saccade 0.0.3 → 0.2.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/README.md +65 -2
- package/dist/core.cjs +267 -157
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +63 -11
- package/dist/core.d.ts +63 -11
- package/dist/core.mjs +264 -156
- package/dist/core.mjs.map +1 -1
- package/dist/index.cjs +299 -193
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -11
- package/dist/index.d.ts +37 -11
- package/dist/index.mjs +297 -193
- package/dist/index.mjs.map +1 -1
- package/dist/install.cjs +1846 -0
- package/dist/install.cjs.map +1 -0
- package/dist/install.d.cts +129 -0
- package/dist/install.d.ts +129 -0
- package/dist/install.mjs +1819 -0
- package/dist/install.mjs.map +1 -0
- package/package.json +12 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as react from 'react';
|
|
3
2
|
import { ReactNode } from 'react';
|
|
4
|
-
|
|
5
|
-
type SaccadePosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
6
|
-
type SaccadeProps = {
|
|
7
|
-
/** Panel position. Default: 'bottom-left' */
|
|
8
|
-
position?: SaccadePosition;
|
|
9
|
-
};
|
|
10
|
-
declare function Saccade({ position }: SaccadeProps): react_jsx_runtime.JSX.Element;
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
11
4
|
|
|
12
5
|
type ExportFilter = 'active' | 'all-animations' | 'all-elements';
|
|
13
|
-
type OutputDetailLevel = '
|
|
6
|
+
type OutputDetailLevel = 'brief' | 'moderate' | 'detailed' | 'granular';
|
|
14
7
|
type Rect = {
|
|
15
8
|
x: number;
|
|
16
9
|
y: number;
|
|
@@ -30,6 +23,8 @@ type AnimationInfo = {
|
|
|
30
23
|
resolvedVars: Record<string, string> | null;
|
|
31
24
|
conflicts: string[] | null;
|
|
32
25
|
layoutAnimation?: boolean;
|
|
26
|
+
rawKeyframes?: Keyframe[];
|
|
27
|
+
rawTiming?: EffectTiming;
|
|
33
28
|
};
|
|
34
29
|
type PropertySnapshot = {
|
|
35
30
|
property: string;
|
|
@@ -110,6 +105,18 @@ declare class SaccadeEngine {
|
|
|
110
105
|
getCapture(): TimelineCapture | null;
|
|
111
106
|
setSpeed(speed: number): void;
|
|
112
107
|
getSpeed(): number;
|
|
108
|
+
/**
|
|
109
|
+
* Install the timing patches immediately, without changing speed.
|
|
110
|
+
*
|
|
111
|
+
* Call this as early as possible (before app code, GSAP, or Framer Motion
|
|
112
|
+
* run) so they capture the patched time functions rather than the originals.
|
|
113
|
+
* Idempotent and harmless to call more than once. `setSpeed` and
|
|
114
|
+
* `startRecording` also install on demand, so this is only needed to win the
|
|
115
|
+
* early-load race against libraries that cache `Date.now`/`performance.now`.
|
|
116
|
+
*/
|
|
117
|
+
install(): void;
|
|
118
|
+
/** Register a module-imported GSAP instance so saccade can slow it. */
|
|
119
|
+
registerGSAP(gsap: any): void;
|
|
113
120
|
startRecording(boundingBox?: Rect | null): void;
|
|
114
121
|
stopRecording(): TimelineCapture;
|
|
115
122
|
seekTo(timeMs: number): void;
|
|
@@ -121,8 +128,23 @@ declare class SaccadeEngine {
|
|
|
121
128
|
destroy(): void;
|
|
122
129
|
}
|
|
123
130
|
|
|
124
|
-
|
|
131
|
+
type SaccadePosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
132
|
+
type SaccadeProps = {
|
|
133
|
+
/** Panel position. Default: 'bottom-left' */
|
|
134
|
+
position?: SaccadePosition;
|
|
135
|
+
/** Engine the panel should drive. Defaults to the shared singleton, so app
|
|
136
|
+
* code can control the same engine the panel does (e.g. via
|
|
137
|
+
* `getSharedEngine()` or `import 'saccade/install'`). Pass your own only if
|
|
138
|
+
* you deliberately want an isolated engine. */
|
|
139
|
+
engine?: SaccadeEngine;
|
|
140
|
+
};
|
|
141
|
+
declare function Saccade({ position, engine }: SaccadeProps): react.ReactPortal | null;
|
|
142
|
+
|
|
143
|
+
declare function SaccadeProvider({ children, engine }: {
|
|
125
144
|
children: ReactNode;
|
|
145
|
+
/** Engine to provide. Defaults to the process-wide shared singleton so the
|
|
146
|
+
* panel and app code (and `saccade/install`) all drive the same instance. */
|
|
147
|
+
engine?: SaccadeEngine;
|
|
126
148
|
}): react_jsx_runtime.JSX.Element;
|
|
127
149
|
declare function useSaccadeEngine(): SaccadeEngine;
|
|
128
150
|
|
|
@@ -149,4 +171,8 @@ declare function useSpeed(): {
|
|
|
149
171
|
togglePause: () => void;
|
|
150
172
|
};
|
|
151
173
|
|
|
152
|
-
|
|
174
|
+
declare function getSharedEngine(): SaccadeEngine;
|
|
175
|
+
/** Test/teardown hook — drops the singleton so the next get() makes a fresh one. */
|
|
176
|
+
declare function resetSharedEngine(): void;
|
|
177
|
+
|
|
178
|
+
export { type AnimationInfo, type ExportFilter, type FrameSnapshot, type OutputDetailLevel, type Rect, Saccade, SaccadeEngine, type SaccadePosition, type SaccadeProps, SaccadeProvider, type SaccadeState, type TimelineCapture, type TimelineExport, getSharedEngine, resetSharedEngine, useSaccadeEngine, useSpeed, useTimeline };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as react from 'react';
|
|
3
2
|
import { ReactNode } from 'react';
|
|
4
|
-
|
|
5
|
-
type SaccadePosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
6
|
-
type SaccadeProps = {
|
|
7
|
-
/** Panel position. Default: 'bottom-left' */
|
|
8
|
-
position?: SaccadePosition;
|
|
9
|
-
};
|
|
10
|
-
declare function Saccade({ position }: SaccadeProps): react_jsx_runtime.JSX.Element;
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
11
4
|
|
|
12
5
|
type ExportFilter = 'active' | 'all-animations' | 'all-elements';
|
|
13
|
-
type OutputDetailLevel = '
|
|
6
|
+
type OutputDetailLevel = 'brief' | 'moderate' | 'detailed' | 'granular';
|
|
14
7
|
type Rect = {
|
|
15
8
|
x: number;
|
|
16
9
|
y: number;
|
|
@@ -30,6 +23,8 @@ type AnimationInfo = {
|
|
|
30
23
|
resolvedVars: Record<string, string> | null;
|
|
31
24
|
conflicts: string[] | null;
|
|
32
25
|
layoutAnimation?: boolean;
|
|
26
|
+
rawKeyframes?: Keyframe[];
|
|
27
|
+
rawTiming?: EffectTiming;
|
|
33
28
|
};
|
|
34
29
|
type PropertySnapshot = {
|
|
35
30
|
property: string;
|
|
@@ -110,6 +105,18 @@ declare class SaccadeEngine {
|
|
|
110
105
|
getCapture(): TimelineCapture | null;
|
|
111
106
|
setSpeed(speed: number): void;
|
|
112
107
|
getSpeed(): number;
|
|
108
|
+
/**
|
|
109
|
+
* Install the timing patches immediately, without changing speed.
|
|
110
|
+
*
|
|
111
|
+
* Call this as early as possible (before app code, GSAP, or Framer Motion
|
|
112
|
+
* run) so they capture the patched time functions rather than the originals.
|
|
113
|
+
* Idempotent and harmless to call more than once. `setSpeed` and
|
|
114
|
+
* `startRecording` also install on demand, so this is only needed to win the
|
|
115
|
+
* early-load race against libraries that cache `Date.now`/`performance.now`.
|
|
116
|
+
*/
|
|
117
|
+
install(): void;
|
|
118
|
+
/** Register a module-imported GSAP instance so saccade can slow it. */
|
|
119
|
+
registerGSAP(gsap: any): void;
|
|
113
120
|
startRecording(boundingBox?: Rect | null): void;
|
|
114
121
|
stopRecording(): TimelineCapture;
|
|
115
122
|
seekTo(timeMs: number): void;
|
|
@@ -121,8 +128,23 @@ declare class SaccadeEngine {
|
|
|
121
128
|
destroy(): void;
|
|
122
129
|
}
|
|
123
130
|
|
|
124
|
-
|
|
131
|
+
type SaccadePosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
132
|
+
type SaccadeProps = {
|
|
133
|
+
/** Panel position. Default: 'bottom-left' */
|
|
134
|
+
position?: SaccadePosition;
|
|
135
|
+
/** Engine the panel should drive. Defaults to the shared singleton, so app
|
|
136
|
+
* code can control the same engine the panel does (e.g. via
|
|
137
|
+
* `getSharedEngine()` or `import 'saccade/install'`). Pass your own only if
|
|
138
|
+
* you deliberately want an isolated engine. */
|
|
139
|
+
engine?: SaccadeEngine;
|
|
140
|
+
};
|
|
141
|
+
declare function Saccade({ position, engine }: SaccadeProps): react.ReactPortal | null;
|
|
142
|
+
|
|
143
|
+
declare function SaccadeProvider({ children, engine }: {
|
|
125
144
|
children: ReactNode;
|
|
145
|
+
/** Engine to provide. Defaults to the process-wide shared singleton so the
|
|
146
|
+
* panel and app code (and `saccade/install`) all drive the same instance. */
|
|
147
|
+
engine?: SaccadeEngine;
|
|
126
148
|
}): react_jsx_runtime.JSX.Element;
|
|
127
149
|
declare function useSaccadeEngine(): SaccadeEngine;
|
|
128
150
|
|
|
@@ -149,4 +171,8 @@ declare function useSpeed(): {
|
|
|
149
171
|
togglePause: () => void;
|
|
150
172
|
};
|
|
151
173
|
|
|
152
|
-
|
|
174
|
+
declare function getSharedEngine(): SaccadeEngine;
|
|
175
|
+
/** Test/teardown hook — drops the singleton so the next get() makes a fresh one. */
|
|
176
|
+
declare function resetSharedEngine(): void;
|
|
177
|
+
|
|
178
|
+
export { type AnimationInfo, type ExportFilter, type FrameSnapshot, type OutputDetailLevel, type Rect, Saccade, SaccadeEngine, type SaccadePosition, type SaccadeProps, SaccadeProvider, type SaccadeState, type TimelineCapture, type TimelineExport, getSharedEngine, resetSharedEngine, useSaccadeEngine, useSpeed, useTimeline };
|