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
|
@@ -7,133 +7,133 @@ export function generateDocumentCreationVueSheet(entry, id, destination) {
|
|
|
7
7
|
if (!fs.existsSync(generatedFileDir)) {
|
|
8
8
|
fs.mkdirSync(generatedFileDir, { recursive: true });
|
|
9
9
|
}
|
|
10
|
-
const fileNode = expandToNode `
|
|
11
|
-
${generateVueComponentScript()}
|
|
12
|
-
${generateVueComponentTemplate()}
|
|
10
|
+
const fileNode = expandToNode `
|
|
11
|
+
${generateVueComponentScript()}
|
|
12
|
+
${generateVueComponentTemplate()}
|
|
13
13
|
`.appendNewLineIfNotEmpty();
|
|
14
14
|
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
15
15
|
function generateVueComponentScript() {
|
|
16
|
-
return expandToNode `
|
|
17
|
-
<script setup>
|
|
18
|
-
import { ref, inject, computed } from 'vue';
|
|
19
|
-
|
|
20
|
-
const props = defineProps(['context']);
|
|
21
|
-
|
|
22
|
-
// Colors
|
|
23
|
-
const primaryColor = ref('#1565c0');
|
|
24
|
-
const secondaryColor = ref('#4db6ac');
|
|
25
|
-
const tertiaryColor = ref('#ffb74d');
|
|
26
|
-
|
|
27
|
-
const hasFolders = props.context.folders.length > 0;
|
|
28
|
-
const name = ref('');
|
|
29
|
-
const folder = ref(props.context.folder ?? '');
|
|
30
|
-
const type = ref(props.context.type ?? '');
|
|
31
|
-
|
|
32
|
-
const selectedImage = ref(props.context.types.find(x => x.type == type.value)?.icon || 'icons/svg/mystery-man.svg');
|
|
33
|
-
|
|
34
|
-
const onChange = (value) => {
|
|
35
|
-
selectedImage.value = props.context.types.find(x => x.type == type.value)?.icon || 'icons/svg/mystery-man.svg';
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const sheet = inject("rawSheet");
|
|
39
|
-
|
|
40
|
-
const submit = () => {
|
|
41
|
-
sheet.submit();
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const cancel = () => {
|
|
45
|
-
sheet.cancel();
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const getLabel = (label, icon) => {
|
|
49
|
-
const localized = game.i18n.localize(label);
|
|
50
|
-
if (icon) {
|
|
51
|
-
return \`<i class="\${icon}"></i> \${localized}\`;
|
|
52
|
-
}
|
|
53
|
-
return localized;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
</script>
|
|
16
|
+
return expandToNode `
|
|
17
|
+
<script setup>
|
|
18
|
+
import { ref, inject, computed } from 'vue';
|
|
19
|
+
|
|
20
|
+
const props = defineProps(['context']);
|
|
21
|
+
|
|
22
|
+
// Colors
|
|
23
|
+
const primaryColor = ref('#1565c0');
|
|
24
|
+
const secondaryColor = ref('#4db6ac');
|
|
25
|
+
const tertiaryColor = ref('#ffb74d');
|
|
26
|
+
|
|
27
|
+
const hasFolders = props.context.folders.length > 0;
|
|
28
|
+
const name = ref('');
|
|
29
|
+
const folder = ref(props.context.folder ?? '');
|
|
30
|
+
const type = ref(props.context.type ?? '');
|
|
31
|
+
|
|
32
|
+
const selectedImage = ref(props.context.types.find(x => x.type == type.value)?.icon || 'icons/svg/mystery-man.svg');
|
|
33
|
+
|
|
34
|
+
const onChange = (value) => {
|
|
35
|
+
selectedImage.value = props.context.types.find(x => x.type == type.value)?.icon || 'icons/svg/mystery-man.svg';
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const sheet = inject("rawSheet");
|
|
39
|
+
|
|
40
|
+
const submit = () => {
|
|
41
|
+
sheet.submit();
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const cancel = () => {
|
|
45
|
+
sheet.cancel();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const getLabel = (label, icon) => {
|
|
49
|
+
const localized = game.i18n.localize(label);
|
|
50
|
+
if (icon) {
|
|
51
|
+
return \`<i class="\${icon}"></i> \${localized}\`;
|
|
52
|
+
}
|
|
53
|
+
return localized;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
</script>
|
|
57
57
|
`;
|
|
58
58
|
}
|
|
59
59
|
function generateVueComponentTemplate() {
|
|
60
|
-
return expandToNode `
|
|
61
|
-
<template>
|
|
62
|
-
<v-app>
|
|
63
|
-
<!-- Main Content -->
|
|
64
|
-
<v-main class="d-flex">
|
|
65
|
-
<v-container class="topography" fluid>
|
|
66
|
-
<v-col>
|
|
67
|
-
<v-row>
|
|
68
|
-
<v-text-field
|
|
69
|
-
v-model="name"
|
|
70
|
-
name="name"
|
|
71
|
-
label="Document Name"
|
|
72
|
-
outlined
|
|
73
|
-
:clearable="true"
|
|
74
|
-
aria-autocomplete="none"
|
|
75
|
-
></v-text-field>
|
|
76
|
-
</v-row>
|
|
77
|
-
|
|
78
|
-
<v-row>
|
|
79
|
-
<v-autocomplete
|
|
80
|
-
v-model="type"
|
|
81
|
-
@update:modelValue="onChange"
|
|
82
|
-
name="type"
|
|
83
|
-
:items="props.context.types"
|
|
84
|
-
label="Document Type"
|
|
85
|
-
item-title="label"
|
|
86
|
-
item-value="type"
|
|
87
|
-
outlined
|
|
88
|
-
required
|
|
89
|
-
>
|
|
90
|
-
<template v-slot:prepend-inner>
|
|
91
|
-
<v-avatar rounded="0" :image="selectedImage" size="30"</v-avatar>
|
|
92
|
-
</template>
|
|
93
|
-
<template v-slot:item="{ props, item }">
|
|
94
|
-
<v-list-item
|
|
95
|
-
v-bind="props"
|
|
96
|
-
:data-tooltip="item.raw.description"
|
|
97
|
-
>
|
|
98
|
-
<template v-slot:title>
|
|
99
|
-
<div class="flexrow">
|
|
100
|
-
<p style="flex: 1">{{ item.raw.label }}</p>
|
|
101
|
-
</div>
|
|
102
|
-
</template>
|
|
103
|
-
<template v-if="item.raw.icon" v-slot:prepend>
|
|
104
|
-
<v-avatar rounded="0" :image="item.raw.icon" style="background: lightgray;">
|
|
105
|
-
</v-avatar>
|
|
106
|
-
</template>
|
|
107
|
-
<template v-slot:subtitle>
|
|
108
|
-
<div v-html="item.raw.description"></div>
|
|
109
|
-
</template>
|
|
110
|
-
</v-list-item>
|
|
111
|
-
</template>
|
|
112
|
-
</v-autocomplete>
|
|
113
|
-
</v-row>
|
|
114
|
-
|
|
115
|
-
<v-row v-if="hasFolders">
|
|
116
|
-
<v-select
|
|
117
|
-
v-model="folder"
|
|
118
|
-
:items="props.context.folders"
|
|
119
|
-
name="folder"
|
|
120
|
-
item-title="name"
|
|
121
|
-
item-value="id"
|
|
122
|
-
label="Select Folder"
|
|
123
|
-
outlined
|
|
124
|
-
:clearable="true"
|
|
125
|
-
></v-select>
|
|
126
|
-
</v-row>
|
|
127
|
-
|
|
128
|
-
<v-row class="mt-4 flexrow">
|
|
129
|
-
<v-btn @click="submit" :color="primaryColor" class="ma-1 action-btn">Submit</v-btn>
|
|
130
|
-
<v-btn @click="cancel" :color="secondaryColor" class="ma-1 action-btn">Cancel</v-btn>
|
|
131
|
-
</v-row>
|
|
132
|
-
</v-col>
|
|
133
|
-
</v-container>
|
|
134
|
-
</v-main>
|
|
135
|
-
</v-app>
|
|
136
|
-
</template>
|
|
60
|
+
return expandToNode `
|
|
61
|
+
<template>
|
|
62
|
+
<v-app>
|
|
63
|
+
<!-- Main Content -->
|
|
64
|
+
<v-main class="d-flex">
|
|
65
|
+
<v-container class="topography" fluid>
|
|
66
|
+
<v-col>
|
|
67
|
+
<v-row>
|
|
68
|
+
<v-text-field
|
|
69
|
+
v-model="name"
|
|
70
|
+
name="name"
|
|
71
|
+
label="Document Name"
|
|
72
|
+
outlined
|
|
73
|
+
:clearable="true"
|
|
74
|
+
aria-autocomplete="none"
|
|
75
|
+
></v-text-field>
|
|
76
|
+
</v-row>
|
|
77
|
+
|
|
78
|
+
<v-row>
|
|
79
|
+
<v-autocomplete
|
|
80
|
+
v-model="type"
|
|
81
|
+
@update:modelValue="onChange"
|
|
82
|
+
name="type"
|
|
83
|
+
:items="props.context.types"
|
|
84
|
+
label="Document Type"
|
|
85
|
+
item-title="label"
|
|
86
|
+
item-value="type"
|
|
87
|
+
outlined
|
|
88
|
+
required
|
|
89
|
+
>
|
|
90
|
+
<template v-slot:prepend-inner>
|
|
91
|
+
<v-avatar rounded="0" :image="selectedImage" size="30"</v-avatar>
|
|
92
|
+
</template>
|
|
93
|
+
<template v-slot:item="{ props, item }">
|
|
94
|
+
<v-list-item
|
|
95
|
+
v-bind="props"
|
|
96
|
+
:data-tooltip="item.raw.description"
|
|
97
|
+
>
|
|
98
|
+
<template v-slot:title>
|
|
99
|
+
<div class="flexrow">
|
|
100
|
+
<p style="flex: 1">{{ item.raw.label }}</p>
|
|
101
|
+
</div>
|
|
102
|
+
</template>
|
|
103
|
+
<template v-if="item.raw.icon" v-slot:prepend>
|
|
104
|
+
<v-avatar rounded="0" :image="item.raw.icon" style="background: lightgray;">
|
|
105
|
+
</v-avatar>
|
|
106
|
+
</template>
|
|
107
|
+
<template v-slot:subtitle>
|
|
108
|
+
<div v-html="item.raw.description"></div>
|
|
109
|
+
</template>
|
|
110
|
+
</v-list-item>
|
|
111
|
+
</template>
|
|
112
|
+
</v-autocomplete>
|
|
113
|
+
</v-row>
|
|
114
|
+
|
|
115
|
+
<v-row v-if="hasFolders">
|
|
116
|
+
<v-select
|
|
117
|
+
v-model="folder"
|
|
118
|
+
:items="props.context.folders"
|
|
119
|
+
name="folder"
|
|
120
|
+
item-title="name"
|
|
121
|
+
item-value="id"
|
|
122
|
+
label="Select Folder"
|
|
123
|
+
outlined
|
|
124
|
+
:clearable="true"
|
|
125
|
+
></v-select>
|
|
126
|
+
</v-row>
|
|
127
|
+
|
|
128
|
+
<v-row class="mt-4 flexrow">
|
|
129
|
+
<v-btn @click="submit" :color="primaryColor" class="ma-1 action-btn">Submit</v-btn>
|
|
130
|
+
<v-btn @click="cancel" :color="secondaryColor" class="ma-1 action-btn">Cancel</v-btn>
|
|
131
|
+
</v-row>
|
|
132
|
+
</v-col>
|
|
133
|
+
</v-container>
|
|
134
|
+
</v-main>
|
|
135
|
+
</v-app>
|
|
136
|
+
</template>
|
|
137
137
|
`.appendNewLineIfNotEmpty();
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -7,100 +7,100 @@ export function generateDocumentCreationDialog(entry, id, destination) {
|
|
|
7
7
|
if (!fs.existsSync(generatedFileDir)) {
|
|
8
8
|
fs.mkdirSync(generatedFileDir, { recursive: true });
|
|
9
9
|
}
|
|
10
|
-
const fileNode = expandToNode `
|
|
11
|
-
import VueRenderingMixin from './VueRenderingMixin.mjs';
|
|
12
|
-
import { DocumentCreationApp } from "./components/components.vue.es.mjs";
|
|
13
|
-
export default class DocumentCreationVueDialog extends VueRenderingMixin(foundry.applications.api.ApplicationV2) {
|
|
14
|
-
|
|
15
|
-
constructor(resolve, reject, options= {}) {
|
|
16
|
-
super(options);
|
|
17
|
-
this.resolve = resolve;
|
|
18
|
-
this.reject = reject;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
vueParts = {
|
|
22
|
-
"document-creation": {
|
|
23
|
-
component: DocumentCreationApp,
|
|
24
|
-
template: "<document-creation :context=\\"context\\">Vue rendering for dialog failed.</document-creation>"
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
_arrayEntryKey = 0;
|
|
29
|
-
_renderKey = 0;
|
|
30
|
-
|
|
31
|
-
/** @override */
|
|
32
|
-
static DEFAULT_OPTIONS = {
|
|
33
|
-
classes: ["${id}", "sheet", "vue-sheet", "document-creation"],
|
|
34
|
-
position: {
|
|
35
|
-
width: 400,
|
|
36
|
-
// Size to content so the short create form isn't a fixed window with empty
|
|
37
|
-
// space below it (the .document-creation styles neutralize Vuetify's min-height).
|
|
38
|
-
height: "auto",
|
|
39
|
-
},
|
|
40
|
-
window: {
|
|
41
|
-
resizable: false,
|
|
42
|
-
title: "Document Creation"
|
|
43
|
-
},
|
|
44
|
-
tag: "form",
|
|
45
|
-
actions: {
|
|
46
|
-
},
|
|
47
|
-
changeActions: {
|
|
48
|
-
},
|
|
49
|
-
// Custom property that's merged into this.options
|
|
50
|
-
dragDrop: [
|
|
51
|
-
],
|
|
52
|
-
form: {
|
|
53
|
-
submitOnChange: false,
|
|
54
|
-
submitOnClose: true,
|
|
55
|
-
closeOnSubmit: true
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
async _prepareContext(options) {
|
|
60
|
-
const context = {
|
|
61
|
-
types: [],
|
|
62
|
-
folders: [],
|
|
63
|
-
title: "",
|
|
64
|
-
name: "",
|
|
65
|
-
type: "",
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
// Merge options into context
|
|
69
|
-
if (this.options) {
|
|
70
|
-
foundry.utils.mergeObject(context, this.options);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
console.dir(context);
|
|
74
|
-
return context;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
static async prompt(options = {}) {
|
|
78
|
-
return new Promise((resolve, reject) => {
|
|
79
|
-
const app = new this(resolve, reject, options);
|
|
80
|
-
app.render({force: true, focus: true});
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
close() {
|
|
85
|
-
this.reject(new Error("The Dialog was closed without a choice being made."));
|
|
86
|
-
super.close();
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
submit() {
|
|
90
|
-
const formData = new FormDataExtended(this.element);
|
|
91
|
-
const data = { };
|
|
92
|
-
for (const [key, value] of formData.entries()) {
|
|
93
|
-
data[key] = value;
|
|
94
|
-
}
|
|
95
|
-
this.resolve(data);
|
|
96
|
-
this.close();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
cancel() {
|
|
100
|
-
this.reject(new Error("The Dialog was closed without a choice being made."));
|
|
101
|
-
this.close();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
10
|
+
const fileNode = expandToNode `
|
|
11
|
+
import VueRenderingMixin from './VueRenderingMixin.mjs';
|
|
12
|
+
import { DocumentCreationApp } from "./components/components.vue.es.mjs";
|
|
13
|
+
export default class DocumentCreationVueDialog extends VueRenderingMixin(foundry.applications.api.ApplicationV2) {
|
|
14
|
+
|
|
15
|
+
constructor(resolve, reject, options= {}) {
|
|
16
|
+
super(options);
|
|
17
|
+
this.resolve = resolve;
|
|
18
|
+
this.reject = reject;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
vueParts = {
|
|
22
|
+
"document-creation": {
|
|
23
|
+
component: DocumentCreationApp,
|
|
24
|
+
template: "<document-creation :context=\\"context\\">Vue rendering for dialog failed.</document-creation>"
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
_arrayEntryKey = 0;
|
|
29
|
+
_renderKey = 0;
|
|
30
|
+
|
|
31
|
+
/** @override */
|
|
32
|
+
static DEFAULT_OPTIONS = {
|
|
33
|
+
classes: ["${id}", "sheet", "vue-sheet", "document-creation"],
|
|
34
|
+
position: {
|
|
35
|
+
width: 400,
|
|
36
|
+
// Size to content so the short create form isn't a fixed window with empty
|
|
37
|
+
// space below it (the .document-creation styles neutralize Vuetify's min-height).
|
|
38
|
+
height: "auto",
|
|
39
|
+
},
|
|
40
|
+
window: {
|
|
41
|
+
resizable: false,
|
|
42
|
+
title: "Document Creation"
|
|
43
|
+
},
|
|
44
|
+
tag: "form",
|
|
45
|
+
actions: {
|
|
46
|
+
},
|
|
47
|
+
changeActions: {
|
|
48
|
+
},
|
|
49
|
+
// Custom property that's merged into this.options
|
|
50
|
+
dragDrop: [
|
|
51
|
+
],
|
|
52
|
+
form: {
|
|
53
|
+
submitOnChange: false,
|
|
54
|
+
submitOnClose: true,
|
|
55
|
+
closeOnSubmit: true
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
async _prepareContext(options) {
|
|
60
|
+
const context = {
|
|
61
|
+
types: [],
|
|
62
|
+
folders: [],
|
|
63
|
+
title: "",
|
|
64
|
+
name: "",
|
|
65
|
+
type: "",
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Merge options into context
|
|
69
|
+
if (this.options) {
|
|
70
|
+
foundry.utils.mergeObject(context, this.options);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
console.dir(context);
|
|
74
|
+
return context;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static async prompt(options = {}) {
|
|
78
|
+
return new Promise((resolve, reject) => {
|
|
79
|
+
const app = new this(resolve, reject, options);
|
|
80
|
+
app.render({force: true, focus: true});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
close() {
|
|
85
|
+
this.reject(new Error("The Dialog was closed without a choice being made."));
|
|
86
|
+
super.close();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
submit() {
|
|
90
|
+
const formData = new FormDataExtended(this.element);
|
|
91
|
+
const data = { };
|
|
92
|
+
for (const [key, value] of formData.entries()) {
|
|
93
|
+
data[key] = value;
|
|
94
|
+
}
|
|
95
|
+
this.resolve(data);
|
|
96
|
+
this.close();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
cancel() {
|
|
100
|
+
this.reject(new Error("The Dialog was closed without a choice being made."));
|
|
101
|
+
this.close();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
104
|
`.appendNewLineIfNotEmpty();
|
|
105
105
|
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
106
106
|
}
|
|
@@ -177,58 +177,58 @@ function generateIndexMjs(entry, destination) {
|
|
|
177
177
|
const type = isActor(document) ? 'actor' : 'item';
|
|
178
178
|
const page = AstUtils.getContainerOfType(datatable, isPage);
|
|
179
179
|
const pageName = page ? page.name : document.name;
|
|
180
|
-
return expandToNode `
|
|
181
|
-
export { default as ${type}${document.name}${pageName}${datatable.name}VuetifyDatatable } from "./${type}/${document.name.toLowerCase()}/components/datatables/${document.name.toLowerCase()}${pageName}${datatable.name}VuetifyDatatable.vue";
|
|
180
|
+
return expandToNode `
|
|
181
|
+
export { default as ${type}${document.name}${pageName}${datatable.name}VuetifyDatatable } from "./${type}/${document.name.toLowerCase()}/components/datatables/${document.name.toLowerCase()}${pageName}${datatable.name}VuetifyDatatable.vue";
|
|
182
182
|
`;
|
|
183
183
|
}
|
|
184
184
|
function generatePinnedExport(datatable) {
|
|
185
185
|
const type = isActor(document) ? 'actor' : 'item';
|
|
186
186
|
const page = AstUtils.getContainerOfType(datatable, isPage);
|
|
187
187
|
const pageName = page ? page.name : document.name;
|
|
188
|
-
return expandToNode `
|
|
189
|
-
export { default as ${type}${document.name}${pageName}${datatable.name}VuetifyDatatable } from "./${type}/${document.name.toLowerCase()}/components/datatables/${document.name.toLowerCase()}${pageName}${datatable.name}VuetifyDatatable.vue";
|
|
188
|
+
return expandToNode `
|
|
189
|
+
export { default as ${type}${document.name}${pageName}${datatable.name}VuetifyDatatable } from "./${type}/${document.name.toLowerCase()}/components/datatables/${document.name.toLowerCase()}${pageName}${datatable.name}VuetifyDatatable.vue";
|
|
190
190
|
`;
|
|
191
191
|
}
|
|
192
192
|
const tables = getAllOfType(document.body, isTableField, false);
|
|
193
193
|
const pinned = getAllOfType(document.body, isPinnedField, false);
|
|
194
|
-
return expandToNode `
|
|
195
|
-
${joinToNode(tables, generateVuetifyDatableExport, { separator: "\n" })}
|
|
196
|
-
${joinToNode(pinned, generatePinnedExport, { separator: "\n" })}
|
|
194
|
+
return expandToNode `
|
|
195
|
+
${joinToNode(tables, generateVuetifyDatableExport, { separator: "\n" })}
|
|
196
|
+
${joinToNode(pinned, generatePinnedExport, { separator: "\n" })}
|
|
197
197
|
`;
|
|
198
198
|
}
|
|
199
|
-
const fileNode = expandToNode `
|
|
200
|
-
export { default as Attribute } from './components/attribute.vue';
|
|
201
|
-
export { default as Resource } from './components/resource.vue';
|
|
202
|
-
export { default as DocumentLink } from './components/document-link.vue';
|
|
203
|
-
export { default as ProseMirror } from './components/prosemirror.vue';
|
|
204
|
-
export { default as RollVisualizer } from './components/roll-visualizer.vue';
|
|
205
|
-
export { default as Paperdoll } from './components/paperdoll.vue';
|
|
206
|
-
export { default as Calculator } from './components/calculator.vue';
|
|
207
|
-
export { default as TextField } from './components/text-field.vue';
|
|
208
|
-
export { default as DateTime } from './components/date-time.vue';
|
|
209
|
-
export { default as Tracker } from './components/tracker.vue';
|
|
210
|
-
export { default as ActiveEffectApp } from './active-effect-app.vue';
|
|
211
|
-
export { default as DocumentCreationApp } from './document-create-app.vue';
|
|
212
|
-
export { default as MacroField } from './components/macro-field.vue';
|
|
213
|
-
export { default as MeasuredTemplateField } from './components/measured-template.vue';
|
|
214
|
-
export { default as ExtendedChoiceField } from './components/extended-choice-field.vue';
|
|
215
|
-
export { default as DiceField } from './components/dice.vue';
|
|
216
|
-
export { default as DamageBonuses } from "./components/damage-bonuses.vue";
|
|
217
|
-
export { default as DamageResistances } from "./components/damage-resistances.vue";
|
|
218
|
-
export { default as BooleanField } from "./components/boolean.vue";
|
|
219
|
-
export { default as DieField } from "./components/die.vue";
|
|
220
|
-
export { default as StringMethodField } from "./components/string-method.vue";
|
|
221
|
-
export { default as NumberField } from "./components/number.vue";
|
|
222
|
-
export { default as StringChoiceField } from "./components/string-choice.vue";
|
|
223
|
-
export { default as StringChoicesField } from "./components/string-choices.vue";
|
|
224
|
-
export { default as ParentPropertyReferenceField } from "./components/parent-property-reference.vue";
|
|
225
|
-
export { default as SelfPropertyReferenceField } from "./components/self-property-reference.vue";
|
|
226
|
-
export { default as MoneyField } from "./components/money.vue";
|
|
227
|
-
export { default as Inventory } from "./components/inventory.vue";
|
|
228
|
-
export { default as DamageTrack } from "./components/damage-track.vue";
|
|
229
|
-
${joinToNode(entry.documents.map(generateExport), { appendNewLineIfNotEmpty: true })}
|
|
230
|
-
${joinToNode(entry.documents.map(generateDocumentPromptExports), { appendNewLineIfNotEmpty: true })}
|
|
231
|
-
${joinToNode(entry.documents.map(generateDatatableExportForDocument), { appendNewLineIfNotEmpty: true })}
|
|
199
|
+
const fileNode = expandToNode `
|
|
200
|
+
export { default as Attribute } from './components/attribute.vue';
|
|
201
|
+
export { default as Resource } from './components/resource.vue';
|
|
202
|
+
export { default as DocumentLink } from './components/document-link.vue';
|
|
203
|
+
export { default as ProseMirror } from './components/prosemirror.vue';
|
|
204
|
+
export { default as RollVisualizer } from './components/roll-visualizer.vue';
|
|
205
|
+
export { default as Paperdoll } from './components/paperdoll.vue';
|
|
206
|
+
export { default as Calculator } from './components/calculator.vue';
|
|
207
|
+
export { default as TextField } from './components/text-field.vue';
|
|
208
|
+
export { default as DateTime } from './components/date-time.vue';
|
|
209
|
+
export { default as Tracker } from './components/tracker.vue';
|
|
210
|
+
export { default as ActiveEffectApp } from './active-effect-app.vue';
|
|
211
|
+
export { default as DocumentCreationApp } from './document-create-app.vue';
|
|
212
|
+
export { default as MacroField } from './components/macro-field.vue';
|
|
213
|
+
export { default as MeasuredTemplateField } from './components/measured-template.vue';
|
|
214
|
+
export { default as ExtendedChoiceField } from './components/extended-choice-field.vue';
|
|
215
|
+
export { default as DiceField } from './components/dice.vue';
|
|
216
|
+
export { default as DamageBonuses } from "./components/damage-bonuses.vue";
|
|
217
|
+
export { default as DamageResistances } from "./components/damage-resistances.vue";
|
|
218
|
+
export { default as BooleanField } from "./components/boolean.vue";
|
|
219
|
+
export { default as DieField } from "./components/die.vue";
|
|
220
|
+
export { default as StringMethodField } from "./components/string-method.vue";
|
|
221
|
+
export { default as NumberField } from "./components/number.vue";
|
|
222
|
+
export { default as StringChoiceField } from "./components/string-choice.vue";
|
|
223
|
+
export { default as StringChoicesField } from "./components/string-choices.vue";
|
|
224
|
+
export { default as ParentPropertyReferenceField } from "./components/parent-property-reference.vue";
|
|
225
|
+
export { default as SelfPropertyReferenceField } from "./components/self-property-reference.vue";
|
|
226
|
+
export { default as MoneyField } from "./components/money.vue";
|
|
227
|
+
export { default as Inventory } from "./components/inventory.vue";
|
|
228
|
+
export { default as DamageTrack } from "./components/damage-track.vue";
|
|
229
|
+
${joinToNode(entry.documents.map(generateExport), { appendNewLineIfNotEmpty: true })}
|
|
230
|
+
${joinToNode(entry.documents.map(generateDocumentPromptExports), { appendNewLineIfNotEmpty: true })}
|
|
231
|
+
${joinToNode(entry.documents.map(generateDatatableExportForDocument), { appendNewLineIfNotEmpty: true })}
|
|
232
232
|
`.appendNewLine();
|
|
233
233
|
fs.writeFileSync(generatedFilePath, toString(fileNode));
|
|
234
234
|
}
|