pixelagent 0.1.17 → 0.1.19
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 +834 -825
- package/dist/pixelagent.js.map +1 -1
- package/package.json +3 -3
package/dist/pixelagent.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as d, Fragment as
|
|
2
|
-
import { useState 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 [
|
|
12
|
+
const [o, s] = A([]), a = r ?? t;
|
|
13
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);
|
|
@@ -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,
|
|
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;
|
|
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
|
+
let y = 0;
|
|
84
|
+
const S = new Float32Array(s * a * 2);
|
|
93
85
|
let w = 0;
|
|
94
|
-
for (let
|
|
95
|
-
|
|
96
|
-
|
|
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
|
+
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 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:
|
|
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,45 +115,45 @@ 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
|
-
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), 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
|
};
|
|
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(
|
|
@@ -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,13 +229,13 @@ 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
|
)
|
|
236
236
|
] });
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function V({
|
|
239
239
|
variant: e = "regular",
|
|
240
240
|
className: t = "",
|
|
241
241
|
children: i,
|
|
@@ -251,29 +251,29 @@ 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 = "",
|
|
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] =
|
|
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;
|
|
@@ -291,10 +291,10 @@ function Rt({
|
|
|
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
|
};
|
|
@@ -305,27 +305,27 @@ function Rt({
|
|
|
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
|
+
a.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
322
|
), f = $((m) => {
|
|
323
|
-
if (!
|
|
324
|
-
const g = c.current,
|
|
325
|
-
r({ x:
|
|
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
326
|
}, []), p = $((m) => {
|
|
327
|
-
if (!(!
|
|
328
|
-
|
|
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,135 +417,135 @@ 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,
|
|
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
486
|
_(() => {
|
|
487
|
-
|
|
487
|
+
a(at(t));
|
|
488
488
|
}, [t]);
|
|
489
|
-
const
|
|
489
|
+
const w = $(
|
|
490
490
|
(x) => {
|
|
491
|
-
|
|
491
|
+
a(x), i(xn(x));
|
|
492
492
|
},
|
|
493
493
|
[i]
|
|
494
|
-
),
|
|
494
|
+
), k = $(
|
|
495
495
|
(x) => {
|
|
496
|
-
|
|
496
|
+
w(Dt(x));
|
|
497
497
|
},
|
|
498
|
-
[
|
|
499
|
-
),
|
|
498
|
+
[w]
|
|
499
|
+
), N = $(() => {
|
|
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
|
_(() => {
|
|
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) || o(!1);
|
|
516
|
+
}, I = (L) => {
|
|
517
|
+
L.key === "Escape" && o(!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 } =
|
|
528
|
-
|
|
529
|
-
},
|
|
530
|
-
x.preventDefault(),
|
|
531
|
-
const
|
|
532
|
-
window.removeEventListener("mousemove",
|
|
522
|
+
}, [r, N]);
|
|
523
|
+
const E = (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 } = Nn(x, I, L);
|
|
528
|
+
w({ ...s, s: h, v: 100 - F });
|
|
529
|
+
}, z = (x) => {
|
|
530
|
+
x.preventDefault(), E(x.clientX, x.clientY);
|
|
531
|
+
const I = (h) => E(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",
|
|
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
|
{
|
|
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: z,
|
|
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(wn(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 = Cn(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(), o((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
|
{
|
|
@@ -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
|
-
],
|
|
709
|
-
function
|
|
708
|
+
], Te = "";
|
|
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 =
|
|
721
|
-
(s) => s.value === t ||
|
|
720
|
+
const i = Le(t).toLowerCase(), r = me.find(
|
|
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
|
-
...
|
|
733
|
-
{ value: t, label:
|
|
732
|
+
...me,
|
|
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 Se({ 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,
|
|
951
|
+
function ge({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: o }) {
|
|
952
|
+
const [s, a] = A(t);
|
|
953
953
|
return _(() => {
|
|
954
|
-
|
|
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,27 +1193,27 @@ 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,
|
|
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 = Xn(e["text-align"] ?? "left"), S = ((I = e.display) == null ? void 0 : I.trim()) ?? "", w = !!S, k = Gn.has(S), N = [...mt];
|
|
1213
|
+
S && !mt.includes(S) && N.push(S);
|
|
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,31 +1324,31 @@ 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
|
-
value:
|
|
1330
|
+
value: y,
|
|
1331
1331
|
onChange: (h) => t("text-align", h),
|
|
1332
1332
|
options: [
|
|
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",
|
|
@@ -1426,30 +1426,30 @@ 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
|
-
|
|
1442
|
-
|
|
1441
|
+
k && /* @__PURE__ */ n(
|
|
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,150 +1535,159 @@ const Kn = 50, gt = [
|
|
|
1535
1535
|
"border-radius",
|
|
1536
1536
|
"opacity"
|
|
1537
1537
|
];
|
|
1538
|
-
function
|
|
1539
|
-
var
|
|
1540
|
-
const r =
|
|
1541
|
-
|
|
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
|
+
null
|
|
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);
|
|
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 = $(() => {
|
|
1549
|
+
c.current.push(x()), c.current.length > jn && c.current.shift(), R(c.current.length > 0);
|
|
1550
|
+
}, [x]), L = $(
|
|
1551
|
+
(C) => {
|
|
1552
|
+
var H;
|
|
1551
1553
|
if (!e) return;
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1554
|
-
const D =
|
|
1555
|
-
r.current = D,
|
|
1556
|
-
const
|
|
1557
|
-
if (
|
|
1558
|
-
for (const
|
|
1559
|
-
if (
|
|
1560
|
-
for (const
|
|
1561
|
-
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);
|
|
1562
1564
|
else
|
|
1563
|
-
for (const
|
|
1564
|
-
|
|
1565
|
+
for (const Y of D)
|
|
1566
|
+
Y.style.setProperty(O.property, O.newValue);
|
|
1565
1567
|
},
|
|
1566
|
-
[e, t, i,
|
|
1568
|
+
[e, t, i, N]
|
|
1567
1569
|
);
|
|
1568
1570
|
_(() => {
|
|
1569
1571
|
if (!e) {
|
|
1570
|
-
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);
|
|
1571
1573
|
return;
|
|
1572
1574
|
}
|
|
1573
|
-
const
|
|
1574
|
-
r.current =
|
|
1575
|
-
const
|
|
1576
|
-
|
|
1577
|
-
const D =
|
|
1578
|
-
return
|
|
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
|
+
f(P), v(P);
|
|
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);
|
|
1579
1581
|
}, [e]), _(() => {
|
|
1580
|
-
e &&
|
|
1582
|
+
e && L(!0);
|
|
1581
1583
|
}, [t]), _(() => {
|
|
1582
|
-
var
|
|
1584
|
+
var ae;
|
|
1583
1585
|
if (!e) return;
|
|
1584
|
-
const
|
|
1585
|
-
r.current =
|
|
1586
|
-
s.current.filter((
|
|
1586
|
+
const C = Re(e, t);
|
|
1587
|
+
r.current = C, ke(
|
|
1588
|
+
s.current.filter((G) => C.includes(G.element))
|
|
1587
1589
|
);
|
|
1588
|
-
const
|
|
1589
|
-
for (const
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
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);
|
|
1604
|
+
}
|
|
1605
|
+
u.current = { element: e, state: i }, Se(Array.from(o.current)), ze(C, i), o.current = new Set(C);
|
|
1597
1606
|
}, [i, e, t]);
|
|
1598
|
-
const
|
|
1599
|
-
(
|
|
1600
|
-
e &&
|
|
1601
|
-
const
|
|
1602
|
-
return D ===
|
|
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;
|
|
1603
1612
|
});
|
|
1604
1613
|
},
|
|
1605
1614
|
[e, i]
|
|
1606
|
-
),
|
|
1607
|
-
(
|
|
1615
|
+
), F = $(
|
|
1616
|
+
(C, P) => {
|
|
1608
1617
|
if (!e) return;
|
|
1609
|
-
const D = { [
|
|
1610
|
-
|
|
1611
|
-
for (const [
|
|
1612
|
-
const
|
|
1613
|
-
for (const
|
|
1614
|
-
|
|
1615
|
-
|
|
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);
|
|
1616
1625
|
}
|
|
1617
1626
|
},
|
|
1618
|
-
[e,
|
|
1619
|
-
),
|
|
1620
|
-
(
|
|
1621
|
-
if (!(!e ||
|
|
1622
|
-
|
|
1623
|
-
for (const
|
|
1624
|
-
rt(
|
|
1625
|
-
|
|
1627
|
+
[e, p, l, I, h]
|
|
1628
|
+
), U = $(
|
|
1629
|
+
(C) => {
|
|
1630
|
+
if (!(!e || m === "none")) {
|
|
1631
|
+
I(), S(C);
|
|
1632
|
+
for (const P of r.current)
|
|
1633
|
+
rt(P, m, C), o.current.add(P);
|
|
1634
|
+
h(m, w, C);
|
|
1626
1635
|
}
|
|
1627
1636
|
},
|
|
1628
|
-
[e,
|
|
1629
|
-
),
|
|
1630
|
-
const
|
|
1631
|
-
if (
|
|
1632
|
-
|
|
1633
|
-
const
|
|
1634
|
-
|
|
1637
|
+
[e, m, w, I, h]
|
|
1638
|
+
), ye = $(() => {
|
|
1639
|
+
const C = c.current.pop();
|
|
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);
|
|
1643
|
+
P.kind !== "none" && S(P.value);
|
|
1635
1644
|
}
|
|
1636
|
-
}, [e]),
|
|
1637
|
-
if (
|
|
1638
|
-
|
|
1639
|
-
const
|
|
1640
|
-
|
|
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);
|
|
1649
|
+
S(C.value);
|
|
1641
1650
|
}
|
|
1642
|
-
}, [e]),
|
|
1643
|
-
|
|
1651
|
+
}, [e]), re = $(() => {
|
|
1652
|
+
ke(s.current), a.current && Ae(a.current);
|
|
1644
1653
|
}, []), oe = $(() => {
|
|
1645
|
-
if (
|
|
1646
|
-
|
|
1647
|
-
const
|
|
1648
|
-
|
|
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);
|
|
1657
|
+
C.kind !== "none" && S(C.value);
|
|
1649
1658
|
}
|
|
1650
|
-
}, [
|
|
1651
|
-
let
|
|
1652
|
-
for (const
|
|
1653
|
-
for (const
|
|
1654
|
-
const
|
|
1655
|
-
|
|
1659
|
+
}, [re, e]), W = e ? ((ce = N.get(e)) == null ? void 0 : ce.get(i)) ?? [] : [];
|
|
1660
|
+
let j = 0;
|
|
1661
|
+
for (const C of N.values())
|
|
1662
|
+
for (const P of C.values()) j += P.length;
|
|
1663
|
+
const ie = $(() => {
|
|
1664
|
+
E(/* @__PURE__ */ new Map());
|
|
1656
1665
|
}, []);
|
|
1657
1666
|
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:
|
|
1667
|
+
values: l,
|
|
1668
|
+
textKind: m,
|
|
1669
|
+
textValue: y,
|
|
1670
|
+
pendingChanges: W,
|
|
1671
|
+
pendingByElement: N,
|
|
1672
|
+
totalPendingCount: j,
|
|
1673
|
+
clearAllPending: ie,
|
|
1674
|
+
canUndo: z,
|
|
1675
|
+
updateProperty: F,
|
|
1676
|
+
updateText: U,
|
|
1677
|
+
undo: ye,
|
|
1678
|
+
reset: ee,
|
|
1670
1679
|
clearPreviews: oe,
|
|
1671
|
-
revertPreviews:
|
|
1680
|
+
revertPreviews: re
|
|
1672
1681
|
};
|
|
1673
1682
|
}
|
|
1674
|
-
function
|
|
1683
|
+
function Jn({
|
|
1675
1684
|
selectedElement: e,
|
|
1676
1685
|
hoveredElement: t,
|
|
1677
1686
|
onSelectElement: i,
|
|
1678
1687
|
onHoverElement: r,
|
|
1679
|
-
targetScope:
|
|
1688
|
+
targetScope: o,
|
|
1680
1689
|
onTargetScopeChange: s,
|
|
1681
|
-
elementState:
|
|
1690
|
+
elementState: a,
|
|
1682
1691
|
onElementStateChange: c,
|
|
1683
1692
|
onApply: u,
|
|
1684
1693
|
applyStatus: l,
|
|
@@ -1689,63 +1698,63 @@ function qn({
|
|
|
1689
1698
|
values: v,
|
|
1690
1699
|
textKind: m,
|
|
1691
1700
|
textValue: g,
|
|
1692
|
-
pendingChanges:
|
|
1693
|
-
pendingByElement:
|
|
1694
|
-
totalPendingCount:
|
|
1695
|
-
clearAllPending:
|
|
1696
|
-
canUndo:
|
|
1697
|
-
updateProperty:
|
|
1698
|
-
updateText:
|
|
1701
|
+
pendingChanges: y,
|
|
1702
|
+
pendingByElement: S,
|
|
1703
|
+
totalPendingCount: w,
|
|
1704
|
+
clearAllPending: k,
|
|
1705
|
+
canUndo: N,
|
|
1706
|
+
updateProperty: E,
|
|
1707
|
+
updateText: z,
|
|
1699
1708
|
undo: R,
|
|
1700
1709
|
reset: x,
|
|
1701
|
-
clearPreviews:
|
|
1702
|
-
revertPreviews:
|
|
1703
|
-
} =
|
|
1704
|
-
computeDefaultPosition: (
|
|
1705
|
-
x: window.innerWidth -
|
|
1710
|
+
clearPreviews: I,
|
|
1711
|
+
revertPreviews: L
|
|
1712
|
+
} = qn(e, o, a), { elementRef: h, isDragging: F, style: U, dragHandleProps: ye } = Tt({
|
|
1713
|
+
computeDefaultPosition: (T) => ({
|
|
1714
|
+
x: window.innerWidth - T.width - 16,
|
|
1706
1715
|
y: 16
|
|
1707
1716
|
})
|
|
1708
1717
|
});
|
|
1709
|
-
_(() => (p == null || p({ clearPreviews:
|
|
1710
|
-
const
|
|
1711
|
-
(
|
|
1712
|
-
if (f(
|
|
1713
|
-
const
|
|
1714
|
-
(
|
|
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(
|
|
1715
1724
|
"[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
|
|
1716
1725
|
)
|
|
1717
1726
|
);
|
|
1718
|
-
r(
|
|
1727
|
+
r(O ?? null);
|
|
1719
1728
|
},
|
|
1720
1729
|
[f, r]
|
|
1721
|
-
),
|
|
1722
|
-
(
|
|
1723
|
-
if (f(
|
|
1724
|
-
|
|
1725
|
-
const
|
|
1726
|
-
(
|
|
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(
|
|
1727
1736
|
"[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
|
|
1728
1737
|
)
|
|
1729
1738
|
);
|
|
1730
|
-
i(
|
|
1739
|
+
i(O ?? null);
|
|
1731
1740
|
},
|
|
1732
1741
|
[f, i]
|
|
1733
1742
|
);
|
|
1734
|
-
_(() => (document.addEventListener("mousemove",
|
|
1735
|
-
document.removeEventListener("mousemove",
|
|
1736
|
-
}), [
|
|
1737
|
-
const
|
|
1738
|
-
if (
|
|
1739
|
-
const
|
|
1740
|
-
|
|
1741
|
-
},
|
|
1742
|
-
return /* @__PURE__ */ d(
|
|
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 () => {
|
|
1747
|
+
if (w === 0) return;
|
|
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: [
|
|
1743
1752
|
/* @__PURE__ */ n(
|
|
1744
|
-
|
|
1753
|
+
Et,
|
|
1745
1754
|
{
|
|
1746
|
-
element:
|
|
1755
|
+
element: o === "all-instances" ? null : t,
|
|
1747
1756
|
selected: e,
|
|
1748
|
-
multiSelected:
|
|
1757
|
+
multiSelected: D,
|
|
1749
1758
|
primarySelected: e
|
|
1750
1759
|
}
|
|
1751
1760
|
),
|
|
@@ -1754,8 +1763,8 @@ function qn({
|
|
|
1754
1763
|
{
|
|
1755
1764
|
ref: h,
|
|
1756
1765
|
className: `pa-edit-panel-float ${F ? "pa-edit-panel-float--dragging" : ""}`,
|
|
1757
|
-
style:
|
|
1758
|
-
children: /* @__PURE__ */ n(
|
|
1766
|
+
style: U,
|
|
1767
|
+
children: /* @__PURE__ */ n(Pe, { variant: "sheet", side: "right", className: "pa-edit-panel-glass", children: /* @__PURE__ */ d("div", { className: "pa-edit-panel-inner", children: [
|
|
1759
1768
|
/* @__PURE__ */ d("div", { className: "pa-edit-panel-header", children: [
|
|
1760
1769
|
/* @__PURE__ */ n(
|
|
1761
1770
|
"button",
|
|
@@ -1764,7 +1773,7 @@ function qn({
|
|
|
1764
1773
|
className: "pa-edit-panel-drag",
|
|
1765
1774
|
"aria-label": "Drag edit panel",
|
|
1766
1775
|
title: "Drag to move",
|
|
1767
|
-
...
|
|
1776
|
+
...ye,
|
|
1768
1777
|
children: /* @__PURE__ */ d("span", { className: "pa-edit-panel-grip", "aria-hidden": "true", children: [
|
|
1769
1778
|
/* @__PURE__ */ n("span", {}),
|
|
1770
1779
|
/* @__PURE__ */ n("span", {}),
|
|
@@ -1777,57 +1786,57 @@ function qn({
|
|
|
1777
1786
|
),
|
|
1778
1787
|
/* @__PURE__ */ n("h3", { className: "pa-edit-title", children: "Edit" })
|
|
1779
1788
|
] }),
|
|
1780
|
-
e ? /* @__PURE__ */ d(
|
|
1789
|
+
e ? /* @__PURE__ */ d(q, { children: [
|
|
1781
1790
|
/* @__PURE__ */ d("div", { className: "pa-edit-meta", children: [
|
|
1782
1791
|
/* @__PURE__ */ n(
|
|
1783
1792
|
"code",
|
|
1784
1793
|
{
|
|
1785
1794
|
className: "pa-edit-meta-label",
|
|
1786
1795
|
title: `This instance: ${At(e)}
|
|
1787
|
-
All instances: ${
|
|
1796
|
+
All instances: ${ce}`,
|
|
1788
1797
|
children: Xe(e)
|
|
1789
1798
|
}
|
|
1790
1799
|
),
|
|
1791
|
-
((
|
|
1792
|
-
(
|
|
1793
|
-
|
|
1794
|
-
|
|
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: [
|
|
1802
|
+
W.sourceFile,
|
|
1803
|
+
W.lineNumber ? `:${W.lineNumber}` : ""
|
|
1795
1804
|
] }),
|
|
1796
|
-
|
|
1797
|
-
|
|
1805
|
+
W != null && W.sourceFile && j ? " · " : "",
|
|
1806
|
+
j ?? ""
|
|
1798
1807
|
] })
|
|
1799
1808
|
] }),
|
|
1800
1809
|
/* @__PURE__ */ n("div", { className: "pa-edit-panel-scroll", children: /* @__PURE__ */ n(
|
|
1801
|
-
|
|
1810
|
+
Kn,
|
|
1802
1811
|
{
|
|
1803
1812
|
values: v,
|
|
1804
|
-
onPropertyChange:
|
|
1813
|
+
onPropertyChange: E,
|
|
1805
1814
|
textKind: m,
|
|
1806
1815
|
textValue: g,
|
|
1807
|
-
onTextChange:
|
|
1808
|
-
targetScope:
|
|
1816
|
+
onTextChange: z,
|
|
1817
|
+
targetScope: o,
|
|
1809
1818
|
onTargetScopeChange: s,
|
|
1810
|
-
elementState:
|
|
1819
|
+
elementState: a,
|
|
1811
1820
|
onElementStateChange: c,
|
|
1812
|
-
instanceCount:
|
|
1813
|
-
scopeHint:
|
|
1814
|
-
stateHint:
|
|
1821
|
+
instanceCount: ie,
|
|
1822
|
+
scopeHint: P,
|
|
1823
|
+
stateHint: C
|
|
1815
1824
|
}
|
|
1816
1825
|
) }),
|
|
1817
1826
|
/* @__PURE__ */ d("div", { className: "pa-edit-panel-sticky", children: [
|
|
1818
1827
|
/* @__PURE__ */ d("div", { className: "pa-edit-actions", children: [
|
|
1819
|
-
/* @__PURE__ */ n(
|
|
1820
|
-
/* @__PURE__ */ n(
|
|
1828
|
+
/* @__PURE__ */ n(V, { variant: "regular", onClick: R, disabled: !N, children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
|
|
1829
|
+
/* @__PURE__ */ n(gn, { className: "pa-glass-btn-icon" }),
|
|
1821
1830
|
/* @__PURE__ */ n("span", { children: "Undo" })
|
|
1822
1831
|
] }) }),
|
|
1823
1832
|
/* @__PURE__ */ n(
|
|
1824
|
-
|
|
1833
|
+
V,
|
|
1825
1834
|
{
|
|
1826
1835
|
variant: "regular",
|
|
1827
1836
|
onClick: x,
|
|
1828
|
-
disabled:
|
|
1837
|
+
disabled: y.length === 0,
|
|
1829
1838
|
children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
|
|
1830
|
-
/* @__PURE__ */ n(
|
|
1839
|
+
/* @__PURE__ */ n(vn, { className: "pa-glass-btn-icon" }),
|
|
1831
1840
|
/* @__PURE__ */ n("span", { children: "Reset" })
|
|
1832
1841
|
] })
|
|
1833
1842
|
}
|
|
@@ -1838,16 +1847,16 @@ All instances: ${M}`,
|
|
|
1838
1847
|
"span",
|
|
1839
1848
|
{
|
|
1840
1849
|
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 ?? `${
|
|
1850
|
+
children: l ?? `${w} pending change${w !== 1 ? "s" : ""}`
|
|
1842
1851
|
}
|
|
1843
1852
|
),
|
|
1844
1853
|
/* @__PURE__ */ n(
|
|
1845
|
-
|
|
1854
|
+
V,
|
|
1846
1855
|
{
|
|
1847
1856
|
variant: "glass-primary",
|
|
1848
|
-
onClick:
|
|
1849
|
-
disabled:
|
|
1850
|
-
title:
|
|
1857
|
+
onClick: oe,
|
|
1858
|
+
disabled: w === 0,
|
|
1859
|
+
title: W != null && W.sourceFile ? void 0 : "No source file — Apply copies selector + changes to clipboard",
|
|
1851
1860
|
children: "Apply"
|
|
1852
1861
|
}
|
|
1853
1862
|
)
|
|
@@ -1859,7 +1868,7 @@ All instances: ${M}`,
|
|
|
1859
1868
|
)
|
|
1860
1869
|
] });
|
|
1861
1870
|
}
|
|
1862
|
-
async function
|
|
1871
|
+
async function Zn(e, t = {}) {
|
|
1863
1872
|
if (t.onApply)
|
|
1864
1873
|
try {
|
|
1865
1874
|
const r = await t.onApply(e);
|
|
@@ -1874,15 +1883,15 @@ async function Jn(e, t = {}) {
|
|
|
1874
1883
|
method: "POST",
|
|
1875
1884
|
headers: { "Content-Type": "application/json" },
|
|
1876
1885
|
body: JSON.stringify({ payload: e })
|
|
1877
|
-
}),
|
|
1878
|
-
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 };
|
|
1879
1888
|
} catch (r) {
|
|
1880
1889
|
return { mode: "error", message: r instanceof Error ? r.message : String(r) };
|
|
1881
1890
|
}
|
|
1882
1891
|
return await St(JSON.stringify(e, null, 2)), { mode: "clipboard" };
|
|
1883
1892
|
}
|
|
1884
|
-
function
|
|
1885
|
-
const [t, i] =
|
|
1893
|
+
function Qn(e) {
|
|
1894
|
+
const [t, i] = A(null);
|
|
1886
1895
|
return _(() => {
|
|
1887
1896
|
if (!e) {
|
|
1888
1897
|
i(null);
|
|
@@ -1890,13 +1899,13 @@ function Zn(e) {
|
|
|
1890
1899
|
}
|
|
1891
1900
|
const r = () => i(e.getBoundingClientRect());
|
|
1892
1901
|
r();
|
|
1893
|
-
const
|
|
1894
|
-
return
|
|
1895
|
-
|
|
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);
|
|
1896
1905
|
};
|
|
1897
1906
|
}, [e]), t;
|
|
1898
1907
|
}
|
|
1899
|
-
const
|
|
1908
|
+
const le = 8, Q = 8, er = 12, tr = 300, nr = 280;
|
|
1900
1909
|
function He(e, t, i, r) {
|
|
1901
1910
|
return {
|
|
1902
1911
|
top: e,
|
|
@@ -1910,7 +1919,7 @@ function He(e, t, i, r) {
|
|
|
1910
1919
|
function Ye(e, t) {
|
|
1911
1920
|
return e.left < t.right && e.right > t.left && e.top < t.bottom && e.bottom > t.top;
|
|
1912
1921
|
}
|
|
1913
|
-
function
|
|
1922
|
+
function rr(e, t) {
|
|
1914
1923
|
return {
|
|
1915
1924
|
top: e.top - t,
|
|
1916
1925
|
left: e.left - t,
|
|
@@ -1920,33 +1929,33 @@ function nr(e, t) {
|
|
|
1920
1929
|
height: e.height + t * 2
|
|
1921
1930
|
};
|
|
1922
1931
|
}
|
|
1923
|
-
function
|
|
1932
|
+
function ir() {
|
|
1924
1933
|
if (typeof document > "u") return null;
|
|
1925
1934
|
const e = document.querySelector(
|
|
1926
1935
|
"[data-pixelagent-toolbar-portal] .pa-toolbar-float"
|
|
1927
1936
|
);
|
|
1928
|
-
return e ?
|
|
1937
|
+
return e ? rr(e.getBoundingClientRect(), er) : null;
|
|
1929
1938
|
}
|
|
1930
1939
|
function Ve(e, t) {
|
|
1931
1940
|
return Math.min(
|
|
1932
|
-
Math.max(
|
|
1933
|
-
window.innerWidth - t -
|
|
1941
|
+
Math.max(le, e),
|
|
1942
|
+
window.innerWidth - t - le
|
|
1934
1943
|
);
|
|
1935
1944
|
}
|
|
1936
|
-
function
|
|
1945
|
+
function Ee(e, t) {
|
|
1937
1946
|
return Math.min(
|
|
1938
|
-
Math.max(
|
|
1939
|
-
window.innerHeight - t -
|
|
1947
|
+
Math.max(le, e),
|
|
1948
|
+
window.innerHeight - t - le
|
|
1940
1949
|
);
|
|
1941
1950
|
}
|
|
1942
|
-
function
|
|
1943
|
-
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;
|
|
1944
1953
|
}
|
|
1945
1954
|
function ar(e, t) {
|
|
1946
|
-
return t && Ye(e, t) ? !1 :
|
|
1955
|
+
return t && Ye(e, t) ? !1 : or(e);
|
|
1947
1956
|
}
|
|
1948
|
-
function
|
|
1949
|
-
const r =
|
|
1957
|
+
function sr(e, t = tr, i = nr) {
|
|
1958
|
+
const r = ir(), s = e.top > window.innerHeight * 0.45 ? [
|
|
1950
1959
|
{ placement: "above", top: e.top - i - Q, left: e.left },
|
|
1951
1960
|
{ placement: "below", top: e.bottom + Q, left: e.left },
|
|
1952
1961
|
{ placement: "right", top: e.top, left: e.right + Q },
|
|
@@ -1959,7 +1968,7 @@ function or(e, t = er, i = tr) {
|
|
|
1959
1968
|
];
|
|
1960
1969
|
for (const { top: u, left: l } of s) {
|
|
1961
1970
|
const f = He(
|
|
1962
|
-
|
|
1971
|
+
Ee(u, i),
|
|
1963
1972
|
Ve(l, t),
|
|
1964
1973
|
t,
|
|
1965
1974
|
i
|
|
@@ -1967,40 +1976,40 @@ function or(e, t = er, i = tr) {
|
|
|
1967
1976
|
if (ar(f, r))
|
|
1968
1977
|
return { top: f.top, left: f.left };
|
|
1969
1978
|
}
|
|
1970
|
-
let
|
|
1979
|
+
let a = Ee(e.top - i - Q, i), c = Ve(e.left, t);
|
|
1971
1980
|
if (r) {
|
|
1972
|
-
let u = He(
|
|
1973
|
-
Ye(u, r) && (
|
|
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(
|
|
1974
1983
|
Math.min(e.left, r.left - t - Q),
|
|
1975
1984
|
t
|
|
1976
1985
|
));
|
|
1977
1986
|
}
|
|
1978
|
-
return { top:
|
|
1987
|
+
return { top: a, left: c };
|
|
1979
1988
|
}
|
|
1980
|
-
function
|
|
1989
|
+
function lr({
|
|
1981
1990
|
elements: e,
|
|
1982
1991
|
areaBbox: t,
|
|
1983
1992
|
onSubmit: i,
|
|
1984
1993
|
onCancel: r
|
|
1985
1994
|
}) {
|
|
1986
|
-
const [
|
|
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;
|
|
1987
1996
|
if (_(() => {
|
|
1988
|
-
var
|
|
1989
|
-
(
|
|
1997
|
+
var k;
|
|
1998
|
+
(k = a.current) == null || k.focus();
|
|
1990
1999
|
}, [e]), _(() => {
|
|
1991
|
-
const
|
|
1992
|
-
|
|
2000
|
+
const k = (N) => {
|
|
2001
|
+
N.key === "Escape" && r();
|
|
1993
2002
|
};
|
|
1994
|
-
return document.addEventListener("keydown",
|
|
2003
|
+
return document.addEventListener("keydown", k), () => document.removeEventListener("keydown", k);
|
|
1995
2004
|
}, [r]), !p) return null;
|
|
1996
|
-
const
|
|
1997
|
-
|
|
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);
|
|
1998
2007
|
};
|
|
1999
2008
|
return /* @__PURE__ */ n(
|
|
2000
|
-
|
|
2009
|
+
Pe,
|
|
2001
2010
|
{
|
|
2002
2011
|
variant: "popover",
|
|
2003
|
-
style: { top:
|
|
2012
|
+
style: { top: y.top, left: y.left },
|
|
2004
2013
|
children: /* @__PURE__ */ d(
|
|
2005
2014
|
"div",
|
|
2006
2015
|
{
|
|
@@ -2010,7 +2019,7 @@ function sr({
|
|
|
2010
2019
|
"aria-label": "Add annotation",
|
|
2011
2020
|
className: "pa-popover-body",
|
|
2012
2021
|
children: [
|
|
2013
|
-
/* @__PURE__ */ n("div", { className: "pa-popover-header", children: /* @__PURE__ */ n("span", { className: "pa-popover-selector", children:
|
|
2022
|
+
/* @__PURE__ */ n("div", { className: "pa-popover-header", children: /* @__PURE__ */ n("span", { className: "pa-popover-selector", children: S }) }),
|
|
2014
2023
|
(v || g) && /* @__PURE__ */ d("div", { className: "pa-popover-context", children: [
|
|
2015
2024
|
v && /* @__PURE__ */ d("p", { className: "pa-popover-context-line", children: [
|
|
2016
2025
|
/* @__PURE__ */ n("span", { className: "pa-popover-context-label", children: "Selected" }),
|
|
@@ -2026,36 +2035,36 @@ function sr({
|
|
|
2026
2035
|
/* @__PURE__ */ n(
|
|
2027
2036
|
"textarea",
|
|
2028
2037
|
{
|
|
2029
|
-
ref:
|
|
2038
|
+
ref: a,
|
|
2030
2039
|
className: "pa-textarea",
|
|
2031
|
-
value:
|
|
2032
|
-
onChange: (
|
|
2040
|
+
value: o,
|
|
2041
|
+
onChange: (k) => s(k.target.value),
|
|
2033
2042
|
placeholder: "Describe the change...",
|
|
2034
2043
|
rows: 3,
|
|
2035
|
-
onKeyDown: (
|
|
2036
|
-
|
|
2044
|
+
onKeyDown: (k) => {
|
|
2045
|
+
k.key === "Enter" && (k.metaKey || k.ctrlKey) && (k.preventDefault(), w(k.shiftKey)), k.key === "Escape" && r();
|
|
2037
2046
|
}
|
|
2038
2047
|
}
|
|
2039
2048
|
)
|
|
2040
2049
|
] }),
|
|
2041
2050
|
/* @__PURE__ */ n("p", { className: "pa-popover-hint", children: "⌘↵ Add · ⇧⌘↵ Add & next · Esc Cancel" }),
|
|
2042
2051
|
/* @__PURE__ */ d("div", { className: "pa-popover-actions", children: [
|
|
2043
|
-
/* @__PURE__ */ n(
|
|
2052
|
+
/* @__PURE__ */ n(V, { variant: "ghost", onClick: r, children: "Cancel" }),
|
|
2044
2053
|
/* @__PURE__ */ n(
|
|
2045
|
-
|
|
2054
|
+
V,
|
|
2046
2055
|
{
|
|
2047
2056
|
variant: "ghost",
|
|
2048
|
-
onClick: () =>
|
|
2049
|
-
disabled: !
|
|
2057
|
+
onClick: () => w(!0),
|
|
2058
|
+
disabled: !o.trim(),
|
|
2050
2059
|
children: "Add & next"
|
|
2051
2060
|
}
|
|
2052
2061
|
),
|
|
2053
2062
|
/* @__PURE__ */ n(
|
|
2054
|
-
|
|
2063
|
+
V,
|
|
2055
2064
|
{
|
|
2056
2065
|
variant: "glass-primary",
|
|
2057
|
-
onClick: () =>
|
|
2058
|
-
disabled: !
|
|
2066
|
+
onClick: () => w(!1),
|
|
2067
|
+
disabled: !o.trim(),
|
|
2059
2068
|
children: "Add"
|
|
2060
2069
|
}
|
|
2061
2070
|
)
|
|
@@ -2066,7 +2075,7 @@ function sr({
|
|
|
2066
2075
|
}
|
|
2067
2076
|
);
|
|
2068
2077
|
}
|
|
2069
|
-
function
|
|
2078
|
+
function cr({ area: e, isDragging: t }) {
|
|
2070
2079
|
return !e || e.width < 2 || e.height < 2 ? null : /* @__PURE__ */ n(
|
|
2071
2080
|
"div",
|
|
2072
2081
|
{
|
|
@@ -2081,9 +2090,9 @@ function lr({ area: e, isDragging: t }) {
|
|
|
2081
2090
|
}
|
|
2082
2091
|
);
|
|
2083
2092
|
}
|
|
2084
|
-
function
|
|
2085
|
-
const { elements: t, note: i, areaBbox: r } = e,
|
|
2086
|
-
if (!
|
|
2093
|
+
function dr(e) {
|
|
2094
|
+
const { elements: t, note: i, areaBbox: r } = e, o = t[0];
|
|
2095
|
+
if (!o && r)
|
|
2087
2096
|
return {
|
|
2088
2097
|
id: crypto.randomUUID(),
|
|
2089
2098
|
selector: "area-selection",
|
|
@@ -2098,9 +2107,9 @@ function cr(e) {
|
|
|
2098
2107
|
},
|
|
2099
2108
|
createdAt: Date.now()
|
|
2100
2109
|
};
|
|
2101
|
-
if (!
|
|
2110
|
+
if (!o)
|
|
2102
2111
|
throw new Error("buildAnnotationEntry requires at least one element or areaBbox");
|
|
2103
|
-
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));
|
|
2104
2113
|
return {
|
|
2105
2114
|
id: crypto.randomUUID(),
|
|
2106
2115
|
selector: f[0],
|
|
@@ -2114,25 +2123,25 @@ function cr(e) {
|
|
|
2114
2123
|
height: Math.round(s.height)
|
|
2115
2124
|
},
|
|
2116
2125
|
areaBbox: r,
|
|
2117
|
-
domPath:
|
|
2126
|
+
domPath: Zt(o),
|
|
2118
2127
|
selectedText: c,
|
|
2119
2128
|
elementText: l,
|
|
2120
|
-
sourceFile:
|
|
2121
|
-
lineNumber:
|
|
2122
|
-
componentName:
|
|
2129
|
+
sourceFile: a.sourceFile,
|
|
2130
|
+
lineNumber: a.lineNumber,
|
|
2131
|
+
componentName: Jt(o) ?? a.componentName,
|
|
2123
2132
|
createdAt: Date.now()
|
|
2124
2133
|
};
|
|
2125
2134
|
}
|
|
2126
|
-
function
|
|
2127
|
-
const t =
|
|
2135
|
+
function ur(e) {
|
|
2136
|
+
const t = $t(e);
|
|
2128
2137
|
if (t) return t.getBoundingClientRect();
|
|
2129
2138
|
if (e.bbox) {
|
|
2130
|
-
const { x: i, y: r, width:
|
|
2131
|
-
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);
|
|
2132
2141
|
}
|
|
2133
2142
|
if (e.areaBbox) {
|
|
2134
|
-
const { x: i, y: r, width:
|
|
2135
|
-
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);
|
|
2136
2145
|
}
|
|
2137
2146
|
if (e.position) {
|
|
2138
2147
|
const { x: i, y: r } = e.position;
|
|
@@ -2140,46 +2149,46 @@ function dr(e) {
|
|
|
2140
2149
|
}
|
|
2141
2150
|
return null;
|
|
2142
2151
|
}
|
|
2143
|
-
function
|
|
2152
|
+
function pr(e) {
|
|
2144
2153
|
return `${Math.round(e.top)}:${Math.round(e.left)}:${Math.round(e.width)}:${Math.round(e.height)}`;
|
|
2145
2154
|
}
|
|
2146
|
-
const
|
|
2147
|
-
function
|
|
2148
|
-
const [t, i] =
|
|
2155
|
+
const hr = 20;
|
|
2156
|
+
function fr({ annotations: e }) {
|
|
2157
|
+
const [t, i] = A([]);
|
|
2149
2158
|
return _(() => {
|
|
2150
2159
|
if (e.length === 0) {
|
|
2151
2160
|
i([]);
|
|
2152
2161
|
return;
|
|
2153
2162
|
}
|
|
2154
|
-
const r = /* @__PURE__ */ new Map(),
|
|
2163
|
+
const r = /* @__PURE__ */ new Map(), o = () => {
|
|
2155
2164
|
const c = [];
|
|
2156
2165
|
e.forEach((u, l) => {
|
|
2157
|
-
const f =
|
|
2166
|
+
const f = ur(u);
|
|
2158
2167
|
if (!f) return;
|
|
2159
|
-
const p =
|
|
2168
|
+
const p = pr(f), v = r.get(p) ?? 0;
|
|
2160
2169
|
r.set(p, v + 1), c.push({
|
|
2161
2170
|
id: u.id,
|
|
2162
2171
|
index: l + 1,
|
|
2163
|
-
top: f.top - 6 - v *
|
|
2172
|
+
top: f.top - 6 - v * hr,
|
|
2164
2173
|
left: f.right - 6
|
|
2165
2174
|
});
|
|
2166
2175
|
}), i(c);
|
|
2167
2176
|
};
|
|
2168
|
-
|
|
2177
|
+
o();
|
|
2169
2178
|
const s = /* @__PURE__ */ new Set();
|
|
2170
2179
|
for (const c of e) {
|
|
2171
|
-
const u =
|
|
2180
|
+
const u = $t(c);
|
|
2172
2181
|
u && s.add(u);
|
|
2173
2182
|
}
|
|
2174
|
-
const
|
|
2175
|
-
const u = new ResizeObserver(
|
|
2183
|
+
const a = Array.from(s).map((c) => {
|
|
2184
|
+
const u = new ResizeObserver(o);
|
|
2176
2185
|
return u.observe(c), u;
|
|
2177
2186
|
});
|
|
2178
|
-
return window.addEventListener("scroll",
|
|
2179
|
-
for (const c of
|
|
2180
|
-
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);
|
|
2181
2190
|
};
|
|
2182
|
-
}, [e]), t.length === 0 ? null : /* @__PURE__ */ n(
|
|
2191
|
+
}, [e]), t.length === 0 ? null : /* @__PURE__ */ n(q, { children: t.map((r) => /* @__PURE__ */ n(
|
|
2183
2192
|
"span",
|
|
2184
2193
|
{
|
|
2185
2194
|
className: "pa-annotation-badge",
|
|
@@ -2191,7 +2200,7 @@ function hr({ annotations: e }) {
|
|
|
2191
2200
|
)) });
|
|
2192
2201
|
}
|
|
2193
2202
|
const Ze = "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]";
|
|
2194
|
-
function
|
|
2203
|
+
function Ie(e) {
|
|
2195
2204
|
return e instanceof Element ? !!e.closest(Ze) : !1;
|
|
2196
2205
|
}
|
|
2197
2206
|
function vt(e, t) {
|
|
@@ -2215,35 +2224,35 @@ function Ht({
|
|
|
2215
2224
|
"aria-live": "polite",
|
|
2216
2225
|
children: e
|
|
2217
2226
|
}
|
|
2218
|
-
) : /* @__PURE__ */ n(
|
|
2227
|
+
) : /* @__PURE__ */ n(q, { children: i });
|
|
2219
2228
|
}
|
|
2220
|
-
function
|
|
2229
|
+
function mr({
|
|
2221
2230
|
annotations: e,
|
|
2222
2231
|
collapsed: t,
|
|
2223
2232
|
onToggleCollapsed: i,
|
|
2224
2233
|
onClose: r,
|
|
2225
|
-
onCopyAll:
|
|
2234
|
+
onCopyAll: o,
|
|
2226
2235
|
onCopyOne: s,
|
|
2227
|
-
onRemove:
|
|
2236
|
+
onRemove: a,
|
|
2228
2237
|
onUpdate: c,
|
|
2229
2238
|
copyStatus: u,
|
|
2230
2239
|
copiedEntryId: l,
|
|
2231
2240
|
copyAllFrom: f
|
|
2232
2241
|
}) {
|
|
2233
|
-
const [p, v] =
|
|
2242
|
+
const [p, v] = A(null), [m, g] = A("");
|
|
2234
2243
|
_(() => {
|
|
2235
|
-
const
|
|
2236
|
-
|
|
2244
|
+
const w = (k) => {
|
|
2245
|
+
k.key === "Escape" && (t ? r() : i());
|
|
2237
2246
|
};
|
|
2238
|
-
return document.addEventListener("keydown",
|
|
2247
|
+
return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
|
|
2239
2248
|
}, [t, r, i]);
|
|
2240
|
-
const
|
|
2241
|
-
v(
|
|
2242
|
-
},
|
|
2243
|
-
m.trim() && (c(
|
|
2249
|
+
const y = (w) => {
|
|
2250
|
+
v(w.id), g(w.note);
|
|
2251
|
+
}, S = (w) => {
|
|
2252
|
+
m.trim() && (c(w, { note: m.trim() }), v(null));
|
|
2244
2253
|
};
|
|
2245
2254
|
return /* @__PURE__ */ d(
|
|
2246
|
-
|
|
2255
|
+
Pe,
|
|
2247
2256
|
{
|
|
2248
2257
|
variant: "sheet",
|
|
2249
2258
|
side: "right",
|
|
@@ -2252,7 +2261,7 @@ function fr({
|
|
|
2252
2261
|
/* @__PURE__ */ d("div", { className: "pa-session-header", children: [
|
|
2253
2262
|
/* @__PURE__ */ d("div", { className: "pa-session-header-main", children: [
|
|
2254
2263
|
/* @__PURE__ */ n(
|
|
2255
|
-
|
|
2264
|
+
V,
|
|
2256
2265
|
{
|
|
2257
2266
|
variant: "ghost",
|
|
2258
2267
|
className: "pa-glass-btn--sm pa-session-collapse-btn",
|
|
@@ -2276,25 +2285,25 @@ function fr({
|
|
|
2276
2285
|
feedback: f === "session" ? u : null,
|
|
2277
2286
|
slotClassName: "pa-copy-feedback-slot--session",
|
|
2278
2287
|
children: /* @__PURE__ */ n(
|
|
2279
|
-
|
|
2288
|
+
V,
|
|
2280
2289
|
{
|
|
2281
2290
|
variant: "glass-primary",
|
|
2282
2291
|
className: "pa-glass-btn--sm",
|
|
2283
|
-
onClick:
|
|
2292
|
+
onClick: o,
|
|
2284
2293
|
disabled: e.length === 0,
|
|
2285
2294
|
children: "Copy all"
|
|
2286
2295
|
}
|
|
2287
2296
|
)
|
|
2288
2297
|
}
|
|
2289
2298
|
),
|
|
2290
|
-
/* @__PURE__ */ n(
|
|
2299
|
+
/* @__PURE__ */ n(V, { variant: "ghost", onClick: r, "aria-label": "Close session panel", children: "✕" })
|
|
2291
2300
|
] })
|
|
2292
2301
|
] }),
|
|
2293
2302
|
!t && /* @__PURE__ */ d("ul", { className: "pa-session-list", children: [
|
|
2294
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." }),
|
|
2295
|
-
e.map((
|
|
2296
|
-
const
|
|
2297
|
-
return /* @__PURE__ */ n("li", { className: "pa-session-item", children: p ===
|
|
2304
|
+
e.map((w) => {
|
|
2305
|
+
const k = Qt(w);
|
|
2306
|
+
return /* @__PURE__ */ n("li", { className: "pa-session-item", children: p === w.id ? /* @__PURE__ */ d("div", { className: "pa-session-edit", children: [
|
|
2298
2307
|
/* @__PURE__ */ d("label", { className: "pa-label", children: [
|
|
2299
2308
|
"Note",
|
|
2300
2309
|
/* @__PURE__ */ n(
|
|
@@ -2302,31 +2311,31 @@ function fr({
|
|
|
2302
2311
|
{
|
|
2303
2312
|
className: "pa-textarea",
|
|
2304
2313
|
value: m,
|
|
2305
|
-
onChange: (
|
|
2314
|
+
onChange: (N) => g(N.target.value),
|
|
2306
2315
|
rows: 3
|
|
2307
2316
|
}
|
|
2308
2317
|
)
|
|
2309
2318
|
] }),
|
|
2310
2319
|
/* @__PURE__ */ d("div", { className: "pa-session-item-actions", children: [
|
|
2311
|
-
/* @__PURE__ */ n(
|
|
2320
|
+
/* @__PURE__ */ n(V, { variant: "ghost", onClick: () => v(null), children: "Cancel" }),
|
|
2312
2321
|
/* @__PURE__ */ n(
|
|
2313
|
-
|
|
2322
|
+
V,
|
|
2314
2323
|
{
|
|
2315
2324
|
variant: "glass-primary",
|
|
2316
|
-
onClick: () =>
|
|
2325
|
+
onClick: () => S(w.id),
|
|
2317
2326
|
disabled: !m.trim(),
|
|
2318
2327
|
children: "Save"
|
|
2319
2328
|
}
|
|
2320
2329
|
)
|
|
2321
2330
|
] })
|
|
2322
|
-
] }) : /* @__PURE__ */ d(
|
|
2331
|
+
] }) : /* @__PURE__ */ d(q, { children: [
|
|
2323
2332
|
/* @__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
|
-
|
|
2333
|
+
/* @__PURE__ */ n("span", { className: "pa-session-target", children: k.target }),
|
|
2334
|
+
/* @__PURE__ */ n("p", { className: "pa-session-note", children: k.note }),
|
|
2335
|
+
k.meta && /* @__PURE__ */ n("p", { className: "pa-session-meta-line", children: k.meta })
|
|
2327
2336
|
] }),
|
|
2328
2337
|
/* @__PURE__ */ d("div", { className: "pa-session-item-actions", children: [
|
|
2329
|
-
u === "Copied!" && l ===
|
|
2338
|
+
u === "Copied!" && l === w.id ? /* @__PURE__ */ n(
|
|
2330
2339
|
"span",
|
|
2331
2340
|
{
|
|
2332
2341
|
className: "pa-status pa-copy-feedback-slot pa-copy-feedback-slot--item",
|
|
@@ -2335,44 +2344,44 @@ function fr({
|
|
|
2335
2344
|
children: "Copied!"
|
|
2336
2345
|
}
|
|
2337
2346
|
) : /* @__PURE__ */ n(
|
|
2338
|
-
|
|
2347
|
+
V,
|
|
2339
2348
|
{
|
|
2340
2349
|
variant: "glass-primary",
|
|
2341
2350
|
className: "pa-glass-btn--sm",
|
|
2342
|
-
onClick: () => s(
|
|
2351
|
+
onClick: () => s(w.id),
|
|
2343
2352
|
"aria-label": "Copy annotation",
|
|
2344
2353
|
children: "Copy"
|
|
2345
2354
|
}
|
|
2346
2355
|
),
|
|
2347
2356
|
/* @__PURE__ */ n(
|
|
2348
|
-
|
|
2357
|
+
V,
|
|
2349
2358
|
{
|
|
2350
2359
|
variant: "ghost",
|
|
2351
2360
|
className: "pa-glass-btn--sm",
|
|
2352
|
-
onClick: () =>
|
|
2361
|
+
onClick: () => y(w),
|
|
2353
2362
|
"aria-label": "Edit annotation note",
|
|
2354
2363
|
children: "✎"
|
|
2355
2364
|
}
|
|
2356
2365
|
),
|
|
2357
2366
|
/* @__PURE__ */ n(
|
|
2358
|
-
|
|
2367
|
+
V,
|
|
2359
2368
|
{
|
|
2360
2369
|
variant: "ghost",
|
|
2361
2370
|
className: "pa-glass-btn--sm",
|
|
2362
|
-
onClick: () =>
|
|
2371
|
+
onClick: () => a(w.id),
|
|
2363
2372
|
"aria-label": "Remove annotation",
|
|
2364
2373
|
children: "✕"
|
|
2365
2374
|
}
|
|
2366
2375
|
)
|
|
2367
2376
|
] })
|
|
2368
|
-
] }) },
|
|
2377
|
+
] }) }, w.id);
|
|
2369
2378
|
})
|
|
2370
2379
|
] })
|
|
2371
2380
|
]
|
|
2372
2381
|
}
|
|
2373
2382
|
);
|
|
2374
2383
|
}
|
|
2375
|
-
function
|
|
2384
|
+
function gr() {
|
|
2376
2385
|
return /* @__PURE__ */ d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
2377
2386
|
/* @__PURE__ */ n(
|
|
2378
2387
|
"path",
|
|
@@ -2393,7 +2402,7 @@ function mr() {
|
|
|
2393
2402
|
)
|
|
2394
2403
|
] });
|
|
2395
2404
|
}
|
|
2396
|
-
function
|
|
2405
|
+
function vr() {
|
|
2397
2406
|
return /* @__PURE__ */ d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
2398
2407
|
/* @__PURE__ */ n("circle", { cx: "8", cy: "8", r: "2.75", stroke: "currentColor", strokeWidth: "1.25" }),
|
|
2399
2408
|
/* @__PURE__ */ n(
|
|
@@ -2407,7 +2416,7 @@ function gr() {
|
|
|
2407
2416
|
)
|
|
2408
2417
|
] });
|
|
2409
2418
|
}
|
|
2410
|
-
function
|
|
2419
|
+
function br() {
|
|
2411
2420
|
return /* @__PURE__ */ n("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
2412
2421
|
"path",
|
|
2413
2422
|
{
|
|
@@ -2418,27 +2427,27 @@ function vr() {
|
|
|
2418
2427
|
}
|
|
2419
2428
|
) });
|
|
2420
2429
|
}
|
|
2421
|
-
function
|
|
2430
|
+
function yr({
|
|
2422
2431
|
open: e,
|
|
2423
2432
|
onClose: t,
|
|
2424
2433
|
hostTheme: i,
|
|
2425
2434
|
chrome: r,
|
|
2426
|
-
onToggleHostTheme:
|
|
2435
|
+
onToggleHostTheme: o
|
|
2427
2436
|
}) {
|
|
2428
|
-
const s =
|
|
2437
|
+
const s = X(null);
|
|
2429
2438
|
return _(() => {
|
|
2430
2439
|
if (!e) return;
|
|
2431
|
-
const
|
|
2440
|
+
const a = (u) => {
|
|
2432
2441
|
u.key === "Escape" && t();
|
|
2433
2442
|
}, c = (u) => {
|
|
2434
2443
|
var f, p;
|
|
2435
2444
|
const l = u.target;
|
|
2436
2445
|
(f = s.current) != null && f.contains(l) || (p = l.closest) != null && p.call(l, "[data-pa-settings-trigger]") || t();
|
|
2437
2446
|
};
|
|
2438
|
-
return window.addEventListener("keydown",
|
|
2439
|
-
window.removeEventListener("keydown",
|
|
2447
|
+
return window.addEventListener("keydown", a), window.addEventListener("mousedown", c), () => {
|
|
2448
|
+
window.removeEventListener("keydown", a), window.removeEventListener("mousedown", c);
|
|
2440
2449
|
};
|
|
2441
|
-
}, [e, t]), e ? /* @__PURE__ */ n("div", { ref: s, className: "pa-settings-menu", role: "dialog", "aria-label": "PixelAgent settings", children: /* @__PURE__ */ n(
|
|
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: [
|
|
2442
2451
|
/* @__PURE__ */ d("header", { className: "pa-settings-menu-header", children: [
|
|
2443
2452
|
/* @__PURE__ */ n("h4", { className: "pa-settings-menu-title", children: "Settings" }),
|
|
2444
2453
|
/* @__PURE__ */ n("p", { className: "pa-settings-menu-subtitle", children: "Appearance and chrome" })
|
|
@@ -2448,13 +2457,13 @@ function br({
|
|
|
2448
2457
|
/* @__PURE__ */ d("div", { className: "pa-settings-row", children: [
|
|
2449
2458
|
/* @__PURE__ */ n("span", { className: "pa-settings-row-value", children: i === "dark" ? "Dark canvas" : "Light canvas" }),
|
|
2450
2459
|
/* @__PURE__ */ n(
|
|
2451
|
-
|
|
2460
|
+
V,
|
|
2452
2461
|
{
|
|
2453
2462
|
variant: "icon",
|
|
2454
|
-
onClick:
|
|
2463
|
+
onClick: o,
|
|
2455
2464
|
"aria-label": i === "dark" ? "Switch host to light theme" : "Switch host to dark theme",
|
|
2456
2465
|
title: i === "dark" ? "Light theme" : "Dark theme",
|
|
2457
|
-
children: i === "dark" ? /* @__PURE__ */ n(
|
|
2466
|
+
children: i === "dark" ? /* @__PURE__ */ n(vr, {}) : /* @__PURE__ */ n(br, {})
|
|
2458
2467
|
}
|
|
2459
2468
|
)
|
|
2460
2469
|
] })
|
|
@@ -2470,14 +2479,14 @@ function br({
|
|
|
2470
2479
|
] }) }) }) : null;
|
|
2471
2480
|
}
|
|
2472
2481
|
const bt = "0 0 24 24";
|
|
2473
|
-
function
|
|
2474
|
-
return /* @__PURE__ */ d(
|
|
2482
|
+
function wr() {
|
|
2483
|
+
return /* @__PURE__ */ d(q, { children: [
|
|
2475
2484
|
/* @__PURE__ */ n("rect", { x: "3", y: "14", width: "4", height: "4", fill: "currentColor" }),
|
|
2476
2485
|
/* @__PURE__ */ n("path", { fill: "currentColor", d: "M7 5h12v12L7 5z" })
|
|
2477
2486
|
] });
|
|
2478
2487
|
}
|
|
2479
|
-
const
|
|
2480
|
-
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" }) {
|
|
2481
2490
|
return t === "pointer" ? /* @__PURE__ */ n(
|
|
2482
2491
|
"svg",
|
|
2483
2492
|
{
|
|
@@ -2491,7 +2500,7 @@ function xr({ size: e = 22, variant: t = "cursor" }) {
|
|
|
2491
2500
|
"path",
|
|
2492
2501
|
{
|
|
2493
2502
|
fill: "currentColor",
|
|
2494
|
-
d:
|
|
2503
|
+
d: xr
|
|
2495
2504
|
}
|
|
2496
2505
|
)
|
|
2497
2506
|
}
|
|
@@ -2504,23 +2513,23 @@ function xr({ size: e = 22, variant: t = "cursor" }) {
|
|
|
2504
2513
|
viewBox: bt,
|
|
2505
2514
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2506
2515
|
"aria-hidden": "true",
|
|
2507
|
-
children: /* @__PURE__ */ n(
|
|
2516
|
+
children: /* @__PURE__ */ n(wr, {})
|
|
2508
2517
|
}
|
|
2509
2518
|
);
|
|
2510
2519
|
}
|
|
2511
|
-
const
|
|
2520
|
+
const kr = ["element", "area", "multi"], Cr = {
|
|
2512
2521
|
element: "Click",
|
|
2513
2522
|
area: "Area",
|
|
2514
2523
|
multi: "Multi"
|
|
2515
2524
|
};
|
|
2516
|
-
function
|
|
2525
|
+
function Mr({
|
|
2517
2526
|
rootAttributes: e,
|
|
2518
2527
|
hostTheme: t,
|
|
2519
2528
|
chrome: i,
|
|
2520
2529
|
settingsOpen: r,
|
|
2521
|
-
onToggleSettings:
|
|
2530
|
+
onToggleSettings: o,
|
|
2522
2531
|
onCloseSettings: s,
|
|
2523
|
-
onToggleHostTheme:
|
|
2532
|
+
onToggleHostTheme: a,
|
|
2524
2533
|
active: c,
|
|
2525
2534
|
mode: u,
|
|
2526
2535
|
captureMode: l,
|
|
@@ -2529,32 +2538,32 @@ function Cr({
|
|
|
2529
2538
|
copyStatus: v,
|
|
2530
2539
|
copyAllFrom: m,
|
|
2531
2540
|
onActivateAnnotate: g,
|
|
2532
|
-
onActivateEdit:
|
|
2533
|
-
onDeactivate:
|
|
2534
|
-
onCopyAll:
|
|
2535
|
-
onCaptureModeChange:
|
|
2536
|
-
onConfirmMultiSelect:
|
|
2541
|
+
onActivateEdit: y,
|
|
2542
|
+
onDeactivate: S,
|
|
2543
|
+
onCopyAll: w,
|
|
2544
|
+
onCaptureModeChange: k,
|
|
2545
|
+
onConfirmMultiSelect: N
|
|
2537
2546
|
}) {
|
|
2538
|
-
const { elementRef:
|
|
2547
|
+
const { elementRef: E, isDragging: z, style: R, dragHandleProps: x } = Tt(), I = /* @__PURE__ */ d(
|
|
2539
2548
|
"div",
|
|
2540
2549
|
{
|
|
2541
|
-
ref:
|
|
2542
|
-
className: `pa-toolbar-float ${
|
|
2550
|
+
ref: E,
|
|
2551
|
+
className: `pa-toolbar-float ${z ? "pa-toolbar-float--dragging" : ""}`,
|
|
2543
2552
|
style: R,
|
|
2544
2553
|
role: "toolbar",
|
|
2545
2554
|
"aria-label": "PixelAgent",
|
|
2546
2555
|
children: [
|
|
2547
2556
|
!c && /* @__PURE__ */ n(
|
|
2548
|
-
|
|
2557
|
+
yr,
|
|
2549
2558
|
{
|
|
2550
2559
|
open: r,
|
|
2551
2560
|
onClose: s,
|
|
2552
2561
|
hostTheme: t,
|
|
2553
2562
|
chrome: i,
|
|
2554
|
-
onToggleHostTheme:
|
|
2563
|
+
onToggleHostTheme: a
|
|
2555
2564
|
}
|
|
2556
2565
|
),
|
|
2557
|
-
/* @__PURE__ */ n(
|
|
2566
|
+
/* @__PURE__ */ n(Rt, { shape: "capsule", className: "pa-toolbar-glass", intensity: "enhanced", children: /* @__PURE__ */ d("div", { className: "pa-toolbar-inner", children: [
|
|
2558
2567
|
/* @__PURE__ */ n(
|
|
2559
2568
|
"button",
|
|
2560
2569
|
{
|
|
@@ -2563,29 +2572,29 @@ function Cr({
|
|
|
2563
2572
|
"aria-label": "Drag PixelAgent toolbar",
|
|
2564
2573
|
title: "Drag to move",
|
|
2565
2574
|
...x,
|
|
2566
|
-
children: /* @__PURE__ */ n(
|
|
2575
|
+
children: /* @__PURE__ */ n(Nr, { size: 22 })
|
|
2567
2576
|
}
|
|
2568
2577
|
),
|
|
2569
2578
|
/* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
|
|
2570
|
-
c ? /* @__PURE__ */ d(
|
|
2579
|
+
c ? /* @__PURE__ */ d(q, { children: [
|
|
2571
2580
|
/* @__PURE__ */ d("div", { className: "pa-toolbar-segment", children: [
|
|
2572
2581
|
/* @__PURE__ */ n("span", { className: "pa-mode-badge", children: u }),
|
|
2573
|
-
u === "annotate" && /* @__PURE__ */ d(
|
|
2582
|
+
u === "annotate" && /* @__PURE__ */ d(q, { children: [
|
|
2574
2583
|
/* @__PURE__ */ n(
|
|
2575
2584
|
"select",
|
|
2576
2585
|
{
|
|
2577
2586
|
className: "pa-select pa-toolbar-capture-select",
|
|
2578
2587
|
value: l,
|
|
2579
|
-
onChange: (
|
|
2588
|
+
onChange: (L) => k(L.target.value),
|
|
2580
2589
|
"aria-label": "Capture mode",
|
|
2581
|
-
children:
|
|
2590
|
+
children: kr.map((L) => /* @__PURE__ */ n("option", { value: L, children: Cr[L] }, L))
|
|
2582
2591
|
}
|
|
2583
2592
|
),
|
|
2584
2593
|
p > 0 && /* @__PURE__ */ n(
|
|
2585
|
-
|
|
2594
|
+
V,
|
|
2586
2595
|
{
|
|
2587
2596
|
variant: "glass-primary",
|
|
2588
|
-
onClick:
|
|
2597
|
+
onClick: N,
|
|
2589
2598
|
"aria-label": "Annotate selected elements",
|
|
2590
2599
|
children: p
|
|
2591
2600
|
}
|
|
@@ -2596,10 +2605,10 @@ function Cr({
|
|
|
2596
2605
|
feedback: m === "toolbar" ? v : null,
|
|
2597
2606
|
slotClassName: "pa-copy-feedback-slot--toolbar",
|
|
2598
2607
|
children: /* @__PURE__ */ n(
|
|
2599
|
-
|
|
2608
|
+
V,
|
|
2600
2609
|
{
|
|
2601
2610
|
variant: "glass-primary",
|
|
2602
|
-
onClick:
|
|
2611
|
+
onClick: w,
|
|
2603
2612
|
disabled: f === 0,
|
|
2604
2613
|
"aria-label": f > 0 ? `Copy all annotations (${f})` : "Copy all annotations",
|
|
2605
2614
|
children: f > 0 ? `Copy (${f})` : "Copy"
|
|
@@ -2610,11 +2619,11 @@ function Cr({
|
|
|
2610
2619
|
] })
|
|
2611
2620
|
] }),
|
|
2612
2621
|
/* @__PURE__ */ n(
|
|
2613
|
-
|
|
2622
|
+
V,
|
|
2614
2623
|
{
|
|
2615
2624
|
variant: "icon",
|
|
2616
2625
|
className: "pa-toolbar-close",
|
|
2617
|
-
onClick:
|
|
2626
|
+
onClick: S,
|
|
2618
2627
|
"aria-label": "Close",
|
|
2619
2628
|
children: /* @__PURE__ */ n(
|
|
2620
2629
|
"svg",
|
|
@@ -2638,22 +2647,22 @@ function Cr({
|
|
|
2638
2647
|
}
|
|
2639
2648
|
)
|
|
2640
2649
|
] }) : /* @__PURE__ */ d("div", { className: "pa-toolbar-segment", children: [
|
|
2641
|
-
/* @__PURE__ */ n(
|
|
2642
|
-
/* @__PURE__ */ n(
|
|
2650
|
+
/* @__PURE__ */ n(V, { onClick: g, children: "Annotate" }),
|
|
2651
|
+
/* @__PURE__ */ n(V, { onClick: y, children: "Edit" })
|
|
2643
2652
|
] }),
|
|
2644
|
-
!c && /* @__PURE__ */ d(
|
|
2653
|
+
!c && /* @__PURE__ */ d(q, { children: [
|
|
2645
2654
|
/* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
|
|
2646
2655
|
/* @__PURE__ */ n(
|
|
2647
|
-
|
|
2656
|
+
V,
|
|
2648
2657
|
{
|
|
2649
2658
|
variant: "icon",
|
|
2650
2659
|
className: "pa-toolbar-settings",
|
|
2651
2660
|
"data-pa-settings-trigger": !0,
|
|
2652
|
-
onClick:
|
|
2661
|
+
onClick: o,
|
|
2653
2662
|
"aria-label": "PixelAgent settings",
|
|
2654
2663
|
"aria-expanded": r,
|
|
2655
2664
|
title: "Settings",
|
|
2656
|
-
children: /* @__PURE__ */ n(
|
|
2665
|
+
children: /* @__PURE__ */ n(gr, {})
|
|
2657
2666
|
}
|
|
2658
2667
|
)
|
|
2659
2668
|
] }),
|
|
@@ -2662,59 +2671,59 @@ function Cr({
|
|
|
2662
2671
|
]
|
|
2663
2672
|
}
|
|
2664
2673
|
);
|
|
2665
|
-
return typeof document > "u" ?
|
|
2674
|
+
return typeof document > "u" ? I : Ke(
|
|
2666
2675
|
/* @__PURE__ */ n(
|
|
2667
2676
|
"div",
|
|
2668
2677
|
{
|
|
2669
2678
|
className: "pa-root pa-root--toolbar-portal",
|
|
2670
2679
|
"data-pixelagent-toolbar-portal": !0,
|
|
2671
2680
|
...e,
|
|
2672
|
-
children:
|
|
2681
|
+
children: I
|
|
2673
2682
|
}
|
|
2674
2683
|
),
|
|
2675
2684
|
document.body
|
|
2676
2685
|
);
|
|
2677
2686
|
}
|
|
2678
|
-
function
|
|
2679
|
-
const e =
|
|
2687
|
+
function Ar() {
|
|
2688
|
+
const e = X(en()), [t, i] = A(
|
|
2680
2689
|
() => {
|
|
2681
2690
|
var s;
|
|
2682
2691
|
return ((s = e.current) == null ? void 0 : s.annotations) ?? [];
|
|
2683
2692
|
}
|
|
2684
2693
|
);
|
|
2685
2694
|
_(() => {
|
|
2686
|
-
|
|
2695
|
+
tn({ annotations: t });
|
|
2687
2696
|
}, [t]);
|
|
2688
|
-
const r = $((s,
|
|
2697
|
+
const r = $((s, a) => {
|
|
2689
2698
|
i(
|
|
2690
|
-
(c) => c.map((u) => u.id === s ? { ...u, ...
|
|
2699
|
+
(c) => c.map((u) => u.id === s ? { ...u, ...a } : u)
|
|
2691
2700
|
);
|
|
2692
|
-
}, []),
|
|
2693
|
-
i((
|
|
2701
|
+
}, []), o = $((s) => {
|
|
2702
|
+
i((a) => a.filter((c) => c.id !== s));
|
|
2694
2703
|
}, []);
|
|
2695
2704
|
return {
|
|
2696
2705
|
annotations: t,
|
|
2697
2706
|
setAnnotations: i,
|
|
2698
2707
|
updateAnnotation: r,
|
|
2699
|
-
removeAnnotation:
|
|
2708
|
+
removeAnnotation: o
|
|
2700
2709
|
};
|
|
2701
2710
|
}
|
|
2702
|
-
function
|
|
2711
|
+
function Sr({
|
|
2703
2712
|
ui: e,
|
|
2704
2713
|
hostTheme: t,
|
|
2705
2714
|
onHostThemeChange: i
|
|
2706
2715
|
}) {
|
|
2707
|
-
const r =
|
|
2708
|
-
() => ({ ...
|
|
2716
|
+
const r = Me(
|
|
2717
|
+
() => ({ ...nn, ...e }),
|
|
2709
2718
|
[e]
|
|
2710
|
-
), [
|
|
2719
|
+
), [o, s] = A(
|
|
2711
2720
|
() => t ?? it(r) ?? "dark"
|
|
2712
|
-
), [
|
|
2721
|
+
), [a, c] = A(!1), u = t ?? o;
|
|
2713
2722
|
_(() => {
|
|
2714
2723
|
if (t !== void 0) return;
|
|
2715
2724
|
const v = () => {
|
|
2716
|
-
const
|
|
2717
|
-
|
|
2725
|
+
const y = it(r);
|
|
2726
|
+
y && s(y);
|
|
2718
2727
|
};
|
|
2719
2728
|
v();
|
|
2720
2729
|
const m = r.hostThemeAttribute, g = new MutationObserver(v);
|
|
@@ -2723,8 +2732,8 @@ function Ar({
|
|
|
2723
2732
|
attributeFilter: [m]
|
|
2724
2733
|
}), () => g.disconnect();
|
|
2725
2734
|
}, [t, r]);
|
|
2726
|
-
const l =
|
|
2727
|
-
() =>
|
|
2735
|
+
const l = Me(
|
|
2736
|
+
() => rn(r, u),
|
|
2728
2737
|
[r, u]
|
|
2729
2738
|
), f = $(() => {
|
|
2730
2739
|
const v = u === "dark" ? "light" : "dark";
|
|
@@ -2732,7 +2741,7 @@ function Ar({
|
|
|
2732
2741
|
i(v);
|
|
2733
2742
|
return;
|
|
2734
2743
|
}
|
|
2735
|
-
s(v),
|
|
2744
|
+
s(v), on(v, r);
|
|
2736
2745
|
}, [u, i, r]), p = $(() => {
|
|
2737
2746
|
c((v) => !v);
|
|
2738
2747
|
}, []);
|
|
@@ -2741,7 +2750,7 @@ function Ar({
|
|
|
2741
2750
|
rootAttributes: an(l),
|
|
2742
2751
|
hostTheme: u,
|
|
2743
2752
|
toggleHostTheme: f,
|
|
2744
|
-
settingsOpen:
|
|
2753
|
+
settingsOpen: a,
|
|
2745
2754
|
setSettingsOpen: c,
|
|
2746
2755
|
toggleSettings: p,
|
|
2747
2756
|
uiSettings: r
|
|
@@ -2750,7 +2759,7 @@ function Ar({
|
|
|
2750
2759
|
const yt = "/__pixelagent/apply", wt = "pixelagent-runtime-styles";
|
|
2751
2760
|
let xt = 0;
|
|
2752
2761
|
const We = /* @__PURE__ */ new WeakMap();
|
|
2753
|
-
function
|
|
2762
|
+
function Lr(e) {
|
|
2754
2763
|
let t = We.get(e);
|
|
2755
2764
|
if (t) return t;
|
|
2756
2765
|
for (const i of Array.from(e.classList))
|
|
@@ -2758,17 +2767,17 @@ function Sr(e) {
|
|
|
2758
2767
|
return We.set(e, i), i;
|
|
2759
2768
|
return xt += 1, t = `pa-runtime-${xt}`, We.set(e, t), e.classList.add(t), t;
|
|
2760
2769
|
}
|
|
2761
|
-
function
|
|
2770
|
+
function $r() {
|
|
2762
2771
|
let e = document.getElementById(wt);
|
|
2763
2772
|
return e || (e = document.createElement("style"), e.id = wt, document.head.appendChild(e)), e;
|
|
2764
2773
|
}
|
|
2765
2774
|
function Er(e, t, i, r) {
|
|
2766
|
-
const
|
|
2775
|
+
const o = $r(), s = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = new RegExp(
|
|
2767
2776
|
`(\\.${s}:${t}\\s*\\{)([\\s\\S]*?)(\\})`,
|
|
2768
2777
|
"m"
|
|
2769
2778
|
), c = `${i}: ${r} !important`;
|
|
2770
|
-
let u =
|
|
2771
|
-
const l = u.match(
|
|
2779
|
+
let u = o.textContent ?? "";
|
|
2780
|
+
const l = u.match(a);
|
|
2772
2781
|
if (l) {
|
|
2773
2782
|
const f = l[2], p = new RegExp(`(\\s*${i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*:\\s*)[^;]+;?`);
|
|
2774
2783
|
let v;
|
|
@@ -2780,7 +2789,7 @@ function Er(e, t, i, r) {
|
|
|
2780
2789
|
${c};
|
|
2781
2790
|
`;
|
|
2782
2791
|
}
|
|
2783
|
-
u = u.replace(
|
|
2792
|
+
u = u.replace(a, `$1${v}$3`);
|
|
2784
2793
|
} else
|
|
2785
2794
|
u && !u.endsWith(`
|
|
2786
2795
|
`) && (u += `
|
|
@@ -2789,287 +2798,287 @@ function Er(e, t, i, r) {
|
|
|
2789
2798
|
${c};
|
|
2790
2799
|
}
|
|
2791
2800
|
`;
|
|
2792
|
-
|
|
2801
|
+
o.textContent = u;
|
|
2793
2802
|
}
|
|
2794
2803
|
function Nt(e) {
|
|
2795
|
-
const t = Math.min(e.startX, e.currentX), i = Math.min(e.startY, e.currentY), r = Math.abs(e.currentX - e.startX),
|
|
2796
|
-
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 };
|
|
2797
2806
|
}
|
|
2798
|
-
function
|
|
2807
|
+
function Ir({
|
|
2799
2808
|
ui: e,
|
|
2800
2809
|
hostTheme: t,
|
|
2801
2810
|
onHostThemeChange: i,
|
|
2802
2811
|
applyEndpoint: r,
|
|
2803
|
-
onApply:
|
|
2812
|
+
onApply: o,
|
|
2804
2813
|
runtimeStateStyles: s
|
|
2805
2814
|
} = {}) {
|
|
2806
|
-
const
|
|
2815
|
+
const a = Sr({ ui: e, hostTheme: t, onHostThemeChange: i }), [c, u] = A(null);
|
|
2807
2816
|
_(() => {
|
|
2808
|
-
if (r ||
|
|
2809
|
-
let
|
|
2810
|
-
return fetch(yt, { method: "GET" }).then((
|
|
2811
|
-
!
|
|
2817
|
+
if (r || o) return;
|
|
2818
|
+
let b = !1;
|
|
2819
|
+
return fetch(yt, { method: "GET" }).then((M) => {
|
|
2820
|
+
!b && M.status === 405 && u(yt);
|
|
2812
2821
|
}).catch(() => {
|
|
2813
2822
|
}), () => {
|
|
2814
|
-
|
|
2823
|
+
b = !0;
|
|
2815
2824
|
};
|
|
2816
|
-
}, [r,
|
|
2817
|
-
const [l, f] =
|
|
2818
|
-
annotations:
|
|
2819
|
-
setAnnotations:
|
|
2820
|
-
updateAnnotation:
|
|
2821
|
-
removeAnnotation:
|
|
2822
|
-
} =
|
|
2823
|
-
(
|
|
2824
|
-
|
|
2825
|
-
|
|
2825
|
+
}, [r, o]);
|
|
2826
|
+
const [l, f] = A(!1), [p, v] = A("idle"), [m, g] = A("element"), {
|
|
2827
|
+
annotations: y,
|
|
2828
|
+
setAnnotations: S,
|
|
2829
|
+
updateAnnotation: w,
|
|
2830
|
+
removeAnnotation: k
|
|
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 = $(
|
|
2832
|
+
(b, M) => {
|
|
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);
|
|
2826
2835
|
}, 2500);
|
|
2827
2836
|
},
|
|
2828
2837
|
[]
|
|
2829
|
-
),
|
|
2830
|
-
async (
|
|
2831
|
-
if (
|
|
2838
|
+
), he = $(
|
|
2839
|
+
async (b, M, J) => {
|
|
2840
|
+
if (b)
|
|
2832
2841
|
try {
|
|
2833
|
-
await St(
|
|
2842
|
+
await St(b), K(M, J);
|
|
2834
2843
|
} catch {
|
|
2835
|
-
|
|
2844
|
+
K("Copy failed — check clipboard permissions", J);
|
|
2836
2845
|
}
|
|
2837
2846
|
},
|
|
2838
|
-
[
|
|
2839
|
-
),
|
|
2840
|
-
(
|
|
2841
|
-
|
|
2847
|
+
[K]
|
|
2848
|
+
), we = $(
|
|
2849
|
+
(b, M) => {
|
|
2850
|
+
b.length === 0 && !M || (h({ elements: b, areaBbox: M }), R(b[0] ?? null));
|
|
2842
2851
|
},
|
|
2843
2852
|
[]
|
|
2844
2853
|
), De = $(
|
|
2845
|
-
(
|
|
2846
|
-
if (!(!l || p !== "annotate" ||
|
|
2854
|
+
(b) => {
|
|
2855
|
+
if (!(!l || p !== "annotate" || Ie(b.target))) {
|
|
2847
2856
|
if (F) {
|
|
2848
|
-
|
|
2849
|
-
(
|
|
2857
|
+
U(
|
|
2858
|
+
(M) => M && { ...M, currentX: b.clientX, currentY: b.clientY }
|
|
2850
2859
|
);
|
|
2851
2860
|
return;
|
|
2852
2861
|
}
|
|
2853
|
-
m !== "area" &&
|
|
2862
|
+
m !== "area" && E(vt(b.clientX, b.clientY));
|
|
2854
2863
|
}
|
|
2855
2864
|
},
|
|
2856
2865
|
[l, p, F, m]
|
|
2857
2866
|
), Oe = $(
|
|
2858
|
-
(
|
|
2859
|
-
!l || p !== "annotate" ||
|
|
2860
|
-
startX:
|
|
2861
|
-
startY:
|
|
2862
|
-
currentX:
|
|
2863
|
-
currentY:
|
|
2867
|
+
(b) => {
|
|
2868
|
+
!l || p !== "annotate" || Ie(b.target) || m !== "area" || b.button !== 0 || (b.preventDefault(), b.stopPropagation(), U({
|
|
2869
|
+
startX: b.clientX,
|
|
2870
|
+
startY: b.clientY,
|
|
2871
|
+
currentX: b.clientX,
|
|
2872
|
+
currentY: b.clientY
|
|
2864
2873
|
}), h(null));
|
|
2865
2874
|
},
|
|
2866
2875
|
[l, p, m]
|
|
2867
2876
|
), Fe = $(() => {
|
|
2868
2877
|
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
|
-
|
|
2878
|
+
const b = Nt(F);
|
|
2879
|
+
if (U(null), b.width < 8 || b.height < 8) return;
|
|
2880
|
+
const M = sn(b, Ze);
|
|
2881
|
+
we(M, b);
|
|
2882
|
+
}, [F, we]), Be = $(
|
|
2883
|
+
(b) => {
|
|
2884
|
+
if (!l || p !== "annotate" || Ie(b.target) || m === "area") return;
|
|
2885
|
+
b.preventDefault(), b.stopPropagation();
|
|
2886
|
+
const M = vt(b.clientX, b.clientY);
|
|
2887
|
+
if (!M) return;
|
|
2888
|
+
if (b.shiftKey || m === "multi") {
|
|
2889
|
+
I((te) => te.includes(M) ? te.filter((B) => B !== M) : [...te, M]), R(M);
|
|
2881
2890
|
return;
|
|
2882
2891
|
}
|
|
2883
|
-
const J = x.length > 0 ? x : [
|
|
2884
|
-
|
|
2892
|
+
const J = x.length > 0 ? x : [M];
|
|
2893
|
+
we(J.includes(M) ? J : [M]);
|
|
2885
2894
|
},
|
|
2886
|
-
[l, p, m, x,
|
|
2895
|
+
[l, p, m, x, we]
|
|
2887
2896
|
);
|
|
2888
2897
|
_(() => {
|
|
2889
|
-
!
|
|
2890
|
-
}, [
|
|
2898
|
+
!z || j !== "all-instances" || Ct(z) <= 1 && ie("this-instance");
|
|
2899
|
+
}, [z, j]), _(() => {
|
|
2891
2900
|
if (l)
|
|
2892
2901
|
return document.addEventListener("mousemove", De, !0), document.addEventListener("mousedown", Oe, !0), document.addEventListener("mouseup", Fe, !0), document.addEventListener("click", Be, !0), () => {
|
|
2893
2902
|
document.removeEventListener("mousemove", De, !0), document.removeEventListener("mousedown", Oe, !0), document.removeEventListener("mouseup", Fe, !0), document.removeEventListener("click", Be, !0);
|
|
2894
2903
|
};
|
|
2895
2904
|
}, [l, De, Oe, Fe, Be]);
|
|
2896
2905
|
const Vt = $(
|
|
2897
|
-
(
|
|
2898
|
-
if (!
|
|
2899
|
-
const { elements: J, areaBbox: te } =
|
|
2906
|
+
(b, M) => {
|
|
2907
|
+
if (!L || !b.trim()) return;
|
|
2908
|
+
const { elements: J, areaBbox: te } = L;
|
|
2900
2909
|
if (J.length === 0 && !te) return;
|
|
2901
|
-
const
|
|
2910
|
+
const xe = dr({
|
|
2902
2911
|
elements: J,
|
|
2903
|
-
note:
|
|
2912
|
+
note: b,
|
|
2904
2913
|
areaBbox: te
|
|
2905
2914
|
});
|
|
2906
|
-
|
|
2915
|
+
S((B) => [...B, xe]), ee(!1), oe(!1), M ? (h(null), R(null)) : (h(null), R(null), I([]));
|
|
2907
2916
|
},
|
|
2908
|
-
[
|
|
2917
|
+
[L, S]
|
|
2909
2918
|
), Wt = $(() => {
|
|
2910
2919
|
h(null), R(null);
|
|
2911
2920
|
}, []), Qe = $(
|
|
2912
|
-
async (
|
|
2913
|
-
const
|
|
2914
|
-
await
|
|
2921
|
+
async (b) => {
|
|
2922
|
+
const M = ln(y);
|
|
2923
|
+
await he(M, "Copied all!", { copyAllFrom: b });
|
|
2915
2924
|
},
|
|
2916
|
-
[
|
|
2925
|
+
[y, he]
|
|
2917
2926
|
), Ut = $(
|
|
2918
|
-
async (
|
|
2919
|
-
const
|
|
2920
|
-
|
|
2927
|
+
async (b) => {
|
|
2928
|
+
const M = y.find((J) => J.id === b);
|
|
2929
|
+
M && await he(cn(M), "Copied!", { entryId: b });
|
|
2921
2930
|
},
|
|
2922
|
-
[
|
|
2931
|
+
[y, he]
|
|
2923
2932
|
), Yt = $(
|
|
2924
|
-
async (
|
|
2925
|
-
const
|
|
2926
|
-
for (const [B, Z] of
|
|
2927
|
-
for (const [
|
|
2928
|
-
ne.length > 0 &&
|
|
2929
|
-
if (
|
|
2933
|
+
async (b) => {
|
|
2934
|
+
const M = [];
|
|
2935
|
+
for (const [B, Z] of b)
|
|
2936
|
+
for (const [de, ne] of Z)
|
|
2937
|
+
ne.length > 0 && M.push([B, de, ne]);
|
|
2938
|
+
if (M.length === 0) return { applied: !1 };
|
|
2930
2939
|
if (s) {
|
|
2931
|
-
for (const [B, Z,
|
|
2940
|
+
for (const [B, Z, de] of M) {
|
|
2932
2941
|
if (Z === "normal") continue;
|
|
2933
|
-
const ne =
|
|
2934
|
-
for (const
|
|
2935
|
-
B.style.removeProperty(
|
|
2942
|
+
const ne = Lr(B);
|
|
2943
|
+
for (const Ne of de)
|
|
2944
|
+
B.style.removeProperty(Ne.property), Er(ne, Z, Ne.property, Ne.newValue);
|
|
2936
2945
|
}
|
|
2937
|
-
for (const [B, Z,
|
|
2946
|
+
for (const [B, Z, de] of M)
|
|
2938
2947
|
if (Z === "normal")
|
|
2939
|
-
for (const ne of
|
|
2948
|
+
for (const ne of de)
|
|
2940
2949
|
B.style.setProperty(ne.property, ne.newValue);
|
|
2941
|
-
return
|
|
2950
|
+
return K("Change applied"), { applied: !0, skipRevert: !0 };
|
|
2942
2951
|
}
|
|
2943
2952
|
const J = r ?? c ?? void 0, te = [];
|
|
2944
|
-
for (const [B, Z,
|
|
2945
|
-
const ne = Ge(B),
|
|
2953
|
+
for (const [B, Z, de] of M) {
|
|
2954
|
+
const ne = Ge(B), Ne = {
|
|
2946
2955
|
schemaVersion: 1,
|
|
2947
|
-
elementSelector: Mt(B,
|
|
2956
|
+
elementSelector: Mt(B, j),
|
|
2948
2957
|
sourceFile: ne.sourceFile,
|
|
2949
2958
|
lineNumber: ne.lineNumber,
|
|
2950
|
-
targetScope:
|
|
2959
|
+
targetScope: j,
|
|
2951
2960
|
state: Z,
|
|
2952
2961
|
stylingSystem: kt(B),
|
|
2953
|
-
changes:
|
|
2962
|
+
changes: de
|
|
2954
2963
|
};
|
|
2955
|
-
te.push(await
|
|
2964
|
+
te.push(await Zn(Ne, { applyEndpoint: J, onApply: o }));
|
|
2956
2965
|
}
|
|
2957
|
-
const
|
|
2966
|
+
const xe = te.every(
|
|
2958
2967
|
(B) => B.mode === "mcp" && B.result.success && B.result.linesChanged.length > 0
|
|
2959
2968
|
);
|
|
2960
|
-
return
|
|
2969
|
+
return K(xe ? "Change applied" : "Apply failed"), te.forEach((B, Z) => {
|
|
2961
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);
|
|
2962
|
-
}), { applied:
|
|
2971
|
+
}), { applied: xe };
|
|
2963
2972
|
},
|
|
2964
|
-
[
|
|
2965
|
-
), et = (
|
|
2966
|
-
|
|
2973
|
+
[j, r, c, o, s, K]
|
|
2974
|
+
), et = (b) => {
|
|
2975
|
+
a.setSettingsOpen(!1), f(!0), v(b), R(null), E(null), h(null), I([]), U(null), b === "annotate" && ee(!1);
|
|
2967
2976
|
}, Xt = () => {
|
|
2968
|
-
f(!1), v("idle"), R(null),
|
|
2977
|
+
f(!1), v("idle"), R(null), E(null), h(null), I([]), U(null), ee(!1), oe(!1);
|
|
2969
2978
|
}, Gt = F ? Nt(F) : null;
|
|
2970
2979
|
return /* @__PURE__ */ d(
|
|
2971
2980
|
"div",
|
|
2972
2981
|
{
|
|
2973
|
-
ref:
|
|
2982
|
+
ref: ae,
|
|
2974
2983
|
className: "pa-root",
|
|
2975
2984
|
"data-pixelagent-root": !0,
|
|
2976
|
-
...
|
|
2985
|
+
...a.rootAttributes,
|
|
2977
2986
|
children: [
|
|
2978
2987
|
/* @__PURE__ */ n(
|
|
2979
|
-
|
|
2988
|
+
Mr,
|
|
2980
2989
|
{
|
|
2981
|
-
rootAttributes:
|
|
2982
|
-
hostTheme:
|
|
2983
|
-
chrome:
|
|
2984
|
-
settingsOpen:
|
|
2985
|
-
onToggleSettings:
|
|
2986
|
-
onCloseSettings: () =>
|
|
2987
|
-
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,
|
|
2988
2997
|
active: l,
|
|
2989
2998
|
mode: p,
|
|
2990
2999
|
captureMode: m,
|
|
2991
|
-
annotationCount:
|
|
3000
|
+
annotationCount: y.length,
|
|
2992
3001
|
multiSelectCount: x.length,
|
|
2993
|
-
copyStatus:
|
|
2994
|
-
copyAllFrom:
|
|
3002
|
+
copyStatus: P,
|
|
3003
|
+
copyAllFrom: O,
|
|
2995
3004
|
onActivateAnnotate: () => et("annotate"),
|
|
2996
3005
|
onActivateEdit: () => et("edit"),
|
|
2997
3006
|
onDeactivate: Xt,
|
|
2998
3007
|
onCopyAll: () => Qe("toolbar"),
|
|
2999
3008
|
onCaptureModeChange: g,
|
|
3000
3009
|
onConfirmMultiSelect: () => {
|
|
3001
|
-
x.length > 0 &&
|
|
3010
|
+
x.length > 0 && we(x);
|
|
3002
3011
|
}
|
|
3003
3012
|
}
|
|
3004
3013
|
),
|
|
3005
|
-
l && p === "annotate" && /* @__PURE__ */ d(
|
|
3014
|
+
l && p === "annotate" && /* @__PURE__ */ d(q, { children: [
|
|
3006
3015
|
/* @__PURE__ */ n(
|
|
3007
|
-
|
|
3016
|
+
Et,
|
|
3008
3017
|
{
|
|
3009
|
-
element:
|
|
3010
|
-
selected:
|
|
3018
|
+
element: N,
|
|
3019
|
+
selected: z,
|
|
3011
3020
|
multiSelected: x
|
|
3012
3021
|
}
|
|
3013
3022
|
),
|
|
3014
|
-
/* @__PURE__ */ n(
|
|
3015
|
-
/* @__PURE__ */ n(
|
|
3023
|
+
/* @__PURE__ */ n(fr, { annotations: y }),
|
|
3024
|
+
/* @__PURE__ */ n(cr, { area: Gt, isDragging: !!F })
|
|
3016
3025
|
] }),
|
|
3017
|
-
l && p === "annotate" &&
|
|
3018
|
-
|
|
3026
|
+
l && p === "annotate" && L && /* @__PURE__ */ n(
|
|
3027
|
+
lr,
|
|
3019
3028
|
{
|
|
3020
|
-
elements:
|
|
3021
|
-
areaBbox:
|
|
3029
|
+
elements: L.elements,
|
|
3030
|
+
areaBbox: L.areaBbox,
|
|
3022
3031
|
onSubmit: Vt,
|
|
3023
3032
|
onCancel: Wt
|
|
3024
3033
|
}
|
|
3025
3034
|
),
|
|
3026
3035
|
l && p === "edit" && /* @__PURE__ */ n(
|
|
3027
|
-
|
|
3036
|
+
Jn,
|
|
3028
3037
|
{
|
|
3029
|
-
selectedElement:
|
|
3030
|
-
hoveredElement:
|
|
3038
|
+
selectedElement: z,
|
|
3039
|
+
hoveredElement: N,
|
|
3031
3040
|
onSelectElement: R,
|
|
3032
|
-
onHoverElement:
|
|
3033
|
-
targetScope:
|
|
3034
|
-
onTargetScopeChange:
|
|
3035
|
-
elementState:
|
|
3036
|
-
onElementStateChange:
|
|
3041
|
+
onHoverElement: E,
|
|
3042
|
+
targetScope: j,
|
|
3043
|
+
onTargetScopeChange: ie,
|
|
3044
|
+
elementState: ce,
|
|
3045
|
+
onElementStateChange: C,
|
|
3037
3046
|
onApply: Yt,
|
|
3038
|
-
applyStatus: p === "edit" ?
|
|
3039
|
-
isToolbarTarget:
|
|
3047
|
+
applyStatus: p === "edit" ? P : null,
|
|
3048
|
+
isToolbarTarget: Ie
|
|
3040
3049
|
}
|
|
3041
3050
|
),
|
|
3042
|
-
|
|
3043
|
-
|
|
3051
|
+
W && /* @__PURE__ */ n(
|
|
3052
|
+
mr,
|
|
3044
3053
|
{
|
|
3045
|
-
annotations:
|
|
3046
|
-
collapsed:
|
|
3047
|
-
onToggleCollapsed: () =>
|
|
3054
|
+
annotations: y,
|
|
3055
|
+
collapsed: re,
|
|
3056
|
+
onToggleCollapsed: () => oe((b) => !b),
|
|
3048
3057
|
onClose: () => {
|
|
3049
|
-
|
|
3058
|
+
ee(!0), oe(!1);
|
|
3050
3059
|
},
|
|
3051
3060
|
onCopyAll: () => Qe("session"),
|
|
3052
3061
|
onCopyOne: Ut,
|
|
3053
|
-
onRemove:
|
|
3054
|
-
onUpdate:
|
|
3055
|
-
copyStatus:
|
|
3056
|
-
copiedEntryId:
|
|
3057
|
-
copyAllFrom:
|
|
3062
|
+
onRemove: k,
|
|
3063
|
+
onUpdate: w,
|
|
3064
|
+
copyStatus: P,
|
|
3065
|
+
copiedEntryId: T,
|
|
3066
|
+
copyAllFrom: O
|
|
3058
3067
|
}
|
|
3059
3068
|
)
|
|
3060
3069
|
]
|
|
3061
3070
|
}
|
|
3062
3071
|
);
|
|
3063
3072
|
}
|
|
3064
|
-
function
|
|
3073
|
+
function Rr() {
|
|
3065
3074
|
return typeof process < "u" && process.env.NODE_ENV !== "production";
|
|
3066
3075
|
}
|
|
3067
|
-
function
|
|
3068
|
-
return
|
|
3076
|
+
function Fr() {
|
|
3077
|
+
return Rr() ? /* @__PURE__ */ n(Ir, {}) : null;
|
|
3069
3078
|
}
|
|
3070
3079
|
export {
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3080
|
+
Ir as PixelAgent,
|
|
3081
|
+
Fr as PixelAgentDev,
|
|
3082
|
+
Rr as isDevEnvironment
|
|
3074
3083
|
};
|
|
3075
3084
|
//# sourceMappingURL=pixelagent.js.map
|