@se-studio/core-data-types 1.0.14 → 1.0.16

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/README.md CHANGED
@@ -35,51 +35,78 @@ const page: IPage = {
35
35
  type PartialPage = DeepPartial<IPage>;
36
36
  ```
37
37
 
38
- ## API Overview
39
-
40
- ### Page Types
41
-
42
- - **`IPage`** - Base interface for page content models
43
- - `id: string` - Unique identifier
44
- - `slug: string` - URL-friendly slug
45
- - `title: string` - Page title
46
- - `seo?: ISeoMetadata` - Optional SEO metadata
47
- - `publishedAt?: string` - Publication date
48
- - `updatedAt?: string` - Last updated date
49
- - `locale?: string` - Content locale
50
- - `sections?: unknown[]` - Content sections (to be defined)
51
-
52
- - **`IPageMetadata`** - Page metadata without content sections
53
-
54
- ### Common Types
55
-
56
- - **`ISeoMetadata`** - SEO metadata structure
57
- - `title?: string`
58
- - `description?: string`
59
- - `keywords?: string[]`
60
- - `ogImage?: string`
61
- - `noIndex?: boolean`
62
- - `canonicalUrl?: string`
63
-
64
- - **`IAsset`** - Image/media asset structure
65
- - `url: string`
66
- - `title?: string`
67
- - `description?: string`
68
- - `width?: number`
69
- - `height?: number`
70
- - `contentType?: string`
71
-
72
- - **`ILink`** - Link/reference structure
73
- - `text: string`
74
- - `url: string`
75
- - `target?: '_blank' | '_self'`
76
- - `ariaLabel?: string`
38
+ ## API Reference
39
+
40
+ ### Content Model Types
41
+
42
+ #### Pages
43
+ - **`IBasePage`** - Base interface for page content models
44
+ - Extends `IBaseModel` with page-specific properties
45
+ - `type: 'Page'` - Content type discriminator
46
+ - `isHomePage: boolean` - Whether this is the home page
47
+ - `contents?: ReadonlyArray<ITyped>` - Page content sections
48
+ - `tags?: ReadonlyArray<IInternalLink>` - Tags associated with the page
49
+ - `structuredData?: ReadonlyArray<unknown>` - Optional structured data
50
+
51
+ - **`PageLink`** - Page link type (metadata without full content)
52
+
53
+ #### Articles
54
+ - **`IBaseArticle`** - Base interface for article content models
55
+ - `type: 'Article'` - Content type discriminator
56
+ - `articleType?: IInternalLink` - Link to the article type
57
+ - `contents?: ReadonlyArray<ITyped>` - Article content sections
58
+ - `tags?: ReadonlyArray<IInternalLink>` - Tags associated with the article
59
+
60
+ - **`IBaseArticleType`** - Base interface for article type content models
61
+ - `type: 'Article type'` - Content type discriminator
62
+ - `indexPageContent?: ReadonlyArray<ITyped>` - Content for index page
63
+ - `searchPageContent?: ReadonlyArray<ITyped>` - Content for search page
64
+
65
+ #### Components & Collections
66
+ - **`IBaseComponent`** - Base interface for component content models
67
+ - **`IBaseCollection`** - Base interface for collection content models
68
+ - **`IBaseExternalComponent`** - Base interface for external component models
69
+
70
+ #### Visual/Asset Types
71
+ - **`IVisual`** - Union type for visual content (Image | Video | Animation)
72
+ - **`IImage`** - Image types (Picture | SvgImage | SvgData)
73
+ - **`IVideo`** - Video content type
74
+ - **`IAnimation`** - Animation/Lottie content type
75
+ - **`IResponsiveVisual`** - Responsive visual with breakpoint configuration
76
+
77
+ #### Link Types
78
+ - **`ILinkProps`** - Base link properties
79
+ - **`IInternalLink`** - Internal link to CMS content
80
+ - **`IExternalLink`** - External link
81
+ - **`IDownloadLink`** - Download link
82
+ - **`IBlankLink`** - Blank link (no href)
83
+
84
+ #### Context Types
85
+ - **`IPageContext`** - Page context with links to related content
86
+ - **`IContentContext`** - Content context for component rendering
87
+ - **`IAnalyticsContext`** - Analytics context for tracking
88
+
89
+ ### Type Guard Functions
90
+
91
+ - **`isPage(content)`** - Check if content is a page
92
+ - **`isArticle(content)`** - Check if content is an article
93
+ - **`isArticleType(content)`** - Check if content is an article type
94
+ - **`isComponent(content)`** - Check if content is a component
95
+ - **`isCollection(content)`** - Check if content is a collection
96
+ - **`isInternalLink(link)`** - Check if link is internal
97
+ - **`isExternalLink(link)`** - Check if link is external
98
+ - **`isDownloadLink(link)`** - Check if link is a download link
99
+ - **`isImage(visual)`** - Check if visual is an image
100
+ - **`isVideo(visual)`** - Check if visual is a video
101
+ - **`isAnimation(visual)`** - Check if visual is an animation
77
102
 
78
103
  ### Utility Types
79
104
 
80
- - **`DeepPartial<T>`** - Makes all nested properties optional
105
+ - **`DeepPartial<T>`** - Makes all nested properties optional (recursive)
81
106
  - **`Prettify<T>`** - Improves type readability in IDE tooltips
82
107
 
108
+ For detailed JSDoc documentation on all types and functions, see the TypeScript declaration files (`.d.ts`) in the package.
109
+
83
110
  ## Development
84
111
 
85
112
  This package is part of the SE Studio monorepo. To work on this package:
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;;;ACmEO,SAAS,YAAY,IAAA,EAAsC;AAChE,EAAA,OAAO,KAAK,IAAA,KAAS,YAAA;AACvB;AAEO,SAAS,eAAe,IAAA,EAAyC;AACtE,EAAA,OAAO,KAAK,IAAA,KAAS,eAAA;AACvB;AAEO,SAAS,eAAe,IAAA,EAAyC;AACtE,EAAA,OAAO,KAAK,IAAA,KAAS,eAAA;AACvB;AAEO,SAAS,eAAe,IAAA,EAAyC;AACtE,EAAA,OAAO,KAAK,IAAA,KAAS,eAAA;AACvB;AAmEO,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;AAuBO,SAAS,aAAa,GAAA,EAAsC;AACjE,EAAA,IAAI,OAAO,G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,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 otherMedia?: ReadonlyArray<IVisual>;\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 minWidth: number;\n proportion: number;\n pixels: number;\n size: string;\n}\ntype IBreakpoint = Pick<IInternalBreakpoint, 'minWidth'> &\n Partial<Omit<IInternalBreakpoint, 'minWidth'>>;\nexport interface IVisualSizes {\n defaultSize?: string;\n defaultPixels?: number;\n breakpoints?: IBreakpoint[];\n}\n\nfunction fillInBreakpoints(breakpoints?: IBreakpoint[]): IInternalBreakpoint[] | undefined {\n return breakpoints?.map(({ minWidth, proportion, pixels, size }) => {\n if (proportion) {\n return {\n minWidth,\n proportion,\n pixels: Math.round(minWidth * proportion),\n size: `${Math.round(100 * proportion)}vw`,\n };\n }\n if (pixels) {\n const proportion = Math.round(minWidth / pixels);\n return {\n minWidth,\n proportion,\n pixels,\n size: size ?? `${Math.round(100 * proportion)}vw`,\n };\n }\n\n return { minWidth, proportion: 1, pixels: minWidth, 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":";AAwCO,SAAS,UAAU,OAAA,EAA8C;AACtE,EAAA,OAAO,QAAQ,IAAA,KAAS,SAAA;AAC1B;AA8BO,SAAS,cAAc,OAAA,EAAkD;AAC9E,EAAA,OAAO,QAAQ,IAAA,KAAS,cAAA;AAC1B;;;ACkDO,SAAS,YAAY,IAAA,EAAsC;AAChE,EAAA,OAAO,KAAK,IAAA,KAAS,YAAA;AACvB;AAQO,SAAS,eAAe,IAAA,EAAyC;AACtE,EAAA,OAAO,KAAK,IAAA,KAAS,eAAA;AACvB;AAQO,SAAS,eAAe,IAAA,EAAyC;AACtE,EAAA,OAAO,KAAK,IAAA,KAAS,eAAA;AACvB;AAQO,SAAS,eAAe,IAAA,EAAyC;AACtE,EAAA,OAAO,KAAK,IAAA,KAAS,eAAA;AACvB;AAmEO,SAAS,YAAY,GAAA,EAAqC;AAC/D,EAAA,IAAI,OAAO,GAAA,KAAQ,QAAA,IAAY,GAAA,KAAQ,IAAA,EAAM;AAC3C,IAAA,OAAO,KAAA;AAAA,EACT;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UO,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\n/**\n * Base interface for article content models.\n *\n * Extends IBaseModel with article-specific properties. Projects should extend\n * this interface with additional fields from their Contentful article content type.\n */\nexport interface IBaseArticle extends IBaseModel {\n /** Content type discriminator - always 'Article' */\n type: 'Article';\n /** Link to the article type (e.g., 'blog', 'news') */\n articleType?: IInternalLink;\n /** Optional structured data (JSON-LD, etc.) */\n structuredData?: ReadonlyArray<unknown>;\n /** Article content sections - will be narrowed at project level */\n contents?: ReadonlyArray<ITyped>;\n /** Tags associated with the article */\n tags?: ReadonlyArray<IInternalLink>;\n}\n\n/**\n * Article link type (article metadata without full content).\n *\n * Used for article listings, related articles, etc. Omits heavy content fields.\n */\nexport type ArticleLink = Omit<\n IBaseArticle,\n BaseModelLinkOmissions | 'structuredData' | 'contents' | 'tags'\n> & {\n tags?: ReadonlyArray<TagLink>;\n};\n\n/**\n * Type guard to check if content is an article.\n *\n * @param content - Content model to check\n * @returns True if content is an article\n */\nexport function isArticle(content: IBaseModel): content is IBaseArticle {\n return content.type === 'Article';\n}\n\n/**\n * Base interface for article type content models.\n *\n * Article types represent categories of articles (e.g., 'Blog', 'News', 'Press Releases').\n */\nexport interface IBaseArticleType extends IBaseModel {\n /** Content type discriminator - always 'Article type' */\n type: 'Article type';\n /** Content for the article type index page - will be narrowed at project level */\n indexPageContent?: ReadonlyArray<ITyped>;\n /** Content for the article type search page - will be narrowed at project level */\n searchPageContent?: ReadonlyArray<ITyped>;\n}\n\n/**\n * Article type link (article type metadata without full content).\n */\nexport type ArticleTypeLink = Omit<\n IBaseArticleType,\n BaseModelLinkOmissions | 'indexPageContent' | 'searchPageContent'\n>;\n\n/**\n * Type guard to check if content is an article type.\n *\n * @param content - Content model to check\n * @returns True if content is an article type\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 *\n * Recursively makes all properties optional, including nested objects.\n *\n * @example\n * ```ts\n * type PartialPage = DeepPartial<IBasePage>;\n * // All properties of IBasePage and nested objects are now optional\n * ```\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 *\n * Flattens intersection types and makes them easier to read in autocomplete.\n *\n * @example\n * ```ts\n * type Readable = Prettify<A & B & C>;\n * // IDE will show a cleaner type instead of A & B & C\n * ```\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\n/**\n * Type guard to check if a link is a blank link (no href).\n *\n * @param link - Link to check\n * @returns True if link is a blank link\n */\nexport function isBlankLink(link: ILinkProps): link is IBlankLink {\n return link.type === 'Blank link';\n}\n\n/**\n * Type guard to check if a link is an external link.\n *\n * @param link - Link to check\n * @returns True if link is an external link\n */\nexport function isExternalLink(link: ILinkProps): link is IExternalLink {\n return link.type === 'External link';\n}\n\n/**\n * Type guard to check if a link is an internal link (to CMS content).\n *\n * @param link - Link to check\n * @returns True if link is an internal link\n */\nexport function isInternalLink(link: ILinkProps): link is IInternalLink {\n return link.type === 'Internal link';\n}\n\n/**\n * Type guard to check if a link is a download link.\n *\n * @param link - Link to check\n * @returns True if link is a download link\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 otherMedia?: ReadonlyArray<IVisual>;\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\n/**\n * Base interface for page content models.\n *\n * Extends IBaseModel with page-specific properties. Projects should extend\n * this interface with additional fields from their Contentful page content type.\n *\n * @example\n * ```ts\n * interface IMyPage extends IBasePage {\n * hero: { title: string; image: IVisual };\n * sections: ReadonlyArray<IMyComponent>;\n * }\n * ```\n */\nexport interface IBasePage extends IBaseModel {\n /** Content type discriminator - always 'Page' */\n type: 'Page';\n /** Whether this is the home page */\n isHomePage: boolean;\n /** Optional structured data (JSON-LD, etc.) */\n structuredData?: ReadonlyArray<unknown>;\n /** Page content sections (components, collections, etc.) - will be narrowed at project level */\n contents?: ReadonlyArray<ITyped>;\n /** Tags associated with the page */\n tags?: ReadonlyArray<IInternalLink>;\n}\n\n/**\n * Page link type (page metadata without full content).\n *\n * Used for navigation, related pages, etc. Omits heavy content fields.\n */\nexport type PageLink = Omit<IBasePage, BaseModelLinkOmissions | 'structuredData' | 'contents'>;\n\n/**\n * Type guard to check if content is a page.\n *\n * @param content - Content model to check\n * @returns True if content is a page, false otherwise\n *\n * @example\n * ```ts\n * import { isPage } from '@se-studio/core-data-types';\n *\n * if (isPage(content)) {\n * // content is now typed as IBasePage\n * console.log(content.slug, content.isHomePage);\n * }\n * ```\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 minWidth: number;\n proportion: number;\n pixels: number;\n size: string;\n}\ntype IBreakpoint = Pick<IInternalBreakpoint, 'minWidth'> &\n Partial<Omit<IInternalBreakpoint, 'minWidth'>>;\nexport interface IVisualSizes {\n defaultSize?: string;\n defaultPixels?: number;\n breakpoints?: IBreakpoint[];\n}\n\nfunction fillInBreakpoints(breakpoints?: IBreakpoint[]): IInternalBreakpoint[] | undefined {\n return breakpoints?.map(({ minWidth, proportion, pixels, size }) => {\n if (proportion) {\n return {\n minWidth,\n proportion,\n pixels: Math.round(minWidth * proportion),\n size: `${Math.round(100 * proportion)}vw`,\n };\n }\n if (pixels) {\n const proportion = Math.round(minWidth / pixels);\n return {\n minWidth,\n proportion,\n pixels,\n size: size ?? `${Math.round(100 * proportion)}vw`,\n };\n }\n\n return { minWidth, proportion: 1, pixels: minWidth, 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.14",
3
+ "version": "1.0.16",
4
4
  "description": "Core TypeScript type definitions for SE Studio content models",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,10 +23,19 @@
23
23
  "keywords": [
24
24
  "typescript",
25
25
  "types",
26
+ "type-definitions",
26
27
  "contentful",
27
28
  "cms",
28
- "nextjs"
29
+ "nextjs",
30
+ "next.js",
31
+ "type-guards",
32
+ "content-models",
33
+ "typescript-types"
29
34
  ],
35
+ "homepage": "https://github.com/Something-Else-Studio/se-core-product#readme",
36
+ "bugs": {
37
+ "url": "https://github.com/Something-Else-Studio/se-core-product/issues"
38
+ },
30
39
  "devDependencies": {
31
40
  "@biomejs/biome": "^2.3.7",
32
41
  "tsup": "^8.5.1",