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.
- package/.claude/agents/langium-language-designer.md +38 -0
- package/.claude/agents/typescript-vscode-expert.md +29 -0
- package/.claude/agents/ui-ux-designer.md +36 -0
- package/.claude/settings.local.json +33 -0
- package/.idea/inspectionProfiles/Project_Default.xml +7 -0
- package/.idea/isdl.iml +14 -0
- package/.idea/modules.xml +9 -0
- package/.idea/vcs.xml +7 -0
- package/.idea/watcherTasks.xml +4 -0
- package/.vscodeignore +18 -0
- package/LICENSE +674 -0
- package/README.md +86 -0
- package/bin/cli.js +4 -0
- package/bin/lsp.js +8 -0
- package/isdl.png +0 -0
- package/out/_backgrounds.scss +91 -0
- package/out/_handlebars.scss +505 -0
- package/out/_isdlStyles.scss +1357 -0
- package/out/_vuetifyOverrides.scss +425 -0
- package/out/_vuetifyStyles.scss +31957 -0
- package/out/cli/cli-util.js +39 -0
- package/out/cli/cli-util.js.map +1 -0
- package/out/cli/components/_backgrounds.scss +91 -0
- package/out/cli/components/_handlebars.scss +505 -0
- package/out/cli/components/_isdlStyles.scss +1357 -0
- package/out/cli/components/_vuetifyOverrides.scss +425 -0
- package/out/cli/components/_vuetifyStyles.scss +31957 -0
- package/out/cli/components/active-effect-sheet-generator.js +643 -0
- package/out/cli/components/active-effect-sheet-generator.js.map +1 -0
- package/out/cli/components/base-actor-sheet-generator.js +125 -0
- package/out/cli/components/base-actor-sheet-generator.js.map +1 -0
- package/out/cli/components/base-sheet-generator.js +525 -0
- package/out/cli/components/base-sheet-generator.js.map +1 -0
- package/out/cli/components/chat-card-generator.js +683 -0
- package/out/cli/components/chat-card-generator.js.map +1 -0
- package/out/cli/components/css-generator.js +58 -0
- package/out/cli/components/css-generator.js.map +1 -0
- package/out/cli/components/damage-roll-generator.js +173 -0
- package/out/cli/components/damage-roll-generator.js.map +1 -0
- package/out/cli/components/datamodel-generator.js +672 -0
- package/out/cli/components/datamodel-generator.js.map +1 -0
- package/out/cli/components/derived-data-generator.js +1340 -0
- package/out/cli/components/derived-data-generator.js.map +1 -0
- package/out/cli/components/hotbar-drop-hook-generator.js +95 -0
- package/out/cli/components/hotbar-drop-hook-generator.js.map +1 -0
- package/out/cli/components/init-hook-generator.js +597 -0
- package/out/cli/components/init-hook-generator.js.map +1 -0
- package/out/cli/components/keywords-generator.js +220 -0
- package/out/cli/components/keywords-generator.js.map +1 -0
- package/out/cli/components/language-generator.js +110 -0
- package/out/cli/components/language-generator.js.map +1 -0
- package/out/cli/components/measured-template-preview.js +234 -0
- package/out/cli/components/measured-template-preview.js.map +1 -0
- package/out/cli/components/method-generator.js +1812 -0
- package/out/cli/components/method-generator.js.map +1 -0
- package/out/cli/components/ready-hook-generator.js +448 -0
- package/out/cli/components/ready-hook-generator.js.map +1 -0
- package/out/cli/components/token-generator.js +138 -0
- package/out/cli/components/token-generator.js.map +1 -0
- package/out/cli/components/utils.js +176 -0
- package/out/cli/components/utils.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-attribute.js +148 -0
- package/out/cli/components/vue/base-components/vue-attribute.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-boolean.js +77 -0
- package/out/cli/components/vue/base-components/vue-boolean.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-calculator.js +106 -0
- package/out/cli/components/vue/base-components/vue-calculator.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-damage-application.js +369 -0
- package/out/cli/components/vue/base-components/vue-damage-application.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-damage-bonuses.js +225 -0
- package/out/cli/components/vue/base-components/vue-damage-bonuses.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-damage-resistances.js +256 -0
- package/out/cli/components/vue/base-components/vue-damage-resistances.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-damage-track.js +134 -0
- package/out/cli/components/vue/base-components/vue-damage-track.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-date-time.js +55 -0
- package/out/cli/components/vue/base-components/vue-date-time.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-dice.js +111 -0
- package/out/cli/components/vue/base-components/vue-dice.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-die.js +86 -0
- package/out/cli/components/vue/base-components/vue-die.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-document-choice.js +172 -0
- package/out/cli/components/vue/base-components/vue-document-choice.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-document-choices.js +203 -0
- package/out/cli/components/vue/base-components/vue-document-choices.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-document-link.js +73 -0
- package/out/cli/components/vue/base-components/vue-document-link.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-extended-choice.js +101 -0
- package/out/cli/components/vue/base-components/vue-extended-choice.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-inventory.js +532 -0
- package/out/cli/components/vue/base-components/vue-inventory.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-macro-choice.js +150 -0
- package/out/cli/components/vue/base-components/vue-macro-choice.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-measured-template.js +543 -0
- package/out/cli/components/vue/base-components/vue-measured-template.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-money.js +496 -0
- package/out/cli/components/vue/base-components/vue-money.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-number.js +184 -0
- package/out/cli/components/vue/base-components/vue-number.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-paperdoll.js +56 -0
- package/out/cli/components/vue/base-components/vue-paperdoll.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-parent-property-reference.js +89 -0
- package/out/cli/components/vue/base-components/vue-parent-property-reference.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-prosemirror.js +31 -0
- package/out/cli/components/vue/base-components/vue-prosemirror.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-resource.js +149 -0
- package/out/cli/components/vue/base-components/vue-resource.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-roll-visualizer.js +121 -0
- package/out/cli/components/vue/base-components/vue-roll-visualizer.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-self-property-reference.js +75 -0
- package/out/cli/components/vue/base-components/vue-self-property-reference.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-string-choice.js +111 -0
- package/out/cli/components/vue/base-components/vue-string-choice.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-string-choices.js +216 -0
- package/out/cli/components/vue/base-components/vue-string-choices.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-string.js +73 -0
- package/out/cli/components/vue/base-components/vue-string.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-text-field.js +66 -0
- package/out/cli/components/vue/base-components/vue-text-field.js.map +1 -0
- package/out/cli/components/vue/base-components/vue-tracker.js +444 -0
- package/out/cli/components/vue/base-components/vue-tracker.js.map +1 -0
- package/out/cli/components/vue/vue-action-component-generator.js +88 -0
- package/out/cli/components/vue/vue-action-component-generator.js.map +1 -0
- package/out/cli/components/vue/vue-active-effect-sheet-generator.js +1016 -0
- package/out/cli/components/vue/vue-active-effect-sheet-generator.js.map +1 -0
- package/out/cli/components/vue/vue-base-components-generator.js +59 -0
- package/out/cli/components/vue/vue-base-components-generator.js.map +1 -0
- package/out/cli/components/vue/vue-datatable-component-generator.js +307 -0
- package/out/cli/components/vue/vue-datatable-component-generator.js.map +1 -0
- package/out/cli/components/vue/vue-datatable-sheet-class-generator.js +342 -0
- package/out/cli/components/vue/vue-datatable-sheet-class-generator.js.map +1 -0
- package/out/cli/components/vue/vue-datatable2-component-generator.js +939 -0
- package/out/cli/components/vue/vue-datatable2-component-generator.js.map +1 -0
- package/out/cli/components/vue/vue-document-creation-app.js +140 -0
- package/out/cli/components/vue/vue-document-creation-app.js.map +1 -0
- package/out/cli/components/vue/vue-document-creation-sheet.js +105 -0
- package/out/cli/components/vue/vue-document-creation-sheet.js.map +1 -0
- package/out/cli/components/vue/vue-generator.js +240 -0
- package/out/cli/components/vue/vue-generator.js.map +1 -0
- package/out/cli/components/vue/vue-mixin.js +338 -0
- package/out/cli/components/vue/vue-mixin.js.map +1 -0
- package/out/cli/components/vue/vue-pinned-datatable-component-generator.js +306 -0
- package/out/cli/components/vue/vue-pinned-datatable-component-generator.js.map +1 -0
- package/out/cli/components/vue/vue-prompt-generator.js +201 -0
- package/out/cli/components/vue/vue-prompt-generator.js.map +1 -0
- package/out/cli/components/vue/vue-prompt-sheet-class-generator.js +252 -0
- package/out/cli/components/vue/vue-prompt-sheet-class-generator.js.map +1 -0
- package/out/cli/components/vue/vue-sheet-application-generator.js +2008 -0
- package/out/cli/components/vue/vue-sheet-application-generator.js.map +1 -0
- package/out/cli/components/vue/vue-sheet-class-generator.js +484 -0
- package/out/cli/components/vue/vue-sheet-class-generator.js.map +1 -0
- package/out/cli/generator.js +659 -0
- package/out/cli/generator.js.map +1 -0
- package/out/cli/main.js +43 -0
- package/out/cli/main.js.map +1 -0
- package/out/datatables.min.css +54 -0
- package/out/datatables.min.js +178 -0
- package/out/extension/github/githubAuthProvider.js +345 -0
- package/out/extension/github/githubAuthProvider.js.map +1 -0
- package/out/extension/github/githubConfig.js +132 -0
- package/out/extension/github/githubConfig.js.map +1 -0
- package/out/extension/github/githubGistActions.js +251 -0
- package/out/extension/github/githubGistActions.js.map +1 -0
- package/out/extension/github/githubGistManager.js +255 -0
- package/out/extension/github/githubGistManager.js.map +1 -0
- package/out/extension/github/githubManager.js +1735 -0
- package/out/extension/github/githubManager.js.map +1 -0
- package/out/extension/github/githubQuickActions.js +659 -0
- package/out/extension/github/githubQuickActions.js.map +1 -0
- package/out/extension/github/githubTreeProvider.js +181 -0
- package/out/extension/github/githubTreeProvider.js.map +1 -0
- package/out/extension/github/system-workflow.yml +48 -0
- package/out/extension/main.cjs +70315 -0
- package/out/extension/main.cjs.map +7 -0
- package/out/extension/main.js +237 -0
- package/out/extension/main.js.map +1 -0
- package/out/extension/package.json +426 -0
- package/out/isdl.png +0 -0
- package/out/language/generated/ast.js +2992 -0
- package/out/language/generated/ast.js.map +1 -0
- package/out/language/generated/grammar.js +13970 -0
- package/out/language/generated/grammar.js.map +1 -0
- package/out/language/generated/module.js +20 -0
- package/out/language/generated/module.js.map +1 -0
- package/out/language/intelligent-system-design-language-formatter.js +85 -0
- package/out/language/intelligent-system-design-language-formatter.js.map +1 -0
- package/out/language/intelligent-system-design-language-module.js +69 -0
- package/out/language/intelligent-system-design-language-module.js.map +1 -0
- package/out/language/intelligent-system-design-language-quickfixes.js +37 -0
- package/out/language/intelligent-system-design-language-quickfixes.js.map +1 -0
- package/out/language/intelligent-system-design-language-validator.js +515 -0
- package/out/language/intelligent-system-design-language-validator.js.map +1 -0
- package/out/language/isdl-hover-provider.js +77 -0
- package/out/language/isdl-hover-provider.js.map +1 -0
- package/out/language/isdl-scope-provider.js +149 -0
- package/out/language/isdl-scope-provider.js.map +1 -0
- package/out/language/main.cjs +47655 -0
- package/out/language/main.cjs.map +7 -0
- package/out/language/main.js +11 -0
- package/out/language/main.js.map +1 -0
- package/out/missing-character.png +0 -0
- package/out/package.json +426 -0
- package/out/paperdoll_default.png +0 -0
- package/out/progressbar.min.js +7 -0
- package/out/styles.scss +722 -0
- package/out/test/formatting/formatter.test.js +46 -0
- package/out/test/formatting/formatter.test.js.map +1 -0
- package/out/vuetify.esm.js +30279 -0
- package/package.json +426 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-number.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAGxD,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,WAAmB,EAAE,KAAa;IAC9E,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAC5F,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;IAEpE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QAClC,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;KACrD;IAED,MAAM,QAAQ,GAAG,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2K5B,CAAC,aAAa,EAAE,CAAC;IAElB,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { expandToNode, toString } from 'langium/generate';
|
|
4
|
+
export default function generatePaperdollComponent(destination) {
|
|
5
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", "components");
|
|
6
|
+
const generatedFilePath = path.join(generatedFileDir, `paperdoll.vue`);
|
|
7
|
+
if (!fs.existsSync(generatedFileDir)) {
|
|
8
|
+
fs.mkdirSync(generatedFileDir, { recursive: true });
|
|
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>
|
|
53
|
+
`;
|
|
54
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=vue-paperdoll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-paperdoll.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-paperdoll.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAExD,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,WAAmB;IAClE,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAC5F,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IAEvE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QAClC,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;KACrD;IAED,MAAM,QAAQ,GAAG,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2C5B,CAAC;IAEF,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { expandToNode, toString } from 'langium/generate';
|
|
4
|
+
export default function generateParentPropertyReferenceComponent(destination, entry) {
|
|
5
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", "components");
|
|
6
|
+
const generatedFilePath = path.join(generatedFileDir, "parent-property-reference.vue");
|
|
7
|
+
if (!fs.existsSync(generatedFileDir)) {
|
|
8
|
+
fs.mkdirSync(generatedFileDir, { recursive: true });
|
|
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>
|
|
86
|
+
`.appendNewLine();
|
|
87
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=vue-parent-property-reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-parent-property-reference.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-parent-property-reference.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;AAG1D,MAAM,CAAC,OAAO,UAAU,wCAAwC,CAAC,WAAmB,EAAE,KAAa;IAC/F,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAC5F,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,+BAA+B,CAAC,CAAC;IAEvF,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QAClC,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;KACvD;IAED,MAAM,QAAQ,GAAG,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4E5B,CAAC,aAAa,EAAE,CAAC;IAElB,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { expandToNode, toString } from 'langium/generate';
|
|
4
|
+
export default function generateProsemirrorComponent(destination) {
|
|
5
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", "components");
|
|
6
|
+
const generatedFilePath = path.join(generatedFileDir, `prosemirror.vue`);
|
|
7
|
+
if (!fs.existsSync(generatedFileDir)) {
|
|
8
|
+
fs.mkdirSync(generatedFileDir, { recursive: true });
|
|
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>
|
|
28
|
+
`;
|
|
29
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=vue-prosemirror.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-prosemirror.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-prosemirror.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAExD,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAAC,WAAmB;IACpE,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAC5F,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAEzE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QAClC,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;KACrD;IAED,MAAM,QAAQ,GAAG,YAAY,CAAA;;;;;;;;;;;;;;;;;;KAkB5B,CAAC;IAEF,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { expandToNode, toString } from 'langium/generate';
|
|
4
|
+
export default function generateResourceComponent(destination) {
|
|
5
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", "components");
|
|
6
|
+
const generatedFilePath = path.join(generatedFileDir, `resource.vue`);
|
|
7
|
+
if (!fs.existsSync(generatedFileDir)) {
|
|
8
|
+
fs.mkdirSync(generatedFileDir, { recursive: true });
|
|
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
|
+
disabled: Boolean,
|
|
19
|
+
primaryColor: String,
|
|
20
|
+
secondaryColor: String
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const document = inject("rawDocument");
|
|
24
|
+
|
|
25
|
+
// Vuetify's up/down stepper buttons update the model without firing a
|
|
26
|
+
// native change event, so Foundry's submitOnChange form handler never
|
|
27
|
+
// persists them. When the value changes while focus is NOT on a text
|
|
28
|
+
// input (i.e. a stepper click, not typing), persist directly. Typing
|
|
29
|
+
// still persists via the input's native change on blur/enter.
|
|
30
|
+
// ('document' is the injected Foundry document; DOM access uses window.)
|
|
31
|
+
const persistOnStep = (path, newValue) => {
|
|
32
|
+
if (document && window.document.activeElement?.tagName !== 'INPUT') {
|
|
33
|
+
document.update({ [path]: newValue });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const value = computed({
|
|
38
|
+
get: () => foundry.utils.getProperty(props.context, props.systemPath + ".value"),
|
|
39
|
+
set: (newValue) => foundry.utils.setProperty(props.context, props.systemPath + ".value", newValue)
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const max = computed({
|
|
43
|
+
get: () => foundry.utils.getProperty(props.context, props.systemPath + ".max"),
|
|
44
|
+
set: (newValue) => foundry.utils.setProperty(props.context, props.systemPath + ".max", newValue)
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const temp = computed({
|
|
48
|
+
get: () => foundry.utils.getProperty(props.context, props.systemPath + ".temp"),
|
|
49
|
+
set: (newValue) => foundry.utils.setProperty(props.context, props.systemPath + ".temp", newValue)
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const barMax = computed(() => {
|
|
53
|
+
const totalValue = value.value + temp.value;
|
|
54
|
+
if (totalValue > max.value) {
|
|
55
|
+
return totalValue;
|
|
56
|
+
}
|
|
57
|
+
return max.value;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const expanded = ref(false);
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<template>
|
|
64
|
+
<v-card elevation="4" class="ml-1 mr-1 resource-card" variant="outlined">
|
|
65
|
+
<v-card-title>
|
|
66
|
+
{{ game.i18n.localize(label) }}
|
|
67
|
+
</v-card-title>
|
|
68
|
+
|
|
69
|
+
<v-card-actions>
|
|
70
|
+
<v-progress-linear
|
|
71
|
+
:height="18"
|
|
72
|
+
:color="primaryColor"
|
|
73
|
+
bg-color="#92aed9"
|
|
74
|
+
rounded
|
|
75
|
+
:model-value="value"
|
|
76
|
+
min="0"
|
|
77
|
+
:max="barMax"
|
|
78
|
+
:buffer-value="value + temp"
|
|
79
|
+
buffer-opacity="1"
|
|
80
|
+
:buffer-color="secondaryColor"
|
|
81
|
+
:data-tooltip="\`Value: \${value} / Temp: \${temp} / Max: \${max}\`"
|
|
82
|
+
style="font-weight: bold;"
|
|
83
|
+
>
|
|
84
|
+
<template v-slot:default>
|
|
85
|
+
{{ value }} / {{ max }}
|
|
86
|
+
</template>
|
|
87
|
+
</v-progress-linear>
|
|
88
|
+
<v-spacer></v-spacer>
|
|
89
|
+
<v-btn :icon="expanded ? 'fa-solid fa-chevron-up' : 'fa-solid fa-chevron-down'" @click="expanded = !expanded" color="primary">
|
|
90
|
+
</v-btn>
|
|
91
|
+
</v-card-actions>
|
|
92
|
+
|
|
93
|
+
<v-expand-transition>
|
|
94
|
+
<div v-show="expanded">
|
|
95
|
+
<v-card-text>
|
|
96
|
+
<div class="d-flex flex-row">
|
|
97
|
+
<v-number-input
|
|
98
|
+
:model-value="value"
|
|
99
|
+
@update:model-value="(v) => { value = v; persistOnStep(systemPath + '.value', v); }"
|
|
100
|
+
:name="systemPath + '.value'"
|
|
101
|
+
label="Value"
|
|
102
|
+
controlVariant="stacked"
|
|
103
|
+
density="compact"
|
|
104
|
+
variant="outlined"
|
|
105
|
+
class="flex-grow-1"
|
|
106
|
+
style="min-width: 100px;"
|
|
107
|
+
hide-details="true"
|
|
108
|
+
/>
|
|
109
|
+
<v-number-input
|
|
110
|
+
:model-value="temp"
|
|
111
|
+
@update:model-value="(v) => { temp = v; persistOnStep(systemPath + '.temp', v); }"
|
|
112
|
+
:name="systemPath + '.temp'"
|
|
113
|
+
label="Temp"
|
|
114
|
+
controlVariant="stacked"
|
|
115
|
+
density="compact"
|
|
116
|
+
variant="outlined"
|
|
117
|
+
class="flex-grow-1"
|
|
118
|
+
style="min-width: 100px;"
|
|
119
|
+
hide-details="true"
|
|
120
|
+
/>
|
|
121
|
+
<v-number-input
|
|
122
|
+
:model-value="max"
|
|
123
|
+
@update:model-value="(v) => { max = v; persistOnStep(systemPath + '.max', v); }"
|
|
124
|
+
:name="systemPath + '.max'"
|
|
125
|
+
label="Max"
|
|
126
|
+
:disabled="disabled"
|
|
127
|
+
controlVariant="stacked"
|
|
128
|
+
density="compact"
|
|
129
|
+
variant="outlined"
|
|
130
|
+
class="flex-grow-1"
|
|
131
|
+
style="min-width: 100px;"
|
|
132
|
+
hide-details="true"
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
</v-card-text>
|
|
136
|
+
</div>
|
|
137
|
+
</v-expand-transition>
|
|
138
|
+
</v-card>
|
|
139
|
+
</template>
|
|
140
|
+
|
|
141
|
+
<style>
|
|
142
|
+
.resource-card {
|
|
143
|
+
min-width: 300px;
|
|
144
|
+
}
|
|
145
|
+
</style>
|
|
146
|
+
`;
|
|
147
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=vue-resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-resource.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAExD,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,WAAmB;IACjE,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAC5F,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;IAEtE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QAClC,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;KACrD;IAED,MAAM,QAAQ,GAAG,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwI5B,CAAC;IACF,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { expandToNode, toString } from 'langium/generate';
|
|
4
|
+
export default function generateRollVisualizerComponent(destination) {
|
|
5
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", "components");
|
|
6
|
+
const generatedFilePath = path.join(generatedFileDir, `roll-visualizer.vue`);
|
|
7
|
+
if (!fs.existsSync(generatedFileDir)) {
|
|
8
|
+
fs.mkdirSync(generatedFileDir, { recursive: true });
|
|
9
|
+
}
|
|
10
|
+
const fileNode = expandToNode `
|
|
11
|
+
<script setup>
|
|
12
|
+
import { ref, computed, watch } from "vue";
|
|
13
|
+
|
|
14
|
+
const props = defineProps({});
|
|
15
|
+
|
|
16
|
+
const resultText = ref("Not Evaluated");
|
|
17
|
+
const roll = ref("2d20 + d6 + 5");
|
|
18
|
+
|
|
19
|
+
let estimated = true;
|
|
20
|
+
|
|
21
|
+
const iterations = ref(1000);
|
|
22
|
+
const labels = ref([]);
|
|
23
|
+
const values = ref([]);
|
|
24
|
+
const min = ref(0);
|
|
25
|
+
const max = ref(0);
|
|
26
|
+
|
|
27
|
+
const countAndSplitNumbers = (arr) => {
|
|
28
|
+
// Count occurrences
|
|
29
|
+
const countMap = arr.reduce((acc, num) => {
|
|
30
|
+
acc[num] = (acc[num] || 0) + 1;
|
|
31
|
+
return acc;
|
|
32
|
+
}, {});
|
|
33
|
+
|
|
34
|
+
// Sort and split into two arrays
|
|
35
|
+
const sortedEntries = Object.entries(countMap).sort(([a], [b]) => a - b);
|
|
36
|
+
const labels = sortedEntries.map(([num]) => Number(num));
|
|
37
|
+
const values = sortedEntries.map(([, count]) => count);
|
|
38
|
+
|
|
39
|
+
return { labels, values };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
watch(roll, async () => {
|
|
43
|
+
|
|
44
|
+
if (!Roll.validate(roll.value)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Whenever the roll changes, we need to re-calculate the value. First we do a quick simulation, then we do a more accurate one and reload the results
|
|
49
|
+
let result = await Roll.simulate(roll.value, 1000);
|
|
50
|
+
let counted = countAndSplitNumbers(result);
|
|
51
|
+
iterations.value = 1000;
|
|
52
|
+
|
|
53
|
+
// If there are more than 20 labels, only show every other label
|
|
54
|
+
if (counted.labels.length > 20) {
|
|
55
|
+
counted.labels = counted.labels.filter((_, i) => i % 2 === 0);
|
|
56
|
+
counted.values = counted.values.filter((_, i) => i % 2 === 0);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
labels.value = counted.labels;
|
|
60
|
+
values.value = counted.values;
|
|
61
|
+
min.value = Math.min(...counted.labels);
|
|
62
|
+
max.value = Math.max(...counted.labels);
|
|
63
|
+
|
|
64
|
+
setTimeout(async () => {
|
|
65
|
+
Roll.simulate(roll.value, 10000).then(result2 => {
|
|
66
|
+
let counted2 = countAndSplitNumbers(result2);
|
|
67
|
+
iterations.value = 10000;
|
|
68
|
+
|
|
69
|
+
// If there are more than 20 labels, only show every other label
|
|
70
|
+
if (counted2.labels.length > 20) {
|
|
71
|
+
counted2.labels = counted.labels.filter((_, i) => i % 2 === 0);
|
|
72
|
+
counted2.values = counted.values.filter((_, i) => i % 2 === 0);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
labels.value = counted2.labels;
|
|
76
|
+
values.value = counted2.values;
|
|
77
|
+
});
|
|
78
|
+
}, 0);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<template>
|
|
85
|
+
<v-card class="mt-8 mx-auto overflow-visible" style="min-width: 600px;">
|
|
86
|
+
<v-sheet
|
|
87
|
+
class="v-sheet--offset mx-auto"
|
|
88
|
+
color="cyan"
|
|
89
|
+
elevation="12"
|
|
90
|
+
max-width="calc(100% - 32px)"
|
|
91
|
+
rounded="lg"
|
|
92
|
+
>
|
|
93
|
+
<v-sparkline
|
|
94
|
+
:labels="labels"
|
|
95
|
+
:model-value="values"
|
|
96
|
+
color="white"
|
|
97
|
+
line-width="2"
|
|
98
|
+
padding="16"
|
|
99
|
+
smooth="8"
|
|
100
|
+
label-size="6"
|
|
101
|
+
></v-sparkline>
|
|
102
|
+
</v-sheet>
|
|
103
|
+
|
|
104
|
+
<v-card-text class="pt-0">
|
|
105
|
+
<div class="text-h6 font-weight-light mb-2">
|
|
106
|
+
<v-text-field v-model="roll"></v-text-field>
|
|
107
|
+
</div>
|
|
108
|
+
<div class="subheading font-weight-light text-grey" v-if="values.length > 0">
|
|
109
|
+
Min: {{min}} Max: {{max}}
|
|
110
|
+
</div>
|
|
111
|
+
<v-divider class="my-2"></v-divider>
|
|
112
|
+
<span class="text-caption text-grey font-weight-light">
|
|
113
|
+
Approximate results based on {{iterations}} simulations
|
|
114
|
+
</span>
|
|
115
|
+
</v-card-text>
|
|
116
|
+
</v-card>
|
|
117
|
+
</template>
|
|
118
|
+
`;
|
|
119
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=vue-roll-visualizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-roll-visualizer.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-roll-visualizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAExD,MAAM,CAAC,OAAO,UAAU,+BAA+B,CAAC,WAAmB;IACvE,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAC5F,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;IAE7E,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QAClC,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;KACrD;IAED,MAAM,QAAQ,GAAG,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4G5B,CAAC;IAEF,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { expandToNode, toString } from 'langium/generate';
|
|
4
|
+
export default function generateSelfPropertyReferenceComponent(destination, entry) {
|
|
5
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", "components");
|
|
6
|
+
const generatedFilePath = path.join(generatedFileDir, `self-property-reference.vue`);
|
|
7
|
+
if (!fs.existsSync(generatedFileDir)) {
|
|
8
|
+
fs.mkdirSync(generatedFileDir, { recursive: true });
|
|
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
|
+
disabled: Boolean,
|
|
19
|
+
icon: String,
|
|
20
|
+
color: String,
|
|
21
|
+
propertyType: String,
|
|
22
|
+
choices: Array
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const document = inject("rawDocument");
|
|
26
|
+
|
|
27
|
+
const value = computed({
|
|
28
|
+
get: () => foundry.utils.getProperty(props.context, props.systemPath),
|
|
29
|
+
set: (newValue) => foundry.utils.setProperty(props.context, props.systemPath, newValue)
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Filter choices based on property type if provided
|
|
33
|
+
const availableChoices = computed(() => {
|
|
34
|
+
if (!props.choices || !props.propertyType) return [];
|
|
35
|
+
|
|
36
|
+
// Filter properties based on type
|
|
37
|
+
return props.choices.filter(choice => {
|
|
38
|
+
// Here we would check if the choice matches the expected property type
|
|
39
|
+
// For now, return all choices - this could be enhanced with type checking
|
|
40
|
+
return true;
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
const fieldColor = computed(() => {
|
|
46
|
+
return props.color || 'primary';
|
|
47
|
+
});
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<div class="isdl-self-property-reference single-wide">
|
|
52
|
+
<v-select
|
|
53
|
+
:model-value="value"
|
|
54
|
+
@update:model-value="(v) => { value = v; if (document) document.update({ [props.systemPath]: v }); }"
|
|
55
|
+
:items="availableChoices"
|
|
56
|
+
:name="props.systemPath"
|
|
57
|
+
:disabled="disabled"
|
|
58
|
+
:color="fieldColor"
|
|
59
|
+
variant="outlined"
|
|
60
|
+
density="compact"
|
|
61
|
+
clearable
|
|
62
|
+
>
|
|
63
|
+
<template #label>
|
|
64
|
+
<span class="field-label">
|
|
65
|
+
<v-icon v-if="props.icon" :icon="props.icon" size="small" class="me-1"></v-icon>
|
|
66
|
+
{{ game.i18n.localize(props.label) }}
|
|
67
|
+
</span>
|
|
68
|
+
</template>
|
|
69
|
+
</v-select>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
`.appendNewLine();
|
|
73
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=vue-self-property-reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-self-property-reference.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-self-property-reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAGxD,MAAM,CAAC,OAAO,UAAU,sCAAsC,CAAC,WAAmB,EAAE,KAAa;IAC7F,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAC5F,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,6BAA6B,CAAC,CAAC;IAErF,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QAClC,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;KACrD;IAED,MAAM,QAAQ,GAAG,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8D5B,CAAC,aAAa,EAAE,CAAC;IAElB,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { expandToNode, toString } from 'langium/generate';
|
|
4
|
+
export default function generateStringChoiceComponent(destination, entry) {
|
|
5
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", "components");
|
|
6
|
+
const generatedFilePath = path.join(generatedFileDir, `string-choice.vue`);
|
|
7
|
+
if (!fs.existsSync(generatedFileDir)) {
|
|
8
|
+
fs.mkdirSync(generatedFileDir, { recursive: true });
|
|
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
|
+
items: {
|
|
24
|
+
type: Array,
|
|
25
|
+
default: () => []
|
|
26
|
+
},
|
|
27
|
+
isExtended: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
primaryColor: String,
|
|
32
|
+
secondaryColor: String
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const document = inject("rawDocument");
|
|
36
|
+
|
|
37
|
+
const value = computed({
|
|
38
|
+
get: () => foundry.utils.getProperty(props.context, props.systemPath),
|
|
39
|
+
set: (newValue) => foundry.utils.setProperty(props.context, props.systemPath, newValue)
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const isHidden = computed(() => {
|
|
43
|
+
if (props.visibility === "hidden") {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
if (props.visibility === "gm" && !game.user.isGM) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const isDisabled = computed(() => {
|
|
53
|
+
return props.disabled ||
|
|
54
|
+
props.visibility === "locked" ||
|
|
55
|
+
props.visibility === "readonly" ||
|
|
56
|
+
(props.visibility === "gmOnly" && !game.user.isGM);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const fieldColor = computed(() => {
|
|
60
|
+
return props.color || 'primary';
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const localizedLabel = computed(() => {
|
|
64
|
+
return game.i18n.localize(props.label);
|
|
65
|
+
});
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<template>
|
|
69
|
+
<div v-if="!isHidden" class="isdl-string-choice single-wide">
|
|
70
|
+
<!-- Simple choice field - uses v-select -->
|
|
71
|
+
<v-select
|
|
72
|
+
v-if="!props.isExtended"
|
|
73
|
+
:model-value="value"
|
|
74
|
+
@update:model-value="(v) => { value = v; if (document) document.update({ [props.systemPath]: v }); }"
|
|
75
|
+
:name="props.systemPath"
|
|
76
|
+
:items="props.items"
|
|
77
|
+
item-title="label"
|
|
78
|
+
item-value="value"
|
|
79
|
+
:disabled="isDisabled"
|
|
80
|
+
:color="fieldColor"
|
|
81
|
+
variant="outlined"
|
|
82
|
+
density="compact"
|
|
83
|
+
>
|
|
84
|
+
<template #label>
|
|
85
|
+
<span class="field-label">
|
|
86
|
+
<v-icon v-if="props.icon" :icon="props.icon" size="small" class="me-1"></v-icon>
|
|
87
|
+
{{ localizedLabel }}
|
|
88
|
+
</span>
|
|
89
|
+
</template>
|
|
90
|
+
</v-select>
|
|
91
|
+
|
|
92
|
+
<!-- Extended choice field - uses i-extended-choice -->
|
|
93
|
+
<i-extended-choice
|
|
94
|
+
v-else
|
|
95
|
+
:label="props.label"
|
|
96
|
+
:icon="props.icon"
|
|
97
|
+
:systemPath="props.systemPath"
|
|
98
|
+
:context="props.context"
|
|
99
|
+
:items="props.items"
|
|
100
|
+
:primaryColor="props.primaryColor"
|
|
101
|
+
:secondaryColor="props.secondaryColor"
|
|
102
|
+
:visibility="props.visibility"
|
|
103
|
+
:disabled="props.disabled"
|
|
104
|
+
:color="props.color">
|
|
105
|
+
</i-extended-choice>
|
|
106
|
+
</div>
|
|
107
|
+
</template>
|
|
108
|
+
`.appendNewLine();
|
|
109
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=vue-string-choice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-string-choice.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-string-choice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAGxD,MAAM,CAAC,OAAO,UAAU,6BAA6B,CAAC,WAAmB,EAAE,KAAa;IACpF,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAC5F,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC;IAE3E,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QAClC,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;KACrD;IAED,MAAM,QAAQ,GAAG,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkG5B,CAAC,aAAa,EAAE,CAAC;IAElB,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|