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
Merge branch 'main' into remove_schema
Roman Pominov9549de9ef6f0
diff --cc packages/react-sdk/src/css/schema.tsindex f3e8072cf8,865e5c021f..aabba3dc9a--- a/packages/react-sdk/src/css/schema.ts+++ b/packages/react-sdk/src/css/schema.ts@@@ -1,18 -1,15 +1,18 @@@import { z } from "zod";import { units } from "./units";+import { StyleProperty } from "./types";-export const UnitSchema = z.union([z.enum(units), z.literal("number")]);+export const Unit = z.union([z.enum(units), z.literal("number")]);-export const UnitValueSchema = z.object({+export type Unit = z.infer<typeof Unit>;+- const UnitValue = z.object({++export const UnitValue = z.object({type: z.literal("unit"),- unit: UnitSchema,+ unit: Unit,value: z.number(),});- const KeywordValue = z.object({-export const KeywordValueSchema = z.object({++export const KeywordValue = z.object({type: z.literal("keyword"),// @todo use exact typevalue: z.string(),@@@ -20,23 -17,27 +20,30 @@@// We want to be able to render the invalid value// and show it is invalid visually, without saving it to the db- const InvalidValue = z.object({-export const InvalidValueSchema = z.object({++export const InvalidValue = z.object({type: z.literal("invalid"),value: z.string(),});- export const StyleValue = z.union([UnitValue, KeywordValue, InvalidValue]);-export const UnsetValueSchema = z.object({++export const UnsetValue = z.object({+ type: z.literal("unset"),+ value: z.literal(""),+ });+-export const StyleValueSchema = z.union([- UnitValueSchema,- KeywordValueSchema,- InvalidValueSchema,- UnsetValueSchema,-]);++export type UnsetValue = z.infer<typeof UnsetValue>;++++export const StyleValue = z.union([UnitValue, KeywordValue, InvalidValue, UnsetValue]);++export type StyleValue = z.infer<typeof StyleValue>;-export const StyleSchema = z.record(z.string(), StyleValueSchema);+export const Style = z.record(z.string(), StyleValue);-export const CssRuleSchema = z.object({- style: StyleSchema,+export type Style = {+ [property in StyleProperty]?: StyleValue;+};++export const CssRule = z.object({+ style: Style,breakpoint: z.string(),});diff --cc packages/react-sdk/src/css/types.tsindex 7cf39d75e1,d7850f134d..728a3e424f--- a/packages/react-sdk/src/css/types.ts+++ b/packages/react-sdk/src/css/types.ts@@@ -5,3 -16,19 +5,4 @@@ type Properties = typeof propertiesexport type StyleProperty = keyof Properties;export type AppliesTo = Properties[StyleProperty]["appliesTo"];+-export type Style = {- [property in StyleProperty]?: StyleValue;-};--export type CssRule = z.infer<typeof CssRuleSchema>;--export type Unit = z.infer<typeof UnitSchema>;--export type StyleValue = z.infer<typeof StyleValueSchema>;-export type UnitValue = z.infer<typeof UnitValueSchema>;-export type KeywordValue = z.infer<typeof KeywordValueSchema>;-export type InvalidValue = z.infer<typeof InvalidValueSchema>;-export type UnsetValue = z.infer<typeof UnsetValueSchema>;--export type Breakpoint = z.infer<typeof BreakpointSchema>;