@hyperframes/core 0.8.173 → 0.8.175

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.
@@ -28,11 +28,5 @@ export interface ClipFact {
28
28
  role: string | null;
29
29
  }
30
30
  export declare const byStart: (a: ClipFact, b: ClipFact) => number;
31
- export declare const instantTolerance: (time: number) => number;
32
- /** Float sums like 19.8 + 6.4 miss 26.2 by a rounding step; a few steps, scaled to the time, are one instant. */
33
- export declare function sameInstant(a: number, b: number): boolean;
34
- /** For timeline lanes: a zero-length clip inside another still counts, so it gets a lane of its own. */
35
- export declare function spansOverlap(aStart: number, aEnd: number, bStart: number, bEnd: number): boolean;
36
- export declare function spansShareTime(aStart: number, aEnd: number, bStart: number, bEnd: number): boolean;
37
- export declare const isInsideSpan: (time: number, start: number, end: number) => boolean;
31
+ export { instantTolerance, isInsideSpan, sameInstant, spansOverlap, spansShareTime, } from "@hyperframes/parsers/time-spans";
38
32
  export declare function formatClipLine(clip: ClipFact): string;
package/dist/clipFacts.js CHANGED
@@ -2,22 +2,7 @@
2
2
  export const byStart = (a, b) => a.start - b.start || a.trackIndex - b.trackIndex;
3
3
  const roundTo3 = (n) => Math.round(n * 1000) / 1000;
4
4
  const num = (n) => String(roundTo3(n));
5
- export const instantTolerance = (time) => 4 * Number.EPSILON * Math.max(1, Math.abs(time));
6
- /** Float sums like 19.8 + 6.4 miss 26.2 by a rounding step; a few steps, scaled to the time, are one instant. */
7
- export function sameInstant(a, b) {
8
- if (!Number.isFinite(a) || !Number.isFinite(b))
9
- return a === b;
10
- return Math.abs(a - b) <= instantTolerance(Math.max(Math.abs(a), Math.abs(b)));
11
- }
12
- const isBefore = (a, b) => a < b && !sameInstant(a, b);
13
- /** For timeline lanes: a zero-length clip inside another still counts, so it gets a lane of its own. */
14
- export function spansOverlap(aStart, aEnd, bStart, bEnd) {
15
- return isBefore(aStart, bEnd) && isBefore(bStart, aEnd);
16
- }
17
- export function spansShareTime(aStart, aEnd, bStart, bEnd) {
18
- return isBefore(Math.max(aStart, bStart), Math.min(aEnd, bEnd));
19
- }
20
- export const isInsideSpan = (time, start, end) => isBefore(start, time) && isBefore(time, end);
5
+ export { instantTolerance, isInsideSpan, sameInstant, spansOverlap, spansShareTime, } from "@hyperframes/parsers/time-spans";
21
6
  export function formatClipLine(clip) {
22
7
  const parts = [
23
8
  `${clip.kind} "${clip.id}"`,
@@ -13,6 +13,7 @@ export declare const COLOR_GRADING_SOURCE_HIDDEN_ATTR = "data-hf-color-grading-s
13
13
  export declare const COLOR_GRADING_AUTHORED_OPACITY_ATTR = "data-hf-authored-opacity";
14
14
  export declare const HF_COLOR_GRADING_CANVAS_ID_PREFIX = "__hf_color_grading_";
15
15
  export declare const HF_COLOR_GRADING_COLOR_SPACE = "rec709";
16
+ export declare const HF_COLOR_GRADING_SOURCE_TAGS: readonly ["video", "img", "canvas"];
16
17
  export type HfColorGradingPresetId = "neutral" | "warm-daylight" | "clean-studio" | "skin-soft" | "food-pop" | "night-lift" | "muted-editorial" | "vintage-wash" | "mono-clean" | "mono-fade" | "soft-boost" | "bright-pop" | "deep-contrast" | "creator-camcorder" | "vhs-playback" | "home-movie-8mm" | "editorial-halftone" | "two-ink-print";
17
18
  export type HfColorGradingAdjustKey = (typeof COLOR_GRADING_ADJUST_KEYS)[number];
18
19
  export type HfColorGradingAdjust = Partial<Record<HfColorGradingAdjustKey, number>>;
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_MAX_CUBE_LUT_SIZE } from "./colorLuts.js";
2
- import { COLOR_GRADING_ADJUST_KEYS, COLOR_GRADING_EXAMPLE, COLOR_GRADING_ADVANCED_LIMITS, COLOR_GRADING_COLOR_SPACE, COLOR_GRADING_CONTRACT_VERSION, COLOR_GRADING_CURVE_KEYS, COLOR_GRADING_DETAIL_KEYS, COLOR_GRADING_EFFECT_KEYS, COLOR_GRADING_HUE_CURVE_KEYS, COLOR_GRADING_LUT_KEYS, COLOR_GRADING_MAX_CURVE_POINTS, COLOR_GRADING_MAX_SECONDARIES, COLOR_GRADING_TOP_LEVEL_KEYS, COLOR_GRADING_WHEEL_KEYS, } from "@hyperframes/parsers/color-grading-contract";
2
+ import { COLOR_GRADING_ADJUST_KEYS, COLOR_GRADING_EXAMPLE, COLOR_GRADING_ADVANCED_LIMITS, COLOR_GRADING_COLOR_SPACE, COLOR_GRADING_CONTRACT_VERSION, COLOR_GRADING_CURVE_KEYS, COLOR_GRADING_DETAIL_KEYS, COLOR_GRADING_EFFECT_KEYS, COLOR_GRADING_HUE_CURVE_KEYS, COLOR_GRADING_LUT_KEYS, COLOR_GRADING_MAX_CURVE_POINTS, COLOR_GRADING_MAX_SECONDARIES, COLOR_GRADING_SOURCE_TAGS, COLOR_GRADING_TOP_LEVEL_KEYS, COLOR_GRADING_WHEEL_KEYS, } from "@hyperframes/parsers/color-grading-contract";
3
3
  export { compileHfColorCurve, compileHfHueCurve, HF_COLOR_CURVE_MAX_POINTS, } from "./colorGradingCurves.js";
4
4
  export const HF_COLOR_GRADING_ATTR = "data-color-grading";
5
5
  // Runtime <-> studio contract attributes. The runtime grading engine writes
@@ -15,6 +15,7 @@ export const COLOR_GRADING_SOURCE_HIDDEN_ATTR = "data-hf-color-grading-source-hi
15
15
  export const COLOR_GRADING_AUTHORED_OPACITY_ATTR = "data-hf-authored-opacity";
16
16
  export const HF_COLOR_GRADING_CANVAS_ID_PREFIX = "__hf_color_grading_";
17
17
  export const HF_COLOR_GRADING_COLOR_SPACE = COLOR_GRADING_COLOR_SPACE;
18
+ export const HF_COLOR_GRADING_SOURCE_TAGS = COLOR_GRADING_SOURCE_TAGS;
18
19
  const ADJUST_ZERO = {
19
20
  exposure: 0,
20
21
  contrast: 0,
@@ -1,4 +1,5 @@
1
1
  import { HF_AUDIO_GROUP_TAG } from "../audioGroups.js";
2
+ import { HF_COLOR_GRADING_SOURCE_TAGS } from "../colorGrading.js";
2
3
  /**
3
4
  * kebab-case px parser. Single source of truth — studio's domEditingDom
4
5
  * re-exports this so the two paths can't drift.
@@ -140,7 +141,7 @@ export function resolveEditingSections(facts) {
140
141
  text: facts.hasEditableText && !facts.isCompositionHost && !facts.isInsideLockedComposition,
141
142
  media: facts.tag === "video" || facts.tag === "audio" || facts.tag === "img",
142
143
  audioFx: facts.tag === "audio" || isAudioBus || (facts.tag === "video" && facts.hasAudio === true),
143
- colorGrading: facts.tag === "video" || facts.tag === "img",
144
+ colorGrading: HF_COLOR_GRADING_SOURCE_TAGS.includes(facts.tag),
144
145
  // A bus has no clip range at all — no `data-start`, no duration, and its
145
146
  // automation clock is composition time — so Start/Duration/End would be
146
147
  // editing nothing. Audio keeps its timing: an `<audio>` clip is placed on
@@ -2,6 +2,7 @@ export declare function compressToWoff2(input: Buffer): Promise<Buffer>;
2
2
  type FontCompressionOptions = {
3
3
  cacheDir?: string;
4
4
  compressImpl?: (input: Buffer) => Promise<Buffer>;
5
+ compressToWoff2?: boolean;
5
6
  };
6
7
  export declare function fontToDataUri(input: Buffer, originalFormat: string, options?: FontCompressionOptions): Promise<string>;
7
8
  export {};
@@ -71,8 +71,8 @@ export async function fontToDataUri(input, originalFormat, options = {}) {
71
71
  if (originalFormat === "woff2") {
72
72
  return `data:font/woff2;base64,${input.toString("base64")}`;
73
73
  }
74
- if (originalFormat === "ttc") {
75
- return `data:font/collection;base64,${input.toString("base64")}`;
74
+ if (originalFormat === "ttc" || options.compressToWoff2 === false) {
75
+ return `data:${rawMimeType(originalFormat)};base64,${input.toString("base64")}`;
76
76
  }
77
77
  try {
78
78
  const cachePath = cachedCompressionPath(input, originalFormat, options.cacheDir ?? defaultCacheDir());