@supernova-studio/model 0.0.8 → 0.2.2
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/dist/index.d.mts +114371 -0
- package/dist/index.d.ts +114371 -0
- package/dist/index.js +3108 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3108 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +27 -9
- package/src/dsm/documentation/block-definitions/item.ts +8 -2
- package/src/dsm/elements/data/documentation-block-v1.ts +9 -0
- package/src/dsm/elements/data/documentation-block-v2.ts +60 -8
- package/src/helpers/index.ts +0 -1
- package/src/utils/validation.ts +4 -0
- package/src/workspace/workspace-create.ts +2 -2
- package/index.ts +0 -1
- package/src/helpers/slug-helper.ts +0 -641
|
@@ -219,6 +219,15 @@ export const PageBlockText = z.object({
|
|
|
219
219
|
spans: z.array(PageBlockTextSpan),
|
|
220
220
|
});
|
|
221
221
|
|
|
222
|
+
export type PageBlockCalloutType = z.infer<typeof PageBlockCalloutType>;
|
|
223
|
+
export type PageBlockCodeLanguage = z.infer<typeof PageBlockCodeLanguage>;
|
|
224
|
+
export type PageBlockAlignment = z.infer<typeof PageBlockAlignment>;
|
|
225
|
+
export type PageBlockThemeType = z.infer<typeof PageBlockThemeType>;
|
|
226
|
+
export type PageBlockAssetType = z.infer<typeof PageBlockAssetType>;
|
|
227
|
+
export type PageBlockTilesAlignment = z.infer<typeof PageBlockTilesAlignment>;
|
|
228
|
+
export type PageBlockTilesLayout = z.infer<typeof PageBlockTilesLayout>;
|
|
229
|
+
export type PageBlockTextSpanAttributeType = z.infer<typeof PageBlockTextSpanAttributeType>;
|
|
230
|
+
|
|
222
231
|
export type PageBlockTypeV1 = z.infer<typeof PageBlockTypeV1>;
|
|
223
232
|
export type PageBlockTextSpanAttribute = z.infer<typeof PageBlockTextSpanAttribute>;
|
|
224
233
|
export type PageBlockTextSpan = z.infer<typeof PageBlockTextSpan>;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ColorValue } from "./color";
|
|
3
|
-
import { PageBlockCalloutType } from "./documentation-block-v1";
|
|
3
|
+
import { PageBlockCalloutType, PageBlockText } from "./documentation-block-v1";
|
|
4
|
+
import { Size } from "../primitives";
|
|
4
5
|
|
|
5
6
|
//
|
|
6
7
|
// Enums
|
|
7
8
|
//
|
|
8
9
|
|
|
9
|
-
export const PageBlockLinkType = z.enum(["
|
|
10
|
+
export const PageBlockLinkType = z.enum(["DocumentationItem", "PageHeading", "Url"]);
|
|
11
|
+
export const PageBlockImageType = z.enum(["Upload", "Asset", "FigmaFrame"]);
|
|
12
|
+
export const PageBlockImageAlignment = z.enum(["Left", "Center", "Stretch"]);
|
|
10
13
|
|
|
11
14
|
export type PageBlockLinkType = z.infer<typeof PageBlockLinkType>;
|
|
15
|
+
export type PageBlockImageType = z.infer<typeof PageBlockImageType>;
|
|
16
|
+
export type PageBlockImageAlignment = z.infer<typeof PageBlockImageAlignment>;
|
|
12
17
|
|
|
13
18
|
//
|
|
14
19
|
// Definitions
|
|
@@ -18,16 +23,56 @@ export const PageBlockAppearanceV2 = z.object({
|
|
|
18
23
|
itemBackgroundColor: ColorValue,
|
|
19
24
|
});
|
|
20
25
|
|
|
21
|
-
export const
|
|
22
|
-
|
|
26
|
+
export const PageBlockItemUntypedPropertyValue = z
|
|
27
|
+
.object({
|
|
28
|
+
value: z.any(),
|
|
29
|
+
})
|
|
30
|
+
.and(z.record(z.any()));
|
|
31
|
+
|
|
32
|
+
export const PageBlockItemRichTextPropertyValue = z.object({
|
|
33
|
+
value: PageBlockText,
|
|
23
34
|
calloutType: PageBlockCalloutType.optional(),
|
|
24
35
|
});
|
|
25
36
|
|
|
37
|
+
export const PageBlockItemEmbedPropertyValue = z.object({
|
|
38
|
+
value: z.string().optional(),
|
|
39
|
+
caption: z.string().optional(),
|
|
40
|
+
height: z.number().optional(),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const PageBlockItemMultiRichTextPropertyValue = z.object({
|
|
44
|
+
value: PageBlockText.array(),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const PageBlockItemTextPropertyValue = z.object({
|
|
48
|
+
value: z.string(),
|
|
49
|
+
calloutType: PageBlockCalloutType.optional(),
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const PageBlockItemImageReference = z.object({
|
|
53
|
+
type: PageBlockImageType,
|
|
54
|
+
url: z.string(),
|
|
55
|
+
assetId: z.string().optional(),
|
|
56
|
+
size: Size.optional(),
|
|
57
|
+
figmaFile: z
|
|
58
|
+
.object({
|
|
59
|
+
sourceId: z.string(),
|
|
60
|
+
frameId: z.string(),
|
|
61
|
+
})
|
|
62
|
+
.optional(),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const PageBlockItemImageValue = z.object({
|
|
66
|
+
alt: z.string().optional(),
|
|
67
|
+
caption: z.string().optional(),
|
|
68
|
+
alignment: PageBlockImageAlignment.optional(),
|
|
69
|
+
value: PageBlockItemImageReference.optional(),
|
|
70
|
+
});
|
|
71
|
+
|
|
26
72
|
export const PageBlockLinkV2 = z.object({
|
|
27
73
|
type: PageBlockLinkType,
|
|
28
|
-
|
|
74
|
+
documentationItemId: z.string().optional(),
|
|
29
75
|
pageHeadingId: z.string().optional(),
|
|
30
|
-
groupId: z.string().optional(),
|
|
31
76
|
url: z.string().optional(),
|
|
32
77
|
openInNewTab: z.boolean().optional(),
|
|
33
78
|
});
|
|
@@ -35,7 +80,7 @@ export const PageBlockLinkV2 = z.object({
|
|
|
35
80
|
export const PageBlockItemV2 = z.object({
|
|
36
81
|
id: z.string(),
|
|
37
82
|
linksTo: PageBlockLinkV2.optional(),
|
|
38
|
-
props: z.record(
|
|
83
|
+
props: z.record(PageBlockItemUntypedPropertyValue),
|
|
39
84
|
});
|
|
40
85
|
|
|
41
86
|
export const PageBlockDataV2 = z.object({
|
|
@@ -47,7 +92,14 @@ export const PageBlockDataV2 = z.object({
|
|
|
47
92
|
});
|
|
48
93
|
|
|
49
94
|
export type PageBlockAppearanceV2 = z.infer<typeof PageBlockAppearanceV2>;
|
|
50
|
-
export type
|
|
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
|
+
export type PageBlockItemImageReference = z.infer<typeof PageBlockItemImageReference>;
|
|
102
|
+
|
|
51
103
|
export type PageBlockLinkV2 = z.infer<typeof PageBlockLinkV2>;
|
|
52
104
|
export type PageBlockItemV2 = z.infer<typeof PageBlockItemV2>;
|
|
53
105
|
export type PageBlockDataV2 = z.infer<typeof PageBlockDataV2>;
|
package/src/helpers/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { UserInvites } from "./user-invite";
|
|
3
|
-
import { SLUG_REGEX } from "../helpers";
|
|
4
3
|
import { ProductCodeSchema } from "../billing";
|
|
4
|
+
import { slugRegex } from "../utils/validation";
|
|
5
5
|
|
|
6
6
|
const WORKSPACE_NAME_MIN_LENGTH: number = 2;
|
|
7
7
|
const WORKSPACE_NAME_MAX_LENGTH: number = 64;
|
|
@@ -15,7 +15,7 @@ export const CreateWorkspaceInput = z.object({
|
|
|
15
15
|
billingEmail: z.string().email().optional(),
|
|
16
16
|
handle: z
|
|
17
17
|
.string()
|
|
18
|
-
.regex(
|
|
18
|
+
.regex(slugRegex)
|
|
19
19
|
.min(HANDLE_MIN_LENGTH)
|
|
20
20
|
.max(HANDLE_MAX_LENGTH)
|
|
21
21
|
.refine(value => value?.length > 0)
|
package/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src';
|