pixelagent 0.1.18 → 0.1.20
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/bin/pixelagent.js +21 -3
- package/dist/edit/useEditPreview.d.ts.map +1 -1
- package/dist/pixelagent.js +652 -649
- package/dist/pixelagent.js.map +1 -1
- package/package.json +2 -3
package/dist/pixelagent.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsxs as d, Fragment as
|
|
2
|
-
import { useState as A, useEffect as
|
|
3
|
-
import { getElementDisplayLabel as Xe, captureTextSnapshot as tt, captureInlineStyles as nt, restoreInlineStyles as
|
|
1
|
+
import { jsxs as d, Fragment as q, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as A, useEffect as _, useRef as X, useMemo as Me, useLayoutEffect as Kt, useCallback as $, useId as jt } from "react";
|
|
3
|
+
import { getElementDisplayLabel as Xe, captureTextSnapshot as tt, captureInlineStyles as nt, restoreInlineStyles as ke, restoreTextSnapshot as Ae, getPreviewTargets as Re, clearTailwindStatePreview as Se, applyTailwindStatePreview as ze, setEditableTextPreview as rt, getRelevantComputedStyles as Ce, getEditableTextInfo as ve, readStateRuleDeclarations as qt, readReactSource as Ge, detectStylingSystem as kt, countElementInstances as Ct, getScopeSelector as Mt, getCssSelector as At, copyToClipboard as St, getWindowSelectionText as Lt, getNearestReactComponentName as Jt, getDomPath as Zt, resolveElementFromEntry as $t, getAnnotationSessionDisplay as Qt, loadAnnotationSession as en, saveAnnotationSession as tn, DEFAULT_PIXEL_AGENT_UI_SETTINGS as nn, readHostThemeFromDocument as it, resolvePixelAgentChrome as rn, applyHostThemeToDocument as on, pixelAgentRootAttributes as an, getElementsInArea as sn, formatAllAnnotations as ln, formatAnnotation as cn } from "@pixelagent/shared";
|
|
4
4
|
export * from "@pixelagent/shared";
|
|
5
5
|
import { createPortal as Ke } from "react-dom";
|
|
6
|
-
function
|
|
6
|
+
function Et({
|
|
7
7
|
element: e,
|
|
8
8
|
selected: t,
|
|
9
9
|
multiSelected: i = [],
|
|
10
10
|
primarySelected: r = null
|
|
11
11
|
}) {
|
|
12
|
-
const [
|
|
13
|
-
if (
|
|
12
|
+
const [o, s] = A([]), a = r ?? t;
|
|
13
|
+
if (_(() => {
|
|
14
14
|
const l = /* @__PURE__ */ new Map(), f = i.length > 0;
|
|
15
15
|
e && !t && !f && l.set(e, !1), t && l.set(t, !0);
|
|
16
16
|
for (const m of i)
|
|
@@ -25,7 +25,7 @@ function $t({
|
|
|
25
25
|
rect: m.getBoundingClientRect(),
|
|
26
26
|
label: Xe(m),
|
|
27
27
|
isSelected: g,
|
|
28
|
-
isPrimary:
|
|
28
|
+
isPrimary: a !== null && m === a
|
|
29
29
|
}))
|
|
30
30
|
);
|
|
31
31
|
};
|
|
@@ -38,10 +38,10 @@ function $t({
|
|
|
38
38
|
for (const m of v) m.disconnect();
|
|
39
39
|
window.removeEventListener("scroll", p, !0), window.removeEventListener("resize", p);
|
|
40
40
|
};
|
|
41
|
-
}, [e, t, i,
|
|
42
|
-
const c =
|
|
43
|
-
return /* @__PURE__ */ d(
|
|
44
|
-
|
|
41
|
+
}, [e, t, i, a]), o.length === 0) return null;
|
|
42
|
+
const c = o.find((l) => l.isPrimary) ?? o.find((l) => l.isSelected) ?? o[0], u = o.filter((l) => l.isSelected).length;
|
|
43
|
+
return /* @__PURE__ */ d(q, { children: [
|
|
44
|
+
o.map((l, f) => /* @__PURE__ */ n(
|
|
45
45
|
"div",
|
|
46
46
|
{
|
|
47
47
|
className: [
|
|
@@ -72,41 +72,41 @@ function $t({
|
|
|
72
72
|
)
|
|
73
73
|
] });
|
|
74
74
|
}
|
|
75
|
-
const It = 0.35,
|
|
76
|
-
function
|
|
75
|
+
const It = 0.35, dn = 0.48;
|
|
76
|
+
function un(e, t, i, r = It) {
|
|
77
77
|
if (e < 8 || t < 8) return null;
|
|
78
|
-
const
|
|
79
|
-
c.width = s, c.height =
|
|
78
|
+
const o = 1, s = Math.max(1, Math.round(e * o)), a = Math.max(1, Math.round(t * o)), c = document.createElement("canvas");
|
|
79
|
+
c.width = s, c.height = a;
|
|
80
80
|
const u = c.getContext("2d");
|
|
81
81
|
if (!u) return null;
|
|
82
|
-
const l = u.createImageData(s,
|
|
82
|
+
const l = u.createImageData(s, a), f = l.data, p = Math.min(0.5, i / Math.min(e, t)), v = 0.3, m = 0.2, g = Math.max(0.4, p + 0.1);
|
|
83
83
|
let y = 0;
|
|
84
|
-
const S = new Float32Array(s *
|
|
84
|
+
const S = new Float32Array(s * a * 2);
|
|
85
85
|
let w = 0;
|
|
86
|
-
for (let N = 0; N <
|
|
87
|
-
for (let
|
|
88
|
-
const
|
|
86
|
+
for (let N = 0; N < a; N++)
|
|
87
|
+
for (let E = 0; E < s; E++) {
|
|
88
|
+
const z = E / s - 0.5, R = N / a - 0.5, x = pn(z, R, v, m, g), I = ot(0.8, 0, x - 0.15), L = ot(0, 1, I), h = (z * L + 0.5) * s - E, F = (R * L + 0.5) * a - N;
|
|
89
89
|
Math.abs(h) > y && (y = Math.abs(h)), Math.abs(F) > y && (y = Math.abs(F)), S[w++] = h, S[w++] = F;
|
|
90
90
|
}
|
|
91
91
|
if (y === 0) return null;
|
|
92
92
|
y *= 0.4 * r;
|
|
93
93
|
let k = 0;
|
|
94
94
|
for (let N = 0; N < f.length; N += 4) {
|
|
95
|
-
const
|
|
96
|
-
f[N] =
|
|
95
|
+
const E = S[k++] / y + 0.5, z = S[k++] / y + 0.5;
|
|
96
|
+
f[N] = E * 255, f[N + 1] = z * 255, f[N + 2] = 0, f[N + 3] = 255;
|
|
97
97
|
}
|
|
98
98
|
return u.putImageData(l, 0, 0), {
|
|
99
99
|
href: c.toDataURL("image/png"),
|
|
100
|
-
scale: y /
|
|
100
|
+
scale: y / o,
|
|
101
101
|
width: s,
|
|
102
|
-
height:
|
|
102
|
+
height: a
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
const s = Math.abs(e) - i +
|
|
107
|
-
return Math.min(Math.max(s,
|
|
105
|
+
function pn(e, t, i, r, o) {
|
|
106
|
+
const s = Math.abs(e) - i + o, a = Math.abs(t) - r + o;
|
|
107
|
+
return Math.min(Math.max(s, a), 0) + Math.hypot(Math.max(s, 0), Math.max(a, 0)) - o;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function ot(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
|
}
|
|
@@ -115,38 +115,38 @@ function Ue() {
|
|
|
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 hn = {
|
|
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 fn(e, t = "default") {
|
|
124
|
+
const i = hn[t], o = e !== null && Ue() ? `${i} url(#${e})` : i;
|
|
125
125
|
return {
|
|
126
|
-
backdropFilter:
|
|
127
|
-
WebkitBackdropFilter:
|
|
126
|
+
backdropFilter: o,
|
|
127
|
+
WebkitBackdropFilter: o
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
let
|
|
131
|
-
function
|
|
130
|
+
let mn = 0;
|
|
131
|
+
function Rt({
|
|
132
132
|
shape: e = "rect",
|
|
133
133
|
cornerRadius: t,
|
|
134
134
|
tint: i = "neutral",
|
|
135
135
|
intensity: r = "default",
|
|
136
|
-
className:
|
|
136
|
+
className: o = "",
|
|
137
137
|
style: s,
|
|
138
|
-
children:
|
|
138
|
+
children: a
|
|
139
139
|
}) {
|
|
140
|
-
const c = t ?? (e === "capsule" ? 9999 : 20), u = r === "enhanced" ?
|
|
140
|
+
const c = t ?? (e === "capsule" ? 9999 : 20), u = r === "enhanced" ? dn : It, l = X(null), f = Me(() => `pa-lg-${++mn}`, []), [p, v] = A(null);
|
|
141
141
|
Kt(() => {
|
|
142
142
|
const g = l.current;
|
|
143
143
|
if (!g) return;
|
|
144
144
|
let y = 0;
|
|
145
145
|
const S = () => {
|
|
146
146
|
cancelAnimationFrame(y), y = requestAnimationFrame(() => {
|
|
147
|
-
const k = g.getBoundingClientRect(), N = Math.round(k.width),
|
|
148
|
-
if (N < 8 ||
|
|
149
|
-
const
|
|
147
|
+
const k = g.getBoundingClientRect(), N = Math.round(k.width), E = Math.round(k.height);
|
|
148
|
+
if (N < 8 || E < 8) return;
|
|
149
|
+
const z = e === "capsule" ? E / 2 : Math.min(c, N / 2, E / 2), R = un(N, E, z, u);
|
|
150
150
|
R && v(R);
|
|
151
151
|
});
|
|
152
152
|
};
|
|
@@ -211,16 +211,16 @@ function Tt({
|
|
|
211
211
|
),
|
|
212
212
|
document.body
|
|
213
213
|
) : null;
|
|
214
|
-
return /* @__PURE__ */ d(
|
|
214
|
+
return /* @__PURE__ */ d(q, { children: [
|
|
215
215
|
m,
|
|
216
216
|
/* @__PURE__ */ d(
|
|
217
217
|
"div",
|
|
218
218
|
{
|
|
219
219
|
ref: l,
|
|
220
|
-
className: `pa-glass-surface pa-glass-surface--${e} pa-glass-surface--${i} ${
|
|
220
|
+
className: `pa-glass-surface pa-glass-surface--${e} pa-glass-surface--${i} ${o}`.trim(),
|
|
221
221
|
style: {
|
|
222
222
|
borderRadius: e === "capsule" ? "999px" : `${c}px`,
|
|
223
|
-
...
|
|
223
|
+
...fn(
|
|
224
224
|
p && Ue() ? f : null,
|
|
225
225
|
r
|
|
226
226
|
),
|
|
@@ -229,7 +229,7 @@ function Tt({
|
|
|
229
229
|
children: [
|
|
230
230
|
/* @__PURE__ */ n("div", { className: "pa-glass-surface-bg", "aria-hidden": "true" }),
|
|
231
231
|
/* @__PURE__ */ n("div", { className: "pa-glass-surface-shine", "aria-hidden": "true" }),
|
|
232
|
-
/* @__PURE__ */ n("div", { className: "pa-glass-surface-content", children:
|
|
232
|
+
/* @__PURE__ */ n("div", { className: "pa-glass-surface-content", children: a })
|
|
233
233
|
]
|
|
234
234
|
}
|
|
235
235
|
)
|
|
@@ -256,24 +256,24 @@ function Pe({
|
|
|
256
256
|
side: t = "left",
|
|
257
257
|
className: i = "",
|
|
258
258
|
style: r,
|
|
259
|
-
children:
|
|
259
|
+
children: o
|
|
260
260
|
}) {
|
|
261
261
|
return /* @__PURE__ */ n(
|
|
262
|
-
|
|
262
|
+
Rt,
|
|
263
263
|
{
|
|
264
264
|
shape: "rect",
|
|
265
265
|
cornerRadius: e === "popover" ? 16 : 20,
|
|
266
266
|
className: `pa-glass-panel pa-glass-panel--${e} pa-glass-panel--${t} ${i}`.trim(),
|
|
267
267
|
style: r,
|
|
268
|
-
children:
|
|
268
|
+
children: o
|
|
269
269
|
}
|
|
270
270
|
);
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function Tt({
|
|
273
273
|
defaultPosition: e = null,
|
|
274
274
|
computeDefaultPosition: t
|
|
275
275
|
} = {}) {
|
|
276
|
-
const [i, r] = A(e), [
|
|
276
|
+
const [i, r] = A(e), [o, s] = A(!1), a = X(null), c = X(null), u = $(() => {
|
|
277
277
|
if (i !== null) return;
|
|
278
278
|
const m = c.current;
|
|
279
279
|
if (!m) return;
|
|
@@ -285,9 +285,9 @@ function Rt({
|
|
|
285
285
|
}
|
|
286
286
|
);
|
|
287
287
|
}, [i, t]);
|
|
288
|
-
|
|
288
|
+
_(() => {
|
|
289
289
|
u();
|
|
290
|
-
}, [u]),
|
|
290
|
+
}, [u]), _(() => {
|
|
291
291
|
const m = () => {
|
|
292
292
|
r((g) => {
|
|
293
293
|
if (!g || !c.current) return g;
|
|
@@ -300,7 +300,7 @@ function Rt({
|
|
|
300
300
|
};
|
|
301
301
|
return window.addEventListener("resize", m), () => window.removeEventListener("resize", m);
|
|
302
302
|
}, []);
|
|
303
|
-
const l =
|
|
303
|
+
const l = $(
|
|
304
304
|
(m) => {
|
|
305
305
|
if (m.button !== 0) return;
|
|
306
306
|
const g = c.current;
|
|
@@ -310,7 +310,7 @@ function Rt({
|
|
|
310
310
|
const S = g.getBoundingClientRect();
|
|
311
311
|
y = { x: S.left, y: S.top }, r(y);
|
|
312
312
|
}
|
|
313
|
-
|
|
313
|
+
a.current = {
|
|
314
314
|
pointerId: m.pointerId,
|
|
315
315
|
startX: m.clientX,
|
|
316
316
|
startY: m.clientY,
|
|
@@ -319,13 +319,13 @@ function Rt({
|
|
|
319
319
|
}, s(!0), m.currentTarget.setPointerCapture(m.pointerId), m.preventDefault();
|
|
320
320
|
},
|
|
321
321
|
[i]
|
|
322
|
-
), f =
|
|
323
|
-
if (!
|
|
324
|
-
const g = c.current, y = (g == null ? void 0 : g.offsetWidth) ?? 320, S = (g == null ? void 0 : g.offsetHeight) ?? 48, w = m.clientX -
|
|
325
|
-
r({ x: N, y:
|
|
326
|
-
}, []), p =
|
|
327
|
-
if (!(!
|
|
328
|
-
|
|
322
|
+
), f = $((m) => {
|
|
323
|
+
if (!a.current || a.current.pointerId !== m.pointerId) return;
|
|
324
|
+
const g = c.current, y = (g == null ? void 0 : g.offsetWidth) ?? 320, S = (g == null ? void 0 : g.offsetHeight) ?? 48, w = m.clientX - a.current.startX, k = m.clientY - a.current.startY, N = Math.max(8, Math.min(window.innerWidth - y - 8, a.current.originX + w)), E = Math.max(8, Math.min(window.innerHeight - S - 8, a.current.originY + k));
|
|
325
|
+
r({ x: N, y: E });
|
|
326
|
+
}, []), p = $((m) => {
|
|
327
|
+
if (!(!a.current || a.current.pointerId !== m.pointerId)) {
|
|
328
|
+
a.current = null, s(!1);
|
|
329
329
|
try {
|
|
330
330
|
m.currentTarget.releasePointerCapture(m.pointerId);
|
|
331
331
|
} catch {
|
|
@@ -342,7 +342,7 @@ function Rt({
|
|
|
342
342
|
return {
|
|
343
343
|
elementRef: c,
|
|
344
344
|
position: i,
|
|
345
|
-
isDragging:
|
|
345
|
+
isDragging: o,
|
|
346
346
|
style: v,
|
|
347
347
|
dragHandleProps: {
|
|
348
348
|
onPointerDown: l,
|
|
@@ -352,7 +352,7 @@ function Rt({
|
|
|
352
352
|
}
|
|
353
353
|
};
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function gn({ 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 mn({ className: e }) {
|
|
|
378
378
|
)
|
|
379
379
|
] });
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function vn({ 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,7 +404,7 @@ function gn({ className: e }) {
|
|
|
404
404
|
)
|
|
405
405
|
] });
|
|
406
406
|
}
|
|
407
|
-
const
|
|
407
|
+
const be = (e, t, i) => Math.min(i, Math.max(t, e));
|
|
408
408
|
function je(e) {
|
|
409
409
|
const t = e.trim();
|
|
410
410
|
if (!t) return null;
|
|
@@ -417,86 +417,86 @@ function je(e) {
|
|
|
417
417
|
};
|
|
418
418
|
const r = t.match(/^#([0-9a-f]{3})$/i);
|
|
419
419
|
if (r) {
|
|
420
|
-
const [s,
|
|
420
|
+
const [s, a, c] = r[1].split("");
|
|
421
421
|
return {
|
|
422
422
|
r: parseInt(s + s, 16),
|
|
423
|
-
g: parseInt(
|
|
423
|
+
g: parseInt(a + a, 16),
|
|
424
424
|
b: parseInt(c + c, 16)
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
|
-
const
|
|
428
|
-
return
|
|
429
|
-
r:
|
|
430
|
-
g:
|
|
431
|
-
b:
|
|
427
|
+
const o = t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
|
|
428
|
+
return o ? {
|
|
429
|
+
r: be(parseInt(o[1], 10), 0, 255),
|
|
430
|
+
g: be(parseInt(o[2], 10), 0, 255),
|
|
431
|
+
b: be(parseInt(o[3], 10), 0, 255)
|
|
432
432
|
} : null;
|
|
433
433
|
}
|
|
434
434
|
function Pt(e) {
|
|
435
|
-
const t = (i) =>
|
|
435
|
+
const t = (i) => be(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 bn(e) {
|
|
439
439
|
return `rgb(${e.r}, ${e.g}, ${e.b})`;
|
|
440
440
|
}
|
|
441
441
|
function Dt({ r: e, g: t, b: i }) {
|
|
442
|
-
const r = e / 255,
|
|
442
|
+
const r = e / 255, o = t / 255, s = i / 255, a = Math.max(r, o, s), c = Math.min(r, o, s), u = a - c;
|
|
443
443
|
let l = 0;
|
|
444
|
-
u !== 0 && (
|
|
445
|
-
const f =
|
|
444
|
+
u !== 0 && (a === r ? l = (o - s) / u % 6 : a === o ? l = (s - r) / u + 2 : l = (r - o) / u + 4, l *= 60, l < 0 && (l += 360));
|
|
445
|
+
const f = a === 0 ? 0 : u / a * 100, p = a * 100;
|
|
446
446
|
return { h: l, s: f, v: p };
|
|
447
447
|
}
|
|
448
448
|
function Ot({ h: e, s: t, v: i }) {
|
|
449
|
-
const r =
|
|
449
|
+
const r = be(t, 0, 100) / 100, o = be(i, 0, 100) / 100, s = o * r, a = s * (1 - Math.abs(e / 60 % 2 - 1)), c = o - s;
|
|
450
450
|
let u = 0, l = 0, f = 0;
|
|
451
451
|
const p = (e % 360 + 360) % 360;
|
|
452
|
-
return p < 60 ? (u = s, l =
|
|
452
|
+
return p < 60 ? (u = s, l = a) : p < 120 ? (u = a, l = s) : p < 180 ? (l = s, f = a) : p < 240 ? (l = a, f = s) : p < 300 ? (u = a, f = s) : (u = s, f = a), {
|
|
453
453
|
r: Math.round((u + c) * 255),
|
|
454
454
|
g: Math.round((l + c) * 255),
|
|
455
455
|
b: Math.round((f + c) * 255)
|
|
456
456
|
};
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function at(e) {
|
|
459
459
|
const t = je(e);
|
|
460
460
|
return t ? Dt(t) : { h: 0, s: 0, v: 45 };
|
|
461
461
|
}
|
|
462
|
-
function
|
|
462
|
+
function yn(e) {
|
|
463
463
|
return e.replace(/^#/, "").toUpperCase().slice(0, 6);
|
|
464
464
|
}
|
|
465
|
-
function
|
|
465
|
+
function wn(e, t) {
|
|
466
466
|
const i = e.replace(/[^0-9a-f]/gi, "").slice(0, 6);
|
|
467
467
|
return i.length < 6 ? t : je(`#${i}`) ?? t;
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function xn(e) {
|
|
470
470
|
return Pt(Ot(e));
|
|
471
471
|
}
|
|
472
|
-
function
|
|
473
|
-
const r = st((e - i.left) / i.width),
|
|
474
|
-
return { x: r * 100, y:
|
|
472
|
+
function Nn(e, t, i) {
|
|
473
|
+
const r = st((e - i.left) / i.width), o = st((t - i.top) / i.height);
|
|
474
|
+
return { x: r * 100, y: o * 100 };
|
|
475
475
|
}
|
|
476
476
|
function st(e) {
|
|
477
477
|
return Math.min(1, Math.max(0, e));
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function kn() {
|
|
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
484
|
function _e({ label: e, value: t, onChange: i }) {
|
|
485
|
-
const [r,
|
|
486
|
-
|
|
487
|
-
|
|
485
|
+
const [r, o] = A(!1), [s, a] = A(() => at(t)), c = X(null), u = X(null), l = X(null), f = jt(), [p, v] = A({ top: 0, left: 0, width: 260 }), m = Ot(s), g = yn(Pt(m)), y = je(t) ? t : bn(m), S = e.toLowerCase().includes("color") ? e : `${e} color`;
|
|
486
|
+
_(() => {
|
|
487
|
+
a(at(t));
|
|
488
488
|
}, [t]);
|
|
489
|
-
const w =
|
|
489
|
+
const w = $(
|
|
490
490
|
(x) => {
|
|
491
|
-
|
|
491
|
+
a(x), i(xn(x));
|
|
492
492
|
},
|
|
493
493
|
[i]
|
|
494
|
-
), k =
|
|
494
|
+
), k = $(
|
|
495
495
|
(x) => {
|
|
496
496
|
w(Dt(x));
|
|
497
497
|
},
|
|
498
498
|
[w]
|
|
499
|
-
), N =
|
|
499
|
+
), N = $(() => {
|
|
500
500
|
const x = c.current;
|
|
501
501
|
if (!x) return;
|
|
502
502
|
const I = x.getBoundingClientRect(), L = 260;
|
|
@@ -506,29 +506,29 @@ function _e({ label: e, value: t, onChange: i }) {
|
|
|
506
506
|
const U = 320;
|
|
507
507
|
F + U > window.innerHeight - 12 && (F = Math.max(12, I.top - U - 8)), v({ top: F, left: h, width: L });
|
|
508
508
|
}, []);
|
|
509
|
-
|
|
509
|
+
_(() => {
|
|
510
510
|
if (!r) return;
|
|
511
511
|
N();
|
|
512
512
|
const x = (L) => {
|
|
513
513
|
var F, U;
|
|
514
514
|
const h = L.target;
|
|
515
|
-
(F = c.current) != null && F.contains(h) || (U = u.current) != null && U.contains(h) ||
|
|
515
|
+
(F = c.current) != null && F.contains(h) || (U = u.current) != null && U.contains(h) || o(!1);
|
|
516
516
|
}, I = (L) => {
|
|
517
|
-
L.key === "Escape" &&
|
|
517
|
+
L.key === "Escape" && o(!1);
|
|
518
518
|
};
|
|
519
519
|
return window.addEventListener("mousedown", x, !0), window.addEventListener("keydown", I), window.addEventListener("resize", N), window.addEventListener("scroll", N, !0), () => {
|
|
520
520
|
window.removeEventListener("mousedown", x, !0), window.removeEventListener("keydown", I), window.removeEventListener("resize", N), window.removeEventListener("scroll", N, !0);
|
|
521
521
|
};
|
|
522
522
|
}, [r, N]);
|
|
523
|
-
const
|
|
523
|
+
const E = (x, I) => {
|
|
524
524
|
var U;
|
|
525
525
|
const L = (U = l.current) == null ? void 0 : U.getBoundingClientRect();
|
|
526
526
|
if (!L) return;
|
|
527
|
-
const { x: h, y: F } =
|
|
527
|
+
const { x: h, y: F } = Nn(x, I, L);
|
|
528
528
|
w({ ...s, s: h, v: 100 - F });
|
|
529
|
-
},
|
|
530
|
-
x.preventDefault(),
|
|
531
|
-
const I = (h) =>
|
|
529
|
+
}, z = (x) => {
|
|
530
|
+
x.preventDefault(), E(x.clientX, x.clientY);
|
|
531
|
+
const I = (h) => E(h.clientX, h.clientY), L = () => {
|
|
532
532
|
window.removeEventListener("mousemove", I), window.removeEventListener("mouseup", L);
|
|
533
533
|
};
|
|
534
534
|
window.addEventListener("mousemove", I), window.addEventListener("mouseup", L);
|
|
@@ -538,7 +538,7 @@ function _e({ label: e, value: t, onChange: i }) {
|
|
|
538
538
|
{
|
|
539
539
|
className: "pa-root pa-root--toolbar-portal pa-color-picker-portal",
|
|
540
540
|
"data-pixelagent-picker-portal": !0,
|
|
541
|
-
...
|
|
541
|
+
...kn(),
|
|
542
542
|
children: /* @__PURE__ */ d(
|
|
543
543
|
"div",
|
|
544
544
|
{
|
|
@@ -566,7 +566,7 @@ function _e({ label: e, value: t, onChange: i }) {
|
|
|
566
566
|
ref: l,
|
|
567
567
|
className: "pa-color-picker-sb",
|
|
568
568
|
style: { "--pa-picker-h": String(Math.round(s.h)) },
|
|
569
|
-
onMouseDown:
|
|
569
|
+
onMouseDown: z,
|
|
570
570
|
children: /* @__PURE__ */ n(
|
|
571
571
|
"span",
|
|
572
572
|
{
|
|
@@ -608,7 +608,7 @@ function _e({ label: e, value: t, onChange: i }) {
|
|
|
608
608
|
type: "text",
|
|
609
609
|
value: g,
|
|
610
610
|
spellCheck: !1,
|
|
611
|
-
onChange: (x) => k(
|
|
611
|
+
onChange: (x) => k(wn(x.target.value, m))
|
|
612
612
|
}
|
|
613
613
|
)
|
|
614
614
|
] }),
|
|
@@ -623,7 +623,7 @@ function _e({ label: e, value: t, onChange: i }) {
|
|
|
623
623
|
max: 255,
|
|
624
624
|
value: m[x],
|
|
625
625
|
onChange: (I) => {
|
|
626
|
-
const L =
|
|
626
|
+
const L = Cn(parseInt(I.target.value, 10));
|
|
627
627
|
k({ ...m, [x]: L });
|
|
628
628
|
}
|
|
629
629
|
}
|
|
@@ -648,7 +648,7 @@ function _e({ label: e, value: t, onChange: i }) {
|
|
|
648
648
|
"aria-haspopup": "dialog",
|
|
649
649
|
"aria-controls": r ? f : void 0,
|
|
650
650
|
onClick: () => {
|
|
651
|
-
r || N(),
|
|
651
|
+
r || N(), o((x) => !x);
|
|
652
652
|
},
|
|
653
653
|
children: [
|
|
654
654
|
/* @__PURE__ */ n("span", { className: "pa-color-field-swatch", style: { backgroundColor: y }, "aria-hidden": "true" }),
|
|
@@ -669,19 +669,19 @@ function _e({ label: e, value: t, onChange: i }) {
|
|
|
669
669
|
R
|
|
670
670
|
] });
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function Cn(e) {
|
|
673
673
|
return Number.isFinite(e) ? Math.min(255, Math.max(0, e)) : 0;
|
|
674
674
|
}
|
|
675
|
-
function
|
|
676
|
-
const [
|
|
677
|
-
return /* @__PURE__ */ d("section", { className: `pa-edit-section ${
|
|
675
|
+
function fe({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
|
|
676
|
+
const [o, s] = A(i);
|
|
677
|
+
return /* @__PURE__ */ d("section", { className: `pa-edit-section ${o ? "pa-edit-section--open" : ""}`, children: [
|
|
678
678
|
/* @__PURE__ */ d(
|
|
679
679
|
"button",
|
|
680
680
|
{
|
|
681
681
|
type: "button",
|
|
682
682
|
className: "pa-edit-section-header",
|
|
683
|
-
"aria-expanded":
|
|
684
|
-
onClick: () => s((
|
|
683
|
+
"aria-expanded": o,
|
|
684
|
+
onClick: () => s((a) => !a),
|
|
685
685
|
children: [
|
|
686
686
|
/* @__PURE__ */ n("span", { className: "pa-edit-section-title", children: e }),
|
|
687
687
|
r ? /* @__PURE__ */ n("span", { className: "pa-edit-section-badge", children: r }) : null,
|
|
@@ -689,10 +689,10 @@ function ue({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
|
|
|
689
689
|
]
|
|
690
690
|
}
|
|
691
691
|
),
|
|
692
|
-
|
|
692
|
+
o ? /* @__PURE__ */ n("div", { className: "pa-edit-section-body", children: t }) : null
|
|
693
693
|
] });
|
|
694
694
|
}
|
|
695
|
-
const
|
|
695
|
+
const me = [
|
|
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 pe = [
|
|
|
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
|
-
],
|
|
708
|
+
], Te = "";
|
|
709
709
|
function Le(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 Mn(e) {
|
|
714
714
|
const t = e.trim();
|
|
715
715
|
if (!t)
|
|
716
716
|
return {
|
|
717
|
-
selectValue:
|
|
718
|
-
options:
|
|
717
|
+
selectValue: Te,
|
|
718
|
+
options: me
|
|
719
719
|
};
|
|
720
|
-
const i = Le(t).toLowerCase(), r =
|
|
720
|
+
const i = Le(t).toLowerCase(), r = me.find(
|
|
721
721
|
(s) => s.value === t || Le(s.value).toLowerCase() === i
|
|
722
722
|
);
|
|
723
723
|
if (r)
|
|
724
|
-
return { selectValue: r.value, options:
|
|
725
|
-
const
|
|
726
|
-
const
|
|
727
|
-
return t.toLowerCase().includes(
|
|
724
|
+
return { selectValue: r.value, options: me };
|
|
725
|
+
const o = me.find((s) => {
|
|
726
|
+
const a = Le(s.value).toLowerCase();
|
|
727
|
+
return t.toLowerCase().includes(a) || a.includes(i);
|
|
728
728
|
});
|
|
729
|
-
return
|
|
729
|
+
return o ? { selectValue: o.value, options: me } : {
|
|
730
730
|
selectValue: t,
|
|
731
731
|
options: [
|
|
732
|
-
...
|
|
732
|
+
...me,
|
|
733
733
|
{ value: t, label: Le(t) || "Custom" }
|
|
734
734
|
]
|
|
735
735
|
};
|
|
736
736
|
}
|
|
737
|
-
function
|
|
738
|
-
const { selectValue: i, options: r } =
|
|
739
|
-
() =>
|
|
737
|
+
function An({ value: e, onChange: t }) {
|
|
738
|
+
const { selectValue: i, options: r } = Me(
|
|
739
|
+
() => Mn(e),
|
|
740
740
|
[e]
|
|
741
741
|
);
|
|
742
742
|
return /* @__PURE__ */ d("label", { className: "pa-edit-stack-field", children: [
|
|
@@ -745,14 +745,14 @@ function Mn({ value: e, onChange: t }) {
|
|
|
745
745
|
"select",
|
|
746
746
|
{
|
|
747
747
|
className: "pa-select pa-font-family-select",
|
|
748
|
-
value: i ||
|
|
749
|
-
onChange: (
|
|
750
|
-
const s =
|
|
751
|
-
s && s !==
|
|
748
|
+
value: i || Te,
|
|
749
|
+
onChange: (o) => {
|
|
750
|
+
const s = o.target.value;
|
|
751
|
+
s && s !== Te && t(s);
|
|
752
752
|
},
|
|
753
753
|
children: [
|
|
754
|
-
/* @__PURE__ */ n("option", { value:
|
|
755
|
-
r.map((
|
|
754
|
+
/* @__PURE__ */ n("option", { value: Te, disabled: !0, children: "Select font style" }),
|
|
755
|
+
r.map((o) => /* @__PURE__ */ n("option", { value: o.value, children: o.label }, o.value))
|
|
756
756
|
]
|
|
757
757
|
}
|
|
758
758
|
)
|
|
@@ -762,7 +762,7 @@ function qe(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 Sn(e) {
|
|
766
766
|
const t = e.trim();
|
|
767
767
|
if (!t) return null;
|
|
768
768
|
if (t.endsWith("%")) {
|
|
@@ -772,7 +772,7 @@ function An(e) {
|
|
|
772
772
|
const i = parseFloat(t);
|
|
773
773
|
return Number.isFinite(i) && i >= 0 && i <= 1 ? i : null;
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function Ln(e) {
|
|
776
776
|
const t = Ft(e);
|
|
777
777
|
if (t !== null) return t > 0;
|
|
778
778
|
const i = qe(e);
|
|
@@ -781,12 +781,12 @@ function Sn(e) {
|
|
|
781
781
|
function Ft(e) {
|
|
782
782
|
const t = e.trim().split(/\s+/).filter(Boolean);
|
|
783
783
|
if (t.length === 0) return null;
|
|
784
|
-
const i = t.map((
|
|
785
|
-
if (i.some((
|
|
784
|
+
const i = t.map((o) => qe(o));
|
|
785
|
+
if (i.some((o) => o === null)) return null;
|
|
786
786
|
const r = i[0];
|
|
787
|
-
return i.every((
|
|
787
|
+
return i.every((o) => o === r) ? r : null;
|
|
788
788
|
}
|
|
789
|
-
const
|
|
789
|
+
const $n = {
|
|
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" },
|
|
@@ -803,7 +803,7 @@ const Ln = {
|
|
|
803
803
|
function En(e, t, i) {
|
|
804
804
|
switch (i.kind) {
|
|
805
805
|
case "opacity":
|
|
806
|
-
return
|
|
806
|
+
return Sn(t);
|
|
807
807
|
case "px":
|
|
808
808
|
return qe(t);
|
|
809
809
|
case "uniform-px":
|
|
@@ -812,7 +812,7 @@ function En(e, t, i) {
|
|
|
812
812
|
return null;
|
|
813
813
|
}
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function In(e, t, i) {
|
|
816
816
|
switch (i.kind) {
|
|
817
817
|
case "opacity":
|
|
818
818
|
return String(Math.round(t * 100) / 100);
|
|
@@ -823,14 +823,14 @@ function $n(e, t, i) {
|
|
|
823
823
|
return String(t);
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
|
-
function
|
|
826
|
+
function se({
|
|
827
827
|
property: e,
|
|
828
828
|
label: t,
|
|
829
829
|
value: i,
|
|
830
830
|
onChange: r,
|
|
831
|
-
compact:
|
|
831
|
+
compact: o = !1
|
|
832
832
|
}) {
|
|
833
|
-
const s =
|
|
833
|
+
const s = $n[e] ?? { kind: "text" }, a = En(e, i, s), c = s.kind !== "text" && a !== null, u = o ? "pa-prop-row pa-prop-row--compact" : "pa-prop-row", l = o ? "pa-edit-field-label" : "pa-prop-label";
|
|
834
834
|
if (!c)
|
|
835
835
|
return /* @__PURE__ */ d("label", { className: u, children: [
|
|
836
836
|
/* @__PURE__ */ n("span", { className: l, children: t }),
|
|
@@ -845,7 +845,7 @@ function ie({
|
|
|
845
845
|
)
|
|
846
846
|
] });
|
|
847
847
|
const f = s.min ?? 0, p = s.max ?? 100, v = s.step ?? 1, m = (g) => {
|
|
848
|
-
r(
|
|
848
|
+
r(In(e, g, s));
|
|
849
849
|
};
|
|
850
850
|
return /* @__PURE__ */ d("label", { className: `${u} pa-prop-row--slider`, children: [
|
|
851
851
|
/* @__PURE__ */ n("span", { className: l, children: t }),
|
|
@@ -858,7 +858,7 @@ function ie({
|
|
|
858
858
|
min: f,
|
|
859
859
|
max: p,
|
|
860
860
|
step: v,
|
|
861
|
-
value:
|
|
861
|
+
value: a,
|
|
862
862
|
"aria-valuetext": i,
|
|
863
863
|
onChange: (g) => m(parseFloat(g.target.value))
|
|
864
864
|
}
|
|
@@ -876,36 +876,36 @@ function ie({
|
|
|
876
876
|
] })
|
|
877
877
|
] });
|
|
878
878
|
}
|
|
879
|
-
function
|
|
879
|
+
function Rn(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];
|
|
883
883
|
if (t.length === 2) return { top: i, right: r, bottom: i, left: r };
|
|
884
|
-
const
|
|
885
|
-
return t.length === 3 ? { top: i, right: r, bottom:
|
|
884
|
+
const o = t[2];
|
|
885
|
+
return t.length === 3 ? { top: i, right: r, bottom: o, left: r } : { top: i, right: r, bottom: o, left: t[3] };
|
|
886
886
|
}
|
|
887
887
|
function Tn({ 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 ue(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 pe(e) {
|
|
895
895
|
const t = e.trim();
|
|
896
896
|
return t === "" ? "0px" : /^-?\d+(?:\.\d+)?$/.test(t) ? `${t}px` : t;
|
|
897
897
|
}
|
|
898
898
|
function lt(e, t) {
|
|
899
|
-
return e === t ?
|
|
899
|
+
return e === t ? ue(e) : `${ue(e)}, ${ue(t)}`;
|
|
900
900
|
}
|
|
901
901
|
function ct(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 = pe(i[0]);
|
|
906
906
|
return [r, r];
|
|
907
907
|
}
|
|
908
|
-
return [
|
|
908
|
+
return [pe(i[0]), pe(i[1])];
|
|
909
909
|
}
|
|
910
910
|
const dt = 12, Je = {
|
|
911
911
|
width: dt,
|
|
@@ -914,21 +914,21 @@ const dt = 12, Je = {
|
|
|
914
914
|
fill: "none",
|
|
915
915
|
"aria-hidden": !0
|
|
916
916
|
};
|
|
917
|
-
function
|
|
917
|
+
function Pn() {
|
|
918
918
|
return /* @__PURE__ */ d("svg", { ...Je, 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
|
|
924
|
+
function Dn() {
|
|
925
925
|
return /* @__PURE__ */ d("svg", { ...Je, 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 $e({ 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 },
|
|
@@ -940,7 +940,7 @@ function Ee({ side: e }) {
|
|
|
940
940
|
/* @__PURE__ */ n("line", { ...t, stroke: "currentColor", strokeWidth: "1.5" })
|
|
941
941
|
] });
|
|
942
942
|
}
|
|
943
|
-
function
|
|
943
|
+
function On() {
|
|
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,10 +948,10 @@ function Dn() {
|
|
|
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 [s,
|
|
953
|
-
return
|
|
954
|
-
|
|
951
|
+
function ge({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: o }) {
|
|
952
|
+
const [s, a] = A(t);
|
|
953
|
+
return _(() => {
|
|
954
|
+
a(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 }),
|
|
957
957
|
/* @__PURE__ */ n(
|
|
@@ -960,10 +960,10 @@ function he({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
|
|
|
960
960
|
className: "pa-input pa-spacing-cell-input",
|
|
961
961
|
type: "text",
|
|
962
962
|
value: s,
|
|
963
|
-
onChange: (c) =>
|
|
964
|
-
onBlur: () =>
|
|
963
|
+
onChange: (c) => a(c.target.value),
|
|
964
|
+
onBlur: () => o(s),
|
|
965
965
|
onKeyDown: (c) => {
|
|
966
|
-
c.key === "Enter" && c.target.blur(), c.key === "Escape" && (
|
|
966
|
+
c.key === "Enter" && c.target.blur(), c.key === "Escape" && (a(t), c.target.blur());
|
|
967
967
|
},
|
|
968
968
|
"aria-label": i,
|
|
969
969
|
spellCheck: !1
|
|
@@ -972,7 +972,7 @@ function he({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
|
|
|
972
972
|
] });
|
|
973
973
|
}
|
|
974
974
|
function ut({ label: e, value: t, onChange: i }) {
|
|
975
|
-
const r =
|
|
975
|
+
const r = Rn(t), [o, s] = A(!1), a = (l) => {
|
|
976
976
|
i(Tn({ ...r, ...l }));
|
|
977
977
|
}, c = r.left !== r.right, u = r.top !== r.bottom;
|
|
978
978
|
return /* @__PURE__ */ d("div", { className: "pa-prop-row pa-prop-row--compact pa-spacing-row", children: [
|
|
@@ -980,74 +980,74 @@ function ut({ label: e, value: t, onChange: i }) {
|
|
|
980
980
|
/* @__PURE__ */ d(
|
|
981
981
|
"div",
|
|
982
982
|
{
|
|
983
|
-
className: `pa-spacing-control ${
|
|
983
|
+
className: `pa-spacing-control ${o ? "pa-spacing-control--split" : "pa-spacing-control--pair"}`,
|
|
984
984
|
children: [
|
|
985
|
-
|
|
985
|
+
o ? (
|
|
986
986
|
// Grid mirrors pair-view columns:
|
|
987
987
|
// Col 1 (horizontal pair) → L on top, R on bottom
|
|
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
|
+
ge,
|
|
992
992
|
{
|
|
993
|
-
icon: /* @__PURE__ */ n(
|
|
994
|
-
display:
|
|
993
|
+
icon: /* @__PURE__ */ n($e, { side: "left" }),
|
|
994
|
+
display: ue(r.left),
|
|
995
995
|
ariaLabel: `${e} left`,
|
|
996
|
-
onCommit: (l) =>
|
|
996
|
+
onCommit: (l) => a({ left: pe(l) })
|
|
997
997
|
}
|
|
998
998
|
),
|
|
999
999
|
/* @__PURE__ */ n(
|
|
1000
|
-
|
|
1000
|
+
ge,
|
|
1001
1001
|
{
|
|
1002
|
-
icon: /* @__PURE__ */ n(
|
|
1003
|
-
display:
|
|
1002
|
+
icon: /* @__PURE__ */ n($e, { side: "top" }),
|
|
1003
|
+
display: ue(r.top),
|
|
1004
1004
|
ariaLabel: `${e} top`,
|
|
1005
|
-
onCommit: (l) =>
|
|
1005
|
+
onCommit: (l) => a({ top: pe(l) })
|
|
1006
1006
|
}
|
|
1007
1007
|
),
|
|
1008
1008
|
/* @__PURE__ */ n(
|
|
1009
|
-
|
|
1009
|
+
ge,
|
|
1010
1010
|
{
|
|
1011
|
-
icon: /* @__PURE__ */ n(
|
|
1012
|
-
display:
|
|
1011
|
+
icon: /* @__PURE__ */ n($e, { side: "right" }),
|
|
1012
|
+
display: ue(r.right),
|
|
1013
1013
|
ariaLabel: `${e} right`,
|
|
1014
|
-
onCommit: (l) =>
|
|
1014
|
+
onCommit: (l) => a({ right: pe(l) })
|
|
1015
1015
|
}
|
|
1016
1016
|
),
|
|
1017
1017
|
/* @__PURE__ */ n(
|
|
1018
|
-
|
|
1018
|
+
ge,
|
|
1019
1019
|
{
|
|
1020
|
-
icon: /* @__PURE__ */ n(
|
|
1021
|
-
display:
|
|
1020
|
+
icon: /* @__PURE__ */ n($e, { side: "bottom" }),
|
|
1021
|
+
display: ue(r.bottom),
|
|
1022
1022
|
ariaLabel: `${e} bottom`,
|
|
1023
|
-
onCommit: (l) =>
|
|
1023
|
+
onCommit: (l) => a({ bottom: pe(l) })
|
|
1024
1024
|
}
|
|
1025
1025
|
)
|
|
1026
1026
|
] })
|
|
1027
1027
|
) : /* @__PURE__ */ d("div", { className: "pa-spacing-pair", children: [
|
|
1028
1028
|
/* @__PURE__ */ n(
|
|
1029
|
-
|
|
1029
|
+
ge,
|
|
1030
1030
|
{
|
|
1031
|
-
icon: /* @__PURE__ */ n(
|
|
1031
|
+
icon: /* @__PURE__ */ n(Pn, {}),
|
|
1032
1032
|
display: lt(r.left, r.right),
|
|
1033
1033
|
mixed: c,
|
|
1034
1034
|
ariaLabel: `${e} horizontal`,
|
|
1035
1035
|
onCommit: (l) => {
|
|
1036
1036
|
const [f, p] = ct(l, r.left);
|
|
1037
|
-
|
|
1037
|
+
a({ left: f, right: p });
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
1040
|
),
|
|
1041
1041
|
/* @__PURE__ */ n(
|
|
1042
|
-
|
|
1042
|
+
ge,
|
|
1043
1043
|
{
|
|
1044
|
-
icon: /* @__PURE__ */ n(
|
|
1044
|
+
icon: /* @__PURE__ */ n(Dn, {}),
|
|
1045
1045
|
display: lt(r.top, r.bottom),
|
|
1046
1046
|
mixed: u,
|
|
1047
1047
|
ariaLabel: `${e} vertical`,
|
|
1048
1048
|
onCommit: (l) => {
|
|
1049
1049
|
const [f, p] = ct(l, r.top);
|
|
1050
|
-
|
|
1050
|
+
a({ top: f, bottom: p });
|
|
1051
1051
|
}
|
|
1052
1052
|
}
|
|
1053
1053
|
)
|
|
@@ -1056,12 +1056,12 @@ function ut({ label: e, value: t, onChange: i }) {
|
|
|
1056
1056
|
"button",
|
|
1057
1057
|
{
|
|
1058
1058
|
type: "button",
|
|
1059
|
-
className: `pa-spacing-toggle ${
|
|
1059
|
+
className: `pa-spacing-toggle ${o ? "pa-spacing-toggle--on" : ""}`,
|
|
1060
1060
|
onClick: () => s((l) => !l),
|
|
1061
|
-
"aria-pressed":
|
|
1062
|
-
"aria-label":
|
|
1063
|
-
title:
|
|
1064
|
-
children: /* @__PURE__ */ n(
|
|
1061
|
+
"aria-pressed": o,
|
|
1062
|
+
"aria-label": o ? "Collapse to pair view" : "Expand to per-side view",
|
|
1063
|
+
title: o ? "Collapse to pair view" : "Expand to per-side view",
|
|
1064
|
+
children: /* @__PURE__ */ n(On, {})
|
|
1065
1065
|
}
|
|
1066
1066
|
)
|
|
1067
1067
|
]
|
|
@@ -1069,27 +1069,27 @@ function ut({ label: e, value: t, onChange: i }) {
|
|
|
1069
1069
|
)
|
|
1070
1070
|
] });
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function Fn({
|
|
1073
1073
|
options: e,
|
|
1074
1074
|
value: t,
|
|
1075
1075
|
ariaLabel: i,
|
|
1076
1076
|
onChange: r
|
|
1077
1077
|
}) {
|
|
1078
|
-
return /* @__PURE__ */ n("div", { className: "pa-segmented", role: "group", "aria-label": i, children: e.map((
|
|
1078
|
+
return /* @__PURE__ */ n("div", { className: "pa-segmented", role: "group", "aria-label": i, children: e.map((o) => /* @__PURE__ */ n(
|
|
1079
1079
|
"button",
|
|
1080
1080
|
{
|
|
1081
1081
|
type: "button",
|
|
1082
|
-
className: `pa-segmented-btn ${t ===
|
|
1083
|
-
title:
|
|
1084
|
-
"aria-pressed": t ===
|
|
1085
|
-
"aria-label":
|
|
1086
|
-
onClick: () => r == null ? void 0 : r(
|
|
1087
|
-
children:
|
|
1082
|
+
className: `pa-segmented-btn ${t === o.value ? "pa-segmented-btn--on" : ""}`,
|
|
1083
|
+
title: o.title,
|
|
1084
|
+
"aria-pressed": t === o.value,
|
|
1085
|
+
"aria-label": o.title,
|
|
1086
|
+
onClick: () => r == null ? void 0 : r(o.value),
|
|
1087
|
+
children: o.content
|
|
1088
1088
|
},
|
|
1089
|
-
|
|
1089
|
+
o.value
|
|
1090
1090
|
)) });
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1092
|
+
function Bn({
|
|
1093
1093
|
options: e,
|
|
1094
1094
|
ariaLabel: t,
|
|
1095
1095
|
onToggle: i
|
|
@@ -1108,7 +1108,7 @@ function Fn({
|
|
|
1108
1108
|
r.id
|
|
1109
1109
|
)) });
|
|
1110
1110
|
}
|
|
1111
|
-
function
|
|
1111
|
+
function zn({ 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 Bn({ className: e }) {
|
|
|
1117
1117
|
}
|
|
1118
1118
|
) });
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function _n({ 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 zn({ className: e }) {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
) });
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1129
|
+
function Hn({ 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 _n({ className: e }) {
|
|
|
1135
1135
|
}
|
|
1136
1136
|
) });
|
|
1137
1137
|
}
|
|
1138
|
-
function
|
|
1138
|
+
function Vn({ 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 Wn({ 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
|
{
|
|
@@ -1151,13 +1151,13 @@ function Bt(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
|
|
1154
|
+
function Un(e) {
|
|
1155
1155
|
return Bt(e) ? "400" : "700";
|
|
1156
1156
|
}
|
|
1157
1157
|
function zt(e) {
|
|
1158
1158
|
return e.trim() === "italic" || e.trim() === "oblique";
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1160
|
+
function Yn(e) {
|
|
1161
1161
|
return zt(e) ? "normal" : "italic";
|
|
1162
1162
|
}
|
|
1163
1163
|
function pt(e, t) {
|
|
@@ -1169,7 +1169,7 @@ function ht(e, t) {
|
|
|
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 Xn(e) {
|
|
1173
1173
|
const t = e.trim();
|
|
1174
1174
|
return t === "center" || t === "right" || t === "justify" ? t : "left";
|
|
1175
1175
|
}
|
|
@@ -1193,15 +1193,15 @@ const ft = [
|
|
|
1193
1193
|
"inline-grid",
|
|
1194
1194
|
"none",
|
|
1195
1195
|
"contents"
|
|
1196
|
-
],
|
|
1197
|
-
function
|
|
1196
|
+
], Gn = /* @__PURE__ */ new Set(["flex", "inline-flex", "grid", "inline-grid"]);
|
|
1197
|
+
function Kn({
|
|
1198
1198
|
values: e,
|
|
1199
1199
|
onPropertyChange: t,
|
|
1200
1200
|
textKind: i,
|
|
1201
1201
|
textValue: r,
|
|
1202
|
-
onTextChange:
|
|
1202
|
+
onTextChange: o,
|
|
1203
1203
|
targetScope: s,
|
|
1204
|
-
onTargetScopeChange:
|
|
1204
|
+
onTargetScopeChange: a,
|
|
1205
1205
|
elementState: c,
|
|
1206
1206
|
onElementStateChange: u,
|
|
1207
1207
|
instanceCount: l,
|
|
@@ -1209,11 +1209,11 @@ function Gn({
|
|
|
1209
1209
|
stateHint: p
|
|
1210
1210
|
}) {
|
|
1211
1211
|
var I, L;
|
|
1212
|
-
const v = e["font-weight"] ?? "", m = e["font-style"] ?? "normal", g = e["text-decoration"] ?? "none", y =
|
|
1212
|
+
const v = e["font-weight"] ?? "", m = e["font-style"] ?? "normal", g = e["text-decoration"] ?? "none", y = Xn(e["text-align"] ?? "left"), S = ((I = e.display) == null ? void 0 : I.trim()) ?? "", w = !!S, k = Gn.has(S), N = [...mt];
|
|
1213
1213
|
S && !mt.includes(S) && N.push(S);
|
|
1214
|
-
const
|
|
1214
|
+
const E = ((L = e.gap) == null ? void 0 : L.trim()) ?? "", z = E === "normal" || E === "" ? "0px" : E, R = e["border-style"] ?? "none", x = [...ft];
|
|
1215
1215
|
return R && !ft.includes(R) && x.push(R), /* @__PURE__ */ d("div", { className: "pa-edit-sections", children: [
|
|
1216
|
-
/* @__PURE__ */ d(
|
|
1216
|
+
/* @__PURE__ */ d(fe, { 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" }),
|
|
@@ -1222,7 +1222,7 @@ function Gn({
|
|
|
1222
1222
|
{
|
|
1223
1223
|
className: "pa-select",
|
|
1224
1224
|
value: s,
|
|
1225
|
-
onChange: (h) =>
|
|
1225
|
+
onChange: (h) => a(h.target.value),
|
|
1226
1226
|
children: [
|
|
1227
1227
|
/* @__PURE__ */ n("option", { value: "this-instance", children: "This instance" }),
|
|
1228
1228
|
/* @__PURE__ */ d("option", { value: "all-instances", disabled: l <= 1, children: [
|
|
@@ -1256,22 +1256,22 @@ function Gn({
|
|
|
1256
1256
|
f ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: f }) : null,
|
|
1257
1257
|
p ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: p }) : null
|
|
1258
1258
|
] }),
|
|
1259
|
-
i !== "none" && /* @__PURE__ */ n(
|
|
1259
|
+
i !== "none" && /* @__PURE__ */ n(fe, { 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",
|
|
1263
1263
|
{
|
|
1264
1264
|
className: "pa-textarea pa-edit-text-input",
|
|
1265
1265
|
value: r,
|
|
1266
|
-
onChange: (h) =>
|
|
1266
|
+
onChange: (h) => o(h.target.value),
|
|
1267
1267
|
rows: i === "value" ? 2 : 3,
|
|
1268
1268
|
placeholder: "Edit visible text…"
|
|
1269
1269
|
}
|
|
1270
1270
|
)
|
|
1271
1271
|
] }) }),
|
|
1272
|
-
/* @__PURE__ */ d(
|
|
1272
|
+
/* @__PURE__ */ d(fe, { title: "Typography", defaultOpen: !0, children: [
|
|
1273
1273
|
/* @__PURE__ */ n(
|
|
1274
|
-
|
|
1274
|
+
An,
|
|
1275
1275
|
{
|
|
1276
1276
|
value: e["font-family"] ?? "",
|
|
1277
1277
|
onChange: (h) => t("font-family", h)
|
|
@@ -1280,7 +1280,7 @@ function Gn({
|
|
|
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
|
+
Bn,
|
|
1284
1284
|
{
|
|
1285
1285
|
ariaLabel: "Text style",
|
|
1286
1286
|
options: [
|
|
@@ -1306,11 +1306,11 @@ function Gn({
|
|
|
1306
1306
|
id: "strikethrough",
|
|
1307
1307
|
title: "Strikethrough",
|
|
1308
1308
|
pressed: pt(g, "line-through"),
|
|
1309
|
-
content: /* @__PURE__ */ n(
|
|
1309
|
+
content: /* @__PURE__ */ n(Wn, { className: "pa-segmented-icon" })
|
|
1310
1310
|
}
|
|
1311
1311
|
],
|
|
1312
1312
|
onToggle: (h) => {
|
|
1313
|
-
h === "bold" ? t("font-weight",
|
|
1313
|
+
h === "bold" ? t("font-weight", Un(v)) : h === "italic" ? t("font-style", Yn(m)) : h === "underline" ? t(
|
|
1314
1314
|
"text-decoration",
|
|
1315
1315
|
ht(g, "underline")
|
|
1316
1316
|
) : h === "strikethrough" && t(
|
|
@@ -1324,7 +1324,7 @@ function Gn({
|
|
|
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
|
+
Fn,
|
|
1328
1328
|
{
|
|
1329
1329
|
ariaLabel: "Text align",
|
|
1330
1330
|
value: y,
|
|
@@ -1333,22 +1333,22 @@ function Gn({
|
|
|
1333
1333
|
{
|
|
1334
1334
|
value: "left",
|
|
1335
1335
|
title: "Align left",
|
|
1336
|
-
content: /* @__PURE__ */ n(
|
|
1336
|
+
content: /* @__PURE__ */ n(zn, { 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(_n, { 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(Hn, { className: "pa-segmented-icon" })
|
|
1347
1347
|
},
|
|
1348
1348
|
{
|
|
1349
1349
|
value: "justify",
|
|
1350
1350
|
title: "Justify",
|
|
1351
|
-
content: /* @__PURE__ */ n(
|
|
1351
|
+
content: /* @__PURE__ */ n(Vn, { className: "pa-segmented-icon" })
|
|
1352
1352
|
}
|
|
1353
1353
|
]
|
|
1354
1354
|
}
|
|
@@ -1356,7 +1356,7 @@ function Gn({
|
|
|
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
|
+
se,
|
|
1360
1360
|
{
|
|
1361
1361
|
compact: !0,
|
|
1362
1362
|
property: "font-size",
|
|
@@ -1366,7 +1366,7 @@ function Gn({
|
|
|
1366
1366
|
}
|
|
1367
1367
|
),
|
|
1368
1368
|
/* @__PURE__ */ n(
|
|
1369
|
-
|
|
1369
|
+
se,
|
|
1370
1370
|
{
|
|
1371
1371
|
compact: !0,
|
|
1372
1372
|
property: "line-height",
|
|
@@ -1385,10 +1385,10 @@ function Gn({
|
|
|
1385
1385
|
}
|
|
1386
1386
|
)
|
|
1387
1387
|
] }),
|
|
1388
|
-
/* @__PURE__ */ d(
|
|
1388
|
+
/* @__PURE__ */ d(fe, { title: "Layout", defaultOpen: !0, children: [
|
|
1389
1389
|
/* @__PURE__ */ d("div", { className: "pa-edit-split-fields", children: [
|
|
1390
1390
|
/* @__PURE__ */ n(
|
|
1391
|
-
|
|
1391
|
+
se,
|
|
1392
1392
|
{
|
|
1393
1393
|
compact: !0,
|
|
1394
1394
|
property: "width",
|
|
@@ -1398,7 +1398,7 @@ function Gn({
|
|
|
1398
1398
|
}
|
|
1399
1399
|
),
|
|
1400
1400
|
/* @__PURE__ */ n(
|
|
1401
|
-
|
|
1401
|
+
se,
|
|
1402
1402
|
{
|
|
1403
1403
|
compact: !0,
|
|
1404
1404
|
property: "height",
|
|
@@ -1439,17 +1439,17 @@ function Gn({
|
|
|
1439
1439
|
)
|
|
1440
1440
|
] }),
|
|
1441
1441
|
k && /* @__PURE__ */ n(
|
|
1442
|
-
|
|
1442
|
+
se,
|
|
1443
1443
|
{
|
|
1444
1444
|
compact: !0,
|
|
1445
1445
|
property: "gap",
|
|
1446
1446
|
label: "Gap",
|
|
1447
|
-
value:
|
|
1447
|
+
value: z,
|
|
1448
1448
|
onChange: (h) => t("gap", h)
|
|
1449
1449
|
}
|
|
1450
1450
|
)
|
|
1451
1451
|
] }),
|
|
1452
|
-
/* @__PURE__ */ d(
|
|
1452
|
+
/* @__PURE__ */ d(fe, { title: "Fill", children: [
|
|
1453
1453
|
/* @__PURE__ */ n(
|
|
1454
1454
|
_e,
|
|
1455
1455
|
{
|
|
@@ -1459,7 +1459,7 @@ function Gn({
|
|
|
1459
1459
|
}
|
|
1460
1460
|
),
|
|
1461
1461
|
/* @__PURE__ */ n(
|
|
1462
|
-
|
|
1462
|
+
se,
|
|
1463
1463
|
{
|
|
1464
1464
|
compact: !0,
|
|
1465
1465
|
property: "opacity",
|
|
@@ -1469,7 +1469,7 @@ function Gn({
|
|
|
1469
1469
|
}
|
|
1470
1470
|
)
|
|
1471
1471
|
] }),
|
|
1472
|
-
/* @__PURE__ */ d(
|
|
1472
|
+
/* @__PURE__ */ d(fe, { title: "Border", defaultOpen: !0, children: [
|
|
1473
1473
|
/* @__PURE__ */ n(
|
|
1474
1474
|
_e,
|
|
1475
1475
|
{
|
|
@@ -1491,7 +1491,7 @@ function Gn({
|
|
|
1491
1491
|
)
|
|
1492
1492
|
] }),
|
|
1493
1493
|
/* @__PURE__ */ n(
|
|
1494
|
-
|
|
1494
|
+
se,
|
|
1495
1495
|
{
|
|
1496
1496
|
compact: !0,
|
|
1497
1497
|
property: "border-width",
|
|
@@ -1501,7 +1501,7 @@ function Gn({
|
|
|
1501
1501
|
}
|
|
1502
1502
|
),
|
|
1503
1503
|
/* @__PURE__ */ n(
|
|
1504
|
-
|
|
1504
|
+
se,
|
|
1505
1505
|
{
|
|
1506
1506
|
compact: !0,
|
|
1507
1507
|
property: "border-radius",
|
|
@@ -1513,7 +1513,7 @@ function Gn({
|
|
|
1513
1513
|
] })
|
|
1514
1514
|
] });
|
|
1515
1515
|
}
|
|
1516
|
-
const
|
|
1516
|
+
const jn = 50, gt = [
|
|
1517
1517
|
"font-family",
|
|
1518
1518
|
"font-size",
|
|
1519
1519
|
"font-weight",
|
|
@@ -1535,130 +1535,133 @@ const Kn = 50, gt = [
|
|
|
1535
1535
|
"border-radius",
|
|
1536
1536
|
"opacity"
|
|
1537
1537
|
];
|
|
1538
|
-
function
|
|
1539
|
-
var
|
|
1540
|
-
const r = X([]),
|
|
1538
|
+
function qn(e, t, i) {
|
|
1539
|
+
var ce;
|
|
1540
|
+
const r = X([]), o = X(/* @__PURE__ */ new Set()), s = X([]), a = X(null), c = X([]), u = X(
|
|
1541
1541
|
null
|
|
1542
|
-
), [l, f] = A({}), [p, v] = A({}), [m, g] = A("none"), [y, S] = A(""), [w, k] = A(""), [N,
|
|
1543
|
-
const C = Array.from(
|
|
1542
|
+
), [l, f] = A({}), [p, v] = A({}), [m, g] = A("none"), [y, S] = A(""), [w, k] = A(""), [N, E] = A(() => /* @__PURE__ */ new Map()), [z, R] = A(!1), x = $(() => {
|
|
1543
|
+
const C = Array.from(o.current);
|
|
1544
1544
|
return {
|
|
1545
1545
|
inline: nt(C, [...gt]),
|
|
1546
1546
|
text: e && m !== "none" ? tt(e, m) : null
|
|
1547
1547
|
};
|
|
1548
|
-
}, [e, m]), I =
|
|
1549
|
-
c.current.push(x()), c.current.length >
|
|
1550
|
-
}, [x]), L =
|
|
1548
|
+
}, [e, m]), I = $(() => {
|
|
1549
|
+
c.current.push(x()), c.current.length > jn && c.current.shift(), R(c.current.length > 0);
|
|
1550
|
+
}, [x]), L = $(
|
|
1551
1551
|
(C) => {
|
|
1552
|
-
var
|
|
1552
|
+
var H;
|
|
1553
1553
|
if (!e) return;
|
|
1554
|
-
const P = Array.from(
|
|
1555
|
-
|
|
1556
|
-
const
|
|
1557
|
-
r.current =
|
|
1558
|
-
const
|
|
1559
|
-
if (C &&
|
|
1560
|
-
for (const
|
|
1561
|
-
if (
|
|
1562
|
-
for (const
|
|
1563
|
-
rt(
|
|
1554
|
+
const P = Array.from(o.current);
|
|
1555
|
+
ke(s.current.filter((O) => P.includes(O.element))), a.current && Ae(a.current);
|
|
1556
|
+
const D = Re(e, t);
|
|
1557
|
+
r.current = D, o.current = new Set(D), Se(P), ze(D, i);
|
|
1558
|
+
const T = e ? ((H = N.get(e)) == null ? void 0 : H.get(i)) ?? [] : [];
|
|
1559
|
+
if (C && T.length > 0)
|
|
1560
|
+
for (const O of T)
|
|
1561
|
+
if (O.property === "textContent" || O.property === "value")
|
|
1562
|
+
for (const Y of D)
|
|
1563
|
+
rt(Y, O.property, O.newValue);
|
|
1564
1564
|
else
|
|
1565
|
-
for (const
|
|
1566
|
-
|
|
1565
|
+
for (const Y of D)
|
|
1566
|
+
Y.style.setProperty(O.property, O.newValue);
|
|
1567
1567
|
},
|
|
1568
1568
|
[e, t, i, N]
|
|
1569
1569
|
);
|
|
1570
|
-
|
|
1570
|
+
_(() => {
|
|
1571
1571
|
if (!e) {
|
|
1572
|
-
r.current = [],
|
|
1572
|
+
r.current = [], o.current = /* @__PURE__ */ new Set(), s.current = [], a.current = null, c.current = [], f({}), v({}), g("none"), S(""), k(""), E(/* @__PURE__ */ new Map()), R(!1);
|
|
1573
1573
|
return;
|
|
1574
1574
|
}
|
|
1575
|
-
const C =
|
|
1576
|
-
r.current = C,
|
|
1577
|
-
const P =
|
|
1575
|
+
const C = Re(e, t);
|
|
1576
|
+
r.current = C, o.current = new Set(C), s.current = nt(C, [...gt]), c.current = [], R(!1);
|
|
1577
|
+
const P = Ce(e);
|
|
1578
1578
|
f(P), v(P);
|
|
1579
|
-
const
|
|
1580
|
-
return g(
|
|
1581
|
-
}, [e]),
|
|
1579
|
+
const D = ve(e);
|
|
1580
|
+
return g(D.kind), S(D.value), k(D.value), a.current = D.kind !== "none" ? tt(e, D.kind) : null, ze(C, i), () => Se(C);
|
|
1581
|
+
}, [e]), _(() => {
|
|
1582
1582
|
e && L(!0);
|
|
1583
|
-
}, [t]),
|
|
1584
|
-
var
|
|
1583
|
+
}, [t]), _(() => {
|
|
1584
|
+
var ae;
|
|
1585
1585
|
if (!e) return;
|
|
1586
|
-
const C =
|
|
1587
|
-
r.current = C,
|
|
1588
|
-
s.current.filter((
|
|
1586
|
+
const C = Re(e, t);
|
|
1587
|
+
r.current = C, ke(
|
|
1588
|
+
s.current.filter((G) => C.includes(G.element))
|
|
1589
1589
|
);
|
|
1590
|
-
const P = (
|
|
1591
|
-
for (const
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1590
|
+
const P = Ce(e), D = i === "normal" ? {} : qt(e, i);
|
|
1591
|
+
for (const [G, K] of Object.entries(D))
|
|
1592
|
+
for (const he of C) he.style.setProperty(G, K);
|
|
1593
|
+
const T = ((ae = N.get(e)) == null ? void 0 : ae.get(i)) ?? [];
|
|
1594
|
+
for (const G of T)
|
|
1595
|
+
if (!(G.property === "textContent" || G.property === "value"))
|
|
1596
|
+
for (const K of C)
|
|
1597
|
+
K.style.setProperty(G.property, G.newValue);
|
|
1598
|
+
const H = u.current, O = H !== null && H.element === e && H.state !== i, Y = H !== null && H.element !== e && i !== "normal";
|
|
1599
|
+
if (O || Y) {
|
|
1600
|
+
const G = { ...P, ...D };
|
|
1601
|
+
for (const K of T)
|
|
1602
|
+
K.property === "textContent" || K.property === "value" || (G[K.property] = K.newValue);
|
|
1603
|
+
f(G);
|
|
1601
1604
|
}
|
|
1602
|
-
u.current = { element: e, state: i },
|
|
1605
|
+
u.current = { element: e, state: i }, Se(Array.from(o.current)), ze(C, i), o.current = new Set(C);
|
|
1603
1606
|
}, [i, e, t]);
|
|
1604
|
-
const h =
|
|
1605
|
-
(C, P,
|
|
1606
|
-
e &&
|
|
1607
|
-
const
|
|
1608
|
-
return
|
|
1607
|
+
const h = $(
|
|
1608
|
+
(C, P, D) => {
|
|
1609
|
+
e && E((T) => {
|
|
1610
|
+
const H = new Map(T), O = new Map(H.get(e) ?? /* @__PURE__ */ new Map()), ae = (O.get(i) ?? []).filter((G) => G.property !== C);
|
|
1611
|
+
return D === P ? ae.length === 0 ? O.delete(i) : O.set(i, ae) : O.set(i, [...ae, { property: C, oldValue: P, newValue: D }]), O.size === 0 ? H.delete(e) : H.set(e, O), H;
|
|
1609
1612
|
});
|
|
1610
1613
|
},
|
|
1611
1614
|
[e, i]
|
|
1612
|
-
), F =
|
|
1615
|
+
), F = $(
|
|
1613
1616
|
(C, P) => {
|
|
1614
1617
|
if (!e) return;
|
|
1615
|
-
const
|
|
1616
|
-
C === "border-width" && (l["border-style"] ?? "none") === "none" &&
|
|
1617
|
-
for (const [
|
|
1618
|
-
const
|
|
1619
|
-
for (const
|
|
1620
|
-
|
|
1621
|
-
h(
|
|
1618
|
+
const D = { [C]: P };
|
|
1619
|
+
C === "border-width" && (l["border-style"] ?? "none") === "none" && Ln(P) && (D["border-style"] = "solid"), I(), f((T) => ({ ...T, ...D }));
|
|
1620
|
+
for (const [T, H] of Object.entries(D)) {
|
|
1621
|
+
const O = p[T] ?? "";
|
|
1622
|
+
for (const Y of r.current)
|
|
1623
|
+
Y.style.setProperty(T, H), o.current.add(Y);
|
|
1624
|
+
h(T, O, H);
|
|
1622
1625
|
}
|
|
1623
1626
|
},
|
|
1624
1627
|
[e, p, l, I, h]
|
|
1625
|
-
), U =
|
|
1628
|
+
), U = $(
|
|
1626
1629
|
(C) => {
|
|
1627
1630
|
if (!(!e || m === "none")) {
|
|
1628
1631
|
I(), S(C);
|
|
1629
1632
|
for (const P of r.current)
|
|
1630
|
-
rt(P, m, C),
|
|
1633
|
+
rt(P, m, C), o.current.add(P);
|
|
1631
1634
|
h(m, w, C);
|
|
1632
1635
|
}
|
|
1633
1636
|
},
|
|
1634
1637
|
[e, m, w, I, h]
|
|
1635
|
-
),
|
|
1638
|
+
), ye = $(() => {
|
|
1636
1639
|
const C = c.current.pop();
|
|
1637
|
-
if (C && (
|
|
1638
|
-
f(
|
|
1639
|
-
const P =
|
|
1640
|
+
if (C && (ke(C.inline), C.text && Ae(C.text), R(c.current.length > 0), e)) {
|
|
1641
|
+
f(Ce(e));
|
|
1642
|
+
const P = ve(e);
|
|
1640
1643
|
P.kind !== "none" && S(P.value);
|
|
1641
1644
|
}
|
|
1642
|
-
}, [e]),
|
|
1643
|
-
if (
|
|
1644
|
-
f(
|
|
1645
|
-
const C =
|
|
1645
|
+
}, [e]), ee = $(() => {
|
|
1646
|
+
if (ke(s.current), a.current && Ae(a.current), c.current = [], R(!1), E(/* @__PURE__ */ new Map()), e) {
|
|
1647
|
+
f(Ce(e));
|
|
1648
|
+
const C = ve(e);
|
|
1646
1649
|
S(C.value);
|
|
1647
1650
|
}
|
|
1648
|
-
}, [e]),
|
|
1649
|
-
|
|
1650
|
-
}, []),
|
|
1651
|
-
if (
|
|
1652
|
-
f(
|
|
1653
|
-
const C =
|
|
1651
|
+
}, [e]), re = $(() => {
|
|
1652
|
+
ke(s.current), a.current && Ae(a.current);
|
|
1653
|
+
}, []), oe = $(() => {
|
|
1654
|
+
if (re(), Se(Array.from(o.current)), c.current = [], R(!1), E(/* @__PURE__ */ new Map()), e) {
|
|
1655
|
+
f(Ce(e));
|
|
1656
|
+
const C = ve(e);
|
|
1654
1657
|
C.kind !== "none" && S(C.value);
|
|
1655
1658
|
}
|
|
1656
|
-
}, [
|
|
1657
|
-
let
|
|
1659
|
+
}, [re, e]), W = e ? ((ce = N.get(e)) == null ? void 0 : ce.get(i)) ?? [] : [];
|
|
1660
|
+
let j = 0;
|
|
1658
1661
|
for (const C of N.values())
|
|
1659
|
-
for (const P of C.values())
|
|
1660
|
-
const
|
|
1661
|
-
|
|
1662
|
+
for (const P of C.values()) j += P.length;
|
|
1663
|
+
const ie = $(() => {
|
|
1664
|
+
E(/* @__PURE__ */ new Map());
|
|
1662
1665
|
}, []);
|
|
1663
1666
|
return {
|
|
1664
1667
|
values: l,
|
|
@@ -1666,25 +1669,25 @@ function jn(e, t, i) {
|
|
|
1666
1669
|
textValue: y,
|
|
1667
1670
|
pendingChanges: W,
|
|
1668
1671
|
pendingByElement: N,
|
|
1669
|
-
totalPendingCount:
|
|
1670
|
-
clearAllPending:
|
|
1671
|
-
canUndo:
|
|
1672
|
+
totalPendingCount: j,
|
|
1673
|
+
clearAllPending: ie,
|
|
1674
|
+
canUndo: z,
|
|
1672
1675
|
updateProperty: F,
|
|
1673
1676
|
updateText: U,
|
|
1674
|
-
undo:
|
|
1675
|
-
reset:
|
|
1676
|
-
clearPreviews:
|
|
1677
|
-
revertPreviews:
|
|
1677
|
+
undo: ye,
|
|
1678
|
+
reset: ee,
|
|
1679
|
+
clearPreviews: oe,
|
|
1680
|
+
revertPreviews: re
|
|
1678
1681
|
};
|
|
1679
1682
|
}
|
|
1680
|
-
function
|
|
1683
|
+
function Jn({
|
|
1681
1684
|
selectedElement: e,
|
|
1682
1685
|
hoveredElement: t,
|
|
1683
1686
|
onSelectElement: i,
|
|
1684
1687
|
onHoverElement: r,
|
|
1685
|
-
targetScope:
|
|
1688
|
+
targetScope: o,
|
|
1686
1689
|
onTargetScopeChange: s,
|
|
1687
|
-
elementState:
|
|
1690
|
+
elementState: a,
|
|
1688
1691
|
onElementStateChange: c,
|
|
1689
1692
|
onApply: u,
|
|
1690
1693
|
applyStatus: l,
|
|
@@ -1700,58 +1703,58 @@ function qn({
|
|
|
1700
1703
|
totalPendingCount: w,
|
|
1701
1704
|
clearAllPending: k,
|
|
1702
1705
|
canUndo: N,
|
|
1703
|
-
updateProperty:
|
|
1704
|
-
updateText:
|
|
1706
|
+
updateProperty: E,
|
|
1707
|
+
updateText: z,
|
|
1705
1708
|
undo: R,
|
|
1706
1709
|
reset: x,
|
|
1707
1710
|
clearPreviews: I,
|
|
1708
1711
|
revertPreviews: L
|
|
1709
|
-
} =
|
|
1710
|
-
computeDefaultPosition: (
|
|
1711
|
-
x: window.innerWidth -
|
|
1712
|
+
} = qn(e, o, a), { elementRef: h, isDragging: F, style: U, dragHandleProps: ye } = Tt({
|
|
1713
|
+
computeDefaultPosition: (T) => ({
|
|
1714
|
+
x: window.innerWidth - T.width - 16,
|
|
1712
1715
|
y: 16
|
|
1713
1716
|
})
|
|
1714
1717
|
});
|
|
1715
|
-
|
|
1716
|
-
const
|
|
1717
|
-
(
|
|
1718
|
-
if (f(
|
|
1719
|
-
const
|
|
1720
|
-
(
|
|
1718
|
+
_(() => (p == null || p({ clearPreviews: I, revertPreviews: L }), () => p == null ? void 0 : p(null)), [p, I, L]);
|
|
1719
|
+
const ee = $(
|
|
1720
|
+
(T) => {
|
|
1721
|
+
if (f(T.target)) return;
|
|
1722
|
+
const O = document.elementsFromPoint(T.clientX, T.clientY).find(
|
|
1723
|
+
(Y) => Y instanceof Element && !Y.closest(
|
|
1721
1724
|
"[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
|
|
1722
1725
|
)
|
|
1723
1726
|
);
|
|
1724
|
-
r(
|
|
1727
|
+
r(O ?? null);
|
|
1725
1728
|
},
|
|
1726
1729
|
[f, r]
|
|
1727
|
-
),
|
|
1728
|
-
(
|
|
1729
|
-
if (f(
|
|
1730
|
-
|
|
1731
|
-
const
|
|
1732
|
-
(
|
|
1730
|
+
), re = $(
|
|
1731
|
+
(T) => {
|
|
1732
|
+
if (f(T.target)) return;
|
|
1733
|
+
T.preventDefault(), T.stopPropagation();
|
|
1734
|
+
const O = document.elementsFromPoint(T.clientX, T.clientY).find(
|
|
1735
|
+
(Y) => Y instanceof Element && !Y.closest(
|
|
1733
1736
|
"[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
|
|
1734
1737
|
)
|
|
1735
1738
|
);
|
|
1736
|
-
i(
|
|
1739
|
+
i(O ?? null);
|
|
1737
1740
|
},
|
|
1738
1741
|
[f, i]
|
|
1739
1742
|
);
|
|
1740
|
-
|
|
1741
|
-
document.removeEventListener("mousemove",
|
|
1742
|
-
}), [
|
|
1743
|
-
const
|
|
1743
|
+
_(() => (document.addEventListener("mousemove", ee, !0), document.addEventListener("click", re, !0), () => {
|
|
1744
|
+
document.removeEventListener("mousemove", ee, !0), document.removeEventListener("click", re, !0);
|
|
1745
|
+
}), [ee, re]);
|
|
1746
|
+
const oe = async () => {
|
|
1744
1747
|
if (w === 0) return;
|
|
1745
|
-
const
|
|
1746
|
-
|
|
1747
|
-
}, W = e ? Ge(e) : null,
|
|
1748
|
-
return /* @__PURE__ */ d(
|
|
1748
|
+
const T = await u(S);
|
|
1749
|
+
T.applied && (k(), T.skipRevert || L());
|
|
1750
|
+
}, W = e ? Ge(e) : null, j = e ? kt(e) : null, ie = e ? Ct(e) : 0, ce = e ? Mt(e, "all-instances") : "", C = a !== "normal" && j === "tailwind" ? "Tailwind variant preview: matching hover:/focus:/… classes are applied without the prefix." : a !== "normal" ? "State preview uses focus/disabled simulation where possible." : null, P = ie > 1 ? o === "all-instances" ? `Preview & Apply on ${ie} elements (${ce}).` : `This instance only — ${ie - 1} other on page.` : o === "all-instances" ? "Only one match — scope has no effect." : null, D = Me(() => !e || o !== "all-instances" ? [] : Re(e, "all-instances"), [e, o]);
|
|
1751
|
+
return /* @__PURE__ */ d(q, { children: [
|
|
1749
1752
|
/* @__PURE__ */ n(
|
|
1750
|
-
|
|
1753
|
+
Et,
|
|
1751
1754
|
{
|
|
1752
|
-
element:
|
|
1755
|
+
element: o === "all-instances" ? null : t,
|
|
1753
1756
|
selected: e,
|
|
1754
|
-
multiSelected:
|
|
1757
|
+
multiSelected: D,
|
|
1755
1758
|
primarySelected: e
|
|
1756
1759
|
}
|
|
1757
1760
|
),
|
|
@@ -1770,7 +1773,7 @@ function qn({
|
|
|
1770
1773
|
className: "pa-edit-panel-drag",
|
|
1771
1774
|
"aria-label": "Drag edit panel",
|
|
1772
1775
|
title: "Drag to move",
|
|
1773
|
-
...
|
|
1776
|
+
...ye,
|
|
1774
1777
|
children: /* @__PURE__ */ d("span", { className: "pa-edit-panel-grip", "aria-hidden": "true", children: [
|
|
1775
1778
|
/* @__PURE__ */ n("span", {}),
|
|
1776
1779
|
/* @__PURE__ */ n("span", {}),
|
|
@@ -1783,39 +1786,39 @@ function qn({
|
|
|
1783
1786
|
),
|
|
1784
1787
|
/* @__PURE__ */ n("h3", { className: "pa-edit-title", children: "Edit" })
|
|
1785
1788
|
] }),
|
|
1786
|
-
e ? /* @__PURE__ */ d(
|
|
1789
|
+
e ? /* @__PURE__ */ d(q, { children: [
|
|
1787
1790
|
/* @__PURE__ */ d("div", { className: "pa-edit-meta", children: [
|
|
1788
1791
|
/* @__PURE__ */ n(
|
|
1789
1792
|
"code",
|
|
1790
1793
|
{
|
|
1791
1794
|
className: "pa-edit-meta-label",
|
|
1792
1795
|
title: `This instance: ${At(e)}
|
|
1793
|
-
All instances: ${
|
|
1796
|
+
All instances: ${ce}`,
|
|
1794
1797
|
children: Xe(e)
|
|
1795
1798
|
}
|
|
1796
1799
|
),
|
|
1797
|
-
((W == null ? void 0 : W.sourceFile) ||
|
|
1798
|
-
(W == null ? void 0 : W.sourceFile) && /* @__PURE__ */ d(
|
|
1800
|
+
((W == null ? void 0 : W.sourceFile) || j) && /* @__PURE__ */ d("span", { className: "pa-edit-source", children: [
|
|
1801
|
+
(W == null ? void 0 : W.sourceFile) && /* @__PURE__ */ d(q, { children: [
|
|
1799
1802
|
W.sourceFile,
|
|
1800
1803
|
W.lineNumber ? `:${W.lineNumber}` : ""
|
|
1801
1804
|
] }),
|
|
1802
|
-
W != null && W.sourceFile &&
|
|
1803
|
-
|
|
1805
|
+
W != null && W.sourceFile && j ? " · " : "",
|
|
1806
|
+
j ?? ""
|
|
1804
1807
|
] })
|
|
1805
1808
|
] }),
|
|
1806
1809
|
/* @__PURE__ */ n("div", { className: "pa-edit-panel-scroll", children: /* @__PURE__ */ n(
|
|
1807
|
-
|
|
1810
|
+
Kn,
|
|
1808
1811
|
{
|
|
1809
1812
|
values: v,
|
|
1810
|
-
onPropertyChange:
|
|
1813
|
+
onPropertyChange: E,
|
|
1811
1814
|
textKind: m,
|
|
1812
1815
|
textValue: g,
|
|
1813
|
-
onTextChange:
|
|
1814
|
-
targetScope:
|
|
1816
|
+
onTextChange: z,
|
|
1817
|
+
targetScope: o,
|
|
1815
1818
|
onTargetScopeChange: s,
|
|
1816
|
-
elementState:
|
|
1819
|
+
elementState: a,
|
|
1817
1820
|
onElementStateChange: c,
|
|
1818
|
-
instanceCount:
|
|
1821
|
+
instanceCount: ie,
|
|
1819
1822
|
scopeHint: P,
|
|
1820
1823
|
stateHint: C
|
|
1821
1824
|
}
|
|
@@ -1823,7 +1826,7 @@ All instances: ${oe}`,
|
|
|
1823
1826
|
/* @__PURE__ */ d("div", { className: "pa-edit-panel-sticky", children: [
|
|
1824
1827
|
/* @__PURE__ */ d("div", { className: "pa-edit-actions", children: [
|
|
1825
1828
|
/* @__PURE__ */ n(V, { variant: "regular", onClick: R, disabled: !N, children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
|
|
1826
|
-
/* @__PURE__ */ n(
|
|
1829
|
+
/* @__PURE__ */ n(gn, { className: "pa-glass-btn-icon" }),
|
|
1827
1830
|
/* @__PURE__ */ n("span", { children: "Undo" })
|
|
1828
1831
|
] }) }),
|
|
1829
1832
|
/* @__PURE__ */ n(
|
|
@@ -1833,7 +1836,7 @@ All instances: ${oe}`,
|
|
|
1833
1836
|
onClick: x,
|
|
1834
1837
|
disabled: y.length === 0,
|
|
1835
1838
|
children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
|
|
1836
|
-
/* @__PURE__ */ n(
|
|
1839
|
+
/* @__PURE__ */ n(vn, { className: "pa-glass-btn-icon" }),
|
|
1837
1840
|
/* @__PURE__ */ n("span", { children: "Reset" })
|
|
1838
1841
|
] })
|
|
1839
1842
|
}
|
|
@@ -1851,7 +1854,7 @@ All instances: ${oe}`,
|
|
|
1851
1854
|
V,
|
|
1852
1855
|
{
|
|
1853
1856
|
variant: "glass-primary",
|
|
1854
|
-
onClick:
|
|
1857
|
+
onClick: oe,
|
|
1855
1858
|
disabled: w === 0,
|
|
1856
1859
|
title: W != null && W.sourceFile ? void 0 : "No source file — Apply copies selector + changes to clipboard",
|
|
1857
1860
|
children: "Apply"
|
|
@@ -1865,7 +1868,7 @@ All instances: ${oe}`,
|
|
|
1865
1868
|
)
|
|
1866
1869
|
] });
|
|
1867
1870
|
}
|
|
1868
|
-
async function
|
|
1871
|
+
async function Zn(e, t = {}) {
|
|
1869
1872
|
if (t.onApply)
|
|
1870
1873
|
try {
|
|
1871
1874
|
const r = await t.onApply(e);
|
|
@@ -1880,29 +1883,29 @@ async function Jn(e, t = {}) {
|
|
|
1880
1883
|
method: "POST",
|
|
1881
1884
|
headers: { "Content-Type": "application/json" },
|
|
1882
1885
|
body: JSON.stringify({ payload: e })
|
|
1883
|
-
}),
|
|
1884
|
-
return r.ok ? { mode: "mcp", result:
|
|
1886
|
+
}), o = await r.json();
|
|
1887
|
+
return r.ok ? { mode: "mcp", result: o } : { mode: "error", message: o.error ?? r.statusText };
|
|
1885
1888
|
} catch (r) {
|
|
1886
1889
|
return { mode: "error", message: r instanceof Error ? r.message : String(r) };
|
|
1887
1890
|
}
|
|
1888
1891
|
return await St(JSON.stringify(e, null, 2)), { mode: "clipboard" };
|
|
1889
1892
|
}
|
|
1890
|
-
function
|
|
1893
|
+
function Qn(e) {
|
|
1891
1894
|
const [t, i] = A(null);
|
|
1892
|
-
return
|
|
1895
|
+
return _(() => {
|
|
1893
1896
|
if (!e) {
|
|
1894
1897
|
i(null);
|
|
1895
1898
|
return;
|
|
1896
1899
|
}
|
|
1897
1900
|
const r = () => i(e.getBoundingClientRect());
|
|
1898
1901
|
r();
|
|
1899
|
-
const
|
|
1900
|
-
return
|
|
1901
|
-
|
|
1902
|
+
const o = new ResizeObserver(r);
|
|
1903
|
+
return o.observe(e), window.addEventListener("scroll", r, !0), window.addEventListener("resize", r), () => {
|
|
1904
|
+
o.disconnect(), window.removeEventListener("scroll", r, !0), window.removeEventListener("resize", r);
|
|
1902
1905
|
};
|
|
1903
1906
|
}, [e]), t;
|
|
1904
1907
|
}
|
|
1905
|
-
const
|
|
1908
|
+
const le = 8, Q = 8, er = 12, tr = 300, nr = 280;
|
|
1906
1909
|
function He(e, t, i, r) {
|
|
1907
1910
|
return {
|
|
1908
1911
|
top: e,
|
|
@@ -1916,7 +1919,7 @@ function He(e, t, i, r) {
|
|
|
1916
1919
|
function Ye(e, t) {
|
|
1917
1920
|
return e.left < t.right && e.right > t.left && e.top < t.bottom && e.bottom > t.top;
|
|
1918
1921
|
}
|
|
1919
|
-
function
|
|
1922
|
+
function rr(e, t) {
|
|
1920
1923
|
return {
|
|
1921
1924
|
top: e.top - t,
|
|
1922
1925
|
left: e.left - t,
|
|
@@ -1926,46 +1929,46 @@ function nr(e, t) {
|
|
|
1926
1929
|
height: e.height + t * 2
|
|
1927
1930
|
};
|
|
1928
1931
|
}
|
|
1929
|
-
function
|
|
1932
|
+
function ir() {
|
|
1930
1933
|
if (typeof document > "u") return null;
|
|
1931
1934
|
const e = document.querySelector(
|
|
1932
1935
|
"[data-pixelagent-toolbar-portal] .pa-toolbar-float"
|
|
1933
1936
|
);
|
|
1934
|
-
return e ?
|
|
1937
|
+
return e ? rr(e.getBoundingClientRect(), er) : null;
|
|
1935
1938
|
}
|
|
1936
1939
|
function Ve(e, t) {
|
|
1937
1940
|
return Math.min(
|
|
1938
|
-
Math.max(
|
|
1939
|
-
window.innerWidth - t -
|
|
1941
|
+
Math.max(le, e),
|
|
1942
|
+
window.innerWidth - t - le
|
|
1940
1943
|
);
|
|
1941
1944
|
}
|
|
1942
|
-
function
|
|
1945
|
+
function Ee(e, t) {
|
|
1943
1946
|
return Math.min(
|
|
1944
|
-
Math.max(
|
|
1945
|
-
window.innerHeight - t -
|
|
1947
|
+
Math.max(le, e),
|
|
1948
|
+
window.innerHeight - t - le
|
|
1946
1949
|
);
|
|
1947
1950
|
}
|
|
1948
|
-
function
|
|
1949
|
-
return e.top >=
|
|
1951
|
+
function or(e) {
|
|
1952
|
+
return e.top >= le && e.left >= le && e.right <= window.innerWidth - le && e.bottom <= window.innerHeight - le;
|
|
1950
1953
|
}
|
|
1951
1954
|
function ar(e, t) {
|
|
1952
|
-
return t && Ye(e, t) ? !1 :
|
|
1953
|
-
}
|
|
1954
|
-
function
|
|
1955
|
-
const r =
|
|
1956
|
-
{ placement: "above", top: e.top - i -
|
|
1957
|
-
{ placement: "below", top: e.bottom +
|
|
1958
|
-
{ placement: "right", top: e.top, left: e.right +
|
|
1959
|
-
{ placement: "left", top: e.top, left: e.left - t -
|
|
1955
|
+
return t && Ye(e, t) ? !1 : or(e);
|
|
1956
|
+
}
|
|
1957
|
+
function sr(e, t = tr, i = nr) {
|
|
1958
|
+
const r = ir(), s = e.top > window.innerHeight * 0.45 ? [
|
|
1959
|
+
{ placement: "above", top: e.top - i - Q, left: e.left },
|
|
1960
|
+
{ placement: "below", top: e.bottom + Q, left: e.left },
|
|
1961
|
+
{ placement: "right", top: e.top, left: e.right + Q },
|
|
1962
|
+
{ placement: "left", top: e.top, left: e.left - t - Q }
|
|
1960
1963
|
] : [
|
|
1961
|
-
{ placement: "below", top: e.bottom +
|
|
1962
|
-
{ placement: "above", top: e.top - i -
|
|
1963
|
-
{ placement: "right", top: e.top, left: e.right +
|
|
1964
|
-
{ placement: "left", top: e.top, left: e.left - t -
|
|
1964
|
+
{ placement: "below", top: e.bottom + Q, left: e.left },
|
|
1965
|
+
{ placement: "above", top: e.top - i - Q, left: e.left },
|
|
1966
|
+
{ placement: "right", top: e.top, left: e.right + Q },
|
|
1967
|
+
{ placement: "left", top: e.top, left: e.left - t - Q }
|
|
1965
1968
|
];
|
|
1966
1969
|
for (const { top: u, left: l } of s) {
|
|
1967
1970
|
const f = He(
|
|
1968
|
-
|
|
1971
|
+
Ee(u, i),
|
|
1969
1972
|
Ve(l, t),
|
|
1970
1973
|
t,
|
|
1971
1974
|
i
|
|
@@ -1973,34 +1976,34 @@ function or(e, t = er, i = tr) {
|
|
|
1973
1976
|
if (ar(f, r))
|
|
1974
1977
|
return { top: f.top, left: f.left };
|
|
1975
1978
|
}
|
|
1976
|
-
let
|
|
1979
|
+
let a = Ee(e.top - i - Q, i), c = Ve(e.left, t);
|
|
1977
1980
|
if (r) {
|
|
1978
|
-
let u = He(
|
|
1979
|
-
Ye(u, r) && (
|
|
1980
|
-
Math.min(e.left, r.left - t -
|
|
1981
|
+
let u = He(a, c, t, i);
|
|
1982
|
+
Ye(u, r) && (a = Ee(r.top - i - Q, i), u = He(a, c, t, i)), Ye(u, r) && (a = Ee(e.bottom + Q, i), c = Ve(
|
|
1983
|
+
Math.min(e.left, r.left - t - Q),
|
|
1981
1984
|
t
|
|
1982
1985
|
));
|
|
1983
1986
|
}
|
|
1984
|
-
return { top:
|
|
1987
|
+
return { top: a, left: c };
|
|
1985
1988
|
}
|
|
1986
|
-
function
|
|
1989
|
+
function lr({
|
|
1987
1990
|
elements: e,
|
|
1988
1991
|
areaBbox: t,
|
|
1989
1992
|
onSubmit: i,
|
|
1990
1993
|
onCancel: r
|
|
1991
1994
|
}) {
|
|
1992
|
-
const [
|
|
1993
|
-
if (
|
|
1995
|
+
const [o, s] = A(""), a = X(null), c = X(null), u = e[0] ?? null, l = t ? new DOMRect(t.x, t.y, t.width, t.height) : null, f = Qn(u), p = l ?? f, v = Lt(), m = u ? ve(u) : { kind: "none", value: "" }, g = m.kind !== "none" ? m.value : void 0;
|
|
1996
|
+
if (_(() => {
|
|
1994
1997
|
var k;
|
|
1995
|
-
(k =
|
|
1996
|
-
}, [e]),
|
|
1998
|
+
(k = a.current) == null || k.focus();
|
|
1999
|
+
}, [e]), _(() => {
|
|
1997
2000
|
const k = (N) => {
|
|
1998
2001
|
N.key === "Escape" && r();
|
|
1999
2002
|
};
|
|
2000
2003
|
return document.addEventListener("keydown", k), () => document.removeEventListener("keydown", k);
|
|
2001
2004
|
}, [r]), !p) return null;
|
|
2002
|
-
const y =
|
|
2003
|
-
|
|
2005
|
+
const y = sr(p), S = e.length > 1 ? `${e.length} selected` : u ? Xe(u) : "Area selection", w = (k) => {
|
|
2006
|
+
o.trim() && i(o, k);
|
|
2004
2007
|
};
|
|
2005
2008
|
return /* @__PURE__ */ n(
|
|
2006
2009
|
Pe,
|
|
@@ -2032,9 +2035,9 @@ function sr({
|
|
|
2032
2035
|
/* @__PURE__ */ n(
|
|
2033
2036
|
"textarea",
|
|
2034
2037
|
{
|
|
2035
|
-
ref:
|
|
2038
|
+
ref: a,
|
|
2036
2039
|
className: "pa-textarea",
|
|
2037
|
-
value:
|
|
2040
|
+
value: o,
|
|
2038
2041
|
onChange: (k) => s(k.target.value),
|
|
2039
2042
|
placeholder: "Describe the change...",
|
|
2040
2043
|
rows: 3,
|
|
@@ -2052,7 +2055,7 @@ function sr({
|
|
|
2052
2055
|
{
|
|
2053
2056
|
variant: "ghost",
|
|
2054
2057
|
onClick: () => w(!0),
|
|
2055
|
-
disabled: !
|
|
2058
|
+
disabled: !o.trim(),
|
|
2056
2059
|
children: "Add & next"
|
|
2057
2060
|
}
|
|
2058
2061
|
),
|
|
@@ -2061,7 +2064,7 @@ function sr({
|
|
|
2061
2064
|
{
|
|
2062
2065
|
variant: "glass-primary",
|
|
2063
2066
|
onClick: () => w(!1),
|
|
2064
|
-
disabled: !
|
|
2067
|
+
disabled: !o.trim(),
|
|
2065
2068
|
children: "Add"
|
|
2066
2069
|
}
|
|
2067
2070
|
)
|
|
@@ -2072,7 +2075,7 @@ function sr({
|
|
|
2072
2075
|
}
|
|
2073
2076
|
);
|
|
2074
2077
|
}
|
|
2075
|
-
function
|
|
2078
|
+
function cr({ area: e, isDragging: t }) {
|
|
2076
2079
|
return !e || e.width < 2 || e.height < 2 ? null : /* @__PURE__ */ n(
|
|
2077
2080
|
"div",
|
|
2078
2081
|
{
|
|
@@ -2087,9 +2090,9 @@ function lr({ area: e, isDragging: t }) {
|
|
|
2087
2090
|
}
|
|
2088
2091
|
);
|
|
2089
2092
|
}
|
|
2090
|
-
function
|
|
2091
|
-
const { elements: t, note: i, areaBbox: r } = e,
|
|
2092
|
-
if (!
|
|
2093
|
+
function dr(e) {
|
|
2094
|
+
const { elements: t, note: i, areaBbox: r } = e, o = t[0];
|
|
2095
|
+
if (!o && r)
|
|
2093
2096
|
return {
|
|
2094
2097
|
id: crypto.randomUUID(),
|
|
2095
2098
|
selector: "area-selection",
|
|
@@ -2104,9 +2107,9 @@ function cr(e) {
|
|
|
2104
2107
|
},
|
|
2105
2108
|
createdAt: Date.now()
|
|
2106
2109
|
};
|
|
2107
|
-
if (!
|
|
2110
|
+
if (!o)
|
|
2108
2111
|
throw new Error("buildAnnotationEntry requires at least one element or areaBbox");
|
|
2109
|
-
const s =
|
|
2112
|
+
const s = o.getBoundingClientRect(), a = Ge(o), c = Lt(), u = ve(o), l = u.kind !== "none" ? u.value : void 0, f = t.map((p) => At(p));
|
|
2110
2113
|
return {
|
|
2111
2114
|
id: crypto.randomUUID(),
|
|
2112
2115
|
selector: f[0],
|
|
@@ -2120,25 +2123,25 @@ function cr(e) {
|
|
|
2120
2123
|
height: Math.round(s.height)
|
|
2121
2124
|
},
|
|
2122
2125
|
areaBbox: r,
|
|
2123
|
-
domPath:
|
|
2126
|
+
domPath: Zt(o),
|
|
2124
2127
|
selectedText: c,
|
|
2125
2128
|
elementText: l,
|
|
2126
|
-
sourceFile:
|
|
2127
|
-
lineNumber:
|
|
2128
|
-
componentName:
|
|
2129
|
+
sourceFile: a.sourceFile,
|
|
2130
|
+
lineNumber: a.lineNumber,
|
|
2131
|
+
componentName: Jt(o) ?? a.componentName,
|
|
2129
2132
|
createdAt: Date.now()
|
|
2130
2133
|
};
|
|
2131
2134
|
}
|
|
2132
|
-
function
|
|
2133
|
-
const t =
|
|
2135
|
+
function ur(e) {
|
|
2136
|
+
const t = $t(e);
|
|
2134
2137
|
if (t) return t.getBoundingClientRect();
|
|
2135
2138
|
if (e.bbox) {
|
|
2136
|
-
const { x: i, y: r, width:
|
|
2137
|
-
return new DOMRect(i, r,
|
|
2139
|
+
const { x: i, y: r, width: o, height: s } = e.bbox;
|
|
2140
|
+
return new DOMRect(i, r, o, s);
|
|
2138
2141
|
}
|
|
2139
2142
|
if (e.areaBbox) {
|
|
2140
|
-
const { x: i, y: r, width:
|
|
2141
|
-
return new DOMRect(i, r,
|
|
2143
|
+
const { x: i, y: r, width: o, height: s } = e.areaBbox;
|
|
2144
|
+
return new DOMRect(i, r, o, s);
|
|
2142
2145
|
}
|
|
2143
2146
|
if (e.position) {
|
|
2144
2147
|
const { x: i, y: r } = e.position;
|
|
@@ -2146,46 +2149,46 @@ function dr(e) {
|
|
|
2146
2149
|
}
|
|
2147
2150
|
return null;
|
|
2148
2151
|
}
|
|
2149
|
-
function
|
|
2152
|
+
function pr(e) {
|
|
2150
2153
|
return `${Math.round(e.top)}:${Math.round(e.left)}:${Math.round(e.width)}:${Math.round(e.height)}`;
|
|
2151
2154
|
}
|
|
2152
|
-
const
|
|
2153
|
-
function
|
|
2155
|
+
const hr = 20;
|
|
2156
|
+
function fr({ annotations: e }) {
|
|
2154
2157
|
const [t, i] = A([]);
|
|
2155
|
-
return
|
|
2158
|
+
return _(() => {
|
|
2156
2159
|
if (e.length === 0) {
|
|
2157
2160
|
i([]);
|
|
2158
2161
|
return;
|
|
2159
2162
|
}
|
|
2160
|
-
const r = /* @__PURE__ */ new Map(),
|
|
2163
|
+
const r = /* @__PURE__ */ new Map(), o = () => {
|
|
2161
2164
|
const c = [];
|
|
2162
2165
|
e.forEach((u, l) => {
|
|
2163
|
-
const f =
|
|
2166
|
+
const f = ur(u);
|
|
2164
2167
|
if (!f) return;
|
|
2165
|
-
const p =
|
|
2168
|
+
const p = pr(f), v = r.get(p) ?? 0;
|
|
2166
2169
|
r.set(p, v + 1), c.push({
|
|
2167
2170
|
id: u.id,
|
|
2168
2171
|
index: l + 1,
|
|
2169
|
-
top: f.top - 6 - v *
|
|
2172
|
+
top: f.top - 6 - v * hr,
|
|
2170
2173
|
left: f.right - 6
|
|
2171
2174
|
});
|
|
2172
2175
|
}), i(c);
|
|
2173
2176
|
};
|
|
2174
|
-
|
|
2177
|
+
o();
|
|
2175
2178
|
const s = /* @__PURE__ */ new Set();
|
|
2176
2179
|
for (const c of e) {
|
|
2177
|
-
const u =
|
|
2180
|
+
const u = $t(c);
|
|
2178
2181
|
u && s.add(u);
|
|
2179
2182
|
}
|
|
2180
|
-
const
|
|
2181
|
-
const u = new ResizeObserver(
|
|
2183
|
+
const a = Array.from(s).map((c) => {
|
|
2184
|
+
const u = new ResizeObserver(o);
|
|
2182
2185
|
return u.observe(c), u;
|
|
2183
2186
|
});
|
|
2184
|
-
return window.addEventListener("scroll",
|
|
2185
|
-
for (const c of
|
|
2186
|
-
window.removeEventListener("scroll",
|
|
2187
|
+
return window.addEventListener("scroll", o, !0), window.addEventListener("resize", o), () => {
|
|
2188
|
+
for (const c of a) c.disconnect();
|
|
2189
|
+
window.removeEventListener("scroll", o, !0), window.removeEventListener("resize", o);
|
|
2187
2190
|
};
|
|
2188
|
-
}, [e]), t.length === 0 ? null : /* @__PURE__ */ n(
|
|
2191
|
+
}, [e]), t.length === 0 ? null : /* @__PURE__ */ n(q, { children: t.map((r) => /* @__PURE__ */ n(
|
|
2189
2192
|
"span",
|
|
2190
2193
|
{
|
|
2191
2194
|
className: "pa-annotation-badge",
|
|
@@ -2221,23 +2224,23 @@ function Ht({
|
|
|
2221
2224
|
"aria-live": "polite",
|
|
2222
2225
|
children: e
|
|
2223
2226
|
}
|
|
2224
|
-
) : /* @__PURE__ */ n(
|
|
2227
|
+
) : /* @__PURE__ */ n(q, { children: i });
|
|
2225
2228
|
}
|
|
2226
|
-
function
|
|
2229
|
+
function mr({
|
|
2227
2230
|
annotations: e,
|
|
2228
2231
|
collapsed: t,
|
|
2229
2232
|
onToggleCollapsed: i,
|
|
2230
2233
|
onClose: r,
|
|
2231
|
-
onCopyAll:
|
|
2234
|
+
onCopyAll: o,
|
|
2232
2235
|
onCopyOne: s,
|
|
2233
|
-
onRemove:
|
|
2236
|
+
onRemove: a,
|
|
2234
2237
|
onUpdate: c,
|
|
2235
2238
|
copyStatus: u,
|
|
2236
2239
|
copiedEntryId: l,
|
|
2237
2240
|
copyAllFrom: f
|
|
2238
2241
|
}) {
|
|
2239
2242
|
const [p, v] = A(null), [m, g] = A("");
|
|
2240
|
-
|
|
2243
|
+
_(() => {
|
|
2241
2244
|
const w = (k) => {
|
|
2242
2245
|
k.key === "Escape" && (t ? r() : i());
|
|
2243
2246
|
};
|
|
@@ -2286,7 +2289,7 @@ function fr({
|
|
|
2286
2289
|
{
|
|
2287
2290
|
variant: "glass-primary",
|
|
2288
2291
|
className: "pa-glass-btn--sm",
|
|
2289
|
-
onClick:
|
|
2292
|
+
onClick: o,
|
|
2290
2293
|
disabled: e.length === 0,
|
|
2291
2294
|
children: "Copy all"
|
|
2292
2295
|
}
|
|
@@ -2299,7 +2302,7 @@ function fr({
|
|
|
2299
2302
|
!t && /* @__PURE__ */ d("ul", { className: "pa-session-list", children: [
|
|
2300
2303
|
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." }),
|
|
2301
2304
|
e.map((w) => {
|
|
2302
|
-
const k =
|
|
2305
|
+
const k = Qt(w);
|
|
2303
2306
|
return /* @__PURE__ */ n("li", { className: "pa-session-item", children: p === w.id ? /* @__PURE__ */ d("div", { className: "pa-session-edit", children: [
|
|
2304
2307
|
/* @__PURE__ */ d("label", { className: "pa-label", children: [
|
|
2305
2308
|
"Note",
|
|
@@ -2325,7 +2328,7 @@ function fr({
|
|
|
2325
2328
|
}
|
|
2326
2329
|
)
|
|
2327
2330
|
] })
|
|
2328
|
-
] }) : /* @__PURE__ */ d(
|
|
2331
|
+
] }) : /* @__PURE__ */ d(q, { children: [
|
|
2329
2332
|
/* @__PURE__ */ d("div", { className: "pa-session-content", children: [
|
|
2330
2333
|
/* @__PURE__ */ n("span", { className: "pa-session-target", children: k.target }),
|
|
2331
2334
|
/* @__PURE__ */ n("p", { className: "pa-session-note", children: k.note }),
|
|
@@ -2365,7 +2368,7 @@ function fr({
|
|
|
2365
2368
|
{
|
|
2366
2369
|
variant: "ghost",
|
|
2367
2370
|
className: "pa-glass-btn--sm",
|
|
2368
|
-
onClick: () =>
|
|
2371
|
+
onClick: () => a(w.id),
|
|
2369
2372
|
"aria-label": "Remove annotation",
|
|
2370
2373
|
children: "✕"
|
|
2371
2374
|
}
|
|
@@ -2378,7 +2381,7 @@ function fr({
|
|
|
2378
2381
|
}
|
|
2379
2382
|
);
|
|
2380
2383
|
}
|
|
2381
|
-
function
|
|
2384
|
+
function gr() {
|
|
2382
2385
|
return /* @__PURE__ */ d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
2383
2386
|
/* @__PURE__ */ n(
|
|
2384
2387
|
"path",
|
|
@@ -2399,7 +2402,7 @@ function mr() {
|
|
|
2399
2402
|
)
|
|
2400
2403
|
] });
|
|
2401
2404
|
}
|
|
2402
|
-
function
|
|
2405
|
+
function vr() {
|
|
2403
2406
|
return /* @__PURE__ */ d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
2404
2407
|
/* @__PURE__ */ n("circle", { cx: "8", cy: "8", r: "2.75", stroke: "currentColor", strokeWidth: "1.25" }),
|
|
2405
2408
|
/* @__PURE__ */ n(
|
|
@@ -2413,7 +2416,7 @@ function gr() {
|
|
|
2413
2416
|
)
|
|
2414
2417
|
] });
|
|
2415
2418
|
}
|
|
2416
|
-
function
|
|
2419
|
+
function br() {
|
|
2417
2420
|
return /* @__PURE__ */ n("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
2418
2421
|
"path",
|
|
2419
2422
|
{
|
|
@@ -2424,25 +2427,25 @@ function vr() {
|
|
|
2424
2427
|
}
|
|
2425
2428
|
) });
|
|
2426
2429
|
}
|
|
2427
|
-
function
|
|
2430
|
+
function yr({
|
|
2428
2431
|
open: e,
|
|
2429
2432
|
onClose: t,
|
|
2430
2433
|
hostTheme: i,
|
|
2431
2434
|
chrome: r,
|
|
2432
|
-
onToggleHostTheme:
|
|
2435
|
+
onToggleHostTheme: o
|
|
2433
2436
|
}) {
|
|
2434
2437
|
const s = X(null);
|
|
2435
|
-
return
|
|
2438
|
+
return _(() => {
|
|
2436
2439
|
if (!e) return;
|
|
2437
|
-
const
|
|
2440
|
+
const a = (u) => {
|
|
2438
2441
|
u.key === "Escape" && t();
|
|
2439
2442
|
}, c = (u) => {
|
|
2440
2443
|
var f, p;
|
|
2441
2444
|
const l = u.target;
|
|
2442
2445
|
(f = s.current) != null && f.contains(l) || (p = l.closest) != null && p.call(l, "[data-pa-settings-trigger]") || t();
|
|
2443
2446
|
};
|
|
2444
|
-
return window.addEventListener("keydown",
|
|
2445
|
-
window.removeEventListener("keydown",
|
|
2447
|
+
return window.addEventListener("keydown", a), window.addEventListener("mousedown", c), () => {
|
|
2448
|
+
window.removeEventListener("keydown", a), window.removeEventListener("mousedown", c);
|
|
2446
2449
|
};
|
|
2447
2450
|
}, [e, t]), e ? /* @__PURE__ */ n("div", { ref: s, className: "pa-settings-menu", role: "dialog", "aria-label": "PixelAgent settings", children: /* @__PURE__ */ n(Pe, { variant: "popover", className: "pa-settings-menu-panel", children: /* @__PURE__ */ d("div", { className: "pa-settings-menu-inner", children: [
|
|
2448
2451
|
/* @__PURE__ */ d("header", { className: "pa-settings-menu-header", children: [
|
|
@@ -2457,10 +2460,10 @@ function br({
|
|
|
2457
2460
|
V,
|
|
2458
2461
|
{
|
|
2459
2462
|
variant: "icon",
|
|
2460
|
-
onClick:
|
|
2463
|
+
onClick: o,
|
|
2461
2464
|
"aria-label": i === "dark" ? "Switch host to light theme" : "Switch host to dark theme",
|
|
2462
2465
|
title: i === "dark" ? "Light theme" : "Dark theme",
|
|
2463
|
-
children: i === "dark" ? /* @__PURE__ */ n(
|
|
2466
|
+
children: i === "dark" ? /* @__PURE__ */ n(vr, {}) : /* @__PURE__ */ n(br, {})
|
|
2464
2467
|
}
|
|
2465
2468
|
)
|
|
2466
2469
|
] })
|
|
@@ -2476,14 +2479,14 @@ function br({
|
|
|
2476
2479
|
] }) }) }) : null;
|
|
2477
2480
|
}
|
|
2478
2481
|
const bt = "0 0 24 24";
|
|
2479
|
-
function
|
|
2480
|
-
return /* @__PURE__ */ d(
|
|
2482
|
+
function wr() {
|
|
2483
|
+
return /* @__PURE__ */ d(q, { children: [
|
|
2481
2484
|
/* @__PURE__ */ n("rect", { x: "3", y: "14", width: "4", height: "4", fill: "currentColor" }),
|
|
2482
2485
|
/* @__PURE__ */ n("path", { fill: "currentColor", d: "M7 5h12v12L7 5z" })
|
|
2483
2486
|
] });
|
|
2484
2487
|
}
|
|
2485
|
-
const
|
|
2486
|
-
function
|
|
2488
|
+
const xr = "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";
|
|
2489
|
+
function Nr({ size: e = 22, variant: t = "cursor" }) {
|
|
2487
2490
|
return t === "pointer" ? /* @__PURE__ */ n(
|
|
2488
2491
|
"svg",
|
|
2489
2492
|
{
|
|
@@ -2497,7 +2500,7 @@ function xr({ size: e = 22, variant: t = "cursor" }) {
|
|
|
2497
2500
|
"path",
|
|
2498
2501
|
{
|
|
2499
2502
|
fill: "currentColor",
|
|
2500
|
-
d:
|
|
2503
|
+
d: xr
|
|
2501
2504
|
}
|
|
2502
2505
|
)
|
|
2503
2506
|
}
|
|
@@ -2510,23 +2513,23 @@ function xr({ size: e = 22, variant: t = "cursor" }) {
|
|
|
2510
2513
|
viewBox: bt,
|
|
2511
2514
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2512
2515
|
"aria-hidden": "true",
|
|
2513
|
-
children: /* @__PURE__ */ n(
|
|
2516
|
+
children: /* @__PURE__ */ n(wr, {})
|
|
2514
2517
|
}
|
|
2515
2518
|
);
|
|
2516
2519
|
}
|
|
2517
|
-
const
|
|
2520
|
+
const kr = ["element", "area", "multi"], Cr = {
|
|
2518
2521
|
element: "Click",
|
|
2519
2522
|
area: "Area",
|
|
2520
2523
|
multi: "Multi"
|
|
2521
2524
|
};
|
|
2522
|
-
function
|
|
2525
|
+
function Mr({
|
|
2523
2526
|
rootAttributes: e,
|
|
2524
2527
|
hostTheme: t,
|
|
2525
2528
|
chrome: i,
|
|
2526
2529
|
settingsOpen: r,
|
|
2527
|
-
onToggleSettings:
|
|
2530
|
+
onToggleSettings: o,
|
|
2528
2531
|
onCloseSettings: s,
|
|
2529
|
-
onToggleHostTheme:
|
|
2532
|
+
onToggleHostTheme: a,
|
|
2530
2533
|
active: c,
|
|
2531
2534
|
mode: u,
|
|
2532
2535
|
captureMode: l,
|
|
@@ -2541,26 +2544,26 @@ function Cr({
|
|
|
2541
2544
|
onCaptureModeChange: k,
|
|
2542
2545
|
onConfirmMultiSelect: N
|
|
2543
2546
|
}) {
|
|
2544
|
-
const { elementRef:
|
|
2547
|
+
const { elementRef: E, isDragging: z, style: R, dragHandleProps: x } = Tt(), I = /* @__PURE__ */ d(
|
|
2545
2548
|
"div",
|
|
2546
2549
|
{
|
|
2547
|
-
ref:
|
|
2548
|
-
className: `pa-toolbar-float ${
|
|
2550
|
+
ref: E,
|
|
2551
|
+
className: `pa-toolbar-float ${z ? "pa-toolbar-float--dragging" : ""}`,
|
|
2549
2552
|
style: R,
|
|
2550
2553
|
role: "toolbar",
|
|
2551
2554
|
"aria-label": "PixelAgent",
|
|
2552
2555
|
children: [
|
|
2553
2556
|
!c && /* @__PURE__ */ n(
|
|
2554
|
-
|
|
2557
|
+
yr,
|
|
2555
2558
|
{
|
|
2556
2559
|
open: r,
|
|
2557
2560
|
onClose: s,
|
|
2558
2561
|
hostTheme: t,
|
|
2559
2562
|
chrome: i,
|
|
2560
|
-
onToggleHostTheme:
|
|
2563
|
+
onToggleHostTheme: a
|
|
2561
2564
|
}
|
|
2562
2565
|
),
|
|
2563
|
-
/* @__PURE__ */ n(
|
|
2566
|
+
/* @__PURE__ */ n(Rt, { shape: "capsule", className: "pa-toolbar-glass", intensity: "enhanced", children: /* @__PURE__ */ d("div", { className: "pa-toolbar-inner", children: [
|
|
2564
2567
|
/* @__PURE__ */ n(
|
|
2565
2568
|
"button",
|
|
2566
2569
|
{
|
|
@@ -2569,14 +2572,14 @@ function Cr({
|
|
|
2569
2572
|
"aria-label": "Drag PixelAgent toolbar",
|
|
2570
2573
|
title: "Drag to move",
|
|
2571
2574
|
...x,
|
|
2572
|
-
children: /* @__PURE__ */ n(
|
|
2575
|
+
children: /* @__PURE__ */ n(Nr, { size: 22 })
|
|
2573
2576
|
}
|
|
2574
2577
|
),
|
|
2575
2578
|
/* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
|
|
2576
|
-
c ? /* @__PURE__ */ d(
|
|
2579
|
+
c ? /* @__PURE__ */ d(q, { children: [
|
|
2577
2580
|
/* @__PURE__ */ d("div", { className: "pa-toolbar-segment", children: [
|
|
2578
2581
|
/* @__PURE__ */ n("span", { className: "pa-mode-badge", children: u }),
|
|
2579
|
-
u === "annotate" && /* @__PURE__ */ d(
|
|
2582
|
+
u === "annotate" && /* @__PURE__ */ d(q, { children: [
|
|
2580
2583
|
/* @__PURE__ */ n(
|
|
2581
2584
|
"select",
|
|
2582
2585
|
{
|
|
@@ -2584,7 +2587,7 @@ function Cr({
|
|
|
2584
2587
|
value: l,
|
|
2585
2588
|
onChange: (L) => k(L.target.value),
|
|
2586
2589
|
"aria-label": "Capture mode",
|
|
2587
|
-
children:
|
|
2590
|
+
children: kr.map((L) => /* @__PURE__ */ n("option", { value: L, children: Cr[L] }, L))
|
|
2588
2591
|
}
|
|
2589
2592
|
),
|
|
2590
2593
|
p > 0 && /* @__PURE__ */ n(
|
|
@@ -2647,7 +2650,7 @@ function Cr({
|
|
|
2647
2650
|
/* @__PURE__ */ n(V, { onClick: g, children: "Annotate" }),
|
|
2648
2651
|
/* @__PURE__ */ n(V, { onClick: y, children: "Edit" })
|
|
2649
2652
|
] }),
|
|
2650
|
-
!c && /* @__PURE__ */ d(
|
|
2653
|
+
!c && /* @__PURE__ */ d(q, { children: [
|
|
2651
2654
|
/* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
|
|
2652
2655
|
/* @__PURE__ */ n(
|
|
2653
2656
|
V,
|
|
@@ -2655,11 +2658,11 @@ function Cr({
|
|
|
2655
2658
|
variant: "icon",
|
|
2656
2659
|
className: "pa-toolbar-settings",
|
|
2657
2660
|
"data-pa-settings-trigger": !0,
|
|
2658
|
-
onClick:
|
|
2661
|
+
onClick: o,
|
|
2659
2662
|
"aria-label": "PixelAgent settings",
|
|
2660
2663
|
"aria-expanded": r,
|
|
2661
2664
|
title: "Settings",
|
|
2662
|
-
children: /* @__PURE__ */ n(
|
|
2665
|
+
children: /* @__PURE__ */ n(gr, {})
|
|
2663
2666
|
}
|
|
2664
2667
|
)
|
|
2665
2668
|
] }),
|
|
@@ -2681,42 +2684,42 @@ function Cr({
|
|
|
2681
2684
|
document.body
|
|
2682
2685
|
);
|
|
2683
2686
|
}
|
|
2684
|
-
function
|
|
2685
|
-
const e = X(
|
|
2687
|
+
function Ar() {
|
|
2688
|
+
const e = X(en()), [t, i] = A(
|
|
2686
2689
|
() => {
|
|
2687
2690
|
var s;
|
|
2688
2691
|
return ((s = e.current) == null ? void 0 : s.annotations) ?? [];
|
|
2689
2692
|
}
|
|
2690
2693
|
);
|
|
2691
|
-
|
|
2692
|
-
|
|
2694
|
+
_(() => {
|
|
2695
|
+
tn({ annotations: t });
|
|
2693
2696
|
}, [t]);
|
|
2694
|
-
const r =
|
|
2697
|
+
const r = $((s, a) => {
|
|
2695
2698
|
i(
|
|
2696
|
-
(c) => c.map((u) => u.id === s ? { ...u, ...
|
|
2699
|
+
(c) => c.map((u) => u.id === s ? { ...u, ...a } : u)
|
|
2697
2700
|
);
|
|
2698
|
-
}, []),
|
|
2699
|
-
i((
|
|
2701
|
+
}, []), o = $((s) => {
|
|
2702
|
+
i((a) => a.filter((c) => c.id !== s));
|
|
2700
2703
|
}, []);
|
|
2701
2704
|
return {
|
|
2702
2705
|
annotations: t,
|
|
2703
2706
|
setAnnotations: i,
|
|
2704
2707
|
updateAnnotation: r,
|
|
2705
|
-
removeAnnotation:
|
|
2708
|
+
removeAnnotation: o
|
|
2706
2709
|
};
|
|
2707
2710
|
}
|
|
2708
|
-
function
|
|
2711
|
+
function Sr({
|
|
2709
2712
|
ui: e,
|
|
2710
2713
|
hostTheme: t,
|
|
2711
2714
|
onHostThemeChange: i
|
|
2712
2715
|
}) {
|
|
2713
|
-
const r =
|
|
2714
|
-
() => ({ ...
|
|
2716
|
+
const r = Me(
|
|
2717
|
+
() => ({ ...nn, ...e }),
|
|
2715
2718
|
[e]
|
|
2716
|
-
), [
|
|
2719
|
+
), [o, s] = A(
|
|
2717
2720
|
() => t ?? it(r) ?? "dark"
|
|
2718
|
-
), [
|
|
2719
|
-
|
|
2721
|
+
), [a, c] = A(!1), u = t ?? o;
|
|
2722
|
+
_(() => {
|
|
2720
2723
|
if (t !== void 0) return;
|
|
2721
2724
|
const v = () => {
|
|
2722
2725
|
const y = it(r);
|
|
@@ -2729,17 +2732,17 @@ function Ar({
|
|
|
2729
2732
|
attributeFilter: [m]
|
|
2730
2733
|
}), () => g.disconnect();
|
|
2731
2734
|
}, [t, r]);
|
|
2732
|
-
const l =
|
|
2733
|
-
() =>
|
|
2735
|
+
const l = Me(
|
|
2736
|
+
() => rn(r, u),
|
|
2734
2737
|
[r, u]
|
|
2735
|
-
), f =
|
|
2738
|
+
), f = $(() => {
|
|
2736
2739
|
const v = u === "dark" ? "light" : "dark";
|
|
2737
2740
|
if (i) {
|
|
2738
2741
|
i(v);
|
|
2739
2742
|
return;
|
|
2740
2743
|
}
|
|
2741
|
-
s(v),
|
|
2742
|
-
}, [u, i, r]), p =
|
|
2744
|
+
s(v), on(v, r);
|
|
2745
|
+
}, [u, i, r]), p = $(() => {
|
|
2743
2746
|
c((v) => !v);
|
|
2744
2747
|
}, []);
|
|
2745
2748
|
return {
|
|
@@ -2747,7 +2750,7 @@ function Ar({
|
|
|
2747
2750
|
rootAttributes: an(l),
|
|
2748
2751
|
hostTheme: u,
|
|
2749
2752
|
toggleHostTheme: f,
|
|
2750
|
-
settingsOpen:
|
|
2753
|
+
settingsOpen: a,
|
|
2751
2754
|
setSettingsOpen: c,
|
|
2752
2755
|
toggleSettings: p,
|
|
2753
2756
|
uiSettings: r
|
|
@@ -2756,7 +2759,7 @@ function Ar({
|
|
|
2756
2759
|
const yt = "/__pixelagent/apply", wt = "pixelagent-runtime-styles";
|
|
2757
2760
|
let xt = 0;
|
|
2758
2761
|
const We = /* @__PURE__ */ new WeakMap();
|
|
2759
|
-
function
|
|
2762
|
+
function Lr(e) {
|
|
2760
2763
|
let t = We.get(e);
|
|
2761
2764
|
if (t) return t;
|
|
2762
2765
|
for (const i of Array.from(e.classList))
|
|
@@ -2764,17 +2767,17 @@ function Sr(e) {
|
|
|
2764
2767
|
return We.set(e, i), i;
|
|
2765
2768
|
return xt += 1, t = `pa-runtime-${xt}`, We.set(e, t), e.classList.add(t), t;
|
|
2766
2769
|
}
|
|
2767
|
-
function
|
|
2770
|
+
function $r() {
|
|
2768
2771
|
let e = document.getElementById(wt);
|
|
2769
2772
|
return e || (e = document.createElement("style"), e.id = wt, document.head.appendChild(e)), e;
|
|
2770
2773
|
}
|
|
2771
2774
|
function Er(e, t, i, r) {
|
|
2772
|
-
const
|
|
2775
|
+
const o = $r(), s = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = new RegExp(
|
|
2773
2776
|
`(\\.${s}:${t}\\s*\\{)([\\s\\S]*?)(\\})`,
|
|
2774
2777
|
"m"
|
|
2775
2778
|
), c = `${i}: ${r} !important`;
|
|
2776
|
-
let u =
|
|
2777
|
-
const l = u.match(
|
|
2779
|
+
let u = o.textContent ?? "";
|
|
2780
|
+
const l = u.match(a);
|
|
2778
2781
|
if (l) {
|
|
2779
2782
|
const f = l[2], p = new RegExp(`(\\s*${i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*:\\s*)[^;]+;?`);
|
|
2780
2783
|
let v;
|
|
@@ -2786,7 +2789,7 @@ function Er(e, t, i, r) {
|
|
|
2786
2789
|
${c};
|
|
2787
2790
|
`;
|
|
2788
2791
|
}
|
|
2789
|
-
u = u.replace(
|
|
2792
|
+
u = u.replace(a, `$1${v}$3`);
|
|
2790
2793
|
} else
|
|
2791
2794
|
u && !u.endsWith(`
|
|
2792
2795
|
`) && (u += `
|
|
@@ -2795,23 +2798,23 @@ function Er(e, t, i, r) {
|
|
|
2795
2798
|
${c};
|
|
2796
2799
|
}
|
|
2797
2800
|
`;
|
|
2798
|
-
|
|
2801
|
+
o.textContent = u;
|
|
2799
2802
|
}
|
|
2800
2803
|
function Nt(e) {
|
|
2801
|
-
const t = Math.min(e.startX, e.currentX), i = Math.min(e.startY, e.currentY), r = Math.abs(e.currentX - e.startX),
|
|
2802
|
-
return { x: t, y: i, width: r, height:
|
|
2804
|
+
const t = Math.min(e.startX, e.currentX), i = Math.min(e.startY, e.currentY), r = Math.abs(e.currentX - e.startX), o = Math.abs(e.currentY - e.startY);
|
|
2805
|
+
return { x: t, y: i, width: r, height: o };
|
|
2803
2806
|
}
|
|
2804
|
-
function
|
|
2807
|
+
function Ir({
|
|
2805
2808
|
ui: e,
|
|
2806
2809
|
hostTheme: t,
|
|
2807
2810
|
onHostThemeChange: i,
|
|
2808
2811
|
applyEndpoint: r,
|
|
2809
|
-
onApply:
|
|
2812
|
+
onApply: o,
|
|
2810
2813
|
runtimeStateStyles: s
|
|
2811
2814
|
} = {}) {
|
|
2812
|
-
const
|
|
2813
|
-
|
|
2814
|
-
if (r ||
|
|
2815
|
+
const a = Sr({ ui: e, hostTheme: t, onHostThemeChange: i }), [c, u] = A(null);
|
|
2816
|
+
_(() => {
|
|
2817
|
+
if (r || o) return;
|
|
2815
2818
|
let b = !1;
|
|
2816
2819
|
return fetch(yt, { method: "GET" }).then((M) => {
|
|
2817
2820
|
!b && M.status === 405 && u(yt);
|
|
@@ -2819,35 +2822,35 @@ function $r({
|
|
|
2819
2822
|
}), () => {
|
|
2820
2823
|
b = !0;
|
|
2821
2824
|
};
|
|
2822
|
-
}, [r,
|
|
2825
|
+
}, [r, o]);
|
|
2823
2826
|
const [l, f] = A(!1), [p, v] = A("idle"), [m, g] = A("element"), {
|
|
2824
2827
|
annotations: y,
|
|
2825
2828
|
setAnnotations: S,
|
|
2826
2829
|
updateAnnotation: w,
|
|
2827
2830
|
removeAnnotation: k
|
|
2828
|
-
} =
|
|
2831
|
+
} = Ar(), [N, E] = A(null), [z, R] = A(null), [x, I] = A([]), [L, h] = A(null), [F, U] = A(null), [ye, ee] = A(!1), [re, oe] = A(!1), W = l && p === "annotate" && y.length > 0 && !ye, [j, ie] = A("this-instance"), [ce, C] = A("normal"), [P, D] = A(null), [T, H] = A(null), [O, Y] = A(null), ae = X(null), G = X(null), K = $(
|
|
2829
2832
|
(b, M) => {
|
|
2830
|
-
|
|
2831
|
-
|
|
2833
|
+
G.current && clearTimeout(G.current), D(b), H((M == null ? void 0 : M.entryId) ?? null), Y((M == null ? void 0 : M.copyAllFrom) ?? null), G.current = setTimeout(() => {
|
|
2834
|
+
D(null), H(null), Y(null);
|
|
2832
2835
|
}, 2500);
|
|
2833
2836
|
},
|
|
2834
2837
|
[]
|
|
2835
|
-
),
|
|
2836
|
-
async (b, M,
|
|
2838
|
+
), he = $(
|
|
2839
|
+
async (b, M, J) => {
|
|
2837
2840
|
if (b)
|
|
2838
2841
|
try {
|
|
2839
|
-
await St(b),
|
|
2842
|
+
await St(b), K(M, J);
|
|
2840
2843
|
} catch {
|
|
2841
|
-
|
|
2844
|
+
K("Copy failed — check clipboard permissions", J);
|
|
2842
2845
|
}
|
|
2843
2846
|
},
|
|
2844
|
-
[
|
|
2845
|
-
),
|
|
2847
|
+
[K]
|
|
2848
|
+
), we = $(
|
|
2846
2849
|
(b, M) => {
|
|
2847
2850
|
b.length === 0 && !M || (h({ elements: b, areaBbox: M }), R(b[0] ?? null));
|
|
2848
2851
|
},
|
|
2849
2852
|
[]
|
|
2850
|
-
), De =
|
|
2853
|
+
), De = $(
|
|
2851
2854
|
(b) => {
|
|
2852
2855
|
if (!(!l || p !== "annotate" || Ie(b.target))) {
|
|
2853
2856
|
if (F) {
|
|
@@ -2856,11 +2859,11 @@ function $r({
|
|
|
2856
2859
|
);
|
|
2857
2860
|
return;
|
|
2858
2861
|
}
|
|
2859
|
-
m !== "area" &&
|
|
2862
|
+
m !== "area" && E(vt(b.clientX, b.clientY));
|
|
2860
2863
|
}
|
|
2861
2864
|
},
|
|
2862
2865
|
[l, p, F, m]
|
|
2863
|
-
), Oe =
|
|
2866
|
+
), Oe = $(
|
|
2864
2867
|
(b) => {
|
|
2865
2868
|
!l || p !== "annotate" || Ie(b.target) || m !== "area" || b.button !== 0 || (b.preventDefault(), b.stopPropagation(), U({
|
|
2866
2869
|
startX: b.clientX,
|
|
@@ -2870,158 +2873,158 @@ function $r({
|
|
|
2870
2873
|
}), h(null));
|
|
2871
2874
|
},
|
|
2872
2875
|
[l, p, m]
|
|
2873
|
-
), Fe =
|
|
2876
|
+
), Fe = $(() => {
|
|
2874
2877
|
if (!F) return;
|
|
2875
2878
|
const b = Nt(F);
|
|
2876
2879
|
if (U(null), b.width < 8 || b.height < 8) return;
|
|
2877
|
-
const M =
|
|
2878
|
-
|
|
2879
|
-
}, [F,
|
|
2880
|
+
const M = sn(b, Ze);
|
|
2881
|
+
we(M, b);
|
|
2882
|
+
}, [F, we]), Be = $(
|
|
2880
2883
|
(b) => {
|
|
2881
2884
|
if (!l || p !== "annotate" || Ie(b.target) || m === "area") return;
|
|
2882
2885
|
b.preventDefault(), b.stopPropagation();
|
|
2883
2886
|
const M = vt(b.clientX, b.clientY);
|
|
2884
2887
|
if (!M) return;
|
|
2885
2888
|
if (b.shiftKey || m === "multi") {
|
|
2886
|
-
I((
|
|
2889
|
+
I((te) => te.includes(M) ? te.filter((B) => B !== M) : [...te, M]), R(M);
|
|
2887
2890
|
return;
|
|
2888
2891
|
}
|
|
2889
|
-
const
|
|
2890
|
-
|
|
2892
|
+
const J = x.length > 0 ? x : [M];
|
|
2893
|
+
we(J.includes(M) ? J : [M]);
|
|
2891
2894
|
},
|
|
2892
|
-
[l, p, m, x,
|
|
2895
|
+
[l, p, m, x, we]
|
|
2893
2896
|
);
|
|
2894
|
-
|
|
2895
|
-
!
|
|
2896
|
-
}, [
|
|
2897
|
+
_(() => {
|
|
2898
|
+
!z || j !== "all-instances" || Ct(z) <= 1 && ie("this-instance");
|
|
2899
|
+
}, [z, j]), _(() => {
|
|
2897
2900
|
if (l)
|
|
2898
2901
|
return document.addEventListener("mousemove", De, !0), document.addEventListener("mousedown", Oe, !0), document.addEventListener("mouseup", Fe, !0), document.addEventListener("click", Be, !0), () => {
|
|
2899
2902
|
document.removeEventListener("mousemove", De, !0), document.removeEventListener("mousedown", Oe, !0), document.removeEventListener("mouseup", Fe, !0), document.removeEventListener("click", Be, !0);
|
|
2900
2903
|
};
|
|
2901
2904
|
}, [l, De, Oe, Fe, Be]);
|
|
2902
|
-
const Vt =
|
|
2905
|
+
const Vt = $(
|
|
2903
2906
|
(b, M) => {
|
|
2904
2907
|
if (!L || !b.trim()) return;
|
|
2905
|
-
const { elements:
|
|
2906
|
-
if (
|
|
2907
|
-
const
|
|
2908
|
-
elements:
|
|
2908
|
+
const { elements: J, areaBbox: te } = L;
|
|
2909
|
+
if (J.length === 0 && !te) return;
|
|
2910
|
+
const xe = dr({
|
|
2911
|
+
elements: J,
|
|
2909
2912
|
note: b,
|
|
2910
|
-
areaBbox:
|
|
2913
|
+
areaBbox: te
|
|
2911
2914
|
});
|
|
2912
|
-
S((B) => [...B,
|
|
2915
|
+
S((B) => [...B, xe]), ee(!1), oe(!1), M ? (h(null), R(null)) : (h(null), R(null), I([]));
|
|
2913
2916
|
},
|
|
2914
2917
|
[L, S]
|
|
2915
|
-
), Wt =
|
|
2918
|
+
), Wt = $(() => {
|
|
2916
2919
|
h(null), R(null);
|
|
2917
|
-
}, []), Qe =
|
|
2920
|
+
}, []), Qe = $(
|
|
2918
2921
|
async (b) => {
|
|
2919
|
-
const M =
|
|
2920
|
-
await
|
|
2922
|
+
const M = ln(y);
|
|
2923
|
+
await he(M, "Copied all!", { copyAllFrom: b });
|
|
2921
2924
|
},
|
|
2922
|
-
[y,
|
|
2923
|
-
), Ut =
|
|
2925
|
+
[y, he]
|
|
2926
|
+
), Ut = $(
|
|
2924
2927
|
async (b) => {
|
|
2925
|
-
const M = y.find((
|
|
2926
|
-
M && await
|
|
2928
|
+
const M = y.find((J) => J.id === b);
|
|
2929
|
+
M && await he(cn(M), "Copied!", { entryId: b });
|
|
2927
2930
|
},
|
|
2928
|
-
[y,
|
|
2929
|
-
), Yt =
|
|
2931
|
+
[y, he]
|
|
2932
|
+
), Yt = $(
|
|
2930
2933
|
async (b) => {
|
|
2931
2934
|
const M = [];
|
|
2932
|
-
for (const [B,
|
|
2933
|
-
for (const [
|
|
2934
|
-
|
|
2935
|
+
for (const [B, Z] of b)
|
|
2936
|
+
for (const [de, ne] of Z)
|
|
2937
|
+
ne.length > 0 && M.push([B, de, ne]);
|
|
2935
2938
|
if (M.length === 0) return { applied: !1 };
|
|
2936
2939
|
if (s) {
|
|
2937
|
-
for (const [B,
|
|
2938
|
-
if (
|
|
2939
|
-
const
|
|
2940
|
-
for (const
|
|
2941
|
-
B.style.removeProperty(
|
|
2940
|
+
for (const [B, Z, de] of M) {
|
|
2941
|
+
if (Z === "normal") continue;
|
|
2942
|
+
const ne = Lr(B);
|
|
2943
|
+
for (const Ne of de)
|
|
2944
|
+
B.style.removeProperty(Ne.property), Er(ne, Z, Ne.property, Ne.newValue);
|
|
2942
2945
|
}
|
|
2943
|
-
for (const [B,
|
|
2944
|
-
if (
|
|
2945
|
-
for (const
|
|
2946
|
-
B.style.setProperty(
|
|
2947
|
-
return
|
|
2946
|
+
for (const [B, Z, de] of M)
|
|
2947
|
+
if (Z === "normal")
|
|
2948
|
+
for (const ne of de)
|
|
2949
|
+
B.style.setProperty(ne.property, ne.newValue);
|
|
2950
|
+
return K("Change applied"), { applied: !0, skipRevert: !0 };
|
|
2948
2951
|
}
|
|
2949
|
-
const
|
|
2950
|
-
for (const [B,
|
|
2951
|
-
const
|
|
2952
|
+
const J = r ?? c ?? void 0, te = [];
|
|
2953
|
+
for (const [B, Z, de] of M) {
|
|
2954
|
+
const ne = Ge(B), Ne = {
|
|
2952
2955
|
schemaVersion: 1,
|
|
2953
|
-
elementSelector: Mt(B,
|
|
2954
|
-
sourceFile:
|
|
2955
|
-
lineNumber:
|
|
2956
|
-
targetScope:
|
|
2957
|
-
state:
|
|
2956
|
+
elementSelector: Mt(B, j),
|
|
2957
|
+
sourceFile: ne.sourceFile,
|
|
2958
|
+
lineNumber: ne.lineNumber,
|
|
2959
|
+
targetScope: j,
|
|
2960
|
+
state: Z,
|
|
2958
2961
|
stylingSystem: kt(B),
|
|
2959
|
-
changes:
|
|
2962
|
+
changes: de
|
|
2960
2963
|
};
|
|
2961
|
-
|
|
2964
|
+
te.push(await Zn(Ne, { applyEndpoint: J, onApply: o }));
|
|
2962
2965
|
}
|
|
2963
|
-
const
|
|
2966
|
+
const xe = te.every(
|
|
2964
2967
|
(B) => B.mode === "mcp" && B.result.success && B.result.linesChanged.length > 0
|
|
2965
2968
|
);
|
|
2966
|
-
return
|
|
2967
|
-
B.mode === "error" ? console.error(`[pixelagent] Apply #${
|
|
2968
|
-
}), { applied:
|
|
2969
|
+
return K(xe ? "Change applied" : "Apply failed"), te.forEach((B, Z) => {
|
|
2970
|
+
B.mode === "error" ? console.error(`[pixelagent] Apply #${Z} failed:`, B.message) : B.mode === "clipboard" ? console.warn(`[pixelagent] Apply #${Z} fell back to clipboard`) : B.mode === "mcp" && !B.result.success && console.warn(`[pixelagent] Apply #${Z} reported no changes:`, B.result);
|
|
2971
|
+
}), { applied: xe };
|
|
2969
2972
|
},
|
|
2970
|
-
[
|
|
2973
|
+
[j, r, c, o, s, K]
|
|
2971
2974
|
), et = (b) => {
|
|
2972
|
-
|
|
2975
|
+
a.setSettingsOpen(!1), f(!0), v(b), R(null), E(null), h(null), I([]), U(null), b === "annotate" && ee(!1);
|
|
2973
2976
|
}, Xt = () => {
|
|
2974
|
-
f(!1), v("idle"), R(null),
|
|
2977
|
+
f(!1), v("idle"), R(null), E(null), h(null), I([]), U(null), ee(!1), oe(!1);
|
|
2975
2978
|
}, Gt = F ? Nt(F) : null;
|
|
2976
2979
|
return /* @__PURE__ */ d(
|
|
2977
2980
|
"div",
|
|
2978
2981
|
{
|
|
2979
|
-
ref:
|
|
2982
|
+
ref: ae,
|
|
2980
2983
|
className: "pa-root",
|
|
2981
2984
|
"data-pixelagent-root": !0,
|
|
2982
|
-
...
|
|
2985
|
+
...a.rootAttributes,
|
|
2983
2986
|
children: [
|
|
2984
2987
|
/* @__PURE__ */ n(
|
|
2985
|
-
|
|
2988
|
+
Mr,
|
|
2986
2989
|
{
|
|
2987
|
-
rootAttributes:
|
|
2988
|
-
hostTheme:
|
|
2989
|
-
chrome:
|
|
2990
|
-
settingsOpen:
|
|
2991
|
-
onToggleSettings:
|
|
2992
|
-
onCloseSettings: () =>
|
|
2993
|
-
onToggleHostTheme:
|
|
2990
|
+
rootAttributes: a.rootAttributes,
|
|
2991
|
+
hostTheme: a.hostTheme,
|
|
2992
|
+
chrome: a.chrome,
|
|
2993
|
+
settingsOpen: a.settingsOpen,
|
|
2994
|
+
onToggleSettings: a.toggleSettings,
|
|
2995
|
+
onCloseSettings: () => a.setSettingsOpen(!1),
|
|
2996
|
+
onToggleHostTheme: a.toggleHostTheme,
|
|
2994
2997
|
active: l,
|
|
2995
2998
|
mode: p,
|
|
2996
2999
|
captureMode: m,
|
|
2997
3000
|
annotationCount: y.length,
|
|
2998
3001
|
multiSelectCount: x.length,
|
|
2999
3002
|
copyStatus: P,
|
|
3000
|
-
copyAllFrom:
|
|
3003
|
+
copyAllFrom: O,
|
|
3001
3004
|
onActivateAnnotate: () => et("annotate"),
|
|
3002
3005
|
onActivateEdit: () => et("edit"),
|
|
3003
3006
|
onDeactivate: Xt,
|
|
3004
3007
|
onCopyAll: () => Qe("toolbar"),
|
|
3005
3008
|
onCaptureModeChange: g,
|
|
3006
3009
|
onConfirmMultiSelect: () => {
|
|
3007
|
-
x.length > 0 &&
|
|
3010
|
+
x.length > 0 && we(x);
|
|
3008
3011
|
}
|
|
3009
3012
|
}
|
|
3010
3013
|
),
|
|
3011
|
-
l && p === "annotate" && /* @__PURE__ */ d(
|
|
3014
|
+
l && p === "annotate" && /* @__PURE__ */ d(q, { children: [
|
|
3012
3015
|
/* @__PURE__ */ n(
|
|
3013
|
-
|
|
3016
|
+
Et,
|
|
3014
3017
|
{
|
|
3015
3018
|
element: N,
|
|
3016
|
-
selected:
|
|
3019
|
+
selected: z,
|
|
3017
3020
|
multiSelected: x
|
|
3018
3021
|
}
|
|
3019
3022
|
),
|
|
3020
|
-
/* @__PURE__ */ n(
|
|
3021
|
-
/* @__PURE__ */ n(
|
|
3023
|
+
/* @__PURE__ */ n(fr, { annotations: y }),
|
|
3024
|
+
/* @__PURE__ */ n(cr, { area: Gt, isDragging: !!F })
|
|
3022
3025
|
] }),
|
|
3023
3026
|
l && p === "annotate" && L && /* @__PURE__ */ n(
|
|
3024
|
-
|
|
3027
|
+
lr,
|
|
3025
3028
|
{
|
|
3026
3029
|
elements: L.elements,
|
|
3027
3030
|
areaBbox: L.areaBbox,
|
|
@@ -3030,15 +3033,15 @@ function $r({
|
|
|
3030
3033
|
}
|
|
3031
3034
|
),
|
|
3032
3035
|
l && p === "edit" && /* @__PURE__ */ n(
|
|
3033
|
-
|
|
3036
|
+
Jn,
|
|
3034
3037
|
{
|
|
3035
|
-
selectedElement:
|
|
3038
|
+
selectedElement: z,
|
|
3036
3039
|
hoveredElement: N,
|
|
3037
3040
|
onSelectElement: R,
|
|
3038
|
-
onHoverElement:
|
|
3039
|
-
targetScope:
|
|
3040
|
-
onTargetScopeChange:
|
|
3041
|
-
elementState:
|
|
3041
|
+
onHoverElement: E,
|
|
3042
|
+
targetScope: j,
|
|
3043
|
+
onTargetScopeChange: ie,
|
|
3044
|
+
elementState: ce,
|
|
3042
3045
|
onElementStateChange: C,
|
|
3043
3046
|
onApply: Yt,
|
|
3044
3047
|
applyStatus: p === "edit" ? P : null,
|
|
@@ -3046,36 +3049,36 @@ function $r({
|
|
|
3046
3049
|
}
|
|
3047
3050
|
),
|
|
3048
3051
|
W && /* @__PURE__ */ n(
|
|
3049
|
-
|
|
3052
|
+
mr,
|
|
3050
3053
|
{
|
|
3051
3054
|
annotations: y,
|
|
3052
|
-
collapsed:
|
|
3053
|
-
onToggleCollapsed: () =>
|
|
3055
|
+
collapsed: re,
|
|
3056
|
+
onToggleCollapsed: () => oe((b) => !b),
|
|
3054
3057
|
onClose: () => {
|
|
3055
|
-
|
|
3058
|
+
ee(!0), oe(!1);
|
|
3056
3059
|
},
|
|
3057
3060
|
onCopyAll: () => Qe("session"),
|
|
3058
3061
|
onCopyOne: Ut,
|
|
3059
3062
|
onRemove: k,
|
|
3060
3063
|
onUpdate: w,
|
|
3061
3064
|
copyStatus: P,
|
|
3062
|
-
copiedEntryId:
|
|
3063
|
-
copyAllFrom:
|
|
3065
|
+
copiedEntryId: T,
|
|
3066
|
+
copyAllFrom: O
|
|
3064
3067
|
}
|
|
3065
3068
|
)
|
|
3066
3069
|
]
|
|
3067
3070
|
}
|
|
3068
3071
|
);
|
|
3069
3072
|
}
|
|
3070
|
-
function
|
|
3073
|
+
function Rr() {
|
|
3071
3074
|
return typeof process < "u" && process.env.NODE_ENV !== "production";
|
|
3072
3075
|
}
|
|
3073
|
-
function
|
|
3074
|
-
return
|
|
3076
|
+
function Fr() {
|
|
3077
|
+
return Rr() ? /* @__PURE__ */ n(Ir, {}) : null;
|
|
3075
3078
|
}
|
|
3076
3079
|
export {
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
+
Ir as PixelAgent,
|
|
3081
|
+
Fr as PixelAgentDev,
|
|
3082
|
+
Rr as isDevEnvironment
|
|
3080
3083
|
};
|
|
3081
3084
|
//# sourceMappingURL=pixelagent.js.map
|