pixelagent 0.1.12 → 0.1.14
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/PixelAgent.d.ts.map +1 -1
- package/dist/edit/EditPanel.d.ts +1 -1
- package/dist/edit/EditPanel.d.ts.map +1 -1
- package/dist/edit/useEditPreview.d.ts +1 -1
- package/dist/edit/useEditPreview.d.ts.map +1 -1
- package/dist/pixelagent.js +704 -693
- package/dist/pixelagent.js.map +1 -1
- package/package.json +3 -3
package/dist/pixelagent.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsxs as d, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { getElementDisplayLabel as
|
|
1
|
+
import { jsxs as d, Fragment as G, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as A, useEffect as H, useRef as W, useMemo as we, useLayoutEffect as Wt, useCallback as L, useId as Yt } from "react";
|
|
3
|
+
import { getElementDisplayLabel as Ue, captureTextSnapshot as Ze, captureInlineStyles as Qe, restoreInlineStyles as ye, restoreTextSnapshot as Ne, getPreviewTargets as Ee, clearTailwindStatePreview as ke, applyTailwindStatePreview as Fe, setEditableTextPreview as et, getRelevantComputedStyles as Ce, getEditableTextInfo as ue, readReactSource as We, detectStylingSystem as bt, countElementInstances as yt, getScopeSelector as wt, getCssSelector as xt, copyToClipboard as Nt, getWindowSelectionText as kt, getNearestReactComponentName as Xt, getDomPath as Gt, resolveElementFromEntry as Ct, getAnnotationSessionDisplay as Kt, loadAnnotationSession as jt, saveAnnotationSession as qt, DEFAULT_PIXEL_AGENT_UI_SETTINGS as Jt, readHostThemeFromDocument as tt, resolvePixelAgentChrome as Zt, applyHostThemeToDocument as Qt, pixelAgentRootAttributes as en, getElementsInArea as tn, formatAllAnnotations as nn, formatAnnotation as rn } from "@pixelagent/shared";
|
|
4
4
|
export * from "@pixelagent/shared";
|
|
5
|
-
import { createPortal as
|
|
6
|
-
function
|
|
5
|
+
import { createPortal as Ye } from "react-dom";
|
|
6
|
+
function Mt({
|
|
7
7
|
element: e,
|
|
8
8
|
selected: t,
|
|
9
9
|
multiSelected: i = [],
|
|
10
10
|
primarySelected: r = null
|
|
11
11
|
}) {
|
|
12
|
-
const [a, o] =
|
|
13
|
-
if (
|
|
12
|
+
const [a, o] = A([]), s = r ?? t;
|
|
13
|
+
if (H(() => {
|
|
14
14
|
const l = /* @__PURE__ */ new Map(), p = i.length > 0;
|
|
15
15
|
e && !t && !p && l.set(e, !1), t && l.set(t, !0);
|
|
16
16
|
for (const g of i)
|
|
@@ -19,28 +19,28 @@ function Ct({
|
|
|
19
19
|
o([]);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
const
|
|
22
|
+
const f = () => {
|
|
23
23
|
o(
|
|
24
|
-
Array.from(l.entries()).map(([g,
|
|
24
|
+
Array.from(l.entries()).map(([g, m]) => ({
|
|
25
25
|
rect: g.getBoundingClientRect(),
|
|
26
|
-
label:
|
|
27
|
-
isSelected:
|
|
26
|
+
label: Ue(g),
|
|
27
|
+
isSelected: m,
|
|
28
28
|
isPrimary: s !== null && g === s
|
|
29
29
|
}))
|
|
30
30
|
);
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
f();
|
|
33
33
|
const v = Array.from(l.keys()).map((g) => {
|
|
34
|
-
const
|
|
35
|
-
return
|
|
34
|
+
const m = new ResizeObserver(f);
|
|
35
|
+
return m.observe(g), m;
|
|
36
36
|
});
|
|
37
|
-
return window.addEventListener("scroll",
|
|
37
|
+
return window.addEventListener("scroll", f, !0), window.addEventListener("resize", f), () => {
|
|
38
38
|
for (const g of v) g.disconnect();
|
|
39
|
-
window.removeEventListener("scroll",
|
|
39
|
+
window.removeEventListener("scroll", f, !0), window.removeEventListener("resize", f);
|
|
40
40
|
};
|
|
41
41
|
}, [e, t, i, s]), a.length === 0) return null;
|
|
42
42
|
const u = a.find((l) => l.isPrimary) ?? a.find((l) => l.isSelected) ?? a[0], c = a.filter((l) => l.isSelected).length;
|
|
43
|
-
return /* @__PURE__ */ d(
|
|
43
|
+
return /* @__PURE__ */ d(G, { children: [
|
|
44
44
|
a.map((l, p) => /* @__PURE__ */ n(
|
|
45
45
|
"div",
|
|
46
46
|
{
|
|
@@ -72,21 +72,21 @@ function Ct({
|
|
|
72
72
|
)
|
|
73
73
|
] });
|
|
74
74
|
}
|
|
75
|
-
const At = 0.35,
|
|
76
|
-
function
|
|
75
|
+
const At = 0.35, an = 0.48;
|
|
76
|
+
function on(e, t, i, r = At) {
|
|
77
77
|
if (e < 8 || t < 8) return null;
|
|
78
78
|
const a = 1, o = Math.max(1, Math.round(e * a)), s = Math.max(1, Math.round(t * a)), u = document.createElement("canvas");
|
|
79
79
|
u.width = o, u.height = s;
|
|
80
80
|
const c = u.getContext("2d");
|
|
81
81
|
if (!c) return null;
|
|
82
|
-
const l = c.createImageData(o, s), p = l.data,
|
|
82
|
+
const l = c.createImageData(o, s), p = l.data, f = Math.min(0.5, i / Math.min(e, t)), v = 0.3, g = 0.2, m = Math.max(0.4, f + 0.1);
|
|
83
83
|
let y = 0;
|
|
84
84
|
const E = new Float32Array(o * s * 2);
|
|
85
85
|
let x = 0;
|
|
86
86
|
for (let N = 0; N < s; N++)
|
|
87
87
|
for (let T = 0; T < o; T++) {
|
|
88
|
-
const P = T / o - 0.5,
|
|
89
|
-
Math.abs(h) > y && (y = Math.abs(h)), Math.abs(
|
|
88
|
+
const P = T / o - 0.5, $ = N / s - 0.5, k = sn(P, $, v, g, m), I = nt(0.8, 0, k - 0.15), C = nt(0, 1, I), h = (P * C + 0.5) * o - T, B = ($ * C + 0.5) * s - N;
|
|
89
|
+
Math.abs(h) > y && (y = Math.abs(h)), Math.abs(B) > y && (y = Math.abs(B)), E[x++] = h, E[x++] = B;
|
|
90
90
|
}
|
|
91
91
|
if (y === 0) return null;
|
|
92
92
|
y *= 0.4 * r;
|
|
@@ -102,33 +102,33 @@ function an(e, t, i, r = At) {
|
|
|
102
102
|
height: s
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function sn(e, t, i, r, a) {
|
|
106
106
|
const o = Math.abs(e) - i + a, s = Math.abs(t) - r + a;
|
|
107
107
|
return Math.min(Math.max(o, s), 0) + Math.hypot(Math.max(o, 0), Math.max(s, 0)) - a;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function nt(e, t, i) {
|
|
110
110
|
const r = Math.max(0, Math.min(1, (i - e) / (t - e)));
|
|
111
111
|
return r * r * (3 - 2 * r);
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function _e() {
|
|
114
114
|
if (typeof navigator > "u") return !1;
|
|
115
115
|
const e = navigator.userAgent;
|
|
116
116
|
return !(/AppleWebKit/i.test(e) && !/Chrome|Chromium|Edg|OPR|CriOS|FxiOS/i.test(e) || /Firefox/i.test(e));
|
|
117
117
|
}
|
|
118
|
-
const
|
|
118
|
+
const ln = {
|
|
119
119
|
default: "blur(4px) saturate(130%)",
|
|
120
120
|
/** Toolbar — slightly stronger frost + refraction chain. */
|
|
121
121
|
enhanced: "blur(6px) saturate(138%)"
|
|
122
122
|
};
|
|
123
|
-
function
|
|
124
|
-
const i =
|
|
123
|
+
function cn(e, t = "default") {
|
|
124
|
+
const i = ln[t], a = e !== null && _e() ? `${i} url(#${e})` : i;
|
|
125
125
|
return {
|
|
126
126
|
backdropFilter: a,
|
|
127
127
|
WebkitBackdropFilter: a
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
let
|
|
131
|
-
function
|
|
130
|
+
let dn = 0;
|
|
131
|
+
function St({
|
|
132
132
|
shape: e = "rect",
|
|
133
133
|
cornerRadius: t,
|
|
134
134
|
tint: i = "neutral",
|
|
@@ -137,26 +137,26 @@ function Mt({
|
|
|
137
137
|
style: o,
|
|
138
138
|
children: s
|
|
139
139
|
}) {
|
|
140
|
-
const u = t ?? (e === "capsule" ? 9999 : 20), c = r === "enhanced" ?
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
if (!
|
|
140
|
+
const u = t ?? (e === "capsule" ? 9999 : 20), c = r === "enhanced" ? an : At, l = W(null), p = we(() => `pa-lg-${++dn}`, []), [f, v] = A(null);
|
|
141
|
+
Wt(() => {
|
|
142
|
+
const m = l.current;
|
|
143
|
+
if (!m) return;
|
|
144
144
|
let y = 0;
|
|
145
145
|
const E = () => {
|
|
146
146
|
cancelAnimationFrame(y), y = requestAnimationFrame(() => {
|
|
147
|
-
const w =
|
|
147
|
+
const w = m.getBoundingClientRect(), N = Math.round(w.width), T = Math.round(w.height);
|
|
148
148
|
if (N < 8 || T < 8) return;
|
|
149
|
-
const P = e === "capsule" ? T / 2 : Math.min(u, N / 2, T / 2),
|
|
150
|
-
|
|
149
|
+
const P = e === "capsule" ? T / 2 : Math.min(u, N / 2, T / 2), $ = on(N, T, P, c);
|
|
150
|
+
$ && v($);
|
|
151
151
|
});
|
|
152
152
|
};
|
|
153
153
|
E();
|
|
154
154
|
const x = new ResizeObserver(E);
|
|
155
|
-
return x.observe(
|
|
155
|
+
return x.observe(m), () => {
|
|
156
156
|
cancelAnimationFrame(y), x.disconnect();
|
|
157
157
|
};
|
|
158
158
|
}, [e, u, c]);
|
|
159
|
-
const g =
|
|
159
|
+
const g = f && _e() && typeof document < "u" ? Ye(
|
|
160
160
|
/* @__PURE__ */ n(
|
|
161
161
|
"svg",
|
|
162
162
|
{
|
|
@@ -180,16 +180,16 @@ function Mt({
|
|
|
180
180
|
colorInterpolationFilters: "sRGB",
|
|
181
181
|
x: "0",
|
|
182
182
|
y: "0",
|
|
183
|
-
width:
|
|
184
|
-
height:
|
|
183
|
+
width: f.width,
|
|
184
|
+
height: f.height,
|
|
185
185
|
children: [
|
|
186
186
|
/* @__PURE__ */ n(
|
|
187
187
|
"feImage",
|
|
188
188
|
{
|
|
189
|
-
href:
|
|
190
|
-
xlinkHref:
|
|
191
|
-
width:
|
|
192
|
-
height:
|
|
189
|
+
href: f.href,
|
|
190
|
+
xlinkHref: f.href,
|
|
191
|
+
width: f.width,
|
|
192
|
+
height: f.height,
|
|
193
193
|
preserveAspectRatio: "none",
|
|
194
194
|
result: "map"
|
|
195
195
|
}
|
|
@@ -199,7 +199,7 @@ function Mt({
|
|
|
199
199
|
{
|
|
200
200
|
in: "SourceGraphic",
|
|
201
201
|
in2: "map",
|
|
202
|
-
scale:
|
|
202
|
+
scale: f.scale,
|
|
203
203
|
xChannelSelector: "R",
|
|
204
204
|
yChannelSelector: "G"
|
|
205
205
|
}
|
|
@@ -211,7 +211,7 @@ function Mt({
|
|
|
211
211
|
),
|
|
212
212
|
document.body
|
|
213
213
|
) : null;
|
|
214
|
-
return /* @__PURE__ */ d(
|
|
214
|
+
return /* @__PURE__ */ d(G, { children: [
|
|
215
215
|
g,
|
|
216
216
|
/* @__PURE__ */ d(
|
|
217
217
|
"div",
|
|
@@ -220,8 +220,8 @@ function Mt({
|
|
|
220
220
|
className: `pa-glass-surface pa-glass-surface--${e} pa-glass-surface--${i} ${a}`.trim(),
|
|
221
221
|
style: {
|
|
222
222
|
borderRadius: e === "capsule" ? "999px" : `${u}px`,
|
|
223
|
-
...
|
|
224
|
-
|
|
223
|
+
...cn(
|
|
224
|
+
f && _e() ? p : null,
|
|
225
225
|
r
|
|
226
226
|
),
|
|
227
227
|
...o
|
|
@@ -235,7 +235,7 @@ function Mt({
|
|
|
235
235
|
)
|
|
236
236
|
] });
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function V({
|
|
239
239
|
variant: e = "regular",
|
|
240
240
|
className: t = "",
|
|
241
241
|
children: i,
|
|
@@ -251,7 +251,7 @@ function _({
|
|
|
251
251
|
}
|
|
252
252
|
);
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function Te({
|
|
255
255
|
variant: e = "sheet",
|
|
256
256
|
side: t = "left",
|
|
257
257
|
className: i = "",
|
|
@@ -259,7 +259,7 @@ function Ee({
|
|
|
259
259
|
children: a
|
|
260
260
|
}) {
|
|
261
261
|
return /* @__PURE__ */ n(
|
|
262
|
-
|
|
262
|
+
St,
|
|
263
263
|
{
|
|
264
264
|
shape: "rect",
|
|
265
265
|
cornerRadius: e === "popover" ? 16 : 20,
|
|
@@ -269,32 +269,32 @@ function Ee({
|
|
|
269
269
|
}
|
|
270
270
|
);
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function Lt({
|
|
273
273
|
defaultPosition: e = null,
|
|
274
274
|
computeDefaultPosition: t
|
|
275
275
|
} = {}) {
|
|
276
|
-
const [i, r] =
|
|
276
|
+
const [i, r] = A(e), [a, o] = A(!1), s = W(null), u = W(null), c = L(() => {
|
|
277
277
|
if (i !== null) return;
|
|
278
278
|
const g = u.current;
|
|
279
279
|
if (!g) return;
|
|
280
|
-
const
|
|
280
|
+
const m = g.getBoundingClientRect();
|
|
281
281
|
r(
|
|
282
|
-
t ? t(
|
|
283
|
-
x: (window.innerWidth -
|
|
284
|
-
y: window.innerHeight -
|
|
282
|
+
t ? t(m) : {
|
|
283
|
+
x: (window.innerWidth - m.width) / 2,
|
|
284
|
+
y: window.innerHeight - m.height - 24
|
|
285
285
|
}
|
|
286
286
|
);
|
|
287
287
|
}, [i, t]);
|
|
288
|
-
|
|
288
|
+
H(() => {
|
|
289
289
|
c();
|
|
290
|
-
}, [c]),
|
|
290
|
+
}, [c]), H(() => {
|
|
291
291
|
const g = () => {
|
|
292
|
-
r((
|
|
293
|
-
if (!
|
|
292
|
+
r((m) => {
|
|
293
|
+
if (!m || !u.current) return m;
|
|
294
294
|
const y = u.current.getBoundingClientRect();
|
|
295
295
|
return {
|
|
296
|
-
x: Math.min(
|
|
297
|
-
y: Math.min(
|
|
296
|
+
x: Math.min(m.x, window.innerWidth - y.width),
|
|
297
|
+
y: Math.min(m.y, window.innerHeight - y.height)
|
|
298
298
|
};
|
|
299
299
|
});
|
|
300
300
|
};
|
|
@@ -303,11 +303,11 @@ function St({
|
|
|
303
303
|
const l = L(
|
|
304
304
|
(g) => {
|
|
305
305
|
if (g.button !== 0) return;
|
|
306
|
-
const
|
|
307
|
-
if (!
|
|
306
|
+
const m = u.current;
|
|
307
|
+
if (!m) return;
|
|
308
308
|
let y = i;
|
|
309
309
|
if (!y) {
|
|
310
|
-
const E =
|
|
310
|
+
const E = m.getBoundingClientRect();
|
|
311
311
|
y = { x: E.left, y: E.top }, r(y);
|
|
312
312
|
}
|
|
313
313
|
s.current = {
|
|
@@ -321,9 +321,9 @@ function St({
|
|
|
321
321
|
[i]
|
|
322
322
|
), p = L((g) => {
|
|
323
323
|
if (!s.current || s.current.pointerId !== g.pointerId) return;
|
|
324
|
-
const
|
|
324
|
+
const m = u.current, y = (m == null ? void 0 : m.offsetWidth) ?? 320, E = (m == null ? void 0 : m.offsetHeight) ?? 48, x = g.clientX - s.current.startX, w = g.clientY - s.current.startY, N = Math.max(8, Math.min(window.innerWidth - y - 8, s.current.originX + x)), T = Math.max(8, Math.min(window.innerHeight - E - 8, s.current.originY + w));
|
|
325
325
|
r({ x: N, y: T });
|
|
326
|
-
}, []),
|
|
326
|
+
}, []), f = L((g) => {
|
|
327
327
|
if (!(!s.current || s.current.pointerId !== g.pointerId)) {
|
|
328
328
|
s.current = null, o(!1);
|
|
329
329
|
try {
|
|
@@ -347,12 +347,12 @@ function St({
|
|
|
347
347
|
dragHandleProps: {
|
|
348
348
|
onPointerDown: l,
|
|
349
349
|
onPointerMove: p,
|
|
350
|
-
onPointerUp:
|
|
351
|
-
onPointerCancel:
|
|
350
|
+
onPointerUp: f,
|
|
351
|
+
onPointerCancel: f
|
|
352
352
|
}
|
|
353
353
|
};
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function un({ className: e }) {
|
|
356
356
|
return /* @__PURE__ */ d("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
357
357
|
/* @__PURE__ */ n(
|
|
358
358
|
"path",
|
|
@@ -378,7 +378,7 @@ function dn({ className: e }) {
|
|
|
378
378
|
)
|
|
379
379
|
] });
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function pn({ className: e }) {
|
|
382
382
|
return /* @__PURE__ */ d("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
383
383
|
/* @__PURE__ */ n(
|
|
384
384
|
"path",
|
|
@@ -404,8 +404,8 @@ function un({ className: e }) {
|
|
|
404
404
|
)
|
|
405
405
|
] });
|
|
406
406
|
}
|
|
407
|
-
const
|
|
408
|
-
function
|
|
407
|
+
const pe = (e, t, i) => Math.min(i, Math.max(t, e));
|
|
408
|
+
function Xe(e) {
|
|
409
409
|
const t = e.trim();
|
|
410
410
|
if (!t) return null;
|
|
411
411
|
const i = t.match(/^#([0-9a-f]{6})$/i);
|
|
@@ -426,74 +426,74 @@ function We(e) {
|
|
|
426
426
|
}
|
|
427
427
|
const a = t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
|
|
428
428
|
return a ? {
|
|
429
|
-
r:
|
|
430
|
-
g:
|
|
431
|
-
b:
|
|
429
|
+
r: pe(parseInt(a[1], 10), 0, 255),
|
|
430
|
+
g: pe(parseInt(a[2], 10), 0, 255),
|
|
431
|
+
b: pe(parseInt(a[3], 10), 0, 255)
|
|
432
432
|
} : null;
|
|
433
433
|
}
|
|
434
|
-
function
|
|
435
|
-
const t = (i) =>
|
|
434
|
+
function Et(e) {
|
|
435
|
+
const t = (i) => pe(Math.round(i), 0, 255).toString(16).padStart(2, "0");
|
|
436
436
|
return `#${t(e.r)}${t(e.g)}${t(e.b)}`;
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function hn(e) {
|
|
439
439
|
return `rgb(${e.r}, ${e.g}, ${e.b})`;
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function It({ r: e, g: t, b: i }) {
|
|
442
442
|
const r = e / 255, a = t / 255, o = i / 255, s = Math.max(r, a, o), u = Math.min(r, a, o), c = s - u;
|
|
443
443
|
let l = 0;
|
|
444
444
|
c !== 0 && (s === r ? l = (a - o) / c % 6 : s === a ? l = (o - r) / c + 2 : l = (r - a) / c + 4, l *= 60, l < 0 && (l += 360));
|
|
445
|
-
const p = s === 0 ? 0 : c / s * 100,
|
|
446
|
-
return { h: l, s: p, v:
|
|
445
|
+
const p = s === 0 ? 0 : c / s * 100, f = s * 100;
|
|
446
|
+
return { h: l, s: p, v: f };
|
|
447
447
|
}
|
|
448
|
-
function
|
|
449
|
-
const r =
|
|
448
|
+
function Tt({ h: e, s: t, v: i }) {
|
|
449
|
+
const r = pe(t, 0, 100) / 100, a = pe(i, 0, 100) / 100, o = a * r, s = o * (1 - Math.abs(e / 60 % 2 - 1)), u = a - o;
|
|
450
450
|
let c = 0, l = 0, p = 0;
|
|
451
|
-
const
|
|
452
|
-
return
|
|
451
|
+
const f = (e % 360 + 360) % 360;
|
|
452
|
+
return f < 60 ? (c = o, l = s) : f < 120 ? (c = s, l = o) : f < 180 ? (l = o, p = s) : f < 240 ? (l = s, p = o) : f < 300 ? (c = s, p = o) : (c = o, p = s), {
|
|
453
453
|
r: Math.round((c + u) * 255),
|
|
454
454
|
g: Math.round((l + u) * 255),
|
|
455
455
|
b: Math.round((p + u) * 255)
|
|
456
456
|
};
|
|
457
457
|
}
|
|
458
|
-
function
|
|
459
|
-
const t =
|
|
460
|
-
return t ?
|
|
458
|
+
function rt(e) {
|
|
459
|
+
const t = Xe(e);
|
|
460
|
+
return t ? It(t) : { h: 0, s: 0, v: 45 };
|
|
461
461
|
}
|
|
462
|
-
function
|
|
462
|
+
function fn(e) {
|
|
463
463
|
return e.replace(/^#/, "").toUpperCase().slice(0, 6);
|
|
464
464
|
}
|
|
465
465
|
function mn(e, t) {
|
|
466
466
|
const i = e.replace(/[^0-9a-f]/gi, "").slice(0, 6);
|
|
467
|
-
return i.length < 6 ? t :
|
|
467
|
+
return i.length < 6 ? t : Xe(`#${i}`) ?? t;
|
|
468
468
|
}
|
|
469
|
-
function
|
|
470
|
-
return
|
|
469
|
+
function gn(e) {
|
|
470
|
+
return Et(Tt(e));
|
|
471
471
|
}
|
|
472
|
-
function
|
|
473
|
-
const r =
|
|
472
|
+
function vn(e, t, i) {
|
|
473
|
+
const r = it((e - i.left) / i.width), a = it((t - i.top) / i.height);
|
|
474
474
|
return { x: r * 100, y: a * 100 };
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function it(e) {
|
|
477
477
|
return Math.min(1, Math.max(0, e));
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function bn() {
|
|
480
480
|
if (typeof document > "u") return {};
|
|
481
481
|
const e = document.querySelector("[data-pixelagent-root]") ?? document.querySelector("[data-pixelagent-toolbar-portal]"), t = e == null ? void 0 : e.getAttribute("data-pa-chrome");
|
|
482
482
|
return t ? { "data-pa-chrome": t } : {};
|
|
483
483
|
}
|
|
484
|
-
function
|
|
485
|
-
const [r, a] =
|
|
486
|
-
|
|
487
|
-
s(
|
|
484
|
+
function Be({ label: e, value: t, onChange: i }) {
|
|
485
|
+
const [r, a] = A(!1), [o, s] = A(() => rt(t)), u = W(null), c = W(null), l = W(null), p = Yt(), [f, v] = A({ top: 0, left: 0, width: 260 }), g = Tt(o), m = fn(Et(g)), y = Xe(t) ? t : hn(g), E = e.toLowerCase().includes("color") ? e : `${e} color`;
|
|
486
|
+
H(() => {
|
|
487
|
+
s(rt(t));
|
|
488
488
|
}, [t]);
|
|
489
489
|
const x = L(
|
|
490
490
|
(k) => {
|
|
491
|
-
s(k), i(
|
|
491
|
+
s(k), i(gn(k));
|
|
492
492
|
},
|
|
493
493
|
[i]
|
|
494
494
|
), w = L(
|
|
495
495
|
(k) => {
|
|
496
|
-
x(
|
|
496
|
+
x(It(k));
|
|
497
497
|
},
|
|
498
498
|
[x]
|
|
499
499
|
), N = L(() => {
|
|
@@ -502,17 +502,17 @@ function Oe({ label: e, value: t, onChange: i }) {
|
|
|
502
502
|
const I = k.getBoundingClientRect(), C = 260;
|
|
503
503
|
let h = I.left;
|
|
504
504
|
h + C > window.innerWidth - 12 && (h = window.innerWidth - C - 12), h = Math.max(12, h);
|
|
505
|
-
let
|
|
505
|
+
let B = I.bottom + 8;
|
|
506
506
|
const Y = 320;
|
|
507
|
-
|
|
507
|
+
B + Y > window.innerHeight - 12 && (B = Math.max(12, I.top - Y - 8)), v({ top: B, left: h, width: C });
|
|
508
508
|
}, []);
|
|
509
|
-
|
|
509
|
+
H(() => {
|
|
510
510
|
if (!r) return;
|
|
511
511
|
N();
|
|
512
512
|
const k = (C) => {
|
|
513
|
-
var
|
|
513
|
+
var B, Y;
|
|
514
514
|
const h = C.target;
|
|
515
|
-
(
|
|
515
|
+
(B = u.current) != null && B.contains(h) || (Y = c.current) != null && Y.contains(h) || a(!1);
|
|
516
516
|
}, I = (C) => {
|
|
517
517
|
C.key === "Escape" && a(!1);
|
|
518
518
|
};
|
|
@@ -524,21 +524,21 @@ function Oe({ label: e, value: t, onChange: i }) {
|
|
|
524
524
|
var Y;
|
|
525
525
|
const C = (Y = l.current) == null ? void 0 : Y.getBoundingClientRect();
|
|
526
526
|
if (!C) return;
|
|
527
|
-
const { x: h, y:
|
|
528
|
-
x({ ...o, s: h, v: 100 -
|
|
527
|
+
const { x: h, y: B } = vn(k, I, C);
|
|
528
|
+
x({ ...o, s: h, v: 100 - B });
|
|
529
529
|
}, P = (k) => {
|
|
530
530
|
k.preventDefault(), T(k.clientX, k.clientY);
|
|
531
531
|
const I = (h) => T(h.clientX, h.clientY), C = () => {
|
|
532
532
|
window.removeEventListener("mousemove", I), window.removeEventListener("mouseup", C);
|
|
533
533
|
};
|
|
534
534
|
window.addEventListener("mousemove", I), window.addEventListener("mouseup", C);
|
|
535
|
-
},
|
|
535
|
+
}, $ = r ? Ye(
|
|
536
536
|
/* @__PURE__ */ n(
|
|
537
537
|
"div",
|
|
538
538
|
{
|
|
539
539
|
className: "pa-root pa-root--toolbar-portal pa-color-picker-portal",
|
|
540
540
|
"data-pixelagent-picker-portal": !0,
|
|
541
|
-
...
|
|
541
|
+
...bn(),
|
|
542
542
|
children: /* @__PURE__ */ d(
|
|
543
543
|
"div",
|
|
544
544
|
{
|
|
@@ -547,7 +547,7 @@ function Oe({ label: e, value: t, onChange: i }) {
|
|
|
547
547
|
role: "dialog",
|
|
548
548
|
"aria-label": E,
|
|
549
549
|
className: "pa-color-picker",
|
|
550
|
-
style: { top:
|
|
550
|
+
style: { top: f.top, left: f.left, width: f.width },
|
|
551
551
|
children: [
|
|
552
552
|
/* @__PURE__ */ d("header", { className: "pa-color-picker-header", children: [
|
|
553
553
|
/* @__PURE__ */ n(
|
|
@@ -606,7 +606,7 @@ function Oe({ label: e, value: t, onChange: i }) {
|
|
|
606
606
|
{
|
|
607
607
|
className: "pa-input pa-color-picker-input",
|
|
608
608
|
type: "text",
|
|
609
|
-
value:
|
|
609
|
+
value: m,
|
|
610
610
|
spellCheck: !1,
|
|
611
611
|
onChange: (k) => w(mn(k.target.value, g))
|
|
612
612
|
}
|
|
@@ -623,7 +623,7 @@ function Oe({ label: e, value: t, onChange: i }) {
|
|
|
623
623
|
max: 255,
|
|
624
624
|
value: g[k],
|
|
625
625
|
onChange: (I) => {
|
|
626
|
-
const C =
|
|
626
|
+
const C = yn(parseInt(I.target.value, 10));
|
|
627
627
|
w({ ...g, [k]: C });
|
|
628
628
|
}
|
|
629
629
|
}
|
|
@@ -666,14 +666,14 @@ function Oe({ label: e, value: t, onChange: i }) {
|
|
|
666
666
|
]
|
|
667
667
|
}
|
|
668
668
|
),
|
|
669
|
-
|
|
669
|
+
$
|
|
670
670
|
] });
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function yn(e) {
|
|
673
673
|
return Number.isFinite(e) ? Math.min(255, Math.max(0, e)) : 0;
|
|
674
674
|
}
|
|
675
|
-
function
|
|
676
|
-
const [a, o] =
|
|
675
|
+
function le({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
|
|
676
|
+
const [a, o] = A(i);
|
|
677
677
|
return /* @__PURE__ */ d("section", { className: `pa-edit-section ${a ? "pa-edit-section--open" : ""}`, children: [
|
|
678
678
|
/* @__PURE__ */ d(
|
|
679
679
|
"button",
|
|
@@ -692,7 +692,7 @@ function se({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
|
|
|
692
692
|
a ? /* @__PURE__ */ n("div", { className: "pa-edit-section-body", children: t }) : null
|
|
693
693
|
] });
|
|
694
694
|
}
|
|
695
|
-
const
|
|
695
|
+
const ce = [
|
|
696
696
|
{ value: "Inter, system-ui, sans-serif", label: "Inter" },
|
|
697
697
|
{ value: "system-ui, sans-serif", label: "System UI" },
|
|
698
698
|
{
|
|
@@ -705,38 +705,38 @@ const le = [
|
|
|
705
705
|
{ value: "Helvetica, Arial, sans-serif", label: "Helvetica" },
|
|
706
706
|
{ value: '"JetBrains Mono", ui-monospace, monospace', label: "JetBrains Mono" },
|
|
707
707
|
{ value: "ui-monospace, monospace", label: "Monospace" }
|
|
708
|
-
],
|
|
709
|
-
function
|
|
708
|
+
], Ie = "";
|
|
709
|
+
function Me(e) {
|
|
710
710
|
var i;
|
|
711
711
|
return (((i = e.split(",")[0]) == null ? void 0 : i.trim()) ?? "").replace(/^["']|["']$/g, "");
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function wn(e) {
|
|
714
714
|
const t = e.trim();
|
|
715
715
|
if (!t)
|
|
716
716
|
return {
|
|
717
|
-
selectValue:
|
|
718
|
-
options:
|
|
717
|
+
selectValue: Ie,
|
|
718
|
+
options: ce
|
|
719
719
|
};
|
|
720
|
-
const i =
|
|
721
|
-
(o) => o.value === t ||
|
|
720
|
+
const i = Me(t).toLowerCase(), r = ce.find(
|
|
721
|
+
(o) => o.value === t || Me(o.value).toLowerCase() === i
|
|
722
722
|
);
|
|
723
723
|
if (r)
|
|
724
|
-
return { selectValue: r.value, options:
|
|
725
|
-
const a =
|
|
726
|
-
const s =
|
|
724
|
+
return { selectValue: r.value, options: ce };
|
|
725
|
+
const a = ce.find((o) => {
|
|
726
|
+
const s = Me(o.value).toLowerCase();
|
|
727
727
|
return t.toLowerCase().includes(s) || s.includes(i);
|
|
728
728
|
});
|
|
729
|
-
return a ? { selectValue: a.value, options:
|
|
729
|
+
return a ? { selectValue: a.value, options: ce } : {
|
|
730
730
|
selectValue: t,
|
|
731
731
|
options: [
|
|
732
|
-
...
|
|
733
|
-
{ value: t, label:
|
|
732
|
+
...ce,
|
|
733
|
+
{ value: t, label: Me(t) || "Custom" }
|
|
734
734
|
]
|
|
735
735
|
};
|
|
736
736
|
}
|
|
737
|
-
function
|
|
738
|
-
const { selectValue: i, options: r } =
|
|
739
|
-
() =>
|
|
737
|
+
function xn({ value: e, onChange: t }) {
|
|
738
|
+
const { selectValue: i, options: r } = we(
|
|
739
|
+
() => wn(e),
|
|
740
740
|
[e]
|
|
741
741
|
);
|
|
742
742
|
return /* @__PURE__ */ d("label", { className: "pa-edit-stack-field", children: [
|
|
@@ -745,24 +745,24 @@ function wn({ value: e, onChange: t }) {
|
|
|
745
745
|
"select",
|
|
746
746
|
{
|
|
747
747
|
className: "pa-select pa-font-family-select",
|
|
748
|
-
value: i ||
|
|
748
|
+
value: i || Ie,
|
|
749
749
|
onChange: (a) => {
|
|
750
750
|
const o = a.target.value;
|
|
751
|
-
o && o !==
|
|
751
|
+
o && o !== Ie && t(o);
|
|
752
752
|
},
|
|
753
753
|
children: [
|
|
754
|
-
/* @__PURE__ */ n("option", { value:
|
|
754
|
+
/* @__PURE__ */ n("option", { value: Ie, disabled: !0, children: "Select font style" }),
|
|
755
755
|
r.map((a) => /* @__PURE__ */ n("option", { value: a.value, children: a.label }, a.value))
|
|
756
756
|
]
|
|
757
757
|
}
|
|
758
758
|
)
|
|
759
759
|
] });
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function Ge(e) {
|
|
762
762
|
const t = e.trim().match(/^(-?\d+(?:\.\d+)?)px$/i);
|
|
763
763
|
return t ? parseFloat(t[1]) : null;
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function Nn(e) {
|
|
766
766
|
const t = e.trim();
|
|
767
767
|
if (!t) return null;
|
|
768
768
|
if (t.endsWith("%")) {
|
|
@@ -772,21 +772,21 @@ function xn(e) {
|
|
|
772
772
|
const i = parseFloat(t);
|
|
773
773
|
return Number.isFinite(i) && i >= 0 && i <= 1 ? i : null;
|
|
774
774
|
}
|
|
775
|
-
function
|
|
776
|
-
const t =
|
|
775
|
+
function kn(e) {
|
|
776
|
+
const t = Pt(e);
|
|
777
777
|
if (t !== null) return t > 0;
|
|
778
|
-
const i =
|
|
778
|
+
const i = Ge(e);
|
|
779
779
|
return i !== null && i > 0;
|
|
780
780
|
}
|
|
781
|
-
function
|
|
781
|
+
function Pt(e) {
|
|
782
782
|
const t = e.trim().split(/\s+/).filter(Boolean);
|
|
783
783
|
if (t.length === 0) return null;
|
|
784
|
-
const i = t.map((a) =>
|
|
784
|
+
const i = t.map((a) => Ge(a));
|
|
785
785
|
if (i.some((a) => a === null)) return null;
|
|
786
786
|
const r = i[0];
|
|
787
787
|
return i.every((a) => a === r) ? r : null;
|
|
788
788
|
}
|
|
789
|
-
const
|
|
789
|
+
const Cn = {
|
|
790
790
|
padding: { kind: "uniform-px", min: 0, max: 80, step: 1 },
|
|
791
791
|
margin: { kind: "uniform-px", min: 0, max: 80, step: 1 },
|
|
792
792
|
width: { kind: "text" },
|
|
@@ -800,14 +800,14 @@ const kn = {
|
|
|
800
800
|
"border-radius": { kind: "px", min: 0, max: 48, step: 1 },
|
|
801
801
|
opacity: { kind: "opacity", min: 0, max: 1, step: 0.01 }
|
|
802
802
|
};
|
|
803
|
-
function
|
|
803
|
+
function Mn(e, t, i) {
|
|
804
804
|
switch (i.kind) {
|
|
805
805
|
case "opacity":
|
|
806
|
-
return
|
|
806
|
+
return Nn(t);
|
|
807
807
|
case "px":
|
|
808
|
-
return
|
|
808
|
+
return Ge(t);
|
|
809
809
|
case "uniform-px":
|
|
810
|
-
return
|
|
810
|
+
return Pt(t);
|
|
811
811
|
default:
|
|
812
812
|
return null;
|
|
813
813
|
}
|
|
@@ -823,14 +823,14 @@ function An(e, t, i) {
|
|
|
823
823
|
return String(t);
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
|
-
function
|
|
826
|
+
function re({
|
|
827
827
|
property: e,
|
|
828
828
|
label: t,
|
|
829
829
|
value: i,
|
|
830
830
|
onChange: r,
|
|
831
831
|
compact: a = !1
|
|
832
832
|
}) {
|
|
833
|
-
const o =
|
|
833
|
+
const o = Cn[e] ?? { kind: "text" }, s = Mn(e, i, o), u = o.kind !== "text" && s !== null, c = a ? "pa-prop-row pa-prop-row--compact" : "pa-prop-row", l = a ? "pa-edit-field-label" : "pa-prop-label";
|
|
834
834
|
if (!u)
|
|
835
835
|
return /* @__PURE__ */ d("label", { className: c, children: [
|
|
836
836
|
/* @__PURE__ */ n("span", { className: l, children: t }),
|
|
@@ -840,12 +840,12 @@ function ne({
|
|
|
840
840
|
className: "pa-input",
|
|
841
841
|
type: "text",
|
|
842
842
|
value: i,
|
|
843
|
-
onChange: (
|
|
843
|
+
onChange: (m) => r(m.target.value)
|
|
844
844
|
}
|
|
845
845
|
)
|
|
846
846
|
] });
|
|
847
|
-
const p = o.min ?? 0,
|
|
848
|
-
r(An(e,
|
|
847
|
+
const p = o.min ?? 0, f = o.max ?? 100, v = o.step ?? 1, g = (m) => {
|
|
848
|
+
r(An(e, m, o));
|
|
849
849
|
};
|
|
850
850
|
return /* @__PURE__ */ d("label", { className: `${c} pa-prop-row--slider`, children: [
|
|
851
851
|
/* @__PURE__ */ n("span", { className: l, children: t }),
|
|
@@ -856,11 +856,11 @@ function ne({
|
|
|
856
856
|
type: "range",
|
|
857
857
|
className: "pa-slider",
|
|
858
858
|
min: p,
|
|
859
|
-
max:
|
|
859
|
+
max: f,
|
|
860
860
|
step: v,
|
|
861
861
|
value: s,
|
|
862
862
|
"aria-valuetext": i,
|
|
863
|
-
onChange: (
|
|
863
|
+
onChange: (m) => g(parseFloat(m.target.value))
|
|
864
864
|
}
|
|
865
865
|
),
|
|
866
866
|
/* @__PURE__ */ n(
|
|
@@ -869,14 +869,14 @@ function ne({
|
|
|
869
869
|
className: "pa-input pa-prop-slider-value",
|
|
870
870
|
type: "text",
|
|
871
871
|
value: i,
|
|
872
|
-
onChange: (
|
|
872
|
+
onChange: (m) => r(m.target.value),
|
|
873
873
|
"aria-label": `${t} value`
|
|
874
874
|
}
|
|
875
875
|
)
|
|
876
876
|
] })
|
|
877
877
|
] });
|
|
878
878
|
}
|
|
879
|
-
function
|
|
879
|
+
function Sn(e) {
|
|
880
880
|
const t = e.trim().split(/\s+/).filter(Boolean), i = t[0] ?? "0px";
|
|
881
881
|
if (t.length <= 1) return { top: i, right: i, bottom: i, left: i };
|
|
882
882
|
const r = t[1];
|
|
@@ -884,63 +884,63 @@ function Mn(e) {
|
|
|
884
884
|
const a = t[2];
|
|
885
885
|
return t.length === 3 ? { top: i, right: r, bottom: a, left: r } : { top: i, right: r, bottom: a, left: t[3] };
|
|
886
886
|
}
|
|
887
|
-
function
|
|
887
|
+
function Ln({ top: e, right: t, bottom: i, left: r }) {
|
|
888
888
|
return e === t && t === i && i === r ? e : e === i && t === r ? `${e} ${t}` : t === r ? `${e} ${t} ${i}` : `${e} ${t} ${i} ${r}`;
|
|
889
889
|
}
|
|
890
|
-
function
|
|
890
|
+
function oe(e) {
|
|
891
891
|
const t = e.trim().match(/^(-?\d+(?:\.\d+)?)px$/i);
|
|
892
892
|
return t ? t[1] : e;
|
|
893
893
|
}
|
|
894
|
-
function
|
|
894
|
+
function se(e) {
|
|
895
895
|
const t = e.trim();
|
|
896
896
|
return t === "" ? "0px" : /^-?\d+(?:\.\d+)?$/.test(t) ? `${t}px` : t;
|
|
897
897
|
}
|
|
898
|
-
function it(e, t) {
|
|
899
|
-
return e === t ? ae(e) : `${ae(e)}, ${ae(t)}`;
|
|
900
|
-
}
|
|
901
898
|
function at(e, t) {
|
|
899
|
+
return e === t ? oe(e) : `${oe(e)}, ${oe(t)}`;
|
|
900
|
+
}
|
|
901
|
+
function ot(e, t) {
|
|
902
902
|
const i = e.split(",").map((r) => r.trim()).filter(Boolean);
|
|
903
903
|
if (i.length === 0) return [t, t];
|
|
904
904
|
if (i.length === 1) {
|
|
905
|
-
const r =
|
|
905
|
+
const r = se(i[0]);
|
|
906
906
|
return [r, r];
|
|
907
907
|
}
|
|
908
|
-
return [
|
|
908
|
+
return [se(i[0]), se(i[1])];
|
|
909
909
|
}
|
|
910
|
-
const
|
|
911
|
-
width:
|
|
912
|
-
height:
|
|
910
|
+
const st = 12, Ke = {
|
|
911
|
+
width: st,
|
|
912
|
+
height: st,
|
|
913
913
|
viewBox: "0 0 12 12",
|
|
914
914
|
fill: "none",
|
|
915
915
|
"aria-hidden": !0
|
|
916
916
|
};
|
|
917
|
-
function
|
|
918
|
-
return /* @__PURE__ */ d("svg", { ...
|
|
917
|
+
function En() {
|
|
918
|
+
return /* @__PURE__ */ d("svg", { ...Ke, children: [
|
|
919
919
|
/* @__PURE__ */ n("rect", { x: "1.5", y: "1.5", width: "9", height: "9", stroke: "currentColor", strokeOpacity: "0.35" }),
|
|
920
920
|
/* @__PURE__ */ n("line", { x1: "1.5", y1: "1.5", x2: "1.5", y2: "10.5", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
921
921
|
/* @__PURE__ */ n("line", { x1: "10.5", y1: "1.5", x2: "10.5", y2: "10.5", stroke: "currentColor", strokeWidth: "1.5" })
|
|
922
922
|
] });
|
|
923
923
|
}
|
|
924
|
-
function
|
|
925
|
-
return /* @__PURE__ */ d("svg", { ...
|
|
924
|
+
function In() {
|
|
925
|
+
return /* @__PURE__ */ d("svg", { ...Ke, children: [
|
|
926
926
|
/* @__PURE__ */ n("rect", { x: "1.5", y: "1.5", width: "9", height: "9", stroke: "currentColor", strokeOpacity: "0.35" }),
|
|
927
927
|
/* @__PURE__ */ n("line", { x1: "1.5", y1: "1.5", x2: "10.5", y2: "1.5", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
928
928
|
/* @__PURE__ */ n("line", { x1: "1.5", y1: "10.5", x2: "10.5", y2: "10.5", stroke: "currentColor", strokeWidth: "1.5" })
|
|
929
929
|
] });
|
|
930
930
|
}
|
|
931
|
-
function
|
|
931
|
+
function Ae({ side: e }) {
|
|
932
932
|
const t = {
|
|
933
933
|
top: { x1: 1.5, y1: 1.5, x2: 10.5, y2: 1.5 },
|
|
934
934
|
right: { x1: 10.5, y1: 1.5, x2: 10.5, y2: 10.5 },
|
|
935
935
|
bottom: { x1: 1.5, y1: 10.5, x2: 10.5, y2: 10.5 },
|
|
936
936
|
left: { x1: 1.5, y1: 1.5, x2: 1.5, y2: 10.5 }
|
|
937
937
|
}[e];
|
|
938
|
-
return /* @__PURE__ */ d("svg", { ...
|
|
938
|
+
return /* @__PURE__ */ d("svg", { ...Ke, children: [
|
|
939
939
|
/* @__PURE__ */ n("rect", { x: "1.5", y: "1.5", width: "9", height: "9", stroke: "currentColor", strokeOpacity: "0.35" }),
|
|
940
940
|
/* @__PURE__ */ n("line", { ...t, stroke: "currentColor", strokeWidth: "1.5" })
|
|
941
941
|
] });
|
|
942
942
|
}
|
|
943
|
-
function
|
|
943
|
+
function Tn() {
|
|
944
944
|
return /* @__PURE__ */ d("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
|
|
945
945
|
/* @__PURE__ */ n("rect", { x: "2", y: "2", width: "4", height: "4", stroke: "currentColor", strokeWidth: "1.2" }),
|
|
946
946
|
/* @__PURE__ */ n("rect", { x: "8", y: "2", width: "4", height: "4", stroke: "currentColor", strokeWidth: "1.2" }),
|
|
@@ -948,9 +948,9 @@ function In() {
|
|
|
948
948
|
/* @__PURE__ */ n("rect", { x: "8", y: "8", width: "4", height: "4", stroke: "currentColor", strokeWidth: "1.2" })
|
|
949
949
|
] });
|
|
950
950
|
}
|
|
951
|
-
function
|
|
952
|
-
const [o, s] =
|
|
953
|
-
return
|
|
951
|
+
function de({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
|
|
952
|
+
const [o, s] = A(t);
|
|
953
|
+
return H(() => {
|
|
954
954
|
s(t);
|
|
955
955
|
}, [t]), /* @__PURE__ */ d("label", { className: `pa-spacing-cell ${r ? "pa-spacing-cell--mixed" : ""}`, children: [
|
|
956
956
|
/* @__PURE__ */ n("span", { className: "pa-spacing-cell-icon", children: e }),
|
|
@@ -971,9 +971,9 @@ function ce({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
|
|
|
971
971
|
)
|
|
972
972
|
] });
|
|
973
973
|
}
|
|
974
|
-
function
|
|
975
|
-
const r =
|
|
976
|
-
i(
|
|
974
|
+
function lt({ label: e, value: t, onChange: i }) {
|
|
975
|
+
const r = Sn(t), [a, o] = A(!1), s = (l) => {
|
|
976
|
+
i(Ln({ ...r, ...l }));
|
|
977
977
|
}, u = r.left !== r.right, c = r.top !== r.bottom;
|
|
978
978
|
return /* @__PURE__ */ d("div", { className: "pa-prop-row pa-prop-row--compact pa-spacing-row", children: [
|
|
979
979
|
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: e }),
|
|
@@ -988,66 +988,66 @@ function st({ label: e, value: t, onChange: i }) {
|
|
|
988
988
|
// Col 2 (vertical pair) → T on top, B on bottom
|
|
989
989
|
/* @__PURE__ */ d("div", { className: "pa-spacing-grid", children: [
|
|
990
990
|
/* @__PURE__ */ n(
|
|
991
|
-
|
|
991
|
+
de,
|
|
992
992
|
{
|
|
993
|
-
icon: /* @__PURE__ */ n(
|
|
994
|
-
display:
|
|
993
|
+
icon: /* @__PURE__ */ n(Ae, { side: "left" }),
|
|
994
|
+
display: oe(r.left),
|
|
995
995
|
ariaLabel: `${e} left`,
|
|
996
|
-
onCommit: (l) => s({ left:
|
|
996
|
+
onCommit: (l) => s({ left: se(l) })
|
|
997
997
|
}
|
|
998
998
|
),
|
|
999
999
|
/* @__PURE__ */ n(
|
|
1000
|
-
|
|
1000
|
+
de,
|
|
1001
1001
|
{
|
|
1002
|
-
icon: /* @__PURE__ */ n(
|
|
1003
|
-
display:
|
|
1002
|
+
icon: /* @__PURE__ */ n(Ae, { side: "top" }),
|
|
1003
|
+
display: oe(r.top),
|
|
1004
1004
|
ariaLabel: `${e} top`,
|
|
1005
|
-
onCommit: (l) => s({ top:
|
|
1005
|
+
onCommit: (l) => s({ top: se(l) })
|
|
1006
1006
|
}
|
|
1007
1007
|
),
|
|
1008
1008
|
/* @__PURE__ */ n(
|
|
1009
|
-
|
|
1009
|
+
de,
|
|
1010
1010
|
{
|
|
1011
|
-
icon: /* @__PURE__ */ n(
|
|
1012
|
-
display:
|
|
1011
|
+
icon: /* @__PURE__ */ n(Ae, { side: "right" }),
|
|
1012
|
+
display: oe(r.right),
|
|
1013
1013
|
ariaLabel: `${e} right`,
|
|
1014
|
-
onCommit: (l) => s({ right:
|
|
1014
|
+
onCommit: (l) => s({ right: se(l) })
|
|
1015
1015
|
}
|
|
1016
1016
|
),
|
|
1017
1017
|
/* @__PURE__ */ n(
|
|
1018
|
-
|
|
1018
|
+
de,
|
|
1019
1019
|
{
|
|
1020
|
-
icon: /* @__PURE__ */ n(
|
|
1021
|
-
display:
|
|
1020
|
+
icon: /* @__PURE__ */ n(Ae, { side: "bottom" }),
|
|
1021
|
+
display: oe(r.bottom),
|
|
1022
1022
|
ariaLabel: `${e} bottom`,
|
|
1023
|
-
onCommit: (l) => s({ bottom:
|
|
1023
|
+
onCommit: (l) => s({ bottom: se(l) })
|
|
1024
1024
|
}
|
|
1025
1025
|
)
|
|
1026
1026
|
] })
|
|
1027
1027
|
) : /* @__PURE__ */ d("div", { className: "pa-spacing-pair", children: [
|
|
1028
1028
|
/* @__PURE__ */ n(
|
|
1029
|
-
|
|
1029
|
+
de,
|
|
1030
1030
|
{
|
|
1031
|
-
icon: /* @__PURE__ */ n(
|
|
1032
|
-
display:
|
|
1031
|
+
icon: /* @__PURE__ */ n(En, {}),
|
|
1032
|
+
display: at(r.left, r.right),
|
|
1033
1033
|
mixed: u,
|
|
1034
1034
|
ariaLabel: `${e} horizontal`,
|
|
1035
1035
|
onCommit: (l) => {
|
|
1036
|
-
const [p,
|
|
1037
|
-
s({ left: p, right:
|
|
1036
|
+
const [p, f] = ot(l, r.left);
|
|
1037
|
+
s({ left: p, right: f });
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
1040
|
),
|
|
1041
1041
|
/* @__PURE__ */ n(
|
|
1042
|
-
|
|
1042
|
+
de,
|
|
1043
1043
|
{
|
|
1044
|
-
icon: /* @__PURE__ */ n(
|
|
1045
|
-
display:
|
|
1044
|
+
icon: /* @__PURE__ */ n(In, {}),
|
|
1045
|
+
display: at(r.top, r.bottom),
|
|
1046
1046
|
mixed: c,
|
|
1047
1047
|
ariaLabel: `${e} vertical`,
|
|
1048
1048
|
onCommit: (l) => {
|
|
1049
|
-
const [p,
|
|
1050
|
-
s({ top: p, bottom:
|
|
1049
|
+
const [p, f] = ot(l, r.top);
|
|
1050
|
+
s({ top: p, bottom: f });
|
|
1051
1051
|
}
|
|
1052
1052
|
}
|
|
1053
1053
|
)
|
|
@@ -1061,7 +1061,7 @@ function st({ label: e, value: t, onChange: i }) {
|
|
|
1061
1061
|
"aria-pressed": a,
|
|
1062
1062
|
"aria-label": a ? "Collapse to pair view" : "Expand to per-side view",
|
|
1063
1063
|
title: a ? "Collapse to pair view" : "Expand to per-side view",
|
|
1064
|
-
children: /* @__PURE__ */ n(
|
|
1064
|
+
children: /* @__PURE__ */ n(Tn, {})
|
|
1065
1065
|
}
|
|
1066
1066
|
)
|
|
1067
1067
|
]
|
|
@@ -1069,7 +1069,7 @@ function st({ label: e, value: t, onChange: i }) {
|
|
|
1069
1069
|
)
|
|
1070
1070
|
] });
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function Pn({
|
|
1073
1073
|
options: e,
|
|
1074
1074
|
value: t,
|
|
1075
1075
|
ariaLabel: i,
|
|
@@ -1089,7 +1089,7 @@ function Tn({
|
|
|
1089
1089
|
a.value
|
|
1090
1090
|
)) });
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1092
|
+
function Rn({
|
|
1093
1093
|
options: e,
|
|
1094
1094
|
ariaLabel: t,
|
|
1095
1095
|
onToggle: i
|
|
@@ -1108,7 +1108,7 @@ function Pn({
|
|
|
1108
1108
|
r.id
|
|
1109
1109
|
)) });
|
|
1110
1110
|
}
|
|
1111
|
-
function
|
|
1111
|
+
function $n({ className: e }) {
|
|
1112
1112
|
return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
1113
1113
|
"path",
|
|
1114
1114
|
{
|
|
@@ -1117,7 +1117,7 @@ function Rn({ className: e }) {
|
|
|
1117
1117
|
}
|
|
1118
1118
|
) });
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function Dn({ className: e }) {
|
|
1121
1121
|
return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
1122
1122
|
"path",
|
|
1123
1123
|
{
|
|
@@ -1126,7 +1126,7 @@ function $n({ className: e }) {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
) });
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1129
|
+
function On({ className: e }) {
|
|
1130
1130
|
return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
1131
1131
|
"path",
|
|
1132
1132
|
{
|
|
@@ -1135,10 +1135,10 @@ function Dn({ className: e }) {
|
|
|
1135
1135
|
}
|
|
1136
1136
|
) });
|
|
1137
1137
|
}
|
|
1138
|
-
function
|
|
1138
|
+
function Fn({ className: e }) {
|
|
1139
1139
|
return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { fill: "currentColor", d: "M2 3h12v1.5H2V3zm0 3.5h12v1.5H2V6.5zm0 3.5h12v1.5H2V10zm0 3.5h12v1.5H2V13.5z" }) });
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1141
|
+
function Bn({ className: e }) {
|
|
1142
1142
|
return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
1143
1143
|
"path",
|
|
1144
1144
|
{
|
|
@@ -1147,33 +1147,33 @@ function Fn({ className: e }) {
|
|
|
1147
1147
|
}
|
|
1148
1148
|
) });
|
|
1149
1149
|
}
|
|
1150
|
-
function
|
|
1150
|
+
function Rt(e) {
|
|
1151
1151
|
const t = parseInt(e.trim(), 10);
|
|
1152
1152
|
return Number.isFinite(t) ? t >= 600 : e.trim() === "bold" || e.trim() === "bolder";
|
|
1153
1153
|
}
|
|
1154
|
-
function
|
|
1155
|
-
return
|
|
1154
|
+
function zn(e) {
|
|
1155
|
+
return Rt(e) ? "400" : "700";
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1157
|
+
function $t(e) {
|
|
1158
1158
|
return e.trim() === "italic" || e.trim() === "oblique";
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1161
|
-
return
|
|
1160
|
+
function Hn(e) {
|
|
1161
|
+
return $t(e) ? "normal" : "italic";
|
|
1162
1162
|
}
|
|
1163
|
-
function
|
|
1163
|
+
function ct(e, t) {
|
|
1164
1164
|
return e.split(/\s+/).includes(t);
|
|
1165
1165
|
}
|
|
1166
|
-
function
|
|
1166
|
+
function dt(e, t) {
|
|
1167
1167
|
const i = new Set(
|
|
1168
1168
|
e.trim().split(/\s+/).filter((r) => r && r !== "none")
|
|
1169
1169
|
);
|
|
1170
1170
|
return i.has(t) ? i.delete(t) : i.add(t), i.size === 0 ? "none" : Array.from(i).join(" ");
|
|
1171
1171
|
}
|
|
1172
|
-
function
|
|
1172
|
+
function _n(e) {
|
|
1173
1173
|
const t = e.trim();
|
|
1174
1174
|
return t === "center" || t === "right" || t === "justify" ? t : "left";
|
|
1175
1175
|
}
|
|
1176
|
-
const
|
|
1176
|
+
const ut = [
|
|
1177
1177
|
"none",
|
|
1178
1178
|
"solid",
|
|
1179
1179
|
"dashed",
|
|
@@ -1183,7 +1183,7 @@ const dt = [
|
|
|
1183
1183
|
"ridge",
|
|
1184
1184
|
"inset",
|
|
1185
1185
|
"outset"
|
|
1186
|
-
],
|
|
1186
|
+
], pt = [
|
|
1187
1187
|
"block",
|
|
1188
1188
|
"inline",
|
|
1189
1189
|
"inline-block",
|
|
@@ -1193,8 +1193,8 @@ const dt = [
|
|
|
1193
1193
|
"inline-grid",
|
|
1194
1194
|
"none",
|
|
1195
1195
|
"contents"
|
|
1196
|
-
],
|
|
1197
|
-
function
|
|
1196
|
+
], Vn = /* @__PURE__ */ new Set(["flex", "inline-flex", "grid", "inline-grid"]);
|
|
1197
|
+
function Un({
|
|
1198
1198
|
values: e,
|
|
1199
1199
|
onPropertyChange: t,
|
|
1200
1200
|
textKind: i,
|
|
@@ -1206,14 +1206,14 @@ function Vn({
|
|
|
1206
1206
|
onElementStateChange: c,
|
|
1207
1207
|
instanceCount: l,
|
|
1208
1208
|
scopeHint: p,
|
|
1209
|
-
stateHint:
|
|
1209
|
+
stateHint: f
|
|
1210
1210
|
}) {
|
|
1211
1211
|
var I, C;
|
|
1212
|
-
const v = e["font-weight"] ?? "", g = e["font-style"] ?? "normal",
|
|
1213
|
-
E && !
|
|
1214
|
-
const T = ((C = e.gap) == null ? void 0 : C.trim()) ?? "", P = T === "normal" || T === "" ? "0px" : T,
|
|
1215
|
-
return
|
|
1216
|
-
/* @__PURE__ */ d(
|
|
1212
|
+
const v = e["font-weight"] ?? "", g = e["font-style"] ?? "normal", m = e["text-decoration"] ?? "none", y = _n(e["text-align"] ?? "left"), E = ((I = e.display) == null ? void 0 : I.trim()) ?? "", x = !!E, w = Vn.has(E), N = [...pt];
|
|
1213
|
+
E && !pt.includes(E) && N.push(E);
|
|
1214
|
+
const T = ((C = e.gap) == null ? void 0 : C.trim()) ?? "", P = T === "normal" || T === "" ? "0px" : T, $ = e["border-style"] ?? "none", k = [...ut];
|
|
1215
|
+
return $ && !ut.includes($) && k.push($), /* @__PURE__ */ d("div", { className: "pa-edit-sections", children: [
|
|
1216
|
+
/* @__PURE__ */ d(le, { title: "Targeting", defaultOpen: !0, children: [
|
|
1217
1217
|
/* @__PURE__ */ d("div", { className: "pa-edit-field-grid pa-edit-field-grid--2", children: [
|
|
1218
1218
|
/* @__PURE__ */ d("label", { className: "pa-edit-mini-field", children: [
|
|
1219
1219
|
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Scope" }),
|
|
@@ -1254,9 +1254,9 @@ function Vn({
|
|
|
1254
1254
|
] })
|
|
1255
1255
|
] }),
|
|
1256
1256
|
p ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: p }) : null,
|
|
1257
|
-
|
|
1257
|
+
f ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: f }) : null
|
|
1258
1258
|
] }),
|
|
1259
|
-
i !== "none" && /* @__PURE__ */ n(
|
|
1259
|
+
i !== "none" && /* @__PURE__ */ n(le, { title: "Content", defaultOpen: !0, children: /* @__PURE__ */ d("label", { className: "pa-edit-stack-field", children: [
|
|
1260
1260
|
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Text" }),
|
|
1261
1261
|
/* @__PURE__ */ n(
|
|
1262
1262
|
"textarea",
|
|
@@ -1269,9 +1269,9 @@ function Vn({
|
|
|
1269
1269
|
}
|
|
1270
1270
|
)
|
|
1271
1271
|
] }) }),
|
|
1272
|
-
/* @__PURE__ */ d(
|
|
1272
|
+
/* @__PURE__ */ d(le, { title: "Typography", defaultOpen: !0, children: [
|
|
1273
1273
|
/* @__PURE__ */ n(
|
|
1274
|
-
|
|
1274
|
+
xn,
|
|
1275
1275
|
{
|
|
1276
1276
|
value: e["font-family"] ?? "",
|
|
1277
1277
|
onChange: (h) => t("font-family", h)
|
|
@@ -1280,42 +1280,42 @@ function Vn({
|
|
|
1280
1280
|
/* @__PURE__ */ d("div", { className: "pa-edit-field-block", children: [
|
|
1281
1281
|
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Style" }),
|
|
1282
1282
|
/* @__PURE__ */ n(
|
|
1283
|
-
|
|
1283
|
+
Rn,
|
|
1284
1284
|
{
|
|
1285
1285
|
ariaLabel: "Text style",
|
|
1286
1286
|
options: [
|
|
1287
1287
|
{
|
|
1288
1288
|
id: "bold",
|
|
1289
1289
|
title: "Bold",
|
|
1290
|
-
pressed:
|
|
1290
|
+
pressed: Rt(v),
|
|
1291
1291
|
content: /* @__PURE__ */ n("span", { className: "pa-segmented-type pa-segmented-type--bold", children: "B" })
|
|
1292
1292
|
},
|
|
1293
1293
|
{
|
|
1294
1294
|
id: "italic",
|
|
1295
1295
|
title: "Italic",
|
|
1296
|
-
pressed:
|
|
1296
|
+
pressed: $t(g),
|
|
1297
1297
|
content: /* @__PURE__ */ n("span", { className: "pa-segmented-type pa-segmented-type--italic", children: "I" })
|
|
1298
1298
|
},
|
|
1299
1299
|
{
|
|
1300
1300
|
id: "underline",
|
|
1301
1301
|
title: "Underline",
|
|
1302
|
-
pressed:
|
|
1302
|
+
pressed: ct(m, "underline"),
|
|
1303
1303
|
content: /* @__PURE__ */ n("span", { className: "pa-segmented-type pa-segmented-type--underline", children: "U" })
|
|
1304
1304
|
},
|
|
1305
1305
|
{
|
|
1306
1306
|
id: "strikethrough",
|
|
1307
1307
|
title: "Strikethrough",
|
|
1308
|
-
pressed:
|
|
1309
|
-
content: /* @__PURE__ */ n(
|
|
1308
|
+
pressed: ct(m, "line-through"),
|
|
1309
|
+
content: /* @__PURE__ */ n(Bn, { className: "pa-segmented-icon" })
|
|
1310
1310
|
}
|
|
1311
1311
|
],
|
|
1312
1312
|
onToggle: (h) => {
|
|
1313
|
-
h === "bold" ? t("font-weight",
|
|
1313
|
+
h === "bold" ? t("font-weight", zn(v)) : h === "italic" ? t("font-style", Hn(g)) : h === "underline" ? t(
|
|
1314
1314
|
"text-decoration",
|
|
1315
|
-
|
|
1315
|
+
dt(m, "underline")
|
|
1316
1316
|
) : h === "strikethrough" && t(
|
|
1317
1317
|
"text-decoration",
|
|
1318
|
-
|
|
1318
|
+
dt(m, "line-through")
|
|
1319
1319
|
);
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
@@ -1324,7 +1324,7 @@ function Vn({
|
|
|
1324
1324
|
/* @__PURE__ */ d("div", { className: "pa-edit-field-block", children: [
|
|
1325
1325
|
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Align" }),
|
|
1326
1326
|
/* @__PURE__ */ n(
|
|
1327
|
-
|
|
1327
|
+
Pn,
|
|
1328
1328
|
{
|
|
1329
1329
|
ariaLabel: "Text align",
|
|
1330
1330
|
value: y,
|
|
@@ -1333,22 +1333,22 @@ function Vn({
|
|
|
1333
1333
|
{
|
|
1334
1334
|
value: "left",
|
|
1335
1335
|
title: "Align left",
|
|
1336
|
-
content: /* @__PURE__ */ n(
|
|
1336
|
+
content: /* @__PURE__ */ n($n, { className: "pa-segmented-icon" })
|
|
1337
1337
|
},
|
|
1338
1338
|
{
|
|
1339
1339
|
value: "center",
|
|
1340
1340
|
title: "Align center",
|
|
1341
|
-
content: /* @__PURE__ */ n(
|
|
1341
|
+
content: /* @__PURE__ */ n(Dn, { className: "pa-segmented-icon" })
|
|
1342
1342
|
},
|
|
1343
1343
|
{
|
|
1344
1344
|
value: "right",
|
|
1345
1345
|
title: "Align right",
|
|
1346
|
-
content: /* @__PURE__ */ n(
|
|
1346
|
+
content: /* @__PURE__ */ n(On, { className: "pa-segmented-icon" })
|
|
1347
1347
|
},
|
|
1348
1348
|
{
|
|
1349
1349
|
value: "justify",
|
|
1350
1350
|
title: "Justify",
|
|
1351
|
-
content: /* @__PURE__ */ n(
|
|
1351
|
+
content: /* @__PURE__ */ n(Fn, { className: "pa-segmented-icon" })
|
|
1352
1352
|
}
|
|
1353
1353
|
]
|
|
1354
1354
|
}
|
|
@@ -1356,7 +1356,7 @@ function Vn({
|
|
|
1356
1356
|
] }),
|
|
1357
1357
|
/* @__PURE__ */ d("div", { className: "pa-edit-field-grid pa-edit-field-grid--2 pa-edit-size-row", children: [
|
|
1358
1358
|
/* @__PURE__ */ n(
|
|
1359
|
-
|
|
1359
|
+
re,
|
|
1360
1360
|
{
|
|
1361
1361
|
compact: !0,
|
|
1362
1362
|
property: "font-size",
|
|
@@ -1366,7 +1366,7 @@ function Vn({
|
|
|
1366
1366
|
}
|
|
1367
1367
|
),
|
|
1368
1368
|
/* @__PURE__ */ n(
|
|
1369
|
-
|
|
1369
|
+
re,
|
|
1370
1370
|
{
|
|
1371
1371
|
compact: !0,
|
|
1372
1372
|
property: "line-height",
|
|
@@ -1377,7 +1377,7 @@ function Vn({
|
|
|
1377
1377
|
)
|
|
1378
1378
|
] }),
|
|
1379
1379
|
/* @__PURE__ */ n(
|
|
1380
|
-
|
|
1380
|
+
Be,
|
|
1381
1381
|
{
|
|
1382
1382
|
label: "Color",
|
|
1383
1383
|
value: e.color ?? "",
|
|
@@ -1385,10 +1385,10 @@ function Vn({
|
|
|
1385
1385
|
}
|
|
1386
1386
|
)
|
|
1387
1387
|
] }),
|
|
1388
|
-
/* @__PURE__ */ d(
|
|
1388
|
+
/* @__PURE__ */ d(le, { title: "Layout", defaultOpen: !0, children: [
|
|
1389
1389
|
/* @__PURE__ */ d("div", { className: "pa-edit-split-fields", children: [
|
|
1390
1390
|
/* @__PURE__ */ n(
|
|
1391
|
-
|
|
1391
|
+
re,
|
|
1392
1392
|
{
|
|
1393
1393
|
compact: !0,
|
|
1394
1394
|
property: "width",
|
|
@@ -1398,7 +1398,7 @@ function Vn({
|
|
|
1398
1398
|
}
|
|
1399
1399
|
),
|
|
1400
1400
|
/* @__PURE__ */ n(
|
|
1401
|
-
|
|
1401
|
+
re,
|
|
1402
1402
|
{
|
|
1403
1403
|
compact: !0,
|
|
1404
1404
|
property: "height",
|
|
@@ -1409,7 +1409,7 @@ function Vn({
|
|
|
1409
1409
|
)
|
|
1410
1410
|
] }),
|
|
1411
1411
|
/* @__PURE__ */ n(
|
|
1412
|
-
|
|
1412
|
+
lt,
|
|
1413
1413
|
{
|
|
1414
1414
|
property: "padding",
|
|
1415
1415
|
label: "Padding",
|
|
@@ -1418,7 +1418,7 @@ function Vn({
|
|
|
1418
1418
|
}
|
|
1419
1419
|
),
|
|
1420
1420
|
/* @__PURE__ */ n(
|
|
1421
|
-
|
|
1421
|
+
lt,
|
|
1422
1422
|
{
|
|
1423
1423
|
property: "margin",
|
|
1424
1424
|
label: "Margin",
|
|
@@ -1439,7 +1439,7 @@ function Vn({
|
|
|
1439
1439
|
)
|
|
1440
1440
|
] }),
|
|
1441
1441
|
w && /* @__PURE__ */ n(
|
|
1442
|
-
|
|
1442
|
+
re,
|
|
1443
1443
|
{
|
|
1444
1444
|
compact: !0,
|
|
1445
1445
|
property: "gap",
|
|
@@ -1449,9 +1449,9 @@ function Vn({
|
|
|
1449
1449
|
}
|
|
1450
1450
|
)
|
|
1451
1451
|
] }),
|
|
1452
|
-
/* @__PURE__ */ d(
|
|
1452
|
+
/* @__PURE__ */ d(le, { title: "Fill", children: [
|
|
1453
1453
|
/* @__PURE__ */ n(
|
|
1454
|
-
|
|
1454
|
+
Be,
|
|
1455
1455
|
{
|
|
1456
1456
|
label: "Background",
|
|
1457
1457
|
value: e["background-color"] ?? "",
|
|
@@ -1459,7 +1459,7 @@ function Vn({
|
|
|
1459
1459
|
}
|
|
1460
1460
|
),
|
|
1461
1461
|
/* @__PURE__ */ n(
|
|
1462
|
-
|
|
1462
|
+
re,
|
|
1463
1463
|
{
|
|
1464
1464
|
compact: !0,
|
|
1465
1465
|
property: "opacity",
|
|
@@ -1469,9 +1469,9 @@ function Vn({
|
|
|
1469
1469
|
}
|
|
1470
1470
|
)
|
|
1471
1471
|
] }),
|
|
1472
|
-
/* @__PURE__ */ d(
|
|
1472
|
+
/* @__PURE__ */ d(le, { title: "Border", defaultOpen: !0, children: [
|
|
1473
1473
|
/* @__PURE__ */ n(
|
|
1474
|
-
|
|
1474
|
+
Be,
|
|
1475
1475
|
{
|
|
1476
1476
|
label: "Border color",
|
|
1477
1477
|
value: e["border-color"] ?? "",
|
|
@@ -1484,14 +1484,14 @@ function Vn({
|
|
|
1484
1484
|
"select",
|
|
1485
1485
|
{
|
|
1486
1486
|
className: "pa-select",
|
|
1487
|
-
value:
|
|
1487
|
+
value: $,
|
|
1488
1488
|
onChange: (h) => t("border-style", h.target.value),
|
|
1489
1489
|
children: k.map((h) => /* @__PURE__ */ n("option", { value: h, children: h }, h))
|
|
1490
1490
|
}
|
|
1491
1491
|
)
|
|
1492
1492
|
] }),
|
|
1493
1493
|
/* @__PURE__ */ n(
|
|
1494
|
-
|
|
1494
|
+
re,
|
|
1495
1495
|
{
|
|
1496
1496
|
compact: !0,
|
|
1497
1497
|
property: "border-width",
|
|
@@ -1501,7 +1501,7 @@ function Vn({
|
|
|
1501
1501
|
}
|
|
1502
1502
|
),
|
|
1503
1503
|
/* @__PURE__ */ n(
|
|
1504
|
-
|
|
1504
|
+
re,
|
|
1505
1505
|
{
|
|
1506
1506
|
compact: !0,
|
|
1507
1507
|
property: "border-radius",
|
|
@@ -1513,7 +1513,7 @@ function Vn({
|
|
|
1513
1513
|
] })
|
|
1514
1514
|
] });
|
|
1515
1515
|
}
|
|
1516
|
-
const
|
|
1516
|
+
const Wn = 50, ht = [
|
|
1517
1517
|
"font-family",
|
|
1518
1518
|
"font-size",
|
|
1519
1519
|
"font-weight",
|
|
@@ -1535,130 +1535,140 @@ const Un = 50, pt = [
|
|
|
1535
1535
|
"border-radius",
|
|
1536
1536
|
"opacity"
|
|
1537
1537
|
];
|
|
1538
|
-
function
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
const A = Array.from(a.current);
|
|
1538
|
+
function Yn(e, t, i) {
|
|
1539
|
+
var te;
|
|
1540
|
+
const r = W([]), a = W(/* @__PURE__ */ new Set()), o = W([]), s = W(null), u = W([]), [c, l] = A({}), [p, f] = A({}), [v, g] = A("none"), [m, y] = A(""), [E, x] = A(""), [w, N] = A(() => /* @__PURE__ */ new Map()), [T, P] = A(!1), $ = L(() => {
|
|
1541
|
+
const M = Array.from(a.current);
|
|
1543
1542
|
return {
|
|
1544
|
-
inline:
|
|
1545
|
-
text: e && v !== "none" ?
|
|
1543
|
+
inline: Qe(M, [...ht]),
|
|
1544
|
+
text: e && v !== "none" ? Ze(e, v) : null
|
|
1546
1545
|
};
|
|
1547
1546
|
}, [e, v]), k = L(() => {
|
|
1548
|
-
u.current.push(
|
|
1549
|
-
}, [
|
|
1550
|
-
(
|
|
1547
|
+
u.current.push($()), u.current.length > Wn && u.current.shift(), P(u.current.length > 0);
|
|
1548
|
+
}, [$]), I = L(
|
|
1549
|
+
(M) => {
|
|
1550
|
+
var R;
|
|
1551
1551
|
if (!e) return;
|
|
1552
|
-
const
|
|
1553
|
-
ye(o.current.filter((
|
|
1554
|
-
const
|
|
1555
|
-
r.current =
|
|
1556
|
-
const
|
|
1557
|
-
if (
|
|
1558
|
-
for (const
|
|
1559
|
-
if (
|
|
1560
|
-
for (const
|
|
1561
|
-
|
|
1552
|
+
const D = Array.from(a.current);
|
|
1553
|
+
ye(o.current.filter((z) => D.includes(z.element))), s.current && Ne(s.current);
|
|
1554
|
+
const O = Ee(e, t);
|
|
1555
|
+
r.current = O, a.current = new Set(O), ke(D), Fe(O, i);
|
|
1556
|
+
const _ = e ? ((R = w.get(e)) == null ? void 0 : R.get(i)) ?? [] : [];
|
|
1557
|
+
if (M && _.length > 0)
|
|
1558
|
+
for (const z of _)
|
|
1559
|
+
if (z.property === "textContent" || z.property === "value")
|
|
1560
|
+
for (const X of O)
|
|
1561
|
+
et(X, z.property, z.newValue);
|
|
1562
1562
|
else
|
|
1563
|
-
for (const
|
|
1564
|
-
|
|
1563
|
+
for (const X of O)
|
|
1564
|
+
X.style.setProperty(z.property, z.newValue);
|
|
1565
1565
|
},
|
|
1566
1566
|
[e, t, i, w]
|
|
1567
1567
|
);
|
|
1568
|
-
|
|
1568
|
+
H(() => {
|
|
1569
1569
|
if (!e) {
|
|
1570
|
-
r.current = [], a.current = /* @__PURE__ */ new Set(), o.current = [], s.current = null, u.current = [], l({}),
|
|
1570
|
+
r.current = [], a.current = /* @__PURE__ */ new Set(), o.current = [], s.current = null, u.current = [], l({}), f({}), g("none"), y(""), x(""), N(/* @__PURE__ */ new Map()), P(!1);
|
|
1571
1571
|
return;
|
|
1572
1572
|
}
|
|
1573
|
-
const
|
|
1574
|
-
r.current =
|
|
1575
|
-
const
|
|
1576
|
-
l(
|
|
1577
|
-
const
|
|
1578
|
-
return g(
|
|
1579
|
-
}, [e]),
|
|
1573
|
+
const M = Ee(e, t);
|
|
1574
|
+
r.current = M, a.current = new Set(M), o.current = Qe(M, [...ht]), u.current = [], P(!1);
|
|
1575
|
+
const D = Ce(e);
|
|
1576
|
+
l(D), f(D);
|
|
1577
|
+
const O = ue(e);
|
|
1578
|
+
return g(O.kind), y(O.value), x(O.value), s.current = O.kind !== "none" ? Ze(e, O.kind) : null, Fe(M, i), () => ke(M);
|
|
1579
|
+
}, [e]), H(() => {
|
|
1580
1580
|
e && I(!0);
|
|
1581
|
-
}, [t]),
|
|
1581
|
+
}, [t]), H(() => {
|
|
1582
|
+
var O;
|
|
1582
1583
|
if (!e) return;
|
|
1583
|
-
const
|
|
1584
|
-
r.current =
|
|
1584
|
+
const M = Ee(e, t);
|
|
1585
|
+
r.current = M, ye(
|
|
1586
|
+
o.current.filter((_) => M.includes(_.element))
|
|
1587
|
+
);
|
|
1588
|
+
const D = ((O = w.get(e)) == null ? void 0 : O.get(i)) ?? [];
|
|
1589
|
+
for (const _ of D)
|
|
1590
|
+
if (!(_.property === "textContent" || _.property === "value"))
|
|
1591
|
+
for (const R of M)
|
|
1592
|
+
R.style.setProperty(_.property, _.newValue);
|
|
1593
|
+
ke(Array.from(a.current)), Fe(M, i), a.current = new Set(M);
|
|
1585
1594
|
}, [i, e, t]);
|
|
1586
1595
|
const C = L(
|
|
1587
|
-
(
|
|
1588
|
-
e && N((
|
|
1589
|
-
const
|
|
1590
|
-
return
|
|
1596
|
+
(M, D, O) => {
|
|
1597
|
+
e && N((_) => {
|
|
1598
|
+
const R = new Map(_), z = new Map(R.get(e) ?? /* @__PURE__ */ new Map()), q = (z.get(i) ?? []).filter((fe) => fe.property !== M);
|
|
1599
|
+
return O === D ? q.length === 0 ? z.delete(i) : z.set(i, q) : z.set(i, [...q, { property: M, oldValue: D, newValue: O }]), z.size === 0 ? R.delete(e) : R.set(e, z), R;
|
|
1591
1600
|
});
|
|
1592
1601
|
},
|
|
1593
|
-
[e]
|
|
1602
|
+
[e, i]
|
|
1594
1603
|
), h = L(
|
|
1595
|
-
(
|
|
1604
|
+
(M, D) => {
|
|
1596
1605
|
if (!e) return;
|
|
1597
|
-
const
|
|
1598
|
-
|
|
1599
|
-
for (const [
|
|
1600
|
-
const
|
|
1601
|
-
for (const
|
|
1602
|
-
|
|
1603
|
-
C(
|
|
1606
|
+
const O = { [M]: D };
|
|
1607
|
+
M === "border-width" && (c["border-style"] ?? "none") === "none" && kn(D) && (O["border-style"] = "solid"), k(), l((_) => ({ ..._, ...O }));
|
|
1608
|
+
for (const [_, R] of Object.entries(O)) {
|
|
1609
|
+
const z = p[_] ?? "";
|
|
1610
|
+
for (const X of r.current)
|
|
1611
|
+
X.style.setProperty(_, R), a.current.add(X);
|
|
1612
|
+
C(_, z, R);
|
|
1604
1613
|
}
|
|
1605
1614
|
},
|
|
1606
1615
|
[e, p, c, k, C]
|
|
1607
|
-
),
|
|
1608
|
-
(
|
|
1616
|
+
), B = L(
|
|
1617
|
+
(M) => {
|
|
1609
1618
|
if (!(!e || v === "none")) {
|
|
1610
|
-
k(), y(
|
|
1611
|
-
for (const
|
|
1612
|
-
|
|
1613
|
-
C(v, E,
|
|
1619
|
+
k(), y(M);
|
|
1620
|
+
for (const D of r.current)
|
|
1621
|
+
et(D, v, M), a.current.add(D);
|
|
1622
|
+
C(v, E, M);
|
|
1614
1623
|
}
|
|
1615
1624
|
},
|
|
1616
1625
|
[e, v, E, k, C]
|
|
1617
1626
|
), Y = L(() => {
|
|
1618
|
-
const
|
|
1619
|
-
if (
|
|
1620
|
-
l(
|
|
1621
|
-
const
|
|
1622
|
-
|
|
1627
|
+
const M = u.current.pop();
|
|
1628
|
+
if (M && (ye(M.inline), M.text && Ne(M.text), P(u.current.length > 0), e)) {
|
|
1629
|
+
l(Ce(e));
|
|
1630
|
+
const D = ue(e);
|
|
1631
|
+
D.kind !== "none" && y(D.value);
|
|
1623
1632
|
}
|
|
1624
|
-
}, [e]),
|
|
1625
|
-
if (ye(o.current), s.current &&
|
|
1626
|
-
l(
|
|
1627
|
-
const
|
|
1628
|
-
y(
|
|
1633
|
+
}, [e]), ne = L(() => {
|
|
1634
|
+
if (ye(o.current), s.current && Ne(s.current), u.current = [], P(!1), N(/* @__PURE__ */ new Map()), e) {
|
|
1635
|
+
l(Ce(e));
|
|
1636
|
+
const M = ue(e);
|
|
1637
|
+
y(M.value);
|
|
1629
1638
|
}
|
|
1630
|
-
}, [e]),
|
|
1631
|
-
ye(o.current), s.current &&
|
|
1632
|
-
}, []),
|
|
1633
|
-
if (
|
|
1634
|
-
l(
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1639
|
+
}, [e]), Q = L(() => {
|
|
1640
|
+
ye(o.current), s.current && Ne(s.current);
|
|
1641
|
+
}, []), J = L(() => {
|
|
1642
|
+
if (Q(), ke(Array.from(a.current)), u.current = [], P(!1), N(/* @__PURE__ */ new Map()), e) {
|
|
1643
|
+
l(Ce(e));
|
|
1644
|
+
const M = ue(e);
|
|
1645
|
+
M.kind !== "none" && y(M.value);
|
|
1637
1646
|
}
|
|
1638
|
-
}, [
|
|
1639
|
-
let
|
|
1640
|
-
for (const
|
|
1641
|
-
|
|
1647
|
+
}, [Q, e]), he = e ? ((te = w.get(e)) == null ? void 0 : te.get(i)) ?? [] : [];
|
|
1648
|
+
let F = 0;
|
|
1649
|
+
for (const M of w.values())
|
|
1650
|
+
for (const D of M.values()) F += D.length;
|
|
1651
|
+
const ee = L(() => {
|
|
1642
1652
|
N(/* @__PURE__ */ new Map());
|
|
1643
1653
|
}, []);
|
|
1644
1654
|
return {
|
|
1645
1655
|
values: c,
|
|
1646
1656
|
textKind: v,
|
|
1647
|
-
textValue:
|
|
1648
|
-
pendingChanges:
|
|
1657
|
+
textValue: m,
|
|
1658
|
+
pendingChanges: he,
|
|
1649
1659
|
pendingByElement: w,
|
|
1650
|
-
totalPendingCount:
|
|
1651
|
-
clearAllPending:
|
|
1660
|
+
totalPendingCount: F,
|
|
1661
|
+
clearAllPending: ee,
|
|
1652
1662
|
canUndo: T,
|
|
1653
1663
|
updateProperty: h,
|
|
1654
|
-
updateText:
|
|
1664
|
+
updateText: B,
|
|
1655
1665
|
undo: Y,
|
|
1656
|
-
reset:
|
|
1657
|
-
clearPreviews:
|
|
1658
|
-
revertPreviews:
|
|
1666
|
+
reset: ne,
|
|
1667
|
+
clearPreviews: J,
|
|
1668
|
+
revertPreviews: Q
|
|
1659
1669
|
};
|
|
1660
1670
|
}
|
|
1661
|
-
function
|
|
1671
|
+
function Xn({
|
|
1662
1672
|
selectedElement: e,
|
|
1663
1673
|
hoveredElement: t,
|
|
1664
1674
|
onSelectElement: i,
|
|
@@ -1670,12 +1680,12 @@ function Yn({
|
|
|
1670
1680
|
onApply: c,
|
|
1671
1681
|
applyStatus: l,
|
|
1672
1682
|
isToolbarTarget: p,
|
|
1673
|
-
onPreviewApi:
|
|
1683
|
+
onPreviewApi: f
|
|
1674
1684
|
}) {
|
|
1675
1685
|
const {
|
|
1676
1686
|
values: v,
|
|
1677
1687
|
textKind: g,
|
|
1678
|
-
textValue:
|
|
1688
|
+
textValue: m,
|
|
1679
1689
|
pendingChanges: y,
|
|
1680
1690
|
pendingByElement: E,
|
|
1681
1691
|
totalPendingCount: x,
|
|
@@ -1683,54 +1693,54 @@ function Yn({
|
|
|
1683
1693
|
canUndo: N,
|
|
1684
1694
|
updateProperty: T,
|
|
1685
1695
|
updateText: P,
|
|
1686
|
-
undo:
|
|
1696
|
+
undo: $,
|
|
1687
1697
|
reset: k,
|
|
1688
1698
|
clearPreviews: I,
|
|
1689
1699
|
revertPreviews: C
|
|
1690
|
-
} =
|
|
1691
|
-
computeDefaultPosition: (
|
|
1692
|
-
x: window.innerWidth -
|
|
1700
|
+
} = Yn(e, a, s), { elementRef: h, isDragging: B, style: Y, dragHandleProps: ne } = Lt({
|
|
1701
|
+
computeDefaultPosition: (R) => ({
|
|
1702
|
+
x: window.innerWidth - R.width - 16,
|
|
1693
1703
|
y: 16
|
|
1694
1704
|
})
|
|
1695
1705
|
});
|
|
1696
|
-
|
|
1697
|
-
const
|
|
1698
|
-
(
|
|
1699
|
-
if (p(
|
|
1700
|
-
const
|
|
1701
|
-
(
|
|
1706
|
+
H(() => (f == null || f({ clearPreviews: I, revertPreviews: C }), () => f == null ? void 0 : f(null)), [f, I, C]);
|
|
1707
|
+
const Q = L(
|
|
1708
|
+
(R) => {
|
|
1709
|
+
if (p(R.target)) return;
|
|
1710
|
+
const X = document.elementsFromPoint(R.clientX, R.clientY).find(
|
|
1711
|
+
(q) => q instanceof Element && !q.closest(
|
|
1702
1712
|
"[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
|
|
1703
1713
|
)
|
|
1704
1714
|
);
|
|
1705
|
-
r(
|
|
1715
|
+
r(X ?? null);
|
|
1706
1716
|
},
|
|
1707
1717
|
[p, r]
|
|
1708
|
-
),
|
|
1709
|
-
(
|
|
1710
|
-
if (p(
|
|
1711
|
-
|
|
1712
|
-
const
|
|
1713
|
-
(
|
|
1718
|
+
), J = L(
|
|
1719
|
+
(R) => {
|
|
1720
|
+
if (p(R.target)) return;
|
|
1721
|
+
R.preventDefault(), R.stopPropagation();
|
|
1722
|
+
const X = document.elementsFromPoint(R.clientX, R.clientY).find(
|
|
1723
|
+
(q) => q instanceof Element && !q.closest(
|
|
1714
1724
|
"[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
|
|
1715
1725
|
)
|
|
1716
1726
|
);
|
|
1717
|
-
i(
|
|
1727
|
+
i(X ?? null);
|
|
1718
1728
|
},
|
|
1719
1729
|
[p, i]
|
|
1720
1730
|
);
|
|
1721
|
-
|
|
1722
|
-
document.removeEventListener("mousemove",
|
|
1723
|
-
}), [
|
|
1724
|
-
const
|
|
1731
|
+
H(() => (document.addEventListener("mousemove", Q, !0), document.addEventListener("click", J, !0), () => {
|
|
1732
|
+
document.removeEventListener("mousemove", Q, !0), document.removeEventListener("click", J, !0);
|
|
1733
|
+
}), [Q, J]);
|
|
1734
|
+
const he = async () => {
|
|
1725
1735
|
x === 0 || !await c(E) || (w(), C());
|
|
1726
|
-
},
|
|
1727
|
-
return /* @__PURE__ */ d(
|
|
1736
|
+
}, F = e ? We(e) : null, ee = e ? bt(e) : null, te = e ? yt(e) : 0, M = e ? wt(e, "all-instances") : "", D = s !== "normal" && ee === "tailwind" ? "Tailwind variant preview: matching hover:/focus:/… classes are applied without the prefix." : s !== "normal" ? "State preview uses focus/disabled simulation where possible." : null, O = te > 1 ? a === "all-instances" ? `Preview & Apply on ${te} elements (${M}).` : `This instance only — ${te - 1} other on page.` : a === "all-instances" ? "Only one match — scope has no effect." : null, _ = we(() => !e || a !== "all-instances" ? [] : Ee(e, "all-instances"), [e, a]);
|
|
1737
|
+
return /* @__PURE__ */ d(G, { children: [
|
|
1728
1738
|
/* @__PURE__ */ n(
|
|
1729
|
-
|
|
1739
|
+
Mt,
|
|
1730
1740
|
{
|
|
1731
1741
|
element: a === "all-instances" ? null : t,
|
|
1732
1742
|
selected: e,
|
|
1733
|
-
multiSelected:
|
|
1743
|
+
multiSelected: _,
|
|
1734
1744
|
primarySelected: e
|
|
1735
1745
|
}
|
|
1736
1746
|
),
|
|
@@ -1738,9 +1748,9 @@ function Yn({
|
|
|
1738
1748
|
"div",
|
|
1739
1749
|
{
|
|
1740
1750
|
ref: h,
|
|
1741
|
-
className: `pa-edit-panel-float ${
|
|
1751
|
+
className: `pa-edit-panel-float ${B ? "pa-edit-panel-float--dragging" : ""}`,
|
|
1742
1752
|
style: Y,
|
|
1743
|
-
children: /* @__PURE__ */ n(
|
|
1753
|
+
children: /* @__PURE__ */ n(Te, { variant: "sheet", side: "right", className: "pa-edit-panel-glass", children: /* @__PURE__ */ d("div", { className: "pa-edit-panel-inner", children: [
|
|
1744
1754
|
/* @__PURE__ */ d("div", { className: "pa-edit-panel-header", children: [
|
|
1745
1755
|
/* @__PURE__ */ n(
|
|
1746
1756
|
"button",
|
|
@@ -1749,7 +1759,7 @@ function Yn({
|
|
|
1749
1759
|
className: "pa-edit-panel-drag",
|
|
1750
1760
|
"aria-label": "Drag edit panel",
|
|
1751
1761
|
title: "Drag to move",
|
|
1752
|
-
...
|
|
1762
|
+
...ne,
|
|
1753
1763
|
children: /* @__PURE__ */ d("span", { className: "pa-edit-panel-grip", "aria-hidden": "true", children: [
|
|
1754
1764
|
/* @__PURE__ */ n("span", {}),
|
|
1755
1765
|
/* @__PURE__ */ n("span", {}),
|
|
@@ -1762,57 +1772,57 @@ function Yn({
|
|
|
1762
1772
|
),
|
|
1763
1773
|
/* @__PURE__ */ n("h3", { className: "pa-edit-title", children: "Edit" })
|
|
1764
1774
|
] }),
|
|
1765
|
-
e ? /* @__PURE__ */ d(
|
|
1775
|
+
e ? /* @__PURE__ */ d(G, { children: [
|
|
1766
1776
|
/* @__PURE__ */ d("div", { className: "pa-edit-meta", children: [
|
|
1767
1777
|
/* @__PURE__ */ n(
|
|
1768
1778
|
"code",
|
|
1769
1779
|
{
|
|
1770
1780
|
className: "pa-edit-meta-label",
|
|
1771
|
-
title: `This instance: ${
|
|
1772
|
-
All instances: ${
|
|
1773
|
-
children:
|
|
1781
|
+
title: `This instance: ${xt(e)}
|
|
1782
|
+
All instances: ${M}`,
|
|
1783
|
+
children: Ue(e)
|
|
1774
1784
|
}
|
|
1775
1785
|
),
|
|
1776
|
-
((
|
|
1777
|
-
(
|
|
1778
|
-
|
|
1779
|
-
|
|
1786
|
+
((F == null ? void 0 : F.sourceFile) || ee) && /* @__PURE__ */ d("span", { className: "pa-edit-source", children: [
|
|
1787
|
+
(F == null ? void 0 : F.sourceFile) && /* @__PURE__ */ d(G, { children: [
|
|
1788
|
+
F.sourceFile,
|
|
1789
|
+
F.lineNumber ? `:${F.lineNumber}` : ""
|
|
1780
1790
|
] }),
|
|
1781
|
-
|
|
1782
|
-
|
|
1791
|
+
F != null && F.sourceFile && ee ? " · " : "",
|
|
1792
|
+
ee ?? ""
|
|
1783
1793
|
] })
|
|
1784
1794
|
] }),
|
|
1785
1795
|
/* @__PURE__ */ n("div", { className: "pa-edit-panel-scroll", children: /* @__PURE__ */ n(
|
|
1786
|
-
|
|
1796
|
+
Un,
|
|
1787
1797
|
{
|
|
1788
1798
|
values: v,
|
|
1789
1799
|
onPropertyChange: T,
|
|
1790
1800
|
textKind: g,
|
|
1791
|
-
textValue:
|
|
1801
|
+
textValue: m,
|
|
1792
1802
|
onTextChange: P,
|
|
1793
1803
|
targetScope: a,
|
|
1794
1804
|
onTargetScopeChange: o,
|
|
1795
1805
|
elementState: s,
|
|
1796
1806
|
onElementStateChange: u,
|
|
1797
|
-
instanceCount:
|
|
1798
|
-
scopeHint:
|
|
1807
|
+
instanceCount: te,
|
|
1808
|
+
scopeHint: O,
|
|
1799
1809
|
stateHint: D
|
|
1800
1810
|
}
|
|
1801
1811
|
) }),
|
|
1802
1812
|
/* @__PURE__ */ d("div", { className: "pa-edit-panel-sticky", children: [
|
|
1803
1813
|
/* @__PURE__ */ d("div", { className: "pa-edit-actions", children: [
|
|
1804
|
-
/* @__PURE__ */ n(
|
|
1805
|
-
/* @__PURE__ */ n(
|
|
1814
|
+
/* @__PURE__ */ n(V, { variant: "regular", onClick: $, disabled: !N, children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
|
|
1815
|
+
/* @__PURE__ */ n(un, { className: "pa-glass-btn-icon" }),
|
|
1806
1816
|
/* @__PURE__ */ n("span", { children: "Undo" })
|
|
1807
1817
|
] }) }),
|
|
1808
1818
|
/* @__PURE__ */ n(
|
|
1809
|
-
|
|
1819
|
+
V,
|
|
1810
1820
|
{
|
|
1811
1821
|
variant: "regular",
|
|
1812
1822
|
onClick: k,
|
|
1813
1823
|
disabled: y.length === 0,
|
|
1814
1824
|
children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
|
|
1815
|
-
/* @__PURE__ */ n(
|
|
1825
|
+
/* @__PURE__ */ n(pn, { className: "pa-glass-btn-icon" }),
|
|
1816
1826
|
/* @__PURE__ */ n("span", { children: "Reset" })
|
|
1817
1827
|
] })
|
|
1818
1828
|
}
|
|
@@ -1827,12 +1837,12 @@ All instances: ${F}`,
|
|
|
1827
1837
|
}
|
|
1828
1838
|
),
|
|
1829
1839
|
/* @__PURE__ */ n(
|
|
1830
|
-
|
|
1840
|
+
V,
|
|
1831
1841
|
{
|
|
1832
1842
|
variant: "glass-primary",
|
|
1833
|
-
onClick:
|
|
1843
|
+
onClick: he,
|
|
1834
1844
|
disabled: x === 0,
|
|
1835
|
-
title:
|
|
1845
|
+
title: F != null && F.sourceFile ? void 0 : "No source file — Apply copies selector + changes to clipboard",
|
|
1836
1846
|
children: "Apply"
|
|
1837
1847
|
}
|
|
1838
1848
|
)
|
|
@@ -1844,7 +1854,7 @@ All instances: ${F}`,
|
|
|
1844
1854
|
)
|
|
1845
1855
|
] });
|
|
1846
1856
|
}
|
|
1847
|
-
async function
|
|
1857
|
+
async function Gn(e, t = {}) {
|
|
1848
1858
|
if (t.onApply)
|
|
1849
1859
|
try {
|
|
1850
1860
|
const r = await t.onApply(e);
|
|
@@ -1864,11 +1874,11 @@ async function Xn(e, t = {}) {
|
|
|
1864
1874
|
} catch (r) {
|
|
1865
1875
|
return { mode: "error", message: r instanceof Error ? r.message : String(r) };
|
|
1866
1876
|
}
|
|
1867
|
-
return await
|
|
1877
|
+
return await Nt(JSON.stringify(e, null, 2)), { mode: "clipboard" };
|
|
1868
1878
|
}
|
|
1869
|
-
function
|
|
1870
|
-
const [t, i] =
|
|
1871
|
-
return
|
|
1879
|
+
function Kn(e) {
|
|
1880
|
+
const [t, i] = A(null);
|
|
1881
|
+
return H(() => {
|
|
1872
1882
|
if (!e) {
|
|
1873
1883
|
i(null);
|
|
1874
1884
|
return;
|
|
@@ -1881,8 +1891,8 @@ function Gn(e) {
|
|
|
1881
1891
|
};
|
|
1882
1892
|
}, [e]), t;
|
|
1883
1893
|
}
|
|
1884
|
-
const
|
|
1885
|
-
function
|
|
1894
|
+
const ie = 8, j = 8, jn = 12, qn = 300, Jn = 280;
|
|
1895
|
+
function ze(e, t, i, r) {
|
|
1886
1896
|
return {
|
|
1887
1897
|
top: e,
|
|
1888
1898
|
left: t,
|
|
@@ -1892,10 +1902,10 @@ function Fe(e, t, i, r) {
|
|
|
1892
1902
|
height: r
|
|
1893
1903
|
};
|
|
1894
1904
|
}
|
|
1895
|
-
function
|
|
1905
|
+
function Ve(e, t) {
|
|
1896
1906
|
return e.left < t.right && e.right > t.left && e.top < t.bottom && e.bottom > t.top;
|
|
1897
1907
|
}
|
|
1898
|
-
function
|
|
1908
|
+
function Zn(e, t) {
|
|
1899
1909
|
return {
|
|
1900
1910
|
top: e.top - t,
|
|
1901
1911
|
left: e.left - t,
|
|
@@ -1905,84 +1915,84 @@ function Jn(e, t) {
|
|
|
1905
1915
|
height: e.height + t * 2
|
|
1906
1916
|
};
|
|
1907
1917
|
}
|
|
1908
|
-
function
|
|
1918
|
+
function Qn() {
|
|
1909
1919
|
if (typeof document > "u") return null;
|
|
1910
1920
|
const e = document.querySelector(
|
|
1911
1921
|
"[data-pixelagent-toolbar-portal] .pa-toolbar-float"
|
|
1912
1922
|
);
|
|
1913
|
-
return e ?
|
|
1923
|
+
return e ? Zn(e.getBoundingClientRect(), jn) : null;
|
|
1914
1924
|
}
|
|
1915
|
-
function
|
|
1925
|
+
function He(e, t) {
|
|
1916
1926
|
return Math.min(
|
|
1917
|
-
Math.max(
|
|
1918
|
-
window.innerWidth - t -
|
|
1927
|
+
Math.max(ie, e),
|
|
1928
|
+
window.innerWidth - t - ie
|
|
1919
1929
|
);
|
|
1920
1930
|
}
|
|
1921
|
-
function
|
|
1931
|
+
function Se(e, t) {
|
|
1922
1932
|
return Math.min(
|
|
1923
|
-
Math.max(
|
|
1924
|
-
window.innerHeight - t -
|
|
1933
|
+
Math.max(ie, e),
|
|
1934
|
+
window.innerHeight - t - ie
|
|
1925
1935
|
);
|
|
1926
1936
|
}
|
|
1927
|
-
function
|
|
1928
|
-
return e.top >=
|
|
1937
|
+
function er(e) {
|
|
1938
|
+
return e.top >= ie && e.left >= ie && e.right <= window.innerWidth - ie && e.bottom <= window.innerHeight - ie;
|
|
1929
1939
|
}
|
|
1930
|
-
function
|
|
1931
|
-
return t &&
|
|
1940
|
+
function tr(e, t) {
|
|
1941
|
+
return t && Ve(e, t) ? !1 : er(e);
|
|
1932
1942
|
}
|
|
1933
|
-
function
|
|
1934
|
-
const r =
|
|
1935
|
-
{ placement: "above", top: e.top - i -
|
|
1936
|
-
{ placement: "below", top: e.bottom +
|
|
1937
|
-
{ placement: "right", top: e.top, left: e.right +
|
|
1938
|
-
{ placement: "left", top: e.top, left: e.left - t -
|
|
1943
|
+
function nr(e, t = qn, i = Jn) {
|
|
1944
|
+
const r = Qn(), o = e.top > window.innerHeight * 0.45 ? [
|
|
1945
|
+
{ placement: "above", top: e.top - i - j, left: e.left },
|
|
1946
|
+
{ placement: "below", top: e.bottom + j, left: e.left },
|
|
1947
|
+
{ placement: "right", top: e.top, left: e.right + j },
|
|
1948
|
+
{ placement: "left", top: e.top, left: e.left - t - j }
|
|
1939
1949
|
] : [
|
|
1940
|
-
{ placement: "below", top: e.bottom +
|
|
1941
|
-
{ placement: "above", top: e.top - i -
|
|
1942
|
-
{ placement: "right", top: e.top, left: e.right +
|
|
1943
|
-
{ placement: "left", top: e.top, left: e.left - t -
|
|
1950
|
+
{ placement: "below", top: e.bottom + j, left: e.left },
|
|
1951
|
+
{ placement: "above", top: e.top - i - j, left: e.left },
|
|
1952
|
+
{ placement: "right", top: e.top, left: e.right + j },
|
|
1953
|
+
{ placement: "left", top: e.top, left: e.left - t - j }
|
|
1944
1954
|
];
|
|
1945
1955
|
for (const { top: c, left: l } of o) {
|
|
1946
|
-
const p =
|
|
1947
|
-
|
|
1948
|
-
|
|
1956
|
+
const p = ze(
|
|
1957
|
+
Se(c, i),
|
|
1958
|
+
He(l, t),
|
|
1949
1959
|
t,
|
|
1950
1960
|
i
|
|
1951
1961
|
);
|
|
1952
|
-
if (
|
|
1962
|
+
if (tr(p, r))
|
|
1953
1963
|
return { top: p.top, left: p.left };
|
|
1954
1964
|
}
|
|
1955
|
-
let s =
|
|
1965
|
+
let s = Se(e.top - i - j, i), u = He(e.left, t);
|
|
1956
1966
|
if (r) {
|
|
1957
|
-
let c =
|
|
1958
|
-
|
|
1959
|
-
Math.min(e.left, r.left - t -
|
|
1967
|
+
let c = ze(s, u, t, i);
|
|
1968
|
+
Ve(c, r) && (s = Se(r.top - i - j, i), c = ze(s, u, t, i)), Ve(c, r) && (s = Se(e.bottom + j, i), u = He(
|
|
1969
|
+
Math.min(e.left, r.left - t - j),
|
|
1960
1970
|
t
|
|
1961
1971
|
));
|
|
1962
1972
|
}
|
|
1963
1973
|
return { top: s, left: u };
|
|
1964
1974
|
}
|
|
1965
|
-
function
|
|
1975
|
+
function rr({
|
|
1966
1976
|
elements: e,
|
|
1967
1977
|
areaBbox: t,
|
|
1968
1978
|
onSubmit: i,
|
|
1969
1979
|
onCancel: r
|
|
1970
1980
|
}) {
|
|
1971
|
-
const [a, o] =
|
|
1972
|
-
if (
|
|
1981
|
+
const [a, o] = A(""), s = W(null), u = W(null), c = e[0] ?? null, l = t ? new DOMRect(t.x, t.y, t.width, t.height) : null, p = Kn(c), f = l ?? p, v = kt(), g = c ? ue(c) : { kind: "none", value: "" }, m = g.kind !== "none" ? g.value : void 0;
|
|
1982
|
+
if (H(() => {
|
|
1973
1983
|
var w;
|
|
1974
1984
|
(w = s.current) == null || w.focus();
|
|
1975
|
-
}, [e]),
|
|
1985
|
+
}, [e]), H(() => {
|
|
1976
1986
|
const w = (N) => {
|
|
1977
1987
|
N.key === "Escape" && r();
|
|
1978
1988
|
};
|
|
1979
1989
|
return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
|
|
1980
|
-
}, [r]), !
|
|
1981
|
-
const y =
|
|
1990
|
+
}, [r]), !f) return null;
|
|
1991
|
+
const y = nr(f), E = e.length > 1 ? `${e.length} selected` : c ? Ue(c) : "Area selection", x = (w) => {
|
|
1982
1992
|
a.trim() && i(a, w);
|
|
1983
1993
|
};
|
|
1984
1994
|
return /* @__PURE__ */ n(
|
|
1985
|
-
|
|
1995
|
+
Te,
|
|
1986
1996
|
{
|
|
1987
1997
|
variant: "popover",
|
|
1988
1998
|
style: { top: y.top, left: y.left },
|
|
@@ -1996,14 +2006,14 @@ function nr({
|
|
|
1996
2006
|
className: "pa-popover-body",
|
|
1997
2007
|
children: [
|
|
1998
2008
|
/* @__PURE__ */ n("div", { className: "pa-popover-header", children: /* @__PURE__ */ n("span", { className: "pa-popover-selector", children: E }) }),
|
|
1999
|
-
(v ||
|
|
2009
|
+
(v || m) && /* @__PURE__ */ d("div", { className: "pa-popover-context", children: [
|
|
2000
2010
|
v && /* @__PURE__ */ d("p", { className: "pa-popover-context-line", children: [
|
|
2001
2011
|
/* @__PURE__ */ n("span", { className: "pa-popover-context-label", children: "Selected" }),
|
|
2002
2012
|
v
|
|
2003
2013
|
] }),
|
|
2004
|
-
|
|
2014
|
+
m && m !== v && /* @__PURE__ */ d("p", { className: "pa-popover-context-line", children: [
|
|
2005
2015
|
/* @__PURE__ */ n("span", { className: "pa-popover-context-label", children: "Element" }),
|
|
2006
|
-
|
|
2016
|
+
m
|
|
2007
2017
|
] })
|
|
2008
2018
|
] }),
|
|
2009
2019
|
/* @__PURE__ */ d("label", { className: "pa-label", children: [
|
|
@@ -2025,9 +2035,9 @@ function nr({
|
|
|
2025
2035
|
] }),
|
|
2026
2036
|
/* @__PURE__ */ n("p", { className: "pa-popover-hint", children: "⌘↵ Add · ⇧⌘↵ Add & next · Esc Cancel" }),
|
|
2027
2037
|
/* @__PURE__ */ d("div", { className: "pa-popover-actions", children: [
|
|
2028
|
-
/* @__PURE__ */ n(
|
|
2038
|
+
/* @__PURE__ */ n(V, { variant: "ghost", onClick: r, children: "Cancel" }),
|
|
2029
2039
|
/* @__PURE__ */ n(
|
|
2030
|
-
|
|
2040
|
+
V,
|
|
2031
2041
|
{
|
|
2032
2042
|
variant: "ghost",
|
|
2033
2043
|
onClick: () => x(!0),
|
|
@@ -2036,7 +2046,7 @@ function nr({
|
|
|
2036
2046
|
}
|
|
2037
2047
|
),
|
|
2038
2048
|
/* @__PURE__ */ n(
|
|
2039
|
-
|
|
2049
|
+
V,
|
|
2040
2050
|
{
|
|
2041
2051
|
variant: "glass-primary",
|
|
2042
2052
|
onClick: () => x(!1),
|
|
@@ -2051,7 +2061,7 @@ function nr({
|
|
|
2051
2061
|
}
|
|
2052
2062
|
);
|
|
2053
2063
|
}
|
|
2054
|
-
function
|
|
2064
|
+
function ir({ area: e, isDragging: t }) {
|
|
2055
2065
|
return !e || e.width < 2 || e.height < 2 ? null : /* @__PURE__ */ n(
|
|
2056
2066
|
"div",
|
|
2057
2067
|
{
|
|
@@ -2066,7 +2076,7 @@ function rr({ area: e, isDragging: t }) {
|
|
|
2066
2076
|
}
|
|
2067
2077
|
);
|
|
2068
2078
|
}
|
|
2069
|
-
function
|
|
2079
|
+
function ar(e) {
|
|
2070
2080
|
const { elements: t, note: i, areaBbox: r } = e, a = t[0];
|
|
2071
2081
|
if (!a && r)
|
|
2072
2082
|
return {
|
|
@@ -2085,7 +2095,7 @@ function ir(e) {
|
|
|
2085
2095
|
};
|
|
2086
2096
|
if (!a)
|
|
2087
2097
|
throw new Error("buildAnnotationEntry requires at least one element or areaBbox");
|
|
2088
|
-
const o = a.getBoundingClientRect(), s =
|
|
2098
|
+
const o = a.getBoundingClientRect(), s = We(a), u = kt(), c = ue(a), l = c.kind !== "none" ? c.value : void 0, p = t.map((f) => xt(f));
|
|
2089
2099
|
return {
|
|
2090
2100
|
id: crypto.randomUUID(),
|
|
2091
2101
|
selector: p[0],
|
|
@@ -2099,17 +2109,17 @@ function ir(e) {
|
|
|
2099
2109
|
height: Math.round(o.height)
|
|
2100
2110
|
},
|
|
2101
2111
|
areaBbox: r,
|
|
2102
|
-
domPath:
|
|
2112
|
+
domPath: Gt(a),
|
|
2103
2113
|
selectedText: u,
|
|
2104
2114
|
elementText: l,
|
|
2105
2115
|
sourceFile: s.sourceFile,
|
|
2106
2116
|
lineNumber: s.lineNumber,
|
|
2107
|
-
componentName:
|
|
2117
|
+
componentName: Xt(a) ?? s.componentName,
|
|
2108
2118
|
createdAt: Date.now()
|
|
2109
2119
|
};
|
|
2110
2120
|
}
|
|
2111
|
-
function
|
|
2112
|
-
const t =
|
|
2121
|
+
function or(e) {
|
|
2122
|
+
const t = Ct(e);
|
|
2113
2123
|
if (t) return t.getBoundingClientRect();
|
|
2114
2124
|
if (e.bbox) {
|
|
2115
2125
|
const { x: i, y: r, width: a, height: o } = e.bbox;
|
|
@@ -2125,13 +2135,13 @@ function ar(e) {
|
|
|
2125
2135
|
}
|
|
2126
2136
|
return null;
|
|
2127
2137
|
}
|
|
2128
|
-
function
|
|
2138
|
+
function sr(e) {
|
|
2129
2139
|
return `${Math.round(e.top)}:${Math.round(e.left)}:${Math.round(e.width)}:${Math.round(e.height)}`;
|
|
2130
2140
|
}
|
|
2131
|
-
const
|
|
2132
|
-
function
|
|
2133
|
-
const [t, i] =
|
|
2134
|
-
return
|
|
2141
|
+
const lr = 20;
|
|
2142
|
+
function cr({ annotations: e }) {
|
|
2143
|
+
const [t, i] = A([]);
|
|
2144
|
+
return H(() => {
|
|
2135
2145
|
if (e.length === 0) {
|
|
2136
2146
|
i([]);
|
|
2137
2147
|
return;
|
|
@@ -2139,13 +2149,13 @@ function lr({ annotations: e }) {
|
|
|
2139
2149
|
const r = /* @__PURE__ */ new Map(), a = () => {
|
|
2140
2150
|
const u = [];
|
|
2141
2151
|
e.forEach((c, l) => {
|
|
2142
|
-
const p =
|
|
2152
|
+
const p = or(c);
|
|
2143
2153
|
if (!p) return;
|
|
2144
|
-
const
|
|
2145
|
-
r.set(
|
|
2154
|
+
const f = sr(p), v = r.get(f) ?? 0;
|
|
2155
|
+
r.set(f, v + 1), u.push({
|
|
2146
2156
|
id: c.id,
|
|
2147
2157
|
index: l + 1,
|
|
2148
|
-
top: p.top - 6 - v *
|
|
2158
|
+
top: p.top - 6 - v * lr,
|
|
2149
2159
|
left: p.right - 6
|
|
2150
2160
|
});
|
|
2151
2161
|
}), i(u);
|
|
@@ -2153,7 +2163,7 @@ function lr({ annotations: e }) {
|
|
|
2153
2163
|
a();
|
|
2154
2164
|
const o = /* @__PURE__ */ new Set();
|
|
2155
2165
|
for (const u of e) {
|
|
2156
|
-
const c =
|
|
2166
|
+
const c = Ct(u);
|
|
2157
2167
|
c && o.add(c);
|
|
2158
2168
|
}
|
|
2159
2169
|
const s = Array.from(o).map((u) => {
|
|
@@ -2164,7 +2174,7 @@ function lr({ annotations: e }) {
|
|
|
2164
2174
|
for (const u of s) u.disconnect();
|
|
2165
2175
|
window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
|
|
2166
2176
|
};
|
|
2167
|
-
}, [e]), t.length === 0 ? null : /* @__PURE__ */ n(
|
|
2177
|
+
}, [e]), t.length === 0 ? null : /* @__PURE__ */ n(G, { children: t.map((r) => /* @__PURE__ */ n(
|
|
2168
2178
|
"span",
|
|
2169
2179
|
{
|
|
2170
2180
|
className: "pa-annotation-badge",
|
|
@@ -2175,24 +2185,24 @@ function lr({ annotations: e }) {
|
|
|
2175
2185
|
r.id
|
|
2176
2186
|
)) });
|
|
2177
2187
|
}
|
|
2178
|
-
const
|
|
2179
|
-
function
|
|
2180
|
-
return e instanceof Element ? !!e.closest(
|
|
2188
|
+
const je = "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]";
|
|
2189
|
+
function Le(e) {
|
|
2190
|
+
return e instanceof Element ? !!e.closest(je) : !1;
|
|
2181
2191
|
}
|
|
2182
|
-
function
|
|
2192
|
+
function ft(e, t) {
|
|
2183
2193
|
return document.elementsFromPoint(e, t).find(
|
|
2184
|
-
(r) => r instanceof Element && !r.closest(
|
|
2194
|
+
(r) => r instanceof Element && !r.closest(je)
|
|
2185
2195
|
) ?? null;
|
|
2186
2196
|
}
|
|
2187
|
-
function
|
|
2197
|
+
function Dt(e) {
|
|
2188
2198
|
return e ? e === "Copied all!" || e.startsWith("Copy failed") : !1;
|
|
2189
2199
|
}
|
|
2190
|
-
function
|
|
2200
|
+
function Ot({
|
|
2191
2201
|
feedback: e,
|
|
2192
2202
|
slotClassName: t,
|
|
2193
2203
|
children: i
|
|
2194
2204
|
}) {
|
|
2195
|
-
return e &&
|
|
2205
|
+
return e && Dt(e) ? /* @__PURE__ */ n(
|
|
2196
2206
|
"span",
|
|
2197
2207
|
{
|
|
2198
2208
|
className: `pa-status pa-copy-feedback-slot ${t}`,
|
|
@@ -2200,9 +2210,9 @@ function Dt({
|
|
|
2200
2210
|
"aria-live": "polite",
|
|
2201
2211
|
children: e
|
|
2202
2212
|
}
|
|
2203
|
-
) : /* @__PURE__ */ n(
|
|
2213
|
+
) : /* @__PURE__ */ n(G, { children: i });
|
|
2204
2214
|
}
|
|
2205
|
-
function
|
|
2215
|
+
function dr({
|
|
2206
2216
|
annotations: e,
|
|
2207
2217
|
collapsed: t,
|
|
2208
2218
|
onToggleCollapsed: i,
|
|
@@ -2215,20 +2225,20 @@ function cr({
|
|
|
2215
2225
|
copiedEntryId: l,
|
|
2216
2226
|
copyAllFrom: p
|
|
2217
2227
|
}) {
|
|
2218
|
-
const [
|
|
2219
|
-
|
|
2228
|
+
const [f, v] = A(null), [g, m] = A("");
|
|
2229
|
+
H(() => {
|
|
2220
2230
|
const x = (w) => {
|
|
2221
2231
|
w.key === "Escape" && (t ? r() : i());
|
|
2222
2232
|
};
|
|
2223
2233
|
return document.addEventListener("keydown", x), () => document.removeEventListener("keydown", x);
|
|
2224
2234
|
}, [t, r, i]);
|
|
2225
2235
|
const y = (x) => {
|
|
2226
|
-
v(x.id),
|
|
2236
|
+
v(x.id), m(x.note);
|
|
2227
2237
|
}, E = (x) => {
|
|
2228
2238
|
g.trim() && (u(x, { note: g.trim() }), v(null));
|
|
2229
2239
|
};
|
|
2230
2240
|
return /* @__PURE__ */ d(
|
|
2231
|
-
|
|
2241
|
+
Te,
|
|
2232
2242
|
{
|
|
2233
2243
|
variant: "sheet",
|
|
2234
2244
|
side: "right",
|
|
@@ -2237,7 +2247,7 @@ function cr({
|
|
|
2237
2247
|
/* @__PURE__ */ d("div", { className: "pa-session-header", children: [
|
|
2238
2248
|
/* @__PURE__ */ d("div", { className: "pa-session-header-main", children: [
|
|
2239
2249
|
/* @__PURE__ */ n(
|
|
2240
|
-
|
|
2250
|
+
V,
|
|
2241
2251
|
{
|
|
2242
2252
|
variant: "ghost",
|
|
2243
2253
|
className: "pa-glass-btn--sm pa-session-collapse-btn",
|
|
@@ -2256,12 +2266,12 @@ function cr({
|
|
|
2256
2266
|
!t && /* @__PURE__ */ n("p", { className: "pa-session-subtitle", children: "Persists until tab close" }),
|
|
2257
2267
|
/* @__PURE__ */ d("div", { className: "pa-session-actions", children: [
|
|
2258
2268
|
/* @__PURE__ */ n(
|
|
2259
|
-
|
|
2269
|
+
Ot,
|
|
2260
2270
|
{
|
|
2261
2271
|
feedback: p === "session" ? c : null,
|
|
2262
2272
|
slotClassName: "pa-copy-feedback-slot--session",
|
|
2263
2273
|
children: /* @__PURE__ */ n(
|
|
2264
|
-
|
|
2274
|
+
V,
|
|
2265
2275
|
{
|
|
2266
2276
|
variant: "glass-primary",
|
|
2267
2277
|
className: "pa-glass-btn--sm",
|
|
@@ -2272,14 +2282,14 @@ function cr({
|
|
|
2272
2282
|
)
|
|
2273
2283
|
}
|
|
2274
2284
|
),
|
|
2275
|
-
/* @__PURE__ */ n(
|
|
2285
|
+
/* @__PURE__ */ n(V, { variant: "ghost", onClick: r, "aria-label": "Close session panel", children: "✕" })
|
|
2276
2286
|
] })
|
|
2277
2287
|
] }),
|
|
2278
2288
|
!t && /* @__PURE__ */ d("ul", { className: "pa-session-list", children: [
|
|
2279
2289
|
e.length === 0 && /* @__PURE__ */ n("li", { className: "pa-session-empty", children: "No annotations yet. Click an element, drag an area, or Shift+click for multi-select." }),
|
|
2280
2290
|
e.map((x) => {
|
|
2281
|
-
const w =
|
|
2282
|
-
return /* @__PURE__ */ n("li", { className: "pa-session-item", children:
|
|
2291
|
+
const w = Kt(x);
|
|
2292
|
+
return /* @__PURE__ */ n("li", { className: "pa-session-item", children: f === x.id ? /* @__PURE__ */ d("div", { className: "pa-session-edit", children: [
|
|
2283
2293
|
/* @__PURE__ */ d("label", { className: "pa-label", children: [
|
|
2284
2294
|
"Note",
|
|
2285
2295
|
/* @__PURE__ */ n(
|
|
@@ -2287,15 +2297,15 @@ function cr({
|
|
|
2287
2297
|
{
|
|
2288
2298
|
className: "pa-textarea",
|
|
2289
2299
|
value: g,
|
|
2290
|
-
onChange: (N) =>
|
|
2300
|
+
onChange: (N) => m(N.target.value),
|
|
2291
2301
|
rows: 3
|
|
2292
2302
|
}
|
|
2293
2303
|
)
|
|
2294
2304
|
] }),
|
|
2295
2305
|
/* @__PURE__ */ d("div", { className: "pa-session-item-actions", children: [
|
|
2296
|
-
/* @__PURE__ */ n(
|
|
2306
|
+
/* @__PURE__ */ n(V, { variant: "ghost", onClick: () => v(null), children: "Cancel" }),
|
|
2297
2307
|
/* @__PURE__ */ n(
|
|
2298
|
-
|
|
2308
|
+
V,
|
|
2299
2309
|
{
|
|
2300
2310
|
variant: "glass-primary",
|
|
2301
2311
|
onClick: () => E(x.id),
|
|
@@ -2304,7 +2314,7 @@ function cr({
|
|
|
2304
2314
|
}
|
|
2305
2315
|
)
|
|
2306
2316
|
] })
|
|
2307
|
-
] }) : /* @__PURE__ */ d(
|
|
2317
|
+
] }) : /* @__PURE__ */ d(G, { children: [
|
|
2308
2318
|
/* @__PURE__ */ d("div", { className: "pa-session-content", children: [
|
|
2309
2319
|
/* @__PURE__ */ n("span", { className: "pa-session-target", children: w.target }),
|
|
2310
2320
|
/* @__PURE__ */ n("p", { className: "pa-session-note", children: w.note }),
|
|
@@ -2320,7 +2330,7 @@ function cr({
|
|
|
2320
2330
|
children: "Copied!"
|
|
2321
2331
|
}
|
|
2322
2332
|
) : /* @__PURE__ */ n(
|
|
2323
|
-
|
|
2333
|
+
V,
|
|
2324
2334
|
{
|
|
2325
2335
|
variant: "glass-primary",
|
|
2326
2336
|
className: "pa-glass-btn--sm",
|
|
@@ -2330,7 +2340,7 @@ function cr({
|
|
|
2330
2340
|
}
|
|
2331
2341
|
),
|
|
2332
2342
|
/* @__PURE__ */ n(
|
|
2333
|
-
|
|
2343
|
+
V,
|
|
2334
2344
|
{
|
|
2335
2345
|
variant: "ghost",
|
|
2336
2346
|
className: "pa-glass-btn--sm",
|
|
@@ -2340,7 +2350,7 @@ function cr({
|
|
|
2340
2350
|
}
|
|
2341
2351
|
),
|
|
2342
2352
|
/* @__PURE__ */ n(
|
|
2343
|
-
|
|
2353
|
+
V,
|
|
2344
2354
|
{
|
|
2345
2355
|
variant: "ghost",
|
|
2346
2356
|
className: "pa-glass-btn--sm",
|
|
@@ -2357,7 +2367,7 @@ function cr({
|
|
|
2357
2367
|
}
|
|
2358
2368
|
);
|
|
2359
2369
|
}
|
|
2360
|
-
function
|
|
2370
|
+
function ur() {
|
|
2361
2371
|
return /* @__PURE__ */ d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
2362
2372
|
/* @__PURE__ */ n(
|
|
2363
2373
|
"path",
|
|
@@ -2378,7 +2388,7 @@ function dr() {
|
|
|
2378
2388
|
)
|
|
2379
2389
|
] });
|
|
2380
2390
|
}
|
|
2381
|
-
function
|
|
2391
|
+
function pr() {
|
|
2382
2392
|
return /* @__PURE__ */ d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
2383
2393
|
/* @__PURE__ */ n("circle", { cx: "8", cy: "8", r: "2.75", stroke: "currentColor", strokeWidth: "1.25" }),
|
|
2384
2394
|
/* @__PURE__ */ n(
|
|
@@ -2392,7 +2402,7 @@ function ur() {
|
|
|
2392
2402
|
)
|
|
2393
2403
|
] });
|
|
2394
2404
|
}
|
|
2395
|
-
function
|
|
2405
|
+
function hr() {
|
|
2396
2406
|
return /* @__PURE__ */ n("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
2397
2407
|
"path",
|
|
2398
2408
|
{
|
|
@@ -2403,27 +2413,27 @@ function pr() {
|
|
|
2403
2413
|
}
|
|
2404
2414
|
) });
|
|
2405
2415
|
}
|
|
2406
|
-
function
|
|
2416
|
+
function fr({
|
|
2407
2417
|
open: e,
|
|
2408
2418
|
onClose: t,
|
|
2409
2419
|
hostTheme: i,
|
|
2410
2420
|
chrome: r,
|
|
2411
2421
|
onToggleHostTheme: a
|
|
2412
2422
|
}) {
|
|
2413
|
-
const o =
|
|
2414
|
-
return
|
|
2423
|
+
const o = W(null);
|
|
2424
|
+
return H(() => {
|
|
2415
2425
|
if (!e) return;
|
|
2416
2426
|
const s = (c) => {
|
|
2417
2427
|
c.key === "Escape" && t();
|
|
2418
2428
|
}, u = (c) => {
|
|
2419
|
-
var p,
|
|
2429
|
+
var p, f;
|
|
2420
2430
|
const l = c.target;
|
|
2421
|
-
(p = o.current) != null && p.contains(l) || (
|
|
2431
|
+
(p = o.current) != null && p.contains(l) || (f = l.closest) != null && f.call(l, "[data-pa-settings-trigger]") || t();
|
|
2422
2432
|
};
|
|
2423
2433
|
return window.addEventListener("keydown", s), window.addEventListener("mousedown", u), () => {
|
|
2424
2434
|
window.removeEventListener("keydown", s), window.removeEventListener("mousedown", u);
|
|
2425
2435
|
};
|
|
2426
|
-
}, [e, t]), e ? /* @__PURE__ */ n("div", { ref: o, className: "pa-settings-menu", role: "dialog", "aria-label": "PixelAgent settings", children: /* @__PURE__ */ n(
|
|
2436
|
+
}, [e, t]), e ? /* @__PURE__ */ n("div", { ref: o, className: "pa-settings-menu", role: "dialog", "aria-label": "PixelAgent settings", children: /* @__PURE__ */ n(Te, { variant: "popover", className: "pa-settings-menu-panel", children: /* @__PURE__ */ d("div", { className: "pa-settings-menu-inner", children: [
|
|
2427
2437
|
/* @__PURE__ */ d("header", { className: "pa-settings-menu-header", children: [
|
|
2428
2438
|
/* @__PURE__ */ n("h4", { className: "pa-settings-menu-title", children: "Settings" }),
|
|
2429
2439
|
/* @__PURE__ */ n("p", { className: "pa-settings-menu-subtitle", children: "Appearance and chrome" })
|
|
@@ -2433,13 +2443,13 @@ function hr({
|
|
|
2433
2443
|
/* @__PURE__ */ d("div", { className: "pa-settings-row", children: [
|
|
2434
2444
|
/* @__PURE__ */ n("span", { className: "pa-settings-row-value", children: i === "dark" ? "Dark canvas" : "Light canvas" }),
|
|
2435
2445
|
/* @__PURE__ */ n(
|
|
2436
|
-
|
|
2446
|
+
V,
|
|
2437
2447
|
{
|
|
2438
2448
|
variant: "icon",
|
|
2439
2449
|
onClick: a,
|
|
2440
2450
|
"aria-label": i === "dark" ? "Switch host to light theme" : "Switch host to dark theme",
|
|
2441
2451
|
title: i === "dark" ? "Light theme" : "Dark theme",
|
|
2442
|
-
children: i === "dark" ? /* @__PURE__ */ n(
|
|
2452
|
+
children: i === "dark" ? /* @__PURE__ */ n(pr, {}) : /* @__PURE__ */ n(hr, {})
|
|
2443
2453
|
}
|
|
2444
2454
|
)
|
|
2445
2455
|
] })
|
|
@@ -2456,13 +2466,13 @@ function hr({
|
|
|
2456
2466
|
}
|
|
2457
2467
|
const mt = "0 0 24 24";
|
|
2458
2468
|
function mr() {
|
|
2459
|
-
return /* @__PURE__ */ d(
|
|
2469
|
+
return /* @__PURE__ */ d(G, { children: [
|
|
2460
2470
|
/* @__PURE__ */ n("rect", { x: "3", y: "14", width: "4", height: "4", fill: "currentColor" }),
|
|
2461
2471
|
/* @__PURE__ */ n("path", { fill: "currentColor", d: "M7 5h12v12L7 5z" })
|
|
2462
2472
|
] });
|
|
2463
2473
|
}
|
|
2464
|
-
const
|
|
2465
|
-
function
|
|
2474
|
+
const gr = "M4.5 2.5L4.5 17.25L9.1 12.9L11.35 19.15L13.55 17.95L11.05 11.85L16.85 11.85L4.5 2.5Z";
|
|
2475
|
+
function vr({ size: e = 22, variant: t = "cursor" }) {
|
|
2466
2476
|
return t === "pointer" ? /* @__PURE__ */ n(
|
|
2467
2477
|
"svg",
|
|
2468
2478
|
{
|
|
@@ -2476,7 +2486,7 @@ function gr({ size: e = 22, variant: t = "cursor" }) {
|
|
|
2476
2486
|
"path",
|
|
2477
2487
|
{
|
|
2478
2488
|
fill: "currentColor",
|
|
2479
|
-
d:
|
|
2489
|
+
d: gr
|
|
2480
2490
|
}
|
|
2481
2491
|
)
|
|
2482
2492
|
}
|
|
@@ -2493,12 +2503,12 @@ function gr({ size: e = 22, variant: t = "cursor" }) {
|
|
|
2493
2503
|
}
|
|
2494
2504
|
);
|
|
2495
2505
|
}
|
|
2496
|
-
const
|
|
2506
|
+
const br = ["element", "area", "multi"], yr = {
|
|
2497
2507
|
element: "Click",
|
|
2498
2508
|
area: "Area",
|
|
2499
2509
|
multi: "Multi"
|
|
2500
2510
|
};
|
|
2501
|
-
function
|
|
2511
|
+
function wr({
|
|
2502
2512
|
rootAttributes: e,
|
|
2503
2513
|
hostTheme: t,
|
|
2504
2514
|
chrome: i,
|
|
@@ -2510,27 +2520,27 @@ function yr({
|
|
|
2510
2520
|
mode: c,
|
|
2511
2521
|
captureMode: l,
|
|
2512
2522
|
annotationCount: p,
|
|
2513
|
-
multiSelectCount:
|
|
2523
|
+
multiSelectCount: f,
|
|
2514
2524
|
copyStatus: v,
|
|
2515
2525
|
copyAllFrom: g,
|
|
2516
|
-
onActivateAnnotate:
|
|
2526
|
+
onActivateAnnotate: m,
|
|
2517
2527
|
onActivateEdit: y,
|
|
2518
2528
|
onDeactivate: E,
|
|
2519
2529
|
onCopyAll: x,
|
|
2520
2530
|
onCaptureModeChange: w,
|
|
2521
2531
|
onConfirmMultiSelect: N
|
|
2522
2532
|
}) {
|
|
2523
|
-
const { elementRef: T, isDragging: P, style:
|
|
2533
|
+
const { elementRef: T, isDragging: P, style: $, dragHandleProps: k } = Lt(), I = /* @__PURE__ */ d(
|
|
2524
2534
|
"div",
|
|
2525
2535
|
{
|
|
2526
2536
|
ref: T,
|
|
2527
2537
|
className: `pa-toolbar-float ${P ? "pa-toolbar-float--dragging" : ""}`,
|
|
2528
|
-
style:
|
|
2538
|
+
style: $,
|
|
2529
2539
|
role: "toolbar",
|
|
2530
2540
|
"aria-label": "PixelAgent",
|
|
2531
2541
|
children: [
|
|
2532
2542
|
!u && /* @__PURE__ */ n(
|
|
2533
|
-
|
|
2543
|
+
fr,
|
|
2534
2544
|
{
|
|
2535
2545
|
open: r,
|
|
2536
2546
|
onClose: o,
|
|
@@ -2539,7 +2549,7 @@ function yr({
|
|
|
2539
2549
|
onToggleHostTheme: s
|
|
2540
2550
|
}
|
|
2541
2551
|
),
|
|
2542
|
-
/* @__PURE__ */ n(
|
|
2552
|
+
/* @__PURE__ */ n(St, { shape: "capsule", className: "pa-toolbar-glass", intensity: "enhanced", children: /* @__PURE__ */ d("div", { className: "pa-toolbar-inner", children: [
|
|
2543
2553
|
/* @__PURE__ */ n(
|
|
2544
2554
|
"button",
|
|
2545
2555
|
{
|
|
@@ -2548,14 +2558,14 @@ function yr({
|
|
|
2548
2558
|
"aria-label": "Drag PixelAgent toolbar",
|
|
2549
2559
|
title: "Drag to move",
|
|
2550
2560
|
...k,
|
|
2551
|
-
children: /* @__PURE__ */ n(
|
|
2561
|
+
children: /* @__PURE__ */ n(vr, { size: 22 })
|
|
2552
2562
|
}
|
|
2553
2563
|
),
|
|
2554
2564
|
/* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
|
|
2555
|
-
u ? /* @__PURE__ */ d(
|
|
2565
|
+
u ? /* @__PURE__ */ d(G, { children: [
|
|
2556
2566
|
/* @__PURE__ */ d("div", { className: "pa-toolbar-segment", children: [
|
|
2557
2567
|
/* @__PURE__ */ n("span", { className: "pa-mode-badge", children: c }),
|
|
2558
|
-
c === "annotate" && /* @__PURE__ */ d(
|
|
2568
|
+
c === "annotate" && /* @__PURE__ */ d(G, { children: [
|
|
2559
2569
|
/* @__PURE__ */ n(
|
|
2560
2570
|
"select",
|
|
2561
2571
|
{
|
|
@@ -2563,25 +2573,25 @@ function yr({
|
|
|
2563
2573
|
value: l,
|
|
2564
2574
|
onChange: (C) => w(C.target.value),
|
|
2565
2575
|
"aria-label": "Capture mode",
|
|
2566
|
-
children:
|
|
2576
|
+
children: br.map((C) => /* @__PURE__ */ n("option", { value: C, children: yr[C] }, C))
|
|
2567
2577
|
}
|
|
2568
2578
|
),
|
|
2569
|
-
|
|
2570
|
-
|
|
2579
|
+
f > 0 && /* @__PURE__ */ n(
|
|
2580
|
+
V,
|
|
2571
2581
|
{
|
|
2572
2582
|
variant: "glass-primary",
|
|
2573
2583
|
onClick: N,
|
|
2574
2584
|
"aria-label": "Annotate selected elements",
|
|
2575
|
-
children:
|
|
2585
|
+
children: f
|
|
2576
2586
|
}
|
|
2577
2587
|
),
|
|
2578
2588
|
/* @__PURE__ */ n(
|
|
2579
|
-
|
|
2589
|
+
Ot,
|
|
2580
2590
|
{
|
|
2581
2591
|
feedback: g === "toolbar" ? v : null,
|
|
2582
2592
|
slotClassName: "pa-copy-feedback-slot--toolbar",
|
|
2583
2593
|
children: /* @__PURE__ */ n(
|
|
2584
|
-
|
|
2594
|
+
V,
|
|
2585
2595
|
{
|
|
2586
2596
|
variant: "glass-primary",
|
|
2587
2597
|
onClick: x,
|
|
@@ -2595,7 +2605,7 @@ function yr({
|
|
|
2595
2605
|
] })
|
|
2596
2606
|
] }),
|
|
2597
2607
|
/* @__PURE__ */ n(
|
|
2598
|
-
|
|
2608
|
+
V,
|
|
2599
2609
|
{
|
|
2600
2610
|
variant: "icon",
|
|
2601
2611
|
className: "pa-toolbar-close",
|
|
@@ -2623,13 +2633,13 @@ function yr({
|
|
|
2623
2633
|
}
|
|
2624
2634
|
)
|
|
2625
2635
|
] }) : /* @__PURE__ */ d("div", { className: "pa-toolbar-segment", children: [
|
|
2626
|
-
/* @__PURE__ */ n(
|
|
2627
|
-
/* @__PURE__ */ n(
|
|
2636
|
+
/* @__PURE__ */ n(V, { onClick: m, children: "Annotate" }),
|
|
2637
|
+
/* @__PURE__ */ n(V, { onClick: y, children: "Edit" })
|
|
2628
2638
|
] }),
|
|
2629
|
-
!u && /* @__PURE__ */ d(
|
|
2639
|
+
!u && /* @__PURE__ */ d(G, { children: [
|
|
2630
2640
|
/* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
|
|
2631
2641
|
/* @__PURE__ */ n(
|
|
2632
|
-
|
|
2642
|
+
V,
|
|
2633
2643
|
{
|
|
2634
2644
|
variant: "icon",
|
|
2635
2645
|
className: "pa-toolbar-settings",
|
|
@@ -2638,16 +2648,16 @@ function yr({
|
|
|
2638
2648
|
"aria-label": "PixelAgent settings",
|
|
2639
2649
|
"aria-expanded": r,
|
|
2640
2650
|
title: "Settings",
|
|
2641
|
-
children: /* @__PURE__ */ n(
|
|
2651
|
+
children: /* @__PURE__ */ n(ur, {})
|
|
2642
2652
|
}
|
|
2643
2653
|
)
|
|
2644
2654
|
] }),
|
|
2645
|
-
v &&
|
|
2655
|
+
v && !Dt(v) && v !== "Copied!" && /* @__PURE__ */ n("span", { className: "pa-status pa-toolbar-status", role: "status", children: v })
|
|
2646
2656
|
] }) })
|
|
2647
2657
|
]
|
|
2648
2658
|
}
|
|
2649
2659
|
);
|
|
2650
|
-
return typeof document > "u" ? I :
|
|
2660
|
+
return typeof document > "u" ? I : Ye(
|
|
2651
2661
|
/* @__PURE__ */ n(
|
|
2652
2662
|
"div",
|
|
2653
2663
|
{
|
|
@@ -2660,15 +2670,15 @@ function yr({
|
|
|
2660
2670
|
document.body
|
|
2661
2671
|
);
|
|
2662
2672
|
}
|
|
2663
|
-
function
|
|
2664
|
-
const e =
|
|
2673
|
+
function xr() {
|
|
2674
|
+
const e = W(jt()), [t, i] = A(
|
|
2665
2675
|
() => {
|
|
2666
2676
|
var o;
|
|
2667
2677
|
return ((o = e.current) == null ? void 0 : o.annotations) ?? [];
|
|
2668
2678
|
}
|
|
2669
2679
|
);
|
|
2670
|
-
|
|
2671
|
-
|
|
2680
|
+
H(() => {
|
|
2681
|
+
qt({ annotations: t });
|
|
2672
2682
|
}, [t]);
|
|
2673
2683
|
const r = L((o, s) => {
|
|
2674
2684
|
i(
|
|
@@ -2684,32 +2694,32 @@ function wr() {
|
|
|
2684
2694
|
removeAnnotation: a
|
|
2685
2695
|
};
|
|
2686
2696
|
}
|
|
2687
|
-
function
|
|
2697
|
+
function Nr({
|
|
2688
2698
|
ui: e,
|
|
2689
2699
|
hostTheme: t,
|
|
2690
2700
|
onHostThemeChange: i
|
|
2691
2701
|
}) {
|
|
2692
|
-
const r =
|
|
2693
|
-
() => ({ ...
|
|
2702
|
+
const r = we(
|
|
2703
|
+
() => ({ ...Jt, ...e }),
|
|
2694
2704
|
[e]
|
|
2695
|
-
), [a, o] =
|
|
2696
|
-
() => t ??
|
|
2697
|
-
), [s, u] =
|
|
2698
|
-
|
|
2705
|
+
), [a, o] = A(
|
|
2706
|
+
() => t ?? tt(r) ?? "dark"
|
|
2707
|
+
), [s, u] = A(!1), c = t ?? a;
|
|
2708
|
+
H(() => {
|
|
2699
2709
|
if (t !== void 0) return;
|
|
2700
2710
|
const v = () => {
|
|
2701
|
-
const y =
|
|
2711
|
+
const y = tt(r);
|
|
2702
2712
|
y && o(y);
|
|
2703
2713
|
};
|
|
2704
2714
|
v();
|
|
2705
|
-
const g = r.hostThemeAttribute,
|
|
2706
|
-
return
|
|
2715
|
+
const g = r.hostThemeAttribute, m = new MutationObserver(v);
|
|
2716
|
+
return m.observe(document.documentElement, {
|
|
2707
2717
|
attributes: !0,
|
|
2708
2718
|
attributeFilter: [g]
|
|
2709
|
-
}), () =>
|
|
2719
|
+
}), () => m.disconnect();
|
|
2710
2720
|
}, [t, r]);
|
|
2711
|
-
const l =
|
|
2712
|
-
() =>
|
|
2721
|
+
const l = we(
|
|
2722
|
+
() => Zt(r, c),
|
|
2713
2723
|
[r, c]
|
|
2714
2724
|
), p = L(() => {
|
|
2715
2725
|
const v = c === "dark" ? "light" : "dark";
|
|
@@ -2717,87 +2727,87 @@ function xr({
|
|
|
2717
2727
|
i(v);
|
|
2718
2728
|
return;
|
|
2719
2729
|
}
|
|
2720
|
-
o(v),
|
|
2721
|
-
}, [c, i, r]),
|
|
2730
|
+
o(v), Qt(v, r);
|
|
2731
|
+
}, [c, i, r]), f = L(() => {
|
|
2722
2732
|
u((v) => !v);
|
|
2723
2733
|
}, []);
|
|
2724
2734
|
return {
|
|
2725
2735
|
chrome: l,
|
|
2726
|
-
rootAttributes:
|
|
2736
|
+
rootAttributes: en(l),
|
|
2727
2737
|
hostTheme: c,
|
|
2728
2738
|
toggleHostTheme: p,
|
|
2729
2739
|
settingsOpen: s,
|
|
2730
2740
|
setSettingsOpen: u,
|
|
2731
|
-
toggleSettings:
|
|
2741
|
+
toggleSettings: f,
|
|
2732
2742
|
uiSettings: r
|
|
2733
2743
|
};
|
|
2734
2744
|
}
|
|
2735
|
-
const
|
|
2736
|
-
function
|
|
2745
|
+
const gt = "/__pixelagent/apply";
|
|
2746
|
+
function vt(e) {
|
|
2737
2747
|
const t = Math.min(e.startX, e.currentX), i = Math.min(e.startY, e.currentY), r = Math.abs(e.currentX - e.startX), a = Math.abs(e.currentY - e.startY);
|
|
2738
2748
|
return { x: t, y: i, width: r, height: a };
|
|
2739
2749
|
}
|
|
2740
|
-
function
|
|
2750
|
+
function kr({
|
|
2741
2751
|
ui: e,
|
|
2742
2752
|
hostTheme: t,
|
|
2743
2753
|
onHostThemeChange: i,
|
|
2744
2754
|
applyEndpoint: r,
|
|
2745
2755
|
onApply: a
|
|
2746
2756
|
} = {}) {
|
|
2747
|
-
const o =
|
|
2748
|
-
|
|
2757
|
+
const o = Nr({ ui: e, hostTheme: t, onHostThemeChange: i }), [s, u] = A(null);
|
|
2758
|
+
H(() => {
|
|
2749
2759
|
if (r || a) return;
|
|
2750
2760
|
let b = !1;
|
|
2751
|
-
return fetch(
|
|
2752
|
-
!b && S.status === 405 && u(
|
|
2761
|
+
return fetch(gt, { method: "GET" }).then((S) => {
|
|
2762
|
+
!b && S.status === 405 && u(gt);
|
|
2753
2763
|
}).catch(() => {
|
|
2754
2764
|
}), () => {
|
|
2755
2765
|
b = !0;
|
|
2756
2766
|
};
|
|
2757
2767
|
}, [r, a]);
|
|
2758
|
-
const [c, l] =
|
|
2759
|
-
annotations:
|
|
2768
|
+
const [c, l] = A(!1), [p, f] = A("idle"), [v, g] = A("element"), {
|
|
2769
|
+
annotations: m,
|
|
2760
2770
|
setAnnotations: y,
|
|
2761
2771
|
updateAnnotation: E,
|
|
2762
2772
|
removeAnnotation: x
|
|
2763
|
-
} =
|
|
2773
|
+
} = xr(), [w, N] = A(null), [T, P] = A(null), [$, k] = A([]), [I, C] = A(null), [h, B] = A(null), [Y, ne] = A(!1), [Q, J] = A(!1), he = c && p === "annotate" && m.length > 0 && !Y, [F, ee] = A("this-instance"), [te, M] = A("normal"), [D, O] = A(null), [_, R] = A(null), [z, X] = A(null), q = W(null), fe = W(null), me = L(
|
|
2764
2774
|
(b, S) => {
|
|
2765
|
-
|
|
2766
|
-
|
|
2775
|
+
fe.current && clearTimeout(fe.current), O(b), R((S == null ? void 0 : S.entryId) ?? null), X((S == null ? void 0 : S.copyAllFrom) ?? null), fe.current = setTimeout(() => {
|
|
2776
|
+
O(null), R(null), X(null);
|
|
2767
2777
|
}, 2500);
|
|
2768
2778
|
},
|
|
2769
2779
|
[]
|
|
2770
|
-
),
|
|
2771
|
-
async (b, S,
|
|
2780
|
+
), xe = L(
|
|
2781
|
+
async (b, S, K) => {
|
|
2772
2782
|
if (b)
|
|
2773
2783
|
try {
|
|
2774
|
-
await
|
|
2784
|
+
await Nt(b), me(S, K);
|
|
2775
2785
|
} catch {
|
|
2776
|
-
|
|
2786
|
+
me("Copy failed — check clipboard permissions", K);
|
|
2777
2787
|
}
|
|
2778
2788
|
},
|
|
2779
|
-
[
|
|
2780
|
-
),
|
|
2789
|
+
[me]
|
|
2790
|
+
), ge = L(
|
|
2781
2791
|
(b, S) => {
|
|
2782
2792
|
b.length === 0 && !S || (C({ elements: b, areaBbox: S }), P(b[0] ?? null));
|
|
2783
2793
|
},
|
|
2784
2794
|
[]
|
|
2785
|
-
),
|
|
2795
|
+
), Pe = L(
|
|
2786
2796
|
(b) => {
|
|
2787
|
-
if (!(!c || p !== "annotate" ||
|
|
2797
|
+
if (!(!c || p !== "annotate" || Le(b.target))) {
|
|
2788
2798
|
if (h) {
|
|
2789
|
-
|
|
2799
|
+
B(
|
|
2790
2800
|
(S) => S && { ...S, currentX: b.clientX, currentY: b.clientY }
|
|
2791
2801
|
);
|
|
2792
2802
|
return;
|
|
2793
2803
|
}
|
|
2794
|
-
v !== "area" && N(
|
|
2804
|
+
v !== "area" && N(ft(b.clientX, b.clientY));
|
|
2795
2805
|
}
|
|
2796
2806
|
},
|
|
2797
2807
|
[c, p, h, v]
|
|
2798
|
-
),
|
|
2808
|
+
), Re = L(
|
|
2799
2809
|
(b) => {
|
|
2800
|
-
!c || p !== "annotate" ||
|
|
2810
|
+
!c || p !== "annotate" || Le(b.target) || v !== "area" || b.button !== 0 || (b.preventDefault(), b.stopPropagation(), B({
|
|
2801
2811
|
startX: b.clientX,
|
|
2802
2812
|
startY: b.clientY,
|
|
2803
2813
|
currentX: b.clientX,
|
|
@@ -2805,105 +2815,106 @@ function Nr({
|
|
|
2805
2815
|
}), C(null));
|
|
2806
2816
|
},
|
|
2807
2817
|
[c, p, v]
|
|
2808
|
-
),
|
|
2818
|
+
), $e = L(() => {
|
|
2809
2819
|
if (!h) return;
|
|
2810
|
-
const b =
|
|
2811
|
-
if (
|
|
2812
|
-
const S =
|
|
2813
|
-
|
|
2814
|
-
}, [h,
|
|
2820
|
+
const b = vt(h);
|
|
2821
|
+
if (B(null), b.width < 8 || b.height < 8) return;
|
|
2822
|
+
const S = tn(b, je);
|
|
2823
|
+
ge(S, b);
|
|
2824
|
+
}, [h, ge]), De = L(
|
|
2815
2825
|
(b) => {
|
|
2816
|
-
if (!c || p !== "annotate" ||
|
|
2826
|
+
if (!c || p !== "annotate" || Le(b.target) || v === "area") return;
|
|
2817
2827
|
b.preventDefault(), b.stopPropagation();
|
|
2818
|
-
const S =
|
|
2828
|
+
const S = ft(b.clientX, b.clientY);
|
|
2819
2829
|
if (!S) return;
|
|
2820
2830
|
if (b.shiftKey || v === "multi") {
|
|
2821
|
-
k((
|
|
2831
|
+
k((Z) => Z.includes(S) ? Z.filter((U) => U !== S) : [...Z, S]), P(S);
|
|
2822
2832
|
return;
|
|
2823
2833
|
}
|
|
2824
|
-
const
|
|
2825
|
-
|
|
2834
|
+
const K = $.length > 0 ? $ : [S];
|
|
2835
|
+
ge(K.includes(S) ? K : [S]);
|
|
2826
2836
|
},
|
|
2827
|
-
[c, p, v,
|
|
2837
|
+
[c, p, v, $, ge]
|
|
2828
2838
|
);
|
|
2829
|
-
|
|
2830
|
-
!T ||
|
|
2831
|
-
}, [T,
|
|
2839
|
+
H(() => {
|
|
2840
|
+
!T || F !== "all-instances" || yt(T) <= 1 && ee("this-instance");
|
|
2841
|
+
}, [T, F]), H(() => {
|
|
2832
2842
|
if (c)
|
|
2833
|
-
return document.addEventListener("mousemove",
|
|
2834
|
-
document.removeEventListener("mousemove",
|
|
2843
|
+
return document.addEventListener("mousemove", Pe, !0), document.addEventListener("mousedown", Re, !0), document.addEventListener("mouseup", $e, !0), document.addEventListener("click", De, !0), () => {
|
|
2844
|
+
document.removeEventListener("mousemove", Pe, !0), document.removeEventListener("mousedown", Re, !0), document.removeEventListener("mouseup", $e, !0), document.removeEventListener("click", De, !0);
|
|
2835
2845
|
};
|
|
2836
|
-
}, [c,
|
|
2837
|
-
const
|
|
2846
|
+
}, [c, Pe, Re, $e, De]);
|
|
2847
|
+
const Ft = L(
|
|
2838
2848
|
(b, S) => {
|
|
2839
2849
|
if (!I || !b.trim()) return;
|
|
2840
|
-
const { elements:
|
|
2841
|
-
if (
|
|
2842
|
-
const
|
|
2843
|
-
elements:
|
|
2850
|
+
const { elements: K, areaBbox: Z } = I;
|
|
2851
|
+
if (K.length === 0 && !Z) return;
|
|
2852
|
+
const ve = ar({
|
|
2853
|
+
elements: K,
|
|
2844
2854
|
note: b,
|
|
2845
|
-
areaBbox:
|
|
2855
|
+
areaBbox: Z
|
|
2846
2856
|
});
|
|
2847
|
-
y((
|
|
2857
|
+
y((U) => [...U, ve]), ne(!1), J(!1), S ? (C(null), P(null)) : (C(null), P(null), k([]));
|
|
2848
2858
|
},
|
|
2849
2859
|
[I, y]
|
|
2850
|
-
),
|
|
2860
|
+
), Bt = L(() => {
|
|
2851
2861
|
C(null), P(null);
|
|
2852
|
-
}, []),
|
|
2862
|
+
}, []), qe = L(
|
|
2853
2863
|
async (b) => {
|
|
2854
|
-
const S =
|
|
2855
|
-
await
|
|
2864
|
+
const S = nn(m);
|
|
2865
|
+
await xe(S, "Copied all!", { copyAllFrom: b });
|
|
2856
2866
|
},
|
|
2857
|
-
[
|
|
2858
|
-
),
|
|
2867
|
+
[m, xe]
|
|
2868
|
+
), zt = L(
|
|
2859
2869
|
async (b) => {
|
|
2860
|
-
const S =
|
|
2861
|
-
S && await
|
|
2870
|
+
const S = m.find((K) => K.id === b);
|
|
2871
|
+
S && await xe(rn(S), "Copied!", { entryId: b });
|
|
2862
2872
|
},
|
|
2863
|
-
[
|
|
2864
|
-
),
|
|
2873
|
+
[m, xe]
|
|
2874
|
+
), Ht = L(
|
|
2865
2875
|
async (b) => {
|
|
2866
|
-
const S =
|
|
2867
|
-
|
|
2868
|
-
|
|
2876
|
+
const S = [];
|
|
2877
|
+
for (const [U, ae] of b)
|
|
2878
|
+
for (const [Oe, be] of ae)
|
|
2879
|
+
be.length > 0 && S.push([U, Oe, be]);
|
|
2869
2880
|
if (S.length === 0) return !1;
|
|
2870
|
-
const
|
|
2871
|
-
for (const [
|
|
2872
|
-
const
|
|
2881
|
+
const K = r ?? s ?? void 0, Z = [];
|
|
2882
|
+
for (const [U, ae, Oe] of S) {
|
|
2883
|
+
const be = We(U), Ut = {
|
|
2873
2884
|
schemaVersion: 1,
|
|
2874
|
-
elementSelector:
|
|
2875
|
-
sourceFile:
|
|
2876
|
-
lineNumber:
|
|
2877
|
-
targetScope:
|
|
2878
|
-
state:
|
|
2879
|
-
stylingSystem:
|
|
2880
|
-
changes:
|
|
2885
|
+
elementSelector: wt(U, F),
|
|
2886
|
+
sourceFile: be.sourceFile,
|
|
2887
|
+
lineNumber: be.lineNumber,
|
|
2888
|
+
targetScope: F,
|
|
2889
|
+
state: ae,
|
|
2890
|
+
stylingSystem: bt(U),
|
|
2891
|
+
changes: Oe
|
|
2881
2892
|
};
|
|
2882
|
-
|
|
2893
|
+
Z.push(await Gn(Ut, { applyEndpoint: K, onApply: a }));
|
|
2883
2894
|
}
|
|
2884
|
-
const
|
|
2885
|
-
(
|
|
2895
|
+
const ve = Z.every(
|
|
2896
|
+
(U) => U.mode === "mcp" && U.result.success && U.result.linesChanged.length > 0
|
|
2886
2897
|
);
|
|
2887
|
-
return
|
|
2888
|
-
|
|
2889
|
-
}),
|
|
2898
|
+
return me(ve ? "Change applied" : "Apply failed"), Z.forEach((U, ae) => {
|
|
2899
|
+
U.mode === "error" ? console.error(`[pixelagent] Apply #${ae} failed:`, U.message) : U.mode === "clipboard" ? console.warn(`[pixelagent] Apply #${ae} fell back to clipboard`) : U.mode === "mcp" && !U.result.success && console.warn(`[pixelagent] Apply #${ae} reported no changes:`, U.result);
|
|
2900
|
+
}), ve;
|
|
2890
2901
|
},
|
|
2891
|
-
[
|
|
2892
|
-
),
|
|
2893
|
-
o.setSettingsOpen(!1), l(!0),
|
|
2894
|
-
},
|
|
2895
|
-
l(!1),
|
|
2896
|
-
},
|
|
2902
|
+
[F, r, s, a, me]
|
|
2903
|
+
), Je = (b) => {
|
|
2904
|
+
o.setSettingsOpen(!1), l(!0), f(b), P(null), N(null), C(null), k([]), B(null), b === "annotate" && ne(!1);
|
|
2905
|
+
}, _t = () => {
|
|
2906
|
+
l(!1), f("idle"), P(null), N(null), C(null), k([]), B(null), ne(!1), J(!1);
|
|
2907
|
+
}, Vt = h ? vt(h) : null;
|
|
2897
2908
|
return /* @__PURE__ */ d(
|
|
2898
2909
|
"div",
|
|
2899
2910
|
{
|
|
2900
|
-
ref:
|
|
2911
|
+
ref: q,
|
|
2901
2912
|
className: "pa-root",
|
|
2902
2913
|
"data-pixelagent-root": !0,
|
|
2903
2914
|
...o.rootAttributes,
|
|
2904
2915
|
children: [
|
|
2905
2916
|
/* @__PURE__ */ n(
|
|
2906
|
-
|
|
2917
|
+
wr,
|
|
2907
2918
|
{
|
|
2908
2919
|
rootAttributes: o.rootAttributes,
|
|
2909
2920
|
hostTheme: o.hostTheme,
|
|
@@ -2915,88 +2926,88 @@ function Nr({
|
|
|
2915
2926
|
active: c,
|
|
2916
2927
|
mode: p,
|
|
2917
2928
|
captureMode: v,
|
|
2918
|
-
annotationCount:
|
|
2919
|
-
multiSelectCount:
|
|
2929
|
+
annotationCount: m.length,
|
|
2930
|
+
multiSelectCount: $.length,
|
|
2920
2931
|
copyStatus: D,
|
|
2921
|
-
copyAllFrom:
|
|
2922
|
-
onActivateAnnotate: () =>
|
|
2923
|
-
onActivateEdit: () =>
|
|
2924
|
-
onDeactivate:
|
|
2925
|
-
onCopyAll: () =>
|
|
2932
|
+
copyAllFrom: z,
|
|
2933
|
+
onActivateAnnotate: () => Je("annotate"),
|
|
2934
|
+
onActivateEdit: () => Je("edit"),
|
|
2935
|
+
onDeactivate: _t,
|
|
2936
|
+
onCopyAll: () => qe("toolbar"),
|
|
2926
2937
|
onCaptureModeChange: g,
|
|
2927
2938
|
onConfirmMultiSelect: () => {
|
|
2928
|
-
|
|
2939
|
+
$.length > 0 && ge($);
|
|
2929
2940
|
}
|
|
2930
2941
|
}
|
|
2931
2942
|
),
|
|
2932
|
-
c && p === "annotate" && /* @__PURE__ */ d(
|
|
2943
|
+
c && p === "annotate" && /* @__PURE__ */ d(G, { children: [
|
|
2933
2944
|
/* @__PURE__ */ n(
|
|
2934
|
-
|
|
2945
|
+
Mt,
|
|
2935
2946
|
{
|
|
2936
2947
|
element: w,
|
|
2937
2948
|
selected: T,
|
|
2938
|
-
multiSelected:
|
|
2949
|
+
multiSelected: $
|
|
2939
2950
|
}
|
|
2940
2951
|
),
|
|
2941
|
-
/* @__PURE__ */ n(
|
|
2942
|
-
/* @__PURE__ */ n(
|
|
2952
|
+
/* @__PURE__ */ n(cr, { annotations: m }),
|
|
2953
|
+
/* @__PURE__ */ n(ir, { area: Vt, isDragging: !!h })
|
|
2943
2954
|
] }),
|
|
2944
2955
|
c && p === "annotate" && I && /* @__PURE__ */ n(
|
|
2945
|
-
|
|
2956
|
+
rr,
|
|
2946
2957
|
{
|
|
2947
2958
|
elements: I.elements,
|
|
2948
2959
|
areaBbox: I.areaBbox,
|
|
2949
|
-
onSubmit:
|
|
2950
|
-
onCancel:
|
|
2960
|
+
onSubmit: Ft,
|
|
2961
|
+
onCancel: Bt
|
|
2951
2962
|
}
|
|
2952
2963
|
),
|
|
2953
2964
|
c && p === "edit" && /* @__PURE__ */ n(
|
|
2954
|
-
|
|
2965
|
+
Xn,
|
|
2955
2966
|
{
|
|
2956
2967
|
selectedElement: T,
|
|
2957
2968
|
hoveredElement: w,
|
|
2958
2969
|
onSelectElement: P,
|
|
2959
2970
|
onHoverElement: N,
|
|
2960
|
-
targetScope:
|
|
2961
|
-
onTargetScopeChange:
|
|
2962
|
-
elementState:
|
|
2963
|
-
onElementStateChange:
|
|
2964
|
-
onApply:
|
|
2971
|
+
targetScope: F,
|
|
2972
|
+
onTargetScopeChange: ee,
|
|
2973
|
+
elementState: te,
|
|
2974
|
+
onElementStateChange: M,
|
|
2975
|
+
onApply: Ht,
|
|
2965
2976
|
applyStatus: p === "edit" ? D : null,
|
|
2966
|
-
isToolbarTarget:
|
|
2977
|
+
isToolbarTarget: Le
|
|
2967
2978
|
}
|
|
2968
2979
|
),
|
|
2969
|
-
|
|
2970
|
-
|
|
2980
|
+
he && /* @__PURE__ */ n(
|
|
2981
|
+
dr,
|
|
2971
2982
|
{
|
|
2972
|
-
annotations:
|
|
2973
|
-
collapsed:
|
|
2974
|
-
onToggleCollapsed: () =>
|
|
2983
|
+
annotations: m,
|
|
2984
|
+
collapsed: Q,
|
|
2985
|
+
onToggleCollapsed: () => J((b) => !b),
|
|
2975
2986
|
onClose: () => {
|
|
2976
|
-
|
|
2987
|
+
ne(!0), J(!1);
|
|
2977
2988
|
},
|
|
2978
|
-
onCopyAll: () =>
|
|
2979
|
-
onCopyOne:
|
|
2989
|
+
onCopyAll: () => qe("session"),
|
|
2990
|
+
onCopyOne: zt,
|
|
2980
2991
|
onRemove: x,
|
|
2981
2992
|
onUpdate: E,
|
|
2982
2993
|
copyStatus: D,
|
|
2983
|
-
copiedEntryId:
|
|
2984
|
-
copyAllFrom:
|
|
2994
|
+
copiedEntryId: _,
|
|
2995
|
+
copyAllFrom: z
|
|
2985
2996
|
}
|
|
2986
2997
|
)
|
|
2987
2998
|
]
|
|
2988
2999
|
}
|
|
2989
3000
|
);
|
|
2990
3001
|
}
|
|
2991
|
-
function
|
|
3002
|
+
function Cr() {
|
|
2992
3003
|
return typeof process < "u" && process.env.NODE_ENV !== "production";
|
|
2993
3004
|
}
|
|
2994
|
-
function
|
|
2995
|
-
return
|
|
3005
|
+
function Er() {
|
|
3006
|
+
return Cr() ? /* @__PURE__ */ n(kr, {}) : null;
|
|
2996
3007
|
}
|
|
2997
3008
|
export {
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3009
|
+
kr as PixelAgent,
|
|
3010
|
+
Er as PixelAgentDev,
|
|
3011
|
+
Cr as isDevEnvironment
|
|
3001
3012
|
};
|
|
3002
3013
|
//# sourceMappingURL=pixelagent.js.map
|