@magmonium/cli 0.8.18 → 0.8.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/codegen/index.js CHANGED
@@ -84,9 +84,10 @@ __export(index_exports, {
84
84
  DEFAULT_DEV_SOCKET_URL: () => DEFAULT_DEV_SOCKET_URL,
85
85
  DEFAULT_INDEX_ALIAS: () => DEFAULT_INDEX_ALIAS,
86
86
  DEFAULT_ITEM_ALIAS: () => DEFAULT_ITEM_ALIAS,
87
- DEFAULT_NORMAL_AUTH_URL: () => DEFAULT_NORMAL_AUTH_URL,
88
- DEFAULT_NORMAL_BACKEND_URL: () => DEFAULT_NORMAL_BACKEND_URL,
89
- DEFAULT_NORMAL_SOCKET_URL: () => DEFAULT_NORMAL_SOCKET_URL,
87
+ DEFAULT_KEY_ALIAS: () => DEFAULT_KEY_ALIAS,
88
+ DEFAULT_LOCAL_AUTH_URL: () => DEFAULT_LOCAL_AUTH_URL,
89
+ DEFAULT_LOCAL_BACKEND_URL: () => DEFAULT_LOCAL_BACKEND_URL,
90
+ DEFAULT_LOCAL_SOCKET_URL: () => DEFAULT_LOCAL_SOCKET_URL,
90
91
  DEFAULT_PROD_AUTH_URL: () => DEFAULT_PROD_AUTH_URL,
91
92
  DEFAULT_PROD_BACKEND_URL: () => DEFAULT_PROD_BACKEND_URL,
92
93
  DEFAULT_PROD_SOCKET_URL: () => DEFAULT_PROD_SOCKET_URL,
@@ -142,6 +143,8 @@ __export(index_exports, {
142
143
  FORMAT_PIPE_LABEL: () => FORMAT_PIPE_LABEL,
143
144
  FORMAT_PIPE_NAMES: () => FORMAT_PIPE_NAMES,
144
145
  FORM_NAME_CONFIG_KEY: () => FORM_NAME_CONFIG_KEY,
146
+ FUNCTION_LIBRARY_GROUPS: () => FUNCTION_LIBRARY_GROUPS,
147
+ FUNCTION_STARTERS: () => FUNCTION_STARTERS,
145
148
  GENERATED_SET: () => GENERATED_SET,
146
149
  GLOBAL_METHOD_CATALOG: () => GLOBAL_METHOD_CATALOG,
147
150
  GLOBAL_METHOD_STORES: () => GLOBAL_METHOD_STORES,
@@ -247,6 +250,7 @@ __export(index_exports, {
247
250
  PLUGIN_INPUTS_KEY: () => PLUGIN_INPUTS_KEY,
248
251
  PLUGIN_LINK_KEY: () => PLUGIN_LINK_KEY,
249
252
  PLUGIN_OUTPUTS_KEY: () => PLUGIN_OUTPUTS_KEY,
253
+ PLUGIN_OUTPUT_SHAPES_KEY: () => PLUGIN_OUTPUT_SHAPES_KEY,
250
254
  PLUGIN_PORT_KEY: () => PLUGIN_PORT_KEY,
251
255
  PLUGIN_SCREEN_KEY: () => PLUGIN_SCREEN_KEY,
252
256
  PLUGIN_SOURCE_KEY: () => PLUGIN_SOURCE_KEY,
@@ -293,6 +297,7 @@ __export(index_exports, {
293
297
  SHARED_SHAPE_ID_PREFIX: () => SHARED_SHAPE_ID_PREFIX,
294
298
  SHIPPED_SHELL_PATHS: () => SHIPPED_SHELL_PATHS,
295
299
  SOURCE_LANG: () => SOURCE_LANG,
300
+ STARTER_GROUP: () => STARTER_GROUP,
296
301
  STAT_TEXT_SOURCES: () => STAT_TEXT_SOURCES,
297
302
  STORAGE_SERVICE: () => STORAGE_SERVICE,
298
303
  STYLE_DIRECTIVE_FORM: () => STYLE_DIRECTIVE_FORM,
@@ -337,6 +342,7 @@ __export(index_exports, {
337
342
  addMenuGroup: () => addMenuGroup,
338
343
  addMenuGroupSeeded: () => addMenuGroupSeeded,
339
344
  admitsTextSource: () => admitsTextSource,
345
+ aliasDisplayName: () => aliasDisplayName,
340
346
  aliasHoldersInScope: () => aliasHoldersInScope,
341
347
  aliasNames: () => aliasNames,
342
348
  aliasSourceSlot: () => aliasSourceSlot,
@@ -380,6 +386,7 @@ __export(index_exports, {
380
386
  bindablePaths: () => bindablePaths,
381
387
  bindingAlwaysPresent: () => bindingAlwaysPresent,
382
388
  bindingCanvasText: () => bindingCanvasText,
389
+ bindingCardinality: () => bindingCardinality,
383
390
  bindingDataType: () => bindingDataType,
384
391
  bindingDisplayText: () => bindingDisplayText,
385
392
  bindingExpression: () => bindingExpression,
@@ -424,6 +431,9 @@ __export(index_exports, {
424
431
  callArgumentsExpression: () => callArgumentsExpression,
425
432
  callError: () => callError,
426
433
  callStatement: () => callStatement,
434
+ callTargetKey: () => callTargetKey,
435
+ callTargetName: () => callTargetName,
436
+ callTargetOfKey: () => callTargetOfKey,
427
437
  callableMethods: () => callableMethods,
428
438
  canAddChildType: () => canAddChildType,
429
439
  canAppendFormatPipe: () => canAppendFormatPipe,
@@ -499,6 +509,7 @@ __export(index_exports, {
499
509
  comparisonSource: () => comparisonSource,
500
510
  componentInputShapeIds: () => componentInputShapeIds,
501
511
  componentInputTsType: () => componentInputTsType,
512
+ composeFunctionBinding: () => composeFunctionBinding,
502
513
  composeLabelValue: () => composeLabelValue,
503
514
  computeError: () => computeError,
504
515
  computeId: () => computeId,
@@ -548,6 +559,7 @@ __export(index_exports, {
548
559
  createCompute: () => createCompute,
549
560
  createCondition: () => createCondition,
550
561
  createConfirm: () => createConfirm,
562
+ createFunctionLeaf: () => createFunctionLeaf,
551
563
  createGroup: () => createGroup,
552
564
  createOpen: () => createOpen,
553
565
  createOutputNav: () => createOutputNav,
@@ -570,14 +582,11 @@ __export(index_exports, {
570
582
  decodeWorkspace: () => decodeWorkspace,
571
583
  defaultCallArgEvent: () => defaultCallArgEvent,
572
584
  defaultChildId: () => defaultChildId,
573
- defaultDevHosts: () => defaultDevHosts,
574
585
  defaultEnvironment: () => defaultEnvironment,
575
586
  defaultLiteralFor: () => defaultLiteralFor,
576
- defaultNormalHosts: () => defaultNormalHosts,
577
587
  defaultOptionValue: () => defaultOptionValue,
578
588
  defaultOutputArm: () => defaultOutputArm,
579
589
  defaultOutputOpenValue: () => defaultOutputOpenValue,
580
- defaultProdHosts: () => defaultProdHosts,
581
590
  defaultScreenEmitValue: () => defaultScreenEmitValue,
582
591
  defaultScreenWriteValue: () => defaultScreenWriteValue,
583
592
  defaultStateWriteValue: () => defaultStateWriteValue,
@@ -683,7 +692,9 @@ __export(index_exports, {
683
692
  firstControlAtLayer: () => firstControlAtLayer,
684
693
  fittedCaseArgs: () => fittedCaseArgs,
685
694
  fixedAllowed: () => fixedAllowed,
695
+ fixedExpression: () => fixedExpression,
686
696
  fixedIsText: () => fixedIsText,
697
+ fixedItems: () => fixedItems,
687
698
  fnv64: () => fnv64,
688
699
  foldedButtonName: () => foldedButtonName,
689
700
  foldedButtons: () => foldedButtons,
@@ -724,6 +735,11 @@ __export(index_exports, {
724
735
  formatPipeExpression: () => formatPipeExpression,
725
736
  formatPipeImports: () => formatPipeImports,
726
737
  formatPipesOf: () => formatPipesOf,
738
+ functionBindingArgs: () => functionBindingArgs,
739
+ functionBindingId: () => functionBindingId,
740
+ functionBindingTarget: () => functionBindingTarget,
741
+ functionChipDisplay: () => functionChipDisplay,
742
+ functionError: () => functionError,
727
743
  functionFileBase: () => functionFileBase,
728
744
  functionFilePath: () => functionFilePath,
729
745
  functionImportPath: () => functionImportPath,
@@ -741,6 +757,7 @@ __export(index_exports, {
741
757
  generateFormInterface: () => generateFormInterface,
742
758
  generateFormValidation: () => generateFormValidation,
743
759
  generateFormValidationFile: () => generateFormValidationFile,
760
+ generateFunctionExpression: () => generateFunctionExpression,
744
761
  generateFunctionFile: () => generateFunctionFile,
745
762
  generateHtml: () => generateHtml,
746
763
  generateRuleExpression: () => generateRuleExpression,
@@ -854,7 +871,9 @@ __export(index_exports, {
854
871
  isFunctionInUse: () => isFunctionInUse,
855
872
  isGeneratedPath: () => isGeneratedPath,
856
873
  isHeld: () => isHeld,
874
+ isIdentifier: () => isIdentifier,
857
875
  isKeyArg: () => isKeyArg,
876
+ isKeyedRepeat: () => isKeyedRepeat,
858
877
  isKnownVariantId: () => isKnownVariantId,
859
878
  isLegalNavTail: () => isLegalNavTail,
860
879
  isLinkedFormModel: () => isLinkedFormModel,
@@ -997,8 +1016,11 @@ __export(index_exports, {
997
1016
  mappedMethod: () => mappedMethod,
998
1017
  mappedProperties: () => mappedProperties,
999
1018
  maxVariants: () => maxVariants,
1019
+ memberAccess: () => memberAccess,
1000
1020
  memberIdsOf: () => memberIdsOf,
1001
1021
  memberKindOf: () => memberKindOf,
1022
+ memberStep: () => memberStep,
1023
+ memberToken: () => memberToken,
1002
1024
  menuActionCheckLabel: () => menuActionCheckLabel,
1003
1025
  menuActionKey: () => menuActionKey,
1004
1026
  menuActionKeys: () => menuActionKeys,
@@ -1101,6 +1123,7 @@ __export(index_exports, {
1101
1123
  newInstanceFunctionOption: () => newInstanceFunctionOption,
1102
1124
  newOutputArmCheck: () => newOutputArmCheck,
1103
1125
  newRepeatSpec: () => newRepeatSpec,
1126
+ newerVersion: () => newerVersion,
1104
1127
  nextAliasName: () => nextAliasName,
1105
1128
  nextCallArgRow: () => nextCallArgRow,
1106
1129
  nextFieldName: () => nextFieldName,
@@ -1245,14 +1268,18 @@ __export(index_exports, {
1245
1268
  pickFolder: () => pickFolder,
1246
1269
  pickedNavTail: () => pickedNavTail,
1247
1270
  planScreenEmit: () => planScreenEmit,
1271
+ pluginContractResync: () => pluginContractResync,
1248
1272
  pluginContracts: () => pluginContracts,
1249
1273
  pluginInputSlot: () => pluginInputSlot,
1250
1274
  pluginNamesOf: () => pluginNamesOf,
1251
1275
  pluginOriginKey: () => pluginOriginKey,
1276
+ pluginOutputShapeOf: () => pluginOutputShapeOf,
1252
1277
  pluginPickWrites: () => pluginPickWrites,
1253
1278
  pluginPortOf: () => pluginPortOf,
1254
1279
  pluginSourceOf: () => pluginSourceOf,
1280
+ presetHosts: () => presetHosts,
1255
1281
  propertiesWithComputeds: () => propertiesWithComputeds,
1282
+ propertyKey: () => propertyKey,
1256
1283
  pruneFormEventReads: () => pruneFormEventReads,
1257
1284
  pruneMappings: () => pruneMappings,
1258
1285
  pruneMenuActions: () => pruneMenuActions,
@@ -1267,6 +1294,7 @@ __export(index_exports, {
1267
1294
  pureFunctionArgs: () => pureFunctionArgs,
1268
1295
  pureFunctionTest: () => pureFunctionTest,
1269
1296
  pureTarget: () => pureTarget,
1297
+ putSectionTableColumn: () => putSectionTableColumn,
1270
1298
  quantifierApplies: () => quantifierApplies,
1271
1299
  readDesignSource: () => readDesignSource,
1272
1300
  readFileAt: () => readFileAt,
@@ -1320,6 +1348,7 @@ __export(index_exports, {
1320
1348
  repairMessageVariables: () => repairMessageVariables,
1321
1349
  repairSplitShapes: () => repairSplitShapes,
1322
1350
  repairTranslationMarkup: () => repairTranslationMarkup,
1351
+ repeatEntryLets: () => repeatEntryLets,
1323
1352
  repeatGapReason: () => repeatGapReason,
1324
1353
  repeatHeader: () => repeatHeader,
1325
1354
  repeatSpec: () => repeatSpec,
@@ -1355,10 +1384,13 @@ __export(index_exports, {
1355
1384
  routeTargets: () => routeTargets,
1356
1385
  routerLinkMode: () => routerLinkMode,
1357
1386
  routesNavTail: () => routesNavTail,
1387
+ rowMemberOptions: () => rowMemberOptions,
1358
1388
  rowsWithOneDefault: () => rowsWithOneDefault,
1359
1389
  ruleCalls: () => ruleCalls,
1360
1390
  ruleChecks: () => ruleChecks,
1361
1391
  ruleError: () => ruleError,
1392
+ ruleFunctionImports: () => ruleFunctionImports,
1393
+ ruleFunctions: () => ruleFunctions,
1362
1394
  ruleGlobalStores: () => ruleGlobalStores,
1363
1395
  ruleNavs: () => ruleNavs,
1364
1396
  ruleReferencedIds: () => ruleReferencedIds,
@@ -1467,6 +1499,7 @@ __export(index_exports, {
1467
1499
  seededMenuOptions: () => seededMenuOptions,
1468
1500
  segmentOptions: () => segmentOptions,
1469
1501
  selectableShapes: () => selectableShapes,
1502
+ seriesMemberPicks: () => seriesMemberPicks,
1470
1503
  setArmClosesOverlay: () => setArmClosesOverlay,
1471
1504
  setArmDialog: () => setArmDialog,
1472
1505
  setArmNav: () => setArmNav,
@@ -1474,6 +1507,7 @@ __export(index_exports, {
1474
1507
  setMenuActionChecks: () => setMenuActionChecks,
1475
1508
  setOutputArmChecks: () => setOutputArmChecks,
1476
1509
  setOutputArmMode: () => setOutputArmMode,
1510
+ setOutputArmStartsChain: () => setOutputArmStartsChain,
1477
1511
  setVariantJoin: () => setVariantJoin,
1478
1512
  shadowOnPath: () => shadowOnPath,
1479
1513
  shadowedShapes: () => shadowedShapes,
@@ -1501,6 +1535,7 @@ __export(index_exports, {
1501
1535
  staleCases: () => staleCases,
1502
1536
  staleMenuActionItems: () => staleMenuActionItems,
1503
1537
  standardMenuConfigs: () => standardMenuConfigs,
1538
+ starterFunction: () => starterFunction,
1504
1539
  stateComputedArgExpression: () => stateComputedArgExpression,
1505
1540
  stateComputedArgHeldType: () => stateComputedArgHeldType,
1506
1541
  stateInterfaceName: () => stateInterfaceName,
@@ -1577,6 +1612,7 @@ __export(index_exports, {
1577
1612
  toPascalCase: () => toPascalCase,
1578
1613
  toSectionTableColumns: () => toSectionTableColumns,
1579
1614
  toggleFieldOptionValue: () => toggleFieldOptionValue,
1615
+ transformBindingLeaves: () => transformBindingLeaves,
1580
1616
  transformGapDetail: () => transformGapDetail,
1581
1617
  transformIncomplete: () => transformIncomplete,
1582
1618
  transformLabel: () => transformLabel,
@@ -1680,6 +1716,8 @@ var ControlType = /* @__PURE__ */ ((ControlType2) => {
1680
1716
  ControlType2["SECTION_TABLE"] = "section_table";
1681
1717
  ControlType2["SECTION_TABLE_ROW"] = "section_table_row";
1682
1718
  ControlType2["SECTION_TABLE_CELL"] = "section_table_cell";
1719
+ ControlType2["SECTION_CHART"] = "section_chart";
1720
+ ControlType2["SECTION_CHART_SERIES"] = "section_chart_series";
1683
1721
  ControlType2["LIST"] = "list";
1684
1722
  ControlType2["SECTION_SEARCH"] = "section_search";
1685
1723
  ControlType2["SECTION_ACTION"] = "section_action";
@@ -1704,6 +1742,7 @@ var ControlType = /* @__PURE__ */ ((ControlType2) => {
1704
1742
  ControlType2["STAT"] = "stat";
1705
1743
  ControlType2["STAT_VALUE"] = "stat_value";
1706
1744
  ControlType2["STAT_CORNER"] = "stat_corner";
1745
+ ControlType2["HEAT_SWATCH"] = "heat_swatch";
1707
1746
  ControlType2["FORM"] = "form";
1708
1747
  ControlType2["FIELD"] = "field";
1709
1748
  ControlType2["SECTION_BUTTON_GROUP"] = "section_button_group";
@@ -1907,7 +1946,9 @@ document \u2014 there is one source and two places it is read.
1907
1946
  Register the app in the Magmonium Store first \u2014 that is what mints its app id \u2014
1908
1947
  and link it in One UI, so every Push writes that id into \`.magmonium/index.json\`.
1909
1948
  CD reads the app id from \`appTarget.appId\` there, and the backend from
1910
- \`appTarget.environment.prod.backendUrl\`.
1949
+ \`appTarget.environment.hosts.backendUrl\` \u2014 the Environment panel's Backend URL.
1950
+ Pick \`dev\` or \`prod\` there before you merge: a \`local\` one points at your own
1951
+ machine, which a runner cannot reach, so CD refuses it.
1911
1952
 
1912
1953
  Your deploy token is your own, not the app's: rotate it once from the Store
1913
1954
  and reuse it for every app you own or collaborate on. It is the one secret, in
@@ -1953,39 +1994,39 @@ The job builds the bundle, \`POST\`s it to \`/store/v1/bundle/<app-id>\`, then
1953
1994
 
1954
1995
  // libs/codegen/src/model/app-target.ts
1955
1996
  var APP_MODES = ["existing", "new"];
1956
- var ENVIRONMENT_PRESETS = [
1957
- "normal",
1958
- "dev",
1959
- "prod"
1960
- ];
1997
+ var ENVIRONMENT_PRESETS = ["local", "dev", "prod"];
1961
1998
  var DEFAULT_PROD_AUTH_URL = "https://api.magmonium.com";
1962
1999
  var DEFAULT_PROD_BACKEND_URL = "https://api.magmonium.com";
1963
2000
  var DEFAULT_PROD_SOCKET_URL = "wss://pops.magmonium.com";
1964
2001
  var DEFAULT_DEV_AUTH_URL = "https://api-dev.magmonium.com";
1965
2002
  var DEFAULT_DEV_BACKEND_URL = "https://api-dev.magmonium.com";
1966
2003
  var DEFAULT_DEV_SOCKET_URL = "wss://pops-dev.magmonium.com";
1967
- var DEFAULT_NORMAL_AUTH_URL = "https://api-dev.magmonium.com";
1968
- var DEFAULT_NORMAL_BACKEND_URL = "http://localhost:8000";
1969
- var DEFAULT_NORMAL_SOCKET_URL = "wss://pops-dev.magmonium.com";
1970
- var defaultProdHosts = () => ({
1971
- authUrl: DEFAULT_PROD_AUTH_URL,
1972
- backendUrl: DEFAULT_PROD_BACKEND_URL,
1973
- socketUrl: DEFAULT_PROD_SOCKET_URL
1974
- });
1975
- var defaultDevHosts = () => ({
1976
- authUrl: DEFAULT_DEV_AUTH_URL,
1977
- backendUrl: DEFAULT_DEV_BACKEND_URL,
1978
- socketUrl: DEFAULT_DEV_SOCKET_URL
1979
- });
1980
- var defaultNormalHosts = () => ({
1981
- authUrl: DEFAULT_NORMAL_AUTH_URL,
1982
- backendUrl: DEFAULT_NORMAL_BACKEND_URL,
1983
- socketUrl: DEFAULT_NORMAL_SOCKET_URL
2004
+ var DEFAULT_LOCAL_AUTH_URL = "https://api-dev.magmonium.com";
2005
+ var DEFAULT_LOCAL_BACKEND_URL = "http://localhost:8000";
2006
+ var DEFAULT_LOCAL_SOCKET_URL = "wss://pops-dev.magmonium.com";
2007
+ var PRESET_HOSTS = {
2008
+ local: {
2009
+ authUrl: DEFAULT_LOCAL_AUTH_URL,
2010
+ backendUrl: DEFAULT_LOCAL_BACKEND_URL,
2011
+ socketUrl: DEFAULT_LOCAL_SOCKET_URL
2012
+ },
2013
+ dev: {
2014
+ authUrl: DEFAULT_DEV_AUTH_URL,
2015
+ backendUrl: DEFAULT_DEV_BACKEND_URL,
2016
+ socketUrl: DEFAULT_DEV_SOCKET_URL
2017
+ },
2018
+ prod: {
2019
+ authUrl: DEFAULT_PROD_AUTH_URL,
2020
+ backendUrl: DEFAULT_PROD_BACKEND_URL,
2021
+ socketUrl: DEFAULT_PROD_SOCKET_URL
2022
+ }
2023
+ };
2024
+ var presetHosts = (preset) => ({
2025
+ ...PRESET_HOSTS[preset]
1984
2026
  });
1985
- var defaultEnvironment = (overrides) => ({
1986
- normal: { ...defaultNormalHosts(), ...overrides?.normal },
1987
- prod: { ...defaultProdHosts(), ...overrides?.prod },
1988
- dev: { ...defaultDevHosts(), ...overrides?.dev }
2027
+ var defaultEnvironment = (hosts, preset = "local") => ({
2028
+ preset,
2029
+ hosts: { ...presetHosts(preset), ...hosts }
1989
2030
  });
1990
2031
  var EMPTY_APP_TARGET = {
1991
2032
  // `new` rather than `existing`: an empty AppTarget has no folder to read
@@ -2548,22 +2589,41 @@ function generateShapeInterface(shapes, shape, options = {}) {
2548
2589
  ).join("\n") : "";
2549
2590
  const audienceImport = (options.imports ?? true) && shape.keys.some((key2) => key2.dataType.type === "audience") ? `import type { ${AUDIENCE_TYPE_NAME} } from '${AUDIENCE_TYPE_PACKAGE}';` : "";
2550
2591
  const members = shape.keys.map(
2551
- (key2) => ` ${key2.name}: ${tsTypeExpression(
2592
+ (key2) => ` ${shape.positional ? tupleLabel(key2.name) : propertyKey(key2.name)}: ${tsTypeExpression(
2552
2593
  shapes,
2553
2594
  key2.dataType,
2554
2595
  key2.cardinality
2555
- )};`
2596
+ )}${shape.positional ? "," : ";"}`
2556
2597
  ).join("\n");
2557
2598
  const head = [imports, audienceImport].filter(Boolean).join("\n");
2558
- return `${head ? `${head}
2559
-
2560
- ` : ""}export interface ${shapeInterfaceName(
2561
- shape.name
2562
- )} {
2599
+ const body = shape.positional ? `export type ${shapeInterfaceName(shape.name)} = [
2600
+ ${members}
2601
+ ];
2602
+ ` : `export interface ${shapeInterfaceName(shape.name)} {
2563
2603
  ${members}
2564
2604
  }
2565
2605
  `;
2606
+ return `${head ? `${head}
2607
+
2608
+ ` : ""}${body}`;
2609
+ }
2610
+ var IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
2611
+ var isIdentifier = (name3) => IDENTIFIER.test(name3);
2612
+ var quotedName = (name3) => `'${name3.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
2613
+ var propertyKey = (name3) => isIdentifier(name3) ? name3 : quotedName(name3);
2614
+ var tupleLabel = (name3) => {
2615
+ const spelled = name3.replace(/[^\w$]/g, "_");
2616
+ return /^[A-Za-z_$]/.test(spelled) ? spelled : `_${spelled}`;
2617
+ };
2618
+ function memberAccess(shape, key2, optional = false) {
2619
+ if (!shape?.positional) {
2620
+ return isIdentifier(key2.name) ? `${optional ? "?." : "."}${key2.name}` : `${optional ? "?." : ""}[${quotedName(key2.name)}]`;
2621
+ }
2622
+ const index = shape.keys.findIndex((k) => k.id === key2.id);
2623
+ return `${optional ? "?." : ""}[${index}]`;
2566
2624
  }
2625
+ var memberStep = (dot, name3) => name3.startsWith("[") ? dot === "?." ? `?.${name3}` : name3 : `${dot}${name3}`;
2626
+ var memberToken = (shape, key2) => shape?.positional ? `[${shape.keys.findIndex((k) => k.id === key2.id)}]` : key2.name;
2567
2627
  function pruneUnknownShapeRefs(holder, shapes) {
2568
2628
  const shapeId = shapeIdOf(holder.dataType);
2569
2629
  if (!shapeId || shapes[shapeId]) return holder;
@@ -2574,17 +2634,21 @@ function statePathRead(path, properties, shapes, receiver, guarded) {
2574
2634
  const property = properties[head];
2575
2635
  if (!property) return "undefined";
2576
2636
  let dataType = property.dataType;
2577
- const names = [];
2637
+ const accesses = [];
2578
2638
  for (const keyId of rest) {
2579
2639
  const shape = dataType?.type === "shape" ? shapes[dataType.shapeId] : void 0;
2580
2640
  const key2 = shape?.keys.find((k) => k.id === keyId);
2581
2641
  if (!key2) return "undefined";
2582
- names.push(key2.name);
2642
+ accesses.push(
2643
+ memberAccess(shape, key2, !accesses.length && !guarded && !!shape?.positional)
2644
+ );
2583
2645
  dataType = key2.dataType;
2584
2646
  }
2585
- if (!names.length)
2647
+ if (!accesses.length)
2586
2648
  return `${receiver}.${property.name}()${guarded ? "!" : ""}`;
2587
- return `${receiver}.${property.name}()${guarded ? "!" : "?"}.${names.join(".")}`;
2649
+ const [first, ...more] = accesses;
2650
+ const lead = first.startsWith("?.") ? first : `${guarded ? "!" : "?"}${first}`;
2651
+ return `${receiver}.${property.name}()${lead}${more.join("")}`;
2588
2652
  }
2589
2653
 
2590
2654
  // libs/one/src/lib/shared/enum/assets/form-asset-folder.ts
@@ -2613,7 +2677,8 @@ var LAYOUT_ASSET_FOLDER = {
2613
2677
  section_carousel: "section_carousels",
2614
2678
  text_output: "text_outputs",
2615
2679
  list: "lists",
2616
- section_table: "section_tables"
2680
+ section_table: "section_tables",
2681
+ section_chart: "section_charts"
2617
2682
  };
2618
2683
 
2619
2684
  // libs/one/src/lib/shared/ui/form/model/form-type.ts
@@ -3121,6 +3186,7 @@ var CONTROL_RELATIONSHIPS = {
3121
3186
  "section_carousel" /* SECTION_CAROUSEL */,
3122
3187
  "list" /* LIST */,
3123
3188
  "section_table" /* SECTION_TABLE */,
3189
+ "section_chart" /* SECTION_CHART */,
3124
3190
  "row" /* ROW */,
3125
3191
  "col" /* COL */,
3126
3192
  "flex" /* FLEX */,
@@ -3203,12 +3269,14 @@ var CONTROL_RELATIONSHIPS = {
3203
3269
  "plugin" /* PLUGIN */,
3204
3270
  "user" /* USER */,
3205
3271
  "stat" /* STAT */,
3272
+ "heat_swatch" /* HEAT_SWATCH */,
3206
3273
  "flex" /* FLEX */,
3207
3274
  "card" /* CARD */,
3208
3275
  "chat_bubble" /* CHAT_BUBBLE */,
3209
3276
  "section_carousel" /* SECTION_CAROUSEL */,
3210
3277
  "list" /* LIST */,
3211
3278
  "section_table" /* SECTION_TABLE */,
3279
+ "section_chart" /* SECTION_CHART */,
3212
3280
  "section_filter" /* SECTION_FILTER */,
3213
3281
  "section_filter_group" /* SECTION_FILTER_GROUP */,
3214
3282
  "form" /* FORM */,
@@ -3243,6 +3311,18 @@ var CONTROL_RELATIONSHIPS = {
3243
3311
  ],
3244
3312
  // Cells and nothing else — a `<tr>` holds `<td>`s.
3245
3313
  ["section_table_row" /* SECTION_TABLE_ROW */]: ["section_table_cell" /* SECTION_TABLE_CELL */],
3314
+ // Series, a Repeat holding series, and a branch choosing between them — the
3315
+ // SectionTable's list with its rows swapped for lines (libs/one GLOSSARY.md
3316
+ // SectionChart). A Repeat and a branch are transparent, so a repeated series
3317
+ // lands here too. Nothing else: the plot, legend, presets and navigator are
3318
+ // the chart itself, never children.
3319
+ ["section_chart" /* SECTION_CHART */]: [
3320
+ "section_chart_series" /* SECTION_CHART_SERIES */,
3321
+ "repeat" /* REPEAT */,
3322
+ "variant_branch" /* VARIANT_BRANCH */
3323
+ ],
3324
+ // A leaf: a series is its rows and the two members it reads off them.
3325
+ ["section_chart_series" /* SECTION_CHART_SERIES */]: [],
3246
3326
  // Anything a Col holds that is content rather than layout: a cell is one
3247
3327
  // box of one line, so a Section, a Row or an outlet has no business in it.
3248
3328
  ["section_table_cell" /* SECTION_TABLE_CELL */]: [
@@ -3253,6 +3333,7 @@ var CONTROL_RELATIONSHIPS = {
3253
3333
  "img" /* IMG */,
3254
3334
  "user" /* USER */,
3255
3335
  "stat" /* STAT */,
3336
+ "heat_swatch" /* HEAT_SWATCH */,
3256
3337
  "flex" /* FLEX */,
3257
3338
  "card" /* CARD */,
3258
3339
  "chat_bubble" /* CHAT_BUBBLE */,
@@ -3277,12 +3358,14 @@ var CONTROL_RELATIONSHIPS = {
3277
3358
  "plugin" /* PLUGIN */,
3278
3359
  "user" /* USER */,
3279
3360
  "stat" /* STAT */,
3361
+ "heat_swatch" /* HEAT_SWATCH */,
3280
3362
  "flex" /* FLEX */,
3281
3363
  "card" /* CARD */,
3282
3364
  "chat_bubble" /* CHAT_BUBBLE */,
3283
3365
  "section_carousel" /* SECTION_CAROUSEL */,
3284
3366
  "list" /* LIST */,
3285
3367
  "section_table" /* SECTION_TABLE */,
3368
+ "section_chart" /* SECTION_CHART */,
3286
3369
  "section_filter" /* SECTION_FILTER */,
3287
3370
  "section_filter_group" /* SECTION_FILTER_GROUP */,
3288
3371
  "form" /* FORM */,
@@ -3308,12 +3391,14 @@ var CONTROL_RELATIONSHIPS = {
3308
3391
  "plugin" /* PLUGIN */,
3309
3392
  "user" /* USER */,
3310
3393
  "stat" /* STAT */,
3394
+ "heat_swatch" /* HEAT_SWATCH */,
3311
3395
  "flex" /* FLEX */,
3312
3396
  "card" /* CARD */,
3313
3397
  "chat_bubble" /* CHAT_BUBBLE */,
3314
3398
  "section_carousel" /* SECTION_CAROUSEL */,
3315
3399
  "list" /* LIST */,
3316
3400
  "section_table" /* SECTION_TABLE */,
3401
+ "section_chart" /* SECTION_CHART */,
3317
3402
  "section_filter" /* SECTION_FILTER */,
3318
3403
  "section_filter_group" /* SECTION_FILTER_GROUP */,
3319
3404
  "form" /* FORM */,
@@ -3343,11 +3428,13 @@ var CONTROL_RELATIONSHIPS = {
3343
3428
  "plugin" /* PLUGIN */,
3344
3429
  "user" /* USER */,
3345
3430
  "stat" /* STAT */,
3431
+ "heat_swatch" /* HEAT_SWATCH */,
3346
3432
  "card" /* CARD */,
3347
3433
  "chat_bubble" /* CHAT_BUBBLE */,
3348
3434
  "section_carousel" /* SECTION_CAROUSEL */,
3349
3435
  "list" /* LIST */,
3350
3436
  "section_table" /* SECTION_TABLE */,
3437
+ "section_chart" /* SECTION_CHART */,
3351
3438
  "section_filter" /* SECTION_FILTER */,
3352
3439
  "section_filter_group" /* SECTION_FILTER_GROUP */,
3353
3440
  "form" /* FORM */,
@@ -3374,11 +3461,13 @@ var CONTROL_RELATIONSHIPS = {
3374
3461
  "plugin" /* PLUGIN */,
3375
3462
  "user" /* USER */,
3376
3463
  "stat" /* STAT */,
3464
+ "heat_swatch" /* HEAT_SWATCH */,
3377
3465
  "card" /* CARD */,
3378
3466
  "chat_bubble" /* CHAT_BUBBLE */,
3379
3467
  "section_carousel" /* SECTION_CAROUSEL */,
3380
3468
  "list" /* LIST */,
3381
3469
  "section_table" /* SECTION_TABLE */,
3470
+ "section_chart" /* SECTION_CHART */,
3382
3471
  "section_filter" /* SECTION_FILTER */,
3383
3472
  "section_filter_group" /* SECTION_FILTER_GROUP */,
3384
3473
  "form" /* FORM */,
@@ -3437,6 +3526,7 @@ var CONTROL_RELATIONSHIPS = {
3437
3526
  "remote" /* REMOTE */,
3438
3527
  "plugin" /* PLUGIN */,
3439
3528
  "user" /* USER */,
3529
+ "heat_swatch" /* HEAT_SWATCH */,
3440
3530
  "button" /* BUTTON */,
3441
3531
  "context_menu" /* CONTEXT_MENU */,
3442
3532
  "audience_picker" /* AUDIENCE_PICKER */,
@@ -3513,6 +3603,9 @@ var CONTROL_RELATIONSHIPS = {
3513
3603
  // figure is drawn inside it.
3514
3604
  ["stat_value" /* STAT_VALUE */]: ["flex" /* FLEX */],
3515
3605
  ["stat_corner" /* STAT_CORNER */]: ["flex" /* FLEX */],
3606
+ // A leaf: a block of colour holds nothing, and the figure it stands for is a
3607
+ // text laid beside it by the Flex that holds both.
3608
+ ["heat_swatch" /* HEAT_SWATCH */]: [],
3516
3609
  // Content like a Logo, but the one content Control that is not a leaf: what
3517
3610
  // `m-user` projects beneath the name is a ContentControl, the same single
3518
3611
  // child a card Field takes and gated the same way, through `contentSlotOf`.
@@ -3726,6 +3819,8 @@ var OWN_DIRECTIVES = {
3726
3819
  ["section_table" /* SECTION_TABLE */]: [],
3727
3820
  ["section_table_row" /* SECTION_TABLE_ROW */]: [],
3728
3821
  ["section_table_cell" /* SECTION_TABLE_CELL */]: [],
3822
+ ["section_chart" /* SECTION_CHART */]: [],
3823
+ ["section_chart_series" /* SECTION_CHART_SERIES */]: [],
3729
3824
  ["list" /* LIST */]: ["routerLink"],
3730
3825
  ["row" /* ROW */]: ["routerLink"],
3731
3826
  ["col" /* COL */]: ["mModal", "mSidePanel", "routerLink"],
@@ -3747,6 +3842,7 @@ var OWN_DIRECTIVES = {
3747
3842
  ["stat" /* STAT */]: ["routerLink"],
3748
3843
  ["stat_value" /* STAT_VALUE */]: ["routerLink"],
3749
3844
  ["stat_corner" /* STAT_CORNER */]: ["routerLink"],
3845
+ ["heat_swatch" /* HEAT_SWATCH */]: ["routerLink"],
3750
3846
  ["form" /* FORM */]: ["routerLink"],
3751
3847
  ["field" /* FIELD */]: ["mOptions", "routerLink"],
3752
3848
  // Nothing to attach: a ContentControl emits an `ng-template` — where a
@@ -3791,6 +3887,9 @@ var OWN_DIRECTIVES = {
3791
3887
  };
3792
3888
  var STYLE_REFUSED = /* @__PURE__ */ new Set([
3793
3889
  "root" /* ROOT */,
3890
+ // Draws nothing of its own — the chart draws every series — so a padding or
3891
+ // margin on its host would space an element nobody sees.
3892
+ "section_chart_series" /* SECTION_CHART_SERIES */,
3794
3893
  "variant_branch" /* VARIANT_BRANCH */,
3795
3894
  "branch_arm" /* BRANCH_ARM */,
3796
3895
  "repeat" /* REPEAT */,
@@ -3883,6 +3982,8 @@ var CONTROL_LABEL = {
3883
3982
  ["section_table" /* SECTION_TABLE */]: "section-table",
3884
3983
  ["section_table_row" /* SECTION_TABLE_ROW */]: "section-table-row",
3885
3984
  ["section_table_cell" /* SECTION_TABLE_CELL */]: "section-table-cell",
3985
+ ["section_chart" /* SECTION_CHART */]: "section-chart",
3986
+ ["section_chart_series" /* SECTION_CHART_SERIES */]: "section-chart-series",
3886
3987
  ["section_action" /* SECTION_ACTION */]: "section-action",
3887
3988
  ["section_hero" /* SECTION_HERO */]: "section-hero",
3888
3989
  ["section_carousel" /* SECTION_CAROUSEL */]: "section-carousel",
@@ -3909,6 +4010,7 @@ var CONTROL_LABEL = {
3909
4010
  ["stat" /* STAT */]: "stat",
3910
4011
  ["stat_value" /* STAT_VALUE */]: "stat-value",
3911
4012
  ["stat_corner" /* STAT_CORNER */]: "stat-corner",
4013
+ ["heat_swatch" /* HEAT_SWATCH */]: "heat-swatch",
3912
4014
  ["nav_header" /* NAV_HEADER */]: "nav-header",
3913
4015
  ["form" /* FORM */]: "form",
3914
4016
  ["field" /* FIELD */]: "field",
@@ -3947,6 +4049,8 @@ var CONTROL_ICON = {
3947
4049
  ["section_table" /* SECTION_TABLE */]: "control_section_table",
3948
4050
  ["section_table_row" /* SECTION_TABLE_ROW */]: "control_section_table_row",
3949
4051
  ["section_table_cell" /* SECTION_TABLE_CELL */]: "control_section_table_cell",
4052
+ ["section_chart" /* SECTION_CHART */]: "control_section_chart",
4053
+ ["section_chart_series" /* SECTION_CHART_SERIES */]: "control_section_chart_series",
3950
4054
  ["section_action" /* SECTION_ACTION */]: "control_section_action",
3951
4055
  ["section_hero" /* SECTION_HERO */]: "control_section_hero",
3952
4056
  ["section_carousel" /* SECTION_CAROUSEL */]: "control_section_carousel",
@@ -3973,6 +4077,8 @@ var CONTROL_ICON = {
3973
4077
  ["stat" /* STAT */]: "control_stat",
3974
4078
  ["stat_value" /* STAT_VALUE */]: "control_stat_value",
3975
4079
  ["stat_corner" /* STAT_CORNER */]: "control_stat_corner",
4080
+ // Reuse the Stat glyph until swatch artwork joins the shared set.
4081
+ ["heat_swatch" /* HEAT_SWATCH */]: "control_stat",
3976
4082
  ["nav_header" /* NAV_HEADER */]: "control_nav_header",
3977
4083
  ["form" /* FORM */]: "control_form",
3978
4084
  ["field" /* FIELD */]: "control_field",
@@ -4117,6 +4223,20 @@ var CONTROL_CODEGEN = {
4117
4223
  tag: "td m-section-table-cell",
4118
4224
  component: "SectionTableCellComponent"
4119
4225
  },
4226
+ // Folderful so the name picker can adopt a hand-written
4227
+ // `section_charts/<name>.yml` — the one place its preset `ranges` list can
4228
+ // be written (ADR 0010). Every other setting is a scalar on the tag.
4229
+ ["section_chart" /* SECTION_CHART */]: {
4230
+ tag: "m-section-chart",
4231
+ component: "SectionChartComponent",
4232
+ folder: LAYOUT_ASSET_FOLDER.section_chart
4233
+ },
4234
+ // Folderless: `x`, `y`, `label` and `color` are scalars, and its rows are a
4235
+ // DataBinding under `data` — nothing is left for a `name="<id>"` to resolve.
4236
+ ["section_chart_series" /* SECTION_CHART_SERIES */]: {
4237
+ tag: "m-section-chart-series",
4238
+ component: "SectionChartSeriesComponent"
4239
+ },
4120
4240
  ["row" /* ROW */]: {
4121
4241
  tag: "m-row",
4122
4242
  component: "RowComponent",
@@ -4214,6 +4334,12 @@ var CONTROL_CODEGEN = {
4214
4334
  tag: "m-stat",
4215
4335
  component: "StatComponent"
4216
4336
  },
4337
+ // Folderless for the Logo's reason — HeatSwatchComponent takes `value`,
4338
+ // `fromColor`, `toColor` and `radius` as individual inputs.
4339
+ ["heat_swatch" /* HEAT_SWATCH */]: {
4340
+ tag: "m-heat-swatch",
4341
+ component: "HeatSwatchComponent"
4342
+ },
4217
4343
  // Navigation header with back button and breadcrumb trail.
4218
4344
  // Folderless as it uses NavStore internally and takes no config.
4219
4345
  ["nav_header" /* NAV_HEADER */]: {
@@ -4605,7 +4731,7 @@ function isValidFunctionName(name3) {
4605
4731
  return /^[a-z][a-zA-Z0-9]*$/.test(name3);
4606
4732
  }
4607
4733
  function isPureFunctionComplete(fn) {
4608
- return isValidFunctionName(fn.name) && fn.params.length > 0 && fn.body.trim().length > 0;
4734
+ return isValidFunctionName(fn.name) && fn.body.trim().length > 0;
4609
4735
  }
4610
4736
  function functionFileBase(name3) {
4611
4737
  return name3.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
@@ -4699,8 +4825,6 @@ var IMPURE_TOKENS = [
4699
4825
  "inject",
4700
4826
  "fetch",
4701
4827
  "XMLHttpRequest",
4702
- "Date.now",
4703
- "new Date",
4704
4828
  "Math.random",
4705
4829
  "localStorage",
4706
4830
  "sessionStorage",
@@ -5042,9 +5166,10 @@ function stateComputedArgExpression(arg, roots, shapes, rootPrefix = NO_ROOT_PRE
5042
5166
  let shapeId = root.dataType.type === "shape" ? root.dataType.shapeId : void 0;
5043
5167
  let expression = `${rootPrefix(rootId)}${root.name}()`;
5044
5168
  for (const keyId of rest) {
5045
- const key2 = shapeId ? shapes[shapeId]?.keys.find((k) => k.id === keyId) : void 0;
5169
+ const shape = shapeId ? shapes[shapeId] : void 0;
5170
+ const key2 = shape?.keys.find((k) => k.id === keyId);
5046
5171
  if (!key2) return "undefined";
5047
- expression += `?.${key2.name}`;
5172
+ expression += memberAccess(shape, key2, true);
5048
5173
  shapeId = key2.dataType.type === "shape" ? key2.dataType.shapeId : void 0;
5049
5174
  }
5050
5175
  return expression;
@@ -5841,7 +5966,8 @@ var BINDING_TRANSFORM_LEAVES = [
5841
5966
  "fixed",
5842
5967
  "store",
5843
5968
  "const",
5844
- "input"
5969
+ "input",
5970
+ "binding"
5845
5971
  ];
5846
5972
 
5847
5973
  // libs/codegen/src/lib/outcome-transform-helper.ts
@@ -6041,6 +6167,7 @@ var sameType2 = (a, b) => a.type === "shape" && b.type === "shape" ? a.shapeId =
6041
6167
  var typesMatch = (a, b) => sameType2(a.dataType, b.dataType) && a.cardinality === b.cardinality;
6042
6168
  var memberRead = (name3, ctx) => ctx.scope === "class" ? `this.${name3}` : name3;
6043
6169
  var isCall = (expr) => expr.kind === "call";
6170
+ var pipeParamValid = (expr, arity) => Number.isInteger(expr.pipeParam) && (expr.pipeParam >= 0 && expr.pipeParam < arity || expr.pipeParam === -1 && !expr.args.some((arg) => arg.kind === "pipe"));
6044
6171
  var argOmitted = (arg, param) => !!param?.optional && !!arg && !isCall(arg) && arg.kind === "fixed" && !fixedText(arg).trim();
6045
6172
  var fixedText = (arg) => String(arg.value ?? "");
6046
6173
  var argOutOfRange = (arg, param) => {
@@ -6107,7 +6234,7 @@ function inferTransformType(expr, pipeType, surface, functions) {
6107
6234
  if (expr.args.length !== resolved.params.length) {
6108
6235
  return { ok: false, error: "value-transform-arity" };
6109
6236
  }
6110
- if (expr.pipeParam < 0 || expr.pipeParam >= resolved.params.length || !Number.isInteger(expr.pipeParam)) {
6237
+ if (!pipeParamValid(expr, resolved.params.length)) {
6111
6238
  return { ok: false, error: "value-transform-incomplete" };
6112
6239
  }
6113
6240
  for (let i = 0; i < expr.args.length; i++) {
@@ -6148,6 +6275,8 @@ var leafIncomplete = (leaf) => {
6148
6275
  return leaf.constantId ? void 0 : empty;
6149
6276
  case "input":
6150
6277
  return leaf.input?.trim() ? void 0 : empty;
6278
+ case "binding":
6279
+ return leaf.binding ? void 0 : empty;
6151
6280
  default:
6152
6281
  return void 0;
6153
6282
  }
@@ -6178,7 +6307,7 @@ function transformIncomplete(expr, functions, properties, shapes) {
6178
6307
  if (expr.args.length !== resolved.params.length) {
6179
6308
  return "value-transform-arity";
6180
6309
  }
6181
- if (!Number.isInteger(expr.pipeParam) || expr.pipeParam < 0 || expr.pipeParam >= resolved.params.length) {
6310
+ if (!pipeParamValid(expr, resolved.params.length)) {
6182
6311
  return "value-transform-incomplete";
6183
6312
  }
6184
6313
  for (let i = 0; i < expr.args.length; i++) {
@@ -6276,7 +6405,7 @@ var parenthesized = (expr) => {
6276
6405
  var STRING_LITERAL = /^('[^']*'|"[^"]*")$/;
6277
6406
  var MEMBER_CHAIN = /^[A-Za-z_$][\w$]*(\??\.[\w$]+|\??\([^()]*\)|\[[^[\]]*\]|!)*$/;
6278
6407
  var receiverExpr = (receiver) => MEMBER_CHAIN.test(receiver) || STRING_LITERAL.test(receiver) || parenthesized(receiver) ? receiver : `(${receiver})`;
6279
- var memberAccess = (receiver) => receiver.includes("?.") ? "?." : ".";
6408
+ var memberAccess2 = (receiver) => receiver.includes("?.") ? "?." : ".";
6280
6409
  function emitTransformExpr(expr, pipeExpr, ctx, fixedType = { type: "string" }) {
6281
6410
  if (!isCall(expr)) {
6282
6411
  return emitLeaf(expr, pipeExpr, ctx, fixedType);
@@ -6296,16 +6425,17 @@ function emitTransformExpr(expr, pipeExpr, ctx, fixedType = { type: "string" })
6296
6425
  }
6297
6426
  const entry2 = resolved.entry;
6298
6427
  if (!entry2) return pipeExpr;
6428
+ const access = (receiver) => ctx.optionalPipe && receiver === pipeExpr ? "?." : memberAccess2(receiver);
6299
6429
  if (entry2.emit === "method") {
6300
6430
  const [receiver, ...rest] = argExprs;
6301
- return `${receiverExpr(receiver)}${memberAccess(receiver)}${entry2.name}(${rest.join(", ")})`;
6431
+ return `${receiverExpr(receiver)}${access(receiver)}${entry2.name}(${rest.join(", ")})`;
6302
6432
  }
6303
6433
  if (entry2.emit === "static") {
6304
6434
  return `${entry2.object ?? "Object"}.${entry2.name}(${argExprs.join(", ")})`;
6305
6435
  }
6306
6436
  if (entry2.emit === "property") {
6307
6437
  const receiver = argExprs[0];
6308
- return `${receiverExpr(receiver)}${memberAccess(receiver)}${entry2.name}`;
6438
+ return `${receiverExpr(receiver)}${access(receiver)}${entry2.name}`;
6309
6439
  }
6310
6440
  return `${entry2.name}(${argExprs.join(", ")})`;
6311
6441
  }
@@ -6342,6 +6472,8 @@ function emitLeaf(leaf, pipeExpr, ctx, fixedType) {
6342
6472
  if (!leaf.event?.length) return ctx.eventRoot ?? "$event";
6343
6473
  return `$event.${leaf.event.join(".")}`;
6344
6474
  }
6475
+ case "binding":
6476
+ return leaf.binding && ctx.bindingRead?.(leaf.binding) || "undefined";
6345
6477
  }
6346
6478
  }
6347
6479
  function templateTransformRefs(exprs, functions) {
@@ -6378,10 +6510,97 @@ function transformStateRootIds(expr) {
6378
6510
  return;
6379
6511
  }
6380
6512
  if (node.kind === "store" && node.path.length) ids.add(node.path[0]);
6513
+ const root = node.kind === "binding" ? node.binding?.root : void 0;
6514
+ if (root?.kind === "property" || root?.kind === "computed") {
6515
+ ids.add(root.id);
6516
+ }
6381
6517
  };
6382
6518
  walk(expr);
6383
6519
  return [...ids];
6384
6520
  }
6521
+ function transformBindingLeaves(expr) {
6522
+ if (!expr) return [];
6523
+ if (isCall(expr)) return expr.args.flatMap(transformBindingLeaves);
6524
+ return expr.kind === "binding" && expr.binding ? [expr.binding] : [];
6525
+ }
6526
+ var functionBindingTarget = (binding) => binding?.source === "function" ? outerCall(binding.transform)?.target : void 0;
6527
+ var functionBindingId = (binding) => {
6528
+ const target = functionBindingTarget(binding);
6529
+ return target?.kind === "pure" ? target.functionId : void 0;
6530
+ };
6531
+ var NATIVE_KEY_PREFIX = "native:";
6532
+ var callTargetKey = (target) => target.kind === "pure" ? target.functionId : `${NATIVE_KEY_PREFIX}${target.ref.group}:${target.ref.name}`;
6533
+ var callTargetName = (target, functions) => {
6534
+ if (!target) return void 0;
6535
+ if (target.kind === "pure") return functions?.[target.functionId]?.name;
6536
+ return findJsNative(target.ref.group, target.ref.name)?.name;
6537
+ };
6538
+ var callTargetOfKey = (key2) => {
6539
+ if (!key2.startsWith(NATIVE_KEY_PREFIX)) return pureTarget(key2);
6540
+ const [group = "", name3 = ""] = key2.slice(NATIVE_KEY_PREFIX.length).split(":");
6541
+ return nativeTarget({ group, name: name3 });
6542
+ };
6543
+ var plainRead = (binding) => ({
6544
+ root: binding.root,
6545
+ path: binding.path
6546
+ });
6547
+ function functionBindingArgs(binding, arity) {
6548
+ const call = binding?.source === "function" ? outerCall(binding.transform) : void 0;
6549
+ return Array.from({ length: arity }, (_, i) => {
6550
+ const arg = call?.args[i];
6551
+ if (!binding || !arg || isCall(arg)) return { kind: "binding" };
6552
+ if (arg.kind === "pipe") {
6553
+ return { kind: "binding", binding: plainRead(binding) };
6554
+ }
6555
+ if (arg.kind === "binding") {
6556
+ return arg.binding ? { kind: "binding", binding: plainRead(arg.binding) } : { kind: "binding" };
6557
+ }
6558
+ if (arg.kind === "fixed") return { kind: "fixed", value: fixedText(arg) };
6559
+ return { kind: "binding" };
6560
+ });
6561
+ }
6562
+ function composeFunctionBinding(callee, args) {
6563
+ const target = typeof callee === "string" ? pureTarget(callee) : callee;
6564
+ const pipeParam = args.findIndex(
6565
+ (arg) => arg.kind === "binding" && !!arg.binding
6566
+ );
6567
+ const piped = args[pipeParam];
6568
+ if (pipeParam < 0) {
6569
+ if (args.some((arg) => arg.kind === "binding")) return void 0;
6570
+ return {
6571
+ root: { kind: "none" },
6572
+ path: [],
6573
+ source: "function",
6574
+ transform: {
6575
+ kind: "call",
6576
+ target,
6577
+ pipeParam: -1,
6578
+ args: args.map(
6579
+ (arg) => ({
6580
+ kind: "fixed",
6581
+ value: arg.kind === "fixed" ? arg.value : ""
6582
+ })
6583
+ )
6584
+ }
6585
+ };
6586
+ }
6587
+ if (piped?.kind !== "binding" || !piped.binding) return void 0;
6588
+ return {
6589
+ root: piped.binding.root,
6590
+ path: piped.binding.path,
6591
+ source: "function",
6592
+ transform: {
6593
+ kind: "call",
6594
+ target,
6595
+ pipeParam,
6596
+ args: args.map((arg, i) => {
6597
+ if (i === pipeParam) return { kind: "pipe" };
6598
+ if (arg.kind === "fixed") return { kind: "fixed", value: arg.value };
6599
+ return arg.binding ? { kind: "binding", binding: plainRead(arg.binding) } : { kind: "binding" };
6600
+ })
6601
+ }
6602
+ };
6603
+ }
6385
6604
  function unaryCall(target, arity, pipeParam = 0) {
6386
6605
  const args = Array.from(
6387
6606
  { length: arity },
@@ -6495,6 +6714,14 @@ function sanitizeLeaf(leaf) {
6495
6714
  kind: "event",
6496
6715
  ...Array.isArray(leaf.event) ? { event: leaf.event } : {}
6497
6716
  };
6717
+ case "binding": {
6718
+ const binding = leaf.binding;
6719
+ if (!binding) return { kind: "binding" };
6720
+ return binding.root && typeof binding.root === "object" && Array.isArray(binding.path) ? {
6721
+ kind: "binding",
6722
+ binding: { root: binding.root, path: binding.path }
6723
+ } : void 0;
6724
+ }
6498
6725
  default:
6499
6726
  return void 0;
6500
6727
  }
@@ -6523,7 +6750,8 @@ var BINDING_SLOT = {
6523
6750
  label: "label",
6524
6751
  // A FormControl's `data`. The write half is a StateWrite on `dataChange`
6525
6752
  // rather than anything here (ADR 0065). Also a CardControl's collection: the
6526
- // slot is named for the input it lands on, and both land on `data`.
6753
+ // slot is named for the input it lands on, and both land on `data` — as do a
6754
+ // SectionChartSeries' rows.
6527
6755
  data: "data",
6528
6756
  // A RepeatControl's collection.
6529
6757
  source: "source",
@@ -6565,7 +6793,11 @@ var BINDING_SLOT = {
6565
6793
  // author sees those numbers on the Canvas (ADR 0069). What the Filter is
6566
6794
  // *disabled* by stays a Rule's job, which is the line these do not cross.
6567
6795
  min: "min",
6568
- max: "max"
6796
+ max: "max",
6797
+ // A [HeatSwatch]'s figure, named for the `m-heat-swatch` input it lands on.
6798
+ // Content by the `total` test: what the block paints *is* the datum, one per
6799
+ // row inside a Repeat.
6800
+ value: "value"
6569
6801
  };
6570
6802
  var USER_VALUE_SLOTS = [
6571
6803
  BINDING_SLOT.id,
@@ -6683,7 +6915,8 @@ var PARAM_CAPABLE_TYPES = [
6683
6915
  "stat" /* STAT */,
6684
6916
  "section_header" /* SECTION_HEADER */,
6685
6917
  "button" /* BUTTON */,
6686
- "field" /* FIELD */
6918
+ "field" /* FIELD */,
6919
+ "section_chart_series" /* SECTION_CHART_SERIES */
6687
6920
  ];
6688
6921
  var takesMessageParams = (type) => !!type && PARAM_CAPABLE_TYPES.includes(type);
6689
6922
  var messageSlot = (variable) => `var:${variable}`;
@@ -6699,10 +6932,12 @@ var messageBindings = (control) => {
6699
6932
  };
6700
6933
  var DEFAULT_ITEM_ALIAS = "item";
6701
6934
  var DEFAULT_INDEX_ALIAS = "index";
6935
+ var DEFAULT_KEY_ALIAS = "key";
6702
6936
  var ALIAS_PATTERN = /^[a-z][a-zA-Z0-9]*$/;
6703
6937
  var repeatSpec = (control) => ({
6704
6938
  itemAlias: control?.repeat?.itemAlias ?? DEFAULT_ITEM_ALIAS,
6705
6939
  indexAlias: control?.repeat?.indexAlias ?? DEFAULT_INDEX_ALIAS,
6940
+ keyAlias: control?.repeat?.keyAlias ?? DEFAULT_KEY_ALIAS,
6706
6941
  ...control?.repeat?.track ? { track: control.repeat.track } : {},
6707
6942
  ...control?.repeat?.sampleRows !== void 0 ? { sampleRows: control.repeat.sampleRows } : {}
6708
6943
  });
@@ -6765,16 +7000,26 @@ var aliasNames = (control) => isCardHolder(control) ? {
6765
7000
  indexAlias: control?.cards?.indexAlias ?? DEFAULT_INDEX_ALIAS
6766
7001
  } : {
6767
7002
  itemAlias: repeatSpec(control).itemAlias,
6768
- indexAlias: repeatSpec(control).indexAlias
7003
+ indexAlias: repeatSpec(control).indexAlias,
7004
+ // Only a Repeat walks a keyed record (GLOSSARY.md KeyAlias); a List
7005
+ // keeps the same spec but hands `m-list` an array.
7006
+ ...control?.type === "repeat" /* REPEAT */ ? { keyAlias: repeatSpec(control).keyAlias } : {}
6769
7007
  };
6770
7008
  var aliasSourceSlot = (control) => isCardHolder(control) || control?.type === "list" /* LIST */ ? BINDING_SLOT.data : BINDING_SLOT.source;
6771
7009
  var isAliasNameFree = (name3, where, controlMap, which) => {
6772
7010
  if (!ALIAS_PATTERN.test(name3) || isReservedVariantName(name3)) return false;
6773
- const sibling = which === "item" ? where.own.indexAlias : where.own.itemAlias;
6774
- if (name3 === sibling) return false;
7011
+ const own = {
7012
+ item: where.own.itemAlias,
7013
+ index: where.own.indexAlias,
7014
+ key: where.own.keyAlias
7015
+ };
7016
+ const siblings = Object.keys(own).filter(
7017
+ (kind) => kind !== which
7018
+ );
7019
+ if (siblings.some((kind) => own[kind] === name3)) return false;
6775
7020
  return !aliasHoldersInScope(where.parentId, controlMap).some((holder) => {
6776
7021
  const spec = aliasNames(holder);
6777
- return spec.itemAlias === name3 || spec.indexAlias === name3;
7022
+ return spec.itemAlias === name3 || spec.indexAlias === name3 || spec.keyAlias === name3;
6778
7023
  });
6779
7024
  };
6780
7025
  var nextAliasName = (base, where, controlMap, which) => {
@@ -6792,13 +7037,20 @@ var newRepeatSpec = (parentId, controlMap) => {
6792
7037
  controlMap,
6793
7038
  "item"
6794
7039
  );
7040
+ const indexAlias = nextAliasName(
7041
+ DEFAULT_INDEX_ALIAS,
7042
+ { parentId, own: { itemAlias, indexAlias: "" } },
7043
+ controlMap,
7044
+ "index"
7045
+ );
6795
7046
  return {
6796
7047
  itemAlias,
6797
- indexAlias: nextAliasName(
6798
- DEFAULT_INDEX_ALIAS,
6799
- { parentId, own: { itemAlias, indexAlias: "" } },
7048
+ indexAlias,
7049
+ keyAlias: nextAliasName(
7050
+ DEFAULT_KEY_ALIAS,
7051
+ { parentId, own: { itemAlias, indexAlias } },
6800
7052
  controlMap,
6801
- "index"
7053
+ "key"
6802
7054
  )
6803
7055
  };
6804
7056
  };
@@ -6831,7 +7083,7 @@ var isBindingInScope = (binding, controlId, controlMap) => {
6831
7083
  };
6832
7084
  var bindingPathKey = (binding) => {
6833
7085
  const root = binding.root;
6834
- const head = root.kind === "alias" ? `alias:${root.repeatId}:${root.alias}` : root.kind === "auth" ? `${root.kind}:${root.property}` : `${root.kind}:${root.id}`;
7086
+ const head = root.kind === "alias" ? `alias:${root.repeatId}:${root.alias}` : root.kind === "auth" ? `${root.kind}:${root.property}` : root.kind === "none" ? root.kind : `${root.kind}:${root.id}`;
6835
7087
  return binding.path.length ? `${head}.${binding.path.join(".")}` : head;
6836
7088
  };
6837
7089
 
@@ -6880,6 +7132,7 @@ var GLOBAL_RULE_CATALOG = {
6880
7132
  var globalRuleOf = (ruleId) => Object.prototype.hasOwnProperty.call(GLOBAL_RULE_CATALOG, ruleId) ? GLOBAL_RULE_CATALOG[ruleId] : void 0;
6881
7133
 
6882
7134
  // libs/codegen/src/lib/rule-helper.ts
7135
+ var hop = (segment) => segment.position === void 0 ? `?.${segment.name}` : `?.[${segment.position}]`;
6883
7136
  var isPrimitiveType = (dataType) => dataType.type !== "shape" && dataType.type !== "form" && dataType.type !== "option";
6884
7137
  var seq = 0;
6885
7138
  var nodeId = () => `rn${seq += 1}`;
@@ -6903,6 +7156,12 @@ var createCall = (ruleId = "") => ({
6903
7156
  ruleId,
6904
7157
  args: {}
6905
7158
  });
7159
+ var createFunctionLeaf = () => ({
7160
+ id: nodeId(),
7161
+ kind: "function",
7162
+ functionId: "",
7163
+ args: {}
7164
+ });
6906
7165
  var createRule = () => createGroup([createCheck()]);
6907
7166
  function remintRule(rule) {
6908
7167
  const walk = (node) => node.kind === "group" ? { ...node, id: nodeId(), children: node.children.map(walk) } : { ...node, id: nodeId() };
@@ -6924,13 +7183,15 @@ function resolvePath(path, properties, shapes) {
6924
7183
  shapeId = shapeKeyOf(property.dataType);
6925
7184
  continue;
6926
7185
  }
6927
- const key2 = shapeId ? shapes[shapeId]?.keys.find((k) => k.id === id) : void 0;
7186
+ const shape = shapeId ? shapes[shapeId] : void 0;
7187
+ const key2 = shape?.keys.find((k) => k.id === id);
6928
7188
  if (!key2) break;
6929
7189
  segments.push({
6930
7190
  id,
6931
7191
  name: key2.name,
6932
7192
  dataType: key2.dataType,
6933
- cardinality: key2.cardinality
7193
+ cardinality: key2.cardinality,
7194
+ ...shape?.positional ? { position: shape.keys.indexOf(key2) } : {}
6934
7195
  });
6935
7196
  shapeId = shapeKeyOf(key2.dataType);
6936
7197
  }
@@ -7045,14 +7306,28 @@ var swapWithin = (node, id, delta) => {
7045
7306
  var moveRuleNode = (rule, id, delta) => id === rule.id ? rule : swapWithin(rule, id, delta) ?? rule;
7046
7307
  function ruleChecks(node) {
7047
7308
  if (node.kind === "check") return [node];
7048
- if (node.kind === "call" || node.kind === "nav") return [];
7309
+ if (node.kind !== "group") return [];
7049
7310
  return node.children.flatMap(ruleChecks);
7050
7311
  }
7051
7312
  function ruleCalls(node) {
7052
7313
  if (node.kind === "call") return [node];
7053
- if (node.kind === "check" || node.kind === "nav") return [];
7314
+ if (node.kind !== "group") return [];
7054
7315
  return node.children.flatMap(ruleCalls);
7055
7316
  }
7317
+ function ruleFunctions(node) {
7318
+ if (node.kind === "function") return [node];
7319
+ if (node.kind !== "group") return [];
7320
+ return node.children.flatMap(ruleFunctions);
7321
+ }
7322
+ function ruleFunctionImports(rules, properties, shapes, functions) {
7323
+ const byName = /* @__PURE__ */ new Map();
7324
+ for (const leaf of rules.flatMap(ruleFunctions)) {
7325
+ if (functionError(leaf, properties, shapes, functions)) continue;
7326
+ const fn = functions[leaf.functionId];
7327
+ if (fn && !byName.has(fn.name)) byName.set(fn.name, fn);
7328
+ }
7329
+ return [...byName.values()];
7330
+ }
7056
7331
  var variantNavIds = (variant) => [
7057
7332
  variant.navId ?? "",
7058
7333
  ...ruleNavs(variant.rule).map((nav) => nav.navId)
@@ -7070,7 +7345,7 @@ function remapRuleNavs(node, remap) {
7070
7345
  }
7071
7346
  function ruleNavs(node) {
7072
7347
  if (node.kind === "nav") return [node];
7073
- if (node.kind === "check" || node.kind === "call") return [];
7348
+ if (node.kind !== "group") return [];
7074
7349
  return node.children.flatMap(ruleNavs);
7075
7350
  }
7076
7351
  var checkPaths = (check) => check.operand.kind === "path" ? [check.path, check.operand.path] : [check.path];
@@ -7079,7 +7354,8 @@ var callPaths = (call) => Object.values(call.args).flatMap(
7079
7354
  );
7080
7355
  var rulePaths = (rule) => [
7081
7356
  ...ruleChecks(rule).flatMap(checkPaths),
7082
- ...ruleCalls(rule).flatMap(callPaths)
7357
+ ...ruleCalls(rule).flatMap(callPaths),
7358
+ ...ruleFunctions(rule).flatMap((leaf) => Object.values(leaf.args))
7083
7359
  ];
7084
7360
  var ruleReferencedIds = (rule) => new Set(rulePaths(rule).flat());
7085
7361
  function ruleGlobalStores(rules) {
@@ -7142,18 +7418,37 @@ function callError(call, properties, shapes) {
7142
7418
  }
7143
7419
  return null;
7144
7420
  }
7145
- function ruleError(node, properties, shapes) {
7421
+ var sameType3 = (a, b) => a.type === "shape" ? b.type === "shape" && a.shapeId === b.shapeId : a.type === "form" ? b.type === "form" && a.formId === b.formId : a.type === b.type;
7422
+ function functionError(leaf, properties, shapes, functions) {
7423
+ const fn = leaf.functionId ? functions[leaf.functionId] : void 0;
7424
+ if (!fn) return "rule-function-missing";
7425
+ if (fn.returnType.type !== "boolean" || fn.returnCardinality !== "one" || fn.returnAsync)
7426
+ return "rule-function-not-boolean";
7427
+ for (const param of fn.params) {
7428
+ const path = leaf.args[param.id];
7429
+ if (!path?.length) return "rule-operand-missing";
7430
+ const segments = resolvePath(path, properties, shapes);
7431
+ const last = segments[segments.length - 1];
7432
+ if (segments.length !== path.length || !last) return "rule-operand-missing";
7433
+ if (!sameType3(last.dataType, param.dataType) || last.cardinality !== param.cardinality)
7434
+ return "rule-operand-missing";
7435
+ }
7436
+ return null;
7437
+ }
7438
+ function ruleError(node, properties, shapes, functions = {}) {
7146
7439
  if (node.kind === "check") return checkError(node, properties, shapes);
7147
7440
  if (node.kind === "call") return callError(node, properties, shapes);
7148
7441
  if (node.kind === "nav") return node.navId ? null : "rule-nav-missing";
7442
+ if (node.kind === "function")
7443
+ return functionError(node, properties, shapes, functions);
7149
7444
  if (!node.children.length) return "rule-empty-group";
7150
7445
  for (const child of node.children) {
7151
- const error = ruleError(child, properties, shapes);
7446
+ const error = ruleError(child, properties, shapes, functions);
7152
7447
  if (error) return error;
7153
7448
  }
7154
7449
  return null;
7155
7450
  }
7156
- var isRuleComplete = (rule, properties, shapes) => ruleError(rule, properties, shapes) === null;
7451
+ var isRuleComplete = (rule, properties, shapes, functions = {}) => ruleError(rule, properties, shapes, functions) === null;
7157
7452
  var JS_OPERATOR = {
7158
7453
  "==": "===",
7159
7454
  "!=": "!==",
@@ -7169,7 +7464,7 @@ var rootSource = (segment, prefix) => {
7169
7464
  };
7170
7465
  var scalarSource = (segments, prefix = "") => segments.map((segment, index) => {
7171
7466
  if (index === 0) return rootSource(segment, prefix);
7172
- return `?.${segment.name}`;
7467
+ return hop(segment);
7173
7468
  }).join("");
7174
7469
  function operandSource(operand, properties, shapes, prefix = "") {
7175
7470
  if (operand.kind === "literal") return literalSource(operand.value);
@@ -7215,7 +7510,7 @@ function generateCheckExpression(check, properties, shapes, prefix = "") {
7215
7510
  const taken = /* @__PURE__ */ new Set();
7216
7511
  const walk = (index, base, depth) => {
7217
7512
  const segment = segments[index];
7218
- const access = index === 0 ? rootSource(segment, prefix) : `${base}?.${segment.name}`;
7513
+ const access = index === 0 ? rootSource(segment, prefix) : `${base}${hop(segment)}`;
7219
7514
  const last = index === segments.length - 1;
7220
7515
  if (segment.cardinality === "one") {
7221
7516
  return last ? leaf(access, true) : walk(index + 1, access, depth);
@@ -7241,7 +7536,26 @@ function generateCallExpression(call, properties, shapes, prefix = "", callRecei
7241
7536
  });
7242
7537
  return `${callReceiver}${GLOBAL_RULE_STORES[rule.store].prop}.${rule.member}(${args.join(", ")})`;
7243
7538
  }
7244
- function generateRuleExpression(node, properties, shapes, top = true, prefix = "", callReceiver = "") {
7539
+ function generateFunctionExpression(leaf, properties, shapes, functions, prefix = "") {
7540
+ const fn = functions[leaf.functionId];
7541
+ if (!fn) return "false";
7542
+ const guards = [];
7543
+ const args = fn.params.map((param) => {
7544
+ const read = scalarSource(
7545
+ resolvePath(leaf.args[param.id] ?? [], properties, shapes),
7546
+ prefix
7547
+ );
7548
+ if (param.acceptsUndefined) return read;
7549
+ guards.push(`${read} !== undefined`);
7550
+ return `(${read})!`;
7551
+ });
7552
+ const call = `${fn.name}(${args.join(", ")})`;
7553
+ return guards.length ? `(${[...guards, call].join(" && ")})` : call;
7554
+ }
7555
+ function generateRuleExpression(node, properties, shapes, top = true, prefix = "", callReceiver = "", functions = {}) {
7556
+ if (node.kind === "function") {
7557
+ return functionError(node, properties, shapes, functions) ? "false" : generateFunctionExpression(node, properties, shapes, functions, prefix);
7558
+ }
7245
7559
  if (node.kind === "check") {
7246
7560
  return checkError(node, properties, shapes) ? "false" : generateCheckExpression(node, properties, shapes, prefix);
7247
7561
  }
@@ -7260,7 +7574,8 @@ function generateRuleExpression(node, properties, shapes, top = true, prefix = "
7260
7574
  shapes,
7261
7575
  false,
7262
7576
  prefix,
7263
- callReceiver
7577
+ callReceiver,
7578
+ functions
7264
7579
  )
7265
7580
  );
7266
7581
  const joined = parts.join(joiner);
@@ -7282,6 +7597,15 @@ function pathChipDisplay(segments, quantifier, counted, operator = "==") {
7282
7597
  }).join(".");
7283
7598
  return counted ? `count of ${body}` : body;
7284
7599
  }
7600
+ function functionChipDisplay(leaf, properties, shapes, functions) {
7601
+ const fn = functions[leaf.functionId];
7602
+ if (!fn) return "";
7603
+ const args = fn.params.map((param) => {
7604
+ const segments = resolvePath(leaf.args[param.id] ?? [], properties, shapes);
7605
+ return segments.length ? pathDisplay(segments) : "?";
7606
+ });
7607
+ return `${fn.name}(${args.join(", ")})`;
7608
+ }
7285
7609
  function operandDisplay(operand, properties, shapes) {
7286
7610
  if (operand.kind === "literal") return literalSource(operand.value);
7287
7611
  const segments = resolvePath(operand.path, properties, shapes);
@@ -7361,265 +7685,6 @@ var collectListItemsAssets = (controlMap) => Object.values(controlMap ?? {}).fil
7361
7685
  items
7362
7686
  }));
7363
7687
 
7364
- // libs/codegen/src/lib/binding-option-helper.ts
7365
- var ROOT_PREFIX = "root:";
7366
- var SEPARATOR = ".";
7367
- var MAX_DEPTH = 6;
7368
- var WALKABLE_ROOTS = /* @__PURE__ */ new Set([
7369
- "alias",
7370
- "input",
7371
- "screen_computed"
7372
- ]);
7373
- var encodeRoot = (root) => {
7374
- if (root.kind === "alias") return `alias:${root.repeatId}:${root.alias}`;
7375
- if (root.kind === "auth") return `auth:${root.property}`;
7376
- return `${root.kind}:${root.id}`;
7377
- };
7378
- var encodeBinding = (binding) => {
7379
- const { root, path } = binding;
7380
- if (root.kind === "property" || root.kind === "computed") {
7381
- return `${ROOT_PREFIX}store|${[root.id, ...path].join(SEPARATOR)}`;
7382
- }
7383
- const tail = path.join(SEPARATOR);
7384
- return `${ROOT_PREFIX}${encodeRoot(root)}${tail ? `|${tail}` : ""}`;
7385
- };
7386
- var decodeRoot = (encoded) => {
7387
- const parts = encoded.split(":");
7388
- if (parts[0] === "alias" && parts.length === 3) {
7389
- const alias = parts[2];
7390
- if (alias !== "item" && alias !== "index") return void 0;
7391
- return { kind: "alias", repeatId: parts[1], alias };
7392
- }
7393
- if (parts[0] === "auth") {
7394
- const property = AUTH_PROPERTIES.find((entry2) => entry2.id === parts[1]);
7395
- return property ? { kind: "auth", property: property.id } : void 0;
7396
- }
7397
- if (parts[0] === "user_store" && parts[1] === "deployToken") {
7398
- return { kind: "auth", property: "deployToken" };
7399
- }
7400
- const kind = parts[0];
7401
- if (kind === "input" || kind === "screen_computed" || kind === "screen_variable" || kind === "form_model") {
7402
- return { kind, id: parts.slice(1).join(":") };
7403
- }
7404
- return void 0;
7405
- };
7406
- var bindingAlwaysPresent = (binding, scope) => {
7407
- if (binding.path.length > 1) return false;
7408
- const root = binding.root;
7409
- if (root.kind === "alias") return true;
7410
- if (root.kind === "screen_computed") {
7411
- return screenComputedPresent(
7412
- root.id,
7413
- scope.screenComputeds,
7414
- scope.functions,
7415
- scope.inputs
7416
- );
7417
- }
7418
- return root.kind === "input" && !!scope.inputs?.[root.id]?.required;
7419
- };
7420
- var sourceShapeId = (source, scope, seen = /* @__PURE__ */ new Set()) => {
7421
- if (!source) return void 0;
7422
- let dataType;
7423
- const root = source.root;
7424
- if (root.kind === "property" || root.kind === "computed") {
7425
- dataType = scope.roots[root.id]?.dataType;
7426
- } else if (root.kind === "input") {
7427
- dataType = scope.inputs?.[root.id]?.dataType;
7428
- } else if (root.kind === "screen_computed") {
7429
- const computed = scope.screenComputeds?.[root.id];
7430
- dataType = computed ? screenComputedFunction(computed, scope.functions ?? {})?.returnType : void 0;
7431
- } else if (root.kind === "alias") {
7432
- if (root.alias === "index" || seen.has(root.repeatId)) return void 0;
7433
- const rowShapeId = holderRowShapeId(
7434
- scope.controlMap[root.repeatId],
7435
- scope,
7436
- /* @__PURE__ */ new Set([...seen, root.repeatId])
7437
- );
7438
- dataType = rowShapeId ? { type: "shape", shapeId: rowShapeId } : void 0;
7439
- }
7440
- for (const keyId of source.path) {
7441
- const shape = dataType?.type === "shape" ? scope.shapes[dataType.shapeId] : void 0;
7442
- const key2 = shape?.keys.find((k) => k.id === keyId);
7443
- if (!key2) return void 0;
7444
- dataType = key2.dataType;
7445
- }
7446
- return dataType?.type === "shape" ? dataType.shapeId : void 0;
7447
- };
7448
- var holderRowShapeId = (holder, scope, seen = /* @__PURE__ */ new Set()) => {
7449
- const shapeId = sourceShapeId(
7450
- holder?.bindings?.[aliasSourceSlot(holder)],
7451
- scope,
7452
- holder ? /* @__PURE__ */ new Set([...seen, holder.id]) : seen
7453
- );
7454
- if (shapeId) return shapeId;
7455
- return holder?.type === "list" /* LIST */ && toListItemRows(holder.configs?.[LIST_ITEMS_KEY]).length ? LIST_ROW_SHAPE_ID : void 0;
7456
- };
7457
- var aliasRoots = (scope) => {
7458
- const control = scope.controlId ? scope.controlMap[scope.controlId] : void 0;
7459
- if (!control || scope.allowAlias === false) return [];
7460
- const from = isAliasHolder(control) ? control.parentId : control.id;
7461
- return aliasHoldersInScope(from, scope.controlMap).flatMap((holder) => {
7462
- const spec = aliasNames(holder);
7463
- const rowShapeId = holderRowShapeId(holder, scope);
7464
- return [
7465
- {
7466
- root: {
7467
- kind: "alias",
7468
- repeatId: holder.id,
7469
- alias: "item"
7470
- },
7471
- name: spec.itemAlias,
7472
- dataType: rowShapeId ? { type: "shape", shapeId: rowShapeId } : { type: "string" },
7473
- cardinality: "one"
7474
- },
7475
- {
7476
- root: {
7477
- kind: "alias",
7478
- repeatId: holder.id,
7479
- alias: "index"
7480
- },
7481
- name: spec.indexAlias,
7482
- dataType: { type: "number" },
7483
- cardinality: "one"
7484
- }
7485
- ];
7486
- });
7487
- };
7488
- var screenRoots = (scope) => [
7489
- ...Object.values(scope.inputs ?? {}).map((input) => ({
7490
- root: { kind: "input", id: input.id },
7491
- name: input.name,
7492
- dataType: input.dataType,
7493
- cardinality: input.cardinality
7494
- })),
7495
- // A ScreenComputed's type is its PureFunction's declared return and is
7496
- // never authored (GLOSSARY.md ScreenComputed), so it is read off the
7497
- // function the same way `computedAsProperty` reads a StateComputed's.
7498
- ...Object.values(scope.screenComputeds ?? {}).flatMap((computed) => {
7499
- const fn = screenComputedFunction(computed, scope.functions ?? {});
7500
- return fn ? [
7501
- {
7502
- root: { kind: "screen_computed", id: computed.id },
7503
- name: computed.name,
7504
- dataType: fn.returnType,
7505
- cardinality: returnCardinalityOf(fn)
7506
- }
7507
- ] : [];
7508
- }),
7509
- // A ScreenVariable is read whole like the computed above — it holds no
7510
- // StateShape, so there is nothing to walk into (ADR 0079).
7511
- ...Object.values(scope.screenVariables ?? {}).map((variable) => ({
7512
- root: { kind: "screen_variable", id: variable.id },
7513
- name: variable.name,
7514
- dataType: { type: variable.dataType },
7515
- cardinality: variable.cardinality
7516
- })),
7517
- // A FormModel is the one Screen-owned root walked into rather than read
7518
- // whole: a form's value is an object, and its FormShape keys are what
7519
- // reading it elsewhere means (ADR 0127).
7520
- ...Object.values(scope.formModels ?? {}).map((model) => ({
7521
- root: { kind: "form_model", id: model.id },
7522
- name: model.name,
7523
- dataType: { type: "form", formId: model.formId },
7524
- cardinality: "one"
7525
- }))
7526
- ].sort((a, b) => a.name.localeCompare(b.name));
7527
- var authRoots = () => AUTH_PROPERTIES.map((property) => ({
7528
- root: { kind: "auth", property: property.id },
7529
- name: property.name,
7530
- dataType: property.dataType,
7531
- cardinality: "one"
7532
- }));
7533
- var option = (root, path, label, dataType, cardinality) => ({
7534
- value: encodeBinding({ root, path }),
7535
- label,
7536
- binding: { root, path },
7537
- dataType,
7538
- cardinality
7539
- });
7540
- var walkShape = (scope, accept, root, prefix, path, shapeId, depth) => {
7541
- if (depth > MAX_DEPTH) return [];
7542
- const keys = scope.shapes[shapeId]?.keys ?? [];
7543
- const options = [];
7544
- for (const key2 of keys) {
7545
- const next = [...path, key2.id];
7546
- const label = `${prefix}${SEPARATOR}${key2.cardinality === "one" ? key2.name : `${key2.name}[n]`}`;
7547
- if (accept(key2.dataType, key2.cardinality)) {
7548
- options.push(option(root, next, label, key2.dataType, key2.cardinality));
7549
- }
7550
- if (key2.dataType?.type === "shape" && key2.cardinality === "one") {
7551
- options.push(
7552
- ...walkShape(
7553
- scope,
7554
- accept,
7555
- root,
7556
- label,
7557
- next,
7558
- key2.dataType.shapeId,
7559
- depth + 1
7560
- )
7561
- );
7562
- }
7563
- }
7564
- return options;
7565
- };
7566
- var optionsForRoot = (scope, accept, entry2) => {
7567
- const shapeId = entry2.dataType?.type === "shape" ? entry2.dataType.shapeId : void 0;
7568
- const own = accept(entry2.dataType, entry2.cardinality) ? [option(entry2.root, [], entry2.name, entry2.dataType, entry2.cardinality)] : [];
7569
- if (!shapeId || !WALKABLE_ROOTS.has(entry2.root.kind)) return own;
7570
- return [
7571
- ...own,
7572
- ...walkShape(scope, accept, entry2.root, entry2.name, [], shapeId, 0)
7573
- ];
7574
- };
7575
- var walkStore = (scope, accept, path, depth, prefix = "") => {
7576
- if (depth > MAX_DEPTH) return [];
7577
- const options = [];
7578
- for (const segment of segmentOptions(
7579
- path,
7580
- path.length,
7581
- scope.roots,
7582
- scope.shapes
7583
- )) {
7584
- const next = [...path, segment.id];
7585
- const name3 = segment.cardinality === "one" ? segment.name : `${segment.name}[n]`;
7586
- const label = prefix ? `${prefix}${SEPARATOR}${name3}` : name3;
7587
- if (accept(segment.dataType, segment.cardinality)) {
7588
- const [rootId, ...rest] = next;
7589
- const kind = scope.properties[rootId] ? "property" : "computed";
7590
- options.push(
7591
- option(
7592
- { kind, id: rootId },
7593
- rest,
7594
- label,
7595
- segment.dataType,
7596
- segment.cardinality
7597
- )
7598
- );
7599
- }
7600
- if (segment.dataType.type === "shape" && segment.cardinality === "one") {
7601
- options.push(...walkStore(scope, accept, next, depth + 1, label));
7602
- }
7603
- }
7604
- return options;
7605
- };
7606
- var bindingOptions = (rawScope, accept) => {
7607
- const scope = {
7608
- ...rawScope,
7609
- shapes: withListRowShape(rawScope.shapes)
7610
- };
7611
- return [
7612
- ...[
7613
- ...aliasRoots(scope),
7614
- ...screenRoots(scope),
7615
- ...authRoots()
7616
- ].flatMap(
7617
- (entry2) => optionsForRoot(scope, accept, entry2)
7618
- ),
7619
- ...walkStore(scope, accept, [], 0)
7620
- ];
7621
- };
7622
-
7623
7688
  // libs/codegen/src/lib/form-control-helper.ts
7624
7689
  function normalizeFieldName(raw) {
7625
7690
  return raw.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
@@ -7966,9 +8031,10 @@ var walkKeys = (keyIds, rootShapeId2, shapes) => {
7966
8031
  const names = [];
7967
8032
  let shapeId = rootShapeId2;
7968
8033
  for (const keyId of keyIds) {
7969
- const key2 = shapeId ? shapes[shapeId]?.keys.find((k) => k.id === keyId) : void 0;
8034
+ const shape = shapeId ? shapes[shapeId] : void 0;
8035
+ const key2 = shape?.keys.find((k) => k.id === keyId);
7970
8036
  if (!key2) return void 0;
7971
- names.push(key2.name);
8037
+ names.push(memberToken(shape, key2));
7972
8038
  shapeId = key2.dataType?.type === "shape" ? key2.dataType.shapeId : void 0;
7973
8039
  }
7974
8040
  return names;
@@ -7980,7 +8046,7 @@ var rootShapeId = (binding, scope, seen) => {
7980
8046
  return dataType?.type === "shape" ? dataType.shapeId : void 0;
7981
8047
  }
7982
8048
  if (root.kind === "alias") {
7983
- if (root.alias === "index" || seen.has(root.repeatId)) return void 0;
8049
+ if (root.alias !== "item" || seen.has(root.repeatId)) return void 0;
7984
8050
  seen.add(root.repeatId);
7985
8051
  const holder = scope.controlMap?.[root.repeatId];
7986
8052
  const source = holder?.bindings?.[aliasSourceSlot(holder)];
@@ -8017,6 +8083,129 @@ var bindingShapeId = (binding, scope, seen = /* @__PURE__ */ new Set()) => {
8017
8083
  }
8018
8084
  return shapeId;
8019
8085
  };
8086
+ var rowMemberOptions = (binding, scope) => rowMembers(binding, scope).map(({ value, label }) => ({
8087
+ value,
8088
+ label,
8089
+ noTranslate: true
8090
+ }));
8091
+ var rowMembers = (binding, scope) => {
8092
+ const shapeId = binding ? bindingShapeId(binding, scope) : void 0;
8093
+ const shape = shapeId ? shapesOf(scope)[shapeId] : void 0;
8094
+ if (!shape) return [];
8095
+ if (shape.positional) {
8096
+ return shape.keys.map((key2, index) => ({
8097
+ value: String(index),
8098
+ label: `${index} \xB7 ${key2.name}`,
8099
+ name: key2.name,
8100
+ type: key2.dataType?.type
8101
+ }));
8102
+ }
8103
+ return shape.keys.filter(
8104
+ (key2) => key2.cardinality === "one" && key2.dataType?.type !== "shape"
8105
+ ).map((key2) => ({
8106
+ value: key2.name,
8107
+ label: key2.name,
8108
+ name: key2.name,
8109
+ type: key2.dataType?.type
8110
+ }));
8111
+ };
8112
+ var isTimeMember = (name3) => /date|time|^(t|ts|x|day|period)$/i.test(name3) || /(At|_at)$/.test(name3);
8113
+ var seriesMemberPicks = (binding, scope, current) => {
8114
+ const members = rowMembers(binding, scope);
8115
+ if (!members.length) return {};
8116
+ const offered = (value) => typeof value === "string" && members.some((m) => m.value === value);
8117
+ const x = offered(current.x) ? current.x : (members.find((m) => isTimeMember(m.name)) ?? members.find((m) => m.type === "string") ?? members[0]).value;
8118
+ const rest = members.filter((m) => m.value !== x);
8119
+ const y = offered(current.y) && current.y !== x ? current.y : (rest.find((m) => m.type === "number") ?? rest[0])?.value;
8120
+ return {
8121
+ ...x !== current.x ? { x } : {},
8122
+ ...y !== void 0 && y !== current.y ? { y } : {}
8123
+ };
8124
+ };
8125
+ var bindingCardinality = (binding, scope, seen = /* @__PURE__ */ new Set()) => {
8126
+ const root = binding.root;
8127
+ let dataType;
8128
+ let cardinality;
8129
+ switch (root.kind) {
8130
+ case "property": {
8131
+ const property = scope.properties?.[root.id];
8132
+ dataType = property?.dataType;
8133
+ cardinality = property?.cardinality;
8134
+ break;
8135
+ }
8136
+ case "computed": {
8137
+ const computed = scope.computeds?.[root.id];
8138
+ const fn = computed ? scope.functions?.[computed.functionId] : void 0;
8139
+ const folded = fn ? void 0 : scope.properties?.[root.id];
8140
+ dataType = fn?.returnType ?? folded?.dataType;
8141
+ cardinality = fn ? returnCardinalityOf(fn) : folded?.cardinality;
8142
+ break;
8143
+ }
8144
+ case "input": {
8145
+ const input = scope.inputs?.[root.id];
8146
+ dataType = input?.dataType;
8147
+ cardinality = input?.cardinality;
8148
+ break;
8149
+ }
8150
+ case "screen_computed": {
8151
+ const computed = scope.screenComputeds?.[root.id];
8152
+ const fn = computed ? screenComputedFunction(computed, scope.functions ?? {}) : void 0;
8153
+ dataType = fn?.returnType;
8154
+ cardinality = fn ? returnCardinalityOf(fn) : void 0;
8155
+ break;
8156
+ }
8157
+ case "screen_variable": {
8158
+ const variable = scope.screenVariables?.[root.id];
8159
+ dataType = variable ? { type: variable.dataType } : void 0;
8160
+ cardinality = variable?.cardinality;
8161
+ break;
8162
+ }
8163
+ case "form_model": {
8164
+ const model = scope.formModels?.[root.id];
8165
+ dataType = model ? { type: "form", formId: model.formId } : void 0;
8166
+ cardinality = model ? "one" : void 0;
8167
+ break;
8168
+ }
8169
+ case "auth":
8170
+ return binding.path.length ? void 0 : "one";
8171
+ case "alias": {
8172
+ if (seen.has(root.repeatId)) return void 0;
8173
+ seen.add(root.repeatId);
8174
+ const holder = scope.controlMap?.[root.repeatId];
8175
+ if (!holder) return void 0;
8176
+ if (root.alias !== "item") return binding.path.length ? void 0 : "one";
8177
+ const source = holder.bindings?.[aliasSourceSlot(holder)];
8178
+ const sourceCardinality = source ? bindingCardinality(source, scope, seen) : void 0;
8179
+ const shapeId = rootShapeId(binding, scope, /* @__PURE__ */ new Set());
8180
+ dataType = shapeId ? { type: "shape", shapeId } : void 0;
8181
+ cardinality = sourceCardinality === "map-many" ? "many" : "one";
8182
+ break;
8183
+ }
8184
+ }
8185
+ for (const keyId of binding.path) {
8186
+ const key2 = dataType?.type === "shape" ? shapesOf(scope)[dataType.shapeId]?.keys.find(
8187
+ (entry2) => entry2.id === keyId
8188
+ ) : void 0;
8189
+ if (!key2) return void 0;
8190
+ dataType = key2.dataType;
8191
+ cardinality = key2.cardinality;
8192
+ }
8193
+ return cardinality;
8194
+ };
8195
+ var isKeyedRepeat = (control, scope) => {
8196
+ if (control.type !== "repeat" /* REPEAT */) return false;
8197
+ const source = control.bindings?.[BINDING_SLOT.source];
8198
+ return !!source && isMapCardinality(bindingCardinality(source, scope));
8199
+ };
8200
+ var aliasDisplayName = (repeatId, alias, scope) => {
8201
+ const holder = scope.controlMap?.[repeatId];
8202
+ const spec = aliasNames(holder);
8203
+ if (alias === "index") return spec.indexAlias;
8204
+ if (holder && isKeyedRepeat(holder, scope)) {
8205
+ return `${spec.itemAlias}.${alias === "key" ? "key" : "value"}`;
8206
+ }
8207
+ return alias === "key" ? spec.keyAlias : spec.itemAlias;
8208
+ };
8020
8209
  var sourceCarriesTrackKey = (source, keyId, scope) => {
8021
8210
  const shapeId = bindingShapeId(source, scope);
8022
8211
  return !!shapeId && (shapesOf(scope)[shapeId]?.keys ?? []).some((key2) => key2.id === keyId);
@@ -8071,18 +8260,26 @@ var rootExpression = (binding, scope) => {
8071
8260
  return name3 ? `${scope.memberPrefix ?? ""}${name3}()` : void 0;
8072
8261
  }
8073
8262
  case "alias": {
8074
- const spec = aliasNames(scope.controlMap?.[root.repeatId]);
8263
+ const holder = scope.controlMap?.[root.repeatId];
8264
+ const spec = aliasNames(holder);
8265
+ if (root.alias === "key") {
8266
+ return holder && isKeyedRepeat(holder, scope) ? spec.keyAlias : void 0;
8267
+ }
8075
8268
  return root.alias === "index" ? spec.indexAlias : spec.itemAlias;
8076
8269
  }
8077
8270
  // Never gated by `scope.storeProp`: AuthStore is app-wide, not
8078
8271
  // Feature-owned, so it reads the same on a storeless Page (ADR 0040).
8079
8272
  case "auth":
8080
8273
  return `${scope.memberPrefix ?? ""}authStore.${AUTH_EXPRESSION[root.property]}`;
8274
+ // A FunctionBinding that reads nothing (ADR 0199): no argument is a `pipe`,
8275
+ // so this head is never spelled — the call alone is the read.
8276
+ case "none":
8277
+ return binding.transform ? "undefined" : void 0;
8081
8278
  }
8082
8279
  };
8083
8280
  var rootIsPresent = (binding, scope) => {
8084
8281
  const root = binding.root;
8085
- if (root.kind === "alias") return true;
8282
+ if (root.kind === "alias" || root.kind === "none") return true;
8086
8283
  if (root.kind === "screen_computed") {
8087
8284
  return screenComputedPresent(
8088
8285
  root.id,
@@ -8111,8 +8308,8 @@ var bindingExpression = (binding, scope, guardAlias) => {
8111
8308
  );
8112
8309
  if (!names) return void 0;
8113
8310
  const present = !!guardAlias || rootIsPresent(binding, scope);
8114
- const join = present ? "." : "?.";
8115
- expr = `${head}${join}${names.join("?.")}`;
8311
+ const [first, ...rest] = names;
8312
+ expr = `${head}${memberStep(present ? "." : "?.", first)}${rest.map((name3) => memberStep("?.", name3)).join("")}`;
8116
8313
  }
8117
8314
  if (!binding.transform) return expr;
8118
8315
  const roots = transformRoots(scope);
@@ -8124,7 +8321,11 @@ var bindingExpression = (binding, scope, guardAlias) => {
8124
8321
  )) {
8125
8322
  return void 0;
8126
8323
  }
8324
+ const leafRead = (leaf) => bindingExpression(leaf, scope);
8325
+ const leaves = transformBindingLeaves(binding.transform);
8326
+ if (leaves.some((leaf) => !leafRead(leaf))) return void 0;
8127
8327
  return emitTransformExpr(binding.transform, expr, {
8328
+ bindingRead: leafRead,
8128
8329
  functions: scope.functions ?? {},
8129
8330
  properties: roots,
8130
8331
  shapes: shapesOf(scope),
@@ -8220,7 +8421,12 @@ var bindingGapReason = (binding, scope) => {
8220
8421
  roots,
8221
8422
  shapesOf(scope)
8222
8423
  );
8223
- if (!err) return "cannot emit here";
8424
+ if (!err) {
8425
+ const dead = transformBindingLeaves(binding.transform).find(
8426
+ (leaf) => !bindingExpression(leaf, scope)
8427
+ );
8428
+ return dead ? `function argument ${rootLabel(dead.root, scope)} does not resolve here` : "cannot emit here";
8429
+ }
8224
8430
  const detail = transformGapDetail(
8225
8431
  binding.transform,
8226
8432
  scope.functions ?? {},
@@ -8233,8 +8439,12 @@ var repeatHeader = (control, scope) => {
8233
8439
  const source = control.bindings?.["source"];
8234
8440
  if (!source) return void 0;
8235
8441
  const spec = repeatSpec(control);
8236
- if (!spec.track) return void 0;
8237
8442
  const expr = bindingExpression(source, scope);
8443
+ if (expr && isKeyedRepeat(control, scope)) {
8444
+ const entry2 = repeatEntryName(spec.itemAlias);
8445
+ return `${entry2} of ((${expr} | keyvalue) ?? []); track ${entry2}.key; let ${spec.indexAlias} = $index`;
8446
+ }
8447
+ if (!spec.track) return void 0;
8238
8448
  if (!expr) return void 0;
8239
8449
  const track = trackExpression(
8240
8450
  spec.track,
@@ -8246,12 +8456,24 @@ var repeatHeader = (control, scope) => {
8246
8456
  if (!track) return void 0;
8247
8457
  return `${spec.itemAlias} of (${expr} ?? []); track ${track}; let ${spec.indexAlias} = $index`;
8248
8458
  };
8459
+ var repeatEntryName = (itemAlias) => `${itemAlias}Entry`;
8460
+ var repeatEntryLets = (control, scope) => {
8461
+ if (!isKeyedRepeat(control, scope)) return [];
8462
+ const spec = repeatSpec(control);
8463
+ const entry2 = repeatEntryName(spec.itemAlias);
8464
+ return [
8465
+ `@let ${spec.itemAlias} = ${entry2}.value;`,
8466
+ ...spec.keyAlias ? [`@let ${spec.keyAlias} = ${entry2}.key;`] : []
8467
+ ];
8468
+ };
8249
8469
  var repeatGapReason = (control, scope) => {
8250
8470
  const source = control.bindings?.["source"];
8251
8471
  if (!source) return "no source bound";
8252
8472
  const spec = repeatSpec(control);
8473
+ const resolves = !!bindingExpression(source, scope);
8474
+ if (resolves && isKeyedRepeat(control, scope)) return void 0;
8253
8475
  if (!spec.track) return "no track picked";
8254
- if (!bindingExpression(source, scope)) {
8476
+ if (!resolves) {
8255
8477
  return `source ${rootLabel(source.root, scope)} does not resolve here`;
8256
8478
  }
8257
8479
  if (spec.track.kind !== "key") return void 0;
@@ -8276,14 +8498,310 @@ var rootLabel = (root, scope) => {
8276
8498
  return `row alias of repeat '${root.repeatId}'`;
8277
8499
  case "auth":
8278
8500
  return `auth field '${root.property}'`;
8501
+ case "none":
8502
+ return "function call";
8279
8503
  }
8280
8504
  };
8281
8505
  var trackExpression = (track, itemAlias, indexAlias, source, scope) => {
8282
8506
  if (track.kind === "item") return itemAlias;
8283
8507
  if (track.kind === "index") return indexAlias;
8284
8508
  const shapeId = bindingShapeId(source, scope);
8285
- const key2 = shapeId ? shapesOf(scope)[shapeId]?.keys.find((k) => k.id === track.keyId) : void 0;
8286
- return key2 ? `${itemAlias}.${key2.name}` : void 0;
8509
+ const shape = shapeId ? shapesOf(scope)[shapeId] : void 0;
8510
+ const key2 = shape?.keys.find((k) => k.id === track.keyId);
8511
+ return key2 ? `${itemAlias}${memberAccess(shape, key2)}` : void 0;
8512
+ };
8513
+
8514
+ // libs/codegen/src/lib/binding-option-helper.ts
8515
+ var ROOT_PREFIX = "root:";
8516
+ var SEPARATOR = ".";
8517
+ var MAX_DEPTH = 6;
8518
+ var WALKABLE_ROOTS = /* @__PURE__ */ new Set([
8519
+ "alias",
8520
+ "input",
8521
+ "screen_computed"
8522
+ ]);
8523
+ var encodeRoot = (root) => {
8524
+ if (root.kind === "alias") return `alias:${root.repeatId}:${root.alias}`;
8525
+ if (root.kind === "auth") return `auth:${root.property}`;
8526
+ if (root.kind === "none") return root.kind;
8527
+ return `${root.kind}:${root.id}`;
8528
+ };
8529
+ var encodeBinding = (binding) => {
8530
+ const { root, path } = binding;
8531
+ if (root.kind === "property" || root.kind === "computed") {
8532
+ return `${ROOT_PREFIX}store|${[root.id, ...path].join(SEPARATOR)}`;
8533
+ }
8534
+ const tail = path.join(SEPARATOR);
8535
+ return `${ROOT_PREFIX}${encodeRoot(root)}${tail ? `|${tail}` : ""}`;
8536
+ };
8537
+ var decodeRoot = (encoded) => {
8538
+ const parts = encoded.split(":");
8539
+ if (parts[0] === "alias" && parts.length === 3) {
8540
+ const alias = parts[2];
8541
+ if (alias !== "item" && alias !== "index" && alias !== "key") {
8542
+ return void 0;
8543
+ }
8544
+ return { kind: "alias", repeatId: parts[1], alias };
8545
+ }
8546
+ if (parts[0] === "auth") {
8547
+ const property = AUTH_PROPERTIES.find((entry2) => entry2.id === parts[1]);
8548
+ return property ? { kind: "auth", property: property.id } : void 0;
8549
+ }
8550
+ if (parts[0] === "user_store" && parts[1] === "deployToken") {
8551
+ return { kind: "auth", property: "deployToken" };
8552
+ }
8553
+ const kind = parts[0];
8554
+ if (kind === "input" || kind === "screen_computed" || kind === "screen_variable" || kind === "form_model") {
8555
+ return { kind, id: parts.slice(1).join(":") };
8556
+ }
8557
+ return void 0;
8558
+ };
8559
+ var bindingAlwaysPresent = (binding, scope) => {
8560
+ if (binding.path.length > 1) return false;
8561
+ const root = binding.root;
8562
+ if (root.kind === "alias") return true;
8563
+ if (root.kind === "screen_computed") {
8564
+ return screenComputedPresent(
8565
+ root.id,
8566
+ scope.screenComputeds,
8567
+ scope.functions,
8568
+ scope.inputs
8569
+ );
8570
+ }
8571
+ return root.kind === "input" && !!scope.inputs?.[root.id]?.required;
8572
+ };
8573
+ var sourceShapeId = (source, scope, seen = /* @__PURE__ */ new Set()) => {
8574
+ if (!source) return void 0;
8575
+ let dataType;
8576
+ const root = source.root;
8577
+ if (root.kind === "property" || root.kind === "computed") {
8578
+ dataType = scope.roots[root.id]?.dataType;
8579
+ } else if (root.kind === "input") {
8580
+ dataType = scope.inputs?.[root.id]?.dataType;
8581
+ } else if (root.kind === "screen_computed") {
8582
+ const computed = scope.screenComputeds?.[root.id];
8583
+ dataType = computed ? screenComputedFunction(computed, scope.functions ?? {})?.returnType : void 0;
8584
+ } else if (root.kind === "alias") {
8585
+ if (root.alias !== "item" || seen.has(root.repeatId)) return void 0;
8586
+ const rowShapeId = holderRowShapeId(
8587
+ scope.controlMap[root.repeatId],
8588
+ scope,
8589
+ /* @__PURE__ */ new Set([...seen, root.repeatId])
8590
+ );
8591
+ dataType = rowShapeId ? { type: "shape", shapeId: rowShapeId } : void 0;
8592
+ }
8593
+ for (const keyId of source.path) {
8594
+ const shape = dataType?.type === "shape" ? scope.shapes[dataType.shapeId] : void 0;
8595
+ const key2 = shape?.keys.find((k) => k.id === keyId);
8596
+ if (!key2) return void 0;
8597
+ dataType = key2.dataType;
8598
+ }
8599
+ return dataType?.type === "shape" ? dataType.shapeId : void 0;
8600
+ };
8601
+ var holderRowShapeId = (holder, scope, seen = /* @__PURE__ */ new Set()) => {
8602
+ const shapeId = sourceShapeId(
8603
+ holder?.bindings?.[aliasSourceSlot(holder)],
8604
+ scope,
8605
+ holder ? /* @__PURE__ */ new Set([...seen, holder.id]) : seen
8606
+ );
8607
+ if (shapeId) return shapeId;
8608
+ return holder?.type === "list" /* LIST */ && toListItemRows(holder.configs?.[LIST_ITEMS_KEY]).length ? LIST_ROW_SHAPE_ID : void 0;
8609
+ };
8610
+ var asBindingScope = (scope) => ({
8611
+ properties: scope.roots,
8612
+ shapes: scope.shapes,
8613
+ inputs: scope.inputs,
8614
+ screenComputeds: scope.screenComputeds,
8615
+ screenVariables: scope.screenVariables,
8616
+ formModels: scope.formModels,
8617
+ functions: scope.functions,
8618
+ controlMap: scope.controlMap
8619
+ });
8620
+ var holderSourceCardinality = (holder, scope) => {
8621
+ const source = holder.bindings?.[aliasSourceSlot(holder)];
8622
+ return source ? bindingCardinality(source, asBindingScope(scope)) : void 0;
8623
+ };
8624
+ var aliasRoots = (scope) => {
8625
+ const control = scope.controlId ? scope.controlMap[scope.controlId] : void 0;
8626
+ if (!control || scope.allowAlias === false) return [];
8627
+ const from = isAliasHolder(control) ? control.parentId : control.id;
8628
+ return aliasHoldersInScope(from, scope.controlMap).flatMap((holder) => {
8629
+ const spec = aliasNames(holder);
8630
+ const rowShapeId = holderRowShapeId(holder, scope);
8631
+ const sourceCardinality = holder.type === "repeat" /* REPEAT */ ? holderSourceCardinality(holder, scope) : void 0;
8632
+ const keyed = sourceCardinality === "map" || sourceCardinality === "map-many";
8633
+ return [
8634
+ {
8635
+ root: {
8636
+ kind: "alias",
8637
+ repeatId: holder.id,
8638
+ alias: "item"
8639
+ },
8640
+ // `<item>.value` under a keyed Repeat, `<item>.key` below — the two
8641
+ // halves of one entry, display only (`aliasDisplayName`).
8642
+ name: keyed ? `${spec.itemAlias}.value` : spec.itemAlias,
8643
+ dataType: rowShapeId ? { type: "shape", shapeId: rowShapeId } : { type: "string" },
8644
+ cardinality: sourceCardinality === "map-many" ? "many" : "one"
8645
+ },
8646
+ {
8647
+ root: {
8648
+ kind: "alias",
8649
+ repeatId: holder.id,
8650
+ alias: "index"
8651
+ },
8652
+ name: spec.indexAlias,
8653
+ dataType: { type: "number" },
8654
+ cardinality: "one"
8655
+ },
8656
+ ...keyed && spec.keyAlias ? [
8657
+ {
8658
+ root: {
8659
+ kind: "alias",
8660
+ repeatId: holder.id,
8661
+ alias: "key"
8662
+ },
8663
+ name: `${spec.itemAlias}.key`,
8664
+ dataType: { type: "string" },
8665
+ cardinality: "one"
8666
+ }
8667
+ ] : []
8668
+ ];
8669
+ });
8670
+ };
8671
+ var screenRoots = (scope) => [
8672
+ ...Object.values(scope.inputs ?? {}).map((input) => ({
8673
+ root: { kind: "input", id: input.id },
8674
+ name: input.name,
8675
+ dataType: input.dataType,
8676
+ cardinality: input.cardinality
8677
+ })),
8678
+ // A ScreenComputed's type is its PureFunction's declared return and is
8679
+ // never authored (GLOSSARY.md ScreenComputed), so it is read off the
8680
+ // function the same way `computedAsProperty` reads a StateComputed's.
8681
+ ...Object.values(scope.screenComputeds ?? {}).flatMap((computed) => {
8682
+ const fn = screenComputedFunction(computed, scope.functions ?? {});
8683
+ return fn ? [
8684
+ {
8685
+ root: { kind: "screen_computed", id: computed.id },
8686
+ name: computed.name,
8687
+ dataType: fn.returnType,
8688
+ cardinality: returnCardinalityOf(fn)
8689
+ }
8690
+ ] : [];
8691
+ }),
8692
+ // A ScreenVariable is read whole like the computed above — it holds no
8693
+ // StateShape, so there is nothing to walk into (ADR 0079).
8694
+ ...Object.values(scope.screenVariables ?? {}).map((variable) => ({
8695
+ root: { kind: "screen_variable", id: variable.id },
8696
+ name: variable.name,
8697
+ dataType: { type: variable.dataType },
8698
+ cardinality: variable.cardinality
8699
+ })),
8700
+ // A FormModel is the one Screen-owned root walked into rather than read
8701
+ // whole: a form's value is an object, and its FormShape keys are what
8702
+ // reading it elsewhere means (ADR 0127).
8703
+ ...Object.values(scope.formModels ?? {}).map((model) => ({
8704
+ root: { kind: "form_model", id: model.id },
8705
+ name: model.name,
8706
+ dataType: { type: "form", formId: model.formId },
8707
+ cardinality: "one"
8708
+ }))
8709
+ ].sort((a, b) => a.name.localeCompare(b.name));
8710
+ var authRoots = () => AUTH_PROPERTIES.map((property) => ({
8711
+ root: { kind: "auth", property: property.id },
8712
+ name: property.name,
8713
+ dataType: property.dataType,
8714
+ cardinality: "one"
8715
+ }));
8716
+ var option = (root, path, label, dataType, cardinality) => ({
8717
+ value: encodeBinding({ root, path }),
8718
+ label,
8719
+ binding: { root, path },
8720
+ dataType,
8721
+ cardinality
8722
+ });
8723
+ var walkShape = (scope, accept, root, prefix, path, shapeId, depth) => {
8724
+ if (depth > MAX_DEPTH) return [];
8725
+ const keys = scope.shapes[shapeId]?.keys ?? [];
8726
+ const options = [];
8727
+ for (const key2 of keys) {
8728
+ const next = [...path, key2.id];
8729
+ const label = `${prefix}${SEPARATOR}${key2.cardinality === "one" ? key2.name : `${key2.name}[n]`}`;
8730
+ if (accept(key2.dataType, key2.cardinality)) {
8731
+ options.push(option(root, next, label, key2.dataType, key2.cardinality));
8732
+ }
8733
+ if (key2.dataType?.type === "shape" && key2.cardinality === "one") {
8734
+ options.push(
8735
+ ...walkShape(
8736
+ scope,
8737
+ accept,
8738
+ root,
8739
+ label,
8740
+ next,
8741
+ key2.dataType.shapeId,
8742
+ depth + 1
8743
+ )
8744
+ );
8745
+ }
8746
+ }
8747
+ return options;
8748
+ };
8749
+ var optionsForRoot = (scope, accept, entry2) => {
8750
+ const shapeId = entry2.dataType?.type === "shape" ? entry2.dataType.shapeId : void 0;
8751
+ const own = accept(entry2.dataType, entry2.cardinality) ? [option(entry2.root, [], entry2.name, entry2.dataType, entry2.cardinality)] : [];
8752
+ if (!shapeId || !WALKABLE_ROOTS.has(entry2.root.kind)) return own;
8753
+ if (entry2.root.kind === "alias" && entry2.cardinality !== "one") return own;
8754
+ return [
8755
+ ...own,
8756
+ ...walkShape(scope, accept, entry2.root, entry2.name, [], shapeId, 0)
8757
+ ];
8758
+ };
8759
+ var walkStore = (scope, accept, path, depth, prefix = "") => {
8760
+ if (depth > MAX_DEPTH) return [];
8761
+ const options = [];
8762
+ for (const segment of segmentOptions(
8763
+ path,
8764
+ path.length,
8765
+ scope.roots,
8766
+ scope.shapes
8767
+ )) {
8768
+ const next = [...path, segment.id];
8769
+ const name3 = segment.cardinality === "one" ? segment.name : `${segment.name}[n]`;
8770
+ const label = prefix ? `${prefix}${SEPARATOR}${name3}` : name3;
8771
+ if (accept(segment.dataType, segment.cardinality)) {
8772
+ const [rootId, ...rest] = next;
8773
+ const kind = scope.properties[rootId] ? "property" : "computed";
8774
+ options.push(
8775
+ option(
8776
+ { kind, id: rootId },
8777
+ rest,
8778
+ label,
8779
+ segment.dataType,
8780
+ segment.cardinality
8781
+ )
8782
+ );
8783
+ }
8784
+ if (segment.dataType.type === "shape" && segment.cardinality === "one") {
8785
+ options.push(...walkStore(scope, accept, next, depth + 1, label));
8786
+ }
8787
+ }
8788
+ return options;
8789
+ };
8790
+ var bindingOptions = (rawScope, accept) => {
8791
+ const scope = {
8792
+ ...rawScope,
8793
+ shapes: withListRowShape(rawScope.shapes)
8794
+ };
8795
+ return [
8796
+ ...[
8797
+ ...aliasRoots(scope),
8798
+ ...screenRoots(scope),
8799
+ ...authRoots()
8800
+ ].flatMap(
8801
+ (entry2) => optionsForRoot(scope, accept, entry2)
8802
+ ),
8803
+ ...walkStore(scope, accept, [], 0)
8804
+ ];
8287
8805
  };
8288
8806
 
8289
8807
  // libs/codegen/src/lib/filter-group-helper.ts
@@ -8514,7 +9032,7 @@ function nextCallArgRow(args, rows) {
8514
9032
  value: ""
8515
9033
  };
8516
9034
  }
8517
- var sameType3 = (a, b) => {
9035
+ var sameType4 = (a, b) => {
8518
9036
  if (a.cardinality !== b.cardinality) return false;
8519
9037
  if (!a.dataType || !b.dataType) return false;
8520
9038
  if (a.dataType.type !== b.dataType.type) return false;
@@ -8532,7 +9050,7 @@ var eventMemberType = (row, scope) => {
8532
9050
  function callArgEventMismatch(row, target, scope) {
8533
9051
  if (!target?.dataType || row.transform) return false;
8534
9052
  const member = eventMemberType(row, scope);
8535
- return !!member && !sameType3(target, member);
9053
+ return !!member && !sameType4(target, member);
8536
9054
  }
8537
9055
  var AUTO_CASTS = {
8538
9056
  string: { number: "Number", boolean: "Boolean" },
@@ -8543,7 +9061,7 @@ function callArgTypeMismatch(row, target, scope) {
8543
9061
  if (!target?.dataType || row.transform) return void 0;
8544
9062
  if (row.source !== "binding" && row.source !== "event") return void 0;
8545
9063
  const read = bindingPipeType(row, target, scope);
8546
- if (!read || sameType3(target, read)) return void 0;
9064
+ if (!read || sameType4(target, read)) return void 0;
8547
9065
  const expected = {
8548
9066
  dataType: target.dataType,
8549
9067
  cardinality: target.cardinality
@@ -8586,7 +9104,7 @@ var rowComplete = (row, target, payload, fieldNames, constants, functions, scope
8586
9104
  if (!target.dataType) return "call-arg-type-mismatch";
8587
9105
  const root = scope.roots?.[row.propertyId ?? ""];
8588
9106
  if (!root) return "call-arg-unknown-state";
8589
- if (!sameType3(target, root)) return "call-arg-type-mismatch";
9107
+ if (!sameType4(target, root)) return "call-arg-type-mismatch";
8590
9108
  } else if (row.source === "binding") {
8591
9109
  if (!target.dataType) return "call-arg-type-mismatch";
8592
9110
  if (!row.binding) return "call-arg-incomplete";
@@ -8603,7 +9121,7 @@ var rowComplete = (row, target, payload, fieldNames, constants, functions, scope
8603
9121
  if (!row.storageKey?.trim()) return "call-arg-incomplete";
8604
9122
  } else if (row.source === "search") {
8605
9123
  if (!target.dataType) return "call-arg-type-mismatch";
8606
- if (!sameType3(target, {
9124
+ if (!sameType4(target, {
8607
9125
  dataType: { type: "string" },
8608
9126
  cardinality: "one"
8609
9127
  })) {
@@ -8686,11 +9204,10 @@ function validateCallArgs(args, rows, payload, fieldNames = [], constants = {},
8686
9204
  }
8687
9205
  return void 0;
8688
9206
  }
8689
- var memberAccess2 = (segment) => IDENTIFIER.test(segment) ? `.${segment}` : `['${segment}']`;
8690
- var IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
9207
+ var memberAccess3 = (segment) => isIdentifier(segment) ? `.${segment}` : `[${propertyKey(segment)}]`;
8691
9208
  var eventExpression = (event, payload, root = "$event", eventMember, target, dataType) => {
8692
9209
  if (payload !== "record" || !event?.length) return root;
8693
- const read = `$event${event.map(memberAccess2).join("")}`;
9210
+ const read = `$event${event.map(memberAccess3).join("")}`;
8694
9211
  return eventMember ? eventMember(event, read, "$event", target, dataType) : read;
8695
9212
  };
8696
9213
  function eventPayloadTsType(reads, shapes) {
@@ -8728,11 +9245,10 @@ function eventPayloadTsType(reads, shapes) {
8728
9245
  }
8729
9246
  }
8730
9247
  const serialize = (node) => `{ ${[...node.children.entries()].map(
8731
- ([name3, child]) => `${quoteKey(name3)}: ${child.type ?? serialize(child)}`
9248
+ ([name3, child]) => `${propertyKey(name3)}: ${child.type ?? serialize(child)}`
8732
9249
  ).join("; ")} }`;
8733
9250
  return root.children.size ? serialize(root) : void 0;
8734
9251
  }
8735
- var quoteKey = (name3) => IDENTIFIER.test(name3) ? name3 : `'${name3}'`;
8736
9252
  var memberRead2 = (name3, ctx) => ctx.scope === "class" ? `this.${name3}` : name3;
8737
9253
  var callArgStateRead = (row, ctx) => {
8738
9254
  const name3 = ctx.roots?.[row.propertyId ?? ""]?.name;
@@ -9242,18 +9758,28 @@ function collectScreenWires(tree, refs = {}) {
9242
9758
  });
9243
9759
  }
9244
9760
  var escapeSingle = (value) => value.replace(/'/g, "\\'");
9761
+ var staticLiteral = (value, primitive) => {
9762
+ if (primitive === "number") {
9763
+ const parsed2 = Number(value);
9764
+ return Number.isFinite(parsed2) ? String(parsed2) : void 0;
9765
+ }
9766
+ if (primitive === "boolean") return String(value === "true");
9767
+ return `'${escapeSingle(value)}'`;
9768
+ };
9245
9769
  function screenInputExpression(binding, target, wires, renderBinding = () => void 0) {
9246
9770
  switch (binding.kind) {
9247
9771
  case "static": {
9248
- if (!target || target.cardinality !== "one") return void 0;
9772
+ if (!target) return void 0;
9249
9773
  const primitive = inputPrimitive(target);
9250
9774
  if (!primitive) return void 0;
9251
- if (primitive === "number") {
9252
- const parsed2 = Number(binding.value);
9253
- return Number.isFinite(parsed2) ? String(parsed2) : void 0;
9775
+ if (target.cardinality === "one") {
9776
+ return staticLiteral(binding.value, primitive);
9254
9777
  }
9255
- if (primitive === "boolean") return String(binding.value === "true");
9256
- return `'${escapeSingle(binding.value)}'`;
9778
+ if (target.cardinality !== "many") return void 0;
9779
+ const items = fixedItems(binding.value).map(
9780
+ (item) => staticLiteral(item, primitive)
9781
+ );
9782
+ return items.every((item) => item !== void 0) ? `[${items.join(", ")}]` : void 0;
9257
9783
  }
9258
9784
  case "input":
9259
9785
  case "variable":
@@ -9563,7 +10089,7 @@ function validateStateWrites(properties, rows, payload, fieldNames, inputs, cons
9563
10089
  return void 0;
9564
10090
  }
9565
10091
  var IDENTIFIER2 = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
9566
- var memberAccess3 = (segment) => IDENTIFIER2.test(segment) ? `.${segment}` : `['${segment}']`;
10092
+ var memberAccess4 = (segment) => IDENTIFIER2.test(segment) ? `.${segment}` : `['${segment}']`;
9567
10093
  var valueExpression = (value, property, payload, storeProp, inputs, constants, eventRoot, self = "", eventMember) => {
9568
10094
  if (value.kind === "clear") return "undefined";
9569
10095
  if (value.kind === "toggle") return `!${storeProp}.${property.name}()`;
@@ -9579,7 +10105,7 @@ var valueExpression = (value, property, payload, storeProp, inputs, constants, e
9579
10105
  return input ? `${self}${input.name}()` : void 0;
9580
10106
  }
9581
10107
  if (payload !== "record" || !value.path?.length) return eventRoot;
9582
- const read = `$event${value.path.map(memberAccess3).join("")}`;
10108
+ const read = `$event${value.path.map(memberAccess4).join("")}`;
9583
10109
  return eventMember ? eventMember(
9584
10110
  value.path,
9585
10111
  read,
@@ -9778,7 +10304,7 @@ function validateScreenWrites(variables, rows, payload, fieldNames, inputs, cons
9778
10304
  return void 0;
9779
10305
  }
9780
10306
  var IDENTIFIER3 = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
9781
- var memberAccess4 = (segment) => IDENTIFIER3.test(segment) ? `.${segment}` : `['${segment}']`;
10307
+ var memberAccess5 = (segment) => IDENTIFIER3.test(segment) ? `.${segment}` : `['${segment}']`;
9782
10308
  var valueExpression2 = (value, variable, payload, inputs, constants, eventRoot, self = "", eventMember) => {
9783
10309
  if (value.kind === "clear") return "undefined";
9784
10310
  if (value.kind === "toggle") return `!${self}${variable.name}()`;
@@ -9794,7 +10320,7 @@ var valueExpression2 = (value, variable, payload, inputs, constants, eventRoot,
9794
10320
  return input ? `${self}${input.name}()` : void 0;
9795
10321
  }
9796
10322
  if (payload !== "record" || !value.path?.length) return eventRoot;
9797
- const read = `$event${value.path.map(memberAccess4).join("")}`;
10323
+ const read = `$event${value.path.map(memberAccess5).join("")}`;
9798
10324
  return eventMember ? eventMember(
9799
10325
  value.path,
9800
10326
  read,
@@ -10119,6 +10645,19 @@ function setOutputArmMode(control, output, armId, mode) {
10119
10645
  })
10120
10646
  );
10121
10647
  }
10648
+ function setOutputArmStartsChain(control, output, armId, startsChain) {
10649
+ const arms = outputArms(control, output);
10650
+ if (!arms.some((arm) => arm.id === armId)) return control;
10651
+ return withArms(
10652
+ control,
10653
+ output,
10654
+ arms.map((arm) => {
10655
+ if (arm.id !== armId) return arm;
10656
+ const { startsChain: _dropped, ...rest } = arm;
10657
+ return startsChain ? { ...rest, startsChain: true } : rest;
10658
+ })
10659
+ );
10660
+ }
10122
10661
  function setOutputArmChecks(control, output, armId, checks) {
10123
10662
  const arms = outputArms(control, output);
10124
10663
  if (!arms.some((arm) => arm.id === armId)) return control;
@@ -11163,6 +11702,70 @@ function staleMenuActionItems(control) {
11163
11702
  return stale;
11164
11703
  }
11165
11704
 
11705
+ // libs/codegen/src/lib/plugin-control-helper.ts
11706
+ var PLUGIN_LINK_KEY = "link";
11707
+ var PLUGIN_SCREEN_KEY = "screen";
11708
+ var PLUGIN_INPUTS_KEY = "pluginInputs";
11709
+ var PLUGIN_OUTPUTS_KEY = "pluginOutputs";
11710
+ var PLUGIN_OUTPUT_SHAPES_KEY = "pluginOutputShapes";
11711
+ var PLUGIN_SOURCE_KEY = "source";
11712
+ var PLUGIN_PORT_KEY = "port";
11713
+ var pluginSourceOf = (configs) => {
11714
+ const source = configs?.[PLUGIN_SOURCE_KEY];
11715
+ return source === "local" || source === "beta" ? source : "published";
11716
+ };
11717
+ var pluginPortOf = (configs) => {
11718
+ const port = Number(configs?.[PLUGIN_PORT_KEY]);
11719
+ return Number.isInteger(port) && port > 0 && port < 65536 ? port : void 0;
11720
+ };
11721
+ var pluginOriginKey = (configs) => {
11722
+ const link = String(configs?.[PLUGIN_LINK_KEY] ?? "").trim();
11723
+ const source = pluginSourceOf(configs);
11724
+ return source === "local" ? `${link}|local|${pluginPortOf(configs) ?? ""}` : `${link}|${source}`;
11725
+ };
11726
+ var IDENTIFIER4 = /^[A-Za-z_$][\w$]*$/;
11727
+ var pluginNamesOf = (configs, key2) => [
11728
+ ...new Set(
11729
+ String(configs?.[key2] ?? "").split(/[\s,]+/).map((name3) => name3.trim()).filter((name3) => IDENTIFIER4.test(name3))
11730
+ )
11731
+ ];
11732
+ var pluginInputSlot = (name3) => `plugin:${name3}`;
11733
+ var pluginOutputShapeOf = (configs, name3) => {
11734
+ const shapes = configs?.[PLUGIN_OUTPUT_SHAPES_KEY];
11735
+ if (!shapes || typeof shapes !== "object" || Array.isArray(shapes))
11736
+ return void 0;
11737
+ const shape = shapes[name3];
11738
+ return shape === "void" || shape === "string" || shape === "number" || shape === "boolean" || shape === "record" ? shape : void 0;
11739
+ };
11740
+ var pluginPickWrites = (before, picked, contractOf) => {
11741
+ const after = { ...before, ...picked };
11742
+ const originChanged = pluginOriginKey(after) !== pluginOriginKey(before);
11743
+ if (originChanged) {
11744
+ return {
11745
+ [PLUGIN_SCREEN_KEY]: void 0,
11746
+ [PLUGIN_INPUTS_KEY]: void 0,
11747
+ [PLUGIN_OUTPUTS_KEY]: void 0
11748
+ };
11749
+ }
11750
+ if (!(PLUGIN_SCREEN_KEY in picked)) return {};
11751
+ const screen = String(picked[PLUGIN_SCREEN_KEY] ?? "").trim();
11752
+ const contract = screen ? contractOf(after, screen) : void 0;
11753
+ return {
11754
+ [PLUGIN_INPUTS_KEY]: contract?.inputs.length ? contract.inputs.join(", ") : void 0,
11755
+ [PLUGIN_OUTPUTS_KEY]: contract?.outputs.length ? contract.outputs.join(", ") : void 0
11756
+ };
11757
+ };
11758
+ var pluginContractResync = (configs, contractOf) => {
11759
+ const screen = String(configs?.[PLUGIN_SCREEN_KEY] ?? "").trim();
11760
+ if (!configs || !screen || !contractOf(configs, screen)) return null;
11761
+ const writes = pluginPickWrites(configs, { [PLUGIN_SCREEN_KEY]: screen }, contractOf);
11762
+ const names = (bag, key2) => pluginNamesOf(bag, key2).sort().join(",");
11763
+ const inSync = [PLUGIN_INPUTS_KEY, PLUGIN_OUTPUTS_KEY].every(
11764
+ (key2) => names(configs, key2) === names(writes, key2)
11765
+ );
11766
+ return inSync ? null : writes;
11767
+ };
11768
+
11166
11769
  // libs/codegen/src/lib/store-method-helper.ts
11167
11770
  function normalizeMethodName(raw) {
11168
11771
  const cleaned = raw.trim().replace(
@@ -11263,8 +11866,9 @@ function findTarget(op, target) {
11263
11866
  return inputPaths(op).find((t) => t.label === key2);
11264
11867
  }
11265
11868
  function fixedAllowed(target) {
11266
- return target.cardinality === "one" && target.dataType?.type !== "shape";
11869
+ return (target.cardinality === "one" || target.cardinality === "many") && target.dataType?.type !== "shape";
11267
11870
  }
11871
+ var fixedItems = (value) => String(value ?? "").split(/[\n,]/).map((item) => item.trim()).filter(Boolean);
11268
11872
  function fixedIsText(target) {
11269
11873
  return target[0] === "path" || target[0] === "query";
11270
11874
  }
@@ -11323,7 +11927,7 @@ function methodSignature(args) {
11323
11927
  );
11324
11928
  return `f({ ${params.join("; ")} })`;
11325
11929
  }
11326
- var sameType4 = (a, b) => a.cardinality === b.cardinality && a.dataType?.type === b.dataType?.type;
11930
+ var sameType5 = (a, b) => a.cardinality === b.cardinality && a.dataType?.type === b.dataType?.type;
11327
11931
  function validateInputs(method, op) {
11328
11932
  const targets = inputPaths(op);
11329
11933
  const keys = targets.map((t) => t.label);
@@ -11338,7 +11942,9 @@ function validateInputs(method, op) {
11338
11942
  }
11339
11943
  }
11340
11944
  for (const mapping of method.inputs) {
11341
- if (mapping.source === "fixed" && !mapping.value) return "input-incomplete";
11945
+ if (mapping.source === "fixed" && !fixedItems(mapping.value).length) {
11946
+ return "input-incomplete";
11947
+ }
11342
11948
  if (mapping.source === "store" && !mapping.path?.length) {
11343
11949
  return "input-incomplete";
11344
11950
  }
@@ -11352,7 +11958,7 @@ function validateInputs(method, op) {
11352
11958
  const args = /* @__PURE__ */ new Map();
11353
11959
  for (const arg of allArgs(method, op)) {
11354
11960
  const seen = args.get(arg.name);
11355
- if (seen && !sameType4(seen, arg)) return "input-arg-clash";
11961
+ if (seen && !sameType5(seen, arg)) return "input-arg-clash";
11356
11962
  args.set(arg.name, arg);
11357
11963
  }
11358
11964
  const requiredMissing = targets.some(
@@ -11420,6 +12026,10 @@ var OUTPUT_PAYLOADS_BY_CONTROL = {
11420
12026
  // libs/one SectionTableSort — the column's id and the direction.
11421
12027
  ["section_table" /* SECTION_TABLE */]: { sortChange: "record" },
11422
12028
  ["section_table_row" /* SECTION_TABLE_ROW */]: { rowClick: "void" },
12029
+ // libs/one SectionChart: the preset id picked (or `custom` once the window
12030
+ // was dragged), and the window itself as `{from, to}` ISO text — what an
12031
+ // ApiOperation's date params take (GLOSSARY.md SectionChartWindow).
12032
+ ["section_chart" /* SECTION_CHART */]: { rangeChange: "string", windowChange: "record" },
11423
12033
  // `Record<string, string | number | (string|number)[]>` keyed by each
11424
12034
  // Filter's own `name` — a record whose members are the Filters dropped
11425
12035
  // into the group rather than a fixed list, which is why they are resolved
@@ -11445,6 +12055,9 @@ var OUTPUT_PAYLOAD_MEMBERS = {
11445
12055
  ["section_table" /* SECTION_TABLE */]: {
11446
12056
  sortChange: { id: "S", direction: "S" }
11447
12057
  },
12058
+ ["section_chart" /* SECTION_CHART */]: {
12059
+ windowChange: { from: "S", to: "S" }
12060
+ },
11448
12061
  // libs/one `Audience` — one AudienceLevel, then the people and the Groups it
11449
12062
  // lets in or keeps out (GLOSSARY.md AudiencePickerControl). Self-typed, so
11450
12063
  // nothing binds `data` to give the output a shape (ADR 0187).
@@ -11493,6 +12106,10 @@ function filterPayloadShape(configs) {
11493
12106
  }
11494
12107
  function payloadShape(outputName, controlType, configs) {
11495
12108
  const declared = baseOutputName(outputName);
12109
+ if (controlType === "plugin" /* PLUGIN */) {
12110
+ const pluginShape = pluginOutputShapeOf(configs, declared);
12111
+ if (pluginShape) return pluginShape;
12112
+ }
11496
12113
  if (controlType === "field" /* FIELD */ && declared === "dataChange") {
11497
12114
  return fieldPayloadShape(configs) ?? "void";
11498
12115
  }
@@ -11804,7 +12421,7 @@ function responsePaths(response) {
11804
12421
  });
11805
12422
  if (cardinality !== "one" || dataType?.type !== "shape") return;
11806
12423
  const shape = shapes[dataType.shapeId];
11807
- if (!shape) return;
12424
+ if (!shape || shape.positional) return;
11808
12425
  for (const key2 of shape.keys) {
11809
12426
  walk(
11810
12427
  [...source, key2.name],
@@ -11841,9 +12458,18 @@ function renderElement(dataType, shapes, depth, seen) {
11841
12458
  if (!shape) return "object";
11842
12459
  if (seen.has(shape.id)) return shape.name;
11843
12460
  const next = new Set(seen).add(shape.id);
11844
- const pad = " ".repeat(depth + 1);
12461
+ const pad2 = " ".repeat(depth + 1);
12462
+ if (shape.positional) {
12463
+ const places = shape.keys.map((key2, i) => {
12464
+ const comma = i < shape.keys.length - 1 ? "," : "";
12465
+ return `${pad2}${renderJson(key2.dataType, key2.cardinality, shapes, depth + 1, next)}${comma} // ${key2.name}`;
12466
+ }).join("\n");
12467
+ return `[
12468
+ ${places}
12469
+ ${" ".repeat(depth)}]`;
12470
+ }
11845
12471
  const body = shape.keys.map(
11846
- (key2) => `${pad}"${key2.name}": ${renderJson(key2.dataType, key2.cardinality, shapes, depth + 1, next)}`
12472
+ (key2) => `${pad2}"${key2.name}": ${renderJson(key2.dataType, key2.cardinality, shapes, depth + 1, next)}`
11847
12473
  ).join(",\n");
11848
12474
  return body ? `{
11849
12475
  ${body}
@@ -11873,6 +12499,13 @@ function literalExpression(value, dataType) {
11873
12499
  if (type === "number") return String(Number(text2) || 0);
11874
12500
  return `'${text2.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
11875
12501
  }
12502
+ function fixedExpression(value, dataType, cardinality) {
12503
+ if (cardinality !== "many") return literalExpression(value, dataType);
12504
+ const items = fixedItems(value).map(
12505
+ (item) => literalExpression(item, dataType)
12506
+ );
12507
+ return `[${items.join(", ")}]`;
12508
+ }
11876
12509
  function responsePathAt(response, source) {
11877
12510
  const key2 = source.join(".");
11878
12511
  return responsePaths(response).find((p2) => p2.label === key2);
@@ -12158,6 +12791,7 @@ var rulePaths2 = (rule) => {
12158
12791
  return Object.values(node.args).flatMap(
12159
12792
  (arg) => arg.kind === "path" ? [arg.path] : []
12160
12793
  );
12794
+ if (node.kind === "function") return Object.values(node.args);
12161
12795
  return node.operand.kind === "path" ? [node.path, node.operand.path] : [node.path];
12162
12796
  };
12163
12797
  return walk(rule);
@@ -12510,7 +13144,7 @@ function releaseBlocker(config, linked) {
12510
13144
  }
12511
13145
 
12512
13146
  // libs/codegen/src/lib/app-target-helper.ts
12513
- var DEFAULT_BACKEND_URL = DEFAULT_NORMAL_BACKEND_URL;
13147
+ var DEFAULT_BACKEND_URL = DEFAULT_LOCAL_BACKEND_URL;
12514
13148
  function normalizeBackendUrl(url) {
12515
13149
  return url.trim().replace(/\/swagger\.json\/?$/i, "");
12516
13150
  }
@@ -12523,15 +13157,15 @@ function resolvedAuthUrl(authUrl, fallbackAuthUrl) {
12523
13157
  const trimmed = authUrl.trim();
12524
13158
  return trimmed || fallbackAuthUrl;
12525
13159
  }
12526
- function resolvedBackendUrl(backendUrl) {
13160
+ function resolvedBackendUrl(backendUrl, fallbackBackendUrl = DEFAULT_LOCAL_BACKEND_URL) {
12527
13161
  const normalized = normalizeBackendUrl(backendUrl);
12528
- return normalized || DEFAULT_NORMAL_BACKEND_URL;
13162
+ return normalized || fallbackBackendUrl;
12529
13163
  }
12530
13164
  function activeHosts(target) {
12531
- return target.environment.normal;
13165
+ return target.environment.hosts;
12532
13166
  }
12533
13167
  function activeBackendUrl(target) {
12534
- return target.environment.normal.backendUrl;
13168
+ return target.environment.hosts.backendUrl;
12535
13169
  }
12536
13170
  function loadBackendUrl(stored) {
12537
13171
  const backend = typeof stored.backendUrl === "string" ? stored.backendUrl.trim() : "";
@@ -12545,56 +13179,44 @@ function loadBackendUrl(stored) {
12545
13179
  }
12546
13180
  }
12547
13181
  var asHostString = (value) => typeof value === "string" ? value.trim() : "";
12548
- var LEGACY_NORMAL_DEV_AUTH_URL = "https://api.magmonium.com";
12549
- var normalizeStoredAuthUrl = (authUrl, section, fallback) => {
13182
+ var LEGACY_LOCAL_DEV_AUTH_URL = "https://api.magmonium.com";
13183
+ var normalizeStoredAuthUrl = (authUrl, preset, fallback) => {
12550
13184
  const resolved = authUrl || fallback.authUrl;
12551
- if (section !== "prod" && resolved === LEGACY_NORMAL_DEV_AUTH_URL) {
13185
+ if (preset !== "prod" && resolved === LEGACY_LOCAL_DEV_AUTH_URL) {
12552
13186
  return fallback.authUrl;
12553
13187
  }
12554
13188
  return resolved;
12555
13189
  };
12556
- var loadHosts = (value, fallback, section) => {
13190
+ var loadHosts = (value, preset) => {
13191
+ const fallback = presetHosts(preset);
12557
13192
  if (!value || typeof value !== "object") return { ...fallback };
12558
13193
  const raw = value;
12559
13194
  return {
12560
13195
  authUrl: normalizeStoredAuthUrl(
12561
13196
  asHostString(raw.authUrl),
12562
- section,
13197
+ preset,
12563
13198
  fallback
12564
13199
  ),
12565
13200
  backendUrl: asHostString(raw.backendUrl) || fallback.backendUrl,
12566
13201
  socketUrl: asHostString(raw.socketUrl) || fallback.socketUrl
12567
13202
  };
12568
13203
  };
13204
+ var isPreset = (value) => ENVIRONMENT_PRESETS.includes(value);
12569
13205
  function loadEnvironment(stored, legacySocketUrl = "") {
12570
13206
  const raw = stored.environment;
12571
13207
  if (raw && typeof raw === "object") {
12572
13208
  const env = raw;
12573
- if (env.normal && typeof env.normal === "object") {
12574
- return {
12575
- normal: loadHosts(env.normal, defaultNormalHosts(), "normal"),
12576
- prod: loadHosts(env.prod, defaultProdHosts(), "prod"),
12577
- dev: loadHosts(env.dev, defaultDevHosts(), "dev")
12578
- };
13209
+ if (env.hosts && typeof env.hosts === "object") {
13210
+ const preset = isPreset(env.preset) ? env.preset : "local";
13211
+ return { preset, hosts: loadHosts(env.hosts, preset) };
12579
13212
  }
12580
- const prod = loadHosts(env.prod, defaultProdHosts(), "prod");
12581
- const dev = loadHosts(env.dev, defaultDevHosts(), "dev");
12582
- const activeKey = env.active === "prod" ? "prod" : "dev";
12583
- const fromActive = activeKey === "prod" ? prod : dev;
12584
- return {
12585
- normal: { ...fromActive },
12586
- prod,
12587
- // Old "dev" was localhost-oriented; hosted-dev defaults when the old
12588
- // active was already that localhost set copied into normal.
12589
- dev: activeKey === "dev" ? defaultDevHosts() : dev
12590
- };
13213
+ return { preset: "prod", hosts: loadHosts(env.prod, "prod") };
12591
13214
  }
12592
13215
  const legacyBackend = loadBackendUrl(stored);
13216
+ const legacySocket = legacySocketUrl.trim();
12593
13217
  return defaultEnvironment({
12594
- normal: {
12595
- backendUrl: legacyBackend || DEFAULT_NORMAL_BACKEND_URL,
12596
- socketUrl: legacySocketUrl.trim() || defaultNormalHosts().socketUrl
12597
- }
13218
+ ...legacyBackend && { backendUrl: legacyBackend },
13219
+ ...legacySocket && { socketUrl: legacySocket }
12598
13220
  });
12599
13221
  }
12600
13222
  function appDisplayName(appName) {
@@ -12631,6 +13253,13 @@ var bumpVersion = (version3, bump) => {
12631
13253
  if (bump === "minor") return `${major}.${minor + 1}.0`;
12632
13254
  return `${major}.${minor}.${patch + 1}`;
12633
13255
  };
13256
+ var newerVersion = (a, b) => {
13257
+ if (!isReleaseVersion(b)) return a;
13258
+ if (!isReleaseVersion(a)) return b;
13259
+ const [x, y] = [a, b].map((one) => one.split(".").map(Number));
13260
+ const at = x.findIndex((part, index) => part !== y[index]);
13261
+ return at >= 0 && y[at] > x[at] ? b : a;
13262
+ };
12634
13263
  var WC_ENVIRONMENTS = ["dev", "prod"];
12635
13264
 
12636
13265
  // libs/codegen/src/lib/app-target-storage.ts
@@ -12987,18 +13616,24 @@ var FORMAT_PIPE_FORM = {
12987
13616
  var TEXT_SOURCE = {
12988
13617
  translated: "translated",
12989
13618
  static: "static",
12990
- dynamic: "dynamic"
13619
+ dynamic: "dynamic",
13620
+ // A [FunctionBinding] on the label: a PureFunction call, each parameter
13621
+ // mapped (ADR 0197). Bound like `dynamic`, so everything that clears or
13622
+ // keeps a bound label treats the two alike.
13623
+ function: "function"
12991
13624
  };
12992
13625
  var TEXT_SOURCES = [
12993
13626
  TEXT_SOURCE.translated,
12994
13627
  TEXT_SOURCE.static,
12995
- TEXT_SOURCE.dynamic
13628
+ TEXT_SOURCE.dynamic,
13629
+ TEXT_SOURCE.function
12996
13630
  ];
12997
13631
  var STAT_TEXT_SOURCES = [
12998
13632
  TEXT_SOURCE.translated,
12999
- TEXT_SOURCE.dynamic
13633
+ TEXT_SOURCE.dynamic,
13634
+ TEXT_SOURCE.function
13000
13635
  ];
13001
- var hasTextSource = (type) => type === "text" /* TEXT_OUTPUT */ || type === "stat" /* STAT */ || type === "button" /* BUTTON */;
13636
+ var hasTextSource = (type) => type === "text" /* TEXT_OUTPUT */ || type === "stat" /* STAT */ || type === "button" /* BUTTON */ || type === "section_chart_series" /* SECTION_CHART_SERIES */;
13002
13637
  var textSourcesFor = (type) => type === "stat" /* STAT */ ? STAT_TEXT_SOURCES : TEXT_SOURCES;
13003
13638
  var admitsTextSource = (type, source) => hasTextSource(type) && textSourcesFor(type).includes(source);
13004
13639
  var NO_TRANSLATE_CONFIG_KEY = "noTranslate";
@@ -13007,7 +13642,9 @@ var isTextSource = (value) => TEXT_SOURCES.includes(value);
13007
13642
  var textSourceOf = (control) => {
13008
13643
  if (!control) return TEXT_SOURCE.translated;
13009
13644
  if (control.textSource) return control.textSource;
13010
- if (control.bindings?.[BINDING_SLOT.label]) return TEXT_SOURCE.dynamic;
13645
+ const label = control.bindings?.[BINDING_SLOT.label];
13646
+ if (label?.source === "function") return TEXT_SOURCE.function;
13647
+ if (label) return TEXT_SOURCE.dynamic;
13011
13648
  return control.configs?.[NO_TRANSLATE_CONFIG_KEY] === true ? TEXT_SOURCE.static : TEXT_SOURCE.translated;
13012
13649
  };
13013
13650
  var textSourceConfigs = (source) => ({
@@ -13127,6 +13764,13 @@ var staticCanvasLiteral = (control) => {
13127
13764
  return raw === void 0 || raw === null || raw === "" ? void 0 : String(raw);
13128
13765
  };
13129
13766
  var bindingPathText = (binding, scope) => {
13767
+ if (binding.root.kind === "none") {
13768
+ const name3 = callTargetName(
13769
+ functionBindingTarget(binding),
13770
+ scope.functions
13771
+ );
13772
+ return name3 ? `${name3}()` : "";
13773
+ }
13130
13774
  const head = rootDisplayName(binding.root, scope);
13131
13775
  if (!head) return "";
13132
13776
  const names = [];
@@ -13193,10 +13837,8 @@ var authSlotMap = (bindings) => {
13193
13837
  };
13194
13838
  var rootDisplayName = (root, scope) => {
13195
13839
  switch (root.kind) {
13196
- case "alias": {
13197
- const spec = aliasNames(scope.controlMap?.[root.repeatId]);
13198
- return root.alias === "index" ? spec.indexAlias : spec.itemAlias;
13199
- }
13840
+ case "alias":
13841
+ return aliasDisplayName(root.repeatId, root.alias, scope);
13200
13842
  case "input":
13201
13843
  return scope.inputs?.[root.id]?.name;
13202
13844
  case "screen_computed":
@@ -13207,6 +13849,9 @@ var rootDisplayName = (root, scope) => {
13207
13849
  return scope.formModels?.[root.id]?.name;
13208
13850
  case "auth":
13209
13851
  return AUTH_PROPERTIES.find((property) => property.id === root.property)?.name;
13852
+ // Named by its call in `bindingPathText`, which holds the binding.
13853
+ case "none":
13854
+ return void 0;
13210
13855
  // A StateComputed resolves as a synthetic property wherever the editor
13211
13856
  // reads paths (ADR 0047), so one lookup answers for both store roots.
13212
13857
  default:
@@ -13330,9 +13975,12 @@ function computeMemberRead(fn, member, shapes) {
13330
13975
  const names = [];
13331
13976
  for (const keyId of member ?? []) {
13332
13977
  if (cardinality !== "one" || dataType?.type !== "shape") return void 0;
13333
- const key2 = shapes[dataType.shapeId]?.keys.find((k) => k.id === keyId);
13978
+ const shape = shapes[dataType.shapeId];
13979
+ const key2 = shape?.keys.find(
13980
+ (k) => k.id === keyId
13981
+ );
13334
13982
  if (!key2) return void 0;
13335
- names.push(key2.name);
13983
+ names.push(memberToken(shape, key2));
13336
13984
  dataType = key2.dataType;
13337
13985
  cardinality = key2.cardinality;
13338
13986
  }
@@ -14227,8 +14875,9 @@ var classCardScope = (scope) => ({
14227
14875
  var memberExpression = (member, itemLocal, indexLocal, shapeId, shapes) => {
14228
14876
  if (member.kind === "item") return itemLocal;
14229
14877
  if (member.kind === "index") return indexLocal;
14230
- const key2 = shapeId ? shapes[shapeId]?.keys.find((entry2) => entry2.id === member.keyId) : void 0;
14231
- return key2 ? `${itemLocal}.${key2.name}` : void 0;
14878
+ const shape = shapeId ? shapes[shapeId] : void 0;
14879
+ const key2 = shape?.keys.find((entry2) => entry2.id === member.keyId);
14880
+ return key2 ? `${itemLocal}${memberAccess(shape, key2)}` : void 0;
14232
14881
  };
14233
14882
  var cardEmit = (node, control, scope, screenRef) => {
14234
14883
  if (!isCardHolder(control)) return void 0;
@@ -14471,12 +15120,16 @@ function mappingExpression(mapping, target, properties, shapes, functions, compu
14471
15120
  const member = fn ? computeMemberRead(fn, mapping.member, shapes) : void 0;
14472
15121
  if (!fn || !member) return void 0;
14473
15122
  const dot = absent && !waits ? "?." : ".";
14474
- source += member.names.map((name3, at) => `${at === 0 && waits ? "!" : ""}${dot}${name3}`).join("");
15123
+ source += member.names.map((name3, at) => `${at === 0 && waits ? "!" : ""}${memberStep(dot, name3)}`).join("");
14475
15124
  } else if (waits) {
14476
15125
  source += "!";
14477
15126
  }
14478
15127
  } else if (mapping.source === "fixed") {
14479
- source = literalExpression(mapping.value ?? "", target.dataType);
15128
+ source = fixedExpression(
15129
+ mapping.value ?? "",
15130
+ target.dataType,
15131
+ target.cardinality
15132
+ );
14480
15133
  } else {
14481
15134
  source = statePathExpression(
14482
15135
  mapping.path ?? [],
@@ -14783,11 +15436,14 @@ function patchLiteral(mappings, properties, shapes, functions, subject, cast = f
14783
15436
  return { receiver, key: property.name, value: mapping.arg };
14784
15437
  }
14785
15438
  const read = mapping.source.length ? `${subject}${mapping.source.map((s) => `?.${s}`).join("")}` : subject;
15439
+ const element = property.dataType.type === "shape" ? shapes[property.dataType.shapeId] : void 0;
15440
+ const keyKey = element?.keys.find((k) => k.name === mapping.keyBy);
15441
+ const keyRead = keyKey ? `item${memberAccess(element, keyKey)}` : `item.${mapping.keyBy}`;
14786
15442
  const keyed = mapping.keyBy ? property.cardinality === "map-many" ? `(${castRead(read, cast, "unknown[]")} ?? []).reduce<${tsTypeExpression(
14787
15443
  shapes,
14788
15444
  property.dataType,
14789
15445
  property.cardinality
14790
- )}>((acc, item) => { (acc[item.${mapping.keyBy}] ??= []).push(item); return acc; }, {})` : `Object.fromEntries((${castRead(read, cast, "unknown[]")} ?? []).map((item) => [item.${mapping.keyBy}, item]))` : void 0;
15446
+ )}>((acc, item) => { (acc[${keyRead}] ??= []).push(item); return acc; }, {})` : `Object.fromEntries((${castRead(read, cast, "unknown[]")} ?? []).map((item) => [${keyRead}, item]))` : void 0;
14791
15447
  const value = keyed ?? castRead(
14792
15448
  read,
14793
15449
  cast,
@@ -15618,7 +16274,7 @@ ${computeLines.map((line) => ` ${line}`).join("\n")}
15618
16274
  const member = computeMemberRead(fn, binding.member, shapes);
15619
16275
  if (!member) continue;
15620
16276
  const dot = fn.returnUndefined ? "?." : ".";
15621
- const read2 = `${confirmReceiver}.compute.${binding.name}${member.names.map((name3) => `${dot}${name3}`).join("")}`;
16277
+ const read2 = `${confirmReceiver}.compute.${binding.name}${member.names.map((name3) => memberStep(dot, name3)).join("")}`;
15622
16278
  const isText2 = member.dataType?.type === "string" && member.cardinality === "one";
15623
16279
  if (fn.returnUndefined) {
15624
16280
  confirmParams[slot] = isText2 ? `${read2} ?? ''` : `String(${read2} ?? '')`;
@@ -16527,7 +17183,7 @@ function screenMemberOptions(scope, dataType, cardinality, required, byName) {
16527
17183
  }));
16528
17184
  return [...inputs, ...variables, ...constants, ...computeds];
16529
17185
  }
16530
- var sameType5 = (candidate, declared) => {
17186
+ var sameType6 = (candidate, declared) => {
16531
17187
  if (candidate?.type !== declared.type) return false;
16532
17188
  return declared.type === "shape" ? candidate.type === "shape" && candidate.shapeId === declared.shapeId : true;
16533
17189
  };
@@ -16539,7 +17195,7 @@ function dataOptions(scope, want) {
16539
17195
  const listedAsMember = !!want.dataType;
16540
17196
  return bindingOptions(
16541
17197
  data,
16542
- (candidate, rowCardinality) => rowCardinality === cardinality && sameType5(candidate, declared)
17198
+ (candidate, rowCardinality) => rowCardinality === cardinality && sameType6(candidate, declared)
16543
17199
  ).filter(
16544
17200
  ({ binding }) => !(listedAsMember && binding.path.length === 0 && memberRoots.has(binding.root.kind))
16545
17201
  ).map(({ value, label, binding }) => ({
@@ -16704,8 +17360,8 @@ function validateOutputOpen(open, screens, payload, hostInputs, constants = {},
16704
17360
  const filled = new Set(outputOpenInputs(open).map((row) => row.inputId));
16705
17361
  return declared.some((input) => input.required && !filled.has(input.id)) ? "open-input-unmapped" : void 0;
16706
17362
  }
16707
- var IDENTIFIER4 = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
16708
- var memberAccess5 = (segment) => IDENTIFIER4.test(segment) ? `.${segment}` : `['${segment}']`;
17363
+ var IDENTIFIER5 = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
17364
+ var memberAccess6 = (segment) => IDENTIFIER5.test(segment) ? `.${segment}` : `['${segment}']`;
16709
17365
  function valueExpression3(value, input, payload, hostInputs, constants, eventRoot, self, eventMember, renderMember = () => void 0, renderBinding = () => void 0) {
16710
17366
  if (value.kind === "clear") return "undefined";
16711
17367
  if (value.kind === "screen")
@@ -16723,7 +17379,7 @@ function valueExpression3(value, input, payload, hostInputs, constants, eventRoo
16723
17379
  if (value.kind === "toggle") return void 0;
16724
17380
  if (payload === "void") return void 0;
16725
17381
  if (payload !== "record" || !value.path?.length) return eventRoot;
16726
- const read = `$event${value.path.map(memberAccess5).join("")}`;
17382
+ const read = `$event${value.path.map(memberAccess6).join("")}`;
16727
17383
  return eventMember ? eventMember(value.path, read, "$event", input.cardinality, input.dataType) : read;
16728
17384
  }
16729
17385
  var outputOpenReadsEvent = (open) => !!open && outputOpenInputs(open).some((row) => row.value.kind === "event");
@@ -16949,7 +17605,19 @@ function generateSearchFeed(storeKey, feed, properties, shapes, functions = {},
16949
17605
  if (!title) return { block: "", needsSearch: false };
16950
17606
  const item = "item";
16951
17607
  const index = "index";
16952
- const read = (path) => `${item}.${path.join(".")}`;
17608
+ const read = (path) => {
17609
+ let current = property.dataType;
17610
+ let out = item;
17611
+ for (const name3 of path) {
17612
+ const shape = current?.type === "shape" ? shapes[current.shapeId] : void 0;
17613
+ const key2 = shape?.keys.find(
17614
+ (entry2) => entry2.name === name3
17615
+ );
17616
+ out += key2 ? memberAccess(shape, key2) : `.${name3}`;
17617
+ current = key2?.dataType;
17618
+ }
17619
+ return out;
17620
+ };
16953
17621
  const collection = `store.${property.name}() ?? []`;
16954
17622
  const optional = (path) => path ? resolveSearchFeedMember(path, property.dataType, shapes) : void 0;
16955
17623
  const id = optional(feed.id);
@@ -17002,8 +17670,8 @@ var isTimerComplete = (timer) => timerError(timer) === void 0;
17002
17670
  // libs/codegen/src/lib/timer-codegen.ts
17003
17671
  var ms = (seconds) => `${Math.round(seconds * 1e3)}`;
17004
17672
  var indentBy = (block2, steps) => {
17005
- const pad = " ".repeat(steps * 2);
17006
- return block2.split("\n").map((line) => line.trim() ? `${pad}${line}` : line).join("\n");
17673
+ const pad2 = " ".repeat(steps * 2);
17674
+ return block2.split("\n").map((line) => line.trim() ? `${pad2}${line}` : line).join("\n");
17007
17675
  };
17008
17676
  function endStatements(timer, properties, writeCall) {
17009
17677
  const seen = /* @__PURE__ */ new Set();
@@ -17024,7 +17692,7 @@ function endStatements(timer, properties, writeCall) {
17024
17692
  }
17025
17693
  return statements;
17026
17694
  }
17027
- function timerBlock(timer, properties, shapes, roots, mint, writeCall) {
17695
+ function timerBlock(timer, properties, shapes, roots, mint, writeCall, functions) {
17028
17696
  const oneShot = timer.kind === "timeout";
17029
17697
  const schedule = oneShot ? "setTimeout" : "setInterval";
17030
17698
  const cancel = oneShot ? "clearTimeout" : "clearInterval";
@@ -17037,7 +17705,9 @@ function timerBlock(timer, properties, shapes, roots, mint, writeCall) {
17037
17705
  roots,
17038
17706
  shapes,
17039
17707
  true,
17040
- "store."
17708
+ "store.",
17709
+ "",
17710
+ functions
17041
17711
  );
17042
17712
  const durationProperty = timer.duration?.kind === "state" ? properties[timer.duration.propertyId] : void 0;
17043
17713
  const durationLocal = durationProperty ? mint(`${timer.name}Seconds`) : "";
@@ -17097,15 +17767,21 @@ ${scheduled.map((line) => indentBy(line, 5)).join("\n")}
17097
17767
  });
17098
17768
  });`;
17099
17769
  }
17100
- function generateTimers(timers, properties, shapes, roots, mint, writeCall) {
17770
+ function generateTimers(timers, properties, shapes, roots, mint, writeCall, functions = {}) {
17101
17771
  const drawn = Object.values(timers).filter(isTimerComplete).sort((a, b) => a.name.localeCompare(b.name));
17102
17772
  const blocks = drawn.map(
17103
- (timer) => timerBlock(timer, properties, shapes, roots, mint, writeCall)
17773
+ (timer) => timerBlock(timer, properties, shapes, roots, mint, writeCall, functions)
17104
17774
  ).filter(Boolean);
17105
17775
  return {
17106
17776
  blocks,
17107
17777
  needsUntracked: blocks.length > 0,
17108
- globalStores: ruleGlobalStores(drawn.map((timer) => timer.rule))
17778
+ globalStores: ruleGlobalStores(drawn.map((timer) => timer.rule)),
17779
+ functions: ruleFunctionImports(
17780
+ drawn.map((timer) => timer.rule),
17781
+ roots,
17782
+ shapes,
17783
+ functions
17784
+ )
17109
17785
  };
17110
17786
  }
17111
17787
 
@@ -17345,7 +18021,8 @@ function generateStoreHook(featureName, hook, properties, shapes, methods, opera
17345
18021
  shapes,
17346
18022
  timerTaken,
17347
18023
  casts
17348
- )
18024
+ ),
18025
+ functions
17349
18026
  );
17350
18027
  const body = [
17351
18028
  ...effects,
@@ -17364,7 +18041,8 @@ function generateStoreHook(featureName, hook, properties, shapes, methods, opera
17364
18041
  needsFeed: false,
17365
18042
  needsUntracked: false,
17366
18043
  shapeTypes: [],
17367
- globalStores: []
18044
+ globalStores: [],
18045
+ ruleFunctions: []
17368
18046
  };
17369
18047
  }
17370
18048
  const callsRead = (hook?.calls ?? []).some(
@@ -17408,7 +18086,8 @@ ${storageLine}${searchLine}${searchStoreLine}${globalStoreLines}${body.join("\n"
17408
18086
  // A StoreHookRead's cast and a `storage` call-arg row's are both the hook
17409
18087
  // naming an interface the api half may never mention (ADR 0060).
17410
18088
  shapeTypes: namedShapes(shapes, [...reads.typed, ...casts]),
17411
- globalStores: timerEmission.globalStores
18089
+ globalStores: timerEmission.globalStores,
18090
+ ruleFunctions: timerEmission.functions
17412
18091
  };
17413
18092
  }
17414
18093
  var usesStorage = (properties) => heldProperties(properties).length > 0;
@@ -17672,8 +18351,8 @@ function validateScreenEmits(outputs, rows, payload, fieldNames, inputs, constan
17672
18351
  }
17673
18352
  return void 0;
17674
18353
  }
17675
- var IDENTIFIER5 = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
17676
- var memberAccess6 = (segment) => IDENTIFIER5.test(segment) ? `.${segment}` : `['${segment}']`;
18354
+ var IDENTIFIER6 = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
18355
+ var memberAccess7 = (segment) => IDENTIFIER6.test(segment) ? `.${segment}` : `['${segment}']`;
17677
18356
  var valueExpression4 = (value, output, payload, inputs, constants, eventRoot, self, eventMember, bindings) => {
17678
18357
  if (value.kind === "binding") {
17679
18358
  if (bindings?.scope?.memberPrefix && value.binding.root.kind === "alias") {
@@ -17695,7 +18374,7 @@ var valueExpression4 = (value, output, payload, inputs, constants, eventRoot, se
17695
18374
  return input ? `${self}${input.name}()` : void 0;
17696
18375
  }
17697
18376
  if (payload !== "record" || !value.path?.length) return eventRoot;
17698
- const read = `$event${value.path.map(memberAccess6).join("")}`;
18377
+ const read = `$event${value.path.map(memberAccess7).join("")}`;
17699
18378
  return eventMember && output.payload ? eventMember(
17700
18379
  value.path,
17701
18380
  read,
@@ -17893,12 +18572,23 @@ function toSectionTableColumns(value) {
17893
18572
  if (DATA_TYPES.includes(raw["dataType"])) {
17894
18573
  column.dataType = raw["dataType"];
17895
18574
  }
18575
+ if (raw["defaultSort"] === true) column.defaultSort = true;
18576
+ if (raw["ascending"] === true) column.ascending = true;
17896
18577
  if (raw["freeze"] === true) column.freeze = true;
17897
18578
  if (raw["squeeze"] === true) column.squeeze = true;
17898
18579
  return column;
17899
18580
  });
17900
18581
  }
17901
- var columnNeedsId = (column) => !!column.sortable && !column.id;
18582
+ var columnNeedsId = (column) => (!!column.sortable || !!column.defaultSort) && !column.id;
18583
+ var putSectionTableColumn = (columns, index, column) => {
18584
+ const next = index >= columns.length ? [...columns, column] : columns.map((current, i) => i === index ? column : current);
18585
+ if (!column.defaultSort) return next;
18586
+ return next.map((current, i) => {
18587
+ if (i === index || !current.defaultSort) return current;
18588
+ const { defaultSort: _defaultSort, ascending: _ascending, ...rest } = current;
18589
+ return rest;
18590
+ });
18591
+ };
17902
18592
  var enclosingSectionTable = (control, controlMap) => {
17903
18593
  const seen = /* @__PURE__ */ new Set();
17904
18594
  let current = control?.parentId ? controlMap[control.parentId] : void 0;
@@ -17943,7 +18633,7 @@ function syncSectionTableCells(controlMap, tableId, change, genId2) {
17943
18633
  const next = { ...controlMap };
17944
18634
  sectionTableRows(tableId, controlMap).forEach((row) => {
17945
18635
  const cells = [...row.childrens];
17946
- const pad = (length) => {
18636
+ const pad2 = (length) => {
17947
18637
  while (cells.length < length) {
17948
18638
  const id = genId2();
17949
18639
  next[id] = newCell(id, row.id);
@@ -17951,7 +18641,7 @@ function syncSectionTableCells(controlMap, tableId, change, genId2) {
17951
18641
  }
17952
18642
  };
17953
18643
  if (change.kind === "add") {
17954
- pad(change.index);
18644
+ pad2(change.index);
17955
18645
  const id = genId2();
17956
18646
  next[id] = newCell(id, row.id);
17957
18647
  cells.splice(change.index, 0, id);
@@ -17963,7 +18653,7 @@ function syncSectionTableCells(controlMap, tableId, change, genId2) {
17963
18653
  );
17964
18654
  }
17965
18655
  } else {
17966
- pad(Math.max(change.from, change.to) + 1);
18656
+ pad2(Math.max(change.from, change.to) + 1);
17967
18657
  const [moved] = cells.splice(change.from, 1);
17968
18658
  cells.splice(change.to, 0, moved);
17969
18659
  }
@@ -18029,52 +18719,6 @@ var collectSearchEmits = (tree, controlMap, screenRef) => {
18029
18719
  return [...emits.values()];
18030
18720
  };
18031
18721
 
18032
- // libs/codegen/src/lib/plugin-control-helper.ts
18033
- var PLUGIN_LINK_KEY = "link";
18034
- var PLUGIN_SCREEN_KEY = "screen";
18035
- var PLUGIN_INPUTS_KEY = "pluginInputs";
18036
- var PLUGIN_OUTPUTS_KEY = "pluginOutputs";
18037
- var PLUGIN_SOURCE_KEY = "source";
18038
- var PLUGIN_PORT_KEY = "port";
18039
- var pluginSourceOf = (configs) => {
18040
- const source = configs?.[PLUGIN_SOURCE_KEY];
18041
- return source === "local" || source === "beta" ? source : "published";
18042
- };
18043
- var pluginPortOf = (configs) => {
18044
- const port = Number(configs?.[PLUGIN_PORT_KEY]);
18045
- return Number.isInteger(port) && port > 0 && port < 65536 ? port : void 0;
18046
- };
18047
- var pluginOriginKey = (configs) => {
18048
- const link = String(configs?.[PLUGIN_LINK_KEY] ?? "").trim();
18049
- const source = pluginSourceOf(configs);
18050
- return source === "local" ? `${link}|local|${pluginPortOf(configs) ?? ""}` : `${link}|${source}`;
18051
- };
18052
- var IDENTIFIER6 = /^[A-Za-z_$][\w$]*$/;
18053
- var pluginNamesOf = (configs, key2) => [
18054
- ...new Set(
18055
- String(configs?.[key2] ?? "").split(/[\s,]+/).map((name3) => name3.trim()).filter((name3) => IDENTIFIER6.test(name3))
18056
- )
18057
- ];
18058
- var pluginInputSlot = (name3) => `plugin:${name3}`;
18059
- var pluginPickWrites = (before, picked, contractOf) => {
18060
- const after = { ...before, ...picked };
18061
- const originChanged = pluginOriginKey(after) !== pluginOriginKey(before);
18062
- if (originChanged) {
18063
- return {
18064
- [PLUGIN_SCREEN_KEY]: void 0,
18065
- [PLUGIN_INPUTS_KEY]: void 0,
18066
- [PLUGIN_OUTPUTS_KEY]: void 0
18067
- };
18068
- }
18069
- if (!(PLUGIN_SCREEN_KEY in picked)) return {};
18070
- const screen = String(picked[PLUGIN_SCREEN_KEY] ?? "").trim();
18071
- const contract = screen ? contractOf(after, screen) : void 0;
18072
- return {
18073
- [PLUGIN_INPUTS_KEY]: contract?.inputs.length ? contract.inputs.join(", ") : void 0,
18074
- [PLUGIN_OUTPUTS_KEY]: contract?.outputs.length ? contract.outputs.join(", ") : void 0
18075
- };
18076
- };
18077
-
18078
18722
  // libs/codegen/src/lib/message-params-codegen.ts
18079
18723
  var messageParamEntries = (node, control, scope) => {
18080
18724
  if (!takesMessageParams(node.type)) return [];
@@ -19139,7 +19783,7 @@ function screenVariantsBlock(variants, inputs, computeds, constants, variables,
19139
19783
  );
19140
19784
  const roots = { ...stateRoots, ...screenRoots2 };
19141
19785
  const variantList = Object.values(variants);
19142
- if (!variantList.length) return "";
19786
+ if (!variantList.length) return { body: "", functions: [] };
19143
19787
  const entries = variantList.map(
19144
19788
  (variant) => variant.navId !== void 0 ? ` ${variant.name}: ${NAV_REF_MEMBER}?.isNavActive?.('${variant.navId}') ?? false` : ` ${variant.name}: ${generateRuleExpression(
19145
19789
  variant.rule,
@@ -19148,14 +19792,23 @@ function screenVariantsBlock(variants, inputs, computeds, constants, variables,
19148
19792
  true,
19149
19793
  (id) => screenRoots2[id] ? constants[id] ? { prefix: "", isSignal: false } : { prefix: "this.", isSignal: true } : `this.${storeProp}.`,
19150
19794
  // A RuleCall asks the root store this class injects (usesAuth).
19151
- "this."
19795
+ "this.",
19796
+ functions
19152
19797
  )}`
19153
19798
  );
19154
- return `
19799
+ return {
19800
+ body: `
19155
19801
  protected readonly variant = computed(() => ({
19156
19802
  ${entries.join(",\n")}
19157
19803
  }));
19158
- `;
19804
+ `,
19805
+ functions: ruleFunctionImports(
19806
+ variantList.filter((variant) => variant.navId === void 0).map((variant) => variant.rule),
19807
+ roots,
19808
+ shapes,
19809
+ functions
19810
+ )
19811
+ };
19159
19812
  }
19160
19813
  function screenVariantGuard(node, variants) {
19161
19814
  const held = (node.variants ?? []).map((entry2) => {
@@ -19687,11 +20340,11 @@ var numberOnlyKeysOf = (type) => {
19687
20340
  if (type === "section_filter" /* SECTION_FILTER */) return FILTER_NUMBER_ONLY_KEYS;
19688
20341
  return NUMBER_ONLY_KEYS;
19689
20342
  };
19690
- function wrapInGuard(markup, guard, pad) {
20343
+ function wrapInGuard(markup, guard, pad2) {
19691
20344
  if (!guard) return markup;
19692
- return `${pad}@if (${guard}) {
20345
+ return `${pad2}@if (${guard}) {
19693
20346
  ${markup}
19694
- ${pad}}`;
20347
+ ${pad2}}`;
19695
20348
  }
19696
20349
  function orderedTreeArms(node) {
19697
20350
  const arms = node.childrens.filter(
@@ -19725,29 +20378,29 @@ function renderBranch(node, indent2, names, methods, operationOf, storeProp, ctx
19725
20378
  )
19726
20379
  ).filter(Boolean).join("\n");
19727
20380
  if (chain.length === 1 && !chain[0].guard) return body(chain[0].arm, indent2);
19728
- const pad = " ".repeat(indent2);
20381
+ const pad2 = " ".repeat(indent2);
19729
20382
  const lines = [];
19730
20383
  chain.forEach((entry2, index) => {
19731
20384
  lines.push(
19732
- index === 0 ? `${pad}@if (${entry2.guard}) {` : entry2.guard ? `${pad}} @else if (${entry2.guard}) {` : `${pad}} @else {`
20385
+ index === 0 ? `${pad2}@if (${entry2.guard}) {` : entry2.guard ? `${pad2}} @else if (${entry2.guard}) {` : `${pad2}} @else {`
19733
20386
  );
19734
20387
  const inner = body(entry2.arm, indent2 + 1);
19735
20388
  if (inner) lines.push(inner);
19736
20389
  });
19737
- lines.push(`${pad}}`);
20390
+ lines.push(`${pad2}}`);
19738
20391
  return lines.join("\n");
19739
20392
  }
19740
20393
  function renderRepeat(node, indent2, names, methods, operationOf, storeProp, ctx, wires, payloads) {
19741
- const pad = " ".repeat(indent2);
20394
+ const pad2 = " ".repeat(indent2);
19742
20395
  const control = ctx.controlMap?.[node.id];
19743
20396
  if (!control) {
19744
- return `${pad}<!-- repeat ${node.id}: control is gone; not emitted -->`;
20397
+ return `${pad2}<!-- repeat ${node.id}: control is gone; not emitted -->`;
19745
20398
  }
19746
20399
  const scope = bindingScope(ctx, storeProp);
19747
20400
  const header = repeatHeader(control, scope);
19748
20401
  if (!header) {
19749
20402
  const reason = repeatGapReason(control, scope) ?? "cannot emit here";
19750
- return `${pad}<!-- repeat ${node.id}: ${reason}; not emitted -->`;
20403
+ return `${pad2}<!-- repeat ${node.id}: ${reason}; not emitted -->`;
19751
20404
  }
19752
20405
  const body = (children, at) => children.map(
19753
20406
  (child) => renderNode(
@@ -19773,22 +20426,25 @@ function renderRepeat(node, indent2, names, methods, operationOf, storeProp, ctx
19773
20426
  / of \((.*) \?\? \[\]\); track /,
19774
20427
  (_, expr) => ` of ((${expr}) | sectionTableSort: ${sectionTableRef(table.id)}.sort()); track `
19775
20428
  ) : header;
19776
- const lines = [`${pad}@for (${sorted}) {`];
20429
+ const lines = [`${pad2}@for (${sorted}) {`];
20430
+ for (const line of repeatEntryLets(control, scope)) {
20431
+ lines.push(`${pad2} ${line}`);
20432
+ }
19777
20433
  const inner = body(rows, indent2 + 1);
19778
20434
  if (inner) lines.push(inner);
19779
20435
  if (empty) {
19780
20436
  const emptyInner = body(empty.childrens, indent2 + 1);
19781
- lines.push(`${pad}} @empty {`);
20437
+ lines.push(`${pad2}} @empty {`);
19782
20438
  if (emptyInner) lines.push(emptyInner);
19783
20439
  }
19784
- lines.push(`${pad}}`);
20440
+ lines.push(`${pad2}}`);
19785
20441
  return lines.join("\n");
19786
20442
  }
19787
20443
  function renderContent(node, indent2, names, methods, operationOf, storeProp, ctx, wires, payloads) {
19788
20444
  const host = ctx.controlMap?.[ctx.controlMap?.[node.id]?.parentId ?? ""];
19789
20445
  const slot = contentSlotOf(host);
19790
20446
  if (!slot) return "";
19791
- const pad = " ".repeat(indent2);
20447
+ const pad2 = " ".repeat(indent2);
19792
20448
  const childIndent = slot.kind === "projected" ? indent2 : indent2 + 1;
19793
20449
  const children = node.childrens.map(
19794
20450
  (child) => renderNode(
@@ -19805,17 +20461,17 @@ function renderContent(node, indent2, names, methods, operationOf, storeProp, ct
19805
20461
  ).filter(Boolean).join("\n");
19806
20462
  if (slot.kind === "projected") {
19807
20463
  if (host?.type === "user" /* USER */ && node.configs?.["type"] === "inline") {
19808
- return `${pad}<span inline>
20464
+ return `${pad2}<span inline>
19809
20465
  ${children}
19810
- ${pad}</span>`;
20466
+ ${pad2}</span>`;
19811
20467
  }
19812
20468
  return children;
19813
20469
  }
19814
20470
  const open = contentTemplateTag(host);
19815
20471
  if (!open) return "";
19816
- return children ? `${pad}${open}
20472
+ return children ? `${pad2}${open}
19817
20473
  ${children}
19818
- ${pad}</ng-template>` : `${pad}${open}</ng-template>`;
20474
+ ${pad2}</ng-template>` : `${pad2}${open}</ng-template>`;
19819
20475
  }
19820
20476
  var SLOT_ATTR = {
19821
20477
  ["stat_value" /* STAT_VALUE */]: "value",
@@ -19823,7 +20479,7 @@ var SLOT_ATTR = {
19823
20479
  ["section_header_label" /* SECTION_HEADER_LABEL */]: "label"
19824
20480
  };
19825
20481
  function renderSlot(node, indent2, names, methods, operationOf, storeProp, ctx, wires, payloads) {
19826
- const pad = " ".repeat(indent2);
20482
+ const pad2 = " ".repeat(indent2);
19827
20483
  const attr = SLOT_ATTR[node.type];
19828
20484
  const directives = directiveAttrs(
19829
20485
  node,
@@ -19845,9 +20501,9 @@ function renderSlot(node, indent2, names, methods, operationOf, storeProp, ctx,
19845
20501
  )
19846
20502
  ).filter(Boolean).join("\n");
19847
20503
  if (!children) return "";
19848
- return `${pad}<span ${attr}${directives}>
20504
+ return `${pad2}<span ${attr}${directives}>
19849
20505
  ${children}
19850
- ${pad}</span>`;
20506
+ ${pad2}</span>`;
19851
20507
  }
19852
20508
  function renderNode(node, indent2, names, methods, operationOf, storeProp, ctx, wires, payloads) {
19853
20509
  if (node.type === "variant_branch" /* VARIANT_BRANCH */) {
@@ -19934,6 +20590,9 @@ var attrBindingSlots = (type) => {
19934
20590
  if (type === "remote" /* REMOTE */) return REMOTE_VALUE_SLOTS;
19935
20591
  if (type === "app_logo" /* APP_LOGO */) return APP_LOGO_VALUE_SLOTS;
19936
20592
  if (type === "section_pagination" /* SECTION_PAGINATION */) return [BINDING_SLOT.total];
20593
+ if (type === "heat_swatch" /* HEAT_SWATCH */) return [BINDING_SLOT.value];
20594
+ if (type === "section_chart_series" /* SECTION_CHART_SERIES */)
20595
+ return [BINDING_SLOT.data, BINDING_SLOT.label];
19937
20596
  return hasTextSource(type) ? [BINDING_SLOT.label] : [];
19938
20597
  };
19939
20598
  var OPTION_ROW_MISS_TEXT = {
@@ -19953,7 +20612,7 @@ var optionsGapReason = (binding, ctx, storeProp) => {
19953
20612
  );
19954
20613
  return miss ? OPTION_ROW_MISS_TEXT[miss] ?? "cannot emit here" : void 0;
19955
20614
  };
19956
- function bindingGapComments(node, ctx, storeProp, pad) {
20615
+ function bindingGapComments(node, ctx, storeProp, pad2) {
19957
20616
  const bindings = ctx.controlMap?.[node.id]?.bindings;
19958
20617
  if (!bindings) return "";
19959
20618
  const slots = attrBindingSlots(node.type);
@@ -19963,7 +20622,7 @@ function bindingGapComments(node, ctx, storeProp, pad) {
19963
20622
  const binding = bindings[slot];
19964
20623
  if (!binding) return "";
19965
20624
  const reason = slot === BINDING_SLOT.options && node.type !== "context_menu" /* CONTEXT_MENU */ ? optionsGapReason(binding, ctx, storeProp) : bindingGapReason(binding, scope);
19966
- return reason ? `${pad}<!-- ${slot} ${node.id}: ${reason}; not emitted -->
20625
+ return reason ? `${pad2}<!-- ${slot} ${node.id}: ${reason}; not emitted -->
19967
20626
  ` : "";
19968
20627
  }).join("");
19969
20628
  }
@@ -20125,13 +20784,15 @@ function boundAttrs(node, ctx, storeProp) {
20125
20784
  const expr = emission === "piped" ? bindingExpression(binding, scope) : emission === "raw" ? textBindingExpression(binding, scope, translated) : void 0;
20126
20785
  const piped = expr && emission === "piped" ? withBindingFallback(formatPipeExpression(chain, expr, scope), binding) : expr;
20127
20786
  if (piped) {
20128
- parts.push(` [label]="${piped}"${translated ? "" : " noTranslate"}`);
20787
+ parts.push(
20788
+ ` [label]="${piped}"${translated ? "" : ' [noTranslate]="true"'}`
20789
+ );
20129
20790
  }
20130
20791
  } else if (hasTextSource(node.type) && chain.length) {
20131
20792
  const source = staticLabelSource(chain, node.configs?.[BINDING_SLOT.label]);
20132
20793
  if (source) {
20133
20794
  parts.push(
20134
- ` [label]="${formatPipeExpression(chain, source, scope)}" noTranslate`
20795
+ ` [label]="${formatPipeExpression(chain, source, scope)}" [noTranslate]="true"`
20135
20796
  );
20136
20797
  }
20137
20798
  }
@@ -20146,6 +20807,14 @@ function boundAttrs(node, ctx, storeProp) {
20146
20807
  }
20147
20808
  const total = paginationTotalRead(node, ctx, storeProp);
20148
20809
  if (total) parts.push(` [total]="${total.read}"`);
20810
+ if (node.type === "heat_swatch" /* HEAT_SWATCH */ && bindings?.[BINDING_SLOT.value]) {
20811
+ const expr = bindingExpression(bindings[BINDING_SLOT.value], scope);
20812
+ if (expr) parts.push(` [value]="${expr}"`);
20813
+ }
20814
+ if (node.type === "section_chart_series" /* SECTION_CHART_SERIES */ && bindings?.[BINDING_SLOT.data]) {
20815
+ const expr = bindingExpression(bindings[BINDING_SLOT.data], scope);
20816
+ if (expr) parts.push(` [data]="${expr}"`);
20817
+ }
20149
20818
  if (node.type === "section_filter" /* SECTION_FILTER */ && bindings?.[BINDING_SLOT.options]) {
20150
20819
  const expr = optionBindingExpression(
20151
20820
  bindings[BINDING_SLOT.options],
@@ -20308,6 +20977,11 @@ function tagAttrs(node, ctx, storeProp) {
20308
20977
  delete configs2["link"];
20309
20978
  return `${inlineAttrs({ ...node, configs: configs2 })}${boundAttrs(node, ctx, storeProp)}`;
20310
20979
  }
20980
+ if (node.type === "heat_swatch" /* HEAT_SWATCH */ && ctx.controlMap?.[node.id]?.bindings?.[BINDING_SLOT.value]) {
20981
+ const configs2 = { ...node.configs ?? {} };
20982
+ delete configs2[BINDING_SLOT.value];
20983
+ return `${inlineAttrs({ ...node, configs: configs2 })}${boundAttrs(node, ctx, storeProp)}`;
20984
+ }
20311
20985
  if (node.type === "section_filter" /* SECTION_FILTER */) {
20312
20986
  const bindings = ctx.controlMap?.[node.id]?.bindings;
20313
20987
  const configs2 = { ...node.configs ?? {} };
@@ -20796,7 +21470,7 @@ function payloadAttr(node, payloads) {
20796
21470
  return prop && !prop.modeled ? ` [data]="${prop.name}!"` : "";
20797
21471
  }
20798
21472
  function renderTag(node, indent2, names, methods, operationOf, storeProp, ctx, wires, payloads) {
20799
- const pad = " ".repeat(indent2);
21473
+ const pad2 = " ".repeat(indent2);
20800
21474
  if (node.type === "screen" /* SCREEN */) {
20801
21475
  const guardScope = bindingScope(ctx, storeProp);
20802
21476
  const guards = screenControlInputGuards(
@@ -20818,11 +21492,11 @@ function renderTag(node, indent2, names, methods, operationOf, storeProp, ctx, w
20818
21492
  const inputAliases = new Map(
20819
21493
  guards.map((guard) => [guard.expression, guard.alias])
20820
21494
  );
20821
- const pad2 = " ".repeat(indent2 + guards.length);
21495
+ const pad3 = " ".repeat(indent2 + guards.length);
20822
21496
  const ref = embeddedRefOf(node, ctx);
20823
21497
  if (!ref) {
20824
21498
  const name3 = node.handRef ?? node.screenId ?? "an embedded Screen";
20825
- return `${pad2}<!-- ${name3}: referenced Screen has gone; not emitted -->`;
21499
+ return `${pad3}<!-- ${name3}: referenced Screen has gone; not emitted -->`;
20826
21500
  }
20827
21501
  const bound = screenControlAttrs(
20828
21502
  node,
@@ -20885,7 +21559,7 @@ function renderTag(node, indent2, names, methods, operationOf, storeProp, ctx, w
20885
21559
  (binding) => bindingExpression(binding, scope),
20886
21560
  (binding) => bindingGapReason(binding, scope) ?? "cannot emit here"
20887
21561
  );
20888
- return `${pad2}<!-- ${name3}: ${reason ?? "required input is unbound"}; not emitted -->`;
21562
+ return `${pad3}<!-- ${name3}: ${reason ?? "required input is unbound"}; not emitted -->`;
20889
21563
  }
20890
21564
  const maxWidth = toCssLength(node.maxWidth);
20891
21565
  const style = maxWidth ? ` style="max-width: ${maxWidth}"` : "";
@@ -20893,7 +21567,7 @@ function renderTag(node, indent2, names, methods, operationOf, storeProp, ctx, w
20893
21567
  const spacing = STYLE_DIRECTIVE_NAMES.map(
20894
21568
  (name3) => styleDirectiveAttrs(name3, filterConfigs(node.directives?.[name3]?.configs))
20895
21569
  ).join("");
20896
- const tag2 = `${pad2}<${ref.tag}${bound}${style}${spacing} />`;
21570
+ const tag2 = `${pad3}<${ref.tag}${bound}${style}${spacing} />`;
20897
21571
  return guards.reduceRight(
20898
21572
  (markup, guard, index) => `${" ".repeat(indent2 + index)}@if (${guard.expression}; as ${guard.alias}) {
20899
21573
  ${markup}
@@ -20908,7 +21582,7 @@ ${" ".repeat(indent2 + index)}}`,
20908
21582
  if (node.type === "plugin" /* PLUGIN */) {
20909
21583
  return renderPluginTag(
20910
21584
  node,
20911
- pad,
21585
+ pad2,
20912
21586
  tag,
20913
21587
  methods,
20914
21588
  operationOf,
@@ -20923,22 +21597,22 @@ ${" ".repeat(indent2 + index)}}`,
20923
21597
  ctx.controlMap?.[node.id]?.bindings
20924
21598
  )}${outputAttrs(node, methods, operationOf, storeProp, ctx)}`;
20925
21599
  if (node.type === "section_action" /* SECTION_ACTION */) {
20926
- return `${pad}<${tag}${attrs}${actionButtonsAttr(node, ctx.actionButtonNames)} />`;
21600
+ return `${pad2}<${tag}${attrs}${actionButtonsAttr(node, ctx.actionButtonNames)} />`;
20927
21601
  }
20928
21602
  const totalGuard = paginationTotalRead(node, ctx, storeProp)?.guard;
20929
21603
  if (totalGuard) {
20930
- return `${pad}@if (${totalGuard}; as ${PAGINATION_TOTAL_ALIAS}) {
20931
- ${pad} <${tag}${attrs} />
20932
- ${pad}}`;
21604
+ return `${pad2}@if (${totalGuard}; as ${PAGINATION_TOTAL_ALIAS}) {
21605
+ ${pad2} <${tag}${attrs} />
21606
+ ${pad2}}`;
20933
21607
  }
20934
21608
  const element = tag.split(" ")[0];
20935
- const close = (inner) => element === tag ? `${pad}<${tag}${attrs}>
21609
+ const close = (inner) => element === tag ? `${pad2}<${tag}${attrs}>
20936
21610
  ${inner}
20937
- ${pad}</${tag}>` : inner ? `${pad}<${tag}${attrs}>
21611
+ ${pad2}</${tag}>` : inner ? `${pad2}<${tag}${attrs}>
20938
21612
  ${inner}
20939
- ${pad}</${element}>` : `${pad}<${tag}${attrs}></${element}>`;
21613
+ ${pad2}</${element}>` : `${pad2}<${tag}${attrs}></${element}>`;
20940
21614
  if (!node.childrens.length) {
20941
- return element === tag ? `${pad}<${tag}${attrs} />` : close("");
21615
+ return element === tag ? `${pad2}<${tag}${attrs} />` : close("");
20942
21616
  }
20943
21617
  const children = node.childrens.map(
20944
21618
  (child) => renderNode(
@@ -20954,23 +21628,20 @@ ${pad}</${element}>` : `${pad}<${tag}${attrs}></${element}>`;
20954
21628
  )
20955
21629
  ).filter(Boolean).join("\n");
20956
21630
  if (!children)
20957
- return element === tag ? `${pad}<${tag}${attrs} />` : close("");
21631
+ return element === tag ? `${pad2}<${tag}${attrs} />` : close("");
20958
21632
  return close(children);
20959
21633
  }
20960
- var pluginFacts = (tree, ctx) => {
21634
+ var pluginFacts = (tree) => {
20961
21635
  const facts = [];
20962
21636
  const walk = (nodes) => nodes.forEach((node) => {
20963
21637
  if (node.type === "plugin" /* PLUGIN */) {
20964
21638
  const link = String(node.configs?.[PLUGIN_LINK_KEY] ?? "").trim();
20965
21639
  const screen = String(node.configs?.[PLUGIN_SCREEN_KEY] ?? "").trim();
20966
- const bindings = ctx.controlMap?.[node.id]?.bindings ?? {};
20967
21640
  if (link && screen) {
20968
21641
  facts.push({
20969
21642
  link,
20970
21643
  screen,
20971
- inputs: pluginNamesOf(node.configs, PLUGIN_INPUTS_KEY).filter(
20972
- (name3) => !!bindings[pluginInputSlot(name3)]
20973
- ),
21644
+ inputs: pluginNamesOf(node.configs, PLUGIN_INPUTS_KEY),
20974
21645
  outputs: pluginNamesOf(node.configs, PLUGIN_OUTPUTS_KEY)
20975
21646
  });
20976
21647
  }
@@ -20981,23 +21652,21 @@ var pluginFacts = (tree, ctx) => {
20981
21652
  return facts;
20982
21653
  };
20983
21654
  var OUTPUT_ATTR = / \(([^)]+)\)="([^"]*)"/g;
20984
- function renderPluginTag(node, pad, tag, methods, operationOf, storeProp, ctx) {
21655
+ function renderPluginTag(node, pad2, tag, methods, operationOf, storeProp, ctx) {
20985
21656
  const attrs = `${tagAttrs(node, ctx, storeProp)}${directiveAttrs(
20986
21657
  node,
20987
21658
  ctx.overlayNames,
20988
21659
  bindingScope(ctx, storeProp),
20989
21660
  ctx.controlMap?.[node.id]?.bindings
20990
21661
  )}`;
20991
- const inner = `${pad} `;
21662
+ const inner = `${pad2} `;
20992
21663
  const bindings = ctx.controlMap?.[node.id]?.bindings;
20993
21664
  const scope = bindingScope(ctx, storeProp);
20994
- const inputs = pluginNamesOf(node.configs, PLUGIN_INPUTS_KEY).flatMap(
20995
- (name3) => {
20996
- const binding = bindings?.[pluginInputSlot(name3)];
20997
- const expr = binding ? bindingExpression(binding, scope) : void 0;
20998
- return expr ? [`${inner}<m-plugin-input name="${name3}" [value]="${expr}" />`] : [];
20999
- }
21000
- );
21665
+ const inputs = pluginNamesOf(node.configs, PLUGIN_INPUTS_KEY).map((name3) => {
21666
+ const binding = bindings?.[pluginInputSlot(name3)];
21667
+ const expr = binding ? bindingExpression(binding, scope) : void 0;
21668
+ return expr ? `${inner}<m-plugin-input name="${name3}" [value]="${expr}" />` : `${inner}<m-plugin-input name="${name3}" />`;
21669
+ });
21001
21670
  const outputs = [
21002
21671
  ...outputAttrs(node, methods, operationOf, storeProp, ctx).matchAll(
21003
21672
  OUTPUT_ATTR
@@ -21008,9 +21677,9 @@ function renderPluginTag(node, pad, tag, methods, operationOf, storeProp, ctx) {
21008
21677
  if (inputs.length) ctx.writtenTags.add("m-plugin-input");
21009
21678
  if (outputs.length) ctx.writtenTags.add("m-plugin-output");
21010
21679
  const children = [...inputs, ...outputs];
21011
- return children.length ? `${pad}<${tag}${attrs}>
21680
+ return children.length ? `${pad2}<${tag}${attrs}>
21012
21681
  ${children.join("\n")}
21013
- ${pad}</${tag}>` : `${pad}<${tag}${attrs} />`;
21682
+ ${pad2}</${tag}>` : `${pad2}<${tag}${attrs} />`;
21014
21683
  }
21015
21684
  function planScreenEmit(tree, variants = {}, featureName = "feature", ctx = {}) {
21016
21685
  const writtenTags = /* @__PURE__ */ new Set();
@@ -21327,7 +21996,7 @@ var formModelDeclsBlock = (models, scope) => {
21327
21996
  for (const [index, id] of member.entries()) {
21328
21997
  const key2 = current?.keys.find((entry2) => entry2.id === id);
21329
21998
  if (!key2) return void 0;
21330
- read = `${read}?.${key2.name}`;
21999
+ read = `${read}${memberAccess(current, key2, true)}`;
21331
22000
  if (index === member.length - 1) break;
21332
22001
  current = key2.dataType.type === "shape" ? scope.shapes[key2.dataType.shapeId] : void 0;
21333
22002
  }
@@ -22470,7 +23139,10 @@ function armCheckExpr(check, node, ctx, storeProp, payload, eventRoot) {
22470
23139
  shapes: ctx.shapes ?? {},
22471
23140
  constants: ctx.constants ?? {},
22472
23141
  scope: "class",
22473
- storeReceiver: () => storeProp ? `this.${storeProp}` : "store"
23142
+ storeReceiver: () => storeProp ? `this.${storeProp}` : "store",
23143
+ // A binding read may be an optional input, `undefined` until set, and
23144
+ // every comparison below coerces what a `?.` lets through.
23145
+ optionalPipe: true
22474
23146
  }) : subject;
22475
23147
  const piped = needsParens(read) ? `(${read})` : read;
22476
23148
  const raw = (check.value ?? "").trim();
@@ -22502,10 +23174,22 @@ function emittableArms(node, output, ctx, storeProp) {
22502
23174
  if (!offersOutputArms(control)) return [];
22503
23175
  const payload = payloadShape(output, node.type, node.configs);
22504
23176
  const eventRoot = payloadEventRoot(output, node.type, node.configs);
22505
- return scannedOutputArms(control, output).filter(isOutputArmComplete).map((arm) => ({
22506
- arm,
22507
- expr: armExpr(arm, node, ctx, storeProp, payload, eventRoot)
22508
- })).filter((entry2) => !!entry2.expr);
23177
+ const emitted = [];
23178
+ let pendingBreak = false;
23179
+ for (const arm of scannedOutputArms(control, output)) {
23180
+ const expr = isOutputArmComplete(arm) ? armExpr(arm, node, ctx, storeProp, payload, eventRoot) : "";
23181
+ if (!expr) {
23182
+ pendingBreak ||= !!arm.startsChain;
23183
+ continue;
23184
+ }
23185
+ emitted.push({
23186
+ arm,
23187
+ expr,
23188
+ opensChain: !emitted.length || pendingBreak || !!arm.startsChain
23189
+ });
23190
+ pendingBreak = false;
23191
+ }
23192
+ return emitted;
22509
23193
  }
22510
23194
  function emittingArms(node, output, ctx, storeProp) {
22511
23195
  const control = node;
@@ -22638,12 +23322,16 @@ ${format(
22638
23322
  );
22639
23323
  const direct = format(groupOf(output), " ");
22640
23324
  const always = alwaysOutputArms(control, output).map((arm) => bodyOf(arm, " ")).filter(Boolean);
22641
- const chain = wired.map(({ arm, expr }) => {
23325
+ const chains = [];
23326
+ wired.forEach(({ arm, expr, opensChain }) => {
22642
23327
  const body2 = bodyOf(arm, " ");
22643
- return `if (${expr}) {
23328
+ const block2 = `if (${expr}) {
22644
23329
  ${body2 ? `${body2}
22645
23330
  ` : ""} }`;
23331
+ if (opensChain) chains.push([block2]);
23332
+ else chains[chains.length - 1].push(block2);
22646
23333
  });
23334
+ const chain = chains[chains.length - 1] ?? [];
22647
23335
  const fallback = defaultOutputArm(control, output);
22648
23336
  if (fallback) {
22649
23337
  const body2 = bodyOf(fallback, chain.length ? " " : " ");
@@ -22676,7 +23364,7 @@ ${body2 ? `${body2}
22676
23364
  ...pressed,
22677
23365
  direct,
22678
23366
  ...always,
22679
- ...chain.length ? [chain.join(" else ")] : []
23367
+ ...chains.map((blocks) => blocks.join(" else "))
22680
23368
  ].filter(Boolean).join("\n");
22681
23369
  emitted.push(`
22682
23370
  protected readonly ${outputArmHandlerName(
@@ -23110,6 +23798,9 @@ function collectComponentImportEntries(tree, ctx = {}) {
23110
23798
  entries.push({ component: "TranslatePipe", from: ONE_IMPORT_MODULE });
23111
23799
  }
23112
23800
  if (node.type === "section_action" /* SECTION_ACTION */) return;
23801
+ if (node.type === "repeat" /* REPEAT */ && ctx.controlMap?.[node.id] && isKeyedRepeat(ctx.controlMap[node.id], bindingScope(ctx, ""))) {
23802
+ entries.push({ component: "KeyValuePipe", from: "@angular/common" });
23803
+ }
23113
23804
  if (node.type === "section_table" /* SECTION_TABLE */ && ctx.controlMap && tableHasRepeat(node.id, ctx.controlMap)) {
23114
23805
  entries.push({
23115
23806
  component: "SectionTableSortPipe",
@@ -23298,7 +23989,9 @@ function generateFeatureStore(featureName, properties, variants = {}, shapes = {
23298
23989
  true,
23299
23990
  // A Rule sits on the FeatureStore and may read a SubStore's property,
23300
23991
  // which is what makes the main store hold that SubStore (ADR 0093).
23301
- readsAcross ? rootReceiver : ""
23992
+ readsAcross ? rootReceiver : "",
23993
+ "",
23994
+ functions
23302
23995
  );
23303
23996
  return { name: variant.name, expr, local: mintVariantLocal(variant.name) };
23304
23997
  });
@@ -23441,7 +24134,14 @@ ${lines.join("\n")}
23441
24134
  const storageImport = oneImports.length ? `import { ${oneImports.join(", ")} } from '@magmonium/one';
23442
24135
  ` : "";
23443
24136
  const functionImports = Array.from(
23444
- Object.values(computeds).map((computed) => functions[computed.functionId]).concat((drawn.functionIds ?? []).map((id) => functions[id])).concat(hooks.feedFunctionId ? [functions[hooks.feedFunctionId]] : []).filter((fn) => !!fn).reduce(
24137
+ Object.values(computeds).map((computed) => functions[computed.functionId]).concat((drawn.functionIds ?? []).map((id) => functions[id])).concat(hooks.feedFunctionId ? [functions[hooks.feedFunctionId]] : []).concat(
24138
+ ruleFunctionImports(
24139
+ variantList.map((variant) => variant.rule),
24140
+ rootProperties,
24141
+ shapes,
24142
+ functions
24143
+ )
24144
+ ).concat(hooks.ruleFunctions).filter((fn) => !!fn).reduce(
23445
24145
  (byName, fn) => byName.has(fn.name) ? byName : byName.set(fn.name, fn),
23446
24146
  /* @__PURE__ */ new Map()
23447
24147
  ).values()
@@ -24062,7 +24762,7 @@ ${tables.map(
24062
24762
  needsStore ? featureStoreProp(featureName) : "",
24063
24763
  menuVariants
24064
24764
  );
24065
- const screenVariantsBody = screenVariantsBlock(
24765
+ const { body: screenVariantsBody, functions: variantFunctions } = screenVariantsBlock(
24066
24766
  screenVariants,
24067
24767
  ctx.inputs ?? {},
24068
24768
  screenComputeds,
@@ -24145,6 +24845,7 @@ ${tables.map(
24145
24845
  const fn = (ctx.functions ?? {})[id];
24146
24846
  if (fn) screenFunctions.set(fn.name, fn);
24147
24847
  }
24848
+ for (const fn of variantFunctions) screenFunctions.set(fn.name, fn);
24148
24849
  for (const handler of Object.values(ctx.screenMethods ?? {})) {
24149
24850
  for (const one of screenMethodCalls(handler)) {
24150
24851
  const fn = (ctx.functions ?? {})[one.functionId ?? ""];
@@ -24537,7 +25238,7 @@ function generateCode(tree, featureName, screenName, properties = {}, variants =
24537
25238
  featureStoreProp(featureName),
24538
25239
  codegenCtx
24539
25240
  ),
24540
- plugins: pluginFacts(tree, codegenCtx),
25241
+ plugins: pluginFacts(tree),
24541
25242
  variables: Object.values(codegenCtx.variables ?? {}).map((variable) => ({
24542
25243
  name: variable.name,
24543
25244
  dataType: { type: variable.dataType },
@@ -24680,7 +25381,7 @@ __export(package_exports, {
24680
25381
  version: () => version
24681
25382
  });
24682
25383
  var name = "@magmonium/one";
24683
- var version = "0.4.51";
25384
+ var version = "0.4.60";
24684
25385
  var description = "Magmonium One \u2014 Angular design-system primitives for mm Apps";
24685
25386
  var author = "magmonium";
24686
25387
  var license = "MIT";
@@ -24748,7 +25449,7 @@ __export(package_exports2, {
24748
25449
  version: () => version2
24749
25450
  });
24750
25451
  var name2 = "@magmonium/cli";
24751
- var version2 = "0.8.18";
25452
+ var version2 = "0.8.19";
24752
25453
  var description2 = "A powerful and extensible asset compilation tool that can be shared across multiple projects";
24753
25454
  var bin = {
24754
25455
  "mag-cli": "bin/cli.js"
@@ -26762,7 +27463,8 @@ function sanitizeShapes(shapes, reachable = {}, owner = "feature") {
26762
27463
  id,
26763
27464
  name: shape.name,
26764
27465
  keys: [],
26765
- ...origin ? { origin } : {}
27466
+ ...origin ? { origin } : {},
27467
+ ...shape.positional === true ? { positional: true } : {}
26766
27468
  };
26767
27469
  }
26768
27470
  for (const [id, value] of Object.entries(shapes)) {
@@ -26879,6 +27581,24 @@ function sanitizeRuleNode(value, depth = 0) {
26879
27581
  navId: typeof node["navId"] === "string" ? node["navId"] : ""
26880
27582
  };
26881
27583
  }
27584
+ if (kind === "function") {
27585
+ const rawArgs = node["args"];
27586
+ const args = {};
27587
+ if (rawArgs && typeof rawArgs === "object" && !Array.isArray(rawArgs)) {
27588
+ for (const [paramId, path] of Object.entries(
27589
+ rawArgs
27590
+ )) {
27591
+ const clean = sanitizePath(path);
27592
+ if (clean.length) args[paramId] = clean;
27593
+ }
27594
+ }
27595
+ return {
27596
+ id,
27597
+ kind: "function",
27598
+ functionId: typeof node["functionId"] === "string" ? node["functionId"] : "",
27599
+ args
27600
+ };
27601
+ }
26882
27602
  if (kind !== "check" && kind !== "test") return void 0;
26883
27603
  const operator = node["operator"];
26884
27604
  const quantifier = node["quantifier"];
@@ -27375,7 +28095,6 @@ function sanitizePureFunctions(value, shapes) {
27375
28095
  cardinality: sanitizeCardinality(param),
27376
28096
  ...param.acceptsUndefined === true ? { acceptsUndefined: true } : {}
27377
28097
  })) : [];
27378
- if (!params.length) continue;
27379
28098
  const body = typeof fn.body === "string" ? fn.body : "";
27380
28099
  const imports = sanitizeFunctionImports(fn.imports);
27381
28100
  const description3 = typeof fn.description === "string" ? fn.description.trim() : "";
@@ -28498,7 +29217,8 @@ function buildDesignSource(ws, operations = drawnOperations(ws)) {
28498
29217
  // be rederived from there — `package.json` cannot say which of its
28499
29218
  // dependencies a User approved (ADR 0083).
28500
29219
  npmAllowlist: ws.npmAllowlist,
28501
- codegen: CLI_PACKAGE_VERSION
29220
+ codegen: CLI_PACKAGE_VERSION,
29221
+ one: ONE_PACKAGE_VERSION
28502
29222
  };
28503
29223
  const files3 = {
28504
29224
  [DESIGN_INDEX_PATH]: json(index),
@@ -29043,7 +29763,7 @@ var navInstanceSourceBindings = (navMap, features, methodArgNamesOf = () => [])
29043
29763
  ];
29044
29764
  });
29045
29765
  };
29046
- var navKeyLiteral = (navId) => /^[A-Za-z_$][\w$]*$/.test(navId) ? navId : `'${navId}'`;
29766
+ var navKeyLiteral = propertyKey;
29047
29767
  var AUTH_STORE_PARAM = "authStore";
29048
29768
  var AUTH_STORE_CLASS = "AuthStore";
29049
29769
  var visibilityLoadArgs = (nav, navMap, methodArgs2, argNames) => argNames.map((name3) => {
@@ -29521,8 +30241,6 @@ var packageJson = (appName, version3, extraDeps = {}) => JSON.stringify(
29521
30241
  start: "ng serve",
29522
30242
  prebuild: "npm run gen:code && npm run assets:compile",
29523
30243
  build: "ng build",
29524
- "prebuild:dev": "npm run gen:code && npm run assets:compile",
29525
- "build:dev": "ng build --configuration dev",
29526
30244
  "prebuild:wc": "npm run gen:code",
29527
30245
  // What CI runs, and what produces the bundle the Store deploys. Not
29528
30246
  // `ng build` — the WC bundle is ngc + esbuild through the CLI, and
@@ -29617,7 +30335,11 @@ var packageJson = (appName, version3, extraDeps = {}) => JSON.stringify(
29617
30335
  // same exact version. `$webpack` is not enough: npm still nests the
29618
30336
  // exact pin from build-angular next to a newer root resolution.
29619
30337
  overrides: {
29620
- webpack: "5.110.3"
30338
+ webpack: "5.110.3",
30339
+ // The latest 22.2 patch changed deep Webpack imports to paths that
30340
+ // do not exist before webpack 5.112. Keep the builder aligned with
30341
+ // this Angular release and the Webpack 5.110 cap above.
30342
+ "@angular-devkit/build-angular": NG_VERSION
29621
30343
  }
29622
30344
  },
29623
30345
  null,
@@ -29674,30 +30396,15 @@ var angularJson = (app) => JSON.stringify(
29674
30396
  maximumError: "40kb"
29675
30397
  }
29676
30398
  ],
29677
- fileReplacements: [
29678
- {
29679
- replace: "src/environments/environment.ts",
29680
- with: "src/environments/environment.prod.ts"
29681
- }
29682
- ],
29683
30399
  outputHashing: "all"
29684
30400
  },
30401
+ // No file replacements: every configuration builds against the
30402
+ // one `environment.ts` (ADR 0194).
29685
30403
  development: {
29686
30404
  optimization: false,
29687
30405
  extractLicenses: false,
29688
30406
  sourceMap: true,
29689
30407
  namedChunks: true
29690
- },
29691
- // `development` / `ng serve` / Run keep `environment.ts` (= active
29692
- // preset). `dev` and `production` swap in the matching preset.
29693
- dev: {
29694
- fileReplacements: [
29695
- {
29696
- replace: "src/environments/environment.ts",
29697
- with: "src/environments/environment.dev.ts"
29698
- }
29699
- ],
29700
- outputHashing: "all"
29701
30408
  }
29702
30409
  },
29703
30410
  defaultConfiguration: "production"
@@ -30246,18 +30953,15 @@ export const appProviders: ApplicationConfig['providers'] = [
30246
30953
  ...navProvidersGenerated,
30247
30954
  ];
30248
30955
  `;
30249
- var DEFAULT_AUTH_URL = {
30250
- normal: DEFAULT_NORMAL_AUTH_URL,
30251
- dev: DEFAULT_DEV_AUTH_URL,
30252
- prod: DEFAULT_PROD_AUTH_URL
30253
- };
30254
- var environmentFile = (hosts, preset, production, comment) => {
30255
- const authUrl = resolvedAuthUrl(hosts.authUrl, DEFAULT_AUTH_URL[preset]);
30256
- const backend = resolvedBackendUrl(hosts.backendUrl);
30956
+ var environmentFile = ({ preset, hosts }) => {
30957
+ const fallback = presetHosts(preset);
30958
+ const authUrl = resolvedAuthUrl(hosts.authUrl, fallback.authUrl);
30959
+ const backend = resolvedBackendUrl(hosts.backendUrl, fallback.backendUrl);
30257
30960
  const socketUrl = hosts.socketUrl.trim();
30258
- return `${comment}
30961
+ return `// The Environment \u2014 what Run, \`ng serve\` and every build use (ADR 0194).
30962
+ // Preset: ${preset}.
30259
30963
  export const environment = {
30260
- production: ${production},
30964
+ production: ${preset === "prod"},
30261
30965
  authUrl: '${authUrl}',
30262
30966
  url: '${backend}',
30263
30967
  socketUrl: '${socketUrl}',
@@ -30477,13 +31181,19 @@ ${setupNode}${generateStep} - name: Build assets and web component
30477
31181
  - name: Read app id and endpoint from the design source
30478
31182
  run: |
30479
31183
  APP_ID=$(jq -r '.appTarget.appId // empty' ${DESIGN_SOURCE_ROOT}/index.json)
30480
- ENDPOINT=$(jq -r '.appTarget.environment.prod.backendUrl // empty' ${DESIGN_SOURCE_ROOT}/index.json)
31184
+ ENDPOINT=$(jq -r '.appTarget.environment.hosts.backendUrl // empty' ${DESIGN_SOURCE_ROOT}/index.json)
30481
31185
  ENDPOINT="\${ENDPOINT%/}"
30482
31186
  ENDPOINT="\${ENDPOINT%/swagger.json}"
30483
31187
  if [ -z "$APP_ID" ] || [ -z "$ENDPOINT" ]; then
30484
- echo "::error::${DESIGN_SOURCE_ROOT}/index.json names no appTarget.appId or prod backendUrl. Link the app to its Store App in One UI and Push."
31188
+ echo "::error::${DESIGN_SOURCE_ROOT}/index.json names no appTarget.appId or Environment backendUrl. Link the app to its Store App in One UI and Push."
30485
31189
  exit 1
30486
31190
  fi
31191
+ case "$ENDPOINT" in
31192
+ *://localhost*|*://127.0.0.1*|*://0.0.0.0*)
31193
+ echo "::error::The Environment's Backend URL is $ENDPOINT, which a runner cannot reach. Pick dev or prod in One UI's Environment panel and Push."
31194
+ exit 1
31195
+ ;;
31196
+ esac
30487
31197
  echo "MAG_APP_ID=$APP_ID" >> "$GITHUB_ENV"
30488
31198
  echo "MAG_ENDPOINT=$ENDPOINT" >> "$GITHUB_ENV"
30489
31199
  - name: Upload bundle to backend
@@ -30815,30 +31525,7 @@ function scaffoldFiles(appName, config, environment, extraDeps = {}, plugins = [
30815
31525
  { path: "src/styles.sass", contents: stylesSass(selector) },
30816
31526
  {
30817
31527
  path: "src/environments/environment.ts",
30818
- contents: environmentFile(
30819
- environment.normal,
30820
- "normal",
30821
- false,
30822
- `// Normal Environment \u2014 what \`ng serve\` / Run boots (ADR 0033).`
30823
- )
30824
- },
30825
- {
30826
- path: "src/environments/environment.dev.ts",
30827
- contents: environmentFile(
30828
- environment.dev,
30829
- "dev",
30830
- false,
30831
- `// Swapped in by \`ng build --configuration dev\`.`
30832
- )
30833
- },
30834
- {
30835
- path: "src/environments/environment.prod.ts",
30836
- contents: environmentFile(
30837
- environment.prod,
30838
- "prod",
30839
- true,
30840
- `// Swapped in by \`ng build --configuration production\`.`
30841
- )
31528
+ contents: environmentFile(environment)
30842
31529
  },
30843
31530
  ...isPlugin ? [
30844
31531
  { path: "src/app/wc.ts", contents: pluginWcTs(className, selector) },
@@ -30926,14 +31613,19 @@ var fakeOne = (dataType, shapes, depth) => {
30926
31613
  return "null";
30927
31614
  }
30928
31615
  };
30929
- var fakeShape = (shape, shapes, depth) => shape.keys.length ? `{ ${shape.keys.map(
30930
- (member) => `${key(member.name)}: ${fakeLiteral(
30931
- member.dataType,
30932
- member.cardinality,
30933
- shapes,
30934
- depth
30935
- )}`
30936
- ).join(", ")} }` : "{}";
31616
+ var fakeShape = (shape, shapes, depth) => (
31617
+ // A positional shape is a tuple on the wire, so its fake is too (ADR 0196).
31618
+ shape.positional ? `[${shape.keys.map(
31619
+ (member) => fakeLiteral(member.dataType, member.cardinality, shapes, depth)
31620
+ ).join(", ")}]` : shape.keys.length ? `{ ${shape.keys.map(
31621
+ (member) => `${key(member.name)}: ${fakeLiteral(
31622
+ member.dataType,
31623
+ member.cardinality,
31624
+ shapes,
31625
+ depth
31626
+ )}`
31627
+ ).join(", ")} }` : "{}"
31628
+ );
30937
31629
  var withShapes = (shapes, extra = []) => {
30938
31630
  const list = Array.isArray(extra) ? extra : Object.values(extra);
30939
31631
  return list.length ? {
@@ -32501,14 +33193,17 @@ var emitShippedShellFiles = (authored) => {
32501
33193
  ).filter((file) => SHIPPED_SHELL_PATHS.includes(file.path)).map((file) => ({ path: file.path, contents: file.contents }));
32502
33194
  };
32503
33195
  var isRemoteManifestPath = (path) => /^mag_assets(_env\/[^/]+)?\/remote\/[^/]+\.yml$/.test(path);
32504
- var remoteManifestFiles = (ws) => scaffoldFiles(
33196
+ var ENVIRONMENT_PATH = "src/environments/environment.ts";
33197
+ var syncedScaffoldFiles = (ws) => scaffoldFiles(
32505
33198
  ws.appTarget.appName,
32506
33199
  ws.wcConfig,
32507
33200
  ws.appTarget.environment,
32508
33201
  {},
32509
33202
  pluginContractsOf(ws),
32510
33203
  scaffoldShellOf(ws)
32511
- ).filter((file) => isRemoteManifestPath(file.path)).map((file) => ({ path: file.path, contents: file.contents }));
33204
+ ).filter(
33205
+ (file) => isRemoteManifestPath(file.path) || file.path === ENVIRONMENT_PATH
33206
+ ).map((file) => ({ path: file.path, contents: file.contents }));
32512
33207
  var emitOverlayFiles = (authored, stringify) => {
32513
33208
  const ws = inReach(authored);
32514
33209
  const files3 = emitScreenCode(ws, stringify);
@@ -32527,7 +33222,7 @@ var emitOverlayFiles = (authored, stringify) => {
32527
33222
  });
32528
33223
  }
32529
33224
  files3.push(...emitAuthoredAssets(ws, stringify));
32530
- files3.push(...remoteManifestFiles(ws));
33225
+ files3.push(...syncedScaffoldFiles(ws));
32531
33226
  return withGeneratedBanner(withEmittedTests(files3, isGeneratedPath));
32532
33227
  };
32533
33228
  var emitGeneratedFiles = (authored, stringify, tests = false) => emitOverlayFiles(authored, stringify).filter(
@@ -32554,6 +33249,56 @@ var filesToTree = (files3) => {
32554
33249
  return root;
32555
33250
  };
32556
33251
 
33252
+ // libs/codegen/src/lib/function-starter.ts
33253
+ var STARTER_GROUP = "date-time";
33254
+ var FUNCTION_LIBRARY_GROUPS = [
33255
+ STARTER_GROUP,
33256
+ ...JS_NATIVE_GROUPS
33257
+ ];
33258
+ var pad = "String(value).padStart(2, '0')";
33259
+ var FUNCTION_STARTERS = [
33260
+ {
33261
+ name: "today",
33262
+ label: "function-starter-today",
33263
+ description: "Today's date in local time, as YYYY-MM-DD.",
33264
+ body: [
33265
+ "const date = new Date();",
33266
+ `const two = (value: number): string => ${pad};`,
33267
+ "return `${date.getFullYear()}-${two(date.getMonth() + 1)}-${two(date.getDate())}`;"
33268
+ ].join("\n")
33269
+ },
33270
+ {
33271
+ name: "now",
33272
+ label: "function-starter-now",
33273
+ description: "The current moment as an ISO 8601 timestamp, in UTC.",
33274
+ body: "return new Date().toISOString();"
33275
+ },
33276
+ {
33277
+ name: "currentTime",
33278
+ label: "function-starter-current-time",
33279
+ description: "The current local time, as HH:MM.",
33280
+ body: [
33281
+ "const date = new Date();",
33282
+ `const two = (value: number): string => ${pad};`,
33283
+ "return `${two(date.getHours())}:${two(date.getMinutes())}`;"
33284
+ ].join("\n")
33285
+ },
33286
+ {
33287
+ name: "currentYear",
33288
+ label: "function-starter-current-year",
33289
+ description: "The current year, as four digits.",
33290
+ body: "return String(new Date().getFullYear());"
33291
+ }
33292
+ ];
33293
+ var starterFunction = (starter) => ({
33294
+ name: starter.name,
33295
+ params: [],
33296
+ returnType: { type: "string" },
33297
+ returnCardinality: "one",
33298
+ body: starter.body,
33299
+ description: starter.description
33300
+ });
33301
+
32557
33302
  // libs/codegen/src/model/history.ts
32558
33303
  var HISTORY_DEPTH = 50;
32559
33304
  var EMPTY_HISTORY = { undo: [], redo: [] };
@@ -32696,9 +33441,10 @@ var HISTORY_SELECTION_KEYS = [
32696
33441
  DEFAULT_DEV_SOCKET_URL,
32697
33442
  DEFAULT_INDEX_ALIAS,
32698
33443
  DEFAULT_ITEM_ALIAS,
32699
- DEFAULT_NORMAL_AUTH_URL,
32700
- DEFAULT_NORMAL_BACKEND_URL,
32701
- DEFAULT_NORMAL_SOCKET_URL,
33444
+ DEFAULT_KEY_ALIAS,
33445
+ DEFAULT_LOCAL_AUTH_URL,
33446
+ DEFAULT_LOCAL_BACKEND_URL,
33447
+ DEFAULT_LOCAL_SOCKET_URL,
32702
33448
  DEFAULT_PROD_AUTH_URL,
32703
33449
  DEFAULT_PROD_BACKEND_URL,
32704
33450
  DEFAULT_PROD_SOCKET_URL,
@@ -32754,6 +33500,8 @@ var HISTORY_SELECTION_KEYS = [
32754
33500
  FORMAT_PIPE_LABEL,
32755
33501
  FORMAT_PIPE_NAMES,
32756
33502
  FORM_NAME_CONFIG_KEY,
33503
+ FUNCTION_LIBRARY_GROUPS,
33504
+ FUNCTION_STARTERS,
32757
33505
  GENERATED_SET,
32758
33506
  GLOBAL_METHOD_CATALOG,
32759
33507
  GLOBAL_METHOD_STORES,
@@ -32859,6 +33607,7 @@ var HISTORY_SELECTION_KEYS = [
32859
33607
  PLUGIN_INPUTS_KEY,
32860
33608
  PLUGIN_LINK_KEY,
32861
33609
  PLUGIN_OUTPUTS_KEY,
33610
+ PLUGIN_OUTPUT_SHAPES_KEY,
32862
33611
  PLUGIN_PORT_KEY,
32863
33612
  PLUGIN_SCREEN_KEY,
32864
33613
  PLUGIN_SOURCE_KEY,
@@ -32905,6 +33654,7 @@ var HISTORY_SELECTION_KEYS = [
32905
33654
  SHARED_SHAPE_ID_PREFIX,
32906
33655
  SHIPPED_SHELL_PATHS,
32907
33656
  SOURCE_LANG,
33657
+ STARTER_GROUP,
32908
33658
  STAT_TEXT_SOURCES,
32909
33659
  STORAGE_SERVICE,
32910
33660
  STYLE_DIRECTIVE_FORM,
@@ -32949,6 +33699,7 @@ var HISTORY_SELECTION_KEYS = [
32949
33699
  addMenuGroup,
32950
33700
  addMenuGroupSeeded,
32951
33701
  admitsTextSource,
33702
+ aliasDisplayName,
32952
33703
  aliasHoldersInScope,
32953
33704
  aliasNames,
32954
33705
  aliasSourceSlot,
@@ -32992,6 +33743,7 @@ var HISTORY_SELECTION_KEYS = [
32992
33743
  bindablePaths,
32993
33744
  bindingAlwaysPresent,
32994
33745
  bindingCanvasText,
33746
+ bindingCardinality,
32995
33747
  bindingDataType,
32996
33748
  bindingDisplayText,
32997
33749
  bindingExpression,
@@ -33036,6 +33788,9 @@ var HISTORY_SELECTION_KEYS = [
33036
33788
  callArgumentsExpression,
33037
33789
  callError,
33038
33790
  callStatement,
33791
+ callTargetKey,
33792
+ callTargetName,
33793
+ callTargetOfKey,
33039
33794
  callableMethods,
33040
33795
  canAddChildType,
33041
33796
  canAppendFormatPipe,
@@ -33111,6 +33866,7 @@ var HISTORY_SELECTION_KEYS = [
33111
33866
  comparisonSource,
33112
33867
  componentInputShapeIds,
33113
33868
  componentInputTsType,
33869
+ composeFunctionBinding,
33114
33870
  composeLabelValue,
33115
33871
  computeError,
33116
33872
  computeId,
@@ -33160,6 +33916,7 @@ var HISTORY_SELECTION_KEYS = [
33160
33916
  createCompute,
33161
33917
  createCondition,
33162
33918
  createConfirm,
33919
+ createFunctionLeaf,
33163
33920
  createGroup,
33164
33921
  createOpen,
33165
33922
  createOutputNav,
@@ -33182,14 +33939,11 @@ var HISTORY_SELECTION_KEYS = [
33182
33939
  decodeWorkspace,
33183
33940
  defaultCallArgEvent,
33184
33941
  defaultChildId,
33185
- defaultDevHosts,
33186
33942
  defaultEnvironment,
33187
33943
  defaultLiteralFor,
33188
- defaultNormalHosts,
33189
33944
  defaultOptionValue,
33190
33945
  defaultOutputArm,
33191
33946
  defaultOutputOpenValue,
33192
- defaultProdHosts,
33193
33947
  defaultScreenEmitValue,
33194
33948
  defaultScreenWriteValue,
33195
33949
  defaultStateWriteValue,
@@ -33295,7 +34049,9 @@ var HISTORY_SELECTION_KEYS = [
33295
34049
  firstControlAtLayer,
33296
34050
  fittedCaseArgs,
33297
34051
  fixedAllowed,
34052
+ fixedExpression,
33298
34053
  fixedIsText,
34054
+ fixedItems,
33299
34055
  fnv64,
33300
34056
  foldedButtonName,
33301
34057
  foldedButtons,
@@ -33336,6 +34092,11 @@ var HISTORY_SELECTION_KEYS = [
33336
34092
  formatPipeExpression,
33337
34093
  formatPipeImports,
33338
34094
  formatPipesOf,
34095
+ functionBindingArgs,
34096
+ functionBindingId,
34097
+ functionBindingTarget,
34098
+ functionChipDisplay,
34099
+ functionError,
33339
34100
  functionFileBase,
33340
34101
  functionFilePath,
33341
34102
  functionImportPath,
@@ -33353,6 +34114,7 @@ var HISTORY_SELECTION_KEYS = [
33353
34114
  generateFormInterface,
33354
34115
  generateFormValidation,
33355
34116
  generateFormValidationFile,
34117
+ generateFunctionExpression,
33356
34118
  generateFunctionFile,
33357
34119
  generateHtml,
33358
34120
  generateRuleExpression,
@@ -33466,7 +34228,9 @@ var HISTORY_SELECTION_KEYS = [
33466
34228
  isFunctionInUse,
33467
34229
  isGeneratedPath,
33468
34230
  isHeld,
34231
+ isIdentifier,
33469
34232
  isKeyArg,
34233
+ isKeyedRepeat,
33470
34234
  isKnownVariantId,
33471
34235
  isLegalNavTail,
33472
34236
  isLinkedFormModel,
@@ -33609,8 +34373,11 @@ var HISTORY_SELECTION_KEYS = [
33609
34373
  mappedMethod,
33610
34374
  mappedProperties,
33611
34375
  maxVariants,
34376
+ memberAccess,
33612
34377
  memberIdsOf,
33613
34378
  memberKindOf,
34379
+ memberStep,
34380
+ memberToken,
33614
34381
  menuActionCheckLabel,
33615
34382
  menuActionKey,
33616
34383
  menuActionKeys,
@@ -33713,6 +34480,7 @@ var HISTORY_SELECTION_KEYS = [
33713
34480
  newInstanceFunctionOption,
33714
34481
  newOutputArmCheck,
33715
34482
  newRepeatSpec,
34483
+ newerVersion,
33716
34484
  nextAliasName,
33717
34485
  nextCallArgRow,
33718
34486
  nextFieldName,
@@ -33857,14 +34625,18 @@ var HISTORY_SELECTION_KEYS = [
33857
34625
  pickFolder,
33858
34626
  pickedNavTail,
33859
34627
  planScreenEmit,
34628
+ pluginContractResync,
33860
34629
  pluginContracts,
33861
34630
  pluginInputSlot,
33862
34631
  pluginNamesOf,
33863
34632
  pluginOriginKey,
34633
+ pluginOutputShapeOf,
33864
34634
  pluginPickWrites,
33865
34635
  pluginPortOf,
33866
34636
  pluginSourceOf,
34637
+ presetHosts,
33867
34638
  propertiesWithComputeds,
34639
+ propertyKey,
33868
34640
  pruneFormEventReads,
33869
34641
  pruneMappings,
33870
34642
  pruneMenuActions,
@@ -33879,6 +34651,7 @@ var HISTORY_SELECTION_KEYS = [
33879
34651
  pureFunctionArgs,
33880
34652
  pureFunctionTest,
33881
34653
  pureTarget,
34654
+ putSectionTableColumn,
33882
34655
  quantifierApplies,
33883
34656
  readDesignSource,
33884
34657
  readFileAt,
@@ -33932,6 +34705,7 @@ var HISTORY_SELECTION_KEYS = [
33932
34705
  repairMessageVariables,
33933
34706
  repairSplitShapes,
33934
34707
  repairTranslationMarkup,
34708
+ repeatEntryLets,
33935
34709
  repeatGapReason,
33936
34710
  repeatHeader,
33937
34711
  repeatSpec,
@@ -33967,10 +34741,13 @@ var HISTORY_SELECTION_KEYS = [
33967
34741
  routeTargets,
33968
34742
  routerLinkMode,
33969
34743
  routesNavTail,
34744
+ rowMemberOptions,
33970
34745
  rowsWithOneDefault,
33971
34746
  ruleCalls,
33972
34747
  ruleChecks,
33973
34748
  ruleError,
34749
+ ruleFunctionImports,
34750
+ ruleFunctions,
33974
34751
  ruleGlobalStores,
33975
34752
  ruleNavs,
33976
34753
  ruleReferencedIds,
@@ -34079,6 +34856,7 @@ var HISTORY_SELECTION_KEYS = [
34079
34856
  seededMenuOptions,
34080
34857
  segmentOptions,
34081
34858
  selectableShapes,
34859
+ seriesMemberPicks,
34082
34860
  setArmClosesOverlay,
34083
34861
  setArmDialog,
34084
34862
  setArmNav,
@@ -34086,6 +34864,7 @@ var HISTORY_SELECTION_KEYS = [
34086
34864
  setMenuActionChecks,
34087
34865
  setOutputArmChecks,
34088
34866
  setOutputArmMode,
34867
+ setOutputArmStartsChain,
34089
34868
  setVariantJoin,
34090
34869
  shadowOnPath,
34091
34870
  shadowedShapes,
@@ -34113,6 +34892,7 @@ var HISTORY_SELECTION_KEYS = [
34113
34892
  staleCases,
34114
34893
  staleMenuActionItems,
34115
34894
  standardMenuConfigs,
34895
+ starterFunction,
34116
34896
  stateComputedArgExpression,
34117
34897
  stateComputedArgHeldType,
34118
34898
  stateInterfaceName,
@@ -34189,6 +34969,7 @@ var HISTORY_SELECTION_KEYS = [
34189
34969
  toPascalCase,
34190
34970
  toSectionTableColumns,
34191
34971
  toggleFieldOptionValue,
34972
+ transformBindingLeaves,
34192
34973
  transformGapDetail,
34193
34974
  transformIncomplete,
34194
34975
  transformLabel,