@wildwinter/expr-editor 0.12.3 → 0.13.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/dist/index.cjs +55 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +55 -11
- package/dist/index.js.map +1 -1
- package/dist/styles.css +10 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExprNode, BinaryOp, AstPath, PropertyType, UnaryOp, ExpressionValidationResult, ExpressionValidationIssue, ExpressionSchema, Dialect } from '@wildwinter/expr';
|
|
2
2
|
export { ExpressionValidationIssue, ExpressionValidationResult, PropertyType } from '@wildwinter/expr';
|
|
3
3
|
|
|
4
4
|
declare const boolLit: (value: boolean) => ExprNode;
|
|
@@ -53,6 +53,16 @@ declare function findChoicePeer(ast: ExprNode, path: AstPath): {
|
|
|
53
53
|
} | null;
|
|
54
54
|
/** @deprecated Renamed to {@link findChoicePeer} - it serves qualities as well as enums now. */
|
|
55
55
|
declare const findEnumPeer: typeof findChoicePeer;
|
|
56
|
+
/** A name-form ref in ONE form, so two spellings of the same property compare equal: the default
|
|
57
|
+
* scope may be written or left off (`@patter.debt` and `@debt`), and refs are case-insensitive. */
|
|
58
|
+
declare const normaliseRef: (ref: string, defaultScope: string) => string;
|
|
59
|
+
/** The name-form ref a call ADVANCES, when the call is the plain `advance(@x)` shape: one scopedvar
|
|
60
|
+
* argument and nothing else. Null for any other call, and for an argument that is not a property
|
|
61
|
+
* (`advance(f(@x))` keeps its explicit form, since collapsing it would hide the middle).
|
|
62
|
+
*
|
|
63
|
+
* `advance` is the language's own built-in rather than a dialect function, so it is matched by name
|
|
64
|
+
* here the way the evaluator and validator match it. */
|
|
65
|
+
declare function advancedRef(node: ExprNode, defaultScope: string): string | null;
|
|
56
66
|
/**
|
|
57
67
|
* DFS for the first unfilled slot in a template-inserted clause: an empty string
|
|
58
68
|
* literal (a tag / value the author still has to set) or an unnamed flag delta.
|
|
@@ -280,6 +290,11 @@ interface EditCtx {
|
|
|
280
290
|
* (an enum-typed outcome target). Lets the string editor show an enum picker
|
|
281
291
|
* even without a comparison peer. No effect on non-root literals. */
|
|
282
292
|
valueEnumValues?: string[];
|
|
293
|
+
/** The name-form ref of the SET this value belongs to, when there is one. Its only use is the
|
|
294
|
+
* self-advance idiom: `@debt = advance(@debt)` names the property three times to say one thing,
|
|
295
|
+
* so when the value is exactly `advance(<this ref>)` the call collapses to a single "advances"
|
|
296
|
+
* word and the row reads `debt advances`. Any other target, or any other shape, renders in full. */
|
|
297
|
+
selfAdvanceRef?: string;
|
|
283
298
|
/** Host actions for a property pill (e.g. "Go to definition"). When set,
|
|
284
299
|
* right-clicking a property pill opens a menu of these actions. The host
|
|
285
300
|
* resolves what each does (navigation etc.); empty array = no menu. */
|
|
@@ -335,6 +350,10 @@ interface ExpressionEditorOptions {
|
|
|
335
350
|
/** Enum values for the single root literal of a value field (an enum-typed
|
|
336
351
|
* target): the literal editor then offers them as a picker. Flat mode only. */
|
|
337
352
|
valueEnumValues?: string[];
|
|
353
|
+
/** The ref of the SET this value belongs to (flat value fields only). Lets `advance(<that ref>)`
|
|
354
|
+
* render as a single "advances" word: the outcome row already names the property in its target
|
|
355
|
+
* column, so the call would say it twice more. */
|
|
356
|
+
selfAdvanceRef?: string;
|
|
338
357
|
/** Flat single-value field: an empty value renders one editable "set a value…"
|
|
339
358
|
* placeholder pill (a root string literal) rather than the condition
|
|
340
359
|
* clause-menu empty state. Pairs with mode:"flat". */
|
|
@@ -498,4 +517,4 @@ interface ValueWizardOptions {
|
|
|
498
517
|
/** Build the wizard UI into a fresh element (drive it via the host's popover). */
|
|
499
518
|
declare function valueWizard(opts: ValueWizardOptions): HTMLElement;
|
|
500
519
|
|
|
501
|
-
export { ARITHMETIC_OPS, BINARY_LABEL, COMPARABLE_TYPES, COMPARISON_OPS, type CatalogueEntry, EQUALITY_OPS, type EditCtx, type EditorEffect, type EffectsEditorHandle, type EffectsEditorOptions, type ExpressionEditorHandle, type ExpressionEditorOptions, type Filter, type FunctionTemplateSpec, OP_WORD, type PreviewOptions, type TreeRow, UNARY_LABEL, type Validation, type ValueWizardOptions, type WizardSpec, type WizardStepSpec, type WizardValue, addArg, addChildToContainer, addEmit, addSet, astToTree, binary, boolLit, buildSubGroupClause, callNode, choicesOf, comparisonOpsFor, deleteAt, displayName, filterCatalogue, findChoicePeer, findEnumPeer, firstEmptyLeafPath, flagDelta, flipContainerOp, formatNumber, getNodeAt, groupByScope, initialValueFor, insertSiblingClauseAt, isComparisonOp, isPlaceholderForOp, isWrappedInNot, issuesAt, lookup, mountEffectsEditor, mountExpressionEditor, moveAt, moveChildInContainer, needsParens, notNode, numLit, opSwapGroup, pathKey, placeholderForOp, redirectDeleteForPlaceholderSibling, refOf, removeArgAt, removeAt, renderConditionPreview, renderEffectsPreview, rhsTypesFor, scopedVar, searchCatalogue, seedValueSrc, setArgAt, setNodeAt, strLit, toggleContainerNot, toggleNotAt, updateAt, validateSource, valueWizard, wrapInNotAt };
|
|
520
|
+
export { ARITHMETIC_OPS, BINARY_LABEL, COMPARABLE_TYPES, COMPARISON_OPS, type CatalogueEntry, EQUALITY_OPS, type EditCtx, type EditorEffect, type EffectsEditorHandle, type EffectsEditorOptions, type ExpressionEditorHandle, type ExpressionEditorOptions, type Filter, type FunctionTemplateSpec, OP_WORD, type PreviewOptions, type TreeRow, UNARY_LABEL, type Validation, type ValueWizardOptions, type WizardSpec, type WizardStepSpec, type WizardValue, addArg, addChildToContainer, addEmit, addSet, advancedRef, astToTree, binary, boolLit, buildSubGroupClause, callNode, choicesOf, comparisonOpsFor, deleteAt, displayName, filterCatalogue, findChoicePeer, findEnumPeer, firstEmptyLeafPath, flagDelta, flipContainerOp, formatNumber, getNodeAt, groupByScope, initialValueFor, insertSiblingClauseAt, isComparisonOp, isPlaceholderForOp, isWrappedInNot, issuesAt, lookup, mountEffectsEditor, mountExpressionEditor, moveAt, moveChildInContainer, needsParens, normaliseRef, notNode, numLit, opSwapGroup, pathKey, placeholderForOp, redirectDeleteForPlaceholderSibling, refOf, removeArgAt, removeAt, renderConditionPreview, renderEffectsPreview, rhsTypesFor, scopedVar, searchCatalogue, seedValueSrc, setArgAt, setNodeAt, strLit, toggleContainerNot, toggleNotAt, updateAt, validateSource, valueWizard, wrapInNotAt };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExprNode, BinaryOp, AstPath, PropertyType, UnaryOp, ExpressionValidationResult, ExpressionValidationIssue, ExpressionSchema, Dialect } from '@wildwinter/expr';
|
|
2
2
|
export { ExpressionValidationIssue, ExpressionValidationResult, PropertyType } from '@wildwinter/expr';
|
|
3
3
|
|
|
4
4
|
declare const boolLit: (value: boolean) => ExprNode;
|
|
@@ -53,6 +53,16 @@ declare function findChoicePeer(ast: ExprNode, path: AstPath): {
|
|
|
53
53
|
} | null;
|
|
54
54
|
/** @deprecated Renamed to {@link findChoicePeer} - it serves qualities as well as enums now. */
|
|
55
55
|
declare const findEnumPeer: typeof findChoicePeer;
|
|
56
|
+
/** A name-form ref in ONE form, so two spellings of the same property compare equal: the default
|
|
57
|
+
* scope may be written or left off (`@patter.debt` and `@debt`), and refs are case-insensitive. */
|
|
58
|
+
declare const normaliseRef: (ref: string, defaultScope: string) => string;
|
|
59
|
+
/** The name-form ref a call ADVANCES, when the call is the plain `advance(@x)` shape: one scopedvar
|
|
60
|
+
* argument and nothing else. Null for any other call, and for an argument that is not a property
|
|
61
|
+
* (`advance(f(@x))` keeps its explicit form, since collapsing it would hide the middle).
|
|
62
|
+
*
|
|
63
|
+
* `advance` is the language's own built-in rather than a dialect function, so it is matched by name
|
|
64
|
+
* here the way the evaluator and validator match it. */
|
|
65
|
+
declare function advancedRef(node: ExprNode, defaultScope: string): string | null;
|
|
56
66
|
/**
|
|
57
67
|
* DFS for the first unfilled slot in a template-inserted clause: an empty string
|
|
58
68
|
* literal (a tag / value the author still has to set) or an unnamed flag delta.
|
|
@@ -280,6 +290,11 @@ interface EditCtx {
|
|
|
280
290
|
* (an enum-typed outcome target). Lets the string editor show an enum picker
|
|
281
291
|
* even without a comparison peer. No effect on non-root literals. */
|
|
282
292
|
valueEnumValues?: string[];
|
|
293
|
+
/** The name-form ref of the SET this value belongs to, when there is one. Its only use is the
|
|
294
|
+
* self-advance idiom: `@debt = advance(@debt)` names the property three times to say one thing,
|
|
295
|
+
* so when the value is exactly `advance(<this ref>)` the call collapses to a single "advances"
|
|
296
|
+
* word and the row reads `debt advances`. Any other target, or any other shape, renders in full. */
|
|
297
|
+
selfAdvanceRef?: string;
|
|
283
298
|
/** Host actions for a property pill (e.g. "Go to definition"). When set,
|
|
284
299
|
* right-clicking a property pill opens a menu of these actions. The host
|
|
285
300
|
* resolves what each does (navigation etc.); empty array = no menu. */
|
|
@@ -335,6 +350,10 @@ interface ExpressionEditorOptions {
|
|
|
335
350
|
/** Enum values for the single root literal of a value field (an enum-typed
|
|
336
351
|
* target): the literal editor then offers them as a picker. Flat mode only. */
|
|
337
352
|
valueEnumValues?: string[];
|
|
353
|
+
/** The ref of the SET this value belongs to (flat value fields only). Lets `advance(<that ref>)`
|
|
354
|
+
* render as a single "advances" word: the outcome row already names the property in its target
|
|
355
|
+
* column, so the call would say it twice more. */
|
|
356
|
+
selfAdvanceRef?: string;
|
|
338
357
|
/** Flat single-value field: an empty value renders one editable "set a value…"
|
|
339
358
|
* placeholder pill (a root string literal) rather than the condition
|
|
340
359
|
* clause-menu empty state. Pairs with mode:"flat". */
|
|
@@ -498,4 +517,4 @@ interface ValueWizardOptions {
|
|
|
498
517
|
/** Build the wizard UI into a fresh element (drive it via the host's popover). */
|
|
499
518
|
declare function valueWizard(opts: ValueWizardOptions): HTMLElement;
|
|
500
519
|
|
|
501
|
-
export { ARITHMETIC_OPS, BINARY_LABEL, COMPARABLE_TYPES, COMPARISON_OPS, type CatalogueEntry, EQUALITY_OPS, type EditCtx, type EditorEffect, type EffectsEditorHandle, type EffectsEditorOptions, type ExpressionEditorHandle, type ExpressionEditorOptions, type Filter, type FunctionTemplateSpec, OP_WORD, type PreviewOptions, type TreeRow, UNARY_LABEL, type Validation, type ValueWizardOptions, type WizardSpec, type WizardStepSpec, type WizardValue, addArg, addChildToContainer, addEmit, addSet, astToTree, binary, boolLit, buildSubGroupClause, callNode, choicesOf, comparisonOpsFor, deleteAt, displayName, filterCatalogue, findChoicePeer, findEnumPeer, firstEmptyLeafPath, flagDelta, flipContainerOp, formatNumber, getNodeAt, groupByScope, initialValueFor, insertSiblingClauseAt, isComparisonOp, isPlaceholderForOp, isWrappedInNot, issuesAt, lookup, mountEffectsEditor, mountExpressionEditor, moveAt, moveChildInContainer, needsParens, notNode, numLit, opSwapGroup, pathKey, placeholderForOp, redirectDeleteForPlaceholderSibling, refOf, removeArgAt, removeAt, renderConditionPreview, renderEffectsPreview, rhsTypesFor, scopedVar, searchCatalogue, seedValueSrc, setArgAt, setNodeAt, strLit, toggleContainerNot, toggleNotAt, updateAt, validateSource, valueWizard, wrapInNotAt };
|
|
520
|
+
export { ARITHMETIC_OPS, BINARY_LABEL, COMPARABLE_TYPES, COMPARISON_OPS, type CatalogueEntry, EQUALITY_OPS, type EditCtx, type EditorEffect, type EffectsEditorHandle, type EffectsEditorOptions, type ExpressionEditorHandle, type ExpressionEditorOptions, type Filter, type FunctionTemplateSpec, OP_WORD, type PreviewOptions, type TreeRow, UNARY_LABEL, type Validation, type ValueWizardOptions, type WizardSpec, type WizardStepSpec, type WizardValue, addArg, addChildToContainer, addEmit, addSet, advancedRef, astToTree, binary, boolLit, buildSubGroupClause, callNode, choicesOf, comparisonOpsFor, deleteAt, displayName, filterCatalogue, findChoicePeer, findEnumPeer, firstEmptyLeafPath, flagDelta, flipContainerOp, formatNumber, getNodeAt, groupByScope, initialValueFor, insertSiblingClauseAt, isComparisonOp, isPlaceholderForOp, isWrappedInNot, issuesAt, lookup, mountEffectsEditor, mountExpressionEditor, moveAt, moveChildInContainer, needsParens, normaliseRef, notNode, numLit, opSwapGroup, pathKey, placeholderForOp, redirectDeleteForPlaceholderSibling, refOf, removeArgAt, removeAt, renderConditionPreview, renderEffectsPreview, rhsTypesFor, scopedVar, searchCatalogue, seedValueSrc, setArgAt, setNodeAt, strLit, toggleContainerNot, toggleNotAt, updateAt, validateSource, valueWizard, wrapInNotAt };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseAndValidate, unparse } from '@wildwinter/expr';
|
|
1
|
+
import { parseAndValidate, parse, unparse } from '@wildwinter/expr';
|
|
2
2
|
|
|
3
3
|
// src/ast.ts
|
|
4
4
|
var boolLit = (value) => ({ kind: "bool", value });
|
|
@@ -91,6 +91,16 @@ function findChoicePeer(ast, path) {
|
|
|
91
91
|
return other.kind === "scopedvar" ? { scope: other.scope, name: other.name } : null;
|
|
92
92
|
}
|
|
93
93
|
var findEnumPeer = findChoicePeer;
|
|
94
|
+
var normaliseRef = (ref, defaultScope) => {
|
|
95
|
+
const low = ref.toLowerCase();
|
|
96
|
+
const prefix = `@${defaultScope.toLowerCase()}.`;
|
|
97
|
+
return low.startsWith(prefix) ? `@${low.slice(prefix.length)}` : low;
|
|
98
|
+
};
|
|
99
|
+
function advancedRef(node, defaultScope) {
|
|
100
|
+
if (node.kind !== "call" || node.name !== "advance" || node.args.length !== 1) return null;
|
|
101
|
+
const arg = node.args[0];
|
|
102
|
+
return arg.kind === "scopedvar" ? normaliseRef(`@${arg.scope}.${arg.name}`, defaultScope) : null;
|
|
103
|
+
}
|
|
94
104
|
function firstEmptyLeafPath(node, base = []) {
|
|
95
105
|
switch (node.kind) {
|
|
96
106
|
case "string":
|
|
@@ -461,6 +471,16 @@ function renderNode(node, path, ctx, parentOp, side) {
|
|
|
461
471
|
for (let i = 1; i < node.args.length; i++) row2.append(renderNode(node.args[i], [...path, "args", i], ctx));
|
|
462
472
|
return row2;
|
|
463
473
|
}
|
|
474
|
+
if (ctx.selfAdvanceRef && advancedRef(node, ctx.defaultScope) === normaliseRef(ctx.selfAdvanceRef, ctx.defaultScope)) {
|
|
475
|
+
const row2 = el("span", "exed-call exed-call-advance");
|
|
476
|
+
row2.append(pill(
|
|
477
|
+
"advance",
|
|
478
|
+
"advances",
|
|
479
|
+
(b) => callEditor(ctx, path, node, b),
|
|
480
|
+
{ issue, title: "advance one stage", aria: "advances one stage" }
|
|
481
|
+
));
|
|
482
|
+
return row2;
|
|
483
|
+
}
|
|
464
484
|
const row = el("span", "exed-call");
|
|
465
485
|
row.append(pill("func", node.name, (b) => callEditor(ctx, path, node, b), { issue }));
|
|
466
486
|
row.append(el("span", "exed-paren", ["("]));
|
|
@@ -1144,6 +1164,7 @@ function mountExpressionEditor(host, opts) {
|
|
|
1144
1164
|
},
|
|
1145
1165
|
...opts.requireNonEmpty ? { requireNonEmpty: true } : {},
|
|
1146
1166
|
...opts.valueEnumValues ? { valueEnumValues: opts.valueEnumValues } : {},
|
|
1167
|
+
...opts.selfAdvanceRef ? { selfAdvanceRef: opts.selfAdvanceRef } : {},
|
|
1147
1168
|
...opts.propertyActions ? { propertyActions: opts.propertyActions } : {},
|
|
1148
1169
|
...opts.pickNode ? { pickNode: opts.pickNode } : {},
|
|
1149
1170
|
...opts.nodeLabel ? { nodeLabel: opts.nodeLabel } : {}
|
|
@@ -1407,6 +1428,14 @@ function valueWizard(opts) {
|
|
|
1407
1428
|
}
|
|
1408
1429
|
|
|
1409
1430
|
// src/effects.ts
|
|
1431
|
+
function isSelfAdvance(eff, defaultScope, dialect) {
|
|
1432
|
+
if (eff.kind !== "set" || !eff.target) return false;
|
|
1433
|
+
try {
|
|
1434
|
+
return advancedRef(parse(eff.value, dialect), defaultScope) === normaliseRef(eff.target, defaultScope);
|
|
1435
|
+
} catch {
|
|
1436
|
+
return false;
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1410
1439
|
var clone = (list) => list.map((e) => e.kind === "set" ? { ...e } : { ...e, args: [...e.args] });
|
|
1411
1440
|
var addSet = (list, target, value) => [...clone(list), { kind: "set", target, value }];
|
|
1412
1441
|
var addEmit = (list, event) => [...clone(list), { kind: "emit", event, args: [] }];
|
|
@@ -1503,7 +1532,7 @@ function mountEffectsEditor(host, opts) {
|
|
|
1503
1532
|
}), { container: opts.popoverContainer });
|
|
1504
1533
|
};
|
|
1505
1534
|
const targetType = (target) => opts.catalogue.find((e) => refOf(e, defaultScope) === target)?.type;
|
|
1506
|
-
const valueDisplay = (value, onChange, type) => {
|
|
1535
|
+
const valueDisplay = (value, onChange, type, selfAdvanceRef) => {
|
|
1507
1536
|
const sub = el("div", "exed-effect-value");
|
|
1508
1537
|
const addTerm = type === "number" ? "arithmetic" : type === "boolean" ? "boolean" : void 0;
|
|
1509
1538
|
inner.push(mountExpressionEditor(sub, {
|
|
@@ -1514,7 +1543,13 @@ function mountEffectsEditor(host, opts) {
|
|
|
1514
1543
|
scopeOrder: opts.scopeOrder,
|
|
1515
1544
|
functions: opts.functions,
|
|
1516
1545
|
mode: "flat",
|
|
1546
|
+
// Every editor here holds a VALUE (a set's value, an emit's argument), never a condition. Say
|
|
1547
|
+
// so, or emptying one falls back to the condition empty state and an outcome row reads
|
|
1548
|
+
// "always / + Add your first condition" - condition vocabulary, offering clauses where a value
|
|
1549
|
+
// belongs, and no way back to a value. `valueField` renders an editable empty literal instead.
|
|
1550
|
+
valueField: true,
|
|
1517
1551
|
...addTerm ? { addTerm } : {},
|
|
1552
|
+
...selfAdvanceRef ? { selfAdvanceRef } : {},
|
|
1518
1553
|
...opts.popoverContainer ? { popoverContainer: opts.popoverContainer } : {},
|
|
1519
1554
|
text: textMode,
|
|
1520
1555
|
onChange
|
|
@@ -1565,11 +1600,18 @@ function mountEffectsEditor(host, opts) {
|
|
|
1565
1600
|
commit(updateAt(effects, i, { target: refOf(entry, defaultScope), value: initialValueFor(entry, defaultScope).src }));
|
|
1566
1601
|
});
|
|
1567
1602
|
}, "change the target property");
|
|
1568
|
-
|
|
1603
|
+
const advances = isSelfAdvance(eff, defaultScope, opts.dialect);
|
|
1604
|
+
row.append(targetBtn);
|
|
1605
|
+
if (!advances) row.append(el("span", "exed-effect-eq", ["="]));
|
|
1569
1606
|
row.append(valueDisplay(eff.value, (src) => {
|
|
1570
|
-
|
|
1607
|
+
const next = updateAt(effects, i, { value: src });
|
|
1608
|
+
if (isSelfAdvance(next[i], defaultScope, opts.dialect) !== advances) {
|
|
1609
|
+
commit(next);
|
|
1610
|
+
return;
|
|
1611
|
+
}
|
|
1612
|
+
effects = next;
|
|
1571
1613
|
opts.onChange(effects);
|
|
1572
|
-
}, targetType(eff.target)));
|
|
1614
|
+
}, targetType(eff.target), advances ? eff.target : void 0));
|
|
1573
1615
|
row.append(rowActions2(i));
|
|
1574
1616
|
return row;
|
|
1575
1617
|
}
|
|
@@ -1683,7 +1725,7 @@ function mountEffectsEditor(host, opts) {
|
|
|
1683
1725
|
}
|
|
1684
1726
|
|
|
1685
1727
|
// src/preview.ts
|
|
1686
|
-
function frozenCtx(src, o) {
|
|
1728
|
+
function frozenCtx(src, o, selfAdvanceRef) {
|
|
1687
1729
|
const v = validateSource(src, o.schema, o.dialect);
|
|
1688
1730
|
const ctx = {
|
|
1689
1731
|
schema: o.schema,
|
|
@@ -1702,6 +1744,7 @@ function frozenCtx(src, o) {
|
|
|
1702
1744
|
pickNode: () => {
|
|
1703
1745
|
},
|
|
1704
1746
|
// enables labelled node pills; never fires (preview is read-only)
|
|
1747
|
+
...selfAdvanceRef ? { selfAdvanceRef } : {},
|
|
1705
1748
|
...o.nodeLabel ? { nodeLabel: o.nodeLabel } : {},
|
|
1706
1749
|
...o.propertyActions ? {
|
|
1707
1750
|
propertyActions: o.propertyActions,
|
|
@@ -1712,8 +1755,8 @@ function frozenCtx(src, o) {
|
|
|
1712
1755
|
};
|
|
1713
1756
|
return { ctx, ast: v.ast };
|
|
1714
1757
|
}
|
|
1715
|
-
function exprPills(src, o) {
|
|
1716
|
-
const { ctx, ast } = frozenCtx(src, o);
|
|
1758
|
+
function exprPills(src, o, selfAdvanceRef) {
|
|
1759
|
+
const { ctx, ast } = frozenCtx(src, o, selfAdvanceRef);
|
|
1717
1760
|
return ast ? renderNode(ast, [], ctx) : el("span", "exed-preview-raw", [src]);
|
|
1718
1761
|
}
|
|
1719
1762
|
function renderConditionPreview(src, o) {
|
|
@@ -1725,9 +1768,10 @@ function renderEffectsPreview(effects, o) {
|
|
|
1725
1768
|
for (const eff of effects) {
|
|
1726
1769
|
const row = el("div", "exed-preview-eff");
|
|
1727
1770
|
if (eff.kind === "set") {
|
|
1771
|
+
const advances = isSelfAdvance(eff, o.dialect.defaultScope, o.dialect);
|
|
1728
1772
|
row.append(el("span", "exed-pill exed-pill-prop", [eff.target || "(property)"]));
|
|
1729
|
-
row.append(el("span", "exed-effect-eq", ["="]));
|
|
1730
|
-
row.append(exprPills(eff.value, o));
|
|
1773
|
+
if (!advances) row.append(el("span", "exed-effect-eq", ["="]));
|
|
1774
|
+
row.append(exprPills(eff.value, o, advances ? eff.target : void 0));
|
|
1731
1775
|
} else {
|
|
1732
1776
|
row.append(el("span", "exed-effect-kw", ["emit"]));
|
|
1733
1777
|
row.append(el("span", "exed-pill exed-pill-event", [eff.event ? `"${eff.event}"` : "(name)"]));
|
|
@@ -1743,6 +1787,6 @@ function renderEffectsPreview(effects, o) {
|
|
|
1743
1787
|
return wrap;
|
|
1744
1788
|
}
|
|
1745
1789
|
|
|
1746
|
-
export { ARITHMETIC_OPS, BINARY_LABEL, COMPARABLE_TYPES, COMPARISON_OPS, EQUALITY_OPS, OP_WORD, UNARY_LABEL, addArg, addChildToContainer, addEmit, addSet, astToTree, binary, boolLit, buildSubGroupClause, callNode, choicesOf, comparisonOpsFor, deleteAt, displayName, filterCatalogue, findChoicePeer, findEnumPeer, firstEmptyLeafPath, flagDelta, flipContainerOp, formatNumber, getNodeAt, groupByScope, initialValueFor, insertSiblingClauseAt, isComparisonOp, isPlaceholderForOp, isWrappedInNot, issuesAt, lookup, mountEffectsEditor, mountExpressionEditor, moveAt, moveChildInContainer, needsParens, notNode, numLit, opSwapGroup, pathKey, placeholderForOp, redirectDeleteForPlaceholderSibling, refOf, removeArgAt, removeAt, renderConditionPreview, renderEffectsPreview, rhsTypesFor, scopedVar, searchCatalogue, seedValueSrc, setArgAt, setNodeAt, strLit, toggleContainerNot, toggleNotAt, updateAt, validateSource, valueWizard, wrapInNotAt };
|
|
1790
|
+
export { ARITHMETIC_OPS, BINARY_LABEL, COMPARABLE_TYPES, COMPARISON_OPS, EQUALITY_OPS, OP_WORD, UNARY_LABEL, addArg, addChildToContainer, addEmit, addSet, advancedRef, astToTree, binary, boolLit, buildSubGroupClause, callNode, choicesOf, comparisonOpsFor, deleteAt, displayName, filterCatalogue, findChoicePeer, findEnumPeer, firstEmptyLeafPath, flagDelta, flipContainerOp, formatNumber, getNodeAt, groupByScope, initialValueFor, insertSiblingClauseAt, isComparisonOp, isPlaceholderForOp, isWrappedInNot, issuesAt, lookup, mountEffectsEditor, mountExpressionEditor, moveAt, moveChildInContainer, needsParens, normaliseRef, notNode, numLit, opSwapGroup, pathKey, placeholderForOp, redirectDeleteForPlaceholderSibling, refOf, removeArgAt, removeAt, renderConditionPreview, renderEffectsPreview, rhsTypesFor, scopedVar, searchCatalogue, seedValueSrc, setArgAt, setNodeAt, strLit, toggleContainerNot, toggleNotAt, updateAt, validateSource, valueWizard, wrapInNotAt };
|
|
1747
1791
|
//# sourceMappingURL=index.js.map
|
|
1748
1792
|
//# sourceMappingURL=index.js.map
|