@magmonium/cli 0.8.0 → 0.8.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/codegen/index.js +401 -87
- package/package.json +1 -1
package/codegen/index.js
CHANGED
|
@@ -512,6 +512,8 @@ __export(index_exports, {
|
|
|
512
512
|
createConfirm: () => createConfirm,
|
|
513
513
|
createGroup: () => createGroup,
|
|
514
514
|
createOpen: () => createOpen,
|
|
515
|
+
createOutputNav: () => createOutputNav,
|
|
516
|
+
createOutputNewTab: () => createOutputNewTab,
|
|
515
517
|
createOutputOpen: () => createOutputOpen,
|
|
516
518
|
createPlatformNavMap: () => createPlatformNavMap,
|
|
517
519
|
createRule: () => createRule,
|
|
@@ -1125,6 +1127,15 @@ __export(index_exports, {
|
|
|
1125
1127
|
outputCallKey: () => outputCallKey,
|
|
1126
1128
|
outputCallKeys: () => outputCallKeys,
|
|
1127
1129
|
outputCallLabel: () => outputCallLabel,
|
|
1130
|
+
outputLinkBindingTargets: () => outputLinkBindingTargets,
|
|
1131
|
+
outputLinkMemberName: () => outputLinkMemberName,
|
|
1132
|
+
outputLinkParamType: () => outputLinkParamType,
|
|
1133
|
+
outputNavOf: () => outputNavOf,
|
|
1134
|
+
outputNavStatement: () => outputNavStatement,
|
|
1135
|
+
outputNewTabFunctionId: () => outputNewTabFunctionId,
|
|
1136
|
+
outputNewTabFunctions: () => outputNewTabFunctions,
|
|
1137
|
+
outputNewTabOf: () => outputNewTabOf,
|
|
1138
|
+
outputNewTabStatements: () => outputNewTabStatements,
|
|
1128
1139
|
outputOpenConstTargets: () => outputOpenConstTargets,
|
|
1129
1140
|
outputOpenFixedAllowed: () => outputOpenFixedAllowed,
|
|
1130
1141
|
outputOpenHostInputIds: () => outputOpenHostInputIds,
|
|
@@ -1197,6 +1208,7 @@ __export(index_exports, {
|
|
|
1197
1208
|
pruneMappings: () => pruneMappings,
|
|
1198
1209
|
pruneMenuActions: () => pruneMenuActions,
|
|
1199
1210
|
pruneOutputCalls: () => pruneOutputCalls,
|
|
1211
|
+
pruneOutputLinkArgs: () => pruneOutputLinkArgs,
|
|
1200
1212
|
pruneUnknownShapeRefs: () => pruneUnknownShapeRefs,
|
|
1201
1213
|
pruneUnknownVariants: () => pruneUnknownVariants,
|
|
1202
1214
|
prunedInstanceSource: () => prunedInstanceSource,
|
|
@@ -1531,6 +1543,8 @@ __export(index_exports, {
|
|
|
1531
1543
|
validateMethodName: () => validateMethodName,
|
|
1532
1544
|
validateNavSlug: () => validateNavSlug,
|
|
1533
1545
|
validateOutcomeNav: () => validateOutcomeNav,
|
|
1546
|
+
validateOutputNav: () => validateOutputNav,
|
|
1547
|
+
validateOutputNewTab: () => validateOutputNewTab,
|
|
1534
1548
|
validateOutputOpen: () => validateOutputOpen,
|
|
1535
1549
|
validatePatternName: () => validatePatternName,
|
|
1536
1550
|
validateScreenEmits: () => validateScreenEmits,
|
|
@@ -2883,6 +2897,7 @@ var SHARED_ICONS = [
|
|
|
2883
2897
|
// libs/one/src/lib/shared/ui/doc/doc-style.ts
|
|
2884
2898
|
var DEFAULT_DOC_VARIANT = "plain";
|
|
2885
2899
|
var DEFAULT_DOC_DENSITY = "default";
|
|
2900
|
+
var DEFAULT_DOC_ALIGN = "left";
|
|
2886
2901
|
|
|
2887
2902
|
// libs/one/src/lib/shared/functions/size/size-converter.ts
|
|
2888
2903
|
var SIZE_LENGTH = {
|
|
@@ -6040,15 +6055,15 @@ function transformNeverUndefined(expr, functions) {
|
|
|
6040
6055
|
}
|
|
6041
6056
|
var expressionNullish = (expr) => {
|
|
6042
6057
|
let depth = 0;
|
|
6043
|
-
let
|
|
6058
|
+
let quote5 = "";
|
|
6044
6059
|
for (let i = 0; i < expr.length; i++) {
|
|
6045
6060
|
const char = expr[i];
|
|
6046
|
-
if (
|
|
6061
|
+
if (quote5) {
|
|
6047
6062
|
if (char === "\\") i++;
|
|
6048
|
-
else if (char ===
|
|
6063
|
+
else if (char === quote5) quote5 = "";
|
|
6049
6064
|
continue;
|
|
6050
6065
|
}
|
|
6051
|
-
if (char === "'" || char === '"' || char === "`")
|
|
6066
|
+
if (char === "'" || char === '"' || char === "`") quote5 = char;
|
|
6052
6067
|
else if (char === "(" || char === "[") depth++;
|
|
6053
6068
|
else if (char === ")" || char === "]") depth--;
|
|
6054
6069
|
else if (char === "?" && expr[i + 1] === "." && depth === 0) return true;
|
|
@@ -9645,7 +9660,9 @@ var OUTPUT_MAPS = [
|
|
|
9645
9660
|
"outputWrites",
|
|
9646
9661
|
"outputScreenWrites",
|
|
9647
9662
|
"outputOutcomes",
|
|
9648
|
-
"outputOpens"
|
|
9663
|
+
"outputOpens",
|
|
9664
|
+
"outputNavs",
|
|
9665
|
+
"outputNewTabs"
|
|
9649
9666
|
];
|
|
9650
9667
|
var offersOutputArms = (control) => !!control && control.type !== "context_menu" /* CONTEXT_MENU */;
|
|
9651
9668
|
var wiredArmIds = (control, output) => {
|
|
@@ -9670,7 +9687,7 @@ function outputArms(control, output) {
|
|
|
9670
9687
|
var isOutputConditional = (control, output) => outputArms(control, output).length > 0;
|
|
9671
9688
|
var isOutputBound = (control, output) => !!control && (outputArms(control, output).length > 0 || outputCallKeys(control, output).some(
|
|
9672
9689
|
(key2) => isOutputCallBound(control, key2)
|
|
9673
|
-
) || !!control.outputOpens?.[output]?.screenId || outputArgRows(control.outputArgs, output).length > 0 || stateWriteRows(control.outputWrites, output).length > 0 || screenWriteRows(control.outputScreenWrites, output).length > 0);
|
|
9690
|
+
) || !!control.outputOpens?.[output]?.screenId || !!control.outputNavs?.[output] || !!control.outputNewTabs?.[output] || outputArgRows(control.outputArgs, output).length > 0 || stateWriteRows(control.outputWrites, output).length > 0 || screenWriteRows(control.outputScreenWrites, output).length > 0);
|
|
9674
9691
|
var outputArmMode = (arm) => arm.mode ?? "condition";
|
|
9675
9692
|
var scannedOutputArms = (control, output) => outputArms(control, output).filter(
|
|
9676
9693
|
(arm) => outputArmMode(arm) === "condition"
|
|
@@ -10624,7 +10641,9 @@ var OUTPUT_MAPS2 = [
|
|
|
10624
10641
|
"outputWrites",
|
|
10625
10642
|
"outputScreenWrites",
|
|
10626
10643
|
"outputOutcomes",
|
|
10627
|
-
"outputOpens"
|
|
10644
|
+
"outputOpens",
|
|
10645
|
+
"outputNavs",
|
|
10646
|
+
"outputNewTabs"
|
|
10628
10647
|
];
|
|
10629
10648
|
var wiresMenuActions = (control) => control?.type === "context_menu" /* CONTEXT_MENU */;
|
|
10630
10649
|
var wiredKeys = (control) => {
|
|
@@ -11923,8 +11942,8 @@ function storeReaders(feature) {
|
|
|
11923
11942
|
}
|
|
11924
11943
|
var pascalOf = (slug2) => slug2.split("-").filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join("");
|
|
11925
11944
|
var camelOf = (slug2) => {
|
|
11926
|
-
const
|
|
11927
|
-
return
|
|
11945
|
+
const pascal4 = pascalOf(slug2);
|
|
11946
|
+
return pascal4[0].toLowerCase() + pascal4.slice(1);
|
|
11928
11947
|
};
|
|
11929
11948
|
var slugOf = (name3) => name3.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "page";
|
|
11930
11949
|
var featureStorePropName = (featureName) => `${camelOf(slugOf(featureName))}Store`;
|
|
@@ -12023,8 +12042,8 @@ function toPascalCase(slug2) {
|
|
|
12023
12042
|
return slug2.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
12024
12043
|
}
|
|
12025
12044
|
function toCamelCase(slug2) {
|
|
12026
|
-
const
|
|
12027
|
-
return
|
|
12045
|
+
const pascal4 = toPascalCase(slug2);
|
|
12046
|
+
return pascal4.charAt(0).toLowerCase() + pascal4.slice(1);
|
|
12028
12047
|
}
|
|
12029
12048
|
function resolveComponentNaming(prefix, featureName, screenName) {
|
|
12030
12049
|
const feature = slugifyComponentName(featureName);
|
|
@@ -15598,7 +15617,7 @@ function outcomeNavStatePaths(properties, shapes) {
|
|
|
15598
15617
|
const walk = (path, label, dataType, one, depth) => {
|
|
15599
15618
|
if (!one || !dataType) return;
|
|
15600
15619
|
if (dataType.type === "string" || dataType.type === "number") {
|
|
15601
|
-
found.push({ path, label });
|
|
15620
|
+
found.push({ path, label, type: dataType.type });
|
|
15602
15621
|
return;
|
|
15603
15622
|
}
|
|
15604
15623
|
if (dataType.type !== "shape" || depth > 4) return;
|
|
@@ -15632,6 +15651,8 @@ function isOutcomeNavArgFilled(arg) {
|
|
|
15632
15651
|
return !!arg.navId;
|
|
15633
15652
|
case "state":
|
|
15634
15653
|
return arg.path.length > 0;
|
|
15654
|
+
case "binding":
|
|
15655
|
+
return !!arg.binding?.root;
|
|
15635
15656
|
case "fixed":
|
|
15636
15657
|
return String(arg.value ?? "").trim() !== "";
|
|
15637
15658
|
}
|
|
@@ -15664,15 +15685,25 @@ function countOutcomeNavReferences(controlMaps, navId) {
|
|
|
15664
15685
|
...Object.values(control.outputOutcomes ?? {}),
|
|
15665
15686
|
...Object.values(control.screenOutputOutcomes ?? {})
|
|
15666
15687
|
];
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
|
|
15674
|
-
|
|
15675
|
-
}
|
|
15688
|
+
const navs = [
|
|
15689
|
+
...outcomes.flatMap(
|
|
15690
|
+
(outcome) => OUTCOME_ARMS.map((arm) => outcome?.[arm]?.nav)
|
|
15691
|
+
),
|
|
15692
|
+
...Object.values(control.outputNavs ?? {})
|
|
15693
|
+
];
|
|
15694
|
+
for (const nav of navs) {
|
|
15695
|
+
if (!nav || nav.kind !== "nav") continue;
|
|
15696
|
+
const named = within(nav.navId, navId) || Object.values(nav.params ?? {}).some(
|
|
15697
|
+
(arg) => arg.source === "route" && within(arg.navId, navId)
|
|
15698
|
+
);
|
|
15699
|
+
if (named) total += 1;
|
|
15700
|
+
}
|
|
15701
|
+
for (const tab of Object.values(control.outputNewTabs ?? {})) {
|
|
15702
|
+
const args = tab?.mode === "value" ? [tab.value] : tab?.mode === "function" ? Object.values(tab.args ?? {}) : [];
|
|
15703
|
+
if (args.some(
|
|
15704
|
+
(arg) => arg?.source === "route" && within(arg.navId, navId)
|
|
15705
|
+
))
|
|
15706
|
+
total += 1;
|
|
15676
15707
|
}
|
|
15677
15708
|
}
|
|
15678
15709
|
}
|
|
@@ -15711,6 +15742,180 @@ function outcomeNavStatement(nav, navMap, read) {
|
|
|
15711
15742
|
return guards.length ? `if (${guards.join(" && ")}) ${call}` : call;
|
|
15712
15743
|
}
|
|
15713
15744
|
|
|
15745
|
+
// libs/codegen/src/lib/output-link-helper.ts
|
|
15746
|
+
var isNav = (value) => typeof value === "object" && value !== null && (value.kind === "parent" || value.kind === "nav");
|
|
15747
|
+
var NEW_TAB_MODES = [
|
|
15748
|
+
"static",
|
|
15749
|
+
"value",
|
|
15750
|
+
"function"
|
|
15751
|
+
];
|
|
15752
|
+
var asNewTab = (value) => {
|
|
15753
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
15754
|
+
const raw = value;
|
|
15755
|
+
const mode = NEW_TAB_MODES.find((one) => one === raw["mode"]);
|
|
15756
|
+
if (mode === "value")
|
|
15757
|
+
return {
|
|
15758
|
+
mode,
|
|
15759
|
+
...raw["value"] ? { value: raw["value"] } : {}
|
|
15760
|
+
};
|
|
15761
|
+
if (mode === "function")
|
|
15762
|
+
return {
|
|
15763
|
+
mode,
|
|
15764
|
+
functionId: String(raw["functionId"] ?? ""),
|
|
15765
|
+
...raw["args"] ? { args: raw["args"] } : {}
|
|
15766
|
+
};
|
|
15767
|
+
if (mode === "static" || typeof raw["url"] === "string")
|
|
15768
|
+
return { mode: "static", url: String(raw["url"] ?? "") };
|
|
15769
|
+
return void 0;
|
|
15770
|
+
};
|
|
15771
|
+
function outputNavOf(navs, output) {
|
|
15772
|
+
const nav = navs?.[output];
|
|
15773
|
+
return isNav(nav) ? nav : void 0;
|
|
15774
|
+
}
|
|
15775
|
+
function outputNewTabOf(tabs, output) {
|
|
15776
|
+
return asNewTab(tabs?.[output]);
|
|
15777
|
+
}
|
|
15778
|
+
function outputLinkBindingTargets(scope, type) {
|
|
15779
|
+
if (!scope) return [];
|
|
15780
|
+
return bindingOptions(
|
|
15781
|
+
scope,
|
|
15782
|
+
(dataType, cardinality) => cardinality === "one" && (type ? dataType?.type === type : dataType?.type === "string" || dataType?.type === "number" || dataType?.type === "boolean")
|
|
15783
|
+
);
|
|
15784
|
+
}
|
|
15785
|
+
var createOutputNav = () => ({ kind: "parent" });
|
|
15786
|
+
var createOutputNewTab = () => ({
|
|
15787
|
+
mode: "static",
|
|
15788
|
+
url: ""
|
|
15789
|
+
});
|
|
15790
|
+
function outputLinkParamType(param) {
|
|
15791
|
+
if (param.cardinality !== "one") return void 0;
|
|
15792
|
+
const type = param.dataType.type;
|
|
15793
|
+
return type === "string" || type === "number" || type === "boolean" ? type : void 0;
|
|
15794
|
+
}
|
|
15795
|
+
function outputNewTabFunctions(functions) {
|
|
15796
|
+
return Object.values(functions).filter(
|
|
15797
|
+
(fn) => fn.returnType.type === "string" && fn.returnCardinality === "one" && fn.params.every((param) => !!outputLinkParamType(param))
|
|
15798
|
+
).sort((a, b) => a.name.localeCompare(b.name));
|
|
15799
|
+
}
|
|
15800
|
+
var isLinkArgFilled = (arg) => isOutcomeNavArgFilled(arg) && arg?.source !== "args";
|
|
15801
|
+
function validateOutputNav(nav, navMap) {
|
|
15802
|
+
const error = validateOutcomeNav(nav, navMap);
|
|
15803
|
+
if (error) return error;
|
|
15804
|
+
return Object.values(nav?.params ?? {}).some((arg) => arg.source === "args") ? "outcome-nav-param-unfilled" : void 0;
|
|
15805
|
+
}
|
|
15806
|
+
function validateOutputNewTab(tab, functions) {
|
|
15807
|
+
if (!tab) return void 0;
|
|
15808
|
+
switch (tab.mode) {
|
|
15809
|
+
case "static":
|
|
15810
|
+
return tab.url.trim() ? void 0 : "new-tab-no-url";
|
|
15811
|
+
case "value":
|
|
15812
|
+
return isLinkArgFilled(tab.value) && tab.value?.source !== "fixed" ? void 0 : "new-tab-value-unfilled";
|
|
15813
|
+
case "function": {
|
|
15814
|
+
if (!tab.functionId) return "new-tab-no-function";
|
|
15815
|
+
if (!functions) return void 0;
|
|
15816
|
+
const fn = functions[tab.functionId];
|
|
15817
|
+
if (!fn || !outputNewTabFunctions({ [fn.id]: fn }).length)
|
|
15818
|
+
return "new-tab-function-gone";
|
|
15819
|
+
return fn.params.every((param) => isLinkArgFilled(tab.args?.[param.id])) ? void 0 : "new-tab-param-unfilled";
|
|
15820
|
+
}
|
|
15821
|
+
}
|
|
15822
|
+
}
|
|
15823
|
+
var quote3 = (value) => `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
|
|
15824
|
+
function outputNavStatement(nav, navMap, read) {
|
|
15825
|
+
if (!nav || validateOutputNav(nav, navMap)) return void 0;
|
|
15826
|
+
return outcomeNavStatement(nav, navMap, read);
|
|
15827
|
+
}
|
|
15828
|
+
var fixedLiteral = (value, type) => {
|
|
15829
|
+
if (type === "number" && Number.isFinite(Number(value)))
|
|
15830
|
+
return String(Number(value));
|
|
15831
|
+
if (type === "boolean") return String(value === true || value === "true");
|
|
15832
|
+
return quote3(String(value));
|
|
15833
|
+
};
|
|
15834
|
+
var COERCE = {
|
|
15835
|
+
string: "String",
|
|
15836
|
+
number: "Number",
|
|
15837
|
+
boolean: "Boolean"
|
|
15838
|
+
};
|
|
15839
|
+
var URL_LOCAL = "newTabUrl";
|
|
15840
|
+
var openCall = (url) => `globalThis.open?.(${url}, '_blank', 'noopener')`;
|
|
15841
|
+
function outputNewTabStatements(tab, read, functions) {
|
|
15842
|
+
if (!tab || validateOutputNewTab(tab, functions)) return [];
|
|
15843
|
+
if (tab.mode === "static") return [openCall(quote3(tab.url.trim()))];
|
|
15844
|
+
if (tab.mode === "value") {
|
|
15845
|
+
const arg = tab.value;
|
|
15846
|
+
const expr = read(arg);
|
|
15847
|
+
if (!expr) return [];
|
|
15848
|
+
return [
|
|
15849
|
+
`const ${URL_LOCAL} = ${expr}`,
|
|
15850
|
+
`if (${URL_LOCAL} != null) ${openCall(`String(${URL_LOCAL})`)}`
|
|
15851
|
+
];
|
|
15852
|
+
}
|
|
15853
|
+
const fn = functions[tab.functionId];
|
|
15854
|
+
const guards = [];
|
|
15855
|
+
const args = [];
|
|
15856
|
+
for (const param of fn.params) {
|
|
15857
|
+
const type = outputLinkParamType(param);
|
|
15858
|
+
const arg = tab.args?.[param.id];
|
|
15859
|
+
if (arg.source === "fixed") {
|
|
15860
|
+
args.push(fixedLiteral(arg.value, type));
|
|
15861
|
+
continue;
|
|
15862
|
+
}
|
|
15863
|
+
const expr = read(arg);
|
|
15864
|
+
if (!expr) return [];
|
|
15865
|
+
if (!guards.includes(`${expr} != null`)) guards.push(`${expr} != null`);
|
|
15866
|
+
args.push(`${COERCE[type]}(${expr})`);
|
|
15867
|
+
}
|
|
15868
|
+
const call = `${fn.name}(${args.join(", ")})`;
|
|
15869
|
+
const bound = guards.length ? `${guards.join(" && ")} ? ${call} : undefined` : call;
|
|
15870
|
+
if (fn.returnAsync)
|
|
15871
|
+
return [
|
|
15872
|
+
`const ${URL_LOCAL} = ${bound}`,
|
|
15873
|
+
`void Promise.resolve(${URL_LOCAL}).then((url) => { if (url != null) ${openCall("url")}; })`
|
|
15874
|
+
];
|
|
15875
|
+
return [
|
|
15876
|
+
`const ${URL_LOCAL} = ${bound}`,
|
|
15877
|
+
`if (${URL_LOCAL} != null) ${openCall(URL_LOCAL)}`
|
|
15878
|
+
];
|
|
15879
|
+
}
|
|
15880
|
+
var outputNewTabFunctionId = (tab) => tab?.mode === "function" && tab.functionId ? tab.functionId : void 0;
|
|
15881
|
+
var pascal2 = (value) => value.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
15882
|
+
function outputLinkMemberName(controlId, output) {
|
|
15883
|
+
return `follow${pascal2(output)}${pascal2(controlId.slice(0, 8))}`;
|
|
15884
|
+
}
|
|
15885
|
+
function pruneOutputLinkArgs(control, drop) {
|
|
15886
|
+
let dropped = 0;
|
|
15887
|
+
const prune = (args) => {
|
|
15888
|
+
if (!args) return void 0;
|
|
15889
|
+
const kept = Object.fromEntries(
|
|
15890
|
+
Object.entries(args).filter(([, arg]) => !drop(arg))
|
|
15891
|
+
);
|
|
15892
|
+
dropped += Object.keys(args).length - Object.keys(kept).length;
|
|
15893
|
+
return Object.keys(kept).length ? kept : void 0;
|
|
15894
|
+
};
|
|
15895
|
+
if (control.outputNavs) {
|
|
15896
|
+
control.outputNavs = Object.fromEntries(
|
|
15897
|
+
Object.entries(control.outputNavs).map(([output, nav]) => [
|
|
15898
|
+
output,
|
|
15899
|
+
{ ...nav, params: prune(nav.params) }
|
|
15900
|
+
])
|
|
15901
|
+
);
|
|
15902
|
+
}
|
|
15903
|
+
if (control.outputNewTabs) {
|
|
15904
|
+
control.outputNewTabs = Object.fromEntries(
|
|
15905
|
+
Object.entries(control.outputNewTabs).map(([output, tab]) => {
|
|
15906
|
+
if (tab.mode === "function")
|
|
15907
|
+
return [output, { ...tab, args: prune(tab.args) }];
|
|
15908
|
+
if (tab.mode === "value" && tab.value) {
|
|
15909
|
+
const kept = prune({ value: tab.value });
|
|
15910
|
+
return [output, { mode: "value", ...kept ?? {} }];
|
|
15911
|
+
}
|
|
15912
|
+
return [output, tab];
|
|
15913
|
+
})
|
|
15914
|
+
);
|
|
15915
|
+
}
|
|
15916
|
+
return dropped;
|
|
15917
|
+
}
|
|
15918
|
+
|
|
15714
15919
|
// libs/codegen/src/lib/screen-input-source-helper.ts
|
|
15715
15920
|
var SCREEN_SOURCE_SEP = "::";
|
|
15716
15921
|
var encode = (kind, id) => `${kind}${SCREEN_SOURCE_SEP}${id}`;
|
|
@@ -15994,9 +16199,9 @@ function outputOpenHostInputIds(control) {
|
|
|
15994
16199
|
function everyOutputOpen(control) {
|
|
15995
16200
|
return Object.keys(control.outputOpens ?? {}).map((output) => outputOpenOf(control.outputOpens, output)).filter((open) => !!open);
|
|
15996
16201
|
}
|
|
15997
|
-
var
|
|
16202
|
+
var pascal3 = (value) => value.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
15998
16203
|
function outputOpenMemberName(controlId, output) {
|
|
15999
|
-
return `open${
|
|
16204
|
+
return `open${pascal3(output)}${pascal3(controlId.slice(0, 8))}`;
|
|
16000
16205
|
}
|
|
16001
16206
|
function outputOpenIdName(controlId, output) {
|
|
16002
16207
|
return `${outputOpenMemberName(controlId, output)}Id`;
|
|
@@ -18428,6 +18633,7 @@ function bodyConfigs(node) {
|
|
|
18428
18633
|
else delete configs["url"];
|
|
18429
18634
|
if (configs["variant"] === DEFAULT_DOC_VARIANT) delete configs["variant"];
|
|
18430
18635
|
if (configs["density"] === DEFAULT_DOC_DENSITY) delete configs["density"];
|
|
18636
|
+
if (configs["align"] === DEFAULT_DOC_ALIGN) delete configs["align"];
|
|
18431
18637
|
}
|
|
18432
18638
|
if (node.type === "section_filter" /* SECTION_FILTER */) {
|
|
18433
18639
|
const variant = filterVariantOf(node.configs);
|
|
@@ -19494,6 +19700,10 @@ function outputAttrs(node, methods, operationOf, storeProp, ctx) {
|
|
|
19494
19700
|
// the one call to its overlay member is the whole of what it does
|
|
19495
19701
|
// (CONTEXT.md OutputOpen).
|
|
19496
19702
|
...Object.keys(node.outputOpens ?? {}),
|
|
19703
|
+
// An output that only navigates or opens a new tab holds nothing in the
|
|
19704
|
+
// maps above either (CONTEXT.md OutputNav, OutputNewTab).
|
|
19705
|
+
...Object.keys(node.outputNavs ?? {}),
|
|
19706
|
+
...Object.keys(node.outputNewTabs ?? {}),
|
|
19497
19707
|
// An output that only fires a ScreenMethod holds nothing in the three maps
|
|
19498
19708
|
// above, and a handler is the whole of what it does (ADR 0095).
|
|
19499
19709
|
...Object.keys(node.outputScreenMethods ?? {}),
|
|
@@ -19558,6 +19768,8 @@ function outputAttrs(node, methods, operationOf, storeProp, ctx) {
|
|
|
19558
19768
|
operationOf
|
|
19559
19769
|
);
|
|
19560
19770
|
if (open) statements.push(open);
|
|
19771
|
+
const link = outputLinkCall(node, output, ctx, "template", storeProp);
|
|
19772
|
+
if (link) statements.push(link);
|
|
19561
19773
|
if (groupDrawsOutcome(node, output, methods)) {
|
|
19562
19774
|
const refs = groupOutcomeFormIds(
|
|
19563
19775
|
node,
|
|
@@ -19867,7 +20079,15 @@ ${" ".repeat(indent2 + index)}}`,
|
|
|
19867
20079
|
const { tag } = codegen;
|
|
19868
20080
|
ctx.writtenTags.add(tag);
|
|
19869
20081
|
if (node.type === "plugin" /* PLUGIN */) {
|
|
19870
|
-
return renderPluginTag(
|
|
20082
|
+
return renderPluginTag(
|
|
20083
|
+
node,
|
|
20084
|
+
pad,
|
|
20085
|
+
tag,
|
|
20086
|
+
methods,
|
|
20087
|
+
operationOf,
|
|
20088
|
+
storeProp,
|
|
20089
|
+
ctx
|
|
20090
|
+
);
|
|
19871
20091
|
}
|
|
19872
20092
|
const attrs = `${tagAttrs(node, ctx, storeProp)}${payloadAttr(node, payloads)}${directiveAttrs(
|
|
19873
20093
|
node,
|
|
@@ -21045,6 +21265,8 @@ function outcomeHandlersBlock(tree, methods, operationOf, storeProp, ctx, payloa
|
|
|
21045
21265
|
operationOf
|
|
21046
21266
|
);
|
|
21047
21267
|
if (open) statements.push(open);
|
|
21268
|
+
const link = outputLinkCall(node, output, ctx, "class", storeProp);
|
|
21269
|
+
if (link) statements.push(link);
|
|
21048
21270
|
outputCallKeys(node, output).forEach(
|
|
21049
21271
|
(callKey, index) => statements.push(
|
|
21050
21272
|
...classCallStatements(
|
|
@@ -21263,6 +21485,7 @@ function gatedCallSiteStatements(node, key2, payload, eventRoot, methods, operat
|
|
|
21263
21485
|
operationOf
|
|
21264
21486
|
);
|
|
21265
21487
|
if (open) statements.push(open.statement);
|
|
21488
|
+
statements.push(...outputLinkStatements(node, key2, ctx, storeProp));
|
|
21266
21489
|
outputCallKeys(node, key2).forEach(
|
|
21267
21490
|
(callKey, index) => statements.push(
|
|
21268
21491
|
...classCallStatements(
|
|
@@ -21813,10 +22036,19 @@ function armStatements(node, output, arm, payload, eventRoot, selfStore, ctx, ar
|
|
|
21813
22036
|
} else if (answer) {
|
|
21814
22037
|
statements.push(`${OVERLAY_REF_MEMBER}?.change(${answer})`);
|
|
21815
22038
|
}
|
|
21816
|
-
const
|
|
22039
|
+
const linkRead = outputLinkRead(ctx, selfStore.replace(/^this\./, ""));
|
|
22040
|
+
const nav = outcomeNavStatement(
|
|
22041
|
+
rows.nav,
|
|
22042
|
+
ctx.navMap ?? {},
|
|
22043
|
+
(arg) => arg.source === "args" ? argsLocal ? `${argsLocal}.${arg.arg.join("?.")}` : void 0 : linkRead(arg)
|
|
22044
|
+
);
|
|
22045
|
+
if (nav) statements.push(nav);
|
|
22046
|
+
return statements;
|
|
22047
|
+
}
|
|
22048
|
+
function outputLinkRead(ctx, storeProp) {
|
|
22049
|
+
const selfStore = storeProp ? `this.${storeProp}` : "";
|
|
22050
|
+
return (arg) => {
|
|
21817
22051
|
switch (arg.source) {
|
|
21818
|
-
case "args":
|
|
21819
|
-
return argsLocal ? `${argsLocal}.${arg.arg.join("?.")}` : void 0;
|
|
21820
22052
|
case "route":
|
|
21821
22053
|
return `${NAV_REF_MEMBER}?.routeParamOf?.('${arg.navId}')`;
|
|
21822
22054
|
case "state":
|
|
@@ -21827,10 +22059,60 @@ function armStatements(node, output, arm, payload, eventRoot, selfStore, ctx, ar
|
|
|
21827
22059
|
selfStore,
|
|
21828
22060
|
false
|
|
21829
22061
|
) : void 0;
|
|
22062
|
+
case "binding":
|
|
22063
|
+
return bindingExpression(arg.binding, {
|
|
22064
|
+
...bindingScope(ctx, storeProp),
|
|
22065
|
+
memberPrefix: "this."
|
|
22066
|
+
});
|
|
22067
|
+
default:
|
|
22068
|
+
return void 0;
|
|
21830
22069
|
}
|
|
21831
|
-
}
|
|
21832
|
-
|
|
21833
|
-
|
|
22070
|
+
};
|
|
22071
|
+
}
|
|
22072
|
+
function outputLinkStatements(node, output, ctx, storeProp) {
|
|
22073
|
+
const read = outputLinkRead(ctx, storeProp);
|
|
22074
|
+
const nav = outputNavStatement(
|
|
22075
|
+
outputNavOf(node.outputNavs, output),
|
|
22076
|
+
ctx.navMap ?? {},
|
|
22077
|
+
read
|
|
22078
|
+
);
|
|
22079
|
+
return [
|
|
22080
|
+
...outputNewTabStatements(
|
|
22081
|
+
outputNewTabOf(node.outputNewTabs, output),
|
|
22082
|
+
read,
|
|
22083
|
+
ctx.functions ?? {}
|
|
22084
|
+
),
|
|
22085
|
+
...nav ? [nav] : []
|
|
22086
|
+
];
|
|
22087
|
+
}
|
|
22088
|
+
function outputLinkCall(node, output, ctx, scope, storeProp) {
|
|
22089
|
+
if (!outputLinkStatements(node, output, ctx, storeProp).length) return "";
|
|
22090
|
+
const self = scope === "class" ? "this." : "";
|
|
22091
|
+
return `${self}${outputLinkMemberName(node.id, output)}()`;
|
|
22092
|
+
}
|
|
22093
|
+
function outputLinkMembersBlock(tree, ctx, storeProp) {
|
|
22094
|
+
const emitted = [];
|
|
22095
|
+
const walk = (nodes) => {
|
|
22096
|
+
for (const node of nodes) {
|
|
22097
|
+
const outputs = /* @__PURE__ */ new Set([
|
|
22098
|
+
...Object.keys(node.outputNavs ?? {}),
|
|
22099
|
+
...Object.keys(node.outputNewTabs ?? {})
|
|
22100
|
+
]);
|
|
22101
|
+
for (const output of [...outputs].sort()) {
|
|
22102
|
+
if (isOutputArmKey(output) || isMenuActionKey(output)) continue;
|
|
22103
|
+
const lines = outputLinkStatements(node, output, ctx, storeProp);
|
|
22104
|
+
if (!lines.length) continue;
|
|
22105
|
+
emitted.push(`
|
|
22106
|
+
protected readonly ${outputLinkMemberName(node.id, output)} = (): void => {
|
|
22107
|
+
${lines.map((line) => ` ${line};`).join("\n")}
|
|
22108
|
+
};
|
|
22109
|
+
`);
|
|
22110
|
+
}
|
|
22111
|
+
walk(node.childrens);
|
|
22112
|
+
}
|
|
22113
|
+
};
|
|
22114
|
+
walk(tree);
|
|
22115
|
+
return emitted.join("");
|
|
21834
22116
|
}
|
|
21835
22117
|
function methodArgsOf(method, operationOf, ctx) {
|
|
21836
22118
|
const op = operationOf(method);
|
|
@@ -22947,6 +23229,7 @@ ${tables.map(
|
|
|
22947
23229
|
methods,
|
|
22948
23230
|
operationOf
|
|
22949
23231
|
);
|
|
23232
|
+
const outputLinkBody = outputLinkMembersBlock(tree, ctx, storeProp);
|
|
22950
23233
|
const menuActionHandlersBody = menuActionHandlersBlock(
|
|
22951
23234
|
tree,
|
|
22952
23235
|
methods,
|
|
@@ -22982,7 +23265,9 @@ ${tables.map(
|
|
|
22982
23265
|
"Component",
|
|
22983
23266
|
...screenComputedsBody || screenVariantsBody || cardsBody || messageParamsBody ? ["computed"] : [],
|
|
22984
23267
|
...autoCalls.length ? ["effect"] : [],
|
|
22985
|
-
...needsStore || usesAuth || injectedGlobalStores.length > 0 || usesModal || drawsOverlayClose || drawsOutcomeNav || classReadsNavRef
|
|
23268
|
+
...needsStore || usesAuth || injectedGlobalStores.length > 0 || usesModal || drawsOverlayClose || drawsOutcomeNav || classReadsNavRef || `${outputLinkBody}${menuActionHandlersBody}${outputArmHandlersBody}`.includes(
|
|
23269
|
+
`${NAV_REF_MEMBER}?.`
|
|
23270
|
+
) ? ["inject"] : [],
|
|
22986
23271
|
...inputs.length ? ["input"] : [],
|
|
22987
23272
|
...outputs.length ? ["output"] : [],
|
|
22988
23273
|
...wires.length || variables.some((v) => !isLinkedVariable(v)) || Object.values(ctx.formModels ?? {}).some((m) => !isLinkedFormModel(m)) ? ["signal"] : [],
|
|
@@ -23010,6 +23295,15 @@ ${tables.map(
|
|
|
23010
23295
|
if (fn) screenFunctions.set(fn.name, fn);
|
|
23011
23296
|
}
|
|
23012
23297
|
}
|
|
23298
|
+
for (const control of Object.values(ctx.controlMap ?? {})) {
|
|
23299
|
+
for (const output of Object.keys(control.outputNewTabs ?? {})) {
|
|
23300
|
+
const tab = outputNewTabOf(control.outputNewTabs, output);
|
|
23301
|
+
if (validateOutputNewTab(tab, ctx.functions ?? {})) continue;
|
|
23302
|
+
const id = outputNewTabFunctionId(tab);
|
|
23303
|
+
const fn = id ? (ctx.functions ?? {})[id] : void 0;
|
|
23304
|
+
if (fn) screenFunctions.set(fn.name, fn);
|
|
23305
|
+
}
|
|
23306
|
+
}
|
|
23013
23307
|
const screenFunctionImports = [...screenFunctions.values()].sort((a, b) => a.name.localeCompare(b.name)).map(
|
|
23014
23308
|
// Every Screen emits to `src/app/<root>/<slug>/ui/`, whichever
|
|
23015
23309
|
// CompositionKind it is, so the hop to `src/app/shared/lib/` is the same
|
|
@@ -23135,7 +23429,7 @@ ${tables.map(
|
|
|
23135
23429
|
const overlayRefBody = usesOverlayRef ? `
|
|
23136
23430
|
private readonly overlay = inject(MODAL_REF, { optional: true });
|
|
23137
23431
|
` : "";
|
|
23138
|
-
const usesNavRef = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}${screenVariantsBody}${screenComputedsBody}`.includes(
|
|
23432
|
+
const usesNavRef = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}${screenVariantsBody}${screenComputedsBody}${outputLinkBody}`.includes(
|
|
23139
23433
|
`${NAV_REF_MEMBER}?.`
|
|
23140
23434
|
);
|
|
23141
23435
|
const navRefImport = usesNavRef ? `import { NAV_STORE_REF, type NavStoreRef } from '@magmonium/one';
|
|
@@ -23154,7 +23448,7 @@ ${tables.map(
|
|
|
23154
23448
|
})
|
|
23155
23449
|
| null;
|
|
23156
23450
|
` : "";
|
|
23157
|
-
const usesNavRouter = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}`.includes(
|
|
23451
|
+
const usesNavRouter = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}${outputLinkBody}`.includes(
|
|
23158
23452
|
`${NAV_ROUTER_MEMBER}.`
|
|
23159
23453
|
);
|
|
23160
23454
|
const navRouterImport = usesNavRouter ? `import { ActivatedRoute, Router } from '@angular/router';
|
|
@@ -23198,7 +23492,7 @@ ${`${outcomeHandlersBody}${menuActionHandlersBody}`.includes("$event: MenuItem")
|
|
|
23198
23492
|
width: 100%
|
|
23199
23493
|
\`,
|
|
23200
23494
|
})
|
|
23201
|
-
export class ${naming.className} {${storeBody}${busyBody}${authBody}${globalStoreBody}${modalBody}${overlayRefBody}${navRefBody}${navRouterBody}${imgApiOriginBody}${inputsBody}${constantsBody}${screenComputedsBody}${variablesBody}${formModelsBody}${screenVariantsBody}${cardsBody}${searchBody}${messageParamsBody}${outputsBody}${wiresBody}${overlayProps}${contextMenuConfigBody}${payloadsBody}${transformMembersBody}${payloadReadersBody}${sectionTablesBody}${checksBody}${screenMethodsBody}${outputOpenBody}${outcomeHandlersBody}${menuActionHandlersBody}${menuConditionBody}${outputArmHandlersBody}${autoCallsBody}}
|
|
23495
|
+
export class ${naming.className} {${storeBody}${busyBody}${authBody}${globalStoreBody}${modalBody}${overlayRefBody}${navRefBody}${navRouterBody}${imgApiOriginBody}${inputsBody}${constantsBody}${screenComputedsBody}${variablesBody}${formModelsBody}${screenVariantsBody}${cardsBody}${searchBody}${messageParamsBody}${outputsBody}${wiresBody}${overlayProps}${contextMenuConfigBody}${payloadsBody}${transformMembersBody}${payloadReadersBody}${sectionTablesBody}${checksBody}${screenMethodsBody}${outputOpenBody}${outputLinkBody}${outcomeHandlersBody}${menuActionHandlersBody}${menuConditionBody}${outputArmHandlersBody}${autoCallsBody}}
|
|
23202
23496
|
`;
|
|
23203
23497
|
}
|
|
23204
23498
|
function assetName(node) {
|
|
@@ -23404,7 +23698,11 @@ function generateCode(tree, featureName, screenName, properties = {}, variants =
|
|
|
23404
23698
|
].map(({ prop, members }) => ({
|
|
23405
23699
|
prop,
|
|
23406
23700
|
properties: listDataProperties(members).map(
|
|
23407
|
-
({ name: name3, dataType, cardinality }) => ({
|
|
23701
|
+
({ name: name3, dataType, cardinality }) => ({
|
|
23702
|
+
name: name3,
|
|
23703
|
+
dataType,
|
|
23704
|
+
cardinality
|
|
23705
|
+
})
|
|
23408
23706
|
)
|
|
23409
23707
|
})).filter((store) => store.properties.length)
|
|
23410
23708
|
}
|
|
@@ -23518,7 +23816,7 @@ __export(package_exports, {
|
|
|
23518
23816
|
version: () => version
|
|
23519
23817
|
});
|
|
23520
23818
|
var name = "@magmonium/one";
|
|
23521
|
-
var version = "0.4.
|
|
23819
|
+
var version = "0.4.26";
|
|
23522
23820
|
var description = "Magmonium One \u2014 Angular design-system primitives for mm Apps";
|
|
23523
23821
|
var author = "magmonium";
|
|
23524
23822
|
var license = "MIT";
|
|
@@ -23549,7 +23847,7 @@ var peerDependencies = {
|
|
|
23549
23847
|
"@angular/elements": "^21.0.0",
|
|
23550
23848
|
"@ngrx/signals": "^21.0.0",
|
|
23551
23849
|
rxjs: "^7.8.0",
|
|
23552
|
-
"@magmonium/cli": "
|
|
23850
|
+
"@magmonium/cli": ">=0.7.12 <1.0.0",
|
|
23553
23851
|
"socket.io-client": "^4.8.0"
|
|
23554
23852
|
};
|
|
23555
23853
|
var sideEffects = false;
|
|
@@ -23586,7 +23884,7 @@ __export(package_exports2, {
|
|
|
23586
23884
|
version: () => version2
|
|
23587
23885
|
});
|
|
23588
23886
|
var name2 = "@magmonium/cli";
|
|
23589
|
-
var version2 = "0.8.
|
|
23887
|
+
var version2 = "0.8.1";
|
|
23590
23888
|
var description2 = "A powerful and extensible asset compilation tool that can be shared across multiple projects";
|
|
23591
23889
|
var bin = {
|
|
23592
23890
|
"mag-cli": "bin/cli.js"
|
|
@@ -27084,6 +27382,8 @@ function buildTree(controlMap, rootControlIds, selection) {
|
|
|
27084
27382
|
...ctrl.outputEmits && Object.keys(ctrl.outputEmits).length ? { outputEmits: ctrl.outputEmits } : {},
|
|
27085
27383
|
...ctrl.outputScreenWrites && Object.keys(ctrl.outputScreenWrites).length ? { outputScreenWrites: ctrl.outputScreenWrites } : {},
|
|
27086
27384
|
...ctrl.outputOpens && Object.keys(ctrl.outputOpens).length ? { outputOpens: ctrl.outputOpens } : {},
|
|
27385
|
+
...ctrl.outputNavs && Object.keys(ctrl.outputNavs).length ? { outputNavs: ctrl.outputNavs } : {},
|
|
27386
|
+
...ctrl.outputNewTabs && Object.keys(ctrl.outputNewTabs).length ? { outputNewTabs: ctrl.outputNewTabs } : {},
|
|
27087
27387
|
...ctrl.outputOutcomes && Object.keys(ctrl.outputOutcomes).length ? { outputOutcomes: ctrl.outputOutcomes } : {},
|
|
27088
27388
|
// Without this the codegen walk reads `outputArms` off a Tree that never
|
|
27089
27389
|
// carried it, every gated output falls back to ungated, and its groups —
|
|
@@ -29126,9 +29426,9 @@ var emittedTestPath = (path) => path.replace(/\.ts$/, ".spec.ts");
|
|
|
29126
29426
|
var isEmittedTestPath = (path) => path.endsWith(".spec.ts");
|
|
29127
29427
|
var isRuntimePath = (path) => path.endsWith(".ts") && !path.endsWith(".d.ts") && !isEmittedTestPath(path) && !path.includes("/type/") && !path.endsWith("/index.ts");
|
|
29128
29428
|
var siblingModule = (path) => `./${path.slice(path.lastIndexOf("/") + 1).replace(/\.ts$/, "")}`;
|
|
29129
|
-
var
|
|
29429
|
+
var quote4 = (value) => `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
|
|
29130
29430
|
var IDENTIFIER7 = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
29131
|
-
var key = (name3) => IDENTIFIER7.test(name3) ? name3 :
|
|
29431
|
+
var key = (name3) => IDENTIFIER7.test(name3) ? name3 : quote4(name3);
|
|
29132
29432
|
var FAKE_TEXT = "text";
|
|
29133
29433
|
var MAX_DEPTH2 = 3;
|
|
29134
29434
|
var fakeLiteral = (dataType, cardinality, shapes, depth = 0) => {
|
|
@@ -29149,15 +29449,15 @@ var fakeLiteral = (dataType, cardinality, shapes, depth = 0) => {
|
|
|
29149
29449
|
var fakeOne = (dataType, shapes, depth) => {
|
|
29150
29450
|
switch (dataType?.type) {
|
|
29151
29451
|
case "string":
|
|
29152
|
-
return
|
|
29452
|
+
return quote4(FAKE_TEXT);
|
|
29153
29453
|
case "number":
|
|
29154
29454
|
return "1";
|
|
29155
29455
|
case "boolean":
|
|
29156
29456
|
return "true";
|
|
29157
29457
|
case "option":
|
|
29158
|
-
return `{ value: ${
|
|
29458
|
+
return `{ value: ${quote4("option")}, label: ${quote4("option")} }`;
|
|
29159
29459
|
case "file":
|
|
29160
|
-
return `new File([${
|
|
29460
|
+
return `new File([${quote4("file")}], ${quote4("file.txt")})`;
|
|
29161
29461
|
case "shape": {
|
|
29162
29462
|
const shape = shapes[dataType.shapeId];
|
|
29163
29463
|
if (!shape || depth >= MAX_DEPTH2) return "{}";
|
|
@@ -29184,14 +29484,14 @@ var withShapes = (shapes, extra = []) => {
|
|
|
29184
29484
|
...shapes
|
|
29185
29485
|
} : shapes;
|
|
29186
29486
|
};
|
|
29187
|
-
var block = (title, body, isAsync = false) => ` it(${
|
|
29487
|
+
var block = (title, body, isAsync = false) => ` it(${quote4(title)}, ${isAsync ? "async " : ""}() => {
|
|
29188
29488
|
${body.map((line) => line ? ` ${line}` : "").join("\n")}
|
|
29189
29489
|
});`;
|
|
29190
29490
|
var describeFile = (imports, helpers, title, setup, tests) => `${imports.join("\n")}
|
|
29191
29491
|
${helpers.length ? `
|
|
29192
29492
|
${helpers.join("\n")}
|
|
29193
29493
|
` : ""}
|
|
29194
|
-
describe(${
|
|
29494
|
+
describe(${quote4(title)}, () => {
|
|
29195
29495
|
${setup.length ? `${setup.join("\n")}
|
|
29196
29496
|
|
|
29197
29497
|
` : ""}${tests.join("\n\n")}
|
|
@@ -29245,7 +29545,7 @@ var URL_HELPERS = [
|
|
|
29245
29545
|
" .replace(new RegExp(ANY_SEGMENT, 'g'), '[^/]+')}$`",
|
|
29246
29546
|
` );`
|
|
29247
29547
|
];
|
|
29248
|
-
var versionArg = (version3) => version3 ? `, ${
|
|
29548
|
+
var versionArg = (version3) => version3 ? `, ${quote4(version3)}` : "";
|
|
29249
29549
|
var apiServiceTest = (path, className, calls, shapes) => {
|
|
29250
29550
|
const tests = calls.map((call) => {
|
|
29251
29551
|
const lookup = withShapes(
|
|
@@ -29260,20 +29560,20 @@ var apiServiceTest = (path, className, calls, shapes) => {
|
|
|
29260
29560
|
);
|
|
29261
29561
|
const segments = call.segments.map((segment) => {
|
|
29262
29562
|
const template = /^\{(.+)\}$/.exec(segment);
|
|
29263
|
-
return template ? fakes.get(template[1]) ??
|
|
29563
|
+
return template ? fakes.get(template[1]) ?? quote4("text") : quote4(segment);
|
|
29264
29564
|
});
|
|
29265
29565
|
return block(
|
|
29266
29566
|
`${call.name} sends ${call.verb.toUpperCase()} to its operation and hands back the answer`,
|
|
29267
29567
|
[
|
|
29268
29568
|
`const body = { answered: true };`,
|
|
29269
29569
|
`let answered: unknown;`,
|
|
29270
|
-
`(service as unknown as Record<string, (...args: unknown[]) => Observable<unknown>>)[${
|
|
29570
|
+
`(service as unknown as Record<string, (...args: unknown[]) => Observable<unknown>>)[${quote4(
|
|
29271
29571
|
call.name
|
|
29272
29572
|
)}](${[...fakes.values()].join(", ")}).subscribe((value) => (answered = value));`,
|
|
29273
29573
|
`http`,
|
|
29274
|
-
` .expectOne((request) => request.method === ${
|
|
29574
|
+
` .expectOne((request) => request.method === ${quote4(
|
|
29275
29575
|
call.verb.toUpperCase()
|
|
29276
|
-
)} && request.url === urls.buildUrl(${
|
|
29576
|
+
)} && request.url === urls.buildUrl(${quote4(call.domain)}, [${segments.join(
|
|
29277
29577
|
", "
|
|
29278
29578
|
)}]${versionArg(call.version)}))`,
|
|
29279
29579
|
` .flush(body);`,
|
|
@@ -29337,7 +29637,7 @@ var STATUS_TEXT = {
|
|
|
29337
29637
|
var storeMethodTests = (call, shapes) => {
|
|
29338
29638
|
const spies = armSpies(call);
|
|
29339
29639
|
const args = argObject(call.args, spies, shapes);
|
|
29340
|
-
const invoke = `call(store, ${
|
|
29640
|
+
const invoke = `call(store, ${quote4(call.name)}${args ? `, ${args}` : ""});`;
|
|
29341
29641
|
const send = [
|
|
29342
29642
|
invoke,
|
|
29343
29643
|
...call.debounce !== void 0 ? [`vi.advanceTimersByTime(${call.debounce});`] : []
|
|
@@ -29358,8 +29658,8 @@ var storeMethodTests = (call, shapes) => {
|
|
|
29358
29658
|
];
|
|
29359
29659
|
}
|
|
29360
29660
|
const verb = call.verb.toUpperCase();
|
|
29361
|
-
const url = `const url = urlPattern(urls, ${
|
|
29362
|
-
const match = `(request) => request.method === ${
|
|
29661
|
+
const url = `const url = urlPattern(urls, ${quote4(call.domain)}, [${call.segments.map(quote4).join(", ")}]${versionArg(call.version)});`;
|
|
29662
|
+
const match = `(request) => request.method === ${quote4(verb)} && url.test(request.url)`;
|
|
29363
29663
|
const empty = call.ok.code === "204" || !call.ok.dataType;
|
|
29364
29664
|
const body = empty ? "null" : fakeLiteral(
|
|
29365
29665
|
call.ok.dataType,
|
|
@@ -29376,11 +29676,11 @@ var storeMethodTests = (call, shapes) => {
|
|
|
29376
29676
|
...send,
|
|
29377
29677
|
`http.expectOne(${match}).flush(body as never, { status: ${Number(
|
|
29378
29678
|
call.ok.code
|
|
29379
|
-
)}, statusText: ${
|
|
29679
|
+
)}, statusText: ${quote4(STATUS_TEXT[call.ok.code] ?? "OK")} });`,
|
|
29380
29680
|
// What the store patched: the body, or the member of it the landing
|
|
29381
29681
|
// reads — `total` of a page lands a number, not the page.
|
|
29382
29682
|
...call.lands.map(
|
|
29383
|
-
({ name: name3, source }) => `expect(read(store, ${
|
|
29683
|
+
({ name: name3, source }) => `expect(read(store, ${quote4(name3)})).toEqual(${source.length ? `at(body, [${source.map(quote4).join(", ")}])` : "body"});`
|
|
29384
29684
|
),
|
|
29385
29685
|
...call.arms.success ? ["expect(onSuccess).toHaveBeenCalled();"] : [],
|
|
29386
29686
|
...call.arms.settle ? [
|
|
@@ -29419,11 +29719,11 @@ var storeMethodTests = (call, shapes) => {
|
|
|
29419
29719
|
...answer(true),
|
|
29420
29720
|
url,
|
|
29421
29721
|
`const body: unknown = ${body};`,
|
|
29422
|
-
`for (const path of [${call.guards.map((path) => `[${path.map(
|
|
29722
|
+
`for (const path of [${call.guards.map((path) => `[${path.map(quote4).join(", ")}]`).join(", ")}]) {`,
|
|
29423
29723
|
...send.map((line) => ` ${line}`),
|
|
29424
29724
|
` http.expectOne(${match}).flush(drop(body, path) as never, { status: ${Number(
|
|
29425
29725
|
call.ok.code
|
|
29426
|
-
)}, statusText: ${
|
|
29726
|
+
)}, statusText: ${quote4(STATUS_TEXT[call.ok.code] ?? "OK")} });`,
|
|
29427
29727
|
"}",
|
|
29428
29728
|
...call.arms.success ? [
|
|
29429
29729
|
`expect(onSuccess).toHaveBeenCalledTimes(${call.guards.length});`
|
|
@@ -29433,12 +29733,12 @@ var storeMethodTests = (call, shapes) => {
|
|
|
29433
29733
|
] : [];
|
|
29434
29734
|
return [success, failure, ...declined, ...partial];
|
|
29435
29735
|
};
|
|
29436
|
-
var patchLine = (holder, entries) => `${holder ? `on(store, ${
|
|
29736
|
+
var patchLine = (holder, entries) => `${holder ? `on(store, ${quote4(holder)})` : "store"}.patch({ ${entries.join(
|
|
29437
29737
|
", "
|
|
29438
29738
|
)} } as never);`;
|
|
29439
29739
|
var cacheMethodTests = (cache, shapes) => {
|
|
29440
29740
|
const args = argObject(cache.args, [], shapes);
|
|
29441
|
-
const invoke = `ask(store, ${
|
|
29741
|
+
const invoke = `ask(store, ${quote4(cache.name)}${args ? `, ${args}` : ""})`;
|
|
29442
29742
|
const { property } = cache;
|
|
29443
29743
|
const keyArg = cache.args.find((arg) => arg.name === cache.key);
|
|
29444
29744
|
const one = fakeLiteral(property.dataType, "one", shapes);
|
|
@@ -29511,13 +29811,13 @@ var storeTest = (path, facts, shapes) => {
|
|
|
29511
29811
|
shapes
|
|
29512
29812
|
)};`,
|
|
29513
29813
|
`store.patch({ ${key(property.name)}: ${property.name}Value } as never);`,
|
|
29514
|
-
`expect(read(store, ${
|
|
29814
|
+
`expect(read(store, ${quote4(property.name)})).toEqual(${property.name}Value);`
|
|
29515
29815
|
])
|
|
29516
29816
|
)
|
|
29517
29817
|
] : [],
|
|
29518
29818
|
...facts.computeds.length ? [
|
|
29519
29819
|
block("reads every computed without throwing", [
|
|
29520
|
-
`for (const name of [${facts.computeds.map(
|
|
29820
|
+
`for (const name of [${facts.computeds.map(quote4).join(", ")}]) {`,
|
|
29521
29821
|
" expect(() => read(store, name)).not.toThrow();",
|
|
29522
29822
|
"}"
|
|
29523
29823
|
])
|
|
@@ -29527,7 +29827,7 @@ var storeTest = (path, facts, shapes) => {
|
|
|
29527
29827
|
...facts.computeds.length && filled.length ? [
|
|
29528
29828
|
block("reads every computed over filled state without throwing", [
|
|
29529
29829
|
...filled,
|
|
29530
|
-
`for (const name of [${facts.computeds.map(
|
|
29830
|
+
`for (const name of [${facts.computeds.map(quote4).join(", ")}]) {`,
|
|
29531
29831
|
" expect(() => read(store, name)).not.toThrow();",
|
|
29532
29832
|
"}"
|
|
29533
29833
|
])
|
|
@@ -29642,13 +29942,13 @@ var emptyLiteral = (dataType, cardinality) => {
|
|
|
29642
29942
|
if (cardinality !== "one") return "{}";
|
|
29643
29943
|
switch (dataType?.type) {
|
|
29644
29944
|
case "string":
|
|
29645
|
-
return
|
|
29945
|
+
return quote4("");
|
|
29646
29946
|
case "number":
|
|
29647
29947
|
return "0";
|
|
29648
29948
|
case "boolean":
|
|
29649
29949
|
return "false";
|
|
29650
29950
|
case "file":
|
|
29651
|
-
return `new File([], ${
|
|
29951
|
+
return `new File([], ${quote4("")})`;
|
|
29652
29952
|
case "option":
|
|
29653
29953
|
case "shape":
|
|
29654
29954
|
case "form":
|
|
@@ -29663,17 +29963,17 @@ var menuCheckFake = (check) => {
|
|
|
29663
29963
|
const numeric = raw !== "" && Number.isFinite(Number(raw));
|
|
29664
29964
|
switch (check.operator) {
|
|
29665
29965
|
case "exists":
|
|
29666
|
-
return
|
|
29966
|
+
return quote4(FAKE_TEXT);
|
|
29667
29967
|
case "not_exists":
|
|
29668
29968
|
return void 0;
|
|
29669
29969
|
case "contains":
|
|
29670
|
-
return
|
|
29970
|
+
return quote4(raw);
|
|
29671
29971
|
case "not_contains":
|
|
29672
|
-
return
|
|
29972
|
+
return quote4("");
|
|
29673
29973
|
case "==":
|
|
29674
|
-
return numeric ? String(Number(raw)) :
|
|
29974
|
+
return numeric ? String(Number(raw)) : quote4(raw);
|
|
29675
29975
|
case "!=":
|
|
29676
|
-
return
|
|
29976
|
+
return quote4(`${raw}-other`);
|
|
29677
29977
|
case ">":
|
|
29678
29978
|
return String(Number(raw) + 1);
|
|
29679
29979
|
case "<":
|
|
@@ -29684,8 +29984,8 @@ var menuCheckFake = (check) => {
|
|
|
29684
29984
|
};
|
|
29685
29985
|
var menuEventFake = (checks) => {
|
|
29686
29986
|
const event = /* @__PURE__ */ new Map([
|
|
29687
|
-
["id",
|
|
29688
|
-
["label",
|
|
29987
|
+
["id", quote4(FAKE_TEXT)],
|
|
29988
|
+
["label", quote4(FAKE_TEXT)]
|
|
29689
29989
|
]);
|
|
29690
29990
|
for (const check of checks) {
|
|
29691
29991
|
const value = menuCheckFake(check);
|
|
@@ -29696,7 +29996,7 @@ var menuEventFake = (checks) => {
|
|
|
29696
29996
|
};
|
|
29697
29997
|
var menuActionLines = (menus) => menus.flatMap(
|
|
29698
29998
|
({ action }) => action ? action.gates.map(
|
|
29699
|
-
(checks) => ` expect(() => call(${
|
|
29999
|
+
(checks) => ` expect(() => call(${quote4(action.name)}, ${[
|
|
29700
30000
|
menuEventFake(checks),
|
|
29701
30001
|
...Array(action.formRefs).fill("form")
|
|
29702
30002
|
].join(", ")})).not.toThrow();`
|
|
@@ -29705,9 +30005,9 @@ var menuActionLines = (menus) => menus.flatMap(
|
|
|
29705
30005
|
var menuConditionLines = (menus) => menus.flatMap(
|
|
29706
30006
|
({ conditions }) => conditions.flatMap(({ name: name3, kind, keys }) => [
|
|
29707
30007
|
...keys.map(
|
|
29708
|
-
(one) => `expect(typeof instance[${
|
|
30008
|
+
(one) => `expect(typeof instance[${quote4(name3)}](${quote4(one)})).toBe('boolean');`
|
|
29709
30009
|
),
|
|
29710
|
-
`expect(instance[${
|
|
30010
|
+
`expect(instance[${quote4(name3)}]('')).toBe(${kind === "hidden"});`
|
|
29711
30011
|
])
|
|
29712
30012
|
);
|
|
29713
30013
|
var handlerArgs = (handler, shapes) => [
|
|
@@ -29743,11 +30043,11 @@ var screenTest = (path, facts, shapes) => {
|
|
|
29743
30043
|
handlerArgs(handler, shapes),
|
|
29744
30044
|
// A SectionAction's `clicked` again per folded Button, as that press.
|
|
29745
30045
|
...(handler.pressed ?? []).map((name3) => [
|
|
29746
|
-
`{ name: ${
|
|
30046
|
+
`{ name: ${quote4(name3)} }`,
|
|
29747
30047
|
...Array(handler.formRefs).fill("form")
|
|
29748
30048
|
])
|
|
29749
30049
|
].map(
|
|
29750
|
-
(args) => ` expect(() => call(${[
|
|
30050
|
+
(args) => ` expect(() => call(${[quote4(handler.name), ...args].join(
|
|
29751
30051
|
", "
|
|
29752
30052
|
)})).not.toThrow();`
|
|
29753
30053
|
)
|
|
@@ -29814,7 +30114,7 @@ var screenTest = (path, facts, shapes) => {
|
|
|
29814
30114
|
` const create = () => {`,
|
|
29815
30115
|
` const fixture = TestBed.createComponent(${className});`,
|
|
29816
30116
|
...facts.inputs.map(
|
|
29817
|
-
(input) => ` fixture.componentRef.setInput(${
|
|
30117
|
+
(input) => ` fixture.componentRef.setInput(${quote4(input.name)}, ${inputFake(
|
|
29818
30118
|
input,
|
|
29819
30119
|
shapes
|
|
29820
30120
|
)});`
|
|
@@ -29829,7 +30129,7 @@ var screenTest = (path, facts, shapes) => {
|
|
|
29829
30129
|
` const createEmpty = () => {`,
|
|
29830
30130
|
` const fixture = TestBed.createComponent(${className});`,
|
|
29831
30131
|
...requiredInputs.map(
|
|
29832
|
-
(input) => ` fixture.componentRef.setInput(${
|
|
30132
|
+
(input) => ` fixture.componentRef.setInput(${quote4(input.name)}, ${inputEmpty(input)});`
|
|
29833
30133
|
),
|
|
29834
30134
|
` fixture.detectChanges();`,
|
|
29835
30135
|
` return fixture;`,
|
|
@@ -29954,7 +30254,7 @@ var screenTest = (path, facts, shapes) => {
|
|
|
29954
30254
|
"const fixture = create();",
|
|
29955
30255
|
"const instance = fixture.componentInstance as unknown as Record<string, { set: (value: unknown) => void }>;",
|
|
29956
30256
|
...variables.map(
|
|
29957
|
-
(variable) => `instance[${
|
|
30257
|
+
(variable) => `instance[${quote4(variable.name)}].set(${fakeLiteral(
|
|
29958
30258
|
variable.dataType,
|
|
29959
30259
|
variable.cardinality,
|
|
29960
30260
|
shapes
|
|
@@ -29992,11 +30292,11 @@ var screenTest = (path, facts, shapes) => {
|
|
|
29992
30292
|
)
|
|
29993
30293
|
};
|
|
29994
30294
|
const compiled = `
|
|
29995
|
-
describe(${
|
|
30295
|
+
describe(${quote4(`${className} compiled template`)}, () => {
|
|
29996
30296
|
${block("renders before anything it reads has loaded", [
|
|
29997
30297
|
`const fixture = TestBed.createComponent(${className});`,
|
|
29998
30298
|
...requiredInputs.map(
|
|
29999
|
-
(input) => `fixture.componentRef.setInput(${
|
|
30299
|
+
(input) => `fixture.componentRef.setInput(${quote4(input.name)}, ${inputEmpty(input)});`
|
|
30000
30300
|
),
|
|
30001
30301
|
"expect(() => fixture.detectChanges()).not.toThrow();"
|
|
30002
30302
|
])}
|
|
@@ -30004,7 +30304,7 @@ ${block("renders before anything it reads has loaded", [
|
|
|
30004
30304
|
`;
|
|
30005
30305
|
const plugins = facts.plugins ?? [];
|
|
30006
30306
|
const pluginBlock = plugins.length ? `
|
|
30007
|
-
describe(${
|
|
30307
|
+
describe(${quote4(`${className} plugins`)}, () => {
|
|
30008
30308
|
// Every PluginControl this Screen places: its app, its Exposed Screen, the
|
|
30009
30309
|
// inputs it binds and the outputs it hears (CONTEXT.md PluginControl).
|
|
30010
30310
|
const PLUGINS = ${JSON.stringify(plugins)};
|
|
@@ -30026,7 +30326,7 @@ ${block(
|
|
|
30026
30326
|
"});",
|
|
30027
30327
|
`const fixture = TestBed.createComponent(${className});`,
|
|
30028
30328
|
...requiredInputs.map(
|
|
30029
|
-
(input) => `fixture.componentRef.setInput(${
|
|
30329
|
+
(input) => `fixture.componentRef.setInput(${quote4(input.name)}, ${inputEmpty(input)});`
|
|
30030
30330
|
),
|
|
30031
30331
|
"fixture.detectChanges();",
|
|
30032
30332
|
// Not `whenStable`: whatever else the Screen asked for stays pending in
|
|
@@ -30070,7 +30370,7 @@ var blankLiteral = (dataType, cardinality) => {
|
|
|
30070
30370
|
if (cardinality === "many") return "[]";
|
|
30071
30371
|
switch (dataType?.type) {
|
|
30072
30372
|
case "string":
|
|
30073
|
-
return
|
|
30373
|
+
return quote4("");
|
|
30074
30374
|
case "number":
|
|
30075
30375
|
return "0";
|
|
30076
30376
|
case "boolean":
|
|
@@ -30088,7 +30388,7 @@ var validationTest = (path, emission, shapes = {}) => {
|
|
|
30088
30388
|
const readAll = (model) => runs.map(
|
|
30089
30389
|
(holds) => `expect(Object.keys(errorsOf(${[model, holds].filter(Boolean).join(", ")}))).toEqual(Object.keys(${model}));`
|
|
30090
30390
|
);
|
|
30091
|
-
const errorOf = (check) => `expect.objectContaining({ kind: ${
|
|
30391
|
+
const errorOf = (check) => `expect.objectContaining({ kind: ${quote4(check.kind)}, message: ${quote4(check.message)} })`;
|
|
30092
30392
|
return {
|
|
30093
30393
|
path: emittedTestPath(path),
|
|
30094
30394
|
contents: describeFile(
|
|
@@ -30129,7 +30429,7 @@ var validationTest = (path, emission, shapes = {}) => {
|
|
|
30129
30429
|
...readAll("EMPTY"),
|
|
30130
30430
|
...stateChecks.flatMap(
|
|
30131
30431
|
(check) => runs.map(
|
|
30132
|
-
(holds) => `expect(errorsOf(EMPTY, ${holds})[${
|
|
30432
|
+
(holds) => `expect(errorsOf(EMPTY, ${holds})[${quote4(check.fieldName)}]).not.toContainEqual(${errorOf(check)});`
|
|
30133
30433
|
)
|
|
30134
30434
|
)
|
|
30135
30435
|
]),
|
|
@@ -30143,7 +30443,7 @@ var validationTest = (path, emission, shapes = {}) => {
|
|
|
30143
30443
|
`const holding = errorsOf(FILLED, true);`,
|
|
30144
30444
|
`const lapsed = errorsOf(FILLED, false);`,
|
|
30145
30445
|
...stateChecks.flatMap((check) => {
|
|
30146
|
-
const field =
|
|
30446
|
+
const field = quote4(check.fieldName);
|
|
30147
30447
|
const [flagged, clear] = check.kind === "stateTrue" ? ["holding", "lapsed"] : ["lapsed", "holding"];
|
|
30148
30448
|
return [
|
|
30149
30449
|
`expect(${flagged}[${field}]).toContainEqual(${errorOf(check)});`,
|
|
@@ -31306,6 +31606,8 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
31306
31606
|
createConfirm,
|
|
31307
31607
|
createGroup,
|
|
31308
31608
|
createOpen,
|
|
31609
|
+
createOutputNav,
|
|
31610
|
+
createOutputNewTab,
|
|
31309
31611
|
createOutputOpen,
|
|
31310
31612
|
createPlatformNavMap,
|
|
31311
31613
|
createRule,
|
|
@@ -31919,6 +32221,15 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
31919
32221
|
outputCallKey,
|
|
31920
32222
|
outputCallKeys,
|
|
31921
32223
|
outputCallLabel,
|
|
32224
|
+
outputLinkBindingTargets,
|
|
32225
|
+
outputLinkMemberName,
|
|
32226
|
+
outputLinkParamType,
|
|
32227
|
+
outputNavOf,
|
|
32228
|
+
outputNavStatement,
|
|
32229
|
+
outputNewTabFunctionId,
|
|
32230
|
+
outputNewTabFunctions,
|
|
32231
|
+
outputNewTabOf,
|
|
32232
|
+
outputNewTabStatements,
|
|
31922
32233
|
outputOpenConstTargets,
|
|
31923
32234
|
outputOpenFixedAllowed,
|
|
31924
32235
|
outputOpenHostInputIds,
|
|
@@ -31991,6 +32302,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
31991
32302
|
pruneMappings,
|
|
31992
32303
|
pruneMenuActions,
|
|
31993
32304
|
pruneOutputCalls,
|
|
32305
|
+
pruneOutputLinkArgs,
|
|
31994
32306
|
pruneUnknownShapeRefs,
|
|
31995
32307
|
pruneUnknownVariants,
|
|
31996
32308
|
prunedInstanceSource,
|
|
@@ -32325,6 +32637,8 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
32325
32637
|
validateMethodName,
|
|
32326
32638
|
validateNavSlug,
|
|
32327
32639
|
validateOutcomeNav,
|
|
32640
|
+
validateOutputNav,
|
|
32641
|
+
validateOutputNewTab,
|
|
32328
32642
|
validateOutputOpen,
|
|
32329
32643
|
validatePatternName,
|
|
32330
32644
|
validateScreenEmits,
|