intelligent-system-design-language 0.3.13

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 (209) hide show
  1. package/.claude/agents/langium-language-designer.md +38 -0
  2. package/.claude/agents/typescript-vscode-expert.md +29 -0
  3. package/.claude/agents/ui-ux-designer.md +36 -0
  4. package/.claude/settings.local.json +33 -0
  5. package/.idea/inspectionProfiles/Project_Default.xml +7 -0
  6. package/.idea/isdl.iml +14 -0
  7. package/.idea/modules.xml +9 -0
  8. package/.idea/vcs.xml +7 -0
  9. package/.idea/watcherTasks.xml +4 -0
  10. package/.vscodeignore +18 -0
  11. package/LICENSE +674 -0
  12. package/README.md +86 -0
  13. package/bin/cli.js +4 -0
  14. package/bin/lsp.js +8 -0
  15. package/isdl.png +0 -0
  16. package/out/_backgrounds.scss +91 -0
  17. package/out/_handlebars.scss +505 -0
  18. package/out/_isdlStyles.scss +1357 -0
  19. package/out/_vuetifyOverrides.scss +425 -0
  20. package/out/_vuetifyStyles.scss +31957 -0
  21. package/out/cli/cli-util.js +39 -0
  22. package/out/cli/cli-util.js.map +1 -0
  23. package/out/cli/components/_backgrounds.scss +91 -0
  24. package/out/cli/components/_handlebars.scss +505 -0
  25. package/out/cli/components/_isdlStyles.scss +1357 -0
  26. package/out/cli/components/_vuetifyOverrides.scss +425 -0
  27. package/out/cli/components/_vuetifyStyles.scss +31957 -0
  28. package/out/cli/components/active-effect-sheet-generator.js +643 -0
  29. package/out/cli/components/active-effect-sheet-generator.js.map +1 -0
  30. package/out/cli/components/base-actor-sheet-generator.js +125 -0
  31. package/out/cli/components/base-actor-sheet-generator.js.map +1 -0
  32. package/out/cli/components/base-sheet-generator.js +525 -0
  33. package/out/cli/components/base-sheet-generator.js.map +1 -0
  34. package/out/cli/components/chat-card-generator.js +683 -0
  35. package/out/cli/components/chat-card-generator.js.map +1 -0
  36. package/out/cli/components/css-generator.js +58 -0
  37. package/out/cli/components/css-generator.js.map +1 -0
  38. package/out/cli/components/damage-roll-generator.js +173 -0
  39. package/out/cli/components/damage-roll-generator.js.map +1 -0
  40. package/out/cli/components/datamodel-generator.js +672 -0
  41. package/out/cli/components/datamodel-generator.js.map +1 -0
  42. package/out/cli/components/derived-data-generator.js +1340 -0
  43. package/out/cli/components/derived-data-generator.js.map +1 -0
  44. package/out/cli/components/hotbar-drop-hook-generator.js +95 -0
  45. package/out/cli/components/hotbar-drop-hook-generator.js.map +1 -0
  46. package/out/cli/components/init-hook-generator.js +597 -0
  47. package/out/cli/components/init-hook-generator.js.map +1 -0
  48. package/out/cli/components/keywords-generator.js +220 -0
  49. package/out/cli/components/keywords-generator.js.map +1 -0
  50. package/out/cli/components/language-generator.js +110 -0
  51. package/out/cli/components/language-generator.js.map +1 -0
  52. package/out/cli/components/measured-template-preview.js +234 -0
  53. package/out/cli/components/measured-template-preview.js.map +1 -0
  54. package/out/cli/components/method-generator.js +1812 -0
  55. package/out/cli/components/method-generator.js.map +1 -0
  56. package/out/cli/components/ready-hook-generator.js +448 -0
  57. package/out/cli/components/ready-hook-generator.js.map +1 -0
  58. package/out/cli/components/token-generator.js +138 -0
  59. package/out/cli/components/token-generator.js.map +1 -0
  60. package/out/cli/components/utils.js +176 -0
  61. package/out/cli/components/utils.js.map +1 -0
  62. package/out/cli/components/vue/base-components/vue-attribute.js +148 -0
  63. package/out/cli/components/vue/base-components/vue-attribute.js.map +1 -0
  64. package/out/cli/components/vue/base-components/vue-boolean.js +77 -0
  65. package/out/cli/components/vue/base-components/vue-boolean.js.map +1 -0
  66. package/out/cli/components/vue/base-components/vue-calculator.js +106 -0
  67. package/out/cli/components/vue/base-components/vue-calculator.js.map +1 -0
  68. package/out/cli/components/vue/base-components/vue-damage-application.js +369 -0
  69. package/out/cli/components/vue/base-components/vue-damage-application.js.map +1 -0
  70. package/out/cli/components/vue/base-components/vue-damage-bonuses.js +225 -0
  71. package/out/cli/components/vue/base-components/vue-damage-bonuses.js.map +1 -0
  72. package/out/cli/components/vue/base-components/vue-damage-resistances.js +256 -0
  73. package/out/cli/components/vue/base-components/vue-damage-resistances.js.map +1 -0
  74. package/out/cli/components/vue/base-components/vue-damage-track.js +134 -0
  75. package/out/cli/components/vue/base-components/vue-damage-track.js.map +1 -0
  76. package/out/cli/components/vue/base-components/vue-date-time.js +55 -0
  77. package/out/cli/components/vue/base-components/vue-date-time.js.map +1 -0
  78. package/out/cli/components/vue/base-components/vue-dice.js +111 -0
  79. package/out/cli/components/vue/base-components/vue-dice.js.map +1 -0
  80. package/out/cli/components/vue/base-components/vue-die.js +86 -0
  81. package/out/cli/components/vue/base-components/vue-die.js.map +1 -0
  82. package/out/cli/components/vue/base-components/vue-document-choice.js +172 -0
  83. package/out/cli/components/vue/base-components/vue-document-choice.js.map +1 -0
  84. package/out/cli/components/vue/base-components/vue-document-choices.js +203 -0
  85. package/out/cli/components/vue/base-components/vue-document-choices.js.map +1 -0
  86. package/out/cli/components/vue/base-components/vue-document-link.js +73 -0
  87. package/out/cli/components/vue/base-components/vue-document-link.js.map +1 -0
  88. package/out/cli/components/vue/base-components/vue-extended-choice.js +101 -0
  89. package/out/cli/components/vue/base-components/vue-extended-choice.js.map +1 -0
  90. package/out/cli/components/vue/base-components/vue-inventory.js +532 -0
  91. package/out/cli/components/vue/base-components/vue-inventory.js.map +1 -0
  92. package/out/cli/components/vue/base-components/vue-macro-choice.js +150 -0
  93. package/out/cli/components/vue/base-components/vue-macro-choice.js.map +1 -0
  94. package/out/cli/components/vue/base-components/vue-measured-template.js +543 -0
  95. package/out/cli/components/vue/base-components/vue-measured-template.js.map +1 -0
  96. package/out/cli/components/vue/base-components/vue-money.js +496 -0
  97. package/out/cli/components/vue/base-components/vue-money.js.map +1 -0
  98. package/out/cli/components/vue/base-components/vue-number.js +184 -0
  99. package/out/cli/components/vue/base-components/vue-number.js.map +1 -0
  100. package/out/cli/components/vue/base-components/vue-paperdoll.js +56 -0
  101. package/out/cli/components/vue/base-components/vue-paperdoll.js.map +1 -0
  102. package/out/cli/components/vue/base-components/vue-parent-property-reference.js +89 -0
  103. package/out/cli/components/vue/base-components/vue-parent-property-reference.js.map +1 -0
  104. package/out/cli/components/vue/base-components/vue-prosemirror.js +31 -0
  105. package/out/cli/components/vue/base-components/vue-prosemirror.js.map +1 -0
  106. package/out/cli/components/vue/base-components/vue-resource.js +149 -0
  107. package/out/cli/components/vue/base-components/vue-resource.js.map +1 -0
  108. package/out/cli/components/vue/base-components/vue-roll-visualizer.js +121 -0
  109. package/out/cli/components/vue/base-components/vue-roll-visualizer.js.map +1 -0
  110. package/out/cli/components/vue/base-components/vue-self-property-reference.js +75 -0
  111. package/out/cli/components/vue/base-components/vue-self-property-reference.js.map +1 -0
  112. package/out/cli/components/vue/base-components/vue-string-choice.js +111 -0
  113. package/out/cli/components/vue/base-components/vue-string-choice.js.map +1 -0
  114. package/out/cli/components/vue/base-components/vue-string-choices.js +216 -0
  115. package/out/cli/components/vue/base-components/vue-string-choices.js.map +1 -0
  116. package/out/cli/components/vue/base-components/vue-string.js +73 -0
  117. package/out/cli/components/vue/base-components/vue-string.js.map +1 -0
  118. package/out/cli/components/vue/base-components/vue-text-field.js +66 -0
  119. package/out/cli/components/vue/base-components/vue-text-field.js.map +1 -0
  120. package/out/cli/components/vue/base-components/vue-tracker.js +444 -0
  121. package/out/cli/components/vue/base-components/vue-tracker.js.map +1 -0
  122. package/out/cli/components/vue/vue-action-component-generator.js +88 -0
  123. package/out/cli/components/vue/vue-action-component-generator.js.map +1 -0
  124. package/out/cli/components/vue/vue-active-effect-sheet-generator.js +1016 -0
  125. package/out/cli/components/vue/vue-active-effect-sheet-generator.js.map +1 -0
  126. package/out/cli/components/vue/vue-base-components-generator.js +59 -0
  127. package/out/cli/components/vue/vue-base-components-generator.js.map +1 -0
  128. package/out/cli/components/vue/vue-datatable-component-generator.js +307 -0
  129. package/out/cli/components/vue/vue-datatable-component-generator.js.map +1 -0
  130. package/out/cli/components/vue/vue-datatable-sheet-class-generator.js +342 -0
  131. package/out/cli/components/vue/vue-datatable-sheet-class-generator.js.map +1 -0
  132. package/out/cli/components/vue/vue-datatable2-component-generator.js +939 -0
  133. package/out/cli/components/vue/vue-datatable2-component-generator.js.map +1 -0
  134. package/out/cli/components/vue/vue-document-creation-app.js +140 -0
  135. package/out/cli/components/vue/vue-document-creation-app.js.map +1 -0
  136. package/out/cli/components/vue/vue-document-creation-sheet.js +105 -0
  137. package/out/cli/components/vue/vue-document-creation-sheet.js.map +1 -0
  138. package/out/cli/components/vue/vue-generator.js +240 -0
  139. package/out/cli/components/vue/vue-generator.js.map +1 -0
  140. package/out/cli/components/vue/vue-mixin.js +338 -0
  141. package/out/cli/components/vue/vue-mixin.js.map +1 -0
  142. package/out/cli/components/vue/vue-pinned-datatable-component-generator.js +306 -0
  143. package/out/cli/components/vue/vue-pinned-datatable-component-generator.js.map +1 -0
  144. package/out/cli/components/vue/vue-prompt-generator.js +201 -0
  145. package/out/cli/components/vue/vue-prompt-generator.js.map +1 -0
  146. package/out/cli/components/vue/vue-prompt-sheet-class-generator.js +252 -0
  147. package/out/cli/components/vue/vue-prompt-sheet-class-generator.js.map +1 -0
  148. package/out/cli/components/vue/vue-sheet-application-generator.js +2008 -0
  149. package/out/cli/components/vue/vue-sheet-application-generator.js.map +1 -0
  150. package/out/cli/components/vue/vue-sheet-class-generator.js +484 -0
  151. package/out/cli/components/vue/vue-sheet-class-generator.js.map +1 -0
  152. package/out/cli/generator.js +659 -0
  153. package/out/cli/generator.js.map +1 -0
  154. package/out/cli/main.js +43 -0
  155. package/out/cli/main.js.map +1 -0
  156. package/out/datatables.min.css +54 -0
  157. package/out/datatables.min.js +178 -0
  158. package/out/extension/github/githubAuthProvider.js +345 -0
  159. package/out/extension/github/githubAuthProvider.js.map +1 -0
  160. package/out/extension/github/githubConfig.js +132 -0
  161. package/out/extension/github/githubConfig.js.map +1 -0
  162. package/out/extension/github/githubGistActions.js +251 -0
  163. package/out/extension/github/githubGistActions.js.map +1 -0
  164. package/out/extension/github/githubGistManager.js +255 -0
  165. package/out/extension/github/githubGistManager.js.map +1 -0
  166. package/out/extension/github/githubManager.js +1735 -0
  167. package/out/extension/github/githubManager.js.map +1 -0
  168. package/out/extension/github/githubQuickActions.js +659 -0
  169. package/out/extension/github/githubQuickActions.js.map +1 -0
  170. package/out/extension/github/githubTreeProvider.js +181 -0
  171. package/out/extension/github/githubTreeProvider.js.map +1 -0
  172. package/out/extension/github/system-workflow.yml +48 -0
  173. package/out/extension/main.cjs +70315 -0
  174. package/out/extension/main.cjs.map +7 -0
  175. package/out/extension/main.js +237 -0
  176. package/out/extension/main.js.map +1 -0
  177. package/out/extension/package.json +426 -0
  178. package/out/isdl.png +0 -0
  179. package/out/language/generated/ast.js +2992 -0
  180. package/out/language/generated/ast.js.map +1 -0
  181. package/out/language/generated/grammar.js +13970 -0
  182. package/out/language/generated/grammar.js.map +1 -0
  183. package/out/language/generated/module.js +20 -0
  184. package/out/language/generated/module.js.map +1 -0
  185. package/out/language/intelligent-system-design-language-formatter.js +85 -0
  186. package/out/language/intelligent-system-design-language-formatter.js.map +1 -0
  187. package/out/language/intelligent-system-design-language-module.js +69 -0
  188. package/out/language/intelligent-system-design-language-module.js.map +1 -0
  189. package/out/language/intelligent-system-design-language-quickfixes.js +37 -0
  190. package/out/language/intelligent-system-design-language-quickfixes.js.map +1 -0
  191. package/out/language/intelligent-system-design-language-validator.js +515 -0
  192. package/out/language/intelligent-system-design-language-validator.js.map +1 -0
  193. package/out/language/isdl-hover-provider.js +77 -0
  194. package/out/language/isdl-hover-provider.js.map +1 -0
  195. package/out/language/isdl-scope-provider.js +149 -0
  196. package/out/language/isdl-scope-provider.js.map +1 -0
  197. package/out/language/main.cjs +47655 -0
  198. package/out/language/main.cjs.map +7 -0
  199. package/out/language/main.js +11 -0
  200. package/out/language/main.js.map +1 -0
  201. package/out/missing-character.png +0 -0
  202. package/out/package.json +426 -0
  203. package/out/paperdoll_default.png +0 -0
  204. package/out/progressbar.min.js +7 -0
  205. package/out/styles.scss +722 -0
  206. package/out/test/formatting/formatter.test.js +46 -0
  207. package/out/test/formatting/formatter.test.js.map +1 -0
  208. package/out/vuetify.esm.js +30279 -0
  209. package/package.json +426 -0
@@ -0,0 +1,201 @@
1
+ import * as path from 'node:path';
2
+ import * as fs from 'node:fs';
3
+ import { expandToNode, joinToNode, toString } from 'langium/generate';
4
+ import { isAction, isActor, isAttributeExp, isAttributeParamMod, isBooleanExp, isDateExp, isDateTimeExp, isDocumentChoiceExp, isHookHandler, isHtmlExp, isImageParam, isNumberExp, isNumberParamMin, isNumberParamValue, isPaperDollExp, isParentPropertyRefChoiceParam, isParentPropertyRefExp, isProperty, isResourceExp, isSingleDocumentExp, isSizeParam, isStringExp, isStringParamValue, isTimeExp, isVariableExpression } from "../../../language/generated/ast.js";
5
+ import { getDocument, getSystemPath, globalGetAllOfType } from '../utils.js';
6
+ import { AstUtils } from 'langium';
7
+ export function generatePromptApp(name, entry, id, document, prompt, destination) {
8
+ const type = isActor(document) ? 'actor' : 'item';
9
+ const generatedFileDir = path.join(destination, "system", "templates", "vue", type, document.name.toLowerCase(), "components", "prompts");
10
+ const generatedFilePath = path.join(generatedFileDir, `${document.name.toLowerCase()}${name}Prompt.vue`);
11
+ if (!fs.existsSync(generatedFileDir)) {
12
+ fs.mkdirSync(generatedFileDir, { recursive: true });
13
+ }
14
+ const fileNode = expandToNode `
15
+ <script setup>
16
+ import { ref, inject, computed } from "vue";
17
+
18
+ const props = defineProps({
19
+ context: Object,
20
+ primaryColor: String,
21
+ secondaryColor: String,
22
+ });
23
+
24
+ const editMode = true;
25
+ </script>
26
+ <template>
27
+ <v-app>
28
+ <v-main class="d-flex">
29
+ <v-container class="topography" fluid style="padding: 1rem; height: 100%;">
30
+ ${joinToNode(prompt.body, element => generateElement(element), { appendNewLineIfNotEmpty: true })}
31
+ <v-row class="flexrow">
32
+ <v-btn @click="console.log('Clicked ${name}')" color="primary" class="ma-1 action-btn">Submit</v-btn>
33
+ <v-btn @click="console.log('Clicked ${name}')" color="error" class="ma-1 action-btn">Cancel</v-btn>
34
+ </v-row>
35
+ </v-container>
36
+ </v-main>
37
+ </v-app>
38
+ </template>
39
+ `;
40
+ fs.writeFileSync(generatedFilePath, toString(fileNode));
41
+ function generateElement(element) {
42
+ var _a, _b, _c, _d;
43
+ if (isProperty(element)) {
44
+ if (isHookHandler(element))
45
+ return expandToNode ``;
46
+ if (element.modifier == "hidden")
47
+ return expandToNode ``;
48
+ if (element.name == "RollVisualizer") {
49
+ return expandToNode `
50
+ <i-roll-visualizer :context="context"></i-roll-visualizer>
51
+ `;
52
+ }
53
+ let disabled = element.modifier == "readonly" || element.modifier == "locked"; // TODO: Edit mode
54
+ if (element.modifier == "unlocked")
55
+ disabled = false;
56
+ const variable = AstUtils.getContainerOfType(prompt.$container, isVariableExpression);
57
+ const action = AstUtils.getContainerOfType(prompt.$container, isAction);
58
+ const label = `${document.name}.${element.name}`;
59
+ const labelFragment = `:label="game.i18n.localize('${label}')"`;
60
+ const systemPath = `system.${action === null || action === void 0 ? void 0 : action.name.toLowerCase()}${variable === null || variable === void 0 ? void 0 : variable.name.toLowerCase()}.${element.name.toLowerCase()}`;
61
+ if (isParentPropertyRefExp(element)) {
62
+ let allChoices = [];
63
+ const choicesParam = element.params.find(p => isParentPropertyRefChoiceParam(p));
64
+ switch (element.propertyType) {
65
+ case "attribute":
66
+ allChoices = globalGetAllOfType(entry, isAttributeExp);
67
+ break;
68
+ case "resource":
69
+ allChoices = globalGetAllOfType(entry, isResourceExp);
70
+ break;
71
+ case "number":
72
+ allChoices = globalGetAllOfType(entry, isNumberExp);
73
+ break;
74
+ default:
75
+ console.error("Unsupported parent property type: " + element.propertyType);
76
+ break;
77
+ }
78
+ let refChoices = allChoices.map(x => {
79
+ let parentDocument = getDocument(x);
80
+ if (choicesParam && choicesParam.choices.length > 0) {
81
+ if (!choicesParam.choices.find(y => {
82
+ var _a, _b;
83
+ 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());
84
+ if (y.property != undefined) {
85
+ const propertyNameMatches = ((_b = y.property.ref) === null || _b === void 0 ? void 0 : _b.name.toLowerCase()) == x.name.toLowerCase();
86
+ return documentNameMatches && propertyNameMatches;
87
+ }
88
+ // Just check document name
89
+ return documentNameMatches;
90
+ })) {
91
+ return undefined;
92
+ }
93
+ }
94
+ return {
95
+ path: `system.${x.name.toLowerCase()}`,
96
+ parent: parentDocument === null || parentDocument === void 0 ? void 0 : parentDocument.name,
97
+ name: x.name
98
+ };
99
+ });
100
+ refChoices = refChoices.filter(x => x != undefined);
101
+ 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(", ");
102
+ return expandToNode `
103
+ <v-select name="${systemPath}" v-model="context.${systemPath}" :items="[${choices}]" item-title="label" item-value="value" ${labelFragment} :disabled="!editMode || ${disabled}" variant="outlined" density="compact"></v-select>
104
+ `;
105
+ }
106
+ if (isStringExp(element)) {
107
+ const valueParam = element.params.find(p => isStringParamValue(p));
108
+ if (valueParam !== undefined) {
109
+ return expandToNode `
110
+ <v-text-field name="${systemPath}" v-model="context.${systemPath}" ${labelFragment} :disabled="true" variant="outlined" density="compact" append-inner-icon="fa-solid fa-function" :data-tooltip="context.${systemPath}"></v-text-field>
111
+ `;
112
+ }
113
+ return expandToNode `
114
+ <i-text-field label="${label}" systemPath="${systemPath}" :context="context" :editMode="editMode" :primaryColor="primaryColor" :secondaryColor="secondaryColor"></i-text-field>
115
+ `;
116
+ }
117
+ if (isDocumentChoiceExp(element)) {
118
+ const componentName = `${document.name.toLowerCase()}${element.name}DocumentChoice`;
119
+ return expandToNode `
120
+ <${componentName} :context="context" :editMode="editMode" :primaryColor="primaryColor" :secondaryColor="secondaryColor"></${componentName}>
121
+ `;
122
+ }
123
+ if (isHtmlExp(element)) {
124
+ return expandToNode `
125
+ <i-prosemirror ${labelFragment} :field="context.editors['${systemPath}']" :disabled="!editMode"></i-prosemirror>
126
+ `;
127
+ }
128
+ if (isBooleanExp(element)) {
129
+ return expandToNode `
130
+ <v-checkbox v-model="context.${systemPath}" name="${systemPath}" ${labelFragment} :disabled="!editMode || ${disabled}" :color="primaryColor"></v-checkbox>
131
+ `;
132
+ }
133
+ if (isNumberExp(element)) {
134
+ // If this is a calculated value, we don't want to allow editing
135
+ const valueParam = element.params.find(x => isNumberParamValue(x));
136
+ if (valueParam != undefined) {
137
+ disabled = true;
138
+ }
139
+ return expandToNode `
140
+ <v-number-input
141
+ controlVariant="stacked"
142
+ density="compact"
143
+ variant="outlined"
144
+ v-model="context.${systemPath}"
145
+ ${valueParam != undefined ? ` append-inner-icon="fa-solid fa-function" control-variant="hidden" class="calculated-number"` : ``}
146
+ name="${systemPath}"
147
+ ${labelFragment}
148
+ :disabled="!editMode || ${disabled}"
149
+ >
150
+ ${valueParam == undefined ? `
151
+ <template #append-inner>
152
+ <i-calculator v-if="editMode" :context="context" :systemPath="'${systemPath}'" :primaryColor="primaryColor" :secondaryColor="secondaryColor"></i-calculator>
153
+ </template>
154
+ ` : ``}
155
+ </v-number-input>
156
+ `;
157
+ }
158
+ if (isAttributeExp(element)) {
159
+ const minParam = element.params.find(x => isNumberParamMin(x));
160
+ const min = (_a = minParam === null || minParam === void 0 ? void 0 : minParam.value) !== null && _a !== void 0 ? _a : 0;
161
+ const hasMod = element.params.find(x => isAttributeParamMod(x)) != undefined;
162
+ const modSystemPath = getSystemPath(element, ["mod"], undefined, false);
163
+ const valueSystemPath = getSystemPath(element, ["value"], undefined, false);
164
+ return expandToNode `
165
+ <i-attribute label="${label}" :hasMod="${hasMod}" :mod="context.${modSystemPath}" systemPath="${valueSystemPath}" :context="context" :min="${min}" :disabled="!editMode || ${disabled}" :primaryColor="primaryColor" :secondaryColor="secondaryColor"></i-attribute>
166
+ `;
167
+ }
168
+ if (isResourceExp(element)) {
169
+ return expandToNode `
170
+ <i-resource label="${label}" systemPath="system.${element.name.toLowerCase()}" :context="context" :disabled="!editMode || ${disabled}" :primaryColor="primaryColor" :secondaryColor="secondaryColor"></i-resource>
171
+ `;
172
+ }
173
+ if (isSingleDocumentExp(element)) {
174
+ return expandToNode `
175
+ <i-document-link label="${label}" systemPath="system.${element.name.toLowerCase()}" documentName="${(_b = element.document.ref) === null || _b === void 0 ? void 0 : _b.name.toLowerCase()}" :context="context" :disabled="!editMode || ${disabled}" :secondaryColor="secondaryColor"></i-document-link>
176
+ `;
177
+ }
178
+ if (isDateExp(element) || isTimeExp(element) || isDateTimeExp(element)) {
179
+ return expandToNode `
180
+ <p>${label} - TODO</p>
181
+ `;
182
+ }
183
+ if (isPaperDollExp(element)) {
184
+ let sizeParam = element.params.find(x => isSizeParam(x));
185
+ let size = (_c = sizeParam === null || sizeParam === void 0 ? void 0 : sizeParam.value) !== null && _c !== void 0 ? _c : "40px";
186
+ let imageParam = element.params.find(x => isImageParam(x));
187
+ let image = (_d = imageParam === null || imageParam === void 0 ? void 0 : imageParam.value) !== null && _d !== void 0 ? _d : `systems/${id}/img/paperdoll_default.png`;
188
+ return expandToNode `
189
+ <i-paperdoll label="${label}" systemPath="system.${element.name.toLowerCase()}" :context="context" :disabled="!editMode || ${disabled}" image="${image}" size="${size}" :slots="${element.name.toLowerCase()}Slots"></i-paperdoll>
190
+ `;
191
+ }
192
+ return expandToNode `
193
+ <v-alert text="Unknown Property ${element.name}" type="warning" density="compact" class="ga-2 ma-1" variant="outlined"></v-alert>
194
+ `;
195
+ }
196
+ return expandToNode `
197
+ <v-alert text="Unknown Element" type="warning" density="compact" class="ga-2 ma-1" variant="outlined"></v-alert>
198
+ `;
199
+ }
200
+ }
201
+ //# sourceMappingURL=vue-prompt-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue-prompt-generator.js","sourceRoot":"","sources":["../../../../src/cli/components/vue/vue-prompt-generator.ts"],"names":[],"mappings":"AAAA,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SAAS,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE;gBACpE,OAAO,YAAY,CAAA;iBACd,KAAK;aACT,CAAC;aACL;YAED,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;gBACzB,IAAI,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAc,CAAC;gBACtE,IAAI,IAAI,GAAG,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,mCAAI,MAAM,CAAC;gBAEtC,IAAI,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAe,CAAC;gBACzE,IAAI,KAAK,GAAG,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,mCAAI,WAAW,EAAE,4BAA4B,CAAC;gBAE3E,OAAO,YAAY,CAAA;kCACG,KAAK,wBAAwB,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,gDAAgD,QAAQ,YAAY,KAAK,WAAW,IAAI,aAAa,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;aAC3M,CAAC;aACL;YAED,OAAO,YAAY,CAAA;0CACe,OAAO,CAAC,IAAI;SAC7C,CAAC;SACL;QAED,OAAO,YAAY,CAAA;;KAElB,CAAC;IACF,CAAC;AACL,CAAC"}
@@ -0,0 +1,252 @@
1
+ import * as path from 'node:path';
2
+ import * as fs from 'node:fs';
3
+ import { expandToNode, toString } from 'langium/generate';
4
+ import { isActor } from '../../../language/generated/ast.js';
5
+ import { titleize } from 'inflection';
6
+ export function generatePromptSheetClass(name, entry, id, document, prompt, destination) {
7
+ const type = isActor(document) ? 'actor' : 'item';
8
+ const generatedFileDir = path.join(destination, "system", "sheets", "vue", type, "prompts");
9
+ const generatedFilePath = path.join(generatedFileDir, `${document.name.toLowerCase()}-${name}-prompt-app.mjs`);
10
+ if (!fs.existsSync(generatedFileDir)) {
11
+ fs.mkdirSync(generatedFileDir, { recursive: true });
12
+ }
13
+ const vueComponentName = `${document.name.toLowerCase()}-${type}-${name.toLowerCase()}-prompt`;
14
+ const fileNode = expandToNode `
15
+ import VueRenderingMixin from '../../VueRenderingMixin.mjs';
16
+ import { ${document.name}${titleize(type)}${name}Prompt } from "../../components/components.vue.es.mjs";
17
+
18
+ export default class ${document.name}${name}PromptApp extends VueRenderingMixin(foundry.applications.api.ApplicationV2) {
19
+
20
+ document;
21
+ constructor(document, options = {}) {
22
+ super(options);
23
+ this.#dragDrop = this.#createDragDropHandlers();
24
+ this.document = document;
25
+ }
26
+
27
+ vueParts = {
28
+ "${vueComponentName}": {
29
+ component: ${document.name}${titleize(type)}${name}Prompt,
30
+ template: "<${vueComponentName} :context=\\"context\\">Vue rendering for application failed.</${vueComponentName}>"
31
+ }
32
+ };
33
+
34
+ _arrayEntryKey = 0;
35
+ _renderKey = 0;
36
+
37
+ /** @override */
38
+ static DEFAULT_OPTIONS = {
39
+ classes: ["${id}", "dialog", "vue-sheet", "isdl-prompt", "${type}", "${document.name.toLowerCase()}-prompt"],
40
+ position: {
41
+ width: 400,
42
+ height: 600,
43
+ },
44
+ window: {
45
+ resizable: true,
46
+ title: "${name} Prompt",
47
+ },
48
+ tag: "form",
49
+ actions: {
50
+ },
51
+ changeActions: {
52
+ },
53
+ // Custom property that's merged into this.options
54
+ dragDrop: [
55
+ {dropSelector: ".single-document"},
56
+ {dragSelector: ".paper-doll-slot", dropSelector: ".paper-doll-slot"}
57
+ ],
58
+ form: {
59
+ submitOnChange: false,
60
+ submitOnClose: true,
61
+ closeOnSubmit: true,
62
+ }
63
+ };
64
+
65
+ async _prepareContext(options) {
66
+ // Output initialization
67
+ const context = {
68
+ // Validates both permissions and compendium status
69
+ editable: true,
70
+ owner: this.document.isOwner,
71
+ limited: this.document.limited,
72
+
73
+ // Add the document.
74
+ object: this.document.toObject(),
75
+ document: this.document,
76
+
77
+ // Add the data to context.data for easier access, as well as flags.
78
+ system: this.document.system,
79
+ flags: this.document.flags,
80
+
81
+ // Roll data.
82
+ rollData: this.document.getRollData() ?? {},
83
+
84
+ // Editors
85
+ editors: {},
86
+
87
+ // Force re-renders. Defined in the vue mixin.
88
+ _renderKey: this._renderKey ?? 0,
89
+ _arrayEntryKey: this._arrayEntryKey ?? 0,
90
+
91
+ // Necessary for formInput and formFields helpers
92
+ fields: this.document.schema.fields,
93
+ systemFields: this.document.system.schema.fields
94
+ };
95
+
96
+ return context;
97
+ }
98
+
99
+ /**
100
+ * Actions performed after any render of the Application.
101
+ * Post-render steps are not awaited by the render process.
102
+ * @param {ApplicationRenderContext} context Prepared context data
103
+ * @param {RenderOptions} options Provided render options
104
+ * @protected
105
+ */
106
+ _onRender(context, options) {
107
+ this.#dragDrop.forEach((d) => d.bind(this.element));
108
+ // You may want to add other special handling here
109
+ // Foundry comes with a large number of utility classes, e.g. SearchFilter
110
+ // That you may want to implement yourself.
111
+ }
112
+
113
+
114
+ // Drag and Drop
115
+
116
+ /**
117
+ * Returns an array of DragDrop instances
118
+ * @type {DragDrop[]}
119
+ */
120
+ get dragDrop() {
121
+ return this.#dragDrop;
122
+ }
123
+
124
+ /**
125
+ * Define whether a user is able to begin a dragstart workflow for a given drag selector
126
+ * @param {string} selector The candidate HTML selector for dragging
127
+ * @returns {boolean} Can the current user drag this selector?
128
+ * @protected
129
+ */
130
+ _canDragStart(selector) {
131
+ return this.isEditable;
132
+ }
133
+
134
+ /**
135
+ * Define whether a user is able to conclude a drag-and-drop workflow for a given drop selector
136
+ * @param {string} selector The candidate HTML selector for the drop target
137
+ * @returns {boolean} Can the current user drop on this selector?
138
+ * @protected
139
+ */
140
+ _canDragDrop(selector) {
141
+ return this.isEditable;
142
+ }
143
+
144
+ /**
145
+ * Callback actions which occur at the beginning of a drag start workflow.
146
+ * @param {DragEvent} event The originating DragEvent
147
+ * @protected
148
+ */
149
+ _onDragStart(event) {
150
+ console.log("Drag Start");
151
+
152
+ if (event.currentTarget.classList.contains("paper-doll-slot")) {
153
+ // Remove the item from the slot
154
+ const name = event.currentTarget.dataset.name;
155
+ const update = {};
156
+ update[name] = null;
157
+ this.document.update(update);
158
+ }
159
+ else {
160
+ const tr = event.currentTarget.closest("tr");
161
+ const data = {
162
+ type: tr.dataset.type == "ActiveEffect" ? "ActiveEffect" : "Item",
163
+ uuid: tr.dataset.uuid
164
+ };
165
+
166
+ event.dataTransfer.setData("text/plain", JSON.stringify(data));
167
+ }
168
+ }
169
+
170
+ /**
171
+ * Callback actions which occur when a dragged element is over a drop target.
172
+ * @param {DragEvent} event The originating DragEvent
173
+ * @protected
174
+ */
175
+ _onDragOver(event) {}
176
+
177
+ /* -------------------------------------------- */
178
+
179
+ async _onDrop(event) {
180
+ const data = JSON.parse(event.dataTransfer.getData("text/plain"));
181
+
182
+ // If the drop target is a single document, handle it differently
183
+ const linkedClasses = [ "single-document", "paper-doll-slot" ];
184
+ const eventClasses = Array.from(event.currentTarget.classList);
185
+ if (eventClasses.find(c => linkedClasses.includes(c))) {
186
+ const doc = await fromUuid(data.uuid);
187
+ if ( !doc ) return;
188
+ if ( doc.type !== event.currentTarget.dataset.type ) {
189
+ ui.notifications.error(\`Expected a \${event.currentTarget.dataset.type} type Document, but got a \${doc.type} type one instead. \`);
190
+ return;
191
+ }
192
+
193
+ const update = {};
194
+ update[event.currentTarget.dataset.name] = data.uuid;
195
+ await this.document.update(update);
196
+ return;
197
+ }
198
+
199
+ const dropTypes = ["Item", "ActiveEffect"];
200
+ if ( !dropTypes.includes(data.type) ) return;
201
+ const item = await fromUuid(data.uuid);
202
+ if ( !item ) return;
203
+
204
+ // Prevent duplicates when dropping an item that's already owned by this document
205
+ if ( item.parent?.uuid === this.document.uuid ) return;
206
+
207
+ if ( data.type === "ActiveEffect" ) {
208
+ ActiveEffect.createDocuments([item], {parent: this.document})
209
+ return;
210
+ }
211
+
212
+ Item.createDocuments([item], {parent: this.document})
213
+ }
214
+
215
+ /* -------------------------------------------- */
216
+
217
+ /**
218
+ * Returns an array of DragDrop instances
219
+ * @type {DragDrop[]}
220
+ */
221
+ get dragDrop() {
222
+ return this.#dragDrop;
223
+ }
224
+
225
+ // This is marked as private because there's no real need
226
+ // for subclasses or external hooks to mess with it directly
227
+ #dragDrop;
228
+
229
+ /**
230
+ * Create drag-and-drop workflow handlers for this Application
231
+ * @returns {DragDrop[]} An array of DragDrop handlers
232
+ * @private
233
+ */
234
+ #createDragDropHandlers() {
235
+ return this.options.dragDrop.map((d) => {
236
+ d.permissions = {
237
+ dragstart: this._canDragStart.bind(this),
238
+ drop: this._canDragDrop.bind(this)
239
+ };
240
+ d.callbacks = {
241
+ dragstart: this._onDragStart.bind(this),
242
+ dragover: this._onDragOver.bind(this),
243
+ drop: this._onDrop.bind(this)
244
+ };
245
+ return new DragDrop(d);
246
+ });
247
+ }
248
+ }
249
+ `;
250
+ fs.writeFileSync(generatedFilePath, toString(fileNode));
251
+ }
252
+ //# sourceMappingURL=vue-prompt-sheet-class-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue-prompt-sheet-class-generator.js","sourceRoot":"","sources":["../../../../src/cli/components/vue/vue-prompt-sheet-class-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAmB,OAAO,EAAU,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,UAAU,wBAAwB,CAAC,IAAY,EAAE,KAAY,EAAE,EAAU,EAAG,QAAkB,EAAE,MAAc,EAAE,WAAmB;IACrI,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;I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