@robosophy/ui-vue 1.0.10 → 1.0.12
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/README.md +13 -0
- package/components.md +13 -0
- package/dist/components/RsAccountSelector/RsAccountSelector.vue.d.ts.map +1 -1
- package/dist/index.css +752 -1
- package/dist/index.js +696 -487
- package/dist/index.js.map +1 -1
- package/dist/vite.d.ts +1 -0
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +282 -208
- package/dist/vite.js.map +1 -1
- package/package.json +1 -1
package/dist/vite.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { createHash
|
|
2
|
-
import { readFile
|
|
3
|
-
import { join
|
|
4
|
-
import { createRequire
|
|
5
|
-
import { fileURLToPath
|
|
6
|
-
const
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readFile, readdir } from "node:fs/promises";
|
|
3
|
+
import { join, extname, sep } from "node:path";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
const families = ["outlined", "rounded", "sharp"];
|
|
7
|
+
const defaultFamily = "outlined";
|
|
8
|
+
const iconNamePattern = /^[a-z0-9_]+$/;
|
|
9
|
+
const sourceExtensions = /* @__PURE__ */ new Set([".js", ".jsx", ".mjs", ".ts", ".tsx", ".vue"]);
|
|
10
|
+
const skippedDirs = /* @__PURE__ */ new Set([".git", "dist", "node_modules", "storybook-static"]);
|
|
11
|
+
const internalIconNames = [
|
|
7
12
|
"arrow_drop_down",
|
|
8
13
|
"arrow_drop_up",
|
|
9
14
|
"arrow_left",
|
|
@@ -11,128 +16,159 @@ const f = ["outlined", "rounded", "sharp"], p = "outlined", b = /^[a-z0-9_]+$/,
|
|
|
11
16
|
"close",
|
|
12
17
|
"login",
|
|
13
18
|
"nest_eco_leaf"
|
|
14
|
-
]
|
|
19
|
+
];
|
|
20
|
+
const familyFontNames = {
|
|
15
21
|
outlined: "Material Symbols Outlined Variable",
|
|
16
22
|
rounded: "Material Symbols Rounded Variable",
|
|
17
23
|
sharp: "Material Symbols Sharp Variable"
|
|
18
|
-
}
|
|
24
|
+
};
|
|
25
|
+
const familyPackages = {
|
|
19
26
|
outlined: "@fontsource-variable/material-symbols-outlined",
|
|
20
27
|
rounded: "@fontsource-variable/material-symbols-rounded",
|
|
21
28
|
sharp: "@fontsource-variable/material-symbols-sharp"
|
|
22
|
-
}
|
|
29
|
+
};
|
|
30
|
+
const familyFontVariants = {
|
|
23
31
|
outlined: "wght",
|
|
24
32
|
rounded: "wght",
|
|
25
33
|
sharp: "wght"
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
};
|
|
35
|
+
const defaultFontDisplay = "swap";
|
|
36
|
+
const defaultPreload = false;
|
|
37
|
+
const require$1 = createRequire(import.meta.url);
|
|
38
|
+
function robosophyMaterialSymbols(options = {}) {
|
|
39
|
+
const raw = (options.outputDir ?? "").trim().replace(/^\/+/, "");
|
|
40
|
+
const outputDir = raw.split("/").filter((part) => part && part !== "..").join("/") || "assets";
|
|
41
|
+
let config;
|
|
42
|
+
let cachedAssets = null;
|
|
43
|
+
let cacheValid = false;
|
|
44
|
+
async function getAssets() {
|
|
45
|
+
if (cacheValid && cachedAssets) return cachedAssets;
|
|
46
|
+
cachedAssets = await ensureGeneratedAssets(config, options, outputDir);
|
|
47
|
+
cacheValid = true;
|
|
48
|
+
return cachedAssets;
|
|
31
49
|
}
|
|
32
50
|
return {
|
|
33
51
|
name: "robosophy-material-symbols",
|
|
34
|
-
async configResolved(
|
|
35
|
-
|
|
52
|
+
async configResolved(resolvedConfig) {
|
|
53
|
+
config = resolvedConfig;
|
|
36
54
|
},
|
|
37
55
|
async transformIndexHtml() {
|
|
38
|
-
const
|
|
39
|
-
return
|
|
56
|
+
const assets = await getAssets();
|
|
57
|
+
return buildMaterialSymbolsHtmlTags(assets, options);
|
|
40
58
|
},
|
|
41
|
-
configureServer(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
59
|
+
configureServer(server) {
|
|
60
|
+
server.watcher.on("all", (_event, file) => {
|
|
61
|
+
if (sourceExtensions.has(extname(file))) {
|
|
62
|
+
cacheValid = false;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
server.middlewares.use(async (request, response, next) => {
|
|
66
|
+
if (!request.url?.startsWith("/@robosophy-material-symbols/")) {
|
|
67
|
+
next();
|
|
47
68
|
return;
|
|
48
69
|
}
|
|
49
70
|
try {
|
|
50
|
-
const
|
|
51
|
-
|
|
71
|
+
const assets = await getAssets();
|
|
72
|
+
const fileName = decodeURIComponent(
|
|
73
|
+
request.url.replace("/@robosophy-material-symbols/", "").split("?")[0] ?? ""
|
|
52
74
|
);
|
|
53
|
-
if (
|
|
54
|
-
|
|
75
|
+
if (fileName === "rs-material-symbols.css") {
|
|
76
|
+
response.setHeader("Content-Type", "text/css; charset=utf-8");
|
|
77
|
+
response.end(assets.css);
|
|
55
78
|
return;
|
|
56
79
|
}
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
|
|
80
|
+
const font = assets.fonts.find((asset) => asset.fileName === fileName);
|
|
81
|
+
if (font) {
|
|
82
|
+
response.setHeader("Content-Type", "font/woff2");
|
|
83
|
+
response.end(font.source);
|
|
60
84
|
return;
|
|
61
85
|
}
|
|
62
|
-
|
|
63
|
-
} catch (
|
|
64
|
-
|
|
86
|
+
next();
|
|
87
|
+
} catch (error) {
|
|
88
|
+
next(error);
|
|
65
89
|
}
|
|
66
90
|
});
|
|
67
91
|
},
|
|
68
|
-
async generateBundle(
|
|
69
|
-
const
|
|
70
|
-
for (const
|
|
92
|
+
async generateBundle(_outputOptions, bundle) {
|
|
93
|
+
const assets = await getAssets();
|
|
94
|
+
for (const font of assets.fonts) {
|
|
71
95
|
this.emitFile({
|
|
72
|
-
fileName:
|
|
73
|
-
name:
|
|
74
|
-
source:
|
|
96
|
+
fileName: `${outputDir}/${font.fileName}`,
|
|
97
|
+
name: font.fileName,
|
|
98
|
+
source: font.source,
|
|
75
99
|
type: "asset"
|
|
76
100
|
});
|
|
101
|
+
}
|
|
77
102
|
this.emitFile({
|
|
78
|
-
fileName:
|
|
103
|
+
fileName: `${outputDir}/rs-material-symbols.css`,
|
|
79
104
|
name: "rs-material-symbols.css",
|
|
80
|
-
source:
|
|
105
|
+
source: assets.css,
|
|
81
106
|
type: "asset"
|
|
82
107
|
});
|
|
83
108
|
}
|
|
84
109
|
};
|
|
85
110
|
}
|
|
86
|
-
async function
|
|
87
|
-
const
|
|
111
|
+
async function ensureGeneratedAssets(config, options, outputDir) {
|
|
112
|
+
const usages = await collectMaterialSymbolUsages(config, options);
|
|
113
|
+
const devMode = config.command === "serve";
|
|
114
|
+
const fonts = await generateFontAssets(usages, devMode, config.base, outputDir);
|
|
115
|
+
const css = buildMaterialSymbolsCss(
|
|
116
|
+
usages,
|
|
117
|
+
fonts,
|
|
118
|
+
devMode,
|
|
119
|
+
options.fontDisplay ?? defaultFontDisplay
|
|
120
|
+
);
|
|
88
121
|
return {
|
|
89
|
-
css
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
s,
|
|
93
|
-
e.fontDisplay ?? j
|
|
94
|
-
),
|
|
95
|
-
cssHref: s ? "/@robosophy-material-symbols/rs-material-symbols.css" : _(t.base, "assets/rs-material-symbols.css"),
|
|
96
|
-
fonts: o
|
|
122
|
+
css,
|
|
123
|
+
cssHref: devMode ? "/@robosophy-material-symbols/rs-material-symbols.css" : withBase(config.base, `${outputDir}/rs-material-symbols.css`),
|
|
124
|
+
fonts
|
|
97
125
|
};
|
|
98
126
|
}
|
|
99
|
-
async function
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
127
|
+
async function collectMaterialSymbolUsages(config, options = {}) {
|
|
128
|
+
const usages = createUsageMap();
|
|
129
|
+
const manifest = await loadIconManifest();
|
|
130
|
+
if (manifest) {
|
|
131
|
+
for (const family of families) {
|
|
132
|
+
for (const name of manifest[family] ?? []) {
|
|
133
|
+
addUsage(usages, { family, name });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
for (const name of internalIconNames) {
|
|
138
|
+
for (const family of families) {
|
|
139
|
+
addUsage(usages, { family, name });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
for (const icon of options.include ?? []) {
|
|
144
|
+
addUsage(usages, typeof icon === "string" ? { family: defaultFamily, name: icon } : icon);
|
|
145
|
+
}
|
|
146
|
+
if (options.scan !== false) {
|
|
147
|
+
const roots = options.roots ?? [join(config.root, "src")];
|
|
148
|
+
for (const root of roots) {
|
|
149
|
+
for (const filePath of await listSourceFiles(root)) {
|
|
150
|
+
const source = await readFile(filePath, "utf8");
|
|
151
|
+
collectFromSource(source, usages);
|
|
117
152
|
}
|
|
153
|
+
}
|
|
118
154
|
}
|
|
119
|
-
return
|
|
155
|
+
return usages;
|
|
120
156
|
}
|
|
121
|
-
function
|
|
122
|
-
const
|
|
123
|
-
for (const
|
|
124
|
-
const
|
|
125
|
-
|
|
157
|
+
function buildMaterialSymbolsCss(usages, fonts, devMode = false, fontDisplay = defaultFontDisplay) {
|
|
158
|
+
const lines = [];
|
|
159
|
+
for (const font of fonts) {
|
|
160
|
+
const fontUrl = devMode ? `/@robosophy-material-symbols/${font.fileName}` : `./${font.fileName}`;
|
|
161
|
+
lines.push(
|
|
126
162
|
"@font-face {",
|
|
127
|
-
` font-family: "${
|
|
128
|
-
` font-display: ${
|
|
163
|
+
` font-family: "${familyFontNames[font.family]}";`,
|
|
164
|
+
` font-display: ${fontDisplay};`,
|
|
129
165
|
" font-style: normal;",
|
|
130
166
|
" font-weight: 100 700;",
|
|
131
|
-
` src: url("${
|
|
167
|
+
` src: url("${fontUrl}") format("woff2-variations");`,
|
|
132
168
|
"}"
|
|
133
169
|
);
|
|
134
170
|
}
|
|
135
|
-
|
|
171
|
+
lines.push(
|
|
136
172
|
".rs-icon {",
|
|
137
173
|
" --rs-icon-color: currentColor;",
|
|
138
174
|
" --rs-icon-fill: 0;",
|
|
@@ -144,7 +180,7 @@ function O(t, e, n = !1, s = j) {
|
|
|
144
180
|
" color: var(--rs-icon-color);",
|
|
145
181
|
" display: inline-flex;",
|
|
146
182
|
" flex: 0 0 auto;",
|
|
147
|
-
` font-family: "${
|
|
183
|
+
` font-family: "${familyFontNames.outlined}";`,
|
|
148
184
|
" font-size: var(--rs-icon-size);",
|
|
149
185
|
" font-style: normal;",
|
|
150
186
|
' font-feature-settings: "liga";',
|
|
@@ -160,193 +196,231 @@ function O(t, e, n = !1, s = j) {
|
|
|
160
196
|
" white-space: nowrap;",
|
|
161
197
|
" word-wrap: normal;",
|
|
162
198
|
"}",
|
|
163
|
-
`.rs-icon--rounded { font-family: "${
|
|
164
|
-
`.rs-icon--sharp { font-family: "${
|
|
199
|
+
`.rs-icon--rounded { font-family: "${familyFontNames.rounded}"; }`,
|
|
200
|
+
`.rs-icon--sharp { font-family: "${familyFontNames.sharp}"; }`,
|
|
165
201
|
".rs-icon--prime::before { content: var(--rs-icon-content); }"
|
|
166
202
|
);
|
|
167
|
-
const
|
|
168
|
-
for (const
|
|
169
|
-
for (const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
`)
|
|
203
|
+
const names = /* @__PURE__ */ new Set();
|
|
204
|
+
for (const family of families) {
|
|
205
|
+
for (const name of usages.get(family) ?? []) {
|
|
206
|
+
names.add(name);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
for (const name of [...names].sort()) {
|
|
210
|
+
lines.push(`.rs-icon-${name} { --rs-icon-content: "${name}"; }`);
|
|
211
|
+
}
|
|
212
|
+
return `${lines.join("\n")}
|
|
175
213
|
`;
|
|
176
214
|
}
|
|
177
|
-
function
|
|
178
|
-
const
|
|
179
|
-
if (
|
|
180
|
-
for (const
|
|
181
|
-
|
|
215
|
+
function buildMaterialSymbolsHtmlTags(assets, options = {}) {
|
|
216
|
+
const tags = [];
|
|
217
|
+
if (options.preload ?? defaultPreload) {
|
|
218
|
+
for (const font of assets.fonts) {
|
|
219
|
+
tags.push({
|
|
182
220
|
attrs: {
|
|
183
221
|
as: "font",
|
|
184
222
|
crossorigin: "",
|
|
185
|
-
href:
|
|
223
|
+
href: font.href,
|
|
186
224
|
rel: "preload",
|
|
187
225
|
type: "font/woff2"
|
|
188
226
|
},
|
|
189
227
|
tag: "link",
|
|
190
228
|
injectTo: "head"
|
|
191
229
|
});
|
|
192
|
-
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
tags.push({
|
|
193
233
|
attrs: {
|
|
194
|
-
href:
|
|
234
|
+
href: assets.cssHref,
|
|
195
235
|
rel: "stylesheet"
|
|
196
236
|
},
|
|
197
237
|
tag: "link",
|
|
198
238
|
injectTo: "head"
|
|
199
|
-
})
|
|
239
|
+
});
|
|
240
|
+
return tags;
|
|
200
241
|
}
|
|
201
|
-
function
|
|
202
|
-
const
|
|
203
|
-
return
|
|
204
|
-
`)}
|
|
242
|
+
function injectMaterialSymbolsHtmlLinks(html, assets, options = {}) {
|
|
243
|
+
const links = buildMaterialSymbolsHtmlTags(assets, options).map(formatHtmlLinkTag).filter((link) => !html.includes(`href="${getLinkHref(link)}"`));
|
|
244
|
+
return links.length === 0 ? html : html.replace("</head>", `${links.map((link) => ` ${link}`).join("\n")}
|
|
205
245
|
</head>`);
|
|
206
246
|
}
|
|
207
|
-
async function
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
247
|
+
async function generateFontAssets(usages, devMode, base, outputDir) {
|
|
248
|
+
const subsetFont = (await import("subset-font")).default;
|
|
249
|
+
const fonts = [];
|
|
250
|
+
for (const family of families) {
|
|
251
|
+
const names = [...usages.get(family) ?? []].sort();
|
|
252
|
+
if (names.length === 0) {
|
|
212
253
|
continue;
|
|
213
|
-
|
|
254
|
+
}
|
|
255
|
+
const sourcePath = resolveFontPath(family);
|
|
256
|
+
const source = await readFile(sourcePath);
|
|
257
|
+
const subset = await subsetFont(source, names.join(" "), {
|
|
214
258
|
targetFormat: "woff2"
|
|
215
|
-
})
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
259
|
+
});
|
|
260
|
+
const hash = createHash("sha256").update(subset).digest("hex").slice(0, 8);
|
|
261
|
+
const fileName = `rs-material-symbols-${family}-${hash}.woff2`;
|
|
262
|
+
fonts.push({
|
|
263
|
+
family,
|
|
264
|
+
fileName,
|
|
265
|
+
href: fontHref(fileName, devMode, base, outputDir),
|
|
266
|
+
source: subset
|
|
221
267
|
});
|
|
222
268
|
}
|
|
223
|
-
return
|
|
269
|
+
return fonts;
|
|
224
270
|
}
|
|
225
|
-
function
|
|
226
|
-
return
|
|
227
|
-
`${
|
|
271
|
+
function resolveFontPath(family) {
|
|
272
|
+
return require$1.resolve(
|
|
273
|
+
`${familyPackages[family]}/files/material-symbols-${family}-latin-${familyFontVariants[family]}-normal.woff2`
|
|
228
274
|
);
|
|
229
275
|
}
|
|
230
|
-
function
|
|
231
|
-
return
|
|
276
|
+
function fontHref(fileName, devMode, base, outputDir) {
|
|
277
|
+
return devMode ? `/@robosophy-material-symbols/${fileName}` : withBase(base, `${outputDir}/${fileName}`);
|
|
232
278
|
}
|
|
233
|
-
function
|
|
234
|
-
const
|
|
235
|
-
return `<${
|
|
279
|
+
function formatHtmlLinkTag(tag) {
|
|
280
|
+
const attrs = Object.entries(tag.attrs ?? {}).map(([name, value]) => value === "" ? name : `${name}="${value}"`).join(" ");
|
|
281
|
+
return `<${tag.tag}${attrs ? ` ${attrs}` : ""}>`;
|
|
236
282
|
}
|
|
237
|
-
function
|
|
238
|
-
return
|
|
283
|
+
function getLinkHref(link) {
|
|
284
|
+
return link.match(/\bhref="([^"]+)"/)?.[1] ?? "";
|
|
239
285
|
}
|
|
240
|
-
function
|
|
241
|
-
const
|
|
242
|
-
let
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
286
|
+
function collectFromSource(source, usages) {
|
|
287
|
+
const rsIconTagPattern = /<RsIcon\b([^>]*)>/g;
|
|
288
|
+
let tagMatch;
|
|
289
|
+
while (tagMatch = rsIconTagPattern.exec(source)) {
|
|
290
|
+
const attrs = parseStaticAttributes(tagMatch[1] ?? "");
|
|
291
|
+
const rawName = attrs.name ?? attrs[":name"];
|
|
292
|
+
const hasFamily = "family" in attrs || ":family" in attrs;
|
|
293
|
+
const rawFamily = attrs.family ?? attrs[":family"] ?? "";
|
|
294
|
+
if (rawName) {
|
|
295
|
+
const familyList = resolveFamilies(rawFamily, hasFamily);
|
|
296
|
+
const names = resolveNames(rawName);
|
|
297
|
+
for (const family of familyList) {
|
|
298
|
+
for (const name of names) {
|
|
299
|
+
addUsage(usages, { family, name });
|
|
300
|
+
}
|
|
301
|
+
}
|
|
250
302
|
}
|
|
251
303
|
}
|
|
252
|
-
const
|
|
253
|
-
let
|
|
254
|
-
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
family:
|
|
258
|
-
name:
|
|
304
|
+
const primeHelperPattern = /\brsPrimeIcon\(\s*["']([a-z0-9_]+)["'](?:\s*,\s*\{([^)]*)\})?/g;
|
|
305
|
+
let helperMatch;
|
|
306
|
+
while (helperMatch = primeHelperPattern.exec(source)) {
|
|
307
|
+
const family = toFamily(helperMatch[2]?.match(/\bfamily\s*:\s*["'](\w+)["']/)?.[1]);
|
|
308
|
+
addUsage(usages, {
|
|
309
|
+
family: family ?? defaultFamily,
|
|
310
|
+
name: helperMatch[1] ?? ""
|
|
259
311
|
});
|
|
260
312
|
}
|
|
261
|
-
const
|
|
262
|
-
let
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
family:
|
|
266
|
-
name:
|
|
313
|
+
const objectIconPattern = /\bicon\s*:\s*["']([a-z0-9_]+)["']/g;
|
|
314
|
+
let objectMatch;
|
|
315
|
+
while (objectMatch = objectIconPattern.exec(source)) {
|
|
316
|
+
addUsage(usages, {
|
|
317
|
+
family: defaultFamily,
|
|
318
|
+
name: objectMatch[1] ?? ""
|
|
267
319
|
});
|
|
320
|
+
}
|
|
268
321
|
}
|
|
269
|
-
function
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
322
|
+
function parseStaticAttributes(source) {
|
|
323
|
+
const attrs = {};
|
|
324
|
+
const attrPattern = /([:@\w-]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;
|
|
325
|
+
let match;
|
|
326
|
+
while (match = attrPattern.exec(source)) {
|
|
327
|
+
attrs[match[1] ?? ""] = match[2] ?? match[3] ?? "";
|
|
328
|
+
}
|
|
329
|
+
return attrs;
|
|
275
330
|
}
|
|
276
|
-
function
|
|
277
|
-
return
|
|
331
|
+
function unwrapStaticValue(value) {
|
|
332
|
+
return value.replace(/^['"](.+)['"]$/, "$1");
|
|
278
333
|
}
|
|
279
|
-
function
|
|
280
|
-
const
|
|
281
|
-
|
|
334
|
+
function addUsage(usages, icon) {
|
|
335
|
+
const family = icon.family ?? defaultFamily;
|
|
336
|
+
const name = icon.name.trim();
|
|
337
|
+
if (!families.includes(family) || !iconNamePattern.test(name)) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
usages.get(family)?.add(name);
|
|
282
341
|
}
|
|
283
|
-
async function
|
|
342
|
+
async function loadIconManifest() {
|
|
284
343
|
try {
|
|
285
|
-
const
|
|
286
|
-
|
|
344
|
+
const dir = join(fileURLToPath(import.meta.url), "..");
|
|
345
|
+
const manifestPath = join(dir, "icon-manifest.json");
|
|
346
|
+
const source = await readFile(manifestPath, "utf8");
|
|
347
|
+
return JSON.parse(source);
|
|
287
348
|
} catch {
|
|
288
349
|
return null;
|
|
289
350
|
}
|
|
290
351
|
}
|
|
291
|
-
function
|
|
292
|
-
const
|
|
293
|
-
return
|
|
352
|
+
function toFamily(value) {
|
|
353
|
+
const normalized = value ? unwrapStaticValue(value) : "";
|
|
354
|
+
return families.includes(normalized) ? normalized : void 0;
|
|
294
355
|
}
|
|
295
|
-
function
|
|
296
|
-
const
|
|
297
|
-
let
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
const
|
|
301
|
-
|
|
356
|
+
function resolveNames(rawName) {
|
|
357
|
+
const stringLiterals = /["']([a-z0-9_]+)["']/g;
|
|
358
|
+
let strMatch;
|
|
359
|
+
const names = [];
|
|
360
|
+
while (strMatch = stringLiterals.exec(rawName)) {
|
|
361
|
+
const candidate = strMatch[1] ?? "";
|
|
362
|
+
if (iconNamePattern.test(candidate)) {
|
|
363
|
+
names.push(candidate);
|
|
364
|
+
}
|
|
302
365
|
}
|
|
303
|
-
if (
|
|
304
|
-
const
|
|
305
|
-
|
|
366
|
+
if (names.length === 0) {
|
|
367
|
+
const name = unwrapStaticValue(rawName);
|
|
368
|
+
if (iconNamePattern.test(name)) {
|
|
369
|
+
names.push(name);
|
|
370
|
+
}
|
|
306
371
|
}
|
|
307
|
-
return
|
|
372
|
+
return names;
|
|
308
373
|
}
|
|
309
|
-
function
|
|
310
|
-
const
|
|
311
|
-
if (
|
|
312
|
-
const
|
|
313
|
-
let
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
const
|
|
317
|
-
|
|
374
|
+
function resolveFamilies(rawFamily, hasFamily = true) {
|
|
375
|
+
const family = toFamily(rawFamily);
|
|
376
|
+
if (family) return [family];
|
|
377
|
+
const stringLiterals = /["'](\w+)["']/g;
|
|
378
|
+
let strMatch;
|
|
379
|
+
const found = /* @__PURE__ */ new Set();
|
|
380
|
+
while (strMatch = stringLiterals.exec(rawFamily)) {
|
|
381
|
+
const candidate = strMatch[1] ?? "";
|
|
382
|
+
const f = toFamily(candidate);
|
|
383
|
+
if (f) {
|
|
384
|
+
found.add(f);
|
|
385
|
+
}
|
|
318
386
|
}
|
|
319
|
-
|
|
387
|
+
if (found.size > 0) return [...found];
|
|
388
|
+
if (!hasFamily) return [defaultFamily];
|
|
389
|
+
return [...families];
|
|
320
390
|
}
|
|
321
|
-
function
|
|
322
|
-
return new Map(
|
|
391
|
+
function createUsageMap() {
|
|
392
|
+
return new Map(families.map((family) => [family, /* @__PURE__ */ new Set()]));
|
|
323
393
|
}
|
|
324
|
-
async function
|
|
394
|
+
async function listSourceFiles(root) {
|
|
325
395
|
try {
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
const
|
|
330
|
-
|
|
396
|
+
const entries = await readdir(root, { withFileTypes: true });
|
|
397
|
+
const files = await Promise.all(
|
|
398
|
+
entries.map(async (entry) => {
|
|
399
|
+
const path = join(root, entry.name);
|
|
400
|
+
if (entry.isDirectory()) {
|
|
401
|
+
return skippedDirs.has(entry.name) ? [] : listSourceFiles(path);
|
|
402
|
+
}
|
|
403
|
+
return sourceExtensions.has(extname(entry.name)) ? [path] : [];
|
|
331
404
|
})
|
|
332
|
-
)
|
|
405
|
+
);
|
|
406
|
+
return files.flat();
|
|
333
407
|
} catch {
|
|
334
408
|
return [];
|
|
335
409
|
}
|
|
336
410
|
}
|
|
337
|
-
function
|
|
338
|
-
|
|
411
|
+
function withBase(base, path) {
|
|
412
|
+
const cleanBase = base.endsWith("/") ? base : `${base}/`;
|
|
413
|
+
return `${cleanBase}${path}`.replaceAll(`${sep}`, "/");
|
|
339
414
|
}
|
|
340
|
-
function
|
|
341
|
-
return
|
|
342
|
-
`);
|
|
415
|
+
function formatDetectedMaterialSymbols(usages) {
|
|
416
|
+
return families.map((family) => `${family}: ${[...usages.get(family) ?? []].sort().join(", ")}`).join("\n");
|
|
343
417
|
}
|
|
344
418
|
export {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
419
|
+
buildMaterialSymbolsCss,
|
|
420
|
+
buildMaterialSymbolsHtmlTags,
|
|
421
|
+
collectMaterialSymbolUsages,
|
|
422
|
+
formatDetectedMaterialSymbols,
|
|
423
|
+
injectMaterialSymbolsHtmlLinks,
|
|
424
|
+
robosophyMaterialSymbols
|
|
351
425
|
};
|
|
352
426
|
//# sourceMappingURL=vite.js.map
|