@editframe/create 0.43.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/README.md +11 -0
- 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 +2 -2
- package/tsdown.config.ts +4 -0
- package/dist/detectAgent.js +0 -89
- package/dist/detectAgent.js.map +0 -1
|
@@ -0,0 +1,618 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Toggle Loop Element
|
|
3
|
+
description: Button component that toggles loop playback on and off, with visual state reflecting whether the composition will loop.
|
|
4
|
+
type: reference
|
|
5
|
+
nav:
|
|
6
|
+
parent: "Playback Controls"
|
|
7
|
+
priority: 14
|
|
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: ToggleLoop
|
|
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 on and off states
|
|
24
|
+
nav:
|
|
25
|
+
parent: "Components / Playback Controls"
|
|
26
|
+
priority: 53
|
|
27
|
+
related: ["toggle-play", "controls"]
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<!-- html-only -->
|
|
31
|
+
# ef-toggle-loop
|
|
32
|
+
<!-- /html-only -->
|
|
33
|
+
<!-- react-only -->
|
|
34
|
+
# ToggleLoop
|
|
35
|
+
<!-- /react-only -->
|
|
36
|
+
|
|
37
|
+
<!-- html-only -->
|
|
38
|
+
Button to toggle loop playback. Shows different content based on loop state.
|
|
39
|
+
<!-- /html-only -->
|
|
40
|
+
<!-- react-only -->
|
|
41
|
+
Button to toggle looping playback on and off.
|
|
42
|
+
<!-- /react-only -->
|
|
43
|
+
|
|
44
|
+
<!-- react-only -->
|
|
45
|
+
## Import
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { ToggleLoop } 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" sourceout="3s" class="size-full object-contain"></ef-video>
|
|
58
|
+
|
|
59
|
+
<div class="absolute bottom-4 left-4 flex gap-2">
|
|
60
|
+
<ef-toggle-play>
|
|
61
|
+
<button slot="play" class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700">▶</button>
|
|
62
|
+
<button slot="pause" class="px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700">⏸</button>
|
|
63
|
+
</ef-toggle-play>
|
|
64
|
+
|
|
65
|
+
<ef-toggle-loop>
|
|
66
|
+
<button slot="on" class="px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700">🔁 Loop On</button>
|
|
67
|
+
<button slot="off" class="px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700">🔁 Loop Off</button>
|
|
68
|
+
</ef-toggle-loop>
|
|
69
|
+
</div>
|
|
70
|
+
</ef-timegroup>
|
|
71
|
+
```
|
|
72
|
+
<!-- /html-only -->
|
|
73
|
+
<!-- react-only -->
|
|
74
|
+
```tsx
|
|
75
|
+
import { ToggleLoop, Preview } from "@editframe/react";
|
|
76
|
+
|
|
77
|
+
<div className="flex flex-col gap-2">
|
|
78
|
+
<Preview className="w-full h-[600px]" />
|
|
79
|
+
|
|
80
|
+
<ToggleLoop>
|
|
81
|
+
<button slot="off" className="px-4 py-2 bg-gray-600 text-white rounded">
|
|
82
|
+
Enable Loop
|
|
83
|
+
</button>
|
|
84
|
+
<button slot="on" className="px-4 py-2 bg-blue-600 text-white rounded">
|
|
85
|
+
Disable Loop
|
|
86
|
+
</button>
|
|
87
|
+
</ToggleLoop>
|
|
88
|
+
</div>
|
|
89
|
+
```
|
|
90
|
+
<!-- /react-only -->
|
|
91
|
+
|
|
92
|
+
## Slots
|
|
93
|
+
|
|
94
|
+
<!-- html-only -->
|
|
95
|
+
### on
|
|
96
|
+
|
|
97
|
+
Content shown when loop is enabled. Clicking disables loop.
|
|
98
|
+
|
|
99
|
+
### off
|
|
100
|
+
|
|
101
|
+
Content shown when loop is disabled. Clicking enables loop.
|
|
102
|
+
<!-- /html-only -->
|
|
103
|
+
<!-- react-only -->
|
|
104
|
+
### Named Slots
|
|
105
|
+
|
|
106
|
+
ToggleLoop uses named slots to display different content based on loop state:
|
|
107
|
+
|
|
108
|
+
- `slot="off"` - Displayed when looping is disabled
|
|
109
|
+
- `slot="on"` - Displayed when looping is enabled
|
|
110
|
+
|
|
111
|
+
The component automatically switches between the two based on the current loop state.
|
|
112
|
+
<!-- /react-only -->
|
|
113
|
+
|
|
114
|
+
## Icon-Only Toggle
|
|
115
|
+
|
|
116
|
+
<!-- html-only -->
|
|
117
|
+
```html live
|
|
118
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black relative">
|
|
119
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" sourceout="3s" class="size-full object-contain"></ef-video>
|
|
120
|
+
|
|
121
|
+
<div class="absolute top-4 right-4 flex gap-2">
|
|
122
|
+
<ef-toggle-loop>
|
|
123
|
+
<button slot="on" class="w-10 h-10 rounded-full bg-green-600/80 backdrop-blur flex items-center justify-center text-white hover:bg-green-600">
|
|
124
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
125
|
+
<path d="M17 1l4 4-4 4"/>
|
|
126
|
+
<path d="M3 11V9a4 4 0 0 1 4-4h14"/>
|
|
127
|
+
<path d="M7 23l-4-4 4-4"/>
|
|
128
|
+
<path d="M21 13v2a4 4 0 0 1-4 4H3"/>
|
|
129
|
+
</svg>
|
|
130
|
+
</button>
|
|
131
|
+
<button slot="off" class="w-10 h-10 rounded-full bg-black/60 backdrop-blur flex items-center justify-center text-white/60 hover:bg-black/80">
|
|
132
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
133
|
+
<path d="M17 1l4 4-4 4"/>
|
|
134
|
+
<path d="M3 11V9a4 4 0 0 1 4-4h14"/>
|
|
135
|
+
<path d="M7 23l-4-4 4-4"/>
|
|
136
|
+
<path d="M21 13v2a4 4 0 0 1-4 4H3"/>
|
|
137
|
+
</svg>
|
|
138
|
+
</button>
|
|
139
|
+
</ef-toggle-loop>
|
|
140
|
+
</div>
|
|
141
|
+
</ef-timegroup>
|
|
142
|
+
```
|
|
143
|
+
<!-- /html-only -->
|
|
144
|
+
<!-- react-only -->
|
|
145
|
+
Simple icon button:
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
<ToggleLoop className="w-10 h-10">
|
|
149
|
+
<button
|
|
150
|
+
slot="off"
|
|
151
|
+
className="w-full h-full rounded-full bg-gray-600 text-white flex items-center justify-center hover:bg-gray-700"
|
|
152
|
+
>
|
|
153
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
154
|
+
<path d="M17 17H7V14L3 18L7 22V19H19V13H17M7 7H17V10L21 6L17 2V5H5V11H7V7Z"/>
|
|
155
|
+
</svg>
|
|
156
|
+
</button>
|
|
157
|
+
<button
|
|
158
|
+
slot="on"
|
|
159
|
+
className="w-full h-full rounded-full bg-blue-600 text-white flex items-center justify-center hover:bg-blue-700"
|
|
160
|
+
>
|
|
161
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
162
|
+
<path d="M17 17H7V14L3 18L7 22V19H19V13H17M7 7H17V10L21 6L17 2V5H5V11H7V7Z"/>
|
|
163
|
+
</svg>
|
|
164
|
+
</button>
|
|
165
|
+
</ToggleLoop>
|
|
166
|
+
```
|
|
167
|
+
<!-- /react-only -->
|
|
168
|
+
|
|
169
|
+
<!-- html-only -->
|
|
170
|
+
## Compact Toggle
|
|
171
|
+
|
|
172
|
+
```html live
|
|
173
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black relative">
|
|
174
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" sourceout="3s" class="size-full object-contain"></ef-video>
|
|
175
|
+
|
|
176
|
+
<ef-toggle-loop class="absolute top-4 left-4">
|
|
177
|
+
<button slot="on" class="px-3 py-1 text-xs bg-green-600 text-white rounded-full font-semibold hover:bg-green-700">
|
|
178
|
+
Loop: ON
|
|
179
|
+
</button>
|
|
180
|
+
<button slot="off" class="px-3 py-1 text-xs bg-gray-600 text-white rounded-full font-semibold hover:bg-gray-700">
|
|
181
|
+
Loop: OFF
|
|
182
|
+
</button>
|
|
183
|
+
</ef-toggle-loop>
|
|
184
|
+
</ef-timegroup>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## With ef-controls
|
|
188
|
+
|
|
189
|
+
Use with `ef-controls` to control a non-ancestor element:
|
|
190
|
+
|
|
191
|
+
```html
|
|
192
|
+
<ef-timegroup id="my-video" mode="contain" class="w-full h-96">
|
|
193
|
+
<ef-video src="video.mp4" sourceout="3s" class="size-full"></ef-video>
|
|
194
|
+
</ef-timegroup>
|
|
195
|
+
|
|
196
|
+
<ef-controls target="my-video" class="flex gap-2">
|
|
197
|
+
<ef-toggle-play>
|
|
198
|
+
<button slot="play">Play</button>
|
|
199
|
+
<button slot="pause">Pause</button>
|
|
200
|
+
</ef-toggle-play>
|
|
201
|
+
|
|
202
|
+
<ef-toggle-loop>
|
|
203
|
+
<button slot="on">Loop: ON</button>
|
|
204
|
+
<button slot="off">Loop: OFF</button>
|
|
205
|
+
</ef-toggle-loop>
|
|
206
|
+
</ef-controls>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Target Attribute
|
|
210
|
+
|
|
211
|
+
Directly target an element by ID without `ef-controls`:
|
|
212
|
+
|
|
213
|
+
```html
|
|
214
|
+
<ef-timegroup id="video-1" mode="contain">
|
|
215
|
+
<ef-video src="video.mp4"></ef-video>
|
|
216
|
+
</ef-timegroup>
|
|
217
|
+
|
|
218
|
+
<ef-toggle-loop target="video-1">
|
|
219
|
+
<button slot="on">Loop ON</button>
|
|
220
|
+
<button slot="off">Loop OFF</button>
|
|
221
|
+
</ef-toggle-loop>
|
|
222
|
+
```
|
|
223
|
+
<!-- /html-only -->
|
|
224
|
+
|
|
225
|
+
<!-- react-only -->
|
|
226
|
+
## In Control Bar
|
|
227
|
+
|
|
228
|
+
Use in a horizontal control bar with other playback controls:
|
|
229
|
+
|
|
230
|
+
```tsx
|
|
231
|
+
import { TogglePlay, ToggleLoop, Scrubber, TimeDisplay } from "@editframe/react";
|
|
232
|
+
|
|
233
|
+
export const ControlBar = () => {
|
|
234
|
+
return (
|
|
235
|
+
<div className="bg-gray-800 p-3 flex items-center gap-4">
|
|
236
|
+
<TogglePlay>
|
|
237
|
+
<button slot="play" className="w-8 h-8 text-white">▶</button>
|
|
238
|
+
<button slot="pause" className="w-8 h-8 text-white">⏸</button>
|
|
239
|
+
</TogglePlay>
|
|
240
|
+
|
|
241
|
+
<TimeDisplay className="text-white text-sm font-mono" />
|
|
242
|
+
<Scrubber className="flex-1" />
|
|
243
|
+
|
|
244
|
+
<ToggleLoop>
|
|
245
|
+
<button
|
|
246
|
+
slot="off"
|
|
247
|
+
className="w-8 h-8 text-gray-400 hover:text-white transition"
|
|
248
|
+
title="Enable loop"
|
|
249
|
+
>
|
|
250
|
+
🔁
|
|
251
|
+
</button>
|
|
252
|
+
<button
|
|
253
|
+
slot="on"
|
|
254
|
+
className="w-8 h-8 text-blue-400 hover:text-blue-300 transition"
|
|
255
|
+
title="Disable loop"
|
|
256
|
+
>
|
|
257
|
+
🔁
|
|
258
|
+
</button>
|
|
259
|
+
</ToggleLoop>
|
|
260
|
+
</div>
|
|
261
|
+
);
|
|
262
|
+
};
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Styled Toggle
|
|
266
|
+
|
|
267
|
+
Custom styled button with state indication:
|
|
268
|
+
|
|
269
|
+
```tsx
|
|
270
|
+
<ToggleLoop>
|
|
271
|
+
<button
|
|
272
|
+
slot="off"
|
|
273
|
+
className="px-4 py-2 bg-gray-700 text-gray-300 rounded-lg hover:bg-gray-600 transition"
|
|
274
|
+
>
|
|
275
|
+
<span className="flex items-center gap-2">
|
|
276
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" className="opacity-50">
|
|
277
|
+
<path d="M17 17H7V14L3 18L7 22V19H19V13H17M7 7H17V10L21 6L17 2V5H5V11H7V7Z"/>
|
|
278
|
+
</svg>
|
|
279
|
+
<span>Loop Off</span>
|
|
280
|
+
</span>
|
|
281
|
+
</button>
|
|
282
|
+
<button
|
|
283
|
+
slot="on"
|
|
284
|
+
className="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition shadow-lg"
|
|
285
|
+
>
|
|
286
|
+
<span className="flex items-center gap-2">
|
|
287
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
288
|
+
<path d="M17 17H7V14L3 18L7 22V19H19V13H17M7 7H17V10L21 6L17 2V5H5V11H7V7Z"/>
|
|
289
|
+
</svg>
|
|
290
|
+
<span>Loop On</span>
|
|
291
|
+
</span>
|
|
292
|
+
</button>
|
|
293
|
+
</ToggleLoop>
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Minimal Toggle
|
|
297
|
+
|
|
298
|
+
Compact toggle for tight spaces:
|
|
299
|
+
|
|
300
|
+
```tsx
|
|
301
|
+
<ToggleLoop className="text-sm">
|
|
302
|
+
<span slot="off" className="text-gray-400 cursor-pointer hover:text-white">
|
|
303
|
+
Loop: Off
|
|
304
|
+
</span>
|
|
305
|
+
<span slot="on" className="text-blue-400 cursor-pointer hover:text-blue-300">
|
|
306
|
+
Loop: On
|
|
307
|
+
</span>
|
|
308
|
+
</ToggleLoop>
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## With Custom Icons
|
|
312
|
+
|
|
313
|
+
Use any icon library:
|
|
314
|
+
|
|
315
|
+
```tsx
|
|
316
|
+
import { ToggleLoop } from "@editframe/react";
|
|
317
|
+
import { Repeat } from "lucide-react";
|
|
318
|
+
|
|
319
|
+
<ToggleLoop>
|
|
320
|
+
<button
|
|
321
|
+
slot="off"
|
|
322
|
+
className="text-gray-400 hover:text-white transition"
|
|
323
|
+
>
|
|
324
|
+
<Repeat size={24} strokeWidth={1.5} />
|
|
325
|
+
</button>
|
|
326
|
+
<button
|
|
327
|
+
slot="on"
|
|
328
|
+
className="text-blue-400 hover:text-blue-300 transition"
|
|
329
|
+
>
|
|
330
|
+
<Repeat size={24} strokeWidth={2} />
|
|
331
|
+
</button>
|
|
332
|
+
</ToggleLoop>
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Text-Only Toggle
|
|
336
|
+
|
|
337
|
+
Simple text button:
|
|
338
|
+
|
|
339
|
+
```tsx
|
|
340
|
+
<ToggleLoop>
|
|
341
|
+
<button
|
|
342
|
+
slot="off"
|
|
343
|
+
className="px-3 py-1 text-sm text-gray-400 hover:text-white"
|
|
344
|
+
>
|
|
345
|
+
Enable Looping
|
|
346
|
+
</button>
|
|
347
|
+
<button
|
|
348
|
+
slot="on"
|
|
349
|
+
className="px-3 py-1 text-sm text-blue-400 hover:text-blue-300 font-semibold"
|
|
350
|
+
>
|
|
351
|
+
Looping Enabled
|
|
352
|
+
</button>
|
|
353
|
+
</ToggleLoop>
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## Badge Style Toggle
|
|
357
|
+
|
|
358
|
+
Display as a status badge:
|
|
359
|
+
|
|
360
|
+
```tsx
|
|
361
|
+
<ToggleLoop>
|
|
362
|
+
<div
|
|
363
|
+
slot="off"
|
|
364
|
+
className="px-3 py-1 bg-gray-700 text-gray-300 text-xs rounded-full cursor-pointer hover:bg-gray-600"
|
|
365
|
+
>
|
|
366
|
+
Loop: OFF
|
|
367
|
+
</div>
|
|
368
|
+
<div
|
|
369
|
+
slot="on"
|
|
370
|
+
className="px-3 py-1 bg-blue-600 text-white text-xs rounded-full cursor-pointer hover:bg-blue-700 shadow-md"
|
|
371
|
+
>
|
|
372
|
+
Loop: ON
|
|
373
|
+
</div>
|
|
374
|
+
</ToggleLoop>
|
|
375
|
+
```
|
|
376
|
+
<!-- /react-only -->
|
|
377
|
+
|
|
378
|
+
## Full Player Controls
|
|
379
|
+
|
|
380
|
+
<!-- html-only -->
|
|
381
|
+
```html live
|
|
382
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black relative">
|
|
383
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" sourceout="3s" class="size-full object-contain"></ef-video>
|
|
384
|
+
|
|
385
|
+
<div class="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/90 p-4">
|
|
386
|
+
<ef-scrubber class="h-1 bg-white/20 rounded-full mb-3"></ef-scrubber>
|
|
387
|
+
|
|
388
|
+
<div class="flex items-center justify-between">
|
|
389
|
+
<div class="flex items-center gap-2">
|
|
390
|
+
<ef-toggle-play>
|
|
391
|
+
<button slot="play" class="w-9 h-9 rounded-full bg-white/20 backdrop-blur flex items-center justify-center text-white hover:bg-white/30">
|
|
392
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
|
|
393
|
+
<path d="M8 5v14l11-7z"/>
|
|
394
|
+
</svg>
|
|
395
|
+
</button>
|
|
396
|
+
<button slot="pause" class="w-9 h-9 rounded-full bg-white/20 backdrop-blur flex items-center justify-center text-white hover:bg-white/30">
|
|
397
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
|
|
398
|
+
<path d="M6 4h4v16H6zM14 4h4v16h-4z"/>
|
|
399
|
+
</svg>
|
|
400
|
+
</button>
|
|
401
|
+
</ef-toggle-play>
|
|
402
|
+
|
|
403
|
+
<ef-time-display class="text-white text-xs font-mono"></ef-time-display>
|
|
404
|
+
</div>
|
|
405
|
+
|
|
406
|
+
<ef-toggle-loop>
|
|
407
|
+
<button slot="on" class="w-9 h-9 rounded-full bg-green-600/80 flex items-center justify-center text-white hover:bg-green-600">
|
|
408
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
409
|
+
<path d="M17 1l4 4-4 4M3 11V9a4 4 0 0 1 4-4h14M7 23l-4-4 4-4M21 13v2a4 4 0 0 1-4 4H3"/>
|
|
410
|
+
</svg>
|
|
411
|
+
</button>
|
|
412
|
+
<button slot="off" class="w-9 h-9 rounded-full bg-white/10 flex items-center justify-center text-white/50 hover:bg-white/20">
|
|
413
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
414
|
+
<path d="M17 1l4 4-4 4M3 11V9a4 4 0 0 1 4-4h14M7 23l-4-4 4-4M21 13v2a4 4 0 0 1-4 4H3"/>
|
|
415
|
+
</svg>
|
|
416
|
+
</button>
|
|
417
|
+
</ef-toggle-loop>
|
|
418
|
+
</div>
|
|
419
|
+
</div>
|
|
420
|
+
</ef-timegroup>
|
|
421
|
+
```
|
|
422
|
+
<!-- /html-only -->
|
|
423
|
+
<!-- react-only -->
|
|
424
|
+
Complete video editor with loop control:
|
|
425
|
+
|
|
426
|
+
```tsx
|
|
427
|
+
import {
|
|
428
|
+
Preview,
|
|
429
|
+
TogglePlay,
|
|
430
|
+
ToggleLoop,
|
|
431
|
+
Scrubber,
|
|
432
|
+
TimeDisplay,
|
|
433
|
+
} from "@editframe/react";
|
|
434
|
+
|
|
435
|
+
export const VideoEditor = () => {
|
|
436
|
+
return (
|
|
437
|
+
<div className="h-screen flex flex-col bg-gray-900">
|
|
438
|
+
<div className="flex-1 flex items-center justify-center p-8">
|
|
439
|
+
<Preview className="w-full max-w-[1280px] aspect-video bg-black rounded-lg" />
|
|
440
|
+
</div>
|
|
441
|
+
|
|
442
|
+
<div className="bg-gray-800 border-t border-gray-700 p-4">
|
|
443
|
+
<div className="flex items-center gap-4">
|
|
444
|
+
<TogglePlay>
|
|
445
|
+
<button slot="play" className="w-10 h-10 text-white hover:text-blue-400">
|
|
446
|
+
▶
|
|
447
|
+
</button>
|
|
448
|
+
<button slot="pause" className="w-10 h-10 text-white hover:text-gray-400">
|
|
449
|
+
⏸
|
|
450
|
+
</button>
|
|
451
|
+
</TogglePlay>
|
|
452
|
+
|
|
453
|
+
<TimeDisplay className="text-white text-sm font-mono min-w-[120px]" />
|
|
454
|
+
|
|
455
|
+
<div className="flex-1">
|
|
456
|
+
<Scrubber className="w-full h-2" />
|
|
457
|
+
</div>
|
|
458
|
+
|
|
459
|
+
<ToggleLoop>
|
|
460
|
+
<button
|
|
461
|
+
slot="off"
|
|
462
|
+
className="w-10 h-10 text-gray-400 hover:text-white transition"
|
|
463
|
+
title="Enable loop"
|
|
464
|
+
>
|
|
465
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
|
|
466
|
+
<path d="M17 17H7V14L3 18L7 22V19H19V13H17M7 7H17V10L21 6L17 2V5H5V11H7V7Z"/>
|
|
467
|
+
</svg>
|
|
468
|
+
</button>
|
|
469
|
+
<button
|
|
470
|
+
slot="on"
|
|
471
|
+
className="w-10 h-10 text-green-400 hover:text-green-300 transition"
|
|
472
|
+
title="Disable loop"
|
|
473
|
+
>
|
|
474
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
|
|
475
|
+
<path d="M17 17H7V14L3 18L7 22V19H19V13H17M7 7H17V10L21 6L17 2V5H5V11H7V7Z"/>
|
|
476
|
+
</svg>
|
|
477
|
+
</button>
|
|
478
|
+
</ToggleLoop>
|
|
479
|
+
</div>
|
|
480
|
+
</div>
|
|
481
|
+
</div>
|
|
482
|
+
);
|
|
483
|
+
};
|
|
484
|
+
```
|
|
485
|
+
<!-- /react-only -->
|
|
486
|
+
|
|
487
|
+
<!-- html-only -->
|
|
488
|
+
## State Indicator Badge
|
|
489
|
+
|
|
490
|
+
```html live
|
|
491
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black relative">
|
|
492
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" sourceout="3s" class="size-full object-contain"></ef-video>
|
|
493
|
+
|
|
494
|
+
<ef-toggle-loop class="absolute bottom-4 right-4">
|
|
495
|
+
<button slot="on" class="flex items-center gap-2 px-4 py-2 bg-green-600/90 backdrop-blur text-white rounded-full hover:bg-green-600 transition">
|
|
496
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
497
|
+
<path d="M17 1l4 4-4 4M3 11V9a4 4 0 0 1 4-4h14M7 23l-4-4 4-4M21 13v2a4 4 0 0 1-4 4H3"/>
|
|
498
|
+
</svg>
|
|
499
|
+
<span class="text-sm font-semibold">Looping</span>
|
|
500
|
+
</button>
|
|
501
|
+
<button slot="off" class="flex items-center gap-2 px-4 py-2 bg-black/60 backdrop-blur text-white/70 rounded-full hover:bg-black/80 transition">
|
|
502
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
503
|
+
<path d="M17 1l4 4-4 4M3 11V9a4 4 0 0 1 4-4h14M7 23l-4-4 4-4M21 13v2a4 4 0 0 1-4 4H3"/>
|
|
504
|
+
</svg>
|
|
505
|
+
<span class="text-sm font-semibold">Loop Off</span>
|
|
506
|
+
</button>
|
|
507
|
+
</ef-toggle-loop>
|
|
508
|
+
</ef-timegroup>
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
## Minimal Text Toggle
|
|
512
|
+
|
|
513
|
+
```html live
|
|
514
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black relative">
|
|
515
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" sourceout="3s" class="size-full object-contain"></ef-video>
|
|
516
|
+
|
|
517
|
+
<ef-toggle-loop class="absolute top-4 right-4">
|
|
518
|
+
<button slot="on" class="px-3 py-1.5 bg-green-600 text-white rounded text-xs font-bold hover:bg-green-700">
|
|
519
|
+
✓ LOOP
|
|
520
|
+
</button>
|
|
521
|
+
<button slot="off" class="px-3 py-1.5 bg-gray-700 text-gray-400 rounded text-xs font-bold hover:bg-gray-600">
|
|
522
|
+
LOOP
|
|
523
|
+
</button>
|
|
524
|
+
</ef-toggle-loop>
|
|
525
|
+
</ef-timegroup>
|
|
526
|
+
```
|
|
527
|
+
<!-- /html-only -->
|
|
528
|
+
|
|
529
|
+
<!-- react-only -->
|
|
530
|
+
## Corner Loop Indicator
|
|
531
|
+
|
|
532
|
+
Display loop state in corner:
|
|
533
|
+
|
|
534
|
+
```tsx
|
|
535
|
+
import { Timegroup, Video, ToggleLoop } from "@editframe/react";
|
|
536
|
+
|
|
537
|
+
<Timegroup mode="contain" className="w-[720px] h-[480px] bg-black relative">
|
|
538
|
+
<Video src="/assets/video.mp4" className="size-full" />
|
|
539
|
+
|
|
540
|
+
<ToggleLoop className="absolute top-4 right-4">
|
|
541
|
+
<button
|
|
542
|
+
slot="off"
|
|
543
|
+
className="px-3 py-1 bg-black/50 backdrop-blur text-white/50 text-xs rounded hover:bg-black/70"
|
|
544
|
+
>
|
|
545
|
+
Loop
|
|
546
|
+
</button>
|
|
547
|
+
<button
|
|
548
|
+
slot="on"
|
|
549
|
+
className="px-3 py-1 bg-blue-600 backdrop-blur text-white text-xs rounded hover:bg-blue-700 font-semibold"
|
|
550
|
+
>
|
|
551
|
+
Loop ✓
|
|
552
|
+
</button>
|
|
553
|
+
</ToggleLoop>
|
|
554
|
+
</Timegroup>
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
## Settings Panel Toggle
|
|
558
|
+
|
|
559
|
+
Use in a settings panel:
|
|
560
|
+
|
|
561
|
+
```tsx
|
|
562
|
+
<div className="bg-gray-800 p-4 rounded-lg">
|
|
563
|
+
<div className="flex items-center justify-between">
|
|
564
|
+
<div>
|
|
565
|
+
<h3 className="text-white font-semibold">Loop Playback</h3>
|
|
566
|
+
<p className="text-gray-400 text-sm">Repeat video when it ends</p>
|
|
567
|
+
</div>
|
|
568
|
+
|
|
569
|
+
<ToggleLoop>
|
|
570
|
+
<button
|
|
571
|
+
slot="off"
|
|
572
|
+
className="w-12 h-6 bg-gray-600 rounded-full relative"
|
|
573
|
+
>
|
|
574
|
+
<span className="absolute left-1 top-1 w-4 h-4 bg-white rounded-full transition-transform" />
|
|
575
|
+
</button>
|
|
576
|
+
<button
|
|
577
|
+
slot="on"
|
|
578
|
+
className="w-12 h-6 bg-blue-600 rounded-full relative"
|
|
579
|
+
>
|
|
580
|
+
<span className="absolute right-1 top-1 w-4 h-4 bg-white rounded-full transition-transform" />
|
|
581
|
+
</button>
|
|
582
|
+
</ToggleLoop>
|
|
583
|
+
</div>
|
|
584
|
+
</div>
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
## Accessibility
|
|
588
|
+
|
|
589
|
+
Ensure proper labels that update with state:
|
|
590
|
+
|
|
591
|
+
```tsx
|
|
592
|
+
<ToggleLoop>
|
|
593
|
+
<button slot="off" aria-label="Enable loop playback" className="w-10 h-10">
|
|
594
|
+
<svg aria-hidden="true">...</svg>
|
|
595
|
+
</button>
|
|
596
|
+
<button slot="on" aria-label="Disable loop playback" className="w-10 h-10">
|
|
597
|
+
<svg aria-hidden="true">...</svg>
|
|
598
|
+
</button>
|
|
599
|
+
</ToggleLoop>
|
|
600
|
+
```
|
|
601
|
+
<!-- /react-only -->
|
|
602
|
+
|
|
603
|
+
## Use Cases
|
|
604
|
+
|
|
605
|
+
<!-- html-only -->
|
|
606
|
+
- **Short videos** - Loop a short clip continuously
|
|
607
|
+
- **Product demos** - Let users watch the demo repeatedly
|
|
608
|
+
- **Animated backgrounds** - Seamlessly loop background videos
|
|
609
|
+
- **GIF replacements** - Loop video content like animated GIFs
|
|
610
|
+
<!-- /html-only -->
|
|
611
|
+
<!-- react-only -->
|
|
612
|
+
Loop control is useful for:
|
|
613
|
+
- Video previews that should repeat
|
|
614
|
+
- Tutorial videos that users can watch multiple times
|
|
615
|
+
- Background video content
|
|
616
|
+
- Testing and development workflows
|
|
617
|
+
- Short animations that benefit from looping
|
|
618
|
+
<!-- /react-only -->
|