@alpha2-sh/editor 0.4.6 → 0.5.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/browser/bridge.d.ts +15 -16
- package/dist/browser/bridge.js +393 -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 +52 -28
- package/dist/browser/runtime/assets.js +136 -45
- package/dist/browser/runtime/audio.d.ts +16 -11
- package/dist/browser/runtime/audio.js +102 -59
- 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 +44 -44
- package/dist/browser/runtime/engine.js +87 -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 +19 -19
- package/dist/browser/runtime/proxies.js +72 -51
- 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 +244 -239
- package/dist/browser/worker.d.ts +10 -10
- package/dist/browser/worker.js +64 -22
- 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 +65 -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,8 +1,8 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
1
|
+
// Kept proxies live in OPFS {@link PROXY_DIRECTORY} as `<hash>.mp4` plus `<hash>.json` per original
|
|
2
|
+
// SHA-256, shared by every project of the origin. Readers hold a shared Web Lock on the hash and
|
|
3
|
+
// removal takes it exclusively; makers also take turns on a second lock ({@link whileMakingProxy})
|
|
4
|
+
// and write `<hash>.<id>.part` until finished. No media libraries here, so storage-only pages can
|
|
5
|
+
// load this module alone.
|
|
6
6
|
import { holdShared, whenUnheld, withExclusive } from "./locks.js";
|
|
7
7
|
/** The origin-private directory proxies are kept in. */
|
|
8
8
|
export const PROXY_DIRECTORY = "alpha2-proxies";
|
|
@@ -13,8 +13,8 @@ const makeLockName = (hash) => `alpha2-proxy-make:${hash}`;
|
|
|
13
13
|
export const unfinishedProxyName = (hash, id) => `${hash}.${id}.part`;
|
|
14
14
|
const UNFINISHED = /^([0-9a-f]{64})\.[0-9A-Za-z-]+\.part$/;
|
|
15
15
|
/**
|
|
16
|
-
* The proxy directory, or `null`
|
|
17
|
-
*
|
|
16
|
+
* The proxy directory, or `null` without an origin-private file system (or, with `create: false`,
|
|
17
|
+
* when no proxy was ever kept).
|
|
18
18
|
* @returns {Promise<FileSystemDirectoryHandle | null>}
|
|
19
19
|
*/
|
|
20
20
|
export async function proxyDirectory({ create = true } = {}) {
|
|
@@ -27,11 +27,9 @@ export async function proxyDirectory({ create = true } = {}) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* Holds the proxy of `hash` in use
|
|
31
|
-
* the origin
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* `release()` returns a promise that settles when the lock is let go.
|
|
30
|
+
* Holds the proxy of `hash` in use for this page until `release()`, so removals from any page of
|
|
31
|
+
* the origin skip it. Resolves once held; without Web Locks, at once and holding nothing.
|
|
32
|
+
* `release()` settles when the lock is let go.
|
|
35
33
|
* @param {string} hash
|
|
36
34
|
* @returns {Promise<{ release(): Promise<void> }>}
|
|
37
35
|
*/
|
|
@@ -39,10 +37,10 @@ export async function holdProxy(hash) {
|
|
|
39
37
|
return holdShared(lockName(hash));
|
|
40
38
|
}
|
|
41
39
|
/**
|
|
42
|
-
* Runs `make` as the only page of the origin making the proxy of `hash
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
40
|
+
* Runs `make` as the only page of the origin making the proxy of `hash`, waiting for a page already
|
|
41
|
+
* making it so the caller can find that proxy instead. `make` is told whether it holds the turn;
|
|
42
|
+
* without Web Locks it runs at once, holding nothing. Rejects with `signal.reason` if `signal`
|
|
43
|
+
* aborts while waiting.
|
|
46
44
|
* @template T
|
|
47
45
|
* @param {string} hash
|
|
48
46
|
* @param {{ signal?: AbortSignal }} options
|
|
@@ -53,9 +51,8 @@ export function whileMakingProxy(hash, options, make) {
|
|
|
53
51
|
return withExclusive(makeLockName(hash), options, make);
|
|
54
52
|
}
|
|
55
53
|
/**
|
|
56
|
-
* Removes
|
|
57
|
-
*
|
|
58
|
-
* be writing one.
|
|
54
|
+
* Removes unfinished videos a stopped page left while making the proxy of `hash`. Only for the page
|
|
55
|
+
* holding the turn ({@link whileMakingProxy}), when no other page can be writing one.
|
|
59
56
|
* @param {FileSystemDirectoryHandle} directory
|
|
60
57
|
* @param {string} hash
|
|
61
58
|
*/
|
|
@@ -68,7 +65,7 @@ export async function removeUnfinishedProxies(directory, hash) {
|
|
|
68
65
|
await directory.removeEntry(name).catch(() => { });
|
|
69
66
|
}
|
|
70
67
|
/**
|
|
71
|
-
*
|
|
68
|
+
* Each proxy kept in this origin's storage: the original's hash and the proxy's size in bytes.
|
|
72
69
|
* @returns {Promise<import("../types.js").KeptProxy[]>}
|
|
73
70
|
*/
|
|
74
71
|
export async function keptProxies() {
|
|
@@ -90,10 +87,9 @@ export async function keptProxies() {
|
|
|
90
87
|
return [...bytes].map(([hash, size]) => ({ hash, bytes: size }));
|
|
91
88
|
}
|
|
92
89
|
/**
|
|
93
|
-
* Removes the kept proxies of `hashes
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* listed in neither.
|
|
90
|
+
* Removes the kept proxies of `hashes` except those a page holds in use ({@link holdProxy}).
|
|
91
|
+
* Resolves to the removed hashes and those left in use; a hash with nothing kept counts as removed.
|
|
92
|
+
* Strings that are not lowercase hex SHA-256 are ignored and listed in neither.
|
|
97
93
|
* @param {Iterable<string>} hashes
|
|
98
94
|
* @returns {Promise<import("../types.js").ProxyRemoval>}
|
|
99
95
|
*/
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `provider`'s settings as one comparable string, serialized once per provider object: an image
|
|
3
|
-
* sequence's holds every frame's locator.
|
|
4
|
-
*/
|
|
1
|
+
/** `provider`'s settings as one comparable string, serialized once per provider object. */
|
|
5
2
|
export function providerSettings(provider: any): any;
|
|
6
3
|
/**
|
|
7
|
-
* Whether two providers have
|
|
8
|
-
*
|
|
4
|
+
* Whether two providers have equal settings. Each pair is compared once, so per-frame checks cost
|
|
5
|
+
* no serialization.
|
|
9
6
|
*/
|
|
10
7
|
export function sameProviderSettings(a: any, b: any): any;
|
|
11
8
|
/** Default byte budget of still and text rasters, matching the frame supply's image cache. */
|
|
12
9
|
export const DEFAULT_RASTER_BUDGET_BYTES: number;
|
|
13
10
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
11
|
+
* Default byte budget for open extension sources (decoded frames in the provider module plus the
|
|
12
|
+
* last shown frame), matching the native host's `providerSourceBytes`.
|
|
16
13
|
*/
|
|
17
14
|
export const DEFAULT_PROVIDER_SOURCE_BYTES: number;
|
|
18
15
|
/** The host side of the engine's per-frame source requests for one renderer (preview or export). */
|
|
@@ -29,10 +26,9 @@ export class SourcePixels {
|
|
|
29
26
|
library: any;
|
|
30
27
|
extensionsWasmUrl: any;
|
|
31
28
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* `decodeFallbacks`.
|
|
29
|
+
* `"auto"` lets the browser pick, hardware where available; `"software"` decodes on the CPU so
|
|
30
|
+
* no frame needs a GPU readback. Sources without a software decoder decode as `"auto"` and are
|
|
31
|
+
* reported in `decodeFallbacks`.
|
|
36
32
|
*/
|
|
37
33
|
videoDecode: string;
|
|
38
34
|
get diagnostics(): {
|
|
@@ -50,42 +46,38 @@ export class SourcePixels {
|
|
|
50
46
|
};
|
|
51
47
|
setOutputSize(width: any, height: any): void;
|
|
52
48
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* opened with other fonts opens again on its next frame; other sources are not touched.
|
|
49
|
+
* Sets the fonts SVG text draws with, in fallback order (the engine's caption stack, `{ bytes }`
|
|
50
|
+
* each), as the native host does. An SVG opened with other fonts reopens on its next frame.
|
|
56
51
|
*/
|
|
57
52
|
setFonts(fonts: any): void;
|
|
58
53
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* neither changes.
|
|
54
|
+
* A source's content identity for `FrameSupply`'s `contentOf`: its runtime asset, plus the fonts
|
|
55
|
+
* for an SVG so a font change redraws it. Stable while neither changes.
|
|
62
56
|
*/
|
|
63
57
|
contentOf(asset: any): any;
|
|
64
|
-
/** Drops the cached raster of `assetId`, so its next read makes it again. */
|
|
65
58
|
invalidate(assetId: any): void;
|
|
66
59
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* the CPU (see `#softwareFrame`).
|
|
60
|
+
* `FrameSupply`'s `pixelsFor` callback. `sourceId` is the source the engine asked for, which the
|
|
61
|
+
* layer may stand in for (a proxy has its own ID); decoders are kept per source, as `release`
|
|
62
|
+
* names them. `decode: "software"` asks for a CPU-decoded frame (see `#softwareFrame`).
|
|
71
63
|
*/
|
|
72
64
|
pixelsFor: (layer: any, seconds: any, { preferVideoFrame, consumerId, sourceId, decode }?: {
|
|
73
65
|
preferVideoFrame?: boolean | undefined;
|
|
74
66
|
consumerId?: any;
|
|
75
67
|
}) => Promise<any>;
|
|
76
68
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* (
|
|
80
|
-
* `"software-unavailable"
|
|
81
|
-
*
|
|
69
|
+
* Fallbacks per source and kind, reported by browser exports. `"element-seek"`: frames read by
|
|
70
|
+
* element seeks instead of decoding, with the last reason, count, and whether decoding stopped
|
|
71
|
+
* for good (failed to open or failed {@link MAX_DECODE_FAILURES} frames running).
|
|
72
|
+
* `"software-unavailable"`: `videoDecode: "software"` decoded as `"auto"` for lack of a software
|
|
73
|
+
* decoder (`frames` 0).
|
|
82
74
|
*/
|
|
83
75
|
get decodeFallbacks(): any[];
|
|
84
|
-
/** Keeps decoder sessions
|
|
76
|
+
/** Keeps decoder sessions to the consumers the current frame needs. */
|
|
85
77
|
retainConsumers: (liveConsumerIds: any) => Promise<void>;
|
|
86
78
|
/**
|
|
87
|
-
* Drops decoders, extension sources
|
|
88
|
-
*
|
|
79
|
+
* Drops decoders, extension sources and rasters for source IDs not in `liveIds`. The engine calls
|
|
80
|
+
* it before each frame reads its sources.
|
|
89
81
|
*/
|
|
90
82
|
release(liveIds: any): Promise<void>;
|
|
91
83
|
dispose(): Promise<void>;
|