@alpha2-sh/editor 0.4.6 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/bridge.d.ts +15 -16
- package/dist/browser/bridge.js +396 -312
- package/dist/browser/extensions-worker.d.ts +12 -16
- package/dist/browser/extensions-worker.js +17 -24
- package/dist/browser/hash-worker.d.ts +4 -5
- package/dist/browser/hash-worker.js +7 -8
- package/dist/browser/jobs.d.ts +17 -19
- package/dist/browser/jobs.js +41 -28
- package/dist/browser/resources.d.ts +6 -11
- package/dist/browser/resources.js +5 -9
- package/dist/browser/runtime/assets.d.ts +47 -28
- package/dist/browser/runtime/assets.js +129 -45
- package/dist/browser/runtime/audio.d.ts +16 -11
- package/dist/browser/runtime/audio.js +58 -31
- package/dist/browser/runtime/budget.d.ts +4 -5
- package/dist/browser/runtime/budget.js +4 -5
- package/dist/browser/runtime/caption-fonts.d.ts +3 -7
- package/dist/browser/runtime/caption-fonts.js +4 -8
- package/dist/browser/runtime/engine.d.ts +39 -44
- package/dist/browser/runtime/engine.js +78 -64
- package/dist/browser/runtime/export-audio.d.ts +6 -6
- package/dist/browser/runtime/export-audio.js +8 -9
- package/dist/browser/runtime/exporter.d.ts +33 -66
- package/dist/browser/runtime/exporter.js +111 -137
- package/dist/browser/runtime/extension-import.d.ts +28 -35
- package/dist/browser/runtime/extension-import.js +36 -46
- package/dist/browser/runtime/fingerprint.d.ts +11 -14
- package/dist/browser/runtime/fingerprint.js +20 -24
- package/dist/browser/runtime/generators.d.ts +2 -3
- package/dist/browser/runtime/generators.js +5 -7
- package/dist/browser/runtime/locks.d.ts +5 -7
- package/dist/browser/runtime/locks.js +5 -7
- package/dist/browser/runtime/output.d.ts +7 -9
- package/dist/browser/runtime/output.js +17 -21
- package/dist/browser/runtime/preview-utils.js +10 -6
- package/dist/browser/runtime/proxies.d.ts +10 -17
- package/dist/browser/runtime/proxies.js +33 -45
- package/dist/browser/runtime/proxy-storage.d.ts +15 -19
- package/dist/browser/runtime/proxy-storage.js +20 -24
- package/dist/browser/runtime/sources.d.ts +23 -31
- package/dist/browser/runtime/sources.js +85 -103
- package/dist/browser/runtime/staging.d.ts +2 -6
- package/dist/browser/runtime/staging.js +7 -11
- package/dist/browser/runtime/still.d.ts +2 -6
- package/dist/browser/runtime/still.js +6 -12
- package/dist/browser/runtime/text.d.ts +14 -0
- package/dist/browser/runtime/text.js +27 -0
- package/dist/browser/runtime/wasm.d.ts +4 -5
- package/dist/browser/runtime/wasm.js +4 -5
- package/dist/browser/types.d.ts +233 -238
- package/dist/browser/worker.d.ts +8 -9
- package/dist/browser/worker.js +50 -21
- package/dist/core/captions.d.ts +8 -10
- package/dist/core/captions.js +10 -18
- package/dist/core/clip-time.d.ts +8 -10
- package/dist/core/clip-time.js +12 -15
- package/dist/core/commands.d.ts +46 -46
- package/dist/core/commands.js +38 -36
- package/dist/core/compositions.d.ts +78 -112
- package/dist/core/compositions.js +66 -94
- package/dist/core/document.d.ts +59 -92
- package/dist/core/document.js +64 -90
- package/dist/core/keyframes.d.ts +11 -12
- package/dist/core/keyframes.js +11 -13
- package/dist/core/presets.d.ts +14 -20
- package/dist/core/presets.js +12 -18
- package/dist/core/session.d.ts +26 -38
- package/dist/core/session.js +38 -53
- package/dist/core/text.d.ts +2 -3
- package/dist/core/text.js +2 -3
- package/dist/core/timeline-index.d.ts +2 -3
- package/dist/core/timeline-index.js +11 -7
- package/dist/core/transitions.js +4 -5
- package/dist/core/validated.d.ts +6 -7
- package/dist/core/validated.js +8 -11
- package/dist/native-client/index.d.ts +31 -32
- package/dist/native-client/index.js +40 -41
- package/dist/ports/index.d.ts +19 -20
- package/dist/react/index.d.ts +5 -6
- package/dist/react/index.js +5 -6
- package/package.json +4 -4
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Decodes an image
|
|
3
|
-
* engine takes, as native decoding refuses one.
|
|
2
|
+
* Decodes an image upright without colour management, rejecting one larger than the engine takes.
|
|
4
3
|
*/
|
|
5
4
|
export function decodeStill(file: any): Promise<ImageBitmap>;
|
|
6
|
-
/**
|
|
7
|
-
* A decoded still's pixels at its own size, in straight alpha as decoded, as a raster frame the
|
|
8
|
-
* engine presents into the output.
|
|
9
|
-
*/
|
|
5
|
+
/** A decoded still's pixels at its own size, in straight alpha, as a raster frame. */
|
|
10
6
|
export function stillRaster(bitmap: any): {
|
|
11
7
|
kind: string;
|
|
12
8
|
width: any;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
// Reads a still image by the same
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// treats SDR input as sRGB and native decoding has no colour management.
|
|
6
|
-
// - At its own size; the engine scales it into the output.
|
|
1
|
+
// Reads a still image by the same rules as native decoding, so preview and browser and native
|
|
2
|
+
// exports match: upright per Exif `Orientation` (`imageOrientation: "from-image"`), in stored
|
|
3
|
+
// sRGB code values with no ICC conversion (the engine treats SDR input as sRGB and native decoding
|
|
4
|
+
// has no colour management), and at its own size.
|
|
7
5
|
/** The longest side the engine decodes, renders, or composes (`MAX_FRAME_DIMENSION`). */
|
|
8
6
|
export const MAX_STILL_DIMENSION = 16_384;
|
|
9
7
|
/** The largest area the engine decodes, renders, or composes (`MAX_FRAME_PIXELS`). */
|
|
10
8
|
export const MAX_STILL_PIXELS = 67_108_864;
|
|
11
9
|
/**
|
|
12
|
-
* Decodes an image
|
|
13
|
-
* engine takes, as native decoding refuses one.
|
|
10
|
+
* Decodes an image upright without colour management, rejecting one larger than the engine takes.
|
|
14
11
|
*/
|
|
15
12
|
export async function decodeStill(file) {
|
|
16
13
|
const bitmap = await createImageBitmap(file, {
|
|
@@ -26,10 +23,7 @@ export async function decodeStill(file) {
|
|
|
26
23
|
}
|
|
27
24
|
return bitmap;
|
|
28
25
|
}
|
|
29
|
-
/**
|
|
30
|
-
* A decoded still's pixels at its own size, in straight alpha as decoded, as a raster frame the
|
|
31
|
-
* engine presents into the output.
|
|
32
|
-
*/
|
|
26
|
+
/** A decoded still's pixels at its own size, in straight alpha, as a raster frame. */
|
|
33
27
|
export function stillRaster(bitmap) {
|
|
34
28
|
const { width, height } = bitmap;
|
|
35
29
|
const canvas = new OffscreenCanvas(width, height);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text of a user's file (a subtitle file, a `.cube` LUT) by the rule every alpha2 runtime uses:
|
|
3
|
+
* UTF-8 (a byte order mark is dropped), or UTF-16 when the file starts with a little- or big-endian
|
|
4
|
+
* byte order mark (as Windows PowerShell 5.1 writes). Anything else, such as a legacy code page,
|
|
5
|
+
* throws an `invalid_text` {@link EditorError} naming the file instead of decoding to replacement
|
|
6
|
+
* characters.
|
|
7
|
+
*
|
|
8
|
+
* @param {Blob & { name?: string }} file
|
|
9
|
+
* @param {string} [operation] The operation the error names. Defaults to `import`.
|
|
10
|
+
* @returns {Promise<string>}
|
|
11
|
+
*/
|
|
12
|
+
export function readUserText(file: Blob & {
|
|
13
|
+
name?: string;
|
|
14
|
+
}, operation?: string): Promise<string>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { EditorError } from "../../core/document.js";
|
|
2
|
+
/**
|
|
3
|
+
* The text of a user's file (a subtitle file, a `.cube` LUT) by the rule every alpha2 runtime uses:
|
|
4
|
+
* UTF-8 (a byte order mark is dropped), or UTF-16 when the file starts with a little- or big-endian
|
|
5
|
+
* byte order mark (as Windows PowerShell 5.1 writes). Anything else, such as a legacy code page,
|
|
6
|
+
* throws an `invalid_text` {@link EditorError} naming the file instead of decoding to replacement
|
|
7
|
+
* characters.
|
|
8
|
+
*
|
|
9
|
+
* @param {Blob & { name?: string }} file
|
|
10
|
+
* @param {string} [operation] The operation the error names. Defaults to `import`.
|
|
11
|
+
* @returns {Promise<string>}
|
|
12
|
+
*/
|
|
13
|
+
export async function readUserText(file, operation = "import") {
|
|
14
|
+
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
15
|
+
const encoding = bytes[0] === 0xff && bytes[1] === 0xfe
|
|
16
|
+
? "utf-16le"
|
|
17
|
+
: bytes[0] === 0xfe && bytes[1] === 0xff
|
|
18
|
+
? "utf-16be"
|
|
19
|
+
: "utf-8";
|
|
20
|
+
try {
|
|
21
|
+
// Each decoder drops its own byte order mark.
|
|
22
|
+
return new TextDecoder(encoding, { fatal: true }).decode(bytes);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
throw new EditorError("invalid_text", `${file.name ?? "the file"} is not UTF-8 text; save it as UTF-8`, operation);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Instantiates `alpha2/wasm` once
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* call.
|
|
2
|
+
* Instantiates `alpha2/wasm` once per realm and resolves to its exports. wasm-bindgen's init only
|
|
3
|
+
* reuses a finished instance, so two concurrent calls would instantiate twice and the second would
|
|
4
|
+
* replace the module's memory under objects made from the first. Every caller goes through here; a
|
|
5
|
+
* failed load is retried by the next call.
|
|
7
6
|
* @param {string | URL | undefined} wasmUrl
|
|
8
7
|
*/
|
|
9
8
|
export function loadEngineWasm(wasmUrl: string | URL | undefined): any;
|
|
@@ -2,11 +2,10 @@ import init from "alpha2/wasm";
|
|
|
2
2
|
import * as binding from "alpha2/wasm";
|
|
3
3
|
let loading = null;
|
|
4
4
|
/**
|
|
5
|
-
* Instantiates `alpha2/wasm` once
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* call.
|
|
5
|
+
* Instantiates `alpha2/wasm` once per realm and resolves to its exports. wasm-bindgen's init only
|
|
6
|
+
* reuses a finished instance, so two concurrent calls would instantiate twice and the second would
|
|
7
|
+
* replace the module's memory under objects made from the first. Every caller goes through here; a
|
|
8
|
+
* failed load is retried by the next call.
|
|
10
9
|
* @param {string | URL | undefined} wasmUrl
|
|
11
10
|
*/
|
|
12
11
|
export function loadEngineWasm(wasmUrl) {
|