@hyperframes/core 0.8.203 → 0.8.205
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/compiler/htmlBundler.js +1 -4
- package/dist/compiler/index.d.ts +2 -2
- package/dist/compiler/index.js +2 -2
- package/dist/compiler/scriptRuns.d.ts +1 -1
- package/dist/compiler/scriptRuns.js +4 -1
- package/dist/generated/runtime-inline.js +1 -1
- package/dist/hyperframe.runtime.iife.js +17 -17
- package/dist/runtime/clipReveal.d.ts +2 -2
- package/dist/runtime/clipReveal.js +2 -2
- package/dist/studioPreviewMark.d.ts +2 -0
- package/dist/studioPreviewMark.js +2 -0
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { compositionStyle, cssStyleMergeKey, deferScriptsUntilFonts,
|
|
2
|
+
import { compositionStyle, cssStyleMergeKey, deferScriptsUntilFonts, isAlwaysAppliedStyle, headStyleRuns, INLINED_FILE_ATTR, inlineScriptRuns, styleElementsFor, } from "./scriptRuns.js";
|
|
3
3
|
import { countPageRoot, executableScripts, isJavaScriptType, planCompositionAssembly, } from "./compositionAssembly.js";
|
|
4
4
|
import { SCENE_FONTS_ATTR, SCENE_PART_ATTR } from "../sceneParts.js";
|
|
5
5
|
import { ensureExternalScriptTag, readExternalScriptAttributes, } from "./externalScripts.js";
|
|
@@ -640,9 +640,6 @@ function placeSceneStylesLikeRender(document) {
|
|
|
640
640
|
holder.textContent = hoisted;
|
|
641
641
|
first.before(holder);
|
|
642
642
|
}
|
|
643
|
-
function isAlwaysAppliedStyle(el) {
|
|
644
|
-
return cssStyleMergeKey(el) === UNCONDITIONAL_CSS_KEY && !el.closest("template, noscript, svg");
|
|
645
|
-
}
|
|
646
643
|
function pushRun(runs, scene, chunk) {
|
|
647
644
|
const last = runs.at(-1);
|
|
648
645
|
if (last && last.scene === scene)
|
package/dist/compiler/index.d.ts
CHANGED
|
@@ -6,10 +6,10 @@ export { readDeclaredDefaults, parseHostVariableValues } from "../runtime/getVar
|
|
|
6
6
|
export { extractCompiledHtmlParityContract, type CompiledHtmlParityContract, type HtmlParityComposition, type HtmlParityResource, type HtmlParityTimedElement, } from "./htmlParityContract.js";
|
|
7
7
|
export { RUNTIME_BOOTSTRAP_ATTR, injectScriptsAtHeadStart, injectTagsAtHeadStart, injectScriptsIntoHtml, insertBeforeCloseTag, insertRuntimeTag, isRuntimeFileUrl, parseHTMLContent, stripEmbeddedRuntimeScripts, } from "./htmlDocument.js";
|
|
8
8
|
export { addScenePartsManifest } from "./scenePartsManifest.js";
|
|
9
|
-
export { AFTER_FONTS_SCRIPT_TYPE, compositionStyle, cssStyleMergeKey, deferScriptsUntilFonts, headStyleRuns, inlineScriptRuns, styleElementsFor, type CompositionStyle, type InlineScriptRun, } from "./scriptRuns.js";
|
|
9
|
+
export { AFTER_FONTS_SCRIPT_TYPE, compositionStyle, cssStyleMergeKey, isAlwaysAppliedStyle, deferScriptsUntilFonts, headStyleRuns, inlineScriptRuns, styleElementsFor, type CompositionStyle, type InlineScriptRun, } from "./scriptRuns.js";
|
|
10
10
|
export { isJavaScriptType } from "./compositionAssembly.js";
|
|
11
11
|
export { validateHyperframeHtmlContract, type HyperframeStaticFailureReason, type HyperframeStaticGuardResult, } from "./staticGuard.js";
|
|
12
|
-
export { buildVariablesByCompScript, scopeCssToComposition, wrapScopedCompositionScript, } from "./compositionScoping.js";
|
|
12
|
+
export { buildVariablesByCompScript, dedupeFontFaceRules, scopeCssToComposition, wrapScopedCompositionScript, } from "./compositionScoping.js";
|
|
13
13
|
export { ensureExternalLinkTag, inlineSubCompositions, type InlineSubCompositionsOptions, type InlineSubCompositionsResult, } from "./inlineSubCompositions.js";
|
|
14
14
|
export { extractStandaloneEntryFromIndex, isTemplateEntry } from "./standaloneEntry.js";
|
|
15
15
|
export { checkSubCompositionUsability, type ParsableDocumentLike, type SubCompositionValidity, type SubCompositionValidityReason, } from "./subCompositionValidity.js";
|
package/dist/compiler/index.js
CHANGED
|
@@ -12,12 +12,12 @@ export { extractCompiledHtmlParityContract, } from "./htmlParityContract.js";
|
|
|
12
12
|
export { RUNTIME_BOOTSTRAP_ATTR, injectScriptsAtHeadStart, injectTagsAtHeadStart, injectScriptsIntoHtml, insertBeforeCloseTag, insertRuntimeTag, isRuntimeFileUrl, parseHTMLContent, stripEmbeddedRuntimeScripts, } from "./htmlDocument.js";
|
|
13
13
|
export { addScenePartsManifest } from "./scenePartsManifest.js";
|
|
14
14
|
// Script ordering shared by the bundler and the producer coalescers
|
|
15
|
-
export { AFTER_FONTS_SCRIPT_TYPE, compositionStyle, cssStyleMergeKey, deferScriptsUntilFonts, headStyleRuns, inlineScriptRuns, styleElementsFor, } from "./scriptRuns.js";
|
|
15
|
+
export { AFTER_FONTS_SCRIPT_TYPE, compositionStyle, cssStyleMergeKey, isAlwaysAppliedStyle, deferScriptsUntilFonts, headStyleRuns, inlineScriptRuns, styleElementsFor, } from "./scriptRuns.js";
|
|
16
16
|
export { isJavaScriptType } from "./compositionAssembly.js";
|
|
17
17
|
// Static guard
|
|
18
18
|
export { validateHyperframeHtmlContract, } from "./staticGuard.js";
|
|
19
19
|
// Composition isolation helpers
|
|
20
|
-
export { buildVariablesByCompScript, scopeCssToComposition, wrapScopedCompositionScript, } from "./compositionScoping.js";
|
|
20
|
+
export { buildVariablesByCompScript, dedupeFontFaceRules, scopeCssToComposition, wrapScopedCompositionScript, } from "./compositionScoping.js";
|
|
21
21
|
// Sub-composition inlining (shared between bundler and producer)
|
|
22
22
|
export { ensureExternalLinkTag, inlineSubCompositions, } from "./inlineSubCompositions.js";
|
|
23
23
|
export { extractStandaloneEntryFromIndex, isTemplateEntry } from "./standaloneEntry.js";
|
|
@@ -17,7 +17,7 @@ export declare function deferScriptsUntilFonts(document: Document, isFramework?:
|
|
|
17
17
|
export declare function typeAfterFonts(el: Element): string | null;
|
|
18
18
|
/** Undefined for a type the browser never applies as CSS; `media="all"` and an empty title count as none. */
|
|
19
19
|
export declare function cssStyleMergeKey(el: Element): string | undefined;
|
|
20
|
-
export declare
|
|
20
|
+
export declare function isAlwaysAppliedStyle(el: Element): boolean;
|
|
21
21
|
export declare function hasSameLink(scope: ParentNode, link: Element): boolean;
|
|
22
22
|
/** Groups head styles into runs of adjacent styles with one merge key, so merging a run never reorders rules. */
|
|
23
23
|
export declare function headStyleRuns(styles: readonly Element[], isPinned?: (el: Element) => boolean): Element[][];
|
|
@@ -102,7 +102,10 @@ export function cssStyleMergeKey(el) {
|
|
|
102
102
|
const media = (el.getAttribute("media") ?? "").trim().toLowerCase();
|
|
103
103
|
return JSON.stringify([media === "all" ? "" : media, el.getAttribute("title") ?? ""]);
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
const UNCONDITIONAL_CSS_KEY = JSON.stringify(["", ""]);
|
|
106
|
+
export function isAlwaysAppliedStyle(el) {
|
|
107
|
+
return cssStyleMergeKey(el) === UNCONDITIONAL_CSS_KEY && !el.closest("template, noscript, svg");
|
|
108
|
+
}
|
|
106
109
|
/** A link's identity and condition; fetch attributes (crossorigin, integrity, referrerpolicy) are not compared. */
|
|
107
110
|
function linkDedupeKey(el) {
|
|
108
111
|
return JSON.stringify([
|