@hyperframes/core 0.9.18 → 0.9.20
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/fonts/deterministicFonts.js +15 -0
- package/dist/generated/runtime-inline.js +1 -1
- package/dist/hyperframe.runtime.iife.js +73 -73
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inline-scripts/pickerApi.d.ts +1 -0
- package/dist/motionBlurFingerprint.d.ts +4 -0
- package/dist/motionBlurFingerprint.js +34 -0
- package/dist/runtime/mediaSteer.d.ts +1 -1
- package/dist/runtime/mediaSteer.js +10 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -68,3 +68,4 @@ export { canaryBucket, evaluateCanary, parseCanaryOverride, type CanaryDecision,
|
|
|
68
68
|
export { CANARIES, canaryEnvVar, findCanary, overdueCanaries, type CanaryDefinition, } from "./canaryRegistry.js";
|
|
69
69
|
export { HF_VFX_ATTR, HF_VFX_CHAIN_VERSION, HF_VFX, chainCapture, getVfxDef, parseVfxChain, serializeVfxChain, normalizeVfxParams, type HfVfxCapture, type HfVfxChain, type HfVfxDef, type HfVfxNode, type HfVfxParam, type HfVfxParamValues, } from "./vfx.js";
|
|
70
70
|
export { PAGE_DEVICE_SCALE_GLOBAL, PAGE_MOTION_BLUR_OFF_GLOBAL, acceleratedCanvasTrackerSource, } from "./pageMotionBlur.js";
|
|
71
|
+
export { MOTION_BLUR_FINGERPRINT_FIELDS, type MotionBlurFingerprint, type MotionBlurFingerprintField, } from "./motionBlurFingerprint.js";
|
package/dist/index.js
CHANGED
|
@@ -71,3 +71,4 @@ export { CANARIES, canaryEnvVar, findCanary, overdueCanaries, } from "./canaryRe
|
|
|
71
71
|
// VFX chain (data-vfx-chain) — defs, chain parse/serialize/normalize
|
|
72
72
|
export { HF_VFX_ATTR, HF_VFX_CHAIN_VERSION, HF_VFX, chainCapture, getVfxDef, parseVfxChain, serializeVfxChain, normalizeVfxParams, } from "./vfx.js";
|
|
73
73
|
export { PAGE_DEVICE_SCALE_GLOBAL, PAGE_MOTION_BLUR_OFF_GLOBAL, acceleratedCanvasTrackerSource, } from "./pageMotionBlur.js";
|
|
74
|
+
export { MOTION_BLUR_FINGERPRINT_FIELDS, } from "./motionBlurFingerprint.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const MOTION_BLUR_FINGERPRINT_FIELDS: readonly ["canvas2d", "webgl", "video", "iframe", "customElement", "svgClip", "mask", "scrollContainer", "threeD", "overflowingMover", "frontOfMover", "blendMode", "fixedInMover", "pseudoOutside"];
|
|
2
|
+
export type MotionBlurFingerprintField = (typeof MOTION_BLUR_FINGERPRINT_FIELDS)[number];
|
|
3
|
+
export type MotionBlurFingerprint = Record<MotionBlurFingerprintField, number>;
|
|
4
|
+
export declare function emptyMotionBlurFingerprint(): MotionBlurFingerprint;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const MOTION_BLUR_FINGERPRINT_FIELDS = [
|
|
2
|
+
"canvas2d",
|
|
3
|
+
"webgl",
|
|
4
|
+
"video",
|
|
5
|
+
"iframe",
|
|
6
|
+
"customElement",
|
|
7
|
+
"svgClip",
|
|
8
|
+
"mask",
|
|
9
|
+
"scrollContainer",
|
|
10
|
+
"threeD",
|
|
11
|
+
"overflowingMover",
|
|
12
|
+
"frontOfMover",
|
|
13
|
+
"blendMode",
|
|
14
|
+
"fixedInMover",
|
|
15
|
+
"pseudoOutside",
|
|
16
|
+
];
|
|
17
|
+
export function emptyMotionBlurFingerprint() {
|
|
18
|
+
return {
|
|
19
|
+
canvas2d: 0,
|
|
20
|
+
webgl: 0,
|
|
21
|
+
video: 0,
|
|
22
|
+
iframe: 0,
|
|
23
|
+
customElement: 0,
|
|
24
|
+
svgClip: 0,
|
|
25
|
+
mask: 0,
|
|
26
|
+
scrollContainer: 0,
|
|
27
|
+
threeD: 0,
|
|
28
|
+
overflowingMover: 0,
|
|
29
|
+
frontOfMover: 0,
|
|
30
|
+
blendMode: 0,
|
|
31
|
+
fixedInMover: 0,
|
|
32
|
+
pseudoOutside: 0,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -3,7 +3,7 @@ export declare const MEDIA_SYNC_TOLERANCE_SECONDS = 0.04;
|
|
|
3
3
|
export declare const MEDIA_HARD_SYNC_SECONDS = 0.5;
|
|
4
4
|
export declare function markMediaRestarted(el: HTMLMediaElement): void;
|
|
5
5
|
/** Rate or seek for media `offset` s behind (+) or ahead (-); a lag still growing (`settled` false) never seeks. */
|
|
6
|
-
export declare function steerMedia(el: HTMLMediaElement, offset: number, baseRate: number, settled: boolean, audioOnly?: boolean): {
|
|
6
|
+
export declare function steerMedia(el: HTMLMediaElement, offset: number, baseRate: number, settled: boolean, audioOnly?: boolean, hidden?: boolean): {
|
|
7
7
|
rate: number;
|
|
8
8
|
seek: boolean;
|
|
9
9
|
};
|
|
@@ -13,6 +13,8 @@ const MEDIA_STEER_RELEASE_SECONDS = 0.01;
|
|
|
13
13
|
const AUDIO_MAX_STEER = 0.1;
|
|
14
14
|
const AUDIO_STEER_LIMIT_SECONDS = 0.1;
|
|
15
15
|
const WEBKIT_AUDIO_START_LAG_SECONDS = 0.65;
|
|
16
|
+
// A video nobody sees runs up to twice as fast (half as slow) to reach the playhead: the lag in seconds times this.
|
|
17
|
+
const HIDDEN_GAIN = 5;
|
|
16
18
|
/** Direction (+1 fast, -1 slow) an element is being steered in; absent when it plays at its authored rate. */
|
|
17
19
|
const steering = new WeakMap();
|
|
18
20
|
/** Started or seeked, not yet moving in tolerance: its lag is its own output latency, which a seek only renews. */
|
|
@@ -21,7 +23,7 @@ export function markMediaRestarted(el) {
|
|
|
21
23
|
catchingUp.add(el);
|
|
22
24
|
}
|
|
23
25
|
/** Rate or seek for media `offset` s behind (+) or ahead (-); a lag still growing (`settled` false) never seeks. */
|
|
24
|
-
export function steerMedia(el, offset, baseRate, settled, audioOnly = el.tagName === "AUDIO") {
|
|
26
|
+
export function steerMedia(el, offset, baseRate, settled, audioOnly = el.tagName === "AUDIO", hidden = false) {
|
|
25
27
|
const lag = Math.abs(offset);
|
|
26
28
|
if (audioOnly && isWebKit()) {
|
|
27
29
|
steering.delete(el);
|
|
@@ -36,6 +38,8 @@ export function steerMedia(el, offset, baseRate, settled, audioOnly = el.tagName
|
|
|
36
38
|
return { rate: baseRate, seek: true };
|
|
37
39
|
}
|
|
38
40
|
const direction = Math.sign(offset);
|
|
41
|
+
if (hidden && lag > MEDIA_SYNC_TOLERANCE_SECONDS)
|
|
42
|
+
return steerHidden(el, direction, lag, baseRate);
|
|
39
43
|
const current = steering.get(el);
|
|
40
44
|
if (lag > MEDIA_SYNC_TOLERANCE_SECONDS)
|
|
41
45
|
steering.set(el, direction);
|
|
@@ -47,6 +51,11 @@ export function steerMedia(el, offset, baseRate, settled, audioOnly = el.tagName
|
|
|
47
51
|
const steer = audioOnly ? Math.min(step, AUDIO_MAX_STEER) : step;
|
|
48
52
|
return { rate: baseRate * (1 + direction * steer), seek: false };
|
|
49
53
|
}
|
|
54
|
+
function steerHidden(el, direction, lag, baseRate) {
|
|
55
|
+
steering.set(el, direction);
|
|
56
|
+
const steer = Math.min(direction > 0 ? 1 : 0.5, lag * HIDDEN_GAIN);
|
|
57
|
+
return { rate: baseRate * (1 + direction * steer), seek: false };
|
|
58
|
+
}
|
|
50
59
|
/** Drop `el`'s steering: it was seeked, paused or replaced, so its old offset says nothing. */
|
|
51
60
|
export function forgetSteering(el) {
|
|
52
61
|
steering.delete(el);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.20",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -437,9 +437,9 @@
|
|
|
437
437
|
"linkedom": "^0.18.12",
|
|
438
438
|
"postcss": "^8.5.8",
|
|
439
439
|
"wawoff2": "^2.0.1",
|
|
440
|
-
"@hyperframes/
|
|
441
|
-
"@hyperframes/
|
|
442
|
-
"@hyperframes/
|
|
440
|
+
"@hyperframes/lint": "0.9.20",
|
|
441
|
+
"@hyperframes/studio-server": "0.9.20",
|
|
442
|
+
"@hyperframes/parsers": "0.9.20"
|
|
443
443
|
},
|
|
444
444
|
"devDependencies": {
|
|
445
445
|
"@fontsource/archivo-black": "^5.2.8",
|