@magmonium/cli 0.8.28 → 0.8.29
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/codegen/index.js +383 -52
- package/package.json +1 -1
package/codegen/index.js
CHANGED
|
@@ -511,6 +511,7 @@ __export(index_exports, {
|
|
|
511
511
|
checkedFieldIds: () => checkedFieldIds,
|
|
512
512
|
checksUsingFunction: () => checksUsingFunction,
|
|
513
513
|
childNavId: () => childNavId,
|
|
514
|
+
classCallOutcomes: () => classCallOutcomes,
|
|
514
515
|
classCardScope: () => classCardScope,
|
|
515
516
|
clearOutputCallRows: () => clearOutputCallRows,
|
|
516
517
|
clearOutputGroupRows: () => clearOutputGroupRows,
|
|
@@ -586,6 +587,7 @@ __export(index_exports, {
|
|
|
586
587
|
controlUsesOverlayRef: () => controlUsesOverlayRef,
|
|
587
588
|
controlVariantIds: () => controlVariantIds,
|
|
588
589
|
controlVariants: () => controlVariants,
|
|
590
|
+
controlWireOutcomes: () => controlWireOutcomes,
|
|
589
591
|
countFormResetReferences: () => countFormResetReferences,
|
|
590
592
|
countIconReferences: () => countIconReferences,
|
|
591
593
|
countOptionSetReferences: () => countOptionSetReferences,
|
|
@@ -777,6 +779,7 @@ __export(index_exports, {
|
|
|
777
779
|
formModelSourceType: () => formModelSourceType,
|
|
778
780
|
formModelStateOptions: () => formModelStateOptions,
|
|
779
781
|
formModelTransforms: () => formModelTransforms,
|
|
782
|
+
formQueryReaches: () => formQueryReaches,
|
|
780
783
|
formRefName: () => formRefName,
|
|
781
784
|
formRefNames: () => formRefNames,
|
|
782
785
|
formResetDepths: () => formResetDepths,
|
|
@@ -1451,6 +1454,7 @@ __export(index_exports, {
|
|
|
1451
1454
|
renameMenuItemId: () => renameMenuItemId,
|
|
1452
1455
|
renameScreenMethodParamReads: () => renameScreenMethodParamReads,
|
|
1453
1456
|
repairCallOutcome: () => repairCallOutcome,
|
|
1457
|
+
repairClassCallSites: () => repairClassCallSites,
|
|
1454
1458
|
repairFieldCheckSignatures: () => repairFieldCheckSignatures,
|
|
1455
1459
|
repairMarkdownLinkUrls: () => repairMarkdownLinkUrls,
|
|
1456
1460
|
repairMessageVariables: () => repairMessageVariables,
|
|
@@ -5241,7 +5245,9 @@ var screenMethodCalls = (method) => method ? [
|
|
|
5241
5245
|
{
|
|
5242
5246
|
methodId: method.methodId,
|
|
5243
5247
|
functionId: method.functionId,
|
|
5244
|
-
args: method.args
|
|
5248
|
+
args: method.args,
|
|
5249
|
+
// The handler's own call's settling (ADR 0219), filed on the handler.
|
|
5250
|
+
...method.outcome ? { outcome: method.outcome } : {}
|
|
5245
5251
|
},
|
|
5246
5252
|
...method.calls ?? []
|
|
5247
5253
|
] : [];
|
|
@@ -16363,7 +16369,7 @@ var refReaches = (button, buttonChain, form, controls) => {
|
|
|
16363
16369
|
const buttonSide = armChildOf(scope.id, button, controls);
|
|
16364
16370
|
return !!formSide && !!buttonSide && projectionSlotOf(formSide) === projectionSlotOf(buttonSide);
|
|
16365
16371
|
};
|
|
16366
|
-
var
|
|
16372
|
+
var formQueryReaches = (form, controls) => ![form, ...ancestors(form, controls)].some(
|
|
16367
16373
|
(node) => isRepeatFamily(node.type) || node.type === "content" /* CONTENT */
|
|
16368
16374
|
);
|
|
16369
16375
|
var accessTo = (button, form, controls) => {
|
|
@@ -16373,7 +16379,7 @@ var accessTo = (button, form, controls) => {
|
|
|
16373
16379
|
...ancestors(button, controls).map((parent) => parent.id)
|
|
16374
16380
|
]);
|
|
16375
16381
|
if (refReaches(button, buttonChain, form, controls)) return "ref";
|
|
16376
|
-
return
|
|
16382
|
+
return formQueryReaches(form, controls) ? "query" : void 0;
|
|
16377
16383
|
};
|
|
16378
16384
|
function submitTargetForms(button, controls) {
|
|
16379
16385
|
if (!canNameSubmitTarget(button, controls)) return [];
|
|
@@ -16433,7 +16439,8 @@ function hasCallOutcome(outcome) {
|
|
|
16433
16439
|
return OUTCOME_ARMS.some((arm) => armHasRows(outcome?.[arm]));
|
|
16434
16440
|
}
|
|
16435
16441
|
function armHasRows(arm) {
|
|
16436
|
-
return !!(arm?.writes?.length || arm?.screenWrites?.length ||
|
|
16442
|
+
return !!(arm?.writes?.length || arm?.screenWrites?.length || // An arm that only tells the host something happened is an arm (ADR 0143).
|
|
16443
|
+
arm?.emits?.length || arm?.formResets?.length || arm?.closesOverlay || arm?.nav || isOutcomeReportDrawn(arm?.report) || arm?.dialog);
|
|
16437
16444
|
}
|
|
16438
16445
|
function denialDialogOf(arm) {
|
|
16439
16446
|
const dialog = arm?.dialog;
|
|
@@ -16442,17 +16449,46 @@ function denialDialogOf(arm) {
|
|
|
16442
16449
|
function setArmDialog(arm, dialog) {
|
|
16443
16450
|
return { ...arm ?? {}, dialog };
|
|
16444
16451
|
}
|
|
16445
|
-
function
|
|
16446
|
-
return Object.values(
|
|
16447
|
-
|
|
16448
|
-
|
|
16452
|
+
function controlWireOutcomes(control) {
|
|
16453
|
+
return Object.values(control.outputOpens ?? {}).flatMap(
|
|
16454
|
+
(open) => Object.values(open?.outputs ?? {}).map((wire) => ({
|
|
16455
|
+
methodId: wire?.binding?.methodId,
|
|
16456
|
+
outcome: wire?.outcome
|
|
16457
|
+
}))
|
|
16458
|
+
);
|
|
16459
|
+
}
|
|
16460
|
+
function classCallOutcomes(sites) {
|
|
16461
|
+
return [
|
|
16462
|
+
...Object.values(sites.methods ?? {}).flatMap(
|
|
16463
|
+
(handler) => screenMethodCalls(handler).map((one) => ({
|
|
16464
|
+
methodId: one.methodId,
|
|
16465
|
+
outcome: one.outcome
|
|
16466
|
+
}))
|
|
16467
|
+
),
|
|
16468
|
+
...(sites.autoCalls ?? []).map((call) => ({
|
|
16469
|
+
methodId: call.methodId,
|
|
16470
|
+
outcome: call.outcome
|
|
16471
|
+
}))
|
|
16472
|
+
];
|
|
16473
|
+
}
|
|
16474
|
+
function denialTranslationKeys(controls, sites = []) {
|
|
16475
|
+
return [
|
|
16476
|
+
...Object.values(controls).flatMap((control) => [
|
|
16477
|
+
...Object.values(control.outputOutcomes ?? {}),
|
|
16478
|
+
...controlWireOutcomes(control).map((entry2) => entry2.outcome)
|
|
16479
|
+
]),
|
|
16480
|
+
...sites.flatMap(
|
|
16481
|
+
(site) => classCallOutcomes(site).map((entry2) => entry2.outcome)
|
|
16482
|
+
)
|
|
16483
|
+
].flatMap((outcome) => {
|
|
16449
16484
|
const dialog = outcome?.denied?.dialog;
|
|
16450
16485
|
return dialog ? [dialog.header, dialog.body, dialog.confirmLabel] : [];
|
|
16451
16486
|
}).filter((value) => !!value && !!value.trim()).map((value) => parseLabelValue(value).key).filter((key2) => !!key2);
|
|
16452
16487
|
}
|
|
16453
16488
|
function controlDrawsDenial(control) {
|
|
16454
16489
|
return [
|
|
16455
|
-
...Object.values(control.outputOutcomes ?? {})
|
|
16490
|
+
...Object.values(control.outputOutcomes ?? {}),
|
|
16491
|
+
...controlWireOutcomes(control).map((entry2) => entry2.outcome)
|
|
16456
16492
|
].some((outcome) => armHasRows(outcome?.denied));
|
|
16457
16493
|
}
|
|
16458
16494
|
function isOutcomeReportDrawn(report) {
|
|
@@ -16575,7 +16611,34 @@ function repairCallOutcome(controls, outcome, constantIds = /* @__PURE__ */ new
|
|
|
16575
16611
|
}
|
|
16576
16612
|
return moved ? repaired : void 0;
|
|
16577
16613
|
}
|
|
16578
|
-
function
|
|
16614
|
+
function repairClassCallSites(controls, sites) {
|
|
16615
|
+
let moved = false;
|
|
16616
|
+
const fix = (outcome) => {
|
|
16617
|
+
if (!outcome) return void 0;
|
|
16618
|
+
const next = repairCallOutcome(controls, outcome);
|
|
16619
|
+
if (!next) return outcome;
|
|
16620
|
+
moved = true;
|
|
16621
|
+
return hasCallOutcome(next) ? next : void 0;
|
|
16622
|
+
};
|
|
16623
|
+
const strip = (entry2) => {
|
|
16624
|
+
const outcome = fix(entry2.outcome);
|
|
16625
|
+
if (outcome === entry2.outcome) return entry2;
|
|
16626
|
+
const { outcome: _drop, ...rest } = entry2;
|
|
16627
|
+
return outcome ? { ...rest, outcome } : rest;
|
|
16628
|
+
};
|
|
16629
|
+
const methods = sites.methods ? Object.fromEntries(
|
|
16630
|
+
Object.entries(sites.methods).map(([id, handler]) => {
|
|
16631
|
+
const own = strip(handler);
|
|
16632
|
+
return [
|
|
16633
|
+
id,
|
|
16634
|
+
handler.calls ? { ...own, calls: handler.calls.map(strip) } : own
|
|
16635
|
+
];
|
|
16636
|
+
})
|
|
16637
|
+
) : void 0;
|
|
16638
|
+
const autoCalls = sites.autoCalls?.map(strip);
|
|
16639
|
+
return moved ? { methods, autoCalls } : void 0;
|
|
16640
|
+
}
|
|
16641
|
+
function methodArms(controlMaps, sites = []) {
|
|
16579
16642
|
const arms = {};
|
|
16580
16643
|
const mark = (methodId, outcome) => {
|
|
16581
16644
|
if (!methodId) return;
|
|
@@ -16593,6 +16656,14 @@ function methodArms(controlMaps) {
|
|
|
16593
16656
|
)) {
|
|
16594
16657
|
mark(control.outputs?.[output], outcome);
|
|
16595
16658
|
}
|
|
16659
|
+
for (const { methodId, outcome } of controlWireOutcomes(control)) {
|
|
16660
|
+
if (outcome) mark(methodId, outcome);
|
|
16661
|
+
}
|
|
16662
|
+
}
|
|
16663
|
+
}
|
|
16664
|
+
for (const site of sites) {
|
|
16665
|
+
for (const { methodId, outcome } of classCallOutcomes(site)) {
|
|
16666
|
+
if (outcome) mark(methodId, outcome);
|
|
16596
16667
|
}
|
|
16597
16668
|
}
|
|
16598
16669
|
return arms;
|
|
@@ -23296,7 +23367,7 @@ function tagAttrs(node, ctx, storeProp) {
|
|
|
23296
23367
|
}
|
|
23297
23368
|
if (node.type === "form" /* FORM */) {
|
|
23298
23369
|
const member = validationMemberFor(node, ctx);
|
|
23299
|
-
const ref = formRefNames(ctx.controlMap ?? {}).get(node.id);
|
|
23370
|
+
const ref = formRefNames(ctx.controlMap ?? {}).get(node.id) ?? (classResetForms(ctx).some((form) => form.id === node.id) ? formRefName(node) : void 0);
|
|
23300
23371
|
return `${ref ? ` #${ref}` : ""}${inlineAttrs(node)}${member ? ` [validation]="${member}"` : ""}${boundAttrs(node, ctx, storeProp)}`;
|
|
23301
23372
|
}
|
|
23302
23373
|
const submitReads = submitTargetReads(node, ctx);
|
|
@@ -24677,6 +24748,167 @@ var localBase2 = (binding, scope) => {
|
|
|
24677
24748
|
(segment, index) => index === 0 ? segment.charAt(0).toLowerCase() + segment.slice(1) : segment.charAt(0).toUpperCase() + segment.slice(1)
|
|
24678
24749
|
).join("");
|
|
24679
24750
|
};
|
|
24751
|
+
var resetTargetMember = (form) => `${formRefName(form).replace(/Ref$/, "")}ResetTarget`;
|
|
24752
|
+
function classResetForms(ctx) {
|
|
24753
|
+
const controls = ctx.controlMap ?? {};
|
|
24754
|
+
const outcomes = [
|
|
24755
|
+
...Object.values(ctx.screenMethods ?? {}).flatMap(
|
|
24756
|
+
(handler) => screenMethodCalls(handler).map((one) => one.outcome)
|
|
24757
|
+
),
|
|
24758
|
+
...(ctx.autoCalls ?? []).map((call) => call.outcome),
|
|
24759
|
+
// A wire's arms emit into the class body too, inside the open's callback,
|
|
24760
|
+
// where no template hands a ref in (ADR 0144).
|
|
24761
|
+
...Object.values(controls).flatMap(
|
|
24762
|
+
(control) => controlWireOutcomes(control).map((entry2) => entry2.outcome)
|
|
24763
|
+
)
|
|
24764
|
+
];
|
|
24765
|
+
const forms = /* @__PURE__ */ new Map();
|
|
24766
|
+
for (const outcome of outcomes) {
|
|
24767
|
+
for (const arm of OUTCOME_ARMS) {
|
|
24768
|
+
for (const row of outcome?.[arm]?.formResets ?? []) {
|
|
24769
|
+
const form = controls[row.controlId];
|
|
24770
|
+
if (!form || form.type !== "form" /* FORM */) continue;
|
|
24771
|
+
if (!formQueryReaches(form, controls)) continue;
|
|
24772
|
+
forms.set(form.id, form);
|
|
24773
|
+
}
|
|
24774
|
+
}
|
|
24775
|
+
}
|
|
24776
|
+
return [...forms.values()];
|
|
24777
|
+
}
|
|
24778
|
+
function resetTargetQueriesBlock(ctx) {
|
|
24779
|
+
return classResetForms(ctx).map(
|
|
24780
|
+
(form) => `
|
|
24781
|
+
protected readonly ${resetTargetMember(
|
|
24782
|
+
form
|
|
24783
|
+
)} = viewChild<SectionFormComponent>('${formRefName(form)}');
|
|
24784
|
+
`
|
|
24785
|
+
).join("");
|
|
24786
|
+
}
|
|
24787
|
+
function classArmStatements(arm, rows, ctx, selfStore, constants, reads, argsLocal) {
|
|
24788
|
+
const controls = ctx.controlMap ?? {};
|
|
24789
|
+
const { payload, fieldNames, eventRoot, eventMember } = reads;
|
|
24790
|
+
const resets = (rows.formResets ?? []).filter((row) => {
|
|
24791
|
+
const form = controls[row.controlId];
|
|
24792
|
+
return !!form && form.type === "form" /* FORM */ && formQueryReaches(form, controls);
|
|
24793
|
+
});
|
|
24794
|
+
const clears = resets.map((row) => formResetPropertyId(controls[row.controlId])).filter((propertyId) => !!propertyId).map((propertyId) => ({ propertyId, value: { kind: "clear" } }));
|
|
24795
|
+
const modelClears = resets.flatMap((row) => {
|
|
24796
|
+
const model = formResetModel(row.controlId, ctx.formModels ?? {});
|
|
24797
|
+
if (!model) return [];
|
|
24798
|
+
const keys = formModelShapeKeys(controls, row.controlId).map((key2) => {
|
|
24799
|
+
const type = formModelKeyType(key2);
|
|
24800
|
+
return type ? `${key2.name}: ${formModelKeyZero(type)}` : void 0;
|
|
24801
|
+
}).filter((entry2) => !!entry2);
|
|
24802
|
+
return [`this.${model.name}.set({ ${keys.join(", ")} })`];
|
|
24803
|
+
});
|
|
24804
|
+
const writes = [...rows.writes ?? [], ...clears].filter(
|
|
24805
|
+
(write, index, all) => all.findIndex((other) => other.propertyId === write.propertyId) === index
|
|
24806
|
+
);
|
|
24807
|
+
const statements = [
|
|
24808
|
+
...arm === "denied" ? [denialDialogCall(denialDialogOf(rows))] : [],
|
|
24809
|
+
...screenWriteStatements(
|
|
24810
|
+
ctx.variables ?? {},
|
|
24811
|
+
rows.screenWrites ?? [],
|
|
24812
|
+
payload,
|
|
24813
|
+
fieldNames,
|
|
24814
|
+
ctx.inputs ?? {},
|
|
24815
|
+
constants,
|
|
24816
|
+
eventRoot,
|
|
24817
|
+
"class",
|
|
24818
|
+
eventMember,
|
|
24819
|
+
void 0,
|
|
24820
|
+
ctx.functions ?? {}
|
|
24821
|
+
),
|
|
24822
|
+
...screenEmitStatements(
|
|
24823
|
+
ctx.outputs ?? {},
|
|
24824
|
+
rows.emits ?? [],
|
|
24825
|
+
payload,
|
|
24826
|
+
fieldNames,
|
|
24827
|
+
ctx.inputs ?? {},
|
|
24828
|
+
constants,
|
|
24829
|
+
eventRoot,
|
|
24830
|
+
"class",
|
|
24831
|
+
eventMember,
|
|
24832
|
+
reads.emitBindings
|
|
24833
|
+
)
|
|
24834
|
+
];
|
|
24835
|
+
if (ctx.properties && selfStore) {
|
|
24836
|
+
const patch = stateWritePatchExpression(
|
|
24837
|
+
ctx.properties,
|
|
24838
|
+
writes,
|
|
24839
|
+
payload,
|
|
24840
|
+
fieldNames,
|
|
24841
|
+
ctx.inputs ?? {},
|
|
24842
|
+
selfStore,
|
|
24843
|
+
constants,
|
|
24844
|
+
eventRoot,
|
|
24845
|
+
"class",
|
|
24846
|
+
eventMember,
|
|
24847
|
+
void 0,
|
|
24848
|
+
ctx.functions ?? {}
|
|
24849
|
+
);
|
|
24850
|
+
if (patch) statements.push(patch);
|
|
24851
|
+
}
|
|
24852
|
+
statements.push(...modelClears);
|
|
24853
|
+
for (const row of resets) {
|
|
24854
|
+
if (row.depth === "value") continue;
|
|
24855
|
+
statements.push(
|
|
24856
|
+
`this.${resetTargetMember(controls[row.controlId])}()?.reset()`
|
|
24857
|
+
);
|
|
24858
|
+
}
|
|
24859
|
+
const answer = isOutcomeReportDrawn(rows.report) ? armReportExpr(
|
|
24860
|
+
rows.report,
|
|
24861
|
+
{ id: "" },
|
|
24862
|
+
ctx,
|
|
24863
|
+
selfStore,
|
|
24864
|
+
payload,
|
|
24865
|
+
eventRoot,
|
|
24866
|
+
(path) => payload === "void" ? void 0 : path.length ? eventMember ? eventMember(path, `$event?.${path.join("?.")}`, eventRoot) : `$event?.${path.join("?.")}` : eventRoot
|
|
24867
|
+
) : void 0;
|
|
24868
|
+
if (rows.closesOverlay) {
|
|
24869
|
+
statements.push(`${OVERLAY_REF_MEMBER}?.close(${answer ?? "undefined"})`);
|
|
24870
|
+
} else if (answer) {
|
|
24871
|
+
statements.push(`${OVERLAY_REF_MEMBER}?.change(${answer})`);
|
|
24872
|
+
}
|
|
24873
|
+
const linkRead = outputLinkRead(ctx, selfStore.replace(/^this\./, ""));
|
|
24874
|
+
const nav = outcomeNavStatement(
|
|
24875
|
+
rows.nav,
|
|
24876
|
+
ctx.navMap ?? {},
|
|
24877
|
+
(arg) => arg.source === "args" ? argsLocal ? `${argsLocal}.${arg.arg.join("?.")}` : void 0 : linkRead(arg)
|
|
24878
|
+
);
|
|
24879
|
+
if (nav) statements.push(nav);
|
|
24880
|
+
return statements;
|
|
24881
|
+
}
|
|
24882
|
+
function classOutcomeCall(callee, args, method, outcome, ctx, selfStore, constants, reads, argsLocalName, indent2) {
|
|
24883
|
+
if (!method || (method.kind ?? "http") !== "http" || !hasCallOutcome(outcome))
|
|
24884
|
+
return [`${callee}(${args})`];
|
|
24885
|
+
const argsLocal = outcomeReadsArgs(outcome) && args && args !== "{}" ? argsLocalName : void 0;
|
|
24886
|
+
const callbacks = OUTCOME_ARMS.map((arm) => {
|
|
24887
|
+
const rows = outcome?.[arm];
|
|
24888
|
+
if (!rows || !armHasRows(rows)) return "";
|
|
24889
|
+
const lines = classArmStatements(
|
|
24890
|
+
arm,
|
|
24891
|
+
rows,
|
|
24892
|
+
ctx,
|
|
24893
|
+
selfStore,
|
|
24894
|
+
constants,
|
|
24895
|
+
reads,
|
|
24896
|
+
argsLocal
|
|
24897
|
+
);
|
|
24898
|
+
if (!lines.length) return "";
|
|
24899
|
+
return `${ARM_CALLBACK[arm]}: ${armParams(arm)} => {
|
|
24900
|
+
${lines.map((line) => `${indent2.line}${line};`).join("\n")}
|
|
24901
|
+
${indent2.close}}`;
|
|
24902
|
+
}).filter(Boolean);
|
|
24903
|
+
if (!callbacks.length) return [`${callee}(${args})`];
|
|
24904
|
+
return [
|
|
24905
|
+
...argsLocal ? [`const ${argsLocal} = ${args}`] : [],
|
|
24906
|
+
`${callee}({ ${[
|
|
24907
|
+
...argsLocal ? [`...${argsLocal}`] : args && args !== "{}" ? [spreadArgs(args)] : [],
|
|
24908
|
+
...callbacks
|
|
24909
|
+
].join(", ")} })`
|
|
24910
|
+
];
|
|
24911
|
+
}
|
|
24680
24912
|
function screenMethodsBlock(screenMethods, methods, operationOf, storeProp, ctx, constants) {
|
|
24681
24913
|
const declared = Object.values(screenMethods).sort(
|
|
24682
24914
|
(a, b) => a.name.localeCompare(b.name)
|
|
@@ -24787,9 +25019,29 @@ function screenMethodsBlock(screenMethods, methods, operationOf, storeProp, ctx,
|
|
|
24787
25019
|
statements.push(`const ${local} = ${expr}`);
|
|
24788
25020
|
}
|
|
24789
25021
|
const tested = read.filter(([, local]) => hoists.guarded.has(local));
|
|
25022
|
+
const fired = classOutcomeCall(
|
|
25023
|
+
call.callee,
|
|
25024
|
+
args,
|
|
25025
|
+
method,
|
|
25026
|
+
one.outcome,
|
|
25027
|
+
ctx,
|
|
25028
|
+
selfStore,
|
|
25029
|
+
constants,
|
|
25030
|
+
{
|
|
25031
|
+
payload,
|
|
25032
|
+
fieldNames,
|
|
25033
|
+
eventRoot,
|
|
25034
|
+
eventMember: screenMethodParamRead
|
|
25035
|
+
},
|
|
25036
|
+
mintLocal2("callArgs", taken),
|
|
25037
|
+
several && tested.length ? { line: " ", close: " " } : { line: " ", close: " " }
|
|
25038
|
+
);
|
|
24790
25039
|
if (tested.length && several) {
|
|
25040
|
+
const test = tested.map(([, local]) => `${local} !== undefined`).join(" && ");
|
|
24791
25041
|
statements.push(
|
|
24792
|
-
`if (${
|
|
25042
|
+
fired.length === 1 ? `if (${test}) ${fired[0]}` : `if (${test}) {
|
|
25043
|
+
${fired.map((line) => ` ${line};`).join("\n")}
|
|
25044
|
+
}`
|
|
24793
25045
|
);
|
|
24794
25046
|
} else {
|
|
24795
25047
|
if (tested.length) {
|
|
@@ -24797,7 +25049,7 @@ function screenMethodsBlock(screenMethods, methods, operationOf, storeProp, ctx,
|
|
|
24797
25049
|
`if (${tested.map(([, local]) => `${local} === undefined`).join(" || ")}) return`
|
|
24798
25050
|
);
|
|
24799
25051
|
}
|
|
24800
|
-
statements.push(
|
|
25052
|
+
statements.push(...fired);
|
|
24801
25053
|
}
|
|
24802
25054
|
}
|
|
24803
25055
|
}
|
|
@@ -24965,7 +25217,34 @@ function overlayOutputEmits(open, ref, node, output, ctx, storeProp, methods, op
|
|
|
24965
25217
|
"class"
|
|
24966
25218
|
);
|
|
24967
25219
|
if (patch) lines.push(patch);
|
|
24968
|
-
|
|
25220
|
+
wireBindings(wire).forEach((binding, index) => {
|
|
25221
|
+
if (!index && wire.binding && hasCallOutcome(wire.outcome)) {
|
|
25222
|
+
const parts = wireCallParts(
|
|
25223
|
+
binding,
|
|
25224
|
+
key2,
|
|
25225
|
+
payload,
|
|
25226
|
+
methods,
|
|
25227
|
+
operationOf,
|
|
25228
|
+
storeProp,
|
|
25229
|
+
ctx
|
|
25230
|
+
);
|
|
25231
|
+
if (!parts) return;
|
|
25232
|
+
lines.push(
|
|
25233
|
+
...classOutcomeCall(
|
|
25234
|
+
`${storeProp ? `this.${storeProp}` : ""}.${parts.method.name}`,
|
|
25235
|
+
parts.args,
|
|
25236
|
+
parts.method,
|
|
25237
|
+
wire.outcome,
|
|
25238
|
+
ctx,
|
|
25239
|
+
storeProp ? `this.${storeProp}` : "",
|
|
25240
|
+
ctx.constants ?? {},
|
|
25241
|
+
{ payload, fieldNames: [], eventRoot: "$event" },
|
|
25242
|
+
"callArgs",
|
|
25243
|
+
{ line: " ", close: " " }
|
|
25244
|
+
)
|
|
25245
|
+
);
|
|
25246
|
+
return;
|
|
25247
|
+
}
|
|
24969
25248
|
const call = wireCall(
|
|
24970
25249
|
binding,
|
|
24971
25250
|
key2,
|
|
@@ -24976,7 +25255,7 @@ function overlayOutputEmits(open, ref, node, output, ctx, storeProp, methods, op
|
|
|
24976
25255
|
ctx
|
|
24977
25256
|
);
|
|
24978
25257
|
if (call) lines.push(call);
|
|
24979
|
-
}
|
|
25258
|
+
});
|
|
24980
25259
|
return [
|
|
24981
25260
|
{
|
|
24982
25261
|
name: target.name,
|
|
@@ -25625,8 +25904,8 @@ function armSubjectExpr(check, node, ctx, storeProp, payload, eventRoot) {
|
|
|
25625
25904
|
const path = (check.event ?? []).filter(Boolean);
|
|
25626
25905
|
return payload !== "record" || !path.length ? eventRoot : `$event?.${path.join("?.")}`;
|
|
25627
25906
|
}
|
|
25628
|
-
function armReportExpr(report, node, ctx, storeProp, payload, eventRoot) {
|
|
25629
|
-
const subject = armSubjectExpr(
|
|
25907
|
+
function armReportExpr(report, node, ctx, storeProp, payload, eventRoot, eventRead) {
|
|
25908
|
+
const subject = eventRead && report.source === "event" ? eventRead((report.event ?? []).filter(Boolean)) : armSubjectExpr(
|
|
25630
25909
|
{ ...report, id: "", operator: "==" },
|
|
25631
25910
|
node,
|
|
25632
25911
|
ctx,
|
|
@@ -26177,7 +26456,7 @@ function methodArgsOf(method, operationOf, ctx) {
|
|
|
26177
26456
|
}
|
|
26178
26457
|
return op ? methodArgs(method, op) : authoredArgs(method);
|
|
26179
26458
|
}
|
|
26180
|
-
function autoCallsBlock(calls, methods, operationOf, storeProp, inputs, constants, functions = {}, bindings = {}, storePropOf, outputs = {}) {
|
|
26459
|
+
function autoCallsBlock(calls, methods, operationOf, storeProp, inputs, constants, functions = {}, bindings = {}, storePropOf, outputs = {}, ctx) {
|
|
26181
26460
|
const byName = new Map(
|
|
26182
26461
|
Object.values(inputs).map((input) => [input.id, input.name])
|
|
26183
26462
|
);
|
|
@@ -26316,7 +26595,23 @@ ${reads.map(([expr, local]) => ` const ${local} = ${expr};`).join("\n")}` :
|
|
|
26316
26595
|
${emits.map((line) => ` ${line};`).join("\n")}
|
|
26317
26596
|
});` : "";
|
|
26318
26597
|
const callLine = method ? `
|
|
26319
|
-
|
|
26598
|
+
${classOutcomeCall(
|
|
26599
|
+
`this.${storePropOf?.(method.id) ?? storeProp}.${method.name}`,
|
|
26600
|
+
args,
|
|
26601
|
+
method,
|
|
26602
|
+
ctx ? call.outcome : void 0,
|
|
26603
|
+
ctx ?? {},
|
|
26604
|
+
storeProp ? `this.${storeProp}` : "",
|
|
26605
|
+
constants,
|
|
26606
|
+
{
|
|
26607
|
+
payload: "void",
|
|
26608
|
+
fieldNames: [],
|
|
26609
|
+
eventRoot: "$event",
|
|
26610
|
+
emitBindings: { scope: bindings.bindingScope ?? {} }
|
|
26611
|
+
},
|
|
26612
|
+
mintLocal2("callArgs", taken),
|
|
26613
|
+
{ line: " ", close: " " }
|
|
26614
|
+
).map((line) => ` ${line};`).join("\n")}` : "";
|
|
26320
26615
|
return `${flagDecl}
|
|
26321
26616
|
private readonly ${member} = effect(() => {${hoists}${guard}${latch}${emitBlock}${callLine}
|
|
26322
26617
|
});
|
|
@@ -27463,7 +27758,29 @@ ${tables.map(
|
|
|
27463
27758
|
ctx,
|
|
27464
27759
|
payloads
|
|
27465
27760
|
);
|
|
27466
|
-
const
|
|
27761
|
+
const screenMethodsBody = screenMethodsBlock(
|
|
27762
|
+
ctx.screenMethods ?? {},
|
|
27763
|
+
methods,
|
|
27764
|
+
operationOf,
|
|
27765
|
+
storeProp,
|
|
27766
|
+
ctx,
|
|
27767
|
+
constants
|
|
27768
|
+
);
|
|
27769
|
+
const autoCallsBody = autoCallsBlock(
|
|
27770
|
+
autoCalls,
|
|
27771
|
+
methods,
|
|
27772
|
+
operationOf,
|
|
27773
|
+
storeProp,
|
|
27774
|
+
ctx.inputs ?? {},
|
|
27775
|
+
constants,
|
|
27776
|
+
ctx.functions ?? {},
|
|
27777
|
+
callArgBindings(ctx, storeProp, { memberPrefix: "this." }),
|
|
27778
|
+
ctx.storePropOf,
|
|
27779
|
+
ctx.outputs ?? {},
|
|
27780
|
+
ctx
|
|
27781
|
+
);
|
|
27782
|
+
const classArmsBody = `${screenMethodsBody}${autoCallsBody}`;
|
|
27783
|
+
const usesModal = `${outputOpenBody}${menuActionHandlersBody}${outputArmHandlersBody}${classArmsBody}`.includes(
|
|
27467
27784
|
"this.modal."
|
|
27468
27785
|
) || Object.values(ctx.controlMap ?? {}).some(controlDrawsDenial);
|
|
27469
27786
|
const drawsOverlayClose = Object.values(ctx.controlMap ?? {}).some(
|
|
@@ -27477,21 +27794,9 @@ ${tables.map(
|
|
|
27477
27794
|
const classReadsNavRef = `${screenVariantsBody}${screenComputedsBody}`.includes(
|
|
27478
27795
|
`${NAV_REF_MEMBER}?.`
|
|
27479
27796
|
);
|
|
27480
|
-
const
|
|
27481
|
-
autoCalls,
|
|
27482
|
-
methods,
|
|
27483
|
-
operationOf,
|
|
27484
|
-
storeProp,
|
|
27485
|
-
ctx.inputs ?? {},
|
|
27486
|
-
constants,
|
|
27487
|
-
ctx.functions ?? {},
|
|
27488
|
-
callArgBindings(ctx, storeProp, { memberPrefix: "this." }),
|
|
27489
|
-
ctx.storePropOf,
|
|
27490
|
-
ctx.outputs ?? {}
|
|
27491
|
-
);
|
|
27492
|
-
const submitTargetQueriesBody = submitTargetQueriesBlock(
|
|
27797
|
+
const submitTargetQueriesBody = `${submitTargetQueriesBlock(
|
|
27493
27798
|
ctx.controlMap ?? {}
|
|
27494
|
-
)
|
|
27799
|
+
)}${resetTargetQueriesBlock(ctx)}`;
|
|
27495
27800
|
const angularCore = [
|
|
27496
27801
|
"ChangeDetectionStrategy",
|
|
27497
27802
|
"Component",
|
|
@@ -27499,7 +27804,7 @@ ${tables.map(
|
|
|
27499
27804
|
...screenComputedsBody || screenVariantsBody || cardsBody || messageParamsBody ? ["computed"] : [],
|
|
27500
27805
|
...autoCalls.length ? ["effect"] : [],
|
|
27501
27806
|
...autoCallsBody.includes("untracked(") ? ["untracked"] : [],
|
|
27502
|
-
...needsStore || usesAuth || injectedGlobalStores.length > 0 || usesModal || drawsOverlayClose || drawsOutcomeNav || classReadsNavRef || `${outputLinkBody}${menuActionHandlersBody}${outputArmHandlersBody}`.includes(
|
|
27807
|
+
...needsStore || usesAuth || injectedGlobalStores.length > 0 || usesModal || drawsOverlayClose || drawsOutcomeNav || classReadsNavRef || `${classArmsBody}${outputOpenBody}`.includes(`${OVERLAY_REF_MEMBER}?.`) || `${classArmsBody}${outputOpenBody}`.includes(`${NAV_REF_MEMBER}?.`) || `${outputLinkBody}${menuActionHandlersBody}${outputArmHandlersBody}`.includes(
|
|
27503
27808
|
`${NAV_REF_MEMBER}?.`
|
|
27504
27809
|
) ? ["inject"] : [],
|
|
27505
27810
|
...inputs.length ? ["input"] : [],
|
|
@@ -27693,7 +27998,7 @@ ${tables.map(
|
|
|
27693
27998
|
const modalBody = usesModal ? `
|
|
27694
27999
|
protected readonly modal = inject(ModalStore);
|
|
27695
28000
|
` : "";
|
|
27696
|
-
const usesOverlayRef = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}`.includes(
|
|
28001
|
+
const usesOverlayRef = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}${classArmsBody}${outputOpenBody}`.includes(
|
|
27697
28002
|
`${OVERLAY_REF_MEMBER}?.`
|
|
27698
28003
|
);
|
|
27699
28004
|
const overlayRefImport = usesOverlayRef ? `import { MODAL_REF } from '@magmonium/one';
|
|
@@ -27701,7 +28006,7 @@ ${tables.map(
|
|
|
27701
28006
|
const overlayRefBody = usesOverlayRef ? `
|
|
27702
28007
|
private readonly overlay = inject(MODAL_REF, { optional: true });
|
|
27703
28008
|
` : "";
|
|
27704
|
-
const usesNavRef = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}${screenVariantsBody}${screenComputedsBody}${outputLinkBody}`.includes(
|
|
28009
|
+
const usesNavRef = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}${screenVariantsBody}${screenComputedsBody}${outputLinkBody}${classArmsBody}${outputOpenBody}`.includes(
|
|
27705
28010
|
`${NAV_REF_MEMBER}?.`
|
|
27706
28011
|
);
|
|
27707
28012
|
const navRefImport = usesNavRef ? `import { NAV_STORE_REF, type NavStoreRef } from '@magmonium/one';
|
|
@@ -27720,7 +28025,7 @@ ${tables.map(
|
|
|
27720
28025
|
})
|
|
27721
28026
|
| null;
|
|
27722
28027
|
` : "";
|
|
27723
|
-
const usesNavRouter = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}${outputLinkBody}`.includes(
|
|
28028
|
+
const usesNavRouter = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}${outputLinkBody}${classArmsBody}${outputOpenBody}`.includes(
|
|
27724
28029
|
`${NAV_ROUTER_MEMBER}.`
|
|
27725
28030
|
);
|
|
27726
28031
|
const navRouterImport = usesNavRouter ? `import { ActivatedRoute, Router } from '@angular/router';
|
|
@@ -27730,14 +28035,6 @@ ${tables.map(
|
|
|
27730
28035
|
|
|
27731
28036
|
private readonly navRoute = inject(ActivatedRoute);
|
|
27732
28037
|
` : "";
|
|
27733
|
-
const screenMethodsBody = screenMethodsBlock(
|
|
27734
|
-
ctx.screenMethods ?? {},
|
|
27735
|
-
methods,
|
|
27736
|
-
operationOf,
|
|
27737
|
-
storeProp,
|
|
27738
|
-
ctx,
|
|
27739
|
-
constants
|
|
27740
|
-
);
|
|
27741
28038
|
const payloadsBody = payloadPropsBlock(payloads);
|
|
27742
28039
|
const transformMembersBody = transformMembersBlock(
|
|
27743
28040
|
templateRefs,
|
|
@@ -28129,7 +28426,7 @@ __export(package_exports, {
|
|
|
28129
28426
|
version: () => version
|
|
28130
28427
|
});
|
|
28131
28428
|
var name = "@magmonium/one";
|
|
28132
|
-
var version = "0.4.
|
|
28429
|
+
var version = "0.4.117";
|
|
28133
28430
|
var description = "Magmonium One \u2014 Angular design-system primitives for mm Apps";
|
|
28134
28431
|
var author = "magmonium";
|
|
28135
28432
|
var license = "MIT";
|
|
@@ -28197,7 +28494,7 @@ __export(package_exports2, {
|
|
|
28197
28494
|
version: () => version2
|
|
28198
28495
|
});
|
|
28199
28496
|
var name2 = "@magmonium/cli";
|
|
28200
|
-
var version2 = "0.8.
|
|
28497
|
+
var version2 = "0.8.29";
|
|
28201
28498
|
var description2 = "A powerful and extensible asset compilation tool that can be shared across multiple projects";
|
|
28202
28499
|
var bin = {
|
|
28203
28500
|
"mag-cli": "bin/cli.js"
|
|
@@ -31495,6 +31792,15 @@ function sanitizeStoreHook(value, properties, methods, roots = properties) {
|
|
|
31495
31792
|
if (!reads.length && !writes.length && !calls.length) return void 0;
|
|
31496
31793
|
return { reads, writes, calls };
|
|
31497
31794
|
}
|
|
31795
|
+
function storedCallOutcome(value, methodId) {
|
|
31796
|
+
if (!methodId || !value || typeof value !== "object" || Array.isArray(value))
|
|
31797
|
+
return {};
|
|
31798
|
+
const outcome = value;
|
|
31799
|
+
const arms = ["success", "denied", "failure"].filter(
|
|
31800
|
+
(arm) => !!outcome[arm] && typeof outcome[arm] === "object"
|
|
31801
|
+
);
|
|
31802
|
+
return arms.length ? { outcome: Object.fromEntries(arms.map((arm) => [arm, outcome[arm]])) } : {};
|
|
31803
|
+
}
|
|
31498
31804
|
function sanitizeAutoCalls(calls, kind) {
|
|
31499
31805
|
if (!Array.isArray(calls)) return [];
|
|
31500
31806
|
const result = [];
|
|
@@ -31523,6 +31829,7 @@ function sanitizeAutoCalls(calls, kind) {
|
|
|
31523
31829
|
// Trusted like `args`: a read naming something gone drops at emit and is
|
|
31524
31830
|
// reported as an EmitGap (ADR 0206).
|
|
31525
31831
|
...reads.length ? { reads } : {},
|
|
31832
|
+
...storedCallOutcome(call.outcome, methodId),
|
|
31526
31833
|
// Kept only where it was drawn: an absent `when` is derived from the rows
|
|
31527
31834
|
// by screenAutoCallWhen, so a Screen saved before ADR 0080 loads exactly
|
|
31528
31835
|
// as it emitted then.
|
|
@@ -31552,7 +31859,11 @@ function sanitizeScreenMethods(value, taken) {
|
|
|
31552
31859
|
...Array.isArray(method.params) && method.params.length ? { params: sanitizeScreenMethodParams(method.params) } : {},
|
|
31553
31860
|
// The further calls (GLOSSARY.md OutputCall), each trusted the way the
|
|
31554
31861
|
// handler's own call is: an object, one of the two ids at most.
|
|
31555
|
-
...Array.isArray(method.calls) && method.calls.length ? { calls: sanitizeScreenMethodCalls(method.calls) } : {}
|
|
31862
|
+
...Array.isArray(method.calls) && method.calls.length ? { calls: sanitizeScreenMethodCalls(method.calls) } : {},
|
|
31863
|
+
...storedCallOutcome(
|
|
31864
|
+
method.outcome,
|
|
31865
|
+
typeof method.methodId === "string" ? method.methodId : void 0
|
|
31866
|
+
)
|
|
31556
31867
|
};
|
|
31557
31868
|
}
|
|
31558
31869
|
return result;
|
|
@@ -31560,7 +31871,11 @@ function sanitizeScreenMethods(value, taken) {
|
|
|
31560
31871
|
function sanitizeScreenMethodCalls(value) {
|
|
31561
31872
|
return value.filter((raw) => !!raw && typeof raw === "object").map((call) => ({
|
|
31562
31873
|
...typeof call.methodId === "string" && call.methodId ? { methodId: call.methodId } : typeof call.functionId === "string" && call.functionId ? { functionId: call.functionId } : {},
|
|
31563
|
-
...Array.isArray(call.args) && call.args.length ? { args: call.args } : {}
|
|
31874
|
+
...Array.isArray(call.args) && call.args.length ? { args: call.args } : {},
|
|
31875
|
+
...storedCallOutcome(
|
|
31876
|
+
call.outcome,
|
|
31877
|
+
typeof call.methodId === "string" ? call.methodId : void 0
|
|
31878
|
+
)
|
|
31564
31879
|
}));
|
|
31565
31880
|
}
|
|
31566
31881
|
function sanitizeScreenMethodParams(value) {
|
|
@@ -36104,7 +36419,13 @@ var featureContextOf = (ws, feature) => ({
|
|
|
36104
36419
|
var featureMethodArms = (ws, featureId) => featureId ? methodArms(
|
|
36105
36420
|
ws.screens.filter(
|
|
36106
36421
|
({ meta }) => meta.kind === "feature" && meta.featureId === featureId
|
|
36107
|
-
).map(({ state }) => state.controlMap)
|
|
36422
|
+
).map(({ state }) => state.controlMap),
|
|
36423
|
+
ws.screens.filter(
|
|
36424
|
+
({ meta }) => meta.kind === "feature" && meta.featureId === featureId
|
|
36425
|
+
).map(({ meta }) => ({
|
|
36426
|
+
methods: meta.methods,
|
|
36427
|
+
autoCalls: meta.autoCalls
|
|
36428
|
+
}))
|
|
36108
36429
|
) : {};
|
|
36109
36430
|
var featureUsesBusy = (ws, featureId) => !!featureId && ws.screens.some(
|
|
36110
36431
|
({ meta, state }) => meta.kind === "feature" && meta.featureId === featureId && controlMapUsesBusy(state.controlMap)
|
|
@@ -36391,7 +36712,13 @@ var emitAuthoredAssets = (ws, stringify) => {
|
|
|
36391
36712
|
(feature) => methodConfirmKeys(feature.methods)
|
|
36392
36713
|
),
|
|
36393
36714
|
// A DenialDialog's messages, handed to the dialog the same way.
|
|
36394
|
-
...denialTranslationKeys(
|
|
36715
|
+
...denialTranslationKeys(
|
|
36716
|
+
map,
|
|
36717
|
+
ws.screens.map(({ meta }) => ({
|
|
36718
|
+
methods: meta.methods,
|
|
36719
|
+
autoCalls: meta.autoCalls
|
|
36720
|
+
}))
|
|
36721
|
+
)
|
|
36395
36722
|
]).forEach((asset) => {
|
|
36396
36723
|
files3.push({
|
|
36397
36724
|
path: `mag_assets/${asset.path}`,
|
|
@@ -37201,6 +37528,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
37201
37528
|
checkedFieldIds,
|
|
37202
37529
|
checksUsingFunction,
|
|
37203
37530
|
childNavId,
|
|
37531
|
+
classCallOutcomes,
|
|
37204
37532
|
classCardScope,
|
|
37205
37533
|
clearOutputCallRows,
|
|
37206
37534
|
clearOutputGroupRows,
|
|
@@ -37276,6 +37604,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
37276
37604
|
controlUsesOverlayRef,
|
|
37277
37605
|
controlVariantIds,
|
|
37278
37606
|
controlVariants,
|
|
37607
|
+
controlWireOutcomes,
|
|
37279
37608
|
countFormResetReferences,
|
|
37280
37609
|
countIconReferences,
|
|
37281
37610
|
countOptionSetReferences,
|
|
@@ -37467,6 +37796,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
37467
37796
|
formModelSourceType,
|
|
37468
37797
|
formModelStateOptions,
|
|
37469
37798
|
formModelTransforms,
|
|
37799
|
+
formQueryReaches,
|
|
37470
37800
|
formRefName,
|
|
37471
37801
|
formRefNames,
|
|
37472
37802
|
formResetDepths,
|
|
@@ -38141,6 +38471,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
38141
38471
|
renameMenuItemId,
|
|
38142
38472
|
renameScreenMethodParamReads,
|
|
38143
38473
|
repairCallOutcome,
|
|
38474
|
+
repairClassCallSites,
|
|
38144
38475
|
repairFieldCheckSignatures,
|
|
38145
38476
|
repairMarkdownLinkUrls,
|
|
38146
38477
|
repairMessageVariables,
|