lowcoder-comps 0.0.29 → 0.0.31

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 (86) hide show
  1. package/README.md +120 -0
  2. package/index.html +26 -0
  3. package/index.tsx +21 -0
  4. package/jest.config.js +6 -0
  5. package/package.json +3 -4
  6. package/src/__test__/allComp.test.tsx +61 -0
  7. package/src/app-env.d.ts +3 -0
  8. package/src/comps/calendarComp/calendarComp.tsx +633 -0
  9. package/src/comps/calendarComp/calendarConstants.tsx +1048 -0
  10. package/src/comps/calendarComp/errorBoundary.tsx +30 -0
  11. package/src/comps/chartComp/chartComp.tsx +442 -0
  12. package/src/comps/chartComp/chartConfigs/barChartConfig.tsx +51 -0
  13. package/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx +307 -0
  14. package/src/comps/chartComp/chartConfigs/chartUrls.tsx +9 -0
  15. package/src/comps/chartComp/chartConfigs/legendConfig.tsx +55 -0
  16. package/src/comps/chartComp/chartConfigs/lineChartConfig.tsx +96 -0
  17. package/src/comps/chartComp/chartConfigs/pieChartConfig.tsx +83 -0
  18. package/src/comps/chartComp/chartConfigs/scatterChartConfig.tsx +62 -0
  19. package/src/comps/chartComp/chartConstants.tsx +299 -0
  20. package/src/comps/chartComp/chartPropertyView.tsx +235 -0
  21. package/src/comps/chartComp/chartUtils.ts +291 -0
  22. package/src/comps/chartComp/reactEcharts/core.tsx +194 -0
  23. package/src/comps/chartComp/reactEcharts/index.ts +21 -0
  24. package/src/comps/chartComp/reactEcharts/types.ts +76 -0
  25. package/src/comps/chartComp/seriesComp.tsx +119 -0
  26. package/src/comps/imageEditorComp/imageEditorClass.tsx +52 -0
  27. package/src/comps/imageEditorComp/imageEditorConstants.tsx +109 -0
  28. package/src/comps/imageEditorComp/index.tsx +184 -0
  29. package/src/comps/mermaidComp/index.tsx +44 -0
  30. package/src/comps/mermaidComp/mermaid.tsx +29 -0
  31. package/src/global.ts +1 -0
  32. package/src/i18n/comps/index.tsx +29 -0
  33. package/src/i18n/comps/locales/en.ts +163 -0
  34. package/src/i18n/comps/locales/enObj.tsx +198 -0
  35. package/src/i18n/comps/locales/index.ts +7 -0
  36. package/src/i18n/comps/locales/types.tsx +10 -0
  37. package/src/i18n/comps/locales/zh.ts +156 -0
  38. package/src/i18n/comps/locales/zhObj.tsx +4 -0
  39. package/src/index.ts +11 -0
  40. package/tsconfig.json +22 -0
  41. package/vite.config.js +10 -0
  42. package/2085da13.js +0 -960
  43. package/250691b5.js +0 -5
  44. package/256b619e.js +0 -92
  45. package/274f545c.js +0 -881
  46. package/289305a1.js +0 -208
  47. package/2eae45c2.js +0 -34
  48. package/2ff2c7a6.js +0 -6
  49. package/2ff7471d.js +0 -9
  50. package/335b22a2.js +0 -220
  51. package/38c826fe.js +0 -1127
  52. package/44011c1d.js +0 -818
  53. package/4fc06812.js +0 -64
  54. package/56a787cf.js +0 -915
  55. package/590941ff.js +0 -86
  56. package/6341867f.js +0 -804
  57. package/657fd065.js +0 -8
  58. package/78a5e50d.js +0 -1579
  59. package/820c3641.js +0 -25
  60. package/88b4e75a.js +0 -2967
  61. package/8d999722.js +0 -1102
  62. package/92e85b65.js +0 -65
  63. package/989caea2.js +0 -505
  64. package/99b984d1.js +0 -237
  65. package/9e5f02d6.js +0 -19104
  66. package/a40faea7.js +0 -11624
  67. package/abac9104.js +0 -1536
  68. package/af2f19b3.js +0 -819
  69. package/af5ee3de.js +0 -268
  70. package/b24707c2.js +0 -48428
  71. package/b68f8b69.js +0 -1276
  72. package/ba68ba65.js +0 -391
  73. package/bafb8599.js +0 -319
  74. package/bba60c35.js +0 -2501
  75. package/bd7c2a8e.js +0 -1089
  76. package/c71dadea.js +0 -455
  77. package/d05c1762.js +0 -933
  78. package/d073ab24.js +0 -134353
  79. package/d838cd10.js +0 -769
  80. package/dc36a6eb.js +0 -796
  81. package/ed143450.js +0 -1284
  82. package/ee8ec8f2.js +0 -2284
  83. package/f6755210.js +0 -1269
  84. package/f9637058.js +0 -16
  85. package/fba4c8e4.js +0 -447
  86. package/index.js +0 -5
package/ed143450.js DELETED
@@ -1,1284 +0,0 @@
1
- import { Y as zt, Z as ot, W as wt, V as Ft, s as Nt, g as Xt, C as Yt, D as St, a as Ht, b as $t, E as Ut, l as Ct, T as qt, i as jt, d as Gt } from "./d073ab24.js";
2
- import { c as Qt } from "./88b4e75a.js";
3
- import { i as Kt } from "./f9637058.js";
4
- import { o as Zt } from "./92e85b65.js";
5
- import { l as ft } from "./fba4c8e4.js";
6
- import { l as pt } from "./2eae45c2.js";
7
- import "./2ff2c7a6.js";
8
- import "./256b619e.js";
9
- function Jt(e, t, i) {
10
- e = +e, t = +t, i = (n = arguments.length) < 2 ? (t = e, e = 0, 1) : n < 3 ? 1 : +i;
11
- for (var s = -1, n = Math.max(0, Math.ceil((t - e) / i)) | 0, o = new Array(n); ++s < n; )
12
- o[s] = e + s * i;
13
- return o;
14
- }
15
- function st() {
16
- var e = Zt().unknown(void 0), t = e.domain, i = e.range, s = 0, n = 1, o, c, f = !1, d = 0, R = 0, _ = 0.5;
17
- delete e.unknown;
18
- function A() {
19
- var m = t().length, T = n < s, S = T ? n : s, P = T ? s : n;
20
- o = (P - S) / Math.max(1, m - d + R * 2), f && (o = Math.floor(o)), S += (P - S - o * (m - d)) * _, c = o * (1 - d), f && (S = Math.round(S), c = Math.round(c));
21
- var p = Jt(m).map(function(C) {
22
- return S + o * C;
23
- });
24
- return i(T ? p.reverse() : p);
25
- }
26
- return e.domain = function(m) {
27
- return arguments.length ? (t(m), A()) : t();
28
- }, e.range = function(m) {
29
- return arguments.length ? ([s, n] = m, s = +s, n = +n, A()) : [s, n];
30
- }, e.rangeRound = function(m) {
31
- return [s, n] = m, s = +s, n = +n, f = !0, A();
32
- }, e.bandwidth = function() {
33
- return c;
34
- }, e.step = function() {
35
- return o;
36
- }, e.round = function(m) {
37
- return arguments.length ? (f = !!m, A()) : f;
38
- }, e.padding = function(m) {
39
- return arguments.length ? (d = Math.min(1, R = +m), A()) : d;
40
- }, e.paddingInner = function(m) {
41
- return arguments.length ? (d = Math.min(1, m), A()) : d;
42
- }, e.paddingOuter = function(m) {
43
- return arguments.length ? (R = +m, A()) : R;
44
- }, e.align = function(m) {
45
- return arguments.length ? (_ = Math.max(0, Math.min(1, m)), A()) : _;
46
- }, e.copy = function() {
47
- return st(t(), [s, n]).round(f).paddingInner(d).paddingOuter(R).align(_);
48
- }, Kt.apply(A(), arguments);
49
- }
50
- var nt = function() {
51
- var e = function(V, r, l, u) {
52
- for (l = l || {}, u = V.length; u--; l[V[u]] = r)
53
- ;
54
- return l;
55
- }, t = [1, 10, 12, 14, 16, 18, 19, 21, 23], i = [2, 6], s = [1, 3], n = [1, 5], o = [1, 6], c = [1, 7], f = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], d = [1, 25], R = [1, 26], _ = [1, 28], A = [1, 29], m = [1, 30], T = [1, 31], S = [1, 32], P = [1, 33], p = [1, 34], C = [1, 35], h = [1, 36], L = [1, 37], z = [1, 43], lt = [1, 42], ct = [1, 47], $ = [1, 50], w = [1, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], Q = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36], E = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], ut = [1, 64], K = {
56
- trace: function() {
57
- },
58
- yy: {},
59
- symbols_: { error: 2, start: 3, eol: 4, XYCHART: 5, chartConfig: 6, document: 7, CHART_ORIENTATION: 8, statement: 9, title: 10, text: 11, X_AXIS: 12, parseXAxis: 13, Y_AXIS: 14, parseYAxis: 15, LINE: 16, plotData: 17, BAR: 18, acc_title: 19, acc_title_value: 20, acc_descr: 21, acc_descr_value: 22, acc_descr_multiline_value: 23, SQUARE_BRACES_START: 24, commaSeparatedNumbers: 25, SQUARE_BRACES_END: 26, NUMBER_WITH_DECIMAL: 27, COMMA: 28, xAxisData: 29, bandData: 30, ARROW_DELIMITER: 31, commaSeparatedTexts: 32, yAxisData: 33, NEWLINE: 34, SEMI: 35, EOF: 36, alphaNum: 37, STR: 38, MD_STR: 39, alphaNumToken: 40, AMP: 41, NUM: 42, ALPHA: 43, PLUS: 44, EQUALS: 45, MULT: 46, DOT: 47, BRKT: 48, MINUS: 49, UNDERSCORE: 50, $accept: 0, $end: 1 },
60
- terminals_: { 2: "error", 5: "XYCHART", 8: "CHART_ORIENTATION", 10: "title", 12: "X_AXIS", 14: "Y_AXIS", 16: "LINE", 18: "BAR", 19: "acc_title", 20: "acc_title_value", 21: "acc_descr", 22: "acc_descr_value", 23: "acc_descr_multiline_value", 24: "SQUARE_BRACES_START", 26: "SQUARE_BRACES_END", 27: "NUMBER_WITH_DECIMAL", 28: "COMMA", 31: "ARROW_DELIMITER", 34: "NEWLINE", 35: "SEMI", 36: "EOF", 38: "STR", 39: "MD_STR", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "PLUS", 45: "EQUALS", 46: "MULT", 47: "DOT", 48: "BRKT", 49: "MINUS", 50: "UNDERSCORE" },
61
- productions_: [0, [3, 2], [3, 3], [3, 2], [3, 1], [6, 1], [7, 0], [7, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 3], [9, 2], [9, 3], [9, 2], [9, 2], [9, 1], [17, 3], [25, 3], [25, 1], [13, 1], [13, 2], [13, 1], [29, 1], [29, 3], [30, 3], [32, 3], [32, 1], [15, 1], [15, 2], [15, 1], [33, 3], [4, 1], [4, 1], [4, 1], [11, 1], [11, 1], [11, 1], [37, 1], [37, 2], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1]],
62
- performAction: function(r, l, u, g, b, a, F) {
63
- var x = a.length - 1;
64
- switch (b) {
65
- case 5:
66
- g.setOrientation(a[x]);
67
- break;
68
- case 9:
69
- g.setDiagramTitle(a[x].text.trim());
70
- break;
71
- case 12:
72
- g.setLineData({ text: "", type: "text" }, a[x]);
73
- break;
74
- case 13:
75
- g.setLineData(a[x - 1], a[x]);
76
- break;
77
- case 14:
78
- g.setBarData({ text: "", type: "text" }, a[x]);
79
- break;
80
- case 15:
81
- g.setBarData(a[x - 1], a[x]);
82
- break;
83
- case 16:
84
- this.$ = a[x].trim(), g.setAccTitle(this.$);
85
- break;
86
- case 17:
87
- case 18:
88
- this.$ = a[x].trim(), g.setAccDescription(this.$);
89
- break;
90
- case 19:
91
- this.$ = a[x - 1];
92
- break;
93
- case 20:
94
- this.$ = [Number(a[x - 2]), ...a[x]];
95
- break;
96
- case 21:
97
- this.$ = [Number(a[x])];
98
- break;
99
- case 22:
100
- g.setXAxisTitle(a[x]);
101
- break;
102
- case 23:
103
- g.setXAxisTitle(a[x - 1]);
104
- break;
105
- case 24:
106
- g.setXAxisTitle({ type: "text", text: "" });
107
- break;
108
- case 25:
109
- g.setXAxisBand(a[x]);
110
- break;
111
- case 26:
112
- g.setXAxisRangeData(Number(a[x - 2]), Number(a[x]));
113
- break;
114
- case 27:
115
- this.$ = a[x - 1];
116
- break;
117
- case 28:
118
- this.$ = [a[x - 2], ...a[x]];
119
- break;
120
- case 29:
121
- this.$ = [a[x]];
122
- break;
123
- case 30:
124
- g.setYAxisTitle(a[x]);
125
- break;
126
- case 31:
127
- g.setYAxisTitle(a[x - 1]);
128
- break;
129
- case 32:
130
- g.setYAxisTitle({ type: "text", text: "" });
131
- break;
132
- case 33:
133
- g.setYAxisRangeData(Number(a[x - 2]), Number(a[x]));
134
- break;
135
- case 37:
136
- this.$ = { text: a[x], type: "text" };
137
- break;
138
- case 38:
139
- this.$ = { text: a[x], type: "text" };
140
- break;
141
- case 39:
142
- this.$ = { text: a[x], type: "markdown" };
143
- break;
144
- case 40:
145
- this.$ = a[x];
146
- break;
147
- case 41:
148
- this.$ = a[x - 1] + "" + a[x];
149
- break;
150
- }
151
- },
152
- table: [e(t, i, { 3: 1, 4: 2, 7: 4, 5: s, 34: n, 35: o, 36: c }), { 1: [3] }, e(t, i, { 4: 2, 7: 4, 3: 8, 5: s, 34: n, 35: o, 36: c }), e(t, i, { 4: 2, 7: 4, 6: 9, 3: 10, 5: s, 8: [1, 11], 34: n, 35: o, 36: c }), { 1: [2, 4], 9: 12, 10: [1, 13], 12: [1, 14], 14: [1, 15], 16: [1, 16], 18: [1, 17], 19: [1, 18], 21: [1, 19], 23: [1, 20] }, e(f, [2, 34]), e(f, [2, 35]), e(f, [2, 36]), { 1: [2, 1] }, e(t, i, { 4: 2, 7: 4, 3: 21, 5: s, 34: n, 35: o, 36: c }), { 1: [2, 3] }, e(f, [2, 5]), e(t, [2, 7], { 4: 22, 34: n, 35: o, 36: c }), { 11: 23, 37: 24, 38: d, 39: R, 40: 27, 41: _, 42: A, 43: m, 44: T, 45: S, 46: P, 47: p, 48: C, 49: h, 50: L }, { 11: 39, 13: 38, 24: z, 27: lt, 29: 40, 30: 41, 37: 24, 38: d, 39: R, 40: 27, 41: _, 42: A, 43: m, 44: T, 45: S, 46: P, 47: p, 48: C, 49: h, 50: L }, { 11: 45, 15: 44, 27: ct, 33: 46, 37: 24, 38: d, 39: R, 40: 27, 41: _, 42: A, 43: m, 44: T, 45: S, 46: P, 47: p, 48: C, 49: h, 50: L }, { 11: 49, 17: 48, 24: $, 37: 24, 38: d, 39: R, 40: 27, 41: _, 42: A, 43: m, 44: T, 45: S, 46: P, 47: p, 48: C, 49: h, 50: L }, { 11: 52, 17: 51, 24: $, 37: 24, 38: d, 39: R, 40: 27, 41: _, 42: A, 43: m, 44: T, 45: S, 46: P, 47: p, 48: C, 49: h, 50: L }, { 20: [1, 53] }, { 22: [1, 54] }, e(w, [2, 18]), { 1: [2, 2] }, e(w, [2, 8]), e(w, [2, 9]), e(Q, [2, 37], { 40: 55, 41: _, 42: A, 43: m, 44: T, 45: S, 46: P, 47: p, 48: C, 49: h, 50: L }), e(Q, [2, 38]), e(Q, [2, 39]), e(E, [2, 40]), e(E, [2, 42]), e(E, [2, 43]), e(E, [2, 44]), e(E, [2, 45]), e(E, [2, 46]), e(E, [2, 47]), e(E, [2, 48]), e(E, [2, 49]), e(E, [2, 50]), e(E, [2, 51]), e(w, [2, 10]), e(w, [2, 22], { 30: 41, 29: 56, 24: z, 27: lt }), e(w, [2, 24]), e(w, [2, 25]), { 31: [1, 57] }, { 11: 59, 32: 58, 37: 24, 38: d, 39: R, 40: 27, 41: _, 42: A, 43: m, 44: T, 45: S, 46: P, 47: p, 48: C, 49: h, 50: L }, e(w, [2, 11]), e(w, [2, 30], { 33: 60, 27: ct }), e(w, [2, 32]), { 31: [1, 61] }, e(w, [2, 12]), { 17: 62, 24: $ }, { 25: 63, 27: ut }, e(w, [2, 14]), { 17: 65, 24: $ }, e(w, [2, 16]), e(w, [2, 17]), e(E, [2, 41]), e(w, [2, 23]), { 27: [1, 66] }, { 26: [1, 67] }, { 26: [2, 29], 28: [1, 68] }, e(w, [2, 31]), { 27: [1, 69] }, e(w, [2, 13]), { 26: [1, 70] }, { 26: [2, 21], 28: [1, 71] }, e(w, [2, 15]), e(w, [2, 26]), e(w, [2, 27]), { 11: 59, 32: 72, 37: 24, 38: d, 39: R, 40: 27, 41: _, 42: A, 43: m, 44: T, 45: S, 46: P, 47: p, 48: C, 49: h, 50: L }, e(w, [2, 33]), e(w, [2, 19]), { 25: 73, 27: ut }, { 26: [2, 28] }, { 26: [2, 20] }],
153
- defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 72: [2, 28], 73: [2, 20] },
154
- parseError: function(r, l) {
155
- if (l.recoverable)
156
- this.trace(r);
157
- else {
158
- var u = new Error(r);
159
- throw u.hash = l, u;
160
- }
161
- },
162
- parse: function(r) {
163
- var l = this, u = [0], g = [], b = [null], a = [], F = this.table, x = "", U = 0, gt = 0, Vt = 2, xt = 1, Wt = a.slice.call(arguments, 1), k = Object.create(this.lexer), W = { yy: {} };
164
- for (var J in this.yy)
165
- Object.prototype.hasOwnProperty.call(this.yy, J) && (W.yy[J] = this.yy[J]);
166
- k.setInput(r, W.yy), W.yy.lexer = k, W.yy.parser = this, typeof k.yylloc == "undefined" && (k.yylloc = {});
167
- var tt = k.yylloc;
168
- a.push(tt);
169
- var Bt = k.options && k.options.ranges;
170
- typeof W.yy.parseError == "function" ? this.parseError = W.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
171
- function Ot() {
172
- var I;
173
- return I = g.pop() || k.lex() || xt, typeof I != "number" && (I instanceof Array && (g = I, I = g.pop()), I = l.symbols_[I] || I), I;
174
- }
175
- for (var D, B, v, it, O = {}, q, M, dt, j; ; ) {
176
- if (B = u[u.length - 1], this.defaultActions[B] ? v = this.defaultActions[B] : ((D === null || typeof D == "undefined") && (D = Ot()), v = F[B] && F[B][D]), typeof v == "undefined" || !v.length || !v[0]) {
177
- var et = "";
178
- j = [];
179
- for (q in F[B])
180
- this.terminals_[q] && q > Vt && j.push("'" + this.terminals_[q] + "'");
181
- k.showPosition ? et = "Parse error on line " + (U + 1) + `:
182
- ` + k.showPosition() + `
183
- Expecting ` + j.join(", ") + ", got '" + (this.terminals_[D] || D) + "'" : et = "Parse error on line " + (U + 1) + ": Unexpected " + (D == xt ? "end of input" : "'" + (this.terminals_[D] || D) + "'"), this.parseError(et, {
184
- text: k.match,
185
- token: this.terminals_[D] || D,
186
- line: k.yylineno,
187
- loc: tt,
188
- expected: j
189
- });
190
- }
191
- if (v[0] instanceof Array && v.length > 1)
192
- throw new Error("Parse Error: multiple actions possible at state: " + B + ", token: " + D);
193
- switch (v[0]) {
194
- case 1:
195
- u.push(D), b.push(k.yytext), a.push(k.yylloc), u.push(v[1]), D = null, gt = k.yyleng, x = k.yytext, U = k.yylineno, tt = k.yylloc;
196
- break;
197
- case 2:
198
- if (M = this.productions_[v[1]][1], O.$ = b[b.length - M], O._$ = {
199
- first_line: a[a.length - (M || 1)].first_line,
200
- last_line: a[a.length - 1].last_line,
201
- first_column: a[a.length - (M || 1)].first_column,
202
- last_column: a[a.length - 1].last_column
203
- }, Bt && (O._$.range = [
204
- a[a.length - (M || 1)].range[0],
205
- a[a.length - 1].range[1]
206
- ]), it = this.performAction.apply(O, [
207
- x,
208
- gt,
209
- U,
210
- W.yy,
211
- v[1],
212
- b,
213
- a
214
- ].concat(Wt)), typeof it != "undefined")
215
- return it;
216
- M && (u = u.slice(0, -1 * M * 2), b = b.slice(0, -1 * M), a = a.slice(0, -1 * M)), u.push(this.productions_[v[1]][0]), b.push(O.$), a.push(O._$), dt = F[u[u.length - 2]][u[u.length - 1]], u.push(dt);
217
- break;
218
- case 3:
219
- return !0;
220
- }
221
- }
222
- return !0;
223
- }
224
- }, It = function() {
225
- var V = {
226
- EOF: 1,
227
- parseError: function(l, u) {
228
- if (this.yy.parser)
229
- this.yy.parser.parseError(l, u);
230
- else
231
- throw new Error(l);
232
- },
233
- // resets the lexer, sets new input
234
- setInput: function(r, l) {
235
- return this.yy = l || this.yy || {}, this._input = r, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
236
- first_line: 1,
237
- first_column: 0,
238
- last_line: 1,
239
- last_column: 0
240
- }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
241
- },
242
- // consumes and returns one char from the input
243
- input: function() {
244
- var r = this._input[0];
245
- this.yytext += r, this.yyleng++, this.offset++, this.match += r, this.matched += r;
246
- var l = r.match(/(?:\r\n?|\n).*/g);
247
- return l ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), r;
248
- },
249
- // unshifts one char (or a string) into the input
250
- unput: function(r) {
251
- var l = r.length, u = r.split(/(?:\r\n?|\n)/g);
252
- this._input = r + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - l), this.offset -= l;
253
- var g = this.match.split(/(?:\r\n?|\n)/g);
254
- this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), u.length - 1 && (this.yylineno -= u.length - 1);
255
- var b = this.yylloc.range;
256
- return this.yylloc = {
257
- first_line: this.yylloc.first_line,
258
- last_line: this.yylineno + 1,
259
- first_column: this.yylloc.first_column,
260
- last_column: u ? (u.length === g.length ? this.yylloc.first_column : 0) + g[g.length - u.length].length - u[0].length : this.yylloc.first_column - l
261
- }, this.options.ranges && (this.yylloc.range = [b[0], b[0] + this.yyleng - l]), this.yyleng = this.yytext.length, this;
262
- },
263
- // When called from action, caches matched text and appends it on next action
264
- more: function() {
265
- return this._more = !0, this;
266
- },
267
- // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
268
- reject: function() {
269
- if (this.options.backtrack_lexer)
270
- this._backtrack = !0;
271
- else
272
- return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
273
- ` + this.showPosition(), {
274
- text: "",
275
- token: null,
276
- line: this.yylineno
277
- });
278
- return this;
279
- },
280
- // retain first n characters of the match
281
- less: function(r) {
282
- this.unput(this.match.slice(r));
283
- },
284
- // displays already matched input, i.e. for error messages
285
- pastInput: function() {
286
- var r = this.matched.substr(0, this.matched.length - this.match.length);
287
- return (r.length > 20 ? "..." : "") + r.substr(-20).replace(/\n/g, "");
288
- },
289
- // displays upcoming input, i.e. for error messages
290
- upcomingInput: function() {
291
- var r = this.match;
292
- return r.length < 20 && (r += this._input.substr(0, 20 - r.length)), (r.substr(0, 20) + (r.length > 20 ? "..." : "")).replace(/\n/g, "");
293
- },
294
- // displays the character position where the lexing error occurred, i.e. for error messages
295
- showPosition: function() {
296
- var r = this.pastInput(), l = new Array(r.length + 1).join("-");
297
- return r + this.upcomingInput() + `
298
- ` + l + "^";
299
- },
300
- // test the lexed token: return FALSE when not a match, otherwise return token
301
- test_match: function(r, l) {
302
- var u, g, b;
303
- if (this.options.backtrack_lexer && (b = {
304
- yylineno: this.yylineno,
305
- yylloc: {
306
- first_line: this.yylloc.first_line,
307
- last_line: this.last_line,
308
- first_column: this.yylloc.first_column,
309
- last_column: this.yylloc.last_column
310
- },
311
- yytext: this.yytext,
312
- match: this.match,
313
- matches: this.matches,
314
- matched: this.matched,
315
- yyleng: this.yyleng,
316
- offset: this.offset,
317
- _more: this._more,
318
- _input: this._input,
319
- yy: this.yy,
320
- conditionStack: this.conditionStack.slice(0),
321
- done: this.done
322
- }, this.options.ranges && (b.yylloc.range = this.yylloc.range.slice(0))), g = r[0].match(/(?:\r\n?|\n).*/g), g && (this.yylineno += g.length), this.yylloc = {
323
- first_line: this.yylloc.last_line,
324
- last_line: this.yylineno + 1,
325
- first_column: this.yylloc.last_column,
326
- last_column: g ? g[g.length - 1].length - g[g.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + r[0].length
327
- }, this.yytext += r[0], this.match += r[0], this.matches = r, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(r[0].length), this.matched += r[0], u = this.performAction.call(this, this.yy, this, l, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), u)
328
- return u;
329
- if (this._backtrack) {
330
- for (var a in b)
331
- this[a] = b[a];
332
- return !1;
333
- }
334
- return !1;
335
- },
336
- // return next match in input
337
- next: function() {
338
- if (this.done)
339
- return this.EOF;
340
- this._input || (this.done = !0);
341
- var r, l, u, g;
342
- this._more || (this.yytext = "", this.match = "");
343
- for (var b = this._currentRules(), a = 0; a < b.length; a++)
344
- if (u = this._input.match(this.rules[b[a]]), u && (!l || u[0].length > l[0].length)) {
345
- if (l = u, g = a, this.options.backtrack_lexer) {
346
- if (r = this.test_match(u, b[a]), r !== !1)
347
- return r;
348
- if (this._backtrack) {
349
- l = !1;
350
- continue;
351
- } else
352
- return !1;
353
- } else if (!this.options.flex)
354
- break;
355
- }
356
- return l ? (r = this.test_match(l, b[g]), r !== !1 ? r : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
357
- ` + this.showPosition(), {
358
- text: "",
359
- token: null,
360
- line: this.yylineno
361
- });
362
- },
363
- // return next match that has a token
364
- lex: function() {
365
- var l = this.next();
366
- return l || this.lex();
367
- },
368
- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
369
- begin: function(l) {
370
- this.conditionStack.push(l);
371
- },
372
- // pop the previously active lexer condition state off the condition stack
373
- popState: function() {
374
- var l = this.conditionStack.length - 1;
375
- return l > 0 ? this.conditionStack.pop() : this.conditionStack[0];
376
- },
377
- // produce the lexer rule set which is active for the currently active lexer condition state
378
- _currentRules: function() {
379
- return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
380
- },
381
- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
382
- topState: function(l) {
383
- return l = this.conditionStack.length - 1 - Math.abs(l || 0), l >= 0 ? this.conditionStack[l] : "INITIAL";
384
- },
385
- // alias for begin(condition)
386
- pushState: function(l) {
387
- this.begin(l);
388
- },
389
- // return the number of states currently on the stack
390
- stateStackSize: function() {
391
- return this.conditionStack.length;
392
- },
393
- options: { "case-insensitive": !0 },
394
- performAction: function(l, u, g, b) {
395
- switch (g) {
396
- case 0:
397
- break;
398
- case 1:
399
- break;
400
- case 2:
401
- return this.popState(), 34;
402
- case 3:
403
- return this.popState(), 34;
404
- case 4:
405
- return 34;
406
- case 5:
407
- break;
408
- case 6:
409
- return 10;
410
- case 7:
411
- return this.pushState("acc_title"), 19;
412
- case 8:
413
- return this.popState(), "acc_title_value";
414
- case 9:
415
- return this.pushState("acc_descr"), 21;
416
- case 10:
417
- return this.popState(), "acc_descr_value";
418
- case 11:
419
- this.pushState("acc_descr_multiline");
420
- break;
421
- case 12:
422
- this.popState();
423
- break;
424
- case 13:
425
- return "acc_descr_multiline_value";
426
- case 14:
427
- return 5;
428
- case 15:
429
- return 8;
430
- case 16:
431
- return this.pushState("axis_data"), "X_AXIS";
432
- case 17:
433
- return this.pushState("axis_data"), "Y_AXIS";
434
- case 18:
435
- return this.pushState("axis_band_data"), 24;
436
- case 19:
437
- return 31;
438
- case 20:
439
- return this.pushState("data"), 16;
440
- case 21:
441
- return this.pushState("data"), 18;
442
- case 22:
443
- return this.pushState("data_inner"), 24;
444
- case 23:
445
- return 27;
446
- case 24:
447
- return this.popState(), 26;
448
- case 25:
449
- this.popState();
450
- break;
451
- case 26:
452
- this.pushState("string");
453
- break;
454
- case 27:
455
- this.popState();
456
- break;
457
- case 28:
458
- return "STR";
459
- case 29:
460
- return 24;
461
- case 30:
462
- return 26;
463
- case 31:
464
- return 43;
465
- case 32:
466
- return "COLON";
467
- case 33:
468
- return 44;
469
- case 34:
470
- return 28;
471
- case 35:
472
- return 45;
473
- case 36:
474
- return 46;
475
- case 37:
476
- return 48;
477
- case 38:
478
- return 50;
479
- case 39:
480
- return 47;
481
- case 40:
482
- return 41;
483
- case 41:
484
- return 49;
485
- case 42:
486
- return 42;
487
- case 43:
488
- break;
489
- case 44:
490
- return 35;
491
- case 45:
492
- return 36;
493
- }
494
- },
495
- rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:(\r?\n))/i, /^(?:(\r?\n))/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:\{)/i, /^(?:[^\}]*)/i, /^(?:xychart-beta\b)/i, /^(?:(?:vertical|horizontal))/i, /^(?:x-axis\b)/i, /^(?:y-axis\b)/i, /^(?:\[)/i, /^(?:-->)/i, /^(?:line\b)/i, /^(?:bar\b)/i, /^(?:\[)/i, /^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i, /^(?:\])/i, /^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s+)/i, /^(?:;)/i, /^(?:$)/i],
496
- conditions: { data_inner: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 }, data: { rules: [0, 1, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 22, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 }, axis_band_data: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 }, axis_data: { rules: [0, 1, 2, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 }, acc_descr_multiline: { rules: [12, 13], inclusive: !1 }, acc_descr: { rules: [10], inclusive: !1 }, acc_title: { rules: [8], inclusive: !1 }, title: { rules: [], inclusive: !1 }, md_string: { rules: [], inclusive: !1 }, string: { rules: [27, 28], inclusive: !1 }, INITIAL: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 } }
497
- };
498
- return V;
499
- }();
500
- K.lexer = It;
501
- function Z() {
502
- this.yy = {};
503
- }
504
- return Z.prototype = K, K.Parser = Z, new Z();
505
- }();
506
- nt.parser = nt;
507
- const ti = nt;
508
- function mt(e) {
509
- return e.type === "bar";
510
- }
511
- function _t(e) {
512
- return e.type === "band";
513
- }
514
- function N(e) {
515
- return e.type === "linear";
516
- }
517
- class kt {
518
- constructor(t) {
519
- this.parentGroup = t;
520
- }
521
- getMaxDimension(t, i) {
522
- if (!this.parentGroup)
523
- return {
524
- width: t.reduce((o, c) => Math.max(c.length, o), 0) * i,
525
- height: i
526
- };
527
- const s = {
528
- width: 0,
529
- height: 0
530
- }, n = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", i);
531
- for (const o of t) {
532
- const c = Qt(n, 1, o), f = c ? c.width : o.length * i, d = c ? c.height : i;
533
- s.width = Math.max(s.width, f), s.height = Math.max(s.height, d);
534
- }
535
- return n.remove(), s;
536
- }
537
- }
538
- const yt = 0.7, bt = 0.2;
539
- class Rt {
540
- constructor(t, i, s, n) {
541
- this.axisConfig = t, this.title = i, this.textDimensionCalculator = s, this.axisThemeConfig = n, this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }, this.axisPosition = "left", this.showTitle = !1, this.showLabel = !1, this.showTick = !1, this.showAxisLine = !1, this.outerPadding = 0, this.titleTextHeight = 0, this.labelTextHeight = 0, this.range = [0, 10], this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }, this.axisPosition = "left";
542
- }
543
- setRange(t) {
544
- this.range = t, this.axisPosition === "left" || this.axisPosition === "right" ? this.boundingRect.height = t[1] - t[0] : this.boundingRect.width = t[1] - t[0], this.recalculateScale();
545
- }
546
- getRange() {
547
- return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
548
- }
549
- setAxisPosition(t) {
550
- this.axisPosition = t, this.setRange(this.range);
551
- }
552
- getTickDistance() {
553
- const t = this.getRange();
554
- return Math.abs(t[0] - t[1]) / this.getTickValues().length;
555
- }
556
- getAxisOuterPadding() {
557
- return this.outerPadding;
558
- }
559
- getLabelDimension() {
560
- return this.textDimensionCalculator.getMaxDimension(
561
- this.getTickValues().map((t) => t.toString()),
562
- this.axisConfig.labelFontSize
563
- );
564
- }
565
- recalculateOuterPaddingToDrawBar() {
566
- yt * this.getTickDistance() > this.outerPadding * 2 && (this.outerPadding = Math.floor(yt * this.getTickDistance() / 2)), this.recalculateScale();
567
- }
568
- calculateSpaceIfDrawnHorizontally(t) {
569
- let i = t.height;
570
- if (this.axisConfig.showAxisLine && i > this.axisConfig.axisLineWidth && (i -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
571
- const s = this.getLabelDimension(), n = bt * t.width;
572
- this.outerPadding = Math.min(s.width / 2, n);
573
- const o = s.height + this.axisConfig.labelPadding * 2;
574
- this.labelTextHeight = s.height, o <= i && (i -= o, this.showLabel = !0);
575
- }
576
- if (this.axisConfig.showTick && i >= this.axisConfig.tickLength && (this.showTick = !0, i -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
577
- const s = this.textDimensionCalculator.getMaxDimension(
578
- [this.title],
579
- this.axisConfig.titleFontSize
580
- ), n = s.height + this.axisConfig.titlePadding * 2;
581
- this.titleTextHeight = s.height, n <= i && (i -= n, this.showTitle = !0);
582
- }
583
- this.boundingRect.width = t.width, this.boundingRect.height = t.height - i;
584
- }
585
- calculateSpaceIfDrawnVertical(t) {
586
- let i = t.width;
587
- if (this.axisConfig.showAxisLine && i > this.axisConfig.axisLineWidth && (i -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
588
- const s = this.getLabelDimension(), n = bt * t.height;
589
- this.outerPadding = Math.min(s.height / 2, n);
590
- const o = s.width + this.axisConfig.labelPadding * 2;
591
- o <= i && (i -= o, this.showLabel = !0);
592
- }
593
- if (this.axisConfig.showTick && i >= this.axisConfig.tickLength && (this.showTick = !0, i -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
594
- const s = this.textDimensionCalculator.getMaxDimension(
595
- [this.title],
596
- this.axisConfig.titleFontSize
597
- ), n = s.height + this.axisConfig.titlePadding * 2;
598
- this.titleTextHeight = s.height, n <= i && (i -= n, this.showTitle = !0);
599
- }
600
- this.boundingRect.width = t.width - i, this.boundingRect.height = t.height;
601
- }
602
- calculateSpace(t) {
603
- return this.axisPosition === "left" || this.axisPosition === "right" ? this.calculateSpaceIfDrawnVertical(t) : this.calculateSpaceIfDrawnHorizontally(t), this.recalculateScale(), {
604
- width: this.boundingRect.width,
605
- height: this.boundingRect.height
606
- };
607
- }
608
- setBoundingBoxXY(t) {
609
- this.boundingRect.x = t.x, this.boundingRect.y = t.y;
610
- }
611
- getDrawableElementsForLeftAxis() {
612
- const t = [];
613
- if (this.showAxisLine) {
614
- const i = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
615
- t.push({
616
- type: "path",
617
- groupTexts: ["left-axis", "axisl-line"],
618
- data: [
619
- {
620
- path: `M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y + this.boundingRect.height} `,
621
- strokeFill: this.axisThemeConfig.axisLineColor,
622
- strokeWidth: this.axisConfig.axisLineWidth
623
- }
624
- ]
625
- });
626
- }
627
- if (this.showLabel && t.push({
628
- type: "text",
629
- groupTexts: ["left-axis", "label"],
630
- data: this.getTickValues().map((i) => ({
631
- text: i.toString(),
632
- x: this.boundingRect.x + this.boundingRect.width - (this.showLabel ? this.axisConfig.labelPadding : 0) - (this.showTick ? this.axisConfig.tickLength : 0) - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
633
- y: this.getScaleValue(i),
634
- fill: this.axisThemeConfig.labelColor,
635
- fontSize: this.axisConfig.labelFontSize,
636
- rotation: 0,
637
- verticalPos: "middle",
638
- horizontalPos: "right"
639
- }))
640
- }), this.showTick) {
641
- const i = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
642
- t.push({
643
- type: "path",
644
- groupTexts: ["left-axis", "ticks"],
645
- data: this.getTickValues().map((s) => ({
646
- path: `M ${i},${this.getScaleValue(s)} L ${i - this.axisConfig.tickLength},${this.getScaleValue(s)}`,
647
- strokeFill: this.axisThemeConfig.tickColor,
648
- strokeWidth: this.axisConfig.tickWidth
649
- }))
650
- });
651
- }
652
- return this.showTitle && t.push({
653
- type: "text",
654
- groupTexts: ["left-axis", "title"],
655
- data: [
656
- {
657
- text: this.title,
658
- x: this.boundingRect.x + this.axisConfig.titlePadding,
659
- y: this.boundingRect.y + this.boundingRect.height / 2,
660
- fill: this.axisThemeConfig.titleColor,
661
- fontSize: this.axisConfig.titleFontSize,
662
- rotation: 270,
663
- verticalPos: "top",
664
- horizontalPos: "center"
665
- }
666
- ]
667
- }), t;
668
- }
669
- getDrawableElementsForBottomAxis() {
670
- const t = [];
671
- if (this.showAxisLine) {
672
- const i = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
673
- t.push({
674
- type: "path",
675
- groupTexts: ["bottom-axis", "axis-line"],
676
- data: [
677
- {
678
- path: `M ${this.boundingRect.x},${i} L ${this.boundingRect.x + this.boundingRect.width},${i}`,
679
- strokeFill: this.axisThemeConfig.axisLineColor,
680
- strokeWidth: this.axisConfig.axisLineWidth
681
- }
682
- ]
683
- });
684
- }
685
- if (this.showLabel && t.push({
686
- type: "text",
687
- groupTexts: ["bottom-axis", "label"],
688
- data: this.getTickValues().map((i) => ({
689
- text: i.toString(),
690
- x: this.getScaleValue(i),
691
- y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
692
- fill: this.axisThemeConfig.labelColor,
693
- fontSize: this.axisConfig.labelFontSize,
694
- rotation: 0,
695
- verticalPos: "top",
696
- horizontalPos: "center"
697
- }))
698
- }), this.showTick) {
699
- const i = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
700
- t.push({
701
- type: "path",
702
- groupTexts: ["bottom-axis", "ticks"],
703
- data: this.getTickValues().map((s) => ({
704
- path: `M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i + this.axisConfig.tickLength}`,
705
- strokeFill: this.axisThemeConfig.tickColor,
706
- strokeWidth: this.axisConfig.tickWidth
707
- }))
708
- });
709
- }
710
- return this.showTitle && t.push({
711
- type: "text",
712
- groupTexts: ["bottom-axis", "title"],
713
- data: [
714
- {
715
- text: this.title,
716
- x: this.range[0] + (this.range[1] - this.range[0]) / 2,
717
- y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
718
- fill: this.axisThemeConfig.titleColor,
719
- fontSize: this.axisConfig.titleFontSize,
720
- rotation: 0,
721
- verticalPos: "top",
722
- horizontalPos: "center"
723
- }
724
- ]
725
- }), t;
726
- }
727
- getDrawableElementsForTopAxis() {
728
- const t = [];
729
- if (this.showAxisLine) {
730
- const i = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
731
- t.push({
732
- type: "path",
733
- groupTexts: ["top-axis", "axis-line"],
734
- data: [
735
- {
736
- path: `M ${this.boundingRect.x},${i} L ${this.boundingRect.x + this.boundingRect.width},${i}`,
737
- strokeFill: this.axisThemeConfig.axisLineColor,
738
- strokeWidth: this.axisConfig.axisLineWidth
739
- }
740
- ]
741
- });
742
- }
743
- if (this.showLabel && t.push({
744
- type: "text",
745
- groupTexts: ["top-axis", "label"],
746
- data: this.getTickValues().map((i) => ({
747
- text: i.toString(),
748
- x: this.getScaleValue(i),
749
- y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
750
- fill: this.axisThemeConfig.labelColor,
751
- fontSize: this.axisConfig.labelFontSize,
752
- rotation: 0,
753
- verticalPos: "top",
754
- horizontalPos: "center"
755
- }))
756
- }), this.showTick) {
757
- const i = this.boundingRect.y;
758
- t.push({
759
- type: "path",
760
- groupTexts: ["top-axis", "ticks"],
761
- data: this.getTickValues().map((s) => ({
762
- path: `M ${this.getScaleValue(s)},${i + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(s)},${i + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`,
763
- strokeFill: this.axisThemeConfig.tickColor,
764
- strokeWidth: this.axisConfig.tickWidth
765
- }))
766
- });
767
- }
768
- return this.showTitle && t.push({
769
- type: "text",
770
- groupTexts: ["top-axis", "title"],
771
- data: [
772
- {
773
- text: this.title,
774
- x: this.boundingRect.x + this.boundingRect.width / 2,
775
- y: this.boundingRect.y + this.axisConfig.titlePadding,
776
- fill: this.axisThemeConfig.titleColor,
777
- fontSize: this.axisConfig.titleFontSize,
778
- rotation: 0,
779
- verticalPos: "top",
780
- horizontalPos: "center"
781
- }
782
- ]
783
- }), t;
784
- }
785
- getDrawableElements() {
786
- if (this.axisPosition === "left")
787
- return this.getDrawableElementsForLeftAxis();
788
- if (this.axisPosition === "right")
789
- throw Error("Drawing of right axis is not implemented");
790
- return this.axisPosition === "bottom" ? this.getDrawableElementsForBottomAxis() : this.axisPosition === "top" ? this.getDrawableElementsForTopAxis() : [];
791
- }
792
- }
793
- class ii extends Rt {
794
- constructor(t, i, s, n, o) {
795
- super(t, n, o, i), this.categories = s, this.scale = st().domain(this.categories).range(this.getRange());
796
- }
797
- setRange(t) {
798
- super.setRange(t);
799
- }
800
- recalculateScale() {
801
- this.scale = st().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5), Ct.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
802
- }
803
- getTickValues() {
804
- return this.categories;
805
- }
806
- getScaleValue(t) {
807
- return this.scale(t) || this.getRange()[0];
808
- }
809
- }
810
- class ei extends Rt {
811
- constructor(t, i, s, n, o) {
812
- super(t, n, o, i), this.domain = s, this.scale = ft().domain(this.domain).range(this.getRange());
813
- }
814
- getTickValues() {
815
- return this.scale.ticks();
816
- }
817
- recalculateScale() {
818
- const t = [...this.domain];
819
- this.axisPosition === "left" && t.reverse(), this.scale = ft().domain(t).range(this.getRange());
820
- }
821
- getScaleValue(t) {
822
- return this.scale(t);
823
- }
824
- }
825
- function At(e, t, i, s) {
826
- const n = new kt(s);
827
- return _t(e) ? new ii(
828
- t,
829
- i,
830
- e.categories,
831
- e.title,
832
- n
833
- ) : new ei(
834
- t,
835
- i,
836
- [e.min, e.max],
837
- e.title,
838
- n
839
- );
840
- }
841
- class si {
842
- constructor(t, i, s, n) {
843
- this.textDimensionCalculator = t, this.chartConfig = i, this.chartData = s, this.chartThemeConfig = n, this.boundingRect = {
844
- x: 0,
845
- y: 0,
846
- width: 0,
847
- height: 0
848
- }, this.showChartTitle = !1;
849
- }
850
- setBoundingBoxXY(t) {
851
- this.boundingRect.x = t.x, this.boundingRect.y = t.y;
852
- }
853
- calculateSpace(t) {
854
- const i = this.textDimensionCalculator.getMaxDimension(
855
- [this.chartData.title],
856
- this.chartConfig.titleFontSize
857
- ), s = Math.max(i.width, t.width), n = i.height + 2 * this.chartConfig.titlePadding;
858
- return i.width <= s && i.height <= n && this.chartConfig.showTitle && this.chartData.title && (this.boundingRect.width = s, this.boundingRect.height = n, this.showChartTitle = !0), {
859
- width: this.boundingRect.width,
860
- height: this.boundingRect.height
861
- };
862
- }
863
- getDrawableElements() {
864
- const t = [];
865
- return this.showChartTitle && t.push({
866
- groupTexts: ["chart-title"],
867
- type: "text",
868
- data: [
869
- {
870
- fontSize: this.chartConfig.titleFontSize,
871
- text: this.chartData.title,
872
- verticalPos: "middle",
873
- horizontalPos: "center",
874
- x: this.boundingRect.x + this.boundingRect.width / 2,
875
- y: this.boundingRect.y + this.boundingRect.height / 2,
876
- fill: this.chartThemeConfig.titleColor,
877
- rotation: 0
878
- }
879
- ]
880
- }), t;
881
- }
882
- }
883
- function ni(e, t, i, s) {
884
- const n = new kt(s);
885
- return new si(n, e, t, i);
886
- }
887
- class ai {
888
- constructor(t, i, s, n, o) {
889
- this.plotData = t, this.xAxis = i, this.yAxis = s, this.orientation = n, this.plotIndex = o;
890
- }
891
- getDrawableElement() {
892
- const t = this.plotData.data.map((s) => [
893
- this.xAxis.getScaleValue(s[0]),
894
- this.yAxis.getScaleValue(s[1])
895
- ]);
896
- let i;
897
- return this.orientation === "horizontal" ? i = pt().y((s) => s[0]).x((s) => s[1])(t) : i = pt().x((s) => s[0]).y((s) => s[1])(t), i ? [
898
- {
899
- groupTexts: ["plot", `line-plot-${this.plotIndex}`],
900
- type: "path",
901
- data: [
902
- {
903
- path: i,
904
- strokeFill: this.plotData.strokeFill,
905
- strokeWidth: this.plotData.strokeWidth
906
- }
907
- ]
908
- }
909
- ] : [];
910
- }
911
- }
912
- class oi {
913
- constructor(t, i, s, n, o, c) {
914
- this.barData = t, this.boundingRect = i, this.xAxis = s, this.yAxis = n, this.orientation = o, this.plotIndex = c;
915
- }
916
- getDrawableElement() {
917
- const t = this.barData.data.map((o) => [
918
- this.xAxis.getScaleValue(o[0]),
919
- this.yAxis.getScaleValue(o[1])
920
- ]), i = 0.05, s = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - i), n = s / 2;
921
- return this.orientation === "horizontal" ? [
922
- {
923
- groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
924
- type: "rect",
925
- data: t.map((o) => ({
926
- x: this.boundingRect.x,
927
- y: o[0] - n,
928
- height: s,
929
- width: o[1] - this.boundingRect.x,
930
- fill: this.barData.fill,
931
- strokeWidth: 0,
932
- strokeFill: this.barData.fill
933
- }))
934
- }
935
- ] : [
936
- {
937
- groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
938
- type: "rect",
939
- data: t.map((o) => ({
940
- x: o[0] - n,
941
- y: o[1],
942
- width: s,
943
- height: this.boundingRect.y + this.boundingRect.height - o[1],
944
- fill: this.barData.fill,
945
- strokeWidth: 0,
946
- strokeFill: this.barData.fill
947
- }))
948
- }
949
- ];
950
- }
951
- }
952
- class ri {
953
- constructor(t, i, s) {
954
- this.chartConfig = t, this.chartData = i, this.chartThemeConfig = s, this.boundingRect = {
955
- x: 0,
956
- y: 0,
957
- width: 0,
958
- height: 0
959
- };
960
- }
961
- setAxes(t, i) {
962
- this.xAxis = t, this.yAxis = i;
963
- }
964
- setBoundingBoxXY(t) {
965
- this.boundingRect.x = t.x, this.boundingRect.y = t.y;
966
- }
967
- calculateSpace(t) {
968
- return this.boundingRect.width = t.width, this.boundingRect.height = t.height, {
969
- width: this.boundingRect.width,
970
- height: this.boundingRect.height
971
- };
972
- }
973
- getDrawableElements() {
974
- if (!(this.xAxis && this.yAxis))
975
- throw Error("Axes must be passed to render Plots");
976
- const t = [];
977
- for (const [i, s] of this.chartData.plots.entries())
978
- switch (s.type) {
979
- case "line":
980
- {
981
- const n = new ai(
982
- s,
983
- this.xAxis,
984
- this.yAxis,
985
- this.chartConfig.chartOrientation,
986
- i
987
- );
988
- t.push(...n.getDrawableElement());
989
- }
990
- break;
991
- case "bar":
992
- {
993
- const n = new oi(
994
- s,
995
- this.boundingRect,
996
- this.xAxis,
997
- this.yAxis,
998
- this.chartConfig.chartOrientation,
999
- i
1000
- );
1001
- t.push(...n.getDrawableElement());
1002
- }
1003
- break;
1004
- }
1005
- return t;
1006
- }
1007
- }
1008
- function hi(e, t, i) {
1009
- return new ri(e, t, i);
1010
- }
1011
- class li {
1012
- constructor(t, i, s, n) {
1013
- this.chartConfig = t, this.chartData = i, this.componentStore = {
1014
- title: ni(t, i, s, n),
1015
- plot: hi(t, i, s),
1016
- xAxis: At(
1017
- i.xAxis,
1018
- t.xAxis,
1019
- {
1020
- titleColor: s.xAxisTitleColor,
1021
- labelColor: s.xAxisLabelColor,
1022
- tickColor: s.xAxisTickColor,
1023
- axisLineColor: s.xAxisLineColor
1024
- },
1025
- n
1026
- ),
1027
- yAxis: At(
1028
- i.yAxis,
1029
- t.yAxis,
1030
- {
1031
- titleColor: s.yAxisTitleColor,
1032
- labelColor: s.yAxisLabelColor,
1033
- tickColor: s.yAxisTickColor,
1034
- axisLineColor: s.yAxisLineColor
1035
- },
1036
- n
1037
- )
1038
- };
1039
- }
1040
- calculateVerticalSpace() {
1041
- let t = this.chartConfig.width, i = this.chartConfig.height, s = 0, n = 0, o = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), c = Math.floor(
1042
- i * this.chartConfig.plotReservedSpacePercent / 100
1043
- ), f = this.componentStore.plot.calculateSpace({
1044
- width: o,
1045
- height: c
1046
- });
1047
- t -= f.width, i -= f.height, f = this.componentStore.title.calculateSpace({
1048
- width: this.chartConfig.width,
1049
- height: i
1050
- }), n = f.height, i -= f.height, this.componentStore.xAxis.setAxisPosition("bottom"), f = this.componentStore.xAxis.calculateSpace({
1051
- width: t,
1052
- height: i
1053
- }), i -= f.height, this.componentStore.yAxis.setAxisPosition("left"), f = this.componentStore.yAxis.calculateSpace({
1054
- width: t,
1055
- height: i
1056
- }), s = f.width, t -= f.width, t > 0 && (o += t, t = 0), i > 0 && (c += i, i = 0), this.componentStore.plot.calculateSpace({
1057
- width: o,
1058
- height: c
1059
- }), this.componentStore.plot.setBoundingBoxXY({ x: s, y: n }), this.componentStore.xAxis.setRange([s, s + o]), this.componentStore.xAxis.setBoundingBoxXY({ x: s, y: n + c }), this.componentStore.yAxis.setRange([n, n + c]), this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: n }), this.chartData.plots.some((d) => mt(d)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1060
- }
1061
- calculateHorizontalSpace() {
1062
- let t = this.chartConfig.width, i = this.chartConfig.height, s = 0, n = 0, o = 0, c = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), f = Math.floor(
1063
- i * this.chartConfig.plotReservedSpacePercent / 100
1064
- ), d = this.componentStore.plot.calculateSpace({
1065
- width: c,
1066
- height: f
1067
- });
1068
- t -= d.width, i -= d.height, d = this.componentStore.title.calculateSpace({
1069
- width: this.chartConfig.width,
1070
- height: i
1071
- }), s = d.height, i -= d.height, this.componentStore.xAxis.setAxisPosition("left"), d = this.componentStore.xAxis.calculateSpace({
1072
- width: t,
1073
- height: i
1074
- }), t -= d.width, n = d.width, this.componentStore.yAxis.setAxisPosition("top"), d = this.componentStore.yAxis.calculateSpace({
1075
- width: t,
1076
- height: i
1077
- }), i -= d.height, o = s + d.height, t > 0 && (c += t, t = 0), i > 0 && (f += i, i = 0), this.componentStore.plot.calculateSpace({
1078
- width: c,
1079
- height: f
1080
- }), this.componentStore.plot.setBoundingBoxXY({ x: n, y: o }), this.componentStore.yAxis.setRange([n, n + c]), this.componentStore.yAxis.setBoundingBoxXY({ x: n, y: s }), this.componentStore.xAxis.setRange([o, o + f]), this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: o }), this.chartData.plots.some((R) => mt(R)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1081
- }
1082
- calculateSpace() {
1083
- this.chartConfig.chartOrientation === "horizontal" ? this.calculateHorizontalSpace() : this.calculateVerticalSpace();
1084
- }
1085
- getDrawableElement() {
1086
- this.calculateSpace();
1087
- const t = [];
1088
- this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
1089
- for (const i of Object.values(this.componentStore))
1090
- t.push(...i.getDrawableElements());
1091
- return t;
1092
- }
1093
- }
1094
- class ci {
1095
- static build(t, i, s, n) {
1096
- return new li(t, i, s, n).getDrawableElement();
1097
- }
1098
- }
1099
- let X = 0, Tt, Y = Pt(), H = Dt(), y = Lt(), at = H.plotColorPalette.split(",").map((e) => e.trim()), G = !1, rt = !1;
1100
- function Dt() {
1101
- const e = zt(), t = ot();
1102
- return wt(e.xyChart, t.themeVariables.xyChart);
1103
- }
1104
- function Pt() {
1105
- const e = ot();
1106
- return wt(
1107
- Ft.xyChart,
1108
- e.xyChart
1109
- );
1110
- }
1111
- function Lt() {
1112
- return {
1113
- yAxis: {
1114
- type: "linear",
1115
- title: "",
1116
- min: 1 / 0,
1117
- max: -1 / 0
1118
- },
1119
- xAxis: {
1120
- type: "band",
1121
- title: "",
1122
- categories: []
1123
- },
1124
- title: "",
1125
- plots: []
1126
- };
1127
- }
1128
- function ht(e) {
1129
- const t = ot();
1130
- return Gt(e.trim(), t);
1131
- }
1132
- function ui(e) {
1133
- Tt = e;
1134
- }
1135
- function gi(e) {
1136
- e === "horizontal" ? Y.chartOrientation = "horizontal" : Y.chartOrientation = "vertical";
1137
- }
1138
- function xi(e) {
1139
- y.xAxis.title = ht(e.text);
1140
- }
1141
- function Et(e, t) {
1142
- y.xAxis = { type: "linear", title: y.xAxis.title, min: e, max: t }, G = !0;
1143
- }
1144
- function di(e) {
1145
- y.xAxis = {
1146
- type: "band",
1147
- title: y.xAxis.title,
1148
- categories: e.map((t) => ht(t.text))
1149
- }, G = !0;
1150
- }
1151
- function fi(e) {
1152
- y.yAxis.title = ht(e.text);
1153
- }
1154
- function pi(e, t) {
1155
- y.yAxis = { type: "linear", title: y.yAxis.title, min: e, max: t }, rt = !0;
1156
- }
1157
- function mi(e) {
1158
- const t = Math.min(...e), i = Math.max(...e), s = N(y.yAxis) ? y.yAxis.min : 1 / 0, n = N(y.yAxis) ? y.yAxis.max : -1 / 0;
1159
- y.yAxis = {
1160
- type: "linear",
1161
- title: y.yAxis.title,
1162
- min: Math.min(s, t),
1163
- max: Math.max(n, i)
1164
- };
1165
- }
1166
- function vt(e) {
1167
- let t = [];
1168
- if (e.length === 0)
1169
- return t;
1170
- if (!G) {
1171
- const i = N(y.xAxis) ? y.xAxis.min : 1 / 0, s = N(y.xAxis) ? y.xAxis.max : -1 / 0;
1172
- Et(Math.min(i, 1), Math.max(s, e.length));
1173
- }
1174
- if (rt || mi(e), _t(y.xAxis) && (t = y.xAxis.categories.map((i, s) => [i, e[s]])), N(y.xAxis)) {
1175
- const i = y.xAxis.min, s = y.xAxis.max, n = (s - i + 1) / e.length, o = [];
1176
- for (let c = i; c <= s; c += n)
1177
- o.push(`${c}`);
1178
- t = o.map((c, f) => [c, e[f]]);
1179
- }
1180
- return t;
1181
- }
1182
- function Mt(e) {
1183
- return at[e === 0 ? 0 : e % at.length];
1184
- }
1185
- function yi(e, t) {
1186
- const i = vt(t);
1187
- y.plots.push({
1188
- type: "line",
1189
- strokeFill: Mt(X),
1190
- strokeWidth: 2,
1191
- data: i
1192
- }), X++;
1193
- }
1194
- function bi(e, t) {
1195
- const i = vt(t);
1196
- y.plots.push({
1197
- type: "bar",
1198
- fill: Mt(X),
1199
- data: i
1200
- }), X++;
1201
- }
1202
- function Ai() {
1203
- if (y.plots.length === 0)
1204
- throw Error("No Plot to render, please provide a plot with some data");
1205
- return y.title = St(), ci.build(Y, y, H, Tt);
1206
- }
1207
- function wi() {
1208
- return H;
1209
- }
1210
- function Si() {
1211
- return Y;
1212
- }
1213
- const Ci = function() {
1214
- Ut(), X = 0, Y = Pt(), y = Lt(), H = Dt(), at = H.plotColorPalette.split(",").map((e) => e.trim()), G = !1, rt = !1;
1215
- }, _i = {
1216
- getDrawableElem: Ai,
1217
- clear: Ci,
1218
- setAccTitle: Nt,
1219
- getAccTitle: Xt,
1220
- setDiagramTitle: Yt,
1221
- getDiagramTitle: St,
1222
- getAccDescription: Ht,
1223
- setAccDescription: $t,
1224
- setOrientation: gi,
1225
- setXAxisTitle: xi,
1226
- setXAxisRangeData: Et,
1227
- setXAxisBand: di,
1228
- setYAxisTitle: fi,
1229
- setYAxisRangeData: pi,
1230
- setLineData: yi,
1231
- setBarData: bi,
1232
- setTmpSVGG: ui,
1233
- getChartThemeConfig: wi,
1234
- getChartConfig: Si
1235
- }, ki = (e, t, i, s) => {
1236
- const n = s.db, o = n.getChartThemeConfig(), c = n.getChartConfig();
1237
- function f(p) {
1238
- return p === "top" ? "text-before-edge" : "middle";
1239
- }
1240
- function d(p) {
1241
- return p === "left" ? "start" : p === "right" ? "end" : "middle";
1242
- }
1243
- function R(p) {
1244
- return `translate(${p.x}, ${p.y}) rotate(${p.rotation || 0})`;
1245
- }
1246
- Ct.debug(`Rendering xychart chart
1247
- ` + e);
1248
- const _ = qt(t), A = _.append("g").attr("class", "main"), m = A.append("rect").attr("width", c.width).attr("height", c.height).attr("class", "background");
1249
- jt(_, c.height, c.width, !0), _.attr("viewBox", `0 0 ${c.width} ${c.height}`), m.attr("fill", o.backgroundColor), n.setTmpSVGG(_.append("g").attr("class", "mermaid-tmp-group"));
1250
- const T = n.getDrawableElem(), S = {};
1251
- function P(p) {
1252
- let C = A, h = "";
1253
- for (const [L] of p.entries()) {
1254
- let z = A;
1255
- L > 0 && S[h] && (z = S[h]), h += p[L], C = S[h], C || (C = S[h] = z.append("g").attr("class", p[L]));
1256
- }
1257
- return C;
1258
- }
1259
- for (const p of T) {
1260
- if (p.data.length === 0)
1261
- continue;
1262
- const C = P(p.groupTexts);
1263
- switch (p.type) {
1264
- case "rect":
1265
- C.selectAll("rect").data(p.data).enter().append("rect").attr("x", (h) => h.x).attr("y", (h) => h.y).attr("width", (h) => h.width).attr("height", (h) => h.height).attr("fill", (h) => h.fill).attr("stroke", (h) => h.strokeFill).attr("stroke-width", (h) => h.strokeWidth);
1266
- break;
1267
- case "text":
1268
- C.selectAll("text").data(p.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (h) => h.fill).attr("font-size", (h) => h.fontSize).attr("dominant-baseline", (h) => f(h.verticalPos)).attr("text-anchor", (h) => d(h.horizontalPos)).attr("transform", (h) => R(h)).text((h) => h.text);
1269
- break;
1270
- case "path":
1271
- C.selectAll("path").data(p.data).enter().append("path").attr("d", (h) => h.path).attr("fill", (h) => h.fill ? h.fill : "none").attr("stroke", (h) => h.strokeFill).attr("stroke-width", (h) => h.strokeWidth);
1272
- break;
1273
- }
1274
- }
1275
- }, Ri = {
1276
- draw: ki
1277
- }, Vi = {
1278
- parser: ti,
1279
- db: _i,
1280
- renderer: Ri
1281
- };
1282
- export {
1283
- Vi as diagram
1284
- };