@vizejs/vite-plugin-musea 0.442.0 → 0.443.0

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.
Files changed (43) hide show
  1. package/dist/a11y/index.mjs +1 -1
  2. package/dist/{a11y-BU5kFNk-.mjs → a11y-DuFu75hl.mjs} +2 -2
  3. package/dist/{a11y-BU5kFNk-.mjs.map → a11y-DuFu75hl.mjs.map} +1 -1
  4. package/dist/cli/index.mjs +2 -2
  5. package/dist/gallery/assets/{MonacoEditor-DpMHG8uG.js → MonacoEditor-CmjDtbrI.js} +2 -2
  6. package/dist/gallery/assets/{cssMode-BhNXI_iH.js → cssMode-B16oWKdO.js} +1 -1
  7. package/dist/gallery/assets/{editor.api-pyN3BEOj.js → editor.api-CfYscGcC.js} +1 -1
  8. package/dist/gallery/assets/{freemarker2-DDdeAW1l.js → freemarker2-Bsla50n3.js} +1 -1
  9. package/dist/gallery/assets/{handlebars-d_XLJufS.js → handlebars-CS_Y5cXs.js} +1 -1
  10. package/dist/gallery/assets/{html-pNQuOCmG.js → html-DagAGhpS.js} +1 -1
  11. package/dist/gallery/assets/{htmlMode-C9_7c2MZ.js → htmlMode-CiuL2Y-P.js} +1 -1
  12. package/dist/gallery/assets/{index-DpZpi0O6.css → index-BaRljRmN.css} +1 -1
  13. package/dist/gallery/assets/{index-qkpGvqJF.js → index-Bma1gCA8.js} +4 -4
  14. package/dist/gallery/assets/{javascript-V9iW4BoD.js → javascript-BQYQMq9R.js} +1 -1
  15. package/dist/gallery/assets/{jsonMode-B_jKD9Gd.js → jsonMode-C5lyVqru.js} +1 -1
  16. package/dist/gallery/assets/{liquid-B5bf9QtA.js → liquid-qbEuwx0o.js} +1 -1
  17. package/dist/gallery/assets/{lspLanguageFeatures-DF8jpKLy.js → lspLanguageFeatures-Dqts9s1L.js} +1 -1
  18. package/dist/gallery/assets/{mdx-B6b4WvnG.js → mdx-DN6uw21R.js} +1 -1
  19. package/dist/gallery/assets/{python-C_8hKql2.js → python-Cbp5CGeG.js} +1 -1
  20. package/dist/gallery/assets/{razor-BK6Cp9pQ.js → razor-BXu36P7p.js} +1 -1
  21. package/dist/gallery/assets/{register-BcnlSPEw.js → register-vvpXemvQ.js} +2 -2
  22. package/dist/gallery/assets/{toggleHighContrast-D_Ox9lw9.js → toggleHighContrast-9EQLxoB9.js} +1 -1
  23. package/dist/gallery/assets/{tsMode-BODHbLZw.js → tsMode-DakVvyMV.js} +1 -1
  24. package/dist/gallery/assets/{typescript-CdaOwWaG.js → typescript-DEY4mnQU.js} +1 -1
  25. package/dist/gallery/assets/{vs-mnsDk7Q8.js → vs-Cd8KAJDG.js} +3 -3
  26. package/dist/gallery/assets/{workers-DYnbCsrm.js → workers-GvANOwSC.js} +1 -1
  27. package/dist/gallery/assets/{xml-ClcAB6Hf.js → xml-cZMAcMEr.js} +1 -1
  28. package/dist/gallery/assets/{yaml-mW5XIYQE.js → yaml-CReFeuuC.js} +1 -1
  29. package/dist/gallery/index.html +2 -2
  30. package/dist/{gallery-CLe_4-XW.mjs → gallery-LgVvVp28.mjs} +2 -2
  31. package/dist/{gallery-CLe_4-XW.mjs.map → gallery-LgVvVp28.mjs.map} +1 -1
  32. package/dist/index.mjs +59 -335
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/{options-DCuB_Fpu.mjs → options-DnKPMMPV.mjs} +334 -18
  35. package/dist/options-DnKPMMPV.mjs.map +1 -0
  36. package/dist/{template-BgBSA10_.mjs → template-CpNUvZPp.mjs} +5 -3
  37. package/dist/template-CpNUvZPp.mjs.map +1 -0
  38. package/dist/{utils-DeMLVlNS.mjs → utils-BloA9YP9.mjs} +35 -29
  39. package/dist/utils-BloA9YP9.mjs.map +1 -0
  40. package/package.json +4 -4
  41. package/dist/options-DCuB_Fpu.mjs.map +0 -1
  42. package/dist/template-BgBSA10_.mjs.map +0 -1
  43. package/dist/utils-DeMLVlNS.mjs.map +0 -1
@@ -1,9 +1,9 @@
1
- import { E as loadNative, S as resolveTrustedSourcePath, T as analyzeSfcFallback, f as parseJsonBody, g as assertComponentSourcePath, s as toPascalCase, t as escapeHtml, v as decodeUrlComponent, w as HttpError, x as resolveInsideAny, y as isVueSourcePath } from "./utils-DeMLVlNS.mjs";
1
+ import { E as loadNative, S as resolveTrustedSourcePath, T as analyzeSfcFallback, f as parseJsonBody, g as assertComponentSourcePath, s as toPascalCase, t as escapeHtml, v as decodeUrlComponent, w as HttpError, x as resolveInsideAny, y as isVueSourcePath } from "./utils-BloA9YP9.mjs";
2
2
  import { s as resolveSnapshotIdentity } from "./vrt-PuxpRuHa.mjs";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
- import crypto, { createHash } from "node:crypto";
6
5
  import ts from "typescript";
6
+ import crypto, { createHash } from "node:crypto";
7
7
  //#region src/component-source.ts
8
8
  function allowedSourceRoots(root, scanRoots = []) {
9
9
  return [...new Set([root, ...scanRoots].map((sourceRoot) => path.resolve(sourceRoot)))];
@@ -20,6 +20,24 @@ function resolveComponentSourcePath(art, artPath, sourceRoots) {
20
20
  return resolved;
21
21
  }
22
22
  //#endregion
23
+ //#region src/variant-bindings.ts
24
+ /** Preserve ordinary bindings and disambiguate every normalized collision. */
25
+ function variantComponentNames(variants) {
26
+ const names = /* @__PURE__ */ new Map();
27
+ const counts = /* @__PURE__ */ new Map();
28
+ for (const { name } of variants) {
29
+ if (names.has(name)) throw new Error(`Duplicate Musea variant name: ${JSON.stringify(name)}`);
30
+ const binding = toPascalCase(name);
31
+ names.set(name, binding);
32
+ counts.set(binding, (counts.get(binding) ?? 0) + 1);
33
+ }
34
+ for (const [name, binding] of names) if (counts.get(binding) > 1) {
35
+ const hash = createHash("sha256").update(JSON.stringify(name)).digest("hex");
36
+ names.set(name, `__MuseaVariant_${hash}`);
37
+ }
38
+ return names;
39
+ }
40
+ //#endregion
23
41
  //#region src/art-module-vue2.ts
24
42
  /**
25
43
  * Legacy Vue 2 variant emission.
@@ -79,7 +97,7 @@ ${components} template: \`${fullTemplate}\`,
79
97
  * The parsed `<script setup>` is passed in rather than parsed here, so this
80
98
  * module does not have to import back from `art-module.ts`.
81
99
  */
82
- function componentNameFromSource$1(source) {
100
+ function componentNameFromSource(source) {
83
101
  const withoutQuery = source.split(/[?#]/, 1)[0] || source;
84
102
  const filename = path.basename(withoutQuery);
85
103
  const extension = path.extname(filename);
@@ -108,7 +126,7 @@ function resolveArtComponent(art, filePath, scriptSetup, options = {}) {
108
126
  };
109
127
  componentImportPath = options.root ? resolveComponentSourcePath(sourceArt, filePath, allowedSourceRoots(options.root, options.scanRoots ?? [])) ?? void 0 : path.isAbsolute(componentSource) ? componentSource : path.resolve(path.dirname(filePath), componentSource);
110
128
  }
111
- componentTagName = defineArtComponentName ?? (art.metadata.component ? componentNameFromSource$1(art.metadata.component) : "MuseaComponent");
129
+ componentTagName = defineArtComponentName ?? (art.metadata.component ? componentNameFromSource(art.metadata.component) : "MuseaComponent");
112
130
  componentBindingName = componentTagName;
113
131
  }
114
132
  return {
@@ -343,13 +361,6 @@ function extractDefineArtComponent(content) {
343
361
  };
344
362
  return { name: content.match(/\bdefineArt\s*\(\s*([A-Za-z_$][\w$]*)/)?.[1] };
345
363
  }
346
- function componentNameFromSource(source) {
347
- const withoutQuery = source.split(/[?#]/, 1)[0] || source;
348
- const filename = path.basename(withoutQuery);
349
- const extension = path.extname(filename);
350
- const name = toPascalCase(extension ? filename.slice(0, -extension.length) : filename);
351
- return name === "Variant" ? "MuseaComponent" : name;
352
- }
353
364
  function isDefineArtLine(trimmed) {
354
365
  return /\bdefineArt\s*\(/.test(trimmed);
355
366
  }
@@ -408,8 +419,9 @@ ${scriptSetup.setupBody.join("\n")}
408
419
  return ${setupReturn};
409
420
  })();
410
421
  `;
422
+ const bindings = variantComponentNames(art.variants);
411
423
  for (const variant of art.variants) {
412
- const variantComponentName = toPascalCase(variant.name);
424
+ const variantComponentName = bindings.get(variant.name);
413
425
  const template = expandSelfTag(variant.template, componentTagName);
414
426
  if (options.vueVersion === 2) {
415
427
  code += emitLegacyVariant({
@@ -434,7 +446,7 @@ export { ${variantComponentName} };
434
446
  }
435
447
  const defaultVariant = art.variants.find((v) => v.isDefault) || art.variants[0];
436
448
  if (defaultVariant) code += `
437
- export default ${toPascalCase(defaultVariant.name)};
449
+ export default ${bindings.get(defaultVariant.name)};
438
450
  `;
439
451
  return code;
440
452
  }
@@ -996,6 +1008,308 @@ function findDependentTokens(tokenMap, targetPath) {
996
1008
  return tokenNative().findDependentDesignTokens(tokenMap, targetPath);
997
1009
  }
998
1010
  //#endregion
1011
+ //#region src/tokens/generator.ts
1012
+ /**
1013
+ * Token documentation generators for Style Dictionary integration.
1014
+ *
1015
+ * Generates HTML, Markdown, and JSON documentation from parsed token categories,
1016
+ * and provides the main processStyleDictionary orchestrator function.
1017
+ */
1018
+ const SAFE_CSS_COLOR_PATTERN = /^(?:#[0-9a-fA-F]{3,8}|(?:rgb|hsl)a?\(\s*[-+.\d,%\s/]+\)|(?:oklch|oklab|lab|lch)\(\s*[-+.\d,%\s/]+\))$/;
1019
+ const DANGEROUS_PROTOCOL_PATTERN = /\b(javascript|vbscript):/gi;
1020
+ function escapeTokenText(value) {
1021
+ return escapeHtml(value).replace(DANGEROUS_PROTOCOL_PATTERN, "$1&#58;");
1022
+ }
1023
+ function safeCssColor(value, type) {
1024
+ if (typeof value !== "string") return null;
1025
+ const trimmed = value.trim();
1026
+ return (type === "color" || trimmed.startsWith("#") || trimmed.startsWith("rgb") || trimmed.startsWith("hsl")) && SAFE_CSS_COLOR_PATTERN.test(trimmed) ? trimmed : null;
1027
+ }
1028
+ /**
1029
+ * Generate HTML documentation for tokens.
1030
+ */
1031
+ function generateTokensHtml(categories) {
1032
+ const renderToken = (name, token) => {
1033
+ const color = safeCssColor(token.value, token.type);
1034
+ return `
1035
+ <div class="token">
1036
+ <div class="token-preview">
1037
+ ${color ? `<div class="color-swatch" style="background: ${color}"></div>` : ""}
1038
+ </div>
1039
+ <div class="token-info">
1040
+ <div class="token-name">${escapeTokenText(name)}</div>
1041
+ <div class="token-value">${escapeTokenText(String(token.value))}</div>
1042
+ ${token.description ? `<div class="token-description">${escapeTokenText(token.description)}</div>` : ""}
1043
+ </div>
1044
+ </div>
1045
+ `;
1046
+ };
1047
+ const renderCategory = (category, level = 2) => {
1048
+ const heading = `h${Math.min(level, 6)}`;
1049
+ let html = `<${heading}>${escapeTokenText(category.name)}</${heading}>`;
1050
+ html += "<div class=\"tokens-grid\">";
1051
+ for (const [name, token] of Object.entries(category.tokens)) html += renderToken(name, token);
1052
+ html += "</div>";
1053
+ if (category.subcategories) for (const sub of category.subcategories) html += renderCategory(sub, level + 1);
1054
+ return html;
1055
+ };
1056
+ return `<!DOCTYPE html>
1057
+ <html lang="en">
1058
+ <head>
1059
+ <meta charset="UTF-8">
1060
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
1061
+ <title>Design Tokens - Musea</title>
1062
+ <style>
1063
+ :root {
1064
+ --musea-bg: #0d0d0d;
1065
+ --musea-bg-secondary: #1a1815;
1066
+ --musea-text: #e6e9f0;
1067
+ --musea-text-muted: #7b8494;
1068
+ --musea-accent: #a34828;
1069
+ --musea-border: #3a3530;
1070
+ }
1071
+ * { box-sizing: border-box; margin: 0; padding: 0; }
1072
+ body {
1073
+ font-family: 'Inter', -apple-system, sans-serif;
1074
+ background: var(--musea-bg);
1075
+ color: var(--musea-text);
1076
+ line-height: 1.6;
1077
+ padding: 2rem;
1078
+ }
1079
+ h1 { margin-bottom: 2rem; color: var(--musea-accent); }
1080
+ h2 { margin: 2rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--musea-border); }
1081
+ h3, h4, h5, h6 { margin: 1.5rem 0 0.75rem; }
1082
+ .tokens-grid {
1083
+ display: grid;
1084
+ grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
1085
+ gap: 1rem;
1086
+ margin-bottom: 1.5rem;
1087
+ }
1088
+ .token {
1089
+ background: var(--musea-bg-secondary);
1090
+ border: 1px solid var(--musea-border);
1091
+ border-radius: 8px;
1092
+ padding: 1rem;
1093
+ display: flex;
1094
+ gap: 1rem;
1095
+ align-items: center;
1096
+ }
1097
+ .token-preview {
1098
+ flex-shrink: 0;
1099
+ width: 48px;
1100
+ height: 48px;
1101
+ display: flex;
1102
+ align-items: center;
1103
+ justify-content: center;
1104
+ }
1105
+ .color-swatch {
1106
+ width: 48px;
1107
+ height: 48px;
1108
+ border-radius: 8px;
1109
+ border: 1px solid var(--musea-border);
1110
+ }
1111
+ .token-info {
1112
+ flex: 1;
1113
+ min-width: 0;
1114
+ }
1115
+ .token-name {
1116
+ font-weight: 600;
1117
+ font-family: 'JetBrains Mono', monospace;
1118
+ font-size: 0.875rem;
1119
+ }
1120
+ .token-value {
1121
+ color: var(--musea-text-muted);
1122
+ font-family: 'JetBrains Mono', monospace;
1123
+ font-size: 0.75rem;
1124
+ word-break: break-all;
1125
+ }
1126
+ .token-description {
1127
+ color: var(--musea-text-muted);
1128
+ font-size: 0.75rem;
1129
+ margin-top: 0.25rem;
1130
+ }
1131
+ </style>
1132
+ </head>
1133
+ <body>
1134
+ <h1>Design Tokens</h1>
1135
+ ${categories.map((cat) => renderCategory(cat)).join("")}
1136
+ </body>
1137
+ </html>`;
1138
+ }
1139
+ /**
1140
+ * Generate Markdown documentation for tokens.
1141
+ */
1142
+ function generateTokensMarkdown(categories) {
1143
+ return tokenNative().generateDesignTokensMarkdown(categories, (/* @__PURE__ */ new Date()).toISOString());
1144
+ }
1145
+ /**
1146
+ * Style Dictionary plugin for Musea.
1147
+ * Parses tokens and generates documentation in the specified format.
1148
+ */
1149
+ async function processStyleDictionary(config) {
1150
+ const categories = await parseTokens(config.tokensPath);
1151
+ const outputDir = config.outputDir ?? ".vize/tokens";
1152
+ const outputFormat = config.outputFormat ?? "html";
1153
+ await fs.promises.mkdir(outputDir, { recursive: true });
1154
+ let content;
1155
+ let filename;
1156
+ switch (outputFormat) {
1157
+ case "html":
1158
+ content = generateTokensHtml(categories);
1159
+ filename = "tokens.html";
1160
+ break;
1161
+ case "markdown":
1162
+ content = generateTokensMarkdown(categories);
1163
+ filename = "tokens.md";
1164
+ break;
1165
+ default:
1166
+ content = JSON.stringify({ categories }, null, 2);
1167
+ filename = "tokens.json";
1168
+ }
1169
+ const outputPath = path.join(outputDir, filename);
1170
+ await fs.promises.writeFile(outputPath, content, "utf-8");
1171
+ console.log(`[musea] Generated token documentation: ${outputPath}`);
1172
+ return {
1173
+ categories,
1174
+ metadata: {
1175
+ name: path.basename(config.tokensPath),
1176
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString()
1177
+ }
1178
+ };
1179
+ }
1180
+ //#endregion
1181
+ //#region src/tokens/preview.ts
1182
+ function resolveTokenPreview(input) {
1183
+ const reference = resolveReference(input.token, input.tokenMap);
1184
+ const value = input.token.$resolvedValue ?? reference?.value ?? input.token.value;
1185
+ const candidates = buildCandidates(input.tokenPath, input.token, reference);
1186
+ const kind = resolveCustomKind(candidates, reference?.path, input.config?.rules) ?? inferPreviewKind(candidates, value);
1187
+ return {
1188
+ kind: new Set(input.config?.disabledKinds ?? []).has(kind) ? "generic" : kind,
1189
+ value,
1190
+ tokenPath: input.tokenPath,
1191
+ reference
1192
+ };
1193
+ }
1194
+ function resolveReference(token, tokenMap) {
1195
+ if (!token.$reference) return void 0;
1196
+ const referencedToken = tokenMap?.[token.$reference];
1197
+ return {
1198
+ path: token.$reference,
1199
+ token: referencedToken,
1200
+ value: referencedToken ? referencedToken.$resolvedValue ?? referencedToken.value : void 0
1201
+ };
1202
+ }
1203
+ function buildCandidates(tokenPath, token, reference) {
1204
+ const candidates = [{
1205
+ tokenPath,
1206
+ name: pathName(tokenPath),
1207
+ token
1208
+ }];
1209
+ if (reference?.token) candidates.push({
1210
+ tokenPath: reference.path,
1211
+ name: pathName(reference.path),
1212
+ token: reference.token
1213
+ });
1214
+ return candidates;
1215
+ }
1216
+ function resolveCustomKind(candidates, referencePath, rules) {
1217
+ for (const rule of rules ?? []) if (matchesRule(rule, candidates, referencePath)) return rule.kind;
1218
+ }
1219
+ function matchesRule(rule, candidates, referencePath) {
1220
+ const checks = [];
1221
+ if (rule.type !== void 0) checks.push(candidates.some((candidate) => typeMatches(candidate, rule.type)));
1222
+ if (rule.pathIncludes !== void 0) checks.push(candidates.some((candidate) => includesAny(candidate.tokenPath, rule.pathIncludes)));
1223
+ if (rule.nameIncludes !== void 0) checks.push(candidates.some((candidate) => includesAny(candidate.name, rule.nameIncludes)));
1224
+ if (rule.referencePathIncludes !== void 0) checks.push(referencePath !== void 0 && includesAny(referencePath, rule.referencePathIncludes));
1225
+ return checks.length > 0 && checks.every(Boolean);
1226
+ }
1227
+ function inferPreviewKind(candidates, value) {
1228
+ if (hasType(candidates, ["color"]) || isColorValue(value)) return "color";
1229
+ if (hasType(candidates, ["shadow", "box-shadow"]) || hasSignal(candidates, ["shadow", "box-shadow"])) return "shadow";
1230
+ if (hasType(candidates, [
1231
+ "z-index",
1232
+ "zindex",
1233
+ "zIndex"
1234
+ ]) || hasSignal(candidates, [
1235
+ "z-index",
1236
+ "zindex",
1237
+ "stacking-order"
1238
+ ])) return "zIndex";
1239
+ if (hasType(candidates, ["opacity"]) || hasSignal(candidates, ["opacity", "alpha"])) return "opacity";
1240
+ if (hasType(candidates, [
1241
+ "border-radius",
1242
+ "borderradius",
1243
+ "radius"
1244
+ ]) || hasSignal(candidates, [
1245
+ "border-radius",
1246
+ "borderradius",
1247
+ "radius",
1248
+ "round",
1249
+ "rounded"
1250
+ ])) return "radius";
1251
+ if (hasType(candidates, ["letterspacing", "letter-spacing"]) || hasSignal(candidates, [
1252
+ "letter-spacing",
1253
+ "letterspacing",
1254
+ "tracking"
1255
+ ])) return "letterSpacing";
1256
+ if (hasType(candidates, ["spacing", "space"]) || hasSignal(candidates, [
1257
+ "spacing",
1258
+ "spasing",
1259
+ "space",
1260
+ "gap",
1261
+ "padding",
1262
+ "margin",
1263
+ "inset"
1264
+ ])) return "spacing";
1265
+ if (hasSignal(candidates, [
1266
+ "font-size",
1267
+ "fontsize",
1268
+ "text-size"
1269
+ ])) return "fontSize";
1270
+ if (hasType(candidates, ["fontweight", "font-weight"]) || hasSignal(candidates, [
1271
+ "font-weight",
1272
+ "fontweight",
1273
+ "weight"
1274
+ ])) return "fontWeight";
1275
+ if (hasType(candidates, ["lineheight", "line-height"]) || hasSignal(candidates, ["line-height", "lineheight"])) return "lineHeight";
1276
+ return "generic";
1277
+ }
1278
+ function hasType(candidates, terms) {
1279
+ return candidates.some((candidate) => typeMatches(candidate, terms));
1280
+ }
1281
+ function hasSignal(candidates, terms) {
1282
+ return candidates.some((candidate) => includesAny(candidate.tokenPath, terms) || includesAny(candidate.name, terms) || candidate.token.type !== void 0 && includesAny(candidate.token.type, terms));
1283
+ }
1284
+ function typeMatches(candidate, expected) {
1285
+ if (!candidate.token.type) return false;
1286
+ return toArray(expected).some((term) => normalize(candidate.token.type) === normalize(term));
1287
+ }
1288
+ function includesAny(value, expected) {
1289
+ const normalizedValue = normalize(value);
1290
+ const compactValue = compact(normalizedValue);
1291
+ return toArray(expected).some((term) => {
1292
+ const normalizedTerm = normalize(term);
1293
+ return normalizedValue.includes(normalizedTerm) || compactValue.includes(compact(normalizedTerm));
1294
+ });
1295
+ }
1296
+ function isColorValue(value) {
1297
+ if (typeof value !== "string") return false;
1298
+ return /^(#|rgb\(|rgba\(|hsl\(|hsla\(|oklch\(|oklab\(|lab\(|lch\(|color\()/i.test(value.trim());
1299
+ }
1300
+ function pathName(tokenPath) {
1301
+ return tokenPath.split(".").at(-1) ?? tokenPath;
1302
+ }
1303
+ function normalize(value) {
1304
+ return value.trim().toLowerCase().replace(/[_\s]+/g, "-");
1305
+ }
1306
+ function compact(value) {
1307
+ return value.replace(/[-.]/g, "");
1308
+ }
1309
+ function toArray(value) {
1310
+ return Array.isArray(value) ? value : [value];
1311
+ }
1312
+ //#endregion
999
1313
  //#region src/api-tokens.ts
1000
1314
  function resolveTokensPath(ctx) {
1001
1315
  const allowedRoots = [ctx.config.root, ...ctx.scanRoots];
@@ -1448,7 +1762,9 @@ function normalizePropName(name) {
1448
1762
  return name.replace(/[-_]/g, "").toLowerCase();
1449
1763
  }
1450
1764
  function generateTypescript(palette) {
1451
- const fields = palette.controls.map((control) => ` ${control.name}${control.required ? "" : "?"}: ${controlTsType(control)};`).join("\n");
1765
+ const fields = palette.controls.map((control) => {
1766
+ return ` ${/^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u.test(control.name) ? control.name : JSON.stringify(control.name)}${control.required ? "" : "?"}: ${controlTsType(control)};`;
1767
+ }).join("\n");
1452
1768
  return `export interface ${pascalCase(palette.title)}Props {\n${fields}\n}\n`;
1453
1769
  }
1454
1770
  function controlTsType(control) {
@@ -1581,12 +1897,12 @@ function joinUrlPath(basePath, ...segments) {
1581
1897
  async function createStaticGalleryPayload(ctx) {
1582
1898
  const apiCtx = createApiContext(ctx);
1583
1899
  const arts = sortedArts(ctx.artFiles.values());
1584
- const previews = {};
1900
+ const previews = Object.create(null);
1585
1901
  const details = {};
1586
1902
  const snapshotIdentities = Object.create(null);
1587
1903
  for (const art of arts) {
1588
1904
  snapshotIdentities[art.path] = resolveSnapshotIdentity(art.path, ctx.projectRoot ?? ctx.config.root);
1589
- previews[art.path] = {};
1905
+ previews[art.path] = Object.create(null);
1590
1906
  for (const variant of art.variants) {
1591
1907
  const id = staticPreviewId(art.path, variant.name);
1592
1908
  previews[art.path][variant.name] = joinUrlPath(ctx.basePath, "preview", `${id}.html`);
@@ -1838,6 +2154,6 @@ function readMuseaOptions(plugin) {
1838
2154
  return plugin[MUSEA_OPTIONS_KEY];
1839
2155
  }
1840
2156
  //#endregion
1841
- export { tokenNative as C, rewriteRelativeImportStatement as D, parseScriptSetupForArt as E, expandSelfTag as O, parseTokens as S, generateArtModule as T, handleTokensUpdate as _, rewriteGalleryBase as a, resolveReferences as b, joinUrlPath as c, handleArtDocs as d, handleArtSource as f, handleTokensGet as g, handleTokensDelete as h, publicBasePathFromViteBase as i, resolveArtComponent as k, staticPreviewId as l, handleTokensCreate as m, readMuseaOptions as n, rewriteGalleryTextAssetBase as o, handleArtPalette as p, processMuseaArtFile as r, createStaticGalleryPayload as s, attachMuseaOptions as t, handleArtAnalysis as u, handleTokensUsage as v, sortedArts as w, scanTokenUsage as x, buildTokenMap as y };
2157
+ export { rewriteRelativeImportStatement as A, buildTokenMap as C, sortedArts as D, parseTokens as E, resolveArtComponent as M, variantComponentNames as N, generateArtModule as O, processStyleDictionary as S, scanTokenUsage as T, handleTokensUpdate as _, rewriteGalleryBase as a, generateTokensHtml as b, joinUrlPath as c, handleArtDocs as d, handleArtSource as f, handleTokensGet as g, handleTokensDelete as h, publicBasePathFromViteBase as i, expandSelfTag as j, parseScriptSetupForArt as k, staticPreviewId as l, handleTokensCreate as m, readMuseaOptions as n, rewriteGalleryTextAssetBase as o, handleArtPalette as p, processMuseaArtFile as r, createStaticGalleryPayload as s, attachMuseaOptions as t, handleArtAnalysis as u, handleTokensUsage as v, resolveReferences as w, generateTokensMarkdown as x, resolveTokenPreview as y };
1842
2158
 
1843
- //# sourceMappingURL=options-DCuB_Fpu.mjs.map
2159
+ //# sourceMappingURL=options-DnKPMMPV.mjs.map