@se-studio/core-data-types 1.0.6 → 1.0.8
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.ts +12 -2
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -182,16 +182,26 @@ interface IBlankLink extends ILinkProps {
|
|
|
182
182
|
interface IExternalLink extends ILinkProps {
|
|
183
183
|
type: 'External link';
|
|
184
184
|
}
|
|
185
|
+
type InternalType = 'Page' | 'Article' | 'ArticleType' | 'Person' | 'Tag' | 'CustomType';
|
|
185
186
|
interface IInternalLink extends ILinkProps {
|
|
186
187
|
type: 'Internal link';
|
|
188
|
+
internalType: InternalType;
|
|
187
189
|
slug: string;
|
|
188
190
|
indexed?: boolean | null;
|
|
189
191
|
hidden?: boolean | null;
|
|
190
192
|
tags?: ReadonlyArray<IInternalLink>;
|
|
191
193
|
}
|
|
194
|
+
interface IArticleLink extends IInternalLink {
|
|
195
|
+
internalType: 'Article';
|
|
196
|
+
articleType?: IInternalLink;
|
|
197
|
+
}
|
|
192
198
|
interface IDownloadLink extends ILinkProps {
|
|
193
199
|
type: 'Download link';
|
|
194
200
|
}
|
|
201
|
+
declare function isBlankLink(link: ILinkProps): link is IBlankLink;
|
|
202
|
+
declare function isExternalLink(link: ILinkProps): link is IExternalLink;
|
|
203
|
+
declare function isInternalLink(link: ILinkProps): link is IInternalLink;
|
|
204
|
+
declare function isDownloadLink(link: ILinkProps): link is IDownloadLink;
|
|
195
205
|
interface INavigation {
|
|
196
206
|
id: string;
|
|
197
207
|
name: string;
|
|
@@ -252,7 +262,7 @@ interface IBaseComponent extends IBaseContent {
|
|
|
252
262
|
additionalCopy?: unknown;
|
|
253
263
|
}
|
|
254
264
|
declare function isComponent(obj: unknown): obj is IBaseComponent;
|
|
255
|
-
type CollectionContent = IBaseComponent | IBaseCollection;
|
|
265
|
+
type CollectionContent = IBaseComponent | IBaseCollection | ILinkProps | IVisual | IBaseExternalComponent;
|
|
256
266
|
interface IBaseCollection extends IBaseContent {
|
|
257
267
|
type: 'Collection';
|
|
258
268
|
collectionType: string;
|
|
@@ -321,4 +331,4 @@ interface IBasePage extends IBaseModel {
|
|
|
321
331
|
}
|
|
322
332
|
declare function isPage(content: IBaseModel): content is IBasePage;
|
|
323
333
|
|
|
324
|
-
export { type BaseContentType, type CollectionContent, type Horizontal, type IAnalyticsContext, type IAnimation, type IBaseArticle, type IBaseArticleType, type IBaseCollection, type IBaseComponent, type IBaseContent, type IBaseExternalComponent, type IBaseModel, type IBasePage, type IBaseTag, type IBaseTags, type IBlankLink, type IContentContext, type IDownloadLink, type IExternalLink, type IExternalVideo, type IFullVideo, type IImage, type IInternalLink, type ILinkProps, type ILocalVideo, type INavigation, type INavigationItem, type IOptimisedSvg, type IPageContext, type IPerson, type IPicture, type IResponsiveVisual, type IRichTextOptions, type ISvgData, type ISvgImage, type ITyped, type IVideo, type IVideoDetails, type IVisual, type IVisualCommon, type IVisualSizes, type PersonLink, type Vertical, isAnimation, isArticle, isArticleType, isCollection, isComponent, isExternalVideo, isFullVideo, isImage, isLocalVideo, isPage, isPicture, isSvgData, isSvgImage, isTag, isTags, isVideo, isVisualAnimation, isVisualImage, isVisualVideo, processSizes };
|
|
334
|
+
export { type BaseContentType, type CollectionContent, type Horizontal, type IAnalyticsContext, type IAnimation, type IArticleLink, type IBaseArticle, type IBaseArticleType, type IBaseCollection, type IBaseComponent, type IBaseContent, type IBaseExternalComponent, type IBaseModel, type IBasePage, type IBaseTag, type IBaseTags, type IBlankLink, type IContentContext, type IDownloadLink, type IExternalLink, type IExternalVideo, type IFullVideo, type IImage, type IInternalLink, type ILinkProps, type ILocalVideo, type INavigation, type INavigationItem, type IOptimisedSvg, type IPageContext, type IPerson, type IPicture, type IResponsiveVisual, type IRichTextOptions, type ISvgData, type ISvgImage, type ITyped, type IVideo, type IVideoDetails, type IVisual, type IVisualCommon, type IVisualSizes, type InternalType, type PersonLink, type Vertical, isAnimation, isArticle, isArticleType, isBlankLink, isCollection, isComponent, isDownloadLink, isExternalLink, isExternalVideo, isFullVideo, isImage, isInternalLink, isLocalVideo, isPage, isPicture, isSvgData, isSvgImage, isTag, isTags, isVideo, isVisualAnimation, isVisualImage, isVisualVideo, processSizes };
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,18 @@ function isArticleType(content) {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
// src/types/common.ts
|
|
10
|
+
function isBlankLink(link) {
|
|
11
|
+
return link.type === "Blank link";
|
|
12
|
+
}
|
|
13
|
+
function isExternalLink(link) {
|
|
14
|
+
return link.type === "External link";
|
|
15
|
+
}
|
|
16
|
+
function isInternalLink(link) {
|
|
17
|
+
return link.type === "Internal link";
|
|
18
|
+
}
|
|
19
|
+
function isDownloadLink(link) {
|
|
20
|
+
return link.type === "Download link";
|
|
21
|
+
}
|
|
10
22
|
function isComponent(obj) {
|
|
11
23
|
if (typeof obj !== "object" || obj === null) {
|
|
12
24
|
return false;
|
|
@@ -106,6 +118,6 @@ function isVisualAnimation(visual) {
|
|
|
106
118
|
return visual?.animation !== void 0;
|
|
107
119
|
}
|
|
108
120
|
|
|
109
|
-
export { isAnimation, isArticle, isArticleType, isCollection, isComponent, isExternalVideo, isFullVideo, isImage, isLocalVideo, isPage, isPicture, isSvgData, isSvgImage, isTag, isTags, isVideo, isVisualAnimation, isVisualImage, isVisualVideo, processSizes };
|
|
121
|
+
export { isAnimation, isArticle, isArticleType, isBlankLink, isCollection, isComponent, isDownloadLink, isExternalLink, isExternalVideo, isFullVideo, isImage, isInternalLink, isLocalVideo, isPage, isPicture, isSvgData, isSvgImage, isTag, isTags, isVideo, isVisualAnimation, isVisualImage, isVisualVideo, processSizes };
|
|
110
122
|
//# sourceMappingURL=index.js.map
|
|
111
123
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/article.ts","../src/types/common.ts","../src/types/page.ts","../src/types/tag.ts","../src/types/visual.ts"],"names":["proportion"],"mappings":";AAkBO,SAAS,UAAU,OAAA,EAA8C;AACtE,EAAA,OAAO,QAAQ,IAAA,KAAS,SAAA;AAC1B;AAaO,SAAS,cAAc,OAAA,EAAkD;AAC9E,EAAA,OAAO,QAAQ,IAAA,KAAS,cAAA;AAC1B;;;AC6IO,SAAS,YAAY,GAAA,EAAqC;AAC/D,EAAA,IAAI,OAAO,GAAA,KAAQ,QAAA,IAAY,GAAA,KAAQ,IAAA,EAAM;AAC3C,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAK,GAAA,CAAuB,SAAS,WAAA,EAAa;AAChD,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAA;AACT;AAkBO,SAAS,aAAa,GAAA,EAAsC;AACjE,EAAA,IAAI,OAAO,GAAA,KAAQ,QAAA,IAAY,GAAA,KAAQ,IAAA,EAAM;AAC3C,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,IAAK,GAAA,CAAwB,SAAS,YAAA,EAAc;AAClD,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAA;AACT;;;ACtMO,SAAS,OAAO,OAAA,EAA2C;AAChE,EAAA,OAAO,QAAQ,IAAA,KAAS,MAAA;AAC1B;;;ACJO,SAAS,MAAM,OAAA,EAA0C;AAC9D,EAAA,OAAO,QAAQ,IAAA,KAAS,KAAA;AAC1B;AAMO,SAAS,OAAO,OAAA,EAA2C;AAChE,EAAA,OAAO,QAAQ,IAAA,KAAS,MAAA;AAC1B;;;ACDA,SAAS,kBAAkB,WAAA,EAAgE;AACzF,EAAA,OAAO,WAAA,EAAa,IAAI,CAAC,EAAE,UAAU,UAAA,EAAY,MAAA,EAAQ,MAAK,KAAM;AAClE,IAAA,IAAI,UAAA,EAAY;AACd,MAAA,OAAO;AAAA,QACL,QAAA;AAAA,QACA,UAAA;AAAA,Q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AK,IAAA,KAAS,aAAA;AACvB;AAEO,SAAS,YAAY,GAAA,EAA0D;AACpF,EAAA,OAAO,KAAK,IAAA,KAAS,YAAA;AACvB;AAEO,SAAS,gBAAgB,GAAA,EAA8D;AAC5F,EAAA,OAAO,KAAK,IAAA,KAAS,gBAAA;AACvB;AAEO,SAAS,QAAQ,GAAA,EAAsD;AAC5E,EAAA,OAAO,aAAa,GAAG,CAAA,IAAK,YAAY,GAAG,CAAA,IAAK,gBAAgB,GAAG,CAAA;AACrE;AAWO,SAAS,YAAY,GAAA,EAAuC;AACjE,EAAA,OAAO,KAAK,IAAA,KAAS,WAAA;AACvB;AAUO,SAAS,cAAc,MAAA,EAAoC;AAChE,EAAA,OAAO,QAAQ,KAAA,KAAU,MAAA;AAC3B;AACO,SAAS,cAAc,MAAA,EAAoC;AAChE,EAAA,OAAO,QAAQ,KAAA,KAAU,MAAA;AAC3B;AACO,SAAS,kBAAkB,MAAA,EAAoC;AACpE,EAAA,OAAO,QAAQ,SAAA,KAAc,MAAA;AAC/B","file":"index.js","sourcesContent":["import type { BaseModelLinkOmissions, IBaseModel, IInternalLink, ITyped } from './common';\nimport type { TagLink } from './tag';\n\nexport interface IBaseArticle extends IBaseModel {\n type: 'Article';\n articleType?: IInternalLink;\n structuredData?: ReadonlyArray<unknown>;\n contents?: ReadonlyArray<ITyped>; // PageContent - will be narrowed at project level\n tags?: ReadonlyArray<IInternalLink>;\n}\n\nexport type ArticleLink = Omit<\n IBaseArticle,\n BaseModelLinkOmissions | 'structuredData' | 'contents' | 'tags'\n> & {\n tags?: ReadonlyArray<TagLink>;\n};\n\nexport function isArticle(content: IBaseModel): content is IBaseArticle {\n return content.type === 'Article';\n}\n\nexport interface IBaseArticleType extends IBaseModel {\n type: 'Article type';\n indexPageContent?: ReadonlyArray<ITyped>; // PageContent - will be narrowed at project level\n searchPageContent?: ReadonlyArray<ITyped>; // PageContent - will be narrowed at project level\n}\n\nexport type ArticleTypeLink = Omit<\n IBaseArticleType,\n BaseModelLinkOmissions | 'indexPageContent' | 'searchPageContent'\n>;\n\nexport function isArticleType(content: IBaseModel): content is IBaseArticleType {\n return content.type === 'Article type';\n}\n","import type { IResponsiveVisual, IVisual } from './visual';\n\n/**\n * Utility type to make all nested properties of a type optional\n */\nexport type DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];\n};\n\n/**\n * Utility type to make TypeScript's complex types more readable in IDE tooltips\n */\nexport type Prettify<T> = {\n [K in keyof T]: T[K];\n} & {};\n\nexport type BaseContentType =\n | 'Component'\n | 'Collection'\n | 'Internal link'\n | 'Visual'\n | 'External component';\n\nexport interface ITyped {\n type: string;\n id: string;\n}\n\nexport interface IPageContext {\n articleLink?: ITyped | null; // ArticleLink - will be narrowed at project level\n articleTypeLink?: ITyped | null; // ArticleTypeLink - will be narrowed at project level\n personLink?: ITyped | null; // PersonLink - will be narrowed at project level\n pageLink?: ITyped | null; // PageLink - will be narrowed at project level\n tagLink?: ITyped | null; // TagLink - will be narrowed at project level\n}\n\nexport interface IContentContext {\n analyticsContext?: IAnalyticsContext;\n pageContext: IPageContext;\n current: ITyped; // PageContent - will be narrowed at project level\n previousContent?: ITyped; // PageContent - will be narrowed at project level\n nextContent?: ITyped; // PageContent - will be narrowed at project level\n}\n\nexport interface IAnalyticsContext {\n slug: string;\n title?: string;\n type?: string;\n}\n\nexport interface IRichTextOptions {\n cmsLabel?: string | null;\n analytics?: IAnalyticsContext;\n embedded?: boolean;\n parentId: string;\n parentIndex: number;\n}\n\nexport interface ILinkProps {\n parentId?: string;\n parentFieldId?: string;\n id: string;\n useName?: boolean | null;\n name: string;\n text?: string | null;\n readonly icon?: IResponsiveVisual;\n visual?: IVisual;\n href?: string | null;\n click?: () => void;\n type: 'Blank link' | 'External link' | 'Internal link' | 'Download link';\n backgroundColour?: string | null;\n textColour?: string | null;\n variant?: string;\n size?: string;\n}\n\nexport interface IBlankLink extends ILinkProps {\n type: 'Blank link';\n}\n\nexport interface IExternalLink extends ILinkProps {\n type: 'External link';\n}\n\nexport interface IInternalLink extends ILinkProps {\n type: 'Internal link';\n slug: string;\n indexed?: boolean | null;\n hidden?: boolean | null;\n tags?: ReadonlyArray<IInternalLink>;\n}\n\nexport interface IDownloadLink extends ILinkProps {\n type: 'Download link';\n}\n\nexport function isBlankLink(link: ILinkProps): link is IBlankLink {\n return link.type === 'Blank link';\n}\n\nexport function isExternalLink(link: ILinkProps): link is IExternalLink {\n return link.type === 'External link';\n}\n\nexport function isInternalLink(link: ILinkProps): link is IInternalLink {\n return link.type === 'Internal link';\n}\n\nexport function isDownloadLink(link: ILinkProps): link is IDownloadLink {\n return link.type === 'Download link';\n}\n\nexport interface INavigation {\n id: string;\n name: string;\n entries: ReadonlyArray<INavigationItem>;\n textColour?: string;\n backgroundColour?: string;\n}\n\nexport interface INavigationItem {\n id: string;\n readonly link?: ILinkProps;\n entries?: ReadonlyArray<INavigationItem>;\n}\n\nexport interface IBaseModel {\n type: string;\n id: string;\n slug: string;\n title: string;\n description: string;\n featuredImage?: IVisual;\n link?: string;\n indexed?: boolean | null;\n hidden?: boolean | null;\n lastUpdated?: string | Date;\n textColour?: string;\n backgroundColour?: string;\n menu?: INavigation;\n footer?: INavigation;\n}\nexport type BaseModelLinkOmissions = 'menu' | 'footer';\n\nexport interface IBaseContent {\n type: string;\n index: number;\n isFirst: boolean;\n isLast: boolean;\n indexOfType: number;\n id: string;\n name: string;\n anchor?: string | null;\n cmsLabel: string | null; // Original CMS label for tracking purposes\n backgroundColour?: string;\n textColour?: string;\n hexColor?: string | null;\n backgroundVisual?: IResponsiveVisual;\n backgroundOverlayOpacity?: number | null;\n visual?: IResponsiveVisual;\n parentId?: string;\n parentFieldId?: string;\n}\n\nexport interface IBaseComponent extends IBaseContent {\n type: 'Component';\n componentType: string;\n preHeading?: string | null;\n heading?: string | null;\n postHeading?: string | null;\n body?: unknown;\n icon?: IVisual;\n links?: ReadonlyArray<ILinkProps>;\n additionalCopy?: unknown;\n}\n\nexport function isComponent(obj: unknown): obj is IBaseComponent {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n if ((obj as IBaseComponent).type !== 'Component') {\n return false;\n }\n return true;\n}\n\nexport type CollectionContent = IBaseComponent | IBaseCollection;\n\nexport interface IBaseCollection extends IBaseContent {\n type: 'Collection';\n collectionType: string;\n anchor?: string | null;\n preHeading?: string | null;\n heading?: string | null;\n postHeading?: string | null;\n body?: unknown;\n icon?: IVisual;\n links?: ReadonlyArray<ILinkProps>;\n additionalCopy?: unknown;\n contents?: ReadonlyArray<CollectionContent>;\n}\n\nexport function isCollection(obj: unknown): obj is IBaseCollection {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n if ((obj as IBaseCollection).type !== 'Collection') {\n return false;\n }\n return true;\n}\n\nexport interface IBaseExternalComponent extends IBaseContent {\n type: 'External component';\n externalType: string;\n data: unknown | null;\n}\n\nexport function isExternalComponent(obj: unknown): obj is IBaseExternalComponent {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n if ((obj as IBaseExternalComponent).type !== 'External component') {\n return false;\n }\n return true;\n}\n\nexport interface IPerson extends IBaseModel {\n type: 'Person';\n jobTitle?: string | null;\n phoneNumber: string | null;\n emailAddress: string | null;\n location: string | null;\n linkedIn: string | null;\n bio: unknown;\n href: string | undefined;\n structuredData?: ReadonlyArray<unknown>;\n contents?: ReadonlyArray<unknown>; // PageContent - will be narrowed at project level\n}\n\nexport type PersonLink = Omit<IPerson, BaseModelLinkOmissions | 'structuredData' | 'contents'>;\n\nexport function isPerson(content: IBaseModel): content is IPerson {\n return content.type === 'Person';\n}\n","import type { BaseModelLinkOmissions, IBaseModel, IInternalLink, ITyped } from './common';\n\nexport interface IBasePage extends IBaseModel {\n type: 'Page';\n isHomePage: boolean;\n structuredData?: ReadonlyArray<unknown>;\n contents?: ReadonlyArray<ITyped>; // PageContent - will be narrowed at project level\n tags?: ReadonlyArray<IInternalLink>;\n}\n\nexport type PageLink = Omit<IBasePage, BaseModelLinkOmissions | 'structuredData' | 'contents'>;\n\nexport function isPage(content: IBaseModel): content is IBasePage {\n return content.type === 'Page';\n}\n","import type { BaseModelLinkOmissions, IBaseModel, ITyped } from './common';\n\nexport interface IBaseTag extends IBaseModel {\n type: 'Tag';\n tagType?: string | null;\n contents?: ReadonlyArray<ITyped>; // PageContent - will be narrowed at project level\n}\n\nexport type TagLink = Omit<IBaseTag, BaseModelLinkOmissions | 'contents'>;\n\nexport function isTag(content: IBaseModel): content is IBaseTag {\n return content.type === 'Tag';\n}\n\nexport interface IBaseTags extends IBaseModel {\n type: 'Tags';\n}\n\nexport function isTags(content: IBaseModel): content is IBaseTags {\n return content.type === 'Tags';\n}\n","import type { VideoTypeData } from '@extractus/oembed-extractor';\n\nexport type Vertical = 'Top' | 'Middle' | 'Bottom';\nexport type Horizontal = 'Left' | 'Middle' | 'Right';\n\ninterface IInternalBreakpoint {\n maxWidth: number;\n proportion: number;\n pixels: number;\n size: string;\n}\ntype IBreakpoint = Pick<IInternalBreakpoint, 'maxWidth'> &\n Partial<Omit<IInternalBreakpoint, 'maxWidth'>>;\nexport interface IVisualSizes {\n defaultSize?: string;\n defaultPixels?: number;\n breakpoints?: IBreakpoint[];\n}\n\nfunction fillInBreakpoints(breakpoints?: IBreakpoint[]): IInternalBreakpoint[] | undefined {\n return breakpoints?.map(({ maxWidth, proportion, pixels, size }) => {\n if (proportion) {\n return {\n maxWidth,\n proportion,\n pixels: Math.round(maxWidth * proportion),\n size: `${Math.round(100 * proportion)}vw`,\n };\n }\n if (pixels) {\n const proportion = Math.round(maxWidth / pixels);\n return {\n maxWidth,\n proportion,\n pixels,\n size: size ?? `${Math.round(100 * proportion)}vw`,\n };\n }\n\n return { maxWidth, proportion: 1, pixels: maxWidth, size: size ?? `100vw` };\n });\n}\nexport function processSizes({ defaultSize, defaultPixels, breakpoints }: IVisualSizes) {\n return {\n defaultSize,\n defaultPixels,\n breakpoints: fillInBreakpoints(breakpoints),\n };\n}\n\nexport interface IVisualCommon {\n type: string;\n id: string;\n name: string;\n description?: string | null;\n nameAsCaption?: boolean | null;\n dontCrop?: boolean | null;\n horizontalCropPosition?: Horizontal | null;\n verticalCropPosition?: Vertical | null;\n horizontalPosition?: Horizontal | null;\n widthPercent?: number | null;\n}\n\nexport interface IOptimisedSvg {\n data: string;\n width: number;\n height: number;\n}\n\ninterface IImageCommon extends IVisualCommon {\n mimeType: string;\n}\nexport interface IPicture extends IImageCommon {\n type: 'Picture';\n src: string;\n width: number;\n height: number;\n size: number;\n}\n\nexport interface ISvgImage extends IImageCommon {\n type: 'Svg image';\n size: number;\n svgSrc: string;\n width: number;\n height: number;\n}\n\nexport interface ISvgData extends IImageCommon {\n type: 'Svg data';\n data: string;\n width: number;\n height: number;\n}\n\nexport type IImage = IPicture | ISvgImage | ISvgData;\n\nexport function isPicture(obj: IVisualCommon | undefined | null): obj is IPicture {\n return obj?.type === 'Picture';\n}\n\nexport function isSvgImage(obj: IVisualCommon | undefined | null): obj is ISvgImage {\n return obj?.type === 'Svg image';\n}\n\nexport function isSvgData(obj: IVisualCommon | undefined | null): obj is ISvgData {\n return obj?.type === 'Svg data';\n}\n\nexport function isImage(obj: IVisualCommon | undefined | null): obj is IImage {\n return isPicture(obj) || isSvgImage(obj) || isSvgData(obj);\n}\n\nexport interface IVideoDetails {\n id: string;\n videoUrl: string;\n mimeType: string;\n fileName: string;\n size: number;\n}\n\nexport interface IVideoCommon extends IVisualCommon {\n poster?: string;\n loop?: boolean | null;\n autoPlay?: boolean | null;\n width?: number;\n height?: number;\n hideControls?: boolean | null;\n}\n\nexport interface ILocalVideo extends IVideoCommon {\n type: 'Local video';\n preview: IVideoDetails;\n videoPrefix: string;\n}\n\nexport interface IFullVideo extends IVideoCommon {\n type: 'Full video';\n preview?: IVideoDetails;\n full: IVideoDetails;\n videoPrefix: string;\n}\n\nexport interface IExternalVideo extends IVideoCommon {\n type: 'External video';\n preview?: IVideoDetails;\n external: string;\n embed?: VideoTypeData;\n}\n\nexport type IVideo = ILocalVideo | IFullVideo | IExternalVideo;\n\nexport function isLocalVideo(obj: IVisualCommon | undefined | null): obj is ILocalVideo {\n return obj?.type === 'Local video';\n}\n\nexport function isFullVideo(obj: IVisualCommon | undefined | null): obj is IFullVideo {\n return obj?.type === 'Full video';\n}\n\nexport function isExternalVideo(obj: IVisualCommon | undefined | null): obj is IExternalVideo {\n return obj?.type === 'External video';\n}\n\nexport function isVideo(obj: IVisualCommon | undefined | null): obj is IVideo {\n return isLocalVideo(obj) || isFullVideo(obj) || isExternalVideo(obj);\n}\n\nexport interface IAnimation extends IVisualCommon {\n type: 'Animation';\n optimised?: IOptimisedSvg;\n animationSrc: string;\n loop?: boolean | null;\n loopDelay?: number | null;\n autoPlay?: boolean | null;\n}\n\nexport function isAnimation(obj: IVisualCommon | undefined | null) {\n return obj?.type === 'Animation';\n}\n\nexport interface IVisual {\n type: 'Visual';\n id: string;\n image?: IImage;\n video?: IVideo;\n animation?: IAnimation;\n}\n\nexport function isVisualVideo(visual: IVisual | undefined | null) {\n return visual?.video !== undefined;\n}\nexport function isVisualImage(visual: IVisual | undefined | null) {\n return visual?.image !== undefined;\n}\nexport function isVisualAnimation(visual: IVisual | undefined | null) {\n return visual?.animation !== undefined;\n}\n\nexport interface IResponsiveVisual {\n visual: IVisual;\n hideVisual?: boolean;\n mobileVisual?: IVisual;\n hideMobileVisual?: boolean;\n visualCustomSize?: number | null;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/types/article.ts","../src/types/common.ts","../src/types/page.ts","../src/types/tag.ts","../src/types/visual.ts"],"names":["proportion"],"mappings":";AAkBO,SAAS,UAAU,OAAA,EAA8C;AACtE,EAAA,OAAO,QAAQ,IAAA,KAAS,SAAA;AAC1B;AAaO,SAAS,cAAc,OAAA,EAAkD;AAC9E,EAAA,OAAO,QAAQ,IAAA,KAAS,cAAA;AAC1B;;;ACmEO,SAAS,YAAY,IAAA,EAAsC;AAChE,EAAA,OAAO,KAAK,IAAA,KAAS,YAAA;AACvB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aAAA;AACvB;AAEO,SAAS,YAAY,GAAA,EAA0D;AACpF,EAAA,OAAO,KAAK,IAAA,KAAS,YAAA;AACvB;AAEO,SAAS,gBAAgB,GAAA,EAA8D;AAC5F,EAAA,OAAO,KAAK,IAAA,KAAS,gBAAA;AACvB;AAEO,SAAS,QAAQ,GAAA,EAAsD;AAC5E,EAAA,OAAO,aAAa,GAAG,CAAA,IAAK,YAAY,GAAG,CAAA,IAAK,gBAAgB,GAAG,CAAA;AACrE;AAWO,SAAS,YAAY,GAAA,EAAuC;AACjE,EAAA,OAAO,KAAK,IAAA,KAAS,WAAA;AACvB;AAUO,SAAS,cAAc,MAAA,EAAoC;AAChE,EAAA,OAAO,QAAQ,KAAA,KAAU,MAAA;AAC3B;AACO,SAAS,cAAc,MAAA,EAAoC;AAChE,EAAA,OAAO,QAAQ,KAAA,KAAU,MAAA;AAC3B;AACO,SAAS,kBAAkB,MAAA,EAAoC;AACpE,EAAA,OAAO,QAAQ,SAAA,KAAc,MAAA;AAC/B","file":"index.js","sourcesContent":["import type { BaseModelLinkOmissions, IBaseModel, IInternalLink, ITyped } from './common';\nimport type { TagLink } from './tag';\n\nexport interface IBaseArticle extends IBaseModel {\n type: 'Article';\n articleType?: IInternalLink;\n structuredData?: ReadonlyArray<unknown>;\n contents?: ReadonlyArray<ITyped>; // PageContent - will be narrowed at project level\n tags?: ReadonlyArray<IInternalLink>;\n}\n\nexport type ArticleLink = Omit<\n IBaseArticle,\n BaseModelLinkOmissions | 'structuredData' | 'contents' | 'tags'\n> & {\n tags?: ReadonlyArray<TagLink>;\n};\n\nexport function isArticle(content: IBaseModel): content is IBaseArticle {\n return content.type === 'Article';\n}\n\nexport interface IBaseArticleType extends IBaseModel {\n type: 'Article type';\n indexPageContent?: ReadonlyArray<ITyped>; // PageContent - will be narrowed at project level\n searchPageContent?: ReadonlyArray<ITyped>; // PageContent - will be narrowed at project level\n}\n\nexport type ArticleTypeLink = Omit<\n IBaseArticleType,\n BaseModelLinkOmissions | 'indexPageContent' | 'searchPageContent'\n>;\n\nexport function isArticleType(content: IBaseModel): content is IBaseArticleType {\n return content.type === 'Article type';\n}\n","import type { IResponsiveVisual, IVisual } from './visual';\n\n/**\n * Utility type to make all nested properties of a type optional\n */\nexport type DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];\n};\n\n/**\n * Utility type to make TypeScript's complex types more readable in IDE tooltips\n */\nexport type Prettify<T> = {\n [K in keyof T]: T[K];\n} & {};\n\nexport type BaseContentType =\n | 'Component'\n | 'Collection'\n | 'Internal link'\n | 'Visual'\n | 'External component';\n\nexport interface ITyped {\n type: string;\n id: string;\n}\n\nexport interface IPageContext {\n articleLink?: ITyped | null; // ArticleLink - will be narrowed at project level\n articleTypeLink?: ITyped | null; // ArticleTypeLink - will be narrowed at project level\n personLink?: ITyped | null; // PersonLink - will be narrowed at project level\n pageLink?: ITyped | null; // PageLink - will be narrowed at project level\n tagLink?: ITyped | null; // TagLink - will be narrowed at project level\n}\n\nexport interface IContentContext {\n analyticsContext?: IAnalyticsContext;\n pageContext: IPageContext;\n current: ITyped; // PageContent - will be narrowed at project level\n previousContent?: ITyped; // PageContent - will be narrowed at project level\n nextContent?: ITyped; // PageContent - will be narrowed at project level\n}\n\nexport interface IAnalyticsContext {\n slug: string;\n title?: string;\n type?: string;\n}\n\nexport interface IRichTextOptions {\n cmsLabel?: string | null;\n analytics?: IAnalyticsContext;\n embedded?: boolean;\n parentId: string;\n parentIndex: number;\n}\n\nexport interface ILinkProps {\n parentId?: string;\n parentFieldId?: string;\n id: string;\n useName?: boolean | null;\n name: string;\n text?: string | null;\n readonly icon?: IResponsiveVisual;\n visual?: IVisual;\n href?: string | null;\n click?: () => void;\n type: 'Blank link' | 'External link' | 'Internal link' | 'Download link';\n backgroundColour?: string | null;\n textColour?: string | null;\n variant?: string;\n size?: string;\n}\n\nexport interface IBlankLink extends ILinkProps {\n type: 'Blank link';\n}\n\nexport interface IExternalLink extends ILinkProps {\n type: 'External link';\n}\nexport type InternalType = 'Page' | 'Article' | 'ArticleType' | 'Person' | 'Tag' | 'CustomType';\nexport interface IInternalLink extends ILinkProps {\n type: 'Internal link';\n internalType: InternalType;\n slug: string;\n indexed?: boolean | null;\n hidden?: boolean | null;\n tags?: ReadonlyArray<IInternalLink>;\n}\n\nexport interface IArticleLink extends IInternalLink {\n internalType: 'Article';\n articleType?: IInternalLink;\n}\n\nexport interface IDownloadLink extends ILinkProps {\n type: 'Download link';\n}\n\nexport function isBlankLink(link: ILinkProps): link is IBlankLink {\n return link.type === 'Blank link';\n}\n\nexport function isExternalLink(link: ILinkProps): link is IExternalLink {\n return link.type === 'External link';\n}\n\nexport function isInternalLink(link: ILinkProps): link is IInternalLink {\n return link.type === 'Internal link';\n}\n\nexport function isDownloadLink(link: ILinkProps): link is IDownloadLink {\n return link.type === 'Download link';\n}\n\nexport interface INavigation {\n id: string;\n name: string;\n entries: ReadonlyArray<INavigationItem>;\n textColour?: string;\n backgroundColour?: string;\n}\n\nexport interface INavigationItem {\n id: string;\n readonly link?: ILinkProps;\n entries?: ReadonlyArray<INavigationItem>;\n}\n\nexport interface IBaseModel {\n type: string;\n id: string;\n slug: string;\n title: string;\n description: string;\n featuredImage?: IVisual;\n link?: string;\n indexed?: boolean | null;\n hidden?: boolean | null;\n lastUpdated?: string | Date;\n textColour?: string;\n backgroundColour?: string;\n menu?: INavigation;\n footer?: INavigation;\n}\nexport type BaseModelLinkOmissions = 'menu' | 'footer';\n\nexport interface IBaseContent {\n type: string;\n index: number;\n isFirst: boolean;\n isLast: boolean;\n indexOfType: number;\n id: string;\n name: string;\n anchor?: string | null;\n cmsLabel: string | null; // Original CMS label for tracking purposes\n backgroundColour?: string;\n textColour?: string;\n hexColor?: string | null;\n backgroundVisual?: IResponsiveVisual;\n backgroundOverlayOpacity?: number | null;\n visual?: IResponsiveVisual;\n parentId?: string;\n parentFieldId?: string;\n}\n\nexport interface IBaseComponent extends IBaseContent {\n type: 'Component';\n componentType: string;\n preHeading?: string | null;\n heading?: string | null;\n postHeading?: string | null;\n body?: unknown;\n icon?: IVisual;\n links?: ReadonlyArray<ILinkProps>;\n additionalCopy?: unknown;\n}\n\nexport function isComponent(obj: unknown): obj is IBaseComponent {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n if ((obj as IBaseComponent).type !== 'Component') {\n return false;\n }\n return true;\n}\n\nexport type CollectionContent =\n | IBaseComponent\n | IBaseCollection\n | ILinkProps\n | IVisual\n | IBaseExternalComponent;\n\nexport interface IBaseCollection extends IBaseContent {\n type: 'Collection';\n collectionType: string;\n anchor?: string | null;\n preHeading?: string | null;\n heading?: string | null;\n postHeading?: string | null;\n body?: unknown;\n icon?: IVisual;\n links?: ReadonlyArray<ILinkProps>;\n additionalCopy?: unknown;\n contents?: ReadonlyArray<CollectionContent>;\n}\n\nexport function isCollection(obj: unknown): obj is IBaseCollection {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n if ((obj as IBaseCollection).type !== 'Collection') {\n return false;\n }\n return true;\n}\n\nexport interface IBaseExternalComponent extends IBaseContent {\n type: 'External component';\n externalType: string;\n data: unknown | null;\n}\n\nexport function isExternalComponent(obj: unknown): obj is IBaseExternalComponent {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n if ((obj as IBaseExternalComponent).type !== 'External component') {\n return false;\n }\n return true;\n}\n\nexport interface IPerson extends IBaseModel {\n type: 'Person';\n jobTitle?: string | null;\n phoneNumber: string | null;\n emailAddress: string | null;\n location: string | null;\n linkedIn: string | null;\n bio: unknown;\n href: string | undefined;\n structuredData?: ReadonlyArray<unknown>;\n contents?: ReadonlyArray<unknown>; // PageContent - will be narrowed at project level\n}\n\nexport type PersonLink = Omit<IPerson, BaseModelLinkOmissions | 'structuredData' | 'contents'>;\n\nexport function isPerson(content: IBaseModel): content is IPerson {\n return content.type === 'Person';\n}\n","import type { BaseModelLinkOmissions, IBaseModel, IInternalLink, ITyped } from './common';\n\nexport interface IBasePage extends IBaseModel {\n type: 'Page';\n isHomePage: boolean;\n structuredData?: ReadonlyArray<unknown>;\n contents?: ReadonlyArray<ITyped>; // PageContent - will be narrowed at project level\n tags?: ReadonlyArray<IInternalLink>;\n}\n\nexport type PageLink = Omit<IBasePage, BaseModelLinkOmissions | 'structuredData' | 'contents'>;\n\nexport function isPage(content: IBaseModel): content is IBasePage {\n return content.type === 'Page';\n}\n","import type { BaseModelLinkOmissions, IBaseModel, ITyped } from './common';\n\nexport interface IBaseTag extends IBaseModel {\n type: 'Tag';\n tagType?: string | null;\n contents?: ReadonlyArray<ITyped>; // PageContent - will be narrowed at project level\n}\n\nexport type TagLink = Omit<IBaseTag, BaseModelLinkOmissions | 'contents'>;\n\nexport function isTag(content: IBaseModel): content is IBaseTag {\n return content.type === 'Tag';\n}\n\nexport interface IBaseTags extends IBaseModel {\n type: 'Tags';\n}\n\nexport function isTags(content: IBaseModel): content is IBaseTags {\n return content.type === 'Tags';\n}\n","import type { VideoTypeData } from '@extractus/oembed-extractor';\n\nexport type Vertical = 'Top' | 'Middle' | 'Bottom';\nexport type Horizontal = 'Left' | 'Middle' | 'Right';\n\ninterface IInternalBreakpoint {\n maxWidth: number;\n proportion: number;\n pixels: number;\n size: string;\n}\ntype IBreakpoint = Pick<IInternalBreakpoint, 'maxWidth'> &\n Partial<Omit<IInternalBreakpoint, 'maxWidth'>>;\nexport interface IVisualSizes {\n defaultSize?: string;\n defaultPixels?: number;\n breakpoints?: IBreakpoint[];\n}\n\nfunction fillInBreakpoints(breakpoints?: IBreakpoint[]): IInternalBreakpoint[] | undefined {\n return breakpoints?.map(({ maxWidth, proportion, pixels, size }) => {\n if (proportion) {\n return {\n maxWidth,\n proportion,\n pixels: Math.round(maxWidth * proportion),\n size: `${Math.round(100 * proportion)}vw`,\n };\n }\n if (pixels) {\n const proportion = Math.round(maxWidth / pixels);\n return {\n maxWidth,\n proportion,\n pixels,\n size: size ?? `${Math.round(100 * proportion)}vw`,\n };\n }\n\n return { maxWidth, proportion: 1, pixels: maxWidth, size: size ?? `100vw` };\n });\n}\nexport function processSizes({ defaultSize, defaultPixels, breakpoints }: IVisualSizes) {\n return {\n defaultSize,\n defaultPixels,\n breakpoints: fillInBreakpoints(breakpoints),\n };\n}\n\nexport interface IVisualCommon {\n type: string;\n id: string;\n name: string;\n description?: string | null;\n nameAsCaption?: boolean | null;\n dontCrop?: boolean | null;\n horizontalCropPosition?: Horizontal | null;\n verticalCropPosition?: Vertical | null;\n horizontalPosition?: Horizontal | null;\n widthPercent?: number | null;\n}\n\nexport interface IOptimisedSvg {\n data: string;\n width: number;\n height: number;\n}\n\ninterface IImageCommon extends IVisualCommon {\n mimeType: string;\n}\nexport interface IPicture extends IImageCommon {\n type: 'Picture';\n src: string;\n width: number;\n height: number;\n size: number;\n}\n\nexport interface ISvgImage extends IImageCommon {\n type: 'Svg image';\n size: number;\n svgSrc: string;\n width: number;\n height: number;\n}\n\nexport interface ISvgData extends IImageCommon {\n type: 'Svg data';\n data: string;\n width: number;\n height: number;\n}\n\nexport type IImage = IPicture | ISvgImage | ISvgData;\n\nexport function isPicture(obj: IVisualCommon | undefined | null): obj is IPicture {\n return obj?.type === 'Picture';\n}\n\nexport function isSvgImage(obj: IVisualCommon | undefined | null): obj is ISvgImage {\n return obj?.type === 'Svg image';\n}\n\nexport function isSvgData(obj: IVisualCommon | undefined | null): obj is ISvgData {\n return obj?.type === 'Svg data';\n}\n\nexport function isImage(obj: IVisualCommon | undefined | null): obj is IImage {\n return isPicture(obj) || isSvgImage(obj) || isSvgData(obj);\n}\n\nexport interface IVideoDetails {\n id: string;\n videoUrl: string;\n mimeType: string;\n fileName: string;\n size: number;\n}\n\nexport interface IVideoCommon extends IVisualCommon {\n poster?: string;\n loop?: boolean | null;\n autoPlay?: boolean | null;\n width?: number;\n height?: number;\n hideControls?: boolean | null;\n}\n\nexport interface ILocalVideo extends IVideoCommon {\n type: 'Local video';\n preview: IVideoDetails;\n videoPrefix: string;\n}\n\nexport interface IFullVideo extends IVideoCommon {\n type: 'Full video';\n preview?: IVideoDetails;\n full: IVideoDetails;\n videoPrefix: string;\n}\n\nexport interface IExternalVideo extends IVideoCommon {\n type: 'External video';\n preview?: IVideoDetails;\n external: string;\n embed?: VideoTypeData;\n}\n\nexport type IVideo = ILocalVideo | IFullVideo | IExternalVideo;\n\nexport function isLocalVideo(obj: IVisualCommon | undefined | null): obj is ILocalVideo {\n return obj?.type === 'Local video';\n}\n\nexport function isFullVideo(obj: IVisualCommon | undefined | null): obj is IFullVideo {\n return obj?.type === 'Full video';\n}\n\nexport function isExternalVideo(obj: IVisualCommon | undefined | null): obj is IExternalVideo {\n return obj?.type === 'External video';\n}\n\nexport function isVideo(obj: IVisualCommon | undefined | null): obj is IVideo {\n return isLocalVideo(obj) || isFullVideo(obj) || isExternalVideo(obj);\n}\n\nexport interface IAnimation extends IVisualCommon {\n type: 'Animation';\n optimised?: IOptimisedSvg;\n animationSrc: string;\n loop?: boolean | null;\n loopDelay?: number | null;\n autoPlay?: boolean | null;\n}\n\nexport function isAnimation(obj: IVisualCommon | undefined | null) {\n return obj?.type === 'Animation';\n}\n\nexport interface IVisual {\n type: 'Visual';\n id: string;\n image?: IImage;\n video?: IVideo;\n animation?: IAnimation;\n}\n\nexport function isVisualVideo(visual: IVisual | undefined | null) {\n return visual?.video !== undefined;\n}\nexport function isVisualImage(visual: IVisual | undefined | null) {\n return visual?.image !== undefined;\n}\nexport function isVisualAnimation(visual: IVisual | undefined | null) {\n return visual?.animation !== undefined;\n}\n\nexport interface IResponsiveVisual {\n visual: IVisual;\n hideVisual?: boolean;\n mobileVisual?: IVisual;\n hideMobileVisual?: boolean;\n visualCustomSize?: number | null;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/core-data-types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Core TypeScript type definitions for SE Studio content models",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"nextjs"
|
|
29
29
|
],
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@biomejs/biome": "^2.3.
|
|
31
|
+
"@biomejs/biome": "^2.3.6",
|
|
32
32
|
"tsup": "^8.5.1",
|
|
33
33
|
"typescript": "^5.9.3",
|
|
34
|
-
"vitest": "^4.0.
|
|
34
|
+
"vitest": "^4.0.10"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@extractus/oembed-extractor": "^4.0.9"
|