@bino-bi/bn-template-engine 1.0.0-alpha.17 → 1.0.0-alpha.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-0107f0cc.entry.js +1 -0
  3. package/dist/bn-template-engine/p-209351c9.entry.js +1 -0
  4. package/dist/bn-template-engine/p-22d0fb7a.entry.js +1 -0
  5. package/dist/bn-template-engine/p-2e6dc267.entry.js +1 -0
  6. package/dist/bn-template-engine/p-485d23d7.entry.js +1 -0
  7. package/dist/bn-template-engine/p-5651417d.entry.js +1 -0
  8. package/dist/bn-template-engine/p-5bfdc1e5.entry.js +1 -0
  9. package/dist/bn-template-engine/p-6b75762d.entry.js +1 -0
  10. package/dist/bn-template-engine/{p-1a1fd8eb.entry.js → p-7bdc0e28.entry.js} +1 -1
  11. package/dist/bn-template-engine/p-9879c9b2.entry.js +1 -0
  12. package/dist/bn-template-engine/p-BWKdb9ym.js +1 -0
  13. package/dist/bn-template-engine/{p-CIXlJoMr.js → p-BZV1b5VH.js} +1 -1
  14. package/dist/bn-template-engine/p-Bdfxd_Ke.js +1 -0
  15. package/dist/bn-template-engine/p-BqhIhYr1.js +1 -0
  16. package/dist/bn-template-engine/p-C0Pwqx-O.js +1 -0
  17. package/dist/bn-template-engine/{p-44L8rZSd.js → p-CBqUr7I8.js} +1 -1
  18. package/dist/bn-template-engine/{p-COXiPUfj.js → p-CPzF3Q2m.js} +1 -1
  19. package/dist/bn-template-engine/{p-DHibUOw5.js → p-CiudZRQr.js} +1 -1
  20. package/dist/bn-template-engine/{p-B2KOyHRY.js → p-Dg9OcXAO.js} +1 -1
  21. package/dist/bn-template-engine/p-DsTzlzxQ.js +1 -0
  22. package/dist/bn-template-engine/p-X6CxL6W-.js +1 -0
  23. package/dist/bn-template-engine/p-a130cb43.entry.js +1 -0
  24. package/dist/bn-template-engine/p-aakBGfzL.js +1 -0
  25. package/dist/bn-template-engine/p-dc745c32.entry.js +1 -0
  26. package/dist/bn-template-engine/p-e96da91f.entry.js +1 -0
  27. package/dist/bn-template-engine/{p-d3fc17ee.entry.js → p-f3d1fa06.entry.js} +1 -1
  28. package/dist/bn-template-engine/p-fcb43f2c.entry.js +1 -0
  29. package/dist/bn-template-engine/p-rdqTC0_5.js +1 -0
  30. package/dist/cjs/{AxisConfig-B_GMRfX_.js → AxisConfig-VnVelfSV.js} +1 -1
  31. package/dist/cjs/LabelCollisionManager-nfD5P__k.js +412 -0
  32. package/dist/cjs/NumericScale-BAyYXpKL.js +107 -0
  33. package/dist/cjs/Order-DobBozQC.js +87 -0
  34. package/dist/cjs/{LabelCollisionManager-8HGn9W0V.js → SVGStyle-BQOmGWLX.js} +2 -409
  35. package/dist/cjs/SVGVariancesStyleGroup-DCGfHrqh.js +50 -0
  36. package/dist/cjs/{VarianceMeasure-DEOzP-XZ.js → VarianceMeasure-NY9yhiNV.js} +1 -1
  37. package/dist/cjs/{XYChartDataRow-CDl1Ofnv.js → XYChartDataRow-B7OKrAcC.js} +7 -111
  38. package/dist/cjs/bn-asset_21.cjs.entry.js +221 -263
  39. package/dist/cjs/bn-chart-bubble.cjs.entry.js +8 -7
  40. package/dist/cjs/bn-chart-bullet.cjs.entry.js +785 -0
  41. package/dist/cjs/bn-chart-scatter.cjs.entry.js +8 -7
  42. package/dist/cjs/bn-grid.cjs.entry.js +5 -4
  43. package/dist/cjs/bn-image.cjs.entry.js +5 -4
  44. package/dist/cjs/bn-internationalization.cjs.entry.js +2 -2
  45. package/dist/cjs/bn-ruleset.cjs.entry.js +2 -2
  46. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  47. package/dist/cjs/bn-template.cjs.entry.js +1 -1
  48. package/dist/cjs/bn-text.cjs.entry.js +6 -5
  49. package/dist/cjs/bn-tree.cjs.entry.js +4 -3
  50. package/dist/cjs/{context-protocol-CIuyJKkK.js → context-protocol-BDrMkhc4.js} +66 -0
  51. package/dist/cjs/editor-companion.cjs.entry.js +2 -2
  52. package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +20 -18
  53. package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +673 -0
  54. package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +19 -17
  55. package/dist/cjs/{layoutObserver-CJWRV_y6.js → layoutObserver-p0wXIWFg.js} +2 -2
  56. package/dist/cjs/loader.cjs.js +1 -1
  57. package/dist/cjs/{scaling-B4UPXivZ.js → scaling-BmqxcNOf.js} +1 -1
  58. package/dist/cjs/{withScalingGroup-D832DQKp.js → withScalingGroup-BmcRlWBs.js} +1 -1
  59. package/dist/cjs/{withStyled-COxuhL-N.js → withStyled-CRiC9fzc.js} +5 -86
  60. package/dist/collection/collection-manifest.json +2 -0
  61. package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.css +10 -0
  62. package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +1014 -0
  63. package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.css +9 -0
  64. package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.js +538 -0
  65. package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +440 -0
  66. package/dist/collection/components/bn-chart-bullet/utils/model/BulletChartStyle.js +132 -0
  67. package/dist/collection/components/bn-chart-bullet/utils/model/BulletConfig.js +89 -0
  68. package/dist/collection/components/bn-chart-bullet/utils/model/index.js +2 -0
  69. package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +1 -1
  70. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +1 -1
  71. package/dist/collection/components/bn-chart-time/bn-chart-time.js +1 -1
  72. package/dist/collection/components/bn-component-style/bn-component-style.js +1 -1
  73. package/dist/collection/components/bn-context/bn-context.js +1 -1
  74. package/dist/collection/components/bn-dataset/bn-dataset.js +1 -1
  75. package/dist/collection/components/bn-datasource/bn-datasource.js +1 -1
  76. package/dist/collection/components/bn-footer/bn-footer.js +1 -1
  77. package/dist/collection/components/bn-grid/bn-grid.js +1 -1
  78. package/dist/collection/components/bn-image/bn-image.js +1 -1
  79. package/dist/collection/components/bn-internationalization/bn-internationalization.js +1 -1
  80. package/dist/collection/components/bn-layout-card/bn-layout-card.js +1 -1
  81. package/dist/collection/components/bn-layout-page/bn-layout-page.js +1 -1
  82. package/dist/collection/components/bn-message/bn-message.js +1 -1
  83. package/dist/collection/components/bn-page/bn-page.js +1 -1
  84. package/dist/collection/components/bn-ruleset/bn-ruleset.js +1 -1
  85. package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +1 -1
  86. package/dist/collection/components/bn-table/bn-table.js +1 -1
  87. package/dist/collection/components/bn-template/bn-template.js +1 -1
  88. package/dist/collection/components/bn-text/bn-text.js +1 -1
  89. package/dist/collection/components/bn-title/bn-title.js +1 -1
  90. package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +1 -1
  91. package/dist/collection/components/editor-companion/editor-companion.js +1 -1
  92. package/dist/collection/stores/componentStyles.js +38 -0
  93. package/dist/collection/stores/internationalization.js +28 -0
  94. package/dist/components/NumericScale.js +1 -0
  95. package/dist/components/Order.js +1 -1
  96. package/dist/components/XYChartDataRow.js +1 -1
  97. package/dist/components/bn-chart-bullet.d.ts +11 -0
  98. package/dist/components/bn-chart-bullet.js +1 -0
  99. package/dist/components/bn-chart-scatter.js +1 -1
  100. package/dist/components/bn-chart-structure.js +1 -1
  101. package/dist/components/bn-chart-time.js +1 -1
  102. package/dist/components/bn-component-style.js +1 -1
  103. package/dist/components/bn-context.js +1 -1
  104. package/dist/components/bn-dataset.js +1 -1
  105. package/dist/components/bn-datasource.js +1 -1
  106. package/dist/components/bn-footer2.js +1 -1
  107. package/dist/components/bn-grid.js +1 -1
  108. package/dist/components/bn-image.js +1 -1
  109. package/dist/components/bn-internationalization.js +1 -1
  110. package/dist/components/bn-layout-card.js +1 -1
  111. package/dist/components/bn-layout-page.js +1 -1
  112. package/dist/components/bn-message2.js +1 -1
  113. package/dist/components/bn-page2.js +1 -1
  114. package/dist/components/bn-ruleset.js +1 -1
  115. package/dist/components/bn-scaling-group.js +1 -1
  116. package/dist/components/bn-table.js +1 -1
  117. package/dist/components/bn-template.js +1 -1
  118. package/dist/components/bn-text.js +1 -1
  119. package/dist/components/bn-title2.js +1 -1
  120. package/dist/components/context-protocol.js +1 -1
  121. package/dist/components/editor-companion.js +1 -1
  122. package/dist/components/ibcs-chart-bubble2.js +1 -1
  123. package/dist/components/ibcs-chart-bullet.d.ts +11 -0
  124. package/dist/components/ibcs-chart-bullet.js +1 -0
  125. package/dist/components/ibcs-chart-bullet2.js +1 -0
  126. package/dist/components/ibcs-chart-scatter2.js +1 -1
  127. package/dist/components/ibcs-chart-structure2.js +1 -1
  128. package/dist/components/ibcs-chart-time2.js +1 -1
  129. package/dist/components/ibcs-table2.js +1 -1
  130. package/dist/components/ibcs-title2.js +1 -1
  131. package/dist/components/main.js +1 -0
  132. package/dist/components/stackColors.js +1 -1
  133. package/dist/esm/{AxisConfig-BwUQrme0.js → AxisConfig-C_zWCKlL.js} +1 -1
  134. package/dist/esm/LabelCollisionManager-8swVQHKA.js +404 -0
  135. package/dist/esm/NumericScale-DsTzlzxQ.js +105 -0
  136. package/dist/esm/Order-BPeWfygb.js +83 -0
  137. package/dist/esm/{LabelCollisionManager-DZP5Vl8T.js → SVGStyle-BxEDw9zh.js} +3 -403
  138. package/dist/esm/SVGVariancesStyleGroup-DRQYvSDD.js +48 -0
  139. package/dist/esm/{VarianceMeasure-Cxshx01h.js → VarianceMeasure-DnwNKspZ.js} +1 -1
  140. package/dist/esm/{XYChartDataRow-FF_VxRnF.js → XYChartDataRow-DeV4r-Wm.js} +5 -108
  141. package/dist/esm/bn-asset_21.entry.js +25 -67
  142. package/dist/esm/bn-chart-bubble.entry.js +8 -7
  143. package/dist/esm/bn-chart-bullet.entry.js +783 -0
  144. package/dist/esm/bn-chart-scatter.entry.js +8 -7
  145. package/dist/esm/bn-grid.entry.js +5 -4
  146. package/dist/esm/bn-image.entry.js +5 -4
  147. package/dist/esm/bn-internationalization.entry.js +2 -2
  148. package/dist/esm/bn-ruleset.entry.js +2 -2
  149. package/dist/esm/bn-template-engine.js +1 -1
  150. package/dist/esm/bn-template.entry.js +1 -1
  151. package/dist/esm/bn-text.entry.js +6 -5
  152. package/dist/esm/bn-tree.entry.js +4 -3
  153. package/dist/esm/{context-protocol-BNHTlllP.js → context-protocol-1Yj1uKvh.js} +66 -0
  154. package/dist/esm/editor-companion.entry.js +2 -2
  155. package/dist/esm/ibcs-chart-bubble.entry.js +6 -4
  156. package/dist/esm/ibcs-chart-bullet.entry.js +671 -0
  157. package/dist/esm/ibcs-chart-scatter.entry.js +6 -4
  158. package/dist/esm/{layoutObserver-D5FY_lQa.js → layoutObserver-DCbmpGrz.js} +2 -2
  159. package/dist/esm/loader.js +1 -1
  160. package/dist/esm/{scaling-B7Pa0d_s.js → scaling-B_k50v9z.js} +1 -1
  161. package/dist/esm/{withScalingGroup-DBheBsP4.js → withScalingGroup-Br70pAv9.js} +1 -1
  162. package/dist/esm/{withStyled-DTvj2nar.js → withStyled-Br2DGTPs.js} +4 -83
  163. package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +172 -0
  164. package/dist/types/components/bn-chart-bullet/ibcs-chart-bullet.d.ts +52 -0
  165. package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +91 -0
  166. package/dist/types/components/bn-chart-bullet/utils/model/BulletChartStyle.d.ts +70 -0
  167. package/dist/types/components/bn-chart-bullet/utils/model/BulletConfig.d.ts +43 -0
  168. package/dist/types/components/bn-chart-bullet/utils/model/index.d.ts +2 -0
  169. package/dist/types/components.d.ts +399 -4
  170. package/dist/types/stores/componentStyles.d.ts +20 -0
  171. package/package.json +1 -1
  172. package/dist/bn-template-engine/p-172499ac.entry.js +0 -1
  173. package/dist/bn-template-engine/p-19e65c04.entry.js +0 -1
  174. package/dist/bn-template-engine/p-2849c367.entry.js +0 -1
  175. package/dist/bn-template-engine/p-5dd11fcc.entry.js +0 -1
  176. package/dist/bn-template-engine/p-63f891d9.entry.js +0 -1
  177. package/dist/bn-template-engine/p-72f63181.entry.js +0 -1
  178. package/dist/bn-template-engine/p-836ad6f3.entry.js +0 -1
  179. package/dist/bn-template-engine/p-BnOTt2YD.js +0 -1
  180. package/dist/bn-template-engine/p-CDPTCKVx.js +0 -1
  181. package/dist/bn-template-engine/p-CPZIJpxn.js +0 -1
  182. package/dist/bn-template-engine/p-a50da0f0.entry.js +0 -1
  183. package/dist/bn-template-engine/p-a9a34fb2.entry.js +0 -1
  184. package/dist/bn-template-engine/p-b0369558.entry.js +0 -1
  185. package/dist/bn-template-engine/p-f8c46905.entry.js +0 -1
  186. package/dist/bn-template-engine/p-lIy3SJs2.js +0 -1
@@ -0,0 +1,87 @@
1
+ 'use strict';
2
+
3
+ var VarianceMeasure = require('./VarianceMeasure-NY9yhiNV.js');
4
+
5
+ /** Shared utilities for the adapter layer, used by all component config adapters. */
6
+ class AdapterUtils {
7
+ /** Returns the trimmed string value, or an empty string if the input is not a string. */
8
+ static adaptDefaultString(data) {
9
+ if (VarianceMeasure.CompareUtil.isString(data)) {
10
+ return data.trim();
11
+ }
12
+ return "";
13
+ }
14
+ /**
15
+ * Safely adapts an array of untyped records through a typed adapter.
16
+ * If `data` is not an array, returns an empty array instead of throwing.
17
+ */
18
+ static adaptArray(data, adapter) {
19
+ const targetArray = [];
20
+ if (VarianceMeasure.CompareUtil.isArray(data)) {
21
+ data.forEach((b) => {
22
+ targetArray.push(adapter.adapt(b));
23
+ });
24
+ }
25
+ return targetArray;
26
+ }
27
+ }
28
+
29
+ exports.OrderDirection = void 0;
30
+ (function (OrderDirection) {
31
+ OrderDirection["ASC"] = "asc";
32
+ OrderDirection["DESC"] = "desc";
33
+ })(exports.OrderDirection || (exports.OrderDirection = {}));
34
+ /** Valid columns for ORDER BY in AlaSQL queries — includes hierarchy dimensions and all 16 scenario slots. */
35
+ exports.OrderColumn = void 0;
36
+ (function (OrderColumn) {
37
+ OrderColumn["ROWGROUP"] = "rowGroup";
38
+ OrderColumn["ROWGROUPINDEX"] = "rowGroupIndex";
39
+ OrderColumn["CATEGORY"] = "category";
40
+ OrderColumn["CATEGORYINDEX"] = "categoryIndex";
41
+ OrderColumn["SUBCATEGORY"] = "subCategory";
42
+ OrderColumn["SUBCATEGORYINDEX"] = "subCategoryIndex";
43
+ OrderColumn["AC1"] = "ac1";
44
+ OrderColumn["AC2"] = "ac2";
45
+ OrderColumn["AC3"] = "ac3";
46
+ OrderColumn["AC4"] = "ac4";
47
+ OrderColumn["PP1"] = "pp1";
48
+ OrderColumn["PP2"] = "pp2";
49
+ OrderColumn["PP3"] = "pp3";
50
+ OrderColumn["PP4"] = "pp4";
51
+ OrderColumn["FC1"] = "fc1";
52
+ OrderColumn["FC2"] = "fc2";
53
+ OrderColumn["FC3"] = "fc3";
54
+ OrderColumn["FC4"] = "fc4";
55
+ OrderColumn["PL1"] = "pl1";
56
+ OrderColumn["PL2"] = "pl2";
57
+ OrderColumn["PL3"] = "pl3";
58
+ OrderColumn["PL4"] = "pl4";
59
+ })(exports.OrderColumn || (exports.OrderColumn = {}));
60
+ class Order {
61
+ /**
62
+ * @param hierarchy Columns for multi-level sorting, applied left-to-right (e.g. `["rowGroup", "category"]`).
63
+ * @param direction Sort direction applied to all hierarchy levels.
64
+ */
65
+ constructor(hierarchy = ["category"], direction = exports.OrderDirection.ASC) {
66
+ this.hierarchy = hierarchy;
67
+ this.direction = direction;
68
+ }
69
+ }
70
+ class OrderAdapter {
71
+ constructor(stringAdapter) {
72
+ this.stringAdapter = stringAdapter;
73
+ }
74
+ adapt(data) {
75
+ var _a;
76
+ const hierarchy = AdapterUtils.adaptArray(data.hierarchy, this.stringAdapter);
77
+ const order = exports.OrderDirection[(_a = data.direction) === null || _a === void 0 ? void 0 : _a.toUpperCase()] || exports.OrderDirection.ASC;
78
+ return new Order(hierarchy.map((str) => exports.OrderColumn[str.toUpperCase()] || exports.OrderColumn.CATEGORY), order);
79
+ }
80
+ default() {
81
+ return new Order(["category"], exports.OrderDirection.ASC);
82
+ }
83
+ }
84
+
85
+ exports.AdapterUtils = AdapterUtils;
86
+ exports.Order = Order;
87
+ exports.OrderAdapter = OrderAdapter;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var contextProtocol = require('./context-protocol-CIuyJKkK.js');
4
- var VarianceMeasure = require('./VarianceMeasure-DEOzP-XZ.js');
3
+ var contextProtocol = require('./context-protocol-BDrMkhc4.js');
4
+ var VarianceMeasure = require('./VarianceMeasure-NY9yhiNV.js');
5
5
 
6
6
  /**
7
7
  * Parses an IBCS variance column name into its constituent parts.
@@ -7933,35 +7933,6 @@ registerMorphableType([
7933
7933
 
7934
7934
  makeMorphable();
7935
7935
 
7936
- /** SI metric prefix for number scaling (e.g. prefix="M", value=1000000 divides displayed values by one million). */
7937
- class SiPrefix {
7938
- constructor(prefix = "", value = 1) {
7939
- this.prefix = prefix;
7940
- this.value = value;
7941
- }
7942
- }
7943
-
7944
- /** Default fill colors cycled through for stacked chart segments. */
7945
- /**
7946
- * IBCS rendering order: back-to-front (PL behind FC behind PP behind AC).
7947
- * Used to ensure correct visual layering when scenarios overlap.
7948
- */
7949
- const IBCS_LAYER_ORDER = ["pl", "fc", "pp", "ac"];
7950
- /** Strips the trailing numeric suffix from a scenario key (e.g. "ac1" -> "ac"). */
7951
- function getScenarioPrefix(scenario) {
7952
- return scenario.replace(/\d+$/, "");
7953
- }
7954
- /**
7955
- * Returns black or white text color for readable contrast against the given
7956
- * hex background, using the W3C relative luminance formula.
7957
- */
7958
- function getContrastTextColor(hexFill) {
7959
- const r = parseInt(hexFill.slice(1, 3), 16);
7960
- const g = parseInt(hexFill.slice(3, 5), 16);
7961
- const b = parseInt(hexFill.slice(5, 7), 16);
7962
- return 0.299 * r + 0.587 * g + 0.114 * b > 128 ? "#000000" : "#ffffff";
7963
- }
7964
-
7965
7936
  /**
7966
7937
  * IBCS rule set defining scenario→style mappings per IBCS notation standard v1.2.
7967
7938
  *
@@ -8227,390 +8198,12 @@ class SVGStyleAdapter {
8227
8198
  }
8228
8199
  }
8229
8200
 
8230
- // import { DataFormatDigits } from "../../../../utils/model/DataFormatDigits";
8231
- // import { SiPrefix } from "../../../../utils/model/SiPrefix";
8232
- /**
8233
- * Anchor point for label positioning relative to its coordinates.
8234
- * Vertical hooks control how the label is offset from its Y coordinate;
8235
- * horizontal hooks control text-anchor alignment (start/middle/end).
8236
- */
8237
- exports.HookLocation = void 0;
8238
- (function (HookLocation) {
8239
- HookLocation[HookLocation["Left"] = 0] = "Left";
8240
- HookLocation[HookLocation["Center"] = 1] = "Center";
8241
- HookLocation[HookLocation["Right"] = 2] = "Right";
8242
- HookLocation[HookLocation["Top"] = 3] = "Top";
8243
- HookLocation[HookLocation["Bottom"] = 4] = "Bottom";
8244
- })(exports.HookLocation || (exports.HookLocation = {}));
8245
- /**
8246
- * SVG text label used across all chart elements (columns, needles, markers, axes).
8247
- *
8248
- * Handles numeric formatting via Formatter.number() with configurable type (decimal/percent),
8249
- * digit precision, and SI prefix scaling. Variance labels prepend a "+" sign for positive values.
8250
- *
8251
- * The label is drawn with a semi-transparent white background rectangle to ensure
8252
- * readability over chart geometry. For stacked segments, the background is omitted
8253
- * and text color is derived from the segment fill for contrast.
8254
- *
8255
- * Positioning uses a two-axis hook system: verticalHookLocation shifts the label
8256
- * above/below/centered on the Y coordinate, horizontalHookLocation sets the SVG
8257
- * text-anchor (start/middle/end) relative to X.
8258
- */
8259
- class Label {
8260
- constructor(parent, xPosition, yPosition, groupPrefix, value, styles, verticalHookLocation, horizontalHookLocation) {
8261
- this.ID_SCENARIOLABEL = "Label";
8262
- this.CSS_CATEGORIES = "categories";
8263
- this.isRelativeLabel = false;
8264
- this.segmentFillColor = null;
8265
- this.x = xPosition;
8266
- this.y = yPosition;
8267
- this.value = value;
8268
- this.group = parent.group().id(this.createElementID(parent.toString(), groupPrefix));
8269
- this.styles = styles;
8270
- this.isVarianceLabel = false;
8271
- this.verticalHookLocation = verticalHookLocation || exports.HookLocation.Top;
8272
- this.horizontalHookLocation = horizontalHookLocation || exports.HookLocation.Left;
8273
- }
8274
- setToVarianceLabel() {
8275
- this.isVarianceLabel = true;
8276
- return this;
8277
- }
8278
- setToRelativeVarianceLabel() {
8279
- this.isVarianceLabel = true;
8280
- this.isRelativeLabel = true;
8281
- return this;
8282
- }
8283
- setSegmentFill(color) {
8284
- this.segmentFillColor = color;
8285
- return this;
8286
- }
8287
- updateGroup(newGroup) {
8288
- this.group = newGroup;
8289
- return this;
8290
- }
8291
- draw(displayLabel = true, dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
8292
- if (this.isEmpty()) {
8293
- return this;
8294
- }
8295
- const label = this.group;
8296
- let valueStr;
8297
- let prefix = "";
8298
- if (Number.isNaN(Number(this.value)) === false) {
8299
- const value = this.value;
8300
- let type = "percent";
8301
- let digits = dataFormatDigits.percent;
8302
- let digitsMin = dataFormatDigits.percent;
8303
- let scale = 1;
8304
- if (this.isRelativeLabel === false) {
8305
- digits = dataFormatDigits.decimal;
8306
- digitsMin = dataFormatDigits.decimal;
8307
- scale = measureScale.value;
8308
- type = "decimal";
8309
- }
8310
- valueStr = Formatter.number(Number(value), type, digits, digitsMin, scale);
8311
- if (this.isVarianceLabel && Number(this.value) >= 0) {
8312
- prefix = "+";
8313
- }
8314
- }
8315
- else {
8316
- valueStr = "" + this.value;
8317
- // displayLabel = false;
8318
- }
8319
- const labelStr = prefix + valueStr;
8320
- const text = this.drawLabel(label, labelStr);
8321
- if (displayLabel === false) {
8322
- text.addClass("hide");
8323
- label.addClass("hide");
8324
- }
8325
- return this;
8326
- }
8327
- isEmpty() {
8328
- return this.value == null || "" === this.value;
8329
- }
8330
- setPos(xPosition, yPosition) {
8331
- this.x = xPosition;
8332
- this.y = yPosition;
8333
- return this;
8334
- }
8335
- forceStringTypeDraw() {
8336
- const label = this.group;
8337
- const labelStr = "" + this.value;
8338
- this.drawLabel(label, labelStr);
8339
- return this;
8340
- }
8341
- drawLabel(label, labelStr) {
8342
- const background = this.styles.fontStyles.background || "#ffffff";
8343
- //let text = label.text(labelStr)
8344
- // .leading(1)
8345
- // .addClass(this.CSS_CATEGORIES)
8346
- // .font({anchor: 'middle'})
8347
- // .move(this.x, this.y);
8348
- let labelAnchor = "start";
8349
- const text = label.text(labelStr);
8350
- text.move(this.x, this.y);
8351
- const boxWidth = text.bbox().w;
8352
- const boxHeight = text.bbox().h;
8353
- let rectX = 0;
8354
- let rectY = 0;
8355
- const textX = text.x();
8356
- let textY = text.y();
8357
- if (this.horizontalHookLocation === exports.HookLocation.Left) {
8358
- labelAnchor = "left";
8359
- rectX = text.x();
8360
- }
8361
- else if (this.horizontalHookLocation === exports.HookLocation.Center) {
8362
- labelAnchor = "middle";
8363
- rectX = text.x() - (boxWidth + 2) / 2;
8364
- }
8365
- else if (this.horizontalHookLocation === exports.HookLocation.Right) {
8366
- labelAnchor = "end";
8367
- rectX = text.x() - boxWidth;
8368
- }
8369
- if (this.verticalHookLocation === exports.HookLocation.Center) {
8370
- textY = text.y() - (boxHeight * 1.2) / 2;
8371
- rectY = textY + boxHeight * 0.2;
8372
- }
8373
- else if (this.verticalHookLocation === exports.HookLocation.Top) {
8374
- textY -= boxHeight / 4;
8375
- rectY = textY + boxHeight * 0.2;
8376
- }
8377
- else if (this.verticalHookLocation === exports.HookLocation.Bottom) {
8378
- textY -= boxHeight;
8379
- rectY = textY + boxHeight * 0.2; // + (boxHeight / 2);
8380
- }
8381
- text.move(textX, textY);
8382
- text.font({ anchor: labelAnchor });
8383
- if (this.segmentFillColor != null) {
8384
- text.fill(getContrastTextColor(this.segmentFillColor));
8385
- }
8386
- else {
8387
- label
8388
- .rect(boxWidth + 2, boxHeight * 0.8)
8389
- .stroke(background)
8390
- .fill(background)
8391
- .opacity(0.9)
8392
- .move(rectX - 1, rectY)
8393
- .insertBefore(text);
8394
- }
8395
- return text;
8396
- }
8397
- createElementID(prefix, groupPrefix) {
8398
- return prefix + "_" + groupPrefix + "_" + this.ID_SCENARIOLABEL;
8399
- }
8400
- }
8401
-
8402
- /**
8403
- * Scenario priority for label collision resolution.
8404
- * Lower number = higher priority. AC always wins.
8405
- */
8406
- const SCENARIO_PRIORITY = {
8407
- ac: 1,
8408
- pp: 2,
8409
- fc: 3,
8410
- pl: 4,
8411
- };
8412
- /**
8413
- * Direction a label can be placed relative to its marker.
8414
- */
8415
- exports.LabelDirection = void 0;
8416
- (function (LabelDirection) {
8417
- LabelDirection[LabelDirection["Above"] = 0] = "Above";
8418
- LabelDirection[LabelDirection["Below"] = 1] = "Below";
8419
- LabelDirection[LabelDirection["Left"] = 2] = "Left";
8420
- LabelDirection[LabelDirection["Right"] = 3] = "Right";
8421
- })(exports.LabelDirection || (exports.LabelDirection = {}));
8422
- /**
8423
- * Manages label collision detection across multiple line series in line charts.
8424
- * Tracks the bounding boxes of all registered labels and detects overlaps.
8425
- * Supports scenario-based priority: when labels collide and cannot be repositioned,
8426
- * lower-priority scenario labels are hidden (AC > PP > FC > PL).
8427
- *
8428
- * Uses 4-direction placement: Above, Below, Left, Right.
8429
- */
8430
- class LabelCollisionManager {
8431
- constructor() {
8432
- this.labels = [];
8433
- this.scenarioLabels = [];
8434
- }
8435
- /**
8436
- * Clears all registered labels. Call this before drawing a new chart.
8437
- */
8438
- clear() {
8439
- this.labels = [];
8440
- this.scenarioLabels = [];
8441
- }
8442
- /**
8443
- * Registers a label's bounding box for collision detection.
8444
- */
8445
- register(bounds) {
8446
- this.labels.push(bounds);
8447
- }
8448
- /**
8449
- * Checks if a label at the given bounds would collide with any existing labels.
8450
- */
8451
- hasCollision(bounds) {
8452
- return this.labels.some((existing) => this.intersects(bounds, existing));
8453
- }
8454
- /**
8455
- * Tries each direction in priorityOrder to find a non-colliding placement.
8456
- * Returns the first non-colliding LabelPlacement, or null if all 4 collide
8457
- * with higher-priority scenario labels (meaning this label should be hidden).
8458
- *
8459
- * @param centerX Center X position of the marker
8460
- * @param markerY Y position of the marker center
8461
- * @param width Estimated label width
8462
- * @param height Estimated label height
8463
- * @param pointIndex The data point index
8464
- * @param markerSize The marker size
8465
- * @param scenarioType e.g. "ac", "pp", "fc", "pl"
8466
- * @param priorityOrder Directions to try, in priority order
8467
- */
8468
- getOptimalPlacement(centerX, markerY, width, height, pointIndex, markerSize, scenarioType, priorityOrder) {
8469
- const priority = SCENARIO_PRIORITY[scenarioType] || 99;
8470
- const gap = 8;
8471
- const halfMarker = markerSize / 2;
8472
- // Try each direction in the caller's preferred order
8473
- for (const direction of priorityOrder) {
8474
- const placement = this.calculatePlacementForDirection(centerX, markerY, width, height, pointIndex, halfMarker, gap, direction);
8475
- if (!this.hasCollision(placement.bounds)) {
8476
- return placement;
8477
- }
8478
- }
8479
- // All 4 positions collide. Check if any collide ONLY with lower-priority
8480
- // labels (meaning we could still place here — the other label would lose).
8481
- // But to keep it simple: hide only if all positions collide with higher-priority labels.
8482
- for (const direction of priorityOrder) {
8483
- const placement = this.calculatePlacementForDirection(centerX, markerY, width, height, pointIndex, halfMarker, gap, direction);
8484
- if (!this.collidesWithHigherPriority(placement.bounds, priority)) {
8485
- // This position only collides with equal or lower priority — claim it
8486
- return placement;
8487
- }
8488
- }
8489
- // All positions collide with higher-priority labels — hide
8490
- return null;
8491
- }
8492
- /**
8493
- * Computes the LabelPlacement for a given direction.
8494
- */
8495
- calculatePlacementForDirection(centerX, markerY, width, height, pointIndex, halfMarker, gap, direction) {
8496
- let labelX;
8497
- let labelY;
8498
- let verticalHook;
8499
- let horizontalHook;
8500
- let boundsX;
8501
- let boundsY;
8502
- switch (direction) {
8503
- case exports.LabelDirection.Above:
8504
- labelX = centerX;
8505
- labelY = markerY - halfMarker - gap;
8506
- verticalHook = exports.HookLocation.Bottom;
8507
- horizontalHook = exports.HookLocation.Center;
8508
- boundsX = centerX - width / 2;
8509
- boundsY = markerY - halfMarker - gap - height;
8510
- break;
8511
- case exports.LabelDirection.Below:
8512
- labelX = centerX;
8513
- labelY = markerY + halfMarker + gap;
8514
- verticalHook = exports.HookLocation.Top;
8515
- horizontalHook = exports.HookLocation.Center;
8516
- boundsX = centerX - width / 2;
8517
- // Top hook shifts text up by height/4, so bounds start earlier
8518
- boundsY = markerY + halfMarker + gap - height / 4;
8519
- break;
8520
- case exports.LabelDirection.Left:
8521
- labelX = centerX - halfMarker - gap;
8522
- labelY = markerY;
8523
- verticalHook = exports.HookLocation.Center;
8524
- horizontalHook = exports.HookLocation.Right;
8525
- boundsX = centerX - halfMarker - gap - width;
8526
- // Center hook shifts text up by height*0.6
8527
- boundsY = markerY - height * 0.6;
8528
- break;
8529
- case exports.LabelDirection.Right:
8530
- labelX = centerX + halfMarker + gap;
8531
- labelY = markerY;
8532
- verticalHook = exports.HookLocation.Center;
8533
- horizontalHook = exports.HookLocation.Left;
8534
- boundsX = centerX + halfMarker + gap;
8535
- // Center hook shifts text up by height*0.6
8536
- boundsY = markerY - height * 0.6;
8537
- break;
8538
- }
8539
- const bounds = {
8540
- x: boundsX,
8541
- y: boundsY,
8542
- width,
8543
- height,
8544
- pointIndex,
8545
- preferredHook: verticalHook,
8546
- };
8547
- return { labelX, labelY, verticalHook, horizontalHook, bounds };
8548
- }
8549
- /**
8550
- * Checks if bounds collide with any registered label that has higher priority.
8551
- */
8552
- collidesWithHigherPriority(bounds, priority) {
8553
- return this.labels.some((existing) => {
8554
- if (!existing.scenarioType)
8555
- return false;
8556
- const existingPriority = SCENARIO_PRIORITY[existing.scenarioType] || 99;
8557
- return existingPriority < priority && this.intersects(bounds, existing);
8558
- });
8559
- }
8560
- /**
8561
- * Checks whether a scenario label at the end of a line should be hidden
8562
- * because it's too close to a higher-priority scenario label.
8563
- */
8564
- shouldHideScenarioLabel(x, y, scenarioType, proximityThreshold = 20) {
8565
- const priority = SCENARIO_PRIORITY[scenarioType] || 99;
8566
- if (priority <= 1)
8567
- return false; // AC is never hidden
8568
- return this.scenarioLabels.some((existing) => {
8569
- const existingPriority = SCENARIO_PRIORITY[existing.scenarioType] || 99;
8570
- if (existingPriority >= priority)
8571
- return false;
8572
- const dy = Math.abs(y - existing.y);
8573
- const dx = Math.abs(x - existing.x);
8574
- return dy < proximityThreshold && dx < proximityThreshold;
8575
- });
8576
- }
8577
- /**
8578
- * Registers a scenario label position for proximity checking.
8579
- */
8580
- registerScenarioLabel(x, y, scenarioType) {
8581
- this.scenarioLabels.push({ x, y, scenarioType });
8582
- }
8583
- /**
8584
- * Checks if two bounding boxes intersect (overlap).
8585
- */
8586
- intersects(a, b) {
8587
- return !(a.x + a.width < b.x || // a is completely to the left of b
8588
- b.x + b.width < a.x || // b is completely to the left of a
8589
- a.y + a.height < b.y || // a is completely above b
8590
- b.y + b.height < a.y // b is completely above a
8591
- );
8592
- }
8593
- /**
8594
- * Gets the number of registered labels.
8595
- */
8596
- getLabelCount() {
8597
- return this.labels.length;
8598
- }
8599
- }
8600
-
8601
8201
  exports.CalculateSize = CalculateSize;
8602
8202
  exports.FontStyleAdapter = FontStyleAdapter;
8603
8203
  exports.Formatter = Formatter;
8604
8204
  exports.IBCSRuleSet = IBCSRuleSet;
8605
- exports.IBCS_LAYER_ORDER = IBCS_LAYER_ORDER;
8606
- exports.Label = Label;
8607
- exports.LabelCollisionManager = LabelCollisionManager;
8608
8205
  exports.PaddingAdapter = PaddingAdapter;
8609
- exports.SCENARIO_PRIORITY = SCENARIO_PRIORITY;
8610
8206
  exports.SVGStyleAdapter = SVGStyleAdapter;
8611
8207
  exports.SVGStyleGroupAdapter = SVGStyleGroupAdapter;
8612
- exports.SiPrefix = SiPrefix;
8613
8208
  exports.Svg = Svg;
8614
8209
  exports.VarianceScenario = VarianceScenario;
8615
- exports.getContrastTextColor = getContrastTextColor;
8616
- exports.getScenarioPrefix = getScenarioPrefix;
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ var VarianceMeasure = require('./VarianceMeasure-NY9yhiNV.js');
4
+
5
+ class SVGVariancesStyleGroup {
6
+ constructor(pos, neg, neu) {
7
+ this.pos = pos;
8
+ this.neg = neg;
9
+ this.neu = neu;
10
+ this.needleHeadColour = "#000000";
11
+ }
12
+ getSVGStyle(scenario) {
13
+ if (scenario === "pos") {
14
+ return this.pos;
15
+ }
16
+ if (scenario === "neg") {
17
+ return this.neg;
18
+ }
19
+ if (scenario === "neu") {
20
+ return this.neu;
21
+ }
22
+ return this.neu;
23
+ }
24
+ }
25
+ class SVGVariancesStyleGroupAdapter {
26
+ constructor(svgStyleAdapter) {
27
+ this.svgStyleAdapter = svgStyleAdapter;
28
+ }
29
+ adapt(data) {
30
+ const styleGroup = new SVGVariancesStyleGroup(this.svgStyleAdapter.defaultPos(), this.svgStyleAdapter.defaultNeg(), this.svgStyleAdapter.defaultNeu());
31
+ if (VarianceMeasure.CompareUtil.isExisting(data.pos)) {
32
+ styleGroup.pos = this.svgStyleAdapter.adapt(data.pos);
33
+ }
34
+ if (VarianceMeasure.CompareUtil.isExisting(data.neg)) {
35
+ styleGroup.neg = this.svgStyleAdapter.adapt(data.neg);
36
+ }
37
+ if (VarianceMeasure.CompareUtil.isExisting(data.pp)) {
38
+ styleGroup.neu = this.svgStyleAdapter.adapt(data.neu);
39
+ }
40
+ if (VarianceMeasure.CompareUtil.isString(data.needleHeadColour)) {
41
+ styleGroup.needleHeadColour = data.needleHeadColour;
42
+ }
43
+ return styleGroup;
44
+ }
45
+ default() {
46
+ return new SVGVariancesStyleGroup(this.svgStyleAdapter.defaultPos(), this.svgStyleAdapter.defaultNeg(), this.svgStyleAdapter.defaultNeu());
47
+ }
48
+ }
49
+
50
+ exports.SVGVariancesStyleGroupAdapter = SVGVariancesStyleGroupAdapter;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var contextProtocol = require('./context-protocol-CIuyJKkK.js');
3
+ var contextProtocol = require('./context-protocol-BDrMkhc4.js');
4
4
 
5
5
  const isObject = (obj) => {
6
6
  if (typeof obj === 'object' && obj !== null) {