@hyperframes/core 0.9.30 → 0.9.31
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.
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** Media elements swapped to their proxy, each with the src attribute it had before the swap. */
|
|
2
2
|
export declare const swappedElements: WeakMap<Element, string | null>;
|
|
3
|
+
export declare function recordOpenedAtInPoint(el: Element, authored: string, written: string | null, holdsWhenIdle?: boolean): void;
|
|
4
|
+
/** True for a clip the runtime holds whenever it is not due, while its src is still the runtime's. */
|
|
5
|
+
export declare function holdsWhenIdle(el: Element): boolean;
|
|
6
|
+
export declare function isHeldUntilDue(el: Element): boolean;
|
|
7
|
+
/** The src the author wrote for a clip the runtime opened or holds. */
|
|
8
|
+
export declare function authoredSrcOf(el: Element): string | null;
|
|
3
9
|
export declare function unproxiedSrc(el: Element): string | null;
|
|
4
10
|
/** Videos showing a still of their last frame as poster across a copy swap: the poster they had before, and when. */
|
|
5
11
|
export declare const heldPosters: WeakMap<Element, {
|
package/dist/runtime/proxySrc.js
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
/** Media elements swapped to their proxy, each with the src attribute it had before the swap. */
|
|
2
2
|
export const swappedElements = new WeakMap();
|
|
3
|
+
/** Media elements the runtime opened at their in-point: the src the author wrote, the one written in its
|
|
4
|
+
* place (null while the clip is held with no src until it is due), and whether it is held again when idle. */
|
|
5
|
+
const openedAtInPoint = new WeakMap();
|
|
6
|
+
export function recordOpenedAtInPoint(el, authored, written, holdsWhenIdle = openedAtInPoint.get(el)?.holdsWhenIdle ?? false) {
|
|
7
|
+
openedAtInPoint.set(el, { authored, written, holdsWhenIdle });
|
|
8
|
+
}
|
|
9
|
+
/** True for a clip the runtime holds whenever it is not due, while its src is still the runtime's. */
|
|
10
|
+
export function holdsWhenIdle(el) {
|
|
11
|
+
return isOpenedAtInPoint(el) && openedAtInPoint.get(el).holdsWhenIdle;
|
|
12
|
+
}
|
|
13
|
+
/** True while the src is still the one the runtime wrote: a script or binding that sets another ends it. */
|
|
14
|
+
function isOpenedAtInPoint(el) {
|
|
15
|
+
const record = openedAtInPoint.get(el);
|
|
16
|
+
return record !== undefined && record.written === el.getAttribute("src");
|
|
17
|
+
}
|
|
18
|
+
export function isHeldUntilDue(el) {
|
|
19
|
+
return isOpenedAtInPoint(el) && openedAtInPoint.get(el).written === null;
|
|
20
|
+
}
|
|
21
|
+
/** The src the author wrote for a clip the runtime opened or holds. */
|
|
22
|
+
export function authoredSrcOf(el) {
|
|
23
|
+
return openedAtInPoint.get(el)?.authored ?? null;
|
|
24
|
+
}
|
|
3
25
|
export function unproxiedSrc(el) {
|
|
4
|
-
|
|
26
|
+
if (swappedElements.has(el))
|
|
27
|
+
return swappedElements.get(el) ?? null;
|
|
28
|
+
return isOpenedAtInPoint(el) ? openedAtInPoint.get(el).authored : el.getAttribute("src");
|
|
5
29
|
}
|
|
6
30
|
/** Videos showing a still of their last frame as poster across a copy swap: the poster they had before, and when. */
|
|
7
31
|
export const heldPosters = new WeakMap();
|
package/dist/runtime/timeline.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { unproxiedSrc } from "./proxySrc.js";
|
|
1
2
|
import { stableClipId } from "./clipTree.js";
|
|
2
3
|
import { findRootCompositionElement, parseCompositionDimension } from "./compositionDimension.js";
|
|
3
4
|
import { AUTHORED_DURATION_ATTR, AUTHORED_END_ATTR, resolveAuthoredTimingWindow, } from "./authoredTiming.js";
|
|
@@ -123,7 +124,7 @@ function toAbsoluteAssetUrl(rawValue) {
|
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
function resolveNodeAssetUrl(node) {
|
|
126
|
-
const src = node
|
|
127
|
+
const src = unproxiedSrc(node) ?? node.getAttribute("data-src");
|
|
127
128
|
if (src)
|
|
128
129
|
return toAbsoluteAssetUrl(src);
|
|
129
130
|
const compositionSrc = node.getAttribute("data-composition-src");
|
|
@@ -132,7 +133,7 @@ function resolveNodeAssetUrl(node) {
|
|
|
132
133
|
const mediaDescendant = node.querySelector("img[src], video[src], audio[src], source[src]");
|
|
133
134
|
if (!mediaDescendant)
|
|
134
135
|
return null;
|
|
135
|
-
return toAbsoluteAssetUrl(mediaDescendant
|
|
136
|
+
return toAbsoluteAssetUrl(unproxiedSrc(mediaDescendant));
|
|
136
137
|
}
|
|
137
138
|
function getFirstClassToken(node) {
|
|
138
139
|
const className = node.className;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.31",
|
|
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/lint": "0.9.
|
|
441
|
-
"@hyperframes/
|
|
442
|
-
"@hyperframes/
|
|
440
|
+
"@hyperframes/lint": "0.9.31",
|
|
441
|
+
"@hyperframes/parsers": "0.9.31",
|
|
442
|
+
"@hyperframes/studio-server": "0.9.31"
|
|
443
443
|
},
|
|
444
444
|
"devDependencies": {
|
|
445
445
|
"@fontsource/archivo-black": "^5.2.8",
|