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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix merge
Roman Pominovb669e1e27dd5
diff --git a/apps/designer/app/canvas/shared/use-drag-drop.ts b/apps/designer/app/canvas/shared/use-drag-drop.tsindex 3818980cef..90478634fa 100644--- a/apps/designer/app/canvas/shared/use-drag-drop.ts+++ b/apps/designer/app/canvas/shared/use-drag-drop.ts@@ -1,16 +1,20 @@import React, { useEffect, useRef } from "react";import { useRootInstance } from "~/shared/nano-states";+import { findInstanceById, getInstancePath } from "~/shared/tree-utils";import {- useDropTarget,- useDrag,- usePlacement,- useAutoScroll,type Rect,type DropTarget,-} from "~/shared/design-system/components/primitives/dnd";-import { findInstanceById, getInstancePath } from "~/shared/tree-utils";-import { primitives } from "~/shared/canvas-components";-import { publish, useSubscribe, type Instance } from "@webstudio-is/react-sdk";+ useAutoScroll,+ usePlacement,+ useDrag,+ useDropTarget,+} from "@webstudio-is/design-system";+import {+ publish,+ useSubscribe,+ type Instance,+ components as primitives,+} from "@webstudio-is/react-sdk";// data shared between iframe and main windowexport type DropTargetSharedData = {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.tsxindex bb792b71a7..876bfd5e18 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,29 +1,20 @@import { type MouseEventHandler, useState } from "react";import { createPortal } from "react-dom";-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 { useEffect, useRef, type MouseEventHandler, useCallback } from "react";-import { useDrag } from "react-dnd";-import { getEmptyImage } from "react-dnd-html5-backend";import {type Instance,type Publish,components,} from "@webstudio-is/react-sdk";-import { Flex } from "@webstudio-is/design-system";+import { Flex, useDrag } from "@webstudio-is/design-system";import { PlusIcon } from "@webstudio-is/icons";-import { type DragData } 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";const componentNames = (- Object.keys(primitives) as Array<Instance["component"]>-).filter((component) => primitives[component].isInlineOnly === false);+ Object.keys(components) as Array<Instance["component"]>+).filter((component) => components[component].isInlineOnly === false);type DraggableThumbProps = {onClick: MouseEventHandler<HTMLDivElement>;@@ -99,7 +90,8 @@ export const TabContent = ({ publish, onSetActiveTab }: TabContentProps) => {const { dragComponent } = event.target.dataset;const component =- dragComponent != null && componentNames.find((c) => c === dragComponent);+ dragComponent != null &&+ componentNames.find((c) => c === dragComponent);if (!component) {event.cancel();diff --git a/apps/designer/app/designer/features/tree-preview/tree-preview.tsx b/apps/designer/app/designer/features/tree-preview/tree-preview.tsxindex 79ae0a3a70..187c96077c 100644--- a/apps/designer/app/designer/features/tree-preview/tree-preview.tsx+++ b/apps/designer/app/designer/features/tree-preview/tree-preview.tsx@@ -2,11 +2,8 @@ import produce from "immer";import { type Instance } from "@webstudio-is/react-sdk";import { useMemo } from "react";import { Tree } from "~/designer/shared/tree";-import { Flex } from "~/shared/design-system";-import { useRootInstance, useDragAndDropState } from "~/shared/nano-states";-import { type DragData, type DropData } from "~/shared/canvas-components";import { Flex } from "@webstudio-is/design-system";-import { useRootInstance } from "~/shared/nano-states";+import { useRootInstance, useDragAndDropState } from "~/shared/nano-states";import {getInstancePath,diff --git a/apps/designer/app/designer/features/workspace/canvas-tools/canvas-tools.tsx b/apps/designer/app/designer/features/workspace/canvas-tools/canvas-tools.tsxindex a460b42a3f..13d5ba5b8c 100644--- a/apps/designer/app/designer/features/workspace/canvas-tools/canvas-tools.tsx+++ b/apps/designer/app/designer/features/workspace/canvas-tools/canvas-tools.tsx@@ -1,7 +1,5 @@import { type Publish } from "@webstudio-is/react-sdk";-import { Box } from "~/shared/design-system";-import { PlacementIndicator } from "~/shared/design-system/components/primitives/dnd";-import { Box } from "@webstudio-is/design-system";+import { Box, PlacementIndicator } from "@webstudio-is/design-system";import {useIsPreviewMode,useIsScrolling,diff --git a/apps/designer/app/shared/canvas-components/index.ts b/apps/designer/app/shared/canvas-components/index.tsindex 96016d1172..e9f7edf109 100644--- a/apps/designer/app/shared/canvas-components/index.ts+++ b/apps/designer/app/shared/canvas-components/index.ts@@ -1 +1 @@-export * from "./instance-data";\ No newline at end of file+export * from "./instance-data";diff --git a/packages/design-system/src/components/primitives/dnd/use-auto-scroll.ts b/packages/design-system/src/components/primitives/dnd/use-auto-scroll.tsindex 0629db791b..999e9f09a6 100644--- a/packages/design-system/src/components/primitives/dnd/use-auto-scroll.ts+++ b/packages/design-system/src/components/primitives/dnd/use-auto-scroll.ts@@ -41,7 +41,7 @@ const getSpeed = (export type UseAutoScrollProps = {edgeDistanceThreshold?: number;- // If set to true entire document will be scrolled.+ // If set to true the entire document will be scrolled.// No need to set targetRef in this case.fullScreen?: boolean;diff --git a/packages/design-system/src/index.ts b/packages/design-system/src/index.tsindex d9fc6e725f..75ee9d4a16 100644--- a/packages/design-system/src/index.ts+++ b/packages/design-system/src/index.ts@@ -59,3 +59,6 @@ export * from "./components/radio";export * from "./components/combobox";export * from "./components/checkbox";export * from "./components/avatar";++// @todo: make sure everything that's exported has unique enough names+export * from "./components/primitives/dnd";