reifyui 0.10.0 → 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/dist/index.cjs +17 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.d.ts +9 -1
- package/src/timeline/Timeline.jsx +27 -10
- package/styles/timeline.css +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reifyui",
|
|
3
|
-
"version": "0.10.
|
|
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
|
@@ -679,14 +679,22 @@ export interface TimelineClip {
|
|
|
679
679
|
label?: string;
|
|
680
680
|
/** Tooltip. Falls back to `label`. */
|
|
681
681
|
title?: string;
|
|
682
|
-
/** Artwork filling the block — a poster frame, a waveform. */
|
|
682
|
+
/** Artwork filling the block, tiled at a fixed tile size — a poster frame, a waveform. */
|
|
683
683
|
poster?: string;
|
|
684
|
+
/** A playable file. Used only when there is no `poster`: its FIRST FRAME is shown, which is a
|
|
685
|
+
* real frame of the real clip rather than a stand-in. Loaded with preload="metadata", so the
|
|
686
|
+
* whole file is not fetched to paint one frame. */
|
|
687
|
+
video?: string;
|
|
684
688
|
/** Shown centred when there is no poster. */
|
|
685
689
|
glyph?: ReactNode;
|
|
686
690
|
/** Small pill at the top left, e.g. an index. */
|
|
687
691
|
badge?: ReactNode;
|
|
688
692
|
/** 'failed' tints the block; any other value is yours to style as `.rui-tl-clip.is-<state>`. */
|
|
689
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 };
|
|
690
698
|
/** Border colour for this clip, as a CSS colour. */
|
|
691
699
|
accent?: string;
|
|
692
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,
|
|
494
|
-
: clamp((t0 + clip.duration) - t, TL_MIN_CLIP_S,
|
|
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,
|
|
504
|
-
: clamp((t0 + clip.duration) - t, TL_MIN_CLIP_S,
|
|
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
|
});
|
|
@@ -551,12 +559,21 @@ function Clip({ l, track, pps, selected, drag, onSelect, beginGesture, onTrim, o
|
|
|
551
559
|
onPointerDown={startMove}
|
|
552
560
|
onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onSelect(); } }}
|
|
553
561
|
>
|
|
554
|
-
{
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
562
|
+
{/* A poster tiles as a strip. With no poster but a playable file, the FILE's own first
|
|
563
|
+
frame is shown — `preload="metadata"` paints it without fetching the whole clip, and it
|
|
564
|
+
is a real frame of the real thing rather than a stand-in. Only when there is neither
|
|
565
|
+
does the block fall back to a glyph, which claims nothing. */}
|
|
566
|
+
{clip.poster ? (
|
|
567
|
+
<span className="rui-tl-strip" style={{
|
|
568
|
+
backgroundImage: `url("${String(clip.poster).replace(/"/g, '\\"')}")`,
|
|
569
|
+
backgroundSize: `${tileW}px 100%`,
|
|
570
|
+
}} />
|
|
571
|
+
) : clip.video ? (
|
|
572
|
+
<video className="rui-tl-frame" src={clip.video} preload="metadata" muted playsInline
|
|
573
|
+
tabIndex={-1} aria-hidden="true" />
|
|
574
|
+
) : (
|
|
575
|
+
<span className="rui-tl-blank" aria-hidden="true">{clip.glyph}</span>
|
|
576
|
+
)}
|
|
560
577
|
|
|
561
578
|
{clip.badge && <span className="rui-tl-badge">{clip.badge}</span>}
|
|
562
579
|
{known && width > 46 && <span className="rui-tl-dur">{durationLabel(clip.duration)}</span>}
|
package/styles/timeline.css
CHANGED
|
@@ -73,6 +73,12 @@
|
|
|
73
73
|
.rui-tl-strip {
|
|
74
74
|
position: absolute; inset: 0; background-repeat: repeat-x; background-position: left center;
|
|
75
75
|
}
|
|
76
|
+
/* The file's own first frame, when there is no poster. Pointer events off: the clip is the
|
|
77
|
+
target, and a <video> would otherwise swallow the drag that trims it. */
|
|
78
|
+
.rui-tl-frame {
|
|
79
|
+
position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
|
|
80
|
+
pointer-events: none; background: #0B0D12;
|
|
81
|
+
}
|
|
76
82
|
.rui-tl-blank {
|
|
77
83
|
position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
|
|
78
84
|
color: var(--uic-mute-2, #8E9199);
|