@supernova-studio/model 0.37.0 → 0.38.0

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.37.0",
3
+ "version": "0.38.0",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -5,10 +5,16 @@ import { DocumentationItemConfigurationV2 } from "./documentation-v2";
5
5
 
6
6
  export const DocumentationGroupBehavior = z.enum(["Group", "Tabs"]);
7
7
 
8
+ export const ElementGroupDataV1 = z.object({
9
+ behavior: nullishToOptional(DocumentationGroupBehavior.optional()),
10
+ configuration: nullishToOptional(DocumentationItemConfigurationV1),
11
+ });
12
+
8
13
  export const ElementGroupDataV2 = z.object({
9
14
  behavior: nullishToOptional(DocumentationGroupBehavior.optional()),
10
15
  configuration: nullishToOptional(DocumentationItemConfigurationV2),
11
16
  });
12
17
 
13
18
  export type DocumentationGroupBehavior = z.infer<typeof DocumentationGroupBehavior>;
19
+ export type ElementGroupDataV1 = z.infer<typeof ElementGroupDataV1>;
14
20
  export type ElementGroupDataV2 = z.infer<typeof ElementGroupDataV2>;
@@ -11,7 +11,7 @@ export const ShadowLayerValue = z.object({
11
11
  y: z.number(),
12
12
  radius: z.number(),
13
13
  spread: z.number(),
14
- opacity: OpacityTokenData,
14
+ opacity: OpacityTokenData.optional(),
15
15
  type: ShadowType,
16
16
  });
17
17
 
@@ -1,8 +1,13 @@
1
1
  import { z } from "zod";
2
- import { DesignElementBase, DesignElementGroupableRequiredPart, DesignElementSlugPart } from "./base";
3
- import { DocumentationPageDataV1 } from "./data";
4
2
  import { DbCreateInputOmit, DbUpdate } from "../../helpers";
5
3
  import { OmitStrict } from "../../utils";
4
+ import { DesignElementBase, DesignElementGroupableRequiredPart, DesignElementSlugPart } from "./base";
5
+ import { DocumentationPageDataV1, ElementGroupDataV1 } from "./data";
6
+ import { ElementGroup } from "./group";
7
+
8
+ //
9
+ // Documentation page
10
+ //
6
11
 
7
12
  export const DocumentationPageV1 = DesignElementBase.extend(DesignElementGroupableRequiredPart.shape)
8
13
  .extend(DesignElementSlugPart.shape)
@@ -15,3 +20,15 @@ export type DocumentationPageV1 = z.infer<typeof DocumentationPageV1>;
15
20
 
16
21
  export type CreateDocumentationPageV1 = DbCreateInputOmit<DocumentationPageV1>;
17
22
  export type UpdateDocumentationPageV1 = OmitStrict<DbUpdate<DocumentationPageV1>, "designSystemVersionId">;
23
+
24
+ //
25
+ // Documentation group (legacy)
26
+ //
27
+
28
+ export const DocumentationGroupV1 = ElementGroup.omit({
29
+ data: true,
30
+ }).extend({
31
+ data: ElementGroupDataV1.optional(),
32
+ });
33
+
34
+ export type DocumentationGroupV1 = z.infer<typeof DocumentationGroupV1>;
@@ -1,9 +1,9 @@
1
1
  import { z } from "zod";
2
- import { DesignElementBase, DesignElementGroupableRequiredPart, DesignElementSlugPart } from "./base";
3
2
  import { DbCreateInputOmit, DbUpdate } from "../../helpers";
4
3
  import { OmitStrict } from "../../utils";
5
- import { DocumentationPageDataV2 } from "./data/documentation-page-v2";
4
+ import { DesignElementBase, DesignElementGroupableRequiredPart, DesignElementSlugPart } from "./base";
6
5
  import { PageBlockV1 } from "./data";
6
+ import { DocumentationPageDataV2 } from "./data/documentation-page-v2";
7
7
 
8
8
  export const DocumentationPageV2 = DesignElementBase.extend(DesignElementGroupableRequiredPart.shape)
9
9
  .extend(DesignElementSlugPart.shape)
@@ -51,6 +51,7 @@ export type FigmaImportBaseContext = z.infer<typeof FigmaImportBaseContext>;
51
51
 
52
52
  export const FigmaImportContextWithSourcesState = FigmaImportBaseContext.extend({
53
53
  sourcesWithMissingAccess: z.array(z.string()).default([]),
54
+ shadowOpacityOptional: z.boolean().default(false),
54
55
  });
55
56
 
56
57
  export type FigmaImportContextWithSourcesState = z.infer<typeof FigmaImportContextWithSourcesState>;
@@ -1,7 +1,11 @@
1
1
  import { z } from "zod";
2
+ import { DocumentationPageV2, ElementGroup } from "..";
2
3
  import { Entity } from "../../common/entity";
3
4
  import { DbCreateInputOmit, DbUpdate } from "../../helpers";
4
- import { DocumentationPageV2, ElementGroup } from "..";
5
+
6
+ //
7
+ // Room
8
+ //
5
9
 
6
10
  export const DesignSystemVersionRoom = Entity.extend({
7
11
  designSystemVersionId: z.string(),
@@ -14,18 +18,26 @@ export type CreateDesignSystemVersionRoom = DbCreateInputOmit<DesignSystemVersio
14
18
  export type UpdateDesignSystemVersionRoom = DbUpdate<DesignSystemVersionRoom>;
15
19
 
16
20
  //
17
- // Update
21
+ // Room state
18
22
  //
19
23
 
24
+ export const DesignSystemVersionRoomInternalSettings = z.object({
25
+ routingVersion: z.string(),
26
+ });
27
+
20
28
  export const DesignSystemVersionRoomInitialState = z.object({
21
29
  pages: z.array(DocumentationPageV2),
22
30
  groups: z.array(ElementGroup),
31
+ internalSettings: DesignSystemVersionRoomInternalSettings,
23
32
  });
24
33
 
25
- export const DesignSystemVersionRoomUpdate = DesignSystemVersionRoomInitialState.extend({
34
+ export const DesignSystemVersionRoomUpdate = z.object({
35
+ pages: z.array(DocumentationPageV2),
36
+ groups: z.array(ElementGroup),
26
37
  deletedPageIds: z.array(z.string()),
27
38
  deletedGroupIds: z.array(z.string()),
28
39
  });
29
40
 
41
+ export type DesignSystemVersionRoomInternalSettings = z.infer<typeof DesignSystemVersionRoomInternalSettings>;
30
42
  export type DesignSystemVersionRoomInitialState = z.infer<typeof DesignSystemVersionRoomInitialState>;
31
43
  export type DesignSystemVersionRoomUpdate = z.infer<typeof DesignSystemVersionRoomUpdate>;
@@ -1,12 +1,13 @@
1
1
  import { z } from "zod";
2
2
 
3
- export const FlaggedFeature = z.enum(["FigmaImporterV2"]);
3
+ export const FlaggedFeature = z.enum(["FigmaImporterV2", "ShadowOpacityOptional"]);
4
4
  export const FeatureFlagMap = z.record(FlaggedFeature, z.boolean());
5
5
  export const FeatureFlag = z.object({
6
6
  id: z.string(),
7
7
  feature: FlaggedFeature,
8
8
  createdAt: z.coerce.date(),
9
9
  enabled: z.boolean(),
10
+ designSystemId: z.string().optional(),
10
11
  });
11
12
 
12
13
  export type FlaggedFeature = z.infer<typeof FlaggedFeature>;