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

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 (164) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-28d5c266.entry.js → p-0a49cf00.entry.js} +1 -1
  3. package/dist/bn-template-engine/{p-b9e94127.entry.js → p-22b8d044.entry.js} +1 -1
  4. package/dist/bn-template-engine/{p-6c7f0076.entry.js → p-251bb53d.entry.js} +1 -1
  5. package/dist/bn-template-engine/p-2aed639e.entry.js +1 -0
  6. package/dist/bn-template-engine/{p-7e9dbc93.entry.js → p-4616b879.entry.js} +1 -1
  7. package/dist/bn-template-engine/{p-99477a27.entry.js → p-629edcca.entry.js} +1 -1
  8. package/dist/bn-template-engine/p-686d8e44.entry.js +1 -0
  9. package/dist/bn-template-engine/{p-a4ea9a79.entry.js → p-68aa61cc.entry.js} +1 -1
  10. package/dist/bn-template-engine/{p-DwYUTvvI.js → p-B5x8M8OC.js} +1 -1
  11. package/dist/bn-template-engine/{p-fFtEvsY-.js → p-BGrnfif3.js} +1 -1
  12. package/dist/bn-template-engine/{p-6lOdN-fB.js → p-BVfLus3u.js} +1 -1
  13. package/dist/bn-template-engine/{p-CJThzFZm.js → p-BcZ5GQZ8.js} +1 -1
  14. package/dist/bn-template-engine/{p-CYE0I1Mx.js → p-Bca5V28_.js} +1 -1
  15. package/dist/bn-template-engine/p-C5UYpZUU.js +2 -0
  16. package/dist/bn-template-engine/{p-BgIpdpfH.js → p-C7T4DAAW.js} +1 -1
  17. package/dist/bn-template-engine/p-CDo04UEU.js +1 -0
  18. package/dist/bn-template-engine/p-CTrNbSXN.js +1 -0
  19. package/dist/bn-template-engine/{p-C5uvAEKI.js → p-CbciPY-M.js} +1 -1
  20. package/dist/bn-template-engine/{p-BpWWgN6k.js → p-CuR4S456.js} +1 -1
  21. package/dist/bn-template-engine/p-DWtTjg0f.js +1 -0
  22. package/dist/bn-template-engine/{p-eEfqksk-.js → p-DdqXNsKP.js} +1 -1
  23. package/dist/bn-template-engine/{p-B4JfKvVT.js → p-DtLI_CzV.js} +1 -1
  24. package/dist/bn-template-engine/p-UtNHLX1j.js +1 -0
  25. package/dist/bn-template-engine/{p-ba912130.entry.js → p-aecb5de3.entry.js} +1 -1
  26. package/dist/bn-template-engine/{p-687032d5.entry.js → p-ba43d46e.entry.js} +1 -1
  27. package/dist/bn-template-engine/{p-6077155f.entry.js → p-c476e7bb.entry.js} +1 -1
  28. package/dist/bn-template-engine/{p-2d3ea756.entry.js → p-d7c670ec.entry.js} +1 -1
  29. package/dist/bn-template-engine/{p-a1380d7c.entry.js → p-e4a584a8.entry.js} +1 -1
  30. package/dist/bn-template-engine/{p-de29986f.entry.js → p-f12fb09b.entry.js} +1 -1
  31. package/dist/bn-template-engine/p-f9a721bb.entry.js +1 -0
  32. package/dist/cjs/{AxisConfig-D7CAyPLO.js → AxisConfig-DmP4U3JM.js} +1 -1
  33. package/dist/cjs/{LabelCollisionManager-DkdQ9Xdg.js → LabelCollisionManager-Cet3WPm0.js} +2 -2
  34. package/dist/cjs/{Order-IPfAP0q8.js → Order-DlKLywO_.js} +1 -1
  35. package/dist/cjs/{SVGStyle-BD8jApd4.js → SVGStyle-D78RaNnj.js} +2 -2
  36. package/dist/cjs/{SVGVariancesStyleGroup-BaWzR951.js → SVGVariancesStyleGroup-XvNAnYYA.js} +1 -1
  37. package/dist/cjs/{VarianceMeasure-BBWTgv2e.js → VarianceMeasure-BfZLlICl.js} +4 -4
  38. package/dist/cjs/{XYChartDataRow-BoR0CTfl.js → XYChartDataRow-B0NNOqxB.js} +4 -4
  39. package/dist/cjs/bn-asset_21.cjs.entry.js +1052 -314
  40. package/dist/cjs/bn-chart-bubble.cjs.entry.js +25 -15
  41. package/dist/cjs/bn-chart-bullet.cjs.entry.js +9 -9
  42. package/dist/cjs/bn-chart-scatter.cjs.entry.js +9 -9
  43. package/dist/cjs/bn-grid.cjs.entry.js +6 -6
  44. package/dist/cjs/bn-image.cjs.entry.js +6 -6
  45. package/dist/cjs/bn-internationalization.cjs.entry.js +4 -4
  46. package/dist/cjs/bn-ruleset.cjs.entry.js +4 -4
  47. package/dist/cjs/bn-template-engine.cjs.js +3 -3
  48. package/dist/cjs/bn-template.cjs.entry.js +2 -2
  49. package/dist/cjs/bn-text.cjs.entry.js +7 -7
  50. package/dist/cjs/bn-tree.cjs.entry.js +6 -6
  51. package/dist/cjs/{context-protocol-BBhT9B52.js → context-protocol-DeLmu5s2.js} +1 -1
  52. package/dist/cjs/editor-companion.cjs.entry.js +2 -2
  53. package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +6 -6
  54. package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +6 -6
  55. package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +6 -6
  56. package/dist/cjs/{index-CDKG4xmO.js → index-C1Z9vO7z.js} +61 -19
  57. package/dist/cjs/{layoutObserver-DUYYkDMQ.js → layoutObserver-CrzQQGpv.js} +5 -5
  58. package/dist/cjs/loader.cjs.js +2 -2
  59. package/dist/cjs/{scaling-BIJQ2NV1.js → scaling-JAU6IJnR.js} +85 -3
  60. package/dist/cjs/{withBodyObserver-BKUE_ypL.js → withBodyObserver-DJO98AJ-.js} +2 -2
  61. package/dist/cjs/{withHasError-Cl2gTQzA.js → withHasError-BdDmiOXM.js} +1 -1
  62. package/dist/cjs/{withScalingGroup-D5clRvRe.js → withScalingGroup-Bu5gatHT.js} +3 -3
  63. package/dist/cjs/{withStyled-Cm9dWQhu.js → withStyled-50UepUwV.js} +8 -8
  64. package/dist/collection/collection-manifest.json +1 -1
  65. package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +15 -5
  66. package/dist/collection/components/bn-chart-structure/bn-chart-structure.css +6 -0
  67. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +149 -57
  68. package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +135 -28
  69. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +30 -19
  70. package/dist/collection/components/bn-chart-time/bn-chart-time.js +186 -49
  71. package/dist/collection/components/bn-chart-time/ibcs-chart-time.css +9 -3
  72. package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +141 -22
  73. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +36 -0
  74. package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +76 -19
  75. package/dist/collection/components/bn-table/bn-table.js +121 -49
  76. package/dist/collection/components/bn-table/ibcs-table.js +83 -42
  77. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +20 -34
  78. package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +4 -5
  79. package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +89 -0
  80. package/dist/collection/utils/autoFit.js +63 -0
  81. package/dist/collection/utils/constants.js +3 -3
  82. package/dist/collection/utils/dataAnalyzer.js +17 -8
  83. package/dist/collection/utils/scaling.js +79 -0
  84. package/dist/collection/utils/validate.js +3 -3
  85. package/dist/components/DataFormatDigits.js +1 -1
  86. package/dist/components/autoFit.js +1 -0
  87. package/dist/components/bn-chart-bubble.js +1 -1
  88. package/dist/components/bn-chart-bullet.js +1 -1
  89. package/dist/components/bn-chart-scatter.js +1 -1
  90. package/dist/components/bn-chart-structure.js +1 -1
  91. package/dist/components/bn-chart-time.js +1 -1
  92. package/dist/components/bn-grid.js +1 -1
  93. package/dist/components/bn-scaling-group.js +1 -1
  94. package/dist/components/bn-table.js +1 -1
  95. package/dist/components/bn-text.js +1 -1
  96. package/dist/components/bn-tree.js +1 -1
  97. package/dist/components/ibcs-chart-structure2.js +1 -1
  98. package/dist/components/ibcs-chart-time2.js +1 -1
  99. package/dist/components/ibcs-table2.js +1 -1
  100. package/dist/components/scaling.js +1 -0
  101. package/dist/components/validate.js +1 -1
  102. package/dist/components/withDataset.js +1 -1
  103. package/dist/components/withStyled.js +1 -1
  104. package/dist/esm/{AxisConfig-ByIP5J-9.js → AxisConfig-Cjy_RANi.js} +1 -1
  105. package/dist/esm/{LabelCollisionManager-DaNiDiM9.js → LabelCollisionManager-B_NUM9yq.js} +2 -2
  106. package/dist/esm/{Order-BQeJE_yi.js → Order-B-aF6Rwn.js} +1 -1
  107. package/dist/esm/{SVGStyle-BwBlY3Km.js → SVGStyle-8FfAtUF-.js} +2 -2
  108. package/dist/esm/{SVGVariancesStyleGroup-BpGW4CvN.js → SVGVariancesStyleGroup-DD4mIOjT.js} +1 -1
  109. package/dist/esm/{VarianceMeasure-CE3N8Bea.js → VarianceMeasure-DLOuIIJ7.js} +4 -4
  110. package/dist/esm/{XYChartDataRow-DeMI1JKU.js → XYChartDataRow-CKfILBFG.js} +4 -4
  111. package/dist/esm/bn-asset_21.entry.js +1052 -314
  112. package/dist/esm/bn-chart-bubble.entry.js +25 -15
  113. package/dist/esm/bn-chart-bullet.entry.js +9 -9
  114. package/dist/esm/bn-chart-scatter.entry.js +9 -9
  115. package/dist/esm/bn-grid.entry.js +6 -6
  116. package/dist/esm/bn-image.entry.js +6 -6
  117. package/dist/esm/bn-internationalization.entry.js +4 -4
  118. package/dist/esm/bn-ruleset.entry.js +4 -4
  119. package/dist/esm/bn-template-engine.js +4 -4
  120. package/dist/esm/bn-template.entry.js +2 -2
  121. package/dist/esm/bn-text.entry.js +7 -7
  122. package/dist/esm/bn-tree.entry.js +6 -6
  123. package/dist/esm/{context-protocol-d8MHrEo8.js → context-protocol-BoEL0caI.js} +1 -1
  124. package/dist/esm/editor-companion.entry.js +2 -2
  125. package/dist/esm/ibcs-chart-bubble.entry.js +6 -6
  126. package/dist/esm/ibcs-chart-bullet.entry.js +6 -6
  127. package/dist/esm/ibcs-chart-scatter.entry.js +6 -6
  128. package/dist/esm/{index-B_d-jp99.js → index-C5UYpZUU.js} +61 -19
  129. package/dist/esm/{layoutObserver-BJBEyhNf.js → layoutObserver-cgIXg2sg.js} +5 -5
  130. package/dist/esm/loader.js +3 -3
  131. package/dist/esm/{scaling-BGnpSN1j.js → scaling-CxyNpMQM.js} +83 -4
  132. package/dist/esm/{withBodyObserver-IokS6fHD.js → withBodyObserver-Cb9ZC5_J.js} +2 -2
  133. package/dist/esm/{withHasError-DW_vMDUp.js → withHasError-Bh1Viz52.js} +1 -1
  134. package/dist/esm/{withScalingGroup-CC3UcvC5.js → withScalingGroup-Yv9nGGe1.js} +3 -3
  135. package/dist/esm/{withStyled-2l5Tx3cf.js → withStyled-By9Jd-Oy.js} +8 -8
  136. package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +5 -2
  137. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +47 -19
  138. package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +17 -3
  139. package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +11 -3
  140. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +52 -18
  141. package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +18 -3
  142. package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +12 -0
  143. package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +28 -8
  144. package/dist/types/components/bn-table/bn-table.d.ts +45 -19
  145. package/dist/types/components/bn-table/ibcs-table.d.ts +23 -6
  146. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +9 -1
  147. package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +51 -0
  148. package/dist/types/components.d.ts +91 -55
  149. package/dist/types/stencil-public-runtime.d.ts +1 -0
  150. package/dist/types/utils/autoFit.d.ts +79 -0
  151. package/dist/types/utils/constants.d.ts +3 -3
  152. package/dist/types/utils/dataAnalyzer.d.ts +5 -1
  153. package/dist/types/utils/scaling.d.ts +63 -0
  154. package/dist/types/utils/validate.d.ts +2 -2
  155. package/package.json +1 -1
  156. package/readme.md +2 -0
  157. package/dist/bn-template-engine/p-2fba7c99.entry.js +0 -1
  158. package/dist/bn-template-engine/p-A8xyE4b1.js +0 -1
  159. package/dist/bn-template-engine/p-B_d-jp99.js +0 -2
  160. package/dist/bn-template-engine/p-BjBz5cSL.js +0 -1
  161. package/dist/bn-template-engine/p-C8Q0lsaU.js +0 -1
  162. package/dist/bn-template-engine/p-C9i1Xsib.js +0 -1
  163. package/dist/bn-template-engine/p-a8291de2.entry.js +0 -1
  164. package/dist/bn-template-engine/p-b5274369.entry.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { forceUpdate, h, Host, writeTask } from "@stencil/core";
2
- import { isBlankInput, isValidBoolean, isValidDirection, isValidInteger, isValidLevel, isValidMeasureScale, isValidNumber, validateOrderList, validateScenarioList, validateStackConfig, validateVariancesList, } from "../../utils/validate";
2
+ import { isBlankInput, isValidBoolean, isValidDirection, isValidInteger, isValidLevel, isValidMeasureScale, validateOrderList, validateScenarioList, validateStackConfig, validateVariancesList, } from "../../utils/validate";
3
3
  import withDataset from "../../utils/withDataset";
4
4
  import withComponentStatus from "../../utils/withComponentStatus";
5
5
  import withTranslation from "../../utils/withTranslation";
@@ -11,7 +11,7 @@ import withRuleSet from "../../utils/withRuleSet";
11
11
  import withHasError from "../../utils/withHasError";
12
12
  import withInheritedProps, { isInheritedValue } from "../../utils/withInheritedProps";
13
13
  import { getParentDimensions } from "../../utils/parentDimensions";
14
- import { parseScaling } from "../../utils/scaling";
14
+ import { formatScalingValue, parseScaling, resolveScalingValue } from "../../utils/scaling";
15
15
  import { observeParentResize } from "../../utils/layoutObserver";
16
16
  import { AggregationLevel, StackBy, StackMode, StackOrder } from "../../utils/constants";
17
17
  import { OrderColumn, OrderDirection } from "../../utils/model/Order";
@@ -64,8 +64,7 @@ export class Chart {
64
64
  }
65
65
  validateUnitScaling(newValue) {
66
66
  const errId = "ERR_unitScaling";
67
- const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
68
- if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
67
+ if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
69
68
  this.errors.addOrReplace({
70
69
  id: errId,
71
70
  type: "warning",
@@ -78,8 +77,7 @@ export class Chart {
78
77
  }
79
78
  validatePercentageScaling(newValue) {
80
79
  const errId = "ERR_percentageScaling";
81
- const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
82
- if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
80
+ if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
83
81
  this.errors.addOrReplace({
84
82
  id: errId,
85
83
  type: "warning",
@@ -326,6 +324,41 @@ export class Chart {
326
324
  this.stack = "";
327
325
  this.pixelPerUnitGroupMap = new Map();
328
326
  this._autoScaleGuard = false;
327
+ this.autoUnitWarningActive = false;
328
+ this.autoPctWarningActive = false;
329
+ /**
330
+ * Receives the auto-fitted values from the inner ibcs-chart-structure (px
331
+ * per unit / px per 1.0 fraction) and surfaces them in the AUTO_* warnings,
332
+ * converted back to the attribute's units-per-em form so users can copy
333
+ * them into a bn-scaling-group.
334
+ */
335
+ this.handleAutoScalingReport = (report) => {
336
+ var _a, _b;
337
+ const changed = (next, last) => last === undefined || Math.abs(next - last) > Math.abs(next) * 1e-3;
338
+ const effFontPx = this.getEffectiveFontPx();
339
+ if (report.unit !== undefined && report.unit > 0 && this.autoUnitWarningActive) {
340
+ const unitsPerEm = effFontPx / report.unit;
341
+ if (changed(unitsPerEm, this.lastReportedUnitsPerEm)) {
342
+ this.lastReportedUnitsPerEm = unitsPerEm;
343
+ this.errors.addOrReplace({
344
+ id: "AUTO_unitScaling",
345
+ type: "warning",
346
+ message: `unit-scaling: ${Chart.describeScalingInput(String((_a = this.unitScaling) !== null && _a !== void 0 ? _a : "").trim())}, auto-fitted to 1 em ≈ ${formatScalingValue(unitsPerEm)} units.`,
347
+ });
348
+ }
349
+ }
350
+ if (report.percentage !== undefined && report.percentage > 0 && this.autoPctWarningActive) {
351
+ const ppPerEm = (100 * effFontPx) / report.percentage;
352
+ if (changed(ppPerEm, this.lastReportedPpPerEm)) {
353
+ this.lastReportedPpPerEm = ppPerEm;
354
+ this.errors.addOrReplace({
355
+ id: "AUTO_percentageScaling",
356
+ type: "warning",
357
+ message: `percentage-scaling: ${Chart.describeScalingInput(String((_b = this.percentageScaling) !== null && _b !== void 0 ? _b : "").trim())}, auto-fitted to 1 em ≈ ${formatScalingValue(ppPerEm)} percentage points.`,
358
+ });
359
+ }
360
+ }
361
+ };
329
362
  withStyled(this);
330
363
  withComponentStatus(this);
331
364
  withDataset(this, (name, _data) => {
@@ -365,18 +398,18 @@ export class Chart {
365
398
  const { mode } = parseScaling(this.scale);
366
399
  if (mode !== "auto" && mode !== "empty") {
367
400
  this._autoScaleGuard = false;
368
- this.checkWidthOverflow();
401
+ this.checkOverflow();
369
402
  return;
370
403
  }
371
404
  if (this._autoScaleGuard) {
372
405
  this._autoScaleGuard = false;
373
- this.checkWidthOverflow();
406
+ this.checkOverflow();
374
407
  return;
375
408
  }
376
409
  const host = this.element;
377
410
  const { height: parentHeight } = getParentDimensions(host);
378
411
  if (parentHeight <= 0) {
379
- this.checkWidthOverflow();
412
+ this.checkOverflow();
380
413
  return;
381
414
  }
382
415
  // Record height so the ResizeObserver callback can tell
@@ -394,7 +427,7 @@ export class Chart {
394
427
  // Content fits. Don't reset to factor 1 — the content only fits
395
428
  // BECAUSE of the current factor. Resetting would cause oscillation.
396
429
  this.errors.remove("AUTO_scale");
397
- this.checkWidthOverflow();
430
+ this.checkOverflow();
398
431
  return;
399
432
  }
400
433
  // Content overflows. Compute a new factor based on the ratio of
@@ -404,7 +437,7 @@ export class Chart {
404
437
  // SVG charts have non-linear scaling so we use a wider tolerance
405
438
  // than tables to avoid oscillation from sub-pixel rounding.
406
439
  if (Math.abs(computedFactor - currentFactor) < 0.01) {
407
- this.checkWidthOverflow();
440
+ this.checkOverflow();
408
441
  return;
409
442
  }
410
443
  host.style.setProperty("--bn-font-size", `${baseFontSize * computedFactor}px`);
@@ -422,7 +455,10 @@ export class Chart {
422
455
  writeTask(() => {
423
456
  this.appliedScaleFactor = computedFactor;
424
457
  });
425
- this.checkWidthOverflow();
458
+ // Check with the current (pre-factor) content so overflow is reported
459
+ // even if the scheduled re-render stalls; the follow-up render re-checks
460
+ // in the guard branch and clears any transiently reported overflow.
461
+ this.checkOverflow();
426
462
  }
427
463
  componentDidLoad() {
428
464
  // Observe the parent container for size changes so auto-scaling
@@ -460,30 +496,74 @@ export class Chart {
460
496
  this.layoutObserver = null;
461
497
  }
462
498
  /**
463
- * Emits an error when a custom unit-scaling value causes the chart to exceed its container width.
464
- * Skipped for auto/unset unit-scaling since auto-fit handles width.
499
+ * Content width from the rendered SVG width attributes (segments render
500
+ * side by side) — immune to the inner hosts' overflow:hidden clipping:
501
+ * flex items with hidden overflow shrink below their content size, so the
502
+ * host's scrollWidth cannot see the overflow. Falls back to scrollWidth
503
+ * before the inner charts have rendered.
465
504
  */
466
- checkWidthOverflow() {
505
+ measureContentWidth() {
467
506
  var _a;
507
+ const inners = (_a = this.element.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("ibcs-chart-structure");
508
+ let total = 0;
509
+ let found = false;
510
+ inners === null || inners === void 0 ? void 0 : inners.forEach((inner) => {
511
+ var _a, _b, _c;
512
+ const width = parseFloat((_c = (_b = (_a = inner.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("svg#drawCanvas")) === null || _b === void 0 ? void 0 : _b.getAttribute("width")) !== null && _c !== void 0 ? _c : "");
513
+ if (!Number.isNaN(width)) {
514
+ total += width;
515
+ found = true;
516
+ }
517
+ });
518
+ // scrollWidth additionally sees non-SVG chrome, but is blind to clipped
519
+ // segments (see above) — take the larger of the two measurements.
520
+ // Floor the fractional SVG widths so borderline sub-pixel overhangs are
521
+ // judged with the same integer tolerance as the scroll metrics.
522
+ return found ? Math.max(Math.floor(total), this.element.scrollWidth) : this.element.scrollWidth;
523
+ }
524
+ /**
525
+ * Reports a WARN_overflow item when the rendered chart exceeds its
526
+ * container. Overflow attributable to a fixed scaling attribute is an
527
+ * error (width: unit-scaling / percentage-scaling, height: scale);
528
+ * overflow in fully-auto mode is a warning — auto-fit prevents it by
529
+ * construction, so it only fires when the content cannot fit at any scale.
530
+ */
531
+ checkOverflow() {
468
532
  const errId = "WARN_overflow";
469
- const us = String((_a = this.unitScaling) !== null && _a !== void 0 ? _a : "")
470
- .trim()
471
- .toLowerCase();
472
- if (us === "" || us === "auto") {
473
- this.errors.remove(errId);
474
- return;
475
- }
476
533
  const parent = getParentDimensions(this.element);
477
- if (parent.width > 0 && this.element.scrollWidth > parent.width + 1) {
478
- this.errors.addOrReplace({
479
- id: errId,
480
- type: "error",
481
- message: `Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(parent.width)}px). Reduce unit-scaling or set to "auto".`,
482
- });
483
- }
484
- else {
534
+ const contentWidth = this.measureContentWidth();
535
+ const contentHeight = this.element.scrollHeight;
536
+ const widthOver = parent.width > 0 && contentWidth > parent.width + 1;
537
+ const heightOver = parent.height > 0 && contentHeight > parent.height + 1;
538
+ if (!widthOver && !heightOver) {
485
539
  this.errors.remove(errId);
540
+ return;
486
541
  }
542
+ const hasRelativeVariance = this.prepareVariances().some((variance) => variance.startsWith("dr"));
543
+ const fixedUnit = resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap).kind === "value";
544
+ const fixedPercent = hasRelativeVariance && resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap).kind === "value";
545
+ const { mode } = parseScaling(this.scale);
546
+ const fixedScale = mode !== "auto" && mode !== "empty";
547
+ const fixedAttrs = [];
548
+ if (widthOver && fixedUnit)
549
+ fixedAttrs.push("unit-scaling");
550
+ if (widthOver && fixedPercent)
551
+ fixedAttrs.push("percentage-scaling");
552
+ if (heightOver && fixedScale)
553
+ fixedAttrs.push("scale");
554
+ const dims = [];
555
+ if (widthOver)
556
+ dims.push(`width (${Math.round(contentWidth)}px > ${Math.round(parent.width)}px)`);
557
+ if (heightOver)
558
+ dims.push(`height (${Math.round(contentHeight)}px > ${Math.round(parent.height)}px)`);
559
+ this.errors.addOrReplace({
560
+ id: errId,
561
+ type: fixedAttrs.length > 0 ? "error" : "warning",
562
+ message: `Chart exceeds available ${dims.join(" and ")}. ` +
563
+ (fixedAttrs.length > 0
564
+ ? `Adjust ${fixedAttrs.join(" / ")} or set to "auto".`
565
+ : "Content does not fit even at minimum auto scaling; enlarge the container."),
566
+ });
487
567
  }
488
568
  prepareDimension() {
489
569
  const parent = getParentDimensions(this.element);
@@ -540,48 +620,56 @@ export class Chart {
540
620
  const i18nMapGlobal = new Map(i18nMetaLabelsGlobal.map((key) => [key, this.t("global.".concat(key))]));
541
621
  return new Map([...i18nMapGlobal.entries(), ...i18nMapLocal.entries()]);
542
622
  }
623
+ /** "not set" for blank input, `invalid value "x"` otherwise — for AUTO_* messages. */
624
+ static describeScalingInput(raw) {
625
+ return raw === "" ? "not set" : `invalid value "${raw}"`;
626
+ }
543
627
  preparePixelPerUnit() {
544
- var _a;
545
- if (this.pixelPerUnitGroupMap.has(this.unitScaling)) {
628
+ const resolved = resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
629
+ if (resolved.kind === "value") {
546
630
  this.errors.remove("AUTO_unitScaling");
547
- return this.pixelPerUnitGroupMap.get(this.unitScaling);
631
+ this.autoUnitWarningActive = false;
632
+ this.lastReportedUnitsPerEm = undefined;
633
+ // The attribute is data units per em; the inner chart expects px for one data unit.
634
+ return this.getEffectiveFontPx() / resolved.value;
548
635
  }
549
636
  // Explicit 'auto' → auto-calculate silently
550
- if (((_a = this.unitScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
637
+ if (resolved.kind === "auto") {
551
638
  this.errors.remove("AUTO_unitScaling");
639
+ this.autoUnitWarningActive = false;
640
+ this.lastReportedUnitsPerEm = undefined;
552
641
  return 0;
553
642
  }
554
- const numeric = Number(this.unitScaling);
555
- if (!isNaN(numeric) && numeric > 0) {
556
- this.errors.remove("AUTO_unitScaling");
557
- return numeric;
558
- }
559
643
  // Not set / invalid → auto-calculate with warning
644
+ this.autoUnitWarningActive = true;
560
645
  this.errors.addOrReplace({
561
646
  id: "AUTO_unitScaling",
562
647
  type: "warning",
563
- message: `unit-scaling: not set, auto-calculated to fit available space.`,
648
+ message: `unit-scaling: ${Chart.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
564
649
  });
565
650
  return 0;
566
651
  }
567
652
  preparePixelPerPercentage() {
568
- var _a;
569
- if (this.pixelPerUnitGroupMap.has(this.percentageScaling)) {
570
- return this.pixelPerUnitGroupMap.get(this.percentageScaling);
571
- }
572
- if (((_a = this.percentageScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
653
+ const resolved = resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
654
+ if (resolved.kind === "value") {
573
655
  this.errors.remove("AUTO_percentageScaling");
574
- return 0;
656
+ this.autoPctWarningActive = false;
657
+ this.lastReportedPpPerEm = undefined;
658
+ // The attribute is percentage points per em; the inner chart expects
659
+ // px per 1.0 fraction (= per 100 percentage points).
660
+ return (100 * this.getEffectiveFontPx()) / resolved.value;
575
661
  }
576
- const numeric = Number(this.percentageScaling);
577
- if (!isNaN(numeric) && numeric > 0) {
662
+ if (resolved.kind === "auto") {
578
663
  this.errors.remove("AUTO_percentageScaling");
579
- return numeric * 100;
664
+ this.autoPctWarningActive = false;
665
+ this.lastReportedPpPerEm = undefined;
666
+ return 0;
580
667
  }
668
+ this.autoPctWarningActive = true;
581
669
  this.errors.addOrReplace({
582
670
  id: "AUTO_percentageScaling",
583
671
  type: "warning",
584
- message: `percentage-scaling: not set, auto-calculated to fit available space.`,
672
+ message: `percentage-scaling: ${Chart.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
585
673
  });
586
674
  return 0;
587
675
  }
@@ -790,14 +878,13 @@ export class Chart {
790
878
  return this.measureUnit;
791
879
  }
792
880
  chartTemplate(localScenarioString, idx) {
793
- const effectiveFactor = this.getEffectiveScaleFactor();
794
881
  const ppu = this.preparePixelPerUnit();
795
882
  const ppp = this.preparePixelPerPercentage();
796
883
  const stackConfig = this.prepareStackConfig();
797
884
  const scenarios = this.prepareScenarios();
798
885
  // Dimension stacking uses only the first scenario
799
886
  const effectiveScenarios = (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
800
- return (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() }));
887
+ return (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() }));
801
888
  }
802
889
  getEffectiveScaleFactor() {
803
890
  const { mode, factor } = parseScaling(this.scale);
@@ -807,6 +894,11 @@ export class Chart {
807
894
  return this.appliedScaleFactor;
808
895
  return 1;
809
896
  }
897
+ /** Effective font size in px: base font from the style store × effective scale factor. */
898
+ getEffectiveFontPx() {
899
+ const baseFontSize = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; });
900
+ return baseFontSize * this.getEffectiveScaleFactor();
901
+ }
810
902
  getFontStyles() {
811
903
  const effectiveFactor = this.getEffectiveScaleFactor();
812
904
  return this.componentStyle(($) => {
@@ -827,7 +919,7 @@ export class Chart {
827
919
  scenariosArray = [...scenariosArray, ...variancesArray];
828
920
  }
829
921
  const fontStyles = this.getFontStyles();
830
- return (h(Host, { key: '472aabc33cfbf293c44cd93537e91c42cdc9e0d7', style: fontStyles }, h("div", { key: 'd48365a9ef3a48df6cd42807f7375414dd6714ef', class: "container" }, scenariosArray.map(this.chartTemplate))));
922
+ return (h(Host, { key: '68eb9fbcc6fb712dd06729f13a33c61c2c5c90e6', style: fontStyles }, h("div", { key: '9d7c49c1d5e2940dd1a4381a90e08912fef77f33', class: "container" }, scenariosArray.map(this.chartTemplate))));
831
923
  }
832
924
  static get is() { return "bn-chart-structure"; }
833
925
  static get encapsulation() { return "shadow"; }
@@ -971,12 +1063,12 @@ export class Chart {
971
1063
  "text": "unit-scaling=\"auto\""
972
1064
  }, {
973
1065
  "name": "example",
974
- "text": "unit-scaling=\"0.05\""
1066
+ "text": "unit-scaling=\"1M\""
975
1067
  }, {
976
1068
  "name": "example",
977
1069
  "text": "unit-scaling=\"revenue-scale\""
978
1070
  }],
979
- "text": "Controls horizontal bar scaling (pixels per data unit).\n\n| Value | Behavior |\n|----------------|-----------------------------------------------------------------|\n| `\"auto\"` | Auto-fit bars to fill the available container width (no warning) |\n| not set / `\"\"` | Same as auto, but emits `AUTO_unitScaling` warning |\n| `\"0.03\"`, `1` | Explicit pixels-per-unit value; bars scale proportionally |\n| group name | References a `<bn-scaling-group>` for synchronized scaling |\n\nWhen using a custom value that causes the chart to exceed its container,\na `WARN_overflow` error is emitted."
1071
+ "text": "Data units displayed per 1 em of bar length (horizontal bars) \u2014 map-scale\nsemantics: a larger value means smaller bars.\n\n| Value | Behavior |\n|--------------------|-------------------------------------------------------------|\n| `\"auto\"` | Auto-fit bars to fill the available container width |\n| not set / invalid | Same as auto, but emits `AUTO_unitScaling` warning |\n| `\"250000\"`, `\"1M\"` | Units per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |\n| group name | References a `<bn-scaling-group>` for synchronized scaling |\n\nWhen using a custom value that causes the chart to exceed its container,\na `WARN_overflow` error is emitted."
980
1072
  },
981
1073
  "getter": false,
982
1074
  "setter": false,
@@ -996,12 +1088,12 @@ export class Chart {
996
1088
  "docs": {
997
1089
  "tags": [{
998
1090
  "name": "example",
999
- "text": "percentage-scaling=\"50\""
1091
+ "text": "percentage-scaling=\"10\""
1000
1092
  }, {
1001
1093
  "name": "example",
1002
1094
  "text": "percentage-scaling=\"pct-scale\""
1003
1095
  }],
1004
- "text": "Controls scaling of relative variance bars (pixels per percentage point).\n\n| Value | Behavior |\n|----------------|---------------------------------------------------------------|\n| `\"auto\"` | Auto-fit to available width |\n| not set / `\"\"` | Same as auto with warning |\n| `\"50\"`, `1.5` | Explicit pixels-per-percentage-point value |\n| group name | References a `<bn-scaling-group>` for synchronized scaling |"
1096
+ "text": "Percentage points displayed per 1 em of bar length for relative\nvariances \u2014 a larger value means shorter bars.\n\n| Value | Behavior |\n|-------------------|---------------------------------------------------------------|\n| `\"auto\"` | Auto-fit to available width |\n| not set / invalid | Same as auto with `AUTO_percentageScaling` warning |\n| `\"10\"`, `\"2.5\"` | Percentage points per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |\n| group name | References a `<bn-scaling-group>` for synchronized scaling |"
1005
1097
  },
1006
1098
  "getter": false,
1007
1099
  "setter": false,
@@ -14,6 +14,7 @@ import { buildFromExpr } from "../../context/scopedDb";
14
14
  import { StructureChartStylesAdapter } from "./utils/model/styles/StructureChartStyle";
15
15
  import { OrderAdapter, OrderDirection } from "../../utils/model/Order";
16
16
  import { AggregationLevel } from "../../utils/constants";
17
+ import { MIN_PIXEL_SCALE, solveAutoFitStep } from "../../utils/autoFit";
17
18
  import { DataFormatDigitsAdapter } from "../../utils/model/DataFormatDigits";
18
19
  import { StringAdapter } from "../../utils/helper/StringAdapter";
19
20
  import { FontStyleAdapter } from "../../utils/model/styles/FontStyle";
@@ -74,8 +75,14 @@ export class IbcsChartStructure {
74
75
  const styles = this.prepareStyle();
75
76
  this.chart = new StructureChart(new IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
76
77
  this.chart.setI18n(this.i18n);
78
+ // The broken-bar overdrive exists to absorb MANUAL scaling overflow.
79
+ // autoFitScaling mutates config.pixelPerUnit to the solved value, so
80
+ // remember auto mode beforehand and skip the overdrive for it — the
81
+ // fitted chart fits by construction, and the overdrive's rough overhead
82
+ // estimate would falsely re-engage on it.
83
+ const unitWasAuto = config.pixelPerUnit <= 0;
77
84
  this.autoFitScaling(config, styles);
78
- this.chart.setAvailableWidth(((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
85
+ this.chart.setAvailableWidth(unitWasAuto ? 0 : ((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
79
86
  this.pattern = new CustomPattern(this.chart.styles);
80
87
  this.chart.setPattern("fc", this.pattern.getFCPolygonPattern());
81
88
  }
@@ -90,16 +97,24 @@ export class IbcsChartStructure {
90
97
  this.chart.setStyles(styles);
91
98
  this.chart.setRuleSet(new IBCSRuleSet(this.ruleSetConfig));
92
99
  this.chart.setConfig(config);
100
+ // See componentWillLoad: no broken-bar overdrive for auto-fitted scaling
101
+ const unitWasAuto = config.pixelPerUnit <= 0;
93
102
  this.autoFitScaling(config, styles);
94
- this.chart.setAvailableWidth(((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
103
+ this.chart.setAvailableWidth(unitWasAuto ? 0 : ((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
95
104
  this.pattern = new CustomPattern(this.chart.styles);
96
105
  this.chart.setPattern("fc", this.pattern.getFCPolygonPattern());
97
106
  }
98
107
  /**
99
- * Two-pass auto-fit for pixelPerUnit and/or pixelPerPercentage.
100
- * When either is 0 (auto mode), renders a measurement pass at 1,
101
- * computes the ratio to fit the available width, and rebuilds.
108
+ * Auto-fit for pixelPerUnit and/or pixelPerPercentage (0 = auto mode).
102
109
  * Structure charts grow horizontally, so we fit to width.
110
+ *
111
+ * The chart width is affine in the pixel scales (width = fixed labels +
112
+ * bar extent × scale), but label clamps flip between passes, so a single
113
+ * analytic solve is not enough: measure at 1, solve, then verify against
114
+ * fresh measurements and re-solve until the chart fits. The loop never
115
+ * ends on an overshoot — the last fitting values are restored, or when
116
+ * even the minimum scale cannot fit (labels alone exceed the container)
117
+ * the values are floored and the wrapper reports the overflow.
103
118
  * Explicit (> 0) values are never overridden.
104
119
  */
105
120
  autoFitScaling(config, styles) {
@@ -109,49 +124,117 @@ export class IbcsChartStructure {
109
124
  if (!autoUnit && !autoPercent) {
110
125
  return; // Both explicit — nothing to auto-fit
111
126
  }
127
+ const reportResolved = () => {
128
+ var _a;
129
+ (_a = this.reportAutoScaling) === null || _a === void 0 ? void 0 : _a.call(this, {
130
+ unit: autoUnit ? config.pixelPerUnit : undefined,
131
+ percentage: autoPercent ? config.pixelPerPercentage : undefined,
132
+ });
133
+ };
112
134
  const targetWidth = (_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width;
113
135
  const db = this.getDb();
136
+ const rebuild = () => {
137
+ this.chart = new StructureChart(new IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
138
+ this.chart.setI18n(this.i18n);
139
+ };
140
+ // toString() runs draw(), which finalizes positions — an undrawn chart
141
+ // reports a stale allocated width.
142
+ const measure = () => {
143
+ this.chart.toString();
144
+ return this.chart.getAllocatedCanvasWidth();
145
+ };
114
146
  if (!targetWidth || targetWidth <= 0) {
115
147
  if (autoUnit)
116
148
  config.pixelPerUnit = 1;
117
149
  if (autoPercent)
118
150
  config.pixelPerPercentage = 50;
119
- this.chart = new StructureChart(new IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
120
- this.chart.setI18n(this.i18n);
151
+ rebuild();
152
+ reportResolved();
121
153
  return;
122
154
  }
123
- // First pass: set auto values to 1 and measure total width + bar extent
155
+ // Measurement pass: render the auto quantities at 1
124
156
  if (autoUnit)
125
157
  config.pixelPerUnit = 1;
126
158
  if (autoPercent)
127
159
  config.pixelPerPercentage = 1;
128
- this.chart = new StructureChart(new IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
129
- this.chart.setI18n(this.i18n);
130
- this.chart.toString();
131
- const svgWidth = this.chart.getAllocatedCanvasWidth();
132
- if (svgWidth <= 0) {
160
+ rebuild();
161
+ let width = measure();
162
+ if (width <= 0) {
163
+ reportResolved();
133
164
  return;
134
165
  }
135
- // Separate fixed parts (labels, padding, spacing) from variable part (bar extent).
136
- // totalWidth(ppu) = fixedWidth + maxBarValue * ppu
137
- // Solving for ppu: ppu = (targetWidth - fixedWidth) / maxBarValue
138
- const maxBarValue = this.chart.getMaxBarValue();
139
- if (autoUnit) {
140
- if (maxBarValue > 0) {
141
- const fixedWidth = svgWidth - maxBarValue; // at ppu=1, barExtent = maxBarValue * 1
142
- config.pixelPerUnit = Math.max(0.001, (targetWidth - fixedWidth) / maxBarValue);
166
+ // Fallback for auto quantities nothing scales with (no bar extent):
167
+ // plain ratio against the measurement pass, as before.
168
+ const ratioFallback = Math.max(MIN_PIXEL_SCALE, (targetWidth * 0.9) / width);
169
+ const EPS = 0.5;
170
+ const MAX_CORRECTIONS = 3;
171
+ let solvedUnit = false;
172
+ let solvedPercent = false;
173
+ let fitting = null;
174
+ for (let iteration = 0; iteration <= MAX_CORRECTIONS; iteration++) {
175
+ const step = solveAutoFitStep({
176
+ target: targetWidth,
177
+ measured: width,
178
+ unitExtent: autoUnit ? this.chart.getUnitBarExtent() : 0,
179
+ pctExtent: autoPercent ? this.chart.getPercentBarExtent() : 0,
180
+ currentPpu: config.pixelPerUnit,
181
+ currentPpp: config.pixelPerPercentage,
182
+ });
183
+ if (step.ppu === undefined && step.ppp === undefined) {
184
+ break; // nothing scales with the auto values — fallback below
185
+ }
186
+ if (autoUnit && step.ppu !== undefined) {
187
+ config.pixelPerUnit = step.ppu;
188
+ solvedUnit = true;
189
+ }
190
+ if (autoPercent && step.ppp !== undefined) {
191
+ config.pixelPerPercentage = step.ppp;
192
+ solvedPercent = true;
193
+ }
194
+ rebuild();
195
+ width = measure();
196
+ if (width <= targetWidth + EPS) {
197
+ fitting = { ppu: config.pixelPerUnit, ppp: config.pixelPerPercentage };
198
+ if (width >= targetWidth * 0.98) {
199
+ break; // fits and tight — done
200
+ }
201
+ // else a released label clamp left slack — loop once more to grow into it
202
+ }
203
+ }
204
+ // Auto quantities the solver never touched get the ratio fallback
205
+ let needsRebuild = false;
206
+ if (autoUnit && !solvedUnit) {
207
+ config.pixelPerUnit = ratioFallback;
208
+ needsRebuild = true;
209
+ }
210
+ if (autoPercent && !solvedPercent) {
211
+ config.pixelPerPercentage = ratioFallback;
212
+ needsRebuild = true;
213
+ }
214
+ // Never end on an overshoot
215
+ if (width > targetWidth + EPS) {
216
+ if (fitting) {
217
+ // Restore the last values that fit (fallback quantities have no extent)
218
+ if (solvedUnit)
219
+ config.pixelPerUnit = fitting.ppu;
220
+ if (solvedPercent)
221
+ config.pixelPerPercentage = fitting.ppp;
143
222
  }
144
223
  else {
145
- config.pixelPerUnit = (targetWidth * 0.9) / svgWidth;
224
+ // Even the solved minimum overshoots (labels alone exceed the
225
+ // container) — shrink proportionally; the wrapper reports this.
226
+ const shrink = targetWidth / width;
227
+ if (autoUnit)
228
+ config.pixelPerUnit = Math.max(MIN_PIXEL_SCALE, config.pixelPerUnit * shrink);
229
+ if (autoPercent)
230
+ config.pixelPerPercentage = Math.max(MIN_PIXEL_SCALE, config.pixelPerPercentage * shrink);
146
231
  }
232
+ needsRebuild = true;
147
233
  }
148
- if (autoPercent) {
149
- // Same ratio approach: scale percentage bars to fill ~90% of width
150
- config.pixelPerPercentage = (targetWidth * 0.9) / svgWidth;
234
+ if (needsRebuild) {
235
+ rebuild();
151
236
  }
152
- // Second pass with the corrected scaling
153
- this.chart = new StructureChart(new IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
154
- this.chart.setI18n(this.i18n);
237
+ reportResolved();
155
238
  }
156
239
  async componentWillRender() {
157
240
  // return await (async () => {
@@ -367,6 +450,30 @@ export class IbcsChartStructure {
367
450
  "attribute": "pixel-per-percentage",
368
451
  "defaultValue": "50"
369
452
  },
453
+ "reportAutoScaling": {
454
+ "type": "unknown",
455
+ "mutable": false,
456
+ "complexType": {
457
+ "original": "(report: AutoScalingReport) => void",
458
+ "resolved": "(report: AutoScalingReport) => void",
459
+ "references": {
460
+ "AutoScalingReport": {
461
+ "location": "import",
462
+ "path": "../../utils/scaling",
463
+ "id": "src/utils/scaling.ts::AutoScalingReport",
464
+ "referenceLocation": "AutoScalingReport"
465
+ }
466
+ }
467
+ },
468
+ "required": false,
469
+ "optional": true,
470
+ "docs": {
471
+ "tags": [],
472
+ "text": "Internal wrapper channel: called with the auto-fitted values (px for one\ndata unit / px per 1.0 fraction) whenever one of them was auto-resolved, so\nthe outer `bn-chart-structure` can surface them in its AUTO_* warnings.\nNot for end users."
473
+ },
474
+ "getter": false,
475
+ "setter": false
476
+ },
370
477
  "limit": {
371
478
  "type": "number",
372
479
  "mutable": false,