@supernova-studio/model 1.0.0 → 1.0.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 +26740 -18977
- package/dist/index.d.ts +26740 -18977
- package/dist/index.js +275 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2201 -1973
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -4
- package/src/asset-delete-schedule/asset-delete-schedule.ts +0 -20
- package/src/asset-delete-schedule/index.ts +0 -1
- package/src/auth/index.ts +0 -1
- package/src/auth/plugin-oauth-request.ts +0 -14
- package/src/billing/card.ts +0 -12
- package/src/billing/checkoutSession.ts +0 -16
- package/src/billing/customer.ts +0 -29
- package/src/billing/features.ts +0 -48
- package/src/billing/index.ts +0 -9
- package/src/billing/invoice.ts +0 -34
- package/src/billing/portalSession.ts +0 -19
- package/src/billing/price.ts +0 -24
- package/src/billing/product.ts +0 -5
- package/src/billing/subscription.ts +0 -65
- package/src/common/entity.ts +0 -9
- package/src/common/index.ts +0 -2
- package/src/common/object-meta.ts +0 -8
- package/src/custom-domains/custom-domains.ts +0 -24
- package/src/custom-domains/index.ts +0 -1
- package/src/data-dumps/code-integration-dump.ts +0 -19
- package/src/data-dumps/design-system-dump.ts +0 -16
- package/src/data-dumps/design-system-version-dump.ts +0 -45
- package/src/data-dumps/index.ts +0 -6
- package/src/data-dumps/published-docs-dump.ts +0 -10
- package/src/data-dumps/user-data-dump.ts +0 -10
- package/src/data-dumps/workspace-dump.ts +0 -14
- package/src/docs-server/index.ts +0 -1
- package/src/docs-server/session.ts +0 -39
- package/src/dsm/assets/asset-dynamo-record.ts +0 -10
- package/src/dsm/assets/asset-reference.ts +0 -18
- package/src/dsm/assets/asset-value.ts +0 -3
- package/src/dsm/assets/asset.ts +0 -60
- package/src/dsm/assets/index.ts +0 -4
- package/src/dsm/brand.ts +0 -13
- package/src/dsm/collection.ts +0 -51
- package/src/dsm/components/asset-rendering.ts +0 -22
- package/src/dsm/components/index.ts +0 -1
- package/src/dsm/data-sources/data-source.ts +0 -167
- package/src/dsm/data-sources/import-job.ts +0 -30
- package/src/dsm/data-sources/import-summary.ts +0 -70
- package/src/dsm/data-sources/index.ts +0 -3
- package/src/dsm/design-system.ts +0 -47
- package/src/dsm/documentation/approvals/approval-state.ts +0 -4
- package/src/dsm/documentation/approvals/approval.ts +0 -18
- package/src/dsm/documentation/approvals/index.ts +0 -2
- package/src/dsm/documentation/block-definitions/aux.ts +0 -10
- package/src/dsm/documentation/block-definitions/definition.ts +0 -76
- package/src/dsm/documentation/block-definitions/index.ts +0 -4
- package/src/dsm/documentation/block-definitions/item.ts +0 -233
- package/src/dsm/documentation/block-definitions/variant.ts +0 -49
- package/src/dsm/documentation/group.ts +0 -19
- package/src/dsm/documentation/index.ts +0 -10
- package/src/dsm/documentation/link-preview.ts +0 -10
- package/src/dsm/documentation/page-anchor.ts +0 -9
- package/src/dsm/documentation/page-content-backup.ts +0 -13
- package/src/dsm/documentation/page-content.ts +0 -32
- package/src/dsm/documentation/page.ts +0 -18
- package/src/dsm/documentation/settings.ts +0 -18
- package/src/dsm/documentation/thread.ts +0 -35
- package/src/dsm/element-snapshots/base.ts +0 -34
- package/src/dsm/element-snapshots/documentation-page-snapshot.ts +0 -29
- package/src/dsm/element-snapshots/group-snapshot.ts +0 -27
- package/src/dsm/element-snapshots/index.ts +0 -3
- package/src/dsm/elements/base.ts +0 -49
- package/src/dsm/elements/component-properties.ts +0 -63
- package/src/dsm/elements/data/base.ts +0 -18
- package/src/dsm/elements/data/blur.ts +0 -16
- package/src/dsm/elements/data/border-radius.ts +0 -16
- package/src/dsm/elements/data/border-width.ts +0 -16
- package/src/dsm/elements/data/border.ts +0 -21
- package/src/dsm/elements/data/color.ts +0 -13
- package/src/dsm/elements/data/component.ts +0 -30
- package/src/dsm/elements/data/dimension.ts +0 -15
- package/src/dsm/elements/data/documentation-block-v1.ts +0 -498
- package/src/dsm/elements/data/documentation-block-v2.ts +0 -429
- package/src/dsm/elements/data/documentation-page-v1.ts +0 -9
- package/src/dsm/elements/data/documentation-page-v2.ts +0 -7
- package/src/dsm/elements/data/documentation-section-v2.ts +0 -47
- package/src/dsm/elements/data/documentation-v1.ts +0 -16
- package/src/dsm/elements/data/documentation-v2.ts +0 -18
- package/src/dsm/elements/data/duration.ts +0 -16
- package/src/dsm/elements/data/figma-file-structure.ts +0 -65
- package/src/dsm/elements/data/figma-node-reference.ts +0 -27
- package/src/dsm/elements/data/font-family.ts +0 -8
- package/src/dsm/elements/data/font-size.ts +0 -16
- package/src/dsm/elements/data/font-weight.ts +0 -8
- package/src/dsm/elements/data/font.ts +0 -9
- package/src/dsm/elements/data/gradient.ts +0 -32
- package/src/dsm/elements/data/group.ts +0 -20
- package/src/dsm/elements/data/index.ts +0 -43
- package/src/dsm/elements/data/item-header-v1.ts +0 -35
- package/src/dsm/elements/data/item-header-v2.ts +0 -34
- package/src/dsm/elements/data/item-header.ts +0 -14
- package/src/dsm/elements/data/letter-spacing.ts +0 -16
- package/src/dsm/elements/data/line-height.ts +0 -16
- package/src/dsm/elements/data/opacity.ts +0 -13
- package/src/dsm/elements/data/paragraph-indent.ts +0 -16
- package/src/dsm/elements/data/paragraph-spacing.ts +0 -16
- package/src/dsm/elements/data/product-copy.ts +0 -8
- package/src/dsm/elements/data/safe-id.ts +0 -13
- package/src/dsm/elements/data/shadow.ts +0 -23
- package/src/dsm/elements/data/size.ts +0 -16
- package/src/dsm/elements/data/space.ts +0 -16
- package/src/dsm/elements/data/string.ts +0 -8
- package/src/dsm/elements/data/text-case.ts +0 -10
- package/src/dsm/elements/data/text-decoration.ts +0 -10
- package/src/dsm/elements/data/typography.ts +0 -28
- package/src/dsm/elements/data/visibility.ts +0 -10
- package/src/dsm/elements/data/z-index.ts +0 -16
- package/src/dsm/elements/documentation-page-v1.ts +0 -34
- package/src/dsm/elements/documentation-page-v2.ts +0 -21
- package/src/dsm/elements/figma-component.ts +0 -67
- package/src/dsm/elements/figma-file-structures.ts +0 -40
- package/src/dsm/elements/figma-node-reference.ts +0 -25
- package/src/dsm/elements/group.ts +0 -40
- package/src/dsm/elements/index.ts +0 -15
- package/src/dsm/elements/page-block-v2.ts +0 -25
- package/src/dsm/elements/primitives/index.ts +0 -2
- package/src/dsm/elements/primitives/point.ts +0 -8
- package/src/dsm/elements/primitives/size.ts +0 -28
- package/src/dsm/elements/raw-element.ts +0 -164
- package/src/dsm/elements/theme.ts +0 -76
- package/src/dsm/elements/tokens.ts +0 -311
- package/src/dsm/elements/utils.ts +0 -114
- package/src/dsm/exporter-property-values-collection.ts +0 -31
- package/src/dsm/import/asset.ts +0 -6
- package/src/dsm/import/base.ts +0 -24
- package/src/dsm/import/collection.ts +0 -16
- package/src/dsm/import/component.ts +0 -40
- package/src/dsm/import/data-source.ts +0 -9
- package/src/dsm/import/figma-frames.ts +0 -74
- package/src/dsm/import/image.ts +0 -87
- package/src/dsm/import/index.ts +0 -12
- package/src/dsm/import/origin.ts +0 -5
- package/src/dsm/import/support/figma-files.ts +0 -19
- package/src/dsm/import/support/import-context.ts +0 -94
- package/src/dsm/import/support/import-model-collections.ts +0 -50
- package/src/dsm/import/support/index.ts +0 -3
- package/src/dsm/import/theme.ts +0 -76
- package/src/dsm/import/tokens.ts +0 -50
- package/src/dsm/import/warning.ts +0 -38
- package/src/dsm/index.ts +0 -19
- package/src/dsm/membership/additions.ts +0 -13
- package/src/dsm/membership/design-system-membership.ts +0 -92
- package/src/dsm/membership/ds-role.ts +0 -28
- package/src/dsm/membership/index.ts +0 -4
- package/src/dsm/membership/invitations.ts +0 -21
- package/src/dsm/properties/index.ts +0 -3
- package/src/dsm/properties/property-definition.ts +0 -57
- package/src/dsm/properties/property-reference.ts +0 -5
- package/src/dsm/properties/property-value.ts +0 -29
- package/src/dsm/published-doc-page-visits.ts +0 -15
- package/src/dsm/published-doc-page.ts +0 -37
- package/src/dsm/published-doc.ts +0 -32
- package/src/dsm/reference.ts +0 -9
- package/src/dsm/version.ts +0 -41
- package/src/dsm/views/column.ts +0 -58
- package/src/dsm/views/index.ts +0 -2
- package/src/dsm/views/view.ts +0 -19
- package/src/emails/design-system-invite.ts +0 -31
- package/src/emails/index.ts +0 -2
- package/src/emails/workspace-invite.ts +0 -29
- package/src/events/base.ts +0 -7
- package/src/events/data-source-imported.ts +0 -9
- package/src/events/index.ts +0 -3
- package/src/events/version-released.ts +0 -10
- package/src/export/export-destinations.ts +0 -127
- package/src/export/export-jobs.ts +0 -122
- package/src/export/export-runner/export-context.ts +0 -34
- package/src/export/export-runner/exporter-payload.ts +0 -10
- package/src/export/export-runner/index.ts +0 -2
- package/src/export/exporter-workspace-membership-role.ts +0 -4
- package/src/export/exporter-workspace-membership.ts +0 -14
- package/src/export/exporter.ts +0 -55
- package/src/export/git-providers.ts +0 -11
- package/src/export/index.ts +0 -9
- package/src/export/pipeline.ts +0 -34
- package/src/export/pulsar.ts +0 -71
- package/src/feature-flags/feature-flags.ts +0 -21
- package/src/feature-flags/index.ts +0 -1
- package/src/helpers/db.ts +0 -82
- package/src/helpers/index.ts +0 -2
- package/src/helpers/nullish-to-optional.ts +0 -9
- package/src/index.ts +0 -20
- package/src/integrations/external-oauth-request.ts +0 -12
- package/src/integrations/git.ts +0 -49
- package/src/integrations/index.ts +0 -6
- package/src/integrations/integration.ts +0 -143
- package/src/integrations/oauth-providers.ts +0 -13
- package/src/integrations/oauth-token.ts +0 -16
- package/src/integrations/workspace-oauth-requests.ts +0 -12
- package/src/liveblocks/index.ts +0 -1
- package/src/liveblocks/rooms/design-system-version-room.ts +0 -62
- package/src/liveblocks/rooms/documentation-page-room.ts +0 -65
- package/src/liveblocks/rooms/index.ts +0 -4
- package/src/liveblocks/rooms/room-type.ts +0 -12
- package/src/liveblocks/rooms/workspace-room.ts +0 -16
- package/src/npm/index.ts +0 -2
- package/src/npm/npm-package.ts +0 -30
- package/src/npm/npm-proxy-token-payload.ts +0 -7
- package/src/tokens/index.ts +0 -1
- package/src/tokens/personal-access-token.ts +0 -25
- package/src/users/index.ts +0 -9
- package/src/users/linked-integrations.ts +0 -36
- package/src/users/user-analytics-cleanup-schedule.ts +0 -15
- package/src/users/user-identity.ts +0 -8
- package/src/users/user-minified.ts +0 -10
- package/src/users/user-notification-settings.ts +0 -18
- package/src/users/user-profile.ts +0 -41
- package/src/users/user-test.ts +0 -8
- package/src/users/user-with-pat.ts +0 -7
- package/src/users/user.ts +0 -21
- package/src/utils/common.ts +0 -172
- package/src/utils/content-loader-instruction.ts +0 -31
- package/src/utils/errors.ts +0 -120
- package/src/utils/index.ts +0 -6
- package/src/utils/naming.ts +0 -73
- package/src/utils/slugify.ts +0 -636
- package/src/utils/validation.ts +0 -4
- package/src/workspace/index.ts +0 -10
- package/src/workspace/npm-registry-settings.ts +0 -45
- package/src/workspace/sso-provider.ts +0 -13
- package/src/workspace/user-invite.ts +0 -18
- package/src/workspace/workspace-configuration.ts +0 -14
- package/src/workspace/workspace-context.ts +0 -13
- package/src/workspace/workspace-create.ts +0 -25
- package/src/workspace/workspace-invitations.ts +0 -22
- package/src/workspace/workspace-membership.ts +0 -31
- package/src/workspace/workspace-role.ts +0 -6
- package/src/workspace/workspace.ts +0 -62
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ZodSchema, ZodTypeDef, z } from "zod";
|
|
2
|
-
|
|
3
|
-
export const TokenDataAliasSchema = z.object({
|
|
4
|
-
aliasTo: z
|
|
5
|
-
.string()
|
|
6
|
-
.optional()
|
|
7
|
-
.nullable()
|
|
8
|
-
.transform(v => v ?? undefined),
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export function tokenAliasOrValue<I, O>(value: ZodSchema<I, ZodTypeDef, O>) {
|
|
12
|
-
return TokenDataAliasSchema.extend({
|
|
13
|
-
value: value
|
|
14
|
-
.optional()
|
|
15
|
-
.nullable()
|
|
16
|
-
.transform(v => (v ?? undefined) as z.output<typeof value> | undefined),
|
|
17
|
-
});
|
|
18
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { tokenAliasOrValue } from "./base";
|
|
3
|
-
import { DimensionTokenData } from "./dimension";
|
|
4
|
-
|
|
5
|
-
export const BlurType = z.enum(["Layer", "Background"]);
|
|
6
|
-
|
|
7
|
-
export const BlurValue = z.object({
|
|
8
|
-
type: BlurType,
|
|
9
|
-
radius: DimensionTokenData,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export const BlurTokenData = tokenAliasOrValue(BlurValue);
|
|
13
|
-
|
|
14
|
-
export type BlurType = z.infer<typeof BlurType>;
|
|
15
|
-
export type BlurValue = z.infer<typeof BlurValue>;
|
|
16
|
-
export type BlurTokenData = z.infer<typeof BlurTokenData>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { tokenAliasOrValue } from "./base";
|
|
3
|
-
import { DimensionUnit } from "./dimension";
|
|
4
|
-
|
|
5
|
-
export const BorderRadiusUnit = z.enum(["Pixels", "Rem", "Percent"]);
|
|
6
|
-
|
|
7
|
-
export const BorderRadiusValue = z.object({
|
|
8
|
-
unit: DimensionUnit,
|
|
9
|
-
measure: z.number(),
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export const BorderRadiusTokenData = tokenAliasOrValue(BorderRadiusValue);
|
|
13
|
-
|
|
14
|
-
export type BorderRadiusUnit = z.infer<typeof BorderRadiusUnit>;
|
|
15
|
-
export type BorderRadiusValue = z.infer<typeof BorderRadiusValue>;
|
|
16
|
-
export type BorderRadiusTokenData = z.infer<typeof BorderRadiusTokenData>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { tokenAliasOrValue } from "./base";
|
|
3
|
-
import { DimensionUnit } from "./dimension";
|
|
4
|
-
|
|
5
|
-
export const BorderWidthUnit = z.enum(["Pixels"]);
|
|
6
|
-
|
|
7
|
-
export const BorderWidthValue = z.object({
|
|
8
|
-
unit: DimensionUnit,
|
|
9
|
-
measure: z.number(),
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export const BorderWidthTokenData = tokenAliasOrValue(BorderWidthValue);
|
|
13
|
-
|
|
14
|
-
export type BorderWidthUnit = z.infer<typeof BorderWidthUnit>;
|
|
15
|
-
export type BorderWidthValue = z.infer<typeof BorderWidthValue>;
|
|
16
|
-
export type BorderWidthTokenData = z.infer<typeof BorderWidthTokenData>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { ColorTokenData } from "./color";
|
|
3
|
-
import { BorderWidthTokenData } from "./border-width";
|
|
4
|
-
import { tokenAliasOrValue } from "./base";
|
|
5
|
-
|
|
6
|
-
export const BorderPosition = z.enum(["Inside", "Center", "Outside"]);
|
|
7
|
-
export const BorderStyle = z.enum(["Dashed", "Dotted", "Solid", "Groove"]);
|
|
8
|
-
|
|
9
|
-
export const BorderValue = z.object({
|
|
10
|
-
color: ColorTokenData,
|
|
11
|
-
width: BorderWidthTokenData,
|
|
12
|
-
position: BorderPosition,
|
|
13
|
-
style: BorderStyle.optional(),
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export const BorderTokenData = tokenAliasOrValue(BorderValue);
|
|
17
|
-
|
|
18
|
-
export type BorderPosition = z.infer<typeof BorderPosition>;
|
|
19
|
-
export type BorderStyle = z.infer<typeof BorderStyle>;
|
|
20
|
-
export type BorderValue = z.infer<typeof BorderValue>;
|
|
21
|
-
export type BorderTokenData = z.infer<typeof BorderTokenData>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { TokenDataAliasSchema, tokenAliasOrValue } from "./base";
|
|
3
|
-
import { OpacityTokenData } from "./opacity";
|
|
4
|
-
|
|
5
|
-
export const ColorValue = z.object({
|
|
6
|
-
opacity: OpacityTokenData,
|
|
7
|
-
color: z.string().or(TokenDataAliasSchema),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export const ColorTokenData = tokenAliasOrValue(ColorValue);
|
|
11
|
-
|
|
12
|
-
export type ColorValue = z.infer<typeof ColorValue>;
|
|
13
|
-
export type ColorTokenData = z.infer<typeof ColorTokenData>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { nullishToOptional } from "../../../helpers/nullish-to-optional";
|
|
3
|
-
import { FigmaComponentPropertyMap } from "../component-properties";
|
|
4
|
-
|
|
5
|
-
export const ComponentElementData = z.object({
|
|
6
|
-
value: z.object({
|
|
7
|
-
thumbnailImage: z.object({
|
|
8
|
-
value: z.object({
|
|
9
|
-
url: z.string(),
|
|
10
|
-
assetId: z.string(),
|
|
11
|
-
}),
|
|
12
|
-
}),
|
|
13
|
-
|
|
14
|
-
svg: z
|
|
15
|
-
.object({
|
|
16
|
-
value: z.object({
|
|
17
|
-
url: z.string(),
|
|
18
|
-
assetId: z.string(),
|
|
19
|
-
}),
|
|
20
|
-
})
|
|
21
|
-
.optional(),
|
|
22
|
-
|
|
23
|
-
parentComponentPersistentId: nullishToOptional(z.string()),
|
|
24
|
-
componentPropertyDefinitions: nullishToOptional(FigmaComponentPropertyMap),
|
|
25
|
-
variantPropertyValues: nullishToOptional(z.record(z.string())),
|
|
26
|
-
renderNodeId: nullishToOptional(z.string()),
|
|
27
|
-
}),
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
export type ComponentElementData = z.infer<typeof ComponentElementData>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { tokenAliasOrValue } from "./base";
|
|
3
|
-
|
|
4
|
-
export const DimensionUnit = z.enum(["Pixels", "Percent", "Rem", "Ms", "Raw", "Points"]);
|
|
5
|
-
|
|
6
|
-
export const DimensionValue = z.object({
|
|
7
|
-
unit: DimensionUnit,
|
|
8
|
-
measure: z.number(),
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export const DimensionTokenData = tokenAliasOrValue(DimensionValue);
|
|
12
|
-
|
|
13
|
-
export type DimensionUnit = z.infer<typeof DimensionUnit>;
|
|
14
|
-
export type DimensionValue = z.infer<typeof DimensionValue>;
|
|
15
|
-
export type DimensionTokenData = z.infer<typeof DimensionTokenData>;
|
|
@@ -1,498 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { nullishToOptional } from "../../../helpers";
|
|
3
|
-
import { areShallowObjectsEqual, mapByUnique } from "../../../utils";
|
|
4
|
-
import { ColorTokenInlineData } from "../../properties";
|
|
5
|
-
import { Size } from "../primitives";
|
|
6
|
-
import { DesignTokenType } from "../raw-element";
|
|
7
|
-
import { DimensionTokenData } from "./dimension";
|
|
8
|
-
|
|
9
|
-
//
|
|
10
|
-
// Enums
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
export const PageBlockCalloutType = z.enum(["Info", "Primary", "Success", "Warning", "Error"]);
|
|
14
|
-
|
|
15
|
-
export const PageBlockTypeV1 = z.enum([
|
|
16
|
-
"Text",
|
|
17
|
-
"Heading",
|
|
18
|
-
"Code",
|
|
19
|
-
"UnorderedList",
|
|
20
|
-
"OrderedList",
|
|
21
|
-
"Quote",
|
|
22
|
-
"Callout",
|
|
23
|
-
"Divider",
|
|
24
|
-
"Image",
|
|
25
|
-
"Embed",
|
|
26
|
-
"Link",
|
|
27
|
-
"Shortcuts",
|
|
28
|
-
"FigmaEmbed",
|
|
29
|
-
"YoutubeEmbed",
|
|
30
|
-
"StorybookEmbed",
|
|
31
|
-
"Token",
|
|
32
|
-
"TokenGroup",
|
|
33
|
-
"TokenList",
|
|
34
|
-
"Component",
|
|
35
|
-
"ComponentGroup",
|
|
36
|
-
"Theme",
|
|
37
|
-
"ComponentSandbox",
|
|
38
|
-
"Custom",
|
|
39
|
-
"FigmaFrames",
|
|
40
|
-
"ComponentAssets",
|
|
41
|
-
"ComponentAssetGroup",
|
|
42
|
-
"RenderCode",
|
|
43
|
-
"Tabs",
|
|
44
|
-
"TabItem",
|
|
45
|
-
"Table",
|
|
46
|
-
"TableRow",
|
|
47
|
-
"TableCell",
|
|
48
|
-
"Guidelines",
|
|
49
|
-
"Guideline",
|
|
50
|
-
"FigmaComponents",
|
|
51
|
-
"FigmaComponentPropsTable",
|
|
52
|
-
]);
|
|
53
|
-
|
|
54
|
-
export const PageBlockCodeLanguage = z.enum([
|
|
55
|
-
"Angular",
|
|
56
|
-
"Bash",
|
|
57
|
-
"C",
|
|
58
|
-
"Cpp",
|
|
59
|
-
"Csharp",
|
|
60
|
-
"CSS",
|
|
61
|
-
"Dart",
|
|
62
|
-
"Handlebars",
|
|
63
|
-
"HTML",
|
|
64
|
-
"Java",
|
|
65
|
-
"Javascript",
|
|
66
|
-
"JSON",
|
|
67
|
-
"ReactJSX",
|
|
68
|
-
"ReactTSX",
|
|
69
|
-
"Kotlin",
|
|
70
|
-
"Lua",
|
|
71
|
-
"Markdown",
|
|
72
|
-
"ObjectiveC",
|
|
73
|
-
"PHP",
|
|
74
|
-
"Plain",
|
|
75
|
-
"Python",
|
|
76
|
-
"Ruby",
|
|
77
|
-
"Rust",
|
|
78
|
-
"Sass",
|
|
79
|
-
"SCSS",
|
|
80
|
-
"Svetle",
|
|
81
|
-
"Swift",
|
|
82
|
-
"Twig",
|
|
83
|
-
"Typescript",
|
|
84
|
-
"Vue",
|
|
85
|
-
"XML",
|
|
86
|
-
"YAML",
|
|
87
|
-
]);
|
|
88
|
-
|
|
89
|
-
export const PageBlockAlignment = z.enum(["Left", "Center", "Stretch", "Right"]);
|
|
90
|
-
export const PageBlockThemeType = z.enum(["Override", "Comparison"]);
|
|
91
|
-
export const PageBlockAssetType = z.enum(["image", "figmaFrame"]);
|
|
92
|
-
|
|
93
|
-
export const PageBlockTilesAlignment = z.enum(["Center", "FrameHeight"]);
|
|
94
|
-
|
|
95
|
-
export const PageBlockTilesLayout = z.enum(["C8", "C7", "C6", "C5", "C4", "C3", "C2", "C1", "C1_75"]);
|
|
96
|
-
|
|
97
|
-
//
|
|
98
|
-
// Support types
|
|
99
|
-
//
|
|
100
|
-
|
|
101
|
-
export const PageBlockTheme = z.object({
|
|
102
|
-
themeIds: z.array(z.string()),
|
|
103
|
-
type: PageBlockThemeType,
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
export const PageBlockSwatch = z.object({
|
|
107
|
-
id: z.string(),
|
|
108
|
-
selectedThemeIds: z.string().array(),
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
export const PageBlockUrlPreview = z.object({
|
|
112
|
-
title: nullishToOptional(z.string()),
|
|
113
|
-
description: nullishToOptional(z.string()),
|
|
114
|
-
thumbnailUrl: nullishToOptional(z.string()),
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
export const PageBlockFrameOrigin = z.object({
|
|
118
|
-
sourceFileName: nullishToOptional(z.string()),
|
|
119
|
-
title: nullishToOptional(z.string()),
|
|
120
|
-
previewUrl: nullishToOptional(z.string()),
|
|
121
|
-
valid: nullishToOptional(z.boolean()),
|
|
122
|
-
referenceId: nullishToOptional(z.string()),
|
|
123
|
-
assetId: nullishToOptional(z.string()),
|
|
124
|
-
assetScale: nullishToOptional(z.number()),
|
|
125
|
-
width: nullishToOptional(z.number()),
|
|
126
|
-
height: nullishToOptional(z.number()),
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
export const PageBlockFrame = z.object({
|
|
130
|
-
persistentId: z.string(),
|
|
131
|
-
sourceId: z.string(),
|
|
132
|
-
sourceFrameId: z.string(),
|
|
133
|
-
title: nullishToOptional(z.string()),
|
|
134
|
-
description: nullishToOptional(z.string()),
|
|
135
|
-
backgroundColor: nullishToOptional(ColorTokenInlineData),
|
|
136
|
-
origin: nullishToOptional(PageBlockFrameOrigin),
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
export const PageBlockAsset = z.object({
|
|
140
|
-
type: PageBlockAssetType,
|
|
141
|
-
id: nullishToOptional(z.string()),
|
|
142
|
-
url: nullishToOptional(z.string()),
|
|
143
|
-
figmaFrame: nullishToOptional(PageBlockFrame),
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
export const PageBlockLinkPreview = z.object({
|
|
147
|
-
title: nullishToOptional(z.string()),
|
|
148
|
-
valid: nullishToOptional(z.boolean()),
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
export const PageBlockShortcut = z.object({
|
|
152
|
-
persistentId: z.string(),
|
|
153
|
-
title: nullishToOptional(z.string()),
|
|
154
|
-
description: nullishToOptional(z.string()),
|
|
155
|
-
asset: nullishToOptional(PageBlockAsset),
|
|
156
|
-
documentationItemId: nullishToOptional(z.string()),
|
|
157
|
-
pageHeadingId: nullishToOptional(z.string()),
|
|
158
|
-
url: nullishToOptional(z.string()),
|
|
159
|
-
openInNewTab: nullishToOptional(z.boolean()),
|
|
160
|
-
urlPreview: nullishToOptional(PageBlockUrlPreview),
|
|
161
|
-
documentationItemPreview: nullishToOptional(PageBlockLinkPreview),
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
export const PageBlockCustomBlockPropertyImageValue = z.object({
|
|
165
|
-
asset: nullishToOptional(PageBlockAsset),
|
|
166
|
-
assetId: nullishToOptional(z.string()),
|
|
167
|
-
assetUrl: nullishToOptional(z.string()),
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
export const PageBlockCustomBlockPropertyValue = z.object({
|
|
171
|
-
key: z.string(),
|
|
172
|
-
value: z.any(),
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
export const PageBlockFigmaFrameProperties = z.object({
|
|
176
|
-
color: nullishToOptional(
|
|
177
|
-
z.object({
|
|
178
|
-
value: z.string(),
|
|
179
|
-
})
|
|
180
|
-
),
|
|
181
|
-
alignment: PageBlockTilesAlignment,
|
|
182
|
-
layout: PageBlockTilesLayout,
|
|
183
|
-
backgroundColor: nullishToOptional(ColorTokenInlineData),
|
|
184
|
-
showTitles: z.boolean(),
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
export const PageBlockRenderCodeProperties = z.object({
|
|
188
|
-
showCode: z.boolean(),
|
|
189
|
-
showControls: z.boolean().optional(),
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
export const PageBlockAssetComponent = z.object({
|
|
193
|
-
persistentId: z.string(),
|
|
194
|
-
componentAssetId: z.string(),
|
|
195
|
-
title: nullishToOptional(z.string()),
|
|
196
|
-
description: nullishToOptional(z.string()),
|
|
197
|
-
backgroundColor: nullishToOptional(ColorTokenInlineData),
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
export const PageBlockTableColumn = z.object({
|
|
201
|
-
id: z.string(),
|
|
202
|
-
width: DimensionTokenData,
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
export const PageBlockTableProperties = z.object({
|
|
206
|
-
showBorders: z.boolean(),
|
|
207
|
-
showHeaderRow: z.boolean(),
|
|
208
|
-
showHeaderColumn: z.boolean(),
|
|
209
|
-
columns: z.array(PageBlockTableColumn),
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
export const PageBlockFigmaComponentBlockConfig = z.object({
|
|
213
|
-
showComponentName: nullishToOptional(z.boolean()),
|
|
214
|
-
showComponentDescription: nullishToOptional(z.boolean()),
|
|
215
|
-
showPropertyList: nullishToOptional(z.boolean()),
|
|
216
|
-
previewOrderIds: nullishToOptional(z.array(z.string())),
|
|
217
|
-
previewContainerSize: nullishToOptional(z.enum(["Centered", "NaturalHeight"])),
|
|
218
|
-
backgroundColor: nullishToOptional(ColorTokenInlineData),
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
export const PageBlockSelectedFigmaComponent = z.object({
|
|
222
|
-
figmaComponentId: z.string(),
|
|
223
|
-
selectedComponentProperties: z.string().array(),
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
//
|
|
227
|
-
// Rich text
|
|
228
|
-
//
|
|
229
|
-
|
|
230
|
-
export const PageBlockTextSpanAttributeType = z.enum(["Bold", "Italic", "Link", "Strikethrough", "Code", "Comment"]);
|
|
231
|
-
|
|
232
|
-
export const PageBlockTextSpanAttribute = z.object({
|
|
233
|
-
type: PageBlockTextSpanAttributeType,
|
|
234
|
-
|
|
235
|
-
// Link attributes
|
|
236
|
-
link: nullishToOptional(z.string()),
|
|
237
|
-
documentationItemId: nullishToOptional(z.string()),
|
|
238
|
-
openInNewWindow: nullishToOptional(z.boolean()), // deprecated. use openInNewTab
|
|
239
|
-
openInNewTab: nullishToOptional(z.boolean()),
|
|
240
|
-
|
|
241
|
-
// Comment attributes
|
|
242
|
-
commentHighlightId: nullishToOptional(z.string()),
|
|
243
|
-
commentIsResolved: nullishToOptional(z.boolean()),
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
export const PageBlockTextSpan = z.object({
|
|
247
|
-
text: z.string(),
|
|
248
|
-
attributes: z.array(PageBlockTextSpanAttribute),
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
export const PageBlockText = z.object({
|
|
252
|
-
spans: z.array(PageBlockTextSpan),
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
export const PageBlockGuideline = z.object({
|
|
256
|
-
description: nullishToOptional(z.string()),
|
|
257
|
-
asset: nullishToOptional(PageBlockAsset),
|
|
258
|
-
type: z.string(),
|
|
259
|
-
imageAlt: nullishToOptional(z.string()),
|
|
260
|
-
imageCaption: nullishToOptional(z.string()),
|
|
261
|
-
imageAlignment: nullishToOptional(PageBlockAlignment),
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
export type PageBlockCalloutType = z.infer<typeof PageBlockCalloutType>;
|
|
265
|
-
export type PageBlockCodeLanguage = z.infer<typeof PageBlockCodeLanguage>;
|
|
266
|
-
export type PageBlockAlignment = z.infer<typeof PageBlockAlignment>;
|
|
267
|
-
export type PageBlockThemeType = z.infer<typeof PageBlockThemeType>;
|
|
268
|
-
export type PageBlockAssetType = z.infer<typeof PageBlockAssetType>;
|
|
269
|
-
export type PageBlockTilesAlignment = z.infer<typeof PageBlockTilesAlignment>;
|
|
270
|
-
export type PageBlockTilesLayout = z.infer<typeof PageBlockTilesLayout>;
|
|
271
|
-
export type PageBlockTextSpanAttributeType = z.infer<typeof PageBlockTextSpanAttributeType>;
|
|
272
|
-
|
|
273
|
-
export type PageBlockTypeV1 = z.infer<typeof PageBlockTypeV1>;
|
|
274
|
-
export type PageBlockTextSpanAttribute = z.infer<typeof PageBlockTextSpanAttribute>;
|
|
275
|
-
export type PageBlockTextSpan = z.infer<typeof PageBlockTextSpan>;
|
|
276
|
-
export type PageBlockText = z.infer<typeof PageBlockText>;
|
|
277
|
-
export type PageBlockGuideline = z.infer<typeof PageBlockGuideline>;
|
|
278
|
-
export type PageBlockFrame = z.infer<typeof PageBlockFrame>;
|
|
279
|
-
export type PageBlockFrameOrigin = z.infer<typeof PageBlockFrameOrigin>;
|
|
280
|
-
export type PageBlockAsset = z.infer<typeof PageBlockAsset>;
|
|
281
|
-
export type PageBlockTableColumn = z.infer<typeof PageBlockTableColumn>;
|
|
282
|
-
export type PageBlockTheme = z.infer<typeof PageBlockTheme>;
|
|
283
|
-
export type PageBlockSwatch = z.infer<typeof PageBlockSwatch>;
|
|
284
|
-
export type PageBlockShortcut = z.infer<typeof PageBlockShortcut>;
|
|
285
|
-
export type PageBlockCustomBlockPropertyValue = z.infer<typeof PageBlockCustomBlockPropertyValue>;
|
|
286
|
-
export type PageBlockCustomBlockPropertyImageValue = z.infer<typeof PageBlockCustomBlockPropertyImageValue>;
|
|
287
|
-
export type PageBlockFigmaComponentBlockConfig = z.infer<typeof PageBlockFigmaComponentBlockConfig>;
|
|
288
|
-
|
|
289
|
-
//
|
|
290
|
-
// Block
|
|
291
|
-
//
|
|
292
|
-
|
|
293
|
-
export const PageBlockBaseV1 = z.object({
|
|
294
|
-
persistentId: z.string(),
|
|
295
|
-
type: PageBlockTypeV1,
|
|
296
|
-
|
|
297
|
-
// V2 generic attributes
|
|
298
|
-
numberOfColumns: nullishToOptional(z.number()),
|
|
299
|
-
itemBackgroundColor: nullishToOptional(ColorTokenInlineData),
|
|
300
|
-
|
|
301
|
-
// Element linking
|
|
302
|
-
designObjectId: nullishToOptional(z.string()),
|
|
303
|
-
designObjectIds: nullishToOptional(z.array(z.string())),
|
|
304
|
-
tokenType: nullishToOptional(DesignTokenType.or(z.literal("Font"))),
|
|
305
|
-
showNestedGroups: nullishToOptional(z.boolean()),
|
|
306
|
-
brandId: nullishToOptional(z.string()),
|
|
307
|
-
|
|
308
|
-
// Rich text
|
|
309
|
-
text: nullishToOptional(PageBlockText),
|
|
310
|
-
caption: nullishToOptional(z.string()),
|
|
311
|
-
headingType: nullishToOptional(z.number().min(1).max(3)),
|
|
312
|
-
codeLanguage: nullishToOptional(PageBlockCodeLanguage),
|
|
313
|
-
calloutType: nullishToOptional(PageBlockCalloutType),
|
|
314
|
-
urlInput: nullishToOptional(z.string()),
|
|
315
|
-
url: nullishToOptional(z.string()),
|
|
316
|
-
urlPreview: nullishToOptional(PageBlockUrlPreview),
|
|
317
|
-
|
|
318
|
-
// Image
|
|
319
|
-
asset: nullishToOptional(PageBlockAsset),
|
|
320
|
-
alignment: nullishToOptional(PageBlockAlignment),
|
|
321
|
-
imageAlt: nullishToOptional(z.string()),
|
|
322
|
-
|
|
323
|
-
// Shortcuts block
|
|
324
|
-
shortcuts: nullishToOptional(z.array(PageBlockShortcut)),
|
|
325
|
-
|
|
326
|
-
// Guidelines
|
|
327
|
-
guideline: nullishToOptional(PageBlockGuideline),
|
|
328
|
-
|
|
329
|
-
// Custom blocks
|
|
330
|
-
customBlockKey: nullishToOptional(z.string()),
|
|
331
|
-
customBlockProperties: nullishToOptional(z.array(PageBlockCustomBlockPropertyValue)),
|
|
332
|
-
variantKey: nullishToOptional(z.string()),
|
|
333
|
-
|
|
334
|
-
// Figma frames
|
|
335
|
-
figmaFrameProperties: nullishToOptional(PageBlockFigmaFrameProperties),
|
|
336
|
-
figmaFrames: nullishToOptional(z.array(PageBlockFrame)),
|
|
337
|
-
|
|
338
|
-
// Generic
|
|
339
|
-
size: nullishToOptional(Size),
|
|
340
|
-
backgroundColor: nullishToOptional(ColorTokenInlineData),
|
|
341
|
-
|
|
342
|
-
// Render code
|
|
343
|
-
renderCodeProperties: nullishToOptional(PageBlockRenderCodeProperties),
|
|
344
|
-
|
|
345
|
-
// Component assets
|
|
346
|
-
componentAssets: nullishToOptional(z.array(PageBlockAssetComponent)),
|
|
347
|
-
|
|
348
|
-
// Tables
|
|
349
|
-
tableProperties: nullishToOptional(PageBlockTableProperties),
|
|
350
|
-
columnId: nullishToOptional(z.string()),
|
|
351
|
-
|
|
352
|
-
// Token spreadsheet
|
|
353
|
-
theme: nullishToOptional(PageBlockTheme),
|
|
354
|
-
swatches: nullishToOptional(PageBlockSwatch.array()),
|
|
355
|
-
blacklistedElementProperties: nullishToOptional(z.array(z.string())),
|
|
356
|
-
|
|
357
|
-
// Figma components
|
|
358
|
-
figmaComponentsBlockConfig: nullishToOptional(PageBlockFigmaComponentBlockConfig),
|
|
359
|
-
selectedFigmaComponent: nullishToOptional(PageBlockSelectedFigmaComponent),
|
|
360
|
-
selectedFigmaComponents: nullishToOptional(PageBlockSelectedFigmaComponent.array()),
|
|
361
|
-
|
|
362
|
-
// Arbitrary
|
|
363
|
-
userMetadata: nullishToOptional(z.string()),
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
type PageBlockV1Input = z.input<typeof PageBlockBaseV1> & {
|
|
367
|
-
children: PageBlockV1Input[] | null | undefined;
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
export const PageBlockV1: z.ZodType<PageBlockV1, z.ZodTypeDef, PageBlockV1Input> = PageBlockBaseV1.extend({
|
|
371
|
-
children: z.lazy(
|
|
372
|
-
() =>
|
|
373
|
-
PageBlockV1.array()
|
|
374
|
-
.nullish()
|
|
375
|
-
.transform(t => t ?? []) as z.ZodType<PageBlockV1[], z.ZodTypeDef, PageBlockV1Input[]>
|
|
376
|
-
),
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
export type PageBlockV1 = z.infer<typeof PageBlockBaseV1> & {
|
|
380
|
-
children: PageBlockV1[];
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
//
|
|
384
|
-
// Utility methods
|
|
385
|
-
//
|
|
386
|
-
|
|
387
|
-
export function traversePageBlocksV1(blocks: PageBlockV1[], action: (block: PageBlockV1) => void) {
|
|
388
|
-
for (const block of blocks) {
|
|
389
|
-
action(block);
|
|
390
|
-
traversePageBlocksV1(block.children, action);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
export function removeCommentSpans(text: PageBlockText): PageBlockText {
|
|
395
|
-
const { spans, ...rest } = text;
|
|
396
|
-
|
|
397
|
-
const newSpans = spans.map(s => {
|
|
398
|
-
return {
|
|
399
|
-
...s,
|
|
400
|
-
attributes: s.attributes.filter(a => a.type !== "Comment"),
|
|
401
|
-
};
|
|
402
|
-
});
|
|
403
|
-
|
|
404
|
-
const updatedRichText = {
|
|
405
|
-
...rest,
|
|
406
|
-
spans: newSpans,
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
return joinRepeatingSpans(updatedRichText);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
export function joinRepeatingSpans(text: PageBlockText): PageBlockText {
|
|
413
|
-
if (text.spans.length < 2) return text;
|
|
414
|
-
|
|
415
|
-
// Make sure spans are clean before comparing them
|
|
416
|
-
text = sanitizeSpans(text);
|
|
417
|
-
const { spans, ...rest } = text;
|
|
418
|
-
|
|
419
|
-
let previousSpan = { ...spans[0] };
|
|
420
|
-
const newSpans = [previousSpan];
|
|
421
|
-
|
|
422
|
-
for (let i = 1; i < spans.length; i++) {
|
|
423
|
-
const span = spans[i];
|
|
424
|
-
if (areAttributesEqual(span.attributes, previousSpan.attributes)) {
|
|
425
|
-
previousSpan.text += span.text;
|
|
426
|
-
} else {
|
|
427
|
-
previousSpan = { ...span };
|
|
428
|
-
newSpans.push(previousSpan);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
return {
|
|
433
|
-
...rest,
|
|
434
|
-
spans: newSpans,
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
function areAttributesEqual(lhs: PageBlockTextSpanAttribute[], rhs: PageBlockTextSpanAttribute[]) {
|
|
439
|
-
if (lhs.length !== rhs.length) return false;
|
|
440
|
-
|
|
441
|
-
const lhsMap = mapByUnique(lhs, i => i.type);
|
|
442
|
-
for (const rhsAttribute of rhs) {
|
|
443
|
-
const lhsAttribute = lhsMap.get(rhsAttribute.type);
|
|
444
|
-
if (!areShallowObjectsEqual(lhsAttribute, rhsAttribute)) return false;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
return true;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
function sanitizeSpans(text: PageBlockText): PageBlockText {
|
|
451
|
-
const { spans, ...rest } = text;
|
|
452
|
-
|
|
453
|
-
return {
|
|
454
|
-
...rest,
|
|
455
|
-
spans: spans.map(s => {
|
|
456
|
-
const { attributes, ...rest } = s;
|
|
457
|
-
|
|
458
|
-
return {
|
|
459
|
-
...rest,
|
|
460
|
-
attributes: attributes.map(sanitizeSpanAttribute),
|
|
461
|
-
};
|
|
462
|
-
}),
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
function sanitizeSpanAttribute(attribute: PageBlockTextSpanAttribute): PageBlockTextSpanAttribute {
|
|
467
|
-
switch (attribute.type) {
|
|
468
|
-
case "Bold":
|
|
469
|
-
return { type: "Bold" };
|
|
470
|
-
case "Code":
|
|
471
|
-
return { type: "Code" };
|
|
472
|
-
case "Strikethrough":
|
|
473
|
-
return { type: "Strikethrough" };
|
|
474
|
-
case "Italic":
|
|
475
|
-
return { type: "Italic" };
|
|
476
|
-
case "Comment":
|
|
477
|
-
const { commentHighlightId, commentIsResolved } = attribute;
|
|
478
|
-
const isCommentIsResolvedDefined = commentIsResolved !== undefined && commentIsResolved !== null;
|
|
479
|
-
|
|
480
|
-
return {
|
|
481
|
-
type: "Comment",
|
|
482
|
-
...(isCommentIsResolvedDefined && { commentIsResolved }),
|
|
483
|
-
...(commentHighlightId && { commentHighlightId }),
|
|
484
|
-
};
|
|
485
|
-
case "Link":
|
|
486
|
-
const { documentationItemId, link, openInNewTab, openInNewWindow } = attribute;
|
|
487
|
-
const isOpenInNewTabDefined = openInNewTab !== undefined && openInNewTab !== null;
|
|
488
|
-
const isOpenInNewWindowDefined = openInNewWindow !== undefined && openInNewWindow !== null;
|
|
489
|
-
|
|
490
|
-
return {
|
|
491
|
-
type: "Link",
|
|
492
|
-
...(isOpenInNewTabDefined && { openInNewTab }),
|
|
493
|
-
...(isOpenInNewWindowDefined && { openInNewWindow }),
|
|
494
|
-
...(documentationItemId && { documentationItemId }),
|
|
495
|
-
...(link && { link }),
|
|
496
|
-
};
|
|
497
|
-
}
|
|
498
|
-
}
|