@supernova-studio/model 0.54.16 → 0.54.17

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.54.16",
3
+ "version": "0.54.17",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -2,6 +2,10 @@ import { z } from "zod";
2
2
 
3
3
  export const FigmaComponentPropertyType = z.enum(["Boolean", "InstanceSwap", "Variant", "Text"]);
4
4
 
5
+ //
6
+ // Definitions
7
+ //
8
+
5
9
  export const FigmaComponentPropertyOrigin = z.object({
6
10
  id: z.string(),
7
11
  });
@@ -22,6 +22,7 @@ export const ComponentElementData = z.object({
22
22
 
23
23
  parentComponentPersistentId: nullishToOptional(z.string()),
24
24
  componentPropertyDefinitions: nullishToOptional(FigmaComponentPropertyMap),
25
+ variantPropertyValues: nullishToOptional(z.record(z.string())),
25
26
  }),
26
27
  });
27
28
 
@@ -9,6 +9,10 @@ import {
9
9
  } from "./base";
10
10
  import { FigmaComponentPropertyMap } from "./component-properties";
11
11
 
12
+ //
13
+ // Figma Component
14
+ //
15
+
12
16
  export const FigmaComponentOriginPart = z.object({
13
17
  nodeId: z.string().optional(),
14
18
  width: z.number().optional(),
@@ -28,6 +32,7 @@ export const FigmaComponent = DesignElementBase.extend(DesignElementGroupableReq
28
32
  origin: FigmaComponentOrigin.optional(),
29
33
  thumbnail: FigmaComponentAsset,
30
34
  componentPropertyDefinitions: FigmaComponentPropertyMap.optional(),
35
+ variantPropertyValues: z.record(z.string()).optional(),
31
36
 
32
37
  svg: FigmaComponentAsset.optional(),
33
38
  isAsset: z.boolean(),
@@ -39,9 +44,9 @@ export type FigmaComponent = z.infer<typeof FigmaComponent>;
39
44
  export type FigmaComponentOrigin = z.infer<typeof FigmaComponentOrigin>;
40
45
  export type ImportedFigmaComponent = OmitStrict<FigmaComponent, "origin"> & { origin: FigmaComponentOrigin };
41
46
 
42
- export function isImportedFigmaComponent(component: FigmaComponent): component is ImportedFigmaComponent {
43
- return !!component.origin;
44
- }
47
+ //
48
+ // Support types
49
+ //
45
50
 
46
51
  export type CreateFigmaComponent = DbCreateInputOmit<FigmaComponent>;
47
52
  export type UpdateFigmaComponent = OmitStrict<DbUpdate<FigmaComponent>, "brandPersistentId" | "designSystemVersionId">;
@@ -51,3 +56,11 @@ export type FigmaComponentDiff = {
51
56
  toUpdate: UpdateFigmaComponent[];
52
57
  toDelete: FigmaComponent["id"][];
53
58
  };
59
+
60
+ //
61
+ // Utils
62
+ //
63
+
64
+ export function isImportedFigmaComponent(component: FigmaComponent): component is ImportedFigmaComponent {
65
+ return !!component.origin;
66
+ }
@@ -11,6 +11,7 @@ const FigmaComponentImportModelPart = z.object({
11
11
  thumbnail: ImageImportModel,
12
12
  parentComponentId: z.string().optional(),
13
13
  componentPropertyDefinitions: FigmaComponentPropertyMap.optional(),
14
+ variantPropertyValues: z.record(z.string()).optional(),
14
15
  });
15
16
 
16
17
  export const FigmaComponentImportModel = ImportModelBase.extend(FigmaComponentImportModelPart.shape).extend({