rapidograph 1.0.7 → 1.0.9
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.
- package/dist/components/rapido-bar/index.d.ts +0 -1
- package/dist/components/rapido-bar/index.js +106 -121
- package/dist/components/rapido-bar/index.js.map +1 -1
- package/dist/utils/dom.js +24 -26
- package/dist/utils/dom.js.map +1 -1
- package/dist/utils/rapidobar.d.ts +12 -15
- package/dist/utils/rapidobar.js +62 -53
- package/dist/utils/rapidobar.js.map +1 -1
- package/package.json +3 -3
|
@@ -47,7 +47,6 @@ export declare class Rapidobar extends LitElement {
|
|
|
47
47
|
private _textSizeDiv;
|
|
48
48
|
private _bars;
|
|
49
49
|
render(): import('lit-html').TemplateResult<1>;
|
|
50
|
-
connectedCallback(): void;
|
|
51
50
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
52
51
|
updated(changedProperties: Map<string, never>): void;
|
|
53
52
|
private _calculateYAxisWidths;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { LitElement as V, unsafeCSS as z, css as H, html as c, nothing as
|
|
2
|
-
import { state as _, property as d, query as y, queryAll as R, eventOptions as
|
|
1
|
+
import { LitElement as V, unsafeCSS as z, css as H, html as c, nothing as $ } from "lit";
|
|
2
|
+
import { state as _, property as d, query as y, queryAll as R, eventOptions as b, customElement as N } from "lit/decorators.js";
|
|
3
3
|
import { Tooltip as K } from "../../helpers/tooltip/index.js";
|
|
4
|
-
import { classMap as
|
|
4
|
+
import { classMap as B } from "lit/directives/class-map.js";
|
|
5
5
|
import { styleMap as F } from "lit/directives/style-map.js";
|
|
6
6
|
import U from "./rapidobar.css.js";
|
|
7
|
-
import { Orientation as
|
|
8
|
-
import {
|
|
9
|
-
import { MIN_Y_AXIS_WIDTH as
|
|
10
|
-
import { calculateYAxisWidths as
|
|
11
|
-
var
|
|
12
|
-
for (var
|
|
13
|
-
(
|
|
14
|
-
return o &&
|
|
7
|
+
import { Orientation as u, XAxisPosition as I, YAxisPosition as g, Theme as A, ShowLabels as M } from "../../shared/enums.js";
|
|
8
|
+
import { analyzeValues as j, formatLabels as S, generateTicks as q, noop as G, formatLabel as P, getSizeInPercentages as J, getUpdatedYAxisWidth as v } from "../../utils/rapidobar.js";
|
|
9
|
+
import { MIN_Y_AXIS_WIDTH as Q, MAX_Y_AXIS_WIDTH as m, DEFAULT_Y_AXIS_WIDTH as Z, X_AXIS_LAST_LABEL_CSS_VAR as tt, X_AXIS_FIRST_LABEL_CSS_VAR as it, DATA_LENGTH_CSS_VAR as et, X_AXIS_HEIGHT_CSS_VAR as st, Y_AXIS_WIDTH_CSS_VAR as C, SCROLLBAR_WIDTH_CSS_VAR as at } from "../../shared/constants.js";
|
|
10
|
+
import { calculateYAxisWidths as rt, getTextWidth as D, getScrollbarSize as ot } from "../../utils/dom.js";
|
|
11
|
+
var nt = Object.defineProperty, lt = Object.getOwnPropertyDescriptor, s = (t, i, r, o) => {
|
|
12
|
+
for (var a = o > 1 ? void 0 : o ? lt(i, r) : i, n = t.length - 1, l; n >= 0; n--)
|
|
13
|
+
(l = t[n]) && (a = (o ? l(i, r, a) : l(a)) || a);
|
|
14
|
+
return o && a && nt(i, r, a), a;
|
|
15
15
|
};
|
|
16
16
|
let e = class extends V {
|
|
17
17
|
constructor() {
|
|
18
|
-
super(...arguments), this._data = [], this._categoryLabels = [], this._ticks = [], this._tickLabels = [], this._hasPositive = !0, this._hasNegative = !1, this._allPositive = !0, this._allNegative = !1, this._yAxisMinWidth =
|
|
18
|
+
super(...arguments), this._data = [], this._categoryLabels = [], this._ticks = [], this._tickLabels = [], this._hasPositive = !0, this._hasNegative = !1, this._allPositive = !0, this._allNegative = !1, this._yAxisMinWidth = Q, this._yAxisMaxWidth = m, this._xAxisHeight = 0, this._firstXAxisLabelWidth = 0, this._lastXAxisLabelWidth = 0, this._scrollbarSize = 0, this._activeBar = null, this._yAxisWidth = Z, this._isDraggingYAxis = !1, this._focusedBarIndex = 0, this.formatters = {}, this.orientation = u.Vertical, this.xAxisPosition = I.Bottom, this.yAxisPosition = g.Left, this.theme = A.Light, this.tooltipTheme = A.Light, this.categoryLabel = "", this.valueLabel = "", this.showLabels = M.Always;
|
|
19
19
|
}
|
|
20
20
|
static get styles() {
|
|
21
21
|
return H`
|
|
@@ -35,12 +35,12 @@ let e = class extends V {
|
|
|
35
35
|
set data(t) {
|
|
36
36
|
const i = this._data;
|
|
37
37
|
this._data = t, this.requestUpdate("data", i);
|
|
38
|
-
const
|
|
39
|
-
this.data.forEach(({ category:
|
|
40
|
-
o[p] =
|
|
41
|
-
})
|
|
42
|
-
const
|
|
43
|
-
this.
|
|
38
|
+
const r = this._data.length, o = new Array(r), a = new Array(r);
|
|
39
|
+
this.data.forEach(({ category: l, value: x }, p) => {
|
|
40
|
+
o[p] = l, a[p] = x;
|
|
41
|
+
});
|
|
42
|
+
const n = j(a);
|
|
43
|
+
this._hasPositive = n.hasPositive, this._hasNegative = n.hasNegative, this._allPositive = n.allPositive, this._allNegative = n.allNegative, this._categoryLabels = S(o, this.formatters.category), this._ticks = q(n.axisMin, n.axisMax), this._tickLabels = S(this._ticks, this.formatters.value), this._calculateTickWidths();
|
|
44
44
|
}
|
|
45
45
|
get _wrapperClasses() {
|
|
46
46
|
return {
|
|
@@ -53,12 +53,12 @@ let e = class extends V {
|
|
|
53
53
|
}
|
|
54
54
|
get _wrapperStyles() {
|
|
55
55
|
return {
|
|
56
|
-
[
|
|
57
|
-
[
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
[
|
|
56
|
+
[at]: `${this._scrollbarSize}px`,
|
|
57
|
+
[C]: `${this._yAxisWidth}px`,
|
|
58
|
+
[st]: `${this._xAxisHeight}px`,
|
|
59
|
+
[et]: this.data.length,
|
|
60
|
+
[it]: `${this._firstXAxisLabelWidth}px`,
|
|
61
|
+
[tt]: `${this._lastXAxisLabelWidth}px`
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
get _barContainerClasses() {
|
|
@@ -68,105 +68,93 @@ let e = class extends V {
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
render() {
|
|
71
|
-
const t = this.orientation ===
|
|
72
|
-
let o,
|
|
73
|
-
t ? (o = this._categoryLabels,
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<div class="rpg-axis-label" title=${h}>${h}</div>
|
|
78
|
-
`);
|
|
79
|
-
const n = c`
|
|
71
|
+
const t = this.orientation === u.Vertical, i = t ? this.categoryLabel : this.valueLabel, r = t ? this.valueLabel : this.categoryLabel;
|
|
72
|
+
let o, a;
|
|
73
|
+
t ? (o = this._categoryLabels, a = this._tickLabels) : (o = this._tickLabels, a = this._categoryLabels);
|
|
74
|
+
const n = o.map(
|
|
75
|
+
(h) => c`<div class="rpg-axis-label" title=${h}>${h}</div>`
|
|
76
|
+
), l = c`
|
|
80
77
|
<div class="rpg-x-axis">
|
|
81
78
|
${i ? c`<div class="rpg-axis-label rpg-axis-title">
|
|
82
79
|
<div class="rpg-axis-title-content">${i}</div>
|
|
83
|
-
</div>` :
|
|
84
|
-
<div class="rpg-x-axis-labels">${
|
|
80
|
+
</div>` : $}
|
|
81
|
+
<div class="rpg-x-axis-labels">${n}</div>
|
|
85
82
|
</div>
|
|
86
|
-
`, x =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<div class="rpg-axis-label" title=${h}>${h}</div>
|
|
90
|
-
`);
|
|
91
|
-
const u = c`
|
|
83
|
+
`, x = a.map(
|
|
84
|
+
(h) => c`<div class="rpg-axis-label" title=${h}>${h}</div>`
|
|
85
|
+
), p = c`
|
|
92
86
|
<div class="rpg-y-axis">
|
|
93
87
|
<div class="rpg-y-axis-labels">${x}</div>
|
|
94
88
|
<div
|
|
95
89
|
class="rpg-y-axis-line-container"
|
|
96
90
|
role="slider"
|
|
97
|
-
tabindex=${this.yAxisPosition ===
|
|
91
|
+
tabindex=${this.yAxisPosition === g.Left ? "1" : "0"}
|
|
98
92
|
aria-valuemin="0"
|
|
99
93
|
aria-valuemax="100"
|
|
100
94
|
aria-valuenow=${this._yAxisWidthPercentage}
|
|
101
95
|
aria-valuetext=${this._yAxisWidthDescription}
|
|
102
96
|
aria-label=${`Y-axis positioned ${this.yAxisPosition}`}
|
|
103
|
-
@dragstart=${
|
|
97
|
+
@dragstart=${G}
|
|
104
98
|
@pointerdown=${this.onYAxisPointerDown}
|
|
105
99
|
@keydown=${this.onYAxisKeyDown}
|
|
106
100
|
>
|
|
107
|
-
${
|
|
108
|
-
<div class="rpg-axis-title-content">${
|
|
109
|
-
</div>` :
|
|
101
|
+
${r ? c`<div class="rpg-axis-label rpg-axis-title">
|
|
102
|
+
<div class="rpg-axis-title-content">${r}</div>
|
|
103
|
+
</div>` : $}
|
|
110
104
|
<div class="rpg-y-axis-line"></div>
|
|
111
105
|
</div>
|
|
112
106
|
</div>
|
|
113
|
-
`,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const W = [];
|
|
117
|
-
for (const [h, { value: g }] of this.data.entries()) {
|
|
118
|
-
const w = h === this._focusedBarIndex, $ = this._categoryLabels[h], X = this._tickLabels[h], B = D(g, this.formatters.data), Y = D(
|
|
119
|
-
g,
|
|
107
|
+
`, T = this._ticks.slice(1).map(() => c`<div class="rpg-gridline"></div>`), X = this.data.map(({ value: h }, f) => {
|
|
108
|
+
const L = f === this._focusedBarIndex, W = this._categoryLabels[f], Y = this._tickLabels[f], w = P(h, this.formatters.data), E = P(
|
|
109
|
+
h,
|
|
120
110
|
this.formatters.tooltip || this.formatters.value
|
|
121
|
-
),
|
|
122
|
-
|
|
111
|
+
), k = this._allPositive || !this._allNegative ? h >= 0 : h > 0, O = J(
|
|
112
|
+
h,
|
|
123
113
|
this._ticks[0],
|
|
124
114
|
this._ticks.at(-1)
|
|
125
115
|
);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
116
|
+
return c`<li
|
|
117
|
+
class="rpg-bar ${k ? "positive" : "negative"}"
|
|
118
|
+
tabindex=${L ? 0 : -1}
|
|
119
|
+
aria-current=${L ? "true" : "false"}
|
|
120
|
+
aria-label="${W}: ${Y}"
|
|
121
|
+
data-category=${W}
|
|
122
|
+
data-value=${E}
|
|
123
|
+
>
|
|
124
|
+
<div
|
|
125
|
+
class="rpg-bar-content"
|
|
126
|
+
style="--rpg-bar-size: ${Math.abs(O)}%;"
|
|
134
127
|
>
|
|
135
|
-
<div
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<div class="rpg-small-bar-label">${B}</div>
|
|
141
|
-
</div>
|
|
142
|
-
</li>`
|
|
143
|
-
);
|
|
144
|
-
}
|
|
128
|
+
<div class="rpg-bar-label">${w}</div>
|
|
129
|
+
<div class="rpg-small-bar-label">${w}</div>
|
|
130
|
+
</div>
|
|
131
|
+
</li>`;
|
|
132
|
+
});
|
|
145
133
|
return c`
|
|
146
134
|
<div
|
|
147
|
-
class=${
|
|
135
|
+
class=${B(this._wrapperClasses)}
|
|
148
136
|
style=${F(this._wrapperStyles)}
|
|
149
137
|
role="figure"
|
|
150
138
|
>
|
|
151
139
|
<div class="rpg-scrollable">
|
|
152
140
|
<div class="rpg-scrollable-content">
|
|
153
|
-
${t ?
|
|
141
|
+
${t ? l : p}
|
|
154
142
|
<div class="rpg-content-container">
|
|
155
|
-
<div class="rpg-gridlines">${
|
|
143
|
+
<div class="rpg-gridlines">${T}</div>
|
|
156
144
|
<ul
|
|
157
|
-
class=${
|
|
145
|
+
class=${B(this._barContainerClasses)}
|
|
158
146
|
@mouseenter=${this.onBarEnter}
|
|
159
147
|
@mouseleave=${this.onBarContainerMouseLeave}
|
|
160
148
|
@focus=${this.onBarContainerFocus}
|
|
161
149
|
@blur=${this.onBarContainerBlur}
|
|
162
150
|
@keydown=${this.onBarContainerKeyDown}
|
|
163
151
|
>
|
|
164
|
-
${this.data.length ?
|
|
152
|
+
${this.data.length ? X : c`<div class="rpg-empty-state">No data</div>`}
|
|
165
153
|
</ul>
|
|
166
154
|
</div>
|
|
167
155
|
</div>
|
|
168
156
|
</div>
|
|
169
|
-
${t ?
|
|
157
|
+
${t ? p : l}
|
|
170
158
|
</div>
|
|
171
159
|
<tool-tip
|
|
172
160
|
.element=${this._isDraggingYAxis ? null : this._activeBar}
|
|
@@ -178,18 +166,15 @@ let e = class extends V {
|
|
|
178
166
|
<div id="rpg-get-text-width" class="rpg-axis-label"></div>
|
|
179
167
|
`;
|
|
180
168
|
}
|
|
181
|
-
connectedCallback() {
|
|
182
|
-
super.connectedCallback(), customElements.get("tool-tip") || customElements.define("tool-tip", K);
|
|
183
|
-
}
|
|
184
169
|
firstUpdated(t) {
|
|
185
170
|
super.firstUpdated(t), this._calculateYAxisWidths(), this.addObservers();
|
|
186
171
|
}
|
|
187
172
|
updated(t) {
|
|
188
|
-
this._xAxis && (this._xAxisHeight = this._xAxis.getBoundingClientRect().height
|
|
173
|
+
this._xAxis && (this._xAxisHeight = (this._xAxis.getBoundingClientRect().height || 1) - 1), (t.has("orientation") || t.has("data")) && this._calculateYAxisWidths();
|
|
189
174
|
}
|
|
190
175
|
_calculateYAxisWidths() {
|
|
191
|
-
const t = this.orientation ===
|
|
192
|
-
[this._yAxisMinWidth, this._yAxisWidth, this._yAxisMaxWidth] =
|
|
176
|
+
const t = this.orientation === u.Vertical;
|
|
177
|
+
[this._yAxisMinWidth, this._yAxisWidth, this._yAxisMaxWidth] = rt(
|
|
193
178
|
this._textSizeDiv,
|
|
194
179
|
this._wrapper,
|
|
195
180
|
this._yAxis,
|
|
@@ -197,10 +182,10 @@ let e = class extends V {
|
|
|
197
182
|
);
|
|
198
183
|
}
|
|
199
184
|
_calculateTickWidths() {
|
|
200
|
-
this._firstXAxisLabelWidth =
|
|
185
|
+
this._firstXAxisLabelWidth = D(
|
|
201
186
|
this._textSizeDiv,
|
|
202
187
|
this._tickLabels[0].toString()
|
|
203
|
-
), this._lastXAxisLabelWidth =
|
|
188
|
+
), this._lastXAxisLabelWidth = D(
|
|
204
189
|
this._textSizeDiv,
|
|
205
190
|
this._tickLabels.at(-1)?.toString()
|
|
206
191
|
);
|
|
@@ -210,7 +195,7 @@ let e = class extends V {
|
|
|
210
195
|
root: this._scrollableElem,
|
|
211
196
|
threshold: 1
|
|
212
197
|
}, i = () => {
|
|
213
|
-
this._scrollbarSize =
|
|
198
|
+
this._scrollbarSize = ot(
|
|
214
199
|
this.orientation,
|
|
215
200
|
this._scrollableElem
|
|
216
201
|
);
|
|
@@ -238,50 +223,50 @@ let e = class extends V {
|
|
|
238
223
|
(!i || i && !this._barContainer.contains(i)) && (this._activeBar = null, this._focusedBarIndex = 0);
|
|
239
224
|
}
|
|
240
225
|
onBarContainerKeyDown(t) {
|
|
241
|
-
const i = this.orientation ===
|
|
242
|
-
|
|
226
|
+
const i = this.orientation === u.Vertical, r = i ? "ArrowRight" : "ArrowDown", o = i ? "ArrowLeft" : "ArrowUp", a = t.key;
|
|
227
|
+
a === r ? (t.preventDefault(), this._focusedBarIndex = Math.min(
|
|
243
228
|
this._focusedBarIndex + 1,
|
|
244
229
|
this.data.length - 1
|
|
245
|
-
), this._bars[this._focusedBarIndex].focus()) :
|
|
230
|
+
), this._bars[this._focusedBarIndex].focus()) : a === o ? (t.preventDefault(), this._focusedBarIndex = Math.max(this._focusedBarIndex - 1, 0), this._bars[this._focusedBarIndex].focus()) : a === "Home" ? (t.preventDefault(), this._focusedBarIndex = 0, this._bars[this._focusedBarIndex].focus()) : a === "End" && (t.preventDefault(), this._focusedBarIndex = this.data.length - 1, this._bars[this._focusedBarIndex].focus());
|
|
246
231
|
}
|
|
247
232
|
onYAxisPointerDown(t) {
|
|
248
233
|
t.preventDefault(), this._isDraggingYAxis = !0;
|
|
249
234
|
let i = this._yAxisWidth;
|
|
250
|
-
const
|
|
251
|
-
const n =
|
|
252
|
-
i =
|
|
253
|
-
let p =
|
|
254
|
-
i <
|
|
235
|
+
const r = (a) => {
|
|
236
|
+
const n = this._wrapper, l = a.clientX, x = t.clientX;
|
|
237
|
+
i = this._yAxisWidth + (this.yAxisPosition === g.Left ? l - x : x - l);
|
|
238
|
+
let p = this._yAxisMaxWidth;
|
|
239
|
+
i < this._yAxisMinWidth && (i = this._yAxisMinWidth), this._yAxisMaxWidth > n.offsetWidth - m && (p = n.offsetWidth - m), i > p && (i = p), this._wrapper.style.setProperty(C, `${i}px`);
|
|
240
|
+
}, o = () => {
|
|
241
|
+
this._yAxisWidth = i, this._isDraggingYAxis = !1, this._oldCursor ? document.body.style.cursor = this._oldCursor : document.body.style.removeProperty("cursor"), window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", o);
|
|
255
242
|
};
|
|
256
|
-
|
|
257
|
-
a._yAxisWidth = i, a._isDraggingYAxis = !1, a._oldCursor ? document.body.style.cursor = a._oldCursor : document.body.style.removeProperty("cursor"), window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", r);
|
|
258
|
-
}
|
|
259
|
-
a._oldCursor = document.body.style.cursor, document.body.style.cursor = "col-resize", window.addEventListener("pointermove", o), window.addEventListener("pointerup", r);
|
|
243
|
+
this._oldCursor = document.body.style.cursor, document.body.style.cursor = "col-resize", window.addEventListener("pointermove", r), window.addEventListener("pointerup", o);
|
|
260
244
|
}
|
|
261
245
|
onYAxisKeyDown(t) {
|
|
262
|
-
const i = parseInt(this._yAxisWidthPercentage ?? "0", 10),
|
|
246
|
+
const i = parseInt(this._yAxisWidthPercentage ?? "0", 10), r = t.key, o = this.yAxisPosition === g.Left, a = o ? "ArrowLeft" : "ArrowRight", n = o ? "ArrowRight" : "ArrowLeft", l = {
|
|
263
247
|
currentPercentage: i,
|
|
264
248
|
minWidth: this._yAxisMinWidth,
|
|
265
249
|
maxWidth: this._yAxisMaxWidth
|
|
266
250
|
};
|
|
267
|
-
|
|
268
|
-
...
|
|
251
|
+
r === a ? (t.preventDefault(), this._yAxisWidth = v({
|
|
252
|
+
...l,
|
|
269
253
|
widthPercentage: Math.max(i - 5, 0)
|
|
270
|
-
}) ?? this._yAxisWidth) :
|
|
271
|
-
...
|
|
254
|
+
}) ?? this._yAxisWidth) : r === n ? (t.preventDefault(), this._yAxisWidth = v({
|
|
255
|
+
...l,
|
|
272
256
|
widthPercentage: Math.min(i + 5, 100)
|
|
273
|
-
}) ?? this._yAxisWidth) :
|
|
274
|
-
...
|
|
257
|
+
}) ?? this._yAxisWidth) : r === "Home" ? (t.preventDefault(), this._yAxisWidth = v({
|
|
258
|
+
...l,
|
|
275
259
|
widthPercentage: 0
|
|
276
|
-
}) ?? this._yAxisWidth) :
|
|
277
|
-
...
|
|
260
|
+
}) ?? this._yAxisWidth) : r === "End" && (t.preventDefault(), this._yAxisWidth = v({
|
|
261
|
+
...l,
|
|
278
262
|
widthPercentage: 100
|
|
279
263
|
}) ?? this._yAxisWidth);
|
|
280
264
|
}
|
|
281
265
|
disconnectedCallback() {
|
|
282
|
-
super.disconnectedCallback(), this._vObserver?.
|
|
266
|
+
super.disconnectedCallback(), this._vObserver?.disconnect(), this._hObserver?.disconnect();
|
|
283
267
|
}
|
|
284
268
|
};
|
|
269
|
+
customElements.get("tool-tip") || customElements.define("tool-tip", K);
|
|
285
270
|
s([
|
|
286
271
|
_()
|
|
287
272
|
], e.prototype, "_xAxisHeight", 2);
|
|
@@ -313,19 +298,19 @@ s([
|
|
|
313
298
|
d({ type: Object, attribute: !1 })
|
|
314
299
|
], e.prototype, "formatters", 2);
|
|
315
300
|
s([
|
|
316
|
-
d({ type:
|
|
301
|
+
d({ type: u, reflect: !0 })
|
|
317
302
|
], e.prototype, "orientation", 2);
|
|
318
303
|
s([
|
|
319
|
-
d({ type:
|
|
304
|
+
d({ type: I, attribute: "x-axis-position" })
|
|
320
305
|
], e.prototype, "xAxisPosition", 2);
|
|
321
306
|
s([
|
|
322
|
-
d({ type:
|
|
307
|
+
d({ type: g, attribute: "y-axis-position" })
|
|
323
308
|
], e.prototype, "yAxisPosition", 2);
|
|
324
309
|
s([
|
|
325
|
-
d({ type:
|
|
310
|
+
d({ type: A, reflect: !0 })
|
|
326
311
|
], e.prototype, "theme", 2);
|
|
327
312
|
s([
|
|
328
|
-
d({ type:
|
|
313
|
+
d({ type: A, attribute: "tooltip-theme" })
|
|
329
314
|
], e.prototype, "tooltipTheme", 2);
|
|
330
315
|
s([
|
|
331
316
|
d({ type: String, attribute: "category-label" })
|
|
@@ -334,7 +319,7 @@ s([
|
|
|
334
319
|
d({ type: String, attribute: "value-label" })
|
|
335
320
|
], e.prototype, "valueLabel", 2);
|
|
336
321
|
s([
|
|
337
|
-
d({ type:
|
|
322
|
+
d({ type: M, attribute: "show-labels" })
|
|
338
323
|
], e.prototype, "showLabels", 2);
|
|
339
324
|
s([
|
|
340
325
|
y(".rpg")
|
|
@@ -358,19 +343,19 @@ s([
|
|
|
358
343
|
R(".rpg-bar")
|
|
359
344
|
], e.prototype, "_bars", 2);
|
|
360
345
|
s([
|
|
361
|
-
|
|
346
|
+
b({ capture: !0 })
|
|
362
347
|
], e.prototype, "onBarEnter", 1);
|
|
363
348
|
s([
|
|
364
|
-
|
|
349
|
+
b({ capture: !0 })
|
|
365
350
|
], e.prototype, "onBarContainerMouseLeave", 1);
|
|
366
351
|
s([
|
|
367
|
-
|
|
352
|
+
b({ capture: !0 })
|
|
368
353
|
], e.prototype, "onBarContainerFocus", 1);
|
|
369
354
|
s([
|
|
370
|
-
|
|
355
|
+
b({ capture: !0 })
|
|
371
356
|
], e.prototype, "onBarContainerBlur", 1);
|
|
372
357
|
s([
|
|
373
|
-
|
|
358
|
+
b({ capture: !0 })
|
|
374
359
|
], e.prototype, "onBarContainerKeyDown", 1);
|
|
375
360
|
e = s([
|
|
376
361
|
N("rapido-bar")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../lib/components/rapido-bar/index.ts"],"sourcesContent":["import {\n DATA_LENGTH_CSS_VAR,\n DEFAULT_Y_AXIS_WIDTH,\n type DataItem,\n MAX_Y_AXIS_WIDTH,\n MIN_Y_AXIS_WIDTH,\n Orientation,\n SCROLLBAR_WIDTH_CSS_VAR,\n ShowLabels,\n Theme,\n type ValueFormatters,\n XAxisPosition,\n X_AXIS_FIRST_LABEL_CSS_VAR,\n X_AXIS_HEIGHT_CSS_VAR,\n X_AXIS_LAST_LABEL_CSS_VAR,\n YAxisPosition,\n Y_AXIS_WIDTH_CSS_VAR,\n} from \"../../shared\";\nimport {\n LitElement,\n type PropertyValues,\n css,\n html,\n nothing,\n unsafeCSS,\n} from \"lit\";\nimport {\n calculateYAxisWidths,\n checkIfAllPositiveOrNegative,\n checkIfSomePositiveAndNegative,\n formatLabel,\n formatLabels,\n generateTicks,\n getMinAndMax,\n getScrollbarSize,\n getSizeInPercentages,\n getTextWidth,\n getUpdatedYAxisWidth,\n noop,\n} from \"../../utils\";\nimport {\n customElement,\n eventOptions,\n property,\n query,\n queryAll,\n state,\n} from \"lit/decorators.js\";\nimport { Tooltip } from \"../../helpers/tooltip\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport styles from \"./rapidobar.css?inline\";\n\n@customElement(\"rapido-bar\")\nexport class Rapidobar extends LitElement {\n static get styles() {\n return css`\n ${unsafeCSS(styles)}\n `;\n }\n\n private _data: DataItem[] = [];\n private _categoryLabels: (string | number)[] = [];\n private _ticks: number[] = [];\n private _tickLabels: (string | number)[] = [];\n private _hasPositive: boolean = true;\n private _hasNegative: boolean = false;\n private _allPositive: boolean = true;\n private _allNegative: boolean = false;\n private _yAxisMinWidth: number = MIN_Y_AXIS_WIDTH;\n private _yAxisMaxWidth: number = MAX_Y_AXIS_WIDTH;\n private _vObserver: IntersectionObserver | undefined;\n private _hObserver: IntersectionObserver | undefined;\n private _oldCursor?: string;\n\n private get _yAxisWidthPercentage() {\n const maxYAxisWidth = this._yAxisMaxWidth - this._yAxisMinWidth;\n const currentYAxisWidth = this._yAxisWidth - this._yAxisMinWidth;\n return ((currentYAxisWidth * 100) / maxYAxisWidth).toFixed(0);\n }\n\n private get _yAxisWidthDescription() {\n return `Y-axis offset ${this._yAxisWidthPercentage}%`;\n }\n\n @state()\n private _xAxisHeight: number = 0;\n @state()\n private _firstXAxisLabelWidth: number = 0;\n @state()\n private _lastXAxisLabelWidth: number = 0;\n @state()\n private _scrollbarSize: number = 0;\n @state()\n private _activeBar: HTMLElement | null = null;\n @state()\n private _yAxisWidth: number = DEFAULT_Y_AXIS_WIDTH;\n @state()\n private _isDraggingYAxis: boolean = false;\n @state()\n private _focusedBarIndex: number = 0;\n\n @property({ type: Array, attribute: false })\n get data(): DataItem[] {\n return this._data || [];\n }\n\n set data(value: DataItem[]) {\n const oldValue = this._data;\n this._data = value;\n this.requestUpdate(\"data\", oldValue);\n\n const length = this._data.length;\n const categories = new Array<string>(length);\n const values = new Array<number>(length);\n this.data.forEach(({ category, value }, index) => {\n categories[index] = category;\n values[index] = value;\n });\n this._categoryLabels = formatLabels(categories, this.formatters.category);\n const [minBarSize, maxBarSize] = getMinAndMax(values);\n this._ticks = generateTicks(minBarSize, maxBarSize);\n this._tickLabels = formatLabels(this._ticks, this.formatters.value);\n [this._hasPositive, this._hasNegative] =\n checkIfSomePositiveAndNegative(values);\n [this._allPositive, this._allNegative] =\n checkIfAllPositiveOrNegative(values);\n this._calculateTickWidths();\n }\n\n @property({ type: Object, attribute: false })\n formatters: ValueFormatters = {};\n\n @property({ type: Orientation, reflect: true })\n orientation: Orientation = Orientation.Vertical;\n\n @property({ type: XAxisPosition, attribute: \"x-axis-position\" })\n xAxisPosition: XAxisPosition = XAxisPosition.Bottom;\n\n @property({ type: YAxisPosition, attribute: \"y-axis-position\" })\n yAxisPosition: YAxisPosition = YAxisPosition.Left;\n\n @property({ type: Theme, reflect: true })\n theme: Theme = Theme.Light;\n\n @property({ type: Theme, attribute: \"tooltip-theme\" })\n tooltipTheme: Theme = Theme.Light;\n\n @property({ type: String, attribute: \"category-label\" })\n categoryLabel: string = \"\";\n\n @property({ type: String, attribute: \"value-label\" })\n valueLabel: string = \"\";\n\n @property({ type: ShowLabels, attribute: \"show-labels\" })\n showLabels: ShowLabels = ShowLabels.Always;\n\n private get _wrapperClasses() {\n return {\n rpg: true,\n [this.orientation]: true,\n [`x-axis-${this.xAxisPosition}`]: true,\n [`y-axis-${this.yAxisPosition}`]: true,\n [`labels-${this.showLabels}`]: true,\n };\n }\n private get _wrapperStyles() {\n return {\n [SCROLLBAR_WIDTH_CSS_VAR]: `${this._scrollbarSize}px`,\n [Y_AXIS_WIDTH_CSS_VAR]: `${this._yAxisWidth}px`,\n [X_AXIS_HEIGHT_CSS_VAR]: `${this._xAxisHeight}px`,\n [DATA_LENGTH_CSS_VAR]: this.data.length,\n [X_AXIS_FIRST_LABEL_CSS_VAR]: `${this._firstXAxisLabelWidth}px`,\n [X_AXIS_LAST_LABEL_CSS_VAR]: `${this._lastXAxisLabelWidth}px`,\n };\n }\n private get _barContainerClasses() {\n return {\n \"rpg-bar-container\": true,\n \"start-from-half\": this._hasPositive && this._hasNegative,\n };\n }\n\n @query(\".rpg\")\n private _wrapper!: HTMLElement;\n @query(\".rpg-scrollable\")\n private _scrollableElem!: HTMLElement;\n @query(\".rpg-bar-container\")\n private _barContainer!: HTMLElement;\n @query(\".rpg-x-axis\")\n private _xAxis!: HTMLElement;\n @query(\".rpg-y-axis\")\n private _yAxis!: HTMLElement;\n @query(\"#rpg-get-text-width\")\n private _textSizeDiv!: HTMLElement;\n @queryAll(\".rpg-bar\")\n private _bars!: HTMLElement[];\n\n render() {\n const isVertical = this.orientation === Orientation.Vertical;\n const xAxisLabel = isVertical ? this.categoryLabel : this.valueLabel;\n const yAxisLabel = isVertical ? this.valueLabel : this.categoryLabel;\n let xAxisLabels;\n let yAxisLabels;\n if (isVertical) {\n xAxisLabels = this._categoryLabels;\n yAxisLabels = this._tickLabels;\n } else {\n xAxisLabels = this._tickLabels;\n yAxisLabels = this._categoryLabels;\n }\n\n const xAxisLabelTemplates = [];\n for (const label of xAxisLabels) {\n xAxisLabelTemplates.push(html`\n <div class=\"rpg-axis-label\" title=${label}>${label}</div>\n `);\n }\n const xAxisTemplate = html`\n <div class=\"rpg-x-axis\">\n ${xAxisLabel\n ? html`<div class=\"rpg-axis-label rpg-axis-title\">\n <div class=\"rpg-axis-title-content\">${xAxisLabel}</div>\n </div>`\n : nothing}\n <div class=\"rpg-x-axis-labels\">${xAxisLabelTemplates}</div>\n </div>\n `;\n\n const yAxisLabelTemplates = [];\n for (const label of yAxisLabels) {\n yAxisLabelTemplates.push(html`\n <div class=\"rpg-axis-label\" title=${label}>${label}</div>\n `);\n }\n\n // tabindex matches flex order - visual and focus order are synchronized\n const yAxisTemplate = html`\n <div class=\"rpg-y-axis\">\n <div class=\"rpg-y-axis-labels\">${yAxisLabelTemplates}</div>\n <div\n class=\"rpg-y-axis-line-container\"\n role=\"slider\"\n tabindex=${this.yAxisPosition === YAxisPosition.Left ? \"1\" : \"0\"}\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n aria-valuenow=${this._yAxisWidthPercentage}\n aria-valuetext=${this._yAxisWidthDescription}\n aria-label=${`Y-axis positioned ${this.yAxisPosition}`}\n @dragstart=${noop}\n @pointerdown=${this.onYAxisPointerDown}\n @keydown=${this.onYAxisKeyDown}\n >\n ${yAxisLabel\n ? html`<div class=\"rpg-axis-label rpg-axis-title\">\n <div class=\"rpg-axis-title-content\">${yAxisLabel}</div>\n </div>`\n : nothing}\n <div class=\"rpg-y-axis-line\"></div>\n </div>\n </div>\n `;\n\n const gridlineTemplates = [];\n for (let i = 0; i < this._ticks.length - 1; i++) {\n gridlineTemplates.push(html`<div class=\"rpg-gridline\"></div>`);\n }\n\n const barTemplates = [];\n for (const [index, { value }] of this.data.entries()) {\n const isFocused = index === this._focusedBarIndex;\n const category = this._categoryLabels[index];\n const axisValue = this._tickLabels[index];\n const barValue = formatLabel(value, this.formatters.data);\n const tooltipValue = formatLabel(\n value,\n this.formatters.tooltip || this.formatters.value,\n );\n\n const isPositive =\n this._allPositive || !this._allNegative ? value >= 0 : value > 0;\n const barSize = getSizeInPercentages(\n value,\n this._ticks[0],\n this._ticks.at(-1),\n );\n\n barTemplates.push(\n html`<li\n class=\"rpg-bar ${isPositive ? \"positive\" : \"negative\"}\"\n tabindex=${isFocused ? 0 : -1}\n aria-current=${isFocused ? \"true\" : \"false\"}\n aria-label=\"${category}: ${axisValue}\"\n data-category=${category}\n data-value=${tooltipValue}\n >\n <div\n class=\"rpg-bar-content\"\n style=\"--rpg-bar-size: ${Math.abs(barSize)}%;\"\n >\n <div class=\"rpg-bar-label\">${barValue}</div>\n <div class=\"rpg-small-bar-label\">${barValue}</div>\n </div>\n </li>`,\n );\n }\n\n return html`\n <div\n class=${classMap(this._wrapperClasses)}\n style=${styleMap(this._wrapperStyles)}\n role=\"figure\"\n >\n <div class=\"rpg-scrollable\">\n <div class=\"rpg-scrollable-content\">\n ${isVertical ? xAxisTemplate : yAxisTemplate}\n <div class=\"rpg-content-container\">\n <div class=\"rpg-gridlines\">${gridlineTemplates}</div>\n <ul\n class=${classMap(this._barContainerClasses)}\n @mouseenter=${this.onBarEnter}\n @mouseleave=${this.onBarContainerMouseLeave}\n @focus=${this.onBarContainerFocus}\n @blur=${this.onBarContainerBlur}\n @keydown=${this.onBarContainerKeyDown}\n >\n ${this.data.length\n ? barTemplates\n : html`<div class=\"rpg-empty-state\">No data</div>`}\n </ul>\n </div>\n </div>\n </div>\n ${isVertical ? yAxisTemplate : xAxisTemplate}\n </div>\n <tool-tip\n .element=${this._isDraggingYAxis ? null : this._activeBar}\n .container=${this._scrollableElem}\n orientation=${this.orientation}\n theme=${this.tooltipTheme}\n ></tool-tip>\n <div aria-live=\"polite\">${this._yAxisWidthDescription}</div>\n <div id=\"rpg-get-text-width\" class=\"rpg-axis-label\"></div>\n `;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n if (!customElements.get(\"tool-tip\")) {\n customElements.define(\"tool-tip\", Tooltip);\n }\n }\n\n protected firstUpdated(_changedProperties: PropertyValues): void {\n super.firstUpdated(_changedProperties);\n\n this._calculateYAxisWidths();\n this.addObservers();\n }\n\n updated(changedProperties: Map<string, never>) {\n if (this._xAxis) {\n this._xAxisHeight = this._xAxis.getBoundingClientRect().height ?? 1 - 1;\n }\n\n if (changedProperties.get(\"orientation\") || changedProperties.get(\"data\")) {\n this._calculateYAxisWidths();\n }\n }\n\n private _calculateYAxisWidths(): void {\n const isVertical = this.orientation === Orientation.Vertical;\n [this._yAxisMinWidth, this._yAxisWidth, this._yAxisMaxWidth] =\n calculateYAxisWidths(\n this._textSizeDiv,\n this._wrapper,\n this._yAxis,\n isVertical ? this._tickLabels : this._categoryLabels,\n );\n }\n\n private _calculateTickWidths(): void {\n this._firstXAxisLabelWidth = getTextWidth(\n this._textSizeDiv,\n this._tickLabels[0].toString(),\n );\n this._lastXAxisLabelWidth = getTextWidth(\n this._textSizeDiv,\n this._tickLabels.at(-1)?.toString(),\n );\n }\n\n private addObservers() {\n const options = {\n root: this._scrollableElem,\n threshold: 1,\n };\n\n const callback = () => {\n this._scrollbarSize = getScrollbarSize(\n this.orientation,\n this._scrollableElem,\n );\n };\n this._vObserver = new IntersectionObserver(callback, {\n ...options,\n rootMargin: \"0px -16px\",\n });\n this._hObserver = new IntersectionObserver(callback, {\n ...options,\n rootMargin: \"-16px 0px\",\n });\n this._vObserver.observe(this._barContainer);\n this._hObserver.observe(this._barContainer);\n }\n\n @eventOptions({ capture: true })\n private onBarEnter(event: MouseEvent) {\n const target = event.target as HTMLElement;\n if (target.classList.contains(\"rpg-bar\")) {\n this._activeBar = target;\n }\n }\n\n @eventOptions({ capture: true })\n private onBarContainerMouseLeave(event: MouseEvent) {\n if (event.target === event.currentTarget) {\n this._activeBar = null;\n }\n }\n\n @eventOptions({ capture: true })\n private onBarContainerFocus(event: FocusEvent) {\n this._activeBar = event.target as HTMLElement;\n }\n\n @eventOptions({ capture: true })\n private onBarContainerBlur(event: FocusEvent) {\n const nextFocused = event.relatedTarget as HTMLElement;\n if (\n !nextFocused ||\n (nextFocused && !this._barContainer.contains(nextFocused))\n ) {\n this._activeBar = null;\n this._focusedBarIndex = 0;\n }\n }\n\n @eventOptions({ capture: true })\n private onBarContainerKeyDown(event: KeyboardEvent) {\n const isVertical = this.orientation === Orientation.Vertical;\n const nextKey = isVertical ? \"ArrowRight\" : \"ArrowDown\";\n const prevKey = isVertical ? \"ArrowLeft\" : \"ArrowUp\";\n const key = event.key;\n\n if (key === nextKey) {\n event.preventDefault();\n this._focusedBarIndex = Math.min(\n this._focusedBarIndex + 1,\n this.data.length - 1,\n );\n this._bars[this._focusedBarIndex].focus();\n } else if (key === prevKey) {\n event.preventDefault();\n this._focusedBarIndex = Math.max(this._focusedBarIndex - 1, 0);\n this._bars[this._focusedBarIndex].focus();\n } else if (key === \"Home\") {\n event.preventDefault();\n this._focusedBarIndex = 0;\n this._bars[this._focusedBarIndex].focus();\n } else if (key === \"End\") {\n event.preventDefault();\n this._focusedBarIndex = this.data.length - 1;\n this._bars[this._focusedBarIndex].focus();\n }\n }\n\n private onYAxisPointerDown(pointerDownEvent: PointerEvent) {\n pointerDownEvent.preventDefault();\n this._isDraggingYAxis = true;\n\n let newWidth = this._yAxisWidth;\n const self = this;\n\n const handlePointerMove = (pointerMoveEvent: PointerEvent) => {\n const parent = self._wrapper;\n\n const moveClientX = pointerMoveEvent.clientX;\n const downClientX = pointerDownEvent.clientX;\n\n newWidth =\n self._yAxisWidth +\n (self.yAxisPosition === YAxisPosition.Left\n ? moveClientX - downClientX\n : downClientX - moveClientX);\n let allowedMaxWidth = self._yAxisMaxWidth;\n\n // the pointer is out of slider => lock the thumb within the boundaries\n if (newWidth < self._yAxisMinWidth) {\n newWidth = self._yAxisMinWidth;\n }\n\n if (self._yAxisMaxWidth > parent.offsetWidth - MAX_Y_AXIS_WIDTH) {\n allowedMaxWidth = parent.offsetWidth - MAX_Y_AXIS_WIDTH;\n }\n if (newWidth > allowedMaxWidth) {\n newWidth = allowedMaxWidth;\n }\n this._wrapper.style.setProperty(Y_AXIS_WIDTH_CSS_VAR, `${newWidth}px`);\n };\n\n function handlePointerUp(): void {\n self._yAxisWidth = newWidth;\n self._isDraggingYAxis = false;\n if (self._oldCursor) {\n document.body.style.cursor = self._oldCursor;\n } else {\n document.body.style.removeProperty(\"cursor\");\n }\n window.removeEventListener(\"pointermove\", handlePointerMove);\n window.removeEventListener(\"pointerup\", handlePointerUp);\n }\n\n self._oldCursor = document.body.style.cursor;\n document.body.style.cursor = \"col-resize\";\n window.addEventListener(\"pointermove\", handlePointerMove);\n window.addEventListener(\"pointerup\", handlePointerUp);\n }\n\n private onYAxisKeyDown(event: KeyboardEvent): void {\n const percentage = parseInt(this._yAxisWidthPercentage ?? \"0\", 10);\n const key = event.key;\n const isLeftAxis = this.yAxisPosition === YAxisPosition.Left;\n const leftKey = isLeftAxis ? \"ArrowLeft\" : \"ArrowRight\";\n const rightKey = isLeftAxis ? \"ArrowRight\" : \"ArrowLeft\";\n const commonArgs = {\n currentPercentage: percentage,\n minWidth: this._yAxisMinWidth,\n maxWidth: this._yAxisMaxWidth,\n };\n\n if (key === leftKey) {\n event.preventDefault();\n this._yAxisWidth =\n getUpdatedYAxisWidth({\n ...commonArgs,\n widthPercentage: Math.max(percentage - 5, 0),\n }) ?? this._yAxisWidth;\n } else if (key === rightKey) {\n event.preventDefault();\n this._yAxisWidth =\n getUpdatedYAxisWidth({\n ...commonArgs,\n widthPercentage: Math.min(percentage + 5, 100),\n }) ?? this._yAxisWidth;\n } else if (key === \"Home\") {\n event.preventDefault();\n this._yAxisWidth =\n getUpdatedYAxisWidth({\n ...commonArgs,\n widthPercentage: 0,\n }) ?? this._yAxisWidth;\n } else if (key === \"End\") {\n event.preventDefault();\n this._yAxisWidth =\n getUpdatedYAxisWidth({\n ...commonArgs,\n widthPercentage: 100,\n }) ?? this._yAxisWidth;\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this._vObserver?.unobserve(this._barContainer);\n this._hObserver?.unobserve(this._barContainer);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"rapido-bar\": Rapidobar;\n }\n}\n"],"names":["Rapidobar","LitElement","MIN_Y_AXIS_WIDTH","MAX_Y_AXIS_WIDTH","DEFAULT_Y_AXIS_WIDTH","Orientation","XAxisPosition","YAxisPosition","Theme","ShowLabels","css","unsafeCSS","styles","maxYAxisWidth","value","oldValue","length","categories","values","category","index","formatLabels","minBarSize","maxBarSize","getMinAndMax","generateTicks","checkIfSomePositiveAndNegative","checkIfAllPositiveOrNegative","SCROLLBAR_WIDTH_CSS_VAR","Y_AXIS_WIDTH_CSS_VAR","X_AXIS_HEIGHT_CSS_VAR","DATA_LENGTH_CSS_VAR","X_AXIS_FIRST_LABEL_CSS_VAR","X_AXIS_LAST_LABEL_CSS_VAR","isVertical","xAxisLabel","yAxisLabel","xAxisLabels","yAxisLabels","xAxisLabelTemplates","label","html","xAxisTemplate","nothing","yAxisLabelTemplates","yAxisTemplate","noop","gridlineTemplates","i","barTemplates","isFocused","axisValue","barValue","formatLabel","tooltipValue","isPositive","barSize","getSizeInPercentages","classMap","styleMap","Tooltip","_changedProperties","changedProperties","calculateYAxisWidths","getTextWidth","options","callback","getScrollbarSize","event","target","nextFocused","nextKey","prevKey","key","pointerDownEvent","newWidth","self","handlePointerMove","pointerMoveEvent","parent","moveClientX","downClientX","allowedMaxWidth","handlePointerUp","percentage","isLeftAxis","leftKey","rightKey","commonArgs","getUpdatedYAxisWidth","__decorateClass","state","property","query","queryAll","eventOptions","customElement"],"mappings":";;;;;;;;;;;;;;;AAsDO,IAAMA,IAAN,cAAwBC,EAAW;AAAA,EAAnC,cAAA;AAAA,UAAA,GAAA,SAAA,GAOL,KAAQ,QAAoB,CAAA,GAC5B,KAAQ,kBAAuC,CAAA,GAC/C,KAAQ,SAAmB,CAAA,GAC3B,KAAQ,cAAmC,CAAA,GAC3C,KAAQ,eAAwB,IAChC,KAAQ,eAAwB,IAChC,KAAQ,eAAwB,IAChC,KAA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VAR,\n DEFAULT_Y_AXIS_WIDTH,\n type DataItem,\n MAX_Y_AXIS_WIDTH,\n MIN_Y_AXIS_WIDTH,\n Orientation,\n SCROLLBAR_WIDTH_CSS_VAR,\n ShowLabels,\n Theme,\n type ValueFormatters,\n XAxisPosition,\n X_AXIS_FIRST_LABEL_CSS_VAR,\n X_AXIS_HEIGHT_CSS_VAR,\n X_AXIS_LAST_LABEL_CSS_VAR,\n YAxisPosition,\n Y_AXIS_WIDTH_CSS_VAR,\n} from \"../../shared\";\nimport {\n LitElement,\n type PropertyValues,\n css,\n html,\n nothing,\n unsafeCSS,\n} from \"lit\";\nimport {\n analyzeValues,\n calculateYAxisWidths,\n formatLabel,\n formatLabels,\n generateTicks,\n getScrollbarSize,\n getSizeInPercentages,\n getTextWidth,\n getUpdatedYAxisWidth,\n noop,\n} from \"../../utils\";\nimport {\n customElement,\n eventOptions,\n property,\n query,\n queryAll,\n state,\n} from \"lit/decorators.js\";\nimport { Tooltip } from \"../../helpers/tooltip\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport styles from \"./rapidobar.css?inline\";\n\n@customElement(\"rapido-bar\")\nexport class Rapidobar extends LitElement {\n static {\n if (!customElements.get(\"tool-tip\")) {\n customElements.define(\"tool-tip\", Tooltip);\n }\n }\n\n static get styles() {\n return css`\n ${unsafeCSS(styles)}\n `;\n }\n\n private _data: DataItem[] = [];\n private _categoryLabels: (string | number)[] = [];\n private _ticks: number[] = [];\n private _tickLabels: (string | number)[] = [];\n private _hasPositive: boolean = true;\n private _hasNegative: boolean = false;\n private _allPositive: boolean = true;\n private _allNegative: boolean = false;\n private _yAxisMinWidth: number = MIN_Y_AXIS_WIDTH;\n private _yAxisMaxWidth: number = MAX_Y_AXIS_WIDTH;\n private _vObserver: IntersectionObserver | undefined;\n private _hObserver: IntersectionObserver | undefined;\n private _oldCursor?: string;\n\n private get _yAxisWidthPercentage() {\n const maxYAxisWidth = this._yAxisMaxWidth - this._yAxisMinWidth;\n const currentYAxisWidth = this._yAxisWidth - this._yAxisMinWidth;\n return ((currentYAxisWidth * 100) / maxYAxisWidth).toFixed(0);\n }\n\n private get _yAxisWidthDescription() {\n return `Y-axis offset ${this._yAxisWidthPercentage}%`;\n }\n\n @state()\n private _xAxisHeight: number = 0;\n @state()\n private _firstXAxisLabelWidth: number = 0;\n @state()\n private _lastXAxisLabelWidth: number = 0;\n @state()\n private _scrollbarSize: number = 0;\n @state()\n private _activeBar: HTMLElement | null = null;\n @state()\n private _yAxisWidth: number = DEFAULT_Y_AXIS_WIDTH;\n @state()\n private _isDraggingYAxis: boolean = false;\n @state()\n private _focusedBarIndex: number = 0;\n\n @property({ type: Array, attribute: false })\n get data(): DataItem[] {\n return this._data || [];\n }\n\n set data(value: DataItem[]) {\n const oldValue = this._data;\n this._data = value;\n this.requestUpdate(\"data\", oldValue);\n\n const length = this._data.length;\n const categories = new Array<string>(length);\n const values = new Array<number>(length);\n this.data.forEach(({ category, value }, index) => {\n categories[index] = category;\n values[index] = value;\n });\n\n const analysis = analyzeValues(values);\n this._hasPositive = analysis.hasPositive;\n this._hasNegative = analysis.hasNegative;\n this._allPositive = analysis.allPositive;\n this._allNegative = analysis.allNegative;\n\n this._categoryLabels = formatLabels(categories, this.formatters.category);\n this._ticks = generateTicks(analysis.axisMin, analysis.axisMax);\n this._tickLabels = formatLabels(this._ticks, this.formatters.value);\n this._calculateTickWidths();\n }\n\n @property({ type: Object, attribute: false })\n formatters: ValueFormatters = {};\n\n @property({ type: Orientation, reflect: true })\n orientation: Orientation = Orientation.Vertical;\n\n @property({ type: XAxisPosition, attribute: \"x-axis-position\" })\n xAxisPosition: XAxisPosition = XAxisPosition.Bottom;\n\n @property({ type: YAxisPosition, attribute: \"y-axis-position\" })\n yAxisPosition: YAxisPosition = YAxisPosition.Left;\n\n @property({ type: Theme, reflect: true })\n theme: Theme = Theme.Light;\n\n @property({ type: Theme, attribute: \"tooltip-theme\" })\n tooltipTheme: Theme = Theme.Light;\n\n @property({ type: String, attribute: \"category-label\" })\n categoryLabel: string = \"\";\n\n @property({ type: String, attribute: \"value-label\" })\n valueLabel: string = \"\";\n\n @property({ type: ShowLabels, attribute: \"show-labels\" })\n showLabels: ShowLabels = ShowLabels.Always;\n\n private get _wrapperClasses() {\n return {\n rpg: true,\n [this.orientation]: true,\n [`x-axis-${this.xAxisPosition}`]: true,\n [`y-axis-${this.yAxisPosition}`]: true,\n [`labels-${this.showLabels}`]: true,\n };\n }\n private get _wrapperStyles() {\n return {\n [SCROLLBAR_WIDTH_CSS_VAR]: `${this._scrollbarSize}px`,\n [Y_AXIS_WIDTH_CSS_VAR]: `${this._yAxisWidth}px`,\n [X_AXIS_HEIGHT_CSS_VAR]: `${this._xAxisHeight}px`,\n [DATA_LENGTH_CSS_VAR]: this.data.length,\n [X_AXIS_FIRST_LABEL_CSS_VAR]: `${this._firstXAxisLabelWidth}px`,\n [X_AXIS_LAST_LABEL_CSS_VAR]: `${this._lastXAxisLabelWidth}px`,\n };\n }\n private get _barContainerClasses() {\n return {\n \"rpg-bar-container\": true,\n \"start-from-half\": this._hasPositive && this._hasNegative,\n };\n }\n\n @query(\".rpg\")\n private _wrapper!: HTMLElement;\n @query(\".rpg-scrollable\")\n private _scrollableElem!: HTMLElement;\n @query(\".rpg-bar-container\")\n private _barContainer!: HTMLElement;\n @query(\".rpg-x-axis\")\n private _xAxis!: HTMLElement;\n @query(\".rpg-y-axis\")\n private _yAxis!: HTMLElement;\n @query(\"#rpg-get-text-width\")\n private _textSizeDiv!: HTMLElement;\n @queryAll(\".rpg-bar\")\n private _bars!: HTMLElement[];\n\n render() {\n const isVertical = this.orientation === Orientation.Vertical;\n const xAxisLabel = isVertical ? this.categoryLabel : this.valueLabel;\n const yAxisLabel = isVertical ? this.valueLabel : this.categoryLabel;\n let xAxisLabels;\n let yAxisLabels;\n if (isVertical) {\n xAxisLabels = this._categoryLabels;\n yAxisLabels = this._tickLabels;\n } else {\n xAxisLabels = this._tickLabels;\n yAxisLabels = this._categoryLabels;\n }\n\n const xAxisLabelTemplates = xAxisLabels.map(\n (label) =>\n html`<div class=\"rpg-axis-label\" title=${label}>${label}</div>`,\n );\n const xAxisTemplate = html`\n <div class=\"rpg-x-axis\">\n ${xAxisLabel\n ? html`<div class=\"rpg-axis-label rpg-axis-title\">\n <div class=\"rpg-axis-title-content\">${xAxisLabel}</div>\n </div>`\n : nothing}\n <div class=\"rpg-x-axis-labels\">${xAxisLabelTemplates}</div>\n </div>\n `;\n\n const yAxisLabelTemplates = yAxisLabels.map(\n (label) =>\n html`<div class=\"rpg-axis-label\" title=${label}>${label}</div>`,\n );\n\n // tabindex matches flex order - visual and focus order are synchronized\n const yAxisTemplate = html`\n <div class=\"rpg-y-axis\">\n <div class=\"rpg-y-axis-labels\">${yAxisLabelTemplates}</div>\n <div\n class=\"rpg-y-axis-line-container\"\n role=\"slider\"\n tabindex=${this.yAxisPosition === YAxisPosition.Left ? \"1\" : \"0\"}\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n aria-valuenow=${this._yAxisWidthPercentage}\n aria-valuetext=${this._yAxisWidthDescription}\n aria-label=${`Y-axis positioned ${this.yAxisPosition}`}\n @dragstart=${noop}\n @pointerdown=${this.onYAxisPointerDown}\n @keydown=${this.onYAxisKeyDown}\n >\n ${yAxisLabel\n ? html`<div class=\"rpg-axis-label rpg-axis-title\">\n <div class=\"rpg-axis-title-content\">${yAxisLabel}</div>\n </div>`\n : nothing}\n <div class=\"rpg-y-axis-line\"></div>\n </div>\n </div>\n `;\n\n const gridlineTemplates = this._ticks\n .slice(1)\n .map(() => html`<div class=\"rpg-gridline\"></div>`);\n\n const barTemplates = this.data.map(({ value }, index) => {\n const isFocused = index === this._focusedBarIndex;\n const category = this._categoryLabels[index];\n const axisValue = this._tickLabels[index];\n const barValue = formatLabel(value, this.formatters.data);\n const tooltipValue = formatLabel(\n value,\n this.formatters.tooltip || this.formatters.value,\n );\n\n const isPositive =\n this._allPositive || !this._allNegative ? value >= 0 : value > 0;\n const barSize = getSizeInPercentages(\n value,\n this._ticks[0],\n this._ticks.at(-1),\n );\n\n return html`<li\n class=\"rpg-bar ${isPositive ? \"positive\" : \"negative\"}\"\n tabindex=${isFocused ? 0 : -1}\n aria-current=${isFocused ? \"true\" : \"false\"}\n aria-label=\"${category}: ${axisValue}\"\n data-category=${category}\n data-value=${tooltipValue}\n >\n <div\n class=\"rpg-bar-content\"\n style=\"--rpg-bar-size: ${Math.abs(barSize)}%;\"\n >\n <div class=\"rpg-bar-label\">${barValue}</div>\n <div class=\"rpg-small-bar-label\">${barValue}</div>\n </div>\n </li>`;\n });\n\n return html`\n <div\n class=${classMap(this._wrapperClasses)}\n style=${styleMap(this._wrapperStyles)}\n role=\"figure\"\n >\n <div class=\"rpg-scrollable\">\n <div class=\"rpg-scrollable-content\">\n ${isVertical ? xAxisTemplate : yAxisTemplate}\n <div class=\"rpg-content-container\">\n <div class=\"rpg-gridlines\">${gridlineTemplates}</div>\n <ul\n class=${classMap(this._barContainerClasses)}\n @mouseenter=${this.onBarEnter}\n @mouseleave=${this.onBarContainerMouseLeave}\n @focus=${this.onBarContainerFocus}\n @blur=${this.onBarContainerBlur}\n @keydown=${this.onBarContainerKeyDown}\n >\n ${this.data.length\n ? barTemplates\n : html`<div class=\"rpg-empty-state\">No data</div>`}\n </ul>\n </div>\n </div>\n </div>\n ${isVertical ? yAxisTemplate : xAxisTemplate}\n </div>\n <tool-tip\n .element=${this._isDraggingYAxis ? null : this._activeBar}\n .container=${this._scrollableElem}\n orientation=${this.orientation}\n theme=${this.tooltipTheme}\n ></tool-tip>\n <div aria-live=\"polite\">${this._yAxisWidthDescription}</div>\n <div id=\"rpg-get-text-width\" class=\"rpg-axis-label\"></div>\n `;\n }\n\n protected firstUpdated(_changedProperties: PropertyValues): void {\n super.firstUpdated(_changedProperties);\n\n this._calculateYAxisWidths();\n this.addObservers();\n }\n\n updated(changedProperties: Map<string, never>) {\n if (this._xAxis) {\n this._xAxisHeight = (this._xAxis.getBoundingClientRect().height || 1) - 1;\n }\n\n if (changedProperties.has(\"orientation\") || changedProperties.has(\"data\")) {\n this._calculateYAxisWidths();\n }\n }\n\n private _calculateYAxisWidths(): void {\n const isVertical = this.orientation === Orientation.Vertical;\n [this._yAxisMinWidth, this._yAxisWidth, this._yAxisMaxWidth] =\n calculateYAxisWidths(\n this._textSizeDiv,\n this._wrapper,\n this._yAxis,\n isVertical ? this._tickLabels : this._categoryLabels,\n );\n }\n\n private _calculateTickWidths(): void {\n this._firstXAxisLabelWidth = getTextWidth(\n this._textSizeDiv,\n this._tickLabels[0].toString(),\n );\n this._lastXAxisLabelWidth = getTextWidth(\n this._textSizeDiv,\n this._tickLabels.at(-1)?.toString(),\n );\n }\n\n private addObservers() {\n const options = {\n root: this._scrollableElem,\n threshold: 1,\n };\n\n const callback = () => {\n this._scrollbarSize = getScrollbarSize(\n this.orientation,\n this._scrollableElem,\n );\n };\n this._vObserver = new IntersectionObserver(callback, {\n ...options,\n rootMargin: \"0px -16px\",\n });\n this._hObserver = new IntersectionObserver(callback, {\n ...options,\n rootMargin: \"-16px 0px\",\n });\n this._vObserver.observe(this._barContainer);\n this._hObserver.observe(this._barContainer);\n }\n\n @eventOptions({ capture: true })\n private onBarEnter(event: MouseEvent) {\n const target = event.target as HTMLElement;\n if (target.classList.contains(\"rpg-bar\")) {\n this._activeBar = target;\n }\n }\n\n @eventOptions({ capture: true })\n private onBarContainerMouseLeave(event: MouseEvent) {\n if (event.target === event.currentTarget) {\n this._activeBar = null;\n }\n }\n\n @eventOptions({ capture: true })\n private onBarContainerFocus(event: FocusEvent) {\n this._activeBar = event.target as HTMLElement;\n }\n\n @eventOptions({ capture: true })\n private onBarContainerBlur(event: FocusEvent) {\n const nextFocused = event.relatedTarget as HTMLElement;\n if (\n !nextFocused ||\n (nextFocused && !this._barContainer.contains(nextFocused))\n ) {\n this._activeBar = null;\n this._focusedBarIndex = 0;\n }\n }\n\n @eventOptions({ capture: true })\n private onBarContainerKeyDown(event: KeyboardEvent) {\n const isVertical = this.orientation === Orientation.Vertical;\n const nextKey = isVertical ? \"ArrowRight\" : \"ArrowDown\";\n const prevKey = isVertical ? \"ArrowLeft\" : \"ArrowUp\";\n const key = event.key;\n\n if (key === nextKey) {\n event.preventDefault();\n this._focusedBarIndex = Math.min(\n this._focusedBarIndex + 1,\n this.data.length - 1,\n );\n this._bars[this._focusedBarIndex].focus();\n } else if (key === prevKey) {\n event.preventDefault();\n this._focusedBarIndex = Math.max(this._focusedBarIndex - 1, 0);\n this._bars[this._focusedBarIndex].focus();\n } else if (key === \"Home\") {\n event.preventDefault();\n this._focusedBarIndex = 0;\n this._bars[this._focusedBarIndex].focus();\n } else if (key === \"End\") {\n event.preventDefault();\n this._focusedBarIndex = this.data.length - 1;\n this._bars[this._focusedBarIndex].focus();\n }\n }\n\n private onYAxisPointerDown(pointerDownEvent: PointerEvent) {\n pointerDownEvent.preventDefault();\n this._isDraggingYAxis = true;\n\n let newWidth = this._yAxisWidth;\n\n const handlePointerMove = (pointerMoveEvent: PointerEvent) => {\n const parent = this._wrapper;\n\n const moveClientX = pointerMoveEvent.clientX;\n const downClientX = pointerDownEvent.clientX;\n\n newWidth =\n this._yAxisWidth +\n (this.yAxisPosition === YAxisPosition.Left\n ? moveClientX - downClientX\n : downClientX - moveClientX);\n let allowedMaxWidth = this._yAxisMaxWidth;\n\n // the pointer is out of slider => lock the thumb within the boundaries\n if (newWidth < this._yAxisMinWidth) {\n newWidth = this._yAxisMinWidth;\n }\n\n if (this._yAxisMaxWidth > parent.offsetWidth - MAX_Y_AXIS_WIDTH) {\n allowedMaxWidth = parent.offsetWidth - MAX_Y_AXIS_WIDTH;\n }\n if (newWidth > allowedMaxWidth) {\n newWidth = allowedMaxWidth;\n }\n this._wrapper.style.setProperty(Y_AXIS_WIDTH_CSS_VAR, `${newWidth}px`);\n };\n\n const handlePointerUp = () => {\n this._yAxisWidth = newWidth;\n this._isDraggingYAxis = false;\n if (this._oldCursor) {\n document.body.style.cursor = this._oldCursor;\n } else {\n document.body.style.removeProperty(\"cursor\");\n }\n window.removeEventListener(\"pointermove\", handlePointerMove);\n window.removeEventListener(\"pointerup\", handlePointerUp);\n };\n\n this._oldCursor = document.body.style.cursor;\n document.body.style.cursor = \"col-resize\";\n window.addEventListener(\"pointermove\", handlePointerMove);\n window.addEventListener(\"pointerup\", handlePointerUp);\n }\n\n private onYAxisKeyDown(event: KeyboardEvent): void {\n const percentage = parseInt(this._yAxisWidthPercentage ?? \"0\", 10);\n const key = event.key;\n const isLeftAxis = this.yAxisPosition === YAxisPosition.Left;\n const leftKey = isLeftAxis ? \"ArrowLeft\" : \"ArrowRight\";\n const rightKey = isLeftAxis ? \"ArrowRight\" : \"ArrowLeft\";\n const commonArgs = {\n currentPercentage: percentage,\n minWidth: this._yAxisMinWidth,\n maxWidth: this._yAxisMaxWidth,\n };\n\n if (key === leftKey) {\n event.preventDefault();\n this._yAxisWidth =\n getUpdatedYAxisWidth({\n ...commonArgs,\n widthPercentage: Math.max(percentage - 5, 0),\n }) ?? this._yAxisWidth;\n } else if (key === rightKey) {\n event.preventDefault();\n this._yAxisWidth =\n getUpdatedYAxisWidth({\n ...commonArgs,\n widthPercentage: Math.min(percentage + 5, 100),\n }) ?? this._yAxisWidth;\n } else if (key === \"Home\") {\n event.preventDefault();\n this._yAxisWidth =\n getUpdatedYAxisWidth({\n ...commonArgs,\n widthPercentage: 0,\n }) ?? this._yAxisWidth;\n } else if (key === \"End\") {\n event.preventDefault();\n this._yAxisWidth =\n getUpdatedYAxisWidth({\n ...commonArgs,\n widthPercentage: 100,\n }) ?? this._yAxisWidth;\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this._vObserver?.disconnect();\n this._hObserver?.disconnect();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"rapido-bar\": Rapidobar;\n }\n}\n"],"names":["Rapidobar","LitElement","MIN_Y_AXIS_WIDTH","MAX_Y_AXIS_WIDTH","DEFAULT_Y_AXIS_WIDTH","Orientation","XAxisPosition","YAxisPosition","Theme","ShowLabels","css","unsafeCSS","styles","maxYAxisWidth","value","oldValue","length","categories","values","category","index","analysis","analyzeValues","formatLabels","generateTicks","SCROLLBAR_WIDTH_CSS_VAR","Y_AXIS_WIDTH_CSS_VAR","X_AXIS_HEIGHT_CSS_VAR","DATA_LENGTH_CSS_VAR","X_AXIS_FIRST_LABEL_CSS_VAR","X_AXIS_LAST_LABEL_CSS_VAR","isVertical","xAxisLabel","yAxisLabel","xAxisLabels","yAxisLabels","xAxisLabelTemplates","label","html","xAxisTemplate","nothing","yAxisLabelTemplates","yAxisTemplate","noop","gridlineTemplates","barTemplates","isFocused","axisValue","barValue","formatLabel","tooltipValue","isPositive","barSize","getSizeInPercentages","classMap","styleMap","_changedProperties","changedProperties","calculateYAxisWidths","getTextWidth","options","callback","getScrollbarSize","event","target","nextFocused","nextKey","prevKey","key","pointerDownEvent","newWidth","handlePointerMove","pointerMoveEvent","parent","moveClientX","downClientX","allowedMaxWidth","handlePointerUp","percentage","isLeftAxis","leftKey","rightKey","commonArgs","getUpdatedYAxisWidth","Tooltip","__decorateClass","state","property","query","queryAll","eventOptions","customElement"],"mappings":";;;;;;;;;;;;;;;AAoDO,IAAMA,IAAN,cAAwBC,EAAW;AAAA,EAAnC,cAAA;AAAA,UAAA,GAAA,SAAA,GAaL,KAAQ,QAAoB,CAAA,GAC5B,KAAQ,kBAAuC,CAAA,GAC/C,KAAQ,SAAmB,CAAA,GAC3B,KAAQ,cAAmC,CAAA,GAC3C,KAAQ,eAAwB,IAChC,KAAQ,eAAwB,IAChC,KAAQ,eAAwB,IAChC,KAAQ,eAAwB,IAChC,KAAQ,iBAAyBC,GACjC,KAAQ,iBAAyBC,GAgBjC,KAAQ,eAAuB,GAE/B,KAAQ,wBAAgC,GAExC,KAAQ,uBAA+B,GAEvC,KAAQ,iBAAyB,GAEjC,KAAQ,aAAiC,MAEzC,KAAQ,cAAsBC,GAE9B,KAAQ,mB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A,EADPI,EAAS,UAAU;AAAA,GArJTzF,EAsJH,WAAA,SAAA,CAAA;AA8MAqF,EAAA;AAAA,EADPK,EAAa,EAAE,SAAS,GAAA,CAAM;AAAA,GAnWpB1F,EAoWH,WAAA,cAAA,CAAA;AAQAqF,EAAA;AAAA,EADPK,EAAa,EAAE,SAAS,GAAA,CAAM;AAAA,GA3WpB1F,EA4WH,WAAA,4BAAA,CAAA;AAOAqF,EAAA;AAAA,EADPK,EAAa,EAAE,SAAS,GAAA,CAAM;AAAA,GAlXpB1F,EAmXH,WAAA,uBAAA,CAAA;AAKAqF,EAAA;AAAA,EADPK,EAAa,EAAE,SAAS,GAAA,CAAM;AAAA,GAvXpB1F,EAwXH,WAAA,sBAAA,CAAA;AAYAqF,EAAA;AAAA,EADPK,EAAa,EAAE,SAAS,GAAA,CAAM;AAAA,GAnYpB1F,EAoYH,WAAA,yBAAA,CAAA;AApYGA,IAANqF,EAAA;AAAA,EADNM,EAAc,YAAY;AAAA,GACd3F,CAAA;"}
|
package/dist/utils/dom.js
CHANGED
|
@@ -1,40 +1,38 @@
|
|
|
1
|
-
import { MIN_Y_AXIS_WIDTH as
|
|
2
|
-
import { Orientation as
|
|
3
|
-
function
|
|
1
|
+
import { MIN_Y_AXIS_WIDTH as l, MAX_Y_AXIS_WIDTH as c, DEFAULT_Y_AXIS_WIDTH as d, MAX_CONTENT_WIDTH as s, Y_AXIS_WIDTH_CSS_VAR as _, Y_AXIS_LINE_WIDTH as g } from "../shared/constants.js";
|
|
2
|
+
import { Orientation as a } from "../shared/enums.js";
|
|
3
|
+
function I(e, t = "") {
|
|
4
4
|
if (!t || !e)
|
|
5
5
|
return 0;
|
|
6
|
-
const
|
|
7
|
-
e.appendChild(
|
|
6
|
+
const i = document.createTextNode(t);
|
|
7
|
+
e.appendChild(i);
|
|
8
8
|
const o = Math.ceil(e.getBoundingClientRect().width);
|
|
9
9
|
return e.replaceChildren(), o;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
return e ===
|
|
11
|
+
function A(e, t) {
|
|
12
|
+
let i = 0;
|
|
13
|
+
return e === a.Vertical && (i = t.offsetHeight - t.clientHeight), e === a.Horizontal && (i = t.offsetWidth - t.clientWidth), i;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
["min",
|
|
15
|
+
function H(e, t, i, o = []) {
|
|
16
|
+
const h = /* @__PURE__ */ new Map([
|
|
17
|
+
["min", l],
|
|
18
18
|
["width", d],
|
|
19
|
-
["max",
|
|
19
|
+
["max", c]
|
|
20
20
|
]);
|
|
21
|
-
if (o.length && e && t &&
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
if (o.length && e && t && i) {
|
|
22
|
+
i.style.removeProperty("width");
|
|
23
|
+
let r = "";
|
|
24
|
+
o.forEach((W) => {
|
|
25
|
+
const f = W.toString();
|
|
26
|
+
f.length > r.length && (r = f);
|
|
26
27
|
});
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
a[0].toString()
|
|
30
|
-
) + I + 6;
|
|
31
|
-
r.set("min", Math.min(i, c)), r.set("max", Math.max(i, f)), i > d && (i = d), i > t.offsetWidth - l && (i = t.offsetWidth - l), r.set("width", i), t.style.setProperty(_, `${i}px`), n.style.setProperty("width", `var(${_})`);
|
|
28
|
+
let n = I(e, r) + g + 6;
|
|
29
|
+
h.set("min", Math.min(n, l)), h.set("max", Math.max(n, c)), n > d && (n = d), n > t.offsetWidth - s && (n = t.offsetWidth - s), h.set("width", n), t.style.setProperty(_, `${n}px`), i.style.setProperty("width", `var(${_})`);
|
|
32
30
|
}
|
|
33
|
-
return Array.from(
|
|
31
|
+
return Array.from(h.values());
|
|
34
32
|
}
|
|
35
33
|
export {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
H as calculateYAxisWidths,
|
|
35
|
+
A as getScrollbarSize,
|
|
36
|
+
I as getTextWidth
|
|
39
37
|
};
|
|
40
38
|
//# sourceMappingURL=dom.js.map
|
package/dist/utils/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sources":["../../lib/utils/dom.ts"],"sourcesContent":["import {\n DEFAULT_Y_AXIS_WIDTH,\n MAX_CONTENT_WIDTH,\n MAX_Y_AXIS_WIDTH,\n MIN_Y_AXIS_WIDTH,\n Orientation,\n Y_AXIS_LINE_WIDTH,\n Y_AXIS_WIDTH_CSS_VAR,\n} from \"../shared\";\n\n/**\n * Measures the rendered width of a given text string in a specific font.\n * @param {HTMLElement} textSizeDiv - Existing element used to measure text size.\n * @param {string} text - The text to measure.\n * @returns {number} The width of the text in pixels.\n */\nexport function getTextWidth(\n textSizeDiv: HTMLElement,\n text: string = \"\",\n): number {\n if (!text || !textSizeDiv) {\n return 0;\n }\n\n const content = document.createTextNode(text);\n textSizeDiv.appendChild(content);\n const width = Math.ceil(textSizeDiv.getBoundingClientRect().width);\n textSizeDiv.replaceChildren();\n\n return width;\n}\n\n/**\n * Calculates the size of the browser's scrollbar.\n * Useful for layout adjustments when dragging y-axis.\n * @param {Orientation} orientation - Chart orientation.\n * @param {HTMLElement} scrollableElement - Chart element that can be scrolled.\n * @returns {number} The scrollbar size in pixels.\n */\nexport function getScrollbarSize(\n orientation: Orientation,\n scrollableElement: HTMLElement,\n): number {\n let width = 0;\n if (orientation === Orientation.Vertical) {\n width = scrollableElement.offsetHeight - scrollableElement.clientHeight;\n }\n if (orientation === Orientation.Horizontal) {\n width = scrollableElement.offsetWidth - scrollableElement.clientWidth;\n }\n return width;\n}\n\n/**\n * Calculates the width of the y-axis based on label content,\n * label formatting, tick labels, and any additional spacing.\n * @param {HTMLElement} textSizeDiv - Existing element used to measure text size.\n * @param {HTMLElement} wrapper - Chart wrapper element.\n * @param {HTMLElement} yAxis - Y-axis element.\n * @param {(string | number)[]} formattedValues - Formatted ticks or labels (depending on the orientation).\n * @returns {number} Y-axis width in pixels.\n */\nexport function calculateYAxisWidths<T extends string | number>(\n textSizeDiv: HTMLElement,\n wrapper: HTMLElement,\n yAxis: HTMLElement,\n formattedValues: T[] = [],\n): number[] {\n const result = new Map<string, number>([\n [\"min\", MIN_Y_AXIS_WIDTH],\n [\"width\", DEFAULT_Y_AXIS_WIDTH],\n [\"max\", MAX_Y_AXIS_WIDTH],\n ]);\n\n if (formattedValues.length && !!textSizeDiv && !!wrapper && !!yAxis) {\n // reset width when values change so that the new one is calculated correctly\n yAxis.style.removeProperty(\"width\");\n\n
|
|
1
|
+
{"version":3,"file":"dom.js","sources":["../../lib/utils/dom.ts"],"sourcesContent":["import {\n DEFAULT_Y_AXIS_WIDTH,\n MAX_CONTENT_WIDTH,\n MAX_Y_AXIS_WIDTH,\n MIN_Y_AXIS_WIDTH,\n Orientation,\n Y_AXIS_LINE_WIDTH,\n Y_AXIS_WIDTH_CSS_VAR,\n} from \"../shared\";\n\n/**\n * Measures the rendered width of a given text string in a specific font.\n * @param {HTMLElement} textSizeDiv - Existing element used to measure text size.\n * @param {string} text - The text to measure.\n * @returns {number} The width of the text in pixels.\n */\nexport function getTextWidth(\n textSizeDiv: HTMLElement,\n text: string = \"\",\n): number {\n if (!text || !textSizeDiv) {\n return 0;\n }\n\n const content = document.createTextNode(text);\n textSizeDiv.appendChild(content);\n const width = Math.ceil(textSizeDiv.getBoundingClientRect().width);\n textSizeDiv.replaceChildren();\n\n return width;\n}\n\n/**\n * Calculates the size of the browser's scrollbar.\n * Useful for layout adjustments when dragging y-axis.\n * @param {Orientation} orientation - Chart orientation.\n * @param {HTMLElement} scrollableElement - Chart element that can be scrolled.\n * @returns {number} The scrollbar size in pixels.\n */\nexport function getScrollbarSize(\n orientation: Orientation,\n scrollableElement: HTMLElement,\n): number {\n let width = 0;\n if (orientation === Orientation.Vertical) {\n width = scrollableElement.offsetHeight - scrollableElement.clientHeight;\n }\n if (orientation === Orientation.Horizontal) {\n width = scrollableElement.offsetWidth - scrollableElement.clientWidth;\n }\n return width;\n}\n\n/**\n * Calculates the width of the y-axis based on label content,\n * label formatting, tick labels, and any additional spacing.\n * @param {HTMLElement} textSizeDiv - Existing element used to measure text size.\n * @param {HTMLElement} wrapper - Chart wrapper element.\n * @param {HTMLElement} yAxis - Y-axis element.\n * @param {(string | number)[]} formattedValues - Formatted ticks or labels (depending on the orientation).\n * @returns {number} Y-axis width in pixels.\n */\nexport function calculateYAxisWidths<T extends string | number>(\n textSizeDiv: HTMLElement,\n wrapper: HTMLElement,\n yAxis: HTMLElement,\n formattedValues: T[] = [],\n): number[] {\n const result = new Map<string, number>([\n [\"min\", MIN_Y_AXIS_WIDTH],\n [\"width\", DEFAULT_Y_AXIS_WIDTH],\n [\"max\", MAX_Y_AXIS_WIDTH],\n ]);\n\n if (formattedValues.length && !!textSizeDiv && !!wrapper && !!yAxis) {\n // reset width when values change so that the new one is calculated correctly\n yAxis.style.removeProperty(\"width\");\n\n let longestLabel = \"\";\n formattedValues.forEach((value) => {\n const label = value.toString();\n if (label.length > longestLabel.length) {\n longestLabel = label;\n }\n });\n const longestLabelWidth = getTextWidth(textSizeDiv, longestLabel);\n // margin 8px + 2px to avoid ellipsis = 6\n let newWidth = longestLabelWidth + Y_AXIS_LINE_WIDTH + 6;\n result.set(\"min\", Math.min(newWidth, MIN_Y_AXIS_WIDTH));\n result.set(\"max\", Math.max(newWidth, MAX_Y_AXIS_WIDTH));\n\n if (newWidth > DEFAULT_Y_AXIS_WIDTH) {\n newWidth = DEFAULT_Y_AXIS_WIDTH;\n }\n if (newWidth > wrapper.offsetWidth - MAX_CONTENT_WIDTH) {\n newWidth = wrapper.offsetWidth - MAX_CONTENT_WIDTH;\n }\n\n result.set(\"width\", newWidth);\n wrapper.style.setProperty(Y_AXIS_WIDTH_CSS_VAR, `${newWidth}px`);\n yAxis.style.setProperty(\"width\", `var(${Y_AXIS_WIDTH_CSS_VAR})`);\n }\n\n return Array.from(result.values());\n}\n"],"names":["getTextWidth","textSizeDiv","text","content","width","getScrollbarSize","orientation","scrollableElement","Orientation","calculateYAxisWidths","wrapper","yAxis","formattedValues","result","MIN_Y_AXIS_WIDTH","DEFAULT_Y_AXIS_WIDTH","MAX_Y_AXIS_WIDTH","longestLabel","value","label","newWidth","Y_AXIS_LINE_WIDTH","MAX_CONTENT_WIDTH","Y_AXIS_WIDTH_CSS_VAR"],"mappings":";;AAgBO,SAASA,EACdC,GACAC,IAAe,IACP;AACR,MAAI,CAACA,KAAQ,CAACD;AACZ,WAAO;AAGT,QAAME,IAAU,SAAS,eAAeD,CAAI;AAC5C,EAAAD,EAAY,YAAYE,CAAO;AAC/B,QAAMC,IAAQ,KAAK,KAAKH,EAAY,sBAAA,EAAwB,KAAK;AACjE,SAAAA,EAAY,gBAAA,GAELG;AACT;AASO,SAASC,EACdC,GACAC,GACQ;AACR,MAAIH,IAAQ;AACZ,SAAIE,MAAgBE,EAAY,aAC9BJ,IAAQG,EAAkB,eAAeA,EAAkB,eAEzDD,MAAgBE,EAAY,eAC9BJ,IAAQG,EAAkB,cAAcA,EAAkB,cAErDH;AACT;AAWO,SAASK,EACdR,GACAS,GACAC,GACAC,IAAuB,CAAA,GACb;AACV,QAAMC,wBAAa,IAAoB;AAAA,IACrC,CAAC,OAAOC,CAAgB;AAAA,IACxB,CAAC,SAASC,CAAoB;AAAA,IAC9B,CAAC,OAAOC,CAAgB;AAAA,EAAA,CACzB;AAED,MAAIJ,EAAgB,UAAYX,KAAiBS,KAAaC,GAAO;AAEnE,IAAAA,EAAM,MAAM,eAAe,OAAO;AAElC,QAAIM,IAAe;AACnB,IAAAL,EAAgB,QAAQ,CAACM,MAAU;AACjC,YAAMC,IAAQD,EAAM,SAAA;AACpB,MAAIC,EAAM,SAASF,EAAa,WAC9BA,IAAeE;AAAA,IAEnB,CAAC;AAGD,QAAIC,IAFsBpB,EAAaC,GAAagB,CAAY,IAE7BI,IAAoB;AACvD,IAAAR,EAAO,IAAI,OAAO,KAAK,IAAIO,GAAUN,CAAgB,CAAC,GACtDD,EAAO,IAAI,OAAO,KAAK,IAAIO,GAAUJ,CAAgB,CAAC,GAElDI,IAAWL,MACbK,IAAWL,IAETK,IAAWV,EAAQ,cAAcY,MACnCF,IAAWV,EAAQ,cAAcY,IAGnCT,EAAO,IAAI,SAASO,CAAQ,GAC5BV,EAAQ,MAAM,YAAYa,GAAsB,GAAGH,CAAQ,IAAI,GAC/DT,EAAM,MAAM,YAAY,SAAS,OAAOY,CAAoB,GAAG;AAAA,EACjE;AAEA,SAAO,MAAM,KAAKV,EAAO,OAAA,CAAQ;AACnC;"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
export declare function noop(): void;
|
|
2
2
|
export declare function echo<T extends string | number>(value: T): T;
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Analyzes an array of values in a single pass to extract min/max,
|
|
5
|
+
* axis bounds, and positivity flags.
|
|
5
6
|
* @param {number[]} values - Array of numeric values to analyze.
|
|
6
|
-
* @returns {[boolean, boolean]} Both true if at least one value is positive and one is negative.
|
|
7
7
|
*/
|
|
8
|
-
export declare function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
export declare function analyzeValues(values?: number[]): {
|
|
9
|
+
min: number;
|
|
10
|
+
max: number;
|
|
11
|
+
axisMin: number;
|
|
12
|
+
axisMax: number;
|
|
13
|
+
hasPositive: boolean;
|
|
14
|
+
hasNegative: boolean;
|
|
15
|
+
allPositive: boolean;
|
|
16
|
+
allNegative: boolean;
|
|
17
|
+
};
|
|
15
18
|
/**
|
|
16
19
|
* Use label formatter if it exists, or return the original label.
|
|
17
20
|
* @param {string | number} label - Axis or bar label
|
|
@@ -25,12 +28,6 @@ export declare function formatLabel<T extends string | number>(label: T, formatt
|
|
|
25
28
|
* @returns {(string | number)[]} - Formatted labels.
|
|
26
29
|
*/
|
|
27
30
|
export declare function formatLabels<T extends string | number>(labels: T[], formatter?: (value: T) => string | number): (string | number)[];
|
|
28
|
-
/**
|
|
29
|
-
* Computes the minimum and maximum values from the dataset.
|
|
30
|
-
* @param {number[]} values - Array of numeric values.
|
|
31
|
-
* @returns {[number, number]} Min and max values.
|
|
32
|
-
*/
|
|
33
|
-
export declare function getMinAndMax(values?: number[]): [number, number];
|
|
34
31
|
/**
|
|
35
32
|
* Generates a list of tick values for the value axis based on
|
|
36
33
|
* all the values and desired tick count.
|
package/dist/utils/rapidobar.js
CHANGED
|
@@ -1,74 +1,83 @@
|
|
|
1
|
-
function
|
|
1
|
+
function v() {
|
|
2
2
|
}
|
|
3
|
-
function
|
|
3
|
+
function d(t) {
|
|
4
4
|
return t;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
const o = t.some((e) => e > 0), n = t.some((e) => e < 0);
|
|
8
|
-
return [o, n];
|
|
9
|
-
}
|
|
10
|
-
function w(t = []) {
|
|
6
|
+
function P(t = []) {
|
|
11
7
|
if (!t.length)
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
return {
|
|
9
|
+
min: 0,
|
|
10
|
+
max: 0,
|
|
11
|
+
axisMin: 0,
|
|
12
|
+
axisMax: 0,
|
|
13
|
+
hasPositive: !1,
|
|
14
|
+
hasNegative: !1,
|
|
15
|
+
allPositive: !1,
|
|
16
|
+
allNegative: !1
|
|
17
|
+
};
|
|
18
|
+
let o = t[0], a = t[0], s = !1, e = !1, n = !0, i = !0;
|
|
19
|
+
for (const r of t)
|
|
20
|
+
r < o && (o = r), r > a && (a = r), r > 0 && (s = !0, i = !1), r < 0 && (e = !0, n = !1);
|
|
21
|
+
let l = o, f = a;
|
|
22
|
+
if (s && e) {
|
|
23
|
+
const r = Math.max(Math.abs(o), Math.abs(a));
|
|
24
|
+
l = -r, f = r;
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
min: o,
|
|
28
|
+
max: a,
|
|
29
|
+
axisMin: l,
|
|
30
|
+
axisMax: f,
|
|
31
|
+
hasPositive: s,
|
|
32
|
+
hasNegative: e,
|
|
33
|
+
allPositive: n,
|
|
34
|
+
allNegative: i
|
|
35
|
+
};
|
|
15
36
|
}
|
|
16
|
-
function
|
|
37
|
+
function m(t, o = d) {
|
|
17
38
|
return o(t);
|
|
18
39
|
}
|
|
19
|
-
function
|
|
20
|
-
return t.map((
|
|
21
|
-
}
|
|
22
|
-
function N(t = []) {
|
|
23
|
-
if (!t.length)
|
|
24
|
-
return [0, 0];
|
|
25
|
-
const o = Math.min(...t), n = Math.max(...t), [e, r] = b(t);
|
|
26
|
-
if (e && r) {
|
|
27
|
-
const a = Math.max(Math.abs(o), Math.abs(n));
|
|
28
|
-
return [-Math.abs(a), a];
|
|
29
|
-
}
|
|
30
|
-
return [o, n];
|
|
40
|
+
function w(t, o = d) {
|
|
41
|
+
return t.map((a) => m(a, o));
|
|
31
42
|
}
|
|
32
|
-
function
|
|
33
|
-
if (
|
|
43
|
+
function N(t = 0, o = 100, a = 5, s = 0.5) {
|
|
44
|
+
if (a <= 1)
|
|
34
45
|
return [];
|
|
35
|
-
let
|
|
46
|
+
let e = t, n = o;
|
|
36
47
|
if (t === o) {
|
|
37
|
-
let
|
|
38
|
-
t !== 0 && (
|
|
48
|
+
let h = 1;
|
|
49
|
+
t !== 0 && (h = Math.pow(10, Math.floor(Math.log10(Math.abs(t)))) * 0.1), e = t - h, n = t + h;
|
|
39
50
|
}
|
|
40
|
-
let
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
let
|
|
44
|
-
return
|
|
45
|
-
const
|
|
46
|
-
return Math.round((
|
|
51
|
+
let i = (n - e) / (a - 1);
|
|
52
|
+
i === 0 && (i = 1);
|
|
53
|
+
const l = Math.floor(Math.log10(i)), f = Math.pow(10, l), r = i / f, p = Math.ceil(r / s) * s, c = parseFloat((p * f).toPrecision(12)), M = c.toString().indexOf("."), b = M >= 0 ? c.toString().length - M - 1 : 0;
|
|
54
|
+
let u;
|
|
55
|
+
return e < 0 && n > 0 ? u = -Math.floor(a / 2) * c : n <= 0 ? u = n - c * (a - 1) : u = e, Array.from({ length: a }, (h, g) => {
|
|
56
|
+
const x = Math.pow(10, b);
|
|
57
|
+
return Math.round((u + g * c) * x) / x;
|
|
47
58
|
});
|
|
48
59
|
}
|
|
49
|
-
function
|
|
50
|
-
const
|
|
51
|
-
return
|
|
60
|
+
function S(t = 0, o = 0, a = 100) {
|
|
61
|
+
const s = +o, e = +a, n = +t;
|
|
62
|
+
return s === 0 && e === 0 ? 0 : s >= 0 && e >= 0 ? (n - s) / (e - s) * 100 : s <= 0 && e <= 0 ? (e - n) / (e - s) * 100 : n >= 0 ? n / e * 100 : Math.abs(n) / Math.abs(s) * 100;
|
|
52
63
|
}
|
|
53
|
-
function
|
|
64
|
+
function z({
|
|
54
65
|
currentPercentage: t = 0,
|
|
55
66
|
minWidth: o = 0,
|
|
56
|
-
maxWidth:
|
|
57
|
-
widthPercentage:
|
|
67
|
+
maxWidth: a = 100,
|
|
68
|
+
widthPercentage: s
|
|
58
69
|
}) {
|
|
59
|
-
const
|
|
60
|
-
return
|
|
70
|
+
const e = +t, n = +o, i = +a, l = +s;
|
|
71
|
+
return e === l ? null : (i - n) * l / 100 + n;
|
|
61
72
|
}
|
|
62
73
|
export {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
m as
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
S as
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
V as getUpdatedYAxisWidth,
|
|
72
|
-
P as noop
|
|
74
|
+
P as analyzeValues,
|
|
75
|
+
d as echo,
|
|
76
|
+
m as formatLabel,
|
|
77
|
+
w as formatLabels,
|
|
78
|
+
N as generateTicks,
|
|
79
|
+
S as getSizeInPercentages,
|
|
80
|
+
z as getUpdatedYAxisWidth,
|
|
81
|
+
v as noop
|
|
73
82
|
};
|
|
74
83
|
//# sourceMappingURL=rapidobar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rapidobar.js","sources":["../../lib/utils/rapidobar.ts"],"sourcesContent":["export function noop() {}\nexport function echo<T extends string | number>(value: T): T {\n return value;\n}\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"rapidobar.js","sources":["../../lib/utils/rapidobar.ts"],"sourcesContent":["export function noop() {}\nexport function echo<T extends string | number>(value: T): T {\n return value;\n}\n\n/**\n * Analyzes an array of values in a single pass to extract min/max,\n * axis bounds, and positivity flags.\n * @param {number[]} values - Array of numeric values to analyze.\n */\nexport function analyzeValues(values: number[] = []) {\n if (!values.length) {\n return {\n min: 0,\n max: 0,\n axisMin: 0,\n axisMax: 0,\n hasPositive: false,\n hasNegative: false,\n allPositive: false,\n allNegative: false,\n };\n }\n\n let min = values[0];\n let max = values[0];\n let hasPositive = false;\n let hasNegative = false;\n let allPositive = true;\n let allNegative = true;\n\n for (const value of values) {\n if (value < min) min = value;\n if (value > max) max = value;\n\n if (value > 0) {\n hasPositive = true;\n allNegative = false;\n }\n if (value < 0) {\n hasNegative = true;\n allPositive = false;\n }\n }\n\n // Symmetric axis bounds for mixed positive/negative values\n let axisMin = min;\n let axisMax = max;\n if (hasPositive && hasNegative) {\n const absMax = Math.max(Math.abs(min), Math.abs(max));\n axisMin = -absMax;\n axisMax = absMax;\n }\n\n return {\n min,\n max,\n axisMin,\n axisMax,\n hasPositive,\n hasNegative,\n allPositive,\n allNegative,\n };\n}\n\n/**\n * Use label formatter if it exists, or return the original label.\n * @param {string | number} label - Axis or bar label\n * @param [formatter=echo] - Axis or bar label formatter\n */\nexport function formatLabel<T extends string | number>(\n label: T,\n formatter: (value: T) => string | number = echo,\n): string | number {\n return formatter(label);\n}\n\n/**\n * Use label formatter if it exists, or return the original labels.\n * @param {string | number} labels - Axis or bar labels.\n * @param [formatter=echo] - Axis or bar label formatter.\n * @returns {(string | number)[]} - Formatted labels.\n */\nexport function formatLabels<T extends string | number>(\n labels: T[],\n formatter: (value: T) => string | number = echo,\n): (string | number)[] {\n return labels.map((label) => formatLabel(label, formatter));\n}\n\n/**\n * Generates a list of tick values for the value axis based on\n * all the values and desired tick count.\n * @param {number} min - Minimum bar value.\n * @param {number} max - Maximum bar value.\n * @param {number} numOfTicks - Number of ticks for the axis.\n * @param {number} granularity - Force the rough tick step to the next available increment.\n * @returns {number[]} An array of tick values evenly distributed across the range.\n */\nexport function generateTicks(\n min: number = 0,\n max: number = 100,\n numOfTicks: number = 5,\n granularity: number = 0.5,\n): number[] {\n if (numOfTicks <= 1) {\n return [];\n }\n\n let start = min;\n let stop = max;\n\n if (min === max) {\n // expand the range equally by 10%\n let offset = 1;\n if (min !== 0) {\n const magnitude = Math.pow(10, Math.floor(Math.log10(Math.abs(min))));\n offset = magnitude * 0.1;\n }\n start = min - offset;\n stop = min + offset;\n }\n\n let step = (stop - start) / (numOfTicks - 1);\n if (step === 0) {\n step = 1;\n }\n const power = Math.floor(Math.log10(step));\n const magnitude = Math.pow(10, power);\n const normalizedStep = step / magnitude;\n const factor = Math.ceil(normalizedStep / granularity) * granularity;\n const increment = parseFloat((factor * magnitude).toPrecision(12));\n\n const decimalIndex = increment.toString().indexOf(\".\");\n const decimals =\n decimalIndex >= 0 ? increment.toString().length - decimalIndex - 1 : 0;\n\n let axisMin;\n if (start < 0 && stop > 0) {\n axisMin = -Math.floor(numOfTicks / 2) * increment;\n } else if (stop <= 0) {\n axisMin = stop - increment * (numOfTicks - 1);\n } else {\n axisMin = start;\n }\n\n return Array.from({ length: numOfTicks }, (_, index) => {\n const factor = Math.pow(10, decimals);\n return Math.round((axisMin + index * increment) * factor) / factor;\n });\n}\n\n/**\n * Converts a given numeric value into a percentage of a reference size.\n * @param {number} value - The value to convert.\n * @param {number} min - Minimum value.\n * @param {number} max - Maximum value.\n * @returns {number} The value expressed as a percentage of the total.\n */\nexport function getSizeInPercentages(\n value: number = 0,\n min: number = 0,\n max: number = 100,\n): number {\n const start = +min;\n const stop = +max;\n const val = +value;\n\n if (start === 0 && stop === 0) {\n return 0;\n }\n\n if (start >= 0 && stop >= 0) {\n return ((val - start) / (stop - start)) * 100;\n }\n\n if (start <= 0 && stop <= 0) {\n return ((stop - val) / (stop - start)) * 100;\n }\n\n if (val >= 0) {\n return (val / stop) * 100;\n } else {\n return (Math.abs(val) / Math.abs(start)) * 100;\n }\n}\n\n/**\n * Returns the new y-axis width based on min, max and current width in percentages.\n * @param {Object} params - Configuration options.\n * @param {number} [params.currentPercentage=0] - Previously applied y-axis width (in %).\n * @param {number} [params.minWidth=0] - Minimum allowed width (in #).\n * @param {number} [params.maxWidth=100] - Maximum allowed width (in #).\n * @param {number} params.widthPercentage - Newly calculated required width (in %).\n * @returns {number | null} Updated y-axis width in pixels or null if current and new are the same.\n */\nexport function getUpdatedYAxisWidth({\n currentPercentage = 0,\n minWidth = 0,\n maxWidth = 100,\n widthPercentage,\n}: {\n currentPercentage?: number;\n minWidth?: number;\n maxWidth?: number;\n widthPercentage: number;\n}): number | null {\n const curr = +currentPercentage;\n const min = +minWidth;\n const max = +maxWidth;\n const width = +widthPercentage;\n\n if (curr === width) {\n return null;\n }\n const maxValue = max - min;\n const absolute = (maxValue * width) / 100;\n return absolute + min;\n}\n"],"names":["noop","echo","value","analyzeValues","values","min","max","hasPositive","hasNegative","allPositive","allNegative","axisMin","axisMax","absMax","formatLabel","label","formatter","formatLabels","labels","generateTicks","numOfTicks","granularity","start","stop","offset","step","power","magnitude","normalizedStep","factor","increment","decimalIndex","decimals","_","index","getSizeInPercentages","val","getUpdatedYAxisWidth","currentPercentage","minWidth","maxWidth","widthPercentage","curr","width"],"mappings":"AAAO,SAASA,IAAO;AAAC;AACjB,SAASC,EAAgCC,GAAa;AAC3D,SAAOA;AACT;AAOO,SAASC,EAAcC,IAAmB,IAAI;AACnD,MAAI,CAACA,EAAO;AACV,WAAO;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,SAAS;AAAA,MACT,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,MACb,aAAa;AAAA,MACb,aAAa;AAAA,IAAA;AAIjB,MAAIC,IAAMD,EAAO,CAAC,GACdE,IAAMF,EAAO,CAA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CAACkC,GACPG,IAAQ,CAACF;AAEf,SAAIC,MAASC,IACJ,QAEQrC,IAAMD,KACMsC,IAAS,MACpBtC;AACpB;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapidograph",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "A micro-library for efficient, customizable HTML chart visualization.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visualization",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"default": "./dist/index.js"
|
|
32
32
|
},
|
|
33
33
|
"./*": {
|
|
34
|
-
"types": "./dist/components
|
|
35
|
-
"default": "./dist/components
|
|
34
|
+
"types": "./dist/components/*/index.d.ts",
|
|
35
|
+
"default": "./dist/components/*/index.js"
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"sideEffects": false,
|