@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.
Files changed (81) hide show
  1. package/dist/browser/bridge.d.ts +15 -16
  2. package/dist/browser/bridge.js +393 -312
  3. package/dist/browser/extensions-worker.d.ts +12 -16
  4. package/dist/browser/extensions-worker.js +17 -24
  5. package/dist/browser/hash-worker.d.ts +4 -5
  6. package/dist/browser/hash-worker.js +7 -8
  7. package/dist/browser/jobs.d.ts +17 -19
  8. package/dist/browser/jobs.js +41 -28
  9. package/dist/browser/resources.d.ts +6 -11
  10. package/dist/browser/resources.js +5 -9
  11. package/dist/browser/runtime/assets.d.ts +52 -28
  12. package/dist/browser/runtime/assets.js +136 -45
  13. package/dist/browser/runtime/audio.d.ts +16 -11
  14. package/dist/browser/runtime/audio.js +102 -59
  15. package/dist/browser/runtime/budget.d.ts +4 -5
  16. package/dist/browser/runtime/budget.js +4 -5
  17. package/dist/browser/runtime/caption-fonts.d.ts +3 -7
  18. package/dist/browser/runtime/caption-fonts.js +4 -8
  19. package/dist/browser/runtime/engine.d.ts +44 -44
  20. package/dist/browser/runtime/engine.js +87 -64
  21. package/dist/browser/runtime/export-audio.d.ts +6 -6
  22. package/dist/browser/runtime/export-audio.js +8 -9
  23. package/dist/browser/runtime/exporter.d.ts +33 -66
  24. package/dist/browser/runtime/exporter.js +111 -137
  25. package/dist/browser/runtime/extension-import.d.ts +28 -35
  26. package/dist/browser/runtime/extension-import.js +36 -46
  27. package/dist/browser/runtime/fingerprint.d.ts +11 -14
  28. package/dist/browser/runtime/fingerprint.js +20 -24
  29. package/dist/browser/runtime/generators.d.ts +2 -3
  30. package/dist/browser/runtime/generators.js +5 -7
  31. package/dist/browser/runtime/locks.d.ts +5 -7
  32. package/dist/browser/runtime/locks.js +5 -7
  33. package/dist/browser/runtime/output.d.ts +7 -9
  34. package/dist/browser/runtime/output.js +17 -21
  35. package/dist/browser/runtime/preview-utils.js +10 -6
  36. package/dist/browser/runtime/proxies.d.ts +19 -19
  37. package/dist/browser/runtime/proxies.js +72 -51
  38. package/dist/browser/runtime/proxy-storage.d.ts +15 -19
  39. package/dist/browser/runtime/proxy-storage.js +20 -24
  40. package/dist/browser/runtime/sources.d.ts +23 -31
  41. package/dist/browser/runtime/sources.js +85 -103
  42. package/dist/browser/runtime/staging.d.ts +2 -6
  43. package/dist/browser/runtime/staging.js +7 -11
  44. package/dist/browser/runtime/still.d.ts +2 -6
  45. package/dist/browser/runtime/still.js +6 -12
  46. package/dist/browser/runtime/text.d.ts +14 -0
  47. package/dist/browser/runtime/text.js +27 -0
  48. package/dist/browser/runtime/wasm.d.ts +4 -5
  49. package/dist/browser/runtime/wasm.js +4 -5
  50. package/dist/browser/types.d.ts +244 -239
  51. package/dist/browser/worker.d.ts +10 -10
  52. package/dist/browser/worker.js +64 -22
  53. package/dist/core/captions.d.ts +8 -10
  54. package/dist/core/captions.js +10 -18
  55. package/dist/core/clip-time.d.ts +8 -10
  56. package/dist/core/clip-time.js +12 -15
  57. package/dist/core/commands.d.ts +46 -46
  58. package/dist/core/commands.js +38 -36
  59. package/dist/core/compositions.d.ts +78 -112
  60. package/dist/core/compositions.js +66 -94
  61. package/dist/core/document.d.ts +59 -92
  62. package/dist/core/document.js +65 -90
  63. package/dist/core/keyframes.d.ts +11 -12
  64. package/dist/core/keyframes.js +11 -13
  65. package/dist/core/presets.d.ts +14 -20
  66. package/dist/core/presets.js +12 -18
  67. package/dist/core/session.d.ts +26 -38
  68. package/dist/core/session.js +38 -53
  69. package/dist/core/text.d.ts +2 -3
  70. package/dist/core/text.js +2 -3
  71. package/dist/core/timeline-index.d.ts +2 -3
  72. package/dist/core/timeline-index.js +11 -7
  73. package/dist/core/transitions.js +4 -5
  74. package/dist/core/validated.d.ts +6 -7
  75. package/dist/core/validated.js +8 -11
  76. package/dist/native-client/index.d.ts +31 -32
  77. package/dist/native-client/index.js +40 -41
  78. package/dist/ports/index.d.ts +19 -20
  79. package/dist/react/index.d.ts +5 -6
  80. package/dist/react/index.js +5 -6
  81. package/package.json +4 -4
@@ -1,8 +1,8 @@
1
- // Where kept proxies live: OPFS {@link PROXY_DIRECTORY}, `<hash>.mp4` plus `<hash>.json` per
2
- // original SHA-256. A proxy is shared by every project of the origin, so it lives while something
3
- // refers to it. Readers hold a shared Web Lock on the hash and removal takes it exclusively; makers
4
- // also take turns on a second lock ({@link whileMakingProxy}) and write `<hash>.<id>.part` until
5
- // finished. No media libraries here, so a storage-only page can load this module alone.
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` where the browser has no origin-private file system (or, with
17
- * `create: false`, where no proxy was ever kept).
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, for this page, until `release()`: a removal from any page of
31
- * the origin leaves it alone meanwhile. Resolves once held; where the browser has no Web Locks, at
32
- * once and holding nothing.
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`: it waits for a page that
43
- * is making it to finish, so it can find that page's proxy instead of making it again. `make` is
44
- * told whether it holds the turn; where the browser has no Web Locks it runs at once, holding
45
- * nothing. Rejects with `signal.reason` once `signal` aborts while it waits.
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 what a page that stopped while making the proxy of `hash` left: the unfinished videos.
57
- * Only for the page holding the turn to make it ({@link whileMakingProxy}), when no other page can
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
- * The proxies kept in this origin's storage: each original's hash and the bytes its proxy takes.
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`, except those a page of this origin holds in use ({@link
94
- * holdProxy}). Resolves to the hashes removed and those left because they are in use; a hash with
95
- * nothing kept counts as removed. A string that is not a lowercase hex SHA-256 is ignored and
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 the same settings: the same object, or equal ones. Two objects are
8
- * compared once, so a pair asked about for every frame costs no serialization or string compare.
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
- * The default byte budget of what open extension sources hold (their decoded frames in the provider
15
- * module and the frame each showed last): the native host's `providerSourceBytes` default.
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
- * How video decodes: `"auto"` lets the browser pick, a hardware decoder where it has one;
33
- * `"software"` decodes on the CPU, so no frame needs a GPU readback, except a source the
34
- * browser has no software decoder for, which decodes as `"auto"` and is reported in
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
- * The fonts an SVG's text draws with, in fallback order: the stack the engine draws captions with
54
- * (`{ bytes }` each), as the native host draws an SVG's text with its caption fonts. An SVG
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
- * What a source's pixels are, for `FrameSupply`'s `contentOf`: its runtime asset, and for an SVG
60
- * also the fonts its text draws with, so a change of fonts draws it again. The same object while
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
- * Bound method handed to `FrameSupply` as its `pixelsFor` callback. `sourceId` is the source the
68
- * engine asked for, which the layer may stand in for (a proxy has an ID of its own): decoders are
69
- * kept per source, as `release` names them. `decode: "software"` asks for the frame decoded on
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
- * What fell back, per source and kind: `"element-seek"`, frames read by element seeks rather
78
- * than decoded, with the last reason, how many frames, and whether its decoding stopped for good
79
- * (it could not open, or failed {@link MAX_DECODE_FAILURES} frames running);
80
- * `"software-unavailable"`, a source `videoDecode: "software"` decoded as `"auto"` because the
81
- * browser has no software decoder for it (`frames` 0). A browser export reports it.
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 bounded to consumers needed by the current frame. */
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, and rasters for source IDs not in `liveIds`. The engine
88
- * calls it before each frame reads its sources, so the previous frame's reads may be evicted.
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>;