alpha2 0.5.2 → 0.5.3
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 +3 -2
- package/THIRD_PARTY_NOTICES.md +186 -0
- package/dist/extensions.d.ts +86 -28
- package/dist/extensions.js +204 -61
- package/dist/generated/project-schema.d.ts +60 -4
- package/dist/generated/project-schema.js +12 -0
- package/dist/generated/project-shape.js +34 -0
- package/dist/media.d.ts +1 -1
- package/dist/media.js +1 -1
- package/dist/project.d.ts +12 -0
- package/dist/project.js +60 -5
- package/dist/wasm-module.d.ts +37 -0
- package/dist/wasm-module.js +47 -0
- package/package.json +11 -2
- 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.js +18 -18
- package/wasm/alpha2_wasm_bg.wasm +0 -0
- package/wasm/rust-crate-licenses.md +499 -4
- /package/wasm/snippets/{alpha2-wasm-a21734ffde826659 → alpha2-wasm-a6265983c9769e80}/inline0.js +0 -0
- /package/wasm/snippets/{alpha2-wasm-a21734ffde826659 → alpha2-wasm-a6265983c9769e80}/inline1.js +0 -0
- /package/wasm/snippets/{alpha2-wasm-a21734ffde826659 → alpha2-wasm-a6265983c9769e80}/inline2.js +0 -0
- /package/wasm/snippets/{alpha2-wasm-a21734ffde826659 → alpha2-wasm-a6265983c9769e80}/inline3.js +0 -0
package/dist/project.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Timeline values are integer ticks at {@link TICKS_PER_SECOND}. Ranges are half-open.
|
|
9
9
|
*/
|
|
10
10
|
import { parseHex, parseInsets, parseLength, parseOffset, parsePlacement, parseSize, parseTrackList, } from "./layout-values.js";
|
|
11
|
-
import { AUDIO_EFFECT_STATE_MARGIN_MS, MAX_CANVAS_DIMENSION, MAX_CANVAS_PIXELS, MAX_TEXT_CONTENT_BYTES, MAX_FONT_FAMILY_BYTES, MAX_COMPOSITIONS, MAX_COMPOSITION_NODES, MAX_COMPOSITION_CONTROLS, MAX_COMPOSITION_DEPTH, MAX_GROUP_INPUTS, MAX_EFFECT_INPUTS, MAX_FRAME_INLINED_NODES, MAX_INLINED_NODES, MAX_MERGE_LAYERS, MAX_CLIP_MASKS, MAX_DASH_ENTRIES, MAX_GRADIENT_STOPS, MAX_PATH_SUBPATHS, MAX_PATH_VERTICES, MAX_POLYSTAR_POINTS, MAX_SHAPE_DEPTH, MAX_SHAPE_ITEMS, MAX_LAYOUT_DEPTH, MAX_LAYOUT_FONT_SIZE, MAX_LAYOUT_ISOLATED, MAX_LAYOUT_NODES, MAX_LAYOUT_TEXTS, MAX_GRID_TRACKS, MIN_POLYSTAR_POINTS, MAX_CLIPS, MAX_CLIPS_PER_TRACK, MAX_AUDIO_DELAY_MS, MAX_AUDIO_EFFECTS, MAX_CAPTION_FONT_SIZE, MAX_CAPTION_NAME_BYTES, MAX_CAPTION_STYLES, MAX_TEXT_GENERATOR_FONT_SIZE, MAX_FONT_WEIGHT, MAX_LETTER_SPACING, MAX_LINE_HEIGHT, MAX_TEXT_PADDING, MAX_ANIMATOR_SCALE, MAX_CLASS_NAME_BYTES, MAX_RANGE_INDEX, MAX_RANGE_PERCENT, MAX_RUN_CLASSES, MAX_TEXT_ANIMATORS, MAX_TEXT_RUNS, MIN_RANGE_PERCENT, MAX_TEXT_SHADOW_BLUR, MAX_TEXT_SHADOW_OFFSET, MAX_TEXT_SHADOWS, MAX_TEXT_STROKE_EXTENT, MAX_TEXT_STROKES, MAX_CHAIN_EFFECTS, MAX_COMPRESSOR_RATIO, MAX_ENVELOPE_MS, MAX_EQ_BANDS, MAX_LOOKAHEAD_MS, MIN_FONT_WEIGHT, MIN_LETTER_SPACING, MIN_LINE_HEIGHT, MIN_LEVEL_DB, MAX_EQ_FREQUENCY_HZ, MAX_EQ_GAIN_DB, MAX_EQ_Q, MAX_GAIN, MAX_PROJECT_JSON_BYTES, MAX_SAMPLE_RATE, MAX_TRACKS, MAX_TRANSITIONS_PER_TRACK, MIN_EQ_FREQUENCY_HZ, MIN_EQ_Q, MIN_SAMPLE_RATE, MIN_HDR_PEAK_NITS, MAX_HDR_PEAK_NITS, MAX_SEQUENCE_FRAMES, REVERB_DELAY_MS, TICKS_PER_SECOND, } from "./generated/project-schema.js";
|
|
11
|
+
import { AUDIO_EFFECT_STATE_MARGIN_MS, MAX_CANVAS_DIMENSION, MAX_CANVAS_PIXELS, MAX_TEXT_CONTENT_BYTES, MAX_FONT_FAMILY_BYTES, MAX_COMPOSITIONS, MAX_COMPOSITION_NODES, MAX_COMPOSITION_CONTROLS, MAX_COMPOSITION_DEPTH, MAX_GROUP_INPUTS, MAX_EFFECT_INPUTS, MAX_FRAME_INLINED_NODES, MAX_INLINED_NODES, MAX_MERGE_LAYERS, MAX_CLIP_MASKS, MAX_DASH_ENTRIES, MAX_GRADIENT_STOPS, MAX_PATH_SUBPATHS, MAX_PATH_VERTICES, MAX_POLYSTAR_POINTS, MAX_SHAPE_DEPTH, MAX_SHAPE_ITEMS, MAX_LAYOUT_DEPTH, MAX_LAYOUT_FONT_SIZE, MAX_LAYOUT_ISOLATED, MAX_LAYOUT_NODES, MAX_LAYOUT_TEXTS, MAX_GRID_TRACKS, MIN_POLYSTAR_POINTS, MAX_CLIPS, MAX_CLIPS_PER_TRACK, MAX_AUDIO_DELAY_MS, MAX_AUDIO_EFFECTS, MAX_CAPTION_FONT_SIZE, MAX_CAPTION_NAME_BYTES, MAX_CAPTION_STYLES, MAX_TEXT_GENERATOR_FONT_SIZE, MAX_FONT_WEIGHT, MAX_LETTER_SPACING, MAX_LINE_HEIGHT, MAX_TEXT_PADDING, MAX_ANIMATOR_SCALE, MAX_CLASS_NAME_BYTES, MAX_RANGE_INDEX, MAX_RANGE_PERCENT, MAX_RUN_CLASSES, MAX_TEXT_ANIMATORS, MAX_TEXT_RUNS, MIN_RANGE_PERCENT, MAX_TEXT_SHADOW_BLUR, MAX_TEXT_SHADOW_OFFSET, MAX_TEXT_SHADOWS, MAX_TEXT_STROKE_EXTENT, MAX_TEXT_STROKES, MAX_CHAIN_EFFECTS, MAX_COMPRESSOR_RATIO, MAX_ENVELOPE_MS, MAX_EQ_BANDS, MAX_LOOKAHEAD_MS, MIN_FONT_WEIGHT, MIN_LETTER_SPACING, MIN_LINE_HEIGHT, MIN_LEVEL_DB, MAX_EQ_FREQUENCY_HZ, MAX_EQ_GAIN_DB, MAX_EQ_Q, MAX_GAIN, MAX_PROJECT_JSON_BYTES, MAX_SAMPLE_RATE, MAX_TRACKS, MAX_TRANSITIONS_PER_TRACK, MIN_EQ_FREQUENCY_HZ, MIN_EQ_Q, MIN_SAMPLE_RATE, MIN_HDR_PEAK_NITS, MAX_HDR_PEAK_NITS, MAX_SEQUENCE_FRAMES, MAX_SELECTED_CHANNELS, MAX_AUDIO_CHANNELS, MAX_LATEX_BYTES, MAX_LATEX_FONT_SIZE, MAX_PDF_PAGES, REVERB_DELAY_MS, TICKS_PER_SECOND, } from "./generated/project-schema.js";
|
|
12
12
|
import { PROJECT_SHAPE } from "./generated/project-shape.js";
|
|
13
13
|
import { MAX_JSON_DEPTH, hasLoneSurrogate, readJsonText, } from "./json-text.js";
|
|
14
14
|
export * from "./generated/project-schema.js";
|
|
@@ -253,6 +253,14 @@ function catalogOf(sourceList, resourceList, compositionList, canvas) {
|
|
|
253
253
|
else if (source.generator != null) {
|
|
254
254
|
problems.push(`source ${sourceId} has an invalid generator`);
|
|
255
255
|
}
|
|
256
|
+
else if (isRecord(source.provider) &&
|
|
257
|
+
typeof source.provider.format === "string" &&
|
|
258
|
+
!providerReadsFile({ format: source.provider.format })) {
|
|
259
|
+
// Mirrors `validate_fileless_source`.
|
|
260
|
+
if (text(source.locator).length > 0 || source.fingerprint != null) {
|
|
261
|
+
problems.push(`source ${sourceId} has an invalid provider`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
256
264
|
else if (text(source.locator).length === 0) {
|
|
257
265
|
problems.push(`source ${sourceId} has an empty locator`);
|
|
258
266
|
}
|
|
@@ -1549,8 +1557,21 @@ function audioProblems(clipId, audio) {
|
|
|
1549
1557
|
if (!validEffects(audio.effects)) {
|
|
1550
1558
|
problems.push(`clip ${clipId} has invalid audio effects`);
|
|
1551
1559
|
}
|
|
1560
|
+
if (audio.channels != null && !validChannelSelection(audio.channels)) {
|
|
1561
|
+
problems.push(`clip ${clipId} has invalid audio properties`);
|
|
1562
|
+
}
|
|
1552
1563
|
return problems;
|
|
1553
1564
|
}
|
|
1565
|
+
/** Mirrors `valid_channel_selection`: one or two distinct stream channels, each in range. */
|
|
1566
|
+
function validChannelSelection(channels) {
|
|
1567
|
+
return (Array.isArray(channels) &&
|
|
1568
|
+
channels.length >= 1 &&
|
|
1569
|
+
channels.length <= MAX_SELECTED_CHANNELS &&
|
|
1570
|
+
channels.every((channel) => Number.isInteger(channel) &&
|
|
1571
|
+
channel >= 0 &&
|
|
1572
|
+
channel < MAX_AUDIO_CHANNELS) &&
|
|
1573
|
+
channels[0] !== channels[1]);
|
|
1574
|
+
}
|
|
1554
1575
|
// Composition time is largest at the clip's last instant: `offset + floor((end - 1 - start) *
|
|
1555
1576
|
// num / den)`, which must fit a safe integer.
|
|
1556
1577
|
function compositionTimeHeld(clip, reference, scale) {
|
|
@@ -2221,6 +2242,20 @@ function validFontWeight(weight) {
|
|
|
2221
2242
|
weight >= MIN_FONT_WEIGHT &&
|
|
2222
2243
|
weight <= MAX_FONT_WEIGHT);
|
|
2223
2244
|
}
|
|
2245
|
+
/**
|
|
2246
|
+
* Whether a provider reads a file of the source's own. One that does not, such as LaTeX, holds its
|
|
2247
|
+
* content in its settings, so its source has an empty locator and no fingerprint. Mirrors
|
|
2248
|
+
* `ProviderSource::reads_file`.
|
|
2249
|
+
*/
|
|
2250
|
+
export function providerReadsFile(provider) {
|
|
2251
|
+
return provider.format !== "latex";
|
|
2252
|
+
}
|
|
2253
|
+
/** The kind of source a provider's media is. Mirrors `ProviderSource::kind`. */
|
|
2254
|
+
export function providerKind(provider) {
|
|
2255
|
+
return ["svg", "exr", "latex", "pdf"].includes(provider.format)
|
|
2256
|
+
? "image"
|
|
2257
|
+
: "video";
|
|
2258
|
+
}
|
|
2224
2259
|
/** Mirrors `ProviderSource::kind` and `ProviderSource::is_valid`. */
|
|
2225
2260
|
function validProvider(provider, kind) {
|
|
2226
2261
|
if (!isRecord(provider))
|
|
@@ -2229,6 +2264,27 @@ function validProvider(provider, kind) {
|
|
|
2229
2264
|
return kind === "image";
|
|
2230
2265
|
if (provider.format === "animated_image")
|
|
2231
2266
|
return kind === "video";
|
|
2267
|
+
if (provider.format === "latex") {
|
|
2268
|
+
const { latex, font_size: size, color } = provider;
|
|
2269
|
+
return (kind === "image" &&
|
|
2270
|
+
typeof latex === "string" &&
|
|
2271
|
+
latex.length > 0 &&
|
|
2272
|
+
new TextEncoder().encode(latex).length <= MAX_LATEX_BYTES &&
|
|
2273
|
+
finiteNumber(size) &&
|
|
2274
|
+
size > 0 &&
|
|
2275
|
+
size <= MAX_LATEX_FONT_SIZE &&
|
|
2276
|
+
(color == null || validRgba(color)) &&
|
|
2277
|
+
(provider.display == null || typeof provider.display === "boolean"));
|
|
2278
|
+
}
|
|
2279
|
+
if (provider.format === "pdf") {
|
|
2280
|
+
const { page, background } = provider;
|
|
2281
|
+
return (kind === "image" &&
|
|
2282
|
+
(page == null ||
|
|
2283
|
+
(Number.isInteger(page) &&
|
|
2284
|
+
page >= 1 &&
|
|
2285
|
+
page <= MAX_PDF_PAGES)) &&
|
|
2286
|
+
(background == null || validRgba(background)));
|
|
2287
|
+
}
|
|
2232
2288
|
if (provider.format === "lottie")
|
|
2233
2289
|
return (kind === "video" &&
|
|
2234
2290
|
(provider.animation == null ||
|
|
@@ -3203,8 +3259,8 @@ function frameEdges(track, sources, inlined) {
|
|
|
3203
3259
|
}
|
|
3204
3260
|
return edges;
|
|
3205
3261
|
}
|
|
3206
|
-
// Mirrors the model's per-frame inlined node bound
|
|
3207
|
-
//
|
|
3262
|
+
// Mirrors the model's per-frame inlined node bound and reports the first clip at the first
|
|
3263
|
+
// instant past it.
|
|
3208
3264
|
function frameNodesOver(tracks) {
|
|
3209
3265
|
const edges = tracks.flat();
|
|
3210
3266
|
// Ends sort before starts at one instant (half-open ranges); stable sort keeps document order.
|
|
@@ -3474,8 +3530,7 @@ function matteProblems(tracks) {
|
|
|
3474
3530
|
return problems;
|
|
3475
3531
|
}
|
|
3476
3532
|
// Tracks whose ducking sidechain leads back to themselves. Each track names at most one sidechain,
|
|
3477
|
-
// so each step is visited once over all walks.
|
|
3478
|
-
// engine.
|
|
3533
|
+
// so each step is visited once over all walks. A repeated id means its first track, as in Rust.
|
|
3479
3534
|
function duckingCycles(tracks) {
|
|
3480
3535
|
const sidechains = new Map();
|
|
3481
3536
|
for (const track of tracks) {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads a wasm-bindgen module once per realm and replaces its instance after a trap, always
|
|
3
|
+
* asynchronously, since browsers refuse to instantiate a large module synchronously.
|
|
4
|
+
*/
|
|
5
|
+
/** The parts of wasm-bindgen `web` glue a {@link WasmModule} uses. */
|
|
6
|
+
export interface WasmBindgenGlue {
|
|
7
|
+
/** The glue's asynchronous init; it reuses a finished instance. */
|
|
8
|
+
default(input?: {
|
|
9
|
+
module_or_path: string | URL;
|
|
10
|
+
}): Promise<unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Replaces the instance from the compiled module, invalidating objects made before. Present
|
|
13
|
+
* when the glue is built to restart (the extension provider module).
|
|
14
|
+
*/
|
|
15
|
+
__wbg_reset_state_async?(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* One wasm-bindgen module. `importGlue` imports its glue, so a bundler sees a static specifier.
|
|
19
|
+
*/
|
|
20
|
+
export declare class WasmModule<Glue extends WasmBindgenGlue> {
|
|
21
|
+
#private;
|
|
22
|
+
constructor(importGlue: () => Promise<Glue>);
|
|
23
|
+
/**
|
|
24
|
+
* The loaded glue. `wasmUrl` locates the `.wasm` file when a bundler moved it, for the first
|
|
25
|
+
* load only. Concurrent calls share one load, and the next call retries a failed one.
|
|
26
|
+
*
|
|
27
|
+
* @throws When the module cannot be fetched, compiled or instantiated.
|
|
28
|
+
*/
|
|
29
|
+
load(wasmUrl?: string | URL): Promise<Glue>;
|
|
30
|
+
/**
|
|
31
|
+
* Replaces the instance with a new one from the compiled module. Objects made from the old
|
|
32
|
+
* instance throw when used.
|
|
33
|
+
*
|
|
34
|
+
* @throws When the module is not loaded, its glue cannot restart, or instantiation fails.
|
|
35
|
+
*/
|
|
36
|
+
restart(): Promise<void>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads a wasm-bindgen module once per realm and replaces its instance after a trap, always
|
|
3
|
+
* asynchronously, since browsers refuse to instantiate a large module synchronously.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* One wasm-bindgen module. `importGlue` imports its glue, so a bundler sees a static specifier.
|
|
7
|
+
*/
|
|
8
|
+
export class WasmModule {
|
|
9
|
+
#importGlue;
|
|
10
|
+
#loading = null;
|
|
11
|
+
#glue = null;
|
|
12
|
+
constructor(importGlue) {
|
|
13
|
+
this.#importGlue = importGlue;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The loaded glue. `wasmUrl` locates the `.wasm` file when a bundler moved it, for the first
|
|
17
|
+
* load only. Concurrent calls share one load, and the next call retries a failed one.
|
|
18
|
+
*
|
|
19
|
+
* @throws When the module cannot be fetched, compiled or instantiated.
|
|
20
|
+
*/
|
|
21
|
+
load(wasmUrl) {
|
|
22
|
+
this.#loading ??= (async () => {
|
|
23
|
+
const glue = await this.#importGlue();
|
|
24
|
+
await glue.default(wasmUrl === undefined ? undefined : { module_or_path: wasmUrl });
|
|
25
|
+
this.#glue = glue;
|
|
26
|
+
return glue;
|
|
27
|
+
})().catch((error) => {
|
|
28
|
+
this.#loading = null;
|
|
29
|
+
throw error;
|
|
30
|
+
});
|
|
31
|
+
return this.#loading;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Replaces the instance with a new one from the compiled module. Objects made from the old
|
|
35
|
+
* instance throw when used.
|
|
36
|
+
*
|
|
37
|
+
* @throws When the module is not loaded, its glue cannot restart, or instantiation fails.
|
|
38
|
+
*/
|
|
39
|
+
async restart() {
|
|
40
|
+
const glue = this.#glue;
|
|
41
|
+
if (glue === null)
|
|
42
|
+
throw new Error("the wasm module is not loaded");
|
|
43
|
+
if (glue.__wbg_reset_state_async === undefined)
|
|
44
|
+
throw new Error("the wasm module is not built to restart");
|
|
45
|
+
await glue.__wbg_reset_state_async();
|
|
46
|
+
}
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alpha2",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "JavaScript bindings for the standalone alpha2 media engine.",
|
|
6
6
|
"repository": {
|
|
@@ -89,6 +89,10 @@
|
|
|
89
89
|
"types": "./dist/extensions.d.ts",
|
|
90
90
|
"import": "./dist/extensions.js"
|
|
91
91
|
},
|
|
92
|
+
"./wasm-module": {
|
|
93
|
+
"types": "./dist/wasm-module.d.ts",
|
|
94
|
+
"import": "./dist/wasm-module.js"
|
|
95
|
+
},
|
|
92
96
|
"./hdr-frames": {
|
|
93
97
|
"types": "./dist/hdr-frames.d.ts",
|
|
94
98
|
"import": "./dist/hdr-frames.js"
|
|
@@ -187,7 +191,12 @@
|
|
|
187
191
|
"types": "./wasm/alpha2_extensions.d.ts",
|
|
188
192
|
"import": "./wasm/alpha2_extensions.js"
|
|
189
193
|
},
|
|
190
|
-
"./wasm/alpha2_extensions_bg.wasm": "./wasm/alpha2_extensions_bg.wasm"
|
|
194
|
+
"./wasm/alpha2_extensions_bg.wasm": "./wasm/alpha2_extensions_bg.wasm",
|
|
195
|
+
"./extensions-pdf-wasm": {
|
|
196
|
+
"types": "./wasm/alpha2_extensions_pdf.d.ts",
|
|
197
|
+
"import": "./wasm/alpha2_extensions_pdf.js"
|
|
198
|
+
},
|
|
199
|
+
"./wasm/alpha2_extensions_pdf_bg.wasm": "./wasm/alpha2_extensions_pdf_bg.wasm"
|
|
191
200
|
},
|
|
192
201
|
"files": [
|
|
193
202
|
"dist",
|
|
@@ -32,8 +32,8 @@ export class ExtensionRegistry {
|
|
|
32
32
|
*/
|
|
33
33
|
openNeeds(provider: string): string;
|
|
34
34
|
/**
|
|
35
|
-
* Opens a provider source (JSON) with its bytes (none for an image sequence) and
|
|
36
|
-
* handle.
|
|
35
|
+
* Opens a provider source (JSON) with its bytes (none for an image sequence or LaTeX) and
|
|
36
|
+
* returns a handle.
|
|
37
37
|
*
|
|
38
38
|
* # Errors
|
|
39
39
|
* If the source cannot be opened.
|
|
@@ -131,8 +131,7 @@ export class RenderedFrame {
|
|
|
131
131
|
*/
|
|
132
132
|
readonly endTicks: bigint | undefined;
|
|
133
133
|
/**
|
|
134
|
-
* Premultiplied linear-light RGBA half-float bits
|
|
135
|
-
* another precision.
|
|
134
|
+
* Premultiplied linear-light RGBA half-float bits (BT.709, rows packed), empty for RGBA8.
|
|
136
135
|
*/
|
|
137
136
|
readonly halfPixels: Uint16Array;
|
|
138
137
|
/**
|
|
@@ -225,3 +224,4 @@ export function initSync(module: { module: SyncInitInput } | SyncInitInput): Ini
|
|
|
225
224
|
* @returns {Promise<InitOutput>}
|
|
226
225
|
*/
|
|
227
226
|
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
227
|
+
export function __wbg_reset_state_async(): Promise<void>;
|
|
@@ -108,8 +108,8 @@ export class ExtensionRegistry {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
|
-
* Opens a provider source (JSON) with its bytes (none for an image sequence) and
|
|
112
|
-
* handle.
|
|
111
|
+
* Opens a provider source (JSON) with its bytes (none for an image sequence or LaTeX) and
|
|
112
|
+
* returns a handle.
|
|
113
113
|
*
|
|
114
114
|
* # Errors
|
|
115
115
|
* If the source cannot be opened.
|
|
@@ -446,8 +446,7 @@ export class RenderedFrame {
|
|
|
446
446
|
return ret[0] === 0 ? undefined : ret[1];
|
|
447
447
|
}
|
|
448
448
|
/**
|
|
449
|
-
* Premultiplied linear-light RGBA half-float bits
|
|
450
|
-
* another precision.
|
|
449
|
+
* Premultiplied linear-light RGBA half-float bits (BT.709, rows packed), empty for RGBA8.
|
|
451
450
|
* @returns {Uint16Array}
|
|
452
451
|
*/
|
|
453
452
|
get halfPixels() {
|
|
@@ -827,3 +826,16 @@ async function __wbg_init(module_or_path) {
|
|
|
827
826
|
}
|
|
828
827
|
|
|
829
828
|
export { initSync, __wbg_init as default };
|
|
829
|
+
|
|
830
|
+
export async function __wbg_reset_state_async () {
|
|
831
|
+
const instance = await WebAssembly.instantiate(wasmModule, __wbg_get_imports());
|
|
832
|
+
__wbg_instance_id++;
|
|
833
|
+
cachedUint16ArrayMemory0 = null;
|
|
834
|
+
cachedUint8ArrayMemory0 = null;
|
|
835
|
+
if (typeof numBytesDecoded !== 'undefined') numBytesDecoded = 0;
|
|
836
|
+
if (typeof WASM_VECTOR_LEN !== 'undefined') WASM_VECTOR_LEN = 0;
|
|
837
|
+
__wbg_reinit_scheduled = false;
|
|
838
|
+
wasmInstance = instance;
|
|
839
|
+
wasm = wasmInstance.exports;
|
|
840
|
+
wasm.__wbindgen_start();
|
|
841
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The providers this module was built with, and the sources a page opened.
|
|
6
|
+
*
|
|
7
|
+
* Failures are thrown as plain string messages, not `Error` objects.
|
|
8
|
+
*/
|
|
9
|
+
export class ExtensionRegistry {
|
|
10
|
+
free(): void;
|
|
11
|
+
[Symbol.dispose](): void;
|
|
12
|
+
/**
|
|
13
|
+
* Forgets every registered font; open sources keep theirs.
|
|
14
|
+
*/
|
|
15
|
+
clearFonts(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Locators rendering at a source tick reads that the source does not hold, as a JSON array.
|
|
18
|
+
*
|
|
19
|
+
* # Errors
|
|
20
|
+
* When the handle is not open.
|
|
21
|
+
*/
|
|
22
|
+
needs(handle: number, time_ticks: bigint): string;
|
|
23
|
+
/**
|
|
24
|
+
* Every provider this module was built with.
|
|
25
|
+
*/
|
|
26
|
+
constructor();
|
|
27
|
+
/**
|
|
28
|
+
* Locators opening a provider source (JSON) reads, as a JSON array.
|
|
29
|
+
*
|
|
30
|
+
* # Errors
|
|
31
|
+
* When the provider source is not valid JSON.
|
|
32
|
+
*/
|
|
33
|
+
openNeeds(provider: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Opens a provider source (JSON) with its bytes (none for an image sequence or LaTeX) and
|
|
36
|
+
* returns a handle.
|
|
37
|
+
*
|
|
38
|
+
* # Errors
|
|
39
|
+
* If the source cannot be opened.
|
|
40
|
+
*/
|
|
41
|
+
open(provider: string, bytes?: Uint8Array | null): number;
|
|
42
|
+
/**
|
|
43
|
+
* The first claiming provider's result as JSON `{ provider, report }`, or `undefined`.
|
|
44
|
+
*
|
|
45
|
+
* # Errors
|
|
46
|
+
* If a claiming provider cannot read the bytes.
|
|
47
|
+
*/
|
|
48
|
+
probe(bytes: Uint8Array): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* The providers' names, in priority order, as a JSON array.
|
|
51
|
+
*/
|
|
52
|
+
providers(): string;
|
|
53
|
+
/**
|
|
54
|
+
* A handle to another independently positioned reader that shares the source's decoded
|
|
55
|
+
* data. It stays valid after the original is closed. `undefined` when any time is equally
|
|
56
|
+
* cheap to draw, so the page should share the source.
|
|
57
|
+
*
|
|
58
|
+
* # Errors
|
|
59
|
+
* When the handle is not open.
|
|
60
|
+
*/
|
|
61
|
+
reader(handle: number): number | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Registers a font for SVG text. Sources read fonts when they open.
|
|
64
|
+
*/
|
|
65
|
+
registerFont(bytes: Uint8Array): void;
|
|
66
|
+
/**
|
|
67
|
+
* Registers bytes under a locator. Sources read them only during open or render, so a page
|
|
68
|
+
* may register them just for that call (see [`Self::needs`]).
|
|
69
|
+
*/
|
|
70
|
+
registerResource(locator: string, bytes: Uint8Array): void;
|
|
71
|
+
/**
|
|
72
|
+
* Forgets the bytes registered under a locator.
|
|
73
|
+
*/
|
|
74
|
+
releaseResource(locator: string): void;
|
|
75
|
+
/**
|
|
76
|
+
* Closes a source.
|
|
77
|
+
*/
|
|
78
|
+
release(handle: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* The frame at a source tick. Vector sources rasterize to fit `fit_width` by `fit_height`
|
|
81
|
+
* (0 by 0 for their own size).
|
|
82
|
+
*
|
|
83
|
+
* # Errors
|
|
84
|
+
* When the handle is not open or the frame cannot be produced.
|
|
85
|
+
*/
|
|
86
|
+
render(handle: number, time_ticks: bigint, fit_width: number, fit_height: number): RenderedFrame;
|
|
87
|
+
/**
|
|
88
|
+
* What an opened source is, as JSON.
|
|
89
|
+
*
|
|
90
|
+
* # Errors
|
|
91
|
+
* When the handle is not open.
|
|
92
|
+
*/
|
|
93
|
+
report(handle: number): string;
|
|
94
|
+
/**
|
|
95
|
+
* Bytes an open source holds between renders (cached frames, images, and file bytes).
|
|
96
|
+
*
|
|
97
|
+
* # Errors
|
|
98
|
+
* When the handle is not open.
|
|
99
|
+
*/
|
|
100
|
+
residentBytes(handle: number): number;
|
|
101
|
+
/**
|
|
102
|
+
* Total bytes registered under locators.
|
|
103
|
+
*/
|
|
104
|
+
resourceBytes(): number;
|
|
105
|
+
/**
|
|
106
|
+
* The part of [`Self::resident_bytes`] shared with [`Self::reader`] readers, counted once.
|
|
107
|
+
*
|
|
108
|
+
* # Errors
|
|
109
|
+
* When the handle is not open.
|
|
110
|
+
*/
|
|
111
|
+
sharedBytes(handle: number): number;
|
|
112
|
+
/**
|
|
113
|
+
* Whether this module opens a project's provider source (JSON).
|
|
114
|
+
*/
|
|
115
|
+
supports(provider: string): boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* One frame a source rendered.
|
|
120
|
+
*/
|
|
121
|
+
export class RenderedFrame {
|
|
122
|
+
private constructor();
|
|
123
|
+
free(): void;
|
|
124
|
+
[Symbol.dispose](): void;
|
|
125
|
+
/**
|
|
126
|
+
* Diagnostics, as a JSON array.
|
|
127
|
+
*/
|
|
128
|
+
readonly diagnostics: string;
|
|
129
|
+
/**
|
|
130
|
+
* The first source tick it no longer shows at, or `undefined` for the last frame.
|
|
131
|
+
*/
|
|
132
|
+
readonly endTicks: bigint | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Premultiplied linear-light RGBA half-float bits (BT.709, rows packed), empty for RGBA8.
|
|
135
|
+
*/
|
|
136
|
+
readonly halfPixels: Uint16Array;
|
|
137
|
+
/**
|
|
138
|
+
* Height in pixels.
|
|
139
|
+
*/
|
|
140
|
+
readonly height: number;
|
|
141
|
+
/**
|
|
142
|
+
* Which of the source's frames this is.
|
|
143
|
+
*/
|
|
144
|
+
readonly index: number;
|
|
145
|
+
/**
|
|
146
|
+
* Premultiplied, sRGB-encoded, packed RGBA8 rows; empty for another precision.
|
|
147
|
+
*/
|
|
148
|
+
readonly pixels: Uint8Array;
|
|
149
|
+
/**
|
|
150
|
+
* `rgba8` for [`Self::pixels`], `linear_f16` for [`Self::half_pixels`].
|
|
151
|
+
*/
|
|
152
|
+
readonly precision: string;
|
|
153
|
+
/**
|
|
154
|
+
* The first source tick it shows at; 0 for the first frame.
|
|
155
|
+
*/
|
|
156
|
+
readonly startTicks: bigint;
|
|
157
|
+
/**
|
|
158
|
+
* Width in pixels.
|
|
159
|
+
*/
|
|
160
|
+
readonly width: number;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export function __wbg_reset_state(): void;
|
|
164
|
+
|
|
165
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
166
|
+
|
|
167
|
+
export interface InitOutput {
|
|
168
|
+
readonly memory: WebAssembly.Memory;
|
|
169
|
+
readonly __wbg_extensionregistry_free: (a: number, b: number) => void;
|
|
170
|
+
readonly __wbg_renderedframe_free: (a: number, b: number) => void;
|
|
171
|
+
readonly extensionregistry_clearFonts: (a: number) => void;
|
|
172
|
+
readonly extensionregistry_needs: (a: number, b: number, c: bigint) => [number, number, number, number];
|
|
173
|
+
readonly extensionregistry_new: () => number;
|
|
174
|
+
readonly extensionregistry_open: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
175
|
+
readonly extensionregistry_openNeeds: (a: number, b: number, c: number) => [number, number, number, number];
|
|
176
|
+
readonly extensionregistry_probe: (a: number, b: number, c: number) => [number, number, number, number];
|
|
177
|
+
readonly extensionregistry_providers: (a: number) => [number, number];
|
|
178
|
+
readonly extensionregistry_reader: (a: number, b: number) => [number, number, number];
|
|
179
|
+
readonly extensionregistry_registerFont: (a: number, b: number, c: number) => void;
|
|
180
|
+
readonly extensionregistry_registerResource: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
181
|
+
readonly extensionregistry_release: (a: number, b: number) => void;
|
|
182
|
+
readonly extensionregistry_releaseResource: (a: number, b: number, c: number) => void;
|
|
183
|
+
readonly extensionregistry_render: (a: number, b: number, c: bigint, d: number, e: number) => [number, number, number];
|
|
184
|
+
readonly extensionregistry_report: (a: number, b: number) => [number, number, number, number];
|
|
185
|
+
readonly extensionregistry_residentBytes: (a: number, b: number) => [number, number, number];
|
|
186
|
+
readonly extensionregistry_resourceBytes: (a: number) => number;
|
|
187
|
+
readonly extensionregistry_sharedBytes: (a: number, b: number) => [number, number, number];
|
|
188
|
+
readonly extensionregistry_supports: (a: number, b: number, c: number) => number;
|
|
189
|
+
readonly renderedframe_diagnostics: (a: number) => [number, number];
|
|
190
|
+
readonly renderedframe_endTicks: (a: number) => [number, bigint];
|
|
191
|
+
readonly renderedframe_halfPixels: (a: number) => any;
|
|
192
|
+
readonly renderedframe_height: (a: number) => number;
|
|
193
|
+
readonly renderedframe_index: (a: number) => number;
|
|
194
|
+
readonly renderedframe_pixels: (a: number) => any;
|
|
195
|
+
readonly renderedframe_precision: (a: number) => [number, number];
|
|
196
|
+
readonly renderedframe_startTicks: (a: number) => bigint;
|
|
197
|
+
readonly renderedframe_width: (a: number) => number;
|
|
198
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
199
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
200
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
201
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
202
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
203
|
+
readonly __wbindgen_start: () => void;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
210
|
+
* a precompiled `WebAssembly.Module`.
|
|
211
|
+
*
|
|
212
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
213
|
+
*
|
|
214
|
+
* @returns {InitOutput}
|
|
215
|
+
*/
|
|
216
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
220
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
221
|
+
*
|
|
222
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
223
|
+
*
|
|
224
|
+
* @returns {Promise<InitOutput>}
|
|
225
|
+
*/
|
|
226
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
227
|
+
export function __wbg_reset_state_async(): Promise<void>;
|