@plitzi/sdk-dev-tools 0.38.24 → 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.
- package/CHANGELOG.md +152 -1
- package/dist/DevToolsContainer.d.ts +11 -1
- package/dist/DevToolsContainer.mjs +68 -62
- package/dist/DevToolsContextProvider.mjs +5 -3
- package/dist/PageContext.d.ts +7 -0
- package/dist/PageContext.mjs +6 -0
- package/dist/agentInspector/flowRuns.d.ts +1 -1
- package/dist/agentInspector/flowRuns.mjs +22 -15
- package/dist/agentInspector/index.d.ts +2 -0
- package/dist/agentInspector/index.mjs +1 -0
- package/dist/agentInspector/inspector.d.ts +31 -1
- package/dist/agentInspector/inspector.mjs +57 -19
- package/dist/agentInspector/report.d.ts +27 -2
- package/dist/agentInspector/report.mjs +59 -38
- package/dist/agentInspector/useAgentInspector.d.ts +3 -2
- package/dist/agentInspector/useAgentInspector.mjs +20 -16
- package/dist/components/DevToolsOverlay/DevToolsOverlay.d.ts +3 -4
- package/dist/components/DevToolsOverlay/DevToolsOverlay.mjs +4 -4
- package/dist/components/DevToolsPanel/DevToolsBody.d.ts +4 -1
- package/dist/components/DevToolsPanel/DevToolsBody.mjs +33 -31
- package/dist/components/DevToolsPanel/DevToolsButton.d.ts +3 -1
- package/dist/components/DevToolsPanel/DevToolsButton.mjs +4 -3
- package/dist/components/DevToolsPanel/DevToolsHeader.d.ts +3 -1
- package/dist/components/DevToolsPanel/DevToolsHeader.mjs +52 -34
- package/dist/components/DevToolsPanel/DevToolsPanel.d.ts +3 -1
- package/dist/components/DevToolsPanel/DevToolsPanel.mjs +50 -47
- package/dist/components/DevToolsPanel/tabs/QaViewer/QaReplayButton.mjs +2 -2
- package/dist/components/DevToolsPanel/tabs/RunViewer/RunReport.d.ts +7 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/RunReport.mjs +97 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/RunTaskRow.d.ts +6 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/RunTaskRow.mjs +79 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/RunViewer.d.ts +11 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/RunViewer.mjs +222 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/index.d.ts +3 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/index.mjs +6 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/reportHelpers.d.ts +9 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/reportHelpers.mjs +39 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/stepRecorder.d.ts +27 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/stepRecorder.mjs +51 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/usePointAt.d.ts +14 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/usePointAt.mjs +33 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/useRunSnapshot.d.ts +9 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/useRunSnapshot.mjs +22 -0
- package/dist/qa/QaContext.d.ts +2 -5
- package/dist/qa/QaContext.mjs +28 -31
- package/dist/qa/QaLayer.mjs +78 -77
- package/dist/qa/overlays/QaInspector.mjs +28 -27
- package/dist/qa/overlays/QaTabOrder.mjs +2 -2
- package/dist/qa/overlays/QaXrayTags.mjs +22 -22
- package/dist/useNarrowWindow.d.ts +8 -0
- package/dist/useNarrowWindow.mjs +13 -0
- 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 };
|
package/dist/qa/QaContext.d.ts
CHANGED
|
@@ -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
|
|
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,
|
|
29
|
+
export declare const QaProvider: ({ children, collapsed }: QaProviderProps) => import('react').JSX.Element;
|
|
33
30
|
export default QaContext;
|
package/dist/qa/QaContext.mjs
CHANGED
|
@@ -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,
|
|
24
|
-
let [
|
|
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
|
-
...
|
|
25
|
+
...f,
|
|
27
26
|
checks: {
|
|
28
27
|
...t.checks,
|
|
29
|
-
...
|
|
28
|
+
...f.checks
|
|
30
29
|
}
|
|
31
|
-
}), [
|
|
30
|
+
}), [f]), C = a((e, t) => p((n) => ({
|
|
32
31
|
...n,
|
|
33
32
|
[e]: t
|
|
34
|
-
})), [
|
|
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
|
-
})), [
|
|
40
|
+
})), [p]), T = a(() => y((e) => e + 1), []);
|
|
42
41
|
o(() => {
|
|
43
|
-
|
|
42
|
+
d && (p((e) => ({
|
|
44
43
|
...e,
|
|
45
44
|
inspect: !1,
|
|
46
45
|
checks: t.checks
|
|
47
|
-
})),
|
|
48
|
-
}, [
|
|
49
|
-
let
|
|
50
|
-
settings:
|
|
51
|
-
setSetting:
|
|
52
|
-
setCheck:
|
|
53
|
-
findings:
|
|
54
|
-
setFindings:
|
|
55
|
-
xrayCounts:
|
|
56
|
-
setXrayCounts:
|
|
57
|
-
round:
|
|
58
|
-
rescan:
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
67
|
-
_,
|
|
68
|
-
y,
|
|
69
|
-
E,
|
|
70
|
-
d,
|
|
71
|
-
x
|
|
68
|
+
b
|
|
72
69
|
]);
|
|
73
70
|
return /* @__PURE__ */ l(u, {
|
|
74
|
-
value:
|
|
71
|
+
value: E,
|
|
75
72
|
children: i
|
|
76
73
|
});
|
|
77
74
|
};
|
package/dist/qa/QaLayer.mjs
CHANGED
|
@@ -1,63 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import l from "./
|
|
5
|
-
import
|
|
6
|
-
import d from "./
|
|
7
|
-
import f from "./overlays/
|
|
8
|
-
import p from "./overlays/
|
|
9
|
-
import m from "./overlays/
|
|
10
|
-
import h from "./overlays/
|
|
11
|
-
import
|
|
12
|
-
import y from "./
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
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
|
|
19
|
-
let { settings:
|
|
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
|
-
]),
|
|
24
|
-
return
|
|
25
|
-
let e =
|
|
26
|
-
if (e &&
|
|
27
|
-
}, [
|
|
28
|
-
if (!
|
|
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 =
|
|
31
|
-
}, [
|
|
32
|
-
if (
|
|
33
|
-
}, [
|
|
34
|
-
let e =
|
|
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(
|
|
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(
|
|
39
|
-
n.setAttribute("id",
|
|
40
|
-
let r = document.createElementNS(
|
|
41
|
-
return r.setAttribute("type", "matrix"), r.setAttribute("values",
|
|
42
|
-
}, [
|
|
43
|
-
let e =
|
|
44
|
-
if (!e || !
|
|
45
|
-
L(
|
|
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 = { ...
|
|
50
|
+
let t = { ...s };
|
|
50
51
|
e.querySelectorAll("[data-plitzi-el]").forEach((e) => {
|
|
51
|
-
let n = e.getAttribute("data-plitzi-el") ?? "", r =
|
|
52
|
-
flat:
|
|
53
|
-
components:
|
|
54
|
-
}, n)?.flat[n]?.definition, i = 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(
|
|
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,
|
|
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(`[${
|
|
69
|
+
clearTimeout(t), i.disconnect(), e.querySelectorAll(`[${c}]`).forEach((e) => e.removeAttribute(c));
|
|
69
70
|
};
|
|
70
71
|
}, [
|
|
71
|
-
|
|
72
|
-
P,
|
|
73
|
-
z,
|
|
74
|
-
B,
|
|
72
|
+
P.xray,
|
|
75
73
|
R,
|
|
74
|
+
B,
|
|
75
|
+
V,
|
|
76
|
+
z,
|
|
76
77
|
L
|
|
77
|
-
]),
|
|
78
|
-
let e =
|
|
79
|
-
if (!e || !
|
|
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(
|
|
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
|
-
}, [
|
|
87
|
-
let
|
|
88
|
-
if (!
|
|
89
|
-
I(
|
|
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(
|
|
94
|
-
let
|
|
95
|
-
for (let
|
|
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) =>
|
|
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:
|
|
100
|
-
},
|
|
101
|
-
clearTimeout(s), c !== void 0 && typeof cancelIdleCallback == "function" && cancelIdleCallback(c), s = setTimeout(l,
|
|
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
|
|
104
|
-
clearTimeout(s), c !== void 0 && typeof cancelIdleCallback == "function" && cancelIdleCallback(c), window.removeEventListener("resize",
|
|
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
|
-
|
|
108
|
-
P,
|
|
109
|
-
F,
|
|
108
|
+
G,
|
|
110
109
|
R,
|
|
110
|
+
F,
|
|
111
|
+
z,
|
|
111
112
|
I
|
|
112
|
-
]), /* @__PURE__ */
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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 {
|
|
122
|
+
export { P as default };
|
|
@@ -1,50 +1,51 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "./
|
|
4
|
-
import r from "./
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
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
|
|
9
|
-
let {
|
|
10
|
-
|
|
11
|
-
let e =
|
|
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(() =>
|
|
15
|
+
cancelAnimationFrame(n), n = requestAnimationFrame(() => y((e) => e + 1));
|
|
15
16
|
}, i = (e) => {
|
|
16
|
-
|
|
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
|
-
|
|
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
|
-
|
|
27
|
+
m,
|
|
27
28
|
f,
|
|
28
29
|
p
|
|
29
30
|
]);
|
|
30
|
-
let
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
|
|
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:
|
|
36
|
-
top:
|
|
37
|
-
width:
|
|
38
|
-
height:
|
|
36
|
+
left: x.left,
|
|
37
|
+
top: x.top,
|
|
38
|
+
width: x.width,
|
|
39
|
+
height: x.height
|
|
39
40
|
}
|
|
40
41
|
}),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
from:
|
|
44
|
-
to:
|
|
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
|
-
|
|
47
|
+
h && !_ && /* @__PURE__ */ l(i, { element: h })
|
|
47
48
|
] });
|
|
48
49
|
};
|
|
49
50
|
//#endregion
|
|
50
|
-
export {
|
|
51
|
+
export { d as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import e from "
|
|
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
|
|
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
|
|
2
|
-
import r from "../
|
|
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) =>
|
|
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(`[${
|
|
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 (
|
|
12
|
-
let
|
|
13
|
-
if (
|
|
14
|
-
let o = (e) => `${String(Math.round(
|
|
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:
|
|
19
|
+
left: n.left,
|
|
20
20
|
top: s
|
|
21
21
|
}));
|
|
22
22
|
}
|
|
23
23
|
return r;
|
|
24
|
-
}, m = ({ filter:
|
|
25
|
-
let
|
|
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
|
|
30
|
-
cancelAnimationFrame(
|
|
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: [
|
|
37
|
+
attributeFilter: [n]
|
|
38
38
|
}), document.addEventListener("scroll", i, !0), window.addEventListener("resize", i), () => {
|
|
39
|
-
cancelAnimationFrame(
|
|
39
|
+
cancelAnimationFrame(t), a.disconnect(), document.removeEventListener("scroll", i, !0), window.removeEventListener("resize", i);
|
|
40
40
|
};
|
|
41
|
-
}, [u,
|
|
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((
|
|
48
|
-
title: e
|
|
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
|
|
51
|
-
},
|
|
50
|
+
style: { backgroundColor: t[e].colour }
|
|
51
|
+
}, e)), /* @__PURE__ */ c("span", {
|
|
52
52
|
className: "truncate",
|
|
53
|
-
children:
|
|
53
|
+
children: e
|
|
54
54
|
})]
|
|
55
|
-
}, `${
|
|
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;
|