@magmonium/cli 0.8.19 → 0.8.20

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.
@@ -669,7 +669,17 @@ function projectJson(appName, port) {
669
669
  executor: '@angular-devkit/build-angular:extract-i18n',
670
670
  options: { buildTarget: `${appName}:build` },
671
671
  },
672
- lint: { executor: '@nx/eslint:lint' },
672
+ lint: {
673
+ inputs: [
674
+ 'default',
675
+ '^default',
676
+ '{workspaceRoot}/.eslintrc.json',
677
+ '{workspaceRoot}/.eslintignore',
678
+ '{workspaceRoot}/eslint.config.mjs',
679
+ '{workspaceRoot}/tools/eslint-rules/**/*',
680
+ { externalDependencies: ['eslint'] },
681
+ ],
682
+ },
673
683
  test: {
674
684
  executor: '@nx/jest:jest',
675
685
  outputs: ['{workspaceRoot}/coverage/{projectRoot}'],
package/codegen/index.js CHANGED
@@ -503,6 +503,8 @@ __export(index_exports, {
503
503
  collectThemeAssets: () => collectThemeAssets,
504
504
  collectTranslationAssets: () => collectTranslationAssets,
505
505
  collectTypedComponentInputs: () => collectTypedComponentInputs,
506
+ colorPipeExpression: () => colorPipeExpression,
507
+ colorPipeOf: () => colorPipeOf,
506
508
  columnNeedsId: () => columnNeedsId,
507
509
  compactControlGroups: () => compactControlGroups,
508
510
  compactControlMap: () => compactControlMap,
@@ -975,12 +977,12 @@ __export(index_exports, {
975
977
  jsNativesInGroup: () => jsNativesInGroup,
976
978
  keyCandidates: () => keyCandidates,
977
979
  keyIdKeeper: () => keyIdKeeper,
980
+ labelChainOf: () => labelChainOf,
978
981
  labelEmission: () => labelEmission,
979
982
  labelReadIsTranslated: () => labelReadIsTranslated,
980
983
  landingNavId: () => landingNavId,
981
984
  landsOn: () => landsOn,
982
985
  landsUnconditionally: () => landsUnconditionally,
983
- layerLabel: () => layerLabel,
984
986
  levelStateComputeds: () => levelStateComputeds,
985
987
  libImportsFrom: () => libImportsFrom,
986
988
  linkDrift: () => linkDrift,
@@ -1553,6 +1555,7 @@ __export(index_exports, {
1553
1555
  stateWriteTargets: () => stateWriteTargets,
1554
1556
  stateWriteToggleAllowed: () => stateWriteToggleAllowed,
1555
1557
  stateWriteValueKinds: () => stateWriteValueKinds,
1558
+ staticHeadSource: () => staticHeadSource,
1556
1559
  staticLabelSource: () => staticLabelSource,
1557
1560
  staticLiteralType: () => staticLiteralType,
1558
1561
  staticLiteralValue: () => staticLiteralValue,
@@ -1711,6 +1714,7 @@ var ControlType = /* @__PURE__ */ ((ControlType2) => {
1711
1714
  ControlType2["SECTION"] = "section";
1712
1715
  ControlType2["SECTION_HEADER"] = "section_header";
1713
1716
  ControlType2["SECTION_HEADER_LABEL"] = "section_header_label";
1717
+ ControlType2["SECTION_FOOTER"] = "section_footer";
1714
1718
  ControlType2["SECTION_HERO"] = "section_hero";
1715
1719
  ControlType2["SECTION_CAROUSEL"] = "section_carousel";
1716
1720
  ControlType2["SECTION_TABLE"] = "section_table";
@@ -3176,6 +3180,7 @@ var hasContent = (node) => (node.childrens ?? []).some((child) => child.type ===
3176
3180
  var CONTROL_RELATIONSHIPS = {
3177
3181
  ["section" /* SECTION */]: [
3178
3182
  "section_header" /* SECTION_HEADER */,
3183
+ "section_footer" /* SECTION_FOOTER */,
3179
3184
  "section_search" /* SECTION_SEARCH */,
3180
3185
  "section_action" /* SECTION_ACTION */,
3181
3186
  "section_filter" /* SECTION_FILTER */,
@@ -3224,6 +3229,10 @@ var CONTROL_RELATIONSHIPS = {
3224
3229
  // line is, and everything beside it (the toggle, the input) is the bar
3225
3230
  // itself rather than a child.
3226
3231
  ["section_search" /* SECTION_SEARCH */]: ["section_header_label" /* SECTION_HEADER_LABEL */],
3232
+ // Its label slot and nothing else — the SectionHeader's title slot, caught
3233
+ // by the footer's unselected `ng-content`. Everything else a footer is
3234
+ // (`sticky`, `align`) is a setting rather than a child.
3235
+ ["section_footer" /* SECTION_FOOTER */]: ["section_header_label" /* SECTION_HEADER_LABEL */],
3227
3236
  // Buttons and nothing else — and unlike the SectionButtonGroup it looks like,
3228
3237
  // they are *consumed* rather than projected: an `m-action` renders raw
3229
3238
  // `<button>`s from a list, so a Button dropped here emits no tag of its own
@@ -3662,6 +3671,8 @@ var canUseArmKind = (branch, kind, controlMap, currentArmId) => {
3662
3671
  var CONTROL_MAX_CHILDREN = {
3663
3672
  ["section" /* SECTION */]: {
3664
3673
  ["section_header" /* SECTION_HEADER */]: 1,
3674
+ // One `<ng-content select="m-section-footer" />` closing the Section.
3675
+ ["section_footer" /* SECTION_FOOTER */]: 1,
3665
3676
  ["section_search" /* SECTION_SEARCH */]: 1,
3666
3677
  // One `<ng-content select="m-action, m-one-action" />` per Section, so a
3667
3678
  // second bar has nowhere to land (libs/one SectionComponent).
@@ -3749,7 +3760,8 @@ var canPlaceChild = (parent, childType, controlMap) => {
3749
3760
  if (isSectionHeaderSlotFamily(childType)) {
3750
3761
  const hosts = [
3751
3762
  "section_header" /* SECTION_HEADER */,
3752
- "section_search" /* SECTION_SEARCH */
3763
+ "section_search" /* SECTION_SEARCH */,
3764
+ "section_footer" /* SECTION_FOOTER */
3753
3765
  ];
3754
3766
  if (!parent || !hosts.includes(parent.type)) return false;
3755
3767
  return !(parent.childrens ?? []).some(
@@ -3800,6 +3812,7 @@ var OWN_DIRECTIVES = {
3800
3812
  ["section" /* SECTION */]: ["mAccordion", "mAccordionGroup", "routerLink"],
3801
3813
  ["section_header" /* SECTION_HEADER */]: ["routerLink"],
3802
3814
  ["section_header_label" /* SECTION_HEADER_LABEL */]: ["routerLink"],
3815
+ ["section_footer" /* SECTION_FOOTER */]: ["routerLink"],
3803
3816
  ["section_search" /* SECTION_SEARCH */]: ["routerLink"],
3804
3817
  ["section_filter" /* SECTION_FILTER */]: ["routerLink"],
3805
3818
  ["section_filter_group" /* SECTION_FILTER_GROUP */]: ["routerLink"],
@@ -3975,6 +3988,7 @@ var CONTROL_LABEL = {
3975
3988
  ["section" /* SECTION */]: "section",
3976
3989
  ["section_header" /* SECTION_HEADER */]: "section-header",
3977
3990
  ["section_header_label" /* SECTION_HEADER_LABEL */]: "section-header-label",
3991
+ ["section_footer" /* SECTION_FOOTER */]: "section-footer",
3978
3992
  ["section_search" /* SECTION_SEARCH */]: "section-search",
3979
3993
  ["section_filter" /* SECTION_FILTER */]: "section-filter",
3980
3994
  ["section_filter_group" /* SECTION_FILTER_GROUP */]: "section-filter-group",
@@ -4038,6 +4052,7 @@ var CONTROL_ICON = {
4038
4052
  ["section" /* SECTION */]: "control_section",
4039
4053
  ["section_header" /* SECTION_HEADER */]: "control_section_header",
4040
4054
  ["section_header_label" /* SECTION_HEADER_LABEL */]: "control_section_header_label",
4055
+ ["section_footer" /* SECTION_FOOTER */]: "control_section_footer",
4041
4056
  ["section_search" /* SECTION_SEARCH */]: "control_section_search",
4042
4057
  // Reuse the search glyph until filter artwork joins the shared set — the
4043
4058
  // same stand-in CARD takes from the side panel.
@@ -4137,6 +4152,12 @@ var CONTROL_CODEGEN = {
4137
4152
  tag: "m-section-header",
4138
4153
  component: "SectionHeaderComponent"
4139
4154
  },
4155
+ // Folderless for the section_header's reason — `sticky` and `align` are its
4156
+ // only settings, both scalars, and its text is the projected label slot.
4157
+ ["section_footer" /* SECTION_FOOTER */]: {
4158
+ tag: "m-section-footer",
4159
+ component: "SectionFooterComponent"
4160
+ },
4140
4161
  // Folderless for the section_header's reason — SectionSearchComponent takes
4141
4162
  // `searchLabel`, `debounce`, `startOpen` and `sticky` as individual inputs
4142
4163
  // rather than a `config` bag, so there is nothing a `name="<id>"` could
@@ -13536,6 +13557,22 @@ var FORMAT_PIPE_CATALOG = [
13536
13557
  { name: "forceSign", dataType: BOOL2, default: false }
13537
13558
  ]
13538
13559
  },
13560
+ {
13561
+ // The one entry that pipes into `color` rather than `label`: it reads the
13562
+ // raw head value beside the label chain, so `amount | money` and
13563
+ // `amount | signColor` stand together on one tag (ADR 0200).
13564
+ name: "signColor",
13565
+ component: "SignColorPipe",
13566
+ importFrom: ONE_IMPORT_MODULE,
13567
+ inputType: NUM2,
13568
+ returnType: STR2,
13569
+ target: "color",
13570
+ params: [
13571
+ // Theme keys rather than hex, so a gain and a loss follow the theme.
13572
+ { name: "positive", dataType: STR2, default: "success" },
13573
+ { name: "negative", dataType: STR2, default: "error" }
13574
+ ]
13575
+ },
13539
13576
  {
13540
13577
  name: "timeAgo",
13541
13578
  component: "TimeAgoPipe",
@@ -13594,6 +13631,7 @@ var FORMAT_PIPE_LABEL = {
13594
13631
  money: "pipe-money",
13595
13632
  compactNumber: "pipe-compact-number",
13596
13633
  percentage: "pipe-percentage",
13634
+ signColor: "pipe-sign-color",
13597
13635
  timeAgo: "pipe-time-ago",
13598
13636
  date: "pipe-date"
13599
13637
  };
@@ -13601,6 +13639,7 @@ var FORMAT_PIPE_ICON = {
13601
13639
  money: "pipe_money",
13602
13640
  compactNumber: "pipe_compact_number",
13603
13641
  percentage: "pipe_percentage",
13642
+ signColor: "pipe_sign_color",
13604
13643
  timeAgo: "pipe_time_ago",
13605
13644
  date: "pipe_date"
13606
13645
  };
@@ -13608,6 +13647,7 @@ var FORMAT_PIPE_FORM = {
13608
13647
  money: "pipe_money_form",
13609
13648
  compactNumber: "pipe_compact_number_form",
13610
13649
  percentage: "pipe_percentage_form",
13650
+ signColor: "pipe_sign_color_form",
13611
13651
  timeAgo: void 0,
13612
13652
  date: "pipe_date_form"
13613
13653
  };
@@ -13658,23 +13698,39 @@ var acceptsFormatPipe = (control) => {
13658
13698
  if (!hasTextSource(control?.type)) return false;
13659
13699
  return textSourceOf(control) !== TEXT_SOURCE.translated;
13660
13700
  };
13701
+ var pipesInto = (pipe, target) => (formatPipeEntry(pipe.name)?.target ?? "label") === target;
13702
+ var labelChainOf = (chain) => chain.filter((pipe) => pipesInto(pipe, "label"));
13703
+ var colorPipeOf = (chain) => chain.find((pipe) => pipesInto(pipe, "color"));
13661
13704
  var sameDataType = (a, b) => !!a && !!b && a.type === b.type;
13662
13705
  var chainReturnType = (chain) => {
13663
- const last = chain.length ? chain[chain.length - 1] : void 0;
13706
+ const label = labelChainOf(chain);
13707
+ const last = label.length ? label[label.length - 1] : void 0;
13664
13708
  return formatPipeEntry(last?.name)?.returnType;
13665
13709
  };
13666
13710
  var canAppendFormatPipe = (control, name3, headType) => {
13667
13711
  if (!acceptsFormatPipe(control)) return false;
13668
13712
  const entry2 = formatPipeEntry(name3);
13669
13713
  if (!entry2) return false;
13670
- const flowing = chainReturnType(formatPipesOf(control));
13671
- if (!flowing) return !headType || sameDataType(headType, entry2.inputType);
13714
+ const chain = formatPipesOf(control);
13715
+ if (entry2.target === "color") {
13716
+ if (colorPipeOf(chain)) return false;
13717
+ const head = chainInputType(labelChainOf(chain)) ?? headType;
13718
+ return !head || sameDataType(head, entry2.inputType);
13719
+ }
13720
+ const flowing = chainReturnType(chain);
13721
+ if (!flowing) {
13722
+ const head = headType ?? chainInputType(chain);
13723
+ return !head || sameDataType(head, entry2.inputType);
13724
+ }
13672
13725
  return sameDataType(flowing, entry2.inputType);
13673
13726
  };
13674
13727
  var appendableFormatPipes = (control, headType) => FORMAT_PIPE_CATALOG.filter(
13675
13728
  (entry2) => canAppendFormatPipe(control, entry2.name, headType)
13676
13729
  );
13677
- var chainInputType = (chain) => formatPipeEntry(chain.length ? chain[0].name : void 0)?.inputType;
13730
+ var chainInputType = (chain) => {
13731
+ const head = labelChainOf(chain)[0] ?? colorPipeOf(chain);
13732
+ return formatPipeEntry(head?.name)?.inputType;
13733
+ };
13678
13734
  var staticLiteralType = (control) => chainInputType(formatPipesOf(control));
13679
13735
  var literalAtType = (type, raw) => {
13680
13736
  if (raw === void 0 || raw === null || raw === "") return void 0;
@@ -13733,24 +13789,36 @@ var entryArgs = (entry2, pipe, scope) => {
13733
13789
  }
13734
13790
  return sources.slice(0, last + 1);
13735
13791
  };
13736
- var formatPipeExpression = (chain, expr, scope) => chain.reduce((source, pipe) => {
13792
+ var pipeCall = (source, pipe, scope) => {
13737
13793
  const entry2 = formatPipeEntry(pipe.name);
13738
- if (!entry2) return source;
13794
+ if (!entry2) return void 0;
13739
13795
  const args = entryArgs(entry2, pipe, scope);
13740
- if (!args) return source;
13796
+ if (!args) return void 0;
13741
13797
  const suffix = args.length ? `:${args.join(":")}` : "";
13742
13798
  const call = `${source} | ${entry2.name}${suffix}`;
13743
13799
  return entry2.nullable ? `(${call}) ?? ''` : call;
13744
- }, expr);
13800
+ };
13801
+ var formatPipeExpression = (chain, expr, scope) => labelChainOf(chain).reduce(
13802
+ (source, pipe) => pipeCall(source, pipe, scope) ?? source,
13803
+ expr
13804
+ );
13805
+ var colorPipeExpression = (chain, expr, scope) => {
13806
+ const pipe = colorPipeOf(chain);
13807
+ return pipe ? pipeCall(expr, pipe, scope) : void 0;
13808
+ };
13745
13809
  var formatPipeCanvasSuffix = (control) => formatPipesOf(control).map((pipe) => formatPipeEntry(pipe.name)?.name).filter((name3) => !!name3).map((name3) => `|${name3}`).join("");
13746
13810
  var formatPipeImports = (chain) => chain.map((pipe) => formatPipeEntry(pipe.name)).filter((entry2) => !!entry2).map(({ component, importFrom }) => ({ component, importFrom }));
13747
13811
  var staticLabelSource = (chain, raw) => {
13812
+ if (!labelChainOf(chain).length) return void 0;
13813
+ return staticHeadSource(chain, raw);
13814
+ };
13815
+ var staticHeadSource = (chain, raw) => {
13748
13816
  if (!chain.length) return void 0;
13749
13817
  const value = literalAtType(chainInputType(chain), raw);
13750
13818
  return value === void 0 ? void 0 : literalSource2(value);
13751
13819
  };
13752
13820
  var labelEmission = (chain, headType) => {
13753
- if (!chain.length) return "raw";
13821
+ if (!labelChainOf(chain).length) return "raw";
13754
13822
  if (!headType || sameDataType(headType, chainInputType(chain)))
13755
13823
  return "piped";
13756
13824
  return headType.type === "string" ? "raw" : "none";
@@ -19994,6 +20062,9 @@ function bodyConfigs(node) {
19994
20062
  if (node.type === "list" /* LIST */) {
19995
20063
  delete configs["items"];
19996
20064
  }
20065
+ if (hasTextSource(node.type) && colorPipeOf(node.formatPipes ?? [])) {
20066
+ delete configs["color"];
20067
+ }
19997
20068
  if (node.type === "audience_picker" /* AUDIENCE_PICKER */) {
19998
20069
  delete configs[AUDIENCE_PICKER_LEVELS_KEY];
19999
20070
  }
@@ -20769,6 +20840,13 @@ var paginationTotalRead = (node, ctx, storeProp) => {
20769
20840
  );
20770
20841
  };
20771
20842
  var formModelNameFor = (formId, ctx) => Object.values(ctx.formModels ?? {}).find((model) => model.formId === formId)?.name;
20843
+ function colorAttr(node, piped) {
20844
+ if (!colorPipeOf(node.formatPipes ?? [])) return "";
20845
+ const authored = node.configs?.["color"];
20846
+ const fallback = typeof authored === "string" && authored.trim() ? authored.trim() : "";
20847
+ if (!piped) return fallback ? ` color="${fallback}"` : "";
20848
+ return fallback ? ` [color]="(${piped}) ?? ${literalSource2(fallback)}"` : ` [color]="${piped}"`;
20849
+ }
20772
20850
  function boundAttrs(node, ctx, storeProp) {
20773
20851
  const bindings = ctx.controlMap?.[node.id]?.bindings;
20774
20852
  const chain = node.formatPipes ?? [];
@@ -20779,8 +20857,9 @@ function boundAttrs(node, ctx, storeProp) {
20779
20857
  const parts = [];
20780
20858
  if (hasTextSource(node.type) && bindings?.[BINDING_SLOT.label]) {
20781
20859
  const binding = bindings[BINDING_SLOT.label];
20782
- const emission = labelEmission(chain, boundDataType(binding, ctx));
20783
- const translated = labelReadIsTranslated(binding, chain);
20860
+ const headType = boundDataType(binding, ctx);
20861
+ const emission = labelEmission(chain, headType);
20862
+ const translated = labelReadIsTranslated(binding, labelChainOf(chain));
20784
20863
  const expr = emission === "piped" ? bindingExpression(binding, scope) : emission === "raw" ? textBindingExpression(binding, scope, translated) : void 0;
20785
20864
  const piped = expr && emission === "piped" ? withBindingFallback(formatPipeExpression(chain, expr, scope), binding) : expr;
20786
20865
  if (piped) {
@@ -20788,6 +20867,10 @@ function boundAttrs(node, ctx, storeProp) {
20788
20867
  ` [label]="${piped}"${translated ? "" : ' [noTranslate]="true"'}`
20789
20868
  );
20790
20869
  }
20870
+ const color = colorPipeOf(chain);
20871
+ const colorInput = formatPipeEntry(color?.name)?.inputType;
20872
+ const raw = !headType || !colorInput || headType.type === colorInput.type ? bindingExpression(binding, scope) : void 0;
20873
+ parts.push(colorAttr(node, raw && colorPipeExpression(chain, raw, scope)));
20791
20874
  } else if (hasTextSource(node.type) && chain.length) {
20792
20875
  const source = staticLabelSource(chain, node.configs?.[BINDING_SLOT.label]);
20793
20876
  if (source) {
@@ -20795,6 +20878,8 @@ function boundAttrs(node, ctx, storeProp) {
20795
20878
  ` [label]="${formatPipeExpression(chain, source, scope)}" [noTranslate]="true"`
20796
20879
  );
20797
20880
  }
20881
+ const head = staticHeadSource(chain, node.configs?.[BINDING_SLOT.label]);
20882
+ parts.push(colorAttr(node, head && colorPipeExpression(chain, head, scope)));
20798
20883
  }
20799
20884
  if (node.type === "form" /* FORM */) {
20800
20885
  const model = formModelNameFor(node.id, ctx);
@@ -23793,7 +23878,7 @@ function collectComponentImportEntries(tree, ctx = {}) {
23793
23878
  );
23794
23879
  if (bindingsNeedTranslate(
23795
23880
  ctx.controlMap?.[node.id]?.bindings,
23796
- node.formatPipes ?? []
23881
+ labelChainOf(node.formatPipes ?? [])
23797
23882
  )) {
23798
23883
  entries.push({ component: "TranslatePipe", from: ONE_IMPORT_MODULE });
23799
23884
  }
@@ -25381,7 +25466,7 @@ __export(package_exports, {
25381
25466
  version: () => version
25382
25467
  });
25383
25468
  var name = "@magmonium/one";
25384
- var version = "0.4.60";
25469
+ var version = "0.4.68";
25385
25470
  var description = "Magmonium One \u2014 Angular design-system primitives for mm Apps";
25386
25471
  var author = "magmonium";
25387
25472
  var license = "MIT";
@@ -25449,7 +25534,7 @@ __export(package_exports2, {
25449
25534
  version: () => version2
25450
25535
  });
25451
25536
  var name2 = "@magmonium/cli";
25452
- var version2 = "0.8.19";
25537
+ var version2 = "0.8.20";
25453
25538
  var description2 = "A powerful and extensible asset compilation tool that can be shared across multiple projects";
25454
25539
  var bin = {
25455
25540
  "mag-cli": "bin/cli.js"
@@ -25583,7 +25668,6 @@ function isDescendant(ancestorId, candidateId, controlMap) {
25583
25668
  }
25584
25669
  return false;
25585
25670
  }
25586
- var layerLabel = (layer) => layer === 0 ? "root-layer" : `Layer ${layer}`;
25587
25671
  function getAvailableLayers(controlMap, selection) {
25588
25672
  const layers = /* @__PURE__ */ new Set();
25589
25673
  layers.add(0);
@@ -33860,6 +33944,8 @@ var HISTORY_SELECTION_KEYS = [
33860
33944
  collectThemeAssets,
33861
33945
  collectTranslationAssets,
33862
33946
  collectTypedComponentInputs,
33947
+ colorPipeExpression,
33948
+ colorPipeOf,
33863
33949
  columnNeedsId,
33864
33950
  compactControlGroups,
33865
33951
  compactControlMap,
@@ -34332,12 +34418,12 @@ var HISTORY_SELECTION_KEYS = [
34332
34418
  jsNativesInGroup,
34333
34419
  keyCandidates,
34334
34420
  keyIdKeeper,
34421
+ labelChainOf,
34335
34422
  labelEmission,
34336
34423
  labelReadIsTranslated,
34337
34424
  landingNavId,
34338
34425
  landsOn,
34339
34426
  landsUnconditionally,
34340
- layerLabel,
34341
34427
  levelStateComputeds,
34342
34428
  libImportsFrom,
34343
34429
  linkDrift,
@@ -34910,6 +34996,7 @@ var HISTORY_SELECTION_KEYS = [
34910
34996
  stateWriteTargets,
34911
34997
  stateWriteToggleAllowed,
34912
34998
  stateWriteValueKinds,
34999
+ staticHeadSource,
34913
35000
  staticLabelSource,
34914
35001
  staticLiteralType,
34915
35002
  staticLiteralValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magmonium/cli",
3
- "version": "0.8.19",
3
+ "version": "0.8.20",
4
4
  "description": "A powerful and extensible asset compilation tool that can be shared across multiple projects",
5
5
  "bin": {
6
6
  "mag-cli": "bin/cli.js"