@editframe/create 0.44.0 → 0.45.1
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,544 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Hierarchy Element
|
|
3
|
+
description: Layer panel that displays the composition element tree with collapsible groups, selection highlighting, and drag-to-reorder.
|
|
4
|
+
type: reference
|
|
5
|
+
nav:
|
|
6
|
+
parent: "Editor Shells"
|
|
7
|
+
priority: 11
|
|
8
|
+
api:
|
|
9
|
+
attributes:
|
|
10
|
+
- name: target
|
|
11
|
+
type: string
|
|
12
|
+
description: ID of the target element (ef-canvas or ef-timegroup)
|
|
13
|
+
- name: header
|
|
14
|
+
type: string
|
|
15
|
+
description: Header text displayed at top of hierarchy
|
|
16
|
+
- name: show-header
|
|
17
|
+
type: boolean
|
|
18
|
+
default: false
|
|
19
|
+
description: Show or hide the header
|
|
20
|
+
- name: hideSelectors
|
|
21
|
+
type: string[]
|
|
22
|
+
description: CSS selectors for elements to hide from hierarchy
|
|
23
|
+
- name: showSelectors
|
|
24
|
+
type: string[]
|
|
25
|
+
description: CSS selectors for elements to include in hierarchy (overrides hide)
|
|
26
|
+
methods:
|
|
27
|
+
- name: select(elementId)
|
|
28
|
+
signature: "select(elementId: string | null): void"
|
|
29
|
+
description: Select an element in the hierarchy
|
|
30
|
+
- name: getSelectedElementId()
|
|
31
|
+
signature: "getSelectedElementId(): string | null"
|
|
32
|
+
description: Get the currently selected element ID
|
|
33
|
+
returns: string | null
|
|
34
|
+
- name: setHighlightedElement(element)
|
|
35
|
+
signature: "setHighlightedElement(element: HTMLElement | null): void"
|
|
36
|
+
description: Set the highlighted (hovered) element
|
|
37
|
+
- name: getHighlightedElement()
|
|
38
|
+
signature: "getHighlightedElement(): HTMLElement | null"
|
|
39
|
+
description: Get the currently highlighted element
|
|
40
|
+
returns: HTMLElement | null
|
|
41
|
+
events:
|
|
42
|
+
- name: hierarchy-select
|
|
43
|
+
detail: "{ elementId: string | null }"
|
|
44
|
+
description: Fired when selection changes
|
|
45
|
+
- name: hierarchy-reorder
|
|
46
|
+
detail: "{ sourceId: string, targetId: string, position: 'before' | 'after' | 'inside' }"
|
|
47
|
+
description: Fired when user reorders elements via drag-and-drop
|
|
48
|
+
react:
|
|
49
|
+
generate: true
|
|
50
|
+
componentName: Hierarchy
|
|
51
|
+
importPath: "@editframe/react"
|
|
52
|
+
propMapping:
|
|
53
|
+
show-header: showHeader
|
|
54
|
+
additionalProps:
|
|
55
|
+
- name: className
|
|
56
|
+
type: string
|
|
57
|
+
description: CSS classes for styling
|
|
58
|
+
nav:
|
|
59
|
+
parent: "Components / Editor UI"
|
|
60
|
+
priority: 60
|
|
61
|
+
related: ["preview", "workbench"]
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
<!-- html-only -->
|
|
65
|
+
# ef-hierarchy
|
|
66
|
+
<!-- /html-only -->
|
|
67
|
+
<!-- react-only -->
|
|
68
|
+
# Hierarchy
|
|
69
|
+
<!-- /react-only -->
|
|
70
|
+
|
|
71
|
+
<!-- html-only -->
|
|
72
|
+
Layer panel showing composition structure with selection and expansion controls.
|
|
73
|
+
<!-- /html-only -->
|
|
74
|
+
<!-- react-only -->
|
|
75
|
+
Tree view displaying composition element hierarchy and layer structure.
|
|
76
|
+
|
|
77
|
+
> **Note**: The Hierarchy component is currently not exported from `@editframe/react`. This documentation describes the underlying `ef-hierarchy` HTML element. To use it in React, you'll need to use the HTML element directly or wait for official React component export.
|
|
78
|
+
<!-- /react-only -->
|
|
79
|
+
|
|
80
|
+
## Basic Usage
|
|
81
|
+
|
|
82
|
+
<!-- html-only -->
|
|
83
|
+
Display a hierarchy of elements in a target container:
|
|
84
|
+
|
|
85
|
+
```html live
|
|
86
|
+
<div class="flex gap-4 h-[400px]">
|
|
87
|
+
<ef-hierarchy target="canvas-1" header="Layers" show-header class="w-64 border border-gray-300 rounded"></ef-hierarchy>
|
|
88
|
+
|
|
89
|
+
<ef-canvas id="canvas-1" class="flex-1 bg-gray-100 relative">
|
|
90
|
+
<ef-timegroup id="scene-1" class="absolute top-4 left-4 w-48 h-32 bg-blue-500 text-white p-4">
|
|
91
|
+
<h2>Scene 1</h2>
|
|
92
|
+
</ef-timegroup>
|
|
93
|
+
<ef-timegroup id="scene-2" class="absolute top-40 left-4 w-48 h-32 bg-green-500 text-white p-4">
|
|
94
|
+
<h2>Scene 2</h2>
|
|
95
|
+
</ef-timegroup>
|
|
96
|
+
</ef-canvas>
|
|
97
|
+
</div>
|
|
98
|
+
```
|
|
99
|
+
<!-- /html-only -->
|
|
100
|
+
<!-- react-only -->
|
|
101
|
+
## HTML Element Usage
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import { useRef, useEffect } from "react";
|
|
105
|
+
|
|
106
|
+
export const App = () => {
|
|
107
|
+
const hierarchyRef = useRef<HTMLElement>(null);
|
|
108
|
+
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
const hierarchy = hierarchyRef.current;
|
|
111
|
+
if (hierarchy) {
|
|
112
|
+
// Access methods via ref
|
|
113
|
+
(hierarchy as any).select("video-1");
|
|
114
|
+
}
|
|
115
|
+
}, []);
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div className="flex h-screen">
|
|
119
|
+
{/* Hierarchy panel */}
|
|
120
|
+
<div className="w-64 border-r bg-gray-50">
|
|
121
|
+
<ef-hierarchy
|
|
122
|
+
ref={hierarchyRef as any}
|
|
123
|
+
target="canvas"
|
|
124
|
+
header="Layers"
|
|
125
|
+
show-header
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
{/* Canvas */}
|
|
130
|
+
<div className="flex-1">
|
|
131
|
+
<ef-canvas id="canvas">
|
|
132
|
+
<ef-timegroup mode="contain" className="w-[1920px] h-[1080px]">
|
|
133
|
+
<ef-video id="video-1" src="/assets/video.mp4" className="size-full" />
|
|
134
|
+
<ef-text id="title" duration="5s" className="text-white text-4xl">
|
|
135
|
+
Title
|
|
136
|
+
</ef-text>
|
|
137
|
+
</ef-timegroup>
|
|
138
|
+
</ef-canvas>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
```
|
|
144
|
+
<!-- /react-only -->
|
|
145
|
+
|
|
146
|
+
<!-- html-only -->
|
|
147
|
+
## Target Binding
|
|
148
|
+
|
|
149
|
+
Hierarchy can target any element containing composition elements:
|
|
150
|
+
|
|
151
|
+
### Canvas Target
|
|
152
|
+
|
|
153
|
+
Show hierarchy of canvas elements:
|
|
154
|
+
|
|
155
|
+
```html
|
|
156
|
+
<ef-hierarchy target="my-canvas"></ef-hierarchy>
|
|
157
|
+
<ef-canvas id="my-canvas">
|
|
158
|
+
<!-- Canvas elements appear in hierarchy -->
|
|
159
|
+
</ef-canvas>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Timegroup Target
|
|
163
|
+
|
|
164
|
+
Show hierarchy of a single timegroup:
|
|
165
|
+
|
|
166
|
+
```html
|
|
167
|
+
<ef-hierarchy target="root-timegroup"></ef-hierarchy>
|
|
168
|
+
<ef-timegroup id="root-timegroup">
|
|
169
|
+
<!-- Nested elements appear in hierarchy -->
|
|
170
|
+
</ef-timegroup>
|
|
171
|
+
```
|
|
172
|
+
<!-- /html-only -->
|
|
173
|
+
|
|
174
|
+
<!-- react-only -->
|
|
175
|
+
## Editor Layout
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
export const EditorWithHierarchy = () => {
|
|
179
|
+
return (
|
|
180
|
+
<div className="h-screen grid grid-cols-[250px_1fr_250px]">
|
|
181
|
+
{/* Left: Hierarchy */}
|
|
182
|
+
<div className="border-r bg-gray-50 overflow-auto">
|
|
183
|
+
<ef-hierarchy
|
|
184
|
+
target="editor-canvas"
|
|
185
|
+
header="Layers"
|
|
186
|
+
show-header
|
|
187
|
+
/>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
{/* Center: Preview */}
|
|
191
|
+
<div className="flex flex-col">
|
|
192
|
+
<div className="flex-1 p-4">
|
|
193
|
+
<ef-preview />
|
|
194
|
+
</div>
|
|
195
|
+
<div className="h-64 border-t">
|
|
196
|
+
<ef-filmstrip target="root-timegroup" />
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
{/* Right: Properties */}
|
|
201
|
+
<div className="border-l bg-gray-50 p-4">
|
|
202
|
+
<h3 className="font-semibold mb-2">Properties</h3>
|
|
203
|
+
{/* Properties panel content */}
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
{/* Composition */}
|
|
207
|
+
<ef-canvas id="editor-canvas">
|
|
208
|
+
<ef-timegroup
|
|
209
|
+
id="root-timegroup"
|
|
210
|
+
mode="sequence"
|
|
211
|
+
className="w-[1920px] h-[1080px]"
|
|
212
|
+
>
|
|
213
|
+
{/* Elements */}
|
|
214
|
+
</ef-timegroup>
|
|
215
|
+
</ef-canvas>
|
|
216
|
+
</div>
|
|
217
|
+
);
|
|
218
|
+
};
|
|
219
|
+
```
|
|
220
|
+
<!-- /react-only -->
|
|
221
|
+
|
|
222
|
+
## Selection Integration
|
|
223
|
+
|
|
224
|
+
<!-- html-only -->
|
|
225
|
+
Hierarchy syncs with ef-canvas selection:
|
|
226
|
+
|
|
227
|
+
```html live
|
|
228
|
+
<div class="flex gap-4 h-[400px]">
|
|
229
|
+
<ef-hierarchy target="canvas-2" show-header header="Layers" class="w-64 border border-gray-300 rounded"></ef-hierarchy>
|
|
230
|
+
|
|
231
|
+
<ef-pan-zoom class="flex-1 border border-gray-300 rounded overflow-hidden">
|
|
232
|
+
<ef-canvas id="canvas-2" class="w-[720px] h-[480px] bg-gray-100">
|
|
233
|
+
<div id="box-1" class="absolute top-8 left-8 w-32 h-32 bg-blue-500 text-white flex items-center justify-center">Box 1</div>
|
|
234
|
+
<div id="box-2" class="absolute top-48 left-48 w-32 h-32 bg-green-500 text-white flex items-center justify-center">Box 2</div>
|
|
235
|
+
<div id="box-3" class="absolute top-8 left-48 w-32 h-32 bg-red-500 text-white flex items-center justify-center">Box 3</div>
|
|
236
|
+
</ef-canvas>
|
|
237
|
+
</ef-pan-zoom>
|
|
238
|
+
</div>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Click items in the hierarchy or canvas to select. Selection stays in sync.
|
|
242
|
+
<!-- /html-only -->
|
|
243
|
+
<!-- react-only -->
|
|
244
|
+
```tsx
|
|
245
|
+
export const SelectionAwareHierarchy = () => {
|
|
246
|
+
const hierarchyRef = useRef<HTMLElement>(null);
|
|
247
|
+
|
|
248
|
+
const handleElementClick = (elementId: string) => {
|
|
249
|
+
const hierarchy = hierarchyRef.current;
|
|
250
|
+
if (hierarchy) {
|
|
251
|
+
(hierarchy as any).select(elementId);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
useEffect(() => {
|
|
256
|
+
const hierarchy = hierarchyRef.current;
|
|
257
|
+
if (!hierarchy) return;
|
|
258
|
+
|
|
259
|
+
const handleSelectionChange = (e: CustomEvent) => {
|
|
260
|
+
console.log("Selected element:", e.detail.elementId);
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
hierarchy.addEventListener("hierarchy-select" as any, handleSelectionChange);
|
|
264
|
+
return () => {
|
|
265
|
+
hierarchy.removeEventListener("hierarchy-select" as any, handleSelectionChange);
|
|
266
|
+
};
|
|
267
|
+
}, []);
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<div className="flex h-screen">
|
|
271
|
+
<div className="w-64 border-r">
|
|
272
|
+
<ef-hierarchy ref={hierarchyRef as any} target="canvas" />
|
|
273
|
+
</div>
|
|
274
|
+
|
|
275
|
+
<div className="flex-1">
|
|
276
|
+
<ef-canvas id="canvas">
|
|
277
|
+
<ef-timegroup mode="contain" className="w-[1920px] h-[1080px]">
|
|
278
|
+
<ef-video
|
|
279
|
+
id="video-1"
|
|
280
|
+
src="/assets/video.mp4"
|
|
281
|
+
onClick={() => handleElementClick("video-1")}
|
|
282
|
+
/>
|
|
283
|
+
</ef-timegroup>
|
|
284
|
+
</ef-canvas>
|
|
285
|
+
</div>
|
|
286
|
+
</div>
|
|
287
|
+
);
|
|
288
|
+
};
|
|
289
|
+
```
|
|
290
|
+
<!-- /react-only -->
|
|
291
|
+
|
|
292
|
+
## Filtering Elements
|
|
293
|
+
|
|
294
|
+
<!-- html-only -->
|
|
295
|
+
Control which elements appear in the hierarchy:
|
|
296
|
+
|
|
297
|
+
### Hide Selectors
|
|
298
|
+
|
|
299
|
+
Hide specific elements by selector:
|
|
300
|
+
|
|
301
|
+
```html
|
|
302
|
+
<ef-hierarchy
|
|
303
|
+
target="canvas"
|
|
304
|
+
.hideSelectors=${['.helper', '.invisible']}>
|
|
305
|
+
</ef-hierarchy>
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Show Selectors
|
|
309
|
+
|
|
310
|
+
Override hiding for specific elements:
|
|
311
|
+
|
|
312
|
+
```html
|
|
313
|
+
<ef-hierarchy
|
|
314
|
+
target="canvas"
|
|
315
|
+
.hideSelectors=${['.helper']}
|
|
316
|
+
.showSelectors=${['.helper-visible']}>
|
|
317
|
+
</ef-hierarchy>
|
|
318
|
+
```
|
|
319
|
+
<!-- /html-only -->
|
|
320
|
+
<!-- react-only -->
|
|
321
|
+
```tsx
|
|
322
|
+
export const FilteredHierarchy = () => {
|
|
323
|
+
const hideSelectors = [".helper-element", "[data-hidden='true']"];
|
|
324
|
+
|
|
325
|
+
return (
|
|
326
|
+
<div className="w-64 h-screen border-r bg-gray-50">
|
|
327
|
+
<ef-hierarchy
|
|
328
|
+
target="canvas"
|
|
329
|
+
hide-selectors={JSON.stringify(hideSelectors)}
|
|
330
|
+
/>
|
|
331
|
+
</div>
|
|
332
|
+
);
|
|
333
|
+
};
|
|
334
|
+
```
|
|
335
|
+
<!-- /react-only -->
|
|
336
|
+
|
|
337
|
+
## Programmatic Control
|
|
338
|
+
|
|
339
|
+
<!-- html-only -->
|
|
340
|
+
Select elements via JavaScript:
|
|
341
|
+
|
|
342
|
+
```javascript
|
|
343
|
+
const hierarchy = document.querySelector('ef-hierarchy');
|
|
344
|
+
|
|
345
|
+
// Select an element
|
|
346
|
+
hierarchy.select('element-id');
|
|
347
|
+
|
|
348
|
+
// Get current selection
|
|
349
|
+
const selectedId = hierarchy.getSelectedElementId();
|
|
350
|
+
|
|
351
|
+
// Clear selection
|
|
352
|
+
hierarchy.select(null);
|
|
353
|
+
|
|
354
|
+
// Listen for selection changes
|
|
355
|
+
hierarchy.addEventListener('hierarchy-select', (e) => {
|
|
356
|
+
console.log('Selected:', e.detail.elementId);
|
|
357
|
+
});
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
## Hover Highlighting
|
|
361
|
+
|
|
362
|
+
Hierarchy shows highlighted (hovered) elements:
|
|
363
|
+
|
|
364
|
+
```javascript
|
|
365
|
+
const hierarchy = document.querySelector('ef-hierarchy');
|
|
366
|
+
|
|
367
|
+
// Highlight an element
|
|
368
|
+
const element = document.getElementById('my-element');
|
|
369
|
+
hierarchy.setHighlightedElement(element);
|
|
370
|
+
|
|
371
|
+
// Get highlighted element
|
|
372
|
+
const highlighted = hierarchy.getHighlightedElement();
|
|
373
|
+
|
|
374
|
+
// Clear highlight
|
|
375
|
+
hierarchy.setHighlightedElement(null);
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
## Drag and Drop Reordering
|
|
379
|
+
|
|
380
|
+
Listen for reorder events when user drags items:
|
|
381
|
+
|
|
382
|
+
```javascript
|
|
383
|
+
const hierarchy = document.querySelector('ef-hierarchy');
|
|
384
|
+
|
|
385
|
+
hierarchy.addEventListener('hierarchy-reorder', (e) => {
|
|
386
|
+
const { sourceId, targetId, position } = e.detail;
|
|
387
|
+
// position is 'before', 'after', or 'inside'
|
|
388
|
+
console.log(`Move ${sourceId} ${position} ${targetId}`);
|
|
389
|
+
});
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
## Expansion State
|
|
393
|
+
|
|
394
|
+
Hierarchy automatically expands all items on initialization. Users can collapse and expand items by clicking the disclosure triangle.
|
|
395
|
+
<!-- /html-only -->
|
|
396
|
+
|
|
397
|
+
<!-- react-only -->
|
|
398
|
+
## Features
|
|
399
|
+
|
|
400
|
+
- **Tree structure**: Displays nested timegroups and elements
|
|
401
|
+
- **Expand/collapse**: Click to expand or collapse nested items
|
|
402
|
+
- **Selection sync**: Syncs with canvas selection state
|
|
403
|
+
- **Drag and drop**: Reorder elements by dragging (when supported)
|
|
404
|
+
- **Visual feedback**: Highlights selected and hovered elements
|
|
405
|
+
- **Context menu**: Right-click for element actions
|
|
406
|
+
- **Auto-scroll**: Scrolls to selected element
|
|
407
|
+
<!-- /react-only -->
|
|
408
|
+
|
|
409
|
+
## Styling
|
|
410
|
+
|
|
411
|
+
Hierarchy uses CSS custom properties:
|
|
412
|
+
|
|
413
|
+
```css
|
|
414
|
+
ef-hierarchy {
|
|
415
|
+
--hierarchy-bg: #fff;
|
|
416
|
+
--hierarchy-border: #e0e0e0;
|
|
417
|
+
--hierarchy-text: #000;
|
|
418
|
+
--hierarchy-hover-bg: #f0f0f0;
|
|
419
|
+
--hierarchy-selected-bg: #e3f2fd;
|
|
420
|
+
--hierarchy-ancestor-selected-bg: #f5f5f5;
|
|
421
|
+
--hierarchy-focused-bg: #bbdefb;
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
## Item Variants
|
|
426
|
+
|
|
427
|
+
<!-- html-only -->
|
|
428
|
+
Hierarchy automatically renders appropriate icons and labels for each element type:
|
|
429
|
+
|
|
430
|
+
- **ef-timegroup** - Container icon with duration
|
|
431
|
+
- **ef-video** - Video icon with filename
|
|
432
|
+
- **ef-audio** - Audio icon with filename
|
|
433
|
+
- **ef-image** - Image icon with filename
|
|
434
|
+
- **ef-text** - Text icon with preview
|
|
435
|
+
- **ef-captions** - Caption icon
|
|
436
|
+
- **ef-waveform** - Waveform icon
|
|
437
|
+
- **ef-surface** - Mirror icon
|
|
438
|
+
- **div** and other HTML - HTML tag name
|
|
439
|
+
<!-- /html-only -->
|
|
440
|
+
<!-- react-only -->
|
|
441
|
+
The hierarchy displays specialized items for each element type:
|
|
442
|
+
|
|
443
|
+
- `ef-timegroup` - Timegroup container
|
|
444
|
+
- `ef-video` - Video layer
|
|
445
|
+
- `ef-audio` - Audio layer
|
|
446
|
+
- `ef-image` - Image layer
|
|
447
|
+
- `ef-text` - Text layer
|
|
448
|
+
- `ef-captions` - Captions layer
|
|
449
|
+
- `ef-surface` - Surface (mirror) layer
|
|
450
|
+
- `ef-waveform` - Waveform visualization
|
|
451
|
+
<!-- /react-only -->
|
|
452
|
+
|
|
453
|
+
<!-- html-only -->
|
|
454
|
+
## Auto-Selection
|
|
455
|
+
|
|
456
|
+
When target changes, hierarchy automatically selects the first root timegroup if nothing is selected.
|
|
457
|
+
<!-- /html-only -->
|
|
458
|
+
|
|
459
|
+
<!-- react-only -->
|
|
460
|
+
## Events
|
|
461
|
+
|
|
462
|
+
### hierarchy-select
|
|
463
|
+
|
|
464
|
+
Fired when an element is selected in the hierarchy:
|
|
465
|
+
|
|
466
|
+
```typescript
|
|
467
|
+
interface HierarchySelectDetail {
|
|
468
|
+
elementId: string | null;
|
|
469
|
+
}
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### hierarchy-reorder
|
|
473
|
+
|
|
474
|
+
Fired when elements are reordered:
|
|
475
|
+
|
|
476
|
+
```typescript
|
|
477
|
+
interface HierarchyReorderDetail {
|
|
478
|
+
sourceId: string;
|
|
479
|
+
targetId: string;
|
|
480
|
+
position: "before" | "after" | "inside";
|
|
481
|
+
}
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
## Methods
|
|
485
|
+
|
|
486
|
+
### select()
|
|
487
|
+
|
|
488
|
+
Programmatically select an element:
|
|
489
|
+
|
|
490
|
+
```tsx
|
|
491
|
+
const hierarchy = hierarchyRef.current;
|
|
492
|
+
if (hierarchy) {
|
|
493
|
+
(hierarchy as any).select("element-id");
|
|
494
|
+
}
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
### getSelectedElementId()
|
|
498
|
+
|
|
499
|
+
Get the currently selected element ID:
|
|
500
|
+
|
|
501
|
+
```tsx
|
|
502
|
+
const hierarchy = hierarchyRef.current;
|
|
503
|
+
if (hierarchy) {
|
|
504
|
+
const selectedId = (hierarchy as any).getSelectedElementId();
|
|
505
|
+
console.log("Selected:", selectedId);
|
|
506
|
+
}
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
## Integration with Canvas
|
|
510
|
+
|
|
511
|
+
The hierarchy component works with `ef-canvas` to provide:
|
|
512
|
+
|
|
513
|
+
- **Selection coordination**: Clicks in hierarchy select canvas elements
|
|
514
|
+
- **Highlight sync**: Hover in hierarchy highlights canvas elements
|
|
515
|
+
- **State sharing**: Uses Lit context for state synchronization
|
|
516
|
+
- **Direct DOM access**: Can work as sibling via target ID
|
|
517
|
+
|
|
518
|
+
## Important Notes
|
|
519
|
+
|
|
520
|
+
- Currently requires using HTML element syntax in React
|
|
521
|
+
- Target should be an `ef-canvas` or `ef-timegroup` element ID
|
|
522
|
+
- Automatically initializes with all items expanded
|
|
523
|
+
- Auto-selects first root timegroup on mount
|
|
524
|
+
- Filters can use CSS selectors or data attributes
|
|
525
|
+
- Selection state syncs bidirectionally with canvas
|
|
526
|
+
- Use `show-header` to display panel title
|
|
527
|
+
- Hierarchy updates automatically when DOM changes
|
|
528
|
+
|
|
529
|
+
## Future React Component
|
|
530
|
+
|
|
531
|
+
When officially exported as a React component, usage will be:
|
|
532
|
+
|
|
533
|
+
```tsx
|
|
534
|
+
import { Hierarchy } from "@editframe/react";
|
|
535
|
+
|
|
536
|
+
<Hierarchy
|
|
537
|
+
target="canvas"
|
|
538
|
+
header="Layers"
|
|
539
|
+
showHeader
|
|
540
|
+
hideSelectors={[".helper"]}
|
|
541
|
+
onSelectionChange={(e) => console.log(e.detail)}
|
|
542
|
+
/>
|
|
543
|
+
```
|
|
544
|
+
<!-- /react-only -->
|