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
Radix tooltip local styles (#1975)
Ivan Starkova9fefa2c646d
diff --git a/packages/sdk-components-react/LICENSE-3RD-PARTY b/packages/sdk-components-react/LICENSE-3RD-PARTYnew file mode 100644index 0000000000..66c8038b0b--- /dev/null+++ b/packages/sdk-components-react/LICENSE-3RD-PARTY@@ -0,0 +1,13 @@+MIT License++Copyright (c) 2023 shadcn++applies to:++- https://github.com/shadcn-ui/ui++Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWAREdiff --git a/packages/sdk-components-react/package.json b/packages/sdk-components-react/package.jsonindex 08bd4db0b7..4de1386fb6 100644--- a/packages/sdk-components-react/package.json+++ b/packages/sdk-components-react/package.json@@ -49,13 +49,15 @@"dependencies": {"@radix-ui/react-tooltip": "^1.0.6","@react-aria/utils": "^3.13.3",+ "@webstudio-is/css-data": "workspace:^","@webstudio-is/css-vars": "workspace:^","@webstudio-is/generate-arg-types": "workspace:^","@webstudio-is/icons": "workspace:^","@webstudio-is/image": "workspace:^","@webstudio-is/react-sdk": "workspace:^","colord": "^2.9.3",- "shallow-equal": "^3.1.0"+ "shallow-equal": "^3.1.0",+ "tailwindcss": "^3.3.3"},"devDependencies": {"@storybook/react": "^7.1.0",diff --git a/packages/sdk-components-react/src/radix-tooltip.ws.tsx b/packages/sdk-components-react/src/radix-tooltip.ws.tsxindex 2b47d0ecf4..80bad8b48e 100644--- a/packages/sdk-components-react/src/radix-tooltip.ws.tsx+++ b/packages/sdk-components-react/src/radix-tooltip.ws.tsx@@ -3,6 +3,7 @@ import {type WsComponentMeta,type WsComponentPropsMeta,} from "@webstudio-is/react-sdk";+import * as tc from "./theme/tailwind-classes";import {propsTooltip,@@ -28,6 +29,14 @@ export const metaTooltipContent: WsComponentMeta = {icon: RadioCheckedIcon,};+/**+ * Styles source without animations:+ * https://github.com/shadcn-ui/ui/blob/main/apps/www/registry/default/ui/tooltip.tsx+ *+ * Attributions+ * MIT License+ * Copyright (c) 2023 shadcn+ **/export const metaTooltip: WsComponentMeta = {category: "radix",invalidAncestors: [],@@ -35,6 +44,7 @@ export const metaTooltip: WsComponentMeta = {label: "Tooltip",icon: RadioCheckedIcon,order: 15,+ stylable: false,template: [{type: "instance",@@ -70,18 +80,26 @@ export const metaTooltip: WsComponentMeta = {component: "TooltipContent",label: "Tooltip Content",props: [],+ /**+ * z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md+ **/+ styles: [+ tc.z(50),+ tc.overflow("hidden"),+ tc.rounded("md"),+ tc.border(),+ tc.bg("popover"),+ tc.px(3),+ tc.py(1.5),+ tc.text("sm"),+ tc.text("popoverForeground"),+ tc.shadow("md"),+ ].flat(),children: [{type: "instance",- component: "Box",- props: [],- children: [- {- type: "instance",- component: "Text",- children: [{ type: "text", value: "The text you can edit" }],- },- ],+ component: "Text",+ children: [{ type: "text", value: "The text you can edit" }],},],},diff --git a/packages/sdk-components-react/src/theme/radix-common-types.ts b/packages/sdk-components-react/src/theme/radix-common-types.tsnew file mode 100644index 0000000000..a3d5bbcccb--- /dev/null+++ b/packages/sdk-components-react/src/theme/radix-common-types.ts@@ -0,0 +1,470 @@+// Source: "tailwindcss/types/generated/default-theme"++import type { colors } from "./tailwind-colors";++// Removed `Config['theme'] &`+type DefaultTheme = {+ animation: Record<"none" | "spin" | "ping" | "pulse" | "bounce", string>;+ aria: Record<+ | "busy"+ | "checked"+ | "disabled"+ | "expanded"+ | "hidden"+ | "pressed"+ | "readonly"+ | "required"+ | "selected",+ string+ >;+ aspectRatio: Record<"auto" | "square" | "video", string>;+ backgroundImage: Record<+ | "none"+ | "gradient-to-t"+ | "gradient-to-tr"+ | "gradient-to-r"+ | "gradient-to-br"+ | "gradient-to-b"+ | "gradient-to-bl"+ | "gradient-to-l"+ | "gradient-to-tl",+ string+ >;+ backgroundPosition: Record<+ | "bottom"+ | "center"+ | "left"+ | "left-bottom"+ | "left-top"+ | "right"+ | "right-bottom"+ | "right-top"+ | "top",+ string+ >;+ backgroundSize: Record<"auto" | "cover" | "contain", string>;+ blur: Record<+ "0" | "none" | "sm" | "DEFAULT" | "md" | "lg" | "xl" | "2xl" | "3xl",+ string+ >;+ borderRadius: Record<+ "none" | "sm" | "DEFAULT" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full",+ string+ >;+ borderWidth: Record<"0" | "2" | "4" | "8" | "DEFAULT", string>;+ boxShadow: Record<+ "sm" | "DEFAULT" | "md" | "lg" | "xl" | "2xl" | "inner" | "none",+ string+ >;+ brightness: Record<+ | "0"+ | "50"+ | "75"+ | "90"+ | "95"+ | "100"+ | "105"+ | "110"+ | "125"+ | "150"+ | "200",+ string+ >;+ columns: Record<+ | "1"+ | "2"+ | "3"+ | "4"+ | "5"+ | "6"+ | "7"+ | "8"+ | "9"+ | "10"+ | "11"+ | "12"+ | "auto"+ | "3xs"+ | "2xs"+ | "xs"+ | "sm"+ | "md"+ | "lg"+ | "xl"+ | "2xl"+ | "3xl"+ | "4xl"+ | "5xl"+ | "6xl"+ | "7xl",+ string+ >;+ content: Record<"none", string>;+ contrast: Record<"0" | "50" | "75" | "100" | "125" | "150" | "200", string>;+ cursor: Record<+ | "auto"+ | "default"+ | "pointer"+ | "wait"+ | "text"+ | "move"+ | "help"+ | "not-allowed"+ | "none"+ | "context-menu"+ | "progress"+ | "cell"+ | "crosshair"+ | "vertical-text"+ | "alias"+ | "copy"+ | "no-drop"+ | "grab"+ | "grabbing"+ | "all-scroll"+ | "col-resize"+ | "row-resize"+ | "n-resize"+ | "e-resize"+ | "s-resize"+ | "w-resize"+ | "ne-resize"+ | "nw-resize"+ | "se-resize"+ | "sw-resize"+ | "ew-resize"+ | "ns-resize"+ | "nesw-resize"+ | "nwse-resize"+ | "zoom-in"+ | "zoom-out",+ string+ >;+ dropShadow: Record<+ "sm" | "DEFAULT" | "md" | "lg" | "xl" | "2xl" | "none",+ string | string[]+ >;+ flex: Record<"1" | "auto" | "initial" | "none", string>;+ flexGrow: Record<"0" | "DEFAULT", string>;+ flexShrink: Record<"0" | "DEFAULT", string>;+ fontFamily: Record<"sans" | "serif" | "mono", string[]>;+ fontSize: Record<+ | "xs"+ | "sm"+ | "base"+ | "lg"+ | "xl"+ | "2xl"+ | "3xl"+ | "4xl"+ | "5xl"+ | "6xl"+ | "7xl"+ | "8xl"+ | "9xl",+ [string, { lineHeight: string }]+ >;+ fontWeight: Record<+ | "thin"+ | "extralight"+ | "light"+ | "normal"+ | "medium"+ | "semibold"+ | "bold"+ | "extrabold"+ | "black",+ string+ >;+ gradientColorStopPositions: Record<+ | "0%"+ | "5%"+ | "10%"+ | "15%"+ | "20%"+ | "25%"+ | "30%"+ | "35%"+ | "40%"+ | "45%"+ | "50%"+ | "55%"+ | "60%"+ | "65%"+ | "70%"+ | "75%"+ | "80%"+ | "85%"+ | "90%"+ | "95%"+ | "100%",+ string+ >;+ grayscale: Record<"0" | "DEFAULT", string>;+ gridAutoColumns: Record<"auto" | "min" | "max" | "fr", string>;+ gridAutoRows: Record<"auto" | "min" | "max" | "fr", string>;+ gridColumn: Record<+ | "auto"+ | "span-1"+ | "span-2"+ | "span-3"+ | "span-4"+ | "span-5"+ | "span-6"+ | "span-7"+ | "span-8"+ | "span-9"+ | "span-10"+ | "span-11"+ | "span-12"+ | "span-full",+ string+ >;+ gridColumnEnd: Record<+ | "1"+ | "2"+ | "3"+ | "4"+ | "5"+ | "6"+ | "7"+ | "8"+ | "9"+ | "10"+ | "11"+ | "12"+ | "13"+ | "auto",+ string+ >;+ gridColumnStart: Record<+ | "1"+ | "2"+ | "3"+ | "4"+ | "5"+ | "6"+ | "7"+ | "8"+ | "9"+ | "10"+ | "11"+ | "12"+ | "13"+ | "auto",+ string+ >;+ gridRow: Record<+ | "auto"+ | "span-1"+ | "span-2"+ | "span-3"+ | "span-4"+ | "span-5"+ | "span-6"+ | "span-full",+ string+ >;+ gridRowEnd: Record<"1" | "2" | "3" | "4" | "5" | "6" | "7" | "auto", string>;+ gridRowStart: Record<+ "1" | "2" | "3" | "4" | "5" | "6" | "7" | "auto",+ string+ >;+ gridTemplateColumns: Record<+ | "1"+ | "2"+ | "3"+ | "4"+ | "5"+ | "6"+ | "7"+ | "8"+ | "9"+ | "10"+ | "11"+ | "12"+ | "none",+ string+ >;+ gridTemplateRows: Record<"1" | "2" | "3" | "4" | "5" | "6" | "none", string>;+ hueRotate: Record<"0" | "15" | "30" | "60" | "90" | "180", string>;+ invert: Record<"0" | "DEFAULT", string>;+ letterSpacing: Record<+ "tighter" | "tight" | "normal" | "wide" | "wider" | "widest",+ string+ >;+ lineHeight: Record<+ | "3"+ | "4"+ | "5"+ | "6"+ | "7"+ | "8"+ | "9"+ | "10"+ | "none"+ | "tight"+ | "snug"+ | "normal"+ | "relaxed"+ | "loose",+ string+ >;+ listStyleType: Record<"none" | "disc" | "decimal", string>;+ listStyleImage: Record<"none", string>;+ lineClamp: Record<"1" | "2" | "3" | "4" | "5" | "6", string>;+ minHeight: Record<"0" | "full" | "screen" | "min" | "max" | "fit", string>;+ minWidth: Record<"0" | "full" | "min" | "max" | "fit", string>;+ objectPosition: Record<+ | "bottom"+ | "center"+ | "left"+ | "left-bottom"+ | "left-top"+ | "right"+ | "right-bottom"+ | "right-top"+ | "top",+ string+ >;+ opacity: Record<+ | "0"+ | "5"+ | "10"+ | "20"+ | "25"+ | "30"+ | "40"+ | "50"+ | "60"+ | "70"+ | "75"+ | "80"+ | "90"+ | "95"+ | "100",+ string+ >;+ order: Record<+ | "1"+ | "2"+ | "3"+ | "4"+ | "5"+ | "6"+ | "7"+ | "8"+ | "9"+ | "10"+ | "11"+ | "12"+ | "first"+ | "last"+ | "none",+ string+ >;+ outlineOffset: Record<"0" | "1" | "2" | "4" | "8", string>;+ outlineWidth: Record<"0" | "1" | "2" | "4" | "8", string>;+ ringOffsetWidth: Record<"0" | "1" | "2" | "4" | "8", string>;+ ringWidth: Record<"0" | "1" | "2" | "4" | "8" | "DEFAULT", string>;+ rotate: Record<+ "0" | "1" | "2" | "3" | "6" | "12" | "45" | "90" | "180",+ string+ >;+ saturate: Record<"0" | "50" | "100" | "150" | "200", string>;+ scale: Record<+ "0" | "50" | "75" | "90" | "95" | "100" | "105" | "110" | "125" | "150",+ string+ >;+ screens: Record<"sm" | "md" | "lg" | "xl" | "2xl", string>;+ sepia: Record<"0" | "DEFAULT", string>;+ skew: Record<"0" | "1" | "2" | "3" | "6" | "12", string>;+ spacing: Record<+ | "0"+ | "1"+ | "2"+ | "3"+ | "4"+ | "5"+ | "6"+ | "7"+ | "8"+ | "9"+ | "10"+ | "11"+ | "12"+ | "14"+ | "16"+ | "20"+ | "24"+ | "28"+ | "32"+ | "36"+ | "40"+ | "44"+ | "48"+ | "52"+ | "56"+ | "60"+ | "64"+ | "72"+ | "80"+ | "96"+ | "px"+ | "0.5"+ | "1.5"+ | "2.5"+ | "3.5",+ string+ >;+ strokeWidth: Record<"0" | "1" | "2", string>;+ textDecorationThickness: Record<+ "0" | "1" | "2" | "4" | "8" | "auto" | "from-font",+ string+ >;+ textUnderlineOffset: Record<"0" | "1" | "2" | "4" | "8" | "auto", string>;+ transformOrigin: Record<+ | "center"+ | "top"+ | "top-right"+ | "right"+ | "bottom-right"+ | "bottom"+ | "bottom-left"+ | "left"+ | "top-left",+ string+ >;+ transitionDelay: Record<+ "0" | "75" | "100" | "150" | "200" | "300" | "500" | "700" | "1000",+ string+ >;+ transitionDuration: Record<+ | "0"+ | "75"+ | "100"+ | "150"+ | "200"+ | "300"+ | "500"+ | "700"+ | "1000"+ | "DEFAULT",+ string+ >;+ transitionProperty: Record<+ "none" | "all" | "DEFAULT" | "colors" | "opacity" | "shadow" | "transform",+ string+ >;+ transitionTimingFunction: Record<+ "DEFAULT" | "linear" | "in" | "out" | "in-out",+ string+ >;+ willChange: Record<"auto" | "scroll" | "contents" | "transform", string>;+ zIndex: Record<"0" | "10" | "20" | "30" | "40" | "50" | "auto", string>;+};++export type EvaluatedDefaultTheme = DefaultTheme & {+ padding: DefaultTheme["spacing"];+ colors: typeof colors;+};diff --git a/packages/sdk-components-react/src/theme/tailwind-classes.ts b/packages/sdk-components-react/src/theme/tailwind-classes.tsnew file mode 100644index 0000000000..52fe89ff53--- /dev/null+++ b/packages/sdk-components-react/src/theme/tailwind-classes.ts@@ -0,0 +1,222 @@+/**+ * Quik and dirty implementation of tailwind classes conversion to webstudio styles.+ */+import type { EmbedTemplateStyleDecl } from "@webstudio-is/react-sdk";+import { theme } from "./tailwind-theme";+import { parseCssValue, parseBoxShadow } from "@webstudio-is/css-data";+import type { EvaluatedDefaultTheme } from "./radix-common-types";++// https://github.com/tailwindlabs/tailwindcss/blob/master/src/css/preflight.css+const preflight = (): EmbedTemplateStyleDecl[] => {+ const borderColorValue = parseCssValue("color", theme("colors")["border"]);++ return [+ {+ property: "borderTopStyle",+ value: { type: "keyword", value: "solid" },+ },+ {+ property: "borderRightStyle",+ value: { type: "keyword", value: "solid" },+ },+ {+ property: "borderBottomStyle",+ value: { type: "keyword", value: "solid" },+ },+ {+ property: "borderLeftStyle",+ value: { type: "keyword", value: "solid" },+ },++ {+ property: "borderTopColor",+ value: borderColorValue,+ },+ {+ property: "borderRightColor",+ value: borderColorValue,+ },+ {+ property: "borderBottomColor",+ value: borderColorValue,+ },+ {+ property: "borderLeftColor",+ value: borderColorValue,+ },+ ];+};++export const z = (+ zIndex?: StringEnumToNumeric<keyof EvaluatedDefaultTheme["zIndex"]>+): EmbedTemplateStyleDecl[] => {+ const valueString = theme("zIndex")[zIndex ?? "auto"];+ const value = parseCssValue("zIndex", valueString);++ return [+ {+ property: "zIndex",+ value,+ },+ ];+};++export const overflow = (+ value: "hidden" | "visible" | "scroll" | "auto"+): EmbedTemplateStyleDecl[] => [+ {+ property: "overflow",+ value: { type: "keyword", value },+ },+];++export const rounded = (+ radius?: keyof EvaluatedDefaultTheme["borderRadius"]+): EmbedTemplateStyleDecl[] => {+ const valueString = theme("borderRadius")[radius ?? "DEFAULT"];+ const value = parseCssValue("borderTopWidth", valueString);++ return [+ {+ property: "borderTopLeftRadius",+ value,+ },+ {+ property: "borderTopRightRadius",+ value,+ },+ {+ property: "borderBottomRightRadius",+ value,+ },+ {+ property: "borderBottomLeftRadius",+ value,+ },+ ];+};++type StringEnumToNumeric<T extends string> = T extends `${infer Z extends+ number}`+ ? Z+ : never;++export const border = (+ borderWidth?: StringEnumToNumeric<keyof EvaluatedDefaultTheme["borderWidth"]>+): EmbedTemplateStyleDecl[] => {+ const key = `${borderWidth ?? "DEFAULT"}` as const;++ const valueString = theme("borderWidth")?.[key] ?? "1px";++ const value = parseCssValue("borderTopWidth", valueString);+ return [+ ...preflight(),+ { property: "borderTopWidth", value },+ { property: "borderRightWidth", value },+ { property: "borderBottomWidth", value },+ { property: "borderLeftWidth", value },+ ];+};++export const px = (+ padding: StringEnumToNumeric<keyof EvaluatedDefaultTheme["padding"]>+): EmbedTemplateStyleDecl[] => {+ const key = `${padding}` as const;+ const valueString = theme("padding")?.[key] ?? "0";+ const value = parseCssValue("paddingLeft", valueString);++ return [+ { property: "paddingLeft", value },+ { property: "paddingRight", value },+ ];+};++export const py = (+ padding: StringEnumToNumeric<keyof EvaluatedDefaultTheme["padding"]>+): EmbedTemplateStyleDecl[] => {+ const key = `${padding}` as const;+ const valueString = theme("padding")[key];+ const value = parseCssValue("paddingTop", valueString);++ return [+ { property: "paddingTop", value },+ { property: "paddingBottom", value },+ ];+};++export const p = (+ padding: StringEnumToNumeric<keyof EvaluatedDefaultTheme["padding"]>+): EmbedTemplateStyleDecl[] => {+ return [...px(padding), ...py(padding)];+};++export const bg = (+ color: keyof EvaluatedDefaultTheme["colors"]+): EmbedTemplateStyleDecl[] => {+ const value = parseCssValue("backgroundColor", theme("colors")[color]);+ return [+ {+ property: "backgroundColor",+ value,+ },+ ];+};++const textSizes = [+ "sm",+ "base",+ "lg",+ "xs",+ "xl",+ "2xl",+ "3xl",+ "4xl",+ "5xl",+ "6xl",+ "7xl",+ "8xl",+ "9xl",+] as const satisfies readonly (keyof EvaluatedDefaultTheme["fontSize"])[];+type TextSize = keyof EvaluatedDefaultTheme["fontSize"];++const isTextSize = (value: string): value is TextSize =>+ textSizes.includes(value as TextSize);++export const text = (+ sizeOrColor: TextSize | keyof EvaluatedDefaultTheme["colors"]+): EmbedTemplateStyleDecl[] => {+ if (isTextSize(sizeOrColor)) {+ const valueArr = theme("fontSize")[sizeOrColor];+ const [fontSizeString, { lineHeight: lineHeightString }] = valueArr;++ const fontSize = parseCssValue("fontSize", fontSizeString);+ const lineHeight = parseCssValue("lineHeight", lineHeightString);+ return [+ { property: "fontSize", value: fontSize },+ { property: "lineHeight", value: lineHeight },+ ];+ }++ const value = parseCssValue("color", theme("colors")[sizeOrColor]);++ return [+ {+ property: "color",+ value,+ },+ ];+};++export const shadow = (+ shadowSize: keyof EvaluatedDefaultTheme["boxShadow"]+): EmbedTemplateStyleDecl[] => {+ const valueString = theme("boxShadow")[shadowSize];+ const value = parseBoxShadow(valueString);++ return [+ {+ property: "boxShadow",+ value,+ },+ ];+};diff --git a/packages/sdk-components-react/src/theme/tailwind-colors.ts b/packages/sdk-components-react/src/theme/tailwind-colors.tsnew file mode 100644index 0000000000..c9fb435314--- /dev/null+++ b/packages/sdk-components-react/src/theme/tailwind-colors.ts@@ -0,0 +1,46 @@+/**+ * Variables source:+ * https://github.com/shadcn-ui/ui/blob/main/apps/www/registry/themes.ts#L1+ * https://github.com/shadcn-ui/ui/blob/5e172fc34fdf015aa0d141f52cc8c082b8ae6613/apps/www/scripts/build-registry.ts#L220+ *+ * Attributions+ * MIT License+ * Copyright (c) 2023 shadcn+ **/++export const colors = {+ transparent: "transparent",+ current: "currentColor",+ popover: "rgb(255, 255, 255)",+ popoverForeground: "rgb(2, 8, 23)",+ border: "rgb(226, 232, 240)",+} as const;++/*+// Not used, leave it for the following components.++--background: 0 0% 100%;+--foreground: 222.2 84% 4.9%;++--muted: 210 40% 96.1%;+--muted-foreground: 215.4 16.3% 46.9%;++--card: 0 0% 100%;+--card-foreground: 222.2 84% 4.9%;++--input: 214.3 31.8% 91.4%;++--primary: 222.2 47.4% 11.2%;+--primary-foreground: 210 40% 98%;++--secondary: 210 40% 96.1%;+--secondary-foreground: 222.2 47.4% 11.2%;++--accent: 210 40% 96.1%;+--accent-foreground: 222.2 47.4% 11.2%;++--destructive: 0 84.2% 60.2%;+--destructive-foreground: 210 40% 98%;++--ring: 215 20.2% 65.1%;+*/diff --git a/packages/sdk-components-react/src/theme/tailwind-theme.ts b/packages/sdk-components-react/src/theme/tailwind-theme.tsnew file mode 100644index 0000000000..5155b8ce1d--- /dev/null+++ b/packages/sdk-components-react/src/theme/tailwind-theme.ts@@ -0,0 +1,24 @@+// eslint-disable-next-line import/no-internal-modules+import defaultTheme from "tailwindcss/defaultTheme"; // Imported theme https://github.com/tailwindlabs/tailwindcss/blob/e0c52a9332a64ef7eb0ba23d2a0fd5a16fe57ab7/stubs/config.full.js+import type { EvaluatedDefaultTheme } from "./radix-common-types";+import { colors } from "./tailwind-colors";++// Override the default theme with our own colors and other values if needed+const localTheme = { ...defaultTheme };++export const theme = <T extends keyof EvaluatedDefaultTheme>(+ name: T+): EvaluatedDefaultTheme[T] => {+ const value = localTheme?.[name] as unknown;++ if (typeof value === "function") {+ return value({ theme, colors });+ }++ return value as never;+};++// Override with our own colors, and other values if needed+localTheme.colors = colors;+localTheme.borderRadius = { ...theme("borderRadius") };+localTheme.borderRadius.DEFAULT = "0.5rem";diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 0fb230b5bf..e0b5452da0 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1267,6 +1267,9 @@ importers:'@react-aria/utils':specifier: ^3.13.3version: 3.13.3([email protected])+ '@webstudio-is/css-data':+ specifier: workspace:^+ version: link:../css-data'@webstudio-is/css-vars':specifier: workspace:^version: link:../css-vars@@ -1288,6 +1291,9 @@ importers:shallow-equal:specifier: ^3.1.0version: 3.1.0+ tailwindcss:+ specifier: ^3.3.3+ version: 3.3.3devDependencies:'@storybook/react':specifier: ^7.1.0@@ -1486,6 +1492,11 @@ importers:packages:+ /@alloc/[email protected]:+ resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==}+ engines: {node: '>=10'}+ dev: false+/@ampproject/[email protected]:resolution: {integrity: sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==}engines: {node: '>=6.0.0'}@@ -1651,7 +1662,7 @@ packages:'@babel/helper-plugin-utils': 7.22.5debug: 4.3.4lodash.debounce: 4.0.8- resolve: 1.22.1+ resolve: 1.22.2transitivePeerDependencies:- supports-color@@ -7794,6 +7805,10 @@ packages:resolution: {integrity: sha512-VbqNsoz55SYGczauuup0MFUyXNQviSpFTj1RQtFzmQLk18qbVSpTFFGMT293rmDaQuKCT6InmbuEyUne4mTuxQ==}engines: {node: '>=12'}+ resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==}+ dev: false+resolution: {integrity: sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==}dependencies:@@ -7827,7 +7842,6 @@ packages:resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==}- dev: trueresolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==}@@ -8422,6 +8436,11 @@ packages:resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}engines: {node: '>=6'}+ resolution: {integrity: sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==}+ engines: {node: '>= 6'}+ dev: false+resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==}engines: {node: '>=6'}@@ -8688,6 +8707,11 @@ packages:resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}+ resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==}+ engines: {node: '>= 6'}+ dev: false+resolution: {integrity: sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==}engines: {node: '>= 6'}@@ -8729,7 +8753,7 @@ packages:dev: false- resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=}+ resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}resolution: {integrity: sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==}@@ -8876,7 +8900,6 @@ packages:resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==}engines: {node: '>=4'}hasBin: true- dev: trueresolution: {integrity: sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==}@@ -9120,6 +9143,10 @@ packages:resolution: {integrity: sha512-ED3jP8saaweFTjeGX8HQPjeC1YYyZs98jGNZx6IiBvxW7JG5v492kamAQB3m2wop07CvU/RQmzcKr6bgcC5D/Q==}dev: false+ resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==}+ dev: false+resolution: {integrity: sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==}engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}@@ -9134,6 +9161,10 @@ packages:dependencies:path-type: 4.0.0+ resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}+ dev: false+resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==}engines: {node: '>=0.10.0'}@@ -10546,6 +10577,17 @@ packages:minipass: 7.0.2path-scurry: 1.10.1+ resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==}+ dependencies:+ fs.realpath: 1.0.0+ inflight: 1.0.6+ inherits: 2.0.4+ minimatch: 3.1.2+ once: 1.4.0+ path-is-absolute: 1.0.1+ dev: false+resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}dependencies:@@ -11706,7 +11748,7 @@ packages:jest-pnp-resolver: 1.2.3([email protected])jest-util: 29.6.1jest-validate: 29.6.1- resolve: 1.22.1+ resolve: 1.22.2resolve.exports: 2.0.2slash: 3.0.0@@ -11887,6 +11929,11 @@ packages:- supports-color- ts-node+ resolution: {integrity: sha512-oVhqoRDaBXf7sjkll95LHVS6Myyyb1zaunVwk4Z0+WPSW4gjS0pl01zYKHScTuyEhQsFxV5L4DR5r+YqSyqyyg==}+ hasBin: true+ dev: false+resolution: {integrity: sha512-njj0VL2TsIxCtgzhO+9RRobBvws4oYyCM8TpvoUQwl/MbIM3NFJRR9+e6x0sS5xXaP1t6OCBkaBME98OV9zU5A==}dev: false@@ -12092,6 +12139,10 @@ packages:engines: {node: '>=10'}dev: true+ resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==}+ engines: {node: '>=10'}+resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}@@ -13015,6 +13066,14 @@ packages:resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==}+ resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}+ dependencies:+ any-promise: 1.3.0+ object-assign: 4.1.1+ thenify-all: 1.6.0+ dev: false+resolution: {integrity: sha512-vSB9X12bbNu4ALBu7nigJgRViZ6ja3OU7CeuiV1zMIbXOdmkLahgtPmh3GBOlDxbKY0CitqlPdOReGlBLSp+yg==}peerDependencies:@@ -13186,7 +13245,7 @@ packages:resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==}dependencies:hosted-git-info: 2.8.9- resolve: 1.22.1+ resolve: 1.22.2semver: 5.7.1validate-npm-package-license: 3.0.4@@ -13263,6 +13322,11 @@ packages:kind-of: 3.2.2dev: false+ resolution: {integrity: sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==}+ engines: {node: '>= 6'}+ dev: false+resolution: {integrity: sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==}@@ -13637,6 +13701,11 @@ packages:hasBin: truedev: true+ resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==}+ engines: {node: '>=0.10.0'}+ dev: false+resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==}engines: {node: '>=6'}@@ -13702,6 +13771,28 @@ packages:postcss: 8.4.27dev: true+ resolution: {integrity: sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==}+ engines: {node: '>=14.0.0'}+ peerDependencies:+ postcss: ^8.0.0+ dependencies:+ postcss: 8.4.27+ postcss-value-parser: 4.2.0+ read-cache: 1.0.0+ resolve: 1.22.2+ dev: false++ resolution: {integrity: sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==}+ engines: {node: ^12 || ^14 || >= 16}+ peerDependencies:+ postcss: ^8.4.21+ dependencies:+ camelcase-css: 2.0.1+ postcss: 8.4.27+ dev: false+resolution: {integrity: sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA==}engines: {node: '>= 14'}@@ -13714,10 +13805,9 @@ packages:ts-node:optional: truedependencies:- lilconfig: 2.0.6+ lilconfig: 2.1.0postcss: 8.4.27yaml: 2.2.1- dev: trueresolution: {integrity: sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==}@@ -13776,17 +13866,25 @@ packages:string-hash: 1.1.3dev: true+ resolution: {integrity: sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ==}+ engines: {node: '>=12.0'}+ peerDependencies:+ postcss: ^8.2.14+ dependencies:+ postcss: 8.4.27+ postcss-selector-parser: 6.0.11+ dev: false+resolution: {integrity: sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==}engines: {node: '>=4'}dependencies:cssesc: 3.0.0util-deprecate: 1.0.2- dev: trueresolution: {integrity: sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==}- dev: trueresolution: {integrity: sha512-gY/ACJtJPSmUFPDCHtX78+01fHa64FaU4zaaWfuh1MhGJISufJAH4cun6k/8fwsHYeK4UQmENQK+tRLCFJE8JQ==}@@ -14305,6 +14403,12 @@ packages:react: 18.2.0dev: false+ resolution: {integrity: sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==}+ dependencies:+ pify: 2.3.0+ dev: false+resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==}engines: {node: '>=8'}@@ -14639,6 +14743,14 @@ packages:path-parse: 1.0.7supports-preserve-symlinks-flag: 1.0.0+ resolution: {integrity: sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==}+ hasBin: true+ dependencies:+ is-core-module: 2.11.0+ path-parse: 1.0.7+ supports-preserve-symlinks-flag: 1.0.0+resolution: {integrity: sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==}hasBin: true@@ -15415,6 +15527,20 @@ packages:resolution: {integrity: sha512-lVrM/bNdhVX2OgBFNa2YJ9Lxj7kPzylieHd3TNjuGE0Re9JB7joL5VUKOVH1kdNNJTgGPpT8hmwIAPLaSyEVFQ==}dev: false+ resolution: {integrity: sha512-70/LQEZ07TEcxiU2dz51FKaE6hCTWC6vr7FOk3Gr0U60C3shtAN+H+BFr9XlYe5xqf3RA8nrc+VIwzCfnxuXJw==}+ engines: {node: '>=8'}+ hasBin: true+ dependencies:+ '@jridgewell/gen-mapping': 0.3.2+ commander: 4.1.1+ glob: 7.1.6+ lines-and-columns: 1.2.4+ mz: 2.7.0+ pirates: 4.0.5+ ts-interface-checker: 0.1.13+ dev: false+resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}engines: {node: '>=4'}@@ -15453,6 +15579,37 @@ packages:resolution: {integrity: sha512-k8uzYIkIVwmT+TcglpdN50pS2y1BDcUnBPK9iJeGu0Pl1lOI8pD6wtzgw91Pjpe+RxtTncw32tLxs/R0yNL2Mg==}+ resolution: {integrity: sha512-A0KgSkef7eE4Mf+nKJ83i75TMyq8HqY3qmFIJSWy8bNt0v1lG7jUcpGpoTFxAwYcWOphcTBLPPJg+bDfhDf52w==}+ engines: {node: '>=14.0.0'}+ hasBin: true+ dependencies:+ '@alloc/quick-lru': 5.2.0+ arg: 5.0.2+ chokidar: 3.5.3+ didyoumean: 1.2.2+ dlv: 1.1.3+ fast-glob: 3.2.12+ glob-parent: 6.0.2+ is-glob: 4.0.3+ jiti: 1.19.1+ lilconfig: 2.1.0+ micromatch: 4.0.5+ normalize-path: 3.0.0+ object-hash: 3.0.0+ picocolors: 1.0.0+ postcss: 8.4.27+ postcss-import: 15.1.0([email protected])+ postcss-js: 4.0.1([email protected])+ postcss-load-config: 4.0.1([email protected])+ postcss-nested: 6.0.1([email protected])+ postcss-selector-parser: 6.0.11+ resolve: 1.22.2+ sucrase: 3.34.0+ transitivePeerDependencies:+ - ts-node+ dev: false+resolution: {integrity: sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==}dependencies:@@ -15519,6 +15676,19 @@ packages:resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}dev: false+ resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==}+ engines: {node: '>=0.8'}+ dependencies:+ thenify: 3.3.1+ dev: false++ resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==}+ dependencies:+ any-promise: 1.3.0+ dev: false+resolution: {integrity: sha512-dTEWWNu6JmeVXY0ZYoPuH5cRIwc0MeGbJwah9KUNYSJwommQpCzTySTpEe8Gs1J23aeWEuAobe4Ag7EHVt/LOg==}engines: {node: '>=10'}@@ -15644,6 +15814,10 @@ packages:resolution: {integrity: sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ==}dev: false+ resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}+ dev: false+resolution: {integrity: sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==}dependencies:@@ -16541,7 +16715,6 @@ packages:resolution: {integrity: sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==}engines: {node: '>= 14'}- dev: trueresolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==}