@ethlete/contentful 3.9.0 → 4.0.0-next.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/package.json
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethlete/contentful",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-next.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"@angular
|
|
8
|
-
"@angular/
|
|
9
|
-
"@angular/
|
|
10
|
-
"@
|
|
11
|
-
"@
|
|
12
|
-
"@ethlete/
|
|
13
|
-
"@ethlete/
|
|
14
|
-
"
|
|
7
|
+
"@analogjs/vite-plugin-angular": "2.3.1",
|
|
8
|
+
"@angular/cdk": "21.2.1",
|
|
9
|
+
"@angular/common": "21.2.1",
|
|
10
|
+
"@angular/core": "21.2.1",
|
|
11
|
+
"@contentful/rich-text-types": "17.2.5",
|
|
12
|
+
"@ethlete/cdk": "^5.0.0-next.0",
|
|
13
|
+
"@ethlete/core": "^5.0.0-next.0",
|
|
14
|
+
"@ethlete/query": "^6.0.0-next.0",
|
|
15
|
+
"@nx/vite": "22.5.4",
|
|
16
|
+
"rxjs": "7.8.2",
|
|
17
|
+
"vite": "^7.0.0"
|
|
15
18
|
},
|
|
16
19
|
"module": "fesm2022/ethlete-contentful.mjs",
|
|
17
|
-
"typings": "
|
|
20
|
+
"typings": "types/ethlete-contentful.d.ts",
|
|
18
21
|
"exports": {
|
|
19
22
|
"./package.json": {
|
|
20
23
|
"default": "./package.json"
|
|
21
24
|
},
|
|
22
25
|
".": {
|
|
23
|
-
"types": "./
|
|
26
|
+
"types": "./types/ethlete-contentful.d.ts",
|
|
24
27
|
"default": "./fesm2022/ethlete-contentful.mjs"
|
|
25
28
|
}
|
|
26
29
|
},
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { ViewContainerRef, ElementRef, ComponentRef, InputSignal, InjectionToken } from '@angular/core';
|
|
3
3
|
import { NgClassType } from '@ethlete/core';
|
|
4
4
|
import * as _ethlete_query from '@ethlete/query';
|
|
5
5
|
import { ComponentType } from '@angular/cdk/portal';
|
|
6
6
|
import { Mark, BLOCKS, INLINES, NodeData, Block } from '@contentful/rich-text-types';
|
|
7
|
+
import * as _ethlete_contentful from '@ethlete/contentful';
|
|
7
8
|
import * as _ethlete_cdk from '@ethlete/cdk';
|
|
8
9
|
import { PictureSource } from '@ethlete/cdk';
|
|
9
10
|
|
|
10
11
|
declare const GQL_FRAGMENT_CONTENTFUL_ASSET: _ethlete_query.GQL;
|
|
11
|
-
|
|
12
|
+
type ContentfulGqlAsset = {
|
|
12
13
|
sys: {
|
|
13
14
|
id: string;
|
|
14
15
|
};
|
|
@@ -19,7 +20,7 @@ interface ContentfulGqlAsset {
|
|
|
19
20
|
width: number | null;
|
|
20
21
|
height: number | null;
|
|
21
22
|
size: number | null;
|
|
22
|
-
}
|
|
23
|
+
};
|
|
23
24
|
declare const isContentfulGqlAsset: (asset: any) => asset is ContentfulGqlAsset;
|
|
24
25
|
type ContentfulGqlWhereFilter<TLinkedFrom extends Record<string, unknown> = Record<string, unknown>> = {
|
|
25
26
|
/**
|
|
@@ -123,7 +124,7 @@ type HtmlOpenRenderCommand = [
|
|
|
123
124
|
domPosition: number,
|
|
124
125
|
index: number,
|
|
125
126
|
attributes: Record<string, string>,
|
|
126
|
-
tagName:
|
|
127
|
+
tagName: keyof HTMLElementTagNameMap,
|
|
127
128
|
textId: string
|
|
128
129
|
];
|
|
129
130
|
type HtmlCloseRenderCommand = [
|
|
@@ -131,7 +132,7 @@ type HtmlCloseRenderCommand = [
|
|
|
131
132
|
nestingLevel: number,
|
|
132
133
|
domPosition: number,
|
|
133
134
|
index: number,
|
|
134
|
-
tagName:
|
|
135
|
+
tagName: keyof HTMLElementTagNameMap,
|
|
135
136
|
elementId: string
|
|
136
137
|
];
|
|
137
138
|
type TextRenderCommand = [
|
|
@@ -224,22 +225,53 @@ type ContentfulIncludeMap = {
|
|
|
224
225
|
*/
|
|
225
226
|
getAssets: (ids: string[]) => ContentfulRestAsset[];
|
|
226
227
|
};
|
|
227
|
-
|
|
228
|
+
type CreateContentfulIncludeMapConfig = {
|
|
228
229
|
/** The entries that should be present inside the map */
|
|
229
230
|
entries: ContentfulEntry[];
|
|
230
231
|
/** The assets that should be present inside the map */
|
|
231
232
|
assets: ContentfulRestAsset[];
|
|
232
|
-
}
|
|
233
|
+
};
|
|
233
234
|
/**
|
|
234
235
|
* Create a contentful include map using the provided entries and assets.
|
|
235
236
|
*/
|
|
236
237
|
declare const createContentfulIncludeMap: (config: CreateContentfulIncludeMapConfig) => ContentfulIncludeMap;
|
|
237
238
|
declare class ContentfulRichTextRendererComponent {
|
|
238
239
|
_viewContainerRef: ViewContainerRef;
|
|
239
|
-
_renderer:
|
|
240
|
+
_renderer: {
|
|
241
|
+
addClass: (element: HTMLElement, ...classes: string[]) => void;
|
|
242
|
+
removeClass: (element: HTMLElement, ...classes: string[]) => void;
|
|
243
|
+
toggleClass: (element: HTMLElement, className: string, force?: boolean) => boolean;
|
|
244
|
+
setStyle: (element: HTMLElement, style: Partial<Record<keyof CSSStyleDeclaration, string | null>>, flags?: _angular_core.RendererStyleFlags2) => void;
|
|
245
|
+
removeStyle: (element: HTMLElement, ...styles: (keyof CSSStyleDeclaration)[]) => void;
|
|
246
|
+
setAttribute: (element: HTMLElement, name: string, value: string | null, namespace?: string | null) => void;
|
|
247
|
+
removeAttribute: (element: HTMLElement, ...names: string[]) => void;
|
|
248
|
+
setProperty: (element: HTMLElement, name: string, value: unknown) => void;
|
|
249
|
+
setProperties: (element: HTMLElement, properties: Record<string, unknown>) => void;
|
|
250
|
+
createElement: <K extends keyof HTMLElementTagNameMap>(tagName: K, namespace?: string | null) => HTMLElementTagNameMap[K];
|
|
251
|
+
createText: (value: string) => globalThis.Text;
|
|
252
|
+
createComment: (value: string) => Comment;
|
|
253
|
+
appendChild: (parent: HTMLElement, newChild: Node) => void;
|
|
254
|
+
insertBefore: (parent: Node, newChild: Node, refChild: Node | null) => void;
|
|
255
|
+
removeChild: (parent: Node, oldChild: Node, isHostElement?: boolean) => void;
|
|
256
|
+
selectRootElement: (selectorOrNode: string | HTMLElement, preserveContent?: boolean) => HTMLElement;
|
|
257
|
+
parentNode: (node: Node) => Node | null;
|
|
258
|
+
nextSibling: (node: Node) => Node | null;
|
|
259
|
+
setValue: (node: Node, value: string) => void;
|
|
260
|
+
listen: (target: HTMLElement | Window | Document | "window" | "document" | "body", eventName: string, callback: (event: Event) => boolean | void) => (() => void);
|
|
261
|
+
destroyNode: (node: Node) => void;
|
|
262
|
+
replaceChild: (parent: Node, newChild: Node, oldChild: Node) => void;
|
|
263
|
+
empty: (element: HTMLElement) => void;
|
|
264
|
+
setTextContent: (element: HTMLElement, text: string) => void;
|
|
265
|
+
setInnerHTML: (element: HTMLElement, html: string) => void;
|
|
266
|
+
setAttributes: (element: HTMLElement, attributes: Record<string, string | null>, namespace?: string | null) => void;
|
|
267
|
+
setDataAttributes: (element: HTMLElement, data: Record<string, string | null>) => void;
|
|
268
|
+
setCssProperty: (element: HTMLElement, name: string, value: string | null) => void;
|
|
269
|
+
setCssProperties: (element: HTMLElement, properties: Record<string, string | null>) => void;
|
|
270
|
+
renderer: _angular_core.Renderer2;
|
|
271
|
+
};
|
|
240
272
|
_elementRef: ElementRef<HTMLElement>;
|
|
241
273
|
_document: Document;
|
|
242
|
-
_config: ContentfulConfig;
|
|
274
|
+
_config: _ethlete_contentful.ContentfulConfig;
|
|
243
275
|
/**
|
|
244
276
|
* A cache for all executed commands that are not deleted.
|
|
245
277
|
* This is used to keep track of all rendered elements and components.
|
|
@@ -286,7 +318,7 @@ declare class ContentfulRichTextRendererComponent {
|
|
|
286
318
|
}
|
|
287
319
|
|
|
288
320
|
declare const isRichTextRootNode: (node: unknown) => node is RichTextResponse;
|
|
289
|
-
declare const translateContentfulNodeTypeToHtmlTag: (nodeType: "text" | BLOCKS | INLINES) => "
|
|
321
|
+
declare const translateContentfulNodeTypeToHtmlTag: (nodeType: "text" | BLOCKS | INLINES) => "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "ul" | "ol" | "li" | "hr" | "blockquote" | "table" | "tr" | "td" | "th" | "div" | "a" | "span";
|
|
290
322
|
|
|
291
323
|
type ContentfulImageResizeBehavior = 'pad' | 'crop' | 'fill' | 'scale' | 'thumb' | 'fit';
|
|
292
324
|
type ContentfulImageFocusArea = 'top' | 'bottom' | 'left' | 'right' | 'center' | 'top_left' | 'top_right' | 'bottom_left' | 'bottom_right' | 'face' | 'faces';
|
|
@@ -299,13 +331,13 @@ type ComponentLikeWithContentfulRendererInputs = ComponentType<{
|
|
|
299
331
|
metadata?: InputSignal<ContentfulMetadata>;
|
|
300
332
|
sys?: InputSignal<ContentfulEntrySys>;
|
|
301
333
|
}>;
|
|
302
|
-
|
|
334
|
+
type ContentfulAssetComponents = {
|
|
303
335
|
file: ComponentLikeWithAsset;
|
|
304
336
|
image: ComponentLikeWithAsset;
|
|
305
337
|
video: ComponentLikeWithAsset;
|
|
306
338
|
audio: ComponentLikeWithAsset;
|
|
307
|
-
}
|
|
308
|
-
|
|
339
|
+
};
|
|
340
|
+
type ContentfulConfig = {
|
|
309
341
|
/**
|
|
310
342
|
* Default components for rendering contentful assets
|
|
311
343
|
*/
|
|
@@ -343,31 +375,31 @@ interface ContentfulConfig {
|
|
|
343
375
|
*/
|
|
344
376
|
backgroundColor: string | null;
|
|
345
377
|
};
|
|
346
|
-
}
|
|
378
|
+
};
|
|
347
379
|
type ContentfulLinkType = 'Space' | 'ContentType' | 'Environment' | 'Entry' | 'Asset' | 'Tag';
|
|
348
|
-
|
|
380
|
+
type ContentfulLink<T extends ContentfulLinkType> = {
|
|
349
381
|
type: 'Link';
|
|
350
382
|
linkType: T;
|
|
351
383
|
id: string;
|
|
352
|
-
}
|
|
384
|
+
};
|
|
353
385
|
type ContentfulSpaceLink = ContentfulLink<'Space'>;
|
|
354
386
|
type ContentfulEnvironmentLink = ContentfulLink<'Environment'>;
|
|
355
387
|
type ContentfulContentTypeLink = ContentfulLink<'ContentType'>;
|
|
356
388
|
type ContentfulEntryLink = ContentfulLink<'Entry'>;
|
|
357
389
|
type ContentfulAssetLink = ContentfulLink<'Asset'>;
|
|
358
390
|
type ContentfulTagLink = ContentfulLink<'Tag'>;
|
|
359
|
-
|
|
391
|
+
type ContentfulTagLinkItem = {
|
|
360
392
|
sys: ContentfulTagLink;
|
|
361
|
-
}
|
|
362
|
-
|
|
393
|
+
};
|
|
394
|
+
type ContentfulEntryLinkItem = {
|
|
363
395
|
sys: ContentfulEntryLink;
|
|
364
|
-
}
|
|
365
|
-
|
|
396
|
+
};
|
|
397
|
+
type ContentfulAssetLinkItem = {
|
|
366
398
|
sys: ContentfulAssetLink;
|
|
367
|
-
}
|
|
368
|
-
|
|
399
|
+
};
|
|
400
|
+
type ContentfulMetadata = {
|
|
369
401
|
tags: ContentfulTagLinkItem[];
|
|
370
|
-
}
|
|
402
|
+
};
|
|
371
403
|
type ContentfulSys = {
|
|
372
404
|
type: string;
|
|
373
405
|
id: string;
|
|
@@ -387,11 +419,11 @@ type ContentfulEntrySys = ContentfulSys & {
|
|
|
387
419
|
sys: ContentfulContentTypeLink;
|
|
388
420
|
};
|
|
389
421
|
};
|
|
390
|
-
|
|
422
|
+
type ContentfulAssetImageData = {
|
|
391
423
|
width: number;
|
|
392
424
|
height: number;
|
|
393
|
-
}
|
|
394
|
-
|
|
425
|
+
};
|
|
426
|
+
type ContentfulAssetFileData = {
|
|
395
427
|
url: string | null;
|
|
396
428
|
details: {
|
|
397
429
|
size: number | null;
|
|
@@ -399,8 +431,8 @@ interface ContentfulAssetFileData {
|
|
|
399
431
|
};
|
|
400
432
|
fileName: string | null;
|
|
401
433
|
contentType: string | null;
|
|
402
|
-
}
|
|
403
|
-
|
|
434
|
+
};
|
|
435
|
+
type ContentfulRestAsset = {
|
|
404
436
|
sys: ContentfulSys;
|
|
405
437
|
fields: {
|
|
406
438
|
title: string;
|
|
@@ -408,15 +440,15 @@ interface ContentfulRestAsset {
|
|
|
408
440
|
file: ContentfulAssetFileData;
|
|
409
441
|
};
|
|
410
442
|
metadata: ContentfulMetadata;
|
|
411
|
-
}
|
|
412
|
-
|
|
443
|
+
};
|
|
444
|
+
type ContentfulEntry<T = {
|
|
413
445
|
[key: string]: any;
|
|
414
|
-
}> {
|
|
446
|
+
}> = {
|
|
415
447
|
sys: ContentfulEntrySys;
|
|
416
448
|
fields: T;
|
|
417
449
|
metadata: ContentfulMetadata;
|
|
418
|
-
}
|
|
419
|
-
|
|
450
|
+
};
|
|
451
|
+
type ContentfulCollection = {
|
|
420
452
|
includes: {
|
|
421
453
|
Asset: ContentfulRestAsset[];
|
|
422
454
|
Entry: ContentfulEntry[];
|
|
@@ -428,12 +460,12 @@ interface ContentfulCollection {
|
|
|
428
460
|
sys: {
|
|
429
461
|
type: 'Array';
|
|
430
462
|
};
|
|
431
|
-
}
|
|
432
|
-
|
|
463
|
+
};
|
|
464
|
+
type RichTextResponse = {
|
|
433
465
|
nodeType: 'document';
|
|
434
466
|
data: NodeData;
|
|
435
467
|
content: Block[];
|
|
436
|
-
}
|
|
468
|
+
};
|
|
437
469
|
|
|
438
470
|
declare class ContentfulAudioComponent {
|
|
439
471
|
asset: _angular_core.InputSignal<ContentfulGqlAsset | ContentfulRestAsset | null | undefined>;
|
|
@@ -462,7 +494,7 @@ declare class ContentfulFileComponent {
|
|
|
462
494
|
}
|
|
463
495
|
|
|
464
496
|
declare class ContentfulImageComponent {
|
|
465
|
-
_contentfulConfig: ContentfulConfig;
|
|
497
|
+
_contentfulConfig: _ethlete_contentful.ContentfulConfig;
|
|
466
498
|
asset: _angular_core.InputSignal<ContentfulGqlAsset | ContentfulRestAsset | null | undefined>;
|
|
467
499
|
backgroundColor: _angular_core.InputSignal<string | null>;
|
|
468
500
|
srcsetSizes: _angular_core.InputSignal<string[]>;
|