intelligent-system-design-language 0.3.22 → 0.3.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/.claude/agents/langium-language-designer.md +38 -38
  2. package/.claude/agents/typescript-vscode-expert.md +29 -29
  3. package/.claude/agents/ui-ux-designer.md +36 -36
  4. package/.claude/settings.local.json +33 -33
  5. package/.idea/inspectionProfiles/Project_Default.xml +6 -6
  6. package/.idea/isdl.iml +13 -13
  7. package/.idea/modules.xml +8 -8
  8. package/.idea/vcs.xml +6 -6
  9. package/.idea/watcherTasks.xml +3 -3
  10. package/.vscodeignore +18 -18
  11. package/LICENSE +673 -673
  12. package/README.md +86 -86
  13. package/bin/cli.js +4 -4
  14. package/bin/lsp.js +8 -8
  15. package/out/_backgrounds.scss +91 -91
  16. package/out/_handlebars.scss +497 -497
  17. package/out/_isdlStyles.scss +1444 -1444
  18. package/out/_vuetifyOverrides.scss +425 -425
  19. package/out/_vuetifyStyles.scss +31957 -31957
  20. package/out/cli/components/_backgrounds.scss +91 -91
  21. package/out/cli/components/_handlebars.scss +497 -497
  22. package/out/cli/components/_isdlStyles.scss +1444 -1444
  23. package/out/cli/components/_vuetifyOverrides.scss +425 -425
  24. package/out/cli/components/_vuetifyStyles.scss +31957 -31957
  25. package/out/cli/components/active-effect-sheet-generator.js +453 -453
  26. package/out/cli/components/chat-card-generator.js +654 -654
  27. package/out/cli/components/css-generator.js +4 -4
  28. package/out/cli/components/damage-roll-generator.js +160 -160
  29. package/out/cli/components/datamodel-generator.js +257 -257
  30. package/out/cli/components/derived-data-generator.js +923 -923
  31. package/out/cli/components/hotbar-drop-hook-generator.js +82 -82
  32. package/out/cli/components/init-hook-generator.js +495 -495
  33. package/out/cli/components/language-generator.js +1 -1
  34. package/out/cli/components/language-generator.js.map +1 -1
  35. package/out/cli/components/measured-template-preview.js +221 -221
  36. package/out/cli/components/method-generator.js +601 -562
  37. package/out/cli/components/method-generator.js.map +1 -1
  38. package/out/cli/components/ready-hook-generator.js +404 -404
  39. package/out/cli/components/token-generator.js +116 -116
  40. package/out/cli/components/vue/base-components/vue-attribute.js +138 -138
  41. package/out/cli/components/vue/base-components/vue-boolean.js +64 -64
  42. package/out/cli/components/vue/base-components/vue-calculator.js +93 -93
  43. package/out/cli/components/vue/base-components/vue-damage-application.js +356 -356
  44. package/out/cli/components/vue/base-components/vue-damage-bonuses.js +165 -165
  45. package/out/cli/components/vue/base-components/vue-damage-resistances.js +196 -196
  46. package/out/cli/components/vue/base-components/vue-damage-track.js +121 -121
  47. package/out/cli/components/vue/base-components/vue-date-time.js +42 -42
  48. package/out/cli/components/vue/base-components/vue-dice.js +98 -98
  49. package/out/cli/components/vue/base-components/vue-die.js +73 -73
  50. package/out/cli/components/vue/base-components/vue-document-choice.js +149 -149
  51. package/out/cli/components/vue/base-components/vue-document-choices.js +179 -179
  52. package/out/cli/components/vue/base-components/vue-document-link.js +60 -60
  53. package/out/cli/components/vue/base-components/vue-extended-choice.js +88 -88
  54. package/out/cli/components/vue/base-components/vue-inventory.js +519 -519
  55. package/out/cli/components/vue/base-components/vue-macro-choice.js +138 -138
  56. package/out/cli/components/vue/base-components/vue-measured-template.js +530 -530
  57. package/out/cli/components/vue/base-components/vue-money.js +483 -483
  58. package/out/cli/components/vue/base-components/vue-number.js +174 -174
  59. package/out/cli/components/vue/base-components/vue-paperdoll.js +43 -43
  60. package/out/cli/components/vue/base-components/vue-parent-property-reference.js +76 -76
  61. package/out/cli/components/vue/base-components/vue-prosemirror.js +18 -18
  62. package/out/cli/components/vue/base-components/vue-resource.js +136 -136
  63. package/out/cli/components/vue/base-components/vue-roll-visualizer.js +285 -285
  64. package/out/cli/components/vue/base-components/vue-self-property-reference.js +62 -62
  65. package/out/cli/components/vue/base-components/vue-string-choice.js +98 -98
  66. package/out/cli/components/vue/base-components/vue-string-choices.js +203 -203
  67. package/out/cli/components/vue/base-components/vue-string.js +60 -60
  68. package/out/cli/components/vue/base-components/vue-text-field.js +53 -53
  69. package/out/cli/components/vue/base-components/vue-tracker.js +431 -431
  70. package/out/cli/components/vue/vue-action-component-generator.js +64 -64
  71. package/out/cli/components/vue/vue-active-effect-sheet-generator.js +856 -856
  72. package/out/cli/components/vue/vue-datatable-sheet-class-generator.js +292 -292
  73. package/out/cli/components/vue/vue-datatable2-component-generator.js +824 -824
  74. package/out/cli/components/vue/vue-document-creation-app.js +121 -121
  75. package/out/cli/components/vue/vue-document-creation-sheet.js +94 -94
  76. package/out/cli/components/vue/vue-generator.js +40 -40
  77. package/out/cli/components/vue/vue-mixin.js +296 -296
  78. package/out/cli/components/vue/vue-pinned-datatable-component-generator.js +260 -260
  79. package/out/cli/components/vue/vue-prompt-generator.js +80 -80
  80. package/out/cli/components/vue/vue-prompt-sheet-class-generator.js +317 -317
  81. package/out/cli/components/vue/vue-sheet-application-generator.js +1171 -1171
  82. package/out/cli/components/vue/vue-sheet-class-generator.js +510 -510
  83. package/out/cli/generator.js +508 -438
  84. package/out/cli/generator.js.map +1 -1
  85. package/out/extension/github/githubManager.js +35 -35
  86. package/out/extension/github/githubQuickActions.js +120 -120
  87. package/out/extension/github/system-workflow.yml +47 -47
  88. package/out/extension/main.cjs +881 -311
  89. package/out/extension/main.cjs.map +3 -3
  90. package/out/extension/package.json +419 -419
  91. package/out/language/generated/ast.js +98 -2
  92. package/out/language/generated/ast.js.map +1 -1
  93. package/out/language/generated/grammar.js +14688 -14240
  94. package/out/language/generated/grammar.js.map +1 -1
  95. package/out/language/intelligent-system-design-language-validator.js +44 -2
  96. package/out/language/intelligent-system-design-language-validator.js.map +1 -1
  97. package/out/language/isdl-scope-provider.js +7 -1
  98. package/out/language/isdl-scope-provider.js.map +1 -1
  99. package/out/language/main.cjs +881 -311
  100. package/out/language/main.cjs.map +3 -3
  101. package/out/package.json +419 -419
  102. package/out/progressbar.min.js +6 -6
  103. package/out/styles.scss +828 -762
  104. package/out/test/validating/diagnostics.test.js +55 -0
  105. package/out/test/validating/diagnostics.test.js.map +1 -1
  106. package/package.json +419 -419
@@ -7,180 +7,180 @@ export default function generateNumberComponent(destination, entry) {
7
7
  if (!fs.existsSync(generatedFileDir)) {
8
8
  fs.mkdirSync(generatedFileDir, { recursive: true });
9
9
  }
10
- const fileNode = expandToNode `
11
- <script setup>
12
- import { ref, computed, inject } from "vue";
13
-
14
- const props = defineProps({
15
- label: String,
16
- systemPath: String,
17
- context: Object,
18
- visibility: String,
19
- editMode: Boolean,
20
- icon: String,
21
- color: String,
22
- disabled: Boolean,
23
- hasValueParam: Boolean,
24
- primaryColor: String,
25
- secondaryColor: String,
26
- min: Number,
27
- max: Number,
28
- calculator: {
29
- type: Boolean,
30
- default: undefined
31
- }
32
- });
33
-
34
- const document = inject("rawDocument");
35
-
36
- const numberInput = ref(null);
37
-
38
- const value = computed({
39
- get: () => foundry.utils.getProperty(props.context, props.systemPath),
40
- set: (newValue) => foundry.utils.setProperty(props.context, props.systemPath, newValue)
41
- });
42
-
43
- // Vuetify's up/down stepper buttons update the model without firing a
44
- // native change event, so Foundry's submitOnChange form handler never
45
- // persists the new value. When a change arrives while the text input is
46
- // NOT focused (i.e. it came from a stepper click, not typing), persist
47
- // directly via document.update — the same reliable path the dice fields
48
- // use (dispatching a synthetic change risks Foundry reading the DOM
49
- // input before Vue has flushed the new value). Typing still persists via
50
- // the input's own native change on blur/enter.
51
- // Note: 'document' is the injected Foundry document; DOM access must go
52
- // through window.document.
53
- const onValueUpdate = (newValue) => {
54
- value.value = newValue;
55
- const input = numberInput.value?.\$el?.querySelector('input');
56
- if (document && input && window.document.activeElement !== input) {
57
- document.update({ [props.systemPath]: newValue });
58
- }
59
- };
60
-
61
- const isHidden = computed(() => {
62
- if (props.visibility === "hidden") {
63
- return true;
64
- }
65
- if (props.visibility === "gm" && !game.user.isGM) {
66
- return true;
67
- }
68
- return false;
69
- });
70
-
71
- const isDisabled = computed(() => {
72
- return props.disabled ||
73
- props.visibility === "locked" ||
74
- props.visibility === "readonly" ||
75
- (props.visibility === "gmOnly" && !game.user.isGM);
76
- });
77
-
78
- const fieldColor = computed(() => {
79
- return props.color || 'primary';
80
- });
81
-
82
- const isCalculated = computed(() => {
83
- return props.hasValueParam;
84
- });
85
-
86
- const controlVariant = computed(() => {
87
- return isCalculated.value ? 'hidden' : 'stacked';
88
- });
89
-
90
- const classes = computed(() => {
91
- return isCalculated.value ? 'calculated-number' : '';
92
- });
93
-
94
- const showCalculator = computed(() => {
95
- // Check if calculator was explicitly passed as a prop
96
- const hasCalculatorProp = props.calculator !== undefined && props.calculator !== false;
97
- const calculatorExplicitlyFalse = props.calculator === false;
98
-
99
- // If calculator param is explicitly set to true, use it
100
- if (hasCalculatorProp) {
101
- return true;
102
- }
103
-
104
- // If calculator param is explicitly set to false, never show
105
- if (calculatorExplicitlyFalse) {
106
- return false;
107
- }
108
-
109
- // Don't show on calculated fields
110
- if (isCalculated.value) {
111
- return false;
112
- }
113
-
114
- // Show if max > 10
115
- if (props.max && props.max > 10) {
116
- return true;
117
- }
118
-
119
- // When max is undefined, show if current value >= 10 or <= -10
120
- if (props.max === undefined) {
121
- const currentValue = value.value;
122
- if (typeof currentValue === 'number' && (currentValue >= 10 || currentValue <= -10)) {
123
- return true;
124
- }
125
- }
126
-
127
- return false;
128
- });
129
- </script>
130
-
131
- <template>
132
- <div v-if="!isHidden" class="isdl-number single-wide">
133
- <v-number-input
134
- v-if="!isCalculated"
135
- ref="numberInput"
136
- :model-value="value"
137
- @update:model-value="onValueUpdate"
138
- :name="props.systemPath"
139
- :disabled="isDisabled"
140
- :color="fieldColor"
141
- :min="props.min"
142
- :max="props.max"
143
- controlVariant="stacked"
144
- density="compact"
145
- variant="outlined"
146
- >
147
- <template #label>
148
- <span class="field-label">
149
- <v-icon v-if="props.icon" :icon="props.icon" size="small" class="me-1"></v-icon>
150
- {{ game.i18n.localize(props.label) }}
151
- </span>
152
- </template>
153
- <template #append-inner v-if="props.editMode && showCalculator">
154
- <i-calculator
155
- :context="props.context"
156
- :systemPath="props.systemPath"
157
- :primaryColor="props.primaryColor"
158
- :secondaryColor="props.secondaryColor">
159
- </i-calculator>
160
- </template>
161
- </v-number-input>
162
-
163
- <v-number-input
164
- v-else
165
- :model-value="value"
166
- :name="props.systemPath"
167
- :disabled="isDisabled"
168
- :color="fieldColor"
169
- controlVariant="hidden"
170
- density="compact"
171
- variant="outlined"
172
- append-inner-icon="fa-solid fa-function"
173
- class="calculated-number single-wide"
174
- >
175
- <template #label>
176
- <span class="field-label">
177
- <v-icon v-if="props.icon" :icon="props.icon" size="small" class="me-1"></v-icon>
178
- {{ game.i18n.localize(props.label) }}
179
- </span>
180
- </template>
181
- </v-number-input>
182
- </div>
183
- </template>
10
+ const fileNode = expandToNode `
11
+ <script setup>
12
+ import { ref, computed, inject } from "vue";
13
+
14
+ const props = defineProps({
15
+ label: String,
16
+ systemPath: String,
17
+ context: Object,
18
+ visibility: String,
19
+ editMode: Boolean,
20
+ icon: String,
21
+ color: String,
22
+ disabled: Boolean,
23
+ hasValueParam: Boolean,
24
+ primaryColor: String,
25
+ secondaryColor: String,
26
+ min: Number,
27
+ max: Number,
28
+ calculator: {
29
+ type: Boolean,
30
+ default: undefined
31
+ }
32
+ });
33
+
34
+ const document = inject("rawDocument");
35
+
36
+ const numberInput = ref(null);
37
+
38
+ const value = computed({
39
+ get: () => foundry.utils.getProperty(props.context, props.systemPath),
40
+ set: (newValue) => foundry.utils.setProperty(props.context, props.systemPath, newValue)
41
+ });
42
+
43
+ // Vuetify's up/down stepper buttons update the model without firing a
44
+ // native change event, so Foundry's submitOnChange form handler never
45
+ // persists the new value. When a change arrives while the text input is
46
+ // NOT focused (i.e. it came from a stepper click, not typing), persist
47
+ // directly via document.update — the same reliable path the dice fields
48
+ // use (dispatching a synthetic change risks Foundry reading the DOM
49
+ // input before Vue has flushed the new value). Typing still persists via
50
+ // the input's own native change on blur/enter.
51
+ // Note: 'document' is the injected Foundry document; DOM access must go
52
+ // through window.document.
53
+ const onValueUpdate = (newValue) => {
54
+ value.value = newValue;
55
+ const input = numberInput.value?.\$el?.querySelector('input');
56
+ if (document && input && window.document.activeElement !== input) {
57
+ document.update({ [props.systemPath]: newValue });
58
+ }
59
+ };
60
+
61
+ const isHidden = computed(() => {
62
+ if (props.visibility === "hidden") {
63
+ return true;
64
+ }
65
+ if (props.visibility === "gm" && !game.user.isGM) {
66
+ return true;
67
+ }
68
+ return false;
69
+ });
70
+
71
+ const isDisabled = computed(() => {
72
+ return props.disabled ||
73
+ props.visibility === "locked" ||
74
+ props.visibility === "readonly" ||
75
+ (props.visibility === "gmOnly" && !game.user.isGM);
76
+ });
77
+
78
+ const fieldColor = computed(() => {
79
+ return props.color || 'primary';
80
+ });
81
+
82
+ const isCalculated = computed(() => {
83
+ return props.hasValueParam;
84
+ });
85
+
86
+ const controlVariant = computed(() => {
87
+ return isCalculated.value ? 'hidden' : 'stacked';
88
+ });
89
+
90
+ const classes = computed(() => {
91
+ return isCalculated.value ? 'calculated-number' : '';
92
+ });
93
+
94
+ const showCalculator = computed(() => {
95
+ // Check if calculator was explicitly passed as a prop
96
+ const hasCalculatorProp = props.calculator !== undefined && props.calculator !== false;
97
+ const calculatorExplicitlyFalse = props.calculator === false;
98
+
99
+ // If calculator param is explicitly set to true, use it
100
+ if (hasCalculatorProp) {
101
+ return true;
102
+ }
103
+
104
+ // If calculator param is explicitly set to false, never show
105
+ if (calculatorExplicitlyFalse) {
106
+ return false;
107
+ }
108
+
109
+ // Don't show on calculated fields
110
+ if (isCalculated.value) {
111
+ return false;
112
+ }
113
+
114
+ // Show if max > 10
115
+ if (props.max && props.max > 10) {
116
+ return true;
117
+ }
118
+
119
+ // When max is undefined, show if current value >= 10 or <= -10
120
+ if (props.max === undefined) {
121
+ const currentValue = value.value;
122
+ if (typeof currentValue === 'number' && (currentValue >= 10 || currentValue <= -10)) {
123
+ return true;
124
+ }
125
+ }
126
+
127
+ return false;
128
+ });
129
+ </script>
130
+
131
+ <template>
132
+ <div v-if="!isHidden" class="isdl-number single-wide">
133
+ <v-number-input
134
+ v-if="!isCalculated"
135
+ ref="numberInput"
136
+ :model-value="value"
137
+ @update:model-value="onValueUpdate"
138
+ :name="props.systemPath"
139
+ :disabled="isDisabled"
140
+ :color="fieldColor"
141
+ :min="props.min"
142
+ :max="props.max"
143
+ controlVariant="stacked"
144
+ density="compact"
145
+ variant="outlined"
146
+ >
147
+ <template #label>
148
+ <span class="field-label">
149
+ <v-icon v-if="props.icon" :icon="props.icon" size="small" class="me-1"></v-icon>
150
+ {{ game.i18n.localize(props.label) }}
151
+ </span>
152
+ </template>
153
+ <template #append-inner v-if="props.editMode && showCalculator">
154
+ <i-calculator
155
+ :context="props.context"
156
+ :systemPath="props.systemPath"
157
+ :primaryColor="props.primaryColor"
158
+ :secondaryColor="props.secondaryColor">
159
+ </i-calculator>
160
+ </template>
161
+ </v-number-input>
162
+
163
+ <v-number-input
164
+ v-else
165
+ :model-value="value"
166
+ :name="props.systemPath"
167
+ :disabled="isDisabled"
168
+ :color="fieldColor"
169
+ controlVariant="hidden"
170
+ density="compact"
171
+ variant="outlined"
172
+ append-inner-icon="fa-solid fa-function"
173
+ class="calculated-number single-wide"
174
+ >
175
+ <template #label>
176
+ <span class="field-label">
177
+ <v-icon v-if="props.icon" :icon="props.icon" size="small" class="me-1"></v-icon>
178
+ {{ game.i18n.localize(props.label) }}
179
+ </span>
180
+ </template>
181
+ </v-number-input>
182
+ </div>
183
+ </template>
184
184
  `.appendNewLine();
185
185
  fs.writeFileSync(generatedFilePath, toString(fileNode));
186
186
  }
@@ -7,49 +7,49 @@ export default function generatePaperdollComponent(destination) {
7
7
  if (!fs.existsSync(generatedFileDir)) {
8
8
  fs.mkdirSync(generatedFileDir, { recursive: true });
9
9
  }
10
- const fileNode = expandToNode `
11
- <script setup>
12
- import { ref, computed } from "vue";
13
-
14
- const props = defineProps({
15
- label: String,
16
- systemPath: String,
17
- context: Object,
18
- disabled: Boolean,
19
- slots: Array,
20
- image: String,
21
- size: String
22
- });
23
-
24
- const value = computed(() => {
25
- return foundry.utils.getProperty(props.context, props.systemPath);
26
- });
27
-
28
- const slotValue = (systemPath) => {
29
- return foundry.utils.getProperty(props.context, systemPath);
30
- };
31
-
32
- const openSlot = (slot) => {
33
- const item = slotValue(slot.systemPath);
34
- if (item) {
35
- const fromUuid = fromUuidSync(item.uuid);
36
- fromUuid.sheet.render(true);
37
- }
38
- };
39
- </script>
40
-
41
- <template>
42
- <v-card class="isdl-paperdoll">
43
- <v-card-title>{{ game.i18n.localize(label) }}</v-card-title>
44
- <v-card-text>
45
- <div class="paper-doll-container" :data-name="systemPath" :style="{ backgroundImage: 'url(' + image + ')' }">
46
- <div class="paper-doll-slot" v-for="slot in slots" :key="slot.name" :data-name="slot.systemPath" @click="openSlot(slot)" :data-tooltip="slot.name" :data-type="slot.type" :style="{ left: slot.left, top: slot.top, width: size, height: size }">
47
- <img :src="slotValue(slot.systemPath)?.img" :data-tooltip="slotValue(slot.systemPath)?.name" />
48
- </div>
49
- </div>
50
- </v-card-text>
51
- </v-card>
52
- </template>
10
+ const fileNode = expandToNode `
11
+ <script setup>
12
+ import { ref, computed } from "vue";
13
+
14
+ const props = defineProps({
15
+ label: String,
16
+ systemPath: String,
17
+ context: Object,
18
+ disabled: Boolean,
19
+ slots: Array,
20
+ image: String,
21
+ size: String
22
+ });
23
+
24
+ const value = computed(() => {
25
+ return foundry.utils.getProperty(props.context, props.systemPath);
26
+ });
27
+
28
+ const slotValue = (systemPath) => {
29
+ return foundry.utils.getProperty(props.context, systemPath);
30
+ };
31
+
32
+ const openSlot = (slot) => {
33
+ const item = slotValue(slot.systemPath);
34
+ if (item) {
35
+ const fromUuid = fromUuidSync(item.uuid);
36
+ fromUuid.sheet.render(true);
37
+ }
38
+ };
39
+ </script>
40
+
41
+ <template>
42
+ <v-card class="isdl-paperdoll">
43
+ <v-card-title>{{ game.i18n.localize(label) }}</v-card-title>
44
+ <v-card-text>
45
+ <div class="paper-doll-container" :data-name="systemPath" :style="{ backgroundImage: 'url(' + image + ')' }">
46
+ <div class="paper-doll-slot" v-for="slot in slots" :key="slot.name" :data-name="slot.systemPath" @click="openSlot(slot)" :data-tooltip="slot.name" :data-type="slot.type" :style="{ left: slot.left, top: slot.top, width: size, height: size }">
47
+ <img :src="slotValue(slot.systemPath)?.img" :data-tooltip="slotValue(slot.systemPath)?.name" />
48
+ </div>
49
+ </div>
50
+ </v-card-text>
51
+ </v-card>
52
+ </template>
53
53
  `;
54
54
  fs.writeFileSync(generatedFilePath, toString(fileNode));
55
55
  }
@@ -7,82 +7,82 @@ export default function generateParentPropertyReferenceComponent(destination, en
7
7
  if (!fs.existsSync(generatedFileDir)) {
8
8
  fs.mkdirSync(generatedFileDir, { recursive: true });
9
9
  }
10
- const fileNode = expandToNode `
11
- <template>
12
- <div class="isdl-parent-property-reference single-wide">
13
- <v-select
14
- :name="props.systemPath"
15
- :model-value="value"
16
- @update:model-value="(v) => { value = v; if (document) document.update({ [props.systemPath]: v }); }"
17
- :items="refChoices"
18
- item-title="label"
19
- item-value="value"
20
- :disabled="disabled"
21
- :color="color"
22
- variant="outlined"
23
- clearable
24
- density="compact">
25
- <template #label>
26
- <span v-html="getLabel(props.label, props.icon)" />
27
- </template>
28
- </v-select>
29
- </div>
30
- </template>
31
-
32
- <script setup>
33
- import { computed, inject } from 'vue';
34
-
35
- const document = inject("rawDocument");
36
-
37
- const props = defineProps({
38
- context: {
39
- type: Object,
40
- required: true
41
- },
42
- label: {
43
- type: String,
44
- required: true
45
- },
46
- icon: {
47
- type: String,
48
- required: false
49
- },
50
- systemPath: {
51
- type: String,
52
- required: true
53
- },
54
- refChoices: {
55
- type: Array,
56
- required: true,
57
- default: () => []
58
- },
59
- disabled: {
60
- type: Boolean,
61
- default: false
62
- },
63
- hidden: {
64
- type: Boolean,
65
- default: false
66
- },
67
- color: {
68
- type: String,
69
- default: 'primary'
70
- }
71
- });
72
-
73
- const value = computed({
74
- get: () => foundry.utils.getProperty(props.context, props.systemPath),
75
- set: (newValue) => foundry.utils.setProperty(props.context, props.systemPath, newValue)
76
- });
77
-
78
- // Expose helper function
79
- const getLabel = (label, icon) => {
80
- if (icon) {
81
- return \`<i class="\${icon}"></i> \${game.i18n.localize(label)}\`;
82
- }
83
- return game.i18n.localize(label);
84
- };
85
- </script>
10
+ const fileNode = expandToNode `
11
+ <template>
12
+ <div class="isdl-parent-property-reference single-wide">
13
+ <v-select
14
+ :name="props.systemPath"
15
+ :model-value="value"
16
+ @update:model-value="(v) => { value = v; if (document) document.update({ [props.systemPath]: v }); }"
17
+ :items="refChoices"
18
+ item-title="label"
19
+ item-value="value"
20
+ :disabled="disabled"
21
+ :color="color"
22
+ variant="outlined"
23
+ clearable
24
+ density="compact">
25
+ <template #label>
26
+ <span v-html="getLabel(props.label, props.icon)" />
27
+ </template>
28
+ </v-select>
29
+ </div>
30
+ </template>
31
+
32
+ <script setup>
33
+ import { computed, inject } from 'vue';
34
+
35
+ const document = inject("rawDocument");
36
+
37
+ const props = defineProps({
38
+ context: {
39
+ type: Object,
40
+ required: true
41
+ },
42
+ label: {
43
+ type: String,
44
+ required: true
45
+ },
46
+ icon: {
47
+ type: String,
48
+ required: false
49
+ },
50
+ systemPath: {
51
+ type: String,
52
+ required: true
53
+ },
54
+ refChoices: {
55
+ type: Array,
56
+ required: true,
57
+ default: () => []
58
+ },
59
+ disabled: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ hidden: {
64
+ type: Boolean,
65
+ default: false
66
+ },
67
+ color: {
68
+ type: String,
69
+ default: 'primary'
70
+ }
71
+ });
72
+
73
+ const value = computed({
74
+ get: () => foundry.utils.getProperty(props.context, props.systemPath),
75
+ set: (newValue) => foundry.utils.setProperty(props.context, props.systemPath, newValue)
76
+ });
77
+
78
+ // Expose helper function
79
+ const getLabel = (label, icon) => {
80
+ if (icon) {
81
+ return \`<i class="\${icon}"></i> \${game.i18n.localize(label)}\`;
82
+ }
83
+ return game.i18n.localize(label);
84
+ };
85
+ </script>
86
86
  `.appendNewLine();
87
87
  fs.writeFileSync(generatedFilePath, toString(fileNode));
88
88
  }
@@ -7,24 +7,24 @@ export default function generateProsemirrorComponent(destination) {
7
7
  if (!fs.existsSync(generatedFileDir)) {
8
8
  fs.mkdirSync(generatedFileDir, { recursive: true });
9
9
  }
10
- const fileNode = expandToNode `
11
- <script setup>
12
- import { ref, computed } from "vue";
13
-
14
- const props = defineProps({
15
- label: String,
16
- icon: String,
17
- field: Object,
18
- disabled: Boolean
19
- });
20
- </script>
21
-
22
- <template>
23
- <div class="isdl-html flexcol">
24
- <label style="font-weight: bold"><span v-if="icon" class="padding-right: 0.25rem;"><i :class="icon"></i> </span>{{ game.i18n.localize(label) }}</label>
25
- <div class="prose-mirror-wrapper" v-html="disabled ? field.enriched : field.element.outerHTML"></div>
26
- </div>
27
- </template>
10
+ const fileNode = expandToNode `
11
+ <script setup>
12
+ import { ref, computed } from "vue";
13
+
14
+ const props = defineProps({
15
+ label: String,
16
+ icon: String,
17
+ field: Object,
18
+ disabled: Boolean
19
+ });
20
+ </script>
21
+
22
+ <template>
23
+ <div class="isdl-html flexcol">
24
+ <label style="font-weight: bold"><span v-if="icon" class="padding-right: 0.25rem;"><i :class="icon"></i> </span>{{ game.i18n.localize(label) }}</label>
25
+ <div class="prose-mirror-wrapper" v-html="disabled ? field.enriched : field.element.outerHTML"></div>
26
+ </div>
27
+ </template>
28
28
  `;
29
29
  fs.writeFileSync(generatedFilePath, toString(fileNode));
30
30
  }