@supernova-studio/model 0.3.0 → 0.4.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.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,10 +11,12 @@ import { DesignTokenType } from "../raw-element";
11
11
  export const PageBlockLinkType = z.enum(["DocumentationItem", "PageHeading", "Url"]);
12
12
  export const PageBlockImageType = z.enum(["Upload", "Asset", "FigmaFrame"]);
13
13
  export const PageBlockImageAlignment = z.enum(["Left", "Center", "Stretch"]);
14
+ export const PageBlockTableCellAlignment = z.enum(["Left", "Center", "Right"]);
14
15
 
15
16
  export type PageBlockLinkType = z.infer<typeof PageBlockLinkType>;
16
17
  export type PageBlockImageType = z.infer<typeof PageBlockImageType>;
17
18
  export type PageBlockImageAlignment = z.infer<typeof PageBlockImageAlignment>;
19
+ export type PageBlockTableCellAlignment = z.infer<typeof PageBlockTableCellAlignment>;
18
20
 
19
21
  //
20
22
  // Definitions - Block
@@ -172,10 +174,6 @@ export const PageBlockItemStorybookValue = z.object({
172
174
  value: z.string(),
173
175
  });
174
176
 
175
- export const PageBlockItemTableValue = z.object({
176
- value: z.any(),
177
- });
178
-
179
177
  export const PageBlockItemTextValue = z.object({
180
178
  value: z.string(),
181
179
  });
@@ -225,9 +223,60 @@ export type PageBlockItemNumberValue = z.infer<typeof PageBlockItemNumberValue>;
225
223
  export type PageBlockItemRichTextValue = z.infer<typeof PageBlockItemRichTextValue>;
226
224
  export type PageBlockItemSingleSelectValue = z.infer<typeof PageBlockItemSingleSelectValue>;
227
225
  export type PageBlockItemStorybookValue = z.infer<typeof PageBlockItemStorybookValue>;
228
- export type PageBlockItemTableValue = z.infer<typeof PageBlockItemTableValue>;
229
226
  export type PageBlockItemTextValue = z.infer<typeof PageBlockItemTextValue>;
230
227
  export type PageBlockItemTokenValue = z.infer<typeof PageBlockItemTokenValue>;
231
228
  export type PageBlockItemTokenPropertyValue = z.infer<typeof PageBlockItemTokenPropertyValue>;
232
229
  export type PageBlockItemTokenTypeValue = z.infer<typeof PageBlockItemTokenTypeValue>;
233
230
  export type PageBlockItemUrlValue = z.infer<typeof PageBlockItemUrlValue>;
231
+
232
+ //
233
+ // Definitions - Table Value
234
+ //
235
+
236
+ export const PageBlockItemTableRichTextNode = z.object({
237
+ type: z.literal("RichText"),
238
+ value: PageBlockItemRichTextValue.shape.value,
239
+ });
240
+
241
+ export const PageBlockItemTableMultiRichTextNode = z.object({
242
+ type: z.literal("MultiRichText"),
243
+ value: PageBlockItemMultiRichTextValue.shape.value,
244
+ });
245
+
246
+ export const PageBlockItemTableImageNode = z.object({
247
+ type: z.literal("Image"),
248
+ value: PageBlockItemImageValue.shape.value,
249
+ });
250
+
251
+ export const PageBlockItemTableNode = z.discriminatedUnion("type", [
252
+ PageBlockItemTableRichTextNode,
253
+ PageBlockItemTableMultiRichTextNode,
254
+ PageBlockItemTableImageNode,
255
+ ]);
256
+
257
+ export const PageBlockItemTableCell = z.object({
258
+ id: z.string(),
259
+ nodes: z.array(PageBlockItemTableNode),
260
+ columnWidth: z.number().optional(),
261
+ alignment: PageBlockTableCellAlignment,
262
+ });
263
+
264
+ export const PageBlockItemTableRow = z.object({
265
+ cells: z.array(PageBlockItemTableCell),
266
+ });
267
+
268
+ export const PageBlockItemTableValue = z.object({
269
+ highlightHeaderColumn: z.boolean().optional(),
270
+ highlightHeaderRow: z.boolean().optional(),
271
+ showBorder: z.boolean().optional(),
272
+ width: z.number().optional(),
273
+ value: z.array(PageBlockItemTableRow),
274
+ });
275
+
276
+ export type PageBlockItemTableRichTextNode = z.infer<typeof PageBlockItemTableRichTextNode>;
277
+ export type PageBlockItemTableMultiRichTextNode = z.infer<typeof PageBlockItemTableMultiRichTextNode>;
278
+ export type PageBlockItemTableImageNode = z.infer<typeof PageBlockItemTableImageNode>;
279
+ export type PageBlockItemTableNode = z.infer<typeof PageBlockItemTableNode>;
280
+ export type PageBlockItemTableCell = z.infer<typeof PageBlockItemTableCell>;
281
+ export type PageBlockItemTableRow = z.infer<typeof PageBlockItemTableRow>;
282
+ export type PageBlockItemTableValue = z.infer<typeof PageBlockItemTableValue>;