@bino-bi/bn-template-engine 1.0.0-next.21 → 1.0.0-next.22

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 (84) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-99477a27.entry.js → p-445c76cd.entry.js} +1 -1
  3. package/dist/bn-template-engine/p-7d1083f6.entry.js +1 -0
  4. package/dist/bn-template-engine/{p-7e9dbc93.entry.js → p-91e5dddf.entry.js} +1 -1
  5. package/dist/bn-template-engine/{p-b9e94127.entry.js → p-93eaded3.entry.js} +1 -1
  6. package/dist/bn-template-engine/{p-BpWWgN6k.js → p-D1SJ10zl.js} +1 -1
  7. package/dist/bn-template-engine/p-D75i_YOP.js +1 -0
  8. package/dist/bn-template-engine/{p-A8xyE4b1.js → p-Da6p_F4J.js} +1 -1
  9. package/dist/bn-template-engine/{p-a1380d7c.entry.js → p-c3383557.entry.js} +1 -1
  10. package/dist/bn-template-engine/{p-ba912130.entry.js → p-cda4322a.entry.js} +1 -1
  11. package/dist/bn-template-engine/{p-6c7f0076.entry.js → p-e49f9170.entry.js} +1 -1
  12. package/dist/bn-template-engine/{p-6077155f.entry.js → p-f275b9fe.entry.js} +1 -1
  13. package/dist/cjs/bn-asset_21.cjs.entry.js +369 -122
  14. package/dist/cjs/bn-chart-bubble.cjs.entry.js +18 -8
  15. package/dist/cjs/bn-chart-bullet.cjs.entry.js +3 -3
  16. package/dist/cjs/bn-chart-scatter.cjs.entry.js +3 -3
  17. package/dist/cjs/bn-grid.cjs.entry.js +1 -1
  18. package/dist/cjs/bn-image.cjs.entry.js +1 -1
  19. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  20. package/dist/cjs/bn-text.cjs.entry.js +2 -2
  21. package/dist/cjs/bn-tree.cjs.entry.js +1 -1
  22. package/dist/cjs/{layoutObserver-DUYYkDMQ.js → layoutObserver-D8leSb4j.js} +1 -1
  23. package/dist/cjs/loader.cjs.js +1 -1
  24. package/dist/cjs/{scaling-BIJQ2NV1.js → scaling-B6_M_HWH.js} +82 -0
  25. package/dist/cjs/{withStyled-Cm9dWQhu.js → withStyled-DuwvaDMp.js} +3 -3
  26. package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +15 -5
  27. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +81 -39
  28. package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +34 -0
  29. package/dist/collection/components/bn-chart-time/bn-chart-time.js +80 -35
  30. package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +34 -0
  31. package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +76 -19
  32. package/dist/collection/components/bn-table/bn-table.js +111 -45
  33. package/dist/collection/components/bn-table/ibcs-table.js +37 -2
  34. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +2 -2
  35. package/dist/collection/utils/dataAnalyzer.js +17 -8
  36. package/dist/collection/utils/scaling.js +79 -0
  37. package/dist/collection/utils/validate.js +3 -3
  38. package/dist/components/DataFormatDigits.js +1 -1
  39. package/dist/components/bn-chart-bubble.js +1 -1
  40. package/dist/components/bn-chart-bullet.js +1 -1
  41. package/dist/components/bn-chart-scatter.js +1 -1
  42. package/dist/components/bn-chart-structure.js +1 -1
  43. package/dist/components/bn-chart-time.js +1 -1
  44. package/dist/components/bn-grid.js +1 -1
  45. package/dist/components/bn-scaling-group.js +1 -1
  46. package/dist/components/bn-table.js +1 -1
  47. package/dist/components/bn-text.js +1 -1
  48. package/dist/components/bn-tree.js +1 -1
  49. package/dist/components/ibcs-chart-structure2.js +1 -1
  50. package/dist/components/ibcs-chart-time2.js +1 -1
  51. package/dist/components/ibcs-table2.js +1 -1
  52. package/dist/components/scaling.js +1 -0
  53. package/dist/components/validate.js +1 -1
  54. package/dist/components/withDataset.js +1 -1
  55. package/dist/components/withStyled.js +1 -1
  56. package/dist/esm/bn-asset_21.entry.js +369 -122
  57. package/dist/esm/bn-chart-bubble.entry.js +18 -8
  58. package/dist/esm/bn-chart-bullet.entry.js +3 -3
  59. package/dist/esm/bn-chart-scatter.entry.js +3 -3
  60. package/dist/esm/bn-grid.entry.js +1 -1
  61. package/dist/esm/bn-image.entry.js +1 -1
  62. package/dist/esm/bn-template-engine.js +1 -1
  63. package/dist/esm/bn-text.entry.js +2 -2
  64. package/dist/esm/bn-tree.entry.js +1 -1
  65. package/dist/esm/{layoutObserver-BJBEyhNf.js → layoutObserver-DtZb2vdM.js} +1 -1
  66. package/dist/esm/loader.js +1 -1
  67. package/dist/esm/{scaling-BGnpSN1j.js → scaling-Bw8XyrFq.js} +80 -1
  68. package/dist/esm/{withStyled-2l5Tx3cf.js → withStyled-41rsCSM1.js} +3 -3
  69. package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +5 -2
  70. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +33 -16
  71. package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +8 -0
  72. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +35 -18
  73. package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +8 -0
  74. package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +28 -8
  75. package/dist/types/components/bn-table/bn-table.d.ts +37 -17
  76. package/dist/types/components/bn-table/ibcs-table.d.ts +8 -0
  77. package/dist/types/components.d.ts +85 -51
  78. package/dist/types/utils/dataAnalyzer.d.ts +5 -1
  79. package/dist/types/utils/scaling.d.ts +63 -0
  80. package/dist/types/utils/validate.d.ts +2 -2
  81. package/package.json +1 -1
  82. package/readme.md +2 -0
  83. package/dist/bn-template-engine/p-C9i1Xsib.js +0 -1
  84. package/dist/bn-template-engine/p-b5274369.entry.js +0 -1
@@ -4,10 +4,10 @@ var index = require('./index-CDKG4xmO.js');
4
4
  var withHasError = require('./withHasError-Cl2gTQzA.js');
5
5
  var contextProtocol = require('./context-protocol-BBhT9B52.js');
6
6
  var withBodyObserver = require('./withBodyObserver-BKUE_ypL.js');
7
- var withStyled = require('./withStyled-Cm9dWQhu.js');
8
- var scaling = require('./scaling-BIJQ2NV1.js');
7
+ var withStyled = require('./withStyled-DuwvaDMp.js');
8
+ var scaling = require('./scaling-B6_M_HWH.js');
9
9
  var withScalingGroup = require('./withScalingGroup-D5clRvRe.js');
10
- var layoutObserver = require('./layoutObserver-DUYYkDMQ.js');
10
+ var layoutObserver = require('./layoutObserver-D8leSb4j.js');
11
11
  var VarianceMeasure = require('./VarianceMeasure-BBWTgv2e.js');
12
12
  var Order = require('./Order-IPfAP0q8.js');
13
13
  var SVGStyle = require('./SVGStyle-BD8jApd4.js');
@@ -142,8 +142,7 @@ const Chart$1 = class Chart {
142
142
  }
143
143
  validateUnitScaling(newValue) {
144
144
  const errId = "ERR_unitScaling";
145
- const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
146
- if (!isAuto && !withStyled.isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
145
+ if (scaling.resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
147
146
  this.errors.addOrReplace({
148
147
  id: errId,
149
148
  type: "warning",
@@ -156,8 +155,7 @@ const Chart$1 = class Chart {
156
155
  }
157
156
  validatePercentageScaling(newValue) {
158
157
  const errId = "ERR_percentageScaling";
159
- const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
160
- if (!isAuto && !withStyled.isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
158
+ if (scaling.resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
161
159
  this.errors.addOrReplace({
162
160
  id: errId,
163
161
  type: "warning",
@@ -405,6 +403,41 @@ const Chart$1 = class Chart {
405
403
  this.stack = "";
406
404
  this.pixelPerUnitGroupMap = new Map();
407
405
  this._autoScaleGuard = false;
406
+ this.autoUnitWarningActive = false;
407
+ this.autoPctWarningActive = false;
408
+ /**
409
+ * Receives the auto-fitted values from the inner ibcs-chart-structure (px
410
+ * per unit / px per 1.0 fraction) and surfaces them in the AUTO_* warnings,
411
+ * converted back to the attribute's units-per-em form so users can copy
412
+ * them into a bn-scaling-group.
413
+ */
414
+ this.handleAutoScalingReport = (report) => {
415
+ var _a, _b;
416
+ const changed = (next, last) => last === undefined || Math.abs(next - last) > Math.abs(next) * 1e-3;
417
+ const effFontPx = this.getEffectiveFontPx();
418
+ if (report.unit !== undefined && report.unit > 0 && this.autoUnitWarningActive) {
419
+ const unitsPerEm = effFontPx / report.unit;
420
+ if (changed(unitsPerEm, this.lastReportedUnitsPerEm)) {
421
+ this.lastReportedUnitsPerEm = unitsPerEm;
422
+ this.errors.addOrReplace({
423
+ id: "AUTO_unitScaling",
424
+ type: "warning",
425
+ message: `unit-scaling: ${Chart$1.describeScalingInput(String((_a = this.unitScaling) !== null && _a !== void 0 ? _a : "").trim())}, auto-fitted to 1 em ≈ ${scaling.formatScalingValue(unitsPerEm)} units.`,
426
+ });
427
+ }
428
+ }
429
+ if (report.percentage !== undefined && report.percentage > 0 && this.autoPctWarningActive) {
430
+ const ppPerEm = (100 * effFontPx) / report.percentage;
431
+ if (changed(ppPerEm, this.lastReportedPpPerEm)) {
432
+ this.lastReportedPpPerEm = ppPerEm;
433
+ this.errors.addOrReplace({
434
+ id: "AUTO_percentageScaling",
435
+ type: "warning",
436
+ message: `percentage-scaling: ${Chart$1.describeScalingInput(String((_b = this.percentageScaling) !== null && _b !== void 0 ? _b : "").trim())}, auto-fitted to 1 em ≈ ${scaling.formatScalingValue(ppPerEm)} percentage points.`,
437
+ });
438
+ }
439
+ }
440
+ };
408
441
  withStyled.withStyled(this);
409
442
  withHasError.withComponentStatus(this);
410
443
  scaling.withDataset(this, (name, _data) => {
@@ -543,12 +576,9 @@ const Chart$1 = class Chart {
543
576
  * Skipped for auto/unset unit-scaling since auto-fit handles width.
544
577
  */
545
578
  checkWidthOverflow() {
546
- var _a;
547
579
  const errId = "WARN_overflow";
548
- const us = String((_a = this.unitScaling) !== null && _a !== void 0 ? _a : "")
549
- .trim()
550
- .toLowerCase();
551
- if (us === "" || us === "auto") {
580
+ if (scaling.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap).kind !== "value") {
581
+ // Auto (explicit or fallback) fits the width by construction.
552
582
  this.errors.remove(errId);
553
583
  return;
554
584
  }
@@ -557,7 +587,7 @@ const Chart$1 = class Chart {
557
587
  this.errors.addOrReplace({
558
588
  id: errId,
559
589
  type: "error",
560
- message: `Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(parent.width)}px). Reduce unit-scaling or set to "auto".`,
590
+ message: `Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(parent.width)}px). Increase unit-scaling or set to "auto".`,
561
591
  });
562
592
  }
563
593
  else {
@@ -619,48 +649,56 @@ const Chart$1 = class Chart {
619
649
  const i18nMapGlobal = new Map(i18nMetaLabelsGlobal.map((key) => [key, this.t("global.".concat(key))]));
620
650
  return new Map([...i18nMapGlobal.entries(), ...i18nMapLocal.entries()]);
621
651
  }
652
+ /** "not set" for blank input, `invalid value "x"` otherwise — for AUTO_* messages. */
653
+ static describeScalingInput(raw) {
654
+ return raw === "" ? "not set" : `invalid value "${raw}"`;
655
+ }
622
656
  preparePixelPerUnit() {
623
- var _a;
624
- if (this.pixelPerUnitGroupMap.has(this.unitScaling)) {
657
+ const resolved = scaling.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
658
+ if (resolved.kind === "value") {
625
659
  this.errors.remove("AUTO_unitScaling");
626
- return this.pixelPerUnitGroupMap.get(this.unitScaling);
660
+ this.autoUnitWarningActive = false;
661
+ this.lastReportedUnitsPerEm = undefined;
662
+ // The attribute is data units per em; the inner chart expects px for one data unit.
663
+ return this.getEffectiveFontPx() / resolved.value;
627
664
  }
628
665
  // Explicit 'auto' → auto-calculate silently
629
- if (((_a = this.unitScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
666
+ if (resolved.kind === "auto") {
630
667
  this.errors.remove("AUTO_unitScaling");
668
+ this.autoUnitWarningActive = false;
669
+ this.lastReportedUnitsPerEm = undefined;
631
670
  return 0;
632
671
  }
633
- const numeric = Number(this.unitScaling);
634
- if (!isNaN(numeric) && numeric > 0) {
635
- this.errors.remove("AUTO_unitScaling");
636
- return numeric;
637
- }
638
672
  // Not set / invalid → auto-calculate with warning
673
+ this.autoUnitWarningActive = true;
639
674
  this.errors.addOrReplace({
640
675
  id: "AUTO_unitScaling",
641
676
  type: "warning",
642
- message: `unit-scaling: not set, auto-calculated to fit available space.`,
677
+ message: `unit-scaling: ${Chart$1.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
643
678
  });
644
679
  return 0;
645
680
  }
646
681
  preparePixelPerPercentage() {
647
- var _a;
648
- if (this.pixelPerUnitGroupMap.has(this.percentageScaling)) {
649
- return this.pixelPerUnitGroupMap.get(this.percentageScaling);
650
- }
651
- if (((_a = this.percentageScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
682
+ const resolved = scaling.resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
683
+ if (resolved.kind === "value") {
652
684
  this.errors.remove("AUTO_percentageScaling");
653
- return 0;
685
+ this.autoPctWarningActive = false;
686
+ this.lastReportedPpPerEm = undefined;
687
+ // The attribute is percentage points per em; the inner chart expects
688
+ // px per 1.0 fraction (= per 100 percentage points).
689
+ return (100 * this.getEffectiveFontPx()) / resolved.value;
654
690
  }
655
- const numeric = Number(this.percentageScaling);
656
- if (!isNaN(numeric) && numeric > 0) {
691
+ if (resolved.kind === "auto") {
657
692
  this.errors.remove("AUTO_percentageScaling");
658
- return numeric * 100;
693
+ this.autoPctWarningActive = false;
694
+ this.lastReportedPpPerEm = undefined;
695
+ return 0;
659
696
  }
697
+ this.autoPctWarningActive = true;
660
698
  this.errors.addOrReplace({
661
699
  id: "AUTO_percentageScaling",
662
700
  type: "warning",
663
- message: `percentage-scaling: not set, auto-calculated to fit available space.`,
701
+ message: `percentage-scaling: ${Chart$1.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
664
702
  });
665
703
  return 0;
666
704
  }
@@ -869,14 +907,13 @@ const Chart$1 = class Chart {
869
907
  return this.measureUnit;
870
908
  }
871
909
  chartTemplate(localScenarioString, idx) {
872
- const effectiveFactor = this.getEffectiveScaleFactor();
873
910
  const ppu = this.preparePixelPerUnit();
874
911
  const ppp = this.preparePixelPerPercentage();
875
912
  const stackConfig = this.prepareStackConfig();
876
913
  const scenarios = this.prepareScenarios();
877
914
  // Dimension stacking uses only the first scenario
878
915
  const effectiveScenarios = (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === VarianceMeasure.StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
879
- return (index.h("ibcs-chart-structure", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideCategories: this.prepareHideCategories(idx), pixelPerUnit: ppu > 0 ? ppu * effectiveFactor : 0, pixelPerPercentage: ppp > 0 ? ppp * effectiveFactor : 0, limit: this.prepareLimit(), styles: this.prepareStyle(), i18n: this.prepareI18n(), order: this.prepareOrder(), level: this.prepareLevel(), filter: this.prepareFilter(), "measure-scale": this.prepareMeasureScale(), "measure-unit": this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(idx), stackConfig: stackConfig, parentDimensions: this.prepareDimension(), ruleSetConfig: this.ruleSetConfig() }));
916
+ return (index.h("ibcs-chart-structure", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideCategories: this.prepareHideCategories(idx), pixelPerUnit: ppu, pixelPerPercentage: ppp, reportAutoScaling: this.handleAutoScalingReport, limit: this.prepareLimit(), styles: this.prepareStyle(), i18n: this.prepareI18n(), order: this.prepareOrder(), level: this.prepareLevel(), filter: this.prepareFilter(), "measure-scale": this.prepareMeasureScale(), "measure-unit": this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(idx), stackConfig: stackConfig, parentDimensions: this.prepareDimension(), ruleSetConfig: this.ruleSetConfig() }));
880
917
  }
881
918
  getEffectiveScaleFactor() {
882
919
  const { mode, factor } = scaling.parseScaling(this.scale);
@@ -886,6 +923,11 @@ const Chart$1 = class Chart {
886
923
  return this.appliedScaleFactor;
887
924
  return 1;
888
925
  }
926
+ /** Effective font size in px: base font from the style store × effective scale factor. */
927
+ getEffectiveFontPx() {
928
+ const baseFontSize = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; });
929
+ return baseFontSize * this.getEffectiveScaleFactor();
930
+ }
889
931
  getFontStyles() {
890
932
  const effectiveFactor = this.getEffectiveScaleFactor();
891
933
  return this.componentStyle(($) => {
@@ -906,7 +948,7 @@ const Chart$1 = class Chart {
906
948
  scenariosArray = [...scenariosArray, ...variancesArray];
907
949
  }
908
950
  const fontStyles = this.getFontStyles();
909
- return (index.h(index.Host, { key: '472aabc33cfbf293c44cd93537e91c42cdc9e0d7', style: fontStyles }, index.h("div", { key: 'd48365a9ef3a48df6cd42807f7375414dd6714ef', class: "container" }, scenariosArray.map(this.chartTemplate))));
951
+ return (index.h(index.Host, { key: '8050c526688b5094b630f9646fb0dd141a63beb2', style: fontStyles }, index.h("div", { key: '771c98ce06779536ac1b701a7cad40becc47738c', class: "container" }, scenariosArray.map(this.chartTemplate))));
910
952
  }
911
953
  get element() { return index.getElement(this); }
912
954
  static get watchers() { return {
@@ -1029,8 +1071,7 @@ const Chart = class {
1029
1071
  }
1030
1072
  validateUnitScaling(newValue) {
1031
1073
  const errId = "ERR_unitScaling";
1032
- const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
1033
- if (!isAuto && !withStyled.isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
1074
+ if (scaling.resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
1034
1075
  this.errors.addOrReplace({
1035
1076
  id: errId,
1036
1077
  type: "warning",
@@ -1043,8 +1084,7 @@ const Chart = class {
1043
1084
  }
1044
1085
  validatePercentageScaling(newValue) {
1045
1086
  const errId = "ERR_percentageScaling";
1046
- const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
1047
- if (!isAuto && !withStyled.isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
1087
+ if (scaling.resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
1048
1088
  this.errors.addOrReplace({
1049
1089
  id: errId,
1050
1090
  type: "warning",
@@ -1369,7 +1409,7 @@ const Chart = class {
1369
1409
  * original value.
1370
1410
  * <br /><br />
1371
1411
  * values: <br />
1372
- * ```_ // k // M // G // T // P // E // Z // Y // m // μ // n // p // P // f // a // z // y // GREATEST // LEAST```
1412
+ * ```_ // k // M // G // T // P // E // Z // Y // m // my (μ) // n // p // f // a // z // y // GREATEST // LEAST```
1373
1413
  * <br /><br />
1374
1414
  * SiPrefix overview:
1375
1415
  * ``` "Y": 1E+24,```<br />
@@ -1382,7 +1422,7 @@ const Chart = class {
1382
1422
  * ``` "k": 1000,```<br />
1383
1423
  * <br />
1384
1424
  * ``` "m": 0.001,```<br />
1385
- * ``` "μ": 0.000001,```<br />
1425
+ * ``` "my" (μ): 0.000001,```<br />
1386
1426
  * ``` "n": 0.000000001,```<br />
1387
1427
  * ``` "p": 0.000000000001,```<br />
1388
1428
  * ``` "f": 0.000000000000001,```<br />
@@ -1417,6 +1457,41 @@ const Chart = class {
1417
1457
  this._lastObservedWidth = 0;
1418
1458
  this._settleTimer = null;
1419
1459
  this._lastAppliedHeight = 0;
1460
+ this.autoUnitWarningActive = false;
1461
+ this.autoPctWarningActive = false;
1462
+ /**
1463
+ * Receives the auto-fitted values from the inner ibcs-chart-time (px per
1464
+ * unit / px per 1.0 fraction) and surfaces them in the AUTO_* warnings,
1465
+ * converted back to the attribute's units-per-em form so users can copy
1466
+ * them into a bn-scaling-group.
1467
+ */
1468
+ this.handleAutoScalingReport = (report) => {
1469
+ var _a, _b;
1470
+ const changed = (next, last) => last === undefined || Math.abs(next - last) > Math.abs(next) * 1e-3;
1471
+ const effFontPx = this.getEffectiveFontPx();
1472
+ if (report.unit !== undefined && report.unit > 0 && this.autoUnitWarningActive) {
1473
+ const unitsPerEm = effFontPx / report.unit;
1474
+ if (changed(unitsPerEm, this.lastReportedUnitsPerEm)) {
1475
+ this.lastReportedUnitsPerEm = unitsPerEm;
1476
+ this.errors.addOrReplace({
1477
+ id: "AUTO_unitScaling",
1478
+ type: "warning",
1479
+ message: `unit-scaling: ${Chart.describeScalingInput(String((_a = this.unitScaling) !== null && _a !== void 0 ? _a : "").trim())}, auto-fitted to 1 em ≈ ${scaling.formatScalingValue(unitsPerEm)} units.`,
1480
+ });
1481
+ }
1482
+ }
1483
+ if (report.percentage !== undefined && report.percentage > 0 && this.autoPctWarningActive) {
1484
+ const ppPerEm = (100 * effFontPx) / report.percentage;
1485
+ if (changed(ppPerEm, this.lastReportedPpPerEm)) {
1486
+ this.lastReportedPpPerEm = ppPerEm;
1487
+ this.errors.addOrReplace({
1488
+ id: "AUTO_percentageScaling",
1489
+ type: "warning",
1490
+ message: `percentage-scaling: ${Chart.describeScalingInput(String((_b = this.percentageScaling) !== null && _b !== void 0 ? _b : "").trim())}, auto-fitted to 1 em ≈ ${scaling.formatScalingValue(ppPerEm)} percentage points.`,
1491
+ });
1492
+ }
1493
+ }
1494
+ };
1420
1495
  withStyled.withStyled(this);
1421
1496
  withHasError.withComponentStatus(this);
1422
1497
  scaling.withDataset(this, (name, _data) => {
@@ -1650,48 +1725,56 @@ const Chart = class {
1650
1725
  const i18nMapGlobal = new Map(i18nMetaLabelsGlobal.map((key) => [key, this.t("global.".concat(key))]));
1651
1726
  return new Map([...i18nMapGlobal.entries(), ...i18nMapLocal.entries()]);
1652
1727
  }
1728
+ /** "not set" for blank input, `invalid value "x"` otherwise — for AUTO_* messages. */
1729
+ static describeScalingInput(raw) {
1730
+ return raw === "" ? "not set" : `invalid value "${raw}"`;
1731
+ }
1653
1732
  preparePixelPerUnit() {
1654
- var _a;
1655
- if (this.pixelPerUnitGroupMap.has(this.unitScaling)) {
1733
+ const resolved = scaling.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
1734
+ if (resolved.kind === "value") {
1656
1735
  this.errors.remove("AUTO_unitScaling");
1657
- return this.pixelPerUnitGroupMap.get(this.unitScaling);
1736
+ this.autoUnitWarningActive = false;
1737
+ this.lastReportedUnitsPerEm = undefined;
1738
+ // The attribute is data units per em; the inner chart expects px for one data unit.
1739
+ return this.getEffectiveFontPx() / resolved.value;
1658
1740
  }
1659
1741
  // Explicit 'auto' → auto-calculate silently
1660
- if (((_a = this.unitScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
1742
+ if (resolved.kind === "auto") {
1661
1743
  this.errors.remove("AUTO_unitScaling");
1744
+ this.autoUnitWarningActive = false;
1745
+ this.lastReportedUnitsPerEm = undefined;
1662
1746
  return 0;
1663
1747
  }
1664
- const numeric = Number(this.unitScaling);
1665
- if (!isNaN(numeric) && numeric > 0) {
1666
- this.errors.remove("AUTO_unitScaling");
1667
- return numeric;
1668
- }
1669
1748
  // Not set / invalid → auto-calculate with warning
1749
+ this.autoUnitWarningActive = true;
1670
1750
  this.errors.addOrReplace({
1671
1751
  id: "AUTO_unitScaling",
1672
1752
  type: "warning",
1673
- message: `unit-scaling: not set, auto-calculated to fit available space.`,
1753
+ message: `unit-scaling: ${Chart.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
1674
1754
  });
1675
1755
  return 0;
1676
1756
  }
1677
1757
  preparePixelPerPercentage() {
1678
- var _a;
1679
- if (this.pixelPerUnitGroupMap.has(this.percentageScaling)) {
1680
- return this.pixelPerUnitGroupMap.get(this.percentageScaling);
1681
- }
1682
- if (((_a = this.percentageScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
1758
+ const resolved = scaling.resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
1759
+ if (resolved.kind === "value") {
1683
1760
  this.errors.remove("AUTO_percentageScaling");
1684
- return 0;
1761
+ this.autoPctWarningActive = false;
1762
+ this.lastReportedPpPerEm = undefined;
1763
+ // The attribute is percentage points per em; the inner chart expects
1764
+ // px per 1.0 fraction (= per 100 percentage points).
1765
+ return (100 * this.getEffectiveFontPx()) / resolved.value;
1685
1766
  }
1686
- const numeric = Number(this.percentageScaling);
1687
- if (!isNaN(numeric) && numeric > 0) {
1767
+ if (resolved.kind === "auto") {
1688
1768
  this.errors.remove("AUTO_percentageScaling");
1689
- return numeric * 100;
1769
+ this.autoPctWarningActive = false;
1770
+ this.lastReportedPpPerEm = undefined;
1771
+ return 0;
1690
1772
  }
1773
+ this.autoPctWarningActive = true;
1691
1774
  this.errors.addOrReplace({
1692
1775
  id: "AUTO_percentageScaling",
1693
1776
  type: "warning",
1694
- message: `percentage-scaling: not set, auto-calculated to fit available space.`,
1777
+ message: `percentage-scaling: ${Chart.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
1695
1778
  });
1696
1779
  return 0;
1697
1780
  }
@@ -1961,13 +2044,12 @@ const Chart = class {
1961
2044
  const preparedI18n = this.prepareI18n();
1962
2045
  const preparedStyle = this.prepareStyle();
1963
2046
  const fullParentWidth = scaling.getParentDimensions(this.element).width;
1964
- const effectiveFactor = this.getEffectiveScaleFactor();
1965
2047
  const ppu = this.preparePixelPerUnit();
1966
2048
  const ppp = this.preparePixelPerPercentage();
1967
2049
  const stackConfig = this.prepareStackConfig();
1968
2050
  const scenarios = this.prepareScenarios();
1969
2051
  const effectiveScenarios = (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === VarianceMeasure.StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
1970
- return (index.h("ibcs-chart-time", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideAxisLabels: this.prepareHideAxisLabels(idx), pixelPerUnit: ppu > 0 ? ppu * effectiveFactor : 0, pixelPerPercentage: ppp > 0 ? ppp * effectiveFactor : 0, limit: this.prepareLimit(), leftSideOffsetForHorizontalSync: this.prepareLeftSideOffset(preparedI18n, preparedStyle), styles: preparedStyle, i18n: preparedI18n, order: this.prepareOrder(), level: this.prepareLevel(), dateInterval: this.prepareDateInterval(), intervalSpanLimit: this.prepareIntervalSpanLimit(), axisLabelsMode: this.prepareAxisLabelsMode(), filter: this.prepareFilter(), "measure-scale": this.prepareMeasureScale(), "measure-unit": this.prepareMeasureUnit(), showOverlayAvg: this.prepareAvg(), showOverlayMedian: this.prepareMedian(), showMeasureScale: this.prepareShowMeasureScale(idx), chartMode: this.prepareChartMode(), maxBars: this.prepareMaxBars(), stackConfig: stackConfig, lineFullWidth: this.prepareLineFullWidth(), containerWidth: fullParentWidth, parentDimensions: this.prepareDimension(), ruleSetConfig: this.ruleSetConfig() }));
2052
+ return (index.h("ibcs-chart-time", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideAxisLabels: this.prepareHideAxisLabels(idx), pixelPerUnit: ppu, pixelPerPercentage: ppp, reportAutoScaling: this.handleAutoScalingReport, limit: this.prepareLimit(), leftSideOffsetForHorizontalSync: this.prepareLeftSideOffset(preparedI18n, preparedStyle), styles: preparedStyle, i18n: preparedI18n, order: this.prepareOrder(), level: this.prepareLevel(), dateInterval: this.prepareDateInterval(), intervalSpanLimit: this.prepareIntervalSpanLimit(), axisLabelsMode: this.prepareAxisLabelsMode(), filter: this.prepareFilter(), "measure-scale": this.prepareMeasureScale(), "measure-unit": this.prepareMeasureUnit(), showOverlayAvg: this.prepareAvg(), showOverlayMedian: this.prepareMedian(), showMeasureScale: this.prepareShowMeasureScale(idx), chartMode: this.prepareChartMode(), maxBars: this.prepareMaxBars(), stackConfig: stackConfig, lineFullWidth: this.prepareLineFullWidth(), containerWidth: fullParentWidth, parentDimensions: this.prepareDimension(), ruleSetConfig: this.ruleSetConfig() }));
1971
2053
  }
1972
2054
  getEffectiveScaleFactor() {
1973
2055
  const { mode, factor } = scaling.parseScaling(this.scale);
@@ -1977,6 +2059,11 @@ const Chart = class {
1977
2059
  return this.appliedScaleFactor;
1978
2060
  return 1;
1979
2061
  }
2062
+ /** Effective font size in px: base font from the style store × effective scale factor. */
2063
+ getEffectiveFontPx() {
2064
+ const baseFontSize = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; });
2065
+ return baseFontSize * this.getEffectiveScaleFactor();
2066
+ }
1980
2067
  getFontStyles() {
1981
2068
  const effectiveFactor = this.getEffectiveScaleFactor();
1982
2069
  return this.componentStyle(($) => {
@@ -1997,7 +2084,7 @@ const Chart = class {
1997
2084
  scenariosArray = [...scenariosArray, ...variancesArray];
1998
2085
  }
1999
2086
  const fontStyles = this.getFontStyles();
2000
- return (index.h(index.Host, { key: '104f7786a091dd6826e780981c6f9304727294d7', style: fontStyles }, index.h("div", { key: 'b8730bc1ecfe26feb450881e97de7ef407163a21', class: "container" }, scenariosArray.map(this.chartTemplate))));
2087
+ return (index.h(index.Host, { key: 'a8070cc2333500d65e991851af93f498bd007e74', style: fontStyles }, index.h("div", { key: 'f54fa6d3db57c652fc6f900be59243925a718aa2', class: "container" }, scenariosArray.map(this.chartTemplate))));
2001
2088
  }
2002
2089
  get element() { return index.getElement(this); }
2003
2090
  static get watchers() { return {
@@ -3937,28 +4024,44 @@ const ScalingGroup = class {
3937
4024
  this.stores = contextProtocol.getStores(this.element);
3938
4025
  this.pushToStore();
3939
4026
  }
4027
+ disconnectedCallback() {
4028
+ this.removeEntryIfOurs(this.storedName);
4029
+ }
3940
4030
  onNameChange(newName, oldName) {
3941
- if (oldName && oldName !== newName && this.stores) {
3942
- // Remove old entry — only if it still points to our value
3943
- // (another bn-scaling-group with the same name may have overwritten it)
3944
- const current = this.stores.scalingGroups.state[oldName];
3945
- if (current === this.value) {
3946
- // @ts-ignore – dynamic key
3947
- this.stores.scalingGroups.set(oldName, undefined);
3948
- }
4031
+ const trimmedOld = oldName === null || oldName === void 0 ? void 0 : oldName.toString().trim();
4032
+ if (trimmedOld && trimmedOld !== (newName === null || newName === void 0 ? void 0 : newName.toString().trim())) {
4033
+ this.removeEntryIfOurs(trimmedOld);
3949
4034
  }
3950
4035
  this.pushToStore();
3951
4036
  }
3952
4037
  onValueChange() {
3953
4038
  this.pushToStore();
3954
4039
  }
4040
+ /**
4041
+ * Removes the store entry for `name` — but only if it still holds the value
4042
+ * this element wrote (another bn-scaling-group with the same name may have
4043
+ * overwritten it).
4044
+ */
4045
+ removeEntryIfOurs(name) {
4046
+ if (!name || !this.stores)
4047
+ return;
4048
+ if (this.storedName === name && this.stores.scalingGroups.state[name] === this.storedValue) {
4049
+ // @ts-ignore – dynamic key
4050
+ this.stores.scalingGroups.set(name, undefined);
4051
+ }
4052
+ if (this.storedName === name) {
4053
+ this.storedName = undefined;
4054
+ this.storedValue = undefined;
4055
+ }
4056
+ }
3955
4057
  pushToStore() {
3956
4058
  var _a;
3957
4059
  if (!this.stores)
3958
4060
  return;
3959
4061
  const trimmedName = (_a = this.name) === null || _a === void 0 ? void 0 : _a.toString().trim();
4062
+ const nameParse = scaling.parseScalingValue(trimmedName);
3960
4063
  // Validate: "auto" is reserved
3961
- if ((trimmedName === null || trimmedName === void 0 ? void 0 : trimmedName.toLowerCase()) === "auto") {
4064
+ if (nameParse.kind === "auto") {
3962
4065
  this.errors.addOrReplace({
3963
4066
  id: "ERR_reserved_name",
3964
4067
  type: "warning",
@@ -3976,11 +4079,49 @@ const ScalingGroup = class {
3976
4079
  return;
3977
4080
  }
3978
4081
  this.errors.remove("ERR_empty_name");
4082
+ // Validate: a name that parses as a number/SI value would be ambiguous
4083
+ // with a literal scaling value at the referencing component.
4084
+ if (nameParse.kind === "number") {
4085
+ this.errors.addOrReplace({
4086
+ id: "ERR_numeric_name",
4087
+ type: "warning",
4088
+ message: `bn-scaling-group: name "${trimmedName}" is not allowed — it would be ambiguous with a numeric scaling value.`,
4089
+ });
4090
+ return;
4091
+ }
4092
+ this.errors.remove("ERR_numeric_name");
4093
+ const parsedValue = scaling.parseScalingValue(this.value);
4094
+ if (parsedValue.kind !== "number") {
4095
+ this.errors.addOrReplace({
4096
+ id: "ERR_invalid_value",
4097
+ type: "warning",
4098
+ message: `bn-scaling-group: invalid value "${this.value}" — must be a positive number, optionally with k/M/G/T suffix.`,
4099
+ });
4100
+ return;
4101
+ }
4102
+ this.errors.remove("ERR_invalid_value");
4103
+ const existing = this.stores.scalingGroups.state[trimmedName];
4104
+ const wroteExisting = this.storedName === trimmedName && this.storedValue === existing;
4105
+ if (existing !== undefined && existing !== parsedValue.value && !wroteExisting) {
4106
+ this.errors.addOrReplace({
4107
+ id: "WARN_duplicate_group",
4108
+ type: "warning",
4109
+ message: `bn-scaling-group: "${trimmedName}" is already registered with a different value (${scaling.formatScalingValue(existing)}); overwriting.`,
4110
+ });
4111
+ }
4112
+ else {
4113
+ this.errors.remove("WARN_duplicate_group");
4114
+ }
4115
+ if (this.storedName && this.storedName !== trimmedName) {
4116
+ this.removeEntryIfOurs(this.storedName);
4117
+ }
3979
4118
  // @ts-ignore – dynamic key
3980
- this.stores.scalingGroups.set(trimmedName, this.value);
4119
+ this.stores.scalingGroups.set(trimmedName, parsedValue.value);
4120
+ this.storedName = trimmedName;
4121
+ this.storedValue = parsedValue.value;
3981
4122
  }
3982
4123
  render() {
3983
- return index.h(index.Host, { key: '56092f6e012b217bb60833dba91def0561edf06b' });
4124
+ return index.h(index.Host, { key: '7b125b03953f91d15c6c9df7ca178c9f33b054cc' });
3984
4125
  }
3985
4126
  get element() { return index.getElement(this); }
3986
4127
  static get watchers() { return {
@@ -4249,31 +4390,40 @@ const Table$1 = class Table {
4249
4390
  */
4250
4391
  this.barColumnWidth = "w10";
4251
4392
  /**
4252
- * Pixels per unit for absolute variance bar charts (ΔPY).
4253
- * Controls bar width: barWidth = value × unitScaling.
4393
+ * Data units displayed per 1 em of bar length for absolute variance bar
4394
+ * charts (ΔPY) — map-scale semantics: a larger value means smaller bars.
4254
4395
  * Bars exceeding barColumnWidth are shown with an arrow indicator.
4255
- * <br /><br />
4256
- * Accepts a number, `"auto"`, or a `<bn-scaling-group>` name for synchronized scaling.
4257
- * <br /><br />
4258
- * Default: 0.01
4259
4396
  *
4260
- * @example unit-scaling="0.01"
4397
+ * | Value | Behavior |
4398
+ * |------------------|----------------------------------------------------------------|
4399
+ * | `"auto"` | Auto-fit the largest bar to the bar column width |
4400
+ * | `"250000"`, `"1M"` | Units per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |
4401
+ * | group name | References a `<bn-scaling-group>` for synchronized scaling |
4402
+ * | invalid / unknown | Auto-fit + `AUTO_unitScaling` warning |
4403
+ *
4404
+ * Default: `"100"` (1 em of bar represents 100 units)
4405
+ *
4406
+ * @example unit-scaling="1M"
4261
4407
  * @example unit-scaling="revenue-scale"
4262
4408
  */
4263
- this.unitScaling = 0.01;
4409
+ this.unitScaling = "100";
4264
4410
  /**
4265
- * Scaling for relative variance pin charts (ΔPY%).
4266
- * <br /><br />
4267
- * Accepts a number, `"auto"`, or a `<bn-scaling-group>` name for synchronized scaling.
4268
- * <br /><br />
4269
- * Example: 0.5 means 100% = 50 pixels width.
4270
- * <br /><br />
4271
- * Default: 0.5
4411
+ * Percentage points displayed per 1 em of pin length for relative variance
4412
+ * pin charts (ΔPY%) — a larger value means shorter pins.
4413
+ *
4414
+ * | Value | Behavior |
4415
+ * |------------------|----------------------------------------------------------------|
4416
+ * | `"auto"` | Auto-fit the largest pin to the pin area |
4417
+ * | `"10"`, `"2.5"` | Percentage points per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |
4418
+ * | group name | References a `<bn-scaling-group>` for synchronized scaling |
4419
+ * | invalid / unknown | Auto-fit + `AUTO_percentageScaling` warning |
4272
4420
  *
4273
- * @example percentage-scaling="0.5"
4421
+ * Default: `"2"` (a +2 % variance pin is 1 em long)
4422
+ *
4423
+ * @example percentage-scaling="10"
4274
4424
  * @example percentage-scaling="pct-scale"
4275
4425
  */
4276
- this.percentageScaling = 0.5;
4426
+ this.percentageScaling = "2";
4277
4427
  // Global scaling groups map - can be populated externally for shared scaling across components
4278
4428
  this.pixelPerUnitGroupMap = new Map();
4279
4429
  /**
@@ -4387,7 +4537,7 @@ const Table$1 = class Table {
4387
4537
  * original value.
4388
4538
  * <br /><br />
4389
4539
  * values: <br />
4390
- * ```_ // k // M // G // T // P // E // Z // Y // m // μ // n // p // P // f // a // z // y // GREATEST // LEAST```
4540
+ * ```_ // k // M // G // T // P // E // Z // Y // m // my (μ) // n // p // f // a // z // y // GREATEST // LEAST```
4391
4541
  * <br /><br />
4392
4542
  * SiPrefix overview:
4393
4543
  * ``` "Y": 1E+24,```<br />
@@ -4400,7 +4550,7 @@ const Table$1 = class Table {
4400
4550
  * ``` "k": 1000,```<br />
4401
4551
  * <br />
4402
4552
  * ``` "m": 0.001,```<br />
4403
- * ``` "μ": 0.000001,```<br />
4553
+ * ``` "my" (μ): 0.000001,```<br />
4404
4554
  * ``` "n": 0.000000001,```<br />
4405
4555
  * ``` "p": 0.000000000001,```<br />
4406
4556
  * ``` "f": 0.000000000000001,```<br />
@@ -4472,6 +4622,39 @@ const Table$1 = class Table {
4472
4622
  */
4473
4623
  this.tableAttributes = "";
4474
4624
  this._autoScaleGuard = false;
4625
+ this.autoUnitWarningActive = false;
4626
+ this.autoPctWarningActive = false;
4627
+ /**
4628
+ * Receives the auto-fitted scaling values from the inner ibcs-table
4629
+ * (em per unit / em per percentage point) and surfaces them in the AUTO_*
4630
+ * warnings, converted back to the attribute's units-per-em form so users
4631
+ * can copy them into a bn-scaling-group.
4632
+ */
4633
+ this.handleAutoScalingReport = (report) => {
4634
+ const changed = (next, last) => last === undefined || Math.abs(next - last) > Math.abs(next) * 1e-3;
4635
+ if (report.unit !== undefined && report.unit > 0 && this.autoUnitWarningActive) {
4636
+ const unitsPerEm = 1 / report.unit;
4637
+ if (changed(unitsPerEm, this.lastReportedUnitsPerEm)) {
4638
+ this.lastReportedUnitsPerEm = unitsPerEm;
4639
+ this.errors.addOrReplace({
4640
+ id: "AUTO_unitScaling",
4641
+ type: "warning",
4642
+ message: `unit-scaling: invalid value "${this.unitScaling}" — auto-fitted to 1 em ≈ ${scaling.formatScalingValue(unitsPerEm)} units.`,
4643
+ });
4644
+ }
4645
+ }
4646
+ if (report.percentage !== undefined && report.percentage > 0 && this.autoPctWarningActive) {
4647
+ const ppPerEm = 1 / report.percentage;
4648
+ if (changed(ppPerEm, this.lastReportedPpPerEm)) {
4649
+ this.lastReportedPpPerEm = ppPerEm;
4650
+ this.errors.addOrReplace({
4651
+ id: "AUTO_percentageScaling",
4652
+ type: "warning",
4653
+ message: `percentage-scaling: invalid value "${this.percentageScaling}" — auto-fitted to 1 em ≈ ${scaling.formatScalingValue(ppPerEm)} percentage points.`,
4654
+ });
4655
+ }
4656
+ }
4657
+ };
4475
4658
  withStyled.withStyled(this);
4476
4659
  withHasError.withComponentStatus(this);
4477
4660
  this.errors = withHasError.withHasError(this);
@@ -4566,8 +4749,7 @@ const Table$1 = class Table {
4566
4749
  }
4567
4750
  validateUnitScaling(newValue) {
4568
4751
  const errId = "ERR_unitScaling";
4569
- const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
4570
- if (!isAuto && !withStyled.isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
4752
+ if (scaling.resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
4571
4753
  this.errors.addOrReplace({
4572
4754
  id: errId,
4573
4755
  type: "warning",
@@ -4580,8 +4762,7 @@ const Table$1 = class Table {
4580
4762
  }
4581
4763
  validatePercentageScaling(newValue) {
4582
4764
  const errId = "ERR_percentageScaling";
4583
- const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
4584
- if (!isAuto && !withStyled.isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
4765
+ if (scaling.resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
4585
4766
  this.errors.addOrReplace({
4586
4767
  id: errId,
4587
4768
  type: "warning",
@@ -5216,24 +5397,50 @@ const Table$1 = class Table {
5216
5397
  return this.barColumns.split(",").map((col) => col.trim());
5217
5398
  }
5218
5399
  prepareUnitScaling() {
5219
- var _a;
5220
- if (this.pixelPerUnitGroupMap.has(this.unitScaling)) {
5221
- return this.pixelPerUnitGroupMap.get(this.unitScaling);
5400
+ const resolved = scaling.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
5401
+ if (resolved.kind === "value") {
5402
+ this.errors.remove("AUTO_unitScaling");
5403
+ this.autoUnitWarningActive = false;
5404
+ this.lastReportedUnitsPerEm = undefined;
5405
+ // Inner ibcs-table expects em per unit; the attribute is units per em.
5406
+ return 1 / resolved.value;
5222
5407
  }
5223
- if (((_a = this.unitScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
5408
+ if (resolved.kind === "auto") {
5409
+ this.errors.remove("AUTO_unitScaling");
5410
+ this.autoUnitWarningActive = false;
5411
+ this.lastReportedUnitsPerEm = undefined;
5224
5412
  return 0;
5225
5413
  }
5226
- return Number(this.unitScaling);
5414
+ this.autoUnitWarningActive = true;
5415
+ this.errors.addOrReplace({
5416
+ id: "AUTO_unitScaling",
5417
+ type: "warning",
5418
+ message: `unit-scaling: invalid value "${resolved.raw}" — auto-fitting to the bar column width.`,
5419
+ });
5420
+ return 0;
5227
5421
  }
5228
5422
  preparePercentageScaling() {
5229
- var _a;
5230
- if (this.pixelPerUnitGroupMap.has(this.percentageScaling)) {
5231
- return this.pixelPerUnitGroupMap.get(this.percentageScaling);
5423
+ const resolved = scaling.resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
5424
+ if (resolved.kind === "value") {
5425
+ this.errors.remove("AUTO_percentageScaling");
5426
+ this.autoPctWarningActive = false;
5427
+ this.lastReportedPpPerEm = undefined;
5428
+ // Inner ibcs-table expects em per percentage point.
5429
+ return 1 / resolved.value;
5232
5430
  }
5233
- if (((_a = this.percentageScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
5431
+ if (resolved.kind === "auto") {
5432
+ this.errors.remove("AUTO_percentageScaling");
5433
+ this.autoPctWarningActive = false;
5434
+ this.lastReportedPpPerEm = undefined;
5234
5435
  return 0;
5235
5436
  }
5236
- return Number(this.percentageScaling);
5437
+ this.autoPctWarningActive = true;
5438
+ this.errors.addOrReplace({
5439
+ id: "AUTO_percentageScaling",
5440
+ type: "warning",
5441
+ message: `percentage-scaling: invalid value "${resolved.raw}" — auto-fitting to the pin area.`,
5442
+ });
5443
+ return 0;
5237
5444
  }
5238
5445
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5239
5446
  getDataStructure() {
@@ -5296,7 +5503,7 @@ const Table$1 = class Table {
5296
5503
  render() {
5297
5504
  const fontStyles = this.getFontStyles();
5298
5505
  const effectiveFactor = this.getEffectiveScaleFactor();
5299
- return (index.h(index.Host, { key: '71fe0e81888c25970edcaab0803cbdbd3b73d1fd', style: fontStyles }, index.h("div", { key: '5afa87ac3a8b4d5864bb34acb8a4e84de12261ea' }, index.h("ibcs-table", { key: '8a276ca87e342f8c3b3aac76c9915681c4b2a005', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), categoryWidth: this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), i18nMode: this.prepareI18nMode(), measureScale: this.prepareMeasureScale(), measureType: this.prepareMeasureType(), measureUnit: this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), interval: this.prepareInterval(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
5506
+ return (index.h(index.Host, { key: 'de215fb339b9b38a57da35da8dce380641cd9d35', style: fontStyles }, index.h("div", { key: '6628fdc73598c2f9bf313184ae62703b6587c35f' }, index.h("ibcs-table", { key: 'f9a93bdfdfef7861604ba3a880ade5e2cafdd6dc', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), categoryWidth: this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), i18nMode: this.prepareI18nMode(), measureScale: this.prepareMeasureScale(), measureType: this.prepareMeasureType(), measureUnit: this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), interval: this.prepareInterval(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), reportAutoScaling: this.handleAutoScalingReport, scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
5300
5507
  }
5301
5508
  get element() { return index.getElement(this); }
5302
5509
  static get watchers() { return {
@@ -6115,6 +6322,10 @@ class DataAnalyzer {
6115
6322
  if (mode === "_") {
6116
6323
  return new LabelCollisionManager.SiPrefix();
6117
6324
  }
6325
+ // Accept the Unicode micro sign as an alias for the ASCII "my" key.
6326
+ if (mode === "μ") {
6327
+ mode = "my";
6328
+ }
6118
6329
  if (mode != null) {
6119
6330
  if ([...this.unitsLeast, ...this.unitsGreat].includes(mode)) {
6120
6331
  return this.lookupPrefix(mode);
@@ -6149,17 +6360,22 @@ class DataAnalyzer {
6149
6360
  }
6150
6361
  return this.determinePrefix(Math.abs(num));
6151
6362
  }
6152
- /** Maps an absolute numeric value to the best-fitting SI prefix based on digit count. */
6363
+ /**
6364
+ * Maps an absolute numeric value to the best-fitting SI prefix based on
6365
+ * its decimal magnitude. Values in (0.001, 1000) keep the identity prefix.
6366
+ * Magnitudes beyond the covered SI range clamp to the outermost prefix.
6367
+ */
6153
6368
  static determinePrefix(num) {
6369
+ if (!Number.isFinite(num) || num <= 0) {
6370
+ return new LabelCollisionManager.SiPrefix();
6371
+ }
6154
6372
  if (num >= 1000) {
6155
- const floor = Math.floor(Math.floor(Math.abs(num)).toString().length / 3);
6156
- const value = +Math.pow(1000, floor);
6157
- return new LabelCollisionManager.SiPrefix(this.unitsGreat[floor - 1], value);
6373
+ const idx = Math.min(Math.floor(Math.log10(num) / 3), this.unitsGreat.length) - 1;
6374
+ return new LabelCollisionManager.SiPrefix(this.unitsGreat[idx], Math.pow(1000, idx + 1));
6158
6375
  }
6159
6376
  if (num <= 0.001) {
6160
- const floor = Math.floor(Math.abs(num).toString().length / 3);
6161
- const value = +(1 / Math.pow(1000, floor));
6162
- return new LabelCollisionManager.SiPrefix(this.unitsLeast[floor - 1], value);
6377
+ const idx = Math.min(-Math.floor(Math.log10(num) / 3), this.unitsLeast.length) - 1;
6378
+ return new LabelCollisionManager.SiPrefix(this.unitsLeast[idx], Math.pow(1000, -(idx + 1)));
6163
6379
  }
6164
6380
  return new LabelCollisionManager.SiPrefix();
6165
6381
  }
@@ -6171,7 +6387,7 @@ class DataAnalyzer {
6171
6387
  /** SI prefixes for large numbers, ordered by magnitude (k=10^3 .. Y=10^24). */
6172
6388
  DataAnalyzer.unitsGreat = ["k", "M", "G", "T", "P", "E", "Z", "Y"];
6173
6389
  /** SI prefixes for small numbers, ordered by magnitude (m=10^-3 .. y=10^-24). */
6174
- DataAnalyzer.unitsLeast = ["m", "my", "n", "p", "P", "f", "a", "z", "y"];
6390
+ DataAnalyzer.unitsLeast = ["m", "my", "n", "p", "f", "a", "z", "y"];
6175
6391
 
6176
6392
  class StringAdapter {
6177
6393
  adapt(data) {
@@ -8855,6 +9071,13 @@ const IbcsChartStructure = class {
8855
9071
  if (!autoUnit && !autoPercent) {
8856
9072
  return; // Both explicit — nothing to auto-fit
8857
9073
  }
9074
+ const reportResolved = () => {
9075
+ var _a;
9076
+ (_a = this.reportAutoScaling) === null || _a === void 0 ? void 0 : _a.call(this, {
9077
+ unit: autoUnit ? config.pixelPerUnit : undefined,
9078
+ percentage: autoPercent ? config.pixelPerPercentage : undefined,
9079
+ });
9080
+ };
8858
9081
  const targetWidth = (_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width;
8859
9082
  const db = this.getDb();
8860
9083
  if (!targetWidth || targetWidth <= 0) {
@@ -8864,6 +9087,7 @@ const IbcsChartStructure = class {
8864
9087
  config.pixelPerPercentage = 50;
8865
9088
  this.chart = new StructureChart(new SVGStyle.IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
8866
9089
  this.chart.setI18n(this.i18n);
9090
+ reportResolved();
8867
9091
  return;
8868
9092
  }
8869
9093
  // First pass: set auto values to 1 and measure total width + bar extent
@@ -8876,6 +9100,7 @@ const IbcsChartStructure = class {
8876
9100
  this.chart.toString();
8877
9101
  const svgWidth = this.chart.getAllocatedCanvasWidth();
8878
9102
  if (svgWidth <= 0) {
9103
+ reportResolved();
8879
9104
  return;
8880
9105
  }
8881
9106
  // Separate fixed parts (labels, padding, spacing) from variable part (bar extent).
@@ -8898,6 +9123,7 @@ const IbcsChartStructure = class {
8898
9123
  // Second pass with the corrected scaling
8899
9124
  this.chart = new StructureChart(new SVGStyle.IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
8900
9125
  this.chart.setI18n(this.i18n);
9126
+ reportResolved();
8901
9127
  }
8902
9128
  async componentWillRender() {
8903
9129
  // return await (async () => {
@@ -12721,6 +12947,13 @@ const IbcsChartTime = class {
12721
12947
  if (!autoUnit && !autoPercent) {
12722
12948
  return; // Both explicit — nothing to auto-fit
12723
12949
  }
12950
+ const reportResolved = () => {
12951
+ var _a;
12952
+ (_a = this.reportAutoScaling) === null || _a === void 0 ? void 0 : _a.call(this, {
12953
+ unit: autoUnit ? config.pixelPerUnit : undefined,
12954
+ percentage: autoPercent ? config.pixelPerPercentage : undefined,
12955
+ });
12956
+ };
12724
12957
  const targetHeight = (_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height;
12725
12958
  const availableWidth = this.containerWidth || 0;
12726
12959
  if (!targetHeight || targetHeight <= 0) {
@@ -12730,6 +12963,7 @@ const IbcsChartTime = class {
12730
12963
  config.pixelPerPercentage = 50;
12731
12964
  this.chart = new TimeChart(new SVGStyle.IBCSRuleSet(this.ruleSetConfig), this.getDb(), this.tableName, config, styles, availableWidth);
12732
12965
  this.chart.setI18n(this.i18n);
12966
+ reportResolved();
12733
12967
  return;
12734
12968
  }
12735
12969
  // First pass: set auto values to 1 and measure SVG height
@@ -12742,6 +12976,7 @@ const IbcsChartTime = class {
12742
12976
  this.chart.toString();
12743
12977
  const svgHeight = this.chart.getAllocatedCanvasHeight();
12744
12978
  if (svgHeight <= 0) {
12979
+ reportResolved();
12745
12980
  return;
12746
12981
  }
12747
12982
  // Scale so the chart fits in ~90% of the available height
@@ -12753,6 +12988,7 @@ const IbcsChartTime = class {
12753
12988
  // Second pass with the corrected scaling
12754
12989
  this.chart = new TimeChart(new SVGStyle.IBCSRuleSet(this.ruleSetConfig), this.getDb(), this.tableName, config, styles, availableWidth);
12755
12990
  this.chart.setI18n(this.i18n);
12991
+ reportResolved();
12756
12992
  }
12757
12993
  async componentWillRender() {
12758
12994
  // return await (async () => {
@@ -12983,8 +13219,8 @@ const DEFAULT_STYLES = {
12983
13219
  fontColor: "#000000",
12984
13220
  fontSize: 11,
12985
13221
  fontFamily: "'Noto Sans', sans-serif",
12986
- unitScaling: 0.01, // Default: 1000 units = 10 pixels
12987
- percentageScaling: 0.5, // Default: 100% = 50 pixels
13222
+ unitScaling: 0.01, // Default: 100 units per em of bar
13223
+ percentageScaling: 0.5, // Default: 2 percentage points per em of pin
12988
13224
  scaleFactor: 1,
12989
13225
  };
12990
13226
  const AXIS_COLOR = "#666666";
@@ -15597,6 +15833,17 @@ const IbcsTable = class {
15597
15833
  * Scenario styles (ac, pp, fc, pl) use barStyles for IBCS-compliant grayscale coloring.
15598
15834
  */
15599
15835
  prepareBarChartStyles() {
15836
+ var _a;
15837
+ const autoUnit = !(this.unitScaling > 0);
15838
+ const autoPercent = !(this.percentageScaling > 0);
15839
+ const resolvedUnit = autoUnit ? this.autoUnitScaling() : this.unitScaling;
15840
+ const resolvedPercent = autoPercent ? this.autoPercentageScaling() : this.percentageScaling;
15841
+ if (autoUnit || autoPercent) {
15842
+ (_a = this.reportAutoScaling) === null || _a === void 0 ? void 0 : _a.call(this, {
15843
+ unit: autoUnit ? resolvedUnit : undefined,
15844
+ percentage: autoPercent ? resolvedPercent : undefined,
15845
+ });
15846
+ }
15600
15847
  return this.componentStyle(($) => {
15601
15848
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
15602
15849
  const varianceStyles = (_a = $["bn-chart-time"]) === null || _a === void 0 ? void 0 : _a["varianceStyles"];
@@ -15653,8 +15900,8 @@ const IbcsTable = class {
15653
15900
  fontColor: ((_z = $["global"]) === null || _z === void 0 ? void 0 : _z["fontColor"]) || "#000000",
15654
15901
  fontSize: (((_0 = $["global"]) === null || _0 === void 0 ? void 0 : _0["fontSizePx"]) || 13.3333) * 0.85 * this.scaleFactor,
15655
15902
  fontFamily: ((_1 = $["global"]) === null || _1 === void 0 ? void 0 : _1["fontFamily"]) || "'Noto Sans', sans-serif",
15656
- unitScaling: this.unitScaling > 0 ? this.unitScaling : this.autoUnitScaling(),
15657
- percentageScaling: this.percentageScaling > 0 ? this.percentageScaling : this.autoPercentageScaling(),
15903
+ unitScaling: resolvedUnit,
15904
+ percentageScaling: resolvedPercent,
15658
15905
  scaleFactor: this.scaleFactor,
15659
15906
  };
15660
15907
  });