@pixerate/editor 0.58.0 → 0.60.0
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/agent/index.cjs +111 -38
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +30 -2
- package/dist/agent/index.d.ts +30 -2
- package/dist/agent/index.js +96 -23
- package/dist/agent/index.js.map +1 -1
- package/dist/agent-caret-BmYhQF7L.d.cts +106 -0
- package/dist/agent-caret-BmYhQF7L.d.ts +106 -0
- package/dist/animation/index.cjs +9 -3
- package/dist/animation/index.cjs.map +1 -1
- package/dist/animation/index.d.cts +2 -2
- package/dist/animation/index.d.ts +2 -2
- package/dist/animation/index.js +9 -3
- package/dist/animation-editor/index.cjs +535 -124
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +239 -9
- package/dist/animation-editor/index.d.ts +239 -9
- package/dist/animation-editor/index.js +494 -83
- package/dist/animation-editor/index.js.map +1 -1
- package/dist/canvas/index.cjs +35 -29
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +4 -4
- package/dist/canvas/index.d.ts +4 -4
- package/dist/canvas/index.js +9 -3
- package/dist/canvas/index.js.map +1 -1
- package/dist/{chunk-O4ONBPZW.cjs → chunk-2FGRTYJN.cjs} +4 -4
- package/dist/{chunk-O4ONBPZW.cjs.map → chunk-2FGRTYJN.cjs.map} +1 -1
- package/dist/{chunk-XZ4L3R4K.cjs → chunk-2FHLHZAL.cjs} +39 -3
- package/dist/chunk-2FHLHZAL.cjs.map +1 -0
- package/dist/{chunk-PYMV7HLI.js → chunk-3TLL5OID.js} +2 -2
- package/dist/{chunk-LMUDHBWR.js → chunk-4YFMSPBU.js} +2 -2
- package/dist/{chunk-3I6V7PI4.cjs → chunk-7ZSU4MQZ.cjs} +45 -45
- package/dist/{chunk-3I6V7PI4.cjs.map → chunk-7ZSU4MQZ.cjs.map} +1 -1
- package/dist/{chunk-UB2OY7FD.js → chunk-AGR4P4UZ.js} +38 -2
- package/dist/chunk-AGR4P4UZ.js.map +1 -0
- package/dist/{chunk-SHOVAHUB.js → chunk-JK6M6V7G.js} +2 -2
- package/dist/{chunk-WLVZ235X.js → chunk-OK7T2LHK.js} +229 -2
- package/dist/chunk-OK7T2LHK.js.map +1 -0
- package/dist/{chunk-AHCENCU4.cjs → chunk-T4XWVPJK.cjs} +253 -26
- package/dist/chunk-T4XWVPJK.cjs.map +1 -0
- package/dist/{chunk-FKONE6AO.cjs → chunk-YJLCBA7V.cjs} +3 -3
- package/dist/{chunk-FKONE6AO.cjs.map → chunk-YJLCBA7V.cjs.map} +1 -1
- package/dist/{easing-CNGk-W6d.d.ts → easing-lM0Xo9Ni.d.cts} +14 -2
- package/dist/{easing-CNGk-W6d.d.cts → easing-lM0Xo9Ni.d.ts} +14 -2
- package/dist/extensions/index.cjs +27 -3
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +2 -1
- package/dist/extensions/index.d.ts +2 -1
- package/dist/extensions/index.js +26 -2
- package/dist/{index-CTCc3m3C.d.ts → index-B16wbOn_.d.ts} +1 -0
- package/dist/{index-BcHyG0Wq.d.cts → index-BAt14aIU.d.cts} +1 -0
- package/dist/index.cjs +32 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/dist/parameters/index.cjs +2 -2
- package/dist/parameters/index.d.cts +1 -1
- package/dist/parameters/index.d.ts +1 -1
- package/dist/parameters/index.js +1 -1
- package/dist/{player-W-5DX3Go.d.ts → player-DV4Jujdq.d.ts} +1 -1
- package/dist/{player-Dg0FT0UI.d.cts → player-DrcP2xqj.d.cts} +1 -1
- package/dist/vector/index.cjs +472 -472
- package/dist/vector/index.d.cts +1 -1
- package/dist/vector/index.d.ts +1 -1
- package/dist/vector/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-AHCENCU4.cjs.map +0 -1
- package/dist/chunk-UB2OY7FD.js.map +0 -1
- package/dist/chunk-WLVZ235X.js.map +0 -1
- package/dist/chunk-XZ4L3R4K.cjs.map +0 -1
- /package/dist/{chunk-PYMV7HLI.js.map → chunk-3TLL5OID.js.map} +0 -0
- /package/dist/{chunk-LMUDHBWR.js.map → chunk-4YFMSPBU.js.map} +0 -0
- /package/dist/{chunk-SHOVAHUB.js.map → chunk-JK6M6V7G.js.map} +0 -0
|
@@ -12,6 +12,10 @@ var ANIMATION_EASING_PRESETS = [
|
|
|
12
12
|
"ease-in-out-elastic",
|
|
13
13
|
"elastic",
|
|
14
14
|
"spring",
|
|
15
|
+
"spring-gentle",
|
|
16
|
+
"spring-quick",
|
|
17
|
+
"spring-bouncy",
|
|
18
|
+
"spring-slow",
|
|
15
19
|
"hold"
|
|
16
20
|
];
|
|
17
21
|
var ANIMATION_EASING_LABELS = {
|
|
@@ -27,7 +31,11 @@ var ANIMATION_EASING_LABELS = {
|
|
|
27
31
|
"ease-in-elastic": "Elastic in",
|
|
28
32
|
"ease-in-out-elastic": "Elastic in-out",
|
|
29
33
|
elastic: "Elastic",
|
|
30
|
-
spring: "Spring"
|
|
34
|
+
spring: "Spring",
|
|
35
|
+
"spring-gentle": "Spring (gentle)",
|
|
36
|
+
"spring-quick": "Spring (quick)",
|
|
37
|
+
"spring-bouncy": "Spring (bouncy)",
|
|
38
|
+
"spring-slow": "Spring (slow)"
|
|
31
39
|
};
|
|
32
40
|
var CUBIC_BEZIER_PRESETS = {
|
|
33
41
|
linear: [0, 0, 1, 1],
|
|
@@ -39,6 +47,30 @@ var CUBIC_BEZIER_PRESETS = {
|
|
|
39
47
|
"ease-out-back": [0.34, 1.56, 0.64, 1]
|
|
40
48
|
};
|
|
41
49
|
var DEFAULT_SPRING = { stiffness: 170, damping: 26, mass: 1, velocity: 0 };
|
|
50
|
+
var SPRING_PRESETS = {
|
|
51
|
+
"spring-gentle": { mass: 1, stiffness: 100, damping: 15, velocity: 0 },
|
|
52
|
+
"spring-quick": { mass: 1, stiffness: 300, damping: 20, velocity: 0 },
|
|
53
|
+
"spring-bouncy": { mass: 1, stiffness: 600, damping: 15, velocity: 0 },
|
|
54
|
+
"spring-slow": { mass: 1, stiffness: 80, damping: 20, velocity: 0 }
|
|
55
|
+
};
|
|
56
|
+
function springSettleMs(spring) {
|
|
57
|
+
const stiffness = Math.max(1e-6, finite(spring.stiffness, DEFAULT_SPRING.stiffness));
|
|
58
|
+
const damping = Math.max(0, finite(spring.damping, DEFAULT_SPRING.damping));
|
|
59
|
+
const mass = Math.max(1e-6, finite(spring.mass, DEFAULT_SPRING.mass));
|
|
60
|
+
const w0 = Math.sqrt(stiffness / mass);
|
|
61
|
+
const zeta = damping / (2 * Math.sqrt(stiffness * mass));
|
|
62
|
+
let seconds;
|
|
63
|
+
if (zeta <= 0) seconds = Infinity;
|
|
64
|
+
else if (zeta < 1 - 1e-6) seconds = 6.9 / (zeta * w0);
|
|
65
|
+
else if (zeta <= 1 + 1e-6) seconds = 9.2 / w0;
|
|
66
|
+
else seconds = 9.2 / (w0 * (zeta - Math.sqrt(zeta * zeta - 1)));
|
|
67
|
+
return Math.round(Math.min(1e4, Math.max(50, seconds * 1e3)));
|
|
68
|
+
}
|
|
69
|
+
function reverseCubicBezier(easing) {
|
|
70
|
+
const r = resolveEasing(easing);
|
|
71
|
+
if (r === "hold" || r.type !== "cubic-bezier") return null;
|
|
72
|
+
return { type: "cubic-bezier", x1: 1 - r.x2, y1: 1 - r.y2, x2: 1 - r.x1, y2: 1 - r.y1 };
|
|
73
|
+
}
|
|
42
74
|
var DEFAULT_ELASTIC = { amplitude: 1, period: 0.3, mode: "out" };
|
|
43
75
|
var clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
44
76
|
var finite = (v, fallback) => typeof v === "number" && Number.isFinite(v) ? v : fallback;
|
|
@@ -123,6 +155,7 @@ function springAt(spring, seconds) {
|
|
|
123
155
|
function resolveEasing(easing) {
|
|
124
156
|
if (easing === "hold") return "hold";
|
|
125
157
|
if (easing === "spring") return { type: "spring", ...DEFAULT_SPRING };
|
|
158
|
+
if (typeof easing === "string" && easing in SPRING_PRESETS) return { type: "spring", ...SPRING_PRESETS[easing] };
|
|
126
159
|
if (easing === "elastic" || easing === "ease-out-elastic") {
|
|
127
160
|
return { type: "elastic", ...DEFAULT_ELASTIC, mode: "out" };
|
|
128
161
|
}
|
|
@@ -248,6 +281,9 @@ export {
|
|
|
248
281
|
ANIMATION_EASING_PRESETS,
|
|
249
282
|
ANIMATION_EASING_LABELS,
|
|
250
283
|
CUBIC_BEZIER_PRESETS,
|
|
284
|
+
SPRING_PRESETS,
|
|
285
|
+
springSettleMs,
|
|
286
|
+
reverseCubicBezier,
|
|
251
287
|
elasticAt,
|
|
252
288
|
cubicBezierAt,
|
|
253
289
|
springAt,
|
|
@@ -259,4 +295,4 @@ export {
|
|
|
259
295
|
easingToCss,
|
|
260
296
|
easingLabel
|
|
261
297
|
};
|
|
262
|
-
//# sourceMappingURL=chunk-
|
|
298
|
+
//# sourceMappingURL=chunk-AGR4P4UZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/animation/easing.ts"],"sourcesContent":["// Portions ported from filmcraft-main/crates/project/src/keyframe.rs (MIT OR Apache-2.0, © ArtCraft Team and contributors). See THIRD_PARTY_NOTICES.md.\n\n/**\n * Keyframe easing: the curve a segment follows from one keyframe to the next.\n *\n * - `hold` keeps the first keyframe's value until the next one (a step).\n * - `linear` and the CSS presets (`ease`, `ease-in`, `ease-out`, `ease-in-out`) are\n * CSS-compatible `cubic-bezier()` curves; `{ type: 'cubic-bezier', x1, y1, x2, y2 }` is any\n * such curve (x1 / y1 is the leaving keyframe's out handle, x2 / y2 the next one's in handle).\n * - `spring` is a damped spring settling on the next value (it may overshoot).\n */\n\n/** Named easing presets. */\nexport type AnimationEasingPreset =\n\t| 'linear'\n\t| 'hold'\n\t| 'ease'\n\t| 'ease-in'\n\t| 'ease-out'\n\t| 'ease-in-out'\n\t| 'ease-in-back'\n\t| 'ease-out-back'\n\t| 'ease-out-elastic'\n\t| 'ease-in-elastic'\n\t| 'ease-in-out-elastic'\n\t| 'elastic'\n\t| 'spring'\n\t| 'spring-gentle'\n\t| 'spring-quick'\n\t| 'spring-bouncy'\n\t| 'spring-slow';\n\nexport interface CubicBezierEasing {\n\ttype: 'cubic-bezier';\n\tx1: number;\n\ty1: number;\n\tx2: number;\n\ty2: number;\n}\n\nexport interface SpringEasing {\n\ttype: 'spring';\n\t/** Spring stiffness (default 170). */\n\tstiffness?: number;\n\t/** Damping (default 26). */\n\tdamping?: number;\n\t/** Mass (default 1). */\n\tmass?: number;\n\t/** Initial velocity in units of the segment's value change per second (default 0). */\n\tvelocity?: number;\n}\n\nexport interface ElasticEasing {\n\ttype: 'elastic';\n\t/** Amplitude / overshoot factor (default 1). */\n\tamplitude?: number;\n\t/** Period of oscillation as a fraction of duration (default 0.3). */\n\tperiod?: number;\n\t/** Mode of elastic oscillation ('out' | 'in' | 'in-out', default 'out'). */\n\tmode?: 'out' | 'in' | 'in-out';\n}\n\nexport type AnimationEasing = AnimationEasingPreset | CubicBezierEasing | SpringEasing | ElasticEasing;\n\n/** Preset names, in picker order. */\nexport const ANIMATION_EASING_PRESETS: readonly AnimationEasingPreset[] = [\n\t'linear',\n\t'ease',\n\t'ease-in',\n\t'ease-out',\n\t'ease-in-out',\n\t'ease-in-back',\n\t'ease-out-back',\n\t'ease-out-elastic',\n\t'ease-in-elastic',\n\t'ease-in-out-elastic',\n\t'elastic',\n\t'spring',\n\t'spring-gentle',\n\t'spring-quick',\n\t'spring-bouncy',\n\t'spring-slow',\n\t'hold'\n];\n\n/** Picker labels for the presets. */\nexport const ANIMATION_EASING_LABELS: Readonly<Record<AnimationEasingPreset, string>> = {\n\tlinear: 'Linear',\n\thold: 'Hold',\n\tease: 'Ease',\n\t'ease-in': 'Ease in',\n\t'ease-out': 'Ease out',\n\t'ease-in-out': 'Ease in-out',\n\t'ease-in-back': 'Back in',\n\t'ease-out-back': 'Back out',\n\t'ease-out-elastic': 'Elastic out',\n\t'ease-in-elastic': 'Elastic in',\n\t'ease-in-out-elastic': 'Elastic in-out',\n\telastic: 'Elastic',\n\tspring: 'Spring',\n\t'spring-gentle': 'Spring (gentle)',\n\t'spring-quick': 'Spring (quick)',\n\t'spring-bouncy': 'Spring (bouncy)',\n\t'spring-slow': 'Spring (slow)'\n};\n\n/** The CSS control points of the bezier presets (CSS Easing Functions Level 1 values for the CSS keywords). */\nexport const CUBIC_BEZIER_PRESETS: Readonly<Record<string, readonly [number, number, number, number]>> = {\n\tlinear: [0, 0, 1, 1],\n\tease: [0.25, 0.1, 0.25, 1],\n\t'ease-in': [0.42, 0, 1, 1],\n\t'ease-out': [0, 0, 0.58, 1],\n\t'ease-in-out': [0.42, 0, 0.58, 1],\n\t'ease-in-back': [0.36, 0, 0.66, -0.56],\n\t'ease-out-back': [0.34, 1.56, 0.64, 1]\n};\n\nconst DEFAULT_SPRING = { stiffness: 170, damping: 26, mass: 1, velocity: 0 };\n\n/**\n * Figma's named springs (mass 1): gentle 100 / 15, quick 300 / 20, bouncy 600 / 15, slow 80 / 20\n * (stiffness / damping). Each plays until it settles (see `springSettleMs`).\n */\nexport const SPRING_PRESETS: Readonly<Record<'spring-gentle' | 'spring-quick' | 'spring-bouncy' | 'spring-slow', Required<Omit<SpringEasing, 'type'>>>> = {\n\t'spring-gentle': { mass: 1, stiffness: 100, damping: 15, velocity: 0 },\n\t'spring-quick': { mass: 1, stiffness: 300, damping: 20, velocity: 0 },\n\t'spring-bouncy': { mass: 1, stiffness: 600, damping: 15, velocity: 0 },\n\t'spring-slow': { mass: 1, stiffness: 80, damping: 20, velocity: 0 }\n};\n\n/**\n * How long a spring takes to settle within 0.1% of its target, in ms (clamped to 50–10000):\n * 6.9 / (ζ·ω₀) s when under-damped, else 9.2 / its slowest rate.\n */\nexport function springSettleMs(spring: Omit<SpringEasing, 'type'>): number {\n\tconst stiffness = Math.max(1e-6, finite(spring.stiffness, DEFAULT_SPRING.stiffness));\n\tconst damping = Math.max(0, finite(spring.damping, DEFAULT_SPRING.damping));\n\tconst mass = Math.max(1e-6, finite(spring.mass, DEFAULT_SPRING.mass));\n\tconst w0 = Math.sqrt(stiffness / mass);\n\tconst zeta = damping / (2 * Math.sqrt(stiffness * mass));\n\tlet seconds: number;\n\tif (zeta <= 0) seconds = Infinity;\n\telse if (zeta < 1 - 1e-6) seconds = 6.9 / (zeta * w0);\n\telse if (zeta <= 1 + 1e-6) seconds = 9.2 / w0;\n\telse seconds = 9.2 / (w0 * (zeta - Math.sqrt(zeta * zeta - 1)));\n\treturn Math.round(Math.min(10000, Math.max(50, seconds * 1000)));\n}\n\n/** The same curve run backwards in time (`1 − e(1 − u)`) for a cubic-bezier, or null for other easings. */\nexport function reverseCubicBezier(easing: AnimationEasing | string | undefined | null): CubicBezierEasing | null {\n\tconst r = resolveEasing(easing);\n\tif (r === 'hold' || r.type !== 'cubic-bezier') return null;\n\treturn { type: 'cubic-bezier', x1: 1 - r.x2, y1: 1 - r.y2, x2: 1 - r.x1, y2: 1 - r.y1 };\n}\nconst DEFAULT_ELASTIC = { amplitude: 1, period: 0.3, mode: 'out' as const };\n\nconst clamp = (v: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, v));\nconst finite = (v: unknown, fallback: number) => (typeof v === 'number' && Number.isFinite(v) ? v : fallback);\n\n/**\n * Normalised position for a parametric elastic oscillation curve (as used in Rive and Penner curves).\n * Amplitude controls the overshoot intensity; period controls the wave frequency across normalized progress `t` (0–1).\n */\nexport function elasticAt(elastic: Omit<ElasticEasing, 'type'>, t: number): number {\n\tif (t <= 0) return 0;\n\tif (t >= 1) return 1;\n\n\tconst a = Math.max(1e-6, finite(elastic.amplitude, DEFAULT_ELASTIC.amplitude));\n\tconst p = Math.max(1e-6, finite(elastic.period, DEFAULT_ELASTIC.period));\n\tconst mode = elastic.mode ?? 'out';\n\n\tconst TAU = 2 * Math.PI;\n\n\tconst solveOut = (u: number, amp: number, per: number) => {\n\t\tconst s = amp < 1 ? per / 4 : (per / TAU) * Math.asin(1 / amp);\n\t\treturn amp * Math.pow(2, -10 * u) * Math.sin(((u - s) * TAU) / per) + 1;\n\t};\n\n\tconst solveIn = (u: number, amp: number, per: number) => {\n\t\tconst s = amp < 1 ? per / 4 : (per / TAU) * Math.asin(1 / amp);\n\t\tconst adjusted = u - 1;\n\t\treturn -(amp * Math.pow(2, 10 * adjusted) * Math.sin(((adjusted - s) * TAU) / per));\n\t};\n\n\tif (mode === 'in') {\n\t\treturn solveIn(t, a, p);\n\t}\n\tif (mode === 'in-out') {\n\t\tif (t < 0.5) {\n\t\t\treturn 0.5 * solveIn(t * 2, a, p);\n\t\t}\n\t\treturn 0.5 + 0.5 * solveOut((t - 0.5) * 2, a, p);\n\t}\n\treturn solveOut(t, a, p);\n}\n\n/**\n * Solves a CSS `cubic-bezier(x1, y1, x2, y2)` for y at progress x (Newton steps with a\n * bisection fallback). x1 / x2 are clamped to 0–1 as CSS requires.\n */\nexport function cubicBezierAt(x1: number, y1: number, x2: number, y2: number, x: number): number {\n\tif (x <= 0) return 0;\n\tif (x >= 1) return 1;\n\tx1 = clamp(x1, 0, 1);\n\tx2 = clamp(x2, 0, 1);\n\tconst bx = (s: number) => 3 * (1 - s) * (1 - s) * s * x1 + 3 * (1 - s) * s * s * x2 + s * s * s;\n\tconst by = (s: number) => 3 * (1 - s) * (1 - s) * s * y1 + 3 * (1 - s) * s * s * y2 + s * s * s;\n\tconst dbx = (s: number) => 3 * (1 - s) * (1 - s) * x1 + 6 * (1 - s) * s * (x2 - x1) + 3 * s * s * (1 - x2);\n\tlet s = x;\n\tfor (let i = 0; i < 8; i++) {\n\t\tconst d = dbx(s);\n\t\tif (Math.abs(d) < 1e-9) break;\n\t\tconst next = s - (bx(s) - x) / d;\n\t\tif (!(next >= 0 && next <= 1)) break;\n\t\ts = next;\n\t}\n\tif (Math.abs(bx(s) - x) > 1e-7) {\n\t\tlet lo = 0;\n\t\tlet hi = 1;\n\t\tfor (let i = 0; i < 60; i++) {\n\t\t\ts = (lo + hi) / 2;\n\t\t\tif (bx(s) < x) lo = s;\n\t\t\telse hi = s;\n\t\t}\n\t}\n\treturn by(s);\n}\n\n/**\n * Normalised position of a damped spring released from 0 towards 1, `seconds` after release.\n * Closed form for under-, critically and over-damped springs.\n */\nexport function springAt(spring: Omit<SpringEasing, 'type'>, seconds: number): number {\n\tconst stiffness = Math.max(1e-6, finite(spring.stiffness, DEFAULT_SPRING.stiffness));\n\tconst damping = Math.max(0, finite(spring.damping, DEFAULT_SPRING.damping));\n\tconst mass = Math.max(1e-6, finite(spring.mass, DEFAULT_SPRING.mass));\n\tconst v0 = -finite(spring.velocity, DEFAULT_SPRING.velocity);\n\tconst t = Math.max(0, seconds);\n\tconst w0 = Math.sqrt(stiffness / mass);\n\tconst zeta = damping / (2 * Math.sqrt(stiffness * mass));\n\t// x(t) is the displacement from the target (starts at 1); progress = 1 - x.\n\tlet x: number;\n\tif (zeta < 1 - 1e-6) {\n\t\tconst wd = w0 * Math.sqrt(1 - zeta * zeta);\n\t\tx = Math.exp(-zeta * w0 * t) * (Math.cos(wd * t) + ((zeta * w0 + v0) / wd) * Math.sin(wd * t));\n\t} else if (zeta <= 1 + 1e-6) {\n\t\tx = Math.exp(-w0 * t) * (1 + (w0 + v0) * t);\n\t} else {\n\t\tconst r = Math.sqrt(zeta * zeta - 1);\n\t\tconst s1 = -w0 * (zeta - r);\n\t\tconst s2 = -w0 * (zeta + r);\n\t\tconst c2 = (v0 - s1) / (s2 - s1);\n\t\tconst c1 = 1 - c2;\n\t\tx = c1 * Math.exp(s1 * t) + c2 * Math.exp(s2 * t);\n\t}\n\treturn 1 - x;\n}\n\n/** Resolves an easing to a cubic-bezier, spring, elastic or hold descriptor (unknown input → linear). */\nexport function resolveEasing(\n\teasing: AnimationEasing | string | undefined | null\n): CubicBezierEasing | Required<SpringEasing> | Required<ElasticEasing> | 'hold' {\n\tif (easing === 'hold') return 'hold';\n\tif (easing === 'spring') return { type: 'spring', ...DEFAULT_SPRING };\n\tif (typeof easing === 'string' && easing in SPRING_PRESETS) return { type: 'spring', ...SPRING_PRESETS[easing as keyof typeof SPRING_PRESETS] };\n\tif (easing === 'elastic' || easing === 'ease-out-elastic') {\n\t\treturn { type: 'elastic', ...DEFAULT_ELASTIC, mode: 'out' };\n\t}\n\tif (easing === 'ease-in-elastic') {\n\t\treturn { type: 'elastic', ...DEFAULT_ELASTIC, mode: 'in' };\n\t}\n\tif (easing === 'ease-in-out-elastic') {\n\t\treturn { type: 'elastic', ...DEFAULT_ELASTIC, mode: 'in-out' };\n\t}\n\tif (typeof easing === 'string') {\n\t\tconst preset = CUBIC_BEZIER_PRESETS[easing];\n\t\tif (preset) return { type: 'cubic-bezier', x1: preset[0], y1: preset[1], x2: preset[2], y2: preset[3] };\n\t\tconst parsed = parseCssEasing(easing);\n\t\treturn parsed ? resolveEasing(parsed) : { type: 'cubic-bezier', x1: 0, y1: 0, x2: 1, y2: 1 };\n\t}\n\tif (easing && typeof easing === 'object') {\n\t\tif (easing.type === 'spring') {\n\t\t\treturn {\n\t\t\t\ttype: 'spring',\n\t\t\t\tstiffness: finite(easing.stiffness, DEFAULT_SPRING.stiffness),\n\t\t\t\tdamping: finite(easing.damping, DEFAULT_SPRING.damping),\n\t\t\t\tmass: finite(easing.mass, DEFAULT_SPRING.mass),\n\t\t\t\tvelocity: finite(easing.velocity, DEFAULT_SPRING.velocity)\n\t\t\t};\n\t\t}\n\t\tif (easing.type === 'elastic') {\n\t\t\treturn {\n\t\t\t\ttype: 'elastic',\n\t\t\t\tamplitude: finite(easing.amplitude, DEFAULT_ELASTIC.amplitude),\n\t\t\t\tperiod: finite(easing.period, DEFAULT_ELASTIC.period),\n\t\t\t\tmode: easing.mode === 'in' || easing.mode === 'in-out' ? easing.mode : 'out'\n\t\t\t};\n\t\t}\n\t\tif (easing.type === 'cubic-bezier') {\n\t\t\treturn {\n\t\t\t\ttype: 'cubic-bezier',\n\t\t\t\tx1: clamp(finite(easing.x1, 0), 0, 1),\n\t\t\t\ty1: finite(easing.y1, 0),\n\t\t\t\tx2: clamp(finite(easing.x2, 1), 0, 1),\n\t\t\t\ty2: finite(easing.y2, 1)\n\t\t\t};\n\t\t}\n\t}\n\treturn { type: 'cubic-bezier', x1: 0, y1: 0, x2: 1, y2: 1 };\n}\n\n/**\n * Eased progress for linear progress `u` (0–1) through a segment lasting `durationMs`\n * (springs depend on real time; other curves ignore it). `hold` returns 0 until `u` reaches 1.\n */\nexport function evaluateEasing(easing: AnimationEasing | string | undefined | null, u: number, durationMs = 1000): number {\n\tif (!(u > 0)) return 0;\n\tif (u >= 1) return 1;\n\tconst resolved = resolveEasing(easing);\n\tif (resolved === 'hold') return 0;\n\tif (resolved.type === 'spring') return springAt(resolved, (u * Math.max(0, durationMs)) / 1000);\n\tif (resolved.type === 'elastic') return elasticAt(resolved, u);\n\tconst { x1, y1, x2, y2 } = resolved;\n\tif (x1 === y1 && x2 === y2) return u; // linear\n\treturn cubicBezierAt(x1, y1, x2, y2, u);\n}\n\n/**\n * The easing filmcraft (and Premiere) derive from temporal \"influence\" handles: flat handles of\n * the given influences (0.01–1, default 1/3) on the leaving and arriving keyframe.\n */\nexport function easingFromInfluence(outInfluence = 1 / 3, inInfluence = 1 / 3): CubicBezierEasing {\n\treturn {\n\t\ttype: 'cubic-bezier',\n\t\tx1: clamp(outInfluence, 0.01, 1),\n\t\ty1: 0,\n\t\tx2: 1 - clamp(inInfluence, 0.01, 1),\n\t\ty2: 1\n\t};\n}\n\nconst NUMBER = String.raw`\\s*(-?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[-+]?\\d+)?)\\s*`;\nconst CUBIC_RE = new RegExp(`^cubic-bezier\\\\(${NUMBER},${NUMBER},${NUMBER},${NUMBER}\\\\)$`, 'i');\n\n/**\n * Parses a CSS easing (`linear`, `ease…`, `cubic-bezier(…)`, `steps(1, end)` / `step-end` →\n * hold) or a preset name. Returns `null` for anything else.\n */\nexport function parseCssEasing(text: string): AnimationEasing | null {\n\tconst value = text.trim().toLowerCase();\n\tif (value.length > 200) return null;\n\tif ((ANIMATION_EASING_PRESETS as readonly string[]).includes(value)) return value as AnimationEasingPreset;\n\tif (value === 'step-end' || /^steps\\(\\s*1\\s*(,\\s*(end|jump-end)\\s*)?\\)$/.test(value)) return 'hold';\n\tconst m = CUBIC_RE.exec(value);\n\tif (!m) return null;\n\tconst [x1, y1, x2, y2] = m.slice(1).map(Number);\n\tif (![x1, y1, x2, y2].every(Number.isFinite) || x1 < 0 || x1 > 1 || x2 < 0 || x2 > 1) return null;\n\treturn { type: 'cubic-bezier', x1, y1, x2, y2 };\n}\n\n/** Whether a value is a usable easing (preset name, CSS easing string or descriptor). */\nexport function isAnimationEasing(value: unknown): value is AnimationEasing {\n\tif (typeof value === 'string') return parseCssEasing(value) !== null;\n\tif (typeof value !== 'object' || value === null) return false;\n\tconst e = value as Record<string, unknown>;\n\tif (e.type === 'spring') return true;\n\tif (e.type === 'elastic') return true;\n\treturn e.type === 'cubic-bezier' && [e.x1, e.y1, e.x2, e.y2].every((v) => typeof v === 'number' && Number.isFinite(v));\n}\n\nconst round = (v: number, digits = 4) => {\n\tconst p = 10 ** digits;\n\treturn Math.round(v * p) / p;\n};\n\n/**\n * The CSS `animation-timing-function` for an easing: a keyword or `cubic-bezier()`,\n * `steps(1, end)` for hold, and a sampled `linear(…)` for springs over `durationMs`.\n */\nexport function easingToCss(easing: AnimationEasing | string | undefined | null, durationMs = 1000, samples = 24): string {\n\tconst resolved = resolveEasing(easing);\n\tif (resolved === 'hold') return 'steps(1, end)';\n\tif (resolved.type === 'spring') {\n\t\tconst n = Math.max(2, Math.floor(samples));\n\t\tconst points: string[] = [];\n\t\tfor (let i = 0; i <= n; i++) points.push(String(round(i === n ? 1 : springAt(resolved, ((i / n) * durationMs) / 1000))));\n\t\treturn `linear(${points.join(', ')})`;\n\t}\n\tif (resolved.type === 'elastic') {\n\t\tconst n = Math.max(2, Math.floor(samples));\n\t\tconst points: string[] = [];\n\t\tfor (let i = 0; i <= n; i++) points.push(String(round(i === n ? 1 : elasticAt(resolved, i / n))));\n\t\treturn `linear(${points.join(', ')})`;\n\t}\n\tconst { x1, y1, x2, y2 } = resolved;\n\tfor (const [name, p] of Object.entries(CUBIC_BEZIER_PRESETS)) {\n\t\tif (['linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out'].includes(name) && p[0] === x1 && p[1] === y1 && p[2] === x2 && p[3] === y2) {\n\t\t\treturn name;\n\t\t}\n\t}\n\treturn `cubic-bezier(${round(x1)}, ${round(y1)}, ${round(x2)}, ${round(y2)})`;\n}\n\n/** Short label for an easing (a preset's label, or `Custom` / `Spring` / `Elastic`). */\nexport function easingLabel(easing: AnimationEasing | undefined | null): string {\n\tif (easing === undefined || easing === null) return ANIMATION_EASING_LABELS.linear;\n\tif (typeof easing === 'string') return ANIMATION_EASING_LABELS[easing as AnimationEasingPreset] ?? easing;\n\tif (easing.type === 'spring') return 'Spring';\n\tif (easing.type === 'elastic') return 'Elastic';\n\treturn 'Custom';\n}\n"],"mappings":";AAiEO,IAAM,2BAA6D;AAAA,EACzE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAGO,IAAM,0BAA2E;AAAA,EACvF,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,uBAAuB;AAAA,EACvB,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,iBAAi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AAM,MAAM,EAAE,CAAC,MAAM,IAAI;AACxI,aAAO;AAAA,IACR;AAAA,EACD;AACA,SAAO,gBAAgB,MAAM,EAAE,CAAC,KAAK,MAAM,EAAE,CAAC,KAAK,MAAM,EAAE,CAAC,KAAK,MAAM,EAAE,CAAC;AAC3E;AAGO,SAAS,YAAY,QAAoD;AAC/E,MAAI,WAAW,UAAa,WAAW,KAAM,QAAO,wBAAwB;AAC5E,MAAI,OAAO,WAAW,SAAU,QAAO,wBAAwB,MAA+B,KAAK;AACnG,MAAI,OAAO,SAAS,SAAU,QAAO;AACrC,MAAI,OAAO,SAAS,UAAW,QAAO;AACtC,SAAO;AACR;","names":["s"]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
evaluateEasing,
|
|
6
6
|
isAnimationEasing
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AGR4P4UZ.js";
|
|
8
8
|
|
|
9
9
|
// src/animation/keyframes.ts
|
|
10
10
|
var ANIMATION_TIME_EPSILON = 1e-6;
|
|
@@ -384,4 +384,4 @@ export {
|
|
|
384
384
|
AnimationPlayer,
|
|
385
385
|
createAnimationPlayer
|
|
386
386
|
};
|
|
387
|
-
//# sourceMappingURL=chunk-
|
|
387
|
+
//# sourceMappingURL=chunk-JK6M6V7G.js.map
|
|
@@ -14,6 +14,10 @@ import {
|
|
|
14
14
|
normalizeChartSpec
|
|
15
15
|
} from "./chunk-633QC34G.js";
|
|
16
16
|
import {
|
|
17
|
+
plainTextToSlice
|
|
18
|
+
} from "./chunk-UKI64KUD.js";
|
|
19
|
+
import {
|
|
20
|
+
TRACK_CHANGES_SKIP_META,
|
|
17
21
|
isTrackChangesEnabled
|
|
18
22
|
} from "./chunk-SWE3NPOU.js";
|
|
19
23
|
|
|
@@ -1999,6 +2003,217 @@ function createTableStore(editor) {
|
|
|
1999
2003
|
};
|
|
2000
2004
|
}
|
|
2001
2005
|
|
|
2006
|
+
// src/extensions/agent-caret.ts
|
|
2007
|
+
import { Extension } from "@tiptap/core";
|
|
2008
|
+
import { Plugin as Plugin3, PluginKey as PluginKey3 } from "@tiptap/pm/state";
|
|
2009
|
+
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
2010
|
+
var DEFAULT_AGENT_CARET_COLOR = "#8b5cf6";
|
|
2011
|
+
var DEFAULT_AGENT_CARET_NAME = "Agent";
|
|
2012
|
+
var agentCaretPluginKey = new PluginKey3("agentCaret");
|
|
2013
|
+
var clamp = (pos, size) => Math.max(0, Math.min(size, Math.round(pos)));
|
|
2014
|
+
function caretWidget(caret) {
|
|
2015
|
+
return (view) => {
|
|
2016
|
+
const doc = view.dom.ownerDocument;
|
|
2017
|
+
const el = doc.createElement("span");
|
|
2018
|
+
el.className = "pe-agent-caret";
|
|
2019
|
+
el.setAttribute("data-agent-id", caret.id);
|
|
2020
|
+
el.setAttribute("contenteditable", "false");
|
|
2021
|
+
el.setAttribute("aria-hidden", "true");
|
|
2022
|
+
el.style.cssText = `position:relative;margin-left:-1px;margin-right:-1px;border-left:2px solid ${caret.color};word-break:normal;pointer-events:none;`;
|
|
2023
|
+
const label = doc.createElement("span");
|
|
2024
|
+
label.className = "pe-agent-caret-label";
|
|
2025
|
+
label.textContent = caret.name;
|
|
2026
|
+
label.style.cssText = `position:absolute;left:-2px;bottom:100%;background:${caret.color};color:#fff;font:600 11px/1.5 system-ui,sans-serif;padding:0 5px;border-radius:3px 3px 3px 0;white-space:nowrap;user-select:none;pointer-events:none;`;
|
|
2027
|
+
el.append("\u2060", label, "\u2060");
|
|
2028
|
+
return el;
|
|
2029
|
+
};
|
|
2030
|
+
}
|
|
2031
|
+
var tint = (color, percent) => `color-mix(in srgb, ${color} ${percent}%, transparent)`;
|
|
2032
|
+
function buildDecorations(state, carets) {
|
|
2033
|
+
const decorations = [];
|
|
2034
|
+
for (const caret of carets) {
|
|
2035
|
+
for (const range of caret.changed) {
|
|
2036
|
+
decorations.push(
|
|
2037
|
+
Decoration.inline(range.from, range.to, {
|
|
2038
|
+
class: "pe-agent-changed",
|
|
2039
|
+
"data-agent-id": caret.id,
|
|
2040
|
+
style: `background-color:${tint(caret.color, 18)};`
|
|
2041
|
+
})
|
|
2042
|
+
);
|
|
2043
|
+
}
|
|
2044
|
+
const from = Math.min(caret.anchor, caret.head);
|
|
2045
|
+
const to = Math.max(caret.anchor, caret.head);
|
|
2046
|
+
if (from < to) {
|
|
2047
|
+
decorations.push(
|
|
2048
|
+
Decoration.inline(from, to, {
|
|
2049
|
+
class: "pe-agent-selection",
|
|
2050
|
+
"data-agent-id": caret.id,
|
|
2051
|
+
style: `background-color:${tint(caret.color, 28)};`
|
|
2052
|
+
})
|
|
2053
|
+
);
|
|
2054
|
+
}
|
|
2055
|
+
decorations.push(
|
|
2056
|
+
Decoration.widget(caret.head, caretWidget(caret), {
|
|
2057
|
+
key: `agent-caret:${caret.id}:${caret.name}:${caret.color}`,
|
|
2058
|
+
side: 10,
|
|
2059
|
+
ignoreSelection: true
|
|
2060
|
+
})
|
|
2061
|
+
);
|
|
2062
|
+
}
|
|
2063
|
+
return DecorationSet.create(state.doc, decorations);
|
|
2064
|
+
}
|
|
2065
|
+
function createAgentCaretPlugin() {
|
|
2066
|
+
return new Plugin3({
|
|
2067
|
+
key: agentCaretPluginKey,
|
|
2068
|
+
state: {
|
|
2069
|
+
init: (_, state) => ({ carets: [], spans: {}, decorations: DecorationSet.create(state.doc, []) }),
|
|
2070
|
+
apply(tr, value, _old, state) {
|
|
2071
|
+
const meta = tr.getMeta(agentCaretPluginKey);
|
|
2072
|
+
if (!tr.docChanged && !meta) return value;
|
|
2073
|
+
const size = state.doc.content.size;
|
|
2074
|
+
let carets = value.carets;
|
|
2075
|
+
let spans = value.spans;
|
|
2076
|
+
if (tr.docChanged) {
|
|
2077
|
+
const anchorBias = (c) => c.anchor <= c.head ? 1 : -1;
|
|
2078
|
+
carets = carets.map((c) => ({
|
|
2079
|
+
...c,
|
|
2080
|
+
anchor: tr.mapping.map(c.anchor, anchorBias(c)),
|
|
2081
|
+
head: tr.mapping.map(c.head, -anchorBias(c)),
|
|
2082
|
+
changed: c.changed.map((r) => ({ from: tr.mapping.map(r.from, 1), to: tr.mapping.map(r.to, -1) })).filter((r) => r.from < r.to)
|
|
2083
|
+
}));
|
|
2084
|
+
const own = !!meta && "span" in meta;
|
|
2085
|
+
spans = Object.fromEntries(
|
|
2086
|
+
Object.entries(spans).map(([id, s]) => {
|
|
2087
|
+
const from = tr.mapping.map(s.from, 1);
|
|
2088
|
+
return [id, { from, to: Math.max(from, tr.mapping.map(s.to, -1)), foreign: s.foreign || !own }];
|
|
2089
|
+
})
|
|
2090
|
+
);
|
|
2091
|
+
}
|
|
2092
|
+
if (meta && "set" in meta) {
|
|
2093
|
+
const input = meta.set;
|
|
2094
|
+
const prev = carets.find((c) => c.id === input.id);
|
|
2095
|
+
const anchor = clamp(input.from, size);
|
|
2096
|
+
const caret = {
|
|
2097
|
+
id: input.id,
|
|
2098
|
+
name: input.name ?? prev?.name ?? DEFAULT_AGENT_CARET_NAME,
|
|
2099
|
+
color: input.color ?? prev?.color ?? DEFAULT_AGENT_CARET_COLOR,
|
|
2100
|
+
anchor,
|
|
2101
|
+
head: input.to === void 0 ? anchor : clamp(input.to, size),
|
|
2102
|
+
changed: prev?.changed ?? []
|
|
2103
|
+
};
|
|
2104
|
+
carets = prev ? carets.map((c) => c.id === input.id ? caret : c) : [...carets, caret];
|
|
2105
|
+
} else if (meta && "clear" in meta) {
|
|
2106
|
+
carets = meta.clear === null ? [] : carets.filter((c) => c.id !== meta.clear);
|
|
2107
|
+
} else if (meta && "changed" in meta) {
|
|
2108
|
+
const { id, ranges } = meta.changed;
|
|
2109
|
+
carets = carets.map(
|
|
2110
|
+
(c) => c.id === id ? { ...c, changed: ranges.map((r) => ({ from: clamp(r.from, size), to: clamp(r.to, size) })).filter((r) => r.from < r.to) } : c
|
|
2111
|
+
);
|
|
2112
|
+
} else if (meta && "span" in meta) {
|
|
2113
|
+
const span = meta.span;
|
|
2114
|
+
spans = { ...spans };
|
|
2115
|
+
if ("end" in span) delete spans[span.id];
|
|
2116
|
+
else spans[span.id] = { from: span.from, to: span.to, foreign: spans[span.id]?.foreign ?? false };
|
|
2117
|
+
}
|
|
2118
|
+
return { carets, spans, decorations: buildDecorations(state, carets) };
|
|
2119
|
+
}
|
|
2120
|
+
},
|
|
2121
|
+
props: {
|
|
2122
|
+
decorations: (state) => agentCaretPluginKey.getState(state)?.decorations
|
|
2123
|
+
}
|
|
2124
|
+
});
|
|
2125
|
+
}
|
|
2126
|
+
var AgentCaret = Extension.create({
|
|
2127
|
+
name: "agentCaret",
|
|
2128
|
+
addProseMirrorPlugins() {
|
|
2129
|
+
return [createAgentCaretPlugin()];
|
|
2130
|
+
}
|
|
2131
|
+
});
|
|
2132
|
+
function ensureAgentCaret(editor) {
|
|
2133
|
+
if (editor.isDestroyed || agentCaretPluginKey.getState(editor.state)) return;
|
|
2134
|
+
editor.registerPlugin(createAgentCaretPlugin());
|
|
2135
|
+
}
|
|
2136
|
+
function dispatchMeta(editor, meta) {
|
|
2137
|
+
if (editor.isDestroyed) return;
|
|
2138
|
+
ensureAgentCaret(editor);
|
|
2139
|
+
editor.view.dispatch(editor.state.tr.setMeta(agentCaretPluginKey, meta).setMeta("addToHistory", false));
|
|
2140
|
+
}
|
|
2141
|
+
function setAgentCaret(editor, caret) {
|
|
2142
|
+
dispatchMeta(editor, { set: caret });
|
|
2143
|
+
}
|
|
2144
|
+
function clearAgentCaret(editor, id) {
|
|
2145
|
+
if (editor.isDestroyed || !agentCaretPluginKey.getState(editor.state)) return;
|
|
2146
|
+
dispatchMeta(editor, { clear: id ?? null });
|
|
2147
|
+
}
|
|
2148
|
+
function markAgentChanges(editor, id, ranges) {
|
|
2149
|
+
if (!ranges.length && !agentCaretPluginKey.getState(editor.state)) return;
|
|
2150
|
+
dispatchMeta(editor, { changed: { id, ranges } });
|
|
2151
|
+
}
|
|
2152
|
+
function getAgentCarets(state) {
|
|
2153
|
+
return agentCaretPluginKey.getState(state)?.carets ?? [];
|
|
2154
|
+
}
|
|
2155
|
+
function replaceWithTextTransaction(state, from, to, text) {
|
|
2156
|
+
return /[\r\n]/.test(text) ? state.tr.replace(from, to, plainTextToSlice(text, state.schema)) : text ? state.tr.insertText(text, from, to) : state.tr.delete(from, to);
|
|
2157
|
+
}
|
|
2158
|
+
var NO_HISTORY = (tr) => tr.setMeta("addToHistory", false).setMeta(TRACK_CHANGES_SKIP_META, true);
|
|
2159
|
+
var cannotAnimate = () => typeof document === "undefined" || document.hidden === true;
|
|
2160
|
+
async function typeAgentText(editor, options) {
|
|
2161
|
+
const { from, to, text, caret, signal } = options;
|
|
2162
|
+
const cps = options.charsPerSecond ?? 60;
|
|
2163
|
+
const chars = Array.from(text);
|
|
2164
|
+
ensureAgentCaret(editor);
|
|
2165
|
+
const show = (tr, anchor, head = anchor) => tr.setMeta(agentCaretPluginKey, { set: { ...caret, from: anchor, to: head } });
|
|
2166
|
+
const commit = (start, end) => {
|
|
2167
|
+
const tr = replaceWithTextTransaction(editor.state, start, end, text);
|
|
2168
|
+
const insertedTo = tr.mapping.map(end, 1);
|
|
2169
|
+
const insertedFrom = Math.min(tr.mapping.map(start, -1), insertedTo);
|
|
2170
|
+
editor.view.dispatch(show(tr, insertedTo).scrollIntoView());
|
|
2171
|
+
if (insertedFrom < insertedTo) markAgentChanges(editor, caret.id, [{ from: insertedFrom, to: insertedTo }]);
|
|
2172
|
+
return { from: insertedFrom, to: insertedTo };
|
|
2173
|
+
};
|
|
2174
|
+
const animate = Number.isFinite(cps) && cps > 0 && chars.length > 0 && (options.wait || !cannotAnimate());
|
|
2175
|
+
if (!animate) return commit(from, to);
|
|
2176
|
+
const wait = options.wait ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
2177
|
+
const duration = Math.min(options.maxDurationMs ?? 1500, chars.length / cps * 1e3);
|
|
2178
|
+
const frameMs = 1e3 / 30;
|
|
2179
|
+
const frames = Math.max(1, Math.min(chars.length, Math.round(duration / frameMs)));
|
|
2180
|
+
const original = editor.state.doc.slice(from, to);
|
|
2181
|
+
const inverses = [];
|
|
2182
|
+
const span = () => agentCaretPluginKey.getState(editor.state).spans[caret.id];
|
|
2183
|
+
editor.view.dispatch(NO_HISTORY(editor.state.tr.setMeta(agentCaretPluginKey, { span: { id: caret.id, from, to } })));
|
|
2184
|
+
editor.view.dispatch(NO_HISTORY(show(editor.state.tr, from, to)));
|
|
2185
|
+
const rollback = () => {
|
|
2186
|
+
const s = span();
|
|
2187
|
+
const tr = editor.state.tr;
|
|
2188
|
+
if (!s.foreign) inverses.slice().reverse().forEach((step) => tr.step(step));
|
|
2189
|
+
else tr.replace(s.from, s.to, original);
|
|
2190
|
+
tr.setMeta(agentCaretPluginKey, { span: { id: caret.id, end: true } });
|
|
2191
|
+
editor.view.dispatch(NO_HISTORY(tr));
|
|
2192
|
+
return { from: s.from, to: s.from + original.size };
|
|
2193
|
+
};
|
|
2194
|
+
try {
|
|
2195
|
+
if (from < to) await wait(options.selectMs ?? 250);
|
|
2196
|
+
for (let i = 1; i <= frames; i++) {
|
|
2197
|
+
if (signal?.aborted) throw new Error("Typing was cancelled; the document is unchanged.");
|
|
2198
|
+
if (editor.isDestroyed) throw new Error("The editor was closed while the agent was typing.");
|
|
2199
|
+
const s = span();
|
|
2200
|
+
const prefix = chars.slice(0, Math.round(chars.length * i / frames)).join("");
|
|
2201
|
+
const tr = replaceWithTextTransaction(editor.state, s.from, s.to, prefix);
|
|
2202
|
+
tr.steps.forEach((step, k) => inverses.push(step.invert(tr.docs[k])));
|
|
2203
|
+
const end = tr.mapping.map(s.to, 1);
|
|
2204
|
+
tr.setMeta(agentCaretPluginKey, { span: { id: caret.id, from: Math.min(tr.mapping.map(s.from, -1), end), to: end } });
|
|
2205
|
+
editor.view.dispatch(NO_HISTORY(tr));
|
|
2206
|
+
editor.view.dispatch(NO_HISTORY(show(editor.state.tr, end)));
|
|
2207
|
+
if (i < frames) await wait(duration / frames);
|
|
2208
|
+
}
|
|
2209
|
+
} catch (error) {
|
|
2210
|
+
if (!editor.isDestroyed) rollback();
|
|
2211
|
+
throw error;
|
|
2212
|
+
}
|
|
2213
|
+
const restored = rollback();
|
|
2214
|
+
return commit(restored.from, restored.to);
|
|
2215
|
+
}
|
|
2216
|
+
|
|
2002
2217
|
export {
|
|
2003
2218
|
ALLOW_NESTED_TABLES_META,
|
|
2004
2219
|
tableNestingPluginKey,
|
|
@@ -2057,6 +2272,18 @@ export {
|
|
|
2057
2272
|
runTableAction,
|
|
2058
2273
|
EMPTY_TABLE_STATE,
|
|
2059
2274
|
getTableState,
|
|
2060
|
-
createTableStore
|
|
2275
|
+
createTableStore,
|
|
2276
|
+
DEFAULT_AGENT_CARET_COLOR,
|
|
2277
|
+
DEFAULT_AGENT_CARET_NAME,
|
|
2278
|
+
agentCaretPluginKey,
|
|
2279
|
+
createAgentCaretPlugin,
|
|
2280
|
+
AgentCaret,
|
|
2281
|
+
ensureAgentCaret,
|
|
2282
|
+
setAgentCaret,
|
|
2283
|
+
clearAgentCaret,
|
|
2284
|
+
markAgentChanges,
|
|
2285
|
+
getAgentCarets,
|
|
2286
|
+
replaceWithTextTransaction,
|
|
2287
|
+
typeAgentText
|
|
2061
2288
|
};
|
|
2062
|
-
//# sourceMappingURL=chunk-
|
|
2289
|
+
//# sourceMappingURL=chunk-OK7T2LHK.js.map
|