@hyperframes/core 0.8.172 → 0.8.174

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>>;
@@ -290,7 +291,17 @@ export declare function getHfColorGradingCapabilities(): {
290
291
  label: string;
291
292
  intensity: number;
292
293
  }[];
293
- adjustments: {
294
+ example: {
295
+ readonly adjust: {
296
+ readonly exposure: 0.1;
297
+ readonly contrast: 0.05;
298
+ readonly temperature: 0.08;
299
+ };
300
+ readonly details: {
301
+ readonly vignette: 0.15;
302
+ };
303
+ };
304
+ adjust: {
294
305
  min: number;
295
306
  max: number;
296
307
  key: "exposure" | "contrast" | "highlights" | "shadows" | "whites" | "blacks" | "temperature" | "tint" | "vibrance" | "saturation";
@@ -442,7 +453,7 @@ export declare function getHfColorGradingCapabilities(): {
442
453
  readonly label: "Art";
443
454
  readonly description: "ASCII, engraved, crosshatched, and painterly rendering.";
444
455
  }];
445
- finishing: {
456
+ details: {
446
457
  min: number;
447
458
  max: number;
448
459
  key: "vignette" | "vignetteMidpoint" | "vignetteRoundness" | "vignetteFeather" | "grain" | "grainSize" | "grainRoughness";
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_MAX_CUBE_LUT_SIZE } from "./colorLuts.js";
2
- import { COLOR_GRADING_ADJUST_KEYS, 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,
@@ -657,7 +658,8 @@ export function getHfColorGradingCapabilities() {
657
658
  label: preset.label,
658
659
  intensity: preset.intensity,
659
660
  })),
660
- adjustments: HF_COLOR_GRADING_ADJUST_KEYS.map((key) => ({
661
+ example: COLOR_GRADING_EXAMPLE,
662
+ adjust: HF_COLOR_GRADING_ADJUST_KEYS.map((key) => ({
661
663
  key,
662
664
  identity: ADJUST_ZERO[key],
663
665
  ...ADJUST_LIMITS[key],
@@ -728,7 +730,7 @@ export function getHfColorGradingCapabilities() {
728
730
  },
729
731
  },
730
732
  effectFamilies: EFFECT_FAMILIES,
731
- finishing: HF_COLOR_GRADING_DETAIL_KEYS.map((key) => ({
733
+ details: HF_COLOR_GRADING_DETAIL_KEYS.map((key) => ({
732
734
  key,
733
735
  identity: DETAIL_DEFAULTS[key],
734
736
  ...DETAIL_LIMITS[key],
@@ -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