fix: starter template icons fix and auto resize of custon icons are reverted (#1298)
Browse files* fix: starter template icons fix and auto resize of custon icons are reverted
* fix: slidev icon revert
- icons/slidev.svg +1 -3
- package.json +1 -2
- pnpm-lock.yaml +0 -0
- uno.config.ts +14 -63
icons/slidev.svg
CHANGED
|
|
package.json
CHANGED
@@ -65,7 +65,7 @@
|
|
65 |
"@radix-ui/react-collapsible": "^1.0.3",
|
66 |
"@radix-ui/react-context-menu": "^2.2.2",
|
67 |
"@radix-ui/react-dialog": "^1.1.5",
|
68 |
-
"@radix-ui/react-dropdown-menu": "^2.1.
|
69 |
"@radix-ui/react-label": "^2.1.1",
|
70 |
"@radix-ui/react-popover": "^1.1.5",
|
71 |
"@radix-ui/react-progress": "^1.0.3",
|
@@ -104,7 +104,6 @@
|
|
104 |
"jspdf": "^2.5.2",
|
105 |
"jszip": "^3.10.1",
|
106 |
"nanostores": "^0.10.3",
|
107 |
-
"next": "^15.1.5",
|
108 |
"ollama-ai-provider": "^0.15.2",
|
109 |
"path-browserify": "^1.0.1",
|
110 |
"react": "^18.3.1",
|
|
|
65 |
"@radix-ui/react-collapsible": "^1.0.3",
|
66 |
"@radix-ui/react-context-menu": "^2.2.2",
|
67 |
"@radix-ui/react-dialog": "^1.1.5",
|
68 |
+
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
69 |
"@radix-ui/react-label": "^2.1.1",
|
70 |
"@radix-ui/react-popover": "^1.1.5",
|
71 |
"@radix-ui/react-progress": "^1.0.3",
|
|
|
104 |
"jspdf": "^2.5.2",
|
105 |
"jszip": "^3.10.1",
|
106 |
"nanostores": "^0.10.3",
|
|
|
107 |
"ollama-ai-provider": "^0.15.2",
|
108 |
"path-browserify": "^1.0.1",
|
109 |
"react": "^18.3.1",
|
pnpm-lock.yaml
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
uno.config.ts
CHANGED
@@ -1,52 +1,23 @@
|
|
1 |
import { globSync } from 'fast-glob';
|
2 |
import fs from 'node:fs/promises';
|
3 |
-
import { basename
|
4 |
import { defineConfig, presetIcons, presetUno, transformerDirectives } from 'unocss';
|
5 |
-
import type { IconifyJSON } from '@iconify/types';
|
6 |
|
7 |
-
|
8 |
-
console.log('CWD:', process.cwd());
|
9 |
-
|
10 |
-
// Use resolve to get absolute path and normalize slashes
|
11 |
-
const iconsDir = resolve(process.cwd(), 'icons');
|
12 |
-
const iconPaths = globSync('*.svg', {
|
13 |
-
cwd: iconsDir,
|
14 |
-
absolute: true,
|
15 |
-
onlyFiles: true,
|
16 |
-
});
|
17 |
-
|
18 |
-
console.log('Found icons:', iconPaths);
|
19 |
|
20 |
const collectionName = 'bolt';
|
21 |
|
22 |
-
const customIconCollection =
|
23 |
-
|
24 |
-
(
|
25 |
-
const [iconName] = basename(iconPath).split('.');
|
26 |
-
console.log(`Loading icon: ${iconName} from ${iconPath}`); // Debug log
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
const content = await fs.readFile(iconPath, 'utf8');
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
.replace(/width="[^"]*"/g, 'width="24"')
|
37 |
-
.replace(/height="[^"]*"/g, 'height="24"')
|
38 |
-
.replace(/viewBox="[^"]*"/g, 'viewBox="0 0 24 24"');
|
39 |
-
} catch (error) {
|
40 |
-
console.error(`Error loading icon ${iconName}:`, error);
|
41 |
-
return '';
|
42 |
-
}
|
43 |
-
};
|
44 |
-
|
45 |
-
return acc;
|
46 |
-
},
|
47 |
-
{} as Record<string, () => Promise<string>>,
|
48 |
-
),
|
49 |
-
};
|
50 |
|
51 |
const BASE_COLORS = {
|
52 |
white: '#FFFFFF',
|
@@ -128,9 +99,7 @@ const COLOR_PRIMITIVES = {
|
|
128 |
|
129 |
export default defineConfig({
|
130 |
safelist: [
|
131 |
-
|
132 |
-
...Object.keys(customIconCollection[collectionName] || {}).map((x) => `i-${collectionName}-${x}`),
|
133 |
-
...Object.keys(customIconCollection[collectionName] || {}).map((x) => `i-${collectionName}:${x}`),
|
134 |
],
|
135 |
shortcuts: {
|
136 |
'bolt-ease-cubic-bezier': 'ease-[cubic-bezier(0.4,0,0.2,1)]',
|
@@ -273,27 +242,9 @@ export default defineConfig({
|
|
273 |
presetIcons({
|
274 |
warn: true,
|
275 |
collections: {
|
276 |
-
|
277 |
-
ph: async () => {
|
278 |
-
const icons = await import('@iconify-json/ph/icons.json');
|
279 |
-
return icons.default as IconifyJSON;
|
280 |
-
},
|
281 |
-
},
|
282 |
-
extraProperties: {
|
283 |
-
display: 'inline-block',
|
284 |
-
'vertical-align': 'middle',
|
285 |
-
width: '24px',
|
286 |
-
height: '24px',
|
287 |
-
},
|
288 |
-
customizations: {
|
289 |
-
customize(props) {
|
290 |
-
return {
|
291 |
-
...props,
|
292 |
-
width: '24px',
|
293 |
-
height: '24px',
|
294 |
-
};
|
295 |
-
},
|
296 |
},
|
|
|
297 |
}),
|
298 |
],
|
299 |
});
|
|
|
1 |
import { globSync } from 'fast-glob';
|
2 |
import fs from 'node:fs/promises';
|
3 |
+
import { basename } from 'node:path';
|
4 |
import { defineConfig, presetIcons, presetUno, transformerDirectives } from 'unocss';
|
|
|
5 |
|
6 |
+
const iconPaths = globSync('./icons/*.svg');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
const collectionName = 'bolt';
|
9 |
|
10 |
+
const customIconCollection = iconPaths.reduce(
|
11 |
+
(acc, iconPath) => {
|
12 |
+
const [iconName] = basename(iconPath).split('.');
|
|
|
|
|
13 |
|
14 |
+
acc[collectionName] ??= {};
|
15 |
+
acc[collectionName][iconName] = async () => fs.readFile(iconPath, 'utf8');
|
|
|
16 |
|
17 |
+
return acc;
|
18 |
+
},
|
19 |
+
{} as Record<string, Record<string, () => Promise<string>>>,
|
20 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
const BASE_COLORS = {
|
23 |
white: '#FFFFFF',
|
|
|
99 |
|
100 |
export default defineConfig({
|
101 |
safelist: [
|
102 |
+
...Object.keys(customIconCollection[collectionName] || {}).map(x => `i-bolt:${x}`)
|
|
|
|
|
103 |
],
|
104 |
shortcuts: {
|
105 |
'bolt-ease-cubic-bezier': 'ease-[cubic-bezier(0.4,0,0.2,1)]',
|
|
|
242 |
presetIcons({
|
243 |
warn: true,
|
244 |
collections: {
|
245 |
+
...customIconCollection,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
},
|
247 |
+
unit: 'em',
|
248 |
}),
|
249 |
],
|
250 |
});
|