mirror of
https://github.com/iconify/iconify.git
synced 2025-01-07 15:44:05 +00:00
Rebuild Svelte component: component is now a default export, svelte component is used as main export to make it work correctly with SSR
This commit is contained in:
parent
7214c077b4
commit
93c93a3330
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon } from '@iconify/svelte/dist/offline';
|
import Icon from '@iconify/svelte';
|
||||||
import homeIcon from '@iconify-icons/bi/house-door';
|
import homeIcon from '@iconify-icons/bi/house-door';
|
||||||
import blogIcon from '@iconify-icons/bi/file-text';
|
import blogIcon from '@iconify-icons/bi/file-text';
|
||||||
import aboutIcon from '@iconify-icons/bi/question-octagon';
|
import aboutIcon from '@iconify-icons/bi/question-octagon';
|
||||||
|
@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const promises = [
|
const promises = [
|
||||||
import('@iconify/svelte/dist/offline-bundle'),
|
import('@iconify/svelte'),
|
||||||
import('@iconify-icons/bi/link-45deg'),
|
import('@iconify-icons/bi/link-45deg'),
|
||||||
];
|
];
|
||||||
const results = await Promise.all(promises);
|
const results = await Promise.all(promises);
|
||||||
Icon = results[0].Icon;
|
Icon = results[0].default;
|
||||||
postIcon = results[1].default;
|
postIcon = results[1].default;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
// Render icon on server
|
// Render icon on server
|
||||||
import { Icon } from '@iconify/svelte/dist/offline';
|
import Icon from '@iconify/svelte';
|
||||||
import successIcon from '@iconify-icons/openmoji/artist-medium-light-skin-tone';
|
import successIcon from '@iconify-icons/openmoji/artist-medium-light-skin-tone';
|
||||||
|
|
||||||
// Dynamically load icon component, icon data and render it on client side
|
// Dynamically load icon component, icon data and render it on client side
|
||||||
@ -13,11 +13,11 @@
|
|||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
let promises = [
|
let promises = [
|
||||||
import('@iconify/svelte/dist/offline-bundle'),
|
import('@iconify/svelte'),
|
||||||
import('@iconify-icons/openmoji/artist-medium-light-skin-tone'),
|
import('@iconify-icons/openmoji/artist-medium-light-skin-tone'),
|
||||||
];
|
];
|
||||||
const results = await Promise.all(promises);
|
const results = await Promise.all(promises);
|
||||||
Icon = results[0].Icon;
|
Icon = results[0].default;
|
||||||
successIcon = results[1].default;
|
successIcon = results[1].default;
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon } from '@iconify/svelte/dist/offline';
|
import Icon from '@iconify/svelte/dist/offline';
|
||||||
import checkedIcon from '@iconify-icons/uil/check-square';
|
import checkedIcon from '@iconify-icons/uil/check-square';
|
||||||
import uncheckedIcon from '@iconify-icons/uil/square';
|
import uncheckedIcon from '@iconify-icons/uil/square';
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon as OfflineIcon } from '@iconify/svelte/dist/offline';
|
import OfflineIcon from '@iconify/svelte/dist/offline';
|
||||||
import { Icon as FullIcon } from '@iconify/svelte';
|
import FullIcon from '@iconify/svelte';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section class="inline-demo">
|
<section class="inline-demo">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon } from '@iconify/svelte';
|
import Icon from '@iconify/svelte';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section class="icon-24">
|
<section class="icon-24">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon } from '@iconify/svelte';
|
import Icon from '@iconify/svelte';
|
||||||
import accountIcon from '@iconify-icons/mdi-light/account';
|
import accountIcon from '@iconify-icons/mdi-light/account';
|
||||||
import alertIcon from '@iconify-icons/mdi-light/alert';
|
import alertIcon from '@iconify-icons/mdi-light/alert';
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon } from '@iconify/svelte/dist/offline';
|
import Icon from '@iconify/svelte/dist/offline';
|
||||||
import accountIcon from '@iconify-icons/mdi-light/account';
|
import accountIcon from '@iconify-icons/mdi-light/account';
|
||||||
import alertIcon from '@iconify-icons/mdi-light/alert';
|
import alertIcon from '@iconify-icons/mdi-light/alert';
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon } from '@iconify/svelte';
|
import Icon from '@iconify/svelte';
|
||||||
|
|
||||||
const paperclipIcon = 'dashicons:paperclip';
|
const paperclipIcon = 'dashicons:paperclip';
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon } from '@iconify/svelte';
|
import Icon from '@iconify/svelte';
|
||||||
|
|
||||||
const adminUsers = 'dashicons:admin-users';
|
const adminUsers = 'dashicons:admin-users';
|
||||||
const icon1Style = 'color: purple; vertical-align: 0; font-size: 2em;';
|
const icon1Style = 'color: purple; vertical-align: 0; font-size: 2em;';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon } from '@iconify/svelte';
|
import Icon from '@iconify/svelte';
|
||||||
|
|
||||||
const demoIcon = {
|
const demoIcon = {
|
||||||
width: 16,
|
width: 16,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon } from '@iconify/svelte';
|
import Icon from '@iconify/svelte';
|
||||||
|
|
||||||
const adminCustomizer = 'dashicons:admin-customizer';
|
const adminCustomizer = 'dashicons:admin-customizer';
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon } from '@iconify/svelte';
|
import Icon from '@iconify/svelte';
|
||||||
|
|
||||||
const paperclipIcon = 'dashicons:paperclip';
|
const paperclipIcon = 'dashicons:paperclip';
|
||||||
const redIcon = 'color: red;';
|
const redIcon = 'color: red;';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon } from '@iconify/svelte';
|
import Icon from '@iconify/svelte';
|
||||||
|
|
||||||
const paperclipIcon = 'dashicons:paperclip';
|
const paperclipIcon = 'dashicons:paperclip';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
9
packages/svelte/api-extractor.functions.json
Normal file
9
packages/svelte/api-extractor.functions.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
|
"extends": "./api-extractor.json",
|
||||||
|
"mainEntryPointFilePath": "lib/functions.d.ts",
|
||||||
|
"dtsRollup": {
|
||||||
|
"enabled": true,
|
||||||
|
"untrimmedFilePath": "<projectFolder>/dist/functions.d.ts"
|
||||||
|
}
|
||||||
|
}
|
@ -1,45 +1,9 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
|
"extends": "./api-extractor.json",
|
||||||
"mainEntryPointFilePath": "lib/iconify.d.ts",
|
"mainEntryPointFilePath": "lib/iconify.d.ts",
|
||||||
"bundledPackages": [
|
|
||||||
"@iconify/types",
|
|
||||||
"@iconify/core",
|
|
||||||
"@cyberalien/redundancy"
|
|
||||||
],
|
|
||||||
"compiler": {
|
|
||||||
"skipLibCheck": true
|
|
||||||
},
|
|
||||||
"apiReport": {
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
"docModel": {
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
"dtsRollup": {
|
"dtsRollup": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"untrimmedFilePath": "<projectFolder>/dist/iconify.d.ts"
|
"untrimmedFilePath": "<projectFolder>/dist/iconify.d.ts"
|
||||||
},
|
|
||||||
"tsdocMetadata": {
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
"messages": {
|
|
||||||
"compilerMessageReporting": {
|
|
||||||
"default": {
|
|
||||||
"logLevel": "warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"extractorMessageReporting": {
|
|
||||||
"default": {
|
|
||||||
"logLevel": "warning"
|
|
||||||
},
|
|
||||||
"ae-missing-release-tag": {
|
|
||||||
"logLevel": "none"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tsdocMessageReporting": {
|
|
||||||
"default": {
|
|
||||||
"logLevel": "warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
"mainEntryPointFilePath": "lib/offline.d.ts",
|
|
||||||
"bundledPackages": [
|
"bundledPackages": [
|
||||||
"@iconify/types",
|
"@iconify/types",
|
||||||
"@iconify/core",
|
"@iconify/core",
|
||||||
@ -15,10 +14,6 @@
|
|||||||
"docModel": {
|
"docModel": {
|
||||||
"enabled": false
|
"enabled": false
|
||||||
},
|
},
|
||||||
"dtsRollup": {
|
|
||||||
"enabled": true,
|
|
||||||
"untrimmedFilePath": "<projectFolder>/dist/offline.d.ts"
|
|
||||||
},
|
|
||||||
"tsdocMetadata": {
|
"tsdocMetadata": {
|
||||||
"enabled": false
|
"enabled": false
|
||||||
},
|
},
|
9
packages/svelte/api-extractor.offline-functions.json
Normal file
9
packages/svelte/api-extractor.offline-functions.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
|
"extends": "./api-extractor.json",
|
||||||
|
"mainEntryPointFilePath": "lib/offline-functions.d.ts",
|
||||||
|
"dtsRollup": {
|
||||||
|
"enabled": true,
|
||||||
|
"untrimmedFilePath": "<projectFolder>/dist/offline-functions.d.ts"
|
||||||
|
}
|
||||||
|
}
|
9
packages/svelte/api-extractor.offline-iconify.json
Normal file
9
packages/svelte/api-extractor.offline-iconify.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
|
"extends": "./api-extractor.json",
|
||||||
|
"mainEntryPointFilePath": "lib/offline-iconify.d.ts",
|
||||||
|
"dtsRollup": {
|
||||||
|
"enabled": true,
|
||||||
|
"untrimmedFilePath": "<projectFolder>/dist/offline-iconify.d.ts"
|
||||||
|
}
|
||||||
|
}
|
@ -7,13 +7,17 @@ const packagesDir = path.dirname(__dirname);
|
|||||||
// List of commands to run
|
// List of commands to run
|
||||||
const commands = [];
|
const commands = [];
|
||||||
|
|
||||||
|
// api-extractor command line
|
||||||
|
const extractor = (name) =>
|
||||||
|
`api-extractor run --local --verbose --config api-extractor.${name}.json`;
|
||||||
|
|
||||||
// Parse command line
|
// Parse command line
|
||||||
const compile = {
|
const compile = {
|
||||||
core: false,
|
core: false,
|
||||||
tsc: true,
|
tsc: true,
|
||||||
bundles: true,
|
bundles: true,
|
||||||
copy: true,
|
|
||||||
api: true,
|
api: true,
|
||||||
|
finish: true,
|
||||||
};
|
};
|
||||||
process.argv.slice(2).forEach((cmd) => {
|
process.argv.slice(2).forEach((cmd) => {
|
||||||
if (cmd.slice(0, 2) !== '--') {
|
if (cmd.slice(0, 2) !== '--') {
|
||||||
@ -72,23 +76,66 @@ if (compile.core) {
|
|||||||
|
|
||||||
// Compile other packages
|
// Compile other packages
|
||||||
Object.keys(compile).forEach((key) => {
|
Object.keys(compile).forEach((key) => {
|
||||||
if (key !== 'core' && compile[key]) {
|
if (!compile[key]) {
|
||||||
commands.push({
|
return;
|
||||||
cmd: 'npm',
|
}
|
||||||
args: ['run', 'build:' + key],
|
switch (key) {
|
||||||
});
|
case 'core':
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'api':
|
||||||
|
apiFiles().forEach((name) => {
|
||||||
|
const cmd = extractor(name).split(' ');
|
||||||
|
commands.push({
|
||||||
|
cmd: cmd.shift(),
|
||||||
|
args: cmd,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'finish':
|
||||||
|
commands.push(cleanup);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
commands.push({
|
||||||
|
cmd: 'npm',
|
||||||
|
args: ['run', 'build:' + key],
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all api-extractor.*.json files
|
||||||
|
*/
|
||||||
|
function apiFiles() {
|
||||||
|
return fs
|
||||||
|
.readdirSync(__dirname)
|
||||||
|
.map((item) => {
|
||||||
|
const parts = item.split('.');
|
||||||
|
if (parts.pop() !== 'json' || parts.shift() !== 'api-extractor') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return parts.length === 1 ? parts[0] : '';
|
||||||
|
})
|
||||||
|
.filter((item) => item !== '');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run next command
|
* Run next command
|
||||||
*/
|
*/
|
||||||
const next = () => {
|
function next() {
|
||||||
const item = commands.shift();
|
const item = commands.shift();
|
||||||
if (item === void 0) {
|
if (item === void 0) {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof item === 'function') {
|
||||||
|
item();
|
||||||
|
process.nextTick(next);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (item.cwd === void 0) {
|
if (item.cwd === void 0) {
|
||||||
item.cwd = __dirname;
|
item.cwd = __dirname;
|
||||||
}
|
}
|
||||||
@ -103,5 +150,73 @@ const next = () => {
|
|||||||
} else {
|
} else {
|
||||||
process.exit(result.status);
|
process.exit(result.status);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
next();
|
next();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleanup
|
||||||
|
*/
|
||||||
|
function cleanup() {
|
||||||
|
// Merge TypeScript files
|
||||||
|
const sourceDir = __dirname + '/src/';
|
||||||
|
const distDir = __dirname + '/dist/';
|
||||||
|
|
||||||
|
function createTypes() {
|
||||||
|
// Get Svelte file, split it. Import and content should be separated by empty line
|
||||||
|
const svelteParts = fs
|
||||||
|
.readFileSync(sourceDir + 'svelte.d.ts', 'utf8')
|
||||||
|
.trim()
|
||||||
|
.replace(/\r/g, '')
|
||||||
|
.split('\n\n');
|
||||||
|
if (svelteParts.lenght < 2) {
|
||||||
|
throw new Error(
|
||||||
|
'Error parsing svelte.d.ts. Imports and content should be separated by 2 new lines'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const svelteImport = svelteParts.shift() + '\n\n';
|
||||||
|
const svelteContent = '\n\n' + svelteParts.join('\n\n');
|
||||||
|
|
||||||
|
// Merge files
|
||||||
|
[
|
||||||
|
// Full component
|
||||||
|
{
|
||||||
|
source: 'iconify.d.ts',
|
||||||
|
target: 'index.d.ts',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
source: 'iconify.d.ts',
|
||||||
|
target: 'Icon.svelte.d.ts',
|
||||||
|
},
|
||||||
|
// Offline component
|
||||||
|
{
|
||||||
|
source: 'offline-iconify.d.ts',
|
||||||
|
target: 'offline.d.ts',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
source: 'offline-iconify.d.ts',
|
||||||
|
target: 'OfflineIcon.svelte.d.ts',
|
||||||
|
},
|
||||||
|
].forEach((item) => {
|
||||||
|
const content =
|
||||||
|
svelteImport +
|
||||||
|
fs
|
||||||
|
.readFileSync(distDir + item.source, 'utf8')
|
||||||
|
.replace('export { }', '')
|
||||||
|
.trim() +
|
||||||
|
svelteContent;
|
||||||
|
fs.writeFileSync(distDir + item.target, content, 'utf8');
|
||||||
|
console.log(`Created dist/${item.target}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyComponents() {
|
||||||
|
['Icon.svelte', 'OfflineIcon.svelte'].forEach((name) => {
|
||||||
|
const content = fs.readFileSync(sourceDir + name, 'utf8');
|
||||||
|
fs.writeFileSync(distDir + name, content, 'utf8');
|
||||||
|
console.log(`Copied dist/${name}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
createTypes();
|
||||||
|
copyComponents();
|
||||||
|
}
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
// Directories
|
|
||||||
const rootDir = __dirname + '/';
|
|
||||||
const distDir = 'dist';
|
|
||||||
const sourceDir = 'src';
|
|
||||||
const libDir = 'lib';
|
|
||||||
|
|
||||||
// Create lib and dist
|
|
||||||
try {
|
|
||||||
fs.mkdirSync(rootDir + libDir);
|
|
||||||
} catch (err) {}
|
|
||||||
try {
|
|
||||||
fs.mkdirSync(rootDir + distDir);
|
|
||||||
} catch (err) {}
|
|
||||||
|
|
||||||
// Copy Svelte files and definitions to lib
|
|
||||||
// These files are required by api-extractor, not aren't created by tsc
|
|
||||||
[
|
|
||||||
'Icon.svelte',
|
|
||||||
'Icon.svelte.d.ts',
|
|
||||||
'OfflineIcon.svelte',
|
|
||||||
'OfflineIcon.svelte.d.ts',
|
|
||||||
].forEach((file) => {
|
|
||||||
const target = libDir + '/' + file;
|
|
||||||
const source = sourceDir + '/' + file;
|
|
||||||
fs.writeFileSync(rootDir + target, fs.readFileSync(rootDir + source));
|
|
||||||
console.log('copied', source, '->', target);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Copy pre-compiled files
|
|
||||||
// These files should not have imports that don't exist in all 3 directories: src, lib and dest
|
|
||||||
[
|
|
||||||
'Icon.svelte',
|
|
||||||
'Icon.svelte.d.ts',
|
|
||||||
'OfflineIcon.svelte',
|
|
||||||
'OfflineIcon.svelte.d.ts',
|
|
||||||
'iconify.js',
|
|
||||||
'offline.js',
|
|
||||||
].forEach((file) => {
|
|
||||||
const target = distDir + '/' + file;
|
|
||||||
const source = libDir + '/' + file;
|
|
||||||
fs.writeFileSync(rootDir + target, fs.readFileSync(rootDir + source));
|
|
||||||
console.log('copied', source, '->', target);
|
|
||||||
});
|
|
@ -2,7 +2,7 @@
|
|||||||
"name": "@iconify/svelte",
|
"name": "@iconify/svelte",
|
||||||
"description": "Iconify icon component for Svelte.",
|
"description": "Iconify icon component for Svelte.",
|
||||||
"author": "Vjacheslav Trushkin",
|
"author": "Vjacheslav Trushkin",
|
||||||
"version": "2.0.0-alpha.6",
|
"version": "2.0.0-alpha.7",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": "https://github.com/iconify/iconify/issues",
|
"bugs": "https://github.com/iconify/iconify/issues",
|
||||||
"homepage": "https://github.com/iconify/iconify",
|
"homepage": "https://github.com/iconify/iconify",
|
||||||
@ -11,17 +11,15 @@
|
|||||||
"url": "https://github.com/iconify/iconify.git",
|
"url": "https://github.com/iconify/iconify.git",
|
||||||
"directory": "packages/svelte"
|
"directory": "packages/svelte"
|
||||||
},
|
},
|
||||||
"svelte": "dist/iconify.js",
|
"svelte": "dist/Icon.svelte",
|
||||||
"module": "dist/bundle.mjs",
|
"module": "dist/bundle.mjs",
|
||||||
"main": "dist/bundle.js",
|
"main": "dist/bundle.js",
|
||||||
"types": "dist/iconify.d.ts",
|
"types": "dist/bundle.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node build",
|
"build": "node build",
|
||||||
"build:copy": "node copy",
|
|
||||||
"build:tsc": "tsc -b",
|
"build:tsc": "tsc -b",
|
||||||
"build:bundles": "rollup -c rollup.config.js",
|
"build:bundles": "rollup -c rollup.config.js",
|
||||||
"prebuild:api": "api-extractor run --local --verbose --config api-extractor.offline.json",
|
"build:api": "node build --only-api",
|
||||||
"build:api": "api-extractor run --local --verbose --config api-extractor.iconify.json",
|
|
||||||
"pretest": "npm run build",
|
"pretest": "npm run build",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
|
@ -12,10 +12,10 @@ const sourceDir = 'src';
|
|||||||
export default [
|
export default [
|
||||||
// Bundle everything
|
// Bundle everything
|
||||||
{
|
{
|
||||||
input: sourceDir + '/iconify.ts',
|
input: sourceDir + '/Icon.svelte',
|
||||||
output: [
|
output: [
|
||||||
{ file: targetDir + '/bundle.mjs', format: 'es' },
|
{ file: targetDir + '/index.mjs', format: 'es' },
|
||||||
{ file: targetDir + '/bundle.js', format: 'cjs' },
|
{ file: targetDir + '/index.js', format: 'cjs' },
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
svelte({
|
svelte({
|
||||||
@ -29,10 +29,10 @@ export default [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: sourceDir + '/offline.ts',
|
input: sourceDir + '/OfflineIcon.svelte',
|
||||||
output: [
|
output: [
|
||||||
{ file: targetDir + '/offline-bundle.mjs', format: 'es' },
|
{ file: targetDir + '/offline.mjs', format: 'es' },
|
||||||
{ file: targetDir + '/offline-bundle.js', format: 'cjs' },
|
{ file: targetDir + '/offline.js', format: 'cjs' },
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
svelte({
|
svelte({
|
||||||
@ -45,6 +45,7 @@ export default [
|
|||||||
commonjs(),
|
commonjs(),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
// Files included in Icon.svelte as bundle
|
// Files included in Icon.svelte as bundle
|
||||||
{
|
{
|
||||||
input: sourceDir + '/functions.ts',
|
input: sourceDir + '/functions.ts',
|
||||||
|
@ -1,3 +1,40 @@
|
|||||||
|
<script context="module">
|
||||||
|
|
||||||
|
// Export stuff.
|
||||||
|
// Important: duplicate of iconify.ts. When changing exports, they must be changed in both files.
|
||||||
|
import {
|
||||||
|
enableCache,
|
||||||
|
disableCache,
|
||||||
|
iconExists,
|
||||||
|
getIcon,
|
||||||
|
listIcons,
|
||||||
|
addIcon,
|
||||||
|
addCollection,
|
||||||
|
calculateSize,
|
||||||
|
replaceIDs,
|
||||||
|
buildIcon,
|
||||||
|
loadIcons,
|
||||||
|
addAPIProvider,
|
||||||
|
_api
|
||||||
|
} from './functions';
|
||||||
|
|
||||||
|
export {
|
||||||
|
enableCache,
|
||||||
|
disableCache,
|
||||||
|
iconExists,
|
||||||
|
getIcon,
|
||||||
|
listIcons,
|
||||||
|
addIcon,
|
||||||
|
addCollection,
|
||||||
|
calculateSize,
|
||||||
|
replaceIDs,
|
||||||
|
buildIcon,
|
||||||
|
loadIcons,
|
||||||
|
addAPIProvider,
|
||||||
|
_api
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
<script>
|
<script>
|
||||||
import { onMount, onDestroy } from 'svelte';
|
import { onMount, onDestroy } from 'svelte';
|
||||||
import { checkIconState, generateIcon } from './functions';
|
import { checkIconState, generateIcon } from './functions';
|
||||||
|
@ -1,3 +1,18 @@
|
|||||||
|
<script context="module">
|
||||||
|
|
||||||
|
// Export stuff.
|
||||||
|
// Important: duplicate of offline-iconify.ts. When changing exports, they must be changed in both files.
|
||||||
|
import {
|
||||||
|
addIcon,
|
||||||
|
addCollection
|
||||||
|
} from './offline-functions';
|
||||||
|
|
||||||
|
export {
|
||||||
|
addIcon,
|
||||||
|
addCollection
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
<script>
|
<script>
|
||||||
import { generateIcon } from './offline-functions';
|
import { generateIcon } from './offline-functions';
|
||||||
|
|
||||||
|
3
packages/svelte/src/OfflineIcon.svelte.d.ts
vendored
3
packages/svelte/src/OfflineIcon.svelte.d.ts
vendored
@ -1,3 +0,0 @@
|
|||||||
import { SvelteComponent } from 'svelte';
|
|
||||||
|
|
||||||
export default class Icon extends SvelteComponent {}
|
|
@ -42,11 +42,11 @@ export { RawIconCustomisations, IconifyIconBuildResult } from './functions';
|
|||||||
// Browser cache
|
// Browser cache
|
||||||
export { IconifyBrowserCacheType } from './functions';
|
export { IconifyBrowserCacheType } from './functions';
|
||||||
|
|
||||||
// Component and params
|
// Component params
|
||||||
export { default as Icon } from './Icon.svelte';
|
|
||||||
export { IconifyIconOnLoad } from './functions';
|
export { IconifyIconOnLoad } from './functions';
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
|
// Important: duplicate of global exports in Icon.svelte. When changing exports, they must be changed in both files.
|
||||||
export { enableCache, disableCache } from './functions';
|
export { enableCache, disableCache } from './functions';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
@ -10,8 +10,6 @@ export type {
|
|||||||
// Types from props.ts
|
// Types from props.ts
|
||||||
export type { IconifyIconCustomisations, IconProps } from './props';
|
export type { IconifyIconCustomisations, IconProps } from './props';
|
||||||
|
|
||||||
// Component
|
|
||||||
export { default as Icon } from './OfflineIcon.svelte';
|
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
|
// Important: duplicate of global exports in OfflineIcon.svelte. When changing exports, they must be changed in both files.
|
||||||
export { addIcon, addCollection } from './offline-functions';
|
export { addIcon, addCollection } from './offline-functions';
|
@ -1,3 +1,6 @@
|
|||||||
import { SvelteComponent } from 'svelte';
|
import { SvelteComponent } from 'svelte';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Svelte component
|
||||||
|
*/
|
||||||
export default class Icon extends SvelteComponent {}
|
export default class Icon extends SvelteComponent {}
|
@ -1,4 +1,4 @@
|
|||||||
import { loadIcons, iconExists } from '../../dist/iconify';
|
import { loadIcons, iconExists } from '../../dist/';
|
||||||
import { mockAPIData } from '@iconify/core/lib/api/modules/mock';
|
import { mockAPIData } from '@iconify/core/lib/api/modules/mock';
|
||||||
import { provider, nextPrefix } from './load';
|
import { provider, nextPrefix } from './load';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon, loadIcons, iconExists } from '../../dist/iconify';
|
import Icon, { loadIcons, iconExists } from '../../dist/';
|
||||||
import { mockAPIData } from '@iconify/core/lib/api/modules/mock';
|
import { mockAPIData } from '@iconify/core/lib/api/modules/mock';
|
||||||
import { provider, nextPrefix } from './load';
|
import { provider, nextPrefix } from './load';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { iconExists } from '../../dist/iconify';
|
import { iconExists } from '../../dist/';
|
||||||
import { mockAPIData } from '@iconify/core/lib/api/modules/mock';
|
import { mockAPIData } from '@iconify/core/lib/api/modules/mock';
|
||||||
import { provider, nextPrefix } from './load';
|
import { provider, nextPrefix } from './load';
|
||||||
import ChangeIcon from './fixtures/ChangeIcon.svelte';
|
import ChangeIcon from './fixtures/ChangeIcon.svelte';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon } from '../../../dist/iconify';
|
import Icon from '../../../dist/';
|
||||||
|
|
||||||
export let icon1;
|
export let icon1;
|
||||||
export let icon2;
|
export let icon2;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Icon } from '../../../dist/iconify';
|
import Icon from '../../../dist/';
|
||||||
|
|
||||||
export let icon;
|
export let icon;
|
||||||
export let expose;
|
export let expose;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { _api, addAPIProvider } from '../../dist/iconify';
|
import { _api, addAPIProvider } from '../../dist/';
|
||||||
import { mockAPIModule } from '@iconify/core/lib/api/modules/mock';
|
import { mockAPIModule } from '@iconify/core/lib/api/modules/mock';
|
||||||
|
|
||||||
// API provider for tests
|
// API provider for tests
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/iconify';
|
import Icon from '../../dist/';
|
||||||
|
|
||||||
const iconData = {
|
const iconData = {
|
||||||
body:
|
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||||
'<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/iconify';
|
import Icon from '../../dist/';
|
||||||
|
|
||||||
describe('Empty icon', () => {
|
describe('Empty icon', () => {
|
||||||
test('basic test', () => {
|
test('basic test', () => {
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/iconify';
|
import Icon from '../../dist/';
|
||||||
|
|
||||||
const iconData = {
|
const iconData = {
|
||||||
body:
|
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||||
'<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/iconify';
|
import Icon from '../../dist/';
|
||||||
|
|
||||||
const iconData = {
|
const iconData = {
|
||||||
body:
|
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||||
'<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/iconify';
|
import Icon from '../../dist/';
|
||||||
|
|
||||||
const iconDataWithID = {
|
const iconDataWithID = {
|
||||||
body:
|
body: '<defs><path id="ssvg-id-1st-place-medala" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medald" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalf" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalh" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalj" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalm" d="M.93.01h120.55v58.36H.93z"/><path d="M52.849 78.373v-3.908c3.681-.359 6.25-.958 7.703-1.798c1.454-.84 2.54-2.828 3.257-5.962h4.021v40.385h-5.437V78.373h-9.544z" id="ssvg-id-1st-place-medalp"/><linearGradient x1="49.998%" y1="-13.249%" x2="49.998%" y2="90.002%" id="ssvg-id-1st-place-medalb"><stop stop-color="#1E88E5" offset="13.55%"/><stop stop-color="#1565C0" offset="93.8%"/></linearGradient><linearGradient x1="26.648%" y1="2.735%" x2="77.654%" y2="105.978%" id="ssvg-id-1st-place-medalk"><stop stop-color="#64B5F6" offset="13.55%"/><stop stop-color="#2196F3" offset="94.62%"/></linearGradient><radialGradient cx="22.368%" cy="12.5%" fx="22.368%" fy="12.5%" r="95.496%" id="ssvg-id-1st-place-medalo"><stop stop-color="#FFEB3B" offset="29.72%"/><stop stop-color="#FBC02D" offset="95.44%"/></radialGradient></defs><g fill="none" fill-rule="evenodd"><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medalc" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medala"/></mask><path fill="url(#ssvg-id-1st-place-medalb)" fill-rule="nonzero" mask="url(#ssvg-id-1st-place-medalc)" d="M45.44 42.18h31.43l30-48.43H75.44z"/></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medale" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medald"/></mask><g opacity=".2" mask="url(#ssvg-id-1st-place-medale)" fill="#424242" fill-rule="nonzero"><path d="M101.23-3L75.2 39H50.85L77.11-3h24.12zm5.64-3H75.44l-30 48h31.42l30.01-48z"/></g></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medalg" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalf"/></mask><path d="M79 30H43c-4.42 0-8 3.58-8 8v16.04c0 2.17 1.8 3.95 4.02 3.96h.01c2.23-.01 4.97-1.75 4.97-3.96V44c0-1.1.9-2 2-2h30c1.1 0 2 .9 2 2v9.93c0 1.98 2.35 3.68 4.22 4.04c.26.05.52.08.78.08c2.21 0 4-1.79 4-4V38c0-4.42-3.58-8-8-8z" fill="#FDD835" fill-rule="nonzero" mask="url(#ssvg-id-1st-place-medalg)"/></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medali" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalh"/></mask><g opacity=".2" mask="url(#ssvg-id-1st-place-medali)" fill="#424242" fill-rule="nonzero"><path d="M79 32c3.31 0 6 2.69 6 6v16.04A2.006 2.006 0 0 1 82.59 56c-1.18-.23-2.59-1.35-2.59-2.07V44c0-2.21-1.79-4-4-4H46c-2.21 0-4 1.79-4 4v10.04c0 .88-1.64 1.96-2.97 1.96c-1.12-.01-2.03-.89-2.03-1.96V38c0-3.31 2.69-6 6-6h36zm0-2H43c-4.42 0-8 3.58-8 8v16.04c0 2.17 1.8 3.95 4.02 3.96h.01c2.23-.01 4.97-1.75 4.97-3.96V44c0-1.1.9-2 2-2h30c1.1 0 2 .9 2 2v9.93c0 1.98 2.35 3.68 4.22 4.04c.26.05.52.08.78.08c2.21 0 4-1.79 4-4V38c0-4.42-3.58-8-8-8z"/></g></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medall" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalj"/></mask><path fill="url(#ssvg-id-1st-place-medalk)" fill-rule="nonzero" mask="url(#ssvg-id-1st-place-medall)" d="M76.87 42.18H45.44l-30-48.43h31.43z"/></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medaln" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalm"/></mask><g opacity=".2" mask="url(#ssvg-id-1st-place-medaln)" fill="#424242" fill-rule="nonzero"><path d="M45.1-3l26.35 42H47.1L20.86-3H45.1zm1.77-3H15.44l30 48h31.42L46.87-6z"/></g></g><circle fill="url(#ssvg-id-1st-place-medalo)" fill-rule="nonzero" cx="64" cy="86" r="38"/><path d="M64 51c19.3 0 35 15.7 35 35s-15.7 35-35 35s-35-15.7-35-35s15.7-35 35-35zm0-3c-20.99 0-38 17.01-38 38s17.01 38 38 38s38-17.01 38-38s-17.01-38-38-38z" opacity=".2" fill="#424242" fill-rule="nonzero"/><path d="M47.3 63.59h33.4v44.4H47.3z"/><use fill="#000" xlink:href="#ssvg-id-1st-place-medalp"/><use fill="#FFA000" xlink:href="#ssvg-id-1st-place-medalp"/></g>',
|
||||||
'<defs><path id="ssvg-id-1st-place-medala" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medald" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalf" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalh" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalj" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalm" d="M.93.01h120.55v58.36H.93z"/><path d="M52.849 78.373v-3.908c3.681-.359 6.25-.958 7.703-1.798c1.454-.84 2.54-2.828 3.257-5.962h4.021v40.385h-5.437V78.373h-9.544z" id="ssvg-id-1st-place-medalp"/><linearGradient x1="49.998%" y1="-13.249%" x2="49.998%" y2="90.002%" id="ssvg-id-1st-place-medalb"><stop stop-color="#1E88E5" offset="13.55%"/><stop stop-color="#1565C0" offset="93.8%"/></linearGradient><linearGradient x1="26.648%" y1="2.735%" x2="77.654%" y2="105.978%" id="ssvg-id-1st-place-medalk"><stop stop-color="#64B5F6" offset="13.55%"/><stop stop-color="#2196F3" offset="94.62%"/></linearGradient><radialGradient cx="22.368%" cy="12.5%" fx="22.368%" fy="12.5%" r="95.496%" id="ssvg-id-1st-place-medalo"><stop stop-color="#FFEB3B" offset="29.72%"/><stop stop-color="#FBC02D" offset="95.44%"/></radialGradient></defs><g fill="none" fill-rule="evenodd"><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medalc" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medala"/></mask><path fill="url(#ssvg-id-1st-place-medalb)" fill-rule="nonzero" mask="url(#ssvg-id-1st-place-medalc)" d="M45.44 42.18h31.43l30-48.43H75.44z"/></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medale" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medald"/></mask><g opacity=".2" mask="url(#ssvg-id-1st-place-medale)" fill="#424242" fill-rule="nonzero"><path d="M101.23-3L75.2 39H50.85L77.11-3h24.12zm5.64-3H75.44l-30 48h31.42l30.01-48z"/></g></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medalg" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalf"/></mask><path d="M79 30H43c-4.42 0-8 3.58-8 8v16.04c0 2.17 1.8 3.95 4.02 3.96h.01c2.23-.01 4.97-1.75 4.97-3.96V44c0-1.1.9-2 2-2h30c1.1 0 2 .9 2 2v9.93c0 1.98 2.35 3.68 4.22 4.04c.26.05.52.08.78.08c2.21 0 4-1.79 4-4V38c0-4.42-3.58-8-8-8z" fill="#FDD835" fill-rule="nonzero" mask="url(#ssvg-id-1st-place-medalg)"/></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medali" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalh"/></mask><g opacity=".2" mask="url(#ssvg-id-1st-place-medali)" fill="#424242" fill-rule="nonzero"><path d="M79 32c3.31 0 6 2.69 6 6v16.04A2.006 2.006 0 0 1 82.59 56c-1.18-.23-2.59-1.35-2.59-2.07V44c0-2.21-1.79-4-4-4H46c-2.21 0-4 1.79-4 4v10.04c0 .88-1.64 1.96-2.97 1.96c-1.12-.01-2.03-.89-2.03-1.96V38c0-3.31 2.69-6 6-6h36zm0-2H43c-4.42 0-8 3.58-8 8v16.04c0 2.17 1.8 3.95 4.02 3.96h.01c2.23-.01 4.97-1.75 4.97-3.96V44c0-1.1.9-2 2-2h30c1.1 0 2 .9 2 2v9.93c0 1.98 2.35 3.68 4.22 4.04c.26.05.52.08.78.08c2.21 0 4-1.79 4-4V38c0-4.42-3.58-8-8-8z"/></g></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medall" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalj"/></mask><path fill="url(#ssvg-id-1st-place-medalk)" fill-rule="nonzero" mask="url(#ssvg-id-1st-place-medall)" d="M76.87 42.18H45.44l-30-48.43h31.43z"/></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medaln" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalm"/></mask><g opacity=".2" mask="url(#ssvg-id-1st-place-medaln)" fill="#424242" fill-rule="nonzero"><path d="M45.1-3l26.35 42H47.1L20.86-3H45.1zm1.77-3H15.44l30 48h31.42L46.87-6z"/></g></g><circle fill="url(#ssvg-id-1st-place-medalo)" fill-rule="nonzero" cx="64" cy="86" r="38"/><path d="M64 51c19.3 0 35 15.7 35 35s-15.7 35-35 35s-35-15.7-35-35s15.7-35 35-35zm0-3c-20.99 0-38 17.01-38 38s17.01 38 38 38s38-17.01 38-38s-17.01-38-38-38z" opacity=".2" fill="#424242" fill-rule="nonzero"/><path d="M47.3 63.59h33.4v44.4H47.3z"/><use fill="#000" xlink:href="#ssvg-id-1st-place-medalp"/><use fill="#FFA000" xlink:href="#ssvg-id-1st-place-medalp"/></g>',
|
|
||||||
width: 128,
|
width: 128,
|
||||||
height: 128,
|
height: 128,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/iconify';
|
import Icon from '../../dist/';
|
||||||
|
|
||||||
const iconData = {
|
const iconData = {
|
||||||
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/iconify';
|
import Icon from '../../dist/';
|
||||||
|
|
||||||
const iconData = {
|
const iconData = {
|
||||||
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/offline';
|
import Icon from '../../dist/offline';
|
||||||
|
|
||||||
const iconData = {
|
const iconData = {
|
||||||
body:
|
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||||
'<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/iconify';
|
import Icon from '../../dist/offline';
|
||||||
|
|
||||||
describe('Empty icon', () => {
|
describe('Empty icon', () => {
|
||||||
test('basic test', () => {
|
test('basic test', () => {
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/offline';
|
import Icon from '../../dist/offline';
|
||||||
|
|
||||||
const iconData = {
|
const iconData = {
|
||||||
body:
|
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||||
'<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/offline';
|
import Icon from '../../dist/offline';
|
||||||
|
|
||||||
const iconData = {
|
const iconData = {
|
||||||
body:
|
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||||
'<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/offline';
|
import Icon from '../../dist/offline';
|
||||||
|
|
||||||
const iconDataWithID = {
|
const iconDataWithID = {
|
||||||
body:
|
body: '<defs><path id="ssvg-id-1st-place-medala" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medald" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalf" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalh" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalj" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalm" d="M.93.01h120.55v58.36H.93z"/><path d="M52.849 78.373v-3.908c3.681-.359 6.25-.958 7.703-1.798c1.454-.84 2.54-2.828 3.257-5.962h4.021v40.385h-5.437V78.373h-9.544z" id="ssvg-id-1st-place-medalp"/><linearGradient x1="49.998%" y1="-13.249%" x2="49.998%" y2="90.002%" id="ssvg-id-1st-place-medalb"><stop stop-color="#1E88E5" offset="13.55%"/><stop stop-color="#1565C0" offset="93.8%"/></linearGradient><linearGradient x1="26.648%" y1="2.735%" x2="77.654%" y2="105.978%" id="ssvg-id-1st-place-medalk"><stop stop-color="#64B5F6" offset="13.55%"/><stop stop-color="#2196F3" offset="94.62%"/></linearGradient><radialGradient cx="22.368%" cy="12.5%" fx="22.368%" fy="12.5%" r="95.496%" id="ssvg-id-1st-place-medalo"><stop stop-color="#FFEB3B" offset="29.72%"/><stop stop-color="#FBC02D" offset="95.44%"/></radialGradient></defs><g fill="none" fill-rule="evenodd"><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medalc" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medala"/></mask><path fill="url(#ssvg-id-1st-place-medalb)" fill-rule="nonzero" mask="url(#ssvg-id-1st-place-medalc)" d="M45.44 42.18h31.43l30-48.43H75.44z"/></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medale" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medald"/></mask><g opacity=".2" mask="url(#ssvg-id-1st-place-medale)" fill="#424242" fill-rule="nonzero"><path d="M101.23-3L75.2 39H50.85L77.11-3h24.12zm5.64-3H75.44l-30 48h31.42l30.01-48z"/></g></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medalg" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalf"/></mask><path d="M79 30H43c-4.42 0-8 3.58-8 8v16.04c0 2.17 1.8 3.95 4.02 3.96h.01c2.23-.01 4.97-1.75 4.97-3.96V44c0-1.1.9-2 2-2h30c1.1 0 2 .9 2 2v9.93c0 1.98 2.35 3.68 4.22 4.04c.26.05.52.08.78.08c2.21 0 4-1.79 4-4V38c0-4.42-3.58-8-8-8z" fill="#FDD835" fill-rule="nonzero" mask="url(#ssvg-id-1st-place-medalg)"/></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medali" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalh"/></mask><g opacity=".2" mask="url(#ssvg-id-1st-place-medali)" fill="#424242" fill-rule="nonzero"><path d="M79 32c3.31 0 6 2.69 6 6v16.04A2.006 2.006 0 0 1 82.59 56c-1.18-.23-2.59-1.35-2.59-2.07V44c0-2.21-1.79-4-4-4H46c-2.21 0-4 1.79-4 4v10.04c0 .88-1.64 1.96-2.97 1.96c-1.12-.01-2.03-.89-2.03-1.96V38c0-3.31 2.69-6 6-6h36zm0-2H43c-4.42 0-8 3.58-8 8v16.04c0 2.17 1.8 3.95 4.02 3.96h.01c2.23-.01 4.97-1.75 4.97-3.96V44c0-1.1.9-2 2-2h30c1.1 0 2 .9 2 2v9.93c0 1.98 2.35 3.68 4.22 4.04c.26.05.52.08.78.08c2.21 0 4-1.79 4-4V38c0-4.42-3.58-8-8-8z"/></g></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medall" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalj"/></mask><path fill="url(#ssvg-id-1st-place-medalk)" fill-rule="nonzero" mask="url(#ssvg-id-1st-place-medall)" d="M76.87 42.18H45.44l-30-48.43h31.43z"/></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medaln" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalm"/></mask><g opacity=".2" mask="url(#ssvg-id-1st-place-medaln)" fill="#424242" fill-rule="nonzero"><path d="M45.1-3l26.35 42H47.1L20.86-3H45.1zm1.77-3H15.44l30 48h31.42L46.87-6z"/></g></g><circle fill="url(#ssvg-id-1st-place-medalo)" fill-rule="nonzero" cx="64" cy="86" r="38"/><path d="M64 51c19.3 0 35 15.7 35 35s-15.7 35-35 35s-35-15.7-35-35s15.7-35 35-35zm0-3c-20.99 0-38 17.01-38 38s17.01 38 38 38s38-17.01 38-38s-17.01-38-38-38z" opacity=".2" fill="#424242" fill-rule="nonzero"/><path d="M47.3 63.59h33.4v44.4H47.3z"/><use fill="#000" xlink:href="#ssvg-id-1st-place-medalp"/><use fill="#FFA000" xlink:href="#ssvg-id-1st-place-medalp"/></g>',
|
||||||
'<defs><path id="ssvg-id-1st-place-medala" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medald" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalf" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalh" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalj" d="M.93.01h120.55v58.36H.93z"/><path id="ssvg-id-1st-place-medalm" d="M.93.01h120.55v58.36H.93z"/><path d="M52.849 78.373v-3.908c3.681-.359 6.25-.958 7.703-1.798c1.454-.84 2.54-2.828 3.257-5.962h4.021v40.385h-5.437V78.373h-9.544z" id="ssvg-id-1st-place-medalp"/><linearGradient x1="49.998%" y1="-13.249%" x2="49.998%" y2="90.002%" id="ssvg-id-1st-place-medalb"><stop stop-color="#1E88E5" offset="13.55%"/><stop stop-color="#1565C0" offset="93.8%"/></linearGradient><linearGradient x1="26.648%" y1="2.735%" x2="77.654%" y2="105.978%" id="ssvg-id-1st-place-medalk"><stop stop-color="#64B5F6" offset="13.55%"/><stop stop-color="#2196F3" offset="94.62%"/></linearGradient><radialGradient cx="22.368%" cy="12.5%" fx="22.368%" fy="12.5%" r="95.496%" id="ssvg-id-1st-place-medalo"><stop stop-color="#FFEB3B" offset="29.72%"/><stop stop-color="#FBC02D" offset="95.44%"/></radialGradient></defs><g fill="none" fill-rule="evenodd"><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medalc" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medala"/></mask><path fill="url(#ssvg-id-1st-place-medalb)" fill-rule="nonzero" mask="url(#ssvg-id-1st-place-medalc)" d="M45.44 42.18h31.43l30-48.43H75.44z"/></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medale" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medald"/></mask><g opacity=".2" mask="url(#ssvg-id-1st-place-medale)" fill="#424242" fill-rule="nonzero"><path d="M101.23-3L75.2 39H50.85L77.11-3h24.12zm5.64-3H75.44l-30 48h31.42l30.01-48z"/></g></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medalg" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalf"/></mask><path d="M79 30H43c-4.42 0-8 3.58-8 8v16.04c0 2.17 1.8 3.95 4.02 3.96h.01c2.23-.01 4.97-1.75 4.97-3.96V44c0-1.1.9-2 2-2h30c1.1 0 2 .9 2 2v9.93c0 1.98 2.35 3.68 4.22 4.04c.26.05.52.08.78.08c2.21 0 4-1.79 4-4V38c0-4.42-3.58-8-8-8z" fill="#FDD835" fill-rule="nonzero" mask="url(#ssvg-id-1st-place-medalg)"/></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medali" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalh"/></mask><g opacity=".2" mask="url(#ssvg-id-1st-place-medali)" fill="#424242" fill-rule="nonzero"><path d="M79 32c3.31 0 6 2.69 6 6v16.04A2.006 2.006 0 0 1 82.59 56c-1.18-.23-2.59-1.35-2.59-2.07V44c0-2.21-1.79-4-4-4H46c-2.21 0-4 1.79-4 4v10.04c0 .88-1.64 1.96-2.97 1.96c-1.12-.01-2.03-.89-2.03-1.96V38c0-3.31 2.69-6 6-6h36zm0-2H43c-4.42 0-8 3.58-8 8v16.04c0 2.17 1.8 3.95 4.02 3.96h.01c2.23-.01 4.97-1.75 4.97-3.96V44c0-1.1.9-2 2-2h30c1.1 0 2 .9 2 2v9.93c0 1.98 2.35 3.68 4.22 4.04c.26.05.52.08.78.08c2.21 0 4-1.79 4-4V38c0-4.42-3.58-8-8-8z"/></g></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medall" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalj"/></mask><path fill="url(#ssvg-id-1st-place-medalk)" fill-rule="nonzero" mask="url(#ssvg-id-1st-place-medall)" d="M76.87 42.18H45.44l-30-48.43h31.43z"/></g><g transform="translate(3 4)"><mask id="ssvg-id-1st-place-medaln" fill="#fff"><use xlink:href="#ssvg-id-1st-place-medalm"/></mask><g opacity=".2" mask="url(#ssvg-id-1st-place-medaln)" fill="#424242" fill-rule="nonzero"><path d="M45.1-3l26.35 42H47.1L20.86-3H45.1zm1.77-3H15.44l30 48h31.42L46.87-6z"/></g></g><circle fill="url(#ssvg-id-1st-place-medalo)" fill-rule="nonzero" cx="64" cy="86" r="38"/><path d="M64 51c19.3 0 35 15.7 35 35s-15.7 35-35 35s-35-15.7-35-35s15.7-35 35-35zm0-3c-20.99 0-38 17.01-38 38s17.01 38 38 38s38-17.01 38-38s-17.01-38-38-38z" opacity=".2" fill="#424242" fill-rule="nonzero"/><path d="M47.3 63.59h33.4v44.4H47.3z"/><use fill="#000" xlink:href="#ssvg-id-1st-place-medalp"/><use fill="#FFA000" xlink:href="#ssvg-id-1st-place-medalp"/></g>',
|
|
||||||
width: 128,
|
width: 128,
|
||||||
height: 128,
|
height: 128,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/offline';
|
import Icon from '../../dist/offline';
|
||||||
|
|
||||||
const iconData = {
|
const iconData = {
|
||||||
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon, addIcon, addCollection } from '../../dist/offline';
|
import Icon, { addIcon, addCollection } from '../../dist/offline';
|
||||||
|
|
||||||
const iconData = {
|
const iconData = {
|
||||||
body:
|
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||||
'<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
|
||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
};
|
};
|
||||||
@ -26,12 +25,10 @@ describe('Using storage', () => {
|
|||||||
prefix: 'mdi-light',
|
prefix: 'mdi-light',
|
||||||
icons: {
|
icons: {
|
||||||
account: {
|
account: {
|
||||||
body:
|
body: '<path d="M11.5 14c4.142 0 7.5 1.567 7.5 3.5V20H4v-2.5c0-1.933 3.358-3.5 7.5-3.5zm6.5 3.5c0-1.38-2.91-2.5-6.5-2.5S5 16.12 5 17.5V19h13v-1.5zM11.5 5a3.5 3.5 0 1 1 0 7a3.5 3.5 0 0 1 0-7zm0 1a2.5 2.5 0 1 0 0 5a2.5 2.5 0 0 0 0-5z" fill="currentColor"/>',
|
||||||
'<path d="M11.5 14c4.142 0 7.5 1.567 7.5 3.5V20H4v-2.5c0-1.933 3.358-3.5 7.5-3.5zm6.5 3.5c0-1.38-2.91-2.5-6.5-2.5S5 16.12 5 17.5V19h13v-1.5zM11.5 5a3.5 3.5 0 1 1 0 7a3.5 3.5 0 0 1 0-7zm0 1a2.5 2.5 0 1 0 0 5a2.5 2.5 0 0 0 0-5z" fill="currentColor"/>',
|
|
||||||
},
|
},
|
||||||
home: {
|
home: {
|
||||||
body:
|
body: '<path d="M16 8.414l-4.5-4.5L4.414 11H6v8h3v-6h5v6h3v-8h1.586L17 9.414V6h-1v2.414zM2 12l9.5-9.5L15 6V5h3v4l3 3h-3v7.998h-5v-6h-3v6H5V12H2z" fill="currentColor"/>',
|
||||||
'<path d="M16 8.414l-4.5-4.5L4.414 11H6v8h3v-6h5v6h3v-8h1.586L17 9.414V6h-1v2.414zM2 12l9.5-9.5L15 6V5h3v4l3 3h-3v7.998h-5v-6h-3v6H5V12H2z" fill="currentColor"/>',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
width: 24,
|
width: 24,
|
||||||
@ -54,12 +51,10 @@ describe('Using storage', () => {
|
|||||||
prefix: 'mdi-light',
|
prefix: 'mdi-light',
|
||||||
icons: {
|
icons: {
|
||||||
'account-alert': {
|
'account-alert': {
|
||||||
body:
|
body: '<path d="M10.5 14c4.142 0 7.5 1.567 7.5 3.5V20H3v-2.5c0-1.933 3.358-3.5 7.5-3.5zm6.5 3.5c0-1.38-2.91-2.5-6.5-2.5S4 16.12 4 17.5V19h13v-1.5zM10.5 5a3.5 3.5 0 1 1 0 7a3.5 3.5 0 0 1 0-7zm0 1a2.5 2.5 0 1 0 0 5a2.5 2.5 0 0 0 0-5zM20 16v-1h1v1h-1zm0-3V7h1v6h-1z" fill="currentColor"/>',
|
||||||
'<path d="M10.5 14c4.142 0 7.5 1.567 7.5 3.5V20H3v-2.5c0-1.933 3.358-3.5 7.5-3.5zm6.5 3.5c0-1.38-2.91-2.5-6.5-2.5S4 16.12 4 17.5V19h13v-1.5zM10.5 5a3.5 3.5 0 1 1 0 7a3.5 3.5 0 0 1 0-7zm0 1a2.5 2.5 0 1 0 0 5a2.5 2.5 0 0 0 0-5zM20 16v-1h1v1h-1zm0-3V7h1v6h-1z" fill="currentColor"/>',
|
|
||||||
},
|
},
|
||||||
'link': {
|
'link': {
|
||||||
body:
|
body: '<path d="M8 13v-1h7v1H8zm7.5-6a5.5 5.5 0 1 1 0 11H13v-1h2.5a4.5 4.5 0 1 0 0-9H13V7h2.5zm-8 11a5.5 5.5 0 1 1 0-11H10v1H7.5a4.5 4.5 0 1 0 0 9H10v1H7.5z" fill="currentColor"/>',
|
||||||
'<path d="M8 13v-1h7v1H8zm7.5-6a5.5 5.5 0 1 1 0 11H13v-1h2.5a4.5 4.5 0 1 0 0-9H13V7h2.5zm-8 11a5.5 5.5 0 1 1 0-11H10v1H7.5a4.5 4.5 0 1 0 0 9H10v1H7.5z" fill="currentColor"/>',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
width: 24,
|
width: 24,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/svelte';
|
import { render } from '@testing-library/svelte';
|
||||||
import { Icon } from '../../dist/offline';
|
import Icon from '../../dist/offline';
|
||||||
|
|
||||||
const iconData = {
|
const iconData = {
|
||||||
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||||
|
Loading…
Reference in New Issue
Block a user