@hyperframes/parsers 0.9.26 → 0.9.28-alpha.0
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/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { getObjectArrayKeyframeTiming } from './gsapParserExports.js';
|
|
|
6
6
|
export { SPRING_PRESETS, SpringPreset, generateSpringEaseData } from './springEase.js';
|
|
7
7
|
export { parseGsapScriptAcorn as parseGsapScript } from './gsapParserAcorn.js';
|
|
8
8
|
export { EXCLUDED_TAGS, ensureHfIds, isCompositionTemplate, mintHfId, stampHfIdsInPlace, walkCompositionDescendants } from './hfIds.js';
|
|
9
|
-
export { ParsableDocumentLike, SubCompositionValidity, SubCompositionValidityReason, checkSubCompositionUsability, resolveSubCompositionContent } from './subCompositionValidity.js';
|
|
9
|
+
export { ParsableDocumentLike, SceneTemplateLike, SubCompositionValidity, SubCompositionValidityReason, checkSubCompositionUsability, findSceneTemplate, resolveSubCompositionContent } from './subCompositionValidity.js';
|
|
10
10
|
export { CANONICAL_AUTHORED_TIMING_ATTRIBUTES, COMPOSITION_ATTRIBUTES, COMPOSITION_CONTRACT_VERSION, ClipAttributeReader, ClipAttributeWriter, ClipTiming, ClipTimingDiagnostic, ClipTimingDiagnosticCode, ClipTimingUpdate, ClipTimingWriteError, DERIVED_TIMING_ATTRIBUTES, LEGACY_TIMING_ATTRIBUTES, ReadClipTimingOptions, ReferenceExpression, SPLIT_BOUNDARY_EPSILON_S, parseNumeric, parseStartExpression, readClipTiming, writeClipTiming } from './compositionContract.js';
|
|
11
11
|
export { C as CANONICAL_FONT_DISPLAY_NAMES, F as FONT_ALIAS_KEYS, a as FONT_ALIAS_MAP, H as HTML_BODY_CSS_HEIGHT_FIRST_RE, b as HTML_BODY_CSS_WIDTH_FIRST_RE, M as MediaSrcMutation, V as VIEWPORT_META_SIZE_RE, c as VariableUsageScan, e as extractMediaSrcMutations, p as parseCompositionVariables, r as resolveAliasDisplayName, s as scanVariableUsage } from './fontAliases-CjqNyywH.js';
|
|
12
12
|
export { StructureNode, TrackKind, TrackKindSource, isSubCompositionHost, isTimedElement, topLevelElements, trackKindOf } from './topLevelElements.js';
|
package/dist/index.js
CHANGED
|
@@ -3669,8 +3669,14 @@ function extractGsapScripts(doc) {
|
|
|
3669
3669
|
}
|
|
3670
3670
|
|
|
3671
3671
|
// src/subCompositionValidity.ts
|
|
3672
|
+
function findSceneTemplate(templates) {
|
|
3673
|
+
return Array.from(templates).find(
|
|
3674
|
+
(template) => template.content.querySelector("[data-composition-id]") != null
|
|
3675
|
+
);
|
|
3676
|
+
}
|
|
3672
3677
|
function resolveSubCompositionContent(html, document) {
|
|
3673
|
-
const
|
|
3678
|
+
const templates = Array.from(document.querySelectorAll("template"));
|
|
3679
|
+
const template = findSceneTemplate(templates) ?? templates[0];
|
|
3674
3680
|
if (template) return { contentHtml: template.innerHTML ?? "", hasTemplate: true };
|
|
3675
3681
|
const body = document.querySelector("body");
|
|
3676
3682
|
if (body) return { contentHtml: body.innerHTML ?? "", hasTemplate: false };
|
|
@@ -4806,6 +4812,7 @@ export {
|
|
|
4806
4812
|
ensureHfIds,
|
|
4807
4813
|
extractCompositionMetadata,
|
|
4808
4814
|
extractMediaSrcMutations,
|
|
4815
|
+
findSceneTemplate,
|
|
4809
4816
|
generateSpringEaseData,
|
|
4810
4817
|
getAnimationsForElementId,
|
|
4811
4818
|
getDefaultStageZoom,
|
|
@@ -54,7 +54,16 @@ interface ParsableDocumentLike {
|
|
|
54
54
|
querySelector(selector: string): {
|
|
55
55
|
innerHTML?: string | null;
|
|
56
56
|
} | null;
|
|
57
|
+
querySelectorAll(selector: string): ArrayLike<{
|
|
58
|
+
innerHTML?: string | null;
|
|
59
|
+
} & SceneTemplateLike>;
|
|
60
|
+
}
|
|
61
|
+
interface SceneTemplateLike {
|
|
62
|
+
content: {
|
|
63
|
+
querySelector(selector: string): unknown;
|
|
64
|
+
};
|
|
57
65
|
}
|
|
66
|
+
declare function findSceneTemplate<T extends SceneTemplateLike>(templates: ArrayLike<T>): T | undefined;
|
|
58
67
|
/** Resolve authored content without invoking linkedom's synthetic body getter. */
|
|
59
68
|
declare function resolveSubCompositionContent(html: string, document: ParsableDocumentLike): {
|
|
60
69
|
contentHtml: string;
|
|
@@ -81,4 +90,4 @@ declare function resolveSubCompositionContent(html: string, document: ParsableDo
|
|
|
81
90
|
*/
|
|
82
91
|
declare function checkSubCompositionUsability(html: string | null | undefined, parseHtml: (html: string) => ParsableDocumentLike): SubCompositionValidity;
|
|
83
92
|
|
|
84
|
-
export { type ParsableDocumentLike, type SubCompositionValidity, type SubCompositionValidityReason, checkSubCompositionUsability, resolveSubCompositionContent };
|
|
93
|
+
export { type ParsableDocumentLike, type SceneTemplateLike, type SubCompositionValidity, type SubCompositionValidityReason, checkSubCompositionUsability, findSceneTemplate, resolveSubCompositionContent };
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
// src/subCompositionValidity.ts
|
|
2
|
+
function findSceneTemplate(templates) {
|
|
3
|
+
return Array.from(templates).find(
|
|
4
|
+
(template) => template.content.querySelector("[data-composition-id]") != null
|
|
5
|
+
);
|
|
6
|
+
}
|
|
2
7
|
function resolveSubCompositionContent(html, document) {
|
|
3
|
-
const
|
|
8
|
+
const templates = Array.from(document.querySelectorAll("template"));
|
|
9
|
+
const template = findSceneTemplate(templates) ?? templates[0];
|
|
4
10
|
if (template) return { contentHtml: template.innerHTML ?? "", hasTemplate: true };
|
|
5
11
|
const body = document.querySelector("body");
|
|
6
12
|
if (body) return { contentHtml: body.innerHTML ?? "", hasTemplate: false };
|
|
@@ -50,5 +56,6 @@ function checkSubCompositionUsability(html, parseHtml) {
|
|
|
50
56
|
}
|
|
51
57
|
export {
|
|
52
58
|
checkSubCompositionUsability,
|
|
59
|
+
findSceneTemplate,
|
|
53
60
|
resolveSubCompositionContent
|
|
54
61
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/parsers",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.28-alpha.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/heygen-com/hyperframes",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"tsx": "^4.21.0",
|
|
140
140
|
"typescript": "^5.0.0",
|
|
141
141
|
"vitest": "^4.1.11",
|
|
142
|
-
"@hyperframes/core": "0.9.
|
|
142
|
+
"@hyperframes/core": "0.9.28-alpha.0"
|
|
143
143
|
},
|
|
144
144
|
"scripts": {
|
|
145
145
|
"build": "tsup",
|