@dxos/react-ui-animation 0.0.0-stage → 0.0.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/LICENSE +105 -0
- package/dist/lib/index.mjs +306 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/px-icons/anthropic.svg +12 -0
- package/dist/px-icons/bar-high.svg +21 -0
- package/dist/px-icons/bar-low.svg +18 -0
- package/dist/px-icons/bar-medium.svg +20 -0
- package/dist/px-icons/circle.svg +5 -0
- package/dist/px-icons/context-panel.svg +6 -0
- package/dist/px-icons/deepseek.svg +10 -0
- package/dist/types/src/components/TimelineBar/TimelineBar.d.ts +38 -0
- package/dist/types/src/components/TimelineBar/TimelineBar.d.ts.map +1 -0
- package/dist/types/src/components/TimelineBar/TimelineBar.stories.d.ts +23 -0
- package/dist/types/src/components/TimelineBar/TimelineBar.stories.d.ts.map +1 -0
- package/dist/types/src/components/TimelineBar/TimelineBar.test.d.ts +2 -0
- package/dist/types/src/components/TimelineBar/TimelineBar.test.d.ts.map +1 -0
- package/dist/types/src/components/TimelineBar/index.d.ts +2 -0
- package/dist/types/src/components/TimelineBar/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +3 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useClock.d.ts +13 -0
- package/dist/types/src/hooks/useClock.d.ts.map +1 -0
- package/dist/types/src/hooks/useExposedClock.d.ts +10 -0
- package/dist/types/src/hooks/useExposedClock.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +49 -3
- package/src/components/TimelineBar/TimelineBar.stories.tsx +200 -0
- package/src/components/TimelineBar/TimelineBar.test.ts +20 -0
- package/src/components/TimelineBar/TimelineBar.tsx +288 -0
- package/src/components/TimelineBar/index.ts +5 -0
- package/src/components/index.ts +5 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useClock.ts +56 -0
- package/src/hooks/useExposedClock.ts +35 -0
- package/src/index.ts +6 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
2
|
+
import * as Button from "@dxos/react-ui/Button";
|
|
3
|
+
import * as Menu from "@dxos/react-ui/Menu";
|
|
4
|
+
import * as Toolbar from "@dxos/react-ui/Toolbar";
|
|
5
|
+
import { mx } from "@dxos/ui-theme";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useAtomValue } from "@effect/atom-react/Hooks";
|
|
8
|
+
import { RegistryContext } from "@effect/atom-react/RegistryContext";
|
|
9
|
+
import { DEFAULT_FPS, MAX_CLOCK_STEP, exposeClock } from "@dxos/animation";
|
|
10
|
+
//#region src/components/TimelineBar/TimelineBar.tsx
|
|
11
|
+
/** The timeline's controls show no focus ring: focus is visible as the playhead and keys respond to the keyboard. */
|
|
12
|
+
var NO_RING = "focus-visible:ring-0";
|
|
13
|
+
/** The key at time `t`, if one is within half a frame of it. */
|
|
14
|
+
var keyAt = (keys, t, fps) => keys.find((key) => Math.abs(key - t) < .5 / fps);
|
|
15
|
+
/** Where ⌘ with an arrow goes from `t`: the next (or previous) key, else the end (or start) when there is none that way. */
|
|
16
|
+
var jumpTarget = (keys, t, fps, duration, back) => (back ? [...keys].reverse().find((key) => key < t - .5 / fps) : keys.find((key) => key > t + .5 / fps)) ?? (back ? 0 : duration);
|
|
17
|
+
/** `t` as `s.ff`, seconds and frames, as an editor's timecode reads. */
|
|
18
|
+
var formatTime = (t, fps) => {
|
|
19
|
+
const frame = Math.round(t * fps);
|
|
20
|
+
return `${Math.floor(frame / fps)}.${String(frame % fps).padStart(2, "0")}`;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The collapsed timeline (react-ui-canvas ANIMATION.md §5.8): play and pause, a track to scrub the playhead along with the selection's
|
|
24
|
+
* keys on it, the time, the key toggle and the auto-key toggle. Dragging the track scrubs; clicking a diamond moves the
|
|
25
|
+
* playhead to it. On the track, the arrows step a frame (with Shift, a second), ⌘ or Ctrl with an arrow jumps to the
|
|
26
|
+
* previous or next key (the start or end when there is none that way), and Delete removes the key under the playhead. On the play button, Left and Right jump to the
|
|
27
|
+
* keys (or ends) with ⌘ or Ctrl and scrub otherwise, Enter keys the playhead, Delete removes the key there and Space plays and pauses.
|
|
28
|
+
*/
|
|
29
|
+
var TimelineBar = ({ classNames, time, duration, playing, fps, keys = [], autoKey, readonly, onPlayingChange, onTimeChange, onAutoKeyChange, onAddKey, onRemoveKey, onMoveKey }) => {
|
|
30
|
+
const current = keyAt(keys, time, fps);
|
|
31
|
+
const [dragging, setDragging] = useState();
|
|
32
|
+
const trackRef = useRef(null);
|
|
33
|
+
const timeAt = useCallback((clientX) => {
|
|
34
|
+
const track = trackRef.current?.getBoundingClientRect();
|
|
35
|
+
if (!track || track.width === 0 || duration <= 0) return 0;
|
|
36
|
+
const raw = (clientX - track.left) / track.width * duration;
|
|
37
|
+
return Math.min(duration, Math.max(0, Math.round(raw * fps) / fps));
|
|
38
|
+
}, [duration, fps]);
|
|
39
|
+
const onPointerDown = useCallback((event) => {
|
|
40
|
+
event.stopPropagation();
|
|
41
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
42
|
+
onPlayingChange?.(false);
|
|
43
|
+
onTimeChange?.(timeAt(event.clientX));
|
|
44
|
+
}, [
|
|
45
|
+
onPlayingChange,
|
|
46
|
+
onTimeChange,
|
|
47
|
+
timeAt
|
|
48
|
+
]);
|
|
49
|
+
const onPointerMove = useCallback((event) => {
|
|
50
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) onTimeChange?.(timeAt(event.clientX));
|
|
51
|
+
}, [onTimeChange, timeAt]);
|
|
52
|
+
const onKeyDown = useCallback((event) => {
|
|
53
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
event.stopPropagation();
|
|
56
|
+
const back = event.key === "ArrowLeft";
|
|
57
|
+
if (event.metaKey || event.ctrlKey) {
|
|
58
|
+
onTimeChange?.(jumpTarget(keys, time, fps, duration, back));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const step = event.shiftKey ? 1 : 1 / fps;
|
|
62
|
+
onTimeChange?.(Math.min(duration, Math.max(0, time + (back ? -step : step))));
|
|
63
|
+
} else if ((event.key === "Delete" || event.key === "Backspace") && current !== void 0 && onRemoveKey) {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
event.stopPropagation();
|
|
66
|
+
onRemoveKey();
|
|
67
|
+
}
|
|
68
|
+
}, [
|
|
69
|
+
time,
|
|
70
|
+
duration,
|
|
71
|
+
fps,
|
|
72
|
+
keys,
|
|
73
|
+
current,
|
|
74
|
+
onTimeChange,
|
|
75
|
+
onRemoveKey
|
|
76
|
+
]);
|
|
77
|
+
const at = (t) => `${duration > 0 ? t / duration * 100 : 0}%`;
|
|
78
|
+
return /* @__PURE__ */ jsxs(Toolbar.Root, {
|
|
79
|
+
classNames: mx("min-w-[24rem]", classNames),
|
|
80
|
+
"data-testid": "timeline",
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ jsx(Button.Root, {
|
|
83
|
+
variant: "ghost",
|
|
84
|
+
iconOnly: true,
|
|
85
|
+
classNames: NO_RING,
|
|
86
|
+
icon: playing ? "ph--pause--regular" : "ph--play--regular",
|
|
87
|
+
label: playing ? "Pause" : "Play",
|
|
88
|
+
"data-testid": "timeline-play",
|
|
89
|
+
onKeyDown: (event) => {
|
|
90
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
event.stopPropagation();
|
|
93
|
+
onPlayingChange?.(false);
|
|
94
|
+
const back = event.key === "ArrowLeft";
|
|
95
|
+
if (event.metaKey || event.ctrlKey) onTimeChange?.(jumpTarget(keys, time, fps, duration, back));
|
|
96
|
+
else {
|
|
97
|
+
const step = event.shiftKey ? 1 : 1 / fps;
|
|
98
|
+
onTimeChange?.(Math.min(duration, Math.max(0, time + (back ? -step : step))));
|
|
99
|
+
}
|
|
100
|
+
} else if (event.key === "Enter") {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
event.stopPropagation();
|
|
103
|
+
if (current === void 0 && onAddKey && !readonly) onAddKey();
|
|
104
|
+
} else if ((event.key === "Delete" || event.key === "Backspace") && current !== void 0 && onRemoveKey) {
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
event.stopPropagation();
|
|
107
|
+
onRemoveKey();
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
onClick: () => {
|
|
111
|
+
if (!playing && time >= duration) onTimeChange?.(0);
|
|
112
|
+
onPlayingChange?.(!playing);
|
|
113
|
+
}
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ jsxs("div", {
|
|
116
|
+
ref: trackRef,
|
|
117
|
+
role: "slider",
|
|
118
|
+
tabIndex: 0,
|
|
119
|
+
"aria-label": "Playhead",
|
|
120
|
+
"aria-valuemin": 0,
|
|
121
|
+
"aria-valuemax": duration,
|
|
122
|
+
"aria-valuenow": time,
|
|
123
|
+
"aria-valuetext": `${formatTime(time, fps)} s`,
|
|
124
|
+
className: "relative grow h-6 mx-2 cursor-pointer touch-none outline-none rounded-xs",
|
|
125
|
+
"data-testid": "timeline-track",
|
|
126
|
+
onPointerDown,
|
|
127
|
+
onPointerMove,
|
|
128
|
+
onKeyDown,
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-x-0 top-1/2 h-0.5 -translate-y-1/2 bg-separator rounded-full" }),
|
|
131
|
+
/* @__PURE__ */ jsx("div", {
|
|
132
|
+
className: "absolute left-0 top-1/2 h-0.5 -translate-y-1/2 bg-accent-bg rounded-full",
|
|
133
|
+
style: { width: at(time) }
|
|
134
|
+
}),
|
|
135
|
+
keys.map((key) => {
|
|
136
|
+
const shown = dragging?.from === key ? dragging.to : key;
|
|
137
|
+
return /* @__PURE__ */ jsx("button", {
|
|
138
|
+
type: "button",
|
|
139
|
+
"aria-label": `Key at ${formatTime(key, fps)} s`,
|
|
140
|
+
className: mx("absolute top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rotate-45 border border-separator", onMoveKey && !readonly && "cursor-ew-resize", key === current || dragging?.from === key ? "bg-amber-300 ring-1 ring-amber-300" : "bg-amber-500"),
|
|
141
|
+
style: { left: at(shown) },
|
|
142
|
+
"data-testid": "timeline-key",
|
|
143
|
+
onPointerDown: (event) => {
|
|
144
|
+
event.stopPropagation();
|
|
145
|
+
onPlayingChange?.(false);
|
|
146
|
+
onTimeChange?.(key);
|
|
147
|
+
if (onMoveKey && !readonly) {
|
|
148
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
149
|
+
setDragging({
|
|
150
|
+
from: key,
|
|
151
|
+
to: key
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
onPointerMove: (event) => {
|
|
156
|
+
if (dragging?.from === key) {
|
|
157
|
+
const to = timeAt(event.clientX);
|
|
158
|
+
setDragging({
|
|
159
|
+
from: key,
|
|
160
|
+
to
|
|
161
|
+
});
|
|
162
|
+
onTimeChange?.(to);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
onPointerUp: () => {
|
|
166
|
+
if (dragging?.from === key && dragging.to !== key) onMoveKey?.(key, dragging.to);
|
|
167
|
+
setDragging(void 0);
|
|
168
|
+
},
|
|
169
|
+
onPointerCancel: () => setDragging(void 0)
|
|
170
|
+
}, key);
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ jsx("div", {
|
|
173
|
+
className: "absolute top-0 bottom-0 w-0.5 -translate-x-1/2 bg-accent-bg pointer-events-none",
|
|
174
|
+
style: { left: at(time) },
|
|
175
|
+
"data-testid": "timeline-playhead"
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ jsxs("span", {
|
|
180
|
+
className: "shrink-0 text-end text-sm whitespace-nowrap tabular-nums text-fg-muted",
|
|
181
|
+
"data-testid": "timeline-time",
|
|
182
|
+
children: [
|
|
183
|
+
formatTime(time, fps),
|
|
184
|
+
" / ",
|
|
185
|
+
formatTime(duration, fps)
|
|
186
|
+
]
|
|
187
|
+
}),
|
|
188
|
+
!readonly && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Menu.Root, {
|
|
189
|
+
positioning: {
|
|
190
|
+
placement: "top-end",
|
|
191
|
+
gutter: 4
|
|
192
|
+
},
|
|
193
|
+
children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
194
|
+
asChild: true,
|
|
195
|
+
children: /* @__PURE__ */ jsx(Button.Root, {
|
|
196
|
+
variant: "ghost",
|
|
197
|
+
iconOnly: true,
|
|
198
|
+
classNames: NO_RING,
|
|
199
|
+
icon: "ph--dots-three-vertical--regular",
|
|
200
|
+
label: "Timeline actions",
|
|
201
|
+
"data-testid": "timeline-menu"
|
|
202
|
+
})
|
|
203
|
+
}), /* @__PURE__ */ jsxs(Menu.Content, { children: [
|
|
204
|
+
/* @__PURE__ */ jsx(Menu.Item, {
|
|
205
|
+
item: {
|
|
206
|
+
value: "add-key",
|
|
207
|
+
label: "Add key",
|
|
208
|
+
shortcut: "↵"
|
|
209
|
+
},
|
|
210
|
+
disabled: current !== void 0 || !onAddKey,
|
|
211
|
+
"data-testid": "timeline-add-key",
|
|
212
|
+
onSelect: () => onAddKey?.()
|
|
213
|
+
}),
|
|
214
|
+
/* @__PURE__ */ jsx(Menu.Item, {
|
|
215
|
+
item: {
|
|
216
|
+
value: "remove-key",
|
|
217
|
+
label: "Delete key",
|
|
218
|
+
shortcut: "⌫"
|
|
219
|
+
},
|
|
220
|
+
disabled: current === void 0 || !onRemoveKey,
|
|
221
|
+
"data-testid": "timeline-remove-key",
|
|
222
|
+
onSelect: () => onRemoveKey?.()
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ jsx(Menu.Separator, {}),
|
|
225
|
+
/* @__PURE__ */ jsx(Menu.CheckboxItem, {
|
|
226
|
+
item: {
|
|
227
|
+
value: "auto-key",
|
|
228
|
+
label: "Auto-key"
|
|
229
|
+
},
|
|
230
|
+
checked: !!autoKey,
|
|
231
|
+
"data-testid": "timeline-auto-key",
|
|
232
|
+
onCheckedChange: (checked) => onAutoKeyChange?.(checked === true)
|
|
233
|
+
})
|
|
234
|
+
] })]
|
|
235
|
+
}) })
|
|
236
|
+
]
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/hooks/useClock.ts
|
|
241
|
+
/**
|
|
242
|
+
* A clock's one animation loop (react-ui-canvas ANIMATION.md §5.1): while the clock plays, each frame advances its
|
|
243
|
+
* time by the wall time since the last, capped at `MAX_CLOCK_STEP`. The first frame after a start advances nothing, so
|
|
244
|
+
* no step is ever negative. Reading the wall clock is this hook's alone; everything animated reads the clock's time.
|
|
245
|
+
*/
|
|
246
|
+
var useClock = (clock, { duration = 0, loop = false } = {}) => {
|
|
247
|
+
const registry = useContext(RegistryContext);
|
|
248
|
+
const playing = useAtomValue(clock.playing);
|
|
249
|
+
const boundsRef = useRef({
|
|
250
|
+
duration,
|
|
251
|
+
loop
|
|
252
|
+
});
|
|
253
|
+
boundsRef.current = {
|
|
254
|
+
duration,
|
|
255
|
+
loop
|
|
256
|
+
};
|
|
257
|
+
useEffect(() => {
|
|
258
|
+
if (!playing) return;
|
|
259
|
+
let last;
|
|
260
|
+
let frame = requestAnimationFrame(function step() {
|
|
261
|
+
const now = performance.now();
|
|
262
|
+
const seconds = last === void 0 ? 0 : Math.min(MAX_CLOCK_STEP, Math.max(0, (now - last) / 1e3));
|
|
263
|
+
last = now;
|
|
264
|
+
if (seconds > 0) {
|
|
265
|
+
const { duration, loop } = boundsRef.current;
|
|
266
|
+
const next = registry.get(clock.time) + seconds * registry.get(clock.rate);
|
|
267
|
+
if (duration > 0 && next >= duration) {
|
|
268
|
+
if (loop) registry.set(clock.time, next % duration);
|
|
269
|
+
else {
|
|
270
|
+
registry.set(clock.time, duration);
|
|
271
|
+
registry.set(clock.playing, false);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
} else registry.set(clock.time, next);
|
|
275
|
+
}
|
|
276
|
+
frame = requestAnimationFrame(step);
|
|
277
|
+
});
|
|
278
|
+
return () => cancelAnimationFrame(frame);
|
|
279
|
+
}, [
|
|
280
|
+
playing,
|
|
281
|
+
registry,
|
|
282
|
+
clock
|
|
283
|
+
]);
|
|
284
|
+
};
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/hooks/useExposedClock.ts
|
|
287
|
+
/**
|
|
288
|
+
* Publishes a clock for a frame renderer, which seeks the clock rather than faking the browser's
|
|
289
|
+
* (react-ui-canvas ANIMATION.md §7.2); `exportable` off, nothing is published.
|
|
290
|
+
*/
|
|
291
|
+
var useExposedClock = (registry, clock, span, exportable) => {
|
|
292
|
+
const spanRef = useRef(span);
|
|
293
|
+
spanRef.current = span;
|
|
294
|
+
useEffect(() => exportable ? exposeClock(registry, clock, () => ({
|
|
295
|
+
duration: spanRef.current?.duration ?? 0,
|
|
296
|
+
fps: spanRef.current?.fps ?? DEFAULT_FPS
|
|
297
|
+
})) : void 0, [
|
|
298
|
+
exportable,
|
|
299
|
+
registry,
|
|
300
|
+
clock
|
|
301
|
+
]);
|
|
302
|
+
};
|
|
303
|
+
//#endregion
|
|
304
|
+
export { TimelineBar, formatTime, jumpTarget, keyAt, useClock, useExposedClock };
|
|
305
|
+
|
|
306
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["_Fragment"],"sources":["../../src/components/TimelineBar/TimelineBar.tsx","../../src/hooks/useClock.ts","../../src/hooks/useExposedClock.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { type KeyboardEvent, type PointerEvent, useCallback, useRef, useState } from 'react';\n\nimport * as Button from '@dxos/react-ui/Button';\nimport * as Menu from '@dxos/react-ui/Menu';\nimport * as Toolbar from '@dxos/react-ui/Toolbar';\nimport type * as Util from '@dxos/react-ui/Util';\nimport { mx } from '@dxos/ui-theme';\n\nexport type TimelineBarProps = Util.ThemedClassName<{\n /** Shows its controls without letting them change the keys. */\n readonly?: boolean;\n /** Seconds. */\n time: number;\n duration: number;\n playing: boolean;\n fps: number;\n /** Times of the selection's keys, drawn as diamonds on the track. */\n keys?: readonly number[];\n autoKey?: boolean;\n onPlayingChange?: (playing: boolean) => void;\n onTimeChange?: (time: number) => void;\n onAutoKeyChange?: (autoKey: boolean) => void;\n /** Keys the selection's animatable properties at the playhead; offered while something is selected. */\n onAddKey?: () => void;\n /** Removes the selection's keys at the playhead; offered while the playhead is on one. */\n onRemoveKey?: () => void;\n /** Moves the selection's keys at `from` to `to`; offered, a diamond drags along the track. */\n onMoveKey?: (from: number, to: number) => void;\n}>;\n\n/** The timeline's controls show no focus ring: focus is visible as the playhead and keys respond to the keyboard. */\nconst NO_RING = 'focus-visible:ring-0';\n\n/** The key at time `t`, if one is within half a frame of it. */\nexport const keyAt = (keys: readonly number[], t: number, fps: number): number | undefined =>\n keys.find((key) => Math.abs(key - t) < 0.5 / fps);\n\n/** Where ⌘ with an arrow goes from `t`: the next (or previous) key, else the end (or start) when there is none that way. */\nexport const jumpTarget = (keys: readonly number[], t: number, fps: number, duration: number, back: boolean): number =>\n (back ? [...keys].reverse().find((key) => key < t - 0.5 / fps) : keys.find((key) => key > t + 0.5 / fps)) ??\n (back ? 0 : duration);\n\n/** `t` as `s.ff`, seconds and frames, as an editor's timecode reads. */\nexport const formatTime = (t: number, fps: number): string => {\n const frame = Math.round(t * fps);\n const seconds = Math.floor(frame / fps);\n return `${seconds}.${String(frame % fps).padStart(2, '0')}`;\n};\n\n/**\n * The collapsed timeline (react-ui-canvas ANIMATION.md §5.8): play and pause, a track to scrub the playhead along with the selection's\n * keys on it, the time, the key toggle and the auto-key toggle. Dragging the track scrubs; clicking a diamond moves the\n * playhead to it. On the track, the arrows step a frame (with Shift, a second), ⌘ or Ctrl with an arrow jumps to the\n * previous or next key (the start or end when there is none that way), and Delete removes the key under the playhead. On the play button, Left and Right jump to the\n * keys (or ends) with ⌘ or Ctrl and scrub otherwise, Enter keys the playhead, Delete removes the key there and Space plays and pauses.\n */\nexport const TimelineBar = ({\n classNames,\n time,\n duration,\n playing,\n fps,\n keys = [],\n autoKey,\n readonly,\n onPlayingChange,\n onTimeChange,\n onAutoKeyChange,\n onAddKey,\n onRemoveKey,\n onMoveKey,\n}: TimelineBarProps) => {\n const current = keyAt(keys, time, fps);\n // The key being dragged and where it would land; a press that never moves stays a click that seeks.\n const [dragging, setDragging] = useState<{ from: number; to: number }>();\n const trackRef = useRef<HTMLDivElement>(null);\n const timeAt = useCallback(\n (clientX: number) => {\n const track = trackRef.current?.getBoundingClientRect();\n if (!track || track.width === 0 || duration <= 0) {\n return 0;\n }\n // On the frame grid, so a scrub lands where frame stepping and export would.\n const raw = ((clientX - track.left) / track.width) * duration;\n return Math.min(duration, Math.max(0, Math.round(raw * fps) / fps));\n },\n [duration, fps],\n );\n const onPointerDown = useCallback(\n (event: PointerEvent<HTMLDivElement>) => {\n event.stopPropagation();\n event.currentTarget.setPointerCapture(event.pointerId);\n onPlayingChange?.(false);\n onTimeChange?.(timeAt(event.clientX));\n },\n [onPlayingChange, onTimeChange, timeAt],\n );\n const onPointerMove = useCallback(\n (event: PointerEvent<HTMLDivElement>) => {\n if (event.currentTarget.hasPointerCapture(event.pointerId)) {\n onTimeChange?.(timeAt(event.clientX));\n }\n },\n [onTimeChange, timeAt],\n );\n const onKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {\n event.preventDefault();\n event.stopPropagation();\n const back = event.key === 'ArrowLeft';\n if (event.metaKey || event.ctrlKey) {\n onTimeChange?.(jumpTarget(keys, time, fps, duration, back));\n return;\n }\n const step = event.shiftKey ? 1 : 1 / fps;\n onTimeChange?.(Math.min(duration, Math.max(0, time + (back ? -step : step))));\n } else if ((event.key === 'Delete' || event.key === 'Backspace') && current !== undefined && onRemoveKey) {\n event.preventDefault();\n event.stopPropagation();\n onRemoveKey();\n }\n },\n [time, duration, fps, keys, current, onTimeChange, onRemoveKey],\n );\n const at = (t: number) => `${duration > 0 ? (t / duration) * 100 : 0}%`;\n return (\n <Toolbar.Root classNames={mx('min-w-[24rem]', classNames)} data-testid='timeline'>\n <Button.Root\n variant='ghost'\n iconOnly\n classNames={NO_RING}\n icon={playing ? 'ph--pause--regular' : 'ph--play--regular'}\n label={playing ? 'Pause' : 'Play'}\n data-testid='timeline-play'\n // Focused, the button drives the playhead and keys: Left and Right scrub a frame (Shift, a second), with ⌘ or\n // Ctrl they jump to the next key, or the end when there is none; Enter keys the playhead (unless it is on a key)\n // and Delete removes the key there. Space, the button's own key, plays and pauses.\n onKeyDown={(event) => {\n if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {\n event.preventDefault();\n event.stopPropagation();\n onPlayingChange?.(false);\n const back = event.key === 'ArrowLeft';\n if (event.metaKey || event.ctrlKey) {\n onTimeChange?.(jumpTarget(keys, time, fps, duration, back));\n } else {\n const step = event.shiftKey ? 1 : 1 / fps;\n onTimeChange?.(Math.min(duration, Math.max(0, time + (back ? -step : step))));\n }\n } else if (event.key === 'Enter') {\n // Enter keys rather than presses: preventing it here keeps the button from playing.\n event.preventDefault();\n event.stopPropagation();\n if (current === undefined && onAddKey && !readonly) {\n onAddKey();\n }\n } else if ((event.key === 'Delete' || event.key === 'Backspace') && current !== undefined && onRemoveKey) {\n event.preventDefault();\n event.stopPropagation();\n onRemoveKey();\n }\n }}\n onClick={() => {\n // Played from the end, the timeline starts over.\n if (!playing && time >= duration) {\n onTimeChange?.(0);\n }\n onPlayingChange?.(!playing);\n }}\n />\n <div\n ref={trackRef}\n role='slider'\n tabIndex={0}\n aria-label='Playhead'\n aria-valuemin={0}\n aria-valuemax={duration}\n aria-valuenow={time}\n aria-valuetext={`${formatTime(time, fps)} s`}\n className='relative grow h-6 mx-2 cursor-pointer touch-none outline-none rounded-xs'\n data-testid='timeline-track'\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onKeyDown={onKeyDown}\n >\n <div className='absolute inset-x-0 top-1/2 h-0.5 -translate-y-1/2 bg-separator rounded-full' />\n <div\n className='absolute left-0 top-1/2 h-0.5 -translate-y-1/2 bg-accent-bg rounded-full'\n style={{ width: at(time) }}\n />\n {keys.map((key) => {\n const shown = dragging?.from === key ? dragging.to : key;\n return (\n <button\n key={key}\n type='button'\n aria-label={`Key at ${formatTime(key, fps)} s`}\n className={mx(\n 'absolute top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rotate-45 border border-separator',\n onMoveKey && !readonly && 'cursor-ew-resize',\n key === current || dragging?.from === key ? 'bg-amber-300 ring-1 ring-amber-300' : 'bg-amber-500',\n )}\n style={{ left: at(shown) }}\n data-testid='timeline-key'\n onPointerDown={(event) => {\n event.stopPropagation();\n onPlayingChange?.(false);\n onTimeChange?.(key);\n if (onMoveKey && !readonly) {\n event.currentTarget.setPointerCapture(event.pointerId);\n setDragging({ from: key, to: key });\n }\n }}\n onPointerMove={(event) => {\n if (dragging?.from === key) {\n const to = timeAt(event.clientX);\n setDragging({ from: key, to });\n onTimeChange?.(to);\n }\n }}\n onPointerUp={() => {\n if (dragging?.from === key && dragging.to !== key) {\n onMoveKey?.(key, dragging.to);\n }\n setDragging(undefined);\n }}\n onPointerCancel={() => setDragging(undefined)}\n />\n );\n })}\n <div\n className='absolute top-0 bottom-0 w-0.5 -translate-x-1/2 bg-accent-bg pointer-events-none'\n style={{ left: at(time) }}\n data-testid='timeline-playhead'\n />\n </div>\n <span\n className='shrink-0 text-end text-sm whitespace-nowrap tabular-nums text-fg-muted'\n data-testid='timeline-time'\n >\n {formatTime(time, fps)} / {formatTime(duration, fps)}\n </span>\n {!readonly && (\n <>\n {/* The less frequent actions, in one menu: the keyboard covers keying from the play button. */}\n <Menu.Root positioning={{ placement: 'top-end', gutter: 4 }}>\n <Menu.Trigger asChild>\n <Button.Root\n variant='ghost'\n iconOnly\n classNames={NO_RING}\n icon='ph--dots-three-vertical--regular'\n label='Timeline actions'\n data-testid='timeline-menu'\n />\n </Menu.Trigger>\n <Menu.Content>\n <Menu.Item\n item={{ value: 'add-key', label: 'Add key', shortcut: '↵' }}\n disabled={current !== undefined || !onAddKey}\n data-testid='timeline-add-key'\n onSelect={() => onAddKey?.()}\n />\n <Menu.Item\n item={{ value: 'remove-key', label: 'Delete key', shortcut: '⌫' }}\n disabled={current === undefined || !onRemoveKey}\n data-testid='timeline-remove-key'\n onSelect={() => onRemoveKey?.()}\n />\n <Menu.Separator />\n <Menu.CheckboxItem\n item={{ value: 'auto-key', label: 'Auto-key' }}\n checked={!!autoKey}\n data-testid='timeline-auto-key'\n onCheckedChange={(checked) => onAutoKeyChange?.(checked === true)}\n />\n </Menu.Content>\n </Menu.Root>\n </>\n )}\n </Toolbar.Root>\n );\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport { useAtomValue } from '@effect/atom-react/Hooks';\nimport { RegistryContext } from '@effect/atom-react/RegistryContext';\nimport { useContext, useEffect, useRef } from 'react';\n\nimport { type Clock, MAX_CLOCK_STEP } from '@dxos/animation';\n\nexport type UseClockOptions = {\n /** Seconds; playback stops (or wraps) there. Unbounded when unset or zero. */\n duration?: number;\n loop?: boolean;\n};\n\n/**\n * A clock's one animation loop (react-ui-canvas ANIMATION.md §5.1): while the clock plays, each frame advances its\n * time by the wall time since the last, capped at `MAX_CLOCK_STEP`. The first frame after a start advances nothing, so\n * no step is ever negative. Reading the wall clock is this hook's alone; everything animated reads the clock's time.\n */\nexport const useClock = (clock: Clock, { duration = 0, loop = false }: UseClockOptions = {}): void => {\n const registry = useContext(RegistryContext);\n const playing = useAtomValue(clock.playing);\n // Read per frame, so a change of length or looping does not restart the loop (a restart's first step is empty).\n const boundsRef = useRef({ duration, loop });\n boundsRef.current = { duration, loop };\n useEffect(() => {\n if (!playing) {\n return;\n }\n let last: number | undefined;\n let frame = requestAnimationFrame(function step() {\n const now = performance.now();\n const seconds = last === undefined ? 0 : Math.min(MAX_CLOCK_STEP, Math.max(0, (now - last) / 1000));\n last = now;\n if (seconds > 0) {\n const { duration, loop } = boundsRef.current;\n const next = registry.get(clock.time) + seconds * registry.get(clock.rate);\n if (duration > 0 && next >= duration) {\n if (loop) {\n registry.set(clock.time, next % duration);\n } else {\n registry.set(clock.time, duration);\n registry.set(clock.playing, false);\n return;\n }\n } else {\n registry.set(clock.time, next);\n }\n }\n frame = requestAnimationFrame(step);\n });\n return () => cancelAnimationFrame(frame);\n }, [playing, registry, clock]);\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport type * as Registry from 'effect/reactivity/AtomRegistry';\nimport { useEffect, useRef } from 'react';\n\nimport { type Clock, DEFAULT_FPS, type Timeline, exposeClock } from '@dxos/animation';\n\n/** What a frame renderer exports: the clock's length and rate. */\nexport type ExposedSpan = Pick<Timeline, 'duration' | 'fps'>;\n\n/**\n * Publishes a clock for a frame renderer, which seeks the clock rather than faking the browser's\n * (react-ui-canvas ANIMATION.md §7.2); `exportable` off, nothing is published.\n */\nexport const useExposedClock = (\n registry: Registry.AtomRegistry,\n clock: Clock,\n span: ExposedSpan | undefined,\n exportable: boolean | undefined,\n) => {\n const spanRef = useRef<ExposedSpan | undefined>(span);\n spanRef.current = span;\n useEffect(\n () =>\n exportable\n ? exposeClock(registry, clock, () => ({\n duration: spanRef.current?.duration ?? 0,\n fps: spanRef.current?.fps ?? DEFAULT_FPS,\n }))\n : undefined,\n [exportable, registry, clock],\n );\n};\n"],"mappings":";;;;;;;;;;;AAmCA,IAAM,UAAU;;AAGhB,IAAa,SAAS,MAAyB,GAAW,QACxD,KAAK,MAAM,QAAQ,KAAK,IAAI,MAAM,CAAC,IAAI,KAAM,GAAG;;AAGlD,IAAa,cAAc,MAAyB,GAAW,KAAa,UAAkB,UAC3F,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,QAAQ,MAAM,IAAI,KAAM,GAAG,IAAI,KAAK,MAAM,QAAQ,MAAM,IAAI,KAAM,GAAG,OACtG,OAAO,IAAI;;AAGd,IAAa,cAAc,GAAW,QAAwB;CAC5D,MAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;CAEhC,OAAO,GADS,KAAK,MAAM,QAAQ,GACzB,EAAQ,GAAG,OAAO,QAAQ,GAAG,CAAC,CAAC,SAAS,GAAG,GAAG;AAC1D;;;;;;;;AASA,IAAa,eAAe,EAC1B,YACA,MACA,UACA,SACA,KACA,OAAO,CAAC,GACR,SACA,UACA,iBACA,cACA,iBACA,UACA,aACA,gBACsB;CACtB,MAAM,UAAU,MAAM,MAAM,MAAM,GAAG;CAErC,MAAM,CAAC,UAAU,eAAe,SAAuC;CACvE,MAAM,WAAW,OAAuB,IAAI;CAC5C,MAAM,SAAS,aACZ,YAAoB;EACnB,MAAM,QAAQ,SAAS,SAAS,sBAAsB;EACtD,IAAI,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AAO;GACP,IAAI,UAAU,GAAG;IACf,MAAM,EAAE,UAAU,SAAS,UAAU;IACrC,MAAM,OAAO,SAAS,IAAI,MAAM,IAAI,IAAI,UAAU,SAAS,IAAI,MAAM,IAAI;IACzE,IAAI,WAAW,KAAK,QAAQ,UAAU;KACpC,IAAI,MACF,SAAS,IAAI,MAAM,MAAM,OAAO,QAAQ;UACnC;MACL,SAAS,IAAI,MAAM,MAAM,QAAQ;MACjC,SAAS,IAAI,MAAM,SAAS,KAAK;MACjC;KACF;IACF,OACE,SAAS,IAAI,MAAM,MAAM,IAAI;GAEjC;GACA,QAAQ,sBAAsB,IAAI;EACpC,CAAC;EACD,aAAa,qBAAqB,KAAK;CACzC,GAAG;EAAC;EAAS;EAAU;CAAK,CAAC;AAC/B;;;;;;;ACvCA,IAAa,mBACX,UACA,OACA,MACA,eACG;CACH,MAAM,UAAU,OAAgC,IAAI;CACpD,QAAQ,UAAU;CAClB,gBAEI,aACI,YAAY,UAAU,cAAc;EAClC,UAAU,QAAQ,SAAS,YAAY;EACvC,KAAK,QAAQ,SAAS,OAAO;CAC/B,EAAE,IACF,KAAA,GACN;EAAC;EAAY;EAAU;CAAK,CAC9B;AACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg width="100%" height="100%" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
4
|
+
<g transform="matrix(1,0,0,1,-256,0)">
|
|
5
|
+
<g id="anthropic" transform="matrix(0.882759,0,0,1.03226,3.53103,-2.06452)">
|
|
6
|
+
<rect x="286" y="2" width="290" height="248" style="fill:none;"/>
|
|
7
|
+
<g transform="matrix(2.75361,0,0,2.35481,303.993,49.4687)">
|
|
8
|
+
<path d="M66.5,0L52.4,0L78.1,65L92.2,65L66.5,0ZM25.7,0L0,65L14.4,65L19.7,51.4L46.6,51.4L51.8,65L66.2,65L40.5,0L25.7,0ZM24.3,39.3L33.1,16.5L41.9,39.3L24.3,39.3Z" style="fill:currentColor;fill-rule:nonzero;"/>
|
|
9
|
+
</g>
|
|
10
|
+
</g>
|
|
11
|
+
</g>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg width="100%" height="100%" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
4
|
+
<g transform="matrix(1,0,0,1,-600,-600)">
|
|
5
|
+
<g id="bar-high" transform="matrix(1.01587,0,0,0.920863,890.54,625.784)">
|
|
6
|
+
<rect x="-286" y="-28" width="252" height="278" style="fill:none;"/>
|
|
7
|
+
<g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
|
|
8
|
+
<path d="M80,384L80,471L41,471L41,384L80,384ZM68,396L53,396L53,459L68,459L68,396Z"/>
|
|
9
|
+
<rect x="41" y="384" width="39" height="87"/>
|
|
10
|
+
</g>
|
|
11
|
+
<g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
|
|
12
|
+
<path d="M144,336L144,472L96,472L96,336L144,336ZM132,348L108,348L108,460L132,460L132,348Z"/>
|
|
13
|
+
<rect x="96" y="336" width="48" height="136"/>
|
|
14
|
+
</g>
|
|
15
|
+
<g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
|
|
16
|
+
<path d="M216,288L216,472L160,472L160,288L216,288ZM204,300L172,300L172,460L204,460L204,300Z"/>
|
|
17
|
+
<rect x="160" y="288" width="56" height="184"/>
|
|
18
|
+
</g>
|
|
19
|
+
</g>
|
|
20
|
+
</g>
|
|
21
|
+
</svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg width="100%" height="100%" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
4
|
+
<g transform="matrix(1,0,0,1,0,-600)">
|
|
5
|
+
<g id="bar-low" transform="matrix(1.01587,0,0,0.920863,290.54,625.784)">
|
|
6
|
+
<rect x="-286" y="-28" width="252" height="278" style="fill:none;"/>
|
|
7
|
+
<g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
|
|
8
|
+
<rect x="41" y="384" width="39" height="87"/>
|
|
9
|
+
</g>
|
|
10
|
+
<g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
|
|
11
|
+
<rect x="96" y="336" width="48" height="136" style="fill-opacity:0.25;"/>
|
|
12
|
+
</g>
|
|
13
|
+
<g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
|
|
14
|
+
<rect x="160" y="288" width="56" height="184" style="fill-opacity:0.25;"/>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg width="100%" height="100%" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
4
|
+
<g transform="matrix(1,0,0,1,-300,-600)">
|
|
5
|
+
<g id="bar-medium" transform="matrix(1.01587,0,0,0.920863,590.54,625.784)">
|
|
6
|
+
<rect x="-286" y="-28" width="252" height="278" style="fill:none;"/>
|
|
7
|
+
<g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
|
|
8
|
+
<path d="M80,384L80,471L41,471L41,384L80,384ZM68,396L53,396L53,459L68,459L68,396Z"/>
|
|
9
|
+
<rect x="41" y="384" width="39" height="87"/>
|
|
10
|
+
</g>
|
|
11
|
+
<g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
|
|
12
|
+
<path d="M144,336L144,472L96,472L96,336L144,336ZM132,348L108,348L108,460L132,460L132,348Z"/>
|
|
13
|
+
<rect x="96" y="336" width="48" height="136"/>
|
|
14
|
+
</g>
|
|
15
|
+
<g transform="matrix(0.984375,0,0,1.08594,-286,-306)">
|
|
16
|
+
<rect x="160" y="288" width="56" height="184" style="fill-opacity:0.25;"/>
|
|
17
|
+
</g>
|
|
18
|
+
</g>
|
|
19
|
+
</g>
|
|
20
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg width="100%" height="100%" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;">
|
|
4
|
+
<circle cx="128" cy="128" r="96" style="fill:none;stroke:currentColor;stroke-width:16px;"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" style="fill-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;">
|
|
2
|
+
<rect x="32" y="48" width="192" height="160" rx="8" style="fill:none;stroke:currentColor;stroke-width:16px;"/>
|
|
3
|
+
<rect x="68" y="88" width="32" height="32" rx="4" style="fill:currentColor;"/>
|
|
4
|
+
<circle cx="84" cy="152" r="12" style="fill:currentColor;"/>
|
|
5
|
+
<path d="M128,104L184,104M128,152L184,152" style="fill:none;stroke:currentColor;stroke-width:16px;"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg width="100%" height="100%" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
|
4
|
+
<g id="deepseek" transform="matrix(1.01587,0,0,0.920863,290.54,25.7842)">
|
|
5
|
+
<rect x="-286" y="-28" width="252" height="278" style="fill:none;"/>
|
|
6
|
+
<g transform="matrix(9.18732,0,0,10.1352,-270.25,-8.90305)">
|
|
7
|
+
<path d="M23.748,4.482C23.494,4.358 23.384,4.595 23.236,4.716C23.185,4.755 23.142,4.806 23.099,4.852C22.727,5.249 22.293,5.509 21.726,5.478C20.897,5.432 20.189,5.692 19.563,6.326C19.43,5.544 18.988,5.078 18.316,4.778C17.964,4.622 17.608,4.467 17.361,4.128C17.189,3.887 17.142,3.618 17.056,3.354C17.001,3.194 16.946,3.031 16.763,3.004C16.563,2.973 16.485,3.14 16.407,3.28C16.094,3.852 15.973,4.482 15.985,5.12C16.012,6.556 16.618,7.7 17.823,8.513C17.96,8.606 17.995,8.7 17.952,8.836C17.87,9.116 17.772,9.388 17.686,9.669C17.631,9.848 17.549,9.886 17.357,9.809C16.708,9.53 16.119,9.13 15.621,8.629C14.764,7.801 13.99,6.887 13.024,6.171C12.8,6.006 12.57,5.849 12.335,5.7C11.35,4.743 12.465,3.957 12.723,3.864C12.993,3.766 12.816,3.432 11.944,3.436C11.072,3.44 10.274,3.731 9.257,4.12C9.106,4.178 8.95,4.224 8.792,4.257C7.842,4.078 6.87,4.044 5.909,4.155C4.024,4.365 2.519,5.257 1.412,6.778C0.082,8.606 -0.231,10.684 0.152,12.85C0.555,15.134 1.721,17.025 3.512,18.503C5.37,20.036 7.509,20.787 9.95,20.643C11.432,20.558 13.083,20.359 14.944,18.783C15.414,19.017 15.906,19.11 16.724,19.18C17.354,19.239 17.96,19.15 18.429,19.052C19.164,18.896 19.113,18.215 18.848,18.091C16.693,17.087 17.166,17.496 16.735,17.165C17.831,15.869 19.481,14.523 20.127,10.162C20.177,9.815 20.134,9.597 20.127,9.317C20.123,9.147 20.162,9.08 20.357,9.061C20.898,9.005 21.423,8.844 21.902,8.586C23.298,7.823 23.862,6.571 23.995,5.069C24.015,4.839 23.991,4.602 23.748,4.481L23.748,4.482ZM11.581,18C9.492,16.358 8.479,15.817 8.061,15.84C7.669,15.864 7.74,16.311 7.826,16.603C7.916,16.891 8.033,17.089 8.197,17.342C8.311,17.509 8.389,17.758 8.084,17.945C7.411,18.361 6.242,17.805 6.187,17.778C4.826,16.976 3.687,15.918 2.886,14.471C2.112,13.078 1.662,11.584 1.588,9.989C1.568,9.603 1.681,9.467 2.065,9.397C2.569,9.301 3.086,9.287 3.594,9.358C5.726,9.67 7.54,10.623 9.062,12.132C9.93,12.992 10.587,14.019 11.264,15.023C11.984,16.089 12.758,17.105 13.744,17.937C14.092,18.229 14.369,18.451 14.635,18.614C13.833,18.704 12.495,18.724 11.581,18ZM12.581,11.56C12.581,11.56 12.581,11.559 12.581,11.559C12.581,11.391 12.719,11.253 12.887,11.253C12.924,11.253 12.961,11.26 12.996,11.273C13.117,11.316 13.198,11.432 13.196,11.561C13.196,11.561 13.196,11.562 13.196,11.562C13.196,11.73 13.058,11.868 12.89,11.868C12.889,11.868 12.885,11.868 12.885,11.868C12.719,11.868 12.582,11.731 12.582,11.565C12.582,11.563 12.582,11.562 12.582,11.56L12.581,11.56ZM15.691,13.156C15.491,13.237 15.292,13.307 15.101,13.316C14.814,13.326 14.532,13.236 14.303,13.062C14.029,12.832 13.833,12.704 13.751,12.304C13.723,12.109 13.728,11.91 13.767,11.716C13.837,11.389 13.759,11.179 13.528,10.989C13.341,10.833 13.102,10.79 12.84,10.79C12.75,10.785 12.663,10.758 12.586,10.712C12.476,10.658 12.386,10.522 12.472,10.354C12.5,10.3 12.632,10.168 12.664,10.144C13.02,9.942 13.431,10.008 13.81,10.16C14.162,10.304 14.428,10.568 14.811,10.942C15.202,11.393 15.273,11.518 15.496,11.856C15.672,12.121 15.832,12.393 15.941,12.704C16.008,12.899 15.922,13.058 15.691,13.156Z"/>
|
|
8
|
+
</g>
|
|
9
|
+
</g>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type * as Util from '@dxos/react-ui/Util';
|
|
3
|
+
export type TimelineBarProps = Util.ThemedClassName<{
|
|
4
|
+
/** Shows its controls without letting them change the keys. */
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
/** Seconds. */
|
|
7
|
+
time: number;
|
|
8
|
+
duration: number;
|
|
9
|
+
playing: boolean;
|
|
10
|
+
fps: number;
|
|
11
|
+
/** Times of the selection's keys, drawn as diamonds on the track. */
|
|
12
|
+
keys?: readonly number[];
|
|
13
|
+
autoKey?: boolean;
|
|
14
|
+
onPlayingChange?: (playing: boolean) => void;
|
|
15
|
+
onTimeChange?: (time: number) => void;
|
|
16
|
+
onAutoKeyChange?: (autoKey: boolean) => void;
|
|
17
|
+
/** Keys the selection's animatable properties at the playhead; offered while something is selected. */
|
|
18
|
+
onAddKey?: () => void;
|
|
19
|
+
/** Removes the selection's keys at the playhead; offered while the playhead is on one. */
|
|
20
|
+
onRemoveKey?: () => void;
|
|
21
|
+
/** Moves the selection's keys at `from` to `to`; offered, a diamond drags along the track. */
|
|
22
|
+
onMoveKey?: (from: number, to: number) => void;
|
|
23
|
+
}>;
|
|
24
|
+
/** The key at time `t`, if one is within half a frame of it. */
|
|
25
|
+
export declare const keyAt: (keys: readonly number[], t: number, fps: number) => number | undefined;
|
|
26
|
+
/** Where ⌘ with an arrow goes from `t`: the next (or previous) key, else the end (or start) when there is none that way. */
|
|
27
|
+
export declare const jumpTarget: (keys: readonly number[], t: number, fps: number, duration: number, back: boolean) => number;
|
|
28
|
+
/** `t` as `s.ff`, seconds and frames, as an editor's timecode reads. */
|
|
29
|
+
export declare const formatTime: (t: number, fps: number) => string;
|
|
30
|
+
/**
|
|
31
|
+
* The collapsed timeline (react-ui-canvas ANIMATION.md §5.8): play and pause, a track to scrub the playhead along with the selection's
|
|
32
|
+
* keys on it, the time, the key toggle and the auto-key toggle. Dragging the track scrubs; clicking a diamond moves the
|
|
33
|
+
* playhead to it. On the track, the arrows step a frame (with Shift, a second), ⌘ or Ctrl with an arrow jumps to the
|
|
34
|
+
* previous or next key (the start or end when there is none that way), and Delete removes the key under the playhead. On the play button, Left and Right jump to the
|
|
35
|
+
* keys (or ends) with ⌘ or Ctrl and scrub otherwise, Enter keys the playhead, Delete removes the key there and Space plays and pauses.
|
|
36
|
+
*/
|
|
37
|
+
export declare const TimelineBar: ({ classNames, time, duration, playing, fps, keys, autoKey, readonly, onPlayingChange, onTimeChange, onAutoKeyChange, onAddKey, onRemoveKey, onMoveKey, }: TimelineBarProps) => React.JSX.Element;
|
|
38
|
+
//# sourceMappingURL=TimelineBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimelineBar.d.ts","sourceRoot":"","sources":["../../../../../src/components/TimelineBar/TimelineBar.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA+E,MAAM,OAAO,CAAC;AAKpG,OAAO,KAAK,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAGjD,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,eAAe,CAAC;IAClD,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,0FAA0F;IAC1F,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,8FAA8F;IAC9F,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD,CAAC,CAAC;AAKH,gEAAgE;AAChE,eAAO,MAAM,KAAK,SAAU,SAAS,MAAM,EAAE,KAAK,MAAM,OAAO,MAAM,KAAG,MAAM,GAAG,SAC9B,CAAC;AAEpD,4HAA4H;AAC5H,eAAO,MAAM,UAAU,SAAU,SAAS,MAAM,EAAE,KAAK,MAAM,OAAO,MAAM,YAAY,MAAM,QAAQ,OAAO,KAAG,MAEvF,CAAC;AAExB,wEAAwE;AACxE,eAAO,MAAM,UAAU,MAAO,MAAM,OAAO,MAAM,KAAG,MAInD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,6JAerB,gBAAgB,sBAoNlB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
2
|
+
type StoryArgs = {
|
|
3
|
+
duration: number;
|
|
4
|
+
fps: number;
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const meta: Meta<StoryArgs>;
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof meta>;
|
|
10
|
+
/**
|
|
11
|
+
* Test:
|
|
12
|
+
* 1. The bar shows the time against the duration and a diamond per key.
|
|
13
|
+
* 2. Pressing the middle of the track moves the playhead there, on the frame grid.
|
|
14
|
+
* 3. Add key puts a diamond at the playhead; on a key the same button removes it.
|
|
15
|
+
* 4. ⌘← and ⌘→ jump between keys; Delete removes the key under the playhead.
|
|
16
|
+
* 5. Play advances the clock; pressing it again pauses.
|
|
17
|
+
*/
|
|
18
|
+
export declare const Default: Story;
|
|
19
|
+
/** The default story, driven: its steps run as a play test. */
|
|
20
|
+
export declare const Test: Story;
|
|
21
|
+
/** Read-only: play and scrub stay, the key and auto-key menu goes. */
|
|
22
|
+
export declare const Readonly: Story;
|
|
23
|
+
//# sourceMappingURL=TimelineBar.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimelineBar.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/TimelineBar/TimelineBar.stories.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAWjE,KAAK,SAAS,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAkCvE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,SAAS,CAUzB,CAAC;eAEa,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,+DAA+D;AAC/D,eAAO,MAAM,IAAI,EAAE,KA+GlB,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,QAAQ,EAAE,KAOtB,CAAC"}
|