@glissade/player 0.8.1 → 0.9.0-pre.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/index.d.ts +9 -0
- package/dist/index.js +19 -5
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -76,6 +76,15 @@ interface PlayerOptions {
|
|
|
76
76
|
reducedMotion?: ReducedMotionMode;
|
|
77
77
|
/** Override reduced-motion detection (defaults to the media query). */
|
|
78
78
|
prefersReducedMotion?: () => boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Font validation (§3.6). `true` = strict: an unregistered non-generic family
|
|
81
|
+
* or an uncovered glyph throws (rejects the async check). Default = dev-warn.
|
|
82
|
+
* Realtime is non-blocking — the check runs off the first paint, never gating
|
|
83
|
+
* it (the export paths await; frame-exactness lives there).
|
|
84
|
+
*/
|
|
85
|
+
strictFonts?: boolean;
|
|
86
|
+
/** OS-installed families to treat as registered for strict mode. */
|
|
87
|
+
osFonts?: ReadonlySet<string>;
|
|
79
88
|
}
|
|
80
89
|
interface PlayHandle {
|
|
81
90
|
/** true = completed naturally, false = interrupted. Completion signal ONLY (§2). */
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { compileTimeline } from "@glissade/core";
|
|
2
|
-
import { evaluate } from "@glissade/scene";
|
|
1
|
+
import { buildFontRegistry, compileTimeline } from "@glissade/core";
|
|
2
|
+
import { evaluate, validateSceneFonts } from "@glissade/scene";
|
|
3
3
|
import { Canvas2DBackend } from "@glissade/backend-canvas2d";
|
|
4
4
|
//#region src/driver.ts
|
|
5
5
|
/**
|
|
@@ -298,12 +298,26 @@ function mount(initialScene, initialDoc, canvas, opts = {}) {
|
|
|
298
298
|
const unsubscribe = playhead.subscribe(schedule);
|
|
299
299
|
const loadFonts = (forDoc) => {
|
|
300
300
|
if (typeof FontFace === "undefined") return;
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
const face = new FontFace(family, `url(${
|
|
301
|
+
const registry = buildFontRegistry(forDoc.assets);
|
|
302
|
+
for (const f of registry.faces()) {
|
|
303
|
+
const face = new FontFace(f.family, `url(${f.url})`, {
|
|
304
|
+
weight: String(f.weight),
|
|
305
|
+
style: f.style
|
|
306
|
+
});
|
|
304
307
|
document.fonts.add(face);
|
|
305
308
|
face.load().then(() => renderNow(), () => void 0);
|
|
306
309
|
}
|
|
310
|
+
validateSceneFonts(scene, forDoc, async (url) => {
|
|
311
|
+
try {
|
|
312
|
+
const resp = await fetch(url);
|
|
313
|
+
return resp.ok ? await resp.arrayBuffer() : void 0;
|
|
314
|
+
} catch {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
}, {
|
|
318
|
+
mode: opts.strictFonts ? "strict" : "dev",
|
|
319
|
+
...opts.osFonts !== void 0 ? { osFamilies: opts.osFonts } : {}
|
|
320
|
+
});
|
|
307
321
|
};
|
|
308
322
|
loadFonts(doc);
|
|
309
323
|
const prefersReduced = (opts.prefersReducedMotion ?? mediaPrefersReducedMotion)();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glissade/player",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0-pre.1",
|
|
4
4
|
"description": "glissade embed runtime: Player, Drivers (clock, scroll), mount().",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@glissade/backend-canvas2d": "0.
|
|
19
|
-
"@glissade/core": "0.
|
|
20
|
-
"@glissade/scene": "0.
|
|
18
|
+
"@glissade/backend-canvas2d": "0.9.0-pre.1",
|
|
19
|
+
"@glissade/core": "0.9.0-pre.1",
|
|
20
|
+
"@glissade/scene": "0.9.0-pre.1"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|