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
Add style sources schema (#850)
Bogdan Chadkin0f9043fc5446
diff --git a/packages/prisma-client/prisma/migrations/20230127120101_style_sources/migration.sql b/packages/prisma-client/prisma/migrations/20230127120101_style_sources/migration.sqlnew file mode 100644index 0000000000..5ccac368bb--- /dev/null+++ b/packages/prisma-client/prisma/migrations/20230127120101_style_sources/migration.sql@@ -0,0 +1,8 @@+-- AlterTable+ALTER TABLE "Build"+ ADD COLUMN "styleSources" TEXT NOT NULL DEFAULT '[]',+ ADD COLUMN "styles" TEXT NOT NULL DEFAULT '[]';++-- AlterTable+ALTER TABLE "Tree"+ ADD COLUMN "styleSelections" TEXT NOT NULL DEFAULT '[]';diff --git a/packages/prisma-client/prisma/schema.prisma b/packages/prisma-client/prisma/schema.prismaindex b46d5f2e7b..dcc3eac83b 100644--- a/packages/prisma-client/prisma/schema.prisma+++ b/packages/prisma-client/prisma/schema.prisma@@ -75,15 +75,19 @@ model Build {breakpoints Breakpoints?designTokens DesignTokens?++ styles String @default("[]")+ styleSources String @default("[]")}model Tree {- id String @id @default(uuid())- root String- instances String @default("[]")- props String @default("[]")- presetStyles String @default("[]")- styles String @default("[]")+ id String @id @default(uuid())+ root String+ instances String @default("[]")+ props String @default("[]")+ presetStyles String @default("[]")+ styles String @default("[]")+ styleSelections String @default("[]")}model InstanceProps {diff --git a/packages/project-build/src/index.ts b/packages/project-build/src/index.tsindex f4872ca7df..7248fb538e 100644--- a/packages/project-build/src/index.ts+++ b/packages/project-build/src/index.ts@@ -1,4 +1,5 @@export * from "./schema/instances";export * from "./schema/props";export * from "./schema/styles";+export * from "./schema/style-sources";export * from "./types";diff --git a/packages/project-build/src/schema/style-sources.ts b/packages/project-build/src/schema/style-sources.tsnew file mode 100644index 0000000000..89af6d1d7a--- /dev/null+++ b/packages/project-build/src/schema/style-sources.ts@@ -0,0 +1,36 @@+import { z } from "zod";++const StyleSourceId = z.string();++const StyleSourceToken = z.object({+ type: z.literal("token"),+ id: StyleSourceId,+ treeId: z.string().optional(),+ name: z.string(),+});++const StyleSourceLocal = z.object({+ type: z.literal("local"),+ id: StyleSourceId,+ treeId: z.string(),+ name: z.string(),+});++export const StyleSource = z.union([StyleSourceToken, StyleSourceLocal]);++export type StyleSource = z.infer<typeof StyleSource>;++export const StyleSources = z.array(StyleSource);++export type StyleSources = z.infer<typeof StyleSources>;++export const StyleSourceSelection = z.object({+ instanceId: z.string(),+ values: z.array(StyleSourceId),+});++export type StyleSourceSelection = z.infer<typeof StyleSourceSelection>;++export const StyleSourceSelections = z.array(StyleSourceSelection);++export type StyleSourceSelections = z.infer<typeof StyleSourceSelections>;