@robosophy/ui-vue 1.0.9 → 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 +11 -11
- package/dist/components/RsAccountSelector/RsAccountSelector.vue.d.ts.map +1 -1
- package/dist/components/RsSidebar/RsSidebar.vue.d.ts.map +1 -1
- package/dist/index.css +752 -1
- package/dist/index.js +697 -4338
- package/dist/index.js.map +1 -1
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +286 -180
- package/dist/vite.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":""}
|
package/dist/vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAA4B,MAAM,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAEhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,KAAK,SAAS,GAAG,MAAM,GAAG;IAAE,MAAM,CAAC,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAClE,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAE3E,MAAM,MAAM,+BAA+B,GAAG;IAC5C,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,KAAK,YAAY,GAAG,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,EAAE,CAAC;CAC3C,CAAC;AAuCF,wBAAgB,wBAAwB,CACtC,OAAO,GAAE,+BAAoC,GAC5C,MAAM,
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAA4B,MAAM,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAEhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,KAAK,SAAS,GAAG,MAAM,GAAG;IAAE,MAAM,CAAC,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAClE,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAE3E,MAAM,MAAM,+BAA+B,GAAG;IAC5C,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,KAAK,YAAY,GAAG,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,EAAE,CAAC;CAC3C,CAAC;AAuCF,wBAAgB,wBAAwB,CACtC,OAAO,GAAE,+BAAoC,GAC5C,MAAM,CAgFR;AAED,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA+BF,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,EACpC,OAAO,GAAE,+BAAoC,yBAsC9C;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,UAAU,CAAC,EAAE,EACxD,OAAO,UAAQ,EACf,WAAW,GAAE,iBAAsC,UAkEpD;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,yBAAyB,EACjC,OAAO,GAAE,IAAI,CAAC,+BAA+B,EAAE,SAAS,CAAM,GAC7D,iBAAiB,EAAE,CA6BrB;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,yBAAyB,EACjC,OAAO,GAAE,IAAI,CAAC,+BAA+B,EAAE,SAAS,CAAM,UAS/D;AAiOD,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,YAAY,UAIjE"}
|
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,125 +16,157 @@ const l = ["outlined", "rounded", "sharp"], u = "outlined", k = /^[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
|
-
|
|
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;
|
|
47
|
+
}
|
|
29
48
|
return {
|
|
30
49
|
name: "robosophy-material-symbols",
|
|
31
|
-
async configResolved(
|
|
32
|
-
|
|
50
|
+
async configResolved(resolvedConfig) {
|
|
51
|
+
config = resolvedConfig;
|
|
33
52
|
},
|
|
34
53
|
async transformIndexHtml() {
|
|
35
|
-
const
|
|
36
|
-
return
|
|
54
|
+
const assets = await getAssets();
|
|
55
|
+
return buildMaterialSymbolsHtmlTags(assets, options);
|
|
37
56
|
},
|
|
38
|
-
configureServer(
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
|
|
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();
|
|
42
66
|
return;
|
|
43
67
|
}
|
|
44
68
|
try {
|
|
45
|
-
const
|
|
46
|
-
|
|
69
|
+
const assets = await getAssets();
|
|
70
|
+
const fileName = decodeURIComponent(
|
|
71
|
+
request.url.replace("/@robosophy-material-symbols/", "").split("?")[0] ?? ""
|
|
47
72
|
);
|
|
48
|
-
if (
|
|
49
|
-
|
|
73
|
+
if (fileName === "rs-material-symbols.css") {
|
|
74
|
+
response.setHeader("Content-Type", "text/css; charset=utf-8");
|
|
75
|
+
response.end(assets.css);
|
|
50
76
|
return;
|
|
51
77
|
}
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
|
|
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);
|
|
55
82
|
return;
|
|
56
83
|
}
|
|
57
|
-
|
|
58
|
-
} catch (
|
|
59
|
-
|
|
84
|
+
next();
|
|
85
|
+
} catch (error) {
|
|
86
|
+
next(error);
|
|
60
87
|
}
|
|
61
88
|
});
|
|
62
89
|
},
|
|
63
|
-
async generateBundle(
|
|
64
|
-
const
|
|
65
|
-
for (const
|
|
90
|
+
async generateBundle(_outputOptions, bundle) {
|
|
91
|
+
const assets = await getAssets();
|
|
92
|
+
for (const font of assets.fonts) {
|
|
66
93
|
this.emitFile({
|
|
67
|
-
fileName: `assets/${
|
|
68
|
-
name:
|
|
69
|
-
source:
|
|
94
|
+
fileName: `assets/${font.fileName}`,
|
|
95
|
+
name: font.fileName,
|
|
96
|
+
source: font.source,
|
|
70
97
|
type: "asset"
|
|
71
98
|
});
|
|
99
|
+
}
|
|
72
100
|
this.emitFile({
|
|
73
101
|
fileName: "assets/rs-material-symbols.css",
|
|
74
102
|
name: "rs-material-symbols.css",
|
|
75
|
-
source:
|
|
103
|
+
source: assets.css,
|
|
76
104
|
type: "asset"
|
|
77
105
|
});
|
|
78
|
-
for (const a of Object.values(o))
|
|
79
|
-
a.type === "asset" && a.fileName.endsWith(".html") && (a.source = O(String(a.source), n, t));
|
|
80
106
|
}
|
|
81
107
|
};
|
|
82
108
|
}
|
|
83
|
-
async function
|
|
84
|
-
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
|
+
);
|
|
85
119
|
return {
|
|
86
|
-
css
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
o,
|
|
90
|
-
e.fontDisplay ?? $
|
|
91
|
-
),
|
|
92
|
-
cssHref: o ? "/@robosophy-material-symbols/rs-material-symbols.css" : F(t.base, "assets/rs-material-symbols.css"),
|
|
93
|
-
fonts: n
|
|
120
|
+
css,
|
|
121
|
+
cssHref: devMode ? "/@robosophy-material-symbols/rs-material-symbols.css" : withBase(config.base, "assets/rs-material-symbols.css"),
|
|
122
|
+
fonts
|
|
94
123
|
};
|
|
95
124
|
}
|
|
96
|
-
async function
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const n = e.roots ?? [y(t.root, "src")];
|
|
110
|
-
for (const a of n)
|
|
111
|
-
for (const r of await j(a)) {
|
|
112
|
-
const i = await b(r, "utf8");
|
|
113
|
-
E(i, s);
|
|
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 });
|
|
114
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);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
115
152
|
}
|
|
116
|
-
return
|
|
153
|
+
return usages;
|
|
117
154
|
}
|
|
118
|
-
function
|
|
119
|
-
const
|
|
120
|
-
for (const
|
|
121
|
-
const
|
|
122
|
-
|
|
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(
|
|
123
160
|
"@font-face {",
|
|
124
|
-
` font-family: "${
|
|
125
|
-
` font-display: ${
|
|
161
|
+
` font-family: "${familyFontNames[font.family]}";`,
|
|
162
|
+
` font-display: ${fontDisplay};`,
|
|
126
163
|
" font-style: normal;",
|
|
127
164
|
" font-weight: 100 700;",
|
|
128
|
-
` src: url("${
|
|
165
|
+
` src: url("${fontUrl}") format("woff2-variations");`,
|
|
129
166
|
"}"
|
|
130
167
|
);
|
|
131
168
|
}
|
|
132
|
-
|
|
169
|
+
lines.push(
|
|
133
170
|
".rs-icon {",
|
|
134
171
|
" --rs-icon-color: currentColor;",
|
|
135
172
|
" --rs-icon-fill: 0;",
|
|
@@ -141,7 +178,7 @@ function C(t, e, s = !1, o = $) {
|
|
|
141
178
|
" color: var(--rs-icon-color);",
|
|
142
179
|
" display: inline-flex;",
|
|
143
180
|
" flex: 0 0 auto;",
|
|
144
|
-
` font-family: "${
|
|
181
|
+
` font-family: "${familyFontNames.outlined}";`,
|
|
145
182
|
" font-size: var(--rs-icon-size);",
|
|
146
183
|
" font-style: normal;",
|
|
147
184
|
' font-feature-settings: "liga";',
|
|
@@ -157,162 +194,231 @@ function C(t, e, s = !1, o = $) {
|
|
|
157
194
|
" white-space: nowrap;",
|
|
158
195
|
" word-wrap: normal;",
|
|
159
196
|
"}",
|
|
160
|
-
`.rs-icon--rounded { font-family: "${
|
|
161
|
-
`.rs-icon--sharp { font-family: "${
|
|
197
|
+
`.rs-icon--rounded { font-family: "${familyFontNames.rounded}"; }`,
|
|
198
|
+
`.rs-icon--sharp { font-family: "${familyFontNames.sharp}"; }`,
|
|
162
199
|
".rs-icon--prime::before { content: var(--rs-icon-content); }"
|
|
163
200
|
);
|
|
164
|
-
const
|
|
165
|
-
for (const
|
|
166
|
-
for (const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
`)
|
|
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")}
|
|
172
211
|
`;
|
|
173
212
|
}
|
|
174
|
-
function
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
177
|
-
for (const
|
|
178
|
-
|
|
213
|
+
function buildMaterialSymbolsHtmlTags(assets, options = {}) {
|
|
214
|
+
const tags = [];
|
|
215
|
+
if (options.preload ?? defaultPreload) {
|
|
216
|
+
for (const font of assets.fonts) {
|
|
217
|
+
tags.push({
|
|
179
218
|
attrs: {
|
|
180
219
|
as: "font",
|
|
181
220
|
crossorigin: "",
|
|
182
|
-
href:
|
|
221
|
+
href: font.href,
|
|
183
222
|
rel: "preload",
|
|
184
223
|
type: "font/woff2"
|
|
185
224
|
},
|
|
186
225
|
tag: "link",
|
|
187
226
|
injectTo: "head"
|
|
188
227
|
});
|
|
189
|
-
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
tags.push({
|
|
190
231
|
attrs: {
|
|
191
|
-
href:
|
|
232
|
+
href: assets.cssHref,
|
|
192
233
|
rel: "stylesheet"
|
|
193
234
|
},
|
|
194
235
|
tag: "link",
|
|
195
236
|
injectTo: "head"
|
|
196
|
-
})
|
|
237
|
+
});
|
|
238
|
+
return tags;
|
|
197
239
|
}
|
|
198
|
-
function
|
|
199
|
-
const
|
|
200
|
-
return
|
|
201
|
-
`)}
|
|
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")}
|
|
202
243
|
</head>`);
|
|
203
244
|
}
|
|
204
|
-
async function
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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) {
|
|
209
251
|
continue;
|
|
210
|
-
|
|
252
|
+
}
|
|
253
|
+
const sourcePath = resolveFontPath(family);
|
|
254
|
+
const source = await readFile(sourcePath);
|
|
255
|
+
const subset = await subsetFont(source, names.join(" "), {
|
|
211
256
|
targetFormat: "woff2"
|
|
212
|
-
})
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
|
|
218
265
|
});
|
|
219
266
|
}
|
|
220
|
-
return
|
|
267
|
+
return fonts;
|
|
221
268
|
}
|
|
222
|
-
function
|
|
223
|
-
return
|
|
224
|
-
`${
|
|
269
|
+
function resolveFontPath(family) {
|
|
270
|
+
return require$1.resolve(
|
|
271
|
+
`${familyPackages[family]}/files/material-symbols-${family}-latin-${familyFontVariants[family]}-normal.woff2`
|
|
225
272
|
);
|
|
226
273
|
}
|
|
227
|
-
function
|
|
228
|
-
return
|
|
274
|
+
function fontHref(fileName, devMode, base) {
|
|
275
|
+
return devMode ? `/@robosophy-material-symbols/${fileName}` : withBase(base, `assets/${fileName}`);
|
|
229
276
|
}
|
|
230
|
-
function
|
|
231
|
-
const
|
|
232
|
-
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}` : ""}>`;
|
|
233
280
|
}
|
|
234
|
-
function
|
|
235
|
-
return
|
|
281
|
+
function getLinkHref(link) {
|
|
282
|
+
return link.match(/\bhref="([^"]+)"/)?.[1] ?? "";
|
|
236
283
|
}
|
|
237
|
-
function
|
|
238
|
-
const
|
|
239
|
-
let
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
|
|
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
|
+
}
|
|
300
|
+
}
|
|
243
301
|
}
|
|
244
|
-
const
|
|
245
|
-
let
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
family:
|
|
250
|
-
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] ?? ""
|
|
251
309
|
});
|
|
252
310
|
}
|
|
253
|
-
const
|
|
254
|
-
let
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
family:
|
|
258
|
-
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] ?? ""
|
|
259
317
|
});
|
|
318
|
+
}
|
|
260
319
|
}
|
|
261
|
-
function
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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;
|
|
267
328
|
}
|
|
268
|
-
function
|
|
269
|
-
return
|
|
329
|
+
function unwrapStaticValue(value) {
|
|
330
|
+
return value.replace(/^['"](.+)['"]$/, "$1");
|
|
270
331
|
}
|
|
271
|
-
function
|
|
272
|
-
const
|
|
273
|
-
|
|
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);
|
|
274
339
|
}
|
|
275
|
-
async function
|
|
340
|
+
async function loadIconManifest() {
|
|
276
341
|
try {
|
|
277
|
-
const
|
|
278
|
-
|
|
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);
|
|
279
346
|
} catch {
|
|
280
347
|
return null;
|
|
281
348
|
}
|
|
282
349
|
}
|
|
283
|
-
function
|
|
284
|
-
const
|
|
285
|
-
return
|
|
350
|
+
function toFamily(value) {
|
|
351
|
+
const normalized = value ? unwrapStaticValue(value) : "";
|
|
352
|
+
return families.includes(normalized) ? normalized : void 0;
|
|
286
353
|
}
|
|
287
|
-
function
|
|
288
|
-
|
|
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
|
+
}
|
|
363
|
+
}
|
|
364
|
+
if (names.length === 0) {
|
|
365
|
+
const name = unwrapStaticValue(rawName);
|
|
366
|
+
if (iconNamePattern.test(name)) {
|
|
367
|
+
names.push(name);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return names;
|
|
289
371
|
}
|
|
290
|
-
|
|
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
|
+
}
|
|
384
|
+
}
|
|
385
|
+
if (found.size > 0) return [...found];
|
|
386
|
+
if (!hasFamily) return [defaultFamily];
|
|
387
|
+
return [...families];
|
|
388
|
+
}
|
|
389
|
+
function createUsageMap() {
|
|
390
|
+
return new Map(families.map((family) => [family, /* @__PURE__ */ new Set()]));
|
|
391
|
+
}
|
|
392
|
+
async function listSourceFiles(root) {
|
|
291
393
|
try {
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
const
|
|
296
|
-
|
|
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] : [];
|
|
297
402
|
})
|
|
298
|
-
)
|
|
403
|
+
);
|
|
404
|
+
return files.flat();
|
|
299
405
|
} catch {
|
|
300
406
|
return [];
|
|
301
407
|
}
|
|
302
408
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
409
|
+
function withBase(base, path) {
|
|
410
|
+
const cleanBase = base.endsWith("/") ? base : `${base}/`;
|
|
411
|
+
return `${cleanBase}${path}`.replaceAll(`${sep}`, "/");
|
|
305
412
|
}
|
|
306
|
-
function
|
|
307
|
-
return
|
|
308
|
-
`);
|
|
413
|
+
function formatDetectedMaterialSymbols(usages) {
|
|
414
|
+
return families.map((family) => `${family}: ${[...usages.get(family) ?? []].sort().join(", ")}`).join("\n");
|
|
309
415
|
}
|
|
310
416
|
export {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
417
|
+
buildMaterialSymbolsCss,
|
|
418
|
+
buildMaterialSymbolsHtmlTags,
|
|
419
|
+
collectMaterialSymbolUsages,
|
|
420
|
+
formatDetectedMaterialSymbols,
|
|
421
|
+
injectMaterialSymbolsHtmlLinks,
|
|
422
|
+
robosophyMaterialSymbols
|
|
317
423
|
};
|
|
318
424
|
//# sourceMappingURL=vite.js.map
|