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,55 @@
|
|
|
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 generateDateTimeComponent(destination) {
|
|
5
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", "components");
|
|
6
|
+
const generatedFilePath = path.join(generatedFileDir, `date-time.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
|
+
type: String,
|
|
17
|
+
systemPath: String,
|
|
18
|
+
context: Object,
|
|
19
|
+
disabled: Boolean
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const value = ref(foundry.utils.getProperty(props.context, props.systemPath));
|
|
23
|
+
const document = inject("rawDocument");
|
|
24
|
+
|
|
25
|
+
const debouncedPersist = foundry.utils.debounce((newValue) => {
|
|
26
|
+
const update = {};
|
|
27
|
+
value.value = newValue;
|
|
28
|
+
update[props.systemPath] = newValue;
|
|
29
|
+
document.update(update);
|
|
30
|
+
}, 150);
|
|
31
|
+
|
|
32
|
+
const update = (newValue) => {
|
|
33
|
+
value.value = newValue;
|
|
34
|
+
debouncedPersist(newValue);
|
|
35
|
+
};
|
|
36
|
+
</script>
|
|
37
|
+
<template>
|
|
38
|
+
<v-input v-model="value" class="isdl-datetime">
|
|
39
|
+
<template #default>
|
|
40
|
+
<v-field
|
|
41
|
+
class="v-field--active"
|
|
42
|
+
density="compact"
|
|
43
|
+
variant="outlined"
|
|
44
|
+
:disabled="disabled"
|
|
45
|
+
:label="game.i18n.localize(label)"
|
|
46
|
+
>
|
|
47
|
+
<input :type="type" :name="systemPath" v-model="value" :disabled="disabled" />
|
|
48
|
+
</v-field>
|
|
49
|
+
</template>
|
|
50
|
+
</v-input>
|
|
51
|
+
</template>
|
|
52
|
+
`;
|
|
53
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=vue-date-time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-date-time.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-date-time.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,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0C5B,CAAC;IAEF,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 generateDiceComponent(destination) {
|
|
5
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", "components");
|
|
6
|
+
const generatedFilePath = path.join(generatedFileDir, `dice.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, watch } from "vue";
|
|
13
|
+
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
label: String,
|
|
16
|
+
icon: String,
|
|
17
|
+
systemPath: String,
|
|
18
|
+
context: Object,
|
|
19
|
+
editMode: Boolean,
|
|
20
|
+
disabled: Boolean,
|
|
21
|
+
choices: Array,
|
|
22
|
+
primaryColor: String,
|
|
23
|
+
secondaryColor: String
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const document = inject("rawDocument");
|
|
27
|
+
|
|
28
|
+
const getLabel = (label, icon) => {
|
|
29
|
+
const localized = game.i18n.localize(label);
|
|
30
|
+
if (icon) {
|
|
31
|
+
return \`<i class="\${icon}"></i> \${localized}\`;
|
|
32
|
+
}
|
|
33
|
+
return localized;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const numberValue = computed({
|
|
37
|
+
get: () => foundry.utils.getProperty(props.context, props.systemPath + ".number") ?? 1,
|
|
38
|
+
set: (newValue) => foundry.utils.setProperty(props.context, props.systemPath + ".number", newValue)
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const dieValue = computed({
|
|
42
|
+
get: () => foundry.utils.getProperty(props.context, props.systemPath + ".die") ?? "d6",
|
|
43
|
+
set: (newValue) => foundry.utils.setProperty(props.context, props.systemPath + ".die", newValue)
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
watch(numberValue, (newVal) => {
|
|
47
|
+
if (document) document.update({ [\`\${props.systemPath}.number\`]: newVal });
|
|
48
|
+
});
|
|
49
|
+
watch(dieValue, (newVal) => {
|
|
50
|
+
if (document) document.update({ [\`\${props.systemPath}.die\`]: newVal });
|
|
51
|
+
});
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<v-input
|
|
56
|
+
class="isdl-dice-field"
|
|
57
|
+
:disabled="disabled"
|
|
58
|
+
hide-details
|
|
59
|
+
>
|
|
60
|
+
|
|
61
|
+
<template #default>
|
|
62
|
+
<v-field
|
|
63
|
+
class="v-field--active"
|
|
64
|
+
variant="outlined"
|
|
65
|
+
density="compact"
|
|
66
|
+
:disabled="disabled"
|
|
67
|
+
>
|
|
68
|
+
<template #label>
|
|
69
|
+
<span v-html="getLabel(label, icon)" />
|
|
70
|
+
</template>
|
|
71
|
+
<div class="flexrow align-center inner-content">
|
|
72
|
+
<v-number-input
|
|
73
|
+
:name="systemPath + '.number'"
|
|
74
|
+
v-model="numberValue"
|
|
75
|
+
:min="0"
|
|
76
|
+
:step="1"
|
|
77
|
+
variant="plain"
|
|
78
|
+
density="compact"
|
|
79
|
+
:disabled="disabled"
|
|
80
|
+
hide-details
|
|
81
|
+
class="dice-number-input inner-input"
|
|
82
|
+
style="flex: 1; min-width: 50px; text-align: center; margin-right: 0.5rem;"
|
|
83
|
+
control-variant="stacked"
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
<v-select
|
|
87
|
+
:name="systemPath + '.die'"
|
|
88
|
+
v-model="dieValue"
|
|
89
|
+
:items="choices"
|
|
90
|
+
item-value="value"
|
|
91
|
+
item-title="label"
|
|
92
|
+
:disabled="disabled"
|
|
93
|
+
variant="plain"
|
|
94
|
+
density="compact"
|
|
95
|
+
hide-details
|
|
96
|
+
class="dice-type-select inner-input"
|
|
97
|
+
style="flex: 2; min-width: 100px;"
|
|
98
|
+
>
|
|
99
|
+
<template #prepend-inner>
|
|
100
|
+
<i :class="'fa-solid fa-dice-' + dieValue" style="padding-right: 6px;"></i>
|
|
101
|
+
</template>
|
|
102
|
+
</v-select>
|
|
103
|
+
</div>
|
|
104
|
+
</v-field>
|
|
105
|
+
</template>
|
|
106
|
+
</v-input>
|
|
107
|
+
</template>
|
|
108
|
+
`.appendNewLine();
|
|
109
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=vue-dice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-dice.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-dice.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,qBAAqB,CAAC,WAAmB;IAC7D,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,UAAU,CAAC,CAAC;IAElE,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"}
|
|
@@ -0,0 +1,86 @@
|
|
|
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 generateDieComponent(destination, entry) {
|
|
5
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", "components");
|
|
6
|
+
const generatedFilePath = path.join(generatedFileDir, `die.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, watch } from "vue";
|
|
13
|
+
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
label: String,
|
|
16
|
+
systemPath: String,
|
|
17
|
+
context: Object,
|
|
18
|
+
visibility: String,
|
|
19
|
+
disabled: Boolean,
|
|
20
|
+
icon: String,
|
|
21
|
+
color: String,
|
|
22
|
+
none: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false
|
|
25
|
+
},
|
|
26
|
+
choices: {
|
|
27
|
+
type: Array,
|
|
28
|
+
default: () => ['d4', 'd6', 'd8', 'd10', 'd12', 'd20']
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const document = inject("rawDocument");
|
|
33
|
+
|
|
34
|
+
const selectColor = computed(() => {
|
|
35
|
+
return props.color || 'primary';
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const allChoices = computed(() => {
|
|
39
|
+
return props.none ? ['none', ...props.choices] : props.choices;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const value = computed({
|
|
43
|
+
get: () => foundry.utils.getProperty(props.context, props.systemPath),
|
|
44
|
+
set: (newValue) => foundry.utils.setProperty(props.context, props.systemPath, newValue)
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
watch(value, (newVal) => {
|
|
48
|
+
if (document) document.update({ [props.systemPath]: newVal });
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const dieIcon = computed(() => {
|
|
52
|
+
const currentValue = value.value;
|
|
53
|
+
if (!currentValue || currentValue === 'none') return 'fa-solid fa-ban';
|
|
54
|
+
if (currentValue.startsWith('d')) {
|
|
55
|
+
return \`fa-solid fa-dice-\${currentValue}\`;
|
|
56
|
+
}
|
|
57
|
+
return 'fa-solid fa-dice';
|
|
58
|
+
});
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
<v-select
|
|
63
|
+
v-model="value"
|
|
64
|
+
:name="props.systemPath"
|
|
65
|
+
:items="allChoices"
|
|
66
|
+
:disabled="disabled"
|
|
67
|
+
:color="selectColor"
|
|
68
|
+
density="compact"
|
|
69
|
+
variant="outlined"
|
|
70
|
+
class="isdl-die single-wide"
|
|
71
|
+
>
|
|
72
|
+
<template #label>
|
|
73
|
+
<span class="field-label">
|
|
74
|
+
<v-icon v-if="props.icon" :icon="props.icon" size="small" class="me-1"></v-icon>
|
|
75
|
+
{{ game.i18n.localize(props.label) }}
|
|
76
|
+
</span>
|
|
77
|
+
</template>
|
|
78
|
+
<template #prepend-inner>
|
|
79
|
+
<v-icon :icon="dieIcon" size="small"></v-icon>
|
|
80
|
+
</template>
|
|
81
|
+
</v-select>
|
|
82
|
+
</template>
|
|
83
|
+
`.appendNewLine();
|
|
84
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=vue-die.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-die.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-die.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,oBAAoB,CAAC,WAAmB,EAAE,KAAa;IAC3E,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,SAAS,CAAC,CAAC;IAEjE,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyE5B,CAAC,aAAa,EAAE,CAAC;IAElB,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { expandToNode, toString } from 'langium/generate';
|
|
4
|
+
import { isActor, isGlobalParam, isIconParam, isWhereParam } from "../../../../language/generated/ast.js";
|
|
5
|
+
import { translateExpression } from '../../method-generator.js';
|
|
6
|
+
import { getSystemPath } from '../../utils.js';
|
|
7
|
+
export function generateDocumentChoiceComponent(entry, id, document, documentChoice, destination) {
|
|
8
|
+
var _a, _b, _c, _d, _e;
|
|
9
|
+
const type = isActor(document) ? 'actor' : 'item';
|
|
10
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", type, document.name.toLowerCase(), "components", "document-choices");
|
|
11
|
+
const generatedFilePath = path.join(generatedFileDir, `${document.name.toLowerCase()}${documentChoice.name}DocumentChoice.vue`);
|
|
12
|
+
const iconParam = documentChoice.params.find(isIconParam);
|
|
13
|
+
const globalParam = documentChoice.params.find(isGlobalParam);
|
|
14
|
+
const globalAllowed = (_a = globalParam === null || globalParam === void 0 ? void 0 : globalParam.value) !== null && _a !== void 0 ? _a : false;
|
|
15
|
+
if (!fs.existsSync(generatedFileDir)) {
|
|
16
|
+
fs.mkdirSync(generatedFileDir, { recursive: true });
|
|
17
|
+
}
|
|
18
|
+
const unlocked = documentChoice.modifier === 'unlocked';
|
|
19
|
+
console.log("Generating document choice component", documentChoice.name);
|
|
20
|
+
const fileNode = expandToNode `
|
|
21
|
+
<script setup>
|
|
22
|
+
import { ref, inject, computed } from "vue";
|
|
23
|
+
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
context: Object,
|
|
26
|
+
editMode: Boolean,
|
|
27
|
+
primaryColor: String,
|
|
28
|
+
secondaryColor: String
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const document = inject('rawDocument');
|
|
32
|
+
const unlocked = ${unlocked};
|
|
33
|
+
|
|
34
|
+
const value = ref(foundry.utils.getProperty(document, '${getSystemPath(documentChoice)}'));
|
|
35
|
+
const onChange = (value) => {
|
|
36
|
+
document.update({ '${getSystemPath(documentChoice)}': value });
|
|
37
|
+
const updated = fromUuidSync(value);
|
|
38
|
+
if (updated) selectedImage.value = updated.img;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const selectedImage = ref(value.value?.img);
|
|
42
|
+
|
|
43
|
+
const disabled = computed(() => {
|
|
44
|
+
let item = value.value?.length > 0 ? value.value[0] : value.value;
|
|
45
|
+
let system = props.context.system;
|
|
46
|
+
return ${false} || (!props.editMode && !unlocked);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const hidden = computed(() => {
|
|
50
|
+
let item = value.value?.length > 0 ? value.value[0] : value.value;
|
|
51
|
+
let system = props.context.system;
|
|
52
|
+
return ${false}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const choices = computed(() => {
|
|
56
|
+
let system = props.context.system;
|
|
57
|
+
let allChoices = Array.from(document.items);
|
|
58
|
+
|
|
59
|
+
${globalAllowed ?
|
|
60
|
+
`
|
|
61
|
+
let gameItems = game.items.filter(item => item.type === '${(_b = documentChoice.document.ref) === null || _b === void 0 ? void 0 : _b.name.toLowerCase()}');
|
|
62
|
+
allChoices = allChoices.concat(gameItems);
|
|
63
|
+
|
|
64
|
+
let itemPacks = game.packs.filter(pack => pack.documentName === 'Item');
|
|
65
|
+
for (let pack of itemPacks) {
|
|
66
|
+
const packItems = pack.index.contents;
|
|
67
|
+
packItems.forEach(item => {
|
|
68
|
+
item.compendium = pack;
|
|
69
|
+
});
|
|
70
|
+
allChoices = allChoices.concat(packItems);
|
|
71
|
+
}
|
|
72
|
+
` : ''}
|
|
73
|
+
|
|
74
|
+
allChoices = allChoices.filter(item => {
|
|
75
|
+
if (item.type !== '${(_c = documentChoice.document.ref) === null || _c === void 0 ? void 0 : _c.name.toLowerCase()}') return false;
|
|
76
|
+
return ${(_e = translateExpression(entry, id, (_d = documentChoice.params.filter(x => isWhereParam(x))[0]) === null || _d === void 0 ? void 0 : _d.value)) !== null && _e !== void 0 ? _e : true}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
if (allChoices.length === 0) return [{
|
|
80
|
+
id: null,
|
|
81
|
+
name: 'No choices available'
|
|
82
|
+
}];
|
|
83
|
+
|
|
84
|
+
return allChoices.map(choice => {
|
|
85
|
+
let context = {
|
|
86
|
+
id: choice.uuid,
|
|
87
|
+
name: choice.name,
|
|
88
|
+
image: choice.img,
|
|
89
|
+
summary: truncate(choice.system.description, 50),
|
|
90
|
+
description: choice.system.description
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
if (choice.parent) {
|
|
94
|
+
context.source = "Self";
|
|
95
|
+
context.color = props.primaryColor;
|
|
96
|
+
context.icon = 'fa-solid fa-user';
|
|
97
|
+
}
|
|
98
|
+
else if (choice.compendium) {
|
|
99
|
+
context.source = \`\${choice.compendium.metadata.packageName} - \${choice.compendium.title}\`;
|
|
100
|
+
context.color = props.secondaryColor;
|
|
101
|
+
context.icon = 'fa-solid fa-suitcase';
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
context.source = "World";
|
|
105
|
+
context.color = props.secondaryColor;
|
|
106
|
+
context.icon = 'fa-solid fa-globe';
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return context;
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const truncate = (text, maxLength) => {
|
|
114
|
+
if (text.length > maxLength) {
|
|
115
|
+
return text.substring(0, maxLength) + '...';
|
|
116
|
+
}
|
|
117
|
+
return text;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const getLabel = (label, icon) => {
|
|
121
|
+
const localized = game.i18n.localize(label);
|
|
122
|
+
if (icon) {
|
|
123
|
+
return \`<i class="\${icon}"></i> \${localized}\`;
|
|
124
|
+
}
|
|
125
|
+
return localized;
|
|
126
|
+
}
|
|
127
|
+
</script>
|
|
128
|
+
<template>
|
|
129
|
+
<v-autocomplete clearable dense
|
|
130
|
+
v-model="value"
|
|
131
|
+
@update:modelValue="onChange"
|
|
132
|
+
:items="choices"
|
|
133
|
+
item-title="name"
|
|
134
|
+
item-value="id"
|
|
135
|
+
density="compact"
|
|
136
|
+
variant="outlined"
|
|
137
|
+
:disabled="disabled"
|
|
138
|
+
class="double-wide"
|
|
139
|
+
>
|
|
140
|
+
<template #label>
|
|
141
|
+
<span v-html="getLabel('${document.name}.${documentChoice.name}', ${iconParam ? `'${iconParam.value}'` : undefined})" />
|
|
142
|
+
</template>
|
|
143
|
+
<template v-slot:prepend-inner v-if="value">
|
|
144
|
+
<v-avatar rounded="0" :image="selectedImage" size="30"</v-avatar>
|
|
145
|
+
</template>
|
|
146
|
+
<template v-slot:item="{ props, item }">
|
|
147
|
+
<v-list-item
|
|
148
|
+
v-bind="props"
|
|
149
|
+
:data-tooltip="item.raw.description"
|
|
150
|
+
>
|
|
151
|
+
<template v-slot:title>
|
|
152
|
+
<div class="flexrow">
|
|
153
|
+
<p style="flex: 1">{{ item.raw.name }}</p>
|
|
154
|
+
<v-spacer />
|
|
155
|
+
<v-chip size="small" label :color="item.raw.color" style="align-self: center; white-space: nowrap; flex: 0; line-height: 26px; display: inline-table;"><v-icon :icon="item.raw.icon" start></v-icon> {{ item.raw.source }}</v-chip>
|
|
156
|
+
</div>
|
|
157
|
+
</template>
|
|
158
|
+
<template v-if="item.raw.image" v-slot:prepend>
|
|
159
|
+
<v-avatar rounded="0" :image="item.raw.image">
|
|
160
|
+
</v-avatar>
|
|
161
|
+
</template>
|
|
162
|
+
<template v-slot:subtitle>
|
|
163
|
+
<div v-html="item.raw.summary"></div>
|
|
164
|
+
</template>
|
|
165
|
+
</v-list-item>
|
|
166
|
+
</template>
|
|
167
|
+
</v-autocomplete>
|
|
168
|
+
</template>
|
|
169
|
+
`;
|
|
170
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=vue-document-choice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-document-choice.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-document-choice.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,EAE+C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EACtG,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,UAAU,+BAA+B,CAAC,KAAY,EAAE,EAAU,EAAE,QAAkB,EAAE,cAAiC,EAAE,WAAmB;;IAChJ,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAClD,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,YAAY,EAAE,kBAAkB,CAAC,CAAC;IACnJ,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,cAAc,CAAC,IAAI,oBAAoB,CAAC,CAAC;IAEhI,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAA0B,CAAC;IACnF,MAAM,WAAW,GAAG,cAAc,C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GAAG,CAAC,CAAC,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4B7H,CAAC;IAEF,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { expandToNode, toString } from 'langium/generate';
|
|
4
|
+
import { isActor, isGlobalParam, isIconParam, isWhereParam } from "../../../../language/generated/ast.js";
|
|
5
|
+
import { translateExpression } from '../../method-generator.js';
|
|
6
|
+
import { getSystemPath } from '../../utils.js';
|
|
7
|
+
export function generateDocumentChoicesComponent(entry, id, document, documentChoices, destination) {
|
|
8
|
+
var _a, _b, _c, _d, _e;
|
|
9
|
+
const type = isActor(document) ? 'actor' : 'item';
|
|
10
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", type, document.name.toLowerCase(), "components", "document-choices");
|
|
11
|
+
const generatedFilePath = path.join(generatedFileDir, `${document.name.toLowerCase()}${documentChoices.name}DocumentChoices.vue`);
|
|
12
|
+
const iconParam = documentChoices.params.find(isIconParam);
|
|
13
|
+
const globalParam = documentChoices.params.find(isGlobalParam);
|
|
14
|
+
const globalAllowed = (_a = globalParam === null || globalParam === void 0 ? void 0 : globalParam.value) !== null && _a !== void 0 ? _a : false;
|
|
15
|
+
if (!fs.existsSync(generatedFileDir)) {
|
|
16
|
+
fs.mkdirSync(generatedFileDir, { recursive: true });
|
|
17
|
+
}
|
|
18
|
+
const unlocked = documentChoices.modifier === 'unlocked';
|
|
19
|
+
console.log("Generating document choices component", documentChoices.name);
|
|
20
|
+
const fileNode = expandToNode `
|
|
21
|
+
<script setup>
|
|
22
|
+
import { ref, inject, computed } from "vue";
|
|
23
|
+
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
context: Object,
|
|
26
|
+
editMode: Boolean,
|
|
27
|
+
primaryColor: String,
|
|
28
|
+
secondaryColor: String
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const document = inject('rawDocument');
|
|
32
|
+
const unlocked = ${unlocked};
|
|
33
|
+
|
|
34
|
+
// Raw value holds the actual UUIDs stored in the document
|
|
35
|
+
const rawValue = ref(foundry.utils.getProperty(document, '${getSystemPath(documentChoices)}') || []);
|
|
36
|
+
console.log("Raw Value:", rawValue);
|
|
37
|
+
|
|
38
|
+
// Computed value maps UUIDs to choice objects for v-model
|
|
39
|
+
const value = computed({
|
|
40
|
+
get() {
|
|
41
|
+
return rawValue.value.map(item => {
|
|
42
|
+
let context = {
|
|
43
|
+
id: item.uuid,
|
|
44
|
+
name: item.name,
|
|
45
|
+
image: item.img,
|
|
46
|
+
summary: truncate(item.system?.description || '', 50),
|
|
47
|
+
description: item.system?.description || ''
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
if (item.parent) {
|
|
51
|
+
context.source = "Self";
|
|
52
|
+
context.color = props.primaryColor;
|
|
53
|
+
context.icon = 'fa-solid fa-user';
|
|
54
|
+
}
|
|
55
|
+
else if (item.compendium) {
|
|
56
|
+
context.source = \`\${item.compendium.metadata.packageName} - \${item.compendium.title}\`;
|
|
57
|
+
context.color = props.secondaryColor;
|
|
58
|
+
context.icon = 'fa-solid fa-suitcase';
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
context.source = "World";
|
|
62
|
+
context.color = props.secondaryColor;
|
|
63
|
+
context.icon = 'fa-solid fa-globe';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return context;
|
|
67
|
+
}).filter(Boolean);
|
|
68
|
+
},
|
|
69
|
+
set(newValue) {
|
|
70
|
+
console.log("Updating Document choices to:", newValue);
|
|
71
|
+
rawValue.value = newValue;
|
|
72
|
+
document.update({ '${getSystemPath(documentChoices)}': newValue });
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const choices = computed(() => {
|
|
77
|
+
let system = props.context.system;
|
|
78
|
+
let allChoices = Array.from(document.items);
|
|
79
|
+
|
|
80
|
+
${globalAllowed ?
|
|
81
|
+
`
|
|
82
|
+
let gameItems = game.items.filter(item => item.type === '${(_b = documentChoices.document.ref) === null || _b === void 0 ? void 0 : _b.name.toLowerCase()}');
|
|
83
|
+
allChoices = allChoices.concat(gameItems);
|
|
84
|
+
|
|
85
|
+
let itemPacks = game.packs.filter(pack => pack.documentName === 'Item');
|
|
86
|
+
for (let pack of itemPacks) {
|
|
87
|
+
const packItems = pack.index.contents;
|
|
88
|
+
packItems.forEach(item => {
|
|
89
|
+
item.compendium = pack;
|
|
90
|
+
});
|
|
91
|
+
allChoices = allChoices.concat(packItems);
|
|
92
|
+
}
|
|
93
|
+
` : ''}
|
|
94
|
+
|
|
95
|
+
allChoices = allChoices.filter(item => {
|
|
96
|
+
if (item.type !== '${(_c = documentChoices.document.ref) === null || _c === void 0 ? void 0 : _c.name.toLowerCase()}') return false;
|
|
97
|
+
return ${(_e = translateExpression(entry, id, (_d = documentChoices.params.filter((x) => isWhereParam(x))[0]) === null || _d === void 0 ? void 0 : _d.value)) !== null && _e !== void 0 ? _e : true}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
if (allChoices.length === 0) return [{
|
|
101
|
+
id: null,
|
|
102
|
+
name: 'No choices available'
|
|
103
|
+
}];
|
|
104
|
+
|
|
105
|
+
return allChoices.map(choice => {
|
|
106
|
+
let context = {
|
|
107
|
+
id: choice.uuid,
|
|
108
|
+
name: choice.name,
|
|
109
|
+
image: choice.img,
|
|
110
|
+
summary: truncate(choice.system.description, 50),
|
|
111
|
+
description: choice.system.description
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
if (choice.parent) {
|
|
115
|
+
context.source = "Self";
|
|
116
|
+
context.color = props.primaryColor;
|
|
117
|
+
context.icon = 'fa-solid fa-user';
|
|
118
|
+
}
|
|
119
|
+
else if (choice.compendium) {
|
|
120
|
+
context.source = \`\${choice.compendium.metadata.packageName} - \${choice.compendium.title}\`;
|
|
121
|
+
context.color = props.secondaryColor;
|
|
122
|
+
context.icon = 'fa-solid fa-suitcase';
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
context.source = "World";
|
|
126
|
+
context.color = props.secondaryColor;
|
|
127
|
+
context.icon = 'fa-solid fa-globe';
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return context;
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const truncate = (text, maxLength) => {
|
|
135
|
+
if (text.length > maxLength) {
|
|
136
|
+
return text.substring(0, maxLength) + '...';
|
|
137
|
+
}
|
|
138
|
+
return text;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const getLabel = (label, icon) => {
|
|
142
|
+
const localized = game.i18n.localize(label);
|
|
143
|
+
if (icon) {
|
|
144
|
+
return \`<i class="\${icon}"></i> \${localized}\`;
|
|
145
|
+
}
|
|
146
|
+
return localized;
|
|
147
|
+
}
|
|
148
|
+
</script>
|
|
149
|
+
<template>
|
|
150
|
+
<v-autocomplete
|
|
151
|
+
clearable
|
|
152
|
+
dense
|
|
153
|
+
multiple
|
|
154
|
+
chips
|
|
155
|
+
v-model="value"
|
|
156
|
+
:items="choices"
|
|
157
|
+
item-title="name"
|
|
158
|
+
item-value="id"
|
|
159
|
+
density="compact"
|
|
160
|
+
variant="outlined"
|
|
161
|
+
class="double-wide"
|
|
162
|
+
>
|
|
163
|
+
<template #label>
|
|
164
|
+
<span v-html="getLabel('${document.name}.${documentChoices.name}', ${iconParam ? `'${iconParam.value}'` : undefined})" />
|
|
165
|
+
</template>
|
|
166
|
+
<template v-slot:item="{ props, item }">
|
|
167
|
+
<v-list-item
|
|
168
|
+
v-bind="props"
|
|
169
|
+
:data-tooltip="item.raw.description"
|
|
170
|
+
>
|
|
171
|
+
<template v-slot:title>
|
|
172
|
+
<div class="flexrow">
|
|
173
|
+
<p style="flex: 1">{{ item.raw.name }}</p>
|
|
174
|
+
<v-spacer />
|
|
175
|
+
<v-chip size="small" label :color="item.raw.color" style="align-self: center; white-space: nowrap; flex: 0; line-height: 26px; display: inline-table;"><v-icon :icon="item.raw.icon" start></v-icon> {{ item.raw.source }}</v-chip>
|
|
176
|
+
</div>
|
|
177
|
+
</template>
|
|
178
|
+
<template v-if="item.raw.image" v-slot:prepend>
|
|
179
|
+
<v-avatar rounded="0" :image="item.raw.image">
|
|
180
|
+
</v-avatar>
|
|
181
|
+
</template>
|
|
182
|
+
<template v-slot:subtitle>
|
|
183
|
+
<div v-html="item.raw.summary"></div>
|
|
184
|
+
</template>
|
|
185
|
+
</v-list-item>
|
|
186
|
+
</template>
|
|
187
|
+
<template v-slot:chip="{ props: chipProps, item }">
|
|
188
|
+
<v-chip
|
|
189
|
+
label
|
|
190
|
+
v-bind="chipProps"
|
|
191
|
+
:text="item.title"
|
|
192
|
+
>
|
|
193
|
+
<template v-slot:prepend v-if="item.raw?.image">
|
|
194
|
+
<v-avatar rounded="0" size="small" :image="item.raw.image" style="padding-right: 2px;"></v-avatar>
|
|
195
|
+
</template>
|
|
196
|
+
</v-chip>
|
|
197
|
+
</template>
|
|
198
|
+
</v-autocomplete>
|
|
199
|
+
</template>
|
|
200
|
+
`;
|
|
201
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=vue-document-choices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-document-choices.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-document-choices.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,EAA+D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAc,MAAM,uCAAuC,CAAC;AACnL,OAAO,EAAE,mBAAmB,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