reifyui 0.8.0 → 0.9.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/index.cjs CHANGED
@@ -80,8 +80,13 @@ __export(src_exports, {
80
80
  Select: () => Select,
81
81
  SheetGrid: () => SheetGrid,
82
82
  Svg: () => Svg,
83
+ TL_DEFAULT_PPS: () => TL_DEFAULT_PPS,
84
+ TL_HEAD_W: () => TL_HEAD_W,
85
+ TL_MAX_PPS: () => TL_MAX_PPS,
86
+ TL_MIN_PPS: () => TL_MIN_PPS,
83
87
  TaskList: () => TaskList,
84
88
  Textarea: () => Textarea,
89
+ Timeline: () => Timeline,
85
90
  ToolGroup: () => ToolGroup,
86
91
  ToolRow: () => ToolRow,
87
92
  UserTurn: () => UserTurn,
@@ -106,6 +111,7 @@ __export(src_exports, {
106
111
  isAuthed: () => isAuthed,
107
112
  login: () => login,
108
113
  logout: () => logout,
114
+ majorTickStep: () => majorTickStep,
109
115
  packLayout: () => packLayout,
110
116
  parseArgs: () => parseArgs,
111
117
  prettyJson: () => prettyJson,
@@ -119,6 +125,8 @@ __export(src_exports, {
119
125
  summarizeSteps: () => summarizeSteps,
120
126
  switchOrg: () => switchOrg,
121
127
  taskStatusGroup: () => taskStatusGroup,
128
+ tickLabel: () => tickLabel,
129
+ timelineDurationLabel: () => durationLabel,
122
130
  toolMeta: () => toolMeta,
123
131
  turnsToMessages: () => turnsToMessages,
124
132
  useDialog: () => useDialog,
@@ -1422,7 +1430,7 @@ function useResizablePane(opts = {}) {
1422
1430
  storageKey = null
1423
1431
  // persist the chosen width per user (localStorage)
1424
1432
  } = opts;
1425
- const clamp = (0, import_react9.useCallback)((x) => {
1433
+ const clamp2 = (0, import_react9.useCallback)((x) => {
1426
1434
  let hi = max ?? Infinity;
1427
1435
  if (maxFraction && typeof window !== "undefined") hi = Math.min(hi, Math.round(window.innerWidth * maxFraction));
1428
1436
  return Math.min(hi, Math.max(min, x));
@@ -1431,7 +1439,7 @@ function useResizablePane(opts = {}) {
1431
1439
  if (storageKey && typeof window !== "undefined") {
1432
1440
  try {
1433
1441
  const n = parseInt(window.localStorage.getItem(storageKey) || "", 10);
1434
- if (Number.isFinite(n)) return clamp(n);
1442
+ if (Number.isFinite(n)) return clamp2(n);
1435
1443
  } catch {
1436
1444
  }
1437
1445
  }
@@ -1450,7 +1458,7 @@ function useResizablePane(opts = {}) {
1450
1458
  e.preventDefault();
1451
1459
  const sx = e.clientX, base = widthRef.current, dir = fromRight ? -1 : 1;
1452
1460
  document.body.classList.add("uic-resizing");
1453
- const move = (ev) => setWidth(clamp(base + dir * (ev.clientX - sx)));
1461
+ const move = (ev) => setWidth(clamp2(base + dir * (ev.clientX - sx)));
1454
1462
  const up = () => {
1455
1463
  window.removeEventListener("mousemove", move);
1456
1464
  window.removeEventListener("mouseup", up);
@@ -1461,7 +1469,7 @@ function useResizablePane(opts = {}) {
1461
1469
  window.addEventListener("mousemove", move);
1462
1470
  window.addEventListener("mouseup", up);
1463
1471
  document.body.style.cursor = "col-resize";
1464
- }, [clamp, fromRight, persist]);
1472
+ }, [clamp2, fromRight, persist]);
1465
1473
  const reset = (0, import_react9.useCallback)(() => {
1466
1474
  setWidth(initial);
1467
1475
  if (storageKey) {
@@ -3861,8 +3869,8 @@ function Panel(props) {
3861
3869
  var import_react25 = __toESM(require("react"), 1);
3862
3870
 
3863
3871
  // src/grid/layout.js
3864
- function sortLayout(layout) {
3865
- return [...layout].sort((a, b) => a.y - b.y || a.x - b.x);
3872
+ function sortLayout(layout2) {
3873
+ return [...layout2].sort((a, b) => a.y - b.y || a.x - b.x);
3866
3874
  }
3867
3875
  function overlaps(a, b) {
3868
3876
  return a.i !== b.i && a.x < b.x + b.w && a.x + a.w > b.x && a.y < b.y + b.h && a.y + a.h > b.y;
@@ -3879,8 +3887,8 @@ function clampItem(item, cols) {
3879
3887
  const x = Math.min(Math.max(item.x ?? 0, 0), cols - w);
3880
3888
  return { ...item, x, y: Math.max(0, item.y ?? 0), w, h };
3881
3889
  }
3882
- function compact(layout, cols, pinned) {
3883
- const sorted = layout.map((it) => clampItem(it, cols)).sort((a, b) => a.y - b.y || Number(b.i === pinned) - Number(a.i === pinned) || a.x - b.x);
3890
+ function compact(layout2, cols, pinned) {
3891
+ const sorted = layout2.map((it) => clampItem(it, cols)).sort((a, b) => a.y - b.y || Number(b.i === pinned) - Number(a.i === pinned) || a.x - b.x);
3884
3892
  const statics = sorted.filter((it) => it.static);
3885
3893
  const rest = sorted.filter((it) => !it.static);
3886
3894
  const placed = [...statics];
@@ -3892,34 +3900,34 @@ function compact(layout, cols, pinned) {
3892
3900
  placed.push({ ...item, y });
3893
3901
  }
3894
3902
  const byId = new Map(placed.map((it) => [it.i, it]));
3895
- return layout.map((it) => byId.get(it.i) || it);
3903
+ return layout2.map((it) => byId.get(it.i) || it);
3896
3904
  }
3897
- function moveItem(layout, id, x, y, cols) {
3898
- const next = layout.map((it) => it.i === id && !it.static ? clampItem({ ...it, x, y: Math.max(0, y) }, cols) : it);
3905
+ function moveItem(layout2, id, x, y, cols) {
3906
+ const next = layout2.map((it) => it.i === id && !it.static ? clampItem({ ...it, x, y: Math.max(0, y) }, cols) : it);
3899
3907
  return compact(next, cols, id);
3900
3908
  }
3901
- function nudgeItem(layout, id, dx, dy, cols) {
3902
- const item = layout.find((it) => it.i === id);
3903
- if (!item || item.static) return layout;
3904
- if (dx) return moveItem(layout, id, item.x + dx, item.y, cols);
3905
- const sameCols = layout.filter((o) => o.i !== id && o.x < item.x + item.w && o.x + o.w > item.x);
3909
+ function nudgeItem(layout2, id, dx, dy, cols) {
3910
+ const item = layout2.find((it) => it.i === id);
3911
+ if (!item || item.static) return layout2;
3912
+ if (dx) return moveItem(layout2, id, item.x + dx, item.y, cols);
3913
+ const sameCols = layout2.filter((o) => o.i !== id && o.x < item.x + item.w && o.x + o.w > item.x);
3906
3914
  if (dy < 0) {
3907
3915
  const above = sameCols.filter((o) => o.y + o.h <= item.y);
3908
- if (!above.length) return layout;
3916
+ if (!above.length) return layout2;
3909
3917
  const near2 = above.reduce((a, b) => a.y + a.h > b.y + b.h ? a : b);
3910
- return moveItem(layout, id, item.x, near2.y, cols);
3918
+ return moveItem(layout2, id, item.x, near2.y, cols);
3911
3919
  }
3912
3920
  const below = sameCols.filter((o) => o.y >= item.y + item.h);
3913
- if (!below.length) return layout;
3921
+ if (!below.length) return layout2;
3914
3922
  const near = below.reduce((a, b) => a.y < b.y ? a : b);
3915
- return moveItem(layout, id, item.x, near.y + near.h, cols);
3923
+ return moveItem(layout2, id, item.x, near.y + near.h, cols);
3916
3924
  }
3917
- function resizeItem(layout, id, w, h, cols) {
3918
- const next = layout.map((it) => it.i === id && !it.static ? clampItem({ ...it, w, h }, cols) : it);
3925
+ function resizeItem(layout2, id, w, h, cols) {
3926
+ const next = layout2.map((it) => it.i === id && !it.static ? clampItem({ ...it, w, h }, cols) : it);
3919
3927
  return compact(next, cols, id);
3920
3928
  }
3921
- function layoutRows(layout) {
3922
- return layout.reduce((n, it) => Math.max(n, (it.y || 0) + (it.h || 1)), 0);
3929
+ function layoutRows(layout2) {
3930
+ return layout2.reduce((n, it) => Math.max(n, (it.y || 0) + (it.h || 1)), 0);
3923
3931
  }
3924
3932
  function sameLayout(a, b) {
3925
3933
  if (a.length !== b.length) return false;
@@ -3949,7 +3957,7 @@ function useMeasuredWidth() {
3949
3957
  var NO_DRAG = "button, a, input, select, textarea, [data-uic-nodrag]";
3950
3958
  function PanelGrid(props) {
3951
3959
  const {
3952
- layout = [],
3960
+ layout: layout2 = [],
3953
3961
  children,
3954
3962
  cols = 12,
3955
3963
  rowHeight = 40,
@@ -3967,7 +3975,7 @@ function PanelGrid(props) {
3967
3975
  const swallowClick = (0, import_react25.useRef)(false);
3968
3976
  const stacked = width > 0 && width < stackAt;
3969
3977
  const arrangeable = editable && !stacked;
3970
- const live = drag ? drag.preview : layout;
3978
+ const live = drag ? drag.preview : layout2;
3971
3979
  const colW = width > 0 ? (width - gap * (cols - 1)) / cols : 0;
3972
3980
  const cellW = colW + gap;
3973
3981
  const cellH = rowHeight + gap;
@@ -3985,18 +3993,18 @@ function PanelGrid(props) {
3985
3993
  const rows = layoutRows(live);
3986
3994
  const height = stacked ? stack2.height : rows ? rowsToPx(rows) : 0;
3987
3995
  const commit = (0, import_react25.useCallback)((next) => {
3988
- if (onLayoutChange && !sameLayout(next, layout)) onLayoutChange(next);
3989
- }, [onLayoutChange, layout]);
3996
+ if (onLayoutChange && !sameLayout(next, layout2)) onLayoutChange(next);
3997
+ }, [onLayoutChange, layout2]);
3990
3998
  const detach = (0, import_react25.useRef)(null);
3991
3999
  (0, import_react25.useEffect)(() => () => detach.current?.(), []);
3992
4000
  const start = (id, mode) => (e) => {
3993
4001
  if (!arrangeable || e.button !== 0) return;
3994
- const item = layout.find((it) => it.i === id);
4002
+ const item = layout2.find((it) => it.i === id);
3995
4003
  if (!item || item.static) return;
3996
4004
  if (mode === "move" && (!e.target.closest(dragHandle) || e.target.closest(NO_DRAG))) return;
3997
4005
  e.preventDefault();
3998
4006
  detach.current?.();
3999
- const begin = { id, mode, origin: item, px: e.clientX, py: e.clientY, dx: 0, dy: 0, preview: layout };
4007
+ const begin = { id, mode, origin: item, px: e.clientX, py: e.clientY, dx: 0, dy: 0, preview: layout2 };
4000
4008
  dragRef.current = begin;
4001
4009
  setDrag(begin);
4002
4010
  const onMove = (ev) => {
@@ -4007,7 +4015,7 @@ function PanelGrid(props) {
4007
4015
  if (Math.abs(dx) > 3 || Math.abs(dy) > 3) swallowClick.current = true;
4008
4016
  const cx = Math.round(dx / cellW);
4009
4017
  const cy = Math.round(dy / cellH);
4010
- const preview = d.mode === "move" ? moveItem(layout, d.id, d.origin.x + cx, d.origin.y + cy, cols) : resizeItem(layout, d.id, d.origin.w + cx, d.origin.h + cy, cols);
4018
+ const preview = d.mode === "move" ? moveItem(layout2, d.id, d.origin.x + cx, d.origin.y + cy, cols) : resizeItem(layout2, d.id, d.origin.w + cx, d.origin.h + cy, cols);
4011
4019
  dragRef.current = { ...d, dx, dy, preview };
4012
4020
  setDrag(dragRef.current);
4013
4021
  };
@@ -4044,10 +4052,10 @@ function PanelGrid(props) {
4044
4052
  const onHandleKey = (id) => (e) => {
4045
4053
  const step = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }[e.key];
4046
4054
  if (!step) return;
4047
- const item = layout.find((it) => it.i === id);
4055
+ const item = layout2.find((it) => it.i === id);
4048
4056
  if (!item) return;
4049
4057
  e.preventDefault();
4050
- commit(e.shiftKey ? nudgeItem(layout, id, step[0], step[1], cols) : resizeItem(layout, id, item.w + step[0], item.h + step[1], cols));
4058
+ commit(e.shiftKey ? nudgeItem(layout2, id, step[0], step[1], cols) : resizeItem(layout2, id, item.w + step[0], item.h + step[1], cols));
4051
4059
  };
4052
4060
  const boxOf = (it) => stacked ? { left: 0, top: stack2.tops.get(it.i), width, height: rowsToPx(it.h || 1) } : { left: it.x * cellW, top: it.y * cellH, width: it.w * colW + (it.w - 1) * gap, height: rowsToPx(it.h) };
4053
4061
  const byId = new Map(live.map((it) => [it.i, it]));
@@ -4099,8 +4107,281 @@ function PanelGrid(props) {
4099
4107
  }
4100
4108
  );
4101
4109
  }
4102
- function packLayout(layout, cols = 12) {
4103
- const bottom = layoutRows(layout.filter((it) => Number.isFinite(it.y)));
4104
- return compact(layout.map((it) => Number.isFinite(it.y) ? it : { ...it, y: bottom }), cols);
4110
+ function packLayout(layout2, cols = 12) {
4111
+ const bottom = layoutRows(layout2.filter((it) => Number.isFinite(it.y)));
4112
+ return compact(layout2.map((it) => Number.isFinite(it.y) ? it : { ...it, y: bottom }), cols);
4113
+ }
4114
+
4115
+ // src/timeline/Timeline.jsx
4116
+ var import_react26 = require("react");
4117
+ var import_jsx_runtime25 = require("react/jsx-runtime");
4118
+ var TL_MIN_PPS = 4;
4119
+ var TL_MAX_PPS = 240;
4120
+ var TL_DEFAULT_PPS = 26;
4121
+ var TL_HEAD_W = 76;
4122
+ var UNKNOWN_W = 46;
4123
+ var MIN_CLIP_W = 26;
4124
+ var LANE_H = 48;
4125
+ var clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
4126
+ var TICK_STEPS = [0.1, 0.2, 0.5, 1, 2, 5, 10, 15, 30, 60, 120, 300, 600];
4127
+ function majorTickStep(pps) {
4128
+ for (const s of TICK_STEPS) if (s * pps >= 64) return s;
4129
+ return TICK_STEPS[TICK_STEPS.length - 1];
4130
+ }
4131
+ function tickLabel(t, step = 1) {
4132
+ const m = Math.floor(t / 60);
4133
+ const s = t - m * 60;
4134
+ const whole = Math.floor(s + 1e-6);
4135
+ const base = `${m}:${String(whole).padStart(2, "0")}`;
4136
+ if (step >= 1) return base;
4137
+ const frac = Math.round((s - whole) * 10);
4138
+ return frac > 0 ? `${base}.${frac}` : base;
4139
+ }
4140
+ function durationLabel(seconds) {
4141
+ if (!Number.isFinite(seconds) || seconds < 0) return "";
4142
+ const m = Math.floor(seconds / 60);
4143
+ const s = Math.round(seconds - m * 60);
4144
+ return `${m}:${String(s).padStart(2, "0")}`;
4145
+ }
4146
+ function layout(clips, pps, sequential) {
4147
+ let cursor = 0;
4148
+ return clips.map((c) => {
4149
+ const known = Number.isFinite(c.duration);
4150
+ const w = known ? Math.max(MIN_CLIP_W, c.duration * pps) : UNKNOWN_W;
4151
+ const x = sequential ? cursor * pps : (c.start || 0) * pps;
4152
+ if (sequential) cursor += known ? c.duration : UNKNOWN_W / pps;
4153
+ return { clip: c, x, w, known };
4154
+ });
4155
+ }
4156
+ function Timeline({
4157
+ tracks = [],
4158
+ /** Seconds. Drives the playhead; pass it from whatever is playing. */
4159
+ currentTime = 0,
4160
+ /** Called with a time in seconds when the ruler or lane background is scrubbed. */
4161
+ onSeek,
4162
+ onSelectClip,
4163
+ selectedClipId = null,
4164
+ /** Rendered at the right of each clip on hover — e.g. remove, reorder. (clip, index) => node */
4165
+ clipActions,
4166
+ /** Rendered after the last clip of a lane, e.g. an add button. (track) => node */
4167
+ laneAppend,
4168
+ zoomStorageKey = null,
4169
+ emptyLabel = "Nothing here yet.",
4170
+ className = ""
4171
+ }) {
4172
+ const scroller = (0, import_react26.useRef)(null);
4173
+ const [pps, setPps] = (0, import_react26.useState)(() => {
4174
+ if (zoomStorageKey && typeof window !== "undefined") {
4175
+ const n = parseFloat(window.localStorage.getItem(zoomStorageKey) || "");
4176
+ if (Number.isFinite(n)) return clamp(n, TL_MIN_PPS, TL_MAX_PPS);
4177
+ }
4178
+ return TL_DEFAULT_PPS;
4179
+ });
4180
+ const anchor = (0, import_react26.useRef)(null);
4181
+ const rows = (0, import_react26.useMemo)(
4182
+ () => tracks.map((t) => ({ ...t, laid: layout(t.clips || [], pps, t.sequential !== false) })),
4183
+ [tracks, pps]
4184
+ );
4185
+ const contentSeconds = (0, import_react26.useMemo)(() => {
4186
+ let end = 0;
4187
+ for (const t of rows) {
4188
+ for (const { clip, x, w } of t.laid) {
4189
+ void clip;
4190
+ end = Math.max(end, (x + w) / pps);
4191
+ }
4192
+ }
4193
+ return end;
4194
+ }, [rows, pps]);
4195
+ const setZoom = (0, import_react26.useCallback)((next, clientX) => {
4196
+ const v = clamp(next, TL_MIN_PPS, TL_MAX_PPS);
4197
+ const el = scroller.current;
4198
+ if (el) {
4199
+ const rect = el.getBoundingClientRect();
4200
+ const vx = clientX === void 0 ? (rect.width + TL_HEAD_W) / 2 : clientX - rect.left;
4201
+ anchor.current = { t: Math.max(0, (el.scrollLeft + vx - TL_HEAD_W) / pps), vx };
4202
+ }
4203
+ setPps(v);
4204
+ if (zoomStorageKey && typeof window !== "undefined") {
4205
+ try {
4206
+ window.localStorage.setItem(zoomStorageKey, String(v));
4207
+ } catch {
4208
+ }
4209
+ }
4210
+ }, [pps, zoomStorageKey]);
4211
+ (0, import_react26.useLayoutEffect)(() => {
4212
+ const a = anchor.current;
4213
+ if (!a || !scroller.current) return;
4214
+ anchor.current = null;
4215
+ scroller.current.scrollLeft = Math.max(0, TL_HEAD_W + a.t * pps - a.vx);
4216
+ }, [pps]);
4217
+ (0, import_react26.useEffect)(() => {
4218
+ const el = scroller.current;
4219
+ if (!el) return void 0;
4220
+ const onWheel = (e) => {
4221
+ if (!(e.ctrlKey || e.metaKey)) return;
4222
+ e.preventDefault();
4223
+ setZoom(pps * Math.exp(-e.deltaY * 22e-4), e.clientX);
4224
+ };
4225
+ el.addEventListener("wheel", onWheel, { passive: false });
4226
+ return () => el.removeEventListener("wheel", onWheel);
4227
+ }, [pps, setZoom]);
4228
+ const timeAt = (0, import_react26.useCallback)((clientX) => {
4229
+ const el = scroller.current;
4230
+ if (!el) return 0;
4231
+ const rect = el.getBoundingClientRect();
4232
+ return Math.max(0, (el.scrollLeft + (clientX - rect.left) - TL_HEAD_W) / pps);
4233
+ }, [pps]);
4234
+ const onScrub = (0, import_react26.useCallback)((e) => {
4235
+ if (!onSeek) return;
4236
+ e.currentTarget.setPointerCapture?.(e.pointerId);
4237
+ onSeek(timeAt(e.clientX));
4238
+ const move = (ev) => onSeek(timeAt(ev.clientX));
4239
+ const up = () => {
4240
+ window.removeEventListener("pointermove", move);
4241
+ window.removeEventListener("pointerup", up);
4242
+ };
4243
+ window.addEventListener("pointermove", move);
4244
+ window.addEventListener("pointerup", up);
4245
+ }, [onSeek, timeAt]);
4246
+ const onKeyDown = (0, import_react26.useCallback)((e) => {
4247
+ if (e.key === "+" || e.key === "=") {
4248
+ e.preventDefault();
4249
+ setZoom(pps * 1.35);
4250
+ }
4251
+ if (e.key === "-" || e.key === "_") {
4252
+ e.preventDefault();
4253
+ setZoom(pps / 1.35);
4254
+ }
4255
+ }, [pps, setZoom]);
4256
+ const major = majorTickStep(pps);
4257
+ const minor = major / 5;
4258
+ const laneW = Math.max(contentSeconds * pps + 120, 240);
4259
+ const ticks = [];
4260
+ for (let t = 0; t <= contentSeconds + major; t += major) ticks.push(t);
4261
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `rui-tl ${className}`, onKeyDown, tabIndex: -1, children: [
4262
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rui-tl-scroll", ref: scroller, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rui-tl-inner", style: { width: TL_HEAD_W + laneW }, children: [
4263
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rui-tl-row rui-tl-rulerrow", children: [
4264
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rui-tl-head rui-tl-rulerhead", "aria-hidden": "true" }),
4265
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4266
+ "div",
4267
+ {
4268
+ className: "rui-tl-ruler",
4269
+ style: {
4270
+ width: laneW,
4271
+ // Minor ticks are a repeating background rather than elements: at 600 s and a
4272
+ // fine zoom that is thousands of nodes, and they carry no information a stripe
4273
+ // does not.
4274
+ backgroundImage: "linear-gradient(90deg, var(--uic-line, #DDDFE6) 0 1px, transparent 1px),linear-gradient(90deg, var(--uic-line-soft, #EFF1F4) 0 1px, transparent 1px)",
4275
+ backgroundSize: `${major * pps}px 9px, ${minor * pps}px 5px`
4276
+ },
4277
+ onPointerDown: onScrub,
4278
+ role: onSeek ? "slider" : void 0,
4279
+ "aria-label": onSeek ? "Playhead" : void 0,
4280
+ "aria-valuemin": 0,
4281
+ "aria-valuemax": Math.round(contentSeconds),
4282
+ "aria-valuenow": Math.round(currentTime),
4283
+ tabIndex: onSeek ? 0 : void 0,
4284
+ onKeyDown: onSeek ? (e) => {
4285
+ const step = e.shiftKey ? 5 : 1;
4286
+ if (e.key === "ArrowLeft") {
4287
+ e.preventDefault();
4288
+ onSeek(Math.max(0, currentTime - step));
4289
+ }
4290
+ if (e.key === "ArrowRight") {
4291
+ e.preventDefault();
4292
+ onSeek(currentTime + step);
4293
+ }
4294
+ } : void 0,
4295
+ children: ticks.map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "rui-tl-ticklbl", style: { left: t * pps }, children: tickLabel(t, major) }, t))
4296
+ }
4297
+ )
4298
+ ] }),
4299
+ rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "rui-tl-empty", children: emptyLabel }),
4300
+ rows.map((track) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rui-tl-row", children: [
4301
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rui-tl-head", title: track.label, children: [
4302
+ track.icon,
4303
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "rui-tl-headlbl", children: track.label })
4304
+ ] }),
4305
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4306
+ "div",
4307
+ {
4308
+ className: "rui-tl-lane",
4309
+ style: { width: laneW, height: LANE_H },
4310
+ onPointerDown: (e) => {
4311
+ if (e.target === e.currentTarget) onScrub(e);
4312
+ },
4313
+ children: [
4314
+ track.laid.length === 0 && track.emptyLabel && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "rui-tl-laneempty", children: track.emptyLabel }),
4315
+ track.laid.map(({ clip, x, w, known }, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4316
+ "article",
4317
+ {
4318
+ className: "rui-tl-clip" + (clip.state ? ` is-${clip.state}` : "") + (known ? "" : " is-unmeasured") + (selectedClipId === clip.id ? " is-selected" : ""),
4319
+ style: { left: x, width: w, ...clip.accent ? { "--rui-tl-accent": clip.accent } : null },
4320
+ title: clip.title || clip.label,
4321
+ tabIndex: 0,
4322
+ onClick: () => onSelectClip?.(clip, i),
4323
+ onKeyDown: (e) => {
4324
+ if (e.key === "Enter" || e.key === " ") {
4325
+ e.preventDefault();
4326
+ onSelectClip?.(clip, i);
4327
+ }
4328
+ },
4329
+ children: [
4330
+ clip.poster ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("img", { className: "rui-tl-poster", src: clip.poster, alt: "", loading: "lazy" }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "rui-tl-blank", "aria-hidden": "true", children: clip.glyph }),
4331
+ clip.badge && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "rui-tl-badge", children: clip.badge }),
4332
+ known && w > 44 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "rui-tl-dur", children: durationLabel(clip.duration) }),
4333
+ clip.label && w > 96 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "rui-tl-name", children: clip.label }),
4334
+ clipActions && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "rui-tl-acts", children: clipActions(clip, i) })
4335
+ ]
4336
+ },
4337
+ clip.id ?? i
4338
+ )),
4339
+ laneAppend && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4340
+ "span",
4341
+ {
4342
+ className: "rui-tl-append",
4343
+ style: { left: track.laid.reduce((n, l) => Math.max(n, l.x + l.w), 0) + 4 },
4344
+ children: laneAppend(track)
4345
+ }
4346
+ )
4347
+ ]
4348
+ }
4349
+ )
4350
+ ] }, track.id)),
4351
+ Number.isFinite(currentTime) && contentSeconds > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4352
+ "div",
4353
+ {
4354
+ className: "rui-tl-playhead",
4355
+ style: { left: TL_HEAD_W + currentTime * pps },
4356
+ "aria-hidden": "true",
4357
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "rui-tl-playhead-grip" })
4358
+ }
4359
+ )
4360
+ ] }) }),
4361
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rui-tl-zoom", children: [
4362
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4363
+ "button",
4364
+ {
4365
+ type: "button",
4366
+ className: "rui-tl-zoombtn",
4367
+ "aria-label": "Zoom out",
4368
+ onClick: () => setZoom(pps / 1.35),
4369
+ disabled: pps <= TL_MIN_PPS + 1e-6,
4370
+ children: "\u2212"
4371
+ }
4372
+ ),
4373
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4374
+ "button",
4375
+ {
4376
+ type: "button",
4377
+ className: "rui-tl-zoombtn",
4378
+ "aria-label": "Zoom in",
4379
+ onClick: () => setZoom(pps * 1.35),
4380
+ disabled: pps >= TL_MAX_PPS - 1e-6,
4381
+ children: "+"
4382
+ }
4383
+ )
4384
+ ] })
4385
+ ] });
4105
4386
  }
4106
4387
  //# sourceMappingURL=index.cjs.map