@hyperframes/parsers 0.7.16 → 0.7.17

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.
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Shared primitives for scanning and rewriting asset paths in HTML/CSS.
3
+ *
4
+ * Used by: rewriteSubCompPaths (core), collectExternalAssets (producer),
5
+ * localizeExternalAssets (CLI publish).
6
+ */
7
+ /**
8
+ * Regex matching CSS `url(...)` references — captures the quote style and the
9
+ * raw URL. The URL group is anchored to non-whitespace at both ends so the
10
+ * surrounding `\s*` can never overlap it (avoids polynomial-ReDoS backtracking);
11
+ * the captured value is whitespace-bounded already, matching the old behavior
12
+ * after callers `.trim()` it.
13
+ */
14
+ declare const CSS_URL_RE: RegExp;
15
+ /** Attributes that may contain relative asset paths. */
16
+ declare const PATH_ATTRS: readonly ["src", "href"];
17
+ /** Returns true for URLs/prefixes that should never be rewritten. */
18
+ declare function isNonRelativeUrl(val: string): boolean;
19
+ /**
20
+ * Cross-platform containment check: is `childPath` inside `parentPath`?
21
+ * Equality counts as "inside".
22
+ */
23
+ declare function isPathInside(childPath: string, parentPath: string): boolean;
24
+
25
+ /**
26
+ * Rewrite relative asset paths in sub-composition content so they resolve
27
+ * correctly after the content is inlined into the root document.
28
+ *
29
+ * A sub-composition at "compositions/scene.html" referencing "../icon.svg"
30
+ * means the project root — but after inlining into root index.html, the
31
+ * "../" escapes the project directory and causes 404s. This function
32
+ * resolves each relative path against the sub-composition's directory,
33
+ * then normalizes it to be relative to the project root.
34
+ *
35
+ * Used by both the core bundler (preview) and the producer compiler (render)
36
+ * to ensure consistent behavior.
37
+ */
38
+ /**
39
+ * Rewrite a single relative path from a sub-composition's context to the
40
+ * project root context.
41
+ *
42
+ * @param compSrcPath - The `data-composition-src` value (e.g. "compositions/scene.html")
43
+ * @param relativePath - The asset path to rewrite (e.g. "../icon.svg")
44
+ * @returns The rewritten path relative to project root (e.g. "icon.svg"), or
45
+ * the original path if no rewriting is needed.
46
+ */
47
+ declare function rewriteAssetPath(compSrcPath: string, relativePath: string): string;
48
+ /**
49
+ * Rewrite all relative `src` and `href` attributes on elements within a
50
+ * DOM tree, adjusting paths from the sub-composition's directory context
51
+ * to the project root.
52
+ *
53
+ * @param elements - Iterable of DOM elements to scan (e.g. from querySelectorAll)
54
+ * @param compSrcPath - The `data-composition-src` value
55
+ * @param getAttr - Function to read an attribute from an element
56
+ * @param setAttr - Function to set an attribute on an element
57
+ */
58
+ declare function rewriteAssetPaths<T>(elements: Iterable<T>, compSrcPath: string, getAttr: (el: T, attr: string) => string | null | undefined, setAttr: (el: T, attr: string, value: string) => void): void;
59
+ /**
60
+ * Rewrite CSS url(...) references inside inline style attributes.
61
+ */
62
+ declare function rewriteInlineStyleAssetUrls<T>(elements: Iterable<T>, compSrcPath: string, getStyle: (el: T) => string | null | undefined, setStyle: (el: T, value: string) => void): void;
63
+ /**
64
+ * Rewrite CSS url(...) references in a sub-composition's inline styles so
65
+ * ../foo.woff2 remains valid after the CSS is hoisted into the root document.
66
+ */
67
+ declare function rewriteCssAssetUrls(cssText: string, compSrcPath: string): string;
68
+
69
+ export { CSS_URL_RE, PATH_ATTRS, isNonRelativeUrl, isPathInside, rewriteAssetPath, rewriteAssetPaths, rewriteCssAssetUrls, rewriteInlineStyleAssetUrls };
package/dist/assets.js ADDED
@@ -0,0 +1,74 @@
1
+ // src/assetPaths.ts
2
+ import { isAbsolute, relative, resolve } from "path";
3
+ var CSS_URL_RE = /\burl\(\s*(["']?)([^)"'\s](?:[^)"']*[^)"'\s])?)\1\s*\)/g;
4
+ var PATH_ATTRS = ["src", "href"];
5
+ function isNonRelativeUrl(val) {
6
+ return !val || val.startsWith("http://") || val.startsWith("https://") || val.startsWith("//") || val.startsWith("data:") || val.startsWith("#") || val.startsWith("/");
7
+ }
8
+ function isPathInside(childPath, parentPath) {
9
+ const absChild = resolve(childPath);
10
+ const absParent = resolve(parentPath);
11
+ if (absChild === absParent) return true;
12
+ const rel = relative(absParent, absChild);
13
+ return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
14
+ }
15
+
16
+ // src/rewriteSubCompPaths.ts
17
+ import { posix } from "path";
18
+ var { join, resolve: resolve2, dirname } = posix;
19
+ var isAbsoluteOrSpecial = isNonRelativeUrl;
20
+ function needsRewrite(val) {
21
+ return val.startsWith("../") || val === "..";
22
+ }
23
+ function rewriteAssetPath(compSrcPath, relativePath) {
24
+ if (isAbsoluteOrSpecial(relativePath)) return relativePath;
25
+ if (!needsRewrite(relativePath)) return relativePath;
26
+ const compDir = dirname(compSrcPath);
27
+ if (!compDir || compDir === ".") return relativePath;
28
+ const resolved = join(compDir, relativePath);
29
+ const normalized = resolve2("/", resolved).slice(1);
30
+ return normalized;
31
+ }
32
+ function rewriteAssetPaths(elements, compSrcPath, getAttr, setAttr) {
33
+ for (const el of elements) {
34
+ for (const attr of PATH_ATTRS) {
35
+ const val = (getAttr(el, attr) || "").trim();
36
+ const rewritten = rewriteAssetPath(compSrcPath, val);
37
+ if (rewritten !== val) {
38
+ setAttr(el, attr, rewritten);
39
+ }
40
+ }
41
+ }
42
+ }
43
+ function rewriteInlineStyleAssetUrls(elements, compSrcPath, getStyle, setStyle) {
44
+ const compDir = dirname(compSrcPath);
45
+ if (!compDir || compDir === ".") return;
46
+ for (const el of elements) {
47
+ const style = getStyle(el);
48
+ if (!style) continue;
49
+ const rewritten = rewriteCssAssetUrls(style, compSrcPath);
50
+ if (rewritten !== style) {
51
+ setStyle(el, rewritten);
52
+ }
53
+ }
54
+ }
55
+ function rewriteCssAssetUrls(cssText, compSrcPath) {
56
+ if (!cssText) return cssText;
57
+ return cssText.replace(CSS_URL_RE, (full, quote, rawUrl) => {
58
+ const urlValue = (rawUrl || "").trim();
59
+ const rewritten = rewriteAssetPath(compSrcPath, urlValue);
60
+ if (rewritten === urlValue) return full;
61
+ return `url(${quote || ""}${rewritten}${quote || ""})`;
62
+ });
63
+ }
64
+ export {
65
+ CSS_URL_RE,
66
+ PATH_ATTRS,
67
+ isNonRelativeUrl,
68
+ isPathInside,
69
+ rewriteAssetPath,
70
+ rewriteAssetPaths,
71
+ rewriteCssAssetUrls,
72
+ rewriteInlineStyleAssetUrls
73
+ };
74
+ //# sourceMappingURL=assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/assetPaths.ts","../src/rewriteSubCompPaths.ts"],"sourcesContent":["/**\n * Shared primitives for scanning and rewriting asset paths in HTML/CSS.\n *\n * Used by: rewriteSubCompPaths (core), collectExternalAssets (producer),\n * localizeExternalAssets (CLI publish).\n */\n\nimport { isAbsolute, relative, resolve } from \"node:path\";\n\n/**\n * Regex matching CSS `url(...)` references — captures the quote style and the\n * raw URL. The URL group is anchored to non-whitespace at both ends so the\n * surrounding `\\s*` can never overlap it (avoids polynomial-ReDoS backtracking);\n * the captured value is whitespace-bounded already, matching the old behavior\n * after callers `.trim()` it.\n */\nexport const CSS_URL_RE = /\\burl\\(\\s*([\"']?)([^)\"'\\s](?:[^)\"']*[^)\"'\\s])?)\\1\\s*\\)/g;\n\n/** Attributes that may contain relative asset paths. */\nexport const PATH_ATTRS = [\"src\", \"href\"] as const;\n\n/** Returns true for URLs/prefixes that should never be rewritten. */\nexport function isNonRelativeUrl(val: string): boolean {\n return (\n !val ||\n val.startsWith(\"http://\") ||\n val.startsWith(\"https://\") ||\n val.startsWith(\"//\") ||\n val.startsWith(\"data:\") ||\n val.startsWith(\"#\") ||\n val.startsWith(\"/\")\n );\n}\n\n/**\n * Cross-platform containment check: is `childPath` inside `parentPath`?\n * Equality counts as \"inside\".\n */\nexport function isPathInside(childPath: string, parentPath: string): boolean {\n const absChild = resolve(childPath);\n const absParent = resolve(parentPath);\n if (absChild === absParent) return true;\n const rel = relative(absParent, absChild);\n return rel !== \"\" && !rel.startsWith(\"..\") && !isAbsolute(rel);\n}\n","/**\n * Rewrite relative asset paths in sub-composition content so they resolve\n * correctly after the content is inlined into the root document.\n *\n * A sub-composition at \"compositions/scene.html\" referencing \"../icon.svg\"\n * means the project root — but after inlining into root index.html, the\n * \"../\" escapes the project directory and causes 404s. This function\n * resolves each relative path against the sub-composition's directory,\n * then normalizes it to be relative to the project root.\n *\n * Used by both the core bundler (preview) and the producer compiler (render)\n * to ensure consistent behavior.\n */\n\n// URL paths in HTML output are POSIX regardless of host OS — use the `posix`\n// submodule so Windows builds don't emit backslash-separated paths (or worse,\n// drive-letter-prefixed artifacts from `resolve(\"/\", ...)`).\nimport { posix } from \"path\";\nconst { join, resolve, dirname } = posix;\n\nimport { CSS_URL_RE, PATH_ATTRS, isNonRelativeUrl } from \"./assetPaths.js\";\n\nconst isAbsoluteOrSpecial = isNonRelativeUrl;\n\n/**\n * Returns true only for paths that traverse up with `../`.\n * Plain relative paths like `assets/foo.svg` are already correct from the\n * root perspective — the browser resolves them against the served root, which\n * is the project root, so they don't need rewriting.\n */\nfunction needsRewrite(val: string): boolean {\n return val.startsWith(\"../\") || val === \"..\";\n}\n\n/**\n * Rewrite a single relative path from a sub-composition's context to the\n * project root context.\n *\n * @param compSrcPath - The `data-composition-src` value (e.g. \"compositions/scene.html\")\n * @param relativePath - The asset path to rewrite (e.g. \"../icon.svg\")\n * @returns The rewritten path relative to project root (e.g. \"icon.svg\"), or\n * the original path if no rewriting is needed.\n */\nexport function rewriteAssetPath(compSrcPath: string, relativePath: string): string {\n if (isAbsoluteOrSpecial(relativePath)) return relativePath;\n if (!needsRewrite(relativePath)) return relativePath;\n const compDir = dirname(compSrcPath);\n if (!compDir || compDir === \".\") return relativePath;\n const resolved = join(compDir, relativePath);\n const normalized = resolve(\"/\", resolved).slice(1);\n return normalized;\n}\n\n/**\n * Rewrite all relative `src` and `href` attributes on elements within a\n * DOM tree, adjusting paths from the sub-composition's directory context\n * to the project root.\n *\n * @param elements - Iterable of DOM elements to scan (e.g. from querySelectorAll)\n * @param compSrcPath - The `data-composition-src` value\n * @param getAttr - Function to read an attribute from an element\n * @param setAttr - Function to set an attribute on an element\n */\nexport function rewriteAssetPaths<T>(\n elements: Iterable<T>,\n compSrcPath: string,\n getAttr: (el: T, attr: string) => string | null | undefined,\n setAttr: (el: T, attr: string, value: string) => void,\n): void {\n for (const el of elements) {\n for (const attr of PATH_ATTRS) {\n const val = (getAttr(el, attr) || \"\").trim();\n const rewritten = rewriteAssetPath(compSrcPath, val);\n if (rewritten !== val) {\n setAttr(el, attr, rewritten);\n }\n }\n }\n}\n\n/**\n * Rewrite CSS url(...) references inside inline style attributes.\n */\nexport function rewriteInlineStyleAssetUrls<T>(\n elements: Iterable<T>,\n compSrcPath: string,\n getStyle: (el: T) => string | null | undefined,\n setStyle: (el: T, value: string) => void,\n): void {\n const compDir = dirname(compSrcPath);\n if (!compDir || compDir === \".\") return;\n\n for (const el of elements) {\n const style = getStyle(el);\n if (!style) continue;\n const rewritten = rewriteCssAssetUrls(style, compSrcPath);\n if (rewritten !== style) {\n setStyle(el, rewritten);\n }\n }\n}\n\n/**\n * Rewrite CSS url(...) references in a sub-composition's inline styles so\n * ../foo.woff2 remains valid after the CSS is hoisted into the root document.\n */\nexport function rewriteCssAssetUrls(cssText: string, compSrcPath: string): string {\n if (!cssText) return cssText;\n return cssText.replace(CSS_URL_RE, (full, quote: string, rawUrl: string) => {\n const urlValue = (rawUrl || \"\").trim();\n const rewritten = rewriteAssetPath(compSrcPath, urlValue);\n if (rewritten === urlValue) return full;\n return `url(${quote || \"\"}${rewritten}${quote || \"\"})`;\n });\n}\n"],"mappings":";AAOA,SAAS,YAAY,UAAU,eAAe;AASvC,IAAM,aAAa;AAGnB,IAAM,aAAa,CAAC,OAAO,MAAM;AAGjC,SAAS,iBAAiB,KAAsB;AACrD,SACE,CAAC,OACD,IAAI,WAAW,SAAS,KACxB,IAAI,WAAW,UAAU,KACzB,IAAI,WAAW,IAAI,KACnB,IAAI,WAAW,OAAO,KACtB,IAAI,WAAW,GAAG,KAClB,IAAI,WAAW,GAAG;AAEtB;AAMO,SAAS,aAAa,WAAmB,YAA6B;AAC3E,QAAM,WAAW,QA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ACF;AACF;AAMO,SAAS,oBAAoB,SAAiB,aAA6B;AAChF,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,QAAQ,YAAY,CAAC,MAAM,OAAe,WAAmB;AAC1E,UAAM,YAAY,UAAU,IAAI,KAAK;AACrC,UAAM,YAAY,iBAAiB,aAAa,QAAQ;AACxD,QAAI,cAAc,SAAU,QAAO;AACnC,WAAO,OAAO,SAAS,EAAE,GAAG,SAAS,GAAG,SAAS,EAAE;AAAA,EACrD,CAAC;AACH;","names":["resolve"]}
@@ -0,0 +1,96 @@
1
+ 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, C as CompositionVariable, i as CompositionVariableBase, j as CompositionVariableType, D as DEFAULT_DURATIONS, E as ElementKeyframes, k as EnumVariable, F as FontVariable, I as ImageVariable, K as Keyframe, l as KeyframeProperties, M as MediaElementType, m as MediaFile, N as NumberVariable, P as PlayerAPI, n as StageZoom, S as StageZoomKeyframe, o as StringVariable, p as TIMELINE_COLORS, q as TimelineCompositionElement, T as TimelineElement, r as TimelineElementBase, s as TimelineElementType, t as TimelineMediaElement, u as TimelineTextElement, v as VALID_CANVAS_RESOLUTIONS, V as ValidationResult, W as WaveformData, w as getDefaultStageZoom, x as isCompositionElement, y as isMediaElement, z as isTextElement, G as normalizeResolutionFlag } from './types-Cg0ZTXEf.js';
2
+
3
+ declare function decodeUrlPathVariants(path: string): string[];
4
+
5
+ /**
6
+ * Single source of truth for the deterministic font alias map. Both the
7
+ * producer's @font-face injector and the core lint rules import from here,
8
+ * eliminating manual drift between the two.
9
+ *
10
+ * Keys are lowercase font family names. Values are canonical font slugs
11
+ * matching CANONICAL_FONTS keys in the producer's deterministicFonts module.
12
+ */
13
+ declare const FONT_ALIAS_MAP: {
14
+ inter: string;
15
+ montserrat: string;
16
+ outfit: string;
17
+ nunito: string;
18
+ oswald: string;
19
+ "league gothic": string;
20
+ "archivo black": string;
21
+ "space mono": string;
22
+ "ibm plex mono": string;
23
+ "jetbrains mono": string;
24
+ "eb garamond": string;
25
+ "playfair display": string;
26
+ "source code pro": string;
27
+ "noto sans jp": string;
28
+ roboto: string;
29
+ "open sans": string;
30
+ lato: string;
31
+ poppins: string;
32
+ "helvetica neue": string;
33
+ helvetica: string;
34
+ arial: string;
35
+ "helvetica bold": string;
36
+ futura: string;
37
+ "din alternate": string;
38
+ "arial black": string;
39
+ "bebas neue": string;
40
+ "courier new": string;
41
+ courier: string;
42
+ garamond: string;
43
+ "noto sans japanese": string;
44
+ "segoe ui": string;
45
+ "sf pro": string;
46
+ "sf pro display": string;
47
+ "sf pro text": string;
48
+ "sf pro rounded": string;
49
+ avenir: string;
50
+ "avenir next": string;
51
+ "lucida grande": string;
52
+ geneva: string;
53
+ optima: string;
54
+ verdana: string;
55
+ tahoma: string;
56
+ "trebuchet ms": string;
57
+ calibri: string;
58
+ candara: string;
59
+ corbel: string;
60
+ "lucida sans": string;
61
+ "lucida sans unicode": string;
62
+ "noto sans": string;
63
+ "dejavu sans": string;
64
+ "liberation sans": string;
65
+ "sf mono": string;
66
+ menlo: string;
67
+ monaco: string;
68
+ consolas: string;
69
+ "lucida console": string;
70
+ "lucida sans typewriter": string;
71
+ "andale mono": string;
72
+ "dejavu sans mono": string;
73
+ "liberation mono": string;
74
+ georgia: string;
75
+ palatino: string;
76
+ "palatino linotype": string;
77
+ "book antiqua": string;
78
+ cambria: string;
79
+ times: string;
80
+ "times new roman": string;
81
+ "dejavu serif": string;
82
+ "liberation serif": string;
83
+ };
84
+ declare const FONT_ALIAS_KEYS: ReadonlySet<string>;
85
+ /**
86
+ * Human-readable display names for canonical font slugs. Used by the lint
87
+ * rule to tell authors what their aliased font will render as.
88
+ */
89
+ declare const CANONICAL_FONT_DISPLAY_NAMES: Readonly<Record<string, string>>;
90
+ /**
91
+ * Resolve a font alias to its canonical display name, or undefined if the
92
+ * alias is not in the map.
93
+ */
94
+ declare function resolveAliasDisplayName(alias: string): string | undefined;
95
+
96
+ export { CANONICAL_FONT_DISPLAY_NAMES, FONT_ALIAS_KEYS, FONT_ALIAS_MAP, decodeUrlPathVariants, resolveAliasDisplayName };
@@ -0,0 +1,207 @@
1
+ // src/types.ts
2
+ var CANVAS_DIMENSIONS = {
3
+ landscape: { width: 1920, height: 1080 },
4
+ portrait: { width: 1080, height: 1920 },
5
+ "landscape-4k": { width: 3840, height: 2160 },
6
+ "portrait-4k": { width: 2160, height: 3840 },
7
+ square: { width: 1080, height: 1080 },
8
+ "square-4k": { width: 2160, height: 2160 }
9
+ };
10
+ var VALID_CANVAS_RESOLUTIONS = Object.keys(
11
+ CANVAS_DIMENSIONS
12
+ );
13
+ var RESOLUTION_ALIASES = {
14
+ "1080p": "landscape",
15
+ hd: "landscape",
16
+ "1080p-portrait": "portrait",
17
+ "portrait-1080p": "portrait",
18
+ "4k": "landscape-4k",
19
+ uhd: "landscape-4k",
20
+ "4k-portrait": "portrait-4k",
21
+ "1080p-square": "square",
22
+ "square-1080p": "square",
23
+ "4k-square": "square-4k"
24
+ };
25
+ function normalizeResolutionFlag(input) {
26
+ if (!input) return void 0;
27
+ const lowered = input.toLowerCase();
28
+ if (VALID_CANVAS_RESOLUTIONS.includes(lowered)) {
29
+ return lowered;
30
+ }
31
+ return RESOLUTION_ALIASES[lowered];
32
+ }
33
+ var COMPOSITION_VARIABLE_TYPES = [
34
+ "string",
35
+ "number",
36
+ "color",
37
+ "boolean",
38
+ "enum",
39
+ "font",
40
+ "image"
41
+ ];
42
+ function isTextElement(el) {
43
+ return el.type === "text";
44
+ }
45
+ function isMediaElement(el) {
46
+ return el.type === "video" || el.type === "image" || el.type === "audio";
47
+ }
48
+ function isCompositionElement(el) {
49
+ return el.type === "composition";
50
+ }
51
+ var TIMELINE_COLORS = {
52
+ video: "#ec4899",
53
+ image: "#3b82f6",
54
+ text: "#06b6d4",
55
+ audio: "#10b981",
56
+ composition: "#f97316"
57
+ };
58
+ var DEFAULT_DURATIONS = {
59
+ video: 5,
60
+ image: 5,
61
+ text: 2,
62
+ audio: 5,
63
+ composition: 5
64
+ };
65
+ function getDefaultStageZoom(resolution) {
66
+ const { width, height } = CANVAS_DIMENSIONS[resolution];
67
+ return {
68
+ scale: 1,
69
+ focusX: width / 2,
70
+ focusY: height / 2
71
+ };
72
+ }
73
+
74
+ // src/fontAliases.ts
75
+ var FONT_ALIAS_MAP = {
76
+ // ── Canonical bundled fonts (self-referencing) ────────────────────────
77
+ inter: "inter",
78
+ montserrat: "montserrat",
79
+ outfit: "outfit",
80
+ nunito: "nunito",
81
+ oswald: "oswald",
82
+ "league gothic": "league-gothic",
83
+ "archivo black": "archivo-black",
84
+ "space mono": "space-mono",
85
+ "ibm plex mono": "ibm-plex-mono",
86
+ "jetbrains mono": "jetbrains-mono",
87
+ "eb garamond": "eb-garamond",
88
+ "playfair display": "playfair-display",
89
+ "source code pro": "source-code-pro",
90
+ "noto sans jp": "noto-sans-jp",
91
+ roboto: "roboto",
92
+ "open sans": "open-sans",
93
+ lato: "lato",
94
+ poppins: "poppins",
95
+ // ── Common aliases → nearest canonical ────────────────────────────────
96
+ "helvetica neue": "inter",
97
+ helvetica: "inter",
98
+ arial: "inter",
99
+ "helvetica bold": "inter",
100
+ futura: "montserrat",
101
+ "din alternate": "montserrat",
102
+ "arial black": "montserrat",
103
+ "bebas neue": "league-gothic",
104
+ "courier new": "jetbrains-mono",
105
+ courier: "jetbrains-mono",
106
+ garamond: "eb-garamond",
107
+ "noto sans japanese": "noto-sans-jp",
108
+ "segoe ui": "roboto",
109
+ // ── macOS sans-serif system fonts → inter ─────────────────────────────
110
+ "sf pro": "inter",
111
+ "sf pro display": "inter",
112
+ "sf pro text": "inter",
113
+ "sf pro rounded": "inter",
114
+ avenir: "inter",
115
+ "avenir next": "inter",
116
+ "lucida grande": "inter",
117
+ geneva: "inter",
118
+ optima: "inter",
119
+ // ── Windows sans-serif system fonts → inter ───────────────────────────
120
+ verdana: "inter",
121
+ tahoma: "inter",
122
+ "trebuchet ms": "inter",
123
+ calibri: "inter",
124
+ candara: "inter",
125
+ corbel: "inter",
126
+ "lucida sans": "inter",
127
+ "lucida sans unicode": "inter",
128
+ // ── Linux sans-serif system fonts → inter ─────────────────────────────
129
+ "noto sans": "inter",
130
+ "dejavu sans": "inter",
131
+ "liberation sans": "inter",
132
+ // ── Monospace system fonts → jetbrains-mono ───────────────────────────
133
+ "sf mono": "jetbrains-mono",
134
+ menlo: "jetbrains-mono",
135
+ monaco: "jetbrains-mono",
136
+ consolas: "jetbrains-mono",
137
+ "lucida console": "jetbrains-mono",
138
+ "lucida sans typewriter": "jetbrains-mono",
139
+ "andale mono": "jetbrains-mono",
140
+ "dejavu sans mono": "jetbrains-mono",
141
+ "liberation mono": "jetbrains-mono",
142
+ // ── Serif system fonts → eb-garamond ──────────────────────────────────
143
+ georgia: "eb-garamond",
144
+ palatino: "eb-garamond",
145
+ "palatino linotype": "eb-garamond",
146
+ "book antiqua": "eb-garamond",
147
+ cambria: "eb-garamond",
148
+ times: "eb-garamond",
149
+ "times new roman": "eb-garamond",
150
+ "dejavu serif": "eb-garamond",
151
+ "liberation serif": "eb-garamond"
152
+ };
153
+ var FONT_ALIAS_KEYS = new Set(Object.keys(FONT_ALIAS_MAP));
154
+ var CANONICAL_FONT_DISPLAY_NAMES = {
155
+ inter: "Inter",
156
+ montserrat: "Montserrat",
157
+ outfit: "Outfit",
158
+ nunito: "Nunito",
159
+ oswald: "Oswald",
160
+ "league-gothic": "League Gothic",
161
+ "archivo-black": "Archivo Black",
162
+ "space-mono": "Space Mono",
163
+ "ibm-plex-mono": "IBM Plex Mono",
164
+ "jetbrains-mono": "JetBrains Mono",
165
+ "eb-garamond": "EB Garamond",
166
+ "playfair-display": "Playfair Display",
167
+ "source-code-pro": "Source Code Pro",
168
+ "noto-sans-jp": "Noto Sans JP",
169
+ roboto: "Roboto",
170
+ "open-sans": "Open Sans",
171
+ lato: "Lato",
172
+ poppins: "Poppins"
173
+ };
174
+ function resolveAliasDisplayName(alias) {
175
+ const slug = FONT_ALIAS_MAP[alias.toLowerCase()];
176
+ if (!slug) return void 0;
177
+ return CANONICAL_FONT_DISPLAY_NAMES[slug];
178
+ }
179
+
180
+ // src/utils/urlPath.ts
181
+ function decodeUrlPathVariants(path) {
182
+ const variants = [path];
183
+ try {
184
+ const decoded = decodeURIComponent(path);
185
+ if (decoded !== path) variants.unshift(decoded);
186
+ } catch {
187
+ }
188
+ return variants;
189
+ }
190
+ export {
191
+ CANONICAL_FONT_DISPLAY_NAMES,
192
+ CANVAS_DIMENSIONS,
193
+ COMPOSITION_VARIABLE_TYPES,
194
+ DEFAULT_DURATIONS,
195
+ FONT_ALIAS_KEYS,
196
+ FONT_ALIAS_MAP,
197
+ TIMELINE_COLORS,
198
+ VALID_CANVAS_RESOLUTIONS,
199
+ decodeUrlPathVariants,
200
+ getDefaultStageZoom,
201
+ isCompositionElement,
202
+ isMediaElement,
203
+ isTextElement,
204
+ normalizeResolutionFlag,
205
+ resolveAliasDisplayName
206
+ };
207
+ //# sourceMappingURL=composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts","../src/fontAliases.ts","../src/utils/urlPath.ts"],"sourcesContent":["// ── Composition data types ───────────────────────────────────────────────────\n// Moved from @hyperframes/core/core.types in the parsers extraction refactor.\n// These are the types produced and consumed by the parser pipeline.\n\nexport interface Asset {\n id: string;\n url: string;\n type: string;\n is_reference?: boolean;\n /** Duration in seconds for video/audio assets */\n duration?: number;\n}\n\n// ── Timeline types ──────────────────────────────────────────────────────────\n\nexport type TimelineElementType = \"video\" | \"image\" | \"text\" | \"audio\" | \"composition\";\nexport type MediaElementType = \"video\" | \"image\" | \"audio\";\n\nexport const CANVAS_DIMENSIONS = {\n landscape: { width: 1920, height: 1080 },\n portrait: { width: 1080, height: 1920 },\n \"landscape-4k\": { width: 3840, height: 2160 },\n \"portrait-4k\": { width: 2160, height: 3840 },\n square: { width: 1080, height: 1080 },\n \"square-4k\": { width: 2160, height: 2160 },\n} as const;\n\n// Single source of truth: derive the type from the table so adding a preset\n// extends the union automatically. Avoids the prior `as readonly CanvasResolution[]`\n// cast on `VALID_CANVAS_RESOLUTIONS` quietly drifting if the table grew but\n// the union didn't.\nexport type CanvasResolution = keyof typeof CANVAS_DIMENSIONS;\n\n// `Object.keys` ordering matches insertion order in `CANVAS_DIMENSIONS` on\n// every supported JS engine; tests pin the order in `index.test.ts`. Reorder\n// the table above with care.\nexport const VALID_CANVAS_RESOLUTIONS = Object.keys(\n CANVAS_DIMENSIONS,\n) as readonly CanvasResolution[];\n\nconst RESOLUTION_ALIASES: Record<string, CanvasResolution> = {\n \"1080p\": \"landscape\",\n hd: \"landscape\",\n \"1080p-portrait\": \"portrait\",\n \"portrait-1080p\": \"portrait\",\n \"4k\": \"landscape-4k\",\n uhd: \"landscape-4k\",\n \"4k-portrait\": \"portrait-4k\",\n \"1080p-square\": \"square\",\n \"square-1080p\": \"square\",\n \"4k-square\": \"square-4k\",\n};\n\n/**\n * Map a user-facing resolution string (canonical name or alias) to a\n * `CanvasResolution`. Returns undefined for unknown values so callers\n * can produce their own \"invalid\" UX (CLI exit, route validation, etc.).\n */\nexport function normalizeResolutionFlag(input: string | undefined): CanvasResolution | undefined {\n if (!input) return undefined;\n const lowered = input.toLowerCase();\n if ((VALID_CANVAS_RESOLUTIONS as readonly string[]).includes(lowered)) {\n return lowered as CanvasResolution;\n }\n return RESOLUTION_ALIASES[lowered];\n}\n\nexport interface TimelineElementBase {\n id: string;\n type: TimelineElementType;\n name: string;\n startTime: number;\n duration: number;\n zIndex: number;\n x?: number;\n y?: number;\n scale?: number;\n opacity?: number;\n}\n\nexport interface TimelineMediaElement extends TimelineElementBase {\n type: MediaElementType;\n src: string;\n mediaStartTime?: number;\n sourceDuration?: number;\n isAroll?: boolean;\n sourceWidth?: number;\n sourceHeight?: number;\n volume?: number; // 0-1 (0% to 100%), default 1.0\n hasAudio?: boolean; // For videos - indicates if video has audio track\n}\n\nexport interface WaveformData {\n peaks: number[];\n duration: number;\n sampleRate?: number;\n}\n\nexport interface TimelineTextElement extends TimelineElementBase {\n type: \"text\";\n content: string;\n color?: string;\n fontSize?: number;\n textShadow?: boolean;\n fontFamily?: string;\n fontWeight?: number;\n textOutline?: boolean;\n textOutlineColor?: string;\n textOutlineWidth?: number;\n textHighlight?: boolean;\n textHighlightColor?: string;\n textHighlightPadding?: number;\n textHighlightRadius?: number;\n}\n\nexport interface TimelineCompositionElement extends TimelineElementBase {\n type: \"composition\";\n src: string;\n compositionId: string;\n scale?: number;\n sourceDuration?: number;\n variableValues?: Record<string, string | number | boolean>;\n sourceWidth?: number;\n sourceHeight?: number;\n}\n\n// Composition Variable Types\nexport type CompositionVariableType =\n | \"string\"\n | \"number\"\n | \"color\"\n | \"boolean\"\n | \"enum\"\n | \"font\"\n | \"image\";\n\n/**\n * Runtime list of every valid `CompositionVariableType`. Use this anywhere\n * a Set/array of valid type strings is needed (lint rules, validators).\n * The `satisfies` guard turns adding a new variant to the union without\n * also adding it here into a compile error.\n */\nexport const COMPOSITION_VARIABLE_TYPES = [\n \"string\",\n \"number\",\n \"color\",\n \"boolean\",\n \"enum\",\n \"font\",\n \"image\",\n] as const satisfies readonly CompositionVariableType[];\n\nexport interface CompositionVariableBase {\n id: string;\n type: CompositionVariableType;\n label: string;\n description?: string;\n}\n\nexport interface StringVariable extends CompositionVariableBase {\n type: \"string\";\n default: string;\n placeholder?: string;\n maxLength?: number;\n}\n\nexport interface NumberVariable extends CompositionVariableBase {\n type: \"number\";\n default: number;\n min?: number;\n max?: number;\n step?: number;\n unit?: string;\n}\n\nexport interface ColorVariable extends CompositionVariableBase {\n type: \"color\";\n default: string;\n /** Brand role identifier, e.g. \"color:primary\". */\n brandRole?: string;\n}\n\nexport interface BooleanVariable extends CompositionVariableBase {\n type: \"boolean\";\n default: boolean;\n}\n\nexport interface EnumVariable extends CompositionVariableBase {\n type: \"enum\";\n default: string;\n options: { value: string; label: string }[];\n}\n\n/**\n * Font variable — value is a `{name, source}` object (object-valued; LOCKED §7).\n * `default` is the fallback font-family name string.\n * `source` is the font stylesheet URL (e.g. Google Fonts CSS).\n * `default_name` / `default_source` are the CSS-level fallbacks when the\n * brand font is absent.\n */\nexport interface FontVariable extends CompositionVariableBase {\n type: \"font\";\n /** Fallback font-family name, e.g. \"Inter\". */\n default: string;\n /** Font stylesheet URL (e.g. Google Fonts CSS link). */\n source?: string;\n /** CSS font-family name to use when source is unavailable, e.g. \"sans-serif\". */\n default_name?: string;\n /** Fallback font stylesheet URL (empty string = system font). */\n default_source?: string;\n}\n\n/**\n * Image variable — value is a `{url, …}` object (object-valued; LOCKED §7).\n * `default` is the fallback image URL string.\n * `brandRole` is an optional semantic label, e.g. \"logo:primary\".\n */\nexport interface ImageVariable extends CompositionVariableBase {\n type: \"image\";\n /** Fallback image URL. */\n default: string;\n /** Brand role identifier, e.g. \"logo:primary\". */\n brandRole?: string;\n}\n\nexport type CompositionVariable =\n | StringVariable\n | NumberVariable\n | ColorVariable\n | BooleanVariable\n | EnumVariable\n | FontVariable\n | ImageVariable;\n\nexport interface CompositionSpec {\n id: string;\n duration: number;\n variables: CompositionVariable[];\n}\n\nexport type TimelineElement =\n | TimelineMediaElement\n | TimelineTextElement\n | TimelineCompositionElement;\n\nexport function isTextElement(el: TimelineElement): el is TimelineTextElement {\n return el.type === \"text\";\n}\n\nexport function isMediaElement(el: TimelineElement): el is TimelineMediaElement {\n return el.type === \"video\" || el.type === \"image\" || el.type === \"audio\";\n}\n\nexport function isCompositionElement(el: TimelineElement): el is TimelineCompositionElement {\n return el.type === \"composition\";\n}\n\nexport interface MediaFile {\n id: string;\n name: string;\n type: TimelineElementType;\n src: string;\n file?: File;\n duration?: number;\n compositionId?: string;\n sourceWidth?: number; // Intrinsic width for compositions\n sourceHeight?: number; // Intrinsic height for compositions\n}\n\nexport const TIMELINE_COLORS: Record<TimelineElementType, string> = {\n video: \"#ec4899\",\n image: \"#3b82f6\",\n text: \"#06b6d4\",\n audio: \"#10b981\",\n composition: \"#f97316\",\n};\n\nexport const DEFAULT_DURATIONS: Record<TimelineElementType, number> = {\n video: 5,\n image: 5,\n text: 2,\n audio: 5,\n composition: 5,\n};\n\nexport interface CompositionAPI {\n id: string;\n duration: number;\n seek(time: number): void;\n getTime(): number;\n getDuration(): number;\n}\n\n// ── Player API types (used by runtime) ────────────────────────────────────\n\nexport interface PlayerAPI {\n play(): void;\n pause(): void;\n seek(time: number, options?: { keepPlaying?: boolean }): void;\n getTime(): number;\n getDuration(): number;\n isPlaying(): boolean;\n getMainTimeline(): unknown;\n getElementBounds(elementId: string): void;\n getElementsAtPoint(x: number, y: number): void;\n setElementPosition(elementId: string, x: number, y: number): void;\n previewElementPosition(elementId: string, x: number, y: number): void;\n setElementKeyframes(\n elementId: string,\n keyframes: Array<{\n id: string;\n time: number;\n properties: { x?: number; y?: number };\n }> | null,\n ): void;\n setElementScale(elementId: string, scale: number): void;\n setElementFontSize(elementId: string, fontSize: number): void;\n setElementTextContent(elementId: string, content: string): void;\n setElementTextColor(elementId: string, color: string): void;\n setElementTextShadow(elementId: string, enabled: boolean): void;\n setElementTextFontWeight(elementId: string, weight: number): void;\n setElementTextFontFamily(elementId: string, fontFamily: string): void;\n setElementTextOutline(elementId: string, enabled: boolean, color?: string, width?: number): void;\n setElementTextHighlight(\n elementId: string,\n enabled: boolean,\n color?: string,\n padding?: number,\n radius?: number,\n ): void;\n setElementVolume(elementId: string, volume: number): void;\n setStageZoom(scale: number, focusX: number, focusY: number): void;\n getStageZoom(): { scale: number; focusX: number; focusY: number };\n setStageZoomKeyframes(\n keyframes: Array<{\n id: string;\n time: number;\n zoom: { scale: number; focusX: number; focusY: number };\n ease?: string;\n }> | null,\n ): void;\n getStageZoomKeyframes(): Array<{\n id: string;\n time: number;\n zoom: { scale: number; focusX: number; focusY: number };\n ease?: string;\n }>;\n addElement(data: AddElementData): boolean;\n removeElement(elementId: string): boolean;\n updateElementTiming(elementId: string, start?: number, end?: number): boolean;\n setElementTiming(\n elementId: string,\n startTime: number,\n duration: number,\n mediaStartTime?: number,\n ): void;\n updateElementSrc(elementId: string, src: string): boolean;\n updateElementLayer(elementId: string, zIndex: number): boolean;\n updateElementBasePosition(elementId: string, x?: number, y?: number, scale?: number): boolean;\n markTimelineDirty(): void;\n isTimelineDirty(): boolean;\n rebuildTimeline(): void;\n ensureTimeline(): void;\n enableRenderMode(): void;\n disableRenderMode(): void;\n renderSeek(time: number): void;\n getElementVisibility(elementId: string): { visible: boolean; opacity?: number };\n getVisibleElements(): Array<{ id: string; tagName: string; start: number; end: number }>;\n getRenderState(): {\n time: number;\n duration: number;\n isPlaying: boolean;\n renderMode: boolean;\n timelineDirty: boolean;\n };\n}\n\nexport interface AddElementData {\n id: string;\n type: \"video\" | \"image\" | \"text\" | \"audio\" | \"composition\";\n name?: string;\n src?: string;\n content?: string;\n start: number;\n end: number;\n zIndex?: number;\n x?: number;\n y?: number;\n scale?: number;\n fontSize?: number;\n color?: string;\n textShadow?: boolean;\n fontWeight?: number;\n textOutline?: boolean;\n textOutlineColor?: string;\n textOutlineWidth?: number;\n textHighlight?: boolean;\n textHighlightColor?: string;\n textHighlightPadding?: number;\n textHighlightRadius?: number;\n compositionId?: string;\n sourceWidth?: number;\n sourceHeight?: number;\n isAroll?: boolean;\n}\n\nexport interface ValidationResult {\n valid: boolean;\n errors: string[];\n warnings: string[];\n}\n\nexport interface CompositionAsset {\n id: string;\n name: string;\n type: \"composition\";\n src: string;\n duration: number;\n compositionId: string;\n thumbnail?: string;\n}\n\nexport interface Keyframe {\n id: string;\n time: number;\n properties: Partial<KeyframeProperties>;\n ease?: string;\n}\n\nexport interface KeyframeProperties {\n x: number;\n y: number;\n opacity: number;\n scale: number;\n scaleX: number;\n scaleY: number;\n rotation: number;\n width: number;\n height: number;\n}\n\nexport interface ElementKeyframes {\n elementId: string;\n keyframes: Keyframe[];\n}\n\nexport interface StageZoom {\n scale: number;\n focusX: number;\n focusY: number;\n}\n\nexport interface StageZoomKeyframe {\n id: string;\n time: number;\n zoom: StageZoom;\n ease?: string;\n}\n\nexport function getDefaultStageZoom(resolution: CanvasResolution): StageZoom {\n const { width, height } = CANVAS_DIMENSIONS[resolution];\n return {\n scale: 1,\n focusX: width / 2,\n focusY: height / 2,\n };\n}\n","/**\n * Single source of truth for the deterministic font alias map. Both the\n * producer's @font-face injector and the core lint rules import from here,\n * eliminating manual drift between the two.\n *\n * Keys are lowercase font family names. Values are canonical font slugs\n * matching CANONICAL_FONTS keys in the producer's deterministicFonts module.\n */\nexport const FONT_ALIAS_MAP = {\n // ── Canonical bundled fonts (self-referencing) ────────────────────────\n inter: \"inter\",\n montserrat: \"montserrat\",\n outfit: \"outfit\",\n nunito: \"nunito\",\n oswald: \"oswald\",\n \"league gothic\": \"league-gothic\",\n \"archivo black\": \"archivo-black\",\n \"space mono\": \"space-mono\",\n \"ibm plex mono\": \"ibm-plex-mono\",\n \"jetbrains mono\": \"jetbrains-mono\",\n \"eb garamond\": \"eb-garamond\",\n \"playfair display\": \"playfair-display\",\n \"source code pro\": \"source-code-pro\",\n \"noto sans jp\": \"noto-sans-jp\",\n roboto: \"roboto\",\n \"open sans\": \"open-sans\",\n lato: \"lato\",\n poppins: \"poppins\",\n\n // ── Common aliases → nearest canonical ────────────────────────────────\n \"helvetica neue\": \"inter\",\n helvetica: \"inter\",\n arial: \"inter\",\n \"helvetica bold\": \"inter\",\n futura: \"montserrat\",\n \"din alternate\": \"montserrat\",\n \"arial black\": \"montserrat\",\n \"bebas neue\": \"league-gothic\",\n \"courier new\": \"jetbrains-mono\",\n courier: \"jetbrains-mono\",\n garamond: \"eb-garamond\",\n \"noto sans japanese\": \"noto-sans-jp\",\n \"segoe ui\": \"roboto\",\n\n // ── macOS sans-serif system fonts → inter ─────────────────────────────\n \"sf pro\": \"inter\",\n \"sf pro display\": \"inter\",\n \"sf pro text\": \"inter\",\n \"sf pro rounded\": \"inter\",\n avenir: \"inter\",\n \"avenir next\": \"inter\",\n \"lucida grande\": \"inter\",\n geneva: \"inter\",\n optima: \"inter\",\n\n // ── Windows sans-serif system fonts → inter ───────────────────────────\n verdana: \"inter\",\n tahoma: \"inter\",\n \"trebuchet ms\": \"inter\",\n calibri: \"inter\",\n candara: \"inter\",\n corbel: \"inter\",\n \"lucida sans\": \"inter\",\n \"lucida sans unicode\": \"inter\",\n\n // ── Linux sans-serif system fonts → inter ─────────────────────────────\n \"noto sans\": \"inter\",\n \"dejavu sans\": \"inter\",\n \"liberation sans\": \"inter\",\n\n // ── Monospace system fonts → jetbrains-mono ───────────────────────────\n \"sf mono\": \"jetbrains-mono\",\n menlo: \"jetbrains-mono\",\n monaco: \"jetbrains-mono\",\n consolas: \"jetbrains-mono\",\n \"lucida console\": \"jetbrains-mono\",\n \"lucida sans typewriter\": \"jetbrains-mono\",\n \"andale mono\": \"jetbrains-mono\",\n \"dejavu sans mono\": \"jetbrains-mono\",\n \"liberation mono\": \"jetbrains-mono\",\n\n // ── Serif system fonts → eb-garamond ──────────────────────────────────\n georgia: \"eb-garamond\",\n palatino: \"eb-garamond\",\n \"palatino linotype\": \"eb-garamond\",\n \"book antiqua\": \"eb-garamond\",\n cambria: \"eb-garamond\",\n times: \"eb-garamond\",\n \"times new roman\": \"eb-garamond\",\n \"dejavu serif\": \"eb-garamond\",\n \"liberation serif\": \"eb-garamond\",\n} satisfies Readonly<Record<string, string>>;\n\nexport const FONT_ALIAS_KEYS: ReadonlySet<string> = new Set(Object.keys(FONT_ALIAS_MAP));\n\n/**\n * Human-readable display names for canonical font slugs. Used by the lint\n * rule to tell authors what their aliased font will render as.\n */\nexport const CANONICAL_FONT_DISPLAY_NAMES: Readonly<Record<string, string>> = {\n inter: \"Inter\",\n montserrat: \"Montserrat\",\n outfit: \"Outfit\",\n nunito: \"Nunito\",\n oswald: \"Oswald\",\n \"league-gothic\": \"League Gothic\",\n \"archivo-black\": \"Archivo Black\",\n \"space-mono\": \"Space Mono\",\n \"ibm-plex-mono\": \"IBM Plex Mono\",\n \"jetbrains-mono\": \"JetBrains Mono\",\n \"eb-garamond\": \"EB Garamond\",\n \"playfair-display\": \"Playfair Display\",\n \"source-code-pro\": \"Source Code Pro\",\n \"noto-sans-jp\": \"Noto Sans JP\",\n roboto: \"Roboto\",\n \"open-sans\": \"Open Sans\",\n lato: \"Lato\",\n poppins: \"Poppins\",\n};\n\n/**\n * Resolve a font alias to its canonical display name, or undefined if the\n * alias is not in the map.\n */\nexport function resolveAliasDisplayName(alias: string): string | undefined {\n const slug = (FONT_ALIAS_MAP as Record<string, string>)[alias.toLowerCase()];\n if (!slug) return undefined;\n return CANONICAL_FONT_DISPLAY_NAMES[slug];\n}\n","export function decodeUrlPathVariants(path: string): string[] {\n const variants = [path];\n try {\n const decoded = decodeURIComponent(path);\n if (decoded !== path) variants.unshift(decoded);\n } catch {\n // Malformed percent sequences may be literal filesystem names.\n }\n\n return variants;\n}\n"],"mappings":";AAkBO,IAAM,oBAAoB;AAAA,EAC/B,WAAW,EAAE,OAAO,MAAM,QAAQ,KAAK;AAAA,EACvC,UAAU,EAAE,OAAO,MAAM,QAAQ,KAAK;AAAA,EACtC,gBAAgB,EAAE,OAAO,MAAM,QAAQ,KAAK;AAAA,EAC5C,eAAe,EAAE,OAAO,MAAM,QAAQ,KAAK;AAAA,EAC3C,QAAQ,EAAE,OAAO,MAAM,QAAQ,KAAK;AAAA,EACpC,aAAa,EAAE,OAAO,MAAM,QAAQ,KAAK;AAC3C;AAWO,IAAM,2BAA2B,OAAO;AAAA,EAC7C;AACF;AAEA,IAAM,qBAAuD;AAAA,EAC3D,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,MAAM;AAAA,EACN,KAAK;AAAA,EACL,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,aAAa;AACf;AAOO,SAAS,wBAAwB,OAAyD;AAC/F,MAAI,CAAC,MAAO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AA,EAClB,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,MAAM;AAAA,EACN,SAAS;AACX;AAMO,SAAS,wBAAwB,OAAmC;AACzE,QAAM,OAAQ,eAA0C,MAAM,YAAY,CAAC;AAC3E,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO,6BAA6B,IAAI;AAC1C;;;AChIO,SAAS,sBAAsB,MAAwB;AAC5D,QAAM,WAAW,CAAC,IAAI;AACtB,MAAI;AACF,UAAM,UAAU,mBAAmB,IAAI;AACvC,QAAI,YAAY,KAAM,UAAS,QAAQ,OAAO;AAAA,EAChD,QAAQ;AAAA,EAER;AAEA,SAAO;AACT;","names":[]}
@@ -1,7 +1,8 @@
1
- import { G as GsapAnimation, P as ParsedGsap, A as ArcPathConfig, a as ArcPathSegment } from './gsapSerialize-B_JRTCeV.js';
2
- export { m as GsapKeyframeFormat, b as GsapKeyframesData, c as GsapMethod, d as GsapPercentageKeyframe, i as getAnimationsForElementId, j as gsapAnimationsToKeyframes, k as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-B_JRTCeV.js';
1
+ import { G as GsapAnimation, P as ParsedGsap, A as ArcPathConfig, a as ArcPathSegment } from './gsapSerialize-Bei7m7M7.js';
2
+ export { m as GsapKeyframeFormat, b as GsapKeyframesData, c as GsapMethod, d as GsapPercentageKeyframe, i as getAnimationsForElementId, j as gsapAnimationsToKeyframes, k as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-Bei7m7M7.js';
3
3
  export { PROPERTY_GROUPS, PropertyGroupName, SUPPORTED_EASES, SUPPORTED_PROPS, classifyPropertyGroup, classifyTweenPropertyGroup } from './gsapConstants.js';
4
4
  export { SPRING_PRESETS, SpringPreset, generateSpringEaseData } from './springEase.js';
5
+ import './types-Cg0ZTXEf.js';
5
6
 
6
7
  declare function parseGsapScript(script: string): ParsedGsap;
7
8
  declare function updateAnimationInScript(script: string, animationId: string, updates: Partial<GsapAnimation> & {
@@ -1,5 +1,6 @@
1
- import { P as ParsedGsap, c as GsapMethod, G as GsapAnimation } from './gsapSerialize-B_JRTCeV.js';
2
- export { A as ArcPathConfig, a as ArcPathSegment, e as GsapProvenance, f as GsapProvenanceKind, K as KeyframeEditability, M as MotionPathShape, l as buildArcPath, h as editabilityForProvenance } from './gsapSerialize-B_JRTCeV.js';
1
+ import { P as ParsedGsap, c as GsapMethod, G as GsapAnimation } from './gsapSerialize-Bei7m7M7.js';
2
+ export { A as ArcPathConfig, a as ArcPathSegment, e as GsapProvenance, f as GsapProvenanceKind, K as KeyframeEditability, M as MotionPathShape, l as buildArcPath, h as editabilityForProvenance } from './gsapSerialize-Bei7m7M7.js';
3
+ import './types-Cg0ZTXEf.js';
3
4
  import './gsapConstants.js';
4
5
 
5
6
  interface TweenCallInfo {
@@ -1,5 +1,6 @@
1
- export { A as ArcPathConfig, a as ArcPathSegment, G as GsapAnimation, b as GsapKeyframesData, c as GsapMethod, d as GsapPercentageKeyframe, e as GsapProvenance, f as GsapProvenanceKind, K as KeyframeEditability, P as ParsedGsap, S as SplitAnimationsOptions, g as SplitAnimationsResult, h as editabilityForProvenance, i as getAnimationsForElementId, j as gsapAnimationsToKeyframes, k as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-B_JRTCeV.js';
1
+ export { A as ArcPathConfig, a as ArcPathSegment, G as GsapAnimation, b as GsapKeyframesData, c as GsapMethod, d as GsapPercentageKeyframe, e as GsapProvenance, f as GsapProvenanceKind, K as KeyframeEditability, P as ParsedGsap, S as SplitAnimationsOptions, g as SplitAnimationsResult, h as editabilityForProvenance, i as getAnimationsForElementId, j as gsapAnimationsToKeyframes, k as keyframesToGsapAnimations, s as serializeGsapAnimations, v as validateCompositionGsap } from './gsapSerialize-Bei7m7M7.js';
2
2
  export { isStudioHoldSet } from './gsapParser.js';
3
3
  export { PROPERTY_GROUPS, PropertyGroupName, SUPPORTED_EASES, SUPPORTED_PROPS, classifyPropertyGroup, classifyTweenPropertyGroup } from './gsapConstants.js';
4
4
  export { SPRING_PRESETS, SpringPreset, generateSpringEaseData } from './springEase.js';
5
5
  export { parseGsapScriptAcorn as parseGsapScript } from './gsapParserAcorn.js';
6
+ import './types-Cg0ZTXEf.js';