storybook 9.0.8 → 9.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/bin/index.cjs +54 -61
- package/dist/bin/index.js +45 -52
- package/dist/cli/bin/index.cjs +572 -572
- package/dist/cli/bin/index.js +582 -582
- package/dist/common/index.cjs +677 -684
- package/dist/common/index.d.ts +0 -7
- package/dist/common/index.js +680 -687
- package/dist/core-server/presets/common-manager.js +2545 -2507
- package/dist/csf/index.d.ts +3 -1
- package/dist/instrumenter/index.cjs +958 -934
- package/dist/instrumenter/index.d.ts +1 -0
- package/dist/instrumenter/index.js +933 -908
- package/dist/manager/globals-runtime.js +8514 -8489
- package/dist/manager-api/index.cjs +1 -1
- package/dist/manager-api/index.js +1 -1
- package/dist/preview/runtime.js +7488 -7459
- package/dist/preview-api/index.cjs +4438 -2648
- package/dist/preview-api/index.js +4231 -2435
- package/dist/telemetry/index.cjs +521 -521
- package/dist/telemetry/index.js +526 -526
- package/package.json +1 -185
- package/dist/actions/preview.cjs +0 -159
- package/dist/actions/preview.d.ts +0 -555
- package/dist/actions/preview.js +0 -149
- package/dist/backgrounds/index.cjs +0 -148
- package/dist/backgrounds/index.d.ts +0 -592
- package/dist/backgrounds/index.js +0 -130
- package/dist/backgrounds/preview.cjs +0 -143
- package/dist/backgrounds/preview.d.ts +0 -555
- package/dist/backgrounds/preview.js +0 -127
- package/dist/component-testing/index.cjs +0 -23
- package/dist/component-testing/index.d.ts +0 -3
- package/dist/component-testing/index.js +0 -5
- package/dist/component-testing/preview.cjs +0 -40
- package/dist/component-testing/preview.d.ts +0 -5
- package/dist/component-testing/preview.js +0 -25
- package/dist/controls/preview.cjs +0 -26
- package/dist/controls/preview.d.ts +0 -555
- package/dist/controls/preview.js +0 -9
- package/dist/highlight/preview.cjs +0 -590
- package/dist/highlight/preview.d.ts +0 -555
- package/dist/highlight/preview.js +0 -574
- package/dist/measure/index.cjs +0 -476
- package/dist/measure/index.d.ts +0 -567
- package/dist/measure/index.js +0 -464
- package/dist/measure/preview.cjs +0 -466
- package/dist/measure/preview.d.ts +0 -560
- package/dist/measure/preview.js +0 -450
- package/dist/outline/index.cjs +0 -528
- package/dist/outline/index.d.ts +0 -567
- package/dist/outline/index.js +0 -500
- package/dist/outline/preview.cjs +0 -518
- package/dist/outline/preview.d.ts +0 -560
- package/dist/outline/preview.js +0 -486
- package/dist/test/preview.cjs +0 -73
- package/dist/test/preview.d.ts +0 -555
- package/dist/test/preview.js +0 -66
- package/dist/viewport/preview.cjs +0 -35
- package/dist/viewport/preview.d.ts +0 -569
- package/dist/viewport/preview.js +0 -19
|
@@ -1,590 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var R = Object.defineProperty;
|
|
3
|
-
var me = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var he = Object.getOwnPropertyNames;
|
|
5
|
-
var ge = Object.prototype.hasOwnProperty;
|
|
6
|
-
var d = (t, e) => R(t, "name", { value: e, configurable: !0 });
|
|
7
|
-
var fe = (t, e) => {
|
|
8
|
-
for (var l in e)
|
|
9
|
-
R(t, l, { get: e[l], enumerable: !0 });
|
|
10
|
-
}, ye = (t, e, l, c) => {
|
|
11
|
-
if (e && typeof e == "object" || typeof e == "function")
|
|
12
|
-
for (let r of he(e))
|
|
13
|
-
!ge.call(t, r) && r !== l && R(t, r, { get: () => e[r], enumerable: !(c = me(e, r)) || c.enumerable });
|
|
14
|
-
return t;
|
|
15
|
-
};
|
|
16
|
-
var be = (t) => ye(R({}, "__esModule", { value: !0 }), t);
|
|
17
|
-
|
|
18
|
-
// src/highlight/preview.ts
|
|
19
|
-
var He = {};
|
|
20
|
-
fe(He, {
|
|
21
|
-
default: () => ve
|
|
22
|
-
});
|
|
23
|
-
module.exports = be(He);
|
|
24
|
-
var B = require("storybook/preview-api");
|
|
25
|
-
|
|
26
|
-
// src/highlight/useHighlights.ts
|
|
27
|
-
var ce = require("storybook/internal/core-events");
|
|
28
|
-
|
|
29
|
-
// src/highlight/constants.ts
|
|
30
|
-
var D = "storybook/highlight", J = `${D}/add`, Q = `${D}/remove`, ee = `${D}/reset`, te = `${D}/scroll-into-view`, z = 2147483647, L = 28;
|
|
31
|
-
|
|
32
|
-
// src/highlight/icons.ts
|
|
33
|
-
var P = {
|
|
34
|
-
chevronLeft: [
|
|
35
|
-
"M9.10355 10.1464C9.29882 10.3417 9.29882 10.6583 9.10355 10.8536C8.90829 11.0488 8.59171 11.0488 8.39645 10.8536L4.89645 7.35355C4.7011\
|
|
36
|
-
8 7.15829 4.70118 6.84171 4.89645 6.64645L8.39645 3.14645C8.59171 2.95118 8.90829 2.95118 9.10355 3.14645C9.29882 3.34171 9.29882 3.65829 9.\
|
|
37
|
-
10355 3.85355L5.95711 7L9.10355 10.1464Z"
|
|
38
|
-
],
|
|
39
|
-
chevronRight: [
|
|
40
|
-
"M4.89645 10.1464C4.70118 10.3417 4.70118 10.6583 4.89645 10.8536C5.09171 11.0488 5.40829 11.0488 5.60355 10.8536L9.10355 7.35355C9.2988\
|
|
41
|
-
2 7.15829 9.29882 6.84171 9.10355 6.64645L5.60355 3.14645C5.40829 2.95118 5.09171 2.95118 4.89645 3.14645C4.70118 3.34171 4.70118 3.65829 4.\
|
|
42
|
-
89645 3.85355L8.04289 7L4.89645 10.1464Z"
|
|
43
|
-
],
|
|
44
|
-
info: [
|
|
45
|
-
"M7 5.5a.5.5 0 01.5.5v4a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zM7 4.5A.75.75 0 107 3a.75.75 0 000 1.5z",
|
|
46
|
-
"M7 14A7 7 0 107 0a7 7 0 000 14zm0-1A6 6 0 107 1a6 6 0 000 12z"
|
|
47
|
-
],
|
|
48
|
-
shareAlt: [
|
|
49
|
-
"M2 1.004a1 1 0 00-1 1v10a1 1 0 001 1h10a1 1 0 001-1v-4.5a.5.5 0 00-1 0v4.5H2v-10h4.5a.5.5 0 000-1H2z",
|
|
50
|
-
"M7.354 7.357L12 2.711v1.793a.5.5 0 001 0v-3a.5.5 0 00-.5-.5h-3a.5.5 0 100 1h1.793L6.646 6.65a.5.5 0 10.708.707z"
|
|
51
|
-
]
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// src/highlight/utils.ts
|
|
55
|
-
var xe = "svg,path,rect,circle,line,polyline,polygon,ellipse,text".split(","), b = /* @__PURE__ */ d((t, e = {}, l) => {
|
|
56
|
-
let c = xe.includes(t) ? document.createElementNS("http://www.w3.org/2000/svg", t) : document.createElement(t);
|
|
57
|
-
return Object.entries(e).forEach(([r, p]) => {
|
|
58
|
-
/[A-Z]/.test(r) ? (r === "onClick" && (c.addEventListener("click", p), c.addEventListener("keydown", (u) => {
|
|
59
|
-
(u.key === "Enter" || u.key === " ") && (u.preventDefault(), p());
|
|
60
|
-
})), r === "onMouseEnter" && c.addEventListener("mouseenter", p), r === "onMouseLeave" && c.addEventListener("mouseleave", p)) : c.setAttribute(
|
|
61
|
-
r, p);
|
|
62
|
-
}), l?.forEach((r) => {
|
|
63
|
-
if (!(r == null || r === !1))
|
|
64
|
-
try {
|
|
65
|
-
c.appendChild(r);
|
|
66
|
-
} catch {
|
|
67
|
-
c.appendChild(document.createTextNode(String(r)));
|
|
68
|
-
}
|
|
69
|
-
}), c;
|
|
70
|
-
}, "createElement"), k = /* @__PURE__ */ d((t) => P[t] && b(
|
|
71
|
-
"svg",
|
|
72
|
-
{ width: "14", height: "14", viewBox: "0 0 14 14", xmlns: "http://www.w3.org/2000/svg" },
|
|
73
|
-
P[t].map(
|
|
74
|
-
(e) => b("path", {
|
|
75
|
-
fill: "currentColor",
|
|
76
|
-
"fill-rule": "evenodd",
|
|
77
|
-
"clip-rule": "evenodd",
|
|
78
|
-
d: e
|
|
79
|
-
})
|
|
80
|
-
)
|
|
81
|
-
), "createIcon"), oe = /* @__PURE__ */ d((t) => {
|
|
82
|
-
if ("elements" in t) {
|
|
83
|
-
let { elements: c, color: r, style: p } = t;
|
|
84
|
-
return {
|
|
85
|
-
id: void 0,
|
|
86
|
-
priority: 0,
|
|
87
|
-
selectors: c,
|
|
88
|
-
styles: {
|
|
89
|
-
outline: `2px ${p} ${r}`,
|
|
90
|
-
outlineOffset: "2px",
|
|
91
|
-
boxShadow: "0 0 0 6px rgba(255,255,255,0.6)"
|
|
92
|
-
},
|
|
93
|
-
menu: void 0
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
let { menu: e, ...l } = t;
|
|
97
|
-
return {
|
|
98
|
-
id: void 0,
|
|
99
|
-
priority: 0,
|
|
100
|
-
styles: {
|
|
101
|
-
outline: "2px dashed #029cfd"
|
|
102
|
-
},
|
|
103
|
-
...l,
|
|
104
|
-
menu: Array.isArray(e) ? e.every(Array.isArray) ? e : [e] : void 0
|
|
105
|
-
};
|
|
106
|
-
}, "normalizeOptions"), Ee = /* @__PURE__ */ d((t) => t instanceof Function, "isFunction"), S = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(),
|
|
107
|
-
N = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ d((t) => {
|
|
108
|
-
let e = Symbol();
|
|
109
|
-
return C.set(e, []), S.set(e, t), { get: /* @__PURE__ */ d(() => S.get(e), "get"), set: /* @__PURE__ */ d((u) => {
|
|
110
|
-
let m = S.get(e), f = Ee(u) ? u(m) : u;
|
|
111
|
-
f !== m && (S.set(e, f), C.get(e)?.forEach((E) => {
|
|
112
|
-
N.get(E)?.(), N.set(E, E(f));
|
|
113
|
-
}));
|
|
114
|
-
}, "set"), subscribe: /* @__PURE__ */ d((u) => (C.get(e)?.push(u), () => {
|
|
115
|
-
let m = C.get(e);
|
|
116
|
-
m && C.set(
|
|
117
|
-
e,
|
|
118
|
-
m.filter((f) => f !== u)
|
|
119
|
-
);
|
|
120
|
-
}), "subscribe"), teardown: /* @__PURE__ */ d(() => {
|
|
121
|
-
C.get(e)?.forEach((u) => {
|
|
122
|
-
N.get(u)?.(), N.delete(u);
|
|
123
|
-
}), C.delete(e), S.delete(e);
|
|
124
|
-
}, "teardown") };
|
|
125
|
-
}, "useStore"), X = /* @__PURE__ */ d((t) => {
|
|
126
|
-
let e = document.getElementById("storybook-root"), l = /* @__PURE__ */ new Map();
|
|
127
|
-
for (let c of t) {
|
|
128
|
-
let { priority: r = 0 } = c;
|
|
129
|
-
for (let p of c.selectors) {
|
|
130
|
-
let u = [
|
|
131
|
-
...document.querySelectorAll(
|
|
132
|
-
// Elements matching the selector, excluding storybook elements and their descendants.
|
|
133
|
-
// Necessary to find portaled elements (e.g. children of `body`).
|
|
134
|
-
`:is(${p}):not([id^="storybook-"], [id^="storybook-"] *, [class^="sb-"], [class^="sb-"] *)`
|
|
135
|
-
),
|
|
136
|
-
// Elements matching the selector inside the storybook root, as these were excluded above.
|
|
137
|
-
...e?.querySelectorAll(p) || []
|
|
138
|
-
];
|
|
139
|
-
for (let m of u) {
|
|
140
|
-
let f = l.get(m);
|
|
141
|
-
(!f || f.priority <= r) && l.set(m, {
|
|
142
|
-
...c,
|
|
143
|
-
priority: r,
|
|
144
|
-
selectors: Array.from(new Set((f?.selectors || []).concat(p)))
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return l;
|
|
150
|
-
}, "mapElements"), ne = /* @__PURE__ */ d((t) => Array.from(t.entries()).map(([e, { selectors: l, styles: c, hoverStyles: r, focusStyles: p,
|
|
151
|
-
menu: u }]) => {
|
|
152
|
-
let { top: m, left: f, width: E, height: w } = e.getBoundingClientRect(), { position: v } = getComputedStyle(e);
|
|
153
|
-
return {
|
|
154
|
-
element: e,
|
|
155
|
-
selectors: l,
|
|
156
|
-
styles: c,
|
|
157
|
-
hoverStyles: r,
|
|
158
|
-
focusStyles: p,
|
|
159
|
-
menu: u,
|
|
160
|
-
top: v === "fixed" ? m : m + window.scrollY,
|
|
161
|
-
left: v === "fixed" ? f : f + window.scrollX,
|
|
162
|
-
width: E,
|
|
163
|
-
height: w
|
|
164
|
-
};
|
|
165
|
-
}).sort((e, l) => l.width * l.height - e.width * e.height), "mapBoxes"), V = /* @__PURE__ */ d((t, e) => {
|
|
166
|
-
let l = t.getBoundingClientRect(), { x: c, y: r } = e;
|
|
167
|
-
return l?.top && l?.left && c >= l.left && c <= l.left + l.width && r >= l.top && r <= l.top + l.height;
|
|
168
|
-
}, "isOverMenu"), Y = /* @__PURE__ */ d((t, e, l) => {
|
|
169
|
-
if (!e || !l)
|
|
170
|
-
return !1;
|
|
171
|
-
let { left: c, top: r, width: p, height: u } = t;
|
|
172
|
-
u < L && (r = r - Math.round((L - u) / 2), u = L), p < L && (c = c - Math.round((L - p) / 2), p = L), e.style.position === "fixed" && (c +=
|
|
173
|
-
window.scrollX, r += window.scrollY);
|
|
174
|
-
let { x: m, y: f } = l;
|
|
175
|
-
return m >= c && m <= c + p && f >= r && f <= r + u;
|
|
176
|
-
}, "isTargeted"), se = /* @__PURE__ */ d((t, e, l = {}) => {
|
|
177
|
-
let { x: c, y: r } = e, { margin: p = 5, topOffset: u = 0, centered: m = !1 } = l, { scrollX: f, scrollY: E, innerHeight: w, innerWidth: v } = window,
|
|
178
|
-
I = Math.min(
|
|
179
|
-
t.style.position === "fixed" ? r - E : r,
|
|
180
|
-
w - t.clientHeight - p - u + E
|
|
181
|
-
), H = m ? t.clientWidth / 2 : 0, A = t.style.position === "fixed" ? Math.max(Math.min(c - f, v - H - p), H + p) : Math.max(
|
|
182
|
-
Math.min(c, v - H - p + f),
|
|
183
|
-
H + p + f
|
|
184
|
-
);
|
|
185
|
-
Object.assign(t.style, {
|
|
186
|
-
...A !== c && { left: `${A}px` },
|
|
187
|
-
...I !== r && { top: `${I}px` }
|
|
188
|
-
});
|
|
189
|
-
}, "keepInViewport"), Z = /* @__PURE__ */ d((t) => {
|
|
190
|
-
window.HTMLElement.prototype.hasOwnProperty("showPopover") && t.showPopover();
|
|
191
|
-
}, "showPopover"), ie = /* @__PURE__ */ d((t) => {
|
|
192
|
-
window.HTMLElement.prototype.hasOwnProperty("showPopover") && t.hidePopover();
|
|
193
|
-
}, "hidePopover"), re = /* @__PURE__ */ d((t) => ({
|
|
194
|
-
top: t.top,
|
|
195
|
-
left: t.left,
|
|
196
|
-
width: t.width,
|
|
197
|
-
height: t.height,
|
|
198
|
-
selectors: t.selectors,
|
|
199
|
-
element: {
|
|
200
|
-
attributes: Object.fromEntries(
|
|
201
|
-
Array.from(t.element.attributes).map((e) => [e.name, e.value])
|
|
202
|
-
),
|
|
203
|
-
localName: t.element.localName,
|
|
204
|
-
tagName: t.element.tagName,
|
|
205
|
-
outerHTML: t.element.outerHTML
|
|
206
|
-
}
|
|
207
|
-
}), "getEventDetails");
|
|
208
|
-
|
|
209
|
-
// src/highlight/useHighlights.ts
|
|
210
|
-
var g = "storybook-highlights-menu", le = "storybook-highlights-root", we = "storybook-root", de = /* @__PURE__ */ d((t) => {
|
|
211
|
-
if (globalThis.__STORYBOOK_HIGHLIGHT_INITIALIZED)
|
|
212
|
-
return;
|
|
213
|
-
globalThis.__STORYBOOK_HIGHLIGHT_INITIALIZED = !0;
|
|
214
|
-
let { document: e } = globalThis, l = T([]), c = T(/* @__PURE__ */ new Map()), r = T([]), p = T(), u = T(), m = T([]), f = T([]), E = T(),
|
|
215
|
-
w = T(), v = e.getElementById(le);
|
|
216
|
-
l.subscribe(() => {
|
|
217
|
-
v || (v = b("div", { id: le }), e.body.appendChild(v));
|
|
218
|
-
}), l.subscribe((s) => {
|
|
219
|
-
let o = e.getElementById(we);
|
|
220
|
-
if (!o)
|
|
221
|
-
return;
|
|
222
|
-
c.set(X(s));
|
|
223
|
-
let n = new MutationObserver(() => c.set(X(s)));
|
|
224
|
-
return n.observe(o, { subtree: !0, childList: !0 }), () => {
|
|
225
|
-
n.disconnect();
|
|
226
|
-
};
|
|
227
|
-
}), c.subscribe((s) => {
|
|
228
|
-
let o = /* @__PURE__ */ d(() => requestAnimationFrame(() => r.set(ne(s))), "updateBoxes"), n = new ResizeObserver(o);
|
|
229
|
-
n.observe(e.body), Array.from(s.keys()).forEach((i) => n.observe(i));
|
|
230
|
-
let a = Array.from(e.body.querySelectorAll("*")).filter((i) => {
|
|
231
|
-
let { overflow: h, overflowX: x, overflowY: y } = window.getComputedStyle(i);
|
|
232
|
-
return ["auto", "scroll"].some((M) => [h, x, y].includes(M));
|
|
233
|
-
});
|
|
234
|
-
return a.forEach((i) => i.addEventListener("scroll", o)), () => {
|
|
235
|
-
n.disconnect(), a.forEach((i) => i.removeEventListener("scroll", o));
|
|
236
|
-
};
|
|
237
|
-
}), c.subscribe((s) => {
|
|
238
|
-
let o = Array.from(s.keys()).filter(({ style: a }) => a.position === "sticky"), n = /* @__PURE__ */ d(() => requestAnimationFrame(() => {
|
|
239
|
-
r.set(
|
|
240
|
-
(a) => a.map((i) => {
|
|
241
|
-
if (o.includes(i.element)) {
|
|
242
|
-
let { top: h, left: x } = i.element.getBoundingClientRect();
|
|
243
|
-
return { ...i, top: h + window.scrollY, left: x + window.scrollX };
|
|
244
|
-
}
|
|
245
|
-
return i;
|
|
246
|
-
})
|
|
247
|
-
);
|
|
248
|
-
}), "updateBoxes");
|
|
249
|
-
return e.addEventListener("scroll", n), () => e.removeEventListener("scroll", n);
|
|
250
|
-
}), c.subscribe((s) => {
|
|
251
|
-
m.set((o) => o.filter(({ element: n }) => s.has(n)));
|
|
252
|
-
}), m.subscribe((s) => {
|
|
253
|
-
s.length ? (w.set((o) => s.some((n) => n.element === o?.element) ? o : void 0), E.set((o) => s.some((n) => n.element === o?.element) ? o :
|
|
254
|
-
void 0)) : (w.set(void 0), E.set(void 0), p.set(void 0));
|
|
255
|
-
});
|
|
256
|
-
let I = new Map(/* @__PURE__ */ new Map());
|
|
257
|
-
l.subscribe((s) => {
|
|
258
|
-
s.forEach(({ keyframes: o }) => {
|
|
259
|
-
if (o) {
|
|
260
|
-
let n = I.get(o);
|
|
261
|
-
n || (n = e.createElement("style"), n.setAttribute("data-highlight", "keyframes"), I.set(o, n), e.head.appendChild(n)), n.innerHTML =
|
|
262
|
-
o;
|
|
263
|
-
}
|
|
264
|
-
}), I.forEach((o, n) => {
|
|
265
|
-
s.some((a) => a.keyframes === n) || (o.remove(), I.delete(n));
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
let H = new Map(/* @__PURE__ */ new Map());
|
|
269
|
-
r.subscribe((s) => {
|
|
270
|
-
s.forEach((o) => {
|
|
271
|
-
let n = H.get(o.element);
|
|
272
|
-
if (v && !n) {
|
|
273
|
-
let a = {
|
|
274
|
-
popover: "manual",
|
|
275
|
-
"data-highlight-dimensions": `w${o.width.toFixed(0)}h${o.height.toFixed(0)}`,
|
|
276
|
-
"data-highlight-coordinates": `x${o.left.toFixed(0)}y${o.top.toFixed(0)}`
|
|
277
|
-
};
|
|
278
|
-
n = v.appendChild(
|
|
279
|
-
b("div", a, [b("div")])
|
|
280
|
-
), H.set(o.element, n);
|
|
281
|
-
}
|
|
282
|
-
}), H.forEach((o, n) => {
|
|
283
|
-
s.some(({ element: a }) => a === n) || (o.remove(), H.delete(n));
|
|
284
|
-
});
|
|
285
|
-
}), r.subscribe((s) => {
|
|
286
|
-
let o = s.filter((a) => a.menu);
|
|
287
|
-
if (!o.length)
|
|
288
|
-
return;
|
|
289
|
-
let n = /* @__PURE__ */ d((a) => {
|
|
290
|
-
requestAnimationFrame(() => {
|
|
291
|
-
let i = e.getElementById(g), h = { x: a.pageX, y: a.pageY };
|
|
292
|
-
if (i && !V(i, h)) {
|
|
293
|
-
let x = o.filter((y) => {
|
|
294
|
-
let M = H.get(y.element);
|
|
295
|
-
return Y(y, M, h);
|
|
296
|
-
});
|
|
297
|
-
p.set(x.length ? h : void 0), m.set(x);
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
}, "onClick");
|
|
301
|
-
return e.addEventListener("click", n), () => e.removeEventListener("click", n);
|
|
302
|
-
});
|
|
303
|
-
let A = /* @__PURE__ */ d(() => {
|
|
304
|
-
let s = e.getElementById(g), o = u.get();
|
|
305
|
-
!o || s && V(s, o) || f.set((n) => {
|
|
306
|
-
let a = r.get().filter((y) => {
|
|
307
|
-
let M = H.get(y.element);
|
|
308
|
-
return Y(y, M, o);
|
|
309
|
-
}), i = n.filter((y) => a.includes(y)), h = a.filter((y) => !n.includes(y)), x = n.length - i.length;
|
|
310
|
-
return h.length || x ? [...i, ...h] : n;
|
|
311
|
-
});
|
|
312
|
-
}, "updateHovered");
|
|
313
|
-
u.subscribe(A), r.subscribe(A);
|
|
314
|
-
let $ = /* @__PURE__ */ d(() => {
|
|
315
|
-
let s = w.get(), o = s ? [s] : m.get(), n = o.length === 1 ? o[0] : E.get(), a = p.get() !== void 0;
|
|
316
|
-
r.get().forEach((i) => {
|
|
317
|
-
let h = H.get(i.element);
|
|
318
|
-
if (h) {
|
|
319
|
-
let x = n === i, y = a ? n ? x : o.includes(i) : f.get()?.includes(i);
|
|
320
|
-
Object.assign(h.style, {
|
|
321
|
-
animation: "none",
|
|
322
|
-
background: "transparent",
|
|
323
|
-
border: "none",
|
|
324
|
-
boxSizing: "border-box",
|
|
325
|
-
outline: "none",
|
|
326
|
-
outlineOffset: "0px",
|
|
327
|
-
...i.styles,
|
|
328
|
-
...y ? i.hoverStyles : {},
|
|
329
|
-
...x ? i.focusStyles : {},
|
|
330
|
-
position: getComputedStyle(i.element).position === "fixed" ? "fixed" : "absolute",
|
|
331
|
-
zIndex: z - 10,
|
|
332
|
-
top: `${i.top}px`,
|
|
333
|
-
left: `${i.left}px`,
|
|
334
|
-
width: `${i.width}px`,
|
|
335
|
-
height: `${i.height}px`,
|
|
336
|
-
margin: 0,
|
|
337
|
-
padding: 0,
|
|
338
|
-
cursor: i.menu && y ? "pointer" : "default",
|
|
339
|
-
pointerEvents: i.menu ? "auto" : "none",
|
|
340
|
-
display: "flex",
|
|
341
|
-
alignItems: "center",
|
|
342
|
-
justifyContent: "center",
|
|
343
|
-
overflow: "visible"
|
|
344
|
-
}), Object.assign(h.children[0].style, {
|
|
345
|
-
width: "100%",
|
|
346
|
-
height: "100%",
|
|
347
|
-
minHeight: `${L}px`,
|
|
348
|
-
minWidth: `${L}px`,
|
|
349
|
-
boxSizing: "content-box",
|
|
350
|
-
padding: h.style.outlineWidth || "0px"
|
|
351
|
-
}), Z(h);
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
}, "updateBoxStyles");
|
|
355
|
-
r.subscribe($), m.subscribe($), f.subscribe($), E.subscribe($), w.subscribe($);
|
|
356
|
-
let j = /* @__PURE__ */ d(() => {
|
|
357
|
-
if (!v)
|
|
358
|
-
return;
|
|
359
|
-
let s = e.getElementById(g);
|
|
360
|
-
if (s)
|
|
361
|
-
s.innerHTML = "";
|
|
362
|
-
else {
|
|
363
|
-
let i = { id: g, popover: "manual" };
|
|
364
|
-
s = v.appendChild(b("div", i)), v.appendChild(
|
|
365
|
-
b("style", {}, [
|
|
366
|
-
`
|
|
367
|
-
#${g} {
|
|
368
|
-
position: absolute;
|
|
369
|
-
z-index: ${z};
|
|
370
|
-
width: 300px;
|
|
371
|
-
padding: 0px;
|
|
372
|
-
margin: 15px 0 0 0;
|
|
373
|
-
transform: translateX(-50%);
|
|
374
|
-
font-family: "Nunito Sans", -apple-system, ".SFNSText-Regular", "San Francisco", BlinkMacSystemFont, "Segoe UI", "Helvetica Ne\
|
|
375
|
-
ue", Helvetica, Arial, sans-serif;
|
|
376
|
-
font-size: 12px;
|
|
377
|
-
background: white;
|
|
378
|
-
border: none;
|
|
379
|
-
border-radius: 6px;
|
|
380
|
-
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.05), 0 5px 15px 0 rgba(0, 0, 0, 0.1);
|
|
381
|
-
color: #2E3438;
|
|
382
|
-
}
|
|
383
|
-
#${g} ul {
|
|
384
|
-
list-style: none;
|
|
385
|
-
margin: 0;
|
|
386
|
-
padding: 0;
|
|
387
|
-
}
|
|
388
|
-
#${g} > ul {
|
|
389
|
-
max-height: 300px;
|
|
390
|
-
overflow-y: auto;
|
|
391
|
-
padding: 4px 0;
|
|
392
|
-
}
|
|
393
|
-
#${g} li {
|
|
394
|
-
padding: 0 4px;
|
|
395
|
-
margin: 0;
|
|
396
|
-
}
|
|
397
|
-
#${g} li > :not(ul) {
|
|
398
|
-
display: flex;
|
|
399
|
-
padding: 8px;
|
|
400
|
-
margin: 0;
|
|
401
|
-
align-items: center;
|
|
402
|
-
gap: 8px;
|
|
403
|
-
border-radius: 4px;
|
|
404
|
-
}
|
|
405
|
-
#${g} button {
|
|
406
|
-
width: 100%;
|
|
407
|
-
border: 0;
|
|
408
|
-
background: transparent;
|
|
409
|
-
color: inherit;
|
|
410
|
-
text-align: left;
|
|
411
|
-
font-family: inherit;
|
|
412
|
-
font-size: inherit;
|
|
413
|
-
}
|
|
414
|
-
#${g} button:focus-visible {
|
|
415
|
-
outline-color: #029CFD;
|
|
416
|
-
}
|
|
417
|
-
#${g} button:hover {
|
|
418
|
-
background: rgba(2, 156, 253, 0.07);
|
|
419
|
-
color: #029CFD;
|
|
420
|
-
cursor: pointer;
|
|
421
|
-
}
|
|
422
|
-
#${g} li code {
|
|
423
|
-
white-space: nowrap;
|
|
424
|
-
overflow: hidden;
|
|
425
|
-
text-overflow: ellipsis;
|
|
426
|
-
line-height: 16px;
|
|
427
|
-
font-size: 11px;
|
|
428
|
-
}
|
|
429
|
-
#${g} li svg {
|
|
430
|
-
flex-shrink: 0;
|
|
431
|
-
margin: 1px;
|
|
432
|
-
color: #73828C;
|
|
433
|
-
}
|
|
434
|
-
#${g} li > button:hover svg, #${g} li > button:focus-visible svg {
|
|
435
|
-
color: #029CFD;
|
|
436
|
-
}
|
|
437
|
-
#${g} .element-list li svg {
|
|
438
|
-
display: none;
|
|
439
|
-
}
|
|
440
|
-
#${g} li.selectable svg, #${g} li.selected svg {
|
|
441
|
-
display: block;
|
|
442
|
-
}
|
|
443
|
-
#${g} .menu-list {
|
|
444
|
-
border-top: 1px solid rgba(38, 85, 115, 0.15);
|
|
445
|
-
}
|
|
446
|
-
#${g} .menu-list > li:not(:last-child) {
|
|
447
|
-
padding-bottom: 4px;
|
|
448
|
-
margin-bottom: 4px;
|
|
449
|
-
border-bottom: 1px solid rgba(38, 85, 115, 0.15);
|
|
450
|
-
}
|
|
451
|
-
#${g} .menu-items, #${g} .menu-items li {
|
|
452
|
-
padding: 0;
|
|
453
|
-
}
|
|
454
|
-
#${g} .menu-item {
|
|
455
|
-
display: flex;
|
|
456
|
-
}
|
|
457
|
-
#${g} .menu-item-content {
|
|
458
|
-
display: flex;
|
|
459
|
-
flex-direction: column;
|
|
460
|
-
flex-grow: 1;
|
|
461
|
-
}
|
|
462
|
-
`
|
|
463
|
-
])
|
|
464
|
-
);
|
|
465
|
-
}
|
|
466
|
-
let o = w.get(), n = o ? [o] : m.get();
|
|
467
|
-
if (n.length && (s.style.position = getComputedStyle(n[0].element).position === "fixed" ? "fixed" : "absolute", s.appendChild(
|
|
468
|
-
b(
|
|
469
|
-
"ul",
|
|
470
|
-
{ class: "element-list" },
|
|
471
|
-
n.map((i) => {
|
|
472
|
-
let h = n.length > 1 && !!i.menu?.some(
|
|
473
|
-
(M) => M.some(
|
|
474
|
-
(O) => !O.selectors || O.selectors.some((_) => i.selectors.includes(_))
|
|
475
|
-
)
|
|
476
|
-
), x = h ? {
|
|
477
|
-
class: "selectable",
|
|
478
|
-
onClick: /* @__PURE__ */ d(() => w.set(i), "onClick"),
|
|
479
|
-
onMouseEnter: /* @__PURE__ */ d(() => E.set(i), "onMouseEnter"),
|
|
480
|
-
onMouseLeave: /* @__PURE__ */ d(() => E.set(void 0), "onMouseLeave")
|
|
481
|
-
} : o ? { class: "selected", onClick: /* @__PURE__ */ d(() => w.set(void 0), "onClick") } : {}, y = h || o;
|
|
482
|
-
return b("li", x, [
|
|
483
|
-
b(y ? "button" : "div", y ? { type: "button" } : {}, [
|
|
484
|
-
o ? k("chevronLeft") : null,
|
|
485
|
-
b("code", {}, [i.element.outerHTML]),
|
|
486
|
-
h ? k("chevronRight") : null
|
|
487
|
-
])
|
|
488
|
-
]);
|
|
489
|
-
})
|
|
490
|
-
)
|
|
491
|
-
)), w.get() || m.get().length === 1) {
|
|
492
|
-
let i = w.get() || m.get()[0], h = i.menu?.filter(
|
|
493
|
-
(x) => x.some(
|
|
494
|
-
(y) => !y.selectors || y.selectors.some((M) => i.selectors.includes(M))
|
|
495
|
-
)
|
|
496
|
-
);
|
|
497
|
-
h?.length && s.appendChild(
|
|
498
|
-
b(
|
|
499
|
-
"ul",
|
|
500
|
-
{ class: "menu-list" },
|
|
501
|
-
h.map(
|
|
502
|
-
(x) => b("li", {}, [
|
|
503
|
-
b(
|
|
504
|
-
"ul",
|
|
505
|
-
{ class: "menu-items" },
|
|
506
|
-
x.map(
|
|
507
|
-
({ id: y, title: M, description: O, iconLeft: _, iconRight: U, clickEvent: K }) => {
|
|
508
|
-
let G = K && (() => t.emit(K, y, re(i)));
|
|
509
|
-
return b("li", {}, [
|
|
510
|
-
b(
|
|
511
|
-
G ? "button" : "div",
|
|
512
|
-
G ? { class: "menu-item", type: "button", onClick: G } : { class: "menu-item" },
|
|
513
|
-
[
|
|
514
|
-
_ ? k(_) : null,
|
|
515
|
-
b("div", { class: "menu-item-content" }, [
|
|
516
|
-
b(O ? "strong" : "span", {}, [M]),
|
|
517
|
-
O && b("span", {}, [O])
|
|
518
|
-
]),
|
|
519
|
-
U ? k(U) : null
|
|
520
|
-
]
|
|
521
|
-
)
|
|
522
|
-
]);
|
|
523
|
-
}
|
|
524
|
-
)
|
|
525
|
-
)
|
|
526
|
-
])
|
|
527
|
-
)
|
|
528
|
-
)
|
|
529
|
-
);
|
|
530
|
-
}
|
|
531
|
-
let a = p.get();
|
|
532
|
-
a ? (Object.assign(s.style, {
|
|
533
|
-
display: "block",
|
|
534
|
-
left: `${s.style.position === "fixed" ? a.x - window.scrollX : a.x}px`,
|
|
535
|
-
top: `${s.style.position === "fixed" ? a.y - window.scrollY : a.y}px`
|
|
536
|
-
}), Z(s), requestAnimationFrame(() => se(s, a, { topOffset: 15, centered: !0 }))) : (ie(s), Object.assign(s.style, { display: "none" }));
|
|
537
|
-
}, "renderMenu");
|
|
538
|
-
m.subscribe(j), w.subscribe(j);
|
|
539
|
-
let ae = /* @__PURE__ */ d((s) => {
|
|
540
|
-
let o = oe(s);
|
|
541
|
-
l.set((n) => {
|
|
542
|
-
let a = o.id ? n.filter((i) => i.id !== o.id) : n;
|
|
543
|
-
return o.selectors?.length ? [...a, o] : a;
|
|
544
|
-
});
|
|
545
|
-
}, "addHighlight"), F = /* @__PURE__ */ d((s) => {
|
|
546
|
-
s && l.set((o) => o.filter((n) => n.id !== s));
|
|
547
|
-
}, "removeHighlight"), q = /* @__PURE__ */ d(() => {
|
|
548
|
-
l.set([]), c.set(/* @__PURE__ */ new Map()), r.set([]), p.set(void 0), u.set(void 0), m.set([]), f.set([]), E.set(void 0), w.set(void 0);
|
|
549
|
-
}, "resetState"), W, pe = /* @__PURE__ */ d((s, o) => {
|
|
550
|
-
let n = "scrollIntoView-highlight";
|
|
551
|
-
clearTimeout(W), F(n);
|
|
552
|
-
let a = e.querySelector(s);
|
|
553
|
-
if (!a) {
|
|
554
|
-
console.warn(`Cannot scroll into view: ${s} not found`);
|
|
555
|
-
return;
|
|
556
|
-
}
|
|
557
|
-
a.scrollIntoView({ behavior: "smooth", block: "center", ...o });
|
|
558
|
-
let i = `kf-${Math.random().toString(36).substring(2, 15)}`;
|
|
559
|
-
l.set((h) => [
|
|
560
|
-
...h,
|
|
561
|
-
{
|
|
562
|
-
id: n,
|
|
563
|
-
priority: 1e3,
|
|
564
|
-
selectors: [s],
|
|
565
|
-
styles: {
|
|
566
|
-
outline: "2px solid #1EA7FD",
|
|
567
|
-
outlineOffset: "-1px",
|
|
568
|
-
animation: `${i} 3s linear forwards`
|
|
569
|
-
},
|
|
570
|
-
keyframes: `@keyframes ${i} {
|
|
571
|
-
0% { outline: 2px solid #1EA7FD; }
|
|
572
|
-
20% { outline: 2px solid #1EA7FD00; }
|
|
573
|
-
40% { outline: 2px solid #1EA7FD; }
|
|
574
|
-
60% { outline: 2px solid #1EA7FD00; }
|
|
575
|
-
80% { outline: 2px solid #1EA7FD; }
|
|
576
|
-
100% { outline: 2px solid #1EA7FD00; }
|
|
577
|
-
}`
|
|
578
|
-
}
|
|
579
|
-
]), W = setTimeout(() => F(n), 3500);
|
|
580
|
-
}, "scrollIntoView"), ue = /* @__PURE__ */ d((s) => {
|
|
581
|
-
requestAnimationFrame(() => u.set({ x: s.pageX, y: s.pageY }));
|
|
582
|
-
}, "onMouseMove");
|
|
583
|
-
e.body.addEventListener("mousemove", ue), t.on(J, ae), t.on(Q, F), t.on(ee, q), t.on(te, pe), t.on(ce.STORY_RENDER_PHASE_CHANGED, ({ newPhase: s }) => {
|
|
584
|
-
s === "loading" && q();
|
|
585
|
-
});
|
|
586
|
-
}, "useHighlights");
|
|
587
|
-
|
|
588
|
-
// src/highlight/preview.ts
|
|
589
|
-
globalThis?.FEATURES?.highlight && B.addons?.ready && B.addons.ready().then(de);
|
|
590
|
-
var ve = /* @__PURE__ */ d(() => (0, B.definePreview)({}), "default");
|