@serimo/player 0.3.0 → 0.3.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/README.md +16 -0
- package/dist/audio/player-audio.d.ts +10 -0
- package/dist/audio/player-audio.d.ts.map +1 -0
- package/dist/audio/prepared-pcm.d.ts +8 -0
- package/dist/audio/prepared-pcm.d.ts.map +1 -0
- package/dist/composition/composition-player.d.ts.map +1 -0
- package/dist/composition/composition-timing.d.ts.map +1 -0
- package/dist/{player-session.d.ts → composition/player-session.d.ts} +1 -9
- package/dist/composition/player-session.d.ts.map +1 -0
- package/dist/composition/player-status.d.ts.map +1 -0
- package/dist/composition/renderer-bridge.d.ts.map +1 -0
- package/dist/image/image-accessibility.d.ts +6 -0
- package/dist/image/image-accessibility.d.ts.map +1 -0
- package/dist/{image-asset-types.d.ts → image/image-asset-types.d.ts} +10 -0
- package/dist/image/image-asset-types.d.ts.map +1 -0
- package/dist/image/image-asset.d.ts +3 -0
- package/dist/image/image-asset.d.ts.map +1 -0
- package/dist/image/image-resources.d.ts.map +1 -0
- package/dist/image/image-sequence.d.ts.map +1 -0
- package/dist/image/image-svg-animation.d.ts.map +1 -0
- package/dist/{image-svg.d.ts → image/image-svg-validation.d.ts} +3 -3
- package/dist/image/image-svg-validation.d.ts.map +1 -0
- package/dist/image/image-svg.d.ts +3 -0
- package/dist/image/image-svg.d.ts.map +1 -0
- package/dist/index.d.ts +6 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +154 -155
- package/package.json +1 -1
- package/dist/composition-player.d.ts.map +0 -1
- package/dist/composition-timing.d.ts.map +0 -1
- package/dist/image-asset-types.d.ts.map +0 -1
- package/dist/image-asset.d.ts +0 -13
- package/dist/image-asset.d.ts.map +0 -1
- package/dist/image-resources.d.ts.map +0 -1
- package/dist/image-sequence.d.ts.map +0 -1
- package/dist/image-svg-animation.d.ts.map +0 -1
- package/dist/image-svg.d.ts.map +0 -1
- package/dist/player-audio.d.ts +0 -12
- package/dist/player-audio.d.ts.map +0 -1
- package/dist/player-session.d.ts.map +0 -1
- package/dist/player-status.d.ts.map +0 -1
- package/dist/renderer-bridge.d.ts.map +0 -1
- /package/dist/{composition-player.d.ts → composition/composition-player.d.ts} +0 -0
- /package/dist/{composition-timing.d.ts → composition/composition-timing.d.ts} +0 -0
- /package/dist/{player-status.d.ts → composition/player-status.d.ts} +0 -0
- /package/dist/{renderer-bridge.d.ts → composition/renderer-bridge.d.ts} +0 -0
- /package/dist/{image-resources.d.ts → image/image-resources.d.ts} +0 -0
- /package/dist/{image-sequence.d.ts → image/image-sequence.d.ts} +0 -0
- /package/dist/{image-svg-animation.d.ts → image/image-svg-animation.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -258,6 +258,22 @@ After readiness, invoke `audio.play(frame)` directly in the user's click/keyboar
|
|
|
258
258
|
|
|
259
259
|
Player supplies audio controls; the host owns playback scheduling and terminal behavior. The CLI holds frame N−1 until N/FPS for audio compositions, then pauses, and never seeks frame N. Replacement, failure and unmount fence old handles and dispose audio resources. Silent handles retain their existing three methods without an `audio` member. See the [integration guide](../../docs/guides/composition-player-renderer.md#voiceover-preparation-playback-dan-ekspor) for measured timing and limitations.
|
|
260
260
|
|
|
261
|
+
## Internal architecture
|
|
262
|
+
|
|
263
|
+
### Composition
|
|
264
|
+
|
|
265
|
+
[Composition setup](src/composition/composition-player.tsx) validates the input through Core, assembles the ordered clips, and exposes the active session through a React ref. The [session](src/composition/player-session.ts) owns the readiness deadline, initial seek, and cancellation for each mount. The [browser bridge](src/composition/renderer-bridge.tsx) exposes the active handle to the CLI and Renderer. The CLI can extend readiness with its own font and image checks.
|
|
266
|
+
|
|
267
|
+
### Audio
|
|
268
|
+
|
|
269
|
+
[PCM preparation](src/audio/prepared-pcm.ts) bounds and validates the WAV response. The [audio runtime](src/audio/player-audio.ts) decodes each unique source, owns the Web Audio graph, and schedules tracks on a shared output clock.
|
|
270
|
+
|
|
271
|
+
### Prepared images
|
|
272
|
+
|
|
273
|
+
[`ImageAsset`](src/image/image-asset.tsx) validates the shared declaration and dispatches by asset kind. Its raster implementation registers a canvas and uses the [composition FPS](src/composition/composition-timing.ts) to select [sequence frames](src/image/image-sequence.ts) at exact rational intervals. The [document resource store](src/image/image-resources.ts) owns the decode queue and shared bitmap leases.
|
|
274
|
+
|
|
275
|
+
[SVG validation](src/image/image-svg-validation.ts) checks the prepared tree and CSS before the [SVG component](src/image/image-svg.tsx) constructs the isolated DOM and registers its playhead. The [animation sampler](src/image/image-svg-animation.ts) applies a fixed state at each seek.
|
|
276
|
+
|
|
261
277
|
## Tests and limitations
|
|
262
278
|
|
|
263
279
|
From the repository root, after building dependencies:
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type MotionComposition } from '@serimo/core/composition';
|
|
2
|
+
export declare function createPlayerAudio(composition: MotionComposition, signal: AbortSignal): {
|
|
3
|
+
ready: Promise<void>;
|
|
4
|
+
pause: () => void;
|
|
5
|
+
dispose: () => Promise<void>;
|
|
6
|
+
play(frame: number): Promise<{
|
|
7
|
+
originTimeMs: number;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=player-audio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"player-audio.d.ts","sourceRoot":"","sources":["../../src/audio/player-audio.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,iBAAiB,EAGvB,MAAM,0BAA0B,CAAA;AA6BjC,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,iBAAiB,EAC9B,MAAM,EAAE,WAAW;;;;gBA6FL,MAAM,GAAG,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;EA+EzD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const PCM_SAMPLE_RATE = 48000;
|
|
2
|
+
export declare const MAX_PCM_BYTES: number;
|
|
3
|
+
export declare function inspectPreparedPcm(bytes: ArrayBuffer, required: number): {
|
|
4
|
+
channels: number;
|
|
5
|
+
samples: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function readPreparedPcm(src: string, signal: AbortSignal): Promise<ArrayBuffer>;
|
|
8
|
+
//# sourceMappingURL=prepared-pcm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepared-pcm.d.ts","sourceRoot":"","sources":["../../src/audio/prepared-pcm.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,QAAQ,CAAA;AACpC,eAAO,MAAM,aAAa,QAAoB,CAAA;AAE9C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM;;;EA+CtE;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,wBAiCrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition-player.d.ts","sourceRoot":"","sources":["../../src/composition/composition-player.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAuB,MAAM,0BAA0B,CAAA;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,GAAG,EAMT,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,qBAAqB,CAAA;AAG5E,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,UAAU,CAAA;IAChB,QAAQ,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAA;IACnD,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,sBAAsB,KAAK,YAAY,CAAA;AAE/E,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC3C,GAAG,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,CAAA;CACxB;AAyCD,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,UAAU,EACV,GAAG,EACJ,EAAE,sBAAsB,+BA4DxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition-timing.d.ts","sourceRoot":"","sources":["../../src/composition/composition-timing.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,wCAAqC,CAAA"}
|
|
@@ -13,15 +13,7 @@ export interface PlayerHandle {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
export declare function createPlayerSession(composition: MotionComposition, registry: Registry): {
|
|
16
|
-
|
|
17
|
-
seek(frame: number): Promise<void>;
|
|
18
|
-
getComposition(): Pick<MotionComposition, 'id' | 'width' | 'height' | 'fps' | 'durationInFrames' | 'audio'>;
|
|
19
|
-
audio?: {
|
|
20
|
-
play(frame: number): Promise<{
|
|
21
|
-
originTimeMs: number;
|
|
22
|
-
}>;
|
|
23
|
-
pause(): void;
|
|
24
|
-
};
|
|
16
|
+
handle: PlayerHandle;
|
|
25
17
|
start(): Promise<void>;
|
|
26
18
|
stop: () => Promise<void>;
|
|
27
19
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"player-session.d.ts","sourceRoot":"","sources":["../../src/composition/player-session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAI5E,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAQzD,MAAM,WAAW,YAAY;IAC3B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClC,cAAc,IAAI,IAAI,CACpB,iBAAiB,EACjB,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,kBAAkB,GAAG,OAAO,CACjE,CAAA;IACD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;YAAE,YAAY,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;QACtD,KAAK,IAAI,IAAI,CAAA;KACd,CAAA;CACF;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,iBAAiB,EAC9B,QAAQ,EAAE,QAAQ;;;;EAiHnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"player-status.d.ts","sourceRoot":"","sources":["../../src/composition/player-status.tsx"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,KAAK,EACN,EAAE;IACD,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,sCAWA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer-bridge.d.ts","sourceRoot":"","sources":["../../src/composition/renderer-bridge.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAA;AAKhC,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,KAAK,CAAC,+BAsD3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-accessibility.d.ts","sourceRoot":"","sources":["../../src/image/image-accessibility.ts"],"names":[],"mappings":"AAAA,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM;;;;EAMrD"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { createTimelineRegistry } from '@serimo/core/timeline-registry';
|
|
2
|
+
import type { CSSProperties } from 'react';
|
|
1
3
|
export interface FrozenImageFrame {
|
|
2
4
|
src: string;
|
|
3
5
|
bytes: number;
|
|
@@ -21,4 +23,12 @@ export interface FrozenImageAsset {
|
|
|
21
23
|
tree?: FrozenSvgNode;
|
|
22
24
|
bytes?: number;
|
|
23
25
|
}
|
|
26
|
+
export interface ImageAssetProps {
|
|
27
|
+
asset: FrozenImageAsset;
|
|
28
|
+
clipId: string;
|
|
29
|
+
registry: Pick<ReturnType<typeof createTimelineRegistry>, 'register'>;
|
|
30
|
+
alt: string;
|
|
31
|
+
className?: string;
|
|
32
|
+
style?: CSSProperties;
|
|
33
|
+
}
|
|
24
34
|
//# sourceMappingURL=image-asset-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-asset-types.d.ts","sourceRoot":"","sources":["../../src/image/image-asset-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAA;CACpD;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC5C,QAAQ,EAAE,SAAS,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,CAAA;CAC9C;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,CAAC,CAAA;IAChB,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAA;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,GAAG,UAAU,CAAA;IAC1B,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAA;IACnC,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,gBAAgB,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,EAAE,UAAU,CAAC,CAAA;IACrE,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-asset.d.ts","sourceRoot":"","sources":["../../src/image/image-asset.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAK7D,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,+BAoBhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-resources.d.ts","sourceRoot":"","sources":["../../src/image/image-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAkC9D,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,QAA8B,GACvC,MAAM,IAAI,CAgBZ;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,QAA8B,GACvC;IAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAAC,OAAO,IAAI,IAAI,CAAA;CAAE,CAsKlD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-sequence.d.ts","sourceRoot":"","sources":["../../src/image/image-sequence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAO9D,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,gBAAgB,EAAE,EACnC,KAAK,EAAE,MAAM,GAAG,UAAU,EAC1B,GAAG,EAAE,MAAM,GACV,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAuDhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-svg-animation.d.ts","sourceRoot":"","sources":["../../src/image/image-svg-animation.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,aAAa;IAuDpD,IAAI,UAAU,MAAM;IA8BpB,OAAO;EAIV"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FrozenSvgNode } from './image-asset-types.js';
|
|
2
|
-
|
|
2
|
+
export declare function rejectPreparedSvg(): never;
|
|
3
3
|
export declare function inspectSvgTree(tree: FrozenSvgNode, bytes: number, width: number, height: number): {
|
|
4
4
|
styles: string[];
|
|
5
5
|
ids: Map<string, FrozenSvgNode>;
|
|
6
6
|
nodes: number;
|
|
7
7
|
masks: number;
|
|
8
8
|
};
|
|
9
|
-
export declare function
|
|
10
|
-
//# sourceMappingURL=image-svg.d.ts.map
|
|
9
|
+
export declare function validateSvgStyles(styles: string[], ids: Map<string, FrozenSvgNode>, nodes: number): number;
|
|
10
|
+
//# sourceMappingURL=image-svg-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-svg-validation.d.ts","sourceRoot":"","sources":["../../src/image/image-svg-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAiC3D,wBAAgB,iBAAiB,IAAI,KAAK,CAEzC;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;;;;;EAgJf;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EAAE,EAChB,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EAC/B,KAAK,EAAE,MAAM,UAyEd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-svg.d.ts","sourceRoot":"","sources":["../../src/image/image-svg.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAS5E,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,MAAM,EACN,QAAQ,EACR,GAAG,EACH,SAAS,EACT,KAAK,EACN,EAAE,eAAe,+BAwHjB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export { CompositionPlayer } from './composition-player.js';
|
|
2
|
-
export type { CompositionPlayerProps, PlayerComponent, PlayerComponentOptions } from './composition-player.js';
|
|
3
|
-
export type { PlayerHandle } from './player-session.js';
|
|
4
|
-
export { CompositionPlayerBridge } from './renderer-bridge.js';
|
|
5
|
-
export { ImageAsset } from './image-asset.js';
|
|
6
|
-
export type { ImageAssetProps } from './image-asset.js';
|
|
7
|
-
export type { FrozenImageAsset, FrozenImageFrame, FrozenSvgNode } from './image-asset-types.js';
|
|
1
|
+
export { CompositionPlayer } from './composition/composition-player.js';
|
|
2
|
+
export type { CompositionPlayerProps, PlayerComponent, PlayerComponentOptions } from './composition/composition-player.js';
|
|
3
|
+
export type { PlayerHandle } from './composition/player-session.js';
|
|
4
|
+
export { CompositionPlayerBridge } from './composition/renderer-bridge.js';
|
|
5
|
+
export { ImageAsset } from './image/image-asset.js';
|
|
6
|
+
export type { FrozenImageAsset, FrozenImageFrame, FrozenSvgNode, ImageAssetProps } from './image/image-asset-types.js';
|
|
8
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AACvE,YAAY,EACV,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACvB,MAAM,qCAAqC,CAAA;AAC5C,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,eAAe,EAChB,MAAM,8BAA8B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -4,13 +4,13 @@ import { createTimelineRegistry } from "@serimo/core/timeline-registry";
|
|
|
4
4
|
import { createContext, createElement, forwardRef, isValidElement, useContext, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { getFrameState } from "@serimo/core/clock";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
// src/composition-timing.ts
|
|
7
|
+
// src/composition/composition-timing.ts
|
|
8
8
|
const CompositionFps = createContext(null);
|
|
9
|
-
// src/
|
|
10
|
-
const
|
|
11
|
-
function
|
|
9
|
+
// src/audio/prepared-pcm.ts
|
|
10
|
+
const PCM_SAMPLE_RATE = 48e3;
|
|
11
|
+
function inspectPreparedPcm(bytes, required) {
|
|
12
12
|
const invalid = () => /* @__PURE__ */ new Error("E_ASSET: prepared audio must be sufficient PCM16 48 kHz mono or stereo WAV");
|
|
13
|
-
if (bytes.byteLength < 44 || bytes.byteLength >
|
|
13
|
+
if (bytes.byteLength < 44 || bytes.byteLength > 268435456) throw invalid();
|
|
14
14
|
const view = new DataView(bytes);
|
|
15
15
|
const text = (offset) => String.fromCharCode(...new Uint8Array(bytes, offset, 4));
|
|
16
16
|
if (text(0) !== "RIFF" || text(8) !== "WAVE" || view.getUint32(4, true) + 8 !== bytes.byteLength) throw invalid();
|
|
@@ -37,12 +37,12 @@ function inspectPCM(bytes, required) {
|
|
|
37
37
|
samples
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
async function
|
|
40
|
+
async function readPreparedPcm(src, signal) {
|
|
41
41
|
const response = await fetch(src, {
|
|
42
42
|
signal,
|
|
43
43
|
credentials: "omit"
|
|
44
44
|
});
|
|
45
|
-
if (!response.ok || !response.body || Number(response.headers.get("content-length") ?? 0) >
|
|
45
|
+
if (!response.ok || !response.body || Number(response.headers.get("content-length") ?? 0) > 268435456) throw new Error("E_ASSET: prepared PCM audio unavailable or too large");
|
|
46
46
|
const native = response.clone();
|
|
47
47
|
const reader = response.body.getReader();
|
|
48
48
|
let size = 0;
|
|
@@ -52,7 +52,7 @@ async function readPCM(src, signal) {
|
|
|
52
52
|
const { done, value } = await reader.read();
|
|
53
53
|
if (done) break;
|
|
54
54
|
size += value.byteLength;
|
|
55
|
-
if (size >
|
|
55
|
+
if (size > 268435456) throw new Error("E_ASSET: prepared PCM audio exceeds its size limit");
|
|
56
56
|
}
|
|
57
57
|
} catch (error) {
|
|
58
58
|
await Promise.allSettled([reader.cancel(), native.body?.cancel()]);
|
|
@@ -64,10 +64,22 @@ async function readPCM(src, signal) {
|
|
|
64
64
|
if (bytes.byteLength !== size) throw new Error("E_ASSET: prepared PCM byte count changed");
|
|
65
65
|
return bytes;
|
|
66
66
|
}
|
|
67
|
+
// src/audio/player-audio.ts
|
|
68
|
+
async function waitForOutputClock(context, assertCurrent) {
|
|
69
|
+
while (true) {
|
|
70
|
+
assertCurrent();
|
|
71
|
+
const { contextTime, performanceTime } = context.getOutputTimestamp();
|
|
72
|
+
if (typeof contextTime === "number" && contextTime > 0 && Number.isFinite(contextTime) && typeof performanceTime === "number" && performanceTime > 0 && Number.isFinite(performanceTime)) return {
|
|
73
|
+
contextTime,
|
|
74
|
+
performanceTime
|
|
75
|
+
};
|
|
76
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
67
79
|
function createPlayerAudio(composition, signal) {
|
|
68
80
|
const tracks = getAudioTracks(composition.audio);
|
|
69
81
|
if (!tracks.length) throw new Error("E_ASSET: audio declaration missing");
|
|
70
|
-
const context = new AudioContext({ sampleRate:
|
|
82
|
+
const context = new AudioContext({ sampleRate: PCM_SAMPLE_RATE });
|
|
71
83
|
const controller = new AbortController();
|
|
72
84
|
const activeSignal = AbortSignal.any([signal, controller.signal]);
|
|
73
85
|
const gains = tracks.map((track) => {
|
|
@@ -112,13 +124,13 @@ function createPlayerAudio(composition, signal) {
|
|
|
112
124
|
let bytesTotal = 0;
|
|
113
125
|
let channels = 1;
|
|
114
126
|
for (const track of tracks) {
|
|
115
|
-
const required = Math.ceil(track.durationInFrames *
|
|
127
|
+
const required = Math.ceil(track.durationInFrames * PCM_SAMPLE_RATE / composition.fps);
|
|
116
128
|
let decoded = buffers.get(track.src);
|
|
117
129
|
if (!decoded) {
|
|
118
|
-
const bytes = await
|
|
130
|
+
const bytes = await readPreparedPcm(track.src, activeSignal);
|
|
119
131
|
bytesTotal += bytes.byteLength;
|
|
120
|
-
if (bytesTotal >
|
|
121
|
-
const pcm =
|
|
132
|
+
if (bytesTotal > 536870912) throw new Error("E_ASSET: prepared PCM audio exceeds its session size limit");
|
|
133
|
+
const pcm = inspectPreparedPcm(bytes, required);
|
|
122
134
|
decoded = await context.decodeAudioData(bytes);
|
|
123
135
|
activeSignal.throwIfAborted();
|
|
124
136
|
if (decoded.sampleRate !== 48e3 || decoded.numberOfChannels !== pcm.channels || decoded.length !== pcm.samples) throw new Error("E_ASSET: decoded PCM audio does not match its prepared samples");
|
|
@@ -151,48 +163,42 @@ function createPlayerAudio(composition, signal) {
|
|
|
151
163
|
const resume = context.resume();
|
|
152
164
|
return (async () => {
|
|
153
165
|
let timer;
|
|
154
|
-
const
|
|
166
|
+
const assertCurrent = () => {
|
|
155
167
|
if (generation !== version || disposed || activeSignal.aborted) throw new DOMException("Stale audio playback", "AbortError");
|
|
156
168
|
};
|
|
157
169
|
try {
|
|
158
|
-
const
|
|
159
|
-
while (true) {
|
|
160
|
-
check();
|
|
161
|
-
const stamp = context.getOutputTimestamp();
|
|
162
|
-
if (Number.isFinite(stamp.contextTime) && Number.isFinite(stamp.performanceTime) && stamp.contextTime > 0 && stamp.performanceTime > 0) return stamp;
|
|
163
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
164
|
-
}
|
|
165
|
-
}), new Promise((_resolve, reject) => {
|
|
170
|
+
const { contextTime, performanceTime } = await Promise.race([resume.then(() => waitForOutputClock(context, assertCurrent)), new Promise((_resolve, reject) => {
|
|
166
171
|
timer = setTimeout(() => {
|
|
167
172
|
if (generation === version) pause();
|
|
168
173
|
reject(/* @__PURE__ */ new Error("E_ASSET: audio activation blocked or output clock unavailable"));
|
|
169
174
|
}, 1e3);
|
|
170
175
|
})]);
|
|
171
|
-
|
|
176
|
+
assertCurrent();
|
|
172
177
|
const start = context.currentTime + .05;
|
|
173
|
-
const
|
|
178
|
+
const { fps } = composition;
|
|
179
|
+
const seconds = frame / fps;
|
|
174
180
|
for (const [index, track] of tracks.entries()) {
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
181
|
+
const trackStart = track.startFrame / fps;
|
|
182
|
+
const offset = Math.max(0, seconds - trackStart);
|
|
183
|
+
const remaining = track.durationInFrames / fps - offset;
|
|
184
|
+
if (!(remaining > 0)) continue;
|
|
185
|
+
const source = context.createBufferSource();
|
|
186
|
+
source.buffer = buffers.get(track.src) ?? null;
|
|
187
|
+
const gain = gains[index];
|
|
188
|
+
if (!gain) throw new Error("E_ASSET: audio gain unavailable");
|
|
189
|
+
source.connect(gain);
|
|
190
|
+
source.onended = () => {
|
|
191
|
+
if (sources.delete(source)) source.disconnect();
|
|
192
|
+
};
|
|
193
|
+
try {
|
|
194
|
+
source.start(start + Math.max(0, trackStart - seconds), offset, remaining);
|
|
195
|
+
sources.add(source);
|
|
196
|
+
} catch (error) {
|
|
197
|
+
source.disconnect();
|
|
198
|
+
throw error;
|
|
193
199
|
}
|
|
194
200
|
}
|
|
195
|
-
return { originTimeMs: performance.timeOrigin +
|
|
201
|
+
return { originTimeMs: performance.timeOrigin + performanceTime + (start - contextTime) * 1e3 };
|
|
196
202
|
} catch (error) {
|
|
197
203
|
if (generation === version) pause();
|
|
198
204
|
throw error;
|
|
@@ -203,7 +209,7 @@ function createPlayerAudio(composition, signal) {
|
|
|
203
209
|
}
|
|
204
210
|
};
|
|
205
211
|
}
|
|
206
|
-
// src/player-session.ts
|
|
212
|
+
// src/composition/player-session.ts
|
|
207
213
|
function createPlayerSession(composition, registry) {
|
|
208
214
|
let current;
|
|
209
215
|
const stop = () => {
|
|
@@ -247,9 +253,10 @@ function createPlayerSession(composition, registry) {
|
|
|
247
253
|
} } : {}
|
|
248
254
|
};
|
|
249
255
|
return {
|
|
250
|
-
|
|
256
|
+
handle,
|
|
251
257
|
start() {
|
|
252
258
|
const controller = new AbortController();
|
|
259
|
+
const { signal } = controller;
|
|
253
260
|
stop().catch((error) => controller.abort(error));
|
|
254
261
|
const active = {
|
|
255
262
|
controller,
|
|
@@ -259,20 +266,20 @@ function createPlayerSession(composition, registry) {
|
|
|
259
266
|
const timeout = setTimeout(() => {
|
|
260
267
|
controller.abort(/* @__PURE__ */ new Error("Player timelines were not ready within 10000ms"));
|
|
261
268
|
}, 1e4);
|
|
262
|
-
const abortReady = () => rejectReady(
|
|
269
|
+
const abortReady = () => rejectReady(signal.reason);
|
|
263
270
|
let rejectReady = () => {};
|
|
264
271
|
const cancelled = new Promise((_resolve, reject) => {
|
|
265
272
|
rejectReady = reject;
|
|
266
273
|
});
|
|
267
|
-
|
|
268
|
-
const ready = Promise.race([cancelled, Promise.all([registry.whenReady({ signal
|
|
269
|
-
|
|
274
|
+
signal.addEventListener("abort", abortReady, { once: true });
|
|
275
|
+
const ready = Promise.race([cancelled, Promise.all([registry.whenReady({ signal }), Promise.resolve().then(() => {
|
|
276
|
+
signal.throwIfAborted();
|
|
270
277
|
if (composition.audio) {
|
|
271
|
-
active.audio = createPlayerAudio(composition,
|
|
278
|
+
active.audio = createPlayerAudio(composition, signal);
|
|
272
279
|
return active.audio.ready;
|
|
273
280
|
}
|
|
274
281
|
})])]).then(() => {
|
|
275
|
-
|
|
282
|
+
signal.throwIfAborted();
|
|
276
283
|
registry.seek(0);
|
|
277
284
|
}).catch(async (error) => {
|
|
278
285
|
controller.abort(error);
|
|
@@ -280,7 +287,7 @@ function createPlayerSession(composition, registry) {
|
|
|
280
287
|
throw error;
|
|
281
288
|
}).finally(() => {
|
|
282
289
|
clearTimeout(timeout);
|
|
283
|
-
|
|
290
|
+
signal.removeEventListener("abort", abortReady);
|
|
284
291
|
});
|
|
285
292
|
active.ready = ready;
|
|
286
293
|
return ready;
|
|
@@ -1801,7 +1808,7 @@ function Spinner({ className, ...props }) {
|
|
|
1801
1808
|
...props
|
|
1802
1809
|
});
|
|
1803
1810
|
}
|
|
1804
|
-
// src/player-status.tsx
|
|
1811
|
+
// src/composition/player-status.tsx
|
|
1805
1812
|
function PlayerStatus({ state, error }) {
|
|
1806
1813
|
if (state === "loading") return /* @__PURE__ */ jsx(Spinner, { "aria-label": "Composition loading" });
|
|
1807
1814
|
if (state === "error") return /* @__PURE__ */ jsxs(Alert, {
|
|
@@ -1810,52 +1817,41 @@ function PlayerStatus({ state, error }) {
|
|
|
1810
1817
|
});
|
|
1811
1818
|
return null;
|
|
1812
1819
|
}
|
|
1813
|
-
// src/composition-player.tsx
|
|
1814
|
-
function
|
|
1815
|
-
const
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
+
// src/composition/composition-player.tsx
|
|
1821
|
+
function prepareComposition(composition, components) {
|
|
1822
|
+
const validated = validateComposition(composition);
|
|
1823
|
+
const registry = createTimelineRegistry(validated);
|
|
1824
|
+
const clips = validated.clips.slice().sort((left, right) => left.layer - right.layer).map((clip) => {
|
|
1825
|
+
const renderComponent = Object.hasOwn(components, clip.component) ? components[clip.component] : void 0;
|
|
1826
|
+
if (typeof renderComponent !== "function") throw new RangeError(`Unknown player component: ${clip.component}`);
|
|
1827
|
+
const element = renderComponent({
|
|
1828
|
+
clip,
|
|
1820
1829
|
registry,
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
inset: 0
|
|
1842
|
-
},
|
|
1843
|
-
children: element
|
|
1844
|
-
}, clip.id);
|
|
1845
|
-
})
|
|
1846
|
-
};
|
|
1847
|
-
}, [composition, components]);
|
|
1848
|
-
const session = useMemo(() => createPlayerSession(validated, registry), [validated, registry]);
|
|
1830
|
+
durationSeconds: clip.durationInFrames / validated.fps
|
|
1831
|
+
});
|
|
1832
|
+
if (!isValidElement(element)) throw new TypeError(`Component ${clip.component} must return a React element`);
|
|
1833
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1834
|
+
"data-clip-id": clip.id,
|
|
1835
|
+
style: {
|
|
1836
|
+
position: "absolute",
|
|
1837
|
+
inset: 0
|
|
1838
|
+
},
|
|
1839
|
+
children: element
|
|
1840
|
+
}, clip.id);
|
|
1841
|
+
});
|
|
1842
|
+
return {
|
|
1843
|
+
validated,
|
|
1844
|
+
session: createPlayerSession(validated, registry),
|
|
1845
|
+
clips
|
|
1846
|
+
};
|
|
1847
|
+
}
|
|
1848
|
+
function CompositionPlayer({ composition, components, ref }) {
|
|
1849
|
+
const { validated, session, clips } = useMemo(() => prepareComposition(composition, components), [composition, components]);
|
|
1849
1850
|
const [status, setStatus] = useState({
|
|
1850
1851
|
session,
|
|
1851
1852
|
state: "loading"
|
|
1852
1853
|
});
|
|
1853
|
-
useImperativeHandle(ref, () => ({
|
|
1854
|
-
whenReady: session.whenReady,
|
|
1855
|
-
seek: session.seek,
|
|
1856
|
-
getComposition: session.getComposition,
|
|
1857
|
-
...session.audio ? { audio: session.audio } : {}
|
|
1858
|
-
}), [session]);
|
|
1854
|
+
useImperativeHandle(ref, () => ({ ...session.handle }), [session]);
|
|
1859
1855
|
useLayoutEffect(() => {
|
|
1860
1856
|
let active = true;
|
|
1861
1857
|
session.start().then(() => {
|
|
@@ -1901,18 +1897,16 @@ function CompositionPlayer({ composition, components, ref }) {
|
|
|
1901
1897
|
error: currentStatus.error
|
|
1902
1898
|
})] });
|
|
1903
1899
|
}
|
|
1904
|
-
// src/renderer-bridge.tsx
|
|
1900
|
+
// src/composition/renderer-bridge.tsx
|
|
1905
1901
|
function CompositionPlayerBridge(props) {
|
|
1906
1902
|
const playerRef = useRef(null);
|
|
1907
1903
|
useLayoutEffect(() => {
|
|
1908
1904
|
const browserWindow = window;
|
|
1909
1905
|
if (browserWindow.__serimoRenderer) throw new Error("Renderer bridge already installed");
|
|
1910
|
-
|
|
1911
|
-
let active = true;
|
|
1906
|
+
let installedPlayer = playerRef.current;
|
|
1912
1907
|
const currentPlayer = () => {
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
return player;
|
|
1908
|
+
if (!installedPlayer || playerRef.current !== installedPlayer) throw new Error("Player is not mounted");
|
|
1909
|
+
return installedPlayer;
|
|
1916
1910
|
};
|
|
1917
1911
|
const bridge = {
|
|
1918
1912
|
async whenReady() {
|
|
@@ -1933,14 +1927,15 @@ function CompositionPlayerBridge(props) {
|
|
|
1933
1927
|
}
|
|
1934
1928
|
},
|
|
1935
1929
|
pause() {
|
|
1936
|
-
|
|
1930
|
+
installedPlayer?.audio?.pause();
|
|
1937
1931
|
}
|
|
1938
1932
|
} } : {}
|
|
1939
1933
|
};
|
|
1940
1934
|
browserWindow.__serimoRenderer = bridge;
|
|
1941
1935
|
return () => {
|
|
1942
|
-
|
|
1943
|
-
installedPlayer
|
|
1936
|
+
const player = installedPlayer;
|
|
1937
|
+
installedPlayer = null;
|
|
1938
|
+
player?.audio?.pause();
|
|
1944
1939
|
if (browserWindow.__serimoRenderer === bridge) delete browserWindow.__serimoRenderer;
|
|
1945
1940
|
};
|
|
1946
1941
|
}, [props.composition, props.components]);
|
|
@@ -1949,7 +1944,15 @@ function CompositionPlayerBridge(props) {
|
|
|
1949
1944
|
ref: playerRef
|
|
1950
1945
|
});
|
|
1951
1946
|
}
|
|
1952
|
-
// src/image-
|
|
1947
|
+
// src/image/image-accessibility.ts
|
|
1948
|
+
function getImageAccessibilityProps(alt) {
|
|
1949
|
+
return {
|
|
1950
|
+
role: alt ? "img" : "presentation",
|
|
1951
|
+
"aria-label": alt || void 0,
|
|
1952
|
+
"aria-hidden": alt ? void 0 : true
|
|
1953
|
+
};
|
|
1954
|
+
}
|
|
1955
|
+
// src/image/image-resources.ts
|
|
1953
1956
|
const stores = /* @__PURE__ */ new WeakMap();
|
|
1954
1957
|
const MAX_DATA = 536870912;
|
|
1955
1958
|
function imageStore(document) {
|
|
@@ -2076,7 +2079,8 @@ function acquireImageFrame(frame, width, height, document = globalThis.document)
|
|
|
2076
2079
|
ready,
|
|
2077
2080
|
width,
|
|
2078
2081
|
height,
|
|
2079
|
-
bytes: frame.bytes
|
|
2082
|
+
bytes: frame.bytes,
|
|
2083
|
+
finish
|
|
2080
2084
|
};
|
|
2081
2085
|
store.entries.set(key, resource);
|
|
2082
2086
|
}
|
|
@@ -2091,15 +2095,11 @@ function acquireImageFrame(frame, width, height, document = globalThis.document)
|
|
|
2091
2095
|
if (--state.references) return;
|
|
2092
2096
|
state.controller.abort();
|
|
2093
2097
|
if (store.entries.get(key) === held) store.entries.delete(key);
|
|
2094
|
-
if (state.complete
|
|
2095
|
-
state.finished = true;
|
|
2096
|
-
state.bitmap?.close();
|
|
2097
|
-
store.used -= width * height * 4;
|
|
2098
|
-
}
|
|
2098
|
+
if (state.complete) held.finish();
|
|
2099
2099
|
}
|
|
2100
2100
|
};
|
|
2101
2101
|
}
|
|
2102
|
-
// src/image-sequence.ts
|
|
2102
|
+
// src/image/image-sequence.ts
|
|
2103
2103
|
function gcd(left, right) {
|
|
2104
2104
|
while (right) [left, right] = [right, left % right];
|
|
2105
2105
|
return left;
|
|
@@ -2115,16 +2115,18 @@ function createImageSequence(frames, plays, fps) {
|
|
|
2115
2115
|
};
|
|
2116
2116
|
});
|
|
2117
2117
|
const denominator = timings.reduce((value, time) => value / gcd(value, time.denominator) * time.denominator, 1n);
|
|
2118
|
+
const frameRate = BigInt(fps);
|
|
2118
2119
|
let total = 0n;
|
|
2119
2120
|
const ends = timings.map((time) => {
|
|
2120
2121
|
total += time.numerator * (denominator / time.denominator);
|
|
2121
|
-
return total *
|
|
2122
|
+
return total * frameRate;
|
|
2122
2123
|
});
|
|
2123
|
-
const period = total *
|
|
2124
|
+
const period = total * frameRate;
|
|
2125
|
+
const endOfPlayback = plays === "infinite" ? void 0 : period * BigInt(plays);
|
|
2124
2126
|
return (localFrame) => {
|
|
2125
2127
|
if (!Number.isSafeInteger(localFrame) || localFrame < 0) throw Error("E_ASSET: invalid image seek frame");
|
|
2126
2128
|
const elapsed = BigInt(localFrame) * denominator;
|
|
2127
|
-
if (
|
|
2129
|
+
if (endOfPlayback !== void 0 && elapsed >= endOfPlayback) return frames.length - 1;
|
|
2128
2130
|
const position = elapsed % period;
|
|
2129
2131
|
let lower = 0;
|
|
2130
2132
|
let upper = ends.length - 1;
|
|
@@ -2138,7 +2140,7 @@ function createImageSequence(frames, plays, fps) {
|
|
|
2138
2140
|
return lower;
|
|
2139
2141
|
};
|
|
2140
2142
|
}
|
|
2141
|
-
// src/image-svg-animation.ts
|
|
2143
|
+
// src/image/image-svg-animation.ts
|
|
2142
2144
|
function prepareSvgAnimations(root) {
|
|
2143
2145
|
const originals = root.getAnimations({ subtree: true });
|
|
2144
2146
|
const effects = originals.map((animation) => {
|
|
@@ -2205,7 +2207,7 @@ function prepareSvgAnimations(root) {
|
|
|
2205
2207
|
}
|
|
2206
2208
|
};
|
|
2207
2209
|
}
|
|
2208
|
-
// src/image-svg.
|
|
2210
|
+
// src/image/image-svg-validation.ts
|
|
2209
2211
|
const tags = new Set("svg g defs rect circle ellipse path polygon polyline line text tspan title desc use linearGradient radialGradient stop clipPath mask style animate animateTransform animateMotion mpath set".split(" "));
|
|
2210
2212
|
const attributes = new Set("xmlns xmlns:xlink id class style viewBox width height x y x1 x2 y1 y2 cx cy r rx ry d points dx dy fill fill-opacity fill-rule stroke stroke-width stroke-opacity stroke-linecap stroke-linejoin stroke-dasharray stroke-dashoffset opacity transform preserveAspectRatio href xlink:href offset stop-color stop-opacity gradientUnits gradientTransform spreadMethod clip-path clipPathUnits mask maskUnits maskContentUnits font-family font-size font-weight font-style text-anchor dominant-baseline attributeName from to by values keyTimes keySplines keyPoints calcMode type path rotate begin dur end repeatCount repeatDur additive accumulate restart".split(" "));
|
|
2211
2213
|
const animated = new Set("x y x1 x2 y1 y2 cx cy r rx ry d points opacity fill fill-opacity stroke stroke-width stroke-opacity transform".split(" "));
|
|
@@ -2227,7 +2229,7 @@ const defaults = /* @__PURE__ */ new Map([
|
|
|
2227
2229
|
["mask-mode", "match-source"]
|
|
2228
2230
|
]);
|
|
2229
2231
|
const properties = new Set("animation animation-name animation-duration animation-delay animation-direction animation-fill-mode animation-iteration-count animation-play-state animation-timing-function animation-composition transform transform-origin transform-box translate rotate scale opacity fill fill-opacity fill-rule stroke stroke-width stroke-opacity stroke-linecap stroke-linejoin stroke-dasharray stroke-dashoffset clip-path mask stop-color stop-opacity color visibility display x y cx cy r rx ry d".split(" "));
|
|
2230
|
-
function
|
|
2232
|
+
function rejectPreparedSvg() {
|
|
2231
2233
|
throw Error("E_ASSET: invalid or unsupported prepared SVG");
|
|
2232
2234
|
}
|
|
2233
2235
|
function inspectSvgTree(tree, bytes, width, height) {
|
|
@@ -2236,11 +2238,11 @@ function inspectSvgTree(tree, bytes, width, height) {
|
|
|
2236
2238
|
const seen = /* @__PURE__ */ new Set();
|
|
2237
2239
|
const styles = [];
|
|
2238
2240
|
const walk = (node, depth) => {
|
|
2239
|
-
if (!node || typeof node !== "object" || seen.has(node) || ++count > 1e4 || depth > 128 || !tags.has(node.tag) || !node.attributes || typeof node.attributes !== "object" || !Array.isArray(node.children) || Object.keys(node.attributes).length > 128)
|
|
2241
|
+
if (!node || typeof node !== "object" || seen.has(node) || ++count > 1e4 || depth > 128 || !tags.has(node.tag) || !node.attributes || typeof node.attributes !== "object" || !Array.isArray(node.children) || Object.keys(node.attributes).length > 128) rejectPreparedSvg();
|
|
2240
2242
|
seen.add(node);
|
|
2241
2243
|
if (node.tag === "mask") {
|
|
2242
2244
|
const units = node.attributes.maskUnits ?? "objectBoundingBox";
|
|
2243
|
-
if (!["objectBoundingBox", "userSpaceOnUse"].includes(units))
|
|
2245
|
+
if (!["objectBoundingBox", "userSpaceOnUse"].includes(units)) rejectPreparedSvg();
|
|
2244
2246
|
for (const name of [
|
|
2245
2247
|
"x",
|
|
2246
2248
|
"y",
|
|
@@ -2249,22 +2251,22 @@ function inspectSvgTree(tree, bytes, width, height) {
|
|
|
2249
2251
|
]) {
|
|
2250
2252
|
const value = node.attributes[name];
|
|
2251
2253
|
if (value === void 0) continue;
|
|
2252
|
-
if (!/^-?(?:\d+(?:\.\d*)?|\.\d+)%?$/.test(value))
|
|
2254
|
+
if (!/^-?(?:\d+(?:\.\d*)?|\.\d+)%?$/.test(value)) rejectPreparedSvg();
|
|
2253
2255
|
const positive = name === "width" || name === "height";
|
|
2254
2256
|
const limit = value.endsWith("%") ? positive ? 200 : 100 : units === "objectBoundingBox" ? positive ? 2 : 1 : (name === "x" || name === "width" ? width : height) * (positive ? 2 : 1);
|
|
2255
2257
|
const number = parseFloat(value);
|
|
2256
|
-
if (!Number.isFinite(number) || Math.abs(number) > limit || positive && number <= 0)
|
|
2258
|
+
if (!Number.isFinite(number) || Math.abs(number) > limit || positive && number <= 0) rejectPreparedSvg();
|
|
2257
2259
|
}
|
|
2258
2260
|
}
|
|
2259
2261
|
for (const [name, value] of Object.entries(node.attributes)) {
|
|
2260
|
-
if (!attributes.has(name) && !/^data-[a-z-]+$/.test(name) || typeof value !== "string")
|
|
2262
|
+
if (!attributes.has(name) && !/^data-[a-z-]+$/.test(name) || typeof value !== "string") rejectPreparedSvg();
|
|
2261
2263
|
characters += name.length + value.length;
|
|
2262
|
-
if (characters > bytes)
|
|
2264
|
+
if (characters > bytes) rejectPreparedSvg();
|
|
2263
2265
|
if (name === "id") {
|
|
2264
|
-
if (!/^[a-zA-Z_][\w.-]*$/.test(value) || ids.has(value))
|
|
2266
|
+
if (!/^[a-zA-Z_][\w.-]*$/.test(value) || ids.has(value)) rejectPreparedSvg();
|
|
2265
2267
|
ids.set(value, node);
|
|
2266
2268
|
}
|
|
2267
|
-
if ((name === "href" || name === "xlink:href") && !/^#[a-zA-Z_][\w.-]*$/.test(value))
|
|
2269
|
+
if ((name === "href" || name === "xlink:href") && !/^#[a-zA-Z_][\w.-]*$/.test(value)) rejectPreparedSvg();
|
|
2268
2270
|
if (name === "style") styles.push(`.inline{${value}}`);
|
|
2269
2271
|
if (paints.has(name) && !(name === "fill" && [
|
|
2270
2272
|
"animate",
|
|
@@ -2278,12 +2280,12 @@ function inspectSvgTree(tree, bytes, width, height) {
|
|
|
2278
2280
|
"dur",
|
|
2279
2281
|
"repeatDur"
|
|
2280
2282
|
].includes(name)) {
|
|
2281
|
-
for (const time of value.split(";")) if (!/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:ms|s)?$/.test(time.trim()) || !Number.isFinite(parseFloat(time)))
|
|
2283
|
+
for (const time of value.split(";")) if (!/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:ms|s)?$/.test(time.trim()) || !Number.isFinite(parseFloat(time))) rejectPreparedSvg();
|
|
2282
2284
|
}
|
|
2283
2285
|
}
|
|
2284
2286
|
if (["animate", "set"].includes(node.tag)) {
|
|
2285
2287
|
const name = node.attributes.attributeName ?? "";
|
|
2286
|
-
if (!animated.has(name))
|
|
2288
|
+
if (!animated.has(name)) rejectPreparedSvg();
|
|
2287
2289
|
if (paints.has(name)) for (const attr of [
|
|
2288
2290
|
"from",
|
|
2289
2291
|
"to",
|
|
@@ -2292,20 +2294,20 @@ function inspectSvgTree(tree, bytes, width, height) {
|
|
|
2292
2294
|
]) for (const value of (node.attributes[attr] ?? "").split(";").filter(Boolean)) styles.push(`.paint{${name}:${value}}`);
|
|
2293
2295
|
}
|
|
2294
2296
|
if (node.tag === "style") {
|
|
2295
|
-
if (node.children.some((child) => typeof child !== "string"))
|
|
2297
|
+
if (node.children.some((child) => typeof child !== "string")) rejectPreparedSvg();
|
|
2296
2298
|
styles.push(node.children.join(""));
|
|
2297
2299
|
}
|
|
2298
2300
|
for (const child of node.children) if (typeof child === "string") {
|
|
2299
|
-
if (++count > 1e4)
|
|
2301
|
+
if (++count > 1e4) rejectPreparedSvg();
|
|
2300
2302
|
characters += child.length;
|
|
2301
|
-
if (characters > bytes)
|
|
2303
|
+
if (characters > bytes) rejectPreparedSvg();
|
|
2302
2304
|
} else walk(child, depth + 1);
|
|
2303
2305
|
};
|
|
2304
2306
|
walk(tree, 0);
|
|
2305
2307
|
const visiting = /* @__PURE__ */ new Set(), costs = /* @__PURE__ */ new Map();
|
|
2306
2308
|
const maskCosts = /* @__PURE__ */ new Map();
|
|
2307
2309
|
const expansion = (node, depth) => {
|
|
2308
|
-
if (visiting.has(node) || depth > 128) return
|
|
2310
|
+
if (visiting.has(node) || depth > 128) return rejectPreparedSvg();
|
|
2309
2311
|
const cached = costs.get(node);
|
|
2310
2312
|
if (cached !== void 0) return cached;
|
|
2311
2313
|
visiting.add(node);
|
|
@@ -2320,12 +2322,12 @@ function inspectSvgTree(tree, bytes, width, height) {
|
|
|
2320
2322
|
const href = node.attributes[name];
|
|
2321
2323
|
if (href) {
|
|
2322
2324
|
const target = ids.get(href.slice(1));
|
|
2323
|
-
if (!target) return
|
|
2325
|
+
if (!target) return rejectPreparedSvg();
|
|
2324
2326
|
cost += expansion(target, depth + 1);
|
|
2325
2327
|
masks += maskCosts.get(target) ?? 0;
|
|
2326
2328
|
}
|
|
2327
2329
|
}
|
|
2328
|
-
if (cost > 1e4) return
|
|
2330
|
+
if (cost > 1e4) return rejectPreparedSvg();
|
|
2329
2331
|
visiting.delete(node);
|
|
2330
2332
|
costs.set(node, cost);
|
|
2331
2333
|
maskCosts.set(node, masks);
|
|
@@ -2338,45 +2340,46 @@ function inspectSvgTree(tree, bytes, width, height) {
|
|
|
2338
2340
|
masks: maskCosts.get(tree) ?? 0
|
|
2339
2341
|
};
|
|
2340
2342
|
}
|
|
2341
|
-
function
|
|
2343
|
+
function validateSvgStyles(styles, ids, nodes) {
|
|
2342
2344
|
let cssCharacters = 0, cssFrames = 0, cssRules = 0, cssBraces = 0, animationNames = 0;
|
|
2343
2345
|
for (const style of styles) {
|
|
2344
2346
|
cssCharacters += style.length;
|
|
2345
2347
|
cssBraces += style.match(/{/g)?.length ?? 0;
|
|
2346
|
-
if (cssBraces > 1e4)
|
|
2347
|
-
if (/\\|@(?!keyframes\b)|:host|::|:(?:hover|active|focus|focus-within|focus-visible|target|visited|link|checked|disabled|enabled|state)\b|var\(|env\(|attr\(|image-set\(|cross-fade\(|paint\(|image\(|(?:animation|scroll|view)-timeline\s*:|transition(?:-[\w-]+)?\s*:/i.test(style))
|
|
2348
|
+
if (cssBraces > 1e4) rejectPreparedSvg();
|
|
2349
|
+
if (/\\|@(?!keyframes\b)|:host|::|:(?:hover|active|focus|focus-within|focus-visible|target|visited|link|checked|disabled|enabled|state)\b|var\(|env\(|attr\(|image-set\(|cross-fade\(|paint\(|image\(|(?:animation|scroll|view)-timeline\s*:|transition(?:-[\w-]+)?\s*:/i.test(style)) rejectPreparedSvg();
|
|
2348
2350
|
const sheet = new CSSStyleSheet();
|
|
2349
2351
|
sheet.replaceSync(style);
|
|
2350
2352
|
const visit = (rules) => {
|
|
2351
2353
|
for (const rule of rules) {
|
|
2352
|
-
if (++cssRules > 1e4)
|
|
2354
|
+
if (++cssRules > 1e4) rejectPreparedSvg();
|
|
2353
2355
|
if (rule instanceof CSSKeyframesRule) {
|
|
2354
2356
|
cssFrames += rule.cssRules.length;
|
|
2355
|
-
if (cssFrames > 1e3)
|
|
2357
|
+
if (cssFrames > 1e3) rejectPreparedSvg();
|
|
2356
2358
|
visit(rule.cssRules);
|
|
2357
2359
|
} else if (rule instanceof CSSStyleRule || rule instanceof CSSKeyframeRule) {
|
|
2358
2360
|
const names = rule.style.getPropertyValue("animation-name");
|
|
2359
2361
|
if (names && names !== "none") animationNames = Math.max(animationNames, names.split(",").length);
|
|
2360
|
-
if (animationNames > 1e3)
|
|
2362
|
+
if (animationNames > 1e3) rejectPreparedSvg();
|
|
2361
2363
|
for (const name of rule.style) {
|
|
2362
|
-
if (rule instanceof CSSKeyframeRule && (name === "display" || name === "visibility"))
|
|
2364
|
+
if (rule instanceof CSSKeyframeRule && (name === "display" || name === "visibility")) rejectPreparedSvg();
|
|
2363
2365
|
const value = rule.style.getPropertyValue(name);
|
|
2364
2366
|
if (defaults.get(name) === value) continue;
|
|
2365
2367
|
if (name === "animation-timeline" && value === "auto" || (name === "animation-range-start" || name === "animation-range-end") && value === "normal") continue;
|
|
2366
|
-
if (!properties.has(name) && name !== "mask-image")
|
|
2368
|
+
if (!properties.has(name) && name !== "mask-image") rejectPreparedSvg();
|
|
2367
2369
|
const remainder = value.replace(/url\(\s*["']?(#[a-zA-Z_][\w.-]*)["']?\s*\)/gi, (_match, target) => {
|
|
2368
|
-
if (!ids.has(target.slice(1)))
|
|
2370
|
+
if (!ids.has(target.slice(1))) rejectPreparedSvg();
|
|
2369
2371
|
return "";
|
|
2370
2372
|
});
|
|
2371
|
-
if (/url\s*\(|\\|image-set\(|cross-fade\(|image\(|attr\(|var\(|env\(/i.test(remainder))
|
|
2373
|
+
if (/url\s*\(|\\|image-set\(|cross-fade\(|image\(|attr\(|var\(|env\(/i.test(remainder)) rejectPreparedSvg();
|
|
2372
2374
|
}
|
|
2373
|
-
} else
|
|
2375
|
+
} else rejectPreparedSvg();
|
|
2374
2376
|
}
|
|
2375
2377
|
};
|
|
2376
2378
|
visit(sheet.cssRules);
|
|
2377
2379
|
}
|
|
2378
2380
|
return nodes * animationNames * (cssCharacters * 4 + (cssFrames + 1) * 2048);
|
|
2379
2381
|
}
|
|
2382
|
+
// src/image/image-svg.tsx
|
|
2380
2383
|
function SvgImageAsset({ asset, clipId, registry, alt, className, style }) {
|
|
2381
2384
|
const ref = useRef(null);
|
|
2382
2385
|
const [failure, setFailure] = useState();
|
|
@@ -2401,10 +2404,10 @@ function SvgImageAsset({ asset, clipId, registry, alt, className, style }) {
|
|
|
2401
2404
|
const prepare = async () => {
|
|
2402
2405
|
try {
|
|
2403
2406
|
const { tree, bytes } = asset;
|
|
2404
|
-
if (!tree || tree.tag !== "svg" || !Number.isSafeInteger(bytes) || !bytes || bytes < 1 || bytes > 67108864 || asset.frames.length || asset.plays !== 1)
|
|
2407
|
+
if (!tree || tree.tag !== "svg" || !Number.isSafeInteger(bytes) || !bytes || bytes < 1 || bytes > 67108864 || asset.frames.length || asset.plays !== 1) rejectPreparedSvg();
|
|
2405
2408
|
const inspected = inspectSvgTree(tree, bytes, asset.width, asset.height);
|
|
2406
2409
|
release = reserveImageData(bytes * 24 + asset.width * asset.height * (16 + 64 * inspected.masks * inspected.nodes) + inspected.nodes * 1024, host.ownerDocument);
|
|
2407
|
-
const cssBytes =
|
|
2410
|
+
const cssBytes = validateSvgStyles(inspected.styles, inspected.ids, inspected.nodes);
|
|
2408
2411
|
if (cssBytes) releaseCss = reserveImageData(cssBytes, host.ownerDocument);
|
|
2409
2412
|
const build = (node) => {
|
|
2410
2413
|
if (typeof node === "string") return host.ownerDocument.createTextNode(node);
|
|
@@ -2415,7 +2418,7 @@ function SvgImageAsset({ asset, clipId, registry, alt, className, style }) {
|
|
|
2415
2418
|
return element;
|
|
2416
2419
|
};
|
|
2417
2420
|
const root = build(tree);
|
|
2418
|
-
if (!(root instanceof SVGSVGElement)) return
|
|
2421
|
+
if (!(root instanceof SVGSVGElement)) return rejectPreparedSvg();
|
|
2419
2422
|
root.style.width = "100%";
|
|
2420
2423
|
root.style.height = "100%";
|
|
2421
2424
|
root.style.display = "block";
|
|
@@ -2455,9 +2458,7 @@ function SvgImageAsset({ asset, clipId, registry, alt, className, style }) {
|
|
|
2455
2458
|
return /* @__PURE__ */ jsx("div", {
|
|
2456
2459
|
ref,
|
|
2457
2460
|
className,
|
|
2458
|
-
|
|
2459
|
-
"aria-label": alt || void 0,
|
|
2460
|
-
"aria-hidden": alt ? void 0 : true,
|
|
2461
|
+
...getImageAccessibilityProps(alt),
|
|
2461
2462
|
style: {
|
|
2462
2463
|
width: asset.width,
|
|
2463
2464
|
height: asset.height,
|
|
@@ -2467,7 +2468,7 @@ function SvgImageAsset({ asset, clipId, registry, alt, className, style }) {
|
|
|
2467
2468
|
}
|
|
2468
2469
|
});
|
|
2469
2470
|
}
|
|
2470
|
-
// src/image-asset.tsx
|
|
2471
|
+
// src/image/image-asset.tsx
|
|
2471
2472
|
function ImageAsset(props) {
|
|
2472
2473
|
const { asset, alt } = props;
|
|
2473
2474
|
if (!asset || asset.schemaVersion !== 1 || !Number.isSafeInteger(asset.width) || !Number.isSafeInteger(asset.height) || asset.width < 1 || asset.height < 1 || asset.width > 8192 || asset.height > 8192 || asset.width * asset.height > 16777216 || typeof alt !== "string") throw Error("E_ASSET: invalid image declaration");
|
|
@@ -2477,7 +2478,7 @@ function RasterImageAsset({ asset, clipId, registry, alt, className, style }) {
|
|
|
2477
2478
|
const canvasRef = useRef(null);
|
|
2478
2479
|
const [failure, setFailure] = useState();
|
|
2479
2480
|
const fps = useContext(CompositionFps);
|
|
2480
|
-
if (
|
|
2481
|
+
if (asset.kind !== "static" && asset.kind !== "sequence" || !asset.frames?.length || asset.frames.length > 1e3 || asset.kind === "static" && (asset.frames.length !== 1 || asset.plays !== 1 || asset.frames[0]?.timing !== void 0) || asset.kind === "sequence" && fps === null) throw Error("E_ASSET: invalid image declaration");
|
|
2481
2482
|
useLayoutEffect(() => {
|
|
2482
2483
|
const canvas = canvasRef.current;
|
|
2483
2484
|
if (!canvas) throw Error("E_ASSET: missing image surface");
|
|
@@ -2542,9 +2543,7 @@ function RasterImageAsset({ asset, clipId, registry, alt, className, style }) {
|
|
|
2542
2543
|
return /* @__PURE__ */ jsx("canvas", {
|
|
2543
2544
|
ref: canvasRef,
|
|
2544
2545
|
className,
|
|
2545
|
-
|
|
2546
|
-
"aria-label": alt || void 0,
|
|
2547
|
-
"aria-hidden": alt ? void 0 : true,
|
|
2546
|
+
...getImageAccessibilityProps(alt),
|
|
2548
2547
|
style: {
|
|
2549
2548
|
display: "block",
|
|
2550
2549
|
width: asset.width,
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"composition-player.d.ts","sourceRoot":"","sources":["../src/composition-player.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAuB,MAAM,0BAA0B,CAAA;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,GAAG,EAMT,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,qBAAqB,CAAA;AAG5E,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,UAAU,CAAA;IAChB,QAAQ,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAA;IACnD,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,sBAAsB,KAAK,YAAY,CAAA;AAE/E,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC3C,GAAG,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,CAAA;CACxB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,UAAU,EACV,GAAG,EACJ,EAAE,sBAAsB,+BA4GxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"composition-timing.d.ts","sourceRoot":"","sources":["../src/composition-timing.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,wCAAqC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-asset-types.d.ts","sourceRoot":"","sources":["../src/image-asset-types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAA;CACpD;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC5C,QAAQ,EAAE,SAAS,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,CAAA;CAC9C;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,CAAC,CAAA;IAChB,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,KAAK,CAAA;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,GAAG,UAAU,CAAA;IAC1B,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAA;IACnC,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
|
package/dist/image-asset.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { createTimelineRegistry } from '@serimo/core/timeline-registry';
|
|
2
|
-
import { type CSSProperties } from 'react';
|
|
3
|
-
import type { FrozenImageAsset } from './image-asset-types.js';
|
|
4
|
-
export interface ImageAssetProps {
|
|
5
|
-
asset: FrozenImageAsset;
|
|
6
|
-
clipId: string;
|
|
7
|
-
registry: Pick<ReturnType<typeof createTimelineRegistry>, 'register'>;
|
|
8
|
-
alt: string;
|
|
9
|
-
className?: string;
|
|
10
|
-
style?: CSSProperties;
|
|
11
|
-
}
|
|
12
|
-
export declare function ImageAsset(props: ImageAssetProps): import("react").JSX.Element;
|
|
13
|
-
//# sourceMappingURL=image-asset.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-asset.d.ts","sourceRoot":"","sources":["../src/image-asset.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,OAAO,CAAA;AAGd,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAK9D,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,gBAAgB,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,EAAE,UAAU,CAAC,CAAA;IACrE,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,+BAoBhD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-resources.d.ts","sourceRoot":"","sources":["../src/image-resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAiC9D,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,QAA8B,GACvC,MAAM,IAAI,CAgBZ;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,QAA8B,GACvC;IAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAAC,OAAO,IAAI,IAAI,CAAA;CAAE,CA0KlD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-sequence.d.ts","sourceRoot":"","sources":["../src/image-sequence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAO9D,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,gBAAgB,EAAE,EACnC,KAAK,EAAE,MAAM,GAAG,UAAU,EAC1B,GAAG,EAAE,MAAM,GACV,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAoDhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-svg-animation.d.ts","sourceRoot":"","sources":["../src/image-svg-animation.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,aAAa;IAuDpD,IAAI,UAAU,MAAM;IA8BpB,OAAO;EAIV"}
|
package/dist/image-svg.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-svg.d.ts","sourceRoot":"","sources":["../src/image-svg.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAuCvD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;;;;;EA6If;AA+ED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,MAAM,EACN,QAAQ,EACR,GAAG,EACH,SAAS,EACT,KAAK,EACN,EAAE,eAAe,+BA0HjB"}
|
package/dist/player-audio.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type MotionAudioTrack, type MotionComposition } from '@serimo/core/composition';
|
|
2
|
-
export declare function createPlayerAudio(composition: Omit<MotionComposition, 'audio'> & {
|
|
3
|
-
audio?: MotionAudioTrack | MotionAudioTrack[];
|
|
4
|
-
}, signal: AbortSignal): {
|
|
5
|
-
ready: Promise<void>;
|
|
6
|
-
pause: () => void;
|
|
7
|
-
dispose: () => Promise<void>;
|
|
8
|
-
play(frame: number): Promise<{
|
|
9
|
-
originTimeMs: number;
|
|
10
|
-
}>;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=player-audio.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"player-audio.d.ts","sourceRoot":"","sources":["../src/player-audio.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EAGvB,MAAM,0BAA0B,CAAA;AAwFjC,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG;IAC9C,KAAK,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,CAAA;CAC9C,EACD,MAAM,EAAE,WAAW;;;;gBA6FL,MAAM,GAAG,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;EA8FzD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"player-session.d.ts","sourceRoot":"","sources":["../src/player-session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAI5E,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAEzD,MAAM,WAAW,YAAY;IAC3B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClC,cAAc,IAAI,IAAI,CACpB,iBAAiB,EACjB,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,kBAAkB,GAAG,OAAO,CACjE,CAAA;IACD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;YAAE,YAAY,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;QACtD,KAAK,IAAI,IAAI,CAAA;KACd,CAAA;CACF;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,iBAAiB,EAC9B,QAAQ,EAAE,QAAQ;iBAdL,OAAO,CAAC,IAAI,CAAC;gBACd,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;sBAChB,IAAI,CACpB,iBAAiB,EACjB,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,kBAAkB,GAAG,OAAO,CACjE;YACO;QACN,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;YAAE,YAAY,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;QACtD,KAAK,IAAI,IAAI,CAAA;KACd;;;EA2HF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"player-status.d.ts","sourceRoot":"","sources":["../src/player-status.tsx"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,KAAK,EACN,EAAE;IACD,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,sCAWA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renderer-bridge.d.ts","sourceRoot":"","sources":["../src/renderer-bridge.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAA;AAKhC,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,KAAK,CAAC,+BAuD3C"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|