@ethlete/contentful 3.7.2 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -1,10 +1,529 @@
1
- export * from './lib/components/audio';
2
- export * from './lib/components/file';
3
- export * from './lib/components/image';
4
- export * from './lib/components/rich-text-renderer';
5
- export * from './lib/components/video';
6
- export * from './lib/constants';
7
- export * from './lib/contentful.imports';
8
- export * from './lib/gql';
9
- export * from './lib/types';
10
- export * from './lib/utils';
1
+ import * as _angular_core from '@angular/core';
2
+ import { ComponentRef, ViewContainerRef, Renderer2, ElementRef, InputSignal, InjectionToken } from '@angular/core';
3
+ import { NgClassType } from '@ethlete/core';
4
+ import * as _ethlete_query from '@ethlete/query';
5
+ import { ComponentType } from '@angular/cdk/portal';
6
+ import { Mark, BLOCKS, INLINES, NodeData, Block } from '@contentful/rich-text-types';
7
+ import * as _ethlete_cdk from '@ethlete/cdk';
8
+ import { PictureSource } from '@ethlete/cdk';
9
+
10
+ declare const GQL_FRAGMENT_CONTENTFUL_ASSET: _ethlete_query.GQL;
11
+ interface ContentfulGqlAsset {
12
+ sys: {
13
+ id: string;
14
+ };
15
+ title: string | null;
16
+ contentType: string | null;
17
+ url: string | null;
18
+ description: string | null;
19
+ width: number | null;
20
+ height: number | null;
21
+ size: number | null;
22
+ }
23
+ declare const isContentfulGqlAsset: (asset: any) => asset is ContentfulGqlAsset;
24
+ type ContentfulGqlWhereFilter<TLinkedFrom extends Record<string, unknown> = Record<string, unknown>> = {
25
+ /**
26
+ * Filer by ids.
27
+ * @see https://www.contentful.com/developers/docs/references/graphql/#/reference/collection-filters/sys-filters
28
+ */
29
+ sys?: {
30
+ id?: string;
31
+ id_not?: string;
32
+ id_in?: string[];
33
+ id_not_in?: string[];
34
+ id_contains?: string;
35
+ id_not_contains?: string;
36
+ };
37
+ /**
38
+ * Filer by tags.
39
+ * @see https://www.contentful.com/developers/docs/references/graphql/#/reference/collection-filters/contentfulmetadata-filters
40
+ */
41
+ contentfulMetadata?: {
42
+ tags_exists?: boolean;
43
+ tags?: {
44
+ id_contains_some?: string[];
45
+ id_contains_none?: string[];
46
+ id_contains_all?: string[];
47
+ };
48
+ };
49
+ /**
50
+ * Retrieve a collection of entries linked to the specified entry or asset.
51
+ * @see https://www.contentful.com/developers/docs/references/graphql/#links-to-a-specific-item
52
+ */
53
+ linkedFrom?: TLinkedFrom;
54
+ };
55
+ type ContentfulGqlOrder = `${string}_${'ASC' | 'DESC'}`;
56
+ type ContentfulGqlCollectionFilterVariables<TCustomWhere extends Record<string, unknown> = Record<string, unknown>, TLinkedFrom extends Record<string, unknown> = Record<string, unknown>> = {
57
+ /**
58
+ * Zero-indexed offset in the collection from which items are fetched
59
+ * @default 0
60
+ */
61
+ skip?: number;
62
+ /**
63
+ * Maximum number of items to fetch. Maximum is 1000.
64
+ * @default 100
65
+ */
66
+ limit?: number;
67
+ /**
68
+ * Filter specifications to apply on the collection query.
69
+ * @see https://www.contentful.com/developers/docs/references/graphql/#/reference/collection-filters
70
+ */
71
+ where?: TCustomWhere & ContentfulGqlWhereFilter<TLinkedFrom>;
72
+ /**
73
+ * Order specifications to apply on the collection query.
74
+ * @see https://www.contentful.com/developers/docs/references/graphql/#/reference/collection-order
75
+ */
76
+ order?: ContentfulGqlOrder[];
77
+ /**
78
+ * When set to `true` the field will be resolved with non published content.
79
+ * @default false
80
+ */
81
+ preview?: boolean;
82
+ /**
83
+ * Locale for the collection items. If not set the default locale is used.
84
+ */
85
+ locale?: string;
86
+ };
87
+
88
+ declare const RENDER_COMMAND_TYPE: {
89
+ readonly HTML_OPEN: 0;
90
+ readonly HTML_CLOSE: 1;
91
+ readonly TEXT: 2;
92
+ readonly COMPONENT: 3;
93
+ };
94
+ declare const RENDER_COMMAND_POSITION: {
95
+ readonly TYPE: 0;
96
+ readonly NESTING_LEVEL: 1;
97
+ readonly DOM_POSITION: 2;
98
+ readonly INDEX: 3;
99
+ };
100
+ declare const HTML_OPEN_RENDER_COMMAND_POSITION: {
101
+ readonly ATTRIBUTES: 4;
102
+ readonly TAG_NAME: 5;
103
+ readonly ELEMENT_ID: 6;
104
+ };
105
+ declare const HTML_CLOSE_RENDER_COMMAND_POSITION: {
106
+ readonly TAG_NAME: 4;
107
+ readonly ELEMENT_ID: 5;
108
+ };
109
+ declare const TEXT_RENDER_COMMAND_POSITION: {
110
+ readonly ATTRIBUTES: 4;
111
+ readonly TEXT: 5;
112
+ readonly TEXT_ID: 6;
113
+ };
114
+ declare const COMPONENT_RENDER_COMMAND_POSITION: {
115
+ readonly ATTRIBUTES: 4;
116
+ readonly COMPONENT: 5;
117
+ readonly INPUTS: 6;
118
+ readonly COMPONENT_ID: 7;
119
+ };
120
+ type HtmlOpenRenderCommand = [
121
+ type: typeof RENDER_COMMAND_TYPE.HTML_OPEN,
122
+ nestingLevel: number,
123
+ domPosition: number,
124
+ index: number,
125
+ attributes: Record<string, string>,
126
+ tagName: string,
127
+ textId: string
128
+ ];
129
+ type HtmlCloseRenderCommand = [
130
+ type: typeof RENDER_COMMAND_TYPE.HTML_CLOSE,
131
+ nestingLevel: number,
132
+ domPosition: number,
133
+ index: number,
134
+ tagName: string,
135
+ elementId: string
136
+ ];
137
+ type TextRenderCommand = [
138
+ type: typeof RENDER_COMMAND_TYPE.TEXT,
139
+ nestingLevel: number,
140
+ domPosition: number,
141
+ index: number,
142
+ attributes: Record<string, string>,
143
+ text: string,
144
+ elementId: string
145
+ ];
146
+ type ComponentRenderCommand = [
147
+ type: typeof RENDER_COMMAND_TYPE.COMPONENT,
148
+ nestingLevel: number,
149
+ domPosition: number,
150
+ index: number,
151
+ attributes: Record<string, string>,
152
+ component: ComponentType<unknown>,
153
+ inputs: Record<string, unknown>,
154
+ componentId: string
155
+ ];
156
+ type RenderCommand = HtmlOpenRenderCommand | HtmlCloseRenderCommand | TextRenderCommand | ComponentRenderCommand;
157
+ declare const RENDER_INSTRUCTION_POSITION: {
158
+ readonly TYPE: 0;
159
+ readonly COMMAND: 1;
160
+ };
161
+ declare const RENDER_INSTRUCTION_TYPE: {
162
+ readonly CREATE: 0;
163
+ readonly UPDATE: 1;
164
+ readonly DELETE: 2;
165
+ readonly MOVE: 3;
166
+ };
167
+ type RenderInstructionTypeValue = (typeof RENDER_INSTRUCTION_TYPE)[keyof typeof RENDER_INSTRUCTION_TYPE];
168
+ type RenderInstruction = [RenderInstructionTypeValue, RenderCommand];
169
+ declare const marksToClass: (marks: Mark[]) => string;
170
+ declare const isHtmlOpenRenderCommand: (command: RenderCommand) => command is HtmlOpenRenderCommand;
171
+ declare const isHtmlCloseRenderCommand: (command: RenderCommand) => command is HtmlCloseRenderCommand;
172
+ declare const isTextRenderCommand: (command: RenderCommand) => command is TextRenderCommand;
173
+ declare const isComponentRenderCommand: (command: RenderCommand) => command is ComponentRenderCommand;
174
+ declare const getRenderCommandId: (command: RenderCommand) => string;
175
+ type ExecutedCommandCacheItemBase = {
176
+ element: HTMLElement;
177
+ };
178
+ type ExecutedComponentCommandCacheItem = {
179
+ command: ComponentRenderCommand;
180
+ componentRef: ComponentRef<unknown>;
181
+ } & ExecutedCommandCacheItemBase;
182
+ type ExecutedHtmlCommandCacheItem = {
183
+ command: HtmlOpenRenderCommand | HtmlCloseRenderCommand;
184
+ } & ExecutedCommandCacheItemBase;
185
+ type ExecutedTextCommandCacheItem = {
186
+ command: TextRenderCommand;
187
+ textNode: unknown;
188
+ } & ExecutedCommandCacheItemBase;
189
+ type ExecutedCommandCacheItem = ExecutedComponentCommandCacheItem | ExecutedHtmlCommandCacheItem | ExecutedTextCommandCacheItem;
190
+ declare const isExecutedComponentCommandCacheItem: (cache: ExecutedCommandCacheItem) => cache is ExecutedComponentCommandCacheItem;
191
+ declare const isExecutedHtmlOrTextCommandCacheItem: (cache: ExecutedCommandCacheItem) => cache is ExecutedHtmlCommandCacheItem;
192
+ declare const isExecutedTextCommandCacheItem: (cache: ExecutedCommandCacheItem) => cache is ExecutedTextCommandCacheItem;
193
+ declare const ET_CONTENTFUL_ANY_ENTRY_CONTENT_TYPE_SYS_ID = "$$$_et-contentful-any-entry-content-type-sys-id";
194
+ type ContentfulIncludeMap = {
195
+ /**
196
+ * Select an entry by its ID and content type ID.
197
+ *
198
+ * The content type ID can be found inside the entry -> sys -> contentType -> sys -> id property.
199
+ *
200
+ * You can provide the `ET_CONTENTFUL_ANY_ENTRY_CONTENT_TYPE_SYS_ID` constant to match any entry sys ID.
201
+ * But be aware that this will return the entry as is without any type checking.
202
+ */
203
+ getEntry: <T extends {
204
+ [key: string]: any;
205
+ }>(id: string, contentTypeId: string) => ContentfulEntry<T> | null;
206
+ /**
207
+ * Select multiple entries by their IDs and content type ID.
208
+ * If an entry is not found, it will be omitted from the result.
209
+ *
210
+ * The content type ID can be found inside the entry -> sys -> contentType -> sys -> id property.
211
+ *
212
+ * You can provide the `ET_CONTENTFUL_ANY_ENTRY_CONTENT_TYPE_SYS_ID` constant to match any entry sys ID.
213
+ * But be aware that this will return the entry as is without any type checking.
214
+ */
215
+ getEntries: <T extends {
216
+ [key: string]: any;
217
+ }>(ids: string[] | ContentfulEntryLinkItem[], contentTypeId: string) => ContentfulEntry<T>[];
218
+ /**
219
+ * Select an asset by its ID.
220
+ */
221
+ getAsset: (id: string) => ContentfulRestAsset | null;
222
+ /**
223
+ * Select multiple assets by their IDs. If an asset is not found, it will be omitted from the result.
224
+ */
225
+ getAssets: (ids: string[]) => ContentfulRestAsset[];
226
+ };
227
+ interface CreateContentfulIncludeMapConfig {
228
+ /** The entries that should be present inside the map */
229
+ entries: ContentfulEntry[];
230
+ /** The assets that should be present inside the map */
231
+ assets: ContentfulRestAsset[];
232
+ }
233
+ /**
234
+ * Create a contentful include map using the provided entries and assets.
235
+ */
236
+ declare const createContentfulIncludeMap: (config: CreateContentfulIncludeMapConfig) => ContentfulIncludeMap;
237
+ declare class ContentfulRichTextRendererComponent {
238
+ _viewContainerRef: ViewContainerRef;
239
+ _renderer: Renderer2;
240
+ _elementRef: ElementRef<HTMLElement>;
241
+ _document: Document;
242
+ _config: ContentfulConfig;
243
+ /**
244
+ * A cache for all executed commands that are not deleted.
245
+ * This is used to keep track of all rendered elements and components.
246
+ * The key is the render command element ID.
247
+ */
248
+ _executedCommandsCache: Map<string, ExecutedCommandCacheItem>;
249
+ /**
250
+ * The contentful response gotten via their REST api.
251
+ * @see https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/entries/entries-collection
252
+ */
253
+ content: _angular_core.InputSignal<ContentfulCollection | null | undefined>;
254
+ /**
255
+ * The path to where the rich text field is inside the contentful response. Dot and array notation is allowed.
256
+ * @example "items[0].fields.html"
257
+ */
258
+ richTextPath: _angular_core.InputSignal<string>;
259
+ /**
260
+ * A map of all includes in the contentful response.
261
+ * This is useful for looking up assets and entries that are referenced in the rich text without having to use loops.
262
+ */
263
+ contentIncludesMap: _angular_core.Signal<ContentfulIncludeMap>;
264
+ /**
265
+ * The rich text data that should be rendered.
266
+ */
267
+ richTextData: _angular_core.Signal<RichTextResponse | null>;
268
+ renderCommands: _angular_core.Signal<RenderCommand[]>;
269
+ renderCommandHistory: _angular_core.Signal<[RenderCommand[], RenderCommand[]]>;
270
+ previousRenderCommandMap: _angular_core.Signal<Map<string | number, RenderCommand>>;
271
+ renderInstructions: _angular_core.Signal<RenderInstruction[]>;
272
+ constructor();
273
+ private _createRenderCommands;
274
+ private _execInstructions;
275
+ private _runCreateInstruction;
276
+ private _runUpdateInstruction;
277
+ private _runMoveInstruction;
278
+ private _runDeleteInstruction;
279
+ private _getComponentRootNode;
280
+ private _updateComponentInputs;
281
+ private _findParent;
282
+ private _findFollowingElement;
283
+ private _renderInsertOrAppend;
284
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ContentfulRichTextRendererComponent, never>;
285
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ContentfulRichTextRendererComponent, "et-contentful-rich-text-renderer", never, { "content": { "alias": "content"; "required": true; "isSignal": true; }; "richTextPath": { "alias": "richTextPath"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
286
+ }
287
+
288
+ declare const isRichTextRootNode: (node: unknown) => node is RichTextResponse;
289
+ declare const translateContentfulNodeTypeToHtmlTag: (nodeType: "text" | BLOCKS | INLINES) => "document" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "ul" | "ol" | "li" | "hr" | "blockquote" | "table" | "tr" | "td" | "th" | "div" | "a" | "span";
290
+
291
+ type ContentfulImageResizeBehavior = 'pad' | 'crop' | 'fill' | 'scale' | 'thumb' | 'fit';
292
+ type ContentfulImageFocusArea = 'top' | 'bottom' | 'left' | 'right' | 'center' | 'top_left' | 'top_right' | 'bottom_left' | 'bottom_right' | 'face' | 'faces';
293
+ type ComponentLikeWithAsset = ComponentType<{
294
+ asset: InputSignal<ContentfulRestAsset | ContentfulGqlAsset | null | undefined>;
295
+ }>;
296
+ type ComponentLikeWithContentfulRendererInputs = ComponentType<{
297
+ fields?: InputSignal<any>;
298
+ includes?: InputSignal<ContentfulIncludeMap>;
299
+ metadata?: InputSignal<ContentfulMetadata>;
300
+ sys?: InputSignal<ContentfulEntrySys>;
301
+ }>;
302
+ interface ContentfulAssetComponents {
303
+ file: ComponentLikeWithAsset;
304
+ image: ComponentLikeWithAsset;
305
+ video: ComponentLikeWithAsset;
306
+ audio: ComponentLikeWithAsset;
307
+ }
308
+ interface ContentfulConfig {
309
+ /**
310
+ * Default components for rendering contentful assets
311
+ */
312
+ components: ContentfulAssetComponents;
313
+ /**
314
+ * Component for rendering embedded entries
315
+ */
316
+ customComponents: Record<string, ComponentLikeWithContentfulRendererInputs>;
317
+ /**
318
+ * Determines if the contentful rich text renderer should render the contentful rich text with tailwind css classes
319
+ */
320
+ useTailwindClasses: boolean;
321
+ /**
322
+ * Default options for the contentful image api
323
+ */
324
+ imageOptions: {
325
+ /**
326
+ * Source set sizes. Eg.
327
+ * - `"400"` - 400px width
328
+ * - `"400x300"` - 400px width and 300px height
329
+ * - `"400w"` - 400px width
330
+ * - `"400h"` - 400px height
331
+ * - `"400wx300h"` - 400px width and 300px height
332
+ **/
333
+ srcsetSizes: string[];
334
+ /**
335
+ * Sizes for the image. Eg.
336
+ * - `"100vw"` - 100% of the viewport width
337
+ * - `"50vw"` - 50% of the viewport width
338
+ * - `(min-width: 30em) 30em"` - 30em if the viewport is at least 30em wide
339
+ */
340
+ sizes: string[];
341
+ /**
342
+ * Background color for the image in hex. Eg. `"000000"`
343
+ */
344
+ backgroundColor: string | null;
345
+ };
346
+ }
347
+ type ContentfulLinkType = 'Space' | 'ContentType' | 'Environment' | 'Entry' | 'Asset' | 'Tag';
348
+ interface ContentfulLink<T extends ContentfulLinkType> {
349
+ type: 'Link';
350
+ linkType: T;
351
+ id: string;
352
+ }
353
+ type ContentfulSpaceLink = ContentfulLink<'Space'>;
354
+ type ContentfulEnvironmentLink = ContentfulLink<'Environment'>;
355
+ type ContentfulContentTypeLink = ContentfulLink<'ContentType'>;
356
+ type ContentfulEntryLink = ContentfulLink<'Entry'>;
357
+ type ContentfulAssetLink = ContentfulLink<'Asset'>;
358
+ type ContentfulTagLink = ContentfulLink<'Tag'>;
359
+ interface ContentfulTagLinkItem {
360
+ sys: ContentfulTagLink;
361
+ }
362
+ interface ContentfulEntryLinkItem {
363
+ sys: ContentfulEntryLink;
364
+ }
365
+ interface ContentfulAssetLinkItem {
366
+ sys: ContentfulAssetLink;
367
+ }
368
+ interface ContentfulMetadata {
369
+ tags: ContentfulTagLinkItem[];
370
+ }
371
+ type ContentfulSys = {
372
+ type: string;
373
+ id: string;
374
+ createdAt: string;
375
+ updatedAt: string;
376
+ locale: string;
377
+ revision?: number;
378
+ space?: {
379
+ sys: ContentfulSpaceLink;
380
+ };
381
+ environment?: {
382
+ sys: ContentfulEnvironmentLink;
383
+ };
384
+ };
385
+ type ContentfulEntrySys = ContentfulSys & {
386
+ contentType: {
387
+ sys: ContentfulContentTypeLink;
388
+ };
389
+ };
390
+ interface ContentfulAssetImageData {
391
+ width: number;
392
+ height: number;
393
+ }
394
+ interface ContentfulAssetFileData {
395
+ url: string | null;
396
+ details: {
397
+ size: number | null;
398
+ image?: ContentfulAssetImageData;
399
+ };
400
+ fileName: string | null;
401
+ contentType: string | null;
402
+ }
403
+ interface ContentfulRestAsset {
404
+ sys: ContentfulSys;
405
+ fields: {
406
+ title: string;
407
+ description: string;
408
+ file: ContentfulAssetFileData;
409
+ };
410
+ metadata: ContentfulMetadata;
411
+ }
412
+ interface ContentfulEntry<T = {
413
+ [key: string]: any;
414
+ }> {
415
+ sys: ContentfulEntrySys;
416
+ fields: T;
417
+ metadata: ContentfulMetadata;
418
+ }
419
+ interface ContentfulCollection {
420
+ includes: {
421
+ Asset: ContentfulRestAsset[];
422
+ Entry: ContentfulEntry[];
423
+ };
424
+ items: ContentfulEntry[];
425
+ limit: number;
426
+ skip: number;
427
+ total: number;
428
+ sys: {
429
+ type: 'Array';
430
+ };
431
+ }
432
+ interface RichTextResponse {
433
+ nodeType: 'document';
434
+ data: NodeData;
435
+ content: Block[];
436
+ }
437
+
438
+ declare class ContentfulAudioComponent {
439
+ asset: _angular_core.InputSignal<ContentfulGqlAsset | ContentfulRestAsset | null | undefined>;
440
+ audioClass: _angular_core.InputSignal<NgClassType>;
441
+ figureClass: _angular_core.InputSignal<NgClassType>;
442
+ figcaptionClass: _angular_core.InputSignal<NgClassType>;
443
+ data: _angular_core.Signal<{
444
+ url: string | null;
445
+ title: string | null;
446
+ } | null>;
447
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ContentfulAudioComponent, never>;
448
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ContentfulAudioComponent, "et-contentful-audio", never, { "asset": { "alias": "asset"; "required": true; "isSignal": true; }; "audioClass": { "alias": "audioClass"; "required": false; "isSignal": true; }; "figureClass": { "alias": "figureClass"; "required": false; "isSignal": true; }; "figcaptionClass": { "alias": "figcaptionClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
449
+ }
450
+
451
+ declare class ContentfulFileComponent {
452
+ asset: _angular_core.InputSignal<ContentfulGqlAsset | ContentfulRestAsset | null | undefined>;
453
+ fileClass: _angular_core.InputSignal<NgClassType>;
454
+ data: _angular_core.Signal<{
455
+ url: string | null;
456
+ contentType: string | null;
457
+ size: number | null;
458
+ title: string | null;
459
+ } | null>;
460
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ContentfulFileComponent, never>;
461
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ContentfulFileComponent, "et-contentful-file", never, { "asset": { "alias": "asset"; "required": true; "isSignal": true; }; "fileClass": { "alias": "fileClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
462
+ }
463
+
464
+ declare class ContentfulImageComponent {
465
+ _contentfulConfig: ContentfulConfig;
466
+ asset: _angular_core.InputSignal<ContentfulGqlAsset | ContentfulRestAsset | null | undefined>;
467
+ backgroundColor: _angular_core.InputSignal<string | null>;
468
+ srcsetSizes: _angular_core.InputSignal<string[]>;
469
+ quality: _angular_core.InputSignalWithTransform<number | null, unknown>;
470
+ focusArea: _angular_core.InputSignal<ContentfulImageFocusArea | null>;
471
+ resizeBehavior: _angular_core.InputSignal<ContentfulImageResizeBehavior | null>;
472
+ hasPriority: _angular_core.InputSignalWithTransform<boolean, unknown>;
473
+ imgClass: _angular_core.InputSignal<NgClassType>;
474
+ figureClass: _angular_core.InputSignal<NgClassType>;
475
+ figcaptionClass: _angular_core.InputSignal<NgClassType>;
476
+ pictureClass: _angular_core.InputSignal<NgClassType>;
477
+ sizes: _angular_core.InputSignalWithTransform<string | null, string | string[] | null>;
478
+ normalizedAsset: _angular_core.Signal<{
479
+ alt: string | null;
480
+ figcaption: string | null;
481
+ width: number | null;
482
+ height: number | null;
483
+ }>;
484
+ _sources: _angular_core.Signal<_ethlete_cdk.PictureSource[]>;
485
+ _defaultSrc: _angular_core.Signal<_ethlete_cdk.PictureSource | null>;
486
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ContentfulImageComponent, never>;
487
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ContentfulImageComponent, "et-contentful-image", never, { "asset": { "alias": "asset"; "required": true; "isSignal": true; }; "backgroundColor": { "alias": "backgroundColor"; "required": false; "isSignal": true; }; "srcsetSizes": { "alias": "srcsetSizes"; "required": false; "isSignal": true; }; "quality": { "alias": "quality"; "required": false; "isSignal": true; }; "focusArea": { "alias": "focusArea"; "required": false; "isSignal": true; }; "resizeBehavior": { "alias": "resizeBehavior"; "required": false; "isSignal": true; }; "hasPriority": { "alias": "hasPriority"; "required": false; "isSignal": true; }; "imgClass": { "alias": "imgClass"; "required": false; "isSignal": true; }; "figureClass": { "alias": "figureClass"; "required": false; "isSignal": true; }; "figcaptionClass": { "alias": "figcaptionClass"; "required": false; "isSignal": true; }; "pictureClass": { "alias": "pictureClass"; "required": false; "isSignal": true; }; "sizes": { "alias": "sizes"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
488
+ }
489
+
490
+ declare const generateDefaultContentfulImageSource: (data: ContentfulRestAsset | ContentfulGqlAsset) => PictureSource;
491
+ /**
492
+ * Parses source set sizes into an object containing with and height. Eg.
493
+ * - `"400"` - 400px width
494
+ * - `"400x300"` - 400px width and 300px height
495
+ * - `"400w"` - 400px width
496
+ * - `"400h"` - 400px height
497
+ * - `"400wx300h"` - 400px width and 300px height
498
+ **/
499
+ declare const parseContentfulImageSize: (size: string) => {
500
+ width: number | null;
501
+ height: number | null;
502
+ };
503
+ declare const generateContentfulImageSources: (data: ContentfulRestAsset | ContentfulGqlAsset, srcsetSizes: string[], backgroundColor: string | null, quality: number | null, focusArea: ContentfulImageFocusArea | null, resizeBehavior: ContentfulImageResizeBehavior | null) => PictureSource[];
504
+
505
+ declare class ContentfulVideoComponent {
506
+ asset: _angular_core.InputSignal<ContentfulGqlAsset | ContentfulRestAsset | null | undefined>;
507
+ videoClass: _angular_core.InputSignal<NgClassType>;
508
+ data: _angular_core.Signal<{
509
+ url: string | null;
510
+ contentType: string | null;
511
+ } | null>;
512
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ContentfulVideoComponent, never>;
513
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ContentfulVideoComponent, "et-contentful-video", never, { "asset": { "alias": "asset"; "required": true; "isSignal": true; }; "videoClass": { "alias": "videoClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
514
+ }
515
+
516
+ declare const CONTENTFUL_CONFIG: InjectionToken<ContentfulConfig>;
517
+
518
+ declare const ContentfulImports: readonly [typeof ContentfulAudioComponent, typeof ContentfulFileComponent, typeof ContentfulImageComponent, typeof ContentfulVideoComponent, typeof ContentfulRichTextRendererComponent];
519
+
520
+ declare const createContentfulConfig: (config?: Partial<ContentfulConfig> | null | undefined) => ContentfulConfig;
521
+
522
+ declare const provideContentfulConfig: (contentfulConfig?: Partial<ContentfulConfig> | null | undefined) => {
523
+ provide: _angular_core.InjectionToken<ContentfulConfig>;
524
+ useValue: ContentfulConfig;
525
+ };
526
+ declare const isContentfulEntryType: <T extends ContentfulEntry>(entry: ContentfulEntry, type: string) => entry is T;
527
+
528
+ export { COMPONENT_RENDER_COMMAND_POSITION, CONTENTFUL_CONFIG, ContentfulAudioComponent, ContentfulFileComponent, ContentfulImageComponent, ContentfulImports, ContentfulRichTextRendererComponent, ContentfulVideoComponent, ET_CONTENTFUL_ANY_ENTRY_CONTENT_TYPE_SYS_ID, GQL_FRAGMENT_CONTENTFUL_ASSET, HTML_CLOSE_RENDER_COMMAND_POSITION, HTML_OPEN_RENDER_COMMAND_POSITION, RENDER_COMMAND_POSITION, RENDER_COMMAND_TYPE, RENDER_INSTRUCTION_POSITION, RENDER_INSTRUCTION_TYPE, TEXT_RENDER_COMMAND_POSITION, createContentfulConfig, createContentfulIncludeMap, generateContentfulImageSources, generateDefaultContentfulImageSource, getRenderCommandId, isComponentRenderCommand, isContentfulEntryType, isContentfulGqlAsset, isExecutedComponentCommandCacheItem, isExecutedHtmlOrTextCommandCacheItem, isExecutedTextCommandCacheItem, isHtmlCloseRenderCommand, isHtmlOpenRenderCommand, isRichTextRootNode, isTextRenderCommand, marksToClass, parseContentfulImageSize, provideContentfulConfig, translateContentfulNodeTypeToHtmlTag };
529
+ export type { ComponentLikeWithAsset, ComponentLikeWithContentfulRendererInputs, ContentfulAssetComponents, ContentfulAssetFileData, ContentfulAssetImageData, ContentfulAssetLink, ContentfulAssetLinkItem, ContentfulCollection, ContentfulConfig, ContentfulContentTypeLink, ContentfulEntry, ContentfulEntryLink, ContentfulEntryLinkItem, ContentfulEntrySys, ContentfulEnvironmentLink, ContentfulGqlAsset, ContentfulGqlCollectionFilterVariables, ContentfulGqlOrder, ContentfulGqlWhereFilter, ContentfulImageFocusArea, ContentfulImageResizeBehavior, ContentfulIncludeMap, ContentfulLink, ContentfulLinkType, ContentfulMetadata, ContentfulRestAsset, ContentfulSpaceLink, ContentfulSys, ContentfulTagLink, ContentfulTagLinkItem, CreateContentfulIncludeMapConfig, RichTextResponse };
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@ethlete/contentful",
3
- "version": "3.7.2",
3
+ "version": "3.9.0",
4
+ "license": "MIT",
4
5
  "sideEffects": false,
5
6
  "peerDependencies": {
6
- "@angular/cdk": "19.1.2",
7
- "@angular/common": "19.1.4",
8
- "@angular/core": "19.1.4",
7
+ "@angular/cdk": "20.0.3",
8
+ "@angular/common": "20.0.3",
9
+ "@angular/core": "20.0.3",
9
10
  "@contentful/rich-text-types": "17.0.0",
10
11
  "@ethlete/cdk": "^4.0.3",
11
12
  "@ethlete/core": "^4.0.3",
12
13
  "@ethlete/query": "^5.0.3",
13
- "rxjs": "7.8.1"
14
+ "rxjs": "7.8.2"
14
15
  },
15
16
  "module": "fesm2022/ethlete-contentful.mjs",
16
17
  "typings": "index.d.ts",
@@ -1,16 +0,0 @@
1
- import { NgClassType } from '@ethlete/core';
2
- import { ContentfulGqlAsset } from '../../gql';
3
- import { ContentfulRestAsset } from '../../types';
4
- import * as i0 from "@angular/core";
5
- export declare class ContentfulAudioComponent {
6
- asset: import("@angular/core").InputSignal<ContentfulGqlAsset | ContentfulRestAsset | null | undefined>;
7
- audioClass: import("@angular/core").InputSignal<NgClassType>;
8
- figureClass: import("@angular/core").InputSignal<NgClassType>;
9
- figcaptionClass: import("@angular/core").InputSignal<NgClassType>;
10
- data: import("@angular/core").Signal<{
11
- url: string | null;
12
- title: string | null;
13
- } | null>;
14
- static ɵfac: i0.ɵɵFactoryDeclaration<ContentfulAudioComponent, never>;
15
- static ɵcmp: i0.ɵɵComponentDeclaration<ContentfulAudioComponent, "et-contentful-audio", never, { "asset": { "alias": "asset"; "required": true; "isSignal": true; }; "audioClass": { "alias": "audioClass"; "required": false; "isSignal": true; }; "figureClass": { "alias": "figureClass"; "required": false; "isSignal": true; }; "figcaptionClass": { "alias": "figcaptionClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
16
- }
@@ -1 +0,0 @@
1
- export * from './contentful-audio.component';
@@ -1,16 +0,0 @@
1
- import { NgClassType } from '@ethlete/core';
2
- import { ContentfulGqlAsset } from '../../gql';
3
- import { ContentfulRestAsset } from '../../types';
4
- import * as i0 from "@angular/core";
5
- export declare class ContentfulFileComponent {
6
- asset: import("@angular/core").InputSignal<ContentfulGqlAsset | ContentfulRestAsset | null | undefined>;
7
- fileClass: import("@angular/core").InputSignal<NgClassType>;
8
- data: import("@angular/core").Signal<{
9
- url: string | null;
10
- contentType: string | null;
11
- size: number | null;
12
- title: string | null;
13
- } | null>;
14
- static ɵfac: i0.ɵɵFactoryDeclaration<ContentfulFileComponent, never>;
15
- static ɵcmp: i0.ɵɵComponentDeclaration<ContentfulFileComponent, "et-contentful-file", never, { "asset": { "alias": "asset"; "required": true; "isSignal": true; }; "fileClass": { "alias": "fileClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
16
- }
@@ -1 +0,0 @@
1
- export * from './contentful-file.component';
@@ -1,29 +0,0 @@
1
- import { NgClassType } from '@ethlete/core';
2
- import { ContentfulGqlAsset } from '../../gql';
3
- import { ContentfulImageFocusArea, ContentfulImageResizeBehavior, ContentfulRestAsset } from '../../types';
4
- import * as i0 from "@angular/core";
5
- export declare class ContentfulImageComponent {
6
- _contentfulConfig: import("../../types").ContentfulConfig;
7
- asset: import("@angular/core").InputSignal<ContentfulGqlAsset | ContentfulRestAsset | null | undefined>;
8
- backgroundColor: import("@angular/core").InputSignal<string | null>;
9
- srcsetSizes: import("@angular/core").InputSignal<string[]>;
10
- quality: import("@angular/core").InputSignalWithTransform<number | null, unknown>;
11
- focusArea: import("@angular/core").InputSignal<ContentfulImageFocusArea | null>;
12
- resizeBehavior: import("@angular/core").InputSignal<ContentfulImageResizeBehavior | null>;
13
- hasPriority: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
14
- imgClass: import("@angular/core").InputSignal<NgClassType>;
15
- figureClass: import("@angular/core").InputSignal<NgClassType>;
16
- figcaptionClass: import("@angular/core").InputSignal<NgClassType>;
17
- pictureClass: import("@angular/core").InputSignal<NgClassType>;
18
- sizes: import("@angular/core").InputSignalWithTransform<string | null, string | string[] | null>;
19
- normalizedAsset: import("@angular/core").Signal<{
20
- alt: string | null;
21
- figcaption: string | null;
22
- width: number | null;
23
- height: number | null;
24
- }>;
25
- _sources: import("@angular/core").Signal<import("@ethlete/cdk").PictureSource[]>;
26
- _defaultSrc: import("@angular/core").Signal<import("@ethlete/cdk").PictureSource | null>;
27
- static ɵfac: i0.ɵɵFactoryDeclaration<ContentfulImageComponent, never>;
28
- static ɵcmp: i0.ɵɵComponentDeclaration<ContentfulImageComponent, "et-contentful-image", never, { "asset": { "alias": "asset"; "required": true; "isSignal": true; }; "backgroundColor": { "alias": "backgroundColor"; "required": false; "isSignal": true; }; "srcsetSizes": { "alias": "srcsetSizes"; "required": false; "isSignal": true; }; "quality": { "alias": "quality"; "required": false; "isSignal": true; }; "focusArea": { "alias": "focusArea"; "required": false; "isSignal": true; }; "resizeBehavior": { "alias": "resizeBehavior"; "required": false; "isSignal": true; }; "hasPriority": { "alias": "hasPriority"; "required": false; "isSignal": true; }; "imgClass": { "alias": "imgClass"; "required": false; "isSignal": true; }; "figureClass": { "alias": "figureClass"; "required": false; "isSignal": true; }; "figcaptionClass": { "alias": "figcaptionClass"; "required": false; "isSignal": true; }; "pictureClass": { "alias": "pictureClass"; "required": false; "isSignal": true; }; "sizes": { "alias": "sizes"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
29
- }
@@ -1,17 +0,0 @@
1
- import { PictureSource } from '@ethlete/cdk';
2
- import { ContentfulGqlAsset } from '../../gql';
3
- import { ContentfulImageFocusArea, ContentfulImageResizeBehavior, ContentfulRestAsset } from '../../types';
4
- export declare const generateDefaultContentfulImageSource: (data: ContentfulRestAsset | ContentfulGqlAsset) => PictureSource;
5
- /**
6
- * Parses source set sizes into an object containing with and height. Eg.
7
- * - `"400"` - 400px width
8
- * - `"400x300"` - 400px width and 300px height
9
- * - `"400w"` - 400px width
10
- * - `"400h"` - 400px height
11
- * - `"400wx300h"` - 400px width and 300px height
12
- **/
13
- export declare const parseContentfulImageSize: (size: string) => {
14
- width: number | null;
15
- height: number | null;
16
- };
17
- export declare const generateContentfulImageSources: (data: ContentfulRestAsset | ContentfulGqlAsset, srcsetSizes: string[], backgroundColor: string | null, quality: number | null, focusArea: ContentfulImageFocusArea | null, resizeBehavior: ContentfulImageResizeBehavior | null) => PictureSource[];
@@ -1,2 +0,0 @@
1
- export * from './contentful-image.component';
2
- export * from './contentful-image.component.utils';
@@ -1,2 +0,0 @@
1
- export * from './rich-text-renderer.component';
2
- export * from './rich-text-renderer.util';