@ethlete/contentful 4.0.0-next.10 → 4.0.0-next.11
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/CHANGELOG.md +21 -0
- package/fesm2022/ethlete-contentful.mjs +205 -242
- package/fesm2022/ethlete-contentful.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ethlete-contentful.d.ts +52 -9
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { Type, InputSignal, InjectionToken, Provider } from '@angular/core';
|
|
3
|
+
import * as _ethlete_core from '@ethlete/core';
|
|
3
4
|
import { NgClassType } from '@ethlete/core';
|
|
4
5
|
import { GQL } from '@ethlete/query';
|
|
5
6
|
import { Mark, BLOCKS, INLINES, NodeData, Block } from '@contentful/rich-text-types';
|
|
7
|
+
import * as _ethlete_contentful from '@ethlete/contentful';
|
|
6
8
|
import * as _ethlete_components from '@ethlete/components';
|
|
7
9
|
import { PictureSource } from '@ethlete/components';
|
|
8
10
|
import * as _angular_router from '@angular/router';
|
|
@@ -13,6 +15,7 @@ type ContentfulGqlAsset = {
|
|
|
13
15
|
id: string;
|
|
14
16
|
};
|
|
15
17
|
title: string | null;
|
|
18
|
+
fileName?: string | null;
|
|
16
19
|
contentType: string | null;
|
|
17
20
|
url: string | null;
|
|
18
21
|
description: string | null;
|
|
@@ -145,6 +148,7 @@ declare class ContentfulRichTextRendererComponent {
|
|
|
145
148
|
private renderer;
|
|
146
149
|
private elementRef;
|
|
147
150
|
private config;
|
|
151
|
+
private document;
|
|
148
152
|
/**
|
|
149
153
|
* The contentful response gotten via their REST api.
|
|
150
154
|
* @see https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/entries/entries-collection
|
|
@@ -169,14 +173,18 @@ declare class ContentfulRichTextRendererComponent {
|
|
|
169
173
|
private runDeleteInstruction;
|
|
170
174
|
private getComponentRootNode;
|
|
171
175
|
private findParent;
|
|
172
|
-
private
|
|
173
|
-
private renderInsertOrAppend;
|
|
176
|
+
private renderInsertAfter;
|
|
174
177
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ContentfulRichTextRendererComponent, never>;
|
|
175
178
|
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>;
|
|
176
179
|
}
|
|
177
180
|
|
|
178
181
|
declare const isRichTextRootNode: (node: unknown) => node is RichTextResponse;
|
|
179
|
-
|
|
182
|
+
/**
|
|
183
|
+
* The html element a structural rich text node renders as. A node type without an element
|
|
184
|
+
* (an unsupported inline or block) falls back to `span` for inlines and `div` otherwise,
|
|
185
|
+
* with a dev-mode warning.
|
|
186
|
+
*/
|
|
187
|
+
declare const translateContentfulNodeTypeToHtmlTag: (nodeType: "text" | BLOCKS | INLINES) => keyof HTMLElementTagNameMap;
|
|
180
188
|
|
|
181
189
|
type ContentfulImageResizeBehavior = 'pad' | 'crop' | 'fill' | 'scale' | 'thumb' | 'fit';
|
|
182
190
|
type ContentfulImageFocusArea = 'top' | 'bottom' | 'left' | 'right' | 'center' | 'top_left' | 'top_right' | 'bottom_left' | 'bottom_right' | 'face' | 'faces';
|
|
@@ -187,6 +195,7 @@ type ComponentLikeWithLink = Type<{
|
|
|
187
195
|
href: InputSignal<string>;
|
|
188
196
|
text: InputSignal<string>;
|
|
189
197
|
textClass: InputSignal<string>;
|
|
198
|
+
anchorClass?: InputSignal<string>;
|
|
190
199
|
}>;
|
|
191
200
|
type ComponentLikeWithContentfulRendererInputs = Type<{
|
|
192
201
|
fields?: InputSignal<any>;
|
|
@@ -306,7 +315,7 @@ type ContentfulRestAsset = {
|
|
|
306
315
|
fields: {
|
|
307
316
|
title: string;
|
|
308
317
|
description: string;
|
|
309
|
-
file
|
|
318
|
+
file?: ContentfulAssetFileData;
|
|
310
319
|
};
|
|
311
320
|
metadata: ContentfulMetadata;
|
|
312
321
|
};
|
|
@@ -349,7 +358,26 @@ declare class ContentfulAudioComponent {
|
|
|
349
358
|
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>;
|
|
350
359
|
}
|
|
351
360
|
|
|
361
|
+
/** Every string `et-contentful-file` renders itself. Override them app-wide with {@link provideContentfulFileLabels}. */
|
|
362
|
+
type ContentfulFileLabels = {
|
|
363
|
+
/** The size shown after the file title, e.g. `'(1.5 MB)'`. */
|
|
364
|
+
fileSize: (bytes: number) => string;
|
|
365
|
+
};
|
|
366
|
+
/** The built-in English labels. */
|
|
367
|
+
declare const DEFAULT_CONTENTFUL_FILE_LABELS: ContentfulFileLabels;
|
|
368
|
+
/**
|
|
369
|
+
* Localize `et-contentful-file` for everything below this injector, and read the set in effect here as a signal.
|
|
370
|
+
* Partial - whatever you leave out keeps its {@link DEFAULT_CONTENTFUL_FILE_LABELS} value.
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* provideContentfulFileLabels({ fileSize: (bytes) => `(${new Intl.NumberFormat('de').format(bytes)} Byte)` });
|
|
374
|
+
*/
|
|
375
|
+
declare const provideContentfulFileLabels: (labels: _ethlete_core.LabelsSource<ContentfulFileLabels>) => _angular_core.Provider;
|
|
376
|
+
declare const injectContentfulFileLabels: () => _angular_core.Signal<ContentfulFileLabels>;
|
|
377
|
+
declare const CONTENTFUL_FILE_LABELS: _angular_core.InjectionToken<_ethlete_core.LabelsSource<ContentfulFileLabels>>;
|
|
378
|
+
|
|
352
379
|
declare class ContentfulFileComponent {
|
|
380
|
+
protected labels: _angular_core.Signal<_ethlete_contentful.ContentfulFileLabels>;
|
|
353
381
|
asset: _angular_core.InputSignal<ContentfulGqlAsset | ContentfulRestAsset | null | undefined>;
|
|
354
382
|
fileClass: _angular_core.InputSignal<NgClassType>;
|
|
355
383
|
protected data: _angular_core.Signal<{
|
|
@@ -396,22 +424,37 @@ declare const parseContentfulImageSize: (size: string) => {
|
|
|
396
424
|
width: number | null;
|
|
397
425
|
height: number | null;
|
|
398
426
|
};
|
|
399
|
-
|
|
427
|
+
type ContentfulImageSourcesOptions = {
|
|
428
|
+
srcsetSizes?: string[];
|
|
429
|
+
backgroundColor?: string | null;
|
|
430
|
+
quality?: number | null;
|
|
431
|
+
focusArea?: ContentfulImageFocusArea | null;
|
|
432
|
+
resizeBehavior?: ContentfulImageResizeBehavior | null;
|
|
433
|
+
};
|
|
434
|
+
/**
|
|
435
|
+
* Builds AVIF and WebP `<source>` entries for a Contentful asset through the Contentful Images API.
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* generateContentfulImageSources(asset, { srcsetSizes: ['400w', '800w'], quality: 80 });
|
|
439
|
+
*/
|
|
440
|
+
declare const generateContentfulImageSources: (data: ContentfulRestAsset | ContentfulGqlAsset, options?: ContentfulImageSourcesOptions) => PictureSource[];
|
|
400
441
|
|
|
401
442
|
declare class ContentfulLinkComponent {
|
|
402
443
|
private document;
|
|
403
444
|
private router;
|
|
404
445
|
private config;
|
|
446
|
+
private url;
|
|
405
447
|
href: _angular_core.InputSignal<string>;
|
|
406
448
|
text: _angular_core.InputSignal<string>;
|
|
407
449
|
textClass: _angular_core.InputSignal<string>;
|
|
450
|
+
anchorClass: _angular_core.InputSignal<string>;
|
|
408
451
|
protected usesRouterLink: _angular_core.Signal<boolean>;
|
|
409
452
|
protected openInNewTab: _angular_core.Signal<boolean>;
|
|
410
453
|
protected internalPath: _angular_core.Signal<string>;
|
|
411
454
|
protected internalUrlTree: _angular_core.Signal<_angular_router.UrlTree>;
|
|
412
|
-
protected linkClass: _angular_core.Signal<string>;
|
|
455
|
+
protected linkClass: _angular_core.Signal<string | null>;
|
|
413
456
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ContentfulLinkComponent, never>;
|
|
414
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ContentfulLinkComponent, "et-contentful-link", never, { "href": { "alias": "href"; "required": true; "isSignal": true; }; "text": { "alias": "text"; "required": true; "isSignal": true; }; "textClass": { "alias": "textClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
457
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ContentfulLinkComponent, "et-contentful-link", never, { "href": { "alias": "href"; "required": true; "isSignal": true; }; "text": { "alias": "text"; "required": true; "isSignal": true; }; "textClass": { "alias": "textClass"; "required": false; "isSignal": true; }; "anchorClass": { "alias": "anchorClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
415
458
|
}
|
|
416
459
|
|
|
417
460
|
declare class ContentfulVideoComponent {
|
|
@@ -439,5 +482,5 @@ declare const injectContentfulConfig: () => ContentfulConfig;
|
|
|
439
482
|
declare const provideContentfulConfig: (contentfulConfig?: Partial<ContentfulConfig> | null) => Provider;
|
|
440
483
|
declare const isContentfulEntryType: <T extends ContentfulEntry>(entry: ContentfulEntry, type: string) => entry is T;
|
|
441
484
|
|
|
442
|
-
export { CONTENTFUL_CONFIG, ContentfulAudioComponent, ContentfulFileComponent, ContentfulImageComponent, ContentfulImports, ContentfulLinkComponent, ContentfulRichTextRendererComponent, ContentfulVideoComponent, ET_CONTENTFUL_ANY_ENTRY_CONTENT_TYPE_SYS_ID, GQL_FRAGMENT_CONTENTFUL_ASSET, createContentfulConfig, createContentfulIncludeMap, generateContentfulImageSources, generateDefaultContentfulImageSource, injectContentfulConfig, isContentfulEntryType, isContentfulGqlAsset, isRichTextRootNode, marksToClass, marksToTags, parseContentfulImageSize, provideContentfulConfig, translateContentfulNodeTypeToHtmlTag };
|
|
443
|
-
export type { ComponentLikeWithAsset, ComponentLikeWithContentfulRendererInputs, ComponentLikeWithLink, 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 };
|
|
485
|
+
export { CONTENTFUL_CONFIG, CONTENTFUL_FILE_LABELS, ContentfulAudioComponent, ContentfulFileComponent, ContentfulImageComponent, ContentfulImports, ContentfulLinkComponent, ContentfulRichTextRendererComponent, ContentfulVideoComponent, DEFAULT_CONTENTFUL_FILE_LABELS, ET_CONTENTFUL_ANY_ENTRY_CONTENT_TYPE_SYS_ID, GQL_FRAGMENT_CONTENTFUL_ASSET, createContentfulConfig, createContentfulIncludeMap, generateContentfulImageSources, generateDefaultContentfulImageSource, injectContentfulConfig, injectContentfulFileLabels, isContentfulEntryType, isContentfulGqlAsset, isRichTextRootNode, marksToClass, marksToTags, parseContentfulImageSize, provideContentfulConfig, provideContentfulFileLabels, translateContentfulNodeTypeToHtmlTag };
|
|
486
|
+
export type { ComponentLikeWithAsset, ComponentLikeWithContentfulRendererInputs, ComponentLikeWithLink, ContentfulAssetComponents, ContentfulAssetFileData, ContentfulAssetImageData, ContentfulAssetLink, ContentfulAssetLinkItem, ContentfulCollection, ContentfulConfig, ContentfulContentTypeLink, ContentfulEntry, ContentfulEntryLink, ContentfulEntryLinkItem, ContentfulEntrySys, ContentfulEnvironmentLink, ContentfulFileLabels, ContentfulGqlAsset, ContentfulGqlCollectionFilterVariables, ContentfulGqlOrder, ContentfulGqlWhereFilter, ContentfulImageFocusArea, ContentfulImageResizeBehavior, ContentfulImageSourcesOptions, ContentfulIncludeMap, ContentfulLink, ContentfulLinkType, ContentfulMetadata, ContentfulRestAsset, ContentfulSpaceLink, ContentfulSys, ContentfulTagLink, ContentfulTagLinkItem, CreateContentfulIncludeMapConfig, RichTextResponse };
|