@bino-bi/bn-template-engine 1.0.0-alpha.3 → 1.0.0-alpha.4

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 (195) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-1265d8d3.entry.js +1 -0
  3. package/dist/bn-template-engine/p-15516dac.entry.js +1 -0
  4. package/dist/bn-template-engine/p-1c716641.entry.js +1 -0
  5. package/dist/bn-template-engine/p-27cc8dc0.entry.js +1 -0
  6. package/dist/bn-template-engine/p-4426d484.entry.js +1 -0
  7. package/dist/bn-template-engine/p-51f8dc9e.entry.js +1 -0
  8. package/dist/bn-template-engine/p-53d4e690.entry.js +1 -0
  9. package/dist/bn-template-engine/p-5KQYRQLK.js +1 -0
  10. package/dist/bn-template-engine/p-745f4596.entry.js +1 -0
  11. package/dist/bn-template-engine/{p-0f1504f3.entry.js → p-75e97c87.entry.js} +1 -1
  12. package/dist/bn-template-engine/p-7a560278.entry.js +1 -0
  13. package/dist/bn-template-engine/p-7ea7c325.entry.js +1 -0
  14. package/dist/bn-template-engine/p-945cc95d.entry.js +1 -0
  15. package/dist/bn-template-engine/p-BYBpC0EO.js +1 -0
  16. package/dist/bn-template-engine/p-BfXY5dsy.js +1 -0
  17. package/dist/bn-template-engine/p-BgnHJQ9Q.js +1 -0
  18. package/dist/bn-template-engine/{p-B4ySv9KQ.js → p-Bhd_WSML.js} +1 -1
  19. package/dist/bn-template-engine/p-Bka-Z6jo.js +1 -0
  20. package/dist/bn-template-engine/p-Bnhh02CF.js +1 -0
  21. package/dist/bn-template-engine/p-C7dQL8CS.js +1 -0
  22. package/dist/bn-template-engine/p-CL1RYuNU.js +1 -0
  23. package/dist/bn-template-engine/p-CYwd_ZNM.js +1 -0
  24. package/dist/bn-template-engine/p-ChlK-T9I.js +1 -0
  25. package/dist/bn-template-engine/p-DHezf8pZ.js +1 -0
  26. package/dist/bn-template-engine/{p-DVMu6dEy.js → p-DlppAFq9.js} +1 -1
  27. package/dist/bn-template-engine/p-DvDDgmcV.js +1 -0
  28. package/dist/bn-template-engine/p-DvvwfRQG.js +1 -0
  29. package/dist/bn-template-engine/{p-DG-1MR_T.js → p-P7pGJBgc.js} +1 -1
  30. package/dist/bn-template-engine/p-b34eaf86.entry.js +1 -0
  31. package/dist/bn-template-engine/p-bdb8b44c.entry.js +1 -0
  32. package/dist/bn-template-engine/p-c44fcb8e.entry.js +1 -0
  33. package/dist/bn-template-engine/p-c7e1a49b.entry.js +1 -0
  34. package/dist/bn-template-engine/p-d9003041.entry.js +1 -0
  35. package/dist/bn-template-engine/p-daa7ffa3.entry.js +1 -0
  36. package/dist/bn-template-engine/p-e084f50a.entry.js +1 -0
  37. package/dist/bn-template-engine/p-eaba6658.entry.js +1 -0
  38. package/dist/bn-template-engine/{p-C0yAPzJz.js → p-u8igQLRZ.js} +1 -1
  39. package/dist/cjs/{DataFormatDigits-DAmZzqbD.js → DataFormatDigits-DKcOeLNK.js} +1 -1
  40. package/dist/cjs/{DateStringFactory-CcluhpGI.js → DateStringFactory-CSKvbS8K.js} +1 -1
  41. package/dist/cjs/{Order-BKoDS21t.js → Order-iG11HI4R.js} +8 -5
  42. package/dist/cjs/{SVGVariancesStyleGroup-DYYAU-81.js → SVGVariancesStyleGroup-K-Tw6lOD.js} +1 -14
  43. package/dist/cjs/bn-asset.cjs.entry.js +5 -4
  44. package/dist/cjs/bn-body_4.cjs.entry.js +15 -13
  45. package/dist/cjs/bn-card.cjs.entry.js +5 -4
  46. package/dist/cjs/{ibcs-chart-structure.cjs.entry.js → bn-chart-structure_5.cjs.entry.js} +1058 -28
  47. package/dist/cjs/bn-chart-time.cjs.entry.js +38 -12
  48. package/dist/cjs/bn-component-style.cjs.entry.js +5 -4
  49. package/dist/cjs/bn-dataset.cjs.entry.js +38 -9
  50. package/dist/cjs/bn-grid.cjs.entry.js +9 -7
  51. package/dist/cjs/bn-image.cjs.entry.js +9 -7
  52. package/dist/cjs/bn-internationalization.cjs.entry.js +5 -4
  53. package/dist/cjs/bn-layout-card.cjs.entry.js +3 -2
  54. package/dist/cjs/bn-layout-page.cjs.entry.js +2 -1
  55. package/dist/cjs/bn-message.cjs.entry.js +5 -4
  56. package/dist/cjs/bn-table.cjs.entry.js +979 -0
  57. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  58. package/dist/cjs/bn-template.cjs.entry.js +3 -2
  59. package/dist/cjs/bn-text.cjs.entry.js +11 -9
  60. package/dist/cjs/bn-tree.cjs.entry.js +9 -7
  61. package/dist/cjs/contentDecoder-JxOldq1e.js +419 -0
  62. package/dist/cjs/{context-protocol-CRPmux5D.js → context-protocol-DRQWrwsA.js} +2 -0
  63. package/dist/cjs/editor-companion.cjs.entry.js +1 -1
  64. package/dist/cjs/emotion-hash.esm-nbbEQ0Dn.js +57 -0
  65. package/dist/cjs/ibcs-chart-time.cjs.entry.js +22 -18
  66. package/dist/cjs/{bn-context_5.cjs.entry.js → ibcs-table.cjs.entry.js} +122 -1293
  67. package/dist/cjs/{StringAdapter-Bneo8T4k.js → ibcsRuleSet-DgUoXOfd.js} +10 -10
  68. package/dist/cjs/index-Dm85hG6t.js +65 -0
  69. package/dist/cjs/loader.cjs.js +1 -1
  70. package/dist/cjs/{scaling-D8sIIKft.js → scaling-9Tz595RQ.js} +7 -7
  71. package/dist/cjs/{withHasError-B8gHkfV2.js → utils-CwHIVbbL.js} +1 -69
  72. package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-CKpSD8UT.js} +3 -3
  73. package/dist/cjs/{withComponentStatus-_x4LQZ0N.js → withComponentStatus-Bw70BhO0.js} +5 -5
  74. package/dist/cjs/{withComponentStyle-DMtic_9Y.js → withComponentStyle-aIbTCtfj.js} +5 -5
  75. package/dist/cjs/withHasError-D7ue5vAv.js +72 -0
  76. package/dist/cjs/{withStyled-CW30Bh6c.js → withStyled-CS1Yp4sv.js} +8 -61
  77. package/dist/cjs/{withTranslation-CWPAIRjh.js → withTranslation-rwgyITqe.js} +5 -5
  78. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +226 -99
  79. package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +13 -3
  80. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +94 -11
  81. package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +3 -4
  82. package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +4 -0
  83. package/dist/collection/components/bn-chart-time/bn-chart-time.js +28 -4
  84. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +3 -3
  85. package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +3 -4
  86. package/dist/collection/components/bn-chart-time/utils/model/styles/TimeChartStyle.js +4 -0
  87. package/dist/collection/components/bn-dataset/bn-dataset.js +49 -2
  88. package/dist/collection/components/bn-datasource/bn-datasource.js +46 -3
  89. package/dist/collection/components/bn-table/bn-table.js +9 -12
  90. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +58 -41
  91. package/dist/collection/stores/componentStyles.js +2 -0
  92. package/dist/collection/utils/constants.js +8 -5
  93. package/dist/collection/utils/contentDecoder.js +28 -0
  94. package/dist/collection/utils/stackColors.js +2 -2
  95. package/dist/collection/utils/validate.js +1 -1
  96. package/dist/components/DataFormatDigits.js +1 -1
  97. package/dist/components/Order.js +1 -1
  98. package/dist/components/SVGVariancesStyleGroup.js +1 -1
  99. package/dist/components/bn-chart-structure.js +1 -1
  100. package/dist/components/bn-chart-time.js +1 -1
  101. package/dist/components/bn-dataset.js +1 -1
  102. package/dist/components/bn-datasource.js +1 -1
  103. package/dist/components/bn-table.js +1 -1
  104. package/dist/components/contentDecoder.js +1 -0
  105. package/dist/components/context-protocol.js +1 -1
  106. package/dist/components/emotion-hash.esm.js +1 -0
  107. package/dist/components/ibcs-chart-structure2.js +1 -1
  108. package/dist/components/ibcs-chart-time2.js +1 -1
  109. package/dist/components/ibcs-table2.js +1 -1
  110. package/dist/components/ibcs-title2.js +1 -1
  111. package/dist/components/ibcsRuleSet.js +1 -1
  112. package/dist/components/validate.js +1 -1
  113. package/dist/components/withStyled.js +1 -1
  114. package/dist/esm/{DataFormatDigits--qIbKvXa.js → DataFormatDigits-oSZ1hBKE.js} +1 -1
  115. package/dist/esm/{DateStringFactory-XWdUjsn8.js → DateStringFactory-CSGz6TDk.js} +1 -1
  116. package/dist/esm/{Order-sqjrku2z.js → Order-Bnhh02CF.js} +9 -6
  117. package/dist/esm/{SVGVariancesStyleGroup-ibg3sLjM.js → SVGVariancesStyleGroup-CqTjrZYg.js} +2 -13
  118. package/dist/esm/bn-asset.entry.js +5 -4
  119. package/dist/esm/bn-body_4.entry.js +11 -9
  120. package/dist/esm/bn-card.entry.js +5 -4
  121. package/dist/esm/{ibcs-chart-structure.entry.js → bn-chart-structure_5.entry.js} +1048 -22
  122. package/dist/esm/bn-chart-time.entry.js +38 -12
  123. package/dist/esm/bn-component-style.entry.js +5 -4
  124. package/dist/esm/bn-dataset.entry.js +35 -6
  125. package/dist/esm/bn-grid.entry.js +9 -7
  126. package/dist/esm/bn-image.entry.js +9 -7
  127. package/dist/esm/bn-internationalization.entry.js +5 -4
  128. package/dist/esm/bn-layout-card.entry.js +3 -2
  129. package/dist/esm/bn-layout-page.entry.js +2 -1
  130. package/dist/esm/bn-message.entry.js +5 -4
  131. package/dist/esm/bn-table.entry.js +977 -0
  132. package/dist/esm/bn-template-engine.js +1 -1
  133. package/dist/esm/bn-template.entry.js +3 -2
  134. package/dist/esm/bn-text.entry.js +11 -9
  135. package/dist/esm/bn-tree.entry.js +9 -7
  136. package/dist/esm/contentDecoder-oMmxz6nJ.js +416 -0
  137. package/dist/esm/{context-protocol-Bz5klD-F.js → context-protocol-BHnQsVsr.js} +2 -0
  138. package/dist/esm/editor-companion.entry.js +1 -1
  139. package/dist/esm/emotion-hash.esm-BYBpC0EO.js +55 -0
  140. package/dist/esm/ibcs-chart-time.entry.js +15 -11
  141. package/dist/esm/{bn-context_5.entry.js → ibcs-table.entry.js} +68 -1235
  142. package/dist/esm/{StringAdapter-BCLJpQQ8.js → ibcsRuleSet-K4ytuA1f.js} +10 -10
  143. package/dist/esm/index-DHezf8pZ.js +65 -0
  144. package/dist/esm/loader.js +1 -1
  145. package/dist/esm/{scaling-C6K8FYSF.js → scaling-Cehc74IE.js} +2 -2
  146. package/dist/esm/{withHasError-B3QX2emi.js → utils-DvvwfRQG.js} +1 -69
  147. package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-FQ8NwCIz.js} +1 -1
  148. package/dist/esm/{withComponentStatus-DodoSXe-.js → withComponentStatus-DWjDYtZ7.js} +1 -1
  149. package/dist/esm/{withComponentStyle-BerJY64r.js → withComponentStyle-9uP_hcDq.js} +2 -2
  150. package/dist/esm/withHasError-FyY5mQ_3.js +70 -0
  151. package/dist/esm/{withStyled-D1fAWJ3g.js → withStyled--qQWquTH.js} +6 -59
  152. package/dist/esm/{withTranslation-mimbJdER.js → withTranslation-BqD0Kp7b.js} +2 -2
  153. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +155 -109
  154. package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +7 -0
  155. package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +1 -0
  156. package/dist/types/components/bn-chart-time/utils/model/styles/TimeChartStyle.d.ts +1 -0
  157. package/dist/types/components/bn-dataset/bn-dataset.d.ts +6 -0
  158. package/dist/types/components/bn-datasource/bn-datasource.d.ts +8 -0
  159. package/dist/types/components/bn-table/bn-table.d.ts +3 -3
  160. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +0 -2
  161. package/dist/types/components.d.ts +100 -36
  162. package/dist/types/stores/componentStyles.d.ts +2 -0
  163. package/dist/types/utils/constants.d.ts +8 -5
  164. package/dist/types/utils/contentDecoder.d.ts +12 -0
  165. package/package.json +2 -1
  166. package/dist/bn-template-engine/p-05a82a77.entry.js +0 -1
  167. package/dist/bn-template-engine/p-1970906d.entry.js +0 -1
  168. package/dist/bn-template-engine/p-1dbd339c.entry.js +0 -1
  169. package/dist/bn-template-engine/p-2e68cf09.entry.js +0 -1
  170. package/dist/bn-template-engine/p-31cc6a2d.entry.js +0 -1
  171. package/dist/bn-template-engine/p-37881d05.entry.js +0 -1
  172. package/dist/bn-template-engine/p-3b894997.entry.js +0 -1
  173. package/dist/bn-template-engine/p-50e49732.entry.js +0 -1
  174. package/dist/bn-template-engine/p-6c7c0455.entry.js +0 -1
  175. package/dist/bn-template-engine/p-6da93eae.entry.js +0 -1
  176. package/dist/bn-template-engine/p-701e1578.entry.js +0 -1
  177. package/dist/bn-template-engine/p-8tsCnxIz.js +0 -1
  178. package/dist/bn-template-engine/p-997b2fe4.entry.js +0 -1
  179. package/dist/bn-template-engine/p-BL8gyUwE.js +0 -1
  180. package/dist/bn-template-engine/p-BSfqOkN_.js +0 -1
  181. package/dist/bn-template-engine/p-CRLgp9-v.js +0 -1
  182. package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
  183. package/dist/bn-template-engine/p-DRikHQE-.js +0 -1
  184. package/dist/bn-template-engine/p-DtdQCMzj.js +0 -1
  185. package/dist/bn-template-engine/p-a90f1cbe.entry.js +0 -1
  186. package/dist/bn-template-engine/p-b7bec050.entry.js +0 -1
  187. package/dist/bn-template-engine/p-d7f0cbaf.entry.js +0 -1
  188. package/dist/bn-template-engine/p-dfb61aa5.entry.js +0 -1
  189. package/dist/bn-template-engine/p-ece17f84.entry.js +0 -1
  190. package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
  191. package/dist/bn-template-engine/p-fd427179.entry.js +0 -1
  192. package/dist/bn-template-engine/p-sqjrku2z.js +0 -1
  193. package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
  194. package/dist/cjs/bn-chart-structure.cjs.entry.js +0 -700
  195. package/dist/esm/bn-chart-structure.entry.js +0 -698
@@ -151,35 +151,59 @@ function getBarStroke(varianceStyle) {
151
151
  return { stroke: "none", strokeWidth: 0 };
152
152
  }
153
153
  /**
154
- * Computes an effective max for proportional scaling that keeps most bars readable.
155
- * If a few outliers (extreme values) dominate, the effective max is capped so the
156
- * majority of bars remain at a useful size. Values exceeding the effective max are
157
- * flagged as "extreme" and rendered with an arrow indicator.
158
- *
159
- * Algorithm: effectiveMax = median * EXTREME_THRESHOLD (default 3×).
160
- * If this would be less than absMax, some values are extreme.
161
- * If the median is 0 (e.g. single value), falls back to absMax.
154
+ * Renders a zigzag break indicator at a given x position, matching the structure chart style.
155
+ * Two mirrored zigzag lines with a white background covering the break gap.
162
156
  */
163
- const EXTREME_THRESHOLD = 3;
164
- function computeEffectiveMax(columnStats) {
165
- if (columnStats.median <= 0) {
166
- return columnStats.absMax;
157
+ function renderZigzagBreak(breakX, breakGap, yTop, barHeight, s) {
158
+ const midX = breakX + breakGap / 2;
159
+ const halfGap = breakGap * 0.35;
160
+ const zigCount = 3;
161
+ const segHeight = barHeight / zigCount;
162
+ const amplitude = breakGap * 0.3;
163
+ let leftPath = `M ${midX - halfGap} ${yTop}`;
164
+ for (let i = 0; i < zigCount; i++) {
165
+ const y1 = yTop + segHeight * (i + 0.5);
166
+ const y2 = yTop + segHeight * (i + 1);
167
+ leftPath += ` L ${midX - halfGap - amplitude} ${y1} L ${midX - halfGap} ${y2}`;
168
+ }
169
+ let rightPath = `M ${midX + halfGap} ${yTop}`;
170
+ for (let i = 0; i < zigCount; i++) {
171
+ const y1 = yTop + segHeight * (i + 0.5);
172
+ const y2 = yTop + segHeight * (i + 1);
173
+ rightPath += ` L ${midX + halfGap + amplitude} ${y1} L ${midX + halfGap} ${y2}`;
167
174
  }
168
- const cap = columnStats.median * EXTREME_THRESHOLD;
169
- return Math.min(cap, columnStats.absMax);
175
+ return [
176
+ h("rect", { x: breakX, y: yTop - 1, width: breakGap, height: barHeight + 2, fill: "#ffffff" }),
177
+ h("path", { d: leftPath, fill: "none", stroke: "#000000", "stroke-width": 1 * s }),
178
+ h("path", { d: rightPath, fill: "none", stroke: "#000000", "stroke-width": 1 * s }),
179
+ ];
170
180
  }
171
181
  /**
172
182
  * Renders an absolute variance bar chart (d_ prefix).
173
183
  * Horizontal bar with centered axis, green for positive, red for negative.
174
- * Value label shown next to the bar (black text per IBCS).
184
+ * When a bar exceeds maxBarWidth it is drawn as an overdrive bar:
185
+ * base segment + zigzag break + proportional overdrive stub (like structure chart).
175
186
  *
176
187
  * Layout: [left label area][bar area with axis][right label area]
177
188
  */
178
189
  const AbsoluteVarianceBar = (props) => {
179
- const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, maxBarWidth: maxBarWidthEm = 3, styles = DEFAULT_STYLES, } = props;
190
+ const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, maxBarWidth: maxBarWidthEm = 10, styles = DEFAULT_STYLES, } = props;
180
191
  const s = styles.scaleFactor;
192
+ const fs = styles.fontSize;
181
193
  const labelAreaWidth = 38 * s;
182
- const maxBarWidth = maxBarWidthEm * styles.fontSize * s;
194
+ const maxBarWidth = maxBarWidthEm * fs;
195
+ // Overdrive layout constants
196
+ const breakGap = 4 * s;
197
+ const overdriveZoneWidth = maxBarWidth * 0.15;
198
+ const cutWidth = maxBarWidth - breakGap - overdriveZoneWidth;
199
+ // Direct unit scaling via fontSize
200
+ const scaledWidth = Math.abs(value) * styles.unitScaling * fs;
201
+ const isExtreme = scaledWidth > cutWidth;
202
+ // Compute proportional overdrive width across the column
203
+ const maxScaledWidth = columnStats.absMax * styles.unitScaling * fs;
204
+ const maxOverflow = Math.max(0, maxScaledWidth - cutWidth);
205
+ const overflowAmount = Math.max(0, scaledWidth - cutWidth);
206
+ const overdriveWidth = maxOverflow > 0 ? (overflowAmount / maxOverflow) * overdriveZoneWidth : 0;
183
207
  // Adaptive axis placement based on data range
184
208
  const hasNeg = columnStats.min < 0;
185
209
  const hasPos = columnStats.max > 0;
@@ -190,18 +214,10 @@ const AbsoluteVarianceBar = (props) => {
190
214
  const padding = 2 * s;
191
215
  const barHeight = height - padding * 2;
192
216
  const axisX = (hasNeg ? labelAreaWidth : 0) + negBarWidth;
193
- // Proportional scaling with outlier detection
194
- const effectiveMax = computeEffectiveMax(columnStats);
195
- const absValue = Math.abs(value);
196
- const proportion = effectiveMax > 0 ? absValue / effectiveMax : 0;
197
- const isExtreme = absValue > effectiveMax;
198
- const barWidth = Math.min(proportion, 1) * maxBarWidth;
199
- const isPositive = value >= 0;
200
- const barX = isPositive ? axisX : axisX - barWidth;
201
217
  const barY = padding;
218
+ const isPositive = value >= 0;
202
219
  // Get style based on column type (scenario vs variance)
203
220
  const barStyle = getBarStyle(scenario, value, isPositiveGood, styles);
204
- // Pattern prefix for scenarios uses scenario type, for variances uses pos/neg
205
221
  const patternPrefix = isScenarioColumn(scenario)
206
222
  ? getScenarioType(scenario)
207
223
  : isPositiveGood
@@ -214,13 +230,14 @@ const AbsoluteVarianceBar = (props) => {
214
230
  const fillValue = getBarFill(barStyle, patternPrefix);
215
231
  const { stroke: barStroke, strokeWidth: barStrokeWidth } = getBarStroke(barStyle);
216
232
  const displayValue = formattedValue || formatValue(value, false, measureScale);
217
- // Label position: in the label area on the appropriate side
218
- // Positive values: label in right area, left-aligned
219
- // Negative values: label in left area, right-aligned
220
- const labelX = isPositive ? axisX + barWidth + 4 * s : axisX - barWidth - 4 * s;
233
+ // Normal bar width (clamped to cutWidth when extreme)
234
+ const baseBarWidth = isExtreme ? cutWidth : scaledWidth;
235
+ // Label position accounts for overdrive
236
+ const totalVisualWidth = isExtreme ? cutWidth + breakGap + overdriveWidth : scaledWidth;
237
+ const labelX = isPositive ? axisX + totalVisualWidth + 4 * s : axisX - totalVisualWidth - 4 * s;
221
238
  const labelAnchor = isPositive ? "start" : "end";
222
- const centerY = height / 2;
223
- return (h("svg", { width: totalWidth, height: height, class: "cell-bar-chart absolute-variance", style: { overflow: "visible" } }, h(PatternDefs, { styles: styles }), h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s }), barWidth > 0 && (h("rect", { x: barX, y: barY, width: barWidth, height: barHeight, fill: fillValue, stroke: barStroke, "stroke-width": barStrokeWidth * s })), isExtreme && isPositive && (h("polygon", { points: `${axisX + maxBarWidth},${centerY} ${axisX + maxBarWidth - 6 * s},${centerY - 3 * s} ${axisX + maxBarWidth - 6 * s},${centerY + 3 * s}`, fill: barStyle.fill === "transparent" ? barStyle.stroke : barStyle.fill })), isExtreme && !isPositive && (h("polygon", { points: `${axisX - maxBarWidth},${centerY} ${axisX - maxBarWidth + 6 * s},${centerY - 3 * s} ${axisX - maxBarWidth + 6 * s},${centerY + 3 * s}`, fill: barStyle.fill === "transparent" ? barStyle.stroke : barStyle.fill })), h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": labelAnchor, fill: styles.fontColor, "font-size": styles.fontSize, "font-family": styles.fontFamily }, displayValue)));
239
+ return (h("svg", { width: totalWidth, height: height, class: "cell-bar-chart absolute-variance", style: { overflow: "visible" } }, h(PatternDefs, { styles: styles }), h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s }), baseBarWidth > 0 && (h("rect", { x: isPositive ? axisX : axisX - baseBarWidth, y: barY, width: baseBarWidth, height: barHeight, fill: fillValue, stroke: barStroke, "stroke-width": barStrokeWidth * s })), isExtreme && overdriveWidth > 0 && (h("rect", { x: isPositive ? axisX + cutWidth + breakGap : axisX - cutWidth - breakGap - overdriveWidth, y: barY, width: overdriveWidth, height: barHeight, fill: fillValue, stroke: barStroke, "stroke-width": barStrokeWidth * s })), isExtreme &&
240
+ renderZigzagBreak(isPositive ? axisX + cutWidth : axisX - cutWidth - breakGap, breakGap, barY, barHeight, s), h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": labelAnchor, fill: styles.fontColor, "font-size": fs, "font-family": styles.fontFamily }, displayValue)));
224
241
  };
225
242
  /**
226
243
  * Renders a relative variance pin chart (dr_ prefix).
@@ -230,10 +247,11 @@ const AbsoluteVarianceBar = (props) => {
230
247
  * Uses percentageScaling to determine pin length (pixels per percentage point).
231
248
  */
232
249
  const RelativeVariancePin = (props) => {
233
- const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, maxBarWidth: maxBarWidthEm = 3, styles = DEFAULT_STYLES, } = props;
250
+ const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, maxBarWidth: maxBarWidthEm = 10, styles = DEFAULT_STYLES, } = props;
234
251
  const s = styles.scaleFactor;
252
+ const fs = styles.fontSize;
235
253
  // Pin length is ~2/3 of bar width for visual balance
236
- const maxPinLength = Math.round(maxBarWidthEm * 0.67 * styles.fontSize) * s;
254
+ const maxPinLength = Math.round(maxBarWidthEm * 0.67 * fs);
237
255
  const pinPadding = 5 * s;
238
256
  // Adaptive axis placement based on data range
239
257
  const hasNeg = columnStats.min < 0;
@@ -245,12 +263,11 @@ const RelativeVariancePin = (props) => {
245
263
  const totalWidth = pinAreaWidth + labelAreaWidth;
246
264
  const axisX = negPinWidth;
247
265
  const centerY = height / 2;
248
- // Proportional scaling with outlier detection
249
- const effectiveMax = computeEffectiveMax(columnStats);
250
- const absValue = Math.abs(value);
251
- const proportion = effectiveMax > 0 ? absValue / effectiveMax : 0;
252
- const isExtreme = absValue > effectiveMax;
253
- const pinLength = Math.min(proportion, 1) * maxPinLength;
266
+ // Direct unit scaling via fontSize
267
+ const percentValue = Math.abs(value) * 100;
268
+ const scaledLength = percentValue * styles.percentageScaling * fs;
269
+ const isExtreme = scaledLength > maxPinLength;
270
+ const pinLength = Math.min(scaledLength, maxPinLength);
254
271
  const isPositive = value >= 0;
255
272
  const pinEndX = isPositive ? axisX + pinLength : axisX - pinLength;
256
273
  // Get style based on column type (scenario vs variance)
@@ -259,7 +276,7 @@ const RelativeVariancePin = (props) => {
259
276
  const displayValue = formattedValue || formatValue(value, true, measureScale);
260
277
  // Label always on the right side after the pin area
261
278
  const labelX = pinAreaWidth + 4 * s;
262
- return (h("svg", { width: totalWidth, height: height, class: "cell-bar-chart relative-variance", style: { overflow: "visible" } }, h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s }), !isExtreme && h("circle", { cx: pinEndX, cy: centerY, r: dotRadius, fill: styles.fontColor }), h("line", { x1: axisX, y1: centerY, x2: pinEndX, y2: centerY, stroke: barStyle.fill, "stroke-width": 2 * s }), isExtreme && isPositive && (h("polygon", { points: `${axisX + maxPinLength},${centerY} ${axisX + maxPinLength - 6 * s},${centerY - 3 * s} ${axisX + maxPinLength - 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), isExtreme && !isPositive && (h("polygon", { points: `${axisX - maxPinLength},${centerY} ${axisX - maxPinLength + 6 * s},${centerY - 3 * s} ${axisX - maxPinLength + 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": "start", fill: styles.fontColor, "font-size": styles.fontSize, "font-style": "italic", "font-family": styles.fontFamily }, displayValue)));
279
+ return (h("svg", { width: totalWidth, height: height, class: "cell-bar-chart relative-variance", style: { overflow: "visible" } }, h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s }), !isExtreme && h("circle", { cx: pinEndX, cy: centerY, r: dotRadius, fill: styles.fontColor }), h("line", { x1: axisX, y1: centerY, x2: pinEndX, y2: centerY, stroke: barStyle.fill, "stroke-width": 2 * s }), isExtreme && isPositive && (h("polygon", { points: `${axisX + maxPinLength},${centerY} ${axisX + maxPinLength - 6 * s},${centerY - 3 * s} ${axisX + maxPinLength - 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), isExtreme && !isPositive && (h("polygon", { points: `${axisX - maxPinLength},${centerY} ${axisX - maxPinLength + 6 * s},${centerY - 3 * s} ${axisX - maxPinLength + 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": "start", fill: styles.fontColor, "font-size": fs, "font-style": "italic", "font-family": styles.fontFamily }, displayValue)));
263
280
  };
264
281
  /**
265
282
  * CellBarChart - Renders IBCS-compliant variance bar charts.
@@ -41,6 +41,7 @@ export const SYSTEM_STYLE_DEFAULTS = {
41
41
  neg: { stroke: "#ff0000", fill: "#ff0000", width: 0.1 },
42
42
  neu: { stroke: "#808080", fill: "#808080", width: 0.1 },
43
43
  },
44
+ stackColors: ["#000000", "#c0c0c0", "#808080"],
44
45
  padding: {
45
46
  top: 10,
46
47
  left: 10,
@@ -83,6 +84,7 @@ export const SYSTEM_STYLE_DEFAULTS = {
83
84
  neg: { stroke: "#ff0000", fill: "#ff0000", width: 0.1 },
84
85
  neu: { stroke: "#808080", fill: "#808080", width: 0.1 },
85
86
  },
87
+ stackColors: ["#000000", "#c0c0c0", "#808080"],
86
88
  padding: {
87
89
  top: 10,
88
90
  left: 10,
@@ -154,13 +154,16 @@ export var ChartMode;
154
154
  ChartMode["LINE"] = "line";
155
155
  ChartMode["AUTO"] = "auto";
156
156
  })(ChartMode || (ChartMode = {}));
157
- /** Dimension used to split bars into stacked segments within a single data point. */
157
+ /**
158
+ * Stacking dimension for multi-segment bar charts.
159
+ * - SCENARIOS: stack the scenarios from the `scenarios` prop end-to-end
160
+ * - DIMENSIONS: stack by the next-lower hierarchy level derived from the `level` prop
161
+ * (rowGroup → category, category → subCategory)
162
+ */
158
163
  export var StackBy;
159
164
  (function (StackBy) {
160
- StackBy["SCENARIO"] = "scenario";
161
- StackBy["CATEGORY"] = "category";
162
- StackBy["SUBCATEGORY"] = "subcategory";
163
- StackBy["ROWGROUP"] = "rowgroup";
165
+ StackBy["SCENARIOS"] = "scenarios";
166
+ StackBy["DIMENSIONS"] = "dimensions";
164
167
  })(StackBy || (StackBy = {}));
165
168
  /**
166
169
  * How stacked values are presented.
@@ -0,0 +1,28 @@
1
+ import hash from "@emotion/hash";
2
+ import { gunzipSync } from "fflate";
3
+ /**
4
+ * Compute a short deterministic hash of a string.
5
+ */
6
+ export function computeContentHash(text) {
7
+ return hash(text);
8
+ }
9
+ /**
10
+ * Decode a compressed payload in the format `<hash>:<base64_gzip>`.
11
+ * Returns the embedded hash and the decompressed JSON string.
12
+ */
13
+ export function decodeCompressedContent(text) {
14
+ const colonIndex = text.indexOf(":");
15
+ if (colonIndex === -1) {
16
+ throw new Error("Invalid compressed format: missing ':' separator");
17
+ }
18
+ const embeddedHash = text.slice(0, colonIndex);
19
+ const base64Data = text.slice(colonIndex + 1);
20
+ const binaryString = atob(base64Data);
21
+ const bytes = new Uint8Array(binaryString.length);
22
+ for (let i = 0; i < binaryString.length; i++) {
23
+ bytes[i] = binaryString.charCodeAt(i);
24
+ }
25
+ const decompressed = gunzipSync(bytes);
26
+ const json = new TextDecoder().decode(decompressed);
27
+ return { hash: embeddedHash, json };
28
+ }
@@ -1,7 +1,7 @@
1
1
  /** Default fill colors cycled through for stacked chart segments. */
2
- export const STACK_FILLS = ["#808080", "#c0c0c0", "#000000"];
2
+ export const STACK_FILLS = ["#000000", "#c0c0c0", "#808080"];
3
3
  /** Default stroke colors cycled through for stacked chart segments. */
4
- export const STACK_STROKES = ["#808080", "#c0c0c0", "#000000"];
4
+ export const STACK_STROKES = ["#000000", "#c0c0c0", "#808080"];
5
5
  /**
6
6
  * IBCS rendering order: back-to-front (PL behind FC behind PP behind AC).
7
7
  * Used to ensure correct visual layering when scenarios overlap.
@@ -294,7 +294,7 @@ export function validateStackConfig(value) {
294
294
  errors.push("stack: 'by' is required");
295
295
  }
296
296
  else {
297
- const validBy = ["scenario", "category", "subcategory", "rowgroup"];
297
+ const validBy = ["scenarios", "dimensions"];
298
298
  if (!validBy.includes(config.by)) {
299
299
  errors.push(`stack: 'by' must be one of: ${validBy.join(", ")}`);
300
300
  }
@@ -1 +1 @@
1
- import{a as e}from"./alasql.min.js";import{i as t}from"./Order.js";class a{constructor(e="",t=1){this.prefix=e,this.value=t}}var s;!function(e){e[e.Y=1e24]="Y",e[e.Z=1e21]="Z",e[e.E=1e18]="E",e[e.P=1e15]="P",e[e.T=1e12]="T",e[e.G=1e9]="G",e[e.M=1e6]="M",e[e.k=1e3]="k",e[e.h=100]="h",e[e.da=10]="da",e[e.d=.1]="d",e[e.c=.01]="c",e[e.m=.001]="m",e[e.my=1e-6]="my",e[e.n=1e-9]="n",e[e.p=1e-12]="p",e[e.f=1e-15]="f",e[e.a=1e-18]="a",e[e.z=1e-21]="z",e[e.y=1e-24]="y"}(s||(s={}));class r{static calculateMeasureScale(t,s,r){var n;if("_"===r)return new a;if(null!=r&&[...this.unitsLeast,...this.unitsGreat].includes(r))return this.lookupPrefix(r);if(0===s.length)return new a;const i=`SELECT MAX(GREATEST(${s.filter((e=>3===e.length)).map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ?`,u=`SELECT MIN(LEAST(${s.filter((e=>3===e.length)).map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ?`;let c=i;"LEAST"===(null==r?void 0:r.toUpperCase())&&(c=u);const l=null===(n=e(c,[t])[0])||void 0===n?void 0:n.prefixvalue;return this.determinePrefix(Math.abs(l))}static determinePrefix(e){if(e>=1e3){const t=Math.floor(Math.floor(Math.abs(e)).toString().length/3),s=+Math.pow(1e3,t);return new a(this.unitsGreat[t-1],s)}if(e<=.001){const t=Math.floor(Math.abs(e).toString().length/3),s=1/Math.pow(1e3,t);return new a(this.unitsLeast[t-1],s)}return new a}static lookupPrefix(e){return new a(e,s[e])}}r.unitsGreat=["k","M","G","T","P","E","Z","Y"],r.unitsLeast=["m","my","n","p","P","f","a","z","y"];class n{constructor(e=2,t=1){this.percent=e,this.decimal=t}}class i{adapt(e){const a=new n;return t.isNumber(e.percent)&&(a.percent=e.percent),t.isNumber(e.decimal)&&(a.decimal=e.decimal),a}default(){return new n}}export{r as D,a as S,n as a,i as b}
1
+ import{a as e}from"./alasql.min.js";import{j as t}from"./Order.js";class a{constructor(e="",t=1){this.prefix=e,this.value=t}}var s;!function(e){e[e.Y=1e24]="Y",e[e.Z=1e21]="Z",e[e.E=1e18]="E",e[e.P=1e15]="P",e[e.T=1e12]="T",e[e.G=1e9]="G",e[e.M=1e6]="M",e[e.k=1e3]="k",e[e.h=100]="h",e[e.da=10]="da",e[e.d=.1]="d",e[e.c=.01]="c",e[e.m=.001]="m",e[e.my=1e-6]="my",e[e.n=1e-9]="n",e[e.p=1e-12]="p",e[e.f=1e-15]="f",e[e.a=1e-18]="a",e[e.z=1e-21]="z",e[e.y=1e-24]="y"}(s||(s={}));class r{static calculateMeasureScale(t,s,r){var n;if("_"===r)return new a;if(null!=r&&[...this.unitsLeast,...this.unitsGreat].includes(r))return this.lookupPrefix(r);if(0===s.length)return new a;const i=`SELECT MAX(GREATEST(${s.filter((e=>3===e.length)).map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ?`,u=`SELECT MIN(LEAST(${s.filter((e=>3===e.length)).map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ?`;let c=i;"LEAST"===(null==r?void 0:r.toUpperCase())&&(c=u);const l=null===(n=e(c,[t])[0])||void 0===n?void 0:n.prefixvalue;return this.determinePrefix(Math.abs(l))}static determinePrefix(e){if(e>=1e3){const t=Math.floor(Math.floor(Math.abs(e)).toString().length/3),s=+Math.pow(1e3,t);return new a(this.unitsGreat[t-1],s)}if(e<=.001){const t=Math.floor(Math.abs(e).toString().length/3),s=1/Math.pow(1e3,t);return new a(this.unitsLeast[t-1],s)}return new a}static lookupPrefix(e){return new a(e,s[e])}}r.unitsGreat=["k","M","G","T","P","E","Z","Y"],r.unitsLeast=["m","my","n","p","P","f","a","z","y"];class n{constructor(e=2,t=1){this.percent=e,this.decimal=t}}class i{adapt(e){const a=new n;return t.isNumber(e.percent)&&(a.percent=e.percent),t.isNumber(e.decimal)&&(a.decimal=e.decimal),a}default(){return new n}}export{r as D,a as S,n as a,i as b}