@magmonium/cli 0.8.0 → 0.8.2
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
CHANGED
|
@@ -268,6 +268,7 @@ __export(index_exports, {
|
|
|
268
268
|
SHARED_LIB_ROOT: () => SHARED_LIB_ROOT,
|
|
269
269
|
SHARED_SHAPES: () => SHARED_SHAPES,
|
|
270
270
|
SHARED_SHAPE_ID_PREFIX: () => SHARED_SHAPE_ID_PREFIX,
|
|
271
|
+
SHIPPED_SHELL_PATHS: () => SHIPPED_SHELL_PATHS,
|
|
271
272
|
SOURCE_LANG: () => SOURCE_LANG,
|
|
272
273
|
STAT_TEXT_SOURCES: () => STAT_TEXT_SOURCES,
|
|
273
274
|
STORAGE_SERVICE: () => STORAGE_SERVICE,
|
|
@@ -372,6 +373,7 @@ __export(index_exports, {
|
|
|
372
373
|
buildScreenWriteValue: () => buildScreenWriteValue,
|
|
373
374
|
buildStateWriteValue: () => buildStateWriteValue,
|
|
374
375
|
buildTree: () => buildTree,
|
|
376
|
+
bumpVersion: () => bumpVersion,
|
|
375
377
|
busyVariant: () => busyVariant,
|
|
376
378
|
byRouteSpecificity: () => byRouteSpecificity,
|
|
377
379
|
cacheMethodArgs: () => cacheMethodArgs,
|
|
@@ -512,6 +514,8 @@ __export(index_exports, {
|
|
|
512
514
|
createConfirm: () => createConfirm,
|
|
513
515
|
createGroup: () => createGroup,
|
|
514
516
|
createOpen: () => createOpen,
|
|
517
|
+
createOutputNav: () => createOutputNav,
|
|
518
|
+
createOutputNewTab: () => createOutputNewTab,
|
|
515
519
|
createOutputOpen: () => createOutputOpen,
|
|
516
520
|
createPlatformNavMap: () => createPlatformNavMap,
|
|
517
521
|
createRule: () => createRule,
|
|
@@ -578,6 +582,7 @@ __export(index_exports, {
|
|
|
578
582
|
emitFullAppFiles: () => emitFullAppFiles,
|
|
579
583
|
emitGeneratedFiles: () => emitGeneratedFiles,
|
|
580
584
|
emitOverlayFiles: () => emitOverlayFiles,
|
|
585
|
+
emitShippedShellFiles: () => emitShippedShellFiles,
|
|
581
586
|
emitTransformExpr: () => emitTransformExpr,
|
|
582
587
|
emittedFormIds: () => emittedFormIds,
|
|
583
588
|
emittedOperation: () => emittedOperation,
|
|
@@ -854,6 +859,7 @@ __export(index_exports, {
|
|
|
854
859
|
isPureFunctionComplete: () => isPureFunctionComplete,
|
|
855
860
|
isRedirectRoute: () => isRedirectRoute,
|
|
856
861
|
isReferencedByRule: () => isReferencedByRule,
|
|
862
|
+
isReleaseVersion: () => isReleaseVersion,
|
|
857
863
|
isRepeatFamily: () => isRepeatFamily,
|
|
858
864
|
isReservedFeatureName: () => isReservedFeatureName,
|
|
859
865
|
isReservedVariantId: () => isReservedVariantId,
|
|
@@ -1125,6 +1131,15 @@ __export(index_exports, {
|
|
|
1125
1131
|
outputCallKey: () => outputCallKey,
|
|
1126
1132
|
outputCallKeys: () => outputCallKeys,
|
|
1127
1133
|
outputCallLabel: () => outputCallLabel,
|
|
1134
|
+
outputLinkBindingTargets: () => outputLinkBindingTargets,
|
|
1135
|
+
outputLinkMemberName: () => outputLinkMemberName,
|
|
1136
|
+
outputLinkParamType: () => outputLinkParamType,
|
|
1137
|
+
outputNavOf: () => outputNavOf,
|
|
1138
|
+
outputNavStatement: () => outputNavStatement,
|
|
1139
|
+
outputNewTabFunctionId: () => outputNewTabFunctionId,
|
|
1140
|
+
outputNewTabFunctions: () => outputNewTabFunctions,
|
|
1141
|
+
outputNewTabOf: () => outputNewTabOf,
|
|
1142
|
+
outputNewTabStatements: () => outputNewTabStatements,
|
|
1128
1143
|
outputOpenConstTargets: () => outputOpenConstTargets,
|
|
1129
1144
|
outputOpenFixedAllowed: () => outputOpenFixedAllowed,
|
|
1130
1145
|
outputOpenHostInputIds: () => outputOpenHostInputIds,
|
|
@@ -1197,6 +1212,7 @@ __export(index_exports, {
|
|
|
1197
1212
|
pruneMappings: () => pruneMappings,
|
|
1198
1213
|
pruneMenuActions: () => pruneMenuActions,
|
|
1199
1214
|
pruneOutputCalls: () => pruneOutputCalls,
|
|
1215
|
+
pruneOutputLinkArgs: () => pruneOutputLinkArgs,
|
|
1200
1216
|
pruneUnknownShapeRefs: () => pruneUnknownShapeRefs,
|
|
1201
1217
|
pruneUnknownVariants: () => pruneUnknownVariants,
|
|
1202
1218
|
prunedInstanceSource: () => prunedInstanceSource,
|
|
@@ -1531,6 +1547,8 @@ __export(index_exports, {
|
|
|
1531
1547
|
validateMethodName: () => validateMethodName,
|
|
1532
1548
|
validateNavSlug: () => validateNavSlug,
|
|
1533
1549
|
validateOutcomeNav: () => validateOutcomeNav,
|
|
1550
|
+
validateOutputNav: () => validateOutputNav,
|
|
1551
|
+
validateOutputNewTab: () => validateOutputNewTab,
|
|
1534
1552
|
validateOutputOpen: () => validateOutputOpen,
|
|
1535
1553
|
validatePatternName: () => validatePatternName,
|
|
1536
1554
|
validateScreenEmits: () => validateScreenEmits,
|
|
@@ -1845,28 +1863,31 @@ Store app to point local builds at.
|
|
|
1845
1863
|
|
|
1846
1864
|
## CI
|
|
1847
1865
|
|
|
1848
|
-
\`.github/workflows/ci.yml\`, on
|
|
1849
|
-
It installs
|
|
1850
|
-
the web-component bundle with \`BUILD_CONFIG=prod\`. It never deploys
|
|
1851
|
-
|
|
1866
|
+
\`.github/workflows/ci.yml\`, on a pull request into \`main\` and nothing else.
|
|
1867
|
+
It installs from \`package.json\` alone, regenerates the code, lints, tests, and
|
|
1868
|
+
builds the web-component bundle with \`BUILD_CONFIG=prod\`. It never deploys. A
|
|
1869
|
+
push to a working branch runs nothing.
|
|
1852
1870
|
|
|
1853
1871
|
## CD
|
|
1854
1872
|
|
|
1855
|
-
\`.github/workflows/cd.yml\`,
|
|
1873
|
+
\`.github/workflows/cd.yml\`, when a pull request into \`main\` merges, and
|
|
1874
|
+
nothing else \u2014 not a push straight to \`main\`, not a pull request closed
|
|
1875
|
+
without merging.
|
|
1856
1876
|
|
|
1857
|
-
It
|
|
1858
|
-
|
|
1859
|
-
That gate is also why an unconfigured scaffold is quiet rather than broken:
|
|
1877
|
+
It deploys **only when that merge changed \`version:\` in
|
|
1878
|
+
\`mag_assets/remote/<app>.yml\`**. Merging is not a release; bumping the version
|
|
1879
|
+
is. That gate is also why an unconfigured scaffold is quiet rather than broken:
|
|
1860
1880
|
seeded at \`0.0.1\`, nothing fires until you have registered, set the three
|
|
1861
|
-
secrets, and
|
|
1881
|
+
secrets, and released.
|
|
1862
1882
|
|
|
1863
1883
|
To release:
|
|
1864
1884
|
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1885
|
+
1. In One UI, **Push** with **Release needed: Yes** and pick the version change
|
|
1886
|
+
(major / minor / patch). The Push writes the new \`version:\` and ends its
|
|
1887
|
+
commit message with \`release: <version> (<change>)\`. Do not bump the line
|
|
1888
|
+
by hand \u2014 every Push rewrites the manifest from the editor.
|
|
1889
|
+
2. Open a pull request from that branch into \`main\`; CI checks it.
|
|
1890
|
+
3. Merge it. CD builds and deploys the new version.
|
|
1870
1891
|
|
|
1871
1892
|
The job builds the bundle, \`POST\`s it to \`/store/v1/bundle/<app-id>\`, then
|
|
1872
1893
|
\`POST\`s \`/store/v1/deploy/<app-id>\`.
|
|
@@ -2883,6 +2904,7 @@ var SHARED_ICONS = [
|
|
|
2883
2904
|
// libs/one/src/lib/shared/ui/doc/doc-style.ts
|
|
2884
2905
|
var DEFAULT_DOC_VARIANT = "plain";
|
|
2885
2906
|
var DEFAULT_DOC_DENSITY = "default";
|
|
2907
|
+
var DEFAULT_DOC_ALIGN = "left";
|
|
2886
2908
|
|
|
2887
2909
|
// libs/one/src/lib/shared/functions/size/size-converter.ts
|
|
2888
2910
|
var SIZE_LENGTH = {
|
|
@@ -6040,15 +6062,15 @@ function transformNeverUndefined(expr, functions) {
|
|
|
6040
6062
|
}
|
|
6041
6063
|
var expressionNullish = (expr) => {
|
|
6042
6064
|
let depth = 0;
|
|
6043
|
-
let
|
|
6065
|
+
let quote5 = "";
|
|
6044
6066
|
for (let i = 0; i < expr.length; i++) {
|
|
6045
6067
|
const char = expr[i];
|
|
6046
|
-
if (
|
|
6068
|
+
if (quote5) {
|
|
6047
6069
|
if (char === "\\") i++;
|
|
6048
|
-
else if (char ===
|
|
6070
|
+
else if (char === quote5) quote5 = "";
|
|
6049
6071
|
continue;
|
|
6050
6072
|
}
|
|
6051
|
-
if (char === "'" || char === '"' || char === "`")
|
|
6073
|
+
if (char === "'" || char === '"' || char === "`") quote5 = char;
|
|
6052
6074
|
else if (char === "(" || char === "[") depth++;
|
|
6053
6075
|
else if (char === ")" || char === "]") depth--;
|
|
6054
6076
|
else if (char === "?" && expr[i + 1] === "." && depth === 0) return true;
|
|
@@ -9645,7 +9667,9 @@ var OUTPUT_MAPS = [
|
|
|
9645
9667
|
"outputWrites",
|
|
9646
9668
|
"outputScreenWrites",
|
|
9647
9669
|
"outputOutcomes",
|
|
9648
|
-
"outputOpens"
|
|
9670
|
+
"outputOpens",
|
|
9671
|
+
"outputNavs",
|
|
9672
|
+
"outputNewTabs"
|
|
9649
9673
|
];
|
|
9650
9674
|
var offersOutputArms = (control) => !!control && control.type !== "context_menu" /* CONTEXT_MENU */;
|
|
9651
9675
|
var wiredArmIds = (control, output) => {
|
|
@@ -9670,7 +9694,7 @@ function outputArms(control, output) {
|
|
|
9670
9694
|
var isOutputConditional = (control, output) => outputArms(control, output).length > 0;
|
|
9671
9695
|
var isOutputBound = (control, output) => !!control && (outputArms(control, output).length > 0 || outputCallKeys(control, output).some(
|
|
9672
9696
|
(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);
|
|
9697
|
+
) || !!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
9698
|
var outputArmMode = (arm) => arm.mode ?? "condition";
|
|
9675
9699
|
var scannedOutputArms = (control, output) => outputArms(control, output).filter(
|
|
9676
9700
|
(arm) => outputArmMode(arm) === "condition"
|
|
@@ -10624,7 +10648,9 @@ var OUTPUT_MAPS2 = [
|
|
|
10624
10648
|
"outputWrites",
|
|
10625
10649
|
"outputScreenWrites",
|
|
10626
10650
|
"outputOutcomes",
|
|
10627
|
-
"outputOpens"
|
|
10651
|
+
"outputOpens",
|
|
10652
|
+
"outputNavs",
|
|
10653
|
+
"outputNewTabs"
|
|
10628
10654
|
];
|
|
10629
10655
|
var wiresMenuActions = (control) => control?.type === "context_menu" /* CONTEXT_MENU */;
|
|
10630
10656
|
var wiredKeys = (control) => {
|
|
@@ -11923,8 +11949,8 @@ function storeReaders(feature) {
|
|
|
11923
11949
|
}
|
|
11924
11950
|
var pascalOf = (slug2) => slug2.split("-").filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join("");
|
|
11925
11951
|
var camelOf = (slug2) => {
|
|
11926
|
-
const
|
|
11927
|
-
return
|
|
11952
|
+
const pascal4 = pascalOf(slug2);
|
|
11953
|
+
return pascal4[0].toLowerCase() + pascal4.slice(1);
|
|
11928
11954
|
};
|
|
11929
11955
|
var slugOf = (name3) => name3.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "page";
|
|
11930
11956
|
var featureStorePropName = (featureName) => `${camelOf(slugOf(featureName))}Store`;
|
|
@@ -12023,8 +12049,8 @@ function toPascalCase(slug2) {
|
|
|
12023
12049
|
return slug2.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
12024
12050
|
}
|
|
12025
12051
|
function toCamelCase(slug2) {
|
|
12026
|
-
const
|
|
12027
|
-
return
|
|
12052
|
+
const pascal4 = toPascalCase(slug2);
|
|
12053
|
+
return pascal4.charAt(0).toLowerCase() + pascal4.slice(1);
|
|
12028
12054
|
}
|
|
12029
12055
|
function resolveComponentNaming(prefix, featureName, screenName) {
|
|
12030
12056
|
const feature = slugifyComponentName(featureName);
|
|
@@ -12233,6 +12259,7 @@ function downloadName(appName) {
|
|
|
12233
12259
|
}
|
|
12234
12260
|
|
|
12235
12261
|
// libs/codegen/src/model/web-component-config.ts
|
|
12262
|
+
var INITIAL_WC_VERSION = "0.0.1";
|
|
12236
12263
|
var EMPTY_WC_CONFIG = {
|
|
12237
12264
|
description: "",
|
|
12238
12265
|
company: "",
|
|
@@ -12242,9 +12269,16 @@ var EMPTY_WC_CONFIG = {
|
|
|
12242
12269
|
pwaColor: "#0f172a",
|
|
12243
12270
|
pwaBgColor: "#0f172a",
|
|
12244
12271
|
logoSvg: "",
|
|
12245
|
-
theme: ""
|
|
12272
|
+
theme: "",
|
|
12273
|
+
version: INITIAL_WC_VERSION
|
|
12274
|
+
};
|
|
12275
|
+
var isReleaseVersion = (value) => /^\d+\.\d+\.\d+$/.test(value);
|
|
12276
|
+
var bumpVersion = (version3, bump) => {
|
|
12277
|
+
const [major, minor, patch] = isReleaseVersion(version3) ? version3.split(".").map(Number) : INITIAL_WC_VERSION.split(".").map(Number);
|
|
12278
|
+
if (bump === "major") return `${major + 1}.0.0`;
|
|
12279
|
+
if (bump === "minor") return `${major}.${minor + 1}.0`;
|
|
12280
|
+
return `${major}.${minor}.${patch + 1}`;
|
|
12246
12281
|
};
|
|
12247
|
-
var INITIAL_WC_VERSION = "0.0.1";
|
|
12248
12282
|
var WC_ENVIRONMENTS = ["dev", "prod"];
|
|
12249
12283
|
|
|
12250
12284
|
// libs/codegen/src/lib/app-target-storage.ts
|
|
@@ -12293,7 +12327,10 @@ function sanitizeWcConfig(value) {
|
|
|
12293
12327
|
pwaColor: asString(stored.pwaColor) || EMPTY_WC_CONFIG.pwaColor,
|
|
12294
12328
|
pwaBgColor: asString(stored.pwaBgColor) || EMPTY_WC_CONFIG.pwaBgColor,
|
|
12295
12329
|
logoSvg: asString(stored.logoSvg),
|
|
12296
|
-
theme: asString(stored.theme)
|
|
12330
|
+
theme: asString(stored.theme),
|
|
12331
|
+
// A record from before the field, or one holding anything but `X.Y.Z`,
|
|
12332
|
+
// starts where a fresh scaffold does.
|
|
12333
|
+
version: isReleaseVersion(asString(stored.version)) ? asString(stored.version) : INITIAL_WC_VERSION
|
|
12297
12334
|
};
|
|
12298
12335
|
}
|
|
12299
12336
|
function saveWcConfig(storage, config) {
|
|
@@ -15598,7 +15635,7 @@ function outcomeNavStatePaths(properties, shapes) {
|
|
|
15598
15635
|
const walk = (path, label, dataType, one, depth) => {
|
|
15599
15636
|
if (!one || !dataType) return;
|
|
15600
15637
|
if (dataType.type === "string" || dataType.type === "number") {
|
|
15601
|
-
found.push({ path, label });
|
|
15638
|
+
found.push({ path, label, type: dataType.type });
|
|
15602
15639
|
return;
|
|
15603
15640
|
}
|
|
15604
15641
|
if (dataType.type !== "shape" || depth > 4) return;
|
|
@@ -15632,6 +15669,8 @@ function isOutcomeNavArgFilled(arg) {
|
|
|
15632
15669
|
return !!arg.navId;
|
|
15633
15670
|
case "state":
|
|
15634
15671
|
return arg.path.length > 0;
|
|
15672
|
+
case "binding":
|
|
15673
|
+
return !!arg.binding?.root;
|
|
15635
15674
|
case "fixed":
|
|
15636
15675
|
return String(arg.value ?? "").trim() !== "";
|
|
15637
15676
|
}
|
|
@@ -15664,15 +15703,25 @@ function countOutcomeNavReferences(controlMaps, navId) {
|
|
|
15664
15703
|
...Object.values(control.outputOutcomes ?? {}),
|
|
15665
15704
|
...Object.values(control.screenOutputOutcomes ?? {})
|
|
15666
15705
|
];
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
|
|
15674
|
-
|
|
15675
|
-
}
|
|
15706
|
+
const navs = [
|
|
15707
|
+
...outcomes.flatMap(
|
|
15708
|
+
(outcome) => OUTCOME_ARMS.map((arm) => outcome?.[arm]?.nav)
|
|
15709
|
+
),
|
|
15710
|
+
...Object.values(control.outputNavs ?? {})
|
|
15711
|
+
];
|
|
15712
|
+
for (const nav of navs) {
|
|
15713
|
+
if (!nav || nav.kind !== "nav") continue;
|
|
15714
|
+
const named = within(nav.navId, navId) || Object.values(nav.params ?? {}).some(
|
|
15715
|
+
(arg) => arg.source === "route" && within(arg.navId, navId)
|
|
15716
|
+
);
|
|
15717
|
+
if (named) total += 1;
|
|
15718
|
+
}
|
|
15719
|
+
for (const tab of Object.values(control.outputNewTabs ?? {})) {
|
|
15720
|
+
const args = tab?.mode === "value" ? [tab.value] : tab?.mode === "function" ? Object.values(tab.args ?? {}) : [];
|
|
15721
|
+
if (args.some(
|
|
15722
|
+
(arg) => arg?.source === "route" && within(arg.navId, navId)
|
|
15723
|
+
))
|
|
15724
|
+
total += 1;
|
|
15676
15725
|
}
|
|
15677
15726
|
}
|
|
15678
15727
|
}
|
|
@@ -15711,6 +15760,180 @@ function outcomeNavStatement(nav, navMap, read) {
|
|
|
15711
15760
|
return guards.length ? `if (${guards.join(" && ")}) ${call}` : call;
|
|
15712
15761
|
}
|
|
15713
15762
|
|
|
15763
|
+
// libs/codegen/src/lib/output-link-helper.ts
|
|
15764
|
+
var isNav = (value) => typeof value === "object" && value !== null && (value.kind === "parent" || value.kind === "nav");
|
|
15765
|
+
var NEW_TAB_MODES = [
|
|
15766
|
+
"static",
|
|
15767
|
+
"value",
|
|
15768
|
+
"function"
|
|
15769
|
+
];
|
|
15770
|
+
var asNewTab = (value) => {
|
|
15771
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
15772
|
+
const raw = value;
|
|
15773
|
+
const mode = NEW_TAB_MODES.find((one) => one === raw["mode"]);
|
|
15774
|
+
if (mode === "value")
|
|
15775
|
+
return {
|
|
15776
|
+
mode,
|
|
15777
|
+
...raw["value"] ? { value: raw["value"] } : {}
|
|
15778
|
+
};
|
|
15779
|
+
if (mode === "function")
|
|
15780
|
+
return {
|
|
15781
|
+
mode,
|
|
15782
|
+
functionId: String(raw["functionId"] ?? ""),
|
|
15783
|
+
...raw["args"] ? { args: raw["args"] } : {}
|
|
15784
|
+
};
|
|
15785
|
+
if (mode === "static" || typeof raw["url"] === "string")
|
|
15786
|
+
return { mode: "static", url: String(raw["url"] ?? "") };
|
|
15787
|
+
return void 0;
|
|
15788
|
+
};
|
|
15789
|
+
function outputNavOf(navs, output) {
|
|
15790
|
+
const nav = navs?.[output];
|
|
15791
|
+
return isNav(nav) ? nav : void 0;
|
|
15792
|
+
}
|
|
15793
|
+
function outputNewTabOf(tabs, output) {
|
|
15794
|
+
return asNewTab(tabs?.[output]);
|
|
15795
|
+
}
|
|
15796
|
+
function outputLinkBindingTargets(scope, type) {
|
|
15797
|
+
if (!scope) return [];
|
|
15798
|
+
return bindingOptions(
|
|
15799
|
+
scope,
|
|
15800
|
+
(dataType, cardinality) => cardinality === "one" && (type ? dataType?.type === type : dataType?.type === "string" || dataType?.type === "number" || dataType?.type === "boolean")
|
|
15801
|
+
);
|
|
15802
|
+
}
|
|
15803
|
+
var createOutputNav = () => ({ kind: "parent" });
|
|
15804
|
+
var createOutputNewTab = () => ({
|
|
15805
|
+
mode: "static",
|
|
15806
|
+
url: ""
|
|
15807
|
+
});
|
|
15808
|
+
function outputLinkParamType(param) {
|
|
15809
|
+
if (param.cardinality !== "one") return void 0;
|
|
15810
|
+
const type = param.dataType.type;
|
|
15811
|
+
return type === "string" || type === "number" || type === "boolean" ? type : void 0;
|
|
15812
|
+
}
|
|
15813
|
+
function outputNewTabFunctions(functions) {
|
|
15814
|
+
return Object.values(functions).filter(
|
|
15815
|
+
(fn) => fn.returnType.type === "string" && fn.returnCardinality === "one" && fn.params.every((param) => !!outputLinkParamType(param))
|
|
15816
|
+
).sort((a, b) => a.name.localeCompare(b.name));
|
|
15817
|
+
}
|
|
15818
|
+
var isLinkArgFilled = (arg) => isOutcomeNavArgFilled(arg) && arg?.source !== "args";
|
|
15819
|
+
function validateOutputNav(nav, navMap) {
|
|
15820
|
+
const error = validateOutcomeNav(nav, navMap);
|
|
15821
|
+
if (error) return error;
|
|
15822
|
+
return Object.values(nav?.params ?? {}).some((arg) => arg.source === "args") ? "outcome-nav-param-unfilled" : void 0;
|
|
15823
|
+
}
|
|
15824
|
+
function validateOutputNewTab(tab, functions) {
|
|
15825
|
+
if (!tab) return void 0;
|
|
15826
|
+
switch (tab.mode) {
|
|
15827
|
+
case "static":
|
|
15828
|
+
return tab.url.trim() ? void 0 : "new-tab-no-url";
|
|
15829
|
+
case "value":
|
|
15830
|
+
return isLinkArgFilled(tab.value) && tab.value?.source !== "fixed" ? void 0 : "new-tab-value-unfilled";
|
|
15831
|
+
case "function": {
|
|
15832
|
+
if (!tab.functionId) return "new-tab-no-function";
|
|
15833
|
+
if (!functions) return void 0;
|
|
15834
|
+
const fn = functions[tab.functionId];
|
|
15835
|
+
if (!fn || !outputNewTabFunctions({ [fn.id]: fn }).length)
|
|
15836
|
+
return "new-tab-function-gone";
|
|
15837
|
+
return fn.params.every((param) => isLinkArgFilled(tab.args?.[param.id])) ? void 0 : "new-tab-param-unfilled";
|
|
15838
|
+
}
|
|
15839
|
+
}
|
|
15840
|
+
}
|
|
15841
|
+
var quote3 = (value) => `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
|
|
15842
|
+
function outputNavStatement(nav, navMap, read) {
|
|
15843
|
+
if (!nav || validateOutputNav(nav, navMap)) return void 0;
|
|
15844
|
+
return outcomeNavStatement(nav, navMap, read);
|
|
15845
|
+
}
|
|
15846
|
+
var fixedLiteral = (value, type) => {
|
|
15847
|
+
if (type === "number" && Number.isFinite(Number(value)))
|
|
15848
|
+
return String(Number(value));
|
|
15849
|
+
if (type === "boolean") return String(value === true || value === "true");
|
|
15850
|
+
return quote3(String(value));
|
|
15851
|
+
};
|
|
15852
|
+
var COERCE = {
|
|
15853
|
+
string: "String",
|
|
15854
|
+
number: "Number",
|
|
15855
|
+
boolean: "Boolean"
|
|
15856
|
+
};
|
|
15857
|
+
var URL_LOCAL = "newTabUrl";
|
|
15858
|
+
var openCall = (url) => `globalThis.open?.(${url}, '_blank', 'noopener')`;
|
|
15859
|
+
function outputNewTabStatements(tab, read, functions) {
|
|
15860
|
+
if (!tab || validateOutputNewTab(tab, functions)) return [];
|
|
15861
|
+
if (tab.mode === "static") return [openCall(quote3(tab.url.trim()))];
|
|
15862
|
+
if (tab.mode === "value") {
|
|
15863
|
+
const arg = tab.value;
|
|
15864
|
+
const expr = read(arg);
|
|
15865
|
+
if (!expr) return [];
|
|
15866
|
+
return [
|
|
15867
|
+
`const ${URL_LOCAL} = ${expr}`,
|
|
15868
|
+
`if (${URL_LOCAL} != null) ${openCall(`String(${URL_LOCAL})`)}`
|
|
15869
|
+
];
|
|
15870
|
+
}
|
|
15871
|
+
const fn = functions[tab.functionId];
|
|
15872
|
+
const guards = [];
|
|
15873
|
+
const args = [];
|
|
15874
|
+
for (const param of fn.params) {
|
|
15875
|
+
const type = outputLinkParamType(param);
|
|
15876
|
+
const arg = tab.args?.[param.id];
|
|
15877
|
+
if (arg.source === "fixed") {
|
|
15878
|
+
args.push(fixedLiteral(arg.value, type));
|
|
15879
|
+
continue;
|
|
15880
|
+
}
|
|
15881
|
+
const expr = read(arg);
|
|
15882
|
+
if (!expr) return [];
|
|
15883
|
+
if (!guards.includes(`${expr} != null`)) guards.push(`${expr} != null`);
|
|
15884
|
+
args.push(`${COERCE[type]}(${expr})`);
|
|
15885
|
+
}
|
|
15886
|
+
const call = `${fn.name}(${args.join(", ")})`;
|
|
15887
|
+
const bound = guards.length ? `${guards.join(" && ")} ? ${call} : undefined` : call;
|
|
15888
|
+
if (fn.returnAsync)
|
|
15889
|
+
return [
|
|
15890
|
+
`const ${URL_LOCAL} = ${bound}`,
|
|
15891
|
+
`void Promise.resolve(${URL_LOCAL}).then((url) => { if (url != null) ${openCall("url")}; })`
|
|
15892
|
+
];
|
|
15893
|
+
return [
|
|
15894
|
+
`const ${URL_LOCAL} = ${bound}`,
|
|
15895
|
+
`if (${URL_LOCAL} != null) ${openCall(URL_LOCAL)}`
|
|
15896
|
+
];
|
|
15897
|
+
}
|
|
15898
|
+
var outputNewTabFunctionId = (tab) => tab?.mode === "function" && tab.functionId ? tab.functionId : void 0;
|
|
15899
|
+
var pascal2 = (value) => value.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
15900
|
+
function outputLinkMemberName(controlId, output) {
|
|
15901
|
+
return `follow${pascal2(output)}${pascal2(controlId.slice(0, 8))}`;
|
|
15902
|
+
}
|
|
15903
|
+
function pruneOutputLinkArgs(control, drop) {
|
|
15904
|
+
let dropped = 0;
|
|
15905
|
+
const prune = (args) => {
|
|
15906
|
+
if (!args) return void 0;
|
|
15907
|
+
const kept = Object.fromEntries(
|
|
15908
|
+
Object.entries(args).filter(([, arg]) => !drop(arg))
|
|
15909
|
+
);
|
|
15910
|
+
dropped += Object.keys(args).length - Object.keys(kept).length;
|
|
15911
|
+
return Object.keys(kept).length ? kept : void 0;
|
|
15912
|
+
};
|
|
15913
|
+
if (control.outputNavs) {
|
|
15914
|
+
control.outputNavs = Object.fromEntries(
|
|
15915
|
+
Object.entries(control.outputNavs).map(([output, nav]) => [
|
|
15916
|
+
output,
|
|
15917
|
+
{ ...nav, params: prune(nav.params) }
|
|
15918
|
+
])
|
|
15919
|
+
);
|
|
15920
|
+
}
|
|
15921
|
+
if (control.outputNewTabs) {
|
|
15922
|
+
control.outputNewTabs = Object.fromEntries(
|
|
15923
|
+
Object.entries(control.outputNewTabs).map(([output, tab]) => {
|
|
15924
|
+
if (tab.mode === "function")
|
|
15925
|
+
return [output, { ...tab, args: prune(tab.args) }];
|
|
15926
|
+
if (tab.mode === "value" && tab.value) {
|
|
15927
|
+
const kept = prune({ value: tab.value });
|
|
15928
|
+
return [output, { mode: "value", ...kept ?? {} }];
|
|
15929
|
+
}
|
|
15930
|
+
return [output, tab];
|
|
15931
|
+
})
|
|
15932
|
+
);
|
|
15933
|
+
}
|
|
15934
|
+
return dropped;
|
|
15935
|
+
}
|
|
15936
|
+
|
|
15714
15937
|
// libs/codegen/src/lib/screen-input-source-helper.ts
|
|
15715
15938
|
var SCREEN_SOURCE_SEP = "::";
|
|
15716
15939
|
var encode = (kind, id) => `${kind}${SCREEN_SOURCE_SEP}${id}`;
|
|
@@ -15994,9 +16217,9 @@ function outputOpenHostInputIds(control) {
|
|
|
15994
16217
|
function everyOutputOpen(control) {
|
|
15995
16218
|
return Object.keys(control.outputOpens ?? {}).map((output) => outputOpenOf(control.outputOpens, output)).filter((open) => !!open);
|
|
15996
16219
|
}
|
|
15997
|
-
var
|
|
16220
|
+
var pascal3 = (value) => value.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
15998
16221
|
function outputOpenMemberName(controlId, output) {
|
|
15999
|
-
return `open${
|
|
16222
|
+
return `open${pascal3(output)}${pascal3(controlId.slice(0, 8))}`;
|
|
16000
16223
|
}
|
|
16001
16224
|
function outputOpenIdName(controlId, output) {
|
|
16002
16225
|
return `${outputOpenMemberName(controlId, output)}Id`;
|
|
@@ -18428,6 +18651,7 @@ function bodyConfigs(node) {
|
|
|
18428
18651
|
else delete configs["url"];
|
|
18429
18652
|
if (configs["variant"] === DEFAULT_DOC_VARIANT) delete configs["variant"];
|
|
18430
18653
|
if (configs["density"] === DEFAULT_DOC_DENSITY) delete configs["density"];
|
|
18654
|
+
if (configs["align"] === DEFAULT_DOC_ALIGN) delete configs["align"];
|
|
18431
18655
|
}
|
|
18432
18656
|
if (node.type === "section_filter" /* SECTION_FILTER */) {
|
|
18433
18657
|
const variant = filterVariantOf(node.configs);
|
|
@@ -19494,6 +19718,10 @@ function outputAttrs(node, methods, operationOf, storeProp, ctx) {
|
|
|
19494
19718
|
// the one call to its overlay member is the whole of what it does
|
|
19495
19719
|
// (CONTEXT.md OutputOpen).
|
|
19496
19720
|
...Object.keys(node.outputOpens ?? {}),
|
|
19721
|
+
// An output that only navigates or opens a new tab holds nothing in the
|
|
19722
|
+
// maps above either (CONTEXT.md OutputNav, OutputNewTab).
|
|
19723
|
+
...Object.keys(node.outputNavs ?? {}),
|
|
19724
|
+
...Object.keys(node.outputNewTabs ?? {}),
|
|
19497
19725
|
// An output that only fires a ScreenMethod holds nothing in the three maps
|
|
19498
19726
|
// above, and a handler is the whole of what it does (ADR 0095).
|
|
19499
19727
|
...Object.keys(node.outputScreenMethods ?? {}),
|
|
@@ -19558,6 +19786,8 @@ function outputAttrs(node, methods, operationOf, storeProp, ctx) {
|
|
|
19558
19786
|
operationOf
|
|
19559
19787
|
);
|
|
19560
19788
|
if (open) statements.push(open);
|
|
19789
|
+
const link = outputLinkCall(node, output, ctx, "template", storeProp);
|
|
19790
|
+
if (link) statements.push(link);
|
|
19561
19791
|
if (groupDrawsOutcome(node, output, methods)) {
|
|
19562
19792
|
const refs = groupOutcomeFormIds(
|
|
19563
19793
|
node,
|
|
@@ -19867,7 +20097,15 @@ ${" ".repeat(indent2 + index)}}`,
|
|
|
19867
20097
|
const { tag } = codegen;
|
|
19868
20098
|
ctx.writtenTags.add(tag);
|
|
19869
20099
|
if (node.type === "plugin" /* PLUGIN */) {
|
|
19870
|
-
return renderPluginTag(
|
|
20100
|
+
return renderPluginTag(
|
|
20101
|
+
node,
|
|
20102
|
+
pad,
|
|
20103
|
+
tag,
|
|
20104
|
+
methods,
|
|
20105
|
+
operationOf,
|
|
20106
|
+
storeProp,
|
|
20107
|
+
ctx
|
|
20108
|
+
);
|
|
19871
20109
|
}
|
|
19872
20110
|
const attrs = `${tagAttrs(node, ctx, storeProp)}${payloadAttr(node, payloads)}${directiveAttrs(
|
|
19873
20111
|
node,
|
|
@@ -21045,6 +21283,8 @@ function outcomeHandlersBlock(tree, methods, operationOf, storeProp, ctx, payloa
|
|
|
21045
21283
|
operationOf
|
|
21046
21284
|
);
|
|
21047
21285
|
if (open) statements.push(open);
|
|
21286
|
+
const link = outputLinkCall(node, output, ctx, "class", storeProp);
|
|
21287
|
+
if (link) statements.push(link);
|
|
21048
21288
|
outputCallKeys(node, output).forEach(
|
|
21049
21289
|
(callKey, index) => statements.push(
|
|
21050
21290
|
...classCallStatements(
|
|
@@ -21263,6 +21503,7 @@ function gatedCallSiteStatements(node, key2, payload, eventRoot, methods, operat
|
|
|
21263
21503
|
operationOf
|
|
21264
21504
|
);
|
|
21265
21505
|
if (open) statements.push(open.statement);
|
|
21506
|
+
statements.push(...outputLinkStatements(node, key2, ctx, storeProp));
|
|
21266
21507
|
outputCallKeys(node, key2).forEach(
|
|
21267
21508
|
(callKey, index) => statements.push(
|
|
21268
21509
|
...classCallStatements(
|
|
@@ -21813,10 +22054,19 @@ function armStatements(node, output, arm, payload, eventRoot, selfStore, ctx, ar
|
|
|
21813
22054
|
} else if (answer) {
|
|
21814
22055
|
statements.push(`${OVERLAY_REF_MEMBER}?.change(${answer})`);
|
|
21815
22056
|
}
|
|
21816
|
-
const
|
|
22057
|
+
const linkRead = outputLinkRead(ctx, selfStore.replace(/^this\./, ""));
|
|
22058
|
+
const nav = outcomeNavStatement(
|
|
22059
|
+
rows.nav,
|
|
22060
|
+
ctx.navMap ?? {},
|
|
22061
|
+
(arg) => arg.source === "args" ? argsLocal ? `${argsLocal}.${arg.arg.join("?.")}` : void 0 : linkRead(arg)
|
|
22062
|
+
);
|
|
22063
|
+
if (nav) statements.push(nav);
|
|
22064
|
+
return statements;
|
|
22065
|
+
}
|
|
22066
|
+
function outputLinkRead(ctx, storeProp) {
|
|
22067
|
+
const selfStore = storeProp ? `this.${storeProp}` : "";
|
|
22068
|
+
return (arg) => {
|
|
21817
22069
|
switch (arg.source) {
|
|
21818
|
-
case "args":
|
|
21819
|
-
return argsLocal ? `${argsLocal}.${arg.arg.join("?.")}` : void 0;
|
|
21820
22070
|
case "route":
|
|
21821
22071
|
return `${NAV_REF_MEMBER}?.routeParamOf?.('${arg.navId}')`;
|
|
21822
22072
|
case "state":
|
|
@@ -21827,10 +22077,60 @@ function armStatements(node, output, arm, payload, eventRoot, selfStore, ctx, ar
|
|
|
21827
22077
|
selfStore,
|
|
21828
22078
|
false
|
|
21829
22079
|
) : void 0;
|
|
22080
|
+
case "binding":
|
|
22081
|
+
return bindingExpression(arg.binding, {
|
|
22082
|
+
...bindingScope(ctx, storeProp),
|
|
22083
|
+
memberPrefix: "this."
|
|
22084
|
+
});
|
|
22085
|
+
default:
|
|
22086
|
+
return void 0;
|
|
21830
22087
|
}
|
|
21831
|
-
}
|
|
21832
|
-
|
|
21833
|
-
|
|
22088
|
+
};
|
|
22089
|
+
}
|
|
22090
|
+
function outputLinkStatements(node, output, ctx, storeProp) {
|
|
22091
|
+
const read = outputLinkRead(ctx, storeProp);
|
|
22092
|
+
const nav = outputNavStatement(
|
|
22093
|
+
outputNavOf(node.outputNavs, output),
|
|
22094
|
+
ctx.navMap ?? {},
|
|
22095
|
+
read
|
|
22096
|
+
);
|
|
22097
|
+
return [
|
|
22098
|
+
...outputNewTabStatements(
|
|
22099
|
+
outputNewTabOf(node.outputNewTabs, output),
|
|
22100
|
+
read,
|
|
22101
|
+
ctx.functions ?? {}
|
|
22102
|
+
),
|
|
22103
|
+
...nav ? [nav] : []
|
|
22104
|
+
];
|
|
22105
|
+
}
|
|
22106
|
+
function outputLinkCall(node, output, ctx, scope, storeProp) {
|
|
22107
|
+
if (!outputLinkStatements(node, output, ctx, storeProp).length) return "";
|
|
22108
|
+
const self = scope === "class" ? "this." : "";
|
|
22109
|
+
return `${self}${outputLinkMemberName(node.id, output)}()`;
|
|
22110
|
+
}
|
|
22111
|
+
function outputLinkMembersBlock(tree, ctx, storeProp) {
|
|
22112
|
+
const emitted = [];
|
|
22113
|
+
const walk = (nodes) => {
|
|
22114
|
+
for (const node of nodes) {
|
|
22115
|
+
const outputs = /* @__PURE__ */ new Set([
|
|
22116
|
+
...Object.keys(node.outputNavs ?? {}),
|
|
22117
|
+
...Object.keys(node.outputNewTabs ?? {})
|
|
22118
|
+
]);
|
|
22119
|
+
for (const output of [...outputs].sort()) {
|
|
22120
|
+
if (isOutputArmKey(output) || isMenuActionKey(output)) continue;
|
|
22121
|
+
const lines = outputLinkStatements(node, output, ctx, storeProp);
|
|
22122
|
+
if (!lines.length) continue;
|
|
22123
|
+
emitted.push(`
|
|
22124
|
+
protected readonly ${outputLinkMemberName(node.id, output)} = (): void => {
|
|
22125
|
+
${lines.map((line) => ` ${line};`).join("\n")}
|
|
22126
|
+
};
|
|
22127
|
+
`);
|
|
22128
|
+
}
|
|
22129
|
+
walk(node.childrens);
|
|
22130
|
+
}
|
|
22131
|
+
};
|
|
22132
|
+
walk(tree);
|
|
22133
|
+
return emitted.join("");
|
|
21834
22134
|
}
|
|
21835
22135
|
function methodArgsOf(method, operationOf, ctx) {
|
|
21836
22136
|
const op = operationOf(method);
|
|
@@ -22947,6 +23247,7 @@ ${tables.map(
|
|
|
22947
23247
|
methods,
|
|
22948
23248
|
operationOf
|
|
22949
23249
|
);
|
|
23250
|
+
const outputLinkBody = outputLinkMembersBlock(tree, ctx, storeProp);
|
|
22950
23251
|
const menuActionHandlersBody = menuActionHandlersBlock(
|
|
22951
23252
|
tree,
|
|
22952
23253
|
methods,
|
|
@@ -22982,7 +23283,9 @@ ${tables.map(
|
|
|
22982
23283
|
"Component",
|
|
22983
23284
|
...screenComputedsBody || screenVariantsBody || cardsBody || messageParamsBody ? ["computed"] : [],
|
|
22984
23285
|
...autoCalls.length ? ["effect"] : [],
|
|
22985
|
-
...needsStore || usesAuth || injectedGlobalStores.length > 0 || usesModal || drawsOverlayClose || drawsOutcomeNav || classReadsNavRef
|
|
23286
|
+
...needsStore || usesAuth || injectedGlobalStores.length > 0 || usesModal || drawsOverlayClose || drawsOutcomeNav || classReadsNavRef || `${outputLinkBody}${menuActionHandlersBody}${outputArmHandlersBody}`.includes(
|
|
23287
|
+
`${NAV_REF_MEMBER}?.`
|
|
23288
|
+
) ? ["inject"] : [],
|
|
22986
23289
|
...inputs.length ? ["input"] : [],
|
|
22987
23290
|
...outputs.length ? ["output"] : [],
|
|
22988
23291
|
...wires.length || variables.some((v) => !isLinkedVariable(v)) || Object.values(ctx.formModels ?? {}).some((m) => !isLinkedFormModel(m)) ? ["signal"] : [],
|
|
@@ -23010,6 +23313,15 @@ ${tables.map(
|
|
|
23010
23313
|
if (fn) screenFunctions.set(fn.name, fn);
|
|
23011
23314
|
}
|
|
23012
23315
|
}
|
|
23316
|
+
for (const control of Object.values(ctx.controlMap ?? {})) {
|
|
23317
|
+
for (const output of Object.keys(control.outputNewTabs ?? {})) {
|
|
23318
|
+
const tab = outputNewTabOf(control.outputNewTabs, output);
|
|
23319
|
+
if (validateOutputNewTab(tab, ctx.functions ?? {})) continue;
|
|
23320
|
+
const id = outputNewTabFunctionId(tab);
|
|
23321
|
+
const fn = id ? (ctx.functions ?? {})[id] : void 0;
|
|
23322
|
+
if (fn) screenFunctions.set(fn.name, fn);
|
|
23323
|
+
}
|
|
23324
|
+
}
|
|
23013
23325
|
const screenFunctionImports = [...screenFunctions.values()].sort((a, b) => a.name.localeCompare(b.name)).map(
|
|
23014
23326
|
// Every Screen emits to `src/app/<root>/<slug>/ui/`, whichever
|
|
23015
23327
|
// CompositionKind it is, so the hop to `src/app/shared/lib/` is the same
|
|
@@ -23135,7 +23447,7 @@ ${tables.map(
|
|
|
23135
23447
|
const overlayRefBody = usesOverlayRef ? `
|
|
23136
23448
|
private readonly overlay = inject(MODAL_REF, { optional: true });
|
|
23137
23449
|
` : "";
|
|
23138
|
-
const usesNavRef = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}${screenVariantsBody}${screenComputedsBody}`.includes(
|
|
23450
|
+
const usesNavRef = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}${screenVariantsBody}${screenComputedsBody}${outputLinkBody}`.includes(
|
|
23139
23451
|
`${NAV_REF_MEMBER}?.`
|
|
23140
23452
|
);
|
|
23141
23453
|
const navRefImport = usesNavRef ? `import { NAV_STORE_REF, type NavStoreRef } from '@magmonium/one';
|
|
@@ -23154,7 +23466,7 @@ ${tables.map(
|
|
|
23154
23466
|
})
|
|
23155
23467
|
| null;
|
|
23156
23468
|
` : "";
|
|
23157
|
-
const usesNavRouter = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}`.includes(
|
|
23469
|
+
const usesNavRouter = `${outcomeHandlersBody}${menuActionHandlersBody}${outputArmHandlersBody}${outputLinkBody}`.includes(
|
|
23158
23470
|
`${NAV_ROUTER_MEMBER}.`
|
|
23159
23471
|
);
|
|
23160
23472
|
const navRouterImport = usesNavRouter ? `import { ActivatedRoute, Router } from '@angular/router';
|
|
@@ -23198,7 +23510,7 @@ ${`${outcomeHandlersBody}${menuActionHandlersBody}`.includes("$event: MenuItem")
|
|
|
23198
23510
|
width: 100%
|
|
23199
23511
|
\`,
|
|
23200
23512
|
})
|
|
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}}
|
|
23513
|
+
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
23514
|
`;
|
|
23203
23515
|
}
|
|
23204
23516
|
function assetName(node) {
|
|
@@ -23404,7 +23716,11 @@ function generateCode(tree, featureName, screenName, properties = {}, variants =
|
|
|
23404
23716
|
].map(({ prop, members }) => ({
|
|
23405
23717
|
prop,
|
|
23406
23718
|
properties: listDataProperties(members).map(
|
|
23407
|
-
({ name: name3, dataType, cardinality }) => ({
|
|
23719
|
+
({ name: name3, dataType, cardinality }) => ({
|
|
23720
|
+
name: name3,
|
|
23721
|
+
dataType,
|
|
23722
|
+
cardinality
|
|
23723
|
+
})
|
|
23408
23724
|
)
|
|
23409
23725
|
})).filter((store) => store.properties.length)
|
|
23410
23726
|
}
|
|
@@ -23518,7 +23834,7 @@ __export(package_exports, {
|
|
|
23518
23834
|
version: () => version
|
|
23519
23835
|
});
|
|
23520
23836
|
var name = "@magmonium/one";
|
|
23521
|
-
var version = "0.4.
|
|
23837
|
+
var version = "0.4.27";
|
|
23522
23838
|
var description = "Magmonium One \u2014 Angular design-system primitives for mm Apps";
|
|
23523
23839
|
var author = "magmonium";
|
|
23524
23840
|
var license = "MIT";
|
|
@@ -23549,7 +23865,7 @@ var peerDependencies = {
|
|
|
23549
23865
|
"@angular/elements": "^21.0.0",
|
|
23550
23866
|
"@ngrx/signals": "^21.0.0",
|
|
23551
23867
|
rxjs: "^7.8.0",
|
|
23552
|
-
"@magmonium/cli": "
|
|
23868
|
+
"@magmonium/cli": ">=0.7.12 <1.0.0",
|
|
23553
23869
|
"socket.io-client": "^4.8.0"
|
|
23554
23870
|
};
|
|
23555
23871
|
var sideEffects = false;
|
|
@@ -23586,7 +23902,7 @@ __export(package_exports2, {
|
|
|
23586
23902
|
version: () => version2
|
|
23587
23903
|
});
|
|
23588
23904
|
var name2 = "@magmonium/cli";
|
|
23589
|
-
var version2 = "0.8.
|
|
23905
|
+
var version2 = "0.8.2";
|
|
23590
23906
|
var description2 = "A powerful and extensible asset compilation tool that can be shared across multiple projects";
|
|
23591
23907
|
var bin = {
|
|
23592
23908
|
"mag-cli": "bin/cli.js"
|
|
@@ -27084,6 +27400,8 @@ function buildTree(controlMap, rootControlIds, selection) {
|
|
|
27084
27400
|
...ctrl.outputEmits && Object.keys(ctrl.outputEmits).length ? { outputEmits: ctrl.outputEmits } : {},
|
|
27085
27401
|
...ctrl.outputScreenWrites && Object.keys(ctrl.outputScreenWrites).length ? { outputScreenWrites: ctrl.outputScreenWrites } : {},
|
|
27086
27402
|
...ctrl.outputOpens && Object.keys(ctrl.outputOpens).length ? { outputOpens: ctrl.outputOpens } : {},
|
|
27403
|
+
...ctrl.outputNavs && Object.keys(ctrl.outputNavs).length ? { outputNavs: ctrl.outputNavs } : {},
|
|
27404
|
+
...ctrl.outputNewTabs && Object.keys(ctrl.outputNewTabs).length ? { outputNewTabs: ctrl.outputNewTabs } : {},
|
|
27087
27405
|
...ctrl.outputOutcomes && Object.keys(ctrl.outputOutcomes).length ? { outputOutcomes: ctrl.outputOutcomes } : {},
|
|
27088
27406
|
// Without this the codegen walk reads `outputArms` off a Tree that never
|
|
27089
27407
|
// carried it, every gated output falls back to ungated, and its groups —
|
|
@@ -27836,13 +28154,13 @@ var TEST_RUNNER_DEV_DEPS = {
|
|
|
27836
28154
|
"@vitest/coverage-v8": VITEST_VERSION,
|
|
27837
28155
|
jsdom: "^27.1.0"
|
|
27838
28156
|
};
|
|
27839
|
-
var packageJson = (appName, extraDeps = {}) => JSON.stringify(
|
|
28157
|
+
var packageJson = (appName, version3, extraDeps = {}) => JSON.stringify(
|
|
27840
28158
|
{
|
|
27841
28159
|
// The package identity is the AppTarget's exact user-supplied name.
|
|
27842
28160
|
// File names still use `appFileBase` below, which has separate naming
|
|
27843
28161
|
// requirements and must not redefine the app itself.
|
|
27844
28162
|
name: appName.trim() || "app",
|
|
27845
|
-
version:
|
|
28163
|
+
version: version3,
|
|
27846
28164
|
private: true,
|
|
27847
28165
|
scripts: {
|
|
27848
28166
|
// `assets:compile` before every build and serve, because the app reads
|
|
@@ -27909,15 +28227,17 @@ var packageJson = (appName, extraDeps = {}) => JSON.stringify(
|
|
|
27909
28227
|
"@angular/forms": NG_VERSION,
|
|
27910
28228
|
"@angular/platform-browser": NG_VERSION,
|
|
27911
28229
|
"@angular/router": NG_VERSION,
|
|
27912
|
-
//
|
|
27913
|
-
//
|
|
27914
|
-
//
|
|
27915
|
-
//
|
|
28230
|
+
// Exact, never a range, for the reason `@magmonium/cli` is: CI
|
|
28231
|
+
// installs from this file alone (no lockfile), so a range would build
|
|
28232
|
+
// against a library the editor never shipped with. The pin moves with
|
|
28233
|
+
// every publish, and `scaffold-helper.spec.ts` asserts it against
|
|
28234
|
+
// `libs/one`'s own version rather than a literal so it cannot lag —
|
|
28235
|
+
// every Push rewrites it. It must not lag — the
|
|
27916
28236
|
// Platform Nav seed and the panels behind search, notifications, the
|
|
27917
28237
|
// user menu and settings all live in the library (libs/one ADR 0016),
|
|
27918
28238
|
// and a scaffold on an older pin still compiles while every one of
|
|
27919
28239
|
// those panels comes up blank.
|
|
27920
|
-
"@magmonium/one":
|
|
28240
|
+
"@magmonium/one": ONE_PACKAGE_VERSION,
|
|
27921
28241
|
"@ngrx/signals": "^21.0.1",
|
|
27922
28242
|
rxjs: "~7.8.0",
|
|
27923
28243
|
"socket.io-client": "^4.8.3",
|
|
@@ -28622,7 +28942,7 @@ ${p2.required?.length ? ` required: [${p2.required.join(", ")}]
|
|
|
28622
28942
|
`
|
|
28623
28943
|
).join("")}` : "";
|
|
28624
28944
|
var remoteManifest = (app, appName, config, className, selector, plugins) => `app: ${app}
|
|
28625
|
-
version: ${
|
|
28945
|
+
version: ${config.version}
|
|
28626
28946
|
name: ${appDisplayName(appName)}
|
|
28627
28947
|
description: ${config.description}
|
|
28628
28948
|
company: ${config.company}
|
|
@@ -28653,7 +28973,8 @@ var setupNode = ` - uses: actions/setup-node@v4
|
|
|
28653
28973
|
cache-dependency-path: package.json
|
|
28654
28974
|
- name: Install dependencies
|
|
28655
28975
|
run: |
|
|
28656
|
-
|
|
28976
|
+
rm -f package-lock.json
|
|
28977
|
+
npm install --no-package-lock
|
|
28657
28978
|
`;
|
|
28658
28979
|
var generateStep = ` - name: Generate code and tests from .magmonium
|
|
28659
28980
|
run: npm run gen:test
|
|
@@ -28661,10 +28982,8 @@ var generateStep = ` - name: Generate code and tests from .magmonium
|
|
|
28661
28982
|
var ciWorkflow = () => `name: CI
|
|
28662
28983
|
|
|
28663
28984
|
on:
|
|
28664
|
-
push:
|
|
28665
28985
|
pull_request:
|
|
28666
28986
|
branches: [main]
|
|
28667
|
-
workflow_dispatch:
|
|
28668
28987
|
|
|
28669
28988
|
jobs:
|
|
28670
28989
|
verify:
|
|
@@ -28684,19 +29003,21 @@ ${setupNode}${generateStep} - name: Lint
|
|
|
28684
29003
|
var cdWorkflow = (app) => `name: CD
|
|
28685
29004
|
|
|
28686
29005
|
on:
|
|
28687
|
-
|
|
29006
|
+
pull_request:
|
|
29007
|
+
types: [closed]
|
|
28688
29008
|
branches: [main]
|
|
28689
|
-
workflow_dispatch:
|
|
28690
29009
|
|
|
28691
29010
|
jobs:
|
|
28692
29011
|
version-check:
|
|
28693
29012
|
name: Check Version Change
|
|
29013
|
+
if: github.event.pull_request.merged == true
|
|
28694
29014
|
runs-on: ubuntu-latest
|
|
28695
29015
|
outputs:
|
|
28696
29016
|
changed: \${{ steps.check.outputs.changed }}
|
|
28697
29017
|
steps:
|
|
28698
29018
|
- uses: actions/checkout@v4
|
|
28699
29019
|
with:
|
|
29020
|
+
ref: \${{ github.event.pull_request.merge_commit_sha }}
|
|
28700
29021
|
fetch-depth: 0
|
|
28701
29022
|
- name: Check if version changed
|
|
28702
29023
|
id: check
|
|
@@ -28726,9 +29047,9 @@ jobs:
|
|
|
28726
29047
|
runs-on: ubuntu-latest
|
|
28727
29048
|
steps:
|
|
28728
29049
|
- uses: actions/checkout@v4
|
|
28729
|
-
|
|
28730
|
-
|
|
28731
|
-
- name: Build assets and web component
|
|
29050
|
+
with:
|
|
29051
|
+
ref: \${{ github.event.pull_request.merge_commit_sha }}
|
|
29052
|
+
${setupNode}${generateStep} - name: Build assets and web component
|
|
28732
29053
|
run: npm run build:wc --ignore-scripts
|
|
28733
29054
|
env:
|
|
28734
29055
|
BUILD_CONFIG: prod
|
|
@@ -28963,6 +29284,9 @@ direction is a cycle. \`npm run lint\` enforces it.
|
|
|
28963
29284
|
var gitattributes = () => `* text=auto eol=lf
|
|
28964
29285
|
`;
|
|
28965
29286
|
var gitignore = () => `node_modules/
|
|
29287
|
+
# CI installs from package.json alone and deletes any lock it finds; a
|
|
29288
|
+
# committed one would only mislead whoever reads it.
|
|
29289
|
+
package-lock.json
|
|
28966
29290
|
dist/
|
|
28967
29291
|
out-tsc/
|
|
28968
29292
|
coverage/
|
|
@@ -29032,7 +29356,10 @@ function scaffoldFiles(appName, config, environment, extraDeps = {}, plugins = [
|
|
|
29032
29356
|
const className = wcClassName(appName);
|
|
29033
29357
|
const selector = wcSelector(appName);
|
|
29034
29358
|
return [
|
|
29035
|
-
{
|
|
29359
|
+
{
|
|
29360
|
+
path: "package.json",
|
|
29361
|
+
contents: packageJson(appName, config.version, extraDeps)
|
|
29362
|
+
},
|
|
29036
29363
|
{ path: "angular.json", contents: angularJson(app) },
|
|
29037
29364
|
{ path: "tsconfig.json", contents: tsconfigJson() },
|
|
29038
29365
|
{ path: "tsconfig.app.json", contents: tsconfigAppJson() },
|
|
@@ -29051,8 +29378,8 @@ function scaffoldFiles(appName, config, environment, extraDeps = {}, plugins = [
|
|
|
29051
29378
|
},
|
|
29052
29379
|
{ path: "webpack.config.ts", contents: webpackConfigTs(app) },
|
|
29053
29380
|
{ path: "README.md", contents: readme(app, config) },
|
|
29054
|
-
// Two files, two jobs: CI verifies
|
|
29055
|
-
//
|
|
29381
|
+
// Two files, two jobs: CI verifies a pull request into `main`, CD deploys
|
|
29382
|
+
// a version bump once that pull request merges, and nothing else (ADR 0087).
|
|
29056
29383
|
{ path: ".github/workflows/ci.yml", contents: ciWorkflow() },
|
|
29057
29384
|
{ path: ".github/workflows/cd.yml", contents: cdWorkflow(app) },
|
|
29058
29385
|
{ path: "src/index.html", contents: indexHtml(appName, config) },
|
|
@@ -29126,9 +29453,9 @@ var emittedTestPath = (path) => path.replace(/\.ts$/, ".spec.ts");
|
|
|
29126
29453
|
var isEmittedTestPath = (path) => path.endsWith(".spec.ts");
|
|
29127
29454
|
var isRuntimePath = (path) => path.endsWith(".ts") && !path.endsWith(".d.ts") && !isEmittedTestPath(path) && !path.includes("/type/") && !path.endsWith("/index.ts");
|
|
29128
29455
|
var siblingModule = (path) => `./${path.slice(path.lastIndexOf("/") + 1).replace(/\.ts$/, "")}`;
|
|
29129
|
-
var
|
|
29456
|
+
var quote4 = (value) => `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
|
|
29130
29457
|
var IDENTIFIER7 = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
29131
|
-
var key = (name3) => IDENTIFIER7.test(name3) ? name3 :
|
|
29458
|
+
var key = (name3) => IDENTIFIER7.test(name3) ? name3 : quote4(name3);
|
|
29132
29459
|
var FAKE_TEXT = "text";
|
|
29133
29460
|
var MAX_DEPTH2 = 3;
|
|
29134
29461
|
var fakeLiteral = (dataType, cardinality, shapes, depth = 0) => {
|
|
@@ -29149,15 +29476,15 @@ var fakeLiteral = (dataType, cardinality, shapes, depth = 0) => {
|
|
|
29149
29476
|
var fakeOne = (dataType, shapes, depth) => {
|
|
29150
29477
|
switch (dataType?.type) {
|
|
29151
29478
|
case "string":
|
|
29152
|
-
return
|
|
29479
|
+
return quote4(FAKE_TEXT);
|
|
29153
29480
|
case "number":
|
|
29154
29481
|
return "1";
|
|
29155
29482
|
case "boolean":
|
|
29156
29483
|
return "true";
|
|
29157
29484
|
case "option":
|
|
29158
|
-
return `{ value: ${
|
|
29485
|
+
return `{ value: ${quote4("option")}, label: ${quote4("option")} }`;
|
|
29159
29486
|
case "file":
|
|
29160
|
-
return `new File([${
|
|
29487
|
+
return `new File([${quote4("file")}], ${quote4("file.txt")})`;
|
|
29161
29488
|
case "shape": {
|
|
29162
29489
|
const shape = shapes[dataType.shapeId];
|
|
29163
29490
|
if (!shape || depth >= MAX_DEPTH2) return "{}";
|
|
@@ -29184,14 +29511,14 @@ var withShapes = (shapes, extra = []) => {
|
|
|
29184
29511
|
...shapes
|
|
29185
29512
|
} : shapes;
|
|
29186
29513
|
};
|
|
29187
|
-
var block = (title, body, isAsync = false) => ` it(${
|
|
29514
|
+
var block = (title, body, isAsync = false) => ` it(${quote4(title)}, ${isAsync ? "async " : ""}() => {
|
|
29188
29515
|
${body.map((line) => line ? ` ${line}` : "").join("\n")}
|
|
29189
29516
|
});`;
|
|
29190
29517
|
var describeFile = (imports, helpers, title, setup, tests) => `${imports.join("\n")}
|
|
29191
29518
|
${helpers.length ? `
|
|
29192
29519
|
${helpers.join("\n")}
|
|
29193
29520
|
` : ""}
|
|
29194
|
-
describe(${
|
|
29521
|
+
describe(${quote4(title)}, () => {
|
|
29195
29522
|
${setup.length ? `${setup.join("\n")}
|
|
29196
29523
|
|
|
29197
29524
|
` : ""}${tests.join("\n\n")}
|
|
@@ -29245,7 +29572,7 @@ var URL_HELPERS = [
|
|
|
29245
29572
|
" .replace(new RegExp(ANY_SEGMENT, 'g'), '[^/]+')}$`",
|
|
29246
29573
|
` );`
|
|
29247
29574
|
];
|
|
29248
|
-
var versionArg = (version3) => version3 ? `, ${
|
|
29575
|
+
var versionArg = (version3) => version3 ? `, ${quote4(version3)}` : "";
|
|
29249
29576
|
var apiServiceTest = (path, className, calls, shapes) => {
|
|
29250
29577
|
const tests = calls.map((call) => {
|
|
29251
29578
|
const lookup = withShapes(
|
|
@@ -29260,20 +29587,20 @@ var apiServiceTest = (path, className, calls, shapes) => {
|
|
|
29260
29587
|
);
|
|
29261
29588
|
const segments = call.segments.map((segment) => {
|
|
29262
29589
|
const template = /^\{(.+)\}$/.exec(segment);
|
|
29263
|
-
return template ? fakes.get(template[1]) ??
|
|
29590
|
+
return template ? fakes.get(template[1]) ?? quote4("text") : quote4(segment);
|
|
29264
29591
|
});
|
|
29265
29592
|
return block(
|
|
29266
29593
|
`${call.name} sends ${call.verb.toUpperCase()} to its operation and hands back the answer`,
|
|
29267
29594
|
[
|
|
29268
29595
|
`const body = { answered: true };`,
|
|
29269
29596
|
`let answered: unknown;`,
|
|
29270
|
-
`(service as unknown as Record<string, (...args: unknown[]) => Observable<unknown>>)[${
|
|
29597
|
+
`(service as unknown as Record<string, (...args: unknown[]) => Observable<unknown>>)[${quote4(
|
|
29271
29598
|
call.name
|
|
29272
29599
|
)}](${[...fakes.values()].join(", ")}).subscribe((value) => (answered = value));`,
|
|
29273
29600
|
`http`,
|
|
29274
|
-
` .expectOne((request) => request.method === ${
|
|
29601
|
+
` .expectOne((request) => request.method === ${quote4(
|
|
29275
29602
|
call.verb.toUpperCase()
|
|
29276
|
-
)} && request.url === urls.buildUrl(${
|
|
29603
|
+
)} && request.url === urls.buildUrl(${quote4(call.domain)}, [${segments.join(
|
|
29277
29604
|
", "
|
|
29278
29605
|
)}]${versionArg(call.version)}))`,
|
|
29279
29606
|
` .flush(body);`,
|
|
@@ -29337,7 +29664,7 @@ var STATUS_TEXT = {
|
|
|
29337
29664
|
var storeMethodTests = (call, shapes) => {
|
|
29338
29665
|
const spies = armSpies(call);
|
|
29339
29666
|
const args = argObject(call.args, spies, shapes);
|
|
29340
|
-
const invoke = `call(store, ${
|
|
29667
|
+
const invoke = `call(store, ${quote4(call.name)}${args ? `, ${args}` : ""});`;
|
|
29341
29668
|
const send = [
|
|
29342
29669
|
invoke,
|
|
29343
29670
|
...call.debounce !== void 0 ? [`vi.advanceTimersByTime(${call.debounce});`] : []
|
|
@@ -29358,8 +29685,8 @@ var storeMethodTests = (call, shapes) => {
|
|
|
29358
29685
|
];
|
|
29359
29686
|
}
|
|
29360
29687
|
const verb = call.verb.toUpperCase();
|
|
29361
|
-
const url = `const url = urlPattern(urls, ${
|
|
29362
|
-
const match = `(request) => request.method === ${
|
|
29688
|
+
const url = `const url = urlPattern(urls, ${quote4(call.domain)}, [${call.segments.map(quote4).join(", ")}]${versionArg(call.version)});`;
|
|
29689
|
+
const match = `(request) => request.method === ${quote4(verb)} && url.test(request.url)`;
|
|
29363
29690
|
const empty = call.ok.code === "204" || !call.ok.dataType;
|
|
29364
29691
|
const body = empty ? "null" : fakeLiteral(
|
|
29365
29692
|
call.ok.dataType,
|
|
@@ -29376,11 +29703,11 @@ var storeMethodTests = (call, shapes) => {
|
|
|
29376
29703
|
...send,
|
|
29377
29704
|
`http.expectOne(${match}).flush(body as never, { status: ${Number(
|
|
29378
29705
|
call.ok.code
|
|
29379
|
-
)}, statusText: ${
|
|
29706
|
+
)}, statusText: ${quote4(STATUS_TEXT[call.ok.code] ?? "OK")} });`,
|
|
29380
29707
|
// What the store patched: the body, or the member of it the landing
|
|
29381
29708
|
// reads — `total` of a page lands a number, not the page.
|
|
29382
29709
|
...call.lands.map(
|
|
29383
|
-
({ name: name3, source }) => `expect(read(store, ${
|
|
29710
|
+
({ name: name3, source }) => `expect(read(store, ${quote4(name3)})).toEqual(${source.length ? `at(body, [${source.map(quote4).join(", ")}])` : "body"});`
|
|
29384
29711
|
),
|
|
29385
29712
|
...call.arms.success ? ["expect(onSuccess).toHaveBeenCalled();"] : [],
|
|
29386
29713
|
...call.arms.settle ? [
|
|
@@ -29419,11 +29746,11 @@ var storeMethodTests = (call, shapes) => {
|
|
|
29419
29746
|
...answer(true),
|
|
29420
29747
|
url,
|
|
29421
29748
|
`const body: unknown = ${body};`,
|
|
29422
|
-
`for (const path of [${call.guards.map((path) => `[${path.map(
|
|
29749
|
+
`for (const path of [${call.guards.map((path) => `[${path.map(quote4).join(", ")}]`).join(", ")}]) {`,
|
|
29423
29750
|
...send.map((line) => ` ${line}`),
|
|
29424
29751
|
` http.expectOne(${match}).flush(drop(body, path) as never, { status: ${Number(
|
|
29425
29752
|
call.ok.code
|
|
29426
|
-
)}, statusText: ${
|
|
29753
|
+
)}, statusText: ${quote4(STATUS_TEXT[call.ok.code] ?? "OK")} });`,
|
|
29427
29754
|
"}",
|
|
29428
29755
|
...call.arms.success ? [
|
|
29429
29756
|
`expect(onSuccess).toHaveBeenCalledTimes(${call.guards.length});`
|
|
@@ -29433,12 +29760,12 @@ var storeMethodTests = (call, shapes) => {
|
|
|
29433
29760
|
] : [];
|
|
29434
29761
|
return [success, failure, ...declined, ...partial];
|
|
29435
29762
|
};
|
|
29436
|
-
var patchLine = (holder, entries) => `${holder ? `on(store, ${
|
|
29763
|
+
var patchLine = (holder, entries) => `${holder ? `on(store, ${quote4(holder)})` : "store"}.patch({ ${entries.join(
|
|
29437
29764
|
", "
|
|
29438
29765
|
)} } as never);`;
|
|
29439
29766
|
var cacheMethodTests = (cache, shapes) => {
|
|
29440
29767
|
const args = argObject(cache.args, [], shapes);
|
|
29441
|
-
const invoke = `ask(store, ${
|
|
29768
|
+
const invoke = `ask(store, ${quote4(cache.name)}${args ? `, ${args}` : ""})`;
|
|
29442
29769
|
const { property } = cache;
|
|
29443
29770
|
const keyArg = cache.args.find((arg) => arg.name === cache.key);
|
|
29444
29771
|
const one = fakeLiteral(property.dataType, "one", shapes);
|
|
@@ -29511,13 +29838,13 @@ var storeTest = (path, facts, shapes) => {
|
|
|
29511
29838
|
shapes
|
|
29512
29839
|
)};`,
|
|
29513
29840
|
`store.patch({ ${key(property.name)}: ${property.name}Value } as never);`,
|
|
29514
|
-
`expect(read(store, ${
|
|
29841
|
+
`expect(read(store, ${quote4(property.name)})).toEqual(${property.name}Value);`
|
|
29515
29842
|
])
|
|
29516
29843
|
)
|
|
29517
29844
|
] : [],
|
|
29518
29845
|
...facts.computeds.length ? [
|
|
29519
29846
|
block("reads every computed without throwing", [
|
|
29520
|
-
`for (const name of [${facts.computeds.map(
|
|
29847
|
+
`for (const name of [${facts.computeds.map(quote4).join(", ")}]) {`,
|
|
29521
29848
|
" expect(() => read(store, name)).not.toThrow();",
|
|
29522
29849
|
"}"
|
|
29523
29850
|
])
|
|
@@ -29527,7 +29854,7 @@ var storeTest = (path, facts, shapes) => {
|
|
|
29527
29854
|
...facts.computeds.length && filled.length ? [
|
|
29528
29855
|
block("reads every computed over filled state without throwing", [
|
|
29529
29856
|
...filled,
|
|
29530
|
-
`for (const name of [${facts.computeds.map(
|
|
29857
|
+
`for (const name of [${facts.computeds.map(quote4).join(", ")}]) {`,
|
|
29531
29858
|
" expect(() => read(store, name)).not.toThrow();",
|
|
29532
29859
|
"}"
|
|
29533
29860
|
])
|
|
@@ -29642,13 +29969,13 @@ var emptyLiteral = (dataType, cardinality) => {
|
|
|
29642
29969
|
if (cardinality !== "one") return "{}";
|
|
29643
29970
|
switch (dataType?.type) {
|
|
29644
29971
|
case "string":
|
|
29645
|
-
return
|
|
29972
|
+
return quote4("");
|
|
29646
29973
|
case "number":
|
|
29647
29974
|
return "0";
|
|
29648
29975
|
case "boolean":
|
|
29649
29976
|
return "false";
|
|
29650
29977
|
case "file":
|
|
29651
|
-
return `new File([], ${
|
|
29978
|
+
return `new File([], ${quote4("")})`;
|
|
29652
29979
|
case "option":
|
|
29653
29980
|
case "shape":
|
|
29654
29981
|
case "form":
|
|
@@ -29663,17 +29990,17 @@ var menuCheckFake = (check) => {
|
|
|
29663
29990
|
const numeric = raw !== "" && Number.isFinite(Number(raw));
|
|
29664
29991
|
switch (check.operator) {
|
|
29665
29992
|
case "exists":
|
|
29666
|
-
return
|
|
29993
|
+
return quote4(FAKE_TEXT);
|
|
29667
29994
|
case "not_exists":
|
|
29668
29995
|
return void 0;
|
|
29669
29996
|
case "contains":
|
|
29670
|
-
return
|
|
29997
|
+
return quote4(raw);
|
|
29671
29998
|
case "not_contains":
|
|
29672
|
-
return
|
|
29999
|
+
return quote4("");
|
|
29673
30000
|
case "==":
|
|
29674
|
-
return numeric ? String(Number(raw)) :
|
|
30001
|
+
return numeric ? String(Number(raw)) : quote4(raw);
|
|
29675
30002
|
case "!=":
|
|
29676
|
-
return
|
|
30003
|
+
return quote4(`${raw}-other`);
|
|
29677
30004
|
case ">":
|
|
29678
30005
|
return String(Number(raw) + 1);
|
|
29679
30006
|
case "<":
|
|
@@ -29684,8 +30011,8 @@ var menuCheckFake = (check) => {
|
|
|
29684
30011
|
};
|
|
29685
30012
|
var menuEventFake = (checks) => {
|
|
29686
30013
|
const event = /* @__PURE__ */ new Map([
|
|
29687
|
-
["id",
|
|
29688
|
-
["label",
|
|
30014
|
+
["id", quote4(FAKE_TEXT)],
|
|
30015
|
+
["label", quote4(FAKE_TEXT)]
|
|
29689
30016
|
]);
|
|
29690
30017
|
for (const check of checks) {
|
|
29691
30018
|
const value = menuCheckFake(check);
|
|
@@ -29696,7 +30023,7 @@ var menuEventFake = (checks) => {
|
|
|
29696
30023
|
};
|
|
29697
30024
|
var menuActionLines = (menus) => menus.flatMap(
|
|
29698
30025
|
({ action }) => action ? action.gates.map(
|
|
29699
|
-
(checks) => ` expect(() => call(${
|
|
30026
|
+
(checks) => ` expect(() => call(${quote4(action.name)}, ${[
|
|
29700
30027
|
menuEventFake(checks),
|
|
29701
30028
|
...Array(action.formRefs).fill("form")
|
|
29702
30029
|
].join(", ")})).not.toThrow();`
|
|
@@ -29705,9 +30032,9 @@ var menuActionLines = (menus) => menus.flatMap(
|
|
|
29705
30032
|
var menuConditionLines = (menus) => menus.flatMap(
|
|
29706
30033
|
({ conditions }) => conditions.flatMap(({ name: name3, kind, keys }) => [
|
|
29707
30034
|
...keys.map(
|
|
29708
|
-
(one) => `expect(typeof instance[${
|
|
30035
|
+
(one) => `expect(typeof instance[${quote4(name3)}](${quote4(one)})).toBe('boolean');`
|
|
29709
30036
|
),
|
|
29710
|
-
`expect(instance[${
|
|
30037
|
+
`expect(instance[${quote4(name3)}]('')).toBe(${kind === "hidden"});`
|
|
29711
30038
|
])
|
|
29712
30039
|
);
|
|
29713
30040
|
var handlerArgs = (handler, shapes) => [
|
|
@@ -29743,11 +30070,11 @@ var screenTest = (path, facts, shapes) => {
|
|
|
29743
30070
|
handlerArgs(handler, shapes),
|
|
29744
30071
|
// A SectionAction's `clicked` again per folded Button, as that press.
|
|
29745
30072
|
...(handler.pressed ?? []).map((name3) => [
|
|
29746
|
-
`{ name: ${
|
|
30073
|
+
`{ name: ${quote4(name3)} }`,
|
|
29747
30074
|
...Array(handler.formRefs).fill("form")
|
|
29748
30075
|
])
|
|
29749
30076
|
].map(
|
|
29750
|
-
(args) => ` expect(() => call(${[
|
|
30077
|
+
(args) => ` expect(() => call(${[quote4(handler.name), ...args].join(
|
|
29751
30078
|
", "
|
|
29752
30079
|
)})).not.toThrow();`
|
|
29753
30080
|
)
|
|
@@ -29814,7 +30141,7 @@ var screenTest = (path, facts, shapes) => {
|
|
|
29814
30141
|
` const create = () => {`,
|
|
29815
30142
|
` const fixture = TestBed.createComponent(${className});`,
|
|
29816
30143
|
...facts.inputs.map(
|
|
29817
|
-
(input) => ` fixture.componentRef.setInput(${
|
|
30144
|
+
(input) => ` fixture.componentRef.setInput(${quote4(input.name)}, ${inputFake(
|
|
29818
30145
|
input,
|
|
29819
30146
|
shapes
|
|
29820
30147
|
)});`
|
|
@@ -29829,7 +30156,7 @@ var screenTest = (path, facts, shapes) => {
|
|
|
29829
30156
|
` const createEmpty = () => {`,
|
|
29830
30157
|
` const fixture = TestBed.createComponent(${className});`,
|
|
29831
30158
|
...requiredInputs.map(
|
|
29832
|
-
(input) => ` fixture.componentRef.setInput(${
|
|
30159
|
+
(input) => ` fixture.componentRef.setInput(${quote4(input.name)}, ${inputEmpty(input)});`
|
|
29833
30160
|
),
|
|
29834
30161
|
` fixture.detectChanges();`,
|
|
29835
30162
|
` return fixture;`,
|
|
@@ -29954,7 +30281,7 @@ var screenTest = (path, facts, shapes) => {
|
|
|
29954
30281
|
"const fixture = create();",
|
|
29955
30282
|
"const instance = fixture.componentInstance as unknown as Record<string, { set: (value: unknown) => void }>;",
|
|
29956
30283
|
...variables.map(
|
|
29957
|
-
(variable) => `instance[${
|
|
30284
|
+
(variable) => `instance[${quote4(variable.name)}].set(${fakeLiteral(
|
|
29958
30285
|
variable.dataType,
|
|
29959
30286
|
variable.cardinality,
|
|
29960
30287
|
shapes
|
|
@@ -29992,11 +30319,11 @@ var screenTest = (path, facts, shapes) => {
|
|
|
29992
30319
|
)
|
|
29993
30320
|
};
|
|
29994
30321
|
const compiled = `
|
|
29995
|
-
describe(${
|
|
30322
|
+
describe(${quote4(`${className} compiled template`)}, () => {
|
|
29996
30323
|
${block("renders before anything it reads has loaded", [
|
|
29997
30324
|
`const fixture = TestBed.createComponent(${className});`,
|
|
29998
30325
|
...requiredInputs.map(
|
|
29999
|
-
(input) => `fixture.componentRef.setInput(${
|
|
30326
|
+
(input) => `fixture.componentRef.setInput(${quote4(input.name)}, ${inputEmpty(input)});`
|
|
30000
30327
|
),
|
|
30001
30328
|
"expect(() => fixture.detectChanges()).not.toThrow();"
|
|
30002
30329
|
])}
|
|
@@ -30004,7 +30331,7 @@ ${block("renders before anything it reads has loaded", [
|
|
|
30004
30331
|
`;
|
|
30005
30332
|
const plugins = facts.plugins ?? [];
|
|
30006
30333
|
const pluginBlock = plugins.length ? `
|
|
30007
|
-
describe(${
|
|
30334
|
+
describe(${quote4(`${className} plugins`)}, () => {
|
|
30008
30335
|
// Every PluginControl this Screen places: its app, its Exposed Screen, the
|
|
30009
30336
|
// inputs it binds and the outputs it hears (CONTEXT.md PluginControl).
|
|
30010
30337
|
const PLUGINS = ${JSON.stringify(plugins)};
|
|
@@ -30026,7 +30353,7 @@ ${block(
|
|
|
30026
30353
|
"});",
|
|
30027
30354
|
`const fixture = TestBed.createComponent(${className});`,
|
|
30028
30355
|
...requiredInputs.map(
|
|
30029
|
-
(input) => `fixture.componentRef.setInput(${
|
|
30356
|
+
(input) => `fixture.componentRef.setInput(${quote4(input.name)}, ${inputEmpty(input)});`
|
|
30030
30357
|
),
|
|
30031
30358
|
"fixture.detectChanges();",
|
|
30032
30359
|
// Not `whenStable`: whatever else the Screen asked for stays pending in
|
|
@@ -30070,7 +30397,7 @@ var blankLiteral = (dataType, cardinality) => {
|
|
|
30070
30397
|
if (cardinality === "many") return "[]";
|
|
30071
30398
|
switch (dataType?.type) {
|
|
30072
30399
|
case "string":
|
|
30073
|
-
return
|
|
30400
|
+
return quote4("");
|
|
30074
30401
|
case "number":
|
|
30075
30402
|
return "0";
|
|
30076
30403
|
case "boolean":
|
|
@@ -30088,7 +30415,7 @@ var validationTest = (path, emission, shapes = {}) => {
|
|
|
30088
30415
|
const readAll = (model) => runs.map(
|
|
30089
30416
|
(holds) => `expect(Object.keys(errorsOf(${[model, holds].filter(Boolean).join(", ")}))).toEqual(Object.keys(${model}));`
|
|
30090
30417
|
);
|
|
30091
|
-
const errorOf = (check) => `expect.objectContaining({ kind: ${
|
|
30418
|
+
const errorOf = (check) => `expect.objectContaining({ kind: ${quote4(check.kind)}, message: ${quote4(check.message)} })`;
|
|
30092
30419
|
return {
|
|
30093
30420
|
path: emittedTestPath(path),
|
|
30094
30421
|
contents: describeFile(
|
|
@@ -30129,7 +30456,7 @@ var validationTest = (path, emission, shapes = {}) => {
|
|
|
30129
30456
|
...readAll("EMPTY"),
|
|
30130
30457
|
...stateChecks.flatMap(
|
|
30131
30458
|
(check) => runs.map(
|
|
30132
|
-
(holds) => `expect(errorsOf(EMPTY, ${holds})[${
|
|
30459
|
+
(holds) => `expect(errorsOf(EMPTY, ${holds})[${quote4(check.fieldName)}]).not.toContainEqual(${errorOf(check)});`
|
|
30133
30460
|
)
|
|
30134
30461
|
)
|
|
30135
30462
|
]),
|
|
@@ -30143,7 +30470,7 @@ var validationTest = (path, emission, shapes = {}) => {
|
|
|
30143
30470
|
`const holding = errorsOf(FILLED, true);`,
|
|
30144
30471
|
`const lapsed = errorsOf(FILLED, false);`,
|
|
30145
30472
|
...stateChecks.flatMap((check) => {
|
|
30146
|
-
const field =
|
|
30473
|
+
const field = quote4(check.fieldName);
|
|
30147
30474
|
const [flagged, clear] = check.kind === "stateTrue" ? ["holding", "lapsed"] : ["lapsed", "holding"];
|
|
30148
30475
|
return [
|
|
30149
30476
|
`expect(${flagged}[${field}]).toContainEqual(${errorOf(check)});`,
|
|
@@ -30661,12 +30988,7 @@ var emitFullAppFiles = (authored, stringify) => {
|
|
|
30661
30988
|
ws.appTarget.appName,
|
|
30662
30989
|
ws.wcConfig,
|
|
30663
30990
|
ws.appTarget.environment,
|
|
30664
|
-
|
|
30665
|
-
Object.values(ws.npmAllowlist ?? {}).map((entry2) => [
|
|
30666
|
-
entry2.name,
|
|
30667
|
-
entry2.version
|
|
30668
|
-
])
|
|
30669
|
-
),
|
|
30991
|
+
allowlistDeps(ws),
|
|
30670
30992
|
pluginContractsOf(ws)
|
|
30671
30993
|
);
|
|
30672
30994
|
const files3 = scaffold.map((file) => ({
|
|
@@ -30691,6 +31013,27 @@ var emitFullAppFiles = (authored, stringify) => {
|
|
|
30691
31013
|
files3.push(...emitAuthoredAssets(ws, stringify));
|
|
30692
31014
|
return withGeneratedBanner(withEmittedTests(files3, isGeneratedPath));
|
|
30693
31015
|
};
|
|
31016
|
+
var allowlistDeps = (ws) => Object.fromEntries(
|
|
31017
|
+
Object.values(ws.npmAllowlist ?? {}).map((entry2) => [
|
|
31018
|
+
entry2.name,
|
|
31019
|
+
entry2.version
|
|
31020
|
+
])
|
|
31021
|
+
);
|
|
31022
|
+
var SHIPPED_SHELL_PATHS = [
|
|
31023
|
+
"package.json",
|
|
31024
|
+
".github/workflows/ci.yml",
|
|
31025
|
+
".github/workflows/cd.yml"
|
|
31026
|
+
];
|
|
31027
|
+
var emitShippedShellFiles = (authored) => {
|
|
31028
|
+
const ws = inReach(authored);
|
|
31029
|
+
return scaffoldFiles(
|
|
31030
|
+
ws.appTarget.appName,
|
|
31031
|
+
ws.wcConfig,
|
|
31032
|
+
ws.appTarget.environment,
|
|
31033
|
+
allowlistDeps(ws),
|
|
31034
|
+
pluginContractsOf(ws)
|
|
31035
|
+
).filter((file) => SHIPPED_SHELL_PATHS.includes(file.path)).map((file) => ({ path: file.path, contents: file.contents }));
|
|
31036
|
+
};
|
|
30694
31037
|
var remoteManifestFiles = (ws) => scaffoldFiles(
|
|
30695
31038
|
ws.appTarget.appName,
|
|
30696
31039
|
ws.wcConfig,
|
|
@@ -31062,6 +31405,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
31062
31405
|
SHARED_LIB_ROOT,
|
|
31063
31406
|
SHARED_SHAPES,
|
|
31064
31407
|
SHARED_SHAPE_ID_PREFIX,
|
|
31408
|
+
SHIPPED_SHELL_PATHS,
|
|
31065
31409
|
SOURCE_LANG,
|
|
31066
31410
|
STAT_TEXT_SOURCES,
|
|
31067
31411
|
STORAGE_SERVICE,
|
|
@@ -31166,6 +31510,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
31166
31510
|
buildScreenWriteValue,
|
|
31167
31511
|
buildStateWriteValue,
|
|
31168
31512
|
buildTree,
|
|
31513
|
+
bumpVersion,
|
|
31169
31514
|
busyVariant,
|
|
31170
31515
|
byRouteSpecificity,
|
|
31171
31516
|
cacheMethodArgs,
|
|
@@ -31306,6 +31651,8 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
31306
31651
|
createConfirm,
|
|
31307
31652
|
createGroup,
|
|
31308
31653
|
createOpen,
|
|
31654
|
+
createOutputNav,
|
|
31655
|
+
createOutputNewTab,
|
|
31309
31656
|
createOutputOpen,
|
|
31310
31657
|
createPlatformNavMap,
|
|
31311
31658
|
createRule,
|
|
@@ -31372,6 +31719,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
31372
31719
|
emitFullAppFiles,
|
|
31373
31720
|
emitGeneratedFiles,
|
|
31374
31721
|
emitOverlayFiles,
|
|
31722
|
+
emitShippedShellFiles,
|
|
31375
31723
|
emitTransformExpr,
|
|
31376
31724
|
emittedFormIds,
|
|
31377
31725
|
emittedOperation,
|
|
@@ -31648,6 +31996,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
31648
31996
|
isPureFunctionComplete,
|
|
31649
31997
|
isRedirectRoute,
|
|
31650
31998
|
isReferencedByRule,
|
|
31999
|
+
isReleaseVersion,
|
|
31651
32000
|
isRepeatFamily,
|
|
31652
32001
|
isReservedFeatureName,
|
|
31653
32002
|
isReservedVariantId,
|
|
@@ -31919,6 +32268,15 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
31919
32268
|
outputCallKey,
|
|
31920
32269
|
outputCallKeys,
|
|
31921
32270
|
outputCallLabel,
|
|
32271
|
+
outputLinkBindingTargets,
|
|
32272
|
+
outputLinkMemberName,
|
|
32273
|
+
outputLinkParamType,
|
|
32274
|
+
outputNavOf,
|
|
32275
|
+
outputNavStatement,
|
|
32276
|
+
outputNewTabFunctionId,
|
|
32277
|
+
outputNewTabFunctions,
|
|
32278
|
+
outputNewTabOf,
|
|
32279
|
+
outputNewTabStatements,
|
|
31922
32280
|
outputOpenConstTargets,
|
|
31923
32281
|
outputOpenFixedAllowed,
|
|
31924
32282
|
outputOpenHostInputIds,
|
|
@@ -31991,6 +32349,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
31991
32349
|
pruneMappings,
|
|
31992
32350
|
pruneMenuActions,
|
|
31993
32351
|
pruneOutputCalls,
|
|
32352
|
+
pruneOutputLinkArgs,
|
|
31994
32353
|
pruneUnknownShapeRefs,
|
|
31995
32354
|
pruneUnknownVariants,
|
|
31996
32355
|
prunedInstanceSource,
|
|
@@ -32325,6 +32684,8 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
32325
32684
|
validateMethodName,
|
|
32326
32685
|
validateNavSlug,
|
|
32327
32686
|
validateOutcomeNav,
|
|
32687
|
+
validateOutputNav,
|
|
32688
|
+
validateOutputNewTab,
|
|
32328
32689
|
validateOutputOpen,
|
|
32329
32690
|
validatePatternName,
|
|
32330
32691
|
validateScreenEmits,
|