Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
seanchas116 committed Apr 27, 2023
1 parent f77d3d5 commit 5aa4d33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 35 deletions.
4 changes: 2 additions & 2 deletions packages/model/src/file/ProjectEmitter.ts
Expand Up @@ -267,7 +267,7 @@ export class PageEmitter {
return path;
}

transformColor(color: Data.Color): File.Color {
transformColor(color: Data.Color): Data.Color {
if (typeof color === "object") {
const token = this.project.colorTokens.get(color.token);
if (token?.type === "normal") {
Expand All @@ -282,7 +282,7 @@ export class PageEmitter {
return color;
}

transformFill(fill: Data.SolidFill): File.Fill {
transformFill(fill: Data.Fill): Data.Fill {
return {
solid: this.transformColor(fill.solid),
};
Expand Down
4 changes: 2 additions & 2 deletions packages/model/src/file/ProjectLoader.ts
Expand Up @@ -229,7 +229,7 @@ class PageLoader {
return relativePath;
}

transformColor(color: File.Color): Data.Color {
transformColor(color: Data.Color): Data.Color {
if (typeof color === "object") {
const tokenPath = color.token;
const tokenId = this.colorTokenFromRelativePath(tokenPath)?.id;
Expand All @@ -248,7 +248,7 @@ class PageLoader {
return color;
}

transformFill(fill: File.Fill): Data.SolidFill {
transformFill(fill: Data.Fill): Data.Fill {
return {
solid: this.transformColor(fill.solid),
};
Expand Down
34 changes: 3 additions & 31 deletions packages/model/src/file/types.ts
@@ -1,5 +1,8 @@
import {
Fill,
Position,
Shadow,
Size,
StackAlign,
StackDirection,
StackJustify,
Expand All @@ -10,37 +13,6 @@ import {
import { z } from "zod";
import Babel from "@babel/standalone";

export const Position = z.object({
left: z.number().optional(),
top: z.number().optional(),
right: z.number().optional(),
bottom: z.number().optional(),
});
export type Position = z.infer<typeof Position>;

export const Size = z.union([
z.literal("hug"),
z.number(),
z.object({
min: z.number(),
max: z.number().optional(),
}),
]);
export type Size = z.infer<typeof Size>;

export const Color = z.union([
z.string(), // hex
z.object({
token: z.string(),
}),
]);
export type Color = z.infer<typeof Color>;

export const Fill = z.object({
solid: Color,
});
export type Fill = z.infer<typeof Fill>;

export const BaseStyleProps = z.object({
hidden: z.boolean(),
locked: z.boolean(),
Expand Down

0 comments on commit 5aa4d33

Please sign in to comment.