Skip to content

Commit

Permalink
chore: update dependencies, remove sveltekit demo
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberalien committed Aug 4, 2024
1 parent 858c174 commit 89052a0
Show file tree
Hide file tree
Showing 44 changed files with 5,354 additions and 18,025 deletions.
4 changes: 2 additions & 2 deletions @iconify-demo/doc-samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@iconify/tools": "workspace:^"
},
"devDependencies": {
"@types/node": "^20.11.17",
"typescript": "^5.3.3"
"@types/node": "^20.14.14",
"typescript": "^5.5.4"
}
}
4 changes: 2 additions & 2 deletions @iconify-demo/mdi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@iconify/tools": "workspace:^"
},
"devDependencies": {
"@types/node": "^20.11.17",
"typescript": "^5.3.3"
"@types/node": "^20.14.14",
"typescript": "^5.5.4"
}
}
18 changes: 9 additions & 9 deletions @iconify-demo/unocss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@iconify/tools": "workspace:^",
"@unocss/reset": "^0.58.5",
"vue": "^3.4.18"
"@unocss/reset": "^0.61.9",
"vue": "^3.4.35"
},
"devDependencies": {
"@antfu/ni": "^0.21.12",
"@iconify-json/carbon": "^1.1.29",
"@iconify-json/carbon": "^1.1.36",
"@iconify/types": "^2.0.0",
"@iconify/utils": "^2.1.22",
"@types/node": "^20.11.17",
"@iconify/utils": "^2.1.29",
"@types/node": "^20.14.14",
"@vitejs/plugin-vue": "^4.6.2",
"typescript": "^5.3.3",
"unocss": "^0.58.5",
"vite": "^5.1.1",
"typescript": "^5.5.4",
"unocss": "^0.61.9",
"vite": "^5.3.5",
"vue-tsc": "^1.8.27"
}
}
2 changes: 1 addition & 1 deletion @iconify-demo/unocss/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class="i-custom-svg:loading text-blue-600 hover:text-red-600 icon24 inline-icon"
></span>
<span
class="i-custom-svg:loadin2 text-blue-600 hover:text-red-600 icon24 inline-icon"
class="i-custom-svg:loading2 text-blue-600 hover:text-red-600 icon24 inline-icon"
></span>
</p>
</div>
Expand Down
83 changes: 36 additions & 47 deletions @iconify-demo/unocss/unocss.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { promises as fs } from 'node:fs';
import { defineConfig, presetIcons, presetUno } from 'unocss';
import { compareColors, stringToColor } from '@iconify/utils/lib/colors';
import type { IconSet } from '@iconify/tools';
import {
deOptimisePaths,
importDirectory,
importDirectorySync,
parseColors,
runSVGO,
} from '@iconify/tools';
Expand All @@ -13,62 +12,52 @@ import type { CustomIconLoader } from '@iconify/utils/lib/loader/types';
/**
* Load custom icon set
*/
function loadCustomIconSet(): CustomIconLoader {
const promise = new Promise<IconSet>((resolve, reject) => {
importDirectory('assets/svg', {
prefix: 'svg',
}).then((iconSet) => {
// Parse all icons: optimise, clean up palette
iconSet
.forEachSync((name) => {
const svg = iconSet.toSVG(name)!;
function loadCustomIconSet() {
// Load icon set
const iconSet = importDirectorySync('assets/svg', {
prefix: 'svg',
});

// Change color to `currentColor`
const blackColor = stringToColor('black')!;
// Parse all icons: optimise, clean up palette
iconSet.forEachSync((name) => {
const svg = iconSet.toSVG(name)!;

parseColors(svg, {
defaultColor: 'currentColor',
callback: (attr, colorStr, color) => {
// console.log('Color:', colorStr, color);
// Change color to `currentColor`
const blackColor = stringToColor('black')!;

// Change black to 'currentColor'
if (color && compareColors(color, blackColor))
return 'currentColor';
parseColors(svg, {
defaultColor: 'currentColor',
callback: (attr, colorStr, color) => {
// console.log('Color:', colorStr, color);

switch (color?.type) {
case 'none':
case 'current':
return color;
}
// Change black to 'currentColor'
if (color && compareColors(color, blackColor))
return 'currentColor';

throw new Error(
`Unexpected color "${colorStr}" in attribute ${attr}`
);
},
});
switch (color?.type) {
case 'none':
case 'current':
return color;
}

// Optimise
runSVGO(svg);
throw new Error(
`Unexpected color "${colorStr}" in attribute ${attr}`
);
},
});

// Update paths for compatibility with old software
deOptimisePaths(svg);
// Optimise
runSVGO(svg);

// Update icon in icon set
iconSet.fromSVG(name, svg);
});
// Update paths for compatibility with old software
deOptimisePaths(svg);

// Resolve with icon set
resolve(iconSet);

}).catch((err) => {
reject(err);
});
// Update icon in icon set
iconSet.fromSVG(name, svg);
});

return async (name) => {
const iconSet = await promise;
return iconSet.toSVG(name)?.toMinifiedString();
};
// Return as function
return () => iconSet.export();
}

/**
Expand Down
12 changes: 0 additions & 12 deletions @iconify-demo/unplugin-svelte/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion @iconify-demo/unplugin-svelte/.npmrc

This file was deleted.

38 changes: 0 additions & 38 deletions @iconify-demo/unplugin-svelte/README.md

This file was deleted.

5 changes: 0 additions & 5 deletions @iconify-demo/unplugin-svelte/assets/svg-animated/loading.svg

This file was deleted.

14 changes: 0 additions & 14 deletions @iconify-demo/unplugin-svelte/assets/svg-animated/loading2.svg

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion @iconify-demo/unplugin-svelte/assets/svg-ion/build.svg

This file was deleted.

28 changes: 0 additions & 28 deletions @iconify-demo/unplugin-svelte/package.json

This file was deleted.

9 changes: 0 additions & 9 deletions @iconify-demo/unplugin-svelte/src/app.d.ts

This file was deleted.

12 changes: 0 additions & 12 deletions @iconify-demo/unplugin-svelte/src/app.html

This file was deleted.

16 changes: 0 additions & 16 deletions @iconify-demo/unplugin-svelte/src/lib/images/github.svg

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
53 changes: 0 additions & 53 deletions @iconify-demo/unplugin-svelte/src/routes/+layout.svelte

This file was deleted.

Loading

0 comments on commit 89052a0

Please sign in to comment.