@erclx/aitk 3.6.0 → 3.7.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/claude/.claude-plugin/plugin.json +1 -1
- package/claude/skills/claude-autoship/SKILL.md +5 -5
- package/claude/skills/claude-docs/SKILL.md +15 -10
- package/claude/skills/claude-memory-review/SKILL.md +7 -7
- package/claude/skills/claude-memory-review/references/receipt-format.md +1 -1
- package/claude/skills/claude-orchestrate/SKILL.md +2 -2
- package/claude/skills/claude-pr-review/SKILL.md +25 -7
- package/claude/skills/claude-review/SKILL.md +5 -3
- package/claude/skills/claude-screencast/SKILL.md +9 -4
- package/claude/skills/claude-tasks/SKILL.md +2 -2
- package/claude/skills/git-pr/references/pr.md +3 -0
- package/claude/skills/git-ship/SKILL.md +1 -1
- package/claude/skills/git-split/references/pr.md +3 -0
- package/claude/skills/toolkit-feedback/SKILL.md +2 -2
- package/docs/agents/capture.md +3 -1
- package/docs/agents/commands.md +4 -1
- package/docs/agents/demo.md +82 -0
- package/docs/agents/index.md +1 -0
- package/docs/agents/records.md +2 -2
- package/docs/agents/tasks.md +1 -1
- package/docs/ai-workflow.md +7 -5
- package/docs/operating-model.md +13 -4
- package/governance/rules/claude/558-plan.md +1 -2
- package/governance/rules/lib/300-testing-ts.md +1 -0
- package/package.json +3 -2
- package/src/cli.ts +4 -1
- package/src/commands/demo.ts +373 -0
- package/src/commands/feedback.ts +10 -3
- package/src/commands/tasks.ts +1 -1
- package/src/demo/beats.ts +135 -0
- package/src/demo/compile.ts +295 -0
- package/src/demo/cursors.ts +55 -0
- package/src/demo/drive.ts +256 -0
- package/src/demo/pointer.ts +178 -0
- package/src/demo/theme.ts +112 -0
- package/src/records/backup.ts +34 -8
- package/src/tasks/archive.ts +11 -4
- package/standards/bundled/pr.md +3 -0
- package/standards/plan.md +1 -1
- package/standards/tasks.md +4 -4
- package/tooling/claude/manifest.toml +1 -1
- package/tooling/claude/reference.md +6 -5
- package/tooling/claude/seeds/.claude/hooks/tasks-index.sh +4 -1
- package/tooling/claude/seeds/CLAUDE.md +1 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads the human-facing draft `claude-screencast` writes. Nothing here knows
|
|
3
|
+
* about a browser: the draft is prose aimed at a person, and turning it into
|
|
4
|
+
* something executable is `@/demo/compile`'s job.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface Beat {
|
|
8
|
+
readonly index: number
|
|
9
|
+
readonly name: string
|
|
10
|
+
readonly onScreen: string
|
|
11
|
+
readonly action: string
|
|
12
|
+
readonly watchFor: string
|
|
13
|
+
readonly emphasis: string
|
|
14
|
+
readonly caption: string
|
|
15
|
+
readonly transitionOut?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface Draft {
|
|
19
|
+
readonly title: string
|
|
20
|
+
readonly beats: readonly Beat[]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type DraftParse =
|
|
24
|
+
| { status: 'parsed'; draft: Draft }
|
|
25
|
+
| { status: 'failed'; reason: string }
|
|
26
|
+
|
|
27
|
+
const TITLE = /^#\s+Screencast:\s*(.+)$/m
|
|
28
|
+
const BEAT_SHEET = /^##\s+.*Beat sheet.*$/im
|
|
29
|
+
const BEAT_HEADING = /^###\s+Beat\s+(\d+)\s*:\s*(.*)$/i
|
|
30
|
+
const FIELD = /^-\s+([A-Za-z][A-Za-z\s]*?)\s*:\s*(.*)$/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Labels are matched case-insensitively with whitespace collapsed, because the
|
|
34
|
+
* draft is hand-edited between being written and being compiled and a
|
|
35
|
+
* capitalization change there is not a reason to refuse the whole file.
|
|
36
|
+
*/
|
|
37
|
+
const FIELDS: Record<string, keyof Beat> = {
|
|
38
|
+
'on screen': 'onScreen',
|
|
39
|
+
action: 'action',
|
|
40
|
+
'watch for': 'watchFor',
|
|
41
|
+
emphasis: 'emphasis',
|
|
42
|
+
caption: 'caption',
|
|
43
|
+
'transition out': 'transitionOut',
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function parseDraft(markdown: string): DraftParse {
|
|
47
|
+
const sheet = beatSheetSection(markdown)
|
|
48
|
+
if (sheet === undefined) {
|
|
49
|
+
return {
|
|
50
|
+
status: 'failed',
|
|
51
|
+
reason: 'no "Beat sheet" section, so the draft carries no beats to run',
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const beats = readBeats(sheet)
|
|
56
|
+
if (!beats.length) {
|
|
57
|
+
return {
|
|
58
|
+
status: 'failed',
|
|
59
|
+
reason: 'the beat sheet holds no "### Beat" heading',
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
status: 'parsed',
|
|
65
|
+
draft: { title: TITLE.exec(markdown)?.[1]?.trim() ?? '', beats },
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Returns the lines between the beat sheet heading and the next `##`, so a
|
|
71
|
+
* `### Beat` heading elsewhere in the draft cannot be read as a beat.
|
|
72
|
+
*/
|
|
73
|
+
function beatSheetSection(markdown: string): string[] | undefined {
|
|
74
|
+
const lines = markdown.split('\n')
|
|
75
|
+
const start = lines.findIndex((line) => BEAT_SHEET.test(line))
|
|
76
|
+
if (start === -1) return undefined
|
|
77
|
+
|
|
78
|
+
const rest = lines.slice(start + 1)
|
|
79
|
+
const end = rest.findIndex((line) => /^##\s/.test(line))
|
|
80
|
+
return end === -1 ? rest : rest.slice(0, end)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function readBeats(lines: string[]): Beat[] {
|
|
84
|
+
const beats: Beat[] = []
|
|
85
|
+
let open: Partial<Beat> | undefined
|
|
86
|
+
|
|
87
|
+
for (const line of lines) {
|
|
88
|
+
const heading = BEAT_HEADING.exec(line)
|
|
89
|
+
if (heading) {
|
|
90
|
+
if (open) beats.push(sealBeat(open))
|
|
91
|
+
open = {
|
|
92
|
+
index: Number(heading[1]),
|
|
93
|
+
name: (heading[2] ?? '').trim(),
|
|
94
|
+
}
|
|
95
|
+
continue
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (!open) continue
|
|
99
|
+
const field = FIELD.exec(line)
|
|
100
|
+
if (!field) continue
|
|
101
|
+
|
|
102
|
+
const key = FIELDS[normalizeLabel(field[1] ?? '')]
|
|
103
|
+
if (key) open = { ...open, [key]: (field[2] ?? '').trim() }
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (open) beats.push(sealBeat(open))
|
|
107
|
+
return beats
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Fills the five required fields with empty strings rather than leaving them
|
|
112
|
+
* undefined, so a downstream reader distinguishes "the operator left it blank"
|
|
113
|
+
* from "the label was misspelt" by the presence of the key alone.
|
|
114
|
+
*
|
|
115
|
+
* `transitionOut` stays optional, because the draft adds it only when it is
|
|
116
|
+
* not the default and an empty one would claim a decision nobody made.
|
|
117
|
+
*/
|
|
118
|
+
function sealBeat(open: Partial<Beat>): Beat {
|
|
119
|
+
const beat: Beat = {
|
|
120
|
+
index: open.index ?? 0,
|
|
121
|
+
name: open.name ?? '',
|
|
122
|
+
onScreen: open.onScreen ?? '',
|
|
123
|
+
action: open.action ?? '',
|
|
124
|
+
watchFor: open.watchFor ?? '',
|
|
125
|
+
emphasis: open.emphasis ?? '',
|
|
126
|
+
caption: open.caption ?? '',
|
|
127
|
+
}
|
|
128
|
+
return open.transitionOut === undefined
|
|
129
|
+
? beat
|
|
130
|
+
: { ...beat, transitionOut: open.transitionOut }
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function normalizeLabel(label: string): string {
|
|
134
|
+
return label.trim().toLowerCase().replace(/\s+/g, ' ')
|
|
135
|
+
}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import type { Beat, Draft } from '@/demo/beats'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Turns the human-facing draft into the machine-facing plan. The two are
|
|
5
|
+
* separate artifacts on purpose: a beat carries no target, no wait condition,
|
|
6
|
+
* and no timing, and putting those four fields on every beat would destroy the
|
|
7
|
+
* property the draft was designed around. See
|
|
8
|
+
* `.claude/groundwork/demo-recorder/06-decision.md`.
|
|
9
|
+
*
|
|
10
|
+
* A compiled plan is committed rather than scratch, because the timing below is
|
|
11
|
+
* a starting point the operator tunes and the draft cannot reproduce a tuned
|
|
12
|
+
* value.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** Hand-tuned in spike 2 against one fixture. Nothing establishes them in general. */
|
|
16
|
+
const POINTER_STEPS = 45
|
|
17
|
+
const TYPE_DELAY_MS = 110
|
|
18
|
+
const HOLD_MS = 600
|
|
19
|
+
const FINAL_HOLD_MS = 1200
|
|
20
|
+
|
|
21
|
+
const VIEWPORT = { width: 1280, height: 720 } as const
|
|
22
|
+
const ANNOTATIONS = {
|
|
23
|
+
durationMs: 900,
|
|
24
|
+
position: 'bottom-right',
|
|
25
|
+
fontSize: 22,
|
|
26
|
+
} as const
|
|
27
|
+
|
|
28
|
+
export type StepKind =
|
|
29
|
+
| 'navigate'
|
|
30
|
+
| 'click'
|
|
31
|
+
| 'fill'
|
|
32
|
+
| 'hover'
|
|
33
|
+
| 'scroll'
|
|
34
|
+
| 'wait'
|
|
35
|
+
| 'hold'
|
|
36
|
+
|
|
37
|
+
/** Verbs that point at an element, so a plan without a target cannot run. */
|
|
38
|
+
const TARGETED: ReadonlySet<StepKind> = new Set<StepKind>([
|
|
39
|
+
'click',
|
|
40
|
+
'fill',
|
|
41
|
+
'hover',
|
|
42
|
+
'scroll',
|
|
43
|
+
])
|
|
44
|
+
|
|
45
|
+
const VERBS: Record<string, StepKind> = {
|
|
46
|
+
navigate: 'navigate',
|
|
47
|
+
open: 'navigate',
|
|
48
|
+
visit: 'navigate',
|
|
49
|
+
load: 'navigate',
|
|
50
|
+
click: 'click',
|
|
51
|
+
press: 'click',
|
|
52
|
+
tap: 'click',
|
|
53
|
+
submit: 'click',
|
|
54
|
+
toggle: 'click',
|
|
55
|
+
type: 'fill',
|
|
56
|
+
fill: 'fill',
|
|
57
|
+
enter: 'fill',
|
|
58
|
+
input: 'fill',
|
|
59
|
+
hover: 'hover',
|
|
60
|
+
scroll: 'scroll',
|
|
61
|
+
wait: 'wait',
|
|
62
|
+
pause: 'wait',
|
|
63
|
+
settle: 'wait',
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface DemoStep {
|
|
67
|
+
readonly beat: number
|
|
68
|
+
readonly name: string
|
|
69
|
+
readonly kind: StepKind
|
|
70
|
+
readonly target: string
|
|
71
|
+
readonly text: string
|
|
72
|
+
readonly waitFor: string
|
|
73
|
+
readonly holdMs: number
|
|
74
|
+
readonly caption: string
|
|
75
|
+
readonly still: boolean
|
|
76
|
+
readonly note?: string
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface DemoPlan {
|
|
80
|
+
readonly slug: string
|
|
81
|
+
readonly title: string
|
|
82
|
+
readonly url: string
|
|
83
|
+
readonly viewport: { readonly width: number; readonly height: number }
|
|
84
|
+
readonly output: { readonly video: string; readonly still: string }
|
|
85
|
+
readonly pointer: { readonly steps: number; readonly typeDelayMs: number }
|
|
86
|
+
readonly annotations: typeof ANNOTATIONS
|
|
87
|
+
readonly steps: readonly DemoStep[]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface CompileOptions {
|
|
91
|
+
readonly slug: string
|
|
92
|
+
readonly outDir: string
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function compilePlan(draft: Draft, options: CompileOptions): DemoPlan {
|
|
96
|
+
const stillAt = heroIndex(draft.beats)
|
|
97
|
+
return {
|
|
98
|
+
slug: options.slug,
|
|
99
|
+
title: draft.title,
|
|
100
|
+
url: '',
|
|
101
|
+
viewport: VIEWPORT,
|
|
102
|
+
output: {
|
|
103
|
+
video: `${options.outDir}/${options.slug}.webm`,
|
|
104
|
+
still: `${options.outDir}/${options.slug}.png`,
|
|
105
|
+
},
|
|
106
|
+
pointer: { steps: POINTER_STEPS, typeDelayMs: TYPE_DELAY_MS },
|
|
107
|
+
annotations: ANNOTATIONS,
|
|
108
|
+
steps: draft.beats.map((beat, position) =>
|
|
109
|
+
compileStep(beat, {
|
|
110
|
+
still: position === stillAt,
|
|
111
|
+
last: position === draft.beats.length - 1,
|
|
112
|
+
}),
|
|
113
|
+
),
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function compileStep(
|
|
118
|
+
beat: Beat,
|
|
119
|
+
place: { still: boolean; last: boolean },
|
|
120
|
+
): DemoStep {
|
|
121
|
+
const verb = firstVerb(beat.action)
|
|
122
|
+
const kind = verb ? VERBS[verb] : undefined
|
|
123
|
+
const step: DemoStep = {
|
|
124
|
+
beat: beat.index,
|
|
125
|
+
name: beat.name,
|
|
126
|
+
kind: kind ?? 'hold',
|
|
127
|
+
target: '',
|
|
128
|
+
text: '',
|
|
129
|
+
waitFor: '',
|
|
130
|
+
holdMs: place.last ? FINAL_HOLD_MS : HOLD_MS,
|
|
131
|
+
caption: beat.caption,
|
|
132
|
+
still: place.still,
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (kind) return step
|
|
136
|
+
return {
|
|
137
|
+
...step,
|
|
138
|
+
note: `no step maps to the verb "${beat.action.trim()}", so this beat only waits`,
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The draft specifies one verb per beat, and a hand-edited beat reads as a
|
|
144
|
+
* phrase often enough that matching only the whole field would refuse work a
|
|
145
|
+
* reader can see is a click. The first recognized word wins.
|
|
146
|
+
*/
|
|
147
|
+
function firstVerb(action: string): string | undefined {
|
|
148
|
+
return action
|
|
149
|
+
.toLowerCase()
|
|
150
|
+
.split(/[^a-z]+/)
|
|
151
|
+
.find((word) => word in VERBS)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The still is a landing frame, so it wants the beat the draft calls the hero
|
|
156
|
+
* rather than an arbitrary one. Falling back to the last beat rather than the
|
|
157
|
+
* first is deliberate: a demo's final state is the payoff, and a cold open is
|
|
158
|
+
* usually an empty screen.
|
|
159
|
+
*/
|
|
160
|
+
function heroIndex(beats: readonly Beat[]): number {
|
|
161
|
+
const named = beats.findIndex((beat) => /hero/i.test(beat.name))
|
|
162
|
+
return named === -1 ? beats.length - 1 : named
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export type PlanParse =
|
|
166
|
+
| { status: 'parsed'; plan: DemoPlan }
|
|
167
|
+
| { status: 'failed'; reason: string }
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Validates a plan read off disk. The file is hand-edited between being
|
|
171
|
+
* compiled and being run, which is the whole reason it is committed rather than
|
|
172
|
+
* regenerated, so every field is checked here rather than trusted.
|
|
173
|
+
*
|
|
174
|
+
* An absent field takes the seeded default and a present one is kept, so a
|
|
175
|
+
* plan that dropped a timing block still runs while a tuned one is never
|
|
176
|
+
* overwritten.
|
|
177
|
+
*/
|
|
178
|
+
export function parsePlan(text: string): PlanParse {
|
|
179
|
+
let raw: unknown
|
|
180
|
+
try {
|
|
181
|
+
raw = JSON.parse(text)
|
|
182
|
+
} catch (error) {
|
|
183
|
+
return {
|
|
184
|
+
status: 'failed',
|
|
185
|
+
reason: error instanceof Error ? error.message : 'unreadable json',
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (!isRecord(raw)) return { status: 'failed', reason: 'not a json object' }
|
|
190
|
+
if (!Array.isArray(raw.steps))
|
|
191
|
+
return { status: 'failed', reason: 'steps is not an array' }
|
|
192
|
+
if (!raw.steps.length) return { status: 'failed', reason: 'steps is empty' }
|
|
193
|
+
|
|
194
|
+
const steps: DemoStep[] = []
|
|
195
|
+
for (const [index, entry] of raw.steps.entries()) {
|
|
196
|
+
const step = parseStep(entry, index)
|
|
197
|
+
if ('reason' in step) return { status: 'failed', reason: step.reason }
|
|
198
|
+
steps.push(step.step)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const slug = asText(raw.slug)
|
|
202
|
+
const output = isRecord(raw.output) ? raw.output : {}
|
|
203
|
+
const pointer = isRecord(raw.pointer) ? raw.pointer : {}
|
|
204
|
+
const viewport = isRecord(raw.viewport) ? raw.viewport : {}
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
status: 'parsed',
|
|
208
|
+
plan: {
|
|
209
|
+
slug,
|
|
210
|
+
title: asText(raw.title),
|
|
211
|
+
url: asText(raw.url),
|
|
212
|
+
viewport: {
|
|
213
|
+
width: asNumber(viewport.width, VIEWPORT.width),
|
|
214
|
+
height: asNumber(viewport.height, VIEWPORT.height),
|
|
215
|
+
},
|
|
216
|
+
output: {
|
|
217
|
+
video: asText(output.video) || `demos/${slug || 'demo'}.webm`,
|
|
218
|
+
still: asText(output.still) || `demos/${slug || 'demo'}.png`,
|
|
219
|
+
},
|
|
220
|
+
pointer: {
|
|
221
|
+
steps: asNumber(pointer.steps, POINTER_STEPS),
|
|
222
|
+
typeDelayMs: asNumber(pointer.typeDelayMs, TYPE_DELAY_MS),
|
|
223
|
+
},
|
|
224
|
+
annotations: ANNOTATIONS,
|
|
225
|
+
steps,
|
|
226
|
+
},
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function parseStep(
|
|
231
|
+
entry: unknown,
|
|
232
|
+
index: number,
|
|
233
|
+
): { step: DemoStep } | { reason: string } {
|
|
234
|
+
if (!isRecord(entry)) return { reason: `steps[${index}] is not an object` }
|
|
235
|
+
|
|
236
|
+
const kind = asText(entry.kind)
|
|
237
|
+
if (!isStepKind(kind)) {
|
|
238
|
+
return {
|
|
239
|
+
reason: `steps[${index}].kind is "${kind}", which is not a step this can drive`,
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const step: DemoStep = {
|
|
244
|
+
beat: asNumber(entry.beat, index + 1),
|
|
245
|
+
name: asText(entry.name),
|
|
246
|
+
kind,
|
|
247
|
+
target: asText(entry.target),
|
|
248
|
+
text: asText(entry.text),
|
|
249
|
+
waitFor: asText(entry.waitFor),
|
|
250
|
+
holdMs: asNumber(entry.holdMs, HOLD_MS),
|
|
251
|
+
caption: asText(entry.caption),
|
|
252
|
+
still: entry.still === true,
|
|
253
|
+
}
|
|
254
|
+
const note = asText(entry.note)
|
|
255
|
+
return { step: note ? { ...step, note } : step }
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function isStepKind(value: string): value is StepKind {
|
|
259
|
+
return (
|
|
260
|
+
value === 'navigate' ||
|
|
261
|
+
value === 'click' ||
|
|
262
|
+
value === 'fill' ||
|
|
263
|
+
value === 'hover' ||
|
|
264
|
+
value === 'scroll' ||
|
|
265
|
+
value === 'wait' ||
|
|
266
|
+
value === 'hold'
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
271
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function asText(value: unknown): string {
|
|
275
|
+
return typeof value === 'string' ? value : ''
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function asNumber(value: unknown, fallback: number): number {
|
|
279
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : fallback
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Names every field a person still has to fill before the plan can drive
|
|
284
|
+
* anything. Compile reports these and run refuses on them, so an unfilled plan
|
|
285
|
+
* fails at the point it is written rather than part-way through a recording.
|
|
286
|
+
*/
|
|
287
|
+
export function unresolved(plan: DemoPlan): string[] {
|
|
288
|
+
const missing: string[] = plan.url.trim() ? [] : ['url']
|
|
289
|
+
plan.steps.forEach((step, index) => {
|
|
290
|
+
if (TARGETED.has(step.kind) && !step.target.trim()) {
|
|
291
|
+
missing.push(`steps[${index}].target`)
|
|
292
|
+
}
|
|
293
|
+
})
|
|
294
|
+
return missing
|
|
295
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { CursorSet } from '@/demo/pointer'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The bundled pointer artwork, drawn as vector markup rather than read from a
|
|
5
|
+
* theme on disk. Spike 3 proved the browser decodes a Windows cursor resource
|
|
6
|
+
* directly, so `--cursor` points at a theme folder and gets that path instead.
|
|
7
|
+
* This set is what makes the command work in a target that has no theme to
|
|
8
|
+
* point at, which is every target on first run.
|
|
9
|
+
*
|
|
10
|
+
* Each drawing sits in a 48 by 48 box so one hotspot scale factor covers the
|
|
11
|
+
* set, and each carries a drop shadow so it stays visible over a light surface
|
|
12
|
+
* and a dark one.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const SHADOW =
|
|
16
|
+
'<filter id="s" x="-50%" y="-50%" width="200%" height="200%">' +
|
|
17
|
+
'<feDropShadow dx="0" dy="1" stdDeviation="1.2" flood-opacity="0.45"/></filter>'
|
|
18
|
+
|
|
19
|
+
function svg(body: string): string {
|
|
20
|
+
return `data:image/svg+xml;utf8,${encodeURIComponent(
|
|
21
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48" height="48">${SHADOW}<g filter="url(#s)">${body}</g></svg>`,
|
|
22
|
+
)}`
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const STROKE = 'fill="#ffffff" stroke="#1b1b1b" stroke-width="2.2"'
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Hotspots are stated against the 48 by 48 box each drawing uses, so the
|
|
29
|
+
* pointer scales them the same way it scales a hotspot read off a real cursor
|
|
30
|
+
* resource. Skipping the scale offsets the artwork by roughly a third of a
|
|
31
|
+
* cursor, which is the defect spike 3 recorded.
|
|
32
|
+
*/
|
|
33
|
+
export const DEFAULT_CURSORS: CursorSet = {
|
|
34
|
+
default: {
|
|
35
|
+
image: svg(
|
|
36
|
+
`<path ${STROKE} d="M5 3 L5 35 L13.5 27 L19 39.5 L25 37 L19.5 25 L31 24.5 Z"/>`,
|
|
37
|
+
),
|
|
38
|
+
hotspot: { width: 48, height: 48, hotspotX: 5, hotspotY: 3 },
|
|
39
|
+
},
|
|
40
|
+
pointer: {
|
|
41
|
+
image: svg(
|
|
42
|
+
`<path ${STROKE} d="M18 4 a3.2 3.2 0 0 1 6.4 0 v14 a3 3 0 0 1 5.6 0 v2 a3 3 0 0 1 5.6 0 v2 a3 3 0 0 1 5.4 0 v9 a12 12 0 0 1 -12 12 h-6 a12 12 0 0 1 -12 -12 v-9 a3.2 3.2 0 0 1 6.4 0 z"/>`,
|
|
43
|
+
),
|
|
44
|
+
hotspot: { width: 48, height: 48, hotspotX: 21, hotspotY: 4 },
|
|
45
|
+
},
|
|
46
|
+
// Drawn as one filled outline rather than three stroked segments. A stroked
|
|
47
|
+
// version needs its own fill, and a second fill attribute on a path carrying
|
|
48
|
+
// STROKE makes the markup invalid, which renders as a broken image.
|
|
49
|
+
text: {
|
|
50
|
+
image: svg(
|
|
51
|
+
`<path ${STROKE} d="M18 5 h12 v3.5 h-4 v31 h4 V43 h-12 v-3.5 h4 v-31 h-4 z"/>`,
|
|
52
|
+
),
|
|
53
|
+
hotspot: { width: 48, height: 48, hotspotX: 24, hotspotY: 24 },
|
|
54
|
+
},
|
|
55
|
+
}
|