@pixerate/editor-react 0.91.1 → 0.93.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/animation-editor/AnimationEditor.d.cts +11 -1
- package/dist/animation-editor/AnimationEditor.d.ts +11 -1
- package/dist/animation-editor/index.cjs +494 -366
- package/dist/animation-editor/index.js +48 -4
- package/dist/canvas/AgentPresenceLayer.d.cts +3 -0
- package/dist/canvas/AgentPresenceLayer.d.ts +3 -0
- package/dist/canvas/index.cjs +1033 -893
- package/dist/canvas/index.d.cts +2 -0
- package/dist/canvas/index.d.ts +2 -0
- package/dist/canvas/index.js +125 -74
- package/dist/canvas/useCanvasPlaybackSurface.d.cts +28 -0
- package/dist/canvas/useCanvasPlaybackSurface.d.ts +28 -0
- package/dist/chart/ChartEditor.d.cts +12 -1
- package/dist/chart/ChartEditor.d.ts +12 -1
- package/dist/chart/index.cjs +187 -29
- package/dist/chart/index.js +74 -10
- package/dist/{chunk-SMMO7CZB.js → chunk-6YRSQW2V.js} +84 -2
- package/dist/chunk-7I73DW4V.js +43 -0
- package/dist/{chunk-GML6BYCN.js → chunk-GECXTPSH.js} +53 -3
- package/dist/chunk-IPVWWVSF.js +96 -0
- package/dist/hooks/useAgentToolProvider.d.cts +6 -2
- package/dist/hooks/useAgentToolProvider.d.ts +6 -2
- package/dist/image-editor/ImageEditor.d.cts +10 -0
- package/dist/image-editor/ImageEditor.d.ts +10 -0
- package/dist/image-editor/index.cjs +1028 -864
- package/dist/image-editor/index.js +2 -1
- package/dist/index.cjs +2070 -1812
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +21 -3
- package/dist/paint-editor/PaintEditor.d.cts +12 -1
- package/dist/paint-editor/PaintEditor.d.ts +12 -1
- package/dist/paint-editor/index.cjs +319 -164
- package/dist/paint-editor/index.js +84 -11
- package/dist/parameters/ParametersPanel.d.cts +11 -1
- package/dist/parameters/ParametersPanel.d.ts +11 -1
- package/dist/parameters/index.cjs +190 -41
- package/dist/parameters/index.js +23 -4
- package/dist/playback/AgentPlaybackContext.d.cts +9 -0
- package/dist/playback/AgentPlaybackContext.d.ts +9 -0
- package/dist/playback/PresenceLayer.d.cts +28 -0
- package/dist/playback/PresenceLayer.d.ts +28 -0
- package/dist/playback/index.d.cts +4 -0
- package/dist/playback/index.d.ts +4 -0
- package/dist/playback/useElementPlaybackSurface.d.cts +19 -0
- package/dist/playback/useElementPlaybackSurface.d.ts +19 -0
- package/dist/playback/usePlaybackSurface.d.cts +11 -0
- package/dist/playback/usePlaybackSurface.d.ts +11 -0
- package/dist/spreadsheet/SpreadsheetEditor.d.cts +10 -0
- package/dist/spreadsheet/SpreadsheetEditor.d.ts +10 -0
- package/dist/spreadsheet/index.cjs +443 -313
- package/dist/spreadsheet/index.js +2 -1
- package/dist/vector/VectorCanvas.d.cts +11 -1
- package/dist/vector/VectorCanvas.d.ts +11 -1
- package/dist/vector/index.cjs +946 -826
- package/dist/vector/index.js +42 -3
- package/dist/video-editor/VideoEditor.d.cts +6 -1
- package/dist/video-editor/VideoEditor.d.ts +6 -1
- package/dist/video-editor/VideoTimeline.d.cts +11 -1
- package/dist/video-editor/VideoTimeline.d.ts +11 -1
- package/dist/video-editor/index.cjs +463 -332
- package/dist/video-editor/index.js +53 -5
- package/package.json +3 -3
|
@@ -5,6 +5,11 @@ import {
|
|
|
5
5
|
useEffects
|
|
6
6
|
} from "../chunk-5R67YSSD.js";
|
|
7
7
|
import "../chunk-OTGJEYHV.js";
|
|
8
|
+
import {
|
|
9
|
+
PresenceLayer,
|
|
10
|
+
useAgentPlayback,
|
|
11
|
+
usePlaybackSurface
|
|
12
|
+
} from "../chunk-IPVWWVSF.js";
|
|
8
13
|
|
|
9
14
|
// src/video-editor/useVideoEditor.ts
|
|
10
15
|
import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
|
|
@@ -224,7 +229,8 @@ import {
|
|
|
224
229
|
videoClipTint,
|
|
225
230
|
videoDropTracks,
|
|
226
231
|
videoRulerTicks,
|
|
227
|
-
formatVideoSeconds
|
|
232
|
+
formatVideoSeconds,
|
|
233
|
+
parseVideoTimeRef
|
|
228
234
|
} from "@pixerate/editor/video-editor";
|
|
229
235
|
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
230
236
|
var HEADER = 150;
|
|
@@ -270,7 +276,7 @@ function useCachedRanges(controller, project, px) {
|
|
|
270
276
|
}, [controller, project, px]);
|
|
271
277
|
return ranges;
|
|
272
278
|
}
|
|
273
|
-
function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable = true, waveforms = "audio", className = "" }) {
|
|
279
|
+
function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable = true, waveforms = "audio", className = "", playback, playbackId = "video", onPlaybackReveal }) {
|
|
274
280
|
const state = useVideoEditorState(controller);
|
|
275
281
|
const { project, duration, time, selection, readOnly, error } = state;
|
|
276
282
|
const [ownZoom, setOwnZoom] = useState2(pxPerSecond ?? 100);
|
|
@@ -283,6 +289,47 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
|
|
|
283
289
|
const assets = videoAssetMap(project);
|
|
284
290
|
const sequences = videoSequenceMap(project);
|
|
285
291
|
const msToPx = (ms) => ms * px / 1e3;
|
|
292
|
+
const wrapperRef = useRef4(null);
|
|
293
|
+
const pxRef = useRef4(px);
|
|
294
|
+
pxRef.current = px;
|
|
295
|
+
const ambientPlayback = useAgentPlayback();
|
|
296
|
+
const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
|
|
297
|
+
const rectIn = (el) => {
|
|
298
|
+
const box = wrapperRef.current?.getBoundingClientRect();
|
|
299
|
+
const r = el?.getBoundingClientRect();
|
|
300
|
+
return box && r && r.width > 0 ? { x: r.left - box.left, y: r.top - box.top, width: r.width, height: r.height } : null;
|
|
301
|
+
};
|
|
302
|
+
const q = (selector) => wrapperRef.current?.querySelector(selector);
|
|
303
|
+
const agentPresence = usePlaybackSurface(playing, playbackId, {
|
|
304
|
+
defaultKind: "clip",
|
|
305
|
+
locate: (ref) => {
|
|
306
|
+
if (ref.kind === "clip") return rectIn(q(`[data-clip="${CSS.escape(ref.id)}"]`));
|
|
307
|
+
if (ref.kind === "track") return rectIn(q(`[data-track-lane="${CSS.escape(ref.id)}"]`));
|
|
308
|
+
if (ref.kind === "marker") return rectIn(q(`[data-marker="${CSS.escape(ref.id)}"]`));
|
|
309
|
+
const at = parseVideoTimeRef(ref);
|
|
310
|
+
if (!at) return null;
|
|
311
|
+
const lane = at.track ? q(`[data-track-lane="${CSS.escape(at.track)}"]`) : at.clip ? q(`[data-clip="${CSS.escape(at.clip)}"]`)?.closest("[data-track-lane]") : ruler.current;
|
|
312
|
+
const row = rectIn(lane);
|
|
313
|
+
return row ? { x: row.x + at.time * pxRef.current / 1e3 - 3, y: row.y, width: 6, height: row.height } : null;
|
|
314
|
+
},
|
|
315
|
+
bounds: () => {
|
|
316
|
+
const r = wrapperRef.current?.getBoundingClientRect();
|
|
317
|
+
return r && r.width > 0 ? { x: 0, y: 0, width: r.width, height: r.height } : null;
|
|
318
|
+
},
|
|
319
|
+
visible: () => {
|
|
320
|
+
const r = wrapperRef.current?.getBoundingClientRect();
|
|
321
|
+
return !!r && r.width > 0 && r.height > 0 && !(typeof document !== "undefined" && document.visibilityState === "hidden");
|
|
322
|
+
},
|
|
323
|
+
toViewport: (p) => {
|
|
324
|
+
const r = wrapperRef.current?.getBoundingClientRect();
|
|
325
|
+
return { x: (r?.left ?? 0) + p.x, y: (r?.top ?? 0) + p.y };
|
|
326
|
+
},
|
|
327
|
+
fromViewport: (p) => {
|
|
328
|
+
const r = wrapperRef.current?.getBoundingClientRect();
|
|
329
|
+
return { x: p.x - (r?.left ?? 0), y: p.y - (r?.top ?? 0) };
|
|
330
|
+
},
|
|
331
|
+
reveal: () => onPlaybackReveal?.()
|
|
332
|
+
});
|
|
286
333
|
const span = Math.max(duration + 5e3, 1e4);
|
|
287
334
|
const width = msToPx(span);
|
|
288
335
|
const ticks = videoRulerTicks(span, px, project.fps);
|
|
@@ -407,7 +454,8 @@ function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable
|
|
|
407
454
|
children: field2 === "muted" ? "M" : field2 === "hidden" ? "H" : "L"
|
|
408
455
|
}
|
|
409
456
|
);
|
|
410
|
-
return /* @__PURE__ */ jsxs3("div", { className: `flex flex-col gap-1 ${className}`, "data-video-timeline-wrapper": "", children: [
|
|
457
|
+
return /* @__PURE__ */ jsxs3("div", { ref: wrapperRef, className: `relative flex flex-col gap-1 ${className}`, "data-video-timeline-wrapper": "", children: [
|
|
458
|
+
playing && /* @__PURE__ */ jsx4(PresenceLayer, { presence: agentPresence }),
|
|
411
459
|
!onPxPerSecondChange && /* @__PURE__ */ jsxs3("label", { className: "flex items-center gap-2 self-end text-xs text-muted-foreground", children: [
|
|
412
460
|
"Zoom",
|
|
413
461
|
/* @__PURE__ */ jsx4("input", { type: "range", min: MIN_ZOOM, max: MAX_ZOOM, step: 5, value: ownZoom, "aria-label": "Timeline zoom", onChange: (e) => setOwnZoom(Number(e.target.value)), "data-zoom": "" })
|
|
@@ -1316,7 +1364,7 @@ function VideoEffectsPanel({ controller, className = "" }) {
|
|
|
1316
1364
|
|
|
1317
1365
|
// src/video-editor/VideoEditor.tsx
|
|
1318
1366
|
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1319
|
-
function VideoEditor({ controller: given, options, editable = true, pxPerSecond, onPxPerSecondChange, resolution, showIssues = true, showTranscript = true, showScopes = false, effects, showEffects, className = "" }) {
|
|
1367
|
+
function VideoEditor({ controller: given, options, editable = true, pxPerSecond, onPxPerSecondChange, resolution, showIssues = true, showTranscript = true, showScopes = false, effects, showEffects, className = "", playback, onPlaybackReveal }) {
|
|
1320
1368
|
const { controller, state } = useVideoEditor(given ?? options ?? {});
|
|
1321
1369
|
useEffects(controller, effects);
|
|
1322
1370
|
const effectsShown = showEffects ?? !!(state.effectsProvider || state.project.tracks.some((t) => t.clips.some((c) => c.type === "effect" || c.effects?.length || c.transition?.type === "effect")));
|
|
@@ -1341,7 +1389,7 @@ function VideoEditor({ controller: given, options, editable = true, pxPerSecond,
|
|
|
1341
1389
|
effectsShown && /* @__PURE__ */ jsx9(VideoEffectsPanel, { controller, className: "min-w-0" })
|
|
1342
1390
|
] })
|
|
1343
1391
|
] }),
|
|
1344
|
-
/* @__PURE__ */ jsx9(VideoTimeline, { controller, editable, pxPerSecond, onPxPerSecondChange }),
|
|
1392
|
+
/* @__PURE__ */ jsx9(VideoTimeline, { controller, editable, pxPerSecond, onPxPerSecondChange, playback, onPlaybackReveal }),
|
|
1345
1393
|
showTranscript && /* @__PURE__ */ jsx9(TranscriptPanel, { controller, editable }),
|
|
1346
1394
|
issueList
|
|
1347
1395
|
] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.93.1",
|
|
4
4
|
"description": "React bindings and prompt/rich-text components for @pixerate/editor",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
},
|
|
220
220
|
"peerDependencies": {
|
|
221
221
|
"@dagrejs/dagre": "^1.1.8",
|
|
222
|
-
"@pixerate/editor": ">=0.
|
|
222
|
+
"@pixerate/editor": ">=0.142.1 <1.0.0-0",
|
|
223
223
|
"@tiptap/core": "^2.27.3",
|
|
224
224
|
"@tiptap/pm": "^2.27.3",
|
|
225
225
|
"@tiptap/react": "^2.27.3",
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
"tsup": "^9.0.0",
|
|
247
247
|
"typescript": "^5.7.3",
|
|
248
248
|
"vitest": "^5.0.5",
|
|
249
|
-
"@pixerate/editor": "0.
|
|
249
|
+
"@pixerate/editor": "0.142.1"
|
|
250
250
|
},
|
|
251
251
|
"scripts": {
|
|
252
252
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|