@bino-bi/bn-template-engine 1.0.0-alpha.6 → 1.0.0-alpha.8

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 (108) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-0d41c5d8.entry.js +1 -0
  3. package/dist/bn-template-engine/p-67538176.entry.js +1 -0
  4. package/dist/bn-template-engine/p-825a07a8.entry.js +1 -0
  5. package/dist/bn-template-engine/p-916296a5.entry.js +1 -0
  6. package/dist/bn-template-engine/{p-1164c0b0.entry.js → p-96006b06.entry.js} +1 -1
  7. package/dist/bn-template-engine/p-B4JfKvVT.js +1 -0
  8. package/dist/bn-template-engine/{p-JNHhIe7t.js → p-B_d-jp99.js} +1 -1
  9. package/dist/bn-template-engine/p-Ck-NYtot.js +1 -0
  10. package/dist/bn-template-engine/p-CnDq0oVa.js +1 -0
  11. package/dist/bn-template-engine/p-DSXNgKLa.js +1 -0
  12. package/dist/bn-template-engine/p-bc711fb0.entry.js +1 -0
  13. package/dist/bn-template-engine/p-e6f646b1.entry.js +1 -0
  14. package/dist/bn-template-engine/p-f41d9242.entry.js +1 -0
  15. package/dist/bn-template-engine/{p-B0lsgVuN.js → p-gFbbuhtl.js} +1 -1
  16. package/dist/cjs/{SVGVariancesStyleGroup-BqAdPYtL.js → bn-asset_20.cjs.entry.js} +21948 -6938
  17. package/dist/cjs/bn-grid.cjs.entry.js +6 -9
  18. package/dist/cjs/bn-image.cjs.entry.js +6 -9
  19. package/dist/cjs/bn-internationalization.cjs.entry.js +5 -6
  20. package/dist/cjs/bn-template-engine.cjs.js +2 -2
  21. package/dist/cjs/bn-template.cjs.entry.js +3 -4
  22. package/dist/cjs/bn-text.cjs.entry.js +7 -10
  23. package/dist/cjs/bn-tree.cjs.entry.js +6 -9
  24. package/dist/cjs/{context-protocol-DRQWrwsA.js → context-protocol-ohYzcb5F.js} +1 -1
  25. package/dist/cjs/editor-companion.cjs.entry.js +2 -2
  26. package/dist/cjs/{index-Cjw0q6gP.js → index-CDKG4xmO.js} +1 -0
  27. package/dist/cjs/loader.cjs.js +2 -2
  28. package/dist/cjs/{scaling-BidPsO53.js → scaling-CIAClQR5.js} +3 -3
  29. package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-D7BKWN2N.js} +2 -2
  30. package/dist/cjs/{withHasError-B8gHkfV2.js → withHasError-Cl2gTQzA.js} +106 -2
  31. package/dist/cjs/{Order-BGx39pS5.js → withStyled-qd94SSb4.js} +648 -6
  32. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +65 -13
  33. package/dist/collection/components/bn-chart-time/bn-chart-time.js +63 -11
  34. package/dist/collection/components/bn-layout-card/bn-layout-card.js +43 -6
  35. package/dist/collection/components/bn-layout-page/bn-layout-page.js +12 -7
  36. package/dist/collection/components/bn-table/bn-table.js +83 -19
  37. package/dist/collection/components/bn-table/ibcs-table.js +68 -3
  38. package/dist/collection/utils/withInheritedProps.js +152 -0
  39. package/dist/components/bn-chart-structure.js +1 -1
  40. package/dist/components/bn-chart-time.js +1 -1
  41. package/dist/components/bn-layout-card.js +1 -1
  42. package/dist/components/bn-layout-page.js +1 -1
  43. package/dist/components/bn-table.js +1 -1
  44. package/dist/components/ibcs-table2.js +1 -1
  45. package/dist/components/withInheritedProps.js +1 -0
  46. package/dist/esm/{SVGVariancesStyleGroup-DOIT-zvI.js → bn-asset_20.entry.js} +22048 -7042
  47. package/dist/esm/bn-grid.entry.js +4 -7
  48. package/dist/esm/bn-image.entry.js +4 -7
  49. package/dist/esm/bn-internationalization.entry.js +4 -5
  50. package/dist/esm/bn-template-engine.js +3 -3
  51. package/dist/esm/bn-template.entry.js +2 -3
  52. package/dist/esm/bn-text.entry.js +5 -8
  53. package/dist/esm/bn-tree.entry.js +4 -7
  54. package/dist/esm/{context-protocol-2peaD4y8.js → context-protocol-DdbSplvE.js} +2 -2
  55. package/dist/esm/editor-companion.entry.js +2 -2
  56. package/dist/esm/{index-JNHhIe7t.js → index-B_d-jp99.js} +1 -1
  57. package/dist/esm/loader.js +3 -3
  58. package/dist/esm/{scaling-BOcjT8M0.js → scaling-DGKKkuL9.js} +4 -4
  59. package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-AFk2wwHT.js} +2 -2
  60. package/dist/esm/{withHasError-B3QX2emi.js → withHasError-DW_vMDUp.js} +106 -2
  61. package/dist/esm/{Order-sRO-lj7X.js → withStyled-BIkqU2w4.js} +616 -1
  62. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +2 -0
  63. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +2 -0
  64. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +16 -2
  65. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +8 -3
  66. package/dist/types/components/bn-table/bn-table.d.ts +1 -0
  67. package/dist/types/components/bn-table/ibcs-table.d.ts +19 -0
  68. package/dist/types/components.d.ts +8 -8
  69. package/dist/types/utils/withInheritedProps.d.ts +38 -0
  70. package/package.json +1 -1
  71. package/dist/bn-template-engine/p-06946f44.entry.js +0 -1
  72. package/dist/bn-template-engine/p-0fabe296.entry.js +0 -1
  73. package/dist/bn-template-engine/p-355abdf0.entry.js +0 -1
  74. package/dist/bn-template-engine/p-79KuA4Ox.js +0 -1
  75. package/dist/bn-template-engine/p-859cc06d.entry.js +0 -1
  76. package/dist/bn-template-engine/p-8acec99e.entry.js +0 -1
  77. package/dist/bn-template-engine/p-8f490c45.entry.js +0 -1
  78. package/dist/bn-template-engine/p-98cf512f.entry.js +0 -1
  79. package/dist/bn-template-engine/p-9a564f8f.entry.js +0 -1
  80. package/dist/bn-template-engine/p-B7p8beYH.js +0 -1
  81. package/dist/bn-template-engine/p-BDh7GfC5.js +0 -1
  82. package/dist/bn-template-engine/p-BoMtoHJB.js +0 -1
  83. package/dist/bn-template-engine/p-Bs8BqBsb.js +0 -1
  84. package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
  85. package/dist/bn-template-engine/p-DG-1MR_T.js +0 -1
  86. package/dist/bn-template-engine/p-bdd2b243.entry.js +0 -1
  87. package/dist/bn-template-engine/p-e6b24f15.entry.js +0 -1
  88. package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
  89. package/dist/bn-template-engine/p-sRO-lj7X.js +0 -1
  90. package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
  91. package/dist/cjs/bn-asset_16.cjs.entry.js +0 -9018
  92. package/dist/cjs/bn-card.cjs.entry.js +0 -36
  93. package/dist/cjs/bn-chart-time.cjs.entry.js +0 -995
  94. package/dist/cjs/bn-layout-card.cjs.entry.js +0 -248
  95. package/dist/cjs/formatter-4XCS0d2B.js +0 -221
  96. package/dist/cjs/ibcs-chart-time.cjs.entry.js +0 -4137
  97. package/dist/cjs/withComponentStatus-_x4LQZ0N.js +0 -109
  98. package/dist/cjs/withComponentStyle-ClSJfCku.js +0 -128
  99. package/dist/cjs/withStyled-9tG024gQ.js +0 -522
  100. package/dist/esm/bn-asset_16.entry.js +0 -9001
  101. package/dist/esm/bn-card.entry.js +0 -34
  102. package/dist/esm/bn-chart-time.entry.js +0 -993
  103. package/dist/esm/bn-layout-card.entry.js +0 -246
  104. package/dist/esm/formatter-BDh7GfC5.js +0 -215
  105. package/dist/esm/ibcs-chart-time.entry.js +0 -4135
  106. package/dist/esm/withComponentStatus-DodoSXe-.js +0 -107
  107. package/dist/esm/withComponentStyle-D3VWOsto.js +0 -126
  108. package/dist/esm/withStyled-CE3_3taP.js +0 -495
@@ -1,3 +1,128 @@
1
+ import { g as getElement, f as forceUpdate } from './index-B_d-jp99.js';
2
+ import { g as getStores, c as clearStoresCache } from './context-protocol-DdbSplvE.js';
3
+ import { r as runIfExisits } from './withHasError-DW_vMDUp.js';
4
+
5
+ const isObject = (obj) => {
6
+ if (typeof obj === 'object' && obj !== null) {
7
+ if (typeof Object.getPrototypeOf === 'function') {
8
+ const prototype = Object.getPrototypeOf(obj);
9
+ return prototype === Object.prototype || prototype === null;
10
+ }
11
+ return Object.prototype.toString.call(obj) === '[object Object]';
12
+ }
13
+ return false;
14
+ };
15
+ const overwriteMerge = (_, currArr) => currArr;
16
+ const combineMerge = (prevArr, currArr) => {
17
+ return [...new Set([...prevArr, ...currArr])];
18
+ };
19
+ const getMergeFn = (type) => {
20
+ switch (type) {
21
+ case 'overwrite':
22
+ return overwriteMerge;
23
+ case 'combine':
24
+ default:
25
+ return combineMerge;
26
+ }
27
+ };
28
+
29
+ const withDefaultOptions = (options) => {
30
+ return {
31
+ arrayMergeType: 'combine',
32
+ arrayMerge: getMergeFn(options ? options.arrayMergeType : 'combine'),
33
+ ...options,
34
+ };
35
+ };
36
+ const merge = (objects, options) => {
37
+ const opts = withDefaultOptions(options);
38
+ return objects.reduce((prev, curr) => {
39
+ Object.keys(curr).forEach((key) => {
40
+ if (Array.isArray(prev[key]) && Array.isArray(curr[key])) {
41
+ if (opts && opts.arrayMerge) {
42
+ prev[key] = opts.arrayMerge(prev[key], curr[key]);
43
+ }
44
+ }
45
+ else if (isObject(prev[key]) && isObject(curr[key])) {
46
+ prev[key] = merge([prev[key], curr[key]], opts);
47
+ }
48
+ else {
49
+ prev[key] = curr[key];
50
+ }
51
+ });
52
+ return prev;
53
+ }, {});
54
+ };
55
+
56
+ /**
57
+ * Mixin that provides themed styling to a Stencil component using a
58
+ * three-layer merge strategy.
59
+ *
60
+ * The effective style is computed by deep-merging three layers in order:
61
+ * 1. `_system` -- built-in defaults (lowest priority)
62
+ * 2. `_default` -- user-defined global overrides
63
+ * 3. The value of the host element's `selected-style` attribute (highest priority)
64
+ *
65
+ * A MutationObserver watches `selected-style` and the store subscription
66
+ * reacts to updates in the componentStyles store, triggering a re-merge
67
+ * and forced re-render on changes.
68
+ *
69
+ * @param component - The Stencil component instance
70
+ * @returns A query function `componentStyle(<selector>)` that provides type-safe
71
+ * access to the merged style object, e.g. `componentStyle(s => s.table.headerBg)`
72
+ */
73
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
+ const withComponentStyle = (component) => {
75
+ let subscription;
76
+ let stores;
77
+ let selectedStyle;
78
+ let style;
79
+ const updateStyle = () => {
80
+ const state = stores.componentStyles.state;
81
+ style = merge([
82
+ state["_system"] || {},
83
+ state["_default"] || {},
84
+ state[selectedStyle] || {},
85
+ ]);
86
+ };
87
+ const observer = new MutationObserver((mutations) => {
88
+ mutations.forEach((mutation) => {
89
+ if (mutation.attributeName === "selected-style") {
90
+ selectedStyle = getElement(component).getAttribute("selected-style");
91
+ updateStyle();
92
+ forceUpdate(component);
93
+ }
94
+ });
95
+ });
96
+ const connectedCallback = component["connectedCallback"];
97
+ component["connectedCallback"] = () => {
98
+ const element = getElement(component);
99
+ stores = getStores(element);
100
+ style = stores.componentStyles.state["_system"];
101
+ observer.observe(element, { attributes: true, attributeFilter: ["selected-style"] });
102
+ selectedStyle = getElement(component).getAttribute("selected-style");
103
+ updateStyle();
104
+ subscription = stores.componentStyles.on("set", (key) => {
105
+ if (key === selectedStyle) {
106
+ selectedStyle = getElement(component).getAttribute("selected-style");
107
+ updateStyle();
108
+ forceUpdate(getElement(component));
109
+ }
110
+ });
111
+ runIfExisits(connectedCallback, component);
112
+ };
113
+ const disconnectedCallback = component["disconnectedCallback"];
114
+ component["disconnectedCallback"] = () => {
115
+ observer.disconnect();
116
+ runIfExisits(subscription);
117
+ clearStoresCache(getElement(component));
118
+ runIfExisits(disconnectedCallback, component);
119
+ };
120
+ const componentStyle = (q) => {
121
+ return q(style);
122
+ };
123
+ return componentStyle;
124
+ };
125
+
1
126
  /** Controls which parts of a component are translated: ALL=labels+data, META=labels only. */
2
127
  var I18nMode;
3
128
  (function (I18nMode) {
@@ -8883,4 +9008,494 @@ class OrderAdapter {
8883
9008
  }
8884
9009
  }
8885
9010
 
8886
- export { AxisLabelsMode as A, BAR_COLUMN_WIDTH_EM as B, ChartMode as C, DateDistance as D, I18nMode as I, MeasureType as M, OrderDirection as O, StackBy as S, TableBarColumnWidth as T, OrderColumn as a, StackOrder as b, StackMode as c, Scenarios as d, Sentiments as e, AggregationLevel as f, DataFormat as g, TableType as h, TableCategoryWidth as i, DateLink as j, CompareUtil as k, DateTime as l, DateStringFactory as m, AdapterUtils as n, OrderAdapter as o };
9011
+ /**
9012
+ * Prop validators for Stencil @Watch handlers.
9013
+ *
9014
+ * Each validator returns an array of invalid items; an empty array means the input is valid.
9015
+ * These are used in component @Watch methods to warn about malformed attribute values
9016
+ * without crashing the component.
9017
+ */
9018
+ /**
9019
+ * Checks whether a value is blank, null, undefined, or the string `"null"`.
9020
+ * The string `"null"` check handles serialized null values from HTML attributes,
9021
+ * which arrive as the literal string "null" rather than a JS null.
9022
+ */
9023
+ function isBlankInput(value) {
9024
+ return value === null || value === undefined || value === "" || value === "null";
9025
+ }
9026
+ /**
9027
+ * Validates a comma-separated list of scenario identifiers.
9028
+ * The special value `"auto"` is always valid. Base scenarios are validated against
9029
+ * the Scenarios enum; remaining invalid entries are passed to `validateVariancesList`
9030
+ * for variance format checking (e.g. `d_ac1_pl1_pos`).
9031
+ */
9032
+ function validateScenarioList(value) {
9033
+ if (isBlankInput(value)) {
9034
+ return [];
9035
+ }
9036
+ if (value.trim().toLowerCase() === "auto") {
9037
+ return [];
9038
+ }
9039
+ const invalidScenarios = value === null || value === void 0 ? void 0 : value.split(",").filter((element) => !(element.toUpperCase().trim() in Scenarios));
9040
+ return validateVariancesList(invalidScenarios.toString());
9041
+ }
9042
+ /**
9043
+ * Validates variance identifiers in the format `d_<base>_<delta>_<sentiment>` or
9044
+ * `dr_<base>_<delta>_<sentiment>`. Each component is checked against the Scenarios
9045
+ * and Sentiments enums. Returns items that fail validation.
9046
+ */
9047
+ function validateVariancesList(value) {
9048
+ if (isBlankInput(value)) {
9049
+ return [];
9050
+ }
9051
+ const invalidScenarios = value
9052
+ .replace(";", ",")
9053
+ .split(",")
9054
+ .filter((element) => {
9055
+ var _a, _b, _c;
9056
+ const splittedElement = element.split("_");
9057
+ const scenarioSubtrahend = (_a = splittedElement[0]) === null || _a === void 0 ? void 0 : _a.replace(/^dr|^d/, "").toUpperCase().trim();
9058
+ const scenarioMinuend = (_b = splittedElement[1]) === null || _b === void 0 ? void 0 : _b.toUpperCase().trim();
9059
+ const scenarioSentiment = (_c = splittedElement[2]) === null || _c === void 0 ? void 0 : _c.toUpperCase().trim();
9060
+ return (splittedElement.length !== 3 ||
9061
+ !(scenarioSubtrahend in Scenarios) ||
9062
+ !(scenarioMinuend in Scenarios) ||
9063
+ !(scenarioSentiment in Sentiments));
9064
+ });
9065
+ return invalidScenarios;
9066
+ }
9067
+ function validateOrderList(value) {
9068
+ if (isBlankInput(value)) {
9069
+ return [];
9070
+ }
9071
+ if (value.trim().toLowerCase() === "auto") {
9072
+ return [];
9073
+ }
9074
+ const invalidScenarios = value.split(",").filter((element) => !(element.toUpperCase() in OrderColumn));
9075
+ return validateVariancesList(invalidScenarios.toString());
9076
+ }
9077
+ function isValidInteger(value) {
9078
+ if (isBlankInput(value)) {
9079
+ return false;
9080
+ }
9081
+ return Number.isInteger(Number(value));
9082
+ }
9083
+ function isValidNumber(value) {
9084
+ if (isBlankInput(value)) {
9085
+ return false;
9086
+ }
9087
+ return !Number.isNaN(Number(value));
9088
+ }
9089
+ function isValidDirection(value) {
9090
+ if (isBlankInput(value)) {
9091
+ return false;
9092
+ }
9093
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in OrderDirection;
9094
+ }
9095
+ function isValidLevel(value) {
9096
+ if ((value === null || value === void 0 ? void 0 : value.toLowerCase()) === "auto") {
9097
+ return true;
9098
+ }
9099
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in AggregationLevel;
9100
+ }
9101
+ function validateMeasureList(value) {
9102
+ if (isBlankInput(value)) {
9103
+ return [];
9104
+ }
9105
+ try {
9106
+ const newObj = JSON.parse(value);
9107
+ if (newObj instanceof Array) {
9108
+ return newObj.filter((elem) => !(elem.hasOwnProperty("name") && elem.hasOwnProperty("unit")));
9109
+ }
9110
+ }
9111
+ catch (e) {
9112
+ console.error("validateMeasureList: failed to parse JSON", e);
9113
+ }
9114
+ return ["Invalid JSON structure"];
9115
+ }
9116
+ function isValidDate(value) {
9117
+ const newDate = Date.parse(value);
9118
+ return Number.isInteger(newDate);
9119
+ }
9120
+ function isValidDateLink(value) {
9121
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in DateLink;
9122
+ }
9123
+ function isValidDateFormat(value) {
9124
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in DateDistance;
9125
+ }
9126
+ function isValidAxisLabelsMode(value) {
9127
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in AxisLabelsMode;
9128
+ }
9129
+ function isValidDataFormat(value) {
9130
+ if (isBlankInput(value)) {
9131
+ return false;
9132
+ }
9133
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in DataFormat;
9134
+ }
9135
+ function isValidBoolean(value) {
9136
+ if (isBlankInput(value)) {
9137
+ return false;
9138
+ }
9139
+ const validValues = ["true", "false", true, false];
9140
+ return validValues.some((elem) => elem === value);
9141
+ }
9142
+ function isValidTableType(value) {
9143
+ if (isBlankInput(value)) {
9144
+ return false;
9145
+ }
9146
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in TableType;
9147
+ }
9148
+ function validateThereOfJsonStr(value) {
9149
+ if (isBlankInput(value)) {
9150
+ return [];
9151
+ }
9152
+ try {
9153
+ const jsonObject = JSON.parse(value);
9154
+ if (jsonObject instanceof Array) {
9155
+ // return newObj.filter(elem => elem.hasOwnProperty('rowgroup') && elem.hasOwnProperty('category') && elem.hasOwnProperty('subcategory'))
9156
+ return jsonObject.filter((elem) => !(elem.hasOwnProperty("rowGroup") && elem.hasOwnProperty("category") && elem.hasOwnProperty("subCategory")));
9157
+ }
9158
+ }
9159
+ catch (err) {
9160
+ console.error("validateThereOfJsonStr: failed to parse JSON", err);
9161
+ }
9162
+ return ["Invalid JSON structure"];
9163
+ }
9164
+ function validatePartOfJsonStr(value) {
9165
+ if (isBlankInput(value)) {
9166
+ return [];
9167
+ }
9168
+ try {
9169
+ const jsonObject = JSON.parse(value);
9170
+ if (jsonObject instanceof Array) {
9171
+ // return newObj.filter(elem => elem.hasOwnProperty('rowgroup') && elem.hasOwnProperty('category') && elem.hasOwnProperty('subcategory'))
9172
+ return jsonObject.filter((elem) => !(elem.hasOwnProperty("rowGroup") && elem.hasOwnProperty("category")));
9173
+ }
9174
+ }
9175
+ catch (e) {
9176
+ console.error("validatePartOfJsonStr: failed to parse JSON", e);
9177
+ }
9178
+ return ["Invalid JSON structure"];
9179
+ }
9180
+ function isValidMeasureType(value) {
9181
+ return (value === null || value === void 0 ? void 0 : value.trim().toUpperCase()) in MeasureType;
9182
+ }
9183
+ /**
9184
+ * Validates a measure-scale attribute value.
9185
+ * Accepted values: `"_"` (no scaling), SI prefix letters (k, M, G, T, P, E, Z, Y, m, etc.),
9186
+ * or auto-detection modes `"GREATEST"` / `"LEAST"`.
9187
+ */
9188
+ function isValidMeasureScale(value) {
9189
+ return (["_", "k", "M", "G", "T", "P", "E", "Z", "Y", "m", "μ", "n", "p", "P", "f", "a", "z", "y"].includes(value === null || value === void 0 ? void 0 : value.trim()) || ["GREATEST", "LEAST"].includes(value === null || value === void 0 ? void 0 : value.trim().toUpperCase()));
9190
+ }
9191
+ function isTableCategoryWidth(value) {
9192
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase().trim()) in TableCategoryWidth;
9193
+ }
9194
+ function isTableBarColumnWidth(value) {
9195
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase().trim()) in TableBarColumnWidth;
9196
+ }
9197
+ function validateColumnThereOfJsonStr(value) {
9198
+ if (isBlankInput(value)) {
9199
+ return [];
9200
+ }
9201
+ try {
9202
+ const jsonObject = JSON.parse(value);
9203
+ return jsonObject.filter((elem) => !(elem.hasOwnProperty("scenario") && elem.hasOwnProperty("name") && elem.hasOwnProperty("subGroups")));
9204
+ }
9205
+ catch (e) {
9206
+ console.error("validateColumnThereOfJsonStr: failed to parse JSON", e);
9207
+ }
9208
+ return ["Invalid JSON structure"];
9209
+ }
9210
+ function validateStackConfig(value) {
9211
+ if (isBlankInput(value)) {
9212
+ return [];
9213
+ }
9214
+ try {
9215
+ const config = JSON.parse(value);
9216
+ if (typeof config !== "object" || config === null || Array.isArray(config)) {
9217
+ return ["stack: must be a JSON object"];
9218
+ }
9219
+ const errors = [];
9220
+ if (!config.hasOwnProperty("by")) {
9221
+ errors.push("stack: 'by' is required");
9222
+ }
9223
+ else {
9224
+ const validBy = ["scenarios", "dimensions"];
9225
+ if (!validBy.includes(config.by)) {
9226
+ errors.push(`stack: 'by' must be one of: ${validBy.join(", ")}`);
9227
+ }
9228
+ }
9229
+ if (config.hasOwnProperty("mode")) {
9230
+ const validModes = ["absolute", "relative", "absolute-relative"];
9231
+ if (!validModes.includes(config.mode)) {
9232
+ errors.push(`stack: 'mode' must be one of: ${validModes.join(", ")}`);
9233
+ }
9234
+ }
9235
+ if (config.hasOwnProperty("order")) {
9236
+ const validOrders = ["asc", "desc", "dataset"];
9237
+ if (!validOrders.includes(config.order)) {
9238
+ errors.push(`stack: 'order' must be one of: ${validOrders.join(", ")}`);
9239
+ }
9240
+ }
9241
+ return errors;
9242
+ }
9243
+ catch (_e) {
9244
+ return ["stack: invalid JSON"];
9245
+ }
9246
+ }
9247
+
9248
+ class StyleSheet {
9249
+ constructor() {
9250
+ this.cache = new Map();
9251
+ this.tag = StyleSheet.makeStyleTag();
9252
+ }
9253
+ static makeStyleTag() {
9254
+ const tag = document.createElement("style");
9255
+ tag.type = "text/css";
9256
+ tag.setAttribute("data-bn-computed-style", "");
9257
+ tag.append(document.createTextNode(""));
9258
+ (document.head || document.querySelector("head")).append(tag);
9259
+ return tag;
9260
+ }
9261
+ apply(data) {
9262
+ data.forEach((value) => this.cache.set(value.className, value.style));
9263
+ this.tag.innerHTML = Array.from(this.cache.values())
9264
+ .map((value) => value)
9265
+ .join("\n");
9266
+ }
9267
+ }
9268
+ const styleSheet = new StyleSheet();
9269
+
9270
+ /* eslint-disable */
9271
+ // Inspired by https://github.com/garycourt/murmurhash-js
9272
+ // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
9273
+ function murmur2(str) {
9274
+ // 'm' and 'r' are mixing constants generated offline.
9275
+ // They're not really 'magic', they just happen to work well.
9276
+ // const m = 0x5bd1e995;
9277
+ // const r = 24;
9278
+ // Initialize the hash
9279
+ var h = 0; // Mix 4 bytes at a time into the hash
9280
+
9281
+ var k,
9282
+ i = 0,
9283
+ len = str.length;
9284
+
9285
+ for (; len >= 4; ++i, len -= 4) {
9286
+ k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
9287
+ k =
9288
+ /* Math.imul(k, m): */
9289
+ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
9290
+ k ^=
9291
+ /* k >>> r: */
9292
+ k >>> 24;
9293
+ h =
9294
+ /* Math.imul(k, m): */
9295
+ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
9296
+ /* Math.imul(h, m): */
9297
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
9298
+ } // Handle the last few bytes of the input array
9299
+
9300
+
9301
+ switch (len) {
9302
+ case 3:
9303
+ h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
9304
+
9305
+ case 2:
9306
+ h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
9307
+
9308
+ case 1:
9309
+ h ^= str.charCodeAt(i) & 0xff;
9310
+ h =
9311
+ /* Math.imul(h, m): */
9312
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
9313
+ } // Do a few final mixes of the hash to ensure the last few
9314
+ // bytes are well-incorporated.
9315
+
9316
+
9317
+ h ^= h >>> 13;
9318
+ h =
9319
+ /* Math.imul(h, m): */
9320
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
9321
+ return ((h ^ h >>> 15) >>> 0).toString(36);
9322
+ }
9323
+
9324
+ const transofrmToUnitString = (value) => {
9325
+ if (isValidNumber(value)) {
9326
+ return `${value}px`;
9327
+ }
9328
+ else {
9329
+ return value;
9330
+ }
9331
+ };
9332
+ const width = {
9333
+ className: "w",
9334
+ cssName: "width",
9335
+ attrName: "width",
9336
+ transform: transofrmToUnitString,
9337
+ };
9338
+ const height = {
9339
+ className: "h",
9340
+ cssName: "height",
9341
+ attrName: "height",
9342
+ transform: transofrmToUnitString,
9343
+ };
9344
+ const position = {
9345
+ className: "pst",
9346
+ cssName: "position",
9347
+ attrName: "position",
9348
+ };
9349
+ const top = {
9350
+ className: "top",
9351
+ cssName: "top",
9352
+ attrName: "top",
9353
+ transform: transofrmToUnitString,
9354
+ };
9355
+ const right = {
9356
+ className: "rgt",
9357
+ cssName: "right",
9358
+ attrName: "right",
9359
+ transform: transofrmToUnitString,
9360
+ };
9361
+ const bottom = {
9362
+ className: "btm",
9363
+ cssName: "bottom",
9364
+ attrName: "bottom",
9365
+ transform: transofrmToUnitString,
9366
+ };
9367
+ const left = {
9368
+ className: "lft",
9369
+ cssName: "left",
9370
+ attrName: "left",
9371
+ transform: transofrmToUnitString,
9372
+ };
9373
+ const fontSize = {
9374
+ className: "fts",
9375
+ cssName: "font-size",
9376
+ attrName: "font-size",
9377
+ transform: transofrmToUnitString,
9378
+ };
9379
+ const gridColumn = {
9380
+ className: "gdc",
9381
+ cssName: "grid-column",
9382
+ attrName: "grid-column",
9383
+ };
9384
+ const gridRow = {
9385
+ className: "gdr",
9386
+ cssName: "grid-row",
9387
+ attrName: "grid-row",
9388
+ };
9389
+ const attributes = {
9390
+ width: width,
9391
+ height: height,
9392
+ position: position,
9393
+ top: top,
9394
+ right: right,
9395
+ bottom: bottom,
9396
+ left: left,
9397
+ "font-size": fontSize,
9398
+ "grid-column": gridColumn,
9399
+ "grid-row": gridRow,
9400
+ };
9401
+ const attributesNames = Object.keys(attributes);
9402
+ function getClassName(attr, value) {
9403
+ const valueKey = murmur2(value);
9404
+ return `bn-c-${attr.className}_${valueKey}`;
9405
+ }
9406
+ function getStyle(attr, className, value) {
9407
+ return `.${className} {${attr.cssName}: ${value};}`;
9408
+ }
9409
+ function getCSS(attr, value) {
9410
+ const className = getClassName(attr, value);
9411
+ const style = getStyle(attr, className, value);
9412
+ return { className, style };
9413
+ }
9414
+ const apply = (el) => {
9415
+ const map = new Map();
9416
+ //map.set("position", getCSS(attributes["position"], "absolute"))
9417
+ attributesNames.forEach((name) => {
9418
+ const value = el.getAttribute(name);
9419
+ if (value) {
9420
+ if (["top", "left", "right", "bottom"].includes(name)) {
9421
+ map.set("position", getCSS(attributes["position"], "absolute"));
9422
+ }
9423
+ const transform = attributes[name].transform ||
9424
+ function (v) {
9425
+ return v;
9426
+ };
9427
+ map.set(name, getCSS(attributes[name], transform(value)));
9428
+ }
9429
+ });
9430
+ return map;
9431
+ };
9432
+
9433
+ /**
9434
+ * Shared MutationObserver that watches for style-attribute changes on all
9435
+ * subscribed elements. When a monitored attribute changes, it re-applies the
9436
+ * Styletron CSS-in-JS stylesheet and updates the element's className,
9437
+ * preserving any non-`bn-c-` classes.
9438
+ */
9439
+ const observer = new MutationObserver((mutations) => {
9440
+ for (const mutation of mutations) {
9441
+ const el = mutation.target;
9442
+ const map = apply(el);
9443
+ styleSheet.apply(map);
9444
+ const classes = Array.from(map.values()).map((value) => value.className);
9445
+ el.className = el.className
9446
+ .split(" ")
9447
+ .filter((value) => !value.startsWith("bn-c-"))
9448
+ .concat(...classes)
9449
+ .join(" ");
9450
+ forceUpdate(el);
9451
+ }
9452
+ });
9453
+ /**
9454
+ * Registers an element with the Styletron observer: applies the initial
9455
+ * stylesheet, assigns generated `bn-c-*` class names, and begins watching
9456
+ * for attribute mutations that affect styling.
9457
+ */
9458
+ const subscribe = (el) => {
9459
+ const map = apply(el);
9460
+ styleSheet.apply(map);
9461
+ const classes = Array.from(map.values()).map((value) => value.className);
9462
+ el.className = el.className
9463
+ .split(" ")
9464
+ .filter((value) => !value.startsWith("bn-c-"))
9465
+ .concat(...classes)
9466
+ .join(" ");
9467
+ observer.observe(el, { attributes: true, attributeFilter: attributesNames, childList: false, subtree: false });
9468
+ };
9469
+ /**
9470
+ * Mixin that integrates Styletron CSS-in-JS styling into a Stencil component.
9471
+ *
9472
+ * On `connectedCallback`, it subscribes the host element to a shared
9473
+ * MutationObserver that watches for style-related attribute changes. When
9474
+ * attributes change, the Styletron stylesheet is re-applied and the element's
9475
+ * class list is updated with generated `bn-c-*` class names, followed by a
9476
+ * forced re-render.
9477
+ *
9478
+ * @param component - The Stencil component instance
9479
+ */
9480
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9481
+ const withStyled = (component) => {
9482
+ const cstrConnectedCallback = component["connectedCallback"];
9483
+ const cstrDisconnectedCallback = component["disconnectedCallback"];
9484
+ component["connectedCallback"] = () => {
9485
+ const elm = getElement(component);
9486
+ if (elm) {
9487
+ subscribe(elm);
9488
+ }
9489
+ else {
9490
+ throw new Error(`Can't find element field in component ${undefined}`);
9491
+ }
9492
+ runIfExisits(cstrConnectedCallback, component);
9493
+ };
9494
+ component["disconnectedCallback"] = () => {
9495
+ // MutationObserver has no per-element unobserve — the shared observer
9496
+ // automatically stops firing for elements removed from the DOM.
9497
+ runIfExisits(cstrDisconnectedCallback, component);
9498
+ };
9499
+ };
9500
+
9501
+ export { AggregationLevel as A, isTableCategoryWidth as B, ChartMode as C, DateDistance as D, validateColumnThereOfJsonStr as E, DataFormat as F, BAR_COLUMN_WIDTH_EM as G, TableBarColumnWidth as H, I18nMode as I, validateMeasureList as J, isValidDate as K, isValidDateLink as L, MeasureType as M, DateLink as N, OrderDirection as O, DateTime as P, AdapterUtils as Q, CompareUtil as R, StackBy as S, TableCategoryWidth as T, OrderAdapter as U, DateStringFactory as V, withComponentStyle as a, isValidNumber as b, validateVariancesList as c, isValidLevel as d, validateOrderList as e, isValidDirection as f, isValidInteger as g, isValidMeasureScale as h, isValidBoolean as i, validateStackConfig as j, isBlankInput as k, OrderColumn as l, StackOrder as m, StackMode as n, isValidDateFormat as o, isValidAxisLabelsMode as p, AxisLabelsMode as q, murmur2 as r, isTableBarColumnWidth as s, isValidDataFormat as t, isValidTableType as u, validateScenarioList as v, withStyled as w, validateThereOfJsonStr as x, validatePartOfJsonStr as y, isValidMeasureType as z };
@@ -18,6 +18,7 @@ export declare class Chart {
18
18
  private readonly t;
19
19
  private readonly componentStyle;
20
20
  private readonly errors;
21
+ private readonly resolveInherited;
21
22
  /**
22
23
  * Title displayed above the chart. When empty, the title is derived
23
24
  * from the variance scenario labels (if variances are configured).
@@ -250,6 +251,7 @@ export declare class Chart {
250
251
  componentWillLoad(): void;
251
252
  private _autoScaleGuard;
252
253
  componentDidRender(): void;
254
+ componentDidLoad(): void;
253
255
  /**
254
256
  * Emits an error when a custom unit-scaling value causes the chart to exceed its container width.
255
257
  * Skipped for auto/unset unit-scaling since auto-fit handles width.
@@ -18,6 +18,7 @@ export declare class Chart {
18
18
  private readonly t;
19
19
  private readonly componentStyle;
20
20
  private readonly errors;
21
+ private readonly resolveInherited;
21
22
  /**
22
23
  * Custom chart title
23
24
  */
@@ -290,6 +291,7 @@ export declare class Chart {
290
291
  componentWillLoad(): void;
291
292
  private _autoScaleGuard;
292
293
  componentDidRender(): void;
294
+ componentDidLoad(): void;
293
295
  prepareDimension(): ParentDimensions;
294
296
  private prepareScenarios;
295
297
  private prepareAvg;
@@ -1,6 +1,7 @@
1
1
  export declare class LayoutCard {
2
2
  private element;
3
3
  private readonly errors;
4
+ private readonly resolveInherited;
4
5
  private stores;
5
6
  constructor();
6
7
  connectedCallback(): void;
@@ -151,8 +152,14 @@ export declare class LayoutCard {
151
152
  cardGridGap: string;
152
153
  /**
153
154
  * When `true`, the card shrinks to fit its content (`fit-content`)
154
- * for both width and height. When `false`, the card stretches to
155
- * fill its parent (`100%`).
155
+ * for both width and height. When `false` (default), the card stretches
156
+ * to fill its parent (`100%`).
157
+ * <br /><br />
158
+ * Use `false` (default) when the card contains components with
159
+ * auto-scaling (e.g. `unit-scaling="auto"`), because auto-scaling
160
+ * needs a fixed parent width to calculate dimensions. `fit-content`
161
+ * creates a circular dependency where the card width depends on the
162
+ * child content but the child needs the card width to render.
156
163
  */
157
164
  cardFitToContent: boolean;
158
165
  /**
@@ -172,6 +179,13 @@ export declare class LayoutCard {
172
179
  getNumberOfSlot(name: string): Promise<number>;
173
180
  componentDidUpdate(): void;
174
181
  setCardClass(): string;
182
+ /**
183
+ * When the card itself inherits a title prop from a page, write the
184
+ * resolved value back to the host element's attribute so that child
185
+ * vis components (bn-table, bn-chart-*) performing their own DOM walk
186
+ * read the actual value instead of the literal "inherited-page" keyword.
187
+ */
188
+ private reflectInheritedAttrs;
175
189
  prepareTitleImage(value: string): string;
176
190
  render(): any;
177
191
  }