@ethlete/contentful 2.1.2 → 3.0.1
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 +25 -0
- package/esm2022/index.mjs +2 -1
- package/esm2022/lib/components/audio/contentful-audio.component.mjs +18 -47
- package/esm2022/lib/components/file/contentful-file.component.mjs +14 -36
- package/esm2022/lib/components/image/contentful-image.component.mjs +64 -113
- package/esm2022/lib/components/image/contentful-image.component.utils.mjs +15 -19
- package/esm2022/lib/components/rich-text-renderer/index.mjs +1 -3
- package/esm2022/lib/components/rich-text-renderer/rich-text-renderer.component.mjs +683 -78
- package/esm2022/lib/components/rich-text-renderer/rich-text-renderer.errors.mjs +21 -0
- package/esm2022/lib/components/rich-text-renderer/rich-text-renderer.util.mjs +4 -133
- package/esm2022/lib/components/video/contentful-video.component.mjs +14 -39
- package/esm2022/lib/gql/asset.fragments.mjs +1 -17
- package/esm2022/lib/types/contentful.types.mjs +1 -1
- package/esm2022/lib/utils/contentful.util.mjs +1 -7
- package/fesm2022/ethlete-contentful.mjs +835 -484
- package/fesm2022/ethlete-contentful.mjs.map +1 -1
- package/lib/components/audio/contentful-audio.component.d.ts +6 -11
- package/lib/components/file/contentful-file.component.d.ts +4 -9
- package/lib/components/image/contentful-image.component.d.ts +19 -24
- package/lib/components/image/contentful-image.component.utils.d.ts +2 -2
- package/lib/components/rich-text-renderer/index.d.ts +0 -2
- package/lib/components/rich-text-renderer/rich-text-renderer.component.d.ts +160 -15
- package/lib/components/rich-text-renderer/rich-text-renderer.errors.d.ts +12 -0
- package/lib/components/rich-text-renderer/rich-text-renderer.util.d.ts +4 -17
- package/lib/components/video/contentful-video.component.d.ts +4 -9
- package/lib/gql/asset.fragments.d.ts +0 -1
- package/lib/types/contentful.types.d.ts +92 -48
- package/lib/utils/contentful.util.d.ts +1 -3
- package/package.json +4 -4
- package/esm2022/lib/components/rich-text-renderer/rich-text-renderer.constants.mjs +0 -3
- package/esm2022/lib/components/rich-text-renderer/rich-text-renderer.types.mjs +0 -2
- package/lib/components/rich-text-renderer/rich-text-renderer.constants.d.ts +0 -2
- package/lib/components/rich-text-renderer/rich-text-renderer.types.d.ts +0 -12
|
@@ -1,19 +1,164 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentType } from '@angular/cdk/portal';
|
|
2
|
+
import { ComponentRef, ElementRef, Renderer2, ViewContainerRef } from '@angular/core';
|
|
3
|
+
import { Mark } from '@contentful/rich-text-types';
|
|
4
|
+
import { ContentfulAsset, ContentfulCollection, ContentfulEntry, RichTextResponse } from '../../types';
|
|
2
5
|
import * as i0 from "@angular/core";
|
|
6
|
+
export declare const RENDER_COMMAND_TYPE: {
|
|
7
|
+
readonly HTML_OPEN: 0;
|
|
8
|
+
readonly HTML_CLOSE: 1;
|
|
9
|
+
readonly TEXT: 2;
|
|
10
|
+
readonly COMPONENT: 3;
|
|
11
|
+
};
|
|
12
|
+
export declare const RENDER_COMMAND_POSITION: {
|
|
13
|
+
readonly TYPE: 0;
|
|
14
|
+
readonly NESTING_LEVEL: 1;
|
|
15
|
+
readonly DOM_POSITION: 2;
|
|
16
|
+
readonly INDEX: 3;
|
|
17
|
+
};
|
|
18
|
+
export declare const HTML_OPEN_RENDER_COMMAND_POSITION: {
|
|
19
|
+
readonly ATTRIBUTES: 4;
|
|
20
|
+
readonly TAG_NAME: 5;
|
|
21
|
+
readonly ELEMENT_ID: 6;
|
|
22
|
+
};
|
|
23
|
+
export declare const HTML_CLOSE_RENDER_COMMAND_POSITION: {
|
|
24
|
+
readonly TAG_NAME: 4;
|
|
25
|
+
readonly ELEMENT_ID: 5;
|
|
26
|
+
};
|
|
27
|
+
export declare const TEXT_RENDER_COMMAND_POSITION: {
|
|
28
|
+
readonly TEXT: 4;
|
|
29
|
+
};
|
|
30
|
+
export declare const COMPONENT_RENDER_COMMAND_POSITION: {
|
|
31
|
+
readonly ATTRIBUTES: 4;
|
|
32
|
+
readonly COMPONENT: 5;
|
|
33
|
+
readonly INPUTS: 6;
|
|
34
|
+
readonly COMPONENT_TYPE: 7;
|
|
35
|
+
};
|
|
36
|
+
type HtmlOpenRenderCommand = [
|
|
37
|
+
type: typeof RENDER_COMMAND_TYPE.HTML_OPEN,
|
|
38
|
+
nestingLevel: number,
|
|
39
|
+
domPosition: number,
|
|
40
|
+
index: number,
|
|
41
|
+
attributes: Record<string, string>,
|
|
42
|
+
tagName: string,
|
|
43
|
+
elementId: string
|
|
44
|
+
];
|
|
45
|
+
type HtmlCloseRenderCommand = [
|
|
46
|
+
type: typeof RENDER_COMMAND_TYPE.HTML_CLOSE,
|
|
47
|
+
nestingLevel: number,
|
|
48
|
+
domPosition: number,
|
|
49
|
+
index: number,
|
|
50
|
+
tagName: string,
|
|
51
|
+
elementId: string
|
|
52
|
+
];
|
|
53
|
+
type TextRenderCommand = [
|
|
54
|
+
type: typeof RENDER_COMMAND_TYPE.TEXT,
|
|
55
|
+
nestingLevel: number,
|
|
56
|
+
domPosition: number,
|
|
57
|
+
index: number,
|
|
58
|
+
text: string
|
|
59
|
+
];
|
|
60
|
+
type ComponentRenderCommand = [
|
|
61
|
+
type: typeof RENDER_COMMAND_TYPE.COMPONENT,
|
|
62
|
+
nestingLevel: number,
|
|
63
|
+
domPosition: number,
|
|
64
|
+
index: number,
|
|
65
|
+
attributes: Record<string, string>,
|
|
66
|
+
component: ComponentType<unknown>,
|
|
67
|
+
inputs: Record<string, unknown>,
|
|
68
|
+
componentType: string
|
|
69
|
+
];
|
|
70
|
+
type RenderCommand = HtmlOpenRenderCommand | HtmlCloseRenderCommand | TextRenderCommand | ComponentRenderCommand;
|
|
71
|
+
export declare const RENDER_INSTRUCTION_POSITION: {
|
|
72
|
+
readonly TYPE: 0;
|
|
73
|
+
readonly COMMAND: 1;
|
|
74
|
+
};
|
|
75
|
+
export declare const RENDER_INSTRUCTION_TYPE: {
|
|
76
|
+
readonly CREATE: 0;
|
|
77
|
+
readonly UPDATE: 1;
|
|
78
|
+
readonly DELETE: 2;
|
|
79
|
+
readonly MOVE: 3;
|
|
80
|
+
};
|
|
81
|
+
type RenderInstructionTypeValue = (typeof RENDER_INSTRUCTION_TYPE)[keyof typeof RENDER_INSTRUCTION_TYPE];
|
|
82
|
+
type RenderInstruction = [RenderInstructionTypeValue, RenderCommand];
|
|
83
|
+
export declare const marksToClass: (marks: Mark[]) => string;
|
|
84
|
+
export declare const isHtmlOpenRenderCommand: (command: RenderCommand) => command is HtmlOpenRenderCommand;
|
|
85
|
+
export declare const isHtmlCloseRenderCommand: (command: RenderCommand) => command is HtmlCloseRenderCommand;
|
|
86
|
+
export declare const isTextRenderCommand: (command: RenderCommand) => command is TextRenderCommand;
|
|
87
|
+
export declare const isComponentRenderCommand: (command: RenderCommand) => command is ComponentRenderCommand;
|
|
88
|
+
export declare const getRenderCommandId: (command: RenderCommand) => string;
|
|
89
|
+
type ExecutedCommandCacheItemBase = {
|
|
90
|
+
element: HTMLElement;
|
|
91
|
+
};
|
|
92
|
+
type ExecutedComponentCommandCacheItem = {
|
|
93
|
+
command: ComponentRenderCommand;
|
|
94
|
+
componentRef: ComponentRef<unknown>;
|
|
95
|
+
} & ExecutedCommandCacheItemBase;
|
|
96
|
+
type ExecutedHtmlCommandCacheItem = {
|
|
97
|
+
command: HtmlOpenRenderCommand | HtmlCloseRenderCommand;
|
|
98
|
+
} & ExecutedCommandCacheItemBase;
|
|
99
|
+
type ExecutedTextCommandCacheItem = {
|
|
100
|
+
command: TextRenderCommand;
|
|
101
|
+
textNode: unknown;
|
|
102
|
+
} & ExecutedCommandCacheItemBase;
|
|
103
|
+
type ExecutedCommandCacheItem = ExecutedComponentCommandCacheItem | ExecutedHtmlCommandCacheItem | ExecutedTextCommandCacheItem;
|
|
104
|
+
export declare const isExecutedComponentCommandCacheItem: (cache: ExecutedCommandCacheItem) => cache is ExecutedComponentCommandCacheItem;
|
|
105
|
+
export declare const isExecutedHtmlOrTextCommandCacheItem: (cache: ExecutedCommandCacheItem) => cache is ExecutedHtmlCommandCacheItem;
|
|
106
|
+
export declare const isExecutedTextCommandCacheItem: (cache: ExecutedCommandCacheItem) => cache is ExecutedTextCommandCacheItem;
|
|
107
|
+
export type ContentfulIncludeMap = {
|
|
108
|
+
assets: Record<string, ContentfulAsset>;
|
|
109
|
+
entries: Record<string, ContentfulEntry>;
|
|
110
|
+
};
|
|
3
111
|
export declare class ContentfulRichTextRendererComponent {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
112
|
+
_viewContainerRef: ViewContainerRef;
|
|
113
|
+
_renderer: Renderer2;
|
|
114
|
+
_elementRef: ElementRef<HTMLElement>;
|
|
115
|
+
_document: Document;
|
|
116
|
+
_config: import("../../types").ContentfulConfig;
|
|
117
|
+
/**
|
|
118
|
+
* A cache for all executed commands that are not deleted.
|
|
119
|
+
* This is used to keep track of all rendered elements and components.
|
|
120
|
+
* The key is the render command element ID.
|
|
121
|
+
*/
|
|
122
|
+
_executedCommandsCache: Map<string, ExecutedCommandCacheItem>;
|
|
123
|
+
/**
|
|
124
|
+
* The contentful response gotten via their REST api.
|
|
125
|
+
* @see https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/entries/entries-collection
|
|
126
|
+
*/
|
|
127
|
+
content: import("@angular/core").InputSignal<ContentfulCollection | null | undefined>;
|
|
128
|
+
/**
|
|
129
|
+
* The path to where the rich text field is inside the contentful response. Dot and array notation is allowed.
|
|
130
|
+
* @default "items[0].fields.html"
|
|
131
|
+
*/
|
|
132
|
+
richTextPath: import("@angular/core").InputSignal<string>;
|
|
133
|
+
/**
|
|
134
|
+
* A map of all includes in the contentful response.
|
|
135
|
+
* This is useful for looking up assets and entries that are referenced in the rich text without having to use loops.
|
|
136
|
+
*/
|
|
137
|
+
contentIncludesMap: import("@angular/core").Signal<ContentfulIncludeMap>;
|
|
138
|
+
/**
|
|
139
|
+
* The rich text data that should be rendered.
|
|
140
|
+
*/
|
|
141
|
+
richTextData: import("@angular/core").Signal<RichTextResponse | null>;
|
|
142
|
+
renderCommands: import("@angular/core").Signal<RenderCommand[]>;
|
|
143
|
+
renderCommandHistory: import("@angular/core").Signal<[RenderCommand[], RenderCommand[]]>;
|
|
144
|
+
previousRenderCommandMap: import("@angular/core").Signal<Map<string | number, RenderCommand>>;
|
|
145
|
+
renderInstructions: import("@angular/core").Signal<RenderInstruction[]>;
|
|
146
|
+
constructor();
|
|
147
|
+
private _createRenderCommands;
|
|
148
|
+
private _execInstructions;
|
|
149
|
+
private _runCreateInstruction;
|
|
150
|
+
private _runUpdateInstruction;
|
|
151
|
+
private _runMoveInstruction;
|
|
152
|
+
private _runDeleteInstruction;
|
|
153
|
+
private _getComponentRootNode;
|
|
154
|
+
private _updateComponentInputs;
|
|
155
|
+
private _findParent;
|
|
156
|
+
private _findFollowingElement;
|
|
157
|
+
private _renderInsertOrAppend;
|
|
158
|
+
private _debugVisualizeRenderCommands;
|
|
159
|
+
private _stringifyRenderCommand;
|
|
160
|
+
private _stringifyRenderInstruction;
|
|
17
161
|
static ɵfac: i0.ɵɵFactoryDeclaration<ContentfulRichTextRendererComponent, never>;
|
|
18
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ContentfulRichTextRendererComponent, "et-contentful-rich-text-renderer", never, { "
|
|
162
|
+
static ɵcmp: i0.ɵɵ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>;
|
|
19
163
|
}
|
|
164
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const RICH_TEXT_RENDERER_ERRORS: {
|
|
2
|
+
readonly rich_text_undefined: "The property value given at richTextPath is undefined. Use the richTextPath input to specify the path to the rich text object.";
|
|
3
|
+
readonly rich_text_wrong_type: "The rich text object does not satisfy the RichTextResponse interface. It should contain a property named \"nodeType\" with the value \"document\".";
|
|
4
|
+
readonly asset_id_not_found: "The asset ID was not found. This node is not supported.";
|
|
5
|
+
readonly entry_id_not_found: "The entry ID was not found. This node is not supported.";
|
|
6
|
+
readonly asset_not_found: "The asset was not found. This node is not supported.";
|
|
7
|
+
readonly entry_not_found: "The entry was not found. This node is not supported.";
|
|
8
|
+
readonly custom_component_not_found: "No custom component found for entry type. Please provide one for this type.";
|
|
9
|
+
readonly text_parent_not_found: "The parent node is not found. This structure is not supported.";
|
|
10
|
+
readonly text_parent_wrong_type: "The parent node neither a html element nor a custom component. This structure is not supported.";
|
|
11
|
+
};
|
|
12
|
+
export declare const richTextRendererError: (code: keyof typeof RICH_TEXT_RENDERER_ERRORS, devOnly: boolean, data?: unknown) => never;
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
5
|
-
data: RichTextResponse;
|
|
6
|
-
config: ContentfulConfig;
|
|
7
|
-
}) => RichTextRenderCommand[];
|
|
8
|
-
export declare const createContentfulRenderCommand: (node: Block | Inline | Text, parent: RichTextRenderCommand, resourceMap: ContentfulResourceMap, config: ContentfulConfig) => RichTextRenderCommand;
|
|
9
|
-
export declare const getContentfulNodeProps: (node: Block | Inline | Text) => {
|
|
10
|
-
children: (Block | Inline | Text)[] | null;
|
|
11
|
-
marks: Mark[] | null;
|
|
12
|
-
value: string | null;
|
|
13
|
-
};
|
|
14
|
-
export declare const transformContentfulMarks: (marks: Mark[], useTailwindClasses: boolean) => string;
|
|
15
|
-
export 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" | "document";
|
|
16
|
-
export declare const createContentfulResourceMap: (links: RichTextResponse['links']) => ContentfulResourceMap;
|
|
17
|
-
export declare const createContentfulMap: <T extends ContentfulEntryBase>(links: Array<T> | null | undefined) => Map<string, T>;
|
|
1
|
+
import { BLOCKS, INLINES } from '@contentful/rich-text-types';
|
|
2
|
+
import { RichTextResponse } from '../../types';
|
|
3
|
+
export declare const isRichTextRootNode: (node: unknown) => node is RichTextResponse;
|
|
4
|
+
export 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";
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { OnInit } from '@angular/core';
|
|
2
1
|
import { NgClassType } from '@ethlete/core';
|
|
3
2
|
import { ContentfulAsset } from '../../types';
|
|
4
3
|
import * as i0 from "@angular/core";
|
|
5
|
-
export declare class ContentfulVideoComponent
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
set data(v: ContentfulAsset | null | undefined);
|
|
9
|
-
private _data;
|
|
10
|
-
videoClass: NgClassType;
|
|
11
|
-
ngOnInit(): void;
|
|
4
|
+
export declare class ContentfulVideoComponent {
|
|
5
|
+
asset: import("@angular/core").InputSignal<ContentfulAsset | null | undefined>;
|
|
6
|
+
videoClass: import("@angular/core").InputSignal<NgClassType>;
|
|
12
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<ContentfulVideoComponent, never>;
|
|
13
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ContentfulVideoComponent, "et-contentful-video", never, { "
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ContentfulVideoComponent, "et-contentful-video", never, { "asset": { "alias": "asset"; "required": true; "isSignal": true; }; "videoClass": { "alias": "videoClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
14
9
|
}
|
|
@@ -1,54 +1,17 @@
|
|
|
1
1
|
import { ComponentType } from '@angular/cdk/portal';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
id: string;
|
|
6
|
-
};
|
|
7
|
-
title: string;
|
|
8
|
-
contentType: string;
|
|
9
|
-
url: string;
|
|
10
|
-
description: string | null;
|
|
11
|
-
width: number | null;
|
|
12
|
-
height: number | null;
|
|
13
|
-
size: number;
|
|
14
|
-
priority?: boolean;
|
|
15
|
-
__typename: string;
|
|
16
|
-
}
|
|
2
|
+
import { InputSignal } from '@angular/core';
|
|
3
|
+
import { Block, NodeData } from '@contentful/rich-text-types';
|
|
4
|
+
import { ContentfulIncludeMap } from '../components/rich-text-renderer';
|
|
17
5
|
export type ContentfulImageResizeBehavior = 'pad' | 'crop' | 'fill' | 'scale' | 'thumb' | 'fit';
|
|
18
6
|
export type ContentfulImageFocusArea = 'top' | 'bottom' | 'left' | 'right' | 'center' | 'top_left' | 'top_right' | 'bottom_left' | 'bottom_right' | 'face' | 'faces';
|
|
19
|
-
export interface ContentfulImage {
|
|
20
|
-
sys: {
|
|
21
|
-
id: string;
|
|
22
|
-
};
|
|
23
|
-
asset: ContentfulAsset;
|
|
24
|
-
alt: string | null;
|
|
25
|
-
caption: string | null;
|
|
26
|
-
resizeBehavior: ContentfulImageResizeBehavior | null;
|
|
27
|
-
focusArea: ContentfulImageFocusArea | null;
|
|
28
|
-
quality: number;
|
|
29
|
-
__typename: string;
|
|
30
|
-
}
|
|
31
|
-
export interface RichTextResponse {
|
|
32
|
-
json: ContentfulDocument;
|
|
33
|
-
links: {
|
|
34
|
-
assets?: {
|
|
35
|
-
block?: Array<ContentfulAsset>;
|
|
36
|
-
inline?: Array<ContentfulAsset>;
|
|
37
|
-
};
|
|
38
|
-
entries?: {
|
|
39
|
-
block?: Array<ContentfulEntryBase>;
|
|
40
|
-
inline?: Array<ContentfulEntryBase>;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
export interface ContentfulEntryBase {
|
|
45
|
-
sys: {
|
|
46
|
-
id: string;
|
|
47
|
-
};
|
|
48
|
-
__typename: string;
|
|
49
|
-
}
|
|
50
7
|
type ComponentLikeWithAsset = ComponentType<{
|
|
51
|
-
|
|
8
|
+
asset: InputSignal<ContentfulAsset | null | undefined>;
|
|
9
|
+
}>;
|
|
10
|
+
type ComponentLikeWithContentfulRendererInputs = ComponentType<{
|
|
11
|
+
fields?: InputSignal<any>;
|
|
12
|
+
includes?: InputSignal<ContentfulIncludeMap>;
|
|
13
|
+
metadata?: InputSignal<ContentfulMetadata>;
|
|
14
|
+
sys?: InputSignal<ContentfulSys>;
|
|
52
15
|
}>;
|
|
53
16
|
export interface ContentfulAssetComponents {
|
|
54
17
|
file: ComponentLikeWithAsset;
|
|
@@ -64,7 +27,7 @@ export interface ContentfulConfig {
|
|
|
64
27
|
/**
|
|
65
28
|
* Component for rendering embedded entries
|
|
66
29
|
*/
|
|
67
|
-
customComponents: Record<string,
|
|
30
|
+
customComponents: Record<string, ComponentLikeWithContentfulRendererInputs>;
|
|
68
31
|
/**
|
|
69
32
|
* Determines if the contentful rich text renderer should render the contentful rich text with tailwind css classes
|
|
70
33
|
*/
|
|
@@ -95,4 +58,85 @@ export interface ContentfulConfig {
|
|
|
95
58
|
backgroundColor: string | null;
|
|
96
59
|
};
|
|
97
60
|
}
|
|
61
|
+
export type ContentfulLinkType = 'Space' | 'ContentType' | 'Environment';
|
|
62
|
+
export interface ContentfulLink<T extends ContentfulLinkType> {
|
|
63
|
+
type: 'Link';
|
|
64
|
+
linkType: T;
|
|
65
|
+
id: string;
|
|
66
|
+
}
|
|
67
|
+
export type ContentfulSpaceLink = ContentfulLink<'Space'>;
|
|
68
|
+
export type ContentfulEnvironmentLink = ContentfulLink<'Environment'>;
|
|
69
|
+
export type ContentfulContentTypeLink = ContentfulLink<'ContentType'>;
|
|
70
|
+
export interface ContentfulTagLink {
|
|
71
|
+
sys: {
|
|
72
|
+
type: 'Link';
|
|
73
|
+
linkType: 'Tag';
|
|
74
|
+
id: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export interface ContentfulMetadata {
|
|
78
|
+
tags: ContentfulTagLink[];
|
|
79
|
+
}
|
|
80
|
+
export interface ContentfulSys {
|
|
81
|
+
type: string;
|
|
82
|
+
id: string;
|
|
83
|
+
createdAt: string;
|
|
84
|
+
updatedAt: string;
|
|
85
|
+
locale: string;
|
|
86
|
+
revision?: number;
|
|
87
|
+
space?: {
|
|
88
|
+
sys: ContentfulSpaceLink;
|
|
89
|
+
};
|
|
90
|
+
environment?: {
|
|
91
|
+
sys: ContentfulEnvironmentLink;
|
|
92
|
+
};
|
|
93
|
+
contentType: {
|
|
94
|
+
sys: ContentfulContentTypeLink;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export interface ContentfulAssetImageData {
|
|
98
|
+
width: number;
|
|
99
|
+
height: number;
|
|
100
|
+
}
|
|
101
|
+
export interface ContentfulAssetFileData {
|
|
102
|
+
url: string;
|
|
103
|
+
details: {
|
|
104
|
+
size: number;
|
|
105
|
+
image?: ContentfulAssetImageData;
|
|
106
|
+
};
|
|
107
|
+
fileName: string;
|
|
108
|
+
contentType: string;
|
|
109
|
+
}
|
|
110
|
+
export interface ContentfulAsset {
|
|
111
|
+
sys: ContentfulSys;
|
|
112
|
+
fields: {
|
|
113
|
+
title: string;
|
|
114
|
+
description: string;
|
|
115
|
+
file: ContentfulAssetFileData;
|
|
116
|
+
};
|
|
117
|
+
metadata: ContentfulMetadata;
|
|
118
|
+
}
|
|
119
|
+
export interface ContentfulEntry<T = Record<string, unknown>> {
|
|
120
|
+
sys: ContentfulSys;
|
|
121
|
+
fields: T;
|
|
122
|
+
metadata: ContentfulMetadata;
|
|
123
|
+
}
|
|
124
|
+
export interface ContentfulCollection {
|
|
125
|
+
includes: {
|
|
126
|
+
Asset: ContentfulAsset[];
|
|
127
|
+
Entry: ContentfulEntry[];
|
|
128
|
+
};
|
|
129
|
+
items: ContentfulEntry[];
|
|
130
|
+
limit: number;
|
|
131
|
+
skip: number;
|
|
132
|
+
total: number;
|
|
133
|
+
sys: {
|
|
134
|
+
type: 'Array';
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
export interface RichTextResponse {
|
|
138
|
+
nodeType: 'document';
|
|
139
|
+
data: NodeData;
|
|
140
|
+
content: Block[];
|
|
141
|
+
}
|
|
98
142
|
export {};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContentfulConfig } from '../types';
|
|
2
2
|
export declare const provideContentfulConfig: (contentfulConfig?: Partial<ContentfulConfig> | null | undefined) => {
|
|
3
3
|
provide: import("@angular/core").InjectionToken<ContentfulConfig>;
|
|
4
4
|
useValue: ContentfulConfig;
|
|
5
5
|
};
|
|
6
|
-
export declare const isContentfulImage: (v: ContentfulAsset | ContentfulImage | null | undefined) => v is ContentfulImage;
|
|
7
|
-
export declare const isContentfulAsset: (v: ContentfulAsset | ContentfulImage | null | undefined) => v is ContentfulAsset;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethlete/contentful",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/cdk": "17.
|
|
6
|
-
"@angular/common": "17.3.
|
|
7
|
-
"@angular/core": "17.3.
|
|
5
|
+
"@angular/cdk": "17.3.3",
|
|
6
|
+
"@angular/common": "17.3.3",
|
|
7
|
+
"@angular/core": "17.3.3",
|
|
8
8
|
"@contentful/rich-text-types": "^16.3.0",
|
|
9
9
|
"@ethlete/cdk": "^4.0.3",
|
|
10
10
|
"@ethlete/core": "^4.0.3",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
|
2
|
-
export const RICH_TEXT_RENDERER_COMPONENT_DATA = new InjectionToken('RICH_TEXT_RENDERER_COMPONENT_DATA');
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmljaC10ZXh0LXJlbmRlcmVyLmNvbnN0YW50cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29udGVudGZ1bC9zcmMvbGliL2NvbXBvbmVudHMvcmljaC10ZXh0LXJlbmRlcmVyL3JpY2gtdGV4dC1yZW5kZXJlci5jb25zdGFudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUUvQyxNQUFNLENBQUMsTUFBTSxpQ0FBaUMsR0FBRyxJQUFJLGNBQWMsQ0FBVSxtQ0FBbUMsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSW5qZWN0aW9uVG9rZW4gfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuZXhwb3J0IGNvbnN0IFJJQ0hfVEVYVF9SRU5ERVJFUl9DT01QT05FTlRfREFUQSA9IG5ldyBJbmplY3Rpb25Ub2tlbjx1bmtub3duPignUklDSF9URVhUX1JFTkRFUkVSX0NPTVBPTkVOVF9EQVRBJyk7XG4iXX0=
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmljaC10ZXh0LXJlbmRlcmVyLnR5cGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb250ZW50ZnVsL3NyYy9saWIvY29tcG9uZW50cy9yaWNoLXRleHQtcmVuZGVyZXIvcmljaC10ZXh0LXJlbmRlcmVyLnR5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBDb250ZW50ZnVsQXNzZXQsIENvbnRlbnRmdWxFbnRyeUJhc2UgfSBmcm9tICcuLi8uLi90eXBlcyc7XG5cbmV4cG9ydCBpbnRlcmZhY2UgUmljaFRleHRSZW5kZXJDb21tYW5kIHtcbiAgcGF5bG9hZDogc3RyaW5nIHwgKG5ldyAoKSA9PiB1bmtub3duKTtcbiAgZGF0YT86IHVua25vd247XG4gIGF0dHJpYnV0ZXM/OiBSZWNvcmQ8c3RyaW5nLCBzdHJpbmc+O1xuICBjaGlsZHJlbjogUmljaFRleHRSZW5kZXJDb21tYW5kW107XG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgQ29udGVudGZ1bFJlc291cmNlTWFwIHtcbiAgcmVhZG9ubHkgYXNzZXRzQmxvY2s6IE1hcDxzdHJpbmcsIENvbnRlbnRmdWxBc3NldD47XG4gIHJlYWRvbmx5IGVudHJpZXNJbmxpbmU6IE1hcDxzdHJpbmcsIENvbnRlbnRmdWxFbnRyeUJhc2U+O1xuICByZWFkb25seSBlbnRyaWVzQmxvY2s6IE1hcDxzdHJpbmcsIENvbnRlbnRmdWxFbnRyeUJhc2U+O1xufVxuIl19
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ContentfulAsset, ContentfulEntryBase } from '../../types';
|
|
2
|
-
export interface RichTextRenderCommand {
|
|
3
|
-
payload: string | (new () => unknown);
|
|
4
|
-
data?: unknown;
|
|
5
|
-
attributes?: Record<string, string>;
|
|
6
|
-
children: RichTextRenderCommand[];
|
|
7
|
-
}
|
|
8
|
-
export interface ContentfulResourceMap {
|
|
9
|
-
readonly assetsBlock: Map<string, ContentfulAsset>;
|
|
10
|
-
readonly entriesInline: Map<string, ContentfulEntryBase>;
|
|
11
|
-
readonly entriesBlock: Map<string, ContentfulEntryBase>;
|
|
12
|
-
}
|