@supernova-studio/model 0.55.6 → 0.55.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernova-studio/model",
3
- "version": "0.55.6",
3
+ "version": "0.55.8",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,10 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import { tokenAliasOrValue } from "./base";
3
+ import { DimensionUnit } from "./dimension";
3
4
 
4
5
  export const BorderRadiusUnit = z.enum(["Pixels", "Rem", "Percent"]);
5
6
 
6
7
  export const BorderRadiusValue = z.object({
7
- unit: BorderRadiusUnit,
8
+ unit: DimensionUnit,
8
9
  measure: z.number(),
9
10
  });
10
11
 
@@ -1,10 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import { tokenAliasOrValue } from "./base";
3
+ import { DimensionUnit } from "./dimension";
3
4
 
4
5
  export const BorderWidthUnit = z.enum(["Pixels"]);
5
6
 
6
7
  export const BorderWidthValue = z.object({
7
- unit: BorderWidthUnit,
8
+ unit: DimensionUnit,
8
9
  measure: z.number(),
9
10
  });
10
11
 
@@ -47,6 +47,8 @@ export const PageBlockTypeV1 = z.enum([
47
47
  "TableCell",
48
48
  "Guidelines",
49
49
  "Guideline",
50
+ "FigmaComponents",
51
+ "FigmaComponentPropsTable",
50
52
  ]);
51
53
 
52
54
  export const PageBlockCodeLanguage = z.enum([
@@ -168,17 +170,6 @@ export const PageBlockCustomBlockPropertyImageValue = z.object({
168
170
  export const PageBlockCustomBlockPropertyValue = z.object({
169
171
  key: z.string(),
170
172
  value: z.any(),
171
-
172
- // TODO Artem: for some reason there are cases when there's an array here in the DB
173
- // e.g. element id 67451 in the dev db
174
-
175
- // value: z
176
- // .boolean()
177
- // .or(z.number())
178
- // .or(z.string())
179
- // .or(ColorTokenData)
180
- // .or(TypographyTokenData)
181
- // .or(PageBlockCustomBlockPropertyImageValue),
182
173
  });
183
174
 
184
175
  export const PageBlockFigmaFrameProperties = z.object({
@@ -218,6 +209,23 @@ export const PageBlockTableProperties = z.object({
218
209
  columns: z.array(PageBlockTableColumn),
219
210
  });
220
211
 
212
+ export const PageBlockFigmaComponentBlockConfig = z.object({
213
+ showComponentName: nullishToOptional(z.boolean()),
214
+ showComponentDescription: nullishToOptional(z.boolean()),
215
+ showPropertyList: nullishToOptional(z.boolean()),
216
+ previewContainerSize: nullishToOptional(z.enum(["Centered", "NaturalHeight"])),
217
+ backgroundColor: nullishToOptional(ColorTokenInlineData),
218
+ });
219
+
220
+ export const PageBlockSelectedFigmaComponent = z.object({
221
+ figmaComponentId: z.string(),
222
+ selectedComponentProperties: z.string().array(),
223
+ });
224
+
225
+ //
226
+ // Rich text
227
+ //
228
+
221
229
  export const PageBlockTextSpanAttributeType = z.enum(["Bold", "Italic", "Link", "Strikethrough", "Code", "Comment"]);
222
230
 
223
231
  export const PageBlockTextSpanAttribute = z.object({
@@ -275,6 +283,7 @@ export type PageBlockSwatch = z.infer<typeof PageBlockSwatch>;
275
283
  export type PageBlockShortcut = z.infer<typeof PageBlockShortcut>;
276
284
  export type PageBlockCustomBlockPropertyValue = z.infer<typeof PageBlockCustomBlockPropertyValue>;
277
285
  export type PageBlockCustomBlockPropertyImageValue = z.infer<typeof PageBlockCustomBlockPropertyImageValue>;
286
+ export type PageBlockFigmaComponentBlockConfig = z.infer<typeof PageBlockFigmaComponentBlockConfig>;
278
287
 
279
288
  //
280
289
  // Block
@@ -342,6 +351,11 @@ export const PageBlockBaseV1 = z.object({
342
351
  swatches: nullishToOptional(PageBlockSwatch.array()),
343
352
  blacklistedElementProperties: nullishToOptional(z.array(z.string())),
344
353
 
354
+ // Figma components
355
+ figmaComponentsBlockConfig: nullishToOptional(PageBlockFigmaComponentBlockConfig),
356
+ selectedFigmaComponent: nullishToOptional(PageBlockSelectedFigmaComponent),
357
+ selectedFigmaComponents: nullishToOptional(PageBlockSelectedFigmaComponent.array()),
358
+
345
359
  // Arbitrary
346
360
  userMetadata: nullishToOptional(z.string()),
347
361
  });
@@ -148,7 +148,7 @@ export const PageBlockItemFigmaComponentValue = z.object({
148
148
  z.object({
149
149
  entityId: z.string(),
150
150
  entityType: z.enum(["FigmaComponent"]),
151
- entityMeta: PageBlockFigmaComponentEntityMeta.optional(),
151
+ selectedComponentProperties: z.string().array().optional(),
152
152
  })
153
153
  )
154
154
  .default([]),
@@ -1,10 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import { tokenAliasOrValue } from "./base";
3
+ import { DimensionUnit } from "./dimension";
3
4
 
4
5
  export const DurationUnit = z.enum(["Ms"]);
5
6
 
6
7
  export const DurationValue = z.object({
7
- unit: DurationUnit,
8
+ unit: DimensionUnit,
8
9
  measure: z.number(),
9
10
  });
10
11
 
@@ -1,10 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import { tokenAliasOrValue } from "./base";
3
+ import { DimensionUnit } from "./dimension";
3
4
 
4
5
  export const FontSizeUnit = z.enum(["Pixels", "Rem", "Percent"]);
5
6
 
6
7
  export const FontSizeValue = z.object({
7
- unit: FontSizeUnit,
8
+ unit: DimensionUnit,
8
9
  measure: z.number(),
9
10
  });
10
11
 
@@ -1,10 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import { tokenAliasOrValue } from "./base";
3
+ import { DimensionUnit } from "./dimension";
3
4
 
4
5
  export const LetterSpacingUnit = z.enum(["Pixels", "Rem", "Percent"]);
5
6
 
6
7
  export const LetterSpacingValue = z.object({
7
- unit: LetterSpacingUnit,
8
+ unit: DimensionUnit,
8
9
  measure: z.number(),
9
10
  });
10
11
 
@@ -1,10 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import { tokenAliasOrValue } from "./base";
3
+ import { DimensionUnit } from "./dimension";
3
4
 
4
5
  export const LineHeightUnit = z.enum(["Pixels", "Rem", "Percent", "Raw"]);
5
6
 
6
7
  export const LineHeightValue = z.object({
7
- unit: LineHeightUnit,
8
+ unit: DimensionUnit,
8
9
  measure: z.number(),
9
10
  });
10
11
 
@@ -1,8 +1,9 @@
1
1
  import { z } from "zod";
2
2
  import { tokenAliasOrValue } from "./base";
3
+ import { DimensionUnit } from "./dimension";
3
4
 
4
5
  export const OpacityValue = z.object({
5
- unit: z.enum(["Raw", "Pixels"]),
6
+ unit: DimensionUnit,
6
7
  measure: z.number(),
7
8
  });
8
9
 
@@ -1,10 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import { tokenAliasOrValue } from "./base";
3
+ import { DimensionUnit } from "./dimension";
3
4
 
4
5
  export const ParagraphIndentUnit = z.enum(["Pixels", "Rem", "Percent"]);
5
6
 
6
7
  export const ParagraphIndentValue = z.object({
7
- unit: ParagraphIndentUnit,
8
+ unit: DimensionUnit,
8
9
  measure: z.number(),
9
10
  });
10
11
 
@@ -1,10 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import { tokenAliasOrValue } from "./base";
3
+ import { DimensionUnit } from "./dimension";
3
4
 
4
5
  export const ParagraphSpacingUnit = z.enum(["Pixels", "Rem", "Percent"]);
5
6
 
6
7
  export const ParagraphSpacingValue = z.object({
7
- unit: ParagraphSpacingUnit,
8
+ unit: DimensionUnit,
8
9
  measure: z.number(),
9
10
  });
10
11
 
@@ -1,10 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import { tokenAliasOrValue } from "./base";
3
+ import { DimensionUnit } from "./dimension";
3
4
 
4
5
  export const SizeUnit = z.enum(["Pixels", "Rem", "Percent"]);
5
6
 
6
7
  export const SizeValue = z.object({
7
- unit: SizeUnit,
8
+ unit: DimensionUnit,
8
9
  measure: z.number(),
9
10
  });
10
11
 
@@ -1,10 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import { tokenAliasOrValue } from "./base";
3
+ import { DimensionUnit } from "./dimension";
3
4
 
4
5
  export const SpaceUnit = z.enum(["Pixels", "Rem", "Percent"]);
5
6
 
6
7
  export const SpaceValue = z.object({
7
- unit: SpaceUnit,
8
+ unit: DimensionUnit,
8
9
  measure: z.number(),
9
10
  });
10
11
 
@@ -1,10 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import { tokenAliasOrValue } from "./base";
3
+ import { DimensionUnit } from "./dimension";
3
4
 
4
5
  export const ZIndexUnit = z.enum(["Raw"]);
5
6
 
6
7
  export const ZIndexValue = z.object({
7
- unit: ZIndexUnit,
8
+ unit: DimensionUnit,
8
9
  measure: z.number(),
9
10
  });
10
11