@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/CHANGELOG.md +12 -0
- package/fesm2022/ethlete-contentful.mjs +22 -18
- package/fesm2022/ethlete-contentful.mjs.map +1 -1
- package/index.d.ts +529 -10
- package/package.json +6 -5
- package/lib/components/audio/contentful-audio.component.d.ts +0 -16
- package/lib/components/audio/index.d.ts +0 -1
- package/lib/components/file/contentful-file.component.d.ts +0 -16
- package/lib/components/file/index.d.ts +0 -1
- package/lib/components/image/contentful-image.component.d.ts +0 -29
- package/lib/components/image/contentful-image.component.utils.d.ts +0 -17
- package/lib/components/image/index.d.ts +0 -2
- package/lib/components/rich-text-renderer/index.d.ts +0 -2
- package/lib/components/rich-text-renderer/rich-text-renderer.component.d.ts +0 -205
- package/lib/components/rich-text-renderer/rich-text-renderer.errors.d.ts +0 -12
- package/lib/components/rich-text-renderer/rich-text-renderer.util.d.ts +0 -4
- package/lib/components/video/contentful-video.component.d.ts +0 -14
- package/lib/components/video/index.d.ts +0 -1
- package/lib/constants/contentful.constants.d.ts +0 -3
- package/lib/constants/index.d.ts +0 -1
- package/lib/contentful.imports.d.ts +0 -6
- package/lib/gql/asset.fragments.d.ts +0 -77
- package/lib/gql/index.d.ts +0 -1
- package/lib/types/contentful.types.d.ts +0 -151
- package/lib/types/index.d.ts +0 -1
- package/lib/utils/contentful-config.d.ts +0 -2
- package/lib/utils/contentful.util.d.ts +0 -6
- package/lib/utils/index.d.ts +0 -2
|
@@ -1,205 +0,0 @@
|
|
|
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 { ContentfulCollection, ContentfulEntry, ContentfulEntryLinkItem, ContentfulRestAsset, RichTextResponse } from '../../types';
|
|
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 ATTRIBUTES: 4;
|
|
29
|
-
readonly TEXT: 5;
|
|
30
|
-
readonly TEXT_ID: 6;
|
|
31
|
-
};
|
|
32
|
-
export declare const COMPONENT_RENDER_COMMAND_POSITION: {
|
|
33
|
-
readonly ATTRIBUTES: 4;
|
|
34
|
-
readonly COMPONENT: 5;
|
|
35
|
-
readonly INPUTS: 6;
|
|
36
|
-
readonly COMPONENT_ID: 7;
|
|
37
|
-
};
|
|
38
|
-
type HtmlOpenRenderCommand = [
|
|
39
|
-
type: typeof RENDER_COMMAND_TYPE.HTML_OPEN,
|
|
40
|
-
nestingLevel: number,
|
|
41
|
-
domPosition: number,
|
|
42
|
-
index: number,
|
|
43
|
-
attributes: Record<string, string>,
|
|
44
|
-
tagName: string,
|
|
45
|
-
textId: string
|
|
46
|
-
];
|
|
47
|
-
type HtmlCloseRenderCommand = [
|
|
48
|
-
type: typeof RENDER_COMMAND_TYPE.HTML_CLOSE,
|
|
49
|
-
nestingLevel: number,
|
|
50
|
-
domPosition: number,
|
|
51
|
-
index: number,
|
|
52
|
-
tagName: string,
|
|
53
|
-
elementId: string
|
|
54
|
-
];
|
|
55
|
-
type TextRenderCommand = [
|
|
56
|
-
type: typeof RENDER_COMMAND_TYPE.TEXT,
|
|
57
|
-
nestingLevel: number,
|
|
58
|
-
domPosition: number,
|
|
59
|
-
index: number,
|
|
60
|
-
attributes: Record<string, string>,
|
|
61
|
-
text: string,
|
|
62
|
-
elementId: string
|
|
63
|
-
];
|
|
64
|
-
type ComponentRenderCommand = [
|
|
65
|
-
type: typeof RENDER_COMMAND_TYPE.COMPONENT,
|
|
66
|
-
nestingLevel: number,
|
|
67
|
-
domPosition: number,
|
|
68
|
-
index: number,
|
|
69
|
-
attributes: Record<string, string>,
|
|
70
|
-
component: ComponentType<unknown>,
|
|
71
|
-
inputs: Record<string, unknown>,
|
|
72
|
-
componentId: string
|
|
73
|
-
];
|
|
74
|
-
type RenderCommand = HtmlOpenRenderCommand | HtmlCloseRenderCommand | TextRenderCommand | ComponentRenderCommand;
|
|
75
|
-
export declare const RENDER_INSTRUCTION_POSITION: {
|
|
76
|
-
readonly TYPE: 0;
|
|
77
|
-
readonly COMMAND: 1;
|
|
78
|
-
};
|
|
79
|
-
export declare const RENDER_INSTRUCTION_TYPE: {
|
|
80
|
-
readonly CREATE: 0;
|
|
81
|
-
readonly UPDATE: 1;
|
|
82
|
-
readonly DELETE: 2;
|
|
83
|
-
readonly MOVE: 3;
|
|
84
|
-
};
|
|
85
|
-
type RenderInstructionTypeValue = (typeof RENDER_INSTRUCTION_TYPE)[keyof typeof RENDER_INSTRUCTION_TYPE];
|
|
86
|
-
type RenderInstruction = [RenderInstructionTypeValue, RenderCommand];
|
|
87
|
-
export declare const marksToClass: (marks: Mark[]) => string;
|
|
88
|
-
export declare const isHtmlOpenRenderCommand: (command: RenderCommand) => command is HtmlOpenRenderCommand;
|
|
89
|
-
export declare const isHtmlCloseRenderCommand: (command: RenderCommand) => command is HtmlCloseRenderCommand;
|
|
90
|
-
export declare const isTextRenderCommand: (command: RenderCommand) => command is TextRenderCommand;
|
|
91
|
-
export declare const isComponentRenderCommand: (command: RenderCommand) => command is ComponentRenderCommand;
|
|
92
|
-
export declare const getRenderCommandId: (command: RenderCommand) => string;
|
|
93
|
-
type ExecutedCommandCacheItemBase = {
|
|
94
|
-
element: HTMLElement;
|
|
95
|
-
};
|
|
96
|
-
type ExecutedComponentCommandCacheItem = {
|
|
97
|
-
command: ComponentRenderCommand;
|
|
98
|
-
componentRef: ComponentRef<unknown>;
|
|
99
|
-
} & ExecutedCommandCacheItemBase;
|
|
100
|
-
type ExecutedHtmlCommandCacheItem = {
|
|
101
|
-
command: HtmlOpenRenderCommand | HtmlCloseRenderCommand;
|
|
102
|
-
} & ExecutedCommandCacheItemBase;
|
|
103
|
-
type ExecutedTextCommandCacheItem = {
|
|
104
|
-
command: TextRenderCommand;
|
|
105
|
-
textNode: unknown;
|
|
106
|
-
} & ExecutedCommandCacheItemBase;
|
|
107
|
-
type ExecutedCommandCacheItem = ExecutedComponentCommandCacheItem | ExecutedHtmlCommandCacheItem | ExecutedTextCommandCacheItem;
|
|
108
|
-
export declare const isExecutedComponentCommandCacheItem: (cache: ExecutedCommandCacheItem) => cache is ExecutedComponentCommandCacheItem;
|
|
109
|
-
export declare const isExecutedHtmlOrTextCommandCacheItem: (cache: ExecutedCommandCacheItem) => cache is ExecutedHtmlCommandCacheItem;
|
|
110
|
-
export declare const isExecutedTextCommandCacheItem: (cache: ExecutedCommandCacheItem) => cache is ExecutedTextCommandCacheItem;
|
|
111
|
-
export declare const ET_CONTENTFUL_ANY_ENTRY_CONTENT_TYPE_SYS_ID = "$$$_et-contentful-any-entry-content-type-sys-id";
|
|
112
|
-
export type ContentfulIncludeMap = {
|
|
113
|
-
/**
|
|
114
|
-
* Select an entry by its ID and content type ID.
|
|
115
|
-
*
|
|
116
|
-
* The content type ID can be found inside the entry -> sys -> contentType -> sys -> id property.
|
|
117
|
-
*
|
|
118
|
-
* You can provide the `ET_CONTENTFUL_ANY_ENTRY_CONTENT_TYPE_SYS_ID` constant to match any entry sys ID.
|
|
119
|
-
* But be aware that this will return the entry as is without any type checking.
|
|
120
|
-
*/
|
|
121
|
-
getEntry: <T extends {
|
|
122
|
-
[key: string]: any;
|
|
123
|
-
}>(id: string, contentTypeId: string) => ContentfulEntry<T> | null;
|
|
124
|
-
/**
|
|
125
|
-
* Select multiple entries by their IDs and content type ID.
|
|
126
|
-
* If an entry is not found, it will be omitted from the result.
|
|
127
|
-
*
|
|
128
|
-
* The content type ID can be found inside the entry -> sys -> contentType -> sys -> id property.
|
|
129
|
-
*
|
|
130
|
-
* You can provide the `ET_CONTENTFUL_ANY_ENTRY_CONTENT_TYPE_SYS_ID` constant to match any entry sys ID.
|
|
131
|
-
* But be aware that this will return the entry as is without any type checking.
|
|
132
|
-
*/
|
|
133
|
-
getEntries: <T extends {
|
|
134
|
-
[key: string]: any;
|
|
135
|
-
}>(ids: string[] | ContentfulEntryLinkItem[], contentTypeId: string) => ContentfulEntry<T>[];
|
|
136
|
-
/**
|
|
137
|
-
* Select an asset by its ID.
|
|
138
|
-
*/
|
|
139
|
-
getAsset: (id: string) => ContentfulRestAsset | null;
|
|
140
|
-
/**
|
|
141
|
-
* Select multiple assets by their IDs. If an asset is not found, it will be omitted from the result.
|
|
142
|
-
*/
|
|
143
|
-
getAssets: (ids: string[]) => ContentfulRestAsset[];
|
|
144
|
-
};
|
|
145
|
-
export interface CreateContentfulIncludeMapConfig {
|
|
146
|
-
/** The entries that should be present inside the map */
|
|
147
|
-
entries: ContentfulEntry[];
|
|
148
|
-
/** The assets that should be present inside the map */
|
|
149
|
-
assets: ContentfulRestAsset[];
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Create a contentful include map using the provided entries and assets.
|
|
153
|
-
*/
|
|
154
|
-
export declare const createContentfulIncludeMap: (config: CreateContentfulIncludeMapConfig) => ContentfulIncludeMap;
|
|
155
|
-
export declare class ContentfulRichTextRendererComponent {
|
|
156
|
-
_viewContainerRef: ViewContainerRef;
|
|
157
|
-
_renderer: Renderer2;
|
|
158
|
-
_elementRef: ElementRef<HTMLElement>;
|
|
159
|
-
_document: Document;
|
|
160
|
-
_config: import("../../types").ContentfulConfig;
|
|
161
|
-
/**
|
|
162
|
-
* A cache for all executed commands that are not deleted.
|
|
163
|
-
* This is used to keep track of all rendered elements and components.
|
|
164
|
-
* The key is the render command element ID.
|
|
165
|
-
*/
|
|
166
|
-
_executedCommandsCache: Map<string, ExecutedCommandCacheItem>;
|
|
167
|
-
/**
|
|
168
|
-
* The contentful response gotten via their REST api.
|
|
169
|
-
* @see https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/entries/entries-collection
|
|
170
|
-
*/
|
|
171
|
-
content: import("@angular/core").InputSignal<ContentfulCollection | null | undefined>;
|
|
172
|
-
/**
|
|
173
|
-
* The path to where the rich text field is inside the contentful response. Dot and array notation is allowed.
|
|
174
|
-
* @example "items[0].fields.html"
|
|
175
|
-
*/
|
|
176
|
-
richTextPath: import("@angular/core").InputSignal<string>;
|
|
177
|
-
/**
|
|
178
|
-
* A map of all includes in the contentful response.
|
|
179
|
-
* This is useful for looking up assets and entries that are referenced in the rich text without having to use loops.
|
|
180
|
-
*/
|
|
181
|
-
contentIncludesMap: import("@angular/core").Signal<ContentfulIncludeMap>;
|
|
182
|
-
/**
|
|
183
|
-
* The rich text data that should be rendered.
|
|
184
|
-
*/
|
|
185
|
-
richTextData: import("@angular/core").Signal<RichTextResponse | null>;
|
|
186
|
-
renderCommands: import("@angular/core").Signal<RenderCommand[]>;
|
|
187
|
-
renderCommandHistory: import("@angular/core").Signal<[RenderCommand[], RenderCommand[]]>;
|
|
188
|
-
previousRenderCommandMap: import("@angular/core").Signal<Map<string | number, RenderCommand>>;
|
|
189
|
-
renderInstructions: import("@angular/core").Signal<RenderInstruction[]>;
|
|
190
|
-
constructor();
|
|
191
|
-
private _createRenderCommands;
|
|
192
|
-
private _execInstructions;
|
|
193
|
-
private _runCreateInstruction;
|
|
194
|
-
private _runUpdateInstruction;
|
|
195
|
-
private _runMoveInstruction;
|
|
196
|
-
private _runDeleteInstruction;
|
|
197
|
-
private _getComponentRootNode;
|
|
198
|
-
private _updateComponentInputs;
|
|
199
|
-
private _findParent;
|
|
200
|
-
private _findFollowingElement;
|
|
201
|
-
private _renderInsertOrAppend;
|
|
202
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ContentfulRichTextRendererComponent, never>;
|
|
203
|
-
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>;
|
|
204
|
-
}
|
|
205
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
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,4 +0,0 @@
|
|
|
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 +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 ContentfulVideoComponent {
|
|
6
|
-
asset: import("@angular/core").InputSignal<ContentfulGqlAsset | ContentfulRestAsset | null | undefined>;
|
|
7
|
-
videoClass: import("@angular/core").InputSignal<NgClassType>;
|
|
8
|
-
data: import("@angular/core").Signal<{
|
|
9
|
-
url: string | null;
|
|
10
|
-
contentType: string | null;
|
|
11
|
-
} | null>;
|
|
12
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ContentfulVideoComponent, never>;
|
|
13
|
-
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './contentful-video.component';
|
package/lib/constants/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './contentful.constants';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ContentfulAudioComponent } from './components/audio';
|
|
2
|
-
import { ContentfulFileComponent } from './components/file';
|
|
3
|
-
import { ContentfulImageComponent } from './components/image';
|
|
4
|
-
import { ContentfulRichTextRendererComponent } from './components/rich-text-renderer';
|
|
5
|
-
import { ContentfulVideoComponent } from './components/video';
|
|
6
|
-
export declare const ContentfulImports: readonly [typeof ContentfulAudioComponent, typeof ContentfulFileComponent, typeof ContentfulImageComponent, typeof ContentfulVideoComponent, typeof ContentfulRichTextRendererComponent];
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
export declare const GQL_FRAGMENT_CONTENTFUL_ASSET: string;
|
|
2
|
-
export interface ContentfulGqlAsset {
|
|
3
|
-
sys: {
|
|
4
|
-
id: string;
|
|
5
|
-
};
|
|
6
|
-
title: string | null;
|
|
7
|
-
contentType: string | null;
|
|
8
|
-
url: string | null;
|
|
9
|
-
description: string | null;
|
|
10
|
-
width: number | null;
|
|
11
|
-
height: number | null;
|
|
12
|
-
size: number | null;
|
|
13
|
-
}
|
|
14
|
-
export declare const isContentfulGqlAsset: (asset: any) => asset is ContentfulGqlAsset;
|
|
15
|
-
export type ContentfulGqlWhereFilter<TLinkedFrom extends Record<string, unknown> = Record<string, unknown>> = {
|
|
16
|
-
/**
|
|
17
|
-
* Filer by ids.
|
|
18
|
-
* @see https://www.contentful.com/developers/docs/references/graphql/#/reference/collection-filters/sys-filters
|
|
19
|
-
*/
|
|
20
|
-
sys?: {
|
|
21
|
-
id?: string;
|
|
22
|
-
id_not?: string;
|
|
23
|
-
id_in?: string[];
|
|
24
|
-
id_not_in?: string[];
|
|
25
|
-
id_contains?: string;
|
|
26
|
-
id_not_contains?: string;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Filer by tags.
|
|
30
|
-
* @see https://www.contentful.com/developers/docs/references/graphql/#/reference/collection-filters/contentfulmetadata-filters
|
|
31
|
-
*/
|
|
32
|
-
contentfulMetadata?: {
|
|
33
|
-
tags_exists?: boolean;
|
|
34
|
-
tags?: {
|
|
35
|
-
id_contains_some?: string[];
|
|
36
|
-
id_contains_none?: string[];
|
|
37
|
-
id_contains_all?: string[];
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Retrieve a collection of entries linked to the specified entry or asset.
|
|
42
|
-
* @see https://www.contentful.com/developers/docs/references/graphql/#links-to-a-specific-item
|
|
43
|
-
*/
|
|
44
|
-
linkedFrom?: TLinkedFrom;
|
|
45
|
-
};
|
|
46
|
-
export type ContentfulGqlOrder = `${string}_${'ASC' | 'DESC'}`;
|
|
47
|
-
export type ContentfulGqlCollectionFilterVariables<TCustomWhere extends Record<string, unknown> = Record<string, unknown>, TLinkedFrom extends Record<string, unknown> = Record<string, unknown>> = {
|
|
48
|
-
/**
|
|
49
|
-
* Zero-indexed offset in the collection from which items are fetched
|
|
50
|
-
* @default 0
|
|
51
|
-
*/
|
|
52
|
-
skip?: number;
|
|
53
|
-
/**
|
|
54
|
-
* Maximum number of items to fetch. Maximum is 1000.
|
|
55
|
-
* @default 100
|
|
56
|
-
*/
|
|
57
|
-
limit?: number;
|
|
58
|
-
/**
|
|
59
|
-
* Filter specifications to apply on the collection query.
|
|
60
|
-
* @see https://www.contentful.com/developers/docs/references/graphql/#/reference/collection-filters
|
|
61
|
-
*/
|
|
62
|
-
where?: TCustomWhere & ContentfulGqlWhereFilter<TLinkedFrom>;
|
|
63
|
-
/**
|
|
64
|
-
* Order specifications to apply on the collection query.
|
|
65
|
-
* @see https://www.contentful.com/developers/docs/references/graphql/#/reference/collection-order
|
|
66
|
-
*/
|
|
67
|
-
order?: ContentfulGqlOrder[];
|
|
68
|
-
/**
|
|
69
|
-
* When set to `true` the field will be resolved with non published content.
|
|
70
|
-
* @default false
|
|
71
|
-
*/
|
|
72
|
-
preview?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Locale for the collection items. If not set the default locale is used.
|
|
75
|
-
*/
|
|
76
|
-
locale?: string;
|
|
77
|
-
};
|
package/lib/gql/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './asset.fragments';
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { ComponentType } from '@angular/cdk/portal';
|
|
2
|
-
import { InputSignal } from '@angular/core';
|
|
3
|
-
import { Block, NodeData } from '@contentful/rich-text-types';
|
|
4
|
-
import { ContentfulIncludeMap } from '../components/rich-text-renderer';
|
|
5
|
-
import { ContentfulGqlAsset } from '../gql';
|
|
6
|
-
export type ContentfulImageResizeBehavior = 'pad' | 'crop' | 'fill' | 'scale' | 'thumb' | 'fit';
|
|
7
|
-
export type ContentfulImageFocusArea = 'top' | 'bottom' | 'left' | 'right' | 'center' | 'top_left' | 'top_right' | 'bottom_left' | 'bottom_right' | 'face' | 'faces';
|
|
8
|
-
export type ComponentLikeWithAsset = ComponentType<{
|
|
9
|
-
asset: InputSignal<ContentfulRestAsset | ContentfulGqlAsset | null | undefined>;
|
|
10
|
-
}>;
|
|
11
|
-
export type ComponentLikeWithContentfulRendererInputs = ComponentType<{
|
|
12
|
-
fields?: InputSignal<any>;
|
|
13
|
-
includes?: InputSignal<ContentfulIncludeMap>;
|
|
14
|
-
metadata?: InputSignal<ContentfulMetadata>;
|
|
15
|
-
sys?: InputSignal<ContentfulEntrySys>;
|
|
16
|
-
}>;
|
|
17
|
-
export interface ContentfulAssetComponents {
|
|
18
|
-
file: ComponentLikeWithAsset;
|
|
19
|
-
image: ComponentLikeWithAsset;
|
|
20
|
-
video: ComponentLikeWithAsset;
|
|
21
|
-
audio: ComponentLikeWithAsset;
|
|
22
|
-
}
|
|
23
|
-
export interface ContentfulConfig {
|
|
24
|
-
/**
|
|
25
|
-
* Default components for rendering contentful assets
|
|
26
|
-
*/
|
|
27
|
-
components: ContentfulAssetComponents;
|
|
28
|
-
/**
|
|
29
|
-
* Component for rendering embedded entries
|
|
30
|
-
*/
|
|
31
|
-
customComponents: Record<string, ComponentLikeWithContentfulRendererInputs>;
|
|
32
|
-
/**
|
|
33
|
-
* Determines if the contentful rich text renderer should render the contentful rich text with tailwind css classes
|
|
34
|
-
*/
|
|
35
|
-
useTailwindClasses: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Default options for the contentful image api
|
|
38
|
-
*/
|
|
39
|
-
imageOptions: {
|
|
40
|
-
/**
|
|
41
|
-
* Source set sizes. Eg.
|
|
42
|
-
* - `"400"` - 400px width
|
|
43
|
-
* - `"400x300"` - 400px width and 300px height
|
|
44
|
-
* - `"400w"` - 400px width
|
|
45
|
-
* - `"400h"` - 400px height
|
|
46
|
-
* - `"400wx300h"` - 400px width and 300px height
|
|
47
|
-
**/
|
|
48
|
-
srcsetSizes: string[];
|
|
49
|
-
/**
|
|
50
|
-
* Sizes for the image. Eg.
|
|
51
|
-
* - `"100vw"` - 100% of the viewport width
|
|
52
|
-
* - `"50vw"` - 50% of the viewport width
|
|
53
|
-
* - `(min-width: 30em) 30em"` - 30em if the viewport is at least 30em wide
|
|
54
|
-
*/
|
|
55
|
-
sizes: string[];
|
|
56
|
-
/**
|
|
57
|
-
* Background color for the image in hex. Eg. `"000000"`
|
|
58
|
-
*/
|
|
59
|
-
backgroundColor: string | null;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
export type ContentfulLinkType = 'Space' | 'ContentType' | 'Environment' | 'Entry' | 'Asset' | 'Tag';
|
|
63
|
-
export interface ContentfulLink<T extends ContentfulLinkType> {
|
|
64
|
-
type: 'Link';
|
|
65
|
-
linkType: T;
|
|
66
|
-
id: string;
|
|
67
|
-
}
|
|
68
|
-
export type ContentfulSpaceLink = ContentfulLink<'Space'>;
|
|
69
|
-
export type ContentfulEnvironmentLink = ContentfulLink<'Environment'>;
|
|
70
|
-
export type ContentfulContentTypeLink = ContentfulLink<'ContentType'>;
|
|
71
|
-
export type ContentfulEntryLink = ContentfulLink<'Entry'>;
|
|
72
|
-
export type ContentfulAssetLink = ContentfulLink<'Asset'>;
|
|
73
|
-
export type ContentfulTagLink = ContentfulLink<'Tag'>;
|
|
74
|
-
export interface ContentfulTagLinkItem {
|
|
75
|
-
sys: ContentfulTagLink;
|
|
76
|
-
}
|
|
77
|
-
export interface ContentfulEntryLinkItem {
|
|
78
|
-
sys: ContentfulEntryLink;
|
|
79
|
-
}
|
|
80
|
-
export interface ContentfulAssetLinkItem {
|
|
81
|
-
sys: ContentfulAssetLink;
|
|
82
|
-
}
|
|
83
|
-
export interface ContentfulMetadata {
|
|
84
|
-
tags: ContentfulTagLinkItem[];
|
|
85
|
-
}
|
|
86
|
-
export type ContentfulSys = {
|
|
87
|
-
type: string;
|
|
88
|
-
id: string;
|
|
89
|
-
createdAt: string;
|
|
90
|
-
updatedAt: string;
|
|
91
|
-
locale: string;
|
|
92
|
-
revision?: number;
|
|
93
|
-
space?: {
|
|
94
|
-
sys: ContentfulSpaceLink;
|
|
95
|
-
};
|
|
96
|
-
environment?: {
|
|
97
|
-
sys: ContentfulEnvironmentLink;
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
export type ContentfulEntrySys = ContentfulSys & {
|
|
101
|
-
contentType: {
|
|
102
|
-
sys: ContentfulContentTypeLink;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
export interface ContentfulAssetImageData {
|
|
106
|
-
width: number;
|
|
107
|
-
height: number;
|
|
108
|
-
}
|
|
109
|
-
export interface ContentfulAssetFileData {
|
|
110
|
-
url: string | null;
|
|
111
|
-
details: {
|
|
112
|
-
size: number | null;
|
|
113
|
-
image?: ContentfulAssetImageData;
|
|
114
|
-
};
|
|
115
|
-
fileName: string | null;
|
|
116
|
-
contentType: string | null;
|
|
117
|
-
}
|
|
118
|
-
export interface ContentfulRestAsset {
|
|
119
|
-
sys: ContentfulSys;
|
|
120
|
-
fields: {
|
|
121
|
-
title: string;
|
|
122
|
-
description: string;
|
|
123
|
-
file: ContentfulAssetFileData;
|
|
124
|
-
};
|
|
125
|
-
metadata: ContentfulMetadata;
|
|
126
|
-
}
|
|
127
|
-
export interface ContentfulEntry<T = {
|
|
128
|
-
[key: string]: any;
|
|
129
|
-
}> {
|
|
130
|
-
sys: ContentfulEntrySys;
|
|
131
|
-
fields: T;
|
|
132
|
-
metadata: ContentfulMetadata;
|
|
133
|
-
}
|
|
134
|
-
export interface ContentfulCollection {
|
|
135
|
-
includes: {
|
|
136
|
-
Asset: ContentfulRestAsset[];
|
|
137
|
-
Entry: ContentfulEntry[];
|
|
138
|
-
};
|
|
139
|
-
items: ContentfulEntry[];
|
|
140
|
-
limit: number;
|
|
141
|
-
skip: number;
|
|
142
|
-
total: number;
|
|
143
|
-
sys: {
|
|
144
|
-
type: 'Array';
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
export interface RichTextResponse {
|
|
148
|
-
nodeType: 'document';
|
|
149
|
-
data: NodeData;
|
|
150
|
-
content: Block[];
|
|
151
|
-
}
|
package/lib/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './contentful.types';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ContentfulConfig, ContentfulEntry } from '../types';
|
|
2
|
-
export declare const provideContentfulConfig: (contentfulConfig?: Partial<ContentfulConfig> | null | undefined) => {
|
|
3
|
-
provide: import("@angular/core").InjectionToken<ContentfulConfig>;
|
|
4
|
-
useValue: ContentfulConfig;
|
|
5
|
-
};
|
|
6
|
-
export declare const isContentfulEntryType: <T extends ContentfulEntry>(entry: ContentfulEntry, type: string) => entry is T;
|
package/lib/utils/index.d.ts
DELETED