pixelagent 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/edit/useEditPreview.d.ts.map +1 -1
- package/dist/pixelagent.js +537 -531
- package/dist/pixelagent.js.map +1 -1
- package/package.json +3 -3
package/dist/pixelagent.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as d, Fragment as K, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { getElementDisplayLabel as Xe, captureTextSnapshot as tt, captureInlineStyles as nt, restoreInlineStyles as
|
|
2
|
+
import { useState as A, useEffect as H, useRef as X, useMemo as ke, useLayoutEffect as Kt, useCallback as E, useId as jt } from "react";
|
|
3
|
+
import { getElementDisplayLabel as Xe, captureTextSnapshot as tt, captureInlineStyles as nt, restoreInlineStyles as Ne, restoreTextSnapshot as Me, getPreviewTargets as Te, clearTailwindStatePreview as Ae, applyTailwindStatePreview as ze, setEditableTextPreview as rt, getRelevantComputedStyles as Se, getEditableTextInfo as fe, readReactSource as Ge, detectStylingSystem as kt, countElementInstances as Ct, getScopeSelector as Mt, getCssSelector as At, copyToClipboard as St, getWindowSelectionText as Lt, getNearestReactComponentName as qt, getDomPath as Jt, resolveElementFromEntry as Et, getAnnotationSessionDisplay as Zt, loadAnnotationSession as Qt, saveAnnotationSession as en, DEFAULT_PIXEL_AGENT_UI_SETTINGS as tn, readHostThemeFromDocument as it, resolvePixelAgentChrome as nn, applyHostThemeToDocument as rn, pixelAgentRootAttributes as an, getElementsInArea as on, formatAllAnnotations as sn, formatAnnotation as ln } from "@pixelagent/shared";
|
|
4
4
|
export * from "@pixelagent/shared";
|
|
5
5
|
import { createPortal as Ke } from "react-dom";
|
|
6
6
|
function $t({
|
|
@@ -9,8 +9,8 @@ function $t({
|
|
|
9
9
|
multiSelected: i = [],
|
|
10
10
|
primarySelected: r = null
|
|
11
11
|
}) {
|
|
12
|
-
const [a, s] =
|
|
13
|
-
if (
|
|
12
|
+
const [a, s] = A([]), o = r ?? t;
|
|
13
|
+
if (H(() => {
|
|
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)
|
|
@@ -80,24 +80,24 @@ function dn(e, t, i, r = It) {
|
|
|
80
80
|
const u = c.getContext("2d");
|
|
81
81
|
if (!u) return null;
|
|
82
82
|
const l = u.createImageData(s, o), 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
|
-
let
|
|
84
|
-
const
|
|
85
|
-
let N = 0;
|
|
86
|
-
for (let k = 0; k < o; k++)
|
|
87
|
-
for (let I = 0; I < s; I++) {
|
|
88
|
-
const P = I / s - 0.5, R = k / o - 0.5, x = un(P, R, v, m, g), T = at(0.8, 0, x - 0.15), C = at(0, 1, T), h = (P * C + 0.5) * s - I, F = (R * C + 0.5) * o - k;
|
|
89
|
-
Math.abs(h) > b && (b = Math.abs(h)), Math.abs(F) > b && (b = Math.abs(F)), E[N++] = h, E[N++] = F;
|
|
90
|
-
}
|
|
91
|
-
if (b === 0) return null;
|
|
92
|
-
b *= 0.4 * r;
|
|
83
|
+
let y = 0;
|
|
84
|
+
const S = new Float32Array(s * o * 2);
|
|
93
85
|
let w = 0;
|
|
94
|
-
for (let
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
for (let N = 0; N < o; N++)
|
|
87
|
+
for (let $ = 0; $ < s; $++) {
|
|
88
|
+
const _ = $ / s - 0.5, R = N / o - 0.5, x = un(_, R, v, m, g), I = at(0.8, 0, x - 0.15), L = at(0, 1, I), h = (_ * L + 0.5) * s - $, F = (R * L + 0.5) * o - N;
|
|
89
|
+
Math.abs(h) > y && (y = Math.abs(h)), Math.abs(F) > y && (y = Math.abs(F)), S[w++] = h, S[w++] = F;
|
|
90
|
+
}
|
|
91
|
+
if (y === 0) return null;
|
|
92
|
+
y *= 0.4 * r;
|
|
93
|
+
let k = 0;
|
|
94
|
+
for (let N = 0; N < f.length; N += 4) {
|
|
95
|
+
const $ = S[k++] / y + 0.5, _ = S[k++] / y + 0.5;
|
|
96
|
+
f[N] = $ * 255, f[N + 1] = _ * 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:
|
|
100
|
+
scale: y / a,
|
|
101
101
|
width: s,
|
|
102
102
|
height: o
|
|
103
103
|
};
|
|
@@ -137,23 +137,23 @@ function Tt({
|
|
|
137
137
|
style: s,
|
|
138
138
|
children: o
|
|
139
139
|
}) {
|
|
140
|
-
const c = t ?? (e === "capsule" ? 9999 : 20), u = r === "enhanced" ? cn : It, l =
|
|
140
|
+
const c = t ?? (e === "capsule" ? 9999 : 20), u = r === "enhanced" ? cn : It, l = X(null), f = ke(() => `pa-lg-${++fn}`, []), [p, v] = A(null);
|
|
141
141
|
Kt(() => {
|
|
142
142
|
const g = l.current;
|
|
143
143
|
if (!g) return;
|
|
144
|
-
let
|
|
145
|
-
const
|
|
146
|
-
cancelAnimationFrame(
|
|
147
|
-
const
|
|
148
|
-
if (
|
|
149
|
-
const
|
|
144
|
+
let y = 0;
|
|
145
|
+
const S = () => {
|
|
146
|
+
cancelAnimationFrame(y), y = requestAnimationFrame(() => {
|
|
147
|
+
const k = g.getBoundingClientRect(), N = Math.round(k.width), $ = Math.round(k.height);
|
|
148
|
+
if (N < 8 || $ < 8) return;
|
|
149
|
+
const _ = e === "capsule" ? $ / 2 : Math.min(c, N / 2, $ / 2), R = dn(N, $, _, u);
|
|
150
150
|
R && v(R);
|
|
151
151
|
});
|
|
152
152
|
};
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
return
|
|
156
|
-
cancelAnimationFrame(
|
|
153
|
+
S();
|
|
154
|
+
const w = new ResizeObserver(S);
|
|
155
|
+
return w.observe(g), () => {
|
|
156
|
+
cancelAnimationFrame(y), w.disconnect();
|
|
157
157
|
};
|
|
158
158
|
}, [e, c, u]);
|
|
159
159
|
const m = p && Ue() && typeof document < "u" ? Ke(
|
|
@@ -235,7 +235,7 @@ function Tt({
|
|
|
235
235
|
)
|
|
236
236
|
] });
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function V({
|
|
239
239
|
variant: e = "regular",
|
|
240
240
|
className: t = "",
|
|
241
241
|
children: i,
|
|
@@ -251,7 +251,7 @@ function H({
|
|
|
251
251
|
}
|
|
252
252
|
);
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function Pe({
|
|
255
255
|
variant: e = "sheet",
|
|
256
256
|
side: t = "left",
|
|
257
257
|
className: i = "",
|
|
@@ -273,7 +273,7 @@ function Rt({
|
|
|
273
273
|
defaultPosition: e = null,
|
|
274
274
|
computeDefaultPosition: t
|
|
275
275
|
} = {}) {
|
|
276
|
-
const [i, r] =
|
|
276
|
+
const [i, r] = A(e), [a, s] = A(!1), o = X(null), c = X(null), u = E(() => {
|
|
277
277
|
if (i !== null) return;
|
|
278
278
|
const m = c.current;
|
|
279
279
|
if (!m) return;
|
|
@@ -285,45 +285,45 @@ function Rt({
|
|
|
285
285
|
}
|
|
286
286
|
);
|
|
287
287
|
}, [i, t]);
|
|
288
|
-
|
|
288
|
+
H(() => {
|
|
289
289
|
u();
|
|
290
|
-
}, [u]),
|
|
290
|
+
}, [u]), H(() => {
|
|
291
291
|
const m = () => {
|
|
292
292
|
r((g) => {
|
|
293
293
|
if (!g || !c.current) return g;
|
|
294
|
-
const
|
|
294
|
+
const y = c.current.getBoundingClientRect();
|
|
295
295
|
return {
|
|
296
|
-
x: Math.min(g.x, window.innerWidth -
|
|
297
|
-
y: Math.min(g.y, window.innerHeight -
|
|
296
|
+
x: Math.min(g.x, window.innerWidth - y.width),
|
|
297
|
+
y: Math.min(g.y, window.innerHeight - y.height)
|
|
298
298
|
};
|
|
299
299
|
});
|
|
300
300
|
};
|
|
301
301
|
return window.addEventListener("resize", m), () => window.removeEventListener("resize", m);
|
|
302
302
|
}, []);
|
|
303
|
-
const l =
|
|
303
|
+
const l = E(
|
|
304
304
|
(m) => {
|
|
305
305
|
if (m.button !== 0) return;
|
|
306
306
|
const g = c.current;
|
|
307
307
|
if (!g) return;
|
|
308
|
-
let
|
|
309
|
-
if (!
|
|
310
|
-
const
|
|
311
|
-
|
|
308
|
+
let y = i;
|
|
309
|
+
if (!y) {
|
|
310
|
+
const S = g.getBoundingClientRect();
|
|
311
|
+
y = { x: S.left, y: S.top }, r(y);
|
|
312
312
|
}
|
|
313
313
|
o.current = {
|
|
314
314
|
pointerId: m.pointerId,
|
|
315
315
|
startX: m.clientX,
|
|
316
316
|
startY: m.clientY,
|
|
317
|
-
originX:
|
|
318
|
-
originY:
|
|
317
|
+
originX: y.x,
|
|
318
|
+
originY: y.y
|
|
319
319
|
}, s(!0), m.currentTarget.setPointerCapture(m.pointerId), m.preventDefault();
|
|
320
320
|
},
|
|
321
321
|
[i]
|
|
322
|
-
), f =
|
|
322
|
+
), f = E((m) => {
|
|
323
323
|
if (!o.current || o.current.pointerId !== m.pointerId) return;
|
|
324
|
-
const g = c.current,
|
|
325
|
-
r({ x:
|
|
326
|
-
}, []), p =
|
|
324
|
+
const g = c.current, y = (g == null ? void 0 : g.offsetWidth) ?? 320, S = (g == null ? void 0 : g.offsetHeight) ?? 48, w = m.clientX - o.current.startX, k = m.clientY - o.current.startY, N = Math.max(8, Math.min(window.innerWidth - y - 8, o.current.originX + w)), $ = Math.max(8, Math.min(window.innerHeight - S - 8, o.current.originY + k));
|
|
325
|
+
r({ x: N, y: $ });
|
|
326
|
+
}, []), p = E((m) => {
|
|
327
327
|
if (!(!o.current || o.current.pointerId !== m.pointerId)) {
|
|
328
328
|
o.current = null, s(!1);
|
|
329
329
|
try {
|
|
@@ -482,56 +482,56 @@ function Nn() {
|
|
|
482
482
|
return t ? { "data-pa-chrome": t } : {};
|
|
483
483
|
}
|
|
484
484
|
function _e({ label: e, value: t, onChange: i }) {
|
|
485
|
-
const [r, a] =
|
|
486
|
-
|
|
485
|
+
const [r, a] = A(!1), [s, o] = A(() => ot(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 = bn(Pt(m)), y = je(t) ? t : vn(m), S = e.toLowerCase().includes("color") ? e : `${e} color`;
|
|
486
|
+
H(() => {
|
|
487
487
|
o(ot(t));
|
|
488
488
|
}, [t]);
|
|
489
|
-
const
|
|
489
|
+
const w = E(
|
|
490
490
|
(x) => {
|
|
491
491
|
o(x), i(wn(x));
|
|
492
492
|
},
|
|
493
493
|
[i]
|
|
494
|
-
),
|
|
494
|
+
), k = E(
|
|
495
495
|
(x) => {
|
|
496
|
-
|
|
496
|
+
w(Dt(x));
|
|
497
497
|
},
|
|
498
|
-
[
|
|
499
|
-
),
|
|
498
|
+
[w]
|
|
499
|
+
), N = E(() => {
|
|
500
500
|
const x = c.current;
|
|
501
501
|
if (!x) return;
|
|
502
|
-
const
|
|
503
|
-
let h =
|
|
504
|
-
h +
|
|
505
|
-
let F =
|
|
506
|
-
const
|
|
507
|
-
F +
|
|
502
|
+
const I = x.getBoundingClientRect(), L = 260;
|
|
503
|
+
let h = I.left;
|
|
504
|
+
h + L > window.innerWidth - 12 && (h = window.innerWidth - L - 12), h = Math.max(12, h);
|
|
505
|
+
let F = I.bottom + 8;
|
|
506
|
+
const U = 320;
|
|
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
|
+
H(() => {
|
|
510
510
|
if (!r) return;
|
|
511
|
-
|
|
512
|
-
const x = (
|
|
513
|
-
var F,
|
|
514
|
-
const h =
|
|
515
|
-
(F = c.current) != null && F.contains(h) || (
|
|
516
|
-
},
|
|
517
|
-
|
|
511
|
+
N();
|
|
512
|
+
const x = (L) => {
|
|
513
|
+
var F, U;
|
|
514
|
+
const h = L.target;
|
|
515
|
+
(F = c.current) != null && F.contains(h) || (U = u.current) != null && U.contains(h) || a(!1);
|
|
516
|
+
}, I = (L) => {
|
|
517
|
+
L.key === "Escape" && a(!1);
|
|
518
518
|
};
|
|
519
|
-
return window.addEventListener("mousedown", x, !0), window.addEventListener("keydown",
|
|
520
|
-
window.removeEventListener("mousedown", x, !0), window.removeEventListener("keydown",
|
|
519
|
+
return window.addEventListener("mousedown", x, !0), window.addEventListener("keydown", I), window.addEventListener("resize", N), window.addEventListener("scroll", N, !0), () => {
|
|
520
|
+
window.removeEventListener("mousedown", x, !0), window.removeEventListener("keydown", I), window.removeEventListener("resize", N), window.removeEventListener("scroll", N, !0);
|
|
521
521
|
};
|
|
522
|
-
}, [r,
|
|
523
|
-
const
|
|
524
|
-
var
|
|
525
|
-
const
|
|
526
|
-
if (!
|
|
527
|
-
const { x: h, y: F } = xn(x,
|
|
528
|
-
|
|
529
|
-
},
|
|
530
|
-
x.preventDefault(),
|
|
531
|
-
const
|
|
532
|
-
window.removeEventListener("mousemove",
|
|
522
|
+
}, [r, N]);
|
|
523
|
+
const $ = (x, I) => {
|
|
524
|
+
var U;
|
|
525
|
+
const L = (U = l.current) == null ? void 0 : U.getBoundingClientRect();
|
|
526
|
+
if (!L) return;
|
|
527
|
+
const { x: h, y: F } = xn(x, I, L);
|
|
528
|
+
w({ ...s, s: h, v: 100 - F });
|
|
529
|
+
}, _ = (x) => {
|
|
530
|
+
x.preventDefault(), $(x.clientX, x.clientY);
|
|
531
|
+
const I = (h) => $(h.clientX, h.clientY), L = () => {
|
|
532
|
+
window.removeEventListener("mousemove", I), window.removeEventListener("mouseup", L);
|
|
533
533
|
};
|
|
534
|
-
window.addEventListener("mousemove",
|
|
534
|
+
window.addEventListener("mousemove", I), window.addEventListener("mouseup", L);
|
|
535
535
|
}, R = r ? Ke(
|
|
536
536
|
/* @__PURE__ */ n(
|
|
537
537
|
"div",
|
|
@@ -545,7 +545,7 @@ function _e({ label: e, value: t, onChange: i }) {
|
|
|
545
545
|
ref: u,
|
|
546
546
|
id: f,
|
|
547
547
|
role: "dialog",
|
|
548
|
-
"aria-label":
|
|
548
|
+
"aria-label": S,
|
|
549
549
|
className: "pa-color-picker",
|
|
550
550
|
style: { top: p.top, left: p.left, width: p.width },
|
|
551
551
|
children: [
|
|
@@ -554,11 +554,11 @@ function _e({ label: e, value: t, onChange: i }) {
|
|
|
554
554
|
"span",
|
|
555
555
|
{
|
|
556
556
|
className: "pa-color-picker-preview",
|
|
557
|
-
style: { backgroundColor:
|
|
557
|
+
style: { backgroundColor: y },
|
|
558
558
|
"aria-hidden": "true"
|
|
559
559
|
}
|
|
560
560
|
),
|
|
561
|
-
/* @__PURE__ */ n("span", { className: "pa-color-picker-header-label", children:
|
|
561
|
+
/* @__PURE__ */ n("span", { className: "pa-color-picker-header-label", children: S })
|
|
562
562
|
] }),
|
|
563
563
|
/* @__PURE__ */ n(
|
|
564
564
|
"div",
|
|
@@ -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: _,
|
|
570
570
|
children: /* @__PURE__ */ n(
|
|
571
571
|
"span",
|
|
572
572
|
{
|
|
@@ -587,7 +587,7 @@ function _e({ label: e, value: t, onChange: i }) {
|
|
|
587
587
|
max: 360,
|
|
588
588
|
value: Math.round(s.h),
|
|
589
589
|
"aria-label": "Hue",
|
|
590
|
-
onChange: (x) =>
|
|
590
|
+
onChange: (x) => w({ ...s, h: parseFloat(x.target.value) })
|
|
591
591
|
}
|
|
592
592
|
),
|
|
593
593
|
/* @__PURE__ */ n(
|
|
@@ -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) =>
|
|
611
|
+
onChange: (x) => k(yn(x.target.value, m))
|
|
612
612
|
}
|
|
613
613
|
)
|
|
614
614
|
] }),
|
|
@@ -622,9 +622,9 @@ function _e({ label: e, value: t, onChange: i }) {
|
|
|
622
622
|
min: 0,
|
|
623
623
|
max: 255,
|
|
624
624
|
value: m[x],
|
|
625
|
-
onChange: (
|
|
626
|
-
const
|
|
627
|
-
|
|
625
|
+
onChange: (I) => {
|
|
626
|
+
const L = kn(parseInt(I.target.value, 10));
|
|
627
|
+
k({ ...m, [x]: L });
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
630
|
)
|
|
@@ -648,10 +648,10 @@ 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 ||
|
|
651
|
+
r || N(), a((x) => !x);
|
|
652
652
|
},
|
|
653
653
|
children: [
|
|
654
|
-
/* @__PURE__ */ n("span", { className: "pa-color-field-swatch", style: { backgroundColor:
|
|
654
|
+
/* @__PURE__ */ n("span", { className: "pa-color-field-swatch", style: { backgroundColor: y }, "aria-hidden": "true" }),
|
|
655
655
|
/* @__PURE__ */ n(
|
|
656
656
|
"input",
|
|
657
657
|
{
|
|
@@ -673,7 +673,7 @@ function kn(e) {
|
|
|
673
673
|
return Number.isFinite(e) ? Math.min(255, Math.max(0, e)) : 0;
|
|
674
674
|
}
|
|
675
675
|
function ue({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
|
|
676
|
-
const [a, s] =
|
|
676
|
+
const [a, s] = A(i);
|
|
677
677
|
return /* @__PURE__ */ d("section", { className: `pa-edit-section ${a ? "pa-edit-section--open" : ""}`, children: [
|
|
678
678
|
/* @__PURE__ */ d(
|
|
679
679
|
"button",
|
|
@@ -705,8 +705,8 @@ 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
|
-
],
|
|
709
|
-
function
|
|
708
|
+
], Re = "";
|
|
709
|
+
function Le(e) {
|
|
710
710
|
var i;
|
|
711
711
|
return (((i = e.split(",")[0]) == null ? void 0 : i.trim()) ?? "").replace(/^["']|["']$/g, "");
|
|
712
712
|
}
|
|
@@ -714,28 +714,28 @@ function Cn(e) {
|
|
|
714
714
|
const t = e.trim();
|
|
715
715
|
if (!t)
|
|
716
716
|
return {
|
|
717
|
-
selectValue:
|
|
717
|
+
selectValue: Re,
|
|
718
718
|
options: pe
|
|
719
719
|
};
|
|
720
|
-
const i =
|
|
721
|
-
(s) => s.value === t ||
|
|
720
|
+
const i = Le(t).toLowerCase(), r = pe.find(
|
|
721
|
+
(s) => s.value === t || Le(s.value).toLowerCase() === i
|
|
722
722
|
);
|
|
723
723
|
if (r)
|
|
724
724
|
return { selectValue: r.value, options: pe };
|
|
725
725
|
const a = pe.find((s) => {
|
|
726
|
-
const o =
|
|
726
|
+
const o = Le(s.value).toLowerCase();
|
|
727
727
|
return t.toLowerCase().includes(o) || o.includes(i);
|
|
728
728
|
});
|
|
729
729
|
return a ? { selectValue: a.value, options: pe } : {
|
|
730
730
|
selectValue: t,
|
|
731
731
|
options: [
|
|
732
732
|
...pe,
|
|
733
|
-
{ value: t, label:
|
|
733
|
+
{ value: t, label: Le(t) || "Custom" }
|
|
734
734
|
]
|
|
735
735
|
};
|
|
736
736
|
}
|
|
737
737
|
function Mn({ value: e, onChange: t }) {
|
|
738
|
-
const { selectValue: i, options: r } =
|
|
738
|
+
const { selectValue: i, options: r } = ke(
|
|
739
739
|
() => Cn(e),
|
|
740
740
|
[e]
|
|
741
741
|
);
|
|
@@ -745,13 +745,13 @@ function Mn({ value: e, onChange: t }) {
|
|
|
745
745
|
"select",
|
|
746
746
|
{
|
|
747
747
|
className: "pa-select pa-font-family-select",
|
|
748
|
-
value: i ||
|
|
748
|
+
value: i || Re,
|
|
749
749
|
onChange: (a) => {
|
|
750
750
|
const s = a.target.value;
|
|
751
|
-
s && s !==
|
|
751
|
+
s && s !== Re && t(s);
|
|
752
752
|
},
|
|
753
753
|
children: [
|
|
754
|
-
/* @__PURE__ */ n("option", { value:
|
|
754
|
+
/* @__PURE__ */ n("option", { value: Re, disabled: !0, children: "Select font style" }),
|
|
755
755
|
r.map((a) => /* @__PURE__ */ n("option", { value: a.value, children: a.label }, a.value))
|
|
756
756
|
]
|
|
757
757
|
}
|
|
@@ -928,7 +928,7 @@ function Pn() {
|
|
|
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 Ee({ 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 },
|
|
@@ -949,8 +949,8 @@ function Dn() {
|
|
|
949
949
|
] });
|
|
950
950
|
}
|
|
951
951
|
function he({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
|
|
952
|
-
const [s, o] =
|
|
953
|
-
return
|
|
952
|
+
const [s, o] = A(t);
|
|
953
|
+
return H(() => {
|
|
954
954
|
o(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 }),
|
|
@@ -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 = In(t), [a, s] =
|
|
975
|
+
const r = In(t), [a, s] = A(!1), o = (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: [
|
|
@@ -990,7 +990,7 @@ function ut({ label: e, value: t, onChange: i }) {
|
|
|
990
990
|
/* @__PURE__ */ n(
|
|
991
991
|
he,
|
|
992
992
|
{
|
|
993
|
-
icon: /* @__PURE__ */ n(
|
|
993
|
+
icon: /* @__PURE__ */ n(Ee, { side: "left" }),
|
|
994
994
|
display: le(r.left),
|
|
995
995
|
ariaLabel: `${e} left`,
|
|
996
996
|
onCommit: (l) => o({ left: ce(l) })
|
|
@@ -999,7 +999,7 @@ function ut({ label: e, value: t, onChange: i }) {
|
|
|
999
999
|
/* @__PURE__ */ n(
|
|
1000
1000
|
he,
|
|
1001
1001
|
{
|
|
1002
|
-
icon: /* @__PURE__ */ n(
|
|
1002
|
+
icon: /* @__PURE__ */ n(Ee, { side: "top" }),
|
|
1003
1003
|
display: le(r.top),
|
|
1004
1004
|
ariaLabel: `${e} top`,
|
|
1005
1005
|
onCommit: (l) => o({ top: ce(l) })
|
|
@@ -1008,7 +1008,7 @@ function ut({ label: e, value: t, onChange: i }) {
|
|
|
1008
1008
|
/* @__PURE__ */ n(
|
|
1009
1009
|
he,
|
|
1010
1010
|
{
|
|
1011
|
-
icon: /* @__PURE__ */ n(
|
|
1011
|
+
icon: /* @__PURE__ */ n(Ee, { side: "right" }),
|
|
1012
1012
|
display: le(r.right),
|
|
1013
1013
|
ariaLabel: `${e} right`,
|
|
1014
1014
|
onCommit: (l) => o({ right: ce(l) })
|
|
@@ -1017,7 +1017,7 @@ function ut({ label: e, value: t, onChange: i }) {
|
|
|
1017
1017
|
/* @__PURE__ */ n(
|
|
1018
1018
|
he,
|
|
1019
1019
|
{
|
|
1020
|
-
icon: /* @__PURE__ */ n(
|
|
1020
|
+
icon: /* @__PURE__ */ n(Ee, { side: "bottom" }),
|
|
1021
1021
|
display: le(r.bottom),
|
|
1022
1022
|
ariaLabel: `${e} bottom`,
|
|
1023
1023
|
onCommit: (l) => o({ bottom: ce(l) })
|
|
@@ -1208,10 +1208,10 @@ function Gn({
|
|
|
1208
1208
|
scopeHint: f,
|
|
1209
1209
|
stateHint: p
|
|
1210
1210
|
}) {
|
|
1211
|
-
var
|
|
1212
|
-
const v = e["font-weight"] ?? "", m = e["font-style"] ?? "normal", g = e["text-decoration"] ?? "none",
|
|
1213
|
-
|
|
1214
|
-
const
|
|
1211
|
+
var I, L;
|
|
1212
|
+
const v = e["font-weight"] ?? "", m = e["font-style"] ?? "normal", g = e["text-decoration"] ?? "none", y = Yn(e["text-align"] ?? "left"), S = ((I = e.display) == null ? void 0 : I.trim()) ?? "", w = !!S, k = Xn.has(S), N = [...mt];
|
|
1213
|
+
S && !mt.includes(S) && N.push(S);
|
|
1214
|
+
const $ = ((L = e.gap) == null ? void 0 : L.trim()) ?? "", _ = $ === "normal" || $ === "" ? "0px" : $, 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
1216
|
/* @__PURE__ */ d(ue, { title: "Targeting", defaultOpen: !0, children: [
|
|
1217
1217
|
/* @__PURE__ */ d("div", { className: "pa-edit-field-grid pa-edit-field-grid--2", children: [
|
|
@@ -1327,7 +1327,7 @@ function Gn({
|
|
|
1327
1327
|
On,
|
|
1328
1328
|
{
|
|
1329
1329
|
ariaLabel: "Text align",
|
|
1330
|
-
value:
|
|
1330
|
+
value: y,
|
|
1331
1331
|
onChange: (h) => t("text-align", h),
|
|
1332
1332
|
options: [
|
|
1333
1333
|
{
|
|
@@ -1426,25 +1426,25 @@ function Gn({
|
|
|
1426
1426
|
onChange: (h) => t("margin", h)
|
|
1427
1427
|
}
|
|
1428
1428
|
),
|
|
1429
|
-
|
|
1429
|
+
w && /* @__PURE__ */ d("label", { className: "pa-prop-row pa-prop-row--compact", children: [
|
|
1430
1430
|
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Display" }),
|
|
1431
1431
|
/* @__PURE__ */ n(
|
|
1432
1432
|
"select",
|
|
1433
1433
|
{
|
|
1434
1434
|
className: "pa-select",
|
|
1435
|
-
value:
|
|
1435
|
+
value: S,
|
|
1436
1436
|
onChange: (h) => t("display", h.target.value),
|
|
1437
|
-
children:
|
|
1437
|
+
children: N.map((h) => /* @__PURE__ */ n("option", { value: h, children: h }, h))
|
|
1438
1438
|
}
|
|
1439
1439
|
)
|
|
1440
1440
|
] }),
|
|
1441
|
-
|
|
1441
|
+
k && /* @__PURE__ */ n(
|
|
1442
1442
|
ie,
|
|
1443
1443
|
{
|
|
1444
1444
|
compact: !0,
|
|
1445
1445
|
property: "gap",
|
|
1446
1446
|
label: "Gap",
|
|
1447
|
-
value:
|
|
1447
|
+
value: _,
|
|
1448
1448
|
onChange: (h) => t("gap", h)
|
|
1449
1449
|
}
|
|
1450
1450
|
)
|
|
@@ -1536,139 +1536,145 @@ const Kn = 50, gt = [
|
|
|
1536
1536
|
"opacity"
|
|
1537
1537
|
];
|
|
1538
1538
|
function jn(e, t, i) {
|
|
1539
|
-
var
|
|
1540
|
-
const r =
|
|
1541
|
-
|
|
1539
|
+
var oe;
|
|
1540
|
+
const r = X([]), a = X(/* @__PURE__ */ new Set()), s = X([]), o = X(null), c = X([]), u = X(
|
|
1541
|
+
null
|
|
1542
|
+
), [l, f] = A({}), [p, v] = A({}), [m, g] = A("none"), [y, S] = A(""), [w, k] = A(""), [N, $] = A(() => /* @__PURE__ */ new Map()), [_, R] = A(!1), x = E(() => {
|
|
1543
|
+
const C = Array.from(a.current);
|
|
1542
1544
|
return {
|
|
1543
|
-
inline: nt(
|
|
1544
|
-
text: e &&
|
|
1545
|
+
inline: nt(C, [...gt]),
|
|
1546
|
+
text: e && m !== "none" ? tt(e, m) : null
|
|
1545
1547
|
};
|
|
1546
|
-
}, [e,
|
|
1547
|
-
c.current.push(
|
|
1548
|
-
}, [
|
|
1549
|
-
(
|
|
1550
|
-
var
|
|
1548
|
+
}, [e, m]), I = E(() => {
|
|
1549
|
+
c.current.push(x()), c.current.length > Kn && c.current.shift(), R(c.current.length > 0);
|
|
1550
|
+
}, [x]), L = E(
|
|
1551
|
+
(C) => {
|
|
1552
|
+
var Y;
|
|
1551
1553
|
if (!e) return;
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1554
|
-
const
|
|
1555
|
-
r.current =
|
|
1556
|
-
const
|
|
1557
|
-
if (
|
|
1558
|
-
for (const
|
|
1559
|
-
if (
|
|
1560
|
-
for (const
|
|
1561
|
-
rt(
|
|
1554
|
+
const P = Array.from(a.current);
|
|
1555
|
+
Ne(s.current.filter((T) => P.includes(T.element))), o.current && Me(o.current);
|
|
1556
|
+
const O = Te(e, t);
|
|
1557
|
+
r.current = O, a.current = new Set(O), Ae(P), ze(O, i);
|
|
1558
|
+
const D = e ? ((Y = N.get(e)) == null ? void 0 : Y.get(i)) ?? [] : [];
|
|
1559
|
+
if (C && D.length > 0)
|
|
1560
|
+
for (const T of D)
|
|
1561
|
+
if (T.property === "textContent" || T.property === "value")
|
|
1562
|
+
for (const z of O)
|
|
1563
|
+
rt(z, T.property, T.newValue);
|
|
1562
1564
|
else
|
|
1563
|
-
for (const
|
|
1564
|
-
|
|
1565
|
+
for (const z of O)
|
|
1566
|
+
z.style.setProperty(T.property, T.newValue);
|
|
1565
1567
|
},
|
|
1566
|
-
[e, t, i,
|
|
1568
|
+
[e, t, i, N]
|
|
1567
1569
|
);
|
|
1568
|
-
|
|
1570
|
+
H(() => {
|
|
1569
1571
|
if (!e) {
|
|
1570
|
-
r.current = [], a.current = /* @__PURE__ */ new Set(), s.current = [], o.current = null, c.current = [],
|
|
1572
|
+
r.current = [], a.current = /* @__PURE__ */ new Set(), s.current = [], o.current = null, c.current = [], f({}), v({}), g("none"), S(""), k(""), $(/* @__PURE__ */ new Map()), R(!1);
|
|
1571
1573
|
return;
|
|
1572
1574
|
}
|
|
1573
|
-
const
|
|
1574
|
-
r.current =
|
|
1575
|
-
const
|
|
1576
|
-
|
|
1577
|
-
const
|
|
1578
|
-
return
|
|
1579
|
-
}, [e]),
|
|
1580
|
-
e &&
|
|
1581
|
-
}, [t]),
|
|
1582
|
-
var
|
|
1575
|
+
const C = Te(e, t);
|
|
1576
|
+
r.current = C, a.current = new Set(C), s.current = nt(C, [...gt]), c.current = [], R(!1);
|
|
1577
|
+
const P = Se(e);
|
|
1578
|
+
f(P), v(P);
|
|
1579
|
+
const O = fe(e);
|
|
1580
|
+
return g(O.kind), S(O.value), k(O.value), o.current = O.kind !== "none" ? tt(e, O.kind) : null, ze(C, i), () => Ae(C);
|
|
1581
|
+
}, [e]), H(() => {
|
|
1582
|
+
e && L(!0);
|
|
1583
|
+
}, [t]), H(() => {
|
|
1584
|
+
var Y;
|
|
1583
1585
|
if (!e) return;
|
|
1584
|
-
const
|
|
1585
|
-
r.current =
|
|
1586
|
-
s.current.filter((
|
|
1586
|
+
const C = Te(e, t);
|
|
1587
|
+
r.current = C, Ne(
|
|
1588
|
+
s.current.filter((T) => C.includes(T.element))
|
|
1587
1589
|
);
|
|
1588
|
-
const
|
|
1589
|
-
for (const
|
|
1590
|
-
if (!(
|
|
1591
|
-
for (const z of
|
|
1592
|
-
z.style.setProperty(
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1590
|
+
const P = ((Y = N.get(e)) == null ? void 0 : Y.get(i)) ?? [];
|
|
1591
|
+
for (const T of P)
|
|
1592
|
+
if (!(T.property === "textContent" || T.property === "value"))
|
|
1593
|
+
for (const z of C)
|
|
1594
|
+
z.style.setProperty(T.property, T.newValue);
|
|
1595
|
+
const O = u.current;
|
|
1596
|
+
if (O !== null && O.element === e && O.state !== i) {
|
|
1597
|
+
const T = { ...p };
|
|
1598
|
+
for (const z of P)
|
|
1599
|
+
z.property === "textContent" || z.property === "value" || (T[z.property] = z.newValue);
|
|
1600
|
+
f(T);
|
|
1601
|
+
}
|
|
1602
|
+
u.current = { element: e, state: i }, Ae(Array.from(a.current)), ze(C, i), a.current = new Set(C);
|
|
1597
1603
|
}, [i, e, t]);
|
|
1598
|
-
const
|
|
1599
|
-
(
|
|
1600
|
-
e &&
|
|
1601
|
-
const
|
|
1602
|
-
return
|
|
1604
|
+
const h = E(
|
|
1605
|
+
(C, P, O) => {
|
|
1606
|
+
e && $((D) => {
|
|
1607
|
+
const Y = new Map(D), T = new Map(Y.get(e) ?? /* @__PURE__ */ new Map()), ve = (T.get(i) ?? []).filter((be) => be.property !== C);
|
|
1608
|
+
return O === P ? ve.length === 0 ? T.delete(i) : T.set(i, ve) : T.set(i, [...ve, { property: C, oldValue: P, newValue: O }]), T.size === 0 ? Y.delete(e) : Y.set(e, T), Y;
|
|
1603
1609
|
});
|
|
1604
1610
|
},
|
|
1605
1611
|
[e, i]
|
|
1606
|
-
),
|
|
1607
|
-
(
|
|
1612
|
+
), F = E(
|
|
1613
|
+
(C, P) => {
|
|
1608
1614
|
if (!e) return;
|
|
1609
|
-
const
|
|
1610
|
-
|
|
1611
|
-
for (const [
|
|
1612
|
-
const
|
|
1613
|
-
for (const
|
|
1614
|
-
|
|
1615
|
-
|
|
1615
|
+
const O = { [C]: P };
|
|
1616
|
+
C === "border-width" && (l["border-style"] ?? "none") === "none" && Sn(P) && (O["border-style"] = "solid"), I(), f((D) => ({ ...D, ...O }));
|
|
1617
|
+
for (const [D, Y] of Object.entries(O)) {
|
|
1618
|
+
const T = p[D] ?? "";
|
|
1619
|
+
for (const z of r.current)
|
|
1620
|
+
z.style.setProperty(D, Y), a.current.add(z);
|
|
1621
|
+
h(D, T, Y);
|
|
1616
1622
|
}
|
|
1617
1623
|
},
|
|
1618
|
-
[e,
|
|
1619
|
-
),
|
|
1620
|
-
(
|
|
1621
|
-
if (!(!e ||
|
|
1622
|
-
|
|
1623
|
-
for (const
|
|
1624
|
-
rt(
|
|
1625
|
-
|
|
1624
|
+
[e, p, l, I, h]
|
|
1625
|
+
), U = E(
|
|
1626
|
+
(C) => {
|
|
1627
|
+
if (!(!e || m === "none")) {
|
|
1628
|
+
I(), S(C);
|
|
1629
|
+
for (const P of r.current)
|
|
1630
|
+
rt(P, m, C), a.current.add(P);
|
|
1631
|
+
h(m, w, C);
|
|
1626
1632
|
}
|
|
1627
1633
|
},
|
|
1628
|
-
[e,
|
|
1629
|
-
),
|
|
1630
|
-
const
|
|
1631
|
-
if (
|
|
1632
|
-
|
|
1633
|
-
const
|
|
1634
|
-
|
|
1634
|
+
[e, m, w, I, h]
|
|
1635
|
+
), ge = E(() => {
|
|
1636
|
+
const C = c.current.pop();
|
|
1637
|
+
if (C && (Ne(C.inline), C.text && Me(C.text), R(c.current.length > 0), e)) {
|
|
1638
|
+
f(Se(e));
|
|
1639
|
+
const P = fe(e);
|
|
1640
|
+
P.kind !== "none" && S(P.value);
|
|
1635
1641
|
}
|
|
1636
|
-
}, [e]),
|
|
1637
|
-
if (
|
|
1638
|
-
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1642
|
+
}, [e]), Z = E(() => {
|
|
1643
|
+
if (Ne(s.current), o.current && Me(o.current), c.current = [], R(!1), $(/* @__PURE__ */ new Map()), e) {
|
|
1644
|
+
f(Se(e));
|
|
1645
|
+
const C = fe(e);
|
|
1646
|
+
S(C.value);
|
|
1641
1647
|
}
|
|
1642
|
-
}, [e]),
|
|
1643
|
-
|
|
1644
|
-
}, []),
|
|
1645
|
-
if (
|
|
1646
|
-
|
|
1647
|
-
const
|
|
1648
|
-
|
|
1648
|
+
}, [e]), te = E(() => {
|
|
1649
|
+
Ne(s.current), o.current && Me(o.current);
|
|
1650
|
+
}, []), re = E(() => {
|
|
1651
|
+
if (te(), Ae(Array.from(a.current)), c.current = [], R(!1), $(/* @__PURE__ */ new Map()), e) {
|
|
1652
|
+
f(Se(e));
|
|
1653
|
+
const C = fe(e);
|
|
1654
|
+
C.kind !== "none" && S(C.value);
|
|
1649
1655
|
}
|
|
1650
|
-
}, [
|
|
1651
|
-
let
|
|
1652
|
-
for (const
|
|
1653
|
-
for (const
|
|
1654
|
-
const
|
|
1655
|
-
|
|
1656
|
+
}, [te, e]), W = e ? ((oe = N.get(e)) == null ? void 0 : oe.get(i)) ?? [] : [];
|
|
1657
|
+
let G = 0;
|
|
1658
|
+
for (const C of N.values())
|
|
1659
|
+
for (const P of C.values()) G += P.length;
|
|
1660
|
+
const ne = E(() => {
|
|
1661
|
+
$(/* @__PURE__ */ new Map());
|
|
1656
1662
|
}, []);
|
|
1657
1663
|
return {
|
|
1658
|
-
values:
|
|
1659
|
-
textKind:
|
|
1660
|
-
textValue:
|
|
1661
|
-
pendingChanges:
|
|
1662
|
-
pendingByElement:
|
|
1663
|
-
totalPendingCount:
|
|
1664
|
-
clearAllPending:
|
|
1665
|
-
canUndo:
|
|
1666
|
-
updateProperty:
|
|
1667
|
-
updateText:
|
|
1668
|
-
undo:
|
|
1669
|
-
reset:
|
|
1670
|
-
clearPreviews:
|
|
1671
|
-
revertPreviews:
|
|
1664
|
+
values: l,
|
|
1665
|
+
textKind: m,
|
|
1666
|
+
textValue: y,
|
|
1667
|
+
pendingChanges: W,
|
|
1668
|
+
pendingByElement: N,
|
|
1669
|
+
totalPendingCount: G,
|
|
1670
|
+
clearAllPending: ne,
|
|
1671
|
+
canUndo: _,
|
|
1672
|
+
updateProperty: F,
|
|
1673
|
+
updateText: U,
|
|
1674
|
+
undo: ge,
|
|
1675
|
+
reset: Z,
|
|
1676
|
+
clearPreviews: re,
|
|
1677
|
+
revertPreviews: te
|
|
1672
1678
|
};
|
|
1673
1679
|
}
|
|
1674
1680
|
function qn({
|
|
@@ -1689,63 +1695,63 @@ function qn({
|
|
|
1689
1695
|
values: v,
|
|
1690
1696
|
textKind: m,
|
|
1691
1697
|
textValue: g,
|
|
1692
|
-
pendingChanges:
|
|
1693
|
-
pendingByElement:
|
|
1694
|
-
totalPendingCount:
|
|
1695
|
-
clearAllPending:
|
|
1696
|
-
canUndo:
|
|
1697
|
-
updateProperty:
|
|
1698
|
-
updateText:
|
|
1698
|
+
pendingChanges: y,
|
|
1699
|
+
pendingByElement: S,
|
|
1700
|
+
totalPendingCount: w,
|
|
1701
|
+
clearAllPending: k,
|
|
1702
|
+
canUndo: N,
|
|
1703
|
+
updateProperty: $,
|
|
1704
|
+
updateText: _,
|
|
1699
1705
|
undo: R,
|
|
1700
1706
|
reset: x,
|
|
1701
|
-
clearPreviews:
|
|
1702
|
-
revertPreviews:
|
|
1703
|
-
} = jn(e, a, o), { elementRef: h, isDragging: F, style:
|
|
1704
|
-
computeDefaultPosition: (
|
|
1705
|
-
x: window.innerWidth -
|
|
1707
|
+
clearPreviews: I,
|
|
1708
|
+
revertPreviews: L
|
|
1709
|
+
} = jn(e, a, o), { elementRef: h, isDragging: F, style: U, dragHandleProps: ge } = Rt({
|
|
1710
|
+
computeDefaultPosition: (D) => ({
|
|
1711
|
+
x: window.innerWidth - D.width - 16,
|
|
1706
1712
|
y: 16
|
|
1707
1713
|
})
|
|
1708
1714
|
});
|
|
1709
|
-
|
|
1710
|
-
const
|
|
1711
|
-
(
|
|
1712
|
-
if (f(
|
|
1713
|
-
const
|
|
1714
|
-
(
|
|
1715
|
+
H(() => (p == null || p({ clearPreviews: I, revertPreviews: L }), () => p == null ? void 0 : p(null)), [p, I, L]);
|
|
1716
|
+
const Z = E(
|
|
1717
|
+
(D) => {
|
|
1718
|
+
if (f(D.target)) return;
|
|
1719
|
+
const T = document.elementsFromPoint(D.clientX, D.clientY).find(
|
|
1720
|
+
(z) => z instanceof Element && !z.closest(
|
|
1715
1721
|
"[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
|
|
1716
1722
|
)
|
|
1717
1723
|
);
|
|
1718
|
-
r(
|
|
1724
|
+
r(T ?? null);
|
|
1719
1725
|
},
|
|
1720
1726
|
[f, r]
|
|
1721
|
-
),
|
|
1722
|
-
(
|
|
1723
|
-
if (f(
|
|
1724
|
-
|
|
1725
|
-
const
|
|
1726
|
-
(
|
|
1727
|
+
), te = E(
|
|
1728
|
+
(D) => {
|
|
1729
|
+
if (f(D.target)) return;
|
|
1730
|
+
D.preventDefault(), D.stopPropagation();
|
|
1731
|
+
const T = document.elementsFromPoint(D.clientX, D.clientY).find(
|
|
1732
|
+
(z) => z instanceof Element && !z.closest(
|
|
1727
1733
|
"[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
|
|
1728
1734
|
)
|
|
1729
1735
|
);
|
|
1730
|
-
i(
|
|
1736
|
+
i(T ?? null);
|
|
1731
1737
|
},
|
|
1732
1738
|
[f, i]
|
|
1733
1739
|
);
|
|
1734
|
-
|
|
1735
|
-
document.removeEventListener("mousemove",
|
|
1736
|
-
}), [
|
|
1740
|
+
H(() => (document.addEventListener("mousemove", Z, !0), document.addEventListener("click", te, !0), () => {
|
|
1741
|
+
document.removeEventListener("mousemove", Z, !0), document.removeEventListener("click", te, !0);
|
|
1742
|
+
}), [Z, te]);
|
|
1737
1743
|
const re = async () => {
|
|
1738
|
-
if (
|
|
1739
|
-
const
|
|
1740
|
-
|
|
1741
|
-
},
|
|
1744
|
+
if (w === 0) return;
|
|
1745
|
+
const D = await u(S);
|
|
1746
|
+
D.applied && (k(), D.skipRevert || L());
|
|
1747
|
+
}, W = e ? Ge(e) : null, G = e ? kt(e) : null, ne = e ? Ct(e) : 0, oe = e ? Mt(e, "all-instances") : "", C = o !== "normal" && G === "tailwind" ? "Tailwind variant preview: matching hover:/focus:/… classes are applied without the prefix." : o !== "normal" ? "State preview uses focus/disabled simulation where possible." : null, P = ne > 1 ? a === "all-instances" ? `Preview & Apply on ${ne} elements (${oe}).` : `This instance only — ${ne - 1} other on page.` : a === "all-instances" ? "Only one match — scope has no effect." : null, O = ke(() => !e || a !== "all-instances" ? [] : Te(e, "all-instances"), [e, a]);
|
|
1742
1748
|
return /* @__PURE__ */ d(K, { children: [
|
|
1743
1749
|
/* @__PURE__ */ n(
|
|
1744
1750
|
$t,
|
|
1745
1751
|
{
|
|
1746
1752
|
element: a === "all-instances" ? null : t,
|
|
1747
1753
|
selected: e,
|
|
1748
|
-
multiSelected:
|
|
1754
|
+
multiSelected: O,
|
|
1749
1755
|
primarySelected: e
|
|
1750
1756
|
}
|
|
1751
1757
|
),
|
|
@@ -1754,8 +1760,8 @@ function qn({
|
|
|
1754
1760
|
{
|
|
1755
1761
|
ref: h,
|
|
1756
1762
|
className: `pa-edit-panel-float ${F ? "pa-edit-panel-float--dragging" : ""}`,
|
|
1757
|
-
style:
|
|
1758
|
-
children: /* @__PURE__ */ n(
|
|
1763
|
+
style: U,
|
|
1764
|
+
children: /* @__PURE__ */ n(Pe, { variant: "sheet", side: "right", className: "pa-edit-panel-glass", children: /* @__PURE__ */ d("div", { className: "pa-edit-panel-inner", children: [
|
|
1759
1765
|
/* @__PURE__ */ d("div", { className: "pa-edit-panel-header", children: [
|
|
1760
1766
|
/* @__PURE__ */ n(
|
|
1761
1767
|
"button",
|
|
@@ -1784,16 +1790,16 @@ function qn({
|
|
|
1784
1790
|
{
|
|
1785
1791
|
className: "pa-edit-meta-label",
|
|
1786
1792
|
title: `This instance: ${At(e)}
|
|
1787
|
-
All instances: ${
|
|
1793
|
+
All instances: ${oe}`,
|
|
1788
1794
|
children: Xe(e)
|
|
1789
1795
|
}
|
|
1790
1796
|
),
|
|
1791
|
-
((
|
|
1792
|
-
(
|
|
1793
|
-
|
|
1794
|
-
|
|
1797
|
+
((W == null ? void 0 : W.sourceFile) || G) && /* @__PURE__ */ d("span", { className: "pa-edit-source", children: [
|
|
1798
|
+
(W == null ? void 0 : W.sourceFile) && /* @__PURE__ */ d(K, { children: [
|
|
1799
|
+
W.sourceFile,
|
|
1800
|
+
W.lineNumber ? `:${W.lineNumber}` : ""
|
|
1795
1801
|
] }),
|
|
1796
|
-
|
|
1802
|
+
W != null && W.sourceFile && G ? " · " : "",
|
|
1797
1803
|
G ?? ""
|
|
1798
1804
|
] })
|
|
1799
1805
|
] }),
|
|
@@ -1801,31 +1807,31 @@ All instances: ${M}`,
|
|
|
1801
1807
|
Gn,
|
|
1802
1808
|
{
|
|
1803
1809
|
values: v,
|
|
1804
|
-
onPropertyChange:
|
|
1810
|
+
onPropertyChange: $,
|
|
1805
1811
|
textKind: m,
|
|
1806
1812
|
textValue: g,
|
|
1807
|
-
onTextChange:
|
|
1813
|
+
onTextChange: _,
|
|
1808
1814
|
targetScope: a,
|
|
1809
1815
|
onTargetScopeChange: s,
|
|
1810
1816
|
elementState: o,
|
|
1811
1817
|
onElementStateChange: c,
|
|
1812
|
-
instanceCount:
|
|
1813
|
-
scopeHint:
|
|
1814
|
-
stateHint:
|
|
1818
|
+
instanceCount: ne,
|
|
1819
|
+
scopeHint: P,
|
|
1820
|
+
stateHint: C
|
|
1815
1821
|
}
|
|
1816
1822
|
) }),
|
|
1817
1823
|
/* @__PURE__ */ d("div", { className: "pa-edit-panel-sticky", children: [
|
|
1818
1824
|
/* @__PURE__ */ d("div", { className: "pa-edit-actions", children: [
|
|
1819
|
-
/* @__PURE__ */ n(
|
|
1825
|
+
/* @__PURE__ */ n(V, { variant: "regular", onClick: R, disabled: !N, children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
|
|
1820
1826
|
/* @__PURE__ */ n(mn, { className: "pa-glass-btn-icon" }),
|
|
1821
1827
|
/* @__PURE__ */ n("span", { children: "Undo" })
|
|
1822
1828
|
] }) }),
|
|
1823
1829
|
/* @__PURE__ */ n(
|
|
1824
|
-
|
|
1830
|
+
V,
|
|
1825
1831
|
{
|
|
1826
1832
|
variant: "regular",
|
|
1827
1833
|
onClick: x,
|
|
1828
|
-
disabled:
|
|
1834
|
+
disabled: y.length === 0,
|
|
1829
1835
|
children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
|
|
1830
1836
|
/* @__PURE__ */ n(gn, { className: "pa-glass-btn-icon" }),
|
|
1831
1837
|
/* @__PURE__ */ n("span", { children: "Reset" })
|
|
@@ -1838,16 +1844,16 @@ All instances: ${M}`,
|
|
|
1838
1844
|
"span",
|
|
1839
1845
|
{
|
|
1840
1846
|
className: l ? /fail/i.test(l) ? "pa-change-count pa-change-count--error" : "pa-change-count pa-change-count--success" : "pa-change-count",
|
|
1841
|
-
children: l ?? `${
|
|
1847
|
+
children: l ?? `${w} pending change${w !== 1 ? "s" : ""}`
|
|
1842
1848
|
}
|
|
1843
1849
|
),
|
|
1844
1850
|
/* @__PURE__ */ n(
|
|
1845
|
-
|
|
1851
|
+
V,
|
|
1846
1852
|
{
|
|
1847
1853
|
variant: "glass-primary",
|
|
1848
1854
|
onClick: re,
|
|
1849
|
-
disabled:
|
|
1850
|
-
title:
|
|
1855
|
+
disabled: w === 0,
|
|
1856
|
+
title: W != null && W.sourceFile ? void 0 : "No source file — Apply copies selector + changes to clipboard",
|
|
1851
1857
|
children: "Apply"
|
|
1852
1858
|
}
|
|
1853
1859
|
)
|
|
@@ -1882,8 +1888,8 @@ async function Jn(e, t = {}) {
|
|
|
1882
1888
|
return await St(JSON.stringify(e, null, 2)), { mode: "clipboard" };
|
|
1883
1889
|
}
|
|
1884
1890
|
function Zn(e) {
|
|
1885
|
-
const [t, i] =
|
|
1886
|
-
return
|
|
1891
|
+
const [t, i] = A(null);
|
|
1892
|
+
return H(() => {
|
|
1887
1893
|
if (!e) {
|
|
1888
1894
|
i(null);
|
|
1889
1895
|
return;
|
|
@@ -1896,7 +1902,7 @@ function Zn(e) {
|
|
|
1896
1902
|
};
|
|
1897
1903
|
}, [e]), t;
|
|
1898
1904
|
}
|
|
1899
|
-
const ae = 8,
|
|
1905
|
+
const ae = 8, J = 8, Qn = 12, er = 300, tr = 280;
|
|
1900
1906
|
function He(e, t, i, r) {
|
|
1901
1907
|
return {
|
|
1902
1908
|
top: e,
|
|
@@ -1933,7 +1939,7 @@ function Ve(e, t) {
|
|
|
1933
1939
|
window.innerWidth - t - ae
|
|
1934
1940
|
);
|
|
1935
1941
|
}
|
|
1936
|
-
function
|
|
1942
|
+
function $e(e, t) {
|
|
1937
1943
|
return Math.min(
|
|
1938
1944
|
Math.max(ae, e),
|
|
1939
1945
|
window.innerHeight - t - ae
|
|
@@ -1947,19 +1953,19 @@ function ar(e, t) {
|
|
|
1947
1953
|
}
|
|
1948
1954
|
function or(e, t = er, i = tr) {
|
|
1949
1955
|
const r = rr(), s = e.top > window.innerHeight * 0.45 ? [
|
|
1950
|
-
{ placement: "above", top: e.top - i -
|
|
1951
|
-
{ placement: "below", top: e.bottom +
|
|
1952
|
-
{ placement: "right", top: e.top, left: e.right +
|
|
1953
|
-
{ placement: "left", top: e.top, left: e.left - t -
|
|
1956
|
+
{ placement: "above", top: e.top - i - J, left: e.left },
|
|
1957
|
+
{ placement: "below", top: e.bottom + J, left: e.left },
|
|
1958
|
+
{ placement: "right", top: e.top, left: e.right + J },
|
|
1959
|
+
{ placement: "left", top: e.top, left: e.left - t - J }
|
|
1954
1960
|
] : [
|
|
1955
|
-
{ placement: "below", top: e.bottom +
|
|
1956
|
-
{ placement: "above", top: e.top - i -
|
|
1957
|
-
{ placement: "right", top: e.top, left: e.right +
|
|
1958
|
-
{ placement: "left", top: e.top, left: e.left - t -
|
|
1961
|
+
{ placement: "below", top: e.bottom + J, left: e.left },
|
|
1962
|
+
{ placement: "above", top: e.top - i - J, left: e.left },
|
|
1963
|
+
{ placement: "right", top: e.top, left: e.right + J },
|
|
1964
|
+
{ placement: "left", top: e.top, left: e.left - t - J }
|
|
1959
1965
|
];
|
|
1960
1966
|
for (const { top: u, left: l } of s) {
|
|
1961
1967
|
const f = He(
|
|
1962
|
-
|
|
1968
|
+
$e(u, i),
|
|
1963
1969
|
Ve(l, t),
|
|
1964
1970
|
t,
|
|
1965
1971
|
i
|
|
@@ -1967,11 +1973,11 @@ function or(e, t = er, i = tr) {
|
|
|
1967
1973
|
if (ar(f, r))
|
|
1968
1974
|
return { top: f.top, left: f.left };
|
|
1969
1975
|
}
|
|
1970
|
-
let o =
|
|
1976
|
+
let o = $e(e.top - i - J, i), c = Ve(e.left, t);
|
|
1971
1977
|
if (r) {
|
|
1972
1978
|
let u = He(o, c, t, i);
|
|
1973
|
-
Ye(u, r) && (o =
|
|
1974
|
-
Math.min(e.left, r.left - t -
|
|
1979
|
+
Ye(u, r) && (o = $e(r.top - i - J, i), u = He(o, c, t, i)), Ye(u, r) && (o = $e(e.bottom + J, i), c = Ve(
|
|
1980
|
+
Math.min(e.left, r.left - t - J),
|
|
1975
1981
|
t
|
|
1976
1982
|
));
|
|
1977
1983
|
}
|
|
@@ -1983,24 +1989,24 @@ function sr({
|
|
|
1983
1989
|
onSubmit: i,
|
|
1984
1990
|
onCancel: r
|
|
1985
1991
|
}) {
|
|
1986
|
-
const [a, s] =
|
|
1987
|
-
if (
|
|
1988
|
-
var
|
|
1989
|
-
(
|
|
1990
|
-
}, [e]),
|
|
1991
|
-
const
|
|
1992
|
-
|
|
1992
|
+
const [a, s] = A(""), o = X(null), c = X(null), u = e[0] ?? null, l = t ? new DOMRect(t.x, t.y, t.width, t.height) : null, f = Zn(u), p = l ?? f, v = Lt(), m = u ? fe(u) : { kind: "none", value: "" }, g = m.kind !== "none" ? m.value : void 0;
|
|
1993
|
+
if (H(() => {
|
|
1994
|
+
var k;
|
|
1995
|
+
(k = o.current) == null || k.focus();
|
|
1996
|
+
}, [e]), H(() => {
|
|
1997
|
+
const k = (N) => {
|
|
1998
|
+
N.key === "Escape" && r();
|
|
1993
1999
|
};
|
|
1994
|
-
return document.addEventListener("keydown",
|
|
2000
|
+
return document.addEventListener("keydown", k), () => document.removeEventListener("keydown", k);
|
|
1995
2001
|
}, [r]), !p) return null;
|
|
1996
|
-
const
|
|
1997
|
-
a.trim() && i(a,
|
|
2002
|
+
const y = or(p), S = e.length > 1 ? `${e.length} selected` : u ? Xe(u) : "Area selection", w = (k) => {
|
|
2003
|
+
a.trim() && i(a, k);
|
|
1998
2004
|
};
|
|
1999
2005
|
return /* @__PURE__ */ n(
|
|
2000
|
-
|
|
2006
|
+
Pe,
|
|
2001
2007
|
{
|
|
2002
2008
|
variant: "popover",
|
|
2003
|
-
style: { top:
|
|
2009
|
+
style: { top: y.top, left: y.left },
|
|
2004
2010
|
children: /* @__PURE__ */ d(
|
|
2005
2011
|
"div",
|
|
2006
2012
|
{
|
|
@@ -2010,7 +2016,7 @@ function sr({
|
|
|
2010
2016
|
"aria-label": "Add annotation",
|
|
2011
2017
|
className: "pa-popover-body",
|
|
2012
2018
|
children: [
|
|
2013
|
-
/* @__PURE__ */ n("div", { className: "pa-popover-header", children: /* @__PURE__ */ n("span", { className: "pa-popover-selector", children:
|
|
2019
|
+
/* @__PURE__ */ n("div", { className: "pa-popover-header", children: /* @__PURE__ */ n("span", { className: "pa-popover-selector", children: S }) }),
|
|
2014
2020
|
(v || g) && /* @__PURE__ */ d("div", { className: "pa-popover-context", children: [
|
|
2015
2021
|
v && /* @__PURE__ */ d("p", { className: "pa-popover-context-line", children: [
|
|
2016
2022
|
/* @__PURE__ */ n("span", { className: "pa-popover-context-label", children: "Selected" }),
|
|
@@ -2029,32 +2035,32 @@ function sr({
|
|
|
2029
2035
|
ref: o,
|
|
2030
2036
|
className: "pa-textarea",
|
|
2031
2037
|
value: a,
|
|
2032
|
-
onChange: (
|
|
2038
|
+
onChange: (k) => s(k.target.value),
|
|
2033
2039
|
placeholder: "Describe the change...",
|
|
2034
2040
|
rows: 3,
|
|
2035
|
-
onKeyDown: (
|
|
2036
|
-
|
|
2041
|
+
onKeyDown: (k) => {
|
|
2042
|
+
k.key === "Enter" && (k.metaKey || k.ctrlKey) && (k.preventDefault(), w(k.shiftKey)), k.key === "Escape" && r();
|
|
2037
2043
|
}
|
|
2038
2044
|
}
|
|
2039
2045
|
)
|
|
2040
2046
|
] }),
|
|
2041
2047
|
/* @__PURE__ */ n("p", { className: "pa-popover-hint", children: "⌘↵ Add · ⇧⌘↵ Add & next · Esc Cancel" }),
|
|
2042
2048
|
/* @__PURE__ */ d("div", { className: "pa-popover-actions", children: [
|
|
2043
|
-
/* @__PURE__ */ n(
|
|
2049
|
+
/* @__PURE__ */ n(V, { variant: "ghost", onClick: r, children: "Cancel" }),
|
|
2044
2050
|
/* @__PURE__ */ n(
|
|
2045
|
-
|
|
2051
|
+
V,
|
|
2046
2052
|
{
|
|
2047
2053
|
variant: "ghost",
|
|
2048
|
-
onClick: () =>
|
|
2054
|
+
onClick: () => w(!0),
|
|
2049
2055
|
disabled: !a.trim(),
|
|
2050
2056
|
children: "Add & next"
|
|
2051
2057
|
}
|
|
2052
2058
|
),
|
|
2053
2059
|
/* @__PURE__ */ n(
|
|
2054
|
-
|
|
2060
|
+
V,
|
|
2055
2061
|
{
|
|
2056
2062
|
variant: "glass-primary",
|
|
2057
|
-
onClick: () =>
|
|
2063
|
+
onClick: () => w(!1),
|
|
2058
2064
|
disabled: !a.trim(),
|
|
2059
2065
|
children: "Add"
|
|
2060
2066
|
}
|
|
@@ -2145,8 +2151,8 @@ function ur(e) {
|
|
|
2145
2151
|
}
|
|
2146
2152
|
const pr = 20;
|
|
2147
2153
|
function hr({ annotations: e }) {
|
|
2148
|
-
const [t, i] =
|
|
2149
|
-
return
|
|
2154
|
+
const [t, i] = A([]);
|
|
2155
|
+
return H(() => {
|
|
2150
2156
|
if (e.length === 0) {
|
|
2151
2157
|
i([]);
|
|
2152
2158
|
return;
|
|
@@ -2191,7 +2197,7 @@ function hr({ annotations: e }) {
|
|
|
2191
2197
|
)) });
|
|
2192
2198
|
}
|
|
2193
2199
|
const Ze = "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]";
|
|
2194
|
-
function
|
|
2200
|
+
function Ie(e) {
|
|
2195
2201
|
return e instanceof Element ? !!e.closest(Ze) : !1;
|
|
2196
2202
|
}
|
|
2197
2203
|
function vt(e, t) {
|
|
@@ -2230,20 +2236,20 @@ function fr({
|
|
|
2230
2236
|
copiedEntryId: l,
|
|
2231
2237
|
copyAllFrom: f
|
|
2232
2238
|
}) {
|
|
2233
|
-
const [p, v] =
|
|
2234
|
-
|
|
2235
|
-
const
|
|
2236
|
-
|
|
2239
|
+
const [p, v] = A(null), [m, g] = A("");
|
|
2240
|
+
H(() => {
|
|
2241
|
+
const w = (k) => {
|
|
2242
|
+
k.key === "Escape" && (t ? r() : i());
|
|
2237
2243
|
};
|
|
2238
|
-
return document.addEventListener("keydown",
|
|
2244
|
+
return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
|
|
2239
2245
|
}, [t, r, i]);
|
|
2240
|
-
const
|
|
2241
|
-
v(
|
|
2242
|
-
},
|
|
2243
|
-
m.trim() && (c(
|
|
2246
|
+
const y = (w) => {
|
|
2247
|
+
v(w.id), g(w.note);
|
|
2248
|
+
}, S = (w) => {
|
|
2249
|
+
m.trim() && (c(w, { note: m.trim() }), v(null));
|
|
2244
2250
|
};
|
|
2245
2251
|
return /* @__PURE__ */ d(
|
|
2246
|
-
|
|
2252
|
+
Pe,
|
|
2247
2253
|
{
|
|
2248
2254
|
variant: "sheet",
|
|
2249
2255
|
side: "right",
|
|
@@ -2252,7 +2258,7 @@ function fr({
|
|
|
2252
2258
|
/* @__PURE__ */ d("div", { className: "pa-session-header", children: [
|
|
2253
2259
|
/* @__PURE__ */ d("div", { className: "pa-session-header-main", children: [
|
|
2254
2260
|
/* @__PURE__ */ n(
|
|
2255
|
-
|
|
2261
|
+
V,
|
|
2256
2262
|
{
|
|
2257
2263
|
variant: "ghost",
|
|
2258
2264
|
className: "pa-glass-btn--sm pa-session-collapse-btn",
|
|
@@ -2276,7 +2282,7 @@ function fr({
|
|
|
2276
2282
|
feedback: f === "session" ? u : null,
|
|
2277
2283
|
slotClassName: "pa-copy-feedback-slot--session",
|
|
2278
2284
|
children: /* @__PURE__ */ n(
|
|
2279
|
-
|
|
2285
|
+
V,
|
|
2280
2286
|
{
|
|
2281
2287
|
variant: "glass-primary",
|
|
2282
2288
|
className: "pa-glass-btn--sm",
|
|
@@ -2287,14 +2293,14 @@ function fr({
|
|
|
2287
2293
|
)
|
|
2288
2294
|
}
|
|
2289
2295
|
),
|
|
2290
|
-
/* @__PURE__ */ n(
|
|
2296
|
+
/* @__PURE__ */ n(V, { variant: "ghost", onClick: r, "aria-label": "Close session panel", children: "✕" })
|
|
2291
2297
|
] })
|
|
2292
2298
|
] }),
|
|
2293
2299
|
!t && /* @__PURE__ */ d("ul", { className: "pa-session-list", children: [
|
|
2294
2300
|
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." }),
|
|
2295
|
-
e.map((
|
|
2296
|
-
const
|
|
2297
|
-
return /* @__PURE__ */ n("li", { className: "pa-session-item", children: p ===
|
|
2301
|
+
e.map((w) => {
|
|
2302
|
+
const k = Zt(w);
|
|
2303
|
+
return /* @__PURE__ */ n("li", { className: "pa-session-item", children: p === w.id ? /* @__PURE__ */ d("div", { className: "pa-session-edit", children: [
|
|
2298
2304
|
/* @__PURE__ */ d("label", { className: "pa-label", children: [
|
|
2299
2305
|
"Note",
|
|
2300
2306
|
/* @__PURE__ */ n(
|
|
@@ -2302,18 +2308,18 @@ function fr({
|
|
|
2302
2308
|
{
|
|
2303
2309
|
className: "pa-textarea",
|
|
2304
2310
|
value: m,
|
|
2305
|
-
onChange: (
|
|
2311
|
+
onChange: (N) => g(N.target.value),
|
|
2306
2312
|
rows: 3
|
|
2307
2313
|
}
|
|
2308
2314
|
)
|
|
2309
2315
|
] }),
|
|
2310
2316
|
/* @__PURE__ */ d("div", { className: "pa-session-item-actions", children: [
|
|
2311
|
-
/* @__PURE__ */ n(
|
|
2317
|
+
/* @__PURE__ */ n(V, { variant: "ghost", onClick: () => v(null), children: "Cancel" }),
|
|
2312
2318
|
/* @__PURE__ */ n(
|
|
2313
|
-
|
|
2319
|
+
V,
|
|
2314
2320
|
{
|
|
2315
2321
|
variant: "glass-primary",
|
|
2316
|
-
onClick: () =>
|
|
2322
|
+
onClick: () => S(w.id),
|
|
2317
2323
|
disabled: !m.trim(),
|
|
2318
2324
|
children: "Save"
|
|
2319
2325
|
}
|
|
@@ -2321,12 +2327,12 @@ function fr({
|
|
|
2321
2327
|
] })
|
|
2322
2328
|
] }) : /* @__PURE__ */ d(K, { children: [
|
|
2323
2329
|
/* @__PURE__ */ d("div", { className: "pa-session-content", children: [
|
|
2324
|
-
/* @__PURE__ */ n("span", { className: "pa-session-target", children:
|
|
2325
|
-
/* @__PURE__ */ n("p", { className: "pa-session-note", children:
|
|
2326
|
-
|
|
2330
|
+
/* @__PURE__ */ n("span", { className: "pa-session-target", children: k.target }),
|
|
2331
|
+
/* @__PURE__ */ n("p", { className: "pa-session-note", children: k.note }),
|
|
2332
|
+
k.meta && /* @__PURE__ */ n("p", { className: "pa-session-meta-line", children: k.meta })
|
|
2327
2333
|
] }),
|
|
2328
2334
|
/* @__PURE__ */ d("div", { className: "pa-session-item-actions", children: [
|
|
2329
|
-
u === "Copied!" && l ===
|
|
2335
|
+
u === "Copied!" && l === w.id ? /* @__PURE__ */ n(
|
|
2330
2336
|
"span",
|
|
2331
2337
|
{
|
|
2332
2338
|
className: "pa-status pa-copy-feedback-slot pa-copy-feedback-slot--item",
|
|
@@ -2335,37 +2341,37 @@ function fr({
|
|
|
2335
2341
|
children: "Copied!"
|
|
2336
2342
|
}
|
|
2337
2343
|
) : /* @__PURE__ */ n(
|
|
2338
|
-
|
|
2344
|
+
V,
|
|
2339
2345
|
{
|
|
2340
2346
|
variant: "glass-primary",
|
|
2341
2347
|
className: "pa-glass-btn--sm",
|
|
2342
|
-
onClick: () => s(
|
|
2348
|
+
onClick: () => s(w.id),
|
|
2343
2349
|
"aria-label": "Copy annotation",
|
|
2344
2350
|
children: "Copy"
|
|
2345
2351
|
}
|
|
2346
2352
|
),
|
|
2347
2353
|
/* @__PURE__ */ n(
|
|
2348
|
-
|
|
2354
|
+
V,
|
|
2349
2355
|
{
|
|
2350
2356
|
variant: "ghost",
|
|
2351
2357
|
className: "pa-glass-btn--sm",
|
|
2352
|
-
onClick: () =>
|
|
2358
|
+
onClick: () => y(w),
|
|
2353
2359
|
"aria-label": "Edit annotation note",
|
|
2354
2360
|
children: "✎"
|
|
2355
2361
|
}
|
|
2356
2362
|
),
|
|
2357
2363
|
/* @__PURE__ */ n(
|
|
2358
|
-
|
|
2364
|
+
V,
|
|
2359
2365
|
{
|
|
2360
2366
|
variant: "ghost",
|
|
2361
2367
|
className: "pa-glass-btn--sm",
|
|
2362
|
-
onClick: () => o(
|
|
2368
|
+
onClick: () => o(w.id),
|
|
2363
2369
|
"aria-label": "Remove annotation",
|
|
2364
2370
|
children: "✕"
|
|
2365
2371
|
}
|
|
2366
2372
|
)
|
|
2367
2373
|
] })
|
|
2368
|
-
] }) },
|
|
2374
|
+
] }) }, w.id);
|
|
2369
2375
|
})
|
|
2370
2376
|
] })
|
|
2371
2377
|
]
|
|
@@ -2425,8 +2431,8 @@ function br({
|
|
|
2425
2431
|
chrome: r,
|
|
2426
2432
|
onToggleHostTheme: a
|
|
2427
2433
|
}) {
|
|
2428
|
-
const s =
|
|
2429
|
-
return
|
|
2434
|
+
const s = X(null);
|
|
2435
|
+
return H(() => {
|
|
2430
2436
|
if (!e) return;
|
|
2431
2437
|
const o = (u) => {
|
|
2432
2438
|
u.key === "Escape" && t();
|
|
@@ -2438,7 +2444,7 @@ function br({
|
|
|
2438
2444
|
return window.addEventListener("keydown", o), window.addEventListener("mousedown", c), () => {
|
|
2439
2445
|
window.removeEventListener("keydown", o), window.removeEventListener("mousedown", c);
|
|
2440
2446
|
};
|
|
2441
|
-
}, [e, t]), e ? /* @__PURE__ */ n("div", { ref: s, className: "pa-settings-menu", role: "dialog", "aria-label": "PixelAgent settings", children: /* @__PURE__ */ n(
|
|
2447
|
+
}, [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: [
|
|
2442
2448
|
/* @__PURE__ */ d("header", { className: "pa-settings-menu-header", children: [
|
|
2443
2449
|
/* @__PURE__ */ n("h4", { className: "pa-settings-menu-title", children: "Settings" }),
|
|
2444
2450
|
/* @__PURE__ */ n("p", { className: "pa-settings-menu-subtitle", children: "Appearance and chrome" })
|
|
@@ -2448,7 +2454,7 @@ function br({
|
|
|
2448
2454
|
/* @__PURE__ */ d("div", { className: "pa-settings-row", children: [
|
|
2449
2455
|
/* @__PURE__ */ n("span", { className: "pa-settings-row-value", children: i === "dark" ? "Dark canvas" : "Light canvas" }),
|
|
2450
2456
|
/* @__PURE__ */ n(
|
|
2451
|
-
|
|
2457
|
+
V,
|
|
2452
2458
|
{
|
|
2453
2459
|
variant: "icon",
|
|
2454
2460
|
onClick: a,
|
|
@@ -2529,17 +2535,17 @@ function Cr({
|
|
|
2529
2535
|
copyStatus: v,
|
|
2530
2536
|
copyAllFrom: m,
|
|
2531
2537
|
onActivateAnnotate: g,
|
|
2532
|
-
onActivateEdit:
|
|
2533
|
-
onDeactivate:
|
|
2534
|
-
onCopyAll:
|
|
2535
|
-
onCaptureModeChange:
|
|
2536
|
-
onConfirmMultiSelect:
|
|
2538
|
+
onActivateEdit: y,
|
|
2539
|
+
onDeactivate: S,
|
|
2540
|
+
onCopyAll: w,
|
|
2541
|
+
onCaptureModeChange: k,
|
|
2542
|
+
onConfirmMultiSelect: N
|
|
2537
2543
|
}) {
|
|
2538
|
-
const { elementRef:
|
|
2544
|
+
const { elementRef: $, isDragging: _, style: R, dragHandleProps: x } = Rt(), I = /* @__PURE__ */ d(
|
|
2539
2545
|
"div",
|
|
2540
2546
|
{
|
|
2541
|
-
ref:
|
|
2542
|
-
className: `pa-toolbar-float ${
|
|
2547
|
+
ref: $,
|
|
2548
|
+
className: `pa-toolbar-float ${_ ? "pa-toolbar-float--dragging" : ""}`,
|
|
2543
2549
|
style: R,
|
|
2544
2550
|
role: "toolbar",
|
|
2545
2551
|
"aria-label": "PixelAgent",
|
|
@@ -2576,16 +2582,16 @@ function Cr({
|
|
|
2576
2582
|
{
|
|
2577
2583
|
className: "pa-select pa-toolbar-capture-select",
|
|
2578
2584
|
value: l,
|
|
2579
|
-
onChange: (
|
|
2585
|
+
onChange: (L) => k(L.target.value),
|
|
2580
2586
|
"aria-label": "Capture mode",
|
|
2581
|
-
children: Nr.map((
|
|
2587
|
+
children: Nr.map((L) => /* @__PURE__ */ n("option", { value: L, children: kr[L] }, L))
|
|
2582
2588
|
}
|
|
2583
2589
|
),
|
|
2584
2590
|
p > 0 && /* @__PURE__ */ n(
|
|
2585
|
-
|
|
2591
|
+
V,
|
|
2586
2592
|
{
|
|
2587
2593
|
variant: "glass-primary",
|
|
2588
|
-
onClick:
|
|
2594
|
+
onClick: N,
|
|
2589
2595
|
"aria-label": "Annotate selected elements",
|
|
2590
2596
|
children: p
|
|
2591
2597
|
}
|
|
@@ -2596,10 +2602,10 @@ function Cr({
|
|
|
2596
2602
|
feedback: m === "toolbar" ? v : null,
|
|
2597
2603
|
slotClassName: "pa-copy-feedback-slot--toolbar",
|
|
2598
2604
|
children: /* @__PURE__ */ n(
|
|
2599
|
-
|
|
2605
|
+
V,
|
|
2600
2606
|
{
|
|
2601
2607
|
variant: "glass-primary",
|
|
2602
|
-
onClick:
|
|
2608
|
+
onClick: w,
|
|
2603
2609
|
disabled: f === 0,
|
|
2604
2610
|
"aria-label": f > 0 ? `Copy all annotations (${f})` : "Copy all annotations",
|
|
2605
2611
|
children: f > 0 ? `Copy (${f})` : "Copy"
|
|
@@ -2610,11 +2616,11 @@ function Cr({
|
|
|
2610
2616
|
] })
|
|
2611
2617
|
] }),
|
|
2612
2618
|
/* @__PURE__ */ n(
|
|
2613
|
-
|
|
2619
|
+
V,
|
|
2614
2620
|
{
|
|
2615
2621
|
variant: "icon",
|
|
2616
2622
|
className: "pa-toolbar-close",
|
|
2617
|
-
onClick:
|
|
2623
|
+
onClick: S,
|
|
2618
2624
|
"aria-label": "Close",
|
|
2619
2625
|
children: /* @__PURE__ */ n(
|
|
2620
2626
|
"svg",
|
|
@@ -2638,13 +2644,13 @@ function Cr({
|
|
|
2638
2644
|
}
|
|
2639
2645
|
)
|
|
2640
2646
|
] }) : /* @__PURE__ */ d("div", { className: "pa-toolbar-segment", children: [
|
|
2641
|
-
/* @__PURE__ */ n(
|
|
2642
|
-
/* @__PURE__ */ n(
|
|
2647
|
+
/* @__PURE__ */ n(V, { onClick: g, children: "Annotate" }),
|
|
2648
|
+
/* @__PURE__ */ n(V, { onClick: y, children: "Edit" })
|
|
2643
2649
|
] }),
|
|
2644
2650
|
!c && /* @__PURE__ */ d(K, { children: [
|
|
2645
2651
|
/* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
|
|
2646
2652
|
/* @__PURE__ */ n(
|
|
2647
|
-
|
|
2653
|
+
V,
|
|
2648
2654
|
{
|
|
2649
2655
|
variant: "icon",
|
|
2650
2656
|
className: "pa-toolbar-settings",
|
|
@@ -2662,34 +2668,34 @@ function Cr({
|
|
|
2662
2668
|
]
|
|
2663
2669
|
}
|
|
2664
2670
|
);
|
|
2665
|
-
return typeof document > "u" ?
|
|
2671
|
+
return typeof document > "u" ? I : Ke(
|
|
2666
2672
|
/* @__PURE__ */ n(
|
|
2667
2673
|
"div",
|
|
2668
2674
|
{
|
|
2669
2675
|
className: "pa-root pa-root--toolbar-portal",
|
|
2670
2676
|
"data-pixelagent-toolbar-portal": !0,
|
|
2671
2677
|
...e,
|
|
2672
|
-
children:
|
|
2678
|
+
children: I
|
|
2673
2679
|
}
|
|
2674
2680
|
),
|
|
2675
2681
|
document.body
|
|
2676
2682
|
);
|
|
2677
2683
|
}
|
|
2678
2684
|
function Mr() {
|
|
2679
|
-
const e =
|
|
2685
|
+
const e = X(Qt()), [t, i] = A(
|
|
2680
2686
|
() => {
|
|
2681
2687
|
var s;
|
|
2682
2688
|
return ((s = e.current) == null ? void 0 : s.annotations) ?? [];
|
|
2683
2689
|
}
|
|
2684
2690
|
);
|
|
2685
|
-
|
|
2691
|
+
H(() => {
|
|
2686
2692
|
en({ annotations: t });
|
|
2687
2693
|
}, [t]);
|
|
2688
|
-
const r =
|
|
2694
|
+
const r = E((s, o) => {
|
|
2689
2695
|
i(
|
|
2690
2696
|
(c) => c.map((u) => u.id === s ? { ...u, ...o } : u)
|
|
2691
2697
|
);
|
|
2692
|
-
}, []), a =
|
|
2698
|
+
}, []), a = E((s) => {
|
|
2693
2699
|
i((o) => o.filter((c) => c.id !== s));
|
|
2694
2700
|
}, []);
|
|
2695
2701
|
return {
|
|
@@ -2704,17 +2710,17 @@ function Ar({
|
|
|
2704
2710
|
hostTheme: t,
|
|
2705
2711
|
onHostThemeChange: i
|
|
2706
2712
|
}) {
|
|
2707
|
-
const r =
|
|
2713
|
+
const r = ke(
|
|
2708
2714
|
() => ({ ...tn, ...e }),
|
|
2709
2715
|
[e]
|
|
2710
|
-
), [a, s] =
|
|
2716
|
+
), [a, s] = A(
|
|
2711
2717
|
() => t ?? it(r) ?? "dark"
|
|
2712
|
-
), [o, c] =
|
|
2713
|
-
|
|
2718
|
+
), [o, c] = A(!1), u = t ?? a;
|
|
2719
|
+
H(() => {
|
|
2714
2720
|
if (t !== void 0) return;
|
|
2715
2721
|
const v = () => {
|
|
2716
|
-
const
|
|
2717
|
-
|
|
2722
|
+
const y = it(r);
|
|
2723
|
+
y && s(y);
|
|
2718
2724
|
};
|
|
2719
2725
|
v();
|
|
2720
2726
|
const m = r.hostThemeAttribute, g = new MutationObserver(v);
|
|
@@ -2723,17 +2729,17 @@ function Ar({
|
|
|
2723
2729
|
attributeFilter: [m]
|
|
2724
2730
|
}), () => g.disconnect();
|
|
2725
2731
|
}, [t, r]);
|
|
2726
|
-
const l =
|
|
2732
|
+
const l = ke(
|
|
2727
2733
|
() => nn(r, u),
|
|
2728
2734
|
[r, u]
|
|
2729
|
-
), f =
|
|
2735
|
+
), f = E(() => {
|
|
2730
2736
|
const v = u === "dark" ? "light" : "dark";
|
|
2731
2737
|
if (i) {
|
|
2732
2738
|
i(v);
|
|
2733
2739
|
return;
|
|
2734
2740
|
}
|
|
2735
2741
|
s(v), rn(v, r);
|
|
2736
|
-
}, [u, i, r]), p =
|
|
2742
|
+
}, [u, i, r]), p = E(() => {
|
|
2737
2743
|
c((v) => !v);
|
|
2738
2744
|
}, []);
|
|
2739
2745
|
return {
|
|
@@ -2803,174 +2809,174 @@ function $r({
|
|
|
2803
2809
|
onApply: a,
|
|
2804
2810
|
runtimeStateStyles: s
|
|
2805
2811
|
} = {}) {
|
|
2806
|
-
const o = Ar({ ui: e, hostTheme: t, onHostThemeChange: i }), [c, u] =
|
|
2807
|
-
|
|
2812
|
+
const o = Ar({ ui: e, hostTheme: t, onHostThemeChange: i }), [c, u] = A(null);
|
|
2813
|
+
H(() => {
|
|
2808
2814
|
if (r || a) return;
|
|
2809
|
-
let
|
|
2810
|
-
return fetch(yt, { method: "GET" }).then((
|
|
2811
|
-
!
|
|
2815
|
+
let b = !1;
|
|
2816
|
+
return fetch(yt, { method: "GET" }).then((M) => {
|
|
2817
|
+
!b && M.status === 405 && u(yt);
|
|
2812
2818
|
}).catch(() => {
|
|
2813
2819
|
}), () => {
|
|
2814
|
-
|
|
2820
|
+
b = !0;
|
|
2815
2821
|
};
|
|
2816
2822
|
}, [r, a]);
|
|
2817
|
-
const [l, f] =
|
|
2818
|
-
annotations:
|
|
2819
|
-
setAnnotations:
|
|
2820
|
-
updateAnnotation:
|
|
2821
|
-
removeAnnotation:
|
|
2822
|
-
} = Mr(), [
|
|
2823
|
-
(
|
|
2824
|
-
|
|
2825
|
-
|
|
2823
|
+
const [l, f] = A(!1), [p, v] = A("idle"), [m, g] = A("element"), {
|
|
2824
|
+
annotations: y,
|
|
2825
|
+
setAnnotations: S,
|
|
2826
|
+
updateAnnotation: w,
|
|
2827
|
+
removeAnnotation: k
|
|
2828
|
+
} = Mr(), [N, $] = A(null), [_, R] = A(null), [x, I] = A([]), [L, h] = A(null), [F, U] = A(null), [ge, Z] = A(!1), [te, re] = A(!1), W = l && p === "annotate" && y.length > 0 && !ge, [G, ne] = A("this-instance"), [oe, C] = A("normal"), [P, O] = A(null), [D, Y] = A(null), [T, z] = A(null), ve = X(null), be = X(null), de = E(
|
|
2829
|
+
(b, M) => {
|
|
2830
|
+
be.current && clearTimeout(be.current), O(b), Y((M == null ? void 0 : M.entryId) ?? null), z((M == null ? void 0 : M.copyAllFrom) ?? null), be.current = setTimeout(() => {
|
|
2831
|
+
O(null), Y(null), z(null);
|
|
2826
2832
|
}, 2500);
|
|
2827
2833
|
},
|
|
2828
2834
|
[]
|
|
2829
|
-
),
|
|
2830
|
-
async (
|
|
2831
|
-
if (
|
|
2835
|
+
), Ce = E(
|
|
2836
|
+
async (b, M, j) => {
|
|
2837
|
+
if (b)
|
|
2832
2838
|
try {
|
|
2833
|
-
await St(
|
|
2839
|
+
await St(b), de(M, j);
|
|
2834
2840
|
} catch {
|
|
2835
|
-
de("Copy failed — check clipboard permissions",
|
|
2841
|
+
de("Copy failed — check clipboard permissions", j);
|
|
2836
2842
|
}
|
|
2837
2843
|
},
|
|
2838
2844
|
[de]
|
|
2839
|
-
),
|
|
2840
|
-
(
|
|
2841
|
-
|
|
2845
|
+
), ye = E(
|
|
2846
|
+
(b, M) => {
|
|
2847
|
+
b.length === 0 && !M || (h({ elements: b, areaBbox: M }), R(b[0] ?? null));
|
|
2842
2848
|
},
|
|
2843
2849
|
[]
|
|
2844
|
-
), De =
|
|
2845
|
-
(
|
|
2846
|
-
if (!(!l || p !== "annotate" ||
|
|
2850
|
+
), De = E(
|
|
2851
|
+
(b) => {
|
|
2852
|
+
if (!(!l || p !== "annotate" || Ie(b.target))) {
|
|
2847
2853
|
if (F) {
|
|
2848
|
-
|
|
2849
|
-
(
|
|
2854
|
+
U(
|
|
2855
|
+
(M) => M && { ...M, currentX: b.clientX, currentY: b.clientY }
|
|
2850
2856
|
);
|
|
2851
2857
|
return;
|
|
2852
2858
|
}
|
|
2853
|
-
m !== "area" &&
|
|
2859
|
+
m !== "area" && $(vt(b.clientX, b.clientY));
|
|
2854
2860
|
}
|
|
2855
2861
|
},
|
|
2856
2862
|
[l, p, F, m]
|
|
2857
|
-
), Oe =
|
|
2858
|
-
(
|
|
2859
|
-
!l || p !== "annotate" ||
|
|
2860
|
-
startX:
|
|
2861
|
-
startY:
|
|
2862
|
-
currentX:
|
|
2863
|
-
currentY:
|
|
2863
|
+
), Oe = E(
|
|
2864
|
+
(b) => {
|
|
2865
|
+
!l || p !== "annotate" || Ie(b.target) || m !== "area" || b.button !== 0 || (b.preventDefault(), b.stopPropagation(), U({
|
|
2866
|
+
startX: b.clientX,
|
|
2867
|
+
startY: b.clientY,
|
|
2868
|
+
currentX: b.clientX,
|
|
2869
|
+
currentY: b.clientY
|
|
2864
2870
|
}), h(null));
|
|
2865
2871
|
},
|
|
2866
2872
|
[l, p, m]
|
|
2867
|
-
), Fe =
|
|
2873
|
+
), Fe = E(() => {
|
|
2868
2874
|
if (!F) return;
|
|
2869
|
-
const
|
|
2870
|
-
if (
|
|
2871
|
-
const
|
|
2872
|
-
|
|
2873
|
-
}, [F,
|
|
2874
|
-
(
|
|
2875
|
-
if (!l || p !== "annotate" ||
|
|
2876
|
-
|
|
2877
|
-
const
|
|
2878
|
-
if (!
|
|
2879
|
-
if (
|
|
2880
|
-
|
|
2875
|
+
const b = Nt(F);
|
|
2876
|
+
if (U(null), b.width < 8 || b.height < 8) return;
|
|
2877
|
+
const M = on(b, Ze);
|
|
2878
|
+
ye(M, b);
|
|
2879
|
+
}, [F, ye]), Be = E(
|
|
2880
|
+
(b) => {
|
|
2881
|
+
if (!l || p !== "annotate" || Ie(b.target) || m === "area") return;
|
|
2882
|
+
b.preventDefault(), b.stopPropagation();
|
|
2883
|
+
const M = vt(b.clientX, b.clientY);
|
|
2884
|
+
if (!M) return;
|
|
2885
|
+
if (b.shiftKey || m === "multi") {
|
|
2886
|
+
I((Q) => Q.includes(M) ? Q.filter((B) => B !== M) : [...Q, M]), R(M);
|
|
2881
2887
|
return;
|
|
2882
2888
|
}
|
|
2883
|
-
const
|
|
2884
|
-
|
|
2889
|
+
const j = x.length > 0 ? x : [M];
|
|
2890
|
+
ye(j.includes(M) ? j : [M]);
|
|
2885
2891
|
},
|
|
2886
|
-
[l, p, m, x,
|
|
2892
|
+
[l, p, m, x, ye]
|
|
2887
2893
|
);
|
|
2888
|
-
|
|
2889
|
-
!
|
|
2890
|
-
}, [
|
|
2894
|
+
H(() => {
|
|
2895
|
+
!_ || G !== "all-instances" || Ct(_) <= 1 && ne("this-instance");
|
|
2896
|
+
}, [_, G]), H(() => {
|
|
2891
2897
|
if (l)
|
|
2892
2898
|
return document.addEventListener("mousemove", De, !0), document.addEventListener("mousedown", Oe, !0), document.addEventListener("mouseup", Fe, !0), document.addEventListener("click", Be, !0), () => {
|
|
2893
2899
|
document.removeEventListener("mousemove", De, !0), document.removeEventListener("mousedown", Oe, !0), document.removeEventListener("mouseup", Fe, !0), document.removeEventListener("click", Be, !0);
|
|
2894
2900
|
};
|
|
2895
2901
|
}, [l, De, Oe, Fe, Be]);
|
|
2896
|
-
const Vt =
|
|
2897
|
-
(
|
|
2898
|
-
if (!
|
|
2899
|
-
const { elements:
|
|
2900
|
-
if (
|
|
2901
|
-
const
|
|
2902
|
-
elements:
|
|
2903
|
-
note:
|
|
2904
|
-
areaBbox:
|
|
2902
|
+
const Vt = E(
|
|
2903
|
+
(b, M) => {
|
|
2904
|
+
if (!L || !b.trim()) return;
|
|
2905
|
+
const { elements: j, areaBbox: Q } = L;
|
|
2906
|
+
if (j.length === 0 && !Q) return;
|
|
2907
|
+
const we = cr({
|
|
2908
|
+
elements: j,
|
|
2909
|
+
note: b,
|
|
2910
|
+
areaBbox: Q
|
|
2905
2911
|
});
|
|
2906
|
-
|
|
2912
|
+
S((B) => [...B, we]), Z(!1), re(!1), M ? (h(null), R(null)) : (h(null), R(null), I([]));
|
|
2907
2913
|
},
|
|
2908
|
-
[
|
|
2909
|
-
), Wt =
|
|
2914
|
+
[L, S]
|
|
2915
|
+
), Wt = E(() => {
|
|
2910
2916
|
h(null), R(null);
|
|
2911
|
-
}, []), Qe =
|
|
2912
|
-
async (
|
|
2913
|
-
const
|
|
2914
|
-
await
|
|
2917
|
+
}, []), Qe = E(
|
|
2918
|
+
async (b) => {
|
|
2919
|
+
const M = sn(y);
|
|
2920
|
+
await Ce(M, "Copied all!", { copyAllFrom: b });
|
|
2915
2921
|
},
|
|
2916
|
-
[
|
|
2917
|
-
), Ut =
|
|
2918
|
-
async (
|
|
2919
|
-
const
|
|
2920
|
-
|
|
2922
|
+
[y, Ce]
|
|
2923
|
+
), Ut = E(
|
|
2924
|
+
async (b) => {
|
|
2925
|
+
const M = y.find((j) => j.id === b);
|
|
2926
|
+
M && await Ce(ln(M), "Copied!", { entryId: b });
|
|
2921
2927
|
},
|
|
2922
|
-
[
|
|
2923
|
-
), Yt =
|
|
2924
|
-
async (
|
|
2925
|
-
const
|
|
2926
|
-
for (const [B,
|
|
2927
|
-
for (const [se,
|
|
2928
|
-
|
|
2929
|
-
if (
|
|
2928
|
+
[y, Ce]
|
|
2929
|
+
), Yt = E(
|
|
2930
|
+
async (b) => {
|
|
2931
|
+
const M = [];
|
|
2932
|
+
for (const [B, q] of b)
|
|
2933
|
+
for (const [se, ee] of q)
|
|
2934
|
+
ee.length > 0 && M.push([B, se, ee]);
|
|
2935
|
+
if (M.length === 0) return { applied: !1 };
|
|
2930
2936
|
if (s) {
|
|
2931
|
-
for (const [B,
|
|
2932
|
-
if (
|
|
2933
|
-
const
|
|
2934
|
-
for (const
|
|
2935
|
-
B.style.removeProperty(
|
|
2937
|
+
for (const [B, q, se] of M) {
|
|
2938
|
+
if (q === "normal") continue;
|
|
2939
|
+
const ee = Sr(B);
|
|
2940
|
+
for (const xe of se)
|
|
2941
|
+
B.style.removeProperty(xe.property), Er(ee, q, xe.property, xe.newValue);
|
|
2936
2942
|
}
|
|
2937
|
-
for (const [B,
|
|
2938
|
-
if (
|
|
2939
|
-
for (const
|
|
2940
|
-
B.style.setProperty(
|
|
2943
|
+
for (const [B, q, se] of M)
|
|
2944
|
+
if (q === "normal")
|
|
2945
|
+
for (const ee of se)
|
|
2946
|
+
B.style.setProperty(ee.property, ee.newValue);
|
|
2941
2947
|
return de("Change applied"), { applied: !0, skipRevert: !0 };
|
|
2942
2948
|
}
|
|
2943
|
-
const
|
|
2944
|
-
for (const [B,
|
|
2945
|
-
const
|
|
2949
|
+
const j = r ?? c ?? void 0, Q = [];
|
|
2950
|
+
for (const [B, q, se] of M) {
|
|
2951
|
+
const ee = Ge(B), xe = {
|
|
2946
2952
|
schemaVersion: 1,
|
|
2947
2953
|
elementSelector: Mt(B, G),
|
|
2948
|
-
sourceFile:
|
|
2949
|
-
lineNumber:
|
|
2954
|
+
sourceFile: ee.sourceFile,
|
|
2955
|
+
lineNumber: ee.lineNumber,
|
|
2950
2956
|
targetScope: G,
|
|
2951
|
-
state:
|
|
2957
|
+
state: q,
|
|
2952
2958
|
stylingSystem: kt(B),
|
|
2953
2959
|
changes: se
|
|
2954
2960
|
};
|
|
2955
|
-
|
|
2961
|
+
Q.push(await Jn(xe, { applyEndpoint: j, onApply: a }));
|
|
2956
2962
|
}
|
|
2957
|
-
const
|
|
2963
|
+
const we = Q.every(
|
|
2958
2964
|
(B) => B.mode === "mcp" && B.result.success && B.result.linesChanged.length > 0
|
|
2959
2965
|
);
|
|
2960
|
-
return de(
|
|
2961
|
-
B.mode === "error" ? console.error(`[pixelagent] Apply #${
|
|
2962
|
-
}), { applied:
|
|
2966
|
+
return de(we ? "Change applied" : "Apply failed"), Q.forEach((B, q) => {
|
|
2967
|
+
B.mode === "error" ? console.error(`[pixelagent] Apply #${q} failed:`, B.message) : B.mode === "clipboard" ? console.warn(`[pixelagent] Apply #${q} fell back to clipboard`) : B.mode === "mcp" && !B.result.success && console.warn(`[pixelagent] Apply #${q} reported no changes:`, B.result);
|
|
2968
|
+
}), { applied: we };
|
|
2963
2969
|
},
|
|
2964
2970
|
[G, r, c, a, s, de]
|
|
2965
|
-
), et = (
|
|
2966
|
-
o.setSettingsOpen(!1), f(!0), v(
|
|
2971
|
+
), et = (b) => {
|
|
2972
|
+
o.setSettingsOpen(!1), f(!0), v(b), R(null), $(null), h(null), I([]), U(null), b === "annotate" && Z(!1);
|
|
2967
2973
|
}, Xt = () => {
|
|
2968
|
-
f(!1), v("idle"), R(null),
|
|
2974
|
+
f(!1), v("idle"), R(null), $(null), h(null), I([]), U(null), Z(!1), re(!1);
|
|
2969
2975
|
}, Gt = F ? Nt(F) : null;
|
|
2970
2976
|
return /* @__PURE__ */ d(
|
|
2971
2977
|
"div",
|
|
2972
2978
|
{
|
|
2973
|
-
ref:
|
|
2979
|
+
ref: ve,
|
|
2974
2980
|
className: "pa-root",
|
|
2975
2981
|
"data-pixelagent-root": !0,
|
|
2976
2982
|
...o.rootAttributes,
|
|
@@ -2988,17 +2994,17 @@ function $r({
|
|
|
2988
2994
|
active: l,
|
|
2989
2995
|
mode: p,
|
|
2990
2996
|
captureMode: m,
|
|
2991
|
-
annotationCount:
|
|
2997
|
+
annotationCount: y.length,
|
|
2992
2998
|
multiSelectCount: x.length,
|
|
2993
|
-
copyStatus:
|
|
2994
|
-
copyAllFrom:
|
|
2999
|
+
copyStatus: P,
|
|
3000
|
+
copyAllFrom: T,
|
|
2995
3001
|
onActivateAnnotate: () => et("annotate"),
|
|
2996
3002
|
onActivateEdit: () => et("edit"),
|
|
2997
3003
|
onDeactivate: Xt,
|
|
2998
3004
|
onCopyAll: () => Qe("toolbar"),
|
|
2999
3005
|
onCaptureModeChange: g,
|
|
3000
3006
|
onConfirmMultiSelect: () => {
|
|
3001
|
-
x.length > 0 &&
|
|
3007
|
+
x.length > 0 && ye(x);
|
|
3002
3008
|
}
|
|
3003
3009
|
}
|
|
3004
3010
|
),
|
|
@@ -3006,19 +3012,19 @@ function $r({
|
|
|
3006
3012
|
/* @__PURE__ */ n(
|
|
3007
3013
|
$t,
|
|
3008
3014
|
{
|
|
3009
|
-
element:
|
|
3010
|
-
selected:
|
|
3015
|
+
element: N,
|
|
3016
|
+
selected: _,
|
|
3011
3017
|
multiSelected: x
|
|
3012
3018
|
}
|
|
3013
3019
|
),
|
|
3014
|
-
/* @__PURE__ */ n(hr, { annotations:
|
|
3020
|
+
/* @__PURE__ */ n(hr, { annotations: y }),
|
|
3015
3021
|
/* @__PURE__ */ n(lr, { area: Gt, isDragging: !!F })
|
|
3016
3022
|
] }),
|
|
3017
|
-
l && p === "annotate" &&
|
|
3023
|
+
l && p === "annotate" && L && /* @__PURE__ */ n(
|
|
3018
3024
|
sr,
|
|
3019
3025
|
{
|
|
3020
|
-
elements:
|
|
3021
|
-
areaBbox:
|
|
3026
|
+
elements: L.elements,
|
|
3027
|
+
areaBbox: L.areaBbox,
|
|
3022
3028
|
onSubmit: Vt,
|
|
3023
3029
|
onCancel: Wt
|
|
3024
3030
|
}
|
|
@@ -3026,35 +3032,35 @@ function $r({
|
|
|
3026
3032
|
l && p === "edit" && /* @__PURE__ */ n(
|
|
3027
3033
|
qn,
|
|
3028
3034
|
{
|
|
3029
|
-
selectedElement:
|
|
3030
|
-
hoveredElement:
|
|
3035
|
+
selectedElement: _,
|
|
3036
|
+
hoveredElement: N,
|
|
3031
3037
|
onSelectElement: R,
|
|
3032
|
-
onHoverElement:
|
|
3038
|
+
onHoverElement: $,
|
|
3033
3039
|
targetScope: G,
|
|
3034
|
-
onTargetScopeChange:
|
|
3035
|
-
elementState:
|
|
3036
|
-
onElementStateChange:
|
|
3040
|
+
onTargetScopeChange: ne,
|
|
3041
|
+
elementState: oe,
|
|
3042
|
+
onElementStateChange: C,
|
|
3037
3043
|
onApply: Yt,
|
|
3038
|
-
applyStatus: p === "edit" ?
|
|
3039
|
-
isToolbarTarget:
|
|
3044
|
+
applyStatus: p === "edit" ? P : null,
|
|
3045
|
+
isToolbarTarget: Ie
|
|
3040
3046
|
}
|
|
3041
3047
|
),
|
|
3042
|
-
|
|
3048
|
+
W && /* @__PURE__ */ n(
|
|
3043
3049
|
fr,
|
|
3044
3050
|
{
|
|
3045
|
-
annotations:
|
|
3046
|
-
collapsed:
|
|
3047
|
-
onToggleCollapsed: () => re((
|
|
3051
|
+
annotations: y,
|
|
3052
|
+
collapsed: te,
|
|
3053
|
+
onToggleCollapsed: () => re((b) => !b),
|
|
3048
3054
|
onClose: () => {
|
|
3049
|
-
|
|
3055
|
+
Z(!0), re(!1);
|
|
3050
3056
|
},
|
|
3051
3057
|
onCopyAll: () => Qe("session"),
|
|
3052
3058
|
onCopyOne: Ut,
|
|
3053
|
-
onRemove:
|
|
3054
|
-
onUpdate:
|
|
3055
|
-
copyStatus:
|
|
3056
|
-
copiedEntryId:
|
|
3057
|
-
copyAllFrom:
|
|
3059
|
+
onRemove: k,
|
|
3060
|
+
onUpdate: w,
|
|
3061
|
+
copyStatus: P,
|
|
3062
|
+
copiedEntryId: D,
|
|
3063
|
+
copyAllFrom: T
|
|
3058
3064
|
}
|
|
3059
3065
|
)
|
|
3060
3066
|
]
|