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.

Merge branch 'main' into 252-fonts-manager-and-fonts-selector

Oleg Isonen12c58f764717
diff --cc packages/react-sdk/src/css/schema.ts
index 4b9bc605ff,b7ddbeca85..604ce6bf04
--- a/packages/react-sdk/src/css/schema.ts
+++ b/packages/react-sdk/src/css/schema.ts
@@@ -14,36 -19,40 +19,46 @@@ export const KeywordValue = z.object(
// @todo use exact type
value: z.string(),
});
-
+ export type KeywordValue = z.infer<typeof KeywordValue>;
- const FontFamilyValueSchema = z.object({
++export const FontFamilyValue = z.object({
+ type: z.literal("fontFamily"),
+ value: z.array(z.string()),
+});
++export type FontFamilyValue = z.infer<typeof FontFamilyValue>;
+
// We want to be able to render the invalid value
// and show it is invalid visually, without saving it to the db
- export const InvalidValueSchema = z.object({
+ export const InvalidValue = z.object({
type: z.literal("invalid"),
value: z.string(),
});
++export type InvalidValue = z.infer<typeof InvalidValue>;
- export const UnsetValueSchema = z.object({
+ export const UnsetValue = z.object({
type: z.literal("unset"),
value: z.literal(""),
});
-
+ export type UnsetValue = z.infer<typeof UnsetValue>;
- export const StyleValueSchema = z.union([
- UnitValueSchema,
- KeywordValueSchema,
- InvalidValueSchema,
- FontFamilyValueSchema,
- UnsetValueSchema,
+ export const StyleValue = z.union([
+ UnitValue,
+ KeywordValue,
+ InvalidValue,
+ UnsetValue,
++ FontFamilyValue,
]);
- export const StyleSchema = z.record(z.string(), StyleValueSchema);
+ export type StyleValue = z.infer<typeof StyleValue>;
+
+ 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.ts
index d7850f134d,728a3e424f..7cf39d75e1
--- a/packages/react-sdk/src/css/types.ts
+++ b/packages/react-sdk/src/css/types.ts
@@@ -16,19 -5,4 +5,3 @@@ type Properties = typeof properties
export 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>;