saccade 0.0.1
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/README.md +135 -0
- package/dist/core.cjs +1736 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +276 -0
- package/dist/core.d.ts +276 -0
- package/dist/core.mjs +1703 -0
- package/dist/core.mjs.map +1 -0
- package/dist/index.cjs +2822 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +152 -0
- package/dist/index.d.ts +152 -0
- package/dist/index.mjs +2791 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# saccade
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/saccade)
|
|
4
|
+
|
|
5
|
+
**Saccade** is a drop-in animation inspector for web apps. Slow down time, record interactions, scrub through transitions frame-by-frame, and copy structured animation state for AI coding agents.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install saccade -D
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Lapse } from 'saccade'
|
|
17
|
+
|
|
18
|
+
function App() {
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<YourApp />
|
|
22
|
+
<Lapse />
|
|
23
|
+
</>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
A floating panel appears in the corner. Use it to control speed, record, and scrub.
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- **Speed control** — Slow down or speed up all animations (CSS transitions, CSS animations, JS timers, `requestAnimationFrame`, video/audio)
|
|
33
|
+
- **Timeline recording** — Record interactions, then scrub through captured frames to inspect mid-transition states
|
|
34
|
+
- **LLM export** — Copy structured animation state (properties, keyframes, easing, progress) as markdown for AI coding agents
|
|
35
|
+
- **Shadow DOM isolation** — Panel styles never leak into your app
|
|
36
|
+
- **Auto-stop** — Recording caps at 60s / 3600 frames, and stops when the tab is hidden
|
|
37
|
+
- **Zero config** — Drop in the component and go
|
|
38
|
+
|
|
39
|
+
## How it works
|
|
40
|
+
|
|
41
|
+
Saccade patches timing APIs (`setTimeout`, `setInterval`, `requestAnimationFrame`, `performance.now`, `Date.now`) to scale time by a configurable factor. During recording, it snapshots computed styles, attributes, and animation state every frame. In scrub mode, it replays those snapshots by applying inline styles directly to the DOM.
|
|
42
|
+
|
|
43
|
+
## Props
|
|
44
|
+
|
|
45
|
+
| Prop | Type | Default | Description |
|
|
46
|
+
|------|------|---------|-------------|
|
|
47
|
+
| `position` | `'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right'` | `'bottom-left'` | Panel position |
|
|
48
|
+
|
|
49
|
+
## Core API
|
|
50
|
+
|
|
51
|
+
For non-React usage or programmatic control:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { LapseEngine } from 'saccade/core'
|
|
55
|
+
|
|
56
|
+
const engine = new LapseEngine()
|
|
57
|
+
|
|
58
|
+
// Speed control
|
|
59
|
+
engine.setSpeed(0.25) // quarter speed
|
|
60
|
+
engine.getSpeed()
|
|
61
|
+
|
|
62
|
+
// Recording
|
|
63
|
+
engine.startRecording()
|
|
64
|
+
const capture = engine.stopRecording()
|
|
65
|
+
|
|
66
|
+
// Scrubbing
|
|
67
|
+
engine.seekTo(500) // seek to 500ms
|
|
68
|
+
engine.release()
|
|
69
|
+
|
|
70
|
+
// Export
|
|
71
|
+
const markdown = engine.exportForLLM(500, 'active', 'standard')
|
|
72
|
+
|
|
73
|
+
// Cleanup
|
|
74
|
+
engine.destroy()
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## React Hooks
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import { LapseProvider, useLapseEngine, useTimeline, useSpeed } from 'saccade'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### `useSpeed`
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
const { speed, isPaused, setSpeed, togglePause } = useSpeed()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### `useTimeline`
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
const {
|
|
93
|
+
state, // 'idle' | 'recording' | 'scrubbing'
|
|
94
|
+
capture, // TimelineCapture | null
|
|
95
|
+
scrubTime, // current scrub position in ms
|
|
96
|
+
startRecording,
|
|
97
|
+
stopRecording,
|
|
98
|
+
seek,
|
|
99
|
+
release,
|
|
100
|
+
exportLLM,
|
|
101
|
+
} = useTimeline()
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Export Detail Levels
|
|
105
|
+
|
|
106
|
+
The LLM export supports four detail levels:
|
|
107
|
+
|
|
108
|
+
| Level | Description |
|
|
109
|
+
|-------|-------------|
|
|
110
|
+
| `compact` | One line per element — property names and timing only |
|
|
111
|
+
| `standard` | Full property values, ranges, interaction state |
|
|
112
|
+
| `detailed` | Adds CSS variables, `@keyframes` source, transition conflicts |
|
|
113
|
+
| `forensic` | Adds viewport, URL, user agent, device pixel ratio |
|
|
114
|
+
|
|
115
|
+
## Types
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
import type {
|
|
119
|
+
AnimationInfo,
|
|
120
|
+
TimelineCapture,
|
|
121
|
+
TimelineExport,
|
|
122
|
+
FrameSnapshot,
|
|
123
|
+
ExportFilter,
|
|
124
|
+
OutputDetailLevel,
|
|
125
|
+
} from 'saccade'
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Requirements
|
|
129
|
+
|
|
130
|
+
- React 18+ (for the `<Lapse>` component)
|
|
131
|
+
- No React dependency needed for `saccade/core`
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
MIT
|