intelligent-system-design-language 0.4.0 → 0.4.1
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/out/cli/cli-util.js +9 -3
- package/out/cli/cli-util.js.map +1 -1
- package/out/cli/components/derived-data-generator.js +23 -8
- package/out/cli/components/derived-data-generator.js.map +1 -1
- package/out/cli/components/dev-module-generator.js +399 -0
- package/out/cli/components/dev-module-generator.js.map +1 -0
- package/out/cli/components/method-generator.js +83 -36
- package/out/cli/components/method-generator.js.map +1 -1
- package/out/cli/components/vue/base-components/vue-string-choices.js +11 -4
- package/out/cli/components/vue/base-components/vue-string-choices.js.map +1 -1
- package/out/cli/generator.js +46 -42
- package/out/cli/generator.js.map +1 -1
- package/out/extension/main.cjs +710 -560
- package/out/extension/main.cjs.map +4 -4
- package/out/extension/main.js +2 -2
- package/out/extension/main.js.map +1 -1
- package/out/extension/package.json +1 -1
- package/out/language/generated/ast.js +13 -4
- package/out/language/generated/ast.js.map +1 -1
- package/out/language/generated/grammar.js +106 -32
- package/out/language/generated/grammar.js.map +1 -1
- package/out/language/intelligent-system-design-language-module.js +3 -1
- package/out/language/intelligent-system-design-language-module.js.map +1 -1
- package/out/language/intelligent-system-design-language-validator.js +20 -7
- package/out/language/intelligent-system-design-language-validator.js.map +1 -1
- package/out/language/isdl-completion-provider.js +32 -0
- package/out/language/isdl-completion-provider.js.map +1 -0
- package/out/language/isdl-docs.js +106 -0
- package/out/language/isdl-docs.js.map +1 -0
- package/out/language/isdl-hover-provider.js +4 -54
- package/out/language/isdl-hover-provider.js.map +1 -1
- package/out/language/main.cjs +633 -483
- package/out/language/main.cjs.map +4 -4
- package/out/package.json +1 -1
- package/package.json +1 -1
|
@@ -66,6 +66,10 @@ export function translateDiceParts(expression, noLabels = false) {
|
|
|
66
66
|
`;
|
|
67
67
|
}
|
|
68
68
|
if (isParentAccess(expression)) {
|
|
69
|
+
if (expression.nameAccess) {
|
|
70
|
+
const suffix = noLabels ? "" : "[Name]";
|
|
71
|
+
return expandToNode `"@name${suffix}"`;
|
|
72
|
+
}
|
|
69
73
|
let path = (_j = (_h = (_g = expression.property) === null || _g === void 0 ? void 0 : _g.ref) === null || _h === void 0 ? void 0 : _h.name) !== null && _j !== void 0 ? _j : "";
|
|
70
74
|
let label = humanize((_m = (_l = (_k = expression.property) === null || _k === void 0 ? void 0 : _k.ref) === null || _l === void 0 ? void 0 : _l.name) !== null && _m !== void 0 ? _m : "");
|
|
71
75
|
const document = getParentDocument(expression);
|
|
@@ -92,6 +96,10 @@ export function translateDiceParts(expression, noLabels = false) {
|
|
|
92
96
|
`;
|
|
93
97
|
}
|
|
94
98
|
if (isTargetAccess(expression)) {
|
|
99
|
+
if (expression.nameAccess) {
|
|
100
|
+
const suffix = noLabels ? "" : "[Name]";
|
|
101
|
+
return expandToNode `"@name${suffix}"`;
|
|
102
|
+
}
|
|
95
103
|
let path = (_w = (_v = (_u = expression.property) === null || _u === void 0 ? void 0 : _u.ref) === null || _v === void 0 ? void 0 : _v.name) !== null && _w !== void 0 ? _w : "";
|
|
96
104
|
let label = humanize((_z = (_y = (_x = expression.property) === null || _x === void 0 ? void 0 : _x.ref) === null || _y === void 0 ? void 0 : _y.name) !== null && _z !== void 0 ? _z : "");
|
|
97
105
|
const document = getTargetDocument(expression);
|
|
@@ -222,9 +230,13 @@ function translateDisplayFormula(expression) {
|
|
|
222
230
|
return label.trim();
|
|
223
231
|
}
|
|
224
232
|
if (isParentAccess(expression)) {
|
|
233
|
+
if (expression.nameAccess)
|
|
234
|
+
return "Name";
|
|
225
235
|
return humanize((_m = (_l = (_k = expression.property) === null || _k === void 0 ? void 0 : _k.ref) === null || _l === void 0 ? void 0 : _l.name) !== null && _m !== void 0 ? _m : "");
|
|
226
236
|
}
|
|
227
237
|
if (isTargetAccess(expression)) {
|
|
238
|
+
if (expression.nameAccess)
|
|
239
|
+
return "Name";
|
|
228
240
|
return humanize((_q = (_p = (_o = expression.property) === null || _o === void 0 ? void 0 : _o.ref) === null || _p === void 0 ? void 0 : _p.name) !== null && _q !== void 0 ? _q : "");
|
|
229
241
|
}
|
|
230
242
|
if (isFleetingAccess(expression)) {
|
|
@@ -236,6 +248,11 @@ export function translateDiceData(expression, entry, id, preDerived, generatingP
|
|
|
236
248
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61;
|
|
237
249
|
console.log("Translating Dice Data: ", expression.$type);
|
|
238
250
|
if (isParentAccess(expression)) {
|
|
251
|
+
if (expression.nameAccess) {
|
|
252
|
+
return expandToNode `
|
|
253
|
+
"name": context.object.parent?.name
|
|
254
|
+
`;
|
|
255
|
+
}
|
|
239
256
|
let path = "context.object.parent.system";
|
|
240
257
|
let label = (_c = (_b = (_a = expression.property) === null || _a === void 0 ? void 0 : _a.ref) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : "";
|
|
241
258
|
console.log("Parent Access:", (_e = (_d = expression.property) === null || _d === void 0 ? void 0 : _d.ref) === null || _e === void 0 ? void 0 : _e.name);
|
|
@@ -257,6 +274,11 @@ export function translateDiceData(expression, entry, id, preDerived, generatingP
|
|
|
257
274
|
`;
|
|
258
275
|
}
|
|
259
276
|
if (isTargetAccess(expression)) {
|
|
277
|
+
if (expression.nameAccess) {
|
|
278
|
+
return expandToNode `
|
|
279
|
+
"name": context.target?.name
|
|
280
|
+
`;
|
|
281
|
+
}
|
|
260
282
|
let path = "context.target.system";
|
|
261
283
|
let label = (_q = (_p = (_o = expression.property) === null || _o === void 0 ? void 0 : _o.ref) === null || _p === void 0 ? void 0 : _p.name) !== null && _q !== void 0 ? _q : "";
|
|
262
284
|
console.log("Target Access:", (_s = (_r = expression.property) === null || _r === void 0 ? void 0 : _r.ref) === null || _s === void 0 ? void 0 : _s.name);
|
|
@@ -491,7 +513,7 @@ export function translateDiceData(expression, entry, id, preDerived, generatingP
|
|
|
491
513
|
return undefined;
|
|
492
514
|
}
|
|
493
515
|
export function translateExpression(entry, id, expression, preDerived = false, generatingProperty = undefined) {
|
|
494
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10
|
|
516
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
|
|
495
517
|
function humanize(string) {
|
|
496
518
|
if (string == undefined) {
|
|
497
519
|
return "";
|
|
@@ -823,11 +845,30 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
823
845
|
throw new Error("Reference expression has no reference");
|
|
824
846
|
}
|
|
825
847
|
console.log("Translating Reference Expression: " + accessPath);
|
|
826
|
-
//
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
848
|
+
// If this reference resolves to an `each` loop variable, the loop iterates over a
|
|
849
|
+
// collection of Foundry Documents (embedded items). Custom fields on a Document live
|
|
850
|
+
// under `.system` (e.g. `sk.Expertise` -> `sk.system.expertise`), so member access on
|
|
851
|
+
// the loop variable needs the `.system` hop. Built-in Document props like `.name` are
|
|
852
|
+
// handled separately below and must NOT get `.system`.
|
|
853
|
+
//
|
|
854
|
+
// Only the loop VARIABLE itself gets this treatment. Function/method parameters and
|
|
855
|
+
// other locals that merely appear inside the loop body (e.g. `SkillName`, `Expt`) are
|
|
856
|
+
// plain JS values and must be referenced by their bare name -- appending `.system` to a
|
|
857
|
+
// string param produced `SkillName.system` (undefined at runtime). See bug #123.
|
|
858
|
+
//
|
|
859
|
+
// Walk every enclosing `each` (not just the innermost) so a reference to an outer loop
|
|
860
|
+
// variable from within a nested loop still resolves correctly.
|
|
861
|
+
const refTarget0 = expression.val.ref;
|
|
862
|
+
if (isParameter(refTarget0)) {
|
|
863
|
+
let eachAncestor = AstUtils.getContainerOfType(expression.$container, isEach);
|
|
864
|
+
while (eachAncestor != undefined) {
|
|
865
|
+
if (eachAncestor.var === refTarget0) {
|
|
866
|
+
if (isAccess(eachAncestor.collection) || isParentAccess(eachAncestor.collection) || isTargetAccess(eachAncestor.collection)) {
|
|
867
|
+
accessPath = `${accessPath}.system`;
|
|
868
|
+
}
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
eachAncestor = AstUtils.getContainerOfType(eachAncestor.$container, isEach);
|
|
831
872
|
}
|
|
832
873
|
}
|
|
833
874
|
const refTargetIsRoll = isVariableExpression(expression.val.ref) && isRoll(expression.val.ref.value);
|
|
@@ -1173,14 +1214,12 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1173
1214
|
}
|
|
1174
1215
|
if (isParentAccess(expression)) {
|
|
1175
1216
|
let path = "context.object.parent";
|
|
1176
|
-
|
|
1177
|
-
// If the ref is unresolved but the raw text is "name"/"Name", emit it directly.
|
|
1178
|
-
if (!((_a = expression.property) === null || _a === void 0 ? void 0 : _a.ref) && ((_c = (_b = expression.property) === null || _b === void 0 ? void 0 : _b.$refText) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === "name") {
|
|
1217
|
+
if (expression.nameAccess) {
|
|
1179
1218
|
return expandToNode `
|
|
1180
|
-
${path}?.name
|
|
1219
|
+
${path}?.name
|
|
1181
1220
|
`;
|
|
1182
1221
|
}
|
|
1183
|
-
let systemPath = getSystemPath((
|
|
1222
|
+
let systemPath = getSystemPath((_a = expression.property) === null || _a === void 0 ? void 0 : _a.ref, expression.subProperties, expression, true);
|
|
1184
1223
|
path = `${path}?.${systemPath}`;
|
|
1185
1224
|
console.log("Translating Parent Access Expression: ", path);
|
|
1186
1225
|
return expandToNode `
|
|
@@ -1189,14 +1228,12 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1189
1228
|
}
|
|
1190
1229
|
if (isTargetAccess(expression)) {
|
|
1191
1230
|
let path = "context.target";
|
|
1192
|
-
|
|
1193
|
-
// If the ref is unresolved but the raw text is "name"/"Name", emit it directly.
|
|
1194
|
-
if (!((_e = expression.property) === null || _e === void 0 ? void 0 : _e.ref) && ((_g = (_f = expression.property) === null || _f === void 0 ? void 0 : _f.$refText) === null || _g === void 0 ? void 0 : _g.toLowerCase()) === "name") {
|
|
1231
|
+
if (expression.nameAccess) {
|
|
1195
1232
|
return expandToNode `
|
|
1196
1233
|
${path}?.name
|
|
1197
1234
|
`;
|
|
1198
1235
|
}
|
|
1199
|
-
let systemPath = getSystemPath((
|
|
1236
|
+
let systemPath = getSystemPath((_b = expression.property) === null || _b === void 0 ? void 0 : _b.ref, expression.subProperties, undefined, true);
|
|
1200
1237
|
path = `${path}?.${systemPath}`;
|
|
1201
1238
|
console.log("Translating Target Access Expression: ", path);
|
|
1202
1239
|
return expandToNode `
|
|
@@ -1204,7 +1241,7 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1204
1241
|
`;
|
|
1205
1242
|
}
|
|
1206
1243
|
if (isItemAccess(expression)) {
|
|
1207
|
-
const itemPropName = (
|
|
1244
|
+
const itemPropName = (_c = expression.property) === null || _c === void 0 ? void 0 : _c.toLowerCase();
|
|
1208
1245
|
let path = `item.system.${itemPropName}`;
|
|
1209
1246
|
if (expression.subProperty != undefined) {
|
|
1210
1247
|
path = `${path}.${expression.subProperty}`;
|
|
@@ -1213,8 +1250,8 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1213
1250
|
// `item.X` inside a where: clause iterates over the container's referenced document.
|
|
1214
1251
|
// Choice fields are stored as {value,...} objects, so resolve the field and compare by
|
|
1215
1252
|
// its .value rather than the whole object (e.g. `where: item.Type equals "Armor"`).
|
|
1216
|
-
const whereContainer = (
|
|
1217
|
-
const refDoc = ((
|
|
1253
|
+
const whereContainer = (_f = (_e = (_d = AstUtils.getContainerOfType(expression, isTableField)) !== null && _d !== void 0 ? _d : AstUtils.getContainerOfType(expression, isDocumentChoiceExp)) !== null && _e !== void 0 ? _e : AstUtils.getContainerOfType(expression, isDocumentChoicesExp)) !== null && _f !== void 0 ? _f : AstUtils.getContainerOfType(expression, isInventoryField);
|
|
1254
|
+
const refDoc = ((_j = (_h = (_g = whereContainer === null || whereContainer === void 0 ? void 0 : whereContainer.documents) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.ref) !== null && _j !== void 0 ? _j : (_k = whereContainer === null || whereContainer === void 0 ? void 0 : whereContainer.document) === null || _k === void 0 ? void 0 : _k.ref);
|
|
1218
1255
|
if (refDoc) {
|
|
1219
1256
|
const prop = AstUtils.streamAllContents(refDoc).find(n => isProperty(n) && n.name.toLowerCase() === itemPropName);
|
|
1220
1257
|
if (prop && (isStringChoiceField(prop) || isDamageTypeChoiceField(prop))) {
|
|
@@ -1236,7 +1273,7 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1236
1273
|
return translateComparisonExpression(expression);
|
|
1237
1274
|
}
|
|
1238
1275
|
if (isRollResultAccess(expression)) {
|
|
1239
|
-
const target = (
|
|
1276
|
+
const target = (_l = expression.variable.ref) === null || _l === void 0 ? void 0 : _l.name;
|
|
1240
1277
|
const jsMethod = expression.method === "count" ? "countDice"
|
|
1241
1278
|
: expression.method === "contains" ? "containsDie"
|
|
1242
1279
|
: expression.method;
|
|
@@ -1247,18 +1284,18 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1247
1284
|
return expandToNode `${target}.${jsMethod}(${argJs})`;
|
|
1248
1285
|
}
|
|
1249
1286
|
if (isFleetingAccess(expression)) {
|
|
1250
|
-
let accessPath = (
|
|
1287
|
+
let accessPath = (_m = expression.variable.ref) === null || _m === void 0 ? void 0 : _m.name;
|
|
1251
1288
|
if (expression.subProperty != undefined) {
|
|
1252
1289
|
// Foundry's Roll#dice returns DiceTerms; remap r.dice to the face-value getter.
|
|
1253
|
-
const isRollDice = (isRoll((
|
|
1290
|
+
const isRollDice = (isRoll((_o = expression.variable.ref) === null || _o === void 0 ? void 0 : _o.value) || isDamageRoll((_p = expression.variable.ref) === null || _p === void 0 ? void 0 : _p.value))
|
|
1254
1291
|
&& expression.subProperty.toLowerCase() === "dice";
|
|
1255
1292
|
accessPath = `${accessPath}.${isRollDice ? "diceFaces" : fleetingSubProperty(expression)}`;
|
|
1256
1293
|
}
|
|
1257
1294
|
else if (expression.arrayAccess != undefined) {
|
|
1258
|
-
const indexStr = (
|
|
1295
|
+
const indexStr = (_r = (_q = toString(translateExpression(entry, id, expression.arrayAccess, preDerived, generatingProperty))) === null || _q === void 0 ? void 0 : _q.trim()) !== null && _r !== void 0 ? _r : '';
|
|
1259
1296
|
accessPath = `${accessPath}[${indexStr}]`;
|
|
1260
1297
|
}
|
|
1261
|
-
else if (isRoll((
|
|
1298
|
+
else if (isRoll((_s = expression.variable.ref) === null || _s === void 0 ? void 0 : _s.value) || isDamageRoll((_t = expression.variable.ref) === null || _t === void 0 ? void 0 : _t.value)) {
|
|
1262
1299
|
// A bare reference to a roll variable used in a general expression
|
|
1263
1300
|
// (comparison, arithmetic, assignment, return, function arg) should
|
|
1264
1301
|
// use the roll's numeric total rather than the Roll object itself.
|
|
@@ -1367,15 +1404,25 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1367
1404
|
`;
|
|
1368
1405
|
}
|
|
1369
1406
|
if (isParentAccess(expression)) {
|
|
1370
|
-
let systemPath = getSystemPath((_3 = expression.property) === null || _3 === void 0 ? void 0 : _3.ref, expression.subProperties, undefined, true);
|
|
1371
1407
|
const wide = expression.type == "wide" ? true : false;
|
|
1408
|
+
if (expression.nameAccess) {
|
|
1409
|
+
return expandToNode `
|
|
1410
|
+
{ isRoll: false, label: "Name", value: context.object.parent?.name, wide: ${wide}, hasValue: context.object.parent?.name != "" },
|
|
1411
|
+
`;
|
|
1412
|
+
}
|
|
1413
|
+
let systemPath = getSystemPath((_3 = expression.property) === null || _3 === void 0 ? void 0 : _3.ref, expression.subProperties, undefined, true);
|
|
1372
1414
|
return expandToNode `
|
|
1373
1415
|
{ isRoll: false, label: "${humanize((_6 = (_5 = (_4 = expression.property) === null || _4 === void 0 ? void 0 : _4.ref) === null || _5 === void 0 ? void 0 : _5.name) !== null && _6 !== void 0 ? _6 : "")}", value: context.object.parent?.${systemPath}, wide: ${wide}, hasValue: context.object.parent?.${systemPath} != "" },
|
|
1374
1416
|
`;
|
|
1375
1417
|
}
|
|
1376
1418
|
if (isTargetAccess(expression)) {
|
|
1377
|
-
let systemPath = getSystemPath((_7 = expression.property) === null || _7 === void 0 ? void 0 : _7.ref, expression.subProperties, undefined, true);
|
|
1378
1419
|
const wide = expression.type == "wide" ? true : false;
|
|
1420
|
+
if (expression.nameAccess) {
|
|
1421
|
+
return expandToNode `
|
|
1422
|
+
{ isRoll: false, label: "Name", value: context.target?.name, wide: ${wide}, hasValue: context.target?.name != "" },
|
|
1423
|
+
`;
|
|
1424
|
+
}
|
|
1425
|
+
let systemPath = getSystemPath((_7 = expression.property) === null || _7 === void 0 ? void 0 : _7.ref, expression.subProperties, undefined, true);
|
|
1379
1426
|
return expandToNode `
|
|
1380
1427
|
{ isRoll: false, label: "${humanize((_10 = (_9 = (_8 = expression.property) === null || _8 === void 0 ? void 0 : _8.ref) === null || _9 === void 0 ? void 0 : _9.name) !== null && _10 !== void 0 ? _10 : "")}", value: context.target?.${systemPath}, wide: ${wide}, hasValue: context.target?.${systemPath} != "" },
|
|
1381
1428
|
`;
|
|
@@ -1451,11 +1498,11 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1451
1498
|
const typeParam = expression.params.find(isTypeParam);
|
|
1452
1499
|
let damageTypeDataAccess = '';
|
|
1453
1500
|
if (isAccess(typeParam.value)) {
|
|
1454
|
-
damageTypeDataAccess = `context.object.system.${(
|
|
1501
|
+
damageTypeDataAccess = `context.object.system.${(_w = (_v = (_u = typeParam.value) === null || _u === void 0 ? void 0 : _u.property) === null || _v === void 0 ? void 0 : _v.ref) === null || _w === void 0 ? void 0 : _w.name.toLowerCase()}`;
|
|
1455
1502
|
}
|
|
1456
1503
|
else if (isParentAccess(typeParam.value)) {
|
|
1457
1504
|
// Handle parent.SomeDamageType
|
|
1458
|
-
const parentPath = (
|
|
1505
|
+
const parentPath = (_0 = (_z = (_y = (_x = typeParam.value.property) === null || _x === void 0 ? void 0 : _x.ref) === null || _y === void 0 ? void 0 : _y.name) === null || _z === void 0 ? void 0 : _z.toLowerCase()) !== null && _0 !== void 0 ? _0 : '';
|
|
1459
1506
|
damageTypeDataAccess = `context.object.parent?.system.${parentPath}`;
|
|
1460
1507
|
}
|
|
1461
1508
|
return expandToNode `
|
|
@@ -1547,12 +1594,12 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1547
1594
|
})) {
|
|
1548
1595
|
if (isParentAccess(expression.collection)) {
|
|
1549
1596
|
updateExpression = expandToNode `
|
|
1550
|
-
parentEmbeddedUpdate["${getSystemPath((
|
|
1597
|
+
parentEmbeddedUpdate["${getSystemPath((_1 = expression.collection.property) === null || _1 === void 0 ? void 0 : _1.ref, [], undefined, false)}"] = ${collection};
|
|
1551
1598
|
`;
|
|
1552
1599
|
}
|
|
1553
1600
|
else if (isTargetAccess(expression.collection)) {
|
|
1554
1601
|
updateExpression = expandToNode `
|
|
1555
|
-
targetEmbeddedUpdate["${getSystemPath((
|
|
1602
|
+
targetEmbeddedUpdate["${getSystemPath((_2 = expression.collection.property) === null || _2 === void 0 ? void 0 : _2.ref, [], undefined, false)}"] = ${collection};
|
|
1556
1603
|
`;
|
|
1557
1604
|
}
|
|
1558
1605
|
else {
|
|
@@ -1570,9 +1617,9 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1570
1617
|
}
|
|
1571
1618
|
if (isPrompt(expression)) {
|
|
1572
1619
|
const labelParam = expression.params.find(x => isLabelParam(x));
|
|
1573
|
-
const title = (
|
|
1620
|
+
const title = (_3 = labelParam === null || labelParam === void 0 ? void 0 : labelParam.value) !== null && _3 !== void 0 ? _3 : "Prompt";
|
|
1574
1621
|
const targetParam = expression.params.find(x => isTargetParam(x));
|
|
1575
|
-
const target = (
|
|
1622
|
+
const target = (_4 = targetParam === null || targetParam === void 0 ? void 0 : targetParam.value) !== null && _4 !== void 0 ? _4 : "self";
|
|
1576
1623
|
// Registry key for the generated Vue prompt app (game.system.prompts.<doc><container><variable>).
|
|
1577
1624
|
// The container is the enclosing `action` OR `function` -- prompts work inside either.
|
|
1578
1625
|
const promptContainer = getPromptContainer(expression);
|
|
@@ -1591,7 +1638,7 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1591
1638
|
if (timeLimitParam != undefined) {
|
|
1592
1639
|
let durationMod = "";
|
|
1593
1640
|
const duration = translateExpression(entry, id, timeLimitParam.value, preDerived, generatingProperty);
|
|
1594
|
-
let units = (
|
|
1641
|
+
let units = (_5 = timeLimitParam.unit) !== null && _5 !== void 0 ? _5 : "ms";
|
|
1595
1642
|
if (units === "seconds") {
|
|
1596
1643
|
durationMod = ` * 1000`;
|
|
1597
1644
|
}
|
|
@@ -1761,7 +1808,7 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1761
1808
|
}
|
|
1762
1809
|
if (isUpdate(expression)) {
|
|
1763
1810
|
console.log("Translating Update Expression:");
|
|
1764
|
-
let systemPath = getSystemPath((
|
|
1811
|
+
let systemPath = getSystemPath((_6 = expression.property) === null || _6 === void 0 ? void 0 : _6.ref, expression.subProperties, (_7 = expression.propertyLookup) === null || _7 === void 0 ? void 0 : _7.ref, false);
|
|
1765
1812
|
if (isUpdateParent(expression)) {
|
|
1766
1813
|
return expandToNode `
|
|
1767
1814
|
parentUpdate["${systemPath}"] = foundry.utils.getProperty(context.object.parent, "system.${systemPath}");
|
|
@@ -1791,7 +1838,7 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1791
1838
|
// in-scope `system` and no update/await — derived values run synchronously and must be pure.
|
|
1792
1839
|
if (preDerived) {
|
|
1793
1840
|
return expandToNode `
|
|
1794
|
-
function_${(
|
|
1841
|
+
function_${(_8 = expression.method.ref) === null || _8 === void 0 ? void 0 : _8.name}(system${expression.params.length ? ", " : ""}${args})
|
|
1795
1842
|
`;
|
|
1796
1843
|
}
|
|
1797
1844
|
let accessPath = "this";
|
|
@@ -1799,7 +1846,7 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1799
1846
|
accessPath = "document.sheet";
|
|
1800
1847
|
}
|
|
1801
1848
|
return expandToNode `
|
|
1802
|
-
await ${accessPath}.function_${(
|
|
1849
|
+
await ${accessPath}.function_${(_9 = expression.method.ref) === null || _9 === void 0 ? void 0 : _9.name}(context, update, embeddedUpdate, parentUpdate, parentEmbeddedUpdate, targetUpdate, targetEmbeddedUpdate, ${args})
|
|
1803
1850
|
`;
|
|
1804
1851
|
}
|
|
1805
1852
|
if (isParentFunctionCall(expression)) {
|
|
@@ -1848,7 +1895,7 @@ export function translateExpression(entry, id, expression, preDerived = false, g
|
|
|
1848
1895
|
if (!fileParam)
|
|
1849
1896
|
return undefined;
|
|
1850
1897
|
const volumeParam = expression.params.find(x => isPlayAudioVolume(x));
|
|
1851
|
-
const volume = (
|
|
1898
|
+
const volume = (_10 = volumeParam === null || volumeParam === void 0 ? void 0 : volumeParam.value) !== null && _10 !== void 0 ? _10 : 0.5;
|
|
1852
1899
|
return expandToNode `
|
|
1853
1900
|
await game.system.utils.playSfx(${translateExpression(entry, id, fileParam.value, false, generatingProperty)}, ${translateExpression(entry, id, volume, false, generatingProperty)});
|
|
1854
1901
|
`;
|