@blackbelt-technology/frontend-mockup-loop 0.11.0 → 0.12.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/.pi/skills/frontend-mockup-loop/SKILL.md +87 -8
- package/README.md +47 -2
- package/package.json +43 -4
- package/references/live-mock-site.md +332 -0
- package/site/Site.tsx +627 -0
- package/site/clock.ts +39 -0
- package/site/fixtures.ts +144 -0
- package/site/frame-env.ts +59 -0
- package/site/kit.tsx +175 -0
- package/site/main.tsx +11 -0
- package/site/pane-runtime.ts +230 -0
- package/site/pane-scroll-guard.ts +70 -0
- package/site/ring-line.ts +100 -0
- package/site/script.ts +201 -0
- package/site/site.css +179 -0
- package/site/step-gate.ts +138 -0
- package/site/tsconfig.json +16 -0
- package/site/virtual.d.ts +16 -0
- package/src/extension.ts +189 -58
- package/src/mock-site/base.d.mts +2 -0
- package/src/mock-site/base.mjs +28 -0
- package/src/mock-site/browser.d.mts +8 -0
- package/src/mock-site/browser.mjs +72 -0
- package/src/mock-site/capture.d.mts +8 -0
- package/src/mock-site/capture.mjs +221 -0
- package/src/mock-site/check.mjs +8 -0
- package/src/mock-site/cli.d.mts +3 -0
- package/src/mock-site/cli.mjs +96 -0
- package/src/mock-site/decisions.d.mts +6 -0
- package/src/mock-site/decisions.mjs +71 -0
- package/src/mock-site/discover.d.mts +7 -0
- package/src/mock-site/discover.mjs +137 -0
- package/src/mock-site/env.d.mts +15 -0
- package/src/mock-site/env.mjs +228 -0
- package/src/mock-site/frameworks.d.mts +5 -0
- package/src/mock-site/frameworks.mjs +27 -0
- package/src/mock-site/headless.d.mts +9 -0
- package/src/mock-site/headless.mjs +207 -0
- package/src/mock-site/locate.d.mts +3 -0
- package/src/mock-site/locate.mjs +30 -0
- package/src/mock-site/options.d.mts +19 -0
- package/src/mock-site/options.mjs +45 -0
- package/src/mock-site/plugin.d.mts +21 -0
- package/src/mock-site/plugin.mjs +191 -0
- package/src/mock-site/refs.d.mts +7 -0
- package/src/mock-site/refs.mjs +65 -0
- package/src/mock-site/serve-cli.mjs +43 -0
- package/src/mock-site/video.mjs +8 -0
- package/src/mock-site-serve.ts +186 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// GENERIC pane scroll guard (side-effect module, imported FIRST by main.tsx). In an
|
|
2
|
+
// embedded `?pane=` document, nothing the runner or a mocked component does may scroll
|
|
3
|
+
// the reviewer's page: native focus / scrollIntoView scroll every ancestor scrollport,
|
|
4
|
+
// including the host page. Patched (only methods that exist):
|
|
5
|
+
// - HTMLElement / SVGElement `focus`: always `preventScroll: true`, then reveal in the pane
|
|
6
|
+
// unless the caller asked for `preventScroll: true`;
|
|
7
|
+
// - `scrollIntoView` / `scrollIntoViewIfNeeded`: reveal in the pane only.
|
|
8
|
+
// Reveal scrolls in-pane scroll containers, then the pane window; never an ancestor
|
|
9
|
+
// document. Top-level `?pane=` documents (headless check / video) keep native scrolling.
|
|
10
|
+
// See change: mock-player-step-controls (design D1).
|
|
11
|
+
|
|
12
|
+
type Align = "start" | "center" | "end" | "nearest";
|
|
13
|
+
type Win = Window & typeof globalThis;
|
|
14
|
+
|
|
15
|
+
/** Scroll offset that brings [a, b] (relative to the scrollport start) into a port of `size`. */
|
|
16
|
+
function delta(a: number, b: number, size: number, align: Align): number {
|
|
17
|
+
if (align === "start") return a;
|
|
18
|
+
if (align === "end") return b - size;
|
|
19
|
+
if (align === "center") return (a + b) / 2 - size / 2;
|
|
20
|
+
if (a >= 0 && b <= size) return 0;
|
|
21
|
+
if (a < 0 && b > size) return 0;
|
|
22
|
+
return a < 0 || b - a > size ? a : b - size;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Reveal `el` inside its own document: scrollable ancestors first, then the window. */
|
|
26
|
+
function reveal(win: Win, el: Element, block: Align, inline: Align): void {
|
|
27
|
+
const doc = el.ownerDocument;
|
|
28
|
+
for (let p = el.parentElement; p && p !== doc.body && p !== doc.documentElement; p = p.parentElement) {
|
|
29
|
+
const cs = win.getComputedStyle(p);
|
|
30
|
+
const sy = cs.overflowY !== "visible" && p.scrollHeight > p.clientHeight;
|
|
31
|
+
const sx = cs.overflowX !== "visible" && p.scrollWidth > p.clientWidth;
|
|
32
|
+
if (!sy && !sx) continue;
|
|
33
|
+
const box = p.getBoundingClientRect();
|
|
34
|
+
const r = el.getBoundingClientRect();
|
|
35
|
+
const top = box.top + p.clientTop;
|
|
36
|
+
const left = box.left + p.clientLeft;
|
|
37
|
+
if (sy) p.scrollTop += delta(r.top - top, r.bottom - top, p.clientHeight, block);
|
|
38
|
+
if (sx) p.scrollLeft += delta(r.left - left, r.right - left, p.clientWidth, inline);
|
|
39
|
+
}
|
|
40
|
+
const r = el.getBoundingClientRect();
|
|
41
|
+
const dy = delta(r.top, r.bottom, win.innerHeight, block);
|
|
42
|
+
const dx = delta(r.left, r.right, win.innerWidth, inline);
|
|
43
|
+
if (dx || dy) win.scrollTo(win.scrollX + dx, win.scrollY + dy);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const blockOf = (arg: unknown): Align =>
|
|
47
|
+
arg === false ? "end" : typeof arg === "object" && arg !== null ? ((arg as ScrollIntoViewOptions).block ?? "start") : "start";
|
|
48
|
+
|
|
49
|
+
/** Install the guard on `win` when it is an embedded `?pane=` document. Returns whether it did. */
|
|
50
|
+
export function installPaneScrollGuard(win: Win): boolean {
|
|
51
|
+
if (!new URLSearchParams(win.location.search).has("pane") || win.parent === win) return false;
|
|
52
|
+
for (const proto of [win.HTMLElement?.prototype, win.SVGElement?.prototype]) {
|
|
53
|
+
const focus = proto?.focus;
|
|
54
|
+
if (typeof focus !== "function") continue;
|
|
55
|
+
proto.focus = function (this: HTMLElement, opts?: FocusOptions) {
|
|
56
|
+
focus.call(this, { ...opts, preventScroll: true });
|
|
57
|
+
if (opts?.preventScroll !== true && this.ownerDocument.activeElement === this) reveal(win, this, "nearest", "nearest");
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const el = win.Element.prototype as Element & { scrollIntoViewIfNeeded?: (center?: boolean) => void };
|
|
61
|
+
if (typeof el.scrollIntoView === "function") {
|
|
62
|
+
el.scrollIntoView = function (this: Element, arg?: boolean | ScrollIntoViewOptions) { reveal(win, this, blockOf(arg), "nearest"); };
|
|
63
|
+
}
|
|
64
|
+
if (typeof el.scrollIntoViewIfNeeded === "function") {
|
|
65
|
+
el.scrollIntoViewIfNeeded = function (this: Element) { reveal(win, this, "nearest", "nearest"); };
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
installPaneScrollGuard(window as Win);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// GENERIC ring line clamp (framework-free). The line is a positioned child of the ring
|
|
2
|
+
// (`.mk-ring-line`, 2px stroke 2px out) so it scrolls / transforms with its part natively.
|
|
3
|
+
// Per side, its inset is reduced so the line stays inside every clipping ancestor's
|
|
4
|
+
// scroll-content box and the document's: it never adds scrollable overflow and a pane
|
|
5
|
+
// edge never cuts it. Recomputed only on layout change (ResizeObserver / MutationObserver),
|
|
6
|
+
// never on scroll or per frame; observers are off while Highlights is off.
|
|
7
|
+
// See change: add-mock-locate-frame (design D5).
|
|
8
|
+
|
|
9
|
+
/** Gap (2px) + stroke (2px): the line's outward reach at rest. */
|
|
10
|
+
const REACH = 4;
|
|
11
|
+
const MEASURING = "mk-ring-measure";
|
|
12
|
+
|
|
13
|
+
const clips = (cs: CSSStyleDeclaration) =>
|
|
14
|
+
cs.overflowX !== "visible" || cs.overflowY !== "visible" || /paint|strict|content/.test(cs.contain || "") || (!!cs.clipPath && cs.clipPath !== "none");
|
|
15
|
+
|
|
16
|
+
/** Ancestors of `ring` that clip their content (body / root excluded: the document box covers them). */
|
|
17
|
+
function clipAncestors(ring: Element): Element[] {
|
|
18
|
+
const doc = ring.ownerDocument;
|
|
19
|
+
const win = doc.defaultView!;
|
|
20
|
+
const out: Element[] = [];
|
|
21
|
+
for (let a = ring.parentElement; a && a !== doc.body && a !== doc.documentElement; a = a.parentElement) if (clips(win.getComputedStyle(a))) out.push(a);
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Set the line's per-side inset: -4px where there is room, down to 0 (inside the part's edge) where an edge would cut it. */
|
|
26
|
+
function clampRingLine(ring: Element, line: HTMLElement): void {
|
|
27
|
+
const doc = ring.ownerDocument;
|
|
28
|
+
const win = doc.defaultView!;
|
|
29
|
+
const root = doc.documentElement;
|
|
30
|
+
root.classList.add(MEASURING); // no line counts toward any scroll size while measuring
|
|
31
|
+
try {
|
|
32
|
+
const r = ring.getBoundingClientRect();
|
|
33
|
+
let L = -win.scrollX, T = -win.scrollY;
|
|
34
|
+
let R = root.scrollWidth - win.scrollX, B = root.scrollHeight - win.scrollY;
|
|
35
|
+
for (const a of clipAncestors(ring)) {
|
|
36
|
+
const b = a.getBoundingClientRect();
|
|
37
|
+
// client / scroll sizes are untransformed: scale them into the viewport space of the rects
|
|
38
|
+
const sx = (a as HTMLElement).offsetWidth ? b.width / (a as HTMLElement).offsetWidth : 1;
|
|
39
|
+
const sy = (a as HTMLElement).offsetHeight ? b.height / (a as HTMLElement).offsetHeight : 1;
|
|
40
|
+
const l = b.left + (a.clientLeft - a.scrollLeft) * sx;
|
|
41
|
+
const t = b.top + (a.clientTop - a.scrollTop) * sy;
|
|
42
|
+
L = Math.max(L, l); T = Math.max(T, t);
|
|
43
|
+
R = Math.min(R, l + Math.max(a.scrollWidth, a.clientWidth) * sx);
|
|
44
|
+
B = Math.min(B, t + Math.max(a.scrollHeight, a.clientHeight) * sy);
|
|
45
|
+
}
|
|
46
|
+
// room is in viewport px; the inset is in the ring's own (possibly scaled) px
|
|
47
|
+
const ex = (ring as HTMLElement).offsetWidth ? r.width / (ring as HTMLElement).offsetWidth : 1;
|
|
48
|
+
const ey = (ring as HTMLElement).offsetHeight ? r.height / (ring as HTMLElement).offsetHeight : 1;
|
|
49
|
+
const inset = (room: number, e: number) => `${-Math.min(REACH, Math.max(0, Math.floor(room / (e || 1))))}px`;
|
|
50
|
+
const side = (room: number, vertical = false) => inset(room, vertical ? ey : ex);
|
|
51
|
+
line.style.inset = `${side(r.top - T, true)} ${side(R - r.right)} ${side(B - r.bottom, true)} ${side(r.left - L)}`;
|
|
52
|
+
} finally {
|
|
53
|
+
root.classList.remove(MEASURING);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** One `mk-no-rings` watcher per document, shared by every ring. */
|
|
58
|
+
const toggles = new WeakMap<Document, Set<() => void>>();
|
|
59
|
+
function onRingsToggle(doc: Document, fn: () => void): () => void {
|
|
60
|
+
let set = toggles.get(doc);
|
|
61
|
+
if (!set) {
|
|
62
|
+
const s = new Set<() => void>();
|
|
63
|
+
set = s;
|
|
64
|
+
toggles.set(doc, s);
|
|
65
|
+
let on = !doc.documentElement.classList.contains("mk-no-rings");
|
|
66
|
+
new MutationObserver(() => {
|
|
67
|
+
const now = !doc.documentElement.classList.contains("mk-no-rings");
|
|
68
|
+
if (now !== on) { on = now; for (const f of s) f(); }
|
|
69
|
+
}).observe(doc.documentElement, { attributes: true, attributeFilter: ["class"] });
|
|
70
|
+
}
|
|
71
|
+
set.add(fn);
|
|
72
|
+
return () => { set.delete(fn); };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Clamp now (before paint when called from a layout effect) and on every layout change while Highlights is on. */
|
|
76
|
+
export function watchRingLine(ring: HTMLElement, line: HTMLElement): () => void {
|
|
77
|
+
const doc = ring.ownerDocument;
|
|
78
|
+
const win = doc.defaultView!;
|
|
79
|
+
let ro: ResizeObserver | null = null;
|
|
80
|
+
let mo: MutationObserver | null = null;
|
|
81
|
+
const clamp = () => clampRingLine(ring, line);
|
|
82
|
+
const start = () => {
|
|
83
|
+
if (ro) return;
|
|
84
|
+
clamp();
|
|
85
|
+
ro = new win.ResizeObserver(clamp);
|
|
86
|
+
for (const el of [ring, ...clipAncestors(ring), doc.documentElement]) ro.observe(el);
|
|
87
|
+
// childList, and class / style changes that can move a part without resizing it (margin, position);
|
|
88
|
+
// the line's own inset writes are ignored, so a clamp never re-triggers itself
|
|
89
|
+
mo = new win.MutationObserver((recs) => { if (recs.some((m) => !(m.target as Element).classList?.contains("mk-ring-line"))) clamp(); });
|
|
90
|
+
mo.observe(ring.closest(".mk-canvas") ?? doc.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["class", "style"] });
|
|
91
|
+
};
|
|
92
|
+
const stop = () => { ro?.disconnect(); mo?.disconnect(); ro = null; mo = null; };
|
|
93
|
+
// Observe while Highlights is on, or while the ring has focus (focus shows the line with Highlights off).
|
|
94
|
+
const sync = () => (doc.documentElement.classList.contains("mk-no-rings") && doc.activeElement !== ring ? stop() : start());
|
|
95
|
+
sync();
|
|
96
|
+
const off = onRingsToggle(doc, sync);
|
|
97
|
+
ring.addEventListener("focus", sync);
|
|
98
|
+
ring.addEventListener("blur", sync);
|
|
99
|
+
return () => { stop(); off(); ring.removeEventListener("focus", sync); ring.removeEventListener("blur", sync); };
|
|
100
|
+
}
|
package/site/script.ts
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// GENERIC script runner (framework-free): drives a frame's `script` on the REAL
|
|
2
|
+
// rendered DOM of one pane document with Testing Library user-event, behind a
|
|
3
|
+
// visible pointer + caption overlay. Bounded waits; `unless` skips a step whose
|
|
4
|
+
// goal already holds, `expect` must hold after the act. `spot` dims the pane around
|
|
5
|
+
// its target and labels it ("You are here") until the pane remounts.
|
|
6
|
+
// See change: add-mock-site-exact-env (design D4, D5), add-mock-locate-frame (D3).
|
|
7
|
+
|
|
8
|
+
export interface ScriptStep {
|
|
9
|
+
/** Caption shown while the step runs. */
|
|
10
|
+
say: string;
|
|
11
|
+
/** Test id (tried first) or CSS selector. Required except for a plain `wait` with `expect`. */
|
|
12
|
+
target?: string;
|
|
13
|
+
act: "click" | "type" | "clear" | "hover" | "press" | "wait" | "spot";
|
|
14
|
+
/** Text for `type`. */
|
|
15
|
+
text?: string;
|
|
16
|
+
/** Key for `press`, e.g. "Enter" or "{Control>}a{/Control}". */
|
|
17
|
+
key?: string;
|
|
18
|
+
/** Skip the step when this holds (selector present, or a check). */
|
|
19
|
+
unless?: string | ((doc: Document) => boolean);
|
|
20
|
+
/** Must hold within the timeout after the act. */
|
|
21
|
+
expect?: string | ((doc: Document) => boolean);
|
|
22
|
+
/** Per-step wait budget in ms (default 4000). */
|
|
23
|
+
timeout?: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const DEFAULT_STEP_TIMEOUT = 4000;
|
|
27
|
+
const POLL_MS = 50;
|
|
28
|
+
const MOVE_MS = 450;
|
|
29
|
+
const TYPE_DELAY_MS = 70;
|
|
30
|
+
/** A visible step lasts at least this long, so its caption can be read. */
|
|
31
|
+
const MIN_STEP_MS = 700;
|
|
32
|
+
|
|
33
|
+
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
|
34
|
+
|
|
35
|
+
/** First element for a target: `[data-testid=…]` first, then as a CSS selector. */
|
|
36
|
+
function findTarget(doc: Document, target: string): Element | null {
|
|
37
|
+
const byId = doc.querySelector(`[data-testid="${CSS.escape(target)}"]`);
|
|
38
|
+
if (byId) return byId;
|
|
39
|
+
try { return doc.querySelector(target); } catch { return null; }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const holds = (doc: Document, c: string | ((d: Document) => boolean)) => (typeof c === "string" ? !!findTarget(doc, c) : !!c(doc));
|
|
43
|
+
const describe = (c: string | ((d: Document) => boolean)) => (typeof c === "string" ? `\`${c}\`` : "check");
|
|
44
|
+
|
|
45
|
+
async function waitFor<T>(fn: () => T | null | false, timeout: number, signal?: AbortSignal): Promise<T | null> {
|
|
46
|
+
const end = Date.now() + timeout;
|
|
47
|
+
for (;;) {
|
|
48
|
+
const v = fn();
|
|
49
|
+
if (v) return v;
|
|
50
|
+
if (Date.now() >= end || signal?.aborted) return null;
|
|
51
|
+
await sleep(POLL_MS);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Remove the spotlight of a `spot` step (and its listeners) from `doc`. */
|
|
56
|
+
function clearSpot(doc: Document): void {
|
|
57
|
+
for (const el of Array.from(doc.querySelectorAll<HTMLElement & { mkOff?: () => void }>(".mk-spot"))) { el.mkOff?.(); el.remove(); }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Spotlight over `target`: dims the rest of the pane, rings the target, labels it. Never interactive; follows the target. */
|
|
61
|
+
function showSpot(doc: Document, target: Element, say: string): void {
|
|
62
|
+
clearSpot(doc);
|
|
63
|
+
const win = doc.defaultView!;
|
|
64
|
+
const spot = doc.createElement("div") as HTMLDivElement & { mkOff?: () => void };
|
|
65
|
+
spot.className = "mk-spot";
|
|
66
|
+
spot.style.pointerEvents = "none";
|
|
67
|
+
spot.setAttribute("aria-hidden", "true");
|
|
68
|
+
const label = doc.createElement("span");
|
|
69
|
+
label.className = "mk-spot-label";
|
|
70
|
+
label.textContent = `You are here: ${say}`;
|
|
71
|
+
spot.append(label);
|
|
72
|
+
spot.style.borderRadius = win.getComputedStyle(target).borderRadius || "0";
|
|
73
|
+
const place = () => {
|
|
74
|
+
const b = target.getBoundingClientRect();
|
|
75
|
+
Object.assign(spot.style, { left: `${b.left}px`, top: `${b.top}px`, width: `${b.width}px`, height: `${b.height}px` });
|
|
76
|
+
// label above; else below; else (target fills the pane) inside its top edge
|
|
77
|
+
const above = b.top >= 32, below = b.bottom + 32 <= win.innerHeight;
|
|
78
|
+
spot.classList.toggle("mk-spot-below", !above && below);
|
|
79
|
+
spot.classList.toggle("mk-spot-inside", !above && !below);
|
|
80
|
+
// keep the label inside the pane: shift it left of the target's edge when it would overflow
|
|
81
|
+
label.style.left = `${Math.max(8 - b.left, Math.min(0, win.innerWidth - 8 - b.left - label.offsetWidth))}px`;
|
|
82
|
+
};
|
|
83
|
+
place();
|
|
84
|
+
// Scroll, resize and transforms (a panel sliding in, a late reflow) all move the target: follow it
|
|
85
|
+
// per frame for the spotlight's life (it lives until the loop restarts or the pane remounts).
|
|
86
|
+
let raf = win.requestAnimationFrame(function follow() {
|
|
87
|
+
place();
|
|
88
|
+
raf = win.requestAnimationFrame(follow);
|
|
89
|
+
});
|
|
90
|
+
spot.mkOff = () => win.cancelAnimationFrame(raf);
|
|
91
|
+
doc.body.append(spot);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface Overlay { readonly x: number; readonly y: number; move(x: number, y: number, instant: boolean): Promise<void>; press(on: boolean): void; caption(text: string): void; error(text: string): void; clear(): void }
|
|
95
|
+
|
|
96
|
+
/** Pointer + caption painted with `--mk-*` tokens; `pointer-events: none`; inside this document. */
|
|
97
|
+
export function createOverlay(doc: Document): Overlay {
|
|
98
|
+
const cursor = doc.createElement("div");
|
|
99
|
+
cursor.className = "mk-cursor";
|
|
100
|
+
cursor.setAttribute("aria-hidden", "true");
|
|
101
|
+
const cap = doc.createElement("div");
|
|
102
|
+
cap.className = "mk-caption";
|
|
103
|
+
cap.setAttribute("role", "status");
|
|
104
|
+
doc.body.append(cursor, cap);
|
|
105
|
+
doc.body.classList.add("mk-scripted"); // room for the caption under the content
|
|
106
|
+
let at = { x: -1, y: -1 };
|
|
107
|
+
return {
|
|
108
|
+
get x() { return at.x; },
|
|
109
|
+
get y() { return at.y; },
|
|
110
|
+
async move(x, y, instant) {
|
|
111
|
+
at = { x, y };
|
|
112
|
+
cursor.style.transitionDuration = instant ? "0ms" : `${MOVE_MS}ms`;
|
|
113
|
+
cursor.style.transform = `translate(${x}px, ${y}px)`;
|
|
114
|
+
cursor.dataset.x = String(x);
|
|
115
|
+
cursor.dataset.y = String(y);
|
|
116
|
+
cursor.classList.add("on");
|
|
117
|
+
if (!instant) await sleep(MOVE_MS + 30);
|
|
118
|
+
},
|
|
119
|
+
press(on) { cursor.classList.toggle("mk-down", on); },
|
|
120
|
+
caption(text) { cap.textContent = text; cap.classList.toggle("on", !!text); },
|
|
121
|
+
error(text) { cap.textContent = text; cap.classList.add("on", "mk-cap-err"); },
|
|
122
|
+
clear() { cap.classList.remove("on", "mk-cap-err"); cursor.classList.remove("on", "mk-down"); clearSpot(doc); },
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export type RunResult = { ok: true } | { ok: false; error: string };
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Run steps `from`+1..`upTo` (default: all) on `doc`. `fast` = no pointer travel or
|
|
130
|
+
* typing delay (reduced-motion step panes, headless checks, replay, pre-measure).
|
|
131
|
+
* `paused(k)` runs before step k+1 with the completed-step count k (an `unless`-skipped
|
|
132
|
+
* step counts). `signal` ends the run at the next wait (bounded pre-measure).
|
|
133
|
+
*/
|
|
134
|
+
export async function runSteps(
|
|
135
|
+
doc: Document,
|
|
136
|
+
steps: ScriptStep[],
|
|
137
|
+
o: { from?: number; upTo?: number; fast?: boolean; overlay?: Overlay | null; paused?: (k: number) => Promise<void>; signal?: AbortSignal } = {},
|
|
138
|
+
): Promise<RunResult> {
|
|
139
|
+
const { default: userEvent } = await import("@testing-library/user-event");
|
|
140
|
+
// No internal delay: each user-event call completes in microtasks, so another pane on
|
|
141
|
+
// the same page cannot steal focus mid-action. Pacing is explicit sleeps between actions.
|
|
142
|
+
const user = userEvent.setup({ document: doc, delay: null, pointerEventsCheck: 0 });
|
|
143
|
+
const last = Math.min(o.upTo ?? steps.length, steps.length);
|
|
144
|
+
for (let i = o.from ?? 0; i < last; i++) {
|
|
145
|
+
await o.paused?.(i);
|
|
146
|
+
if (o.signal?.aborted) return { ok: false, error: "aborted" };
|
|
147
|
+
const started = Date.now();
|
|
148
|
+
const s = steps[i];
|
|
149
|
+
const tag = `Step ${i + 1}/${steps.length} "${s.say}"`;
|
|
150
|
+
const timeout = s.timeout ?? DEFAULT_STEP_TIMEOUT;
|
|
151
|
+
o.overlay?.caption(`${i + 1}/${steps.length} ${s.say}`);
|
|
152
|
+
if (s.unless !== undefined && holds(doc, s.unless)) continue;
|
|
153
|
+
let el: Element | null = null;
|
|
154
|
+
if (s.target) {
|
|
155
|
+
el = await waitFor(() => findTarget(doc, s.target!), timeout, o.signal);
|
|
156
|
+
if (o.signal?.aborted) return { ok: false, error: "aborted" };
|
|
157
|
+
if (!el) return { ok: false, error: `${tag} failed: no element matches \`${s.target}\` within ${timeout} ms` };
|
|
158
|
+
} else if (s.act !== "wait" && s.act !== "press") {
|
|
159
|
+
return { ok: false, error: `${tag} failed: act "${s.act}" needs a target` };
|
|
160
|
+
}
|
|
161
|
+
if (el && s.act !== "wait" && o.overlay) {
|
|
162
|
+
// No scrollIntoView: the pane document is sized to its content, and scrolling
|
|
163
|
+
// here would scroll the reviewer's page (the parent) too. Aim, then re-aim while the target still moves (late data reflows it during travel).
|
|
164
|
+
let instant = !!o.fast;
|
|
165
|
+
for (let k = 0; k < 4; k++) {
|
|
166
|
+
const b = el.getBoundingClientRect();
|
|
167
|
+
const x = b.left + b.width / 2, y = b.top + b.height / 2;
|
|
168
|
+
if (k > 0 && Math.abs(x - o.overlay.x) < 1 && Math.abs(y - o.overlay.y) < 1) break;
|
|
169
|
+
await o.overlay.move(x, y, instant);
|
|
170
|
+
instant = true;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
switch (s.act) {
|
|
174
|
+
case "click":
|
|
175
|
+
o.overlay?.press(true);
|
|
176
|
+
await user.click(el!);
|
|
177
|
+
o.overlay?.press(false);
|
|
178
|
+
break;
|
|
179
|
+
case "type":
|
|
180
|
+
await user.click(el!);
|
|
181
|
+
for (const ch of s.text ?? "") {
|
|
182
|
+
(el as HTMLElement).focus({ preventScroll: true });
|
|
183
|
+
await user.keyboard(ch === "{" || ch === "[" ? ch + ch : ch);
|
|
184
|
+
if (!o.fast) await sleep(TYPE_DELAY_MS);
|
|
185
|
+
}
|
|
186
|
+
break;
|
|
187
|
+
case "clear": (el as HTMLElement).focus({ preventScroll: true }); await user.clear(el!); break;
|
|
188
|
+
case "hover": await user.hover(el!); break;
|
|
189
|
+
case "press":
|
|
190
|
+
if (el) (el as HTMLElement).focus({ preventScroll: true });
|
|
191
|
+
await user.keyboard(s.key?.startsWith("{") ? s.key : `{${s.key ?? "Enter"}}`);
|
|
192
|
+
break;
|
|
193
|
+
case "wait": break;
|
|
194
|
+
case "spot": showSpot(doc, el!, s.say); break;
|
|
195
|
+
}
|
|
196
|
+
if (s.expect !== undefined && !(await waitFor(() => holds(doc, s.expect!), timeout, o.signal)))
|
|
197
|
+
return { ok: false, error: `${tag} failed: expect ${describe(s.expect)} did not hold within ${timeout} ms` };
|
|
198
|
+
if (!o.fast) await sleep(MIN_STEP_MS - (Date.now() - started));
|
|
199
|
+
}
|
|
200
|
+
return { ok: true };
|
|
201
|
+
}
|
package/site/site.css
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/* GENERIC mock-site chrome (layout + review layer). Plain CSS (no Tailwind). mk- prefix only;
|
|
2
|
+
never re-styles an app class. Colours come only from --mk-* tokens, which the project's
|
|
3
|
+
mock-site.app.tsx maps onto the app's own tokens. See change: add-live-component-mock-site. */
|
|
4
|
+
html body { margin: 0; background: var(--mk-page); color: var(--mk-fg); }
|
|
5
|
+
.mk-site { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100vh; font: 14px/1.45 system-ui, sans-serif; }
|
|
6
|
+
|
|
7
|
+
/* sidebar */
|
|
8
|
+
.mk-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 12px; border-right: 1px solid var(--mk-line); background: var(--mk-panel); box-sizing: border-box; }
|
|
9
|
+
.mk-brand { font-weight: 700; font-size: 15px; margin: 0 4px 12px; }
|
|
10
|
+
.mk-q { width: 100%; box-sizing: border-box; min-height: 40px; padding: 8px 12px; border: 1px solid var(--mk-line-2); border-radius: 8px; background: var(--mk-page); color: var(--mk-fg); font: inherit; }
|
|
11
|
+
.mk-sec { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mk-muted); margin: 18px 4px 6px; }
|
|
12
|
+
.mk-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: inherit; }
|
|
13
|
+
.mk-item:hover, .mk-item:focus-visible { background: var(--mk-page); outline: none; }
|
|
14
|
+
.mk-item.on { background: var(--mk-page); box-shadow: inset 3px 0 0 var(--mk-accent); }
|
|
15
|
+
.mk-it { font-size: 13.5px; font-weight: 600; }
|
|
16
|
+
.mk-im { font-size: 12px; color: var(--mk-muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
|
|
17
|
+
.mk-closed { display: flex; gap: 8px; align-items: center; margin: 22px 4px 0; font-size: 12.5px; color: var(--mk-muted); }
|
|
18
|
+
|
|
19
|
+
/* main column: the PAGE scrolls (no inner scroll box), only the slim top bar is sticky */
|
|
20
|
+
.mk-main { padding: 0 28px 64px; min-width: 0; }
|
|
21
|
+
/* bar sits above any app z-index (portaled overlays included); only the tip is higher */
|
|
22
|
+
.mk-bar { position: sticky; top: 0; z-index: 2147483000; display: flex; align-items: center; gap: 8px; padding: 12px 0; background: var(--mk-page); }
|
|
23
|
+
.mk-sp { flex: 1; }
|
|
24
|
+
.mk-rings-sw { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--mk-muted); margin-right: 8px; }
|
|
25
|
+
.mk-theme button { min-height: 32px; padding: 4px 12px; border: 1px solid var(--mk-line-2); background: var(--mk-panel); color: var(--mk-muted); border-radius: 6px; font: inherit; font-size: 12.5px; cursor: pointer; margin-left: 4px; }
|
|
26
|
+
.mk-theme button[aria-pressed="true"] { color: var(--mk-fg); border-color: var(--mk-accent); }
|
|
27
|
+
.mk-empty { color: var(--mk-muted); }
|
|
28
|
+
|
|
29
|
+
/* buttons (player Pause / script Pause). Decisions are read-only: no decision controls. */
|
|
30
|
+
.mk-btn { min-height: 32px; padding: 4px 14px; border-radius: 6px; border: 1px solid var(--mk-line-2); background: var(--mk-panel); color: var(--mk-fg); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
|
|
31
|
+
.mk-btn:hover { background: var(--mk-hover); }
|
|
32
|
+
|
|
33
|
+
/* mock header */
|
|
34
|
+
.mk-change { margin-bottom: 40px; }
|
|
35
|
+
.mk-ch h1 { font-size: 22px; margin: 4px 0 6px; }
|
|
36
|
+
.mk-ch.mk-st-accepted h1, .mk-ch.mk-st-rejected h1 { color: var(--mk-muted); }
|
|
37
|
+
.mk-meta { font-size: 13px; color: var(--mk-muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
|
|
38
|
+
.mk-by { color: var(--mk-faint); }
|
|
39
|
+
.mk-note { margin: 6px 0 0; font-size: 13px; color: var(--mk-muted); font-style: italic; }
|
|
40
|
+
.mk-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--mk-page); color: var(--mk-muted); text-transform: capitalize; }
|
|
41
|
+
.mk-item .mk-pill { background: var(--mk-panel); }
|
|
42
|
+
.mk-pill .d { width: 6px; height: 6px; border-radius: 3px; background: currentColor; }
|
|
43
|
+
.mk-pill.mk-accepted { color: var(--mk-ok-text, var(--mk-ok)); } .mk-pill.mk-rejected { color: var(--mk-bad-text, var(--mk-bad)); }
|
|
44
|
+
|
|
45
|
+
/* frames: flat (no box around a frame), the PANES are the cards */
|
|
46
|
+
.mk-frame { margin-top: 28px; scroll-margin-top: 64px; }
|
|
47
|
+
.mk-fh { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
|
|
48
|
+
.mk-fn { min-width: 26px; height: 26px; border-radius: 13px; display: inline-grid; place-items: center; background: var(--mk-panel); border: 1px solid var(--mk-line-2); font-size: 12.5px; font-weight: 700; text-decoration: none; color: inherit; }
|
|
49
|
+
.mk-ft { font-size: 15px; font-weight: 600; }
|
|
50
|
+
.mk-pair { display: flex; flex-wrap: wrap; gap: 24px 16px; align-items: flex-start; padding: 14px 6px 10px; }
|
|
51
|
+
.mk-pane { flex: none; max-width: 100%; display: flex; flex-direction: column; gap: 6px; }
|
|
52
|
+
/* pane labels = quiet chips (red / green stays reserved for rings) */
|
|
53
|
+
.mk-lab { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 1px 8px; border-radius: 5px; background: var(--mk-panel); border: 1px solid var(--mk-line-2); color: var(--mk-muted); }
|
|
54
|
+
.mk-lab.mk-bad { color: var(--mk-muted); }
|
|
55
|
+
.mk-lab.mk-ok { color: var(--mk-ok-text, var(--mk-ok)); background: color-mix(in srgb, var(--mk-ok) 10%, var(--mk-panel)); border-color: color-mix(in srgb, var(--mk-ok) 35%, var(--mk-line-2)); }
|
|
56
|
+
.mk-why { margin: 0 0 4px 36px; font-size: 13px; color: var(--mk-muted); max-width: 90ch; }
|
|
57
|
+
.mk-long.mk-long-inline { position: static; display: inline-block; margin-left: 8px; }
|
|
58
|
+
|
|
59
|
+
/* page overview: one caption card per frame (invoice-bot style index) */
|
|
60
|
+
.mk-ov { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 16px; max-width: 1100px; }
|
|
61
|
+
.mk-ov-card { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--mk-line-2); border-radius: 10px; background: var(--mk-panel); color: inherit; text-decoration: none; }
|
|
62
|
+
.mk-ov-card:hover, .mk-ov-card:focus-visible { border-color: var(--mk-accent); outline: none; }
|
|
63
|
+
.mk-ov-n { flex: none; min-width: 24px; height: 24px; border-radius: 12px; display: inline-grid; place-items: center; border: 1px solid var(--mk-line-2); font-size: 12px; font-weight: 700; }
|
|
64
|
+
.mk-ov-b { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 13px; }
|
|
65
|
+
.mk-ov-why { color: var(--mk-muted); font-size: 12.5px; }
|
|
66
|
+
.mk-ov-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
|
|
67
|
+
.mk-chip { font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 5px; border: 1px solid var(--mk-line-2); color: var(--mk-muted); }
|
|
68
|
+
.mk-chip-ok { color: var(--mk-ok-text, var(--mk-ok)); border-color: color-mix(in srgb, var(--mk-ok) 35%, var(--mk-line-2)); }
|
|
69
|
+
.mk-none { padding: 28px; border: 1px dashed var(--mk-line-2); border-radius: 10px; text-align: center; max-width: 640px; }
|
|
70
|
+
.mk-none b { color: var(--mk-fg); font-size: 15px; }
|
|
71
|
+
|
|
72
|
+
/* steps: side by side (default) or animated player */
|
|
73
|
+
.mk-pane-steps { max-width: 100%; }
|
|
74
|
+
.mk-strip { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 16px 4px 6px; }
|
|
75
|
+
.mk-step-wrap { display: flex; align-items: stretch; flex: none; }
|
|
76
|
+
.mk-arrow { align-self: center; padding: 0 10px; color: var(--mk-faint); font-size: 18px; }
|
|
77
|
+
.mk-step { display: flex; flex-direction: column; gap: 6px; flex: none; scroll-margin-top: 64px; }
|
|
78
|
+
.mk-step-l { font: 500 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--mk-muted); text-decoration: none; }
|
|
79
|
+
.mk-step-l b { color: var(--mk-fg); }
|
|
80
|
+
.mk-player { display: flex; flex-direction: column; gap: 8px; padding-top: 16px; }
|
|
81
|
+
.mk-stage { display: grid; }
|
|
82
|
+
.mk-stage-phone { padding: 0; width: max-content; }
|
|
83
|
+
.mk-scene { grid-area: 1 / 1; opacity: 0; visibility: hidden; transition: opacity .45s ease, visibility 0s linear .45s; }
|
|
84
|
+
.mk-scene.on { opacity: 1; visibility: visible; transition: opacity .45s ease; }
|
|
85
|
+
.mk-dots { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--mk-muted); }
|
|
86
|
+
.mk-pp { min-height: 28px; padding: 2px 10px; }
|
|
87
|
+
.mk-dot { width: 10px; height: 10px; padding: 0; border: 0; border-radius: 5px; background: var(--mk-line-2); cursor: pointer; }
|
|
88
|
+
.mk-dot.on { width: 22px; background: var(--mk-accent); }
|
|
89
|
+
.mk-dot-l { margin-left: 4px; }
|
|
90
|
+
.mk-tap { position: relative; display: inline-block; }
|
|
91
|
+
.mk-tap-dot { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; border: 2px solid var(--mk-accent); background: color-mix(in srgb, var(--mk-accent) 30%, transparent); pointer-events: none; }
|
|
92
|
+
.mk-scene.on .mk-tap-anim .mk-tap-dot { animation: mk-tap 1.2s ease-out .6s both; }
|
|
93
|
+
.mk-tap-anim .mk-tap-dot { opacity: 0; }
|
|
94
|
+
@keyframes mk-tap { 0% { transform: scale(.3); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1.7); opacity: 0; } }
|
|
95
|
+
@media (prefers-reduced-motion: reduce) { .mk-scene, .mk-scene.on { transition: none; } }
|
|
96
|
+
.mk-canvas { background: var(--mk-panel); border: 1px solid var(--mk-line-2); border-radius: 10px; padding: 16px; contain: layout paint; isolation: isolate; }
|
|
97
|
+
/* content box = exactly 375px (border outside), zero padding inside -> innerWidth 375 */
|
|
98
|
+
.mk-phone-wrap { position: relative; }
|
|
99
|
+
.mk-phone-load { position: absolute; inset: 1px; display: grid; place-items: center; border-radius: 12px; background: var(--mk-panel); color: var(--mk-muted); font-size: 12.5px; pointer-events: none; }
|
|
100
|
+
.mk-phone { display: block; box-sizing: content-box; border: 1px solid var(--mk-line-2); border-radius: 12px; background: var(--mk-panel); }
|
|
101
|
+
/* isolated pane (fixtures / script): same-origin iframe, content-sized; placeholder until scrolled near */
|
|
102
|
+
.mk-iso { display: block; box-sizing: content-box; max-width: 100%; border: 1px solid var(--mk-line-2); border-radius: 12px; background: var(--mk-panel); }
|
|
103
|
+
.mk-iso-ph { border-radius: 12px; background: var(--mk-panel); }
|
|
104
|
+
.mk-pane-load { padding: 16px; color: var(--mk-muted); font: 12.5px system-ui; }
|
|
105
|
+
body.mk-pane-only.mk-pane-wide .mk-canvas { padding: 22px 16px 16px; }
|
|
106
|
+
body.mk-pane-only.mk-scripted .mk-canvas { padding-bottom: 48px; }
|
|
107
|
+
/* one non-wrapping line: counts, errors and step controls never change its height */
|
|
108
|
+
.mk-health { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--mk-muted); white-space: nowrap; overflow: hidden; }
|
|
109
|
+
.mk-health > * { flex: none; }
|
|
110
|
+
.mk-health-err { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--mk-bad-text, var(--mk-bad)); font-weight: 600; }
|
|
111
|
+
.mk-step-ctl { display: inline-flex; gap: 4px; }
|
|
112
|
+
.mk-step-btn { padding: 4px 10px; }
|
|
113
|
+
.mk-btn[aria-disabled="true"] { opacity: .5; cursor: default; }
|
|
114
|
+
.mk-missing { margin-top: 12px; padding: 8px 12px; max-width: 900px; border: 1px dashed var(--mk-bad); border-radius: 8px; font-size: 12.5px; color: var(--mk-muted); }
|
|
115
|
+
.mk-missing ul { margin: 4px 0 0; padding-left: 18px; }
|
|
116
|
+
.mk-missing code { color: var(--mk-fg); margin-right: 6px; }
|
|
117
|
+
/* script overlay: pointer + caption inside the pane document, never interactive */
|
|
118
|
+
.mk-cursor { position: fixed; left: -9px; top: -4px; z-index: 2147483646; width: 18px; height: 18px; pointer-events: none; opacity: 0;
|
|
119
|
+
transition-property: transform, opacity; transition-timing-function: ease-in-out;
|
|
120
|
+
clip-path: polygon(0 0, 0 100%, 30% 72%, 52% 100%, 66% 92%, 45% 66%, 85% 66%); background: var(--mk-fg); filter: drop-shadow(0 0 1.5px var(--mk-panel)); }
|
|
121
|
+
.mk-cursor.on { opacity: 1; }
|
|
122
|
+
.mk-cursor.mk-down { scale: .82; }
|
|
123
|
+
.mk-cursor::after { content: ""; position: absolute; left: -6px; top: -2px; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--mk-accent); opacity: 0; }
|
|
124
|
+
.mk-cursor.mk-down::after { opacity: .9; }
|
|
125
|
+
.mk-caption { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 2147483646; padding: 6px 10px; border-radius: 8px; pointer-events: none; opacity: 0;
|
|
126
|
+
background: var(--mk-fg); color: var(--mk-panel); font: 600 12.5px/1.35 system-ui; }
|
|
127
|
+
.mk-caption.on { opacity: .92; }
|
|
128
|
+
.mk-caption.mk-cap-err { background: var(--mk-bad); color: #fff; opacity: 1; }
|
|
129
|
+
@media (prefers-reduced-motion: reduce) { .mk-cursor { transition: none; } }
|
|
130
|
+
/* spot step: dims the pane outside the part, rings it, labels it; under pointer / caption, never interactive, kept with Highlights off */
|
|
131
|
+
.mk-spot { position: fixed; z-index: 2147483640; pointer-events: none; box-shadow: 0 0 0 2px var(--mk-accent), 0 0 0 200vmax color-mix(in srgb, #000 45%, transparent); }
|
|
132
|
+
.mk-spot-label { position: absolute; left: 0; bottom: calc(100% + 6px); width: max-content; max-width: 320px; padding: 3px 8px; border-radius: 6px; background: var(--mk-accent); color: #fff; font: 700 12.5px/1.35 system-ui; }
|
|
133
|
+
.mk-spot.mk-spot-below .mk-spot-label { bottom: auto; top: calc(100% + 6px); }
|
|
134
|
+
.mk-spot.mk-spot-inside .mk-spot-label { bottom: auto; top: 6px; }
|
|
135
|
+
html body.mk-pane-only { margin: 0; padding: 0; background: var(--mk-panel); }
|
|
136
|
+
/* zero side padding keeps the content exactly 375px; top padding leaves room for a badge above a top-edge ring */
|
|
137
|
+
body.mk-pane-only .mk-canvas { border: 0; padding: 22px 0 0; border-radius: 0; }
|
|
138
|
+
body.mk-pane-only .mk-ring-n { left: 0; top: -22px; } /* above the ring, never over its text; the iframe edge never clips it */
|
|
139
|
+
.mk-error { margin: 12px; padding: 12px; border: 1px solid var(--mk-bad); border-radius: 8px; color: var(--mk-bad-text, var(--mk-bad)); font: 600 13px system-ui; }
|
|
140
|
+
/* Locate frame (add-mock-locate-frame D1, D9): page at its own size, scaled to the column by the shell */
|
|
141
|
+
.mk-scale { overflow: hidden; }
|
|
142
|
+
.mk-locate-steps { display: flex; flex-direction: column; gap: 14px; padding-top: 10px; }
|
|
143
|
+
.mk-locate-page { position: relative; overflow: hidden; }
|
|
144
|
+
html body.mk-pane-only.mk-pane-locate .mk-canvas { padding: 0; }
|
|
145
|
+
.mk-loc-bad { display: inline-block; margin-left: 6px; padding: 0 6px; border: 1px solid var(--mk-bad); border-radius: 4px; color: var(--mk-bad-text, var(--mk-bad)); font: 700 10.5px/16px system-ui; vertical-align: middle; }
|
|
146
|
+
.mk-problems { margin: 16px 4px 0; padding: 8px 8px 8px 22px; border: 1px solid var(--mk-bad); border-radius: 8px; font-size: 12px; color: var(--mk-bad-text, var(--mk-bad)); }
|
|
147
|
+
|
|
148
|
+
/* rings: outline on the element; number badge = child of the ring (scrolls with it, under the bar);
|
|
149
|
+
tip = body layer above everything */
|
|
150
|
+
.mk-ring { position: relative; display: inline-flex; align-items: center; flex-wrap: nowrap; gap: inherit; vertical-align: middle; border-radius: 12px; cursor: help; }
|
|
151
|
+
.mk-ring.mk-block { display: grid; }
|
|
152
|
+
/* ring line: positioned child (2px stroke, 2px out), above the part's children and neighbours, under the bar,
|
|
153
|
+
spotlight, pointer and caption; never interactive; inset clamped by ring-line.ts (add-mock-locate-frame D5) */
|
|
154
|
+
.mk-ring-line { position: absolute; inset: -4px; z-index: 2147482990; border: 2px solid var(--mk-ok); border-radius: 14px; pointer-events: none; box-sizing: border-box; }
|
|
155
|
+
.mk-ring.mk-bad > .mk-ring-line { border-color: var(--mk-bad); }
|
|
156
|
+
.mk-ring-measure .mk-ring-line { display: none !important; }
|
|
157
|
+
.mk-ring:focus-visible { outline: none; }
|
|
158
|
+
.mk-ring:focus-visible > .mk-ring-line { display: block; border: 3px solid var(--mk-accent); }
|
|
159
|
+
.mk-ring-n { position: absolute; left: -15px; top: -15px; z-index: 2147482991; min-width: 22px; height: 22px; border-radius: 11px; color: #fff; font: 700 12px/22px system-ui; text-align: center; text-decoration: none; }
|
|
160
|
+
.mk-ring-n.mk-bad { background: var(--mk-bad); } .mk-ring-n.mk-ok { background: var(--mk-ok); }
|
|
161
|
+
.mk-tip { position: fixed; z-index: 2147483647; transform: translate(-50%, -100%); width: max-content; max-width: 280px; padding: 6px 10px; border-radius: 8px; font: 600 13px/1.35 system-ui; color: #fff; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
|
|
162
|
+
.mk-tip.mk-below { transform: translate(-50%, 0); }
|
|
163
|
+
.mk-tip.mk-bad { background: var(--mk-bad); } .mk-tip.mk-ok { background: var(--mk-ok); }
|
|
164
|
+
.mk-long { position: absolute; right: -6px; bottom: -10px; background: var(--mk-bad); color: #fff; font: 700 10px/16px system-ui; padding: 0 5px; border-radius: 4px; }
|
|
165
|
+
|
|
166
|
+
/* references: every page / frame / side / ring links to itself */
|
|
167
|
+
.mk-lab { display: inline-block; text-decoration: none; }
|
|
168
|
+
.mk-lab:hover, .mk-fn:hover { text-decoration: underline; }
|
|
169
|
+
.mk-ref { font: 500 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--mk-muted); text-decoration: none; vertical-align: middle; }
|
|
170
|
+
.mk-ref:hover { text-decoration: underline; }
|
|
171
|
+
.mk-ring-n:hover { filter: brightness(1.15); }
|
|
172
|
+
/* Highlights switch off: rings keep layout (refs + deep links still resolve), drop line/badges/tips; a focused ring stays emphasised */
|
|
173
|
+
.mk-no-rings .mk-ring { cursor: inherit; }
|
|
174
|
+
.mk-no-rings .mk-ring-line { display: none; }
|
|
175
|
+
.mk-no-rings .mk-ring-n, .mk-no-rings .mk-ring > .mk-long { visibility: hidden; }
|
|
176
|
+
@keyframes mk-hit { 0%, 60% { box-shadow: 0 0 0 6px var(--mk-accent); } 100% { box-shadow: 0 0 0 6px transparent; } }
|
|
177
|
+
.mk-hit { animation: mk-hit 1.6s ease-out; border-radius: 12px; }
|
|
178
|
+
/* Opaque (tier-5) frame: storage-dependent features are off. Noticeable, but below the sticky bar so it never hides rings. */
|
|
179
|
+
.mk-opaque { margin: 0 0 12px; padding: 8px 10px; border: 1px solid var(--mk-line, currentColor); border-radius: 8px; font-size: 12px; color: var(--mk-muted); }
|