Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

drad from panel moslty works

Roman Pominov05046a242c69
diff --git a/apps/designer/app/canvas/shared/instance.ts b/apps/designer/app/canvas/shared/instance.ts
index aac70dbb9e..37cb6cb92d 100644
--- a/apps/designer/app/canvas/shared/instance.ts
+++ b/apps/designer/app/canvas/shared/instance.ts
@@ -48,8 +48,12 @@ export const useInsertInstance = () => {
useSubscribe<
"insertInstance",
- { instance: Instance; /*dropData?: DropData;*/ props?: InstanceProps }
- >("insertInstance", ({ instance, /*dropData,*/ props }) => {
+ {
+ instance: Instance;
+ dropTarget?: { instanceId: Instance["id"]; position: number };
+ props?: InstanceProps;
+ }
+ >("insertInstance", ({ instance, dropTarget, props }) => {
store.createTransaction(
[rootInstanceContainer, allUserPropsContainer],
(rootInstance, allUserProps) => {
@@ -60,9 +64,8 @@ export const useInsertInstance = () => {
populatedInstance,
{
parentId:
- /*dropData?.instance.id ??*/ selectedInstance?.id ??
- rootInstance.id,
- position: /*dropData?.position ||*/ "end",
+ dropTarget?.instanceId ?? selectedInstance?.id ?? rootInstance.id,
+ position: dropTarget?.position || "end",
}
);
if (hasInserted) {
diff --git a/apps/designer/app/canvas/shared/use-drag-drop.ts b/apps/designer/app/canvas/shared/use-drag-drop.ts
index 271a653797..a4e117a1fc 100644
--- a/apps/designer/app/canvas/shared/use-drag-drop.ts
+++ b/apps/designer/app/canvas/shared/use-drag-drop.ts
@@ -10,7 +10,7 @@ import {
} from "~/shared/design-system/components/primitives/dnd";
import { findInstanceById, getInstancePath } from "~/shared/tree-utils";
import { primitives } from "~/shared/canvas-components";
-import { publish, type Instance } from "@webstudio-is/react-sdk";
+import { publish, useSubscribe, type Instance } from "@webstudio-is/react-sdk";
// data shared between iframe and main window
export type DropTargetSharedData = {
@@ -42,12 +42,7 @@ export const useDragAndDrop = () => {
payload: {
rect: dropTarget.rect,
placementRect: placement.placementRect,
-
- // @todo: adjust index if the parent stays the same
- // (account for the item being removed from the old position)
- // Can the hook do that for us automatically?
position: placement.index,
-
instanceId: dropTarget.data.id,
instanceComponent: dropTarget.data.component,
},
@@ -138,13 +133,20 @@ export const useDragAndDrop = () => {
return;
}
+ // @todo: If we can't find the data corresponding to the target element,
+ // should we climb up the DOM tree for another element?
+ // Should the hook do that for us?
+
state.current.dragItem = instance;
autoScrollHandlers.setEnabled(true);
- publish<"dragStart", { dragItem: { instance: Instance } }>({
+ publish<
+ "dragStart",
+ { origin: "panel" | "canvas"; dragItem: { instance: Instance } }
+ >({
type: "dragStart",
- payload: { dragItem: { instance } },
+ payload: { origin: "canvas", dragItem: { instance } },
});
},
onMove: (poiterCoordinate) => {
@@ -157,7 +159,10 @@ export const useDragAndDrop = () => {
autoScrollHandlers.setEnabled(false);
placementHandlers.handleEnd();
- publish<"dragEnd">({ type: "dragEnd" });
+ publish<"dragEnd", { origin: "panel" | "canvas" }>({
+ type: "dragEnd",
+ payload: { origin: "canvas" },
+ });
const { dropTarget, placement, dragItem } = state.current;
@@ -221,4 +226,60 @@ export const useDragAndDrop = () => {
// @todo: need to make the dependencies more stable,
// because as is this will fire on every render
}, [dragProps, dropTargetHandlers, placementHandlers, autoScrollHandlers]);
+
+ // Handle drag from the panel
+ // ================================================================
+
+ useSubscribe<
+ "dragStart",
+ { origin: "panel" | "canvas"; dragItem: { instance: Instance } }
+ >("dragStart", ({ origin, dragItem }) => {
+ if (origin === "panel") {
+ state.current.dragItem = dragItem.instance;
+ autoScrollHandlers.setEnabled(true);
+ }
+ });
+
+ useSubscribe<"dragMove", { canvasCoordinates: { x: number; y: number } }>(
+ "dragMove",
+ ({ canvasCoordinates }) => {
+ dropTargetHandlers.handleMove(canvasCoordinates);
+ autoScrollHandlers.handleMove(canvasCoordinates);
+ placementHandlers.handleMove(canvasCoordinates);
+ }
+ );
+
+ useSubscribe<"dragEnd", { origin: "panel" | "canvas" }>(
+ "dragEnd",
+ ({ origin }) => {
+ if (origin === "panel") {
+ dropTargetHandlers.handleEnd();
+ autoScrollHandlers.setEnabled(false);
+ placementHandlers.handleEnd();
+
+ const { dropTarget, placement, dragItem } = state.current;
+
+ if (dropTarget && placement && dragItem) {
+ publish<
+ "insertInstance",
+ {
+ instance: Instance;
+ dropTarget: { instanceId: Instance["id"]; position: number };
+ }
+ >({
+ type: "insertInstance",
+ payload: {
+ instance: dragItem,
+ dropTarget: {
+ instanceId: dropTarget.data.id,
+ position: placement.index,
+ },
+ },
+ });
+ }
+
+ state.current = { ...initialState };
+ }
+ }
+ );
};
diff --git a/apps/designer/app/designer/designer.tsx b/apps/designer/app/designer/designer.tsx
index 06a959f242..3816d323f0 100644
--- a/apps/designer/app/designer/designer.tsx
+++ b/apps/designer/app/designer/designer.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useState } from "react";
+import { useCallback } from "react";
import { useSubscribe, usePublish } from "@webstudio-is/react-sdk";
import { type Project, type Asset } from "@webstudio-is/prisma-client";
import type { Config } from "~/config";
@@ -67,16 +67,16 @@ const useSubscribeSyncStatus = () => {
useSubscribe<"syncStatus", SyncStatus>("syncStatus", setValue);
};
-const useIsDragging = (): [boolean, (isDragging: boolean) => void] => {
- const [isDragging, setIsDragging] = useState<boolean>(false);
- useSubscribe<"dragStartInstance">("dragStartInstance", () => {
- setIsDragging(true);
- });
- useSubscribe<"dragEndInstance">("dragEndInstance", () => {
- setIsDragging(false);
- });
- return [isDragging, setIsDragging];
-};
+// const useIsDragging = (): [boolean, (isDragging: boolean) => void] => {
+// const [isDragging, setIsDragging] = useState<boolean>(false);
+// useSubscribe<"dragStartInstance">("dragStartInstance", () => {
+// setIsDragging(true);
+// });
+// useSubscribe<"dragEndInstance">("dragEndInstance", () => {
+// setIsDragging(false);
+// });
+// return [isDragging, setIsDragging];
+// };
type SidePanelProps = {
children: JSX.Element | Array<JSX.Element>;
@@ -185,7 +185,7 @@ export const Designer = ({ config, project, assets }: DesignerProps) => {
useSubscribeClientSetting();
const [publish, publishRef] = usePublish();
const [isPreviewMode] = useIsPreviewMode();
- const [isDragging, setIsDragging] = useIsDragging();
+ // const [isDragging, setIsDragging] = useIsDragging();
usePublishShortcuts(publish);
const onRefReadCanvasWidth = useUpdateCanvasWidth();
const { onRef: onRefReadCanvas, onTransitionEnd } = useReadCanvasRect();
@@ -215,7 +215,11 @@ export const Designer = ({ config, project, assets }: DesignerProps) => {
<CanvasIframe
ref={iframeRefCallback}
src={`${config.canvasPath}/${project.id}`}
- pointerEvents={isDragging ? "none" : "all"}
+ pointerEvents={
+ dragAndDrop.isDragging && dragAndDrop.origin === "panel"
+ ? "none"
+ : "all"
+ }
title={project.title}
css={{
height: "100%",
@@ -227,7 +231,7 @@ export const Designer = ({ config, project, assets }: DesignerProps) => {
<SidePanel gridArea="sidebar" isPreviewMode={isPreviewMode}>
<SidebarLeft
assets={assets}
- onDragChange={setIsDragging}
+ // onDragChange={setIsDragging}
publish={publish}
/>
</SidePanel>
@@ -236,11 +240,13 @@ export const Designer = ({ config, project, assets }: DesignerProps) => {
isPreviewMode={isPreviewMode}
css={{ overflow: "hidden" }}
>
- {isDragging || dragAndDrop.isDragging ? (
- <TreePrevew />
- ) : (
- <Inspector publish={publish} />
- )}
+ {
+ /*isDragging ||*/ dragAndDrop.isDragging ? (
+ <TreePrevew />
+ ) : (
+ <Inspector publish={publish} />
+ )
+ }
</SidePanel>
<Breadcrumbs publish={publish} />
</ChromeWrapper>
diff --git a/apps/designer/app/designer/features/sidebar-left/panels/components/components.tsx b/apps/designer/app/designer/features/sidebar-left/panels/components/components.tsx
index 7a8b30872d..8918b3a240 100644
--- a/apps/designer/app/designer/features/sidebar-left/panels/components/components.tsx
+++ b/apps/designer/app/designer/features/sidebar-left/panels/components/components.tsx
@@ -1,56 +1,124 @@
-import { type MouseEventHandler, useCallback } from "react";
+import { type MouseEventHandler, useState } from "react";
import { type Instance, type Publish } from "@webstudio-is/react-sdk";
import { Flex } from "~/shared/design-system";
import { PlusIcon } from "~/shared/icons";
import { primitives } from "~/shared/canvas-components";
import { createInstance } from "~/shared/tree-utils";
+import { useDrag } from "~/shared/design-system/components/primitives/dnd";
import type { TabName } from "../../types";
import { ComponentThumb } from "./component-thumb";
+import { useCanvasRect, useZoom } from "~/designer/shared/nano-states";
-type UseDraggableProps = {
- component: Instance["component"];
- onDragChange: (isDragging: boolean) => void;
-};
+const components = (
+ Object.keys(primitives) as Array<Instance["component"]>
+).filter((component) => primitives[component].isInlineOnly === false);
+
+// type UseDraggableProps = {
+// component: Instance["component"];
+// onDragChange: (isDragging: boolean) => void;
+// };
type DraggableThumbProps = {
onClick: MouseEventHandler<HTMLDivElement>;
-} & UseDraggableProps;
+ component: Instance["component"];
+};
const DraggableThumb = ({
component,
// onDragChange,
onClick,
}: DraggableThumbProps) => {
- return <ComponentThumb component={component} onClick={onClick} />;
+ return (
+ <ComponentThumb
+ data-drag-component={component}
+ component={component}
+ onClick={onClick}
+ />
+ );
};
type TabContentProps = {
- onDragChange: UseDraggableProps["onDragChange"];
+ // onDragChange: UseDraggableProps["onDragChange"];
onSetActiveTab: (tabName: TabName) => void;
publish: Publish;
};
export const TabContent = ({
- onDragChange,
+ // onDragChange,
publish,
onSetActiveTab,
}: TabContentProps) => {
- const components = (
- Object.keys(primitives) as Array<Instance["component"]>
- ).filter((component) => primitives[component].isInlineOnly === false);
-
- const handleDragChange = useCallback(
- (isDragging: boolean) => {
- onDragChange(isDragging);
- publish<"dragStartInstance" | "dragEndInstance">({
- type: isDragging === true ? "dragStartInstance" : "dragEndInstance",
+ const [_dragItem, setDragItem] = useState<{
+ component: Instance["component"];
+ originalPointerPosition: { x: number; y: number };
+ }>();
+
+ const [canvasRect] = useCanvasRect();
+ const [zoom] = useZoom();
+
+ const toCanvasCoordinates = ({ x, y }: { x: number; y: number }) => {
+ if (canvasRect === undefined) {
+ return { x: 0, y: 0 };
+ }
+ const scale = zoom / 100;
+ return { x: (x - canvasRect.x) / scale, y: (y - canvasRect.y) / scale };
+ };
+
+ const dragProps = useDrag({
+ onStart(event) {
+ const { dragComponent } = event.target.dataset;
+ const { x, y } = event;
+
+ const component =
+ dragComponent != null && components.find((c) => c === dragComponent);
+
+ if (!component) {
+ event.cancel();
+ return;
+ }
+
+ const instance = createInstance({ component });
+
+ setDragItem({
+ component,
+ originalPointerPosition: { x, y },
+ });
+
+ publish<
+ "dragStart",
+ { origin: "panel" | "canvas"; dragItem: { instance: Instance } }
+ >({
+ type: "dragStart",
+ payload: { origin: "panel", dragItem: { instance } },
});
},
- [onDragChange, publish]
- );
+ onMove: (poiterCoordinate) => {
+ publish<"dragMove", { canvasCoordinates: { x: number; y: number } }>({
+ type: "dragMove",
+ payload: { canvasCoordinates: toCanvasCoordinates(poiterCoordinate) },
+ });
+ },
+ onEnd() {
+ setDragItem(undefined);
+ publish<"dragEnd", { origin: "panel" | "canvas" }>({
+ type: "dragEnd",
+ payload: { origin: "panel" },
+ });
+ },
+ });
+
+ // const handleDragChange = useCallback(
+ // (isDragging: boolean) => {
+ // onDragChange(isDragging);
+ // publish<"dragStartInstance" | "dragEndInstance">({
+ // type: isDragging === true ? "dragStartInstance" : "dragEndInstance",
+ // });
+ // },
+ // [onDragChange, publish]
+ // );
return (
- <Flex gap="1" wrap="wrap" css={{ padding: "$1" }}>
+ <Flex gap="1" wrap="wrap" css={{ padding: "$1" }} {...dragProps}>
{components.map((component: Instance["component"]) => (
<DraggableThumb
key={component}
@@ -62,7 +130,7 @@ export const TabContent = ({
payload: { instance: createInstance({ component }) },
});
}}
- onDragChange={handleDragChange}
+ // onDragChange={handleDragChange}
/>
))}
</Flex>
@@ -70,3 +138,54 @@ export const TabContent = ({
};
export const icon = <PlusIcon />;
+
+/*
+export const CustomDragLayer = ({ onDrag }: CustomDragLayerProps) => {
+ const { component, isDragging, clientOffset, sourceClientOffset } =
+ useDragLayer((monitor) => ({
+ component: monitor.getItemType() as Instance["component"],
+ isDragging: monitor.isDragging(),
+ clientOffset: monitor.getClientOffset(),
+ sourceClientOffset: monitor.getSourceClientOffset(),
+ }));
+ const [canvasRect] = useCanvasRect();
+ const [zoom] = useZoom();
+
+ useEffect(() => {
+ if (
+ clientOffset === null ||
+ component === null ||
+ canvasRect === undefined
+ ) {
+ return;
+ }
+
+ const scale = zoom / 100;
+ const currentOffset = {
+ x: (clientOffset.x - canvasRect.x) / scale,
+ y: (clientOffset.y - canvasRect.y) / scale,
+ };
+
+ onDrag({
+ currentOffset,
+ component,
+ });
+ }, [clientOffset, component, onDrag, zoom, canvasRect]);
+
+ if (isDragging === false || sourceClientOffset === null) return null;
+
+ return createPortal(
+ <div style={layerStyles}>
+ <ComponentThumb
+ component={component}
+ style={{
+ transform: `translate3d(${sourceClientOffset.x}px, ${sourceClientOffset.y}px, 0)`,
+ }}
+ state="dragging"
+ />
+ </div>,
+ document.body
+ );
+};
+
+*/
diff --git a/apps/designer/app/designer/features/sidebar-left/sidebar-left.tsx b/apps/designer/app/designer/features/sidebar-left/sidebar-left.tsx
index 65b9cd96b8..00fed11978 100644
--- a/apps/designer/app/designer/features/sidebar-left/sidebar-left.tsx
+++ b/apps/designer/app/designer/features/sidebar-left/sidebar-left.tsx
@@ -1,4 +1,4 @@
-import { useState, useCallback } from "react";
+import { useState } from "react";
import { useSubscribe, type Publish } from "@webstudio-is/react-sdk";
import type { Asset } from "@webstudio-is/prisma-client";
import {
@@ -26,13 +26,13 @@ const sidebarTabsContentStyle = {
const none = { TabContent: () => null };
type SidebarLeftProps = {
- onDragChange: (isDragging: boolean) => void;
+ // onDragChange: (isDragging: boolean) => void;
publish: Publish;
assets: Array<Asset>;
};
export const SidebarLeft = ({
- onDragChange,
+ // onDragChange,
publish,
assets,
}: SidebarLeftProps) => {
@@ -51,16 +51,16 @@ export const SidebarLeft = ({
setIsDragging(false);
});
- const handleDragChange = useCallback(
- (isDragging: boolean) => {
- // After dragging is done, container is going to become visible
- // and we need to close it for good.
- if (isDragging === false) setActiveTab("none");
- setIsDragging(isDragging);
- onDragChange(isDragging);
- },
- [onDragChange]
- );
+ // const handleDragChange = useCallback(
+ // (isDragging: boolean) => {
+ // // After dragging is done, container is going to become visible
+ // // and we need to close it for good.
+ // if (isDragging === false) setActiveTab("none");
+ // setIsDragging(isDragging);
+ // onDragChange(isDragging);
+ // },
+ // [onDragChange]
+ // );
const enabledPanels = (
isFeatureEnabled("assets")
@@ -100,7 +100,7 @@ export const SidebarLeft = ({
selectedInstanceData={selectedInstanceData}
publish={publish}
onSetActiveTab={setActiveTab}
- onDragChange={handleDragChange}
+ // onDragChange={handleDragChange}
/>
</SidebarTabsContent>
</SidebarTabs>
diff --git a/apps/designer/app/shared/design-system/components/primitives/dnd/use-drag.ts b/apps/designer/app/shared/design-system/components/primitives/dnd/use-drag.ts
index 721e0ea7bf..2552acee8b 100644
--- a/apps/designer/app/shared/design-system/components/primitives/dnd/use-drag.ts
+++ b/apps/designer/app/shared/design-system/components/primitives/dnd/use-drag.ts
@@ -21,7 +21,12 @@ const initialState = {
export type UseDragProps = {
startDistanceThreashold?: number;
shiftDistanceThreshold?: number;
- onStart: (event: { target: HTMLElement; cancel: () => void }) => void;
+ onStart: (event: {
+ target: HTMLElement;
+ x: number;
+ y: number;
+ cancel: () => void;
+ }) => void;
onMove: (event: { x: number; y: number }) => void;
onShiftChange?: (event: { shifts: number }) => void;
onEnd: () => void;
@@ -76,7 +81,7 @@ export const useDrag = ({
initialY: y,
shifts: 0,
};
- onStart({ target, cancel });
+ onStart({ target, x, y, cancel });
},
onMove({ clientX: x, clientY: y }: { clientX: number; clientY: number }) {
if (state.current.status === "canceled") {
diff --git a/apps/designer/app/shared/dom-utils/get-drag-over-info.ts b/apps/designer/app/shared/dom-utils/get-drag-over-info.ts
index ad5e6e7e14..e17fda5075 100644
--- a/apps/designer/app/shared/dom-utils/get-drag-over-info.ts
+++ b/apps/designer/app/shared/dom-utils/get-drag-over-info.ts
@@ -1,36 +1,39 @@
-import type { Coordinate, DragOverInfo } from "./types";
-
-const elementFromPoint = (coordinate: Coordinate): HTMLElement | undefined => {
- const element = document.elementFromPoint(coordinate.x, coordinate.y);
- if (element instanceof HTMLElement) return element;
-};
-
-/**
- * Get element we are hovering over from coordinate.
- * When nearing to an edge of an element - return the parent.
- */
-export const getDragOverInfo = (
- offset: Coordinate,
- getBoundingClientRect: (element: Element) => DOMRect
-): DragOverInfo => {
- let element = elementFromPoint(offset);
- let edge: DragOverInfo["edge"] = "none";
-
- if (element === undefined) return { element, edge };
-
- const { bottom, y } = getBoundingClientRect(element);
- // We are at the top/bottom edge and this means user wants
- // to insert after that element into its parent
- if (offset.y - y <= 5) edge = "top";
- if (bottom - offset.y <= 5) edge = "bottom";
-
- if (edge === "none") return { element, edge };
-
- const { parentElement } = element;
-
- if (parentElement !== null && parentElement !== document.body) {
- element = parentElement;
- }
-
- return { element, edge };
-};
+// import type { Coordinate, DragOverInfo } from "./types";
+
+// const elementFromPoint = (coordinate: Coordinate): HTMLElement | undefined => {
+// const element = document.elementFromPoint(coordinate.x, coordinate.y);
+// if (element instanceof HTMLElement) return element;
+// };
+
+// /**
+// * Get element we are hovering over from coordinate.
+// * When nearing to an edge of an element - return the parent.
+// */
+// export const getDragOverInfo = (
+// offset: Coordinate,
+// getBoundingClientRect: (element: Element) => DOMRect
+// ): DragOverInfo => {
+// let element = elementFromPoint(offset);
+// let edge: DragOverInfo["edge"] = "none";
+
+// if (element === undefined) return { element, edge };
+
+// const { bottom, y } = getBoundingClientRect(element);
+// // We are at the top/bottom edge and this means user wants
+// // to insert after that element into its parent
+// if (offset.y - y <= 5) edge = "top";
+// if (bottom - offset.y <= 5) edge = "bottom";
+
+// if (edge === "none") return { element, edge };
+
+// const { parentElement } = element;
+
+// if (parentElement !== null && parentElement !== document.body) {
+// element = parentElement;
+// }
+
+// return { element, edge };
+// };
+
+// @todo: delete the file
+export const tmp = 1;
diff --git a/apps/designer/app/shared/dom-utils/types.ts b/apps/designer/app/shared/dom-utils/types.ts
index b9b2fe1adc..30775cc388 100644
--- a/apps/designer/app/shared/dom-utils/types.ts
+++ b/apps/designer/app/shared/dom-utils/types.ts
@@ -1,9 +1,12 @@
-export type Coordinate = { x: number; y: number };
-export type DragOverInfo = {
- element: HTMLElement | undefined;
- edge: "top" | "bottom" | "none";
-};
-export type ClosestChildInfo = {
- relativePosition: "before" | "after" | "inside";
- element: Element;
-};
+// export type Coordinate = { x: number; y: number };
+// export type DragOverInfo = {
+// element: HTMLElement | undefined;
+// edge: "top" | "bottom" | "none";
+// };
+// export type ClosestChildInfo = {
+// relativePosition: "before" | "after" | "inside";
+// element: Element;
+// };
+
+// @todo: delete the file
+export const tmp = 1;
diff --git a/apps/designer/app/shared/nano-states/nano-states.ts b/apps/designer/app/shared/nano-states/nano-states.ts
index 45c4374c79..013e189291 100644
--- a/apps/designer/app/shared/nano-states/nano-states.ts
+++ b/apps/designer/app/shared/nano-states/nano-states.ts
@@ -35,8 +35,11 @@ const textEditingInstanceIdContainer = createValueContainer<
export const useTextEditingInstanceId = () =>
useValue(textEditingInstanceIdContainer);
+// @todo: not sure it's a good idea to keep all this state in one container.
+// Spliting to separate containers may let us avoid some re-renders.
export type DragAndDropState = {
isDragging: boolean;
+ origin?: "canvas" | "panel";
dropTarget?: DropTargetSharedData;
dragItem?: { instance: Instance };
};
diff --git a/apps/designer/app/shared/nano-states/use-subscribe-drag-drop-state.ts b/apps/designer/app/shared/nano-states/use-subscribe-drag-drop-state.ts
index 1eba22389c..eaa5b104e0 100644
--- a/apps/designer/app/shared/nano-states/use-subscribe-drag-drop-state.ts
+++ b/apps/designer/app/shared/nano-states/use-subscribe-drag-drop-state.ts
@@ -14,14 +14,18 @@ export const useSubscribeDragAndDropState = () => {
}
);
- useSubscribe<"dragStart", { dragItem: { instance: Instance } }>(
+ useSubscribe<
"dragStart",
- ({ dragItem }) => {
- setState({ isDragging: true, dragItem });
- }
- );
+ { origin: "panel" | "canvas"; dragItem: { instance: Instance } }
+ >("dragStart", ({ origin, dragItem }) => {
+ setState({
+ isDragging: true,
+ origin,
+ dragItem,
+ });
+ });
- useSubscribe<"dragEnd">("dragEnd", () => {
+ useSubscribe<"dragEnd", { origin: "panel" | "canvas" }>("dragEnd", () => {
setState({ isDragging: false });
});
};