@pixerate/editor-react 0.91.1 → 0.92.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/canvas/AgentPresenceLayer.d.cts +3 -0
- package/dist/canvas/AgentPresenceLayer.d.ts +3 -0
- package/dist/canvas/index.cjs +1032 -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/{chunk-SMMO7CZB.js → chunk-6MDTFAPY.js} +84 -2
- package/dist/chunk-ECBC4HD7.js +95 -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 +1027 -864
- package/dist/image-editor/index.js +2 -1
- package/dist/index.cjs +1986 -1810
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -2
- 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 +3 -0
- package/dist/playback/index.d.ts +3 -0
- package/dist/playback/usePlaybackSurface.d.cts +9 -0
- package/dist/playback/usePlaybackSurface.d.ts +9 -0
- package/dist/vector/VectorCanvas.d.cts +11 -1
- package/dist/vector/VectorCanvas.d.ts +11 -1
- package/dist/vector/index.cjs +945 -826
- package/dist/vector/index.js +42 -3
- package/package.json +3 -3
package/dist/vector/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PresenceLayer,
|
|
3
|
+
useAgentPlayback,
|
|
4
|
+
usePlaybackSurface
|
|
5
|
+
} from "../chunk-ECBC4HD7.js";
|
|
1
6
|
import {
|
|
2
7
|
EffectParameters,
|
|
3
8
|
EffectsBrowser,
|
|
@@ -94,7 +99,8 @@ import {
|
|
|
94
99
|
isVectorTextTarget,
|
|
95
100
|
toVectorKeyInput,
|
|
96
101
|
toVectorPointerInput,
|
|
97
|
-
vectorDiamondPath
|
|
102
|
+
vectorDiamondPath,
|
|
103
|
+
createVectorPlaybackLocator
|
|
98
104
|
} from "@pixerate/editor/vector";
|
|
99
105
|
|
|
100
106
|
// src/vector/VectorWidthPointEditor.tsx
|
|
@@ -372,7 +378,10 @@ function VectorCanvas({
|
|
|
372
378
|
guideColor = THEME2.guide,
|
|
373
379
|
className,
|
|
374
380
|
style,
|
|
375
|
-
"aria-label": ariaLabel = "Vector canvas"
|
|
381
|
+
"aria-label": ariaLabel = "Vector canvas",
|
|
382
|
+
playback,
|
|
383
|
+
playbackId = "vector",
|
|
384
|
+
onPlaybackReveal
|
|
376
385
|
}) {
|
|
377
386
|
const state = useVectorEditorState(controller);
|
|
378
387
|
const svgRef = useRef3(null);
|
|
@@ -426,6 +435,34 @@ function VectorCanvas({
|
|
|
426
435
|
el.addEventListener("wheel", onWheel, { passive: false });
|
|
427
436
|
return () => el.removeEventListener("wheel", onWheel);
|
|
428
437
|
}, [controller]);
|
|
438
|
+
const ambientPlayback = useAgentPlayback();
|
|
439
|
+
const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
|
|
440
|
+
const [locate] = useState2(() => createVectorPlaybackLocator(controller));
|
|
441
|
+
const svgBox = () => svgRef.current?.getBoundingClientRect() ?? null;
|
|
442
|
+
const presence = usePlaybackSurface(playing, playbackId, {
|
|
443
|
+
defaultKind: "vector",
|
|
444
|
+
locate,
|
|
445
|
+
bounds: () => {
|
|
446
|
+
const r = svgBox();
|
|
447
|
+
const v = controller.getState().viewport;
|
|
448
|
+
return r && r.width > 0 ? { x: -v.x / v.zoom, y: -v.y / v.zoom, width: r.width / v.zoom, height: r.height / v.zoom } : null;
|
|
449
|
+
},
|
|
450
|
+
visible: () => {
|
|
451
|
+
const r = svgBox();
|
|
452
|
+
return !!r && r.width > 0 && r.height > 0 && !(typeof document !== "undefined" && document.visibilityState === "hidden");
|
|
453
|
+
},
|
|
454
|
+
toViewport: (p) => {
|
|
455
|
+
const r = svgBox();
|
|
456
|
+
const v = controller.getState().viewport;
|
|
457
|
+
return { x: (r?.left ?? 0) + p.x * v.zoom + v.x, y: (r?.top ?? 0) + p.y * v.zoom + v.y };
|
|
458
|
+
},
|
|
459
|
+
fromViewport: (p) => {
|
|
460
|
+
const r = svgBox();
|
|
461
|
+
const v = controller.getState().viewport;
|
|
462
|
+
return { x: (p.x - (r?.left ?? 0) - v.x) / v.zoom, y: (p.y - (r?.top ?? 0) - v.y) / v.zoom };
|
|
463
|
+
},
|
|
464
|
+
reveal: () => onPlaybackReveal?.()
|
|
465
|
+
});
|
|
429
466
|
const local = (e) => {
|
|
430
467
|
const rect = svgRef.current?.getBoundingClientRect();
|
|
431
468
|
return { x: e.clientX - (rect?.left ?? 0), y: e.clientY - (rect?.top ?? 0) };
|
|
@@ -814,7 +851,9 @@ function VectorCanvas({
|
|
|
814
851
|
}
|
|
815
852
|
) }),
|
|
816
853
|
edit && editAt && // Width Point Edit (double-click with the width tool), beside the point.
|
|
817
|
-
/* @__PURE__ */ jsx2("foreignObject", { "data-vector-width-point-edit": "", x: editAt.x + 12, y: editAt.y + 12, width: 180, height: 140, style: { overflow: "visible" }, children: /* @__PURE__ */ jsx2(VectorWidthPointEditor, { controller, edit, accentColor }, `${edit.nodeId}:${edit.index}:${edit.t}`) })
|
|
854
|
+
/* @__PURE__ */ jsx2("foreignObject", { "data-vector-width-point-edit": "", x: editAt.x + 12, y: editAt.y + 12, width: 180, height: 140, style: { overflow: "visible" }, children: /* @__PURE__ */ jsx2(VectorWidthPointEditor, { controller, edit, accentColor }, `${edit.nodeId}:${edit.index}:${edit.t}`) }),
|
|
855
|
+
playing && // The agent's cursor (agent playback), over everything and never in the way.
|
|
856
|
+
/* @__PURE__ */ jsx2("foreignObject", { "data-vector-presence": "", x: 0, y: 0, width: "100%", height: "100%", pointerEvents: "none", style: { overflow: "visible", pointerEvents: "none" }, children: /* @__PURE__ */ jsx2("div", { style: { position: "relative", width: "100%", height: "100%" }, children: /* @__PURE__ */ jsx2(PresenceLayer, { presence, viewport: state.viewport }) }) })
|
|
818
857
|
]
|
|
819
858
|
}
|
|
820
859
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.92.0",
|
|
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.141.0 <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.141.0"
|
|
250
250
|
},
|
|
251
251
|
"scripts": {
|
|
252
252
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|