@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,526 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Toggle Play Element
|
|
3
|
+
description: Combined play/pause toggle button that switches between play and pause states with configurable icons and labels.
|
|
4
|
+
type: reference
|
|
5
|
+
nav:
|
|
6
|
+
parent: "Playback Controls"
|
|
7
|
+
priority: 13
|
|
8
|
+
api:
|
|
9
|
+
attributes:
|
|
10
|
+
- name: target
|
|
11
|
+
type: string
|
|
12
|
+
description: ID of the element to control (optional if nested in composition)
|
|
13
|
+
react:
|
|
14
|
+
generate: true
|
|
15
|
+
componentName: TogglePlay
|
|
16
|
+
importPath: "@editframe/react"
|
|
17
|
+
additionalProps:
|
|
18
|
+
- name: className
|
|
19
|
+
type: string
|
|
20
|
+
description: CSS classes for styling
|
|
21
|
+
- name: children
|
|
22
|
+
type: ReactNode
|
|
23
|
+
description: Named slots for play and pause content
|
|
24
|
+
nav:
|
|
25
|
+
parent: "Components / Playback Controls"
|
|
26
|
+
priority: 52
|
|
27
|
+
related: ["play", "pause", "controls"]
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<!-- html-only -->
|
|
31
|
+
# ef-toggle-play
|
|
32
|
+
<!-- /html-only -->
|
|
33
|
+
<!-- react-only -->
|
|
34
|
+
# TogglePlay
|
|
35
|
+
<!-- /react-only -->
|
|
36
|
+
|
|
37
|
+
<!-- html-only -->
|
|
38
|
+
Combined play/pause button that toggles playback and switches content based on state.
|
|
39
|
+
<!-- /html-only -->
|
|
40
|
+
<!-- react-only -->
|
|
41
|
+
Single button that toggles between play and pause states.
|
|
42
|
+
<!-- /react-only -->
|
|
43
|
+
|
|
44
|
+
<!-- react-only -->
|
|
45
|
+
## Import
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { TogglePlay } from "@editframe/react";
|
|
49
|
+
```
|
|
50
|
+
<!-- /react-only -->
|
|
51
|
+
|
|
52
|
+
## Basic Usage
|
|
53
|
+
|
|
54
|
+
<!-- html-only -->
|
|
55
|
+
```html live
|
|
56
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black relative">
|
|
57
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" class="size-full object-contain"></ef-video>
|
|
58
|
+
|
|
59
|
+
<ef-toggle-play class="absolute bottom-4 left-4">
|
|
60
|
+
<button slot="play" class="px-6 py-3 bg-blue-600 text-white rounded-lg font-bold hover:bg-blue-700">
|
|
61
|
+
▶ Play
|
|
62
|
+
</button>
|
|
63
|
+
<button slot="pause" class="px-6 py-3 bg-gray-600 text-white rounded-lg font-bold hover:bg-gray-700">
|
|
64
|
+
⏸ Pause
|
|
65
|
+
</button>
|
|
66
|
+
</ef-toggle-play>
|
|
67
|
+
</ef-timegroup>
|
|
68
|
+
```
|
|
69
|
+
<!-- /html-only -->
|
|
70
|
+
<!-- react-only -->
|
|
71
|
+
```tsx
|
|
72
|
+
import { TogglePlay, Timegroup, Video } from "@editframe/react";
|
|
73
|
+
|
|
74
|
+
<Timegroup mode="contain" className="w-[720px] h-[480px] bg-black relative">
|
|
75
|
+
<Video src="/assets/video.mp4" className="size-full object-contain" />
|
|
76
|
+
|
|
77
|
+
<TogglePlay className="absolute bottom-4 left-4">
|
|
78
|
+
<button slot="play" className="px-4 py-2 bg-blue-600 text-white rounded">
|
|
79
|
+
▶ Play
|
|
80
|
+
</button>
|
|
81
|
+
<button slot="pause" className="px-4 py-2 bg-gray-600 text-white rounded">
|
|
82
|
+
⏸ Pause
|
|
83
|
+
</button>
|
|
84
|
+
</TogglePlay>
|
|
85
|
+
</Timegroup>
|
|
86
|
+
```
|
|
87
|
+
<!-- /react-only -->
|
|
88
|
+
|
|
89
|
+
## Slots
|
|
90
|
+
|
|
91
|
+
<!-- html-only -->
|
|
92
|
+
### play
|
|
93
|
+
|
|
94
|
+
Content shown when paused. Clicking starts playback.
|
|
95
|
+
|
|
96
|
+
### pause
|
|
97
|
+
|
|
98
|
+
Content shown when playing. Clicking pauses playback.
|
|
99
|
+
<!-- /html-only -->
|
|
100
|
+
<!-- react-only -->
|
|
101
|
+
### Named Slots
|
|
102
|
+
|
|
103
|
+
TogglePlay uses named slots to display different content based on playback state:
|
|
104
|
+
|
|
105
|
+
- `slot="play"` - Displayed when paused
|
|
106
|
+
- `slot="pause"` - Displayed when playing
|
|
107
|
+
|
|
108
|
+
The component automatically switches between the two based on the current playback state.
|
|
109
|
+
<!-- /react-only -->
|
|
110
|
+
|
|
111
|
+
## Icon-Only Toggle
|
|
112
|
+
|
|
113
|
+
<!-- html-only -->
|
|
114
|
+
```html live
|
|
115
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black relative">
|
|
116
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" class="size-full object-contain"></ef-video>
|
|
117
|
+
|
|
118
|
+
<ef-toggle-play class="absolute inset-0 flex items-center justify-center">
|
|
119
|
+
<button slot="play" class="w-20 h-20 rounded-full bg-white/90 flex items-center justify-center shadow-lg hover:scale-110 transition">
|
|
120
|
+
<svg width="32" height="32" viewBox="0 0 24 24" fill="currentColor">
|
|
121
|
+
<path d="M8 5v14l11-7z"/>
|
|
122
|
+
</svg>
|
|
123
|
+
</button>
|
|
124
|
+
<button slot="pause" class="w-20 h-20 rounded-full bg-white/90 flex items-center justify-center shadow-lg hover:scale-110 transition">
|
|
125
|
+
<svg width="32" height="32" viewBox="0 0 24 24" fill="currentColor">
|
|
126
|
+
<path d="M6 4h4v16H6zM14 4h4v16h-4z"/>
|
|
127
|
+
</svg>
|
|
128
|
+
</button>
|
|
129
|
+
</ef-toggle-play>
|
|
130
|
+
</ef-timegroup>
|
|
131
|
+
```
|
|
132
|
+
<!-- /html-only -->
|
|
133
|
+
<!-- react-only -->
|
|
134
|
+
Simple icon button that changes on click:
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
<TogglePlay className="w-10 h-10">
|
|
138
|
+
<button
|
|
139
|
+
slot="play"
|
|
140
|
+
className="w-full h-full rounded-full bg-blue-600 text-white flex items-center justify-center hover:bg-blue-700"
|
|
141
|
+
>
|
|
142
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
143
|
+
<path d="M8 5v14l11-7z"/>
|
|
144
|
+
</svg>
|
|
145
|
+
</button>
|
|
146
|
+
<button
|
|
147
|
+
slot="pause"
|
|
148
|
+
className="w-full h-full rounded-full bg-gray-600 text-white flex items-center justify-center hover:bg-gray-700"
|
|
149
|
+
>
|
|
150
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
151
|
+
<path d="M6 4h4v16H6zM14 4h4v16h-4z"/>
|
|
152
|
+
</svg>
|
|
153
|
+
</button>
|
|
154
|
+
</TogglePlay>
|
|
155
|
+
```
|
|
156
|
+
<!-- /react-only -->
|
|
157
|
+
|
|
158
|
+
<!-- html-only -->
|
|
159
|
+
## Compact Toggle
|
|
160
|
+
|
|
161
|
+
```html live
|
|
162
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black relative">
|
|
163
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" class="size-full object-contain"></ef-video>
|
|
164
|
+
|
|
165
|
+
<ef-toggle-play class="absolute bottom-4 left-4">
|
|
166
|
+
<button slot="play" class="w-10 h-10 rounded-full bg-black/60 backdrop-blur flex items-center justify-center text-white hover:bg-black/80">
|
|
167
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
168
|
+
<path d="M8 5v14l11-7z"/>
|
|
169
|
+
</svg>
|
|
170
|
+
</button>
|
|
171
|
+
<button slot="pause" class="w-10 h-10 rounded-full bg-black/60 backdrop-blur flex items-center justify-center text-white hover:bg-black/80">
|
|
172
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
173
|
+
<path d="M6 4h4v16H6zM14 4h4v16h-4z"/>
|
|
174
|
+
</svg>
|
|
175
|
+
</button>
|
|
176
|
+
</ef-toggle-play>
|
|
177
|
+
</ef-timegroup>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## With ef-controls
|
|
181
|
+
|
|
182
|
+
Use with `ef-controls` to control a non-ancestor element:
|
|
183
|
+
|
|
184
|
+
```html
|
|
185
|
+
<ef-timegroup id="my-video" mode="contain" class="w-full h-96">
|
|
186
|
+
<ef-video src="video.mp4" class="size-full"></ef-video>
|
|
187
|
+
</ef-timegroup>
|
|
188
|
+
|
|
189
|
+
<ef-controls target="my-video">
|
|
190
|
+
<ef-toggle-play>
|
|
191
|
+
<button slot="play" class="px-4 py-2 bg-blue-600 text-white rounded">Play</button>
|
|
192
|
+
<button slot="pause" class="px-4 py-2 bg-gray-600 text-white rounded">Pause</button>
|
|
193
|
+
</ef-toggle-play>
|
|
194
|
+
</ef-controls>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Target Attribute
|
|
198
|
+
|
|
199
|
+
Directly target an element by ID without `ef-controls`:
|
|
200
|
+
|
|
201
|
+
```html
|
|
202
|
+
<ef-timegroup id="video-1" mode="contain">
|
|
203
|
+
<ef-video src="video.mp4"></ef-video>
|
|
204
|
+
</ef-timegroup>
|
|
205
|
+
|
|
206
|
+
<ef-toggle-play target="video-1">
|
|
207
|
+
<button slot="play">Play</button>
|
|
208
|
+
<button slot="pause">Pause</button>
|
|
209
|
+
</ef-toggle-play>
|
|
210
|
+
```
|
|
211
|
+
<!-- /html-only -->
|
|
212
|
+
|
|
213
|
+
<!-- react-only -->
|
|
214
|
+
## Center Overlay Toggle
|
|
215
|
+
|
|
216
|
+
Large button that appears over video:
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
import { TogglePlay, Timegroup, Video } from "@editframe/react";
|
|
220
|
+
|
|
221
|
+
export const VideoPlayer = () => {
|
|
222
|
+
return (
|
|
223
|
+
<Timegroup mode="contain" className="w-[720px] h-[480px] bg-black relative">
|
|
224
|
+
<Video src="/assets/video.mp4" className="size-full object-contain" />
|
|
225
|
+
|
|
226
|
+
<TogglePlay className="absolute inset-0 flex items-center justify-center">
|
|
227
|
+
<button
|
|
228
|
+
slot="play"
|
|
229
|
+
className="w-20 h-20 rounded-full bg-white/90 flex items-center justify-center shadow-2xl hover:scale-110 transition"
|
|
230
|
+
>
|
|
231
|
+
<svg width="32" height="32" viewBox="0 0 24 24" fill="currentColor">
|
|
232
|
+
<path d="M8 5v14l11-7z"/>
|
|
233
|
+
</svg>
|
|
234
|
+
</button>
|
|
235
|
+
<button
|
|
236
|
+
slot="pause"
|
|
237
|
+
className="w-20 h-20 rounded-full bg-white/90 flex items-center justify-center shadow-2xl hover:scale-110 transition opacity-0 hover:opacity-100"
|
|
238
|
+
>
|
|
239
|
+
<svg width="32" height="32" viewBox="0 0 24 24" fill="currentColor">
|
|
240
|
+
<path d="M6 4h4v16H6zM14 4h4v16h-4z"/>
|
|
241
|
+
</svg>
|
|
242
|
+
</button>
|
|
243
|
+
</TogglePlay>
|
|
244
|
+
</Timegroup>
|
|
245
|
+
);
|
|
246
|
+
};
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## With Text Labels
|
|
250
|
+
|
|
251
|
+
Toggle button with changing text:
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
<TogglePlay>
|
|
255
|
+
<button
|
|
256
|
+
slot="play"
|
|
257
|
+
className="px-6 py-3 bg-gradient-to-r from-blue-600 to-purple-600 text-white rounded-lg font-semibold"
|
|
258
|
+
>
|
|
259
|
+
▶ Start Playing
|
|
260
|
+
</button>
|
|
261
|
+
<button
|
|
262
|
+
slot="pause"
|
|
263
|
+
className="px-6 py-3 bg-gradient-to-r from-gray-600 to-gray-700 text-white rounded-lg font-semibold"
|
|
264
|
+
>
|
|
265
|
+
⏸ Pause
|
|
266
|
+
</button>
|
|
267
|
+
</TogglePlay>
|
|
268
|
+
```
|
|
269
|
+
<!-- /react-only -->
|
|
270
|
+
|
|
271
|
+
## Full Control Bar
|
|
272
|
+
|
|
273
|
+
<!-- html-only -->
|
|
274
|
+
```html live
|
|
275
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black relative">
|
|
276
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" class="size-full object-contain"></ef-video>
|
|
277
|
+
|
|
278
|
+
<div class="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 p-4">
|
|
279
|
+
<div class="flex items-center gap-3">
|
|
280
|
+
<ef-toggle-play>
|
|
281
|
+
<button slot="play" class="w-10 h-10 rounded-full bg-white/20 backdrop-blur flex items-center justify-center text-white hover:bg-white/30">
|
|
282
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
283
|
+
<path d="M8 5v14l11-7z"/>
|
|
284
|
+
</svg>
|
|
285
|
+
</button>
|
|
286
|
+
<button slot="pause" class="w-10 h-10 rounded-full bg-white/20 backdrop-blur flex items-center justify-center text-white hover:bg-white/30">
|
|
287
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
288
|
+
<path d="M6 4h4v16H6zM14 4h4v16h-4z"/>
|
|
289
|
+
</svg>
|
|
290
|
+
</button>
|
|
291
|
+
</ef-toggle-play>
|
|
292
|
+
|
|
293
|
+
<ef-scrubber class="flex-1 h-1 bg-white/20 rounded-full"></ef-scrubber>
|
|
294
|
+
|
|
295
|
+
<ef-time-display class="text-white text-sm font-mono"></ef-time-display>
|
|
296
|
+
</div>
|
|
297
|
+
</div>
|
|
298
|
+
</ef-timegroup>
|
|
299
|
+
```
|
|
300
|
+
<!-- /html-only -->
|
|
301
|
+
<!-- react-only -->
|
|
302
|
+
Use in a horizontal control bar:
|
|
303
|
+
|
|
304
|
+
```tsx
|
|
305
|
+
import { TogglePlay, Scrubber, TimeDisplay } from "@editframe/react";
|
|
306
|
+
|
|
307
|
+
export const ControlBar = () => {
|
|
308
|
+
return (
|
|
309
|
+
<div className="bg-gray-800 p-3 flex items-center gap-4">
|
|
310
|
+
<TogglePlay>
|
|
311
|
+
<button slot="play" className="w-8 h-8 text-white hover:text-blue-400">
|
|
312
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
|
|
313
|
+
<path d="M8 5v14l11-7z"/>
|
|
314
|
+
</svg>
|
|
315
|
+
</button>
|
|
316
|
+
<button slot="pause" className="w-8 h-8 text-white hover:text-gray-400">
|
|
317
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
|
|
318
|
+
<path d="M6 4h4v16H6zM14 4h4v16h-4z"/>
|
|
319
|
+
</svg>
|
|
320
|
+
</button>
|
|
321
|
+
</TogglePlay>
|
|
322
|
+
|
|
323
|
+
<TimeDisplay className="text-white text-sm font-mono" />
|
|
324
|
+
<Scrubber className="flex-1" />
|
|
325
|
+
</div>
|
|
326
|
+
);
|
|
327
|
+
};
|
|
328
|
+
```
|
|
329
|
+
<!-- /react-only -->
|
|
330
|
+
|
|
331
|
+
## Styled Single Button
|
|
332
|
+
|
|
333
|
+
<!-- html-only -->
|
|
334
|
+
Use the same button element for both slots if you want a single button with changing icons:
|
|
335
|
+
|
|
336
|
+
```html live
|
|
337
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black relative">
|
|
338
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" class="size-full object-contain"></ef-video>
|
|
339
|
+
|
|
340
|
+
<ef-toggle-play class="absolute bottom-4 right-4">
|
|
341
|
+
<button slot="play" class="px-5 py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-full font-bold shadow-lg hover:scale-105 transition">
|
|
342
|
+
Play Video ▶
|
|
343
|
+
</button>
|
|
344
|
+
<button slot="pause" class="px-5 py-3 bg-gradient-to-r from-gray-500 to-gray-700 text-white rounded-full font-bold shadow-lg hover:scale-105 transition">
|
|
345
|
+
Pause ⏸
|
|
346
|
+
</button>
|
|
347
|
+
</ef-toggle-play>
|
|
348
|
+
</ef-timegroup>
|
|
349
|
+
```
|
|
350
|
+
<!-- /html-only -->
|
|
351
|
+
<!-- react-only -->
|
|
352
|
+
Custom styled button with smooth transitions:
|
|
353
|
+
|
|
354
|
+
```tsx
|
|
355
|
+
<TogglePlay>
|
|
356
|
+
<button
|
|
357
|
+
slot="play"
|
|
358
|
+
className="group relative px-8 py-4 bg-gradient-to-br from-blue-500 to-purple-600 text-white rounded-full font-bold shadow-lg hover:shadow-xl transform hover:scale-105 transition-all"
|
|
359
|
+
>
|
|
360
|
+
<span className="flex items-center gap-3">
|
|
361
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
|
|
362
|
+
<path d="M8 5v14l11-7z"/>
|
|
363
|
+
</svg>
|
|
364
|
+
<span>Play Video</span>
|
|
365
|
+
</span>
|
|
366
|
+
</button>
|
|
367
|
+
<button
|
|
368
|
+
slot="pause"
|
|
369
|
+
className="group relative px-8 py-4 bg-gradient-to-br from-gray-600 to-gray-800 text-white rounded-full font-bold shadow-lg hover:shadow-xl transform hover:scale-105 transition-all"
|
|
370
|
+
>
|
|
371
|
+
<span className="flex items-center gap-3">
|
|
372
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
|
|
373
|
+
<path d="M6 4h4v16H6zM14 4h4v16h-4z"/>
|
|
374
|
+
</svg>
|
|
375
|
+
<span>Pause</span>
|
|
376
|
+
</span>
|
|
377
|
+
</button>
|
|
378
|
+
</TogglePlay>
|
|
379
|
+
```
|
|
380
|
+
<!-- /react-only -->
|
|
381
|
+
|
|
382
|
+
<!-- html-only -->
|
|
383
|
+
## Mobile-Friendly Controls
|
|
384
|
+
|
|
385
|
+
```html live
|
|
386
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black relative">
|
|
387
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" class="size-full object-contain"></ef-video>
|
|
388
|
+
|
|
389
|
+
<ef-toggle-play class="absolute inset-0 flex items-center justify-center">
|
|
390
|
+
<button slot="play" class="flex flex-col items-center gap-2 text-white">
|
|
391
|
+
<div class="w-24 h-24 rounded-full bg-white/20 backdrop-blur flex items-center justify-center">
|
|
392
|
+
<svg width="40" height="40" viewBox="0 0 24 24" fill="currentColor">
|
|
393
|
+
<path d="M8 5v14l11-7z"/>
|
|
394
|
+
</svg>
|
|
395
|
+
</div>
|
|
396
|
+
<span class="text-sm font-semibold">Tap to play</span>
|
|
397
|
+
</button>
|
|
398
|
+
<button slot="pause" class="w-24 h-24 rounded-full bg-white/20 backdrop-blur flex items-center justify-center text-white">
|
|
399
|
+
<svg width="40" height="40" viewBox="0 0 24 24" fill="currentColor">
|
|
400
|
+
<path d="M6 4h4v16H6zM14 4h4v16h-4z"/>
|
|
401
|
+
</svg>
|
|
402
|
+
</button>
|
|
403
|
+
</ef-toggle-play>
|
|
404
|
+
</ef-timegroup>
|
|
405
|
+
```
|
|
406
|
+
<!-- /html-only -->
|
|
407
|
+
|
|
408
|
+
<!-- react-only -->
|
|
409
|
+
## With Custom Icons
|
|
410
|
+
|
|
411
|
+
Use any icon library:
|
|
412
|
+
|
|
413
|
+
```tsx
|
|
414
|
+
import { TogglePlay } from "@editframe/react";
|
|
415
|
+
import { PlayCircle, PauseCircle } from "lucide-react";
|
|
416
|
+
|
|
417
|
+
<TogglePlay className="text-white">
|
|
418
|
+
<button slot="play" className="hover:text-blue-400 transition">
|
|
419
|
+
<PlayCircle size={48} strokeWidth={1.5} />
|
|
420
|
+
</button>
|
|
421
|
+
<button slot="pause" className="hover:text-gray-400 transition">
|
|
422
|
+
<PauseCircle size={48} strokeWidth={1.5} />
|
|
423
|
+
</button>
|
|
424
|
+
</TogglePlay>
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
## Minimal Toggle
|
|
428
|
+
|
|
429
|
+
Compact toggle for tight spaces:
|
|
430
|
+
|
|
431
|
+
```tsx
|
|
432
|
+
<TogglePlay className="w-6 h-6">
|
|
433
|
+
<div slot="play" className="text-blue-500 cursor-pointer">▶</div>
|
|
434
|
+
<div slot="pause" className="text-gray-500 cursor-pointer">⏸</div>
|
|
435
|
+
</TogglePlay>
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
## With Preview Component
|
|
439
|
+
|
|
440
|
+
Use inside Preview for non-ancestor element control:
|
|
441
|
+
|
|
442
|
+
```tsx
|
|
443
|
+
import { Preview, TogglePlay } from "@editframe/react";
|
|
444
|
+
|
|
445
|
+
<div className="flex flex-col gap-2">
|
|
446
|
+
<Preview className="w-full h-[600px]" />
|
|
447
|
+
|
|
448
|
+
<TogglePlay>
|
|
449
|
+
<button slot="play" className="w-full px-4 py-2 bg-green-600 text-white rounded">
|
|
450
|
+
Play
|
|
451
|
+
</button>
|
|
452
|
+
<button slot="pause" className="w-full px-4 py-2 bg-gray-600 text-white rounded">
|
|
453
|
+
Pause
|
|
454
|
+
</button>
|
|
455
|
+
</TogglePlay>
|
|
456
|
+
</div>
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
The Preview component provides context that TogglePlay automatically consumes.
|
|
460
|
+
|
|
461
|
+
## Full Editor Example
|
|
462
|
+
|
|
463
|
+
Complete video editor with toggle controls:
|
|
464
|
+
|
|
465
|
+
```tsx
|
|
466
|
+
import { Preview, TogglePlay, Scrubber, TimeDisplay, ToggleLoop } from "@editframe/react";
|
|
467
|
+
|
|
468
|
+
export const VideoEditor = () => {
|
|
469
|
+
return (
|
|
470
|
+
<div className="h-screen flex flex-col bg-gray-900">
|
|
471
|
+
<div className="flex-1 flex items-center justify-center p-8">
|
|
472
|
+
<Preview className="w-full max-w-[1280px] aspect-video bg-black rounded-lg" />
|
|
473
|
+
</div>
|
|
474
|
+
|
|
475
|
+
<div className="bg-gray-800 border-t border-gray-700 p-4">
|
|
476
|
+
<div className="flex items-center gap-4">
|
|
477
|
+
<TogglePlay>
|
|
478
|
+
<button slot="play" className="w-10 h-10 text-white hover:text-blue-400">
|
|
479
|
+
▶
|
|
480
|
+
</button>
|
|
481
|
+
<button slot="pause" className="w-10 h-10 text-white hover:text-gray-400">
|
|
482
|
+
⏸
|
|
483
|
+
</button>
|
|
484
|
+
</TogglePlay>
|
|
485
|
+
|
|
486
|
+
<TimeDisplay className="text-white text-sm font-mono min-w-[120px]" />
|
|
487
|
+
<Scrubber className="flex-1 h-2" />
|
|
488
|
+
<ToggleLoop className="w-10 h-10 text-white" />
|
|
489
|
+
</div>
|
|
490
|
+
</div>
|
|
491
|
+
</div>
|
|
492
|
+
);
|
|
493
|
+
};
|
|
494
|
+
```
|
|
495
|
+
<!-- /react-only -->
|
|
496
|
+
|
|
497
|
+
## When to Use
|
|
498
|
+
|
|
499
|
+
<!-- html-only -->
|
|
500
|
+
- **Use `ef-toggle-play`** when you want a single button that changes appearance
|
|
501
|
+
- **Use separate `ef-play` and `ef-pause`** when you want independent buttons that auto-hide
|
|
502
|
+
- Both approaches provide the same functionality - choose based on your UI design
|
|
503
|
+
<!-- /html-only -->
|
|
504
|
+
<!-- react-only -->
|
|
505
|
+
- Use `TogglePlay` for a single button that switches icons - simpler UI, single click target
|
|
506
|
+
- Use separate `Play` and `Pause` for independent buttons - clearer state indication
|
|
507
|
+
- TogglePlay is ideal for control bars and minimal UIs
|
|
508
|
+
- Separate buttons work better for overlay controls
|
|
509
|
+
<!-- /react-only -->
|
|
510
|
+
|
|
511
|
+
<!-- react-only -->
|
|
512
|
+
## Accessibility
|
|
513
|
+
|
|
514
|
+
Ensure proper labels that update with state:
|
|
515
|
+
|
|
516
|
+
```tsx
|
|
517
|
+
<TogglePlay>
|
|
518
|
+
<button slot="play" aria-label="Play video" className="w-10 h-10">
|
|
519
|
+
<svg aria-hidden="true">...</svg>
|
|
520
|
+
</button>
|
|
521
|
+
<button slot="pause" aria-label="Pause video" className="w-10 h-10">
|
|
522
|
+
<svg aria-hidden="true">...</svg>
|
|
523
|
+
</button>
|
|
524
|
+
</TogglePlay>
|
|
525
|
+
```
|
|
526
|
+
<!-- /react-only -->
|