intelligent-system-design-language 0.3.21 → 0.3.23
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 -38
- package/.claude/agents/typescript-vscode-expert.md +29 -29
- package/.claude/agents/ui-ux-designer.md +36 -36
- package/.claude/settings.local.json +33 -33
- package/.idea/inspectionProfiles/Project_Default.xml +6 -6
- package/.idea/isdl.iml +13 -13
- package/.idea/modules.xml +8 -8
- package/.idea/vcs.xml +6 -6
- package/.idea/watcherTasks.xml +3 -3
- package/.vscodeignore +18 -18
- package/LICENSE +673 -673
- package/README.md +86 -86
- package/bin/cli.js +4 -4
- package/bin/lsp.js +8 -8
- package/out/_backgrounds.scss +91 -91
- package/out/_handlebars.scss +497 -497
- package/out/_isdlStyles.scss +1444 -1381
- package/out/_vuetifyOverrides.scss +425 -425
- package/out/_vuetifyStyles.scss +31957 -31957
- package/out/cli/components/_backgrounds.scss +91 -91
- package/out/cli/components/_handlebars.scss +497 -497
- package/out/cli/components/_isdlStyles.scss +1444 -1381
- package/out/cli/components/_vuetifyOverrides.scss +425 -425
- package/out/cli/components/_vuetifyStyles.scss +31957 -31957
- package/out/cli/components/active-effect-sheet-generator.js +453 -453
- package/out/cli/components/chat-card-generator.js +654 -651
- package/out/cli/components/chat-card-generator.js.map +1 -1
- package/out/cli/components/css-generator.js +4 -4
- package/out/cli/components/damage-roll-generator.js +160 -160
- package/out/cli/components/datamodel-generator.js +264 -257
- package/out/cli/components/datamodel-generator.js.map +1 -1
- package/out/cli/components/derived-data-generator.js +923 -923
- package/out/cli/components/hotbar-drop-hook-generator.js +82 -82
- package/out/cli/components/init-hook-generator.js +495 -495
- package/out/cli/components/language-generator.js +1 -1
- package/out/cli/components/language-generator.js.map +1 -1
- package/out/cli/components/measured-template-preview.js +221 -221
- package/out/cli/components/method-generator.js +979 -887
- package/out/cli/components/method-generator.js.map +1 -1
- package/out/cli/components/ready-hook-generator.js +404 -404
- package/out/cli/components/token-generator.js +116 -116
- package/out/cli/components/vue/base-components/vue-attribute.js +138 -138
- package/out/cli/components/vue/base-components/vue-boolean.js +64 -64
- package/out/cli/components/vue/base-components/vue-calculator.js +93 -93
- package/out/cli/components/vue/base-components/vue-damage-application.js +356 -356
- package/out/cli/components/vue/base-components/vue-damage-bonuses.js +165 -165
- package/out/cli/components/vue/base-components/vue-damage-resistances.js +196 -196
- package/out/cli/components/vue/base-components/vue-damage-track.js +121 -121
- package/out/cli/components/vue/base-components/vue-date-time.js +42 -42
- package/out/cli/components/vue/base-components/vue-dice.js +98 -98
- package/out/cli/components/vue/base-components/vue-die.js +73 -73
- package/out/cli/components/vue/base-components/vue-document-choice.js +149 -149
- package/out/cli/components/vue/base-components/vue-document-choices.js +179 -179
- package/out/cli/components/vue/base-components/vue-document-link.js +60 -60
- package/out/cli/components/vue/base-components/vue-extended-choice.js +88 -88
- package/out/cli/components/vue/base-components/vue-inventory.js +519 -519
- package/out/cli/components/vue/base-components/vue-macro-choice.js +138 -138
- package/out/cli/components/vue/base-components/vue-measured-template.js +530 -530
- package/out/cli/components/vue/base-components/vue-money.js +483 -483
- package/out/cli/components/vue/base-components/vue-number.js +174 -174
- package/out/cli/components/vue/base-components/vue-paperdoll.js +43 -43
- package/out/cli/components/vue/base-components/vue-parent-property-reference.js +76 -76
- package/out/cli/components/vue/base-components/vue-prosemirror.js +18 -18
- package/out/cli/components/vue/base-components/vue-resource.js +136 -136
- package/out/cli/components/vue/base-components/vue-roll-visualizer.js +286 -109
- package/out/cli/components/vue/base-components/vue-roll-visualizer.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-self-property-reference.js +62 -62
- package/out/cli/components/vue/base-components/vue-string-choice.js +98 -98
- package/out/cli/components/vue/base-components/vue-string-choices.js +203 -203
- package/out/cli/components/vue/base-components/vue-string.js +60 -60
- package/out/cli/components/vue/base-components/vue-text-field.js +53 -53
- package/out/cli/components/vue/base-components/vue-tracker.js +431 -431
- package/out/cli/components/vue/vue-action-component-generator.js +64 -64
- package/out/cli/components/vue/vue-active-effect-sheet-generator.js +856 -856
- package/out/cli/components/vue/vue-datatable-sheet-class-generator.js +292 -292
- package/out/cli/components/vue/vue-datatable2-component-generator.js +824 -824
- package/out/cli/components/vue/vue-document-creation-app.js +121 -121
- package/out/cli/components/vue/vue-document-creation-sheet.js +94 -94
- package/out/cli/components/vue/vue-generator.js +40 -40
- package/out/cli/components/vue/vue-mixin.js +296 -296
- package/out/cli/components/vue/vue-pinned-datatable-component-generator.js +260 -260
- package/out/cli/components/vue/vue-prompt-generator.js +91 -76
- package/out/cli/components/vue/vue-prompt-generator.js.map +1 -1
- package/out/cli/components/vue/vue-prompt-sheet-class-generator.js +317 -317
- package/out/cli/components/vue/vue-sheet-application-generator.js +1177 -1167
- package/out/cli/components/vue/vue-sheet-application-generator.js.map +1 -1
- package/out/cli/components/vue/vue-sheet-class-generator.js +510 -510
- package/out/cli/generator.js +438 -433
- package/out/cli/generator.js.map +1 -1
- package/out/extension/github/githubAuthProvider.js +71 -29
- package/out/extension/github/githubAuthProvider.js.map +1 -1
- package/out/extension/github/githubGistManager.js +4 -3
- package/out/extension/github/githubGistManager.js.map +1 -1
- package/out/extension/github/githubManager.js +40 -38
- package/out/extension/github/githubManager.js.map +1 -1
- package/out/extension/github/githubQuickActions.js +120 -120
- package/out/extension/github/system-workflow.yml +47 -47
- package/out/extension/main.cjs +909 -532
- package/out/extension/main.cjs.map +3 -3
- package/out/extension/package.json +419 -419
- package/out/language/generated/ast.js +51 -2
- package/out/language/generated/ast.js.map +1 -1
- package/out/language/generated/grammar.js +14240 -13991
- package/out/language/generated/grammar.js.map +1 -1
- package/out/language/intelligent-system-design-language-validator.js +32 -2
- package/out/language/intelligent-system-design-language-validator.js.map +1 -1
- package/out/language/isdl-scope-provider.js +14 -1
- package/out/language/isdl-scope-provider.js.map +1 -1
- package/out/language/main.cjs +913 -569
- package/out/language/main.cjs.map +3 -3
- package/out/package.json +419 -419
- package/out/progressbar.min.js +6 -6
- package/out/styles.scss +762 -747
- package/out/test/validating/diagnostics.test.js +40 -0
- package/out/test/validating/diagnostics.test.js.map +1 -1
- package/package.json +419 -419
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-card-generator.js","sourceRoot":"","sources":["../../../src/cli/components/chat-card-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAmB,aAAa,EAAe,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAClH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEzD,MAAM,UAAU,qBAAqB,CAAC,KAAY,EAAE,WAAmB;IAEnE,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IACvE,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,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;KACvD;IAED,MAAM,EAAE,GAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAU,CAAC,KAAK,CAAC;IAEhG,SAAS,iBAAiB,CAAC,QAAkB;QACzC,MAAM,cAAc,GAAG,YAAY,CAAc,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CA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AE,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;KACvD;IAED,MAAM,QAAQ,GAAG,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2G5B,CAAC,uBAAuB,EAAE,CAAC;IAE5B,EAAE,CAAC,aAAa,CAAC,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -35,8 +35,8 @@ export function generateSystemCss(entry, id, destination) {
|
|
|
35
35
|
if (!fs.existsSync(generatedFileDir)) {
|
|
36
36
|
fs.mkdirSync(generatedFileDir, { recursive: true });
|
|
37
37
|
}
|
|
38
|
-
const fileNode = expandToNode `
|
|
39
|
-
${compileSCSS(id)}
|
|
38
|
+
const fileNode = expandToNode `
|
|
39
|
+
${compileSCSS(id)}
|
|
40
40
|
`.appendNewLineIfNotEmpty();
|
|
41
41
|
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
42
42
|
}
|
|
@@ -50,8 +50,8 @@ export function generateCustomCss(entry, id, destination) {
|
|
|
50
50
|
if (fs.existsSync(generatedFilePath)) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
const fileNode = expandToNode `
|
|
54
|
-
/* Custom CSS for ${id}. This file is empty by default and won't be overwritten by the generator. */
|
|
53
|
+
const fileNode = expandToNode `
|
|
54
|
+
/* Custom CSS for ${id}. This file is empty by default and won't be overwritten by the generator. */
|
|
55
55
|
`.appendNewLineIfNotEmpty();
|
|
56
56
|
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
57
57
|
}
|
|
@@ -7,166 +7,166 @@ export function generateDamageRoll(entry, id, destination) {
|
|
|
7
7
|
if (!fs.existsSync(generatedFileDir)) {
|
|
8
8
|
fs.mkdirSync(generatedFileDir, { recursive: true });
|
|
9
9
|
}
|
|
10
|
-
const fileNode = expandToNode `
|
|
11
|
-
import ${entry.config.name}Roll from "./roll.mjs";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Extended Roll class for damage with type metadata
|
|
15
|
-
*/
|
|
16
|
-
export default class ${entry.config.name}DamageRoll extends ${entry.config.name}Roll {
|
|
17
|
-
|
|
18
|
-
constructor(formula, data = {}, options = {}) {
|
|
19
|
-
// Add AE Damage Type Bonus if damage type is specified and actor exists
|
|
20
|
-
if (options.type?.value && data.actor) {
|
|
21
|
-
const damageTypeKey = options.type.value.toLowerCase().replace(/\\s+/g, '');
|
|
22
|
-
const bonusField = \`\${damageTypeKey}bonusdamage\`;
|
|
23
|
-
const aeBonus = data.actor.system[bonusField];
|
|
24
|
-
|
|
25
|
-
if (aeBonus && aeBonus !== 0) {
|
|
26
|
-
// Add the AE bonus as a separate term to the formula
|
|
27
|
-
formula = \`\${formula} + \${aeBonus}[AE \${options.type.value} Damage Bonus]\`;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
super(formula, data, options);
|
|
32
|
-
|
|
33
|
-
// Store damage type metadata
|
|
34
|
-
this._damageType = options.type?.value || null;
|
|
35
|
-
this._damageTypeData = options.type || {};
|
|
36
|
-
this.#createCustomPropertyAccessors();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/* -------------------------------------------- */
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The damage type of this roll
|
|
43
|
-
* @type {string}
|
|
44
|
-
*/
|
|
45
|
-
get type() {
|
|
46
|
-
return this._damageType;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The icon associated with this damage type
|
|
51
|
-
* @type {string}
|
|
52
|
-
*/
|
|
53
|
-
get icon() {
|
|
54
|
-
return this._damageTypeData.icon || '';
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* The color associated with this damage type
|
|
59
|
-
* @type {string}
|
|
60
|
-
*/
|
|
61
|
-
get color() {
|
|
62
|
-
return this._damageTypeData.color || '#ffffff';
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Get a custom metadata property for this damage type
|
|
67
|
-
* @param {string} key - The property key
|
|
68
|
-
* @returns {*} The property value
|
|
69
|
-
*/
|
|
70
|
-
getMetadata(key) {
|
|
71
|
-
return this._damageTypeData[key];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Get all custom metadata for this damage type
|
|
76
|
-
* @returns {object} All metadata properties
|
|
77
|
-
*/
|
|
78
|
-
get metadata() {
|
|
79
|
-
return this._damageTypeData;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Access custom properties directly on the roll
|
|
84
|
-
* Enables usage like: damageRoll.physical, damageRoll.magical, etc.
|
|
85
|
-
*/
|
|
86
|
-
#createCustomPropertyAccessors() {
|
|
87
|
-
if (this._damageTypeData) {
|
|
88
|
-
for (const [key, value] of Object.entries(this._damageTypeData)) {
|
|
89
|
-
if (!this.hasOwnProperty(key) && !this.constructor.prototype.hasOwnProperty(key)) {
|
|
90
|
-
Object.defineProperty(this, key, {
|
|
91
|
-
get: () => value,
|
|
92
|
-
enumerable: true,
|
|
93
|
-
configurable: true
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/* -------------------------------------------- */
|
|
101
|
-
|
|
102
|
-
/** @override */
|
|
103
|
-
async getTooltip() {
|
|
104
|
-
let tooltip = await super.getTooltip();
|
|
105
|
-
|
|
106
|
-
// Add damage type information to tooltip
|
|
107
|
-
if (this.type) {
|
|
108
|
-
// Add data attribute for styling
|
|
109
|
-
tooltip = tooltip.replace('<div class="dice-tooltip"',
|
|
110
|
-
\`<div class="dice-tooltip damage-tooltip" data-damage-type="\${this.type}"\`);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Build damage metadata section if we have metadata
|
|
114
|
-
if (this._damageTypeData && Object.keys(this._damageTypeData).length > 0) {
|
|
115
|
-
let metadataHtml = '<div class="damage-metadata" style="display: flex; gap: 0.5em; align-items: center;">';
|
|
116
|
-
|
|
117
|
-
// Add damage type with icon and color if available
|
|
118
|
-
if (this.type) {
|
|
119
|
-
metadataHtml += \`<span class="damage-property" data-property="type">Type: <span style="color: \${this.color};">\${this.type}</span></span>\`;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Add custom metadata properties (excluding standard ones)
|
|
123
|
-
const excludedKeys = ['value', 'icon', 'color', 'label'];
|
|
124
|
-
const customProperties = Object.entries(this._damageTypeData)
|
|
125
|
-
.filter(([key]) => !excludedKeys.includes(key));
|
|
126
|
-
|
|
127
|
-
for (const [key, value] of customProperties) {
|
|
128
|
-
if (value !== null && value !== undefined && value !== '') {
|
|
129
|
-
metadataHtml += \`<span class="damage-property" data-property="\${key}">\${key}: \${value}</span>\`;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
metadataHtml += '</div>';
|
|
134
|
-
|
|
135
|
-
const wrapper = document.createElement('div');
|
|
136
|
-
wrapper.innerHTML = tooltip;
|
|
137
|
-
|
|
138
|
-
// Choose the last .dice-tooltip (or use querySelector to pick a specific one)
|
|
139
|
-
const tips = wrapper.querySelectorAll('.dice-tooltip');
|
|
140
|
-
if (tips.length > 0) {
|
|
141
|
-
const tip = tips[tips.length - 1];
|
|
142
|
-
tip.insertAdjacentHTML('beforeend', metadataHtml);
|
|
143
|
-
tooltip = wrapper.innerHTML;
|
|
144
|
-
} else {
|
|
145
|
-
// fallback: append at end if no container found
|
|
146
|
-
tooltip += metadataHtml;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return tooltip;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/* -------------------------------------------- */
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Create a DamageRoll from a damage() function call
|
|
157
|
-
* @param {string} formula - The dice formula
|
|
158
|
-
* @param {string} damageType - The damage type value
|
|
159
|
-
* @param {object} damageTypeData - The metadata associated with the damage type
|
|
160
|
-
* @param {object} data - Roll data context
|
|
161
|
-
* @param {object} options - Additional roll options
|
|
162
|
-
* @returns {${entry.config.name}DamageRoll}
|
|
163
|
-
*/
|
|
164
|
-
static create(baseRoll, options = {}) {
|
|
165
|
-
const roll = new this(baseRoll._formula, baseRoll.data, options);
|
|
166
|
-
roll.#createCustomPropertyAccessors();
|
|
167
|
-
return roll;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
10
|
+
const fileNode = expandToNode `
|
|
11
|
+
import ${entry.config.name}Roll from "./roll.mjs";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Extended Roll class for damage with type metadata
|
|
15
|
+
*/
|
|
16
|
+
export default class ${entry.config.name}DamageRoll extends ${entry.config.name}Roll {
|
|
17
|
+
|
|
18
|
+
constructor(formula, data = {}, options = {}) {
|
|
19
|
+
// Add AE Damage Type Bonus if damage type is specified and actor exists
|
|
20
|
+
if (options.type?.value && data.actor) {
|
|
21
|
+
const damageTypeKey = options.type.value.toLowerCase().replace(/\\s+/g, '');
|
|
22
|
+
const bonusField = \`\${damageTypeKey}bonusdamage\`;
|
|
23
|
+
const aeBonus = data.actor.system[bonusField];
|
|
24
|
+
|
|
25
|
+
if (aeBonus && aeBonus !== 0) {
|
|
26
|
+
// Add the AE bonus as a separate term to the formula
|
|
27
|
+
formula = \`\${formula} + \${aeBonus}[AE \${options.type.value} Damage Bonus]\`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
super(formula, data, options);
|
|
32
|
+
|
|
33
|
+
// Store damage type metadata
|
|
34
|
+
this._damageType = options.type?.value || null;
|
|
35
|
+
this._damageTypeData = options.type || {};
|
|
36
|
+
this.#createCustomPropertyAccessors();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* -------------------------------------------- */
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The damage type of this roll
|
|
43
|
+
* @type {string}
|
|
44
|
+
*/
|
|
45
|
+
get type() {
|
|
46
|
+
return this._damageType;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The icon associated with this damage type
|
|
51
|
+
* @type {string}
|
|
52
|
+
*/
|
|
53
|
+
get icon() {
|
|
54
|
+
return this._damageTypeData.icon || '';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The color associated with this damage type
|
|
59
|
+
* @type {string}
|
|
60
|
+
*/
|
|
61
|
+
get color() {
|
|
62
|
+
return this._damageTypeData.color || '#ffffff';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get a custom metadata property for this damage type
|
|
67
|
+
* @param {string} key - The property key
|
|
68
|
+
* @returns {*} The property value
|
|
69
|
+
*/
|
|
70
|
+
getMetadata(key) {
|
|
71
|
+
return this._damageTypeData[key];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Get all custom metadata for this damage type
|
|
76
|
+
* @returns {object} All metadata properties
|
|
77
|
+
*/
|
|
78
|
+
get metadata() {
|
|
79
|
+
return this._damageTypeData;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Access custom properties directly on the roll
|
|
84
|
+
* Enables usage like: damageRoll.physical, damageRoll.magical, etc.
|
|
85
|
+
*/
|
|
86
|
+
#createCustomPropertyAccessors() {
|
|
87
|
+
if (this._damageTypeData) {
|
|
88
|
+
for (const [key, value] of Object.entries(this._damageTypeData)) {
|
|
89
|
+
if (!this.hasOwnProperty(key) && !this.constructor.prototype.hasOwnProperty(key)) {
|
|
90
|
+
Object.defineProperty(this, key, {
|
|
91
|
+
get: () => value,
|
|
92
|
+
enumerable: true,
|
|
93
|
+
configurable: true
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* -------------------------------------------- */
|
|
101
|
+
|
|
102
|
+
/** @override */
|
|
103
|
+
async getTooltip() {
|
|
104
|
+
let tooltip = await super.getTooltip();
|
|
105
|
+
|
|
106
|
+
// Add damage type information to tooltip
|
|
107
|
+
if (this.type) {
|
|
108
|
+
// Add data attribute for styling
|
|
109
|
+
tooltip = tooltip.replace('<div class="dice-tooltip"',
|
|
110
|
+
\`<div class="dice-tooltip damage-tooltip" data-damage-type="\${this.type}"\`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Build damage metadata section if we have metadata
|
|
114
|
+
if (this._damageTypeData && Object.keys(this._damageTypeData).length > 0) {
|
|
115
|
+
let metadataHtml = '<div class="damage-metadata" style="display: flex; gap: 0.5em; align-items: center;">';
|
|
116
|
+
|
|
117
|
+
// Add damage type with icon and color if available
|
|
118
|
+
if (this.type) {
|
|
119
|
+
metadataHtml += \`<span class="damage-property" data-property="type">Type: <span style="color: \${this.color};">\${this.type}</span></span>\`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Add custom metadata properties (excluding standard ones)
|
|
123
|
+
const excludedKeys = ['value', 'icon', 'color', 'label'];
|
|
124
|
+
const customProperties = Object.entries(this._damageTypeData)
|
|
125
|
+
.filter(([key]) => !excludedKeys.includes(key));
|
|
126
|
+
|
|
127
|
+
for (const [key, value] of customProperties) {
|
|
128
|
+
if (value !== null && value !== undefined && value !== '') {
|
|
129
|
+
metadataHtml += \`<span class="damage-property" data-property="\${key}">\${key}: \${value}</span>\`;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
metadataHtml += '</div>';
|
|
134
|
+
|
|
135
|
+
const wrapper = document.createElement('div');
|
|
136
|
+
wrapper.innerHTML = tooltip;
|
|
137
|
+
|
|
138
|
+
// Choose the last .dice-tooltip (or use querySelector to pick a specific one)
|
|
139
|
+
const tips = wrapper.querySelectorAll('.dice-tooltip');
|
|
140
|
+
if (tips.length > 0) {
|
|
141
|
+
const tip = tips[tips.length - 1];
|
|
142
|
+
tip.insertAdjacentHTML('beforeend', metadataHtml);
|
|
143
|
+
tooltip = wrapper.innerHTML;
|
|
144
|
+
} else {
|
|
145
|
+
// fallback: append at end if no container found
|
|
146
|
+
tooltip += metadataHtml;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return tooltip;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* -------------------------------------------- */
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Create a DamageRoll from a damage() function call
|
|
157
|
+
* @param {string} formula - The dice formula
|
|
158
|
+
* @param {string} damageType - The damage type value
|
|
159
|
+
* @param {object} damageTypeData - The metadata associated with the damage type
|
|
160
|
+
* @param {object} data - Roll data context
|
|
161
|
+
* @param {object} options - Additional roll options
|
|
162
|
+
* @returns {${entry.config.name}DamageRoll}
|
|
163
|
+
*/
|
|
164
|
+
static create(baseRoll, options = {}) {
|
|
165
|
+
const roll = new this(baseRoll._formula, baseRoll.data, options);
|
|
166
|
+
roll.#createCustomPropertyAccessors();
|
|
167
|
+
return roll;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
170
|
`.appendNewLineIfNotEmpty();
|
|
171
171
|
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
172
172
|
}
|