@hyperframes/parsers 0.8.42 → 0.8.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -135,6 +135,26 @@ declare function unrollComputedTimeline(script: string): string;
135
135
 
136
136
  declare function queryByAttr(root: ParentNode, attr: string, value: string, tag?: string): Element | null;
137
137
 
138
+ /**
139
+ * Where a scaffolded project's canvas resolution lives besides the composition
140
+ * root's own `data-width`/`data-height`: the inline `html, body { width;
141
+ * height }` CSS block and the `<meta name="viewport">` `content` attribute.
142
+ * `@hyperframes/cli`'s `applyResolutionPreset` rewrites those same two places
143
+ * when a project scaffolds with `--resolution`, but keeps its own
144
+ * prefix-capturing regexes for that replace — these are a separate read-only
145
+ * definition of the same locations, not the literal patterns it uses.
146
+ *
147
+ * Lives in `@hyperframes/parsers` rather than `@hyperframes/cli` because
148
+ * `@hyperframes/lint` cannot depend on `cli` (`cli` depends on `lint`, not the
149
+ * reverse), and `parsers` is a dependency both already share.
150
+ */
151
+ /** Matches `html, body { ...width: <n>px... height: <n>px... }`. */
152
+ declare const HTML_BODY_CSS_WIDTH_FIRST_RE: RegExp;
153
+ /** Matches the same block with height authored before width. */
154
+ declare const HTML_BODY_CSS_HEIGHT_FIRST_RE: RegExp;
155
+ /** Matches `<meta ... name="viewport" ... content="width=<n>, height=<n>">`. */
156
+ declare const VIEWPORT_META_SIZE_RE: RegExp;
157
+
138
158
  interface MediaSrcMutation {
139
159
  selector: string;
140
160
  operation: "src_assignment" | "set_attribute";
@@ -143,4 +163,4 @@ interface MediaSrcMutation {
143
163
  /** Find literal source writes whose target is a statically resolvable DOM lookup. */
144
164
  declare function extractMediaSrcMutations(script: string): MediaSrcMutation[];
145
165
 
146
- export { CanvasResolution, CompositionHtmlParseError, type CompositionMetadata, CompositionVariable, Keyframe, type MediaSrcMutation, type OutputResolutionCompatibility, type OutputResolutionIssueKind, type ParsedHtml, StageZoomKeyframe, TimelineElement, ValidationResult, addElementToHtml, checkOutputResolutionCompatibility, extractCompositionMetadata, extractMediaSrcMutations, parseHtml, queryByAttr, removeElementFromHtml, removeElementWithGsapCascade, suggestMatchingPreset, unrollComputedTimeline, updateElementInHtml, validateCompositionHtml };
166
+ export { CanvasResolution, CompositionHtmlParseError, type CompositionMetadata, CompositionVariable, HTML_BODY_CSS_HEIGHT_FIRST_RE, HTML_BODY_CSS_WIDTH_FIRST_RE, Keyframe, type MediaSrcMutation, type OutputResolutionCompatibility, type OutputResolutionIssueKind, type ParsedHtml, StageZoomKeyframe, TimelineElement, VIEWPORT_META_SIZE_RE, ValidationResult, addElementToHtml, checkOutputResolutionCompatibility, extractCompositionMetadata, extractMediaSrcMutations, parseHtml, queryByAttr, removeElementFromHtml, removeElementWithGsapCascade, suggestMatchingPreset, unrollComputedTimeline, updateElementInHtml, validateCompositionHtml };
package/dist/index.js CHANGED
@@ -3521,6 +3521,11 @@ function unrollComputedTimeline(script) {
3521
3521
  return ms.toString();
3522
3522
  }
3523
3523
 
3524
+ // src/canvasScaffoldPatterns.ts
3525
+ var HTML_BODY_CSS_WIDTH_FIRST_RE = /html\s*,\s*body\s*\{[^}]*?width:\s*(\d+)px[^}]*?height:\s*(\d+)px/i;
3526
+ var HTML_BODY_CSS_HEIGHT_FIRST_RE = /html\s*,\s*body\s*\{[^}]*?height:\s*(\d+)px[^}]*?width:\s*(\d+)px/i;
3527
+ var VIEWPORT_META_SIZE_RE = /<meta[^>]*name=["']viewport["'][^>]*content=["']width=(\d+),\s*height=(\d+)/i;
3528
+
3524
3529
  // src/utils/urlPath.ts
3525
3530
  function decodeUrlPathVariants(path) {
3526
3531
  const variants = [path];
@@ -3829,6 +3834,8 @@ export {
3829
3834
  EXCLUDED_TAGS,
3830
3835
  FONT_ALIAS_KEYS,
3831
3836
  FONT_ALIAS_MAP,
3837
+ HTML_BODY_CSS_HEIGHT_FIRST_RE,
3838
+ HTML_BODY_CSS_WIDTH_FIRST_RE,
3832
3839
  LEGACY_TIMING_ATTRIBUTES,
3833
3840
  PROPERTY_GROUPS,
3834
3841
  SPRING_PRESETS,
@@ -3836,6 +3843,7 @@ export {
3836
3843
  SUPPORTED_PROPS,
3837
3844
  TIMELINE_COLORS,
3838
3845
  VALID_CANVAS_RESOLUTIONS,
3846
+ VIEWPORT_META_SIZE_RE,
3839
3847
  addElementToHtml,
3840
3848
  checkOutputResolutionCompatibility,
3841
3849
  checkSubCompositionUsability,