reifyui 0.9.0 → 0.9.1
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 +39 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/timeline/Timeline.jsx +30 -0
- package/styles/timeline.css +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reifyui",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
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",
|
|
@@ -133,6 +133,34 @@ export function Timeline({
|
|
|
133
133
|
}
|
|
134
134
|
}, [pps, zoomStorageKey]);
|
|
135
135
|
|
|
136
|
+
/** The zoom at which the whole cut fills the lane, with a margin. */
|
|
137
|
+
const fitPps = useCallback((seconds) => {
|
|
138
|
+
const el = scroller.current;
|
|
139
|
+
if (!el || !(seconds > 0)) return null;
|
|
140
|
+
const room = el.clientWidth - TL_HEAD_W - 48;
|
|
141
|
+
if (room <= 0) return null;
|
|
142
|
+
return clamp(room / seconds, TL_MIN_PPS, TL_MAX_PPS);
|
|
143
|
+
}, []);
|
|
144
|
+
|
|
145
|
+
const fit = useCallback(() => {
|
|
146
|
+
const v = fitPps(contentSeconds);
|
|
147
|
+
if (v !== null) { setPps(v); if (scroller.current) scroller.current.scrollLeft = 0; }
|
|
148
|
+
}, [fitPps, contentSeconds]);
|
|
149
|
+
|
|
150
|
+
// FIT ONCE, when there is first something to fit. A 1 s clip at a fixed default is a 26 px
|
|
151
|
+
// sliver and reads as a broken control rather than a short shot; a 10 minute one runs off the
|
|
152
|
+
// panel. Fitting on the first content is the difference between a timeline that looks designed
|
|
153
|
+
// and one that looks unfinished — and it is done ONCE, not on every change, because re-fitting
|
|
154
|
+
// under someone who has just zoomed in is the control fighting them.
|
|
155
|
+
const fitted = useRef(false);
|
|
156
|
+
useLayoutEffect(() => {
|
|
157
|
+
if (fitted.current || !(contentSeconds > 0)) return;
|
|
158
|
+
if (zoomStorageKey && typeof window !== 'undefined'
|
|
159
|
+
&& window.localStorage.getItem(zoomStorageKey)) { fitted.current = true; return; }
|
|
160
|
+
const v = fitPps(contentSeconds);
|
|
161
|
+
if (v !== null) { fitted.current = true; setPps(v); }
|
|
162
|
+
}, [contentSeconds, fitPps, zoomStorageKey]);
|
|
163
|
+
|
|
136
164
|
useLayoutEffect(() => {
|
|
137
165
|
const a = anchor.current;
|
|
138
166
|
if (!a || !scroller.current) return;
|
|
@@ -294,6 +322,8 @@ export function Timeline({
|
|
|
294
322
|
onClick={() => setZoom(pps / 1.35)} disabled={pps <= TL_MIN_PPS + 1e-6}>−</button>
|
|
295
323
|
<button type="button" className="rui-tl-zoombtn" aria-label="Zoom in"
|
|
296
324
|
onClick={() => setZoom(pps * 1.35)} disabled={pps >= TL_MAX_PPS - 1e-6}>+</button>
|
|
325
|
+
<button type="button" className="rui-tl-zoombtn rui-tl-fit" aria-label="Fit to width"
|
|
326
|
+
title="Fit to width" onClick={fit} disabled={!(contentSeconds > 0)}>⤢</button>
|
|
297
327
|
</div>
|
|
298
328
|
</div>
|
|
299
329
|
);
|
package/styles/timeline.css
CHANGED
|
@@ -47,7 +47,9 @@
|
|
|
47
47
|
.rui-tl-lane {
|
|
48
48
|
position: relative; flex: 0 0 auto;
|
|
49
49
|
border-bottom: 1px solid var(--uic-line-soft, #EFF1F4);
|
|
50
|
-
|
|
50
|
+
/* Colour first, then the grid over it: a `background` shorthand after a background-image wipes
|
|
51
|
+
the image, which is how a lane loses its grid and nobody can see why. */
|
|
52
|
+
background-color: var(--uic-surface-2, #F7F8FA);
|
|
51
53
|
}
|
|
52
54
|
.rui-tl-laneempty {
|
|
53
55
|
margin: 0; padding: 0 10px; line-height: 48px; font-size: 12px;
|
|
@@ -128,6 +130,7 @@
|
|
|
128
130
|
}
|
|
129
131
|
.rui-tl-zoombtn:hover:not(:disabled) { background: var(--uic-line-soft, #EFF1F4); }
|
|
130
132
|
.rui-tl-zoombtn:disabled { opacity: .35; cursor: default; }
|
|
133
|
+
.rui-tl-fit { font-size: 12px; }
|
|
131
134
|
|
|
132
135
|
@media (prefers-reduced-motion: reduce) {
|
|
133
136
|
.rui-tl-scroll { scroll-behavior: auto; }
|