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.

shared/component > shared/canvas-components

Oleg Isonen479a57d5095d
diff --git a/app/canvas/features/wrapper-component/editable/use-content-editable.tsx b/app/canvas/features/wrapper-component/editable/use-content-editable.tsx
index f10584c232..be48678793 100644
--- a/app/canvas/features/wrapper-component/editable/use-content-editable.tsx
+++ b/app/canvas/features/wrapper-component/editable/use-content-editable.tsx
@@ -4,7 +4,7 @@ import useDebounce from "react-use/lib/useDebounce";
import ObjectId from "bson-objectid";
import { type ChildrenUpdates, type Instance } from "@webstudio-is/sdk";
import { type OnChangeChildren } from "~/shared/tree-utils";
-import { primitives } from "~/shared/component";
+import { primitives } from "~/shared/canvas-components";
import { useSelectedInstance } from "~/canvas/shared/nano-states";
import { useEditable, type Content } from "./use-editable";
import { useToolbar } from "./use-toolbar";
diff --git a/app/canvas/features/wrapper-component/use-css.tsx b/app/canvas/features/wrapper-component/use-css.tsx
index f5ee97dda4..c58ee18d14 100644
--- a/app/canvas/features/wrapper-component/use-css.tsx
+++ b/app/canvas/features/wrapper-component/use-css.tsx
@@ -7,7 +7,7 @@ import {
toValue,
} from "@webstudio-is/sdk";
import { useDropData, useSelectedInstance } from "~/canvas/shared/nano-states";
-import { primitives, type StyleUpdates } from "~/shared/component";
+import { primitives, type StyleUpdates } from "~/shared/canvas-components";
// @todo this doesn't work with the node at the top edge of the iframe, tag gets hidden.
const componentTagStyle = {
diff --git a/app/canvas/features/wrapper-component/use-draggable.ts b/app/canvas/features/wrapper-component/use-draggable.ts
index 79b87960b6..640570e43b 100644
--- a/app/canvas/features/wrapper-component/use-draggable.ts
+++ b/app/canvas/features/wrapper-component/use-draggable.ts
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useRef } from "react";
import { useDrag } from "react-dnd";
import { type Instance, publish } from "@webstudio-is/sdk";
-import { type DragData } from "~/shared/component";
+import { type DragData } from "~/shared/canvas-components";
//import { usePointerOutline } from "~/canvas/hooks";
type UseDraggable = {
diff --git a/app/canvas/features/wrapper-component/wrapper-component.tsx b/app/canvas/features/wrapper-component/wrapper-component.tsx
index 38c3d9bebf..5759b9da2d 100644
--- a/app/canvas/features/wrapper-component/wrapper-component.tsx
+++ b/app/canvas/features/wrapper-component/wrapper-component.tsx
@@ -6,7 +6,7 @@ import {
useUserProps,
renderWrapperComponentChildren,
} from "@webstudio-is/sdk";
-import { primitives } from "~/shared/component";
+import { primitives } from "~/shared/canvas-components";
import { useContentEditable } from "./editable";
import { useCss } from "./use-css";
import { useDraggable } from "./use-draggable";
diff --git a/app/canvas/shared/instance.ts b/app/canvas/shared/instance.ts
index 1e2a14a2f2..3cd81ca944 100644
--- a/app/canvas/shared/instance.ts
+++ b/app/canvas/shared/instance.ts
@@ -19,7 +19,7 @@ import {
findInstanceById,
} from "~/shared/tree-utils";
import store from "immerhin";
-import { DropData, type SelectedInstanceData } from "~/shared/component";
+import { DropData, type SelectedInstanceData } from "~/shared/canvas-components";
import { useSelectedInstance, useSelectedElement } from "./nano-states";
import { rootInstanceContainer, useRootInstance } from "~/shared/nano-states";
diff --git a/app/canvas/shared/nano-states.ts b/app/canvas/shared/nano-states.ts
index 75b85f5b1d..522ad0c524 100644
--- a/app/canvas/shared/nano-states.ts
+++ b/app/canvas/shared/nano-states.ts
@@ -1,6 +1,6 @@
import { createValueContainer, useValue } from "react-nano-state";
import { type Instance } from "@webstudio-is/sdk";
-import { type DropData } from "~/shared/component";
+import { type DropData } from "~/shared/canvas-components";
const dropDataContainer = createValueContainer<DropData | undefined>();
export const useDropData = () => useValue(dropDataContainer);
diff --git a/app/canvas/shared/style.ts b/app/canvas/shared/style.ts
index ed0ca85e2d..a402079bff 100644
--- a/app/canvas/shared/style.ts
+++ b/app/canvas/shared/style.ts
@@ -1,6 +1,6 @@
import store from "immerhin";
import { useSubscribe } from "@webstudio-is/sdk";
-import { type StyleUpdates } from "~/shared/component";
+import { type StyleUpdates } from "~/shared/canvas-components";
import { setInstanceStyleMutable } from "~/shared/tree-utils";
import { useSelectedInstance } from "./nano-states";
import { rootInstanceContainer } from "~/shared/nano-states";
diff --git a/app/canvas/shared/use-drag-drop-handlers.ts b/app/canvas/shared/use-drag-drop-handlers.ts
index 3cdb88924e..d736543817 100644
--- a/app/canvas/shared/use-drag-drop-handlers.ts
+++ b/app/canvas/shared/use-drag-drop-handlers.ts
@@ -1,7 +1,7 @@
import { useState } from "react";
import memoize from "lodash.memoize";
import { publish, useSubscribe } from "@webstudio-is/sdk";
-import { type DragData, type DropData } from "~/shared/component";
+import { type DragData, type DropData } from "~/shared/canvas-components";
import { findInstanceById } from "~/shared/tree-utils";
import {
findClosestChild,
diff --git a/app/designer/designer.tsx b/app/designer/designer.tsx
index 3d5dcf94af..2e3f26be59 100644
--- a/app/designer/designer.tsx
+++ b/app/designer/designer.tsx
@@ -3,7 +3,7 @@ import { DndProvider } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";
import { type Project, useSubscribe, usePublish } from "@webstudio-is/sdk";
import type { Config } from "~/config";
-import type { SelectedInstanceData } from "~/shared/component";
+import type { SelectedInstanceData } from "~/shared/canvas-components";
import { Box, Flex, Grid, type CSS } from "~/shared/design-system";
import interStyles from "~/shared/font-faces/inter.css";
import { SidebarLeft } from "./features/sidebar-left";
diff --git a/app/designer/features/settings-panel/settings-panel.tsx b/app/designer/features/settings-panel/settings-panel.tsx
index b5f7a33225..73d0821f6e 100644
--- a/app/designer/features/settings-panel/settings-panel.tsx
+++ b/app/designer/features/settings-panel/settings-panel.tsx
@@ -2,7 +2,7 @@ import { type UserProp, type Publish } from "@webstudio-is/sdk";
import { CollapsibleSection, ComponentInfo } from "~/designer/shared/inspector";
import { TextField, Flex, Button, Box } from "~/shared/design-system";
import { PlusIcon, TrashIcon } from "~/shared/icons";
-import type { SelectedInstanceData } from "~/shared/component";
+import type { SelectedInstanceData } from "~/shared/canvas-components";
import { usePropsLogic } from "./use-props-logic";
type PropertyProps = {
diff --git a/app/designer/features/settings-panel/use-props-logic.ts b/app/designer/features/settings-panel/use-props-logic.ts
index 20fb7884af..5fe80661fa 100644
--- a/app/designer/features/settings-panel/use-props-logic.ts
+++ b/app/designer/features/settings-panel/use-props-logic.ts
@@ -8,7 +8,7 @@ import type {
UserPropsUpdates,
Publish,
} from "@webstudio-is/sdk";
-import type { SelectedInstanceData } from "~/shared/component";
+import type { SelectedInstanceData } from "~/shared/canvas-components";
const getInitialProp = () => ({
id: ObjectId().toString(),
diff --git a/app/designer/features/sidebar-left/panels/components/component-thumb.tsx b/app/designer/features/sidebar-left/panels/components/component-thumb.tsx
index b846a415e6..82d682fa7a 100644
--- a/app/designer/features/sidebar-left/panels/components/component-thumb.tsx
+++ b/app/designer/features/sidebar-left/panels/components/component-thumb.tsx
@@ -1,6 +1,6 @@
import { type Instance } from "@webstudio-is/sdk";
import { forwardRef, type ElementRef, type ComponentProps } from "react";
-import { primitives } from "~/shared/component";
+import { primitives } from "~/shared/canvas-components";
import { Flex, Text, styled } from "~/shared/design-system";
const Thumb = styled(Flex, {
diff --git a/app/designer/features/sidebar-left/panels/components/components.tsx b/app/designer/features/sidebar-left/panels/components/components.tsx
index a0c56a23c7..9ff340da79 100644
--- a/app/designer/features/sidebar-left/panels/components/components.tsx
+++ b/app/designer/features/sidebar-left/panels/components/components.tsx
@@ -4,7 +4,7 @@ import { getEmptyImage } from "react-dnd-html5-backend";
import { type Instance, type Publish } from "@webstudio-is/sdk";
import { Flex } from "~/shared/design-system";
import { PlusIcon } from "~/shared/icons";
-import { primitives, type DragData } from "~/shared/component";
+import { primitives, type DragData } from "~/shared/canvas-components";
import { createInstance } from "~/shared/tree-utils";
import type { TabName } from "../../types";
import { CustomDragLayer } from "./custom-drag-layer";
diff --git a/app/designer/features/sidebar-left/panels/tree.tsx b/app/designer/features/sidebar-left/panels/tree.tsx
index a14464067d..a78aa0317b 100644
--- a/app/designer/features/sidebar-left/panels/tree.tsx
+++ b/app/designer/features/sidebar-left/panels/tree.tsx
@@ -1,7 +1,7 @@
import { type Instance, type Publish } from "@webstudio-is/sdk";
import { ListNestedIcon } from "~/shared/icons";
import { Flex } from "~/shared/design-system";
-import { type SelectedInstanceData } from "~/shared/component";
+import { type SelectedInstanceData } from "~/shared/canvas-components";
import { useSelectedInstancePath } from "~/designer/shared/instance/use-selected-instance-path";
import { Tree } from "~/designer/shared/tree";
import { useRootInstance } from "~/shared/nano-states";
diff --git a/app/designer/features/style-panel/settings.tsx b/app/designer/features/style-panel/settings.tsx
index d78de80872..fbe29866b2 100644
--- a/app/designer/features/style-panel/settings.tsx
+++ b/app/designer/features/style-panel/settings.tsx
@@ -14,7 +14,7 @@ import { renderProperty } from "./render-property";
import { dependencies } from "./dependencies";
import { type InheritedStyle } from "./get-inherited-style";
import { type SetProperty } from "./use-style-data";
-import { type SelectedInstanceData } from "~/shared/component";
+import { type SelectedInstanceData } from "~/shared/canvas-components";
// Finds a property/value by using any available form: property, label, value
const filterProperties = (properties: Array<string>, search: string) => {
diff --git a/app/designer/features/style-panel/style-panel.tsx b/app/designer/features/style-panel/style-panel.tsx
index 3051bbf62a..8cccc80c43 100644
--- a/app/designer/features/style-panel/style-panel.tsx
+++ b/app/designer/features/style-panel/style-panel.tsx
@@ -1,7 +1,7 @@
import type { Publish } from "@webstudio-is/sdk";
import { willRender } from "~/designer/shared/breakpoints";
import { Box, Card, Paragraph } from "~/shared/design-system";
-import type { SelectedInstanceData } from "~/shared/component";
+import type { SelectedInstanceData } from "~/shared/canvas-components";
import { useStyleData } from "./use-style-data";
import { ComponentInfo } from "../../shared/inspector";
import { VisualSettings } from "./settings";
diff --git a/app/designer/features/style-panel/use-style-data.ts b/app/designer/features/style-panel/use-style-data.ts
index e4546c22b2..7a6dccd578 100644
--- a/app/designer/features/style-panel/use-style-data.ts
+++ b/app/designer/features/style-panel/use-style-data.ts
@@ -1,5 +1,5 @@
import { useState, useMemo, useEffect, useCallback } from "react";
-import type { SelectedInstanceData, StyleUpdates } from "~/shared/component";
+import type { SelectedInstanceData, StyleUpdates } from "~/shared/canvas-components";
import { type StyleProperty, type Publish } from "@webstudio-is/sdk";
import { useSelectedBreakpoint } from "../../shared/nano-states";
import { parseCssValue } from "./parse-css-value";
diff --git a/app/designer/features/tree-preview/tree-preview.tsx b/app/designer/features/tree-preview/tree-preview.tsx
index a32e49b2ea..a1b9e0dd6e 100644
--- a/app/designer/features/tree-preview/tree-preview.tsx
+++ b/app/designer/features/tree-preview/tree-preview.tsx
@@ -2,7 +2,7 @@ import { Instance, useSubscribe } from "@webstudio-is/sdk";
import produce from "immer";
import { useState } from "react";
import { Tree } from "~/designer/shared/tree";
-import { type DragData, type DropData } from "~/shared/component";
+import { type DragData, type DropData } from "~/shared/canvas-components";
import { Flex } from "~/shared/design-system";
import { useRootInstance } from "~/shared/nano-states";
import {
diff --git a/app/designer/shared/inspector/component-info.tsx b/app/designer/shared/inspector/component-info.tsx
index c0655ade64..72b2c9af15 100644
--- a/app/designer/shared/inspector/component-info.tsx
+++ b/app/designer/shared/inspector/component-info.tsx
@@ -1,6 +1,6 @@
import { Flex, Text } from "~/shared/design-system";
-import type { SelectedInstanceData } from "~/shared/component";
-import { primitives } from "~/shared/component";
+import type { SelectedInstanceData } from "~/shared/canvas-components";
+import { primitives } from "~/shared/canvas-components";
export const ComponentInfo = ({
selectedInstanceData,
diff --git a/app/designer/shared/nano-states/index.ts b/app/designer/shared/nano-states/index.ts
index 5b47dc76b9..d78fc692aa 100644
--- a/app/designer/shared/nano-states/index.ts
+++ b/app/designer/shared/nano-states/index.ts
@@ -1,6 +1,6 @@
import { createValueContainer, useValue } from "react-nano-state";
import { type Breakpoint } from "@webstudio-is/sdk";
-import { SelectedInstanceData } from "~/shared/component";
+import { SelectedInstanceData } from "~/shared/canvas-components";
import { type SyncStatus } from "~/shared/sync";
const selectedInstanceDataContainer = createValueContainer<
diff --git a/app/designer/shared/tree/tree.tsx b/app/designer/shared/tree/tree.tsx
index 2c4590da5c..cf464888fb 100644
--- a/app/designer/shared/tree/tree.tsx
+++ b/app/designer/shared/tree/tree.tsx
@@ -9,7 +9,7 @@ import {
styled,
} from "~/shared/design-system";
import { TriangleRightIcon, TriangleDownIcon } from "~/shared/icons";
-import { primitives } from "~/shared/component";
+import { primitives } from "~/shared/canvas-components";
import noop from "lodash.noop";
const openKeyframes = keyframes({
diff --git a/app/shared/component/draggable.ts b/app/shared/canvas-components/draggable.ts
similarity index 100%
rename from app/shared/component/draggable.ts
rename to app/shared/canvas-components/draggable.ts
diff --git a/app/shared/component/index.ts b/app/shared/canvas-components/index.ts
similarity index 100%
rename from app/shared/component/index.ts
rename to app/shared/canvas-components/index.ts
diff --git a/app/shared/component/instance-data.ts b/app/shared/canvas-components/instance-data.ts
similarity index 100%
rename from app/shared/component/instance-data.ts
rename to app/shared/canvas-components/instance-data.ts
diff --git a/app/shared/component/primitives/bold.tsx b/app/shared/canvas-components/primitives/bold.tsx
similarity index 100%
rename from app/shared/component/primitives/bold.tsx
rename to app/shared/canvas-components/primitives/bold.tsx
diff --git a/app/shared/component/primitives/box.tsx b/app/shared/canvas-components/primitives/box.tsx
similarity index 100%
rename from app/shared/component/primitives/box.tsx
rename to app/shared/canvas-components/primitives/box.tsx
diff --git a/app/shared/component/primitives/button.tsx b/app/shared/canvas-components/primitives/button.tsx
similarity index 100%
rename from app/shared/component/primitives/button.tsx
rename to app/shared/canvas-components/primitives/button.tsx
diff --git a/app/shared/component/primitives/form.tsx b/app/shared/canvas-components/primitives/form.tsx
similarity index 100%
rename from app/shared/component/primitives/form.tsx
rename to app/shared/canvas-components/primitives/form.tsx
diff --git a/app/shared/component/primitives/heading.tsx b/app/shared/canvas-components/primitives/heading.tsx
similarity index 100%
rename from app/shared/component/primitives/heading.tsx
rename to app/shared/canvas-components/primitives/heading.tsx
diff --git a/app/shared/component/primitives/index.ts b/app/shared/canvas-components/primitives/index.ts
similarity index 100%
rename from app/shared/component/primitives/index.ts
rename to app/shared/canvas-components/primitives/index.ts
diff --git a/app/shared/component/primitives/input.tsx b/app/shared/canvas-components/primitives/input.tsx
similarity index 100%
rename from app/shared/component/primitives/input.tsx
rename to app/shared/canvas-components/primitives/input.tsx
diff --git a/app/shared/component/primitives/italic.tsx b/app/shared/canvas-components/primitives/italic.tsx
similarity index 100%
rename from app/shared/component/primitives/italic.tsx
rename to app/shared/canvas-components/primitives/italic.tsx
diff --git a/app/shared/component/primitives/link.tsx b/app/shared/canvas-components/primitives/link.tsx
similarity index 100%
rename from app/shared/component/primitives/link.tsx
rename to app/shared/canvas-components/primitives/link.tsx
diff --git a/app/shared/component/primitives/paragraph.tsx b/app/shared/canvas-components/primitives/paragraph.tsx
similarity index 100%
rename from app/shared/component/primitives/paragraph.tsx
rename to app/shared/canvas-components/primitives/paragraph.tsx
diff --git a/app/shared/component/primitives/text-block.tsx b/app/shared/canvas-components/primitives/text-block.tsx
similarity index 100%
rename from app/shared/component/primitives/text-block.tsx
rename to app/shared/canvas-components/primitives/text-block.tsx
diff --git a/app/shared/tree-utils/create-instance.ts b/app/shared/tree-utils/create-instance.ts
index 5d32348028..a54ef85a8c 100644
--- a/app/shared/tree-utils/create-instance.ts
+++ b/app/shared/tree-utils/create-instance.ts
@@ -1,6 +1,6 @@
import ObjectId from "bson-objectid";
import { type CssRule, type Instance } from "@webstudio-is/sdk";
-import { primitives } from "~/shared/component";
+import { primitives } from "~/shared/canvas-components";
export const createInstance = ({
component,
diff --git a/app/shared/tree-utils/populate.ts b/app/shared/tree-utils/populate.ts
index 3e27dd4526..60ffb271d7 100644
--- a/app/shared/tree-utils/populate.ts
+++ b/app/shared/tree-utils/populate.ts
@@ -1,5 +1,5 @@
import { type Instance } from "@webstudio-is/sdk";
-import { primitives } from "~/shared/component";
+import { primitives } from "~/shared/canvas-components";
/**
* Populate instance with:
diff --git a/app/shared/tree-utils/set-instance-style.ts b/app/shared/tree-utils/set-instance-style.ts
index b0e2da0b0f..ad0b3c8f13 100644
--- a/app/shared/tree-utils/set-instance-style.ts
+++ b/app/shared/tree-utils/set-instance-style.ts
@@ -1,5 +1,5 @@
import { Breakpoint, type Instance } from "@webstudio-is/sdk";
-import { type StyleUpdates } from "~/shared/component";
+import { type StyleUpdates } from "~/shared/canvas-components";
import { findInstanceById } from "./find-instance";
export const setInstanceStyleMutable = (