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,106 @@
|
|
|
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 generateCalculator(destination) {
|
|
5
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", "components");
|
|
6
|
+
const generatedFilePath = path.join(generatedFileDir, `calculator.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
|
+
systemPath: String,
|
|
16
|
+
context: Object,
|
|
17
|
+
primaryColor: String,
|
|
18
|
+
secondaryColor: String
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const document = inject("rawDocument");
|
|
22
|
+
|
|
23
|
+
const open = ref(false);
|
|
24
|
+
const value = ref(0);
|
|
25
|
+
const mode = ref("add");
|
|
26
|
+
const btn = ref(null);
|
|
27
|
+
|
|
28
|
+
const toggleCalculator = () => {
|
|
29
|
+
open.value = !open.value;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const swapMode = (modeName) => {
|
|
33
|
+
mode.value = modeName;
|
|
34
|
+
console.log("Swapping mode to", modeName);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const isActive = (modeName) => {
|
|
38
|
+
return mode.value === modeName ? "active" : "";
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const submit = () => {
|
|
42
|
+
const update = {};
|
|
43
|
+
const currentValue = foundry.utils.getProperty(document, props.systemPath);
|
|
44
|
+
let updateValue = value.value;
|
|
45
|
+
if (mode.value === "add") {
|
|
46
|
+
updateValue = currentValue + value.value;
|
|
47
|
+
} else if (mode.value === "subtract") {
|
|
48
|
+
updateValue = currentValue - value.value;
|
|
49
|
+
} else if (mode.value === "multiply") {
|
|
50
|
+
updateValue = currentValue * value.value;
|
|
51
|
+
} else if (mode.value === "divide") {
|
|
52
|
+
updateValue = currentValue / value.value;
|
|
53
|
+
}
|
|
54
|
+
if (isNaN(updateValue)) {
|
|
55
|
+
console.error("Invalid value", updateValue);
|
|
56
|
+
updateValue = 0;
|
|
57
|
+
}
|
|
58
|
+
update[props.systemPath] = updateValue;
|
|
59
|
+
document.update(update);
|
|
60
|
+
open.value = false;
|
|
61
|
+
};
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<div>
|
|
66
|
+
<v-icon icon="fa-solid fa-calculator" @click="toggleCalculator">
|
|
67
|
+
</v-icon>
|
|
68
|
+
<v-dialog v-model="open" max-width="340">
|
|
69
|
+
<template v-slot:default="{ open }">
|
|
70
|
+
<v-card title="Calculator">
|
|
71
|
+
<v-card-text>
|
|
72
|
+
<v-number-input
|
|
73
|
+
v-model="value"
|
|
74
|
+
label="Value"
|
|
75
|
+
controlVariant="stacked"
|
|
76
|
+
density="compact"
|
|
77
|
+
variant="outlined"
|
|
78
|
+
></v-number-input>
|
|
79
|
+
<v-btn-toggle v-model="mode" class="flexrow" mandatory divided>
|
|
80
|
+
<v-btn value="add" data-tooltip="Add" :color="primaryColor">
|
|
81
|
+
<v-icon icon="fa-solid fa-plus"></v-icon>
|
|
82
|
+
</v-btn>
|
|
83
|
+
<v-btn value="subtract" data-tooltip="Subtract" :color="primaryColor">
|
|
84
|
+
<v-icon icon="fa-solid fa-minus"></v-icon>
|
|
85
|
+
</v-btn>
|
|
86
|
+
<v-btn value="multiply" data-tooltip="Multiply" :color="primaryColor">
|
|
87
|
+
<v-icon icon="fa-solid fa-times"></v-icon>
|
|
88
|
+
</v-btn>
|
|
89
|
+
<v-btn value="divide" data-tooltip="Divide" :color="primaryColor">
|
|
90
|
+
<v-icon icon="fa-solid fa-divide"></v-icon>
|
|
91
|
+
</v-btn>
|
|
92
|
+
</v-btn-toggle>
|
|
93
|
+
</v-card-text>
|
|
94
|
+
<v-card-actions class="flexrow">
|
|
95
|
+
<v-btn text="Submit" @click="submit" prepend-icon="fa-solid fa-check" :color="primaryColor"></v-btn>
|
|
96
|
+
<v-btn text="Cancel" @click="toggleCalculator" prepend-icon="fa-solid fa-xmark" :color="secondaryColor"></v-btn>
|
|
97
|
+
</v-card-actions>
|
|
98
|
+
</v-card>
|
|
99
|
+
</template>
|
|
100
|
+
</v-dialog>
|
|
101
|
+
</div>
|
|
102
|
+
</template>
|
|
103
|
+
`;
|
|
104
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=vue-calculator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-calculator.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-calculator.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,kBAAkB,CAAC,WAAmB;IAC1D,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,gBAAgB,CAAC,CAAC;IAExE,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6F5B,CAAC;IAEF,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,369 @@
|
|
|
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 generateDamageApplicationComponent(destination) {
|
|
5
|
+
const generatedFileDir = path.join(destination, "system", "templates", "vue", "components");
|
|
6
|
+
const generatedFilePath = path.join(generatedFileDir, `damage-application.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
|
+
rollData: {
|
|
16
|
+
type: Object,
|
|
17
|
+
required: true,
|
|
18
|
+
default: () => ({
|
|
19
|
+
value: 0,
|
|
20
|
+
isDamageRoll: false,
|
|
21
|
+
damageType: null,
|
|
22
|
+
damageColor: null,
|
|
23
|
+
damageIcon: null,
|
|
24
|
+
metadata: {}
|
|
25
|
+
})
|
|
26
|
+
},
|
|
27
|
+
visible: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const emit = defineEmits(['close', 'apply']);
|
|
34
|
+
|
|
35
|
+
// Internal state
|
|
36
|
+
const selectedTargetType = ref('selected');
|
|
37
|
+
const selectedMultiplier = ref(1);
|
|
38
|
+
const showDialog = ref(false);
|
|
39
|
+
|
|
40
|
+
// Available multipliers
|
|
41
|
+
const multipliers = [
|
|
42
|
+
{ value: 0.25, label: '¼x' },
|
|
43
|
+
{ value: 0.5, label: '½x' },
|
|
44
|
+
{ value: 1, label: '1x' },
|
|
45
|
+
{ value: 1.5, label: '1.5x' },
|
|
46
|
+
{ value: 2, label: '2x' },
|
|
47
|
+
{ value: 3, label: '3x' },
|
|
48
|
+
{ value: 4, label: '4x' }
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
// Target type options
|
|
52
|
+
const targetTypes = [
|
|
53
|
+
{ value: 'targeted', label: 'Targeted', icon: 'fa-solid fa-bullseye' },
|
|
54
|
+
{ value: 'selected', label: 'Selected', icon: 'fa-solid fa-expand' }
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
// Watch for visibility changes
|
|
58
|
+
watch(() => props.visible, (newValue) => {
|
|
59
|
+
showDialog.value = newValue;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Computed values
|
|
63
|
+
const finalDamage = computed(() => {
|
|
64
|
+
return Math.floor(props.rollData.value * selectedMultiplier.value);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const targets = computed(() => {
|
|
68
|
+
const targetType = selectedTargetType.value;
|
|
69
|
+
const targetList = targetType === 'targeted'
|
|
70
|
+
? [...game.user.targets]
|
|
71
|
+
: (canvas?.tokens?.controlled ?? []);
|
|
72
|
+
|
|
73
|
+
return targetList;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const hasTargets = computed(() => targets.value.length > 0);
|
|
77
|
+
|
|
78
|
+
const damageTypeDisplay = computed(() => {
|
|
79
|
+
if (!props.rollData.isDamageRoll || !props.rollData.damageType) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
type: props.rollData.damageType,
|
|
85
|
+
color: props.rollData.damageColor || '#ffffff',
|
|
86
|
+
icon: props.rollData.damageIcon
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Methods
|
|
91
|
+
const closeDialog = () => {
|
|
92
|
+
showDialog.value = false;
|
|
93
|
+
emit('close');
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const applyDamage = (type = 'damage') => {
|
|
97
|
+
if (!hasTargets.value) {
|
|
98
|
+
ui.notifications.warn(game.i18n.localize(\`NOTIFICATIONS.\${selectedTargetType.value === 'targeted' ? 'NoTokenTargeted' : 'NoTokenSelected'}\`));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const context = {
|
|
103
|
+
amount: type === 'healing' ? -finalDamage.value : finalDamage.value,
|
|
104
|
+
multiplier: selectedMultiplier.value,
|
|
105
|
+
targetType: selectedTargetType.value,
|
|
106
|
+
damageType: props.rollData.isDamageRoll ? props.rollData.damageType : null,
|
|
107
|
+
damageMetadata: props.rollData.isDamageRoll ? props.rollData.metadata : {},
|
|
108
|
+
color: props.rollData.isDamageRoll ? props.rollData.damageColor : null,
|
|
109
|
+
icon: props.rollData.isDamageRoll ? props.rollData.damageIcon : null,
|
|
110
|
+
isDamageRoll: props.rollData.isDamageRoll
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
emit('apply', {
|
|
114
|
+
type,
|
|
115
|
+
targets: targets.value,
|
|
116
|
+
context
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
closeDialog();
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// Expose data for the Application sheet
|
|
123
|
+
const getApplicationData = () => {
|
|
124
|
+
return {
|
|
125
|
+
targets: targets.value,
|
|
126
|
+
context: {
|
|
127
|
+
amount: finalDamage.value,
|
|
128
|
+
multiplier: selectedMultiplier.value,
|
|
129
|
+
targetType: selectedTargetType.value
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// Expose the method to the parent component
|
|
135
|
+
const rawSheet = inject("rawSheet", null);
|
|
136
|
+
if (rawSheet && typeof rawSheet === 'object') {
|
|
137
|
+
rawSheet.getApplicationData = getApplicationData;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const applyHealing = () => applyDamage('healing');
|
|
141
|
+
const applyTemp = () => applyDamage('temp');
|
|
142
|
+
|
|
143
|
+
const selectTargetType = (type) => {
|
|
144
|
+
selectedTargetType.value = type;
|
|
145
|
+
game.settings.set(game.system.id, 'userTargetDamageApplicationType', type);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const selectMultiplier = (multiplier) => {
|
|
149
|
+
selectedMultiplier.value = multiplier;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// Initialize from settings
|
|
153
|
+
const initializeSettings = () => {
|
|
154
|
+
const allowTargeting = game.settings.get(game.system.id, 'allowTargetDamageApplication');
|
|
155
|
+
let targetType = game.settings.get(game.system.id, 'userTargetDamageApplicationType');
|
|
156
|
+
|
|
157
|
+
if (!allowTargeting && targetType !== 'selected') {
|
|
158
|
+
targetType = 'selected';
|
|
159
|
+
game.settings.set(game.system.id, 'userTargetDamageApplicationType', 'selected');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
selectedTargetType.value = targetType;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// Initialize on mount
|
|
166
|
+
initializeSettings();
|
|
167
|
+
</script>
|
|
168
|
+
|
|
169
|
+
<template>
|
|
170
|
+
<v-dialog
|
|
171
|
+
v-model="showDialog"
|
|
172
|
+
max-width="500"
|
|
173
|
+
persistent
|
|
174
|
+
@click:outside="closeDialog"
|
|
175
|
+
>
|
|
176
|
+
<v-card>
|
|
177
|
+
<v-card-title class="d-flex align-center">
|
|
178
|
+
<v-icon class="mr-2">mdi-sword-cross</v-icon>
|
|
179
|
+
Apply Damage
|
|
180
|
+
<v-spacer></v-spacer>
|
|
181
|
+
<v-btn
|
|
182
|
+
icon="mdi-close"
|
|
183
|
+
variant="text"
|
|
184
|
+
size="small"
|
|
185
|
+
@click="closeDialog"
|
|
186
|
+
></v-btn>
|
|
187
|
+
</v-card-title>
|
|
188
|
+
|
|
189
|
+
<v-card-text>
|
|
190
|
+
<!-- Damage Info -->
|
|
191
|
+
<div class="damage-info mb-4">
|
|
192
|
+
<div class="d-flex align-center mb-2">
|
|
193
|
+
<span class="text-h6 mr-2">{{ props.rollData.value }}</span>
|
|
194
|
+
<span v-if="damageTypeDisplay" class="damage-type-badge">
|
|
195
|
+
<v-icon
|
|
196
|
+
v-if="damageTypeDisplay.icon"
|
|
197
|
+
:icon="damageTypeDisplay.icon"
|
|
198
|
+
:color="damageTypeDisplay.color"
|
|
199
|
+
size="small"
|
|
200
|
+
class="mr-1"
|
|
201
|
+
></v-icon>
|
|
202
|
+
<span :style="{ color: damageTypeDisplay.color }">
|
|
203
|
+
{{ damageTypeDisplay.type }}
|
|
204
|
+
</span>
|
|
205
|
+
</span>
|
|
206
|
+
</div>
|
|
207
|
+
|
|
208
|
+
<!-- Damage metadata -->
|
|
209
|
+
<div v-if="props.rollData.isDamageRoll && Object.keys(props.rollData.metadata).length > 0"
|
|
210
|
+
class="damage-metadata">
|
|
211
|
+
<v-chip
|
|
212
|
+
v-for="(value, key) in props.rollData.metadata"
|
|
213
|
+
:key="key"
|
|
214
|
+
size="small"
|
|
215
|
+
variant="outlined"
|
|
216
|
+
class="mr-1 mb-1"
|
|
217
|
+
>
|
|
218
|
+
{{ key }}: {{ value }}
|
|
219
|
+
</v-chip>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
|
|
223
|
+
<!-- Target Selection -->
|
|
224
|
+
<div class="target-selection mb-4">
|
|
225
|
+
<h4 class="mb-2">Target Type</h4>
|
|
226
|
+
<v-btn-toggle
|
|
227
|
+
v-model="selectedTargetType"
|
|
228
|
+
mandatory
|
|
229
|
+
variant="outlined"
|
|
230
|
+
divided
|
|
231
|
+
>
|
|
232
|
+
<v-btn
|
|
233
|
+
v-for="targetType in targetTypes"
|
|
234
|
+
:key="targetType.value"
|
|
235
|
+
:value="targetType.value"
|
|
236
|
+
@click="selectTargetType(targetType.value)"
|
|
237
|
+
>
|
|
238
|
+
<v-icon :icon="targetType.icon" class="mr-1"></v-icon>
|
|
239
|
+
{{ targetType.label }}
|
|
240
|
+
</v-btn>
|
|
241
|
+
</v-btn-toggle>
|
|
242
|
+
|
|
243
|
+
<div class="mt-2">
|
|
244
|
+
<v-alert
|
|
245
|
+
v-if="!hasTargets"
|
|
246
|
+
type="warning"
|
|
247
|
+
density="compact"
|
|
248
|
+
class="mb-2"
|
|
249
|
+
>
|
|
250
|
+
No tokens {{ selectedTargetType === 'targeted' ? 'targeted' : 'selected' }}
|
|
251
|
+
</v-alert>
|
|
252
|
+
<v-chip
|
|
253
|
+
v-else
|
|
254
|
+
color="success"
|
|
255
|
+
size="small"
|
|
256
|
+
>
|
|
257
|
+
{{ targets.length }} target{{ targets.length !== 1 ? 's' : '' }}
|
|
258
|
+
</v-chip>
|
|
259
|
+
</div>
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
<!-- Multiplier Selection -->
|
|
263
|
+
<div class="multiplier-selection mb-4">
|
|
264
|
+
<h4 class="mb-2">Damage Multiplier</h4>
|
|
265
|
+
<v-btn-toggle
|
|
266
|
+
v-model="selectedMultiplier"
|
|
267
|
+
mandatory
|
|
268
|
+
variant="outlined"
|
|
269
|
+
divided
|
|
270
|
+
>
|
|
271
|
+
<v-btn
|
|
272
|
+
v-for="multiplier in multipliers"
|
|
273
|
+
:key="multiplier.value"
|
|
274
|
+
:value="multiplier.value"
|
|
275
|
+
@click="selectMultiplier(multiplier.value)"
|
|
276
|
+
size="small"
|
|
277
|
+
>
|
|
278
|
+
{{ multiplier.label }}
|
|
279
|
+
</v-btn>
|
|
280
|
+
</v-btn-toggle>
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
<!-- Final Damage Display -->
|
|
284
|
+
<div class="final-damage mb-4">
|
|
285
|
+
<v-card variant="outlined">
|
|
286
|
+
<v-card-text class="text-center">
|
|
287
|
+
<div class="text-h5">
|
|
288
|
+
Final Damage: {{ finalDamage }}
|
|
289
|
+
</div>
|
|
290
|
+
<div v-if="selectedMultiplier !== 1" class="text-caption">
|
|
291
|
+
({{ props.rollData.value }} × {{ selectedMultiplier }})
|
|
292
|
+
</div>
|
|
293
|
+
</v-card-text>
|
|
294
|
+
</v-card>
|
|
295
|
+
</div>
|
|
296
|
+
</v-card-text>
|
|
297
|
+
|
|
298
|
+
<v-card-actions>
|
|
299
|
+
<v-btn
|
|
300
|
+
color="error"
|
|
301
|
+
variant="elevated"
|
|
302
|
+
prepend-icon="mdi-sword"
|
|
303
|
+
:disabled="!hasTargets"
|
|
304
|
+
@click="applyDamage('damage')"
|
|
305
|
+
>
|
|
306
|
+
Apply Damage
|
|
307
|
+
</v-btn>
|
|
308
|
+
|
|
309
|
+
<v-btn
|
|
310
|
+
color="success"
|
|
311
|
+
variant="elevated"
|
|
312
|
+
prepend-icon="mdi-medical-bag"
|
|
313
|
+
:disabled="!hasTargets"
|
|
314
|
+
@click="applyHealing"
|
|
315
|
+
>
|
|
316
|
+
Apply Healing
|
|
317
|
+
</v-btn>
|
|
318
|
+
|
|
319
|
+
<v-btn
|
|
320
|
+
color="info"
|
|
321
|
+
variant="elevated"
|
|
322
|
+
prepend-icon="mdi-heart"
|
|
323
|
+
:disabled="!hasTargets"
|
|
324
|
+
@click="applyTemp"
|
|
325
|
+
>
|
|
326
|
+
Temp HP
|
|
327
|
+
</v-btn>
|
|
328
|
+
|
|
329
|
+
<v-spacer></v-spacer>
|
|
330
|
+
|
|
331
|
+
<v-btn
|
|
332
|
+
variant="text"
|
|
333
|
+
@click="closeDialog"
|
|
334
|
+
>
|
|
335
|
+
Cancel
|
|
336
|
+
</v-btn>
|
|
337
|
+
</v-card-actions>
|
|
338
|
+
</v-card>
|
|
339
|
+
</v-dialog>
|
|
340
|
+
</template>
|
|
341
|
+
|
|
342
|
+
<style scoped>
|
|
343
|
+
.damage-type-badge {
|
|
344
|
+
display: inline-flex;
|
|
345
|
+
align-items: center;
|
|
346
|
+
padding: 2px 8px;
|
|
347
|
+
border-radius: 12px;
|
|
348
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
349
|
+
font-size: 0.875rem;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.damage-metadata {
|
|
353
|
+
margin-top: 8px;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.target-selection, .multiplier-selection {
|
|
357
|
+
border: 1px solid rgba(0, 0, 0, 0.12);
|
|
358
|
+
border-radius: 4px;
|
|
359
|
+
padding: 12px;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.final-damage {
|
|
363
|
+
margin-top: 16px;
|
|
364
|
+
}
|
|
365
|
+
</style>
|
|
366
|
+
`.appendNewLine();
|
|
367
|
+
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
368
|
+
}
|
|
369
|
+
//# sourceMappingURL=vue-damage-application.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-damage-application.js","sourceRoot":"","sources":["../../../../../src/cli/components/vue/base-components/vue-damage-application.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,kCAAkC,CAAC,WAAmB;IAC1E,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,wBAAwB,CAAC,CAAC;IAEhF,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoW5B,CAAC,aAAa,EAAE,CAAC;IAElB,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|