@pixerate/editor 0.147.0 → 0.148.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/dist/effects/authoring-session.d.cts +25 -0
- package/dist/effects/authoring-session.d.ts +25 -0
- package/dist/effects/authoring-tools.d.cts +31 -0
- package/dist/effects/authoring-tools.d.ts +31 -0
- package/dist/effects/authoring.d.cts +152 -0
- package/dist/effects/authoring.d.ts +152 -0
- package/dist/effects/conformance.d.cts +2 -0
- package/dist/effects/conformance.d.ts +2 -0
- package/dist/effects/fake.d.cts +2 -0
- package/dist/effects/fake.d.ts +2 -0
- package/dist/effects/index.cjs +1216 -9
- package/dist/effects/index.d.cts +3 -0
- package/dist/effects/index.d.ts +3 -0
- package/dist/effects/index.js +1210 -3
- package/dist/effects/types.d.cts +9 -2
- package/dist/effects/types.d.ts +9 -2
- package/dist/effects/ui.d.cts +8 -0
- package/dist/effects/ui.d.ts +8 -0
- package/package.json +1 -1
- package/skills/README.md +1 -0
- package/skills/pixerate-effect-authoring/SKILL.md +80 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic effect authoring session: controls values, keyframes, presets, timing, undo/redo
|
|
3
|
+
* and preview rendering for any effect provider.
|
|
4
|
+
*/
|
|
5
|
+
import { HistoryManager } from '../history/HistoryManager.cjs';
|
|
6
|
+
import type { EffectAuthoringSession, EffectAuthoringSource } from './authoring.cjs';
|
|
7
|
+
import type { EffectProvider } from './types.cjs';
|
|
8
|
+
export interface GenericAuthoringOptions {
|
|
9
|
+
/** The provider whose `describe` and `createRenderer` the session uses. */
|
|
10
|
+
provider: EffectProvider;
|
|
11
|
+
/** Undo history to record into (default: a new HistoryManager). */
|
|
12
|
+
history?: HistoryManager;
|
|
13
|
+
/**
|
|
14
|
+
* Time source for playback: called with a frame callback, returns a cancel function.
|
|
15
|
+
* Default: requestAnimationFrame where it exists, else a 16 ms timer. Tests pass a manual one.
|
|
16
|
+
*/
|
|
17
|
+
schedule?: (frame: (now: number) => void) => () => void;
|
|
18
|
+
/** Ms within which `setValue` calls on one control with no gesture merge (default 400). */
|
|
19
|
+
mergeWindowMs?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates an effect authoring session with values, presets, keyframes, timing and undo
|
|
23
|
+
* over any provider. It has no source editing (`sourceLanguage: null`).
|
|
24
|
+
*/
|
|
25
|
+
export declare function createEffectAuthoringSession(source: EffectAuthoringSource, options: GenericAuthoringOptions): Promise<EffectAuthoringSession>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic effect authoring session: controls values, keyframes, presets, timing, undo/redo
|
|
3
|
+
* and preview rendering for any effect provider.
|
|
4
|
+
*/
|
|
5
|
+
import { HistoryManager } from '../history/HistoryManager.js';
|
|
6
|
+
import type { EffectAuthoringSession, EffectAuthoringSource } from './authoring.js';
|
|
7
|
+
import type { EffectProvider } from './types.js';
|
|
8
|
+
export interface GenericAuthoringOptions {
|
|
9
|
+
/** The provider whose `describe` and `createRenderer` the session uses. */
|
|
10
|
+
provider: EffectProvider;
|
|
11
|
+
/** Undo history to record into (default: a new HistoryManager). */
|
|
12
|
+
history?: HistoryManager;
|
|
13
|
+
/**
|
|
14
|
+
* Time source for playback: called with a frame callback, returns a cancel function.
|
|
15
|
+
* Default: requestAnimationFrame where it exists, else a 16 ms timer. Tests pass a manual one.
|
|
16
|
+
*/
|
|
17
|
+
schedule?: (frame: (now: number) => void) => () => void;
|
|
18
|
+
/** Ms within which `setValue` calls on one control with no gesture merge (default 400). */
|
|
19
|
+
mergeWindowMs?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates an effect authoring session with values, presets, keyframes, timing and undo
|
|
23
|
+
* over any provider. It has no source editing (`sourceLanguage: null`).
|
|
24
|
+
*/
|
|
25
|
+
export declare function createEffectAuthoringSession(source: EffectAuthoringSource, options: GenericAuthoringOptions): Promise<EffectAuthoringSession>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent tools for authoring shaders and procedural effects: inspecting controls, setting values,
|
|
3
|
+
* applying presets, managing keyframes on animation tracks, playback timing, and previewing.
|
|
4
|
+
*/
|
|
5
|
+
import type { AgentToolProvider } from '../tools/registry.cjs';
|
|
6
|
+
import type { EffectAuthoringSession } from './authoring.cjs';
|
|
7
|
+
export interface EffectAuthoringToolHost {
|
|
8
|
+
/**
|
|
9
|
+
* The open authoring session, or null when nothing is open (tools then refuse with a message
|
|
10
|
+
* explaining how to open one).
|
|
11
|
+
*/
|
|
12
|
+
session(): EffectAuthoringSession | null;
|
|
13
|
+
/** Optional: a PNG data URL of the preview, for the `effect_authoring_view` tool. */
|
|
14
|
+
capture?(): Promise<string>;
|
|
15
|
+
/** Lets the tool list follow session opens, closes, or changes. */
|
|
16
|
+
subscribe?: (notify: () => void) => () => void;
|
|
17
|
+
}
|
|
18
|
+
export interface EffectAuthoringToolOptions {
|
|
19
|
+
/** Provider id (unique per registry). Default: 'effect-authoring'. */
|
|
20
|
+
id?: string;
|
|
21
|
+
/** Tool-name prefix (`<namespace>__<name>`); defaults to the provider id. */
|
|
22
|
+
namespace?: string;
|
|
23
|
+
/** Toolset title. */
|
|
24
|
+
title?: string;
|
|
25
|
+
/** Toolset description. */
|
|
26
|
+
description?: string;
|
|
27
|
+
/** Name of the agent skill documenting these tools. */
|
|
28
|
+
skill?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Creates the agent tool provider for effect authoring. */
|
|
31
|
+
export declare function createEffectAuthoringToolProvider(host: EffectAuthoringToolHost, options?: EffectAuthoringToolOptions): AgentToolProvider;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent tools for authoring shaders and procedural effects: inspecting controls, setting values,
|
|
3
|
+
* applying presets, managing keyframes on animation tracks, playback timing, and previewing.
|
|
4
|
+
*/
|
|
5
|
+
import type { AgentToolProvider } from '../tools/registry.js';
|
|
6
|
+
import type { EffectAuthoringSession } from './authoring.js';
|
|
7
|
+
export interface EffectAuthoringToolHost {
|
|
8
|
+
/**
|
|
9
|
+
* The open authoring session, or null when nothing is open (tools then refuse with a message
|
|
10
|
+
* explaining how to open one).
|
|
11
|
+
*/
|
|
12
|
+
session(): EffectAuthoringSession | null;
|
|
13
|
+
/** Optional: a PNG data URL of the preview, for the `effect_authoring_view` tool. */
|
|
14
|
+
capture?(): Promise<string>;
|
|
15
|
+
/** Lets the tool list follow session opens, closes, or changes. */
|
|
16
|
+
subscribe?: (notify: () => void) => () => void;
|
|
17
|
+
}
|
|
18
|
+
export interface EffectAuthoringToolOptions {
|
|
19
|
+
/** Provider id (unique per registry). Default: 'effect-authoring'. */
|
|
20
|
+
id?: string;
|
|
21
|
+
/** Tool-name prefix (`<namespace>__<name>`); defaults to the provider id. */
|
|
22
|
+
namespace?: string;
|
|
23
|
+
/** Toolset title. */
|
|
24
|
+
title?: string;
|
|
25
|
+
/** Toolset description. */
|
|
26
|
+
description?: string;
|
|
27
|
+
/** Name of the agent skill documenting these tools. */
|
|
28
|
+
skill?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Creates the agent tool provider for effect authoring. */
|
|
31
|
+
export declare function createEffectAuthoringToolProvider(host: EffectAuthoringToolHost, options?: EffectAuthoringToolOptions): AgentToolProvider;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The effects authoring contract: types for editing effects (GLSL or SVG source, control values,
|
|
3
|
+
* keyframes, presets, timeline and playback). Implementations may be headless sessions like Flair's
|
|
4
|
+
* `EffectEditor` or the generic authoring session provided by this package.
|
|
5
|
+
*/
|
|
6
|
+
import type { AnimationEasing } from '../animation/easing.cjs';
|
|
7
|
+
import type { EffectDescription, EffectKind, EffectPreset, EffectRenderer, EffectRendererOptions, EffectValue, EffectValues, MaybePromise } from './types.cjs';
|
|
8
|
+
/** A document saved earlier by `exportDocument` and reopened with `{ document }`. */
|
|
9
|
+
export interface EffectAuthoringDocument {
|
|
10
|
+
version: 1;
|
|
11
|
+
providerId: string;
|
|
12
|
+
effectId: string;
|
|
13
|
+
name: string;
|
|
14
|
+
values: EffectValues;
|
|
15
|
+
tracks: Readonly<Record<string, readonly EffectKeyframe[]>>;
|
|
16
|
+
presets: readonly EffectPreset[];
|
|
17
|
+
duration: number;
|
|
18
|
+
loop: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** What to open: a catalog effect (optionally with a preset applied), or a document saved earlier by `exportDocument`. */
|
|
21
|
+
export type EffectAuthoringSource = {
|
|
22
|
+
effectId: string;
|
|
23
|
+
preset?: string;
|
|
24
|
+
} | {
|
|
25
|
+
document: EffectAuthoringDocument | unknown;
|
|
26
|
+
};
|
|
27
|
+
/** The language of an editable source, or null when the effect has no source to edit. */
|
|
28
|
+
export type EffectSourceLanguage = 'glsl' | 'svg' | null;
|
|
29
|
+
/** One keyframe of an animated control. */
|
|
30
|
+
export interface EffectKeyframe {
|
|
31
|
+
/** Ms from the start of the effect. */
|
|
32
|
+
time: number;
|
|
33
|
+
/** The value at this keyframe. */
|
|
34
|
+
value: EffectValue;
|
|
35
|
+
/** Easing into the next keyframe (default `linear`). */
|
|
36
|
+
easing?: AnimationEasing;
|
|
37
|
+
}
|
|
38
|
+
/** A problem with the effect, e.g. a compile error. `line` is 1-based in `source` when known. */
|
|
39
|
+
export interface EffectAuthoringIssue {
|
|
40
|
+
message: string;
|
|
41
|
+
line?: number;
|
|
42
|
+
severity: 'error' | 'warning';
|
|
43
|
+
}
|
|
44
|
+
/** The observable state of an effect authoring session. */
|
|
45
|
+
export interface EffectAuthoringState {
|
|
46
|
+
/** Stable id of the provider that owns this effect. */
|
|
47
|
+
providerId: string;
|
|
48
|
+
/** The id the effect was opened from, or null for a document with no catalog id. */
|
|
49
|
+
effectId: string | null;
|
|
50
|
+
/** Display name of the effect. */
|
|
51
|
+
name: string;
|
|
52
|
+
/** How the effect is drawn. */
|
|
53
|
+
kind: EffectKind;
|
|
54
|
+
/** The current controls, defaults and presets. They change when the source changes. */
|
|
55
|
+
description: EffectDescription;
|
|
56
|
+
/** Editable source, or null (see `sourceLanguage`). */
|
|
57
|
+
source: string | null;
|
|
58
|
+
/** Language of `source`, or null when source editing is not supported. */
|
|
59
|
+
sourceLanguage: EffectSourceLanguage;
|
|
60
|
+
/** Every control's value at the playhead (keyframes applied). */
|
|
61
|
+
values: EffectValues;
|
|
62
|
+
/** Keyframes per control. A control with no entry is not animated. */
|
|
63
|
+
tracks: Readonly<Record<string, readonly EffectKeyframe[]>>;
|
|
64
|
+
/** Diagnostic issues, compile errors and warnings. */
|
|
65
|
+
issues: readonly EffectAuthoringIssue[];
|
|
66
|
+
/** Whether the source compiled: true, false, or null when that is not known yet (no preview has compiled it). */
|
|
67
|
+
compiled: boolean | null;
|
|
68
|
+
/** Current playhead position (ms). */
|
|
69
|
+
time: number;
|
|
70
|
+
/** Length of one play (ms). */
|
|
71
|
+
duration: number;
|
|
72
|
+
/** Whether playback loops. */
|
|
73
|
+
loop: boolean;
|
|
74
|
+
/** Whether playback is currently active. */
|
|
75
|
+
playing: boolean;
|
|
76
|
+
/** Whether an undo action is available. */
|
|
77
|
+
canUndo: boolean;
|
|
78
|
+
/** Whether a redo action is available. */
|
|
79
|
+
canRedo: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** The result of a session mutation: either successful, or refused with a reason message. */
|
|
82
|
+
export type EffectAuthoringResult<T = Record<never, never>> = ({
|
|
83
|
+
ok: true;
|
|
84
|
+
} & T) | {
|
|
85
|
+
ok: false;
|
|
86
|
+
message: string;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* A live editing session for an effect: controls values, keyframes, presets, source editing,
|
|
90
|
+
* playback timeline and undo/redo history.
|
|
91
|
+
*/
|
|
92
|
+
export interface EffectAuthoringSession {
|
|
93
|
+
/**
|
|
94
|
+
* The current state. Returns the same object reference until something changes, suitable
|
|
95
|
+
* for React's `useSyncExternalStore` or Svelte store subscriptions.
|
|
96
|
+
*/
|
|
97
|
+
getState(): EffectAuthoringState;
|
|
98
|
+
/** Called after every change. Returns a function that unsubscribes. */
|
|
99
|
+
subscribe(listener: (state: EffectAuthoringState) => void): () => void;
|
|
100
|
+
/** Replaces the source. Refused when `sourceLanguage` is null. */
|
|
101
|
+
setSource?(source: string): MaybePromise<EffectAuthoringResult<{
|
|
102
|
+
issues: readonly EffectAuthoringIssue[];
|
|
103
|
+
}>>;
|
|
104
|
+
/**
|
|
105
|
+
* Sets a control at the playhead: updates the value if the control is not animated,
|
|
106
|
+
* else creates/updates a keyframe at `time`. Calls with the same `gesture` key merge into one undo step.
|
|
107
|
+
*/
|
|
108
|
+
setValue(name: string, value: EffectValue, options?: {
|
|
109
|
+
gesture?: string | null;
|
|
110
|
+
}): EffectAuthoringResult;
|
|
111
|
+
/** Sets several controls as one undo step, all or nothing: one bad value refuses the lot. */
|
|
112
|
+
setValues(values: EffectValues, options?: {
|
|
113
|
+
gesture?: string | null;
|
|
114
|
+
}): EffectAuthoringResult;
|
|
115
|
+
/** Puts controls back to their defaults (default: all controls). */
|
|
116
|
+
resetValues(names?: readonly string[]): EffectAuthoringResult;
|
|
117
|
+
/** Applies a named preset's values. */
|
|
118
|
+
applyPreset(name: string): EffectAuthoringResult;
|
|
119
|
+
/** Saves the current values as a preset, or replaces an existing preset with the same name. */
|
|
120
|
+
savePreset(name: string): EffectAuthoringResult;
|
|
121
|
+
/** Adds or replaces a keyframe. `value` defaults to the control's value at that time. */
|
|
122
|
+
setKeyframe(name: string, time: number, value?: EffectValue, easing?: AnimationEasing): EffectAuthoringResult;
|
|
123
|
+
/** Removes a keyframe from a control at the given time. */
|
|
124
|
+
removeKeyframe(name: string, time: number): EffectAuthoringResult;
|
|
125
|
+
/** Removes every keyframe of a control. The value it has at the playhead becomes its static value. */
|
|
126
|
+
clearTrack(name: string): EffectAuthoringResult;
|
|
127
|
+
/** Configures timeline duration and loop behavior. */
|
|
128
|
+
setTiming(timing: {
|
|
129
|
+
duration?: number;
|
|
130
|
+
loop?: boolean;
|
|
131
|
+
}): EffectAuthoringResult;
|
|
132
|
+
/** Starts playback. */
|
|
133
|
+
play(): void;
|
|
134
|
+
/** Pauses playback. */
|
|
135
|
+
pause(): void;
|
|
136
|
+
/** Moves the playhead (clamped to 0..duration). */
|
|
137
|
+
seek(time: number): void;
|
|
138
|
+
/** Reverts the last edit. Returns true if state changed. */
|
|
139
|
+
undo(): boolean;
|
|
140
|
+
/** Redoes the last undone edit. Returns true if state changed. */
|
|
141
|
+
redo(): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Creates a renderer that draws this session's current effect (source and values as they are at each
|
|
144
|
+
* `render` call). `render({ time })` draws the effect at `time` with the keyframed values for
|
|
145
|
+
* that time unless `values` is given. A compile failure shows in `issues` and `compiled`.
|
|
146
|
+
*/
|
|
147
|
+
createPreview(options: EffectRendererOptions): MaybePromise<EffectRenderer>;
|
|
148
|
+
/** Exports the document as plain JSON, to save and reopen with `{ document }`. */
|
|
149
|
+
exportDocument(): EffectAuthoringDocument;
|
|
150
|
+
/** Disposes the session, stops playback, cleans up listeners and disposes created previews. */
|
|
151
|
+
dispose(): void;
|
|
152
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The effects authoring contract: types for editing effects (GLSL or SVG source, control values,
|
|
3
|
+
* keyframes, presets, timeline and playback). Implementations may be headless sessions like Flair's
|
|
4
|
+
* `EffectEditor` or the generic authoring session provided by this package.
|
|
5
|
+
*/
|
|
6
|
+
import type { AnimationEasing } from '../animation/easing.js';
|
|
7
|
+
import type { EffectDescription, EffectKind, EffectPreset, EffectRenderer, EffectRendererOptions, EffectValue, EffectValues, MaybePromise } from './types.js';
|
|
8
|
+
/** A document saved earlier by `exportDocument` and reopened with `{ document }`. */
|
|
9
|
+
export interface EffectAuthoringDocument {
|
|
10
|
+
version: 1;
|
|
11
|
+
providerId: string;
|
|
12
|
+
effectId: string;
|
|
13
|
+
name: string;
|
|
14
|
+
values: EffectValues;
|
|
15
|
+
tracks: Readonly<Record<string, readonly EffectKeyframe[]>>;
|
|
16
|
+
presets: readonly EffectPreset[];
|
|
17
|
+
duration: number;
|
|
18
|
+
loop: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** What to open: a catalog effect (optionally with a preset applied), or a document saved earlier by `exportDocument`. */
|
|
21
|
+
export type EffectAuthoringSource = {
|
|
22
|
+
effectId: string;
|
|
23
|
+
preset?: string;
|
|
24
|
+
} | {
|
|
25
|
+
document: EffectAuthoringDocument | unknown;
|
|
26
|
+
};
|
|
27
|
+
/** The language of an editable source, or null when the effect has no source to edit. */
|
|
28
|
+
export type EffectSourceLanguage = 'glsl' | 'svg' | null;
|
|
29
|
+
/** One keyframe of an animated control. */
|
|
30
|
+
export interface EffectKeyframe {
|
|
31
|
+
/** Ms from the start of the effect. */
|
|
32
|
+
time: number;
|
|
33
|
+
/** The value at this keyframe. */
|
|
34
|
+
value: EffectValue;
|
|
35
|
+
/** Easing into the next keyframe (default `linear`). */
|
|
36
|
+
easing?: AnimationEasing;
|
|
37
|
+
}
|
|
38
|
+
/** A problem with the effect, e.g. a compile error. `line` is 1-based in `source` when known. */
|
|
39
|
+
export interface EffectAuthoringIssue {
|
|
40
|
+
message: string;
|
|
41
|
+
line?: number;
|
|
42
|
+
severity: 'error' | 'warning';
|
|
43
|
+
}
|
|
44
|
+
/** The observable state of an effect authoring session. */
|
|
45
|
+
export interface EffectAuthoringState {
|
|
46
|
+
/** Stable id of the provider that owns this effect. */
|
|
47
|
+
providerId: string;
|
|
48
|
+
/** The id the effect was opened from, or null for a document with no catalog id. */
|
|
49
|
+
effectId: string | null;
|
|
50
|
+
/** Display name of the effect. */
|
|
51
|
+
name: string;
|
|
52
|
+
/** How the effect is drawn. */
|
|
53
|
+
kind: EffectKind;
|
|
54
|
+
/** The current controls, defaults and presets. They change when the source changes. */
|
|
55
|
+
description: EffectDescription;
|
|
56
|
+
/** Editable source, or null (see `sourceLanguage`). */
|
|
57
|
+
source: string | null;
|
|
58
|
+
/** Language of `source`, or null when source editing is not supported. */
|
|
59
|
+
sourceLanguage: EffectSourceLanguage;
|
|
60
|
+
/** Every control's value at the playhead (keyframes applied). */
|
|
61
|
+
values: EffectValues;
|
|
62
|
+
/** Keyframes per control. A control with no entry is not animated. */
|
|
63
|
+
tracks: Readonly<Record<string, readonly EffectKeyframe[]>>;
|
|
64
|
+
/** Diagnostic issues, compile errors and warnings. */
|
|
65
|
+
issues: readonly EffectAuthoringIssue[];
|
|
66
|
+
/** Whether the source compiled: true, false, or null when that is not known yet (no preview has compiled it). */
|
|
67
|
+
compiled: boolean | null;
|
|
68
|
+
/** Current playhead position (ms). */
|
|
69
|
+
time: number;
|
|
70
|
+
/** Length of one play (ms). */
|
|
71
|
+
duration: number;
|
|
72
|
+
/** Whether playback loops. */
|
|
73
|
+
loop: boolean;
|
|
74
|
+
/** Whether playback is currently active. */
|
|
75
|
+
playing: boolean;
|
|
76
|
+
/** Whether an undo action is available. */
|
|
77
|
+
canUndo: boolean;
|
|
78
|
+
/** Whether a redo action is available. */
|
|
79
|
+
canRedo: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** The result of a session mutation: either successful, or refused with a reason message. */
|
|
82
|
+
export type EffectAuthoringResult<T = Record<never, never>> = ({
|
|
83
|
+
ok: true;
|
|
84
|
+
} & T) | {
|
|
85
|
+
ok: false;
|
|
86
|
+
message: string;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* A live editing session for an effect: controls values, keyframes, presets, source editing,
|
|
90
|
+
* playback timeline and undo/redo history.
|
|
91
|
+
*/
|
|
92
|
+
export interface EffectAuthoringSession {
|
|
93
|
+
/**
|
|
94
|
+
* The current state. Returns the same object reference until something changes, suitable
|
|
95
|
+
* for React's `useSyncExternalStore` or Svelte store subscriptions.
|
|
96
|
+
*/
|
|
97
|
+
getState(): EffectAuthoringState;
|
|
98
|
+
/** Called after every change. Returns a function that unsubscribes. */
|
|
99
|
+
subscribe(listener: (state: EffectAuthoringState) => void): () => void;
|
|
100
|
+
/** Replaces the source. Refused when `sourceLanguage` is null. */
|
|
101
|
+
setSource?(source: string): MaybePromise<EffectAuthoringResult<{
|
|
102
|
+
issues: readonly EffectAuthoringIssue[];
|
|
103
|
+
}>>;
|
|
104
|
+
/**
|
|
105
|
+
* Sets a control at the playhead: updates the value if the control is not animated,
|
|
106
|
+
* else creates/updates a keyframe at `time`. Calls with the same `gesture` key merge into one undo step.
|
|
107
|
+
*/
|
|
108
|
+
setValue(name: string, value: EffectValue, options?: {
|
|
109
|
+
gesture?: string | null;
|
|
110
|
+
}): EffectAuthoringResult;
|
|
111
|
+
/** Sets several controls as one undo step, all or nothing: one bad value refuses the lot. */
|
|
112
|
+
setValues(values: EffectValues, options?: {
|
|
113
|
+
gesture?: string | null;
|
|
114
|
+
}): EffectAuthoringResult;
|
|
115
|
+
/** Puts controls back to their defaults (default: all controls). */
|
|
116
|
+
resetValues(names?: readonly string[]): EffectAuthoringResult;
|
|
117
|
+
/** Applies a named preset's values. */
|
|
118
|
+
applyPreset(name: string): EffectAuthoringResult;
|
|
119
|
+
/** Saves the current values as a preset, or replaces an existing preset with the same name. */
|
|
120
|
+
savePreset(name: string): EffectAuthoringResult;
|
|
121
|
+
/** Adds or replaces a keyframe. `value` defaults to the control's value at that time. */
|
|
122
|
+
setKeyframe(name: string, time: number, value?: EffectValue, easing?: AnimationEasing): EffectAuthoringResult;
|
|
123
|
+
/** Removes a keyframe from a control at the given time. */
|
|
124
|
+
removeKeyframe(name: string, time: number): EffectAuthoringResult;
|
|
125
|
+
/** Removes every keyframe of a control. The value it has at the playhead becomes its static value. */
|
|
126
|
+
clearTrack(name: string): EffectAuthoringResult;
|
|
127
|
+
/** Configures timeline duration and loop behavior. */
|
|
128
|
+
setTiming(timing: {
|
|
129
|
+
duration?: number;
|
|
130
|
+
loop?: boolean;
|
|
131
|
+
}): EffectAuthoringResult;
|
|
132
|
+
/** Starts playback. */
|
|
133
|
+
play(): void;
|
|
134
|
+
/** Pauses playback. */
|
|
135
|
+
pause(): void;
|
|
136
|
+
/** Moves the playhead (clamped to 0..duration). */
|
|
137
|
+
seek(time: number): void;
|
|
138
|
+
/** Reverts the last edit. Returns true if state changed. */
|
|
139
|
+
undo(): boolean;
|
|
140
|
+
/** Redoes the last undone edit. Returns true if state changed. */
|
|
141
|
+
redo(): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Creates a renderer that draws this session's current effect (source and values as they are at each
|
|
144
|
+
* `render` call). `render({ time })` draws the effect at `time` with the keyframed values for
|
|
145
|
+
* that time unless `values` is given. A compile failure shows in `issues` and `compiled`.
|
|
146
|
+
*/
|
|
147
|
+
createPreview(options: EffectRendererOptions): MaybePromise<EffectRenderer>;
|
|
148
|
+
/** Exports the document as plain JSON, to save and reopen with `{ document }`. */
|
|
149
|
+
exportDocument(): EffectAuthoringDocument;
|
|
150
|
+
/** Disposes the session, stops playback, cleans up listeners and disposes created previews. */
|
|
151
|
+
dispose(): void;
|
|
152
|
+
}
|
|
@@ -15,6 +15,8 @@ export interface EffectConformanceOptions {
|
|
|
15
15
|
render?: boolean;
|
|
16
16
|
/** Renderer size for the render check (default 8). */
|
|
17
17
|
size?: number;
|
|
18
|
+
/** Also check authoring when supportsAuthoring is true (default true). */
|
|
19
|
+
authoring?: boolean;
|
|
18
20
|
}
|
|
19
21
|
/** Runs the contract checks against `provider` and returns every issue found (empty when it conforms). */
|
|
20
22
|
export declare function checkEffectProvider(provider: EffectProvider, options?: EffectConformanceOptions): Promise<EffectConformanceIssue[]>;
|
|
@@ -15,6 +15,8 @@ export interface EffectConformanceOptions {
|
|
|
15
15
|
render?: boolean;
|
|
16
16
|
/** Renderer size for the render check (default 8). */
|
|
17
17
|
size?: number;
|
|
18
|
+
/** Also check authoring when supportsAuthoring is true (default true). */
|
|
19
|
+
authoring?: boolean;
|
|
18
20
|
}
|
|
19
21
|
/** Runs the contract checks against `provider` and returns every issue found (empty when it conforms). */
|
|
20
22
|
export declare function checkEffectProvider(provider: EffectProvider, options?: EffectConformanceOptions): Promise<EffectConformanceIssue[]>;
|
package/dist/effects/fake.d.cts
CHANGED
|
@@ -16,6 +16,8 @@ export interface FakeEffectProviderOptions {
|
|
|
16
16
|
capabilities?: Partial<EffectProviderCapabilities>;
|
|
17
17
|
/** Called on every render (tests count frames with it). */
|
|
18
18
|
onRender?: (effectId: string, request: EffectRenderRequest) => void;
|
|
19
|
+
/** Whether authoring is supported (default true). */
|
|
20
|
+
authoring?: boolean;
|
|
19
21
|
}
|
|
20
22
|
/** A deterministic CPU effects provider with six effects (see the module comment). */
|
|
21
23
|
export declare function createFakeEffectProvider(options?: FakeEffectProviderOptions): EffectProvider;
|
package/dist/effects/fake.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export interface FakeEffectProviderOptions {
|
|
|
16
16
|
capabilities?: Partial<EffectProviderCapabilities>;
|
|
17
17
|
/** Called on every render (tests count frames with it). */
|
|
18
18
|
onRender?: (effectId: string, request: EffectRenderRequest) => void;
|
|
19
|
+
/** Whether authoring is supported (default true). */
|
|
20
|
+
authoring?: boolean;
|
|
19
21
|
}
|
|
20
22
|
/** A deterministic CPU effects provider with six effects (see the module comment). */
|
|
21
23
|
export declare function createFakeEffectProvider(options?: FakeEffectProviderOptions): EffectProvider;
|