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