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
|
@@ -37,269 +37,269 @@ export function generatePinnedVuetifyDatatableComponent(id, document, pinnedFiel
|
|
|
37
37
|
const parentDocument = AstUtils.getContainerOfType(action, isDocument);
|
|
38
38
|
return `${parentDocument === null || parentDocument === void 0 ? void 0 : parentDocument.name}.${action.name}`;
|
|
39
39
|
}
|
|
40
|
-
const fileNode = expandToNode `
|
|
41
|
-
<script setup>
|
|
42
|
-
import { ref, computed, inject, onMounted, watch } from "vue";
|
|
43
|
-
|
|
44
|
-
const props = defineProps({
|
|
45
|
-
systemPath: String,
|
|
46
|
-
context: Object,
|
|
47
|
-
primaryColor: String,
|
|
48
|
-
secondaryColor: String,
|
|
49
|
-
tertiaryColor: String
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const document = inject('rawDocument');
|
|
53
|
-
const search = ref('');
|
|
54
|
-
const loading = ref(false);
|
|
55
|
-
|
|
56
|
-
// Function to get actions for a specific document type
|
|
57
|
-
const getActionsForType = (itemType) => {
|
|
58
|
-
const actionsMap = {
|
|
40
|
+
const fileNode = expandToNode `
|
|
41
|
+
<script setup>
|
|
42
|
+
import { ref, computed, inject, onMounted, watch } from "vue";
|
|
43
|
+
|
|
44
|
+
const props = defineProps({
|
|
45
|
+
systemPath: String,
|
|
46
|
+
context: Object,
|
|
47
|
+
primaryColor: String,
|
|
48
|
+
secondaryColor: String,
|
|
49
|
+
tertiaryColor: String
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const document = inject('rawDocument');
|
|
53
|
+
const search = ref('');
|
|
54
|
+
const loading = ref(false);
|
|
55
|
+
|
|
56
|
+
// Function to get actions for a specific document type
|
|
57
|
+
const getActionsForType = (itemType) => {
|
|
58
|
+
const actionsMap = {
|
|
59
59
|
${joinToNode(Array.from(documentActionsMap.entries()), ([docType, actions]) => expandToNode `'${docType}': [${joinToNode(actions, action => {
|
|
60
60
|
var _a, _b, _c, _d;
|
|
61
|
-
return expandToNode `{
|
|
62
|
-
name: '${action.name.toLowerCase()}',
|
|
63
|
-
icon: '${(_b = (_a = action.params.find(p => isIconParam(p))) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "fa-solid fa-bolt"}',
|
|
64
|
-
color: '${(_d = (_c = action.params.find(p => isColorParam(p))) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : "primary"}',
|
|
65
|
-
label: '${getActionLabel(action)}'
|
|
61
|
+
return expandToNode `{
|
|
62
|
+
name: '${action.name.toLowerCase()}',
|
|
63
|
+
icon: '${(_b = (_a = action.params.find(p => isIconParam(p))) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "fa-solid fa-bolt"}',
|
|
64
|
+
color: '${(_d = (_c = action.params.find(p => isColorParam(p))) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : "primary"}',
|
|
65
|
+
label: '${getActionLabel(action)}'
|
|
66
66
|
}`;
|
|
67
|
-
}, { separator: ', ' })}]`, { separator: ',\n ' })}
|
|
68
|
-
};
|
|
69
|
-
return actionsMap[itemType.toLowerCase()] || [];
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// Get all pinned items from the actor's items collection
|
|
73
|
-
const data = computed(() => {
|
|
74
|
-
if (!document || !document.items) return [];
|
|
75
|
-
|
|
76
|
-
return Array.from(document.items.values())
|
|
77
|
-
.filter(item => item.system?.pinned === true)
|
|
78
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const humanize = (str) => {
|
|
82
|
-
if (!str) return "";
|
|
83
|
-
let humanized = str.replace(/_/g, " ");
|
|
84
|
-
humanized = humanized.replace("system.", "").replaceAll(".", " ");
|
|
85
|
-
humanized = humanized.charAt(0).toUpperCase() + humanized.slice(1);
|
|
86
|
-
return humanized;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const editItem = (item) => {
|
|
90
|
-
const foundryItem = document.items.get(item._id);
|
|
91
|
-
foundryItem.sheet.render(true);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const sendItemToChat = async (item) => {
|
|
95
|
-
const foundryItem = document.items.get(item._id);
|
|
96
|
-
const chatDescription = foundryItem.description ?? foundryItem.system.description;
|
|
97
|
-
const content = await renderTemplate("systems/${id}/system/templates/chat/standard-card.hbs", {
|
|
98
|
-
cssClass: "${id}",
|
|
99
|
-
document: foundryItem,
|
|
100
|
-
hasEffects: foundryItem.effects?.size > 0,
|
|
101
|
-
description: chatDescription,
|
|
102
|
-
hasDescription: chatDescription != ""
|
|
103
|
-
});
|
|
104
|
-
ChatMessage.create({
|
|
105
|
-
content: content,
|
|
106
|
-
speaker: ChatMessage.getSpeaker(),
|
|
107
|
-
style: CONST.CHAT_MESSAGE_STYLES.IC
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const deleteItem = async (item) => {
|
|
112
|
-
const foundryItem = document.items.get(item._id);
|
|
113
|
-
const shouldDelete = await Dialog.confirm({
|
|
114
|
-
title: "Delete Confirmation",
|
|
115
|
-
content: \`<p>Are you sure you would like to delete the "\${foundryItem.name}" Item?</p>\`,
|
|
116
|
-
defaultYes: false
|
|
117
|
-
});
|
|
118
|
-
if (shouldDelete) foundryItem.delete();
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const customItemAction = async (item, actionName) => {
|
|
122
|
-
const foundryItem = document.items.get(item._id);
|
|
123
|
-
const event = { currentTarget: { dataset: { action: actionName } } };
|
|
124
|
-
foundryItem.sheet._onAction(event);
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const togglePin = async (item) => {
|
|
128
|
-
const foundryItem = document.items.get(item._id);
|
|
129
|
-
await foundryItem.update({"system.pinned": !foundryItem.system.pinned});
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const bindDragDrop = () => {
|
|
133
|
-
try {
|
|
134
|
-
if (document.sheet.element) {
|
|
135
|
-
document.sheet.dragDrop.forEach((d) => d.bind(document.sheet.element));
|
|
136
|
-
}
|
|
137
|
-
} catch (e) {
|
|
138
|
-
console.error(e);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
// Bind drag drop after component mount
|
|
143
|
-
setTimeout(() => bindDragDrop(), 100);
|
|
144
|
-
</script>
|
|
145
|
-
|
|
146
|
-
<template>
|
|
147
|
-
<v-card flat class="isdl-datatable pt-2">
|
|
148
|
-
<v-card-title class="d-flex align-center pe-1" style="height: 40px;">
|
|
149
|
-
<v-icon icon="${icon}" size="small" />
|
|
150
|
-
{{ game.i18n.localize("${label}") }}
|
|
151
|
-
<v-spacer></v-spacer>
|
|
152
|
-
<v-text-field
|
|
153
|
-
v-model="search"
|
|
154
|
-
density="compact"
|
|
155
|
-
label="Search"
|
|
156
|
-
prepend-inner-icon="fa-solid fa-magnify"
|
|
157
|
-
variant="outlined"
|
|
158
|
-
flat
|
|
159
|
-
hide-details
|
|
160
|
-
single-line
|
|
161
|
-
clearable
|
|
162
|
-
style="margin: 0; margin-right: 8px;"
|
|
163
|
-
></v-text-field>
|
|
164
|
-
</v-card-title>
|
|
165
|
-
<v-divider></v-divider>
|
|
166
|
-
|
|
167
|
-
<v-data-table
|
|
168
|
-
v-model:search="search"
|
|
169
|
-
:items="data"
|
|
170
|
-
:search="search"
|
|
171
|
-
hover
|
|
172
|
-
density="compact"
|
|
173
|
-
hide-default-footer
|
|
174
|
-
items-per-page=-1
|
|
175
|
-
style="background: none;"
|
|
176
|
-
class="custom-datatable"
|
|
177
|
-
:sort-by="[{ key: 'system.pinned', order: 'desc' }, { key: 'name', order: 'asc' }]"
|
|
178
|
-
>
|
|
179
|
-
<template #headers>
|
|
180
|
-
<tr>
|
|
181
|
-
<th class="text-left font-weight-medium" style="width: 40px;"></th>
|
|
182
|
-
<th class="text-left font-weight-medium" style="width: 50px;">{{ game.i18n.localize("Image") }}</th>
|
|
183
|
-
<th class="text-left font-weight-medium">{{ game.i18n.localize("Name") }}</th>
|
|
184
|
-
<th class="text-center font-weight-medium" style="width: 100px;">{{ game.i18n.localize("Type") }}</th>
|
|
185
|
-
<th class="text-center font-weight-medium" style="width: 150px;">{{ game.i18n.localize("Actions") }}</th>
|
|
186
|
-
</tr>
|
|
187
|
-
</template>
|
|
188
|
-
|
|
189
|
-
<!-- Pin toggle slot -->
|
|
190
|
-
<template v-slot:item="{ item }">
|
|
191
|
-
<tr :data-item-id="item._id" :data-document-id="document._id" :data-uuid="item.uuid">
|
|
192
|
-
<td class="text-center" style="width: 40px;">
|
|
193
|
-
<v-btn
|
|
194
|
-
icon
|
|
195
|
-
size="small"
|
|
196
|
-
variant="text"
|
|
197
|
-
@click="togglePin(item)"
|
|
198
|
-
:data-tooltip="'Unpin'"
|
|
199
|
-
>
|
|
200
|
-
<v-icon
|
|
201
|
-
icon="fa-solid fa-thumbtack"
|
|
202
|
-
:color="primaryColor || '#ffd700'"
|
|
203
|
-
size="small"
|
|
204
|
-
></v-icon>
|
|
205
|
-
</v-btn>
|
|
206
|
-
</td>
|
|
207
|
-
|
|
208
|
-
<!-- Image slot -->
|
|
209
|
-
<td style="width: 50px;">
|
|
210
|
-
<v-avatar size="32" rounded="0">
|
|
211
|
-
<v-img :src="item.img" :alt="item.name" cover></v-img>
|
|
212
|
-
</v-avatar>
|
|
213
|
-
</td>
|
|
214
|
-
|
|
215
|
-
<!-- Name slot -->
|
|
216
|
-
<td>
|
|
217
|
-
<div class="d-flex align-center" :data-tooltip="item.system.description">
|
|
218
|
-
<div class="font-weight-medium">{{ item.name }}</div>
|
|
219
|
-
</div>
|
|
220
|
-
</td>
|
|
221
|
-
|
|
222
|
-
<!-- Type slot -->
|
|
223
|
-
<td class="text-center" style="width: 100px;">
|
|
224
|
-
<v-chip
|
|
225
|
-
size="small"
|
|
226
|
-
variant="outlined"
|
|
227
|
-
class="text-caption"
|
|
228
|
-
color="primary"
|
|
229
|
-
>
|
|
230
|
-
{{ item.type }}
|
|
231
|
-
</v-chip>
|
|
232
|
-
</td>
|
|
233
|
-
|
|
234
|
-
<!-- Actions slot -->
|
|
235
|
-
<td class="text-center" style="width: 150px;">
|
|
236
|
-
<div class="d-flex align-center justify-center ga-1">
|
|
237
|
-
<template v-for="action in getActionsForType(item.type)" :key="action.name">
|
|
238
|
-
<v-tooltip :text="game.i18n.localize(action.label)">
|
|
239
|
-
<template v-slot:activator="{ props }">
|
|
240
|
-
<v-btn
|
|
241
|
-
v-bind="props"
|
|
242
|
-
:icon="action.icon"
|
|
243
|
-
size="x-small"
|
|
244
|
-
variant="text"
|
|
245
|
-
:color="action.color"
|
|
246
|
-
@click="customItemAction(item, action.name)"
|
|
247
|
-
></v-btn>
|
|
248
|
-
</template>
|
|
249
|
-
</v-tooltip>
|
|
250
|
-
</template>
|
|
251
|
-
<v-tooltip text="Edit">
|
|
252
|
-
<template v-slot:activator="{ props }">
|
|
253
|
-
<v-btn
|
|
254
|
-
v-bind="props"
|
|
255
|
-
icon="fa-solid fa-edit"
|
|
256
|
-
size="x-small"
|
|
257
|
-
variant="text"
|
|
258
|
-
@click="editItem(item)"
|
|
259
|
-
></v-btn>
|
|
260
|
-
</template>
|
|
261
|
-
</v-tooltip>
|
|
262
|
-
<v-tooltip text="Send to Chat">
|
|
263
|
-
<template v-slot:activator="{ props }">
|
|
264
|
-
<v-btn
|
|
265
|
-
v-bind="props"
|
|
266
|
-
icon="fa-solid fa-message"
|
|
267
|
-
size="x-small"
|
|
268
|
-
variant="text"
|
|
269
|
-
@click="sendItemToChat(item)"
|
|
270
|
-
></v-btn>
|
|
271
|
-
</template>
|
|
272
|
-
</v-tooltip>
|
|
273
|
-
<v-tooltip text="Delete">
|
|
274
|
-
<template v-slot:activator="{ props }">
|
|
275
|
-
<v-btn
|
|
276
|
-
v-bind="props"
|
|
277
|
-
icon="fa-solid fa-trash"
|
|
278
|
-
size="x-small"
|
|
279
|
-
variant="text"
|
|
280
|
-
color="error"
|
|
281
|
-
@click="deleteItem(item)"
|
|
282
|
-
></v-btn>
|
|
283
|
-
</template>
|
|
284
|
-
</v-tooltip>
|
|
285
|
-
</div>
|
|
286
|
-
</td>
|
|
287
|
-
</tr>
|
|
288
|
-
</template>
|
|
289
|
-
|
|
290
|
-
<!-- No data slot -->
|
|
291
|
-
<template v-slot:no-data>
|
|
292
|
-
<div class="text-center pa-4">
|
|
293
|
-
<v-icon size="48" color="grey-lighten-1">fa-solid fa-thumbtack</v-icon>
|
|
294
|
-
<div class="text-h6 mt-2">No pinned items</div>
|
|
295
|
-
<div class="text-body-2 text-medium-emphasis">
|
|
296
|
-
Pin items from your inventory to see them here
|
|
297
|
-
</div>
|
|
298
|
-
</div>
|
|
299
|
-
</template>
|
|
300
|
-
</v-data-table>
|
|
301
|
-
</v-card>
|
|
302
|
-
</template>
|
|
67
|
+
}, { separator: ', ' })}]`, { separator: ',\n ' })}
|
|
68
|
+
};
|
|
69
|
+
return actionsMap[itemType.toLowerCase()] || [];
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Get all pinned items from the actor's items collection
|
|
73
|
+
const data = computed(() => {
|
|
74
|
+
if (!document || !document.items) return [];
|
|
75
|
+
|
|
76
|
+
return Array.from(document.items.values())
|
|
77
|
+
.filter(item => item.system?.pinned === true)
|
|
78
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const humanize = (str) => {
|
|
82
|
+
if (!str) return "";
|
|
83
|
+
let humanized = str.replace(/_/g, " ");
|
|
84
|
+
humanized = humanized.replace("system.", "").replaceAll(".", " ");
|
|
85
|
+
humanized = humanized.charAt(0).toUpperCase() + humanized.slice(1);
|
|
86
|
+
return humanized;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const editItem = (item) => {
|
|
90
|
+
const foundryItem = document.items.get(item._id);
|
|
91
|
+
foundryItem.sheet.render(true);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const sendItemToChat = async (item) => {
|
|
95
|
+
const foundryItem = document.items.get(item._id);
|
|
96
|
+
const chatDescription = foundryItem.description ?? foundryItem.system.description;
|
|
97
|
+
const content = await renderTemplate("systems/${id}/system/templates/chat/standard-card.hbs", {
|
|
98
|
+
cssClass: "${id}",
|
|
99
|
+
document: foundryItem,
|
|
100
|
+
hasEffects: foundryItem.effects?.size > 0,
|
|
101
|
+
description: chatDescription,
|
|
102
|
+
hasDescription: chatDescription != ""
|
|
103
|
+
});
|
|
104
|
+
ChatMessage.create({
|
|
105
|
+
content: content,
|
|
106
|
+
speaker: ChatMessage.getSpeaker(),
|
|
107
|
+
style: CONST.CHAT_MESSAGE_STYLES.IC
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const deleteItem = async (item) => {
|
|
112
|
+
const foundryItem = document.items.get(item._id);
|
|
113
|
+
const shouldDelete = await Dialog.confirm({
|
|
114
|
+
title: "Delete Confirmation",
|
|
115
|
+
content: \`<p>Are you sure you would like to delete the "\${foundryItem.name}" Item?</p>\`,
|
|
116
|
+
defaultYes: false
|
|
117
|
+
});
|
|
118
|
+
if (shouldDelete) foundryItem.delete();
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const customItemAction = async (item, actionName) => {
|
|
122
|
+
const foundryItem = document.items.get(item._id);
|
|
123
|
+
const event = { currentTarget: { dataset: { action: actionName } } };
|
|
124
|
+
foundryItem.sheet._onAction(event);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const togglePin = async (item) => {
|
|
128
|
+
const foundryItem = document.items.get(item._id);
|
|
129
|
+
await foundryItem.update({"system.pinned": !foundryItem.system.pinned});
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const bindDragDrop = () => {
|
|
133
|
+
try {
|
|
134
|
+
if (document.sheet.element) {
|
|
135
|
+
document.sheet.dragDrop.forEach((d) => d.bind(document.sheet.element));
|
|
136
|
+
}
|
|
137
|
+
} catch (e) {
|
|
138
|
+
console.error(e);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Bind drag drop after component mount
|
|
143
|
+
setTimeout(() => bindDragDrop(), 100);
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<template>
|
|
147
|
+
<v-card flat class="isdl-datatable pt-2">
|
|
148
|
+
<v-card-title class="d-flex align-center pe-1" style="height: 40px;">
|
|
149
|
+
<v-icon icon="${icon}" size="small" />
|
|
150
|
+
{{ game.i18n.localize("${label}") }}
|
|
151
|
+
<v-spacer></v-spacer>
|
|
152
|
+
<v-text-field
|
|
153
|
+
v-model="search"
|
|
154
|
+
density="compact"
|
|
155
|
+
label="Search"
|
|
156
|
+
prepend-inner-icon="fa-solid fa-magnify"
|
|
157
|
+
variant="outlined"
|
|
158
|
+
flat
|
|
159
|
+
hide-details
|
|
160
|
+
single-line
|
|
161
|
+
clearable
|
|
162
|
+
style="margin: 0; margin-right: 8px;"
|
|
163
|
+
></v-text-field>
|
|
164
|
+
</v-card-title>
|
|
165
|
+
<v-divider></v-divider>
|
|
166
|
+
|
|
167
|
+
<v-data-table
|
|
168
|
+
v-model:search="search"
|
|
169
|
+
:items="data"
|
|
170
|
+
:search="search"
|
|
171
|
+
hover
|
|
172
|
+
density="compact"
|
|
173
|
+
hide-default-footer
|
|
174
|
+
items-per-page=-1
|
|
175
|
+
style="background: none;"
|
|
176
|
+
class="custom-datatable"
|
|
177
|
+
:sort-by="[{ key: 'system.pinned', order: 'desc' }, { key: 'name', order: 'asc' }]"
|
|
178
|
+
>
|
|
179
|
+
<template #headers>
|
|
180
|
+
<tr>
|
|
181
|
+
<th class="text-left font-weight-medium" style="width: 40px;"></th>
|
|
182
|
+
<th class="text-left font-weight-medium" style="width: 50px;">{{ game.i18n.localize("Image") }}</th>
|
|
183
|
+
<th class="text-left font-weight-medium">{{ game.i18n.localize("Name") }}</th>
|
|
184
|
+
<th class="text-center font-weight-medium" style="width: 100px;">{{ game.i18n.localize("Type") }}</th>
|
|
185
|
+
<th class="text-center font-weight-medium" style="width: 150px;">{{ game.i18n.localize("Actions") }}</th>
|
|
186
|
+
</tr>
|
|
187
|
+
</template>
|
|
188
|
+
|
|
189
|
+
<!-- Pin toggle slot -->
|
|
190
|
+
<template v-slot:item="{ item }">
|
|
191
|
+
<tr :data-item-id="item._id" :data-document-id="document._id" :data-uuid="item.uuid">
|
|
192
|
+
<td class="text-center" style="width: 40px;">
|
|
193
|
+
<v-btn
|
|
194
|
+
icon
|
|
195
|
+
size="small"
|
|
196
|
+
variant="text"
|
|
197
|
+
@click="togglePin(item)"
|
|
198
|
+
:data-tooltip="'Unpin'"
|
|
199
|
+
>
|
|
200
|
+
<v-icon
|
|
201
|
+
icon="fa-solid fa-thumbtack"
|
|
202
|
+
:color="primaryColor || '#ffd700'"
|
|
203
|
+
size="small"
|
|
204
|
+
></v-icon>
|
|
205
|
+
</v-btn>
|
|
206
|
+
</td>
|
|
207
|
+
|
|
208
|
+
<!-- Image slot -->
|
|
209
|
+
<td style="width: 50px;">
|
|
210
|
+
<v-avatar size="32" rounded="0">
|
|
211
|
+
<v-img :src="item.img" :alt="item.name" cover></v-img>
|
|
212
|
+
</v-avatar>
|
|
213
|
+
</td>
|
|
214
|
+
|
|
215
|
+
<!-- Name slot -->
|
|
216
|
+
<td>
|
|
217
|
+
<div class="d-flex align-center" :data-tooltip="item.system.description">
|
|
218
|
+
<div class="font-weight-medium">{{ item.name }}</div>
|
|
219
|
+
</div>
|
|
220
|
+
</td>
|
|
221
|
+
|
|
222
|
+
<!-- Type slot -->
|
|
223
|
+
<td class="text-center" style="width: 100px;">
|
|
224
|
+
<v-chip
|
|
225
|
+
size="small"
|
|
226
|
+
variant="outlined"
|
|
227
|
+
class="text-caption"
|
|
228
|
+
color="primary"
|
|
229
|
+
>
|
|
230
|
+
{{ item.type }}
|
|
231
|
+
</v-chip>
|
|
232
|
+
</td>
|
|
233
|
+
|
|
234
|
+
<!-- Actions slot -->
|
|
235
|
+
<td class="text-center" style="width: 150px;">
|
|
236
|
+
<div class="d-flex align-center justify-center ga-1">
|
|
237
|
+
<template v-for="action in getActionsForType(item.type)" :key="action.name">
|
|
238
|
+
<v-tooltip :text="game.i18n.localize(action.label)">
|
|
239
|
+
<template v-slot:activator="{ props }">
|
|
240
|
+
<v-btn
|
|
241
|
+
v-bind="props"
|
|
242
|
+
:icon="action.icon"
|
|
243
|
+
size="x-small"
|
|
244
|
+
variant="text"
|
|
245
|
+
:color="action.color"
|
|
246
|
+
@click="customItemAction(item, action.name)"
|
|
247
|
+
></v-btn>
|
|
248
|
+
</template>
|
|
249
|
+
</v-tooltip>
|
|
250
|
+
</template>
|
|
251
|
+
<v-tooltip text="Edit">
|
|
252
|
+
<template v-slot:activator="{ props }">
|
|
253
|
+
<v-btn
|
|
254
|
+
v-bind="props"
|
|
255
|
+
icon="fa-solid fa-edit"
|
|
256
|
+
size="x-small"
|
|
257
|
+
variant="text"
|
|
258
|
+
@click="editItem(item)"
|
|
259
|
+
></v-btn>
|
|
260
|
+
</template>
|
|
261
|
+
</v-tooltip>
|
|
262
|
+
<v-tooltip text="Send to Chat">
|
|
263
|
+
<template v-slot:activator="{ props }">
|
|
264
|
+
<v-btn
|
|
265
|
+
v-bind="props"
|
|
266
|
+
icon="fa-solid fa-message"
|
|
267
|
+
size="x-small"
|
|
268
|
+
variant="text"
|
|
269
|
+
@click="sendItemToChat(item)"
|
|
270
|
+
></v-btn>
|
|
271
|
+
</template>
|
|
272
|
+
</v-tooltip>
|
|
273
|
+
<v-tooltip text="Delete">
|
|
274
|
+
<template v-slot:activator="{ props }">
|
|
275
|
+
<v-btn
|
|
276
|
+
v-bind="props"
|
|
277
|
+
icon="fa-solid fa-trash"
|
|
278
|
+
size="x-small"
|
|
279
|
+
variant="text"
|
|
280
|
+
color="error"
|
|
281
|
+
@click="deleteItem(item)"
|
|
282
|
+
></v-btn>
|
|
283
|
+
</template>
|
|
284
|
+
</v-tooltip>
|
|
285
|
+
</div>
|
|
286
|
+
</td>
|
|
287
|
+
</tr>
|
|
288
|
+
</template>
|
|
289
|
+
|
|
290
|
+
<!-- No data slot -->
|
|
291
|
+
<template v-slot:no-data>
|
|
292
|
+
<div class="text-center pa-4">
|
|
293
|
+
<v-icon size="48" color="grey-lighten-1">fa-solid fa-thumbtack</v-icon>
|
|
294
|
+
<div class="text-h6 mt-2">No pinned items</div>
|
|
295
|
+
<div class="text-body-2 text-medium-emphasis">
|
|
296
|
+
Pin items from your inventory to see them here
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
299
|
+
</template>
|
|
300
|
+
</v-data-table>
|
|
301
|
+
</v-card>
|
|
302
|
+
</template>
|
|
303
303
|
`.appendNewLine();
|
|
304
304
|
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
305
305
|
}
|