pixelagent 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/pixelagent.js +6 -0
- package/dist/PixelAgent.d.ts +13 -0
- package/dist/PixelAgent.d.ts.map +1 -0
- package/dist/annotate/AnnotationBadgesOverlay.d.ts +13 -0
- package/dist/annotate/AnnotationBadgesOverlay.d.ts.map +1 -0
- package/dist/annotate/AnnotationPopover.d.ts +14 -0
- package/dist/annotate/AnnotationPopover.d.ts.map +1 -0
- package/dist/annotate/AreaSelectOverlay.d.ts +13 -0
- package/dist/annotate/AreaSelectOverlay.d.ts.map +1 -0
- package/dist/annotate/ElementOverlay.d.ts +10 -0
- package/dist/annotate/ElementOverlay.d.ts.map +1 -0
- package/dist/annotate/SessionPanel.d.ts +17 -0
- package/dist/annotate/SessionPanel.d.ts.map +1 -0
- package/dist/annotate/annotationAnchor.d.ts +5 -0
- package/dist/annotate/annotationAnchor.d.ts.map +1 -0
- package/dist/annotate/buildAnnotationEntry.d.ts +13 -0
- package/dist/annotate/buildAnnotationEntry.d.ts.map +1 -0
- package/dist/annotate/pickElement.d.ts +4 -0
- package/dist/annotate/pickElement.d.ts.map +1 -0
- package/dist/annotate/popoverPosition.d.ts +20 -0
- package/dist/annotate/popoverPosition.d.ts.map +1 -0
- package/dist/edit/ColorField.d.ts +2 -0
- package/dist/edit/ColorField.d.ts.map +1 -0
- package/dist/edit/ColorPickerPopover.d.ts +8 -0
- package/dist/edit/ColorPickerPopover.d.ts.map +1 -0
- package/dist/edit/EditActionIcons.d.ts +7 -0
- package/dist/edit/EditActionIcons.d.ts.map +1 -0
- package/dist/edit/EditPanel.d.ts +19 -0
- package/dist/edit/EditPanel.d.ts.map +1 -0
- package/dist/edit/EditPropertiesPanel.d.ts +17 -0
- package/dist/edit/EditPropertiesPanel.d.ts.map +1 -0
- package/dist/edit/EditSection.d.ts +10 -0
- package/dist/edit/EditSection.d.ts.map +1 -0
- package/dist/edit/FontFamilySelect.d.ts +7 -0
- package/dist/edit/FontFamilySelect.d.ts.map +1 -0
- package/dist/edit/PropertyField.d.ts +11 -0
- package/dist/edit/PropertyField.d.ts.map +1 -0
- package/dist/edit/SegmentedControl.d.ts +29 -0
- package/dist/edit/SegmentedControl.d.ts.map +1 -0
- package/dist/edit/ToggleButtonGroup.d.ts +25 -0
- package/dist/edit/ToggleButtonGroup.d.ts.map +1 -0
- package/dist/edit/TypographyIcons.d.ts +10 -0
- package/dist/edit/TypographyIcons.d.ts.map +1 -0
- package/dist/edit/colorModel.d.ts +21 -0
- package/dist/edit/colorModel.d.ts.map +1 -0
- package/dist/edit/fontFamilies.d.ts +15 -0
- package/dist/edit/fontFamilies.d.ts.map +1 -0
- package/dist/edit/propertyControls.d.ts +19 -0
- package/dist/edit/propertyControls.d.ts.map +1 -0
- package/dist/edit/styleUtils.d.ts +11 -0
- package/dist/edit/styleUtils.d.ts.map +1 -0
- package/dist/edit/submitApply.d.ts +17 -0
- package/dist/edit/submitApply.d.ts.map +1 -0
- package/dist/edit/useEditPreview.d.ts +20 -0
- package/dist/edit/useEditPreview.d.ts.map +1 -0
- package/dist/glass/GlassButton.d.ts +9 -0
- package/dist/glass/GlassButton.d.ts.map +1 -0
- package/dist/glass/GlassContainer.d.ts +12 -0
- package/dist/glass/GlassContainer.d.ts.map +1 -0
- package/dist/glass/GlassGroup.d.ts +11 -0
- package/dist/glass/GlassGroup.d.ts.map +1 -0
- package/dist/glass/GlassPanel.d.ts +13 -0
- package/dist/glass/GlassPanel.d.ts.map +1 -0
- package/dist/glass/GlassSurface.d.ts +17 -0
- package/dist/glass/GlassSurface.d.ts.map +1 -0
- package/dist/glass/backdropSupport.d.ts +16 -0
- package/dist/glass/backdropSupport.d.ts.map +1 -0
- package/dist/glass/displacementMap.d.ts +22 -0
- package/dist/glass/displacementMap.d.ts.map +1 -0
- package/dist/glass/index.d.ts +6 -0
- package/dist/glass/index.d.ts.map +1 -0
- package/dist/hooks/useAnnotationSession.d.ts +8 -0
- package/dist/hooks/useAnnotationSession.d.ts.map +1 -0
- package/dist/hooks/useDraggable.d.ts +25 -0
- package/dist/hooks/useDraggable.d.ts.map +1 -0
- package/dist/hooks/useElementRect.d.ts +2 -0
- package/dist/hooks/useElementRect.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/pixelagent.css +1 -0
- package/dist/pixelagent.js +2723 -0
- package/dist/pixelagent.js.map +1 -0
- package/dist/shadow/PixelAgentIcon.d.ts +11 -0
- package/dist/shadow/PixelAgentIcon.d.ts.map +1 -0
- package/dist/shadow/Toolbar.d.ts +27 -0
- package/dist/shadow/Toolbar.d.ts.map +1 -0
- package/dist/ui/CopyFeedbackSlot.d.ts +10 -0
- package/dist/ui/CopyFeedbackSlot.d.ts.map +1 -0
- package/dist/ui/ToolbarSettingsMenu.d.ts +11 -0
- package/dist/ui/ToolbarSettingsMenu.d.ts.map +1 -0
- package/dist/ui/icons.d.ts +4 -0
- package/dist/ui/icons.d.ts.map +1 -0
- package/dist/ui/usePixelAgentUi.d.ts +23 -0
- package/dist/ui/usePixelAgentUi.d.ts.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,2723 @@
|
|
|
1
|
+
import { jsxs as c, Fragment as X, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as A, useEffect as z, useRef as V, useMemo as le, useLayoutEffect as Ct, useCallback as E, useId as Mt } from "react";
|
|
3
|
+
import { getElementDisplayLabel as Te, captureTextSnapshot as ze, captureInlineStyles as Ue, restoreInlineStyles as ce, restoreTextSnapshot as de, getPreviewTargets as ge, clearTailwindStatePreview as ue, applyTailwindStatePreview as Me, setEditableTextPreview as Ve, getRelevantComputedStyles as pe, getEditableTextInfo as ie, readReactSource as Re, detectStylingSystem as et, countElementInstances as tt, getScopeSelector as nt, getCssSelector as rt, getWindowSelectionText as it, getNearestReactComponentName as At, getDomPath as St, resolveElementFromEntry as at, getAnnotationSessionDisplay as Lt, loadAnnotationSession as Et, saveAnnotationSession as It, DEFAULT_PIXEL_AGENT_UI_SETTINGS as Tt, readHostThemeFromDocument as _e, resolvePixelAgentChrome as Rt, applyHostThemeToDocument as Dt, pixelAgentRootAttributes as Pt, copyToClipboard as Ft, getElementsInArea as Ot, formatAllAnnotations as $t, formatAnnotation as Bt } from "@pixelagent/shared";
|
|
4
|
+
export * from "@pixelagent/shared";
|
|
5
|
+
import { createPortal as De } from "react-dom";
|
|
6
|
+
function ot({
|
|
7
|
+
element: e,
|
|
8
|
+
selected: t,
|
|
9
|
+
multiSelected: i = [],
|
|
10
|
+
primarySelected: r = null
|
|
11
|
+
}) {
|
|
12
|
+
const [a, s] = A([]), o = r ?? t;
|
|
13
|
+
if (z(() => {
|
|
14
|
+
const u = /* @__PURE__ */ new Map(), p = i.length > 0;
|
|
15
|
+
e && !t && !p && u.set(e, !1), t && u.set(t, !0);
|
|
16
|
+
for (const f of i)
|
|
17
|
+
u.set(f, !0);
|
|
18
|
+
if (u.size === 0) {
|
|
19
|
+
s([]);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const m = () => {
|
|
23
|
+
s(
|
|
24
|
+
Array.from(u.entries()).map(([f, g]) => ({
|
|
25
|
+
rect: f.getBoundingClientRect(),
|
|
26
|
+
label: Te(f),
|
|
27
|
+
isSelected: g,
|
|
28
|
+
isPrimary: o !== null && f === o
|
|
29
|
+
}))
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
m();
|
|
33
|
+
const w = Array.from(u.keys()).map((f) => {
|
|
34
|
+
const g = new ResizeObserver(m);
|
|
35
|
+
return g.observe(f), g;
|
|
36
|
+
});
|
|
37
|
+
return window.addEventListener("scroll", m, !0), window.addEventListener("resize", m), () => {
|
|
38
|
+
for (const f of w) f.disconnect();
|
|
39
|
+
window.removeEventListener("scroll", m, !0), window.removeEventListener("resize", m);
|
|
40
|
+
};
|
|
41
|
+
}, [e, t, i, o]), a.length === 0) return null;
|
|
42
|
+
const d = a.find((u) => u.isPrimary) ?? a.find((u) => u.isSelected) ?? a[0], l = a.filter((u) => u.isSelected).length;
|
|
43
|
+
return /* @__PURE__ */ c(X, { children: [
|
|
44
|
+
a.map((u, p) => /* @__PURE__ */ n(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
className: [
|
|
48
|
+
"pa-highlight",
|
|
49
|
+
u.isSelected ? "pa-highlight-selected" : "",
|
|
50
|
+
u.isPrimary ? "pa-highlight-primary" : "",
|
|
51
|
+
u.isSelected && !u.isPrimary && l > 1 ? "pa-highlight-scope" : ""
|
|
52
|
+
].filter(Boolean).join(" "),
|
|
53
|
+
style: {
|
|
54
|
+
top: u.rect.top,
|
|
55
|
+
left: u.rect.left,
|
|
56
|
+
width: u.rect.width,
|
|
57
|
+
height: u.rect.height
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
`${u.label}-${p}`
|
|
61
|
+
)),
|
|
62
|
+
/* @__PURE__ */ n(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
className: "pa-tooltip",
|
|
66
|
+
style: {
|
|
67
|
+
top: Math.max(0, d.rect.top - 28),
|
|
68
|
+
left: d.rect.left
|
|
69
|
+
},
|
|
70
|
+
children: l > 1 ? `${l} instances · ${d.label}` : d.label
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] });
|
|
74
|
+
}
|
|
75
|
+
const st = 0.35, Ht = 0.48;
|
|
76
|
+
function zt(e, t, i, r = st) {
|
|
77
|
+
if (e < 8 || t < 8) return null;
|
|
78
|
+
const a = 1, s = Math.max(1, Math.round(e * a)), o = Math.max(1, Math.round(t * a)), d = document.createElement("canvas");
|
|
79
|
+
d.width = s, d.height = o;
|
|
80
|
+
const l = d.getContext("2d");
|
|
81
|
+
if (!l) return null;
|
|
82
|
+
const u = l.createImageData(s, o), p = u.data, m = Math.min(0.5, i / Math.min(e, t)), w = 0.3, f = 0.2, g = Math.max(0.4, m + 0.1);
|
|
83
|
+
let v = 0;
|
|
84
|
+
const M = new Float32Array(s * o * 2);
|
|
85
|
+
let y = 0;
|
|
86
|
+
for (let N = 0; N < o; N++)
|
|
87
|
+
for (let I = 0; I < s; I++) {
|
|
88
|
+
const T = I / s - 0.5, h = N / o - 0.5, k = Ut(T, h, w, f, g), R = We(0.8, 0, k - 0.15), S = We(0, 1, R), P = (T * S + 0.5) * s - I, F = (h * S + 0.5) * o - N;
|
|
89
|
+
Math.abs(P) > v && (v = Math.abs(P)), Math.abs(F) > v && (v = Math.abs(F)), M[y++] = P, M[y++] = F;
|
|
90
|
+
}
|
|
91
|
+
if (v === 0) return null;
|
|
92
|
+
v *= 0.4 * r;
|
|
93
|
+
let b = 0;
|
|
94
|
+
for (let N = 0; N < p.length; N += 4) {
|
|
95
|
+
const I = M[b++] / v + 0.5, T = M[b++] / v + 0.5;
|
|
96
|
+
p[N] = I * 255, p[N + 1] = T * 255, p[N + 2] = 0, p[N + 3] = 255;
|
|
97
|
+
}
|
|
98
|
+
return l.putImageData(u, 0, 0), {
|
|
99
|
+
href: d.toDataURL("image/png"),
|
|
100
|
+
scale: v / a,
|
|
101
|
+
width: s,
|
|
102
|
+
height: o
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function Ut(e, t, i, r, a) {
|
|
106
|
+
const s = Math.abs(e) - i + a, o = Math.abs(t) - r + a;
|
|
107
|
+
return Math.min(Math.max(s, o), 0) + Math.hypot(Math.max(s, 0), Math.max(o, 0)) - a;
|
|
108
|
+
}
|
|
109
|
+
function We(e, t, i) {
|
|
110
|
+
const r = Math.max(0, Math.min(1, (i - e) / (t - e)));
|
|
111
|
+
return r * r * (3 - 2 * r);
|
|
112
|
+
}
|
|
113
|
+
function Ee() {
|
|
114
|
+
if (typeof navigator > "u") return !1;
|
|
115
|
+
const e = navigator.userAgent;
|
|
116
|
+
return !(/AppleWebKit/i.test(e) && !/Chrome|Chromium|Edg|OPR|CriOS|FxiOS/i.test(e) || /Firefox/i.test(e));
|
|
117
|
+
}
|
|
118
|
+
const Vt = {
|
|
119
|
+
default: "blur(4px) saturate(130%)",
|
|
120
|
+
/** Toolbar — slightly stronger frost + refraction chain. */
|
|
121
|
+
enhanced: "blur(6px) saturate(138%)"
|
|
122
|
+
};
|
|
123
|
+
function _t(e, t = "default") {
|
|
124
|
+
const i = Vt[t], a = e !== null && Ee() ? `${i} url(#${e})` : i;
|
|
125
|
+
return {
|
|
126
|
+
backdropFilter: a,
|
|
127
|
+
WebkitBackdropFilter: a
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
let Wt = 0;
|
|
131
|
+
function lt({
|
|
132
|
+
shape: e = "rect",
|
|
133
|
+
cornerRadius: t,
|
|
134
|
+
tint: i = "neutral",
|
|
135
|
+
intensity: r = "default",
|
|
136
|
+
className: a = "",
|
|
137
|
+
style: s,
|
|
138
|
+
children: o
|
|
139
|
+
}) {
|
|
140
|
+
const d = t ?? (e === "capsule" ? 9999 : 20), l = r === "enhanced" ? Ht : st, u = V(null), p = le(() => `pa-lg-${++Wt}`, []), [m, w] = A(null);
|
|
141
|
+
Ct(() => {
|
|
142
|
+
const g = u.current;
|
|
143
|
+
if (!g) return;
|
|
144
|
+
let v = 0;
|
|
145
|
+
const M = () => {
|
|
146
|
+
cancelAnimationFrame(v), v = requestAnimationFrame(() => {
|
|
147
|
+
const b = g.getBoundingClientRect(), N = Math.round(b.width), I = Math.round(b.height);
|
|
148
|
+
if (N < 8 || I < 8) return;
|
|
149
|
+
const T = e === "capsule" ? I / 2 : Math.min(d, N / 2, I / 2), h = zt(N, I, T, l);
|
|
150
|
+
h && w(h);
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
M();
|
|
154
|
+
const y = new ResizeObserver(M);
|
|
155
|
+
return y.observe(g), () => {
|
|
156
|
+
cancelAnimationFrame(v), y.disconnect();
|
|
157
|
+
};
|
|
158
|
+
}, [e, d, l]);
|
|
159
|
+
const f = m && Ee() && typeof document < "u" ? De(
|
|
160
|
+
/* @__PURE__ */ n(
|
|
161
|
+
"svg",
|
|
162
|
+
{
|
|
163
|
+
"aria-hidden": !0,
|
|
164
|
+
width: "0",
|
|
165
|
+
height: "0",
|
|
166
|
+
style: {
|
|
167
|
+
position: "fixed",
|
|
168
|
+
top: 0,
|
|
169
|
+
left: 0,
|
|
170
|
+
width: 0,
|
|
171
|
+
height: 0,
|
|
172
|
+
overflow: "hidden",
|
|
173
|
+
pointerEvents: "none"
|
|
174
|
+
},
|
|
175
|
+
children: /* @__PURE__ */ n("defs", { children: /* @__PURE__ */ c(
|
|
176
|
+
"filter",
|
|
177
|
+
{
|
|
178
|
+
id: p,
|
|
179
|
+
filterUnits: "userSpaceOnUse",
|
|
180
|
+
colorInterpolationFilters: "sRGB",
|
|
181
|
+
x: "0",
|
|
182
|
+
y: "0",
|
|
183
|
+
width: m.width,
|
|
184
|
+
height: m.height,
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ n(
|
|
187
|
+
"feImage",
|
|
188
|
+
{
|
|
189
|
+
href: m.href,
|
|
190
|
+
xlinkHref: m.href,
|
|
191
|
+
width: m.width,
|
|
192
|
+
height: m.height,
|
|
193
|
+
preserveAspectRatio: "none",
|
|
194
|
+
result: "map"
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
/* @__PURE__ */ n(
|
|
198
|
+
"feDisplacementMap",
|
|
199
|
+
{
|
|
200
|
+
in: "SourceGraphic",
|
|
201
|
+
in2: "map",
|
|
202
|
+
scale: m.scale,
|
|
203
|
+
xChannelSelector: "R",
|
|
204
|
+
yChannelSelector: "G"
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
) })
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
document.body
|
|
213
|
+
) : null;
|
|
214
|
+
return /* @__PURE__ */ c(X, { children: [
|
|
215
|
+
f,
|
|
216
|
+
/* @__PURE__ */ c(
|
|
217
|
+
"div",
|
|
218
|
+
{
|
|
219
|
+
ref: u,
|
|
220
|
+
className: `pa-glass-surface pa-glass-surface--${e} pa-glass-surface--${i} ${a}`.trim(),
|
|
221
|
+
style: {
|
|
222
|
+
borderRadius: e === "capsule" ? "999px" : `${d}px`,
|
|
223
|
+
..._t(
|
|
224
|
+
m && Ee() ? p : null,
|
|
225
|
+
r
|
|
226
|
+
),
|
|
227
|
+
...s
|
|
228
|
+
},
|
|
229
|
+
children: [
|
|
230
|
+
/* @__PURE__ */ n("div", { className: "pa-glass-surface-bg", "aria-hidden": "true" }),
|
|
231
|
+
/* @__PURE__ */ n("div", { className: "pa-glass-surface-shine", "aria-hidden": "true" }),
|
|
232
|
+
/* @__PURE__ */ n("div", { className: "pa-glass-surface-content", children: o })
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
] });
|
|
237
|
+
}
|
|
238
|
+
function B({
|
|
239
|
+
variant: e = "regular",
|
|
240
|
+
className: t = "",
|
|
241
|
+
children: i,
|
|
242
|
+
...r
|
|
243
|
+
}) {
|
|
244
|
+
return /* @__PURE__ */ n(
|
|
245
|
+
"button",
|
|
246
|
+
{
|
|
247
|
+
type: "button",
|
|
248
|
+
className: `pa-glass-btn pa-glass-btn--${e} ${t}`.trim(),
|
|
249
|
+
...r,
|
|
250
|
+
children: i
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
function be({
|
|
255
|
+
variant: e = "sheet",
|
|
256
|
+
side: t = "left",
|
|
257
|
+
className: i = "",
|
|
258
|
+
style: r,
|
|
259
|
+
children: a
|
|
260
|
+
}) {
|
|
261
|
+
return /* @__PURE__ */ n(
|
|
262
|
+
lt,
|
|
263
|
+
{
|
|
264
|
+
shape: "rect",
|
|
265
|
+
cornerRadius: e === "popover" ? 16 : 20,
|
|
266
|
+
className: `pa-glass-panel pa-glass-panel--${e} pa-glass-panel--${t} ${i}`.trim(),
|
|
267
|
+
style: r,
|
|
268
|
+
children: a
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
function ct({
|
|
273
|
+
defaultPosition: e = null,
|
|
274
|
+
computeDefaultPosition: t
|
|
275
|
+
} = {}) {
|
|
276
|
+
const [i, r] = A(e), [a, s] = A(!1), o = V(null), d = V(null), l = E(() => {
|
|
277
|
+
if (i !== null) return;
|
|
278
|
+
const f = d.current;
|
|
279
|
+
if (!f) return;
|
|
280
|
+
const g = f.getBoundingClientRect();
|
|
281
|
+
r(
|
|
282
|
+
t ? t(g) : {
|
|
283
|
+
x: (window.innerWidth - g.width) / 2,
|
|
284
|
+
y: window.innerHeight - g.height - 24
|
|
285
|
+
}
|
|
286
|
+
);
|
|
287
|
+
}, [i, t]);
|
|
288
|
+
z(() => {
|
|
289
|
+
l();
|
|
290
|
+
}, [l]), z(() => {
|
|
291
|
+
const f = () => {
|
|
292
|
+
r((g) => {
|
|
293
|
+
if (!g || !d.current) return g;
|
|
294
|
+
const v = d.current.getBoundingClientRect();
|
|
295
|
+
return {
|
|
296
|
+
x: Math.min(g.x, window.innerWidth - v.width),
|
|
297
|
+
y: Math.min(g.y, window.innerHeight - v.height)
|
|
298
|
+
};
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
return window.addEventListener("resize", f), () => window.removeEventListener("resize", f);
|
|
302
|
+
}, []);
|
|
303
|
+
const u = E(
|
|
304
|
+
(f) => {
|
|
305
|
+
if (f.button !== 0) return;
|
|
306
|
+
const g = d.current;
|
|
307
|
+
if (!g) return;
|
|
308
|
+
let v = i;
|
|
309
|
+
if (!v) {
|
|
310
|
+
const M = g.getBoundingClientRect();
|
|
311
|
+
v = { x: M.left, y: M.top }, r(v);
|
|
312
|
+
}
|
|
313
|
+
o.current = {
|
|
314
|
+
pointerId: f.pointerId,
|
|
315
|
+
startX: f.clientX,
|
|
316
|
+
startY: f.clientY,
|
|
317
|
+
originX: v.x,
|
|
318
|
+
originY: v.y
|
|
319
|
+
}, s(!0), f.currentTarget.setPointerCapture(f.pointerId), f.preventDefault();
|
|
320
|
+
},
|
|
321
|
+
[i]
|
|
322
|
+
), p = E((f) => {
|
|
323
|
+
if (!o.current || o.current.pointerId !== f.pointerId) return;
|
|
324
|
+
const g = d.current, v = (g == null ? void 0 : g.offsetWidth) ?? 320, M = (g == null ? void 0 : g.offsetHeight) ?? 48, y = f.clientX - o.current.startX, b = f.clientY - o.current.startY, N = Math.max(8, Math.min(window.innerWidth - v - 8, o.current.originX + y)), I = Math.max(8, Math.min(window.innerHeight - M - 8, o.current.originY + b));
|
|
325
|
+
r({ x: N, y: I });
|
|
326
|
+
}, []), m = E((f) => {
|
|
327
|
+
if (!(!o.current || o.current.pointerId !== f.pointerId)) {
|
|
328
|
+
o.current = null, s(!1);
|
|
329
|
+
try {
|
|
330
|
+
f.currentTarget.releasePointerCapture(f.pointerId);
|
|
331
|
+
} catch {
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}, []), w = i !== null ? {
|
|
335
|
+
position: "fixed",
|
|
336
|
+
left: i.x,
|
|
337
|
+
top: i.y,
|
|
338
|
+
transform: "none",
|
|
339
|
+
marginLeft: 0,
|
|
340
|
+
bottom: "auto"
|
|
341
|
+
} : void 0;
|
|
342
|
+
return {
|
|
343
|
+
elementRef: d,
|
|
344
|
+
position: i,
|
|
345
|
+
isDragging: a,
|
|
346
|
+
style: w,
|
|
347
|
+
dragHandleProps: {
|
|
348
|
+
onPointerDown: u,
|
|
349
|
+
onPointerMove: p,
|
|
350
|
+
onPointerUp: m,
|
|
351
|
+
onPointerCancel: m
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
function Xt({ className: e }) {
|
|
356
|
+
return /* @__PURE__ */ c("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
357
|
+
/* @__PURE__ */ n(
|
|
358
|
+
"path",
|
|
359
|
+
{
|
|
360
|
+
fill: "none",
|
|
361
|
+
stroke: "currentColor",
|
|
362
|
+
strokeWidth: "1.35",
|
|
363
|
+
strokeLinecap: "round",
|
|
364
|
+
strokeLinejoin: "round",
|
|
365
|
+
d: "M3.25 8a4.75 4.75 0 0 1 8.1-2.35"
|
|
366
|
+
}
|
|
367
|
+
),
|
|
368
|
+
/* @__PURE__ */ n(
|
|
369
|
+
"path",
|
|
370
|
+
{
|
|
371
|
+
fill: "none",
|
|
372
|
+
stroke: "currentColor",
|
|
373
|
+
strokeWidth: "1.35",
|
|
374
|
+
strokeLinecap: "round",
|
|
375
|
+
strokeLinejoin: "round",
|
|
376
|
+
d: "M5.1 5.35 3.25 7.2 5.1 9.05"
|
|
377
|
+
}
|
|
378
|
+
)
|
|
379
|
+
] });
|
|
380
|
+
}
|
|
381
|
+
function Yt({ className: e }) {
|
|
382
|
+
return /* @__PURE__ */ c("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
|
|
383
|
+
/* @__PURE__ */ n(
|
|
384
|
+
"path",
|
|
385
|
+
{
|
|
386
|
+
fill: "none",
|
|
387
|
+
stroke: "currentColor",
|
|
388
|
+
strokeWidth: "1.35",
|
|
389
|
+
strokeLinecap: "round",
|
|
390
|
+
strokeLinejoin: "round",
|
|
391
|
+
d: "M11.1 3.65a4.75 4.75 0 0 1 1.15 7.75M12.05 11.35v2.15h-2.15"
|
|
392
|
+
}
|
|
393
|
+
),
|
|
394
|
+
/* @__PURE__ */ n(
|
|
395
|
+
"path",
|
|
396
|
+
{
|
|
397
|
+
fill: "none",
|
|
398
|
+
stroke: "currentColor",
|
|
399
|
+
strokeWidth: "1.35",
|
|
400
|
+
strokeLinecap: "round",
|
|
401
|
+
strokeLinejoin: "round",
|
|
402
|
+
d: "M4.9 12.35a4.75 4.75 0 0 1-1.15-7.75M3.95 4.65V2.5h2.15"
|
|
403
|
+
}
|
|
404
|
+
)
|
|
405
|
+
] });
|
|
406
|
+
}
|
|
407
|
+
const ae = (e, t, i) => Math.min(i, Math.max(t, e));
|
|
408
|
+
function Pe(e) {
|
|
409
|
+
const t = e.trim();
|
|
410
|
+
if (!t) return null;
|
|
411
|
+
const i = t.match(/^#([0-9a-f]{6})$/i);
|
|
412
|
+
if (i)
|
|
413
|
+
return {
|
|
414
|
+
r: parseInt(i[1].slice(0, 2), 16),
|
|
415
|
+
g: parseInt(i[1].slice(2, 4), 16),
|
|
416
|
+
b: parseInt(i[1].slice(4, 6), 16)
|
|
417
|
+
};
|
|
418
|
+
const r = t.match(/^#([0-9a-f]{3})$/i);
|
|
419
|
+
if (r) {
|
|
420
|
+
const [s, o, d] = r[1].split("");
|
|
421
|
+
return {
|
|
422
|
+
r: parseInt(s + s, 16),
|
|
423
|
+
g: parseInt(o + o, 16),
|
|
424
|
+
b: parseInt(d + d, 16)
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
const a = t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
|
|
428
|
+
return a ? {
|
|
429
|
+
r: ae(parseInt(a[1], 10), 0, 255),
|
|
430
|
+
g: ae(parseInt(a[2], 10), 0, 255),
|
|
431
|
+
b: ae(parseInt(a[3], 10), 0, 255)
|
|
432
|
+
} : null;
|
|
433
|
+
}
|
|
434
|
+
function dt(e) {
|
|
435
|
+
const t = (i) => ae(Math.round(i), 0, 255).toString(16).padStart(2, "0");
|
|
436
|
+
return `#${t(e.r)}${t(e.g)}${t(e.b)}`;
|
|
437
|
+
}
|
|
438
|
+
function Gt(e) {
|
|
439
|
+
return `rgb(${e.r}, ${e.g}, ${e.b})`;
|
|
440
|
+
}
|
|
441
|
+
function ut({ r: e, g: t, b: i }) {
|
|
442
|
+
const r = e / 255, a = t / 255, s = i / 255, o = Math.max(r, a, s), d = Math.min(r, a, s), l = o - d;
|
|
443
|
+
let u = 0;
|
|
444
|
+
l !== 0 && (o === r ? u = (a - s) / l % 6 : o === a ? u = (s - r) / l + 2 : u = (r - a) / l + 4, u *= 60, u < 0 && (u += 360));
|
|
445
|
+
const p = o === 0 ? 0 : l / o * 100, m = o * 100;
|
|
446
|
+
return { h: u, s: p, v: m };
|
|
447
|
+
}
|
|
448
|
+
function pt({ h: e, s: t, v: i }) {
|
|
449
|
+
const r = ae(t, 0, 100) / 100, a = ae(i, 0, 100) / 100, s = a * r, o = s * (1 - Math.abs(e / 60 % 2 - 1)), d = a - s;
|
|
450
|
+
let l = 0, u = 0, p = 0;
|
|
451
|
+
const m = (e % 360 + 360) % 360;
|
|
452
|
+
return m < 60 ? (l = s, u = o) : m < 120 ? (l = o, u = s) : m < 180 ? (u = s, p = o) : m < 240 ? (u = o, p = s) : m < 300 ? (l = o, p = s) : (l = s, p = o), {
|
|
453
|
+
r: Math.round((l + d) * 255),
|
|
454
|
+
g: Math.round((u + d) * 255),
|
|
455
|
+
b: Math.round((p + d) * 255)
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
function Xe(e) {
|
|
459
|
+
const t = Pe(e);
|
|
460
|
+
return t ? ut(t) : { h: 0, s: 0, v: 45 };
|
|
461
|
+
}
|
|
462
|
+
function Kt(e) {
|
|
463
|
+
return e.replace(/^#/, "").toUpperCase().slice(0, 6);
|
|
464
|
+
}
|
|
465
|
+
function jt(e, t) {
|
|
466
|
+
const i = e.replace(/[^0-9a-f]/gi, "").slice(0, 6);
|
|
467
|
+
return i.length < 6 ? t : Pe(`#${i}`) ?? t;
|
|
468
|
+
}
|
|
469
|
+
function qt(e) {
|
|
470
|
+
return dt(pt(e));
|
|
471
|
+
}
|
|
472
|
+
function Jt(e, t, i) {
|
|
473
|
+
const r = Ye((e - i.left) / i.width), a = Ye((t - i.top) / i.height);
|
|
474
|
+
return { x: r * 100, y: a * 100 };
|
|
475
|
+
}
|
|
476
|
+
function Ye(e) {
|
|
477
|
+
return Math.min(1, Math.max(0, e));
|
|
478
|
+
}
|
|
479
|
+
function Zt() {
|
|
480
|
+
if (typeof document > "u") return {};
|
|
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
|
+
return t ? { "data-pa-chrome": t } : {};
|
|
483
|
+
}
|
|
484
|
+
function Ae({ label: e, value: t, onChange: i }) {
|
|
485
|
+
const [r, a] = A(!1), [s, o] = A(() => Xe(t)), d = V(null), l = V(null), u = V(null), p = Mt(), [m, w] = A({ top: 0, left: 0, width: 260 }), f = pt(s), g = Kt(dt(f)), v = Pe(t) ? t : Gt(f), M = e.toLowerCase().includes("color") ? e : `${e} color`;
|
|
486
|
+
z(() => {
|
|
487
|
+
o(Xe(t));
|
|
488
|
+
}, [t]);
|
|
489
|
+
const y = E(
|
|
490
|
+
(k) => {
|
|
491
|
+
o(k), i(qt(k));
|
|
492
|
+
},
|
|
493
|
+
[i]
|
|
494
|
+
), b = E(
|
|
495
|
+
(k) => {
|
|
496
|
+
y(ut(k));
|
|
497
|
+
},
|
|
498
|
+
[y]
|
|
499
|
+
), N = E(() => {
|
|
500
|
+
const k = d.current;
|
|
501
|
+
if (!k) return;
|
|
502
|
+
const R = k.getBoundingClientRect(), S = 260;
|
|
503
|
+
let P = R.left;
|
|
504
|
+
P + S > window.innerWidth - 12 && (P = window.innerWidth - S - 12), P = Math.max(12, P);
|
|
505
|
+
let F = R.bottom + 8;
|
|
506
|
+
const _ = 320;
|
|
507
|
+
F + _ > window.innerHeight - 12 && (F = Math.max(12, R.top - _ - 8)), w({ top: F, left: P, width: S });
|
|
508
|
+
}, []);
|
|
509
|
+
z(() => {
|
|
510
|
+
if (!r) return;
|
|
511
|
+
N();
|
|
512
|
+
const k = (S) => {
|
|
513
|
+
var F, _;
|
|
514
|
+
const P = S.target;
|
|
515
|
+
(F = d.current) != null && F.contains(P) || (_ = l.current) != null && _.contains(P) || a(!1);
|
|
516
|
+
}, R = (S) => {
|
|
517
|
+
S.key === "Escape" && a(!1);
|
|
518
|
+
};
|
|
519
|
+
return window.addEventListener("mousedown", k, !0), window.addEventListener("keydown", R), window.addEventListener("resize", N), window.addEventListener("scroll", N, !0), () => {
|
|
520
|
+
window.removeEventListener("mousedown", k, !0), window.removeEventListener("keydown", R), window.removeEventListener("resize", N), window.removeEventListener("scroll", N, !0);
|
|
521
|
+
};
|
|
522
|
+
}, [r, N]);
|
|
523
|
+
const I = (k, R) => {
|
|
524
|
+
var _;
|
|
525
|
+
const S = (_ = u.current) == null ? void 0 : _.getBoundingClientRect();
|
|
526
|
+
if (!S) return;
|
|
527
|
+
const { x: P, y: F } = Jt(k, R, S);
|
|
528
|
+
y({ ...s, s: P, v: 100 - F });
|
|
529
|
+
}, T = (k) => {
|
|
530
|
+
k.preventDefault(), I(k.clientX, k.clientY);
|
|
531
|
+
const R = (P) => I(P.clientX, P.clientY), S = () => {
|
|
532
|
+
window.removeEventListener("mousemove", R), window.removeEventListener("mouseup", S);
|
|
533
|
+
};
|
|
534
|
+
window.addEventListener("mousemove", R), window.addEventListener("mouseup", S);
|
|
535
|
+
}, h = r ? De(
|
|
536
|
+
/* @__PURE__ */ n(
|
|
537
|
+
"div",
|
|
538
|
+
{
|
|
539
|
+
className: "pa-root pa-root--toolbar-portal pa-color-picker-portal",
|
|
540
|
+
"data-pixelagent-picker-portal": !0,
|
|
541
|
+
...Zt(),
|
|
542
|
+
children: /* @__PURE__ */ c(
|
|
543
|
+
"div",
|
|
544
|
+
{
|
|
545
|
+
ref: l,
|
|
546
|
+
id: p,
|
|
547
|
+
role: "dialog",
|
|
548
|
+
"aria-label": M,
|
|
549
|
+
className: "pa-color-picker",
|
|
550
|
+
style: { top: m.top, left: m.left, width: m.width },
|
|
551
|
+
children: [
|
|
552
|
+
/* @__PURE__ */ c("header", { className: "pa-color-picker-header", children: [
|
|
553
|
+
/* @__PURE__ */ n(
|
|
554
|
+
"span",
|
|
555
|
+
{
|
|
556
|
+
className: "pa-color-picker-preview",
|
|
557
|
+
style: { backgroundColor: v },
|
|
558
|
+
"aria-hidden": "true"
|
|
559
|
+
}
|
|
560
|
+
),
|
|
561
|
+
/* @__PURE__ */ n("span", { className: "pa-color-picker-header-label", children: M })
|
|
562
|
+
] }),
|
|
563
|
+
/* @__PURE__ */ n(
|
|
564
|
+
"div",
|
|
565
|
+
{
|
|
566
|
+
ref: u,
|
|
567
|
+
className: "pa-color-picker-sb",
|
|
568
|
+
style: { "--pa-picker-h": String(Math.round(s.h)) },
|
|
569
|
+
onMouseDown: T,
|
|
570
|
+
children: /* @__PURE__ */ n(
|
|
571
|
+
"span",
|
|
572
|
+
{
|
|
573
|
+
className: "pa-color-picker-sb-thumb",
|
|
574
|
+
style: { left: `${s.s}%`, top: `${100 - s.v}%` },
|
|
575
|
+
"aria-hidden": "true"
|
|
576
|
+
}
|
|
577
|
+
)
|
|
578
|
+
}
|
|
579
|
+
),
|
|
580
|
+
/* @__PURE__ */ c("div", { className: "pa-color-picker-hue", children: [
|
|
581
|
+
/* @__PURE__ */ n(
|
|
582
|
+
"input",
|
|
583
|
+
{
|
|
584
|
+
type: "range",
|
|
585
|
+
className: "pa-color-picker-hue-input",
|
|
586
|
+
min: 0,
|
|
587
|
+
max: 360,
|
|
588
|
+
value: Math.round(s.h),
|
|
589
|
+
"aria-label": "Hue",
|
|
590
|
+
onChange: (k) => y({ ...s, h: parseFloat(k.target.value) })
|
|
591
|
+
}
|
|
592
|
+
),
|
|
593
|
+
/* @__PURE__ */ n(
|
|
594
|
+
"span",
|
|
595
|
+
{
|
|
596
|
+
className: "pa-color-picker-hue-thumb",
|
|
597
|
+
style: { left: `${s.h / 360 * 100}%` },
|
|
598
|
+
"aria-hidden": "true"
|
|
599
|
+
}
|
|
600
|
+
)
|
|
601
|
+
] }),
|
|
602
|
+
/* @__PURE__ */ c("label", { className: "pa-color-picker-field", children: [
|
|
603
|
+
/* @__PURE__ */ n("span", { className: "pa-color-picker-field-label", children: "Hex" }),
|
|
604
|
+
/* @__PURE__ */ n(
|
|
605
|
+
"input",
|
|
606
|
+
{
|
|
607
|
+
className: "pa-input pa-color-picker-input",
|
|
608
|
+
type: "text",
|
|
609
|
+
value: g,
|
|
610
|
+
spellCheck: !1,
|
|
611
|
+
onChange: (k) => b(jt(k.target.value, f))
|
|
612
|
+
}
|
|
613
|
+
)
|
|
614
|
+
] }),
|
|
615
|
+
/* @__PURE__ */ n("div", { className: "pa-color-picker-rgb", children: ["r", "g", "b"].map((k) => /* @__PURE__ */ c("label", { className: "pa-color-picker-field pa-color-picker-field--rgb", children: [
|
|
616
|
+
/* @__PURE__ */ n("span", { className: "pa-color-picker-field-label", children: k.toUpperCase() }),
|
|
617
|
+
/* @__PURE__ */ n(
|
|
618
|
+
"input",
|
|
619
|
+
{
|
|
620
|
+
className: "pa-input pa-color-picker-input",
|
|
621
|
+
type: "number",
|
|
622
|
+
min: 0,
|
|
623
|
+
max: 255,
|
|
624
|
+
value: f[k],
|
|
625
|
+
onChange: (R) => {
|
|
626
|
+
const S = Qt(parseInt(R.target.value, 10));
|
|
627
|
+
b({ ...f, [k]: S });
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
)
|
|
631
|
+
] }, k)) })
|
|
632
|
+
]
|
|
633
|
+
}
|
|
634
|
+
)
|
|
635
|
+
}
|
|
636
|
+
),
|
|
637
|
+
document.body
|
|
638
|
+
) : null;
|
|
639
|
+
return /* @__PURE__ */ c("div", { className: "pa-color-field", children: [
|
|
640
|
+
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: e }),
|
|
641
|
+
/* @__PURE__ */ c(
|
|
642
|
+
"button",
|
|
643
|
+
{
|
|
644
|
+
ref: d,
|
|
645
|
+
type: "button",
|
|
646
|
+
className: "pa-color-field-trigger",
|
|
647
|
+
"aria-expanded": r,
|
|
648
|
+
"aria-haspopup": "dialog",
|
|
649
|
+
"aria-controls": r ? p : void 0,
|
|
650
|
+
onClick: () => {
|
|
651
|
+
r || N(), a((k) => !k);
|
|
652
|
+
},
|
|
653
|
+
children: [
|
|
654
|
+
/* @__PURE__ */ n("span", { className: "pa-color-field-swatch", style: { backgroundColor: v }, "aria-hidden": "true" }),
|
|
655
|
+
/* @__PURE__ */ n(
|
|
656
|
+
"input",
|
|
657
|
+
{
|
|
658
|
+
className: "pa-input pa-color-field-hex",
|
|
659
|
+
type: "text",
|
|
660
|
+
value: t,
|
|
661
|
+
readOnly: !0,
|
|
662
|
+
tabIndex: -1,
|
|
663
|
+
"aria-hidden": "true"
|
|
664
|
+
}
|
|
665
|
+
)
|
|
666
|
+
]
|
|
667
|
+
}
|
|
668
|
+
),
|
|
669
|
+
h
|
|
670
|
+
] });
|
|
671
|
+
}
|
|
672
|
+
function Qt(e) {
|
|
673
|
+
return Number.isFinite(e) ? Math.min(255, Math.max(0, e)) : 0;
|
|
674
|
+
}
|
|
675
|
+
function ne({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
|
|
676
|
+
const [a, s] = A(i);
|
|
677
|
+
return /* @__PURE__ */ c("section", { className: `pa-edit-section ${a ? "pa-edit-section--open" : ""}`, children: [
|
|
678
|
+
/* @__PURE__ */ c(
|
|
679
|
+
"button",
|
|
680
|
+
{
|
|
681
|
+
type: "button",
|
|
682
|
+
className: "pa-edit-section-header",
|
|
683
|
+
"aria-expanded": a,
|
|
684
|
+
onClick: () => s((o) => !o),
|
|
685
|
+
children: [
|
|
686
|
+
/* @__PURE__ */ n("span", { className: "pa-edit-section-title", children: e }),
|
|
687
|
+
r ? /* @__PURE__ */ n("span", { className: "pa-edit-section-badge", children: r }) : null,
|
|
688
|
+
/* @__PURE__ */ n("span", { className: "pa-edit-section-chevron", "aria-hidden": "true" })
|
|
689
|
+
]
|
|
690
|
+
}
|
|
691
|
+
),
|
|
692
|
+
a ? /* @__PURE__ */ n("div", { className: "pa-edit-section-body", children: t }) : null
|
|
693
|
+
] });
|
|
694
|
+
}
|
|
695
|
+
const re = [
|
|
696
|
+
{ value: "Inter, system-ui, sans-serif", label: "Inter" },
|
|
697
|
+
{ value: "system-ui, sans-serif", label: "System UI" },
|
|
698
|
+
{
|
|
699
|
+
value: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
700
|
+
label: "System"
|
|
701
|
+
},
|
|
702
|
+
{ value: 'Georgia, "Times New Roman", Times, serif', label: "Georgia" },
|
|
703
|
+
{ value: '"Times New Roman", Times, serif', label: "Times New Roman" },
|
|
704
|
+
{ value: "Arial, Helvetica, sans-serif", label: "Arial" },
|
|
705
|
+
{ value: "Helvetica, Arial, sans-serif", label: "Helvetica" },
|
|
706
|
+
{ value: '"JetBrains Mono", ui-monospace, monospace', label: "JetBrains Mono" },
|
|
707
|
+
{ value: "ui-monospace, monospace", label: "Monospace" }
|
|
708
|
+
], ve = "";
|
|
709
|
+
function he(e) {
|
|
710
|
+
var i;
|
|
711
|
+
return (((i = e.split(",")[0]) == null ? void 0 : i.trim()) ?? "").replace(/^["']|["']$/g, "");
|
|
712
|
+
}
|
|
713
|
+
function en(e) {
|
|
714
|
+
const t = e.trim();
|
|
715
|
+
if (!t)
|
|
716
|
+
return {
|
|
717
|
+
selectValue: ve,
|
|
718
|
+
options: re
|
|
719
|
+
};
|
|
720
|
+
const i = he(t).toLowerCase(), r = re.find(
|
|
721
|
+
(s) => s.value === t || he(s.value).toLowerCase() === i
|
|
722
|
+
);
|
|
723
|
+
if (r)
|
|
724
|
+
return { selectValue: r.value, options: re };
|
|
725
|
+
const a = re.find((s) => {
|
|
726
|
+
const o = he(s.value).toLowerCase();
|
|
727
|
+
return t.toLowerCase().includes(o) || o.includes(i);
|
|
728
|
+
});
|
|
729
|
+
return a ? { selectValue: a.value, options: re } : {
|
|
730
|
+
selectValue: t,
|
|
731
|
+
options: [
|
|
732
|
+
...re,
|
|
733
|
+
{ value: t, label: he(t) || "Custom" }
|
|
734
|
+
]
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
function tn({ value: e, onChange: t }) {
|
|
738
|
+
const { selectValue: i, options: r } = le(
|
|
739
|
+
() => en(e),
|
|
740
|
+
[e]
|
|
741
|
+
);
|
|
742
|
+
return /* @__PURE__ */ c("label", { className: "pa-edit-stack-field", children: [
|
|
743
|
+
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Font family" }),
|
|
744
|
+
/* @__PURE__ */ c(
|
|
745
|
+
"select",
|
|
746
|
+
{
|
|
747
|
+
className: "pa-select pa-font-family-select",
|
|
748
|
+
value: i || ve,
|
|
749
|
+
onChange: (a) => {
|
|
750
|
+
const s = a.target.value;
|
|
751
|
+
s && s !== ve && t(s);
|
|
752
|
+
},
|
|
753
|
+
children: [
|
|
754
|
+
/* @__PURE__ */ n("option", { value: ve, disabled: !0, children: "Select font style" }),
|
|
755
|
+
r.map((a) => /* @__PURE__ */ n("option", { value: a.value, children: a.label }, a.value))
|
|
756
|
+
]
|
|
757
|
+
}
|
|
758
|
+
)
|
|
759
|
+
] });
|
|
760
|
+
}
|
|
761
|
+
function Fe(e) {
|
|
762
|
+
const t = e.trim().match(/^(-?\d+(?:\.\d+)?)px$/i);
|
|
763
|
+
return t ? parseFloat(t[1]) : null;
|
|
764
|
+
}
|
|
765
|
+
function nn(e) {
|
|
766
|
+
const t = e.trim();
|
|
767
|
+
if (!t) return null;
|
|
768
|
+
if (t.endsWith("%")) {
|
|
769
|
+
const r = parseFloat(t);
|
|
770
|
+
return Number.isFinite(r) ? r / 100 : null;
|
|
771
|
+
}
|
|
772
|
+
const i = parseFloat(t);
|
|
773
|
+
return Number.isFinite(i) && i >= 0 && i <= 1 ? i : null;
|
|
774
|
+
}
|
|
775
|
+
function rn(e) {
|
|
776
|
+
const t = ht(e);
|
|
777
|
+
if (t !== null) return t > 0;
|
|
778
|
+
const i = Fe(e);
|
|
779
|
+
return i !== null && i > 0;
|
|
780
|
+
}
|
|
781
|
+
function ht(e) {
|
|
782
|
+
const t = e.trim().split(/\s+/).filter(Boolean);
|
|
783
|
+
if (t.length === 0) return null;
|
|
784
|
+
const i = t.map((a) => Fe(a));
|
|
785
|
+
if (i.some((a) => a === null)) return null;
|
|
786
|
+
const r = i[0];
|
|
787
|
+
return i.every((a) => a === r) ? r : null;
|
|
788
|
+
}
|
|
789
|
+
const an = {
|
|
790
|
+
padding: { kind: "uniform-px", min: 0, max: 80, step: 1 },
|
|
791
|
+
margin: { kind: "uniform-px", min: 0, max: 80, step: 1 },
|
|
792
|
+
width: { kind: "text" },
|
|
793
|
+
height: { kind: "text" },
|
|
794
|
+
"background-color": { kind: "text" },
|
|
795
|
+
color: { kind: "text" },
|
|
796
|
+
"font-size": { kind: "px", min: 8, max: 128, step: 1 },
|
|
797
|
+
"line-height": { kind: "text" },
|
|
798
|
+
gap: { kind: "uniform-px", min: 0, max: 80, step: 1 },
|
|
799
|
+
"border-width": { kind: "uniform-px", min: 0, max: 24, step: 1 },
|
|
800
|
+
"border-radius": { kind: "px", min: 0, max: 48, step: 1 },
|
|
801
|
+
opacity: { kind: "opacity", min: 0, max: 1, step: 0.01 }
|
|
802
|
+
};
|
|
803
|
+
function on(e, t, i) {
|
|
804
|
+
switch (i.kind) {
|
|
805
|
+
case "opacity":
|
|
806
|
+
return nn(t);
|
|
807
|
+
case "px":
|
|
808
|
+
return Fe(t);
|
|
809
|
+
case "uniform-px":
|
|
810
|
+
return ht(t);
|
|
811
|
+
default:
|
|
812
|
+
return null;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
function sn(e, t, i) {
|
|
816
|
+
switch (i.kind) {
|
|
817
|
+
case "opacity":
|
|
818
|
+
return String(Math.round(t * 100) / 100);
|
|
819
|
+
case "px":
|
|
820
|
+
case "uniform-px":
|
|
821
|
+
return `${Math.round(t)}px`;
|
|
822
|
+
default:
|
|
823
|
+
return String(t);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
function q({
|
|
827
|
+
property: e,
|
|
828
|
+
label: t,
|
|
829
|
+
value: i,
|
|
830
|
+
onChange: r,
|
|
831
|
+
compact: a = !1
|
|
832
|
+
}) {
|
|
833
|
+
const s = an[e] ?? { kind: "text" }, o = on(e, i, s), d = s.kind !== "text" && o !== null, l = a ? "pa-prop-row pa-prop-row--compact" : "pa-prop-row", u = a ? "pa-edit-field-label" : "pa-prop-label";
|
|
834
|
+
if (!d)
|
|
835
|
+
return /* @__PURE__ */ c("label", { className: l, children: [
|
|
836
|
+
/* @__PURE__ */ n("span", { className: u, children: t }),
|
|
837
|
+
/* @__PURE__ */ n(
|
|
838
|
+
"input",
|
|
839
|
+
{
|
|
840
|
+
className: "pa-input",
|
|
841
|
+
type: "text",
|
|
842
|
+
value: i,
|
|
843
|
+
onChange: (g) => r(g.target.value)
|
|
844
|
+
}
|
|
845
|
+
)
|
|
846
|
+
] });
|
|
847
|
+
const p = s.min ?? 0, m = s.max ?? 100, w = s.step ?? 1, f = (g) => {
|
|
848
|
+
r(sn(e, g, s));
|
|
849
|
+
};
|
|
850
|
+
return /* @__PURE__ */ c("label", { className: `${l} pa-prop-row--slider`, children: [
|
|
851
|
+
/* @__PURE__ */ n("span", { className: u, children: t }),
|
|
852
|
+
/* @__PURE__ */ c("div", { className: "pa-prop-slider-wrap", children: [
|
|
853
|
+
/* @__PURE__ */ n(
|
|
854
|
+
"input",
|
|
855
|
+
{
|
|
856
|
+
type: "range",
|
|
857
|
+
className: "pa-slider",
|
|
858
|
+
min: p,
|
|
859
|
+
max: m,
|
|
860
|
+
step: w,
|
|
861
|
+
value: o,
|
|
862
|
+
"aria-valuetext": i,
|
|
863
|
+
onChange: (g) => f(parseFloat(g.target.value))
|
|
864
|
+
}
|
|
865
|
+
),
|
|
866
|
+
/* @__PURE__ */ n(
|
|
867
|
+
"input",
|
|
868
|
+
{
|
|
869
|
+
className: "pa-input pa-prop-slider-value",
|
|
870
|
+
type: "text",
|
|
871
|
+
value: i,
|
|
872
|
+
onChange: (g) => r(g.target.value),
|
|
873
|
+
"aria-label": `${t} value`
|
|
874
|
+
}
|
|
875
|
+
)
|
|
876
|
+
] })
|
|
877
|
+
] });
|
|
878
|
+
}
|
|
879
|
+
function ln({
|
|
880
|
+
options: e,
|
|
881
|
+
value: t,
|
|
882
|
+
ariaLabel: i,
|
|
883
|
+
onChange: r
|
|
884
|
+
}) {
|
|
885
|
+
return /* @__PURE__ */ n("div", { className: "pa-segmented", role: "group", "aria-label": i, children: e.map((a) => /* @__PURE__ */ n(
|
|
886
|
+
"button",
|
|
887
|
+
{
|
|
888
|
+
type: "button",
|
|
889
|
+
className: `pa-segmented-btn ${t === a.value ? "pa-segmented-btn--on" : ""}`,
|
|
890
|
+
title: a.title,
|
|
891
|
+
"aria-pressed": t === a.value,
|
|
892
|
+
"aria-label": a.title,
|
|
893
|
+
onClick: () => r == null ? void 0 : r(a.value),
|
|
894
|
+
children: a.content
|
|
895
|
+
},
|
|
896
|
+
a.value
|
|
897
|
+
)) });
|
|
898
|
+
}
|
|
899
|
+
function cn({
|
|
900
|
+
options: e,
|
|
901
|
+
ariaLabel: t,
|
|
902
|
+
onToggle: i
|
|
903
|
+
}) {
|
|
904
|
+
return /* @__PURE__ */ n("div", { className: "pa-segmented", role: "group", "aria-label": t, children: e.map((r) => /* @__PURE__ */ n(
|
|
905
|
+
"button",
|
|
906
|
+
{
|
|
907
|
+
type: "button",
|
|
908
|
+
className: `pa-segmented-btn ${r.pressed ? "pa-segmented-btn--on" : ""}`,
|
|
909
|
+
title: r.title,
|
|
910
|
+
"aria-pressed": r.pressed,
|
|
911
|
+
"aria-label": r.title,
|
|
912
|
+
onClick: () => i(r.id),
|
|
913
|
+
children: r.content
|
|
914
|
+
},
|
|
915
|
+
r.id
|
|
916
|
+
)) });
|
|
917
|
+
}
|
|
918
|
+
function dn({ className: e }) {
|
|
919
|
+
return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
920
|
+
"path",
|
|
921
|
+
{
|
|
922
|
+
fill: "currentColor",
|
|
923
|
+
d: "M2 3h10v1.5H2V3zm0 3.5h7v1.5H2V6.5zm0 3.5h10v1.5H2V10zm0 3.5h7v1.5H2V13.5z"
|
|
924
|
+
}
|
|
925
|
+
) });
|
|
926
|
+
}
|
|
927
|
+
function un({ className: e }) {
|
|
928
|
+
return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
929
|
+
"path",
|
|
930
|
+
{
|
|
931
|
+
fill: "currentColor",
|
|
932
|
+
d: "M3 3h10v1.5H3V3zm1.5 3.5h7v1.5h-7V6.5zm-1.5 3.5h10v1.5H3V10zm1.5 3.5h7v1.5h-7V13.5z"
|
|
933
|
+
}
|
|
934
|
+
) });
|
|
935
|
+
}
|
|
936
|
+
function pn({ className: e }) {
|
|
937
|
+
return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
938
|
+
"path",
|
|
939
|
+
{
|
|
940
|
+
fill: "currentColor",
|
|
941
|
+
d: "M4 3h10v1.5H4V3zm3 3.5h7v1.5H7V6.5zm-3 3.5h10v1.5H4V10zm3 3.5h7v1.5H7V13.5z"
|
|
942
|
+
}
|
|
943
|
+
) });
|
|
944
|
+
}
|
|
945
|
+
function hn({ className: e }) {
|
|
946
|
+
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" }) });
|
|
947
|
+
}
|
|
948
|
+
function mn({ className: e }) {
|
|
949
|
+
return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
950
|
+
"path",
|
|
951
|
+
{
|
|
952
|
+
fill: "currentColor",
|
|
953
|
+
d: "M11.2 9.25H4.8c.35 1.05 1.2 1.75 2.45 1.75 1.05 0 1.85-.45 2.2-1.15l1.35.55C10.15 11.85 8.7 12.5 7.25 12.5 4.85 12.5 3 10.85 3 8.5h1.5c0 1.55 1.15 2.75 2.75 2.75.55 0 1.05-.15 1.45-.4L3 7.5h10l-1.8 1.75z"
|
|
954
|
+
}
|
|
955
|
+
) });
|
|
956
|
+
}
|
|
957
|
+
function mt(e) {
|
|
958
|
+
const t = parseInt(e.trim(), 10);
|
|
959
|
+
return Number.isFinite(t) ? t >= 600 : e.trim() === "bold" || e.trim() === "bolder";
|
|
960
|
+
}
|
|
961
|
+
function fn(e) {
|
|
962
|
+
return mt(e) ? "400" : "700";
|
|
963
|
+
}
|
|
964
|
+
function ft(e) {
|
|
965
|
+
return e.trim() === "italic" || e.trim() === "oblique";
|
|
966
|
+
}
|
|
967
|
+
function gn(e) {
|
|
968
|
+
return ft(e) ? "normal" : "italic";
|
|
969
|
+
}
|
|
970
|
+
function Ge(e, t) {
|
|
971
|
+
return e.split(/\s+/).includes(t);
|
|
972
|
+
}
|
|
973
|
+
function Ke(e, t) {
|
|
974
|
+
const i = new Set(
|
|
975
|
+
e.trim().split(/\s+/).filter((r) => r && r !== "none")
|
|
976
|
+
);
|
|
977
|
+
return i.has(t) ? i.delete(t) : i.add(t), i.size === 0 ? "none" : Array.from(i).join(" ");
|
|
978
|
+
}
|
|
979
|
+
function vn(e) {
|
|
980
|
+
const t = e.trim();
|
|
981
|
+
return t === "center" || t === "right" || t === "justify" ? t : "left";
|
|
982
|
+
}
|
|
983
|
+
const je = [
|
|
984
|
+
"none",
|
|
985
|
+
"solid",
|
|
986
|
+
"dashed",
|
|
987
|
+
"dotted",
|
|
988
|
+
"double",
|
|
989
|
+
"groove",
|
|
990
|
+
"ridge",
|
|
991
|
+
"inset",
|
|
992
|
+
"outset"
|
|
993
|
+
];
|
|
994
|
+
function bn({
|
|
995
|
+
values: e,
|
|
996
|
+
onPropertyChange: t,
|
|
997
|
+
textKind: i,
|
|
998
|
+
textValue: r,
|
|
999
|
+
onTextChange: a,
|
|
1000
|
+
targetScope: s,
|
|
1001
|
+
onTargetScopeChange: o,
|
|
1002
|
+
elementState: d,
|
|
1003
|
+
onElementStateChange: l,
|
|
1004
|
+
instanceCount: u,
|
|
1005
|
+
scopeHint: p,
|
|
1006
|
+
stateHint: m
|
|
1007
|
+
}) {
|
|
1008
|
+
var I, T;
|
|
1009
|
+
const w = e["font-weight"] ?? "", f = e["font-style"] ?? "normal", g = e["text-decoration"] ?? "none", v = vn(e["text-align"] ?? "left"), M = !!((I = e.gap) != null && I.trim()), y = !!((T = e.display) != null && T.trim()), b = e["border-style"] ?? "none", N = [...je];
|
|
1010
|
+
return b && !je.includes(b) && N.push(b), /* @__PURE__ */ c("div", { className: "pa-edit-sections", children: [
|
|
1011
|
+
/* @__PURE__ */ c(ne, { title: "Targeting", defaultOpen: !0, children: [
|
|
1012
|
+
/* @__PURE__ */ c("div", { className: "pa-edit-field-grid pa-edit-field-grid--2", children: [
|
|
1013
|
+
/* @__PURE__ */ c("label", { className: "pa-edit-mini-field", children: [
|
|
1014
|
+
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Scope" }),
|
|
1015
|
+
/* @__PURE__ */ c(
|
|
1016
|
+
"select",
|
|
1017
|
+
{
|
|
1018
|
+
className: "pa-select",
|
|
1019
|
+
value: s,
|
|
1020
|
+
onChange: (h) => o(h.target.value),
|
|
1021
|
+
children: [
|
|
1022
|
+
/* @__PURE__ */ n("option", { value: "this-instance", children: "This instance" }),
|
|
1023
|
+
/* @__PURE__ */ c("option", { value: "all-instances", disabled: u <= 1, children: [
|
|
1024
|
+
"All (",
|
|
1025
|
+
u,
|
|
1026
|
+
")"
|
|
1027
|
+
] })
|
|
1028
|
+
]
|
|
1029
|
+
}
|
|
1030
|
+
)
|
|
1031
|
+
] }),
|
|
1032
|
+
/* @__PURE__ */ c("label", { className: "pa-edit-mini-field", children: [
|
|
1033
|
+
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "State" }),
|
|
1034
|
+
/* @__PURE__ */ c(
|
|
1035
|
+
"select",
|
|
1036
|
+
{
|
|
1037
|
+
className: "pa-select",
|
|
1038
|
+
value: d,
|
|
1039
|
+
onChange: (h) => l(h.target.value),
|
|
1040
|
+
children: [
|
|
1041
|
+
/* @__PURE__ */ n("option", { value: "normal", children: "Normal" }),
|
|
1042
|
+
/* @__PURE__ */ n("option", { value: "hover", children: "Hover" }),
|
|
1043
|
+
/* @__PURE__ */ n("option", { value: "focus", children: "Focus" }),
|
|
1044
|
+
/* @__PURE__ */ n("option", { value: "active", children: "Active" }),
|
|
1045
|
+
/* @__PURE__ */ n("option", { value: "disabled", children: "Disabled" })
|
|
1046
|
+
]
|
|
1047
|
+
}
|
|
1048
|
+
)
|
|
1049
|
+
] })
|
|
1050
|
+
] }),
|
|
1051
|
+
p ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: p }) : null,
|
|
1052
|
+
m ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: m }) : null
|
|
1053
|
+
] }),
|
|
1054
|
+
i !== "none" && /* @__PURE__ */ n(ne, { title: "Content", defaultOpen: !0, children: /* @__PURE__ */ c("label", { className: "pa-edit-stack-field", children: [
|
|
1055
|
+
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Text" }),
|
|
1056
|
+
/* @__PURE__ */ n(
|
|
1057
|
+
"textarea",
|
|
1058
|
+
{
|
|
1059
|
+
className: "pa-textarea pa-edit-text-input",
|
|
1060
|
+
value: r,
|
|
1061
|
+
onChange: (h) => a(h.target.value),
|
|
1062
|
+
rows: i === "value" ? 2 : 3,
|
|
1063
|
+
placeholder: "Edit visible text…"
|
|
1064
|
+
}
|
|
1065
|
+
)
|
|
1066
|
+
] }) }),
|
|
1067
|
+
/* @__PURE__ */ c(ne, { title: "Typography", defaultOpen: !0, children: [
|
|
1068
|
+
/* @__PURE__ */ n(
|
|
1069
|
+
tn,
|
|
1070
|
+
{
|
|
1071
|
+
value: e["font-family"] ?? "",
|
|
1072
|
+
onChange: (h) => t("font-family", h)
|
|
1073
|
+
}
|
|
1074
|
+
),
|
|
1075
|
+
/* @__PURE__ */ c("div", { className: "pa-edit-field-block", children: [
|
|
1076
|
+
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Style" }),
|
|
1077
|
+
/* @__PURE__ */ n(
|
|
1078
|
+
cn,
|
|
1079
|
+
{
|
|
1080
|
+
ariaLabel: "Text style",
|
|
1081
|
+
options: [
|
|
1082
|
+
{
|
|
1083
|
+
id: "bold",
|
|
1084
|
+
title: "Bold",
|
|
1085
|
+
pressed: mt(w),
|
|
1086
|
+
content: /* @__PURE__ */ n("span", { className: "pa-segmented-type pa-segmented-type--bold", children: "B" })
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
id: "italic",
|
|
1090
|
+
title: "Italic",
|
|
1091
|
+
pressed: ft(f),
|
|
1092
|
+
content: /* @__PURE__ */ n("span", { className: "pa-segmented-type pa-segmented-type--italic", children: "I" })
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
id: "underline",
|
|
1096
|
+
title: "Underline",
|
|
1097
|
+
pressed: Ge(g, "underline"),
|
|
1098
|
+
content: /* @__PURE__ */ n("span", { className: "pa-segmented-type pa-segmented-type--underline", children: "U" })
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
id: "strikethrough",
|
|
1102
|
+
title: "Strikethrough",
|
|
1103
|
+
pressed: Ge(g, "line-through"),
|
|
1104
|
+
content: /* @__PURE__ */ n(mn, { className: "pa-segmented-icon" })
|
|
1105
|
+
}
|
|
1106
|
+
],
|
|
1107
|
+
onToggle: (h) => {
|
|
1108
|
+
h === "bold" ? t("font-weight", fn(w)) : h === "italic" ? t("font-style", gn(f)) : h === "underline" ? t(
|
|
1109
|
+
"text-decoration",
|
|
1110
|
+
Ke(g, "underline")
|
|
1111
|
+
) : h === "strikethrough" && t(
|
|
1112
|
+
"text-decoration",
|
|
1113
|
+
Ke(g, "line-through")
|
|
1114
|
+
);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
)
|
|
1118
|
+
] }),
|
|
1119
|
+
/* @__PURE__ */ c("div", { className: "pa-edit-field-block", children: [
|
|
1120
|
+
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Align" }),
|
|
1121
|
+
/* @__PURE__ */ n(
|
|
1122
|
+
ln,
|
|
1123
|
+
{
|
|
1124
|
+
ariaLabel: "Text align",
|
|
1125
|
+
value: v,
|
|
1126
|
+
onChange: (h) => t("text-align", h),
|
|
1127
|
+
options: [
|
|
1128
|
+
{
|
|
1129
|
+
value: "left",
|
|
1130
|
+
title: "Align left",
|
|
1131
|
+
content: /* @__PURE__ */ n(dn, { className: "pa-segmented-icon" })
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
value: "center",
|
|
1135
|
+
title: "Align center",
|
|
1136
|
+
content: /* @__PURE__ */ n(un, { className: "pa-segmented-icon" })
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
value: "right",
|
|
1140
|
+
title: "Align right",
|
|
1141
|
+
content: /* @__PURE__ */ n(pn, { className: "pa-segmented-icon" })
|
|
1142
|
+
},
|
|
1143
|
+
{
|
|
1144
|
+
value: "justify",
|
|
1145
|
+
title: "Justify",
|
|
1146
|
+
content: /* @__PURE__ */ n(hn, { className: "pa-segmented-icon" })
|
|
1147
|
+
}
|
|
1148
|
+
]
|
|
1149
|
+
}
|
|
1150
|
+
)
|
|
1151
|
+
] }),
|
|
1152
|
+
/* @__PURE__ */ c("div", { className: "pa-edit-field-grid pa-edit-field-grid--2 pa-edit-size-row", children: [
|
|
1153
|
+
/* @__PURE__ */ n(
|
|
1154
|
+
q,
|
|
1155
|
+
{
|
|
1156
|
+
compact: !0,
|
|
1157
|
+
property: "font-size",
|
|
1158
|
+
label: "Font size (px)",
|
|
1159
|
+
value: e["font-size"] ?? "",
|
|
1160
|
+
onChange: (h) => t("font-size", h)
|
|
1161
|
+
}
|
|
1162
|
+
),
|
|
1163
|
+
/* @__PURE__ */ n(
|
|
1164
|
+
q,
|
|
1165
|
+
{
|
|
1166
|
+
compact: !0,
|
|
1167
|
+
property: "line-height",
|
|
1168
|
+
label: "Line height (px)",
|
|
1169
|
+
value: e["line-height"] ?? "",
|
|
1170
|
+
onChange: (h) => t("line-height", h)
|
|
1171
|
+
}
|
|
1172
|
+
)
|
|
1173
|
+
] }),
|
|
1174
|
+
/* @__PURE__ */ n(
|
|
1175
|
+
Ae,
|
|
1176
|
+
{
|
|
1177
|
+
label: "Color",
|
|
1178
|
+
value: e.color ?? "",
|
|
1179
|
+
onChange: (h) => t("color", h)
|
|
1180
|
+
}
|
|
1181
|
+
)
|
|
1182
|
+
] }),
|
|
1183
|
+
/* @__PURE__ */ c(ne, { title: "Layout", defaultOpen: !0, children: [
|
|
1184
|
+
/* @__PURE__ */ c("div", { className: "pa-edit-split-fields", children: [
|
|
1185
|
+
/* @__PURE__ */ n(
|
|
1186
|
+
q,
|
|
1187
|
+
{
|
|
1188
|
+
compact: !0,
|
|
1189
|
+
property: "width",
|
|
1190
|
+
label: "Width",
|
|
1191
|
+
value: e.width ?? "",
|
|
1192
|
+
onChange: (h) => t("width", h)
|
|
1193
|
+
}
|
|
1194
|
+
),
|
|
1195
|
+
/* @__PURE__ */ n(
|
|
1196
|
+
q,
|
|
1197
|
+
{
|
|
1198
|
+
compact: !0,
|
|
1199
|
+
property: "height",
|
|
1200
|
+
label: "Height",
|
|
1201
|
+
value: e.height ?? "",
|
|
1202
|
+
onChange: (h) => t("height", h)
|
|
1203
|
+
}
|
|
1204
|
+
)
|
|
1205
|
+
] }),
|
|
1206
|
+
/* @__PURE__ */ n(
|
|
1207
|
+
q,
|
|
1208
|
+
{
|
|
1209
|
+
compact: !0,
|
|
1210
|
+
property: "padding",
|
|
1211
|
+
label: "Padding",
|
|
1212
|
+
value: e.padding ?? "",
|
|
1213
|
+
onChange: (h) => t("padding", h)
|
|
1214
|
+
}
|
|
1215
|
+
),
|
|
1216
|
+
/* @__PURE__ */ n(
|
|
1217
|
+
q,
|
|
1218
|
+
{
|
|
1219
|
+
compact: !0,
|
|
1220
|
+
property: "margin",
|
|
1221
|
+
label: "Margin",
|
|
1222
|
+
value: e.margin ?? "",
|
|
1223
|
+
onChange: (h) => t("margin", h)
|
|
1224
|
+
}
|
|
1225
|
+
),
|
|
1226
|
+
M && /* @__PURE__ */ n(
|
|
1227
|
+
q,
|
|
1228
|
+
{
|
|
1229
|
+
compact: !0,
|
|
1230
|
+
property: "gap",
|
|
1231
|
+
label: "Gap",
|
|
1232
|
+
value: e.gap ?? "",
|
|
1233
|
+
onChange: (h) => t("gap", h)
|
|
1234
|
+
}
|
|
1235
|
+
),
|
|
1236
|
+
y && /* @__PURE__ */ c("label", { className: "pa-edit-stack-field", children: [
|
|
1237
|
+
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Display" }),
|
|
1238
|
+
/* @__PURE__ */ n(
|
|
1239
|
+
"input",
|
|
1240
|
+
{
|
|
1241
|
+
className: "pa-input",
|
|
1242
|
+
type: "text",
|
|
1243
|
+
value: e.display ?? "",
|
|
1244
|
+
onChange: (h) => t("display", h.target.value),
|
|
1245
|
+
spellCheck: !1
|
|
1246
|
+
}
|
|
1247
|
+
)
|
|
1248
|
+
] })
|
|
1249
|
+
] }),
|
|
1250
|
+
/* @__PURE__ */ c(ne, { title: "Fill", children: [
|
|
1251
|
+
/* @__PURE__ */ n(
|
|
1252
|
+
Ae,
|
|
1253
|
+
{
|
|
1254
|
+
label: "Background",
|
|
1255
|
+
value: e["background-color"] ?? "",
|
|
1256
|
+
onChange: (h) => t("background-color", h)
|
|
1257
|
+
}
|
|
1258
|
+
),
|
|
1259
|
+
/* @__PURE__ */ n(
|
|
1260
|
+
q,
|
|
1261
|
+
{
|
|
1262
|
+
compact: !0,
|
|
1263
|
+
property: "opacity",
|
|
1264
|
+
label: "Opacity",
|
|
1265
|
+
value: e.opacity ?? "",
|
|
1266
|
+
onChange: (h) => t("opacity", h)
|
|
1267
|
+
}
|
|
1268
|
+
)
|
|
1269
|
+
] }),
|
|
1270
|
+
/* @__PURE__ */ c(ne, { title: "Border", defaultOpen: !0, children: [
|
|
1271
|
+
/* @__PURE__ */ n(
|
|
1272
|
+
Ae,
|
|
1273
|
+
{
|
|
1274
|
+
label: "Border color",
|
|
1275
|
+
value: e["border-color"] ?? "",
|
|
1276
|
+
onChange: (h) => t("border-color", h)
|
|
1277
|
+
}
|
|
1278
|
+
),
|
|
1279
|
+
/* @__PURE__ */ c("label", { className: "pa-edit-stack-field", children: [
|
|
1280
|
+
/* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Style" }),
|
|
1281
|
+
/* @__PURE__ */ n(
|
|
1282
|
+
"select",
|
|
1283
|
+
{
|
|
1284
|
+
className: "pa-select",
|
|
1285
|
+
value: b,
|
|
1286
|
+
onChange: (h) => t("border-style", h.target.value),
|
|
1287
|
+
children: N.map((h) => /* @__PURE__ */ n("option", { value: h, children: h }, h))
|
|
1288
|
+
}
|
|
1289
|
+
)
|
|
1290
|
+
] }),
|
|
1291
|
+
/* @__PURE__ */ n(
|
|
1292
|
+
q,
|
|
1293
|
+
{
|
|
1294
|
+
compact: !0,
|
|
1295
|
+
property: "border-width",
|
|
1296
|
+
label: "Stroke width (px)",
|
|
1297
|
+
value: e["border-width"] ?? "",
|
|
1298
|
+
onChange: (h) => t("border-width", h)
|
|
1299
|
+
}
|
|
1300
|
+
),
|
|
1301
|
+
/* @__PURE__ */ n(
|
|
1302
|
+
q,
|
|
1303
|
+
{
|
|
1304
|
+
compact: !0,
|
|
1305
|
+
property: "border-radius",
|
|
1306
|
+
label: "Radius (px)",
|
|
1307
|
+
value: e["border-radius"] ?? "",
|
|
1308
|
+
onChange: (h) => t("border-radius", h)
|
|
1309
|
+
}
|
|
1310
|
+
)
|
|
1311
|
+
] })
|
|
1312
|
+
] });
|
|
1313
|
+
}
|
|
1314
|
+
const wn = 50, qe = [
|
|
1315
|
+
"font-family",
|
|
1316
|
+
"font-size",
|
|
1317
|
+
"font-weight",
|
|
1318
|
+
"font-style",
|
|
1319
|
+
"line-height",
|
|
1320
|
+
"text-align",
|
|
1321
|
+
"text-decoration",
|
|
1322
|
+
"color",
|
|
1323
|
+
"background-color",
|
|
1324
|
+
"padding",
|
|
1325
|
+
"margin",
|
|
1326
|
+
"width",
|
|
1327
|
+
"height",
|
|
1328
|
+
"gap",
|
|
1329
|
+
"display",
|
|
1330
|
+
"border-width",
|
|
1331
|
+
"border-style",
|
|
1332
|
+
"border-color",
|
|
1333
|
+
"border-radius",
|
|
1334
|
+
"opacity"
|
|
1335
|
+
];
|
|
1336
|
+
function yn(e, t, i) {
|
|
1337
|
+
const r = V([]), a = V(/* @__PURE__ */ new Set()), s = V([]), o = V(null), d = V([]), [l, u] = A({}), [p, m] = A({}), [w, f] = A("none"), [g, v] = A(""), [M, y] = A(""), [b, N] = A([]), [I, T] = A(!1), h = E(() => {
|
|
1338
|
+
const C = Array.from(a.current);
|
|
1339
|
+
return {
|
|
1340
|
+
inline: Ue(C, [...qe]),
|
|
1341
|
+
text: e && w !== "none" ? ze(e, w) : null
|
|
1342
|
+
};
|
|
1343
|
+
}, [e, w]), k = E(() => {
|
|
1344
|
+
d.current.push(h()), d.current.length > wn && d.current.shift(), T(d.current.length > 0);
|
|
1345
|
+
}, [h]), R = E(
|
|
1346
|
+
(C) => {
|
|
1347
|
+
if (!e) return;
|
|
1348
|
+
const D = Array.from(a.current);
|
|
1349
|
+
ce(s.current.filter((H) => D.includes(H.element))), o.current && de(o.current);
|
|
1350
|
+
const O = ge(e, t);
|
|
1351
|
+
if (r.current = O, a.current = new Set(O), ue(D), Me(O, i), C && b.length > 0)
|
|
1352
|
+
for (const H of b)
|
|
1353
|
+
if (H.property === "textContent" || H.property === "value")
|
|
1354
|
+
for (const W of O)
|
|
1355
|
+
Ve(W, H.property, H.newValue);
|
|
1356
|
+
else
|
|
1357
|
+
for (const W of O)
|
|
1358
|
+
W.style.setProperty(H.property, H.newValue);
|
|
1359
|
+
},
|
|
1360
|
+
[e, t, i, b]
|
|
1361
|
+
);
|
|
1362
|
+
z(() => {
|
|
1363
|
+
if (!e) {
|
|
1364
|
+
r.current = [], a.current = /* @__PURE__ */ new Set(), s.current = [], o.current = null, d.current = [], u({}), m({}), f("none"), v(""), y(""), N([]), T(!1);
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
const C = ge(e, t);
|
|
1368
|
+
r.current = C, a.current = new Set(C), s.current = Ue(C, [...qe]), d.current = [], T(!1);
|
|
1369
|
+
const D = pe(e);
|
|
1370
|
+
u(D), m(D);
|
|
1371
|
+
const O = ie(e);
|
|
1372
|
+
return f(O.kind), v(O.value), y(O.value), o.current = O.kind !== "none" ? ze(e, O.kind) : null, N([]), Me(C, i), () => ue(C);
|
|
1373
|
+
}, [e]), z(() => {
|
|
1374
|
+
e && R(!0);
|
|
1375
|
+
}, [t]), z(() => {
|
|
1376
|
+
if (!e) return;
|
|
1377
|
+
const C = ge(e, t);
|
|
1378
|
+
r.current = C, ue(Array.from(a.current)), Me(C, i), a.current = new Set(C);
|
|
1379
|
+
}, [i, e, t]);
|
|
1380
|
+
const S = E((C, D, O) => {
|
|
1381
|
+
N((H) => {
|
|
1382
|
+
const W = H.filter((U) => U.property !== C);
|
|
1383
|
+
return O === D ? W : [...W, { property: C, oldValue: D, newValue: O }];
|
|
1384
|
+
});
|
|
1385
|
+
}, []), P = E(
|
|
1386
|
+
(C, D) => {
|
|
1387
|
+
if (!e) return;
|
|
1388
|
+
const O = { [C]: D };
|
|
1389
|
+
C === "border-width" && (l["border-style"] ?? "none") === "none" && rn(D) && (O["border-style"] = "solid"), k(), u((H) => ({ ...H, ...O }));
|
|
1390
|
+
for (const [H, W] of Object.entries(O)) {
|
|
1391
|
+
const U = p[H] ?? "";
|
|
1392
|
+
for (const Q of r.current)
|
|
1393
|
+
Q.style.setProperty(H, W), a.current.add(Q);
|
|
1394
|
+
S(H, U, W);
|
|
1395
|
+
}
|
|
1396
|
+
},
|
|
1397
|
+
[e, p, l, k, S]
|
|
1398
|
+
), F = E(
|
|
1399
|
+
(C) => {
|
|
1400
|
+
if (!(!e || w === "none")) {
|
|
1401
|
+
k(), v(C);
|
|
1402
|
+
for (const D of r.current)
|
|
1403
|
+
Ve(D, w, C), a.current.add(D);
|
|
1404
|
+
S(w, M, C);
|
|
1405
|
+
}
|
|
1406
|
+
},
|
|
1407
|
+
[e, w, M, k, S]
|
|
1408
|
+
), _ = E(() => {
|
|
1409
|
+
const C = d.current.pop();
|
|
1410
|
+
if (C && (ce(C.inline), C.text && de(C.text), T(d.current.length > 0), e)) {
|
|
1411
|
+
u(pe(e));
|
|
1412
|
+
const D = ie(e);
|
|
1413
|
+
D.kind !== "none" && v(D.value);
|
|
1414
|
+
}
|
|
1415
|
+
}, [e]), K = E(() => {
|
|
1416
|
+
if (ce(s.current), o.current && de(o.current), d.current = [], T(!1), N([]), e) {
|
|
1417
|
+
u(pe(e));
|
|
1418
|
+
const C = ie(e);
|
|
1419
|
+
v(C.value);
|
|
1420
|
+
}
|
|
1421
|
+
}, [e]), $ = E(() => {
|
|
1422
|
+
ce(s.current), o.current && de(o.current);
|
|
1423
|
+
}, []), j = E(() => {
|
|
1424
|
+
if ($(), ue(Array.from(a.current)), d.current = [], T(!1), N([]), e) {
|
|
1425
|
+
u(pe(e));
|
|
1426
|
+
const C = ie(e);
|
|
1427
|
+
C.kind !== "none" && v(C.value);
|
|
1428
|
+
}
|
|
1429
|
+
}, [$, e]);
|
|
1430
|
+
return {
|
|
1431
|
+
values: l,
|
|
1432
|
+
textKind: w,
|
|
1433
|
+
textValue: g,
|
|
1434
|
+
pendingChanges: b,
|
|
1435
|
+
canUndo: I,
|
|
1436
|
+
updateProperty: P,
|
|
1437
|
+
updateText: F,
|
|
1438
|
+
undo: _,
|
|
1439
|
+
reset: K,
|
|
1440
|
+
clearPreviews: j,
|
|
1441
|
+
revertPreviews: $
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
function xn({
|
|
1445
|
+
selectedElement: e,
|
|
1446
|
+
hoveredElement: t,
|
|
1447
|
+
onSelectElement: i,
|
|
1448
|
+
onHoverElement: r,
|
|
1449
|
+
targetScope: a,
|
|
1450
|
+
onTargetScopeChange: s,
|
|
1451
|
+
elementState: o,
|
|
1452
|
+
onElementStateChange: d,
|
|
1453
|
+
onApply: l,
|
|
1454
|
+
applyStatus: u,
|
|
1455
|
+
isToolbarTarget: p,
|
|
1456
|
+
onPreviewApi: m
|
|
1457
|
+
}) {
|
|
1458
|
+
const {
|
|
1459
|
+
values: w,
|
|
1460
|
+
textKind: f,
|
|
1461
|
+
textValue: g,
|
|
1462
|
+
pendingChanges: v,
|
|
1463
|
+
canUndo: M,
|
|
1464
|
+
updateProperty: y,
|
|
1465
|
+
updateText: b,
|
|
1466
|
+
undo: N,
|
|
1467
|
+
reset: I,
|
|
1468
|
+
clearPreviews: T,
|
|
1469
|
+
revertPreviews: h
|
|
1470
|
+
} = yn(e, a, o), { elementRef: k, isDragging: R, style: S, dragHandleProps: P } = ct({
|
|
1471
|
+
computeDefaultPosition: (U) => ({
|
|
1472
|
+
x: window.innerWidth - U.width - 16,
|
|
1473
|
+
y: 16
|
|
1474
|
+
})
|
|
1475
|
+
});
|
|
1476
|
+
z(() => (m == null || m({ clearPreviews: T, revertPreviews: h }), () => m == null ? void 0 : m(null)), [m, T, h]);
|
|
1477
|
+
const F = E(
|
|
1478
|
+
(U) => {
|
|
1479
|
+
if (p(U.target)) return;
|
|
1480
|
+
const oe = document.elementsFromPoint(U.clientX, U.clientY).find(
|
|
1481
|
+
(J) => J instanceof Element && !J.closest(
|
|
1482
|
+
"[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
|
|
1483
|
+
)
|
|
1484
|
+
);
|
|
1485
|
+
r(oe ?? null);
|
|
1486
|
+
},
|
|
1487
|
+
[p, r]
|
|
1488
|
+
), _ = E(
|
|
1489
|
+
(U) => {
|
|
1490
|
+
if (p(U.target)) return;
|
|
1491
|
+
U.preventDefault(), U.stopPropagation();
|
|
1492
|
+
const oe = document.elementsFromPoint(U.clientX, U.clientY).find(
|
|
1493
|
+
(J) => J instanceof Element && !J.closest(
|
|
1494
|
+
"[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
|
|
1495
|
+
)
|
|
1496
|
+
);
|
|
1497
|
+
i(oe ?? null);
|
|
1498
|
+
},
|
|
1499
|
+
[p, i]
|
|
1500
|
+
);
|
|
1501
|
+
z(() => (document.addEventListener("mousemove", F, !0), document.addEventListener("click", _, !0), () => {
|
|
1502
|
+
document.removeEventListener("mousemove", F, !0), document.removeEventListener("click", _, !0);
|
|
1503
|
+
}), [F, _]);
|
|
1504
|
+
const K = () => {
|
|
1505
|
+
v.length !== 0 && l(v);
|
|
1506
|
+
}, $ = e ? Re(e) : null, j = e ? et(e) : null, C = e ? tt(e) : 0, D = e ? nt(e, "all-instances") : "", O = o !== "normal" && j === "tailwind" ? "Tailwind variant preview: matching hover:/focus:/… classes are applied without the prefix." : o !== "normal" ? "State preview uses focus/disabled simulation where possible." : null, H = C > 1 ? a === "all-instances" ? `Preview & Apply on ${C} elements (${D}).` : `This instance only — ${C - 1} other on page.` : a === "all-instances" ? "Only one match — scope has no effect." : null, W = le(() => !e || a !== "all-instances" ? [] : ge(e, "all-instances"), [e, a]);
|
|
1507
|
+
return /* @__PURE__ */ c(X, { children: [
|
|
1508
|
+
/* @__PURE__ */ n(
|
|
1509
|
+
ot,
|
|
1510
|
+
{
|
|
1511
|
+
element: a === "all-instances" ? null : t,
|
|
1512
|
+
selected: e,
|
|
1513
|
+
multiSelected: W,
|
|
1514
|
+
primarySelected: e
|
|
1515
|
+
}
|
|
1516
|
+
),
|
|
1517
|
+
/* @__PURE__ */ n(
|
|
1518
|
+
"div",
|
|
1519
|
+
{
|
|
1520
|
+
ref: k,
|
|
1521
|
+
className: `pa-edit-panel-float ${R ? "pa-edit-panel-float--dragging" : ""}`,
|
|
1522
|
+
style: S,
|
|
1523
|
+
children: /* @__PURE__ */ n(be, { variant: "sheet", side: "right", className: "pa-edit-panel-glass", children: /* @__PURE__ */ c("div", { className: "pa-edit-panel-inner", children: [
|
|
1524
|
+
/* @__PURE__ */ c("div", { className: "pa-edit-panel-header", children: [
|
|
1525
|
+
/* @__PURE__ */ n(
|
|
1526
|
+
"button",
|
|
1527
|
+
{
|
|
1528
|
+
type: "button",
|
|
1529
|
+
className: "pa-edit-panel-drag",
|
|
1530
|
+
"aria-label": "Drag edit panel",
|
|
1531
|
+
title: "Drag to move",
|
|
1532
|
+
...P,
|
|
1533
|
+
children: /* @__PURE__ */ c("span", { className: "pa-edit-panel-grip", "aria-hidden": "true", children: [
|
|
1534
|
+
/* @__PURE__ */ n("span", {}),
|
|
1535
|
+
/* @__PURE__ */ n("span", {}),
|
|
1536
|
+
/* @__PURE__ */ n("span", {}),
|
|
1537
|
+
/* @__PURE__ */ n("span", {}),
|
|
1538
|
+
/* @__PURE__ */ n("span", {}),
|
|
1539
|
+
/* @__PURE__ */ n("span", {})
|
|
1540
|
+
] })
|
|
1541
|
+
}
|
|
1542
|
+
),
|
|
1543
|
+
/* @__PURE__ */ n("h3", { className: "pa-edit-title", children: "Edit" })
|
|
1544
|
+
] }),
|
|
1545
|
+
e ? /* @__PURE__ */ c(X, { children: [
|
|
1546
|
+
/* @__PURE__ */ c("div", { className: "pa-edit-meta", children: [
|
|
1547
|
+
/* @__PURE__ */ n(
|
|
1548
|
+
"code",
|
|
1549
|
+
{
|
|
1550
|
+
className: "pa-edit-meta-label",
|
|
1551
|
+
title: `This instance: ${rt(e)}
|
|
1552
|
+
All instances: ${D}`,
|
|
1553
|
+
children: Te(e)
|
|
1554
|
+
}
|
|
1555
|
+
),
|
|
1556
|
+
(($ == null ? void 0 : $.sourceFile) || j) && /* @__PURE__ */ c("span", { className: "pa-edit-source", children: [
|
|
1557
|
+
($ == null ? void 0 : $.sourceFile) && /* @__PURE__ */ c(X, { children: [
|
|
1558
|
+
$.sourceFile,
|
|
1559
|
+
$.lineNumber ? `:${$.lineNumber}` : ""
|
|
1560
|
+
] }),
|
|
1561
|
+
$ != null && $.sourceFile && j ? " · " : "",
|
|
1562
|
+
j ?? ""
|
|
1563
|
+
] })
|
|
1564
|
+
] }),
|
|
1565
|
+
/* @__PURE__ */ n("div", { className: "pa-edit-panel-scroll", children: /* @__PURE__ */ n(
|
|
1566
|
+
bn,
|
|
1567
|
+
{
|
|
1568
|
+
values: w,
|
|
1569
|
+
onPropertyChange: y,
|
|
1570
|
+
textKind: f,
|
|
1571
|
+
textValue: g,
|
|
1572
|
+
onTextChange: b,
|
|
1573
|
+
targetScope: a,
|
|
1574
|
+
onTargetScopeChange: s,
|
|
1575
|
+
elementState: o,
|
|
1576
|
+
onElementStateChange: d,
|
|
1577
|
+
instanceCount: C,
|
|
1578
|
+
scopeHint: H,
|
|
1579
|
+
stateHint: O
|
|
1580
|
+
}
|
|
1581
|
+
) }),
|
|
1582
|
+
/* @__PURE__ */ c("div", { className: "pa-edit-panel-sticky", children: [
|
|
1583
|
+
/* @__PURE__ */ c("div", { className: "pa-edit-actions", children: [
|
|
1584
|
+
/* @__PURE__ */ n(B, { variant: "regular", onClick: N, disabled: !M, children: /* @__PURE__ */ c("span", { className: "pa-glass-btn-inner", children: [
|
|
1585
|
+
/* @__PURE__ */ n(Xt, { className: "pa-glass-btn-icon" }),
|
|
1586
|
+
/* @__PURE__ */ n("span", { children: "Undo" })
|
|
1587
|
+
] }) }),
|
|
1588
|
+
/* @__PURE__ */ n(
|
|
1589
|
+
B,
|
|
1590
|
+
{
|
|
1591
|
+
variant: "regular",
|
|
1592
|
+
onClick: I,
|
|
1593
|
+
disabled: v.length === 0,
|
|
1594
|
+
children: /* @__PURE__ */ c("span", { className: "pa-glass-btn-inner", children: [
|
|
1595
|
+
/* @__PURE__ */ n(Yt, { className: "pa-glass-btn-icon" }),
|
|
1596
|
+
/* @__PURE__ */ n("span", { children: "Reset" })
|
|
1597
|
+
] })
|
|
1598
|
+
}
|
|
1599
|
+
)
|
|
1600
|
+
] }),
|
|
1601
|
+
/* @__PURE__ */ c("div", { className: "pa-edit-footer", children: [
|
|
1602
|
+
/* @__PURE__ */ n("span", { className: "pa-change-count", children: u ?? `${v.length} pending change${v.length !== 1 ? "s" : ""}` }),
|
|
1603
|
+
/* @__PURE__ */ n(
|
|
1604
|
+
B,
|
|
1605
|
+
{
|
|
1606
|
+
variant: "glass-primary",
|
|
1607
|
+
onClick: K,
|
|
1608
|
+
disabled: v.length === 0 || !($ != null && $.sourceFile),
|
|
1609
|
+
children: "Apply"
|
|
1610
|
+
}
|
|
1611
|
+
)
|
|
1612
|
+
] })
|
|
1613
|
+
] })
|
|
1614
|
+
] }) : /* @__PURE__ */ n("p", { className: "pa-edit-hint", children: "Click an element to edit its text and styles." })
|
|
1615
|
+
] }) })
|
|
1616
|
+
}
|
|
1617
|
+
)
|
|
1618
|
+
] });
|
|
1619
|
+
}
|
|
1620
|
+
function Nn(e) {
|
|
1621
|
+
const [t, i] = A(null);
|
|
1622
|
+
return z(() => {
|
|
1623
|
+
if (!e) {
|
|
1624
|
+
i(null);
|
|
1625
|
+
return;
|
|
1626
|
+
}
|
|
1627
|
+
const r = () => i(e.getBoundingClientRect());
|
|
1628
|
+
r();
|
|
1629
|
+
const a = new ResizeObserver(r);
|
|
1630
|
+
return a.observe(e), window.addEventListener("scroll", r, !0), window.addEventListener("resize", r), () => {
|
|
1631
|
+
a.disconnect(), window.removeEventListener("scroll", r, !0), window.removeEventListener("resize", r);
|
|
1632
|
+
};
|
|
1633
|
+
}, [e]), t;
|
|
1634
|
+
}
|
|
1635
|
+
const Z = 8, G = 8, kn = 12, Cn = 300, Mn = 280;
|
|
1636
|
+
function Se(e, t, i, r) {
|
|
1637
|
+
return {
|
|
1638
|
+
top: e,
|
|
1639
|
+
left: t,
|
|
1640
|
+
right: t + i,
|
|
1641
|
+
bottom: e + r,
|
|
1642
|
+
width: i,
|
|
1643
|
+
height: r
|
|
1644
|
+
};
|
|
1645
|
+
}
|
|
1646
|
+
function Ie(e, t) {
|
|
1647
|
+
return e.left < t.right && e.right > t.left && e.top < t.bottom && e.bottom > t.top;
|
|
1648
|
+
}
|
|
1649
|
+
function An(e, t) {
|
|
1650
|
+
return {
|
|
1651
|
+
top: e.top - t,
|
|
1652
|
+
left: e.left - t,
|
|
1653
|
+
right: e.right + t,
|
|
1654
|
+
bottom: e.bottom + t,
|
|
1655
|
+
width: e.width + t * 2,
|
|
1656
|
+
height: e.height + t * 2
|
|
1657
|
+
};
|
|
1658
|
+
}
|
|
1659
|
+
function Sn() {
|
|
1660
|
+
if (typeof document > "u") return null;
|
|
1661
|
+
const e = document.querySelector(
|
|
1662
|
+
"[data-pixelagent-toolbar-portal] .pa-toolbar-float"
|
|
1663
|
+
);
|
|
1664
|
+
return e ? An(e.getBoundingClientRect(), kn) : null;
|
|
1665
|
+
}
|
|
1666
|
+
function Le(e, t) {
|
|
1667
|
+
return Math.min(
|
|
1668
|
+
Math.max(Z, e),
|
|
1669
|
+
window.innerWidth - t - Z
|
|
1670
|
+
);
|
|
1671
|
+
}
|
|
1672
|
+
function me(e, t) {
|
|
1673
|
+
return Math.min(
|
|
1674
|
+
Math.max(Z, e),
|
|
1675
|
+
window.innerHeight - t - Z
|
|
1676
|
+
);
|
|
1677
|
+
}
|
|
1678
|
+
function Ln(e) {
|
|
1679
|
+
return e.top >= Z && e.left >= Z && e.right <= window.innerWidth - Z && e.bottom <= window.innerHeight - Z;
|
|
1680
|
+
}
|
|
1681
|
+
function En(e, t) {
|
|
1682
|
+
return t && Ie(e, t) ? !1 : Ln(e);
|
|
1683
|
+
}
|
|
1684
|
+
function In(e, t = Cn, i = Mn) {
|
|
1685
|
+
const r = Sn(), s = e.top > window.innerHeight * 0.45 ? [
|
|
1686
|
+
{ placement: "above", top: e.top - i - G, left: e.left },
|
|
1687
|
+
{ placement: "below", top: e.bottom + G, left: e.left },
|
|
1688
|
+
{ placement: "right", top: e.top, left: e.right + G },
|
|
1689
|
+
{ placement: "left", top: e.top, left: e.left - t - G }
|
|
1690
|
+
] : [
|
|
1691
|
+
{ placement: "below", top: e.bottom + G, left: e.left },
|
|
1692
|
+
{ placement: "above", top: e.top - i - G, left: e.left },
|
|
1693
|
+
{ placement: "right", top: e.top, left: e.right + G },
|
|
1694
|
+
{ placement: "left", top: e.top, left: e.left - t - G }
|
|
1695
|
+
];
|
|
1696
|
+
for (const { top: l, left: u } of s) {
|
|
1697
|
+
const p = Se(
|
|
1698
|
+
me(l, i),
|
|
1699
|
+
Le(u, t),
|
|
1700
|
+
t,
|
|
1701
|
+
i
|
|
1702
|
+
);
|
|
1703
|
+
if (En(p, r))
|
|
1704
|
+
return { top: p.top, left: p.left };
|
|
1705
|
+
}
|
|
1706
|
+
let o = me(e.top - i - G, i), d = Le(e.left, t);
|
|
1707
|
+
if (r) {
|
|
1708
|
+
let l = Se(o, d, t, i);
|
|
1709
|
+
Ie(l, r) && (o = me(r.top - i - G, i), l = Se(o, d, t, i)), Ie(l, r) && (o = me(e.bottom + G, i), d = Le(
|
|
1710
|
+
Math.min(e.left, r.left - t - G),
|
|
1711
|
+
t
|
|
1712
|
+
));
|
|
1713
|
+
}
|
|
1714
|
+
return { top: o, left: d };
|
|
1715
|
+
}
|
|
1716
|
+
function Tn({
|
|
1717
|
+
elements: e,
|
|
1718
|
+
areaBbox: t,
|
|
1719
|
+
onSubmit: i,
|
|
1720
|
+
onCancel: r
|
|
1721
|
+
}) {
|
|
1722
|
+
const [a, s] = A(""), o = V(null), d = V(null), l = e[0] ?? null, u = t ? new DOMRect(t.x, t.y, t.width, t.height) : null, p = Nn(l), m = u ?? p, w = it(), f = l ? ie(l) : { kind: "none", value: "" }, g = f.kind !== "none" ? f.value : void 0;
|
|
1723
|
+
if (z(() => {
|
|
1724
|
+
var b;
|
|
1725
|
+
(b = o.current) == null || b.focus();
|
|
1726
|
+
}, [e]), z(() => {
|
|
1727
|
+
const b = (N) => {
|
|
1728
|
+
N.key === "Escape" && r();
|
|
1729
|
+
};
|
|
1730
|
+
return document.addEventListener("keydown", b), () => document.removeEventListener("keydown", b);
|
|
1731
|
+
}, [r]), !m) return null;
|
|
1732
|
+
const v = In(m), M = e.length > 1 ? `${e.length} selected` : l ? Te(l) : "Area selection", y = (b) => {
|
|
1733
|
+
a.trim() && i(a, b);
|
|
1734
|
+
};
|
|
1735
|
+
return /* @__PURE__ */ n(
|
|
1736
|
+
be,
|
|
1737
|
+
{
|
|
1738
|
+
variant: "popover",
|
|
1739
|
+
style: { top: v.top, left: v.left },
|
|
1740
|
+
children: /* @__PURE__ */ c(
|
|
1741
|
+
"div",
|
|
1742
|
+
{
|
|
1743
|
+
ref: d,
|
|
1744
|
+
role: "dialog",
|
|
1745
|
+
"aria-modal": "true",
|
|
1746
|
+
"aria-label": "Add annotation",
|
|
1747
|
+
className: "pa-popover-body",
|
|
1748
|
+
children: [
|
|
1749
|
+
/* @__PURE__ */ n("div", { className: "pa-popover-header", children: /* @__PURE__ */ n("span", { className: "pa-popover-selector", children: M }) }),
|
|
1750
|
+
(w || g) && /* @__PURE__ */ c("div", { className: "pa-popover-context", children: [
|
|
1751
|
+
w && /* @__PURE__ */ c("p", { className: "pa-popover-context-line", children: [
|
|
1752
|
+
/* @__PURE__ */ n("span", { className: "pa-popover-context-label", children: "Selected" }),
|
|
1753
|
+
w
|
|
1754
|
+
] }),
|
|
1755
|
+
g && g !== w && /* @__PURE__ */ c("p", { className: "pa-popover-context-line", children: [
|
|
1756
|
+
/* @__PURE__ */ n("span", { className: "pa-popover-context-label", children: "Element" }),
|
|
1757
|
+
g
|
|
1758
|
+
] })
|
|
1759
|
+
] }),
|
|
1760
|
+
/* @__PURE__ */ c("label", { className: "pa-label", children: [
|
|
1761
|
+
"Note",
|
|
1762
|
+
/* @__PURE__ */ n(
|
|
1763
|
+
"textarea",
|
|
1764
|
+
{
|
|
1765
|
+
ref: o,
|
|
1766
|
+
className: "pa-textarea",
|
|
1767
|
+
value: a,
|
|
1768
|
+
onChange: (b) => s(b.target.value),
|
|
1769
|
+
placeholder: "Describe the change...",
|
|
1770
|
+
rows: 3,
|
|
1771
|
+
onKeyDown: (b) => {
|
|
1772
|
+
b.key === "Enter" && (b.metaKey || b.ctrlKey) && (b.preventDefault(), y(b.shiftKey)), b.key === "Escape" && r();
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
)
|
|
1776
|
+
] }),
|
|
1777
|
+
/* @__PURE__ */ n("p", { className: "pa-popover-hint", children: "⌘↵ Add · ⇧⌘↵ Add & next · Esc Cancel" }),
|
|
1778
|
+
/* @__PURE__ */ c("div", { className: "pa-popover-actions", children: [
|
|
1779
|
+
/* @__PURE__ */ n(B, { variant: "ghost", onClick: r, children: "Cancel" }),
|
|
1780
|
+
/* @__PURE__ */ n(
|
|
1781
|
+
B,
|
|
1782
|
+
{
|
|
1783
|
+
variant: "ghost",
|
|
1784
|
+
onClick: () => y(!0),
|
|
1785
|
+
disabled: !a.trim(),
|
|
1786
|
+
children: "Add & next"
|
|
1787
|
+
}
|
|
1788
|
+
),
|
|
1789
|
+
/* @__PURE__ */ n(
|
|
1790
|
+
B,
|
|
1791
|
+
{
|
|
1792
|
+
variant: "glass-primary",
|
|
1793
|
+
onClick: () => y(!1),
|
|
1794
|
+
disabled: !a.trim(),
|
|
1795
|
+
children: "Add"
|
|
1796
|
+
}
|
|
1797
|
+
)
|
|
1798
|
+
] })
|
|
1799
|
+
]
|
|
1800
|
+
}
|
|
1801
|
+
)
|
|
1802
|
+
}
|
|
1803
|
+
);
|
|
1804
|
+
}
|
|
1805
|
+
function Rn({ area: e, isDragging: t }) {
|
|
1806
|
+
return !e || e.width < 2 || e.height < 2 ? null : /* @__PURE__ */ n(
|
|
1807
|
+
"div",
|
|
1808
|
+
{
|
|
1809
|
+
className: `pa-area-select ${t ? "pa-area-select--dragging" : ""}`,
|
|
1810
|
+
style: {
|
|
1811
|
+
top: e.y,
|
|
1812
|
+
left: e.x,
|
|
1813
|
+
width: e.width,
|
|
1814
|
+
height: e.height
|
|
1815
|
+
},
|
|
1816
|
+
"aria-hidden": "true"
|
|
1817
|
+
}
|
|
1818
|
+
);
|
|
1819
|
+
}
|
|
1820
|
+
function Dn(e) {
|
|
1821
|
+
const { elements: t, note: i, areaBbox: r } = e, a = t[0];
|
|
1822
|
+
if (!a && r)
|
|
1823
|
+
return {
|
|
1824
|
+
id: crypto.randomUUID(),
|
|
1825
|
+
selector: "area-selection",
|
|
1826
|
+
note: i.trim(),
|
|
1827
|
+
areaBbox: r,
|
|
1828
|
+
position: { x: Math.round(r.x), y: Math.round(r.y) },
|
|
1829
|
+
bbox: {
|
|
1830
|
+
x: Math.round(r.x),
|
|
1831
|
+
y: Math.round(r.y),
|
|
1832
|
+
width: Math.round(r.width),
|
|
1833
|
+
height: Math.round(r.height)
|
|
1834
|
+
},
|
|
1835
|
+
createdAt: Date.now()
|
|
1836
|
+
};
|
|
1837
|
+
if (!a)
|
|
1838
|
+
throw new Error("buildAnnotationEntry requires at least one element or areaBbox");
|
|
1839
|
+
const s = a.getBoundingClientRect(), o = Re(a), d = it(), l = ie(a), u = l.kind !== "none" ? l.value : void 0, p = t.map((m) => rt(m));
|
|
1840
|
+
return {
|
|
1841
|
+
id: crypto.randomUUID(),
|
|
1842
|
+
selector: p[0],
|
|
1843
|
+
selectors: p.length > 1 ? p : void 0,
|
|
1844
|
+
note: i.trim(),
|
|
1845
|
+
position: { x: Math.round(s.x), y: Math.round(s.y) },
|
|
1846
|
+
bbox: {
|
|
1847
|
+
x: Math.round(s.x),
|
|
1848
|
+
y: Math.round(s.y),
|
|
1849
|
+
width: Math.round(s.width),
|
|
1850
|
+
height: Math.round(s.height)
|
|
1851
|
+
},
|
|
1852
|
+
areaBbox: r,
|
|
1853
|
+
domPath: St(a),
|
|
1854
|
+
selectedText: d,
|
|
1855
|
+
elementText: u,
|
|
1856
|
+
sourceFile: o.sourceFile,
|
|
1857
|
+
lineNumber: o.lineNumber,
|
|
1858
|
+
componentName: At(a) ?? o.componentName,
|
|
1859
|
+
createdAt: Date.now()
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
function Pn(e) {
|
|
1863
|
+
const t = at(e);
|
|
1864
|
+
if (t) return t.getBoundingClientRect();
|
|
1865
|
+
if (e.bbox) {
|
|
1866
|
+
const { x: i, y: r, width: a, height: s } = e.bbox;
|
|
1867
|
+
return new DOMRect(i, r, a, s);
|
|
1868
|
+
}
|
|
1869
|
+
if (e.areaBbox) {
|
|
1870
|
+
const { x: i, y: r, width: a, height: s } = e.areaBbox;
|
|
1871
|
+
return new DOMRect(i, r, a, s);
|
|
1872
|
+
}
|
|
1873
|
+
if (e.position) {
|
|
1874
|
+
const { x: i, y: r } = e.position;
|
|
1875
|
+
return new DOMRect(i, r, 1, 1);
|
|
1876
|
+
}
|
|
1877
|
+
return null;
|
|
1878
|
+
}
|
|
1879
|
+
function Fn(e) {
|
|
1880
|
+
return `${Math.round(e.top)}:${Math.round(e.left)}:${Math.round(e.width)}:${Math.round(e.height)}`;
|
|
1881
|
+
}
|
|
1882
|
+
const On = 20;
|
|
1883
|
+
function $n({ annotations: e }) {
|
|
1884
|
+
const [t, i] = A([]);
|
|
1885
|
+
return z(() => {
|
|
1886
|
+
if (e.length === 0) {
|
|
1887
|
+
i([]);
|
|
1888
|
+
return;
|
|
1889
|
+
}
|
|
1890
|
+
const r = /* @__PURE__ */ new Map(), a = () => {
|
|
1891
|
+
const d = [];
|
|
1892
|
+
e.forEach((l, u) => {
|
|
1893
|
+
const p = Pn(l);
|
|
1894
|
+
if (!p) return;
|
|
1895
|
+
const m = Fn(p), w = r.get(m) ?? 0;
|
|
1896
|
+
r.set(m, w + 1), d.push({
|
|
1897
|
+
id: l.id,
|
|
1898
|
+
index: u + 1,
|
|
1899
|
+
top: p.top - 6 - w * On,
|
|
1900
|
+
left: p.right - 6
|
|
1901
|
+
});
|
|
1902
|
+
}), i(d);
|
|
1903
|
+
};
|
|
1904
|
+
a();
|
|
1905
|
+
const s = /* @__PURE__ */ new Set();
|
|
1906
|
+
for (const d of e) {
|
|
1907
|
+
const l = at(d);
|
|
1908
|
+
l && s.add(l);
|
|
1909
|
+
}
|
|
1910
|
+
const o = Array.from(s).map((d) => {
|
|
1911
|
+
const l = new ResizeObserver(a);
|
|
1912
|
+
return l.observe(d), l;
|
|
1913
|
+
});
|
|
1914
|
+
return window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
|
|
1915
|
+
for (const d of o) d.disconnect();
|
|
1916
|
+
window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
|
|
1917
|
+
};
|
|
1918
|
+
}, [e]), t.length === 0 ? null : /* @__PURE__ */ n(X, { children: t.map((r) => /* @__PURE__ */ n(
|
|
1919
|
+
"span",
|
|
1920
|
+
{
|
|
1921
|
+
className: "pa-annotation-badge",
|
|
1922
|
+
style: { top: r.top, left: r.left },
|
|
1923
|
+
"aria-hidden": "true",
|
|
1924
|
+
children: r.index
|
|
1925
|
+
},
|
|
1926
|
+
r.id
|
|
1927
|
+
)) });
|
|
1928
|
+
}
|
|
1929
|
+
const Oe = "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]";
|
|
1930
|
+
function fe(e) {
|
|
1931
|
+
return e instanceof Element ? !!e.closest(Oe) : !1;
|
|
1932
|
+
}
|
|
1933
|
+
function Je(e, t) {
|
|
1934
|
+
return document.elementsFromPoint(e, t).find(
|
|
1935
|
+
(r) => r instanceof Element && !r.closest(Oe)
|
|
1936
|
+
) ?? null;
|
|
1937
|
+
}
|
|
1938
|
+
function gt(e) {
|
|
1939
|
+
return e ? e === "Copied all!" || e.startsWith("Copy failed") : !1;
|
|
1940
|
+
}
|
|
1941
|
+
function vt({
|
|
1942
|
+
feedback: e,
|
|
1943
|
+
slotClassName: t,
|
|
1944
|
+
children: i
|
|
1945
|
+
}) {
|
|
1946
|
+
return e && gt(e) ? /* @__PURE__ */ n(
|
|
1947
|
+
"span",
|
|
1948
|
+
{
|
|
1949
|
+
className: `pa-status pa-copy-feedback-slot ${t}`,
|
|
1950
|
+
role: "status",
|
|
1951
|
+
"aria-live": "polite",
|
|
1952
|
+
children: e
|
|
1953
|
+
}
|
|
1954
|
+
) : /* @__PURE__ */ n(X, { children: i });
|
|
1955
|
+
}
|
|
1956
|
+
function Bn({
|
|
1957
|
+
annotations: e,
|
|
1958
|
+
collapsed: t,
|
|
1959
|
+
onToggleCollapsed: i,
|
|
1960
|
+
onClose: r,
|
|
1961
|
+
onCopyAll: a,
|
|
1962
|
+
onCopyOne: s,
|
|
1963
|
+
onRemove: o,
|
|
1964
|
+
onUpdate: d,
|
|
1965
|
+
copyStatus: l,
|
|
1966
|
+
copiedEntryId: u,
|
|
1967
|
+
copyAllFrom: p
|
|
1968
|
+
}) {
|
|
1969
|
+
const [m, w] = A(null), [f, g] = A("");
|
|
1970
|
+
z(() => {
|
|
1971
|
+
const y = (b) => {
|
|
1972
|
+
b.key === "Escape" && (t ? r() : i());
|
|
1973
|
+
};
|
|
1974
|
+
return document.addEventListener("keydown", y), () => document.removeEventListener("keydown", y);
|
|
1975
|
+
}, [t, r, i]);
|
|
1976
|
+
const v = (y) => {
|
|
1977
|
+
w(y.id), g(y.note);
|
|
1978
|
+
}, M = (y) => {
|
|
1979
|
+
f.trim() && (d(y, { note: f.trim() }), w(null));
|
|
1980
|
+
};
|
|
1981
|
+
return /* @__PURE__ */ c(
|
|
1982
|
+
be,
|
|
1983
|
+
{
|
|
1984
|
+
variant: "sheet",
|
|
1985
|
+
side: "right",
|
|
1986
|
+
className: t ? "pa-session-panel--collapsed" : void 0,
|
|
1987
|
+
children: [
|
|
1988
|
+
/* @__PURE__ */ c("div", { className: "pa-session-header", children: [
|
|
1989
|
+
/* @__PURE__ */ c("div", { className: "pa-session-header-main", children: [
|
|
1990
|
+
/* @__PURE__ */ n(
|
|
1991
|
+
B,
|
|
1992
|
+
{
|
|
1993
|
+
variant: "ghost",
|
|
1994
|
+
className: "pa-glass-btn--sm pa-session-collapse-btn",
|
|
1995
|
+
onClick: i,
|
|
1996
|
+
"aria-expanded": !t,
|
|
1997
|
+
"aria-label": t ? "Expand session panel" : "Collapse session panel",
|
|
1998
|
+
children: /* @__PURE__ */ n("span", { className: "pa-session-chevron", "aria-hidden": "true", children: t ? "▶" : "▼" })
|
|
1999
|
+
}
|
|
2000
|
+
),
|
|
2001
|
+
/* @__PURE__ */ c("h3", { className: "pa-session-title", children: [
|
|
2002
|
+
"Session (",
|
|
2003
|
+
e.length,
|
|
2004
|
+
")"
|
|
2005
|
+
] })
|
|
2006
|
+
] }),
|
|
2007
|
+
!t && /* @__PURE__ */ n("p", { className: "pa-session-subtitle", children: "Persists until tab close" }),
|
|
2008
|
+
/* @__PURE__ */ c("div", { className: "pa-session-actions", children: [
|
|
2009
|
+
/* @__PURE__ */ n(
|
|
2010
|
+
vt,
|
|
2011
|
+
{
|
|
2012
|
+
feedback: p === "session" ? l : null,
|
|
2013
|
+
slotClassName: "pa-copy-feedback-slot--session",
|
|
2014
|
+
children: /* @__PURE__ */ n(
|
|
2015
|
+
B,
|
|
2016
|
+
{
|
|
2017
|
+
variant: "glass-primary",
|
|
2018
|
+
className: "pa-glass-btn--sm",
|
|
2019
|
+
onClick: a,
|
|
2020
|
+
disabled: e.length === 0,
|
|
2021
|
+
children: "Copy all"
|
|
2022
|
+
}
|
|
2023
|
+
)
|
|
2024
|
+
}
|
|
2025
|
+
),
|
|
2026
|
+
/* @__PURE__ */ n(B, { variant: "ghost", onClick: r, "aria-label": "Close session panel", children: "✕" })
|
|
2027
|
+
] })
|
|
2028
|
+
] }),
|
|
2029
|
+
!t && /* @__PURE__ */ c("ul", { className: "pa-session-list", children: [
|
|
2030
|
+
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." }),
|
|
2031
|
+
e.map((y) => {
|
|
2032
|
+
const b = Lt(y);
|
|
2033
|
+
return /* @__PURE__ */ n("li", { className: "pa-session-item", children: m === y.id ? /* @__PURE__ */ c("div", { className: "pa-session-edit", children: [
|
|
2034
|
+
/* @__PURE__ */ c("label", { className: "pa-label", children: [
|
|
2035
|
+
"Note",
|
|
2036
|
+
/* @__PURE__ */ n(
|
|
2037
|
+
"textarea",
|
|
2038
|
+
{
|
|
2039
|
+
className: "pa-textarea",
|
|
2040
|
+
value: f,
|
|
2041
|
+
onChange: (N) => g(N.target.value),
|
|
2042
|
+
rows: 3
|
|
2043
|
+
}
|
|
2044
|
+
)
|
|
2045
|
+
] }),
|
|
2046
|
+
/* @__PURE__ */ c("div", { className: "pa-session-item-actions", children: [
|
|
2047
|
+
/* @__PURE__ */ n(B, { variant: "ghost", onClick: () => w(null), children: "Cancel" }),
|
|
2048
|
+
/* @__PURE__ */ n(
|
|
2049
|
+
B,
|
|
2050
|
+
{
|
|
2051
|
+
variant: "glass-primary",
|
|
2052
|
+
onClick: () => M(y.id),
|
|
2053
|
+
disabled: !f.trim(),
|
|
2054
|
+
children: "Save"
|
|
2055
|
+
}
|
|
2056
|
+
)
|
|
2057
|
+
] })
|
|
2058
|
+
] }) : /* @__PURE__ */ c(X, { children: [
|
|
2059
|
+
/* @__PURE__ */ c("div", { className: "pa-session-content", children: [
|
|
2060
|
+
/* @__PURE__ */ n("span", { className: "pa-session-target", children: b.target }),
|
|
2061
|
+
/* @__PURE__ */ n("p", { className: "pa-session-note", children: b.note }),
|
|
2062
|
+
b.meta && /* @__PURE__ */ n("p", { className: "pa-session-meta-line", children: b.meta })
|
|
2063
|
+
] }),
|
|
2064
|
+
/* @__PURE__ */ c("div", { className: "pa-session-item-actions", children: [
|
|
2065
|
+
l === "Copied!" && u === y.id ? /* @__PURE__ */ n(
|
|
2066
|
+
"span",
|
|
2067
|
+
{
|
|
2068
|
+
className: "pa-status pa-copy-feedback-slot pa-copy-feedback-slot--item",
|
|
2069
|
+
role: "status",
|
|
2070
|
+
"aria-live": "polite",
|
|
2071
|
+
children: "Copied!"
|
|
2072
|
+
}
|
|
2073
|
+
) : /* @__PURE__ */ n(
|
|
2074
|
+
B,
|
|
2075
|
+
{
|
|
2076
|
+
variant: "glass-primary",
|
|
2077
|
+
className: "pa-glass-btn--sm",
|
|
2078
|
+
onClick: () => s(y.id),
|
|
2079
|
+
"aria-label": "Copy annotation",
|
|
2080
|
+
children: "Copy"
|
|
2081
|
+
}
|
|
2082
|
+
),
|
|
2083
|
+
/* @__PURE__ */ n(
|
|
2084
|
+
B,
|
|
2085
|
+
{
|
|
2086
|
+
variant: "ghost",
|
|
2087
|
+
className: "pa-glass-btn--sm",
|
|
2088
|
+
onClick: () => v(y),
|
|
2089
|
+
"aria-label": "Edit annotation note",
|
|
2090
|
+
children: "✎"
|
|
2091
|
+
}
|
|
2092
|
+
),
|
|
2093
|
+
/* @__PURE__ */ n(
|
|
2094
|
+
B,
|
|
2095
|
+
{
|
|
2096
|
+
variant: "ghost",
|
|
2097
|
+
className: "pa-glass-btn--sm",
|
|
2098
|
+
onClick: () => o(y.id),
|
|
2099
|
+
"aria-label": "Remove annotation",
|
|
2100
|
+
children: "✕"
|
|
2101
|
+
}
|
|
2102
|
+
)
|
|
2103
|
+
] })
|
|
2104
|
+
] }) }, y.id);
|
|
2105
|
+
})
|
|
2106
|
+
] })
|
|
2107
|
+
]
|
|
2108
|
+
}
|
|
2109
|
+
);
|
|
2110
|
+
}
|
|
2111
|
+
function Hn() {
|
|
2112
|
+
return /* @__PURE__ */ c("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
2113
|
+
/* @__PURE__ */ n(
|
|
2114
|
+
"path",
|
|
2115
|
+
{
|
|
2116
|
+
d: "M8 10.25a2.25 2.25 0 1 0 0-4.5 2.25 2.25 0 0 0 0 4.5Z",
|
|
2117
|
+
stroke: "currentColor",
|
|
2118
|
+
strokeWidth: "1.25"
|
|
2119
|
+
}
|
|
2120
|
+
),
|
|
2121
|
+
/* @__PURE__ */ n(
|
|
2122
|
+
"path",
|
|
2123
|
+
{
|
|
2124
|
+
d: "M12.1 9.2c.08-.42.08-.86 0-1.28l1.12-.87a.75.75 0 0 0 .18-.97l-1.06-1.84a.75.75 0 0 0-.92-.34l-1.32.53a5.2 5.2 0 0 0-1.1-.64l-.2-1.4A.75.75 0 0 0 8.9 2h-2.1a.75.75 0 0 0-.74.63l-.2 1.4c-.39.16-.76.37-1.1.64l-1.32-.53a.75.75 0 0 0-.92.34L1.56 6.08a.75.75 0 0 0 .18.97l1.12.87c-.08.42-.08.86 0 1.28l-1.12.87a.75.75 0 0 0-.18.97l1.06 1.84c.2.35.6.5.97.34l1.32-.53c.34.27.71.48 1.1.64l.2 1.4c.08.37.4.63.74.63h2.1c.37 0 .68-.28.74-.63l.2-1.4c.39-.16.76-.37 1.1-.64l1.32.53c.37.15.77 0 .97-.34l1.06-1.84a.75.75 0 0 0-.18-.97l-1.12-.87Z",
|
|
2125
|
+
stroke: "currentColor",
|
|
2126
|
+
strokeWidth: "1.1",
|
|
2127
|
+
strokeLinejoin: "round"
|
|
2128
|
+
}
|
|
2129
|
+
)
|
|
2130
|
+
] });
|
|
2131
|
+
}
|
|
2132
|
+
function zn() {
|
|
2133
|
+
return /* @__PURE__ */ c("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
2134
|
+
/* @__PURE__ */ n("circle", { cx: "8", cy: "8", r: "2.75", stroke: "currentColor", strokeWidth: "1.25" }),
|
|
2135
|
+
/* @__PURE__ */ n(
|
|
2136
|
+
"path",
|
|
2137
|
+
{
|
|
2138
|
+
d: "M8 1.25v1.5M8 13.25v1.5M1.25 8h1.5M13.25 8h1.5M3.05 3.05l1.06 1.06M11.89 11.89l1.06 1.06M3.05 12.95l1.06-1.06M11.89 4.11l1.06-1.06",
|
|
2139
|
+
stroke: "currentColor",
|
|
2140
|
+
strokeWidth: "1.25",
|
|
2141
|
+
strokeLinecap: "round"
|
|
2142
|
+
}
|
|
2143
|
+
)
|
|
2144
|
+
] });
|
|
2145
|
+
}
|
|
2146
|
+
function Un() {
|
|
2147
|
+
return /* @__PURE__ */ n("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
2148
|
+
"path",
|
|
2149
|
+
{
|
|
2150
|
+
d: "M11.2 9.4a4.25 4.25 0 0 1-5.6-5.6A4.75 4.75 0 1 0 11.2 9.4Z",
|
|
2151
|
+
stroke: "currentColor",
|
|
2152
|
+
strokeWidth: "1.25",
|
|
2153
|
+
strokeLinejoin: "round"
|
|
2154
|
+
}
|
|
2155
|
+
) });
|
|
2156
|
+
}
|
|
2157
|
+
function Vn({
|
|
2158
|
+
open: e,
|
|
2159
|
+
onClose: t,
|
|
2160
|
+
hostTheme: i,
|
|
2161
|
+
chrome: r,
|
|
2162
|
+
onToggleHostTheme: a
|
|
2163
|
+
}) {
|
|
2164
|
+
const s = V(null);
|
|
2165
|
+
return z(() => {
|
|
2166
|
+
if (!e) return;
|
|
2167
|
+
const o = (l) => {
|
|
2168
|
+
l.key === "Escape" && t();
|
|
2169
|
+
}, d = (l) => {
|
|
2170
|
+
var p, m;
|
|
2171
|
+
const u = l.target;
|
|
2172
|
+
(p = s.current) != null && p.contains(u) || (m = u.closest) != null && m.call(u, "[data-pa-settings-trigger]") || t();
|
|
2173
|
+
};
|
|
2174
|
+
return window.addEventListener("keydown", o), window.addEventListener("mousedown", d), () => {
|
|
2175
|
+
window.removeEventListener("keydown", o), window.removeEventListener("mousedown", d);
|
|
2176
|
+
};
|
|
2177
|
+
}, [e, t]), e ? /* @__PURE__ */ n("div", { ref: s, className: "pa-settings-menu", role: "dialog", "aria-label": "PixelAgent settings", children: /* @__PURE__ */ n(be, { variant: "popover", className: "pa-settings-menu-panel", children: /* @__PURE__ */ c("div", { className: "pa-settings-menu-inner", children: [
|
|
2178
|
+
/* @__PURE__ */ c("header", { className: "pa-settings-menu-header", children: [
|
|
2179
|
+
/* @__PURE__ */ n("h4", { className: "pa-settings-menu-title", children: "Settings" }),
|
|
2180
|
+
/* @__PURE__ */ n("p", { className: "pa-settings-menu-subtitle", children: "Appearance and chrome" })
|
|
2181
|
+
] }),
|
|
2182
|
+
/* @__PURE__ */ c("section", { className: "pa-settings-section", children: [
|
|
2183
|
+
/* @__PURE__ */ n("span", { className: "pa-settings-section-label", children: "Host theme" }),
|
|
2184
|
+
/* @__PURE__ */ c("div", { className: "pa-settings-row", children: [
|
|
2185
|
+
/* @__PURE__ */ n("span", { className: "pa-settings-row-value", children: i === "dark" ? "Dark canvas" : "Light canvas" }),
|
|
2186
|
+
/* @__PURE__ */ n(
|
|
2187
|
+
B,
|
|
2188
|
+
{
|
|
2189
|
+
variant: "icon",
|
|
2190
|
+
onClick: a,
|
|
2191
|
+
"aria-label": i === "dark" ? "Switch host to light theme" : "Switch host to dark theme",
|
|
2192
|
+
title: i === "dark" ? "Light theme" : "Dark theme",
|
|
2193
|
+
children: i === "dark" ? /* @__PURE__ */ n(zn, {}) : /* @__PURE__ */ n(Un, {})
|
|
2194
|
+
}
|
|
2195
|
+
)
|
|
2196
|
+
] })
|
|
2197
|
+
] }),
|
|
2198
|
+
/* @__PURE__ */ c("section", { className: "pa-settings-section", children: [
|
|
2199
|
+
/* @__PURE__ */ n("span", { className: "pa-settings-section-label", children: "Glass chrome" }),
|
|
2200
|
+
/* @__PURE__ */ c("p", { className: "pa-settings-hint", children: [
|
|
2201
|
+
r === "dim" ? "Dim gray glass for readability on bright pages." : "Frosted glass for dark pages.",
|
|
2202
|
+
" ",
|
|
2203
|
+
"(auto)"
|
|
2204
|
+
] })
|
|
2205
|
+
] })
|
|
2206
|
+
] }) }) }) : null;
|
|
2207
|
+
}
|
|
2208
|
+
const Ze = "0 0 24 24";
|
|
2209
|
+
function _n() {
|
|
2210
|
+
return /* @__PURE__ */ c(X, { children: [
|
|
2211
|
+
/* @__PURE__ */ n("rect", { x: "3", y: "14", width: "4", height: "4", fill: "currentColor" }),
|
|
2212
|
+
/* @__PURE__ */ n("path", { fill: "currentColor", d: "M7 5h12v12L7 5z" })
|
|
2213
|
+
] });
|
|
2214
|
+
}
|
|
2215
|
+
const Wn = "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";
|
|
2216
|
+
function Xn({ size: e = 22, variant: t = "cursor" }) {
|
|
2217
|
+
return t === "pointer" ? /* @__PURE__ */ n(
|
|
2218
|
+
"svg",
|
|
2219
|
+
{
|
|
2220
|
+
className: "pa-brand-cursor pa-brand-cursor--pointer",
|
|
2221
|
+
width: e,
|
|
2222
|
+
height: e,
|
|
2223
|
+
viewBox: Ze,
|
|
2224
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2225
|
+
"aria-hidden": "true",
|
|
2226
|
+
children: /* @__PURE__ */ n(
|
|
2227
|
+
"path",
|
|
2228
|
+
{
|
|
2229
|
+
fill: "currentColor",
|
|
2230
|
+
d: Wn
|
|
2231
|
+
}
|
|
2232
|
+
)
|
|
2233
|
+
}
|
|
2234
|
+
) : /* @__PURE__ */ n(
|
|
2235
|
+
"svg",
|
|
2236
|
+
{
|
|
2237
|
+
className: "pa-brand-cursor pa-brand-cursor--minimal",
|
|
2238
|
+
width: e,
|
|
2239
|
+
height: e,
|
|
2240
|
+
viewBox: Ze,
|
|
2241
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2242
|
+
"aria-hidden": "true",
|
|
2243
|
+
children: /* @__PURE__ */ n(_n, {})
|
|
2244
|
+
}
|
|
2245
|
+
);
|
|
2246
|
+
}
|
|
2247
|
+
const Yn = ["element", "area", "multi"], Gn = {
|
|
2248
|
+
element: "Click",
|
|
2249
|
+
area: "Area",
|
|
2250
|
+
multi: "Multi"
|
|
2251
|
+
};
|
|
2252
|
+
function Kn({
|
|
2253
|
+
rootAttributes: e,
|
|
2254
|
+
hostTheme: t,
|
|
2255
|
+
chrome: i,
|
|
2256
|
+
settingsOpen: r,
|
|
2257
|
+
onToggleSettings: a,
|
|
2258
|
+
onCloseSettings: s,
|
|
2259
|
+
onToggleHostTheme: o,
|
|
2260
|
+
active: d,
|
|
2261
|
+
mode: l,
|
|
2262
|
+
captureMode: u,
|
|
2263
|
+
annotationCount: p,
|
|
2264
|
+
multiSelectCount: m,
|
|
2265
|
+
copyStatus: w,
|
|
2266
|
+
copyAllFrom: f,
|
|
2267
|
+
onActivateAnnotate: g,
|
|
2268
|
+
onActivateEdit: v,
|
|
2269
|
+
onDeactivate: M,
|
|
2270
|
+
onCopyAll: y,
|
|
2271
|
+
onCaptureModeChange: b,
|
|
2272
|
+
onConfirmMultiSelect: N
|
|
2273
|
+
}) {
|
|
2274
|
+
const { elementRef: I, isDragging: T, style: h, dragHandleProps: k } = ct(), R = /* @__PURE__ */ c(
|
|
2275
|
+
"div",
|
|
2276
|
+
{
|
|
2277
|
+
ref: I,
|
|
2278
|
+
className: `pa-toolbar-float ${T ? "pa-toolbar-float--dragging" : ""}`,
|
|
2279
|
+
style: h,
|
|
2280
|
+
role: "toolbar",
|
|
2281
|
+
"aria-label": "PixelAgent",
|
|
2282
|
+
children: [
|
|
2283
|
+
!d && /* @__PURE__ */ n(
|
|
2284
|
+
Vn,
|
|
2285
|
+
{
|
|
2286
|
+
open: r,
|
|
2287
|
+
onClose: s,
|
|
2288
|
+
hostTheme: t,
|
|
2289
|
+
chrome: i,
|
|
2290
|
+
onToggleHostTheme: o
|
|
2291
|
+
}
|
|
2292
|
+
),
|
|
2293
|
+
/* @__PURE__ */ n(lt, { shape: "capsule", className: "pa-toolbar-glass", intensity: "enhanced", children: /* @__PURE__ */ c("div", { className: "pa-toolbar-inner", children: [
|
|
2294
|
+
/* @__PURE__ */ n(
|
|
2295
|
+
"button",
|
|
2296
|
+
{
|
|
2297
|
+
type: "button",
|
|
2298
|
+
className: "pa-toolbar-drag",
|
|
2299
|
+
"aria-label": "Drag PixelAgent toolbar",
|
|
2300
|
+
title: "Drag to move",
|
|
2301
|
+
...k,
|
|
2302
|
+
children: /* @__PURE__ */ n(Xn, { size: 22 })
|
|
2303
|
+
}
|
|
2304
|
+
),
|
|
2305
|
+
/* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
|
|
2306
|
+
d ? /* @__PURE__ */ c(X, { children: [
|
|
2307
|
+
/* @__PURE__ */ c("div", { className: "pa-toolbar-segment", children: [
|
|
2308
|
+
/* @__PURE__ */ n("span", { className: "pa-mode-badge", children: l }),
|
|
2309
|
+
l === "annotate" && /* @__PURE__ */ c(X, { children: [
|
|
2310
|
+
/* @__PURE__ */ n(
|
|
2311
|
+
"select",
|
|
2312
|
+
{
|
|
2313
|
+
className: "pa-select pa-toolbar-capture-select",
|
|
2314
|
+
value: u,
|
|
2315
|
+
onChange: (S) => b(S.target.value),
|
|
2316
|
+
"aria-label": "Capture mode",
|
|
2317
|
+
children: Yn.map((S) => /* @__PURE__ */ n("option", { value: S, children: Gn[S] }, S))
|
|
2318
|
+
}
|
|
2319
|
+
),
|
|
2320
|
+
m > 0 && /* @__PURE__ */ n(
|
|
2321
|
+
B,
|
|
2322
|
+
{
|
|
2323
|
+
variant: "glass-primary",
|
|
2324
|
+
onClick: N,
|
|
2325
|
+
"aria-label": "Annotate selected elements",
|
|
2326
|
+
children: m
|
|
2327
|
+
}
|
|
2328
|
+
),
|
|
2329
|
+
/* @__PURE__ */ n(
|
|
2330
|
+
vt,
|
|
2331
|
+
{
|
|
2332
|
+
feedback: f === "toolbar" ? w : null,
|
|
2333
|
+
slotClassName: "pa-copy-feedback-slot--toolbar",
|
|
2334
|
+
children: /* @__PURE__ */ n(
|
|
2335
|
+
B,
|
|
2336
|
+
{
|
|
2337
|
+
variant: "glass-primary",
|
|
2338
|
+
onClick: y,
|
|
2339
|
+
disabled: p === 0,
|
|
2340
|
+
"aria-label": p > 0 ? `Copy all annotations (${p})` : "Copy all annotations",
|
|
2341
|
+
children: p > 0 ? `Copy (${p})` : "Copy"
|
|
2342
|
+
}
|
|
2343
|
+
)
|
|
2344
|
+
}
|
|
2345
|
+
)
|
|
2346
|
+
] })
|
|
2347
|
+
] }),
|
|
2348
|
+
/* @__PURE__ */ n(
|
|
2349
|
+
B,
|
|
2350
|
+
{
|
|
2351
|
+
variant: "icon",
|
|
2352
|
+
className: "pa-toolbar-close",
|
|
2353
|
+
onClick: M,
|
|
2354
|
+
"aria-label": "Close",
|
|
2355
|
+
children: /* @__PURE__ */ n(
|
|
2356
|
+
"svg",
|
|
2357
|
+
{
|
|
2358
|
+
width: "14",
|
|
2359
|
+
height: "14",
|
|
2360
|
+
viewBox: "0 0 14 14",
|
|
2361
|
+
fill: "none",
|
|
2362
|
+
"aria-hidden": "true",
|
|
2363
|
+
children: /* @__PURE__ */ n(
|
|
2364
|
+
"path",
|
|
2365
|
+
{
|
|
2366
|
+
d: "M3 3L11 11M11 3L3 11",
|
|
2367
|
+
stroke: "currentColor",
|
|
2368
|
+
strokeWidth: "1.75",
|
|
2369
|
+
strokeLinecap: "round"
|
|
2370
|
+
}
|
|
2371
|
+
)
|
|
2372
|
+
}
|
|
2373
|
+
)
|
|
2374
|
+
}
|
|
2375
|
+
)
|
|
2376
|
+
] }) : /* @__PURE__ */ c("div", { className: "pa-toolbar-segment", children: [
|
|
2377
|
+
/* @__PURE__ */ n(B, { onClick: g, children: "Annotate" }),
|
|
2378
|
+
/* @__PURE__ */ n(B, { onClick: v, children: "Edit" })
|
|
2379
|
+
] }),
|
|
2380
|
+
!d && /* @__PURE__ */ c(X, { children: [
|
|
2381
|
+
/* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
|
|
2382
|
+
/* @__PURE__ */ n(
|
|
2383
|
+
B,
|
|
2384
|
+
{
|
|
2385
|
+
variant: "icon",
|
|
2386
|
+
className: "pa-toolbar-settings",
|
|
2387
|
+
"data-pa-settings-trigger": !0,
|
|
2388
|
+
onClick: a,
|
|
2389
|
+
"aria-label": "PixelAgent settings",
|
|
2390
|
+
"aria-expanded": r,
|
|
2391
|
+
title: "Settings",
|
|
2392
|
+
children: /* @__PURE__ */ n(Hn, {})
|
|
2393
|
+
}
|
|
2394
|
+
)
|
|
2395
|
+
] }),
|
|
2396
|
+
w && !gt(w) && w !== "Copied!" && /* @__PURE__ */ n("span", { className: "pa-status pa-toolbar-status", role: "status", children: w })
|
|
2397
|
+
] }) })
|
|
2398
|
+
]
|
|
2399
|
+
}
|
|
2400
|
+
);
|
|
2401
|
+
return typeof document > "u" ? R : De(
|
|
2402
|
+
/* @__PURE__ */ n(
|
|
2403
|
+
"div",
|
|
2404
|
+
{
|
|
2405
|
+
className: "pa-root pa-root--toolbar-portal",
|
|
2406
|
+
"data-pixelagent-toolbar-portal": !0,
|
|
2407
|
+
...e,
|
|
2408
|
+
children: R
|
|
2409
|
+
}
|
|
2410
|
+
),
|
|
2411
|
+
document.body
|
|
2412
|
+
);
|
|
2413
|
+
}
|
|
2414
|
+
function jn() {
|
|
2415
|
+
const e = V(Et()), [t, i] = A(
|
|
2416
|
+
() => {
|
|
2417
|
+
var s;
|
|
2418
|
+
return ((s = e.current) == null ? void 0 : s.annotations) ?? [];
|
|
2419
|
+
}
|
|
2420
|
+
);
|
|
2421
|
+
z(() => {
|
|
2422
|
+
It({ annotations: t });
|
|
2423
|
+
}, [t]);
|
|
2424
|
+
const r = E((s, o) => {
|
|
2425
|
+
i(
|
|
2426
|
+
(d) => d.map((l) => l.id === s ? { ...l, ...o } : l)
|
|
2427
|
+
);
|
|
2428
|
+
}, []), a = E((s) => {
|
|
2429
|
+
i((o) => o.filter((d) => d.id !== s));
|
|
2430
|
+
}, []);
|
|
2431
|
+
return {
|
|
2432
|
+
annotations: t,
|
|
2433
|
+
setAnnotations: i,
|
|
2434
|
+
updateAnnotation: r,
|
|
2435
|
+
removeAnnotation: a
|
|
2436
|
+
};
|
|
2437
|
+
}
|
|
2438
|
+
function qn({
|
|
2439
|
+
ui: e,
|
|
2440
|
+
hostTheme: t,
|
|
2441
|
+
onHostThemeChange: i
|
|
2442
|
+
}) {
|
|
2443
|
+
const r = le(
|
|
2444
|
+
() => ({ ...Tt, ...e }),
|
|
2445
|
+
[e]
|
|
2446
|
+
), [a, s] = A(
|
|
2447
|
+
() => t ?? _e(r) ?? "dark"
|
|
2448
|
+
), [o, d] = A(!1), l = t ?? a;
|
|
2449
|
+
z(() => {
|
|
2450
|
+
if (t !== void 0) return;
|
|
2451
|
+
const w = () => {
|
|
2452
|
+
const v = _e(r);
|
|
2453
|
+
v && s(v);
|
|
2454
|
+
};
|
|
2455
|
+
w();
|
|
2456
|
+
const f = r.hostThemeAttribute, g = new MutationObserver(w);
|
|
2457
|
+
return g.observe(document.documentElement, {
|
|
2458
|
+
attributes: !0,
|
|
2459
|
+
attributeFilter: [f]
|
|
2460
|
+
}), () => g.disconnect();
|
|
2461
|
+
}, [t, r]);
|
|
2462
|
+
const u = le(
|
|
2463
|
+
() => Rt(r, l),
|
|
2464
|
+
[r, l]
|
|
2465
|
+
), p = E(() => {
|
|
2466
|
+
const w = l === "dark" ? "light" : "dark";
|
|
2467
|
+
if (i) {
|
|
2468
|
+
i(w);
|
|
2469
|
+
return;
|
|
2470
|
+
}
|
|
2471
|
+
s(w), Dt(w, r);
|
|
2472
|
+
}, [l, i, r]), m = E(() => {
|
|
2473
|
+
d((w) => !w);
|
|
2474
|
+
}, []);
|
|
2475
|
+
return {
|
|
2476
|
+
chrome: u,
|
|
2477
|
+
rootAttributes: Pt(u),
|
|
2478
|
+
hostTheme: l,
|
|
2479
|
+
toggleHostTheme: p,
|
|
2480
|
+
settingsOpen: o,
|
|
2481
|
+
setSettingsOpen: d,
|
|
2482
|
+
toggleSettings: m,
|
|
2483
|
+
uiSettings: r
|
|
2484
|
+
};
|
|
2485
|
+
}
|
|
2486
|
+
function Qe(e) {
|
|
2487
|
+
const t = Math.min(e.startX, e.currentX), i = Math.min(e.startY, e.currentY), r = Math.abs(e.currentX - e.startX), a = Math.abs(e.currentY - e.startY);
|
|
2488
|
+
return { x: t, y: i, width: r, height: a };
|
|
2489
|
+
}
|
|
2490
|
+
function Jn({ ui: e, hostTheme: t, onHostThemeChange: i } = {}) {
|
|
2491
|
+
const r = qn({ ui: e, hostTheme: t, onHostThemeChange: i }), [a, s] = A(!1), [o, d] = A("idle"), [l, u] = A("element"), {
|
|
2492
|
+
annotations: p,
|
|
2493
|
+
setAnnotations: m,
|
|
2494
|
+
updateAnnotation: w,
|
|
2495
|
+
removeAnnotation: f
|
|
2496
|
+
} = jn(), [g, v] = A(null), [M, y] = A(null), [b, N] = A([]), [I, T] = A(null), [h, k] = A(null), [R, S] = A(!1), [P, F] = A(!1), _ = a && o === "annotate" && p.length > 0 && !R, [K, $] = A("this-instance"), [j, C] = A("normal"), [D, O] = A(null), [H, W] = A(null), [U, Q] = A(null), oe = V(null), J = V(null), we = E(
|
|
2497
|
+
(x, L) => {
|
|
2498
|
+
J.current && clearTimeout(J.current), O(x), W((L == null ? void 0 : L.entryId) ?? null), Q((L == null ? void 0 : L.copyAllFrom) ?? null), J.current = setTimeout(() => {
|
|
2499
|
+
O(null), W(null), Q(null);
|
|
2500
|
+
}, 2500);
|
|
2501
|
+
},
|
|
2502
|
+
[]
|
|
2503
|
+
), ee = E(
|
|
2504
|
+
async (x, L, Y) => {
|
|
2505
|
+
if (x)
|
|
2506
|
+
try {
|
|
2507
|
+
await Ft(x), we(L, Y);
|
|
2508
|
+
} catch {
|
|
2509
|
+
we("Copy failed — check clipboard permissions", Y);
|
|
2510
|
+
}
|
|
2511
|
+
},
|
|
2512
|
+
[we]
|
|
2513
|
+
), se = E(
|
|
2514
|
+
(x, L) => {
|
|
2515
|
+
x.length === 0 && !L || (T({ elements: x, areaBbox: L }), y(x[0] ?? null));
|
|
2516
|
+
},
|
|
2517
|
+
[]
|
|
2518
|
+
), ye = E(
|
|
2519
|
+
(x) => {
|
|
2520
|
+
if (!(!a || o !== "annotate" || fe(x.target))) {
|
|
2521
|
+
if (h) {
|
|
2522
|
+
k(
|
|
2523
|
+
(L) => L && { ...L, currentX: x.clientX, currentY: x.clientY }
|
|
2524
|
+
);
|
|
2525
|
+
return;
|
|
2526
|
+
}
|
|
2527
|
+
l !== "area" && v(Je(x.clientX, x.clientY));
|
|
2528
|
+
}
|
|
2529
|
+
},
|
|
2530
|
+
[a, o, h, l]
|
|
2531
|
+
), xe = E(
|
|
2532
|
+
(x) => {
|
|
2533
|
+
!a || o !== "annotate" || fe(x.target) || l !== "area" || x.button !== 0 || (x.preventDefault(), x.stopPropagation(), k({
|
|
2534
|
+
startX: x.clientX,
|
|
2535
|
+
startY: x.clientY,
|
|
2536
|
+
currentX: x.clientX,
|
|
2537
|
+
currentY: x.clientY
|
|
2538
|
+
}), T(null));
|
|
2539
|
+
},
|
|
2540
|
+
[a, o, l]
|
|
2541
|
+
), Ne = E(() => {
|
|
2542
|
+
if (!h) return;
|
|
2543
|
+
const x = Qe(h);
|
|
2544
|
+
if (k(null), x.width < 8 || x.height < 8) return;
|
|
2545
|
+
const L = Ot(x, Oe);
|
|
2546
|
+
se(L, x);
|
|
2547
|
+
}, [h, se]), ke = E(
|
|
2548
|
+
(x) => {
|
|
2549
|
+
if (!a || o !== "annotate" || fe(x.target) || l === "area") return;
|
|
2550
|
+
x.preventDefault(), x.stopPropagation();
|
|
2551
|
+
const L = Je(x.clientX, x.clientY);
|
|
2552
|
+
if (!L) return;
|
|
2553
|
+
if (x.shiftKey || l === "multi") {
|
|
2554
|
+
N((te) => te.includes(L) ? te.filter((Ce) => Ce !== L) : [...te, L]), y(L);
|
|
2555
|
+
return;
|
|
2556
|
+
}
|
|
2557
|
+
const Y = b.length > 0 ? b : [L];
|
|
2558
|
+
se(Y.includes(L) ? Y : [L]);
|
|
2559
|
+
},
|
|
2560
|
+
[a, o, l, b, se]
|
|
2561
|
+
);
|
|
2562
|
+
z(() => {
|
|
2563
|
+
!M || K !== "all-instances" || tt(M) <= 1 && $("this-instance");
|
|
2564
|
+
}, [M, K]), z(() => {
|
|
2565
|
+
if (a)
|
|
2566
|
+
return document.addEventListener("mousemove", ye, !0), document.addEventListener("mousedown", xe, !0), document.addEventListener("mouseup", Ne, !0), document.addEventListener("click", ke, !0), () => {
|
|
2567
|
+
document.removeEventListener("mousemove", ye, !0), document.removeEventListener("mousedown", xe, !0), document.removeEventListener("mouseup", Ne, !0), document.removeEventListener("click", ke, !0);
|
|
2568
|
+
};
|
|
2569
|
+
}, [a, ye, xe, Ne, ke]);
|
|
2570
|
+
const bt = E(
|
|
2571
|
+
(x, L) => {
|
|
2572
|
+
if (!I || !x.trim()) return;
|
|
2573
|
+
const { elements: Y, areaBbox: te } = I;
|
|
2574
|
+
if (Y.length === 0 && !te) return;
|
|
2575
|
+
const He = Dn({
|
|
2576
|
+
elements: Y,
|
|
2577
|
+
note: x,
|
|
2578
|
+
areaBbox: te
|
|
2579
|
+
});
|
|
2580
|
+
m((Ce) => [...Ce, He]), S(!1), F(!1), L ? (T(null), y(null)) : (T(null), y(null), N([]));
|
|
2581
|
+
},
|
|
2582
|
+
[I, m]
|
|
2583
|
+
), wt = E(() => {
|
|
2584
|
+
T(null), y(null);
|
|
2585
|
+
}, []), $e = E(
|
|
2586
|
+
async (x) => {
|
|
2587
|
+
const L = $t(p);
|
|
2588
|
+
await ee(L, "Copied all!", { copyAllFrom: x });
|
|
2589
|
+
},
|
|
2590
|
+
[p, ee]
|
|
2591
|
+
), yt = E(
|
|
2592
|
+
async (x) => {
|
|
2593
|
+
const L = p.find((Y) => Y.id === x);
|
|
2594
|
+
L && await ee(Bt(L), "Copied!", { entryId: x });
|
|
2595
|
+
},
|
|
2596
|
+
[p, ee]
|
|
2597
|
+
), xt = E(
|
|
2598
|
+
async (x) => {
|
|
2599
|
+
if (!M) return;
|
|
2600
|
+
const L = Re(M), Y = {
|
|
2601
|
+
schemaVersion: 1,
|
|
2602
|
+
elementSelector: nt(M, K),
|
|
2603
|
+
sourceFile: L.sourceFile,
|
|
2604
|
+
lineNumber: L.lineNumber,
|
|
2605
|
+
targetScope: K,
|
|
2606
|
+
state: j,
|
|
2607
|
+
stylingSystem: et(M),
|
|
2608
|
+
changes: x
|
|
2609
|
+
};
|
|
2610
|
+
await ee(JSON.stringify(Y, null, 2), "Apply payload copied!");
|
|
2611
|
+
},
|
|
2612
|
+
[M, K, j, ee]
|
|
2613
|
+
), Be = (x) => {
|
|
2614
|
+
r.setSettingsOpen(!1), s(!0), d(x), y(null), v(null), T(null), N([]), k(null), x === "annotate" && S(!1);
|
|
2615
|
+
}, Nt = () => {
|
|
2616
|
+
s(!1), d("idle"), y(null), v(null), T(null), N([]), k(null), S(!1), F(!1);
|
|
2617
|
+
}, kt = h ? Qe(h) : null;
|
|
2618
|
+
return /* @__PURE__ */ c(
|
|
2619
|
+
"div",
|
|
2620
|
+
{
|
|
2621
|
+
ref: oe,
|
|
2622
|
+
className: "pa-root",
|
|
2623
|
+
"data-pixelagent-root": !0,
|
|
2624
|
+
...r.rootAttributes,
|
|
2625
|
+
children: [
|
|
2626
|
+
/* @__PURE__ */ n(
|
|
2627
|
+
Kn,
|
|
2628
|
+
{
|
|
2629
|
+
rootAttributes: r.rootAttributes,
|
|
2630
|
+
hostTheme: r.hostTheme,
|
|
2631
|
+
chrome: r.chrome,
|
|
2632
|
+
settingsOpen: r.settingsOpen,
|
|
2633
|
+
onToggleSettings: r.toggleSettings,
|
|
2634
|
+
onCloseSettings: () => r.setSettingsOpen(!1),
|
|
2635
|
+
onToggleHostTheme: r.toggleHostTheme,
|
|
2636
|
+
active: a,
|
|
2637
|
+
mode: o,
|
|
2638
|
+
captureMode: l,
|
|
2639
|
+
annotationCount: p.length,
|
|
2640
|
+
multiSelectCount: b.length,
|
|
2641
|
+
copyStatus: D,
|
|
2642
|
+
copyAllFrom: U,
|
|
2643
|
+
onActivateAnnotate: () => Be("annotate"),
|
|
2644
|
+
onActivateEdit: () => Be("edit"),
|
|
2645
|
+
onDeactivate: Nt,
|
|
2646
|
+
onCopyAll: () => $e("toolbar"),
|
|
2647
|
+
onCaptureModeChange: u,
|
|
2648
|
+
onConfirmMultiSelect: () => {
|
|
2649
|
+
b.length > 0 && se(b);
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
),
|
|
2653
|
+
a && o === "annotate" && /* @__PURE__ */ c(X, { children: [
|
|
2654
|
+
/* @__PURE__ */ n(
|
|
2655
|
+
ot,
|
|
2656
|
+
{
|
|
2657
|
+
element: g,
|
|
2658
|
+
selected: M,
|
|
2659
|
+
multiSelected: b
|
|
2660
|
+
}
|
|
2661
|
+
),
|
|
2662
|
+
/* @__PURE__ */ n($n, { annotations: p }),
|
|
2663
|
+
/* @__PURE__ */ n(Rn, { area: kt, isDragging: !!h })
|
|
2664
|
+
] }),
|
|
2665
|
+
a && o === "annotate" && I && /* @__PURE__ */ n(
|
|
2666
|
+
Tn,
|
|
2667
|
+
{
|
|
2668
|
+
elements: I.elements,
|
|
2669
|
+
areaBbox: I.areaBbox,
|
|
2670
|
+
onSubmit: bt,
|
|
2671
|
+
onCancel: wt
|
|
2672
|
+
}
|
|
2673
|
+
),
|
|
2674
|
+
a && o === "edit" && /* @__PURE__ */ n(
|
|
2675
|
+
xn,
|
|
2676
|
+
{
|
|
2677
|
+
selectedElement: M,
|
|
2678
|
+
hoveredElement: g,
|
|
2679
|
+
onSelectElement: y,
|
|
2680
|
+
onHoverElement: v,
|
|
2681
|
+
targetScope: K,
|
|
2682
|
+
onTargetScopeChange: $,
|
|
2683
|
+
elementState: j,
|
|
2684
|
+
onElementStateChange: C,
|
|
2685
|
+
onApply: xt,
|
|
2686
|
+
applyStatus: o === "edit" ? D : null,
|
|
2687
|
+
isToolbarTarget: fe
|
|
2688
|
+
}
|
|
2689
|
+
),
|
|
2690
|
+
_ && /* @__PURE__ */ n(
|
|
2691
|
+
Bn,
|
|
2692
|
+
{
|
|
2693
|
+
annotations: p,
|
|
2694
|
+
collapsed: P,
|
|
2695
|
+
onToggleCollapsed: () => F((x) => !x),
|
|
2696
|
+
onClose: () => {
|
|
2697
|
+
S(!0), F(!1);
|
|
2698
|
+
},
|
|
2699
|
+
onCopyAll: () => $e("session"),
|
|
2700
|
+
onCopyOne: yt,
|
|
2701
|
+
onRemove: f,
|
|
2702
|
+
onUpdate: w,
|
|
2703
|
+
copyStatus: D,
|
|
2704
|
+
copiedEntryId: H,
|
|
2705
|
+
copyAllFrom: U
|
|
2706
|
+
}
|
|
2707
|
+
)
|
|
2708
|
+
]
|
|
2709
|
+
}
|
|
2710
|
+
);
|
|
2711
|
+
}
|
|
2712
|
+
function Zn() {
|
|
2713
|
+
return typeof process < "u" && process.env.NODE_ENV !== "production";
|
|
2714
|
+
}
|
|
2715
|
+
function rr() {
|
|
2716
|
+
return Zn() ? /* @__PURE__ */ n(Jn, {}) : null;
|
|
2717
|
+
}
|
|
2718
|
+
export {
|
|
2719
|
+
Jn as PixelAgent,
|
|
2720
|
+
rr as PixelAgentDev,
|
|
2721
|
+
Zn as isDevEnvironment
|
|
2722
|
+
};
|
|
2723
|
+
//# sourceMappingURL=pixelagent.js.map
|