@magmonium/cli 0.8.17 → 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/bin/cli.js +2 -0
- package/bin/commands/assets.js +73 -0
- package/bin/commands/config-ci.js +10 -11
- package/bin/commands/configure-wc.js +14 -11
- package/bin/commands/connect.js +11 -8
- package/bin/commands/deploy.js +38 -7
- package/bin/commands/fix-i18n.js +27 -12
- package/bin/commands/i18n-baseline.js +33 -0
- package/codegen/index.js +1742 -687
- package/package.json +1 -1
- package/src/compilers/logo-compiler.d.ts.map +1 -1
- package/src/compilers/logo-compiler.js +3 -1
- package/src/compilers/logo-compiler.js.map +1 -1
- package/src/compilers/web-component/lib/installed-pins.d.ts +13 -0
- package/src/compilers/web-component/lib/installed-pins.d.ts.map +1 -0
- package/src/compilers/web-component/lib/installed-pins.js +49 -0
- package/src/compilers/web-component/lib/installed-pins.js.map +1 -0
- package/src/compilers/web-component/lib/ng-build.d.ts.map +1 -1
- package/src/compilers/web-component/lib/ng-build.js +5 -0
- package/src/compilers/web-component/lib/ng-build.js.map +1 -1
- package/src/compilers/web-component/lib/web-component-wrapper.d.ts.map +1 -1
- package/src/compilers/web-component/lib/web-component-wrapper.js +62 -48
- package/src/compilers/web-component/lib/web-component-wrapper.js.map +1 -1
- package/src/compilers/web-component/model/type.d.ts +1 -0
- package/src/compilers/web-component/model/type.d.ts.map +1 -1
- package/src/compilers/worker-compiler.d.ts.map +1 -1
- package/src/compilers/worker-compiler.js +9 -2
- package/src/compilers/worker-compiler.js.map +1 -1
- package/src/core/config.d.ts +44 -0
- package/src/core/config.d.ts.map +1 -1
- package/src/core/config.js +34 -1
- package/src/core/config.js.map +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.d.ts.map +1 -1
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/utils/ai-provider-translator.d.ts +10 -5
- package/src/utils/ai-provider-translator.d.ts.map +1 -1
- package/src/utils/ai-provider-translator.js +37 -31
- package/src/utils/ai-provider-translator.js.map +1 -1
- package/src/utils/app-logo-svg.d.ts +4 -3
- package/src/utils/app-logo-svg.d.ts.map +1 -1
- package/src/utils/app-logo-svg.js +30 -4
- package/src/utils/app-logo-svg.js.map +1 -1
- package/src/utils/i18n-fixer.d.ts +2 -3
- package/src/utils/i18n-fixer.d.ts.map +1 -1
- package/src/utils/i18n-fixer.js +24 -56
- package/src/utils/i18n-fixer.js.map +1 -1
- package/src/utils/i18n-gate.d.ts +30 -0
- package/src/utils/i18n-gate.d.ts.map +1 -0
- package/src/utils/i18n-gate.js +76 -0
- package/src/utils/i18n-gate.js.map +1 -0
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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,
|
|
@@ -243,9 +246,11 @@ __export(index_exports, {
|
|
|
243
246
|
PATTERN_MESSAGE_CONFIG_KEY: () => PATTERN_MESSAGE_CONFIG_KEY,
|
|
244
247
|
PATTERN_NAME_MAX_LENGTH: () => PATTERN_NAME_MAX_LENGTH,
|
|
245
248
|
PATTERN_NAME_PATTERN: () => PATTERN_NAME_PATTERN,
|
|
249
|
+
PLUGIN_HARNESS_PATH: () => PLUGIN_HARNESS_PATH,
|
|
246
250
|
PLUGIN_INPUTS_KEY: () => PLUGIN_INPUTS_KEY,
|
|
247
251
|
PLUGIN_LINK_KEY: () => PLUGIN_LINK_KEY,
|
|
248
252
|
PLUGIN_OUTPUTS_KEY: () => PLUGIN_OUTPUTS_KEY,
|
|
253
|
+
PLUGIN_OUTPUT_SHAPES_KEY: () => PLUGIN_OUTPUT_SHAPES_KEY,
|
|
249
254
|
PLUGIN_PORT_KEY: () => PLUGIN_PORT_KEY,
|
|
250
255
|
PLUGIN_SCREEN_KEY: () => PLUGIN_SCREEN_KEY,
|
|
251
256
|
PLUGIN_SOURCE_KEY: () => PLUGIN_SOURCE_KEY,
|
|
@@ -292,6 +297,7 @@ __export(index_exports, {
|
|
|
292
297
|
SHARED_SHAPE_ID_PREFIX: () => SHARED_SHAPE_ID_PREFIX,
|
|
293
298
|
SHIPPED_SHELL_PATHS: () => SHIPPED_SHELL_PATHS,
|
|
294
299
|
SOURCE_LANG: () => SOURCE_LANG,
|
|
300
|
+
STARTER_GROUP: () => STARTER_GROUP,
|
|
295
301
|
STAT_TEXT_SOURCES: () => STAT_TEXT_SOURCES,
|
|
296
302
|
STORAGE_SERVICE: () => STORAGE_SERVICE,
|
|
297
303
|
STYLE_DIRECTIVE_FORM: () => STYLE_DIRECTIVE_FORM,
|
|
@@ -336,6 +342,7 @@ __export(index_exports, {
|
|
|
336
342
|
addMenuGroup: () => addMenuGroup,
|
|
337
343
|
addMenuGroupSeeded: () => addMenuGroupSeeded,
|
|
338
344
|
admitsTextSource: () => admitsTextSource,
|
|
345
|
+
aliasDisplayName: () => aliasDisplayName,
|
|
339
346
|
aliasHoldersInScope: () => aliasHoldersInScope,
|
|
340
347
|
aliasNames: () => aliasNames,
|
|
341
348
|
aliasSourceSlot: () => aliasSourceSlot,
|
|
@@ -373,11 +380,13 @@ __export(index_exports, {
|
|
|
373
380
|
assetRoot: () => assetRoot,
|
|
374
381
|
assignableVariantIds: () => assignableVariantIds,
|
|
375
382
|
authoredArgs: () => authoredArgs,
|
|
383
|
+
authoredAssetPaths: () => authoredAssetPaths,
|
|
376
384
|
backfilledInstanceArgs: () => backfilledInstanceArgs,
|
|
377
385
|
baseOutputName: () => baseOutputName,
|
|
378
386
|
bindablePaths: () => bindablePaths,
|
|
379
387
|
bindingAlwaysPresent: () => bindingAlwaysPresent,
|
|
380
388
|
bindingCanvasText: () => bindingCanvasText,
|
|
389
|
+
bindingCardinality: () => bindingCardinality,
|
|
381
390
|
bindingDataType: () => bindingDataType,
|
|
382
391
|
bindingDisplayText: () => bindingDisplayText,
|
|
383
392
|
bindingExpression: () => bindingExpression,
|
|
@@ -422,6 +431,9 @@ __export(index_exports, {
|
|
|
422
431
|
callArgumentsExpression: () => callArgumentsExpression,
|
|
423
432
|
callError: () => callError,
|
|
424
433
|
callStatement: () => callStatement,
|
|
434
|
+
callTargetKey: () => callTargetKey,
|
|
435
|
+
callTargetName: () => callTargetName,
|
|
436
|
+
callTargetOfKey: () => callTargetOfKey,
|
|
425
437
|
callableMethods: () => callableMethods,
|
|
426
438
|
canAddChildType: () => canAddChildType,
|
|
427
439
|
canAppendFormatPipe: () => canAppendFormatPipe,
|
|
@@ -492,12 +504,17 @@ __export(index_exports, {
|
|
|
492
504
|
collectTranslationAssets: () => collectTranslationAssets,
|
|
493
505
|
collectTypedComponentInputs: () => collectTypedComponentInputs,
|
|
494
506
|
columnNeedsId: () => columnNeedsId,
|
|
507
|
+
compactControlGroups: () => compactControlGroups,
|
|
508
|
+
compactControlMap: () => compactControlMap,
|
|
495
509
|
comparisonSource: () => comparisonSource,
|
|
496
510
|
componentInputShapeIds: () => componentInputShapeIds,
|
|
497
511
|
componentInputTsType: () => componentInputTsType,
|
|
512
|
+
composeFunctionBinding: () => composeFunctionBinding,
|
|
498
513
|
composeLabelValue: () => composeLabelValue,
|
|
499
514
|
computeError: () => computeError,
|
|
500
515
|
computeId: () => computeId,
|
|
516
|
+
computeInputMemberError: () => computeInputMemberError,
|
|
517
|
+
computeInputPaths: () => computeInputPaths,
|
|
501
518
|
computeIsRead: () => computeIsRead,
|
|
502
519
|
computeMemberRead: () => computeMemberRead,
|
|
503
520
|
computeNameTaken: () => computeNameTaken,
|
|
@@ -542,6 +559,7 @@ __export(index_exports, {
|
|
|
542
559
|
createCompute: () => createCompute,
|
|
543
560
|
createCondition: () => createCondition,
|
|
544
561
|
createConfirm: () => createConfirm,
|
|
562
|
+
createFunctionLeaf: () => createFunctionLeaf,
|
|
545
563
|
createGroup: () => createGroup,
|
|
546
564
|
createOpen: () => createOpen,
|
|
547
565
|
createOutputNav: () => createOutputNav,
|
|
@@ -564,14 +582,11 @@ __export(index_exports, {
|
|
|
564
582
|
decodeWorkspace: () => decodeWorkspace,
|
|
565
583
|
defaultCallArgEvent: () => defaultCallArgEvent,
|
|
566
584
|
defaultChildId: () => defaultChildId,
|
|
567
|
-
defaultDevHosts: () => defaultDevHosts,
|
|
568
585
|
defaultEnvironment: () => defaultEnvironment,
|
|
569
586
|
defaultLiteralFor: () => defaultLiteralFor,
|
|
570
|
-
defaultNormalHosts: () => defaultNormalHosts,
|
|
571
587
|
defaultOptionValue: () => defaultOptionValue,
|
|
572
588
|
defaultOutputArm: () => defaultOutputArm,
|
|
573
589
|
defaultOutputOpenValue: () => defaultOutputOpenValue,
|
|
574
|
-
defaultProdHosts: () => defaultProdHosts,
|
|
575
590
|
defaultScreenEmitValue: () => defaultScreenEmitValue,
|
|
576
591
|
defaultScreenWriteValue: () => defaultScreenWriteValue,
|
|
577
592
|
defaultStateWriteValue: () => defaultStateWriteValue,
|
|
@@ -677,7 +692,9 @@ __export(index_exports, {
|
|
|
677
692
|
firstControlAtLayer: () => firstControlAtLayer,
|
|
678
693
|
fittedCaseArgs: () => fittedCaseArgs,
|
|
679
694
|
fixedAllowed: () => fixedAllowed,
|
|
695
|
+
fixedExpression: () => fixedExpression,
|
|
680
696
|
fixedIsText: () => fixedIsText,
|
|
697
|
+
fixedItems: () => fixedItems,
|
|
681
698
|
fnv64: () => fnv64,
|
|
682
699
|
foldedButtonName: () => foldedButtonName,
|
|
683
700
|
foldedButtons: () => foldedButtons,
|
|
@@ -718,6 +735,11 @@ __export(index_exports, {
|
|
|
718
735
|
formatPipeExpression: () => formatPipeExpression,
|
|
719
736
|
formatPipeImports: () => formatPipeImports,
|
|
720
737
|
formatPipesOf: () => formatPipesOf,
|
|
738
|
+
functionBindingArgs: () => functionBindingArgs,
|
|
739
|
+
functionBindingId: () => functionBindingId,
|
|
740
|
+
functionBindingTarget: () => functionBindingTarget,
|
|
741
|
+
functionChipDisplay: () => functionChipDisplay,
|
|
742
|
+
functionError: () => functionError,
|
|
721
743
|
functionFileBase: () => functionFileBase,
|
|
722
744
|
functionFilePath: () => functionFilePath,
|
|
723
745
|
functionImportPath: () => functionImportPath,
|
|
@@ -735,6 +757,7 @@ __export(index_exports, {
|
|
|
735
757
|
generateFormInterface: () => generateFormInterface,
|
|
736
758
|
generateFormValidation: () => generateFormValidation,
|
|
737
759
|
generateFormValidationFile: () => generateFormValidationFile,
|
|
760
|
+
generateFunctionExpression: () => generateFunctionExpression,
|
|
738
761
|
generateFunctionFile: () => generateFunctionFile,
|
|
739
762
|
generateHtml: () => generateHtml,
|
|
740
763
|
generateRuleExpression: () => generateRuleExpression,
|
|
@@ -813,6 +836,7 @@ __export(index_exports, {
|
|
|
813
836
|
isBaseVariantId: () => isBaseVariantId,
|
|
814
837
|
isBindingInScope: () => isBindingInScope,
|
|
815
838
|
isBooleanStateProperty: () => isBooleanStateProperty,
|
|
839
|
+
isBornNamed: () => isBornNamed,
|
|
816
840
|
isBranchFamily: () => isBranchFamily,
|
|
817
841
|
isBusyVariantId: () => isBusyVariantId,
|
|
818
842
|
isCacheMethod: () => isCacheMethod,
|
|
@@ -847,7 +871,9 @@ __export(index_exports, {
|
|
|
847
871
|
isFunctionInUse: () => isFunctionInUse,
|
|
848
872
|
isGeneratedPath: () => isGeneratedPath,
|
|
849
873
|
isHeld: () => isHeld,
|
|
874
|
+
isIdentifier: () => isIdentifier,
|
|
850
875
|
isKeyArg: () => isKeyArg,
|
|
876
|
+
isKeyedRepeat: () => isKeyedRepeat,
|
|
851
877
|
isKnownVariantId: () => isKnownVariantId,
|
|
852
878
|
isLegalNavTail: () => isLegalNavTail,
|
|
853
879
|
isLinkedFormModel: () => isLinkedFormModel,
|
|
@@ -990,8 +1016,11 @@ __export(index_exports, {
|
|
|
990
1016
|
mappedMethod: () => mappedMethod,
|
|
991
1017
|
mappedProperties: () => mappedProperties,
|
|
992
1018
|
maxVariants: () => maxVariants,
|
|
1019
|
+
memberAccess: () => memberAccess,
|
|
993
1020
|
memberIdsOf: () => memberIdsOf,
|
|
994
1021
|
memberKindOf: () => memberKindOf,
|
|
1022
|
+
memberStep: () => memberStep,
|
|
1023
|
+
memberToken: () => memberToken,
|
|
995
1024
|
menuActionCheckLabel: () => menuActionCheckLabel,
|
|
996
1025
|
menuActionKey: () => menuActionKey,
|
|
997
1026
|
menuActionKeys: () => menuActionKeys,
|
|
@@ -1094,6 +1123,7 @@ __export(index_exports, {
|
|
|
1094
1123
|
newInstanceFunctionOption: () => newInstanceFunctionOption,
|
|
1095
1124
|
newOutputArmCheck: () => newOutputArmCheck,
|
|
1096
1125
|
newRepeatSpec: () => newRepeatSpec,
|
|
1126
|
+
newerVersion: () => newerVersion,
|
|
1097
1127
|
nextAliasName: () => nextAliasName,
|
|
1098
1128
|
nextCallArgRow: () => nextCallArgRow,
|
|
1099
1129
|
nextFieldName: () => nextFieldName,
|
|
@@ -1238,17 +1268,22 @@ __export(index_exports, {
|
|
|
1238
1268
|
pickFolder: () => pickFolder,
|
|
1239
1269
|
pickedNavTail: () => pickedNavTail,
|
|
1240
1270
|
planScreenEmit: () => planScreenEmit,
|
|
1271
|
+
pluginContractResync: () => pluginContractResync,
|
|
1241
1272
|
pluginContracts: () => pluginContracts,
|
|
1242
1273
|
pluginInputSlot: () => pluginInputSlot,
|
|
1243
1274
|
pluginNamesOf: () => pluginNamesOf,
|
|
1244
1275
|
pluginOriginKey: () => pluginOriginKey,
|
|
1276
|
+
pluginOutputShapeOf: () => pluginOutputShapeOf,
|
|
1245
1277
|
pluginPickWrites: () => pluginPickWrites,
|
|
1246
1278
|
pluginPortOf: () => pluginPortOf,
|
|
1247
1279
|
pluginSourceOf: () => pluginSourceOf,
|
|
1280
|
+
presetHosts: () => presetHosts,
|
|
1248
1281
|
propertiesWithComputeds: () => propertiesWithComputeds,
|
|
1282
|
+
propertyKey: () => propertyKey,
|
|
1249
1283
|
pruneFormEventReads: () => pruneFormEventReads,
|
|
1250
1284
|
pruneMappings: () => pruneMappings,
|
|
1251
1285
|
pruneMenuActions: () => pruneMenuActions,
|
|
1286
|
+
pruneOrphanMessageBindings: () => pruneOrphanMessageBindings,
|
|
1252
1287
|
pruneOutputCalls: () => pruneOutputCalls,
|
|
1253
1288
|
pruneOutputLinkArgs: () => pruneOutputLinkArgs,
|
|
1254
1289
|
pruneUnknownShapeRefs: () => pruneUnknownShapeRefs,
|
|
@@ -1259,6 +1294,7 @@ __export(index_exports, {
|
|
|
1259
1294
|
pureFunctionArgs: () => pureFunctionArgs,
|
|
1260
1295
|
pureFunctionTest: () => pureFunctionTest,
|
|
1261
1296
|
pureTarget: () => pureTarget,
|
|
1297
|
+
putSectionTableColumn: () => putSectionTableColumn,
|
|
1262
1298
|
quantifierApplies: () => quantifierApplies,
|
|
1263
1299
|
readDesignSource: () => readDesignSource,
|
|
1264
1300
|
readFileAt: () => readFileAt,
|
|
@@ -1312,6 +1348,7 @@ __export(index_exports, {
|
|
|
1312
1348
|
repairMessageVariables: () => repairMessageVariables,
|
|
1313
1349
|
repairSplitShapes: () => repairSplitShapes,
|
|
1314
1350
|
repairTranslationMarkup: () => repairTranslationMarkup,
|
|
1351
|
+
repeatEntryLets: () => repeatEntryLets,
|
|
1315
1352
|
repeatGapReason: () => repeatGapReason,
|
|
1316
1353
|
repeatHeader: () => repeatHeader,
|
|
1317
1354
|
repeatSpec: () => repeatSpec,
|
|
@@ -1347,10 +1384,13 @@ __export(index_exports, {
|
|
|
1347
1384
|
routeTargets: () => routeTargets,
|
|
1348
1385
|
routerLinkMode: () => routerLinkMode,
|
|
1349
1386
|
routesNavTail: () => routesNavTail,
|
|
1387
|
+
rowMemberOptions: () => rowMemberOptions,
|
|
1350
1388
|
rowsWithOneDefault: () => rowsWithOneDefault,
|
|
1351
1389
|
ruleCalls: () => ruleCalls,
|
|
1352
1390
|
ruleChecks: () => ruleChecks,
|
|
1353
1391
|
ruleError: () => ruleError,
|
|
1392
|
+
ruleFunctionImports: () => ruleFunctionImports,
|
|
1393
|
+
ruleFunctions: () => ruleFunctions,
|
|
1354
1394
|
ruleGlobalStores: () => ruleGlobalStores,
|
|
1355
1395
|
ruleNavs: () => ruleNavs,
|
|
1356
1396
|
ruleReferencedIds: () => ruleReferencedIds,
|
|
@@ -1459,6 +1499,7 @@ __export(index_exports, {
|
|
|
1459
1499
|
seededMenuOptions: () => seededMenuOptions,
|
|
1460
1500
|
segmentOptions: () => segmentOptions,
|
|
1461
1501
|
selectableShapes: () => selectableShapes,
|
|
1502
|
+
seriesMemberPicks: () => seriesMemberPicks,
|
|
1462
1503
|
setArmClosesOverlay: () => setArmClosesOverlay,
|
|
1463
1504
|
setArmDialog: () => setArmDialog,
|
|
1464
1505
|
setArmNav: () => setArmNav,
|
|
@@ -1466,6 +1507,7 @@ __export(index_exports, {
|
|
|
1466
1507
|
setMenuActionChecks: () => setMenuActionChecks,
|
|
1467
1508
|
setOutputArmChecks: () => setOutputArmChecks,
|
|
1468
1509
|
setOutputArmMode: () => setOutputArmMode,
|
|
1510
|
+
setOutputArmStartsChain: () => setOutputArmStartsChain,
|
|
1469
1511
|
setVariantJoin: () => setVariantJoin,
|
|
1470
1512
|
shadowOnPath: () => shadowOnPath,
|
|
1471
1513
|
shadowedShapes: () => shadowedShapes,
|
|
@@ -1493,6 +1535,7 @@ __export(index_exports, {
|
|
|
1493
1535
|
staleCases: () => staleCases,
|
|
1494
1536
|
staleMenuActionItems: () => staleMenuActionItems,
|
|
1495
1537
|
standardMenuConfigs: () => standardMenuConfigs,
|
|
1538
|
+
starterFunction: () => starterFunction,
|
|
1496
1539
|
stateComputedArgExpression: () => stateComputedArgExpression,
|
|
1497
1540
|
stateComputedArgHeldType: () => stateComputedArgHeldType,
|
|
1498
1541
|
stateInterfaceName: () => stateInterfaceName,
|
|
@@ -1569,6 +1612,7 @@ __export(index_exports, {
|
|
|
1569
1612
|
toPascalCase: () => toPascalCase,
|
|
1570
1613
|
toSectionTableColumns: () => toSectionTableColumns,
|
|
1571
1614
|
toggleFieldOptionValue: () => toggleFieldOptionValue,
|
|
1615
|
+
transformBindingLeaves: () => transformBindingLeaves,
|
|
1572
1616
|
transformGapDetail: () => transformGapDetail,
|
|
1573
1617
|
transformIncomplete: () => transformIncomplete,
|
|
1574
1618
|
transformLabel: () => transformLabel,
|
|
@@ -1672,6 +1716,8 @@ var ControlType = /* @__PURE__ */ ((ControlType2) => {
|
|
|
1672
1716
|
ControlType2["SECTION_TABLE"] = "section_table";
|
|
1673
1717
|
ControlType2["SECTION_TABLE_ROW"] = "section_table_row";
|
|
1674
1718
|
ControlType2["SECTION_TABLE_CELL"] = "section_table_cell";
|
|
1719
|
+
ControlType2["SECTION_CHART"] = "section_chart";
|
|
1720
|
+
ControlType2["SECTION_CHART_SERIES"] = "section_chart_series";
|
|
1675
1721
|
ControlType2["LIST"] = "list";
|
|
1676
1722
|
ControlType2["SECTION_SEARCH"] = "section_search";
|
|
1677
1723
|
ControlType2["SECTION_ACTION"] = "section_action";
|
|
@@ -1696,6 +1742,7 @@ var ControlType = /* @__PURE__ */ ((ControlType2) => {
|
|
|
1696
1742
|
ControlType2["STAT"] = "stat";
|
|
1697
1743
|
ControlType2["STAT_VALUE"] = "stat_value";
|
|
1698
1744
|
ControlType2["STAT_CORNER"] = "stat_corner";
|
|
1745
|
+
ControlType2["HEAT_SWATCH"] = "heat_swatch";
|
|
1699
1746
|
ControlType2["FORM"] = "form";
|
|
1700
1747
|
ControlType2["FIELD"] = "field";
|
|
1701
1748
|
ControlType2["SECTION_BUTTON_GROUP"] = "section_button_group";
|
|
@@ -1896,16 +1943,23 @@ document \u2014 there is one source and two places it is read.
|
|
|
1896
1943
|
|
|
1897
1944
|
## Configure before your first release
|
|
1898
1945
|
|
|
1899
|
-
Register the app in the Magmonium Store first \u2014 that is what mints its app id
|
|
1946
|
+
Register the app in the Magmonium Store first \u2014 that is what mints its app id \u2014
|
|
1947
|
+
and link it in One UI, so every Push writes that id into \`.magmonium/index.json\`.
|
|
1948
|
+
CD reads the app id from \`appTarget.appId\` there, and the backend from
|
|
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.
|
|
1952
|
+
|
|
1900
1953
|
Your deploy token is your own, not the app's: rotate it once from the Store
|
|
1901
|
-
and reuse it for every app you own or collaborate on.
|
|
1954
|
+
and reuse it for every app you own or collaborate on. It is the one secret, in
|
|
1955
|
+
**Settings \u2192 Secrets and variables \u2192 Actions**:
|
|
1902
1956
|
|
|
1903
1957
|
| Secret | Value |
|
|
1904
1958
|
| --- | --- |
|
|
1905
|
-
| \`MAG_ENDPOINT\` | Base URL of the Magmonium backend, no trailing slash |
|
|
1906
|
-
| \`MAG_APP_ID\` | The Store's id for this app |
|
|
1907
1959
|
| \`MAG_DEPLOY_TOKEN\` | Your personal deploy token |
|
|
1908
1960
|
|
|
1961
|
+
An app made by Extract Plugin has it set for you.
|
|
1962
|
+
|
|
1909
1963
|
## CI
|
|
1910
1964
|
|
|
1911
1965
|
\`.github/workflows/ci.yml\`, on a pull request into \`main\` and nothing else.
|
|
@@ -1921,9 +1975,9 @@ without merging.
|
|
|
1921
1975
|
|
|
1922
1976
|
It deploys **only when that merge changed \`version:\` in
|
|
1923
1977
|
\`mag_assets/remote/<app>.yml\`**. Merging is not a release; bumping the version
|
|
1924
|
-
is.
|
|
1925
|
-
|
|
1926
|
-
|
|
1978
|
+
is. The first merge into \`main\` is a release all the same: \`main\` has no
|
|
1979
|
+
manifest yet, so \`version:\` goes from nothing to \`0.0.1\` and CD deploys it.
|
|
1980
|
+
Register, link and set \`MAG_DEPLOY_TOKEN\` before that merge.
|
|
1927
1981
|
|
|
1928
1982
|
To release:
|
|
1929
1983
|
|
|
@@ -1940,39 +1994,39 @@ The job builds the bundle, \`POST\`s it to \`/store/v1/bundle/<app-id>\`, then
|
|
|
1940
1994
|
|
|
1941
1995
|
// libs/codegen/src/model/app-target.ts
|
|
1942
1996
|
var APP_MODES = ["existing", "new"];
|
|
1943
|
-
var ENVIRONMENT_PRESETS = [
|
|
1944
|
-
"normal",
|
|
1945
|
-
"dev",
|
|
1946
|
-
"prod"
|
|
1947
|
-
];
|
|
1997
|
+
var ENVIRONMENT_PRESETS = ["local", "dev", "prod"];
|
|
1948
1998
|
var DEFAULT_PROD_AUTH_URL = "https://api.magmonium.com";
|
|
1949
1999
|
var DEFAULT_PROD_BACKEND_URL = "https://api.magmonium.com";
|
|
1950
2000
|
var DEFAULT_PROD_SOCKET_URL = "wss://pops.magmonium.com";
|
|
1951
2001
|
var DEFAULT_DEV_AUTH_URL = "https://api-dev.magmonium.com";
|
|
1952
2002
|
var DEFAULT_DEV_BACKEND_URL = "https://api-dev.magmonium.com";
|
|
1953
2003
|
var DEFAULT_DEV_SOCKET_URL = "wss://pops-dev.magmonium.com";
|
|
1954
|
-
var
|
|
1955
|
-
var
|
|
1956
|
-
var
|
|
1957
|
-
var
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
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]
|
|
1971
2026
|
});
|
|
1972
|
-
var defaultEnvironment = (
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
dev: { ...defaultDevHosts(), ...overrides?.dev }
|
|
2027
|
+
var defaultEnvironment = (hosts, preset = "local") => ({
|
|
2028
|
+
preset,
|
|
2029
|
+
hosts: { ...presetHosts(preset), ...hosts }
|
|
1976
2030
|
});
|
|
1977
2031
|
var EMPTY_APP_TARGET = {
|
|
1978
2032
|
// `new` rather than `existing`: an empty AppTarget has no folder to read
|
|
@@ -2535,22 +2589,41 @@ function generateShapeInterface(shapes, shape, options = {}) {
|
|
|
2535
2589
|
).join("\n") : "";
|
|
2536
2590
|
const audienceImport = (options.imports ?? true) && shape.keys.some((key2) => key2.dataType.type === "audience") ? `import type { ${AUDIENCE_TYPE_NAME} } from '${AUDIENCE_TYPE_PACKAGE}';` : "";
|
|
2537
2591
|
const members = shape.keys.map(
|
|
2538
|
-
(key2) => ` ${key2.name}: ${tsTypeExpression(
|
|
2592
|
+
(key2) => ` ${shape.positional ? tupleLabel(key2.name) : propertyKey(key2.name)}: ${tsTypeExpression(
|
|
2539
2593
|
shapes,
|
|
2540
2594
|
key2.dataType,
|
|
2541
2595
|
key2.cardinality
|
|
2542
|
-
)}
|
|
2596
|
+
)}${shape.positional ? "," : ";"}`
|
|
2543
2597
|
).join("\n");
|
|
2544
2598
|
const head = [imports, audienceImport].filter(Boolean).join("\n");
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
)} {
|
|
2599
|
+
const body = shape.positional ? `export type ${shapeInterfaceName(shape.name)} = [
|
|
2600
|
+
${members}
|
|
2601
|
+
];
|
|
2602
|
+
` : `export interface ${shapeInterfaceName(shape.name)} {
|
|
2550
2603
|
${members}
|
|
2551
2604
|
}
|
|
2552
2605
|
`;
|
|
2606
|
+
return `${head ? `${head}
|
|
2607
|
+
|
|
2608
|
+
` : ""}${body}`;
|
|
2553
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}]`;
|
|
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;
|
|
2554
2627
|
function pruneUnknownShapeRefs(holder, shapes) {
|
|
2555
2628
|
const shapeId = shapeIdOf(holder.dataType);
|
|
2556
2629
|
if (!shapeId || shapes[shapeId]) return holder;
|
|
@@ -2561,17 +2634,21 @@ function statePathRead(path, properties, shapes, receiver, guarded) {
|
|
|
2561
2634
|
const property = properties[head];
|
|
2562
2635
|
if (!property) return "undefined";
|
|
2563
2636
|
let dataType = property.dataType;
|
|
2564
|
-
const
|
|
2637
|
+
const accesses = [];
|
|
2565
2638
|
for (const keyId of rest) {
|
|
2566
2639
|
const shape = dataType?.type === "shape" ? shapes[dataType.shapeId] : void 0;
|
|
2567
2640
|
const key2 = shape?.keys.find((k) => k.id === keyId);
|
|
2568
2641
|
if (!key2) return "undefined";
|
|
2569
|
-
|
|
2642
|
+
accesses.push(
|
|
2643
|
+
memberAccess(shape, key2, !accesses.length && !guarded && !!shape?.positional)
|
|
2644
|
+
);
|
|
2570
2645
|
dataType = key2.dataType;
|
|
2571
2646
|
}
|
|
2572
|
-
if (!
|
|
2647
|
+
if (!accesses.length)
|
|
2573
2648
|
return `${receiver}.${property.name}()${guarded ? "!" : ""}`;
|
|
2574
|
-
|
|
2649
|
+
const [first, ...more] = accesses;
|
|
2650
|
+
const lead = first.startsWith("?.") ? first : `${guarded ? "!" : "?"}${first}`;
|
|
2651
|
+
return `${receiver}.${property.name}()${lead}${more.join("")}`;
|
|
2575
2652
|
}
|
|
2576
2653
|
|
|
2577
2654
|
// libs/one/src/lib/shared/enum/assets/form-asset-folder.ts
|
|
@@ -2600,7 +2677,8 @@ var LAYOUT_ASSET_FOLDER = {
|
|
|
2600
2677
|
section_carousel: "section_carousels",
|
|
2601
2678
|
text_output: "text_outputs",
|
|
2602
2679
|
list: "lists",
|
|
2603
|
-
section_table: "section_tables"
|
|
2680
|
+
section_table: "section_tables",
|
|
2681
|
+
section_chart: "section_charts"
|
|
2604
2682
|
};
|
|
2605
2683
|
|
|
2606
2684
|
// libs/one/src/lib/shared/ui/form/model/form-type.ts
|
|
@@ -2946,6 +3024,7 @@ var SHARED_ICONS = [
|
|
|
2946
3024
|
"wallet_shareholder",
|
|
2947
3025
|
"wand",
|
|
2948
3026
|
"wifi",
|
|
3027
|
+
"wrench",
|
|
2949
3028
|
"x",
|
|
2950
3029
|
"zap"
|
|
2951
3030
|
];
|
|
@@ -3107,6 +3186,7 @@ var CONTROL_RELATIONSHIPS = {
|
|
|
3107
3186
|
"section_carousel" /* SECTION_CAROUSEL */,
|
|
3108
3187
|
"list" /* LIST */,
|
|
3109
3188
|
"section_table" /* SECTION_TABLE */,
|
|
3189
|
+
"section_chart" /* SECTION_CHART */,
|
|
3110
3190
|
"row" /* ROW */,
|
|
3111
3191
|
"col" /* COL */,
|
|
3112
3192
|
"flex" /* FLEX */,
|
|
@@ -3189,12 +3269,14 @@ var CONTROL_RELATIONSHIPS = {
|
|
|
3189
3269
|
"plugin" /* PLUGIN */,
|
|
3190
3270
|
"user" /* USER */,
|
|
3191
3271
|
"stat" /* STAT */,
|
|
3272
|
+
"heat_swatch" /* HEAT_SWATCH */,
|
|
3192
3273
|
"flex" /* FLEX */,
|
|
3193
3274
|
"card" /* CARD */,
|
|
3194
3275
|
"chat_bubble" /* CHAT_BUBBLE */,
|
|
3195
3276
|
"section_carousel" /* SECTION_CAROUSEL */,
|
|
3196
3277
|
"list" /* LIST */,
|
|
3197
3278
|
"section_table" /* SECTION_TABLE */,
|
|
3279
|
+
"section_chart" /* SECTION_CHART */,
|
|
3198
3280
|
"section_filter" /* SECTION_FILTER */,
|
|
3199
3281
|
"section_filter_group" /* SECTION_FILTER_GROUP */,
|
|
3200
3282
|
"form" /* FORM */,
|
|
@@ -3229,6 +3311,18 @@ var CONTROL_RELATIONSHIPS = {
|
|
|
3229
3311
|
],
|
|
3230
3312
|
// Cells and nothing else — a `<tr>` holds `<td>`s.
|
|
3231
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 */]: [],
|
|
3232
3326
|
// Anything a Col holds that is content rather than layout: a cell is one
|
|
3233
3327
|
// box of one line, so a Section, a Row or an outlet has no business in it.
|
|
3234
3328
|
["section_table_cell" /* SECTION_TABLE_CELL */]: [
|
|
@@ -3239,6 +3333,7 @@ var CONTROL_RELATIONSHIPS = {
|
|
|
3239
3333
|
"img" /* IMG */,
|
|
3240
3334
|
"user" /* USER */,
|
|
3241
3335
|
"stat" /* STAT */,
|
|
3336
|
+
"heat_swatch" /* HEAT_SWATCH */,
|
|
3242
3337
|
"flex" /* FLEX */,
|
|
3243
3338
|
"card" /* CARD */,
|
|
3244
3339
|
"chat_bubble" /* CHAT_BUBBLE */,
|
|
@@ -3263,12 +3358,14 @@ var CONTROL_RELATIONSHIPS = {
|
|
|
3263
3358
|
"plugin" /* PLUGIN */,
|
|
3264
3359
|
"user" /* USER */,
|
|
3265
3360
|
"stat" /* STAT */,
|
|
3361
|
+
"heat_swatch" /* HEAT_SWATCH */,
|
|
3266
3362
|
"flex" /* FLEX */,
|
|
3267
3363
|
"card" /* CARD */,
|
|
3268
3364
|
"chat_bubble" /* CHAT_BUBBLE */,
|
|
3269
3365
|
"section_carousel" /* SECTION_CAROUSEL */,
|
|
3270
3366
|
"list" /* LIST */,
|
|
3271
3367
|
"section_table" /* SECTION_TABLE */,
|
|
3368
|
+
"section_chart" /* SECTION_CHART */,
|
|
3272
3369
|
"section_filter" /* SECTION_FILTER */,
|
|
3273
3370
|
"section_filter_group" /* SECTION_FILTER_GROUP */,
|
|
3274
3371
|
"form" /* FORM */,
|
|
@@ -3294,12 +3391,14 @@ var CONTROL_RELATIONSHIPS = {
|
|
|
3294
3391
|
"plugin" /* PLUGIN */,
|
|
3295
3392
|
"user" /* USER */,
|
|
3296
3393
|
"stat" /* STAT */,
|
|
3394
|
+
"heat_swatch" /* HEAT_SWATCH */,
|
|
3297
3395
|
"flex" /* FLEX */,
|
|
3298
3396
|
"card" /* CARD */,
|
|
3299
3397
|
"chat_bubble" /* CHAT_BUBBLE */,
|
|
3300
3398
|
"section_carousel" /* SECTION_CAROUSEL */,
|
|
3301
3399
|
"list" /* LIST */,
|
|
3302
3400
|
"section_table" /* SECTION_TABLE */,
|
|
3401
|
+
"section_chart" /* SECTION_CHART */,
|
|
3303
3402
|
"section_filter" /* SECTION_FILTER */,
|
|
3304
3403
|
"section_filter_group" /* SECTION_FILTER_GROUP */,
|
|
3305
3404
|
"form" /* FORM */,
|
|
@@ -3329,11 +3428,13 @@ var CONTROL_RELATIONSHIPS = {
|
|
|
3329
3428
|
"plugin" /* PLUGIN */,
|
|
3330
3429
|
"user" /* USER */,
|
|
3331
3430
|
"stat" /* STAT */,
|
|
3431
|
+
"heat_swatch" /* HEAT_SWATCH */,
|
|
3332
3432
|
"card" /* CARD */,
|
|
3333
3433
|
"chat_bubble" /* CHAT_BUBBLE */,
|
|
3334
3434
|
"section_carousel" /* SECTION_CAROUSEL */,
|
|
3335
3435
|
"list" /* LIST */,
|
|
3336
3436
|
"section_table" /* SECTION_TABLE */,
|
|
3437
|
+
"section_chart" /* SECTION_CHART */,
|
|
3337
3438
|
"section_filter" /* SECTION_FILTER */,
|
|
3338
3439
|
"section_filter_group" /* SECTION_FILTER_GROUP */,
|
|
3339
3440
|
"form" /* FORM */,
|
|
@@ -3360,11 +3461,13 @@ var CONTROL_RELATIONSHIPS = {
|
|
|
3360
3461
|
"plugin" /* PLUGIN */,
|
|
3361
3462
|
"user" /* USER */,
|
|
3362
3463
|
"stat" /* STAT */,
|
|
3464
|
+
"heat_swatch" /* HEAT_SWATCH */,
|
|
3363
3465
|
"card" /* CARD */,
|
|
3364
3466
|
"chat_bubble" /* CHAT_BUBBLE */,
|
|
3365
3467
|
"section_carousel" /* SECTION_CAROUSEL */,
|
|
3366
3468
|
"list" /* LIST */,
|
|
3367
3469
|
"section_table" /* SECTION_TABLE */,
|
|
3470
|
+
"section_chart" /* SECTION_CHART */,
|
|
3368
3471
|
"section_filter" /* SECTION_FILTER */,
|
|
3369
3472
|
"section_filter_group" /* SECTION_FILTER_GROUP */,
|
|
3370
3473
|
"form" /* FORM */,
|
|
@@ -3423,6 +3526,7 @@ var CONTROL_RELATIONSHIPS = {
|
|
|
3423
3526
|
"remote" /* REMOTE */,
|
|
3424
3527
|
"plugin" /* PLUGIN */,
|
|
3425
3528
|
"user" /* USER */,
|
|
3529
|
+
"heat_swatch" /* HEAT_SWATCH */,
|
|
3426
3530
|
"button" /* BUTTON */,
|
|
3427
3531
|
"context_menu" /* CONTEXT_MENU */,
|
|
3428
3532
|
"audience_picker" /* AUDIENCE_PICKER */,
|
|
@@ -3499,6 +3603,9 @@ var CONTROL_RELATIONSHIPS = {
|
|
|
3499
3603
|
// figure is drawn inside it.
|
|
3500
3604
|
["stat_value" /* STAT_VALUE */]: ["flex" /* FLEX */],
|
|
3501
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 */]: [],
|
|
3502
3609
|
// Content like a Logo, but the one content Control that is not a leaf: what
|
|
3503
3610
|
// `m-user` projects beneath the name is a ContentControl, the same single
|
|
3504
3611
|
// child a card Field takes and gated the same way, through `contentSlotOf`.
|
|
@@ -3540,6 +3647,7 @@ var isSectionHeaderSlotFamily = (type) => type === "section_header_label" /* SEC
|
|
|
3540
3647
|
var isSlotFamily = (type) => isStatSlotFamily(type) || isSectionHeaderSlotFamily(type);
|
|
3541
3648
|
var isTaglessFamily = (type) => isBranchFamily(type) || isRepeatFamily(type);
|
|
3542
3649
|
var isBaglessControl = (type) => type === "screen" /* SCREEN */ || type === "section_table_row" /* SECTION_TABLE_ROW */ || type === "section_table_cell" /* SECTION_TABLE_CELL */ || type === "router_outlet" /* ROUTER_OUTLET */ || type === "nav_header" /* NAV_HEADER */ || type === "content" /* CONTENT */ || type === "root" /* ROOT */;
|
|
3650
|
+
var isBornNamed = (type) => !isTaglessFamily(type) && !isSlotFamily(type) && type !== "section_table_row" /* SECTION_TABLE_ROW */ && type !== "section_table_cell" /* SECTION_TABLE_CELL */;
|
|
3543
3651
|
var DEFAULT_ARM_KIND = "branch";
|
|
3544
3652
|
var ARM_KINDS = ["branch", "default"];
|
|
3545
3653
|
var armKind = (control) => control?.armKind ?? DEFAULT_ARM_KIND;
|
|
@@ -3711,6 +3819,8 @@ var OWN_DIRECTIVES = {
|
|
|
3711
3819
|
["section_table" /* SECTION_TABLE */]: [],
|
|
3712
3820
|
["section_table_row" /* SECTION_TABLE_ROW */]: [],
|
|
3713
3821
|
["section_table_cell" /* SECTION_TABLE_CELL */]: [],
|
|
3822
|
+
["section_chart" /* SECTION_CHART */]: [],
|
|
3823
|
+
["section_chart_series" /* SECTION_CHART_SERIES */]: [],
|
|
3714
3824
|
["list" /* LIST */]: ["routerLink"],
|
|
3715
3825
|
["row" /* ROW */]: ["routerLink"],
|
|
3716
3826
|
["col" /* COL */]: ["mModal", "mSidePanel", "routerLink"],
|
|
@@ -3732,6 +3842,7 @@ var OWN_DIRECTIVES = {
|
|
|
3732
3842
|
["stat" /* STAT */]: ["routerLink"],
|
|
3733
3843
|
["stat_value" /* STAT_VALUE */]: ["routerLink"],
|
|
3734
3844
|
["stat_corner" /* STAT_CORNER */]: ["routerLink"],
|
|
3845
|
+
["heat_swatch" /* HEAT_SWATCH */]: ["routerLink"],
|
|
3735
3846
|
["form" /* FORM */]: ["routerLink"],
|
|
3736
3847
|
["field" /* FIELD */]: ["mOptions", "routerLink"],
|
|
3737
3848
|
// Nothing to attach: a ContentControl emits an `ng-template` — where a
|
|
@@ -3776,6 +3887,9 @@ var OWN_DIRECTIVES = {
|
|
|
3776
3887
|
};
|
|
3777
3888
|
var STYLE_REFUSED = /* @__PURE__ */ new Set([
|
|
3778
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 */,
|
|
3779
3893
|
"variant_branch" /* VARIANT_BRANCH */,
|
|
3780
3894
|
"branch_arm" /* BRANCH_ARM */,
|
|
3781
3895
|
"repeat" /* REPEAT */,
|
|
@@ -3868,6 +3982,8 @@ var CONTROL_LABEL = {
|
|
|
3868
3982
|
["section_table" /* SECTION_TABLE */]: "section-table",
|
|
3869
3983
|
["section_table_row" /* SECTION_TABLE_ROW */]: "section-table-row",
|
|
3870
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",
|
|
3871
3987
|
["section_action" /* SECTION_ACTION */]: "section-action",
|
|
3872
3988
|
["section_hero" /* SECTION_HERO */]: "section-hero",
|
|
3873
3989
|
["section_carousel" /* SECTION_CAROUSEL */]: "section-carousel",
|
|
@@ -3894,6 +4010,7 @@ var CONTROL_LABEL = {
|
|
|
3894
4010
|
["stat" /* STAT */]: "stat",
|
|
3895
4011
|
["stat_value" /* STAT_VALUE */]: "stat-value",
|
|
3896
4012
|
["stat_corner" /* STAT_CORNER */]: "stat-corner",
|
|
4013
|
+
["heat_swatch" /* HEAT_SWATCH */]: "heat-swatch",
|
|
3897
4014
|
["nav_header" /* NAV_HEADER */]: "nav-header",
|
|
3898
4015
|
["form" /* FORM */]: "form",
|
|
3899
4016
|
["field" /* FIELD */]: "field",
|
|
@@ -3932,6 +4049,8 @@ var CONTROL_ICON = {
|
|
|
3932
4049
|
["section_table" /* SECTION_TABLE */]: "control_section_table",
|
|
3933
4050
|
["section_table_row" /* SECTION_TABLE_ROW */]: "control_section_table_row",
|
|
3934
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",
|
|
3935
4054
|
["section_action" /* SECTION_ACTION */]: "control_section_action",
|
|
3936
4055
|
["section_hero" /* SECTION_HERO */]: "control_section_hero",
|
|
3937
4056
|
["section_carousel" /* SECTION_CAROUSEL */]: "control_section_carousel",
|
|
@@ -3958,6 +4077,8 @@ var CONTROL_ICON = {
|
|
|
3958
4077
|
["stat" /* STAT */]: "control_stat",
|
|
3959
4078
|
["stat_value" /* STAT_VALUE */]: "control_stat_value",
|
|
3960
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",
|
|
3961
4082
|
["nav_header" /* NAV_HEADER */]: "control_nav_header",
|
|
3962
4083
|
["form" /* FORM */]: "control_form",
|
|
3963
4084
|
["field" /* FIELD */]: "control_field",
|
|
@@ -4102,6 +4223,20 @@ var CONTROL_CODEGEN = {
|
|
|
4102
4223
|
tag: "td m-section-table-cell",
|
|
4103
4224
|
component: "SectionTableCellComponent"
|
|
4104
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
|
+
},
|
|
4105
4240
|
["row" /* ROW */]: {
|
|
4106
4241
|
tag: "m-row",
|
|
4107
4242
|
component: "RowComponent",
|
|
@@ -4199,6 +4334,12 @@ var CONTROL_CODEGEN = {
|
|
|
4199
4334
|
tag: "m-stat",
|
|
4200
4335
|
component: "StatComponent"
|
|
4201
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
|
+
},
|
|
4202
4343
|
// Navigation header with back button and breadcrumb trail.
|
|
4203
4344
|
// Folderless as it uses NavStore internally and takes no config.
|
|
4204
4345
|
["nav_header" /* NAV_HEADER */]: {
|
|
@@ -4590,7 +4731,7 @@ function isValidFunctionName(name3) {
|
|
|
4590
4731
|
return /^[a-z][a-zA-Z0-9]*$/.test(name3);
|
|
4591
4732
|
}
|
|
4592
4733
|
function isPureFunctionComplete(fn) {
|
|
4593
|
-
return isValidFunctionName(fn.name) && fn.
|
|
4734
|
+
return isValidFunctionName(fn.name) && fn.body.trim().length > 0;
|
|
4594
4735
|
}
|
|
4595
4736
|
function functionFileBase(name3) {
|
|
4596
4737
|
return name3.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
@@ -4684,8 +4825,6 @@ var IMPURE_TOKENS = [
|
|
|
4684
4825
|
"inject",
|
|
4685
4826
|
"fetch",
|
|
4686
4827
|
"XMLHttpRequest",
|
|
4687
|
-
"Date.now",
|
|
4688
|
-
"new Date",
|
|
4689
4828
|
"Math.random",
|
|
4690
4829
|
"localStorage",
|
|
4691
4830
|
"sessionStorage",
|
|
@@ -5027,9 +5166,10 @@ function stateComputedArgExpression(arg, roots, shapes, rootPrefix = NO_ROOT_PRE
|
|
|
5027
5166
|
let shapeId = root.dataType.type === "shape" ? root.dataType.shapeId : void 0;
|
|
5028
5167
|
let expression = `${rootPrefix(rootId)}${root.name}()`;
|
|
5029
5168
|
for (const keyId of rest) {
|
|
5030
|
-
const
|
|
5169
|
+
const shape = shapeId ? shapes[shapeId] : void 0;
|
|
5170
|
+
const key2 = shape?.keys.find((k) => k.id === keyId);
|
|
5031
5171
|
if (!key2) return "undefined";
|
|
5032
|
-
expression +=
|
|
5172
|
+
expression += memberAccess(shape, key2, true);
|
|
5033
5173
|
shapeId = key2.dataType.type === "shape" ? key2.dataType.shapeId : void 0;
|
|
5034
5174
|
}
|
|
5035
5175
|
return expression;
|
|
@@ -5826,7 +5966,8 @@ var BINDING_TRANSFORM_LEAVES = [
|
|
|
5826
5966
|
"fixed",
|
|
5827
5967
|
"store",
|
|
5828
5968
|
"const",
|
|
5829
|
-
"input"
|
|
5969
|
+
"input",
|
|
5970
|
+
"binding"
|
|
5830
5971
|
];
|
|
5831
5972
|
|
|
5832
5973
|
// libs/codegen/src/lib/outcome-transform-helper.ts
|
|
@@ -6026,6 +6167,7 @@ var sameType2 = (a, b) => a.type === "shape" && b.type === "shape" ? a.shapeId =
|
|
|
6026
6167
|
var typesMatch = (a, b) => sameType2(a.dataType, b.dataType) && a.cardinality === b.cardinality;
|
|
6027
6168
|
var memberRead = (name3, ctx) => ctx.scope === "class" ? `this.${name3}` : name3;
|
|
6028
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"));
|
|
6029
6171
|
var argOmitted = (arg, param) => !!param?.optional && !!arg && !isCall(arg) && arg.kind === "fixed" && !fixedText(arg).trim();
|
|
6030
6172
|
var fixedText = (arg) => String(arg.value ?? "");
|
|
6031
6173
|
var argOutOfRange = (arg, param) => {
|
|
@@ -6092,7 +6234,7 @@ function inferTransformType(expr, pipeType, surface, functions) {
|
|
|
6092
6234
|
if (expr.args.length !== resolved.params.length) {
|
|
6093
6235
|
return { ok: false, error: "value-transform-arity" };
|
|
6094
6236
|
}
|
|
6095
|
-
if (expr
|
|
6237
|
+
if (!pipeParamValid(expr, resolved.params.length)) {
|
|
6096
6238
|
return { ok: false, error: "value-transform-incomplete" };
|
|
6097
6239
|
}
|
|
6098
6240
|
for (let i = 0; i < expr.args.length; i++) {
|
|
@@ -6133,6 +6275,8 @@ var leafIncomplete = (leaf) => {
|
|
|
6133
6275
|
return leaf.constantId ? void 0 : empty;
|
|
6134
6276
|
case "input":
|
|
6135
6277
|
return leaf.input?.trim() ? void 0 : empty;
|
|
6278
|
+
case "binding":
|
|
6279
|
+
return leaf.binding ? void 0 : empty;
|
|
6136
6280
|
default:
|
|
6137
6281
|
return void 0;
|
|
6138
6282
|
}
|
|
@@ -6163,7 +6307,7 @@ function transformIncomplete(expr, functions, properties, shapes) {
|
|
|
6163
6307
|
if (expr.args.length !== resolved.params.length) {
|
|
6164
6308
|
return "value-transform-arity";
|
|
6165
6309
|
}
|
|
6166
|
-
if (!
|
|
6310
|
+
if (!pipeParamValid(expr, resolved.params.length)) {
|
|
6167
6311
|
return "value-transform-incomplete";
|
|
6168
6312
|
}
|
|
6169
6313
|
for (let i = 0; i < expr.args.length; i++) {
|
|
@@ -6261,7 +6405,7 @@ var parenthesized = (expr) => {
|
|
|
6261
6405
|
var STRING_LITERAL = /^('[^']*'|"[^"]*")$/;
|
|
6262
6406
|
var MEMBER_CHAIN = /^[A-Za-z_$][\w$]*(\??\.[\w$]+|\??\([^()]*\)|\[[^[\]]*\]|!)*$/;
|
|
6263
6407
|
var receiverExpr = (receiver) => MEMBER_CHAIN.test(receiver) || STRING_LITERAL.test(receiver) || parenthesized(receiver) ? receiver : `(${receiver})`;
|
|
6264
|
-
var
|
|
6408
|
+
var memberAccess2 = (receiver) => receiver.includes("?.") ? "?." : ".";
|
|
6265
6409
|
function emitTransformExpr(expr, pipeExpr, ctx, fixedType = { type: "string" }) {
|
|
6266
6410
|
if (!isCall(expr)) {
|
|
6267
6411
|
return emitLeaf(expr, pipeExpr, ctx, fixedType);
|
|
@@ -6281,16 +6425,17 @@ function emitTransformExpr(expr, pipeExpr, ctx, fixedType = { type: "string" })
|
|
|
6281
6425
|
}
|
|
6282
6426
|
const entry2 = resolved.entry;
|
|
6283
6427
|
if (!entry2) return pipeExpr;
|
|
6428
|
+
const access = (receiver) => ctx.optionalPipe && receiver === pipeExpr ? "?." : memberAccess2(receiver);
|
|
6284
6429
|
if (entry2.emit === "method") {
|
|
6285
6430
|
const [receiver, ...rest] = argExprs;
|
|
6286
|
-
return `${receiverExpr(receiver)}${
|
|
6431
|
+
return `${receiverExpr(receiver)}${access(receiver)}${entry2.name}(${rest.join(", ")})`;
|
|
6287
6432
|
}
|
|
6288
6433
|
if (entry2.emit === "static") {
|
|
6289
6434
|
return `${entry2.object ?? "Object"}.${entry2.name}(${argExprs.join(", ")})`;
|
|
6290
6435
|
}
|
|
6291
6436
|
if (entry2.emit === "property") {
|
|
6292
6437
|
const receiver = argExprs[0];
|
|
6293
|
-
return `${receiverExpr(receiver)}${
|
|
6438
|
+
return `${receiverExpr(receiver)}${access(receiver)}${entry2.name}`;
|
|
6294
6439
|
}
|
|
6295
6440
|
return `${entry2.name}(${argExprs.join(", ")})`;
|
|
6296
6441
|
}
|
|
@@ -6327,6 +6472,8 @@ function emitLeaf(leaf, pipeExpr, ctx, fixedType) {
|
|
|
6327
6472
|
if (!leaf.event?.length) return ctx.eventRoot ?? "$event";
|
|
6328
6473
|
return `$event.${leaf.event.join(".")}`;
|
|
6329
6474
|
}
|
|
6475
|
+
case "binding":
|
|
6476
|
+
return leaf.binding && ctx.bindingRead?.(leaf.binding) || "undefined";
|
|
6330
6477
|
}
|
|
6331
6478
|
}
|
|
6332
6479
|
function templateTransformRefs(exprs, functions) {
|
|
@@ -6363,10 +6510,97 @@ function transformStateRootIds(expr) {
|
|
|
6363
6510
|
return;
|
|
6364
6511
|
}
|
|
6365
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
|
+
}
|
|
6366
6517
|
};
|
|
6367
6518
|
walk(expr);
|
|
6368
6519
|
return [...ids];
|
|
6369
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
|
+
}
|
|
6370
6604
|
function unaryCall(target, arity, pipeParam = 0) {
|
|
6371
6605
|
const args = Array.from(
|
|
6372
6606
|
{ length: arity },
|
|
@@ -6480,6 +6714,14 @@ function sanitizeLeaf(leaf) {
|
|
|
6480
6714
|
kind: "event",
|
|
6481
6715
|
...Array.isArray(leaf.event) ? { event: leaf.event } : {}
|
|
6482
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
|
+
}
|
|
6483
6725
|
default:
|
|
6484
6726
|
return void 0;
|
|
6485
6727
|
}
|
|
@@ -6508,7 +6750,8 @@ var BINDING_SLOT = {
|
|
|
6508
6750
|
label: "label",
|
|
6509
6751
|
// A FormControl's `data`. The write half is a StateWrite on `dataChange`
|
|
6510
6752
|
// rather than anything here (ADR 0065). Also a CardControl's collection: the
|
|
6511
|
-
// 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.
|
|
6512
6755
|
data: "data",
|
|
6513
6756
|
// A RepeatControl's collection.
|
|
6514
6757
|
source: "source",
|
|
@@ -6550,7 +6793,11 @@ var BINDING_SLOT = {
|
|
|
6550
6793
|
// author sees those numbers on the Canvas (ADR 0069). What the Filter is
|
|
6551
6794
|
// *disabled* by stays a Rule's job, which is the line these do not cross.
|
|
6552
6795
|
min: "min",
|
|
6553
|
-
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"
|
|
6554
6801
|
};
|
|
6555
6802
|
var USER_VALUE_SLOTS = [
|
|
6556
6803
|
BINDING_SLOT.id,
|
|
@@ -6668,7 +6915,8 @@ var PARAM_CAPABLE_TYPES = [
|
|
|
6668
6915
|
"stat" /* STAT */,
|
|
6669
6916
|
"section_header" /* SECTION_HEADER */,
|
|
6670
6917
|
"button" /* BUTTON */,
|
|
6671
|
-
"field" /* FIELD
|
|
6918
|
+
"field" /* FIELD */,
|
|
6919
|
+
"section_chart_series" /* SECTION_CHART_SERIES */
|
|
6672
6920
|
];
|
|
6673
6921
|
var takesMessageParams = (type) => !!type && PARAM_CAPABLE_TYPES.includes(type);
|
|
6674
6922
|
var messageSlot = (variable) => `var:${variable}`;
|
|
@@ -6684,10 +6932,12 @@ var messageBindings = (control) => {
|
|
|
6684
6932
|
};
|
|
6685
6933
|
var DEFAULT_ITEM_ALIAS = "item";
|
|
6686
6934
|
var DEFAULT_INDEX_ALIAS = "index";
|
|
6935
|
+
var DEFAULT_KEY_ALIAS = "key";
|
|
6687
6936
|
var ALIAS_PATTERN = /^[a-z][a-zA-Z0-9]*$/;
|
|
6688
6937
|
var repeatSpec = (control) => ({
|
|
6689
6938
|
itemAlias: control?.repeat?.itemAlias ?? DEFAULT_ITEM_ALIAS,
|
|
6690
6939
|
indexAlias: control?.repeat?.indexAlias ?? DEFAULT_INDEX_ALIAS,
|
|
6940
|
+
keyAlias: control?.repeat?.keyAlias ?? DEFAULT_KEY_ALIAS,
|
|
6691
6941
|
...control?.repeat?.track ? { track: control.repeat.track } : {},
|
|
6692
6942
|
...control?.repeat?.sampleRows !== void 0 ? { sampleRows: control.repeat.sampleRows } : {}
|
|
6693
6943
|
});
|
|
@@ -6750,16 +7000,26 @@ var aliasNames = (control) => isCardHolder(control) ? {
|
|
|
6750
7000
|
indexAlias: control?.cards?.indexAlias ?? DEFAULT_INDEX_ALIAS
|
|
6751
7001
|
} : {
|
|
6752
7002
|
itemAlias: repeatSpec(control).itemAlias,
|
|
6753
|
-
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 } : {}
|
|
6754
7007
|
};
|
|
6755
7008
|
var aliasSourceSlot = (control) => isCardHolder(control) || control?.type === "list" /* LIST */ ? BINDING_SLOT.data : BINDING_SLOT.source;
|
|
6756
7009
|
var isAliasNameFree = (name3, where, controlMap, which) => {
|
|
6757
7010
|
if (!ALIAS_PATTERN.test(name3) || isReservedVariantName(name3)) return false;
|
|
6758
|
-
const
|
|
6759
|
-
|
|
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;
|
|
6760
7020
|
return !aliasHoldersInScope(where.parentId, controlMap).some((holder) => {
|
|
6761
7021
|
const spec = aliasNames(holder);
|
|
6762
|
-
return spec.itemAlias === name3 || spec.indexAlias === name3;
|
|
7022
|
+
return spec.itemAlias === name3 || spec.indexAlias === name3 || spec.keyAlias === name3;
|
|
6763
7023
|
});
|
|
6764
7024
|
};
|
|
6765
7025
|
var nextAliasName = (base, where, controlMap, which) => {
|
|
@@ -6777,13 +7037,20 @@ var newRepeatSpec = (parentId, controlMap) => {
|
|
|
6777
7037
|
controlMap,
|
|
6778
7038
|
"item"
|
|
6779
7039
|
);
|
|
7040
|
+
const indexAlias = nextAliasName(
|
|
7041
|
+
DEFAULT_INDEX_ALIAS,
|
|
7042
|
+
{ parentId, own: { itemAlias, indexAlias: "" } },
|
|
7043
|
+
controlMap,
|
|
7044
|
+
"index"
|
|
7045
|
+
);
|
|
6780
7046
|
return {
|
|
6781
7047
|
itemAlias,
|
|
6782
|
-
indexAlias
|
|
6783
|
-
|
|
6784
|
-
|
|
7048
|
+
indexAlias,
|
|
7049
|
+
keyAlias: nextAliasName(
|
|
7050
|
+
DEFAULT_KEY_ALIAS,
|
|
7051
|
+
{ parentId, own: { itemAlias, indexAlias } },
|
|
6785
7052
|
controlMap,
|
|
6786
|
-
"
|
|
7053
|
+
"key"
|
|
6787
7054
|
)
|
|
6788
7055
|
};
|
|
6789
7056
|
};
|
|
@@ -6816,7 +7083,7 @@ var isBindingInScope = (binding, controlId, controlMap) => {
|
|
|
6816
7083
|
};
|
|
6817
7084
|
var bindingPathKey = (binding) => {
|
|
6818
7085
|
const root = binding.root;
|
|
6819
|
-
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}`;
|
|
6820
7087
|
return binding.path.length ? `${head}.${binding.path.join(".")}` : head;
|
|
6821
7088
|
};
|
|
6822
7089
|
|
|
@@ -6865,6 +7132,7 @@ var GLOBAL_RULE_CATALOG = {
|
|
|
6865
7132
|
var globalRuleOf = (ruleId) => Object.prototype.hasOwnProperty.call(GLOBAL_RULE_CATALOG, ruleId) ? GLOBAL_RULE_CATALOG[ruleId] : void 0;
|
|
6866
7133
|
|
|
6867
7134
|
// libs/codegen/src/lib/rule-helper.ts
|
|
7135
|
+
var hop = (segment) => segment.position === void 0 ? `?.${segment.name}` : `?.[${segment.position}]`;
|
|
6868
7136
|
var isPrimitiveType = (dataType) => dataType.type !== "shape" && dataType.type !== "form" && dataType.type !== "option";
|
|
6869
7137
|
var seq = 0;
|
|
6870
7138
|
var nodeId = () => `rn${seq += 1}`;
|
|
@@ -6888,6 +7156,12 @@ var createCall = (ruleId = "") => ({
|
|
|
6888
7156
|
ruleId,
|
|
6889
7157
|
args: {}
|
|
6890
7158
|
});
|
|
7159
|
+
var createFunctionLeaf = () => ({
|
|
7160
|
+
id: nodeId(),
|
|
7161
|
+
kind: "function",
|
|
7162
|
+
functionId: "",
|
|
7163
|
+
args: {}
|
|
7164
|
+
});
|
|
6891
7165
|
var createRule = () => createGroup([createCheck()]);
|
|
6892
7166
|
function remintRule(rule) {
|
|
6893
7167
|
const walk = (node) => node.kind === "group" ? { ...node, id: nodeId(), children: node.children.map(walk) } : { ...node, id: nodeId() };
|
|
@@ -6909,13 +7183,15 @@ function resolvePath(path, properties, shapes) {
|
|
|
6909
7183
|
shapeId = shapeKeyOf(property.dataType);
|
|
6910
7184
|
continue;
|
|
6911
7185
|
}
|
|
6912
|
-
const
|
|
7186
|
+
const shape = shapeId ? shapes[shapeId] : void 0;
|
|
7187
|
+
const key2 = shape?.keys.find((k) => k.id === id);
|
|
6913
7188
|
if (!key2) break;
|
|
6914
7189
|
segments.push({
|
|
6915
7190
|
id,
|
|
6916
7191
|
name: key2.name,
|
|
6917
7192
|
dataType: key2.dataType,
|
|
6918
|
-
cardinality: key2.cardinality
|
|
7193
|
+
cardinality: key2.cardinality,
|
|
7194
|
+
...shape?.positional ? { position: shape.keys.indexOf(key2) } : {}
|
|
6919
7195
|
});
|
|
6920
7196
|
shapeId = shapeKeyOf(key2.dataType);
|
|
6921
7197
|
}
|
|
@@ -7030,14 +7306,28 @@ var swapWithin = (node, id, delta) => {
|
|
|
7030
7306
|
var moveRuleNode = (rule, id, delta) => id === rule.id ? rule : swapWithin(rule, id, delta) ?? rule;
|
|
7031
7307
|
function ruleChecks(node) {
|
|
7032
7308
|
if (node.kind === "check") return [node];
|
|
7033
|
-
if (node.kind
|
|
7309
|
+
if (node.kind !== "group") return [];
|
|
7034
7310
|
return node.children.flatMap(ruleChecks);
|
|
7035
7311
|
}
|
|
7036
7312
|
function ruleCalls(node) {
|
|
7037
7313
|
if (node.kind === "call") return [node];
|
|
7038
|
-
if (node.kind
|
|
7314
|
+
if (node.kind !== "group") return [];
|
|
7039
7315
|
return node.children.flatMap(ruleCalls);
|
|
7040
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
|
+
}
|
|
7041
7331
|
var variantNavIds = (variant) => [
|
|
7042
7332
|
variant.navId ?? "",
|
|
7043
7333
|
...ruleNavs(variant.rule).map((nav) => nav.navId)
|
|
@@ -7055,7 +7345,7 @@ function remapRuleNavs(node, remap) {
|
|
|
7055
7345
|
}
|
|
7056
7346
|
function ruleNavs(node) {
|
|
7057
7347
|
if (node.kind === "nav") return [node];
|
|
7058
|
-
if (node.kind
|
|
7348
|
+
if (node.kind !== "group") return [];
|
|
7059
7349
|
return node.children.flatMap(ruleNavs);
|
|
7060
7350
|
}
|
|
7061
7351
|
var checkPaths = (check) => check.operand.kind === "path" ? [check.path, check.operand.path] : [check.path];
|
|
@@ -7064,7 +7354,8 @@ var callPaths = (call) => Object.values(call.args).flatMap(
|
|
|
7064
7354
|
);
|
|
7065
7355
|
var rulePaths = (rule) => [
|
|
7066
7356
|
...ruleChecks(rule).flatMap(checkPaths),
|
|
7067
|
-
...ruleCalls(rule).flatMap(callPaths)
|
|
7357
|
+
...ruleCalls(rule).flatMap(callPaths),
|
|
7358
|
+
...ruleFunctions(rule).flatMap((leaf) => Object.values(leaf.args))
|
|
7068
7359
|
];
|
|
7069
7360
|
var ruleReferencedIds = (rule) => new Set(rulePaths(rule).flat());
|
|
7070
7361
|
function ruleGlobalStores(rules) {
|
|
@@ -7127,18 +7418,37 @@ function callError(call, properties, shapes) {
|
|
|
7127
7418
|
}
|
|
7128
7419
|
return null;
|
|
7129
7420
|
}
|
|
7130
|
-
|
|
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 = {}) {
|
|
7131
7439
|
if (node.kind === "check") return checkError(node, properties, shapes);
|
|
7132
7440
|
if (node.kind === "call") return callError(node, properties, shapes);
|
|
7133
7441
|
if (node.kind === "nav") return node.navId ? null : "rule-nav-missing";
|
|
7442
|
+
if (node.kind === "function")
|
|
7443
|
+
return functionError(node, properties, shapes, functions);
|
|
7134
7444
|
if (!node.children.length) return "rule-empty-group";
|
|
7135
7445
|
for (const child of node.children) {
|
|
7136
|
-
const error = ruleError(child, properties, shapes);
|
|
7446
|
+
const error = ruleError(child, properties, shapes, functions);
|
|
7137
7447
|
if (error) return error;
|
|
7138
7448
|
}
|
|
7139
7449
|
return null;
|
|
7140
7450
|
}
|
|
7141
|
-
var isRuleComplete = (rule, properties, shapes) => ruleError(rule, properties, shapes) === null;
|
|
7451
|
+
var isRuleComplete = (rule, properties, shapes, functions = {}) => ruleError(rule, properties, shapes, functions) === null;
|
|
7142
7452
|
var JS_OPERATOR = {
|
|
7143
7453
|
"==": "===",
|
|
7144
7454
|
"!=": "!==",
|
|
@@ -7154,7 +7464,7 @@ var rootSource = (segment, prefix) => {
|
|
|
7154
7464
|
};
|
|
7155
7465
|
var scalarSource = (segments, prefix = "") => segments.map((segment, index) => {
|
|
7156
7466
|
if (index === 0) return rootSource(segment, prefix);
|
|
7157
|
-
return
|
|
7467
|
+
return hop(segment);
|
|
7158
7468
|
}).join("");
|
|
7159
7469
|
function operandSource(operand, properties, shapes, prefix = "") {
|
|
7160
7470
|
if (operand.kind === "literal") return literalSource(operand.value);
|
|
@@ -7200,7 +7510,7 @@ function generateCheckExpression(check, properties, shapes, prefix = "") {
|
|
|
7200
7510
|
const taken = /* @__PURE__ */ new Set();
|
|
7201
7511
|
const walk = (index, base, depth) => {
|
|
7202
7512
|
const segment = segments[index];
|
|
7203
|
-
const access = index === 0 ? rootSource(segment, prefix) : `${base}
|
|
7513
|
+
const access = index === 0 ? rootSource(segment, prefix) : `${base}${hop(segment)}`;
|
|
7204
7514
|
const last = index === segments.length - 1;
|
|
7205
7515
|
if (segment.cardinality === "one") {
|
|
7206
7516
|
return last ? leaf(access, true) : walk(index + 1, access, depth);
|
|
@@ -7226,7 +7536,26 @@ function generateCallExpression(call, properties, shapes, prefix = "", callRecei
|
|
|
7226
7536
|
});
|
|
7227
7537
|
return `${callReceiver}${GLOBAL_RULE_STORES[rule.store].prop}.${rule.member}(${args.join(", ")})`;
|
|
7228
7538
|
}
|
|
7229
|
-
function
|
|
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
|
+
}
|
|
7230
7559
|
if (node.kind === "check") {
|
|
7231
7560
|
return checkError(node, properties, shapes) ? "false" : generateCheckExpression(node, properties, shapes, prefix);
|
|
7232
7561
|
}
|
|
@@ -7245,7 +7574,8 @@ function generateRuleExpression(node, properties, shapes, top = true, prefix = "
|
|
|
7245
7574
|
shapes,
|
|
7246
7575
|
false,
|
|
7247
7576
|
prefix,
|
|
7248
|
-
callReceiver
|
|
7577
|
+
callReceiver,
|
|
7578
|
+
functions
|
|
7249
7579
|
)
|
|
7250
7580
|
);
|
|
7251
7581
|
const joined = parts.join(joiner);
|
|
@@ -7267,6 +7597,15 @@ function pathChipDisplay(segments, quantifier, counted, operator = "==") {
|
|
|
7267
7597
|
}).join(".");
|
|
7268
7598
|
return counted ? `count of ${body}` : body;
|
|
7269
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
|
+
}
|
|
7270
7609
|
function operandDisplay(operand, properties, shapes) {
|
|
7271
7610
|
if (operand.kind === "literal") return literalSource(operand.value);
|
|
7272
7611
|
const segments = resolvePath(operand.path, properties, shapes);
|
|
@@ -7346,265 +7685,6 @@ var collectListItemsAssets = (controlMap) => Object.values(controlMap ?? {}).fil
|
|
|
7346
7685
|
items
|
|
7347
7686
|
}));
|
|
7348
7687
|
|
|
7349
|
-
// libs/codegen/src/lib/binding-option-helper.ts
|
|
7350
|
-
var ROOT_PREFIX = "root:";
|
|
7351
|
-
var SEPARATOR = ".";
|
|
7352
|
-
var MAX_DEPTH = 6;
|
|
7353
|
-
var WALKABLE_ROOTS = /* @__PURE__ */ new Set([
|
|
7354
|
-
"alias",
|
|
7355
|
-
"input",
|
|
7356
|
-
"screen_computed"
|
|
7357
|
-
]);
|
|
7358
|
-
var encodeRoot = (root) => {
|
|
7359
|
-
if (root.kind === "alias") return `alias:${root.repeatId}:${root.alias}`;
|
|
7360
|
-
if (root.kind === "auth") return `auth:${root.property}`;
|
|
7361
|
-
return `${root.kind}:${root.id}`;
|
|
7362
|
-
};
|
|
7363
|
-
var encodeBinding = (binding) => {
|
|
7364
|
-
const { root, path } = binding;
|
|
7365
|
-
if (root.kind === "property" || root.kind === "computed") {
|
|
7366
|
-
return `${ROOT_PREFIX}store|${[root.id, ...path].join(SEPARATOR)}`;
|
|
7367
|
-
}
|
|
7368
|
-
const tail = path.join(SEPARATOR);
|
|
7369
|
-
return `${ROOT_PREFIX}${encodeRoot(root)}${tail ? `|${tail}` : ""}`;
|
|
7370
|
-
};
|
|
7371
|
-
var decodeRoot = (encoded) => {
|
|
7372
|
-
const parts = encoded.split(":");
|
|
7373
|
-
if (parts[0] === "alias" && parts.length === 3) {
|
|
7374
|
-
const alias = parts[2];
|
|
7375
|
-
if (alias !== "item" && alias !== "index") return void 0;
|
|
7376
|
-
return { kind: "alias", repeatId: parts[1], alias };
|
|
7377
|
-
}
|
|
7378
|
-
if (parts[0] === "auth") {
|
|
7379
|
-
const property = AUTH_PROPERTIES.find((entry2) => entry2.id === parts[1]);
|
|
7380
|
-
return property ? { kind: "auth", property: property.id } : void 0;
|
|
7381
|
-
}
|
|
7382
|
-
if (parts[0] === "user_store" && parts[1] === "deployToken") {
|
|
7383
|
-
return { kind: "auth", property: "deployToken" };
|
|
7384
|
-
}
|
|
7385
|
-
const kind = parts[0];
|
|
7386
|
-
if (kind === "input" || kind === "screen_computed" || kind === "screen_variable" || kind === "form_model") {
|
|
7387
|
-
return { kind, id: parts.slice(1).join(":") };
|
|
7388
|
-
}
|
|
7389
|
-
return void 0;
|
|
7390
|
-
};
|
|
7391
|
-
var bindingAlwaysPresent = (binding, scope) => {
|
|
7392
|
-
if (binding.path.length > 1) return false;
|
|
7393
|
-
const root = binding.root;
|
|
7394
|
-
if (root.kind === "alias") return true;
|
|
7395
|
-
if (root.kind === "screen_computed") {
|
|
7396
|
-
return screenComputedPresent(
|
|
7397
|
-
root.id,
|
|
7398
|
-
scope.screenComputeds,
|
|
7399
|
-
scope.functions,
|
|
7400
|
-
scope.inputs
|
|
7401
|
-
);
|
|
7402
|
-
}
|
|
7403
|
-
return root.kind === "input" && !!scope.inputs?.[root.id]?.required;
|
|
7404
|
-
};
|
|
7405
|
-
var sourceShapeId = (source, scope, seen = /* @__PURE__ */ new Set()) => {
|
|
7406
|
-
if (!source) return void 0;
|
|
7407
|
-
let dataType;
|
|
7408
|
-
const root = source.root;
|
|
7409
|
-
if (root.kind === "property" || root.kind === "computed") {
|
|
7410
|
-
dataType = scope.roots[root.id]?.dataType;
|
|
7411
|
-
} else if (root.kind === "input") {
|
|
7412
|
-
dataType = scope.inputs?.[root.id]?.dataType;
|
|
7413
|
-
} else if (root.kind === "screen_computed") {
|
|
7414
|
-
const computed = scope.screenComputeds?.[root.id];
|
|
7415
|
-
dataType = computed ? screenComputedFunction(computed, scope.functions ?? {})?.returnType : void 0;
|
|
7416
|
-
} else if (root.kind === "alias") {
|
|
7417
|
-
if (root.alias === "index" || seen.has(root.repeatId)) return void 0;
|
|
7418
|
-
const rowShapeId = holderRowShapeId(
|
|
7419
|
-
scope.controlMap[root.repeatId],
|
|
7420
|
-
scope,
|
|
7421
|
-
/* @__PURE__ */ new Set([...seen, root.repeatId])
|
|
7422
|
-
);
|
|
7423
|
-
dataType = rowShapeId ? { type: "shape", shapeId: rowShapeId } : void 0;
|
|
7424
|
-
}
|
|
7425
|
-
for (const keyId of source.path) {
|
|
7426
|
-
const shape = dataType?.type === "shape" ? scope.shapes[dataType.shapeId] : void 0;
|
|
7427
|
-
const key2 = shape?.keys.find((k) => k.id === keyId);
|
|
7428
|
-
if (!key2) return void 0;
|
|
7429
|
-
dataType = key2.dataType;
|
|
7430
|
-
}
|
|
7431
|
-
return dataType?.type === "shape" ? dataType.shapeId : void 0;
|
|
7432
|
-
};
|
|
7433
|
-
var holderRowShapeId = (holder, scope, seen = /* @__PURE__ */ new Set()) => {
|
|
7434
|
-
const shapeId = sourceShapeId(
|
|
7435
|
-
holder?.bindings?.[aliasSourceSlot(holder)],
|
|
7436
|
-
scope,
|
|
7437
|
-
holder ? /* @__PURE__ */ new Set([...seen, holder.id]) : seen
|
|
7438
|
-
);
|
|
7439
|
-
if (shapeId) return shapeId;
|
|
7440
|
-
return holder?.type === "list" /* LIST */ && toListItemRows(holder.configs?.[LIST_ITEMS_KEY]).length ? LIST_ROW_SHAPE_ID : void 0;
|
|
7441
|
-
};
|
|
7442
|
-
var aliasRoots = (scope) => {
|
|
7443
|
-
const control = scope.controlId ? scope.controlMap[scope.controlId] : void 0;
|
|
7444
|
-
if (!control || scope.allowAlias === false) return [];
|
|
7445
|
-
const from = isAliasHolder(control) ? control.parentId : control.id;
|
|
7446
|
-
return aliasHoldersInScope(from, scope.controlMap).flatMap((holder) => {
|
|
7447
|
-
const spec = aliasNames(holder);
|
|
7448
|
-
const rowShapeId = holderRowShapeId(holder, scope);
|
|
7449
|
-
return [
|
|
7450
|
-
{
|
|
7451
|
-
root: {
|
|
7452
|
-
kind: "alias",
|
|
7453
|
-
repeatId: holder.id,
|
|
7454
|
-
alias: "item"
|
|
7455
|
-
},
|
|
7456
|
-
name: spec.itemAlias,
|
|
7457
|
-
dataType: rowShapeId ? { type: "shape", shapeId: rowShapeId } : { type: "string" },
|
|
7458
|
-
cardinality: "one"
|
|
7459
|
-
},
|
|
7460
|
-
{
|
|
7461
|
-
root: {
|
|
7462
|
-
kind: "alias",
|
|
7463
|
-
repeatId: holder.id,
|
|
7464
|
-
alias: "index"
|
|
7465
|
-
},
|
|
7466
|
-
name: spec.indexAlias,
|
|
7467
|
-
dataType: { type: "number" },
|
|
7468
|
-
cardinality: "one"
|
|
7469
|
-
}
|
|
7470
|
-
];
|
|
7471
|
-
});
|
|
7472
|
-
};
|
|
7473
|
-
var screenRoots = (scope) => [
|
|
7474
|
-
...Object.values(scope.inputs ?? {}).map((input) => ({
|
|
7475
|
-
root: { kind: "input", id: input.id },
|
|
7476
|
-
name: input.name,
|
|
7477
|
-
dataType: input.dataType,
|
|
7478
|
-
cardinality: input.cardinality
|
|
7479
|
-
})),
|
|
7480
|
-
// A ScreenComputed's type is its PureFunction's declared return and is
|
|
7481
|
-
// never authored (GLOSSARY.md ScreenComputed), so it is read off the
|
|
7482
|
-
// function the same way `computedAsProperty` reads a StateComputed's.
|
|
7483
|
-
...Object.values(scope.screenComputeds ?? {}).flatMap((computed) => {
|
|
7484
|
-
const fn = screenComputedFunction(computed, scope.functions ?? {});
|
|
7485
|
-
return fn ? [
|
|
7486
|
-
{
|
|
7487
|
-
root: { kind: "screen_computed", id: computed.id },
|
|
7488
|
-
name: computed.name,
|
|
7489
|
-
dataType: fn.returnType,
|
|
7490
|
-
cardinality: returnCardinalityOf(fn)
|
|
7491
|
-
}
|
|
7492
|
-
] : [];
|
|
7493
|
-
}),
|
|
7494
|
-
// A ScreenVariable is read whole like the computed above — it holds no
|
|
7495
|
-
// StateShape, so there is nothing to walk into (ADR 0079).
|
|
7496
|
-
...Object.values(scope.screenVariables ?? {}).map((variable) => ({
|
|
7497
|
-
root: { kind: "screen_variable", id: variable.id },
|
|
7498
|
-
name: variable.name,
|
|
7499
|
-
dataType: { type: variable.dataType },
|
|
7500
|
-
cardinality: variable.cardinality
|
|
7501
|
-
})),
|
|
7502
|
-
// A FormModel is the one Screen-owned root walked into rather than read
|
|
7503
|
-
// whole: a form's value is an object, and its FormShape keys are what
|
|
7504
|
-
// reading it elsewhere means (ADR 0127).
|
|
7505
|
-
...Object.values(scope.formModels ?? {}).map((model) => ({
|
|
7506
|
-
root: { kind: "form_model", id: model.id },
|
|
7507
|
-
name: model.name,
|
|
7508
|
-
dataType: { type: "form", formId: model.formId },
|
|
7509
|
-
cardinality: "one"
|
|
7510
|
-
}))
|
|
7511
|
-
].sort((a, b) => a.name.localeCompare(b.name));
|
|
7512
|
-
var authRoots = () => AUTH_PROPERTIES.map((property) => ({
|
|
7513
|
-
root: { kind: "auth", property: property.id },
|
|
7514
|
-
name: property.name,
|
|
7515
|
-
dataType: property.dataType,
|
|
7516
|
-
cardinality: "one"
|
|
7517
|
-
}));
|
|
7518
|
-
var option = (root, path, label, dataType, cardinality) => ({
|
|
7519
|
-
value: encodeBinding({ root, path }),
|
|
7520
|
-
label,
|
|
7521
|
-
binding: { root, path },
|
|
7522
|
-
dataType,
|
|
7523
|
-
cardinality
|
|
7524
|
-
});
|
|
7525
|
-
var walkShape = (scope, accept, root, prefix, path, shapeId, depth) => {
|
|
7526
|
-
if (depth > MAX_DEPTH) return [];
|
|
7527
|
-
const keys = scope.shapes[shapeId]?.keys ?? [];
|
|
7528
|
-
const options = [];
|
|
7529
|
-
for (const key2 of keys) {
|
|
7530
|
-
const next = [...path, key2.id];
|
|
7531
|
-
const label = `${prefix}${SEPARATOR}${key2.cardinality === "one" ? key2.name : `${key2.name}[n]`}`;
|
|
7532
|
-
if (accept(key2.dataType, key2.cardinality)) {
|
|
7533
|
-
options.push(option(root, next, label, key2.dataType, key2.cardinality));
|
|
7534
|
-
}
|
|
7535
|
-
if (key2.dataType?.type === "shape" && key2.cardinality === "one") {
|
|
7536
|
-
options.push(
|
|
7537
|
-
...walkShape(
|
|
7538
|
-
scope,
|
|
7539
|
-
accept,
|
|
7540
|
-
root,
|
|
7541
|
-
label,
|
|
7542
|
-
next,
|
|
7543
|
-
key2.dataType.shapeId,
|
|
7544
|
-
depth + 1
|
|
7545
|
-
)
|
|
7546
|
-
);
|
|
7547
|
-
}
|
|
7548
|
-
}
|
|
7549
|
-
return options;
|
|
7550
|
-
};
|
|
7551
|
-
var optionsForRoot = (scope, accept, entry2) => {
|
|
7552
|
-
const shapeId = entry2.dataType?.type === "shape" ? entry2.dataType.shapeId : void 0;
|
|
7553
|
-
const own = accept(entry2.dataType, entry2.cardinality) ? [option(entry2.root, [], entry2.name, entry2.dataType, entry2.cardinality)] : [];
|
|
7554
|
-
if (!shapeId || !WALKABLE_ROOTS.has(entry2.root.kind)) return own;
|
|
7555
|
-
return [
|
|
7556
|
-
...own,
|
|
7557
|
-
...walkShape(scope, accept, entry2.root, entry2.name, [], shapeId, 0)
|
|
7558
|
-
];
|
|
7559
|
-
};
|
|
7560
|
-
var walkStore = (scope, accept, path, depth, prefix = "") => {
|
|
7561
|
-
if (depth > MAX_DEPTH) return [];
|
|
7562
|
-
const options = [];
|
|
7563
|
-
for (const segment of segmentOptions(
|
|
7564
|
-
path,
|
|
7565
|
-
path.length,
|
|
7566
|
-
scope.roots,
|
|
7567
|
-
scope.shapes
|
|
7568
|
-
)) {
|
|
7569
|
-
const next = [...path, segment.id];
|
|
7570
|
-
const name3 = segment.cardinality === "one" ? segment.name : `${segment.name}[n]`;
|
|
7571
|
-
const label = prefix ? `${prefix}${SEPARATOR}${name3}` : name3;
|
|
7572
|
-
if (accept(segment.dataType, segment.cardinality)) {
|
|
7573
|
-
const [rootId, ...rest] = next;
|
|
7574
|
-
const kind = scope.properties[rootId] ? "property" : "computed";
|
|
7575
|
-
options.push(
|
|
7576
|
-
option(
|
|
7577
|
-
{ kind, id: rootId },
|
|
7578
|
-
rest,
|
|
7579
|
-
label,
|
|
7580
|
-
segment.dataType,
|
|
7581
|
-
segment.cardinality
|
|
7582
|
-
)
|
|
7583
|
-
);
|
|
7584
|
-
}
|
|
7585
|
-
if (segment.dataType.type === "shape" && segment.cardinality === "one") {
|
|
7586
|
-
options.push(...walkStore(scope, accept, next, depth + 1, label));
|
|
7587
|
-
}
|
|
7588
|
-
}
|
|
7589
|
-
return options;
|
|
7590
|
-
};
|
|
7591
|
-
var bindingOptions = (rawScope, accept) => {
|
|
7592
|
-
const scope = {
|
|
7593
|
-
...rawScope,
|
|
7594
|
-
shapes: withListRowShape(rawScope.shapes)
|
|
7595
|
-
};
|
|
7596
|
-
return [
|
|
7597
|
-
...[
|
|
7598
|
-
...aliasRoots(scope),
|
|
7599
|
-
...screenRoots(scope),
|
|
7600
|
-
...authRoots()
|
|
7601
|
-
].flatMap(
|
|
7602
|
-
(entry2) => optionsForRoot(scope, accept, entry2)
|
|
7603
|
-
),
|
|
7604
|
-
...walkStore(scope, accept, [], 0)
|
|
7605
|
-
];
|
|
7606
|
-
};
|
|
7607
|
-
|
|
7608
7688
|
// libs/codegen/src/lib/form-control-helper.ts
|
|
7609
7689
|
function normalizeFieldName(raw) {
|
|
7610
7690
|
return raw.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
@@ -7951,9 +8031,10 @@ var walkKeys = (keyIds, rootShapeId2, shapes) => {
|
|
|
7951
8031
|
const names = [];
|
|
7952
8032
|
let shapeId = rootShapeId2;
|
|
7953
8033
|
for (const keyId of keyIds) {
|
|
7954
|
-
const
|
|
8034
|
+
const shape = shapeId ? shapes[shapeId] : void 0;
|
|
8035
|
+
const key2 = shape?.keys.find((k) => k.id === keyId);
|
|
7955
8036
|
if (!key2) return void 0;
|
|
7956
|
-
names.push(key2
|
|
8037
|
+
names.push(memberToken(shape, key2));
|
|
7957
8038
|
shapeId = key2.dataType?.type === "shape" ? key2.dataType.shapeId : void 0;
|
|
7958
8039
|
}
|
|
7959
8040
|
return names;
|
|
@@ -7965,7 +8046,7 @@ var rootShapeId = (binding, scope, seen) => {
|
|
|
7965
8046
|
return dataType?.type === "shape" ? dataType.shapeId : void 0;
|
|
7966
8047
|
}
|
|
7967
8048
|
if (root.kind === "alias") {
|
|
7968
|
-
if (root.alias
|
|
8049
|
+
if (root.alias !== "item" || seen.has(root.repeatId)) return void 0;
|
|
7969
8050
|
seen.add(root.repeatId);
|
|
7970
8051
|
const holder = scope.controlMap?.[root.repeatId];
|
|
7971
8052
|
const source = holder?.bindings?.[aliasSourceSlot(holder)];
|
|
@@ -8002,6 +8083,129 @@ var bindingShapeId = (binding, scope, seen = /* @__PURE__ */ new Set()) => {
|
|
|
8002
8083
|
}
|
|
8003
8084
|
return shapeId;
|
|
8004
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
|
+
};
|
|
8005
8209
|
var sourceCarriesTrackKey = (source, keyId, scope) => {
|
|
8006
8210
|
const shapeId = bindingShapeId(source, scope);
|
|
8007
8211
|
return !!shapeId && (shapesOf(scope)[shapeId]?.keys ?? []).some((key2) => key2.id === keyId);
|
|
@@ -8056,18 +8260,26 @@ var rootExpression = (binding, scope) => {
|
|
|
8056
8260
|
return name3 ? `${scope.memberPrefix ?? ""}${name3}()` : void 0;
|
|
8057
8261
|
}
|
|
8058
8262
|
case "alias": {
|
|
8059
|
-
const
|
|
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
|
+
}
|
|
8060
8268
|
return root.alias === "index" ? spec.indexAlias : spec.itemAlias;
|
|
8061
8269
|
}
|
|
8062
8270
|
// Never gated by `scope.storeProp`: AuthStore is app-wide, not
|
|
8063
8271
|
// Feature-owned, so it reads the same on a storeless Page (ADR 0040).
|
|
8064
8272
|
case "auth":
|
|
8065
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;
|
|
8066
8278
|
}
|
|
8067
8279
|
};
|
|
8068
8280
|
var rootIsPresent = (binding, scope) => {
|
|
8069
8281
|
const root = binding.root;
|
|
8070
|
-
if (root.kind === "alias") return true;
|
|
8282
|
+
if (root.kind === "alias" || root.kind === "none") return true;
|
|
8071
8283
|
if (root.kind === "screen_computed") {
|
|
8072
8284
|
return screenComputedPresent(
|
|
8073
8285
|
root.id,
|
|
@@ -8096,8 +8308,8 @@ var bindingExpression = (binding, scope, guardAlias) => {
|
|
|
8096
8308
|
);
|
|
8097
8309
|
if (!names) return void 0;
|
|
8098
8310
|
const present = !!guardAlias || rootIsPresent(binding, scope);
|
|
8099
|
-
const
|
|
8100
|
-
expr = `${head}${
|
|
8311
|
+
const [first, ...rest] = names;
|
|
8312
|
+
expr = `${head}${memberStep(present ? "." : "?.", first)}${rest.map((name3) => memberStep("?.", name3)).join("")}`;
|
|
8101
8313
|
}
|
|
8102
8314
|
if (!binding.transform) return expr;
|
|
8103
8315
|
const roots = transformRoots(scope);
|
|
@@ -8109,7 +8321,11 @@ var bindingExpression = (binding, scope, guardAlias) => {
|
|
|
8109
8321
|
)) {
|
|
8110
8322
|
return void 0;
|
|
8111
8323
|
}
|
|
8324
|
+
const leafRead = (leaf) => bindingExpression(leaf, scope);
|
|
8325
|
+
const leaves = transformBindingLeaves(binding.transform);
|
|
8326
|
+
if (leaves.some((leaf) => !leafRead(leaf))) return void 0;
|
|
8112
8327
|
return emitTransformExpr(binding.transform, expr, {
|
|
8328
|
+
bindingRead: leafRead,
|
|
8113
8329
|
functions: scope.functions ?? {},
|
|
8114
8330
|
properties: roots,
|
|
8115
8331
|
shapes: shapesOf(scope),
|
|
@@ -8205,7 +8421,12 @@ var bindingGapReason = (binding, scope) => {
|
|
|
8205
8421
|
roots,
|
|
8206
8422
|
shapesOf(scope)
|
|
8207
8423
|
);
|
|
8208
|
-
if (!err)
|
|
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
|
+
}
|
|
8209
8430
|
const detail = transformGapDetail(
|
|
8210
8431
|
binding.transform,
|
|
8211
8432
|
scope.functions ?? {},
|
|
@@ -8218,8 +8439,12 @@ var repeatHeader = (control, scope) => {
|
|
|
8218
8439
|
const source = control.bindings?.["source"];
|
|
8219
8440
|
if (!source) return void 0;
|
|
8220
8441
|
const spec = repeatSpec(control);
|
|
8221
|
-
if (!spec.track) return void 0;
|
|
8222
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;
|
|
8223
8448
|
if (!expr) return void 0;
|
|
8224
8449
|
const track = trackExpression(
|
|
8225
8450
|
spec.track,
|
|
@@ -8231,12 +8456,24 @@ var repeatHeader = (control, scope) => {
|
|
|
8231
8456
|
if (!track) return void 0;
|
|
8232
8457
|
return `${spec.itemAlias} of (${expr} ?? []); track ${track}; let ${spec.indexAlias} = $index`;
|
|
8233
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
|
+
};
|
|
8234
8469
|
var repeatGapReason = (control, scope) => {
|
|
8235
8470
|
const source = control.bindings?.["source"];
|
|
8236
8471
|
if (!source) return "no source bound";
|
|
8237
8472
|
const spec = repeatSpec(control);
|
|
8473
|
+
const resolves = !!bindingExpression(source, scope);
|
|
8474
|
+
if (resolves && isKeyedRepeat(control, scope)) return void 0;
|
|
8238
8475
|
if (!spec.track) return "no track picked";
|
|
8239
|
-
if (!
|
|
8476
|
+
if (!resolves) {
|
|
8240
8477
|
return `source ${rootLabel(source.root, scope)} does not resolve here`;
|
|
8241
8478
|
}
|
|
8242
8479
|
if (spec.track.kind !== "key") return void 0;
|
|
@@ -8261,14 +8498,310 @@ var rootLabel = (root, scope) => {
|
|
|
8261
8498
|
return `row alias of repeat '${root.repeatId}'`;
|
|
8262
8499
|
case "auth":
|
|
8263
8500
|
return `auth field '${root.property}'`;
|
|
8501
|
+
case "none":
|
|
8502
|
+
return "function call";
|
|
8264
8503
|
}
|
|
8265
8504
|
};
|
|
8266
8505
|
var trackExpression = (track, itemAlias, indexAlias, source, scope) => {
|
|
8267
8506
|
if (track.kind === "item") return itemAlias;
|
|
8268
8507
|
if (track.kind === "index") return indexAlias;
|
|
8269
8508
|
const shapeId = bindingShapeId(source, scope);
|
|
8270
|
-
const
|
|
8271
|
-
|
|
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
|
+
];
|
|
8272
8805
|
};
|
|
8273
8806
|
|
|
8274
8807
|
// libs/codegen/src/lib/filter-group-helper.ts
|
|
@@ -8499,7 +9032,7 @@ function nextCallArgRow(args, rows) {
|
|
|
8499
9032
|
value: ""
|
|
8500
9033
|
};
|
|
8501
9034
|
}
|
|
8502
|
-
var
|
|
9035
|
+
var sameType4 = (a, b) => {
|
|
8503
9036
|
if (a.cardinality !== b.cardinality) return false;
|
|
8504
9037
|
if (!a.dataType || !b.dataType) return false;
|
|
8505
9038
|
if (a.dataType.type !== b.dataType.type) return false;
|
|
@@ -8517,7 +9050,7 @@ var eventMemberType = (row, scope) => {
|
|
|
8517
9050
|
function callArgEventMismatch(row, target, scope) {
|
|
8518
9051
|
if (!target?.dataType || row.transform) return false;
|
|
8519
9052
|
const member = eventMemberType(row, scope);
|
|
8520
|
-
return !!member && !
|
|
9053
|
+
return !!member && !sameType4(target, member);
|
|
8521
9054
|
}
|
|
8522
9055
|
var AUTO_CASTS = {
|
|
8523
9056
|
string: { number: "Number", boolean: "Boolean" },
|
|
@@ -8528,7 +9061,7 @@ function callArgTypeMismatch(row, target, scope) {
|
|
|
8528
9061
|
if (!target?.dataType || row.transform) return void 0;
|
|
8529
9062
|
if (row.source !== "binding" && row.source !== "event") return void 0;
|
|
8530
9063
|
const read = bindingPipeType(row, target, scope);
|
|
8531
|
-
if (!read ||
|
|
9064
|
+
if (!read || sameType4(target, read)) return void 0;
|
|
8532
9065
|
const expected = {
|
|
8533
9066
|
dataType: target.dataType,
|
|
8534
9067
|
cardinality: target.cardinality
|
|
@@ -8571,7 +9104,7 @@ var rowComplete = (row, target, payload, fieldNames, constants, functions, scope
|
|
|
8571
9104
|
if (!target.dataType) return "call-arg-type-mismatch";
|
|
8572
9105
|
const root = scope.roots?.[row.propertyId ?? ""];
|
|
8573
9106
|
if (!root) return "call-arg-unknown-state";
|
|
8574
|
-
if (!
|
|
9107
|
+
if (!sameType4(target, root)) return "call-arg-type-mismatch";
|
|
8575
9108
|
} else if (row.source === "binding") {
|
|
8576
9109
|
if (!target.dataType) return "call-arg-type-mismatch";
|
|
8577
9110
|
if (!row.binding) return "call-arg-incomplete";
|
|
@@ -8588,7 +9121,7 @@ var rowComplete = (row, target, payload, fieldNames, constants, functions, scope
|
|
|
8588
9121
|
if (!row.storageKey?.trim()) return "call-arg-incomplete";
|
|
8589
9122
|
} else if (row.source === "search") {
|
|
8590
9123
|
if (!target.dataType) return "call-arg-type-mismatch";
|
|
8591
|
-
if (!
|
|
9124
|
+
if (!sameType4(target, {
|
|
8592
9125
|
dataType: { type: "string" },
|
|
8593
9126
|
cardinality: "one"
|
|
8594
9127
|
})) {
|
|
@@ -8671,11 +9204,10 @@ function validateCallArgs(args, rows, payload, fieldNames = [], constants = {},
|
|
|
8671
9204
|
}
|
|
8672
9205
|
return void 0;
|
|
8673
9206
|
}
|
|
8674
|
-
var
|
|
8675
|
-
var IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
9207
|
+
var memberAccess3 = (segment) => isIdentifier(segment) ? `.${segment}` : `[${propertyKey(segment)}]`;
|
|
8676
9208
|
var eventExpression = (event, payload, root = "$event", eventMember, target, dataType) => {
|
|
8677
9209
|
if (payload !== "record" || !event?.length) return root;
|
|
8678
|
-
const read = `$event${event.map(
|
|
9210
|
+
const read = `$event${event.map(memberAccess3).join("")}`;
|
|
8679
9211
|
return eventMember ? eventMember(event, read, "$event", target, dataType) : read;
|
|
8680
9212
|
};
|
|
8681
9213
|
function eventPayloadTsType(reads, shapes) {
|
|
@@ -8713,11 +9245,10 @@ function eventPayloadTsType(reads, shapes) {
|
|
|
8713
9245
|
}
|
|
8714
9246
|
}
|
|
8715
9247
|
const serialize = (node) => `{ ${[...node.children.entries()].map(
|
|
8716
|
-
([name3, child]) => `${
|
|
9248
|
+
([name3, child]) => `${propertyKey(name3)}: ${child.type ?? serialize(child)}`
|
|
8717
9249
|
).join("; ")} }`;
|
|
8718
9250
|
return root.children.size ? serialize(root) : void 0;
|
|
8719
9251
|
}
|
|
8720
|
-
var quoteKey = (name3) => IDENTIFIER.test(name3) ? name3 : `'${name3}'`;
|
|
8721
9252
|
var memberRead2 = (name3, ctx) => ctx.scope === "class" ? `this.${name3}` : name3;
|
|
8722
9253
|
var callArgStateRead = (row, ctx) => {
|
|
8723
9254
|
const name3 = ctx.roots?.[row.propertyId ?? ""]?.name;
|
|
@@ -9227,18 +9758,28 @@ function collectScreenWires(tree, refs = {}) {
|
|
|
9227
9758
|
});
|
|
9228
9759
|
}
|
|
9229
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
|
+
};
|
|
9230
9769
|
function screenInputExpression(binding, target, wires, renderBinding = () => void 0) {
|
|
9231
9770
|
switch (binding.kind) {
|
|
9232
9771
|
case "static": {
|
|
9233
|
-
if (!target
|
|
9772
|
+
if (!target) return void 0;
|
|
9234
9773
|
const primitive = inputPrimitive(target);
|
|
9235
9774
|
if (!primitive) return void 0;
|
|
9236
|
-
if (
|
|
9237
|
-
|
|
9238
|
-
return Number.isFinite(parsed2) ? String(parsed2) : void 0;
|
|
9775
|
+
if (target.cardinality === "one") {
|
|
9776
|
+
return staticLiteral(binding.value, primitive);
|
|
9239
9777
|
}
|
|
9240
|
-
if (
|
|
9241
|
-
|
|
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;
|
|
9242
9783
|
}
|
|
9243
9784
|
case "input":
|
|
9244
9785
|
case "variable":
|
|
@@ -9548,7 +10089,7 @@ function validateStateWrites(properties, rows, payload, fieldNames, inputs, cons
|
|
|
9548
10089
|
return void 0;
|
|
9549
10090
|
}
|
|
9550
10091
|
var IDENTIFIER2 = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
9551
|
-
var
|
|
10092
|
+
var memberAccess4 = (segment) => IDENTIFIER2.test(segment) ? `.${segment}` : `['${segment}']`;
|
|
9552
10093
|
var valueExpression = (value, property, payload, storeProp, inputs, constants, eventRoot, self = "", eventMember) => {
|
|
9553
10094
|
if (value.kind === "clear") return "undefined";
|
|
9554
10095
|
if (value.kind === "toggle") return `!${storeProp}.${property.name}()`;
|
|
@@ -9564,7 +10105,7 @@ var valueExpression = (value, property, payload, storeProp, inputs, constants, e
|
|
|
9564
10105
|
return input ? `${self}${input.name}()` : void 0;
|
|
9565
10106
|
}
|
|
9566
10107
|
if (payload !== "record" || !value.path?.length) return eventRoot;
|
|
9567
|
-
const read = `$event${value.path.map(
|
|
10108
|
+
const read = `$event${value.path.map(memberAccess4).join("")}`;
|
|
9568
10109
|
return eventMember ? eventMember(
|
|
9569
10110
|
value.path,
|
|
9570
10111
|
read,
|
|
@@ -9763,7 +10304,7 @@ function validateScreenWrites(variables, rows, payload, fieldNames, inputs, cons
|
|
|
9763
10304
|
return void 0;
|
|
9764
10305
|
}
|
|
9765
10306
|
var IDENTIFIER3 = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
9766
|
-
var
|
|
10307
|
+
var memberAccess5 = (segment) => IDENTIFIER3.test(segment) ? `.${segment}` : `['${segment}']`;
|
|
9767
10308
|
var valueExpression2 = (value, variable, payload, inputs, constants, eventRoot, self = "", eventMember) => {
|
|
9768
10309
|
if (value.kind === "clear") return "undefined";
|
|
9769
10310
|
if (value.kind === "toggle") return `!${self}${variable.name}()`;
|
|
@@ -9779,7 +10320,7 @@ var valueExpression2 = (value, variable, payload, inputs, constants, eventRoot,
|
|
|
9779
10320
|
return input ? `${self}${input.name}()` : void 0;
|
|
9780
10321
|
}
|
|
9781
10322
|
if (payload !== "record" || !value.path?.length) return eventRoot;
|
|
9782
|
-
const read = `$event${value.path.map(
|
|
10323
|
+
const read = `$event${value.path.map(memberAccess5).join("")}`;
|
|
9783
10324
|
return eventMember ? eventMember(
|
|
9784
10325
|
value.path,
|
|
9785
10326
|
read,
|
|
@@ -10104,6 +10645,19 @@ function setOutputArmMode(control, output, armId, mode) {
|
|
|
10104
10645
|
})
|
|
10105
10646
|
);
|
|
10106
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
|
+
}
|
|
10107
10661
|
function setOutputArmChecks(control, output, armId, checks) {
|
|
10108
10662
|
const arms = outputArms(control, output);
|
|
10109
10663
|
if (!arms.some((arm) => arm.id === armId)) return control;
|
|
@@ -11148,6 +11702,70 @@ function staleMenuActionItems(control) {
|
|
|
11148
11702
|
return stale;
|
|
11149
11703
|
}
|
|
11150
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
|
+
|
|
11151
11769
|
// libs/codegen/src/lib/store-method-helper.ts
|
|
11152
11770
|
function normalizeMethodName(raw) {
|
|
11153
11771
|
const cleaned = raw.trim().replace(
|
|
@@ -11248,8 +11866,9 @@ function findTarget(op, target) {
|
|
|
11248
11866
|
return inputPaths(op).find((t) => t.label === key2);
|
|
11249
11867
|
}
|
|
11250
11868
|
function fixedAllowed(target) {
|
|
11251
|
-
return target.cardinality === "one" && target.dataType?.type !== "shape";
|
|
11869
|
+
return (target.cardinality === "one" || target.cardinality === "many") && target.dataType?.type !== "shape";
|
|
11252
11870
|
}
|
|
11871
|
+
var fixedItems = (value) => String(value ?? "").split(/[\n,]/).map((item) => item.trim()).filter(Boolean);
|
|
11253
11872
|
function fixedIsText(target) {
|
|
11254
11873
|
return target[0] === "path" || target[0] === "query";
|
|
11255
11874
|
}
|
|
@@ -11308,7 +11927,7 @@ function methodSignature(args) {
|
|
|
11308
11927
|
);
|
|
11309
11928
|
return `f({ ${params.join("; ")} })`;
|
|
11310
11929
|
}
|
|
11311
|
-
var
|
|
11930
|
+
var sameType5 = (a, b) => a.cardinality === b.cardinality && a.dataType?.type === b.dataType?.type;
|
|
11312
11931
|
function validateInputs(method, op) {
|
|
11313
11932
|
const targets = inputPaths(op);
|
|
11314
11933
|
const keys = targets.map((t) => t.label);
|
|
@@ -11323,7 +11942,9 @@ function validateInputs(method, op) {
|
|
|
11323
11942
|
}
|
|
11324
11943
|
}
|
|
11325
11944
|
for (const mapping of method.inputs) {
|
|
11326
|
-
if (mapping.source === "fixed" && !mapping.value)
|
|
11945
|
+
if (mapping.source === "fixed" && !fixedItems(mapping.value).length) {
|
|
11946
|
+
return "input-incomplete";
|
|
11947
|
+
}
|
|
11327
11948
|
if (mapping.source === "store" && !mapping.path?.length) {
|
|
11328
11949
|
return "input-incomplete";
|
|
11329
11950
|
}
|
|
@@ -11337,7 +11958,7 @@ function validateInputs(method, op) {
|
|
|
11337
11958
|
const args = /* @__PURE__ */ new Map();
|
|
11338
11959
|
for (const arg of allArgs(method, op)) {
|
|
11339
11960
|
const seen = args.get(arg.name);
|
|
11340
|
-
if (seen && !
|
|
11961
|
+
if (seen && !sameType5(seen, arg)) return "input-arg-clash";
|
|
11341
11962
|
args.set(arg.name, arg);
|
|
11342
11963
|
}
|
|
11343
11964
|
const requiredMissing = targets.some(
|
|
@@ -11405,6 +12026,10 @@ var OUTPUT_PAYLOADS_BY_CONTROL = {
|
|
|
11405
12026
|
// libs/one SectionTableSort — the column's id and the direction.
|
|
11406
12027
|
["section_table" /* SECTION_TABLE */]: { sortChange: "record" },
|
|
11407
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" },
|
|
11408
12033
|
// `Record<string, string | number | (string|number)[]>` keyed by each
|
|
11409
12034
|
// Filter's own `name` — a record whose members are the Filters dropped
|
|
11410
12035
|
// into the group rather than a fixed list, which is why they are resolved
|
|
@@ -11430,6 +12055,9 @@ var OUTPUT_PAYLOAD_MEMBERS = {
|
|
|
11430
12055
|
["section_table" /* SECTION_TABLE */]: {
|
|
11431
12056
|
sortChange: { id: "S", direction: "S" }
|
|
11432
12057
|
},
|
|
12058
|
+
["section_chart" /* SECTION_CHART */]: {
|
|
12059
|
+
windowChange: { from: "S", to: "S" }
|
|
12060
|
+
},
|
|
11433
12061
|
// libs/one `Audience` — one AudienceLevel, then the people and the Groups it
|
|
11434
12062
|
// lets in or keeps out (GLOSSARY.md AudiencePickerControl). Self-typed, so
|
|
11435
12063
|
// nothing binds `data` to give the output a shape (ADR 0187).
|
|
@@ -11478,6 +12106,10 @@ function filterPayloadShape(configs) {
|
|
|
11478
12106
|
}
|
|
11479
12107
|
function payloadShape(outputName, controlType, configs) {
|
|
11480
12108
|
const declared = baseOutputName(outputName);
|
|
12109
|
+
if (controlType === "plugin" /* PLUGIN */) {
|
|
12110
|
+
const pluginShape = pluginOutputShapeOf(configs, declared);
|
|
12111
|
+
if (pluginShape) return pluginShape;
|
|
12112
|
+
}
|
|
11481
12113
|
if (controlType === "field" /* FIELD */ && declared === "dataChange") {
|
|
11482
12114
|
return fieldPayloadShape(configs) ?? "void";
|
|
11483
12115
|
}
|
|
@@ -11789,7 +12421,7 @@ function responsePaths(response) {
|
|
|
11789
12421
|
});
|
|
11790
12422
|
if (cardinality !== "one" || dataType?.type !== "shape") return;
|
|
11791
12423
|
const shape = shapes[dataType.shapeId];
|
|
11792
|
-
if (!shape) return;
|
|
12424
|
+
if (!shape || shape.positional) return;
|
|
11793
12425
|
for (const key2 of shape.keys) {
|
|
11794
12426
|
walk(
|
|
11795
12427
|
[...source, key2.name],
|
|
@@ -11826,9 +12458,18 @@ function renderElement(dataType, shapes, depth, seen) {
|
|
|
11826
12458
|
if (!shape) return "object";
|
|
11827
12459
|
if (seen.has(shape.id)) return shape.name;
|
|
11828
12460
|
const next = new Set(seen).add(shape.id);
|
|
11829
|
-
const
|
|
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
|
+
}
|
|
11830
12471
|
const body = shape.keys.map(
|
|
11831
|
-
(key2) => `${
|
|
12472
|
+
(key2) => `${pad2}"${key2.name}": ${renderJson(key2.dataType, key2.cardinality, shapes, depth + 1, next)}`
|
|
11832
12473
|
).join(",\n");
|
|
11833
12474
|
return body ? `{
|
|
11834
12475
|
${body}
|
|
@@ -11858,6 +12499,13 @@ function literalExpression(value, dataType) {
|
|
|
11858
12499
|
if (type === "number") return String(Number(text2) || 0);
|
|
11859
12500
|
return `'${text2.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
|
|
11860
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
|
+
}
|
|
11861
12509
|
function responsePathAt(response, source) {
|
|
11862
12510
|
const key2 = source.join(".");
|
|
11863
12511
|
return responsePaths(response).find((p2) => p2.label === key2);
|
|
@@ -12143,6 +12791,7 @@ var rulePaths2 = (rule) => {
|
|
|
12143
12791
|
return Object.values(node.args).flatMap(
|
|
12144
12792
|
(arg) => arg.kind === "path" ? [arg.path] : []
|
|
12145
12793
|
);
|
|
12794
|
+
if (node.kind === "function") return Object.values(node.args);
|
|
12146
12795
|
return node.operand.kind === "path" ? [node.path, node.operand.path] : [node.path];
|
|
12147
12796
|
};
|
|
12148
12797
|
return walk(rule);
|
|
@@ -12495,7 +13144,7 @@ function releaseBlocker(config, linked) {
|
|
|
12495
13144
|
}
|
|
12496
13145
|
|
|
12497
13146
|
// libs/codegen/src/lib/app-target-helper.ts
|
|
12498
|
-
var DEFAULT_BACKEND_URL =
|
|
13147
|
+
var DEFAULT_BACKEND_URL = DEFAULT_LOCAL_BACKEND_URL;
|
|
12499
13148
|
function normalizeBackendUrl(url) {
|
|
12500
13149
|
return url.trim().replace(/\/swagger\.json\/?$/i, "");
|
|
12501
13150
|
}
|
|
@@ -12508,15 +13157,15 @@ function resolvedAuthUrl(authUrl, fallbackAuthUrl) {
|
|
|
12508
13157
|
const trimmed = authUrl.trim();
|
|
12509
13158
|
return trimmed || fallbackAuthUrl;
|
|
12510
13159
|
}
|
|
12511
|
-
function resolvedBackendUrl(backendUrl) {
|
|
13160
|
+
function resolvedBackendUrl(backendUrl, fallbackBackendUrl = DEFAULT_LOCAL_BACKEND_URL) {
|
|
12512
13161
|
const normalized = normalizeBackendUrl(backendUrl);
|
|
12513
|
-
return normalized ||
|
|
13162
|
+
return normalized || fallbackBackendUrl;
|
|
12514
13163
|
}
|
|
12515
13164
|
function activeHosts(target) {
|
|
12516
|
-
return target.environment.
|
|
13165
|
+
return target.environment.hosts;
|
|
12517
13166
|
}
|
|
12518
13167
|
function activeBackendUrl(target) {
|
|
12519
|
-
return target.environment.
|
|
13168
|
+
return target.environment.hosts.backendUrl;
|
|
12520
13169
|
}
|
|
12521
13170
|
function loadBackendUrl(stored) {
|
|
12522
13171
|
const backend = typeof stored.backendUrl === "string" ? stored.backendUrl.trim() : "";
|
|
@@ -12530,56 +13179,44 @@ function loadBackendUrl(stored) {
|
|
|
12530
13179
|
}
|
|
12531
13180
|
}
|
|
12532
13181
|
var asHostString = (value) => typeof value === "string" ? value.trim() : "";
|
|
12533
|
-
var
|
|
12534
|
-
var normalizeStoredAuthUrl = (authUrl,
|
|
13182
|
+
var LEGACY_LOCAL_DEV_AUTH_URL = "https://api.magmonium.com";
|
|
13183
|
+
var normalizeStoredAuthUrl = (authUrl, preset, fallback) => {
|
|
12535
13184
|
const resolved = authUrl || fallback.authUrl;
|
|
12536
|
-
if (
|
|
13185
|
+
if (preset !== "prod" && resolved === LEGACY_LOCAL_DEV_AUTH_URL) {
|
|
12537
13186
|
return fallback.authUrl;
|
|
12538
13187
|
}
|
|
12539
13188
|
return resolved;
|
|
12540
13189
|
};
|
|
12541
|
-
var loadHosts = (value,
|
|
13190
|
+
var loadHosts = (value, preset) => {
|
|
13191
|
+
const fallback = presetHosts(preset);
|
|
12542
13192
|
if (!value || typeof value !== "object") return { ...fallback };
|
|
12543
13193
|
const raw = value;
|
|
12544
13194
|
return {
|
|
12545
13195
|
authUrl: normalizeStoredAuthUrl(
|
|
12546
13196
|
asHostString(raw.authUrl),
|
|
12547
|
-
|
|
13197
|
+
preset,
|
|
12548
13198
|
fallback
|
|
12549
13199
|
),
|
|
12550
13200
|
backendUrl: asHostString(raw.backendUrl) || fallback.backendUrl,
|
|
12551
13201
|
socketUrl: asHostString(raw.socketUrl) || fallback.socketUrl
|
|
12552
13202
|
};
|
|
12553
13203
|
};
|
|
13204
|
+
var isPreset = (value) => ENVIRONMENT_PRESETS.includes(value);
|
|
12554
13205
|
function loadEnvironment(stored, legacySocketUrl = "") {
|
|
12555
13206
|
const raw = stored.environment;
|
|
12556
13207
|
if (raw && typeof raw === "object") {
|
|
12557
13208
|
const env = raw;
|
|
12558
|
-
if (env.
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
prod: loadHosts(env.prod, defaultProdHosts(), "prod"),
|
|
12562
|
-
dev: loadHosts(env.dev, defaultDevHosts(), "dev")
|
|
12563
|
-
};
|
|
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) };
|
|
12564
13212
|
}
|
|
12565
|
-
|
|
12566
|
-
const dev = loadHosts(env.dev, defaultDevHosts(), "dev");
|
|
12567
|
-
const activeKey = env.active === "prod" ? "prod" : "dev";
|
|
12568
|
-
const fromActive = activeKey === "prod" ? prod : dev;
|
|
12569
|
-
return {
|
|
12570
|
-
normal: { ...fromActive },
|
|
12571
|
-
prod,
|
|
12572
|
-
// Old "dev" was localhost-oriented; hosted-dev defaults when the old
|
|
12573
|
-
// active was already that localhost set copied into normal.
|
|
12574
|
-
dev: activeKey === "dev" ? defaultDevHosts() : dev
|
|
12575
|
-
};
|
|
13213
|
+
return { preset: "prod", hosts: loadHosts(env.prod, "prod") };
|
|
12576
13214
|
}
|
|
12577
13215
|
const legacyBackend = loadBackendUrl(stored);
|
|
13216
|
+
const legacySocket = legacySocketUrl.trim();
|
|
12578
13217
|
return defaultEnvironment({
|
|
12579
|
-
|
|
12580
|
-
|
|
12581
|
-
socketUrl: legacySocketUrl.trim() || defaultNormalHosts().socketUrl
|
|
12582
|
-
}
|
|
13218
|
+
...legacyBackend && { backendUrl: legacyBackend },
|
|
13219
|
+
...legacySocket && { socketUrl: legacySocket }
|
|
12583
13220
|
});
|
|
12584
13221
|
}
|
|
12585
13222
|
function appDisplayName(appName) {
|
|
@@ -12616,6 +13253,13 @@ var bumpVersion = (version3, bump) => {
|
|
|
12616
13253
|
if (bump === "minor") return `${major}.${minor + 1}.0`;
|
|
12617
13254
|
return `${major}.${minor}.${patch + 1}`;
|
|
12618
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
|
+
};
|
|
12619
13263
|
var WC_ENVIRONMENTS = ["dev", "prod"];
|
|
12620
13264
|
|
|
12621
13265
|
// libs/codegen/src/lib/app-target-storage.ts
|
|
@@ -12639,7 +13283,9 @@ function loadAppTarget(storage) {
|
|
|
12639
13283
|
appName: asString(stored.appName),
|
|
12640
13284
|
appPath: asString(stored.appPath),
|
|
12641
13285
|
environment: loadEnvironment(stored, legacySocketFromWc(storage)),
|
|
12642
|
-
...typeof stored.appId === "string" && stored.appId ? { appId: stored.appId } : {}
|
|
13286
|
+
...typeof stored.appId === "string" && stored.appId ? { appId: stored.appId } : {},
|
|
13287
|
+
// A Plugin App reopens as one; any other word reads as an ordinary app.
|
|
13288
|
+
...stored.kind === "plugin" ? { kind: "plugin" } : {}
|
|
12643
13289
|
};
|
|
12644
13290
|
}
|
|
12645
13291
|
function saveAppTarget(storage, target) {
|
|
@@ -12970,18 +13616,24 @@ var FORMAT_PIPE_FORM = {
|
|
|
12970
13616
|
var TEXT_SOURCE = {
|
|
12971
13617
|
translated: "translated",
|
|
12972
13618
|
static: "static",
|
|
12973
|
-
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"
|
|
12974
13624
|
};
|
|
12975
13625
|
var TEXT_SOURCES = [
|
|
12976
13626
|
TEXT_SOURCE.translated,
|
|
12977
13627
|
TEXT_SOURCE.static,
|
|
12978
|
-
TEXT_SOURCE.dynamic
|
|
13628
|
+
TEXT_SOURCE.dynamic,
|
|
13629
|
+
TEXT_SOURCE.function
|
|
12979
13630
|
];
|
|
12980
13631
|
var STAT_TEXT_SOURCES = [
|
|
12981
13632
|
TEXT_SOURCE.translated,
|
|
12982
|
-
TEXT_SOURCE.dynamic
|
|
13633
|
+
TEXT_SOURCE.dynamic,
|
|
13634
|
+
TEXT_SOURCE.function
|
|
12983
13635
|
];
|
|
12984
|
-
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 */;
|
|
12985
13637
|
var textSourcesFor = (type) => type === "stat" /* STAT */ ? STAT_TEXT_SOURCES : TEXT_SOURCES;
|
|
12986
13638
|
var admitsTextSource = (type, source) => hasTextSource(type) && textSourcesFor(type).includes(source);
|
|
12987
13639
|
var NO_TRANSLATE_CONFIG_KEY = "noTranslate";
|
|
@@ -12990,7 +13642,9 @@ var isTextSource = (value) => TEXT_SOURCES.includes(value);
|
|
|
12990
13642
|
var textSourceOf = (control) => {
|
|
12991
13643
|
if (!control) return TEXT_SOURCE.translated;
|
|
12992
13644
|
if (control.textSource) return control.textSource;
|
|
12993
|
-
|
|
13645
|
+
const label = control.bindings?.[BINDING_SLOT.label];
|
|
13646
|
+
if (label?.source === "function") return TEXT_SOURCE.function;
|
|
13647
|
+
if (label) return TEXT_SOURCE.dynamic;
|
|
12994
13648
|
return control.configs?.[NO_TRANSLATE_CONFIG_KEY] === true ? TEXT_SOURCE.static : TEXT_SOURCE.translated;
|
|
12995
13649
|
};
|
|
12996
13650
|
var textSourceConfigs = (source) => ({
|
|
@@ -13110,6 +13764,13 @@ var staticCanvasLiteral = (control) => {
|
|
|
13110
13764
|
return raw === void 0 || raw === null || raw === "" ? void 0 : String(raw);
|
|
13111
13765
|
};
|
|
13112
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
|
+
}
|
|
13113
13774
|
const head = rootDisplayName(binding.root, scope);
|
|
13114
13775
|
if (!head) return "";
|
|
13115
13776
|
const names = [];
|
|
@@ -13176,10 +13837,8 @@ var authSlotMap = (bindings) => {
|
|
|
13176
13837
|
};
|
|
13177
13838
|
var rootDisplayName = (root, scope) => {
|
|
13178
13839
|
switch (root.kind) {
|
|
13179
|
-
case "alias":
|
|
13180
|
-
|
|
13181
|
-
return root.alias === "index" ? spec.indexAlias : spec.itemAlias;
|
|
13182
|
-
}
|
|
13840
|
+
case "alias":
|
|
13841
|
+
return aliasDisplayName(root.repeatId, root.alias, scope);
|
|
13183
13842
|
case "input":
|
|
13184
13843
|
return scope.inputs?.[root.id]?.name;
|
|
13185
13844
|
case "screen_computed":
|
|
@@ -13190,6 +13849,9 @@ var rootDisplayName = (root, scope) => {
|
|
|
13190
13849
|
return scope.formModels?.[root.id]?.name;
|
|
13191
13850
|
case "auth":
|
|
13192
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;
|
|
13193
13855
|
// A StateComputed resolves as a synthetic property wherever the editor
|
|
13194
13856
|
// reads paths (ADR 0047), so one lookup answers for both store roots.
|
|
13195
13857
|
default:
|
|
@@ -13313,9 +13975,12 @@ function computeMemberRead(fn, member, shapes) {
|
|
|
13313
13975
|
const names = [];
|
|
13314
13976
|
for (const keyId of member ?? []) {
|
|
13315
13977
|
if (cardinality !== "one" || dataType?.type !== "shape") return void 0;
|
|
13316
|
-
const
|
|
13978
|
+
const shape = shapes[dataType.shapeId];
|
|
13979
|
+
const key2 = shape?.keys.find(
|
|
13980
|
+
(k) => k.id === keyId
|
|
13981
|
+
);
|
|
13317
13982
|
if (!key2) return void 0;
|
|
13318
|
-
names.push(key2
|
|
13983
|
+
names.push(memberToken(shape, key2));
|
|
13319
13984
|
dataType = key2.dataType;
|
|
13320
13985
|
cardinality = key2.cardinality;
|
|
13321
13986
|
}
|
|
@@ -13352,6 +14017,45 @@ function computeTextPaths(computes, functions, shapes) {
|
|
|
13352
14017
|
}
|
|
13353
14018
|
return out;
|
|
13354
14019
|
}
|
|
14020
|
+
function computeInputPaths(computes, functions, shapes) {
|
|
14021
|
+
const out = [];
|
|
14022
|
+
for (const compute of computes) {
|
|
14023
|
+
const fn = functions[compute.functionId];
|
|
14024
|
+
const name3 = compute.name.trim();
|
|
14025
|
+
if (!fn || !name3) continue;
|
|
14026
|
+
const walk = (member, label, dataType, cardinality, seen) => {
|
|
14027
|
+
out.push({ name: name3, member, label, dataType, cardinality });
|
|
14028
|
+
if (cardinality !== "one" || dataType?.type !== "shape") return;
|
|
14029
|
+
const shape = shapes[dataType.shapeId];
|
|
14030
|
+
if (!shape || seen.has(dataType.shapeId)) return;
|
|
14031
|
+
const next = new Set(seen).add(dataType.shapeId);
|
|
14032
|
+
for (const key2 of shape.keys) {
|
|
14033
|
+
walk(
|
|
14034
|
+
[...member, key2.id],
|
|
14035
|
+
`${label}.${key2.name}`,
|
|
14036
|
+
key2.dataType,
|
|
14037
|
+
key2.cardinality,
|
|
14038
|
+
next
|
|
14039
|
+
);
|
|
14040
|
+
}
|
|
14041
|
+
};
|
|
14042
|
+
walk([], name3, fn.returnType, fn.returnCardinality, /* @__PURE__ */ new Set());
|
|
14043
|
+
}
|
|
14044
|
+
return out;
|
|
14045
|
+
}
|
|
14046
|
+
function computeInputMemberError(method, functions, shapes) {
|
|
14047
|
+
for (const mapping of method.inputs) {
|
|
14048
|
+
if (mapping.source !== "compute" || !mapping.member?.length) continue;
|
|
14049
|
+
const compute = (method.computes ?? []).find(
|
|
14050
|
+
(c) => c.name === mapping.compute
|
|
14051
|
+
);
|
|
14052
|
+
const fn = compute && functions[compute.functionId];
|
|
14053
|
+
if (!fn || !computeMemberRead(fn, mapping.member, shapes)) {
|
|
14054
|
+
return "input-incomplete";
|
|
14055
|
+
}
|
|
14056
|
+
}
|
|
14057
|
+
return void 0;
|
|
14058
|
+
}
|
|
13355
14059
|
function computeIsRead(method, name3) {
|
|
13356
14060
|
const wanted = name3.trim();
|
|
13357
14061
|
if (!wanted) return false;
|
|
@@ -13779,6 +14483,27 @@ function isUsableTranslation(sourceText, langText) {
|
|
|
13779
14483
|
const repaired = repairTranslationMarkup(sourceText, langText);
|
|
13780
14484
|
return !hasVariableDrift(variableDrift(sourceText, repaired)) && !hasLinkDrift(linkDrift(sourceText, repaired));
|
|
13781
14485
|
}
|
|
14486
|
+
function pruneOrphanMessageBindings(control, translations) {
|
|
14487
|
+
const bindings = control.bindings;
|
|
14488
|
+
if (!bindings) return control;
|
|
14489
|
+
const named = /* @__PURE__ */ new Set();
|
|
14490
|
+
for (const configKey of TRANSLATION_CONFIG_KEYS) {
|
|
14491
|
+
const value = control.configs?.[configKey];
|
|
14492
|
+
const { key: key2 } = parseLabelValue(
|
|
14493
|
+
typeof value === "string" ? value : void 0
|
|
14494
|
+
);
|
|
14495
|
+
if (!key2) continue;
|
|
14496
|
+
const text2 = translations[key2]?.[SOURCE_LANG];
|
|
14497
|
+
if (text2 === void 0) return control;
|
|
14498
|
+
extractAllVariables(text2).forEach(({ name: name3 }) => named.add(name3));
|
|
14499
|
+
}
|
|
14500
|
+
const kept = Object.entries(bindings).filter(
|
|
14501
|
+
([slot]) => !isMessageSlot(slot) || named.has(messageSlotName(slot))
|
|
14502
|
+
);
|
|
14503
|
+
if (kept.length === Object.keys(bindings).length) return control;
|
|
14504
|
+
const { bindings: _dropped, ...rest } = control;
|
|
14505
|
+
return kept.length ? { ...rest, bindings: Object.fromEntries(kept) } : rest;
|
|
14506
|
+
}
|
|
13782
14507
|
function unfilledVariables(configValue, translations, samples, bound = []) {
|
|
13783
14508
|
const { key: key2, params } = parseLabelValue(configValue);
|
|
13784
14509
|
if (!key2) return [];
|
|
@@ -14150,8 +14875,9 @@ var classCardScope = (scope) => ({
|
|
|
14150
14875
|
var memberExpression = (member, itemLocal, indexLocal, shapeId, shapes) => {
|
|
14151
14876
|
if (member.kind === "item") return itemLocal;
|
|
14152
14877
|
if (member.kind === "index") return indexLocal;
|
|
14153
|
-
const
|
|
14154
|
-
|
|
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;
|
|
14155
14881
|
};
|
|
14156
14882
|
var cardEmit = (node, control, scope, screenRef) => {
|
|
14157
14883
|
if (!isCardHolder(control)) return void 0;
|
|
@@ -14381,12 +15107,29 @@ function modalConfigEntry(open, indent2) {
|
|
|
14381
15107
|
${keys.map((key2) => `${indent2} ${key2}`).join("\n")}
|
|
14382
15108
|
${indent2}},`;
|
|
14383
15109
|
}
|
|
14384
|
-
function mappingExpression(mapping, target, properties, shapes, functions, receiverOf = OWN_STORE) {
|
|
15110
|
+
function mappingExpression(mapping, target, properties, shapes, functions, computes, receiverOf = OWN_STORE) {
|
|
14385
15111
|
let source;
|
|
14386
15112
|
if (mapping.source === "args") source = `${mapping.arg}`;
|
|
14387
|
-
else if (mapping.source === "compute")
|
|
14388
|
-
|
|
14389
|
-
|
|
15113
|
+
else if (mapping.source === "compute") {
|
|
15114
|
+
const compute = computes.find((c) => c.name === mapping.compute);
|
|
15115
|
+
const fn = compute && functions[compute.functionId];
|
|
15116
|
+
const absent = !!fn?.returnUndefined;
|
|
15117
|
+
const waits = absent && target.required;
|
|
15118
|
+
source = `compute.${mapping.compute}`;
|
|
15119
|
+
if (mapping.member?.length) {
|
|
15120
|
+
const member = fn ? computeMemberRead(fn, mapping.member, shapes) : void 0;
|
|
15121
|
+
if (!fn || !member) return void 0;
|
|
15122
|
+
const dot = absent && !waits ? "?." : ".";
|
|
15123
|
+
source += member.names.map((name3, at) => `${at === 0 && waits ? "!" : ""}${memberStep(dot, name3)}`).join("");
|
|
15124
|
+
} else if (waits) {
|
|
15125
|
+
source += "!";
|
|
15126
|
+
}
|
|
15127
|
+
} else if (mapping.source === "fixed") {
|
|
15128
|
+
source = fixedExpression(
|
|
15129
|
+
mapping.value ?? "",
|
|
15130
|
+
target.dataType,
|
|
15131
|
+
target.cardinality
|
|
15132
|
+
);
|
|
14390
15133
|
} else {
|
|
14391
15134
|
source = statePathExpression(
|
|
14392
15135
|
mapping.path ?? [],
|
|
@@ -14424,6 +15167,7 @@ function paramExpression(param, method, targets, properties, shapes, functions,
|
|
|
14424
15167
|
properties,
|
|
14425
15168
|
shapes,
|
|
14426
15169
|
functions,
|
|
15170
|
+
method.computes ?? [],
|
|
14427
15171
|
receiverOf
|
|
14428
15172
|
);
|
|
14429
15173
|
};
|
|
@@ -14692,11 +15436,14 @@ function patchLiteral(mappings, properties, shapes, functions, subject, cast = f
|
|
|
14692
15436
|
return { receiver, key: property.name, value: mapping.arg };
|
|
14693
15437
|
}
|
|
14694
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}`;
|
|
14695
15442
|
const keyed = mapping.keyBy ? property.cardinality === "map-many" ? `(${castRead(read, cast, "unknown[]")} ?? []).reduce<${tsTypeExpression(
|
|
14696
15443
|
shapes,
|
|
14697
15444
|
property.dataType,
|
|
14698
15445
|
property.cardinality
|
|
14699
|
-
)}>((acc, item) => { (acc[
|
|
15446
|
+
)}>((acc, item) => { (acc[${keyRead}] ??= []).push(item); return acc; }, {})` : `Object.fromEntries((${castRead(read, cast, "unknown[]")} ?? []).map((item) => [${keyRead}, item]))` : void 0;
|
|
14700
15447
|
const value = keyed ?? castRead(
|
|
14701
15448
|
read,
|
|
14702
15449
|
cast,
|
|
@@ -15499,6 +16246,24 @@ ${computeLines.map((line) => ` ${line}`).join("\n")}
|
|
|
15499
16246
|
return { ${args.length ? `...${guardReceiver}, ` : ""}compute: { ${computes.map((compute) => compute.name).join(", ")} } };
|
|
15500
16247
|
}),` : "";
|
|
15501
16248
|
if (computes.length) emitsMap = true;
|
|
16249
|
+
const computeValueGuards = method.inputs.flatMap((mapping) => {
|
|
16250
|
+
if (mapping.source !== "compute" || !mapping.compute) return [];
|
|
16251
|
+
const target = targets.find(
|
|
16252
|
+
(t) => t.label === targetKey2(mapping.target) && t.required
|
|
16253
|
+
);
|
|
16254
|
+
if (!target) return [];
|
|
16255
|
+
const compute = computes.find((c) => c.name === mapping.compute);
|
|
16256
|
+
const fn = compute && functions[compute.functionId];
|
|
16257
|
+
if (!fn?.returnUndefined) return [];
|
|
16258
|
+
const read = `${COMPUTE_BAG}.${mapping.compute}`;
|
|
16259
|
+
return [
|
|
16260
|
+
target.cardinality === "many" ? `!!${read}?.length` : `${read} !== undefined`
|
|
16261
|
+
];
|
|
16262
|
+
});
|
|
16263
|
+
const computeValueGuardBlock = computeValueGuards.length ? `
|
|
16264
|
+
filter(({ ${COMPUTE_BAG} }) => ${Array.from(
|
|
16265
|
+
new Set(computeValueGuards)
|
|
16266
|
+
).join(" && ")}),` : "";
|
|
15502
16267
|
const confirm = drawnConfirm(method);
|
|
15503
16268
|
const confirmParams = {};
|
|
15504
16269
|
for (const [slot, binding] of Object.entries(confirm?.params ?? {})) {
|
|
@@ -15509,7 +16274,7 @@ ${computeLines.map((line) => ` ${line}`).join("\n")}
|
|
|
15509
16274
|
const member = computeMemberRead(fn, binding.member, shapes);
|
|
15510
16275
|
if (!member) continue;
|
|
15511
16276
|
const dot = fn.returnUndefined ? "?." : ".";
|
|
15512
|
-
const read2 = `${confirmReceiver}.compute.${binding.name}${member.names.map((name3) =>
|
|
16277
|
+
const read2 = `${confirmReceiver}.compute.${binding.name}${member.names.map((name3) => memberStep(dot, name3)).join("")}`;
|
|
15513
16278
|
const isText2 = member.dataType?.type === "string" && member.cardinality === "one";
|
|
15514
16279
|
if (fn.returnUndefined) {
|
|
15515
16280
|
confirmParams[slot] = isText2 ? `${read2} ?? ''` : `String(${read2} ?? '')`;
|
|
@@ -15577,7 +16342,7 @@ ${beforePersists.map((line) => ` ${line}`).join("\n")}
|
|
|
15577
16342
|
version: op.version,
|
|
15578
16343
|
segments: op.segments,
|
|
15579
16344
|
args,
|
|
15580
|
-
waits: guards.length > guardArgs.size || !!conditionBlock || !!computeGuardBlock || emitsOpen,
|
|
16345
|
+
waits: guards.length > guardArgs.size || !!conditionBlock || !!computeGuardBlock || !!computeValueGuardBlock || emitsOpen,
|
|
15581
16346
|
...debounceBlock && method.debounce ? { debounce: Math.round(method.debounce.seconds * 1e3) } : {},
|
|
15582
16347
|
confirms: !!confirmBlock,
|
|
15583
16348
|
ok: {
|
|
@@ -15609,7 +16374,7 @@ ${beforePersists.map((line) => ` ${line}`).join("\n")}
|
|
|
15609
16374
|
// ends — `finalize` fires on success, on error and when a later call
|
|
15610
16375
|
// replaces it, so the wait never outlives the request (ADR 0139).
|
|
15611
16376
|
` ${method.name}: rxMethod<${argType}>(
|
|
15612
|
-
pipe(${debounceBlock}${guardBlock}${conditionBlock}${computeGuardBlock}${computeBlock}${confirmBlock}${beforeBlock}
|
|
16377
|
+
pipe(${debounceBlock}${guardBlock}${conditionBlock}${computeGuardBlock}${computeBlock}${computeValueGuardBlock}${confirmBlock}${beforeBlock}
|
|
15613
16378
|
switchMap(${callArgName} => {${settleOnly ? `
|
|
15614
16379
|
const { onSent, onSettled } = (input || {}) as { ${SETTLE_MEMBERS.join("; ")} };` : ""}
|
|
15615
16380
|
onSent?.();
|
|
@@ -15620,7 +16385,7 @@ ${beforePersists.map((line) => ` ${line}`).join("\n")}
|
|
|
15620
16385
|
)
|
|
15621
16386
|
),`
|
|
15622
16387
|
) : ` ${method.name}: rxMethod<${argType}>(
|
|
15623
|
-
pipe(${debounceBlock}${guardBlock}${conditionBlock}${computeGuardBlock}${computeBlock}${confirmBlock}${beforeBlock}
|
|
16388
|
+
pipe(${debounceBlock}${guardBlock}${conditionBlock}${computeGuardBlock}${computeBlock}${computeValueGuardBlock}${confirmBlock}${beforeBlock}
|
|
15624
16389
|
switchMap(${callArgName} =>
|
|
15625
16390
|
${apiCall}.pipe(${tapBlock}${catchBlock}
|
|
15626
16391
|
)
|
|
@@ -16418,7 +17183,7 @@ function screenMemberOptions(scope, dataType, cardinality, required, byName) {
|
|
|
16418
17183
|
}));
|
|
16419
17184
|
return [...inputs, ...variables, ...constants, ...computeds];
|
|
16420
17185
|
}
|
|
16421
|
-
var
|
|
17186
|
+
var sameType6 = (candidate, declared) => {
|
|
16422
17187
|
if (candidate?.type !== declared.type) return false;
|
|
16423
17188
|
return declared.type === "shape" ? candidate.type === "shape" && candidate.shapeId === declared.shapeId : true;
|
|
16424
17189
|
};
|
|
@@ -16430,7 +17195,7 @@ function dataOptions(scope, want) {
|
|
|
16430
17195
|
const listedAsMember = !!want.dataType;
|
|
16431
17196
|
return bindingOptions(
|
|
16432
17197
|
data,
|
|
16433
|
-
(candidate, rowCardinality) => rowCardinality === cardinality &&
|
|
17198
|
+
(candidate, rowCardinality) => rowCardinality === cardinality && sameType6(candidate, declared)
|
|
16434
17199
|
).filter(
|
|
16435
17200
|
({ binding }) => !(listedAsMember && binding.path.length === 0 && memberRoots.has(binding.root.kind))
|
|
16436
17201
|
).map(({ value, label, binding }) => ({
|
|
@@ -16595,8 +17360,8 @@ function validateOutputOpen(open, screens, payload, hostInputs, constants = {},
|
|
|
16595
17360
|
const filled = new Set(outputOpenInputs(open).map((row) => row.inputId));
|
|
16596
17361
|
return declared.some((input) => input.required && !filled.has(input.id)) ? "open-input-unmapped" : void 0;
|
|
16597
17362
|
}
|
|
16598
|
-
var
|
|
16599
|
-
var
|
|
17363
|
+
var IDENTIFIER5 = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
17364
|
+
var memberAccess6 = (segment) => IDENTIFIER5.test(segment) ? `.${segment}` : `['${segment}']`;
|
|
16600
17365
|
function valueExpression3(value, input, payload, hostInputs, constants, eventRoot, self, eventMember, renderMember = () => void 0, renderBinding = () => void 0) {
|
|
16601
17366
|
if (value.kind === "clear") return "undefined";
|
|
16602
17367
|
if (value.kind === "screen")
|
|
@@ -16614,7 +17379,7 @@ function valueExpression3(value, input, payload, hostInputs, constants, eventRoo
|
|
|
16614
17379
|
if (value.kind === "toggle") return void 0;
|
|
16615
17380
|
if (payload === "void") return void 0;
|
|
16616
17381
|
if (payload !== "record" || !value.path?.length) return eventRoot;
|
|
16617
|
-
const read = `$event${value.path.map(
|
|
17382
|
+
const read = `$event${value.path.map(memberAccess6).join("")}`;
|
|
16618
17383
|
return eventMember ? eventMember(value.path, read, "$event", input.cardinality, input.dataType) : read;
|
|
16619
17384
|
}
|
|
16620
17385
|
var outputOpenReadsEvent = (open) => !!open && outputOpenInputs(open).some((row) => row.value.kind === "event");
|
|
@@ -16840,7 +17605,19 @@ function generateSearchFeed(storeKey, feed, properties, shapes, functions = {},
|
|
|
16840
17605
|
if (!title) return { block: "", needsSearch: false };
|
|
16841
17606
|
const item = "item";
|
|
16842
17607
|
const index = "index";
|
|
16843
|
-
const read = (path) =>
|
|
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
|
+
};
|
|
16844
17621
|
const collection = `store.${property.name}() ?? []`;
|
|
16845
17622
|
const optional = (path) => path ? resolveSearchFeedMember(path, property.dataType, shapes) : void 0;
|
|
16846
17623
|
const id = optional(feed.id);
|
|
@@ -16893,8 +17670,8 @@ var isTimerComplete = (timer) => timerError(timer) === void 0;
|
|
|
16893
17670
|
// libs/codegen/src/lib/timer-codegen.ts
|
|
16894
17671
|
var ms = (seconds) => `${Math.round(seconds * 1e3)}`;
|
|
16895
17672
|
var indentBy = (block2, steps) => {
|
|
16896
|
-
const
|
|
16897
|
-
return block2.split("\n").map((line) => line.trim() ? `${
|
|
17673
|
+
const pad2 = " ".repeat(steps * 2);
|
|
17674
|
+
return block2.split("\n").map((line) => line.trim() ? `${pad2}${line}` : line).join("\n");
|
|
16898
17675
|
};
|
|
16899
17676
|
function endStatements(timer, properties, writeCall) {
|
|
16900
17677
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -16915,7 +17692,7 @@ function endStatements(timer, properties, writeCall) {
|
|
|
16915
17692
|
}
|
|
16916
17693
|
return statements;
|
|
16917
17694
|
}
|
|
16918
|
-
function timerBlock(timer, properties, shapes, roots, mint, writeCall) {
|
|
17695
|
+
function timerBlock(timer, properties, shapes, roots, mint, writeCall, functions) {
|
|
16919
17696
|
const oneShot = timer.kind === "timeout";
|
|
16920
17697
|
const schedule = oneShot ? "setTimeout" : "setInterval";
|
|
16921
17698
|
const cancel = oneShot ? "clearTimeout" : "clearInterval";
|
|
@@ -16928,7 +17705,9 @@ function timerBlock(timer, properties, shapes, roots, mint, writeCall) {
|
|
|
16928
17705
|
roots,
|
|
16929
17706
|
shapes,
|
|
16930
17707
|
true,
|
|
16931
|
-
"store."
|
|
17708
|
+
"store.",
|
|
17709
|
+
"",
|
|
17710
|
+
functions
|
|
16932
17711
|
);
|
|
16933
17712
|
const durationProperty = timer.duration?.kind === "state" ? properties[timer.duration.propertyId] : void 0;
|
|
16934
17713
|
const durationLocal = durationProperty ? mint(`${timer.name}Seconds`) : "";
|
|
@@ -16988,15 +17767,21 @@ ${scheduled.map((line) => indentBy(line, 5)).join("\n")}
|
|
|
16988
17767
|
});
|
|
16989
17768
|
});`;
|
|
16990
17769
|
}
|
|
16991
|
-
function generateTimers(timers, properties, shapes, roots, mint, writeCall) {
|
|
17770
|
+
function generateTimers(timers, properties, shapes, roots, mint, writeCall, functions = {}) {
|
|
16992
17771
|
const drawn = Object.values(timers).filter(isTimerComplete).sort((a, b) => a.name.localeCompare(b.name));
|
|
16993
17772
|
const blocks = drawn.map(
|
|
16994
|
-
(timer) => timerBlock(timer, properties, shapes, roots, mint, writeCall)
|
|
17773
|
+
(timer) => timerBlock(timer, properties, shapes, roots, mint, writeCall, functions)
|
|
16995
17774
|
).filter(Boolean);
|
|
16996
17775
|
return {
|
|
16997
17776
|
blocks,
|
|
16998
17777
|
needsUntracked: blocks.length > 0,
|
|
16999
|
-
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
|
+
)
|
|
17000
17785
|
};
|
|
17001
17786
|
}
|
|
17002
17787
|
|
|
@@ -17236,7 +18021,8 @@ function generateStoreHook(featureName, hook, properties, shapes, methods, opera
|
|
|
17236
18021
|
shapes,
|
|
17237
18022
|
timerTaken,
|
|
17238
18023
|
casts
|
|
17239
|
-
)
|
|
18024
|
+
),
|
|
18025
|
+
functions
|
|
17240
18026
|
);
|
|
17241
18027
|
const body = [
|
|
17242
18028
|
...effects,
|
|
@@ -17255,7 +18041,8 @@ function generateStoreHook(featureName, hook, properties, shapes, methods, opera
|
|
|
17255
18041
|
needsFeed: false,
|
|
17256
18042
|
needsUntracked: false,
|
|
17257
18043
|
shapeTypes: [],
|
|
17258
|
-
globalStores: []
|
|
18044
|
+
globalStores: [],
|
|
18045
|
+
ruleFunctions: []
|
|
17259
18046
|
};
|
|
17260
18047
|
}
|
|
17261
18048
|
const callsRead = (hook?.calls ?? []).some(
|
|
@@ -17299,7 +18086,8 @@ ${storageLine}${searchLine}${searchStoreLine}${globalStoreLines}${body.join("\n"
|
|
|
17299
18086
|
// A StoreHookRead's cast and a `storage` call-arg row's are both the hook
|
|
17300
18087
|
// naming an interface the api half may never mention (ADR 0060).
|
|
17301
18088
|
shapeTypes: namedShapes(shapes, [...reads.typed, ...casts]),
|
|
17302
|
-
globalStores: timerEmission.globalStores
|
|
18089
|
+
globalStores: timerEmission.globalStores,
|
|
18090
|
+
ruleFunctions: timerEmission.functions
|
|
17303
18091
|
};
|
|
17304
18092
|
}
|
|
17305
18093
|
var usesStorage = (properties) => heldProperties(properties).length > 0;
|
|
@@ -17563,8 +18351,8 @@ function validateScreenEmits(outputs, rows, payload, fieldNames, inputs, constan
|
|
|
17563
18351
|
}
|
|
17564
18352
|
return void 0;
|
|
17565
18353
|
}
|
|
17566
|
-
var
|
|
17567
|
-
var
|
|
18354
|
+
var IDENTIFIER6 = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
18355
|
+
var memberAccess7 = (segment) => IDENTIFIER6.test(segment) ? `.${segment}` : `['${segment}']`;
|
|
17568
18356
|
var valueExpression4 = (value, output, payload, inputs, constants, eventRoot, self, eventMember, bindings) => {
|
|
17569
18357
|
if (value.kind === "binding") {
|
|
17570
18358
|
if (bindings?.scope?.memberPrefix && value.binding.root.kind === "alias") {
|
|
@@ -17586,7 +18374,7 @@ var valueExpression4 = (value, output, payload, inputs, constants, eventRoot, se
|
|
|
17586
18374
|
return input ? `${self}${input.name}()` : void 0;
|
|
17587
18375
|
}
|
|
17588
18376
|
if (payload !== "record" || !value.path?.length) return eventRoot;
|
|
17589
|
-
const read = `$event${value.path.map(
|
|
18377
|
+
const read = `$event${value.path.map(memberAccess7).join("")}`;
|
|
17590
18378
|
return eventMember && output.payload ? eventMember(
|
|
17591
18379
|
value.path,
|
|
17592
18380
|
read,
|
|
@@ -17784,12 +18572,23 @@ function toSectionTableColumns(value) {
|
|
|
17784
18572
|
if (DATA_TYPES.includes(raw["dataType"])) {
|
|
17785
18573
|
column.dataType = raw["dataType"];
|
|
17786
18574
|
}
|
|
18575
|
+
if (raw["defaultSort"] === true) column.defaultSort = true;
|
|
18576
|
+
if (raw["ascending"] === true) column.ascending = true;
|
|
17787
18577
|
if (raw["freeze"] === true) column.freeze = true;
|
|
17788
18578
|
if (raw["squeeze"] === true) column.squeeze = true;
|
|
17789
18579
|
return column;
|
|
17790
18580
|
});
|
|
17791
18581
|
}
|
|
17792
|
-
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
|
+
};
|
|
17793
18592
|
var enclosingSectionTable = (control, controlMap) => {
|
|
17794
18593
|
const seen = /* @__PURE__ */ new Set();
|
|
17795
18594
|
let current = control?.parentId ? controlMap[control.parentId] : void 0;
|
|
@@ -17834,7 +18633,7 @@ function syncSectionTableCells(controlMap, tableId, change, genId2) {
|
|
|
17834
18633
|
const next = { ...controlMap };
|
|
17835
18634
|
sectionTableRows(tableId, controlMap).forEach((row) => {
|
|
17836
18635
|
const cells = [...row.childrens];
|
|
17837
|
-
const
|
|
18636
|
+
const pad2 = (length) => {
|
|
17838
18637
|
while (cells.length < length) {
|
|
17839
18638
|
const id = genId2();
|
|
17840
18639
|
next[id] = newCell(id, row.id);
|
|
@@ -17842,7 +18641,7 @@ function syncSectionTableCells(controlMap, tableId, change, genId2) {
|
|
|
17842
18641
|
}
|
|
17843
18642
|
};
|
|
17844
18643
|
if (change.kind === "add") {
|
|
17845
|
-
|
|
18644
|
+
pad2(change.index);
|
|
17846
18645
|
const id = genId2();
|
|
17847
18646
|
next[id] = newCell(id, row.id);
|
|
17848
18647
|
cells.splice(change.index, 0, id);
|
|
@@ -17854,7 +18653,7 @@ function syncSectionTableCells(controlMap, tableId, change, genId2) {
|
|
|
17854
18653
|
);
|
|
17855
18654
|
}
|
|
17856
18655
|
} else {
|
|
17857
|
-
|
|
18656
|
+
pad2(Math.max(change.from, change.to) + 1);
|
|
17858
18657
|
const [moved] = cells.splice(change.from, 1);
|
|
17859
18658
|
cells.splice(change.to, 0, moved);
|
|
17860
18659
|
}
|
|
@@ -17920,52 +18719,6 @@ var collectSearchEmits = (tree, controlMap, screenRef) => {
|
|
|
17920
18719
|
return [...emits.values()];
|
|
17921
18720
|
};
|
|
17922
18721
|
|
|
17923
|
-
// libs/codegen/src/lib/plugin-control-helper.ts
|
|
17924
|
-
var PLUGIN_LINK_KEY = "link";
|
|
17925
|
-
var PLUGIN_SCREEN_KEY = "screen";
|
|
17926
|
-
var PLUGIN_INPUTS_KEY = "pluginInputs";
|
|
17927
|
-
var PLUGIN_OUTPUTS_KEY = "pluginOutputs";
|
|
17928
|
-
var PLUGIN_SOURCE_KEY = "source";
|
|
17929
|
-
var PLUGIN_PORT_KEY = "port";
|
|
17930
|
-
var pluginSourceOf = (configs) => {
|
|
17931
|
-
const source = configs?.[PLUGIN_SOURCE_KEY];
|
|
17932
|
-
return source === "local" || source === "beta" ? source : "published";
|
|
17933
|
-
};
|
|
17934
|
-
var pluginPortOf = (configs) => {
|
|
17935
|
-
const port = Number(configs?.[PLUGIN_PORT_KEY]);
|
|
17936
|
-
return Number.isInteger(port) && port > 0 && port < 65536 ? port : void 0;
|
|
17937
|
-
};
|
|
17938
|
-
var pluginOriginKey = (configs) => {
|
|
17939
|
-
const link = String(configs?.[PLUGIN_LINK_KEY] ?? "").trim();
|
|
17940
|
-
const source = pluginSourceOf(configs);
|
|
17941
|
-
return source === "local" ? `${link}|local|${pluginPortOf(configs) ?? ""}` : `${link}|${source}`;
|
|
17942
|
-
};
|
|
17943
|
-
var IDENTIFIER6 = /^[A-Za-z_$][\w$]*$/;
|
|
17944
|
-
var pluginNamesOf = (configs, key2) => [
|
|
17945
|
-
...new Set(
|
|
17946
|
-
String(configs?.[key2] ?? "").split(/[\s,]+/).map((name3) => name3.trim()).filter((name3) => IDENTIFIER6.test(name3))
|
|
17947
|
-
)
|
|
17948
|
-
];
|
|
17949
|
-
var pluginInputSlot = (name3) => `plugin:${name3}`;
|
|
17950
|
-
var pluginPickWrites = (before, picked, contractOf) => {
|
|
17951
|
-
const after = { ...before, ...picked };
|
|
17952
|
-
const originChanged = pluginOriginKey(after) !== pluginOriginKey(before);
|
|
17953
|
-
if (originChanged) {
|
|
17954
|
-
return {
|
|
17955
|
-
[PLUGIN_SCREEN_KEY]: void 0,
|
|
17956
|
-
[PLUGIN_INPUTS_KEY]: void 0,
|
|
17957
|
-
[PLUGIN_OUTPUTS_KEY]: void 0
|
|
17958
|
-
};
|
|
17959
|
-
}
|
|
17960
|
-
if (!(PLUGIN_SCREEN_KEY in picked)) return {};
|
|
17961
|
-
const screen = String(picked[PLUGIN_SCREEN_KEY] ?? "").trim();
|
|
17962
|
-
const contract = screen ? contractOf(after, screen) : void 0;
|
|
17963
|
-
return {
|
|
17964
|
-
[PLUGIN_INPUTS_KEY]: contract?.inputs.length ? contract.inputs.join(", ") : void 0,
|
|
17965
|
-
[PLUGIN_OUTPUTS_KEY]: contract?.outputs.length ? contract.outputs.join(", ") : void 0
|
|
17966
|
-
};
|
|
17967
|
-
};
|
|
17968
|
-
|
|
17969
18722
|
// libs/codegen/src/lib/message-params-codegen.ts
|
|
17970
18723
|
var messageParamEntries = (node, control, scope) => {
|
|
17971
18724
|
if (!takesMessageParams(node.type)) return [];
|
|
@@ -19030,7 +19783,7 @@ function screenVariantsBlock(variants, inputs, computeds, constants, variables,
|
|
|
19030
19783
|
);
|
|
19031
19784
|
const roots = { ...stateRoots, ...screenRoots2 };
|
|
19032
19785
|
const variantList = Object.values(variants);
|
|
19033
|
-
if (!variantList.length) return "";
|
|
19786
|
+
if (!variantList.length) return { body: "", functions: [] };
|
|
19034
19787
|
const entries = variantList.map(
|
|
19035
19788
|
(variant) => variant.navId !== void 0 ? ` ${variant.name}: ${NAV_REF_MEMBER}?.isNavActive?.('${variant.navId}') ?? false` : ` ${variant.name}: ${generateRuleExpression(
|
|
19036
19789
|
variant.rule,
|
|
@@ -19039,14 +19792,23 @@ function screenVariantsBlock(variants, inputs, computeds, constants, variables,
|
|
|
19039
19792
|
true,
|
|
19040
19793
|
(id) => screenRoots2[id] ? constants[id] ? { prefix: "", isSignal: false } : { prefix: "this.", isSignal: true } : `this.${storeProp}.`,
|
|
19041
19794
|
// A RuleCall asks the root store this class injects (usesAuth).
|
|
19042
|
-
"this."
|
|
19795
|
+
"this.",
|
|
19796
|
+
functions
|
|
19043
19797
|
)}`
|
|
19044
19798
|
);
|
|
19045
|
-
return
|
|
19799
|
+
return {
|
|
19800
|
+
body: `
|
|
19046
19801
|
protected readonly variant = computed(() => ({
|
|
19047
19802
|
${entries.join(",\n")}
|
|
19048
19803
|
}));
|
|
19049
|
-
|
|
19804
|
+
`,
|
|
19805
|
+
functions: ruleFunctionImports(
|
|
19806
|
+
variantList.filter((variant) => variant.navId === void 0).map((variant) => variant.rule),
|
|
19807
|
+
roots,
|
|
19808
|
+
shapes,
|
|
19809
|
+
functions
|
|
19810
|
+
)
|
|
19811
|
+
};
|
|
19050
19812
|
}
|
|
19051
19813
|
function screenVariantGuard(node, variants) {
|
|
19052
19814
|
const held = (node.variants ?? []).map((entry2) => {
|
|
@@ -19578,11 +20340,11 @@ var numberOnlyKeysOf = (type) => {
|
|
|
19578
20340
|
if (type === "section_filter" /* SECTION_FILTER */) return FILTER_NUMBER_ONLY_KEYS;
|
|
19579
20341
|
return NUMBER_ONLY_KEYS;
|
|
19580
20342
|
};
|
|
19581
|
-
function wrapInGuard(markup, guard,
|
|
20343
|
+
function wrapInGuard(markup, guard, pad2) {
|
|
19582
20344
|
if (!guard) return markup;
|
|
19583
|
-
return `${
|
|
20345
|
+
return `${pad2}@if (${guard}) {
|
|
19584
20346
|
${markup}
|
|
19585
|
-
${
|
|
20347
|
+
${pad2}}`;
|
|
19586
20348
|
}
|
|
19587
20349
|
function orderedTreeArms(node) {
|
|
19588
20350
|
const arms = node.childrens.filter(
|
|
@@ -19616,29 +20378,29 @@ function renderBranch(node, indent2, names, methods, operationOf, storeProp, ctx
|
|
|
19616
20378
|
)
|
|
19617
20379
|
).filter(Boolean).join("\n");
|
|
19618
20380
|
if (chain.length === 1 && !chain[0].guard) return body(chain[0].arm, indent2);
|
|
19619
|
-
const
|
|
20381
|
+
const pad2 = " ".repeat(indent2);
|
|
19620
20382
|
const lines = [];
|
|
19621
20383
|
chain.forEach((entry2, index) => {
|
|
19622
20384
|
lines.push(
|
|
19623
|
-
index === 0 ? `${
|
|
20385
|
+
index === 0 ? `${pad2}@if (${entry2.guard}) {` : entry2.guard ? `${pad2}} @else if (${entry2.guard}) {` : `${pad2}} @else {`
|
|
19624
20386
|
);
|
|
19625
20387
|
const inner = body(entry2.arm, indent2 + 1);
|
|
19626
20388
|
if (inner) lines.push(inner);
|
|
19627
20389
|
});
|
|
19628
|
-
lines.push(`${
|
|
20390
|
+
lines.push(`${pad2}}`);
|
|
19629
20391
|
return lines.join("\n");
|
|
19630
20392
|
}
|
|
19631
20393
|
function renderRepeat(node, indent2, names, methods, operationOf, storeProp, ctx, wires, payloads) {
|
|
19632
|
-
const
|
|
20394
|
+
const pad2 = " ".repeat(indent2);
|
|
19633
20395
|
const control = ctx.controlMap?.[node.id];
|
|
19634
20396
|
if (!control) {
|
|
19635
|
-
return `${
|
|
20397
|
+
return `${pad2}<!-- repeat ${node.id}: control is gone; not emitted -->`;
|
|
19636
20398
|
}
|
|
19637
20399
|
const scope = bindingScope(ctx, storeProp);
|
|
19638
20400
|
const header = repeatHeader(control, scope);
|
|
19639
20401
|
if (!header) {
|
|
19640
20402
|
const reason = repeatGapReason(control, scope) ?? "cannot emit here";
|
|
19641
|
-
return `${
|
|
20403
|
+
return `${pad2}<!-- repeat ${node.id}: ${reason}; not emitted -->`;
|
|
19642
20404
|
}
|
|
19643
20405
|
const body = (children, at) => children.map(
|
|
19644
20406
|
(child) => renderNode(
|
|
@@ -19664,22 +20426,25 @@ function renderRepeat(node, indent2, names, methods, operationOf, storeProp, ctx
|
|
|
19664
20426
|
/ of \((.*) \?\? \[\]\); track /,
|
|
19665
20427
|
(_, expr) => ` of ((${expr}) | sectionTableSort: ${sectionTableRef(table.id)}.sort()); track `
|
|
19666
20428
|
) : header;
|
|
19667
|
-
const lines = [`${
|
|
20429
|
+
const lines = [`${pad2}@for (${sorted}) {`];
|
|
20430
|
+
for (const line of repeatEntryLets(control, scope)) {
|
|
20431
|
+
lines.push(`${pad2} ${line}`);
|
|
20432
|
+
}
|
|
19668
20433
|
const inner = body(rows, indent2 + 1);
|
|
19669
20434
|
if (inner) lines.push(inner);
|
|
19670
20435
|
if (empty) {
|
|
19671
20436
|
const emptyInner = body(empty.childrens, indent2 + 1);
|
|
19672
|
-
lines.push(`${
|
|
20437
|
+
lines.push(`${pad2}} @empty {`);
|
|
19673
20438
|
if (emptyInner) lines.push(emptyInner);
|
|
19674
20439
|
}
|
|
19675
|
-
lines.push(`${
|
|
20440
|
+
lines.push(`${pad2}}`);
|
|
19676
20441
|
return lines.join("\n");
|
|
19677
20442
|
}
|
|
19678
20443
|
function renderContent(node, indent2, names, methods, operationOf, storeProp, ctx, wires, payloads) {
|
|
19679
20444
|
const host = ctx.controlMap?.[ctx.controlMap?.[node.id]?.parentId ?? ""];
|
|
19680
20445
|
const slot = contentSlotOf(host);
|
|
19681
20446
|
if (!slot) return "";
|
|
19682
|
-
const
|
|
20447
|
+
const pad2 = " ".repeat(indent2);
|
|
19683
20448
|
const childIndent = slot.kind === "projected" ? indent2 : indent2 + 1;
|
|
19684
20449
|
const children = node.childrens.map(
|
|
19685
20450
|
(child) => renderNode(
|
|
@@ -19696,17 +20461,17 @@ function renderContent(node, indent2, names, methods, operationOf, storeProp, ct
|
|
|
19696
20461
|
).filter(Boolean).join("\n");
|
|
19697
20462
|
if (slot.kind === "projected") {
|
|
19698
20463
|
if (host?.type === "user" /* USER */ && node.configs?.["type"] === "inline") {
|
|
19699
|
-
return `${
|
|
20464
|
+
return `${pad2}<span inline>
|
|
19700
20465
|
${children}
|
|
19701
|
-
${
|
|
20466
|
+
${pad2}</span>`;
|
|
19702
20467
|
}
|
|
19703
20468
|
return children;
|
|
19704
20469
|
}
|
|
19705
20470
|
const open = contentTemplateTag(host);
|
|
19706
20471
|
if (!open) return "";
|
|
19707
|
-
return children ? `${
|
|
20472
|
+
return children ? `${pad2}${open}
|
|
19708
20473
|
${children}
|
|
19709
|
-
${
|
|
20474
|
+
${pad2}</ng-template>` : `${pad2}${open}</ng-template>`;
|
|
19710
20475
|
}
|
|
19711
20476
|
var SLOT_ATTR = {
|
|
19712
20477
|
["stat_value" /* STAT_VALUE */]: "value",
|
|
@@ -19714,7 +20479,7 @@ var SLOT_ATTR = {
|
|
|
19714
20479
|
["section_header_label" /* SECTION_HEADER_LABEL */]: "label"
|
|
19715
20480
|
};
|
|
19716
20481
|
function renderSlot(node, indent2, names, methods, operationOf, storeProp, ctx, wires, payloads) {
|
|
19717
|
-
const
|
|
20482
|
+
const pad2 = " ".repeat(indent2);
|
|
19718
20483
|
const attr = SLOT_ATTR[node.type];
|
|
19719
20484
|
const directives = directiveAttrs(
|
|
19720
20485
|
node,
|
|
@@ -19736,9 +20501,9 @@ function renderSlot(node, indent2, names, methods, operationOf, storeProp, ctx,
|
|
|
19736
20501
|
)
|
|
19737
20502
|
).filter(Boolean).join("\n");
|
|
19738
20503
|
if (!children) return "";
|
|
19739
|
-
return `${
|
|
20504
|
+
return `${pad2}<span ${attr}${directives}>
|
|
19740
20505
|
${children}
|
|
19741
|
-
${
|
|
20506
|
+
${pad2}</span>`;
|
|
19742
20507
|
}
|
|
19743
20508
|
function renderNode(node, indent2, names, methods, operationOf, storeProp, ctx, wires, payloads) {
|
|
19744
20509
|
if (node.type === "variant_branch" /* VARIANT_BRANCH */) {
|
|
@@ -19825,6 +20590,9 @@ var attrBindingSlots = (type) => {
|
|
|
19825
20590
|
if (type === "remote" /* REMOTE */) return REMOTE_VALUE_SLOTS;
|
|
19826
20591
|
if (type === "app_logo" /* APP_LOGO */) return APP_LOGO_VALUE_SLOTS;
|
|
19827
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];
|
|
19828
20596
|
return hasTextSource(type) ? [BINDING_SLOT.label] : [];
|
|
19829
20597
|
};
|
|
19830
20598
|
var OPTION_ROW_MISS_TEXT = {
|
|
@@ -19844,7 +20612,7 @@ var optionsGapReason = (binding, ctx, storeProp) => {
|
|
|
19844
20612
|
);
|
|
19845
20613
|
return miss ? OPTION_ROW_MISS_TEXT[miss] ?? "cannot emit here" : void 0;
|
|
19846
20614
|
};
|
|
19847
|
-
function bindingGapComments(node, ctx, storeProp,
|
|
20615
|
+
function bindingGapComments(node, ctx, storeProp, pad2) {
|
|
19848
20616
|
const bindings = ctx.controlMap?.[node.id]?.bindings;
|
|
19849
20617
|
if (!bindings) return "";
|
|
19850
20618
|
const slots = attrBindingSlots(node.type);
|
|
@@ -19854,7 +20622,7 @@ function bindingGapComments(node, ctx, storeProp, pad) {
|
|
|
19854
20622
|
const binding = bindings[slot];
|
|
19855
20623
|
if (!binding) return "";
|
|
19856
20624
|
const reason = slot === BINDING_SLOT.options && node.type !== "context_menu" /* CONTEXT_MENU */ ? optionsGapReason(binding, ctx, storeProp) : bindingGapReason(binding, scope);
|
|
19857
|
-
return reason ? `${
|
|
20625
|
+
return reason ? `${pad2}<!-- ${slot} ${node.id}: ${reason}; not emitted -->
|
|
19858
20626
|
` : "";
|
|
19859
20627
|
}).join("");
|
|
19860
20628
|
}
|
|
@@ -20016,13 +20784,15 @@ function boundAttrs(node, ctx, storeProp) {
|
|
|
20016
20784
|
const expr = emission === "piped" ? bindingExpression(binding, scope) : emission === "raw" ? textBindingExpression(binding, scope, translated) : void 0;
|
|
20017
20785
|
const piped = expr && emission === "piped" ? withBindingFallback(formatPipeExpression(chain, expr, scope), binding) : expr;
|
|
20018
20786
|
if (piped) {
|
|
20019
|
-
parts.push(
|
|
20787
|
+
parts.push(
|
|
20788
|
+
` [label]="${piped}"${translated ? "" : ' [noTranslate]="true"'}`
|
|
20789
|
+
);
|
|
20020
20790
|
}
|
|
20021
20791
|
} else if (hasTextSource(node.type) && chain.length) {
|
|
20022
20792
|
const source = staticLabelSource(chain, node.configs?.[BINDING_SLOT.label]);
|
|
20023
20793
|
if (source) {
|
|
20024
20794
|
parts.push(
|
|
20025
|
-
` [label]="${formatPipeExpression(chain, source, scope)}" noTranslate`
|
|
20795
|
+
` [label]="${formatPipeExpression(chain, source, scope)}" [noTranslate]="true"`
|
|
20026
20796
|
);
|
|
20027
20797
|
}
|
|
20028
20798
|
}
|
|
@@ -20037,6 +20807,14 @@ function boundAttrs(node, ctx, storeProp) {
|
|
|
20037
20807
|
}
|
|
20038
20808
|
const total = paginationTotalRead(node, ctx, storeProp);
|
|
20039
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
|
+
}
|
|
20040
20818
|
if (node.type === "section_filter" /* SECTION_FILTER */ && bindings?.[BINDING_SLOT.options]) {
|
|
20041
20819
|
const expr = optionBindingExpression(
|
|
20042
20820
|
bindings[BINDING_SLOT.options],
|
|
@@ -20199,6 +20977,11 @@ function tagAttrs(node, ctx, storeProp) {
|
|
|
20199
20977
|
delete configs2["link"];
|
|
20200
20978
|
return `${inlineAttrs({ ...node, configs: configs2 })}${boundAttrs(node, ctx, storeProp)}`;
|
|
20201
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
|
+
}
|
|
20202
20985
|
if (node.type === "section_filter" /* SECTION_FILTER */) {
|
|
20203
20986
|
const bindings = ctx.controlMap?.[node.id]?.bindings;
|
|
20204
20987
|
const configs2 = { ...node.configs ?? {} };
|
|
@@ -20687,7 +21470,7 @@ function payloadAttr(node, payloads) {
|
|
|
20687
21470
|
return prop && !prop.modeled ? ` [data]="${prop.name}!"` : "";
|
|
20688
21471
|
}
|
|
20689
21472
|
function renderTag(node, indent2, names, methods, operationOf, storeProp, ctx, wires, payloads) {
|
|
20690
|
-
const
|
|
21473
|
+
const pad2 = " ".repeat(indent2);
|
|
20691
21474
|
if (node.type === "screen" /* SCREEN */) {
|
|
20692
21475
|
const guardScope = bindingScope(ctx, storeProp);
|
|
20693
21476
|
const guards = screenControlInputGuards(
|
|
@@ -20709,11 +21492,11 @@ function renderTag(node, indent2, names, methods, operationOf, storeProp, ctx, w
|
|
|
20709
21492
|
const inputAliases = new Map(
|
|
20710
21493
|
guards.map((guard) => [guard.expression, guard.alias])
|
|
20711
21494
|
);
|
|
20712
|
-
const
|
|
21495
|
+
const pad3 = " ".repeat(indent2 + guards.length);
|
|
20713
21496
|
const ref = embeddedRefOf(node, ctx);
|
|
20714
21497
|
if (!ref) {
|
|
20715
21498
|
const name3 = node.handRef ?? node.screenId ?? "an embedded Screen";
|
|
20716
|
-
return `${
|
|
21499
|
+
return `${pad3}<!-- ${name3}: referenced Screen has gone; not emitted -->`;
|
|
20717
21500
|
}
|
|
20718
21501
|
const bound = screenControlAttrs(
|
|
20719
21502
|
node,
|
|
@@ -20776,7 +21559,7 @@ function renderTag(node, indent2, names, methods, operationOf, storeProp, ctx, w
|
|
|
20776
21559
|
(binding) => bindingExpression(binding, scope),
|
|
20777
21560
|
(binding) => bindingGapReason(binding, scope) ?? "cannot emit here"
|
|
20778
21561
|
);
|
|
20779
|
-
return `${
|
|
21562
|
+
return `${pad3}<!-- ${name3}: ${reason ?? "required input is unbound"}; not emitted -->`;
|
|
20780
21563
|
}
|
|
20781
21564
|
const maxWidth = toCssLength(node.maxWidth);
|
|
20782
21565
|
const style = maxWidth ? ` style="max-width: ${maxWidth}"` : "";
|
|
@@ -20784,7 +21567,7 @@ function renderTag(node, indent2, names, methods, operationOf, storeProp, ctx, w
|
|
|
20784
21567
|
const spacing = STYLE_DIRECTIVE_NAMES.map(
|
|
20785
21568
|
(name3) => styleDirectiveAttrs(name3, filterConfigs(node.directives?.[name3]?.configs))
|
|
20786
21569
|
).join("");
|
|
20787
|
-
const tag2 = `${
|
|
21570
|
+
const tag2 = `${pad3}<${ref.tag}${bound}${style}${spacing} />`;
|
|
20788
21571
|
return guards.reduceRight(
|
|
20789
21572
|
(markup, guard, index) => `${" ".repeat(indent2 + index)}@if (${guard.expression}; as ${guard.alias}) {
|
|
20790
21573
|
${markup}
|
|
@@ -20799,7 +21582,7 @@ ${" ".repeat(indent2 + index)}}`,
|
|
|
20799
21582
|
if (node.type === "plugin" /* PLUGIN */) {
|
|
20800
21583
|
return renderPluginTag(
|
|
20801
21584
|
node,
|
|
20802
|
-
|
|
21585
|
+
pad2,
|
|
20803
21586
|
tag,
|
|
20804
21587
|
methods,
|
|
20805
21588
|
operationOf,
|
|
@@ -20814,22 +21597,22 @@ ${" ".repeat(indent2 + index)}}`,
|
|
|
20814
21597
|
ctx.controlMap?.[node.id]?.bindings
|
|
20815
21598
|
)}${outputAttrs(node, methods, operationOf, storeProp, ctx)}`;
|
|
20816
21599
|
if (node.type === "section_action" /* SECTION_ACTION */) {
|
|
20817
|
-
return `${
|
|
21600
|
+
return `${pad2}<${tag}${attrs}${actionButtonsAttr(node, ctx.actionButtonNames)} />`;
|
|
20818
21601
|
}
|
|
20819
21602
|
const totalGuard = paginationTotalRead(node, ctx, storeProp)?.guard;
|
|
20820
21603
|
if (totalGuard) {
|
|
20821
|
-
return `${
|
|
20822
|
-
${
|
|
20823
|
-
${
|
|
21604
|
+
return `${pad2}@if (${totalGuard}; as ${PAGINATION_TOTAL_ALIAS}) {
|
|
21605
|
+
${pad2} <${tag}${attrs} />
|
|
21606
|
+
${pad2}}`;
|
|
20824
21607
|
}
|
|
20825
21608
|
const element = tag.split(" ")[0];
|
|
20826
|
-
const close = (inner) => element === tag ? `${
|
|
21609
|
+
const close = (inner) => element === tag ? `${pad2}<${tag}${attrs}>
|
|
20827
21610
|
${inner}
|
|
20828
|
-
${
|
|
21611
|
+
${pad2}</${tag}>` : inner ? `${pad2}<${tag}${attrs}>
|
|
20829
21612
|
${inner}
|
|
20830
|
-
${
|
|
21613
|
+
${pad2}</${element}>` : `${pad2}<${tag}${attrs}></${element}>`;
|
|
20831
21614
|
if (!node.childrens.length) {
|
|
20832
|
-
return element === tag ? `${
|
|
21615
|
+
return element === tag ? `${pad2}<${tag}${attrs} />` : close("");
|
|
20833
21616
|
}
|
|
20834
21617
|
const children = node.childrens.map(
|
|
20835
21618
|
(child) => renderNode(
|
|
@@ -20845,23 +21628,20 @@ ${pad}</${element}>` : `${pad}<${tag}${attrs}></${element}>`;
|
|
|
20845
21628
|
)
|
|
20846
21629
|
).filter(Boolean).join("\n");
|
|
20847
21630
|
if (!children)
|
|
20848
|
-
return element === tag ? `${
|
|
21631
|
+
return element === tag ? `${pad2}<${tag}${attrs} />` : close("");
|
|
20849
21632
|
return close(children);
|
|
20850
21633
|
}
|
|
20851
|
-
var pluginFacts = (tree
|
|
21634
|
+
var pluginFacts = (tree) => {
|
|
20852
21635
|
const facts = [];
|
|
20853
21636
|
const walk = (nodes) => nodes.forEach((node) => {
|
|
20854
21637
|
if (node.type === "plugin" /* PLUGIN */) {
|
|
20855
21638
|
const link = String(node.configs?.[PLUGIN_LINK_KEY] ?? "").trim();
|
|
20856
21639
|
const screen = String(node.configs?.[PLUGIN_SCREEN_KEY] ?? "").trim();
|
|
20857
|
-
const bindings = ctx.controlMap?.[node.id]?.bindings ?? {};
|
|
20858
21640
|
if (link && screen) {
|
|
20859
21641
|
facts.push({
|
|
20860
21642
|
link,
|
|
20861
21643
|
screen,
|
|
20862
|
-
inputs: pluginNamesOf(node.configs, PLUGIN_INPUTS_KEY)
|
|
20863
|
-
(name3) => !!bindings[pluginInputSlot(name3)]
|
|
20864
|
-
),
|
|
21644
|
+
inputs: pluginNamesOf(node.configs, PLUGIN_INPUTS_KEY),
|
|
20865
21645
|
outputs: pluginNamesOf(node.configs, PLUGIN_OUTPUTS_KEY)
|
|
20866
21646
|
});
|
|
20867
21647
|
}
|
|
@@ -20872,23 +21652,21 @@ var pluginFacts = (tree, ctx) => {
|
|
|
20872
21652
|
return facts;
|
|
20873
21653
|
};
|
|
20874
21654
|
var OUTPUT_ATTR = / \(([^)]+)\)="([^"]*)"/g;
|
|
20875
|
-
function renderPluginTag(node,
|
|
21655
|
+
function renderPluginTag(node, pad2, tag, methods, operationOf, storeProp, ctx) {
|
|
20876
21656
|
const attrs = `${tagAttrs(node, ctx, storeProp)}${directiveAttrs(
|
|
20877
21657
|
node,
|
|
20878
21658
|
ctx.overlayNames,
|
|
20879
21659
|
bindingScope(ctx, storeProp),
|
|
20880
21660
|
ctx.controlMap?.[node.id]?.bindings
|
|
20881
21661
|
)}`;
|
|
20882
|
-
const inner = `${
|
|
21662
|
+
const inner = `${pad2} `;
|
|
20883
21663
|
const bindings = ctx.controlMap?.[node.id]?.bindings;
|
|
20884
21664
|
const scope = bindingScope(ctx, storeProp);
|
|
20885
|
-
const inputs = pluginNamesOf(node.configs, PLUGIN_INPUTS_KEY).
|
|
20886
|
-
(name3)
|
|
20887
|
-
|
|
20888
|
-
|
|
20889
|
-
|
|
20890
|
-
}
|
|
20891
|
-
);
|
|
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
|
+
});
|
|
20892
21670
|
const outputs = [
|
|
20893
21671
|
...outputAttrs(node, methods, operationOf, storeProp, ctx).matchAll(
|
|
20894
21672
|
OUTPUT_ATTR
|
|
@@ -20899,9 +21677,9 @@ function renderPluginTag(node, pad, tag, methods, operationOf, storeProp, ctx) {
|
|
|
20899
21677
|
if (inputs.length) ctx.writtenTags.add("m-plugin-input");
|
|
20900
21678
|
if (outputs.length) ctx.writtenTags.add("m-plugin-output");
|
|
20901
21679
|
const children = [...inputs, ...outputs];
|
|
20902
|
-
return children.length ? `${
|
|
21680
|
+
return children.length ? `${pad2}<${tag}${attrs}>
|
|
20903
21681
|
${children.join("\n")}
|
|
20904
|
-
${
|
|
21682
|
+
${pad2}</${tag}>` : `${pad2}<${tag}${attrs} />`;
|
|
20905
21683
|
}
|
|
20906
21684
|
function planScreenEmit(tree, variants = {}, featureName = "feature", ctx = {}) {
|
|
20907
21685
|
const writtenTags = /* @__PURE__ */ new Set();
|
|
@@ -21218,7 +21996,7 @@ var formModelDeclsBlock = (models, scope) => {
|
|
|
21218
21996
|
for (const [index, id] of member.entries()) {
|
|
21219
21997
|
const key2 = current?.keys.find((entry2) => entry2.id === id);
|
|
21220
21998
|
if (!key2) return void 0;
|
|
21221
|
-
read = `${read}
|
|
21999
|
+
read = `${read}${memberAccess(current, key2, true)}`;
|
|
21222
22000
|
if (index === member.length - 1) break;
|
|
21223
22001
|
current = key2.dataType.type === "shape" ? scope.shapes[key2.dataType.shapeId] : void 0;
|
|
21224
22002
|
}
|
|
@@ -22361,7 +23139,10 @@ function armCheckExpr(check, node, ctx, storeProp, payload, eventRoot) {
|
|
|
22361
23139
|
shapes: ctx.shapes ?? {},
|
|
22362
23140
|
constants: ctx.constants ?? {},
|
|
22363
23141
|
scope: "class",
|
|
22364
|
-
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
|
|
22365
23146
|
}) : subject;
|
|
22366
23147
|
const piped = needsParens(read) ? `(${read})` : read;
|
|
22367
23148
|
const raw = (check.value ?? "").trim();
|
|
@@ -22393,10 +23174,22 @@ function emittableArms(node, output, ctx, storeProp) {
|
|
|
22393
23174
|
if (!offersOutputArms(control)) return [];
|
|
22394
23175
|
const payload = payloadShape(output, node.type, node.configs);
|
|
22395
23176
|
const eventRoot = payloadEventRoot(output, node.type, node.configs);
|
|
22396
|
-
|
|
22397
|
-
|
|
22398
|
-
|
|
22399
|
-
|
|
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;
|
|
22400
23193
|
}
|
|
22401
23194
|
function emittingArms(node, output, ctx, storeProp) {
|
|
22402
23195
|
const control = node;
|
|
@@ -22529,12 +23322,16 @@ ${format(
|
|
|
22529
23322
|
);
|
|
22530
23323
|
const direct = format(groupOf(output), " ");
|
|
22531
23324
|
const always = alwaysOutputArms(control, output).map((arm) => bodyOf(arm, " ")).filter(Boolean);
|
|
22532
|
-
const
|
|
23325
|
+
const chains = [];
|
|
23326
|
+
wired.forEach(({ arm, expr, opensChain }) => {
|
|
22533
23327
|
const body2 = bodyOf(arm, " ");
|
|
22534
|
-
|
|
23328
|
+
const block2 = `if (${expr}) {
|
|
22535
23329
|
${body2 ? `${body2}
|
|
22536
23330
|
` : ""} }`;
|
|
23331
|
+
if (opensChain) chains.push([block2]);
|
|
23332
|
+
else chains[chains.length - 1].push(block2);
|
|
22537
23333
|
});
|
|
23334
|
+
const chain = chains[chains.length - 1] ?? [];
|
|
22538
23335
|
const fallback = defaultOutputArm(control, output);
|
|
22539
23336
|
if (fallback) {
|
|
22540
23337
|
const body2 = bodyOf(fallback, chain.length ? " " : " ");
|
|
@@ -22567,7 +23364,7 @@ ${body2 ? `${body2}
|
|
|
22567
23364
|
...pressed,
|
|
22568
23365
|
direct,
|
|
22569
23366
|
...always,
|
|
22570
|
-
...
|
|
23367
|
+
...chains.map((blocks) => blocks.join(" else "))
|
|
22571
23368
|
].filter(Boolean).join("\n");
|
|
22572
23369
|
emitted.push(`
|
|
22573
23370
|
protected readonly ${outputArmHandlerName(
|
|
@@ -23001,6 +23798,9 @@ function collectComponentImportEntries(tree, ctx = {}) {
|
|
|
23001
23798
|
entries.push({ component: "TranslatePipe", from: ONE_IMPORT_MODULE });
|
|
23002
23799
|
}
|
|
23003
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
|
+
}
|
|
23004
23804
|
if (node.type === "section_table" /* SECTION_TABLE */ && ctx.controlMap && tableHasRepeat(node.id, ctx.controlMap)) {
|
|
23005
23805
|
entries.push({
|
|
23006
23806
|
component: "SectionTableSortPipe",
|
|
@@ -23189,7 +23989,9 @@ function generateFeatureStore(featureName, properties, variants = {}, shapes = {
|
|
|
23189
23989
|
true,
|
|
23190
23990
|
// A Rule sits on the FeatureStore and may read a SubStore's property,
|
|
23191
23991
|
// which is what makes the main store hold that SubStore (ADR 0093).
|
|
23192
|
-
readsAcross ? rootReceiver : ""
|
|
23992
|
+
readsAcross ? rootReceiver : "",
|
|
23993
|
+
"",
|
|
23994
|
+
functions
|
|
23193
23995
|
);
|
|
23194
23996
|
return { name: variant.name, expr, local: mintVariantLocal(variant.name) };
|
|
23195
23997
|
});
|
|
@@ -23332,7 +24134,14 @@ ${lines.join("\n")}
|
|
|
23332
24134
|
const storageImport = oneImports.length ? `import { ${oneImports.join(", ")} } from '@magmonium/one';
|
|
23333
24135
|
` : "";
|
|
23334
24136
|
const functionImports = Array.from(
|
|
23335
|
-
Object.values(computeds).map((computed) => functions[computed.functionId]).concat((drawn.functionIds ?? []).map((id) => functions[id])).concat(hooks.feedFunctionId ? [functions[hooks.feedFunctionId]] : []).
|
|
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(
|
|
23336
24145
|
(byName, fn) => byName.has(fn.name) ? byName : byName.set(fn.name, fn),
|
|
23337
24146
|
/* @__PURE__ */ new Map()
|
|
23338
24147
|
).values()
|
|
@@ -23953,7 +24762,7 @@ ${tables.map(
|
|
|
23953
24762
|
needsStore ? featureStoreProp(featureName) : "",
|
|
23954
24763
|
menuVariants
|
|
23955
24764
|
);
|
|
23956
|
-
const screenVariantsBody = screenVariantsBlock(
|
|
24765
|
+
const { body: screenVariantsBody, functions: variantFunctions } = screenVariantsBlock(
|
|
23957
24766
|
screenVariants,
|
|
23958
24767
|
ctx.inputs ?? {},
|
|
23959
24768
|
screenComputeds,
|
|
@@ -24036,6 +24845,7 @@ ${tables.map(
|
|
|
24036
24845
|
const fn = (ctx.functions ?? {})[id];
|
|
24037
24846
|
if (fn) screenFunctions.set(fn.name, fn);
|
|
24038
24847
|
}
|
|
24848
|
+
for (const fn of variantFunctions) screenFunctions.set(fn.name, fn);
|
|
24039
24849
|
for (const handler of Object.values(ctx.screenMethods ?? {})) {
|
|
24040
24850
|
for (const one of screenMethodCalls(handler)) {
|
|
24041
24851
|
const fn = (ctx.functions ?? {})[one.functionId ?? ""];
|
|
@@ -24428,7 +25238,7 @@ function generateCode(tree, featureName, screenName, properties = {}, variants =
|
|
|
24428
25238
|
featureStoreProp(featureName),
|
|
24429
25239
|
codegenCtx
|
|
24430
25240
|
),
|
|
24431
|
-
plugins: pluginFacts(tree
|
|
25241
|
+
plugins: pluginFacts(tree),
|
|
24432
25242
|
variables: Object.values(codegenCtx.variables ?? {}).map((variable) => ({
|
|
24433
25243
|
name: variable.name,
|
|
24434
25244
|
dataType: { type: variable.dataType },
|
|
@@ -24571,7 +25381,7 @@ __export(package_exports, {
|
|
|
24571
25381
|
version: () => version
|
|
24572
25382
|
});
|
|
24573
25383
|
var name = "@magmonium/one";
|
|
24574
|
-
var version = "0.4.
|
|
25384
|
+
var version = "0.4.60";
|
|
24575
25385
|
var description = "Magmonium One \u2014 Angular design-system primitives for mm Apps";
|
|
24576
25386
|
var author = "magmonium";
|
|
24577
25387
|
var license = "MIT";
|
|
@@ -24639,7 +25449,7 @@ __export(package_exports2, {
|
|
|
24639
25449
|
version: () => version2
|
|
24640
25450
|
});
|
|
24641
25451
|
var name2 = "@magmonium/cli";
|
|
24642
|
-
var version2 = "0.8.
|
|
25452
|
+
var version2 = "0.8.19";
|
|
24643
25453
|
var description2 = "A powerful and extensible asset compilation tool that can be shared across multiple projects";
|
|
24644
25454
|
var bin = {
|
|
24645
25455
|
"mag-cli": "bin/cli.js"
|
|
@@ -26202,7 +27012,7 @@ var caseEquals = (actual, expected) => {
|
|
|
26202
27012
|
};
|
|
26203
27013
|
|
|
26204
27014
|
// libs/codegen/src/lib/workspace-codec.ts
|
|
26205
|
-
var WORKSPACE_SCHEMA_VERSION =
|
|
27015
|
+
var WORKSPACE_SCHEMA_VERSION = 29;
|
|
26206
27016
|
var MIGRATION_FLOOR = 18;
|
|
26207
27017
|
var DEPLOY_TOKEN_METHOD_IDS = {
|
|
26208
27018
|
"@UserStore.ensureDeployToken": "@AuthStore.ensureDeployToken",
|
|
@@ -26298,6 +27108,20 @@ var mapBlobControls = (blob, step) => {
|
|
|
26298
27108
|
}
|
|
26299
27109
|
return next;
|
|
26300
27110
|
};
|
|
27111
|
+
var compactStoredControl = (control) => {
|
|
27112
|
+
const configs = control["configs"];
|
|
27113
|
+
if (!configs || typeof configs !== "object" || Array.isArray(configs)) {
|
|
27114
|
+
return control;
|
|
27115
|
+
}
|
|
27116
|
+
const idNamed = isBornNamed(control["type"]);
|
|
27117
|
+
const entries = Object.entries(configs);
|
|
27118
|
+
const written = entries.filter(
|
|
27119
|
+
([key2, value]) => value !== "" && !(idNamed && key2 === "name" && value === control["id"])
|
|
27120
|
+
);
|
|
27121
|
+
return written.length === entries.length ? control : { ...control, configs: Object.fromEntries(written) };
|
|
27122
|
+
};
|
|
27123
|
+
var compactControlMap = (controlMap) => mapStoredControls(controlMap, compactStoredControl);
|
|
27124
|
+
var compactControlGroups = (groups) => mapBlobControls({ controlGroups: groups }, compactStoredControl)["controlGroups"];
|
|
26301
27125
|
var moveBlobSpacing = (blob) => mapBlobControls(blob, moveSpacingToStyleDirectives);
|
|
26302
27126
|
var dropOptionMultiple = (control) => {
|
|
26303
27127
|
const configs = control["configs"];
|
|
@@ -26381,6 +27205,21 @@ var screenOnly = (step) => ({
|
|
|
26381
27205
|
step
|
|
26382
27206
|
});
|
|
26383
27207
|
var MIGRATIONS = {
|
|
27208
|
+
// 28 → 29: a Control writes only what it says, in a Screen's ControlMap and
|
|
27209
|
+
// in every ControlGroup — and a `var:` binding on one carrying no message
|
|
27210
|
+
// goes. No translations reach a step, so a slot under a key is kept: it may
|
|
27211
|
+
// be one the key's text names.
|
|
27212
|
+
28: everyKind(
|
|
27213
|
+
(blob) => mapBlobControls(
|
|
27214
|
+
blob,
|
|
27215
|
+
(control) => compactStoredControl(
|
|
27216
|
+
pruneOrphanMessageBindings(
|
|
27217
|
+
control,
|
|
27218
|
+
{}
|
|
27219
|
+
)
|
|
27220
|
+
)
|
|
27221
|
+
)
|
|
27222
|
+
),
|
|
26384
27223
|
// 27 → 28: a Button's `url`/`murl` move onto its LinkTarget, in a Screen's
|
|
26385
27224
|
// ControlMap and in every ControlGroup.
|
|
26386
27225
|
27: everyKind((blob) => mapBlobControls(blob, moveButtonNavTarget)),
|
|
@@ -26562,7 +27401,9 @@ function sanitizeAppTarget(value) {
|
|
|
26562
27401
|
appName: typeof target.appName === "string" ? target.appName : "",
|
|
26563
27402
|
appPath: typeof target.appPath === "string" ? target.appPath : "",
|
|
26564
27403
|
environment: loadEnvironment(target),
|
|
26565
|
-
...typeof target.appId === "string" && target.appId ? { appId: target.appId } : {}
|
|
27404
|
+
...typeof target.appId === "string" && target.appId ? { appId: target.appId } : {},
|
|
27405
|
+
// A Plugin App reopens as one; any other word reads as an ordinary app.
|
|
27406
|
+
...target.kind === "plugin" ? { kind: "plugin" } : {}
|
|
26566
27407
|
};
|
|
26567
27408
|
}
|
|
26568
27409
|
function sanitizeDataType(value, shapes) {
|
|
@@ -26622,7 +27463,8 @@ function sanitizeShapes(shapes, reachable = {}, owner = "feature") {
|
|
|
26622
27463
|
id,
|
|
26623
27464
|
name: shape.name,
|
|
26624
27465
|
keys: [],
|
|
26625
|
-
...origin ? { origin } : {}
|
|
27466
|
+
...origin ? { origin } : {},
|
|
27467
|
+
...shape.positional === true ? { positional: true } : {}
|
|
26626
27468
|
};
|
|
26627
27469
|
}
|
|
26628
27470
|
for (const [id, value] of Object.entries(shapes)) {
|
|
@@ -26739,6 +27581,24 @@ function sanitizeRuleNode(value, depth = 0) {
|
|
|
26739
27581
|
navId: typeof node["navId"] === "string" ? node["navId"] : ""
|
|
26740
27582
|
};
|
|
26741
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
|
+
}
|
|
26742
27602
|
if (kind !== "check" && kind !== "test") return void 0;
|
|
26743
27603
|
const operator = node["operator"];
|
|
26744
27604
|
const quantifier = node["quantifier"];
|
|
@@ -26965,7 +27825,11 @@ function sanitizeMethods(methods, properties, functions = {}) {
|
|
|
26965
27825
|
}).map((param) => ({
|
|
26966
27826
|
id: param.id,
|
|
26967
27827
|
name: param.name.trim(),
|
|
26968
|
-
dataType: { type: param.dataType.type }
|
|
27828
|
+
dataType: { type: param.dataType.type },
|
|
27829
|
+
// The one axis the User answers for a parameter nothing sends, so the
|
|
27830
|
+
// load is where it would otherwise be lost silently (GLOSSARY.md
|
|
27831
|
+
// MethodParam).
|
|
27832
|
+
...param.required ? { required: true } : {}
|
|
26969
27833
|
}));
|
|
26970
27834
|
result[id] = {
|
|
26971
27835
|
id,
|
|
@@ -27231,7 +28095,6 @@ function sanitizePureFunctions(value, shapes) {
|
|
|
27231
28095
|
cardinality: sanitizeCardinality(param),
|
|
27232
28096
|
...param.acceptsUndefined === true ? { acceptsUndefined: true } : {}
|
|
27233
28097
|
})) : [];
|
|
27234
|
-
if (!params.length) continue;
|
|
27235
28098
|
const body = typeof fn.body === "string" ? fn.body : "";
|
|
27236
28099
|
const imports = sanitizeFunctionImports(fn.imports);
|
|
27237
28100
|
const description3 = typeof fn.description === "string" ? fn.description.trim() : "";
|
|
@@ -28169,6 +29032,9 @@ function pruneUnknownTypes(controlMap) {
|
|
|
28169
29032
|
control.childrens = (control.childrens || []).filter(
|
|
28170
29033
|
(childId) => pruned[childId]
|
|
28171
29034
|
);
|
|
29035
|
+
if (isBornNamed(control.type) && !("name" in (control.configs ?? {}))) {
|
|
29036
|
+
control.configs = { ...control.configs, name: control.id };
|
|
29037
|
+
}
|
|
28172
29038
|
if (control.source && !CONFIG_SOURCES.includes(control.source)) {
|
|
28173
29039
|
control.source = RAW_CONFIG_SOURCE;
|
|
28174
29040
|
}
|
|
@@ -28351,7 +29217,8 @@ function buildDesignSource(ws, operations = drawnOperations(ws)) {
|
|
|
28351
29217
|
// be rederived from there — `package.json` cannot say which of its
|
|
28352
29218
|
// dependencies a User approved (ADR 0083).
|
|
28353
29219
|
npmAllowlist: ws.npmAllowlist,
|
|
28354
|
-
codegen: CLI_PACKAGE_VERSION
|
|
29220
|
+
codegen: CLI_PACKAGE_VERSION,
|
|
29221
|
+
one: ONE_PACKAGE_VERSION
|
|
28355
29222
|
};
|
|
28356
29223
|
const files3 = {
|
|
28357
29224
|
[DESIGN_INDEX_PATH]: json(index),
|
|
@@ -28374,7 +29241,8 @@ function buildDesignSource(ws, operations = drawnOperations(ws)) {
|
|
|
28374
29241
|
ASSET_FILES.forEach(([file, key2]) => {
|
|
28375
29242
|
files3[assetPath(file)] = json({
|
|
28376
29243
|
v: WORKSPACE_SCHEMA_VERSION,
|
|
28377
|
-
|
|
29244
|
+
// A ControlGroup's Controls are written the way a Screen's are.
|
|
29245
|
+
[file]: key2 === "controlGroups" ? compactControlGroups(ws[key2]) : ws[key2]
|
|
28378
29246
|
});
|
|
28379
29247
|
});
|
|
28380
29248
|
Object.entries(
|
|
@@ -28386,7 +29254,7 @@ function buildDesignSource(ws, operations = drawnOperations(ws)) {
|
|
|
28386
29254
|
files3[`${DESIGN_SCREENS_DIR}/${meta.id}.json`] = json({
|
|
28387
29255
|
v: WORKSPACE_SCHEMA_VERSION,
|
|
28388
29256
|
meta,
|
|
28389
|
-
state
|
|
29257
|
+
state: { ...state, controlMap: compactControlMap(state.controlMap) }
|
|
28390
29258
|
});
|
|
28391
29259
|
});
|
|
28392
29260
|
files3[DESIGN_WRITE_ID_PATH] = `${designWriteId(files3)}
|
|
@@ -28744,7 +29612,7 @@ var exposedScreenBindings = (screens, prefix, features = []) => {
|
|
|
28744
29612
|
...required.length ? { required } : {},
|
|
28745
29613
|
outputs: Object.values(screen.outputs ?? {}).map((o) => o.name).sort((a, b) => a.localeCompare(b))
|
|
28746
29614
|
};
|
|
28747
|
-
return { name: name3, className, importPath, contract };
|
|
29615
|
+
return { screenId: screen.id, name: name3, className, importPath, contract };
|
|
28748
29616
|
}).sort((a, b) => a.name.localeCompare(b.name));
|
|
28749
29617
|
};
|
|
28750
29618
|
var pluginContracts = (screens, prefix, features = []) => exposedScreenBindings(screens, prefix, features).map((b) => b.contract);
|
|
@@ -28895,7 +29763,7 @@ var navInstanceSourceBindings = (navMap, features, methodArgNamesOf = () => [])
|
|
|
28895
29763
|
];
|
|
28896
29764
|
});
|
|
28897
29765
|
};
|
|
28898
|
-
var navKeyLiteral =
|
|
29766
|
+
var navKeyLiteral = propertyKey;
|
|
28899
29767
|
var AUTH_STORE_PARAM = "authStore";
|
|
28900
29768
|
var AUTH_STORE_CLASS = "AuthStore";
|
|
28901
29769
|
var visibilityLoadArgs = (nav, navMap, methodArgs2, argNames) => argNames.map((name3) => {
|
|
@@ -29373,8 +30241,6 @@ var packageJson = (appName, version3, extraDeps = {}) => JSON.stringify(
|
|
|
29373
30241
|
start: "ng serve",
|
|
29374
30242
|
prebuild: "npm run gen:code && npm run assets:compile",
|
|
29375
30243
|
build: "ng build",
|
|
29376
|
-
"prebuild:dev": "npm run gen:code && npm run assets:compile",
|
|
29377
|
-
"build:dev": "ng build --configuration dev",
|
|
29378
30244
|
"prebuild:wc": "npm run gen:code",
|
|
29379
30245
|
// What CI runs, and what produces the bundle the Store deploys. Not
|
|
29380
30246
|
// `ng build` — the WC bundle is ngc + esbuild through the CLI, and
|
|
@@ -29469,7 +30335,11 @@ var packageJson = (appName, version3, extraDeps = {}) => JSON.stringify(
|
|
|
29469
30335
|
// same exact version. `$webpack` is not enough: npm still nests the
|
|
29470
30336
|
// exact pin from build-angular next to a newer root resolution.
|
|
29471
30337
|
overrides: {
|
|
29472
|
-
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
|
|
29473
30343
|
}
|
|
29474
30344
|
},
|
|
29475
30345
|
null,
|
|
@@ -29526,30 +30396,15 @@ var angularJson = (app) => JSON.stringify(
|
|
|
29526
30396
|
maximumError: "40kb"
|
|
29527
30397
|
}
|
|
29528
30398
|
],
|
|
29529
|
-
fileReplacements: [
|
|
29530
|
-
{
|
|
29531
|
-
replace: "src/environments/environment.ts",
|
|
29532
|
-
with: "src/environments/environment.prod.ts"
|
|
29533
|
-
}
|
|
29534
|
-
],
|
|
29535
30399
|
outputHashing: "all"
|
|
29536
30400
|
},
|
|
30401
|
+
// No file replacements: every configuration builds against the
|
|
30402
|
+
// one `environment.ts` (ADR 0194).
|
|
29537
30403
|
development: {
|
|
29538
30404
|
optimization: false,
|
|
29539
30405
|
extractLicenses: false,
|
|
29540
30406
|
sourceMap: true,
|
|
29541
30407
|
namedChunks: true
|
|
29542
|
-
},
|
|
29543
|
-
// `development` / `ng serve` / Run keep `environment.ts` (= active
|
|
29544
|
-
// preset). `dev` and `production` swap in the matching preset.
|
|
29545
|
-
dev: {
|
|
29546
|
-
fileReplacements: [
|
|
29547
|
-
{
|
|
29548
|
-
replace: "src/environments/environment.ts",
|
|
29549
|
-
with: "src/environments/environment.dev.ts"
|
|
29550
|
-
}
|
|
29551
|
-
],
|
|
29552
|
-
outputHashing: "all"
|
|
29553
30408
|
}
|
|
29554
30409
|
},
|
|
29555
30410
|
defaultConfiguration: "production"
|
|
@@ -30003,6 +30858,82 @@ export const appConfig: ApplicationConfig = provideMagWcConfig({
|
|
|
30003
30858
|
providers: appProviders,
|
|
30004
30859
|
});
|
|
30005
30860
|
`;
|
|
30861
|
+
var PLUGIN_HARNESS_PATH = "src/harness/plugin-harness.ts";
|
|
30862
|
+
var pluginWcTs = (className, selector) => `import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
30863
|
+
|
|
30864
|
+
/**
|
|
30865
|
+
* A Plugin App has no frame: its Bundle defines its Exposed Screens and no
|
|
30866
|
+
* root element. The WC build names the Bundle after this class, so it stays.
|
|
30867
|
+
*/
|
|
30868
|
+
@Component({
|
|
30869
|
+
selector: '${selector}',
|
|
30870
|
+
template: '',
|
|
30871
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
30872
|
+
})
|
|
30873
|
+
export class ${className} {}
|
|
30874
|
+
`;
|
|
30875
|
+
var pluginWcConfigTs = () => `import { ApplicationConfig } from '@angular/core';
|
|
30876
|
+
import { provideMagWcConfig } from '@magmonium/one';
|
|
30877
|
+
import { environment } from '../environments/environment';
|
|
30878
|
+
import { appProviders } from './providers';
|
|
30879
|
+
|
|
30880
|
+
// Read by the WC build (\`appConfigPath\` in the manifest). A Plugin App routes
|
|
30881
|
+
// nothing and has no root frame: each Exposed Screen mounts as its own element
|
|
30882
|
+
// inside a host (libs/one ADR 0044). \`bootstrap.ts\` boots the Plugin Harness
|
|
30883
|
+
// instead, which this file never imports.
|
|
30884
|
+
export const appConfig: ApplicationConfig = provideMagWcConfig({
|
|
30885
|
+
backend: environment.url,
|
|
30886
|
+
authUrl: environment.authUrl,
|
|
30887
|
+
socketUrl: environment.socketUrl,
|
|
30888
|
+
routes: [],
|
|
30889
|
+
providers: appProviders,
|
|
30890
|
+
});
|
|
30891
|
+
`;
|
|
30892
|
+
var pluginBootstrapTs = () => `import '@angular/compiler';
|
|
30893
|
+
import { bootstrapMagApp } from '@magmonium/one';
|
|
30894
|
+
import { environment } from './environments/environment';
|
|
30895
|
+
import { appProviders } from './app/providers';
|
|
30896
|
+
import { PluginHarness, harnessRoutes } from './harness/plugin-harness';
|
|
30897
|
+
|
|
30898
|
+
// \`ng serve\` / Run boots the Plugin Harness: one address per Exposed Screen.
|
|
30899
|
+
// Never part of the WC build, which reads \`src/app/wc.config.ts\` alone.
|
|
30900
|
+
bootstrapMagApp({
|
|
30901
|
+
backend: environment.url,
|
|
30902
|
+
authUrl: environment.authUrl,
|
|
30903
|
+
socketUrl: environment.socketUrl,
|
|
30904
|
+
root: PluginHarness,
|
|
30905
|
+
children: harnessRoutes,
|
|
30906
|
+
providers: appProviders,
|
|
30907
|
+
});
|
|
30908
|
+
`;
|
|
30909
|
+
var pluginHarnessTs = (screens) => {
|
|
30910
|
+
const routes = screens.map(
|
|
30911
|
+
(screen) => ` {
|
|
30912
|
+
path: '${screen.name}',
|
|
30913
|
+
loadComponent: () =>
|
|
30914
|
+
import('../app/${screen.importPath.replace(/^\.\//, "")}').then((m) => m.${screen.className}),
|
|
30915
|
+
},`
|
|
30916
|
+
).join("\n");
|
|
30917
|
+
const first = screens[0]?.name;
|
|
30918
|
+
return `import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
30919
|
+
import { Route, RouterOutlet } from '@angular/router';
|
|
30920
|
+
|
|
30921
|
+
/** Dev-only: what \`ng serve\` and Run render. The WC build never reaches it. */
|
|
30922
|
+
@Component({
|
|
30923
|
+
selector: 'plugin-harness',
|
|
30924
|
+
imports: [RouterOutlet],
|
|
30925
|
+
template: \`<router-outlet></router-outlet>\`,
|
|
30926
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
30927
|
+
})
|
|
30928
|
+
export class PluginHarness {}
|
|
30929
|
+
|
|
30930
|
+
/** One address per Exposed Screen, its inputs from the query. */
|
|
30931
|
+
export const harnessRoutes: Route[] = [
|
|
30932
|
+
${first ? ` { path: '', pathMatch: 'full', redirectTo: '${first}' },
|
|
30933
|
+
` : ""}${routes}
|
|
30934
|
+
];
|
|
30935
|
+
`;
|
|
30936
|
+
};
|
|
30006
30937
|
var providersTs = (app) => `import { ApplicationConfig } from '@angular/core';
|
|
30007
30938
|
import { navProvidersGenerated } from './${app}.provide';
|
|
30008
30939
|
|
|
@@ -30022,18 +30953,15 @@ export const appProviders: ApplicationConfig['providers'] = [
|
|
|
30022
30953
|
...navProvidersGenerated,
|
|
30023
30954
|
];
|
|
30024
30955
|
`;
|
|
30025
|
-
var
|
|
30026
|
-
|
|
30027
|
-
|
|
30028
|
-
|
|
30029
|
-
};
|
|
30030
|
-
var environmentFile = (hosts, preset, production, comment) => {
|
|
30031
|
-
const authUrl = resolvedAuthUrl(hosts.authUrl, DEFAULT_AUTH_URL[preset]);
|
|
30032
|
-
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);
|
|
30033
30960
|
const socketUrl = hosts.socketUrl.trim();
|
|
30034
|
-
return
|
|
30961
|
+
return `// The Environment \u2014 what Run, \`ng serve\` and every build use (ADR 0194).
|
|
30962
|
+
// Preset: ${preset}.
|
|
30035
30963
|
export const environment = {
|
|
30036
|
-
production: ${
|
|
30964
|
+
production: ${preset === "prod"},
|
|
30037
30965
|
authUrl: '${authUrl}',
|
|
30038
30966
|
url: '${backend}',
|
|
30039
30967
|
socketUrl: '${socketUrl}',
|
|
@@ -30145,15 +31073,15 @@ var pwaYml = (appName, config) => {
|
|
|
30145
31073
|
""
|
|
30146
31074
|
].join("\n");
|
|
30147
31075
|
};
|
|
30148
|
-
var remoteManifest = (app, appName, config, className, selector, plugins) => `app: ${app}
|
|
31076
|
+
var remoteManifest = (app, appName, config, className, selector, plugins, isPlugin = false) => `app: ${app}
|
|
30149
31077
|
version: ${config.version}
|
|
30150
31078
|
componentPath: src/app
|
|
30151
31079
|
componentName: wc
|
|
30152
31080
|
className: ${className}
|
|
30153
31081
|
appConfigPath: src/app/wc.config
|
|
30154
31082
|
selector: ${selector}
|
|
30155
|
-
${config.theme ? `theme: ${config.theme}
|
|
30156
|
-
` : ""}${pwaYml(appName, config)}${pluginsYml(plugins)}`;
|
|
31083
|
+
${isPlugin ? "kind: plugin\n" : ""}${config.theme ? `theme: ${config.theme}
|
|
31084
|
+
` : ""}${isPlugin ? "" : pwaYml(appName, config)}${pluginsYml(plugins)}`;
|
|
30157
31085
|
var envManifest = (app, className, selector) => `app: ${app}
|
|
30158
31086
|
componentPath: src/app
|
|
30159
31087
|
componentName: wc
|
|
@@ -30250,25 +31178,35 @@ ${setupNode}${generateStep} - name: Build assets and web component
|
|
|
30250
31178
|
BUILD_CONFIG: prod
|
|
30251
31179
|
- name: Package as bundle.zip
|
|
30252
31180
|
run: cd dist/${app}-wc && zip -r ../../bundle.zip .
|
|
30253
|
-
- name:
|
|
31181
|
+
- name: Read app id and endpoint from the design source
|
|
30254
31182
|
run: |
|
|
30255
|
-
|
|
31183
|
+
APP_ID=$(jq -r '.appTarget.appId // empty' ${DESIGN_SOURCE_ROOT}/index.json)
|
|
31184
|
+
ENDPOINT=$(jq -r '.appTarget.environment.hosts.backendUrl // empty' ${DESIGN_SOURCE_ROOT}/index.json)
|
|
30256
31185
|
ENDPOINT="\${ENDPOINT%/}"
|
|
30257
|
-
|
|
30258
|
-
APP_ID
|
|
31186
|
+
ENDPOINT="\${ENDPOINT%/swagger.json}"
|
|
31187
|
+
if [ -z "$APP_ID" ] || [ -z "$ENDPOINT" ]; then
|
|
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."
|
|
31189
|
+
exit 1
|
|
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
|
|
31197
|
+
echo "MAG_APP_ID=$APP_ID" >> "$GITHUB_ENV"
|
|
31198
|
+
echo "MAG_ENDPOINT=$ENDPOINT" >> "$GITHUB_ENV"
|
|
31199
|
+
- name: Upload bundle to backend
|
|
31200
|
+
run: |
|
|
30259
31201
|
curl --fail-with-body -X POST \\
|
|
30260
31202
|
-H "Authorization: Bearer \${{ secrets.MAG_DEPLOY_TOKEN }}" \\
|
|
30261
31203
|
-F "bundle=@bundle.zip" \\
|
|
30262
|
-
"\${
|
|
31204
|
+
"\${MAG_ENDPOINT}/store/v1/bundle/\${MAG_APP_ID}"
|
|
30263
31205
|
- name: Trigger deployment
|
|
30264
31206
|
run: |
|
|
30265
|
-
ENDPOINT="\${{ secrets.MAG_ENDPOINT }}"
|
|
30266
|
-
ENDPOINT="\${ENDPOINT%/}"
|
|
30267
|
-
APP_ID="\${{ secrets.MAG_APP_ID }}"
|
|
30268
|
-
APP_ID="\${APP_ID//[$'\\t\\r\\n ']/}"
|
|
30269
31207
|
curl --fail-with-body -X POST \\
|
|
30270
31208
|
-H "Authorization: Bearer \${{ secrets.MAG_DEPLOY_TOKEN }}" \\
|
|
30271
|
-
"\${
|
|
31209
|
+
"\${MAG_ENDPOINT}/store/v1/deploy/\${MAG_APP_ID}"
|
|
30272
31210
|
`;
|
|
30273
31211
|
var releaseSections = (app) => APP_RELEASE_DOC.slice(APP_RELEASE_DOC.indexOf("## ")).split("<app>").join(app);
|
|
30274
31212
|
var readme = (app, config) => `# ${app}
|
|
@@ -30546,10 +31484,11 @@ end_of_line = lf
|
|
|
30546
31484
|
[*.md]
|
|
30547
31485
|
trim_trailing_whitespace = false
|
|
30548
31486
|
`;
|
|
30549
|
-
function scaffoldFiles(appName, config, environment, extraDeps = {}, plugins = []) {
|
|
31487
|
+
function scaffoldFiles(appName, config, environment, extraDeps = {}, plugins = [], shell = {}) {
|
|
30550
31488
|
const app = appFileBase(appName);
|
|
30551
31489
|
const className = wcClassName(appName);
|
|
30552
31490
|
const selector = wcSelector(appName);
|
|
31491
|
+
const isPlugin = shell.kind === "plugin";
|
|
30553
31492
|
return [
|
|
30554
31493
|
{
|
|
30555
31494
|
path: "package.json",
|
|
@@ -30579,38 +31518,27 @@ function scaffoldFiles(appName, config, environment, extraDeps = {}, plugins = [
|
|
|
30579
31518
|
{ path: ".github/workflows/cd.yml", contents: cdWorkflow(app) },
|
|
30580
31519
|
{ path: "src/index.html", contents: indexHtml(appName, config) },
|
|
30581
31520
|
{ path: "src/main.ts", contents: mainTs() },
|
|
30582
|
-
{ path: "src/bootstrap.ts", contents: bootstrapTs(className) },
|
|
30583
|
-
{ path: "src/styles.sass", contents: stylesSass(selector) },
|
|
30584
|
-
{
|
|
30585
|
-
path: "src/environments/environment.ts",
|
|
30586
|
-
contents: environmentFile(
|
|
30587
|
-
environment.normal,
|
|
30588
|
-
"normal",
|
|
30589
|
-
false,
|
|
30590
|
-
`// Normal Environment \u2014 what \`ng serve\` / Run boots (ADR 0033).`
|
|
30591
|
-
)
|
|
30592
|
-
},
|
|
30593
31521
|
{
|
|
30594
|
-
path: "src/
|
|
30595
|
-
contents:
|
|
30596
|
-
environment.dev,
|
|
30597
|
-
"dev",
|
|
30598
|
-
false,
|
|
30599
|
-
`// Swapped in by \`ng build --configuration dev\`.`
|
|
30600
|
-
)
|
|
31522
|
+
path: "src/bootstrap.ts",
|
|
31523
|
+
contents: isPlugin ? pluginBootstrapTs() : bootstrapTs(className)
|
|
30601
31524
|
},
|
|
31525
|
+
{ path: "src/styles.sass", contents: stylesSass(selector) },
|
|
30602
31526
|
{
|
|
30603
|
-
path: "src/environments/environment.
|
|
30604
|
-
contents: environmentFile(
|
|
30605
|
-
environment.prod,
|
|
30606
|
-
"prod",
|
|
30607
|
-
true,
|
|
30608
|
-
`// Swapped in by \`ng build --configuration production\`.`
|
|
30609
|
-
)
|
|
31527
|
+
path: "src/environments/environment.ts",
|
|
31528
|
+
contents: environmentFile(environment)
|
|
30610
31529
|
},
|
|
30611
|
-
|
|
30612
|
-
|
|
30613
|
-
|
|
31530
|
+
...isPlugin ? [
|
|
31531
|
+
{ path: "src/app/wc.ts", contents: pluginWcTs(className, selector) },
|
|
31532
|
+
{ path: "src/app/wc.config.ts", contents: pluginWcConfigTs() },
|
|
31533
|
+
{
|
|
31534
|
+
path: PLUGIN_HARNESS_PATH,
|
|
31535
|
+
contents: pluginHarnessTs(shell.harness ?? [])
|
|
31536
|
+
}
|
|
31537
|
+
] : [
|
|
31538
|
+
{ path: "src/app/wc.ts", contents: wcTs(className, selector) },
|
|
31539
|
+
{ path: "src/app/wc.config.ts", contents: wcConfigTs(className) },
|
|
31540
|
+
{ path: "src/app/wc.routes.ts", contents: wcRoutesTs(app) }
|
|
31541
|
+
],
|
|
30614
31542
|
{ path: "src/app/providers.ts", contents: providersTs(app) },
|
|
30615
31543
|
{ path: "src/test-providers.ts", contents: testProvidersTs() },
|
|
30616
31544
|
{ path: "src/test-setup.ts", contents: testSetupTs() },
|
|
@@ -30622,7 +31550,8 @@ function scaffoldFiles(appName, config, environment, extraDeps = {}, plugins = [
|
|
|
30622
31550
|
config,
|
|
30623
31551
|
className,
|
|
30624
31552
|
selector,
|
|
30625
|
-
plugins
|
|
31553
|
+
plugins,
|
|
31554
|
+
isPlugin
|
|
30626
31555
|
)
|
|
30627
31556
|
},
|
|
30628
31557
|
// `mag_assets/navs/` is not here: the Nav tree is authored in the editor
|
|
@@ -30684,14 +31613,19 @@ var fakeOne = (dataType, shapes, depth) => {
|
|
|
30684
31613
|
return "null";
|
|
30685
31614
|
}
|
|
30686
31615
|
};
|
|
30687
|
-
var fakeShape = (shape, shapes, depth) =>
|
|
30688
|
-
|
|
30689
|
-
|
|
30690
|
-
member.cardinality,
|
|
30691
|
-
|
|
30692
|
-
|
|
30693
|
-
|
|
30694
|
-
|
|
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
|
+
);
|
|
30695
31629
|
var withShapes = (shapes, extra = []) => {
|
|
30696
31630
|
const list = Array.isArray(extra) ? extra : Object.values(extra);
|
|
30697
31631
|
return list.length ? {
|
|
@@ -31736,6 +32670,18 @@ var pluginContractsOf = (ws) => pluginContracts(
|
|
|
31736
32670
|
prefixOf(ws),
|
|
31737
32671
|
Object.values(ws.features ?? {})
|
|
31738
32672
|
);
|
|
32673
|
+
var scaffoldShellOf = (ws) => ws.appTarget.kind === "plugin" ? {
|
|
32674
|
+
kind: "plugin",
|
|
32675
|
+
harness: exposedScreenBindings(
|
|
32676
|
+
ws.screens.map((screen) => screen.meta),
|
|
32677
|
+
prefixOf(ws),
|
|
32678
|
+
Object.values(ws.features ?? {})
|
|
32679
|
+
).map(({ name: name3, className, importPath }) => ({
|
|
32680
|
+
name: name3,
|
|
32681
|
+
className,
|
|
32682
|
+
importPath
|
|
32683
|
+
}))
|
|
32684
|
+
} : {};
|
|
31739
32685
|
var controlMapOf = (screens) => {
|
|
31740
32686
|
const map = {};
|
|
31741
32687
|
screens.forEach(({ state }) => {
|
|
@@ -32182,7 +33128,8 @@ var emitFullAppFiles = (authored, stringify) => {
|
|
|
32182
33128
|
ws.wcConfig,
|
|
32183
33129
|
ws.appTarget.environment,
|
|
32184
33130
|
allowlistDeps(ws),
|
|
32185
|
-
pluginContractsOf(ws)
|
|
33131
|
+
pluginContractsOf(ws),
|
|
33132
|
+
scaffoldShellOf(ws)
|
|
32186
33133
|
);
|
|
32187
33134
|
const files3 = scaffold.map((file) => ({
|
|
32188
33135
|
path: file.path,
|
|
@@ -32206,6 +33153,7 @@ var emitFullAppFiles = (authored, stringify) => {
|
|
|
32206
33153
|
files3.push(...emitAuthoredAssets(ws, stringify));
|
|
32207
33154
|
return withGeneratedBanner(withEmittedTests(files3, isGeneratedPath));
|
|
32208
33155
|
};
|
|
33156
|
+
var authoredAssetPaths = (authored) => emitAuthoredAssets(inReach(authored), () => "").map((file) => file.path);
|
|
32209
33157
|
var allowlistDeps = (ws) => Object.fromEntries(
|
|
32210
33158
|
Object.values(ws.npmAllowlist ?? {}).map((entry2) => [
|
|
32211
33159
|
entry2.name,
|
|
@@ -32229,7 +33177,9 @@ var SHIPPED_SHELL_PATHS = [
|
|
|
32229
33177
|
"src/app/wc.ts",
|
|
32230
33178
|
"src/app/wc.config.ts",
|
|
32231
33179
|
"src/app/wc.routes.ts",
|
|
32232
|
-
"src/app/providers.ts"
|
|
33180
|
+
"src/app/providers.ts",
|
|
33181
|
+
// A Plugin App's: its addresses follow the Exposed Screens.
|
|
33182
|
+
PLUGIN_HARNESS_PATH
|
|
32233
33183
|
];
|
|
32234
33184
|
var emitShippedShellFiles = (authored) => {
|
|
32235
33185
|
const ws = inReach(authored);
|
|
@@ -32238,17 +33188,22 @@ var emitShippedShellFiles = (authored) => {
|
|
|
32238
33188
|
ws.wcConfig,
|
|
32239
33189
|
ws.appTarget.environment,
|
|
32240
33190
|
allowlistDeps(ws),
|
|
32241
|
-
pluginContractsOf(ws)
|
|
33191
|
+
pluginContractsOf(ws),
|
|
33192
|
+
scaffoldShellOf(ws)
|
|
32242
33193
|
).filter((file) => SHIPPED_SHELL_PATHS.includes(file.path)).map((file) => ({ path: file.path, contents: file.contents }));
|
|
32243
33194
|
};
|
|
32244
33195
|
var isRemoteManifestPath = (path) => /^mag_assets(_env\/[^/]+)?\/remote\/[^/]+\.yml$/.test(path);
|
|
32245
|
-
var
|
|
33196
|
+
var ENVIRONMENT_PATH = "src/environments/environment.ts";
|
|
33197
|
+
var syncedScaffoldFiles = (ws) => scaffoldFiles(
|
|
32246
33198
|
ws.appTarget.appName,
|
|
32247
33199
|
ws.wcConfig,
|
|
32248
33200
|
ws.appTarget.environment,
|
|
32249
33201
|
{},
|
|
32250
|
-
pluginContractsOf(ws)
|
|
32251
|
-
|
|
33202
|
+
pluginContractsOf(ws),
|
|
33203
|
+
scaffoldShellOf(ws)
|
|
33204
|
+
).filter(
|
|
33205
|
+
(file) => isRemoteManifestPath(file.path) || file.path === ENVIRONMENT_PATH
|
|
33206
|
+
).map((file) => ({ path: file.path, contents: file.contents }));
|
|
32252
33207
|
var emitOverlayFiles = (authored, stringify) => {
|
|
32253
33208
|
const ws = inReach(authored);
|
|
32254
33209
|
const files3 = emitScreenCode(ws, stringify);
|
|
@@ -32267,7 +33222,7 @@ var emitOverlayFiles = (authored, stringify) => {
|
|
|
32267
33222
|
});
|
|
32268
33223
|
}
|
|
32269
33224
|
files3.push(...emitAuthoredAssets(ws, stringify));
|
|
32270
|
-
files3.push(...
|
|
33225
|
+
files3.push(...syncedScaffoldFiles(ws));
|
|
32271
33226
|
return withGeneratedBanner(withEmittedTests(files3, isGeneratedPath));
|
|
32272
33227
|
};
|
|
32273
33228
|
var emitGeneratedFiles = (authored, stringify, tests = false) => emitOverlayFiles(authored, stringify).filter(
|
|
@@ -32294,6 +33249,56 @@ var filesToTree = (files3) => {
|
|
|
32294
33249
|
return root;
|
|
32295
33250
|
};
|
|
32296
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
|
+
|
|
32297
33302
|
// libs/codegen/src/model/history.ts
|
|
32298
33303
|
var HISTORY_DEPTH = 50;
|
|
32299
33304
|
var EMPTY_HISTORY = { undo: [], redo: [] };
|
|
@@ -32337,7 +33342,13 @@ var HISTORY_LABELS = [
|
|
|
32337
33342
|
"edit-nav",
|
|
32338
33343
|
"edit-config",
|
|
32339
33344
|
"edit-screen",
|
|
32340
|
-
"edit-samples"
|
|
33345
|
+
"edit-samples",
|
|
33346
|
+
// A Fix applied on the Repair Register is one step under its own name, so
|
|
33347
|
+
// the Undo button reads the Fix it takes back (ADR 0192).
|
|
33348
|
+
"fix-cast",
|
|
33349
|
+
"fix-prune",
|
|
33350
|
+
"fix-retype-parameters",
|
|
33351
|
+
"fix-route-inputs"
|
|
32341
33352
|
];
|
|
32342
33353
|
var HISTORY_AUTHORED_KEYS = [
|
|
32343
33354
|
"controlMap",
|
|
@@ -32430,9 +33441,10 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
32430
33441
|
DEFAULT_DEV_SOCKET_URL,
|
|
32431
33442
|
DEFAULT_INDEX_ALIAS,
|
|
32432
33443
|
DEFAULT_ITEM_ALIAS,
|
|
32433
|
-
|
|
32434
|
-
|
|
32435
|
-
|
|
33444
|
+
DEFAULT_KEY_ALIAS,
|
|
33445
|
+
DEFAULT_LOCAL_AUTH_URL,
|
|
33446
|
+
DEFAULT_LOCAL_BACKEND_URL,
|
|
33447
|
+
DEFAULT_LOCAL_SOCKET_URL,
|
|
32436
33448
|
DEFAULT_PROD_AUTH_URL,
|
|
32437
33449
|
DEFAULT_PROD_BACKEND_URL,
|
|
32438
33450
|
DEFAULT_PROD_SOCKET_URL,
|
|
@@ -32488,6 +33500,8 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
32488
33500
|
FORMAT_PIPE_LABEL,
|
|
32489
33501
|
FORMAT_PIPE_NAMES,
|
|
32490
33502
|
FORM_NAME_CONFIG_KEY,
|
|
33503
|
+
FUNCTION_LIBRARY_GROUPS,
|
|
33504
|
+
FUNCTION_STARTERS,
|
|
32491
33505
|
GENERATED_SET,
|
|
32492
33506
|
GLOBAL_METHOD_CATALOG,
|
|
32493
33507
|
GLOBAL_METHOD_STORES,
|
|
@@ -32589,9 +33603,11 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
32589
33603
|
PATTERN_MESSAGE_CONFIG_KEY,
|
|
32590
33604
|
PATTERN_NAME_MAX_LENGTH,
|
|
32591
33605
|
PATTERN_NAME_PATTERN,
|
|
33606
|
+
PLUGIN_HARNESS_PATH,
|
|
32592
33607
|
PLUGIN_INPUTS_KEY,
|
|
32593
33608
|
PLUGIN_LINK_KEY,
|
|
32594
33609
|
PLUGIN_OUTPUTS_KEY,
|
|
33610
|
+
PLUGIN_OUTPUT_SHAPES_KEY,
|
|
32595
33611
|
PLUGIN_PORT_KEY,
|
|
32596
33612
|
PLUGIN_SCREEN_KEY,
|
|
32597
33613
|
PLUGIN_SOURCE_KEY,
|
|
@@ -32638,6 +33654,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
32638
33654
|
SHARED_SHAPE_ID_PREFIX,
|
|
32639
33655
|
SHIPPED_SHELL_PATHS,
|
|
32640
33656
|
SOURCE_LANG,
|
|
33657
|
+
STARTER_GROUP,
|
|
32641
33658
|
STAT_TEXT_SOURCES,
|
|
32642
33659
|
STORAGE_SERVICE,
|
|
32643
33660
|
STYLE_DIRECTIVE_FORM,
|
|
@@ -32682,6 +33699,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
32682
33699
|
addMenuGroup,
|
|
32683
33700
|
addMenuGroupSeeded,
|
|
32684
33701
|
admitsTextSource,
|
|
33702
|
+
aliasDisplayName,
|
|
32685
33703
|
aliasHoldersInScope,
|
|
32686
33704
|
aliasNames,
|
|
32687
33705
|
aliasSourceSlot,
|
|
@@ -32719,11 +33737,13 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
32719
33737
|
assetRoot,
|
|
32720
33738
|
assignableVariantIds,
|
|
32721
33739
|
authoredArgs,
|
|
33740
|
+
authoredAssetPaths,
|
|
32722
33741
|
backfilledInstanceArgs,
|
|
32723
33742
|
baseOutputName,
|
|
32724
33743
|
bindablePaths,
|
|
32725
33744
|
bindingAlwaysPresent,
|
|
32726
33745
|
bindingCanvasText,
|
|
33746
|
+
bindingCardinality,
|
|
32727
33747
|
bindingDataType,
|
|
32728
33748
|
bindingDisplayText,
|
|
32729
33749
|
bindingExpression,
|
|
@@ -32768,6 +33788,9 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
32768
33788
|
callArgumentsExpression,
|
|
32769
33789
|
callError,
|
|
32770
33790
|
callStatement,
|
|
33791
|
+
callTargetKey,
|
|
33792
|
+
callTargetName,
|
|
33793
|
+
callTargetOfKey,
|
|
32771
33794
|
callableMethods,
|
|
32772
33795
|
canAddChildType,
|
|
32773
33796
|
canAppendFormatPipe,
|
|
@@ -32838,12 +33861,17 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
32838
33861
|
collectTranslationAssets,
|
|
32839
33862
|
collectTypedComponentInputs,
|
|
32840
33863
|
columnNeedsId,
|
|
33864
|
+
compactControlGroups,
|
|
33865
|
+
compactControlMap,
|
|
32841
33866
|
comparisonSource,
|
|
32842
33867
|
componentInputShapeIds,
|
|
32843
33868
|
componentInputTsType,
|
|
33869
|
+
composeFunctionBinding,
|
|
32844
33870
|
composeLabelValue,
|
|
32845
33871
|
computeError,
|
|
32846
33872
|
computeId,
|
|
33873
|
+
computeInputMemberError,
|
|
33874
|
+
computeInputPaths,
|
|
32847
33875
|
computeIsRead,
|
|
32848
33876
|
computeMemberRead,
|
|
32849
33877
|
computeNameTaken,
|
|
@@ -32888,6 +33916,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
32888
33916
|
createCompute,
|
|
32889
33917
|
createCondition,
|
|
32890
33918
|
createConfirm,
|
|
33919
|
+
createFunctionLeaf,
|
|
32891
33920
|
createGroup,
|
|
32892
33921
|
createOpen,
|
|
32893
33922
|
createOutputNav,
|
|
@@ -32910,14 +33939,11 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
32910
33939
|
decodeWorkspace,
|
|
32911
33940
|
defaultCallArgEvent,
|
|
32912
33941
|
defaultChildId,
|
|
32913
|
-
defaultDevHosts,
|
|
32914
33942
|
defaultEnvironment,
|
|
32915
33943
|
defaultLiteralFor,
|
|
32916
|
-
defaultNormalHosts,
|
|
32917
33944
|
defaultOptionValue,
|
|
32918
33945
|
defaultOutputArm,
|
|
32919
33946
|
defaultOutputOpenValue,
|
|
32920
|
-
defaultProdHosts,
|
|
32921
33947
|
defaultScreenEmitValue,
|
|
32922
33948
|
defaultScreenWriteValue,
|
|
32923
33949
|
defaultStateWriteValue,
|
|
@@ -33023,7 +34049,9 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33023
34049
|
firstControlAtLayer,
|
|
33024
34050
|
fittedCaseArgs,
|
|
33025
34051
|
fixedAllowed,
|
|
34052
|
+
fixedExpression,
|
|
33026
34053
|
fixedIsText,
|
|
34054
|
+
fixedItems,
|
|
33027
34055
|
fnv64,
|
|
33028
34056
|
foldedButtonName,
|
|
33029
34057
|
foldedButtons,
|
|
@@ -33064,6 +34092,11 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33064
34092
|
formatPipeExpression,
|
|
33065
34093
|
formatPipeImports,
|
|
33066
34094
|
formatPipesOf,
|
|
34095
|
+
functionBindingArgs,
|
|
34096
|
+
functionBindingId,
|
|
34097
|
+
functionBindingTarget,
|
|
34098
|
+
functionChipDisplay,
|
|
34099
|
+
functionError,
|
|
33067
34100
|
functionFileBase,
|
|
33068
34101
|
functionFilePath,
|
|
33069
34102
|
functionImportPath,
|
|
@@ -33081,6 +34114,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33081
34114
|
generateFormInterface,
|
|
33082
34115
|
generateFormValidation,
|
|
33083
34116
|
generateFormValidationFile,
|
|
34117
|
+
generateFunctionExpression,
|
|
33084
34118
|
generateFunctionFile,
|
|
33085
34119
|
generateHtml,
|
|
33086
34120
|
generateRuleExpression,
|
|
@@ -33159,6 +34193,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33159
34193
|
isBaseVariantId,
|
|
33160
34194
|
isBindingInScope,
|
|
33161
34195
|
isBooleanStateProperty,
|
|
34196
|
+
isBornNamed,
|
|
33162
34197
|
isBranchFamily,
|
|
33163
34198
|
isBusyVariantId,
|
|
33164
34199
|
isCacheMethod,
|
|
@@ -33193,7 +34228,9 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33193
34228
|
isFunctionInUse,
|
|
33194
34229
|
isGeneratedPath,
|
|
33195
34230
|
isHeld,
|
|
34231
|
+
isIdentifier,
|
|
33196
34232
|
isKeyArg,
|
|
34233
|
+
isKeyedRepeat,
|
|
33197
34234
|
isKnownVariantId,
|
|
33198
34235
|
isLegalNavTail,
|
|
33199
34236
|
isLinkedFormModel,
|
|
@@ -33336,8 +34373,11 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33336
34373
|
mappedMethod,
|
|
33337
34374
|
mappedProperties,
|
|
33338
34375
|
maxVariants,
|
|
34376
|
+
memberAccess,
|
|
33339
34377
|
memberIdsOf,
|
|
33340
34378
|
memberKindOf,
|
|
34379
|
+
memberStep,
|
|
34380
|
+
memberToken,
|
|
33341
34381
|
menuActionCheckLabel,
|
|
33342
34382
|
menuActionKey,
|
|
33343
34383
|
menuActionKeys,
|
|
@@ -33440,6 +34480,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33440
34480
|
newInstanceFunctionOption,
|
|
33441
34481
|
newOutputArmCheck,
|
|
33442
34482
|
newRepeatSpec,
|
|
34483
|
+
newerVersion,
|
|
33443
34484
|
nextAliasName,
|
|
33444
34485
|
nextCallArgRow,
|
|
33445
34486
|
nextFieldName,
|
|
@@ -33584,17 +34625,22 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33584
34625
|
pickFolder,
|
|
33585
34626
|
pickedNavTail,
|
|
33586
34627
|
planScreenEmit,
|
|
34628
|
+
pluginContractResync,
|
|
33587
34629
|
pluginContracts,
|
|
33588
34630
|
pluginInputSlot,
|
|
33589
34631
|
pluginNamesOf,
|
|
33590
34632
|
pluginOriginKey,
|
|
34633
|
+
pluginOutputShapeOf,
|
|
33591
34634
|
pluginPickWrites,
|
|
33592
34635
|
pluginPortOf,
|
|
33593
34636
|
pluginSourceOf,
|
|
34637
|
+
presetHosts,
|
|
33594
34638
|
propertiesWithComputeds,
|
|
34639
|
+
propertyKey,
|
|
33595
34640
|
pruneFormEventReads,
|
|
33596
34641
|
pruneMappings,
|
|
33597
34642
|
pruneMenuActions,
|
|
34643
|
+
pruneOrphanMessageBindings,
|
|
33598
34644
|
pruneOutputCalls,
|
|
33599
34645
|
pruneOutputLinkArgs,
|
|
33600
34646
|
pruneUnknownShapeRefs,
|
|
@@ -33605,6 +34651,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33605
34651
|
pureFunctionArgs,
|
|
33606
34652
|
pureFunctionTest,
|
|
33607
34653
|
pureTarget,
|
|
34654
|
+
putSectionTableColumn,
|
|
33608
34655
|
quantifierApplies,
|
|
33609
34656
|
readDesignSource,
|
|
33610
34657
|
readFileAt,
|
|
@@ -33658,6 +34705,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33658
34705
|
repairMessageVariables,
|
|
33659
34706
|
repairSplitShapes,
|
|
33660
34707
|
repairTranslationMarkup,
|
|
34708
|
+
repeatEntryLets,
|
|
33661
34709
|
repeatGapReason,
|
|
33662
34710
|
repeatHeader,
|
|
33663
34711
|
repeatSpec,
|
|
@@ -33693,10 +34741,13 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33693
34741
|
routeTargets,
|
|
33694
34742
|
routerLinkMode,
|
|
33695
34743
|
routesNavTail,
|
|
34744
|
+
rowMemberOptions,
|
|
33696
34745
|
rowsWithOneDefault,
|
|
33697
34746
|
ruleCalls,
|
|
33698
34747
|
ruleChecks,
|
|
33699
34748
|
ruleError,
|
|
34749
|
+
ruleFunctionImports,
|
|
34750
|
+
ruleFunctions,
|
|
33700
34751
|
ruleGlobalStores,
|
|
33701
34752
|
ruleNavs,
|
|
33702
34753
|
ruleReferencedIds,
|
|
@@ -33805,6 +34856,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33805
34856
|
seededMenuOptions,
|
|
33806
34857
|
segmentOptions,
|
|
33807
34858
|
selectableShapes,
|
|
34859
|
+
seriesMemberPicks,
|
|
33808
34860
|
setArmClosesOverlay,
|
|
33809
34861
|
setArmDialog,
|
|
33810
34862
|
setArmNav,
|
|
@@ -33812,6 +34864,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33812
34864
|
setMenuActionChecks,
|
|
33813
34865
|
setOutputArmChecks,
|
|
33814
34866
|
setOutputArmMode,
|
|
34867
|
+
setOutputArmStartsChain,
|
|
33815
34868
|
setVariantJoin,
|
|
33816
34869
|
shadowOnPath,
|
|
33817
34870
|
shadowedShapes,
|
|
@@ -33839,6 +34892,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33839
34892
|
staleCases,
|
|
33840
34893
|
staleMenuActionItems,
|
|
33841
34894
|
standardMenuConfigs,
|
|
34895
|
+
starterFunction,
|
|
33842
34896
|
stateComputedArgExpression,
|
|
33843
34897
|
stateComputedArgHeldType,
|
|
33844
34898
|
stateInterfaceName,
|
|
@@ -33915,6 +34969,7 @@ var HISTORY_SELECTION_KEYS = [
|
|
|
33915
34969
|
toPascalCase,
|
|
33916
34970
|
toSectionTableColumns,
|
|
33917
34971
|
toggleFieldOptionValue,
|
|
34972
|
+
transformBindingLeaves,
|
|
33918
34973
|
transformGapDetail,
|
|
33919
34974
|
transformIncomplete,
|
|
33920
34975
|
transformLabel,
|