@hyperframes/core 0.9.92 → 0.9.94

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.
Files changed (34) hide show
  1. package/dist/clipFacts.d.ts +5 -0
  2. package/dist/clipFacts.js +21 -6
  3. package/dist/colorGrading.d.ts +1 -0
  4. package/dist/colorGrading.js +3 -0
  5. package/dist/compiler/htmlDocument.js +1 -1
  6. package/dist/compiler/htmlParityContract.js +1 -1
  7. package/dist/compiler/standaloneEntry.js +1 -1
  8. package/dist/figma/sanitizeSvg.js +1 -1
  9. package/dist/fonts/pageTree.d.ts +1 -1
  10. package/dist/fonts/pageTree.js +1 -1
  11. package/dist/generated/runtime-inline.js +1 -1
  12. package/dist/generators/richTextHtml.js +1 -1
  13. package/dist/hyperframe.runtime.iife.js +66 -66
  14. package/dist/mediaGradeAnalyzer.js +3 -3
  15. package/dist/runtime/clipNodes.d.ts +1 -0
  16. package/dist/runtime/clipNodes.js +1 -0
  17. package/dist/runtime/editing/gsapSnapshot.d.ts +1 -0
  18. package/dist/runtime/editing/gsapSnapshot.js +7 -0
  19. package/dist/runtime/editing/textEdit.d.ts +23 -0
  20. package/dist/runtime/editing/textEdit.js +88 -3
  21. package/dist/runtime/editingDraft.js +31 -9
  22. package/dist/runtime/editingElement.d.ts +2 -0
  23. package/dist/runtime/editingElement.js +11 -1
  24. package/dist/runtime/editingGestureStart.d.ts +5 -1
  25. package/dist/runtime/editingGestureStart.js +4 -0
  26. package/dist/runtime/editingPort.d.ts +13 -4
  27. package/dist/runtime/editingPort.js +14 -3
  28. package/dist/runtime/timeline.js +14 -1
  29. package/dist/runtime/types.d.ts +1 -0
  30. package/dist/utils/inlineTextStyleRange.d.ts +33 -0
  31. package/dist/utils/inlineTextStyleRange.js +503 -0
  32. package/dist/utils/inlineTextStyleRead.d.ts +20 -0
  33. package/dist/utils/inlineTextStyleRead.js +72 -0
  34. package/package.json +8 -4
@@ -29,4 +29,9 @@ export interface ClipFact {
29
29
  }
30
30
  export declare const byStart: (a: ClipFact, b: ClipFact) => number;
31
31
  export { instantTolerance, isInsideSpan, sameInstant, spansOverlap, spansShareTime, } from "@hyperframes/parsers/time-spans";
32
+ export declare const PROMPT_LABEL_MAX = 160;
33
+ /** A project value as one quoted line that reads back to exactly the value, so text around it cannot be imitated. */
34
+ export declare function promptField(value: string): string;
35
+ /** A display label as one quoted line, its whitespace collapsed and its length capped. */
36
+ export declare function promptLabel(value: string): string;
32
37
  export declare function formatClipLine(clip: ClipFact): string;
package/dist/clipFacts.js CHANGED
@@ -3,20 +3,35 @@ export const byStart = (a, b) => a.start - b.start || a.trackIndex - b.trackInde
3
3
  const roundTo3 = (n) => Math.round(n * 1000) / 1000;
4
4
  const num = (n) => String(roundTo3(n));
5
5
  export { instantTolerance, isInsideSpan, sameInstant, spansOverlap, spansShareTime, } from "@hyperframes/parsers/time-spans";
6
+ const CONTROL_BIDI_OR_LINE_SEPARATOR = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/gu;
7
+ export const PROMPT_LABEL_MAX = 160;
8
+ const escaped = (character) => Array.from({ length: character.length }, (_, i) => `\\u${character.charCodeAt(i).toString(16).padStart(4, "0")}`).join("");
9
+ /** A project value as one quoted line that reads back to exactly the value, so text around it cannot be imitated. */
10
+ export function promptField(value) {
11
+ return JSON.stringify(value).replace(CONTROL_BIDI_OR_LINE_SEPARATOR, escaped);
12
+ }
13
+ /** A display label as one quoted line, its whitespace collapsed and its length capped. */
14
+ export function promptLabel(value) {
15
+ const flat = Array.from(value.replace(CONTROL_BIDI_OR_LINE_SEPARATOR, " ").replace(/\s+/g, " ").trim());
16
+ const kept = flat.length > PROMPT_LABEL_MAX
17
+ ? `${flat.slice(0, PROMPT_LABEL_MAX - 1).join("")}…`
18
+ : flat.join("");
19
+ return JSON.stringify(kept);
20
+ }
6
21
  export function formatClipLine(clip) {
7
22
  const parts = [
8
- `${clip.kind} "${clip.id}"`,
9
- clip.src && `src=${clip.src}`,
23
+ `${promptField(clip.kind)} ${promptField(clip.id)}`,
24
+ clip.src && `src=${promptField(clip.src)}`,
10
25
  `start=${num(clip.start)}`,
11
26
  `duration=${num(clip.duration)}`,
12
27
  `end=${num(clip.end)}`,
13
28
  `track=${clip.trackIndex}`,
14
29
  clip.volume !== null && `volume=${num(clip.volume)}`,
15
30
  clip.playbackRate !== null && `rate=${num(clip.playbackRate)}`,
16
- clip.audioGroup && `group=${clip.audioGroup}`,
17
- clip.role && `role=${clip.role}`,
18
- clip.sourceFile && `file=${clip.sourceFile}`,
19
- ...clip.lanes.map((lane) => `${lane.target}-lane=[${lane.points.map((p) => `${num(p.t)}:${num(p.v)}`).join(", ")}]`),
31
+ clip.audioGroup && `group=${promptField(clip.audioGroup)}`,
32
+ clip.role && `role=${promptField(clip.role)}`,
33
+ clip.sourceFile && `file=${promptField(clip.sourceFile)}`,
34
+ ...clip.lanes.map((lane) => `lane ${promptField(lane.target)}=[${lane.points.map((p) => `${num(p.t)}:${num(p.v)}`).join(", ")}]`),
20
35
  ];
21
36
  return `- ${parts.filter(Boolean).join(" ")}`;
22
37
  }
@@ -214,6 +214,7 @@ export declare const HF_COLOR_GRADING_HUE_CURVE_KEYS: readonly ["hueVsHue", "hue
214
214
  export declare const HF_COLOR_GRADING_DETAIL_KEYS: readonly ["vignette", "vignetteMidpoint", "vignetteRoundness", "vignetteFeather", "grain", "grainSize", "grainRoughness"];
215
215
  export declare const HF_COLOR_GRADING_EFFECT_KEYS: readonly ["blur", "pixelate", "chromaBleed", "tapeDamage", "tapeTracking", "tapeNoise", "tapeSpeed", "filmArtifacts", "halftone", "halftoneSize", "twoInkPrint", "twoInkPrintSize", "ascii", "asciiSize", "asciiInvert", "asciiStyle", "asciiColor", "asciiRotation", "dither", "ditherSize", "bloom", "bloomRadius", "monoScreen", "monoScreenSize", "monoScreenAngle", "monoScreenSpread", "monoScreenShape", "monoScreenInvert", "scanlines", "scanlineCount", "scanlineSoftness", "chromaticAberration", "chromaticAngle", "crtCurvature", "digitalGlitch", "digitalGlitchColorSplit", "digitalGlitchLineTear", "digitalGlitchPixelate", "digitalGlitchBlockAmount", "digitalGlitchBlockDisplacement", "digitalGlitchBlockOpacity", "digitalGlitchSpeed", "engraving", "engravingSpacing", "engravingMinThickness", "engravingMaxThickness", "engravingAngle", "engravingContrast", "engravingSharpness", "engravingWave", "engravingWaveFrequency", "crosshatch", "crosshatchSpacing", "crosshatchThickness", "crosshatchAngle", "crosshatchContrast", "crosshatchEdges", "crosshatchLineWeight", "crosshatchWave", "crosshatchWaveFrequency", "kuwahara", "kuwaharaRadius", "kuwaharaSharpness", "kuwaharaSaturation"];
216
216
  export declare const HF_COLOR_GRADING_PRESETS: readonly HfColorGradingPreset[];
217
+ export declare function isHfColorGradingVariableRef(value: unknown): boolean;
217
218
  export declare const HF_COLOR_GRADING_ACTIVE_EFFECT_KEYS: readonly ["blur", "pixelate", "chromaBleed", "tapeDamage", "filmArtifacts", "halftone", "twoInkPrint", "ascii", "dither", "bloom", "monoScreen", "scanlines", "chromaticAberration", "crtCurvature", "digitalGlitch", "engraving", "crosshatch", "kuwahara"];
218
219
  export type HfColorGradingActiveEffectKey = (typeof HF_COLOR_GRADING_ACTIVE_EFFECT_KEYS)[number];
219
220
  export declare const HF_COLOR_GRADING_EFFECT_PRESETS: HfColorGradingPreset[];
@@ -365,6 +365,9 @@ export const HF_COLOR_GRADING_PRESETS = [
365
365
  ];
366
366
  const PRESETS_BY_ID = new Map(HF_COLOR_GRADING_PRESETS.map((preset) => [preset.id, preset]));
367
367
  const VARIABLE_REF_RE = /^\$(?:\{([A-Za-z0-9_.:-]+)\}|([A-Za-z0-9_.:-]+))$/;
368
+ export function isHfColorGradingVariableRef(value) {
369
+ return typeof value === "string" && VARIABLE_REF_RE.test(value.trim());
370
+ }
368
371
  const ADJUST_LIMITS = {
369
372
  exposure: { min: -2, max: 2 },
370
373
  contrast: { min: -1, max: 1 },
@@ -1,6 +1,6 @@
1
1
  import { acceleratedCanvasTrackerSource } from "../pageMotionBlur.js";
2
2
  import { findSceneTemplate, templateContent } from "@hyperframes/parsers/sub-composition-validity";
3
- import { parseHTML } from "linkedom";
3
+ import { parseHTML } from "@hyperframes/parsers/linkedom";
4
4
  import { escapeInlineScriptSource, indexOfLower, lowerAscii, RUNTIME_BOOTSTRAP_ATTR, startsWithLower, } from "./htmlTokens.js";
5
5
  export { escapeInlineScriptSource, RUNTIME_BOOTSTRAP_ATTR };
6
6
  const RUNTIME_FILES = [
@@ -1,4 +1,4 @@
1
- import { parseHTML } from "linkedom";
1
+ import { parseHTML } from "@hyperframes/parsers/linkedom";
2
2
  function finiteAttribute(element, name) {
3
3
  const raw = element.getAttribute(name);
4
4
  if (raw === null || raw.trim() === "")
@@ -1,4 +1,4 @@
1
- import { parseHTML } from "linkedom";
1
+ import { parseHTML } from "@hyperframes/parsers/linkedom";
2
2
  import { HF_AUDIO_FX_ATTR } from "../audioFx.js";
3
3
  import { locateSceneRoot } from "./htmlDocument.js";
4
4
  export { isTemplateEntry } from "./htmlDocument.js";
@@ -2,7 +2,7 @@
2
2
  * (linkedom): unknown elements and attributes are dropped by default rather than pattern-matched
3
3
  * as dangerous, so a new SVG feature can't reopen a class of bug the way regex denylisting did.
4
4
  */
5
- import { DOMParser } from "linkedom";
5
+ import { DOMParser } from "@hyperframes/parsers/linkedom";
6
6
  import { SVG_ATTRIBUTES as SAFE_ATTRIBUTES, SVG_ELEMENTS as SAFE_ELEMENTS, } from "../utils/svgAllowlist.js";
7
7
  function localName(name) {
8
8
  const i = name.lastIndexOf(":");
@@ -1,4 +1,4 @@
1
- import { parseHTML } from "linkedom";
1
+ import { parseHTML } from "@hyperframes/parsers/linkedom";
2
2
  export type PageDocument = ReturnType<typeof parseHTML>["document"];
3
3
  export declare function readPage(html: string): PageDocument;
4
4
  /** The page's tree for a step that edits it: handed over, and no longer the page the readers share. */
@@ -1,4 +1,4 @@
1
- import { parseHTML } from "linkedom";
1
+ import { parseHTML } from "@hyperframes/parsers/linkedom";
2
2
  /** The tree of the page the font step read last, so its readers share one parse of it. */
3
3
  let lastPage;
4
4
  export function readPage(html) {