@plitzi/sdk-dev-tools 0.38.23 → 0.39.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +172 -1
  2. package/dist/DevToolsContainer.d.ts +11 -1
  3. package/dist/DevToolsContainer.mjs +68 -62
  4. package/dist/DevToolsContextProvider.mjs +5 -3
  5. package/dist/PageContext.d.ts +7 -0
  6. package/dist/PageContext.mjs +6 -0
  7. package/dist/agentInspector/flowRuns.d.ts +1 -1
  8. package/dist/agentInspector/flowRuns.mjs +22 -15
  9. package/dist/agentInspector/index.d.ts +2 -0
  10. package/dist/agentInspector/index.mjs +1 -0
  11. package/dist/agentInspector/inspector.d.ts +31 -1
  12. package/dist/agentInspector/inspector.mjs +57 -19
  13. package/dist/agentInspector/report.d.ts +27 -2
  14. package/dist/agentInspector/report.mjs +59 -38
  15. package/dist/agentInspector/useAgentInspector.d.ts +3 -2
  16. package/dist/agentInspector/useAgentInspector.mjs +20 -16
  17. package/dist/components/DevToolsOverlay/DevToolsOverlay.d.ts +3 -4
  18. package/dist/components/DevToolsOverlay/DevToolsOverlay.mjs +4 -4
  19. package/dist/components/DevToolsPanel/DevToolsBody.d.ts +4 -1
  20. package/dist/components/DevToolsPanel/DevToolsBody.mjs +33 -31
  21. package/dist/components/DevToolsPanel/DevToolsButton.d.ts +3 -1
  22. package/dist/components/DevToolsPanel/DevToolsButton.mjs +4 -3
  23. package/dist/components/DevToolsPanel/DevToolsHeader.d.ts +3 -1
  24. package/dist/components/DevToolsPanel/DevToolsHeader.mjs +52 -34
  25. package/dist/components/DevToolsPanel/DevToolsPanel.d.ts +3 -1
  26. package/dist/components/DevToolsPanel/DevToolsPanel.mjs +50 -47
  27. package/dist/components/DevToolsPanel/tabs/QaViewer/QaReplayButton.mjs +2 -2
  28. package/dist/components/DevToolsPanel/tabs/RunViewer/RunReport.d.ts +7 -0
  29. package/dist/components/DevToolsPanel/tabs/RunViewer/RunReport.mjs +97 -0
  30. package/dist/components/DevToolsPanel/tabs/RunViewer/RunTaskRow.d.ts +6 -0
  31. package/dist/components/DevToolsPanel/tabs/RunViewer/RunTaskRow.mjs +79 -0
  32. package/dist/components/DevToolsPanel/tabs/RunViewer/RunViewer.d.ts +11 -0
  33. package/dist/components/DevToolsPanel/tabs/RunViewer/RunViewer.mjs +222 -0
  34. package/dist/components/DevToolsPanel/tabs/RunViewer/index.d.ts +3 -0
  35. package/dist/components/DevToolsPanel/tabs/RunViewer/index.mjs +6 -0
  36. package/dist/components/DevToolsPanel/tabs/RunViewer/reportHelpers.d.ts +9 -0
  37. package/dist/components/DevToolsPanel/tabs/RunViewer/reportHelpers.mjs +39 -0
  38. package/dist/components/DevToolsPanel/tabs/RunViewer/stepRecorder.d.ts +27 -0
  39. package/dist/components/DevToolsPanel/tabs/RunViewer/stepRecorder.mjs +51 -0
  40. package/dist/components/DevToolsPanel/tabs/RunViewer/usePointAt.d.ts +14 -0
  41. package/dist/components/DevToolsPanel/tabs/RunViewer/usePointAt.mjs +33 -0
  42. package/dist/components/DevToolsPanel/tabs/RunViewer/useRunSnapshot.d.ts +9 -0
  43. package/dist/components/DevToolsPanel/tabs/RunViewer/useRunSnapshot.mjs +22 -0
  44. package/dist/qa/QaContext.d.ts +2 -5
  45. package/dist/qa/QaContext.mjs +28 -31
  46. package/dist/qa/QaLayer.mjs +78 -77
  47. package/dist/qa/overlays/QaInspector.mjs +28 -27
  48. package/dist/qa/overlays/QaTabOrder.mjs +2 -2
  49. package/dist/qa/overlays/QaXrayTags.mjs +22 -22
  50. package/dist/useNarrowWindow.d.ts +8 -0
  51. package/dist/useNarrowWindow.mjs +13 -0
  52. package/package.json +4 -4
@@ -0,0 +1,51 @@
1
+ import { useEffect as e } from "react";
2
+ import { DEV_TOOLS_ATTRIBUTE as t } from "@plitzi/sdk-shared/devTools";
3
+ import { RUN_REPORT_STEPS_MOST as n } from "@plitzi/sdk-shared/runs";
4
+ //#region src/components/DevToolsPanel/tabs/RunViewer/stepRecorder.ts
5
+ var r = [], i = 0, a = () => `${window.location.pathname}${window.location.search}`, o = "button, a[href], input, select, textarea, summary, label, [role=\"button\"], [role=\"tab\"], [role=\"link\"]", s = (e, t = !1) => {
6
+ let n = e instanceof Element && t ? e.closest(o) ?? e : e, r = n instanceof Element ? n.closest("[data-plitzi-el]") : null, i = r?.getAttribute("data-plitzi-el");
7
+ if (!r || !i) return;
8
+ let a = Array.from(document.querySelectorAll(`[data-plitzi-el="${CSS.escape(i)}"]`));
9
+ return a.length > 1 ? `${i}:${String(a.indexOf(r) + 1)}` : i;
10
+ }, c = (e) => e instanceof Element && e.closest(`[${t}]`) !== null, l = (e) => {
11
+ r = [...r, {
12
+ step: e,
13
+ path: a()
14
+ }], r.length > n && (i += r.length - n, r = r.slice(-n));
15
+ }, u = (e) => {
16
+ let t = c(e.target) ? void 0 : s(e.target, !0);
17
+ t && l({
18
+ kind: "click",
19
+ element: t
20
+ });
21
+ }, d = (e) => {
22
+ let t = e.target, n = c(t) ? void 0 : s(t);
23
+ if (!n || !(t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement)) return;
24
+ let i = t instanceof HTMLInputElement && t.type === "password" ? {
25
+ kind: "type",
26
+ element: n,
27
+ secret: !0
28
+ } : {
29
+ kind: "type",
30
+ element: n,
31
+ text: t.value
32
+ }, a = r.at(-1);
33
+ a?.step.kind === "type" && a.step.element === n ? r = [...r.slice(0, -1), {
34
+ ...a,
35
+ step: i
36
+ }] : l(i);
37
+ }, f = () => ({
38
+ steps: r.map((e) => e.step),
39
+ earlier: i,
40
+ from: r.at(0)?.path ?? a()
41
+ }), p = () => {
42
+ r = [], i = 0;
43
+ }, m = (t) => {
44
+ e(() => {
45
+ if (t && typeof document < "u") return document.addEventListener("click", u, !0), document.addEventListener("input", d, !0), window.addEventListener("popstate", p), () => {
46
+ document.removeEventListener("click", u, !0), document.removeEventListener("input", d, !0), window.removeEventListener("popstate", p);
47
+ };
48
+ }, [t]);
49
+ };
50
+ //#endregion
51
+ export { p as clearRecordedSteps, m as default, s as elementName, u as recordClick, d as recordInput, f as recordedSteps };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The element the person points at on the page, for a report: the next click on the page picks it — taken before the
3
+ * page sees it, so it neither presses anything nor counts as a step — and Escape stops pointing. A click in the dev
4
+ * tools is theirs, and goes on.
5
+ */
6
+ declare const usePointAt: () => {
7
+ pointing: boolean;
8
+ element?: string;
9
+ /** The last click was on nothing of the space's — the page's margin, a plugin's own drawing: said, not taken. */
10
+ missed: boolean;
11
+ point: () => void;
12
+ forget: () => void;
13
+ };
14
+ export default usePointAt;
@@ -0,0 +1,33 @@
1
+ import { elementName as e } from "./stepRecorder.mjs";
2
+ import { useCallback as t, useEffect as n, useState as r } from "react";
3
+ import { DEV_TOOLS_ATTRIBUTE as i } from "@plitzi/sdk-shared/devTools";
4
+ //#region src/components/DevToolsPanel/tabs/RunViewer/usePointAt.ts
5
+ var a = () => {
6
+ let [a, o] = r(!1), [s, c] = r(), [l, u] = r(!1);
7
+ return n(() => {
8
+ if (!a) return;
9
+ let t = (t) => {
10
+ if (t.target instanceof Element && t.target.closest(`[${i}]`)) return;
11
+ t.preventDefault(), t.stopPropagation();
12
+ let n = e(t.target);
13
+ c(n), u(n === void 0), o(!1);
14
+ }, n = (e) => {
15
+ e.key === "Escape" && o(!1);
16
+ };
17
+ return window.addEventListener("click", t, !0), window.addEventListener("keydown", n, !0), document.body.style.cursor = "crosshair", () => {
18
+ window.removeEventListener("click", t, !0), window.removeEventListener("keydown", n, !0), document.body.style.cursor = "";
19
+ };
20
+ }, [a]), {
21
+ pointing: a,
22
+ element: s,
23
+ missed: l,
24
+ point: t(() => {
25
+ u(!1), o(!0);
26
+ }, []),
27
+ forget: t(() => {
28
+ c(void 0), u(!1);
29
+ }, [])
30
+ };
31
+ };
32
+ //#endregion
33
+ export { a as default };
@@ -0,0 +1,9 @@
1
+ import { RunSnapshot } from '@plitzi/sdk-shared/runs';
2
+ /**
3
+ * The run of agents this page's server previews (`plitzi run preview`), as the CLI keeps it — asked for only when the
4
+ * server said it previews one (`previews`): any other server has no run, and asking it every few seconds left a 404 in
5
+ * the page's console each time. The Run tab is offered from the first run read, and stays: a run that finished, or a
6
+ * preview that stopped answering, leaves the last one read — never a tab that vanishes while it is read.
7
+ */
8
+ declare const useRunSnapshot: (previews: boolean) => RunSnapshot | undefined;
9
+ export default useRunSnapshot;
@@ -0,0 +1,22 @@
1
+ import { useEffect as e, useState as t } from "react";
2
+ import { RUN_STATUS_PATH as n, isRunSnapshot as r } from "@plitzi/sdk-shared/runs";
3
+ //#region src/components/DevToolsPanel/tabs/RunViewer/useRunSnapshot.ts
4
+ var i = 3e3, a = (a) => {
5
+ let [o, s] = t();
6
+ return e(() => {
7
+ if (!a || typeof window > "u") return;
8
+ let e = !1, t = async () => {
9
+ try {
10
+ let t = await fetch(n, { cache: "no-store" }), i = t.ok ? await t.json() : void 0;
11
+ !e && r(i) && s(i);
12
+ } catch {}
13
+ };
14
+ t();
15
+ let o = window.setInterval(() => void t(), i);
16
+ return () => {
17
+ e = !0, window.clearInterval(o);
18
+ };
19
+ }, [a]), o;
20
+ };
21
+ //#endregion
22
+ export { a as default };
@@ -1,7 +1,7 @@
1
1
  import { QaFindings } from './findings';
2
2
  import { QaCheck, QaSettings } from './qaSettings';
3
3
  import { XrayCounts } from './xray';
4
- import { ReactNode, RefObject } from 'react';
4
+ import { ReactNode } from 'react';
5
5
  export interface QaContextValue {
6
6
  settings: QaSettings;
7
7
  setSetting: <K extends Exclude<keyof QaSettings, 'checks'>>(key: K, value: QaSettings[K]) => void;
@@ -15,8 +15,6 @@ export interface QaContextValue {
15
15
  /** Bumped to make the checks look again. */
16
16
  round: number;
17
17
  rescan: () => void;
18
- /** The page's own box: what the tools draw over and what the checks look in — never the panel. */
19
- pageRef: RefObject<HTMLElement | null>;
20
18
  /** The element the inspector was clicked on, kept in the tab until another is. */
21
19
  pinned: Element | undefined;
22
20
  setPinned: (element: Element | undefined) => void;
@@ -24,10 +22,9 @@ export interface QaContextValue {
24
22
  declare const QaContext: import('react').Context<QaContextValue>;
25
23
  export type QaProviderProps = {
26
24
  children?: ReactNode;
27
- pageRef: RefObject<HTMLElement | null>;
28
25
  /** The panel is folded away: what works on the page's own clicks and marks its elements stops with it. */
29
26
  collapsed: boolean;
30
27
  };
31
28
  /** The QA tab's settings, kept in this browser, and what its checks found — shared by the tab and the layer. */
32
- export declare const QaProvider: ({ children, pageRef, collapsed }: QaProviderProps) => import('react').JSX.Element;
29
+ export declare const QaProvider: ({ children, collapsed }: QaProviderProps) => import('react').JSX.Element;
33
30
  export default QaContext;
@@ -15,63 +15,60 @@ var u = i({
15
15
  setXrayCounts: () => void 0,
16
16
  round: 0,
17
17
  rescan: () => void 0,
18
- pageRef: { current: null },
19
18
  pinned: void 0,
20
19
  setPinned: () => void 0
21
20
  });
22
21
  u.displayName = "QaContext";
23
- var d = ({ children: i, pageRef: d, collapsed: f }) => {
24
- let [p, m] = r("plitzi-sdk-dev-tools-qa", t), [h, g] = c(e), [_, v] = c(n), [y, b] = c(0), [x, S] = c(), C = s(() => ({
22
+ var d = ({ children: i, collapsed: d }) => {
23
+ let [f, p] = r("plitzi-sdk-dev-tools-qa", t), [m, h] = c(e), [g, _] = c(n), [v, y] = c(0), [b, x] = c(), S = s(() => ({
25
24
  ...t,
26
- ...p,
25
+ ...f,
27
26
  checks: {
28
27
  ...t.checks,
29
- ...p.checks
28
+ ...f.checks
30
29
  }
31
- }), [p]), w = a((e, t) => m((n) => ({
30
+ }), [f]), C = a((e, t) => p((n) => ({
32
31
  ...n,
33
32
  [e]: t
34
- })), [m]), T = a((e, n) => m((r) => ({
33
+ })), [p]), w = a((e, n) => p((r) => ({
35
34
  ...r,
36
35
  checks: {
37
36
  ...t.checks,
38
37
  ...r.checks,
39
38
  [e]: n
40
39
  }
41
- })), [m]), E = a(() => b((e) => e + 1), []);
40
+ })), [p]), T = a(() => y((e) => e + 1), []);
42
41
  o(() => {
43
- f && (m((e) => ({
42
+ d && (p((e) => ({
44
43
  ...e,
45
44
  inspect: !1,
46
45
  checks: t.checks
47
- })), S(void 0));
48
- }, [f, m]);
49
- let D = s(() => ({
50
- settings: C,
51
- setSetting: w,
52
- setCheck: T,
53
- findings: h,
54
- setFindings: g,
55
- xrayCounts: _,
56
- setXrayCounts: v,
57
- round: y,
58
- rescan: E,
59
- pageRef: d,
60
- pinned: x,
61
- setPinned: S
46
+ })), x(void 0));
47
+ }, [d, p]);
48
+ let E = s(() => ({
49
+ settings: S,
50
+ setSetting: C,
51
+ setCheck: w,
52
+ findings: m,
53
+ setFindings: h,
54
+ xrayCounts: g,
55
+ setXrayCounts: _,
56
+ round: v,
57
+ rescan: T,
58
+ pinned: b,
59
+ setPinned: x
62
60
  }), [
61
+ S,
63
62
  C,
64
63
  w,
64
+ m,
65
+ g,
66
+ v,
65
67
  T,
66
- h,
67
- _,
68
- y,
69
- E,
70
- d,
71
- x
68
+ b
72
69
  ]);
73
70
  return /* @__PURE__ */ l(u, {
74
- value: D,
71
+ value: E,
75
72
  children: i
76
73
  });
77
74
  };
@@ -1,63 +1,64 @@
1
- import { NO_FINDINGS as e } from "./findings.mjs";
2
- import { QA_CHECKS as t, QA_FINDING_ATTRIBUTE as n, QA_PAGE_ATTRIBUTE as r, REDUCED_MOTION_CLASS as i, isQaActive as a } from "./qaSettings.mjs";
3
- import { NO_XRAY_COUNTS as o, XRAY_ATTRIBUTE as s, xrayMarksOf as c } from "./xray.mjs";
4
- import l from "./QaContext.mjs";
5
- import { CHECKS as u } from "./checks/index.mjs";
6
- import d from "./overlays/QaGrid.mjs";
7
- import f from "./overlays/QaInspector.mjs";
8
- import p from "./overlays/QaTabOrder.mjs";
9
- import m from "./overlays/QaViewport.mjs";
10
- import h from "./overlays/QaXrayTags.mjs";
11
- import { VISION_MATRIX as g, qaCss as _, visionFilterId as v } from "./qaCss.mjs";
12
- import y from "./usePageBox.mjs";
13
- import { use as b, useEffect as x, useMemo as S } from "react";
14
- import { useCommonStore as C } from "@plitzi/sdk-shared/store";
15
- import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
16
- import { treeOf as D } from "@plitzi/sdk-schema";
1
+ import e from "../PageContext.mjs";
2
+ import { NO_FINDINGS as t } from "./findings.mjs";
3
+ import { QA_CHECKS as n, QA_FINDING_ATTRIBUTE as r, QA_PAGE_ATTRIBUTE as i, REDUCED_MOTION_CLASS as a, isQaActive as o } from "./qaSettings.mjs";
4
+ import { NO_XRAY_COUNTS as s, XRAY_ATTRIBUTE as c, xrayMarksOf as l } from "./xray.mjs";
5
+ import u from "./QaContext.mjs";
6
+ import { CHECKS as d } from "./checks/index.mjs";
7
+ import f from "./overlays/QaGrid.mjs";
8
+ import p from "./overlays/QaInspector.mjs";
9
+ import m from "./overlays/QaTabOrder.mjs";
10
+ import h from "./overlays/QaViewport.mjs";
11
+ import g from "./overlays/QaXrayTags.mjs";
12
+ import { VISION_MATRIX as _, qaCss as v, visionFilterId as y } from "./qaCss.mjs";
13
+ import b from "./usePageBox.mjs";
14
+ import { use as x, useEffect as S, useMemo as C } from "react";
15
+ import { useCommonStore as w } from "@plitzi/sdk-shared/store";
16
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
17
+ import { treeOf as O } from "@plitzi/sdk-schema";
17
18
  //#region src/qa/QaLayer.tsx
18
- var O = "http://www.w3.org/2000/svg", k = 250, A = 1e3, j = 200, M = .25, N = () => {
19
- let { settings: N, pageRef: P, round: F, setFindings: I, setXrayCounts: L } = b(l), [[R, z, B]] = C([
19
+ var k = "http://www.w3.org/2000/svg", A = 250, j = 1e3, M = 200, N = .25, P = () => {
20
+ let { settings: P, round: F, setFindings: I, setXrayCounts: L } = x(u), R = x(e), [[z, B, V]] = w([
20
21
  "navigation.currentPageId",
21
22
  "schema.flat",
22
23
  "schema.components"
23
- ]), V = y(P), H = a(N), U = S(() => _(N), [N]), W = S(() => t.filter((e) => N.checks[e]).join(" "), [N.checks]);
24
- return x(() => {
25
- let e = P.current;
26
- if (e && H) return e.setAttribute(r, ""), () => e.removeAttribute(r);
27
- }, [H, P]), x(() => {
28
- if (!U) return;
24
+ ]), H = b(R), U = o(P), W = C(() => v(P), [P]), G = C(() => n.filter((e) => P.checks[e]).join(" "), [P.checks]);
25
+ return S(() => {
26
+ let e = R.current;
27
+ if (e && U) return e.setAttribute(i, ""), () => e.removeAttribute(i);
28
+ }, [U, R]), S(() => {
29
+ if (!W) return;
29
30
  let e = document.createElement("style");
30
- return e.setAttribute("data-plitzi-qa", ""), e.textContent = U, document.head.append(e), () => e.remove();
31
- }, [U]), x(() => {
32
- if (N.reducedMotion) return document.documentElement.classList.add(i), () => document.documentElement.classList.remove(i);
33
- }, [N.reducedMotion]), x(() => {
34
- let e = N.vision;
31
+ return e.setAttribute("data-plitzi-qa", ""), e.textContent = W, document.head.append(e), () => e.remove();
32
+ }, [W]), S(() => {
33
+ if (P.reducedMotion) return document.documentElement.classList.add(a), () => document.documentElement.classList.remove(a);
34
+ }, [P.reducedMotion]), S(() => {
35
+ let e = P.vision;
35
36
  if (e !== "protanopia" && e !== "deuteranopia" && e !== "tritanopia") return;
36
- let t = document.createElementNS(O, "svg");
37
+ let t = document.createElementNS(k, "svg");
37
38
  t.setAttribute("aria-hidden", "true"), t.setAttribute("style", "position: absolute; width: 0; height: 0");
38
- let n = document.createElementNS(O, "filter");
39
- n.setAttribute("id", v(e));
40
- let r = document.createElementNS(O, "feColorMatrix");
41
- return r.setAttribute("type", "matrix"), r.setAttribute("values", g[e]), n.append(r), t.append(n), document.body.append(t), () => t.remove();
42
- }, [N.vision]), x(() => {
43
- let e = P.current;
44
- if (!e || !N.xray) {
45
- L(o);
39
+ let n = document.createElementNS(k, "filter");
40
+ n.setAttribute("id", y(e));
41
+ let r = document.createElementNS(k, "feColorMatrix");
42
+ return r.setAttribute("type", "matrix"), r.setAttribute("values", _[e]), n.append(r), t.append(n), document.body.append(t), () => t.remove();
43
+ }, [P.vision]), S(() => {
44
+ let e = R.current;
45
+ if (!e || !P.xray) {
46
+ L(s);
46
47
  return;
47
48
  }
48
49
  let t, n = () => {
49
- let t = { ...o };
50
+ let t = { ...s };
50
51
  e.querySelectorAll("[data-plitzi-el]").forEach((e) => {
51
- let n = e.getAttribute("data-plitzi-el") ?? "", r = D({
52
- flat: z,
53
- components: B
54
- }, n)?.flat[n]?.definition, i = r ? c(r) : [];
52
+ let n = e.getAttribute("data-plitzi-el") ?? "", r = O({
53
+ flat: B,
54
+ components: V
55
+ }, n)?.flat[n]?.definition, i = r ? l(r) : [];
55
56
  i.forEach((e) => {
56
57
  t[e] += 1;
57
- }), i.length === 0 ? e.removeAttribute(s) : e.getAttribute("data-plitzi-qa-xray") !== i.join(" ") && e.setAttribute(s, i.join(" "));
58
+ }), i.length === 0 ? e.removeAttribute(c) : e.getAttribute("data-plitzi-qa-xray") !== i.join(" ") && e.setAttribute(c, i.join(" "));
58
59
  }), L(t);
59
60
  }, r = () => {
60
- clearTimeout(t), t = setTimeout(n, j);
61
+ clearTimeout(t), t = setTimeout(n, M);
61
62
  };
62
63
  n();
63
64
  let i = new MutationObserver(r);
@@ -65,57 +66,57 @@ var O = "http://www.w3.org/2000/svg", k = 250, A = 1e3, j = 200, M = .25, N = ()
65
66
  childList: !0,
66
67
  subtree: !0
67
68
  }), () => {
68
- clearTimeout(t), i.disconnect(), e.querySelectorAll(`[${s}]`).forEach((e) => e.removeAttribute(s));
69
+ clearTimeout(t), i.disconnect(), e.querySelectorAll(`[${c}]`).forEach((e) => e.removeAttribute(c));
69
70
  };
70
71
  }, [
71
- N.xray,
72
- P,
73
- z,
74
- B,
72
+ P.xray,
75
73
  R,
74
+ B,
75
+ V,
76
+ z,
76
77
  L
77
- ]), x(() => {
78
- let e = P.current;
79
- if (!e || !N.slowMotion) return;
78
+ ]), S(() => {
79
+ let e = R.current;
80
+ if (!e || !P.slowMotion) return;
80
81
  let t = (t) => e.getAnimations({ subtree: !0 }).forEach((e) => {
81
82
  e.playbackRate = t;
82
- }), n = () => t(M);
83
+ }), n = () => t(N);
83
84
  return n(), e.addEventListener("animationstart", n), e.addEventListener("transitionrun", n), () => {
84
85
  e.removeEventListener("animationstart", n), e.removeEventListener("transitionrun", n), t(1);
85
86
  };
86
- }, [N.slowMotion, P]), x(() => {
87
- let r = P.current, i = t.filter((e) => W.split(" ").includes(e));
88
- if (!r || i.length === 0) {
89
- I(e);
87
+ }, [P.slowMotion, R]), S(() => {
88
+ let e = R.current, i = n.filter((e) => G.split(" ").includes(e));
89
+ if (!e || i.length === 0) {
90
+ I(t);
90
91
  return;
91
92
  }
92
93
  let a = [], o = () => {
93
- a.forEach((e) => e.removeAttribute(n));
94
- let t = { ...e };
95
- for (let e of i) t[e] = u[e].run(r);
94
+ a.forEach((e) => e.removeAttribute(r));
95
+ let n = { ...t };
96
+ for (let t of i) n[t] = d[t].run(e);
96
97
  let o = /* @__PURE__ */ new Map();
97
- i.forEach((e) => t[e].forEach(({ element: t }) => o.set(t, [...o.get(t) ?? [], e]))), o.forEach((e, t) => t.setAttribute(n, e.join(" "))), a = [...o.keys()], I(t);
98
+ i.forEach((e) => n[e].forEach(({ element: t }) => o.set(t, [...o.get(t) ?? [], e]))), o.forEach((e, t) => t.setAttribute(r, e.join(" "))), a = [...o.keys()], I(n);
98
99
  }, s, c, l = () => {
99
- typeof requestIdleCallback == "function" ? c = requestIdleCallback(o, { timeout: A }) : o();
100
- }, d = () => {
101
- clearTimeout(s), c !== void 0 && typeof cancelIdleCallback == "function" && cancelIdleCallback(c), s = setTimeout(l, k);
100
+ typeof requestIdleCallback == "function" ? c = requestIdleCallback(o, { timeout: j }) : o();
101
+ }, u = () => {
102
+ clearTimeout(s), c !== void 0 && typeof cancelIdleCallback == "function" && cancelIdleCallback(c), s = setTimeout(l, A);
102
103
  };
103
- return d(), window.addEventListener("resize", d), () => {
104
- clearTimeout(s), c !== void 0 && typeof cancelIdleCallback == "function" && cancelIdleCallback(c), window.removeEventListener("resize", d), a.forEach((e) => e.removeAttribute(n));
104
+ return u(), window.addEventListener("resize", u), () => {
105
+ clearTimeout(s), c !== void 0 && typeof cancelIdleCallback == "function" && cancelIdleCallback(c), window.removeEventListener("resize", u), a.forEach((e) => e.removeAttribute(r));
105
106
  };
106
107
  }, [
107
- W,
108
- P,
109
- F,
108
+ G,
110
109
  R,
110
+ F,
111
+ z,
111
112
  I
112
- ]), /* @__PURE__ */ E(w, { children: [
113
- N.grid && /* @__PURE__ */ T(d, { box: V }),
114
- N.xray && N.xrayFilter !== "none" && /* @__PURE__ */ T(h, { filter: N.xrayFilter }),
115
- N.tabOrder && /* @__PURE__ */ T(p, {}),
116
- N.inspect && /* @__PURE__ */ T(f, {}),
117
- N.viewport && /* @__PURE__ */ T(m, { box: V })
113
+ ]), /* @__PURE__ */ D(T, { children: [
114
+ P.grid && /* @__PURE__ */ E(f, { box: H }),
115
+ P.xray && P.xrayFilter !== "none" && /* @__PURE__ */ E(g, { filter: P.xrayFilter }),
116
+ P.tabOrder && /* @__PURE__ */ E(m, {}),
117
+ P.inspect && /* @__PURE__ */ E(p, {}),
118
+ P.viewport && /* @__PURE__ */ E(h, { box: H })
118
119
  ] });
119
120
  };
120
121
  //#endregion
121
- export { N as default };
122
+ export { P as default };
@@ -1,50 +1,51 @@
1
- import e from "../QaContext.mjs";
2
- import t from "./QaBoxModel.mjs";
3
- import n from "./QaMeasure.mjs";
4
- import r from "./QaTooltip.mjs";
5
- import { use as i, useEffect as a, useState as o } from "react";
6
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
1
+ import e from "../../PageContext.mjs";
2
+ import t from "../QaContext.mjs";
3
+ import n from "./QaBoxModel.mjs";
4
+ import r from "./QaMeasure.mjs";
5
+ import i from "./QaTooltip.mjs";
6
+ import { use as a, useEffect as o, useState as s } from "react";
7
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
7
8
  //#region src/qa/overlays/QaInspector.tsx
8
- var u = () => {
9
- let { pageRef: u, pinned: d, setPinned: f, setSetting: p } = i(e), [m, h] = o(), [g, _] = o(!1), [, v] = o(0);
10
- a(() => {
11
- let e = u.current;
9
+ var d = () => {
10
+ let { pinned: d, setPinned: f, setSetting: p } = a(t), m = a(e), [h, g] = s(), [_, v] = s(!1), [, y] = s(0);
11
+ o(() => {
12
+ let e = m.current;
12
13
  if (!e) return;
13
14
  let t = (t) => t instanceof Element && e.contains(t), n = 0, r = () => {
14
- cancelAnimationFrame(n), n = requestAnimationFrame(() => v((e) => e + 1));
15
+ cancelAnimationFrame(n), n = requestAnimationFrame(() => y((e) => e + 1));
15
16
  }, i = (e) => {
16
- _(e.altKey), h(t(e.target) ? e.target : void 0);
17
+ v(e.altKey), g(t(e.target) ? e.target : void 0);
17
18
  }, a = (e) => {
18
19
  t(e.target) && (e.preventDefault(), e.stopPropagation(), f(e.target));
19
20
  }, o = (e) => {
20
- _(e.altKey), e.type === "keydown" && e.key === "Escape" && p("inspect", !1);
21
+ v(e.altKey), e.type === "keydown" && e.key === "Escape" && p("inspect", !1);
21
22
  };
22
23
  return document.addEventListener("pointermove", i, !0), document.addEventListener("click", a, !0), document.addEventListener("keydown", o, !0), document.addEventListener("keyup", o, !0), document.addEventListener("scroll", r, !0), window.addEventListener("resize", r), () => {
23
24
  cancelAnimationFrame(n), document.removeEventListener("pointermove", i, !0), document.removeEventListener("click", a, !0), document.removeEventListener("keydown", o, !0), document.removeEventListener("keyup", o, !0), document.removeEventListener("scroll", r, !0), window.removeEventListener("resize", r);
24
25
  };
25
26
  }, [
26
- u,
27
+ m,
27
28
  f,
28
29
  p
29
30
  ]);
30
- let y = d?.isConnected ? d : void 0, b = y?.getBoundingClientRect();
31
- return /* @__PURE__ */ l(s, { children: [
32
- b && /* @__PURE__ */ c("div", {
31
+ let b = d?.isConnected ? d : void 0, x = b?.getBoundingClientRect();
32
+ return /* @__PURE__ */ u(c, { children: [
33
+ x && /* @__PURE__ */ l("div", {
33
34
  className: "pointer-events-none fixed z-[999998] box-border outline-2 outline-violet-500",
34
35
  style: {
35
- left: b.left,
36
- top: b.top,
37
- width: b.width,
38
- height: b.height
36
+ left: x.left,
37
+ top: x.top,
38
+ width: x.width,
39
+ height: x.height
39
40
  }
40
41
  }),
41
- m && m !== y && /* @__PURE__ */ c(t, { element: m }),
42
- y && m && m !== y && g && /* @__PURE__ */ c(n, {
43
- from: y,
44
- to: m
42
+ h && h !== b && /* @__PURE__ */ l(n, { element: h }),
43
+ b && h && h !== b && _ && /* @__PURE__ */ l(r, {
44
+ from: b,
45
+ to: h
45
46
  }),
46
- m && !g && /* @__PURE__ */ c(r, { element: m })
47
+ h && !_ && /* @__PURE__ */ l(i, { element: h })
47
48
  ] });
48
49
  };
49
50
  //#endregion
50
- export { u as default };
51
+ export { d as default };
@@ -1,10 +1,10 @@
1
- import e from "../QaContext.mjs";
1
+ import e from "../../PageContext.mjs";
2
2
  import { tabOrderOf as t } from "../tabOrder.mjs";
3
3
  import { use as n, useEffect as r, useState as i } from "react";
4
4
  import { Fragment as a, jsx as o } from "react/jsx-runtime";
5
5
  //#region src/qa/overlays/QaTabOrder.tsx
6
6
  var s = 200, c = () => {
7
- let { pageRef: c } = n(e), [l, u] = i([]), [, d] = i(0);
7
+ let c = n(e), [l, u] = i([]), [, d] = i(0);
8
8
  return r(() => {
9
9
  let e = c.current;
10
10
  if (!e) return;
@@ -1,58 +1,58 @@
1
- import { XRAY as e, XRAY_ATTRIBUTE as t, XRAY_MARKS as n } from "../xray.mjs";
2
- import r from "../QaContext.mjs";
1
+ import e from "../../PageContext.mjs";
2
+ import { XRAY as t, XRAY_ATTRIBUTE as n, XRAY_MARKS as r } from "../xray.mjs";
3
3
  import { use as i, useEffect as a, useState as o } from "react";
4
4
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
5
5
  //#region src/qa/overlays/QaXrayTags.tsx
6
- var u = 150, d = 16, f = (e) => n.some((t) => t === e), p = (e, n) => {
6
+ var u = 150, d = 16, f = (e) => r.some((t) => t === e), p = (e, t) => {
7
7
  let r = [], i = /* @__PURE__ */ new Set();
8
- for (let a of e.querySelectorAll(`[${t}]`)) {
8
+ for (let a of e.querySelectorAll(`[${n}]`)) {
9
9
  if (r.length >= u) break;
10
10
  let e = (a.getAttribute("data-plitzi-qa-xray") ?? "").split(" ").filter(f);
11
- if (n !== "all" && !e.includes(n)) continue;
12
- let t = a.getBoundingClientRect();
13
- if (t.width === 0 || t.bottom < 0 || t.top > window.innerHeight) continue;
14
- let o = (e) => `${String(Math.round(t.left))}:${String(Math.round(e))}`, s = t.top >= d ? t.top - d + 1 : Math.max(t.top, 0);
11
+ if (t !== "all" && !e.includes(t)) continue;
12
+ let n = a.getBoundingClientRect();
13
+ if (n.width === 0 || n.bottom < 0 || n.top > window.innerHeight) continue;
14
+ let o = (e) => `${String(Math.round(n.left))}:${String(Math.round(e))}`, s = n.top >= d ? n.top - d + 1 : Math.max(n.top, 0);
15
15
  for (let e = 0; e < 3 && i.has(o(s)); e += 1) s += d;
16
16
  i.has(o(s)) || (i.add(o(s)), r.push({
17
17
  id: a.getAttribute("data-plitzi-el") ?? "",
18
18
  marks: e,
19
- left: t.left,
19
+ left: n.left,
20
20
  top: s
21
21
  }));
22
22
  }
23
23
  return r;
24
- }, m = ({ filter: n }) => {
25
- let { pageRef: u } = i(r), [d, f] = o([]);
24
+ }, m = ({ filter: r }) => {
25
+ let u = i(e), [d, f] = o([]);
26
26
  return a(() => {
27
27
  let e = u.current;
28
28
  if (!e) return;
29
- let r = 0, i = () => {
30
- cancelAnimationFrame(r), r = requestAnimationFrame(() => f(p(e, n)));
29
+ let t = 0, i = () => {
30
+ cancelAnimationFrame(t), t = requestAnimationFrame(() => f(p(e, r)));
31
31
  };
32
32
  i();
33
33
  let a = new MutationObserver(i);
34
34
  return a.observe(e, {
35
35
  subtree: !0,
36
36
  attributes: !0,
37
- attributeFilter: [t]
37
+ attributeFilter: [n]
38
38
  }), document.addEventListener("scroll", i, !0), window.addEventListener("resize", i), () => {
39
- cancelAnimationFrame(r), a.disconnect(), document.removeEventListener("scroll", i, !0), window.removeEventListener("resize", i);
39
+ cancelAnimationFrame(t), a.disconnect(), document.removeEventListener("scroll", i, !0), window.removeEventListener("resize", i);
40
40
  };
41
- }, [u, n]), /* @__PURE__ */ c(s, { children: d.map(({ id: t, marks: n, left: r, top: i }) => /* @__PURE__ */ l("span", {
41
+ }, [u, r]), /* @__PURE__ */ c(s, { children: d.map(({ id: e, marks: n, left: r, top: i }) => /* @__PURE__ */ l("span", {
42
42
  className: "pointer-events-none fixed z-[999998] flex h-[15px] max-w-56 items-center gap-1 rounded-sm bg-zinc-900/85 px-1 font-mono text-[10px] leading-none text-white shadow-sm",
43
43
  style: {
44
44
  left: r,
45
45
  top: i
46
46
  },
47
- children: [n.map((t) => /* @__PURE__ */ c("span", {
48
- title: e[t].label,
47
+ children: [n.map((e) => /* @__PURE__ */ c("span", {
48
+ title: t[e].label,
49
49
  className: "h-1.5 w-1.5 shrink-0 rounded-full",
50
- style: { backgroundColor: e[t].colour }
51
- }, t)), /* @__PURE__ */ c("span", {
50
+ style: { backgroundColor: t[e].colour }
51
+ }, e)), /* @__PURE__ */ c("span", {
52
52
  className: "truncate",
53
- children: t
53
+ children: e
54
54
  })]
55
- }, `${t}-${String(r)}-${String(i)}`)) });
55
+ }, `${e}-${String(r)}-${String(i)}`)) });
56
56
  };
57
57
  //#endregion
58
58
  export { m as default };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The narrowest window a side panel leaves a page beside it: the panel takes 500 px at least, and a page narrower than
3
+ * a phone's 400 is no page to work on — at 390 the side panel ran off the screen and covered the page whole.
4
+ */
5
+ export declare const SIDE_PANEL_WINDOW_MIN = 900;
6
+ /** Whether the window is too narrow for the panel beside the page — it docks at the bottom then — following it live. */
7
+ declare const useNarrowWindow: () => boolean;
8
+ export default useNarrowWindow;