alpha2 0.5.2 → 0.6.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 +71 -5
- package/THIRD_PARTY_NOTICES.md +191 -1
- package/dist/apply-edit.d.ts +124 -0
- package/dist/apply-edit.js +15 -0
- package/dist/assets.d.ts +12 -0
- package/dist/audio-layout.js +6 -3
- package/dist/audio-worklet-processor.js +27 -33
- package/dist/audio.d.ts +5 -4
- package/dist/audio.js +8 -6
- package/dist/compose.d.ts +105 -0
- package/dist/compose.js +63 -0
- package/dist/decoder-fallback.d.ts +3 -2
- package/dist/decoder-fallback.js +11 -3
- package/dist/decoder-stall.d.ts +15 -0
- package/dist/decoder-stall.js +52 -0
- package/dist/edit-data.d.ts +24 -0
- package/dist/edit-data.js +224 -0
- package/dist/edit-keys.d.ts +16 -0
- package/dist/edit-keys.js +233 -0
- package/dist/edit.d.ts +41 -8
- package/dist/edit.js +123 -30
- package/dist/export-failure.d.ts +10 -2
- package/dist/export-failure.js +55 -4
- package/dist/export-retry.d.ts +6 -1
- package/dist/export-retry.js +12 -1
- package/dist/exporter.d.ts +11 -7
- package/dist/exporter.js +10 -9
- package/dist/extensions.d.ts +86 -28
- package/dist/extensions.js +204 -61
- package/dist/extract.d.ts +65 -0
- package/dist/extract.js +291 -0
- package/dist/extractor.d.ts +151 -0
- package/dist/extractor.js +141 -0
- package/dist/float32.d.ts +2 -0
- package/dist/float32.js +10 -0
- package/dist/frame-intake.d.ts +5 -0
- package/dist/frame-intake.js +10 -3
- package/dist/generated/builtin-effects.d.ts +3 -0
- package/dist/generated/builtin-effects.js +1804 -0
- package/dist/generated/project-schema.d.ts +696 -41
- package/dist/generated/project-schema.js +67 -0
- package/dist/generated/project-shape.js +986 -383
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/json-text.js +14 -2
- package/dist/layout-values.js +7 -1
- package/dist/layout.d.ts +12 -4
- package/dist/media.d.ts +44 -11
- package/dist/media.js +256 -67
- package/dist/mediabunny.d.ts +32 -12
- package/dist/mediabunny.js +276 -90
- package/dist/player.d.ts +9 -3
- package/dist/player.js +114 -18
- package/dist/plugins.d.ts +62 -0
- package/dist/plugins.js +506 -0
- package/dist/project-data.d.ts +56 -0
- package/dist/project-data.js +765 -0
- package/dist/project.d.ts +36 -1
- package/dist/project.js +515 -42
- package/dist/robustness.d.ts +6 -33
- package/dist/robustness.js +2 -63
- package/dist/sha256.d.ts +3 -2
- package/dist/sha256.js +14 -6
- package/dist/wasm-module.d.ts +37 -0
- package/dist/wasm-module.js +47 -0
- package/dist/worker-error.d.ts +3 -2
- package/dist/worker-error.js +3 -1
- package/dist/worker.d.ts +13 -3
- package/dist/worker.js +36 -9
- package/package.json +36 -2
- package/wasm/alpha2_compose.d.ts +92 -0
- package/wasm/alpha2_compose.js +445 -0
- package/wasm/alpha2_compose_bg.wasm +0 -0
- package/wasm/alpha2_compose_bg.wasm.d.ts +17 -0
- package/wasm/alpha2_extensions.d.ts +4 -4
- package/wasm/alpha2_extensions.js +16 -4
- package/wasm/alpha2_extensions_bg.wasm +0 -0
- package/wasm/alpha2_extensions_pdf.d.ts +227 -0
- package/wasm/alpha2_extensions_pdf.js +841 -0
- package/wasm/alpha2_extensions_pdf_bg.wasm +0 -0
- package/wasm/alpha2_extensions_pdf_bg.wasm.d.ts +38 -0
- package/wasm/alpha2_wasm.d.ts +151 -18
- package/wasm/alpha2_wasm.js +403 -59
- package/wasm/alpha2_wasm_bg.wasm +0 -0
- package/wasm/alpha2_wasm_bg.wasm.d.ts +21 -6
- package/wasm/rust-crate-licenses.md +493 -54
- package/wasm/snippets/alpha2-wasm-1b02e9f302d283ba/inline3.js +7 -0
- /package/wasm/snippets/{alpha2-wasm-a21734ffde826659/inline1.js → alpha2-wasm-1b02e9f302d283ba/inline0.js} +0 -0
- /package/wasm/snippets/{alpha2-wasm-a21734ffde826659/inline2.js → alpha2-wasm-1b02e9f302d283ba/inline1.js} +0 -0
- /package/wasm/snippets/{alpha2-wasm-a21734ffde826659/inline3.js → alpha2-wasm-1b02e9f302d283ba/inline2.js} +0 -0
- /package/wasm/snippets/{alpha2-wasm-a21734ffde826659/inline0.js → alpha2-wasm-1b02e9f302d283ba/inline4.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./assets.js";
|
|
|
3
3
|
export * from "./audio-worklet.js";
|
|
4
4
|
export * from "./audio.js";
|
|
5
5
|
export * from "./audio-timeline.js";
|
|
6
|
+
export * from "./compose.js";
|
|
6
7
|
export * from "./audio-worker.js";
|
|
7
8
|
export * from "./containers.js";
|
|
8
9
|
export * from "./effects.js";
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./assets.js";
|
|
|
3
3
|
export * from "./audio-worklet.js";
|
|
4
4
|
export * from "./audio.js";
|
|
5
5
|
export * from "./audio-timeline.js";
|
|
6
|
+
export * from "./compose.js";
|
|
6
7
|
export * from "./audio-worker.js";
|
|
7
8
|
export * from "./containers.js";
|
|
8
9
|
export * from "./effects.js";
|
package/dist/json-text.js
CHANGED
|
@@ -90,8 +90,15 @@ export function readJsonText(json) {
|
|
|
90
90
|
skipSpace();
|
|
91
91
|
at += 1;
|
|
92
92
|
const [item, text] = readValue(depth + 1);
|
|
93
|
-
if (Object.hasOwn(object, key))
|
|
93
|
+
if (Object.hasOwn(object, key)) {
|
|
94
94
|
note(spelling.repeated, object, key);
|
|
95
|
+
// A fraction was not recorded on its own; for a repeated key every value counts.
|
|
96
|
+
const earlier = object[key];
|
|
97
|
+
if (typeof earlier === "number" &&
|
|
98
|
+
!Number.isInteger(earlier) &&
|
|
99
|
+
!spelling.numbers.get(object)?.has(key))
|
|
100
|
+
noteNumber(object, key, JSON.stringify(earlier));
|
|
101
|
+
}
|
|
95
102
|
// The engine reads every value of a repeated key, so each text counts.
|
|
96
103
|
if (text !== undefined)
|
|
97
104
|
noteNumber(object, key, text);
|
|
@@ -114,8 +121,13 @@ export function readJsonText(json) {
|
|
|
114
121
|
at += 1;
|
|
115
122
|
const token = json.slice(start, at);
|
|
116
123
|
const value = JSON.parse(token);
|
|
124
|
+
// Only integer fields read spellings, and a fraction already fails there by value, so a
|
|
125
|
+
// spelling is kept only for an integer the value alone does not show.
|
|
117
126
|
const unspelled = typeof value === "number" &&
|
|
118
|
-
|
|
127
|
+
Number.isInteger(value) &&
|
|
128
|
+
(/[.eE]/.test(token) ||
|
|
129
|
+
Object.is(value, -0) ||
|
|
130
|
+
!Number.isSafeInteger(value));
|
|
119
131
|
return [value, unspelled ? token : undefined];
|
|
120
132
|
};
|
|
121
133
|
try {
|
package/dist/layout-values.js
CHANGED
|
@@ -20,7 +20,13 @@ function tokens(text) {
|
|
|
20
20
|
}
|
|
21
21
|
/** Matches Rust's `trim_matches(' ')`: ASCII spaces only. */
|
|
22
22
|
function trimSpaces(text) {
|
|
23
|
-
|
|
23
|
+
let start = 0;
|
|
24
|
+
let end = text.length;
|
|
25
|
+
while (start < end && text.charCodeAt(start) === 32)
|
|
26
|
+
start += 1;
|
|
27
|
+
while (end > start && text.charCodeAt(end - 1) === 32)
|
|
28
|
+
end -= 1;
|
|
29
|
+
return text.slice(start, end);
|
|
24
30
|
}
|
|
25
31
|
function invalidLength(token, percent) {
|
|
26
32
|
const hint = token.includes(" ")
|
package/dist/layout.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* The output is a plain document; an unreadable CSS value string throws the parser's message.
|
|
10
10
|
*/
|
|
11
11
|
import type { PictureSize } from "./geometry.js";
|
|
12
|
-
import type { AlignContent, AlignItems,
|
|
12
|
+
import type { AlignContent, AlignItems, Keyframed, Display, FlexDirection, FlexWrap, Generator, GridAutoFlow, JustifyContent, LayoutNode, Overflow, Paint, Position, Rgba, ShapeItem, TextAlign, TextShadow, TextStroke, Ticks, Vec2 } from "./project.js";
|
|
13
13
|
/** The `WasmTextMeasurer` method {@link measureLayout} uses. */
|
|
14
14
|
export interface LayoutBinding {
|
|
15
15
|
measureLayout(generatorJson: string, width: number, height: number, time: number, canvasWidth?: number, canvasHeight?: number): string;
|
|
@@ -28,14 +28,22 @@ export interface NodeBounds {
|
|
|
28
28
|
readonly border: LayoutRect;
|
|
29
29
|
readonly content: LayoutRect;
|
|
30
30
|
/**
|
|
31
|
-
* Text is taller than the content box or splits a word, or
|
|
32
|
-
* padding box. Rendering draws it anyway
|
|
31
|
+
* Text (at its fitted size, once clamped) is taller than the content box or splits a word, or
|
|
32
|
+
* an in-flow child reaches past the padding box. Rendering draws it anyway, except a text box
|
|
33
|
+
* over 16,384 pixels a side, which the text host refuses and frames fail on.
|
|
33
34
|
*/
|
|
34
35
|
readonly overflow: boolean;
|
|
35
36
|
/** `null` for non-text nodes. */
|
|
36
37
|
readonly lineCount: number | null;
|
|
37
38
|
/** `null` for non-text nodes and empty text. */
|
|
38
39
|
readonly baselines: Baselines | null;
|
|
40
|
+
/**
|
|
41
|
+
* The font size drawn, fitted by `font_size_fit`, as a fraction of the picture's shorter side.
|
|
42
|
+
* `null` for non-text nodes.
|
|
43
|
+
*/
|
|
44
|
+
readonly fontSize: number | null;
|
|
45
|
+
/** `line_clamp` cut the text's lines. */
|
|
46
|
+
readonly truncated: boolean;
|
|
39
47
|
}
|
|
40
48
|
/** First and last alphabetic baselines, as fractions of the picture height. */
|
|
41
49
|
export interface Baselines {
|
|
@@ -56,7 +64,7 @@ export interface LayoutBounds {
|
|
|
56
64
|
* measurer has no fonts.
|
|
57
65
|
*/
|
|
58
66
|
export declare function measureLayout(binding: LayoutBinding, generator: Generator | LayoutNode, picture: PictureSize, time?: Ticks, canvas?: PictureSize): LayoutBounds;
|
|
59
|
-
export type Value<T> = T |
|
|
67
|
+
export type Value<T> = T | Keyframed<T>;
|
|
60
68
|
/** A fraction of the picture's shorter side, or `"12px"`. No percent. */
|
|
61
69
|
export type Size = number | `${number}px`;
|
|
62
70
|
/** A {@link Size}, or a percent of the parent's content box. */
|
package/dist/media.d.ts
CHANGED
|
@@ -5,11 +5,9 @@ export declare const ROUNDING_SCAN_FRAMES = 64;
|
|
|
5
5
|
/** Packet bytes (16 MiB) after which no more leading packets are read. */
|
|
6
6
|
export declare const ROUNDING_SCAN_BYTES: number;
|
|
7
7
|
/**
|
|
8
|
-
* The unit a stream's timestamps are rounded to, in units of its time resolution
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* for uniform or variable frame rates and for fewer than three distinct timestamps.
|
|
12
|
-
* Throws `RangeError` for a timestamp that is not a safe integer.
|
|
8
|
+
* The unit a stream's timestamps are rounded to, in units of its time resolution (1 for 29.97 fps
|
|
9
|
+
* in ms, whose frames last 33 and 34), or 0 when none shows. Mirrors the engine's
|
|
10
|
+
* `rounding_quantum`. Throws `RangeError` for a timestamp that is not a safe integer.
|
|
13
11
|
*/
|
|
14
12
|
export declare function roundingQuantum(timestamps: readonly number[]): number;
|
|
15
13
|
/**
|
|
@@ -86,7 +84,7 @@ export type ContainerBytes = Blob | ArrayBuffer | ArrayBufferView;
|
|
|
86
84
|
export declare function readVideoOrientation(container: ContainerBytes, trackId: number): Promise<VideoOrientation | undefined>;
|
|
87
85
|
/**
|
|
88
86
|
* The `CodecDelay` a Matroska or WebM file declares for track `trackId` (mediabunny's
|
|
89
|
-
* `InputTrack.id`), in nanoseconds
|
|
87
|
+
* `InputTrack.id`), in nanoseconds, or 0 when none or malformed. mediabunny does not subtract it.
|
|
90
88
|
*/
|
|
91
89
|
export declare function readMatroskaCodecDelay(container: ContainerBytes, trackId: number): Promise<number>;
|
|
92
90
|
/** A demuxer-independent encoded video source consumed by WebCodecs. */
|
|
@@ -143,7 +141,7 @@ export interface BrowserVideoDecoderOptions {
|
|
|
143
141
|
/** Loudspeaker by `FFmpeg` channel name. `UNK` planes (unknown, ambisonic) are not mixed. */
|
|
144
142
|
export type AudioSpeaker = "FL" | "FR" | "FC" | "LFE" | "BL" | "BR" | "FLC" | "FRC" | "BC" | "SL" | "SR" | "TC" | "TFL" | "TFC" | "TFR" | "TBL" | "TBC" | "TBR" | "DL" | "DR" | "WL" | "WR" | "SDL" | "SDR" | "LFE2" | "TSL" | "TSR" | "BFC" | "BFL" | "BFR" | "SSL" | "SSR" | "TTL" | "TTR" | "BIL" | "BIR" | "UNK";
|
|
145
143
|
/** A 22.2 layout's 24; sources with more are refused. */
|
|
146
|
-
export
|
|
144
|
+
export { MAX_AUDIO_CHANNELS } from "./generated/project-schema.js";
|
|
147
145
|
/** Owned project-rate planar audio returned by browser adapters. */
|
|
148
146
|
export interface BrowserAudioBlock {
|
|
149
147
|
readonly sourceId: string;
|
|
@@ -183,7 +181,9 @@ export declare class WebCodecsVideoDecoder implements BrowserVideoDecoder {
|
|
|
183
181
|
get reverseCacheHits(): number;
|
|
184
182
|
/**
|
|
185
183
|
* A decoder failure retries once from the keyframe with `"prefer-software"`. If that fails too,
|
|
186
|
-
* rejects with `DecodeUnavailableError` when no frame was ever decoded, else with the failure
|
|
184
|
+
* rejects with `DecodeUnavailableError` when no frame was ever decoded, else with the failure,
|
|
185
|
+
* and the next request decodes with the configured acceleration. A `device-recovery` request
|
|
186
|
+
* also returns a decoder that fell back to that acceleration.
|
|
187
187
|
*/
|
|
188
188
|
refill(request: DecoderRefillRequest, signal?: AbortSignal): Promise<BrowserDecodedFrame>;
|
|
189
189
|
flush(): Promise<void>;
|
|
@@ -193,8 +193,26 @@ export declare class WebCodecsVideoDecoder implements BrowserVideoDecoder {
|
|
|
193
193
|
export interface DecoderRefillCoordinatorOptions {
|
|
194
194
|
/** Concurrent refills across sources (default 2). */
|
|
195
195
|
readonly maxConcurrency?: number;
|
|
196
|
-
/**
|
|
197
|
-
|
|
196
|
+
/**
|
|
197
|
+
* Decoder cursors kept open across all sources (default 16). Past it the least recently used
|
|
198
|
+
* cursor that is neither refilling nor retained closes; when none can, the budget is exceeded.
|
|
199
|
+
*/
|
|
200
|
+
readonly maxCursors?: number;
|
|
201
|
+
/**
|
|
202
|
+
* Active milliseconds without a request after which a cursor drops its decode position and
|
|
203
|
+
* cached frames, keeping the file open (default 2000).
|
|
204
|
+
*/
|
|
205
|
+
readonly idleMs?: number;
|
|
206
|
+
}
|
|
207
|
+
/** Counters of a {@link DecoderRefillCoordinator}'s cursor budget. */
|
|
208
|
+
export interface DecoderRefillDiagnostics {
|
|
209
|
+
readonly openCursors: number;
|
|
210
|
+
/** Cursors closed to stay within `maxCursors`. */
|
|
211
|
+
readonly evictions: number;
|
|
212
|
+
/** Cursors flushed after `idleMs` without a request. */
|
|
213
|
+
readonly idleFlushes: number;
|
|
214
|
+
/** Times a cursor opened while every open one was refilling or retained. */
|
|
215
|
+
readonly overBudget: number;
|
|
198
216
|
}
|
|
199
217
|
/** What a {@link DecoderRefillCoordinator} asks its opener for. */
|
|
200
218
|
export interface DecoderOpenOptions {
|
|
@@ -204,7 +222,8 @@ export interface DecoderOpenOptions {
|
|
|
204
222
|
/**
|
|
205
223
|
* Runs refills on decoders it opens, one per source and consumer (plus one for software), with
|
|
206
224
|
* one refill per source at a time and at most `maxConcurrency` overall. A newer generation aborts
|
|
207
|
-
* requests in flight and closes their frames instead of delivering them.
|
|
225
|
+
* requests in flight and closes their frames instead of delivering them. At most `maxCursors`
|
|
226
|
+
* decoders stay open across sources, and a cursor idle for `idleMs` releases its decoder's frames.
|
|
208
227
|
*/
|
|
209
228
|
export declare class DecoderRefillCoordinator {
|
|
210
229
|
#private;
|
|
@@ -215,6 +234,16 @@ export declare class DecoderRefillCoordinator {
|
|
|
215
234
|
constructor(open: (sourceId: string, options: DecoderOpenOptions) => BrowserVideoDecoder | Promise<BrowserVideoDecoder>, deliver: (frame: BrowserDecodedFrame) => Promise<void>, options?: DecoderRefillCoordinatorOptions);
|
|
216
235
|
/** Aborts requests in flight and returns the new generation number. */
|
|
217
236
|
beginGeneration(): number;
|
|
237
|
+
/**
|
|
238
|
+
* Declares the cursors of the current round, replacing the previous set; retained cursors are
|
|
239
|
+
* never closed for the budget. A cursor is a source and a `consumerId` (absent is the source's
|
|
240
|
+
* own), in both decode kinds.
|
|
241
|
+
*/
|
|
242
|
+
retain(cursors: Iterable<{
|
|
243
|
+
readonly sourceId: string;
|
|
244
|
+
readonly consumerId?: string;
|
|
245
|
+
}>): void;
|
|
246
|
+
get diagnostics(): DecoderRefillDiagnostics;
|
|
218
247
|
/**
|
|
219
248
|
* Resolves without delivering when the request's generation is superseded; rejects with the
|
|
220
249
|
* decoder's, delivery's or abort's error, and once closed.
|
|
@@ -222,6 +251,10 @@ export declare class DecoderRefillCoordinator {
|
|
|
222
251
|
refill(request: DecoderRefillRequest): Promise<void>;
|
|
223
252
|
close(): void;
|
|
224
253
|
}
|
|
254
|
+
/** Decoder cursors a {@link DecoderRefillCoordinator} keeps open by default. */
|
|
255
|
+
export declare const DEFAULT_MAX_DECODER_CURSORS = 16;
|
|
256
|
+
/** Active milliseconds after which an unrequested cursor is flushed by default. */
|
|
257
|
+
export declare const DEFAULT_DECODER_IDLE_MS = 2000;
|
|
225
258
|
/** Shape used to wrap mediabunny without importing its types into alpha2. */
|
|
226
259
|
export interface OptionalMediaAdapterFactory {
|
|
227
260
|
openVideo(sourceId: string, input: unknown): Promise<BrowserVideoDecoder>;
|