@magmonium/cli 0.8.17 → 0.8.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/bin/cli.js +2 -0
  2. package/bin/commands/assets.js +42 -0
  3. package/bin/commands/fix-i18n.js +27 -12
  4. package/bin/commands/i18n-baseline.js +33 -0
  5. package/codegen/index.js +320 -46
  6. package/package.json +1 -1
  7. package/src/compilers/logo-compiler.d.ts.map +1 -1
  8. package/src/compilers/logo-compiler.js +3 -1
  9. package/src/compilers/logo-compiler.js.map +1 -1
  10. package/src/compilers/web-component/lib/web-component-wrapper.d.ts.map +1 -1
  11. package/src/compilers/web-component/lib/web-component-wrapper.js +62 -48
  12. package/src/compilers/web-component/lib/web-component-wrapper.js.map +1 -1
  13. package/src/compilers/web-component/model/type.d.ts +1 -0
  14. package/src/compilers/web-component/model/type.d.ts.map +1 -1
  15. package/src/index.d.ts +1 -0
  16. package/src/index.d.ts.map +1 -1
  17. package/src/index.js +1 -0
  18. package/src/index.js.map +1 -1
  19. package/src/utils/ai-provider-translator.d.ts +10 -5
  20. package/src/utils/ai-provider-translator.d.ts.map +1 -1
  21. package/src/utils/ai-provider-translator.js +37 -31
  22. package/src/utils/ai-provider-translator.js.map +1 -1
  23. package/src/utils/app-logo-svg.d.ts +4 -3
  24. package/src/utils/app-logo-svg.d.ts.map +1 -1
  25. package/src/utils/app-logo-svg.js +30 -4
  26. package/src/utils/app-logo-svg.js.map +1 -1
  27. package/src/utils/i18n-fixer.d.ts +2 -3
  28. package/src/utils/i18n-fixer.d.ts.map +1 -1
  29. package/src/utils/i18n-fixer.js +24 -56
  30. package/src/utils/i18n-fixer.js.map +1 -1
  31. package/src/utils/i18n-gate.d.ts +28 -0
  32. package/src/utils/i18n-gate.d.ts.map +1 -0
  33. package/src/utils/i18n-gate.js +66 -0
  34. package/src/utils/i18n-gate.js.map +1 -0
package/codegen/index.js CHANGED
@@ -243,6 +243,7 @@ __export(index_exports, {
243
243
  PATTERN_MESSAGE_CONFIG_KEY: () => PATTERN_MESSAGE_CONFIG_KEY,
244
244
  PATTERN_NAME_MAX_LENGTH: () => PATTERN_NAME_MAX_LENGTH,
245
245
  PATTERN_NAME_PATTERN: () => PATTERN_NAME_PATTERN,
246
+ PLUGIN_HARNESS_PATH: () => PLUGIN_HARNESS_PATH,
246
247
  PLUGIN_INPUTS_KEY: () => PLUGIN_INPUTS_KEY,
247
248
  PLUGIN_LINK_KEY: () => PLUGIN_LINK_KEY,
248
249
  PLUGIN_OUTPUTS_KEY: () => PLUGIN_OUTPUTS_KEY,
@@ -373,6 +374,7 @@ __export(index_exports, {
373
374
  assetRoot: () => assetRoot,
374
375
  assignableVariantIds: () => assignableVariantIds,
375
376
  authoredArgs: () => authoredArgs,
377
+ authoredAssetPaths: () => authoredAssetPaths,
376
378
  backfilledInstanceArgs: () => backfilledInstanceArgs,
377
379
  baseOutputName: () => baseOutputName,
378
380
  bindablePaths: () => bindablePaths,
@@ -492,12 +494,16 @@ __export(index_exports, {
492
494
  collectTranslationAssets: () => collectTranslationAssets,
493
495
  collectTypedComponentInputs: () => collectTypedComponentInputs,
494
496
  columnNeedsId: () => columnNeedsId,
497
+ compactControlGroups: () => compactControlGroups,
498
+ compactControlMap: () => compactControlMap,
495
499
  comparisonSource: () => comparisonSource,
496
500
  componentInputShapeIds: () => componentInputShapeIds,
497
501
  componentInputTsType: () => componentInputTsType,
498
502
  composeLabelValue: () => composeLabelValue,
499
503
  computeError: () => computeError,
500
504
  computeId: () => computeId,
505
+ computeInputMemberError: () => computeInputMemberError,
506
+ computeInputPaths: () => computeInputPaths,
501
507
  computeIsRead: () => computeIsRead,
502
508
  computeMemberRead: () => computeMemberRead,
503
509
  computeNameTaken: () => computeNameTaken,
@@ -813,6 +819,7 @@ __export(index_exports, {
813
819
  isBaseVariantId: () => isBaseVariantId,
814
820
  isBindingInScope: () => isBindingInScope,
815
821
  isBooleanStateProperty: () => isBooleanStateProperty,
822
+ isBornNamed: () => isBornNamed,
816
823
  isBranchFamily: () => isBranchFamily,
817
824
  isBusyVariantId: () => isBusyVariantId,
818
825
  isCacheMethod: () => isCacheMethod,
@@ -1249,6 +1256,7 @@ __export(index_exports, {
1249
1256
  pruneFormEventReads: () => pruneFormEventReads,
1250
1257
  pruneMappings: () => pruneMappings,
1251
1258
  pruneMenuActions: () => pruneMenuActions,
1259
+ pruneOrphanMessageBindings: () => pruneOrphanMessageBindings,
1252
1260
  pruneOutputCalls: () => pruneOutputCalls,
1253
1261
  pruneOutputLinkArgs: () => pruneOutputLinkArgs,
1254
1262
  pruneUnknownShapeRefs: () => pruneUnknownShapeRefs,
@@ -1896,16 +1904,21 @@ document \u2014 there is one source and two places it is read.
1896
1904
 
1897
1905
  ## Configure before your first release
1898
1906
 
1899
- Register the app in the Magmonium Store first \u2014 that is what mints its app id.
1907
+ Register the app in the Magmonium Store first \u2014 that is what mints its app id \u2014
1908
+ and link it in One UI, so every Push writes that id into \`.magmonium/index.json\`.
1909
+ CD reads the app id from \`appTarget.appId\` there, and the backend from
1910
+ \`appTarget.environment.prod.backendUrl\`.
1911
+
1900
1912
  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. Then, in **Settings \u2192 Secrets and variables \u2192 Actions**:
1913
+ and reuse it for every app you own or collaborate on. It is the one secret, in
1914
+ **Settings \u2192 Secrets and variables \u2192 Actions**:
1902
1915
 
1903
1916
  | Secret | Value |
1904
1917
  | --- | --- |
1905
- | \`MAG_ENDPOINT\` | Base URL of the Magmonium backend, no trailing slash |
1906
- | \`MAG_APP_ID\` | The Store's id for this app |
1907
1918
  | \`MAG_DEPLOY_TOKEN\` | Your personal deploy token |
1908
1919
 
1920
+ An app made by Extract Plugin has it set for you.
1921
+
1909
1922
  ## CI
1910
1923
 
1911
1924
  \`.github/workflows/ci.yml\`, on a pull request into \`main\` and nothing else.
@@ -1921,9 +1934,9 @@ without merging.
1921
1934
 
1922
1935
  It deploys **only when that merge changed \`version:\` in
1923
1936
  \`mag_assets/remote/<app>.yml\`**. Merging is not a release; bumping the version
1924
- is. That gate is also why an unconfigured scaffold is quiet rather than broken:
1925
- seeded at \`0.0.1\`, nothing fires until you have registered, set the three
1926
- secrets, and released.
1937
+ is. The first merge into \`main\` is a release all the same: \`main\` has no
1938
+ manifest yet, so \`version:\` goes from nothing to \`0.0.1\` and CD deploys it.
1939
+ Register, link and set \`MAG_DEPLOY_TOKEN\` before that merge.
1927
1940
 
1928
1941
  To release:
1929
1942
 
@@ -2946,6 +2959,7 @@ var SHARED_ICONS = [
2946
2959
  "wallet_shareholder",
2947
2960
  "wand",
2948
2961
  "wifi",
2962
+ "wrench",
2949
2963
  "x",
2950
2964
  "zap"
2951
2965
  ];
@@ -3540,6 +3554,7 @@ var isSectionHeaderSlotFamily = (type) => type === "section_header_label" /* SEC
3540
3554
  var isSlotFamily = (type) => isStatSlotFamily(type) || isSectionHeaderSlotFamily(type);
3541
3555
  var isTaglessFamily = (type) => isBranchFamily(type) || isRepeatFamily(type);
3542
3556
  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 */;
3557
+ var isBornNamed = (type) => !isTaglessFamily(type) && !isSlotFamily(type) && type !== "section_table_row" /* SECTION_TABLE_ROW */ && type !== "section_table_cell" /* SECTION_TABLE_CELL */;
3543
3558
  var DEFAULT_ARM_KIND = "branch";
3544
3559
  var ARM_KINDS = ["branch", "default"];
3545
3560
  var armKind = (control) => control?.armKind ?? DEFAULT_ARM_KIND;
@@ -12639,7 +12654,9 @@ function loadAppTarget(storage) {
12639
12654
  appName: asString(stored.appName),
12640
12655
  appPath: asString(stored.appPath),
12641
12656
  environment: loadEnvironment(stored, legacySocketFromWc(storage)),
12642
- ...typeof stored.appId === "string" && stored.appId ? { appId: stored.appId } : {}
12657
+ ...typeof stored.appId === "string" && stored.appId ? { appId: stored.appId } : {},
12658
+ // A Plugin App reopens as one; any other word reads as an ordinary app.
12659
+ ...stored.kind === "plugin" ? { kind: "plugin" } : {}
12643
12660
  };
12644
12661
  }
12645
12662
  function saveAppTarget(storage, target) {
@@ -13352,6 +13369,45 @@ function computeTextPaths(computes, functions, shapes) {
13352
13369
  }
13353
13370
  return out;
13354
13371
  }
13372
+ function computeInputPaths(computes, functions, shapes) {
13373
+ const out = [];
13374
+ for (const compute of computes) {
13375
+ const fn = functions[compute.functionId];
13376
+ const name3 = compute.name.trim();
13377
+ if (!fn || !name3) continue;
13378
+ const walk = (member, label, dataType, cardinality, seen) => {
13379
+ out.push({ name: name3, member, label, dataType, cardinality });
13380
+ if (cardinality !== "one" || dataType?.type !== "shape") return;
13381
+ const shape = shapes[dataType.shapeId];
13382
+ if (!shape || seen.has(dataType.shapeId)) return;
13383
+ const next = new Set(seen).add(dataType.shapeId);
13384
+ for (const key2 of shape.keys) {
13385
+ walk(
13386
+ [...member, key2.id],
13387
+ `${label}.${key2.name}`,
13388
+ key2.dataType,
13389
+ key2.cardinality,
13390
+ next
13391
+ );
13392
+ }
13393
+ };
13394
+ walk([], name3, fn.returnType, fn.returnCardinality, /* @__PURE__ */ new Set());
13395
+ }
13396
+ return out;
13397
+ }
13398
+ function computeInputMemberError(method, functions, shapes) {
13399
+ for (const mapping of method.inputs) {
13400
+ if (mapping.source !== "compute" || !mapping.member?.length) continue;
13401
+ const compute = (method.computes ?? []).find(
13402
+ (c) => c.name === mapping.compute
13403
+ );
13404
+ const fn = compute && functions[compute.functionId];
13405
+ if (!fn || !computeMemberRead(fn, mapping.member, shapes)) {
13406
+ return "input-incomplete";
13407
+ }
13408
+ }
13409
+ return void 0;
13410
+ }
13355
13411
  function computeIsRead(method, name3) {
13356
13412
  const wanted = name3.trim();
13357
13413
  if (!wanted) return false;
@@ -13779,6 +13835,27 @@ function isUsableTranslation(sourceText, langText) {
13779
13835
  const repaired = repairTranslationMarkup(sourceText, langText);
13780
13836
  return !hasVariableDrift(variableDrift(sourceText, repaired)) && !hasLinkDrift(linkDrift(sourceText, repaired));
13781
13837
  }
13838
+ function pruneOrphanMessageBindings(control, translations) {
13839
+ const bindings = control.bindings;
13840
+ if (!bindings) return control;
13841
+ const named = /* @__PURE__ */ new Set();
13842
+ for (const configKey of TRANSLATION_CONFIG_KEYS) {
13843
+ const value = control.configs?.[configKey];
13844
+ const { key: key2 } = parseLabelValue(
13845
+ typeof value === "string" ? value : void 0
13846
+ );
13847
+ if (!key2) continue;
13848
+ const text2 = translations[key2]?.[SOURCE_LANG];
13849
+ if (text2 === void 0) return control;
13850
+ extractAllVariables(text2).forEach(({ name: name3 }) => named.add(name3));
13851
+ }
13852
+ const kept = Object.entries(bindings).filter(
13853
+ ([slot]) => !isMessageSlot(slot) || named.has(messageSlotName(slot))
13854
+ );
13855
+ if (kept.length === Object.keys(bindings).length) return control;
13856
+ const { bindings: _dropped, ...rest } = control;
13857
+ return kept.length ? { ...rest, bindings: Object.fromEntries(kept) } : rest;
13858
+ }
13782
13859
  function unfilledVariables(configValue, translations, samples, bound = []) {
13783
13860
  const { key: key2, params } = parseLabelValue(configValue);
13784
13861
  if (!key2) return [];
@@ -14381,11 +14458,24 @@ function modalConfigEntry(open, indent2) {
14381
14458
  ${keys.map((key2) => `${indent2} ${key2}`).join("\n")}
14382
14459
  ${indent2}},`;
14383
14460
  }
14384
- function mappingExpression(mapping, target, properties, shapes, functions, receiverOf = OWN_STORE) {
14461
+ function mappingExpression(mapping, target, properties, shapes, functions, computes, receiverOf = OWN_STORE) {
14385
14462
  let source;
14386
14463
  if (mapping.source === "args") source = `${mapping.arg}`;
14387
- else if (mapping.source === "compute") source = `compute.${mapping.compute}`;
14388
- else if (mapping.source === "fixed") {
14464
+ else if (mapping.source === "compute") {
14465
+ const compute = computes.find((c) => c.name === mapping.compute);
14466
+ const fn = compute && functions[compute.functionId];
14467
+ const absent = !!fn?.returnUndefined;
14468
+ const waits = absent && target.required;
14469
+ source = `compute.${mapping.compute}`;
14470
+ if (mapping.member?.length) {
14471
+ const member = fn ? computeMemberRead(fn, mapping.member, shapes) : void 0;
14472
+ if (!fn || !member) return void 0;
14473
+ const dot = absent && !waits ? "?." : ".";
14474
+ source += member.names.map((name3, at) => `${at === 0 && waits ? "!" : ""}${dot}${name3}`).join("");
14475
+ } else if (waits) {
14476
+ source += "!";
14477
+ }
14478
+ } else if (mapping.source === "fixed") {
14389
14479
  source = literalExpression(mapping.value ?? "", target.dataType);
14390
14480
  } else {
14391
14481
  source = statePathExpression(
@@ -14424,6 +14514,7 @@ function paramExpression(param, method, targets, properties, shapes, functions,
14424
14514
  properties,
14425
14515
  shapes,
14426
14516
  functions,
14517
+ method.computes ?? [],
14427
14518
  receiverOf
14428
14519
  );
14429
14520
  };
@@ -15499,6 +15590,24 @@ ${computeLines.map((line) => ` ${line}`).join("\n")}
15499
15590
  return { ${args.length ? `...${guardReceiver}, ` : ""}compute: { ${computes.map((compute) => compute.name).join(", ")} } };
15500
15591
  }),` : "";
15501
15592
  if (computes.length) emitsMap = true;
15593
+ const computeValueGuards = method.inputs.flatMap((mapping) => {
15594
+ if (mapping.source !== "compute" || !mapping.compute) return [];
15595
+ const target = targets.find(
15596
+ (t) => t.label === targetKey2(mapping.target) && t.required
15597
+ );
15598
+ if (!target) return [];
15599
+ const compute = computes.find((c) => c.name === mapping.compute);
15600
+ const fn = compute && functions[compute.functionId];
15601
+ if (!fn?.returnUndefined) return [];
15602
+ const read = `${COMPUTE_BAG}.${mapping.compute}`;
15603
+ return [
15604
+ target.cardinality === "many" ? `!!${read}?.length` : `${read} !== undefined`
15605
+ ];
15606
+ });
15607
+ const computeValueGuardBlock = computeValueGuards.length ? `
15608
+ filter(({ ${COMPUTE_BAG} }) => ${Array.from(
15609
+ new Set(computeValueGuards)
15610
+ ).join(" && ")}),` : "";
15502
15611
  const confirm = drawnConfirm(method);
15503
15612
  const confirmParams = {};
15504
15613
  for (const [slot, binding] of Object.entries(confirm?.params ?? {})) {
@@ -15577,7 +15686,7 @@ ${beforePersists.map((line) => ` ${line}`).join("\n")}
15577
15686
  version: op.version,
15578
15687
  segments: op.segments,
15579
15688
  args,
15580
- waits: guards.length > guardArgs.size || !!conditionBlock || !!computeGuardBlock || emitsOpen,
15689
+ waits: guards.length > guardArgs.size || !!conditionBlock || !!computeGuardBlock || !!computeValueGuardBlock || emitsOpen,
15581
15690
  ...debounceBlock && method.debounce ? { debounce: Math.round(method.debounce.seconds * 1e3) } : {},
15582
15691
  confirms: !!confirmBlock,
15583
15692
  ok: {
@@ -15609,7 +15718,7 @@ ${beforePersists.map((line) => ` ${line}`).join("\n")}
15609
15718
  // ends — `finalize` fires on success, on error and when a later call
15610
15719
  // replaces it, so the wait never outlives the request (ADR 0139).
15611
15720
  ` ${method.name}: rxMethod<${argType}>(
15612
- pipe(${debounceBlock}${guardBlock}${conditionBlock}${computeGuardBlock}${computeBlock}${confirmBlock}${beforeBlock}
15721
+ pipe(${debounceBlock}${guardBlock}${conditionBlock}${computeGuardBlock}${computeBlock}${computeValueGuardBlock}${confirmBlock}${beforeBlock}
15613
15722
  switchMap(${callArgName} => {${settleOnly ? `
15614
15723
  const { onSent, onSettled } = (input || {}) as { ${SETTLE_MEMBERS.join("; ")} };` : ""}
15615
15724
  onSent?.();
@@ -15620,7 +15729,7 @@ ${beforePersists.map((line) => ` ${line}`).join("\n")}
15620
15729
  )
15621
15730
  ),`
15622
15731
  ) : ` ${method.name}: rxMethod<${argType}>(
15623
- pipe(${debounceBlock}${guardBlock}${conditionBlock}${computeGuardBlock}${computeBlock}${confirmBlock}${beforeBlock}
15732
+ pipe(${debounceBlock}${guardBlock}${conditionBlock}${computeGuardBlock}${computeBlock}${computeValueGuardBlock}${confirmBlock}${beforeBlock}
15624
15733
  switchMap(${callArgName} =>
15625
15734
  ${apiCall}.pipe(${tapBlock}${catchBlock}
15626
15735
  )
@@ -24571,7 +24680,7 @@ __export(package_exports, {
24571
24680
  version: () => version
24572
24681
  });
24573
24682
  var name = "@magmonium/one";
24574
- var version = "0.4.47";
24683
+ var version = "0.4.51";
24575
24684
  var description = "Magmonium One \u2014 Angular design-system primitives for mm Apps";
24576
24685
  var author = "magmonium";
24577
24686
  var license = "MIT";
@@ -24639,7 +24748,7 @@ __export(package_exports2, {
24639
24748
  version: () => version2
24640
24749
  });
24641
24750
  var name2 = "@magmonium/cli";
24642
- var version2 = "0.8.17";
24751
+ var version2 = "0.8.18";
24643
24752
  var description2 = "A powerful and extensible asset compilation tool that can be shared across multiple projects";
24644
24753
  var bin = {
24645
24754
  "mag-cli": "bin/cli.js"
@@ -26202,7 +26311,7 @@ var caseEquals = (actual, expected) => {
26202
26311
  };
26203
26312
 
26204
26313
  // libs/codegen/src/lib/workspace-codec.ts
26205
- var WORKSPACE_SCHEMA_VERSION = 28;
26314
+ var WORKSPACE_SCHEMA_VERSION = 29;
26206
26315
  var MIGRATION_FLOOR = 18;
26207
26316
  var DEPLOY_TOKEN_METHOD_IDS = {
26208
26317
  "@UserStore.ensureDeployToken": "@AuthStore.ensureDeployToken",
@@ -26298,6 +26407,20 @@ var mapBlobControls = (blob, step) => {
26298
26407
  }
26299
26408
  return next;
26300
26409
  };
26410
+ var compactStoredControl = (control) => {
26411
+ const configs = control["configs"];
26412
+ if (!configs || typeof configs !== "object" || Array.isArray(configs)) {
26413
+ return control;
26414
+ }
26415
+ const idNamed = isBornNamed(control["type"]);
26416
+ const entries = Object.entries(configs);
26417
+ const written = entries.filter(
26418
+ ([key2, value]) => value !== "" && !(idNamed && key2 === "name" && value === control["id"])
26419
+ );
26420
+ return written.length === entries.length ? control : { ...control, configs: Object.fromEntries(written) };
26421
+ };
26422
+ var compactControlMap = (controlMap) => mapStoredControls(controlMap, compactStoredControl);
26423
+ var compactControlGroups = (groups) => mapBlobControls({ controlGroups: groups }, compactStoredControl)["controlGroups"];
26301
26424
  var moveBlobSpacing = (blob) => mapBlobControls(blob, moveSpacingToStyleDirectives);
26302
26425
  var dropOptionMultiple = (control) => {
26303
26426
  const configs = control["configs"];
@@ -26381,6 +26504,21 @@ var screenOnly = (step) => ({
26381
26504
  step
26382
26505
  });
26383
26506
  var MIGRATIONS = {
26507
+ // 28 → 29: a Control writes only what it says, in a Screen's ControlMap and
26508
+ // in every ControlGroup — and a `var:` binding on one carrying no message
26509
+ // goes. No translations reach a step, so a slot under a key is kept: it may
26510
+ // be one the key's text names.
26511
+ 28: everyKind(
26512
+ (blob) => mapBlobControls(
26513
+ blob,
26514
+ (control) => compactStoredControl(
26515
+ pruneOrphanMessageBindings(
26516
+ control,
26517
+ {}
26518
+ )
26519
+ )
26520
+ )
26521
+ ),
26384
26522
  // 27 → 28: a Button's `url`/`murl` move onto its LinkTarget, in a Screen's
26385
26523
  // ControlMap and in every ControlGroup.
26386
26524
  27: everyKind((blob) => mapBlobControls(blob, moveButtonNavTarget)),
@@ -26562,7 +26700,9 @@ function sanitizeAppTarget(value) {
26562
26700
  appName: typeof target.appName === "string" ? target.appName : "",
26563
26701
  appPath: typeof target.appPath === "string" ? target.appPath : "",
26564
26702
  environment: loadEnvironment(target),
26565
- ...typeof target.appId === "string" && target.appId ? { appId: target.appId } : {}
26703
+ ...typeof target.appId === "string" && target.appId ? { appId: target.appId } : {},
26704
+ // A Plugin App reopens as one; any other word reads as an ordinary app.
26705
+ ...target.kind === "plugin" ? { kind: "plugin" } : {}
26566
26706
  };
26567
26707
  }
26568
26708
  function sanitizeDataType(value, shapes) {
@@ -26965,7 +27105,11 @@ function sanitizeMethods(methods, properties, functions = {}) {
26965
27105
  }).map((param) => ({
26966
27106
  id: param.id,
26967
27107
  name: param.name.trim(),
26968
- dataType: { type: param.dataType.type }
27108
+ dataType: { type: param.dataType.type },
27109
+ // The one axis the User answers for a parameter nothing sends, so the
27110
+ // load is where it would otherwise be lost silently (GLOSSARY.md
27111
+ // MethodParam).
27112
+ ...param.required ? { required: true } : {}
26969
27113
  }));
26970
27114
  result[id] = {
26971
27115
  id,
@@ -28169,6 +28313,9 @@ function pruneUnknownTypes(controlMap) {
28169
28313
  control.childrens = (control.childrens || []).filter(
28170
28314
  (childId) => pruned[childId]
28171
28315
  );
28316
+ if (isBornNamed(control.type) && !("name" in (control.configs ?? {}))) {
28317
+ control.configs = { ...control.configs, name: control.id };
28318
+ }
28172
28319
  if (control.source && !CONFIG_SOURCES.includes(control.source)) {
28173
28320
  control.source = RAW_CONFIG_SOURCE;
28174
28321
  }
@@ -28374,7 +28521,8 @@ function buildDesignSource(ws, operations = drawnOperations(ws)) {
28374
28521
  ASSET_FILES.forEach(([file, key2]) => {
28375
28522
  files3[assetPath(file)] = json({
28376
28523
  v: WORKSPACE_SCHEMA_VERSION,
28377
- [file]: ws[key2]
28524
+ // A ControlGroup's Controls are written the way a Screen's are.
28525
+ [file]: key2 === "controlGroups" ? compactControlGroups(ws[key2]) : ws[key2]
28378
28526
  });
28379
28527
  });
28380
28528
  Object.entries(
@@ -28386,7 +28534,7 @@ function buildDesignSource(ws, operations = drawnOperations(ws)) {
28386
28534
  files3[`${DESIGN_SCREENS_DIR}/${meta.id}.json`] = json({
28387
28535
  v: WORKSPACE_SCHEMA_VERSION,
28388
28536
  meta,
28389
- state
28537
+ state: { ...state, controlMap: compactControlMap(state.controlMap) }
28390
28538
  });
28391
28539
  });
28392
28540
  files3[DESIGN_WRITE_ID_PATH] = `${designWriteId(files3)}
@@ -28744,7 +28892,7 @@ var exposedScreenBindings = (screens, prefix, features = []) => {
28744
28892
  ...required.length ? { required } : {},
28745
28893
  outputs: Object.values(screen.outputs ?? {}).map((o) => o.name).sort((a, b) => a.localeCompare(b))
28746
28894
  };
28747
- return { name: name3, className, importPath, contract };
28895
+ return { screenId: screen.id, name: name3, className, importPath, contract };
28748
28896
  }).sort((a, b) => a.name.localeCompare(b.name));
28749
28897
  };
28750
28898
  var pluginContracts = (screens, prefix, features = []) => exposedScreenBindings(screens, prefix, features).map((b) => b.contract);
@@ -30003,6 +30151,82 @@ export const appConfig: ApplicationConfig = provideMagWcConfig({
30003
30151
  providers: appProviders,
30004
30152
  });
30005
30153
  `;
30154
+ var PLUGIN_HARNESS_PATH = "src/harness/plugin-harness.ts";
30155
+ var pluginWcTs = (className, selector) => `import { ChangeDetectionStrategy, Component } from '@angular/core';
30156
+
30157
+ /**
30158
+ * A Plugin App has no frame: its Bundle defines its Exposed Screens and no
30159
+ * root element. The WC build names the Bundle after this class, so it stays.
30160
+ */
30161
+ @Component({
30162
+ selector: '${selector}',
30163
+ template: '',
30164
+ changeDetection: ChangeDetectionStrategy.OnPush,
30165
+ })
30166
+ export class ${className} {}
30167
+ `;
30168
+ var pluginWcConfigTs = () => `import { ApplicationConfig } from '@angular/core';
30169
+ import { provideMagWcConfig } from '@magmonium/one';
30170
+ import { environment } from '../environments/environment';
30171
+ import { appProviders } from './providers';
30172
+
30173
+ // Read by the WC build (\`appConfigPath\` in the manifest). A Plugin App routes
30174
+ // nothing and has no root frame: each Exposed Screen mounts as its own element
30175
+ // inside a host (libs/one ADR 0044). \`bootstrap.ts\` boots the Plugin Harness
30176
+ // instead, which this file never imports.
30177
+ export const appConfig: ApplicationConfig = provideMagWcConfig({
30178
+ backend: environment.url,
30179
+ authUrl: environment.authUrl,
30180
+ socketUrl: environment.socketUrl,
30181
+ routes: [],
30182
+ providers: appProviders,
30183
+ });
30184
+ `;
30185
+ var pluginBootstrapTs = () => `import '@angular/compiler';
30186
+ import { bootstrapMagApp } from '@magmonium/one';
30187
+ import { environment } from './environments/environment';
30188
+ import { appProviders } from './app/providers';
30189
+ import { PluginHarness, harnessRoutes } from './harness/plugin-harness';
30190
+
30191
+ // \`ng serve\` / Run boots the Plugin Harness: one address per Exposed Screen.
30192
+ // Never part of the WC build, which reads \`src/app/wc.config.ts\` alone.
30193
+ bootstrapMagApp({
30194
+ backend: environment.url,
30195
+ authUrl: environment.authUrl,
30196
+ socketUrl: environment.socketUrl,
30197
+ root: PluginHarness,
30198
+ children: harnessRoutes,
30199
+ providers: appProviders,
30200
+ });
30201
+ `;
30202
+ var pluginHarnessTs = (screens) => {
30203
+ const routes = screens.map(
30204
+ (screen) => ` {
30205
+ path: '${screen.name}',
30206
+ loadComponent: () =>
30207
+ import('../app/${screen.importPath.replace(/^\.\//, "")}').then((m) => m.${screen.className}),
30208
+ },`
30209
+ ).join("\n");
30210
+ const first = screens[0]?.name;
30211
+ return `import { ChangeDetectionStrategy, Component } from '@angular/core';
30212
+ import { Route, RouterOutlet } from '@angular/router';
30213
+
30214
+ /** Dev-only: what \`ng serve\` and Run render. The WC build never reaches it. */
30215
+ @Component({
30216
+ selector: 'plugin-harness',
30217
+ imports: [RouterOutlet],
30218
+ template: \`<router-outlet></router-outlet>\`,
30219
+ changeDetection: ChangeDetectionStrategy.OnPush,
30220
+ })
30221
+ export class PluginHarness {}
30222
+
30223
+ /** One address per Exposed Screen, its inputs from the query. */
30224
+ export const harnessRoutes: Route[] = [
30225
+ ${first ? ` { path: '', pathMatch: 'full', redirectTo: '${first}' },
30226
+ ` : ""}${routes}
30227
+ ];
30228
+ `;
30229
+ };
30006
30230
  var providersTs = (app) => `import { ApplicationConfig } from '@angular/core';
30007
30231
  import { navProvidersGenerated } from './${app}.provide';
30008
30232
 
@@ -30145,15 +30369,15 @@ var pwaYml = (appName, config) => {
30145
30369
  ""
30146
30370
  ].join("\n");
30147
30371
  };
30148
- var remoteManifest = (app, appName, config, className, selector, plugins) => `app: ${app}
30372
+ var remoteManifest = (app, appName, config, className, selector, plugins, isPlugin = false) => `app: ${app}
30149
30373
  version: ${config.version}
30150
30374
  componentPath: src/app
30151
30375
  componentName: wc
30152
30376
  className: ${className}
30153
30377
  appConfigPath: src/app/wc.config
30154
30378
  selector: ${selector}
30155
- ${config.theme ? `theme: ${config.theme}
30156
- ` : ""}${pwaYml(appName, config)}${pluginsYml(plugins)}`;
30379
+ ${isPlugin ? "kind: plugin\n" : ""}${config.theme ? `theme: ${config.theme}
30380
+ ` : ""}${isPlugin ? "" : pwaYml(appName, config)}${pluginsYml(plugins)}`;
30157
30381
  var envManifest = (app, className, selector) => `app: ${app}
30158
30382
  componentPath: src/app
30159
30383
  componentName: wc
@@ -30250,25 +30474,29 @@ ${setupNode}${generateStep} - name: Build assets and web component
30250
30474
  BUILD_CONFIG: prod
30251
30475
  - name: Package as bundle.zip
30252
30476
  run: cd dist/${app}-wc && zip -r ../../bundle.zip .
30253
- - name: Upload bundle to backend
30477
+ - name: Read app id and endpoint from the design source
30254
30478
  run: |
30255
- ENDPOINT="\${{ secrets.MAG_ENDPOINT }}"
30479
+ APP_ID=$(jq -r '.appTarget.appId // empty' ${DESIGN_SOURCE_ROOT}/index.json)
30480
+ ENDPOINT=$(jq -r '.appTarget.environment.prod.backendUrl // empty' ${DESIGN_SOURCE_ROOT}/index.json)
30256
30481
  ENDPOINT="\${ENDPOINT%/}"
30257
- APP_ID="\${{ secrets.MAG_APP_ID }}"
30258
- APP_ID="\${APP_ID//[$'\\t\\r\\n ']/}"
30482
+ ENDPOINT="\${ENDPOINT%/swagger.json}"
30483
+ if [ -z "$APP_ID" ] || [ -z "$ENDPOINT" ]; then
30484
+ echo "::error::${DESIGN_SOURCE_ROOT}/index.json names no appTarget.appId or prod backendUrl. Link the app to its Store App in One UI and Push."
30485
+ exit 1
30486
+ fi
30487
+ echo "MAG_APP_ID=$APP_ID" >> "$GITHUB_ENV"
30488
+ echo "MAG_ENDPOINT=$ENDPOINT" >> "$GITHUB_ENV"
30489
+ - name: Upload bundle to backend
30490
+ run: |
30259
30491
  curl --fail-with-body -X POST \\
30260
30492
  -H "Authorization: Bearer \${{ secrets.MAG_DEPLOY_TOKEN }}" \\
30261
30493
  -F "bundle=@bundle.zip" \\
30262
- "\${ENDPOINT}/store/v1/bundle/\${APP_ID}"
30494
+ "\${MAG_ENDPOINT}/store/v1/bundle/\${MAG_APP_ID}"
30263
30495
  - name: Trigger deployment
30264
30496
  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
30497
  curl --fail-with-body -X POST \\
30270
30498
  -H "Authorization: Bearer \${{ secrets.MAG_DEPLOY_TOKEN }}" \\
30271
- "\${ENDPOINT}/store/v1/deploy/\${APP_ID}"
30499
+ "\${MAG_ENDPOINT}/store/v1/deploy/\${MAG_APP_ID}"
30272
30500
  `;
30273
30501
  var releaseSections = (app) => APP_RELEASE_DOC.slice(APP_RELEASE_DOC.indexOf("## ")).split("<app>").join(app);
30274
30502
  var readme = (app, config) => `# ${app}
@@ -30546,10 +30774,11 @@ end_of_line = lf
30546
30774
  [*.md]
30547
30775
  trim_trailing_whitespace = false
30548
30776
  `;
30549
- function scaffoldFiles(appName, config, environment, extraDeps = {}, plugins = []) {
30777
+ function scaffoldFiles(appName, config, environment, extraDeps = {}, plugins = [], shell = {}) {
30550
30778
  const app = appFileBase(appName);
30551
30779
  const className = wcClassName(appName);
30552
30780
  const selector = wcSelector(appName);
30781
+ const isPlugin = shell.kind === "plugin";
30553
30782
  return [
30554
30783
  {
30555
30784
  path: "package.json",
@@ -30579,7 +30808,10 @@ function scaffoldFiles(appName, config, environment, extraDeps = {}, plugins = [
30579
30808
  { path: ".github/workflows/cd.yml", contents: cdWorkflow(app) },
30580
30809
  { path: "src/index.html", contents: indexHtml(appName, config) },
30581
30810
  { path: "src/main.ts", contents: mainTs() },
30582
- { path: "src/bootstrap.ts", contents: bootstrapTs(className) },
30811
+ {
30812
+ path: "src/bootstrap.ts",
30813
+ contents: isPlugin ? pluginBootstrapTs() : bootstrapTs(className)
30814
+ },
30583
30815
  { path: "src/styles.sass", contents: stylesSass(selector) },
30584
30816
  {
30585
30817
  path: "src/environments/environment.ts",
@@ -30608,9 +30840,18 @@ function scaffoldFiles(appName, config, environment, extraDeps = {}, plugins = [
30608
30840
  `// Swapped in by \`ng build --configuration production\`.`
30609
30841
  )
30610
30842
  },
30611
- { path: "src/app/wc.ts", contents: wcTs(className, selector) },
30612
- { path: "src/app/wc.config.ts", contents: wcConfigTs(className) },
30613
- { path: "src/app/wc.routes.ts", contents: wcRoutesTs(app) },
30843
+ ...isPlugin ? [
30844
+ { path: "src/app/wc.ts", contents: pluginWcTs(className, selector) },
30845
+ { path: "src/app/wc.config.ts", contents: pluginWcConfigTs() },
30846
+ {
30847
+ path: PLUGIN_HARNESS_PATH,
30848
+ contents: pluginHarnessTs(shell.harness ?? [])
30849
+ }
30850
+ ] : [
30851
+ { path: "src/app/wc.ts", contents: wcTs(className, selector) },
30852
+ { path: "src/app/wc.config.ts", contents: wcConfigTs(className) },
30853
+ { path: "src/app/wc.routes.ts", contents: wcRoutesTs(app) }
30854
+ ],
30614
30855
  { path: "src/app/providers.ts", contents: providersTs(app) },
30615
30856
  { path: "src/test-providers.ts", contents: testProvidersTs() },
30616
30857
  { path: "src/test-setup.ts", contents: testSetupTs() },
@@ -30622,7 +30863,8 @@ function scaffoldFiles(appName, config, environment, extraDeps = {}, plugins = [
30622
30863
  config,
30623
30864
  className,
30624
30865
  selector,
30625
- plugins
30866
+ plugins,
30867
+ isPlugin
30626
30868
  )
30627
30869
  },
30628
30870
  // `mag_assets/navs/` is not here: the Nav tree is authored in the editor
@@ -31736,6 +31978,18 @@ var pluginContractsOf = (ws) => pluginContracts(
31736
31978
  prefixOf(ws),
31737
31979
  Object.values(ws.features ?? {})
31738
31980
  );
31981
+ var scaffoldShellOf = (ws) => ws.appTarget.kind === "plugin" ? {
31982
+ kind: "plugin",
31983
+ harness: exposedScreenBindings(
31984
+ ws.screens.map((screen) => screen.meta),
31985
+ prefixOf(ws),
31986
+ Object.values(ws.features ?? {})
31987
+ ).map(({ name: name3, className, importPath }) => ({
31988
+ name: name3,
31989
+ className,
31990
+ importPath
31991
+ }))
31992
+ } : {};
31739
31993
  var controlMapOf = (screens) => {
31740
31994
  const map = {};
31741
31995
  screens.forEach(({ state }) => {
@@ -32182,7 +32436,8 @@ var emitFullAppFiles = (authored, stringify) => {
32182
32436
  ws.wcConfig,
32183
32437
  ws.appTarget.environment,
32184
32438
  allowlistDeps(ws),
32185
- pluginContractsOf(ws)
32439
+ pluginContractsOf(ws),
32440
+ scaffoldShellOf(ws)
32186
32441
  );
32187
32442
  const files3 = scaffold.map((file) => ({
32188
32443
  path: file.path,
@@ -32206,6 +32461,7 @@ var emitFullAppFiles = (authored, stringify) => {
32206
32461
  files3.push(...emitAuthoredAssets(ws, stringify));
32207
32462
  return withGeneratedBanner(withEmittedTests(files3, isGeneratedPath));
32208
32463
  };
32464
+ var authoredAssetPaths = (authored) => emitAuthoredAssets(inReach(authored), () => "").map((file) => file.path);
32209
32465
  var allowlistDeps = (ws) => Object.fromEntries(
32210
32466
  Object.values(ws.npmAllowlist ?? {}).map((entry2) => [
32211
32467
  entry2.name,
@@ -32229,7 +32485,9 @@ var SHIPPED_SHELL_PATHS = [
32229
32485
  "src/app/wc.ts",
32230
32486
  "src/app/wc.config.ts",
32231
32487
  "src/app/wc.routes.ts",
32232
- "src/app/providers.ts"
32488
+ "src/app/providers.ts",
32489
+ // A Plugin App's: its addresses follow the Exposed Screens.
32490
+ PLUGIN_HARNESS_PATH
32233
32491
  ];
32234
32492
  var emitShippedShellFiles = (authored) => {
32235
32493
  const ws = inReach(authored);
@@ -32238,7 +32496,8 @@ var emitShippedShellFiles = (authored) => {
32238
32496
  ws.wcConfig,
32239
32497
  ws.appTarget.environment,
32240
32498
  allowlistDeps(ws),
32241
- pluginContractsOf(ws)
32499
+ pluginContractsOf(ws),
32500
+ scaffoldShellOf(ws)
32242
32501
  ).filter((file) => SHIPPED_SHELL_PATHS.includes(file.path)).map((file) => ({ path: file.path, contents: file.contents }));
32243
32502
  };
32244
32503
  var isRemoteManifestPath = (path) => /^mag_assets(_env\/[^/]+)?\/remote\/[^/]+\.yml$/.test(path);
@@ -32247,7 +32506,8 @@ var remoteManifestFiles = (ws) => scaffoldFiles(
32247
32506
  ws.wcConfig,
32248
32507
  ws.appTarget.environment,
32249
32508
  {},
32250
- pluginContractsOf(ws)
32509
+ pluginContractsOf(ws),
32510
+ scaffoldShellOf(ws)
32251
32511
  ).filter((file) => isRemoteManifestPath(file.path)).map((file) => ({ path: file.path, contents: file.contents }));
32252
32512
  var emitOverlayFiles = (authored, stringify) => {
32253
32513
  const ws = inReach(authored);
@@ -32337,7 +32597,13 @@ var HISTORY_LABELS = [
32337
32597
  "edit-nav",
32338
32598
  "edit-config",
32339
32599
  "edit-screen",
32340
- "edit-samples"
32600
+ "edit-samples",
32601
+ // A Fix applied on the Repair Register is one step under its own name, so
32602
+ // the Undo button reads the Fix it takes back (ADR 0192).
32603
+ "fix-cast",
32604
+ "fix-prune",
32605
+ "fix-retype-parameters",
32606
+ "fix-route-inputs"
32341
32607
  ];
32342
32608
  var HISTORY_AUTHORED_KEYS = [
32343
32609
  "controlMap",
@@ -32589,6 +32855,7 @@ var HISTORY_SELECTION_KEYS = [
32589
32855
  PATTERN_MESSAGE_CONFIG_KEY,
32590
32856
  PATTERN_NAME_MAX_LENGTH,
32591
32857
  PATTERN_NAME_PATTERN,
32858
+ PLUGIN_HARNESS_PATH,
32592
32859
  PLUGIN_INPUTS_KEY,
32593
32860
  PLUGIN_LINK_KEY,
32594
32861
  PLUGIN_OUTPUTS_KEY,
@@ -32719,6 +32986,7 @@ var HISTORY_SELECTION_KEYS = [
32719
32986
  assetRoot,
32720
32987
  assignableVariantIds,
32721
32988
  authoredArgs,
32989
+ authoredAssetPaths,
32722
32990
  backfilledInstanceArgs,
32723
32991
  baseOutputName,
32724
32992
  bindablePaths,
@@ -32838,12 +33106,16 @@ var HISTORY_SELECTION_KEYS = [
32838
33106
  collectTranslationAssets,
32839
33107
  collectTypedComponentInputs,
32840
33108
  columnNeedsId,
33109
+ compactControlGroups,
33110
+ compactControlMap,
32841
33111
  comparisonSource,
32842
33112
  componentInputShapeIds,
32843
33113
  componentInputTsType,
32844
33114
  composeLabelValue,
32845
33115
  computeError,
32846
33116
  computeId,
33117
+ computeInputMemberError,
33118
+ computeInputPaths,
32847
33119
  computeIsRead,
32848
33120
  computeMemberRead,
32849
33121
  computeNameTaken,
@@ -33159,6 +33431,7 @@ var HISTORY_SELECTION_KEYS = [
33159
33431
  isBaseVariantId,
33160
33432
  isBindingInScope,
33161
33433
  isBooleanStateProperty,
33434
+ isBornNamed,
33162
33435
  isBranchFamily,
33163
33436
  isBusyVariantId,
33164
33437
  isCacheMethod,
@@ -33595,6 +33868,7 @@ var HISTORY_SELECTION_KEYS = [
33595
33868
  pruneFormEventReads,
33596
33869
  pruneMappings,
33597
33870
  pruneMenuActions,
33871
+ pruneOrphanMessageBindings,
33598
33872
  pruneOutputCalls,
33599
33873
  pruneOutputLinkArgs,
33600
33874
  pruneUnknownShapeRefs,