@hyperframes/core 0.6.116 → 0.6.117
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/beats/index.d.ts +2 -2
- package/dist/beats/index.d.ts.map +1 -1
- package/dist/beats/index.js +2 -2
- package/dist/beats/index.js.map +1 -1
- package/dist/runtime/clipTree.d.ts +31 -0
- package/dist/runtime/clipTree.d.ts.map +1 -0
- package/dist/runtime/clipTree.js +81 -0
- package/dist/runtime/clipTree.js.map +1 -0
- package/dist/runtime/types.d.ts +216 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +2 -0
- package/dist/runtime/types.js.map +1 -0
- package/package.json +18 -1
package/dist/beats/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./beatDetection";
|
|
2
|
-
export * from "./beatFile";
|
|
1
|
+
export * from "./beatDetection.js";
|
|
2
|
+
export * from "./beatFile.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/beats/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/beats/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
|
package/dist/beats/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./beatDetection";
|
|
2
|
-
export * from "./beatFile";
|
|
1
|
+
export * from "./beatDetection.js";
|
|
2
|
+
export * from "./beatFile.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/beats/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/beats/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/beats/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* window.__clipTree — hierarchical clip tree for Studio.
|
|
3
|
+
*
|
|
4
|
+
* Maps every timed element to a node so Studio can derive parent/child
|
|
5
|
+
* relationships for inline timeline expansion. Read-only: timing edits go
|
|
6
|
+
* through the host's normal save → reloadPreview path, not a DOM patch here.
|
|
7
|
+
*
|
|
8
|
+
* ponytail: intentionally minimal. Node carries only what consumers read
|
|
9
|
+
* (id/parentId/children) plus the backing element. Add fields (label, kind,
|
|
10
|
+
* absolute start) when a caller needs them.
|
|
11
|
+
*/
|
|
12
|
+
import type { RuntimeTimelineLike } from "./types";
|
|
13
|
+
export interface ClipNode {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly element: Element;
|
|
16
|
+
readonly parentId: string | null;
|
|
17
|
+
readonly children: readonly ClipNode[];
|
|
18
|
+
}
|
|
19
|
+
export interface ClipTree {
|
|
20
|
+
readonly roots: readonly ClipNode[];
|
|
21
|
+
}
|
|
22
|
+
interface StartResolverLike {
|
|
23
|
+
resolveStartForElement: (element: Element, fallback?: number) => number;
|
|
24
|
+
}
|
|
25
|
+
export declare function createClipTree(params: {
|
|
26
|
+
startResolver: StartResolverLike;
|
|
27
|
+
timelineRegistry: Record<string, RuntimeTimelineLike | undefined>;
|
|
28
|
+
rootDuration: number;
|
|
29
|
+
}): ClipTree;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=clipTree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipTree.d.ts","sourceRoot":"","sources":["../../src/runtime/clipTree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,QAAQ,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;CACrC;AAaD,UAAU,iBAAiB;IACzB,sBAAsB,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CACzE;AA0DD,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACrC,aAAa,EAAE,iBAAiB,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,CAAC,CAAC;IAClE,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,QAAQ,CAyBX"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* window.__clipTree — hierarchical clip tree for Studio.
|
|
3
|
+
*
|
|
4
|
+
* Maps every timed element to a node so Studio can derive parent/child
|
|
5
|
+
* relationships for inline timeline expansion. Read-only: timing edits go
|
|
6
|
+
* through the host's normal save → reloadPreview path, not a DOM patch here.
|
|
7
|
+
*
|
|
8
|
+
* ponytail: intentionally minimal. Node carries only what consumers read
|
|
9
|
+
* (id/parentId/children) plus the backing element. Add fields (label, kind,
|
|
10
|
+
* absolute start) when a caller needs them.
|
|
11
|
+
*/
|
|
12
|
+
const DECORATIVE_TAGS = new Set(["SCRIPT", "STYLE", "LINK", "META", "TEMPLATE", "NOSCRIPT"]);
|
|
13
|
+
function parseNum(value) {
|
|
14
|
+
if (value == null)
|
|
15
|
+
return null;
|
|
16
|
+
const n = Number(value);
|
|
17
|
+
return Number.isFinite(n) ? n : null;
|
|
18
|
+
}
|
|
19
|
+
function durationFromTimeline(el, registry) {
|
|
20
|
+
const compId = el.getAttribute("data-composition-id");
|
|
21
|
+
if (!compId)
|
|
22
|
+
return null;
|
|
23
|
+
const d = Number(registry[compId]?.duration?.());
|
|
24
|
+
return Number.isFinite(d) && d > 0 ? d : null;
|
|
25
|
+
}
|
|
26
|
+
function durationFromMedia(el) {
|
|
27
|
+
if (!(el instanceof HTMLMediaElement) || !Number.isFinite(el.duration))
|
|
28
|
+
return null;
|
|
29
|
+
const mediaStart = parseNum(el.getAttribute("data-playback-start")) ??
|
|
30
|
+
parseNum(el.getAttribute("data-media-start")) ??
|
|
31
|
+
0;
|
|
32
|
+
return el.duration > mediaStart ? el.duration - mediaStart : null;
|
|
33
|
+
}
|
|
34
|
+
// Used only to filter out zero-duration (decorative) elements at build time.
|
|
35
|
+
function resolveDuration(el, timelineRegistry, rootDuration, absoluteStart) {
|
|
36
|
+
const attr = parseNum(el.getAttribute("data-duration"));
|
|
37
|
+
if (attr != null && attr > 0)
|
|
38
|
+
return attr;
|
|
39
|
+
return (durationFromTimeline(el, timelineRegistry) ??
|
|
40
|
+
durationFromMedia(el) ??
|
|
41
|
+
Math.max(0, rootDuration - absoluteStart));
|
|
42
|
+
}
|
|
43
|
+
function linkParentChild(elementToNode) {
|
|
44
|
+
for (const [el, node] of elementToNode) {
|
|
45
|
+
let cursor = el.parentElement;
|
|
46
|
+
while (cursor) {
|
|
47
|
+
const parentNode = elementToNode.get(cursor);
|
|
48
|
+
if (parentNode) {
|
|
49
|
+
node.parentId = parentNode.id;
|
|
50
|
+
parentNode.children.push(node);
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
cursor = cursor.parentElement;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export function createClipTree(params) {
|
|
58
|
+
const { startResolver, timelineRegistry, rootDuration } = params;
|
|
59
|
+
const elementToNode = new Map();
|
|
60
|
+
const root = document.querySelector("[data-composition-id]");
|
|
61
|
+
let ordinal = 0;
|
|
62
|
+
for (const el of document.querySelectorAll("[data-start]")) {
|
|
63
|
+
if (el === root || DECORATIVE_TAGS.has(el.tagName))
|
|
64
|
+
continue;
|
|
65
|
+
const absoluteStart = startResolver.resolveStartForElement(el, 0);
|
|
66
|
+
if (resolveDuration(el, timelineRegistry, rootDuration, absoluteStart) <= 0)
|
|
67
|
+
continue;
|
|
68
|
+
const node = {
|
|
69
|
+
id: el.id || `__clip-${ordinal++}`,
|
|
70
|
+
element: el,
|
|
71
|
+
parentId: null,
|
|
72
|
+
children: [],
|
|
73
|
+
};
|
|
74
|
+
elementToNode.set(el, node);
|
|
75
|
+
}
|
|
76
|
+
linkParentChild(elementToNode);
|
|
77
|
+
return {
|
|
78
|
+
roots: Array.from(elementToNode.values()).filter((n) => n.parentId === null),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=clipTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipTree.js","sourceRoot":"","sources":["../../src/runtime/clipTree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAwBH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAM7F,SAAS,QAAQ,CAAC,KAAoB;IACpC,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/B,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACvC,CAAC;AAED,SAAS,oBAAoB,CAC3B,EAAW,EACX,QAAyD;IAEzD,MAAM,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;IACtD,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,M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E,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,eAAe,CAAC,aAAa,CAAC,CAAC;IAE/B,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC;KAC7E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import type { HfColorGradingTarget } from "../colorGrading";
|
|
2
|
+
export type RuntimeJson = string | number | boolean | null | RuntimeJson[] | {
|
|
3
|
+
[key: string]: RuntimeJson;
|
|
4
|
+
};
|
|
5
|
+
import type { HyperframeControlAction } from "../inline-scripts/runtimeContract.js";
|
|
6
|
+
import type { HyperframePickerElementInfo } from "../inline-scripts/pickerApi.js";
|
|
7
|
+
export type RuntimeBridgeControlAction = HyperframeControlAction | "tick" | "set-volume" | "set-media-output-muted" | "stop-media" | "flash-elements";
|
|
8
|
+
export type RuntimeBridgeControlMessage = {
|
|
9
|
+
source: "hf-parent";
|
|
10
|
+
type: "control";
|
|
11
|
+
action: RuntimeBridgeControlAction;
|
|
12
|
+
frame?: number;
|
|
13
|
+
muted?: boolean;
|
|
14
|
+
volume?: number;
|
|
15
|
+
playbackRate?: number;
|
|
16
|
+
target?: HfColorGradingTarget | string | null;
|
|
17
|
+
grading?: RuntimeJson;
|
|
18
|
+
compare?: RuntimeJson;
|
|
19
|
+
seekMode?: "drag" | "commit";
|
|
20
|
+
};
|
|
21
|
+
export type RuntimeStateMessage = {
|
|
22
|
+
source: "hf-preview";
|
|
23
|
+
type: "state";
|
|
24
|
+
frame: number;
|
|
25
|
+
isPlaying: boolean;
|
|
26
|
+
muted: boolean;
|
|
27
|
+
playbackRate: number;
|
|
28
|
+
};
|
|
29
|
+
export type RuntimeTimelineClip = {
|
|
30
|
+
id: string | null;
|
|
31
|
+
label: string;
|
|
32
|
+
start: number;
|
|
33
|
+
duration: number;
|
|
34
|
+
track: number;
|
|
35
|
+
kind: "video" | "audio" | "image" | "element" | "composition";
|
|
36
|
+
tagName: string | null;
|
|
37
|
+
compositionId: string | null;
|
|
38
|
+
compositionAncestors: string[];
|
|
39
|
+
parentCompositionId: string | null;
|
|
40
|
+
nodePath: string | null;
|
|
41
|
+
compositionSrc: string | null;
|
|
42
|
+
assetUrl: string | null;
|
|
43
|
+
timelineRole: string | null;
|
|
44
|
+
timelineLabel: string | null;
|
|
45
|
+
timelineGroup: string | null;
|
|
46
|
+
timelinePriority: number | null;
|
|
47
|
+
};
|
|
48
|
+
export type RuntimeTimelineScene = {
|
|
49
|
+
id: string;
|
|
50
|
+
label: string;
|
|
51
|
+
start: number;
|
|
52
|
+
duration: number;
|
|
53
|
+
thumbnailUrl: string | null;
|
|
54
|
+
avatarName: string | null;
|
|
55
|
+
};
|
|
56
|
+
export type RuntimeTimelineMessage = {
|
|
57
|
+
source: "hf-preview";
|
|
58
|
+
type: "timeline";
|
|
59
|
+
durationInFrames: number;
|
|
60
|
+
clips: RuntimeTimelineClip[];
|
|
61
|
+
scenes: RuntimeTimelineScene[];
|
|
62
|
+
compositionWidth: number;
|
|
63
|
+
compositionHeight: number;
|
|
64
|
+
};
|
|
65
|
+
export type RuntimeDiagnosticMessage = {
|
|
66
|
+
source: "hf-preview";
|
|
67
|
+
type: "diagnostic";
|
|
68
|
+
code: string;
|
|
69
|
+
details: Record<string, RuntimeJson>;
|
|
70
|
+
};
|
|
71
|
+
export type RuntimePickerElementInfo = HyperframePickerElementInfo;
|
|
72
|
+
export type RuntimePickerHoveredMessage = {
|
|
73
|
+
source: "hf-preview";
|
|
74
|
+
type: "element-hovered";
|
|
75
|
+
elementInfo: RuntimePickerElementInfo;
|
|
76
|
+
};
|
|
77
|
+
export type RuntimePickerCandidatesMessage = {
|
|
78
|
+
source: "hf-preview";
|
|
79
|
+
type: "element-pick-candidates";
|
|
80
|
+
candidates: RuntimePickerElementInfo[];
|
|
81
|
+
selectedIndex: number;
|
|
82
|
+
point: {
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export type RuntimePickerPickedMessage = {
|
|
88
|
+
source: "hf-preview";
|
|
89
|
+
type: "element-picked";
|
|
90
|
+
elementInfo: RuntimePickerElementInfo;
|
|
91
|
+
};
|
|
92
|
+
export type RuntimePickerPickedManyMessage = {
|
|
93
|
+
source: "hf-preview";
|
|
94
|
+
type: "element-picked-many";
|
|
95
|
+
elementInfos: RuntimePickerElementInfo[];
|
|
96
|
+
};
|
|
97
|
+
export type RuntimePickerCancelledMessage = {
|
|
98
|
+
source: "hf-preview";
|
|
99
|
+
type: "pick-mode-cancelled";
|
|
100
|
+
};
|
|
101
|
+
export type RuntimeStageSizeMessage = {
|
|
102
|
+
source: "hf-preview";
|
|
103
|
+
type: "stage-size";
|
|
104
|
+
width: number;
|
|
105
|
+
height: number;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Fired once per session when the runtime's attempt to play a timed media
|
|
109
|
+
* element is rejected with `NotAllowedError`. The parent (web component / host
|
|
110
|
+
* app) uses this as the signal to promote to parent-frame audio proxies —
|
|
111
|
+
* iframes lose autoplay privileges when the user gesture originated in the
|
|
112
|
+
* parent frame, so the host has to take over audible playback there.
|
|
113
|
+
*/
|
|
114
|
+
export type RuntimeMediaAutoplayBlockedMessage = {
|
|
115
|
+
source: "hf-preview";
|
|
116
|
+
type: "media-autoplay-blocked";
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Posted by the runtime when `installRuntimeControlBridge` finishes registering
|
|
120
|
+
* its message listener — signals that subsequent control messages
|
|
121
|
+
* (`set-muted`, `set-volume`, `set-playback-rate`, etc.) will now be received
|
|
122
|
+
* and processed. The parent (web component / host app) listens for this and
|
|
123
|
+
* replays current playback state to repair any race where bridge messages
|
|
124
|
+
* were posted before the listener was installed. Emitted again on every iframe
|
|
125
|
+
* reload because the new runtime instance starts with no state.
|
|
126
|
+
*/
|
|
127
|
+
export type RuntimeReadyMessage = {
|
|
128
|
+
source: "hf-preview";
|
|
129
|
+
type: "ready";
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Analytics events emitted by the runtime.
|
|
133
|
+
*
|
|
134
|
+
* The host app receives these via postMessage and forwards to its analytics
|
|
135
|
+
* provider (PostHog, Mixpanel, Amplitude, custom logging, etc.).
|
|
136
|
+
* No analytics SDK runs inside this iframe.
|
|
137
|
+
*/
|
|
138
|
+
export type RuntimeAnalyticsMessage = {
|
|
139
|
+
source: "hf-preview";
|
|
140
|
+
type: "analytics";
|
|
141
|
+
event: "composition_loaded" | "composition_played" | "composition_paused" | "composition_seeked" | "composition_ended" | "element_picked";
|
|
142
|
+
properties: Record<string, string | number | boolean | null>;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Numeric performance metrics emitted by the runtime — scrub latency, sustained
|
|
146
|
+
* fps, dropped frames, decoder count, composition load time, media sync drift.
|
|
147
|
+
* The host aggregates per-session values (p50/p95) and forwards to its
|
|
148
|
+
* observability pipeline. Distinct from `analytics` events because perf data
|
|
149
|
+
* is continuous and numeric, not discrete.
|
|
150
|
+
*/
|
|
151
|
+
export type RuntimePerformanceMessage = {
|
|
152
|
+
source: "hf-preview";
|
|
153
|
+
type: "perf";
|
|
154
|
+
name: string;
|
|
155
|
+
value: number;
|
|
156
|
+
tags: Record<string, string | number | boolean | null>;
|
|
157
|
+
};
|
|
158
|
+
export type RuntimeOutboundMessage = RuntimeStateMessage | RuntimeTimelineMessage | RuntimeDiagnosticMessage | RuntimePickerHoveredMessage | RuntimePickerCandidatesMessage | RuntimePickerPickedMessage | RuntimePickerPickedManyMessage | RuntimePickerCancelledMessage | RuntimeStageSizeMessage | RuntimeMediaAutoplayBlockedMessage | RuntimeReadyMessage | RuntimeAnalyticsMessage | RuntimePerformanceMessage;
|
|
159
|
+
export type RuntimePlayer = {
|
|
160
|
+
_timeline: RuntimeTimelineLike | null;
|
|
161
|
+
play: () => void;
|
|
162
|
+
pause: () => void;
|
|
163
|
+
seek: (timeSeconds: number, options?: {
|
|
164
|
+
keepPlaying?: boolean;
|
|
165
|
+
}) => void;
|
|
166
|
+
renderSeek: (timeSeconds: number) => void;
|
|
167
|
+
getTime: () => number;
|
|
168
|
+
getDuration: () => number;
|
|
169
|
+
isPlaying: () => boolean;
|
|
170
|
+
setPlaybackRate: (rate: number) => void;
|
|
171
|
+
getPlaybackRate: () => number;
|
|
172
|
+
};
|
|
173
|
+
export type RuntimeTimelineLike = {
|
|
174
|
+
play: () => void;
|
|
175
|
+
pause: () => void;
|
|
176
|
+
seek: (timeSeconds: number, suppressEvents?: boolean) => void;
|
|
177
|
+
totalTime?: (timeSeconds: number, suppressEvents?: boolean) => void;
|
|
178
|
+
time: () => number;
|
|
179
|
+
duration: () => number;
|
|
180
|
+
add: (timeline: RuntimeTimelineLike, startAtSeconds: number) => void;
|
|
181
|
+
paused: (paused?: boolean) => void;
|
|
182
|
+
timeScale?: (rate: number) => void;
|
|
183
|
+
set: (target: RuntimeGsapSetTarget, vars: RuntimeGsapSetVars, atSeconds?: number) => void;
|
|
184
|
+
};
|
|
185
|
+
export type RuntimeDeterministicAdapter = {
|
|
186
|
+
name: string;
|
|
187
|
+
discover: () => void;
|
|
188
|
+
seek: (ctx: {
|
|
189
|
+
time: number;
|
|
190
|
+
}) => void;
|
|
191
|
+
pause: () => void;
|
|
192
|
+
play?: () => void;
|
|
193
|
+
revert?: () => void;
|
|
194
|
+
/**
|
|
195
|
+
* Optional async readiness gate. If the adapter has outstanding async work
|
|
196
|
+
* (e.g. Three.js's `DefaultLoadingManager` still loading models/textures),
|
|
197
|
+
* return a promise that settles when the work is done. The runtime waits
|
|
198
|
+
* for the returned promise to settle before publishing
|
|
199
|
+
* `window.__renderReady = true`, so the engine doesn't capture empty
|
|
200
|
+
* frames while assets are still loading.
|
|
201
|
+
*
|
|
202
|
+
* Return `null` (or omit the method) when nothing is pending. The runtime
|
|
203
|
+
* calls this on every readiness-publish evaluation and tracks promise
|
|
204
|
+
* identity, so returning the same promise on repeated calls is the
|
|
205
|
+
* expected contract — return a fresh promise only when a new wait is
|
|
206
|
+
* actually needed (e.g. a new batch of items has been queued).
|
|
207
|
+
*
|
|
208
|
+
* Throwing or rejecting is safe: the runtime swallows the error and
|
|
209
|
+
* proceeds to publish (matching the existing failure-doesn't-block-render
|
|
210
|
+
* convention).
|
|
211
|
+
*/
|
|
212
|
+
getReadyPromise?: () => PromiseLike<unknown> | null;
|
|
213
|
+
};
|
|
214
|
+
export type RuntimeGsapSetTarget = string | Element | Element[] | null;
|
|
215
|
+
export type RuntimeGsapSetVars = Record<string, string | number | boolean | null | undefined>;
|
|
216
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,WAAW,EAAE,GACb;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAA;CAAE,CAAC;AAEnC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAElF,MAAM,MAAM,0BAA0B,GAClC,uBAAuB,GACvB,MAAM,GACN,YAAY,GACZ,wBAAwB,GACxB,YAAY,GACZ,gBAAgB,CAAC;AAErB,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,0BAA0B,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IACh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MAAM,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,GAAG,EAAE,CAAC,QAAQ,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,GAAG,EAAE,CAAC,MAAM,EAAE,oBAAoB,EAAE,IAAI,EAAE,kBAAkB,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3F,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,EAAE,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;;;;;;;;;;;;;;;OAiBG;IACH,eAAe,CAAC,EAAE,MAAM,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.117",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,6 +21,15 @@
|
|
|
21
21
|
"import": "./dist/index.js",
|
|
22
22
|
"types": "./dist/index.d.ts"
|
|
23
23
|
},
|
|
24
|
+
"./package.json": "./package.json",
|
|
25
|
+
"./beats": {
|
|
26
|
+
"import": "./dist/beats/index.js",
|
|
27
|
+
"types": "./dist/beats/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./html-attr-safety": {
|
|
30
|
+
"import": "./dist/utils/htmlAttrSafety.js",
|
|
31
|
+
"types": "./dist/utils/htmlAttrSafety.d.ts"
|
|
32
|
+
},
|
|
24
33
|
"./lint": {
|
|
25
34
|
"import": "./dist/lint/index.js",
|
|
26
35
|
"types": "./dist/lint/index.d.ts"
|
|
@@ -41,7 +50,15 @@
|
|
|
41
50
|
"import": "./dist/colorLuts.js",
|
|
42
51
|
"types": "./dist/colorLuts.d.ts"
|
|
43
52
|
},
|
|
53
|
+
"./storyboard": {
|
|
54
|
+
"import": "./dist/storyboard/index.js",
|
|
55
|
+
"types": "./dist/storyboard/index.d.ts"
|
|
56
|
+
},
|
|
44
57
|
"./runtime": "./dist/hyperframe.runtime.iife.js",
|
|
58
|
+
"./runtime/clipTree": {
|
|
59
|
+
"import": "./dist/runtime/clipTree.js",
|
|
60
|
+
"types": "./dist/runtime/clipTree.d.ts"
|
|
61
|
+
},
|
|
45
62
|
"./runtime/lottie-readiness": {
|
|
46
63
|
"import": "./dist/lottieReadiness.js",
|
|
47
64
|
"types": "./dist/lottieReadiness.d.ts"
|