@erclx/canon 5.66.0 → 5.67.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 (66) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/claude/.claude-plugin/plugin.json +1 -1
  3. package/claude/skills/app-drive/REQUIREMENT.md +35 -0
  4. package/claude/skills/app-drive/SKILL.md +112 -0
  5. package/claude/skills/app-drive/references/config.md +38 -0
  6. package/claude/skills/app-drive/references/drive-record.md +70 -0
  7. package/claude/skills/app-drive/references/isolate.md +46 -0
  8. package/claude/skills/canon-cli/SKILL.md +2 -0
  9. package/claude/skills/create-skill/references/skill.md +1 -1
  10. package/claude/skills/plan-feature/references/plan.md +1 -1
  11. package/claude/skills/plan-intake/references/intake.md +12 -2
  12. package/claude/skills/review-ui/SKILL.md +5 -4
  13. package/claude/skills/review-ui/references/drive-copy.md +4 -0
  14. package/claude/skills/review-ui/references/driving.md +1 -1
  15. package/claude/skills/role-orchestrator/references/orchestrator-handoff.md +15 -2
  16. package/claude/skills/role-planner/SKILL.md +2 -2
  17. package/claude/skills/role-worker/SKILL.md +4 -6
  18. package/claude/skills/session-map/REQUIREMENT.md +1 -1
  19. package/claude/skills/session-map/SKILL.md +8 -1
  20. package/claude/skills/session-map/references/session.md +19 -5
  21. package/claude/skills/ui-record/REQUIREMENT.md +34 -0
  22. package/claude/skills/ui-record/SKILL.md +103 -0
  23. package/claude/skills/ui-record/references/config.md +40 -0
  24. package/claude/skills/ui-record/references/handoff.md +48 -0
  25. package/claude/skills/ui-record/references/take-craft.md +92 -0
  26. package/docs/agents/records.md +1 -0
  27. package/docs/workflow/parallel-features.md +1 -1
  28. package/docs/workflow/skill-map-on-request.md +1 -0
  29. package/docs/workflow/skill-map.md +1 -0
  30. package/docs/workflow/visual-design-workflow.md +2 -1
  31. package/package.json +1 -1
  32. package/src/audits/catalog.ts +5 -1
  33. package/src/browser/agent-cli.ts +68 -0
  34. package/src/claude/cases/workflow.ts +20 -0
  35. package/src/cli/help.ts +3 -0
  36. package/src/cli.ts +4 -0
  37. package/src/commands/browser.ts +102 -0
  38. package/src/commands/intake.ts +181 -1
  39. package/src/commands/pr.ts +15 -6
  40. package/src/commands/records.ts +18 -1
  41. package/src/commands/take.ts +266 -0
  42. package/src/context/requirements.ts +1 -11
  43. package/src/git/status.ts +73 -0
  44. package/src/intake/drive-check.ts +355 -0
  45. package/src/intake/folder.ts +1 -1
  46. package/src/markdown/scan.ts +10 -0
  47. package/src/pr/drive-copy.ts +97 -84
  48. package/src/records/session-map.ts +75 -0
  49. package/src/records/validate.ts +64 -8
  50. package/src/take/camera.ts +309 -0
  51. package/src/take/encode.ts +170 -0
  52. package/src/take/film.ts +206 -0
  53. package/src/take/fixtures/fade.html +49 -0
  54. package/src/take/fixtures/fetch.html +38 -0
  55. package/src/take/log.ts +109 -0
  56. package/src/take/perform.ts +200 -0
  57. package/src/take/plan.ts +193 -0
  58. package/src/take/screencast.ts +94 -0
  59. package/src/take/shell.ts +287 -0
  60. package/src/take/stepper.ts +252 -0
  61. package/src/take/zoom/NOTICE.md +45 -0
  62. package/src/take/zoom/math-utils.ts +69 -0
  63. package/src/take/zoom/region-utils.ts +55 -0
  64. package/src/take/zoom/spring.ts +133 -0
  65. package/src/tasks/archive.ts +1 -3
  66. package/claude/skills/review-ui/scripts/pw.sh +0 -60
@@ -0,0 +1,206 @@
1
+ import { mkdirSync, writeFileSync } from 'node:fs'
2
+ import { join, resolve } from 'node:path'
3
+ import { isBrowserMissing, isServerUnreachable } from '@/browser/engine'
4
+ import { cameraTrack } from '@/take/camera'
5
+ import { FfmpegMissing, requireFfmpeg } from '@/take/encode'
6
+ import {
7
+ FPS,
8
+ LOG_VERSION,
9
+ type LogEvent,
10
+ type TakeLog,
11
+ VIEWPORT,
12
+ } from '@/take/log'
13
+ import { TargetMissing } from '@/take/perform'
14
+ import type { Beat, Route, TakePlan } from '@/take/plan'
15
+ import { filmScreencast } from '@/take/screencast'
16
+ import { ShellMissing, findShell } from '@/take/shell'
17
+ import { StepperStalled, filmStepped } from '@/take/stepper'
18
+
19
+ /**
20
+ * Films every beat of a plan into its own folder and writes the record the
21
+ * edit reads. Each beat opens the page fresh, so a beat starts from the state
22
+ * its setup reaches rather than wherever the last one left the page.
23
+ */
24
+
25
+ export const TAKE_VERSION = 1
26
+
27
+ export type TakeRefusal =
28
+ | 'ffmpeg-missing'
29
+ | 'browser-missing'
30
+ | 'server-unreachable'
31
+ | 'target-missing'
32
+ | 'take-failed'
33
+
34
+ export interface FilmedBeat {
35
+ readonly name: string
36
+ /** The beat's folder, relative to the take's. */
37
+ readonly dir: string
38
+ readonly requested: Route
39
+ readonly route: Route
40
+ /** Why a `step` beat was filmed by screencast instead, when it was. */
41
+ readonly fallback?: string
42
+ readonly frames: number
43
+ readonly seconds: number
44
+ readonly clip: string
45
+ readonly log: string
46
+ readonly camera: string
47
+ }
48
+
49
+ export type TakeResult =
50
+ | {
51
+ readonly status: 'filmed'
52
+ readonly out: string
53
+ readonly beats: readonly FilmedBeat[]
54
+ readonly durationMs: number
55
+ }
56
+ | {
57
+ readonly status: 'failed'
58
+ readonly reason: TakeRefusal
59
+ readonly message: string
60
+ readonly beat?: string
61
+ }
62
+
63
+ export interface TakeRequest {
64
+ readonly url: string
65
+ readonly plan: TakePlan
66
+ readonly out: string
67
+ readonly env?: NodeJS.ProcessEnv
68
+ }
69
+
70
+ const REACH_TIMEOUT_MS = 5000
71
+
72
+ export async function take(request: TakeRequest): Promise<TakeResult> {
73
+ const started = Date.now()
74
+ const out = resolve(request.out)
75
+
76
+ try {
77
+ await requireFfmpeg()
78
+ } catch (error) {
79
+ if (error instanceof FfmpegMissing) return failed('ffmpeg-missing', error)
80
+ throw error
81
+ }
82
+
83
+ let executable = ''
84
+ if (request.plan.beats.some((beat) => beat.route === 'step')) {
85
+ try {
86
+ executable = findShell(request.env)
87
+ } catch (error) {
88
+ if (error instanceof ShellMissing) return failed('browser-missing', error)
89
+ throw error
90
+ }
91
+ }
92
+
93
+ // Probes the origin rather than the address, since an address can carry a
94
+ // single-use ticket that a probe would spend before the browser opens it.
95
+ try {
96
+ await fetch(new URL(request.url).origin, {
97
+ signal: AbortSignal.timeout(REACH_TIMEOUT_MS),
98
+ })
99
+ } catch (error) {
100
+ return failed('server-unreachable', error)
101
+ }
102
+
103
+ mkdirSync(out, { recursive: true })
104
+ const beats: FilmedBeat[] = []
105
+ for (const [index, beat] of request.plan.beats.entries()) {
106
+ const dir = `${String(index + 1).padStart(2, '0')}-${slug(beat.name)}`
107
+ mkdirSync(join(out, dir), { recursive: true })
108
+ try {
109
+ beats.push(await filmBeat(request.url, beat, out, dir, executable))
110
+ } catch (error) {
111
+ return failed(classify(error), error, beat.name)
112
+ }
113
+ }
114
+
115
+ writeFileSync(
116
+ join(out, 'take.json'),
117
+ `${JSON.stringify({ version: TAKE_VERSION, url: request.url, beats }, null, 2)}\n`,
118
+ )
119
+ return { status: 'filmed', out, beats, durationMs: Date.now() - started }
120
+ }
121
+
122
+ async function filmBeat(
123
+ url: string,
124
+ beat: Beat,
125
+ out: string,
126
+ dir: string,
127
+ executable: string,
128
+ ): Promise<FilmedBeat> {
129
+ const clip = join(dir, 'clip.mp4')
130
+ const target = join(out, clip)
131
+
132
+ let route: Route = beat.route
133
+ let fallback: string | undefined
134
+ let filmed: { frames: number; events: readonly LogEvent[] }
135
+ if (beat.route === 'step') {
136
+ try {
137
+ filmed = await filmStepped({ executable, url, beat, clip: target })
138
+ } catch (error) {
139
+ if (!(error instanceof StepperStalled)) throw error
140
+ route = 'screencast'
141
+ fallback = error.message
142
+ filmed = await filmScreencast({ url, beat, clip: target })
143
+ }
144
+ } else {
145
+ filmed = await filmScreencast({ url, beat, clip: target })
146
+ }
147
+
148
+ const log: TakeLog = {
149
+ version: LOG_VERSION,
150
+ viewport: VIEWPORT,
151
+ fps: FPS,
152
+ route,
153
+ frames: filmed.frames,
154
+ events: filmed.events,
155
+ }
156
+ const logPath = join(dir, 'log.json')
157
+ writeFileSync(join(out, logPath), `${JSON.stringify(log, null, 2)}\n`)
158
+ // One line, since it carries a row per frame and nobody reads it by eye.
159
+ const cameraPath = join(dir, 'camera.json')
160
+ writeFileSync(join(out, cameraPath), `${JSON.stringify(cameraTrack(log))}\n`)
161
+
162
+ return {
163
+ name: beat.name,
164
+ dir,
165
+ requested: beat.route,
166
+ route,
167
+ ...(fallback ? { fallback } : {}),
168
+ frames: filmed.frames,
169
+ seconds: Number((filmed.frames / FPS).toFixed(2)),
170
+ clip,
171
+ log: logPath,
172
+ camera: cameraPath,
173
+ }
174
+ }
175
+
176
+ function classify(error: unknown): TakeRefusal {
177
+ if (error instanceof TargetMissing) return 'target-missing'
178
+ if (error instanceof ShellMissing || isBrowserMissing(error)) {
179
+ return 'browser-missing'
180
+ }
181
+ if (isServerUnreachable(error)) return 'server-unreachable'
182
+ return 'take-failed'
183
+ }
184
+
185
+ function failed(
186
+ reason: TakeRefusal,
187
+ error: unknown,
188
+ beat?: string,
189
+ ): TakeResult {
190
+ return {
191
+ status: 'failed',
192
+ reason,
193
+ message: error instanceof Error ? error.message : String(error),
194
+ ...(beat ? { beat } : {}),
195
+ }
196
+ }
197
+
198
+ function slug(name: string): string {
199
+ return (
200
+ name
201
+ .toLowerCase()
202
+ .replace(/[^a-z0-9]+/g, '-')
203
+ .replace(/^-|-$/g, '')
204
+ .slice(0, 40) || 'beat'
205
+ )
206
+ }
@@ -0,0 +1,49 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Fade</title>
6
+ <!--
7
+ A band that fades from black to white over exactly one second of page
8
+ time once the button is pressed, so its brightness frame by frame reads
9
+ how much page time each frame of a take advanced.
10
+ -->
11
+ <style>
12
+ body {
13
+ margin: 0;
14
+ background: #808080;
15
+ }
16
+
17
+ #go {
18
+ position: absolute;
19
+ left: 100px;
20
+ top: 100px;
21
+ width: 200px;
22
+ height: 60px;
23
+ }
24
+
25
+ #band {
26
+ position: absolute;
27
+ left: 0;
28
+ top: 300px;
29
+ width: 1920px;
30
+ height: 780px;
31
+ background-color: #000;
32
+ transition: background-color 1000ms linear;
33
+ }
34
+
35
+ #band.lit {
36
+ background-color: #fff;
37
+ }
38
+ </style>
39
+ </head>
40
+ <body>
41
+ <button id="go">Go</button>
42
+ <div id="band"></div>
43
+ <script>
44
+ document.getElementById('go').addEventListener('click', () => {
45
+ document.getElementById('band').classList.add('lit')
46
+ })
47
+ </script>
48
+ </body>
49
+ </html>
@@ -0,0 +1,38 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Fetch</title>
6
+ <!--
7
+ A button whose press starts a fetch the server answers slowly, the way
8
+ a page switch in an app loads what the next view shows. A take must keep
9
+ stepping frames while the fetch is in flight.
10
+ -->
11
+ <style>
12
+ body {
13
+ margin: 0;
14
+ background: #808080;
15
+ }
16
+
17
+ #go {
18
+ position: absolute;
19
+ left: 100px;
20
+ top: 100px;
21
+ width: 200px;
22
+ height: 60px;
23
+ }
24
+ </style>
25
+ </head>
26
+ <body>
27
+ <button id="go">Load</button>
28
+ <p id="status">idle</p>
29
+ <script>
30
+ document.getElementById('go').addEventListener('click', () => {
31
+ document.getElementById('status').textContent = 'loading'
32
+ fetch('/slow').then(() => {
33
+ document.getElementById('status').textContent = 'loaded'
34
+ })
35
+ })
36
+ </script>
37
+ </body>
38
+ </html>
@@ -0,0 +1,109 @@
1
+ import type { Route } from '@/take/plan'
2
+
3
+ /**
4
+ * The click log a take writes beside its clip, and the pointer path both
5
+ * capture routes move along and the camera reads back. Every coordinate is in
6
+ * CSS pixels of the page, and every time is in milliseconds on the clip's own
7
+ * clock, so frame `n` sits at `n * 1000 / FPS` whatever route filmed it.
8
+ *
9
+ * The path lives here rather than in a capture route because the edit draws the
10
+ * cursor from this log, so the route moving the real pointer and the reader
11
+ * redrawing it have to agree on one curve.
12
+ */
13
+
14
+ export const LOG_VERSION = 1
15
+
16
+ export const FPS = 60
17
+
18
+ /** The page a take films, in CSS pixels. The stepper renders it at twice this. */
19
+ export const VIEWPORT = { width: 1920, height: 1080 } as const
20
+
21
+ export interface Point {
22
+ readonly x: number
23
+ readonly y: number
24
+ }
25
+
26
+ export interface Box {
27
+ readonly x: number
28
+ readonly y: number
29
+ readonly width: number
30
+ readonly height: number
31
+ }
32
+
33
+ export type LogEvent =
34
+ | {
35
+ readonly t: number
36
+ readonly kind: 'move'
37
+ readonly from: Point
38
+ readonly to: Point
39
+ readonly ms: number
40
+ }
41
+ | {
42
+ readonly t: number
43
+ readonly kind: 'click'
44
+ readonly at: Point
45
+ readonly box: Box
46
+ }
47
+ | {
48
+ readonly t: number
49
+ readonly kind: 'type'
50
+ readonly at: Point
51
+ readonly box: Box
52
+ readonly chars: number
53
+ /** From the first key to the last, so the camera holds for the burst. */
54
+ readonly ms: number
55
+ }
56
+ | {
57
+ readonly t: number
58
+ readonly kind: 'scroll'
59
+ readonly at: Point
60
+ readonly dx: number
61
+ readonly dy: number
62
+ readonly ms: number
63
+ }
64
+
65
+ export interface TakeLog {
66
+ readonly version: typeof LOG_VERSION
67
+ readonly viewport: { readonly width: number; readonly height: number }
68
+ readonly fps: number
69
+ /** The route that filmed the clip, which can differ from the one asked for. */
70
+ readonly route: Route
71
+ readonly frames: number
72
+ readonly events: readonly LogEvent[]
73
+ }
74
+
75
+ /** Where the pointer rests before a take's first move. */
76
+ export const START: Point = { x: VIEWPORT.width / 2, y: VIEWPORT.height / 2 }
77
+
78
+ /**
79
+ * How long the pointer takes to travel, slower for longer reaches and never so
80
+ * quick that a viewer loses it. Carried over from the groundwork takes the
81
+ * camera presets were judged on.
82
+ */
83
+ export function travelMs(from: Point, to: Point): number {
84
+ return Math.min(
85
+ 1200,
86
+ Math.max(300, Math.hypot(to.x - from.x, to.y - from.y) * 0.9),
87
+ )
88
+ }
89
+
90
+ export function easeInOutCubic(t: number): number {
91
+ const x = Math.max(0, Math.min(1, t))
92
+ return x < 0.5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2
93
+ }
94
+
95
+ export function along(from: Point, to: Point, progress: number): Point {
96
+ const k = easeInOutCubic(progress)
97
+ return { x: from.x + (to.x - from.x) * k, y: from.y + (to.y - from.y) * k }
98
+ }
99
+
100
+ /** The pointer's position at a time on the clip's clock, read off the moves. */
101
+ export function cursorAt(events: readonly LogEvent[], ms: number): Point {
102
+ let position = START
103
+ for (const event of events) {
104
+ if (event.kind !== 'move') continue
105
+ if (ms < event.t) break
106
+ position = along(event.from, event.to, (ms - event.t) / event.ms)
107
+ }
108
+ return position
109
+ }
@@ -0,0 +1,200 @@
1
+ import {
2
+ type Box,
3
+ FPS,
4
+ type LogEvent,
5
+ type Point,
6
+ along,
7
+ travelMs,
8
+ } from '@/take/log'
9
+ import type { TakeStep } from '@/take/plan'
10
+
11
+ /**
12
+ * Performs a beat's steps through a stage and logs what the edit needs. The
13
+ * choreography sits here once, and each capture route supplies the stage, being
14
+ * how an input reaches the page and how clip time passes, so a beat moves the
15
+ * same way whichever route filmed it.
16
+ */
17
+
18
+ const FRAME_MS = 1000 / FPS
19
+
20
+ /** The gap between keys, slow enough that a viewer reads each one land. */
21
+ const KEY_MS = 90
22
+
23
+ /** How long a scroll's wheel travel runs. */
24
+ const SCROLL_MS = 900
25
+
26
+ export type PointerInput =
27
+ | {
28
+ readonly type: 'move' | 'down' | 'up'
29
+ readonly x: number
30
+ readonly y: number
31
+ }
32
+ | {
33
+ readonly type: 'wheel'
34
+ readonly x: number
35
+ readonly y: number
36
+ readonly dy: number
37
+ }
38
+
39
+ export interface Stage {
40
+ /** Milliseconds on the clip's own clock. */
41
+ now(): number
42
+ /** Lets `ms` of clip time pass. */
43
+ hold(ms: number): Promise<void>
44
+ /** Sends one pointer input and lets one frame pass. */
45
+ pointer(input: PointerInput): Promise<void>
46
+ /** Types one character into the focused field and lets one frame pass. */
47
+ key(text: string): Promise<void>
48
+ /** Evaluates an expression in the page. */
49
+ evaluate<T>(expression: string): Promise<T>
50
+ }
51
+
52
+ /** A target that resolved to nothing, which refuses rather than films a guess. */
53
+ export class TargetMissing extends Error {
54
+ constructor(readonly target: string) {
55
+ super(`nothing on the page matches ${target}`)
56
+ }
57
+ }
58
+
59
+ export interface Performance {
60
+ pointer: Point
61
+ /** Omitted for setup steps, which run before the clip starts. */
62
+ readonly log?: LogEvent[]
63
+ }
64
+
65
+ export async function performSteps(
66
+ stage: Stage,
67
+ steps: readonly TakeStep[],
68
+ state: Performance,
69
+ ): Promise<void> {
70
+ for (const step of steps) {
71
+ switch (step.kind) {
72
+ case 'move':
73
+ await moveTo(
74
+ stage,
75
+ state,
76
+ 'target' in step ? center(await boxOf(stage, step.target)) : step,
77
+ )
78
+ break
79
+ case 'click':
80
+ await click(stage, state, await boxOf(stage, step.target))
81
+ break
82
+ case 'fill': {
83
+ const box = await boxOf(stage, step.target)
84
+ await click(stage, state, box)
85
+ const start = stage.now()
86
+ for (const character of step.text) {
87
+ await stage.key(character)
88
+ await stage.hold(KEY_MS - FRAME_MS)
89
+ }
90
+ state.log?.push({
91
+ t: start,
92
+ kind: 'type',
93
+ at: state.pointer,
94
+ box,
95
+ chars: step.text.length,
96
+ ms: stage.now() - start,
97
+ })
98
+ break
99
+ }
100
+ case 'scroll': {
101
+ const at = center(await boxOf(stage, step.target))
102
+ await moveTo(stage, state, at)
103
+ const frames = Math.round(SCROLL_MS / FRAME_MS)
104
+ state.log?.push({
105
+ t: stage.now(),
106
+ kind: 'scroll',
107
+ at,
108
+ dx: 0,
109
+ dy: step.dy,
110
+ ms: frames * FRAME_MS,
111
+ })
112
+ let sent = 0
113
+ for (let frame = 1; frame <= frames; frame += 1) {
114
+ const want = along(
115
+ { x: 0, y: 0 },
116
+ { x: 0, y: step.dy },
117
+ frame / frames,
118
+ ).y
119
+ await stage.pointer({ type: 'wheel', ...at, dy: want - sent })
120
+ sent = want
121
+ }
122
+ break
123
+ }
124
+ case 'wait':
125
+ await stage.hold(step.ms)
126
+ break
127
+ }
128
+ }
129
+ }
130
+
131
+ async function moveTo(
132
+ stage: Stage,
133
+ state: Performance,
134
+ to: Point,
135
+ ): Promise<void> {
136
+ const from = state.pointer
137
+ if (Math.hypot(to.x - from.x, to.y - from.y) < 1) return
138
+ const frames = Math.max(1, Math.round(travelMs(from, to) / FRAME_MS))
139
+ state.log?.push({
140
+ t: stage.now(),
141
+ kind: 'move',
142
+ from,
143
+ to,
144
+ ms: frames * FRAME_MS,
145
+ })
146
+ for (let frame = 1; frame <= frames; frame += 1) {
147
+ state.pointer = along(from, to, frame / frames)
148
+ await stage.pointer({ type: 'move', ...state.pointer })
149
+ }
150
+ state.pointer = to
151
+ }
152
+
153
+ async function click(
154
+ stage: Stage,
155
+ state: Performance,
156
+ box: Box,
157
+ ): Promise<void> {
158
+ const at = center(box)
159
+ await moveTo(stage, state, at)
160
+ state.log?.push({ t: stage.now(), kind: 'click', at, box })
161
+ await stage.pointer({ type: 'down', ...at })
162
+ await stage.pointer({ type: 'up', ...at })
163
+ }
164
+
165
+ function center(box: Box): Point {
166
+ return { x: box.x + box.width / 2, y: box.y + box.height / 2 }
167
+ }
168
+
169
+ async function boxOf(stage: Stage, target: string): Promise<Box> {
170
+ const box = await stage.evaluate<Box | null>(boxExpression(target))
171
+ if (!box) throw new TargetMissing(target)
172
+ return box
173
+ }
174
+
175
+ /**
176
+ * Finds a target's box in CSS pixels, reading `text=<words>` as the innermost
177
+ * element whose whole text is those words and anything else as a CSS selector.
178
+ * It runs inside the page so both routes resolve a target the same way, and a
179
+ * match with no size counts as missing, since a click on it would land on
180
+ * whatever sits behind.
181
+ */
182
+ export function boxExpression(target: string): string {
183
+ return `(() => {
184
+ const target = ${JSON.stringify(target)}
185
+ let element = null
186
+ if (target.startsWith('text=')) {
187
+ const want = target.slice(5).trim()
188
+ const matches = [...document.querySelectorAll('body *')].filter(
189
+ (node) => node.textContent.trim() === want,
190
+ )
191
+ element = matches.find((node) => !matches.some((other) => other !== node && node.contains(other))) ?? null
192
+ } else {
193
+ element = document.querySelector(target)
194
+ }
195
+ if (!element) return null
196
+ const rect = element.getBoundingClientRect()
197
+ if (rect.width === 0 || rect.height === 0) return null
198
+ return { x: rect.x, y: rect.y, width: rect.width, height: rect.height }
199
+ })()`
200
+ }