intelligent-system-design-language 0.3.26 → 0.3.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/_backgrounds.scss +17 -17
- package/out/_isdlStyles.scss +59 -0
- package/out/_vuetifyOverrides.scss +23 -1
- package/out/cli/components/_backgrounds.scss +17 -17
- package/out/cli/components/_isdlStyles.scss +59 -0
- package/out/cli/components/_vuetifyOverrides.scss +23 -1
- package/out/cli/components/active-effect-sheet-generator.js +6 -2
- package/out/cli/components/active-effect-sheet-generator.js.map +1 -1
- package/out/cli/components/css-generator.js +299 -0
- package/out/cli/components/css-generator.js.map +1 -1
- package/out/cli/components/datamodel-generator.js +38 -20
- package/out/cli/components/datamodel-generator.js.map +1 -1
- package/out/cli/components/init-hook-generator.js +32 -23
- package/out/cli/components/init-hook-generator.js.map +1 -1
- package/out/cli/components/language-generator.js +9 -1
- package/out/cli/components/language-generator.js.map +1 -1
- package/out/cli/components/method-generator.js +8 -7
- package/out/cli/components/method-generator.js.map +1 -1
- package/out/cli/components/utils.js +18 -12
- package/out/cli/components/utils.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-attribute.js +5 -4
- package/out/cli/components/vue/base-components/vue-attribute.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-boolean.js +3 -2
- package/out/cli/components/vue/base-components/vue-boolean.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-damage-bonuses.js +3 -2
- package/out/cli/components/vue/base-components/vue-damage-bonuses.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-damage-resistances.js +3 -2
- package/out/cli/components/vue/base-components/vue-damage-resistances.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-damage-track.js +2 -1
- package/out/cli/components/vue/base-components/vue-damage-track.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-date-time.js +3 -2
- package/out/cli/components/vue/base-components/vue-date-time.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-dice.js +2 -1
- package/out/cli/components/vue/base-components/vue-dice.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-die.js +2 -1
- package/out/cli/components/vue/base-components/vue-die.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-document-choice.js +2 -1
- package/out/cli/components/vue/base-components/vue-document-choice.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-document-choices.js +2 -1
- package/out/cli/components/vue/base-components/vue-document-choices.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-document-link.js +2 -1
- package/out/cli/components/vue/base-components/vue-document-link.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-extended-choice.js +2 -1
- package/out/cli/components/vue/base-components/vue-extended-choice.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-image.js +89 -0
- package/out/cli/components/vue/base-components/vue-image.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-inventory.js +2 -1
- package/out/cli/components/vue/base-components/vue-inventory.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-macro-choice.js +2 -1
- package/out/cli/components/vue/base-components/vue-macro-choice.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-measured-template.js +3 -2
- package/out/cli/components/vue/base-components/vue-measured-template.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-money.js +4 -3
- package/out/cli/components/vue/base-components/vue-money.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-number.js +3 -2
- package/out/cli/components/vue/base-components/vue-number.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-paperdoll.js +2 -1
- package/out/cli/components/vue/base-components/vue-paperdoll.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-parent-property-reference.js +5 -1
- package/out/cli/components/vue/base-components/vue-parent-property-reference.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-prosemirror.js +3 -2
- package/out/cli/components/vue/base-components/vue-prosemirror.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-resource.js +2 -1
- package/out/cli/components/vue/base-components/vue-resource.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-roll-visualizer.js +2 -1
- package/out/cli/components/vue/base-components/vue-roll-visualizer.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-self-property-reference.js +2 -1
- package/out/cli/components/vue/base-components/vue-self-property-reference.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-string-choice.js +3 -1
- package/out/cli/components/vue/base-components/vue-string-choice.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-string-choices.js +3 -2
- package/out/cli/components/vue/base-components/vue-string-choices.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-string.js +4 -3
- package/out/cli/components/vue/base-components/vue-string.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-text-field.js +4 -3
- package/out/cli/components/vue/base-components/vue-text-field.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-tracker.js +2 -1
- package/out/cli/components/vue/base-components/vue-tracker.js.map +1 -1
- package/out/cli/components/vue/vue-action-component-generator.js +18 -9
- package/out/cli/components/vue/vue-action-component-generator.js.map +1 -1
- package/out/cli/components/vue/vue-active-effect-sheet-generator.js +2 -2
- package/out/cli/components/vue/vue-base-components-generator.js +2 -0
- package/out/cli/components/vue/vue-base-components-generator.js.map +1 -1
- package/out/cli/components/vue/vue-generator.js +8 -7
- package/out/cli/components/vue/vue-generator.js.map +1 -1
- package/out/cli/components/vue/vue-mixin.js +1 -0
- package/out/cli/components/vue/vue-mixin.js.map +1 -1
- package/out/cli/components/vue/vue-prompt-generator.js +4 -4
- package/out/cli/components/vue/vue-prompt-generator.js.map +1 -1
- package/out/cli/components/vue/vue-sheet-application-generator.js +714 -561
- package/out/cli/components/vue/vue-sheet-application-generator.js.map +1 -1
- package/out/cli/components/vue/vue-sheet-class-generator.js +89 -2
- package/out/cli/components/vue/vue-sheet-class-generator.js.map +1 -1
- package/out/cli/generator.js +9 -3
- package/out/cli/generator.js.map +1 -1
- package/out/extension/main.cjs +3057 -848
- package/out/extension/main.cjs.map +3 -3
- package/out/extension/package.json +1 -1
- package/out/language/generated/ast.js +374 -9
- package/out/language/generated/ast.js.map +1 -1
- package/out/language/generated/grammar.js +2696 -874
- package/out/language/generated/grammar.js.map +1 -1
- package/out/language/intelligent-system-design-language-validator.js +99 -3
- package/out/language/intelligent-system-design-language-validator.js.map +1 -1
- package/out/language/main.cjs +3057 -848
- package/out/language/main.cjs.map +3 -3
- package/out/package.json +1 -1
- package/out/styles.scss +33 -4
- package/out/test/validating/theme.test.js +120 -0
- package/out/test/validating/theme.test.js.map +1 -0
- 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, isImageField, isImagePrimaryParam, isHideLabelParam, 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 { themeWidthToInlineStyle, themeHeightToInlineStyle, themePaintToInlineStyle, themeSizingToInlineStyle } 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)}
|
|
@@ -465,19 +497,17 @@ function generateVueComponentScript(entry, id, document, destination) {
|
|
|
465
497
|
function generateAttributeRollMethod(attribute) {
|
|
466
498
|
const rollParam = attribute.params.find(isAttributeRollParam);
|
|
467
499
|
if (rollParam) {
|
|
468
|
-
// A block-style `roll: { ... }` is a method body
|
|
469
|
-
//
|
|
470
|
-
//
|
|
471
|
-
// `
|
|
472
|
-
//
|
|
500
|
+
// A block-style `roll: { ... }` is a method body that can call user functions
|
|
501
|
+
// (self.Foo(...)) and mutate the document (self.X += 1). Those need `this`, the action-style
|
|
502
|
+
// flush objects, and a flush/render tail — none of which exist in this <script setup> scope
|
|
503
|
+
// (`this` is undefined, `update` is never declared). So, like `function:`, the block runs as a
|
|
504
|
+
// real sheet method (_on<Attr>AttributeRoll, generated in vue-sheet-class-generator); here we
|
|
505
|
+
// only emit a delegating arrow. An expression-style `roll: roll(...)` (the else branch below)
|
|
506
|
+
// produces a single Roll value we wrap in a chat card and is unaffected.
|
|
473
507
|
if (isMethodBlock(rollParam.roll)) {
|
|
474
508
|
return expandToNode `
|
|
475
|
-
const on${
|
|
476
|
-
|
|
477
|
-
object: document
|
|
478
|
-
};
|
|
479
|
-
let system = context.object.system;
|
|
480
|
-
${translateExpression(entry, id, rollParam.roll, false, attribute)}
|
|
509
|
+
const on${attribute.name}AttributeRoll = async (event) => {
|
|
510
|
+
await document.sheet._on${attribute.name}AttributeRoll(event);
|
|
481
511
|
};
|
|
482
512
|
`;
|
|
483
513
|
}
|
|
@@ -533,6 +563,8 @@ function generateVueComponentScript(entry, id, document, destination) {
|
|
|
533
563
|
}
|
|
534
564
|
return expandToNode ``;
|
|
535
565
|
}
|
|
566
|
+
const themeColors = getThemeColorDefaults(entry);
|
|
567
|
+
const userColorsEnabled = getUserColorsEnabled(entry);
|
|
536
568
|
return expandToNode `
|
|
537
569
|
<script setup>
|
|
538
570
|
import { ref, watch, inject, computed, watchEffect } from "vue";
|
|
@@ -549,10 +581,37 @@ function generateVueComponentScript(entry, id, document, destination) {
|
|
|
549
581
|
const props = defineProps(['context']);
|
|
550
582
|
|
|
551
583
|
// Colors
|
|
584
|
+
// Defaults come from the system theme (theme primary/secondary/tertiary tokens);
|
|
585
|
+
// when the theme doesn't set them they fall back to the built-in palette. These feed
|
|
586
|
+
// the Vuetify :color props on fields. userColorsEnabled mirrors the userColors config.
|
|
587
|
+
const userColorsEnabled = ${userColorsEnabled};
|
|
588
|
+
const defaultPrimaryColor = '${themeColors.primary}';
|
|
589
|
+
const defaultSecondaryColor = '${themeColors.secondary}';
|
|
590
|
+
const defaultTertiaryColor = '${themeColors.tertiary}';
|
|
591
|
+
|
|
552
592
|
let storedColors = game.settings.get('${id}', 'documentColorThemes');
|
|
553
|
-
const
|
|
554
|
-
const
|
|
555
|
-
const
|
|
593
|
+
const documentColors = userColorsEnabled ? (storedColors[document.uuid] ?? {}) : {};
|
|
594
|
+
const primaryColor = ref(documentColors.primary ?? defaultPrimaryColor);
|
|
595
|
+
const secondaryColor = ref(documentColors.secondary ?? defaultSecondaryColor);
|
|
596
|
+
const tertiaryColor = ref(documentColors.tertiary ?? defaultTertiaryColor);
|
|
597
|
+
|
|
598
|
+
// Track which colors the user has explicitly chosen. Only an explicit choice is
|
|
599
|
+
// emitted as a CSS variable (below) so it can override the theme default; the ref
|
|
600
|
+
// defaults must NOT leak to --isdl-* or an unthemed sheet would gain a colored edge.
|
|
601
|
+
const primarySet = ref(documentColors.primary != null);
|
|
602
|
+
const secondarySet = ref(documentColors.secondary != null);
|
|
603
|
+
const tertiarySet = ref(documentColors.tertiary != null);
|
|
604
|
+
|
|
605
|
+
// User-chosen colors override the theme's --isdl-primary/secondary/tertiary for this
|
|
606
|
+
// document. Bound inline on <v-app>, which sits inside .${id}.vue-application, so it wins
|
|
607
|
+
// over the theme.css defaults for every descendant field. Keys are omitted unless chosen.
|
|
608
|
+
const userColorVars = computed(() => {
|
|
609
|
+
const vars = {};
|
|
610
|
+
if (primarySet.value) vars['--isdl-primary'] = primaryColor.value;
|
|
611
|
+
if (secondarySet.value) vars['--isdl-secondary'] = secondaryColor.value;
|
|
612
|
+
if (tertiarySet.value) vars['--isdl-tertiary'] = tertiaryColor.value;
|
|
613
|
+
return vars;
|
|
614
|
+
});
|
|
556
615
|
|
|
557
616
|
const setupColors = () => {
|
|
558
617
|
const colors = {
|
|
@@ -563,19 +622,28 @@ function generateVueComponentScript(entry, id, document, destination) {
|
|
|
563
622
|
game.settings.set('${id}', 'documentColorThemes', { ...storedColors, [document.uuid]: colors });
|
|
564
623
|
};
|
|
565
624
|
const resetColors = () => {
|
|
566
|
-
primaryColor.value =
|
|
567
|
-
secondaryColor.value =
|
|
568
|
-
tertiaryColor.value =
|
|
569
|
-
|
|
625
|
+
primaryColor.value = defaultPrimaryColor;
|
|
626
|
+
secondaryColor.value = defaultSecondaryColor;
|
|
627
|
+
tertiaryColor.value = defaultTertiaryColor;
|
|
628
|
+
primarySet.value = false;
|
|
629
|
+
secondarySet.value = false;
|
|
630
|
+
tertiarySet.value = false;
|
|
631
|
+
let updated = { ...storedColors };
|
|
632
|
+
delete updated[document.uuid];
|
|
633
|
+
storedColors = updated;
|
|
634
|
+
game.settings.set('${id}', 'documentColorThemes', updated);
|
|
570
635
|
};
|
|
571
636
|
|
|
572
637
|
watch(primaryColor, () => {
|
|
638
|
+
primarySet.value = true;
|
|
573
639
|
setupColors();
|
|
574
640
|
});
|
|
575
641
|
watch(secondaryColor, () => {
|
|
642
|
+
secondarySet.value = true;
|
|
576
643
|
setupColors();
|
|
577
644
|
});
|
|
578
645
|
watch(tertiaryColor, () => {
|
|
646
|
+
tertiarySet.value = true;
|
|
579
647
|
setupColors();
|
|
580
648
|
});
|
|
581
649
|
|
|
@@ -761,9 +829,14 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
761
829
|
const firstPageTables = document.body.filter(isTableField); // We explicitly only want top-level tables
|
|
762
830
|
const firstPagePinned = document.body.filter(isPinnedField); // We explicitly only want top-level pinned fields
|
|
763
831
|
const firstPageInventories = document.body.filter(isInventoryField); // We explicitly only want top-level inventories
|
|
832
|
+
const userColorsEnabled = getUserColorsEnabled(entry);
|
|
833
|
+
// If the author placed a primary image field (one bound to the native `img`), the portrait is
|
|
834
|
+
// rendered inline in their layout -- suppress the default drawer portrait to avoid two of them.
|
|
835
|
+
const hasPrimaryImage = getAllOfType(document.body, isImageField)
|
|
836
|
+
.some(f => f.params.some(p => isImagePrimaryParam(p) && p.value));
|
|
764
837
|
return expandToNode `
|
|
765
838
|
<template>
|
|
766
|
-
<v-app>
|
|
839
|
+
<v-app :style="userColorVars">
|
|
767
840
|
<!-- App Bar -->
|
|
768
841
|
<v-app-bar :color="editModeRef ? 'amber-accent-3' : primaryColor" density="comfortable">
|
|
769
842
|
<v-app-bar-nav-icon @click="drawer = !drawer"></v-app-bar-nav-icon>
|
|
@@ -783,17 +856,17 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
783
856
|
|
|
784
857
|
<!-- Navigation Drawer -->
|
|
785
858
|
<v-navigation-drawer v-model="drawer" temporary style="background-color: #dddddd">
|
|
786
|
-
|
|
859
|
+
${hasPrimaryImage ? '' : expandToNode `<v-img :src="context.document.img" style="background-color: lightgray" data-edit='img' data-action='onEditImage'>
|
|
787
860
|
<template #error>
|
|
788
861
|
<v-img src="/systems/${id}/img/missing-character.png" data-edit='img' data-action='onEditImage'></v-img>
|
|
789
862
|
</template>
|
|
790
|
-
</v-img
|
|
863
|
+
</v-img>`}
|
|
791
864
|
<v-tabs v-model="page" direction="vertical">
|
|
792
865
|
<v-tab value="${document.name.toLowerCase()}" prepend-icon="fa-solid fa-circle-user">${document.name}</v-tab>
|
|
793
866
|
${joinToNode(pages, generateNavListItem, { appendNewLineIfNotEmpty: true })}
|
|
794
867
|
</v-tabs>
|
|
795
868
|
<template v-slot:append>
|
|
796
|
-
<div class="pa-2">
|
|
869
|
+
<div class="pa-2" ${userColorsEnabled ? '' : 'v-if="false"'}>
|
|
797
870
|
<v-btn block @click="setupColors" :color="secondaryColor" prepend-icon="fa-solid fa-palette">
|
|
798
871
|
Setup Colors
|
|
799
872
|
|
|
@@ -966,6 +1039,7 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
966
1039
|
const emptySlotsParam = element.params.find(isInventoryEmptySlotsParam);
|
|
967
1040
|
const summaryParam = element.params.find(isInventorySummaryParam);
|
|
968
1041
|
const label = labelParam ? labelParam.value : `${document.name}.${element.name}`;
|
|
1042
|
+
const hideLabel = element.params.some((p) => isHideLabelParam(p) && p.value);
|
|
969
1043
|
const icon = iconParam === null || iconParam === void 0 ? void 0 : iconParam.value;
|
|
970
1044
|
const slots = (_a = slotsParam === null || slotsParam === void 0 ? void 0 : slotsParam.value) !== null && _a !== void 0 ? _a : 20;
|
|
971
1045
|
const rows = rowsParam === null || rowsParam === void 0 ? void 0 : rowsParam.value;
|
|
@@ -1038,6 +1112,7 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1038
1112
|
systemPath="${systemPath}"
|
|
1039
1113
|
:context="context"
|
|
1040
1114
|
:editMode="editModeRef"
|
|
1115
|
+
${hideLabel ? `:hideLabel="true"` : ''}
|
|
1041
1116
|
${icon ? `icon="${icon}"` : ''}
|
|
1042
1117
|
${slots ? `:maxSlots="${slots}"` : ''}
|
|
1043
1118
|
${rows ? `:rows="${rows}"` : ''}
|
|
@@ -1088,12 +1163,28 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1088
1163
|
`.appendNewLine();
|
|
1089
1164
|
}
|
|
1090
1165
|
function generateElement(element, isTopLevel = false) {
|
|
1091
|
-
var _a, _b
|
|
1166
|
+
var _a, _b;
|
|
1167
|
+
// A layout container's `theme: { ... }` compiles to an inline `style="..."` of ACTUAL
|
|
1168
|
+
// CSS (not `--isdl-*` vars, which would inherit and leak sizing into nested children).
|
|
1169
|
+
// The themed style is split by who owns the geometry: WIDTH governs the flex item that
|
|
1170
|
+
// lays out in the row (the OUTER v-col/v-row), so it must ride that element -- putting it
|
|
1171
|
+
// on the inner card lets the column keep its full width and the card just floats inside.
|
|
1172
|
+
// HEIGHT + PAINT (border/bg/text) belong on the visible v-card surface (or the bare
|
|
1173
|
+
// row/column when there is no card). See css-generator's theme*ToInlineStyle helpers.
|
|
1174
|
+
const themeParam = (_a = element.params) === null || _a === void 0 ? void 0 : _a.find(isThemeFieldParam);
|
|
1092
1175
|
if (isSection(element)) {
|
|
1176
|
+
const colStyle = themeWidthToInlineStyle(themeParam);
|
|
1177
|
+
const colAttr = colStyle.length > 0 ? ` style="${colStyle}"` : '';
|
|
1178
|
+
const cardStyle = [themeHeightToInlineStyle(themeParam), themePaintToInlineStyle(themeParam)]
|
|
1179
|
+
.filter(s => s.length > 0).join('; ');
|
|
1180
|
+
const cardAttr = cardStyle.length > 0 ? ` style="${cardStyle}"` : '';
|
|
1181
|
+
// `hideLabel: true` on a section drops its title bar entirely (compact, unlabeled panel).
|
|
1182
|
+
const hideTitle = ((_b = element.params) !== null && _b !== void 0 ? _b : []).some((p) => isHideLabelParam(p) && p.value);
|
|
1183
|
+
const titleNode = hideTitle ? '' : `<v-card-title>{{ game.i18n.localize('${document.name}.${element.name}') }}</v-card-title>`;
|
|
1093
1184
|
return expandToNode `
|
|
1094
|
-
<v-col class="section">
|
|
1095
|
-
<v-card variant="outlined" elevation="4">
|
|
1096
|
-
|
|
1185
|
+
<v-col class="section isdl-section isdl-section-${element.name.toLowerCase()}"${colAttr}>
|
|
1186
|
+
<v-card variant="outlined" elevation="4"${cardAttr}>
|
|
1187
|
+
${titleNode}
|
|
1097
1188
|
|
|
1098
1189
|
<v-card-text>
|
|
1099
1190
|
<v-row dense>
|
|
@@ -1104,16 +1195,23 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1104
1195
|
</v-col>
|
|
1105
1196
|
`;
|
|
1106
1197
|
}
|
|
1198
|
+
// Bare row/column have no inner card, so sizing AND border ride the element itself.
|
|
1199
|
+
// (background/text are section-only and rejected by the validator, so paint here only ever
|
|
1200
|
+
// yields a border.) themePaintToInlineStyle was previously omitted here -- dropping borders
|
|
1201
|
+
// authored on a row/column.
|
|
1202
|
+
const containerStyle = [themeSizingToInlineStyle(themeParam), themePaintToInlineStyle(themeParam)]
|
|
1203
|
+
.filter(s => s.length > 0).join('; ');
|
|
1204
|
+
const styleAttr = containerStyle.length > 0 ? ` style="${containerStyle}"` : '';
|
|
1107
1205
|
if (isRow(element)) {
|
|
1108
1206
|
return expandToNode `
|
|
1109
|
-
<v-row dense>
|
|
1207
|
+
<v-row dense class="isdl-row"${styleAttr}>
|
|
1110
1208
|
${joinToNode(element.body, element => generateElement(element), { appendNewLineIfNotEmpty: true })}
|
|
1111
1209
|
</v-row>
|
|
1112
1210
|
`;
|
|
1113
1211
|
}
|
|
1114
1212
|
if (isColumn(element)) {
|
|
1115
1213
|
return expandToNode `
|
|
1116
|
-
<v-col>
|
|
1214
|
+
<v-col class="isdl-column"${styleAttr}>
|
|
1117
1215
|
${joinToNode(element.body, element => generateElement(element), { appendNewLineIfNotEmpty: true })}
|
|
1118
1216
|
</v-col>
|
|
1119
1217
|
`;
|
|
@@ -1144,97 +1242,108 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1144
1242
|
const iconParam = standardParams.find(p => isIconParam(p));
|
|
1145
1243
|
const colorParam = standardParams.find(p => isColorParam(p));
|
|
1146
1244
|
const label = `${document.name}.${element.name}`;
|
|
1147
|
-
|
|
1245
|
+
// `hideLabel: true` suppresses the field's label text. Passed to every field component
|
|
1246
|
+
// via the shared fragment; each component guards its label render on !hideLabel.
|
|
1247
|
+
const hideLabel = standardParams.some(p => isHideLabelParam(p) && p.value);
|
|
1248
|
+
const baseFragment = `:disabled="isDisabled('${element.name.toLowerCase()}')" v-if="!isHidden('${element.name.toLowerCase()}')"`;
|
|
1249
|
+
const standardParamsFragment = `${baseFragment}${colorParam ? ` color="${colorParam.value}"` : ''}${hideLabel ? ' :hideLabel="true"' : ''}`;
|
|
1148
1250
|
const systemPath = getSystemPath(element, [], undefined, false);
|
|
1149
1251
|
const entry = AstUtils.getContainerOfType(element, isEntry);
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1252
|
+
// Single choke point for the theme marker: render the field by type, then stamp the
|
|
1253
|
+
// universal `isdl-field` (+ per-field `isdl-field-<name>`) class onto its <i-...> root.
|
|
1254
|
+
// Every field branch returns an <i-...> root, so this reaches ALL field types -- no
|
|
1255
|
+
// per-branch allowlist to drift out of sync as new field types are added.
|
|
1256
|
+
const fieldComponent = (() => {
|
|
1257
|
+
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;
|
|
1258
|
+
if (isRollVisualizerField(element)) {
|
|
1259
|
+
const { formula, data } = compileVisualizerFormula(entry, id, element);
|
|
1260
|
+
return expandToNode `
|
|
1153
1261
|
<i-roll-visualizer
|
|
1154
1262
|
:context="context"
|
|
1155
1263
|
label="${label}"
|
|
1156
1264
|
${iconParam ? `icon="${iconParam.value}"` : ``}
|
|
1157
1265
|
${colorParam ? `color="${colorParam.value}"` : ``}
|
|
1266
|
+
${hideLabel ? `:hideLabel="true"` : ``}
|
|
1158
1267
|
systemPath="${systemPath}"
|
|
1159
1268
|
:formula='${formula}'
|
|
1160
1269
|
:rollData='${data}'
|
|
1161
1270
|
v-if="!isHidden('${element.name.toLowerCase()}')">
|
|
1162
1271
|
</i-roll-visualizer>
|
|
1163
1272
|
`;
|
|
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
1273
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1274
|
+
if (isParentPropertyRefExp(element)) {
|
|
1275
|
+
const choicesParam = element.params.find(p => isParentPropertyRefChoiceParam(p));
|
|
1276
|
+
let allChoices = [];
|
|
1277
|
+
switch (element.propertyType) {
|
|
1278
|
+
case "attribute":
|
|
1279
|
+
allChoices = globalGetAllOfType(entry, isAttributeExp);
|
|
1280
|
+
break;
|
|
1281
|
+
case "resource":
|
|
1282
|
+
allChoices = globalGetAllOfType(entry, isResourceExp);
|
|
1283
|
+
break;
|
|
1284
|
+
case "number":
|
|
1285
|
+
allChoices = globalGetAllOfType(entry, isNumberExp);
|
|
1286
|
+
break;
|
|
1287
|
+
case "boolean":
|
|
1288
|
+
allChoices = globalGetAllOfType(entry, isBooleanExp);
|
|
1289
|
+
break;
|
|
1290
|
+
case "date":
|
|
1291
|
+
allChoices = globalGetAllOfType(entry, isDateExp);
|
|
1292
|
+
break;
|
|
1293
|
+
case "time":
|
|
1294
|
+
allChoices = globalGetAllOfType(entry, isTimeExp);
|
|
1295
|
+
break;
|
|
1296
|
+
case "datetime":
|
|
1297
|
+
allChoices = globalGetAllOfType(entry, isDateTimeExp);
|
|
1298
|
+
break;
|
|
1299
|
+
case "die":
|
|
1300
|
+
allChoices = globalGetAllOfType(entry, isDieField);
|
|
1301
|
+
break;
|
|
1302
|
+
case "dice":
|
|
1303
|
+
allChoices = globalGetAllOfType(entry, isDiceField);
|
|
1304
|
+
break;
|
|
1305
|
+
case "string":
|
|
1306
|
+
allChoices = globalGetAllOfType(entry, isStringExp);
|
|
1307
|
+
break;
|
|
1308
|
+
case "tracker":
|
|
1309
|
+
allChoices = globalGetAllOfType(entry, isTrackerExp);
|
|
1310
|
+
break;
|
|
1311
|
+
case "choice":
|
|
1312
|
+
allChoices = globalGetAllOfType(entry, isDocumentChoiceExp);
|
|
1313
|
+
break;
|
|
1314
|
+
case "paperdoll":
|
|
1315
|
+
allChoices = globalGetAllOfType(entry, isPaperDollExp);
|
|
1316
|
+
break;
|
|
1317
|
+
case "html":
|
|
1318
|
+
allChoices = globalGetAllOfType(entry, isHtmlExp);
|
|
1319
|
+
break;
|
|
1320
|
+
//default: console.error("Unsupported parent property type: " + element.propertyType); break;
|
|
1321
|
+
}
|
|
1322
|
+
let refChoices = allChoices.map(x => {
|
|
1323
|
+
let parentDocument = getDocument(x);
|
|
1324
|
+
if (choicesParam && choicesParam.choices.length > 0) {
|
|
1325
|
+
if (!choicesParam.choices.find(y => {
|
|
1326
|
+
var _a, _b;
|
|
1327
|
+
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());
|
|
1328
|
+
if (y.property != undefined) {
|
|
1329
|
+
const propertyNameMatches = ((_b = y.property.ref) === null || _b === void 0 ? void 0 : _b.name.toLowerCase()) == x.name.toLowerCase();
|
|
1330
|
+
return documentNameMatches && propertyNameMatches;
|
|
1331
|
+
}
|
|
1332
|
+
// Just check document name
|
|
1333
|
+
return documentNameMatches;
|
|
1334
|
+
})) {
|
|
1335
|
+
return undefined;
|
|
1222
1336
|
}
|
|
1223
|
-
// Just check document name
|
|
1224
|
-
return documentNameMatches;
|
|
1225
|
-
})) {
|
|
1226
|
-
return undefined;
|
|
1227
1337
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
};
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
return expandToNode `
|
|
1338
|
+
return {
|
|
1339
|
+
path: `system.${x.name.toLowerCase()}`,
|
|
1340
|
+
parent: parentDocument === null || parentDocument === void 0 ? void 0 : parentDocument.name,
|
|
1341
|
+
name: x.name
|
|
1342
|
+
};
|
|
1343
|
+
});
|
|
1344
|
+
refChoices = refChoices.filter(x => x != undefined);
|
|
1345
|
+
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(", ");
|
|
1346
|
+
return expandToNode `
|
|
1238
1347
|
<i-parent-property-reference
|
|
1239
1348
|
:context="context"
|
|
1240
1349
|
label="${label}"
|
|
@@ -1244,74 +1353,74 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1244
1353
|
${standardParamsFragment}>
|
|
1245
1354
|
</i-parent-property-reference>
|
|
1246
1355
|
`;
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1356
|
+
}
|
|
1357
|
+
if (isSelfPropertyRefExp(element)) {
|
|
1358
|
+
const choicesParam = element.params.find(p => p.$type === 'SelfPropertyRefChoiceParam');
|
|
1359
|
+
let allChoices = [];
|
|
1360
|
+
// Get the current document
|
|
1361
|
+
const currentDocument = getDocument(element);
|
|
1362
|
+
if (!currentDocument) {
|
|
1363
|
+
return expandToNode `
|
|
1255
1364
|
<div class="error">Self property reference error: Cannot find current document</div>
|
|
1256
1365
|
`;
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1366
|
+
}
|
|
1367
|
+
switch (element.propertyType) {
|
|
1368
|
+
case "attribute":
|
|
1369
|
+
allChoices = getAllOfType(currentDocument.body, isAttributeExp);
|
|
1370
|
+
break;
|
|
1371
|
+
case "resource":
|
|
1372
|
+
allChoices = getAllOfType(currentDocument.body, isResourceExp);
|
|
1373
|
+
break;
|
|
1374
|
+
case "number":
|
|
1375
|
+
allChoices = getAllOfType(currentDocument.body, isNumberExp);
|
|
1376
|
+
break;
|
|
1377
|
+
case "boolean":
|
|
1378
|
+
allChoices = getAllOfType(currentDocument.body, isBooleanExp);
|
|
1379
|
+
break;
|
|
1380
|
+
case "date":
|
|
1381
|
+
allChoices = getAllOfType(currentDocument.body, isDateExp);
|
|
1382
|
+
break;
|
|
1383
|
+
case "time":
|
|
1384
|
+
allChoices = getAllOfType(currentDocument.body, isTimeExp);
|
|
1385
|
+
break;
|
|
1386
|
+
case "datetime":
|
|
1387
|
+
allChoices = getAllOfType(currentDocument.body, isDateTimeExp);
|
|
1388
|
+
break;
|
|
1389
|
+
case "die":
|
|
1390
|
+
allChoices = getAllOfType(currentDocument.body, isDieField);
|
|
1391
|
+
break;
|
|
1392
|
+
case "dice":
|
|
1393
|
+
allChoices = getAllOfType(currentDocument.body, isDiceField);
|
|
1394
|
+
break;
|
|
1395
|
+
case "string":
|
|
1396
|
+
allChoices = getAllOfType(currentDocument.body, isStringExp);
|
|
1397
|
+
break;
|
|
1398
|
+
case "tracker":
|
|
1399
|
+
allChoices = getAllOfType(currentDocument.body, isTrackerExp);
|
|
1400
|
+
break;
|
|
1401
|
+
case "choice":
|
|
1402
|
+
allChoices = getAllOfType(currentDocument.body, isDocumentChoiceExp);
|
|
1403
|
+
break;
|
|
1404
|
+
case "paperdoll":
|
|
1405
|
+
allChoices = getAllOfType(currentDocument.body, isPaperDollExp);
|
|
1406
|
+
break;
|
|
1407
|
+
case "html":
|
|
1408
|
+
allChoices = getAllOfType(currentDocument.body, isHtmlExp);
|
|
1409
|
+
break;
|
|
1410
|
+
}
|
|
1411
|
+
let refChoices = allChoices.filter(x => x !== element).map(x => {
|
|
1412
|
+
return {
|
|
1413
|
+
path: `system.${x.name.toLowerCase()}`,
|
|
1414
|
+
name: x.name
|
|
1415
|
+
};
|
|
1416
|
+
});
|
|
1417
|
+
// Filter based on choices parameter if provided
|
|
1418
|
+
if (choicesParam && ((_a = choicesParam.choices) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
1419
|
+
const allowedProperties = choicesParam.choices.map((c) => { var _a; return (_a = c.property.ref) === null || _a === void 0 ? void 0 : _a.name.toLowerCase(); });
|
|
1420
|
+
refChoices = refChoices.filter(x => allowedProperties.includes(x.name.toLowerCase()));
|
|
1421
|
+
}
|
|
1422
|
+
const choices = refChoices.map(c => `{ title: '${c.name}', value: '${c.path}' }`).join(", ");
|
|
1423
|
+
return expandToNode `
|
|
1315
1424
|
<i-self-property-reference
|
|
1316
1425
|
:context="context"
|
|
1317
1426
|
label="${label}"
|
|
@@ -1322,11 +1431,11 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1322
1431
|
${standardParamsFragment}>
|
|
1323
1432
|
</i-self-property-reference>
|
|
1324
1433
|
`;
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1434
|
+
}
|
|
1435
|
+
if (isStringExp(element)) {
|
|
1436
|
+
const valueParam = element.params.find(p => isStringParamValue(p));
|
|
1437
|
+
if (valueParam !== undefined) {
|
|
1438
|
+
return expandToNode `
|
|
1330
1439
|
<i-string
|
|
1331
1440
|
:context="context"
|
|
1332
1441
|
label="${label}"
|
|
@@ -1335,8 +1444,8 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1335
1444
|
${standardParamsFragment}>
|
|
1336
1445
|
</i-string>
|
|
1337
1446
|
`;
|
|
1338
|
-
|
|
1339
|
-
|
|
1447
|
+
}
|
|
1448
|
+
return expandToNode `
|
|
1340
1449
|
<i-text-field
|
|
1341
1450
|
label="${label}"
|
|
1342
1451
|
icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
|
|
@@ -1348,46 +1457,46 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1348
1457
|
:secondaryColor="secondaryColor">
|
|
1349
1458
|
</i-text-field>
|
|
1350
1459
|
`;
|
|
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
1460
|
}
|
|
1358
|
-
if ((
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
return
|
|
1363
|
-
}
|
|
1364
|
-
let value = choice.value.properties.find(isChoiceStringValue);
|
|
1365
|
-
if (value) {
|
|
1366
|
-
return toMachineIdentifier(value.value);
|
|
1461
|
+
if (isStringChoiceField(element)) {
|
|
1462
|
+
const choicesParam = element.params.find(p => isStringParamChoices(p));
|
|
1463
|
+
if (!choicesParam) {
|
|
1464
|
+
console.warn(`StringChoiceField ${element.name} does not have a choices parameter.`);
|
|
1465
|
+
return expandToNode ``;
|
|
1367
1466
|
}
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1467
|
+
if (((_b = choicesParam === null || choicesParam === void 0 ? void 0 : choicesParam.choices) === null || _b === void 0 ? void 0 : _b.length) === 0)
|
|
1468
|
+
return expandToNode ``;
|
|
1469
|
+
function choiceValue(choice) {
|
|
1470
|
+
if (!isStringExtendedChoice(choice.value)) {
|
|
1471
|
+
return toMachineIdentifier(choice.value);
|
|
1472
|
+
}
|
|
1473
|
+
let value = choice.value.properties.find(isChoiceStringValue);
|
|
1474
|
+
if (value) {
|
|
1475
|
+
return toMachineIdentifier(value.value);
|
|
1476
|
+
}
|
|
1477
|
+
let label = choice.value.properties.find(isLabelParam);
|
|
1478
|
+
if (label) {
|
|
1479
|
+
return toMachineIdentifier(label.value);
|
|
1480
|
+
}
|
|
1481
|
+
return "unknown";
|
|
1379
1482
|
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
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: ',' })}] }`;
|
|
1483
|
+
function choiceData(choice) {
|
|
1484
|
+
var _a, _b, _c, _d;
|
|
1485
|
+
let choiceField = element;
|
|
1486
|
+
if (!isStringExtendedChoice(choice.value)) {
|
|
1487
|
+
return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '', color: '' }`;
|
|
1386
1488
|
}
|
|
1489
|
+
let icon = choice.value.properties.find(isIconParam);
|
|
1490
|
+
let color = choice.value.properties.find(isColorParam);
|
|
1491
|
+
if (isStringExtendedChoice(choice.value)) {
|
|
1492
|
+
let customProperties = choice.value.properties.filter(isChoiceCustomProperty);
|
|
1493
|
+
if (customProperties.length > 0) {
|
|
1494
|
+
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: ',' })}] }`;
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
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
1498
|
}
|
|
1388
|
-
return expandToNode `
|
|
1389
|
-
}
|
|
1390
|
-
return expandToNode `
|
|
1499
|
+
return expandToNode `
|
|
1391
1500
|
<i-string-choice
|
|
1392
1501
|
:context="context"
|
|
1393
1502
|
label="${label}.label"
|
|
@@ -1400,52 +1509,52 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1400
1509
|
${standardParamsFragment}>
|
|
1401
1510
|
</i-string-choice>
|
|
1402
1511
|
`;
|
|
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
1512
|
}
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
return expandToNode
|
|
1513
|
+
if (isDamageTypeChoiceField(element)) {
|
|
1514
|
+
const choicesParam = element.params.find(p => isStringParamChoices(p));
|
|
1515
|
+
if (!choicesParam) {
|
|
1516
|
+
console.warn(`DamageTypeChoiceField ${element.name} does not have a choices parameter.`);
|
|
1517
|
+
return expandToNode ``;
|
|
1431
1518
|
}
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
function
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1519
|
+
if (((_c = choicesParam === null || choicesParam === void 0 ? void 0 : choicesParam.choices) === null || _c === void 0 ? void 0 : _c.length) === 0)
|
|
1520
|
+
return expandToNode ``;
|
|
1521
|
+
function choiceValue(choice) {
|
|
1522
|
+
if (!isStringExtendedChoice(choice.value)) {
|
|
1523
|
+
return toMachineIdentifier(choice.value);
|
|
1524
|
+
}
|
|
1525
|
+
let value = choice.value.properties.find(isChoiceStringValue);
|
|
1526
|
+
if (value) {
|
|
1527
|
+
return toMachineIdentifier(value.value);
|
|
1528
|
+
}
|
|
1529
|
+
let label = choice.value.properties.find(isLabelParam);
|
|
1530
|
+
if (label) {
|
|
1531
|
+
return toMachineIdentifier(label.value);
|
|
1532
|
+
}
|
|
1533
|
+
return "unknown";
|
|
1439
1534
|
}
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1535
|
+
function choiceData(choice) {
|
|
1536
|
+
var _a, _b, _c, _d;
|
|
1537
|
+
let choiceField = element;
|
|
1538
|
+
if (!isStringExtendedChoice(choice.value)) {
|
|
1539
|
+
return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '', color: '' }`;
|
|
1444
1540
|
}
|
|
1541
|
+
let icon = choice.value.properties.find(isIconParam);
|
|
1542
|
+
let color = choice.value.properties.find(isColorParam);
|
|
1543
|
+
function asStringOrVal(value) {
|
|
1544
|
+
// If string, return as "value", else just value
|
|
1545
|
+
if (typeof value === 'string')
|
|
1546
|
+
return `'${value}'`;
|
|
1547
|
+
return `${value}`;
|
|
1548
|
+
}
|
|
1549
|
+
if (isStringExtendedChoice(choice.value)) {
|
|
1550
|
+
let customProperties = choice.value.properties.filter(isChoiceCustomProperty);
|
|
1551
|
+
if (customProperties.length > 0) {
|
|
1552
|
+
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: ',' })}] }`;
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
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
1556
|
}
|
|
1446
|
-
return expandToNode `
|
|
1447
|
-
}
|
|
1448
|
-
return expandToNode `
|
|
1557
|
+
return expandToNode `
|
|
1449
1558
|
<i-string-choice
|
|
1450
1559
|
:context="context"
|
|
1451
1560
|
label="${label}.label"
|
|
@@ -1458,49 +1567,49 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1458
1567
|
${standardParamsFragment}>
|
|
1459
1568
|
</i-string-choice>
|
|
1460
1569
|
`;
|
|
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
1570
|
}
|
|
1468
|
-
if ((
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
return
|
|
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);
|
|
1571
|
+
if (isStringChoicesField(element)) {
|
|
1572
|
+
const choicesParam = element.params.find(p => p.$type === 'StringChoicesParamChoices');
|
|
1573
|
+
if (!choicesParam) {
|
|
1574
|
+
console.warn(`StringChoicesField ${element.name} does not have a choices parameter.`);
|
|
1575
|
+
return expandToNode ``;
|
|
1481
1576
|
}
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1577
|
+
if (((_d = choicesParam === null || choicesParam === void 0 ? void 0 : choicesParam.choices) === null || _d === void 0 ? void 0 : _d.length) === 0)
|
|
1578
|
+
return expandToNode ``;
|
|
1579
|
+
function choiceValue(choice) {
|
|
1580
|
+
if (!isStringExtendedChoice(choice.value)) {
|
|
1581
|
+
return toMachineIdentifier(choice.value);
|
|
1582
|
+
}
|
|
1583
|
+
let value = choice.value.properties.find(isChoiceStringValue);
|
|
1584
|
+
if (value) {
|
|
1585
|
+
return toMachineIdentifier(value.value);
|
|
1586
|
+
}
|
|
1587
|
+
let label = choice.value.properties.find(isLabelParam);
|
|
1588
|
+
if (label) {
|
|
1589
|
+
return toMachineIdentifier(label.value);
|
|
1590
|
+
}
|
|
1591
|
+
return "unknown";
|
|
1489
1592
|
}
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1593
|
+
function choiceData(choice) {
|
|
1594
|
+
var _a, _b, _c, _d;
|
|
1595
|
+
let choiceField = element;
|
|
1596
|
+
if (!isStringExtendedChoice(choice.value)) {
|
|
1597
|
+
return expandToNode `{ label: game.i18n.localize('${document.name}.${choiceField.name}.${choiceValue(choice)}'), value: '${choiceValue(choice)}', icon: '', color: '' }`;
|
|
1598
|
+
}
|
|
1599
|
+
let icon = choice.value.properties.find(isIconParam);
|
|
1600
|
+
let color = choice.value.properties.find(isColorParam);
|
|
1601
|
+
if (isStringExtendedChoice(choice.value)) {
|
|
1602
|
+
let customProperties = choice.value.properties.filter(isChoiceCustomProperty);
|
|
1603
|
+
if (customProperties.length > 0) {
|
|
1604
|
+
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: ',' })}] }`;
|
|
1605
|
+
}
|
|
1496
1606
|
}
|
|
1607
|
+
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
1608
|
}
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
const maxSelections = maxParam ? maxParam.value : undefined;
|
|
1503
|
-
return expandToNode `
|
|
1609
|
+
// Get maxSelections parameter
|
|
1610
|
+
const maxParam = element.params.find(p => p.$type === 'StringChoicesParamMax');
|
|
1611
|
+
const maxSelections = maxParam ? maxParam.value : undefined;
|
|
1612
|
+
return expandToNode `
|
|
1504
1613
|
<i-string-choices
|
|
1505
1614
|
:context="context"
|
|
1506
1615
|
label="${label}.label"
|
|
@@ -1514,10 +1623,10 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1514
1623
|
${standardParamsFragment}>
|
|
1515
1624
|
</i-string-choices>
|
|
1516
1625
|
`;
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1626
|
+
}
|
|
1627
|
+
if (isDocumentChoiceExp(element)) {
|
|
1628
|
+
const componentName = `${document.name.toLowerCase()}${element.name}DocumentChoice`;
|
|
1629
|
+
return expandToNode `
|
|
1521
1630
|
<${componentName}
|
|
1522
1631
|
label="${label}"
|
|
1523
1632
|
icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
|
|
@@ -1528,10 +1637,10 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1528
1637
|
:secondaryColor="secondaryColor">
|
|
1529
1638
|
</${componentName}>
|
|
1530
1639
|
`;
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1640
|
+
}
|
|
1641
|
+
if (isDocumentChoicesExp(element)) {
|
|
1642
|
+
const componentName = `${document.name.toLowerCase()}${element.name}DocumentChoices`;
|
|
1643
|
+
return expandToNode `
|
|
1535
1644
|
<${componentName}
|
|
1536
1645
|
label="${label}"
|
|
1537
1646
|
icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
|
|
@@ -1542,9 +1651,9 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1542
1651
|
:secondaryColor="secondaryColor">
|
|
1543
1652
|
</${componentName}>
|
|
1544
1653
|
`;
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1654
|
+
}
|
|
1655
|
+
if (isMacroField(element)) {
|
|
1656
|
+
return expandToNode `
|
|
1548
1657
|
<i-macro
|
|
1549
1658
|
label="${label}"
|
|
1550
1659
|
icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
|
|
@@ -1556,9 +1665,9 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1556
1665
|
:secondaryColor="secondaryColor">
|
|
1557
1666
|
</i-macro>
|
|
1558
1667
|
`;
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1668
|
+
}
|
|
1669
|
+
if (isHtmlExp(element)) {
|
|
1670
|
+
return expandToNode `
|
|
1562
1671
|
<i-prosemirror
|
|
1563
1672
|
label="${label}"
|
|
1564
1673
|
icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
|
|
@@ -1566,9 +1675,9 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1566
1675
|
${standardParamsFragment}>
|
|
1567
1676
|
</i-prosemirror>
|
|
1568
1677
|
`;
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1678
|
+
}
|
|
1679
|
+
if (isMeasuredTemplateField(element)) {
|
|
1680
|
+
return expandToNode `
|
|
1572
1681
|
<i-measured-template
|
|
1573
1682
|
:context="context"
|
|
1574
1683
|
label="${label}"
|
|
@@ -1579,9 +1688,27 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1579
1688
|
${standardParamsFragment}>
|
|
1580
1689
|
</i-measured-template>
|
|
1581
1690
|
`;
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1691
|
+
}
|
|
1692
|
+
if (isImageField(element)) {
|
|
1693
|
+
// A `primary: true` image binds to the document's native `img` (the movable
|
|
1694
|
+
// portrait); otherwise it stores at its own system path. The edit path is
|
|
1695
|
+
// document-relative ("img" vs "system.<name>") so the sheet's onEditImage handler
|
|
1696
|
+
// reads/writes the right property.
|
|
1697
|
+
const isPrimary = element.params.some(p => isImagePrimaryParam(p) && p.value);
|
|
1698
|
+
const imagePath = isPrimary ? 'img' : systemPath;
|
|
1699
|
+
return expandToNode `
|
|
1700
|
+
<i-image
|
|
1701
|
+
:context="context"
|
|
1702
|
+
label="${label}"
|
|
1703
|
+
icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
|
|
1704
|
+
systemPath="${imagePath}"
|
|
1705
|
+
:primary="${isPrimary}"
|
|
1706
|
+
${standardParamsFragment}>
|
|
1707
|
+
</i-image>
|
|
1708
|
+
`;
|
|
1709
|
+
}
|
|
1710
|
+
if (isDamageBonusesField(element)) {
|
|
1711
|
+
return expandToNode `
|
|
1585
1712
|
<i-bonuses
|
|
1586
1713
|
:context="context"
|
|
1587
1714
|
label="${label}"
|
|
@@ -1590,9 +1717,9 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1590
1717
|
${standardParamsFragment}>
|
|
1591
1718
|
</i-bonuses>
|
|
1592
1719
|
`;
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1720
|
+
}
|
|
1721
|
+
if (isDamageResistancesField(element)) {
|
|
1722
|
+
return expandToNode `
|
|
1596
1723
|
<i-resistances
|
|
1597
1724
|
:context="context"
|
|
1598
1725
|
label="${label}"
|
|
@@ -1601,17 +1728,17 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1601
1728
|
${standardParamsFragment}>
|
|
1602
1729
|
</i-resistances>
|
|
1603
1730
|
`;
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1731
|
+
}
|
|
1732
|
+
if (isPinnedField(element)) {
|
|
1733
|
+
if (isTopLevel)
|
|
1734
|
+
return expandToNode ``;
|
|
1735
|
+
const page = AstUtils.getContainerOfType(element, isPage);
|
|
1736
|
+
const pageName = (_e = page === null || page === void 0 ? void 0 : page.name) !== null && _e !== void 0 ? _e : document.name;
|
|
1737
|
+
const systemPath = getSystemPath(element, [], undefined, false);
|
|
1738
|
+
let componentName = `${document.name}${pageName}${element.name}VuetifyDatatable`;
|
|
1739
|
+
// Wrap in a drop zone so drag-drop works for pinned tables inside a
|
|
1740
|
+
// row/column (same reason as regular tables above).
|
|
1741
|
+
return expandToNode `
|
|
1615
1742
|
<div class="datatable-drop-zone" v-if="!isHidden('${element.name.toLowerCase()}')">
|
|
1616
1743
|
<${componentName}
|
|
1617
1744
|
:context="context"
|
|
@@ -1622,9 +1749,9 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1622
1749
|
</${componentName}>
|
|
1623
1750
|
</div>
|
|
1624
1751
|
`;
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1752
|
+
}
|
|
1753
|
+
if (isBooleanExp(element)) {
|
|
1754
|
+
return expandToNode `
|
|
1628
1755
|
<i-boolean
|
|
1629
1756
|
:context="context"
|
|
1630
1757
|
label="${label}"
|
|
@@ -1633,23 +1760,23 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1633
1760
|
${standardParamsFragment}>
|
|
1634
1761
|
</i-boolean>
|
|
1635
1762
|
`;
|
|
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
1763
|
}
|
|
1652
|
-
|
|
1764
|
+
if (isNumberExp(element)) {
|
|
1765
|
+
const valueParam = element.params.find(x => isNumberParamValue(x));
|
|
1766
|
+
const minParam = element.params.find(x => isNumberParamMin(x));
|
|
1767
|
+
const maxParam = element.params.find(x => isNumberParamMax(x));
|
|
1768
|
+
const calculatorParam = element.params.find(x => isNumberParamCalculator(x));
|
|
1769
|
+
// Determine if min/max are literal numbers (not MethodBlocks). Literal bounds are
|
|
1770
|
+
// bound onto the widget so it clamps input at entry, matching the schema's clamp.
|
|
1771
|
+
let minValue = undefined;
|
|
1772
|
+
if (minParam && typeof minParam.value === 'number') {
|
|
1773
|
+
minValue = minParam.value;
|
|
1774
|
+
}
|
|
1775
|
+
let maxValue = undefined;
|
|
1776
|
+
if (maxParam && typeof maxParam.value === 'number') {
|
|
1777
|
+
maxValue = maxParam.value;
|
|
1778
|
+
}
|
|
1779
|
+
return expandToNode `
|
|
1653
1780
|
<i-number
|
|
1654
1781
|
:context="context"
|
|
1655
1782
|
label="${label}"
|
|
@@ -1665,27 +1792,27 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1665
1792
|
${standardParamsFragment}>
|
|
1666
1793
|
</i-number>
|
|
1667
1794
|
`;
|
|
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
1795
|
}
|
|
1688
|
-
|
|
1796
|
+
if (isMoneyField(element)) {
|
|
1797
|
+
const formatParam = element.params.find(p => p.$type === 'MoneyFormatParam');
|
|
1798
|
+
const precisionParam = element.params.find(p => p.$type === 'MoneyPrecisionParam');
|
|
1799
|
+
const displayParam = element.params.find(p => p.$type === 'MoneyDisplayParam');
|
|
1800
|
+
const valueParam = element.params.find(x => isNumberParamValue(x));
|
|
1801
|
+
const format = (formatParam === null || formatParam === void 0 ? void 0 : formatParam.value) || 'auto';
|
|
1802
|
+
const precision = (precisionParam === null || precisionParam === void 0 ? void 0 : precisionParam.value) || 1;
|
|
1803
|
+
const display = (displayParam === null || displayParam === void 0 ? void 0 : displayParam.value) || 'breakdown';
|
|
1804
|
+
// Generate denominations array from AST
|
|
1805
|
+
let denominationsArray = '[]';
|
|
1806
|
+
if (element.denominations && element.denominations.length > 0) {
|
|
1807
|
+
const denominations = element.denominations.map(denom => {
|
|
1808
|
+
const valueParam = denom.params.find((p) => p.$type === 'MoneyDenominationValueParam');
|
|
1809
|
+
const denomIconParam = denom.params.find((p) => p.$type === 'IconParam');
|
|
1810
|
+
const denomColorParam = denom.params.find((p) => p.$type === 'ColorParam');
|
|
1811
|
+
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) || ''}' }`;
|
|
1812
|
+
}).join(', ');
|
|
1813
|
+
denominationsArray = `[${denominations}]`;
|
|
1814
|
+
}
|
|
1815
|
+
return expandToNode `
|
|
1689
1816
|
<i-money
|
|
1690
1817
|
:context="context"
|
|
1691
1818
|
label="${label}"
|
|
@@ -1702,26 +1829,26 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1702
1829
|
${standardParamsFragment}>
|
|
1703
1830
|
</i-money>
|
|
1704
1831
|
`;
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1832
|
+
}
|
|
1833
|
+
if (isAttributeExp(element)) {
|
|
1834
|
+
const minParam = element.params.find(x => isNumberParamMin(x));
|
|
1835
|
+
const min = (_f = minParam === null || minParam === void 0 ? void 0 : minParam.value) !== null && _f !== void 0 ? _f : 0;
|
|
1836
|
+
const hasMod = element.params.find(x => isAttributeParamMod(x)) != undefined;
|
|
1837
|
+
const modSystemPath = getSystemPath(element, ["mod"], undefined, false);
|
|
1838
|
+
const valueSystemPath = getSystemPath(element, ["value"], undefined, false);
|
|
1839
|
+
const styleParam = element.params.find(x => isAttributeStyleParam(x));
|
|
1840
|
+
const style = (_g = styleParam === null || styleParam === void 0 ? void 0 : styleParam.style) !== null && _g !== void 0 ? _g : "box";
|
|
1841
|
+
const rollParam = element.params.find(x => isAttributeRollParam(x));
|
|
1842
|
+
const functionParam = element.params.find(x => isAttributeFunctionParam(x));
|
|
1843
|
+
// Both `roll:` and `function:` drive the attribute's click overlay. Validation forbids
|
|
1844
|
+
// setting both, so at most one of these is defined.
|
|
1845
|
+
const clickHandler = rollParam
|
|
1846
|
+
? expandToNode `on${element.name}AttributeRoll`
|
|
1847
|
+
: (functionParam ? expandToNode `on${element.name}AttributeFunction` : expandToNode `undefined`);
|
|
1848
|
+
// roll: keeps the die icon; function: shows the attribute's own icon (or a generic
|
|
1849
|
+
// action bolt) so the overlay reflects what the click actually triggers.
|
|
1850
|
+
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";
|
|
1851
|
+
return expandToNode `
|
|
1725
1852
|
<i-attribute
|
|
1726
1853
|
label="${label}"
|
|
1727
1854
|
icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
|
|
@@ -1741,30 +1868,31 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1741
1868
|
>
|
|
1742
1869
|
</i-attribute>
|
|
1743
1870
|
`;
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1871
|
+
}
|
|
1872
|
+
// if () {
|
|
1873
|
+
// return expandToNode`
|
|
1874
|
+
// <i-resource
|
|
1875
|
+
// label="${label}"
|
|
1876
|
+
// icon="${iconParam?.value}"
|
|
1877
|
+
// systemPath="system.${element.name.toLowerCase()}"
|
|
1878
|
+
// :context="context"
|
|
1879
|
+
// ${standardParamsFragment}
|
|
1880
|
+
// :primaryColor="primaryColor"
|
|
1881
|
+
// :secondaryColor="secondaryColor">
|
|
1882
|
+
// </i-resource>
|
|
1883
|
+
// `;
|
|
1884
|
+
// }
|
|
1885
|
+
if (isDamageTrackExp(element)) {
|
|
1886
|
+
const typesParam = element.params.find(x => isDamageTrackTypesParam(x));
|
|
1887
|
+
const types = (_j = typesParam === null || typesParam === void 0 ? void 0 : typesParam.types) !== null && _j !== void 0 ? _j : [];
|
|
1888
|
+
const maxParam = element.params.find(x => isNumberParamMax(x));
|
|
1889
|
+
const max = (_k = maxParam === null || maxParam === void 0 ? void 0 : maxParam.value) !== null && _k !== void 0 ? _k : 5;
|
|
1890
|
+
const colorParam = element.params.find(x => isColorParam(x));
|
|
1891
|
+
const primaryColor = colorParam ? `'${colorParam.value}'` : "primaryColor";
|
|
1892
|
+
return expandToNode `
|
|
1766
1893
|
<i-damage-track
|
|
1767
1894
|
label="${label}"
|
|
1895
|
+
${hideLabel ? `:hideLabel="true"` : ''}
|
|
1768
1896
|
systemPath="system.${element.name.toLowerCase()}"
|
|
1769
1897
|
:context="context"
|
|
1770
1898
|
:editMode="editModeRef"
|
|
@@ -1774,34 +1902,35 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1774
1902
|
:max="${max}"
|
|
1775
1903
|
></i-damage-track>
|
|
1776
1904
|
`;
|
|
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
1905
|
}
|
|
1801
|
-
|
|
1802
|
-
|
|
1906
|
+
if (isTrackerExp(element) || isResourceExp(element)) {
|
|
1907
|
+
const styleParam = element.params.find(x => isTrackerStyleParameter(x));
|
|
1908
|
+
const style = (_l = styleParam === null || styleParam === void 0 ? void 0 : styleParam.style) !== null && _l !== void 0 ? _l : "bar";
|
|
1909
|
+
const iconParam = element.params.find(x => isIconParam(x));
|
|
1910
|
+
const icon = (_m = iconParam === null || iconParam === void 0 ? void 0 : iconParam.value) !== null && _m !== void 0 ? _m : undefined;
|
|
1911
|
+
const minParam = element.params.find(x => isNumberParamMin(x));
|
|
1912
|
+
const disableMin = (minParam === null || minParam === void 0 ? void 0 : minParam.value) != undefined;
|
|
1913
|
+
let hideMin = false;
|
|
1914
|
+
const valueParam = element.params.find(x => isNumberParamValue(x));
|
|
1915
|
+
const disableValue = (valueParam === null || valueParam === void 0 ? void 0 : valueParam.value) != undefined;
|
|
1916
|
+
const maxParam = element.params.find(x => isNumberParamMax(x));
|
|
1917
|
+
const disableMax = (maxParam === null || maxParam === void 0 ? void 0 : maxParam.value) != undefined;
|
|
1918
|
+
const colorParam = element.params.find(x => isColorParam(x));
|
|
1919
|
+
const primaryColor = colorParam ? `'${colorParam.value}'` : "primaryColor";
|
|
1920
|
+
const segmentParm = element.params.find(x => isSegmentsParameter(x));
|
|
1921
|
+
const segments = (_o = segmentParm === null || segmentParm === void 0 ? void 0 : segmentParm.segments) !== null && _o !== void 0 ? _o : 1;
|
|
1922
|
+
let isHealth = false;
|
|
1923
|
+
let isWounds = false;
|
|
1924
|
+
if (isResourceExp(element)) {
|
|
1925
|
+
hideMin = true;
|
|
1926
|
+
isHealth = element.tag == "health";
|
|
1927
|
+
isWounds = element.tag == "wounds";
|
|
1928
|
+
}
|
|
1929
|
+
return expandToNode `
|
|
1930
|
+
<i-tracker
|
|
1803
1931
|
label="${label}"
|
|
1804
|
-
|
|
1932
|
+
${hideLabel ? `:hideLabel="true"` : ''}
|
|
1933
|
+
systemPath="system.${element.name.toLowerCase()}" :context="context"
|
|
1805
1934
|
:visibility="visibilityStates['${element.name.toLowerCase()}'].value"
|
|
1806
1935
|
:editMode="editModeRef"
|
|
1807
1936
|
:primaryColor="${primaryColor}" :secondaryColor="secondaryColor" :tertiaryColor="tertiaryColor"
|
|
@@ -1816,9 +1945,9 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1816
1945
|
:isWounds="${isWounds}"
|
|
1817
1946
|
></i-tracker>
|
|
1818
1947
|
`;
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1948
|
+
}
|
|
1949
|
+
if (isSingleDocumentExp(element)) {
|
|
1950
|
+
return expandToNode `
|
|
1822
1951
|
<i-document-link
|
|
1823
1952
|
label="${label}"
|
|
1824
1953
|
icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
|
|
@@ -1829,9 +1958,9 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1829
1958
|
:secondaryColor="secondaryColor">
|
|
1830
1959
|
</i-document-link>
|
|
1831
1960
|
`;
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1961
|
+
}
|
|
1962
|
+
if (isDateExp(element)) {
|
|
1963
|
+
return expandToNode `
|
|
1835
1964
|
<i-datetime
|
|
1836
1965
|
type="date"
|
|
1837
1966
|
label="${label}"
|
|
@@ -1842,9 +1971,9 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1842
1971
|
:primaryColor="primaryColor" :secondaryColor="secondaryColor">
|
|
1843
1972
|
</i-datetime>
|
|
1844
1973
|
`;
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1974
|
+
}
|
|
1975
|
+
if (isTimeExp(element)) {
|
|
1976
|
+
return expandToNode `
|
|
1848
1977
|
<i-datetime
|
|
1849
1978
|
type="time"
|
|
1850
1979
|
label="${label}"
|
|
@@ -1855,9 +1984,9 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1855
1984
|
:primaryColor="primaryColor" :secondaryColor="secondaryColor">
|
|
1856
1985
|
</i-datetime>
|
|
1857
1986
|
`;
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1987
|
+
}
|
|
1988
|
+
if (isDateTimeExp(element)) {
|
|
1989
|
+
return expandToNode `
|
|
1861
1990
|
<i-datetime
|
|
1862
1991
|
type="datetime-local"
|
|
1863
1992
|
label="${label}"
|
|
@@ -1868,13 +1997,13 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1868
1997
|
:primaryColor="primaryColor" :secondaryColor="secondaryColor">
|
|
1869
1998
|
</i-datetime>
|
|
1870
1999
|
`;
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
2000
|
+
}
|
|
2001
|
+
if (isPaperDollExp(element)) {
|
|
2002
|
+
let sizeParam = element.params.find(x => isSizeParam(x));
|
|
2003
|
+
let size = (_q = sizeParam === null || sizeParam === void 0 ? void 0 : sizeParam.value) !== null && _q !== void 0 ? _q : "40px";
|
|
2004
|
+
let imageParam = element.params.find(x => isImageParam(x));
|
|
2005
|
+
let image = (_r = imageParam === null || imageParam === void 0 ? void 0 : imageParam.value) !== null && _r !== void 0 ? _r : `systems/${id}/img/paperdoll_default.png`;
|
|
2006
|
+
return expandToNode `
|
|
1878
2007
|
<i-paperdoll
|
|
1879
2008
|
label="${label}"
|
|
1880
2009
|
icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
|
|
@@ -1886,14 +2015,14 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1886
2015
|
:slots="${element.name.toLowerCase()}Slots">
|
|
1887
2016
|
</i-paperdoll>
|
|
1888
2017
|
`;
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
2018
|
+
}
|
|
2019
|
+
if (isDiceFields(element)) {
|
|
2020
|
+
let choicesParam = element.params.find(x => isDieChoicesParam(x));
|
|
2021
|
+
let choices = choicesParam ? `[${choicesParam.choices.join(", ")}]` : "[ 'd4', 'd6', 'd8', 'd10', 'd12', 'd20' ]";
|
|
2022
|
+
let noneParam = element.params.find(x => isDieNoneParam(x));
|
|
2023
|
+
let noneAttr = (noneParam === null || noneParam === void 0 ? void 0 : noneParam.value) ? `:none="true"` : '';
|
|
2024
|
+
if (isDieField(element)) {
|
|
2025
|
+
return expandToNode `
|
|
1897
2026
|
<i-die
|
|
1898
2027
|
:context="context"
|
|
1899
2028
|
label="${label}"
|
|
@@ -1904,9 +2033,9 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1904
2033
|
${standardParamsFragment}>
|
|
1905
2034
|
</i-die>
|
|
1906
2035
|
`;
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
2036
|
+
}
|
|
2037
|
+
if (isDiceField(element)) {
|
|
2038
|
+
return expandToNode `
|
|
1910
2039
|
<i-dice
|
|
1911
2040
|
label="${label}"
|
|
1912
2041
|
icon="${iconParam === null || iconParam === void 0 ? void 0 : iconParam.value}"
|
|
@@ -1920,119 +2049,120 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
1920
2049
|
:secondaryColor="secondaryColor"
|
|
1921
2050
|
/>
|
|
1922
2051
|
`;
|
|
2052
|
+
}
|
|
1923
2053
|
}
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
return expandToNode `
|
|
2054
|
+
if (isTableField(element)) {
|
|
2055
|
+
if (isTopLevel)
|
|
2056
|
+
return expandToNode ``;
|
|
2057
|
+
const page = AstUtils.getContainerOfType(element, isPage);
|
|
2058
|
+
const pageName = (_s = page === null || page === void 0 ? void 0 : page.name) !== null && _s !== void 0 ? _s : document.name;
|
|
2059
|
+
const systemPath = getSystemPath(element, [], undefined, false);
|
|
2060
|
+
let componentName = `${document.name}${pageName}${element.name}VuetifyDatatable`;
|
|
2061
|
+
// Wrap in a drop zone so drag-drop works for tables inside a row/column.
|
|
2062
|
+
// Tables rendered as their own tab are wrapped in .tabs-container (the
|
|
2063
|
+
// sheet's drop target); layout-rendered tables aren't, so without this
|
|
2064
|
+
// wrapper they have no drop target. The wrapper only exists in the layout
|
|
2065
|
+
// case (never nested inside a .tabs-container), so no double drop binding.
|
|
2066
|
+
return expandToNode `
|
|
1938
2067
|
<div class="datatable-drop-zone" v-if="!isHidden('${element.name.toLowerCase()}')">
|
|
1939
2068
|
<${componentName} systemPath="${systemPath}" :context="context" :primaryColor="primaryColor" :secondaryColor="secondaryColor" :tertiaryColor="tertiaryColor"></${componentName}>
|
|
1940
2069
|
</div>
|
|
1941
2070
|
`.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
2071
|
}
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2072
|
+
if (isInventoryField(element)) {
|
|
2073
|
+
if (isTopLevel)
|
|
2074
|
+
return expandToNode ``;
|
|
2075
|
+
const systemPath = getSystemPath(element, [], undefined, false);
|
|
2076
|
+
const iconParam = element.params.find(p => isIconParam(p));
|
|
2077
|
+
const labelParam = element.params.find(p => isLabelParam(p));
|
|
2078
|
+
const slotsParam = element.params.find(isInventorySlotsParam);
|
|
2079
|
+
const rowsParam = element.params.find(isInventoryRowsParam);
|
|
2080
|
+
const columnsParam = element.params.find(isInventoryColumnsParam);
|
|
2081
|
+
const slotSizeParam = element.params.find(isInventorySlotSizeParam);
|
|
2082
|
+
const quantityParam = element.params.find(isInventoryQuantityParam);
|
|
2083
|
+
const moneyParam = element.params.find(isInventoryMoneyParam);
|
|
2084
|
+
const sumParam = element.params.find(isInventorySumParam);
|
|
2085
|
+
const sumMaxParam = element.params.find(isInventorySumMaxParam);
|
|
2086
|
+
const sortParam = element.params.find(isInventorySortParam);
|
|
2087
|
+
const whereParam = element.params.find(isWhereParam);
|
|
2088
|
+
const globalParam = element.params.find(isGlobalParam);
|
|
2089
|
+
const emptySlotsParam = element.params.find(isInventoryEmptySlotsParam);
|
|
2090
|
+
const summaryParam = element.params.find(isInventorySummaryParam);
|
|
2091
|
+
const label = labelParam ? labelParam.value : `${document.name}.${element.name}`;
|
|
2092
|
+
const icon = iconParam === null || iconParam === void 0 ? void 0 : iconParam.value;
|
|
2093
|
+
const slots = (_t = slotsParam === null || slotsParam === void 0 ? void 0 : slotsParam.value) !== null && _t !== void 0 ? _t : 20;
|
|
2094
|
+
const rows = rowsParam === null || rowsParam === void 0 ? void 0 : rowsParam.value;
|
|
2095
|
+
const columns = columnsParam === null || columnsParam === void 0 ? void 0 : columnsParam.value;
|
|
2096
|
+
const slotSize = slotSizeParam ? parseInt(slotSizeParam.value.replace('px', '')) : 60;
|
|
2097
|
+
const documentType = (_u = element.document.ref) === null || _u === void 0 ? void 0 : _u.name.toLowerCase();
|
|
2098
|
+
const quantityField = (_v = quantityParam === null || quantityParam === void 0 ? void 0 : quantityParam.field.ref) === null || _v === void 0 ? void 0 : _v.name.toLowerCase();
|
|
2099
|
+
const moneyField = (_w = moneyParam === null || moneyParam === void 0 ? void 0 : moneyParam.field.ref) === null || _w === void 0 ? void 0 : _w.name.toLowerCase();
|
|
2100
|
+
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;
|
|
2101
|
+
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;
|
|
2102
|
+
const sortProperty = (_2 = sortParam === null || sortParam === void 0 ? void 0 : sortParam.property.ref) === null || _2 === void 0 ? void 0 : _2.name;
|
|
2103
|
+
const sortOrder = (_3 = sortParam === null || sortParam === void 0 ? void 0 : sortParam.order) !== null && _3 !== void 0 ? _3 : 'asc';
|
|
2104
|
+
const globalAllowed = (_4 = globalParam === null || globalParam === void 0 ? void 0 : globalParam.value) !== null && _4 !== void 0 ? _4 : false;
|
|
2105
|
+
const emptySlots = (_5 = emptySlotsParam === null || emptySlotsParam === void 0 ? void 0 : emptySlotsParam.value) !== null && _5 !== void 0 ? _5 : 'show';
|
|
2106
|
+
const summary = (_6 = summaryParam === null || summaryParam === void 0 ? void 0 : summaryParam.value) !== null && _6 !== void 0 ? _6 : 'full';
|
|
2107
|
+
// Handle sum properties (can be single or array)
|
|
2108
|
+
let sumProperties = [];
|
|
2109
|
+
if (sumParam) {
|
|
2110
|
+
if (sumParam.properties.property) {
|
|
2111
|
+
sumProperties = [((_7 = sumParam.properties.property.ref) === null || _7 === void 0 ? void 0 : _7.name) || ''];
|
|
2112
|
+
}
|
|
2113
|
+
else if (sumParam.properties.properties) {
|
|
2114
|
+
sumProperties = sumParam.properties.properties
|
|
2115
|
+
.map(p => { var _a; return ((_a = p.ref) === null || _a === void 0 ? void 0 : _a.name) || ''; })
|
|
2116
|
+
.filter(n => n !== '');
|
|
2003
2117
|
}
|
|
2004
2118
|
}
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2119
|
+
// Handle sumMax (can be int, expression, or array of ints/expressions)
|
|
2120
|
+
let sumMax = undefined;
|
|
2121
|
+
if (sumMaxParam) {
|
|
2122
|
+
if (sumMaxParam.value !== undefined) {
|
|
2123
|
+
// It's a single INT
|
|
2124
|
+
sumMax = String(sumMaxParam.value);
|
|
2125
|
+
}
|
|
2126
|
+
else if (sumMaxParam.expression) {
|
|
2127
|
+
// It's a single expression (like self.CarryCapacity), translate it
|
|
2128
|
+
const sumMaxNode = translateExpression(entry, id, sumMaxParam.expression);
|
|
2129
|
+
if (sumMaxNode) {
|
|
2130
|
+
// Prefix with context. so it evaluates correctly in Vue template
|
|
2131
|
+
sumMax = `context.${toString(sumMaxNode)}`;
|
|
2010
2132
|
}
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2133
|
+
}
|
|
2134
|
+
else if ((_8 = sumMaxParam.values) === null || _8 === void 0 ? void 0 : _8.values) {
|
|
2135
|
+
// It's an array of ints/expressions
|
|
2136
|
+
const maxValues = sumMaxParam.values.values.map((val) => {
|
|
2137
|
+
if (typeof val === 'number') {
|
|
2138
|
+
return String(val);
|
|
2016
2139
|
}
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2140
|
+
else {
|
|
2141
|
+
// It's an expression, translate it
|
|
2142
|
+
const valNode = translateExpression(entry, id, val);
|
|
2143
|
+
if (valNode) {
|
|
2144
|
+
return `context.${toString(valNode)}`;
|
|
2145
|
+
}
|
|
2146
|
+
return '0';
|
|
2147
|
+
}
|
|
2148
|
+
});
|
|
2149
|
+
sumMax = `[${maxValues.join(', ')}]`;
|
|
2150
|
+
}
|
|
2021
2151
|
}
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
return expandToNode `
|
|
2152
|
+
// Handle where expression
|
|
2153
|
+
let whereExpression = undefined;
|
|
2154
|
+
if (whereParam) {
|
|
2155
|
+
const whereNode = translateExpression(entry, id, whereParam.value);
|
|
2156
|
+
whereExpression = whereNode ? toString(whereNode) : undefined;
|
|
2157
|
+
}
|
|
2158
|
+
return expandToNode `
|
|
2030
2159
|
<i-inventory
|
|
2031
2160
|
v-if="!isHidden('${element.name.toLowerCase()}')"
|
|
2032
2161
|
label="${label}"
|
|
2033
2162
|
systemPath="${systemPath}"
|
|
2034
2163
|
:context="context"
|
|
2035
2164
|
:editMode="editModeRef"
|
|
2165
|
+
${hideLabel ? `:hideLabel="true"` : ''}
|
|
2036
2166
|
${icon ? `icon="${icon}"` : ''}
|
|
2037
2167
|
${slots ? `:maxSlots="${slots}"` : ''}
|
|
2038
2168
|
${rows ? `:rows="${rows}"` : ''}
|
|
@@ -2056,14 +2186,37 @@ function generateVueComponentTemplate(entry, id, document) {
|
|
|
2056
2186
|
:tertiaryColor="tertiaryColor"
|
|
2057
2187
|
/>
|
|
2058
2188
|
`.appendNewLine();
|
|
2059
|
-
|
|
2060
|
-
|
|
2189
|
+
}
|
|
2190
|
+
return expandToNode `
|
|
2061
2191
|
<v-alert text="Unknown Property ${element.name}" type="warning" density="compact" class="ga-2 ma-1" variant="outlined"></v-alert>
|
|
2062
2192
|
`;
|
|
2193
|
+
})();
|
|
2194
|
+
return injectFieldMarker(fieldComponent, element);
|
|
2063
2195
|
}
|
|
2064
2196
|
return expandToNode `
|
|
2065
2197
|
<v-alert text="Unknown Element" type="warning" density="compact" class="ga-2 ma-1" variant="outlined"></v-alert>
|
|
2066
2198
|
`;
|
|
2067
2199
|
}
|
|
2200
|
+
// Stamp the universal field marker onto a rendered field's <i-...> component root (the
|
|
2201
|
+
// element that also carries the type + single/double-wide classes via attribute fallthrough).
|
|
2202
|
+
// `.isdl-field` is the one selector theme-token consumption targets; `.isdl-field-<name>` is
|
|
2203
|
+
// the per-field hook + the target a per-field theme override is emitted against.
|
|
2204
|
+
function injectFieldMarker(node, element) {
|
|
2205
|
+
const html = toString(node);
|
|
2206
|
+
const marker = `isdl-field isdl-field-${element.name.toLowerCase()}`;
|
|
2207
|
+
// Stamp the marker onto the FIRST element tag of the rendered field, whatever its name --
|
|
2208
|
+
// <i-number>, a datatable <div class="datatable-drop-zone">, a <DocumentChoice> component,
|
|
2209
|
+
// etc. Insert right after the tag NAME so attribute values (which can contain '>') are never
|
|
2210
|
+
// parsed. If that tag already leads with a `class` attribute, merge into it (no double class).
|
|
2211
|
+
const tag = html.match(/<([A-Za-z][\w.-]*)/);
|
|
2212
|
+
if ((tag === null || tag === void 0 ? void 0 : tag.index) === undefined)
|
|
2213
|
+
return node;
|
|
2214
|
+
const insertAt = tag.index + tag[0].length;
|
|
2215
|
+
const rest = html.slice(insertAt);
|
|
2216
|
+
const injected = /^\s+class="/.test(rest)
|
|
2217
|
+
? html.slice(0, insertAt) + rest.replace(/^(\s+class=")/, `$1${marker} `)
|
|
2218
|
+
: html.slice(0, insertAt) + ` class="${marker}"` + rest;
|
|
2219
|
+
return expandToNode `${injected}`;
|
|
2220
|
+
}
|
|
2068
2221
|
}
|
|
2069
2222
|
//# sourceMappingURL=vue-sheet-application-generator.js.map
|