pixelagent 0.1.10 → 0.1.11

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.
@@ -1 +1 @@
1
- {"version":3,"file":"PixelAgent.d.ts","sourceRoot":"","sources":["../src/PixelAgent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,YAAY,EACZ,qBAAqB,EAErB,SAAS,EACT,oBAAoB,EAErB,MAAM,oBAAoB,CAAC;AAuB5B,OAAO,yBAAyB,CAAC;AAEjC,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,EAAE,CAAC,EAAE,oBAAoB,CAAC;IAC1B,2DAA2D;IAC3D,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAC/C;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC;CAC5E;AAwBD,wBAAgB,UAAU,CAAC,EACzB,EAAE,EACF,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,OAAO,GACR,GAAE,eAAoB,2CA0YtB;AAED,OAAO,EAAE,UAAU,IAAI,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"PixelAgent.d.ts","sourceRoot":"","sources":["../src/PixelAgent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,YAAY,EACZ,qBAAqB,EAErB,SAAS,EACT,oBAAoB,EAErB,MAAM,oBAAoB,CAAC;AAuB5B,OAAO,yBAAyB,CAAC;AAEjC,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,EAAE,CAAC,EAAE,oBAAoB,CAAC;IAC1B,2DAA2D;IAC3D,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAC/C;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC;CAC5E;AAwBD,wBAAgB,UAAU,CAAC,EACzB,EAAE,EACF,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,OAAO,GACR,GAAE,eAAoB,2CA4YtB;AAED,OAAO,EAAE,UAAU,IAAI,OAAO,EAAE,CAAC"}
@@ -9,7 +9,7 @@ interface EditPanelProps {
9
9
  onTargetScopeChange: (scope: TargetScope) => void;
10
10
  elementState: ElementState;
11
11
  onElementStateChange: (state: ElementState) => void;
12
- onApply: (pendingByElement: Map<Element, StyleChange[]>) => void | Promise<void>;
12
+ onApply: (pendingByElement: Map<Element, StyleChange[]>) => Promise<boolean>;
13
13
  applyStatus: string | null;
14
14
  isToolbarTarget: (target: EventTarget | null) => boolean;
15
15
  onPreviewApi?: (api: EditPreviewApi | null) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"EditPanel.d.ts","sourceRoot":"","sources":["../../src/edit/EditPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAejF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,UAAU,cAAc;IACtB,eAAe,EAAE,OAAO,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,eAAe,EAAE,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C,cAAc,EAAE,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,WAAW,EAAE,WAAW,CAAC;IACzB,mBAAmB,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAClD,YAAY,EAAE,YAAY,CAAC;IAC3B,oBAAoB,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACpD,OAAO,EAAE,CAAC,gBAAgB,EAAE,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,KAAK,OAAO,CAAC;IACzD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;CACrD;AAED,wBAAgB,SAAS,CAAC,EACxB,eAAe,EACf,cAAc,EACd,eAAe,EACf,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,OAAO,EACP,WAAW,EACX,eAAe,EACf,YAAY,GACb,EAAE,cAAc,2CA8OhB"}
1
+ {"version":3,"file":"EditPanel.d.ts","sourceRoot":"","sources":["../../src/edit/EditPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAejF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,UAAU,cAAc;IACtB,eAAe,EAAE,OAAO,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,eAAe,EAAE,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C,cAAc,EAAE,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,WAAW,EAAE,WAAW,CAAC;IACzB,mBAAmB,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAClD,YAAY,EAAE,YAAY,CAAC;IAC3B,oBAAoB,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACpD,OAAO,EAAE,CAAC,gBAAgB,EAAE,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7E,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,KAAK,OAAO,CAAC;IACzD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;CACrD;AAED,wBAAgB,SAAS,CAAC,EACxB,eAAe,EACf,cAAc,EACd,eAAe,EACf,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,OAAO,EACP,WAAW,EACX,eAAe,EACf,YAAY,GACb,EAAE,cAAc,2CAmPhB"}
@@ -1,5 +1,5 @@
1
1
  import { jsxs as d, Fragment as X, jsx as n } from "react/jsx-runtime";
2
- import { useState as M, useEffect as B, useRef as U, useMemo as ge, useLayoutEffect as Ut, useCallback as L, useId as Wt } from "react";
2
+ import { useState as M, useEffect as z, useRef as U, useMemo as ve, useLayoutEffect as Ut, useCallback as L, useId as Wt } from "react";
3
3
  import { getElementDisplayLabel as _e, captureTextSnapshot as Je, captureInlineStyles as Ze, restoreInlineStyles as ye, restoreTextSnapshot as we, getPreviewTargets as Se, clearTailwindStatePreview as xe, applyTailwindStatePreview as De, setEditableTextPreview as Qe, getRelevantComputedStyles as Ne, getEditableTextInfo as de, readReactSource as Ve, detectStylingSystem as vt, countElementInstances as bt, getScopeSelector as yt, getCssSelector as wt, copyToClipboard as xt, getWindowSelectionText as Nt, getNearestReactComponentName as Yt, getDomPath as Xt, resolveElementFromEntry as kt, getAnnotationSessionDisplay as Gt, loadAnnotationSession as Kt, saveAnnotationSession as jt, DEFAULT_PIXEL_AGENT_UI_SETTINGS as qt, readHostThemeFromDocument as et, resolvePixelAgentChrome as Jt, applyHostThemeToDocument as Zt, pixelAgentRootAttributes as Qt, getElementsInArea as en, formatAllAnnotations as tn, formatAnnotation as nn } from "@pixelagent/shared";
4
4
  export * from "@pixelagent/shared";
5
5
  import { createPortal as Ue } from "react-dom";
@@ -10,7 +10,7 @@ function Ct({
10
10
  primarySelected: r = null
11
11
  }) {
12
12
  const [a, o] = M([]), s = r ?? t;
13
- if (B(() => {
13
+ if (z(() => {
14
14
  const l = /* @__PURE__ */ new Map(), p = i.length > 0;
15
15
  e && !t && !p && l.set(e, !1), t && l.set(t, !0);
16
16
  for (const g of i)
@@ -85,7 +85,7 @@ function an(e, t, i, r = At) {
85
85
  let x = 0;
86
86
  for (let N = 0; N < s; N++)
87
87
  for (let T = 0; T < o; T++) {
88
- const P = T / o - 0.5, R = N / s - 0.5, k = on(P, R, v, g, f), I = tt(0.8, 0, k - 0.15), A = tt(0, 1, I), h = (P * A + 0.5) * o - T, O = (R * A + 0.5) * s - N;
88
+ const P = T / o - 0.5, R = N / s - 0.5, k = on(P, R, v, g, f), I = tt(0.8, 0, k - 0.15), C = tt(0, 1, I), h = (P * C + 0.5) * o - T, O = (R * C + 0.5) * s - N;
89
89
  Math.abs(h) > y && (y = Math.abs(h)), Math.abs(O) > y && (y = Math.abs(O)), E[x++] = h, E[x++] = O;
90
90
  }
91
91
  if (y === 0) return null;
@@ -137,7 +137,7 @@ function Mt({
137
137
  style: o,
138
138
  children: s
139
139
  }) {
140
- const u = t ?? (e === "capsule" ? 9999 : 20), c = r === "enhanced" ? rn : At, l = U(null), p = ge(() => `pa-lg-${++cn}`, []), [m, v] = M(null);
140
+ const u = t ?? (e === "capsule" ? 9999 : 20), c = r === "enhanced" ? rn : At, l = U(null), p = ve(() => `pa-lg-${++cn}`, []), [m, v] = M(null);
141
141
  Ut(() => {
142
142
  const f = l.current;
143
143
  if (!f) return;
@@ -285,9 +285,9 @@ function St({
285
285
  }
286
286
  );
287
287
  }, [i, t]);
288
- B(() => {
288
+ z(() => {
289
289
  c();
290
- }, [c]), B(() => {
290
+ }, [c]), z(() => {
291
291
  const g = () => {
292
292
  r((f) => {
293
293
  if (!f || !u.current) return f;
@@ -483,7 +483,7 @@ function vn() {
483
483
  }
484
484
  function Oe({ label: e, value: t, onChange: i }) {
485
485
  const [r, a] = M(!1), [o, s] = M(() => nt(t)), u = U(null), c = U(null), l = U(null), p = Wt(), [m, v] = M({ top: 0, left: 0, width: 260 }), g = It(o), f = hn(Lt(g)), y = We(t) ? t : pn(g), E = e.toLowerCase().includes("color") ? e : `${e} color`;
486
- B(() => {
486
+ z(() => {
487
487
  s(nt(t));
488
488
  }, [t]);
489
489
  const x = L(
@@ -499,22 +499,22 @@ function Oe({ label: e, value: t, onChange: i }) {
499
499
  ), N = L(() => {
500
500
  const k = u.current;
501
501
  if (!k) return;
502
- const I = k.getBoundingClientRect(), A = 260;
502
+ const I = k.getBoundingClientRect(), C = 260;
503
503
  let h = I.left;
504
- h + A > window.innerWidth - 12 && (h = window.innerWidth - A - 12), h = Math.max(12, h);
504
+ h + C > window.innerWidth - 12 && (h = window.innerWidth - C - 12), h = Math.max(12, h);
505
505
  let O = I.bottom + 8;
506
506
  const Y = 320;
507
- O + Y > window.innerHeight - 12 && (O = Math.max(12, I.top - Y - 8)), v({ top: O, left: h, width: A });
507
+ O + Y > window.innerHeight - 12 && (O = Math.max(12, I.top - Y - 8)), v({ top: O, left: h, width: C });
508
508
  }, []);
509
- B(() => {
509
+ z(() => {
510
510
  if (!r) return;
511
511
  N();
512
- const k = (A) => {
512
+ const k = (C) => {
513
513
  var O, Y;
514
- const h = A.target;
514
+ const h = C.target;
515
515
  (O = u.current) != null && O.contains(h) || (Y = c.current) != null && Y.contains(h) || a(!1);
516
- }, I = (A) => {
517
- A.key === "Escape" && a(!1);
516
+ }, I = (C) => {
517
+ C.key === "Escape" && a(!1);
518
518
  };
519
519
  return window.addEventListener("mousedown", k, !0), window.addEventListener("keydown", I), window.addEventListener("resize", N), window.addEventListener("scroll", N, !0), () => {
520
520
  window.removeEventListener("mousedown", k, !0), window.removeEventListener("keydown", I), window.removeEventListener("resize", N), window.removeEventListener("scroll", N, !0);
@@ -522,16 +522,16 @@ function Oe({ label: e, value: t, onChange: i }) {
522
522
  }, [r, N]);
523
523
  const T = (k, I) => {
524
524
  var Y;
525
- const A = (Y = l.current) == null ? void 0 : Y.getBoundingClientRect();
526
- if (!A) return;
527
- const { x: h, y: O } = gn(k, I, A);
525
+ const C = (Y = l.current) == null ? void 0 : Y.getBoundingClientRect();
526
+ if (!C) return;
527
+ const { x: h, y: O } = gn(k, I, C);
528
528
  x({ ...o, s: h, v: 100 - O });
529
529
  }, P = (k) => {
530
530
  k.preventDefault(), T(k.clientX, k.clientY);
531
- const I = (h) => T(h.clientX, h.clientY), A = () => {
532
- window.removeEventListener("mousemove", I), window.removeEventListener("mouseup", A);
531
+ const I = (h) => T(h.clientX, h.clientY), C = () => {
532
+ window.removeEventListener("mousemove", I), window.removeEventListener("mouseup", C);
533
533
  };
534
- window.addEventListener("mousemove", I), window.addEventListener("mouseup", A);
534
+ window.addEventListener("mousemove", I), window.addEventListener("mouseup", C);
535
535
  }, R = r ? Ue(
536
536
  /* @__PURE__ */ n(
537
537
  "div",
@@ -623,8 +623,8 @@ function Oe({ label: e, value: t, onChange: i }) {
623
623
  max: 255,
624
624
  value: g[k],
625
625
  onChange: (I) => {
626
- const A = bn(parseInt(I.target.value, 10));
627
- w({ ...g, [k]: A });
626
+ const C = bn(parseInt(I.target.value, 10));
627
+ w({ ...g, [k]: C });
628
628
  }
629
629
  }
630
630
  )
@@ -735,7 +735,7 @@ function yn(e) {
735
735
  };
736
736
  }
737
737
  function wn({ value: e, onChange: t }) {
738
- const { selectValue: i, options: r } = ge(
738
+ const { selectValue: i, options: r } = ve(
739
739
  () => yn(e),
740
740
  [e]
741
741
  );
@@ -950,7 +950,7 @@ function In() {
950
950
  }
951
951
  function ce({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
952
952
  const [o, s] = M(t);
953
- return B(() => {
953
+ return z(() => {
954
954
  s(t);
955
955
  }, [t]), /* @__PURE__ */ d("label", { className: `pa-spacing-cell ${r ? "pa-spacing-cell--mixed" : ""}`, children: [
956
956
  /* @__PURE__ */ n("span", { className: "pa-spacing-cell-icon", children: e }),
@@ -1208,10 +1208,10 @@ function Vn({
1208
1208
  scopeHint: p,
1209
1209
  stateHint: m
1210
1210
  }) {
1211
- var I, A;
1211
+ var I, C;
1212
1212
  const v = e["font-weight"] ?? "", g = e["font-style"] ?? "normal", f = e["text-decoration"] ?? "none", y = Hn(e["text-align"] ?? "left"), E = ((I = e.display) == null ? void 0 : I.trim()) ?? "", x = !!E, w = _n.has(E), N = [...ut];
1213
1213
  E && !ut.includes(E) && N.push(E);
1214
- const T = ((A = e.gap) == null ? void 0 : A.trim()) ?? "", P = T === "normal" || T === "" ? "0px" : T, R = e["border-style"] ?? "none", k = [...dt];
1214
+ const T = ((C = e.gap) == null ? void 0 : C.trim()) ?? "", P = T === "normal" || T === "" ? "0px" : T, R = e["border-style"] ?? "none", k = [...dt];
1215
1215
  return R && !dt.includes(R) && k.push(R), /* @__PURE__ */ d("div", { className: "pa-edit-sections", children: [
1216
1216
  /* @__PURE__ */ d(se, { title: "Targeting", defaultOpen: !0, children: [
1217
1217
  /* @__PURE__ */ d("div", { className: "pa-edit-field-grid pa-edit-field-grid--2", children: [
@@ -1539,84 +1539,84 @@ function Wn(e, t, i) {
1539
1539
  const r = U([]), a = U(/* @__PURE__ */ new Set()), o = U([]), s = U(null), u = U([]), [c, l] = M({}), [p, m] = M({}), [v, g] = M("none"), [f, y] = M(""), [E, x] = M(""), [w, N] = M(
1540
1540
  () => /* @__PURE__ */ new Map()
1541
1541
  ), [T, P] = M(!1), R = L(() => {
1542
- const C = Array.from(a.current);
1542
+ const A = Array.from(a.current);
1543
1543
  return {
1544
- inline: Ze(C, [...pt]),
1544
+ inline: Ze(A, [...pt]),
1545
1545
  text: e && v !== "none" ? Je(e, v) : null
1546
1546
  };
1547
1547
  }, [e, v]), k = L(() => {
1548
1548
  u.current.push(R()), u.current.length > Un && u.current.shift(), P(u.current.length > 0);
1549
1549
  }, [R]), I = L(
1550
- (C) => {
1550
+ (A) => {
1551
1551
  if (!e) return;
1552
1552
  const F = Array.from(a.current);
1553
- ye(o.current.filter((z) => F.includes(z.element))), s.current && we(s.current);
1553
+ ye(o.current.filter((H) => F.includes(H.element))), s.current && we(s.current);
1554
1554
  const D = Se(e, t);
1555
1555
  r.current = D, a.current = new Set(D), xe(F), De(D, i);
1556
1556
  const W = e ? w.get(e) ?? [] : [];
1557
- if (C && W.length > 0)
1558
- for (const z of W)
1559
- if (z.property === "textContent" || z.property === "value")
1560
- for (const H of D)
1561
- Qe(H, z.property, z.newValue);
1557
+ if (A && W.length > 0)
1558
+ for (const H of W)
1559
+ if (H.property === "textContent" || H.property === "value")
1560
+ for (const B of D)
1561
+ Qe(B, H.property, H.newValue);
1562
1562
  else
1563
- for (const H of D)
1564
- H.style.setProperty(z.property, z.newValue);
1563
+ for (const B of D)
1564
+ B.style.setProperty(H.property, H.newValue);
1565
1565
  },
1566
1566
  [e, t, i, w]
1567
1567
  );
1568
- B(() => {
1568
+ z(() => {
1569
1569
  if (!e) {
1570
1570
  r.current = [], a.current = /* @__PURE__ */ new Set(), o.current = [], s.current = null, u.current = [], l({}), m({}), g("none"), y(""), x(""), N(/* @__PURE__ */ new Map()), P(!1);
1571
1571
  return;
1572
1572
  }
1573
- const C = Se(e, t);
1574
- r.current = C, a.current = new Set(C), o.current = Ze(C, [...pt]), u.current = [], P(!1);
1573
+ const A = Se(e, t);
1574
+ r.current = A, a.current = new Set(A), o.current = Ze(A, [...pt]), u.current = [], P(!1);
1575
1575
  const F = Ne(e);
1576
1576
  l(F), m(F);
1577
1577
  const D = de(e);
1578
- return g(D.kind), y(D.value), x(D.value), s.current = D.kind !== "none" ? Je(e, D.kind) : null, De(C, i), () => xe(C);
1579
- }, [e]), B(() => {
1578
+ return g(D.kind), y(D.value), x(D.value), s.current = D.kind !== "none" ? Je(e, D.kind) : null, De(A, i), () => xe(A);
1579
+ }, [e]), z(() => {
1580
1580
  e && I(!0);
1581
- }, [t]), B(() => {
1581
+ }, [t]), z(() => {
1582
1582
  if (!e) return;
1583
- const C = Se(e, t);
1584
- r.current = C, xe(Array.from(a.current)), De(C, i), a.current = new Set(C);
1583
+ const A = Se(e, t);
1584
+ r.current = A, xe(Array.from(a.current)), De(A, i), a.current = new Set(A);
1585
1585
  }, [i, e, t]);
1586
- const A = L(
1587
- (C, F, D) => {
1586
+ const C = L(
1587
+ (A, F, D) => {
1588
1588
  e && N((W) => {
1589
- const z = new Map(W), j = (z.get(e) ?? []).filter((te) => te.property !== C);
1590
- return D === F ? j.length === 0 ? z.delete(e) : z.set(e, j) : z.set(e, [...j, { property: C, oldValue: F, newValue: D }]), z;
1589
+ const H = new Map(W), j = (H.get(e) ?? []).filter((te) => te.property !== A);
1590
+ return D === F ? j.length === 0 ? H.delete(e) : H.set(e, j) : H.set(e, [...j, { property: A, oldValue: F, newValue: D }]), H;
1591
1591
  });
1592
1592
  },
1593
1593
  [e]
1594
1594
  ), h = L(
1595
- (C, F) => {
1595
+ (A, F) => {
1596
1596
  if (!e) return;
1597
- const D = { [C]: F };
1598
- C === "border-width" && (c["border-style"] ?? "none") === "none" && Nn(F) && (D["border-style"] = "solid"), k(), l((W) => ({ ...W, ...D }));
1599
- for (const [W, z] of Object.entries(D)) {
1600
- const H = p[W] ?? "";
1597
+ const D = { [A]: F };
1598
+ A === "border-width" && (c["border-style"] ?? "none") === "none" && Nn(F) && (D["border-style"] = "solid"), k(), l((W) => ({ ...W, ...D }));
1599
+ for (const [W, H] of Object.entries(D)) {
1600
+ const B = p[W] ?? "";
1601
1601
  for (const j of r.current)
1602
- j.style.setProperty(W, z), a.current.add(j);
1603
- A(W, H, z);
1602
+ j.style.setProperty(W, H), a.current.add(j);
1603
+ C(W, B, H);
1604
1604
  }
1605
1605
  },
1606
- [e, p, c, k, A]
1606
+ [e, p, c, k, C]
1607
1607
  ), O = L(
1608
- (C) => {
1608
+ (A) => {
1609
1609
  if (!(!e || v === "none")) {
1610
- k(), y(C);
1610
+ k(), y(A);
1611
1611
  for (const F of r.current)
1612
- Qe(F, v, C), a.current.add(F);
1613
- A(v, E, C);
1612
+ Qe(F, v, A), a.current.add(F);
1613
+ C(v, E, A);
1614
1614
  }
1615
1615
  },
1616
- [e, v, E, k, A]
1616
+ [e, v, E, k, C]
1617
1617
  ), Y = L(() => {
1618
- const C = u.current.pop();
1619
- if (C && (ye(C.inline), C.text && we(C.text), P(u.current.length > 0), e)) {
1618
+ const A = u.current.pop();
1619
+ if (A && (ye(A.inline), A.text && we(A.text), P(u.current.length > 0), e)) {
1620
1620
  l(Ne(e));
1621
1621
  const F = de(e);
1622
1622
  F.kind !== "none" && y(F.value);
@@ -1624,20 +1624,20 @@ function Wn(e, t, i) {
1624
1624
  }, [e]), ee = L(() => {
1625
1625
  if (ye(o.current), s.current && we(s.current), u.current = [], P(!1), N(/* @__PURE__ */ new Map()), e) {
1626
1626
  l(Ne(e));
1627
- const C = de(e);
1628
- y(C.value);
1627
+ const A = de(e);
1628
+ y(A.value);
1629
1629
  }
1630
1630
  }, [e]), Z = L(() => {
1631
1631
  ye(o.current), s.current && we(s.current);
1632
1632
  }, []), q = L(() => {
1633
1633
  if (Z(), xe(Array.from(a.current)), u.current = [], P(!1), N(/* @__PURE__ */ new Map()), e) {
1634
1634
  l(Ne(e));
1635
- const C = de(e);
1636
- C.kind !== "none" && y(C.value);
1635
+ const A = de(e);
1636
+ A.kind !== "none" && y(A.value);
1637
1637
  }
1638
1638
  }, [Z, e]), pe = e ? w.get(e) ?? [] : [];
1639
1639
  let $ = 0;
1640
- for (const C of w.values()) $ += C.length;
1640
+ for (const A of w.values()) $ += A.length;
1641
1641
  const Q = L(() => {
1642
1642
  N(/* @__PURE__ */ new Map());
1643
1643
  }, []);
@@ -1686,18 +1686,18 @@ function Yn({
1686
1686
  undo: R,
1687
1687
  reset: k,
1688
1688
  clearPreviews: I,
1689
- revertPreviews: A
1689
+ revertPreviews: C
1690
1690
  } = Wn(e, a, s), { elementRef: h, isDragging: O, style: Y, dragHandleProps: ee } = St({
1691
- computeDefaultPosition: (H) => ({
1692
- x: window.innerWidth - H.width - 16,
1691
+ computeDefaultPosition: (B) => ({
1692
+ x: window.innerWidth - B.width - 16,
1693
1693
  y: 16
1694
1694
  })
1695
1695
  });
1696
- B(() => (m == null || m({ clearPreviews: I, revertPreviews: A }), () => m == null ? void 0 : m(null)), [m, I, A]);
1696
+ z(() => (m == null || m({ clearPreviews: I, revertPreviews: C }), () => m == null ? void 0 : m(null)), [m, I, C]);
1697
1697
  const Z = L(
1698
- (H) => {
1699
- if (p(H.target)) return;
1700
- const te = document.elementsFromPoint(H.clientX, H.clientY).find(
1698
+ (B) => {
1699
+ if (p(B.target)) return;
1700
+ const te = document.elementsFromPoint(B.clientX, B.clientY).find(
1701
1701
  (ie) => ie instanceof Element && !ie.closest(
1702
1702
  "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
1703
1703
  )
@@ -1706,10 +1706,10 @@ function Yn({
1706
1706
  },
1707
1707
  [p, r]
1708
1708
  ), q = L(
1709
- (H) => {
1710
- if (p(H.target)) return;
1711
- H.preventDefault(), H.stopPropagation();
1712
- const te = document.elementsFromPoint(H.clientX, H.clientY).find(
1709
+ (B) => {
1710
+ if (p(B.target)) return;
1711
+ B.preventDefault(), B.stopPropagation();
1712
+ const te = document.elementsFromPoint(B.clientX, B.clientY).find(
1713
1713
  (ie) => ie instanceof Element && !ie.closest(
1714
1714
  "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
1715
1715
  )
@@ -1718,19 +1718,19 @@ function Yn({
1718
1718
  },
1719
1719
  [p, i]
1720
1720
  );
1721
- B(() => (document.addEventListener("mousemove", Z, !0), document.addEventListener("click", q, !0), () => {
1721
+ z(() => (document.addEventListener("mousemove", Z, !0), document.addEventListener("click", q, !0), () => {
1722
1722
  document.removeEventListener("mousemove", Z, !0), document.removeEventListener("click", q, !0);
1723
1723
  }), [Z, q]);
1724
1724
  const pe = async () => {
1725
- x !== 0 && (await c(E), w());
1726
- }, $ = e ? Ve(e) : null, Q = e ? vt(e) : null, C = e ? bt(e) : 0, F = e ? yt(e, "all-instances") : "", D = s !== "normal" && Q === "tailwind" ? "Tailwind variant preview: matching hover:/focus:/… classes are applied without the prefix." : s !== "normal" ? "State preview uses focus/disabled simulation where possible." : null, W = C > 1 ? a === "all-instances" ? `Preview & Apply on ${C} elements (${F}).` : `This instance only — ${C - 1} other on page.` : a === "all-instances" ? "Only one match — scope has no effect." : null, z = ge(() => !e || a !== "all-instances" ? [] : Se(e, "all-instances"), [e, a]);
1725
+ x === 0 || !await c(E) || (w(), C());
1726
+ }, $ = e ? Ve(e) : null, Q = e ? vt(e) : null, A = e ? bt(e) : 0, F = e ? yt(e, "all-instances") : "", D = s !== "normal" && Q === "tailwind" ? "Tailwind variant preview: matching hover:/focus:/… classes are applied without the prefix." : s !== "normal" ? "State preview uses focus/disabled simulation where possible." : null, W = A > 1 ? a === "all-instances" ? `Preview & Apply on ${A} elements (${F}).` : `This instance only — ${A - 1} other on page.` : a === "all-instances" ? "Only one match — scope has no effect." : null, H = ve(() => !e || a !== "all-instances" ? [] : Se(e, "all-instances"), [e, a]);
1727
1727
  return /* @__PURE__ */ d(X, { children: [
1728
1728
  /* @__PURE__ */ n(
1729
1729
  Ct,
1730
1730
  {
1731
1731
  element: a === "all-instances" ? null : t,
1732
1732
  selected: e,
1733
- multiSelected: z,
1733
+ multiSelected: H,
1734
1734
  primarySelected: e
1735
1735
  }
1736
1736
  ),
@@ -1794,7 +1794,7 @@ All instances: ${F}`,
1794
1794
  onTargetScopeChange: o,
1795
1795
  elementState: s,
1796
1796
  onElementStateChange: u,
1797
- instanceCount: C,
1797
+ instanceCount: A,
1798
1798
  scopeHint: W,
1799
1799
  stateHint: D
1800
1800
  }
@@ -1868,7 +1868,7 @@ async function Xn(e, t = {}) {
1868
1868
  }
1869
1869
  function Gn(e) {
1870
1870
  const [t, i] = M(null);
1871
- return B(() => {
1871
+ return z(() => {
1872
1872
  if (!e) {
1873
1873
  i(null);
1874
1874
  return;
@@ -1969,10 +1969,10 @@ function nr({
1969
1969
  onCancel: r
1970
1970
  }) {
1971
1971
  const [a, o] = M(""), s = U(null), u = U(null), c = e[0] ?? null, l = t ? new DOMRect(t.x, t.y, t.width, t.height) : null, p = Gn(c), m = l ?? p, v = Nt(), g = c ? de(c) : { kind: "none", value: "" }, f = g.kind !== "none" ? g.value : void 0;
1972
- if (B(() => {
1972
+ if (z(() => {
1973
1973
  var w;
1974
1974
  (w = s.current) == null || w.focus();
1975
- }, [e]), B(() => {
1975
+ }, [e]), z(() => {
1976
1976
  const w = (N) => {
1977
1977
  N.key === "Escape" && r();
1978
1978
  };
@@ -2131,7 +2131,7 @@ function or(e) {
2131
2131
  const sr = 20;
2132
2132
  function lr({ annotations: e }) {
2133
2133
  const [t, i] = M([]);
2134
- return B(() => {
2134
+ return z(() => {
2135
2135
  if (e.length === 0) {
2136
2136
  i([]);
2137
2137
  return;
@@ -2216,7 +2216,7 @@ function cr({
2216
2216
  copyAllFrom: p
2217
2217
  }) {
2218
2218
  const [m, v] = M(null), [g, f] = M("");
2219
- B(() => {
2219
+ z(() => {
2220
2220
  const x = (w) => {
2221
2221
  w.key === "Escape" && (t ? r() : i());
2222
2222
  };
@@ -2411,7 +2411,7 @@ function hr({
2411
2411
  onToggleHostTheme: a
2412
2412
  }) {
2413
2413
  const o = U(null);
2414
- return B(() => {
2414
+ return z(() => {
2415
2415
  if (!e) return;
2416
2416
  const s = (c) => {
2417
2417
  c.key === "Escape" && t();
@@ -2561,9 +2561,9 @@ function yr({
2561
2561
  {
2562
2562
  className: "pa-select pa-toolbar-capture-select",
2563
2563
  value: l,
2564
- onChange: (A) => w(A.target.value),
2564
+ onChange: (C) => w(C.target.value),
2565
2565
  "aria-label": "Capture mode",
2566
- children: vr.map((A) => /* @__PURE__ */ n("option", { value: A, children: br[A] }, A))
2566
+ children: vr.map((C) => /* @__PURE__ */ n("option", { value: C, children: br[C] }, C))
2567
2567
  }
2568
2568
  ),
2569
2569
  m > 0 && /* @__PURE__ */ n(
@@ -2667,7 +2667,7 @@ function wr() {
2667
2667
  return ((o = e.current) == null ? void 0 : o.annotations) ?? [];
2668
2668
  }
2669
2669
  );
2670
- B(() => {
2670
+ z(() => {
2671
2671
  jt({ annotations: t });
2672
2672
  }, [t]);
2673
2673
  const r = L((o, s) => {
@@ -2689,13 +2689,13 @@ function xr({
2689
2689
  hostTheme: t,
2690
2690
  onHostThemeChange: i
2691
2691
  }) {
2692
- const r = ge(
2692
+ const r = ve(
2693
2693
  () => ({ ...qt, ...e }),
2694
2694
  [e]
2695
2695
  ), [a, o] = M(
2696
2696
  () => t ?? et(r) ?? "dark"
2697
2697
  ), [s, u] = M(!1), c = t ?? a;
2698
- B(() => {
2698
+ z(() => {
2699
2699
  if (t !== void 0) return;
2700
2700
  const v = () => {
2701
2701
  const y = et(r);
@@ -2708,7 +2708,7 @@ function xr({
2708
2708
  attributeFilter: [g]
2709
2709
  }), () => f.disconnect();
2710
2710
  }, [t, r]);
2711
- const l = ge(
2711
+ const l = ve(
2712
2712
  () => Jt(r, c),
2713
2713
  [r, c]
2714
2714
  ), p = L(() => {
@@ -2745,7 +2745,7 @@ function Nr({
2745
2745
  onApply: a
2746
2746
  } = {}) {
2747
2747
  const o = xr({ ui: e, hostTheme: t, onHostThemeChange: i }), [s, u] = M(null);
2748
- B(() => {
2748
+ z(() => {
2749
2749
  if (r || a) return;
2750
2750
  let b = !1;
2751
2751
  return fetch(ft, { method: "GET" }).then((S) => {
@@ -2760,14 +2760,14 @@ function Nr({
2760
2760
  setAnnotations: y,
2761
2761
  updateAnnotation: E,
2762
2762
  removeAnnotation: x
2763
- } = wr(), [w, N] = M(null), [T, P] = M(null), [R, k] = M([]), [I, A] = M(null), [h, O] = M(null), [Y, ee] = M(!1), [Z, q] = M(!1), pe = c && p === "annotate" && f.length > 0 && !Y, [$, Q] = M("this-instance"), [C, F] = M("normal"), [D, W] = M(null), [z, H] = M(null), [j, te] = M(null), ie = U(null), Ie = U(null), he = L(
2763
+ } = wr(), [w, N] = M(null), [T, P] = M(null), [R, k] = M([]), [I, C] = M(null), [h, O] = M(null), [Y, ee] = M(!1), [Z, q] = M(!1), pe = c && p === "annotate" && f.length > 0 && !Y, [$, Q] = M("this-instance"), [A, F] = M("normal"), [D, W] = M(null), [H, B] = M(null), [j, te] = M(null), ie = U(null), Ie = U(null), he = L(
2764
2764
  (b, S) => {
2765
- Ie.current && clearTimeout(Ie.current), W(b), H((S == null ? void 0 : S.entryId) ?? null), te((S == null ? void 0 : S.copyAllFrom) ?? null), Ie.current = setTimeout(() => {
2766
- W(null), H(null), te(null);
2765
+ Ie.current && clearTimeout(Ie.current), W(b), B((S == null ? void 0 : S.entryId) ?? null), te((S == null ? void 0 : S.copyAllFrom) ?? null), Ie.current = setTimeout(() => {
2766
+ W(null), B(null), te(null);
2767
2767
  }, 2500);
2768
2768
  },
2769
2769
  []
2770
- ), ve = L(
2770
+ ), be = L(
2771
2771
  async (b, S, G) => {
2772
2772
  if (b)
2773
2773
  try {
@@ -2779,7 +2779,7 @@ function Nr({
2779
2779
  [he]
2780
2780
  ), me = L(
2781
2781
  (b, S) => {
2782
- b.length === 0 && !S || (A({ elements: b, areaBbox: S }), P(b[0] ?? null));
2782
+ b.length === 0 && !S || (C({ elements: b, areaBbox: S }), P(b[0] ?? null));
2783
2783
  },
2784
2784
  []
2785
2785
  ), Te = L(
@@ -2802,7 +2802,7 @@ function Nr({
2802
2802
  startY: b.clientY,
2803
2803
  currentX: b.clientX,
2804
2804
  currentY: b.clientY
2805
- }), A(null));
2805
+ }), C(null));
2806
2806
  },
2807
2807
  [c, p, v]
2808
2808
  ), Re = L(() => {
@@ -2826,9 +2826,9 @@ function Nr({
2826
2826
  },
2827
2827
  [c, p, v, R, me]
2828
2828
  );
2829
- B(() => {
2829
+ z(() => {
2830
2830
  !T || $ !== "all-instances" || bt(T) <= 1 && Q("this-instance");
2831
- }, [T, $]), B(() => {
2831
+ }, [T, $]), z(() => {
2832
2832
  if (c)
2833
2833
  return document.addEventListener("mousemove", Te, !0), document.addEventListener("mousedown", Pe, !0), document.addEventListener("mouseup", Re, !0), document.addEventListener("click", $e, !0), () => {
2834
2834
  document.removeEventListener("mousemove", Te, !0), document.removeEventListener("mousedown", Pe, !0), document.removeEventListener("mouseup", Re, !0), document.removeEventListener("click", $e, !0);
@@ -2839,60 +2839,60 @@ function Nr({
2839
2839
  if (!I || !b.trim()) return;
2840
2840
  const { elements: G, areaBbox: J } = I;
2841
2841
  if (G.length === 0 && !J) return;
2842
- const be = ir({
2842
+ const fe = ir({
2843
2843
  elements: G,
2844
2844
  note: b,
2845
2845
  areaBbox: J
2846
2846
  });
2847
- y((V) => [...V, be]), ee(!1), q(!1), S ? (A(null), P(null)) : (A(null), P(null), k([]));
2847
+ y((V) => [...V, fe]), ee(!1), q(!1), S ? (C(null), P(null)) : (C(null), P(null), k([]));
2848
2848
  },
2849
2849
  [I, y]
2850
2850
  ), Ft = L(() => {
2851
- A(null), P(null);
2851
+ C(null), P(null);
2852
2852
  }, []), Ke = L(
2853
2853
  async (b) => {
2854
2854
  const S = tn(f);
2855
- await ve(S, "Copied all!", { copyAllFrom: b });
2855
+ await be(S, "Copied all!", { copyAllFrom: b });
2856
2856
  },
2857
- [f, ve]
2857
+ [f, be]
2858
2858
  ), Bt = L(
2859
2859
  async (b) => {
2860
2860
  const S = f.find((G) => G.id === b);
2861
- S && await ve(nn(S), "Copied!", { entryId: b });
2861
+ S && await be(nn(S), "Copied!", { entryId: b });
2862
2862
  },
2863
- [f, ve]
2863
+ [f, be]
2864
2864
  ), zt = L(
2865
2865
  async (b) => {
2866
2866
  const S = Array.from(b.entries()).filter(
2867
2867
  ([, V]) => V.length > 0
2868
2868
  );
2869
- if (S.length === 0) return;
2869
+ if (S.length === 0) return !1;
2870
2870
  const G = r ?? s ?? void 0, J = [];
2871
- for (const [V, fe] of S) {
2871
+ for (const [V, ge] of S) {
2872
2872
  const qe = Ve(V), Vt = {
2873
2873
  schemaVersion: 1,
2874
2874
  elementSelector: yt(V, $),
2875
2875
  sourceFile: qe.sourceFile,
2876
2876
  lineNumber: qe.lineNumber,
2877
2877
  targetScope: $,
2878
- state: C,
2878
+ state: A,
2879
2879
  stylingSystem: vt(V),
2880
- changes: fe
2880
+ changes: ge
2881
2881
  };
2882
2882
  J.push(await Xn(Vt, { applyEndpoint: G, onApply: a }));
2883
2883
  }
2884
- const be = J.every(
2884
+ const fe = J.every(
2885
2885
  (V) => V.mode === "mcp" && V.result.success && V.result.linesChanged.length > 0
2886
2886
  );
2887
- he(be ? "Change applied" : "Apply failed"), J.forEach((V, fe) => {
2888
- V.mode === "error" ? console.error(`[pixelagent] Apply #${fe} failed:`, V.message) : V.mode === "clipboard" ? console.warn(`[pixelagent] Apply #${fe} fell back to clipboard`) : V.mode === "mcp" && !V.result.success && console.warn(`[pixelagent] Apply #${fe} reported no changes:`, V.result);
2889
- });
2887
+ return he(fe ? "Change applied" : "Apply failed"), J.forEach((V, ge) => {
2888
+ V.mode === "error" ? console.error(`[pixelagent] Apply #${ge} failed:`, V.message) : V.mode === "clipboard" ? console.warn(`[pixelagent] Apply #${ge} fell back to clipboard`) : V.mode === "mcp" && !V.result.success && console.warn(`[pixelagent] Apply #${ge} reported no changes:`, V.result);
2889
+ }), fe;
2890
2890
  },
2891
- [$, C, r, s, a, he]
2891
+ [$, A, r, s, a, he]
2892
2892
  ), je = (b) => {
2893
- o.setSettingsOpen(!1), l(!0), m(b), P(null), N(null), A(null), k([]), O(null), b === "annotate" && ee(!1);
2893
+ o.setSettingsOpen(!1), l(!0), m(b), P(null), N(null), C(null), k([]), O(null), b === "annotate" && ee(!1);
2894
2894
  }, Ht = () => {
2895
- l(!1), m("idle"), P(null), N(null), A(null), k([]), O(null), ee(!1), q(!1);
2895
+ l(!1), m("idle"), P(null), N(null), C(null), k([]), O(null), ee(!1), q(!1);
2896
2896
  }, _t = h ? gt(h) : null;
2897
2897
  return /* @__PURE__ */ d(
2898
2898
  "div",
@@ -2959,7 +2959,7 @@ function Nr({
2959
2959
  onHoverElement: N,
2960
2960
  targetScope: $,
2961
2961
  onTargetScopeChange: Q,
2962
- elementState: C,
2962
+ elementState: A,
2963
2963
  onElementStateChange: F,
2964
2964
  onApply: zt,
2965
2965
  applyStatus: p === "edit" ? D : null,
@@ -2980,7 +2980,7 @@ function Nr({
2980
2980
  onRemove: x,
2981
2981
  onUpdate: E,
2982
2982
  copyStatus: D,
2983
- copiedEntryId: z,
2983
+ copiedEntryId: H,
2984
2984
  copyAllFrom: j
2985
2985
  }
2986
2986
  )