reifyui 0.10.1 → 0.10.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reifyui",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "The open-source rendering & interaction layer for agentic applications. Stream and render any agent's output as polished, application-native UI \u2014 model-agnostic, framework-agnostic, design-system-native. The foundation for building generative-UI and agent products.",
5
5
  "keywords": [
6
6
  "react",
package/src/index.d.ts CHANGED
@@ -691,6 +691,10 @@ export interface TimelineClip {
691
691
  badge?: ReactNode;
692
692
  /** 'failed' tints the block; any other value is yours to style as `.rui-tl-clip.is-<state>`. */
693
693
  state?: string;
694
+ /** Seconds still available BEYOND the current window on each side — how far a trim may pull the
695
+ * edge back OUT. Without it an edge can only come in, and one stray drag makes a clip
696
+ * unrecoverable even though the film is still in the file. */
697
+ headroom?: { start?: number; end?: number };
694
698
  /** Border colour for this clip, as a CSS colour. */
695
699
  accent?: string;
696
700
  }
@@ -485,13 +485,21 @@ function Clip({ l, track, pps, selected, drag, onSelect, beginGesture, onTrim, o
485
485
 
486
486
  const startTrim = (e, edge) => {
487
487
  if (!onTrim || !known) return;
488
+ // HOW FAR THIS EDGE CAN GO BACK OUT, not just in. A trim clamped to the clip's CURRENT length
489
+ // can only ever shorten, so one stray drag makes a shot unrecoverable — the film is still in
490
+ // the file and the UI will not give it back. `headroom` is what the host says is left on each
491
+ // side beyond the present window; absent, the edge can only come in, which is the old
492
+ // behaviour and the honest default when nobody has said otherwise.
493
+ const room = clip.headroom || {};
494
+ const outward = Math.max(0, Number(edge === 'end' ? room.end : room.start) || 0);
495
+ const maxDur = clip.duration + outward;
488
496
  beginGesture(e, {
489
497
  kind: 'trim',
490
498
  snapTimes,
491
499
  preview: (t) => {
492
500
  const dur = edge === 'end'
493
- ? clamp(t - t0, TL_MIN_CLIP_S, clip.duration)
494
- : clamp((t0 + clip.duration) - t, TL_MIN_CLIP_S, clip.duration);
501
+ ? clamp(t - t0, TL_MIN_CLIP_S, maxDur)
502
+ : clamp((t0 + clip.duration) - t, TL_MIN_CLIP_S, maxDur);
495
503
  const nextW = dur * pps;
496
504
  const nextLeft = edge === 'end' ? x : x + (w - nextW);
497
505
  return { clipId: clip.id, width: nextW, left: nextLeft,
@@ -500,8 +508,8 @@ function Clip({ l, track, pps, selected, drag, onSelect, beginGesture, onTrim, o
500
508
  },
501
509
  commit: (t) => {
502
510
  const dur = edge === 'end'
503
- ? clamp(t - t0, TL_MIN_CLIP_S, clip.duration)
504
- : clamp((t0 + clip.duration) - t, TL_MIN_CLIP_S, clip.duration);
511
+ ? clamp(t - t0, TL_MIN_CLIP_S, maxDur)
512
+ : clamp((t0 + clip.duration) - t, TL_MIN_CLIP_S, maxDur);
505
513
  if (Math.abs(dur - clip.duration) > 1e-3) onTrim(clip, edge, dur, track);
506
514
  },
507
515
  });