@supernova-studio/model 0.0.4 → 0.0.5
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 +1 -1
- package/src/dsm/documentation/block-definitions/aux.ts +1 -0
- package/src/dsm/documentation/block-definitions/definition.ts +22 -51
- package/src/dsm/documentation/block-definitions/item.ts +39 -73
- package/src/dsm/elements/data/documentation-block-v1.ts +2 -9
- package/src/dsm/elements/data/documentation-block-v2.ts +5 -10
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
export const PageBlockDefinitionAppearance = z.object({
|
|
4
4
|
isBordered: z.boolean().optional(),
|
|
5
5
|
hasBackground: z.boolean().optional(),
|
|
6
|
+
isEditorPresentationDifferent: z.boolean().optional(),
|
|
6
7
|
});
|
|
7
8
|
|
|
8
9
|
export type PageBlockDefinitionAppearance = z.infer<typeof PageBlockDefinitionAppearance>;
|
|
@@ -7,63 +7,34 @@ import { PageBlockDefinitionAppearance } from "./aux";
|
|
|
7
7
|
// Enums
|
|
8
8
|
//
|
|
9
9
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
guidelines = "Guidelines",
|
|
25
|
-
/** Show as "Token blocks" */
|
|
26
|
-
token = "Tokens",
|
|
27
|
-
/** Show as "Component blocks" */
|
|
28
|
-
component = "Components",
|
|
29
|
-
/** Shows as "Asset blocks" */
|
|
30
|
-
asset = "Assets",
|
|
31
|
-
/** Show as "Data blocks" */
|
|
32
|
-
data = "Data",
|
|
33
|
-
/** Shows as "Other blocks" */
|
|
34
|
-
other = "Other",
|
|
35
|
-
}
|
|
10
|
+
export const PageBlockCategory = z.enum([
|
|
11
|
+
"Text",
|
|
12
|
+
"Layout",
|
|
13
|
+
"Media",
|
|
14
|
+
"Embed",
|
|
15
|
+
"Figma",
|
|
16
|
+
"Code",
|
|
17
|
+
"Guidelines",
|
|
18
|
+
"Tokens",
|
|
19
|
+
"Components",
|
|
20
|
+
"Assets",
|
|
21
|
+
"Data",
|
|
22
|
+
"Other",
|
|
23
|
+
]);
|
|
36
24
|
|
|
37
|
-
export
|
|
38
|
-
|
|
39
|
-
item = "Item",
|
|
40
|
-
/** Token type allows selection of token entity and associated groups * */
|
|
41
|
-
token = "Token",
|
|
42
|
-
/** Asset type allows selection of asset entity and associated groups * */
|
|
43
|
-
asset = "Asset",
|
|
44
|
-
/** Component type allows selection of asset entity and associated groups * */
|
|
45
|
-
component = "Component",
|
|
46
|
-
}
|
|
25
|
+
export const PageBlockBehaviorDataType = z.enum(["Item", "Token", "Asset", "Component"]);
|
|
26
|
+
export const PageBlockBehaviorSelectionType = z.enum(["Entity", "Group", "EntityAndGroup"]);
|
|
47
27
|
|
|
48
|
-
export
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/** Allows selection of groups only */
|
|
52
|
-
group = "Group",
|
|
53
|
-
/** Allows combined selection of data entities and groups */
|
|
54
|
-
entityAndGroup = "EntityAndGroup",
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export const PageBlockCategorySchema = z.nativeEnum(PageBlockCategory);
|
|
58
|
-
export const PageBlockBehaviorDataTypeSchema = z.nativeEnum(PageBlockBehaviorDataType);
|
|
59
|
-
export const PageBlockBehaviorSelectionTypeSchema = z.nativeEnum(PageBlockBehaviorSelectionType);
|
|
28
|
+
export type PageBlockCategory = z.infer<typeof PageBlockCategory>;
|
|
29
|
+
export type PageBlockBehaviorDataType = z.infer<typeof PageBlockBehaviorDataType>;
|
|
30
|
+
export type PageBlockBehaviorSelectionType = z.infer<typeof PageBlockBehaviorSelectionType>;
|
|
60
31
|
|
|
61
32
|
//
|
|
62
33
|
// Definitions
|
|
63
34
|
//
|
|
64
35
|
|
|
65
36
|
export const PageBlockDefinitionBehavior = z.object({
|
|
66
|
-
dataType:
|
|
37
|
+
dataType: PageBlockBehaviorDataType,
|
|
67
38
|
items: z
|
|
68
39
|
.object({
|
|
69
40
|
numberOfItems: z.number(),
|
|
@@ -72,7 +43,7 @@ export const PageBlockDefinitionBehavior = z.object({
|
|
|
72
43
|
.optional(),
|
|
73
44
|
entities: z
|
|
74
45
|
.object({
|
|
75
|
-
selectionType:
|
|
46
|
+
selectionType: PageBlockBehaviorSelectionType,
|
|
76
47
|
maxSelected: z.number(),
|
|
77
48
|
})
|
|
78
49
|
.optional(),
|
|
@@ -87,7 +58,7 @@ export const PageBlockDefinition = z.object({
|
|
|
87
58
|
id: z.string(),
|
|
88
59
|
name: z.string(),
|
|
89
60
|
description: z.string(),
|
|
90
|
-
category:
|
|
61
|
+
category: PageBlockCategory,
|
|
91
62
|
icon: AssetValue.optional(),
|
|
92
63
|
documentationLink: z.string().optional(),
|
|
93
64
|
searchKeywords: z.array(z.string()).optional(),
|
|
@@ -6,79 +6,45 @@ import { PageBlockDefinitionVariant } from "./variant";
|
|
|
6
6
|
// Enums
|
|
7
7
|
//
|
|
8
8
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/** Component property allows selection of custom component properties (columns) */
|
|
33
|
-
componentProperty = "ComponentProperty",
|
|
34
|
-
/** Asset type allows data access to the assets defined in design system */
|
|
35
|
-
asset = "Asset",
|
|
36
|
-
/** Asset property allows selection of custom asset properties (columns) */
|
|
37
|
-
assetProperty = "AssetProperty",
|
|
38
|
-
/** Page type allows data access to the pages defined in design system */
|
|
39
|
-
/** Page property allows selection of custom page properties (columns) */
|
|
40
|
-
/** Embed property allows user to input page to be embedded via URL */
|
|
41
|
-
embedURL = "EmbedURL",
|
|
42
|
-
/** Embed property allows user to input page to be embedded via iframe */
|
|
43
|
-
/** Markdown property allows user to add markdown to render */
|
|
44
|
-
markdown = "Markdown",
|
|
45
|
-
/** Code property allows user to add code to render */
|
|
46
|
-
code = "Code",
|
|
47
|
-
/** Sandbox property allows user to add code sandbox to render live component */
|
|
48
|
-
codeSandbox = "CodeSandbox",
|
|
49
|
-
/** Table property allows user to add table to render */
|
|
50
|
-
table = "Table",
|
|
51
|
-
/** Divider property that puts visual divider into the block. It has no user input */
|
|
52
|
-
divider = "Divider",
|
|
53
|
-
/** Storybook property allows user to add Storybook story to render */
|
|
54
|
-
storybook = "Storybook",
|
|
55
|
-
}
|
|
9
|
+
export const PageBlockDefinitionPropertyType = z.enum([
|
|
10
|
+
"RichText",
|
|
11
|
+
"Text",
|
|
12
|
+
"Boolean",
|
|
13
|
+
"Number",
|
|
14
|
+
"SingleSelect",
|
|
15
|
+
"MultiSelect",
|
|
16
|
+
"Image",
|
|
17
|
+
"Token",
|
|
18
|
+
"TokenType",
|
|
19
|
+
"TokenProperty",
|
|
20
|
+
"Component",
|
|
21
|
+
"ComponentProperty",
|
|
22
|
+
"Asset",
|
|
23
|
+
"AssetProperty",
|
|
24
|
+
"EmbedURL",
|
|
25
|
+
"Markdown",
|
|
26
|
+
"Code",
|
|
27
|
+
"CodeSandbox",
|
|
28
|
+
"Table",
|
|
29
|
+
"Divider",
|
|
30
|
+
"Storybook",
|
|
31
|
+
]);
|
|
56
32
|
|
|
57
|
-
export
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
quote = "Quote",
|
|
70
|
-
/** Callout */
|
|
71
|
-
callout = "Callout",
|
|
72
|
-
/** Ordered list */
|
|
73
|
-
ol = "OL",
|
|
74
|
-
/** Unordered list */
|
|
75
|
-
ul = "UL",
|
|
76
|
-
/** Default option */
|
|
77
|
-
default = "Default",
|
|
78
|
-
}
|
|
33
|
+
export const PageBlockDefinitionRichTextPropertyStyle = z.enum([
|
|
34
|
+
"Title1",
|
|
35
|
+
"Title2",
|
|
36
|
+
"Title3",
|
|
37
|
+
"Title4",
|
|
38
|
+
"Title5",
|
|
39
|
+
"Quote",
|
|
40
|
+
"Callout",
|
|
41
|
+
"OL",
|
|
42
|
+
"UL",
|
|
43
|
+
"Default",
|
|
44
|
+
]);
|
|
79
45
|
|
|
80
|
-
export
|
|
81
|
-
export
|
|
46
|
+
export type PageBlockDefinitionPropertyType = z.infer<typeof PageBlockDefinitionPropertyType>;
|
|
47
|
+
export type PageBlockDefinitionRichTextPropertyStyle = z.infer<typeof PageBlockDefinitionRichTextPropertyStyle>;
|
|
82
48
|
|
|
83
49
|
//
|
|
84
50
|
// Definitions
|
|
@@ -86,7 +52,7 @@ export const PageBlockDefinitionRichTextPropertyStyleSchema = z.nativeEnum(PageB
|
|
|
86
52
|
|
|
87
53
|
export const PageBlockDefinitionPropertyOptions = z
|
|
88
54
|
.object({
|
|
89
|
-
style:
|
|
55
|
+
style: PageBlockDefinitionRichTextPropertyStyle.optional(),
|
|
90
56
|
placeholder: z.string().optional(),
|
|
91
57
|
})
|
|
92
58
|
.and(z.record(z.any()));
|
|
@@ -94,7 +60,7 @@ export const PageBlockDefinitionPropertyOptions = z
|
|
|
94
60
|
export const PageBlockDefinitionProperty = z.object({
|
|
95
61
|
id: z.string(),
|
|
96
62
|
name: z.string(),
|
|
97
|
-
type:
|
|
63
|
+
type: PageBlockDefinitionPropertyType,
|
|
98
64
|
description: z.string().optional(),
|
|
99
65
|
// TODO Docs
|
|
100
66
|
options: PageBlockDefinitionPropertyOptions.optional(),
|
|
@@ -9,14 +9,7 @@ import { nullishToOptional } from "../../../helpers";
|
|
|
9
9
|
// Enums
|
|
10
10
|
//
|
|
11
11
|
|
|
12
|
-
export
|
|
13
|
-
info = "Info",
|
|
14
|
-
success = "Success",
|
|
15
|
-
warning = "Warning",
|
|
16
|
-
error = "Error",
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const PageBlockCalloutTypeSchema = z.nativeEnum(PageBlockCalloutType);
|
|
12
|
+
export const PageBlockCalloutType = z.enum(["Info", "Success", "Warning", "Error"]);
|
|
20
13
|
|
|
21
14
|
export const PageBlockTypeV1 = z.enum([
|
|
22
15
|
"Text",
|
|
@@ -253,7 +246,7 @@ const PageBlockBaseV1 = z.object({
|
|
|
253
246
|
caption: nullishToOptional(z.string()),
|
|
254
247
|
headingType: nullishToOptional(z.number().min(1).max(3)),
|
|
255
248
|
codeLanguage: nullishToOptional(PageBlockCodeLanguage),
|
|
256
|
-
calloutType: nullishToOptional(
|
|
249
|
+
calloutType: nullishToOptional(PageBlockCalloutType),
|
|
257
250
|
urlInput: nullishToOptional(z.string()),
|
|
258
251
|
url: nullishToOptional(z.string()),
|
|
259
252
|
urlPreview: nullishToOptional(PageBlockUrlPreview),
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ColorValue } from "./color";
|
|
3
|
-
import {
|
|
3
|
+
import { PageBlockCalloutType } from "./documentation-block-v1";
|
|
4
4
|
|
|
5
5
|
//
|
|
6
6
|
// Enums
|
|
7
7
|
//
|
|
8
8
|
|
|
9
|
-
export
|
|
10
|
-
page = "Page",
|
|
11
|
-
pageHeading = "pageHeading",
|
|
12
|
-
group = "Group",
|
|
13
|
-
url = "url",
|
|
14
|
-
}
|
|
9
|
+
export const PageBlockLinkType = z.enum(["Page", "PageHeading", "Group", "Url"]);
|
|
15
10
|
|
|
16
|
-
export
|
|
11
|
+
export type PageBlockLinkType = z.infer<typeof PageBlockLinkType>;
|
|
17
12
|
|
|
18
13
|
//
|
|
19
14
|
// Definitions
|
|
@@ -25,11 +20,11 @@ export const PageBlockAppearanceV2 = z.object({
|
|
|
25
20
|
|
|
26
21
|
export const PageBlockItemPropertyValue = z.object({
|
|
27
22
|
value: z.any(),
|
|
28
|
-
calloutType:
|
|
23
|
+
calloutType: PageBlockCalloutType.optional(),
|
|
29
24
|
});
|
|
30
25
|
|
|
31
26
|
export const PageBlockLinkV2 = z.object({
|
|
32
|
-
type:
|
|
27
|
+
type: PageBlockCalloutType,
|
|
33
28
|
pageId: z.string().optional(),
|
|
34
29
|
pageHeadingId: z.string().optional(),
|
|
35
30
|
groupId: z.string().optional(),
|