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
wip font family
Oleg Isonen04a2ca981f56
diff --git a/apps/designer/app/canvas/shared/instance.ts b/apps/designer/app/canvas/shared/instance.tsindex 39a3420059..5060b5e8c2 100644--- a/apps/designer/app/canvas/shared/instance.ts+++ b/apps/designer/app/canvas/shared/instance.ts@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useRef } from "react";import ObjectId from "bson-objectid";import {type Instance,+ type InstanceProps,type Tree,components,allUserPropsContainer,@@ -48,6 +49,12 @@ declare module "~/shared/pubsub" {selectedInstanceRect: DOMRect;selectInstance?: SelectedInstanceData;textEditingInstanceId?: Instance["id"];+ insertInstance: {+ instance: Instance;+ dropTarget?: { parentId: Instance["id"]; position: number };+ props?: InstanceProps;+ };+ unselectInstance: undefined;}}diff --git a/apps/designer/app/designer/features/sidebar-left/lib/header.tsx b/apps/designer/app/designer/features/sidebar-left/lib/header.tsxindex b10215574d..0b47b76754 100644--- a/apps/designer/app/designer/features/sidebar-left/lib/header.tsx+++ b/apps/designer/app/designer/features/sidebar-left/lib/header.tsx@@ -1,8 +1,4 @@-import {- Flex,- IconButton,- __DEPRECATED__Text,-} from "@webstudio-is/design-system";+import { Flex, IconButton, Text } from "@webstudio-is/design-system";import { Separator } from "@webstudio-is/design-system";import { Cross1Icon } from "@webstudio-is/icons";@@ -20,9 +16,7 @@ export const Header = ({ title, isClosable = true, onClose }: HeaderProps) => {align="center"justify="between">- <__DEPRECATED__Text size="1" css={{ fontWeight: "bold" }}>- {title}- </__DEPRECATED__Text>+ <Text variant="title">{title}</Text>{isClosable && (<IconButtononClick={() => onClose?.()}diff --git a/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsx b/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsxindex c7c005befd..14b486dd1d 100644--- a/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsx+++ b/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsx@@ -1,7 +1,16 @@-import { Grid, TextField } from "@webstudio-is/design-system";+import {+ Grid,+ TextField,+ Popover,+ PopoverTrigger,+ PopoverContent,+ PopoverHeader,+ PopoverPortal,+} from "@webstudio-is/design-system";import type { ControlProps } from "../../style-sections";import { getFinalValue } from "../../shared/get-final-value";import { PropertyName } from "../../shared/property-name";+import { PANEL_WIDTH } from "~/designer/shared/constants";const textFieldStyle = {height: "$6",@@ -28,20 +37,36 @@ export const FontFamilyControl = ({return (<Grid columns={2}><PropertyName property={styleConfig.property} label={styleConfig.label} />- <TextField- css={textFieldStyle}- spellCheck={false}- readOnly- defaultValue={value.value}- onClick={() => {- console.log("show font picker");- }}- onKeyDown={(event) => {- if (event.key === "Enter") {- console.log("show font picker");- }- }}- />++ <Popover>+ <PopoverTrigger asChild aria-label="Share project">+ <TextField+ ref={(element) => {+ if (element) console.log(element.offsetLeft);+ }}+ css={textFieldStyle}+ spellCheck={false}+ readOnly+ defaultValue={value.value}+ onClick={() => {}}+ onKeyDown={(event) => {+ if (event.key === "Enter") {+ console.log("show font picker");+ }+ }}+ />+ </PopoverTrigger>+ <PopoverPortal>+ <PopoverContent+ //alignOffset={PANEL_WIDTH}+ sideOffset={PANEL_WIDTH}+ side="right"+ hideArrow+ >+ <PopoverHeader title="Assets" />+ </PopoverContent>+ </PopoverPortal>+ </Popover></Grid>);};diff --git a/apps/designer/app/designer/features/workspace/workspace.tsx b/apps/designer/app/designer/features/workspace/workspace.tsxindex 2be2c62316..e2a483f175 100644--- a/apps/designer/app/designer/features/workspace/workspace.tsx+++ b/apps/designer/app/designer/features/workspace/workspace.tsx@@ -1,20 +1,8 @@import { Box, Flex, Toaster } from "@webstudio-is/design-system";-import { type Instance, type InstanceProps } from "@webstudio-is/react-sdk";import { useCanvasWidth, useZoom } from "~/designer/shared/nano-states";import { CanvasTools } from "./canvas-tools";import { type Publish } from "~/shared/pubsub";-declare module "~/shared/pubsub" {- export interface PubsubMap {- insertInstance: {- instance: Instance;- dropTarget?: { parentId: Instance["id"]; position: number };- props?: InstanceProps;- };- unselectInstance: undefined;- }-}-const workspaceStyle = {flexGrow: 1,background: "$gray3",diff --git a/packages/design-system/src/components/dialog.tsx b/packages/design-system/src/components/dialog.tsxindex 9c54c6a0e6..f60f4d4691 100644--- a/packages/design-system/src/components/dialog.tsx+++ b/packages/design-system/src/components/dialog.tsx@@ -16,6 +16,7 @@ const StyledOverlay = styled(DialogPrimitive.Overlay, overlayStyles, {right: 0,bottom: 0,left: 0,+ zIndex: "$1",});export const Dialog = ({ children, ...props }: DialogProps) => {@@ -29,6 +30,7 @@ export const Dialog = ({ children, ...props }: DialogProps) => {const StyledContent = styled(DialogPrimitive.Content, panelStyles, {position: "fixed",+ zIndex: "$1",top: "50%",left: "50%",transform: "translate(-50%, -50%)",@@ -77,3 +79,4 @@ export const DialogTrigger = DialogPrimitive.Trigger;export const DialogClose = DialogPrimitive.Close;export const DialogTitle = DialogPrimitive.Title;export const DialogDescription = DialogPrimitive.Description;+export const DialogPortal = DialogPrimitive.Portal;diff --git a/packages/design-system/src/components/popover.tsx b/packages/design-system/src/components/popover.tsxindex ed142ccef8..ec8c1fc640 100644--- a/packages/design-system/src/components/popover.tsx+++ b/packages/design-system/src/components/popover.tsx@@ -1,8 +1,13 @@import React from "react";-import { styled, CSS } from "../stitches.config";+import { Cross1Icon } from "@webstudio-is/icons";import * as PopoverPrimitive from "@radix-ui/react-popover";import { Box } from "./box";import { panelStyles } from "./panel";+import { Flex } from "./flex";+import { IconButton } from "./icon-button";+import { Text } from "./text";+import { Separator } from "./separator";+import { styled, CSS } from "../stitches.config";type PopoverProps = React.ComponentProps<typeof PopoverPrimitive.Root> & {children: React.ReactNode;@@ -49,5 +54,31 @@ export const PopoverContent = React.forwardRef<</StyledContent>));PopoverContent.displayName = "PopoverContent";++type PopoverHeaderProps = {+ title: string;+};++export const PopoverHeader = ({ title }: PopoverHeaderProps) => {+ return (+ <>+ <Flex+ css={{ height: 40, paddingLeft: "$3" }}+ align="center"+ justify="between"+ >+ <Text variant="title">{title}</Text>+ <PopoverClose asChild>+ <IconButton size="1" css={{ marginRight: "$2" }} aria-label="Close">+ <Cross1Icon />+ </IconButton>+ </PopoverClose>+ </Flex>+ <Separator css={{ height: 2 }} />+ </>+ );+};+export const PopoverTrigger = PopoverPrimitive.Trigger;export const PopoverClose = PopoverPrimitive.Close;+export const PopoverPortal = PopoverPrimitive.Portal;