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.

Backgrounds, part 2 (#1201)

Ivan Starkovd3fe47895392
diff --git a/apps/builder/app/builder/builder.tsx b/apps/builder/app/builder/builder.tsx
index ddaf38e42a..d27b61d933 100644
--- a/apps/builder/app/builder/builder.tsx
+++ b/apps/builder/app/builder/builder.tsx
@@ -48,6 +48,7 @@ import { useCopyPaste } from "~/shared/copy-paste";
import { AssetsProvider } from "./shared/assets";
import type { Asset } from "@webstudio-is/asset-uploader";
import { useSearchParams } from "@remix-run/react";
+import { useSyncInitializeOnce } from "~/shared/hook-utils";
registerContainers();
@@ -259,7 +260,14 @@ export const Builder = ({
const [searchParams] = useSearchParams();
const pageId = searchParams.get("pageId") ?? build.pages.homePage.id;
- selectedPageIdStore.set(pageId);
+
+ useSyncInitializeOnce(() => {
+ selectedPageIdStore.set(pageId);
+ });
+ useEffect(() => {
+ selectedPageIdStore.set(pageId);
+ }, [pageId]);
+
useSetAssets(assets);
useSetAuthToken(authToken);
diff --git a/apps/builder/app/builder/features/style-panel/controls/color/color-control.tsx b/apps/builder/app/builder/features/style-panel/controls/color/color-control.tsx
index 6c8a06b269..be257bace8 100644
--- a/apps/builder/app/builder/features/style-panel/controls/color/color-control.tsx
+++ b/apps/builder/app/builder/features/style-panel/controls/color/color-control.tsx
@@ -57,7 +57,7 @@ export const ColorControl = ({
}
return (
- <Flex align="center" css={{ gridColumn: "2/4" }} gap="1">
+ <Flex align="center" gap="1">
<ColorPicker
property={property}
value={value}
diff --git a/apps/builder/app/builder/features/style-panel/controls/image/image-control.tsx b/apps/builder/app/builder/features/style-panel/controls/image/image-control.tsx
index d0338061c9..de37b71c8d 100644
--- a/apps/builder/app/builder/features/style-panel/controls/image/image-control.tsx
+++ b/apps/builder/app/builder/features/style-panel/controls/image/image-control.tsx
@@ -1,4 +1,4 @@
-import { TextField } from "@webstudio-is/design-system";
+import { Button } from "@webstudio-is/design-system";
import type { ControlProps } from "../../style-sections";
import { FloatingPanel } from "~/builder/shared/floating-panel";
import { ImageManager } from "~/builder/shared/image-manager";
@@ -32,7 +32,9 @@ export const ImageControl = ({
/>
}
>
- <TextField defaultValue={valueAsset?.value.name} />
+ <Button color="neutral" css={{ maxWidth: "100%", justifySelf: "right" }}>
+ {valueAsset?.value.name ?? "Choose image..."}
+ </Button>
</FloatingPanel>
);
};
diff --git a/apps/builder/app/builder/features/style-panel/controls/object-position/object-position-control.tsx b/apps/builder/app/builder/features/style-panel/controls/object-position/object-position-control.tsx
index 64eb2c83c9..8c225550c3 100644
--- a/apps/builder/app/builder/features/style-panel/controls/object-position/object-position-control.tsx
+++ b/apps/builder/app/builder/features/style-panel/controls/object-position/object-position-control.tsx
@@ -1,4 +1,4 @@
-import { Flex, IconButton } from "@webstudio-is/design-system";
+import { Flex, IconButton, theme } from "@webstudio-is/design-system";
import type { ControlProps } from "../../style-sections";
import { FloatingPanel } from "~/builder/shared/floating-panel";
import { MenuIcon } from "@webstudio-is/icons";
@@ -15,12 +15,14 @@ export const ObjectPositionControl = ({
<FloatingPanel
title="Object Position"
content={
- <PositionControl
- property={property}
- currentStyle={currentStyle}
- setProperty={setProperty}
- deleteProperty={deleteProperty}
- />
+ <Flex css={{ px: theme.spacing[9], py: theme.spacing[5] }}>
+ <PositionControl
+ property={property}
+ currentStyle={currentStyle}
+ setProperty={setProperty}
+ deleteProperty={deleteProperty}
+ />
+ </Flex>
}
>
<IconButton>
diff --git a/apps/builder/app/builder/features/style-panel/controls/position/css-value-input-container.tsx b/apps/builder/app/builder/features/style-panel/controls/position/css-value-input-container.tsx
index be29c59e0f..20d46085b0 100644
--- a/apps/builder/app/builder/features/style-panel/controls/position/css-value-input-container.tsx
+++ b/apps/builder/app/builder/features/style-panel/controls/position/css-value-input-container.tsx
@@ -16,6 +16,7 @@ type CssValueInputContainerProps = {
value?: StyleValue;
setValue: SetValue;
deleteProperty: DeleteProperty;
+ disabled?: boolean;
};
export const CssValueInputContainer = ({
@@ -26,6 +27,7 @@ export const CssValueInputContainer = ({
value,
setValue,
deleteProperty,
+ disabled,
}: CssValueInputContainerProps) => {
const [intermediateValue, setIntermediateValue] = useState<
StyleValue | IntermediateStyleValue
@@ -35,6 +37,7 @@ export const CssValueInputContainer = ({
<EnhancedTooltip content={label}>
<Box>
<CssValueInput
+ disabled={disabled}
styleSource={styleSource}
property={property}
value={value}
diff --git a/apps/builder/app/builder/features/style-panel/controls/position/position-control.tsx b/apps/builder/app/builder/features/style-panel/controls/position/position-control.tsx
index ebc51446e1..36e7c6bf3c 100644
--- a/apps/builder/app/builder/features/style-panel/controls/position/position-control.tsx
+++ b/apps/builder/app/builder/features/style-panel/controls/position/position-control.tsx
@@ -66,11 +66,7 @@ export const PositionControl = ({
};
return (
- <Flex
- direction="column"
- gap="1"
- css={{ px: theme.spacing[9], py: theme.spacing[5] }}
- >
+ <Flex direction="column" gap="1">
<Label>Position</Label>
<Flex gap="6">
<PositionGrid
@@ -85,7 +81,11 @@ export const PositionControl = ({
});
}}
/>
- <Flex direction="column" justify="between">
+ <Flex
+ css={{ my: theme.spacing[3] }}
+ direction="column"
+ justify="between"
+ >
<Flex align="center" gap="2">
<Label>Left</Label>
<CssValueInputContainer
diff --git a/apps/builder/app/builder/features/style-panel/controls/text/text-control.tsx b/apps/builder/app/builder/features/style-panel/controls/text/text-control.tsx
index dfb0a04642..21c6070987 100644
--- a/apps/builder/app/builder/features/style-panel/controls/text/text-control.tsx
+++ b/apps/builder/app/builder/features/style-panel/controls/text/text-control.tsx
@@ -16,6 +16,7 @@ export const TextControl = ({
setProperty,
deleteProperty,
icon,
+ disabled,
}: ControlProps & { icon?: JSX.Element }) => {
const { label, items: defaultItems } = styleConfigByName[property];
const styleInfo = currentStyle[property];
@@ -31,6 +32,7 @@ export const TextControl = ({
<EnhancedTooltip content={label}>
<Box>
<CssValueInput
+ disabled={disabled}
styleSource={getStyleSource(styleInfo)}
icon={icon}
property={property}
diff --git a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-content.stories.tsx b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-content.stories.tsx
new file mode 100644
index 0000000000..71440ecf16
--- /dev/null
+++ b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-content.stories.tsx
@@ -0,0 +1,63 @@
+import { BackgroundContent } from "./background-content";
+import { getLayerBackgroundStyleInfo } from "./background-layers";
+import {
+ FloatingPanel,
+ FloatingPanelProvider,
+} from "~/builder/shared/floating-panel";
+import { useRef, useState } from "react";
+import type { StyleValue } from "@webstudio-is/css-data";
+
+const defaultCurrentStyle = getLayerBackgroundStyleInfo(0, {
+ backgroundImage: {
+ value: {
+ type: "layers",
+ value: [{ type: "keyword", value: "none" }],
+ },
+ },
+});
+const deleteProperty = () => () => {
+ // do nothing
+};
+
+export const BackgroundContentStory = () => {
+ const elementRef = useRef<HTMLDivElement>(null);
+
+ const [currentStyle, setCurrentStyle] = useState(defaultCurrentStyle);
+
+ const setProperty = (propertyName: string) => (style: StyleValue) => {
+ setCurrentStyle({
+ ...currentStyle,
+ [propertyName]: {
+ value: style,
+ local: style,
+ },
+ });
+ };
+
+ return (
+ <>
+ <div ref={elementRef} style={{ marginLeft: "400px" }}></div>
+
+ <FloatingPanelProvider container={elementRef}>
+ <FloatingPanel
+ open={true}
+ title="Background"
+ content={
+ <BackgroundContent
+ currentStyle={currentStyle}
+ deleteProperty={deleteProperty}
+ setProperty={setProperty}
+ />
+ }
+ >
+ <div>Trigger</div>
+ </FloatingPanel>
+ </FloatingPanelProvider>
+ </>
+ );
+};
+
+export default {
+ title: "Style/Background",
+ component: BackgroundContent,
+};
diff --git a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-content.tsx b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-content.tsx
index 29fcaf6571..198a67a7df 100644
--- a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-content.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-content.tsx
@@ -4,8 +4,18 @@
**/
import type { StyleValue } from "@webstudio-is/css-data";
-import { theme, Flex, Grid, Label } from "@webstudio-is/design-system";
-import { ImageControl, TextControl } from "../../controls";
+import {
+ theme,
+ Flex,
+ Grid,
+ Label,
+ ToggleGroup,
+ ToggleGroupItem,
+ Separator,
+ styled,
+ Tooltip,
+} from "@webstudio-is/design-system";
+import { ImageControl, SelectControl, PositionControl } from "../../controls";
import type { StyleInfo } from "../../shared/style-info";
import type {
DeleteProperty,
@@ -21,7 +31,18 @@ import {
} from "./background-layers";
import { FloatingPanelProvider } from "~/builder/shared/floating-panel";
-import { useRef } from "react";
+import { useRef, useState } from "react";
+import { BackgroundSize } from "./background-size";
+import { ToggleGroupControl } from "../../controls/toggle/toggle-control";
+import {
+ RepeatGridIcon,
+ RepeatColumnIcon,
+ RepeatRowIcon,
+ CrossSmallIcon,
+ InformationIcon,
+} from "@webstudio-is/icons";
+import { toValue } from "@webstudio-is/css-engine";
+import { BackgroundGradient } from "./background-gradient";
type BackgroundContentProps = {
currentStyle: StyleInfo;
@@ -43,167 +64,262 @@ const safeDeleteProperty = (
const safeSetProperty = (setBackgroundProperty: SetBackgroundProperty) => {
const result: SetProperty = (property) => {
- // isBackgroundLayeredProperty is typeguard and ts don't understand === false
- if (!isBackgroundLayeredProperty(property)) {
- throw new Error(
- `Property ${property} should be background style property`
- );
- }
- return (style: string | StyleValue, options?: StyleUpdateOptions) => {
- if (typeof style === "string") {
- throw new Error("style should be StyleValue and not a string");
- }
+ if (isBackgroundLayeredProperty(property)) {
+ return (style: string | StyleValue, options?: StyleUpdateOptions) => {
+ if (typeof style === "string") {
+ throw new Error("style should be StyleValue and not a string");
+ }
+
+ if (isBackgroundStyleValue(style)) {
+ return setBackgroundProperty(property)(style, options);
+ }
- // isBackgroundStyleValue is typeguard and ts don't understand === false
- if (!isBackgroundStyleValue(style)) {
throw new Error("Style should be valid BackgroundStyleValue");
- }
+ };
+ }
- return setBackgroundProperty(property)(style, options);
- };
+ throw new Error(`Property ${property} should be background style property`);
};
+
return result;
};
-/*
-@todo remove comment after section done
+const detectImageOrGradientToggle = (currentStyle: StyleInfo) => {
+ if (currentStyle?.backgroundImage?.value.type === "image") {
+ return "image";
+ }
-Stackable: !default!
+ if (currentStyle?.backgroundImage?.value.type === "keyword") {
+ // The only allowed keyword for backgroundImage is none
+ return "image";
+ }
+ return "gradient";
+};
-background-image: url, linear-gradient, radial-gradient, repeating-linear-gradient, repeating-radial-gradient etc
-
-background-clip: !border-box!, padding-box, content-box, text
-background-origin: border-box, !padding-box!, content-box
-background-size: cover, contain, !auto!, x[unit] y[unit]
-
-background-position-x: !0%!, left, center, right, x[unit]
-background-position-y: !0%!, top, center, bottom, y[unit]
-
-background-repeat-x,
-background-repeat-y: !repeat!, space, round, no-repeat
-
-background-attachment: !scroll!, fixed, local
-
-background-blend-mode: !normal!, multiply, screen, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color, luminosity
+const isImageOrGradient = (value: string): value is "image" | "gradient" => {
+ return value === "image" || value === "gradient";
+};
-Not stackable:
+const BackgroundSection = styled("div", {
+ mx: theme.spacing[9],
+ my: theme.spacing[6],
+});
-background-color
-*/
+const Spacer = styled("div", {
+ height: theme.spacing[5],
+});
export const BackgroundContent = (props: BackgroundContentProps) => {
const setProperty = safeSetProperty(props.setProperty);
const deleteProperty = safeDeleteProperty(props.deleteProperty);
const elementRef = useRef<HTMLDivElement>(null);
+ const [imageGradientToggle, setImageGradientToggle] = useState<
+ "image" | "gradient"
+ >(() => detectImageOrGradientToggle(props.currentStyle));
return (
- <Flex
- css={{ p: theme.spacing[9] }}
- direction="column"
- gap={2}
- ref={elementRef}
- >
- <Grid css={{ gridTemplateColumns: "4fr 6fr" }} align="center" gap={2}>
- <Label color="default" truncate>
- Image
- </Label>
- <FloatingPanelProvider container={elementRef}>
- <ImageControl
+ <>
+ <BackgroundSection ref={elementRef}>
+ <Flex justify="center">
+ <ToggleGroup
+ type="single"
+ value={imageGradientToggle}
+ onValueChange={(value) => {
+ if (isImageOrGradient(value)) {
+ setImageGradientToggle(value);
+ }
+ }}
+ >
+ <ToggleGroupItem value={"image"}>
+ <Flex css={{ px: theme.spacing[2] }}>Image</Flex>
+ </ToggleGroupItem>
+ <ToggleGroupItem value={"gradient"}>
+ <Flex css={{ px: theme.spacing[2] }}>Gradient</Flex>
+ </ToggleGroupItem>
+ </ToggleGroup>
+ </Flex>
+ </BackgroundSection>
+
+ <Separator css={{ gridColumn: "span 2" }} />
+
+ <BackgroundSection>
+ <Grid css={{ gridTemplateColumns: "1fr 128px" }} align="center" gap={2}>
+ {imageGradientToggle === "image" && (
+ <>
+ <Label color="default" truncate>
+ Image
+ </Label>
+
+ <FloatingPanelProvider container={elementRef}>
+ <ImageControl
+ setProperty={setProperty}
+ deleteProperty={deleteProperty}
+ currentStyle={props.currentStyle}
+ property="backgroundImage"
+ />
+ </FloatingPanelProvider>
+ </>
+ )}
+
+ {imageGradientToggle === "gradient" && (
+ <Flex css={{ gridColumn: "span 2" }} direction="column">
+ <Label color="default">
+ <Flex align={"center"} gap={1}>
+ Code
+ <Tooltip
+ variant="wrapped"
+ content={
+ <>
+ Paste a CSS gradient, for example:
+ <br />
+ <br />
+ linear-gradient(...)
+ <br />
+ <br />
+ If pasting from figma, remove the “background” property
+ name.
+ </>
+ }
+ >
+ <InformationIcon />
+ </Tooltip>
+ </Flex>
+ </Label>
+
+ <BackgroundGradient
+ setProperty={setProperty}
+ deleteProperty={deleteProperty}
+ currentStyle={props.currentStyle}
+ />
+ </Flex>
+ )}
+
+ <Label color="default" truncate>
+ Clip
+ </Label>
+
+ <SelectControl
setProperty={setProperty}
deleteProperty={deleteProperty}
currentStyle={props.currentStyle}
- property="backgroundImage"
+ property="backgroundClip"
/>
- </FloatingPanelProvider>
- <Label color="default" truncate>
- Clip
- </Label>
+ <Label color="default" truncate>
+ Origin
+ </Label>
- <TextControl
- setProperty={setProperty}
- deleteProperty={deleteProperty}
- currentStyle={props.currentStyle}
- property="backgroundClip"
- />
-
- <Label color="default" truncate>
- Origin
- </Label>
-
- <TextControl
- setProperty={setProperty}
- deleteProperty={deleteProperty}
- currentStyle={props.currentStyle}
- property="backgroundOrigin"
- />
-
- <Label color="default" truncate>
- Size
- </Label>
-
- <TextControl
- setProperty={setProperty}
- deleteProperty={deleteProperty}
- currentStyle={props.currentStyle}
- property="backgroundSize"
- />
-
- <Label color="default" truncate>
- Position X
- </Label>
-
- <TextControl
- setProperty={setProperty}
- deleteProperty={deleteProperty}
- currentStyle={props.currentStyle}
- property="backgroundPositionX"
- />
+ <SelectControl
+ setProperty={setProperty}
+ deleteProperty={deleteProperty}
+ currentStyle={props.currentStyle}
+ property="backgroundOrigin"
+ />
+ </Grid>
- <Label color="default" truncate>
- Position Y
- </Label>
+ <Spacer />
- <TextControl
+ <BackgroundSize
setProperty={setProperty}
deleteProperty={deleteProperty}
currentStyle={props.currentStyle}
- property="backgroundPositionY"
/>
- <Label color="default" truncate>
- Repeat
- </Label>
+ <Spacer />
- <TextControl
+ <PositionControl
setProperty={setProperty}
deleteProperty={deleteProperty}
currentStyle={props.currentStyle}
- property="backgroundRepeat"
+ property="backgroundPosition"
/>
- <Label color="default" truncate>
- Attachment
- </Label>
- <TextControl
- setProperty={setProperty}
- deleteProperty={deleteProperty}
- currentStyle={props.currentStyle}
- property="backgroundAttachment"
- />
-
- <Label color="default" truncate>
- Blend mode
- </Label>
- <TextControl
- setProperty={setProperty}
- deleteProperty={deleteProperty}
- currentStyle={props.currentStyle}
- property="backgroundBlendMode"
- />
- </Grid>
- </Flex>
+ <Grid
+ css={{ gridTemplateColumns: "1fr 128px", mt: theme.spacing[5] }}
+ align="center"
+ gap={2}
+ >
+ {imageGradientToggle === "image" && (
+ <>
+ <Label color="default" truncate>
+ Repeat
+ </Label>
+
+ <Flex css={{ justifySelf: "end" }}>
+ <ToggleGroupControl
+ styleSource={"default"}
+ onValueChange={(value) =>
+ setProperty("backgroundRepeat")({
+ type: "keyword",
+ value,
+ })
+ }
+ value={toValue(props.currentStyle.backgroundRepeat?.value)}
+ items={[
+ {
+ child: <CrossSmallIcon />,
+ label: "background-repeat: no-repeat",
+ value: "no-repeat",
+ },
+ {
+ child: <RepeatGridIcon />,
+ label: "background-repeat: repeat",
+ value: "repeat",
+ },
+ {
+ child: <RepeatColumnIcon />,
+ label: "background-repeat: repeat-y",
+ value: "repeat-y",
+ },
+ {
+ child: <RepeatRowIcon />,
+ label: "background-repeat: repeat-x",
+ value: "repeat-x",
+ },
+ ]}
+ />
+ </Flex>
+ </>
+ )}
+
+ <Label color="default" truncate>
+ Attachment
+ </Label>
+
+ <Flex css={{ justifySelf: "end" }}>
+ <ToggleGroup
+ type="single"
+ value={toValue(props.currentStyle.backgroundAttachment?.value)}
+ onValueChange={(value) => {
+ setProperty("backgroundAttachment")({
+ type: "keyword",
+ value,
+ });
+ }}
+ >
+ <ToggleGroupItem value={"scroll"}>
+ <Flex css={{ px: theme.spacing[3] }}>Scroll</Flex>
+ </ToggleGroupItem>
+ <ToggleGroupItem value={"fixed"}>
+ <Flex css={{ px: theme.spacing[3] }}>Fixed</Flex>
+ </ToggleGroupItem>
+ </ToggleGroup>
+ </Flex>
+
+ <Label color="default" truncate>
+ Blend mode
+ </Label>
+
+ <SelectControl
+ setProperty={setProperty}
+ deleteProperty={deleteProperty}
+ currentStyle={props.currentStyle}
+ property="backgroundBlendMode"
+ />
+ </Grid>
+ </BackgroundSection>
+ </>
);
};
diff --git a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-gradient.tsx b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-gradient.tsx
new file mode 100644
index 0000000000..6f0b01763e
--- /dev/null
+++ b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-gradient.tsx
@@ -0,0 +1,70 @@
+import { TextArea, theme } from "@webstudio-is/design-system";
+import { useEffect, useRef, useState } from "react";
+import { parseCssValue } from "../../shared/parse-css-value";
+import type { ControlProps } from "../../style-sections";
+
+export const BackgroundGradient = (
+ props: Omit<ControlProps, "property" | "items">
+) => {
+ const property = "backgroundImage";
+
+ const styleInfo = props.currentStyle[property];
+ const styleValue = styleInfo?.value;
+
+ // In gradient section we want to show gradient data only
+ const [intermediateValue, setIntermediateValue] = useState<
+ string | undefined
+ >(undefined);
+
+ const value =
+ intermediateValue ??
+ (styleValue?.type === "unparsed" ? styleValue.value : undefined);
+
+ const handleChange = (value: string, isEphemeral: boolean) => {
+ setIntermediateValue(isEphemeral ? value : undefined);
+
+ const newValue = parseCssValue(property, value);
+
+ if (newValue.type === "unparsed") {
+ props.setProperty(property)(newValue, { isEphemeral });
+ return;
+ }
+
+ props.deleteProperty(property, { isEphemeral });
+ };
+
+ const handleOnComplete = () => {
+ if (intermediateValue !== undefined) {
+ handleChange(intermediateValue, false);
+ }
+ };
+
+ const handleOnCompleteRef = useRef(handleOnComplete);
+ handleOnCompleteRef.current = handleOnComplete;
+
+ // Blur wouldn't fire if user clicks outside of the FloatingPanel
+ useEffect(() => {
+ return () => {
+ handleOnCompleteRef.current();
+ };
+ }, []);
+
+ return (
+ <TextArea
+ css={{ minHeight: theme.spacing[14] }}
+ rows={2}
+ name="description"
+ disabled={props.disabled}
+ value={value}
+ onChange={(event) => {
+ handleChange(event.target.value, true);
+ }}
+ onBlur={handleOnComplete}
+ onKeyDown={(event) => {
+ if (event.key === "Enter") {
+ handleOnComplete();
+ }
+ }}
+ />
+ );
+};
diff --git a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-layers.test.ts b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-layers.test.ts
index 2ee8d7c746..e989e81df3 100644
--- a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-layers.test.ts
+++ b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-layers.test.ts
@@ -49,7 +49,7 @@ describe("setLayerProperty", () => {
const setProperty = setLayerProperty(0, styleInfo, createBatchUpdate);
- setProperty("backgroundPositionX")({ type: "unit", value: 10, unit: "px" });
+ setProperty("backgroundPosition")({ type: "unit", value: 10, unit: "px" });
expect(published).toBe(true);
@@ -163,7 +163,7 @@ describe("setLayerProperty", () => {
const setProperty = setLayerProperty(0, styleInfo, createBatchUpdate);
- setProperty("backgroundPositionX")({ type: "unit", value: 10, unit: "px" });
+ setProperty("backgroundPosition")({ type: "unit", value: 10, unit: "px" });
expect(published).toBe(true);
diff --git a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-layers.ts b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-layers.ts
index 2b0c7e0979..3dfed74b72 100644
--- a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-layers.ts
+++ b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-layers.ts
@@ -12,8 +12,7 @@ export const layeredBackgroundPropsDefaults = {
backgroundBlendMode: { type: "keyword", value: "normal" },
backgroundImage: { type: "keyword", value: "none" },
backgroundOrigin: { type: "keyword", value: "padding-box" },
- backgroundPositionX: { type: "unit", value: 0, unit: "%" },
- backgroundPositionY: { type: "unit", value: 0, unit: "%" },
+ backgroundPosition: { type: "unit", value: 0, unit: "%" },
backgroundRepeat: { type: "keyword", value: "repeat" },
backgroundSize: { type: "keyword", value: "auto" },
} as const satisfies Record<string, BackgroundStyleValue>;
@@ -28,6 +27,7 @@ export const isBackgroundStyleValue = (
style.type === "keyword" ||
style.type === "unparsed" ||
style.type === "image" ||
+ style.type === "tuple" ||
style.type === "invalid"
) {
return true;
diff --git a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-size.tsx b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-size.tsx
new file mode 100644
index 0000000000..34b7ca05f3
--- /dev/null
+++ b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-size.tsx
@@ -0,0 +1,131 @@
+import { Grid, Label, Select, theme } from "@webstudio-is/design-system";
+import { toValue } from "@webstudio-is/css-engine";
+import { styleConfigByName } from "../../shared/configs";
+import { toPascalCase } from "../../shared/keyword-utils";
+import { parseCssValue } from "../../shared/parse-css-value";
+import type { ControlProps } from "../../style-sections";
+import { CssValueInputContainer } from "../../controls/position/css-value-input-container";
+import { StyleValue, TupleValue, TupleValueItem } from "@webstudio-is/css-data";
+import type { SetValue } from "../../shared/use-style-data";
+
+const StyleKeywordAuto = { type: "keyword" as const, value: "auto" };
+
+const toTuple = (
+ valueX?: StyleValue | string,
+ valueY?: StyleValue | string
+) => {
+ const parsedValue = TupleValue.safeParse(valueX);
+ if (parsedValue.success) {
+ return parsedValue.data;
+ }
+
+ const parsedValueX = valueX ? TupleValueItem.parse(valueX) : StyleKeywordAuto;
+ const parsedValueY = valueY ? TupleValueItem.parse(valueY) : parsedValueX;
+
+ return {
+ type: "tuple" as const,
+ value: [parsedValueX, parsedValueY],
+ };
+};
+
+export const BackgroundSize = (
+ props: Omit<ControlProps, "property" | "items">
+) => {
+ const property = "backgroundSize";
+
+ const styleInfo = props.currentStyle[property];
+ const styleValue = styleInfo?.value;
+ const styleSource = "default";
+ const { items: defaultItems } = styleConfigByName[property];
+
+ const selectOptions = [
+ ...defaultItems,
+ { name: "custom", label: "Custom" },
+ ].map(({ name }) => name);
+ const selectValue =
+ styleValue?.type === "keyword" ? toValue(styleValue) : "custom";
+
+ const customSizeDisabled = styleValue?.type === "keyword";
+ const customSizeOptions = [StyleKeywordAuto];
+ const customSizeValue = toTuple(styleValue);
+
+ const setValue = props.setProperty(property);
+
+ const setValueX: SetValue = (valueX, options) => {
+ const nextValue = toTuple(valueX, customSizeValue.value[1]);
+ setValue(nextValue, options);
+ };
+
+ const setValueY: SetValue = (valueY, options) => {
+ const nextValue = toTuple(customSizeValue.value[0], valueY);
+ setValue(nextValue, options);
+ };
+
+ return (
+ <>
+ <Grid css={{ gridTemplateColumns: "1fr 128px" }} align="center" gap={2}>
+ <Label color="default" truncate>
+ Size
+ </Label>
+
+ <Select
+ // show empty field instead of radix placeholder
+ // like css value input does
+ placeholder=""
+ options={selectOptions}
+ getLabel={toPascalCase}
+ value={selectValue}
+ onChange={(name) => {
+ if (name === "custom") {
+ setValue({
+ type: "tuple",
+ value: [StyleKeywordAuto, StyleKeywordAuto],
+ });
+ } else {
+ const cssValue = parseCssValue(property, name);
+ setValue(cssValue);
+ }
+ }}
+ />
+ </Grid>
+
+ <Grid
+ css={{ mt: theme.spacing[4] }}
+ align="center"
+ columns={2}
+ gapX={2}
+ gapY={1}
+ >
+ <Label color="default" disabled={customSizeDisabled} truncate>
+ Width
+ </Label>
+
+ <Label color="default" disabled={customSizeDisabled} truncate>
+ Height
+ </Label>
+
+ <CssValueInputContainer
+ disabled={customSizeDisabled}
+ label={"Width"}
+ property={property}
+ styleSource={styleSource}
+ keywords={customSizeOptions}
+ value={customSizeValue.value[0]}
+ setValue={setValueX}
+ deleteProperty={props.deleteProperty}
+ />
+
+ <CssValueInputContainer
+ disabled={customSizeDisabled}
+ label={"Height"}
+ property={property}
+ styleSource={styleSource}
+ keywords={customSizeOptions}
+ value={customSizeValue.value[1]}
+ setValue={setValueY}
+ deleteProperty={props.deleteProperty}
+ />
+ </Grid>
+ </>
+ );
+};
diff --git a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-thumbnail.tsx b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-thumbnail.tsx
index 69b308be89..48ca5291e9 100644
--- a/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-thumbnail.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/backgrounds/background-thumbnail.tsx
@@ -3,11 +3,14 @@ import { styled, theme } from "@webstudio-is/design-system";
import type { StyleInfo } from "../../shared/style-info";
import brokenImage from "~/shared/images/broken-image-placeholder.svg";
import env from "~/shared/env";
+import { layeredBackgroundProps } from "./background-layers";
+import type { StyleProperty } from "@webstudio-is/css-data";
+import { toValue } from "@webstudio-is/css-engine";
+import { toPascalCase } from "../../shared/keyword-utils";
const Thumbnail = styled("div", {
width: theme.spacing[10],
height: theme.spacing[10],
- backgroundImage: "linear-gradient(yellow, red)",
});
const NoneThumbnail = styled("div", {
@@ -43,14 +46,27 @@ const StyledWebstudioImage = styled(WebstudioImage, {
},
});
+const gradientNames = [
+ "conic-gradient",
+ "linear-gradient",
+ "radial-gradient",
+ "repeating-conic-gradient",
+ "repeating-linear-gradient",
+ "repeating-radial-gradient",
+];
+
export const getLayerName = (layerStyle: StyleInfo) => {
const backgroundImageStyle = layerStyle.backgroundImage?.value;
if (backgroundImageStyle?.type === "image") {
- return "Image"; // backgroundImageStyle.value.value.name;
+ return backgroundImageStyle.value.value.name;
}
if (backgroundImageStyle?.type === "unparsed") {
- return "Gradient";
+ const gradientName = gradientNames.find((name) =>
+ backgroundImageStyle.value.includes(name)
+ );
+
+ return gradientName ? toPascalCase(gradientName) : "Gradient";
}
return "None";
@@ -82,7 +98,13 @@ export const LayerThumbnail = (props: { layerStyle: StyleInfo }) => {
}
if (backgroundImageStyle?.type === "unparsed") {
- return <Thumbnail />;
+ const cssStyle: { [property in StyleProperty]?: string } = {};
+
+ for (const property of layeredBackgroundProps) {
+ cssStyle[property] = toValue(props.layerStyle[property]?.value);
+ }
+
+ return <Thumbnail css={cssStyle} />;
}
return <NoneThumbnail />;
diff --git a/apps/builder/app/builder/features/style-panel/sections/backgrounds/backgrounds.tsx b/apps/builder/app/builder/features/style-panel/sections/backgrounds/backgrounds.tsx
index e80eae1f59..38604b136f 100644
--- a/apps/builder/app/builder/features/style-panel/sections/backgrounds/backgrounds.tsx
+++ b/apps/builder/app/builder/features/style-panel/sections/backgrounds/backgrounds.tsx
@@ -117,7 +117,7 @@ export const BackgroundsSection = ({
))}
<Flex css={{ px: theme.spacing[9] }} direction="column" gap={2}>
- <Grid css={{ gridTemplateColumns: "4fr 6fr" }}>
+ <Grid css={{ gridTemplateColumns: "1fr 128px" }}>
<PropertyName
style={currentStyle}
property={"backgroundColor"}
diff --git a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
index fa65cddaf2..2354e66f51 100644
--- a/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
+++ b/apps/builder/app/builder/features/style-panel/shared/css-value-input/css-value-input.tsx
@@ -218,6 +218,7 @@ type CssValueInputProps = {
* Selected item in the dropdown
*/
keywords?: Array<KeywordValue>;
+ disabled?: boolean;
onChange: (value: CssValueInputValue | undefined) => void;
onChangeComplete: (event: {
value: StyleValue;
@@ -289,6 +290,7 @@ export const CssValueInput = ({
keywords = [],
onHighlight,
onAbort,
+ disabled,
...props
}: CssValueInputProps & { icon?: JSX.Element }) => {
const value = props.intermediateValue ?? props.value ?? initialValue;
@@ -490,6 +492,7 @@ export const CssValueInput = ({
<Box {...getComboboxProps()}>
<ComboboxPopperAnchor>
<TextField
+ disabled={disabled}
{...inputProps}
onFocus={() => {
const isFocused = document.activeElement === inputRef.current;
diff --git a/apps/builder/app/builder/features/style-panel/style-sections.tsx b/apps/builder/app/builder/features/style-panel/style-sections.tsx
index 37139551e5..f9c25961aa 100644
--- a/apps/builder/app/builder/features/style-panel/style-sections.tsx
+++ b/apps/builder/app/builder/features/style-panel/style-sections.tsx
@@ -31,6 +31,7 @@ export type ControlProps = {
currentStyle: StyleInfo;
setProperty: SetProperty;
deleteProperty: DeleteProperty;
+ disabled?: boolean;
};
export type RenderCategoryProps = {
diff --git a/apps/builder/app/builder/shared/floating-panel/floating-panel.tsx b/apps/builder/app/builder/shared/floating-panel/floating-panel.tsx
index 296a386203..199763e5f3 100644
--- a/apps/builder/app/builder/shared/floating-panel/floating-panel.tsx
+++ b/apps/builder/app/builder/shared/floating-panel/floating-panel.tsx
@@ -41,8 +41,8 @@ const useSideOffset = ({
return [triggerRef, sideOffset];
};
-const useLogic = (onOpenChange?: (isOpen: boolean) => void) => {
- const [isOpen, setIsOpen] = useState(false);
+const useLogic = (open?: boolean, onOpenChange?: (isOpen: boolean) => void) => {
+ const [isOpen, setIsOpen] = useState(Boolean(open));
const [triggerRef, sideOffset] = useSideOffset({ isOpen });
const handleOpenChange = (open: boolean) => {
setIsOpen(open);
@@ -56,6 +56,7 @@ type FloatingPanelProps = {
title: string;
content: JSX.Element;
children: JSX.Element;
+ open?: boolean;
onOpenChange?: (isOpen: boolean) => void;
};
@@ -65,10 +66,13 @@ export const FloatingPanel = ({
title,
content,
children,
+ open,
onOpenChange,
}: FloatingPanelProps) => {
- const { isOpen, handleOpenChange, triggerRef, sideOffset } =
- useLogic(onOpenChange);
+ const { isOpen, handleOpenChange, triggerRef, sideOffset } = useLogic(
+ open,
+ onOpenChange
+ );
return (
<FloatingPanelPopover open={isOpen} onOpenChange={handleOpenChange} modal>
<FloatingPanelPopoverTrigger asChild ref={triggerRef}>
diff --git a/packages/css-data/bin/mdn-data.ts b/packages/css-data/bin/mdn-data.ts
index 2cb85e94d0..d1848620f2 100755
--- a/packages/css-data/bin/mdn-data.ts
+++ b/packages/css-data/bin/mdn-data.ts
@@ -165,12 +165,7 @@ type FilteredProperties = { [property in Property]: Value };
const filteredProperties: FilteredProperties = (() => {
// A list of properties we don't want to show
- const ignoreProperties = [
- "all",
- "-webkit-line-clamp",
- "--*",
- "background-position",
- ];
+ const ignoreProperties = ["all", "-webkit-line-clamp", "--*"];
let property: Property;
const result = {} as FilteredProperties;
for (property in properties) {
diff --git a/packages/css-data/src/__generated__/keyword-values.ts b/packages/css-data/src/__generated__/keyword-values.ts
index 159d02a3e1..368f2d8ab1 100644
--- a/packages/css-data/src/__generated__/keyword-values.ts
+++ b/packages/css-data/src/__generated__/keyword-values.ts
@@ -486,6 +486,7 @@ export const keywordValues = {
],
backgroundImage: ["none"],
backgroundOrigin: ["border-box", "padding-box", "content-box"],
+ backgroundPosition: ["left", "center", "right", "top", "bottom"],
backgroundPositionX: ["center", "left", "right", "x-start", "x-end"],
backgroundPositionY: ["center", "top", "bottom", "y-start", "y-end"],
backgroundRepeat: [
diff --git a/packages/css-data/src/__generated__/properties.ts b/packages/css-data/src/__generated__/properties.ts
index 0cce244fa6..3e4511547d 100644
--- a/packages/css-data/src/__generated__/properties.ts
+++ b/packages/css-data/src/__generated__/properties.ts
@@ -253,6 +253,16 @@ export const properties = {
popularity: 0.0847006,
appliesTo: "allElements",
},
+ backgroundPosition: {
+ unitGroups: ["length", "percentage"],
+ inherited: false,
+ initial: {
+ type: "keyword",
+ value: "0% 0%",
+ },
+ popularity: 0.76724967,
+ appliesTo: "allElements",
+ },
backgroundPositionX: {
unitGroups: ["length", "percentage"],
inherited: false,
diff --git a/packages/css-data/src/schema.ts b/packages/css-data/src/schema.ts
index 7ed76900d2..ba2733ab08 100644
--- a/packages/css-data/src/schema.ts
+++ b/packages/css-data/src/schema.ts
@@ -89,28 +89,35 @@ const UnsetValue = z.object({
});
export type UnsetValue = z.infer<typeof UnsetValue>;
+export const TupleValueItem = z.union([UnitValue, KeywordValue, UnparsedValue]);
+export type TupleValueItem = z.infer<typeof TupleValueItem>;
+
+export const TupleValue = z.object({
+ type: z.literal("tuple"),
+ value: z.array(TupleValueItem),
+});
+
+export type TupleValue = z.infer<typeof TupleValue>;
+
// To support background layers https://developer.mozilla.org/en-US/docs/Web/CSS/background
// and similar comma separated css properties
// InvalidValue used in case of asset not found
export const LayersValue = z.object({
type: z.literal("layers"),
value: z.array(
- z.union([UnitValue, KeywordValue, UnparsedValue, ImageValue, InvalidValue])
+ z.union([
+ UnitValue,
+ KeywordValue,
+ UnparsedValue,
+ ImageValue,
+ TupleValue,
+ InvalidValue,
+ ])
),
});
export type LayersValue = z.infer<typeof LayersValue>;
-export const TupleValueItem = z.union([UnitValue, KeywordValue, UnparsedValue]);
-export type TupleValueItem = z.infer<typeof TupleValueItem>;
-
-export const TupleValue = z.object({
- type: z.literal("tuple"),
- value: z.array(TupleValueItem),
-});
-
-export type TupleValue = z.infer<typeof TupleValue>;
-
/**
* All StyleValue types that going to need wrapping into a CSS variable when rendered
* on canvas inside builder.
diff --git a/packages/design-system/src/components/floating-panel-popover.tsx b/packages/design-system/src/components/floating-panel-popover.tsx
index dd13e7c27a..4378c4f140 100644
--- a/packages/design-system/src/components/floating-panel-popover.tsx
+++ b/packages/design-system/src/components/floating-panel-popover.tsx
@@ -10,6 +10,7 @@ const contentStyles = css(floatingPanelStyles, {
minWidth: theme.spacing[28],
maxWidth: "max-content",
maxHeight: "80vh",
+ overflowY: "auto",
});
export const FloatingPanelPopoverContent = React.forwardRef(
diff --git a/packages/design-system/src/components/position-grid.tsx b/packages/design-system/src/components/position-grid.tsx
index e86c93f9ce..c2e036faca 100644
--- a/packages/design-system/src/components/position-grid.tsx
+++ b/packages/design-system/src/components/position-grid.tsx
@@ -37,6 +37,7 @@ const containerStyle = css({
width: "fit-content",
borderRadius: theme.borderRadius[4],
outline: `1px solid ${theme.colors.borderMain}`,
+ outlineOffset: "-1px",
gridTemplateColumns: "repeat(3, 1fr)",
gridTemplateAreas: `
"x x x"
diff --git a/packages/design-system/src/components/toggle-group.tsx b/packages/design-system/src/components/toggle-group.tsx
index 69555caef2..fbb439c17f 100644
--- a/packages/design-system/src/components/toggle-group.tsx
+++ b/packages/design-system/src/components/toggle-group.tsx
@@ -21,21 +21,27 @@ export const ToggleGroupItem = styled(ToggleGroupPrimitive.Item, {
alignItems: "center",
justifyContent: "center",
marginLeft: 1,
- borderRadius: 2,
height: theme.spacing[11],
+ outline: "none",
"&": {
px: theme.spacing[3],
},
"&:first-child": {
marginLeft: 0,
- borderTopLeftRadius: 4,
- borderBottomLeftRadius: 4,
+ borderTopLeftRadius: theme.spacing[3],
+ borderBottomLeftRadius: theme.spacing[3],
+ },
+ "&:last-child": {
+ borderTopRightRadius: theme.spacing[3],
+ borderBottomRightRadius: theme.spacing[3],
},
- "&:last-child": { borderTopRightRadius: 4, borderBottomRightRadius: 4 },
"&:hover": { backgroundColor: theme.colors.slateA3 },
// @note because the outline is outside of the element others can end up covering it
- "&:focus": {
- boxShadow: `0 0 0 ${theme.spacing[2]} ${theme.colors.blue10}`,
+ "&:focus-visible": {
+ outline: `2px solid ${theme.colors.borderFocus}`,
+ outlineOffset: "-2px",
+ borderRadius: theme.spacing[3],
+
zIndex: 1,
},
"&[data-state=on]": { backgroundColor: theme.colors.slate5 },
diff --git a/packages/icons/icons/information.svg b/packages/icons/icons/information.svg
new file mode 100644
index 0000000000..2de67bff67
--- /dev/null
+++ b/packages/icons/icons/information.svg
@@ -0,0 +1,5 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M8.0001 2.64985C5.04537 2.64985 2.6501 5.04513 2.6501 7.99985C2.6501 10.9546 5.04537 13.3499 8.0001 13.3499C10.9548 13.3499 13.3501 10.9546 13.3501 7.99985C13.3501 5.04513 10.9548 2.64985 8.0001 2.64985ZM1.3501 7.99985C1.3501 4.32716 4.3274 1.34985 8.0001 1.34985C11.6728 1.34985 14.6501 4.32716 14.6501 7.99985C14.6501 11.6725 11.6728 14.6499 8.0001 14.6499C4.3274 14.6499 1.3501 11.6725 1.3501 7.99985Z" fill="#707375"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.20011 11.0866C7.20011 10.6448 7.55828 10.2866 8.00011 10.2866H8.00868C8.45051 10.2866 8.80868 10.6448 8.80868 11.0866C8.80868 11.5284 8.45051 11.8866 8.00868 11.8866H8.00011C7.55828 11.8866 7.20011 11.5284 7.20011 11.0866Z" fill="#707375"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00011 4.26321C8.35909 4.26321 8.65011 4.55423 8.65011 4.91321V8.34301C8.65011 8.70199 8.35909 8.99301 8.00011 8.99301C7.64112 8.99301 7.35011 8.70199 7.35011 8.34301V4.91321C7.35011 4.55423 7.64112 4.26321 8.00011 4.26321Z" fill="#707375"/>
+</svg>
diff --git a/packages/icons/icons/repeat-column.svg b/packages/icons/icons/repeat-column.svg
new file mode 100644
index 0000000000..d71782be55
--- /dev/null
+++ b/packages/icons/icons/repeat-column.svg
@@ -0,0 +1,5 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M6.33496 2.00301C6.33496 1.63298 6.63493 1.33301 7.00496 1.33301H8.99496C9.36499 1.33301 9.66496 1.63298 9.66496 2.00301V3.99301C9.66496 4.36304 9.36499 4.66301 8.99496 4.66301H7.00496C6.63493 4.66301 6.33496 4.36304 6.33496 3.99301V2.00301Z" fill="#11181C"/>
+<path d="M6.33496 7.00496C6.33496 6.63493 6.63493 6.33496 7.00496 6.33496H8.99496C9.36499 6.33496 9.66496 6.63493 9.66496 7.00496V8.99496C9.66496 9.36499 9.36499 9.66496 8.99496 9.66496H7.00496C6.63493 9.66496 6.33496 9.36499 6.33496 8.99496V7.00496Z" fill="#11181C"/>
+<path d="M7.00496 11.3369C6.63493 11.3369 6.33496 11.6369 6.33496 12.0069V13.9969C6.33496 14.3669 6.63493 14.6669 7.00496 14.6669H8.99496C9.36499 14.6669 9.66496 14.3669 9.66496 13.9969V12.0069C9.66496 11.6369 9.36499 11.3369 8.99496 11.3369H7.00496Z" fill="#11181C"/>
+</svg>
diff --git a/packages/icons/icons/repeat-grid.svg b/packages/icons/icons/repeat-grid.svg
new file mode 100644
index 0000000000..970424b46c
--- /dev/null
+++ b/packages/icons/icons/repeat-grid.svg
@@ -0,0 +1,11 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M1.3335 2.00301C1.3335 1.63298 1.63347 1.33301 2.0035 1.33301H3.9935C4.36353 1.33301 4.6635 1.63298 4.6635 2.00301V3.99301C4.6635 4.36304 4.36353 4.66301 3.9935 4.66301H2.0035C1.63347 4.66301 1.3335 4.36304 1.3335 3.99301V2.00301Z" fill="#11181C"/>
+<path d="M1.3335 7.00496C1.3335 6.63493 1.63347 6.33496 2.0035 6.33496H3.9935C4.36353 6.33496 4.6635 6.63493 4.6635 7.00496V8.99496C4.6635 9.36499 4.36353 9.66496 3.9935 9.66496H2.0035C1.63347 9.66496 1.3335 9.36499 1.3335 8.99496V7.00496Z" fill="#11181C"/>
+<path d="M4.6635 12.0067C4.6635 11.6366 4.36353 11.3367 3.9935 11.3367H2.0035C1.63347 11.3367 1.3335 11.6366 1.3335 12.0067V13.9967C1.3335 14.3667 1.63347 14.6667 2.0035 14.6667H3.9935C4.36353 14.6667 4.6635 14.3667 4.6635 13.9967V12.0067Z" fill="#11181C"/>
+<path d="M6.33514 2.00301C6.33514 1.63298 6.63511 1.33301 7.00514 1.33301H8.99514C9.36517 1.33301 9.66514 1.63298 9.66514 2.00301V3.99301C9.66514 4.36304 9.36518 4.66301 8.99514 4.66301H7.00514C6.63511 4.66301 6.33514 4.36304 6.33514 3.99301V2.00301Z" fill="#11181C"/>
+<path d="M9.66514 7.00496C9.66514 6.63493 9.36518 6.33496 8.99514 6.33496H7.00514C6.63511 6.33496 6.33514 6.63493 6.33514 7.00496V8.99496C6.33514 9.36499 6.63511 9.66496 7.00514 9.66496H8.99514C9.36517 9.66496 9.66514 9.36499 9.66514 8.99496V7.00496Z" fill="#11181C"/>
+<path d="M6.33514 12.0067C6.33514 11.6366 6.63511 11.3367 7.00514 11.3367H8.99514C9.36517 11.3367 9.66514 11.6366 9.66514 12.0067V13.9967C9.66514 14.3667 9.36518 14.6667 8.99514 14.6667H7.00514C6.63511 14.6667 6.33514 14.3667 6.33514 13.9967V12.0067Z" fill="#11181C"/>
+<path d="M14.6668 2.00301C14.6668 1.63298 14.3668 1.33301 13.9968 1.33301H12.0068C11.6368 1.33301 11.3368 1.63298 11.3368 2.00301V3.99301C11.3368 4.36304 11.6368 4.66301 12.0068 4.66301H13.9968C14.3668 4.66301 14.6668 4.36304 14.6668 3.99301V2.00301Z" fill="#11181C"/>
+<path d="M11.3368 7.00496C11.3368 6.63493 11.6368 6.33496 12.0068 6.33496H13.9968C14.3668 6.33496 14.6668 6.63493 14.6668 7.00496V8.99496C14.6668 9.36499 14.3668 9.66496 13.9968 9.66496H12.0068C11.6368 9.66496 11.3368 9.36499 11.3368 8.99496V7.00496Z" fill="#11181C"/>
+<path d="M14.6668 12.0067C14.6668 11.6366 14.3668 11.3367 13.9968 11.3367H12.0068C11.6368 11.3367 11.3368 11.6366 11.3368 12.0067V13.9967C11.3368 14.3667 11.6368 14.6667 12.0068 14.6667H13.9968C14.3668 14.6667 14.6668 14.3667 14.6668 13.9967V12.0067Z" fill="#11181C"/>
+</svg>
diff --git a/packages/icons/icons/repeat-row.svg b/packages/icons/icons/repeat-row.svg
new file mode 100644
index 0000000000..c0f7236613
--- /dev/null
+++ b/packages/icons/icons/repeat-row.svg
@@ -0,0 +1,5 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M1.3335 7.00496C1.3335 6.63493 1.63347 6.33496 2.0035 6.33496H3.9935C4.36353 6.33496 4.6635 6.63493 4.6635 7.00496V8.99496C4.6635 9.36499 4.36353 9.66496 3.9935 9.66496H2.0035C1.63347 9.66496 1.3335 9.36499 1.3335 8.99496V7.00496Z" fill="#11181C"/>
+<path d="M6.33514 7.00496C6.33514 6.63493 6.63511 6.33496 7.00514 6.33496H8.99514C9.36518 6.33496 9.66514 6.63493 9.66514 7.00496V8.99496C9.66514 9.36499 9.36517 9.66496 8.99514 9.66496H7.00514C6.63511 9.66496 6.33514 9.36499 6.33514 8.99496V7.00496Z" fill="#11181C"/>
+<path d="M12.0068 6.33496C11.6368 6.33496 11.3368 6.63493 11.3368 7.00496V8.99496C11.3368 9.36499 11.6368 9.66496 12.0068 9.66496H13.9968C14.3668 9.66496 14.6668 9.36499 14.6668 8.99496V7.00496C14.6668 6.63493 14.3668 6.33496 13.9968 6.33496H12.0068Z" fill="#11181C"/>
+</svg>
diff --git a/packages/icons/src/__generated__/index.ts b/packages/icons/src/__generated__/index.ts
index 1f9e914654..214f4bd5db 100644
--- a/packages/icons/src/__generated__/index.ts
+++ b/packages/icons/src/__generated__/index.ts
@@ -24,6 +24,7 @@ export * from "./github";
export * from "./google";
export * from "./hamburger-menu";
export * from "./info";
+export * from "./information";
export * from "./linked";
export * from "./list-item";
export * from "./list";
@@ -31,6 +32,9 @@ export * from "./offline";
export * from "./play";
export * from "./radio-checked";
export * from "./radio-unchecked";
+export * from "./repeat-column";
+export * from "./repeat-grid";
+export * from "./repeat-row";
export * from "./scroll";
export * from "./subscript";
export * from "./subtract";
diff --git a/packages/icons/src/__generated__/information.tsx b/packages/icons/src/__generated__/information.tsx
new file mode 100644
index 0000000000..c35bceec4a
--- /dev/null
+++ b/packages/icons/src/__generated__/information.tsx
@@ -0,0 +1,15 @@
+// Generated from icons/information.svg
+
+import { forwardRef } from "react";
+import type { IconProps } from "../types";
+
+// prettier-ignore
+export const InformationIcon = forwardRef<SVGSVGElement, IconProps>(
+ ({ color = "currentColor", size = 16, ...props }, forwardedRef) => {
+ return (
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path fill="#707375" fillRule="evenodd" d="M8 2.65a5.35 5.35 0 1 0 0 10.7 5.35 5.35 0 0 0 0-10.7ZM1.35 8a6.65 6.65 0 1 1 13.3 0 6.65 6.65 0 0 1-13.3 0Z" clipRule="evenodd" /><path fill="#707375" fillRule="evenodd" d="M7.2 11.087a.8.8 0 0 1 .8-.8h.009a.8.8 0 0 1 0 1.6H8a.8.8 0 0 1-.8-.8ZM8 4.263a.65.65 0 0 1 .65.65v3.43a.65.65 0 0 1-1.3 0v-3.43a.65.65 0 0 1 .65-.65Z" clipRule="evenodd" /></svg>
+ );
+ }
+);
+
+InformationIcon.displayName = "InformationIcon";
diff --git a/packages/icons/src/__generated__/repeat-column.tsx b/packages/icons/src/__generated__/repeat-column.tsx
new file mode 100644
index 0000000000..50cb86bd85
--- /dev/null
+++ b/packages/icons/src/__generated__/repeat-column.tsx
@@ -0,0 +1,15 @@
+// Generated from icons/repeat-column.svg
+
+import { forwardRef } from "react";
+import type { IconProps } from "../types";
+
+// prettier-ignore
+export const RepeatColumnIcon = forwardRef<SVGSVGElement, IconProps>(
+ ({ color = "currentColor", size = 16, ...props }, forwardedRef) => {
+ return (
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path fill="#11181C" d="M6.335 2.003c0-.37.3-.67.67-.67h1.99c.37 0 .67.3.67.67v1.99c0 .37-.3.67-.67.67h-1.99a.67.67 0 0 1-.67-.67v-1.99ZM6.335 7.005c0-.37.3-.67.67-.67h1.99c.37 0 .67.3.67.67v1.99c0 .37-.3.67-.67.67h-1.99a.67.67 0 0 1-.67-.67v-1.99ZM7.005 11.337c-.37 0-.67.3-.67.67v1.99c0 .37.3.67.67.67h1.99c.37 0 .67-.3.67-.67v-1.99c0-.37-.3-.67-.67-.67h-1.99Z" /></svg>
+ );
+ }
+);
+
+RepeatColumnIcon.displayName = "RepeatColumnIcon";
diff --git a/packages/icons/src/__generated__/repeat-grid.tsx b/packages/icons/src/__generated__/repeat-grid.tsx
new file mode 100644
index 0000000000..a0a94dc6e5
--- /dev/null
+++ b/packages/icons/src/__generated__/repeat-grid.tsx
@@ -0,0 +1,15 @@
+// Generated from icons/repeat-grid.svg
+
+import { forwardRef } from "react";
+import type { IconProps } from "../types";
+
+// prettier-ignore
+export const RepeatGridIcon = forwardRef<SVGSVGElement, IconProps>(
+ ({ color = "currentColor", size = 16, ...props }, forwardedRef) => {
+ return (
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path fill="#11181C" d="M1.333 2.003c0-.37.3-.67.67-.67h1.99c.37 0 .67.3.67.67v1.99c0 .37-.3.67-.67.67h-1.99a.67.67 0 0 1-.67-.67v-1.99ZM1.333 7.005c0-.37.3-.67.67-.67h1.99c.37 0 .67.3.67.67v1.99c0 .37-.3.67-.67.67h-1.99a.67.67 0 0 1-.67-.67v-1.99ZM4.663 12.007c0-.37-.3-.67-.67-.67h-1.99c-.37 0-.67.3-.67.67v1.99c0 .37.3.67.67.67h1.99c.37 0 .67-.3.67-.67v-1.99ZM6.335 2.003c0-.37.3-.67.67-.67h1.99c.37 0 .67.3.67.67v1.99c0 .37-.3.67-.67.67h-1.99a.67.67 0 0 1-.67-.67v-1.99ZM9.665 7.005c0-.37-.3-.67-.67-.67h-1.99c-.37 0-.67.3-.67.67v1.99c0 .37.3.67.67.67h1.99c.37 0 .67-.3.67-.67v-1.99ZM6.335 12.007c0-.37.3-.67.67-.67h1.99c.37 0 .67.3.67.67v1.99c0 .37-.3.67-.67.67h-1.99a.67.67 0 0 1-.67-.67v-1.99ZM14.667 2.003c0-.37-.3-.67-.67-.67h-1.99c-.37 0-.67.3-.67.67v1.99c0 .37.3.67.67.67h1.99c.37 0 .67-.3.67-.67v-1.99ZM11.337 7.005c0-.37.3-.67.67-.67h1.99c.37 0 .67.3.67.67v1.99c0 .37-.3.67-.67.67h-1.99a.67.67 0 0 1-.67-.67v-1.99ZM14.667 12.007c0-.37-.3-.67-.67-.67h-1.99c-.37 0-.67.3-.67.67v1.99c0 .37.3.67.67.67h1.99c.37 0 .67-.3.67-.67v-1.99Z" /></svg>
+ );
+ }
+);
+
+RepeatGridIcon.displayName = "RepeatGridIcon";
diff --git a/packages/icons/src/__generated__/repeat-row.tsx b/packages/icons/src/__generated__/repeat-row.tsx
new file mode 100644
index 0000000000..5dad25a6c2
--- /dev/null
+++ b/packages/icons/src/__generated__/repeat-row.tsx
@@ -0,0 +1,15 @@
+// Generated from icons/repeat-row.svg
+
+import { forwardRef } from "react";
+import type { IconProps } from "../types";
+
+// prettier-ignore
+export const RepeatRowIcon = forwardRef<SVGSVGElement, IconProps>(
+ ({ color = "currentColor", size = 16, ...props }, forwardedRef) => {
+ return (
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width={size} height={size} fill={color} {...props} ref={forwardedRef}><path fill="#11181C" d="M1.333 7.005c0-.37.3-.67.67-.67h1.99c.37 0 .67.3.67.67v1.99c0 .37-.3.67-.67.67h-1.99a.67.67 0 0 1-.67-.67v-1.99ZM6.335 7.005c0-.37.3-.67.67-.67h1.99c.37 0 .67.3.67.67v1.99c0 .37-.3.67-.67.67h-1.99a.67.67 0 0 1-.67-.67v-1.99ZM12.007 6.335c-.37 0-.67.3-.67.67v1.99c0 .37.3.67.67.67h1.99c.37 0 .67-.3.67-.67v-1.99c0-.37-.3-.67-.67-.67h-1.99Z" /></svg>
+ );
+ }
+);
+
+RepeatRowIcon.displayName = "RepeatRowIcon";
diff --git a/packages/project-build/src/schema/styles.ts b/packages/project-build/src/schema/styles.ts
index be1921d40b..27cb7159d8 100644
--- a/packages/project-build/src/schema/styles.ts
+++ b/packages/project-build/src/schema/styles.ts
@@ -8,6 +8,7 @@ import {
KeywordValue,
UnparsedValue,
InvalidValue,
+ TupleValue,
} from "@webstudio-is/css-data";
const StoredImageValue = z.object({
@@ -23,6 +24,7 @@ const StoredLayersValue = z.object({
KeywordValue,
UnparsedValue,
StoredImageValue,
+ TupleValue,
InvalidValue,
])
),
diff --git a/packages/react-sdk/src/css/categories.ts b/packages/react-sdk/src/css/categories.ts
index 344658dd53..65446a517d 100644
--- a/packages/react-sdk/src/css/categories.ts
+++ b/packages/react-sdk/src/css/categories.ts
@@ -120,8 +120,7 @@ const backgrounds = [
"backgroundColor",
"backgroundImage",
"backgroundOrigin",
- "backgroundPositionX",
- "backgroundPositionY",
+ "backgroundPosition",
"backgroundRepeat",
"backgroundSize",
"backgroundBlendMode",