@hyperframes/parsers 0.9.12 → 0.9.14

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/assets.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { d as decodeCssEscapes, a as decodeWellFormedEscapes, b as decodedUrlPath, e as encodeUrlPath, s as splitUrlSuffix } from './urlPath-C_0f_-Hp.js';
1
+ export { a as decodeCssEscapes, b as decodeWellFormedEscapes, c as decodedUrlPath, e as encodeUrlPath, s as splitUrlSuffix } from './urlPath-CYK47t9W.js';
2
2
 
3
3
  /**
4
4
  * Shared primitives for scanning and rewriting asset paths in HTML/CSS.
@@ -1,188 +1,15 @@
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
- export { c as decodeUrlPathVariants } from './urlPath-C_0f_-Hp.js';
1
+ export { A as AddElementData, a as Asset, B as BooleanVariable, C as CANVAS_DIMENSIONS, b as COMPOSITION_VARIABLE_TYPES, c as CanvasResolution, d as ColorVariable, e as CompositionAPI, f as CompositionAsset, g as CompositionSpec, h as CompositionVariable, 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, K as Keyframe, n as KeyframeProperties, M as MediaElementType, o as MediaFile, N as NumberVariable, P as PlayerAPI, R as ResolvedResolutionFlag, S as StageZoom, p as StageZoomKeyframe, q as StringVariable, T as TIMELINE_COLORS, r as TimelineCompositionElement, s as TimelineElement, t as TimelineElementBase, u as TimelineElementType, v as TimelineMediaElement, w as TimelineTextElement, V as VALID_CANVAS_RESOLUTIONS, x 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-CLCkerbI.js';
2
+ 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, i as isCompositionVariable, d as isFontValue, f as isImageValue, g as isSafeMediaUrl, h as isScalarVariableValue, p as parseCompositionVariables, r as resolveAliasDisplayName, s as scanVariableUsage } from './fontAliases-Bra9p9Et.js';
3
+ export { d as decodeUrlPathVariants } from './urlPath-CYK47t9W.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, SPLIT_BOUNDARY_EPSILON_S, parseNumeric, parseStartExpression, readClipTiming, writeClipTiming } from './compositionContract.js';
5
5
 
6
- /**
7
- * Browser-safe parser for the `data-composition-variables` schema attribute.
8
- * Lives outside htmlParser.ts so browser consumers (SDK, Studio, lint) can
9
- * import it via `@hyperframes/parsers/composition` without pulling the
10
- * linkedom/Node HTML-parser machinery from the main entry.
11
- */
12
-
13
- /**
14
- * Scalar variable values (string/number/boolean) are the ones that flow into
15
- * CSS custom props and text bindings; font/image values are object-shaped.
16
- * Shared so the SDK's CSS-compat writes, the runtime bindings, and Studio's
17
- * display logic can never disagree on what "scalar" means.
18
- */
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;
22
- /**
23
- * True when the value is a structurally valid variable declaration: id, label,
24
- * a known type, a default matching that type, and options[] for enums. The
25
- * same predicate parseCompositionVariables filters with — exported so writers
26
- * (SDK declaration ops, Studio forms) can validate before persisting.
27
- */
28
- declare function isCompositionVariable(v: unknown): v is CompositionVariable;
29
- /**
30
- * Parse the typed variable declarations from an element's
31
- * `data-composition-variables` attribute. Malformed entries (wrong shape,
32
- * unknown type, default not matching the declared type) are dropped; an
33
- * absent attribute, invalid JSON, or a non-array payload yields `[]`.
34
- */
35
- declare function parseCompositionVariables(htmlEl: Element): CompositionVariable[];
36
- /**
37
- * Protocol allowlist for a resolved media URL. Relative URLs (no scheme) resolve
38
- * against the page origin and are always safe. Absolute URLs are restricted to
39
- * http(s)/blob and image data: URIs -- defense-in-depth alongside the runtime's
40
- * VAR_SRC_TAGS element guard, blocking `javascript:`, `data:text/html`, `file:`,
41
- * etc. even if a future tag slips past it. Control chars are stripped before the
42
- * scheme test because browsers ignore them when parsing the URL.
43
- *
44
- * Lives here rather than in the runtime because the linter has to reach the same
45
- * verdict on a declared default statically: a value this rejects is dropped at
46
- * bind time and the element's authored fallback renders instead, so a second copy
47
- * of the scheme list would let lint and the runtime disagree silently.
48
- */
49
- declare function isSafeMediaUrl(url: string): boolean;
50
-
51
- /**
52
- * Where a scaffolded project's canvas resolution lives besides the root's own
53
- * data-width/data-height: the html/body CSS size and the meta viewport content.
54
- */
55
- /** html/body CSS, width first. Groups 1/3 are the surrounding text, 2/4 the digits. */
56
- declare const HTML_BODY_CSS_WIDTH_FIRST_RE: RegExp;
57
- /** Same block, height authored first. */
58
- declare const HTML_BODY_CSS_HEIGHT_FIRST_RE: RegExp;
59
- /** Viewport meta content. Shared by lint (reads groups 2/4) and cli (replaces via 1/3). */
60
- declare const VIEWPORT_META_SIZE_RE: RegExp;
61
-
62
- /**
63
- * Browser-safe static scan for composition-variable reads in script text.
64
- *
65
- * Compositions read variables by calling the runtime API — `getVariables()`
66
- * bare (sub-comp scoped shadow) or via `__hyperframes.getVariables()` /
67
- * `window.__hyperframes.getVariables()` — and there is no DOM-attribute
68
- * binding to scan, so "which variables does this composition use" can only be
69
- * derived from the scripts. This is a best-effort static analysis: the
70
- * patterns agents actually write (destructuring, member access, a single
71
- * alias variable) resolve to ids; anything opaque flips `scanIncomplete`
72
- * so consumers can present usage as a lower bound instead of a fact.
73
- *
74
- * AST nodes are handled untyped (same convention as gsapParserAcorn.ts) —
75
- * acorn's structural types don't survive acorn-walk's visitor signatures.
76
- */
77
- interface VariableUsageScan {
78
- /** Variable ids statically read by the script, in first-seen order. */
79
- usedIds: string[];
80
- /**
81
- * True when the script accesses variables in a way the scan cannot resolve
82
- * (computed keys, rest spreads, the values object escaping into a call…) or
83
- * when the script fails to parse — usedIds is then a lower bound.
84
- */
85
- scanIncomplete: boolean;
6
+ interface FontShorthandFamilies {
7
+ families: string;
8
+ /** False when the shorthand's size cannot be told from its family: `families` is a best guess. */
9
+ certain: boolean;
86
10
  }
87
- declare function scanVariableUsage(scriptText: string): VariableUsageScan;
88
-
89
- interface MediaSrcMutation {
90
- selector: string;
91
- operation: "src_assignment" | "set_attribute";
92
- raw: string;
93
- }
94
- /** Find literal source writes whose target is a statically resolvable DOM lookup. */
95
- declare function extractMediaSrcMutations(script: string): MediaSrcMutation[];
96
-
97
- /**
98
- * Single source of truth for the deterministic font alias map. Both the
99
- * producer's @font-face injector and the core lint rules import from here,
100
- * eliminating manual drift between the two.
101
- *
102
- * Keys are lowercase font family names. Values are canonical font slugs
103
- * matching CANONICAL_FONTS keys in core's fonts/deterministicFonts module.
104
- */
105
- declare const FONT_ALIAS_MAP: {
106
- inter: string;
107
- montserrat: string;
108
- outfit: string;
109
- nunito: string;
110
- oswald: string;
111
- "league gothic": string;
112
- "archivo black": string;
113
- "space mono": string;
114
- "ibm plex mono": string;
115
- "jetbrains mono": string;
116
- "eb garamond": string;
117
- "playfair display": string;
118
- "source code pro": string;
119
- "noto sans jp": string;
120
- roboto: string;
121
- "open sans": string;
122
- lato: string;
123
- poppins: string;
124
- "helvetica neue": string;
125
- helvetica: string;
126
- arial: string;
127
- "helvetica bold": string;
128
- futura: string;
129
- "din alternate": string;
130
- "arial black": string;
131
- "bebas neue": string;
132
- "courier new": string;
133
- courier: string;
134
- garamond: string;
135
- "noto sans japanese": string;
136
- "segoe ui": string;
137
- "sf pro": string;
138
- "sf pro display": string;
139
- "sf pro text": string;
140
- "sf pro rounded": string;
141
- avenir: string;
142
- "avenir next": string;
143
- "lucida grande": string;
144
- geneva: string;
145
- optima: string;
146
- verdana: string;
147
- tahoma: string;
148
- "trebuchet ms": string;
149
- calibri: string;
150
- candara: string;
151
- corbel: string;
152
- "lucida sans": string;
153
- "lucida sans unicode": string;
154
- "noto sans": string;
155
- "dejavu sans": string;
156
- "liberation sans": string;
157
- "sf mono": string;
158
- menlo: string;
159
- monaco: string;
160
- consolas: string;
161
- "lucida console": string;
162
- "lucida sans typewriter": string;
163
- "andale mono": string;
164
- "dejavu sans mono": string;
165
- "liberation mono": string;
166
- georgia: string;
167
- palatino: string;
168
- "palatino linotype": string;
169
- "book antiqua": string;
170
- cambria: string;
171
- times: string;
172
- "times new roman": string;
173
- "dejavu serif": string;
174
- "liberation serif": string;
175
- };
176
- declare const FONT_ALIAS_KEYS: ReadonlySet<string>;
177
- /**
178
- * Human-readable display names for canonical font slugs. Used by the lint
179
- * rule to tell authors what their aliased font will render as.
180
- */
181
- declare const CANONICAL_FONT_DISPLAY_NAMES: Readonly<Record<string, string>>;
182
- /**
183
- * Resolve a font alias to its canonical display name, or undefined if the
184
- * alias is not in the map.
185
- */
186
- declare function resolveAliasDisplayName(alias: string): string | undefined;
11
+ /** The family list of a `font` shorthand, after its optional style/weight/width, size and line height. */
12
+ declare function parseFontShorthand(value: string): FontShorthandFamilies;
13
+ declare function fontShorthandFamilies(value: string): string;
187
14
 
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 };
15
+ export { fontShorthandFamilies, parseFontShorthand };
@@ -208,6 +208,77 @@ function resolveAliasDisplayName(alias) {
208
208
  return CANONICAL_FONT_DISPLAY_NAMES[slug];
209
209
  }
210
210
 
211
+ // src/fontShorthand.ts
212
+ var FONT_SIZE_KEYWORD = /^(?:xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large|smaller|larger)$/i;
213
+ var FONT_SIZE_VALUE = /^(?:\d*\.?\d+(?!(?:deg|grad|rad|turn)$)[a-z%]+|(?:calc|min|max|clamp)\(.*\))$/i;
214
+ var PRE_SIZE_KEYWORD = /^(?:normal|italic|oblique|small-caps|bold|bolder|lighter|(?:ultra-|extra-|semi-)?(?:condensed|expanded)|[+-]?\d*\.?\d+(?:deg|grad|rad|turn)?)$/i;
215
+ var CUSTOM_PROPERTY = /^var\(.*\)$/i;
216
+ var NO_FAMILY = /^(?:caption|icon|menu|message-box|small-caption|status-bar|inherit|initial|unset|revert|revert-layer)$/i;
217
+ function maskGroups(value) {
218
+ let depth = 0;
219
+ let quote = null;
220
+ return value.replace(/[\s\S]/g, (char) => {
221
+ if (quote) {
222
+ if (char === quote) quote = null;
223
+ return "_";
224
+ }
225
+ if (char === '"' || char === "'") {
226
+ quote = char;
227
+ return "_";
228
+ }
229
+ if (char === "(") depth += 1;
230
+ const inside = depth > 0;
231
+ if (char === ")") depth -= 1;
232
+ return inside ? "_" : char;
233
+ });
234
+ }
235
+ function tokens(value) {
236
+ return [...maskGroups(value).matchAll(/\S+/g)].map(({ 0: masked, index }) => ({
237
+ text: value.slice(index, index + masked.length),
238
+ masked,
239
+ start: index
240
+ }));
241
+ }
242
+ var isSize = (text) => FONT_SIZE_KEYWORD.test(text) || FONT_SIZE_VALUE.test(text);
243
+ function familyStart(list, at) {
244
+ const size = list[at];
245
+ const slash = size.masked.indexOf("/");
246
+ if (slash >= 0) return slash === size.masked.length - 1 ? at + 2 : at + 1;
247
+ const next = list[at + 1]?.masked;
248
+ if (next === "/") return at + 3;
249
+ return next?.startsWith("/") ? at + 2 : at + 1;
250
+ }
251
+ var carriesLineHeight = (list, at) => list[at].masked.includes("/") || (list[at + 1]?.masked.startsWith("/") ?? false);
252
+ var headOf = ({ text, masked }) => masked.includes("/") ? text.slice(0, masked.indexOf("/")) : text;
253
+ function findSize(list) {
254
+ let unsure = false;
255
+ for (let i = 0; i < list.length; i++) {
256
+ const head = headOf(list[i]);
257
+ const isVar = CUSTOM_PROPERTY.test(head);
258
+ if (isSize(head) || isVar && carriesLineHeight(list, i)) return { at: i, unsure };
259
+ if (!isVar && !PRE_SIZE_KEYWORD.test(head)) unsure = true;
260
+ }
261
+ return { at: -1, unsure };
262
+ }
263
+ function lastLeadingVar(list) {
264
+ let last = -1;
265
+ for (let i = 0; i < list.length - 1; i++) if (CUSTOM_PROPERTY.test(list[i].text)) last = i;
266
+ return last;
267
+ }
268
+ function parseFontShorthand(value) {
269
+ const list = tokens(value);
270
+ if (list.length === 1 && NO_FAMILY.test(list[0].text)) return { families: "", certain: true };
271
+ const rest = (from) => list[from] ? value.slice(list[from].start).trim() : "";
272
+ const size = findSize(list);
273
+ if (size.at >= 0) return { families: rest(familyStart(list, size.at)), certain: !size.unsure };
274
+ const lastVar = lastLeadingVar(list);
275
+ if (lastVar < 0) return { families: "", certain: !size.unsure };
276
+ return { families: rest(lastVar + 1), certain: false };
277
+ }
278
+ function fontShorthandFamilies(value) {
279
+ return parseFontShorthand(value).families;
280
+ }
281
+
211
282
  // src/utils/urlPath.ts
212
283
  function decodeUrlPathVariants(path) {
213
284
  const decoded = decodeWellFormedEscapes(path);
@@ -880,6 +951,7 @@ export {
880
951
  VIEWPORT_META_SIZE_RE,
881
952
  decodeUrlPathVariants,
882
953
  extractMediaSrcMutations,
954
+ fontShorthandFamilies,
883
955
  getDefaultStageZoom,
884
956
  isAspectAgnosticResolutionAlias,
885
957
  isCompositionElement,
@@ -892,6 +964,7 @@ export {
892
964
  isTextElement,
893
965
  normalizeResolutionFlag,
894
966
  parseCompositionVariables,
967
+ parseFontShorthand,
895
968
  parseNumeric,
896
969
  parseStartExpression,
897
970
  readClipTiming,
@@ -0,0 +1,185 @@
1
+ import { h as CompositionVariable, F as FontValue, I as ImageValue } from './types-CLCkerbI.js';
2
+
3
+ /**
4
+ * Browser-safe parser for the `data-composition-variables` schema attribute.
5
+ * Lives outside htmlParser.ts so browser consumers (SDK, Studio, lint) can
6
+ * import it via `@hyperframes/parsers/composition` without pulling the
7
+ * linkedom/Node HTML-parser machinery from the main entry.
8
+ */
9
+
10
+ /**
11
+ * Scalar variable values (string/number/boolean) are the ones that flow into
12
+ * CSS custom props and text bindings; font/image values are object-shaped.
13
+ * Shared so the SDK's CSS-compat writes, the runtime bindings, and Studio's
14
+ * display logic can never disagree on what "scalar" means.
15
+ */
16
+ declare function isScalarVariableValue(value: unknown): value is string | number | boolean;
17
+ declare function isFontValue(value: unknown): value is FontValue;
18
+ declare function isImageValue(value: unknown): value is ImageValue;
19
+ /**
20
+ * True when the value is a structurally valid variable declaration: id, label,
21
+ * a known type, a default matching that type, and options[] for enums. The
22
+ * same predicate parseCompositionVariables filters with — exported so writers
23
+ * (SDK declaration ops, Studio forms) can validate before persisting.
24
+ */
25
+ declare function isCompositionVariable(v: unknown): v is CompositionVariable;
26
+ /**
27
+ * Parse the typed variable declarations from an element's
28
+ * `data-composition-variables` attribute. Malformed entries (wrong shape,
29
+ * unknown type, default not matching the declared type) are dropped; an
30
+ * absent attribute, invalid JSON, or a non-array payload yields `[]`.
31
+ */
32
+ declare function parseCompositionVariables(htmlEl: Element): CompositionVariable[];
33
+ /**
34
+ * Protocol allowlist for a resolved media URL. Relative URLs (no scheme) resolve
35
+ * against the page origin and are always safe. Absolute URLs are restricted to
36
+ * http(s)/blob and image data: URIs -- defense-in-depth alongside the runtime's
37
+ * VAR_SRC_TAGS element guard, blocking `javascript:`, `data:text/html`, `file:`,
38
+ * etc. even if a future tag slips past it. Control chars are stripped before the
39
+ * scheme test because browsers ignore them when parsing the URL.
40
+ *
41
+ * Lives here rather than in the runtime because the linter has to reach the same
42
+ * verdict on a declared default statically: a value this rejects is dropped at
43
+ * bind time and the element's authored fallback renders instead, so a second copy
44
+ * of the scheme list would let lint and the runtime disagree silently.
45
+ */
46
+ declare function isSafeMediaUrl(url: string): boolean;
47
+
48
+ /**
49
+ * Where a scaffolded project's canvas resolution lives besides the root's own
50
+ * data-width/data-height: the html/body CSS size and the meta viewport content.
51
+ */
52
+ /** html/body CSS, width first. Groups 1/3 are the surrounding text, 2/4 the digits. */
53
+ declare const HTML_BODY_CSS_WIDTH_FIRST_RE: RegExp;
54
+ /** Same block, height authored first. */
55
+ declare const HTML_BODY_CSS_HEIGHT_FIRST_RE: RegExp;
56
+ /** Viewport meta content. Shared by lint (reads groups 2/4) and cli (replaces via 1/3). */
57
+ declare const VIEWPORT_META_SIZE_RE: RegExp;
58
+
59
+ /**
60
+ * Browser-safe static scan for composition-variable reads in script text.
61
+ *
62
+ * Compositions read variables by calling the runtime API — `getVariables()`
63
+ * bare (sub-comp scoped shadow) or via `__hyperframes.getVariables()` /
64
+ * `window.__hyperframes.getVariables()` — and there is no DOM-attribute
65
+ * binding to scan, so "which variables does this composition use" can only be
66
+ * derived from the scripts. This is a best-effort static analysis: the
67
+ * patterns agents actually write (destructuring, member access, a single
68
+ * alias variable) resolve to ids; anything opaque flips `scanIncomplete`
69
+ * so consumers can present usage as a lower bound instead of a fact.
70
+ *
71
+ * AST nodes are handled untyped (same convention as gsapParserAcorn.ts) —
72
+ * acorn's structural types don't survive acorn-walk's visitor signatures.
73
+ */
74
+ interface VariableUsageScan {
75
+ /** Variable ids statically read by the script, in first-seen order. */
76
+ usedIds: string[];
77
+ /**
78
+ * True when the script accesses variables in a way the scan cannot resolve
79
+ * (computed keys, rest spreads, the values object escaping into a call…) or
80
+ * when the script fails to parse — usedIds is then a lower bound.
81
+ */
82
+ scanIncomplete: boolean;
83
+ }
84
+ declare function scanVariableUsage(scriptText: string): VariableUsageScan;
85
+
86
+ interface MediaSrcMutation {
87
+ selector: string;
88
+ operation: "src_assignment" | "set_attribute";
89
+ raw: string;
90
+ }
91
+ /** Find literal source writes whose target is a statically resolvable DOM lookup. */
92
+ declare function extractMediaSrcMutations(script: string): MediaSrcMutation[];
93
+
94
+ /**
95
+ * Single source of truth for the deterministic font alias map. Both the
96
+ * producer's @font-face injector and the core lint rules import from here,
97
+ * eliminating manual drift between the two.
98
+ *
99
+ * Keys are lowercase font family names. Values are canonical font slugs
100
+ * matching CANONICAL_FONTS keys in core's fonts/deterministicFonts module.
101
+ */
102
+ declare const FONT_ALIAS_MAP: {
103
+ inter: string;
104
+ montserrat: string;
105
+ outfit: string;
106
+ nunito: string;
107
+ oswald: string;
108
+ "league gothic": string;
109
+ "archivo black": string;
110
+ "space mono": string;
111
+ "ibm plex mono": string;
112
+ "jetbrains mono": string;
113
+ "eb garamond": string;
114
+ "playfair display": string;
115
+ "source code pro": string;
116
+ "noto sans jp": string;
117
+ roboto: string;
118
+ "open sans": string;
119
+ lato: string;
120
+ poppins: string;
121
+ "helvetica neue": string;
122
+ helvetica: string;
123
+ arial: string;
124
+ "helvetica bold": string;
125
+ futura: string;
126
+ "din alternate": string;
127
+ "arial black": string;
128
+ "bebas neue": string;
129
+ "courier new": string;
130
+ courier: string;
131
+ garamond: string;
132
+ "noto sans japanese": string;
133
+ "segoe ui": string;
134
+ "sf pro": string;
135
+ "sf pro display": string;
136
+ "sf pro text": string;
137
+ "sf pro rounded": string;
138
+ avenir: string;
139
+ "avenir next": string;
140
+ "lucida grande": string;
141
+ geneva: string;
142
+ optima: string;
143
+ verdana: string;
144
+ tahoma: string;
145
+ "trebuchet ms": string;
146
+ calibri: string;
147
+ candara: string;
148
+ corbel: string;
149
+ "lucida sans": string;
150
+ "lucida sans unicode": string;
151
+ "noto sans": string;
152
+ "dejavu sans": string;
153
+ "liberation sans": string;
154
+ "sf mono": string;
155
+ menlo: string;
156
+ monaco: string;
157
+ consolas: string;
158
+ "lucida console": string;
159
+ "lucida sans typewriter": string;
160
+ "andale mono": string;
161
+ "dejavu sans mono": string;
162
+ "liberation mono": string;
163
+ georgia: string;
164
+ palatino: string;
165
+ "palatino linotype": string;
166
+ "book antiqua": string;
167
+ cambria: string;
168
+ times: string;
169
+ "times new roman": string;
170
+ "dejavu serif": string;
171
+ "liberation serif": string;
172
+ };
173
+ declare const FONT_ALIAS_KEYS: ReadonlySet<string>;
174
+ /**
175
+ * Human-readable display names for canonical font slugs. Used by the lint
176
+ * rule to tell authors what their aliased font will render as.
177
+ */
178
+ declare const CANONICAL_FONT_DISPLAY_NAMES: Readonly<Record<string, string>>;
179
+ /**
180
+ * Resolve a font alias to its canonical display name, or undefined if the
181
+ * alias is not in the map.
182
+ */
183
+ declare function resolveAliasDisplayName(alias: string): string | undefined;
184
+
185
+ export { CANONICAL_FONT_DISPLAY_NAMES as C, FONT_ALIAS_KEYS as F, HTML_BODY_CSS_HEIGHT_FIRST_RE as H, type MediaSrcMutation as M, VIEWPORT_META_SIZE_RE as V, FONT_ALIAS_MAP as a, HTML_BODY_CSS_WIDTH_FIRST_RE as b, type VariableUsageScan as c, isFontValue as d, extractMediaSrcMutations as e, isImageValue as f, isSafeMediaUrl as g, isScalarVariableValue as h, isCompositionVariable as i, parseCompositionVariables as p, resolveAliasDisplayName as r, scanVariableUsage as s };
@@ -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-CvtYLHBX.js';
2
- import './types-CdT7qqke.js';
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-BFqbsq67.js';
2
+ import './types-CLCkerbI.js';
@@ -1,7 +1,7 @@
1
- import { G as GsapAnimation, P as ParsedGsap, A as ArcPathConfig, a as ArcPathSegment } from './gsapSerialize-CvtYLHBX.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-CvtYLHBX.js';
1
+ import { G as GsapAnimation, P as ParsedGsap, A as ArcPathConfig, a as ArcPathSegment } from './gsapSerialize-BFqbsq67.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-BFqbsq67.js';
3
3
  export { SPRING_PRESETS, SpringPreset, generateSpringEaseData } from './springEase.js';
4
- import './types-CdT7qqke.js';
4
+ import './types-CLCkerbI.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-CvtYLHBX.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-CvtYLHBX.js';
3
- import './types-CdT7qqke.js';
1
+ import { P as ParsedGsap, d as GsapMethod, G as GsapAnimation } from './gsapSerialize-BFqbsq67.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-BFqbsq67.js';
3
+ import './types-CLCkerbI.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-CvtYLHBX.js';
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-BFqbsq67.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-CdT7qqke.js';
5
+ import './types-CLCkerbI.js';
6
6
 
7
7
  interface ObjectArrayKeyframeTiming {
8
8
  percentages: number[];
@@ -1,4 +1,4 @@
1
- import { K as Keyframe, V as ValidationResult } from './types-CdT7qqke.js';
1
+ import { K as Keyframe, x as ValidationResult } from './types-CLCkerbI.js';
2
2
 
3
3
  /**
4
4
  * GSAP property and ease constants.
@@ -1,5 +1,5 @@
1
- import { G as GsapAnimation, A as ArcPathConfig, r as SplitAnimationsOptions, t as SplitAnimationsResult, a as ArcPathSegment } from './gsapSerialize-CvtYLHBX.js';
2
- import './types-CdT7qqke.js';
1
+ import { G as GsapAnimation, A as ArcPathConfig, r as SplitAnimationsOptions, t as SplitAnimationsResult, a as ArcPathSegment } from './gsapSerialize-BFqbsq67.js';
2
+ import './types-CLCkerbI.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-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-CvtYLHBX.js';
1
+ import { h as CompositionVariable, s as TimelineElement, c as CanvasResolution, K as Keyframe, p as StageZoomKeyframe, x as ValidationResult } from './types-CLCkerbI.js';
2
+ export { A as AddElementData, a as Asset, B as BooleanVariable, C as CANVAS_DIMENSIONS, b as COMPOSITION_VARIABLE_TYPES, d as ColorVariable, e as CompositionAPI, f as CompositionAsset, g 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, S as StageZoom, q as StringVariable, T as TIMELINE_COLORS, r as TimelineCompositionElement, t as TimelineElementBase, u as TimelineElementType, v as TimelineMediaElement, w as TimelineTextElement, V 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-CLCkerbI.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-BFqbsq67.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';
@@ -8,11 +8,11 @@ export { parseGsapScriptAcorn as parseGsapScript } from './gsapParserAcorn.js';
8
8
  export { EXCLUDED_TAGS, ensureHfIds, isCompositionTemplate, mintHfId, stampHfIdsInPlace, walkCompositionDescendants } from './hfIds.js';
9
9
  export { ParsableDocumentLike, SubCompositionValidity, SubCompositionValidityReason, checkSubCompositionUsability, 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
- export { CANONICAL_FONT_DISPLAY_NAMES, FONT_ALIAS_KEYS, FONT_ALIAS_MAP, HTML_BODY_CSS_HEIGHT_FIRST_RE, HTML_BODY_CSS_WIDTH_FIRST_RE, MediaSrcMutation, VIEWPORT_META_SIZE_RE, VariableUsageScan, extractMediaSrcMutations, parseCompositionVariables, resolveAliasDisplayName, scanVariableUsage } from './composition.js';
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-Bra9p9Et.js';
12
12
  export { StructureNode, TrackKind, TrackKindSource, isSubCompositionHost, isTimedElement, topLevelElements, trackKindOf } from './topLevelElements.js';
13
13
  export { AttrReader, DEFAULT_IMAGE_TIMELINE_DURATION_SECONDS, MAX_PLAYBACK_RATE, MIN_PLAYBACK_RATE, MediaDurationResult, MediaDurationSource, MediaTag, PENDING_MEDIA_DURATION_READERS, ResolveMediaDurationInput, clampPlaybackRate, readAuthoredDurationSeconds, readDataDurationSeconds, readMediaOffsetSeconds, readPlaybackRate, resolveMediaDuration, resolveNaturalDurationSeconds } from './mediaDuration.js';
14
14
  export { CompositionDurationResult, CompositionDurationSource, ResolveCompositionDurationInput, TIMING_TOLERANCE_SECONDS, resolveCompositionDuration } from './compositionDuration.js';
15
- export { c as decodeUrlPathVariants, b as decodedUrlPath, e as encodeUrlPath } from './urlPath-C_0f_-Hp.js';
15
+ export { d as decodeUrlPathVariants, c as decodedUrlPath, e as encodeUrlPath } from './urlPath-CYK47t9W.js';
16
16
  export { HTML_ATTRIBUTE_ENTITIES, HtmlAttributeSpan, HtmlOpeningTagSpan, decodeAuthoredAttribute, scanHtmlOpeningTags } from './htmlAttributeSpans.js';
17
17
 
18
18
  /**
@@ -435,4 +435,4 @@ interface StageZoomKeyframe {
435
435
  }
436
436
  declare function getDefaultStageZoom(resolution: CanvasResolution): StageZoom;
437
437
 
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 };
438
+ export { type AddElementData as A, type BooleanVariable as B, CANVAS_DIMENSIONS 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 StageZoom as S, TIMELINE_COLORS as T, VALID_CANVAS_RESOLUTIONS as V, type WaveformData as W, type Asset as a, COMPOSITION_VARIABLE_TYPES as b, type CanvasResolution as c, type ColorVariable as d, type CompositionAPI as e, type CompositionAsset as f, type CompositionSpec as g, type CompositionVariable 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 StageZoomKeyframe as p, type StringVariable as q, type TimelineCompositionElement as r, type TimelineElement as s, type TimelineElementBase as t, type TimelineElementType as u, type TimelineMediaElement as v, type TimelineTextElement as w, type ValidationResult as x, getDefaultStageZoom as y, isAspectAgnosticResolutionAlias as z };
@@ -8,4 +8,4 @@ declare function decodedUrlPath(url: string): string;
8
8
  declare function encodeUrlPath(path: string): string;
9
9
  declare function decodeCssEscapes(text: string): string;
10
10
 
11
- export { decodeWellFormedEscapes as a, decodedUrlPath as b, decodeUrlPathVariants as c, decodeCssEscapes as d, encodeUrlPath as e, splitUrlSuffix as s };
11
+ export { decodeCssEscapes as a, decodeWellFormedEscapes as b, decodedUrlPath as c, decodeUrlPathVariants as d, encodeUrlPath as e, splitUrlSuffix as s };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/parsers",
3
- "version": "0.9.12",
3
+ "version": "0.9.14",
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.12"
142
+ "@hyperframes/core": "0.9.14"
143
143
  },
144
144
  "scripts": {
145
145
  "build": "tsup",