@se-studio/core-data-types 1.0.18 → 1.0.19
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 +79 -56
- package/dist/index.js +25 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import { VideoTypeData } from '@extractus/oembed-extractor';
|
|
2
2
|
|
|
3
|
+
interface IBasePage extends IBaseModel {
|
|
4
|
+
type: 'Page';
|
|
5
|
+
isHomePage: boolean;
|
|
6
|
+
structuredData?: ReadonlyArray<unknown>;
|
|
7
|
+
contents?: ReadonlyArray<ITyped>;
|
|
8
|
+
tags?: ReadonlyArray<IInternalLink>;
|
|
9
|
+
}
|
|
10
|
+
declare function isPage(content: IBaseModel): content is IBasePage;
|
|
11
|
+
|
|
12
|
+
interface IBaseTag extends IBaseModel {
|
|
13
|
+
type: 'Tag';
|
|
14
|
+
tagType?: string | null;
|
|
15
|
+
contents?: ReadonlyArray<ITyped>;
|
|
16
|
+
}
|
|
17
|
+
declare function isTag(content: IBaseModel): content is IBaseTag;
|
|
18
|
+
interface IBaseTags extends IBaseModel {
|
|
19
|
+
type: 'Tags';
|
|
20
|
+
}
|
|
21
|
+
declare function isTags(content: IBaseModel): content is IBaseTags;
|
|
22
|
+
|
|
3
23
|
type Vertical = 'Top' | 'Middle' | 'Bottom';
|
|
4
24
|
type Horizontal = 'Left' | 'Middle' | 'Right';
|
|
5
25
|
interface IInternalBreakpoint {
|
|
@@ -134,11 +154,11 @@ interface ITyped {
|
|
|
134
154
|
id: string;
|
|
135
155
|
}
|
|
136
156
|
interface IPageContext {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
157
|
+
article?: IBaseArticle;
|
|
158
|
+
articleType?: IBaseArticleType;
|
|
159
|
+
person?: IBasePerson;
|
|
160
|
+
page?: IBasePage;
|
|
161
|
+
tag?: IBaseTag;
|
|
142
162
|
}
|
|
143
163
|
interface IContentContext {
|
|
144
164
|
analyticsContext?: IAnalyticsContext;
|
|
@@ -171,8 +191,6 @@ interface ILinkProps {
|
|
|
171
191
|
href?: string | null;
|
|
172
192
|
click?: () => void;
|
|
173
193
|
type: 'Blank link' | 'External link' | 'Internal link' | 'Download link';
|
|
174
|
-
backgroundColour?: string | null;
|
|
175
|
-
textColour?: string | null;
|
|
176
194
|
variant?: string;
|
|
177
195
|
size?: string;
|
|
178
196
|
}
|
|
@@ -191,24 +209,50 @@ interface IInternalLink extends ILinkProps {
|
|
|
191
209
|
hidden?: boolean | null;
|
|
192
210
|
tags?: ReadonlyArray<IInternalLink>;
|
|
193
211
|
lastModified?: Date;
|
|
212
|
+
title: string;
|
|
213
|
+
description?: string | null;
|
|
194
214
|
}
|
|
215
|
+
interface IDownloadLink extends ILinkProps {
|
|
216
|
+
type: 'Download link';
|
|
217
|
+
}
|
|
218
|
+
declare function isBlankLink(link: unknown): link is IBlankLink;
|
|
219
|
+
declare function isExternalLink(link: unknown): link is IExternalLink;
|
|
220
|
+
declare function isInternalLink(link: unknown): link is IInternalLink;
|
|
195
221
|
interface IArticleLink extends IInternalLink {
|
|
196
222
|
internalType: 'Article';
|
|
197
|
-
articleType?:
|
|
223
|
+
articleType?: IArticleTypeLink;
|
|
224
|
+
primaryTag?: ITagLink;
|
|
225
|
+
date?: string;
|
|
226
|
+
author?: IPersonLink;
|
|
198
227
|
}
|
|
199
|
-
interface
|
|
200
|
-
|
|
228
|
+
interface IArticleTypeLink extends IInternalLink {
|
|
229
|
+
internalType: 'ArticleType';
|
|
201
230
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
231
|
+
interface IPersonLink extends IInternalLink {
|
|
232
|
+
internalType: 'Person';
|
|
233
|
+
name: string;
|
|
234
|
+
jobTitle?: string | null;
|
|
235
|
+
phoneNumber: string | null;
|
|
236
|
+
emailAddress: string | null;
|
|
237
|
+
location: string | null;
|
|
238
|
+
linkedIn: string | null;
|
|
239
|
+
}
|
|
240
|
+
interface ITagLink extends IInternalLink {
|
|
241
|
+
internalType: 'Tag';
|
|
242
|
+
}
|
|
243
|
+
interface IPageLink extends IInternalLink {
|
|
244
|
+
internalType: 'Page';
|
|
245
|
+
}
|
|
246
|
+
declare function isArticleLink(link: unknown): link is IArticleLink;
|
|
247
|
+
declare function isArticleTypeLink(link: unknown): link is IArticleTypeLink;
|
|
248
|
+
declare function isTagLink(link: unknown): link is ITagLink;
|
|
249
|
+
declare function isPersonLink(link: unknown): link is IPersonLink;
|
|
250
|
+
declare function isPageLink(link: unknown): link is IPageLink;
|
|
251
|
+
declare function isDownloadLink(link: unknown): link is IDownloadLink;
|
|
206
252
|
interface INavigation {
|
|
207
253
|
id: string;
|
|
208
254
|
name: string;
|
|
209
255
|
entries: ReadonlyArray<INavigationItem>;
|
|
210
|
-
textColour?: string;
|
|
211
|
-
backgroundColour?: string;
|
|
212
256
|
}
|
|
213
257
|
interface INavigationItem {
|
|
214
258
|
id: string;
|
|
@@ -226,8 +270,6 @@ interface IBaseModel {
|
|
|
226
270
|
indexed?: boolean | null;
|
|
227
271
|
hidden?: boolean | null;
|
|
228
272
|
lastUpdated?: string | Date;
|
|
229
|
-
textColour?: string;
|
|
230
|
-
backgroundColour?: string;
|
|
231
273
|
menu?: INavigation;
|
|
232
274
|
footer?: INavigation;
|
|
233
275
|
}
|
|
@@ -242,8 +284,6 @@ interface IBaseContent {
|
|
|
242
284
|
name: string;
|
|
243
285
|
anchor?: string | null;
|
|
244
286
|
cmsLabel: string | null;
|
|
245
|
-
backgroundColour?: string;
|
|
246
|
-
textColour?: string;
|
|
247
287
|
hexColor?: string | null;
|
|
248
288
|
backgroundVisual?: IResponsiveVisual;
|
|
249
289
|
backgroundOverlayOpacity?: number | null;
|
|
@@ -253,61 +293,42 @@ interface IBaseContent {
|
|
|
253
293
|
}
|
|
254
294
|
interface IBaseComponent extends IBaseContent {
|
|
255
295
|
type: 'Component';
|
|
256
|
-
componentType: string;
|
|
257
296
|
preHeading?: string | null;
|
|
258
297
|
heading?: string | null;
|
|
259
298
|
postHeading?: string | null;
|
|
260
|
-
body?: unknown;
|
|
261
299
|
icon?: IVisual;
|
|
262
300
|
links?: ReadonlyArray<ILinkProps>;
|
|
263
301
|
otherMedia?: ReadonlyArray<IVisual>;
|
|
264
|
-
additionalCopy?: unknown;
|
|
265
302
|
}
|
|
266
303
|
declare function isComponent(obj: unknown): obj is IBaseComponent;
|
|
267
|
-
type
|
|
268
|
-
interface IBaseCollection extends IBaseContent {
|
|
304
|
+
type BaseCollectionContent = ILinkProps | IVisual;
|
|
305
|
+
interface IBaseCollection<TContents = BaseCollectionContent> extends IBaseContent {
|
|
269
306
|
type: 'Collection';
|
|
270
|
-
collectionType: string;
|
|
271
307
|
anchor?: string | null;
|
|
272
308
|
preHeading?: string | null;
|
|
273
309
|
heading?: string | null;
|
|
274
310
|
postHeading?: string | null;
|
|
275
|
-
body?: unknown;
|
|
276
311
|
icon?: IVisual;
|
|
277
312
|
links?: ReadonlyArray<ILinkProps>;
|
|
278
|
-
|
|
279
|
-
contents?: ReadonlyArray<CollectionContent>;
|
|
313
|
+
contents?: ReadonlyArray<TContents>;
|
|
280
314
|
}
|
|
281
315
|
declare function isCollection(obj: unknown): obj is IBaseCollection;
|
|
282
316
|
interface IBaseExternalComponent extends IBaseContent {
|
|
283
317
|
type: 'External component';
|
|
284
|
-
externalType: string;
|
|
285
318
|
data: unknown | null;
|
|
286
319
|
}
|
|
287
|
-
interface
|
|
320
|
+
interface IBasePerson extends IBaseModel {
|
|
288
321
|
type: 'Person';
|
|
289
322
|
jobTitle?: string | null;
|
|
290
|
-
phoneNumber
|
|
291
|
-
emailAddress
|
|
292
|
-
location
|
|
293
|
-
linkedIn
|
|
294
|
-
bio: unknown;
|
|
323
|
+
phoneNumber?: string | null;
|
|
324
|
+
emailAddress?: string | null;
|
|
325
|
+
location?: string | null;
|
|
326
|
+
linkedIn?: string | null;
|
|
295
327
|
href: string | undefined;
|
|
296
328
|
structuredData?: ReadonlyArray<unknown>;
|
|
297
329
|
contents?: ReadonlyArray<unknown>;
|
|
298
330
|
}
|
|
299
|
-
type PersonLink = Omit<
|
|
300
|
-
|
|
301
|
-
interface IBaseTag extends IBaseModel {
|
|
302
|
-
type: 'Tag';
|
|
303
|
-
tagType?: string | null;
|
|
304
|
-
contents?: ReadonlyArray<ITyped>;
|
|
305
|
-
}
|
|
306
|
-
declare function isTag(content: IBaseModel): content is IBaseTag;
|
|
307
|
-
interface IBaseTags extends IBaseModel {
|
|
308
|
-
type: 'Tags';
|
|
309
|
-
}
|
|
310
|
-
declare function isTags(content: IBaseModel): content is IBaseTags;
|
|
331
|
+
type PersonLink = Omit<IBasePerson, BaseModelLinkOmissions | 'structuredData' | 'contents'>;
|
|
311
332
|
|
|
312
333
|
interface IBaseArticle extends IBaseModel {
|
|
313
334
|
type: 'Article';
|
|
@@ -319,18 +340,20 @@ interface IBaseArticle extends IBaseModel {
|
|
|
319
340
|
declare function isArticle(content: IBaseModel): content is IBaseArticle;
|
|
320
341
|
interface IBaseArticleType extends IBaseModel {
|
|
321
342
|
type: 'Article type';
|
|
322
|
-
|
|
323
|
-
|
|
343
|
+
structuredData?: ReadonlyArray<unknown>;
|
|
344
|
+
contents?: ReadonlyArray<ITyped>;
|
|
345
|
+
searchPageContents?: ReadonlyArray<ITyped>;
|
|
324
346
|
}
|
|
325
347
|
declare function isArticleType(content: IBaseModel): content is IBaseArticleType;
|
|
326
348
|
|
|
327
|
-
interface
|
|
328
|
-
type: '
|
|
329
|
-
|
|
349
|
+
interface IBaseCustomType extends IBaseModel {
|
|
350
|
+
type: 'Custom type';
|
|
351
|
+
indexPageName: string;
|
|
352
|
+
indexPageSlug: string;
|
|
353
|
+
indexPageDescription: string;
|
|
330
354
|
structuredData?: ReadonlyArray<unknown>;
|
|
331
355
|
contents?: ReadonlyArray<ITyped>;
|
|
332
|
-
tags?: ReadonlyArray<IInternalLink>;
|
|
333
356
|
}
|
|
334
|
-
declare function
|
|
357
|
+
declare function isCustomType(content: IBaseModel): content is IBaseCustomType;
|
|
335
358
|
|
|
336
|
-
export { type
|
|
359
|
+
export { type BaseCollectionContent, type BaseContentType, type Horizontal, type IAnalyticsContext, type IAnimation, type IArticleLink, type IArticleTypeLink, type IBaseArticle, type IBaseArticleType, type IBaseCollection, type IBaseComponent, type IBaseContent, type IBaseCustomType, type IBaseExternalComponent, type IBaseModel, type IBasePage, type IBasePerson, 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 IPageLink, type IPersonLink, type IPicture, type IResponsiveVisual, type IRichTextOptions, type ISvgData, type ISvgImage, type ITagLink, type ITyped, type IVideo, type IVideoDetails, type IVisual, type IVisualCommon, type IVisualSizes, type InternalType, type PersonLink, type Vertical, isAnimation, isArticle, isArticleLink, isArticleType, isArticleTypeLink, isBlankLink, isCollection, isComponent, isCustomType, isDownloadLink, isExternalLink, isExternalVideo, isFullVideo, isImage, isInternalLink, isLocalVideo, isPage, isPageLink, isPersonLink, isPicture, isSvgData, isSvgImage, isTag, isTagLink, isTags, isVideo, isVisualAnimation, isVisualImage, isVisualVideo, processSizes };
|
package/dist/index.js
CHANGED
|
@@ -8,16 +8,31 @@ function isArticleType(content) {
|
|
|
8
8
|
|
|
9
9
|
// src/types/common.ts
|
|
10
10
|
function isBlankLink(link) {
|
|
11
|
-
return link.type === "Blank link";
|
|
11
|
+
return typeof link === "object" && link !== null && link.type === "Blank link";
|
|
12
12
|
}
|
|
13
13
|
function isExternalLink(link) {
|
|
14
|
-
return link.type === "External link";
|
|
14
|
+
return typeof link === "object" && link !== null && link.type === "External link";
|
|
15
15
|
}
|
|
16
16
|
function isInternalLink(link) {
|
|
17
|
-
return link.type === "Internal link";
|
|
17
|
+
return typeof link === "object" && link !== null && link.type === "Internal link";
|
|
18
|
+
}
|
|
19
|
+
function isArticleLink(link) {
|
|
20
|
+
return isInternalLink(link) && link.internalType === "Article";
|
|
21
|
+
}
|
|
22
|
+
function isArticleTypeLink(link) {
|
|
23
|
+
return isInternalLink(link) && link.internalType === "ArticleType";
|
|
24
|
+
}
|
|
25
|
+
function isTagLink(link) {
|
|
26
|
+
return isInternalLink(link) && link.internalType === "Tag";
|
|
27
|
+
}
|
|
28
|
+
function isPersonLink(link) {
|
|
29
|
+
return isInternalLink(link) && link.internalType === "Person";
|
|
30
|
+
}
|
|
31
|
+
function isPageLink(link) {
|
|
32
|
+
return isInternalLink(link) && link.internalType === "Page";
|
|
18
33
|
}
|
|
19
34
|
function isDownloadLink(link) {
|
|
20
|
-
return link.type === "Download link";
|
|
35
|
+
return typeof link === "object" && link !== null && link.type === "Download link";
|
|
21
36
|
}
|
|
22
37
|
function isComponent(obj) {
|
|
23
38
|
if (typeof obj !== "object" || obj === null) {
|
|
@@ -38,6 +53,11 @@ function isCollection(obj) {
|
|
|
38
53
|
return true;
|
|
39
54
|
}
|
|
40
55
|
|
|
56
|
+
// src/types/customType.ts
|
|
57
|
+
function isCustomType(content) {
|
|
58
|
+
return content.type === "Custom type";
|
|
59
|
+
}
|
|
60
|
+
|
|
41
61
|
// src/types/page.ts
|
|
42
62
|
function isPage(content) {
|
|
43
63
|
return content.type === "Page";
|
|
@@ -118,6 +138,6 @@ function isVisualAnimation(visual) {
|
|
|
118
138
|
return visual?.animation !== void 0;
|
|
119
139
|
}
|
|
120
140
|
|
|
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 };
|
|
141
|
+
export { isAnimation, isArticle, isArticleLink, isArticleType, isArticleTypeLink, isBlankLink, isCollection, isComponent, isCustomType, isDownloadLink, isExternalLink, isExternalVideo, isFullVideo, isImage, isInternalLink, isLocalVideo, isPage, isPageLink, isPersonLink, isPicture, isSvgData, isSvgImage, isTag, isTagLink, isTags, isVideo, isVisualAnimation, isVisualImage, isVisualVideo, processSizes };
|
|
122
142
|
//# sourceMappingURL=index.js.map
|
|
123
143
|
//# 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":";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;;;ACmDO,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;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,GAAA,KAAQ,QAAA,IAAY,GAAA,KAAQ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,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 lastModified?: Date;\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"]}
|
|
1
|
+
{"version":3,"sources":["../src/types/article.ts","../src/types/common.ts","../src/types/customType.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;AAgCO,SAAS,cAAc,OAAA,EAAkD;AAC9E,EAAA,OAAO,QAAQ,IAAA,KAAS,cAAA;AAC1B;;;AC+CO,SAAS,YAAY,IAAA,EAAmC;AAC7D,EAAA,OAAO,OAAO,IAAA,KAAS,QAAA,IAAY,IAAA,KAAS,IAAA,IAAS,KAAoB,IAAA,KAAS,YAAA;AACpF;AAQO,SAAS,eAAe,IAAA,EAAsC;A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AO,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 /** Optional structured data (JSON-LD, etc.) */\n structuredData?: ReadonlyArray<unknown>;\n /** Content for the article type index page - will be narrowed at project level */\n contents?: ReadonlyArray<ITyped>;\n /** Content for the article type search page - will be narrowed at project level */\n searchPageContents?: 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 { IBaseArticle, IBaseArticleType } from './article';\nimport type { IBasePage } from './page';\nimport type { IBaseTag } from './tag';\nimport 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 article?: IBaseArticle; // Article - will be narrowed at project level\n articleType?: IBaseArticleType; // ArticleType - will be narrowed at project level\n person?: IBasePerson; // Person - will be narrowed at project level\n page?: IBasePage; // Page - will be narrowed at project level\n tag?: IBaseTag; // Tag - 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 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 lastModified?: Date;\n title: string;\n description?: string | null;\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: unknown): link is IBlankLink {\n return typeof link === 'object' && link !== null && (link as IBlankLink).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: unknown): link is IExternalLink {\n return (\n typeof link === 'object' && link !== null && (link as IExternalLink).type === 'External link'\n );\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: unknown): link is IInternalLink {\n return (\n typeof link === 'object' && link !== null && (link as IInternalLink).type === 'Internal link'\n );\n}\n\nexport interface IArticleLink extends IInternalLink {\n internalType: 'Article';\n articleType?: IArticleTypeLink;\n primaryTag?: ITagLink;\n date?: string;\n author?: IPersonLink;\n}\n\nexport interface IArticleTypeLink extends IInternalLink {\n internalType: 'ArticleType';\n}\n\nexport interface IPersonLink extends IInternalLink {\n internalType: 'Person';\n name: string;\n jobTitle?: string | null;\n phoneNumber: string | null;\n emailAddress: string | null;\n location: string | null;\n linkedIn: string | null;\n}\n\nexport interface ITagLink extends IInternalLink {\n internalType: 'Tag';\n}\n\nexport interface IPageLink extends IInternalLink {\n internalType: 'Page';\n}\n\n/**\n * Type guard to check if a link is an article link.\n *\n * @param link - Link to check\n * @returns True if the link is an article link\n */\nexport function isArticleLink(link: unknown): link is IArticleLink {\n return isInternalLink(link) && link.internalType === 'Article';\n}\n\n/**\n * Type guard to check if a link is an article type link.\n *\n * @param link - Link to check\n * @returns True if the link is an article type link\n */\nexport function isArticleTypeLink(link: unknown): link is IArticleTypeLink {\n return isInternalLink(link) && link.internalType === 'ArticleType';\n}\n\n/**\n * Type guard to check if a link is a tag link.\n *\n * @param link - Link to check\n * @returns True if the link is a tag link\n */\nexport function isTagLink(link: unknown): link is ITagLink {\n return isInternalLink(link) && link.internalType === 'Tag';\n}\n\n/**\n * Type guard to check if a link is a person link.\n *\n * @param link - Link to check\n * @returns True if the link is a person link\n */\nexport function isPersonLink(link: unknown): link is IPersonLink {\n return isInternalLink(link) && link.internalType === 'Person';\n}\n\n/**\n * Type guard to check if a link is a page link.\n *\n * @param link - Link to check\n * @returns True if the link is a page link\n */\nexport function isPageLink(link: unknown): link is IPageLink {\n return isInternalLink(link) && link.internalType === 'Page';\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: unknown): link is IDownloadLink {\n return (\n typeof link === 'object' && link !== null && (link as IDownloadLink).type === 'Download link'\n );\n}\n\nexport interface INavigation {\n id: string;\n name: string;\n entries: ReadonlyArray<INavigationItem>;\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 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 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 preHeading?: string | null;\n heading?: string | null;\n postHeading?: string | null;\n icon?: IVisual;\n links?: ReadonlyArray<ILinkProps>;\n otherMedia?: ReadonlyArray<IVisual>;\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 BaseCollectionContent = ILinkProps | IVisual;\n\nexport interface IBaseCollection<TContents = BaseCollectionContent> extends IBaseContent {\n type: 'Collection';\n anchor?: string | null;\n preHeading?: string | null;\n heading?: string | null;\n postHeading?: string | null;\n icon?: IVisual;\n links?: ReadonlyArray<ILinkProps>;\n contents?: ReadonlyArray<TContents>;\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 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 IBasePerson 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 href: string | undefined;\n structuredData?: ReadonlyArray<unknown>;\n contents?: ReadonlyArray<unknown>; // PageContent - will be narrowed at project level\n}\n\nexport type PersonLink = Omit<IBasePerson, BaseModelLinkOmissions | 'structuredData' | 'contents'>;\n\nexport function isPerson(content: IBaseModel): content is IBasePerson {\n return content.type === 'Person';\n}\n","import type { IBaseModel, ITyped } from './common';\n\n/**\n * Base interface for custom type content models.\n *\n * Custom types represent index pages for categories like Topics or Resources.\n * They provide configuration for both the main index page and potentially\n * individual entry pages.\n */\nexport interface IBaseCustomType extends IBaseModel {\n /** Content type discriminator - always 'Custom type' */\n type: 'Custom type';\n /** Index page name for display purposes */\n indexPageName: string;\n /** Index page slug used for URL routing */\n indexPageSlug: string;\n /** Index page description for SEO/display */\n indexPageDescription: string;\n /** Optional structured data (JSON-LD, etc.) */\n structuredData?: ReadonlyArray<unknown>;\n /** Content for the custom type index page - will be narrowed at project level */\n contents?: ReadonlyArray<ITyped>;\n}\n\n/**\n * Type guard to check if content is a custom type.\n *\n * @param content - Content model to check\n * @returns True if content is a custom type\n */\nexport function isCustomType(content: IBaseModel): content is IBaseCustomType {\n return content.type === 'Custom type';\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"]}
|