@hyperframes/core 0.8.166 → 0.8.167
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/audioGroups.js +2 -5
- package/dist/compiler/htmlBundler.js +11 -11
- package/dist/generated/runtime-inline.js +1 -1
- package/dist/hyperframe.runtime.iife.js +62 -62
- package/dist/runtime/adapters/seek-dispatch.d.ts +5 -2
- package/dist/runtime/adapters/seek-dispatch.js +10 -4
- package/dist/runtime/media.js +1 -1
- package/dist/runtime/mediaVolumeEnvelope.d.ts +7 -0
- package/dist/runtime/mediaVolumeEnvelope.js +19 -13
- package/dist/runtime/stackingContext.d.ts +1 -1
- package/dist/runtime/stackingContext.js +9 -1
- package/dist/runtime/timeline.js +4 -3
- package/package.json +4 -4
package/dist/audioGroups.js
CHANGED
|
@@ -97,11 +97,8 @@ export function isMemberGroupHidden(doc, el) {
|
|
|
97
97
|
* a sub-composition's root is skipped, so repeating one cannot stack chains.
|
|
98
98
|
*/
|
|
99
99
|
export function resolveMasterBusElement(root) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return el;
|
|
103
|
-
}
|
|
104
|
-
return null;
|
|
100
|
+
const first = root.querySelector("[data-composition-id]");
|
|
101
|
+
return first && !first.parentElement?.closest("[data-composition-id]") ? first : null;
|
|
105
102
|
}
|
|
106
103
|
/** The master bus chain: the top-level root's `data-fx-chain`, if it carries one. */
|
|
107
104
|
export function readMasterFxChain(root) {
|
|
@@ -16,7 +16,7 @@ import { resolve, relative, dirname, isAbsolute, sep } from "path";
|
|
|
16
16
|
import { extractStandaloneEntryFromIndex, isTemplateEntry } from "./standaloneEntry.js";
|
|
17
17
|
import { decodeCssEscapes, decodeWellFormedEscapes, encodeUrlPath, decodedUrlPath, splitUrlSuffix, } from "@hyperframes/parsers/asset-paths";
|
|
18
18
|
import { CSS_URL_RE, isNonRelativeUrl } from "./assetPaths.js";
|
|
19
|
-
import {
|
|
19
|
+
import { transform } from "esbuild";
|
|
20
20
|
import { compileHtml } from "./htmlCompiler.js";
|
|
21
21
|
import { RUNTIME_BOOTSTRAP_ATTR, escapeInlineScriptSource, insertRuntimeTag, parseHTMLContent, stripEmbeddedRuntimeScripts, } from "./htmlDocument.js";
|
|
22
22
|
// rewriteSubCompPaths functions are used by inlineSubCompositions (shared module)
|
|
@@ -651,7 +651,7 @@ function pushRun(runs, scene, chunk) {
|
|
|
651
651
|
else
|
|
652
652
|
runs.push({ scene, chunks: [chunk] });
|
|
653
653
|
}
|
|
654
|
-
function coalesceHeadStylesAndBodyScripts(document, provenance) {
|
|
654
|
+
async function coalesceHeadStylesAndBodyScripts(document, provenance) {
|
|
655
655
|
const allHeadStyles = [...document.querySelectorAll("head style")];
|
|
656
656
|
const isScenePart = (el) => el.hasAttribute(SCENE_PART_ATTR);
|
|
657
657
|
for (const run of allHeadStyles.length > 1 ? headStyleRuns(allHeadStyles, isScenePart) : []) {
|
|
@@ -669,7 +669,7 @@ function coalesceHeadStylesAndBodyScripts(document, provenance) {
|
|
|
669
669
|
const mergedJs = joinJsChunks(members.map((el) => el.textContent || ""));
|
|
670
670
|
if (mergedJs && !parsesAsScript(mergedJs)) {
|
|
671
671
|
for (const el of members)
|
|
672
|
-
el.textContent = inlineScriptSource(el.textContent || "", provenance);
|
|
672
|
+
el.textContent = await inlineScriptSource(el.textContent || "", provenance);
|
|
673
673
|
continue;
|
|
674
674
|
}
|
|
675
675
|
for (const el of members)
|
|
@@ -677,7 +677,7 @@ function coalesceHeadStylesAndBodyScripts(document, provenance) {
|
|
|
677
677
|
if (!mergedJs)
|
|
678
678
|
continue;
|
|
679
679
|
const inlineScript = document.createElement("script");
|
|
680
|
-
inlineScript.textContent = inlineScriptSource(mergedJs, provenance);
|
|
680
|
+
inlineScript.textContent = await inlineScriptSource(mergedJs, provenance);
|
|
681
681
|
if (anchor)
|
|
682
682
|
anchor.before(inlineScript);
|
|
683
683
|
else
|
|
@@ -740,11 +740,11 @@ export function parsesAsScript(source) {
|
|
|
740
740
|
return false;
|
|
741
741
|
}
|
|
742
742
|
}
|
|
743
|
-
function stripJsCommentsParserSafe(source, provenance) {
|
|
743
|
+
async function stripJsCommentsParserSafe(source, provenance) {
|
|
744
744
|
if (!source)
|
|
745
745
|
return source;
|
|
746
746
|
try {
|
|
747
|
-
const result =
|
|
747
|
+
const result = await transform(source, {
|
|
748
748
|
loader: "js",
|
|
749
749
|
minify: false,
|
|
750
750
|
legalComments: "none",
|
|
@@ -763,8 +763,8 @@ function stripJsCommentsParserSafe(source, provenance) {
|
|
|
763
763
|
return source;
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
|
-
function inlineScriptSource(js, provenance) {
|
|
767
|
-
return escapeInlineScriptSource(stripJsCommentsParserSafe(js, provenance));
|
|
766
|
+
async function inlineScriptSource(js, provenance) {
|
|
767
|
+
return escapeInlineScriptSource(await stripJsCommentsParserSafe(js, provenance));
|
|
768
768
|
}
|
|
769
769
|
function preserveLocalScriptIntegrity(doc, src, resolvePath) {
|
|
770
770
|
const path = resolvePath(src);
|
|
@@ -1131,7 +1131,7 @@ async function bundleProject(projectDir, options) {
|
|
|
1131
1131
|
if (scene)
|
|
1132
1132
|
script.setAttribute(SCENE_PART_ATTR, scene);
|
|
1133
1133
|
script.textContent = skipsRunMerge
|
|
1134
|
-
? inlineScriptSource(text, options?.scriptProvenance)
|
|
1134
|
+
? await inlineScriptSource(text, options?.scriptProvenance)
|
|
1135
1135
|
: text;
|
|
1136
1136
|
document.body.appendChild(script);
|
|
1137
1137
|
}
|
|
@@ -1140,10 +1140,10 @@ async function bundleProject(projectDir, options) {
|
|
|
1140
1140
|
emitRootCompositionVariableStyles(document, compVariablesByComp);
|
|
1141
1141
|
enforceCompositionPixelSizing(document);
|
|
1142
1142
|
autoHealMissingCompositionIds(document);
|
|
1143
|
-
coalesceHeadStylesAndBodyScripts(document, options?.scriptProvenance);
|
|
1143
|
+
await coalesceHeadStylesAndBodyScripts(document, options?.scriptProvenance);
|
|
1144
1144
|
for (const el of document.querySelectorAll(`script[${INLINED_FILE_ATTR}]`)) {
|
|
1145
1145
|
const js = el.textContent ?? "";
|
|
1146
|
-
el.textContent = escapeInlineScriptSource(isJavaScriptType(el) ? stripJsCommentsParserSafe(js, options?.scriptProvenance) : js);
|
|
1146
|
+
el.textContent = escapeInlineScriptSource(isJavaScriptType(el) ? await stripJsCommentsParserSafe(js, options?.scriptProvenance) : js);
|
|
1147
1147
|
}
|
|
1148
1148
|
deferScriptsUntilFonts(document, (el) => el.hasAttribute(RUNTIME_BOOTSTRAP_ATTR));
|
|
1149
1149
|
injectTextRenderingRule(document);
|