storybook 9.1.0-alpha.1 → 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 +714 -707
- package/dist/common/index.js +703 -696
- 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
package/dist/measure/preview.cjs
CHANGED
|
@@ -13,16 +13,16 @@ var ut = (e, t) => {
|
|
|
13
13
|
!mt.call(e, n) && n !== o && v(e, n, { get: () => t[n], enumerable: !(i = ft(t, n)) || i.enumerable });
|
|
14
14
|
return e;
|
|
15
15
|
};
|
|
16
|
-
var
|
|
16
|
+
var pt = (e) => ht(v({}, "__esModule", { value: !0 }), e);
|
|
17
17
|
|
|
18
18
|
// src/measure/preview.ts
|
|
19
|
-
var
|
|
20
|
-
ut(
|
|
19
|
+
var Pt = {};
|
|
20
|
+
ut(Pt, {
|
|
21
21
|
decorators: () => J,
|
|
22
|
-
default: () =>
|
|
22
|
+
default: () => At,
|
|
23
23
|
initialGlobals: () => tt
|
|
24
24
|
});
|
|
25
|
-
module.exports =
|
|
25
|
+
module.exports = pt(Pt);
|
|
26
26
|
var Q = require("storybook/preview-api");
|
|
27
27
|
|
|
28
28
|
// src/measure/constants.ts
|
|
@@ -33,16 +33,16 @@ var R = "storybook/measure-addon", Ft = `${R}/tool`, F = "measureEnabled", Wt =
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
// src/measure/withMeasure.ts
|
|
36
|
-
var
|
|
36
|
+
var P = require("storybook/preview-api");
|
|
37
37
|
|
|
38
38
|
// src/measure/box-model/canvas.ts
|
|
39
39
|
var y = require("@storybook/global");
|
|
40
40
|
|
|
41
41
|
// ../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
42
|
-
var
|
|
42
|
+
var dt = process.env.NODE_ENV === "production", D = "Invariant failed";
|
|
43
43
|
function M(e, t) {
|
|
44
44
|
if (!e) {
|
|
45
|
-
if (
|
|
45
|
+
if (dt)
|
|
46
46
|
throw new Error(D);
|
|
47
47
|
var o = typeof t == "function" ? t() : t, i = o ? "".concat(D, ": ").concat(o) : D;
|
|
48
48
|
throw new Error(i);
|
|
@@ -56,7 +56,7 @@ function W() {
|
|
|
56
56
|
return { width: Math.max(e.scrollWidth, e.offsetWidth), height: t };
|
|
57
57
|
}
|
|
58
58
|
r(W, "getDocumentWidthAndHeight");
|
|
59
|
-
function
|
|
59
|
+
function gt() {
|
|
60
60
|
let e = y.global.document.createElement("canvas");
|
|
61
61
|
e.id = "storybook-addon-measure";
|
|
62
62
|
let t = e.getContext("2d");
|
|
@@ -65,7 +65,7 @@ function bt() {
|
|
|
65
65
|
return k(e, t, { width: o, height: i }), e.style.position = "absolute", e.style.left = "0", e.style.top = "0", e.style.zIndex = "214748364\
|
|
66
66
|
7", e.style.pointerEvents = "none", y.global.document.body.appendChild(e), { canvas: e, context: t, width: o, height: i };
|
|
67
67
|
}
|
|
68
|
-
r(
|
|
68
|
+
r(gt, "createCanvas");
|
|
69
69
|
function k(e, t, { width: o, height: i }) {
|
|
70
70
|
e.style.width = `${o}px`, e.style.height = `${i}px`;
|
|
71
71
|
let n = y.global.window.devicePixelRatio;
|
|
@@ -74,7 +74,7 @@ function k(e, t, { width: o, height: i }) {
|
|
|
74
74
|
r(k, "setCanvasWidthAndHeight");
|
|
75
75
|
var m = {};
|
|
76
76
|
function Y() {
|
|
77
|
-
m.canvas || (m =
|
|
77
|
+
m.canvas || (m = gt());
|
|
78
78
|
}
|
|
79
79
|
r(Y, "init");
|
|
80
80
|
function B() {
|
|
@@ -97,7 +97,7 @@ function $() {
|
|
|
97
97
|
r($, "destroy");
|
|
98
98
|
|
|
99
99
|
// src/measure/box-model/visualizer.ts
|
|
100
|
-
var
|
|
100
|
+
var g = require("@storybook/global");
|
|
101
101
|
|
|
102
102
|
// src/measure/box-model/labels.ts
|
|
103
103
|
var w = {
|
|
@@ -106,22 +106,22 @@ var w = {
|
|
|
106
106
|
padding: "#93c47d",
|
|
107
107
|
content: "#6fa8dc",
|
|
108
108
|
text: "#232020"
|
|
109
|
-
},
|
|
109
|
+
}, b = 6;
|
|
110
110
|
function N(e, { x: t, y: o, w: i, h: n, r: l }) {
|
|
111
111
|
t = t - i / 2, o = o - n / 2, i < 2 * l && (l = i / 2), n < 2 * l && (l = n / 2), e.beginPath(), e.moveTo(t + l, o), e.arcTo(t + i, o, t +
|
|
112
112
|
i, o + n, l), e.arcTo(t + i, o + n, t, o + n, l), e.arcTo(t, o + n, t, o, l), e.arcTo(t, o, t + i, o, l), e.closePath();
|
|
113
113
|
}
|
|
114
114
|
r(N, "roundedRect");
|
|
115
|
-
function
|
|
115
|
+
function bt(e, { padding: t, border: o, width: i, height: n, top: l, left: a }) {
|
|
116
116
|
let s = i - o.left - o.right - t.left - t.right, f = n - t.top - t.bottom - o.top - o.bottom, c = a + o.left + t.left, u = l + o.top + t.top;
|
|
117
117
|
return e === "top" ? c += s / 2 : e === "right" ? (c += s, u += f / 2) : e === "bottom" ? (c += s / 2, u += f) : e === "left" ? u += f / 2 :
|
|
118
118
|
e === "center" && (c += s / 2, u += f / 2), { x: c, y: u };
|
|
119
119
|
}
|
|
120
|
-
r(
|
|
120
|
+
r(bt, "positionCoordinate");
|
|
121
121
|
function wt(e, t, { margin: o, border: i, padding: n }, l, a) {
|
|
122
|
-
let s = /* @__PURE__ */ r((h) => 0, "shift"), f = 0, c = 0, u = a ? 1 : 0.5,
|
|
123
|
-
return e === "padding" ? s = /* @__PURE__ */ r((h) => n[h] * u +
|
|
124
|
-
u +
|
|
122
|
+
let s = /* @__PURE__ */ r((h) => 0, "shift"), f = 0, c = 0, u = a ? 1 : 0.5, p = a ? l * 2 : 0;
|
|
123
|
+
return e === "padding" ? s = /* @__PURE__ */ r((h) => n[h] * u + p, "shift") : e === "border" ? s = /* @__PURE__ */ r((h) => n[h] + i[h] *
|
|
124
|
+
u + p, "shift") : e === "margin" && (s = /* @__PURE__ */ r((h) => n[h] + i[h] + o[h] * u + p, "shift")), t === "top" ? c = -s("top") : t ===
|
|
125
125
|
"right" ? f = s("right") : t === "bottom" ? c = s("bottom") : t === "left" && (f = -s("left")), { offsetX: f, offsetY: c };
|
|
126
126
|
}
|
|
127
127
|
r(wt, "offset");
|
|
@@ -130,8 +130,8 @@ function Lt(e, t) {
|
|
|
130
130
|
}
|
|
131
131
|
r(Lt, "collide");
|
|
132
132
|
function Et(e, t, o) {
|
|
133
|
-
return e === "top" ? t.y = o.y - o.h -
|
|
134
|
-
"left" && (t.x = o.x - o.w / 2 -
|
|
133
|
+
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 ===
|
|
134
|
+
"left" && (t.x = o.x - o.w / 2 - b - t.w / 2), { x: t.x, y: t.y };
|
|
135
135
|
}
|
|
136
136
|
r(Et, "overlapAdjustment");
|
|
137
137
|
function O(e, t, { x: o, y: i, w: n, h: l }, a) {
|
|
@@ -142,23 +142,23 @@ function O(e, t, { x: o, y: i, w: n, h: l }, a) {
|
|
|
142
142
|
r(O, "textWithRect");
|
|
143
143
|
function I(e, t) {
|
|
144
144
|
e.font = "600 12px monospace", e.textBaseline = "middle", e.textAlign = "center";
|
|
145
|
-
let o = e.measureText(t), i = o.actualBoundingBoxAscent + o.actualBoundingBoxDescent, n = o.width +
|
|
145
|
+
let o = e.measureText(t), i = o.actualBoundingBoxAscent + o.actualBoundingBoxDescent, n = o.width + b * 2, l = i + b * 2;
|
|
146
146
|
return { w: n, h: l };
|
|
147
147
|
}
|
|
148
148
|
r(I, "configureText");
|
|
149
149
|
function yt(e, t, { type: o, position: i = "center", text: n }, l, a = !1) {
|
|
150
|
-
let { x: s, y: f } =
|
|
150
|
+
let { x: s, y: f } = bt(i, t), { offsetX: c, offsetY: u } = wt(o, i, t, b + 1, a);
|
|
151
151
|
s += c, f += u;
|
|
152
|
-
let { w:
|
|
153
|
-
if (l && Lt({ x: s, y: f, w:
|
|
154
|
-
let C = Et(i, { x: s, y: f, w:
|
|
152
|
+
let { w: p, h } = I(e, n);
|
|
153
|
+
if (l && Lt({ x: s, y: f, w: p, h }, l)) {
|
|
154
|
+
let C = Et(i, { x: s, y: f, w: p, h }, l);
|
|
155
155
|
s = C.x, f = C.y;
|
|
156
156
|
}
|
|
157
|
-
return O(e, o, { x: s, y: f, w:
|
|
157
|
+
return O(e, o, { x: s, y: f, w: p, h }, n);
|
|
158
158
|
}
|
|
159
159
|
r(yt, "drawLabel");
|
|
160
160
|
function St(e, { w: t, h: o }) {
|
|
161
|
-
let i = t * 0.5 +
|
|
161
|
+
let i = t * 0.5 + b, n = o * 0.5 + b;
|
|
162
162
|
return {
|
|
163
163
|
offsetX: (e.x === "left" ? -1 : 1) * i,
|
|
164
164
|
offsetY: (e.y === "top" ? -1 : 1) * n
|
|
@@ -166,11 +166,11 @@ function St(e, { w: t, h: o }) {
|
|
|
166
166
|
}
|
|
167
167
|
r(St, "floatingOffset");
|
|
168
168
|
function Ct(e, t, { type: o, text: i }) {
|
|
169
|
-
let { floatingAlignment: n, extremities: l } = t, a = l[n.x], s = l[n.y], { w: f, h: c } = I(e, i), { offsetX: u, offsetY:
|
|
169
|
+
let { floatingAlignment: n, extremities: l } = t, a = l[n.x], s = l[n.y], { w: f, h: c } = I(e, i), { offsetX: u, offsetY: p } = St(n, {
|
|
170
170
|
w: f,
|
|
171
171
|
h: c
|
|
172
172
|
});
|
|
173
|
-
return a += u, s +=
|
|
173
|
+
return a += u, s += p, O(e, o, { x: a, y: s, w: f, h: c }, i);
|
|
174
174
|
}
|
|
175
175
|
r(Ct, "drawFloatingLabel");
|
|
176
176
|
function S(e, t, o, i) {
|
|
@@ -195,24 +195,24 @@ var x = {
|
|
|
195
195
|
padding: "#93c47d8c",
|
|
196
196
|
content: "#6fa8dca8"
|
|
197
197
|
}, q = 30;
|
|
198
|
-
function
|
|
198
|
+
function d(e) {
|
|
199
199
|
return parseInt(e.replace("px", ""), 10);
|
|
200
200
|
}
|
|
201
|
-
r(
|
|
201
|
+
r(d, "pxToNumber");
|
|
202
202
|
function L(e) {
|
|
203
203
|
return Number.isInteger(e) ? e : e.toFixed(2);
|
|
204
204
|
}
|
|
205
205
|
r(L, "round");
|
|
206
|
-
function
|
|
206
|
+
function A(e) {
|
|
207
207
|
return e.filter((t) => t.text !== 0 && t.text !== "0");
|
|
208
208
|
}
|
|
209
|
-
r(
|
|
209
|
+
r(A, "filterZeroValues");
|
|
210
210
|
function vt(e) {
|
|
211
211
|
let t = {
|
|
212
|
-
top:
|
|
213
|
-
bottom:
|
|
214
|
-
left:
|
|
215
|
-
right:
|
|
212
|
+
top: g.global.window.scrollY,
|
|
213
|
+
bottom: g.global.window.scrollY + g.global.window.innerHeight,
|
|
214
|
+
left: g.global.window.scrollX,
|
|
215
|
+
right: g.global.window.scrollX + g.global.window.innerWidth
|
|
216
216
|
}, o = {
|
|
217
217
|
top: Math.abs(t.top - e.top),
|
|
218
218
|
bottom: Math.abs(t.bottom - e.bottom),
|
|
@@ -226,11 +226,11 @@ function vt(e) {
|
|
|
226
226
|
}
|
|
227
227
|
r(vt, "floatingAlignment");
|
|
228
228
|
function Rt(e) {
|
|
229
|
-
let t =
|
|
229
|
+
let t = g.global.getComputedStyle(e), { top: o, left: i, right: n, bottom: l, width: a, height: s } = e.getBoundingClientRect(), {
|
|
230
230
|
marginTop: f,
|
|
231
231
|
marginBottom: c,
|
|
232
232
|
marginLeft: u,
|
|
233
|
-
marginRight:
|
|
233
|
+
marginRight: p,
|
|
234
234
|
paddingTop: h,
|
|
235
235
|
paddingBottom: C,
|
|
236
236
|
paddingLeft: et,
|
|
@@ -240,22 +240,22 @@ function Rt(e) {
|
|
|
240
240
|
borderLeftWidth: lt,
|
|
241
241
|
borderRightWidth: rt
|
|
242
242
|
} = t;
|
|
243
|
-
o = o +
|
|
243
|
+
o = o + g.global.window.scrollY, i = i + g.global.window.scrollX, l = l + g.global.window.scrollY, n = n + g.global.window.scrollX;
|
|
244
244
|
let E = {
|
|
245
|
-
top:
|
|
246
|
-
bottom:
|
|
247
|
-
left:
|
|
248
|
-
right: p
|
|
245
|
+
top: d(f),
|
|
246
|
+
bottom: d(c),
|
|
247
|
+
left: d(u),
|
|
248
|
+
right: d(p)
|
|
249
249
|
}, at = {
|
|
250
|
-
top:
|
|
251
|
-
bottom:
|
|
252
|
-
left:
|
|
253
|
-
right:
|
|
250
|
+
top: d(h),
|
|
251
|
+
bottom: d(C),
|
|
252
|
+
left: d(et),
|
|
253
|
+
right: d(ot)
|
|
254
254
|
}, st = {
|
|
255
|
-
top:
|
|
256
|
-
bottom:
|
|
257
|
-
left:
|
|
258
|
-
right:
|
|
255
|
+
top: d(it),
|
|
256
|
+
bottom: d(nt),
|
|
257
|
+
left: d(lt),
|
|
258
|
+
right: d(rt)
|
|
259
259
|
}, H = {
|
|
260
260
|
top: o - E.top,
|
|
261
261
|
bottom: l + E.bottom,
|
|
@@ -303,7 +303,7 @@ function Mt(e, { margin: t, width: o, height: i, top: n, left: l, bottom: a, rig
|
|
|
303
303
|
position: "left"
|
|
304
304
|
}
|
|
305
305
|
];
|
|
306
|
-
return
|
|
306
|
+
return A(c);
|
|
307
307
|
}
|
|
308
308
|
r(Mt, "drawMargin");
|
|
309
309
|
function xt(e, { padding: t, border: o, width: i, height: n, top: l, left: a, bottom: s, right: f }) {
|
|
@@ -319,7 +319,7 @@ function xt(e, { padding: t, border: o, width: i, height: n, top: l, left: a, bo
|
|
|
319
319
|
c,
|
|
320
320
|
t.bottom
|
|
321
321
|
), e.fillRect(a + o.left, l + t.top + o.top, t.left, u);
|
|
322
|
-
let
|
|
322
|
+
let p = [
|
|
323
323
|
{
|
|
324
324
|
type: "padding",
|
|
325
325
|
text: t.top,
|
|
@@ -341,7 +341,7 @@ function xt(e, { padding: t, border: o, width: i, height: n, top: l, left: a, bo
|
|
|
341
341
|
position: "left"
|
|
342
342
|
}
|
|
343
343
|
];
|
|
344
|
-
return
|
|
344
|
+
return A(p);
|
|
345
345
|
}
|
|
346
346
|
r(xt, "drawPadding");
|
|
347
347
|
function Tt(e, { border: t, width: o, height: i, top: n, left: l, bottom: a, right: s }) {
|
|
@@ -370,7 +370,7 @@ function Tt(e, { border: t, width: o, height: i, top: n, left: l, bottom: a, rig
|
|
|
370
370
|
position: "left"
|
|
371
371
|
}
|
|
372
372
|
];
|
|
373
|
-
return
|
|
373
|
+
return A(c);
|
|
374
374
|
}
|
|
375
375
|
r(Tt, "drawBorder");
|
|
376
376
|
function Dt(e, { padding: t, border: o, width: i, height: n, top: l, left: a }) {
|
|
@@ -429,7 +429,7 @@ function K(e, t) {
|
|
|
429
429
|
r(K, "findAndDrawElement");
|
|
430
430
|
var Z = /* @__PURE__ */ r((e, t) => {
|
|
431
431
|
let { measureEnabled: o } = t.globals || {};
|
|
432
|
-
return (0,
|
|
432
|
+
return (0, P.useEffect)(() => {
|
|
433
433
|
if (typeof globalThis.document > "u")
|
|
434
434
|
return;
|
|
435
435
|
let i = /* @__PURE__ */ r((n) => {
|
|
@@ -440,7 +440,7 @@ var Z = /* @__PURE__ */ r((e, t) => {
|
|
|
440
440
|
return globalThis.document.addEventListener("pointermove", i), () => {
|
|
441
441
|
globalThis.document.removeEventListener("pointermove", i);
|
|
442
442
|
};
|
|
443
|
-
}, []), (0,
|
|
443
|
+
}, []), (0, P.useEffect)(() => {
|
|
444
444
|
let i = /* @__PURE__ */ r((l) => {
|
|
445
445
|
window.requestAnimationFrame(() => {
|
|
446
446
|
l.stopPropagation(), K(l.clientX, l.clientY);
|
|
@@ -460,7 +460,7 @@ resize", n), K(T.x, T.y)), () => {
|
|
|
460
460
|
// src/measure/preview.ts
|
|
461
461
|
var J = globalThis.FEATURES?.measure ? [Z] : [], tt = {
|
|
462
462
|
[F]: !1
|
|
463
|
-
},
|
|
463
|
+
}, At = /* @__PURE__ */ r(() => (0, Q.definePreview)({
|
|
464
464
|
decorators: J,
|
|
465
465
|
initialGlobals: tt
|
|
466
466
|
}), "default");
|
package/dist/measure/preview.js
CHANGED
|
@@ -5,7 +5,7 @@ var r = (e, t) => it(e, "name", { value: t, configurable: !0 });
|
|
|
5
5
|
import { definePreview as St } from "storybook/preview-api";
|
|
6
6
|
|
|
7
7
|
// src/measure/constants.ts
|
|
8
|
-
var C = "storybook/measure-addon", Mt = `${C}/tool`,
|
|
8
|
+
var C = "storybook/measure-addon", Mt = `${C}/tool`, P = "measureEnabled", xt = {
|
|
9
9
|
RESULT: `${C}/result`,
|
|
10
10
|
REQUEST: `${C}/request`,
|
|
11
11
|
CLEAR: `${C}/clear`
|
|
@@ -76,7 +76,7 @@ function z() {
|
|
|
76
76
|
r(z, "destroy");
|
|
77
77
|
|
|
78
78
|
// src/measure/box-model/visualizer.ts
|
|
79
|
-
import { global as
|
|
79
|
+
import { global as g } from "@storybook/global";
|
|
80
80
|
|
|
81
81
|
// src/measure/box-model/labels.ts
|
|
82
82
|
var w = {
|
|
@@ -85,7 +85,7 @@ var w = {
|
|
|
85
85
|
padding: "#93c47d",
|
|
86
86
|
content: "#6fa8dc",
|
|
87
87
|
text: "#232020"
|
|
88
|
-
},
|
|
88
|
+
}, b = 6;
|
|
89
89
|
function X(e, { x: t, y: o, w: i, h: n, r: l }) {
|
|
90
90
|
t = t - i / 2, o = o - n / 2, i < 2 * l && (l = i / 2), n < 2 * l && (l = n / 2), e.beginPath(), e.moveTo(t + l, o), e.arcTo(t + i, o, t +
|
|
91
91
|
i, o + n, l), e.arcTo(t + i, o + n, t, o + n, l), e.arcTo(t, o + n, t, o, l), e.arcTo(t, o, t + i, o, l), e.closePath();
|
|
@@ -98,9 +98,9 @@ function at(e, { padding: t, border: o, width: i, height: n, top: l, left: a })
|
|
|
98
98
|
}
|
|
99
99
|
r(at, "positionCoordinate");
|
|
100
100
|
function st(e, t, { margin: o, border: i, padding: n }, l, a) {
|
|
101
|
-
let s = /* @__PURE__ */ r((h) => 0, "shift"), f = 0, c = 0, u = a ? 1 : 0.5,
|
|
102
|
-
return e === "padding" ? s = /* @__PURE__ */ r((h) => n[h] * u +
|
|
103
|
-
u +
|
|
101
|
+
let s = /* @__PURE__ */ r((h) => 0, "shift"), f = 0, c = 0, u = a ? 1 : 0.5, p = a ? l * 2 : 0;
|
|
102
|
+
return e === "padding" ? s = /* @__PURE__ */ r((h) => n[h] * u + p, "shift") : e === "border" ? s = /* @__PURE__ */ r((h) => n[h] + i[h] *
|
|
103
|
+
u + p, "shift") : e === "margin" && (s = /* @__PURE__ */ r((h) => n[h] + i[h] + o[h] * u + p, "shift")), t === "top" ? c = -s("top") : t ===
|
|
104
104
|
"right" ? f = s("right") : t === "bottom" ? c = s("bottom") : t === "left" && (f = -s("left")), { offsetX: f, offsetY: c };
|
|
105
105
|
}
|
|
106
106
|
r(st, "offset");
|
|
@@ -109,8 +109,8 @@ function ft(e, t) {
|
|
|
109
109
|
}
|
|
110
110
|
r(ft, "collide");
|
|
111
111
|
function ct(e, t, o) {
|
|
112
|
-
return e === "top" ? t.y = o.y - o.h -
|
|
113
|
-
"left" && (t.x = o.x - o.w / 2 -
|
|
112
|
+
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 ===
|
|
113
|
+
"left" && (t.x = o.x - o.w / 2 - b - t.w / 2), { x: t.x, y: t.y };
|
|
114
114
|
}
|
|
115
115
|
r(ct, "overlapAdjustment");
|
|
116
116
|
function $(e, t, { x: o, y: i, w: n, h: l }, a) {
|
|
@@ -121,23 +121,23 @@ function $(e, t, { x: o, y: i, w: n, h: l }, a) {
|
|
|
121
121
|
r($, "textWithRect");
|
|
122
122
|
function N(e, t) {
|
|
123
123
|
e.font = "600 12px monospace", e.textBaseline = "middle", e.textAlign = "center";
|
|
124
|
-
let o = e.measureText(t), i = o.actualBoundingBoxAscent + o.actualBoundingBoxDescent, n = o.width +
|
|
124
|
+
let o = e.measureText(t), i = o.actualBoundingBoxAscent + o.actualBoundingBoxDescent, n = o.width + b * 2, l = i + b * 2;
|
|
125
125
|
return { w: n, h: l };
|
|
126
126
|
}
|
|
127
127
|
r(N, "configureText");
|
|
128
128
|
function mt(e, t, { type: o, position: i = "center", text: n }, l, a = !1) {
|
|
129
|
-
let { x: s, y: f } = at(i, t), { offsetX: c, offsetY: u } = st(o, i, t,
|
|
129
|
+
let { x: s, y: f } = at(i, t), { offsetX: c, offsetY: u } = st(o, i, t, b + 1, a);
|
|
130
130
|
s += c, f += u;
|
|
131
|
-
let { w:
|
|
132
|
-
if (l && ft({ x: s, y: f, w:
|
|
133
|
-
let S = ct(i, { x: s, y: f, w:
|
|
131
|
+
let { w: p, h } = N(e, n);
|
|
132
|
+
if (l && ft({ x: s, y: f, w: p, h }, l)) {
|
|
133
|
+
let S = ct(i, { x: s, y: f, w: p, h }, l);
|
|
134
134
|
s = S.x, f = S.y;
|
|
135
135
|
}
|
|
136
|
-
return $(e, o, { x: s, y: f, w:
|
|
136
|
+
return $(e, o, { x: s, y: f, w: p, h }, n);
|
|
137
137
|
}
|
|
138
138
|
r(mt, "drawLabel");
|
|
139
139
|
function ut(e, { w: t, h: o }) {
|
|
140
|
-
let i = t * 0.5 +
|
|
140
|
+
let i = t * 0.5 + b, n = o * 0.5 + b;
|
|
141
141
|
return {
|
|
142
142
|
offsetX: (e.x === "left" ? -1 : 1) * i,
|
|
143
143
|
offsetY: (e.y === "top" ? -1 : 1) * n
|
|
@@ -145,11 +145,11 @@ function ut(e, { w: t, h: o }) {
|
|
|
145
145
|
}
|
|
146
146
|
r(ut, "floatingOffset");
|
|
147
147
|
function ht(e, t, { type: o, text: i }) {
|
|
148
|
-
let { floatingAlignment: n, extremities: l } = t, a = l[n.x], s = l[n.y], { w: f, h: c } = N(e, i), { offsetX: u, offsetY:
|
|
148
|
+
let { floatingAlignment: n, extremities: l } = t, a = l[n.x], s = l[n.y], { w: f, h: c } = N(e, i), { offsetX: u, offsetY: p } = ut(n, {
|
|
149
149
|
w: f,
|
|
150
150
|
h: c
|
|
151
151
|
});
|
|
152
|
-
return a += u, s +=
|
|
152
|
+
return a += u, s += p, $(e, o, { x: a, y: s, w: f, h: c }, i);
|
|
153
153
|
}
|
|
154
154
|
r(ht, "drawFloatingLabel");
|
|
155
155
|
function y(e, t, o, i) {
|
|
@@ -174,10 +174,10 @@ var M = {
|
|
|
174
174
|
padding: "#93c47d8c",
|
|
175
175
|
content: "#6fa8dca8"
|
|
176
176
|
}, I = 30;
|
|
177
|
-
function
|
|
177
|
+
function d(e) {
|
|
178
178
|
return parseInt(e.replace("px", ""), 10);
|
|
179
179
|
}
|
|
180
|
-
r(
|
|
180
|
+
r(d, "pxToNumber");
|
|
181
181
|
function L(e) {
|
|
182
182
|
return Number.isInteger(e) ? e : e.toFixed(2);
|
|
183
183
|
}
|
|
@@ -186,12 +186,12 @@ function k(e) {
|
|
|
186
186
|
return e.filter((t) => t.text !== 0 && t.text !== "0");
|
|
187
187
|
}
|
|
188
188
|
r(k, "filterZeroValues");
|
|
189
|
-
function
|
|
189
|
+
function pt(e) {
|
|
190
190
|
let t = {
|
|
191
|
-
top:
|
|
192
|
-
bottom:
|
|
193
|
-
left:
|
|
194
|
-
right:
|
|
191
|
+
top: g.window.scrollY,
|
|
192
|
+
bottom: g.window.scrollY + g.window.innerHeight,
|
|
193
|
+
left: g.window.scrollX,
|
|
194
|
+
right: g.window.scrollX + g.window.innerWidth
|
|
195
195
|
}, o = {
|
|
196
196
|
top: Math.abs(t.top - e.top),
|
|
197
197
|
bottom: Math.abs(t.bottom - e.bottom),
|
|
@@ -203,13 +203,13 @@ function dt(e) {
|
|
|
203
203
|
y: o.top > o.bottom ? "top" : "bottom"
|
|
204
204
|
};
|
|
205
205
|
}
|
|
206
|
-
r(
|
|
207
|
-
function
|
|
208
|
-
let t =
|
|
206
|
+
r(pt, "floatingAlignment");
|
|
207
|
+
function dt(e) {
|
|
208
|
+
let t = g.getComputedStyle(e), { top: o, left: i, right: n, bottom: l, width: a, height: s } = e.getBoundingClientRect(), {
|
|
209
209
|
marginTop: f,
|
|
210
210
|
marginBottom: c,
|
|
211
211
|
marginLeft: u,
|
|
212
|
-
marginRight:
|
|
212
|
+
marginRight: p,
|
|
213
213
|
paddingTop: h,
|
|
214
214
|
paddingBottom: S,
|
|
215
215
|
paddingLeft: K,
|
|
@@ -219,23 +219,23 @@ function pt(e) {
|
|
|
219
219
|
borderLeftWidth: tt,
|
|
220
220
|
borderRightWidth: et
|
|
221
221
|
} = t;
|
|
222
|
-
o = o +
|
|
222
|
+
o = o + g.window.scrollY, i = i + g.window.scrollX, l = l + g.window.scrollY, n = n + g.window.scrollX;
|
|
223
223
|
let E = {
|
|
224
|
-
top:
|
|
225
|
-
bottom:
|
|
226
|
-
left:
|
|
227
|
-
right: p
|
|
224
|
+
top: d(f),
|
|
225
|
+
bottom: d(c),
|
|
226
|
+
left: d(u),
|
|
227
|
+
right: d(p)
|
|
228
228
|
}, ot = {
|
|
229
|
-
top:
|
|
230
|
-
bottom:
|
|
231
|
-
left:
|
|
232
|
-
right:
|
|
229
|
+
top: d(h),
|
|
230
|
+
bottom: d(S),
|
|
231
|
+
left: d(K),
|
|
232
|
+
right: d(Z)
|
|
233
233
|
}, nt = {
|
|
234
|
-
top:
|
|
235
|
-
bottom:
|
|
236
|
-
left:
|
|
237
|
-
right:
|
|
238
|
-
},
|
|
234
|
+
top: d(J),
|
|
235
|
+
bottom: d(Q),
|
|
236
|
+
left: d(tt),
|
|
237
|
+
right: d(et)
|
|
238
|
+
}, A = {
|
|
239
239
|
top: o - E.top,
|
|
240
240
|
bottom: l + E.bottom,
|
|
241
241
|
left: i - E.left,
|
|
@@ -251,12 +251,12 @@ function pt(e) {
|
|
|
251
251
|
right: n,
|
|
252
252
|
width: a,
|
|
253
253
|
height: s,
|
|
254
|
-
extremities:
|
|
255
|
-
floatingAlignment:
|
|
254
|
+
extremities: A,
|
|
255
|
+
floatingAlignment: pt(A)
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
|
-
r(
|
|
259
|
-
function
|
|
258
|
+
r(dt, "measureElement");
|
|
259
|
+
function gt(e, { margin: t, width: o, height: i, top: n, left: l, bottom: a, right: s }) {
|
|
260
260
|
let f = i + t.bottom + t.top;
|
|
261
261
|
e.fillStyle = M.margin, e.fillRect(l, n - t.top, o, t.top), e.fillRect(s, n - t.top, t.right, f), e.fillRect(l, a, o, t.bottom), e.fillRect(
|
|
262
262
|
l - t.left, n - t.top, t.left, f);
|
|
@@ -284,8 +284,8 @@ function bt(e, { margin: t, width: o, height: i, top: n, left: l, bottom: a, rig
|
|
|
284
284
|
];
|
|
285
285
|
return k(c);
|
|
286
286
|
}
|
|
287
|
-
r(
|
|
288
|
-
function
|
|
287
|
+
r(gt, "drawMargin");
|
|
288
|
+
function bt(e, { padding: t, border: o, width: i, height: n, top: l, left: a, bottom: s, right: f }) {
|
|
289
289
|
let c = i - o.left - o.right, u = n - t.top - t.bottom - o.top - o.bottom;
|
|
290
290
|
e.fillStyle = M.padding, e.fillRect(a + o.left, l + o.top, c, t.top), e.fillRect(
|
|
291
291
|
f - t.right - o.right,
|
|
@@ -298,7 +298,7 @@ function gt(e, { padding: t, border: o, width: i, height: n, top: l, left: a, bo
|
|
|
298
298
|
c,
|
|
299
299
|
t.bottom
|
|
300
300
|
), e.fillRect(a + o.left, l + t.top + o.top, t.left, u);
|
|
301
|
-
let
|
|
301
|
+
let p = [
|
|
302
302
|
{
|
|
303
303
|
type: "padding",
|
|
304
304
|
text: t.top,
|
|
@@ -320,9 +320,9 @@ function gt(e, { padding: t, border: o, width: i, height: n, top: l, left: a, bo
|
|
|
320
320
|
position: "left"
|
|
321
321
|
}
|
|
322
322
|
];
|
|
323
|
-
return k(
|
|
323
|
+
return k(p);
|
|
324
324
|
}
|
|
325
|
-
r(
|
|
325
|
+
r(bt, "drawPadding");
|
|
326
326
|
function wt(e, { border: t, width: o, height: i, top: n, left: l, bottom: a, right: s }) {
|
|
327
327
|
let f = i - t.top - t.bottom;
|
|
328
328
|
e.fillStyle = M.border, e.fillRect(l, n, o, t.top), e.fillRect(l, a - t.bottom, o, t.bottom), e.fillRect(l, n + t.top, t.left, f), e.fillRect(
|
|
@@ -371,7 +371,7 @@ r(Lt, "drawContent");
|
|
|
371
371
|
function Et(e) {
|
|
372
372
|
return (t) => {
|
|
373
373
|
if (e && t) {
|
|
374
|
-
let o =
|
|
374
|
+
let o = dt(e), i = gt(t, o), n = bt(t, o), l = wt(t, o), a = Lt(t, o), s = o.width <= I * 3 || o.height <= I;
|
|
375
375
|
O(
|
|
376
376
|
t,
|
|
377
377
|
o,
|
|
@@ -438,7 +438,7 @@ resize", n), U(x.x, x.y)), () => {
|
|
|
438
438
|
|
|
439
439
|
// src/measure/preview.ts
|
|
440
440
|
var Ct = globalThis.FEATURES?.measure ? [V] : [], vt = {
|
|
441
|
-
[
|
|
441
|
+
[P]: !1
|
|
442
442
|
}, te = /* @__PURE__ */ r(() => St({
|
|
443
443
|
decorators: Ct,
|
|
444
444
|
initialGlobals: vt
|