@dogsbay/icons 0.2.0-beta.12 → 0.2.0-beta.120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/registry.js +20 -3
- package/package.json +13 -5
package/dist/registry.js
CHANGED
|
@@ -40,6 +40,15 @@ const EMOJI_MAP = {
|
|
|
40
40
|
tada: "🎉", trophy: "🏆", medal: "🏅", crown: "👑",
|
|
41
41
|
image: "🖼️",
|
|
42
42
|
};
|
|
43
|
+
/** Iconify set prefixes → the library (and variant) names this registry uses. */
|
|
44
|
+
const ICONIFY_PREFIX_ALIASES = {
|
|
45
|
+
mdi: { library: "material" },
|
|
46
|
+
"simple-icons": { library: "simple" },
|
|
47
|
+
octicon: { library: "octicons" },
|
|
48
|
+
"fa6-solid": { library: "fontawesome", variant: "solid" },
|
|
49
|
+
"fa6-regular": { library: "fontawesome", variant: "regular" },
|
|
50
|
+
"fa6-brands": { library: "fontawesome", variant: "brands" },
|
|
51
|
+
};
|
|
43
52
|
export class IconRegistry {
|
|
44
53
|
resolvers = new Map();
|
|
45
54
|
emojiMap = new Map(Object.entries(EMOJI_MAP));
|
|
@@ -72,7 +81,11 @@ export class IconRegistry {
|
|
|
72
81
|
if (customResolver) {
|
|
73
82
|
return customResolver.resolve(name, variant, size);
|
|
74
83
|
}
|
|
75
|
-
// Fall back to @iconify/json
|
|
84
|
+
// Fall back to @iconify/json. Iconify's own set prefixes (`mdi:home`, `simple-icons:github`,
|
|
85
|
+
// `fa6-solid:house`, `octicon:repo`) name the same packs as the library names.
|
|
86
|
+
const alias = ICONIFY_PREFIX_ALIASES[library];
|
|
87
|
+
if (alias)
|
|
88
|
+
return this.resolveIconify(alias.library, name, alias.variant ?? variant, size);
|
|
76
89
|
return this.resolveIconify(library, name, variant, size);
|
|
77
90
|
}
|
|
78
91
|
/**
|
|
@@ -134,8 +147,12 @@ export class IconRegistry {
|
|
|
134
147
|
return this.iconifyCache.get(prefix);
|
|
135
148
|
}
|
|
136
149
|
try {
|
|
137
|
-
// Dynamic require to load icon data
|
|
138
|
-
|
|
150
|
+
// Dynamic require to load icon data. We depend on the individual
|
|
151
|
+
// per-set packages (@iconify-json/mdi, …/lucide, etc.) rather than
|
|
152
|
+
// the monolithic @iconify/json (399 MB — the whole catalog) so a
|
|
153
|
+
// consuming site only pulls the ~7 sets we map. The prefix equals
|
|
154
|
+
// the package suffix, and each set ships `icons.json` at its root.
|
|
155
|
+
const { icons, width, height } = require(`@iconify-json/${prefix}/icons.json`);
|
|
139
156
|
const w = width || 24;
|
|
140
157
|
const h = height || 24;
|
|
141
158
|
const result = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dogsbay/icons",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.120",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,11 +13,18 @@
|
|
|
13
13
|
"README.md"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@iconify/
|
|
16
|
+
"@iconify-json/fa6-brands": "^1.2.6",
|
|
17
|
+
"@iconify-json/fa6-regular": "^1.2.4",
|
|
18
|
+
"@iconify-json/fa6-solid": "^1.2.4",
|
|
19
|
+
"@iconify-json/lucide": "^1.2.117",
|
|
20
|
+
"@iconify-json/mdi": "^1.2.3",
|
|
21
|
+
"@iconify-json/octicon": "^1.2.29",
|
|
22
|
+
"@iconify-json/simple-icons": "^1.2.90"
|
|
17
23
|
},
|
|
18
24
|
"devDependencies": {
|
|
19
|
-
"@types/node": "^22.
|
|
20
|
-
"typescript": "^5.
|
|
25
|
+
"@types/node": "^22.20.1",
|
|
26
|
+
"typescript": "^5.9.3",
|
|
27
|
+
"vitest": "^4.1.10"
|
|
21
28
|
},
|
|
22
29
|
"license": "MIT",
|
|
23
30
|
"repository": {
|
|
@@ -30,6 +37,7 @@
|
|
|
30
37
|
"url": "https://github.com/dogsbay/dogsbay/issues"
|
|
31
38
|
},
|
|
32
39
|
"scripts": {
|
|
33
|
-
"build": "tsc"
|
|
40
|
+
"build": "tsc",
|
|
41
|
+
"test": "vitest run"
|
|
34
42
|
}
|
|
35
43
|
}
|