@hyperframes/parsers 0.8.81 → 0.8.83

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
@@ -11,7 +11,7 @@ export { CANONICAL_AUTHORED_TIMING_ATTRIBUTES, COMPOSITION_ATTRIBUTES, COMPOSITI
11
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, decodeUrlPathVariants, extractMediaSrcMutations, parseCompositionVariables, resolveAliasDisplayName, scanVariableUsage } from './composition.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
- export { CompositionDurationResult, CompositionDurationSource, ResolveCompositionDurationInput, resolveCompositionDuration } from './compositionDuration.js';
14
+ export { CompositionDurationResult, CompositionDurationSource, ResolveCompositionDurationInput, TIMING_TOLERANCE_SECONDS, resolveCompositionDuration } from './compositionDuration.js';
15
15
 
16
16
  /**
17
17
  * Thrown by htmlParser functions when the input HTML is empty or does not
package/dist/index.js CHANGED
@@ -3742,7 +3742,28 @@ function trackKindOf(node) {
3742
3742
 
3743
3743
  // src/timingMismatches.ts
3744
3744
  import { parseHTML as parseHTML2 } from "linkedom";
3745
- var EPSILON = 0.05;
3745
+
3746
+ // src/compositionDuration.ts
3747
+ var TIMING_TOLERANCE_SECONDS = 0.05;
3748
+ var isPositiveFinite = (value) => value !== null && Number.isFinite(value) && value > 0;
3749
+ function resolveCompositionDuration(input) {
3750
+ const pendingClips = input.clipEndsSeconds.filter((end) => end === null).length;
3751
+ if (isPositiveFinite(input.authoredDurationSeconds)) {
3752
+ return { seconds: input.authoredDurationSeconds, source: "authored", pendingClips };
3753
+ }
3754
+ const known = input.clipEndsSeconds.filter(isPositiveFinite);
3755
+ if (known.length > 0) {
3756
+ return { seconds: Math.max(...known), source: "derived", pendingClips };
3757
+ }
3758
+ return {
3759
+ seconds: null,
3760
+ source: "unresolved",
3761
+ pendingClips,
3762
+ reason: pendingClips > 0 ? "every clip's length is still pending" : "no authored duration and no clip with a length"
3763
+ };
3764
+ }
3765
+
3766
+ // src/timingMismatches.ts
3746
3767
  var NON_RENDERED = /* @__PURE__ */ new Set(["script", "style", "template", "noscript", "link", "meta"]);
3747
3768
  var toNode = (el) => ({
3748
3769
  tag: el.tagName,
@@ -3783,8 +3804,8 @@ function windowFinding(el, selector, anim, start, end) {
3783
3804
  const duration = attrNumber(el, "data-duration");
3784
3805
  if (dataStart === null) return null;
3785
3806
  const dataEnd = duration === null ? null : dataStart + duration;
3786
- const beforeStart = anim.method !== "set" && start < dataStart - EPSILON;
3787
- const afterEnd = dataEnd !== null && start > dataEnd + EPSILON;
3807
+ const beforeStart = anim.method !== "set" && start < dataStart - TIMING_TOLERANCE_SECONDS;
3808
+ const afterEnd = dataEnd !== null && start > dataEnd + TIMING_TOLERANCE_SECONDS;
3788
3809
  if (!beforeStart && !afterEnd) return null;
3789
3810
  const elementId = el.getAttribute("id");
3790
3811
  return {
@@ -3845,7 +3866,7 @@ function timingMismatches(html) {
3845
3866
  const ends = anims.filter((anim) => !anim.global && !anim.hasUnresolvedSelector).map((anim) => checkTween(anim, root, layout, seenUntimed, report));
3846
3867
  const timelineEnd = Math.max(0, ...ends.filter((e) => e !== null));
3847
3868
  const rootDuration = attrNumber(root, "data-duration");
3848
- if (rootDuration !== null && timelineEnd > rootDuration + EPSILON) {
3869
+ if (rootDuration !== null && timelineEnd > rootDuration + TIMING_TOLERANCE_SECONDS) {
3849
3870
  report.findings.push({ kind: "timeline-exceeds-root-duration", rootDuration, timelineEnd });
3850
3871
  }
3851
3872
  return report;
@@ -3916,25 +3937,6 @@ var PENDING_MEDIA_DURATION_READERS = [
3916
3937
  "studio (timelineDOM.ts, timelineElementHelpers.ts, useTimelineSyncCallbacks.ts)"
3917
3938
  ];
3918
3939
 
3919
- // src/compositionDuration.ts
3920
- var isPositiveFinite = (value) => value !== null && Number.isFinite(value) && value > 0;
3921
- function resolveCompositionDuration(input) {
3922
- const pendingClips = input.clipEndsSeconds.filter((end) => end === null).length;
3923
- if (isPositiveFinite(input.authoredDurationSeconds)) {
3924
- return { seconds: input.authoredDurationSeconds, source: "authored", pendingClips };
3925
- }
3926
- const known = input.clipEndsSeconds.filter(isPositiveFinite);
3927
- if (known.length > 0) {
3928
- return { seconds: Math.max(...known), source: "derived", pendingClips };
3929
- }
3930
- return {
3931
- seconds: null,
3932
- source: "unresolved",
3933
- pendingClips,
3934
- reason: pendingClips > 0 ? "every clip's length is still pending" : "no authored duration and no clip with a length"
3935
- };
3936
- }
3937
-
3938
3940
  // src/utils/urlPath.ts
3939
3941
  function decodeUrlPathVariants(path) {
3940
3942
  const variants = [path];
@@ -4255,6 +4257,7 @@ export {
4255
4257
  SUPPORTED_EASES,
4256
4258
  SUPPORTED_PROPS,
4257
4259
  TIMELINE_COLORS,
4260
+ TIMING_TOLERANCE_SECONDS,
4258
4261
  VALID_CANVAS_RESOLUTIONS,
4259
4262
  VIEWPORT_META_SIZE_RE,
4260
4263
  addElementToHtml,