@glissade/player 0.19.1 → 0.20.0-pre.4
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 +14 -0
- package/dist/index.d.ts +17 -3
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -13,6 +13,20 @@ const { player } = mount(scene, doc, canvas, { loop: true, autoplay: true });
|
|
|
13
13
|
player.seek(1.5); // pure: identical to having played there
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
### Custom render backend
|
|
17
|
+
|
|
18
|
+
`mount()` rasterizes through `Canvas2DBackend` by default. To drive a different
|
|
19
|
+
`RenderBackend` (e.g. a future `@glissade/backend-dom` preview renderer), pass a
|
|
20
|
+
factory as `opts.backend` — it receives the mount target and returns the backend:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
mount(scene, doc, canvas, { backend: (target) => new MyBackend(target) });
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Omit it and the default `Canvas2DBackend` is used, so every existing call site is
|
|
27
|
+
unchanged. This is the single injection seam: `@glissade/player` never statically
|
|
28
|
+
imports a non-default backend — the caller above it supplies the alternative.
|
|
29
|
+
|
|
16
30
|
## Part of glissade
|
|
17
31
|
|
|
18
32
|
*(glide & slide)* — programmatic motion graphics for TypeScript: realtime-first in any web page, deterministic headless video export from the same code, a visual studio over the same document. No generator functions.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Marker, Playhead, ReadonlySignal, Timeline } from "@glissade/core";
|
|
2
|
-
import { Scene } from "@glissade/scene";
|
|
3
|
-
import { Canvas2DBackend } from "@glissade/backend-canvas2d";
|
|
2
|
+
import { RenderBackend, Scene } from "@glissade/scene";
|
|
4
3
|
|
|
5
4
|
//#region src/driver.d.ts
|
|
6
5
|
|
|
@@ -85,6 +84,16 @@ interface PlayerOptions {
|
|
|
85
84
|
strictFonts?: boolean;
|
|
86
85
|
/** OS-installed families to treat as registered for strict mode. */
|
|
87
86
|
osFonts?: ReadonlySet<string>;
|
|
87
|
+
/**
|
|
88
|
+
* Backend-injection seam (dom-backend memo, Seam 2 — the S3 foundation). A
|
|
89
|
+
* factory that builds the `RenderBackend` mount() drives, given the render
|
|
90
|
+
* target. Defaults to `Canvas2DBackend`, so EVERY existing call site is
|
|
91
|
+
* byte-for-byte unchanged and the static `player → backend-canvas2d`
|
|
92
|
+
* dependency stands. The caller ABOVE player (element/react/an app) injects
|
|
93
|
+
* an alternative target (e.g. a future `@glissade/backend-dom`) here without
|
|
94
|
+
* forking the mount body — player itself gains no new static backend dep.
|
|
95
|
+
*/
|
|
96
|
+
backend?: (target: HTMLCanvasElement | OffscreenCanvas) => RenderBackend;
|
|
88
97
|
}
|
|
89
98
|
interface PlayHandle {
|
|
90
99
|
/** true = completed naturally, false = interrupted. Completion signal ONLY (§2). */
|
|
@@ -154,7 +163,12 @@ declare function createPlayer(init: PlayerInit, opts?: PlayerOptions): Player;
|
|
|
154
163
|
//#region src/mount.d.ts
|
|
155
164
|
interface Mounted {
|
|
156
165
|
player: Player;
|
|
157
|
-
|
|
166
|
+
/**
|
|
167
|
+
* The live render backend. `Canvas2DBackend` by default; the abstract
|
|
168
|
+
* `RenderBackend` contract when an `opts.backend` factory was injected
|
|
169
|
+
* (dom-backend memo, Seam 2).
|
|
170
|
+
*/
|
|
171
|
+
backend: RenderBackend;
|
|
158
172
|
/** Force a synchronous render of the current playhead time. */
|
|
159
173
|
render(): void;
|
|
160
174
|
/**
|
package/dist/index.js
CHANGED
|
@@ -288,7 +288,7 @@ function mount(initialScene, initialDoc, canvas, opts = {}) {
|
|
|
288
288
|
let scene = initialScene;
|
|
289
289
|
let doc = initialDoc;
|
|
290
290
|
const compiled = compileTimeline(doc);
|
|
291
|
-
const backend = new Canvas2DBackend(canvas);
|
|
291
|
+
const backend = opts.backend ? opts.backend(canvas) : new Canvas2DBackend(canvas);
|
|
292
292
|
scene.setTextMeasurer(backend);
|
|
293
293
|
const playhead = scene.playhead;
|
|
294
294
|
const player = createPlayer({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glissade/player",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0-pre.4",
|
|
4
4
|
"description": "glissade embed runtime: Player, Drivers (clock, scroll), mount().",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@glissade/backend-canvas2d": "0.
|
|
22
|
-
"@glissade/core": "0.
|
|
23
|
-
"@glissade/scene": "0.
|
|
21
|
+
"@glissade/backend-canvas2d": "0.20.0-pre.4",
|
|
22
|
+
"@glissade/core": "0.20.0-pre.4",
|
|
23
|
+
"@glissade/scene": "0.20.0-pre.4"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|