@supernova-studio/model 0.2.2 → 0.3.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.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,7 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { ColorValue } from "./color";
3
- import { PageBlockCalloutType, PageBlockText } from "./documentation-block-v1";
3
+ import { PageBlockCalloutType, PageBlockCodeLanguage, PageBlockText } from "./documentation-block-v1";
4
4
  import { Size } from "../primitives";
5
+ import { DesignTokenType } from "../raw-element";
5
6
 
6
7
  //
7
8
  // Enums
@@ -16,38 +17,50 @@ export type PageBlockImageType = z.infer<typeof PageBlockImageType>;
16
17
  export type PageBlockImageAlignment = z.infer<typeof PageBlockImageAlignment>;
17
18
 
18
19
  //
19
- // Definitions
20
+ // Definitions - Block
20
21
  //
21
22
 
22
23
  export const PageBlockAppearanceV2 = z.object({
23
24
  itemBackgroundColor: ColorValue,
24
25
  });
25
26
 
26
- export const PageBlockItemUntypedPropertyValue = z
27
+ export const PageBlockItemUntypedValue = z
27
28
  .object({
28
29
  value: z.any(),
29
30
  })
30
31
  .and(z.record(z.any()));
31
32
 
32
- export const PageBlockItemRichTextPropertyValue = z.object({
33
- value: PageBlockText,
34
- calloutType: PageBlockCalloutType.optional(),
33
+ export const PageBlockLinkV2 = z.object({
34
+ type: PageBlockLinkType,
35
+ documentationItemId: z.string().optional(),
36
+ pageHeadingId: z.string().optional(),
37
+ url: z.string().optional(),
38
+ openInNewTab: z.boolean().optional(),
35
39
  });
36
40
 
37
- export const PageBlockItemEmbedPropertyValue = z.object({
38
- value: z.string().optional(),
39
- caption: z.string().optional(),
40
- height: z.number().optional(),
41
+ export const PageBlockItemV2 = z.object({
42
+ id: z.string(),
43
+ linksTo: PageBlockLinkV2.optional(),
44
+ props: z.record(PageBlockItemUntypedValue),
41
45
  });
42
46
 
43
- export const PageBlockItemMultiRichTextPropertyValue = z.object({
44
- value: PageBlockText.array(),
47
+ export const PageBlockDataV2 = z.object({
48
+ packageId: z.string(),
49
+ variantId: z.string().optional(),
50
+ indentLevel: z.number(),
51
+ appearance: PageBlockAppearanceV2.optional(),
52
+ items: z.array(PageBlockItemV2),
45
53
  });
46
54
 
47
- export const PageBlockItemTextPropertyValue = z.object({
48
- value: z.string(),
49
- calloutType: PageBlockCalloutType.optional(),
50
- });
55
+ export type PageBlockAppearanceV2 = z.infer<typeof PageBlockAppearanceV2>;
56
+ export type PageBlockItemUntypedValue = z.infer<typeof PageBlockItemUntypedValue>;
57
+ export type PageBlockLinkV2 = z.infer<typeof PageBlockLinkV2>;
58
+ export type PageBlockItemV2 = z.infer<typeof PageBlockItemV2>;
59
+ export type PageBlockDataV2 = z.infer<typeof PageBlockDataV2>;
60
+
61
+ //
62
+ // Definitions - Typed Values
63
+ //
51
64
 
52
65
  export const PageBlockItemImageReference = z.object({
53
66
  type: PageBlockImageType,
@@ -62,6 +75,64 @@ export const PageBlockItemImageReference = z.object({
62
75
  .optional(),
63
76
  });
64
77
 
78
+ export const PageBlockItemAssetValue = z.object({
79
+ selectedPropertyIds: z.array(z.string()).optional(),
80
+ showSearch: z.boolean().optional(),
81
+ previewContainerSize: z.enum(["Centered", "NaturalHeight"]).optional(),
82
+ backgroundColor: z.string().optional(),
83
+ value: z.array(
84
+ z.object({
85
+ entityId: z.string(),
86
+ entityType: z.enum(["Asset", "AssetGroup"]),
87
+ })
88
+ ),
89
+ });
90
+
91
+ export const PageBlockItemAssetPropertyValue = z.object({
92
+ value: z.array(z.string()),
93
+ });
94
+
95
+ export const PageBlockItemBooleanValue = z.object({
96
+ value: z.boolean(),
97
+ });
98
+
99
+ export const PageBlockItemCodeValue = z.object({
100
+ format: PageBlockCodeLanguage.optional(),
101
+ caption: z.string().optional(),
102
+ value: z.string(),
103
+ });
104
+
105
+ export const PageBlockItemSandboxValue = z.object({
106
+ showCode: z.boolean().optional(),
107
+ backgroundColor: z.string().optional(),
108
+ alignPreview: z.enum(["Left", "Center"]).optional(),
109
+ value: z.string(),
110
+ });
111
+
112
+ export const PageBlockItemColorValue = z.record(z.any());
113
+
114
+ export const PageBlockItemComponentValue = z.object({
115
+ selectedPropertyIds: z.array(z.string()).optional(),
116
+ value: z.array(
117
+ z.object({
118
+ entityId: z.string(),
119
+ entityType: z.enum(["Component", "ComponentGroup"]),
120
+ })
121
+ ),
122
+ });
123
+
124
+ export const PageBlockItemComponentPropertyValue = z.object({
125
+ value: z.string(),
126
+ });
127
+
128
+ export const PageBlockItemDividerValue = z.object({});
129
+
130
+ export const PageBlockItemEmbedValue = z.object({
131
+ value: z.string().optional(),
132
+ caption: z.string().optional(),
133
+ height: z.number().optional(),
134
+ });
135
+
65
136
  export const PageBlockItemImageValue = z.object({
66
137
  alt: z.string().optional(),
67
138
  caption: z.string().optional(),
@@ -69,37 +140,94 @@ export const PageBlockItemImageValue = z.object({
69
140
  value: PageBlockItemImageReference.optional(),
70
141
  });
71
142
 
72
- export const PageBlockLinkV2 = z.object({
73
- type: PageBlockLinkType,
74
- documentationItemId: z.string().optional(),
75
- pageHeadingId: z.string().optional(),
76
- url: z.string().optional(),
77
- openInNewTab: z.boolean().optional(),
143
+ export const PageBlockItemMarkdownValue = z.object({
144
+ value: z.string(),
78
145
  });
79
146
 
80
- export const PageBlockItemV2 = z.object({
81
- id: z.string(),
82
- linksTo: PageBlockLinkV2.optional(),
83
- props: z.record(PageBlockItemUntypedPropertyValue),
147
+ export const PageBlockItemMultiRichTextValue = z.object({
148
+ value: PageBlockText.array(),
84
149
  });
85
150
 
86
- export const PageBlockDataV2 = z.object({
87
- packageId: z.string(),
88
- variantId: z.string().optional(),
89
- indentLevel: z.number(),
90
- appearance: PageBlockAppearanceV2.optional(),
91
- items: z.array(PageBlockItemV2),
151
+ export const PageBlockItemMultiSelectValue = z.object({
152
+ value: z.array(z.string()),
153
+ });
154
+
155
+ export const PageBlockItemNumberValue = z.object({
156
+ value: z.number(),
157
+ });
158
+
159
+ export const PageBlockItemRichTextValue = z.object({
160
+ value: PageBlockText,
161
+ calloutType: PageBlockCalloutType.optional(),
162
+ });
163
+
164
+ export const PageBlockItemSingleSelectValue = z.object({
165
+ value: z.string(),
166
+ });
167
+
168
+ export const PageBlockItemStorybookValue = z.object({
169
+ caption: z.string().optional(),
170
+ height: z.number().optional(),
171
+ showAddons: z.boolean().optional(),
172
+ value: z.string(),
173
+ });
174
+
175
+ export const PageBlockItemTableValue = z.object({
176
+ value: z.any(),
177
+ });
178
+
179
+ export const PageBlockItemTextValue = z.object({
180
+ value: z.string(),
181
+ });
182
+
183
+ export const PageBlockItemTokenValue = z.object({
184
+ selectedPropertyIds: z.array(z.string()).optional(),
185
+ selectedThemeIds: z.array(z.string()).optional(),
186
+ value: z.array(
187
+ z.object({
188
+ entityId: z.string(),
189
+ entityType: z.enum(["Token", "TokenGroup"]),
190
+ })
191
+ ),
192
+ });
193
+
194
+ export const PageBlockItemTokenPropertyValue = z.object({
195
+ selectedPropertyIds: z.array(z.string()).optional(),
196
+ selectedThemeIds: z.array(z.string()).optional(),
197
+ value: z.array(z.string()),
198
+ });
199
+
200
+ export const PageBlockItemTokenTypeValue = z.object({
201
+ value: z.array(DesignTokenType),
202
+ });
203
+
204
+ export const PageBlockItemUrlValue = z.object({
205
+ value: z.string(),
92
206
  });
93
207
 
94
- export type PageBlockAppearanceV2 = z.infer<typeof PageBlockAppearanceV2>;
95
- export type PageBlockItemUntypedPropertyValue = z.infer<typeof PageBlockItemUntypedPropertyValue>;
96
- export type PageBlockItemRichTextPropertyValue = z.infer<typeof PageBlockItemRichTextPropertyValue>;
97
- export type PageBlockItemMultiRichTextPropertyValue = z.infer<typeof PageBlockItemMultiRichTextPropertyValue>;
98
- export type PageBlockItemTextPropertyValue = z.infer<typeof PageBlockItemTextPropertyValue>;
99
- export type PageBlockItemEmbedPropertyValue = z.infer<typeof PageBlockItemEmbedPropertyValue>;
100
- export type PageBlockItemImageValue = z.infer<typeof PageBlockItemImageValue>;
101
208
  export type PageBlockItemImageReference = z.infer<typeof PageBlockItemImageReference>;
102
209
 
103
- export type PageBlockLinkV2 = z.infer<typeof PageBlockLinkV2>;
104
- export type PageBlockItemV2 = z.infer<typeof PageBlockItemV2>;
105
- export type PageBlockDataV2 = z.infer<typeof PageBlockDataV2>;
210
+ export type PageBlockItemAssetValue = z.infer<typeof PageBlockItemAssetValue>;
211
+ export type PageBlockItemAssetPropertyValue = z.infer<typeof PageBlockItemAssetPropertyValue>;
212
+ export type PageBlockItemBooleanValue = z.infer<typeof PageBlockItemBooleanValue>;
213
+ export type PageBlockItemCodeValue = z.infer<typeof PageBlockItemCodeValue>;
214
+ export type PageBlockItemSandboxValue = z.infer<typeof PageBlockItemSandboxValue>;
215
+ export type PageBlockItemColorValue = z.infer<typeof PageBlockItemColorValue>;
216
+ export type PageBlockItemComponentValue = z.infer<typeof PageBlockItemComponentValue>;
217
+ export type PageBlockItemComponentPropertyValue = z.infer<typeof PageBlockItemComponentPropertyValue>;
218
+ export type PageBlockItemDividerValue = z.infer<typeof PageBlockItemDividerValue>;
219
+ export type PageBlockItemEmbedValue = z.infer<typeof PageBlockItemEmbedValue>;
220
+ export type PageBlockItemImageValue = z.infer<typeof PageBlockItemImageValue>;
221
+ export type PageBlockItemMarkdownValue = z.infer<typeof PageBlockItemMarkdownValue>;
222
+ export type PageBlockItemMultiRichTextValue = z.infer<typeof PageBlockItemMultiRichTextValue>;
223
+ export type PageBlockItemMultiSelectValue = z.infer<typeof PageBlockItemMultiSelectValue>;
224
+ export type PageBlockItemNumberValue = z.infer<typeof PageBlockItemNumberValue>;
225
+ export type PageBlockItemRichTextValue = z.infer<typeof PageBlockItemRichTextValue>;
226
+ export type PageBlockItemSingleSelectValue = z.infer<typeof PageBlockItemSingleSelectValue>;
227
+ export type PageBlockItemStorybookValue = z.infer<typeof PageBlockItemStorybookValue>;
228
+ export type PageBlockItemTableValue = z.infer<typeof PageBlockItemTableValue>;
229
+ export type PageBlockItemTextValue = z.infer<typeof PageBlockItemTextValue>;
230
+ export type PageBlockItemTokenValue = z.infer<typeof PageBlockItemTokenValue>;
231
+ export type PageBlockItemTokenPropertyValue = z.infer<typeof PageBlockItemTokenPropertyValue>;
232
+ export type PageBlockItemTokenTypeValue = z.infer<typeof PageBlockItemTokenTypeValue>;
233
+ export type PageBlockItemUrlValue = z.infer<typeof PageBlockItemUrlValue>;