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

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 (157) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-06946f44.entry.js +1 -0
  3. package/dist/bn-template-engine/p-0fabe296.entry.js +1 -0
  4. package/dist/bn-template-engine/p-1164c0b0.entry.js +1 -0
  5. package/dist/bn-template-engine/p-355abdf0.entry.js +1 -0
  6. package/dist/bn-template-engine/p-79KuA4Ox.js +1 -0
  7. package/dist/bn-template-engine/p-859cc06d.entry.js +1 -0
  8. package/dist/bn-template-engine/p-8acec99e.entry.js +1 -0
  9. package/dist/bn-template-engine/p-8f490c45.entry.js +1 -0
  10. package/dist/bn-template-engine/p-98cf512f.entry.js +1 -0
  11. package/dist/bn-template-engine/p-9a564f8f.entry.js +1 -0
  12. package/dist/bn-template-engine/{p-CL1RYuNU.js → p-B0lsgVuN.js} +1 -1
  13. package/dist/bn-template-engine/p-B7p8beYH.js +1 -0
  14. package/dist/bn-template-engine/p-BDh7GfC5.js +1 -0
  15. package/dist/bn-template-engine/p-BoMtoHJB.js +1 -0
  16. package/dist/bn-template-engine/p-Bs8BqBsb.js +1 -0
  17. package/dist/bn-template-engine/p-CYjZRKdI.js +1 -0
  18. package/dist/bn-template-engine/{p-P7pGJBgc.js → p-DG-1MR_T.js} +1 -1
  19. package/dist/bn-template-engine/p-bdd2b243.entry.js +1 -0
  20. package/dist/bn-template-engine/p-e6b24f15.entry.js +1 -0
  21. package/dist/bn-template-engine/p-f27995c9.entry.js +1 -0
  22. package/dist/bn-template-engine/{p-Bnhh02CF.js → p-sRO-lj7X.js} +1 -1
  23. package/dist/bn-template-engine/p-tzFCK9qn.js +1 -0
  24. package/dist/cjs/{Order-iG11HI4R.js → Order-BGx39pS5.js} +448 -0
  25. package/dist/cjs/{alasql.min-C_nHTuEQ.js → SVGVariancesStyleGroup-BqAdPYtL.js} +8228 -3
  26. package/dist/cjs/bn-asset_16.cjs.entry.js +9018 -0
  27. package/dist/cjs/bn-card.cjs.entry.js +3 -4
  28. package/dist/cjs/bn-chart-time.cjs.entry.js +11 -16
  29. package/dist/cjs/bn-grid.cjs.entry.js +5 -8
  30. package/dist/cjs/bn-image.cjs.entry.js +5 -8
  31. package/dist/cjs/bn-internationalization.cjs.entry.js +3 -4
  32. package/dist/cjs/bn-layout-card.cjs.entry.js +125 -6
  33. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  34. package/dist/cjs/bn-template.cjs.entry.js +2 -3
  35. package/dist/cjs/bn-text.cjs.entry.js +7 -11
  36. package/dist/cjs/bn-tree.cjs.entry.js +5 -8
  37. package/dist/cjs/{formatter-DIJL_crx.js → formatter-4XCS0d2B.js} +8 -2
  38. package/dist/cjs/ibcs-chart-time.cjs.entry.js +37 -42
  39. package/dist/cjs/loader.cjs.js +1 -1
  40. package/dist/cjs/{scaling-9Tz595RQ.js → scaling-BidPsO53.js} +115 -12
  41. package/dist/cjs/{withBodyObserver-CKpSD8UT.js → withBodyObserver-C6gLgq_e.js} +3 -3
  42. package/dist/cjs/{withComponentStatus-Bw70BhO0.js → withComponentStatus-_x4LQZ0N.js} +5 -5
  43. package/dist/cjs/{withComponentStyle-aIbTCtfj.js → withComponentStyle-ClSJfCku.js} +4 -4
  44. package/dist/cjs/{utils-CwHIVbbL.js → withHasError-B8gHkfV2.js} +69 -1
  45. package/dist/cjs/{withStyled-CS1Yp4sv.js → withStyled-9tG024gQ.js} +62 -9
  46. package/dist/collection/components/bn-layout-card/bn-layout-card.css +1 -0
  47. package/dist/collection/components/bn-layout-card/bn-layout-card.js +162 -27
  48. package/dist/collection/components/bn-layout-page/bn-layout-page.css +1 -0
  49. package/dist/collection/components/bn-layout-page/bn-layout-page.js +151 -33
  50. package/dist/collection/utils/parentDimensions.js +38 -6
  51. package/dist/components/bn-layout-card.js +1 -1
  52. package/dist/components/bn-layout-page.js +1 -1
  53. package/dist/components/scaling.js +1 -1
  54. package/dist/esm/{Order-Bnhh02CF.js → Order-sRO-lj7X.js} +448 -1
  55. package/dist/esm/{alasql.min-CWu4NkIt.js → SVGVariancesStyleGroup-DOIT-zvI.js} +8212 -2
  56. package/dist/esm/bn-asset_16.entry.js +9001 -0
  57. package/dist/esm/bn-card.entry.js +4 -5
  58. package/dist/esm/bn-chart-time.entry.js +8 -13
  59. package/dist/esm/bn-grid.entry.js +6 -9
  60. package/dist/esm/bn-image.entry.js +6 -9
  61. package/dist/esm/bn-internationalization.entry.js +4 -5
  62. package/dist/esm/bn-layout-card.entry.js +126 -7
  63. package/dist/esm/bn-template-engine.js +1 -1
  64. package/dist/esm/bn-template.entry.js +2 -3
  65. package/dist/esm/bn-text.entry.js +7 -11
  66. package/dist/esm/bn-tree.entry.js +6 -9
  67. package/dist/esm/{context-protocol-BHnQsVsr.js → context-protocol-2peaD4y8.js} +1 -1
  68. package/dist/esm/editor-companion.entry.js +1 -1
  69. package/dist/esm/{formatter-DTMEZ6d8.js → formatter-BDh7GfC5.js} +6 -2
  70. package/dist/esm/ibcs-chart-time.entry.js +3 -8
  71. package/dist/esm/loader.js +1 -1
  72. package/dist/esm/{scaling-Cehc74IE.js → scaling-BOcjT8M0.js} +112 -10
  73. package/dist/esm/{withBodyObserver-FQ8NwCIz.js → withBodyObserver-DczL5ia8.js} +1 -1
  74. package/dist/esm/{withComponentStatus-DWjDYtZ7.js → withComponentStatus-DodoSXe-.js} +1 -1
  75. package/dist/esm/{withComponentStyle-9uP_hcDq.js → withComponentStyle-D3VWOsto.js} +2 -2
  76. package/dist/esm/{utils-DvvwfRQG.js → withHasError-B3QX2emi.js} +69 -1
  77. package/dist/esm/{withStyled--qQWquTH.js → withStyled-CE3_3taP.js} +57 -5
  78. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +139 -0
  79. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +154 -0
  80. package/dist/types/components.d.ts +168 -0
  81. package/dist/types/utils/parentDimensions.d.ts +6 -1
  82. package/package.json +1 -1
  83. package/dist/bn-template-engine/p-1265d8d3.entry.js +0 -1
  84. package/dist/bn-template-engine/p-15516dac.entry.js +0 -1
  85. package/dist/bn-template-engine/p-1c716641.entry.js +0 -1
  86. package/dist/bn-template-engine/p-1jFf17Vj.js +0 -1
  87. package/dist/bn-template-engine/p-27cc8dc0.entry.js +0 -1
  88. package/dist/bn-template-engine/p-3b4c7425.entry.js +0 -1
  89. package/dist/bn-template-engine/p-4426d484.entry.js +0 -1
  90. package/dist/bn-template-engine/p-51f8dc9e.entry.js +0 -1
  91. package/dist/bn-template-engine/p-53d4e690.entry.js +0 -1
  92. package/dist/bn-template-engine/p-5KQYRQLK.js +0 -1
  93. package/dist/bn-template-engine/p-7337e03d.entry.js +0 -1
  94. package/dist/bn-template-engine/p-75e97c87.entry.js +0 -1
  95. package/dist/bn-template-engine/p-7a560278.entry.js +0 -1
  96. package/dist/bn-template-engine/p-BFTU3MAI.js +0 -1
  97. package/dist/bn-template-engine/p-BYBpC0EO.js +0 -1
  98. package/dist/bn-template-engine/p-BYmPQYxx.js +0 -1
  99. package/dist/bn-template-engine/p-BfXY5dsy.js +0 -1
  100. package/dist/bn-template-engine/p-BgnHJQ9Q.js +0 -1
  101. package/dist/bn-template-engine/p-Bhd_WSML.js +0 -1
  102. package/dist/bn-template-engine/p-Bka-Z6jo.js +0 -1
  103. package/dist/bn-template-engine/p-C7dQL8CS.js +0 -1
  104. package/dist/bn-template-engine/p-CYwd_ZNM.js +0 -1
  105. package/dist/bn-template-engine/p-ChlK-T9I.js +0 -1
  106. package/dist/bn-template-engine/p-DHezf8pZ.js +0 -1
  107. package/dist/bn-template-engine/p-DlppAFq9.js +0 -1
  108. package/dist/bn-template-engine/p-DvDDgmcV.js +0 -1
  109. package/dist/bn-template-engine/p-DvvwfRQG.js +0 -1
  110. package/dist/bn-template-engine/p-abc0067c.entry.js +0 -1
  111. package/dist/bn-template-engine/p-b34eaf86.entry.js +0 -1
  112. package/dist/bn-template-engine/p-bdb8b44c.entry.js +0 -1
  113. package/dist/bn-template-engine/p-c44fcb8e.entry.js +0 -1
  114. package/dist/bn-template-engine/p-c7e1a49b.entry.js +0 -1
  115. package/dist/bn-template-engine/p-d9003041.entry.js +0 -1
  116. package/dist/bn-template-engine/p-daa7ffa3.entry.js +0 -1
  117. package/dist/bn-template-engine/p-e084f50a.entry.js +0 -1
  118. package/dist/bn-template-engine/p-eaba6658.entry.js +0 -1
  119. package/dist/bn-template-engine/p-u8igQLRZ.js +0 -1
  120. package/dist/cjs/DataFormatDigits-DKcOeLNK.js +0 -142
  121. package/dist/cjs/DateStringFactory-CSKvbS8K.js +0 -452
  122. package/dist/cjs/SVGVariancesStyleGroup-K-Tw6lOD.js +0 -7960
  123. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +0 -10
  124. package/dist/cjs/bn-asset.cjs.entry.js +0 -42
  125. package/dist/cjs/bn-body_4.cjs.entry.js +0 -748
  126. package/dist/cjs/bn-chart-structure_5.cjs.entry.js +0 -3948
  127. package/dist/cjs/bn-component-style.cjs.entry.js +0 -44
  128. package/dist/cjs/bn-dataset.cjs.entry.js +0 -306
  129. package/dist/cjs/bn-layout-page.cjs.entry.js +0 -143
  130. package/dist/cjs/bn-message.cjs.entry.js +0 -52
  131. package/dist/cjs/bn-table.cjs.entry.js +0 -981
  132. package/dist/cjs/contentDecoder-JxOldq1e.js +0 -419
  133. package/dist/cjs/emotion-hash.esm-nbbEQ0Dn.js +0 -57
  134. package/dist/cjs/ibcs-table.cjs.entry.js +0 -2276
  135. package/dist/cjs/ibcsRuleSet-DgUoXOfd.js +0 -136
  136. package/dist/cjs/index-Dm85hG6t.js +0 -65
  137. package/dist/cjs/withHasError-D7ue5vAv.js +0 -72
  138. package/dist/cjs/withTranslation-rwgyITqe.js +0 -77
  139. package/dist/esm/DataFormatDigits-oSZ1hBKE.js +0 -137
  140. package/dist/esm/DateStringFactory-CSGz6TDk.js +0 -450
  141. package/dist/esm/SVGVariancesStyleGroup-CqTjrZYg.js +0 -7950
  142. package/dist/esm/_commonjsHelpers-BFTU3MAI.js +0 -7
  143. package/dist/esm/bn-asset.entry.js +0 -40
  144. package/dist/esm/bn-body_4.entry.js +0 -743
  145. package/dist/esm/bn-chart-structure_5.entry.js +0 -3942
  146. package/dist/esm/bn-component-style.entry.js +0 -42
  147. package/dist/esm/bn-dataset.entry.js +0 -304
  148. package/dist/esm/bn-layout-page.entry.js +0 -141
  149. package/dist/esm/bn-message.entry.js +0 -50
  150. package/dist/esm/bn-table.entry.js +0 -979
  151. package/dist/esm/contentDecoder-oMmxz6nJ.js +0 -416
  152. package/dist/esm/emotion-hash.esm-BYBpC0EO.js +0 -55
  153. package/dist/esm/ibcs-table.entry.js +0 -2274
  154. package/dist/esm/ibcsRuleSet-K4ytuA1f.js +0 -133
  155. package/dist/esm/index-DHezf8pZ.js +0 -65
  156. package/dist/esm/withHasError-FyY5mQ_3.js +0 -70
  157. package/dist/esm/withTranslation-BqD0Kp7b.js +0 -75
@@ -1,133 +0,0 @@
1
- import { f as AdapterUtils } from './Order-Bnhh02CF.js';
2
- import { V as VarianceScenario } from './formatter-DTMEZ6d8.js';
3
-
4
- class StringAdapter {
5
- adapt(data) {
6
- return AdapterUtils.adaptDefaultString(data);
7
- }
8
- default() {
9
- return "";
10
- }
11
- }
12
-
13
- /**
14
- * IBCS rule set defining scenario→style mappings per IBCS notation standard v1.2.
15
- *
16
- * Color indices encode IBCS visual encoding:
17
- * - 10 = AC: solid dark fill
18
- * - 20 = PP: light gray fill
19
- * - 30 = FC: hatched pattern fill
20
- * - 50 = PL: outlined (no fill)
21
- *
22
- * Sort indices determine column display order: PP(100s) < PL(200s) < FC(300s) < AC(400s).
23
- * Variance columns add +1000 (absolute) or +2000 (relative) to the base sort index.
24
- * Within each group, variant number (1-4) adds multiples of 10.
25
- */
26
- class IBCSRuleSet {
27
- constructor() {
28
- // defines scenario sortIndex an colour PP, PL, FC, AC,
29
- this._dateFormat = {
30
- year: "YYYY",
31
- quarter: "Q[Q] YYYY",
32
- month: "MMM YYYY",
33
- locale: "[KW]WW YYYY",
34
- day: "DD.MM.YYYY",
35
- };
36
- this._dateLinkFormat = {
37
- avg: "Ø[DATE]",
38
- interval: "[DATE]..[DATE]",
39
- start: ".[DATE]",
40
- end: "[DATE].",
41
- ytd: "_[DATE]",
42
- ytg: "[DATE]_",
43
- cum: "[DATE]_[DATE]",
44
- mat: "~[DATE]",
45
- none: "[DATE]",
46
- };
47
- this._scenarioMap = new Map();
48
- this._fallBackScenario = {
49
- name: "Series",
50
- group: "Series",
51
- colorIndex: 10,
52
- sortIndex: 120,
53
- };
54
- this.createScenarioMapEntry("ac", "AC", 10, 400);
55
- this.createScenarioMapEntry("fc", "FC", 30, 300);
56
- this.createScenarioMapEntry("pl", "PL", 50, 200);
57
- this.createScenarioMapEntry("bu", "BU", 50, 200);
58
- this.createScenarioMapEntry("pp", "PP", 20, 100);
59
- this.createScenarioMapEntry("py", "PY", 20, 100);
60
- this.createScenarioMapEntry("dac", "dAC", 10, 1400);
61
- this.createScenarioMapEntry("dfc", "dFC", 30, 1300);
62
- this.createScenarioMapEntry("dpl", "dPL", 50, 1200);
63
- this.createScenarioMapEntry("dbu", "dBU", 50, 1200);
64
- this.createScenarioMapEntry("dpp", "dPP", 20, 1100);
65
- this.createScenarioMapEntry("dpy", "dPY", 20, 1100);
66
- this.createScenarioMapEntry("drac", "drAC", 10, 2400);
67
- this.createScenarioMapEntry("drfc", "drFC", 30, 2300);
68
- this.createScenarioMapEntry("drpl", "drPL", 50, 2200);
69
- this.createScenarioMapEntry("drbu", "drBU", 50, 2200);
70
- this.createScenarioMapEntry("drpp", "drPP", 20, 2100);
71
- this.createScenarioMapEntry("drpy", "drPY", 20, 2100);
72
- }
73
- createScenarioMapEntry(key, name, colorIndex, sortIndex) {
74
- const range = [1, 2, 3, 4];
75
- const _group = name;
76
- const _colorIndex = colorIndex;
77
- range.forEach((element) => {
78
- const _key = key + element;
79
- const _name = name + element;
80
- const _sortIndex = sortIndex + element * 10;
81
- this._scenarioMap.set(_key, { name: _name, group: _group, colorIndex: _colorIndex, sortIndex: _sortIndex });
82
- });
83
- }
84
- getScenario(scenarioName) {
85
- if (this._scenarioMap.has(scenarioName)) {
86
- return this._scenarioMap.get(scenarioName);
87
- }
88
- else {
89
- return this._fallBackScenario;
90
- }
91
- }
92
- getScenarioGroup(scenarioName) {
93
- if (this._scenarioMap.has(scenarioName)) {
94
- return this._scenarioMap.get(scenarioName).name;
95
- }
96
- else {
97
- return this._fallBackScenario.name;
98
- }
99
- }
100
- getScenarioColorIndex(scenarioName) {
101
- if (this._scenarioMap.has(scenarioName)) {
102
- return this._scenarioMap.get(scenarioName).colorIndex;
103
- }
104
- else {
105
- return this._fallBackScenario.colorIndex;
106
- }
107
- }
108
- getScenarioSorIndex(scenarioName) {
109
- const normalizedScenario = this.normalizeVarianceScenario(scenarioName);
110
- if (this._scenarioMap.has(normalizedScenario)) {
111
- return this._scenarioMap.get(normalizedScenario).sortIndex;
112
- }
113
- else {
114
- return this._fallBackScenario.sortIndex;
115
- }
116
- }
117
- /**
118
- * Strips the base scenario from a variance column name, returning type+delta for sort index lookup.
119
- * Example: `"dac1_pl1_pos"` → `"dpl1"`, `"drac1_pl1_neg"` → `"drpl1"`
120
- */
121
- normalizeVarianceScenario(scenario) {
122
- if (scenario === null || scenario === undefined) {
123
- return "";
124
- }
125
- const scenarios = new VarianceScenario(scenario);
126
- if (!scenarios.isValid) {
127
- return scenario;
128
- }
129
- return scenarios.type + scenarios.delta;
130
- }
131
- }
132
-
133
- export { IBCSRuleSet as I, StringAdapter as S };
@@ -1,65 +0,0 @@
1
- /** Sentinel value indicating all groups should be included. */
2
- var GroupSelection;
3
- (function (GroupSelection) {
4
- GroupSelection[GroupSelection["ALL"] = -1] = "ALL";
5
- })(GroupSelection || (GroupSelection = {}));
6
- /**
7
- * Tracks whether a factory's output is current or needs recalculation.
8
- * Used to avoid redundant re-rendering when underlying data has not changed.
9
- */
10
- var FactoryState;
11
- (function (FactoryState) {
12
- /** Output matches the current input data. */
13
- FactoryState[FactoryState["UP_TO_DATE"] = 0] = "UP_TO_DATE";
14
- /** Input data has changed; output needs to be regenerated. */
15
- FactoryState[FactoryState["DIRTY"] = 1] = "DIRTY";
16
- })(FactoryState || (FactoryState = {}));
17
- /**
18
- * Table aggregation modes controlling how rows are grouped and totalled.
19
- *
20
- * - `LIST` -- Flat list with no aggregation.
21
- * - `SUM` -- Grouped rows with sum totals per group and a grand total.
22
- * - `SUMNOTOTAL` -- Grouped rows with group sums but no grand total row.
23
- * - `OPT` -- Operation-aware aggregation (respects the +/- operation field).
24
- * - `OPTNOTOTAL` -- Operation-aware aggregation without a grand total row.
25
- */
26
- var TableType;
27
- (function (TableType) {
28
- TableType["LIST"] = "list";
29
- TableType["SUM"] = "sum";
30
- TableType["SUMNOTOTAL"] = "sumnototal";
31
- TableType["OPT"] = "opt";
32
- TableType["OPTNOTOTAL"] = "optnototal";
33
- })(TableType || (TableType = {}));
34
- var OrderDirection;
35
- (function (OrderDirection) {
36
- OrderDirection["ASC"] = "asc";
37
- OrderDirection["DESC"] = "desc";
38
- })(OrderDirection || (OrderDirection = {}));
39
- /**
40
- * Discriminator for rendered table rows, controlling visual styling and behavior.
41
- *
42
- * - `HEADER` -- Column header row.
43
- * - `GROUPHEAD` -- Group title row (rendered when `grouped` is true).
44
- * - `SEPERATORLINE` -- Visual divider between groups.
45
- * - `SUM` -- Grand total row.
46
- * - `GROUPSUM` -- Sub-total row for a single group.
47
- * - `DRILLELEMENT` -- "Thereof" drill-down sub-row.
48
- * - `STANDARD` -- Normal data row.
49
- * - `PARTELEMENT` -- "Part of" percentage row.
50
- * - `ENTRY` -- Generic entry row.
51
- */
52
- var TableRowType;
53
- (function (TableRowType) {
54
- TableRowType["HEADER"] = "HEADER";
55
- TableRowType["GROUPHEAD"] = "GROUPHEAD";
56
- TableRowType["SEPERATORLINE"] = "SEPERATORLINE";
57
- TableRowType["SUM"] = "SUM";
58
- TableRowType["GROUPSUM"] = "GROUP_SUM";
59
- TableRowType["DRILLELEMENT"] = "DRILLELEMENT";
60
- TableRowType["STANDARD"] = "STANDARD";
61
- TableRowType["PARTELEMENT"] = "PARTELEMENT";
62
- TableRowType["ENTRY"] = "ENTRY";
63
- })(TableRowType || (TableRowType = {}));
64
-
65
- export { FactoryState as F, OrderDirection as O, TableType as T, TableRowType as a };
@@ -1,70 +0,0 @@
1
- import { g as getElement } from './index-JNHhIe7t.js';
2
- import { a as ref } from './utils-DvvwfRQG.js';
3
-
4
- const urlAlphabet =
5
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
6
-
7
- /* @ts-self-types="./index.d.ts" */
8
- let nanoid = (size = 21) => {
9
- let id = '';
10
- let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)));
11
- while (size--) {
12
- id += urlAlphabet[bytes[size] & 63];
13
- }
14
- return id
15
- };
16
-
17
- /**
18
- * Mixin that provides an {@link ErrorDispatcher} for managing validation
19
- * errors and warnings on a component.
20
- *
21
- * Errors are stored internally via a reactive {@link ref}. On every change,
22
- * the host element's `has-error` attribute is updated with a JSON-serialized
23
- * array of {@link ErrorItem}s (or removed when empty). This allows external
24
- * CSS selectors and parent components to detect error states declaratively.
25
- *
26
- * @param component - The Stencil component instance
27
- * @returns An {@link ErrorDispatcher} for adding, replacing, and removing errors
28
- */
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
- const withHasError = (component) => {
31
- const { set, modify } = ref([], (items) => {
32
- const elm = getElement(component);
33
- if (items.length === 0) {
34
- elm.removeAttribute("has-error");
35
- }
36
- else {
37
- elm.setAttribute("has-error", JSON.stringify(items));
38
- }
39
- });
40
- return {
41
- clear: () => {
42
- set([]);
43
- },
44
- replace: (errors) => {
45
- set(errors.map((item) => {
46
- if (!item.id) {
47
- item.id = nanoid();
48
- }
49
- return item;
50
- }));
51
- },
52
- add: (error) => {
53
- if (!error.id)
54
- error.id = nanoid();
55
- modify((current) => [...current, error]);
56
- return error.id;
57
- },
58
- addOrReplace: (error) => {
59
- if (error.id === undefined)
60
- throw "missing";
61
- modify((current) => [...current.filter((item) => item.id !== error.id), error]);
62
- return error.id;
63
- },
64
- remove: (id) => {
65
- modify((current) => current.filter((item) => item.id !== id));
66
- },
67
- };
68
- };
69
-
70
- export { withHasError as w };
@@ -1,75 +0,0 @@
1
- import { g as getStores, c as clearStoresCache } from './context-protocol-BHnQsVsr.js';
2
- import { g as getElement, f as forceUpdate } from './index-JNHhIe7t.js';
3
- import { r as runIfExisits } from './utils-DvvwfRQG.js';
4
-
5
- /**
6
- * Mixin that provides i18n translation support to a Stencil component.
7
- *
8
- * Returns an object with a `t(key, data?)` function for looking up translated strings.
9
- *
10
- * **Key resolution shortcuts:**
11
- * - A key starting with `.` (e.g. `.label`) is expanded to `<component-tag>.label`,
12
- * allowing components to reference their own translations concisely.
13
- * - If the key is not found in the component's namespace, the `_system` namespace
14
- * is used as a fallback.
15
- *
16
- * **Mustache-style interpolation:** `{{variable}}` placeholders in translation
17
- * templates are replaced with values from the optional `data` object.
18
- *
19
- * The mixin observes the `namespace` attribute on the host element and re-renders
20
- * the component when the locale store updates for the active namespace.
21
- *
22
- * @param component - The Stencil component instance
23
- * @returns Object containing the `t` translation function
24
- */
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
- const withTranslation = (component) => {
27
- let subscription;
28
- let namespace = undefined;
29
- let stores;
30
- const observer = new MutationObserver((mutations) => {
31
- mutations.forEach((mutation) => {
32
- if (mutation.attributeName === "namespace") {
33
- namespace = getElement(component).getAttribute("namespace");
34
- forceUpdate(component);
35
- }
36
- });
37
- });
38
- const connectedCallback = component["connectedCallback"];
39
- component["connectedCallback"] = () => {
40
- const element = getElement(component);
41
- stores = getStores(element);
42
- observer.observe(element, { attributes: true, attributeFilter: ["namespace"] });
43
- namespace = getElement(component).getAttribute("namespace");
44
- subscription = stores.internationalization.on("set", (key, _value) => {
45
- if (key === namespace) {
46
- forceUpdate(component);
47
- }
48
- });
49
- runIfExisits(connectedCallback, component);
50
- };
51
- const disconnectedCallback = component["disconnectedCallback"];
52
- component["disconnectedCallback"] = () => {
53
- observer.disconnect();
54
- runIfExisits(subscription);
55
- clearStoresCache(getElement(component));
56
- runIfExisits(disconnectedCallback, component);
57
- };
58
- const t = (key, data) => {
59
- var _a, _b;
60
- if (key.startsWith(".")) {
61
- key = getElement(component).localName + key;
62
- }
63
- const locales = stores.internationalization.state;
64
- const locale = stores.context.state.locale;
65
- let currentNamespace = namespace;
66
- if (((_b = (_a = locales[currentNamespace]) === null || _a === void 0 ? void 0 : _a[locale]) === null || _b === void 0 ? void 0 : _b[key]) == null) {
67
- currentNamespace = "_system";
68
- }
69
- const tpl = locales[currentNamespace][locale][key];
70
- return tpl.replace(/{{([\s\S]+?)}}/g, (_, k) => { var _a; return (_a = data === null || data === void 0 ? void 0 : data[k.trim()]) !== null && _a !== void 0 ? _a : ""; });
71
- };
72
- return { t };
73
- };
74
-
75
- export { withTranslation as w };