@pixerate/editor 0.123.0 → 0.124.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/dist/agent/index.cjs +2 -2
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.js +3 -3
- package/dist/animation/index.d.cts +2 -1
- package/dist/animation/index.d.ts +2 -1
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +11 -733
- package/dist/animation-editor/index.d.ts +11 -733
- package/dist/animation-editor/index.js.map +1 -1
- package/dist/{bezier-C-W9LFyD.d.cts → bezier-CBzKKDjl.d.cts} +2 -66
- package/dist/{bezier-DQZE5dxA.d.ts → bezier-CWv6LQal.d.ts} +2 -66
- package/dist/{brushstrokeRender-M4S65DHT.cjs → brushstrokeRender-EELTV7U4.cjs} +8 -8
- package/dist/{brushstrokeRender-M4S65DHT.cjs.map → brushstrokeRender-EELTV7U4.cjs.map} +1 -1
- package/dist/{brushstrokeRender-CDDRSV2W.js → brushstrokeRender-LRV7GXGD.js} +3 -3
- package/dist/canvas/index.cjs +6 -6
- package/dist/canvas/index.d.cts +10 -6
- package/dist/canvas/index.d.ts +10 -6
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-SMJGE7HM.cjs → chunk-4QQZV5Y5.cjs} +512 -39
- package/dist/chunk-4QQZV5Y5.cjs.map +1 -0
- package/dist/{chunk-TVXFHE4T.js → chunk-64PYNEHJ.js} +45 -12
- package/dist/chunk-64PYNEHJ.js.map +1 -0
- package/dist/{chunk-2IW3BWRT.cjs → chunk-7LQO6OHH.cjs} +2 -2
- package/dist/{chunk-2IW3BWRT.cjs.map → chunk-7LQO6OHH.cjs.map} +1 -1
- package/dist/chunk-CN4PJHUG.cjs +234 -0
- package/dist/chunk-CN4PJHUG.cjs.map +1 -0
- package/dist/chunk-FHYDQOPC.cjs +215 -0
- package/dist/chunk-FHYDQOPC.cjs.map +1 -0
- package/dist/{chunk-KMBC4HNV.js → chunk-J67OLQUQ.js} +2 -2
- package/dist/chunk-JRXJTPES.js +215 -0
- package/dist/chunk-JRXJTPES.js.map +1 -0
- package/dist/{chunk-IPFRWILU.js → chunk-ORHMVUR6.js} +488 -15
- package/dist/chunk-ORHMVUR6.js.map +1 -0
- package/dist/{chunk-6CJRDJCU.cjs → chunk-PEHYWUVV.cjs} +176 -111
- package/dist/chunk-PEHYWUVV.cjs.map +1 -0
- package/dist/chunk-QEG3GRN2.js +234 -0
- package/dist/chunk-QEG3GRN2.js.map +1 -0
- package/dist/{chunk-6ZBR4J62.js → chunk-WATAQ2Z2.js} +79 -14
- package/dist/chunk-WATAQ2Z2.js.map +1 -0
- package/dist/{chunk-RLRUAPBJ.cjs → chunk-Z6OUCS2K.cjs} +47 -14
- package/dist/chunk-Z6OUCS2K.cjs.map +1 -0
- package/dist/effects/index.cjs +605 -0
- package/dist/effects/index.cjs.map +1 -0
- package/dist/effects/index.d.cts +163 -0
- package/dist/effects/index.d.ts +163 -0
- package/dist/effects/index.js +605 -0
- package/dist/effects/index.js.map +1 -0
- package/dist/evaluate-2S3vSPLy.d.cts +55 -0
- package/dist/evaluate-CfmT6xA3.d.ts +55 -0
- package/dist/{export-DfjzHAJI.d.ts → export-BGtXgMJ3.d.ts} +536 -128
- package/dist/{export-Dv0-ZVrV.d.cts → export-BdfY_lH0.d.ts} +392 -5
- package/dist/{export-Dv0-ZVrV.d.ts → export-CbpjwxaI.d.cts} +392 -5
- package/dist/{export-lU5qSpHE.d.cts → export-WmYoWmLM.d.cts} +536 -128
- package/dist/flair-CxB3fOcU.d.ts +739 -0
- package/dist/flair-D7BxyBwL.d.cts +739 -0
- package/dist/gradient-KDfCvhuj.d.cts +66 -0
- package/dist/gradient-KDfCvhuj.d.ts +66 -0
- package/dist/helpers-777mC6dc.d.cts +253 -0
- package/dist/helpers-DX2_7L5t.d.ts +253 -0
- package/dist/image-editor/index.cjs +1296 -805
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +39 -182
- package/dist/image-editor/index.d.ts +39 -182
- package/dist/image-editor/index.js +497 -6
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{opentype-p8Xxf-Wh.d.ts → opentype-14PDI5D2.d.ts} +1 -1
- package/dist/{opentype-BV7wWatY.d.cts → opentype-D80AVmMu.d.cts} +1 -1
- package/dist/paint/index.cjs +2 -2
- package/dist/paint/index.d.cts +32 -10
- package/dist/paint/index.d.ts +32 -10
- package/dist/paint/index.js +1 -1
- package/dist/paint-editor/index.cjs +10 -8
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +11 -5
- package/dist/paint-editor/index.d.ts +11 -5
- package/dist/paint-editor/index.js +4 -2
- package/dist/paint-editor/index.js.map +1 -1
- package/dist/parameters/index.d.cts +4 -184
- package/dist/parameters/index.d.ts +4 -184
- package/dist/{pathfinder-IxcyhO00.d.cts → pathfinder-C0UoFypx.d.cts} +1 -1
- package/dist/{pathfinder-StVChJOT.d.ts → pathfinder-DjISxkUv.d.ts} +1 -1
- package/dist/{player-DrcP2xqj.d.cts → player-CBtEoU2x.d.cts} +2 -54
- package/dist/{player-DV4Jujdq.d.ts → player-cGLrngL_.d.ts} +2 -54
- package/dist/{svg-BtND4TJu.d.cts → svg-BDrjRnL1.d.cts} +3 -2
- package/dist/{svg-BfVXG7hL.d.ts → svg-C-vZ3q50.d.ts} +3 -2
- package/dist/tools/index.cjs +2 -2
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +3 -3
- package/dist/tools-C7JtLYzo.d.ts +126 -0
- package/dist/tools-DHKGHiSK.d.cts +126 -0
- package/dist/{types-fuXEme9j.d.ts → types-BcX7sCsn.d.ts} +2 -2
- package/dist/{types-DJF3Ghn5.d.cts → types-CznabG7m.d.cts} +2 -2
- package/dist/types-D3-J3TFf.d.ts +185 -0
- package/dist/types-DMcf_z4J.d.cts +185 -0
- package/dist/vector/index.d.cts +10 -10
- package/dist/vector/index.d.ts +10 -10
- package/dist/video-editor/index.cjs +749 -277
- package/dist/video-editor/index.cjs.map +1 -1
- package/dist/video-editor/index.d.cts +265 -138
- package/dist/video-editor/index.d.ts +265 -138
- package/dist/video-editor/index.js +490 -18
- package/dist/video-editor/index.js.map +1 -1
- package/dist/{warp-BjmAgQwq.d.cts → warp-CH9MM435.d.cts} +1 -1
- package/dist/{warp-Ca5fedzS.d.ts → warp-k_PdtXOG.d.ts} +1 -1
- package/package.json +6 -1
- package/skills/pixerate-image-editor/SKILL.md +7 -0
- package/skills/pixerate-image-editor/references/provider-effects.md +35 -0
- package/skills/pixerate-video-editor/SKILL.md +39 -1
- package/dist/chunk-6CJRDJCU.cjs.map +0 -1
- package/dist/chunk-6ZBR4J62.js.map +0 -1
- package/dist/chunk-IPFRWILU.js.map +0 -1
- package/dist/chunk-RLRUAPBJ.cjs.map +0 -1
- package/dist/chunk-SMJGE7HM.cjs.map +0 -1
- package/dist/chunk-TVXFHE4T.js.map +0 -1
- /package/dist/{brushstrokeRender-CDDRSV2W.js.map → brushstrokeRender-LRV7GXGD.js.map} +0 -0
- /package/dist/{chunk-KMBC4HNV.js.map → chunk-J67OLQUQ.js.map} +0 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { A as AgentTool, a as AgentToolProvider } from './registry-D-4fit9C.js';
|
|
2
|
+
import { J as JsonSchema } from './schema-Di0CS6Pe.js';
|
|
3
|
+
import { E as EffectProvider, a as EffectUse } from './helpers-DX2_7L5t.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The agent tools for provider effects, shared by every editor that takes an `EffectProvider`:
|
|
7
|
+
* `search_effects`, `describe_effect`, `list_applied_effects`, `apply_effect`, `update_effect` and
|
|
8
|
+
* `remove_effect`. An editor supplies an `EffectToolHost` (what its targets are and how to change
|
|
9
|
+
* them as one undo step each) and may add tools of its own (`extraTools`).
|
|
10
|
+
*
|
|
11
|
+
* Without a provider the read tools say so (and `list_applied_effects` still lists what a
|
|
12
|
+
* document holds), and the write tools refuse with the reason. On a read-only surface the write
|
|
13
|
+
* tools are hidden.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** One effect applied to a target, as the tools report it. */
|
|
17
|
+
interface AppliedEffectInfo {
|
|
18
|
+
/** Its id on the target: what `update_effect` and `remove_effect` take. */
|
|
19
|
+
id: string;
|
|
20
|
+
effect: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
provider?: string;
|
|
23
|
+
/** What it is on the target (e.g. `clip effect`, `effect clip`, `transition`, `smart filter`, `effect layer`). */
|
|
24
|
+
role: string;
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
/** 0–1, or keyframes, where the role has an opacity. */
|
|
27
|
+
opacity?: unknown;
|
|
28
|
+
/** Its saved control values (numbers may be keyframes where the editor allows them). */
|
|
29
|
+
values: Record<string, unknown>;
|
|
30
|
+
/** Its place in the target's stack (0 = applied first), for stacked roles. */
|
|
31
|
+
index?: number;
|
|
32
|
+
}
|
|
33
|
+
interface EffectTargetEffects {
|
|
34
|
+
target: string;
|
|
35
|
+
/** A label for the target (a clip or layer name). */
|
|
36
|
+
name?: string;
|
|
37
|
+
effects: AppliedEffectInfo[];
|
|
38
|
+
}
|
|
39
|
+
interface EffectChangeResult {
|
|
40
|
+
target: string;
|
|
41
|
+
/** What was added, changed or removed. */
|
|
42
|
+
effect: AppliedEffectInfo;
|
|
43
|
+
/** The target's effects afterwards. */
|
|
44
|
+
effects: AppliedEffectInfo[];
|
|
45
|
+
/** Other things the change made (a new clip or layer id, ...). */
|
|
46
|
+
[extra: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
/** What an editor gives the shared effect tools. */
|
|
49
|
+
interface EffectToolHost {
|
|
50
|
+
/** Provider id (unique per registry). */
|
|
51
|
+
id: string;
|
|
52
|
+
/** Always prefix tool names with `<namespace>__`. */
|
|
53
|
+
namespace?: string;
|
|
54
|
+
/** Words for the editor's targets, e.g. `{ noun: 'clip', id: 'A clip id from get_video_project (e.g. "c1").' }`. */
|
|
55
|
+
target: {
|
|
56
|
+
noun: string;
|
|
57
|
+
id: string;
|
|
58
|
+
};
|
|
59
|
+
/** The uses `apply_effect` takes on a target (others go through `extraTools`). */
|
|
60
|
+
applyUses: readonly EffectUse[];
|
|
61
|
+
/** Text added to `apply_effect`'s description: where the effect goes and how it is drawn. */
|
|
62
|
+
applyDetails: string;
|
|
63
|
+
/** The current provider, or `null`. */
|
|
64
|
+
provider(): EffectProvider | null;
|
|
65
|
+
/** Why edits are refused now (read-only), or `null`. */
|
|
66
|
+
readOnlyReason(): string | null;
|
|
67
|
+
/** Every target with effects, or one target (throws for an unknown id, naming valid ones). */
|
|
68
|
+
list(target?: string): EffectTargetEffects[];
|
|
69
|
+
apply(target: string, effect: string, args: {
|
|
70
|
+
values?: Record<string, unknown>;
|
|
71
|
+
index?: number;
|
|
72
|
+
enabled?: boolean;
|
|
73
|
+
opacity?: number;
|
|
74
|
+
}): Promise<EffectChangeResult>;
|
|
75
|
+
update(target: string, instance: string, changes: {
|
|
76
|
+
values?: Record<string, unknown>;
|
|
77
|
+
index?: number;
|
|
78
|
+
enabled?: boolean;
|
|
79
|
+
opacity?: number;
|
|
80
|
+
}): Promise<EffectChangeResult>;
|
|
81
|
+
remove(target: string, instance: string): Promise<EffectChangeResult>;
|
|
82
|
+
/** Editor-specific effect tools (transitions, effect clips, effect layers, keyframes). */
|
|
83
|
+
extraTools?: (context: EffectToolContext) => AgentTool[];
|
|
84
|
+
/** Lets the tool list follow the provider and read-only changes. */
|
|
85
|
+
subscribe?: (notify: () => void) => () => void;
|
|
86
|
+
}
|
|
87
|
+
/** Shared pieces for `extraTools`. */
|
|
88
|
+
interface EffectToolContext {
|
|
89
|
+
/** The provider, or a thrown error saying none is registered. */
|
|
90
|
+
requireProvider(): EffectProvider;
|
|
91
|
+
/** The schema of a `values` argument. */
|
|
92
|
+
valuesSchema(what: string, keyframes?: boolean): JsonSchema;
|
|
93
|
+
/** The schema of an `effect` argument for effects with one of `uses`. */
|
|
94
|
+
effectIdSchema(uses: readonly EffectUse[]): JsonSchema;
|
|
95
|
+
readonly annotations: typeof ANNOTATIONS;
|
|
96
|
+
}
|
|
97
|
+
declare const ANNOTATIONS: {
|
|
98
|
+
readonly read: {
|
|
99
|
+
readonly readOnlyHint: true;
|
|
100
|
+
readonly destructiveHint: false;
|
|
101
|
+
readonly idempotentHint: true;
|
|
102
|
+
readonly openWorldHint: false;
|
|
103
|
+
};
|
|
104
|
+
readonly write: {
|
|
105
|
+
readonly readOnlyHint: false;
|
|
106
|
+
readonly destructiveHint: false;
|
|
107
|
+
readonly idempotentHint: false;
|
|
108
|
+
readonly openWorldHint: false;
|
|
109
|
+
};
|
|
110
|
+
readonly writeIdempotent: {
|
|
111
|
+
readonly readOnlyHint: false;
|
|
112
|
+
readonly destructiveHint: false;
|
|
113
|
+
readonly idempotentHint: true;
|
|
114
|
+
readonly openWorldHint: false;
|
|
115
|
+
};
|
|
116
|
+
readonly destructive: {
|
|
117
|
+
readonly readOnlyHint: false;
|
|
118
|
+
readonly destructiveHint: true;
|
|
119
|
+
readonly idempotentHint: false;
|
|
120
|
+
readonly openWorldHint: false;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
/** The agent tools for provider effects in one editor (see the module comment). */
|
|
124
|
+
declare function createEffectToolProvider(host: EffectToolHost): AgentToolProvider;
|
|
125
|
+
|
|
126
|
+
export { type AppliedEffectInfo as A, type EffectChangeResult as E, type EffectTargetEffects as a, type EffectToolContext as b, type EffectToolHost as c, createEffectToolProvider as d };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { A as AgentTool, a as AgentToolProvider } from './registry-BqA1AZt0.cjs';
|
|
2
|
+
import { J as JsonSchema } from './schema-Di0CS6Pe.cjs';
|
|
3
|
+
import { E as EffectProvider, a as EffectUse } from './helpers-777mC6dc.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The agent tools for provider effects, shared by every editor that takes an `EffectProvider`:
|
|
7
|
+
* `search_effects`, `describe_effect`, `list_applied_effects`, `apply_effect`, `update_effect` and
|
|
8
|
+
* `remove_effect`. An editor supplies an `EffectToolHost` (what its targets are and how to change
|
|
9
|
+
* them as one undo step each) and may add tools of its own (`extraTools`).
|
|
10
|
+
*
|
|
11
|
+
* Without a provider the read tools say so (and `list_applied_effects` still lists what a
|
|
12
|
+
* document holds), and the write tools refuse with the reason. On a read-only surface the write
|
|
13
|
+
* tools are hidden.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** One effect applied to a target, as the tools report it. */
|
|
17
|
+
interface AppliedEffectInfo {
|
|
18
|
+
/** Its id on the target: what `update_effect` and `remove_effect` take. */
|
|
19
|
+
id: string;
|
|
20
|
+
effect: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
provider?: string;
|
|
23
|
+
/** What it is on the target (e.g. `clip effect`, `effect clip`, `transition`, `smart filter`, `effect layer`). */
|
|
24
|
+
role: string;
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
/** 0–1, or keyframes, where the role has an opacity. */
|
|
27
|
+
opacity?: unknown;
|
|
28
|
+
/** Its saved control values (numbers may be keyframes where the editor allows them). */
|
|
29
|
+
values: Record<string, unknown>;
|
|
30
|
+
/** Its place in the target's stack (0 = applied first), for stacked roles. */
|
|
31
|
+
index?: number;
|
|
32
|
+
}
|
|
33
|
+
interface EffectTargetEffects {
|
|
34
|
+
target: string;
|
|
35
|
+
/** A label for the target (a clip or layer name). */
|
|
36
|
+
name?: string;
|
|
37
|
+
effects: AppliedEffectInfo[];
|
|
38
|
+
}
|
|
39
|
+
interface EffectChangeResult {
|
|
40
|
+
target: string;
|
|
41
|
+
/** What was added, changed or removed. */
|
|
42
|
+
effect: AppliedEffectInfo;
|
|
43
|
+
/** The target's effects afterwards. */
|
|
44
|
+
effects: AppliedEffectInfo[];
|
|
45
|
+
/** Other things the change made (a new clip or layer id, ...). */
|
|
46
|
+
[extra: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
/** What an editor gives the shared effect tools. */
|
|
49
|
+
interface EffectToolHost {
|
|
50
|
+
/** Provider id (unique per registry). */
|
|
51
|
+
id: string;
|
|
52
|
+
/** Always prefix tool names with `<namespace>__`. */
|
|
53
|
+
namespace?: string;
|
|
54
|
+
/** Words for the editor's targets, e.g. `{ noun: 'clip', id: 'A clip id from get_video_project (e.g. "c1").' }`. */
|
|
55
|
+
target: {
|
|
56
|
+
noun: string;
|
|
57
|
+
id: string;
|
|
58
|
+
};
|
|
59
|
+
/** The uses `apply_effect` takes on a target (others go through `extraTools`). */
|
|
60
|
+
applyUses: readonly EffectUse[];
|
|
61
|
+
/** Text added to `apply_effect`'s description: where the effect goes and how it is drawn. */
|
|
62
|
+
applyDetails: string;
|
|
63
|
+
/** The current provider, or `null`. */
|
|
64
|
+
provider(): EffectProvider | null;
|
|
65
|
+
/** Why edits are refused now (read-only), or `null`. */
|
|
66
|
+
readOnlyReason(): string | null;
|
|
67
|
+
/** Every target with effects, or one target (throws for an unknown id, naming valid ones). */
|
|
68
|
+
list(target?: string): EffectTargetEffects[];
|
|
69
|
+
apply(target: string, effect: string, args: {
|
|
70
|
+
values?: Record<string, unknown>;
|
|
71
|
+
index?: number;
|
|
72
|
+
enabled?: boolean;
|
|
73
|
+
opacity?: number;
|
|
74
|
+
}): Promise<EffectChangeResult>;
|
|
75
|
+
update(target: string, instance: string, changes: {
|
|
76
|
+
values?: Record<string, unknown>;
|
|
77
|
+
index?: number;
|
|
78
|
+
enabled?: boolean;
|
|
79
|
+
opacity?: number;
|
|
80
|
+
}): Promise<EffectChangeResult>;
|
|
81
|
+
remove(target: string, instance: string): Promise<EffectChangeResult>;
|
|
82
|
+
/** Editor-specific effect tools (transitions, effect clips, effect layers, keyframes). */
|
|
83
|
+
extraTools?: (context: EffectToolContext) => AgentTool[];
|
|
84
|
+
/** Lets the tool list follow the provider and read-only changes. */
|
|
85
|
+
subscribe?: (notify: () => void) => () => void;
|
|
86
|
+
}
|
|
87
|
+
/** Shared pieces for `extraTools`. */
|
|
88
|
+
interface EffectToolContext {
|
|
89
|
+
/** The provider, or a thrown error saying none is registered. */
|
|
90
|
+
requireProvider(): EffectProvider;
|
|
91
|
+
/** The schema of a `values` argument. */
|
|
92
|
+
valuesSchema(what: string, keyframes?: boolean): JsonSchema;
|
|
93
|
+
/** The schema of an `effect` argument for effects with one of `uses`. */
|
|
94
|
+
effectIdSchema(uses: readonly EffectUse[]): JsonSchema;
|
|
95
|
+
readonly annotations: typeof ANNOTATIONS;
|
|
96
|
+
}
|
|
97
|
+
declare const ANNOTATIONS: {
|
|
98
|
+
readonly read: {
|
|
99
|
+
readonly readOnlyHint: true;
|
|
100
|
+
readonly destructiveHint: false;
|
|
101
|
+
readonly idempotentHint: true;
|
|
102
|
+
readonly openWorldHint: false;
|
|
103
|
+
};
|
|
104
|
+
readonly write: {
|
|
105
|
+
readonly readOnlyHint: false;
|
|
106
|
+
readonly destructiveHint: false;
|
|
107
|
+
readonly idempotentHint: false;
|
|
108
|
+
readonly openWorldHint: false;
|
|
109
|
+
};
|
|
110
|
+
readonly writeIdempotent: {
|
|
111
|
+
readonly readOnlyHint: false;
|
|
112
|
+
readonly destructiveHint: false;
|
|
113
|
+
readonly idempotentHint: true;
|
|
114
|
+
readonly openWorldHint: false;
|
|
115
|
+
};
|
|
116
|
+
readonly destructive: {
|
|
117
|
+
readonly readOnlyHint: false;
|
|
118
|
+
readonly destructiveHint: true;
|
|
119
|
+
readonly idempotentHint: false;
|
|
120
|
+
readonly openWorldHint: false;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
/** The agent tools for provider effects in one editor (see the module comment). */
|
|
124
|
+
declare function createEffectToolProvider(host: EffectToolHost): AgentToolProvider;
|
|
125
|
+
|
|
126
|
+
export { type AppliedEffectInfo as A, type EffectChangeResult as E, type EffectTargetEffects as a, type EffectToolContext as b, type EffectToolHost as c, createEffectToolProvider as d };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CanvasGradientDef } from './
|
|
1
|
+
import { C as CanvasGradientDef } from './gradient-KDfCvhuj.js';
|
|
2
2
|
import { W as WarpStyle, a as WarpMesh } from './types-CwMPoRMU.js';
|
|
3
3
|
|
|
4
4
|
/** An affine matrix `[a, b, c, d, e, f]`: `x' = a·x + c·y + e`, `y' = b·x + d·y + f` (SVG order). */
|
|
@@ -990,4 +990,4 @@ type VectorFilter = {
|
|
|
990
990
|
};
|
|
991
991
|
}[VectorFilterType];
|
|
992
992
|
|
|
993
|
-
export { type VectorAlign as $, type VectorTextNode as A, type VectorAnchorType as B, type VectorCornerKind as C, type VectorViewport as D, type VectorConnectorRoute as E, type VectorConnectorSide as F, type VectorConnectorEnd as G, type VectorConnector as H, type VectorConstraintKind as I, type VectorConstraint as J, type VectorCharacterStyle as K, type VectorTextRun as L, type VectorParagraphStyle as M, type VectorTextFrame as N, type VectorTransformHandle as O, type VectorAnchorRef as P, type VectorPathfinderOperation as Q, type VectorTool as R, type VectorDefaults as S, type VectorTextAlign as T, type VectorStyle as U, type
|
|
993
|
+
export { type VectorAlign as $, type VectorTextNode as A, type VectorAnchorType as B, type VectorCornerKind as C, type VectorViewport as D, type VectorConnectorRoute as E, type VectorConnectorSide as F, type VectorConnectorEnd as G, type VectorConnector as H, type VectorConstraintKind as I, type VectorConstraint as J, type VectorCharacterStyle as K, type VectorTextRun as L, type VectorParagraphStyle as M, type VectorTextFrame as N, type VectorTransformHandle as O, type VectorAnchorRef as P, type VectorPathfinderOperation as Q, type VectorTool as R, type VectorDefaults as S, type VectorTextAlign as T, type VectorStyle as U, type VectorDocument as V, type VectorHandleRef as W, type VectorSegmentRef as X, type VectorBlendOptions as Y, type VectorModifiers as Z, type VectorBlendMode as _, type VectorEffectType as a, type VectorDistribute as a0, type VectorArrange as a1, type VectorMaskType as a2, type VectorSymmetryMode as a3, type VectorSymmetry as a4, type VectorFreeformPoint as a5, type VectorMeshGradient as a6, type VectorFreeformGradient as a7, type VectorArrowhead as a8, type VectorResizing as a9, VECTOR_FILTER_TYPES as aA, VECTOR_GRADIENT_INTERPOLATIONS as aB, VECTOR_GRADIENT_SPREADS as aC, VECTOR_GRADIENT_TYPES as aD, VECTOR_HORIZONTAL_RESIZING as aE, VECTOR_MASK_TYPES as aF, VECTOR_MERGE_MODES as aG, VECTOR_PATHFINDER_OPERATIONS as aH, VECTOR_PATH_TEXT_BASELINES as aI, VECTOR_STROKE_GRADIENT_MODES as aJ, VECTOR_SYMMETRY_MODES as aK, VECTOR_TEXT_ALIGNS as aL, VECTOR_TOOLS as aM, VECTOR_TRANSFORM_HANDLES as aN, VECTOR_VERTICAL_RESIZING as aO, type VectorCorner as aP, type VectorGeomRef as aQ, type VectorLineCap as aR, type VectorPathTextBaseline as aS, type VectorStrokeLayerKind as aT, type VectorTextRunStyle as aU, type VectorWarpStyle as aV, type VectorFrame as aa, type VectorHorizontalResizing as ab, type VectorVerticalResizing as ac, type VectorMask as ad, type VectorAverageAxis as ae, type VectorSymbol as af, type VectorParameter as ag, type VectorBlendSpacing as ah, type VectorGradientInterpolation as ai, type VectorStrokeGradientMode as aj, type VectorArrowAlign as ak, type VectorPaintLayer as al, type VectorStrokeLayer as am, type VectorBlend as an, type VectorMergeMode as ao, type VectorLineJoin as ap, type VectorStrokeSettings as aq, type VectorInstanceOverrides as ar, VECTOR_ARROWHEADS as as, VECTOR_BLEND_MODES as at, VECTOR_BLEND_SPACINGS as au, VECTOR_CONNECTOR_ROUTES as av, VECTOR_CONNECTOR_SIDES as aw, VECTOR_CONSTRAINT_KINDS as ax, VECTOR_CORNER_KINDS as ay, VECTOR_EFFECT_TYPES as az, type VectorEffectParamsMap as b, type VectorPathNode as c, type VectorFillRule as d, type VectorBooleanOperation as e, type VectorNode as f, type VectorEffect as g, type VectorGroupNode as h, type VectorBounds as i, type VectorWarpMesh as j, type VectorInstanceNode as k, type VectorFilterType as l, type VectorFilterParamsMap as m, type VectorFilter as n, type VectorGradient as o, type Vec2 as p, type VectorGradientUnits as q, type VectorGradientSpread as r, type VectorGradientType as s, type VectorPaint as t, type VectorMatrix as u, type VectorGradientStop as v, type VectorStrokeAlign as w, type VectorSubpath as x, type VectorWidthPoint as y, type VectorAnchor as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CanvasGradientDef } from './
|
|
1
|
+
import { C as CanvasGradientDef } from './gradient-KDfCvhuj.cjs';
|
|
2
2
|
import { W as WarpStyle, a as WarpMesh } from './types-CwMPoRMU.cjs';
|
|
3
3
|
|
|
4
4
|
/** An affine matrix `[a, b, c, d, e, f]`: `x' = a·x + c·y + e`, `y' = b·x + d·y + f` (SVG order). */
|
|
@@ -990,4 +990,4 @@ type VectorFilter = {
|
|
|
990
990
|
};
|
|
991
991
|
}[VectorFilterType];
|
|
992
992
|
|
|
993
|
-
export { type VectorAlign as $, type VectorTextNode as A, type VectorAnchorType as B, type VectorCornerKind as C, type VectorViewport as D, type VectorConnectorRoute as E, type VectorConnectorSide as F, type VectorConnectorEnd as G, type VectorConnector as H, type VectorConstraintKind as I, type VectorConstraint as J, type VectorCharacterStyle as K, type VectorTextRun as L, type VectorParagraphStyle as M, type VectorTextFrame as N, type VectorTransformHandle as O, type VectorAnchorRef as P, type VectorPathfinderOperation as Q, type VectorTool as R, type VectorDefaults as S, type VectorTextAlign as T, type VectorStyle as U, type
|
|
993
|
+
export { type VectorAlign as $, type VectorTextNode as A, type VectorAnchorType as B, type VectorCornerKind as C, type VectorViewport as D, type VectorConnectorRoute as E, type VectorConnectorSide as F, type VectorConnectorEnd as G, type VectorConnector as H, type VectorConstraintKind as I, type VectorConstraint as J, type VectorCharacterStyle as K, type VectorTextRun as L, type VectorParagraphStyle as M, type VectorTextFrame as N, type VectorTransformHandle as O, type VectorAnchorRef as P, type VectorPathfinderOperation as Q, type VectorTool as R, type VectorDefaults as S, type VectorTextAlign as T, type VectorStyle as U, type VectorDocument as V, type VectorHandleRef as W, type VectorSegmentRef as X, type VectorBlendOptions as Y, type VectorModifiers as Z, type VectorBlendMode as _, type VectorEffectType as a, type VectorDistribute as a0, type VectorArrange as a1, type VectorMaskType as a2, type VectorSymmetryMode as a3, type VectorSymmetry as a4, type VectorFreeformPoint as a5, type VectorMeshGradient as a6, type VectorFreeformGradient as a7, type VectorArrowhead as a8, type VectorResizing as a9, VECTOR_FILTER_TYPES as aA, VECTOR_GRADIENT_INTERPOLATIONS as aB, VECTOR_GRADIENT_SPREADS as aC, VECTOR_GRADIENT_TYPES as aD, VECTOR_HORIZONTAL_RESIZING as aE, VECTOR_MASK_TYPES as aF, VECTOR_MERGE_MODES as aG, VECTOR_PATHFINDER_OPERATIONS as aH, VECTOR_PATH_TEXT_BASELINES as aI, VECTOR_STROKE_GRADIENT_MODES as aJ, VECTOR_SYMMETRY_MODES as aK, VECTOR_TEXT_ALIGNS as aL, VECTOR_TOOLS as aM, VECTOR_TRANSFORM_HANDLES as aN, VECTOR_VERTICAL_RESIZING as aO, type VectorCorner as aP, type VectorGeomRef as aQ, type VectorLineCap as aR, type VectorPathTextBaseline as aS, type VectorStrokeLayerKind as aT, type VectorTextRunStyle as aU, type VectorWarpStyle as aV, type VectorFrame as aa, type VectorHorizontalResizing as ab, type VectorVerticalResizing as ac, type VectorMask as ad, type VectorAverageAxis as ae, type VectorSymbol as af, type VectorParameter as ag, type VectorBlendSpacing as ah, type VectorGradientInterpolation as ai, type VectorStrokeGradientMode as aj, type VectorArrowAlign as ak, type VectorPaintLayer as al, type VectorStrokeLayer as am, type VectorBlend as an, type VectorMergeMode as ao, type VectorLineJoin as ap, type VectorStrokeSettings as aq, type VectorInstanceOverrides as ar, VECTOR_ARROWHEADS as as, VECTOR_BLEND_MODES as at, VECTOR_BLEND_SPACINGS as au, VECTOR_CONNECTOR_ROUTES as av, VECTOR_CONNECTOR_SIDES as aw, VECTOR_CONSTRAINT_KINDS as ax, VECTOR_CORNER_KINDS as ay, VECTOR_EFFECT_TYPES as az, type VectorEffectParamsMap as b, type VectorPathNode as c, type VectorFillRule as d, type VectorBooleanOperation as e, type VectorNode as f, type VectorEffect as g, type VectorGroupNode as h, type VectorBounds as i, type VectorWarpMesh as j, type VectorInstanceNode as k, type VectorFilterType as l, type VectorFilterParamsMap as m, type VectorFilter as n, type VectorGradient as o, type Vec2 as p, type VectorGradientUnits as q, type VectorGradientSpread as r, type VectorGradientType as s, type VectorPaint as t, type VectorMatrix as u, type VectorGradientStop as v, type VectorStrokeAlign as w, type VectorSubpath as x, type VectorWidthPoint as y, type VectorAnchor as z };
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { b as AnimationEasing } from './easing-lM0Xo9Ni.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Types for the schema-driven parameters editor: the control panel of an effect, shader,
|
|
5
|
+
* generator or component. A `ParameterSchema` lists fields (optionally in groups); a
|
|
6
|
+
* `ParametersController` holds their values with validation, undo, presets and keyframes.
|
|
7
|
+
*/
|
|
8
|
+
/** A parameter's value. `number` / `int`: a number; `boolean`; `choice`: an option value;
|
|
9
|
+
* `color`: `#rrggbb` (or `#rrggbbaa` with `alpha`); `vector`: 2–4 numbers; `image` / `text`: a string. */
|
|
10
|
+
type ParameterValue = number | boolean | string | number[];
|
|
11
|
+
/** Parameter id → value. */
|
|
12
|
+
type ParameterValues = Record<string, ParameterValue>;
|
|
13
|
+
type ParameterFieldType = 'number' | 'int' | 'boolean' | 'choice' | 'color' | 'vector' | 'image' | 'text';
|
|
14
|
+
/**
|
|
15
|
+
* One test in a `showIf` condition: a literal (equal to), an array (one of), or an object
|
|
16
|
+
* whose keys must all hold.
|
|
17
|
+
*/
|
|
18
|
+
type ParameterConditionTest = string | number | boolean | readonly (string | number | boolean)[] | {
|
|
19
|
+
eq?: ParameterValue;
|
|
20
|
+
ne?: ParameterValue;
|
|
21
|
+
in?: readonly (string | number | boolean)[];
|
|
22
|
+
notIn?: readonly (string | number | boolean)[];
|
|
23
|
+
gt?: number;
|
|
24
|
+
gte?: number;
|
|
25
|
+
lt?: number;
|
|
26
|
+
lte?: number;
|
|
27
|
+
/** `true`: the value is truthy (non-zero, non-empty); `false`: falsy. */
|
|
28
|
+
truthy?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* When a field or group is shown. An object maps other parameter ids to tests, all of which
|
|
32
|
+
* must hold (`{ mode: 'advanced', count: { gte: 2 } }`); a function gets every value.
|
|
33
|
+
* Hidden fields keep their values.
|
|
34
|
+
*/
|
|
35
|
+
type ParameterCondition = {
|
|
36
|
+
readonly [id: string]: ParameterConditionTest;
|
|
37
|
+
} | ((values: Readonly<ParameterValues>) => boolean);
|
|
38
|
+
interface ParameterFieldBase<TValue extends ParameterValue> {
|
|
39
|
+
/** Unique id across the schema (also the key in `values`). */
|
|
40
|
+
id: string;
|
|
41
|
+
/** Display name (default: the id made readable, `flowSpeed` → "Flow speed"). */
|
|
42
|
+
label?: string;
|
|
43
|
+
/** Help text shown under the label and given to agents. */
|
|
44
|
+
description?: string;
|
|
45
|
+
default: TValue;
|
|
46
|
+
showIf?: ParameterCondition;
|
|
47
|
+
/** Include in `randomize()` (default `true`; image and text fields are never randomised). */
|
|
48
|
+
randomize?: boolean;
|
|
49
|
+
/** Shown but not editable from the panel (agents and code can still set it). */
|
|
50
|
+
readOnly?: boolean;
|
|
51
|
+
}
|
|
52
|
+
interface NumberParameterField extends ParameterFieldBase<number> {
|
|
53
|
+
type: 'number' | 'int';
|
|
54
|
+
min?: number;
|
|
55
|
+
max?: number;
|
|
56
|
+
/** Slider / spinner step (default: 1 for `int`, 1/100 of the range otherwise). */
|
|
57
|
+
step?: number;
|
|
58
|
+
/** Unit shown after the value (`px`, `%`, `°`, `ms`). */
|
|
59
|
+
unit?: string;
|
|
60
|
+
/** `slider` (slider plus number box; the default when `min` and `max` are set) or `input` (number box only). */
|
|
61
|
+
control?: 'slider' | 'input';
|
|
62
|
+
/** Decimal places shown (default: from `step`). */
|
|
63
|
+
decimals?: number;
|
|
64
|
+
}
|
|
65
|
+
interface BooleanParameterField extends ParameterFieldBase<boolean> {
|
|
66
|
+
type: 'boolean';
|
|
67
|
+
}
|
|
68
|
+
interface ParameterChoiceOption {
|
|
69
|
+
value: string | number;
|
|
70
|
+
label?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
}
|
|
73
|
+
interface ChoiceParameterField extends ParameterFieldBase<string | number> {
|
|
74
|
+
type: 'choice';
|
|
75
|
+
options: readonly (string | number | ParameterChoiceOption)[];
|
|
76
|
+
/** `select` (dropdown, the default) or `segmented` (buttons; best for 2–4 options). */
|
|
77
|
+
control?: 'select' | 'segmented';
|
|
78
|
+
}
|
|
79
|
+
interface ColorParameterField extends ParameterFieldBase<string> {
|
|
80
|
+
type: 'color';
|
|
81
|
+
/** Values carry alpha as `#rrggbbaa` (default `false`: `#rrggbb`). */
|
|
82
|
+
alpha?: boolean;
|
|
83
|
+
/** Colours offered as swatches. */
|
|
84
|
+
swatches?: readonly string[];
|
|
85
|
+
}
|
|
86
|
+
interface VectorParameterField extends ParameterFieldBase<number[]> {
|
|
87
|
+
type: 'vector';
|
|
88
|
+
/** Number of components, 2–4 (default: the default's length). */
|
|
89
|
+
size?: 2 | 3 | 4;
|
|
90
|
+
/** Bounds for every component, or one per component. */
|
|
91
|
+
min?: number | readonly number[];
|
|
92
|
+
max?: number | readonly number[];
|
|
93
|
+
step?: number;
|
|
94
|
+
unit?: string;
|
|
95
|
+
/** Component labels (default `x`, `y`, `z`, `w`). */
|
|
96
|
+
labels?: readonly string[];
|
|
97
|
+
decimals?: number;
|
|
98
|
+
}
|
|
99
|
+
interface ParameterImageOption {
|
|
100
|
+
url: string;
|
|
101
|
+
label?: string;
|
|
102
|
+
}
|
|
103
|
+
interface ImageParameterField extends ParameterFieldBase<string> {
|
|
104
|
+
type: 'image';
|
|
105
|
+
/** Suggested assets shown as thumbnails. */
|
|
106
|
+
options?: readonly ParameterImageOption[];
|
|
107
|
+
/** File types offered by the picker's file button, e.g. `image/*`. */
|
|
108
|
+
accept?: string;
|
|
109
|
+
}
|
|
110
|
+
interface TextParameterField extends ParameterFieldBase<string> {
|
|
111
|
+
type: 'text';
|
|
112
|
+
multiline?: boolean;
|
|
113
|
+
maxLength?: number;
|
|
114
|
+
minLength?: number;
|
|
115
|
+
/** Regular expression (unicode) the whole value must match. */
|
|
116
|
+
pattern?: string;
|
|
117
|
+
placeholder?: string;
|
|
118
|
+
}
|
|
119
|
+
type ParameterField = NumberParameterField | BooleanParameterField | ChoiceParameterField | ColorParameterField | VectorParameterField | ImageParameterField | TextParameterField;
|
|
120
|
+
/** A collapsible group of fields (groups may nest). */
|
|
121
|
+
interface ParameterGroup {
|
|
122
|
+
type: 'group';
|
|
123
|
+
/** Unique id (used for its collapsed state). */
|
|
124
|
+
id: string;
|
|
125
|
+
label?: string;
|
|
126
|
+
description?: string;
|
|
127
|
+
/** Starts collapsed (default `false`). */
|
|
128
|
+
collapsed?: boolean;
|
|
129
|
+
showIf?: ParameterCondition;
|
|
130
|
+
fields: readonly ParameterSchemaItem[];
|
|
131
|
+
}
|
|
132
|
+
type ParameterSchemaItem = ParameterField | ParameterGroup;
|
|
133
|
+
/** A named set of values. Fields a preset leaves out go back to their defaults when applied. */
|
|
134
|
+
interface ParameterPreset {
|
|
135
|
+
name: string;
|
|
136
|
+
values: Partial<ParameterValues>;
|
|
137
|
+
description?: string;
|
|
138
|
+
/** Comes from the schema: cannot be overwritten or deleted. */
|
|
139
|
+
builtIn?: boolean;
|
|
140
|
+
}
|
|
141
|
+
interface ParameterSchema {
|
|
142
|
+
title?: string;
|
|
143
|
+
fields: readonly ParameterSchemaItem[];
|
|
144
|
+
/** Built-in presets. */
|
|
145
|
+
presets?: readonly ParameterPreset[];
|
|
146
|
+
}
|
|
147
|
+
/** One error, shaped like `validateJsonSchema`'s: `path` is `/<id>` (or `/<id>/<index>`). */
|
|
148
|
+
interface ParameterError {
|
|
149
|
+
path: string;
|
|
150
|
+
/** The parameter's id. */
|
|
151
|
+
id: string;
|
|
152
|
+
/** A sentence naming the field, e.g. "Speed must be at most 4." */
|
|
153
|
+
message: string;
|
|
154
|
+
}
|
|
155
|
+
/** Easing of a keyframe segment (the `AnimationEasing` of `@pixerate/editor/animation`). */
|
|
156
|
+
type ParameterEasing = AnimationEasing;
|
|
157
|
+
/** One keyframe, shaped like `AnimationKeyframe` from `@pixerate/editor/animation`. */
|
|
158
|
+
interface ParameterKeyframe<TValue = ParameterValue> {
|
|
159
|
+
/** Time in milliseconds. */
|
|
160
|
+
time: number;
|
|
161
|
+
value: TValue;
|
|
162
|
+
/** Easing of the segment leaving this keyframe. */
|
|
163
|
+
easing?: ParameterEasing;
|
|
164
|
+
}
|
|
165
|
+
/** A parameter's keyframes, shaped like `AnimationTrack` from `@pixerate/editor/animation` (which it accepts). */
|
|
166
|
+
interface ParameterTrack<TValue = ParameterValue> {
|
|
167
|
+
keyframes: ParameterKeyframe<TValue>[];
|
|
168
|
+
enabled?: boolean;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Where a parameter's keyframes live: an effect document, a canvas node, or
|
|
172
|
+
* `createParameterKeyframeStore()`. The controller reads and writes whole tracks so a
|
|
173
|
+
* keyframe toggle is one undo step.
|
|
174
|
+
*/
|
|
175
|
+
interface ParameterKeyframes {
|
|
176
|
+
getTrack(id: string): ParameterTrack<any> | undefined;
|
|
177
|
+
/** Replaces a track; `undefined` (or no keyframes) removes it. */
|
|
178
|
+
setTrack(id: string, track: ParameterTrack<any> | undefined): void;
|
|
179
|
+
/** Called when tracks change from outside the controller. */
|
|
180
|
+
subscribe?(listener: () => void): () => void;
|
|
181
|
+
}
|
|
182
|
+
/** `keyed`: a keyframe sits at the current time; `animated`: keyframes elsewhere; `none`. */
|
|
183
|
+
type ParameterKeyState = 'none' | 'animated' | 'keyed';
|
|
184
|
+
|
|
185
|
+
export type { BooleanParameterField as B, ChoiceParameterField as C, ImageParameterField as I, NumberParameterField as N, ParameterField as P, TextParameterField as T, VectorParameterField as V, ParameterValue as a, ParameterError as b, ParameterSchema as c, ParameterChoiceOption as d, ParameterCondition as e, ParameterValues as f, ParameterSchemaItem as g, ParameterGroup as h, ParameterKeyframes as i, ParameterTrack as j, ParameterKeyState as k, ParameterKeyframe as l, ParameterPreset as m, ColorParameterField as n, ParameterConditionTest as o, ParameterEasing as p, ParameterFieldType as q, ParameterImageOption as r };
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { b as AnimationEasing } from './easing-lM0Xo9Ni.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Types for the schema-driven parameters editor: the control panel of an effect, shader,
|
|
5
|
+
* generator or component. A `ParameterSchema` lists fields (optionally in groups); a
|
|
6
|
+
* `ParametersController` holds their values with validation, undo, presets and keyframes.
|
|
7
|
+
*/
|
|
8
|
+
/** A parameter's value. `number` / `int`: a number; `boolean`; `choice`: an option value;
|
|
9
|
+
* `color`: `#rrggbb` (or `#rrggbbaa` with `alpha`); `vector`: 2–4 numbers; `image` / `text`: a string. */
|
|
10
|
+
type ParameterValue = number | boolean | string | number[];
|
|
11
|
+
/** Parameter id → value. */
|
|
12
|
+
type ParameterValues = Record<string, ParameterValue>;
|
|
13
|
+
type ParameterFieldType = 'number' | 'int' | 'boolean' | 'choice' | 'color' | 'vector' | 'image' | 'text';
|
|
14
|
+
/**
|
|
15
|
+
* One test in a `showIf` condition: a literal (equal to), an array (one of), or an object
|
|
16
|
+
* whose keys must all hold.
|
|
17
|
+
*/
|
|
18
|
+
type ParameterConditionTest = string | number | boolean | readonly (string | number | boolean)[] | {
|
|
19
|
+
eq?: ParameterValue;
|
|
20
|
+
ne?: ParameterValue;
|
|
21
|
+
in?: readonly (string | number | boolean)[];
|
|
22
|
+
notIn?: readonly (string | number | boolean)[];
|
|
23
|
+
gt?: number;
|
|
24
|
+
gte?: number;
|
|
25
|
+
lt?: number;
|
|
26
|
+
lte?: number;
|
|
27
|
+
/** `true`: the value is truthy (non-zero, non-empty); `false`: falsy. */
|
|
28
|
+
truthy?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* When a field or group is shown. An object maps other parameter ids to tests, all of which
|
|
32
|
+
* must hold (`{ mode: 'advanced', count: { gte: 2 } }`); a function gets every value.
|
|
33
|
+
* Hidden fields keep their values.
|
|
34
|
+
*/
|
|
35
|
+
type ParameterCondition = {
|
|
36
|
+
readonly [id: string]: ParameterConditionTest;
|
|
37
|
+
} | ((values: Readonly<ParameterValues>) => boolean);
|
|
38
|
+
interface ParameterFieldBase<TValue extends ParameterValue> {
|
|
39
|
+
/** Unique id across the schema (also the key in `values`). */
|
|
40
|
+
id: string;
|
|
41
|
+
/** Display name (default: the id made readable, `flowSpeed` → "Flow speed"). */
|
|
42
|
+
label?: string;
|
|
43
|
+
/** Help text shown under the label and given to agents. */
|
|
44
|
+
description?: string;
|
|
45
|
+
default: TValue;
|
|
46
|
+
showIf?: ParameterCondition;
|
|
47
|
+
/** Include in `randomize()` (default `true`; image and text fields are never randomised). */
|
|
48
|
+
randomize?: boolean;
|
|
49
|
+
/** Shown but not editable from the panel (agents and code can still set it). */
|
|
50
|
+
readOnly?: boolean;
|
|
51
|
+
}
|
|
52
|
+
interface NumberParameterField extends ParameterFieldBase<number> {
|
|
53
|
+
type: 'number' | 'int';
|
|
54
|
+
min?: number;
|
|
55
|
+
max?: number;
|
|
56
|
+
/** Slider / spinner step (default: 1 for `int`, 1/100 of the range otherwise). */
|
|
57
|
+
step?: number;
|
|
58
|
+
/** Unit shown after the value (`px`, `%`, `°`, `ms`). */
|
|
59
|
+
unit?: string;
|
|
60
|
+
/** `slider` (slider plus number box; the default when `min` and `max` are set) or `input` (number box only). */
|
|
61
|
+
control?: 'slider' | 'input';
|
|
62
|
+
/** Decimal places shown (default: from `step`). */
|
|
63
|
+
decimals?: number;
|
|
64
|
+
}
|
|
65
|
+
interface BooleanParameterField extends ParameterFieldBase<boolean> {
|
|
66
|
+
type: 'boolean';
|
|
67
|
+
}
|
|
68
|
+
interface ParameterChoiceOption {
|
|
69
|
+
value: string | number;
|
|
70
|
+
label?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
}
|
|
73
|
+
interface ChoiceParameterField extends ParameterFieldBase<string | number> {
|
|
74
|
+
type: 'choice';
|
|
75
|
+
options: readonly (string | number | ParameterChoiceOption)[];
|
|
76
|
+
/** `select` (dropdown, the default) or `segmented` (buttons; best for 2–4 options). */
|
|
77
|
+
control?: 'select' | 'segmented';
|
|
78
|
+
}
|
|
79
|
+
interface ColorParameterField extends ParameterFieldBase<string> {
|
|
80
|
+
type: 'color';
|
|
81
|
+
/** Values carry alpha as `#rrggbbaa` (default `false`: `#rrggbb`). */
|
|
82
|
+
alpha?: boolean;
|
|
83
|
+
/** Colours offered as swatches. */
|
|
84
|
+
swatches?: readonly string[];
|
|
85
|
+
}
|
|
86
|
+
interface VectorParameterField extends ParameterFieldBase<number[]> {
|
|
87
|
+
type: 'vector';
|
|
88
|
+
/** Number of components, 2–4 (default: the default's length). */
|
|
89
|
+
size?: 2 | 3 | 4;
|
|
90
|
+
/** Bounds for every component, or one per component. */
|
|
91
|
+
min?: number | readonly number[];
|
|
92
|
+
max?: number | readonly number[];
|
|
93
|
+
step?: number;
|
|
94
|
+
unit?: string;
|
|
95
|
+
/** Component labels (default `x`, `y`, `z`, `w`). */
|
|
96
|
+
labels?: readonly string[];
|
|
97
|
+
decimals?: number;
|
|
98
|
+
}
|
|
99
|
+
interface ParameterImageOption {
|
|
100
|
+
url: string;
|
|
101
|
+
label?: string;
|
|
102
|
+
}
|
|
103
|
+
interface ImageParameterField extends ParameterFieldBase<string> {
|
|
104
|
+
type: 'image';
|
|
105
|
+
/** Suggested assets shown as thumbnails. */
|
|
106
|
+
options?: readonly ParameterImageOption[];
|
|
107
|
+
/** File types offered by the picker's file button, e.g. `image/*`. */
|
|
108
|
+
accept?: string;
|
|
109
|
+
}
|
|
110
|
+
interface TextParameterField extends ParameterFieldBase<string> {
|
|
111
|
+
type: 'text';
|
|
112
|
+
multiline?: boolean;
|
|
113
|
+
maxLength?: number;
|
|
114
|
+
minLength?: number;
|
|
115
|
+
/** Regular expression (unicode) the whole value must match. */
|
|
116
|
+
pattern?: string;
|
|
117
|
+
placeholder?: string;
|
|
118
|
+
}
|
|
119
|
+
type ParameterField = NumberParameterField | BooleanParameterField | ChoiceParameterField | ColorParameterField | VectorParameterField | ImageParameterField | TextParameterField;
|
|
120
|
+
/** A collapsible group of fields (groups may nest). */
|
|
121
|
+
interface ParameterGroup {
|
|
122
|
+
type: 'group';
|
|
123
|
+
/** Unique id (used for its collapsed state). */
|
|
124
|
+
id: string;
|
|
125
|
+
label?: string;
|
|
126
|
+
description?: string;
|
|
127
|
+
/** Starts collapsed (default `false`). */
|
|
128
|
+
collapsed?: boolean;
|
|
129
|
+
showIf?: ParameterCondition;
|
|
130
|
+
fields: readonly ParameterSchemaItem[];
|
|
131
|
+
}
|
|
132
|
+
type ParameterSchemaItem = ParameterField | ParameterGroup;
|
|
133
|
+
/** A named set of values. Fields a preset leaves out go back to their defaults when applied. */
|
|
134
|
+
interface ParameterPreset {
|
|
135
|
+
name: string;
|
|
136
|
+
values: Partial<ParameterValues>;
|
|
137
|
+
description?: string;
|
|
138
|
+
/** Comes from the schema: cannot be overwritten or deleted. */
|
|
139
|
+
builtIn?: boolean;
|
|
140
|
+
}
|
|
141
|
+
interface ParameterSchema {
|
|
142
|
+
title?: string;
|
|
143
|
+
fields: readonly ParameterSchemaItem[];
|
|
144
|
+
/** Built-in presets. */
|
|
145
|
+
presets?: readonly ParameterPreset[];
|
|
146
|
+
}
|
|
147
|
+
/** One error, shaped like `validateJsonSchema`'s: `path` is `/<id>` (or `/<id>/<index>`). */
|
|
148
|
+
interface ParameterError {
|
|
149
|
+
path: string;
|
|
150
|
+
/** The parameter's id. */
|
|
151
|
+
id: string;
|
|
152
|
+
/** A sentence naming the field, e.g. "Speed must be at most 4." */
|
|
153
|
+
message: string;
|
|
154
|
+
}
|
|
155
|
+
/** Easing of a keyframe segment (the `AnimationEasing` of `@pixerate/editor/animation`). */
|
|
156
|
+
type ParameterEasing = AnimationEasing;
|
|
157
|
+
/** One keyframe, shaped like `AnimationKeyframe` from `@pixerate/editor/animation`. */
|
|
158
|
+
interface ParameterKeyframe<TValue = ParameterValue> {
|
|
159
|
+
/** Time in milliseconds. */
|
|
160
|
+
time: number;
|
|
161
|
+
value: TValue;
|
|
162
|
+
/** Easing of the segment leaving this keyframe. */
|
|
163
|
+
easing?: ParameterEasing;
|
|
164
|
+
}
|
|
165
|
+
/** A parameter's keyframes, shaped like `AnimationTrack` from `@pixerate/editor/animation` (which it accepts). */
|
|
166
|
+
interface ParameterTrack<TValue = ParameterValue> {
|
|
167
|
+
keyframes: ParameterKeyframe<TValue>[];
|
|
168
|
+
enabled?: boolean;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Where a parameter's keyframes live: an effect document, a canvas node, or
|
|
172
|
+
* `createParameterKeyframeStore()`. The controller reads and writes whole tracks so a
|
|
173
|
+
* keyframe toggle is one undo step.
|
|
174
|
+
*/
|
|
175
|
+
interface ParameterKeyframes {
|
|
176
|
+
getTrack(id: string): ParameterTrack<any> | undefined;
|
|
177
|
+
/** Replaces a track; `undefined` (or no keyframes) removes it. */
|
|
178
|
+
setTrack(id: string, track: ParameterTrack<any> | undefined): void;
|
|
179
|
+
/** Called when tracks change from outside the controller. */
|
|
180
|
+
subscribe?(listener: () => void): () => void;
|
|
181
|
+
}
|
|
182
|
+
/** `keyed`: a keyframe sits at the current time; `animated`: keyframes elsewhere; `none`. */
|
|
183
|
+
type ParameterKeyState = 'none' | 'animated' | 'keyed';
|
|
184
|
+
|
|
185
|
+
export type { BooleanParameterField as B, ChoiceParameterField as C, ImageParameterField as I, NumberParameterField as N, ParameterField as P, TextParameterField as T, VectorParameterField as V, ParameterValue as a, ParameterError as b, ParameterSchema as c, ParameterChoiceOption as d, ParameterCondition as e, ParameterValues as f, ParameterSchemaItem as g, ParameterGroup as h, ParameterKeyframes as i, ParameterTrack as j, ParameterKeyState as k, ParameterKeyframe as l, ParameterPreset as m, ColorParameterField as n, ParameterConditionTest as o, ParameterEasing as p, ParameterFieldType as q, ParameterImageOption as r };
|