@supernova-studio/model 0.0.4
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/index.ts +1 -0
- package/package.json +23 -0
- package/src/auth/index.ts +1 -0
- package/src/auth/plugin-oauth-request.ts +14 -0
- package/src/billing/card.ts +12 -0
- package/src/billing/checkoutSession.ts +16 -0
- package/src/billing/customer.ts +28 -0
- package/src/billing/features.ts +43 -0
- package/src/billing/index.ts +9 -0
- package/src/billing/invoice.ts +34 -0
- package/src/billing/portalSession.ts +19 -0
- package/src/billing/price.ts +24 -0
- package/src/billing/product.ts +5 -0
- package/src/billing/subscription.ts +65 -0
- package/src/codegen/export-jobs.ts +26 -0
- package/src/codegen/exporter-workspace-membership-role.ts +4 -0
- package/src/codegen/exporter-workspace-membership.ts +14 -0
- package/src/codegen/exporter.ts +52 -0
- package/src/codegen/git-providers.ts +11 -0
- package/src/codegen/index.ts +6 -0
- package/src/codegen/pulsar.ts +59 -0
- package/src/common/entity.ts +9 -0
- package/src/common/index.ts +2 -0
- package/src/common/object-meta.ts +8 -0
- package/src/custom-domains/custom-domains.ts +24 -0
- package/src/custom-domains/index.ts +1 -0
- package/src/docs-server/index.ts +1 -0
- package/src/docs-server/session.ts +39 -0
- package/src/dsm/assets/asset-reference.ts +18 -0
- package/src/dsm/assets/asset-value.ts +3 -0
- package/src/dsm/assets/asset.ts +48 -0
- package/src/dsm/assets/index.ts +3 -0
- package/src/dsm/brand.ts +7 -0
- package/src/dsm/data-sources/data-source.ts +158 -0
- package/src/dsm/data-sources/import-job.ts +28 -0
- package/src/dsm/data-sources/import-summary.ts +70 -0
- package/src/dsm/data-sources/index.ts +3 -0
- package/src/dsm/design-system.ts +33 -0
- package/src/dsm/desing-system-create.ts +22 -0
- package/src/dsm/desing-system-update.ts +25 -0
- package/src/dsm/documentation/block-definitions/aux.ts +8 -0
- package/src/dsm/documentation/block-definitions/definition.ts +104 -0
- package/src/dsm/documentation/block-definitions/index.ts +4 -0
- package/src/dsm/documentation/block-definitions/item.ts +113 -0
- package/src/dsm/documentation/block-definitions/variant.ts +78 -0
- package/src/dsm/documentation/group.ts +19 -0
- package/src/dsm/documentation/index.ts +3 -0
- package/src/dsm/documentation/page.ts +18 -0
- package/src/dsm/elements/base.ts +49 -0
- package/src/dsm/elements/component.ts +48 -0
- package/src/dsm/elements/data/base.ts +18 -0
- package/src/dsm/elements/data/blur.ts +16 -0
- package/src/dsm/elements/data/border-radius.ts +15 -0
- package/src/dsm/elements/data/border-width.ts +15 -0
- package/src/dsm/elements/data/border.ts +21 -0
- package/src/dsm/elements/data/color.ts +13 -0
- package/src/dsm/elements/data/component.ts +23 -0
- package/src/dsm/elements/data/dimension.ts +15 -0
- package/src/dsm/elements/data/documentation-block-v1.ts +325 -0
- package/src/dsm/elements/data/documentation-block-v2.ts +57 -0
- package/src/dsm/elements/data/documentation-page-v1.ts +13 -0
- package/src/dsm/elements/data/documentation-page-v2.ts +11 -0
- package/src/dsm/elements/data/documentation.ts +8 -0
- package/src/dsm/elements/data/duration.ts +15 -0
- package/src/dsm/elements/data/figma-file-structure.ts +65 -0
- package/src/dsm/elements/data/figma-node-reference.ts +20 -0
- package/src/dsm/elements/data/font-family.ts +8 -0
- package/src/dsm/elements/data/font-size.ts +15 -0
- package/src/dsm/elements/data/font-weight.ts +8 -0
- package/src/dsm/elements/data/gradient.ts +32 -0
- package/src/dsm/elements/data/group.ts +17 -0
- package/src/dsm/elements/data/index.ts +36 -0
- package/src/dsm/elements/data/letter-spacing.ts +15 -0
- package/src/dsm/elements/data/line-height.ts +15 -0
- package/src/dsm/elements/data/opacity.ts +12 -0
- package/src/dsm/elements/data/paragraph-indent.ts +15 -0
- package/src/dsm/elements/data/paragraph-spacing.ts +15 -0
- package/src/dsm/elements/data/product-copy.ts +8 -0
- package/src/dsm/elements/data/shadow.ts +23 -0
- package/src/dsm/elements/data/size.ts +15 -0
- package/src/dsm/elements/data/space.ts +15 -0
- package/src/dsm/elements/data/string.ts +8 -0
- package/src/dsm/elements/data/text-case.ts +10 -0
- package/src/dsm/elements/data/text-decoration.ts +10 -0
- package/src/dsm/elements/data/typography.ts +28 -0
- package/src/dsm/elements/data/visibility.ts +10 -0
- package/src/dsm/elements/data/z-index.ts +15 -0
- package/src/dsm/elements/documentation-page-v1.ts +30 -0
- package/src/dsm/elements/documentation-page-v2.ts +16 -0
- package/src/dsm/elements/figma-file-structures.ts +39 -0
- package/src/dsm/elements/figma-node-reference.ts +17 -0
- package/src/dsm/elements/group.ts +59 -0
- package/src/dsm/elements/index.ts +13 -0
- package/src/dsm/elements/page-block-v2.ts +24 -0
- package/src/dsm/elements/primitives/index.ts +2 -0
- package/src/dsm/elements/primitives/point.ts +8 -0
- package/src/dsm/elements/primitives/size.ts +28 -0
- package/src/dsm/elements/raw-element.ts +126 -0
- package/src/dsm/elements/theme.ts +74 -0
- package/src/dsm/elements/tokens.ts +288 -0
- package/src/dsm/import/asset.ts +6 -0
- package/src/dsm/import/base.ts +24 -0
- package/src/dsm/import/component.ts +36 -0
- package/src/dsm/import/data-source.ts +9 -0
- package/src/dsm/import/figma-frames.ts +74 -0
- package/src/dsm/import/image.ts +72 -0
- package/src/dsm/import/index.ts +11 -0
- package/src/dsm/import/origin.ts +5 -0
- package/src/dsm/import/support/figma-files.ts +16 -0
- package/src/dsm/import/support/import-context.ts +75 -0
- package/src/dsm/import/support/import-model-collections.ts +46 -0
- package/src/dsm/import/support/index.ts +3 -0
- package/src/dsm/import/theme.ts +76 -0
- package/src/dsm/import/tokens.ts +49 -0
- package/src/dsm/import/warning.ts +28 -0
- package/src/dsm/index.ts +15 -0
- package/src/dsm/properties/index.ts +3 -0
- package/src/dsm/properties/property-definition.ts +44 -0
- package/src/dsm/properties/property-reference.ts +5 -0
- package/src/dsm/properties/property-value.ts +27 -0
- package/src/dsm/published-doc-page.ts +25 -0
- package/src/dsm/published-doc.ts +30 -0
- package/src/dsm/reference.ts +9 -0
- package/src/dsm/version.ts +14 -0
- package/src/dsm/views/column.ts +43 -0
- package/src/dsm/views/index.ts +2 -0
- package/src/dsm/views/view.ts +11 -0
- package/src/feature-flags/feature-flags.ts +14 -0
- package/src/feature-flags/index.ts +1 -0
- package/src/helpers/common.ts +1 -0
- package/src/helpers/db.ts +37 -0
- package/src/helpers/index.ts +4 -0
- package/src/helpers/nullish-to-optional.ts +9 -0
- package/src/helpers/slug-helper.ts +641 -0
- package/src/index.ts +16 -0
- package/src/integrations/external-oauth-request.ts +12 -0
- package/src/integrations/index.ts +3 -0
- package/src/integrations/oauth-providers.ts +13 -0
- package/src/integrations/oauth-token.ts +15 -0
- package/src/multiplayer/design-system-version-room.ts +13 -0
- package/src/multiplayer/documentation-page-room.ts +14 -0
- package/src/multiplayer/index.ts +2 -0
- package/src/npm/index.ts +2 -0
- package/src/npm/npm-package.ts +30 -0
- package/src/npm/npm-proxy-token-payload.ts +7 -0
- package/src/tokens/index.ts +1 -0
- package/src/tokens/personal-access-token.ts +17 -0
- package/src/users/index.ts +5 -0
- package/src/users/linked-integrations.ts +36 -0
- package/src/users/user-identity.ts +8 -0
- package/src/users/user-profile.ts +26 -0
- package/src/users/user-with-pat.ts +7 -0
- package/src/users/user.ts +17 -0
- package/src/utils/content-loader-instruction.ts +31 -0
- package/src/utils/index.ts +1 -0
- package/src/workspace/index.ts +9 -0
- package/src/workspace/npm-registry-settings.ts +45 -0
- package/src/workspace/sso-provider.ts +13 -0
- package/src/workspace/user-invite.ts +18 -0
- package/src/workspace/workspace-context.ts +10 -0
- package/src/workspace/workspace-create.ts +27 -0
- package/src/workspace/workspace-invitations.ts +14 -0
- package/src/workspace/workspace-membership.ts +11 -0
- package/src/workspace/workspace-role.ts +6 -0
- package/src/workspace/workspace.ts +48 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const DurationUnit = z.enum(["Ms"]);
|
|
5
|
+
|
|
6
|
+
export const DurationValue = z.object({
|
|
7
|
+
unit: DurationUnit,
|
|
8
|
+
measure: z.number(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const DurationTokenData = tokenAliasOrValue(DurationValue);
|
|
12
|
+
|
|
13
|
+
export type DurationUnit = z.infer<typeof DurationUnit>;
|
|
14
|
+
export type DurationValue = z.infer<typeof DurationValue>;
|
|
15
|
+
export type DurationTokenData = z.infer<typeof DurationTokenData>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ZodTypeDef, z } from "zod";
|
|
2
|
+
import { Size, SizeOrUndefined } from "../primitives/size";
|
|
3
|
+
|
|
4
|
+
export const FigmaFileStructureNodeType = z.enum(["DOCUMENT", "CANVAS", "FRAME", "COMPONENT", "COMPONENT_SET"]);
|
|
5
|
+
|
|
6
|
+
export const FigmaFileStructureNodeBase = z.object({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
name: z.string(),
|
|
9
|
+
type: FigmaFileStructureNodeType,
|
|
10
|
+
size: SizeOrUndefined,
|
|
11
|
+
parentComponentSetId: z.string().optional(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const FigmaFileStructureNode: z.ZodType<FigmaFileStructureNode, ZodTypeDef, FigmaFileStructureNodeBaseInput> =
|
|
15
|
+
FigmaFileStructureNodeBase.extend({
|
|
16
|
+
children: z.lazy(() => FigmaFileStructureNode.array()),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
type FigmaFileStructureNodeBaseInput = z.input<typeof FigmaFileStructureNodeBase> & {
|
|
20
|
+
children: FigmaFileStructureNodeBaseInput[];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const FigmaFileStructureStatistics = z.object({
|
|
24
|
+
frames: z
|
|
25
|
+
.number()
|
|
26
|
+
.nullable()
|
|
27
|
+
.optional()
|
|
28
|
+
.transform(v => v ?? 0),
|
|
29
|
+
components: z
|
|
30
|
+
.number()
|
|
31
|
+
.nullable()
|
|
32
|
+
.optional()
|
|
33
|
+
.transform(v => v ?? 0),
|
|
34
|
+
componentSets: z
|
|
35
|
+
.number()
|
|
36
|
+
.nullable()
|
|
37
|
+
.optional()
|
|
38
|
+
.transform(v => v ?? 0),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const FigmaFileStructureElementData = z.object({
|
|
42
|
+
value: z.object({
|
|
43
|
+
structure: FigmaFileStructureNode,
|
|
44
|
+
assetsInFile: FigmaFileStructureStatistics,
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export type FigmaFileStructureNodeBase = z.infer<typeof FigmaFileStructureNodeBase>;
|
|
49
|
+
export type FigmaFileStructureNodeType = z.infer<typeof FigmaFileStructureStatistics>;
|
|
50
|
+
export type FigmaFileStructureNode = z.infer<typeof FigmaFileStructureNodeBase> & {
|
|
51
|
+
children: FigmaFileStructureNode[];
|
|
52
|
+
};
|
|
53
|
+
export type FigmaFileStructureStatistics = z.infer<typeof FigmaFileStructureStatistics>;
|
|
54
|
+
export type FigmaFileStructureElementData = z.infer<typeof FigmaFileStructureElementData>;
|
|
55
|
+
|
|
56
|
+
export function figmaFileStructureToMap(root: FigmaFileStructureNode): Map<string, FigmaFileStructureNode> {
|
|
57
|
+
const map = new Map<string, FigmaFileStructureNode>();
|
|
58
|
+
recursiveFigmaFileStructureToMap(root, map);
|
|
59
|
+
return map;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function recursiveFigmaFileStructureToMap(node: FigmaFileStructureNode, map: Map<string, FigmaFileStructureNode>) {
|
|
63
|
+
map.set(node.id, node);
|
|
64
|
+
for (const child of node.children) recursiveFigmaFileStructureToMap(child, map);
|
|
65
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const FigmaNodeReferenceData = z.object({
|
|
4
|
+
structureElementId: z.string(),
|
|
5
|
+
nodeId: z.string(),
|
|
6
|
+
fileId: z.string().optional(),
|
|
7
|
+
valid: z.boolean(),
|
|
8
|
+
assetId: z.string().optional(),
|
|
9
|
+
assetScale: z.number().optional(),
|
|
10
|
+
assetWidth: z.number().optional(),
|
|
11
|
+
assetHeight: z.number().optional(),
|
|
12
|
+
assetUrl: z.string().optional(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const FigmaNodeReferenceElementData = z.object({
|
|
16
|
+
value: FigmaNodeReferenceData,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type FigmaNodeReferenceData = z.infer<typeof FigmaNodeReferenceData>;
|
|
20
|
+
export type FigmaNodeReferenceElementData = z.infer<typeof FigmaNodeReferenceElementData>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const FontFamilyValue = z.string();
|
|
5
|
+
export const FontFamilyTokenData = tokenAliasOrValue(FontFamilyValue);
|
|
6
|
+
|
|
7
|
+
export type FontFamilyValue = z.infer<typeof FontFamilyValue>;
|
|
8
|
+
export type FontFamilyTokenData = z.infer<typeof FontFamilyTokenData>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const FontSizeUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
5
|
+
|
|
6
|
+
export const FontSizeValue = z.object({
|
|
7
|
+
unit: FontSizeUnit,
|
|
8
|
+
measure: z.number(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const FontSizeTokenData = tokenAliasOrValue(FontSizeValue);
|
|
12
|
+
|
|
13
|
+
export type FontSizeUnit = z.infer<typeof FontSizeUnit>;
|
|
14
|
+
export type FontSizeValue = z.infer<typeof FontSizeValue>;
|
|
15
|
+
export type FontSizeTokenData = z.infer<typeof FontSizeTokenData>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const FontWeightValue = z.string();
|
|
5
|
+
export const FontWeightTokenData = tokenAliasOrValue(FontWeightValue);
|
|
6
|
+
|
|
7
|
+
export type FontWeightValue = z.infer<typeof FontWeightValue>;
|
|
8
|
+
export type FontWeightTokenData = z.infer<typeof FontWeightTokenData>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ColorTokenData } from "./color";
|
|
3
|
+
import { tokenAliasOrValue } from "./base";
|
|
4
|
+
import { nullishToOptional } from "../../../helpers";
|
|
5
|
+
import { Point2D } from "../primitives";
|
|
6
|
+
|
|
7
|
+
export const GradientType = z.enum(["Linear", "Radial", "Angular"]);
|
|
8
|
+
|
|
9
|
+
export const GradientStop = z.object({
|
|
10
|
+
position: z.number(),
|
|
11
|
+
color: ColorTokenData,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const GradientLayerValue = z.object({
|
|
15
|
+
from: Point2D,
|
|
16
|
+
to: Point2D,
|
|
17
|
+
type: GradientType,
|
|
18
|
+
aspectRatio: nullishToOptional(z.number()), // z.number(),
|
|
19
|
+
stops: z.array(GradientStop).min(2),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const GradientLayerData = tokenAliasOrValue(GradientLayerValue);
|
|
23
|
+
|
|
24
|
+
export const GradientTokenValue = z.array(GradientLayerData);
|
|
25
|
+
export const GradientTokenData = tokenAliasOrValue(GradientTokenValue);
|
|
26
|
+
|
|
27
|
+
export type GradientType = z.infer<typeof GradientType>;
|
|
28
|
+
export type GradientStop = z.infer<typeof GradientStop>;
|
|
29
|
+
export type GradientLayerValue = z.infer<typeof GradientLayerValue>;
|
|
30
|
+
export type GradientLayerData = z.infer<typeof GradientLayerData>;
|
|
31
|
+
export type GradientTokenValue = z.infer<typeof GradientTokenValue>;
|
|
32
|
+
export type GradientTokenData = z.infer<typeof GradientTokenData>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { nullishToOptional } from "../../../helpers";
|
|
3
|
+
import { DocumentationItemConfiguration } from "./documentation";
|
|
4
|
+
|
|
5
|
+
export const DocumentationGroupBehavior = z.enum(["Group", "Tabs"]);
|
|
6
|
+
|
|
7
|
+
export const ElementGroupData = z.object({
|
|
8
|
+
behavior: nullishToOptional(DocumentationGroupBehavior.optional()),
|
|
9
|
+
configuration: nullishToOptional(DocumentationItemConfiguration),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const ElementGroupElementData = z.object({
|
|
13
|
+
value: ElementGroupData.optional(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type DocumentationGroupBehavior = z.infer<typeof DocumentationGroupBehavior>;
|
|
17
|
+
export type ElementGroupData = z.infer<typeof ElementGroupData>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export * from "./base";
|
|
2
|
+
export * from "./blur";
|
|
3
|
+
export * from "./border-radius";
|
|
4
|
+
export * from "./border-width";
|
|
5
|
+
export * from "./border";
|
|
6
|
+
export * from "./color";
|
|
7
|
+
export * from "./component";
|
|
8
|
+
export * from "./dimension";
|
|
9
|
+
export * from "./documentation-block-v1";
|
|
10
|
+
export * from "./documentation-block-v2";
|
|
11
|
+
export * from "./documentation-page-v1";
|
|
12
|
+
export * from "./documentation-page-v2";
|
|
13
|
+
export * from "./documentation";
|
|
14
|
+
export * from "./duration";
|
|
15
|
+
export * from "./figma-file-structure";
|
|
16
|
+
export * from "./figma-node-reference";
|
|
17
|
+
export * from "./font-family";
|
|
18
|
+
export * from "./font-size";
|
|
19
|
+
export * from "./font-weight";
|
|
20
|
+
export * from "./gradient";
|
|
21
|
+
export * from "./group";
|
|
22
|
+
export * from "./letter-spacing";
|
|
23
|
+
export * from "./line-height";
|
|
24
|
+
export * from "./opacity";
|
|
25
|
+
export * from "./paragraph-indent";
|
|
26
|
+
export * from "./paragraph-spacing";
|
|
27
|
+
export * from "./product-copy";
|
|
28
|
+
export * from "./shadow";
|
|
29
|
+
export * from "./size";
|
|
30
|
+
export * from "./space";
|
|
31
|
+
export * from "./string";
|
|
32
|
+
export * from "./text-case";
|
|
33
|
+
export * from "./text-decoration";
|
|
34
|
+
export * from "./typography";
|
|
35
|
+
export * from "./visibility";
|
|
36
|
+
export * from "./z-index";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const LetterSpacingUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
5
|
+
|
|
6
|
+
export const LetterSpacingValue = z.object({
|
|
7
|
+
unit: LetterSpacingUnit,
|
|
8
|
+
measure: z.number(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const LetterSpacingTokenData = tokenAliasOrValue(LetterSpacingValue);
|
|
12
|
+
|
|
13
|
+
export type LetterSpacingUnit = z.infer<typeof LetterSpacingUnit>;
|
|
14
|
+
export type LetterSpacingValue = z.infer<typeof LetterSpacingValue>;
|
|
15
|
+
export type LetterSpacingTokenData = z.infer<typeof LetterSpacingTokenData>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const LineHeightUnit = z.enum(["Pixels", "Rem", "Percent", "Raw"]);
|
|
5
|
+
|
|
6
|
+
export const LineHeightValue = z.object({
|
|
7
|
+
unit: LineHeightUnit,
|
|
8
|
+
measure: z.number(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const LineHeightTokenData = tokenAliasOrValue(LineHeightValue);
|
|
12
|
+
|
|
13
|
+
export type LineHeightUnit = z.infer<typeof LineHeightUnit>;
|
|
14
|
+
export type LineHeightValue = z.infer<typeof LineHeightValue>;
|
|
15
|
+
export type LineHeightTokenData = z.infer<typeof LineHeightTokenData>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const OpacityValue = z.object({
|
|
5
|
+
unit: z.enum(["Raw", "Pixels"]),
|
|
6
|
+
measure: z.number(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const OpacityTokenData = tokenAliasOrValue(OpacityValue);
|
|
10
|
+
|
|
11
|
+
export type OpacityValue = z.infer<typeof OpacityValue>;
|
|
12
|
+
export type OpacityTokenData = z.infer<typeof OpacityTokenData>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const ParagraphIndentUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
5
|
+
|
|
6
|
+
export const ParagraphIndentValue = z.object({
|
|
7
|
+
unit: ParagraphIndentUnit,
|
|
8
|
+
measure: z.number(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const ParagraphIndentTokenData = tokenAliasOrValue(ParagraphIndentValue);
|
|
12
|
+
|
|
13
|
+
export type ParagraphIndentUnit = z.infer<typeof ParagraphIndentUnit>;
|
|
14
|
+
export type ParagraphIndentValue = z.infer<typeof ParagraphIndentValue>;
|
|
15
|
+
export type ParagraphIndentTokenData = z.infer<typeof ParagraphIndentTokenData>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const ParagraphSpacingUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
5
|
+
|
|
6
|
+
export const ParagraphSpacingValue = z.object({
|
|
7
|
+
unit: ParagraphSpacingUnit,
|
|
8
|
+
measure: z.number(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const ParagraphSpacingTokenData = tokenAliasOrValue(ParagraphSpacingValue);
|
|
12
|
+
|
|
13
|
+
export type ParagraphSpacingUnit = z.infer<typeof ParagraphSpacingUnit>;
|
|
14
|
+
export type ParagraphSpacingValue = z.infer<typeof ParagraphSpacingValue>;
|
|
15
|
+
export type ParagraphSpacingTokenData = z.infer<typeof ParagraphSpacingTokenData>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const ProductCopyValue = z.string();
|
|
5
|
+
export const ProductCopyTokenData = tokenAliasOrValue(ProductCopyValue);
|
|
6
|
+
|
|
7
|
+
export type ProductCopyValue = z.infer<typeof ProductCopyValue>;
|
|
8
|
+
export type ProductCopyTokenData = z.infer<typeof ProductCopyTokenData>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ColorTokenData } from "./color";
|
|
3
|
+
import { OpacityTokenData } from "./opacity";
|
|
4
|
+
import { tokenAliasOrValue } from "./base";
|
|
5
|
+
|
|
6
|
+
export const ShadowType = z.enum(["Drop", "Inner"]);
|
|
7
|
+
|
|
8
|
+
export const ShadowLayerValue = z.object({
|
|
9
|
+
color: ColorTokenData,
|
|
10
|
+
x: z.number(),
|
|
11
|
+
y: z.number(),
|
|
12
|
+
radius: z.number(),
|
|
13
|
+
spread: z.number(),
|
|
14
|
+
opacity: OpacityTokenData,
|
|
15
|
+
type: ShadowType,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const ShadowTokenDataBase = tokenAliasOrValue(ShadowLayerValue);
|
|
19
|
+
export const ShadowTokenData = tokenAliasOrValue(z.array(ShadowTokenDataBase));
|
|
20
|
+
|
|
21
|
+
export type ShadowType = z.infer<typeof ShadowType>;
|
|
22
|
+
export type ShadowLayerValue = z.infer<typeof ShadowLayerValue>;
|
|
23
|
+
export type ShadowTokenData = z.infer<typeof ShadowTokenData>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const SizeUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
5
|
+
|
|
6
|
+
export const SizeValue = z.object({
|
|
7
|
+
unit: SizeUnit,
|
|
8
|
+
measure: z.number(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const SizeTokenData = tokenAliasOrValue(SizeValue);
|
|
12
|
+
|
|
13
|
+
export type SizeUnit = z.infer<typeof SizeUnit>;
|
|
14
|
+
export type SizeValue = z.infer<typeof SizeValue>;
|
|
15
|
+
export type SizeTokenData = z.infer<typeof SizeTokenData>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const SpaceUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
5
|
+
|
|
6
|
+
export const SpaceValue = z.object({
|
|
7
|
+
unit: SpaceUnit,
|
|
8
|
+
measure: z.number(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const SpaceTokenData = tokenAliasOrValue(SpaceValue);
|
|
12
|
+
|
|
13
|
+
export type SpaceUnit = z.infer<typeof SpaceUnit>;
|
|
14
|
+
export type SpaceValue = z.infer<typeof SpaceValue>;
|
|
15
|
+
export type SpaceTokenData = z.infer<typeof SpaceTokenData>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const StringValue = z.string();
|
|
5
|
+
export const StringTokenData = tokenAliasOrValue(StringValue);
|
|
6
|
+
|
|
7
|
+
export type StringValue = z.infer<typeof StringValue>;
|
|
8
|
+
export type StringTokenData = z.infer<typeof StringTokenData>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const TextCase = z.enum(["Original", "Upper", "Lower", "Camel", "SmallCaps"]);
|
|
5
|
+
export const TextCaseValue = TextCase;
|
|
6
|
+
export const TextCaseTokenData = tokenAliasOrValue(TextCaseValue);
|
|
7
|
+
|
|
8
|
+
export type TextCase = z.infer<typeof TextCase>;
|
|
9
|
+
export type TextCaseValue = z.infer<typeof TextCaseValue>;
|
|
10
|
+
export type TextCaseTokenData = z.infer<typeof TextCaseTokenData>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const TextDecoration = z.enum(["None", "Underline", "Strikethrough"]);
|
|
5
|
+
export const TextDecorationValue = TextDecoration;
|
|
6
|
+
export const TextDecorationTokenData = tokenAliasOrValue(TextDecorationValue);
|
|
7
|
+
|
|
8
|
+
export type TextDecoration = z.infer<typeof TextDecoration>;
|
|
9
|
+
export type TextDecorationValue = z.infer<typeof TextDecorationValue>;
|
|
10
|
+
export type TextDecorationTokenData = z.infer<typeof TextDecorationTokenData>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { FontSizeTokenData } from "./font-size";
|
|
3
|
+
import { FontFamilyTokenData } from "./font-family";
|
|
4
|
+
import { FontWeightTokenData } from "./font-weight";
|
|
5
|
+
import { TextDecorationTokenData } from "./text-decoration";
|
|
6
|
+
import { TextCaseTokenData } from "./text-case";
|
|
7
|
+
import { LetterSpacingTokenData } from "./letter-spacing";
|
|
8
|
+
import { LineHeightTokenData } from "./line-height";
|
|
9
|
+
import { ParagraphIndentTokenData } from "./paragraph-indent";
|
|
10
|
+
import { ParagraphSpacingTokenData } from "./paragraph-spacing";
|
|
11
|
+
import { tokenAliasOrValue } from "./base";
|
|
12
|
+
|
|
13
|
+
export const TypographyValue = z.object({
|
|
14
|
+
fontSize: FontSizeTokenData,
|
|
15
|
+
fontFamily: FontFamilyTokenData,
|
|
16
|
+
fontWeight: FontWeightTokenData,
|
|
17
|
+
textDecoration: TextDecorationTokenData,
|
|
18
|
+
textCase: TextCaseTokenData,
|
|
19
|
+
letterSpacing: LetterSpacingTokenData.optional(),
|
|
20
|
+
lineHeight: LineHeightTokenData.optional(),
|
|
21
|
+
paragraphIndent: ParagraphIndentTokenData.optional(),
|
|
22
|
+
paragraphSpacing: ParagraphSpacingTokenData.optional(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const TypographyTokenData = tokenAliasOrValue(TypographyValue);
|
|
26
|
+
|
|
27
|
+
export type TypographyValue = z.infer<typeof TypographyValue>;
|
|
28
|
+
export type TypographyTokenData = z.infer<typeof TypographyTokenData>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const Visibility = z.enum(["Hidden", "Visible"]);
|
|
5
|
+
export const VisibilityValue = Visibility;
|
|
6
|
+
export const VisibilityTokenData = tokenAliasOrValue(VisibilityValue);
|
|
7
|
+
|
|
8
|
+
export type Visibility = z.infer<typeof Visibility>;
|
|
9
|
+
export type VisibilityValue = z.infer<typeof VisibilityValue>;
|
|
10
|
+
export type VisibilityTokenData = z.infer<typeof VisibilityTokenData>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tokenAliasOrValue } from "./base";
|
|
3
|
+
|
|
4
|
+
export const ZIndexUnit = z.enum(["Raw"]);
|
|
5
|
+
|
|
6
|
+
export const ZIndexValue = z.object({
|
|
7
|
+
unit: ZIndexUnit,
|
|
8
|
+
measure: z.number(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const ZIndexTokenData = tokenAliasOrValue(ZIndexValue);
|
|
12
|
+
|
|
13
|
+
export type ZIndexUnit = z.infer<typeof ZIndexUnit>;
|
|
14
|
+
export type ZIndexValue = z.infer<typeof ZIndexValue>;
|
|
15
|
+
export type ZIndexTokenData = z.infer<typeof ZIndexTokenData>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { DesignElementBase, DesignElementGroupableRequiredPart, DesignElementSlugPart } from "./base";
|
|
3
|
+
import { DocumentationPageDataV1 } from "./data";
|
|
4
|
+
import { DbCreateInputOmit, DbUpdate, OmitStrict } from "../../helpers";
|
|
5
|
+
|
|
6
|
+
export const DocumentationPageV1 = DesignElementBase.extend(DesignElementGroupableRequiredPart.shape)
|
|
7
|
+
.extend(DesignElementSlugPart.shape)
|
|
8
|
+
.extend({
|
|
9
|
+
shortPersistentId: z.string(),
|
|
10
|
+
data: DocumentationPageDataV1,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type DocumentationPageV1 = z.infer<typeof DocumentationPageV1>;
|
|
14
|
+
|
|
15
|
+
export type CreateDocumentationPageV1 = DbCreateInputOmit<DocumentationPageV1>;
|
|
16
|
+
export type UpdateDocumentationPageV1 = OmitStrict<DbUpdate<DocumentationPageV1>, "designSystemVersionId">;
|
|
17
|
+
|
|
18
|
+
export const DocumentationPageDTOV1 = DocumentationPageV1.omit({
|
|
19
|
+
data: true,
|
|
20
|
+
meta: true,
|
|
21
|
+
parentPersistentId: true,
|
|
22
|
+
sortOrder: true,
|
|
23
|
+
})
|
|
24
|
+
.extend(DocumentationPageV1.shape.data.shape)
|
|
25
|
+
.extend({
|
|
26
|
+
title: z.string(),
|
|
27
|
+
path: z.string(),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type DocumentationPageDTOV1 = z.infer<typeof DocumentationPageDTOV1>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { DesignElementBase, DesignElementGroupableRequiredPart, DesignElementSlugPart } from "./base";
|
|
3
|
+
import { DbCreateInputOmit, DbUpdate, OmitStrict } from "../../helpers";
|
|
4
|
+
import { DocumentationPageDataV2 } from "./data/documentation-page-v2";
|
|
5
|
+
|
|
6
|
+
export const DocumentationPageV2 = DesignElementBase.extend(DesignElementGroupableRequiredPart.shape)
|
|
7
|
+
.extend(DesignElementSlugPart.shape)
|
|
8
|
+
.extend({
|
|
9
|
+
shortPersistentId: z.string(),
|
|
10
|
+
data: DocumentationPageDataV2,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type DocumentationPageV2 = z.infer<typeof DocumentationPageV2>;
|
|
14
|
+
|
|
15
|
+
export type CreateDocumentationPageV2 = DbCreateInputOmit<DocumentationPageV2>;
|
|
16
|
+
export type UpdateDocumentationPageV2 = OmitStrict<DbUpdate<DocumentationPageV2>, "designSystemVersionId">;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { DesignElementBase } from "./base";
|
|
3
|
+
import { FigmaFileStructureNode, FigmaFileStructureStatistics } from "./data/figma-file-structure";
|
|
4
|
+
import { DbCreateInputOmit, DbUpdate, OmitStrict } from "../../helpers";
|
|
5
|
+
|
|
6
|
+
export const FigmaFileStructureOrigin = z.object({
|
|
7
|
+
sourceId: z.string(),
|
|
8
|
+
fileId: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const FigmaFileStructureData = z.object({
|
|
12
|
+
rootNode: FigmaFileStructureNode,
|
|
13
|
+
assetsInFile: FigmaFileStructureStatistics,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const FigmaFileStructure = DesignElementBase.extend({
|
|
17
|
+
origin: FigmaFileStructureOrigin,
|
|
18
|
+
data: FigmaFileStructureData,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type FigmaFileStructureOrigin = z.infer<typeof FigmaFileStructureOrigin>;
|
|
22
|
+
export type FigmaFileStructureData = z.infer<typeof FigmaFileStructureData>;
|
|
23
|
+
export type FigmaFileStructure = z.infer<typeof FigmaFileStructure>;
|
|
24
|
+
|
|
25
|
+
export type CreateFigmaFileStructure = DbCreateInputOmit<FigmaFileStructure>;
|
|
26
|
+
export type UpdateFigmaFileStructure = OmitStrict<DbUpdate<FigmaFileStructure>, "designSystemVersionId">;
|
|
27
|
+
|
|
28
|
+
export type FigmaFileStructureDiff = {
|
|
29
|
+
toCreate: CreateFigmaFileStructure[];
|
|
30
|
+
toUpdate: UpdateFigmaFileStructure[];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export function traverseStructure(node: FigmaFileStructureNode, action: (node: FigmaFileStructureNode) => void) {
|
|
34
|
+
action(node);
|
|
35
|
+
|
|
36
|
+
for (const child of node.children) {
|
|
37
|
+
traverseStructure(child, action);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { DesignElementBase } from "./base";
|
|
3
|
+
import { FigmaNodeReferenceData } from "./data/figma-node-reference";
|
|
4
|
+
import { DbCreateInputOmit, DbUpdate, OmitStrict } from "../../helpers";
|
|
5
|
+
|
|
6
|
+
export const FigmaNodeReference = DesignElementBase.extend({
|
|
7
|
+
data: FigmaNodeReferenceData,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type FigmaNodeReference = z.infer<typeof FigmaNodeReference>;
|
|
11
|
+
|
|
12
|
+
export type CreateFigmaNodeReference = DbCreateInputOmit<FigmaNodeReference>;
|
|
13
|
+
export type UpdateFigmaNodeReference = OmitStrict<DbUpdate<FigmaNodeReference>, "designSystemVersionId">;
|
|
14
|
+
|
|
15
|
+
export type FigmaNodeReferenceDiff = {
|
|
16
|
+
toUpdate: UpdateFigmaNodeReference[];
|
|
17
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { DesignElementType } from "./raw-element";
|
|
2
|
+
import { DesignElementBase, DesignElementBrandedPart, DesignElementGroupablePart, DesignElementSlugPart } from "./base";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { DbCreateInputOmit, DbUpdate } from "../../helpers";
|
|
5
|
+
import { OmitStrict } from "../../helpers";
|
|
6
|
+
import { DocumentationGroupBehavior, ElementGroupData } from "./data";
|
|
7
|
+
import { DocumentationItemConfiguration } from "./data";
|
|
8
|
+
export const ElementGroup = DesignElementBase.extend(DesignElementGroupablePart.shape)
|
|
9
|
+
.extend(DesignElementSlugPart.shape)
|
|
10
|
+
.extend(DesignElementBrandedPart.partial().shape)
|
|
11
|
+
.extend({
|
|
12
|
+
shortPersistentId: z.string().optional(),
|
|
13
|
+
childType: DesignElementType,
|
|
14
|
+
data: ElementGroupData.optional(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const BrandedElementGroup = ElementGroup.extend(DesignElementBrandedPart.shape);
|
|
18
|
+
|
|
19
|
+
export type ElementGroup = z.infer<typeof ElementGroup>;
|
|
20
|
+
export type BrandedElementGroup = z.infer<typeof BrandedElementGroup>;
|
|
21
|
+
|
|
22
|
+
export type CreateElementGroup = OmitStrict<DbCreateInputOmit<ElementGroup>, "parentPersistentId"> & {
|
|
23
|
+
parentPersistentId: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type UpdateElementGroup = DbUpdate<
|
|
27
|
+
OmitStrict<ElementGroup, "brandPersistentId" | "childType" | "designSystemVersionId" | "parentPersistentId"> & {
|
|
28
|
+
parentPersistentId: string;
|
|
29
|
+
}
|
|
30
|
+
>;
|
|
31
|
+
|
|
32
|
+
export type ElementGroupsDiff = {
|
|
33
|
+
toCreate: CreateElementGroup[];
|
|
34
|
+
toUpdate: UpdateElementGroup[];
|
|
35
|
+
toDelete: ElementGroup["id"][];
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//
|
|
39
|
+
// DTO
|
|
40
|
+
//
|
|
41
|
+
|
|
42
|
+
export const DocumentationGroupDTO = ElementGroup.omit({
|
|
43
|
+
sortOrder: true,
|
|
44
|
+
parentPersistentId: true,
|
|
45
|
+
brandPersistentId: true,
|
|
46
|
+
meta: true,
|
|
47
|
+
childType: true,
|
|
48
|
+
data: true,
|
|
49
|
+
shortPersistentId: true,
|
|
50
|
+
}).extend({
|
|
51
|
+
title: z.string(),
|
|
52
|
+
isRoot: z.boolean(),
|
|
53
|
+
childrenIds: z.array(z.string()),
|
|
54
|
+
groupBehavior: DocumentationGroupBehavior,
|
|
55
|
+
configuration: DocumentationItemConfiguration,
|
|
56
|
+
shortPersistentId: z.string(),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export type DocumentationGroupDTO = z.infer<typeof DocumentationGroupDTO>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./data";
|
|
2
|
+
export * from "./primitives";
|
|
3
|
+
export * from "./base";
|
|
4
|
+
export * from "./component";
|
|
5
|
+
export * from "./documentation-page-v1";
|
|
6
|
+
export * from "./documentation-page-v2";
|
|
7
|
+
export * from "./figma-file-structures";
|
|
8
|
+
export * from "./figma-node-reference";
|
|
9
|
+
export * from "./group";
|
|
10
|
+
export * from "./page-block-v2";
|
|
11
|
+
export * from "./raw-element";
|
|
12
|
+
export * from "./theme";
|
|
13
|
+
export * from "./tokens";
|