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.

forgotten files after they were moved

Oleg Isonenc33368a113df
diff --git a/apps/designer/app/designer/shared/design-tokens-manager/groups.ts b/apps/designer/app/designer/shared/design-tokens-manager/groups.ts
deleted file mode 100644
index df9de4c06c..0000000000
--- a/apps/designer/app/designer/shared/design-tokens-manager/groups.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copied from https://docs.tokens.studio/available-tokens/available-tokens
-
-export const groups = [
- { type: "sizing", group: "Sizing" },
- { type: "spacing", group: "Spacing" },
- { type: "color", group: "Color" },
- { type: "borderRadius", group: "Border Radius" },
- { type: "borderWidth", group: "Border Width" },
- { type: "boxShadow", group: "Box Shadow" },
- { type: "opacity", group: "Opacity" },
- { type: "fontFamilies", group: "Font Families" },
- { type: "fontSizes", group: "Font Size" },
- { type: "fontWeights", group: "Font Weight" },
- { type: "lineHeight", group: "Line Height" },
- { type: "letterSpacing", group: "Letter Spacing" },
- { type: "paragraphSpacing", group: "Paragraph Spacing" },
- { type: "textCase", group: "Text Case" },
- { type: "textDecoration", group: "Text Decoration" },
-] as const;
diff --git a/apps/designer/app/designer/shared/design-tokens-manager/schema.ts b/apps/designer/app/designer/shared/design-tokens-manager/schema.ts
deleted file mode 100644
index 1f00492870..0000000000
--- a/apps/designer/app/designer/shared/design-tokens-manager/schema.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { z } from "zod";
-import { groups } from "./groups";
-
-type Type = typeof groups[number]["type"];
-type Group = typeof groups[number]["group"];
-
-const types = groups.map((group) => group.type) as unknown as readonly [Type];
-const groupNames = groups.map((group) => group.group) as unknown as readonly [
- Group
-];
-
-export const DesignToken = z.object({
- name: z.string(),
- type: z.enum(types),
- value: z.string(),
- description: z.optional(z.string()),
- group: z.enum(groupNames),
-});
-
-export type DesignToken = z.infer<typeof DesignToken>;
diff --git a/packages/design-tokens/src/schema.ts b/packages/design-tokens/src/schema.ts
index 46f2d9f0eb..9becc22972 100644
--- a/packages/design-tokens/src/schema.ts
+++ b/packages/design-tokens/src/schema.ts
@@ -1,39 +1,21 @@
import { z } from "zod";
import { designTokensGroups } from "./groups";
-// @todo this doesn't belong here https://github.com/webstudio-is/webstudio-designer/issues/544
-type UnionToIntersection<U> = (
- U extends never ? never : (arg: U) => never
-) extends (arg: infer I) => void
- ? I
- : never;
-
-type UnionToTuple<T> = UnionToIntersection<
- T extends never ? never : (t: T) => T
-> extends (_: never) => infer W
- ? [...UnionToTuple<Exclude<T, W>>, W]
- : [];
-
type Type = typeof designTokensGroups[number]["type"];
type Group = typeof designTokensGroups[number]["group"];
-// zod is super restrictive on enum type https://github.com/colinhacks/zod/issues/1118
-// so we convert union to tuple here its seriously safer than any as it will break on things like
-// ['a', 'b'] as UnionToTuple<Type> etc
const types = designTokensGroups.map(
(group) => group.type
-) as UnionToTuple<Type>;
+) as unknown as readonly [Type];
const groupNames = designTokensGroups.map(
(group) => group.group
-) as UnionToTuple<Group>;
+) as unknown as readonly [Group];
export const DesignToken = z.object({
name: z.string(),
- // @todo if https://github.com/colinhacks/zod/issues/1118
type: z.enum(types),
value: z.string(),
description: z.optional(z.string()),
- // @todo if https://github.com/colinhacks/zod/issues/1118
group: z.enum(groupNames),
});