@editframe/create 0.44.0 → 0.45.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.js +16 -28
- package/dist/index.js.map +1 -1
- package/dist/skills/editframe-brand-video-generator/README.md +155 -0
- package/dist/skills/editframe-brand-video-generator/SKILL.md +207 -0
- package/dist/skills/editframe-brand-video-generator/references/brand-examples.md +178 -0
- package/dist/skills/editframe-brand-video-generator/references/color-psychology.md +227 -0
- package/dist/skills/editframe-brand-video-generator/references/composition-patterns.md +383 -0
- package/dist/skills/editframe-brand-video-generator/references/editing.md +66 -0
- package/dist/skills/editframe-brand-video-generator/references/emotional-arcs.md +496 -0
- package/dist/skills/editframe-brand-video-generator/references/genre-selection.md +135 -0
- package/dist/skills/editframe-brand-video-generator/references/transition-styles.md +611 -0
- package/dist/skills/editframe-brand-video-generator/references/typography-personalities.md +326 -0
- package/dist/skills/editframe-brand-video-generator/references/video-archetypes.md +86 -0
- package/dist/skills/editframe-brand-video-generator/references/video-fundamentals.md +169 -0
- package/dist/skills/editframe-brand-video-generator/references/visual-metaphors.md +50 -0
- package/dist/skills/editframe-composition/SKILL.md +169 -0
- package/dist/skills/editframe-composition/references/audio.md +483 -0
- package/dist/skills/editframe-composition/references/captions.md +844 -0
- package/dist/skills/editframe-composition/references/composition-model.md +73 -0
- package/dist/skills/editframe-composition/references/configuration.md +403 -0
- package/dist/skills/editframe-composition/references/css-parts.md +105 -0
- package/dist/skills/editframe-composition/references/css-variables.md +640 -0
- package/dist/skills/editframe-composition/references/entry-points.md +810 -0
- package/dist/skills/editframe-composition/references/events.md +499 -0
- package/dist/skills/editframe-composition/references/getting-started.md +259 -0
- package/dist/skills/editframe-composition/references/hooks.md +234 -0
- package/dist/skills/editframe-composition/references/image.md +241 -0
- package/dist/skills/editframe-composition/references/r3f.md +580 -0
- package/dist/skills/editframe-composition/references/render-api.md +484 -0
- package/dist/skills/editframe-composition/references/render-strategies.md +119 -0
- package/dist/skills/editframe-composition/references/render-to-video.md +1101 -0
- package/dist/skills/editframe-composition/references/scripting.md +606 -0
- package/dist/skills/editframe-composition/references/sequencing.md +116 -0
- package/dist/skills/editframe-composition/references/server-rendering.md +753 -0
- package/dist/skills/editframe-composition/references/surface.md +329 -0
- package/dist/skills/editframe-composition/references/text.md +627 -0
- package/dist/skills/editframe-composition/references/time-model.md +99 -0
- package/dist/skills/editframe-composition/references/timegroup-modes.md +102 -0
- package/dist/skills/editframe-composition/references/timegroup.md +457 -0
- package/dist/skills/editframe-composition/references/timeline-root.md +398 -0
- package/dist/skills/editframe-composition/references/transcription.md +47 -0
- package/dist/skills/editframe-composition/references/transitions.md +608 -0
- package/dist/skills/editframe-composition/references/use-media-info.md +357 -0
- package/dist/skills/editframe-composition/references/video.md +506 -0
- package/dist/skills/editframe-composition/references/waveform.md +327 -0
- package/dist/skills/editframe-editor-gui/SKILL.md +152 -0
- package/dist/skills/editframe-editor-gui/references/active-root-temporal.md +657 -0
- package/dist/skills/editframe-editor-gui/references/canvas.md +947 -0
- package/dist/skills/editframe-editor-gui/references/controls.md +366 -0
- package/dist/skills/editframe-editor-gui/references/dial.md +756 -0
- package/dist/skills/editframe-editor-gui/references/editor-toolkit.md +587 -0
- package/dist/skills/editframe-editor-gui/references/filmstrip.md +460 -0
- package/dist/skills/editframe-editor-gui/references/fit-scale.md +772 -0
- package/dist/skills/editframe-editor-gui/references/focus-overlay.md +561 -0
- package/dist/skills/editframe-editor-gui/references/hierarchy.md +544 -0
- package/dist/skills/editframe-editor-gui/references/overlay-item.md +634 -0
- package/dist/skills/editframe-editor-gui/references/overlay-layer.md +429 -0
- package/dist/skills/editframe-editor-gui/references/pan-zoom.md +568 -0
- package/dist/skills/editframe-editor-gui/references/pause.md +397 -0
- package/dist/skills/editframe-editor-gui/references/play.md +370 -0
- package/dist/skills/editframe-editor-gui/references/preview.md +391 -0
- package/dist/skills/editframe-editor-gui/references/resizable-box.md +749 -0
- package/dist/skills/editframe-editor-gui/references/scrubber.md +588 -0
- package/dist/skills/editframe-editor-gui/references/thumbnail-strip.md +566 -0
- package/dist/skills/editframe-editor-gui/references/time-display.md +492 -0
- package/dist/skills/editframe-editor-gui/references/timeline-ruler.md +489 -0
- package/dist/skills/editframe-editor-gui/references/timeline.md +604 -0
- package/dist/skills/editframe-editor-gui/references/toggle-loop.md +618 -0
- package/dist/skills/editframe-editor-gui/references/toggle-play.md +526 -0
- package/dist/skills/editframe-editor-gui/references/transform-handles.md +924 -0
- package/dist/skills/editframe-editor-gui/references/trim-handles.md +725 -0
- package/dist/skills/editframe-editor-gui/references/workbench.md +453 -0
- package/dist/skills/editframe-motion-design/SKILL.md +101 -0
- package/dist/skills/editframe-motion-design/references/0-editframe.md +299 -0
- package/dist/skills/editframe-motion-design/references/1-intent.md +201 -0
- package/dist/skills/editframe-motion-design/references/2-physics-model.md +405 -0
- package/dist/skills/editframe-motion-design/references/3-attention.md +350 -0
- package/dist/skills/editframe-motion-design/references/4-process.md +418 -0
- package/dist/skills/editframe-vite-plugin/SKILL.md +75 -0
- package/dist/skills/editframe-vite-plugin/references/file-api.md +111 -0
- package/dist/skills/editframe-vite-plugin/references/getting-started.md +96 -0
- package/dist/skills/editframe-vite-plugin/references/jit-transcoding.md +91 -0
- package/dist/skills/editframe-vite-plugin/references/local-assets.md +75 -0
- package/dist/skills/editframe-vite-plugin/references/visual-testing.md +136 -0
- package/dist/skills/editframe-webhooks/SKILL.md +126 -0
- package/dist/skills/editframe-webhooks/references/events.md +382 -0
- package/dist/skills/editframe-webhooks/references/getting-started.md +232 -0
- package/dist/skills/editframe-webhooks/references/security.md +418 -0
- package/dist/skills/editframe-webhooks/references/testing.md +409 -0
- package/dist/skills/editframe-webhooks/references/troubleshooting.md +457 -0
- package/dist/templates/html/AGENTS.md +13 -0
- package/dist/templates/react/AGENTS.md +13 -0
- package/dist/utils.js +15 -16
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/tsdown.config.ts +4 -0
- package/dist/detectAgent.js +0 -89
- package/dist/detectAgent.js.map +0 -1
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Time Display Element
|
|
3
|
+
description: Formatted time display showing current playback position and total duration, with configurable frame rate and format options.
|
|
4
|
+
type: reference
|
|
5
|
+
nav:
|
|
6
|
+
parent: "Timeline"
|
|
7
|
+
priority: 13
|
|
8
|
+
api:
|
|
9
|
+
attributes:
|
|
10
|
+
- name: target
|
|
11
|
+
type: string
|
|
12
|
+
description: ID of target temporal element to display time from
|
|
13
|
+
- name: current-time-ms
|
|
14
|
+
type: number
|
|
15
|
+
description: Current time in milliseconds (overrides context)
|
|
16
|
+
- name: duration-ms
|
|
17
|
+
type: number
|
|
18
|
+
description: Total duration in milliseconds (overrides context)
|
|
19
|
+
parts:
|
|
20
|
+
- name: time
|
|
21
|
+
description: Time text span for styling
|
|
22
|
+
react:
|
|
23
|
+
generate: true
|
|
24
|
+
componentName: TimeDisplay
|
|
25
|
+
importPath: "@editframe/react"
|
|
26
|
+
propMapping:
|
|
27
|
+
current-time-ms: currentTimeMs
|
|
28
|
+
duration-ms: durationMs
|
|
29
|
+
additionalProps:
|
|
30
|
+
- name: className
|
|
31
|
+
type: string
|
|
32
|
+
description: CSS classes for styling
|
|
33
|
+
nav:
|
|
34
|
+
parent: "Components / Timeline Controls"
|
|
35
|
+
priority: 61
|
|
36
|
+
related: ["scrubber", "controls"]
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
<!-- html-only -->
|
|
40
|
+
# ef-time-display
|
|
41
|
+
<!-- /html-only -->
|
|
42
|
+
<!-- react-only -->
|
|
43
|
+
# TimeDisplay
|
|
44
|
+
<!-- /react-only -->
|
|
45
|
+
|
|
46
|
+
Formatted time display showing current playback time and total duration in "M:SS / M:SS" format.
|
|
47
|
+
|
|
48
|
+
<!-- react-only -->
|
|
49
|
+
## Import
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { TimeDisplay } from "@editframe/react";
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Also available: `TimeDisplayProps` type for TypeScript.
|
|
56
|
+
<!-- /react-only -->
|
|
57
|
+
|
|
58
|
+
## Basic Usage
|
|
59
|
+
|
|
60
|
+
<!-- html-only -->
|
|
61
|
+
Display time from a target element.
|
|
62
|
+
|
|
63
|
+
```html live
|
|
64
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black" id="time-demo">
|
|
65
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" class="size-full object-contain"></ef-video>
|
|
66
|
+
</ef-timegroup>
|
|
67
|
+
<div class="flex gap-4 items-center p-4 bg-gray-900 rounded-lg mt-4">
|
|
68
|
+
<ef-controls target="time-demo">
|
|
69
|
+
<ef-toggle-play class="px-3 py-1 bg-blue-600 text-white rounded"></ef-toggle-play>
|
|
70
|
+
</ef-controls>
|
|
71
|
+
<ef-time-display target="time-demo" class="text-white text-lg font-mono"></ef-time-display>
|
|
72
|
+
</div>
|
|
73
|
+
```
|
|
74
|
+
<!-- /html-only -->
|
|
75
|
+
<!-- react-only -->
|
|
76
|
+
```tsx
|
|
77
|
+
import { Preview, TimeDisplay } from "@editframe/react";
|
|
78
|
+
|
|
79
|
+
<div className="flex flex-col gap-2">
|
|
80
|
+
<Preview className="w-full h-[600px]" />
|
|
81
|
+
<TimeDisplay className="text-white text-sm font-mono" />
|
|
82
|
+
</div>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The time display automatically connects to the nearest timeline context via Preview or Controls.
|
|
86
|
+
<!-- /react-only -->
|
|
87
|
+
|
|
88
|
+
<!-- html-only -->
|
|
89
|
+
## Within Controls Context
|
|
90
|
+
|
|
91
|
+
Time display automatically reads from parent `ef-controls` context.
|
|
92
|
+
|
|
93
|
+
```html live
|
|
94
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black" id="context-demo">
|
|
95
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" class="size-full object-contain"></ef-video>
|
|
96
|
+
</ef-timegroup>
|
|
97
|
+
<ef-controls target="context-demo" class="flex gap-4 items-center p-4 bg-gray-900 rounded-lg mt-4">
|
|
98
|
+
<ef-toggle-play class="px-3 py-1 bg-blue-600 text-white rounded"></ef-toggle-play>
|
|
99
|
+
<ef-time-display class="text-white text-lg font-mono"></ef-time-display>
|
|
100
|
+
<ef-scrubber class="flex-1"></ef-scrubber>
|
|
101
|
+
</ef-controls>
|
|
102
|
+
```
|
|
103
|
+
<!-- /html-only -->
|
|
104
|
+
|
|
105
|
+
## Display Format
|
|
106
|
+
|
|
107
|
+
TimeDisplay shows time in `M:SS / M:SS` format:
|
|
108
|
+
- Minutes without leading zero
|
|
109
|
+
- Seconds with leading zero
|
|
110
|
+
- Current time followed by duration
|
|
111
|
+
|
|
112
|
+
Examples:
|
|
113
|
+
- `0:00 / 0:10` — 0 seconds of 10 seconds
|
|
114
|
+
- `1:05 / 2:30` — 1 minute 5 seconds of 2 minutes 30 seconds
|
|
115
|
+
- `12:00 / 15:45` — 12 minutes of 15 minutes 45 seconds
|
|
116
|
+
|
|
117
|
+
<!-- react-only -->
|
|
118
|
+
## In Control Bar
|
|
119
|
+
|
|
120
|
+
Typical control bar layout:
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
import { TogglePlay, Scrubber, TimeDisplay } from "@editframe/react";
|
|
124
|
+
|
|
125
|
+
export const ControlBar = () => {
|
|
126
|
+
return (
|
|
127
|
+
<div className="bg-gray-800 p-4 flex items-center gap-4">
|
|
128
|
+
<TogglePlay>
|
|
129
|
+
<button slot="play" className="w-10 h-10 text-white">▶</button>
|
|
130
|
+
<button slot="pause" className="w-10 h-10 text-white">⏸</button>
|
|
131
|
+
</TogglePlay>
|
|
132
|
+
|
|
133
|
+
<TimeDisplay className="text-white text-sm font-mono" />
|
|
134
|
+
<Scrubber className="flex-1 h-2" />
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
```
|
|
139
|
+
<!-- /react-only -->
|
|
140
|
+
|
|
141
|
+
## Custom Styling
|
|
142
|
+
|
|
143
|
+
<!-- html-only -->
|
|
144
|
+
Style the time display using standard CSS or the `time` part.
|
|
145
|
+
|
|
146
|
+
```html live
|
|
147
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black" id="styled-time">
|
|
148
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" class="size-full object-contain"></ef-video>
|
|
149
|
+
</ef-timegroup>
|
|
150
|
+
<ef-controls target="styled-time" class="flex gap-4 items-center p-4 bg-gray-900 rounded-lg mt-4">
|
|
151
|
+
<ef-toggle-play class="px-3 py-1 bg-blue-600 text-white rounded"></ef-toggle-play>
|
|
152
|
+
<ef-time-display id="styled-display" class="px-4 py-2 bg-gray-800 rounded-lg"></ef-time-display>
|
|
153
|
+
</ef-controls>
|
|
154
|
+
|
|
155
|
+
<style>
|
|
156
|
+
#styled-display::part(time) {
|
|
157
|
+
font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
|
|
158
|
+
font-size: 16px;
|
|
159
|
+
font-weight: 600;
|
|
160
|
+
color: #60a5fa;
|
|
161
|
+
letter-spacing: 1px;
|
|
162
|
+
}
|
|
163
|
+
</style>
|
|
164
|
+
```
|
|
165
|
+
<!-- /html-only -->
|
|
166
|
+
<!-- react-only -->
|
|
167
|
+
Style the time display:
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
<TimeDisplay className="text-white text-sm font-mono bg-black/30 px-2 py-1 rounded" />
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## With Custom Colors
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
<TimeDisplay className="text-blue-400 text-lg font-mono font-semibold" />
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Compact Display
|
|
180
|
+
|
|
181
|
+
Minimal time display:
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
<TimeDisplay className="text-xs text-gray-400 font-mono" />
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Large Display
|
|
188
|
+
|
|
189
|
+
Prominent time display:
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
<TimeDisplay className="text-2xl font-mono text-white font-bold tracking-wide" />
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## With Background
|
|
196
|
+
|
|
197
|
+
Add background for better readability:
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
<TimeDisplay className="text-white text-sm font-mono bg-gray-900 px-3 py-1.5 rounded-lg shadow-lg" />
|
|
201
|
+
```
|
|
202
|
+
<!-- /react-only -->
|
|
203
|
+
|
|
204
|
+
<!-- html-only -->
|
|
205
|
+
## With Timeline Controls
|
|
206
|
+
|
|
207
|
+
Time display works seamlessly with other timeline controls.
|
|
208
|
+
|
|
209
|
+
```html live
|
|
210
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black" id="full-controls">
|
|
211
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" class="size-full object-contain"></ef-video>
|
|
212
|
+
</ef-timegroup>
|
|
213
|
+
<ef-controls target="full-controls" class="flex flex-col gap-3 p-4 bg-gray-900 rounded-lg mt-4">
|
|
214
|
+
<div class="flex gap-3 items-center">
|
|
215
|
+
<ef-toggle-play class="px-3 py-1 bg-blue-600 text-white rounded"></ef-toggle-play>
|
|
216
|
+
<ef-toggle-loop class="px-3 py-1 bg-gray-700 text-white rounded"></ef-toggle-loop>
|
|
217
|
+
<ef-time-display class="text-white font-mono ml-auto"></ef-time-display>
|
|
218
|
+
</div>
|
|
219
|
+
<ef-scrubber></ef-scrubber>
|
|
220
|
+
</ef-controls>
|
|
221
|
+
```
|
|
222
|
+
<!-- /html-only -->
|
|
223
|
+
|
|
224
|
+
## Standalone Usage
|
|
225
|
+
|
|
226
|
+
<!-- html-only -->
|
|
227
|
+
Provide explicit time values without a target.
|
|
228
|
+
|
|
229
|
+
```html
|
|
230
|
+
<ef-time-display
|
|
231
|
+
current-time-ms="45000"
|
|
232
|
+
duration-ms="180000"
|
|
233
|
+
class="text-white font-mono"
|
|
234
|
+
></ef-time-display>
|
|
235
|
+
<!-- Displays: 0:45 / 3:00 -->
|
|
236
|
+
```
|
|
237
|
+
<!-- /html-only -->
|
|
238
|
+
<!-- react-only -->
|
|
239
|
+
Override context with manual time values:
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
<TimeDisplay
|
|
243
|
+
currentTimeMs={5000}
|
|
244
|
+
durationMs={30000}
|
|
245
|
+
className="text-white text-sm font-mono"
|
|
246
|
+
/>
|
|
247
|
+
// Displays: "0:05 / 0:30"
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
This is useful for displaying time outside of a timeline context.
|
|
251
|
+
<!-- /react-only -->
|
|
252
|
+
|
|
253
|
+
<!-- html-only -->
|
|
254
|
+
## CSS Custom Properties
|
|
255
|
+
|
|
256
|
+
Control appearance through CSS variables:
|
|
257
|
+
|
|
258
|
+
```css
|
|
259
|
+
ef-time-display {
|
|
260
|
+
--ef-font-family: system-ui;
|
|
261
|
+
--ef-font-size-xs: 0.75rem;
|
|
262
|
+
--ef-text-color: white;
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
<!-- /html-only -->
|
|
266
|
+
|
|
267
|
+
<!-- react-only -->
|
|
268
|
+
## In Corner Overlay
|
|
269
|
+
|
|
270
|
+
Position time display over video:
|
|
271
|
+
|
|
272
|
+
```tsx
|
|
273
|
+
import { Timegroup, Video, TimeDisplay } from "@editframe/react";
|
|
274
|
+
|
|
275
|
+
<Timegroup mode="contain" className="w-[720px] h-[480px] bg-black relative">
|
|
276
|
+
<Video src="/assets/video.mp4" className="size-full object-contain" />
|
|
277
|
+
|
|
278
|
+
<TimeDisplay className="absolute top-4 right-4 text-white text-sm font-mono bg-black/50 backdrop-blur px-3 py-1 rounded" />
|
|
279
|
+
</Timegroup>
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Centered Below Video
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
import { Timegroup, Video, TimeDisplay } from "@editframe/react";
|
|
286
|
+
|
|
287
|
+
<div className="flex flex-col items-center gap-2">
|
|
288
|
+
<Timegroup mode="contain" className="w-[720px] h-[480px] bg-black">
|
|
289
|
+
<Video src="/assets/video.mp4" className="size-full object-contain" />
|
|
290
|
+
</Timegroup>
|
|
291
|
+
|
|
292
|
+
<TimeDisplay className="text-gray-300 text-base font-mono" />
|
|
293
|
+
</div>
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Full Editor Example
|
|
297
|
+
|
|
298
|
+
Complete video editor with time display:
|
|
299
|
+
|
|
300
|
+
```tsx
|
|
301
|
+
import {
|
|
302
|
+
Preview,
|
|
303
|
+
TogglePlay,
|
|
304
|
+
ToggleLoop,
|
|
305
|
+
Scrubber,
|
|
306
|
+
TimeDisplay,
|
|
307
|
+
} from "@editframe/react";
|
|
308
|
+
|
|
309
|
+
export const VideoEditor = () => {
|
|
310
|
+
return (
|
|
311
|
+
<div className="h-screen flex flex-col bg-gray-900">
|
|
312
|
+
<div className="flex-1 flex items-center justify-center p-8">
|
|
313
|
+
<Preview className="w-full max-w-[1280px] aspect-video bg-black rounded-lg" />
|
|
314
|
+
</div>
|
|
315
|
+
|
|
316
|
+
<div className="bg-gray-800 border-t border-gray-700 p-4">
|
|
317
|
+
<div className="flex items-center gap-4">
|
|
318
|
+
<TogglePlay>
|
|
319
|
+
<button slot="play" className="w-8 h-8 text-white hover:text-blue-400">
|
|
320
|
+
▶
|
|
321
|
+
</button>
|
|
322
|
+
<button slot="pause" className="w-8 h-8 text-white hover:text-gray-400">
|
|
323
|
+
⏸
|
|
324
|
+
</button>
|
|
325
|
+
</TogglePlay>
|
|
326
|
+
|
|
327
|
+
<TimeDisplay className="text-white text-sm font-mono min-w-[120px]" />
|
|
328
|
+
|
|
329
|
+
<div className="flex-1">
|
|
330
|
+
<Scrubber className="w-full h-2" />
|
|
331
|
+
</div>
|
|
332
|
+
|
|
333
|
+
<ToggleLoop>
|
|
334
|
+
<button slot="off" className="w-8 h-8 text-gray-400 hover:text-white">
|
|
335
|
+
🔁
|
|
336
|
+
</button>
|
|
337
|
+
<button slot="on" className="w-8 h-8 text-green-400 hover:text-green-300">
|
|
338
|
+
🔁
|
|
339
|
+
</button>
|
|
340
|
+
</ToggleLoop>
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
</div>
|
|
344
|
+
);
|
|
345
|
+
};
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## Minimal Controls
|
|
349
|
+
|
|
350
|
+
Compact control layout:
|
|
351
|
+
|
|
352
|
+
```tsx
|
|
353
|
+
<div className="flex items-center gap-2 p-2 bg-black/80 rounded">
|
|
354
|
+
<TogglePlay className="w-6 h-6 text-white">
|
|
355
|
+
<button slot="play">▶</button>
|
|
356
|
+
<button slot="pause">⏸</button>
|
|
357
|
+
</TogglePlay>
|
|
358
|
+
<TimeDisplay className="text-white text-xs font-mono" />
|
|
359
|
+
<Scrubber className="flex-1 h-1" />
|
|
360
|
+
</div>
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
## With Custom Font
|
|
364
|
+
|
|
365
|
+
Use a custom monospace font:
|
|
366
|
+
|
|
367
|
+
```tsx
|
|
368
|
+
<TimeDisplay
|
|
369
|
+
className="text-white text-sm"
|
|
370
|
+
style={{ fontFamily: 'Monaco, "Courier New", monospace' }}
|
|
371
|
+
/>
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
## Gradient Text
|
|
375
|
+
|
|
376
|
+
Styled with gradient:
|
|
377
|
+
|
|
378
|
+
```tsx
|
|
379
|
+
<TimeDisplay className="text-lg font-mono font-bold bg-gradient-to-r from-blue-400 to-purple-500 bg-clip-text text-transparent" />
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Side by Side Layout
|
|
383
|
+
|
|
384
|
+
Display controls horizontally:
|
|
385
|
+
|
|
386
|
+
```tsx
|
|
387
|
+
<div className="flex items-center gap-4 bg-gray-800 p-3 rounded-lg">
|
|
388
|
+
<TogglePlay className="shrink-0">
|
|
389
|
+
<button slot="play" className="w-8 h-8 text-white">▶</button>
|
|
390
|
+
<button slot="pause" className="w-8 h-8 text-white">⏸</button>
|
|
391
|
+
</TogglePlay>
|
|
392
|
+
|
|
393
|
+
<TimeDisplay className="shrink-0 text-white text-sm font-mono" />
|
|
394
|
+
|
|
395
|
+
<Scrubber className="flex-1 h-2" />
|
|
396
|
+
</div>
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
## Stacked Layout
|
|
400
|
+
|
|
401
|
+
Display controls vertically:
|
|
402
|
+
|
|
403
|
+
```tsx
|
|
404
|
+
<div className="flex flex-col gap-2 p-4 bg-gray-800 rounded-lg">
|
|
405
|
+
<div className="flex items-center justify-between">
|
|
406
|
+
<TogglePlay>
|
|
407
|
+
<button slot="play" className="w-10 h-10 text-white">▶</button>
|
|
408
|
+
<button slot="pause" className="w-10 h-10 text-white">⏸</button>
|
|
409
|
+
</TogglePlay>
|
|
410
|
+
|
|
411
|
+
<TimeDisplay className="text-white text-sm font-mono" />
|
|
412
|
+
</div>
|
|
413
|
+
|
|
414
|
+
<Scrubber className="w-full h-2" />
|
|
415
|
+
</div>
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
## With Preview Component
|
|
419
|
+
|
|
420
|
+
Use inside Preview wrapper:
|
|
421
|
+
|
|
422
|
+
```tsx
|
|
423
|
+
import { Preview, TimeDisplay } from "@editframe/react";
|
|
424
|
+
|
|
425
|
+
<div className="relative">
|
|
426
|
+
<Preview className="w-full h-[600px]" />
|
|
427
|
+
|
|
428
|
+
<div className="absolute bottom-4 left-4 right-4">
|
|
429
|
+
<TimeDisplay className="text-white text-base font-mono bg-black/60 backdrop-blur px-4 py-2 rounded-lg text-center" />
|
|
430
|
+
</div>
|
|
431
|
+
</div>
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
The Preview component provides context that TimeDisplay automatically consumes.
|
|
435
|
+
|
|
436
|
+
## CSS Shadow Parts
|
|
437
|
+
|
|
438
|
+
Style the internal time element using `::part()`:
|
|
439
|
+
|
|
440
|
+
```tsx
|
|
441
|
+
<TimeDisplay
|
|
442
|
+
className={`
|
|
443
|
+
font-mono
|
|
444
|
+
[&::part(time)]:text-blue-400
|
|
445
|
+
[&::part(time)]:font-bold
|
|
446
|
+
`}
|
|
447
|
+
/>
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
### Available Part
|
|
451
|
+
|
|
452
|
+
| Part | Description |
|
|
453
|
+
|------|-------------|
|
|
454
|
+
| `time` | The time text element |
|
|
455
|
+
|
|
456
|
+
## TypeScript Types
|
|
457
|
+
|
|
458
|
+
```tsx
|
|
459
|
+
import type { TimeDisplayProps } from "@editframe/react";
|
|
460
|
+
|
|
461
|
+
const timeDisplayConfig: TimeDisplayProps = {
|
|
462
|
+
currentTimeMs: 5000,
|
|
463
|
+
durationMs: 30000,
|
|
464
|
+
className: "text-white font-mono",
|
|
465
|
+
};
|
|
466
|
+
```
|
|
467
|
+
<!-- /react-only -->
|
|
468
|
+
|
|
469
|
+
## Accessibility
|
|
470
|
+
|
|
471
|
+
<!-- html-only -->
|
|
472
|
+
The time display is readable by screen readers.
|
|
473
|
+
<!-- /html-only -->
|
|
474
|
+
<!-- react-only -->
|
|
475
|
+
The time display is read by screen readers. For enhanced accessibility, consider adding a label:
|
|
476
|
+
|
|
477
|
+
```tsx
|
|
478
|
+
<div role="status" aria-label="Video playback time">
|
|
479
|
+
<TimeDisplay className="text-white text-sm font-mono" />
|
|
480
|
+
</div>
|
|
481
|
+
```
|
|
482
|
+
<!-- /react-only -->
|
|
483
|
+
|
|
484
|
+
<!-- react-only -->
|
|
485
|
+
## Edge Cases
|
|
486
|
+
|
|
487
|
+
TimeDisplay handles edge cases gracefully:
|
|
488
|
+
- `NaN` or `undefined` values show as `0:00 / 0:00`
|
|
489
|
+
- Negative values show as `0:00`
|
|
490
|
+
- Very long durations work correctly (e.g., `45:30` for 45.5 minutes)
|
|
491
|
+
- Updates smoothly during playback without flickering
|
|
492
|
+
<!-- /react-only -->
|