@hyperframes/core 0.9.92 → 0.9.93
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/clipFacts.d.ts +5 -0
- package/dist/clipFacts.js +21 -6
- package/dist/generated/runtime-inline.js +1 -1
- package/dist/hyperframe.runtime.iife.js +66 -66
- package/dist/runtime/editing/gsapSnapshot.d.ts +1 -0
- package/dist/runtime/editing/gsapSnapshot.js +7 -0
- package/dist/runtime/editing/textEdit.d.ts +23 -0
- package/dist/runtime/editing/textEdit.js +88 -3
- package/dist/runtime/editingPort.d.ts +3 -2
- package/dist/runtime/editingPort.js +11 -2
- package/dist/utils/inlineTextStyleRange.d.ts +33 -0
- package/dist/utils/inlineTextStyleRange.js +503 -0
- package/dist/utils/inlineTextStyleRead.d.ts +20 -0
- package/dist/utils/inlineTextStyleRead.js +72 -0
- package/package.json +8 -4
package/dist/clipFacts.d.ts
CHANGED
|
@@ -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}
|
|
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) =>
|
|
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
|
}
|