@alpha2-sh/editor 0.0.0 → 0.1.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 +107 -1
- package/dist/browser/bridge.d.ts +44 -0
- package/dist/browser/bridge.js +2176 -0
- package/dist/browser/extensions-worker-entry.js +3 -0
- package/dist/browser/extensions-worker.d.ts +46 -0
- package/dist/browser/extensions-worker.js +149 -0
- package/dist/browser/hash-worker-entry.d.ts +1 -0
- package/dist/browser/hash-worker-entry.js +3 -0
- package/dist/browser/hash-worker.d.ts +24 -0
- package/dist/browser/hash-worker.js +87 -0
- package/dist/browser/index.d.ts +11 -0
- package/dist/browser/index.js +9 -0
- package/dist/browser/jobs.d.ts +82 -0
- package/dist/browser/jobs.js +291 -0
- package/dist/browser/resources.d.ts +40 -0
- package/dist/browser/resources.js +83 -0
- package/dist/browser/runtime/assets.d.ts +233 -0
- package/dist/browser/runtime/assets.js +633 -0
- package/dist/browser/runtime/audio.d.ts +60 -0
- package/dist/browser/runtime/audio.js +549 -0
- package/dist/browser/runtime/budget.d.ts +11 -0
- package/dist/browser/runtime/budget.js +26 -0
- package/dist/browser/runtime/caption-fonts.d.ts +34 -0
- package/dist/browser/runtime/caption-fonts.js +69 -0
- package/dist/browser/runtime/color.d.ts +7 -0
- package/dist/browser/runtime/color.js +12 -0
- package/dist/browser/runtime/engine.d.ts +91 -0
- package/dist/browser/runtime/engine.js +352 -0
- package/dist/browser/runtime/export-audio.d.ts +23 -0
- package/dist/browser/runtime/export-audio.js +75 -0
- package/dist/browser/runtime/exporter.d.ts +140 -0
- package/dist/browser/runtime/exporter.js +751 -0
- package/dist/browser/runtime/extension-import.d.ts +196 -0
- package/dist/browser/runtime/extension-import.js +521 -0
- package/dist/browser/runtime/fingerprint.d.ts +57 -0
- package/dist/browser/runtime/fingerprint.js +157 -0
- package/dist/browser/runtime/generators.d.ts +188 -0
- package/dist/browser/runtime/generators.js +173 -0
- package/dist/browser/runtime/locks.d.ts +32 -0
- package/dist/browser/runtime/locks.js +86 -0
- package/dist/browser/runtime/output.d.ts +87 -0
- package/dist/browser/runtime/output.js +230 -0
- package/dist/browser/runtime/preview-utils.d.ts +3 -0
- package/dist/browser/runtime/preview-utils.js +49 -0
- package/dist/browser/runtime/proxies.d.ts +72 -0
- package/dist/browser/runtime/proxies.js +369 -0
- package/dist/browser/runtime/proxy-storage.d.ts +59 -0
- package/dist/browser/runtime/proxy-storage.js +119 -0
- package/dist/browser/runtime/sources.d.ts +82 -0
- package/dist/browser/runtime/sources.js +819 -0
- package/dist/browser/runtime/staging.d.ts +10 -0
- package/dist/browser/runtime/staging.js +32 -0
- package/dist/browser/runtime/still.d.ts +21 -0
- package/dist/browser/runtime/still.js +52 -0
- package/dist/browser/runtime/wasm.d.ts +9 -0
- package/dist/browser/runtime/wasm.js +20 -0
- package/dist/browser/types.d.ts +549 -0
- package/dist/browser/types.js +1 -0
- package/dist/browser/worker-entry.d.ts +1 -0
- package/dist/browser/worker-entry.js +2 -0
- package/dist/browser/worker.d.ts +24 -0
- package/dist/browser/worker.js +239 -0
- package/dist/core/captions.d.ts +34 -0
- package/dist/core/captions.js +108 -0
- package/dist/core/clip-time.d.ts +31 -0
- package/dist/core/clip-time.js +125 -0
- package/dist/core/commands.d.ts +413 -0
- package/dist/core/commands.js +1118 -0
- package/dist/core/compositions.d.ts +234 -0
- package/dist/core/compositions.js +851 -0
- package/dist/core/document.d.ts +245 -0
- package/dist/core/document.js +683 -0
- package/dist/core/keyframes.d.ts +82 -0
- package/dist/core/keyframes.js +153 -0
- package/dist/core/presets.d.ts +64 -0
- package/dist/core/presets.js +241 -0
- package/dist/core/session.d.ts +150 -0
- package/dist/core/session.js +541 -0
- package/dist/core/text.d.ts +17 -0
- package/dist/core/text.js +17 -0
- package/dist/core/time.d.ts +19 -0
- package/dist/core/time.js +39 -0
- package/dist/core/timeline-index.d.ts +44 -0
- package/dist/core/timeline-index.js +59 -0
- package/dist/core/transitions.d.ts +20 -0
- package/dist/core/transitions.js +118 -0
- package/dist/core/validated.d.ts +23 -0
- package/dist/core/validated.js +52 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +11 -0
- package/dist/native-client/index.d.ts +131 -0
- package/dist/native-client/index.js +354 -0
- package/dist/ports/index.d.ts +146 -0
- package/dist/ports/index.js +1 -0
- package/dist/react/index.d.ts +37 -0
- package/dist/react/index.js +94 -0
- package/package.json +69 -8
- /package/{index.js → dist/browser/extensions-worker-entry.d.ts} +0 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import type { Clip, ClipEffect, Composition, CompositionNode, Project } from "alpha2/project";
|
|
2
|
+
/** One effect of a clip's effect stack: an effect node of its composition. */
|
|
3
|
+
export interface StackEntry {
|
|
4
|
+
/** The effect node's id, stable across edits. */
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly effect: ClipEffect;
|
|
7
|
+
readonly bypass: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The composition `id` names in `project`. Looked up in an index of the project's compositions
|
|
11
|
+
* array, made once per array, so walks that find many compositions stay linear. An index a changed
|
|
12
|
+
* array no longer matches is made again, and an id it lacks is looked for in the array itself.
|
|
13
|
+
*/
|
|
14
|
+
export declare function findComposition(project: Project, id: string): Composition | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* A clip's effects as a stack: its composition when that is the clip's picture through a chain of
|
|
17
|
+
* effect nodes and nothing else, bottom first. A clip without a composition has an empty stack.
|
|
18
|
+
* `undefined` means the composition is a graph a stack cannot show: it branches, merges, reads
|
|
19
|
+
* other sources, or has loose nodes.
|
|
20
|
+
*/
|
|
21
|
+
export declare function effectStack(project: Project, clip: Clip): readonly StackEntry[] | undefined;
|
|
22
|
+
/** An id based on `base` that no composition in `project` has. */
|
|
23
|
+
export declare function freeCompositionId(project: Project, base: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* `project` with clip `clipId` showing its picture through `stack`, bottom first: its composition
|
|
26
|
+
* rewritten as that chain, or removed with the reference when the stack is empty. The composition
|
|
27
|
+
* keeps its id and the clip its time mapping; a clip without one gets `<clip id>-fx`.
|
|
28
|
+
* Throws when `clipId` names no clip.
|
|
29
|
+
*/
|
|
30
|
+
export declare function withEffectStack(project: Project, clipId: string, stack: readonly StackEntry[]): Project;
|
|
31
|
+
/**
|
|
32
|
+
* The compositions `id` draws: itself and, through group nodes, the group definitions it uses, each
|
|
33
|
+
* once.
|
|
34
|
+
*/
|
|
35
|
+
export declare function compositionTree(project: Project, id: string): Composition[];
|
|
36
|
+
/**
|
|
37
|
+
* Ids of the compositions `project` draws: those clips show and composition sources show (Library
|
|
38
|
+
* items), and those these use through group nodes and composition sources, as far as they go.
|
|
39
|
+
*/
|
|
40
|
+
export declare function drawnCompositions(project: Project): Set<string>;
|
|
41
|
+
/**
|
|
42
|
+
* `after` without the compositions `before` drew and `after` no longer does: a clip owns the
|
|
43
|
+
* composition it shows, so the edit that stops the last drawing of one (deleting its clip or track,
|
|
44
|
+
* removing its Library source or the group node that drew it, emptying an effect stack) removes it,
|
|
45
|
+
* and the group definitions only it drew with it. A composition `before` did not draw stays, so one
|
|
46
|
+
* added for a later edit (a macro's definition) waits for it. Returns the ids it removed.
|
|
47
|
+
*/
|
|
48
|
+
export declare function withoutUndrawn(before: Project, after: Project): {
|
|
49
|
+
readonly project: Project;
|
|
50
|
+
readonly removed: ReadonlySet<string>;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* `project` with `clip` given compositions no other clip draws, for a clip a command puts down (a
|
|
54
|
+
* paste, a duplicate). With `compositions`, those the clip drew when it was copied, it shows a copy
|
|
55
|
+
* of them whatever the project has now. Otherwise it shows a copy of its composition when anything
|
|
56
|
+
* else draws that composition or a group definition in it, and the composition itself when nothing
|
|
57
|
+
* does. A copy takes free ids based on `<root>~<clip id>` ({@link copyComposition}), so the clip is
|
|
58
|
+
* edited independently of its original. Returns the copies' ids by their originals'.
|
|
59
|
+
*/
|
|
60
|
+
export declare function ownComposition(project: Project, clip: Clip, compositions?: readonly Composition[]): {
|
|
61
|
+
readonly project: Project;
|
|
62
|
+
readonly clip: Clip;
|
|
63
|
+
readonly copies: ReadonlyMap<string, string>;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The compositions `copy` draws for those `original` draws, by id: the two themselves, and the
|
|
67
|
+
* definitions of their group nodes of the same id, as far as they go. A composition copied for a
|
|
68
|
+
* split or a paste corresponds to its original this way.
|
|
69
|
+
*/
|
|
70
|
+
export declare function correspondingCompositions(project: Project, original: string, copy: string): Map<string, string>;
|
|
71
|
+
/**
|
|
72
|
+
* Composition time at timeline time `tick` for `clip`: `offset + (tick - start) * scale`, rounded
|
|
73
|
+
* down, as the engine maps it. Without a composition, timeline time. Time is whole ticks; a
|
|
74
|
+
* fraction (a curve sampled between ticks) reads as the tick it falls in.
|
|
75
|
+
*/
|
|
76
|
+
export declare function compositionTime(clip: Clip, tick: number): number;
|
|
77
|
+
/**
|
|
78
|
+
* The first timeline time at which `clip` shows composition time `time`: the inverse of
|
|
79
|
+
* {@link compositionTime}, rounded up to a tick. A fractional `time` is first rounded up to the
|
|
80
|
+
* next whole tick.
|
|
81
|
+
*/
|
|
82
|
+
export declare function timelineTime(clip: Clip, time: number): number;
|
|
83
|
+
/**
|
|
84
|
+
* Ids of the sources `tracks`' clips draw: each clip's own, and those the media nodes its
|
|
85
|
+
* compositions' outputs need read (the inputs {@link CompositionReads.neededInputs} names: of a
|
|
86
|
+
* group node only the ports its composition reads), through group nodes and composition sources
|
|
87
|
+
* too. A clip's composition source counts only where the clip's own composition draws the clip. The
|
|
88
|
+
* engine's `Project::used_sources` is the same set; `tests/cases/used-sources-corpus.json` holds both to
|
|
89
|
+
* it.
|
|
90
|
+
*/
|
|
91
|
+
export declare function shownSources(project: Project, tracks?: Project["timeline"]["tracks"]): Set<string>;
|
|
92
|
+
/**
|
|
93
|
+
* Ids of the effect resources (`effect_resources`) what `tracks` draw reads: those the effect and
|
|
94
|
+
* transition nodes drawing {@link shownSources} evaluates name (not a bypassed node's), and those
|
|
95
|
+
* the tracks' transitions name. Only these must be registered for a render: the engine asks for a
|
|
96
|
+
* resource when a node it evaluates needs one.
|
|
97
|
+
*/
|
|
98
|
+
export declare function drawnEffectResources(project: Project, tracks?: Project["timeline"]["tracks"]): Set<string>;
|
|
99
|
+
/**
|
|
100
|
+
* A node input as graph commands name it: `input`, `from`, `to`, `matte`, or a merge layer's index.
|
|
101
|
+
*/
|
|
102
|
+
export type InputKey = "input" | "from" | "to" | "matte" | number;
|
|
103
|
+
/** The input keys of a node's operation, in order. */
|
|
104
|
+
export declare function inputKeys(op: CompositionNode["op"]): InputKey[];
|
|
105
|
+
/**
|
|
106
|
+
* The inputs drawing `node` reads: only its pass-through input (the first) when it is bypassed, and
|
|
107
|
+
* every input otherwise.
|
|
108
|
+
*/
|
|
109
|
+
export declare function neededInputs(node: CompositionNode): InputKey[];
|
|
110
|
+
/** What each composition's output reads, as alpha2-model's `CompositionReads`. */
|
|
111
|
+
export interface CompositionReads {
|
|
112
|
+
/**
|
|
113
|
+
* Whether composition `id`'s output reads its group input `port`; true for a composition it does
|
|
114
|
+
* not know.
|
|
115
|
+
*/
|
|
116
|
+
readsPort(id: string, port: number): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Whether composition `id`, shown by a clip, draws the clip's picture: its output reaches a clip
|
|
119
|
+
* node, directly or in a group. True for a composition it does not know.
|
|
120
|
+
*/
|
|
121
|
+
drawsClip(id: string): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* The inputs drawing `node` reads: its {@link neededInputs}, of a group node only the ports its
|
|
124
|
+
* composition reads.
|
|
125
|
+
*/
|
|
126
|
+
neededInputs(node: CompositionNode): InputKey[];
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* What each of `compositions` reads: the group inputs and clip nodes a walk from its output
|
|
130
|
+
* reaches, along the inputs drawing each node reads, into the compositions its group nodes draw. A
|
|
131
|
+
* group draws what its nodes would inline, so a group node needs only the ports its composition
|
|
132
|
+
* reads: a port it never reads may be left unconnected, and what a connected one reads is not
|
|
133
|
+
* drawn. A composition that uses itself (which validation refuses) reads every port and draws the
|
|
134
|
+
* clip.
|
|
135
|
+
*/
|
|
136
|
+
export declare function compositionReads(compositions: readonly Composition[]): CompositionReads;
|
|
137
|
+
/** The node an input reads, or `undefined` when it is unconnected or absent. */
|
|
138
|
+
export declare function inputOf(op: CompositionNode["op"], key: InputKey): string | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* `op` with input `key` reading `node` (`null` disconnects it). Throws when `op` has no input
|
|
141
|
+
* `key`.
|
|
142
|
+
*/
|
|
143
|
+
export declare function withInput(op: CompositionNode["op"], key: InputKey, node: string | null): CompositionNode["op"];
|
|
144
|
+
/**
|
|
145
|
+
* How a composition is drawn, which decides what its clip nodes and group inputs read, as the
|
|
146
|
+
* engine plans it.
|
|
147
|
+
*
|
|
148
|
+
* - `clip`: a clip's own composition. Its clip nodes draw the clip; no group node feeds its group
|
|
149
|
+
* inputs.
|
|
150
|
+
* - `source`: a composition source, drawn by a clip or a media node. Nothing feeds its clip nodes
|
|
151
|
+
* or its group inputs.
|
|
152
|
+
* - `group`: a group's definition, opened on its own. Its group inputs read the group node's
|
|
153
|
+
* inputs, and whether its clip nodes draw anything depends on where the group is drawn, so
|
|
154
|
+
* neither is an issue here.
|
|
155
|
+
*/
|
|
156
|
+
export type GraphUse = "clip" | "source" | "group";
|
|
157
|
+
/**
|
|
158
|
+
* Why a composition's output cannot be drawn: the engine's four reasons for refusing it as an
|
|
159
|
+
* incomplete composition (`INCOMPLETE_COMPOSITION`). An issue inside a composition that a group or
|
|
160
|
+
* media node draws names its node as the engine does, prefixed by the drawing node's id and `/`
|
|
161
|
+
* (`group/blur`); a `no_output` there names the drawing node.
|
|
162
|
+
*/
|
|
163
|
+
export type GraphIssue = {
|
|
164
|
+
readonly kind: "no_output";
|
|
165
|
+
readonly node?: string;
|
|
166
|
+
} | {
|
|
167
|
+
readonly kind: "missing_input";
|
|
168
|
+
readonly node: string;
|
|
169
|
+
readonly input: InputKey;
|
|
170
|
+
}
|
|
171
|
+
/** A group input no group node feeds: in a clip's composition or a composition source. */
|
|
172
|
+
| {
|
|
173
|
+
readonly kind: "unbound_group_input";
|
|
174
|
+
readonly node: string;
|
|
175
|
+
}
|
|
176
|
+
/** A clip node in a composition source, which shows no clip. */
|
|
177
|
+
| {
|
|
178
|
+
readonly kind: "clip_without_clip";
|
|
179
|
+
readonly node: string;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* What {@link graphIssues} reads to follow group and media nodes into the compositions they draw.
|
|
183
|
+
*/
|
|
184
|
+
export interface GraphProject {
|
|
185
|
+
readonly compositions?: readonly Composition[] | null;
|
|
186
|
+
readonly sources: readonly {
|
|
187
|
+
readonly id: string;
|
|
188
|
+
readonly composition?: string | null;
|
|
189
|
+
}[];
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* What stops `composition`'s output from rendering when it is drawn as `use`: no output, an
|
|
193
|
+
* unconnected input a node the output reaches uses (only the pass-through input of a bypassed node,
|
|
194
|
+
* and of a group node only the ports its composition reads), a group input nothing feeds, or a clip
|
|
195
|
+
* node where there is no clip. The engine refuses the same frames with `INCOMPLETE_COMPOSITION`;
|
|
196
|
+
* this lets an editor mark the nodes before it asks.
|
|
197
|
+
*
|
|
198
|
+
* With `project`, the issues of the compositions the output's group and media nodes draw are
|
|
199
|
+
* included, as the engine plans them inline; without it those nodes are taken as drawn.
|
|
200
|
+
*/
|
|
201
|
+
export declare function graphIssues(composition: Composition, use: GraphUse, project?: GraphProject): GraphIssue[];
|
|
202
|
+
/** An id based on `base` that no node of `composition` has. */
|
|
203
|
+
export declare function freeNodeId(composition: Composition, base: string): string;
|
|
204
|
+
/**
|
|
205
|
+
* `composition` without the nodes `ids`, every input that read one of them disconnected, no output
|
|
206
|
+
* if it was one of them, and no control that exposed one of them.
|
|
207
|
+
*/
|
|
208
|
+
export declare function withoutNodes(composition: Composition, ids: readonly string[]): Composition;
|
|
209
|
+
/**
|
|
210
|
+
* `composition` with nodes `ids` folded into a group node `groupId` that draws a new composition
|
|
211
|
+
* `definitionId` of them: each node outside the selection that a selected node reads becomes one of
|
|
212
|
+
* its inputs, in the order first read, and the one selected node read from outside (or the output)
|
|
213
|
+
* becomes its output. A selected group input stays in `composition`: it reads `composition`'s own
|
|
214
|
+
* input, which a node inside the group reads through a port like any node outside. The picture does
|
|
215
|
+
* not change.
|
|
216
|
+
*
|
|
217
|
+
* @throws When the selection is empty or only group inputs, names an absent node, `groupId` names
|
|
218
|
+
* an unselected node, or other than one selected node's picture leaves the selection.
|
|
219
|
+
*/
|
|
220
|
+
export declare function groupNodes(composition: Composition, ids: readonly string[], groupId: string, definitionId: string): {
|
|
221
|
+
readonly parent: Composition;
|
|
222
|
+
readonly definition: Composition;
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* `composition` with group node `groupId` replaced by the nodes of the composition it draws, under
|
|
226
|
+
* ids based on `<group>-<node>`: its group inputs read what the group node's inputs read, its
|
|
227
|
+
* controls keep the values the group node set, and what read the group reads its output. Returns
|
|
228
|
+
* the new ids by inner id. The picture does not change.
|
|
229
|
+
* Throws when `groupId` is not a group node of `composition`.
|
|
230
|
+
*/
|
|
231
|
+
export declare function ungroupNode(composition: Composition, groupId: string, definition: Composition): {
|
|
232
|
+
readonly parent: Composition;
|
|
233
|
+
readonly ids: ReadonlyMap<string, string>;
|
|
234
|
+
};
|