storybook 9.1.0-alpha.2 → 9.1.0-alpha.3
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/bin/index.cjs +50 -50
- package/dist/bin/index.js +50 -50
- package/dist/builder-manager/index.cjs +379 -378
- package/dist/builder-manager/index.d.ts +567 -2
- package/dist/builder-manager/index.js +280 -279
- package/dist/cli/bin/index.cjs +1 -1
- package/dist/cli/bin/index.js +1 -1
- package/dist/common/index.cjs +711 -704
- package/dist/common/index.js +698 -691
- package/dist/components/index.cjs +1899 -1895
- package/dist/components/index.js +1343 -1339
- package/dist/manager/globals-runtime.js +5191 -5144
- package/dist/manager-api/index.cjs +1 -1
- package/dist/manager-api/index.js +1 -1
- package/dist/measure/index.cjs +64 -64
- package/dist/measure/index.js +65 -65
- package/dist/measure/preview.cjs +59 -59
- package/dist/measure/preview.js +53 -53
- package/dist/preview/runtime.js +4913 -4870
- package/dist/telemetry/index.cjs +1477 -1288
- package/dist/telemetry/index.js +1503 -1314
- package/dist/test/index.cjs +4437 -4394
- package/dist/test/index.js +3776 -3733
- package/package.json +1 -1
|
@@ -4403,7 +4403,7 @@ U(wr, {
|
|
|
4403
4403
|
var kt = require("@storybook/global"), on = L(rr(), 1), $ = L(require("semver"), 1);
|
|
4404
4404
|
|
|
4405
4405
|
// src/manager-api/version.ts
|
|
4406
|
-
var tn = "9.1.0-alpha.
|
|
4406
|
+
var tn = "9.1.0-alpha.3";
|
|
4407
4407
|
|
|
4408
4408
|
// src/manager-api/modules/versions.ts
|
|
4409
4409
|
var { VERSIONCHECK: Qs } = kt.global, rn = (0, on.default)(1)(() => {
|
|
@@ -3217,7 +3217,7 @@ import { global as Sr } from "@storybook/global";
|
|
|
3217
3217
|
import $ from "semver";
|
|
3218
3218
|
|
|
3219
3219
|
// src/manager-api/version.ts
|
|
3220
|
-
var No = "9.1.0-alpha.
|
|
3220
|
+
var No = "9.1.0-alpha.3";
|
|
3221
3221
|
|
|
3222
3222
|
// src/manager-api/modules/versions.ts
|
|
3223
3223
|
var { VERSIONCHECK: ca } = Sr, ko = (0, jo.default)(1)(() => {
|
package/dist/measure/index.cjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var v = Object.defineProperty;
|
|
3
3
|
var ut = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var pt = Object.getOwnPropertyNames;
|
|
5
|
+
var dt = Object.prototype.hasOwnProperty;
|
|
6
6
|
var l = (e, t) => v(e, "name", { value: t, configurable: !0 });
|
|
7
7
|
var W = (e, t) => {
|
|
8
8
|
for (var o in t)
|
|
9
9
|
v(e, o, { get: t[o], enumerable: !0 });
|
|
10
|
-
},
|
|
10
|
+
}, ht = (e, t, o, i) => {
|
|
11
11
|
if (t && typeof t == "object" || typeof t == "function")
|
|
12
|
-
for (let n of
|
|
13
|
-
!
|
|
12
|
+
for (let n of pt(t))
|
|
13
|
+
!dt.call(e, n) && n !== o && v(e, n, { get: () => t[n], enumerable: !(i = ut(t, n)) || i.enumerable });
|
|
14
14
|
return e;
|
|
15
15
|
};
|
|
16
|
-
var
|
|
16
|
+
var gt = (e) => ht(v({}, "__esModule", { value: !0 }), e);
|
|
17
17
|
|
|
18
18
|
// src/measure/index.ts
|
|
19
19
|
var Wt = {};
|
|
20
20
|
W(Wt, {
|
|
21
21
|
default: () => Ft
|
|
22
22
|
});
|
|
23
|
-
module.exports =
|
|
23
|
+
module.exports = gt(Wt);
|
|
24
24
|
var nt = require("storybook/preview-api");
|
|
25
25
|
|
|
26
26
|
// src/measure/preview.ts
|
|
@@ -43,13 +43,13 @@ var R = "storybook/measure-addon", Bt = `${R}/tool`, Y = "measureEnabled", zt =
|
|
|
43
43
|
var A = require("storybook/preview-api");
|
|
44
44
|
|
|
45
45
|
// src/measure/box-model/canvas.ts
|
|
46
|
-
var
|
|
46
|
+
var E = require("@storybook/global");
|
|
47
47
|
|
|
48
48
|
// ../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
49
|
-
var
|
|
49
|
+
var bt = process.env.NODE_ENV === "production", D = "Invariant failed";
|
|
50
50
|
function M(e, t) {
|
|
51
51
|
if (!e) {
|
|
52
|
-
if (
|
|
52
|
+
if (bt)
|
|
53
53
|
throw new Error(D);
|
|
54
54
|
var o = typeof t == "function" ? t() : t, i = o ? "".concat(D, ": ").concat(o) : D;
|
|
55
55
|
throw new Error(i);
|
|
@@ -59,23 +59,23 @@ l(M, "invariant");
|
|
|
59
59
|
|
|
60
60
|
// src/measure/box-model/canvas.ts
|
|
61
61
|
function B() {
|
|
62
|
-
let e =
|
|
62
|
+
let e = E.global.document.documentElement, t = Math.max(e.scrollHeight, e.offsetHeight);
|
|
63
63
|
return { width: Math.max(e.scrollWidth, e.offsetWidth), height: t };
|
|
64
64
|
}
|
|
65
65
|
l(B, "getDocumentWidthAndHeight");
|
|
66
66
|
function wt() {
|
|
67
|
-
let e =
|
|
67
|
+
let e = E.global.document.createElement("canvas");
|
|
68
68
|
e.id = "storybook-addon-measure";
|
|
69
69
|
let t = e.getContext("2d");
|
|
70
70
|
M(t != null);
|
|
71
71
|
let { width: o, height: i } = B();
|
|
72
72
|
return k(e, t, { width: o, height: i }), e.style.position = "absolute", e.style.left = "0", e.style.top = "0", e.style.zIndex = "214748364\
|
|
73
|
-
7", e.style.pointerEvents = "none",
|
|
73
|
+
7", e.style.pointerEvents = "none", E.global.document.body.appendChild(e), { canvas: e, context: t, width: o, height: i };
|
|
74
74
|
}
|
|
75
75
|
l(wt, "createCanvas");
|
|
76
76
|
function k(e, t, { width: o, height: i }) {
|
|
77
77
|
e.style.width = `${o}px`, e.style.height = `${i}px`;
|
|
78
|
-
let n =
|
|
78
|
+
let n = E.global.window.devicePixelRatio;
|
|
79
79
|
e.width = Math.floor(o * n), e.height = Math.floor(i * n), t.scale(n, n);
|
|
80
80
|
}
|
|
81
81
|
l(k, "setCanvasWidthAndHeight");
|
|
@@ -104,7 +104,7 @@ function O() {
|
|
|
104
104
|
l(O, "destroy");
|
|
105
105
|
|
|
106
106
|
// src/measure/box-model/visualizer.ts
|
|
107
|
-
var
|
|
107
|
+
var g = require("@storybook/global");
|
|
108
108
|
|
|
109
109
|
// src/measure/box-model/labels.ts
|
|
110
110
|
var w = {
|
|
@@ -113,7 +113,7 @@ var w = {
|
|
|
113
113
|
padding: "#93c47d",
|
|
114
114
|
content: "#6fa8dc",
|
|
115
115
|
text: "#232020"
|
|
116
|
-
},
|
|
116
|
+
}, b = 6;
|
|
117
117
|
function I(e, { x: t, y: o, w: i, h: n, r }) {
|
|
118
118
|
t = t - i / 2, o = o - n / 2, i < 2 * r && (r = i / 2), n < 2 * r && (r = n / 2), e.beginPath(), e.moveTo(t + r, o), e.arcTo(t + i, o, t +
|
|
119
119
|
i, o + n, r), e.arcTo(t + i, o + n, t, o + n, r), e.arcTo(t, o + n, t, o, r), e.arcTo(t, o, t + i, o, r), e.closePath();
|
|
@@ -125,20 +125,20 @@ function Lt(e, { padding: t, border: o, width: i, height: n, top: r, left: a })
|
|
|
125
125
|
e === "center" && (c += s / 2, u += f / 2), { x: c, y: u };
|
|
126
126
|
}
|
|
127
127
|
l(Lt, "positionCoordinate");
|
|
128
|
-
function
|
|
129
|
-
let s = /* @__PURE__ */ l((
|
|
130
|
-
return e === "padding" ? s = /* @__PURE__ */ l((
|
|
131
|
-
u +
|
|
128
|
+
function yt(e, t, { margin: o, border: i, padding: n }, r, a) {
|
|
129
|
+
let s = /* @__PURE__ */ l((p) => 0, "shift"), f = 0, c = 0, u = a ? 1 : 0.5, d = a ? r * 2 : 0;
|
|
130
|
+
return e === "padding" ? s = /* @__PURE__ */ l((p) => n[p] * u + d, "shift") : e === "border" ? s = /* @__PURE__ */ l((p) => n[p] + i[p] *
|
|
131
|
+
u + d, "shift") : e === "margin" && (s = /* @__PURE__ */ l((p) => n[p] + i[p] + o[p] * u + d, "shift")), t === "top" ? c = -s("top") : t ===
|
|
132
132
|
"right" ? f = s("right") : t === "bottom" ? c = s("bottom") : t === "left" && (f = -s("left")), { offsetX: f, offsetY: c };
|
|
133
133
|
}
|
|
134
|
-
l(
|
|
135
|
-
function
|
|
134
|
+
l(yt, "offset");
|
|
135
|
+
function Et(e, t) {
|
|
136
136
|
return Math.abs(e.x - t.x) < Math.abs(e.w + t.w) / 2 && Math.abs(e.y - t.y) < Math.abs(e.h + t.h) / 2;
|
|
137
137
|
}
|
|
138
|
-
l(
|
|
138
|
+
l(Et, "collide");
|
|
139
139
|
function St(e, t, o) {
|
|
140
|
-
return e === "top" ? t.y = o.y - o.h -
|
|
141
|
-
"left" && (t.x = o.x - o.w / 2 -
|
|
140
|
+
return e === "top" ? t.y = o.y - o.h - b : e === "right" ? t.x = o.x + o.w / 2 + b + t.w / 2 : e === "bottom" ? t.y = o.y + o.h + b : e ===
|
|
141
|
+
"left" && (t.x = o.x - o.w / 2 - b - t.w / 2), { x: t.x, y: t.y };
|
|
142
142
|
}
|
|
143
143
|
l(St, "overlapAdjustment");
|
|
144
144
|
function _(e, t, { x: o, y: i, w: n, h: r }, a) {
|
|
@@ -149,23 +149,23 @@ function _(e, t, { x: o, y: i, w: n, h: r }, a) {
|
|
|
149
149
|
l(_, "textWithRect");
|
|
150
150
|
function q(e, t) {
|
|
151
151
|
e.font = "600 12px monospace", e.textBaseline = "middle", e.textAlign = "center";
|
|
152
|
-
let o = e.measureText(t), i = o.actualBoundingBoxAscent + o.actualBoundingBoxDescent, n = o.width +
|
|
152
|
+
let o = e.measureText(t), i = o.actualBoundingBoxAscent + o.actualBoundingBoxDescent, n = o.width + b * 2, r = i + b * 2;
|
|
153
153
|
return { w: n, h: r };
|
|
154
154
|
}
|
|
155
155
|
l(q, "configureText");
|
|
156
156
|
function Ct(e, t, { type: o, position: i = "center", text: n }, r, a = !1) {
|
|
157
|
-
let { x: s, y: f } = Lt(i, t), { offsetX: c, offsetY: u } =
|
|
157
|
+
let { x: s, y: f } = Lt(i, t), { offsetX: c, offsetY: u } = yt(o, i, t, b + 1, a);
|
|
158
158
|
s += c, f += u;
|
|
159
|
-
let { w:
|
|
160
|
-
if (r &&
|
|
161
|
-
let C = St(i, { x: s, y: f, w:
|
|
159
|
+
let { w: d, h: p } = q(e, n);
|
|
160
|
+
if (r && Et({ x: s, y: f, w: d, h: p }, r)) {
|
|
161
|
+
let C = St(i, { x: s, y: f, w: d, h: p }, r);
|
|
162
162
|
s = C.x, f = C.y;
|
|
163
163
|
}
|
|
164
|
-
return _(e, o, { x: s, y: f, w:
|
|
164
|
+
return _(e, o, { x: s, y: f, w: d, h: p }, n);
|
|
165
165
|
}
|
|
166
166
|
l(Ct, "drawLabel");
|
|
167
167
|
function vt(e, { w: t, h: o }) {
|
|
168
|
-
let i = t * 0.5 +
|
|
168
|
+
let i = t * 0.5 + b, n = o * 0.5 + b;
|
|
169
169
|
return {
|
|
170
170
|
offsetX: (e.x === "left" ? -1 : 1) * i,
|
|
171
171
|
offsetY: (e.y === "top" ? -1 : 1) * n
|
|
@@ -173,11 +173,11 @@ function vt(e, { w: t, h: o }) {
|
|
|
173
173
|
}
|
|
174
174
|
l(vt, "floatingOffset");
|
|
175
175
|
function Rt(e, t, { type: o, text: i }) {
|
|
176
|
-
let { floatingAlignment: n, extremities: r } = t, a = r[n.x], s = r[n.y], { w: f, h: c } = q(e, i), { offsetX: u, offsetY:
|
|
176
|
+
let { floatingAlignment: n, extremities: r } = t, a = r[n.x], s = r[n.y], { w: f, h: c } = q(e, i), { offsetX: u, offsetY: d } = vt(n, {
|
|
177
177
|
w: f,
|
|
178
178
|
h: c
|
|
179
179
|
});
|
|
180
|
-
return a += u, s +=
|
|
180
|
+
return a += u, s += d, _(e, o, { x: a, y: s, w: f, h: c }, i);
|
|
181
181
|
}
|
|
182
182
|
l(Rt, "drawFloatingLabel");
|
|
183
183
|
function S(e, t, o, i) {
|
|
@@ -202,10 +202,10 @@ var x = {
|
|
|
202
202
|
padding: "#93c47d8c",
|
|
203
203
|
content: "#6fa8dca8"
|
|
204
204
|
}, G = 30;
|
|
205
|
-
function
|
|
205
|
+
function h(e) {
|
|
206
206
|
return parseInt(e.replace("px", ""), 10);
|
|
207
207
|
}
|
|
208
|
-
l(
|
|
208
|
+
l(h, "pxToNumber");
|
|
209
209
|
function L(e) {
|
|
210
210
|
return Number.isInteger(e) ? e : e.toFixed(2);
|
|
211
211
|
}
|
|
@@ -216,10 +216,10 @@ function P(e) {
|
|
|
216
216
|
l(P, "filterZeroValues");
|
|
217
217
|
function Mt(e) {
|
|
218
218
|
let t = {
|
|
219
|
-
top:
|
|
220
|
-
bottom:
|
|
221
|
-
left:
|
|
222
|
-
right:
|
|
219
|
+
top: g.global.window.scrollY,
|
|
220
|
+
bottom: g.global.window.scrollY + g.global.window.innerHeight,
|
|
221
|
+
left: g.global.window.scrollX,
|
|
222
|
+
right: g.global.window.scrollX + g.global.window.innerWidth
|
|
223
223
|
}, o = {
|
|
224
224
|
top: Math.abs(t.top - e.top),
|
|
225
225
|
bottom: Math.abs(t.bottom - e.bottom),
|
|
@@ -233,12 +233,12 @@ function Mt(e) {
|
|
|
233
233
|
}
|
|
234
234
|
l(Mt, "floatingAlignment");
|
|
235
235
|
function xt(e) {
|
|
236
|
-
let t =
|
|
236
|
+
let t = g.global.getComputedStyle(e), { top: o, left: i, right: n, bottom: r, width: a, height: s } = e.getBoundingClientRect(), {
|
|
237
237
|
marginTop: f,
|
|
238
238
|
marginBottom: c,
|
|
239
239
|
marginLeft: u,
|
|
240
|
-
marginRight:
|
|
241
|
-
paddingTop:
|
|
240
|
+
marginRight: d,
|
|
241
|
+
paddingTop: p,
|
|
242
242
|
paddingBottom: C,
|
|
243
243
|
paddingLeft: it,
|
|
244
244
|
paddingRight: rt,
|
|
@@ -247,30 +247,30 @@ function xt(e) {
|
|
|
247
247
|
borderLeftWidth: st,
|
|
248
248
|
borderRightWidth: ft
|
|
249
249
|
} = t;
|
|
250
|
-
o = o +
|
|
251
|
-
let
|
|
252
|
-
top:
|
|
253
|
-
bottom:
|
|
254
|
-
left:
|
|
255
|
-
right:
|
|
250
|
+
o = o + g.global.window.scrollY, i = i + g.global.window.scrollX, r = r + g.global.window.scrollY, n = n + g.global.window.scrollX;
|
|
251
|
+
let y = {
|
|
252
|
+
top: h(f),
|
|
253
|
+
bottom: h(c),
|
|
254
|
+
left: h(u),
|
|
255
|
+
right: h(d)
|
|
256
256
|
}, ct = {
|
|
257
|
-
top: p
|
|
258
|
-
bottom:
|
|
259
|
-
left:
|
|
260
|
-
right:
|
|
257
|
+
top: h(p),
|
|
258
|
+
bottom: h(C),
|
|
259
|
+
left: h(it),
|
|
260
|
+
right: h(rt)
|
|
261
261
|
}, mt = {
|
|
262
|
-
top:
|
|
263
|
-
bottom:
|
|
264
|
-
left:
|
|
265
|
-
right:
|
|
262
|
+
top: h(at),
|
|
263
|
+
bottom: h(lt),
|
|
264
|
+
left: h(st),
|
|
265
|
+
right: h(ft)
|
|
266
266
|
}, F = {
|
|
267
|
-
top: o -
|
|
268
|
-
bottom: r +
|
|
269
|
-
left: i -
|
|
270
|
-
right: n +
|
|
267
|
+
top: o - y.top,
|
|
268
|
+
bottom: r + y.bottom,
|
|
269
|
+
left: i - y.left,
|
|
270
|
+
right: n + y.right
|
|
271
271
|
};
|
|
272
272
|
return {
|
|
273
|
-
margin:
|
|
273
|
+
margin: y,
|
|
274
274
|
padding: ct,
|
|
275
275
|
border: mt,
|
|
276
276
|
top: o,
|
|
@@ -326,7 +326,7 @@ function Dt(e, { padding: t, border: o, width: i, height: n, top: r, left: a, bo
|
|
|
326
326
|
c,
|
|
327
327
|
t.bottom
|
|
328
328
|
), e.fillRect(a + o.left, r + t.top + o.top, t.left, u);
|
|
329
|
-
let
|
|
329
|
+
let d = [
|
|
330
330
|
{
|
|
331
331
|
type: "padding",
|
|
332
332
|
text: t.top,
|
|
@@ -348,7 +348,7 @@ function Dt(e, { padding: t, border: o, width: i, height: n, top: r, left: a, bo
|
|
|
348
348
|
position: "left"
|
|
349
349
|
}
|
|
350
350
|
];
|
|
351
|
-
return P(
|
|
351
|
+
return P(d);
|
|
352
352
|
}
|
|
353
353
|
l(Dt, "drawPadding");
|
|
354
354
|
function kt(e, { border: t, width: o, height: i, top: n, left: r, bottom: a, right: s }) {
|
package/dist/measure/index.js
CHANGED
|
@@ -89,7 +89,7 @@ function $() {
|
|
|
89
89
|
l($, "destroy");
|
|
90
90
|
|
|
91
91
|
// src/measure/box-model/visualizer.ts
|
|
92
|
-
import { global as
|
|
92
|
+
import { global as g } from "@storybook/global";
|
|
93
93
|
|
|
94
94
|
// src/measure/box-model/labels.ts
|
|
95
95
|
var w = {
|
|
@@ -98,7 +98,7 @@ var w = {
|
|
|
98
98
|
padding: "#93c47d",
|
|
99
99
|
content: "#6fa8dc",
|
|
100
100
|
text: "#232020"
|
|
101
|
-
},
|
|
101
|
+
}, b = 6;
|
|
102
102
|
function N(e, { x: t, y: o, w: i, h: n, r }) {
|
|
103
103
|
t = t - i / 2, o = o - n / 2, i < 2 * r && (r = i / 2), n < 2 * r && (r = n / 2), e.beginPath(), e.moveTo(t + r, o), e.arcTo(t + i, o, t +
|
|
104
104
|
i, o + n, r), e.arcTo(t + i, o + n, t, o + n, r), e.arcTo(t, o + n, t, o, r), e.arcTo(t, o, t + i, o, r), e.closePath();
|
|
@@ -111,21 +111,21 @@ function mt(e, { padding: t, border: o, width: i, height: n, top: r, left: a })
|
|
|
111
111
|
}
|
|
112
112
|
l(mt, "positionCoordinate");
|
|
113
113
|
function ut(e, t, { margin: o, border: i, padding: n }, r, a) {
|
|
114
|
-
let s = /* @__PURE__ */ l((
|
|
115
|
-
return e === "padding" ? s = /* @__PURE__ */ l((
|
|
116
|
-
u +
|
|
114
|
+
let s = /* @__PURE__ */ l((p) => 0, "shift"), f = 0, c = 0, u = a ? 1 : 0.5, d = a ? r * 2 : 0;
|
|
115
|
+
return e === "padding" ? s = /* @__PURE__ */ l((p) => n[p] * u + d, "shift") : e === "border" ? s = /* @__PURE__ */ l((p) => n[p] + i[p] *
|
|
116
|
+
u + d, "shift") : e === "margin" && (s = /* @__PURE__ */ l((p) => n[p] + i[p] + o[p] * u + d, "shift")), t === "top" ? c = -s("top") : t ===
|
|
117
117
|
"right" ? f = s("right") : t === "bottom" ? c = s("bottom") : t === "left" && (f = -s("left")), { offsetX: f, offsetY: c };
|
|
118
118
|
}
|
|
119
119
|
l(ut, "offset");
|
|
120
|
-
function
|
|
120
|
+
function pt(e, t) {
|
|
121
121
|
return Math.abs(e.x - t.x) < Math.abs(e.w + t.w) / 2 && Math.abs(e.y - t.y) < Math.abs(e.h + t.h) / 2;
|
|
122
122
|
}
|
|
123
|
-
l(
|
|
124
|
-
function
|
|
125
|
-
return e === "top" ? t.y = o.y - o.h -
|
|
126
|
-
"left" && (t.x = o.x - o.w / 2 -
|
|
123
|
+
l(pt, "collide");
|
|
124
|
+
function dt(e, t, o) {
|
|
125
|
+
return e === "top" ? t.y = o.y - o.h - b : e === "right" ? t.x = o.x + o.w / 2 + b + t.w / 2 : e === "bottom" ? t.y = o.y + o.h + b : e ===
|
|
126
|
+
"left" && (t.x = o.x - o.w / 2 - b - t.w / 2), { x: t.x, y: t.y };
|
|
127
127
|
}
|
|
128
|
-
l(
|
|
128
|
+
l(dt, "overlapAdjustment");
|
|
129
129
|
function O(e, t, { x: o, y: i, w: n, h: r }, a) {
|
|
130
130
|
return N(e, { x: o, y: i, w: n, h: r, r: 3 }), e.fillStyle = `${w[t]}dd`, e.fill(), e.strokeStyle = w[t], e.stroke(), e.fillStyle = w.text,
|
|
131
131
|
e.fillText(a, o, i), N(e, { x: o, y: i, w: n, h: r, r: 3 }), e.fillStyle = `${w[t]}dd`, e.fill(), e.strokeStyle = w[t], e.stroke(), e.fillStyle =
|
|
@@ -134,48 +134,48 @@ function O(e, t, { x: o, y: i, w: n, h: r }, a) {
|
|
|
134
134
|
l(O, "textWithRect");
|
|
135
135
|
function I(e, t) {
|
|
136
136
|
e.font = "600 12px monospace", e.textBaseline = "middle", e.textAlign = "center";
|
|
137
|
-
let o = e.measureText(t), i = o.actualBoundingBoxAscent + o.actualBoundingBoxDescent, n = o.width +
|
|
137
|
+
let o = e.measureText(t), i = o.actualBoundingBoxAscent + o.actualBoundingBoxDescent, n = o.width + b * 2, r = i + b * 2;
|
|
138
138
|
return { w: n, h: r };
|
|
139
139
|
}
|
|
140
140
|
l(I, "configureText");
|
|
141
|
-
function
|
|
142
|
-
let { x: s, y: f } = mt(i, t), { offsetX: c, offsetY: u } = ut(o, i, t,
|
|
141
|
+
function ht(e, t, { type: o, position: i = "center", text: n }, r, a = !1) {
|
|
142
|
+
let { x: s, y: f } = mt(i, t), { offsetX: c, offsetY: u } = ut(o, i, t, b + 1, a);
|
|
143
143
|
s += c, f += u;
|
|
144
|
-
let { w:
|
|
145
|
-
if (r &&
|
|
146
|
-
let S =
|
|
144
|
+
let { w: d, h: p } = I(e, n);
|
|
145
|
+
if (r && pt({ x: s, y: f, w: d, h: p }, r)) {
|
|
146
|
+
let S = dt(i, { x: s, y: f, w: d, h: p }, r);
|
|
147
147
|
s = S.x, f = S.y;
|
|
148
148
|
}
|
|
149
|
-
return O(e, o, { x: s, y: f, w:
|
|
149
|
+
return O(e, o, { x: s, y: f, w: d, h: p }, n);
|
|
150
150
|
}
|
|
151
|
-
l(
|
|
152
|
-
function
|
|
153
|
-
let i = t * 0.5 +
|
|
151
|
+
l(ht, "drawLabel");
|
|
152
|
+
function gt(e, { w: t, h: o }) {
|
|
153
|
+
let i = t * 0.5 + b, n = o * 0.5 + b;
|
|
154
154
|
return {
|
|
155
155
|
offsetX: (e.x === "left" ? -1 : 1) * i,
|
|
156
156
|
offsetY: (e.y === "top" ? -1 : 1) * n
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
l(
|
|
160
|
-
function
|
|
161
|
-
let { floatingAlignment: n, extremities: r } = t, a = r[n.x], s = r[n.y], { w: f, h: c } = I(e, i), { offsetX: u, offsetY:
|
|
159
|
+
l(gt, "floatingOffset");
|
|
160
|
+
function bt(e, t, { type: o, text: i }) {
|
|
161
|
+
let { floatingAlignment: n, extremities: r } = t, a = r[n.x], s = r[n.y], { w: f, h: c } = I(e, i), { offsetX: u, offsetY: d } = gt(n, {
|
|
162
162
|
w: f,
|
|
163
163
|
h: c
|
|
164
164
|
});
|
|
165
|
-
return a += u, s +=
|
|
165
|
+
return a += u, s += d, O(e, o, { x: a, y: s, w: f, h: c }, i);
|
|
166
166
|
}
|
|
167
|
-
l(
|
|
168
|
-
function
|
|
167
|
+
l(bt, "drawFloatingLabel");
|
|
168
|
+
function E(e, t, o, i) {
|
|
169
169
|
let n = [];
|
|
170
170
|
o.forEach((r, a) => {
|
|
171
|
-
let s = i && r.position === "center" ?
|
|
171
|
+
let s = i && r.position === "center" ? bt(e, t, r) : ht(e, t, r, n[a - 1], i);
|
|
172
172
|
n[a] = s;
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
|
-
l(
|
|
175
|
+
l(E, "drawStack");
|
|
176
176
|
function _(e, t, o, i) {
|
|
177
177
|
let n = o.reduce((r, a) => (Object.prototype.hasOwnProperty.call(r, a.position) || (r[a.position] = []), r[a.position]?.push(a), r), {});
|
|
178
|
-
n.top &&
|
|
178
|
+
n.top && E(e, t, n.top, i), n.right && E(e, t, n.right, i), n.bottom && E(e, t, n.bottom, i), n.left && E(e, t, n.left, i), n.center && E(
|
|
179
179
|
e, t, n.center, i);
|
|
180
180
|
}
|
|
181
181
|
l(_, "labelStacks");
|
|
@@ -187,10 +187,10 @@ var M = {
|
|
|
187
187
|
padding: "#93c47d8c",
|
|
188
188
|
content: "#6fa8dca8"
|
|
189
189
|
}, q = 30;
|
|
190
|
-
function
|
|
190
|
+
function h(e) {
|
|
191
191
|
return parseInt(e.replace("px", ""), 10);
|
|
192
192
|
}
|
|
193
|
-
l(
|
|
193
|
+
l(h, "pxToNumber");
|
|
194
194
|
function L(e) {
|
|
195
195
|
return Number.isInteger(e) ? e : e.toFixed(2);
|
|
196
196
|
}
|
|
@@ -201,10 +201,10 @@ function k(e) {
|
|
|
201
201
|
l(k, "filterZeroValues");
|
|
202
202
|
function wt(e) {
|
|
203
203
|
let t = {
|
|
204
|
-
top:
|
|
205
|
-
bottom:
|
|
206
|
-
left:
|
|
207
|
-
right:
|
|
204
|
+
top: g.window.scrollY,
|
|
205
|
+
bottom: g.window.scrollY + g.window.innerHeight,
|
|
206
|
+
left: g.window.scrollX,
|
|
207
|
+
right: g.window.scrollX + g.window.innerWidth
|
|
208
208
|
}, o = {
|
|
209
209
|
top: Math.abs(t.top - e.top),
|
|
210
210
|
bottom: Math.abs(t.bottom - e.bottom),
|
|
@@ -218,12 +218,12 @@ function wt(e) {
|
|
|
218
218
|
}
|
|
219
219
|
l(wt, "floatingAlignment");
|
|
220
220
|
function Lt(e) {
|
|
221
|
-
let t =
|
|
221
|
+
let t = g.getComputedStyle(e), { top: o, left: i, right: n, bottom: r, width: a, height: s } = e.getBoundingClientRect(), {
|
|
222
222
|
marginTop: f,
|
|
223
223
|
marginBottom: c,
|
|
224
224
|
marginLeft: u,
|
|
225
|
-
marginRight:
|
|
226
|
-
paddingTop:
|
|
225
|
+
marginRight: d,
|
|
226
|
+
paddingTop: p,
|
|
227
227
|
paddingBottom: S,
|
|
228
228
|
paddingLeft: tt,
|
|
229
229
|
paddingRight: et,
|
|
@@ -232,30 +232,30 @@ function Lt(e) {
|
|
|
232
232
|
borderLeftWidth: it,
|
|
233
233
|
borderRightWidth: rt
|
|
234
234
|
} = t;
|
|
235
|
-
o = o +
|
|
236
|
-
let
|
|
237
|
-
top:
|
|
238
|
-
bottom:
|
|
239
|
-
left:
|
|
240
|
-
right:
|
|
235
|
+
o = o + g.window.scrollY, i = i + g.window.scrollX, r = r + g.window.scrollY, n = n + g.window.scrollX;
|
|
236
|
+
let y = {
|
|
237
|
+
top: h(f),
|
|
238
|
+
bottom: h(c),
|
|
239
|
+
left: h(u),
|
|
240
|
+
right: h(d)
|
|
241
241
|
}, lt = {
|
|
242
|
-
top: p
|
|
243
|
-
bottom:
|
|
244
|
-
left:
|
|
245
|
-
right:
|
|
242
|
+
top: h(p),
|
|
243
|
+
bottom: h(S),
|
|
244
|
+
left: h(tt),
|
|
245
|
+
right: h(et)
|
|
246
246
|
}, at = {
|
|
247
|
-
top:
|
|
248
|
-
bottom:
|
|
249
|
-
left:
|
|
250
|
-
right:
|
|
247
|
+
top: h(nt),
|
|
248
|
+
bottom: h(ot),
|
|
249
|
+
left: h(it),
|
|
250
|
+
right: h(rt)
|
|
251
251
|
}, A = {
|
|
252
|
-
top: o -
|
|
253
|
-
bottom: r +
|
|
254
|
-
left: i -
|
|
255
|
-
right: n +
|
|
252
|
+
top: o - y.top,
|
|
253
|
+
bottom: r + y.bottom,
|
|
254
|
+
left: i - y.left,
|
|
255
|
+
right: n + y.right
|
|
256
256
|
};
|
|
257
257
|
return {
|
|
258
|
-
margin:
|
|
258
|
+
margin: y,
|
|
259
259
|
padding: lt,
|
|
260
260
|
border: at,
|
|
261
261
|
top: o,
|
|
@@ -269,7 +269,7 @@ function Lt(e) {
|
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
271
|
l(Lt, "measureElement");
|
|
272
|
-
function
|
|
272
|
+
function yt(e, { margin: t, width: o, height: i, top: n, left: r, bottom: a, right: s }) {
|
|
273
273
|
let f = i + t.bottom + t.top;
|
|
274
274
|
e.fillStyle = M.margin, e.fillRect(r, n - t.top, o, t.top), e.fillRect(s, n - t.top, t.right, f), e.fillRect(r, a, o, t.bottom), e.fillRect(
|
|
275
275
|
r - t.left, n - t.top, t.left, f);
|
|
@@ -297,8 +297,8 @@ function Et(e, { margin: t, width: o, height: i, top: n, left: r, bottom: a, rig
|
|
|
297
297
|
];
|
|
298
298
|
return k(c);
|
|
299
299
|
}
|
|
300
|
-
l(
|
|
301
|
-
function
|
|
300
|
+
l(yt, "drawMargin");
|
|
301
|
+
function Et(e, { padding: t, border: o, width: i, height: n, top: r, left: a, bottom: s, right: f }) {
|
|
302
302
|
let c = i - o.left - o.right, u = n - t.top - t.bottom - o.top - o.bottom;
|
|
303
303
|
e.fillStyle = M.padding, e.fillRect(a + o.left, r + o.top, c, t.top), e.fillRect(
|
|
304
304
|
f - t.right - o.right,
|
|
@@ -311,7 +311,7 @@ function yt(e, { padding: t, border: o, width: i, height: n, top: r, left: a, bo
|
|
|
311
311
|
c,
|
|
312
312
|
t.bottom
|
|
313
313
|
), e.fillRect(a + o.left, r + t.top + o.top, t.left, u);
|
|
314
|
-
let
|
|
314
|
+
let d = [
|
|
315
315
|
{
|
|
316
316
|
type: "padding",
|
|
317
317
|
text: t.top,
|
|
@@ -333,9 +333,9 @@ function yt(e, { padding: t, border: o, width: i, height: n, top: r, left: a, bo
|
|
|
333
333
|
position: "left"
|
|
334
334
|
}
|
|
335
335
|
];
|
|
336
|
-
return k(
|
|
336
|
+
return k(d);
|
|
337
337
|
}
|
|
338
|
-
l(
|
|
338
|
+
l(Et, "drawPadding");
|
|
339
339
|
function St(e, { border: t, width: o, height: i, top: n, left: r, bottom: a, right: s }) {
|
|
340
340
|
let f = i - t.top - t.bottom;
|
|
341
341
|
e.fillStyle = M.border, e.fillRect(r, n, o, t.top), e.fillRect(r, a - t.bottom, o, t.bottom), e.fillRect(r, n + t.top, t.left, f), e.fillRect(
|
|
@@ -384,7 +384,7 @@ l(Ct, "drawContent");
|
|
|
384
384
|
function vt(e) {
|
|
385
385
|
return (t) => {
|
|
386
386
|
if (e && t) {
|
|
387
|
-
let o = Lt(e), i =
|
|
387
|
+
let o = Lt(e), i = yt(t, o), n = Et(t, o), r = St(t, o), a = Ct(t, o), s = o.width <= q * 3 || o.height <= q;
|
|
388
388
|
_(
|
|
389
389
|
t,
|
|
390
390
|
o,
|