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
@@ -36,302 +36,302 @@ export function generateVueMixin(description) {
36
36
  "i-inventory": "Inventory",
37
37
  "i-damage-track": "DamageTrack",
38
38
  };
39
- const fileNode = expandToNode `
40
- import { createApp } from "../../../lib/vue.esm-browser.js";
41
- import * as Vuetify from "../../../lib/vuetify.esm.js";
42
- import { ${joinToNode(Object.values(customComponents), c => expandToNode `${c}`, { separator: ", " })} } from "./components/components.vue.es.mjs";
43
-
44
- /**
45
- * Vue rendering mixin for ApplicationV2.
46
- *
47
- * @param {Constructor} BaseApplication
48
- * @returns {VueApplication}
49
- */
50
- export default function VueRenderingMixin(BaseApplication) {
51
-
52
- class VueApplication extends BaseApplication {
53
-
54
- /** Vue application instance created with createApp(). */
55
- vueApp = null;
56
-
57
- /** Vue root for the mounted application instance. */
58
- vueRoot = null;
59
-
60
- /** Constant to force updates on change. */
61
- _renderKey = 0;
62
-
63
- /**
64
- * Object to store vue parts.
65
- *
66
- * @example
67
- * vueParts = {
68
- * 'document-sheet': {
69
- * component: DocumentSheetVue,
70
- * template: \`<document-sheet :context="context">Failed to render</document-sheet>\`
71
- * },
72
- * 'foobar': {
73
- * component: Foobar,
74
- * template: \`<foobar :context="context"/>\`
75
- * }
76
- * }
77
- */
78
- vueParts = {};
79
-
80
- /**
81
- * Getter for vueComponents
82
- *
83
- * Retrieves an object of component tags to component instances from the vueParts property.
84
- *
85
- * @example
86
- * {
87
- * 'document-sheet': DocumentSheet,
88
- * 'foobar': Foobar,
89
- * }
90
- *
91
- * @returns {object} Object with component tags mapped to components.
92
- */
93
- get vueComponents() {
94
- const components = {};
95
- for (let [key, part] of Object.entries(this.vueParts)) {
96
- if (part?.component) {
97
- components[key] = part.component;
98
- }
99
- }
100
- return components;
101
- }
102
-
103
- /**
104
- * Getter for vueTemplates
105
- *
106
- * Retrieves an array of template part strings to render.
107
- *
108
- * @example
109
- * [
110
- * '<document-sheet :context="context">Failed to render</document-sheet>',
111
- * '<foobar :context="context"/>'
112
- * ]
113
- *
114
- * @returns {Array} Array of vue template mount points.
115
- */
116
- get vueTemplates() {
117
- return Object.values(this.vueParts).map((part) => part.template);
118
- }
119
-
120
- vueData(context) {
121
- return {
122
- context: context
123
- };
124
- }
125
-
126
- _getProvidedData() {
127
- // This is a placeholder for any data you want to provide to the Vue app.
128
- // You can override this method in your subclass to provide additional data.
129
- return {};
130
- }
131
-
132
- /**
133
- * Render the outer framing HTMLElement and mount the Vue application.
134
- *
135
- * This occurs when the application is opened, but not on subsequent renders.
136
- *
137
- * @param {RenderOptions} options
138
- * @returns {Promise<HTMLElement>}
139
- *
140
- * @protected
141
- * @override
142
- */
143
- async _renderFrame(options) {
144
- // Retrieve the context and element.
145
- const context = await this._prepareContext(options);
146
- const element = await super._renderFrame(options);
147
-
148
- // Grab our application target and render our parts.
149
- const target = this.hasFrame ? element.querySelector(".window-content") : element;
150
- target.innerHTML = this.vueTemplates.join("");
151
-
152
- const aliases = {
153
- collapse: 'fas fa-chevron-up',
154
- complete: 'fas fa-check',
155
- cancel: 'fas fa-times-circle',
156
- close: 'fas fa-times',
157
- delete: 'fas fa-times-circle',
158
- // delete (e.g. v-chip close)
159
- clear: 'fas fa-times-circle',
160
- // delete (e.g. v-chip close)
161
- success: 'fas fa-check-circle',
162
- info: 'fas fa-info-circle',
163
- warning: 'fas fa-exclamation',
164
- error: 'fas fa-exclamation-triangle',
165
- prev: 'fas fa-chevron-left',
166
- next: 'fas fa-chevron-right',
167
- checkboxOn: 'fas fa-check-square',
168
- checkboxOff: 'far fa-square',
169
- // note 'far'
170
- checkboxIndeterminate: 'fas fa-minus-square',
171
- delimiter: 'fas fa-circle',
172
- // for carousel
173
- sortAsc: 'fas fa-arrow-up',
174
- sortDesc: 'fas fa-arrow-down',
175
- expand: 'fas fa-chevron-down',
176
- menu: 'fas fa-bars',
177
- subgroup: 'fas fa-caret-down',
178
- dropdown: 'fas fa-caret-down',
179
- radioOn: 'far fa-dot-circle',
180
- radioOff: 'far fa-circle',
181
- edit: 'fas fa-edit',
182
- ratingEmpty: 'far fa-star',
183
- ratingFull: 'fas fa-star',
184
- ratingHalf: 'fas fa-star-half',
185
- loading: 'fas fa-sync',
186
- first: 'fas fa-step-backward',
187
- last: 'fas fa-step-forward',
188
- unfold: 'fas fa-arrows-alt-v',
189
- file: 'fas fa-paperclip',
190
- plus: 'fas fa-plus',
191
- minus: 'fas fa-minus',
192
- calendar: 'fas fa-calendar',
193
- treeviewCollapse: 'fas fa-caret-down',
194
- treeviewExpand: 'fas fa-caret-right',
195
- eyeDropper: 'fas fa-eye-dropper'
196
- };
197
- const fa = {
198
- component: Vuetify.components.VClassIcon
199
- };
200
-
201
- const vueData = this.vueData(context);
202
- console.log("Vue App Data:", vueData, this.document);
203
-
204
- // Create and store the Vue application instance.
205
- this.vueApp = createApp({
206
- // Data available in the template.
207
- data() {
208
- return vueData;
209
- },
210
- // Components allowed by the application.
211
- components: this.vueComponents,
212
- // Method to update the template data on subsequent changes.
213
- methods: {
214
- updateContext(newContext) {
215
- // Note that 'this' refers to this.vueApp, not the full AppV2 instance.
216
- for (let key of Object.keys(this.context)) {
217
- if (newContext[key]) {
218
- this.context[key] = newContext[key];
219
- }
220
- }
221
- }
222
- },
223
- watch: {
224
- "context._renderKey": {
225
- handler: function (newVal, oldVal) {
226
- this.$nextTick(() => {
227
- const changeEvent = new Event("change", { bubbles: true });
228
- this.$el.dispatchEvent(changeEvent);
229
- });
230
- }
231
- }
232
- }
233
- });
234
- ${joinToNode(Object.keys(customComponents), c => expandToNode `this.vueApp.component("${c}", ${customComponents[c]});`, { appendNewLineIfNotEmpty: true })}
235
- const vuetify = Vuetify.createVuetify({
236
- icons: {
237
- defaultSet: 'fa',
238
- aliases,
239
- sets: {
240
- fa,
241
- },
242
- },
243
- components: {
244
- VNumberInput: Vuetify.components.VNumberInput
245
- }
246
- });
247
- this.vueApp.use(vuetify);
248
-
249
- // Expose global Foundry variables.
250
- this.vueApp.config.globalProperties.game = game;
251
- this.vueApp.config.globalProperties.CONFIG = CONFIG;
252
- this.vueApp.config.globalProperties.foundry = foundry;
253
-
254
- // Expose the document.
255
- this.vueApp.provide("rawDocument", this.document);
256
- this.vueApp.provide("rawSheet", this);
257
-
258
- // Expose any extras
259
- const providedData = this._getProvidedData();
260
- for (let key of Object.keys(providedData)) {
261
- this.vueApp.provide(key, providedData[key]);
262
- }
263
-
264
- // Mount and store the vue application.
265
- this.vueRoot = this.vueApp.mount(target);
266
-
267
- return element;
268
- }
269
-
270
- /**
271
- * Handle updates for the Vue application instance.
272
- *
273
- * Normally, this would render the HTML for the content within the application.
274
- * However, for Vue, all we want to do is update the 'context' property that's
275
- * passed into the Vue application instance.
276
- *
277
- * Unlike _renderFrame(), this occurs on every update for the application.
278
- *
279
- * @param {ApplicationRenderContext} context
280
- * @param {RenderOptions} options
281
- * @returns {Promise<string>}
282
- *
283
- * @protected
284
- * @override
285
- */
286
- async _renderHTML(context, options) {
287
- // Force certain updates.
288
- this._renderKey++;
289
- context._renderKey = this._renderKey;
290
- // Update the application root with new values.
291
- this.vueRoot.updateContext(context);
292
- // Return doesn't matter, Vue handles updates.
293
-
294
- // If game.tooltip has an element, reactivate it
295
- if (game.tooltip.element) {
296
- const element = game.tooltip.element;
297
- game.tooltip.deactivate();
298
- game.tooltip.activate(element);
299
- }
300
- }
301
-
302
- /** @override */
303
- _replaceHTML(result, content, options) {
304
- // Pass. We don't need this in Vue land! But Foundry itself does...
305
- }
306
-
307
- /**
308
- * Closes the application and unmounts the vue application instance.
309
- *
310
- * @param {ApplicationClosingOptions} options
311
- * @returns {Promise<BaseApplication>}
312
- *
313
- * @override
314
- */
315
- async close(options = {}) {
316
- if (this.options.form.submitOnClose && this.isEditable) {
317
- await this.submit();
318
- }
319
- // Unmount the vue instance.
320
- if (this.vueApp) this.vueApp.unmount();
321
- await super.close(options);
322
- }
323
-
324
- async _onFirstRender(context) {
325
- super._onFirstRender(context);
326
-
327
- // Replace the .application class with .vue-application
328
- this.element.classList.remove("application");
329
- this.element.classList.add("vue-application");
330
- }
331
- }
332
-
333
- return VueApplication;
334
- }
39
+ const fileNode = expandToNode `
40
+ import { createApp } from "../../../lib/vue.esm-browser.js";
41
+ import * as Vuetify from "../../../lib/vuetify.esm.js";
42
+ import { ${joinToNode(Object.values(customComponents), c => expandToNode `${c}`, { separator: ", " })} } from "./components/components.vue.es.mjs";
43
+
44
+ /**
45
+ * Vue rendering mixin for ApplicationV2.
46
+ *
47
+ * @param {Constructor} BaseApplication
48
+ * @returns {VueApplication}
49
+ */
50
+ export default function VueRenderingMixin(BaseApplication) {
51
+
52
+ class VueApplication extends BaseApplication {
53
+
54
+ /** Vue application instance created with createApp(). */
55
+ vueApp = null;
56
+
57
+ /** Vue root for the mounted application instance. */
58
+ vueRoot = null;
59
+
60
+ /** Constant to force updates on change. */
61
+ _renderKey = 0;
62
+
63
+ /**
64
+ * Object to store vue parts.
65
+ *
66
+ * @example
67
+ * vueParts = {
68
+ * 'document-sheet': {
69
+ * component: DocumentSheetVue,
70
+ * template: \`<document-sheet :context="context">Failed to render</document-sheet>\`
71
+ * },
72
+ * 'foobar': {
73
+ * component: Foobar,
74
+ * template: \`<foobar :context="context"/>\`
75
+ * }
76
+ * }
77
+ */
78
+ vueParts = {};
79
+
80
+ /**
81
+ * Getter for vueComponents
82
+ *
83
+ * Retrieves an object of component tags to component instances from the vueParts property.
84
+ *
85
+ * @example
86
+ * {
87
+ * 'document-sheet': DocumentSheet,
88
+ * 'foobar': Foobar,
89
+ * }
90
+ *
91
+ * @returns {object} Object with component tags mapped to components.
92
+ */
93
+ get vueComponents() {
94
+ const components = {};
95
+ for (let [key, part] of Object.entries(this.vueParts)) {
96
+ if (part?.component) {
97
+ components[key] = part.component;
98
+ }
99
+ }
100
+ return components;
101
+ }
102
+
103
+ /**
104
+ * Getter for vueTemplates
105
+ *
106
+ * Retrieves an array of template part strings to render.
107
+ *
108
+ * @example
109
+ * [
110
+ * '<document-sheet :context="context">Failed to render</document-sheet>',
111
+ * '<foobar :context="context"/>'
112
+ * ]
113
+ *
114
+ * @returns {Array} Array of vue template mount points.
115
+ */
116
+ get vueTemplates() {
117
+ return Object.values(this.vueParts).map((part) => part.template);
118
+ }
119
+
120
+ vueData(context) {
121
+ return {
122
+ context: context
123
+ };
124
+ }
125
+
126
+ _getProvidedData() {
127
+ // This is a placeholder for any data you want to provide to the Vue app.
128
+ // You can override this method in your subclass to provide additional data.
129
+ return {};
130
+ }
131
+
132
+ /**
133
+ * Render the outer framing HTMLElement and mount the Vue application.
134
+ *
135
+ * This occurs when the application is opened, but not on subsequent renders.
136
+ *
137
+ * @param {RenderOptions} options
138
+ * @returns {Promise<HTMLElement>}
139
+ *
140
+ * @protected
141
+ * @override
142
+ */
143
+ async _renderFrame(options) {
144
+ // Retrieve the context and element.
145
+ const context = await this._prepareContext(options);
146
+ const element = await super._renderFrame(options);
147
+
148
+ // Grab our application target and render our parts.
149
+ const target = this.hasFrame ? element.querySelector(".window-content") : element;
150
+ target.innerHTML = this.vueTemplates.join("");
151
+
152
+ const aliases = {
153
+ collapse: 'fas fa-chevron-up',
154
+ complete: 'fas fa-check',
155
+ cancel: 'fas fa-times-circle',
156
+ close: 'fas fa-times',
157
+ delete: 'fas fa-times-circle',
158
+ // delete (e.g. v-chip close)
159
+ clear: 'fas fa-times-circle',
160
+ // delete (e.g. v-chip close)
161
+ success: 'fas fa-check-circle',
162
+ info: 'fas fa-info-circle',
163
+ warning: 'fas fa-exclamation',
164
+ error: 'fas fa-exclamation-triangle',
165
+ prev: 'fas fa-chevron-left',
166
+ next: 'fas fa-chevron-right',
167
+ checkboxOn: 'fas fa-check-square',
168
+ checkboxOff: 'far fa-square',
169
+ // note 'far'
170
+ checkboxIndeterminate: 'fas fa-minus-square',
171
+ delimiter: 'fas fa-circle',
172
+ // for carousel
173
+ sortAsc: 'fas fa-arrow-up',
174
+ sortDesc: 'fas fa-arrow-down',
175
+ expand: 'fas fa-chevron-down',
176
+ menu: 'fas fa-bars',
177
+ subgroup: 'fas fa-caret-down',
178
+ dropdown: 'fas fa-caret-down',
179
+ radioOn: 'far fa-dot-circle',
180
+ radioOff: 'far fa-circle',
181
+ edit: 'fas fa-edit',
182
+ ratingEmpty: 'far fa-star',
183
+ ratingFull: 'fas fa-star',
184
+ ratingHalf: 'fas fa-star-half',
185
+ loading: 'fas fa-sync',
186
+ first: 'fas fa-step-backward',
187
+ last: 'fas fa-step-forward',
188
+ unfold: 'fas fa-arrows-alt-v',
189
+ file: 'fas fa-paperclip',
190
+ plus: 'fas fa-plus',
191
+ minus: 'fas fa-minus',
192
+ calendar: 'fas fa-calendar',
193
+ treeviewCollapse: 'fas fa-caret-down',
194
+ treeviewExpand: 'fas fa-caret-right',
195
+ eyeDropper: 'fas fa-eye-dropper'
196
+ };
197
+ const fa = {
198
+ component: Vuetify.components.VClassIcon
199
+ };
200
+
201
+ const vueData = this.vueData(context);
202
+ console.log("Vue App Data:", vueData, this.document);
203
+
204
+ // Create and store the Vue application instance.
205
+ this.vueApp = createApp({
206
+ // Data available in the template.
207
+ data() {
208
+ return vueData;
209
+ },
210
+ // Components allowed by the application.
211
+ components: this.vueComponents,
212
+ // Method to update the template data on subsequent changes.
213
+ methods: {
214
+ updateContext(newContext) {
215
+ // Note that 'this' refers to this.vueApp, not the full AppV2 instance.
216
+ for (let key of Object.keys(this.context)) {
217
+ if (newContext[key]) {
218
+ this.context[key] = newContext[key];
219
+ }
220
+ }
221
+ }
222
+ },
223
+ watch: {
224
+ "context._renderKey": {
225
+ handler: function (newVal, oldVal) {
226
+ this.$nextTick(() => {
227
+ const changeEvent = new Event("change", { bubbles: true });
228
+ this.$el.dispatchEvent(changeEvent);
229
+ });
230
+ }
231
+ }
232
+ }
233
+ });
234
+ ${joinToNode(Object.keys(customComponents), c => expandToNode `this.vueApp.component("${c}", ${customComponents[c]});`, { appendNewLineIfNotEmpty: true })}
235
+ const vuetify = Vuetify.createVuetify({
236
+ icons: {
237
+ defaultSet: 'fa',
238
+ aliases,
239
+ sets: {
240
+ fa,
241
+ },
242
+ },
243
+ components: {
244
+ VNumberInput: Vuetify.components.VNumberInput
245
+ }
246
+ });
247
+ this.vueApp.use(vuetify);
248
+
249
+ // Expose global Foundry variables.
250
+ this.vueApp.config.globalProperties.game = game;
251
+ this.vueApp.config.globalProperties.CONFIG = CONFIG;
252
+ this.vueApp.config.globalProperties.foundry = foundry;
253
+
254
+ // Expose the document.
255
+ this.vueApp.provide("rawDocument", this.document);
256
+ this.vueApp.provide("rawSheet", this);
257
+
258
+ // Expose any extras
259
+ const providedData = this._getProvidedData();
260
+ for (let key of Object.keys(providedData)) {
261
+ this.vueApp.provide(key, providedData[key]);
262
+ }
263
+
264
+ // Mount and store the vue application.
265
+ this.vueRoot = this.vueApp.mount(target);
266
+
267
+ return element;
268
+ }
269
+
270
+ /**
271
+ * Handle updates for the Vue application instance.
272
+ *
273
+ * Normally, this would render the HTML for the content within the application.
274
+ * However, for Vue, all we want to do is update the 'context' property that's
275
+ * passed into the Vue application instance.
276
+ *
277
+ * Unlike _renderFrame(), this occurs on every update for the application.
278
+ *
279
+ * @param {ApplicationRenderContext} context
280
+ * @param {RenderOptions} options
281
+ * @returns {Promise<string>}
282
+ *
283
+ * @protected
284
+ * @override
285
+ */
286
+ async _renderHTML(context, options) {
287
+ // Force certain updates.
288
+ this._renderKey++;
289
+ context._renderKey = this._renderKey;
290
+ // Update the application root with new values.
291
+ this.vueRoot.updateContext(context);
292
+ // Return doesn't matter, Vue handles updates.
293
+
294
+ // If game.tooltip has an element, reactivate it
295
+ if (game.tooltip.element) {
296
+ const element = game.tooltip.element;
297
+ game.tooltip.deactivate();
298
+ game.tooltip.activate(element);
299
+ }
300
+ }
301
+
302
+ /** @override */
303
+ _replaceHTML(result, content, options) {
304
+ // Pass. We don't need this in Vue land! But Foundry itself does...
305
+ }
306
+
307
+ /**
308
+ * Closes the application and unmounts the vue application instance.
309
+ *
310
+ * @param {ApplicationClosingOptions} options
311
+ * @returns {Promise<BaseApplication>}
312
+ *
313
+ * @override
314
+ */
315
+ async close(options = {}) {
316
+ if (this.options.form.submitOnClose && this.isEditable) {
317
+ await this.submit();
318
+ }
319
+ // Unmount the vue instance.
320
+ if (this.vueApp) this.vueApp.unmount();
321
+ await super.close(options);
322
+ }
323
+
324
+ async _onFirstRender(context) {
325
+ super._onFirstRender(context);
326
+
327
+ // Replace the .application class with .vue-application
328
+ this.element.classList.remove("application");
329
+ this.element.classList.add("vue-application");
330
+ }
331
+ }
332
+
333
+ return VueApplication;
334
+ }
335
335
  `.appendNewLine();
336
336
  fs.writeFileSync(generatedFilePath, toString(fileNode));
337
337
  }