intelligent-system-design-language 0.3.26 → 0.3.27

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 (44) hide show
  1. package/out/_backgrounds.scss +17 -17
  2. package/out/_isdlStyles.scss +31 -0
  3. package/out/_vuetifyOverrides.scss +23 -1
  4. package/out/cli/components/_backgrounds.scss +17 -17
  5. package/out/cli/components/_isdlStyles.scss +31 -0
  6. package/out/cli/components/_vuetifyOverrides.scss +23 -1
  7. package/out/cli/components/css-generator.js +259 -0
  8. package/out/cli/components/css-generator.js.map +1 -1
  9. package/out/cli/components/datamodel-generator.js +8 -8
  10. package/out/cli/components/datamodel-generator.js.map +1 -1
  11. package/out/cli/components/init-hook-generator.js +11 -11
  12. package/out/cli/components/init-hook-generator.js.map +1 -1
  13. package/out/cli/components/language-generator.js +9 -1
  14. package/out/cli/components/language-generator.js.map +1 -1
  15. package/out/cli/components/method-generator.js +8 -7
  16. package/out/cli/components/method-generator.js.map +1 -1
  17. package/out/cli/components/utils.js +18 -12
  18. package/out/cli/components/utils.js.map +1 -1
  19. package/out/cli/components/vue/vue-action-component-generator.js +18 -9
  20. package/out/cli/components/vue/vue-action-component-generator.js.map +1 -1
  21. package/out/cli/components/vue/vue-generator.js +7 -7
  22. package/out/cli/components/vue/vue-generator.js.map +1 -1
  23. package/out/cli/components/vue/vue-prompt-generator.js +4 -4
  24. package/out/cli/components/vue/vue-prompt-generator.js.map +1 -1
  25. package/out/cli/components/vue/vue-sheet-application-generator.js +649 -544
  26. package/out/cli/components/vue/vue-sheet-application-generator.js.map +1 -1
  27. package/out/cli/generator.js +9 -3
  28. package/out/cli/generator.js.map +1 -1
  29. package/out/extension/main.cjs +2700 -807
  30. package/out/extension/main.cjs.map +3 -3
  31. package/out/extension/package.json +1 -1
  32. package/out/language/generated/ast.js +313 -8
  33. package/out/language/generated/ast.js.map +1 -1
  34. package/out/language/generated/grammar.js +2332 -763
  35. package/out/language/generated/grammar.js.map +1 -1
  36. package/out/language/intelligent-system-design-language-validator.js +87 -2
  37. package/out/language/intelligent-system-design-language-validator.js.map +1 -1
  38. package/out/language/main.cjs +2700 -807
  39. package/out/language/main.cjs.map +3 -3
  40. package/out/package.json +1 -1
  41. package/out/styles.scss +33 -4
  42. package/out/test/validating/theme.test.js +120 -0
  43. package/out/test/validating/theme.test.js.map +1 -0
  44. package/package.json +1 -1
@@ -1,17 +1,46 @@
1
1
  import * as path from 'node:path';
2
2
  import * as fs from 'node:fs';
3
3
  import { expandToNode, joinToNode, toString } from 'langium/generate';
4
- import { isAccess, isAction, isActor, isAttributeExp, isAttributeParamMod, isAttributeRollParam, isAttributeFunctionParam, isAttributeStyleParam, isBackgroundParam, isBooleanExp, isBooleanParamValue, isChoiceCustomProperty, isChoiceStringValue, isColorParam, isColumn, isDateExp, isDateTimeExp, isDiceField, isDiceFields, isDieChoicesParam, isDieNoneParam, isDieField, isDocumentChoiceExp, isDocumentChoicesExp, isEntry, isHtmlExp, isIconParam, isImageParam, isLabelParam, isMacroField, isMeasuredTemplateField, isDamageBonusesField, isDamageResistancesField, isPinnedField, isMoneyField, isDamageTrackExp, isDamageTrackTypesParam, isRollVisualizerField, isMethodBlock, isNumberExp, isNumberParamMax, isNumberParamMin, isNumberParamValue, isNumberParamCalculator, isPage, isPaperDollExp, isParentPropertyRefChoiceParam, isParentPropertyRefExp, isSelfPropertyRefExp, isProperty, isResourceExp, isRow, isSection, isSegmentsParameter, isSingleDocumentExp, isSizeParam, isStatusProperty, isStringChoiceField, isDamageTypeChoiceField, isStringChoicesField, isStringExp, isStringExtendedChoice, isStringParamChoices, isStringParamValue, isTableField, isTimeExp, isTrackerExp, isTrackerStyleParameter, isVisibilityParam, isInventoryField, isInventorySlotsParam, isInventoryRowsParam, isInventoryColumnsParam, isInventorySlotSizeParam, isInventoryQuantityParam, isInventoryMoneyParam, isInventorySumParam, isInventorySumMaxParam, isInventorySortParam, isInventoryEmptySlotsParam, isInventorySummaryParam, isWhereParam, isGlobalParam } from "../../../language/generated/ast.js";
4
+ import { isAccess, isAction, isActor, isConfigFlag, isTheme, isThemeFieldParam, isThemePrimaryParam, isThemeSecondaryParam, isThemeTertiaryParam, isAttributeExp, isAttributeParamMod, isAttributeRollParam, isAttributeFunctionParam, isAttributeStyleParam, isBackgroundParam, isBooleanExp, isBooleanParamValue, isChoiceCustomProperty, isChoiceStringValue, isColorParam, isColumn, isDateExp, isDateTimeExp, isDiceField, isDiceFields, isDieChoicesParam, isDieNoneParam, isDieField, isDocumentChoiceExp, isDocumentChoicesExp, isEntry, isHtmlExp, isIconParam, isImageParam, isLabelParam, isMacroField, isMeasuredTemplateField, isDamageBonusesField, isDamageResistancesField, isPinnedField, isMoneyField, isDamageTrackExp, isDamageTrackTypesParam, isRollVisualizerField, isMethodBlock, isNumberExp, isNumberParamMax, isNumberParamMin, isNumberParamValue, isNumberParamCalculator, isPage, isPaperDollExp, isParentPropertyRefChoiceParam, isParentPropertyRefExp, isSelfPropertyRefExp, isProperty, isResourceExp, isRow, isSection, isSegmentsParameter, isSingleDocumentExp, isSizeParam, isStatusProperty, isStringChoiceField, isDamageTypeChoiceField, isStringChoicesField, isStringExp, isStringExtendedChoice, isStringParamChoices, isStringParamValue, isTableField, isTimeExp, isTrackerExp, isTrackerStyleParameter, isVisibilityParam, isInventoryField, isInventorySlotsParam, isInventoryRowsParam, isInventoryColumnsParam, isInventorySlotSizeParam, isInventoryQuantityParam, isInventoryMoneyParam, isInventorySumParam, isInventorySumMaxParam, isInventorySortParam, isInventoryEmptySlotsParam, isInventorySummaryParam, isWhereParam, isGlobalParam } from "../../../language/generated/ast.js";
5
5
  import { getAllOfType, getDocument, getSystemPath, globalGetAllOfType, toMachineIdentifier } from '../utils.js';
6
6
  import { AstUtils } from 'langium';
7
- import { generateActionComponent } from './vue-action-component-generator.js';
7
+ import { generateActionComponent, generateDocumentPromptApps } from './vue-action-component-generator.js';
8
8
  import { generatePinnedVuetifyDatatableComponent } from './vue-pinned-datatable-component-generator.js';
9
9
  // import {generateDocumentChoiceComponent} from './vue-document-choice-component-generator.js';
10
10
  import { generateDocumentChoicesComponent } from './base-components/vue-document-choices.js';
11
11
  import { translateBodyExpressionToJavascript, translateExpression, compileVisualizerFormula } from '../method-generator.js';
12
+ import { themeBlockToInlineStyle } from '../css-generator.js';
12
13
  import { humanize } from "inflection";
13
14
  import { generateVuetifyDatatableComponent } from "./vue-datatable2-component-generator.js";
14
15
  import { generateDocumentChoiceComponent } from "./base-components/vue-document-choice.js";
16
+ // --- Theme-derived color defaults -------------------------------------------
17
+ // The per-document primary/secondary/tertiary color pickers default to the
18
+ // system theme (`config { theme { primary/secondary/tertiary } }`) when set,
19
+ // otherwise to the built-in palette. `userColors = false` in config hides the
20
+ // picker entirely (art-directed systems whose look is fixed by the theme).
21
+ const DEFAULT_PRIMARY = '#1565c0';
22
+ const DEFAULT_SECONDARY = '#4db6ac';
23
+ const DEFAULT_TERTIARY = '#ffb74d';
24
+ function getThemeColorDefaults(entry) {
25
+ const theme = entry.config.body.find(isTheme);
26
+ let primary = DEFAULT_PRIMARY, secondary = DEFAULT_SECONDARY, tertiary = DEFAULT_TERTIARY;
27
+ if (theme) {
28
+ for (const param of theme.params) {
29
+ if (isThemePrimaryParam(param))
30
+ primary = param.value;
31
+ else if (isThemeSecondaryParam(param))
32
+ secondary = param.value;
33
+ else if (isThemeTertiaryParam(param))
34
+ tertiary = param.value;
35
+ }
36
+ }
37
+ return { primary, secondary, tertiary };
38
+ }
39
+ // `userColors = false` disables the per-document color pickers. Default is true.
40
+ function getUserColorsEnabled(entry) {
41
+ const flag = entry.config.body.find(x => isConfigFlag(x) && x.type === 'userColors');
42
+ return flag ? flag.value : true;
43
+ }
15
44
  export function generateDocumentVueComponent(entry, id, document, destination) {
16
45
  const type = isActor(document) ? 'actor' : 'item';
17
46
  const generatedFileDir = path.join(destination, "system", "templates", "vue", type, document.name.toLowerCase());
@@ -19,6 +48,9 @@ export function generateDocumentVueComponent(entry, id, document, destination) {
19
48
  if (!fs.existsSync(generatedFileDir)) {
20
49
  fs.mkdirSync(generatedFileDir, { recursive: true });
21
50
  }
51
+ // Generate prompt apps for every action AND function prompt in this document,
52
+ // unconditionally per document (covers documents with function-prompts but no actions).
53
+ generateDocumentPromptApps(entry, id, document, destination);
22
54
  const fileNode = expandToNode `
23
55
  ${generateVueComponentScript(entry, id, document, destination)}
24
56
  ${generateVueComponentTemplate(entry, id, document)}
@@ -533,6 +565,8 @@ function generateVueComponentScript(entry, id, document, destination) {
533
565
  }
534
566
  return expandToNode ``;
535
567
  }
568
+ const themeColors = getThemeColorDefaults(entry);
569
+ const userColorsEnabled = getUserColorsEnabled(entry);
536
570
  return expandToNode `
537
571
  <script setup>
538
572
  import { ref, watch, inject, computed, watchEffect } from "vue";
@@ -549,10 +583,37 @@ function generateVueComponentScript(entry, id, document, destination) {
549
583
  const props = defineProps(['context']);
550
584
 
551
585
  // Colors
586
+ // Defaults come from the system theme (theme primary/secondary/tertiary tokens);
587
+ // when the theme doesn't set them they fall back to the built-in palette. These feed
588
+ // the Vuetify :color props on fields. userColorsEnabled mirrors the userColors config.
589
+ const userColorsEnabled = ${userColorsEnabled};
590
+ const defaultPrimaryColor = '${themeColors.primary}';
591
+ const defaultSecondaryColor = '${themeColors.secondary}';
592
+ const defaultTertiaryColor = '${themeColors.tertiary}';
593
+
552
594
  let storedColors = game.settings.get('${id}', 'documentColorThemes');
553
- const primaryColor = ref(storedColors[document.uuid]?.primary ?? '#1565c0');
554
- const secondaryColor = ref(storedColors[document.uuid]?.secondary ?? '#4db6ac');
555
- const tertiaryColor = ref(storedColors[document.uuid]?.tertiary ?? '#ffb74d');
595
+ const documentColors = userColorsEnabled ? (storedColors[document.uuid] ?? {}) : {};
596
+ const primaryColor = ref(documentColors.primary ?? defaultPrimaryColor);
597
+ const secondaryColor = ref(documentColors.secondary ?? defaultSecondaryColor);
598
+ const tertiaryColor = ref(documentColors.tertiary ?? defaultTertiaryColor);
599
+
600
+ // Track which colors the user has explicitly chosen. Only an explicit choice is
601
+ // emitted as a CSS variable (below) so it can override the theme default; the ref
602
+ // defaults must NOT leak to --isdl-* or an unthemed sheet would gain a colored edge.
603
+ const primarySet = ref(documentColors.primary != null);
604
+ const secondarySet = ref(documentColors.secondary != null);
605
+ const tertiarySet = ref(documentColors.tertiary != null);
606
+
607
+ // User-chosen colors override the theme's --isdl-primary/secondary/tertiary for this
608
+ // document. Bound inline on <v-app>, which sits inside .${id}.vue-application, so it wins
609
+ // over the theme.css defaults for every descendant field. Keys are omitted unless chosen.
610
+ const userColorVars = computed(() => {
611
+ const vars = {};
612
+ if (primarySet.value) vars['--isdl-primary'] = primaryColor.value;
613
+ if (secondarySet.value) vars['--isdl-secondary'] = secondaryColor.value;
614
+ if (tertiarySet.value) vars['--isdl-tertiary'] = tertiaryColor.value;
615
+ return vars;
616
+ });
556
617
 
557
618
  const setupColors = () => {
558
619
  const colors = {
@@ -563,19 +624,28 @@ function generateVueComponentScript(entry, id, document, destination) {
563
624
  game.settings.set('${id}', 'documentColorThemes', { ...storedColors, [document.uuid]: colors });
564
625
  };
565
626
  const resetColors = () => {
566
- primaryColor.value = '#1565c0';
567
- secondaryColor.value = '#4db6ac';
568
- tertiaryColor.value = '#ffb74d';
569
- setupColors();
627
+ primaryColor.value = defaultPrimaryColor;
628
+ secondaryColor.value = defaultSecondaryColor;
629
+ tertiaryColor.value = defaultTertiaryColor;
630
+ primarySet.value = false;
631
+ secondarySet.value = false;
632
+ tertiarySet.value = false;
633
+ let updated = { ...storedColors };
634
+ delete updated[document.uuid];
635
+ storedColors = updated;
636
+ game.settings.set('${id}', 'documentColorThemes', updated);
570
637
  };
571
638
 
572
639
  watch(primaryColor, () => {
640
+ primarySet.value = true;
573
641
  setupColors();
574
642
  });
575
643
  watch(secondaryColor, () => {
644
+ secondarySet.value = true;
576
645
  setupColors();
577
646
  });
578
647
  watch(tertiaryColor, () => {
648
+ tertiarySet.value = true;
579
649
  setupColors();
580
650
  });
581
651
 
@@ -761,9 +831,10 @@ function generateVueComponentTemplate(entry, id, document) {
761
831
  const firstPageTables = document.body.filter(isTableField); // We explicitly only want top-level tables
762
832
  const firstPagePinned = document.body.filter(isPinnedField); // We explicitly only want top-level pinned fields
763
833
  const firstPageInventories = document.body.filter(isInventoryField); // We explicitly only want top-level inventories
834
+ const userColorsEnabled = getUserColorsEnabled(entry);
764
835
  return expandToNode `
765
836
  <template>
766
- <v-app>
837
+ <v-app :style="userColorVars">
767
838
  <!-- App Bar -->
768
839
  <v-app-bar :color="editModeRef ? 'amber-accent-3' : primaryColor" density="comfortable">
769
840
  <v-app-bar-nav-icon @click="drawer = !drawer"></v-app-bar-nav-icon>
@@ -793,7 +864,7 @@ function generateVueComponentTemplate(entry, id, document) {
793
864
  ${joinToNode(pages, generateNavListItem, { appendNewLineIfNotEmpty: true })}
794
865
  </v-tabs>
795
866
  <template v-slot:append>
796
- <div class="pa-2">
867
+ <div class="pa-2" ${userColorsEnabled ? '' : 'v-if="false"'}>
797
868
  <v-btn block @click="setupColors" :color="secondaryColor" prepend-icon="fa-solid fa-palette">
798
869
  Setup Colors
799
870
 
@@ -1088,11 +1159,16 @@ function generateVueComponentTemplate(entry, id, document) {
1088
1159
  `.appendNewLine();
1089
1160
  }
1090
1161
  function generateElement(element, isTopLevel = false) {
1091
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
1162
+ var _a;
1163
+ // A layout container's `theme: { ... }` compiles to an inline `style="..."` of ACTUAL
1164
+ // CSS (not `--isdl-*` vars, which would inherit and leak sizing into nested children).
1165
+ // Section paints the inner <v-card> (border/bg/text live there); row/col paint themselves.
1166
+ const layoutStyle = themeBlockToInlineStyle((_a = element.params) === null || _a === void 0 ? void 0 : _a.find(isThemeFieldParam));
1167
+ const styleAttr = layoutStyle.length > 0 ? ` style="${layoutStyle}"` : '';
1092
1168
  if (isSection(element)) {
1093
1169
  return expandToNode `
1094
- <v-col class="section">
1095
- <v-card variant="outlined" elevation="4">
1170
+ <v-col class="section isdl-section isdl-section-${element.name.toLowerCase()}">
1171
+ <v-card variant="outlined" elevation="4"${styleAttr}>
1096
1172
  <v-card-title>{{ game.i18n.localize('${document.name}.${element.name}') }}</v-card-title>
1097
1173
 
1098
1174
  <v-card-text>
@@ -1106,14 +1182,14 @@ function generateVueComponentTemplate(entry, id, document) {
1106
1182
  }
1107
1183
  if (isRow(element)) {
1108
1184
  return expandToNode `
1109
- <v-row dense>
1185
+ <v-row dense class="isdl-row"${styleAttr}>
1110
1186
  ${joinToNode(element.body, element => generateElement(element), { appendNewLineIfNotEmpty: true })}
1111
1187
  </v-row>
1112
1188
  `;
1113
1189
  }
1114
1190
  if (isColumn(element)) {
1115
1191
  return expandToNode `
1116
- <v-col>
1192
+ <v-col class="isdl-column"${styleAttr}>
1117
1193
  ${joinToNode(element.body, element => generateElement(element), { appendNewLineIfNotEmpty: true })}
1118
1194
  </v-col>
1119
1195
  `;
@@ -1147,9 +1223,15 @@ function generateVueComponentTemplate(entry, id, document) {
1147
1223
  const standardParamsFragment = colorParam ? `:disabled="isDisabled('${element.name.toLowerCase()}')" v-if="!isHidden('${element.name.toLowerCase()}')" color="${colorParam.value}"` : `:disabled="isDisabled('${element.name.toLowerCase()}')" v-if="!isHidden('${element.name.toLowerCase()}')"`;
1148
1224
  const systemPath = getSystemPath(element, [], undefined, false);
1149
1225
  const entry = AstUtils.getContainerOfType(element, isEntry);
1150
- if (isRollVisualizerField(element)) {
1151
- const { formula, data } = compileVisualizerFormula(entry, id, element);
1152
- return expandToNode `
1226
+ // Single choke point for the theme marker: render the field by type, then stamp the
1227
+ // universal `isdl-field` (+ per-field `isdl-field-<name>`) class onto its <i-...> root.
1228
+ // Every field branch returns an <i-...> root, so this reaches ALL field types -- no
1229
+ // per-branch allowlist to drift out of sync as new field types are added.
1230
+ const fieldComponent = (() => {
1231
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
1232
+ if (isRollVisualizerField(element)) {
1233
+ const { formula, data } = compileVisualizerFormula(entry, id, element);
1234
+ return expandToNode `
1153
1235
  <i-roll-visualizer
1154
1236
  :context="context"
1155
1237
  label="${label}"
@@ -1161,80 +1243,80 @@ function generateVueComponentTemplate(entry, id, document) {
1161
1243
  v-if="!isHidden('${element.name.toLowerCase()}')">
1162
1244
  </i-roll-visualizer>
1163
1245
  `;
1164
- }
1165
- if (isParentPropertyRefExp(element)) {
1166
- const choicesParam = element.params.find(p => isParentPropertyRefChoiceParam(p));
1167
- let allChoices = [];
1168
- switch (element.propertyType) {
1169
- case "attribute":
1170
- allChoices = globalGetAllOfType(entry, isAttributeExp);
1171
- break;
1172
- case "resource":
1173
- allChoices = globalGetAllOfType(entry, isResourceExp);
1174
- break;
1175
- case "number":
1176
- allChoices = globalGetAllOfType(entry, isNumberExp);
1177
- break;
1178
- case "boolean":
1179
- allChoices = globalGetAllOfType(entry, isBooleanExp);
1180
- break;
1181
- case "date":
1182
- allChoices = globalGetAllOfType(entry, isDateExp);
1183
- break;
1184
- case "time":
1185
- allChoices = globalGetAllOfType(entry, isTimeExp);
1186
- break;
1187
- case "datetime":
1188
- allChoices = globalGetAllOfType(entry, isDateTimeExp);
1189
- break;
1190
- case "die":
1191
- allChoices = globalGetAllOfType(entry, isDieField);
1192
- break;
1193
- case "dice":
1194
- allChoices = globalGetAllOfType(entry, isDiceField);
1195
- break;
1196
- case "string":
1197
- allChoices = globalGetAllOfType(entry, isStringExp);
1198
- break;
1199
- case "tracker":
1200
- allChoices = globalGetAllOfType(entry, isTrackerExp);
1201
- break;
1202
- case "choice":
1203
- allChoices = globalGetAllOfType(entry, isDocumentChoiceExp);
1204
- break;
1205
- case "paperdoll":
1206
- allChoices = globalGetAllOfType(entry, isPaperDollExp);
1207
- break;
1208
- case "html":
1209
- allChoices = globalGetAllOfType(entry, isHtmlExp);
1210
- break;
1211
- //default: console.error("Unsupported parent property type: " + element.propertyType); break;
1212
1246
  }
1213
- let refChoices = allChoices.map(x => {
1214
- let parentDocument = getDocument(x);
1215
- if (choicesParam && choicesParam.choices.length > 0) {
1216
- if (!choicesParam.choices.find(y => {
1217
- var _a, _b;
1218
- const documentNameMatches = ((_a = y.document.ref) === null || _a === void 0 ? void 0 : _a.name.toLowerCase()) == (parentDocument === null || parentDocument === void 0 ? void 0 : parentDocument.name.toLowerCase());
1219
- if (y.property != undefined) {
1220
- const propertyNameMatches = ((_b = y.property.ref) === null || _b === void 0 ? void 0 : _b.name.toLowerCase()) == x.name.toLowerCase();
1221
- return documentNameMatches && propertyNameMatches;
1247
+ if (isParentPropertyRefExp(element)) {
1248
+ const choicesParam = element.params.find(p => isParentPropertyRefChoiceParam(p));
1249
+ let allChoices = [];
1250
+ switch (element.propertyType) {
1251
+ case "attribute":
1252
+ allChoices = globalGetAllOfType(entry, isAttributeExp);
1253
+ break;
1254
+ case "resource":
1255
+ allChoices = globalGetAllOfType(entry, isResourceExp);
1256
+ break;
1257
+ case "number":
1258
+ allChoices = globalGetAllOfType(entry, isNumberExp);
1259
+ break;
1260
+ case "boolean":
1261
+ allChoices = globalGetAllOfType(entry, isBooleanExp);
1262
+ break;
1263
+ case "date":
1264
+ allChoices = globalGetAllOfType(entry, isDateExp);
1265
+ break;
1266
+ case "time":
1267
+ allChoices = globalGetAllOfType(entry, isTimeExp);
1268
+ break;
1269
+ case "datetime":
1270
+ allChoices = globalGetAllOfType(entry, isDateTimeExp);
1271
+ break;
1272
+ case "die":
1273
+ allChoices = globalGetAllOfType(entry, isDieField);
1274
+ break;
1275
+ case "dice":
1276
+ allChoices = globalGetAllOfType(entry, isDiceField);
1277
+ break;
1278
+ case "string":
1279
+ allChoices = globalGetAllOfType(entry, isStringExp);
1280
+ break;
1281
+ case "tracker":
1282
+ allChoices = globalGetAllOfType(entry, isTrackerExp);
1283
+ break;
1284
+ case "choice":
1285
+ allChoices = globalGetAllOfType(entry, isDocumentChoiceExp);
1286
+ break;
1287
+ case "paperdoll":
1288
+ allChoices = globalGetAllOfType(entry, isPaperDollExp);
1289
+ break;
1290
+ case "html":
1291
+ allChoices = globalGetAllOfType(entry, isHtmlExp);
1292
+ break;
1293
+ //default: console.error("Unsupported parent property type: " + element.propertyType); break;
1294
+ }
1295
+ let refChoices = allChoices.map(x => {
1296
+ let parentDocument = getDocument(x);
1297
+ if (choicesParam && choicesParam.choices.length > 0) {
1298
+ if (!choicesParam.choices.find(y => {
1299
+ var _a, _b;
1300
+ const documentNameMatches = ((_a = y.document.ref) === null || _a === void 0 ? void 0 : _a.name.toLowerCase()) == (parentDocument === null || parentDocument === void 0 ? void 0 : parentDocument.name.toLowerCase());
1301
+ if (y.property != undefined) {
1302
+ const propertyNameMatches = ((_b = y.property.ref) === null || _b === void 0 ? void 0 : _b.name.toLowerCase()) == x.name.toLowerCase();
1303
+ return documentNameMatches && propertyNameMatches;
1304
+ }
1305
+ // Just check document name
1306
+ return documentNameMatches;
1307
+ })) {
1308
+ return undefined;
1222
1309
  }
1223
- // Just check document name
1224
- return documentNameMatches;
1225
- })) {
1226
- return undefined;
1227
1310
  }
1228
- }
1229
- return {
1230
- path: `system.${x.name.toLowerCase()}`,
1231
- parent: parentDocument === null || parentDocument === void 0 ? void 0 : parentDocument.name,
1232
- name: x.name
1233
- };
1234
- });
1235
- refChoices = refChoices.filter(x => x != undefined);
1236
- const choices = refChoices.map(c => `{ label: '${c === null || c === void 0 ? void 0 : c.parent} - ${c === null || c === void 0 ? void 0 : c.name}', value: '${c === null || c === void 0 ? void 0 : c.path}' }`).join(", ");
1237
- return expandToNode `
1311
+ return {
1312
+ path: `system.${x.name.toLowerCase()}`,
1313
+ parent: parentDocument === null || parentDocument === void 0 ? void 0 : parentDocument.name,
1314
+ name: x.name
1315
+ };
1316
+ });
1317
+ refChoices = refChoices.filter(x => x != undefined);
1318
+ const choices = refChoices.map(c => `{ label: '${c === null || c === void 0 ? void 0 : c.parent} - ${c === null || c === void 0 ? void 0 : c.name}', value: '${c === null || c === void 0 ? void 0 : c.path}' }`).join(", ");
1319
+ return expandToNode `
1238
1320
  <i-parent-property-reference
1239
1321
  :context="context"
1240
1322
  label="${label}"
@@ -1244,74 +1326,74 @@ function generateVueComponentTemplate(entry, id, document) {
1244
1326
  ${standardParamsFragment}>
1245
1327
  </i-parent-property-reference>
1246
1328
  `;
1247
- }
1248
- if (isSelfPropertyRefExp(element)) {
1249
- const choicesParam = element.params.find(p => p.$type === 'SelfPropertyRefChoiceParam');
1250
- let allChoices = [];
1251
- // Get the current document
1252
- const currentDocument = getDocument(element);
1253
- if (!currentDocument) {
1254
- return expandToNode `
1329
+ }
1330
+ if (isSelfPropertyRefExp(element)) {
1331
+ const choicesParam = element.params.find(p => p.$type === 'SelfPropertyRefChoiceParam');
1332
+ let allChoices = [];
1333
+ // Get the current document
1334
+ const currentDocument = getDocument(element);
1335
+ if (!currentDocument) {
1336
+ return expandToNode `
1255
1337
  <div class="error">Self property reference error: Cannot find current document</div>
1256
1338
  `;
1257
- }
1258
- switch (element.propertyType) {
1259
- case "attribute":
1260
- allChoices = getAllOfType(currentDocument.body, isAttributeExp);
1261
- break;
1262
- case "resource":
1263
- allChoices = getAllOfType(currentDocument.body, isResourceExp);
1264
- break;
1265
- case "number":
1266
- allChoices = getAllOfType(currentDocument.body, isNumberExp);
1267
- break;
1268
- case "boolean":
1269
- allChoices = getAllOfType(currentDocument.body, isBooleanExp);
1270
- break;
1271
- case "date":
1272
- allChoices = getAllOfType(currentDocument.body, isDateExp);
1273
- break;
1274
- case "time":
1275
- allChoices = getAllOfType(currentDocument.body, isTimeExp);
1276
- break;
1277
- case "datetime":
1278
- allChoices = getAllOfType(currentDocument.body, isDateTimeExp);
1279
- break;
1280
- case "die":
1281
- allChoices = getAllOfType(currentDocument.body, isDieField);
1282
- break;
1283
- case "dice":
1284
- allChoices = getAllOfType(currentDocument.body, isDiceField);
1285
- break;
1286
- case "string":
1287
- allChoices = getAllOfType(currentDocument.body, isStringExp);
1288
- break;
1289
- case "tracker":
1290
- allChoices = getAllOfType(currentDocument.body, isTrackerExp);
1291
- break;
1292
- case "choice":
1293
- allChoices = getAllOfType(currentDocument.body, isDocumentChoiceExp);
1294
- break;
1295
- case "paperdoll":
1296
- allChoices = getAllOfType(currentDocument.body, isPaperDollExp);
1297
- break;
1298
- case "html":
1299
- allChoices = getAllOfType(currentDocument.body, isHtmlExp);
1300
- break;
1301
- }
1302
- let refChoices = allChoices.filter(x => x !== element).map(x => {
1303
- return {
1304
- path: `system.${x.name.toLowerCase()}`,
1305
- name: x.name
1306
- };
1307
- });
1308
- // Filter based on choices parameter if provided
1309
- if (choicesParam && ((_a = choicesParam.choices) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1310
- const allowedProperties = choicesParam.choices.map((c) => { var _a; return (_a = c.property.ref) === null || _a === void 0 ? void 0 : _a.name.toLowerCase(); });
1311
- refChoices = refChoices.filter(x => allowedProperties.includes(x.name.toLowerCase()));
1312
- }
1313
- const choices = refChoices.map(c => `{ title: '${c.name}', value: '${c.path}' }`).join(", ");
1314
- return expandToNode `
1339
+ }
1340
+ switch (element.propertyType) {
1341
+ case "attribute":
1342
+ allChoices = getAllOfType(currentDocument.body, isAttributeExp);
1343
+ break;
1344
+ case "resource":
1345
+ allChoices = getAllOfType(currentDocument.body, isResourceExp);
1346
+ break;
1347
+ case "number":
1348
+ allChoices = getAllOfType(currentDocument.body, isNumberExp);
1349
+ break;
1350
+ case "boolean":
1351
+ allChoices = getAllOfType(currentDocument.body, isBooleanExp);
1352
+ break;
1353
+ case "date":
1354
+ allChoices = getAllOfType(currentDocument.body, isDateExp);
1355
+ break;
1356
+ case "time":
1357
+ allChoices = getAllOfType(currentDocument.body, isTimeExp);
1358
+ break;
1359
+ case "datetime":
1360
+ allChoices = getAllOfType(currentDocument.body, isDateTimeExp);
1361
+ break;
1362
+ case "die":
1363
+ allChoices = getAllOfType(currentDocument.body, isDieField);
1364
+ break;
1365
+ case "dice":
1366
+ allChoices = getAllOfType(currentDocument.body, isDiceField);
1367
+ break;
1368
+ case "string":
1369
+ allChoices = getAllOfType(currentDocument.body, isStringExp);
1370
+ break;
1371
+ case "tracker":
1372
+ allChoices = getAllOfType(currentDocument.body, isTrackerExp);
1373
+ break;
1374
+ case "choice":
1375
+ allChoices = getAllOfType(currentDocument.body, isDocumentChoiceExp);
1376
+ break;
1377
+ case "paperdoll":
1378
+ allChoices = getAllOfType(currentDocument.body, isPaperDollExp);
1379
+ break;
1380
+ case "html":
1381
+ allChoices = getAllOfType(currentDocument.body, isHtmlExp);
1382
+ break;
1383
+ }
1384
+ let refChoices = allChoices.filter(x => x !== element).map(x => {
1385
+ return {
1386
+ path: `system.${x.name.toLowerCase()}`,
1387
+ name: x.name
1388
+ };
1389
+ });
1390
+ // Filter based on choices parameter if provided
1391
+ if (choicesParam && ((_a = choicesParam.choices) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1392
+ const allowedProperties = choicesParam.choices.map((c) => { var _a; return (_a = c.property.ref) === null || _a === void 0 ? void 0 : _a.name.toLowerCase(); });
1393
+ refChoices = refChoices.filter(x => allowedProperties.includes(x.name.toLowerCase()));
1394
+ }
1395
+ const choices = refChoices.map(c => `{ title: '${c.name}', value: '${c.path}' }`).join(", ");
1396
+ return expandToNode `
1315
1397
  <i-self-property-reference
1316
1398
  :context="context"
1317
1399
  label="${label}"
@@ -1322,11 +1404,11 @@ function generateVueComponentTemplate(entry, id, document) {
1322
1404
  ${standardParamsFragment}>
1323
1405
  </i-self-property-reference>
1324
1406
  `;
1325
- }
1326
- if (isStringExp(element)) {
1327
- const valueParam = element.params.find(p => isStringParamValue(p));
1328
- if (valueParam !== undefined) {
1329
- return expandToNode `
1407
+ }
1408
+ if (isStringExp(element)) {
1409
+ const valueParam = element.params.find(p => isStringParamValue(p));
1410
+ if (valueParam !== undefined) {
1411
+ return expandToNode `
1330
1412
  <i-string
1331
1413
  :context="context"
1332
1414
  label="${label}"
@@ -1335,8 +1417,8 @@ function generateVueComponentTemplate(entry, id, document) {
1335
1417
  ${standardParamsFragment}>
1336
1418
  </i-string>
1337
1419
  `;
1338
- }
1339
- return expandToNode `
1420
+ }
1421
+ return expandToNode `
1340
1422
  <i-text-field
1341
1423
  label="${label}"
1342
1424
  icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
@@ -1348,46 +1430,46 @@ function generateVueComponentTemplate(entry, id, document) {
1348
1430
  :secondaryColor="secondaryColor">
1349
1431
  </i-text-field>
1350
1432
  `;
1351
- }
1352
- if (isStringChoiceField(element)) {
1353
- const choicesParam = element.params.find(p => isStringParamChoices(p));
1354
- if (!choicesParam) {
1355
- console.warn(`StringChoiceField ${element.name} does not have a choices parameter.`);
1356
- return expandToNode ``;
1357
1433
  }
1358
- if (((_b = choicesParam === null || choicesParam === void 0 ? void 0 : choicesParam.choices) === null || _b === void 0 ? void 0 : _b.length) === 0)
1359
- return expandToNode ``;
1360
- function choiceValue(choice) {
1361
- if (!isStringExtendedChoice(choice.value)) {
1362
- return toMachineIdentifier(choice.value);
1363
- }
1364
- let value = choice.value.properties.find(isChoiceStringValue);
1365
- if (value) {
1366
- return toMachineIdentifier(value.value);
1434
+ if (isStringChoiceField(element)) {
1435
+ const choicesParam = element.params.find(p => isStringParamChoices(p));
1436
+ if (!choicesParam) {
1437
+ console.warn(`StringChoiceField ${element.name} does not have a choices parameter.`);
1438
+ return expandToNode ``;
1367
1439
  }
1368
- let label = choice.value.properties.find(isLabelParam);
1369
- if (label) {
1370
- return toMachineIdentifier(label.value);
1371
- }
1372
- return "unknown";
1373
- }
1374
- function choiceData(choice) {
1375
- var _a, _b, _c, _d;
1376
- let choiceField = element;
1377
- if (!isStringExtendedChoice(choice.value)) {
1378
- return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '', color: '' }`;
1440
+ if (((_b = choicesParam === null || choicesParam === void 0 ? void 0 : choicesParam.choices) === null || _b === void 0 ? void 0 : _b.length) === 0)
1441
+ return expandToNode ``;
1442
+ function choiceValue(choice) {
1443
+ if (!isStringExtendedChoice(choice.value)) {
1444
+ return toMachineIdentifier(choice.value);
1445
+ }
1446
+ let value = choice.value.properties.find(isChoiceStringValue);
1447
+ if (value) {
1448
+ return toMachineIdentifier(value.value);
1449
+ }
1450
+ let label = choice.value.properties.find(isLabelParam);
1451
+ if (label) {
1452
+ return toMachineIdentifier(label.value);
1453
+ }
1454
+ return "unknown";
1379
1455
  }
1380
- let icon = choice.value.properties.find(isIconParam);
1381
- let color = choice.value.properties.find(isColorParam);
1382
- if (isStringExtendedChoice(choice.value)) {
1383
- let customProperties = choice.value.properties.filter(isChoiceCustomProperty);
1384
- if (customProperties.length > 0) {
1385
- return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '${(_a = icon === null || icon === void 0 ? void 0 : icon.value) !== null && _a !== void 0 ? _a : ""}', color: '${(_b = color === null || color === void 0 ? void 0 : color.value) !== null && _b !== void 0 ? _b : ""}', customKeys: [${joinToNode(customProperties, custom => `{ key: '${custom.key}', label: '${humanize(custom.key)}', value: ${custom.value} }`, { separator: ',' })}] }`;
1456
+ function choiceData(choice) {
1457
+ var _a, _b, _c, _d;
1458
+ let choiceField = element;
1459
+ if (!isStringExtendedChoice(choice.value)) {
1460
+ return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '', color: '' }`;
1461
+ }
1462
+ let icon = choice.value.properties.find(isIconParam);
1463
+ let color = choice.value.properties.find(isColorParam);
1464
+ if (isStringExtendedChoice(choice.value)) {
1465
+ let customProperties = choice.value.properties.filter(isChoiceCustomProperty);
1466
+ if (customProperties.length > 0) {
1467
+ return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '${(_a = icon === null || icon === void 0 ? void 0 : icon.value) !== null && _a !== void 0 ? _a : ""}', color: '${(_b = color === null || color === void 0 ? void 0 : color.value) !== null && _b !== void 0 ? _b : ""}', customKeys: [${joinToNode(customProperties, custom => `{ key: '${custom.key}', label: '${humanize(custom.key)}', value: ${custom.value} }`, { separator: ',' })}] }`;
1468
+ }
1386
1469
  }
1470
+ return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '${(_c = icon === null || icon === void 0 ? void 0 : icon.value) !== null && _c !== void 0 ? _c : ""}', color: '${(_d = color === null || color === void 0 ? void 0 : color.value) !== null && _d !== void 0 ? _d : ""}' }`;
1387
1471
  }
1388
- return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '${(_c = icon === null || icon === void 0 ? void 0 : icon.value) !== null && _c !== void 0 ? _c : ""}', color: '${(_d = color === null || color === void 0 ? void 0 : color.value) !== null && _d !== void 0 ? _d : ""}' }`;
1389
- }
1390
- return expandToNode `
1472
+ return expandToNode `
1391
1473
  <i-string-choice
1392
1474
  :context="context"
1393
1475
  label="${label}.label"
@@ -1400,52 +1482,52 @@ function generateVueComponentTemplate(entry, id, document) {
1400
1482
  ${standardParamsFragment}>
1401
1483
  </i-string-choice>
1402
1484
  `;
1403
- }
1404
- if (isDamageTypeChoiceField(element)) {
1405
- const choicesParam = element.params.find(p => isStringParamChoices(p));
1406
- if (!choicesParam) {
1407
- console.warn(`DamageTypeChoiceField ${element.name} does not have a choices parameter.`);
1408
- return expandToNode ``;
1409
- }
1410
- if (((_c = choicesParam === null || choicesParam === void 0 ? void 0 : choicesParam.choices) === null || _c === void 0 ? void 0 : _c.length) === 0)
1411
- return expandToNode ``;
1412
- function choiceValue(choice) {
1413
- if (!isStringExtendedChoice(choice.value)) {
1414
- return toMachineIdentifier(choice.value);
1415
- }
1416
- let value = choice.value.properties.find(isChoiceStringValue);
1417
- if (value) {
1418
- return toMachineIdentifier(value.value);
1419
- }
1420
- let label = choice.value.properties.find(isLabelParam);
1421
- if (label) {
1422
- return toMachineIdentifier(label.value);
1423
- }
1424
- return "unknown";
1425
1485
  }
1426
- function choiceData(choice) {
1427
- var _a, _b, _c, _d;
1428
- let choiceField = element;
1429
- if (!isStringExtendedChoice(choice.value)) {
1430
- return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '', color: '' }`;
1486
+ if (isDamageTypeChoiceField(element)) {
1487
+ const choicesParam = element.params.find(p => isStringParamChoices(p));
1488
+ if (!choicesParam) {
1489
+ console.warn(`DamageTypeChoiceField ${element.name} does not have a choices parameter.`);
1490
+ return expandToNode ``;
1431
1491
  }
1432
- let icon = choice.value.properties.find(isIconParam);
1433
- let color = choice.value.properties.find(isColorParam);
1434
- function asStringOrVal(value) {
1435
- // If string, return as "value", else just value
1436
- if (typeof value === 'string')
1437
- return `'${value}'`;
1438
- return `${value}`;
1492
+ if (((_c = choicesParam === null || choicesParam === void 0 ? void 0 : choicesParam.choices) === null || _c === void 0 ? void 0 : _c.length) === 0)
1493
+ return expandToNode ``;
1494
+ function choiceValue(choice) {
1495
+ if (!isStringExtendedChoice(choice.value)) {
1496
+ return toMachineIdentifier(choice.value);
1497
+ }
1498
+ let value = choice.value.properties.find(isChoiceStringValue);
1499
+ if (value) {
1500
+ return toMachineIdentifier(value.value);
1501
+ }
1502
+ let label = choice.value.properties.find(isLabelParam);
1503
+ if (label) {
1504
+ return toMachineIdentifier(label.value);
1505
+ }
1506
+ return "unknown";
1439
1507
  }
1440
- if (isStringExtendedChoice(choice.value)) {
1441
- let customProperties = choice.value.properties.filter(isChoiceCustomProperty);
1442
- if (customProperties.length > 0) {
1443
- return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '${(_a = icon === null || icon === void 0 ? void 0 : icon.value) !== null && _a !== void 0 ? _a : ""}', color: '${(_b = color === null || color === void 0 ? void 0 : color.value) !== null && _b !== void 0 ? _b : ""}', customKeys: [${joinToNode(customProperties, custom => `{ key: '${custom.key}', label: '${humanize(custom.key)}', value: ${asStringOrVal(custom.value)} }`, { separator: ',' })}] }`;
1508
+ function choiceData(choice) {
1509
+ var _a, _b, _c, _d;
1510
+ let choiceField = element;
1511
+ if (!isStringExtendedChoice(choice.value)) {
1512
+ return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '', color: '' }`;
1513
+ }
1514
+ let icon = choice.value.properties.find(isIconParam);
1515
+ let color = choice.value.properties.find(isColorParam);
1516
+ function asStringOrVal(value) {
1517
+ // If string, return as "value", else just value
1518
+ if (typeof value === 'string')
1519
+ return `'${value}'`;
1520
+ return `${value}`;
1521
+ }
1522
+ if (isStringExtendedChoice(choice.value)) {
1523
+ let customProperties = choice.value.properties.filter(isChoiceCustomProperty);
1524
+ if (customProperties.length > 0) {
1525
+ return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '${(_a = icon === null || icon === void 0 ? void 0 : icon.value) !== null && _a !== void 0 ? _a : ""}', color: '${(_b = color === null || color === void 0 ? void 0 : color.value) !== null && _b !== void 0 ? _b : ""}', customKeys: [${joinToNode(customProperties, custom => `{ key: '${custom.key}', label: '${humanize(custom.key)}', value: ${asStringOrVal(custom.value)} }`, { separator: ',' })}] }`;
1526
+ }
1444
1527
  }
1528
+ return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '${(_c = icon === null || icon === void 0 ? void 0 : icon.value) !== null && _c !== void 0 ? _c : ""}', color: '${(_d = color === null || color === void 0 ? void 0 : color.value) !== null && _d !== void 0 ? _d : ""}' }`;
1445
1529
  }
1446
- return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '${(_c = icon === null || icon === void 0 ? void 0 : icon.value) !== null && _c !== void 0 ? _c : ""}', color: '${(_d = color === null || color === void 0 ? void 0 : color.value) !== null && _d !== void 0 ? _d : ""}' }`;
1447
- }
1448
- return expandToNode `
1530
+ return expandToNode `
1449
1531
  <i-string-choice
1450
1532
  :context="context"
1451
1533
  label="${label}.label"
@@ -1458,49 +1540,49 @@ function generateVueComponentTemplate(entry, id, document) {
1458
1540
  ${standardParamsFragment}>
1459
1541
  </i-string-choice>
1460
1542
  `;
1461
- }
1462
- if (isStringChoicesField(element)) {
1463
- const choicesParam = element.params.find(p => p.$type === 'StringChoicesParamChoices');
1464
- if (!choicesParam) {
1465
- console.warn(`StringChoicesField ${element.name} does not have a choices parameter.`);
1466
- return expandToNode ``;
1467
1543
  }
1468
- if (((_d = choicesParam === null || choicesParam === void 0 ? void 0 : choicesParam.choices) === null || _d === void 0 ? void 0 : _d.length) === 0)
1469
- return expandToNode ``;
1470
- function choiceValue(choice) {
1471
- if (!isStringExtendedChoice(choice.value)) {
1472
- return toMachineIdentifier(choice.value);
1473
- }
1474
- let value = choice.value.properties.find(isChoiceStringValue);
1475
- if (value) {
1476
- return toMachineIdentifier(value.value);
1477
- }
1478
- let label = choice.value.properties.find(isLabelParam);
1479
- if (label) {
1480
- return toMachineIdentifier(label.value);
1544
+ if (isStringChoicesField(element)) {
1545
+ const choicesParam = element.params.find(p => p.$type === 'StringChoicesParamChoices');
1546
+ if (!choicesParam) {
1547
+ console.warn(`StringChoicesField ${element.name} does not have a choices parameter.`);
1548
+ return expandToNode ``;
1481
1549
  }
1482
- return "unknown";
1483
- }
1484
- function choiceData(choice) {
1485
- var _a, _b, _c, _d;
1486
- let choiceField = element;
1487
- if (!isStringExtendedChoice(choice.value)) {
1488
- return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '', color: '' }`;
1550
+ if (((_d = choicesParam === null || choicesParam === void 0 ? void 0 : choicesParam.choices) === null || _d === void 0 ? void 0 : _d.length) === 0)
1551
+ return expandToNode ``;
1552
+ function choiceValue(choice) {
1553
+ if (!isStringExtendedChoice(choice.value)) {
1554
+ return toMachineIdentifier(choice.value);
1555
+ }
1556
+ let value = choice.value.properties.find(isChoiceStringValue);
1557
+ if (value) {
1558
+ return toMachineIdentifier(value.value);
1559
+ }
1560
+ let label = choice.value.properties.find(isLabelParam);
1561
+ if (label) {
1562
+ return toMachineIdentifier(label.value);
1563
+ }
1564
+ return "unknown";
1489
1565
  }
1490
- let icon = choice.value.properties.find(isIconParam);
1491
- let color = choice.value.properties.find(isColorParam);
1492
- if (isStringExtendedChoice(choice.value)) {
1493
- let customProperties = choice.value.properties.filter(isChoiceCustomProperty);
1494
- if (customProperties.length > 0) {
1495
- return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '${(_a = icon === null || icon === void 0 ? void 0 : icon.value) !== null && _a !== void 0 ? _a : ""}', color: '${(_b = color === null || color === void 0 ? void 0 : color.value) !== null && _b !== void 0 ? _b : ""}', customKeys: [${joinToNode(customProperties, custom => `{ key: '${custom.key}', label: '${humanize(custom.key)}', value: ${custom.value} }`, { separator: ',' })}] }`;
1566
+ function choiceData(choice) {
1567
+ var _a, _b, _c, _d;
1568
+ let choiceField = element;
1569
+ if (!isStringExtendedChoice(choice.value)) {
1570
+ return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '', color: '' }`;
1571
+ }
1572
+ let icon = choice.value.properties.find(isIconParam);
1573
+ let color = choice.value.properties.find(isColorParam);
1574
+ if (isStringExtendedChoice(choice.value)) {
1575
+ let customProperties = choice.value.properties.filter(isChoiceCustomProperty);
1576
+ if (customProperties.length > 0) {
1577
+ return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '${(_a = icon === null || icon === void 0 ? void 0 : icon.value) !== null && _a !== void 0 ? _a : ""}', color: '${(_b = color === null || color === void 0 ? void 0 : color.value) !== null && _b !== void 0 ? _b : ""}', customKeys: [${joinToNode(customProperties, custom => `{ key: '${custom.key}', label: '${humanize(custom.key)}', value: ${custom.value} }`, { separator: ',' })}] }`;
1578
+ }
1496
1579
  }
1580
+ return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '${(_c = icon === null || icon === void 0 ? void 0 : icon.value) !== null && _c !== void 0 ? _c : ""}', color: '${(_d = color === null || color === void 0 ? void 0 : color.value) !== null && _d !== void 0 ? _d : ""}' }`;
1497
1581
  }
1498
- return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '${(_c = icon === null || icon === void 0 ? void 0 : icon.value) !== null && _c !== void 0 ? _c : ""}', color: '${(_d = color === null || color === void 0 ? void 0 : color.value) !== null && _d !== void 0 ? _d : ""}' }`;
1499
- }
1500
- // Get maxSelections parameter
1501
- const maxParam = element.params.find(p => p.$type === 'StringChoicesParamMax');
1502
- const maxSelections = maxParam ? maxParam.value : undefined;
1503
- return expandToNode `
1582
+ // Get maxSelections parameter
1583
+ const maxParam = element.params.find(p => p.$type === 'StringChoicesParamMax');
1584
+ const maxSelections = maxParam ? maxParam.value : undefined;
1585
+ return expandToNode `
1504
1586
  <i-string-choices
1505
1587
  :context="context"
1506
1588
  label="${label}.label"
@@ -1514,10 +1596,10 @@ function generateVueComponentTemplate(entry, id, document) {
1514
1596
  ${standardParamsFragment}>
1515
1597
  </i-string-choices>
1516
1598
  `;
1517
- }
1518
- if (isDocumentChoiceExp(element)) {
1519
- const componentName = `${document.name.toLowerCase()}${element.name}DocumentChoice`;
1520
- return expandToNode `
1599
+ }
1600
+ if (isDocumentChoiceExp(element)) {
1601
+ const componentName = `${document.name.toLowerCase()}${element.name}DocumentChoice`;
1602
+ return expandToNode `
1521
1603
  <${componentName}
1522
1604
  label="${label}"
1523
1605
  icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
@@ -1528,10 +1610,10 @@ function generateVueComponentTemplate(entry, id, document) {
1528
1610
  :secondaryColor="secondaryColor">
1529
1611
  </${componentName}>
1530
1612
  `;
1531
- }
1532
- if (isDocumentChoicesExp(element)) {
1533
- const componentName = `${document.name.toLowerCase()}${element.name}DocumentChoices`;
1534
- return expandToNode `
1613
+ }
1614
+ if (isDocumentChoicesExp(element)) {
1615
+ const componentName = `${document.name.toLowerCase()}${element.name}DocumentChoices`;
1616
+ return expandToNode `
1535
1617
  <${componentName}
1536
1618
  label="${label}"
1537
1619
  icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
@@ -1542,9 +1624,9 @@ function generateVueComponentTemplate(entry, id, document) {
1542
1624
  :secondaryColor="secondaryColor">
1543
1625
  </${componentName}>
1544
1626
  `;
1545
- }
1546
- if (isMacroField(element)) {
1547
- return expandToNode `
1627
+ }
1628
+ if (isMacroField(element)) {
1629
+ return expandToNode `
1548
1630
  <i-macro
1549
1631
  label="${label}"
1550
1632
  icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
@@ -1556,9 +1638,9 @@ function generateVueComponentTemplate(entry, id, document) {
1556
1638
  :secondaryColor="secondaryColor">
1557
1639
  </i-macro>
1558
1640
  `;
1559
- }
1560
- if (isHtmlExp(element)) {
1561
- return expandToNode `
1641
+ }
1642
+ if (isHtmlExp(element)) {
1643
+ return expandToNode `
1562
1644
  <i-prosemirror
1563
1645
  label="${label}"
1564
1646
  icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
@@ -1566,9 +1648,9 @@ function generateVueComponentTemplate(entry, id, document) {
1566
1648
  ${standardParamsFragment}>
1567
1649
  </i-prosemirror>
1568
1650
  `;
1569
- }
1570
- if (isMeasuredTemplateField(element)) {
1571
- return expandToNode `
1651
+ }
1652
+ if (isMeasuredTemplateField(element)) {
1653
+ return expandToNode `
1572
1654
  <i-measured-template
1573
1655
  :context="context"
1574
1656
  label="${label}"
@@ -1579,9 +1661,9 @@ function generateVueComponentTemplate(entry, id, document) {
1579
1661
  ${standardParamsFragment}>
1580
1662
  </i-measured-template>
1581
1663
  `;
1582
- }
1583
- if (isDamageBonusesField(element)) {
1584
- return expandToNode `
1664
+ }
1665
+ if (isDamageBonusesField(element)) {
1666
+ return expandToNode `
1585
1667
  <i-bonuses
1586
1668
  :context="context"
1587
1669
  label="${label}"
@@ -1590,9 +1672,9 @@ function generateVueComponentTemplate(entry, id, document) {
1590
1672
  ${standardParamsFragment}>
1591
1673
  </i-bonuses>
1592
1674
  `;
1593
- }
1594
- if (isDamageResistancesField(element)) {
1595
- return expandToNode `
1675
+ }
1676
+ if (isDamageResistancesField(element)) {
1677
+ return expandToNode `
1596
1678
  <i-resistances
1597
1679
  :context="context"
1598
1680
  label="${label}"
@@ -1601,17 +1683,17 @@ function generateVueComponentTemplate(entry, id, document) {
1601
1683
  ${standardParamsFragment}>
1602
1684
  </i-resistances>
1603
1685
  `;
1604
- }
1605
- if (isPinnedField(element)) {
1606
- if (isTopLevel)
1607
- return expandToNode ``;
1608
- const page = AstUtils.getContainerOfType(element, isPage);
1609
- const pageName = (_e = page === null || page === void 0 ? void 0 : page.name) !== null && _e !== void 0 ? _e : document.name;
1610
- const systemPath = getSystemPath(element, [], undefined, false);
1611
- let componentName = `${document.name}${pageName}${element.name}VuetifyDatatable`;
1612
- // Wrap in a drop zone so drag-drop works for pinned tables inside a
1613
- // row/column (same reason as regular tables above).
1614
- return expandToNode `
1686
+ }
1687
+ if (isPinnedField(element)) {
1688
+ if (isTopLevel)
1689
+ return expandToNode ``;
1690
+ const page = AstUtils.getContainerOfType(element, isPage);
1691
+ const pageName = (_e = page === null || page === void 0 ? void 0 : page.name) !== null && _e !== void 0 ? _e : document.name;
1692
+ const systemPath = getSystemPath(element, [], undefined, false);
1693
+ let componentName = `${document.name}${pageName}${element.name}VuetifyDatatable`;
1694
+ // Wrap in a drop zone so drag-drop works for pinned tables inside a
1695
+ // row/column (same reason as regular tables above).
1696
+ return expandToNode `
1615
1697
  <div class="datatable-drop-zone" v-if="!isHidden('${element.name.toLowerCase()}')">
1616
1698
  <${componentName}
1617
1699
  :context="context"
@@ -1622,9 +1704,9 @@ function generateVueComponentTemplate(entry, id, document) {
1622
1704
  </${componentName}>
1623
1705
  </div>
1624
1706
  `;
1625
- }
1626
- if (isBooleanExp(element)) {
1627
- return expandToNode `
1707
+ }
1708
+ if (isBooleanExp(element)) {
1709
+ return expandToNode `
1628
1710
  <i-boolean
1629
1711
  :context="context"
1630
1712
  label="${label}"
@@ -1633,23 +1715,23 @@ function generateVueComponentTemplate(entry, id, document) {
1633
1715
  ${standardParamsFragment}>
1634
1716
  </i-boolean>
1635
1717
  `;
1636
- }
1637
- if (isNumberExp(element)) {
1638
- const valueParam = element.params.find(x => isNumberParamValue(x));
1639
- const minParam = element.params.find(x => isNumberParamMin(x));
1640
- const maxParam = element.params.find(x => isNumberParamMax(x));
1641
- const calculatorParam = element.params.find(x => isNumberParamCalculator(x));
1642
- // Determine if min/max are literal numbers (not MethodBlocks). Literal bounds are
1643
- // bound onto the widget so it clamps input at entry, matching the schema's clamp.
1644
- let minValue = undefined;
1645
- if (minParam && typeof minParam.value === 'number') {
1646
- minValue = minParam.value;
1647
- }
1648
- let maxValue = undefined;
1649
- if (maxParam && typeof maxParam.value === 'number') {
1650
- maxValue = maxParam.value;
1651
1718
  }
1652
- return expandToNode `
1719
+ if (isNumberExp(element)) {
1720
+ const valueParam = element.params.find(x => isNumberParamValue(x));
1721
+ const minParam = element.params.find(x => isNumberParamMin(x));
1722
+ const maxParam = element.params.find(x => isNumberParamMax(x));
1723
+ const calculatorParam = element.params.find(x => isNumberParamCalculator(x));
1724
+ // Determine if min/max are literal numbers (not MethodBlocks). Literal bounds are
1725
+ // bound onto the widget so it clamps input at entry, matching the schema's clamp.
1726
+ let minValue = undefined;
1727
+ if (minParam && typeof minParam.value === 'number') {
1728
+ minValue = minParam.value;
1729
+ }
1730
+ let maxValue = undefined;
1731
+ if (maxParam && typeof maxParam.value === 'number') {
1732
+ maxValue = maxParam.value;
1733
+ }
1734
+ return expandToNode `
1653
1735
  <i-number
1654
1736
  :context="context"
1655
1737
  label="${label}"
@@ -1665,27 +1747,27 @@ function generateVueComponentTemplate(entry, id, document) {
1665
1747
  ${standardParamsFragment}>
1666
1748
  </i-number>
1667
1749
  `;
1668
- }
1669
- if (isMoneyField(element)) {
1670
- const formatParam = element.params.find(p => p.$type === 'MoneyFormatParam');
1671
- const precisionParam = element.params.find(p => p.$type === 'MoneyPrecisionParam');
1672
- const displayParam = element.params.find(p => p.$type === 'MoneyDisplayParam');
1673
- const valueParam = element.params.find(x => isNumberParamValue(x));
1674
- const format = (formatParam === null || formatParam === void 0 ? void 0 : formatParam.value) || 'auto';
1675
- const precision = (precisionParam === null || precisionParam === void 0 ? void 0 : precisionParam.value) || 1;
1676
- const display = (displayParam === null || displayParam === void 0 ? void 0 : displayParam.value) || 'breakdown';
1677
- // Generate denominations array from AST
1678
- let denominationsArray = '[]';
1679
- if (element.denominations && element.denominations.length > 0) {
1680
- const denominations = element.denominations.map(denom => {
1681
- const valueParam = denom.params.find((p) => p.$type === 'MoneyDenominationValueParam');
1682
- const denomIconParam = denom.params.find((p) => p.$type === 'IconParam');
1683
- const denomColorParam = denom.params.find((p) => p.$type === 'ColorParam');
1684
- return `{ name: '${denom.name}', value: ${(valueParam === null || valueParam === void 0 ? void 0 : valueParam.value) || 1}, icon: '${(denomIconParam === null || denomIconParam === void 0 ? void 0 : denomIconParam.value) || ''}', color: '${(denomColorParam === null || denomColorParam === void 0 ? void 0 : denomColorParam.value) || ''}' }`;
1685
- }).join(', ');
1686
- denominationsArray = `[${denominations}]`;
1687
1750
  }
1688
- return expandToNode `
1751
+ if (isMoneyField(element)) {
1752
+ const formatParam = element.params.find(p => p.$type === 'MoneyFormatParam');
1753
+ const precisionParam = element.params.find(p => p.$type === 'MoneyPrecisionParam');
1754
+ const displayParam = element.params.find(p => p.$type === 'MoneyDisplayParam');
1755
+ const valueParam = element.params.find(x => isNumberParamValue(x));
1756
+ const format = (formatParam === null || formatParam === void 0 ? void 0 : formatParam.value) || 'auto';
1757
+ const precision = (precisionParam === null || precisionParam === void 0 ? void 0 : precisionParam.value) || 1;
1758
+ const display = (displayParam === null || displayParam === void 0 ? void 0 : displayParam.value) || 'breakdown';
1759
+ // Generate denominations array from AST
1760
+ let denominationsArray = '[]';
1761
+ if (element.denominations && element.denominations.length > 0) {
1762
+ const denominations = element.denominations.map(denom => {
1763
+ const valueParam = denom.params.find((p) => p.$type === 'MoneyDenominationValueParam');
1764
+ const denomIconParam = denom.params.find((p) => p.$type === 'IconParam');
1765
+ const denomColorParam = denom.params.find((p) => p.$type === 'ColorParam');
1766
+ return `{ name: '${denom.name}', value: ${(valueParam === null || valueParam === void 0 ? void 0 : valueParam.value) || 1}, icon: '${(denomIconParam === null || denomIconParam === void 0 ? void 0 : denomIconParam.value) || ''}', color: '${(denomColorParam === null || denomColorParam === void 0 ? void 0 : denomColorParam.value) || ''}' }`;
1767
+ }).join(', ');
1768
+ denominationsArray = `[${denominations}]`;
1769
+ }
1770
+ return expandToNode `
1689
1771
  <i-money
1690
1772
  :context="context"
1691
1773
  label="${label}"
@@ -1702,26 +1784,26 @@ function generateVueComponentTemplate(entry, id, document) {
1702
1784
  ${standardParamsFragment}>
1703
1785
  </i-money>
1704
1786
  `;
1705
- }
1706
- if (isAttributeExp(element)) {
1707
- const minParam = element.params.find(x => isNumberParamMin(x));
1708
- const min = (_f = minParam === null || minParam === void 0 ? void 0 : minParam.value) !== null && _f !== void 0 ? _f : 0;
1709
- const hasMod = element.params.find(x => isAttributeParamMod(x)) != undefined;
1710
- const modSystemPath = getSystemPath(element, ["mod"], undefined, false);
1711
- const valueSystemPath = getSystemPath(element, ["value"], undefined, false);
1712
- const styleParam = element.params.find(x => isAttributeStyleParam(x));
1713
- const style = (_g = styleParam === null || styleParam === void 0 ? void 0 : styleParam.style) !== null && _g !== void 0 ? _g : "box";
1714
- const rollParam = element.params.find(x => isAttributeRollParam(x));
1715
- const functionParam = element.params.find(x => isAttributeFunctionParam(x));
1716
- // Both `roll:` and `function:` drive the attribute's click overlay. Validation forbids
1717
- // setting both, so at most one of these is defined.
1718
- const clickHandler = rollParam
1719
- ? expandToNode `on${element.name}AttributeRoll`
1720
- : (functionParam ? expandToNode `on${element.name}AttributeFunction` : expandToNode `undefined`);
1721
- // roll: keeps the die icon; function: shows the attribute's own icon (or a generic
1722
- // action bolt) so the overlay reflects what the click actually triggers.
1723
- const clickIcon = functionParam ? ((_h = iconParam === null || iconParam === void 0 ? void 0 : iconParam.value) !== null && _h !== void 0 ? _h : "fa-solid fa-bolt") : "fa-solid fa-dice";
1724
- return expandToNode `
1787
+ }
1788
+ if (isAttributeExp(element)) {
1789
+ const minParam = element.params.find(x => isNumberParamMin(x));
1790
+ const min = (_f = minParam === null || minParam === void 0 ? void 0 : minParam.value) !== null && _f !== void 0 ? _f : 0;
1791
+ const hasMod = element.params.find(x => isAttributeParamMod(x)) != undefined;
1792
+ const modSystemPath = getSystemPath(element, ["mod"], undefined, false);
1793
+ const valueSystemPath = getSystemPath(element, ["value"], undefined, false);
1794
+ const styleParam = element.params.find(x => isAttributeStyleParam(x));
1795
+ const style = (_g = styleParam === null || styleParam === void 0 ? void 0 : styleParam.style) !== null && _g !== void 0 ? _g : "box";
1796
+ const rollParam = element.params.find(x => isAttributeRollParam(x));
1797
+ const functionParam = element.params.find(x => isAttributeFunctionParam(x));
1798
+ // Both `roll:` and `function:` drive the attribute's click overlay. Validation forbids
1799
+ // setting both, so at most one of these is defined.
1800
+ const clickHandler = rollParam
1801
+ ? expandToNode `on${element.name}AttributeRoll`
1802
+ : (functionParam ? expandToNode `on${element.name}AttributeFunction` : expandToNode `undefined`);
1803
+ // roll: keeps the die icon; function: shows the attribute's own icon (or a generic
1804
+ // action bolt) so the overlay reflects what the click actually triggers.
1805
+ const clickIcon = functionParam ? ((_h = iconParam === null || iconParam === void 0 ? void 0 : iconParam.value) !== null && _h !== void 0 ? _h : "fa-solid fa-bolt") : "fa-solid fa-dice";
1806
+ return expandToNode `
1725
1807
  <i-attribute
1726
1808
  label="${label}"
1727
1809
  icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
@@ -1741,28 +1823,28 @@ function generateVueComponentTemplate(entry, id, document) {
1741
1823
  >
1742
1824
  </i-attribute>
1743
1825
  `;
1744
- }
1745
- // if () {
1746
- // return expandToNode`
1747
- // <i-resource
1748
- // label="${label}"
1749
- // icon="${iconParam?.value}"
1750
- // systemPath="system.${element.name.toLowerCase()}"
1751
- // :context="context"
1752
- // ${standardParamsFragment}
1753
- // :primaryColor="primaryColor"
1754
- // :secondaryColor="secondaryColor">
1755
- // </i-resource>
1756
- // `;
1757
- // }
1758
- if (isDamageTrackExp(element)) {
1759
- const typesParam = element.params.find(x => isDamageTrackTypesParam(x));
1760
- const types = (_j = typesParam === null || typesParam === void 0 ? void 0 : typesParam.types) !== null && _j !== void 0 ? _j : [];
1761
- const maxParam = element.params.find(x => isNumberParamMax(x));
1762
- const max = (_k = maxParam === null || maxParam === void 0 ? void 0 : maxParam.value) !== null && _k !== void 0 ? _k : 5;
1763
- const colorParam = element.params.find(x => isColorParam(x));
1764
- const primaryColor = colorParam ? `'${colorParam.value}'` : "primaryColor";
1765
- return expandToNode `
1826
+ }
1827
+ // if () {
1828
+ // return expandToNode`
1829
+ // <i-resource
1830
+ // label="${label}"
1831
+ // icon="${iconParam?.value}"
1832
+ // systemPath="system.${element.name.toLowerCase()}"
1833
+ // :context="context"
1834
+ // ${standardParamsFragment}
1835
+ // :primaryColor="primaryColor"
1836
+ // :secondaryColor="secondaryColor">
1837
+ // </i-resource>
1838
+ // `;
1839
+ // }
1840
+ if (isDamageTrackExp(element)) {
1841
+ const typesParam = element.params.find(x => isDamageTrackTypesParam(x));
1842
+ const types = (_j = typesParam === null || typesParam === void 0 ? void 0 : typesParam.types) !== null && _j !== void 0 ? _j : [];
1843
+ const maxParam = element.params.find(x => isNumberParamMax(x));
1844
+ const max = (_k = maxParam === null || maxParam === void 0 ? void 0 : maxParam.value) !== null && _k !== void 0 ? _k : 5;
1845
+ const colorParam = element.params.find(x => isColorParam(x));
1846
+ const primaryColor = colorParam ? `'${colorParam.value}'` : "primaryColor";
1847
+ return expandToNode `
1766
1848
  <i-damage-track
1767
1849
  label="${label}"
1768
1850
  systemPath="system.${element.name.toLowerCase()}"
@@ -1774,31 +1856,31 @@ function generateVueComponentTemplate(entry, id, document) {
1774
1856
  :max="${max}"
1775
1857
  ></i-damage-track>
1776
1858
  `;
1777
- }
1778
- if (isTrackerExp(element) || isResourceExp(element)) {
1779
- const styleParam = element.params.find(x => isTrackerStyleParameter(x));
1780
- const style = (_l = styleParam === null || styleParam === void 0 ? void 0 : styleParam.style) !== null && _l !== void 0 ? _l : "bar";
1781
- const iconParam = element.params.find(x => isIconParam(x));
1782
- const icon = (_m = iconParam === null || iconParam === void 0 ? void 0 : iconParam.value) !== null && _m !== void 0 ? _m : undefined;
1783
- const minParam = element.params.find(x => isNumberParamMin(x));
1784
- const disableMin = (minParam === null || minParam === void 0 ? void 0 : minParam.value) != undefined;
1785
- let hideMin = false;
1786
- const valueParam = element.params.find(x => isNumberParamValue(x));
1787
- const disableValue = (valueParam === null || valueParam === void 0 ? void 0 : valueParam.value) != undefined;
1788
- const maxParam = element.params.find(x => isNumberParamMax(x));
1789
- const disableMax = (maxParam === null || maxParam === void 0 ? void 0 : maxParam.value) != undefined;
1790
- const colorParam = element.params.find(x => isColorParam(x));
1791
- const primaryColor = colorParam ? `'${colorParam.value}'` : "primaryColor";
1792
- const segmentParm = element.params.find(x => isSegmentsParameter(x));
1793
- const segments = (_o = segmentParm === null || segmentParm === void 0 ? void 0 : segmentParm.segments) !== null && _o !== void 0 ? _o : 1;
1794
- let isHealth = false;
1795
- let isWounds = false;
1796
- if (isResourceExp(element)) {
1797
- hideMin = true;
1798
- isHealth = element.tag == "health";
1799
- isWounds = element.tag == "wounds";
1800
1859
  }
1801
- return expandToNode `
1860
+ if (isTrackerExp(element) || isResourceExp(element)) {
1861
+ const styleParam = element.params.find(x => isTrackerStyleParameter(x));
1862
+ const style = (_l = styleParam === null || styleParam === void 0 ? void 0 : styleParam.style) !== null && _l !== void 0 ? _l : "bar";
1863
+ const iconParam = element.params.find(x => isIconParam(x));
1864
+ const icon = (_m = iconParam === null || iconParam === void 0 ? void 0 : iconParam.value) !== null && _m !== void 0 ? _m : undefined;
1865
+ const minParam = element.params.find(x => isNumberParamMin(x));
1866
+ const disableMin = (minParam === null || minParam === void 0 ? void 0 : minParam.value) != undefined;
1867
+ let hideMin = false;
1868
+ const valueParam = element.params.find(x => isNumberParamValue(x));
1869
+ const disableValue = (valueParam === null || valueParam === void 0 ? void 0 : valueParam.value) != undefined;
1870
+ const maxParam = element.params.find(x => isNumberParamMax(x));
1871
+ const disableMax = (maxParam === null || maxParam === void 0 ? void 0 : maxParam.value) != undefined;
1872
+ const colorParam = element.params.find(x => isColorParam(x));
1873
+ const primaryColor = colorParam ? `'${colorParam.value}'` : "primaryColor";
1874
+ const segmentParm = element.params.find(x => isSegmentsParameter(x));
1875
+ const segments = (_o = segmentParm === null || segmentParm === void 0 ? void 0 : segmentParm.segments) !== null && _o !== void 0 ? _o : 1;
1876
+ let isHealth = false;
1877
+ let isWounds = false;
1878
+ if (isResourceExp(element)) {
1879
+ hideMin = true;
1880
+ isHealth = element.tag == "health";
1881
+ isWounds = element.tag == "wounds";
1882
+ }
1883
+ return expandToNode `
1802
1884
  <i-tracker
1803
1885
  label="${label}"
1804
1886
  systemPath="system.${element.name.toLowerCase()}" :context="context"
@@ -1816,9 +1898,9 @@ function generateVueComponentTemplate(entry, id, document) {
1816
1898
  :isWounds="${isWounds}"
1817
1899
  ></i-tracker>
1818
1900
  `;
1819
- }
1820
- if (isSingleDocumentExp(element)) {
1821
- return expandToNode `
1901
+ }
1902
+ if (isSingleDocumentExp(element)) {
1903
+ return expandToNode `
1822
1904
  <i-document-link
1823
1905
  label="${label}"
1824
1906
  icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
@@ -1829,9 +1911,9 @@ function generateVueComponentTemplate(entry, id, document) {
1829
1911
  :secondaryColor="secondaryColor">
1830
1912
  </i-document-link>
1831
1913
  `;
1832
- }
1833
- if (isDateExp(element)) {
1834
- return expandToNode `
1914
+ }
1915
+ if (isDateExp(element)) {
1916
+ return expandToNode `
1835
1917
  <i-datetime
1836
1918
  type="date"
1837
1919
  label="${label}"
@@ -1842,9 +1924,9 @@ function generateVueComponentTemplate(entry, id, document) {
1842
1924
  :primaryColor="primaryColor" :secondaryColor="secondaryColor">
1843
1925
  </i-datetime>
1844
1926
  `;
1845
- }
1846
- if (isTimeExp(element)) {
1847
- return expandToNode `
1927
+ }
1928
+ if (isTimeExp(element)) {
1929
+ return expandToNode `
1848
1930
  <i-datetime
1849
1931
  type="time"
1850
1932
  label="${label}"
@@ -1855,9 +1937,9 @@ function generateVueComponentTemplate(entry, id, document) {
1855
1937
  :primaryColor="primaryColor" :secondaryColor="secondaryColor">
1856
1938
  </i-datetime>
1857
1939
  `;
1858
- }
1859
- if (isDateTimeExp(element)) {
1860
- return expandToNode `
1940
+ }
1941
+ if (isDateTimeExp(element)) {
1942
+ return expandToNode `
1861
1943
  <i-datetime
1862
1944
  type="datetime-local"
1863
1945
  label="${label}"
@@ -1868,13 +1950,13 @@ function generateVueComponentTemplate(entry, id, document) {
1868
1950
  :primaryColor="primaryColor" :secondaryColor="secondaryColor">
1869
1951
  </i-datetime>
1870
1952
  `;
1871
- }
1872
- if (isPaperDollExp(element)) {
1873
- let sizeParam = element.params.find(x => isSizeParam(x));
1874
- let size = (_q = sizeParam === null || sizeParam === void 0 ? void 0 : sizeParam.value) !== null && _q !== void 0 ? _q : "40px";
1875
- let imageParam = element.params.find(x => isImageParam(x));
1876
- let image = (_r = imageParam === null || imageParam === void 0 ? void 0 : imageParam.value) !== null && _r !== void 0 ? _r : `systems/${id}/img/paperdoll_default.png`;
1877
- return expandToNode `
1953
+ }
1954
+ if (isPaperDollExp(element)) {
1955
+ let sizeParam = element.params.find(x => isSizeParam(x));
1956
+ let size = (_q = sizeParam === null || sizeParam === void 0 ? void 0 : sizeParam.value) !== null && _q !== void 0 ? _q : "40px";
1957
+ let imageParam = element.params.find(x => isImageParam(x));
1958
+ let image = (_r = imageParam === null || imageParam === void 0 ? void 0 : imageParam.value) !== null && _r !== void 0 ? _r : `systems/${id}/img/paperdoll_default.png`;
1959
+ return expandToNode `
1878
1960
  <i-paperdoll
1879
1961
  label="${label}"
1880
1962
  icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
@@ -1886,14 +1968,14 @@ function generateVueComponentTemplate(entry, id, document) {
1886
1968
  :slots="${element.name.toLowerCase()}Slots">
1887
1969
  </i-paperdoll>
1888
1970
  `;
1889
- }
1890
- if (isDiceFields(element)) {
1891
- let choicesParam = element.params.find(x => isDieChoicesParam(x));
1892
- let choices = choicesParam ? `[${choicesParam.choices.join(", ")}]` : "[ 'd4', 'd6', 'd8', 'd10', 'd12', 'd20' ]";
1893
- let noneParam = element.params.find(x => isDieNoneParam(x));
1894
- let noneAttr = (noneParam === null || noneParam === void 0 ? void 0 : noneParam.value) ? `:none="true"` : '';
1895
- if (isDieField(element)) {
1896
- return expandToNode `
1971
+ }
1972
+ if (isDiceFields(element)) {
1973
+ let choicesParam = element.params.find(x => isDieChoicesParam(x));
1974
+ let choices = choicesParam ? `[${choicesParam.choices.join(", ")}]` : "[ 'd4', 'd6', 'd8', 'd10', 'd12', 'd20' ]";
1975
+ let noneParam = element.params.find(x => isDieNoneParam(x));
1976
+ let noneAttr = (noneParam === null || noneParam === void 0 ? void 0 : noneParam.value) ? `:none="true"` : '';
1977
+ if (isDieField(element)) {
1978
+ return expandToNode `
1897
1979
  <i-die
1898
1980
  :context="context"
1899
1981
  label="${label}"
@@ -1904,9 +1986,9 @@ function generateVueComponentTemplate(entry, id, document) {
1904
1986
  ${standardParamsFragment}>
1905
1987
  </i-die>
1906
1988
  `;
1907
- }
1908
- if (isDiceField(element)) {
1909
- return expandToNode `
1989
+ }
1990
+ if (isDiceField(element)) {
1991
+ return expandToNode `
1910
1992
  <i-dice
1911
1993
  label="${label}"
1912
1994
  icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
@@ -1920,113 +2002,113 @@ function generateVueComponentTemplate(entry, id, document) {
1920
2002
  :secondaryColor="secondaryColor"
1921
2003
  />
1922
2004
  `;
2005
+ }
1923
2006
  }
1924
- }
1925
- if (isTableField(element)) {
1926
- if (isTopLevel)
1927
- return expandToNode ``;
1928
- const page = AstUtils.getContainerOfType(element, isPage);
1929
- const pageName = (_s = page === null || page === void 0 ? void 0 : page.name) !== null && _s !== void 0 ? _s : document.name;
1930
- const systemPath = getSystemPath(element, [], undefined, false);
1931
- let componentName = `${document.name}${pageName}${element.name}VuetifyDatatable`;
1932
- // Wrap in a drop zone so drag-drop works for tables inside a row/column.
1933
- // Tables rendered as their own tab are wrapped in .tabs-container (the
1934
- // sheet's drop target); layout-rendered tables aren't, so without this
1935
- // wrapper they have no drop target. The wrapper only exists in the layout
1936
- // case (never nested inside a .tabs-container), so no double drop binding.
1937
- return expandToNode `
2007
+ if (isTableField(element)) {
2008
+ if (isTopLevel)
2009
+ return expandToNode ``;
2010
+ const page = AstUtils.getContainerOfType(element, isPage);
2011
+ const pageName = (_s = page === null || page === void 0 ? void 0 : page.name) !== null && _s !== void 0 ? _s : document.name;
2012
+ const systemPath = getSystemPath(element, [], undefined, false);
2013
+ let componentName = `${document.name}${pageName}${element.name}VuetifyDatatable`;
2014
+ // Wrap in a drop zone so drag-drop works for tables inside a row/column.
2015
+ // Tables rendered as their own tab are wrapped in .tabs-container (the
2016
+ // sheet's drop target); layout-rendered tables aren't, so without this
2017
+ // wrapper they have no drop target. The wrapper only exists in the layout
2018
+ // case (never nested inside a .tabs-container), so no double drop binding.
2019
+ return expandToNode `
1938
2020
  <div class="datatable-drop-zone" v-if="!isHidden('${element.name.toLowerCase()}')">
1939
2021
  <${componentName} systemPath="${systemPath}" :context="context" :primaryColor="primaryColor" :secondaryColor="secondaryColor" :tertiaryColor="tertiaryColor"></${componentName}>
1940
2022
  </div>
1941
2023
  `.appendNewLine();
1942
- }
1943
- if (isInventoryField(element)) {
1944
- if (isTopLevel)
1945
- return expandToNode ``;
1946
- const systemPath = getSystemPath(element, [], undefined, false);
1947
- const iconParam = element.params.find(p => isIconParam(p));
1948
- const labelParam = element.params.find(p => isLabelParam(p));
1949
- const slotsParam = element.params.find(isInventorySlotsParam);
1950
- const rowsParam = element.params.find(isInventoryRowsParam);
1951
- const columnsParam = element.params.find(isInventoryColumnsParam);
1952
- const slotSizeParam = element.params.find(isInventorySlotSizeParam);
1953
- const quantityParam = element.params.find(isInventoryQuantityParam);
1954
- const moneyParam = element.params.find(isInventoryMoneyParam);
1955
- const sumParam = element.params.find(isInventorySumParam);
1956
- const sumMaxParam = element.params.find(isInventorySumMaxParam);
1957
- const sortParam = element.params.find(isInventorySortParam);
1958
- const whereParam = element.params.find(isWhereParam);
1959
- const globalParam = element.params.find(isGlobalParam);
1960
- const emptySlotsParam = element.params.find(isInventoryEmptySlotsParam);
1961
- const summaryParam = element.params.find(isInventorySummaryParam);
1962
- const label = labelParam ? labelParam.value : `${document.name}.${element.name}`;
1963
- const icon = iconParam === null || iconParam === void 0 ? void 0 : iconParam.value;
1964
- const slots = (_t = slotsParam === null || slotsParam === void 0 ? void 0 : slotsParam.value) !== null && _t !== void 0 ? _t : 20;
1965
- const rows = rowsParam === null || rowsParam === void 0 ? void 0 : rowsParam.value;
1966
- const columns = columnsParam === null || columnsParam === void 0 ? void 0 : columnsParam.value;
1967
- const slotSize = slotSizeParam ? parseInt(slotSizeParam.value.replace('px', '')) : 60;
1968
- const documentType = (_u = element.document.ref) === null || _u === void 0 ? void 0 : _u.name.toLowerCase();
1969
- const quantityField = (_v = quantityParam === null || quantityParam === void 0 ? void 0 : quantityParam.field.ref) === null || _v === void 0 ? void 0 : _v.name.toLowerCase();
1970
- const moneyField = (_w = moneyParam === null || moneyParam === void 0 ? void 0 : moneyParam.field.ref) === null || _w === void 0 ? void 0 : _w.name.toLowerCase();
1971
- const moneyFieldLabel = moneyField ? `${document.name}.${(_y = (_x = moneyParam === null || moneyParam === void 0 ? void 0 : moneyParam.field) === null || _x === void 0 ? void 0 : _x.ref) === null || _y === void 0 ? void 0 : _y.name}` : undefined;
1972
- const moneyFieldIcon = moneyField ? (_1 = (_0 = (_z = moneyParam === null || moneyParam === void 0 ? void 0 : moneyParam.field) === null || _z === void 0 ? void 0 : _z.ref) === null || _0 === void 0 ? void 0 : _0.params.find(isIconParam)) === null || _1 === void 0 ? void 0 : _1.value : undefined;
1973
- const sortProperty = (_2 = sortParam === null || sortParam === void 0 ? void 0 : sortParam.property.ref) === null || _2 === void 0 ? void 0 : _2.name;
1974
- const sortOrder = (_3 = sortParam === null || sortParam === void 0 ? void 0 : sortParam.order) !== null && _3 !== void 0 ? _3 : 'asc';
1975
- const globalAllowed = (_4 = globalParam === null || globalParam === void 0 ? void 0 : globalParam.value) !== null && _4 !== void 0 ? _4 : false;
1976
- const emptySlots = (_5 = emptySlotsParam === null || emptySlotsParam === void 0 ? void 0 : emptySlotsParam.value) !== null && _5 !== void 0 ? _5 : 'show';
1977
- const summary = (_6 = summaryParam === null || summaryParam === void 0 ? void 0 : summaryParam.value) !== null && _6 !== void 0 ? _6 : 'full';
1978
- // Handle sum properties (can be single or array)
1979
- let sumProperties = [];
1980
- if (sumParam) {
1981
- if (sumParam.properties.property) {
1982
- sumProperties = [((_7 = sumParam.properties.property.ref) === null || _7 === void 0 ? void 0 : _7.name) || ''];
1983
- }
1984
- else if (sumParam.properties.properties) {
1985
- sumProperties = sumParam.properties.properties
1986
- .map(p => { var _a; return ((_a = p.ref) === null || _a === void 0 ? void 0 : _a.name) || ''; })
1987
- .filter(n => n !== '');
1988
- }
1989
2024
  }
1990
- // Handle sumMax (can be int, expression, or array of ints/expressions)
1991
- let sumMax = undefined;
1992
- if (sumMaxParam) {
1993
- if (sumMaxParam.value !== undefined) {
1994
- // It's a single INT
1995
- sumMax = String(sumMaxParam.value);
1996
- }
1997
- else if (sumMaxParam.expression) {
1998
- // It's a single expression (like self.CarryCapacity), translate it
1999
- const sumMaxNode = translateExpression(entry, id, sumMaxParam.expression);
2000
- if (sumMaxNode) {
2001
- // Prefix with context. so it evaluates correctly in Vue template
2002
- sumMax = `context.${toString(sumMaxNode)}`;
2025
+ if (isInventoryField(element)) {
2026
+ if (isTopLevel)
2027
+ return expandToNode ``;
2028
+ const systemPath = getSystemPath(element, [], undefined, false);
2029
+ const iconParam = element.params.find(p => isIconParam(p));
2030
+ const labelParam = element.params.find(p => isLabelParam(p));
2031
+ const slotsParam = element.params.find(isInventorySlotsParam);
2032
+ const rowsParam = element.params.find(isInventoryRowsParam);
2033
+ const columnsParam = element.params.find(isInventoryColumnsParam);
2034
+ const slotSizeParam = element.params.find(isInventorySlotSizeParam);
2035
+ const quantityParam = element.params.find(isInventoryQuantityParam);
2036
+ const moneyParam = element.params.find(isInventoryMoneyParam);
2037
+ const sumParam = element.params.find(isInventorySumParam);
2038
+ const sumMaxParam = element.params.find(isInventorySumMaxParam);
2039
+ const sortParam = element.params.find(isInventorySortParam);
2040
+ const whereParam = element.params.find(isWhereParam);
2041
+ const globalParam = element.params.find(isGlobalParam);
2042
+ const emptySlotsParam = element.params.find(isInventoryEmptySlotsParam);
2043
+ const summaryParam = element.params.find(isInventorySummaryParam);
2044
+ const label = labelParam ? labelParam.value : `${document.name}.${element.name}`;
2045
+ const icon = iconParam === null || iconParam === void 0 ? void 0 : iconParam.value;
2046
+ const slots = (_t = slotsParam === null || slotsParam === void 0 ? void 0 : slotsParam.value) !== null && _t !== void 0 ? _t : 20;
2047
+ const rows = rowsParam === null || rowsParam === void 0 ? void 0 : rowsParam.value;
2048
+ const columns = columnsParam === null || columnsParam === void 0 ? void 0 : columnsParam.value;
2049
+ const slotSize = slotSizeParam ? parseInt(slotSizeParam.value.replace('px', '')) : 60;
2050
+ const documentType = (_u = element.document.ref) === null || _u === void 0 ? void 0 : _u.name.toLowerCase();
2051
+ const quantityField = (_v = quantityParam === null || quantityParam === void 0 ? void 0 : quantityParam.field.ref) === null || _v === void 0 ? void 0 : _v.name.toLowerCase();
2052
+ const moneyField = (_w = moneyParam === null || moneyParam === void 0 ? void 0 : moneyParam.field.ref) === null || _w === void 0 ? void 0 : _w.name.toLowerCase();
2053
+ const moneyFieldLabel = moneyField ? `${document.name}.${(_y = (_x = moneyParam === null || moneyParam === void 0 ? void 0 : moneyParam.field) === null || _x === void 0 ? void 0 : _x.ref) === null || _y === void 0 ? void 0 : _y.name}` : undefined;
2054
+ const moneyFieldIcon = moneyField ? (_1 = (_0 = (_z = moneyParam === null || moneyParam === void 0 ? void 0 : moneyParam.field) === null || _z === void 0 ? void 0 : _z.ref) === null || _0 === void 0 ? void 0 : _0.params.find(isIconParam)) === null || _1 === void 0 ? void 0 : _1.value : undefined;
2055
+ const sortProperty = (_2 = sortParam === null || sortParam === void 0 ? void 0 : sortParam.property.ref) === null || _2 === void 0 ? void 0 : _2.name;
2056
+ const sortOrder = (_3 = sortParam === null || sortParam === void 0 ? void 0 : sortParam.order) !== null && _3 !== void 0 ? _3 : 'asc';
2057
+ const globalAllowed = (_4 = globalParam === null || globalParam === void 0 ? void 0 : globalParam.value) !== null && _4 !== void 0 ? _4 : false;
2058
+ const emptySlots = (_5 = emptySlotsParam === null || emptySlotsParam === void 0 ? void 0 : emptySlotsParam.value) !== null && _5 !== void 0 ? _5 : 'show';
2059
+ const summary = (_6 = summaryParam === null || summaryParam === void 0 ? void 0 : summaryParam.value) !== null && _6 !== void 0 ? _6 : 'full';
2060
+ // Handle sum properties (can be single or array)
2061
+ let sumProperties = [];
2062
+ if (sumParam) {
2063
+ if (sumParam.properties.property) {
2064
+ sumProperties = [((_7 = sumParam.properties.property.ref) === null || _7 === void 0 ? void 0 : _7.name) || ''];
2065
+ }
2066
+ else if (sumParam.properties.properties) {
2067
+ sumProperties = sumParam.properties.properties
2068
+ .map(p => { var _a; return ((_a = p.ref) === null || _a === void 0 ? void 0 : _a.name) || ''; })
2069
+ .filter(n => n !== '');
2003
2070
  }
2004
2071
  }
2005
- else if ((_8 = sumMaxParam.values) === null || _8 === void 0 ? void 0 : _8.values) {
2006
- // It's an array of ints/expressions
2007
- const maxValues = sumMaxParam.values.values.map((val) => {
2008
- if (typeof val === 'number') {
2009
- return String(val);
2072
+ // Handle sumMax (can be int, expression, or array of ints/expressions)
2073
+ let sumMax = undefined;
2074
+ if (sumMaxParam) {
2075
+ if (sumMaxParam.value !== undefined) {
2076
+ // It's a single INT
2077
+ sumMax = String(sumMaxParam.value);
2078
+ }
2079
+ else if (sumMaxParam.expression) {
2080
+ // It's a single expression (like self.CarryCapacity), translate it
2081
+ const sumMaxNode = translateExpression(entry, id, sumMaxParam.expression);
2082
+ if (sumMaxNode) {
2083
+ // Prefix with context. so it evaluates correctly in Vue template
2084
+ sumMax = `context.${toString(sumMaxNode)}`;
2010
2085
  }
2011
- else {
2012
- // It's an expression, translate it
2013
- const valNode = translateExpression(entry, id, val);
2014
- if (valNode) {
2015
- return `context.${toString(valNode)}`;
2086
+ }
2087
+ else if ((_8 = sumMaxParam.values) === null || _8 === void 0 ? void 0 : _8.values) {
2088
+ // It's an array of ints/expressions
2089
+ const maxValues = sumMaxParam.values.values.map((val) => {
2090
+ if (typeof val === 'number') {
2091
+ return String(val);
2016
2092
  }
2017
- return '0';
2018
- }
2019
- });
2020
- sumMax = `[${maxValues.join(', ')}]`;
2093
+ else {
2094
+ // It's an expression, translate it
2095
+ const valNode = translateExpression(entry, id, val);
2096
+ if (valNode) {
2097
+ return `context.${toString(valNode)}`;
2098
+ }
2099
+ return '0';
2100
+ }
2101
+ });
2102
+ sumMax = `[${maxValues.join(', ')}]`;
2103
+ }
2021
2104
  }
2022
- }
2023
- // Handle where expression
2024
- let whereExpression = undefined;
2025
- if (whereParam) {
2026
- const whereNode = translateExpression(entry, id, whereParam.value);
2027
- whereExpression = whereNode ? toString(whereNode) : undefined;
2028
- }
2029
- return expandToNode `
2105
+ // Handle where expression
2106
+ let whereExpression = undefined;
2107
+ if (whereParam) {
2108
+ const whereNode = translateExpression(entry, id, whereParam.value);
2109
+ whereExpression = whereNode ? toString(whereNode) : undefined;
2110
+ }
2111
+ return expandToNode `
2030
2112
  <i-inventory
2031
2113
  v-if="!isHidden('${element.name.toLowerCase()}')"
2032
2114
  label="${label}"
@@ -2056,14 +2138,37 @@ function generateVueComponentTemplate(entry, id, document) {
2056
2138
  :tertiaryColor="tertiaryColor"
2057
2139
  />
2058
2140
  `.appendNewLine();
2059
- }
2060
- return expandToNode `
2141
+ }
2142
+ return expandToNode `
2061
2143
  <v-alert text="Unknown Property ${element.name}" type="warning" density="compact" class="ga-2 ma-1" variant="outlined"></v-alert>
2062
2144
  `;
2145
+ })();
2146
+ return injectFieldMarker(fieldComponent, element);
2063
2147
  }
2064
2148
  return expandToNode `
2065
2149
  <v-alert text="Unknown Element" type="warning" density="compact" class="ga-2 ma-1" variant="outlined"></v-alert>
2066
2150
  `;
2067
2151
  }
2152
+ // Stamp the universal field marker onto a rendered field's <i-...> component root (the
2153
+ // element that also carries the type + single/double-wide classes via attribute fallthrough).
2154
+ // `.isdl-field` is the one selector theme-token consumption targets; `.isdl-field-<name>` is
2155
+ // the per-field hook + the target a per-field theme override is emitted against.
2156
+ function injectFieldMarker(node, element) {
2157
+ const html = toString(node);
2158
+ const marker = `isdl-field isdl-field-${element.name.toLowerCase()}`;
2159
+ // Stamp the marker onto the FIRST element tag of the rendered field, whatever its name --
2160
+ // <i-number>, a datatable <div class="datatable-drop-zone">, a <DocumentChoice> component,
2161
+ // etc. Insert right after the tag NAME so attribute values (which can contain '>') are never
2162
+ // parsed. If that tag already leads with a `class` attribute, merge into it (no double class).
2163
+ const tag = html.match(/<([A-Za-z][\w.-]*)/);
2164
+ if ((tag === null || tag === void 0 ? void 0 : tag.index) === undefined)
2165
+ return node;
2166
+ const insertAt = tag.index + tag[0].length;
2167
+ const rest = html.slice(insertAt);
2168
+ const injected = /^\s+class="/.test(rest)
2169
+ ? html.slice(0, insertAt) + rest.replace(/^(\s+class=")/, `$1${marker} `)
2170
+ : html.slice(0, insertAt) + ` class="${marker}"` + rest;
2171
+ return expandToNode `${injected}`;
2172
+ }
2068
2173
  }
2069
2174
  //# sourceMappingURL=vue-sheet-application-generator.js.map