@aicut/core 0.4.2 → 0.4.3

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 CHANGED
@@ -131,17 +131,30 @@ Editor.create({ container, project, locale: localeZh });
131
131
  editor.setLocale({ undo: "Annuler" }); // partial override
132
132
  ```
133
133
 
134
- ## Toolbar slots
134
+ ## Host slots
135
135
 
136
- Both the editor's toolbar and the standalone `Timeline`'s optional toolbar expose `toolbarLeft` / `toolbarRight` slot DOM elements. The library renders nothing into them append your own buttons.
136
+ The editor reserves four slot DOM elements for host-supplied controls. Library paints nothing into any of them; populated slots show, empty ones collapse.
137
137
 
138
138
  ```ts
139
+ // Header above the preview — collapses entirely when both empty.
140
+ editor.headerLeft.textContent = "Untitled project";
139
141
  const exportBtn = document.createElement("button");
140
142
  exportBtn.textContent = "Export";
141
143
  exportBtn.onclick = () => editor.requestExport();
142
- editor.toolbarRight.appendChild(exportBtn);
144
+ editor.headerRight.appendChild(exportBtn);
145
+
146
+ // Toolbar bookends (next to the built-in icons)
147
+ editor.toolbarLeft.appendChild(aspectDropdown);
148
+ editor.toolbarRight.appendChild(customIconBtn);
143
149
  ```
144
150
 
151
+ | Slot | Where |
152
+ | --- | --- |
153
+ | `editor.headerLeft` / `editor.headerRight` | Optional header row above the preview |
154
+ | `editor.toolbarLeft` / `editor.toolbarRight` | Bookends on the toolbar row |
155
+
156
+ The standalone `Timeline` also exposes `toolbarLeft` / `toolbarRight` when constructed with `toolbar: true`.
157
+
145
158
  ## Lighting picker (opt-in sub-entry)
146
159
 
147
160
  A separate component for AI-relighting workflows — drag a light dot around a 3D sphere wrapping a subject frame, control brightness / color / direction. Three.js is bundled only on this sub-entry, so consumers of the video editor pay zero bytes for it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aicut/core",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Framework-agnostic core for the AiCut video editor — canvas timeline, data model, HTML5 playback engine, plus an opt-in 3D lighting picker.",
5
5
  "license": "MIT",
6
6
  "author": "ziqiang <ziqiangytu@gmail.com>",
package/styles/theme.css CHANGED
@@ -52,10 +52,14 @@
52
52
  --aicut-playhead-color: var(--color-brand);
53
53
 
54
54
  display: grid;
55
- /* header (auto, hidden when empty) · preview (1fr) · toolbar (auto)
56
- · timeline (auto). When the header is empty the :has() rule below
57
- overrides the template to drop the row so today's layout stays
58
- identical for callers who don't use the header slots. */
55
+ /* Four explicit rows: header / preview / toolbar / timeline. When
56
+ the header is hidden (empty slots → display:none below), browsers
57
+ would otherwise auto-reflow the remaining three children into
58
+ rows 1/2/3 which would put the preview in the `auto` row and
59
+ toolbar in the `1fr` row, causing the preview to collapse and a
60
+ big gap between toolbar and timeline. The explicit grid-row
61
+ assignments on the children pin each surface to its intended
62
+ row regardless of which siblings are present. */
59
63
  grid-template-rows: auto 1fr auto auto;
60
64
  width: 100%;
61
65
  height: 100%;
@@ -159,17 +163,20 @@
159
163
  }
160
164
 
161
165
  /* Auto-hide when both slots are empty — keep today's default layout
162
- exactly as it was for callers that don't use the header. */
166
+ exactly as it was for callers that don't use the header. With the
167
+ per-child grid-row assignments below, display:none here cleanly
168
+ removes the header without reflowing preview/toolbar/timeline. */
163
169
  .aicut-root:has(.aicut-header-left:empty):has(.aicut-header-right:empty)
164
170
  .aicut-header {
165
171
  display: none;
166
172
  }
167
- /* Fallback for browsers without :has() — collapse the grid row when
168
- the header is hidden via the above rule. Modern Chrome/Safari/
169
- Firefox all support :has() so this is rarely needed. */
170
- .aicut-root:not(:has(.aicut-header *)) {
171
- grid-template-rows: 1fr auto auto;
172
- }
173
+
174
+ /* Pin each editor surface to its intended row. Required so the four
175
+ children can't auto-reflow when one (e.g. the header) is hidden. */
176
+ .aicut-root > .aicut-header { grid-row: 1; }
177
+ .aicut-root > .aicut-preview-host { grid-row: 2; }
178
+ .aicut-root > .aicut-toolbar { grid-row: 3; }
179
+ .aicut-root > .aicut-timeline { grid-row: 4; }
173
180
 
174
181
  .aicut-header-slot {
175
182
  display: flex;