@hyperframes/parsers 0.8.200 → 0.8.202
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/composition.d.ts +5 -3
- package/dist/composition.js +11 -1
- package/dist/gsapConstants.d.ts +2 -2
- package/dist/gsapParser.d.ts +3 -3
- package/dist/gsapParserAcorn.d.ts +3 -3
- package/dist/gsapParserExports.d.ts +2 -2
- package/dist/{gsapSerialize-DmU7GIhl.d.ts → gsapSerialize-DTDYI-MO.d.ts} +1 -1
- package/dist/gsapWriterAcorn.d.ts +2 -2
- package/dist/index.d.ts +21 -4
- package/dist/index.js +38 -1
- package/dist/{types-DhN8sPyL.d.ts → types-CdT7qqke.d.ts} +14 -17
- package/package.json +2 -2
package/dist/composition.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CompositionVariable } from './types-
|
|
2
|
-
export { A as AddElementData, b as Asset, B as BooleanVariable, c as CANVAS_DIMENSIONS, d as COMPOSITION_VARIABLE_TYPES, a as CanvasResolution, e as ColorVariable, f as CompositionAPI, g as CompositionAsset, h as CompositionSpec, i as CompositionVariableBase, j as CompositionVariableType, D as DEFAULT_DURATIONS, E as ElementKeyframes, k as EnumVariable,
|
|
1
|
+
import { C as CompositionVariable, F as FontValue, I as ImageValue } from './types-CdT7qqke.js';
|
|
2
|
+
export { A as AddElementData, b as Asset, B as BooleanVariable, c as CANVAS_DIMENSIONS, d as COMPOSITION_VARIABLE_TYPES, a as CanvasResolution, e as ColorVariable, f as CompositionAPI, g as CompositionAsset, h as CompositionSpec, i as CompositionVariableBase, j as CompositionVariableType, D as DEFAULT_DURATIONS, E as ElementKeyframes, k as EnumVariable, l as FontVariable, m as ImageVariable, K as Keyframe, n as KeyframeProperties, M as MediaElementType, o as MediaFile, N as NumberVariable, P as PlayerAPI, R as ResolvedResolutionFlag, p as StageZoom, S as StageZoomKeyframe, q as StringVariable, r as TIMELINE_COLORS, s as TimelineCompositionElement, T as TimelineElement, t as TimelineElementBase, u as TimelineElementType, v as TimelineMediaElement, w as TimelineTextElement, x as VALID_CANVAS_RESOLUTIONS, V as ValidationResult, W as WaveformData, y as getDefaultStageZoom, z as isAspectAgnosticResolutionAlias, G as isCompositionElement, H as isMediaElement, J as isTextElement, L as normalizeResolutionFlag, O as resolveResolutionFlagPair } from './types-CdT7qqke.js';
|
|
3
3
|
export { c as decodeUrlPathVariants } from './urlPath-C_0f_-Hp.js';
|
|
4
4
|
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, parseNumeric, parseStartExpression, readClipTiming, writeClipTiming } from './compositionContract.js';
|
|
5
5
|
|
|
@@ -17,6 +17,8 @@ export { CANONICAL_AUTHORED_TIMING_ATTRIBUTES, COMPOSITION_ATTRIBUTES, COMPOSITI
|
|
|
17
17
|
* display logic can never disagree on what "scalar" means.
|
|
18
18
|
*/
|
|
19
19
|
declare function isScalarVariableValue(value: unknown): value is string | number | boolean;
|
|
20
|
+
declare function isFontValue(value: unknown): value is FontValue;
|
|
21
|
+
declare function isImageValue(value: unknown): value is ImageValue;
|
|
20
22
|
/**
|
|
21
23
|
* True when the value is a structurally valid variable declaration: id, label,
|
|
22
24
|
* a known type, a default matching that type, and options[] for enums. The
|
|
@@ -183,4 +185,4 @@ declare const CANONICAL_FONT_DISPLAY_NAMES: Readonly<Record<string, string>>;
|
|
|
183
185
|
*/
|
|
184
186
|
declare function resolveAliasDisplayName(alias: string): string | undefined;
|
|
185
187
|
|
|
186
|
-
export { CANONICAL_FONT_DISPLAY_NAMES, CompositionVariable, FONT_ALIAS_KEYS, FONT_ALIAS_MAP, HTML_BODY_CSS_HEIGHT_FIRST_RE, HTML_BODY_CSS_WIDTH_FIRST_RE, type MediaSrcMutation, VIEWPORT_META_SIZE_RE, type VariableUsageScan, extractMediaSrcMutations, isCompositionVariable, isSafeMediaUrl, isScalarVariableValue, parseCompositionVariables, resolveAliasDisplayName, scanVariableUsage };
|
|
188
|
+
export { CANONICAL_FONT_DISPLAY_NAMES, CompositionVariable, FONT_ALIAS_KEYS, FONT_ALIAS_MAP, FontValue, HTML_BODY_CSS_HEIGHT_FIRST_RE, HTML_BODY_CSS_WIDTH_FIRST_RE, ImageValue, type MediaSrcMutation, VIEWPORT_META_SIZE_RE, type VariableUsageScan, extractMediaSrcMutations, isCompositionVariable, isFontValue, isImageValue, isSafeMediaUrl, isScalarVariableValue, parseCompositionVariables, resolveAliasDisplayName, scanVariableUsage };
|
package/dist/composition.js
CHANGED
|
@@ -237,7 +237,13 @@ function isScalarVariableValue(value) {
|
|
|
237
237
|
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
238
238
|
}
|
|
239
239
|
function isRecord(v) {
|
|
240
|
-
return typeof v === "object" && v !== null;
|
|
240
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
241
|
+
}
|
|
242
|
+
function isFontValue(value) {
|
|
243
|
+
return isRecord(value) && typeof value.name === "string" && typeof value.source === "string";
|
|
244
|
+
}
|
|
245
|
+
function isImageValue(value) {
|
|
246
|
+
return isRecord(value) && typeof value.url === "string" && (value.alt === void 0 || typeof value.alt === "string") && (value.fit === void 0 || value.fit === "cover" || value.fit === "contain" || value.fit === "fill" || value.fit === "none" || value.fit === "scale-down");
|
|
241
247
|
}
|
|
242
248
|
function isVariableType(t) {
|
|
243
249
|
return typeof t === "string" && t in DEFAULT_TYPEOF;
|
|
@@ -246,6 +252,8 @@ function isCompositionVariable(v) {
|
|
|
246
252
|
if (!isRecord(v)) return false;
|
|
247
253
|
if (typeof v.id !== "string" || typeof v.label !== "string") return false;
|
|
248
254
|
if (!isVariableType(v.type)) return false;
|
|
255
|
+
if (v.type === "font") return typeof v.default === "string" || isFontValue(v.default);
|
|
256
|
+
if (v.type === "image") return typeof v.default === "string" || isImageValue(v.default);
|
|
249
257
|
if (typeof v.default !== DEFAULT_TYPEOF[v.type]) return false;
|
|
250
258
|
if (v.type === "enum" && !Array.isArray(v.options)) return false;
|
|
251
259
|
return true;
|
|
@@ -764,6 +772,8 @@ export {
|
|
|
764
772
|
isAspectAgnosticResolutionAlias,
|
|
765
773
|
isCompositionElement,
|
|
766
774
|
isCompositionVariable,
|
|
775
|
+
isFontValue,
|
|
776
|
+
isImageValue,
|
|
767
777
|
isMediaElement,
|
|
768
778
|
isSafeMediaUrl,
|
|
769
779
|
isScalarVariableValue,
|
package/dist/gsapConstants.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { B as BUILTIN_VAR_KEYS, D as DROPPED_VAR_KEYS, E as EXTRAS_KEYS, u as GSAP_DEFAULT_DURATION, H as HoldScope, f as PROPERTY_GROUPS, g as PropertyGroupName, S as SUPPORTED_EASES, h as SUPPORTED_PROPS, i as classifyPropertyGroup, j as classifyTweenPropertyGroup, x as holdScope, y as isTweenConfigKey, z as isXYPositionWrite, C as keyframeHoldForAnimation } from './gsapSerialize-
|
|
2
|
-
import './types-
|
|
1
|
+
export { B as BUILTIN_VAR_KEYS, D as DROPPED_VAR_KEYS, E as EXTRAS_KEYS, u as GSAP_DEFAULT_DURATION, H as HoldScope, f as PROPERTY_GROUPS, g as PropertyGroupName, S as SUPPORTED_EASES, h as SUPPORTED_PROPS, i as classifyPropertyGroup, j as classifyTweenPropertyGroup, x as holdScope, y as isTweenConfigKey, z as isXYPositionWrite, C as keyframeHoldForAnimation } from './gsapSerialize-DTDYI-MO.js';
|
|
2
|
+
import './types-CdT7qqke.js';
|
package/dist/gsapParser.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { G as GsapAnimation, P as ParsedGsap, A as ArcPathConfig, a as ArcPathSegment } from './gsapSerialize-
|
|
2
|
-
export { b as GsapKeyframeFormat, c as GsapKeyframesData, d as GsapMethod, e as GsapPercentageKeyframe, f as PROPERTY_GROUPS, g as PropertyGroupName, S as SUPPORTED_EASES, h as SUPPORTED_PROPS, i as classifyPropertyGroup, j as classifyTweenPropertyGroup, k as getAnimationsForElementId, l as gsapAnimationsToKeyframes, m as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-
|
|
1
|
+
import { G as GsapAnimation, P as ParsedGsap, A as ArcPathConfig, a as ArcPathSegment } from './gsapSerialize-DTDYI-MO.js';
|
|
2
|
+
export { b as GsapKeyframeFormat, c as GsapKeyframesData, d as GsapMethod, e as GsapPercentageKeyframe, f as PROPERTY_GROUPS, g as PropertyGroupName, S as SUPPORTED_EASES, h as SUPPORTED_PROPS, i as classifyPropertyGroup, j as classifyTweenPropertyGroup, k as getAnimationsForElementId, l as gsapAnimationsToKeyframes, m as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-DTDYI-MO.js';
|
|
3
3
|
export { SPRING_PRESETS, SpringPreset, generateSpringEaseData } from './springEase.js';
|
|
4
|
-
import './types-
|
|
4
|
+
import './types-CdT7qqke.js';
|
|
5
5
|
|
|
6
6
|
declare function parseGsapScript(script: string): ParsedGsap;
|
|
7
7
|
declare function updateAnimationInScript(script: string, animationId: string, updates: Partial<GsapAnimation> & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ParsedGsap, d as GsapMethod, G as GsapAnimation } from './gsapSerialize-
|
|
2
|
-
export { A as ArcPathConfig, a as ArcPathSegment, n as GsapProvenance, o as GsapProvenanceKind, K as KeyframeEditability, M as MotionPathShape, p as buildArcPath, q as editabilityForProvenance } from './gsapSerialize-
|
|
3
|
-
import './types-
|
|
1
|
+
import { P as ParsedGsap, d as GsapMethod, G as GsapAnimation } from './gsapSerialize-DTDYI-MO.js';
|
|
2
|
+
export { A as ArcPathConfig, a as ArcPathSegment, n as GsapProvenance, o as GsapProvenanceKind, K as KeyframeEditability, M as MotionPathShape, p as buildArcPath, q as editabilityForProvenance } from './gsapSerialize-DTDYI-MO.js';
|
|
3
|
+
import './types-CdT7qqke.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A script's syntax tree as one string, or null when it does not parse. Comments, layout, quote
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { A as ArcPathConfig, a as ArcPathSegment, u as GSAP_DEFAULT_DURATION, G as GsapAnimation, c as GsapKeyframesData, d as GsapMethod, e as GsapPercentageKeyframe, n as GsapProvenance, o as GsapProvenanceKind, K as KeyframeEditability, f as PROPERTY_GROUPS, P as ParsedGsap, g as PropertyGroupName, S as SUPPORTED_EASES, h as SUPPORTED_PROPS, w as SourcedGsapPercentageKeyframe, r as SplitAnimationsOptions, t as SplitAnimationsResult, i as classifyPropertyGroup, j as classifyTweenPropertyGroup, q as editabilityForProvenance, k as getAnimationsForElementId, l as gsapAnimationsToKeyframes, m as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-
|
|
1
|
+
export { A as ArcPathConfig, a as ArcPathSegment, u as GSAP_DEFAULT_DURATION, G as GsapAnimation, c as GsapKeyframesData, d as GsapMethod, e as GsapPercentageKeyframe, n as GsapProvenance, o as GsapProvenanceKind, K as KeyframeEditability, f as PROPERTY_GROUPS, P as ParsedGsap, g as PropertyGroupName, S as SUPPORTED_EASES, h as SUPPORTED_PROPS, w as SourcedGsapPercentageKeyframe, r as SplitAnimationsOptions, t as SplitAnimationsResult, i as classifyPropertyGroup, j as classifyTweenPropertyGroup, q as editabilityForProvenance, k as getAnimationsForElementId, l as gsapAnimationsToKeyframes, m as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-DTDYI-MO.js';
|
|
2
2
|
export { isStudioHoldSet } from './gsapParser.js';
|
|
3
3
|
export { SPRING_PRESETS, SpringPreset, generateSpringEaseData } from './springEase.js';
|
|
4
4
|
export { parseGsapScriptAcorn as parseGsapScript } from './gsapParserAcorn.js';
|
|
5
|
-
import './types-
|
|
5
|
+
import './types-CdT7qqke.js';
|
|
6
6
|
|
|
7
7
|
interface ObjectArrayKeyframeTiming {
|
|
8
8
|
percentages: number[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GsapAnimation, A as ArcPathConfig, r as SplitAnimationsOptions, t as SplitAnimationsResult, a as ArcPathSegment } from './gsapSerialize-
|
|
2
|
-
import './types-
|
|
1
|
+
import { G as GsapAnimation, A as ArcPathConfig, r as SplitAnimationsOptions, t as SplitAnimationsResult, a as ArcPathSegment } from './gsapSerialize-DTDYI-MO.js';
|
|
2
|
+
import './types-CdT7qqke.js';
|
|
3
3
|
|
|
4
4
|
type TweenTarget = Pick<GsapAnimation, "targetSelector" | "hasPartialSelector">;
|
|
5
5
|
type TweenTime = Pick<GsapAnimation, "position" | "implicitPosition">;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as CompositionVariable, T as TimelineElement, a as CanvasResolution, K as Keyframe, S as StageZoomKeyframe, V as ValidationResult } from './types-
|
|
2
|
-
export { A as AddElementData, b as Asset, B as BooleanVariable, c as CANVAS_DIMENSIONS, d as COMPOSITION_VARIABLE_TYPES, e as ColorVariable, f as CompositionAPI, g as CompositionAsset, h as CompositionSpec, i as CompositionVariableBase, j as CompositionVariableType, D as DEFAULT_DURATIONS, E as ElementKeyframes, k as EnumVariable, F as FontVariable, I as ImageVariable,
|
|
3
|
-
export { A as ArcPathConfig, a as ArcPathSegment, u as GSAP_DEFAULT_DURATION, G as GsapAnimation, c as GsapKeyframesData, d as GsapMethod, e as GsapPercentageKeyframe, n as GsapProvenance, o as GsapProvenanceKind, K as KeyframeEditability, f as PROPERTY_GROUPS, P as ParsedGsap, g as PropertyGroupName, S as SUPPORTED_EASES, h as SUPPORTED_PROPS, w as SourcedGsapPercentageKeyframe, r as SplitAnimationsOptions, t as SplitAnimationsResult, i as classifyPropertyGroup, j as classifyTweenPropertyGroup, q as editabilityForProvenance, k as getAnimationsForElementId, l as gsapAnimationsToKeyframes, m as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-
|
|
1
|
+
import { C as CompositionVariable, T as TimelineElement, a as CanvasResolution, K as Keyframe, S as StageZoomKeyframe, V as ValidationResult } from './types-CdT7qqke.js';
|
|
2
|
+
export { A as AddElementData, b as Asset, B as BooleanVariable, c as CANVAS_DIMENSIONS, d as COMPOSITION_VARIABLE_TYPES, e as ColorVariable, f as CompositionAPI, g as CompositionAsset, h as CompositionSpec, i as CompositionVariableBase, j as CompositionVariableType, D as DEFAULT_DURATIONS, E as ElementKeyframes, k as EnumVariable, F as FontValue, l as FontVariable, I as ImageValue, m as ImageVariable, n as KeyframeProperties, M as MediaElementType, o as MediaFile, N as NumberVariable, P as PlayerAPI, R as ResolvedResolutionFlag, p as StageZoom, q as StringVariable, r as TIMELINE_COLORS, s as TimelineCompositionElement, t as TimelineElementBase, u as TimelineElementType, v as TimelineMediaElement, w as TimelineTextElement, x as VALID_CANVAS_RESOLUTIONS, W as WaveformData, y as getDefaultStageZoom, z as isAspectAgnosticResolutionAlias, G as isCompositionElement, H as isMediaElement, J as isTextElement, L as normalizeResolutionFlag, O as resolveResolutionFlagPair } from './types-CdT7qqke.js';
|
|
3
|
+
export { A as ArcPathConfig, a as ArcPathSegment, u as GSAP_DEFAULT_DURATION, G as GsapAnimation, c as GsapKeyframesData, d as GsapMethod, e as GsapPercentageKeyframe, n as GsapProvenance, o as GsapProvenanceKind, K as KeyframeEditability, f as PROPERTY_GROUPS, P as ParsedGsap, g as PropertyGroupName, S as SUPPORTED_EASES, h as SUPPORTED_PROPS, w as SourcedGsapPercentageKeyframe, r as SplitAnimationsOptions, t as SplitAnimationsResult, i as classifyPropertyGroup, j as classifyTweenPropertyGroup, q as editabilityForProvenance, k as getAnimationsForElementId, l as gsapAnimationsToKeyframes, m as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-DTDYI-MO.js';
|
|
4
4
|
export { isStudioHoldSet } from './gsapParser.js';
|
|
5
5
|
export { getObjectArrayKeyframeTiming } from './gsapParserExports.js';
|
|
6
6
|
export { SPRING_PRESETS, SpringPreset, generateSpringEaseData } from './springEase.js';
|
|
@@ -130,6 +130,23 @@ declare function checkOutputResolutionCompatibility(input: {
|
|
|
130
130
|
alphaRequested?: boolean;
|
|
131
131
|
hdrRequested?: boolean;
|
|
132
132
|
}): OutputResolutionCompatibility;
|
|
133
|
+
type OutputSizeResolution = {
|
|
134
|
+
ok: true;
|
|
135
|
+
outputResolution: CanvasResolution | undefined;
|
|
136
|
+
} | {
|
|
137
|
+
ok: false;
|
|
138
|
+
message: string;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* The preset a requested pixel size stands for on a composition: none when it is the composition's own size,
|
|
142
|
+
* else the preset of exactly that size when it is a whole-number multiple (3840×2160 on 1920×1080 is scale 2).
|
|
143
|
+
*/
|
|
144
|
+
declare function outputResolutionForSize(input: {
|
|
145
|
+
compositionWidth: number;
|
|
146
|
+
compositionHeight: number;
|
|
147
|
+
width: number;
|
|
148
|
+
height: number;
|
|
149
|
+
}): OutputSizeResolution;
|
|
133
150
|
|
|
134
151
|
/** Rewrite top-level helper calls and loops into literal tweens; unchanged when nothing can be unrolled. */
|
|
135
152
|
declare function unrollComputedTimeline(script: string): string;
|
|
@@ -168,4 +185,4 @@ interface TimingMismatchReport {
|
|
|
168
185
|
*/
|
|
169
186
|
declare function timingMismatches(html: string): TimingMismatchReport;
|
|
170
187
|
|
|
171
|
-
export { CanvasResolution, CompositionHtmlParseError, type CompositionMetadata, CompositionVariable, Keyframe, type OutputResolutionCompatibility, type OutputResolutionIssueKind, type ParsedHtml, StageZoomKeyframe, TimelineElement, type TimingFinding, type TimingMismatchReport, type UnresolvedTiming, ValidationResult, addElementToHtml, checkOutputResolutionCompatibility, extractCompositionMetadata, parseHtml, queryByAttr, removeElementFromHtml, removeElementWithGsapCascade, suggestMatchingPreset, timingMismatches, unrollComputedTimeline, updateElementInHtml, validateCompositionHtml };
|
|
188
|
+
export { CanvasResolution, CompositionHtmlParseError, type CompositionMetadata, CompositionVariable, Keyframe, type OutputResolutionCompatibility, type OutputResolutionIssueKind, type OutputSizeResolution, type ParsedHtml, StageZoomKeyframe, TimelineElement, type TimingFinding, type TimingMismatchReport, type UnresolvedTiming, ValidationResult, addElementToHtml, checkOutputResolutionCompatibility, extractCompositionMetadata, outputResolutionForSize, parseHtml, queryByAttr, removeElementFromHtml, removeElementWithGsapCascade, suggestMatchingPreset, timingMismatches, unrollComputedTimeline, updateElementInHtml, validateCompositionHtml };
|
package/dist/index.js
CHANGED
|
@@ -2376,7 +2376,13 @@ var DEFAULT_TYPEOF = {
|
|
|
2376
2376
|
image: "string"
|
|
2377
2377
|
};
|
|
2378
2378
|
function isRecord(v) {
|
|
2379
|
-
return typeof v === "object" && v !== null;
|
|
2379
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
2380
|
+
}
|
|
2381
|
+
function isFontValue(value) {
|
|
2382
|
+
return isRecord(value) && typeof value.name === "string" && typeof value.source === "string";
|
|
2383
|
+
}
|
|
2384
|
+
function isImageValue(value) {
|
|
2385
|
+
return isRecord(value) && typeof value.url === "string" && (value.alt === void 0 || typeof value.alt === "string") && (value.fit === void 0 || value.fit === "cover" || value.fit === "contain" || value.fit === "fill" || value.fit === "none" || value.fit === "scale-down");
|
|
2380
2386
|
}
|
|
2381
2387
|
function isVariableType(t) {
|
|
2382
2388
|
return typeof t === "string" && t in DEFAULT_TYPEOF;
|
|
@@ -2385,6 +2391,8 @@ function isCompositionVariable(v) {
|
|
|
2385
2391
|
if (!isRecord(v)) return false;
|
|
2386
2392
|
if (typeof v.id !== "string" || typeof v.label !== "string") return false;
|
|
2387
2393
|
if (!isVariableType(v.type)) return false;
|
|
2394
|
+
if (v.type === "font") return typeof v.default === "string" || isFontValue(v.default);
|
|
2395
|
+
if (v.type === "image") return typeof v.default === "string" || isImageValue(v.default);
|
|
2388
2396
|
if (typeof v.default !== DEFAULT_TYPEOF[v.type]) return false;
|
|
2389
2397
|
if (v.type === "enum" && !Array.isArray(v.options)) return false;
|
|
2390
2398
|
return true;
|
|
@@ -3730,6 +3738,34 @@ function checkOutputResolutionCompatibility(input) {
|
|
|
3730
3738
|
}
|
|
3731
3739
|
return OK;
|
|
3732
3740
|
}
|
|
3741
|
+
function outputResolutionForSize(input) {
|
|
3742
|
+
const { compositionWidth, compositionHeight, width, height } = input;
|
|
3743
|
+
if (width === compositionWidth && height === compositionHeight) {
|
|
3744
|
+
return { ok: true, outputResolution: void 0 };
|
|
3745
|
+
}
|
|
3746
|
+
const composition = `${compositionWidth}\xD7${compositionHeight}`;
|
|
3747
|
+
const scale = width / compositionWidth;
|
|
3748
|
+
if (width < compositionWidth || height < compositionHeight) {
|
|
3749
|
+
return {
|
|
3750
|
+
ok: false,
|
|
3751
|
+
message: `${width}\xD7${height} is smaller than the composition (${composition}). Use the composition's size, or a whole-number multiple of it.`
|
|
3752
|
+
};
|
|
3753
|
+
}
|
|
3754
|
+
const preset = VALID_CANVAS_RESOLUTIONS.find(
|
|
3755
|
+
(name) => CANVAS_DIMENSIONS[name].width === width && CANVAS_DIMENSIONS[name].height === height
|
|
3756
|
+
);
|
|
3757
|
+
if (!Number.isInteger(scale) || height !== compositionHeight * scale || !preset || !checkOutputResolutionCompatibility({
|
|
3758
|
+
compositionWidth,
|
|
3759
|
+
compositionHeight,
|
|
3760
|
+
outputResolution: preset
|
|
3761
|
+
}).ok) {
|
|
3762
|
+
return {
|
|
3763
|
+
ok: false,
|
|
3764
|
+
message: `${width}\xD7${height} is not a whole-number multiple of the composition (${composition}) at a supported size. Use ${composition}, or a multiple such as ${compositionWidth * 2}\xD7${compositionHeight * 2} when that is a preset size (${VALID_CANVAS_RESOLUTIONS.map((name) => `${CANVAS_DIMENSIONS[name].width}\xD7${CANVAS_DIMENSIONS[name].height}`).join(", ")}).`
|
|
3765
|
+
};
|
|
3766
|
+
}
|
|
3767
|
+
return { ok: true, outputResolution: preset };
|
|
3768
|
+
}
|
|
3733
3769
|
|
|
3734
3770
|
// src/gsapUnroll.ts
|
|
3735
3771
|
import * as acorn2 from "acorn";
|
|
@@ -4635,6 +4671,7 @@ export {
|
|
|
4635
4671
|
keyframesToGsapAnimations,
|
|
4636
4672
|
mintHfId,
|
|
4637
4673
|
normalizeResolutionFlag,
|
|
4674
|
+
outputResolutionForSize,
|
|
4638
4675
|
parseCompositionVariables,
|
|
4639
4676
|
parseGsapScriptAcorn as parseGsapScript,
|
|
4640
4677
|
parseHtml,
|
|
@@ -208,17 +208,19 @@ interface EnumVariable extends CompositionVariableBase {
|
|
|
208
208
|
label: string;
|
|
209
209
|
}[];
|
|
210
210
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
211
|
+
interface FontValue {
|
|
212
|
+
name: string;
|
|
213
|
+
source: string;
|
|
214
|
+
}
|
|
215
|
+
interface ImageValue {
|
|
216
|
+
url: string;
|
|
217
|
+
alt?: string;
|
|
218
|
+
fit?: "cover" | "contain" | "fill" | "none" | "scale-down";
|
|
219
|
+
}
|
|
218
220
|
interface FontVariable extends CompositionVariableBase {
|
|
219
221
|
type: "font";
|
|
220
|
-
/**
|
|
221
|
-
default: string;
|
|
222
|
+
/** Font-family fallback or a persisted font value. */
|
|
223
|
+
default: string | FontValue;
|
|
222
224
|
/** Font stylesheet URL (e.g. Google Fonts CSS link). */
|
|
223
225
|
source?: string;
|
|
224
226
|
/** CSS font-family name to use when source is unavailable, e.g. "sans-serif". */
|
|
@@ -226,15 +228,10 @@ interface FontVariable extends CompositionVariableBase {
|
|
|
226
228
|
/** Fallback font stylesheet URL (empty string = system font). */
|
|
227
229
|
default_source?: string;
|
|
228
230
|
}
|
|
229
|
-
/**
|
|
230
|
-
* Image variable — value is a `{url, …}` object (object-valued; LOCKED §7).
|
|
231
|
-
* `default` is the fallback image URL string.
|
|
232
|
-
* `brandRole` is an optional semantic label, e.g. "logo:primary".
|
|
233
|
-
*/
|
|
234
231
|
interface ImageVariable extends CompositionVariableBase {
|
|
235
232
|
type: "image";
|
|
236
|
-
/**
|
|
237
|
-
default: string;
|
|
233
|
+
/** Image URL fallback or a persisted image value. */
|
|
234
|
+
default: string | ImageValue;
|
|
238
235
|
/** Brand role identifier, e.g. "logo:primary". */
|
|
239
236
|
brandRole?: string;
|
|
240
237
|
}
|
|
@@ -438,4 +435,4 @@ interface StageZoomKeyframe {
|
|
|
438
435
|
}
|
|
439
436
|
declare function getDefaultStageZoom(resolution: CanvasResolution): StageZoom;
|
|
440
437
|
|
|
441
|
-
export { type AddElementData as A, type BooleanVariable as B, type CompositionVariable as C, DEFAULT_DURATIONS as D, type ElementKeyframes as E, type
|
|
438
|
+
export { type AddElementData as A, type BooleanVariable as B, type CompositionVariable as C, DEFAULT_DURATIONS as D, type ElementKeyframes as E, type FontValue as F, isCompositionElement as G, isMediaElement as H, type ImageValue as I, isTextElement as J, type Keyframe as K, normalizeResolutionFlag as L, type MediaElementType as M, type NumberVariable as N, resolveResolutionFlagPair as O, type PlayerAPI as P, type ResolvedResolutionFlag as R, type StageZoomKeyframe as S, type TimelineElement as T, type ValidationResult as V, type WaveformData as W, type CanvasResolution as a, type Asset as b, CANVAS_DIMENSIONS as c, COMPOSITION_VARIABLE_TYPES as d, type ColorVariable as e, type CompositionAPI as f, type CompositionAsset as g, type CompositionSpec as h, type CompositionVariableBase as i, type CompositionVariableType as j, type EnumVariable as k, type FontVariable as l, type ImageVariable as m, type KeyframeProperties as n, type MediaFile as o, type StageZoom as p, type StringVariable as q, TIMELINE_COLORS as r, type TimelineCompositionElement as s, type TimelineElementBase as t, type TimelineElementType as u, type TimelineMediaElement as v, type TimelineTextElement as w, VALID_CANVAS_RESOLUTIONS as x, getDefaultStageZoom as y, isAspectAgnosticResolutionAlias as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/parsers",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.202",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/heygen-com/hyperframes",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"tsx": "^4.21.0",
|
|
136
136
|
"typescript": "^5.0.0",
|
|
137
137
|
"vitest": "^4.1.11",
|
|
138
|
-
"@hyperframes/core": "0.8.
|
|
138
|
+
"@hyperframes/core": "0.8.202"
|
|
139
139
|
},
|
|
140
140
|
"scripts": {
|
|
141
141
|
"build": "tsup",
|