@magmonium/cli 0.8.24 → 0.8.26

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.
Files changed (2) hide show
  1. package/codegen/index.js +1405 -621
  2. package/package.json +1 -1
package/codegen/index.js CHANGED
@@ -243,6 +243,7 @@ __export(index_exports, {
243
243
  OUTPUT_ARM_SEPARATOR: () => OUTPUT_ARM_SEPARATOR,
244
244
  OUTPUT_ARM_SOURCES: () => OUTPUT_ARM_SOURCES,
245
245
  OUTPUT_CALL_SEPARATOR: () => OUTPUT_CALL_SEPARATOR,
246
+ OUTPUT_GROUP_MAPS: () => OUTPUT_GROUP_MAPS,
246
247
  OUTPUT_PAYLOADS: () => OUTPUT_PAYLOADS,
247
248
  PAGES_ROOT: () => PAGES_ROOT,
248
249
  PAGE_FILING: () => PAGE_FILING,
@@ -413,6 +414,8 @@ __export(index_exports, {
413
414
  bindingPathText: () => bindingPathText,
414
415
  bindingShapeId: () => bindingShapeId,
415
416
  bindingsNeedTranslate: () => bindingsNeedTranslate,
417
+ boundSlotMismatch: () => boundSlotMismatch,
418
+ boundSlotType: () => boundSlotType,
416
419
  buildDesignSource: () => buildDesignSource,
417
420
  buildFormShape: () => buildFormShape,
418
421
  buildOutputOpenValue: () => buildOutputOpenValue,
@@ -484,6 +487,7 @@ __export(index_exports, {
484
487
  caseLiteral: () => caseLiteral,
485
488
  caseLiteralValue: () => caseLiteralValue,
486
489
  casesFromJson: () => casesFromJson,
490
+ castTransform: () => castTransform,
487
491
  chainCall: () => chainCall,
488
492
  chainInputType: () => chainInputType,
489
493
  chainReturnType: () => chainReturnType,
@@ -498,6 +502,7 @@ __export(index_exports, {
498
502
  childNavId: () => childNavId,
499
503
  classCardScope: () => classCardScope,
500
504
  clearOutputCallRows: () => clearOutputCallRows,
505
+ clearOutputGroupRows: () => clearOutputGroupRows,
501
506
  coerceImgSrcOrigin: () => coerceImgSrcOrigin,
502
507
  collectCardEmits: () => collectCardEmits,
503
508
  collectComputedOptionSets: () => collectComputedOptionSets,
@@ -651,6 +656,7 @@ __export(index_exports, {
651
656
  emitOverlayFiles: () => emitOverlayFiles,
652
657
  emitShippedShellFiles: () => emitShippedShellFiles,
653
658
  emitTransformExpr: () => emitTransformExpr,
659
+ emittedDataType: () => emittedDataType,
654
660
  emittedFormIds: () => emittedFormIds,
655
661
  emittedOperation: () => emittedOperation,
656
662
  emittedResponse: () => emittedResponse,
@@ -693,6 +699,7 @@ __export(index_exports, {
693
699
  featureStoreFile: () => featureStoreFile,
694
700
  featureStoreProp: () => featureStoreProp,
695
701
  featureStorePropName: () => featureStorePropName,
702
+ featuresAsRead: () => featuresAsRead,
696
703
  featuresInReach: () => featuresInReach,
697
704
  fieldCanBeAbsent: () => fieldCanBeAbsent,
698
705
  fieldCheckArgParams: () => fieldCheckArgParams,
@@ -729,6 +736,7 @@ __export(index_exports, {
729
736
  fixedItems: () => fixedItems,
730
737
  fnv64: () => fnv64,
731
738
  foldedButtonName: () => foldedButtonName,
739
+ foldedButtonNames: () => foldedButtonNames,
732
740
  foldedButtons: () => foldedButtons,
733
741
  foldedRouterLink: () => foldedRouterLink,
734
742
  formEventMembers: () => formEventMembers,
@@ -910,6 +918,7 @@ __export(index_exports, {
910
918
  isKeyedRepeat: () => isKeyedRepeat,
911
919
  isKnownVariantId: () => isKnownVariantId,
912
920
  isLegalNavTail: () => isLegalNavTail,
921
+ isLimitDrawn: () => isLimitDrawn,
913
922
  isLinkedFormModel: () => isLinkedFormModel,
914
923
  isLinkedKeySource: () => isLinkedKeySource,
915
924
  isLinkedVariable: () => isLinkedVariable,
@@ -987,6 +996,7 @@ __export(index_exports, {
987
996
  isUnaryOutputArmOperator: () => isUnaryOutputArmOperator,
988
997
  isUsableTranslation: () => isUsableTranslation,
989
998
  isValidAssetPath: () => isValidAssetPath,
999
+ isValidControlGroupCategory: () => isValidControlGroupCategory,
990
1000
  isValidControlGroupName: () => isValidControlGroupName,
991
1001
  isValidFormName: () => isValidFormName,
992
1002
  isValidFunctionName: () => isValidFunctionName,
@@ -1010,10 +1020,12 @@ __export(index_exports, {
1010
1020
  isVariantJoin: () => isVariantJoin,
1011
1021
  isVariantKind: () => isVariantKind,
1012
1022
  jsNativesInGroup: () => jsNativesInGroup,
1023
+ keptNodeId: () => keptNodeId,
1013
1024
  keyCandidates: () => keyCandidates,
1014
1025
  keyIdKeeper: () => keyIdKeeper,
1015
1026
  labelChainOf: () => labelChainOf,
1016
1027
  labelEmission: () => labelEmission,
1028
+ labelHeadType: () => labelHeadType,
1017
1029
  labelReadIsTranslated: () => labelReadIsTranslated,
1018
1030
  landingNavId: () => landingNavId,
1019
1031
  landsOn: () => landsOn,
@@ -1023,6 +1035,9 @@ __export(index_exports, {
1023
1035
  liftToList: () => liftToList,
1024
1036
  liftToListInTemplate: () => liftToListInTemplate,
1025
1037
  liftsToList: () => liftsToList,
1038
+ limitSourceFor: () => limitSourceFor,
1039
+ limitSourceOf: () => limitSourceOf,
1040
+ limitSources: () => limitSources,
1026
1041
  linkDrift: () => linkDrift,
1027
1042
  linkTargetKind: () => linkTargetKind,
1028
1043
  linkedVariableReaders: () => linkedVariableReaders,
@@ -1304,6 +1319,7 @@ __export(index_exports, {
1304
1319
  pathChipDisplay: () => pathChipDisplay,
1305
1320
  pathCrossesCollection: () => pathCrossesCollection,
1306
1321
  pathDisplay: () => pathDisplay,
1322
+ pathLeafEnumId: () => pathLeafEnumId,
1307
1323
  pathLeafType: () => pathLeafType,
1308
1324
  pathsFor: () => pathsFor,
1309
1325
  payloadEventRoot: () => payloadEventRoot,
@@ -1446,6 +1462,7 @@ __export(index_exports, {
1446
1462
  ruleReferencedIds: () => ruleReferencedIds,
1447
1463
  ruleRootProperties: () => ruleRootProperties,
1448
1464
  sameCallTarget: () => sameCallTarget,
1465
+ sameFeaturesAsRead: () => sameFeaturesAsRead,
1449
1466
  sameOrigin: () => sameOrigin,
1450
1467
  sameOwner: () => sameOwner,
1451
1468
  sampleRows: () => sampleRows,
@@ -1591,6 +1608,7 @@ __export(index_exports, {
1591
1608
  slugifyMessage: () => slugifyMessage,
1592
1609
  sortRowEnumId: () => sortRowEnumId,
1593
1610
  sourceCarriesTrackKey: () => sourceCarriesTrackKey,
1611
+ stableId: () => stableId,
1594
1612
  staleCases: () => staleCases,
1595
1613
  staleMenuActionItems: () => staleMenuActionItems,
1596
1614
  stampStatePropertyEnums: () => stampStatePropertyEnums,
@@ -1757,14 +1775,20 @@ __export(index_exports, {
1757
1775
  withCases: () => withCases,
1758
1776
  withDefaultRow: () => withDefaultRow,
1759
1777
  withEmittedTests: () => withEmittedTests,
1778
+ withEventTransform: () => withEventTransform,
1760
1779
  withFormShapes: () => withFormShapes,
1761
1780
  withListRowShape: () => withListRowShape,
1781
+ withPropertyEnums: () => withPropertyEnums,
1762
1782
  withScreenEnums: () => withScreenEnums,
1763
1783
  withScreenMethodCallSites: () => withScreenMethodCallSites,
1764
1784
  withVariableEnums: () => withVariableEnums,
1765
1785
  wouldComputedCycle: () => wouldComputedCycle,
1766
1786
  wouldCycle: () => wouldCycle,
1767
1787
  wouldScreenComputedCycle: () => wouldScreenComputedCycle,
1788
+ writeEventIssue: () => writeEventIssue,
1789
+ writeEventMismatch: () => writeEventMismatch,
1790
+ writeEventReadType: () => writeEventReadType,
1791
+ writeEventTransforms: () => writeEventTransforms,
1768
1792
  writeFileAt: () => writeFileAt,
1769
1793
  writeIdIn: () => writeIdIn,
1770
1794
  writeIdOf: () => writeIdOf,
@@ -1812,9 +1836,9 @@ var ControlType = /* @__PURE__ */ ((ControlType2) => {
1812
1836
  ControlType2["HEAT_SWATCH"] = "heat_swatch";
1813
1837
  ControlType2["SCORE_SET"] = "score_set";
1814
1838
  ControlType2["SCORE_SET_ITEM"] = "score_set_item";
1815
- ControlType2["PRICE_LADDER"] = "price_ladder";
1816
- ControlType2["PRICE_LADDER_MARK"] = "price_ladder_mark";
1817
- ControlType2["PRICE_LADDER_SIGNAL"] = "price_ladder_signal";
1839
+ ControlType2["SCALE"] = "scale";
1840
+ ControlType2["SCALE_MARK"] = "scale_mark";
1841
+ ControlType2["SCALE_RELATION"] = "scale_relation";
1818
1842
  ControlType2["FORM"] = "form";
1819
1843
  ControlType2["FIELD"] = "field";
1820
1844
  ControlType2["SECTION_BUTTON_GROUP"] = "section_button_group";
@@ -2004,6 +2028,17 @@ var actionRenderIds = (node) => {
2004
2028
  const entries = actionButtonEntries(node);
2005
2029
  return entries.length ? Object.fromEntries(entries.map(([name3, button]) => [name3, button.id])) : void 0;
2006
2030
  };
2031
+ var foldedButtonNames = (tree) => {
2032
+ const names = /* @__PURE__ */ new Map();
2033
+ const walk = (nodes) => nodes.forEach((node) => {
2034
+ actionButtonEntries(node).forEach(
2035
+ ([name3, button]) => names.set(button.id, name3)
2036
+ );
2037
+ walk(node.childrens);
2038
+ });
2039
+ walk(tree);
2040
+ return names;
2041
+ };
2007
2042
  var actionButtonEntries = (node) => {
2008
2043
  const counts = /* @__PURE__ */ new Map();
2009
2044
  const taken = /* @__PURE__ */ new Set();
@@ -2288,6 +2323,24 @@ function genId() {
2288
2323
  return v.toString(16);
2289
2324
  });
2290
2325
  }
2326
+ function stableId(seed) {
2327
+ const lane = (offset) => {
2328
+ let hash = offset;
2329
+ for (let i = 0; i < seed.length; i++) {
2330
+ hash ^= seed.charCodeAt(i);
2331
+ hash = Math.imul(hash, 16777619) >>> 0;
2332
+ }
2333
+ return hash.toString(16).padStart(8, "0");
2334
+ };
2335
+ const hex = [2166136261, 16777619, 84696351, 1802464869].map(lane).join("");
2336
+ return [
2337
+ hex.slice(0, 8),
2338
+ hex.slice(8, 12),
2339
+ `5${hex.slice(13, 16)}`,
2340
+ `${(parseInt(hex[16], 16) & 3 | 8).toString(16)}${hex.slice(17, 20)}`,
2341
+ hex.slice(20, 32)
2342
+ ].join("-");
2343
+ }
2291
2344
 
2292
2345
  // libs/codegen/src/lib/state-shape-helper.ts
2293
2346
  function normalizeShapeName(raw) {
@@ -2693,7 +2746,7 @@ var formFileBase = (formName) => `${formName.replace(/_/g, "-")}-form`;
2693
2746
  function tsTypeExpression(shapes, dataType, cardinality, actionEnumName = () => void 0) {
2694
2747
  const shapeKey = shapeKeyOf(dataType);
2695
2748
  const interfaceNameOf = dataType?.type === "form" ? formInterfaceName : shapeInterfaceName;
2696
- const enumId = dataType?.actionEnumId ?? dataType?.sortEnumId;
2749
+ const enumId = enumIdOf(dataType);
2697
2750
  const enumName = enumId ? actionEnumName(enumId) : void 0;
2698
2751
  const element = shapeKey !== void 0 ? interfaceNameOf(shapes[shapeKey]?.name ?? "") : enumName ?? (dataType?.type === "file" ? "File" : dataType?.type === "option" ? OPTION_ROW_TYPE_NAME : dataType?.type === "audience" ? AUDIENCE_TYPE_NAME : dataType?.type) ?? "string";
2699
2752
  const named = element || "unknown";
@@ -3256,7 +3309,7 @@ var mountSegmentOf = (token) => {
3256
3309
  return kind ? { kind } : { kind: "static", value: token };
3257
3310
  };
3258
3311
  var mountTokenOf = (segment) => segment.kind === "static" ? (segment.value ?? "").trim() : MOUNT_TOKEN[segment.kind];
3259
- var parseMountPattern = (text2) => text2.split("/").map((t) => t.trim()).filter(Boolean).map(mountSegmentOf);
3312
+ var parseMountPattern = (text3) => text3.split("/").map((t) => t.trim()).filter(Boolean).map(mountSegmentOf);
3260
3313
  var mountPatternText = (pattern) => pattern.map(mountTokenOf).join("/");
3261
3314
  var mountPatternProblem = (pattern) => {
3262
3315
  const navUrls = pattern.filter((s) => s.kind === "navUrl").length;
@@ -3273,6 +3326,105 @@ var mountPatternProblem = (pattern) => {
3273
3326
  return void 0;
3274
3327
  };
3275
3328
 
3329
+ // libs/one/src/lib/shared/ui/scale/lib/price-relations.ts
3330
+ var compare = (key2, left, op, right, more = {}) => ({
3331
+ key: key2,
3332
+ ...more.hidden ? {} : { label: key2 },
3333
+ tone: more.tone ?? "neutral",
3334
+ type: "compare",
3335
+ left,
3336
+ op,
3337
+ rightKind: more.pct === void 0 ? "mark" : "pct",
3338
+ right,
3339
+ ...more.pct === void 0 ? {} : { rightValue: more.pct },
3340
+ ...more.n === void 0 ? {} : { n: more.n },
3341
+ ...more.hidden ? { hidden: true } : {},
3342
+ ...more.bracket ? { bracket: true } : {}
3343
+ });
3344
+ var combine = (key2, mode, of, tone = "neutral", hidden = false) => ({
3345
+ key: key2,
3346
+ ...hidden ? {} : { label: key2 },
3347
+ tone,
3348
+ type: "combine",
3349
+ mode,
3350
+ of,
3351
+ ...hidden ? { hidden: true } : {}
3352
+ });
3353
+ var SMAS = ["sma10", "sma50", "sma100", "sma200"];
3354
+ var CONVERGING = SMAS.flatMap((a) => SMAS.filter((b) => b !== a).map((b) => `${a}-under-103-of-${b}`));
3355
+ var PRICE_RULES = [
3356
+ compare("golden-cross", "sma50", "gte", "sma200", { tone: "gold", bracket: true }),
3357
+ compare("death-cross", "sma50", "lt", "sma200", { tone: "down", bracket: true }),
3358
+ combine("death-cross-near", "all", ["golden-cross", "cross-near"], "down"),
3359
+ combine("golden-cross-near", "all", ["death-cross", "cross-near"], "gold"),
3360
+ combine("bullish-alignment", "all", ["above-sma10", "sma10-above-sma50", "sma50-above-sma100", "sma100-above-sma200"], "up"),
3361
+ combine("bearish-alignment", "all", ["below-sma10", "sma10-below-sma50", "sma50-below-sma100", "sma100-below-sma200"], "down"),
3362
+ combine("strongly-bullish", "all", ["above-sma50", "above-sma200"], "up"),
3363
+ combine("bullish-support", "all", ["not-above-sma50", "above-sma200"], "up"),
3364
+ combine("recovering", "all", ["above-sma50", "not-above-sma200"]),
3365
+ combine("bearish-pressure", "all", ["not-above-sma50", "not-above-sma200"], "down"),
3366
+ compare("stretched", "current", "gt", "sma200", { tone: "warn", pct: 120 }),
3367
+ compare("far-below-sma-200", "current", "lt", "sma200", { tone: "down", pct: 80 }),
3368
+ combine("averages-converging", "all", CONVERGING, "warn"),
3369
+ compare("52w-breakout", "current", "gte", "high52w", { tone: "up" }),
3370
+ combine("near-52w-high", "all", ["below-52w-high", "within-3-of-52w-high"], "up"),
3371
+ compare("new-52w-low", "current", "lte", "low52w", { tone: "down" }),
3372
+ combine("near-52w-low", "all", ["above-52w-low", "within-3-of-52w-low"], "down"),
3373
+ combine("forecast-against-trend", "any", ["against-up", "against-down"], "warn"),
3374
+ compare("forecast-above-52w-high", "forecast", "gt", "high52w")
3375
+ ];
3376
+ var PRICE_HELPERS = [
3377
+ compare("cross-near", "sma50", "within", "sma200", { n: 1, hidden: true }),
3378
+ compare("above-sma10", "current", "gt", "sma10", { hidden: true }),
3379
+ compare("sma10-above-sma50", "sma10", "gt", "sma50", { hidden: true }),
3380
+ compare("sma50-above-sma100", "sma50", "gt", "sma100", { hidden: true }),
3381
+ compare("sma100-above-sma200", "sma100", "gt", "sma200", { hidden: true }),
3382
+ compare("below-sma10", "current", "lt", "sma10", { hidden: true }),
3383
+ compare("sma10-below-sma50", "sma10", "lt", "sma50", { hidden: true }),
3384
+ compare("sma50-below-sma100", "sma50", "lt", "sma100", { hidden: true }),
3385
+ compare("sma100-below-sma200", "sma100", "lt", "sma200", { hidden: true }),
3386
+ compare("above-sma50", "current", "gt", "sma50", { hidden: true }),
3387
+ compare("above-sma200", "current", "gt", "sma200", { hidden: true }),
3388
+ compare("not-above-sma50", "current", "lte", "sma50", { hidden: true }),
3389
+ compare("not-above-sma200", "current", "lte", "sma200", { hidden: true }),
3390
+ ...SMAS.flatMap(
3391
+ (a) => SMAS.filter((b) => b !== a).map((b) => compare(`${a}-under-103-of-${b}`, a, "lt", b, { pct: 103, hidden: true }))
3392
+ ),
3393
+ compare("below-52w-high", "current", "lt", "high52w", { hidden: true }),
3394
+ // gap(high, current) < 3% ⇔ current > high / 1.03.
3395
+ compare("within-3-of-52w-high", "current", "gt", "high52w", { pct: 100 / 1.03, hidden: true }),
3396
+ compare("above-52w-low", "current", "gt", "low52w", { hidden: true }),
3397
+ compare("within-3-of-52w-low", "current", "lt", "low52w", { pct: 103, hidden: true }),
3398
+ compare("forecast-up", "forecast", "gt", "current", { hidden: true }),
3399
+ compare("forecast-down", "forecast", "lt", "current", { hidden: true }),
3400
+ combine("bear-trend", "any", ["death-cross", "bearish-alignment"], "neutral", true),
3401
+ combine("bull-trend", "any", ["golden-cross", "bullish-alignment"], "neutral", true),
3402
+ combine("against-up", "all", ["forecast-up", "bear-trend"], "neutral", true),
3403
+ combine("against-down", "all", ["forecast-down", "bull-trend"], "neutral", true)
3404
+ ];
3405
+ var BY_KEY = new Map([...PRICE_RULES, ...PRICE_HELPERS].map((r) => [r.key, r]));
3406
+ var isPriceRule = (name3) => typeof name3 === "string" && PRICE_RULES.some((r) => r.key === name3);
3407
+ var asHidden = (relation) => {
3408
+ const rest = { ...relation };
3409
+ delete rest.label;
3410
+ delete rest.bracket;
3411
+ return { ...rest, hidden: true };
3412
+ };
3413
+ var priceRelationsFor = (rules) => {
3414
+ const asked = new Set(rules);
3415
+ const out = /* @__PURE__ */ new Map();
3416
+ const visit = (key2) => {
3417
+ const relation = BY_KEY.get(key2);
3418
+ if (!relation || out.has(key2)) return;
3419
+ out.set(key2, asked.has(key2) ? relation : asHidden(relation));
3420
+ for (const k of relation.of ?? []) visit(k);
3421
+ };
3422
+ rules.forEach((key2) => BY_KEY.has(key2) && !out.has(key2) && out.set(key2, BY_KEY.get(key2)));
3423
+ for (const key2 of rules) for (const k of BY_KEY.get(key2)?.of ?? []) visit(k);
3424
+ return [...out.values()];
3425
+ };
3426
+ var PRICE_SCALE_RELATIONS = priceRelationsFor(PRICE_RULES.map((r) => r.key));
3427
+
3276
3428
  // libs/codegen/src/lib/content-slot.ts
3277
3429
  var contentSlotOf = (control) => {
3278
3430
  if (isCardHolder(control) || control?.type === "list" /* LIST */) {
@@ -3359,7 +3511,7 @@ var CONTROL_RELATIONSHIPS = {
3359
3511
  ["section_search" /* SECTION_SEARCH */]: ["section_header_label" /* SECTION_HEADER_LABEL */],
3360
3512
  // Its label slot and nothing else — the SectionHeader's title slot, caught
3361
3513
  // by the footer's unselected `ng-content`. Everything else a footer is
3362
- // (`sticky`, `align`) is a setting rather than a child.
3514
+ // (`sticky`, `align`, `fullWidth`) is a setting rather than a child.
3363
3515
  ["section_footer" /* SECTION_FOOTER */]: ["section_header_label" /* SECTION_HEADER_LABEL */],
3364
3516
  // Buttons and nothing else — and unlike the SectionButtonGroup it looks like,
3365
3517
  // they are *consumed* rather than projected: an `m-action` renders raw
@@ -3408,7 +3560,7 @@ var CONTROL_RELATIONSHIPS = {
3408
3560
  "stat" /* STAT */,
3409
3561
  "heat_swatch" /* HEAT_SWATCH */,
3410
3562
  "score_set" /* SCORE_SET */,
3411
- "price_ladder" /* PRICE_LADDER */,
3563
+ "scale" /* SCALE */,
3412
3564
  "flex" /* FLEX */,
3413
3565
  "card" /* CARD */,
3414
3566
  "chat_bubble" /* CHAT_BUBBLE */,
@@ -3474,7 +3626,7 @@ var CONTROL_RELATIONSHIPS = {
3474
3626
  "stat" /* STAT */,
3475
3627
  "heat_swatch" /* HEAT_SWATCH */,
3476
3628
  "score_set" /* SCORE_SET */,
3477
- "price_ladder" /* PRICE_LADDER */,
3629
+ "scale" /* SCALE */,
3478
3630
  "flex" /* FLEX */,
3479
3631
  "card" /* CARD */,
3480
3632
  "chat_bubble" /* CHAT_BUBBLE */,
@@ -3501,7 +3653,7 @@ var CONTROL_RELATIONSHIPS = {
3501
3653
  "stat" /* STAT */,
3502
3654
  "heat_swatch" /* HEAT_SWATCH */,
3503
3655
  "score_set" /* SCORE_SET */,
3504
- "price_ladder" /* PRICE_LADDER */,
3656
+ "scale" /* SCALE */,
3505
3657
  "flex" /* FLEX */,
3506
3658
  "card" /* CARD */,
3507
3659
  "chat_bubble" /* CHAT_BUBBLE */,
@@ -3536,7 +3688,7 @@ var CONTROL_RELATIONSHIPS = {
3536
3688
  "stat" /* STAT */,
3537
3689
  "heat_swatch" /* HEAT_SWATCH */,
3538
3690
  "score_set" /* SCORE_SET */,
3539
- "price_ladder" /* PRICE_LADDER */,
3691
+ "scale" /* SCALE */,
3540
3692
  "flex" /* FLEX */,
3541
3693
  "card" /* CARD */,
3542
3694
  "chat_bubble" /* CHAT_BUBBLE */,
@@ -3575,7 +3727,7 @@ var CONTROL_RELATIONSHIPS = {
3575
3727
  "stat" /* STAT */,
3576
3728
  "heat_swatch" /* HEAT_SWATCH */,
3577
3729
  "score_set" /* SCORE_SET */,
3578
- "price_ladder" /* PRICE_LADDER */,
3730
+ "scale" /* SCALE */,
3579
3731
  "card" /* CARD */,
3580
3732
  "chat_bubble" /* CHAT_BUBBLE */,
3581
3733
  "section_carousel" /* SECTION_CAROUSEL */,
@@ -3610,7 +3762,7 @@ var CONTROL_RELATIONSHIPS = {
3610
3762
  "stat" /* STAT */,
3611
3763
  "heat_swatch" /* HEAT_SWATCH */,
3612
3764
  "score_set" /* SCORE_SET */,
3613
- "price_ladder" /* PRICE_LADDER */,
3765
+ "scale" /* SCALE */,
3614
3766
  "card" /* CARD */,
3615
3767
  "chat_bubble" /* CHAT_BUBBLE */,
3616
3768
  "section_carousel" /* SECTION_CAROUSEL */,
@@ -3677,7 +3829,7 @@ var CONTROL_RELATIONSHIPS = {
3677
3829
  "user" /* USER */,
3678
3830
  "heat_swatch" /* HEAT_SWATCH */,
3679
3831
  "score_set" /* SCORE_SET */,
3680
- "price_ladder" /* PRICE_LADDER */,
3832
+ "scale" /* SCALE */,
3681
3833
  "button" /* BUTTON */,
3682
3834
  "context_menu" /* CONTEXT_MENU */,
3683
3835
  "audience_picker" /* AUDIENCE_PICKER */,
@@ -3763,16 +3915,12 @@ var CONTROL_RELATIONSHIPS = {
3763
3915
  ["score_set" /* SCORE_SET */]: ["score_set_item" /* SCORE_SET_ITEM */],
3764
3916
  // A leaf: an item renders nothing of its own.
3765
3917
  ["score_set_item" /* SCORE_SET_ITEM */]: [],
3766
- // Its levels and chips and nothing else — every other setting is an
3767
- // attribute (libs/one GLOSSARY.md PriceLadder). Dropped empty; the Canvas
3768
- // lists each child as a row so it can be named and picked.
3769
- ["price_ladder" /* PRICE_LADDER */]: [
3770
- "price_ladder_mark" /* PRICE_LADDER_MARK */,
3771
- "price_ladder_signal" /* PRICE_LADDER_SIGNAL */
3772
- ],
3773
- // Leaves: the ladder draws both.
3774
- ["price_ladder_mark" /* PRICE_LADDER_MARK */]: [],
3775
- ["price_ladder_signal" /* PRICE_LADDER_SIGNAL */]: [],
3918
+ // Its marks and relations and nothing else — every other setting is an
3919
+ // attribute (libs/one GLOSSARY.md Scale).
3920
+ ["scale" /* SCALE */]: ["scale_mark" /* SCALE_MARK */, "scale_relation" /* SCALE_RELATION */],
3921
+ // Leaves: the scale draws both.
3922
+ ["scale_mark" /* SCALE_MARK */]: [],
3923
+ ["scale_relation" /* SCALE_RELATION */]: [],
3776
3924
  // Content like a Logo, but the one content Control that is not a leaf: what
3777
3925
  // `m-user` projects beneath the name is a ContentControl, the same single
3778
3926
  // child a card Field takes and gated the same way, through `contentSlotOf`.
@@ -4016,9 +4164,9 @@ var OWN_DIRECTIVES = {
4016
4164
  ["heat_swatch" /* HEAT_SWATCH */]: ["routerLink"],
4017
4165
  ["score_set" /* SCORE_SET */]: [],
4018
4166
  ["score_set_item" /* SCORE_SET_ITEM */]: [],
4019
- ["price_ladder" /* PRICE_LADDER */]: [],
4020
- ["price_ladder_mark" /* PRICE_LADDER_MARK */]: [],
4021
- ["price_ladder_signal" /* PRICE_LADDER_SIGNAL */]: [],
4167
+ ["scale" /* SCALE */]: [],
4168
+ ["scale_mark" /* SCALE_MARK */]: [],
4169
+ ["scale_relation" /* SCALE_RELATION */]: [],
4022
4170
  ["form" /* FORM */]: ["routerLink"],
4023
4171
  ["field" /* FIELD */]: ["mOptions", "routerLink"],
4024
4172
  // Nothing to attach: a ContentControl emits an `ng-template` — where a
@@ -4190,9 +4338,9 @@ var CONTROL_LABEL = {
4190
4338
  ["heat_swatch" /* HEAT_SWATCH */]: "heat-swatch",
4191
4339
  ["score_set" /* SCORE_SET */]: "score-set-control",
4192
4340
  ["score_set_item" /* SCORE_SET_ITEM */]: "score-set-item-control",
4193
- ["price_ladder" /* PRICE_LADDER */]: "price-ladder-control",
4194
- ["price_ladder_mark" /* PRICE_LADDER_MARK */]: "price-ladder-mark-control",
4195
- ["price_ladder_signal" /* PRICE_LADDER_SIGNAL */]: "price-ladder-signal-control",
4341
+ ["scale" /* SCALE */]: "scale-control",
4342
+ ["scale_mark" /* SCALE_MARK */]: "scale-mark-control",
4343
+ ["scale_relation" /* SCALE_RELATION */]: "scale-relation-control",
4196
4344
  ["nav_header" /* NAV_HEADER */]: "nav-header",
4197
4345
  ["form" /* FORM */]: "form",
4198
4346
  ["field" /* FIELD */]: "field",
@@ -4266,9 +4414,9 @@ var CONTROL_ICON = {
4266
4414
  ["score_set" /* SCORE_SET */]: "control_stat",
4267
4415
  ["score_set_item" /* SCORE_SET_ITEM */]: "control_stat_value",
4268
4416
  // Reuse the Stat glyphs until ladder artwork joins the shared set.
4269
- ["price_ladder" /* PRICE_LADDER */]: "control_stat",
4270
- ["price_ladder_mark" /* PRICE_LADDER_MARK */]: "control_stat_value",
4271
- ["price_ladder_signal" /* PRICE_LADDER_SIGNAL */]: "control_stat_corner",
4417
+ ["scale" /* SCALE */]: "control_stat",
4418
+ ["scale_mark" /* SCALE_MARK */]: "control_stat_value",
4419
+ ["scale_relation" /* SCALE_RELATION */]: "control_stat_corner",
4272
4420
  ["nav_header" /* NAV_HEADER */]: "control_nav_header",
4273
4421
  ["form" /* FORM */]: "control_form",
4274
4422
  ["field" /* FIELD */]: "control_field",
@@ -4326,8 +4474,9 @@ var CONTROL_CODEGEN = {
4326
4474
  tag: "m-section-header",
4327
4475
  component: "SectionHeaderComponent"
4328
4476
  },
4329
- // Folderless for the section_header's reason — `sticky` and `align` are its
4330
- // only settings, both scalars, and its text is the projected label slot.
4477
+ // Folderless for the section_header's reason — `sticky`, `align` and
4478
+ // `fullWidth` are its only settings, all scalars, and its text is the
4479
+ // projected label slot.
4331
4480
  ["section_footer" /* SECTION_FOOTER */]: {
4332
4481
  tag: "m-section-footer",
4333
4482
  component: "SectionFooterComponent"
@@ -4545,18 +4694,12 @@ var CONTROL_CODEGEN = {
4545
4694
  tag: "m-score-set-item",
4546
4695
  component: "ScoreSetItemComponent"
4547
4696
  },
4548
- // Folderless for the ScoreSet's reason (libs/one GLOSSARY.md PriceLadder).
4549
- ["price_ladder" /* PRICE_LADDER */]: {
4550
- tag: "m-price-ladder",
4551
- component: "PriceLadderComponent"
4552
- },
4553
- ["price_ladder_mark" /* PRICE_LADDER_MARK */]: {
4554
- tag: "m-price-ladder-mark",
4555
- component: "PriceLadderMarkComponent"
4556
- },
4557
- ["price_ladder_signal" /* PRICE_LADDER_SIGNAL */]: {
4558
- tag: "m-price-ladder-signal",
4559
- component: "PriceLadderSignalComponent"
4697
+ // Folderless for the ScoreSet's reason (libs/one GLOSSARY.md Scale).
4698
+ ["scale" /* SCALE */]: { tag: "m-scale", component: "ScaleComponent" },
4699
+ ["scale_mark" /* SCALE_MARK */]: { tag: "m-scale-mark", component: "ScaleMarkComponent" },
4700
+ ["scale_relation" /* SCALE_RELATION */]: {
4701
+ tag: "m-scale-relation",
4702
+ component: "ScaleRelationComponent"
4560
4703
  },
4561
4704
  // Navigation header with back button and breadcrumb trail.
4562
4705
  // Folderless as it uses NavStore internally and takes no config.
@@ -4942,156 +5085,83 @@ var ONE_FUNCTION_ID_PARAM = "id";
4942
5085
  var ONE_FUNCTION_MAP_PARAM = "map";
4943
5086
  var ONE_FUNCTION_DATA_PARAM = "data";
4944
5087
  var ONE_FUNCTION_PREFIX = "one:";
5088
+ var signatureParam = (param, row) => ({
5089
+ id: param.id,
5090
+ name: param.name,
5091
+ dataType: param.rule === "string-one" ? { type: "string" } : row,
5092
+ cardinality: param.rule === "map-path" ? "map" : "one",
5093
+ acceptsUndefined: true
5094
+ });
5095
+ var defineOneFunction = (spec) => {
5096
+ const { returns, ...entry2 } = spec;
5097
+ return {
5098
+ ...entry2,
5099
+ importFrom: ONE_IMPORT_MODULE,
5100
+ returnsRow: returns !== "boolean",
5101
+ signature: (row) => ({
5102
+ params: entry2.params.map((param) => signatureParam(param, row)),
5103
+ ...returns === "boolean" ? { returnType: { type: "boolean" }, returnCardinality: "one" } : returns === "row" ? { returnType: row, returnCardinality: "one", returnUndefined: true } : { returnType: row, returnCardinality: "map" }
5104
+ })
5105
+ };
5106
+ };
4945
5107
  var ONE_FUNCTIONS = [
4946
- {
4947
- // `getFromMap<T>(id, map: Record<string, T>): T | undefined` — the row a
4948
- // `map` holds under an id, typically a ScreenInput a Page was handed.
5108
+ // `getFromMap<T>(id, map: Record<string, T>): T | undefined` — the row a
5109
+ // `map` holds under an id, typically a ScreenInput a Page was handed.
5110
+ defineOneFunction({
4949
5111
  name: "getFromMap",
4950
- importFrom: ONE_IMPORT_MODULE,
4951
5112
  reach: ["screen-computed"],
4952
- returnsRow: true,
5113
+ returns: "row",
4953
5114
  params: [
4954
5115
  { id: ONE_FUNCTION_ID_PARAM, name: "id", rule: "string-one" },
4955
5116
  { id: ONE_FUNCTION_MAP_PARAM, name: "map", rule: "map-path" }
4956
5117
  ],
4957
5118
  rowParamId: ONE_FUNCTION_MAP_PARAM,
4958
- rowCardinality: "map",
4959
- signature: (row) => ({
4960
- params: [
4961
- {
4962
- id: ONE_FUNCTION_ID_PARAM,
4963
- name: "id",
4964
- dataType: { type: "string" },
4965
- cardinality: "one",
4966
- acceptsUndefined: true
4967
- },
4968
- {
4969
- id: ONE_FUNCTION_MAP_PARAM,
4970
- name: "map",
4971
- dataType: row,
4972
- cardinality: "map",
4973
- acceptsUndefined: true
4974
- }
4975
- ],
4976
- returnType: row,
4977
- returnCardinality: "one",
4978
- returnUndefined: true
4979
- })
4980
- },
4981
- {
4982
- // `existsInMap(id, map: Record<string, unknown>): boolean` — whether a
4983
- // `map` holds anything under an id (ADR 0202). `false` rather than
4984
- // `undefined` while either is, so a gate on an unloaded store reads "not
4985
- // there yet" and a computed over it never needs `?.`.
5119
+ rowCardinality: "map"
5120
+ }),
5121
+ // `existsInMap(id, map: Record<string, unknown>): boolean` — whether a
5122
+ // `map` holds anything under an id (ADR 0202). `false` rather than
5123
+ // `undefined` while either is, so a gate on an unloaded store reads "not
5124
+ // there yet" and a computed over it never needs `?.`.
5125
+ defineOneFunction({
4986
5126
  name: "existsInMap",
4987
- importFrom: ONE_IMPORT_MODULE,
4988
5127
  reach: ["screen-computed", "call-condition"],
4989
- returnsRow: false,
5128
+ returns: "boolean",
4990
5129
  params: [
4991
5130
  { id: ONE_FUNCTION_ID_PARAM, name: "id", rule: "string-one" },
4992
5131
  { id: ONE_FUNCTION_MAP_PARAM, name: "map", rule: "map-path" }
4993
5132
  ],
4994
5133
  rowParamId: ONE_FUNCTION_MAP_PARAM,
4995
- rowCardinality: "map",
4996
- signature: (row) => ({
4997
- params: [
4998
- {
4999
- id: ONE_FUNCTION_ID_PARAM,
5000
- name: "id",
5001
- dataType: { type: "string" },
5002
- cardinality: "one",
5003
- acceptsUndefined: true
5004
- },
5005
- {
5006
- id: ONE_FUNCTION_MAP_PARAM,
5007
- name: "map",
5008
- dataType: row,
5009
- cardinality: "map",
5010
- acceptsUndefined: true
5011
- }
5012
- ],
5013
- returnType: { type: "boolean" },
5014
- returnCardinality: "one"
5015
- })
5016
- },
5017
- {
5018
- // `notExistsInMap(id, map: Record<string, unknown>): boolean` — the
5019
- // named inverse, offered on CallConditions (ADR 0202).
5134
+ rowCardinality: "map"
5135
+ }),
5136
+ // `notExistsInMap(id, map: Record<string, unknown>): boolean` — the
5137
+ // named inverse, offered on CallConditions (ADR 0202).
5138
+ defineOneFunction({
5020
5139
  name: "notExistsInMap",
5021
- importFrom: ONE_IMPORT_MODULE,
5022
5140
  reach: ["call-condition"],
5023
- returnsRow: false,
5141
+ returns: "boolean",
5024
5142
  params: [
5025
5143
  { id: ONE_FUNCTION_ID_PARAM, name: "id", rule: "string-one" },
5026
5144
  { id: ONE_FUNCTION_MAP_PARAM, name: "map", rule: "map-path" }
5027
5145
  ],
5028
5146
  rowParamId: ONE_FUNCTION_MAP_PARAM,
5029
- rowCardinality: "map",
5030
- signature: (row) => ({
5031
- params: [
5032
- {
5033
- id: ONE_FUNCTION_ID_PARAM,
5034
- name: "id",
5035
- dataType: { type: "string" },
5036
- cardinality: "one",
5037
- acceptsUndefined: true
5038
- },
5039
- {
5040
- id: ONE_FUNCTION_MAP_PARAM,
5041
- name: "map",
5042
- dataType: row,
5043
- cardinality: "map",
5044
- acceptsUndefined: true
5045
- }
5046
- ],
5047
- returnType: { type: "boolean" },
5048
- returnCardinality: "one"
5049
- })
5050
- },
5051
- {
5052
- // `setInMap<T>(id, data: T, map: Record<string, T>): Record<string, T>` —
5053
- // the map with `data` held under `id`, every other entry kept (ADR 0205).
5054
- // `loadCoin(id)` answers one coin and `coinsById[id]` is where it lands.
5055
- // Offered on an OutcomeTransform alone, where the landing names `T`.
5147
+ rowCardinality: "map"
5148
+ }),
5149
+ // `setInMap<T>(id, data: T, map: Record<string, T>): Record<string, T>` —
5150
+ // the map with `data` held under `id`, every other entry kept (ADR 0205).
5151
+ // `loadCoin(id)` answers one coin and `coinsById[id]` is where it lands.
5152
+ // Offered on an OutcomeTransform alone, where the landing names `T`.
5153
+ defineOneFunction({
5056
5154
  name: "setInMap",
5057
- importFrom: ONE_IMPORT_MODULE,
5058
5155
  reach: ["outcome-transform"],
5059
- returnsRow: true,
5156
+ returns: "row-map",
5060
5157
  params: [
5061
5158
  { id: ONE_FUNCTION_ID_PARAM, name: "id", rule: "string-one" },
5062
5159
  { id: ONE_FUNCTION_DATA_PARAM, name: "data", rule: "row-one" },
5063
5160
  { id: ONE_FUNCTION_MAP_PARAM, name: "map", rule: "map-path" }
5064
5161
  ],
5065
5162
  rowParamId: ONE_FUNCTION_DATA_PARAM,
5066
- rowCardinality: "one",
5067
- signature: (row) => ({
5068
- params: [
5069
- {
5070
- id: ONE_FUNCTION_ID_PARAM,
5071
- name: "id",
5072
- dataType: { type: "string" },
5073
- cardinality: "one",
5074
- acceptsUndefined: true
5075
- },
5076
- {
5077
- id: ONE_FUNCTION_DATA_PARAM,
5078
- name: "data",
5079
- dataType: row,
5080
- cardinality: "one",
5081
- acceptsUndefined: true
5082
- },
5083
- {
5084
- id: ONE_FUNCTION_MAP_PARAM,
5085
- name: "map",
5086
- dataType: row,
5087
- cardinality: "map",
5088
- acceptsUndefined: true
5089
- }
5090
- ],
5091
- returnType: row,
5092
- returnCardinality: "map"
5093
- })
5094
- }
5163
+ rowCardinality: "one"
5164
+ })
5095
5165
  ];
5096
5166
  var ONE_FUNCTION_CATALOG = Object.fromEntries(ONE_FUNCTIONS.map((entry2) => [entry2.name, entry2]));
5097
5167
  var oneFunctionOf = (name3) => name3 ? ONE_FUNCTIONS.find((entry2) => entry2.name === name3) : void 0;
@@ -5895,6 +5965,8 @@ function functionUsage(functionId, stateComputeds, screenComputeds, fieldCheckNa
5895
5965
  (mapping) => mapping.transform?.functionId === functionId
5896
5966
  ) || (method.computes ?? []).some(
5897
5967
  (compute) => compute.functionId === functionId
5968
+ ) || (method.persists ?? []).some(
5969
+ (persist) => persist.sourceKind === "function" && persist.transform?.functionId === functionId
5898
5970
  ) || (method.conditions ?? []).some(
5899
5971
  (condition) => condition.kind !== "check" && condition.functionId === functionId
5900
5972
  )
@@ -6646,6 +6718,15 @@ var outcomeTransformFunctionIds = (methods) => Array.from(
6646
6718
  ).sort();
6647
6719
 
6648
6720
  // libs/codegen/src/lib/value-transform-helper.ts
6721
+ var AUTO_CASTS = {
6722
+ string: { number: "Number", boolean: "Boolean" },
6723
+ number: { string: "String" }
6724
+ };
6725
+ function castTransform(from, to) {
6726
+ if (from.cardinality !== "one" || to.cardinality !== "one") return void 0;
6727
+ const cast = AUTO_CASTS[from.dataType.type]?.[to.dataType.type];
6728
+ return cast ? unaryCall(nativeTarget({ group: "number", name: cast }), 1) : void 0;
6729
+ }
6649
6730
  var SURFACE_LEAVES = {
6650
6731
  input: new Set(INPUT_TRANSFORM_LEAVES),
6651
6732
  "call-arg": new Set(CALL_ARG_TRANSFORM_LEAVES),
@@ -7289,11 +7370,7 @@ var BINDING_SLOT = {
7289
7370
  // A [ScoreSet]'s Score Date, named for the `m-score-set` input it lands on.
7290
7371
  // Content by the `total` test: whether the set reads stale *is* the datum's
7291
7372
  // age, read off the same record its Scores are.
7292
- scoreDate: "scoreDate",
7293
- // A [PriceLadder]'s forward estimate, named for the `m-price-ladder` input it
7294
- // lands on. Content by the `total` test: the forecast *is* the datum. The
7295
- // ladder's current price and a mark's level ride `value`.
7296
- target: "target"
7373
+ scoreDate: "scoreDate"
7297
7374
  };
7298
7375
  var USER_VALUE_SLOTS = [
7299
7376
  BINDING_SLOT.id,
@@ -7355,6 +7432,12 @@ function controlMapStateRootIds(map) {
7355
7432
  transformStateRootIds(binding.transform).forEach((id) => ids.add(id));
7356
7433
  })
7357
7434
  );
7435
+ Object.values(map).forEach(
7436
+ (control) => (control.checks ?? []).forEach((check) => {
7437
+ if (check.limitSource === "state" && check.limitRef)
7438
+ ids.add(check.limitRef);
7439
+ })
7440
+ );
7358
7441
  return [...ids];
7359
7442
  }
7360
7443
  function controlMapReadsState(map) {
@@ -7632,6 +7715,14 @@ var hop = (segment) => segment.position === void 0 ? `?.${segment.name}` : `?.[$
7632
7715
  var isPrimitiveType = (dataType) => dataType.type !== "shape" && dataType.type !== "form" && dataType.type !== "option";
7633
7716
  var seq = 0;
7634
7717
  var nodeId = () => `rn${seq += 1}`;
7718
+ var keptNodeId = (stored, taken) => {
7719
+ const match = typeof stored === "string" ? /^rn([1-9]\d*)$/.exec(stored) : null;
7720
+ const id = match && !taken.has(stored) ? stored : "";
7721
+ if (match && id) seq = Math.max(seq, Number(match[1]));
7722
+ const kept = id || nodeId();
7723
+ taken.add(kept);
7724
+ return kept;
7725
+ };
7635
7726
  var createCheck = () => ({
7636
7727
  id: nodeId(),
7637
7728
  kind: "check",
@@ -7698,7 +7789,12 @@ var pathCrossesCollection = (segments) => segments.some((segment) => segment.car
7698
7789
  function pathLeafType(segments) {
7699
7790
  const last = segments[segments.length - 1];
7700
7791
  if (!last || !isPrimitiveType(last.dataType)) return void 0;
7701
- return last.dataType.type;
7792
+ const type = last.dataType.type;
7793
+ return type === "string" || type === "number" || type === "boolean" ? type : void 0;
7794
+ }
7795
+ function pathLeafEnumId(segments) {
7796
+ const last = segments[segments.length - 1];
7797
+ return last?.dataType.type === "enum" ? last.dataType.enumId : void 0;
7702
7798
  }
7703
7799
  var canCount = (segments) => {
7704
7800
  const last = segments[segments.length - 1];
@@ -7736,8 +7832,9 @@ var STRING_OPERATORS = [
7736
7832
  var BOOLEAN_OPERATORS = ["==", "!="];
7737
7833
  var UNARY_OPERATORS = ["exists", "not_exists"];
7738
7834
  var isUnaryOperator = (operator) => UNARY_OPERATORS.includes(operator);
7739
- function operatorsFor(leaf, counted, resolved = false) {
7835
+ function operatorsFor(leaf, counted, resolved = false, enumLeaf = false) {
7740
7836
  if (counted) return NUMBER_OPERATORS;
7837
+ if (enumLeaf) return [...BOOLEAN_OPERATORS, ...UNARY_OPERATORS];
7741
7838
  if (leaf === "number") return [...NUMBER_OPERATORS, ...UNARY_OPERATORS];
7742
7839
  if (leaf === "boolean") return [...BOOLEAN_OPERATORS, ...UNARY_OPERATORS];
7743
7840
  if (leaf === "string") return [...STRING_OPERATORS, ...UNARY_OPERATORS];
@@ -7879,17 +7976,21 @@ function checkError(check, properties, shapes) {
7879
7976
  const counted = !!check.count;
7880
7977
  if (counted && !canCount(segments)) return "rule-path-not-leaf";
7881
7978
  const leaf = pathLeafType(segments);
7979
+ const enumId = counted ? void 0 : pathLeafEnumId(segments);
7882
7980
  const unary = isUnaryOperator(check.operator);
7883
- if (!counted && !leaf && !unary) return "rule-path-not-leaf";
7884
- if (!operatorsFor(leaf, counted, true).includes(check.operator))
7981
+ if (!counted && !leaf && !enumId && !unary) return "rule-path-not-leaf";
7982
+ if (!operatorsFor(leaf, counted, true, !!enumId).includes(check.operator))
7885
7983
  return "rule-operator-invalid";
7886
7984
  if (unary) return null;
7985
+ if (enumId && check.operand.kind === "literal") {
7986
+ return typeof check.operand.value === "string" && check.operand.value ? null : "rule-operand-missing";
7987
+ }
7887
7988
  if (check.operand.kind === "path") {
7888
7989
  const right = resolvePath(check.operand.path, properties, shapes);
7889
7990
  if (!check.operand.path.length || right.length !== check.operand.path.length)
7890
7991
  return "rule-operand-missing";
7891
7992
  if (pathCrossesCollection(right)) return "rule-operand-missing";
7892
- if (pathLeafType(right) !== operandType(leaf, counted))
7993
+ if (pathLeafType(right) !== operandType(leaf, counted) || pathLeafEnumId(right) !== enumId)
7893
7994
  return "rule-operand-missing";
7894
7995
  }
7895
7996
  return null;
@@ -7986,11 +8087,21 @@ function comparisonSource(left, operator, right) {
7986
8087
  if (operator === "not_contains") return `!${left}.includes(${right})`;
7987
8088
  return `${left} ${JS_OPERATOR[operator]} ${right}`;
7988
8089
  }
7989
- function generateCheckExpression(check, properties, shapes, prefix = "") {
8090
+ function enumMemberSource(check, segments, enums) {
8091
+ if (check.count || check.operand.kind !== "literal") return void 0;
8092
+ const enumId = pathLeafEnumId(segments);
8093
+ if (!enumId) return void 0;
8094
+ const appEnum = enums[enumId];
8095
+ const key2 = check.operand.value;
8096
+ return appEnum && appEnum.members.some((member) => member.key === key2) ? `${appEnum.name}.${key2}` : null;
8097
+ }
8098
+ function generateCheckExpression(check, properties, shapes, prefix = "", enums = {}) {
7990
8099
  const segments = resolvePath(check.path, properties, shapes);
7991
8100
  if (!segments.length) return "false";
7992
8101
  const unary = isUnaryOperator(check.operator);
7993
- const rawRight = unary ? "" : operandSource(check.operand, properties, shapes, prefix);
8102
+ const member = unary ? void 0 : enumMemberSource(check, segments, enums);
8103
+ if (member === null) return "false";
8104
+ const rawRight = unary ? "" : member ?? operandSource(check.operand, properties, shapes, prefix);
7994
8105
  const right = unary ? "" : check.operand.kind === "path" ? guardOptional(rawRight, check.operator) : rawRight;
7995
8106
  const leaf = (value, optional = false) => comparisonSource(
7996
8107
  // Unary asks about undefined itself, so the optional fallbacks that make
@@ -8048,12 +8159,12 @@ function generateFunctionExpression(leaf, properties, shapes, functions, prefix
8048
8159
  const call = `${fn.name}(${args.join(", ")})`;
8049
8160
  return guards.length ? `(${[...guards, call].join(" && ")})` : call;
8050
8161
  }
8051
- function generateRuleExpression(node, properties, shapes, top = true, prefix = "", callReceiver = "", functions = {}) {
8162
+ function generateRuleExpression(node, properties, shapes, top = true, prefix = "", callReceiver = "", functions = {}, enums = {}) {
8052
8163
  if (node.kind === "function") {
8053
8164
  return functionError(node, properties, shapes, functions) ? "false" : generateFunctionExpression(node, properties, shapes, functions, prefix);
8054
8165
  }
8055
8166
  if (node.kind === "check") {
8056
- return checkError(node, properties, shapes) ? "false" : generateCheckExpression(node, properties, shapes, prefix);
8167
+ return checkError(node, properties, shapes) ? "false" : generateCheckExpression(node, properties, shapes, prefix, enums);
8057
8168
  }
8058
8169
  if (node.kind === "call") {
8059
8170
  return callError(node, properties, shapes) ? "false" : generateCallExpression(node, properties, shapes, prefix, callReceiver);
@@ -8071,7 +8182,8 @@ function generateRuleExpression(node, properties, shapes, top = true, prefix = "
8071
8182
  false,
8072
8183
  prefix,
8073
8184
  callReceiver,
8074
- functions
8185
+ functions,
8186
+ enums
8075
8187
  )
8076
8188
  );
8077
8189
  const joined = parts.join(joiner);
@@ -8861,6 +8973,25 @@ var emittedDataType = (binding, scope) => {
8861
8973
  functions: scope.functions
8862
8974
  });
8863
8975
  };
8976
+ var BOUND_SLOT_TYPES = {
8977
+ ["section_pagination" /* SECTION_PAGINATION */]: { [BINDING_SLOT.total]: "number" },
8978
+ ["section_filter" /* SECTION_FILTER */]: {
8979
+ [BINDING_SLOT.min]: "number",
8980
+ [BINDING_SLOT.max]: "number"
8981
+ },
8982
+ ["heat_swatch" /* HEAT_SWATCH */]: { [BINDING_SLOT.value]: "number" },
8983
+ ["score_set_item" /* SCORE_SET_ITEM */]: { [BINDING_SLOT.value]: "number" },
8984
+ ["scale_mark" /* SCALE_MARK */]: { [BINDING_SLOT.value]: "number" },
8985
+ ["score_set" /* SCORE_SET */]: { [BINDING_SLOT.scoreDate]: "string" },
8986
+ ["img" /* IMG */]: { [BINDING_SLOT.src]: "string" }
8987
+ };
8988
+ var boundSlotType = (type, slot) => type ? BOUND_SLOT_TYPES[type]?.[slot] : void 0;
8989
+ var boundSlotMismatch = (type, slot, binding, scope) => {
8990
+ const expected = boundSlotType(type, slot);
8991
+ if (!expected || !binding) return void 0;
8992
+ const actual = emittedDataType(binding, scope)?.type;
8993
+ return actual && actual !== expected ? { expected, actual } : void 0;
8994
+ };
8864
8995
  var textBindingExpression = (binding, scope, translated = false) => {
8865
8996
  const expr = bindingExpression(binding, scope);
8866
8997
  if (!expr) return void 0;
@@ -9547,8 +9678,13 @@ var stringEnumFits = (read, target, enums) => {
9547
9678
  };
9548
9679
  var bindingFits = (option2, target, enums) => stringEnumFits(option2, target, enums) || option2.cardinality === target.cardinality && option2.dataType?.type === target.dataType?.type && (option2.dataType?.type !== "shape" || target.dataType?.type !== "shape" || option2.dataType.shapeId === target.dataType.shapeId);
9549
9680
  var eventMemberType = (row, scope) => {
9681
+ if (row.source !== "event") return void 0;
9550
9682
  const path = row.event ?? [];
9551
- if (row.source !== "event" || path.length !== 1) return void 0;
9683
+ const payload = scope.payload;
9684
+ if (!path.length && (payload === "string" || payload === "number" || payload === "boolean")) {
9685
+ return { dataType: { type: payload }, cardinality: "one" };
9686
+ }
9687
+ if (path.length !== 1) return void 0;
9552
9688
  return scope.fields?.[path[0]];
9553
9689
  };
9554
9690
  function callArgEventMismatch(row, target, scope) {
@@ -9556,10 +9692,6 @@ function callArgEventMismatch(row, target, scope) {
9556
9692
  const member = eventMemberType(row, scope);
9557
9693
  return !!member && !sameType4(target, member) && !stringEnumFits(member, target, scope.bindings?.enums);
9558
9694
  }
9559
- var AUTO_CASTS = {
9560
- string: { number: "Number", boolean: "Boolean" },
9561
- number: { string: "String" }
9562
- };
9563
9695
  var typeName = (type) => type.cardinality === "many" ? `${type.dataType.type}[]` : type.dataType.type;
9564
9696
  function callArgTypeMismatch(row, target, scope) {
9565
9697
  if (!target?.dataType || row.transform) return void 0;
@@ -9571,11 +9703,11 @@ function callArgTypeMismatch(row, target, scope) {
9571
9703
  dataType: target.dataType,
9572
9704
  cardinality: target.cardinality
9573
9705
  };
9574
- const cast = read.cardinality === "one" && expected.cardinality === "one" ? AUTO_CASTS[read.dataType.type]?.[expected.dataType.type] : void 0;
9706
+ const fix = castTransform(read, expected);
9575
9707
  return {
9576
9708
  from: typeName(read),
9577
9709
  to: typeName(expected),
9578
- ...cast ? { fix: unaryCall(nativeTarget({ group: "number", name: cast }), 1) } : {}
9710
+ ...fix ? { fix } : {}
9579
9711
  };
9580
9712
  }
9581
9713
  var bindingPipeType = (row, target, scope) => {
@@ -9694,7 +9826,7 @@ function validateCallArgs(args, rows, payload, fieldNames = [], constants = {},
9694
9826
  fieldNames,
9695
9827
  constants,
9696
9828
  functions,
9697
- scope
9829
+ { payload, ...scope }
9698
9830
  );
9699
9831
  if (err) return err;
9700
9832
  }
@@ -9934,15 +10066,15 @@ var CALL_ARG_SOURCES = [
9934
10066
  var callArgReadsVariable = (row, variableId) => row?.source === "binding" && row.binding?.root.kind === "screen_variable" && row.binding.root.id === variableId;
9935
10067
  var callArgTargetKey = targetKey;
9936
10068
  var parseCallArgTargetKey = (raw) => {
9937
- const text2 = raw.trim();
9938
- if (!text2 || text2 === "args") return [];
9939
- return text2.startsWith("args.") ? text2.slice("args.".length).split(".").filter(Boolean) : text2.split(".").filter(Boolean);
10069
+ const text3 = raw.trim();
10070
+ if (!text3 || text3 === "args") return [];
10071
+ return text3.startsWith("args.") ? text3.slice("args.".length).split(".").filter(Boolean) : text3.split(".").filter(Boolean);
9940
10072
  };
9941
10073
  var callArgEventKey = eventKey;
9942
10074
  var parseCallArgEventKey = (raw) => {
9943
- const text2 = raw.trim();
9944
- if (!text2 || text2 === "event") return [];
9945
- return text2.startsWith("event.") ? text2.slice("event.".length).split(".").filter(Boolean) : text2.split(".").filter(Boolean);
10075
+ const text3 = raw.trim();
10076
+ if (!text3 || text3 === "event") return [];
10077
+ return text3.startsWith("event.") ? text3.slice("event.".length).split(".").filter(Boolean) : text3.split(".").filter(Boolean);
9946
10078
  };
9947
10079
 
9948
10080
  // libs/codegen/src/lib/screen-codegen.ts
@@ -10388,6 +10520,57 @@ function screenWriteToggleAllowed(variable) {
10388
10520
  function screenWriteEventAllowed(payload) {
10389
10521
  return payload !== "void";
10390
10522
  }
10523
+ function writeEventReadType(value, payload) {
10524
+ if (value.kind !== "event" || value.path?.length) return void 0;
10525
+ if (payload === "string" || payload === "number" || payload === "boolean") {
10526
+ return { dataType: { type: payload }, cardinality: "one" };
10527
+ }
10528
+ return void 0;
10529
+ }
10530
+ function writeEventIssue(value, payload, target, functions) {
10531
+ if (value.kind !== "event") return void 0;
10532
+ const read = writeEventReadType(value, payload);
10533
+ if (value.transform) {
10534
+ const err = validateTransform(
10535
+ value.transform,
10536
+ target,
10537
+ read ?? target,
10538
+ "call-arg",
10539
+ functions
10540
+ );
10541
+ if (!err) return void 0;
10542
+ return err === "value-transform-incomplete" ? "incomplete" : "type-mismatch";
10543
+ }
10544
+ if (!read || target.cardinality !== "one") return void 0;
10545
+ return read.dataType.type === target.dataType.type ? void 0 : "type-mismatch";
10546
+ }
10547
+ function writeEventMismatch(value, payload, target) {
10548
+ if (value.kind !== "event" || value.transform) return void 0;
10549
+ const read = writeEventReadType(value, payload);
10550
+ if (!read || target.cardinality !== "one" || read.dataType.type === target.dataType.type) {
10551
+ return void 0;
10552
+ }
10553
+ const fix = castTransform(read, target);
10554
+ return {
10555
+ from: read.dataType.type,
10556
+ to: target.dataType.type,
10557
+ ...fix ? { fix } : {}
10558
+ };
10559
+ }
10560
+ function writeEventTransforms(rows) {
10561
+ return rows.flatMap(
10562
+ (row) => row.value.kind === "event" && row.value.transform ? [row.value.transform] : []
10563
+ );
10564
+ }
10565
+ function withEventTransform(value, read, target, functions, constants, scope) {
10566
+ if (value.kind !== "event" || !value.transform) return read;
10567
+ return emitTransformExpr(
10568
+ value.transform,
10569
+ read,
10570
+ { functions, constants, scope },
10571
+ target
10572
+ );
10573
+ }
10391
10574
  function screenWriteInputTargets(inputs, variable) {
10392
10575
  return Object.values(inputs).filter(
10393
10576
  (input) => inputPrimitive(input) === variable.dataType && input.cardinality === variable.cardinality
@@ -10436,7 +10619,7 @@ function nextScreenWriteRow(variables, rows, payload, inputs, constants = {}) {
10436
10619
  value: defaultScreenWriteValue(free.variable, payload, inputs, constants)
10437
10620
  };
10438
10621
  }
10439
- function validateScreenWrites(variables, rows, payload, fieldNames, inputs, constants = {}) {
10622
+ function validateScreenWrites(variables, rows, payload, fieldNames, inputs, constants = {}, functions = {}) {
10440
10623
  const seen = /* @__PURE__ */ new Set();
10441
10624
  for (const row of rows) {
10442
10625
  if (seen.has(row.variableId)) return "screen-write-duplicate";
@@ -10471,6 +10654,14 @@ function validateScreenWrites(variables, rows, payload, fieldNames, inputs, cons
10471
10654
  if (value.kind === "event" && value.path?.length && fieldNames.length && !value.path.every((name3) => fieldNames.includes(name3))) {
10472
10655
  return "screen-write-incomplete";
10473
10656
  }
10657
+ const issue = writeEventIssue(
10658
+ value,
10659
+ payload,
10660
+ { dataType: { type: variable.dataType }, cardinality: variable.cardinality },
10661
+ functions
10662
+ );
10663
+ if (issue === "incomplete") return "screen-write-incomplete";
10664
+ if (issue) return "screen-write-type-mismatch";
10474
10665
  }
10475
10666
  return void 0;
10476
10667
  }
@@ -10502,7 +10693,7 @@ var valueExpression = (value, variable, payload, inputs, constants, eventRoot, s
10502
10693
  variable.dataType
10503
10694
  ) : read;
10504
10695
  };
10505
- function screenWriteStatements(variables, rows, payload, fieldNames, inputs, constants = {}, eventRoot = "$event", scope = "template", eventMember, narrow) {
10696
+ function screenWriteStatements(variables, rows, payload, fieldNames, inputs, constants = {}, eventRoot = "$event", scope = "template", eventMember, narrow, functions = {}) {
10506
10697
  if (!rows.length) return [];
10507
10698
  if (validateScreenWrites(
10508
10699
  variables,
@@ -10510,7 +10701,8 @@ function screenWriteStatements(variables, rows, payload, fieldNames, inputs, con
10510
10701
  payload,
10511
10702
  fieldNames,
10512
10703
  inputs,
10513
- constants
10704
+ constants,
10705
+ functions
10514
10706
  )) {
10515
10707
  return [];
10516
10708
  }
@@ -10530,7 +10722,15 @@ function screenWriteStatements(variables, rows, payload, fieldNames, inputs, con
10530
10722
  eventMember
10531
10723
  );
10532
10724
  if (expr === void 0) return [];
10533
- const narrowed = narrow ? narrow(variable, row.value, expr) : expr;
10725
+ const transformed = withEventTransform(
10726
+ row.value,
10727
+ expr,
10728
+ { type: variable.dataType },
10729
+ functions,
10730
+ constants,
10731
+ scope
10732
+ );
10733
+ const narrowed = narrow ? narrow(variable, row.value, transformed) : transformed;
10534
10734
  statements.push({
10535
10735
  name: variable.name,
10536
10736
  text: `${self}${variable.name}.set(${narrowed})`
@@ -10757,7 +10957,7 @@ function nextStateWriteRow(properties, rows, payload, inputs, constants = {}) {
10757
10957
  value: defaultStateWriteValue(free.property, payload, inputs, constants)
10758
10958
  };
10759
10959
  }
10760
- function validateStateWrites(properties, rows, payload, fieldNames, inputs, constants = {}) {
10960
+ function validateStateWrites(properties, rows, payload, fieldNames, inputs, constants = {}, functions = {}) {
10761
10961
  const seen = /* @__PURE__ */ new Set();
10762
10962
  for (const row of rows) {
10763
10963
  if (seen.has(row.propertyId)) return "state-write-duplicate";
@@ -10792,6 +10992,14 @@ function validateStateWrites(properties, rows, payload, fieldNames, inputs, cons
10792
10992
  if (value.kind === "event" && value.path?.length && fieldNames.length && !value.path.every((name3) => fieldNames.includes(name3))) {
10793
10993
  return "state-write-incomplete";
10794
10994
  }
10995
+ const issue = writeEventIssue(
10996
+ value,
10997
+ payload,
10998
+ { dataType: property.dataType, cardinality: property.cardinality },
10999
+ functions
11000
+ );
11001
+ if (issue === "incomplete") return "state-write-incomplete";
11002
+ if (issue) return "state-write-type-mismatch";
10795
11003
  }
10796
11004
  return void 0;
10797
11005
  }
@@ -10823,7 +11031,7 @@ var valueExpression2 = (value, property, payload, storeProp, inputs, constants,
10823
11031
  property.dataType
10824
11032
  ) : read;
10825
11033
  };
10826
- function stateWritePatchExpression(properties, rows, payload, fieldNames, inputs, storeProp, constants = {}, eventRoot = "$event", scope = "template", eventMember, narrow) {
11034
+ function stateWritePatchExpression(properties, rows, payload, fieldNames, inputs, storeProp, constants = {}, eventRoot = "$event", scope = "template", eventMember, narrow, functions = {}) {
10827
11035
  if (!rows.length) return void 0;
10828
11036
  if (validateStateWrites(
10829
11037
  properties,
@@ -10831,7 +11039,8 @@ function stateWritePatchExpression(properties, rows, payload, fieldNames, inputs
10831
11039
  payload,
10832
11040
  fieldNames,
10833
11041
  inputs,
10834
- constants
11042
+ constants,
11043
+ functions
10835
11044
  )) {
10836
11045
  return void 0;
10837
11046
  }
@@ -10851,7 +11060,15 @@ function stateWritePatchExpression(properties, rows, payload, fieldNames, inputs
10851
11060
  eventMember
10852
11061
  );
10853
11062
  if (expr === void 0) return void 0;
10854
- const narrowed = narrow ? narrow(property, row.value, expr) : expr;
11063
+ const transformed = withEventTransform(
11064
+ row.value,
11065
+ expr,
11066
+ property.dataType,
11067
+ functions,
11068
+ constants,
11069
+ scope
11070
+ );
11071
+ const narrowed = narrow ? narrow(property, row.value, transformed) : transformed;
10855
11072
  members.push({
10856
11073
  name: property.name,
10857
11074
  text: `${property.name}: ${narrowed}`
@@ -10933,6 +11150,70 @@ function stampStatePropertyEnums(properties, controlMaps) {
10933
11150
  });
10934
11151
  return changed ? next : properties;
10935
11152
  }
11153
+ var featuresAsRead = (features, sharedShapes, screens) => withPropertyEnums(featuresInReach(features, sharedShapes), screens);
11154
+ function withPropertyEnums(features, screens) {
11155
+ let changed = false;
11156
+ const next = Object.fromEntries(
11157
+ Object.entries(features).map(([id, feature]) => {
11158
+ const controlMaps = screens.filter((screen) => screen.featureId === id).map((screen) => screen.controlMap);
11159
+ if (!controlMaps.length) return [id, feature];
11160
+ const properties = stampStatePropertyEnums(
11161
+ feature.properties,
11162
+ controlMaps
11163
+ );
11164
+ let subChanged = false;
11165
+ const subStores = feature.subStores ? Object.fromEntries(
11166
+ Object.entries(feature.subStores).map(([subId, sub]) => {
11167
+ const stamped = stampStatePropertyEnums(
11168
+ sub.properties,
11169
+ controlMaps
11170
+ );
11171
+ if (stamped === sub.properties) return [subId, sub];
11172
+ subChanged = true;
11173
+ return [subId, { ...sub, properties: stamped }];
11174
+ })
11175
+ ) : void 0;
11176
+ if (properties === feature.properties && !subChanged) {
11177
+ return [id, feature];
11178
+ }
11179
+ changed = true;
11180
+ return [
11181
+ id,
11182
+ { ...feature, properties, ...subChanged ? { subStores } : {} }
11183
+ ];
11184
+ })
11185
+ );
11186
+ return changed ? next : features;
11187
+ }
11188
+ var sameEntries = (a, b, same) => {
11189
+ if (a === b) return true;
11190
+ if (!a || !b) return false;
11191
+ const keys = Object.keys(a);
11192
+ return keys.length === Object.keys(b).length && keys.every((key2) => key2 in b && same(a[key2], b[key2]));
11193
+ };
11194
+ var sameFields = (a, b, deep = {}) => {
11195
+ if (a === b) return true;
11196
+ const keys = Object.keys(a);
11197
+ if (keys.length !== Object.keys(b).length) return false;
11198
+ return keys.every((key2) => {
11199
+ const same = deep[key2];
11200
+ return same ? key2 in b && same(a[key2], b[key2]) : a[key2] === b[key2];
11201
+ });
11202
+ };
11203
+ var sameProperty = (a, b) => sameFields(a, b, { dataType: (x, y) => sameFields(x, y) });
11204
+ var sameProperties = (a, b) => sameEntries(a, b, sameProperty);
11205
+ var sameFeaturesAsRead = (a, b) => sameEntries(
11206
+ a,
11207
+ b,
11208
+ (x, y) => sameFields(x, y, {
11209
+ properties: sameProperties,
11210
+ subStores: (p2, q) => sameEntries(
11211
+ p2,
11212
+ q,
11213
+ (s, t) => sameFields(s, t, { properties: sameProperties })
11214
+ )
11215
+ })
11216
+ );
10936
11217
 
10937
11218
  // libs/codegen/src/lib/output-call-helper.ts
10938
11219
  var OUTPUT_CALL_SEPARATOR = "|call:";
@@ -11145,12 +11426,13 @@ var outputArmBaseKey = (key2) => {
11145
11426
  const group = outputCallGroupKey(key2);
11146
11427
  return isOutputArmKey(group) ? group.slice(0, group.indexOf(OUTPUT_ARM_SEPARATOR)) : group;
11147
11428
  };
11148
- var OUTPUT_MAPS = [
11429
+ var OUTPUT_GROUP_MAPS = [
11149
11430
  "outputs",
11150
11431
  "outputScreenMethods",
11151
11432
  "outputArgs",
11152
11433
  "outputWrites",
11153
11434
  "outputScreenWrites",
11435
+ "outputEmits",
11154
11436
  "outputOutcomes",
11155
11437
  "outputOpens",
11156
11438
  "outputNavs",
@@ -11160,7 +11442,7 @@ var offersOutputArms = (control) => !!control && control.type !== "context_menu"
11160
11442
  var wiredArmIds = (control, output) => {
11161
11443
  if (!control) return [];
11162
11444
  const ids = /* @__PURE__ */ new Set();
11163
- OUTPUT_MAPS.forEach(
11445
+ OUTPUT_GROUP_MAPS.forEach(
11164
11446
  (map) => Object.keys(control[map] ?? {}).forEach((key2) => {
11165
11447
  if (isOutputArmKey(key2) && outputArmBaseKey(key2) === output) {
11166
11448
  ids.add(outputArmIdOf(key2));
@@ -11276,7 +11558,7 @@ var withArms = (control, output, arms) => {
11276
11558
  };
11277
11559
  var rowsAt = (control, key2) => {
11278
11560
  const held = {};
11279
- OUTPUT_MAPS.forEach((map) => {
11561
+ OUTPUT_GROUP_MAPS.forEach((map) => {
11280
11562
  const rows = control[map];
11281
11563
  if (rows && key2 in rows) held[map] = rows[key2];
11282
11564
  });
@@ -11285,7 +11567,7 @@ var rowsAt = (control, key2) => {
11285
11567
  var moveRows = (control, from, to) => {
11286
11568
  const held = rowsAt(control, from);
11287
11569
  const next = moveOutputCallRows(control, from, to);
11288
- OUTPUT_MAPS.forEach((map) => {
11570
+ OUTPUT_GROUP_MAPS.forEach((map) => {
11289
11571
  const rows = next[map];
11290
11572
  const has = rows && from in rows;
11291
11573
  if (!has && !(map in held)) return;
@@ -11295,11 +11577,11 @@ var moveRows = (control, from, to) => {
11295
11577
  });
11296
11578
  return next;
11297
11579
  };
11298
- var clearRows = (control, key2) => {
11580
+ var clearOutputGroupRows = (control, key2) => {
11299
11581
  const cleared = clearOutputCallRows(control, key2);
11300
11582
  const next = { ...cleared };
11301
11583
  let held = cleared !== control;
11302
- OUTPUT_MAPS.forEach((map) => {
11584
+ OUTPUT_GROUP_MAPS.forEach((map) => {
11303
11585
  const rows = cleared[map];
11304
11586
  if (!rows || !(key2 in rows)) return;
11305
11587
  const { [key2]: _dropped, ...rest } = rows;
@@ -11324,7 +11606,7 @@ function toDirectOutput(control, output) {
11324
11606
  const [first, ...rest] = arms;
11325
11607
  const kept = moveRows(control, outputArmKey(output, first.id), output);
11326
11608
  const cleared = rest.reduce(
11327
- (held, arm) => clearRows(held, outputArmKey(output, arm.id)),
11609
+ (held, arm) => clearOutputGroupRows(held, outputArmKey(output, arm.id)),
11328
11610
  kept
11329
11611
  );
11330
11612
  return withArms(cleared, output, []);
@@ -11396,7 +11678,7 @@ function removeOutputArm(control, output, armId) {
11396
11678
  output,
11397
11679
  arms.filter((arm) => arm.id !== armId)
11398
11680
  );
11399
- return clearRows(dropped, outputArmKey(output, armId));
11681
+ return clearOutputGroupRows(dropped, outputArmKey(output, armId));
11400
11682
  }
11401
11683
  var BLOCK_LIST_MAPS = {
11402
11684
  "state-write": "outputWrites",
@@ -11448,7 +11730,7 @@ function moveOutputBlock(control, from, block2, to) {
11448
11730
  [map]: writeKey(writeKey(all, from, void 0), to, row)
11449
11731
  };
11450
11732
  }
11451
- var outputGroupHoldsBlocks = (control, key2) => Object.keys(rowsAt(control, key2)).length > 0 || (control.outputEmits?.[key2]?.length ?? 0) > 0 || outputCallIds(control, key2).length > 0;
11733
+ var outputGroupHoldsBlocks = (control, key2) => Object.keys(rowsAt(control, key2)).length > 0 || outputCallIds(control, key2).length > 0;
11452
11734
  function tidyOutputArms(control, output) {
11453
11735
  let next = control;
11454
11736
  for (const arm of outputArms(next, output)) {
@@ -12236,22 +12518,11 @@ var baseOutputName = (key2) => {
12236
12518
  const base = outputArmBaseKey(key2);
12237
12519
  return isMenuActionKey(base) ? MENU_ACTION_OUTPUT : base;
12238
12520
  };
12239
- var OUTPUT_MAPS2 = [
12240
- "outputs",
12241
- "outputScreenMethods",
12242
- "outputArgs",
12243
- "outputWrites",
12244
- "outputScreenWrites",
12245
- "outputOutcomes",
12246
- "outputOpens",
12247
- "outputNavs",
12248
- "outputNewTabs"
12249
- ];
12250
12521
  var wiresMenuActions = (control) => control?.type === "context_menu" /* CONTEXT_MENU */;
12251
12522
  var wiredKeys = (control) => {
12252
12523
  if (!control) return [];
12253
12524
  const keys = /* @__PURE__ */ new Set();
12254
- OUTPUT_MAPS2.forEach(
12525
+ OUTPUT_GROUP_MAPS.forEach(
12255
12526
  (map) => Object.keys(control[map] ?? {}).forEach((key2) => {
12256
12527
  if (isMenuActionKey(key2)) keys.add(outputCallGroupKey(key2));
12257
12528
  })
@@ -12348,21 +12619,7 @@ function removeMenuActionSlot(control, slotId) {
12348
12619
  control,
12349
12620
  slots.filter((slot) => slot.id !== slotId)
12350
12621
  );
12351
- return clearMenuActionRows(dropped, slotId);
12352
- }
12353
- function clearMenuActionRows(control, slotId) {
12354
- const key2 = menuActionKey(slotId);
12355
- const cleared = clearOutputCallRows(control, key2);
12356
- const next = { ...cleared };
12357
- let held = cleared !== control;
12358
- OUTPUT_MAPS2.forEach((map) => {
12359
- const rows = cleared[map];
12360
- if (!rows || !(key2 in rows)) return;
12361
- const { [key2]: _dropped, ...rest } = rows;
12362
- next[map] = Object.keys(rest).length ? rest : void 0;
12363
- held = true;
12364
- });
12365
- return held ? next : control;
12622
+ return clearOutputGroupRows(dropped, menuActionKey(slotId));
12366
12623
  }
12367
12624
  function renameMenuItemId(control, from, to) {
12368
12625
  const before = from.trim();
@@ -13188,9 +13445,9 @@ ${" ".repeat(depth)}}` : "{}";
13188
13445
  }
13189
13446
  var LITERAL_SOURCE = "=";
13190
13447
  function literalType(value) {
13191
- const text2 = value.trim();
13192
- if (text2 === "true" || text2 === "false") return { type: "boolean" };
13193
- if (text2 !== "" && !Number.isNaN(Number(text2))) return { type: "number" };
13448
+ const text3 = value.trim();
13449
+ if (text3 === "true" || text3 === "false") return { type: "boolean" };
13450
+ if (text3 !== "" && !Number.isNaN(Number(text3))) return { type: "number" };
13194
13451
  return { type: "string" };
13195
13452
  }
13196
13453
  function validateLiteral(value, dataType, cardinality) {
@@ -13204,11 +13461,11 @@ function validateLiteral(value, dataType, cardinality) {
13204
13461
  return is === dataType.type ? void 0 : "value-type-mismatch";
13205
13462
  }
13206
13463
  function literalExpression(value, dataType) {
13207
- const text2 = String(value ?? "").trim();
13208
- const type = dataType?.type ?? literalType(text2).type;
13209
- if (type === "boolean") return text2 === "true" ? "true" : "false";
13210
- if (type === "number") return String(Number(text2) || 0);
13211
- return `'${text2.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
13464
+ const text3 = String(value ?? "").trim();
13465
+ const type = dataType?.type ?? literalType(text3).type;
13466
+ if (type === "boolean") return text3 === "true" ? "true" : "false";
13467
+ if (type === "number") return String(Number(text3) || 0);
13468
+ return `'${text3.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
13212
13469
  }
13213
13470
  function fixedExpression(value, dataType, cardinality) {
13214
13471
  if (cardinality !== "many") return literalExpression(value, dataType);
@@ -13561,7 +13818,11 @@ var persistRoots = (persists) => (persists ?? []).filter(
13561
13818
  ).map((persist) => ({
13562
13819
  id: persist.source?.[0],
13563
13820
  path: persist.source
13564
- }));
13821
+ })).concat(
13822
+ (persists ?? []).flatMap(
13823
+ (persist) => persist.sourceKind === "function" && persist.transform ? transformRoots2(persist.transform) : []
13824
+ )
13825
+ );
13565
13826
  function methodReaders(method, owner, into) {
13566
13827
  const push = (read, kind) => {
13567
13828
  if (read.id) into.push(readerOf(owner, kind, method.name, read));
@@ -13700,6 +13961,7 @@ var subStorePropName = (suffix) => camelOf(suffix);
13700
13961
  function subStoreSuffixError(feature, suffix, ignoreId) {
13701
13962
  if (!suffix) return "sub-store-name-empty";
13702
13963
  if (!isValidSlug(suffix)) return "sub-store-name-invalid";
13964
+ if (suffix === MAIN_STORE_VALUE) return "sub-store-name-reserved";
13703
13965
  const taken = subStoresOf(feature).some(
13704
13966
  (subStore) => subStore.name === suffix && subStore.id !== ignoreId
13705
13967
  );
@@ -14424,6 +14686,10 @@ var canAppendFormatPipe = (control, name3, headType) => {
14424
14686
  }
14425
14687
  return sameDataType(flowing, entry2.inputType);
14426
14688
  };
14689
+ var labelHeadType = (control, scope) => {
14690
+ const binding = control?.bindings?.[BINDING_SLOT.label];
14691
+ return binding ? emittedDataType(binding, scope) : void 0;
14692
+ };
14427
14693
  var appendableFormatPipes = (control, headType) => FORMAT_PIPE_CATALOG.filter(
14428
14694
  (entry2) => canAppendFormatPipe(control, entry2.name, headType)
14429
14695
  );
@@ -14564,8 +14830,8 @@ var bindingDisplayText = (binding, scope) => {
14564
14830
  return store ? `${store}.${path}` : path;
14565
14831
  };
14566
14832
  var bindingCanvasText = (binding, scope) => {
14567
- const text2 = bindingDisplayText(binding, scope);
14568
- return text2 ? `{${text2}}` : "";
14833
+ const text3 = bindingDisplayText(binding, scope);
14834
+ return text3 ? `{${text3}}` : "";
14569
14835
  };
14570
14836
  var applyBindingText = (tree, controlMap, scope) => {
14571
14837
  const applyToNode = (node) => {
@@ -14579,10 +14845,10 @@ var applyBindingText = (tree, controlMap, scope) => {
14579
14845
  }
14580
14846
  const bindingText = Object.fromEntries(
14581
14847
  Object.entries(bindings).map(([slot, binding]) => {
14582
- const text2 = bindingCanvasText(binding, scope);
14848
+ const text3 = bindingCanvasText(binding, scope);
14583
14849
  return [
14584
14850
  slot,
14585
- slot === "label" && pipes && text2 ? `${text2.slice(0, -1)}${pipes}}` : text2
14851
+ slot === "label" && pipes && text3 ? `${text3.slice(0, -1)}${pipes}}` : text3
14586
14852
  ];
14587
14853
  })
14588
14854
  );
@@ -15118,21 +15384,21 @@ function validateTranslationKey(raw, existing, libraryKeys) {
15118
15384
  if (existing[key2] !== void 0) return "translation-key-taken";
15119
15385
  return void 0;
15120
15386
  }
15121
- function slugifyMessage(text2) {
15122
- return text2.trim().toLowerCase().replace(/<\$?\w+>/g, " ").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, TRANSLATION_KEY_MAX_LENGTH).replace(/-+$/, "");
15387
+ function slugifyMessage(text3) {
15388
+ return text3.trim().toLowerCase().replace(/<\$?\w+>/g, " ").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, TRANSLATION_KEY_MAX_LENGTH).replace(/-+$/, "");
15123
15389
  }
15124
- function extractMessageVariables(text2) {
15125
- if (!text2) return [];
15390
+ function extractMessageVariables(text3) {
15391
+ if (!text3) return [];
15126
15392
  const found = /* @__PURE__ */ new Set();
15127
- for (const match of text2.matchAll(MESSAGE_VARIABLE_PATTERN)) {
15393
+ for (const match of text3.matchAll(MESSAGE_VARIABLE_PATTERN)) {
15128
15394
  found.add(match[1]);
15129
15395
  }
15130
15396
  return Array.from(found);
15131
15397
  }
15132
- function extractAllVariables(text2) {
15133
- if (!text2) return [];
15398
+ function extractAllVariables(text3) {
15399
+ if (!text3) return [];
15134
15400
  const found = /* @__PURE__ */ new Map();
15135
- for (const match of text2.matchAll(ANY_VARIABLE_PATTERN)) {
15401
+ for (const match of text3.matchAll(ANY_VARIABLE_PATTERN)) {
15136
15402
  const name3 = match[2];
15137
15403
  if (!found.has(name3)) {
15138
15404
  found.set(name3, { name: name3, translated: match[1] === "$" });
@@ -15201,7 +15467,14 @@ function collectTranslationAssets(controlMap, translations, extraKeys = []) {
15201
15467
  return Array.from(referenced).filter((key2) => translations[key2]).sort().map((key2) => ({
15202
15468
  path: translationAssetPath(key2),
15203
15469
  key: key2,
15204
- langs: translations[key2]
15470
+ // Languages in code order: the map holds them in the order they were
15471
+ // translated, which differs between a fresh translate and one read back
15472
+ // from disk, and the file would reorder with nothing changed.
15473
+ langs: Object.fromEntries(
15474
+ Object.entries(translations[key2]).sort(
15475
+ ([a], [b]) => a < b ? -1 : a > b ? 1 : 0
15476
+ )
15477
+ )
15205
15478
  }));
15206
15479
  }
15207
15480
  function variableDrift(sourceText, langText) {
@@ -15215,8 +15488,8 @@ function variableDrift(sourceText, langText) {
15215
15488
  function hasVariableDrift(drift) {
15216
15489
  return drift.missing.length > 0 || drift.unknown.length > 0;
15217
15490
  }
15218
- var extractMarkdownLinkUrls = (text2) => Array.from(
15219
- text2?.matchAll(MARKDOWN_LINK_URL_PATTERN) ?? [],
15491
+ var extractMarkdownLinkUrls = (text3) => Array.from(
15492
+ text3?.matchAll(MARKDOWN_LINK_URL_PATTERN) ?? [],
15220
15493
  (match) => match[1]
15221
15494
  );
15222
15495
  var unmatched = (expected, actual) => {
@@ -15288,9 +15561,9 @@ function pruneOrphanMessageBindings(control, translations) {
15288
15561
  typeof value === "string" ? value : void 0
15289
15562
  );
15290
15563
  if (!key2) continue;
15291
- const text2 = translations[key2]?.[SOURCE_LANG];
15292
- if (text2 === void 0) return control;
15293
- extractAllVariables(text2).forEach(({ name: name3 }) => named.add(name3));
15564
+ const text3 = translations[key2]?.[SOURCE_LANG];
15565
+ if (text3 === void 0) return control;
15566
+ extractAllVariables(text3).forEach(({ name: name3 }) => named.add(name3));
15294
15567
  }
15295
15568
  const kept = Object.entries(bindings).filter(
15296
15569
  ([slot]) => !isMessageSlot(slot) || named.has(messageSlotName(slot))
@@ -15618,8 +15891,8 @@ function outcomeFormIds(outcome, controls) {
15618
15891
  }
15619
15892
 
15620
15893
  // libs/codegen/src/lib/card-codegen.ts
15621
- var camelCase = (text2, fallback = "card") => {
15622
- const parts = text2.split(/[^A-Za-z0-9]+/).filter(Boolean);
15894
+ var camelCase = (text3, fallback = "card") => {
15895
+ const parts = text3.split(/[^A-Za-z0-9]+/).filter(Boolean);
15623
15896
  const name3 = parts.map(
15624
15897
  (part, index) => index === 0 ? part.charAt(0).toLowerCase() + part.slice(1) : part.charAt(0).toUpperCase() + part.slice(1)
15625
15898
  ).join("");
@@ -16317,11 +16590,56 @@ function patchLiteral(mappings, properties, shapes, functions, subject, cast = f
16317
16590
  return { declarations, statements };
16318
16591
  }
16319
16592
  var castRead = (read, cast, type) => cast ? `(${read} as ${type} | undefined)` : read;
16320
- function persistStatements(method, timing, subject, storage, roots, shapes, receiverOf = OWN_STORE) {
16593
+ var persistAsMapping = (persist) => ({
16594
+ code: "",
16595
+ propertyId: persist.propertyId ?? "",
16596
+ source: [],
16597
+ ...persist.transform ? { transform: persist.transform } : {}
16598
+ });
16599
+ var persistFunctionEmits = (persist, method, roots, context) => !!persist.transform && persist.transform.args.every((arg) => arg.source !== "response") && !outcomeTransformError(
16600
+ persistAsMapping(persist),
16601
+ method,
16602
+ context.op,
16603
+ roots,
16604
+ context.lookup,
16605
+ context.functions,
16606
+ roots
16607
+ );
16608
+ function persistStatements(method, timing, subject, storage, roots, shapes, receiverOf = OWN_STORE, context) {
16321
16609
  return (method.persists ?? []).filter(
16322
16610
  (persist) => (persist.shelf === "store" ? !!roots[persist.propertyId ?? ""] && persistSourceKind(persist) !== "state" : !!persist.key.trim()) && (persist.timing ?? "after") === timing && !(timing === "before" && (persist.sourceKind ?? "state") === "response")
16323
- ).map((persist) => {
16611
+ ).filter((persist) => {
16612
+ const kind = persistSourceKind(persist);
16613
+ if (kind !== "clear" && kind !== "function") return true;
16614
+ if (timing !== "before" || persist.shelf !== "store") return false;
16615
+ return kind === "clear" || !!context && persistFunctionEmits(persist, method, roots, context);
16616
+ }).flatMap((persist) => {
16324
16617
  const target = persist.shelf === "store" ? roots[persist.propertyId ?? ""] : void 0;
16618
+ const kind = persistSourceKind(persist);
16619
+ if (target && kind === "clear") {
16620
+ return [`patchState(${receiverOf(target.id)}, { ${target.name}: undefined });`];
16621
+ }
16622
+ if (target && kind === "function" && context) {
16623
+ const patch = patchLiteral(
16624
+ [persistAsMapping(persist)],
16625
+ roots,
16626
+ context.lookup,
16627
+ context.functions,
16628
+ subject,
16629
+ false,
16630
+ roots,
16631
+ context.taken,
16632
+ receiverOf,
16633
+ NO_GATE,
16634
+ context.stateType,
16635
+ context.oneFunctionNames,
16636
+ context.spelledShapes
16637
+ );
16638
+ return [
16639
+ ...patch.declarations,
16640
+ ...patch.statements.map((statement) => `${statement};`)
16641
+ ];
16642
+ }
16325
16643
  const setter = persist.shelf === "session" ? "setSession" : "setLocal";
16326
16644
  const sourceKind = persist.sourceKind ?? (timing === "before" ? "state" : "response");
16327
16645
  const read = sourceKind === "state" ? statePathExpression(
@@ -16635,7 +16953,6 @@ function generateStoreMethods(methods, operationOf, properties, shapes, function
16635
16953
  return `${a.name}: ${type}${narrowed ? "" : " | undefined"}`;
16636
16954
  }), ...callbackMembers].join("; ")} }${settleOnly ? " | void" : ""}`;
16637
16955
  const argType = argObjectType(false);
16638
- const argName = args.length === 0 ? "()" : `({ ${args.map((a) => a.name).join(", ")} })`;
16639
16956
  const sent = sentParams(method, op);
16640
16957
  const callArgs = sent.map(
16641
16958
  (p2) => paramExpression(
@@ -16748,6 +17065,15 @@ function generateStoreMethods(methods, operationOf, properties, shapes, function
16748
17065
  oneFunctionNames,
16749
17066
  argShapes
16750
17067
  );
17068
+ const persistContext = {
17069
+ op,
17070
+ functions,
17071
+ lookup,
17072
+ taken,
17073
+ stateType,
17074
+ oneFunctionNames,
17075
+ spelledShapes: argShapes
17076
+ };
16751
17077
  const beforePersists = persistStatements(
16752
17078
  method,
16753
17079
  "before",
@@ -16755,7 +17081,8 @@ function generateStoreMethods(methods, operationOf, properties, shapes, function
16755
17081
  "storage",
16756
17082
  roots,
16757
17083
  shapes,
16758
- receiverOf
17084
+ receiverOf,
17085
+ persistContext
16759
17086
  );
16760
17087
  const afterPersists = persistStatements(
16761
17088
  method,
@@ -16995,7 +17322,14 @@ ${failureArms.map(
16995
17322
  (binding) => binding.source === "compute" && binding.name === compute.name
16996
17323
  )
16997
17324
  );
16998
- if (readByKept || readsCompute(compute.name)) computes.unshift(compute);
17325
+ const readByPersist = (method.persists ?? []).some(
17326
+ (persist) => persistSourceKind(persist) === "function" && (persist.transform?.args ?? []).some(
17327
+ (binding) => binding.source === "compute" && binding.name === compute.name
17328
+ )
17329
+ );
17330
+ if (readByKept || readByPersist || readsCompute(compute.name)) {
17331
+ computes.unshift(compute);
17332
+ }
16999
17333
  }
17000
17334
  const computeGuards = [];
17001
17335
  let computeGuardsReadArgs = false;
@@ -17113,11 +17447,23 @@ ${confirmOptions(
17113
17447
  emitsModal = true;
17114
17448
  if (confirmHandsBack) emitsMap = true;
17115
17449
  }
17116
- const beforeUsesArgs = (method.persists ?? []).some(
17117
- (persist) => (persist.timing ?? "after") === "before" && persistSourceKind(persist) === "args" && (persist.shelf === "store" ? !!roots[persist.propertyId ?? ""] : !!persist.key.trim())
17450
+ const beforeRows = (method.persists ?? []).filter(
17451
+ (persist) => (persist.timing ?? "after") === "before" && (persist.shelf === "store" ? !!roots[persist.propertyId ?? ""] : !!persist.key.trim())
17452
+ );
17453
+ const beforeBindings = beforeRows.filter(
17454
+ (persist) => persistSourceKind(persist) === "function" && persist.shelf === "store" && persistFunctionEmits(persist, method, roots, persistContext)
17455
+ ).flatMap((persist) => persist.transform?.args ?? []);
17456
+ const beforeUsesArgs = args.length > 0 && (beforeRows.some((persist) => persistSourceKind(persist) === "args") || beforeBindings.some((binding) => binding.source === "args"));
17457
+ const beforeUsesCompute = beforeBindings.some(
17458
+ (binding) => binding.source === "compute"
17118
17459
  );
17460
+ const beforeNames = [
17461
+ ...beforeUsesArgs ? args.map((a) => a.name) : [],
17462
+ ...beforeUsesCompute ? ["compute"] : []
17463
+ ];
17464
+ const beforeArg = beforeNames.length ? `({ ${beforeNames.join(", ")} })` : "()";
17119
17465
  const beforeBlock = beforePersists.length ? `
17120
- tap(${beforeUsesArgs ? argName : "()"} => {
17466
+ tap(${beforeArg} => {
17121
17467
  ${beforePersists.map((line) => ` ${line}`).join("\n")}
17122
17468
  }),` : "";
17123
17469
  const callReadsCompute = computes.some(
@@ -17229,6 +17575,8 @@ ${beforePersists.map((line) => ` ${line}`).join("\n")}
17229
17575
  new Set(
17230
17576
  list.flatMap((method) => [
17231
17577
  ...method.response.map((mapping) => mapping.transform?.functionId).filter((id) => !!id && !!functions[id]),
17578
+ // A `before` Store row's function is spelled in the same file.
17579
+ ...(method.persists ?? []).filter((persist) => persistSourceKind(persist) === "function").map((persist) => persist.transform?.functionId).filter((id) => !!id && !!functions[id]),
17232
17580
  // The store file spells an input's transforms too, so a
17233
17581
  // PureFunction one names is imported beside the ones an outcome
17234
17582
  // names — a call the file never imported is the one thing worse
@@ -17925,127 +18273,15 @@ function pruneOutputLinkArgs(control, drop) {
17925
18273
  return dropped;
17926
18274
  }
17927
18275
 
17928
- // libs/codegen/src/lib/tree-helper.ts
17929
- function buildTree(controlMap, rootControlIds, selection) {
17930
- const state = (id) => selection ? variantRenderState(id, controlMap, selection) : "solid";
17931
- const resolveDirectives = (ctrl) => {
17932
- if (!ctrl.directives) return void 0;
17933
- const resolved = {};
17934
- for (const [name3, directive] of Object.entries(ctrl.directives)) {
17935
- if (directive.overlayId) {
17936
- const overlay = controlMap[directive.overlayId];
17937
- if (overlay) {
17938
- resolved[name3] = {
17939
- overlayId: directive.overlayId,
17940
- type: overlay.type,
17941
- configs: overlay.configs
17942
- };
17943
- }
17944
- } else {
17945
- resolved[name3] = { configs: directive.configs ?? {} };
17946
- }
17947
- }
17948
- return Object.keys(resolved).length > 0 ? resolved : void 0;
17949
- };
17950
- const toNode = (ctrl) => {
17951
- const childrens = getChildren(ctrl.id);
17952
- const fullyFaded = state(ctrl.id) === "faded" && childrens.every((child) => child.faded);
17953
- return {
17954
- type: ctrl.type,
17955
- id: ctrl.id,
17956
- configs: ctrl.configs,
17957
- childrens,
17958
- directives: resolveDirectives(ctrl),
17959
- ...ctrl.source ? { source: ctrl.source } : {},
17960
- ...ctrl.variants?.length ? { variants: ctrl.variants } : {},
17961
- // Carried through so renderBranch can order the `@else` last and spell it
17962
- // without reaching back into ControlMap mid-walk (GLOSSARY.md DefaultArm).
17963
- ...ctrl.armKind ? { armKind: ctrl.armKind } : {},
17964
- ...ctrl.variantKind ? { variantKind: ctrl.variantKind } : {},
17965
- ...ctrl.outputs && Object.keys(ctrl.outputs).length ? { outputs: ctrl.outputs } : {},
17966
- ...ctrl.outputArgs && Object.keys(ctrl.outputArgs).length ? { outputArgs: ctrl.outputArgs } : {},
17967
- ...ctrl.outputWrites && Object.keys(ctrl.outputWrites).length ? { outputWrites: ctrl.outputWrites } : {},
17968
- ...ctrl.outputEmits && Object.keys(ctrl.outputEmits).length ? { outputEmits: ctrl.outputEmits } : {},
17969
- ...ctrl.outputScreenWrites && Object.keys(ctrl.outputScreenWrites).length ? { outputScreenWrites: ctrl.outputScreenWrites } : {},
17970
- ...ctrl.outputOpens && Object.keys(ctrl.outputOpens).length ? { outputOpens: ctrl.outputOpens } : {},
17971
- ...ctrl.outputNavs && Object.keys(ctrl.outputNavs).length ? { outputNavs: ctrl.outputNavs } : {},
17972
- ...ctrl.outputNewTabs && Object.keys(ctrl.outputNewTabs).length ? { outputNewTabs: ctrl.outputNewTabs } : {},
17973
- ...ctrl.outputOutcomes && Object.keys(ctrl.outputOutcomes).length ? { outputOutcomes: ctrl.outputOutcomes } : {},
17974
- // Without this the codegen walk reads `outputArms` off a Tree that never
17975
- // carried it, every gated output falls back to ungated, and its groups —
17976
- // filed under `<output>|arm:<armId>` — are skipped as qualified keys. The
17977
- // output emits nothing at all (GLOSSARY.md OutputArm).
17978
- ...ctrl.outputArms && Object.keys(ctrl.outputArms).length ? { outputArms: ctrl.outputArms } : {},
17979
- // Without this every group fires its first call alone: the rest are
17980
- // filed under `<group>|call:<callId>` and read in the order this holds
17981
- // (GLOSSARY.md OutputCall).
17982
- ...ctrl.outputCalls && Object.keys(ctrl.outputCalls).length ? { outputCalls: ctrl.outputCalls } : {},
17983
- ...ctrl.outputScreenMethods && Object.keys(ctrl.outputScreenMethods).length ? { outputScreenMethods: ctrl.outputScreenMethods } : {},
17984
- ...ctrl.menuActions?.length ? { menuActions: ctrl.menuActions } : {},
17985
- ...ctrl.screenId ? { screenId: ctrl.screenId } : {},
17986
- // The other answer to what a ScreenControl mounts (ADR 0088). Carried
17987
- // for `screenId`'s reason: the Canvas labels its placeholder from it and
17988
- // codegen emits its tag.
17989
- ...ctrl.handRef ? { handRef: ctrl.handRef } : {},
17990
- ...ctrl.screenInputs && Object.keys(ctrl.screenInputs).length ? { screenInputs: ctrl.screenInputs } : {},
17991
- // Carried for `screenId`'s reason: the Canvas draws the embed's box at
17992
- // it and codegen emits it on the tag.
17993
- ...ctrl.maxWidth ? { maxWidth: ctrl.maxWidth } : {},
17994
- ...ctrl.checks?.length ? { checks: ctrl.checks } : {},
17995
- ...ctrl.formatPipes?.length ? { formatPipes: ctrl.formatPipes } : {},
17996
- ...ctrl.cards ? { cards: ctrl.cards } : {},
17997
- ...ctrl.search ? { search: ctrl.search } : {},
17998
- // A Repeat's row count, carried for `cards`' reason: the Canvas draws
17999
- // its sample rows from the Tree alone. Nothing else reads it — codegen
18000
- // never emits a count (GLOSSARY.md SampleValue).
18001
- ...ctrl.repeat?.sampleRows !== void 0 ? { sampleRows: ctrl.repeat.sampleRows } : {},
18002
- ...fullyFaded ? { faded: true } : {}
18003
- };
18004
- };
18005
- const getChildren = (parentId) => {
18006
- const parent = controlMap[parentId];
18007
- if (!parent || !parent.childrens) return [];
18008
- return parent.childrens.map((childId) => controlMap[childId]).filter(Boolean).filter((ctrl) => state(ctrl.id) !== "hidden").map(toNode);
18009
- };
18010
- const tree = rootControlIds.map((id) => controlMap[id]).filter(Boolean).filter((ctrl) => state(ctrl.id) !== "hidden").map(toNode);
18011
- return selection ? markFadedRoots(tree) : tree;
18012
- }
18013
- function markFadedRoots(nodes, underFaded = false) {
18014
- return nodes.map((node) => {
18015
- const faded = !underFaded && node.faded;
18016
- const next = {
18017
- ...node,
18018
- childrens: markFadedRoots(node.childrens, underFaded || !!node.faded)
18019
- };
18020
- if (faded) {
18021
- next.faded = true;
18022
- } else {
18023
- delete next.faded;
18024
- }
18025
- return next;
18026
- });
18027
- }
18028
-
18029
18276
  // libs/codegen/src/lib/enum-label-helper.ts
18030
- function enumLabels(controlMap, rootControlIds, properties = {}) {
18031
- const names = new Map(
18032
- controlEnums([
18033
- { tree: buildTree(controlMap, rootControlIds), controlMap }
18034
- ]).map((entry2) => [entry2.id, entry2.name])
18035
- );
18036
- const stamped = stampStatePropertyEnums(properties, [controlMap]);
18277
+ function enumLabels(enums, controlMap, properties = {}) {
18278
+ const names = new Map(enums.map((entry2) => [entry2.id, entry2.name]));
18037
18279
  const control = (controlId) => names.get(controlId);
18280
+ const named = (id) => id ? control(id) : void 0;
18038
18281
  return {
18039
18282
  control,
18040
- variable: (variable) => {
18041
- const id = screenVariableEnumId(controlMap, variable);
18042
- return id ? control(id) : void 0;
18043
- },
18044
- property: (property) => {
18045
- const dataType = (stamped[property.id] ?? property).dataType;
18046
- const id = dataType.actionEnumId ?? dataType.sortEnumId;
18047
- return id ? control(id) : void 0;
18048
- }
18283
+ variable: (variable) => named(screenVariableEnumId(controlMap, variable)),
18284
+ property: (property) => named(enumIdOf((properties[property.id] ?? property).dataType))
18049
18285
  };
18050
18286
  }
18051
18287
  function enumMemberLabel(key2) {
@@ -18064,8 +18300,8 @@ function emitEnumFile(appEnum) {
18064
18300
  const asString2 = appEnum.hasValue && appEnum.valueType === "string";
18065
18301
  const members = appEnum.members.map((m, index) => {
18066
18302
  if (asString2) {
18067
- const text2 = typeof m.value === "string" ? m.value : m.key;
18068
- const quoted = `'${text2.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
18303
+ const text3 = typeof m.value === "string" ? m.value : m.key;
18304
+ const quoted = `'${text3.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
18069
18305
  return ` ${m.key} = ${quoted},`;
18070
18306
  }
18071
18307
  const own = appEnum.hasValue && typeof m.value === "number";
@@ -18451,6 +18687,9 @@ function outputOpenStatement(open, ref, inputEntries, indent2, answer, outputs =
18451
18687
  `as: '${open.as}',`,
18452
18688
  `widget: () =>`,
18453
18689
  ` import('${ref.importFrom}').then((m) => m.${ref.className}),`,
18690
+ // The loader above is a new function every call; the name is what tells
18691
+ // a SidePanel already holding this Screen apart (libs/one SidePanel).
18692
+ ...open.as === "side_panel" ? [`screen: '${ref.className}',`] : [],
18454
18693
  ...inputEntries.length ? ["inputs: {", ...inputEntries.map((entry2) => ` ${entry2},`), "},"] : [],
18455
18694
  ...settings.filter(Boolean)
18456
18695
  ];
@@ -19547,14 +19786,14 @@ var searchEmit = (node, control, screenRef) => {
19547
19786
  if (!screenId) return void 0;
19548
19787
  const ref = screenRef?.(screenId);
19549
19788
  if (!ref) return void 0;
19550
- const text2 = listScreenInputs(ref.inputs).find(
19789
+ const text3 = listScreenInputs(ref.inputs).find(
19551
19790
  (declared) => declared.origin === "search"
19552
19791
  );
19553
- if (!text2) return void 0;
19792
+ if (!text3) return void 0;
19554
19793
  const elementMember = searchMemberName(ref.component);
19555
19794
  return {
19556
19795
  elementMember,
19557
- resultInput: text2.name,
19796
+ resultInput: text3.name,
19558
19797
  block: `
19559
19798
  protected readonly ${elementMember} = ${ref.component};
19560
19799
  `,
@@ -19713,8 +19952,83 @@ function countIconReferences(controlMap, name3) {
19713
19952
  var fieldChecks = (control) => control?.checks ?? [];
19714
19953
  var checkKind = (check) => check.kind ?? "function";
19715
19954
  var takesLimit = (kind) => LIMIT_CHECK_KINDS.includes(kind);
19955
+ var limitSourceOf = (check) => check.limitSource ?? "fixed";
19956
+ var isNumberScalar = (dataType, cardinality) => dataType?.type === "number" && (cardinality ?? "one") === "one";
19957
+ function limitSources(scope) {
19958
+ const map = {};
19959
+ const add = (entry2) => {
19960
+ map[entry2.id] = entry2;
19961
+ };
19962
+ const functions = scope.functions ?? {};
19963
+ const storeProp = (id) => {
19964
+ const prop = scope.storePropOf?.(id);
19965
+ return prop ? { storeProp: prop } : {};
19966
+ };
19967
+ Object.values(scope.inputs ?? {}).forEach((input) => {
19968
+ if (isNumberScalar(input.dataType, input.cardinality))
19969
+ add({ id: input.id, name: input.name, source: "screen", read: "signal" });
19970
+ });
19971
+ Object.values(scope.constants ?? {}).forEach((constant) => {
19972
+ if (constant.dataType === "number")
19973
+ add({
19974
+ id: constant.id,
19975
+ name: constant.name,
19976
+ source: "screen",
19977
+ read: "plain"
19978
+ });
19979
+ });
19980
+ Object.values(scope.variables ?? {}).forEach((variable) => {
19981
+ if (variable.dataType === "number" && variable.cardinality === "one")
19982
+ add({
19983
+ id: variable.id,
19984
+ name: variable.name,
19985
+ source: "screen",
19986
+ read: "signal"
19987
+ });
19988
+ });
19989
+ Object.values(scope.screenComputeds ?? {}).forEach((computed) => {
19990
+ const fn = computed.functionId ? functions[computed.functionId] : void 0;
19991
+ const held = fn ? { dataType: fn.returnType, cardinality: returnCardinalityOf(fn) } : computed.returns;
19992
+ if (held && isNumberScalar(held.dataType, held.cardinality))
19993
+ add({
19994
+ id: computed.id,
19995
+ name: computed.name,
19996
+ source: "screen",
19997
+ read: "signal"
19998
+ });
19999
+ });
20000
+ Object.values(scope.properties ?? {}).forEach((property) => {
20001
+ if (isNumberScalar(property.dataType, property.cardinality))
20002
+ add({
20003
+ id: property.id,
20004
+ name: property.name,
20005
+ source: "state",
20006
+ read: "signal",
20007
+ ...storeProp(property.id)
20008
+ });
20009
+ });
20010
+ Object.values(scope.computeds ?? {}).forEach((computed) => {
20011
+ const fn = functions[computed.functionId];
20012
+ if (fn && isNumberScalar(fn.returnType, returnCardinalityOf(fn)))
20013
+ add({
20014
+ id: computed.id,
20015
+ name: computed.name,
20016
+ source: "state",
20017
+ read: "signal",
20018
+ ...storeProp(computed.id)
20019
+ });
20020
+ });
20021
+ return map;
20022
+ }
20023
+ var limitSourceFor = (check, sources) => {
20024
+ const source = limitSourceOf(check);
20025
+ if (source === "fixed" || !check.limitRef) return void 0;
20026
+ const entry2 = sources[check.limitRef];
20027
+ return entry2?.source === source ? entry2 : void 0;
20028
+ };
20029
+ var isLimitDrawn = (check, sources = {}) => limitSourceOf(check) === "fixed" ? typeof check.limit === "number" && Number.isFinite(check.limit) : !!limitSourceFor(check, sources);
19716
20030
  var isBooleanStateProperty = (property) => property?.dataType.type === "boolean" && property.cardinality === "one";
19717
- var isCheckComplete = (check, functions, controlMap = {}, properties = {}) => {
20031
+ var isCheckComplete = (check, functions, controlMap = {}, properties = {}, sources = {}) => {
19718
20032
  const kind = checkKind(check);
19719
20033
  if (kind === "function") {
19720
20034
  const fn = functions[check.functionId];
@@ -19727,9 +20041,7 @@ var isCheckComplete = (check, functions, controlMap = {}, properties = {}) => {
19727
20041
  return !!bound && controlMap[bound]?.type === "field" /* FIELD */;
19728
20042
  });
19729
20043
  }
19730
- if (takesLimit(kind)) {
19731
- return typeof check.limit === "number" && Number.isFinite(check.limit);
19732
- }
20044
+ if (takesLimit(kind)) return isLimitDrawn(check, sources);
19733
20045
  if (kind === "matchField") {
19734
20046
  const target = check.matchFieldId ? controlMap[check.matchFieldId] : void 0;
19735
20047
  return target?.type === "field" /* FIELD */;
@@ -19838,13 +20150,14 @@ var STOCK_VALIDATOR = {
19838
20150
  minAge: "minAgeValidation",
19839
20151
  matchField: "matchFieldValidation"
19840
20152
  };
19841
- function stockStatement(kind, check, fieldName, controlMap) {
20153
+ function stockStatement(kind, check, fieldName, controlMap, limitRead) {
19842
20154
  const call = STOCK_VALIDATOR[kind];
20155
+ const limit = limitRead ? `state.${limitRead.name}` : `${check.limit}`;
19843
20156
  if (kind === "email" || kind === "url") {
19844
20157
  return ` ${call}(tree['${fieldName}'] as SchemaPath<string>);`;
19845
20158
  }
19846
20159
  if (kind === "minAge") {
19847
- return ` ${call}(tree['${fieldName}'] as SchemaPath<string>, ${check.limit});`;
20160
+ return ` ${call}(tree['${fieldName}'] as SchemaPath<string>, ${limit});`;
19848
20161
  }
19849
20162
  if (kind === "matchField") {
19850
20163
  const target = check.matchFieldId ? controlMap[check.matchFieldId] : void 0;
@@ -19863,14 +20176,15 @@ function stockStatement(kind, check, fieldName, controlMap) {
19863
20176
  ` );`
19864
20177
  ].join("\n");
19865
20178
  }
19866
- return ` ${call}(tree, ['${fieldName}'], ${check.limit});`;
20179
+ return ` ${call}(tree, ['${fieldName}'], ${limit});`;
19867
20180
  }
19868
- function generateFormValidation(controlMap, formId, functions, properties = {}) {
20181
+ function generateFormValidation(controlMap, formId, functions, properties = {}, sources = {}) {
19869
20182
  const shape = buildFormShape(controlMap, formId);
19870
20183
  if (!shape) return void 0;
19871
20184
  const used = /* @__PURE__ */ new Map();
19872
20185
  const stock = /* @__PURE__ */ new Set();
19873
20186
  const statePropertyNames = /* @__PURE__ */ new Set();
20187
+ const limitReads = /* @__PURE__ */ new Map();
19874
20188
  const stateChecks = [];
19875
20189
  const blocks = [];
19876
20190
  let usesForm = false;
@@ -19880,7 +20194,8 @@ function generateFormValidation(controlMap, formId, functions, properties = {})
19880
20194
  const field = controlMap[fieldId];
19881
20195
  const name3 = resolveFieldName({ id: fieldId, configs: field.configs });
19882
20196
  fieldChecks(field).forEach((check) => {
19883
- if (!isCheckComplete(check, functions, controlMap, properties)) return;
20197
+ if (!isCheckComplete(check, functions, controlMap, properties, sources))
20198
+ return;
19884
20199
  const kind = checkKind(check);
19885
20200
  if (kind === "stateTrue" || kind === "stateFalse") {
19886
20201
  const property = check.statePropertyId ? properties[check.statePropertyId] : void 0;
@@ -19909,8 +20224,16 @@ function generateFormValidation(controlMap, formId, functions, properties = {})
19909
20224
  return;
19910
20225
  }
19911
20226
  if (kind !== "function") {
19912
- const statement = stockStatement(kind, check, name3, controlMap);
20227
+ const limitRead = takesLimit(kind) ? limitSourceFor(check, sources) : void 0;
20228
+ const statement = stockStatement(
20229
+ kind,
20230
+ check,
20231
+ name3,
20232
+ controlMap,
20233
+ limitRead
20234
+ );
19913
20235
  if (!statement) return;
20236
+ if (limitRead) limitReads.set(limitRead.name, limitRead);
19914
20237
  stock.add(STOCK_VALIDATOR[kind]);
19915
20238
  if (!takesLimit(kind) || kind === "minAge") usesSchemaPath = true;
19916
20239
  blocks.push(statement);
@@ -19964,6 +20287,9 @@ function generateFormValidation(controlMap, formId, functions, properties = {})
19964
20287
  functions: [...used.values()].sort((a, b) => a.name.localeCompare(b.name)),
19965
20288
  stockValidators: [...stock].sort(),
19966
20289
  statePropertyNames: [...statePropertyNames].sort(),
20290
+ limitReads: [...limitReads.values()].sort(
20291
+ (a, b) => a.name.localeCompare(b.name)
20292
+ ),
19967
20293
  fields: shape.keys,
19968
20294
  stateChecks,
19969
20295
  usesValidate,
@@ -20010,11 +20336,14 @@ function generateFormValidationFile(emission) {
20010
20336
  ] : [],
20011
20337
  ...functionImports ? [functionImports] : [],
20012
20338
  ``,
20013
- ...emission.statePropertyNames.length ? [
20339
+ ...emission.statePropertyNames.length || emission.limitReads.length ? [
20014
20340
  `export const ${emission.memberName} = (state: {`,
20015
20341
  ...emission.statePropertyNames.map(
20016
20342
  (name3) => ` ${name3}: () => boolean | undefined;`
20017
20343
  ),
20344
+ ...emission.limitReads.map(
20345
+ (read) => ` ${read.name}: () => number | undefined;`
20346
+ ),
20018
20347
  `}): SchemaOrSchemaFn<Record<string, unknown>> => (path) => {`
20019
20348
  ] : [
20020
20349
  `export const ${emission.memberName}: SchemaOrSchemaFn<`,
@@ -20032,41 +20361,74 @@ function generateFormValidationFile(emission) {
20032
20361
  ``
20033
20362
  ].join("\n");
20034
20363
  }
20035
- function formValidationBlock(controlMap, functions, properties = {}, stateAccessor = "") {
20364
+ function formValidationBlock(controlMap, functions, properties = {}, stateAccessor = "", sources = {}) {
20036
20365
  const emissions = Object.keys(controlMap).filter((id) => controlMap[id].type === "form" /* FORM */).map((id) => ({
20037
20366
  id,
20038
- emission: generateFormValidation(controlMap, id, functions, properties)
20367
+ emission: generateFormValidation(
20368
+ controlMap,
20369
+ id,
20370
+ functions,
20371
+ properties,
20372
+ sources
20373
+ )
20039
20374
  })).filter(
20040
20375
  (entry2) => !!entry2.emission
20041
20376
  ).map((entry2) => entry2.emission).sort((a, b) => a.memberName.localeCompare(b.memberName));
20042
20377
  if (!emissions.length) return { body: "", emissions: [] };
20043
20378
  const body = emissions.map((emission) => {
20044
- const state = emission.statePropertyNames.length ? `({ ${emission.statePropertyNames.map((name3) => `${name3}: ${stateAccessor}.${name3}`).join(", ")} })` : "";
20379
+ const entries = [
20380
+ ...emission.statePropertyNames.map(
20381
+ (name3) => `${name3}: ${stateAccessor}.${name3}`
20382
+ ),
20383
+ ...emission.limitReads.map((read) => {
20384
+ const receiver = read.source !== "state" ? "this" : read.storeProp ? `this.${read.storeProp}` : stateAccessor;
20385
+ const call = read.read === "signal" ? "()" : "";
20386
+ return `${read.name}: () => ${receiver}.${read.name}${call}`;
20387
+ })
20388
+ ];
20389
+ const state = entries.length ? `({ ${entries.join(", ")} })` : "";
20045
20390
  return ` protected readonly ${emission.memberName} = ${emission.memberName}${state};`;
20046
20391
  }).join("\n");
20047
20392
  return { body: `
20048
20393
  ${body}
20049
20394
  `, emissions };
20050
20395
  }
20051
- function formValidationFiles(controlMap, functions, properties = {}) {
20052
- return formValidationEmissions(controlMap, functions, properties).map(
20396
+ function formValidationFiles(controlMap, functions, properties = {}, sources = {}) {
20397
+ return formValidationEmissions(
20398
+ controlMap,
20399
+ functions,
20400
+ properties,
20401
+ sources
20402
+ ).map(
20053
20403
  ({ fileName, emission }) => ({
20054
20404
  fileName,
20055
20405
  contents: generateFormValidationFile(emission)
20056
20406
  })
20057
20407
  );
20058
20408
  }
20059
- function formValidationEmissions(controlMap, functions, properties = {}) {
20060
- return formValidationBlock(controlMap, functions, properties).emissions.map(
20409
+ function formValidationEmissions(controlMap, functions, properties = {}, sources = {}) {
20410
+ return formValidationBlock(
20411
+ controlMap,
20412
+ functions,
20413
+ properties,
20414
+ "",
20415
+ sources
20416
+ ).emissions.map(
20061
20417
  (emission) => ({
20062
20418
  fileName: validationFileName(emission.formName),
20063
20419
  emission
20064
20420
  })
20065
20421
  );
20066
20422
  }
20067
- function validationBindings(controlMap, functions, properties = {}) {
20423
+ function validationBindings(controlMap, functions, properties = {}, sources = {}) {
20068
20424
  const bindings = {};
20069
- formValidationBlock(controlMap, functions, properties).emissions.forEach(
20425
+ formValidationBlock(
20426
+ controlMap,
20427
+ functions,
20428
+ properties,
20429
+ "",
20430
+ sources
20431
+ ).emissions.forEach(
20070
20432
  (emission) => {
20071
20433
  bindings[emission.formId] = emission.memberName;
20072
20434
  }
@@ -20633,7 +20995,7 @@ function variantGuard(node, names, storeProp) {
20633
20995
  }
20634
20996
  return expr;
20635
20997
  }
20636
- function screenVariantsBlock(variants, inputs, computeds, constants, variables, stateComputeds, functions, properties, shapes, storeProp, formModels = {}) {
20998
+ function screenVariantsBlock(variants, inputs, computeds, constants, variables, stateComputeds, functions, properties, shapes, storeProp, formModels = {}, appEnums = {}) {
20637
20999
  const screenRoots2 = screenPropertiesWithComputeds(
20638
21000
  inputs,
20639
21001
  computeds,
@@ -20659,7 +21021,8 @@ function screenVariantsBlock(variants, inputs, computeds, constants, variables,
20659
21021
  (id) => screenRoots2[id] ? constants[id] ? { prefix: "", isSignal: false } : { prefix: "this.", isSignal: true } : `this.${storeProp}.`,
20660
21022
  // A RuleCall asks the root store this class injects (usesAuth).
20661
21023
  "this.",
20662
- functions
21024
+ functions,
21025
+ appEnums
20663
21026
  )}`
20664
21027
  );
20665
21028
  return {
@@ -20711,8 +21074,8 @@ var widgetLoaderExpr = (ref) => ({
20711
21074
  });
20712
21075
  function overlayConfigLiteral(configs) {
20713
21076
  const entries = Object.entries(configs).map(([key2, value]) => {
20714
- const text2 = isRawExpr(value) ? value[RAW_EXPR].split("\n").join("\n ") : JSON.stringify(value, null, 2).split("\n").join("\n ");
20715
- return ` ${JSON.stringify(key2)}: ${text2}`;
21077
+ const text3 = isRawExpr(value) ? value[RAW_EXPR].split("\n").join("\n ") : JSON.stringify(value, null, 2).split("\n").join("\n ");
21078
+ return ` ${JSON.stringify(key2)}: ${text3}`;
20716
21079
  });
20717
21080
  return entries.length ? `{
20718
21081
  ${entries.join(",\n")}
@@ -20980,20 +21343,24 @@ var SCORE_SET_NUMBER_ONLY_KEYS = /* @__PURE__ */ new Set([
20980
21343
  ...NUMBER_ONLY_KEYS,
20981
21344
  "staleAfterDays"
20982
21345
  ]);
20983
- var PRICE_LADDER_NUMBER_ONLY_KEYS = /* @__PURE__ */ new Set([
20984
- ...NUMBER_ONLY_KEYS,
20985
- "value",
20986
- "target",
20987
- "targetLow",
20988
- "targetHigh",
20989
- "maxSpanPct"
20990
- ]);
20991
- var PRICE_LADDER_MARK_NUMBER_ONLY_KEYS = /* @__PURE__ */ new Set([
20992
- ...NUMBER_ONLY_KEYS,
20993
- "value",
20994
- "rank"
20995
- ]);
20996
- var PRICE_LADDER_SLOTS = [BINDING_SLOT.value, BINDING_SLOT.target];
21346
+ var SCALE_NUMBER_ONLY_KEYS = /* @__PURE__ */ new Set([...NUMBER_ONLY_KEYS, "min", "max", "maxSpanPct"]);
21347
+ var SCALE_MARK_NUMBER_ONLY_KEYS = /* @__PURE__ */ new Set([...NUMBER_ONLY_KEYS, "value", "low", "high"]);
21348
+ var SCALE_RELATION_NUMBER_ONLY_KEYS = /* @__PURE__ */ new Set([...NUMBER_ONLY_KEYS, "rightValue", "n"]);
21349
+ var NUMBER_ONLY_KEYS_BY_TYPE = {
21350
+ ["img" /* IMG */]: IMG_NUMBER_ONLY_KEYS,
21351
+ ["section_filter" /* SECTION_FILTER */]: FILTER_NUMBER_ONLY_KEYS,
21352
+ ["score_set_item" /* SCORE_SET_ITEM */]: SCORE_ITEM_NUMBER_ONLY_KEYS,
21353
+ ["score_set" /* SCORE_SET */]: SCORE_SET_NUMBER_ONLY_KEYS,
21354
+ ["scale" /* SCALE */]: SCALE_NUMBER_ONLY_KEYS,
21355
+ ["scale_mark" /* SCALE_MARK */]: SCALE_MARK_NUMBER_ONLY_KEYS,
21356
+ ["scale_relation" /* SCALE_RELATION */]: SCALE_RELATION_NUMBER_ONLY_KEYS
21357
+ };
21358
+ var RAW_BOUND_SLOTS = {
21359
+ ["heat_swatch" /* HEAT_SWATCH */]: [BINDING_SLOT.value],
21360
+ ["score_set_item" /* SCORE_SET_ITEM */]: [BINDING_SLOT.value],
21361
+ ["score_set" /* SCORE_SET */]: [BINDING_SLOT.scoreDate],
21362
+ ["scale_mark" /* SCALE_MARK */]: [BINDING_SLOT.value]
21363
+ };
20997
21364
  var SECTION_TABLE_INPUTS = /* @__PURE__ */ new Set([
20998
21365
  "sticky",
20999
21366
  "margin",
@@ -21037,20 +21404,10 @@ function actionButtonPropNames(tree) {
21037
21404
  walk(tree);
21038
21405
  return byId;
21039
21406
  }
21040
- function collectActionButtonProps(tree, names = actionButtonPropNames(tree)) {
21041
- const props = [];
21042
- const walk = (nodes) => {
21043
- nodes.forEach((node) => {
21044
- const propName = names.get(node.id);
21045
- const buttons = propName ? actionButtonOverrides(node) : void 0;
21046
- if (propName && buttons) {
21047
- props.push({ name: propName, configs: buttons });
21048
- }
21049
- walk(node.childrens);
21050
- });
21051
- };
21052
- walk(tree);
21053
- return props;
21407
+ function withoutNameConfig(node) {
21408
+ if (!node.configs || !("name" in node.configs)) return node;
21409
+ const { name: _name, ...configs } = node.configs;
21410
+ return { ...node, configs };
21054
21411
  }
21055
21412
  function contextMenuConfigPropNames(tree) {
21056
21413
  const names = /* @__PURE__ */ new Map();
@@ -21240,7 +21597,7 @@ function screenVariableEnums(ctx) {
21240
21597
  const out = /* @__PURE__ */ new Map();
21241
21598
  const controls = ctx.controlMap ?? {};
21242
21599
  Object.values(withVariableEnums(ctx.variables ?? {}, controls)).forEach((variable) => {
21243
- const id = variable.actionEnumId ?? variable.sortEnumId;
21600
+ const id = enumIdOf(screenVariableDataType(variable));
21244
21601
  const entry2 = id ? ctx.enums?.find((candidate) => candidate.id === id) : void 0;
21245
21602
  if (entry2) out.set(variable.id, entry2);
21246
21603
  });
@@ -21304,23 +21661,10 @@ ${consts}`
21304
21661
  ...emissions.map((emission) => enumOf(emission.id)).filter((entry2) => !!entry2).map(actionEnumFile)
21305
21662
  ];
21306
21663
  }
21307
- function actionButtonsAttr(node, names) {
21308
- const prop = names?.get(node.id);
21309
- return prop ? ` [buttons]="${prop}"` : "";
21310
- }
21311
21664
  function inlineAttrs(node) {
21312
21665
  return attrsFrom(bodyConfigs(node), numberOnlyKeysOf(node.type));
21313
21666
  }
21314
- var numberOnlyKeysOf = (type) => {
21315
- if (type === "img" /* IMG */) return IMG_NUMBER_ONLY_KEYS;
21316
- if (type === "section_filter" /* SECTION_FILTER */) return FILTER_NUMBER_ONLY_KEYS;
21317
- if (type === "score_set_item" /* SCORE_SET_ITEM */) return SCORE_ITEM_NUMBER_ONLY_KEYS;
21318
- if (type === "score_set" /* SCORE_SET */) return SCORE_SET_NUMBER_ONLY_KEYS;
21319
- if (type === "price_ladder" /* PRICE_LADDER */) return PRICE_LADDER_NUMBER_ONLY_KEYS;
21320
- if (type === "price_ladder_mark" /* PRICE_LADDER_MARK */)
21321
- return PRICE_LADDER_MARK_NUMBER_ONLY_KEYS;
21322
- return NUMBER_ONLY_KEYS;
21323
- };
21667
+ var numberOnlyKeysOf = (type) => NUMBER_ONLY_KEYS_BY_TYPE[type] ?? NUMBER_ONLY_KEYS;
21324
21668
  function wrapInGuard(markup, guard, pad2) {
21325
21669
  if (!guard) return markup;
21326
21670
  return `${pad2}@if (${guard}) {
@@ -21345,7 +21689,7 @@ function renderBranch(node, indent2, names, methods, operationOf, storeProp, ctx
21345
21689
  chain.push({ arm, guard });
21346
21690
  }
21347
21691
  if (!chain.length) return "";
21348
- const body = (arm, at) => arm.childrens.map(
21692
+ const render = (children, at) => children.map(
21349
21693
  (child) => renderNode(
21350
21694
  child,
21351
21695
  at,
@@ -21357,19 +21701,73 @@ function renderBranch(node, indent2, names, methods, operationOf, storeProp, ctx
21357
21701
  wires,
21358
21702
  payloads
21359
21703
  )
21360
- ).filter(Boolean).join("\n");
21361
- if (chain.length === 1 && !chain[0].guard) return body(chain[0].arm, indent2);
21704
+ ).filter(Boolean);
21705
+ if (chain.length === 1 && !chain[0].guard) {
21706
+ return render(chain[0].arm.childrens, indent2).join("\n");
21707
+ }
21362
21708
  const pad2 = " ".repeat(indent2);
21363
- const lines = [];
21364
- chain.forEach((entry2, index) => {
21365
- lines.push(
21366
- index === 0 ? `${pad2}@if (${entry2.guard}) {` : entry2.guard ? `${pad2}} @else if (${entry2.guard}) {` : `${pad2}} @else {`
21367
- );
21368
- const inner = body(entry2.arm, indent2 + 1);
21369
- if (inner) lines.push(inner);
21370
- });
21371
- lines.push(`${pad2}}`);
21372
- return lines.join("\n");
21709
+ const slots = branchSlots(chain.map((entry2) => entry2.arm));
21710
+ const chainFor = (slot) => {
21711
+ const lines = [];
21712
+ chain.forEach((entry2, index) => {
21713
+ lines.push(
21714
+ index === 0 ? `${pad2}@if (${entry2.guard}) {` : entry2.guard ? `${pad2}} @else if (${entry2.guard}) {` : `${pad2}} @else {`
21715
+ );
21716
+ const children = entry2.arm.childrens.filter(
21717
+ (child) => projectionSlotOf(child) === slot
21718
+ );
21719
+ const wrap = !!slot && children.length > 1;
21720
+ const inner = render(children, indent2 + (wrap ? 2 : 1));
21721
+ if (!inner.length) return;
21722
+ if (wrap) {
21723
+ lines.push(
21724
+ `${pad2} <ng-container ngProjectAs="${slot}">`,
21725
+ ...inner,
21726
+ `${pad2} </ng-container>`
21727
+ );
21728
+ } else {
21729
+ lines.push(...inner);
21730
+ }
21731
+ });
21732
+ lines.push(`${pad2}}`);
21733
+ return lines.join("\n");
21734
+ };
21735
+ return slots.map(chainFor).join("\n");
21736
+ }
21737
+ var NAMED_SLOT_TAGS = /* @__PURE__ */ new Set([
21738
+ "m-section-header",
21739
+ "m-section-hero",
21740
+ "m-jumbotron",
21741
+ "m-section-search",
21742
+ "m-section-stepper",
21743
+ "m-section-badges",
21744
+ "m-section-toggle",
21745
+ "m-action",
21746
+ "m-one-action",
21747
+ "m-section-back",
21748
+ "m-section-filter",
21749
+ "m-section-filter-group",
21750
+ "m-carousel",
21751
+ "m-one-carousel",
21752
+ "m-section-pagination",
21753
+ "m-section-footer",
21754
+ "m-app-logo"
21755
+ ]);
21756
+ function projectionSlotOf(node) {
21757
+ const tag = codegenFor(node.type)?.tag.split(" ")[0];
21758
+ return tag && NAMED_SLOT_TAGS.has(tag) ? tag : "";
21759
+ }
21760
+ function branchSlots(arms) {
21761
+ const named = /* @__PURE__ */ new Set();
21762
+ let hasDefault = false;
21763
+ for (const arm of arms) {
21764
+ for (const child of arm.childrens) {
21765
+ const slot = projectionSlotOf(child);
21766
+ if (slot) named.add(slot);
21767
+ else hasDefault = true;
21768
+ }
21769
+ }
21770
+ return [...hasDefault || !named.size ? [""] : [], ...named];
21373
21771
  }
21374
21772
  function renderRepeat(node, indent2, names, methods, operationOf, storeProp, ctx, wires, payloads) {
21375
21773
  const pad2 = " ".repeat(indent2);
@@ -21571,11 +21969,8 @@ var attrBindingSlots = (type) => {
21571
21969
  if (type === "remote" /* REMOTE */) return REMOTE_VALUE_SLOTS;
21572
21970
  if (type === "app_logo" /* APP_LOGO */) return APP_LOGO_VALUE_SLOTS;
21573
21971
  if (type === "section_pagination" /* SECTION_PAGINATION */) return [BINDING_SLOT.total];
21574
- if (type === "heat_swatch" /* HEAT_SWATCH */) return [BINDING_SLOT.value];
21575
- if (type === "score_set_item" /* SCORE_SET_ITEM */) return [BINDING_SLOT.value];
21576
- if (type === "score_set" /* SCORE_SET */) return [BINDING_SLOT.scoreDate];
21577
- if (type === "price_ladder" /* PRICE_LADDER */) return PRICE_LADDER_SLOTS;
21578
- if (type === "price_ladder_mark" /* PRICE_LADDER_MARK */) return [BINDING_SLOT.value];
21972
+ const raw = RAW_BOUND_SLOTS[type];
21973
+ if (raw) return raw;
21579
21974
  if (type === "section_chart_series" /* SECTION_CHART_SERIES */)
21580
21975
  return [BINDING_SLOT.data, BINDING_SLOT.label];
21581
21976
  return hasTextSource(type) ? [BINDING_SLOT.label] : [];
@@ -21618,10 +22013,21 @@ var validationMemberFor = (node, ctx) => {
21618
22013
  const bindings = validationBindings(
21619
22014
  controlMap,
21620
22015
  ctx.functions ?? {},
21621
- ctx.properties ?? {}
22016
+ ctx.properties ?? {},
22017
+ checkLimitSources(ctx)
21622
22018
  );
21623
22019
  return bindings[node.id];
21624
22020
  };
22021
+ var checkLimitSources = (ctx) => limitSources({
22022
+ inputs: ctx.inputs,
22023
+ constants: ctx.constants,
22024
+ variables: ctx.variables,
22025
+ screenComputeds: ctx.screenComputeds,
22026
+ properties: ctx.properties,
22027
+ computeds: ctx.computeds,
22028
+ functions: ctx.functions,
22029
+ storePropOf: ctx.storePropOf
22030
+ });
21625
22031
  var bindingScope = (ctx, storeProp) => ({
21626
22032
  properties: ctx.properties,
21627
22033
  shapes: ctx.shapes,
@@ -21848,20 +22254,7 @@ function boundAttrs(node, ctx, storeProp) {
21848
22254
  }
21849
22255
  const total = paginationTotalRead(node, ctx, storeProp);
21850
22256
  if (total) parts.push(` [total]="${total.read}"`);
21851
- if (node.type === "heat_swatch" /* HEAT_SWATCH */ && bindings?.[BINDING_SLOT.value]) {
21852
- const expr = bindingExpression(bindings[BINDING_SLOT.value], scope);
21853
- if (expr) parts.push(` [value]="${expr}"`);
21854
- }
21855
- if (node.type === "score_set_item" /* SCORE_SET_ITEM */ && bindings?.[BINDING_SLOT.value]) {
21856
- const expr = bindingExpression(bindings[BINDING_SLOT.value], scope);
21857
- if (expr) parts.push(` [value]="${expr}"`);
21858
- }
21859
- if (node.type === "score_set" /* SCORE_SET */ && bindings?.[BINDING_SLOT.scoreDate]) {
21860
- const expr = bindingExpression(bindings[BINDING_SLOT.scoreDate], scope);
21861
- if (expr) parts.push(` [scoreDate]="${expr}"`);
21862
- }
21863
- const ladderSlots = node.type === "price_ladder" /* PRICE_LADDER */ ? PRICE_LADDER_SLOTS : node.type === "price_ladder_mark" /* PRICE_LADDER_MARK */ ? [BINDING_SLOT.value] : [];
21864
- for (const slot of ladderSlots) {
22257
+ for (const slot of RAW_BOUND_SLOTS[node.type] ?? []) {
21865
22258
  if (!bindings?.[slot]) continue;
21866
22259
  const expr = bindingExpression(bindings[slot], scope);
21867
22260
  if (expr) parts.push(` [${slot}]="${expr}"`);
@@ -22032,26 +22425,15 @@ function tagAttrs(node, ctx, storeProp) {
22032
22425
  delete configs2["link"];
22033
22426
  return `${inlineAttrs({ ...node, configs: configs2 })}${boundAttrs(node, ctx, storeProp)}`;
22034
22427
  }
22035
- if (node.type === "heat_swatch" /* HEAT_SWATCH */ && ctx.controlMap?.[node.id]?.bindings?.[BINDING_SLOT.value]) {
22036
- const configs2 = { ...node.configs ?? {} };
22037
- delete configs2[BINDING_SLOT.value];
22038
- return `${inlineAttrs({ ...node, configs: configs2 })}${boundAttrs(node, ctx, storeProp)}`;
22039
- }
22040
- const scoreSlot = node.type === "score_set_item" /* SCORE_SET_ITEM */ ? BINDING_SLOT.value : node.type === "score_set" /* SCORE_SET */ ? BINDING_SLOT.scoreDate : void 0;
22041
- if (scoreSlot && ctx.controlMap?.[node.id]?.bindings?.[scoreSlot]) {
22428
+ const bound = ctx.controlMap?.[node.id]?.bindings ?? {};
22429
+ const rawBound = (RAW_BOUND_SLOTS[node.type] ?? []).filter(
22430
+ (slot) => bound[slot]
22431
+ );
22432
+ if (rawBound.length) {
22042
22433
  const configs2 = { ...node.configs ?? {} };
22043
- delete configs2[scoreSlot];
22434
+ for (const slot of rawBound) delete configs2[slot];
22044
22435
  return `${inlineAttrs({ ...node, configs: configs2 })}${boundAttrs(node, ctx, storeProp)}`;
22045
22436
  }
22046
- if (node.type === "price_ladder" /* PRICE_LADDER */ || node.type === "price_ladder_mark" /* PRICE_LADDER_MARK */) {
22047
- const bound = ctx.controlMap?.[node.id]?.bindings ?? {};
22048
- const slots = attrBindingSlots(node.type).filter((s) => bound[s]);
22049
- if (slots.length) {
22050
- const configs2 = { ...node.configs ?? {} };
22051
- for (const s of slots) delete configs2[s];
22052
- return `${inlineAttrs({ ...node, configs: configs2 })}${boundAttrs(node, ctx, storeProp)}`;
22053
- }
22054
- }
22055
22437
  if (node.type === "section_filter" /* SECTION_FILTER */) {
22056
22438
  const bindings = ctx.controlMap?.[node.id]?.bindings;
22057
22439
  const configs2 = { ...node.configs ?? {} };
@@ -22411,8 +22793,7 @@ function statePatchFor(node, output, payload, storeProp, ctx, writes = node.outp
22411
22793
  if (!rows.length) return void 0;
22412
22794
  const enumById = new Map((ctx.enums ?? []).map((entry2) => [entry2.id, entry2]));
22413
22795
  const enumOf = ({ id }) => {
22414
- const dataType = properties[id]?.dataType;
22415
- const enumId = dataType?.actionEnumId ?? dataType?.sortEnumId;
22796
+ const enumId = enumIdOf(properties[id]?.dataType);
22416
22797
  return enumId ? enumById.get(enumId) : void 0;
22417
22798
  };
22418
22799
  const root = actionEventRoot(node, eventRoot, enumOf);
@@ -22438,7 +22819,8 @@ function statePatchFor(node, output, payload, storeProp, ctx, writes = node.outp
22438
22819
  // Filter's own shape (libs/one ADR 0026). Undefined for every other
22439
22820
  // Control, whose members are already typed.
22440
22821
  filterGroupEventMember(node),
22441
- enumNarrow(node, output, enumOf)
22822
+ enumNarrow(node, output, enumOf),
22823
+ ctx.functions ?? {}
22442
22824
  );
22443
22825
  }
22444
22826
  function screenWritesFor(node, output, payload, ctx, writes = node.outputScreenWrites, eventRoot = "$event", scope = "template") {
@@ -22461,7 +22843,8 @@ function screenWritesFor(node, output, payload, ctx, writes = node.outputScreenW
22461
22843
  root,
22462
22844
  scope,
22463
22845
  filterGroupEventMember(node),
22464
- enumNarrow(node, output, enumOf)
22846
+ enumNarrow(node, output, enumOf),
22847
+ ctx.functions ?? {}
22465
22848
  );
22466
22849
  }
22467
22850
  function enumNarrow(node, output, enumOf) {
@@ -22528,8 +22911,8 @@ var payloadPropBase = (node) => {
22528
22911
  return String(node.type);
22529
22912
  return name3;
22530
22913
  };
22531
- var camelCase2 = (text2) => {
22532
- const parts = text2.split(/[^A-Za-z0-9]+/).filter(Boolean);
22914
+ var camelCase2 = (text3) => {
22915
+ const parts = text3.split(/[^A-Za-z0-9]+/).filter(Boolean);
22533
22916
  if (!parts.length) return "form";
22534
22917
  const name3 = parts.map(
22535
22918
  (part, i) => i === 0 ? part.charAt(0).toLowerCase() + part.slice(1) : part.charAt(0).toUpperCase() + part.slice(1)
@@ -22688,15 +23071,14 @@ ${" ".repeat(indent2 + index)}}`,
22688
23071
  ctx
22689
23072
  );
22690
23073
  }
22691
- const attrs = `${tagAttrs(node, ctx, storeProp)}${payloadAttr(node, payloads)}${directiveAttrs(
23074
+ const foldedName = ctx.foldedButtonNames?.get(node.id);
23075
+ const attrNode = foldedName ? withoutNameConfig(node) : node;
23076
+ const attrs = `${foldedName ? ` name="${foldedName}"` : ""}${tagAttrs(attrNode, ctx, storeProp)}${payloadAttr(node, payloads)}${directiveAttrs(
22692
23077
  node,
22693
23078
  ctx.overlayNames,
22694
23079
  bindingScope(ctx, storeProp),
22695
23080
  ctx.controlMap?.[node.id]?.bindings
22696
- )}${sectionTableRowItemAttr(node, ctx.controlMap)}${outputAttrs(node, methods, operationOf, storeProp, ctx)}`;
22697
- if (node.type === "section_action" /* SECTION_ACTION */) {
22698
- return `${pad2}<${tag}${attrs}${actionButtonsAttr(node, ctx.actionButtonNames)} />`;
22699
- }
23081
+ )}${sectionTableRowItemAttr(node, ctx.controlMap)}${foldedName ? "" : outputAttrs(node, methods, operationOf, storeProp, ctx)}`;
22700
23082
  const totalGuard = paginationTotalRead(node, ctx, storeProp)?.guard;
22701
23083
  if (totalGuard) {
22702
23084
  return `${pad2}@if (${totalGuard}; as ${PAGINATION_TOTAL_ALIAS}) {
@@ -22804,7 +23186,7 @@ function planScreenEmit(tree, variants = {}, featureName = "feature", ctx = {})
22804
23186
  // or it is not unique at all, and the class assigns the same names from
22805
23187
  // the same Tree.
22806
23188
  overlayNames: overlayPropNames(tree),
22807
- actionButtonNames: actionButtonPropNames(tree),
23189
+ foldedButtonNames: foldedButtonNames(tree),
22808
23190
  contextMenuConfigNames: contextMenuConfigPropNames(tree),
22809
23191
  audiencePickerConfigNames: audiencePickerConfigPropNames(tree),
22810
23192
  menuVariants: menuVariantLookup(variants, ctx.screenVariants),
@@ -22822,7 +23204,7 @@ function generateHtml(tree, variants = {}, methods = {}, operationOf = () => voi
22822
23204
  // it is not unique at all, and the class assigns the same names from the
22823
23205
  // same Tree.
22824
23206
  overlayNames: overlayPropNames(tree),
22825
- actionButtonNames: actionButtonPropNames(tree),
23207
+ foldedButtonNames: foldedButtonNames(tree),
22826
23208
  contextMenuConfigNames: contextMenuConfigPropNames(tree),
22827
23209
  audiencePickerConfigNames: audiencePickerConfigPropNames(tree),
22828
23210
  menuVariants: menuVariantLookup(variants, ctx.screenVariants),
@@ -22970,8 +23352,8 @@ function everyOutputAttrs(tree, methods, operationOf, storeProp, ctx) {
22970
23352
  return out.join("\n");
22971
23353
  }
22972
23354
  var ENUM_READERS = [ACTION_NAME_READER, ENUM_VALUE_READER];
22973
- var enumReadersIn = (text2) => ENUM_READERS.filter((reader) => text2.includes(`${reader}(`));
22974
- var enumsNamedIn = (text2, enums) => enums.filter((entry2) => new RegExp(`\\b${entry2.name}\\b`).test(text2));
23355
+ var enumReadersIn = (text3) => ENUM_READERS.filter((reader) => text3.includes(`${reader}(`));
23356
+ var enumsNamedIn = (text3, enums) => enums.filter((entry2) => new RegExp(`\\b${entry2.name}\\b`).test(text3));
22975
23357
  function hasStateWrite(tree, ctx) {
22976
23358
  if (!ctx.properties) return false;
22977
23359
  return tree.some(
@@ -23039,6 +23421,50 @@ function collectTemplateTransforms(tree, methods, operationOf, constants = {}, f
23039
23421
  if (row.transform) exprs.push(row.transform);
23040
23422
  }
23041
23423
  }
23424
+ if (ctx) {
23425
+ for (const output of Object.keys(node.outputScreenMethods ?? {})) {
23426
+ if (screenMethodCall(node, output, ctx, storeProp, "") === void 0)
23427
+ continue;
23428
+ for (const row of outputArgRows(node.outputArgs, output)) {
23429
+ if (row.transform) exprs.push(row.transform);
23430
+ }
23431
+ }
23432
+ for (const output of Object.keys(node.outputScreenWrites ?? {})) {
23433
+ const emits = screenWritesFor(
23434
+ node,
23435
+ output,
23436
+ nodePayloadShape(node, output, ctx),
23437
+ ctx,
23438
+ node.outputScreenWrites,
23439
+ nodePayloadEventRoot(node, output)
23440
+ ).length;
23441
+ if (emits) {
23442
+ exprs.push(
23443
+ ...writeEventTransforms(
23444
+ screenWriteRows(node.outputScreenWrites, output)
23445
+ )
23446
+ );
23447
+ }
23448
+ }
23449
+ for (const output of Object.keys(node.outputWrites ?? {})) {
23450
+ const emits = statePatchFor(
23451
+ node,
23452
+ output,
23453
+ nodePayloadShape(node, output, ctx),
23454
+ storeProp,
23455
+ ctx,
23456
+ node.outputWrites,
23457
+ nodePayloadEventRoot(node, output)
23458
+ );
23459
+ if (emits) {
23460
+ exprs.push(
23461
+ ...writeEventTransforms(
23462
+ stateWriteRows(node.outputWrites, output)
23463
+ )
23464
+ );
23465
+ }
23466
+ }
23467
+ }
23042
23468
  for (const binding of Object.values(
23043
23469
  controlMap[node.id]?.bindings ?? {}
23044
23470
  )) {
@@ -23331,7 +23757,9 @@ function screenMethodsBlock(screenMethods, methods, operationOf, storeProp, ctx,
23331
23757
  constants,
23332
23758
  eventRoot,
23333
23759
  "class",
23334
- screenMethodParamRead
23760
+ screenMethodParamRead,
23761
+ void 0,
23762
+ ctx.functions ?? {}
23335
23763
  )
23336
23764
  );
23337
23765
  statements.push(
@@ -23358,7 +23786,9 @@ function screenMethodsBlock(screenMethods, methods, operationOf, storeProp, ctx,
23358
23786
  constants,
23359
23787
  eventRoot,
23360
23788
  "class",
23361
- screenMethodParamRead
23789
+ screenMethodParamRead,
23790
+ void 0,
23791
+ ctx.functions ?? {}
23362
23792
  );
23363
23793
  if (patch) statements.push(patch);
23364
23794
  }
@@ -23996,7 +24426,16 @@ function menuConditionMembersBlock(tree, ctx, roots, screenRoots2, constants, sh
23996
24426
  };
23997
24427
  const menuConditionExpression = (rule, variants) => {
23998
24428
  if (variants?.length) return variantFold(variants);
23999
- return rule ? generateRuleExpression(rule, roots, shapes, true, prefix, "this.") : void 0;
24429
+ return rule ? generateRuleExpression(
24430
+ rule,
24431
+ roots,
24432
+ shapes,
24433
+ true,
24434
+ prefix,
24435
+ "this.",
24436
+ {},
24437
+ ctx.appEnums
24438
+ ) : void 0;
24000
24439
  };
24001
24440
  const walk = (nodes) => {
24002
24441
  for (const node of nodes) {
@@ -24192,7 +24631,7 @@ ${body ? `${body}
24192
24631
  return emitted.join("");
24193
24632
  }
24194
24633
  function outputArmHandlerName(controlId, output) {
24195
- const part = (text2) => text2.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((piece) => piece.charAt(0).toUpperCase() + piece.slice(1)).join("");
24634
+ const part = (text3) => text3.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((piece) => piece.charAt(0).toUpperCase() + piece.slice(1)).join("");
24196
24635
  return `onArm${part(controlId.slice(0, 8))}${part(output)}`;
24197
24636
  }
24198
24637
  function armSubjectExpr(check, node, ctx, storeProp, payload, eventRoot) {
@@ -25028,7 +25467,6 @@ function collectComponentImportEntries(tree, ctx = {}) {
25028
25467
  )) {
25029
25468
  entries.push({ component: "TranslatePipe", from: ONE_IMPORT_MODULE });
25030
25469
  }
25031
- if (node.type === "section_action" /* SECTION_ACTION */) return;
25032
25470
  if (node.type === "repeat" /* REPEAT */ && ctx.controlMap?.[node.id] && isKeyedRepeat(ctx.controlMap[node.id], bindingScope(ctx, ""))) {
25033
25471
  entries.push({ component: "KeyValuePipe", from: "@angular/common" });
25034
25472
  }
@@ -25094,9 +25532,7 @@ function generateStateType(featureName, properties, shapes = {}, enums = [], ini
25094
25532
  const enumById = new Map(enums.map((entry2) => [entry2.id, entry2]));
25095
25533
  const enumImports = Array.from(
25096
25534
  new Set(
25097
- dataProperties.map(
25098
- (property) => property.dataType.actionEnumId ?? property.dataType.sortEnumId
25099
- ).map((id) => id ? enumById.get(id) : void 0).filter((entry2) => !!entry2).map((entry2) => enumImportLine(entry2, "./"))
25535
+ dataProperties.map((property) => enumIdOf(property.dataType)).map((id) => id ? enumById.get(id) : void 0).filter((entry2) => !!entry2).map((entry2) => enumImportLine(entry2, "./"))
25100
25536
  )
25101
25537
  ).join("\n");
25102
25538
  const members = dataProperties.map(
@@ -25695,11 +26131,7 @@ function generateTs(tree, naming, featureName, variants = {}, methods = {}, oper
25695
26131
  tree,
25696
26132
  ctx.overlayWidget,
25697
26133
  plan?.ctx.overlayNames ?? overlayPropNames(tree)
25698
- ),
25699
- // A SectionAction's folded Buttons take the same route for the same reason:
25700
- // the list is authored, never changes at runtime, and cannot be written in
25701
- // the template without tripping `no-inline-config-template` (ADR 0090).
25702
- ...collectActionButtonProps(tree, plan?.ctx.actionButtonNames)
26134
+ )
25703
26135
  ].map(
25704
26136
  (prop) => ` protected readonly ${prop.name} = ${overlayConfigLiteral(
25705
26137
  prop.configs
@@ -25782,7 +26214,8 @@ function generateTs(tree, naming, featureName, variants = {}, methods = {}, oper
25782
26214
  ctx.controlMap ?? {},
25783
26215
  ctx.functions ?? {},
25784
26216
  ctx.properties ?? {},
25785
- `this.${storeProp}`
26217
+ `this.${storeProp}`,
26218
+ checkLimitSources(ctx)
25786
26219
  );
25787
26220
  const checksBody = checks.body;
25788
26221
  const tables = sectionTableEmissions(ctx.controlMap ?? {});
@@ -25796,7 +26229,9 @@ ${tables.map(
25796
26229
  ).join("\n")}
25797
26230
  ` : "";
25798
26231
  const checksReadState = checks.emissions.some(
25799
- (emission) => emission.statePropertyNames.length > 0
26232
+ (emission) => emission.statePropertyNames.length > 0 || emission.limitReads.some(
26233
+ (read) => read.source === "state" && !read.storeProp
26234
+ )
25800
26235
  );
25801
26236
  const validationImports = checks.emissions.map(
25802
26237
  (emission) => `import { ${emission.memberName} } from '../lib/${validationFileBase(
@@ -26024,7 +26459,8 @@ ${tables.map(
26024
26459
  // (ADR 0175).
26025
26460
  { ...ctx.shapes ?? shapes, ...formShapeMap(ctx.controlMap ?? {}) },
26026
26461
  needsStore ? featureStoreProp(featureName) : "",
26027
- ctx.formModels ?? {}
26462
+ ctx.formModels ?? {},
26463
+ ctx.appEnums ?? {}
26028
26464
  );
26029
26465
  const outputOpenBody = outputOpenMembersBlock(
26030
26466
  tree,
@@ -26113,6 +26549,17 @@ ${tables.map(
26113
26549
  const fn = (ctx.functions ?? {})[one.functionId ?? ""];
26114
26550
  if (fn) screenFunctions.set(fn.name, fn);
26115
26551
  }
26552
+ const handlerTransforms = writeEventTransforms([
26553
+ ...handler.screenWrites ?? [],
26554
+ ...handler.writes ?? []
26555
+ ]);
26556
+ for (const id of templateTransformRefs(
26557
+ handlerTransforms,
26558
+ ctx.functions ?? {}
26559
+ ).functionIds) {
26560
+ const fn = (ctx.functions ?? {})[id];
26561
+ if (fn) screenFunctions.set(fn.name, fn);
26562
+ }
26116
26563
  }
26117
26564
  for (const control of Object.values(ctx.controlMap ?? {})) {
26118
26565
  for (const output of Object.keys(control.outputNewTabs ?? {})) {
@@ -26299,7 +26746,11 @@ ${tables.map(
26299
26746
  ctx.functions ?? {}
26300
26747
  );
26301
26748
  const memberEnums = enumMemberEnums(ctx.controlMap ?? {}, ctx.appEnums);
26302
- const memberEnumImports = memberEnums.map(
26749
+ const ruleText = `${screenVariantsBody}${menuConditionBody}`;
26750
+ const ruleEnums = Object.values(ctx.appEnums ?? {}).filter((appEnum) => !memberEnums.includes(appEnum)).filter(
26751
+ (appEnum) => new RegExp(`(^|[^\\w.])${appEnum.name}\\.`).test(ruleText)
26752
+ ).sort((a, b) => a.name.localeCompare(b.name));
26753
+ const memberEnumImports = [...memberEnums, ...ruleEnums].map(
26303
26754
  (appEnum) => `import { ${appEnum.name} } from '../../../shared/type/${appEnum.fileName}';`
26304
26755
  ).filter((line) => !inputTypeImports.includes(line)).map((line) => `${line}
26305
26756
  `).join("");
@@ -26496,12 +26947,14 @@ function generateCode(tree, featureName, screenName, properties = {}, variants =
26496
26947
  validationFiles: formValidationFiles(
26497
26948
  ctx.controlMap ?? {},
26498
26949
  ctx.functions ?? {},
26499
- properties
26950
+ properties,
26951
+ checkLimitSources(codegenCtx)
26500
26952
  ),
26501
26953
  validationEmissions: formValidationEmissions(
26502
26954
  ctx.controlMap ?? {},
26503
26955
  ctx.functions ?? {},
26504
- properties
26956
+ properties,
26957
+ checkLimitSources(codegenCtx)
26505
26958
  ),
26506
26959
  sectionTableFiles: sectionTableFiles(
26507
26960
  sectionTableEmissions(ctx.controlMap ?? {}),
@@ -26640,8 +27093,8 @@ var docEmitPath = (name3, lang) => `mag_assets/${docSourcePath(name3, lang)}`;
26640
27093
  function docsToFiles(docs, pathOf) {
26641
27094
  const files3 = {};
26642
27095
  for (const [name3, byLang] of Object.entries(docs)) {
26643
- for (const [lang, text2] of Object.entries(byLang)) {
26644
- files3[pathOf(name3, lang)] = text2;
27096
+ for (const [lang, text3] of Object.entries(byLang)) {
27097
+ files3[pathOf(name3, lang)] = text3;
26645
27098
  }
26646
27099
  }
26647
27100
  return files3;
@@ -26649,14 +27102,14 @@ function docsToFiles(docs, pathOf) {
26649
27102
  function docsFromFiles(files3, root) {
26650
27103
  const docs = {};
26651
27104
  const prefix = `${root}/`;
26652
- for (const [path, text2] of Object.entries(files3)) {
27105
+ for (const [path, text3] of Object.entries(files3)) {
26653
27106
  if (!path.startsWith(prefix) || !path.endsWith(MARKDOWN_EXTENSION)) continue;
26654
27107
  const parts = path.slice(prefix.length).split("/");
26655
27108
  if (parts.length !== 2) continue;
26656
27109
  const [lang, file] = parts;
26657
27110
  const name3 = file.slice(0, -MARKDOWN_EXTENSION.length);
26658
27111
  if (!lang || !name3) continue;
26659
- (docs[name3] ??= {})[lang] = text2;
27112
+ (docs[name3] ??= {})[lang] = text3;
26660
27113
  }
26661
27114
  return docs;
26662
27115
  }
@@ -26678,7 +27131,7 @@ __export(package_exports, {
26678
27131
  version: () => version
26679
27132
  });
26680
27133
  var name = "@magmonium/one";
26681
- var version = "0.4.82";
27134
+ var version = "0.4.96";
26682
27135
  var description = "Magmonium One \u2014 Angular design-system primitives for mm Apps";
26683
27136
  var author = "magmonium";
26684
27137
  var license = "MIT";
@@ -26746,7 +27199,7 @@ __export(package_exports2, {
26746
27199
  version: () => version2
26747
27200
  });
26748
27201
  var name2 = "@magmonium/cli";
26749
- var version2 = "0.8.24";
27202
+ var version2 = "0.8.26";
26750
27203
  var description2 = "A powerful and extensible asset compilation tool that can be shared across multiple projects";
26751
27204
  var bin = {
26752
27205
  "mag-cli": "bin/cli.js"
@@ -26853,9 +27306,202 @@ var timersReferencing = (timers, propertyId) => Object.values(timers ?? {}).filt
26853
27306
  (timer) => timerPropertyIds(timer).includes(propertyId)
26854
27307
  );
26855
27308
 
27309
+ // libs/codegen/src/lib/price-ladder-migration.ts
27310
+ var PRICE_LEVELS = {
27311
+ sma10: { label: "sma-10", kind: "level" },
27312
+ sma50: { label: "sma-50", kind: "level" },
27313
+ sma100: { label: "sma-100", kind: "level" },
27314
+ sma200: { label: "sma-200", kind: "level" },
27315
+ ema10: { label: "ema-10", kind: "level" },
27316
+ ema50: { label: "ema-50", kind: "level" },
27317
+ ema100: { label: "ema-100", kind: "level" },
27318
+ ema200: { label: "ema-200", kind: "level" },
27319
+ low52w: { label: "52w-low", kind: "bound" },
27320
+ high52w: { label: "52w-high", kind: "bound" },
27321
+ current: { label: "current-price", kind: "level" },
27322
+ forecast: { label: "model-forecast", kind: "target" }
27323
+ };
27324
+ var LADDER = "price_ladder";
27325
+ var LADDER_MARK = "price_ladder_mark";
27326
+ var LADDER_SIGNAL = "price_ladder_signal";
27327
+ var CURRENCY_OF_SYMBOL = { "\u20B9": "INR", $: "USD", "\u20AC": "EUR", "\xA3": "GBP", "\xA5": "JPY" };
27328
+ var VARIANT_TO_ORIENTATION = { line: "horizontal", list: "vertical" };
27329
+ var LADDER_ONLY = [
27330
+ "value",
27331
+ "valueLabel",
27332
+ "target",
27333
+ "targetLow",
27334
+ "targetHigh",
27335
+ "targetLabel",
27336
+ "targetNote",
27337
+ "variant",
27338
+ "symbol",
27339
+ "signals",
27340
+ "crossFrom",
27341
+ "crossTo",
27342
+ "crossTone"
27343
+ ];
27344
+ var orientationOf = (variant) => typeof variant === "string" ? VARIANT_TO_ORIENTATION[variant] : void 0;
27345
+ var recordOf = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
27346
+ var numberOr = (value) => typeof value === "number" && Number.isFinite(value) ? value : void 0;
27347
+ var text2 = (value) => typeof value === "string" ? value.trim() : "";
27348
+ var without = (record, keys) => Object.fromEntries(Object.entries(record).filter(([k]) => !keys.includes(k)));
27349
+ var defined = (record) => Object.fromEntries(Object.entries(record).filter(([, v]) => v !== void 0 && v !== ""));
27350
+ var signalNames = (raw) => (typeof raw === "string" ? raw.split(/[\s,]+/) : Array.isArray(raw) ? raw : []).filter(
27351
+ (s) => typeof s === "string" && !!s
27352
+ );
27353
+ var migratePriceLadders = (controlMap) => {
27354
+ const map = recordOf(controlMap);
27355
+ if (!map) return controlMap;
27356
+ const out = { ...map };
27357
+ for (const [id, raw] of Object.entries(map)) {
27358
+ const ladder = recordOf(raw);
27359
+ if (ladder?.["type"] === LADDER) migrateLadder(id, ladder, out);
27360
+ }
27361
+ return out;
27362
+ };
27363
+ var migrateLadder = (id, ladder, out) => {
27364
+ const configs = recordOf(ladder["configs"]) ?? {};
27365
+ const bindings = recordOf(ladder["bindings"]) ?? {};
27366
+ const childIds = (Array.isArray(ladder["childrens"]) ? ladder["childrens"] : []).filter(
27367
+ (c) => typeof c === "string"
27368
+ );
27369
+ const mint = (key2) => {
27370
+ const base = `${id}_${key2.replace(/[^a-z0-9]+/gi, "_")}`;
27371
+ let candidate = base;
27372
+ for (let n = 2; candidate in out; n++) candidate = `${base}_${n}`;
27373
+ return candidate;
27374
+ };
27375
+ const add = (key2, type, own, extra = {}) => {
27376
+ const cid = mint(key2);
27377
+ out[cid] = { id: cid, type, parentId: id, childrens: [], configs: { name: cid, ...defined(own) }, ...extra };
27378
+ return cid;
27379
+ };
27380
+ const markKeys = /* @__PURE__ */ new Set();
27381
+ for (const cid of childIds) {
27382
+ const mark = recordOf(out[cid]);
27383
+ if (mark?.["type"] !== LADDER_MARK) continue;
27384
+ const own = recordOf(mark["configs"]) ?? {};
27385
+ const key2 = text2(own["key"]) || cid;
27386
+ const level = PRICE_LEVELS[key2];
27387
+ markKeys.add(key2);
27388
+ const kind = key2 === "forecast" ? "target" : key2 === "current" ? "level" : text2(own["kind"]) || level?.kind || "level";
27389
+ out[cid] = {
27390
+ ...mark,
27391
+ type: "scale_mark",
27392
+ configs: defined({
27393
+ ...without(own, ["rank", "note", "kind", "label"]),
27394
+ key: key2,
27395
+ label: text2(own["label"]) || level?.label,
27396
+ kind: kind === "level" ? void 0 : kind,
27397
+ primary: key2 === "current" ? true : void 0,
27398
+ ...key2 === "forecast" ? { low: numberOr(configs["targetLow"]), high: numberOr(configs["targetHigh"]) } : {}
27399
+ })
27400
+ };
27401
+ }
27402
+ const leading = [];
27403
+ if (!markKeys.has("current")) {
27404
+ leading.push(
27405
+ add(
27406
+ "current",
27407
+ "scale_mark",
27408
+ { key: "current", label: text2(configs["valueLabel"]) || "current-price", value: numberOr(configs["value"]), primary: true },
27409
+ bindings["value"] ? { bindings: { value: bindings["value"] } } : {}
27410
+ )
27411
+ );
27412
+ }
27413
+ const forecast = {
27414
+ value: numberOr(configs["target"]),
27415
+ low: numberOr(configs["targetLow"]),
27416
+ high: numberOr(configs["targetHigh"])
27417
+ };
27418
+ if (!markKeys.has("forecast") && (forecast.value !== void 0 || forecast.low !== void 0 || forecast.high !== void 0 || bindings["target"])) {
27419
+ leading.push(
27420
+ add(
27421
+ "forecast",
27422
+ "scale_mark",
27423
+ { key: "forecast", label: text2(configs["targetLabel"]) || "model-forecast", kind: "target", ...forecast },
27424
+ bindings["target"] ? { bindings: { value: bindings["target"] } } : {}
27425
+ )
27426
+ );
27427
+ }
27428
+ const asked = new Set(signalNames(configs["signals"]));
27429
+ const carried = /* @__PURE__ */ new Set();
27430
+ for (const cid of childIds) {
27431
+ const signal = recordOf(out[cid]);
27432
+ if (signal?.["type"] !== LADDER_SIGNAL) continue;
27433
+ const own = recordOf(signal["configs"]) ?? {};
27434
+ const rule = text2(own["rule"]);
27435
+ if (isPriceRule(rule)) {
27436
+ asked.add(rule);
27437
+ carried.add(rule);
27438
+ const relation = priceRelationsFor([rule])[0];
27439
+ out[cid] = {
27440
+ ...signal,
27441
+ type: "scale_relation",
27442
+ configs: defined({
27443
+ name: own["name"],
27444
+ ...relation,
27445
+ label: text2(own["label"]) || relation.label,
27446
+ detail: text2(own["detail"]) || void 0
27447
+ })
27448
+ };
27449
+ } else {
27450
+ out[cid] = {
27451
+ ...signal,
27452
+ type: "scale_relation",
27453
+ configs: defined({
27454
+ name: own["name"],
27455
+ key: text2(own["key"]) || cid,
27456
+ label: text2(own["label"]),
27457
+ tone: text2(own["tone"]) || "neutral",
27458
+ type: "always",
27459
+ detail: text2(own["detail"])
27460
+ })
27461
+ };
27462
+ }
27463
+ }
27464
+ const trailing = [];
27465
+ const rules = priceRelationsFor(asked.has("all") ? PRICE_RULES.map((r) => r.key) : [...asked]);
27466
+ for (const relation of rules) {
27467
+ if (carried.has(relation.key)) continue;
27468
+ trailing.push(add(relation.key, "scale_relation", { ...relation }));
27469
+ }
27470
+ const from = text2(configs["crossFrom"]);
27471
+ const to = text2(configs["crossTo"]);
27472
+ if (from && to) {
27473
+ const tone = text2(configs["crossTone"]) || "neutral";
27474
+ for (const [key2, op] of [["cross-pair-above", "gte"], ["cross-pair-below", "lt"]]) {
27475
+ trailing.push(
27476
+ add(key2, "scale_relation", { key: key2, tone, type: "compare", left: from, op, rightKind: "mark", right: to, hidden: true, bracket: true })
27477
+ );
27478
+ }
27479
+ }
27480
+ const symbol = typeof configs["symbol"] === "string" ? configs["symbol"] : "\u20B9";
27481
+ const currency = CURRENCY_OF_SYMBOL[symbol];
27482
+ const restBindings = without(bindings, ["value", "target"]);
27483
+ const ladderRest = without(ladder, ["bindings"]);
27484
+ out[id] = {
27485
+ ...ladderRest,
27486
+ type: "scale",
27487
+ childrens: [...leading, ...childIds, ...trailing],
27488
+ configs: defined({
27489
+ ...without(configs, LADDER_ONLY),
27490
+ format: currency ? "currency" : "number",
27491
+ currency: currency && currency !== "INR" ? currency : void 0,
27492
+ unit: currency ? void 0 : symbol,
27493
+ // `auto` is the Scale's default, so it is not written.
27494
+ orientation: orientationOf(configs["variant"]),
27495
+ maxSpanPct: numberOr(configs["maxSpanPct"]) ?? 60
27496
+ }),
27497
+ ...Object.keys(restBindings).length ? { bindings: restBindings } : {}
27498
+ };
27499
+ };
27500
+
26856
27501
  // libs/codegen/src/model/control-group.ts
26857
27502
  var CONTROL_GROUP_NAME_MAX = 40;
26858
27503
  var NAME_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
27504
+ var isValidControlGroupCategory = (category) => typeof category === "string" && NAME_PATTERN.test(category) && category.length <= CONTROL_GROUP_NAME_MAX;
26859
27505
  var isValidControlGroupName = (name3) => NAME_PATTERN.test(name3) && name3.length <= CONTROL_GROUP_NAME_MAX;
26860
27506
 
26861
27507
  // libs/codegen/src/lib/layer-helper.ts
@@ -28050,8 +28696,8 @@ var withCases = (fn, cases) => {
28050
28696
  return next;
28051
28697
  };
28052
28698
  var caseArityMatches = (fn, entry2) => entry2.args.length === fn.params.length;
28053
- var caseLiteralValue = (text2) => {
28054
- const source = text2.trim();
28699
+ var caseLiteralValue = (text3) => {
28700
+ const source = text3.trim();
28055
28701
  if (!source) return { ok: false };
28056
28702
  let at = 0;
28057
28703
  const skip = () => {
@@ -28328,7 +28974,7 @@ var caseEquals = (actual, expected) => {
28328
28974
  };
28329
28975
 
28330
28976
  // libs/codegen/src/lib/workspace-codec.ts
28331
- var WORKSPACE_SCHEMA_VERSION = 30;
28977
+ var WORKSPACE_SCHEMA_VERSION = 31;
28332
28978
  var MIGRATION_FLOOR = 18;
28333
28979
  var DEPLOY_TOKEN_METHOD_IDS = {
28334
28980
  "@UserStore.ensureDeployToken": "@AuthStore.ensureDeployToken",
@@ -28424,40 +29070,54 @@ var mapBlobControls = (blob, step) => {
28424
29070
  }
28425
29071
  return next;
28426
29072
  };
29073
+ var mapBlobControlMaps = (blob, step) => {
29074
+ const next = { ...blob };
29075
+ if ("controlMap" in next) next["controlMap"] = step(next["controlMap"]);
29076
+ const groups = next["controlGroups"];
29077
+ if (groups && typeof groups === "object") {
29078
+ next["controlGroups"] = Object.fromEntries(
29079
+ Object.entries(groups).map(([name3, group]) => [
29080
+ name3,
29081
+ group && typeof group === "object" ? { ...group, controls: step(group["controls"]) } : group
29082
+ ])
29083
+ );
29084
+ }
29085
+ return next;
29086
+ };
28427
29087
  var SCREEN_OUTPUT_SIBLINGS = [
28428
29088
  ["screenOutputCalls", "outputCalls"],
28429
29089
  ["screenOutputWrites", "outputWrites"],
28430
29090
  ["screenOutputScreenWrites", "outputScreenWrites"],
28431
29091
  ["screenOutputOutcomes", "outputOutcomes"]
28432
29092
  ];
28433
- var recordOf = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
29093
+ var recordOf2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
28434
29094
  var migrateScreenOutputMaps = (control) => {
28435
29095
  if (!Object.keys(control).some((key2) => key2.startsWith("screenOutput"))) {
28436
29096
  return control;
28437
29097
  }
28438
29098
  const next = { ...control };
28439
29099
  const merge = (field, key2, value) => {
28440
- next[field] = { ...recordOf(next[field]) ?? {}, [key2]: value };
29100
+ next[field] = { ...recordOf2(next[field]) ?? {}, [key2]: value };
28441
29101
  };
28442
29102
  for (const [from, to] of SCREEN_OUTPUT_SIBLINGS) {
28443
- for (const [key2, value] of Object.entries(recordOf(control[from]) ?? {})) {
29103
+ for (const [key2, value] of Object.entries(recordOf2(control[from]) ?? {})) {
28444
29104
  merge(to, key2, value);
28445
29105
  }
28446
29106
  delete next[from];
28447
29107
  }
28448
- const emits = recordOf(control["screenOutputEmits"]) ?? {};
29108
+ const emits = recordOf2(control["screenOutputEmits"]) ?? {};
28449
29109
  for (const [key2, rows] of Object.entries(emits)) {
28450
29110
  merge("outputEmits", key2, rows);
28451
29111
  }
28452
29112
  delete next["screenOutputEmits"];
28453
- const bindings = recordOf(control["screenOutputs"]) ?? {};
29113
+ const bindings = recordOf2(control["screenOutputs"]) ?? {};
28454
29114
  for (const [key2, raw] of Object.entries(bindings)) {
28455
29115
  const binding = raw;
28456
29116
  if (binding?.kind === "method") {
28457
29117
  merge("outputs", key2, binding.methodId);
28458
29118
  if (binding.args?.length) merge("outputArgs", key2, binding.args);
28459
29119
  } else if (binding?.kind === "output") {
28460
- const drawn = recordOf(next["outputEmits"])?.[key2];
29120
+ const drawn = recordOf2(next["outputEmits"])?.[key2];
28461
29121
  merge("outputEmits", key2, [
28462
29122
  ...Array.isArray(drawn) ? drawn : [],
28463
29123
  { id: `reemit-${key2}`, outputId: binding.outputId, value: { kind: "event" } }
@@ -28564,6 +29224,10 @@ var screenOnly = (step) => ({
28564
29224
  step
28565
29225
  });
28566
29226
  var MIGRATIONS = {
29227
+ // 30 → 31: a PriceLadder becomes a Scale — its marks ScaleMarks, its chips
29228
+ // and picked indicators ScaleRelations — in a Screen's ControlMap and in
29229
+ // every ControlGroup (libs/one GLOSSARY.md Scale).
29230
+ 30: everyKind((blob) => mapBlobControlMaps(blob, migratePriceLadders)),
28567
29231
  // 29 → 30: a ScreenControl's ScreenOutputs move onto the standard output
28568
29232
  // maps, in a Screen's ControlMap and in every ControlGroup (ADR 0207).
28569
29233
  29: everyKind((blob) => mapBlobControls(blob, migrateScreenOutputMaps)),
@@ -28912,13 +29576,13 @@ function sanitizeOperand(value) {
28912
29576
  const literal = operand["value"];
28913
29577
  return typeof literal === "string" || typeof literal === "number" || typeof literal === "boolean" ? { kind: "literal", value: literal } : fallback;
28914
29578
  }
28915
- function sanitizeRuleNode(value, depth = 0) {
29579
+ function sanitizeRuleNode(value, taken, depth = 0) {
28916
29580
  if (!value || typeof value !== "object" || depth > 32) return void 0;
28917
29581
  const node = value;
28918
- const id = nodeId();
29582
+ const id = keptNodeId(node["id"], taken);
28919
29583
  const kind = node["kind"];
28920
29584
  if (kind === "group") {
28921
- const children = Array.isArray(node["children"]) ? node["children"].map((child) => sanitizeRuleNode(child, depth + 1)).filter((child) => !!child) : [];
29585
+ const children = Array.isArray(node["children"]) ? node["children"].map((child) => sanitizeRuleNode(child, taken, depth + 1)).filter((child) => !!child) : [];
28922
29586
  return {
28923
29587
  id,
28924
29588
  kind: "group",
@@ -28983,7 +29647,7 @@ function sanitizeRuleNode(value, depth = 0) {
28983
29647
  };
28984
29648
  }
28985
29649
  var sanitizeRule = (value) => {
28986
- const node = sanitizeRuleNode(value);
29650
+ const node = sanitizeRuleNode(value, /* @__PURE__ */ new Set());
28987
29651
  return node && node.kind === "group" ? node : createRule();
28988
29652
  };
28989
29653
  function sanitizeVariants(variants) {
@@ -29089,19 +29753,22 @@ function sanitizeMethods(methods, properties, functions = {}) {
29089
29753
  (persist) => !!persist && typeof persist.id === "string" && !!persist.id && typeof persist.key === "string" && Array.isArray(persist.source) && persist.source.every((segment) => typeof segment === "string")
29090
29754
  ).map((persist) => {
29091
29755
  const timing = persist.timing === "before" ? "before" : "after";
29092
- const sourceKind = persist.sourceKind === "args" || persist.sourceKind === "state" || persist.sourceKind === "fixed" || persist.sourceKind === "response" ? persist.sourceKind : timing === "before" ? "state" : "response";
29756
+ const sourceKind = persist.sourceKind === "args" || persist.sourceKind === "state" || persist.sourceKind === "fixed" || persist.sourceKind === "response" || persist.sourceKind === "clear" || persist.sourceKind === "function" ? persist.sourceKind : timing === "before" ? "state" : "response";
29093
29757
  const shelf = persist.shelf === "store" ? "store" : persist.shelf === "session" ? "session" : "local";
29094
29758
  const target = properties[persist.propertyId ?? ""];
29095
29759
  const value2 = shelf === "store" && sourceKind === "fixed" && target?.dataType.type === "boolean" && target.cardinality === "one" ? persist.value === "true" || persist.value === "false" ? persist.value : "undefined" : persist.value;
29760
+ const { transform: rawTransform, ...rest } = persist;
29761
+ const transform = sourceKind === "function" ? sanitizeOutcomeTransform(rawTransform, functions) : void 0;
29096
29762
  return {
29097
- ...persist,
29763
+ ...rest,
29098
29764
  timing,
29099
29765
  sourceKind,
29100
29766
  shelf,
29101
- ...value2 !== void 0 ? { value: value2 } : {}
29767
+ ...value2 !== void 0 ? { value: value2 } : {},
29768
+ ...transform && transform.args.every((arg) => arg.source !== "response") ? { transform } : {}
29102
29769
  };
29103
29770
  }).filter(
29104
- (persist) => (persist.sourceKind !== "response" || persist.timing === "after") && (persist.sourceKind !== "state" || !!persist.source.length && !!properties[persist.source[0]]) && (persist.sourceKind !== "args" || !!persist.arg) && (persist.sourceKind !== "fixed" || typeof persist.value === "string") && (persist.shelf === "store" ? persist.sourceKind !== "state" && !!properties[persist.propertyId ?? ""] : !!persist.key.trim())
29771
+ (persist) => (persist.sourceKind !== "clear" && persist.sourceKind !== "function" || persist.timing === "before" && persist.shelf === "store") && (persist.sourceKind !== "function" || !!persist.transform) && (persist.sourceKind !== "response" || persist.timing === "after") && (persist.sourceKind !== "state" || !!persist.source.length && !!properties[persist.source[0]]) && (persist.sourceKind !== "args" || !!persist.arg) && (persist.sourceKind !== "fixed" || typeof persist.value === "string") && (persist.shelf === "store" ? persist.sourceKind !== "state" && !!properties[persist.propertyId ?? ""] : !!persist.key.trim())
29105
29772
  );
29106
29773
  const computes = (Array.isArray(method.computes) ? method.computes : []).filter(
29107
29774
  (compute) => !!compute && typeof compute.id === "string" && !!compute.id && typeof compute.name === "string" && !!compute.name.trim() && typeof compute.functionId === "string" && !!functions[compute.functionId] && !!compute.args && typeof compute.args === "object"
@@ -30206,7 +30873,9 @@ function sanitizeControlGroups(groups) {
30206
30873
  // Recomputed rather than read: the count is what the chip says out loud,
30207
30874
  // and a stored one that disagreed with the map would be a lie the User
30208
30875
  // reads on every render.
30209
- count: Object.keys(controls).length - 1
30876
+ count: Object.keys(controls).length - 1,
30877
+ // Kept only when it could name a heading; anything else is uncategorised.
30878
+ ...isValidControlGroupCategory(candidate["category"]) ? { category: candidate["category"] } : {}
30210
30879
  };
30211
30880
  }
30212
30881
  return result;
@@ -30403,10 +31072,10 @@ var sanitizeEnumMembers = (raw, hasValue, valueType) => {
30403
31072
  let value;
30404
31073
  if (hasValue && valueType === "string") {
30405
31074
  const given = typeof stored.value === "string" && stored.value.trim() ? stored.value : stored.key;
30406
- let text2 = takenTexts.has(given) ? stored.key : given;
30407
- for (let n = 2; takenTexts.has(text2); n++) text2 = `${stored.key}_${n}`;
30408
- takenTexts.add(text2);
30409
- value = text2;
31075
+ let text3 = takenTexts.has(given) ? stored.key : given;
31076
+ for (let n = 2; takenTexts.has(text3); n++) text3 = `${stored.key}_${n}`;
31077
+ takenTexts.add(text3);
31078
+ value = text3;
30410
31079
  } else if (hasValue) {
30411
31080
  const given = typeof stored.value === "number" && Number.isFinite(stored.value) ? Math.trunc(stored.value) : void 0;
30412
31081
  value = given !== void 0 && !takenValues.has(given) ? given : 0;
@@ -30766,14 +31435,19 @@ function buildDesignSource(ws, operations = drawnOperations(ws)) {
30766
31435
  });
30767
31436
  Object.entries(
30768
31437
  docsToFiles(ws.docs ?? {}, (name3, lang) => docSourcePath(name3, lang))
30769
- ).forEach(([path, text2]) => {
30770
- files3[`${DESIGN_ASSETS_DIR}/${path}`] = text2;
31438
+ ).forEach(([path, text3]) => {
31439
+ files3[`${DESIGN_ASSETS_DIR}/${path}`] = text3;
30771
31440
  });
30772
31441
  ws.screens.forEach(({ meta, state }) => {
30773
31442
  files3[`${DESIGN_SCREENS_DIR}/${meta.id}.json`] = json({
30774
31443
  v: WORKSPACE_SCHEMA_VERSION,
30775
31444
  meta,
30776
- state: { ...state, controlMap: compactControlMap(state.controlMap) }
31445
+ state: {
31446
+ ...state,
31447
+ selectedControl: void 0,
31448
+ selectedLayerId: 0,
31449
+ controlMap: compactControlMap(state.controlMap)
31450
+ }
30777
31451
  });
30778
31452
  });
30779
31453
  files3[DESIGN_WRITE_ID_PATH] = `${designWriteId(files3)}
@@ -30781,10 +31455,10 @@ function buildDesignSource(ws, operations = drawnOperations(ws)) {
30781
31455
  return files3;
30782
31456
  }
30783
31457
  var isDesignSourcePath = (path) => path === DESIGN_INDEX_PATH || path === DESIGN_WRITE_ID_PATH || path === DESIGN_EMITTED_PATH || path === DESIGN_NAV_PATH || path === DESIGN_HAND_PATH || path === DESIGN_OPERATIONS_PATH || path.startsWith(`${DESIGN_SCREENS_DIR}/`) || path.startsWith(`${DESIGN_ASSETS_DIR}/`);
30784
- var parsed = (text2) => {
30785
- if (text2 === void 0) return void 0;
31458
+ var parsed = (text3) => {
31459
+ if (text3 === void 0) return void 0;
30786
31460
  try {
30787
- return JSON.parse(text2);
31461
+ return JSON.parse(text3);
30788
31462
  } catch {
30789
31463
  return void 0;
30790
31464
  }
@@ -30836,9 +31510,9 @@ function readDesignSource(files3) {
30836
31510
  const stored = step.blob;
30837
31511
  const docs = docsFromFiles(
30838
31512
  Object.fromEntries(
30839
- Object.entries(files3).filter(([path]) => path.startsWith(`${DESIGN_ASSETS_DIR}/`)).map(([path, text2]) => [
31513
+ Object.entries(files3).filter(([path]) => path.startsWith(`${DESIGN_ASSETS_DIR}/`)).map(([path, text3]) => [
30840
31514
  path.slice(`${DESIGN_ASSETS_DIR}/`.length),
30841
- text2
31515
+ text3
30842
31516
  ])
30843
31517
  ),
30844
31518
  DOCS_FOLDER
@@ -30905,8 +31579,8 @@ function rewrites(files3, source) {
30905
31579
  );
30906
31580
  return [...paths].some((path) => files3[path] !== encoded[path]);
30907
31581
  }
30908
- function writeIdOf(text2) {
30909
- const id = text2?.trim();
31582
+ function writeIdOf(text3) {
31583
+ const id = text3?.trim();
30910
31584
  return id ? id : void 0;
30911
31585
  }
30912
31586
  var designSourceEmitted = (ws) => Object.entries(buildDesignSource(ws)).map(([path, contents]) => ({
@@ -30914,6 +31588,107 @@ var designSourceEmitted = (ws) => Object.entries(buildDesignSource(ws)).map(([pa
30914
31588
  contents
30915
31589
  }));
30916
31590
 
31591
+ // libs/codegen/src/lib/tree-helper.ts
31592
+ function buildTree(controlMap, rootControlIds, selection) {
31593
+ const state = (id) => selection ? variantRenderState(id, controlMap, selection) : "solid";
31594
+ const resolveDirectives = (ctrl) => {
31595
+ if (!ctrl.directives) return void 0;
31596
+ const resolved = {};
31597
+ for (const [name3, directive] of Object.entries(ctrl.directives)) {
31598
+ if (directive.overlayId) {
31599
+ const overlay = controlMap[directive.overlayId];
31600
+ if (overlay) {
31601
+ resolved[name3] = {
31602
+ overlayId: directive.overlayId,
31603
+ type: overlay.type,
31604
+ configs: overlay.configs
31605
+ };
31606
+ }
31607
+ } else {
31608
+ resolved[name3] = { configs: directive.configs ?? {} };
31609
+ }
31610
+ }
31611
+ return Object.keys(resolved).length > 0 ? resolved : void 0;
31612
+ };
31613
+ const toNode = (ctrl) => {
31614
+ const childrens = getChildren(ctrl.id);
31615
+ const fullyFaded = state(ctrl.id) === "faded" && childrens.every((child) => child.faded);
31616
+ return {
31617
+ type: ctrl.type,
31618
+ id: ctrl.id,
31619
+ configs: ctrl.configs,
31620
+ childrens,
31621
+ directives: resolveDirectives(ctrl),
31622
+ ...ctrl.source ? { source: ctrl.source } : {},
31623
+ ...ctrl.variants?.length ? { variants: ctrl.variants } : {},
31624
+ // Carried through so renderBranch can order the `@else` last and spell it
31625
+ // without reaching back into ControlMap mid-walk (GLOSSARY.md DefaultArm).
31626
+ ...ctrl.armKind ? { armKind: ctrl.armKind } : {},
31627
+ ...ctrl.variantKind ? { variantKind: ctrl.variantKind } : {},
31628
+ ...ctrl.outputs && Object.keys(ctrl.outputs).length ? { outputs: ctrl.outputs } : {},
31629
+ ...ctrl.outputArgs && Object.keys(ctrl.outputArgs).length ? { outputArgs: ctrl.outputArgs } : {},
31630
+ ...ctrl.outputWrites && Object.keys(ctrl.outputWrites).length ? { outputWrites: ctrl.outputWrites } : {},
31631
+ ...ctrl.outputEmits && Object.keys(ctrl.outputEmits).length ? { outputEmits: ctrl.outputEmits } : {},
31632
+ ...ctrl.outputScreenWrites && Object.keys(ctrl.outputScreenWrites).length ? { outputScreenWrites: ctrl.outputScreenWrites } : {},
31633
+ ...ctrl.outputOpens && Object.keys(ctrl.outputOpens).length ? { outputOpens: ctrl.outputOpens } : {},
31634
+ ...ctrl.outputNavs && Object.keys(ctrl.outputNavs).length ? { outputNavs: ctrl.outputNavs } : {},
31635
+ ...ctrl.outputNewTabs && Object.keys(ctrl.outputNewTabs).length ? { outputNewTabs: ctrl.outputNewTabs } : {},
31636
+ ...ctrl.outputOutcomes && Object.keys(ctrl.outputOutcomes).length ? { outputOutcomes: ctrl.outputOutcomes } : {},
31637
+ // Without this the codegen walk reads `outputArms` off a Tree that never
31638
+ // carried it, every gated output falls back to ungated, and its groups —
31639
+ // filed under `<output>|arm:<armId>` — are skipped as qualified keys. The
31640
+ // output emits nothing at all (GLOSSARY.md OutputArm).
31641
+ ...ctrl.outputArms && Object.keys(ctrl.outputArms).length ? { outputArms: ctrl.outputArms } : {},
31642
+ // Without this every group fires its first call alone: the rest are
31643
+ // filed under `<group>|call:<callId>` and read in the order this holds
31644
+ // (GLOSSARY.md OutputCall).
31645
+ ...ctrl.outputCalls && Object.keys(ctrl.outputCalls).length ? { outputCalls: ctrl.outputCalls } : {},
31646
+ ...ctrl.outputScreenMethods && Object.keys(ctrl.outputScreenMethods).length ? { outputScreenMethods: ctrl.outputScreenMethods } : {},
31647
+ ...ctrl.menuActions?.length ? { menuActions: ctrl.menuActions } : {},
31648
+ ...ctrl.screenId ? { screenId: ctrl.screenId } : {},
31649
+ // The other answer to what a ScreenControl mounts (ADR 0088). Carried
31650
+ // for `screenId`'s reason: the Canvas labels its placeholder from it and
31651
+ // codegen emits its tag.
31652
+ ...ctrl.handRef ? { handRef: ctrl.handRef } : {},
31653
+ ...ctrl.screenInputs && Object.keys(ctrl.screenInputs).length ? { screenInputs: ctrl.screenInputs } : {},
31654
+ // Carried for `screenId`'s reason: the Canvas draws the embed's box at
31655
+ // it and codegen emits it on the tag.
31656
+ ...ctrl.maxWidth ? { maxWidth: ctrl.maxWidth } : {},
31657
+ ...ctrl.checks?.length ? { checks: ctrl.checks } : {},
31658
+ ...ctrl.formatPipes?.length ? { formatPipes: ctrl.formatPipes } : {},
31659
+ ...ctrl.cards ? { cards: ctrl.cards } : {},
31660
+ ...ctrl.search ? { search: ctrl.search } : {},
31661
+ // A Repeat's row count, carried for `cards`' reason: the Canvas draws
31662
+ // its sample rows from the Tree alone. Nothing else reads it — codegen
31663
+ // never emits a count (GLOSSARY.md SampleValue).
31664
+ ...ctrl.repeat?.sampleRows !== void 0 ? { sampleRows: ctrl.repeat.sampleRows } : {},
31665
+ ...fullyFaded ? { faded: true } : {}
31666
+ };
31667
+ };
31668
+ const getChildren = (parentId) => {
31669
+ const parent = controlMap[parentId];
31670
+ if (!parent || !parent.childrens) return [];
31671
+ return parent.childrens.map((childId) => controlMap[childId]).filter(Boolean).filter((ctrl) => state(ctrl.id) !== "hidden").map(toNode);
31672
+ };
31673
+ const tree = rootControlIds.map((id) => controlMap[id]).filter(Boolean).filter((ctrl) => state(ctrl.id) !== "hidden").map(toNode);
31674
+ return selection ? markFadedRoots(tree) : tree;
31675
+ }
31676
+ function markFadedRoots(nodes, underFaded = false) {
31677
+ return nodes.map((node) => {
31678
+ const faded = !underFaded && node.faded;
31679
+ const next = {
31680
+ ...node,
31681
+ childrens: markFadedRoots(node.childrens, underFaded || !!node.faded)
31682
+ };
31683
+ if (faded) {
31684
+ next.faded = true;
31685
+ } else {
31686
+ delete next.faded;
31687
+ }
31688
+ return next;
31689
+ });
31690
+ }
31691
+
30917
31692
  // libs/codegen/src/lib/overlay-widgets-helper.ts
30918
31693
  var overlayWidgetScreenIds = (maps) => {
30919
31694
  const ids = /* @__PURE__ */ new Set();
@@ -31607,7 +32382,7 @@ var GENERATED_SET = [
31607
32382
  var inGeneratedSet = (path) => isGeneratedPath(path) || !isCustomPath(path) && path.startsWith("src/app/shared/type/");
31608
32383
 
31609
32384
  // libs/codegen/src/lib/scaffold-helper.ts
31610
- var endWithNewline = (text2) => text2.endsWith("\n") ? text2 : `${text2}
32385
+ var endWithNewline = (text3) => text3.endsWith("\n") ? text3 : `${text3}
31611
32386
  `;
31612
32387
  var NG_VERSION = "22.2.1";
31613
32388
  var TS_VERSION = "6.0.3";
@@ -33949,9 +34724,13 @@ var blankLiteral = (dataType, cardinality) => {
33949
34724
  };
33950
34725
  var modelLiteral = (fields, value) => fields.length ? `{ ${fields.map((field) => `${key(field.name)}: ${value(field)}`).join(", ")} }` : "{}";
33951
34726
  var validationTest = (path, emission, shapes = {}) => {
33952
- const { memberName: memberName2, fields, stateChecks, statePropertyNames } = emission;
34727
+ const { memberName: memberName2, fields, stateChecks, statePropertyNames, limitReads } = emission;
33953
34728
  const takesState = statePropertyNames.length > 0;
33954
- const schema = takesState ? `${memberName2}({ ${statePropertyNames.map((name3) => `${key(name3)}: () => holds`).join(", ")} })` : memberName2;
34729
+ const factoryArgs = [
34730
+ ...statePropertyNames.map((name3) => `${key(name3)}: () => holds`),
34731
+ ...limitReads.map((read) => `${key(read.name)}: () => undefined`)
34732
+ ];
34733
+ const schema = factoryArgs.length ? `${memberName2}({ ${factoryArgs.join(", ")} })` : memberName2;
33955
34734
  const runs = takesState ? ["true", "false"] : [""];
33956
34735
  const readAll = (model) => runs.map(
33957
34736
  (holds) => `expect(Object.keys(errorsOf(${[model, holds].filter(Boolean).join(", ")}))).toEqual(Object.keys(${model}));`
@@ -34297,36 +35076,17 @@ var emitEnumFiles = (ws) => {
34297
35076
  const enums = ws.enums ?? {};
34298
35077
  return Object.values(enums).map((appEnum) => emitEnumFile(appEnum));
34299
35078
  };
34300
- var inReach = (ws) => withPropertyEnums(
34301
- ws.sharedShapes ? { ...ws, features: featuresInReach(ws.features, ws.sharedShapes) } : ws
34302
- );
34303
- var withPropertyEnums = (ws) => {
34304
- const features = Object.fromEntries(
34305
- Object.entries(ws.features).map(([id, feature]) => {
34306
- const controlMaps = ws.screens.filter(
34307
- (screen) => screen.meta.kind === "feature" && screen.meta.featureId === id
34308
- ).map((screen) => screen.state.controlMap);
34309
- const subStores = feature.subStores ? Object.fromEntries(
34310
- Object.entries(feature.subStores).map(([subId, sub]) => [
34311
- subId,
34312
- {
34313
- ...sub,
34314
- properties: stampStatePropertyEnums(sub.properties, controlMaps)
34315
- }
34316
- ])
34317
- ) : void 0;
34318
- return [
34319
- id,
34320
- {
34321
- ...feature,
34322
- properties: stampStatePropertyEnums(feature.properties, controlMaps),
34323
- ...subStores ? { subStores } : {}
34324
- }
34325
- ];
34326
- })
34327
- );
34328
- return { ...ws, features };
34329
- };
35079
+ var inReach = (ws) => ({
35080
+ ...ws,
35081
+ features: featuresAsRead(
35082
+ ws.features,
35083
+ ws.sharedShapes ?? {},
35084
+ ws.screens.map(({ meta, state }) => ({
35085
+ ...meta.kind === "feature" ? { featureId: meta.featureId } : {},
35086
+ controlMap: state.controlMap
35087
+ }))
35088
+ )
35089
+ });
34330
35090
  var emitFormShapeFiles = (ws) => {
34331
35091
  const functions = { ...ws.functions };
34332
35092
  Object.values(ws.features).forEach((feature) => {
@@ -34781,7 +35541,7 @@ var VALUE_SOURCES = [
34781
35541
  VALUE_SOURCE.static,
34782
35542
  VALUE_SOURCE.dynamic
34783
35543
  ];
34784
- var hasValueSource = (type) => type === "price_ladder_mark" /* PRICE_LADDER_MARK */;
35544
+ var hasValueSource = (type) => type === "scale_mark" /* SCALE_MARK */;
34785
35545
  var isValueSource = (value) => VALUE_SOURCES.includes(value);
34786
35546
  var valueSourceOf = (control) => {
34787
35547
  if (control?.valueSource) return control.valueSource;
@@ -35091,6 +35851,7 @@ var HISTORY_SELECTION_KEYS = [
35091
35851
  OUTPUT_ARM_SEPARATOR,
35092
35852
  OUTPUT_ARM_SOURCES,
35093
35853
  OUTPUT_CALL_SEPARATOR,
35854
+ OUTPUT_GROUP_MAPS,
35094
35855
  OUTPUT_PAYLOADS,
35095
35856
  PAGES_ROOT,
35096
35857
  PAGE_FILING,
@@ -35261,6 +36022,8 @@ var HISTORY_SELECTION_KEYS = [
35261
36022
  bindingPathText,
35262
36023
  bindingShapeId,
35263
36024
  bindingsNeedTranslate,
36025
+ boundSlotMismatch,
36026
+ boundSlotType,
35264
36027
  buildDesignSource,
35265
36028
  buildFormShape,
35266
36029
  buildOutputOpenValue,
@@ -35332,6 +36095,7 @@ var HISTORY_SELECTION_KEYS = [
35332
36095
  caseLiteral,
35333
36096
  caseLiteralValue,
35334
36097
  casesFromJson,
36098
+ castTransform,
35335
36099
  chainCall,
35336
36100
  chainInputType,
35337
36101
  chainReturnType,
@@ -35346,6 +36110,7 @@ var HISTORY_SELECTION_KEYS = [
35346
36110
  childNavId,
35347
36111
  classCardScope,
35348
36112
  clearOutputCallRows,
36113
+ clearOutputGroupRows,
35349
36114
  coerceImgSrcOrigin,
35350
36115
  collectCardEmits,
35351
36116
  collectComputedOptionSets,
@@ -35499,6 +36264,7 @@ var HISTORY_SELECTION_KEYS = [
35499
36264
  emitOverlayFiles,
35500
36265
  emitShippedShellFiles,
35501
36266
  emitTransformExpr,
36267
+ emittedDataType,
35502
36268
  emittedFormIds,
35503
36269
  emittedOperation,
35504
36270
  emittedResponse,
@@ -35541,6 +36307,7 @@ var HISTORY_SELECTION_KEYS = [
35541
36307
  featureStoreFile,
35542
36308
  featureStoreProp,
35543
36309
  featureStorePropName,
36310
+ featuresAsRead,
35544
36311
  featuresInReach,
35545
36312
  fieldCanBeAbsent,
35546
36313
  fieldCheckArgParams,
@@ -35577,6 +36344,7 @@ var HISTORY_SELECTION_KEYS = [
35577
36344
  fixedItems,
35578
36345
  fnv64,
35579
36346
  foldedButtonName,
36347
+ foldedButtonNames,
35580
36348
  foldedButtons,
35581
36349
  foldedRouterLink,
35582
36350
  formEventMembers,
@@ -35758,6 +36526,7 @@ var HISTORY_SELECTION_KEYS = [
35758
36526
  isKeyedRepeat,
35759
36527
  isKnownVariantId,
35760
36528
  isLegalNavTail,
36529
+ isLimitDrawn,
35761
36530
  isLinkedFormModel,
35762
36531
  isLinkedKeySource,
35763
36532
  isLinkedVariable,
@@ -35835,6 +36604,7 @@ var HISTORY_SELECTION_KEYS = [
35835
36604
  isUnaryOutputArmOperator,
35836
36605
  isUsableTranslation,
35837
36606
  isValidAssetPath,
36607
+ isValidControlGroupCategory,
35838
36608
  isValidControlGroupName,
35839
36609
  isValidFormName,
35840
36610
  isValidFunctionName,
@@ -35858,10 +36628,12 @@ var HISTORY_SELECTION_KEYS = [
35858
36628
  isVariantJoin,
35859
36629
  isVariantKind,
35860
36630
  jsNativesInGroup,
36631
+ keptNodeId,
35861
36632
  keyCandidates,
35862
36633
  keyIdKeeper,
35863
36634
  labelChainOf,
35864
36635
  labelEmission,
36636
+ labelHeadType,
35865
36637
  labelReadIsTranslated,
35866
36638
  landingNavId,
35867
36639
  landsOn,
@@ -35871,6 +36643,9 @@ var HISTORY_SELECTION_KEYS = [
35871
36643
  liftToList,
35872
36644
  liftToListInTemplate,
35873
36645
  liftsToList,
36646
+ limitSourceFor,
36647
+ limitSourceOf,
36648
+ limitSources,
35874
36649
  linkDrift,
35875
36650
  linkTargetKind,
35876
36651
  linkedVariableReaders,
@@ -36152,6 +36927,7 @@ var HISTORY_SELECTION_KEYS = [
36152
36927
  pathChipDisplay,
36153
36928
  pathCrossesCollection,
36154
36929
  pathDisplay,
36930
+ pathLeafEnumId,
36155
36931
  pathLeafType,
36156
36932
  pathsFor,
36157
36933
  payloadEventRoot,
@@ -36294,6 +37070,7 @@ var HISTORY_SELECTION_KEYS = [
36294
37070
  ruleReferencedIds,
36295
37071
  ruleRootProperties,
36296
37072
  sameCallTarget,
37073
+ sameFeaturesAsRead,
36297
37074
  sameOrigin,
36298
37075
  sameOwner,
36299
37076
  sampleRows,
@@ -36439,6 +37216,7 @@ var HISTORY_SELECTION_KEYS = [
36439
37216
  slugifyMessage,
36440
37217
  sortRowEnumId,
36441
37218
  sourceCarriesTrackKey,
37219
+ stableId,
36442
37220
  staleCases,
36443
37221
  staleMenuActionItems,
36444
37222
  stampStatePropertyEnums,
@@ -36605,14 +37383,20 @@ var HISTORY_SELECTION_KEYS = [
36605
37383
  withCases,
36606
37384
  withDefaultRow,
36607
37385
  withEmittedTests,
37386
+ withEventTransform,
36608
37387
  withFormShapes,
36609
37388
  withListRowShape,
37389
+ withPropertyEnums,
36610
37390
  withScreenEnums,
36611
37391
  withScreenMethodCallSites,
36612
37392
  withVariableEnums,
36613
37393
  wouldComputedCycle,
36614
37394
  wouldCycle,
36615
37395
  wouldScreenComputedCycle,
37396
+ writeEventIssue,
37397
+ writeEventMismatch,
37398
+ writeEventReadType,
37399
+ writeEventTransforms,
36616
37400
  writeFileAt,
36617
37401
  writeIdIn,
36618
37402
  writeIdOf,