@ethlete/contentful 0.1.0-next.6 → 0.1.0-next.8
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/esm2020/lib/components/audio/contentful-audio.component.mjs +3 -3
- package/esm2020/lib/components/file/contentful-file.component.mjs +3 -3
- package/esm2020/lib/components/image/contentful-image.component.mjs +25 -13
- package/esm2020/lib/components/rich-text-renderer/rich-text-renderer.component.mjs +12 -9
- package/esm2020/lib/components/rich-text-renderer/rich-text-renderer.util.mjs +2 -16
- package/esm2020/lib/components/video/contentful-video.component.mjs +3 -3
- package/esm2020/lib/constants/contentful.constants.mjs +2 -2
- package/esm2020/lib/contentful.module.mjs +4 -4
- package/esm2020/lib/public-api.mjs +2 -2
- package/esm2020/lib/types/contentful.types.mjs +1 -1
- package/esm2020/lib/utils/contentful-config.mjs +12 -15
- package/esm2020/lib/utils/contentful.util.mjs +4 -3
- package/fesm2015/ethlete-contentful.mjs +221 -224
- package/fesm2015/ethlete-contentful.mjs.map +1 -1
- package/fesm2020/ethlete-contentful.mjs +222 -220
- package/fesm2020/ethlete-contentful.mjs.map +1 -1
- package/lib/components/audio/contentful-audio.component.d.ts +1 -1
- package/lib/components/file/contentful-file.component.d.ts +1 -1
- package/lib/components/image/contentful-image.component.d.ts +5 -1
- package/lib/components/rich-text-renderer/rich-text-renderer.component.d.ts +1 -1
- package/lib/components/rich-text-renderer/rich-text-renderer.util.d.ts +1 -16
- package/lib/components/video/contentful-video.component.d.ts +1 -1
- package/lib/constants/contentful.constants.d.ts +1 -1
- package/lib/public-api.d.ts +1 -1
- package/lib/types/contentful.types.d.ts +26 -0
- package/lib/utils/contentful-config.d.ts +2 -26
- package/lib/utils/contentful.util.d.ts +2 -2
- package/package.json +4 -4
- package/esm2020/lib/components/audio/index.mjs +0 -2
- package/esm2020/lib/components/file/index.mjs +0 -2
- package/esm2020/lib/components/image/index.mjs +0 -2
- package/esm2020/lib/components/video/index.mjs +0 -2
- package/esm2020/lib/utils/index.mjs +0 -2
- package/lib/components/audio/index.d.ts +0 -1
- package/lib/components/file/index.d.ts +0 -1
- package/lib/components/image/index.d.ts +0 -1
- package/lib/components/video/index.d.ts +0 -1
- package/lib/utils/index.d.ts +0 -1
|
@@ -1,215 +1,30 @@
|
|
|
1
|
-
import { NgIf, NgClass,
|
|
1
|
+
import { DOCUMENT, NgIf, NgClass, NgOptimizedImage } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, inject,
|
|
3
|
+
import { InjectionToken, inject, Renderer2, ElementRef, ViewContainerRef, ComponentFactoryResolver, ApplicationRef, Injector, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, NgModule } from '@angular/core';
|
|
4
4
|
import { DomPortalOutlet, ComponentPortal } from '@angular/cdk/portal';
|
|
5
|
+
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
5
6
|
import { BLOCKS, INLINES } from '@contentful/rich-text-types';
|
|
6
7
|
|
|
7
|
-
const CONTENTFUL_CONFIG = new InjectionToken('
|
|
8
|
+
const CONTENTFUL_CONFIG = new InjectionToken('ContentfulConfig');
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Determines if the contentful rich text renderer should render the contentful rich text with tailwind css classes
|
|
22
|
-
*/
|
|
23
|
-
this.useTailwindClasses = false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const provideContentfulConfig = (contentfulConfig) => {
|
|
28
|
-
return { provide: CONTENTFUL_CONFIG, useValue: contentfulConfig };
|
|
29
|
-
};
|
|
10
|
+
const createContentfulConfig = (config = {}) => (Object.assign({
|
|
11
|
+
useTailwindClasses: false,
|
|
12
|
+
components: {
|
|
13
|
+
audio: ContentfulAudioComponent,
|
|
14
|
+
file: ContentfulFileComponent,
|
|
15
|
+
image: ContentfulImageComponent,
|
|
16
|
+
video: ContentfulVideoComponent,
|
|
17
|
+
},
|
|
18
|
+
customComponents: {},
|
|
19
|
+
}, (config || {})));
|
|
30
20
|
|
|
31
21
|
const RICH_TEXT_RENDERER_COMPONENT_DATA = new InjectionToken('RICH_TEXT_RENDERER_COMPONENT_DATA');
|
|
32
22
|
|
|
33
|
-
class ContentfulFileComponent {
|
|
34
|
-
constructor() {
|
|
35
|
-
this._richTextData = inject(RICH_TEXT_RENDERER_COMPONENT_DATA, { optional: true });
|
|
36
|
-
this._data = null;
|
|
37
|
-
this.fileClass = null;
|
|
38
|
-
}
|
|
39
|
-
get data() {
|
|
40
|
-
return this._data;
|
|
41
|
-
}
|
|
42
|
-
set data(v) {
|
|
43
|
-
if (v && !v.contentType) {
|
|
44
|
-
this._data = null;
|
|
45
|
-
console.warn('The provided asset is invalid', v);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
this._data = v !== null && v !== void 0 ? v : null;
|
|
49
|
-
}
|
|
50
|
-
ngOnInit() {
|
|
51
|
-
if (this._richTextData && !this.data) {
|
|
52
|
-
this.data = this._richTextData;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
ContentfulFileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.9", ngImport: i0, type: ContentfulFileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
57
|
-
ContentfulFileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.9", type: ContentfulFileComponent, isStandalone: true, selector: "et-contentful-file", inputs: { data: "data", fileClass: "fileClass" }, ngImport: i0, template: `
|
|
58
|
-
<a *ngIf="data" [href]="data.url" [ngClass]="fileClass" class="underline" target="_blank">
|
|
59
|
-
{{ data.title }} ({{ data.size }} Bytes)
|
|
60
|
-
</a>
|
|
61
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
62
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImport: i0, type: ContentfulFileComponent, decorators: [{
|
|
63
|
-
type: Component,
|
|
64
|
-
args: [{
|
|
65
|
-
selector: 'et-contentful-file',
|
|
66
|
-
template: `
|
|
67
|
-
<a *ngIf="data" [href]="data.url" [ngClass]="fileClass" class="underline" target="_blank">
|
|
68
|
-
{{ data.title }} ({{ data.size }} Bytes)
|
|
69
|
-
</a>
|
|
70
|
-
`,
|
|
71
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
72
|
-
encapsulation: ViewEncapsulation.None,
|
|
73
|
-
standalone: true,
|
|
74
|
-
imports: [NgIf, NgClass],
|
|
75
|
-
}]
|
|
76
|
-
}], propDecorators: { data: [{
|
|
77
|
-
type: Input
|
|
78
|
-
}], fileClass: [{
|
|
79
|
-
type: Input
|
|
80
|
-
}] } });
|
|
81
|
-
|
|
82
|
-
class ContentfulImageComponent {
|
|
83
|
-
constructor() {
|
|
84
|
-
this._richTextData = inject(RICH_TEXT_RENDERER_COMPONENT_DATA, { optional: true });
|
|
85
|
-
this._data = null;
|
|
86
|
-
this.imgClass = null;
|
|
87
|
-
this.pictureClass = null;
|
|
88
|
-
}
|
|
89
|
-
get data() {
|
|
90
|
-
return this._data;
|
|
91
|
-
}
|
|
92
|
-
set data(v) {
|
|
93
|
-
if (v && !v.contentType) {
|
|
94
|
-
this._data = null;
|
|
95
|
-
console.warn('The provided asset is invalid', v);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (v && !v.contentType.startsWith('image/')) {
|
|
99
|
-
throw new Error('The provided asset is not an image');
|
|
100
|
-
}
|
|
101
|
-
this._data = v !== null && v !== void 0 ? v : null;
|
|
102
|
-
}
|
|
103
|
-
ngOnInit() {
|
|
104
|
-
if (this._richTextData && !this.data) {
|
|
105
|
-
this.data = this._richTextData;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
ContentfulImageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.9", ngImport: i0, type: ContentfulImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
110
|
-
ContentfulImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.9", type: ContentfulImageComponent, isStandalone: true, selector: "et-contentful-image", inputs: { data: "data", imgClass: "imgClass", pictureClass: "pictureClass" }, ngImport: i0, template: `
|
|
111
|
-
<picture *ngIf="data" [ngClass]="pictureClass">
|
|
112
|
-
<source srcset="{{ data.url }}?fm=avif" type="image/avif" />
|
|
113
|
-
<source srcset="{{ data.url }}?fm=webp" type="image/webp" />
|
|
114
|
-
<source srcset="{{ data.url }}?fm=jpg" type="image/jpeg" />
|
|
115
|
-
<img
|
|
116
|
-
[attr.alt]="data.description ?? undefined"
|
|
117
|
-
[attr.width]="data.width ?? undefined"
|
|
118
|
-
[attr.height]="data.height ?? undefined"
|
|
119
|
-
[ngClass]="imgClass"
|
|
120
|
-
src="{{ data.url }}"
|
|
121
|
-
/>
|
|
122
|
-
</picture>
|
|
123
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
124
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImport: i0, type: ContentfulImageComponent, decorators: [{
|
|
125
|
-
type: Component,
|
|
126
|
-
args: [{
|
|
127
|
-
selector: 'et-contentful-image',
|
|
128
|
-
template: `
|
|
129
|
-
<picture *ngIf="data" [ngClass]="pictureClass">
|
|
130
|
-
<source srcset="{{ data.url }}?fm=avif" type="image/avif" />
|
|
131
|
-
<source srcset="{{ data.url }}?fm=webp" type="image/webp" />
|
|
132
|
-
<source srcset="{{ data.url }}?fm=jpg" type="image/jpeg" />
|
|
133
|
-
<img
|
|
134
|
-
[attr.alt]="data.description ?? undefined"
|
|
135
|
-
[attr.width]="data.width ?? undefined"
|
|
136
|
-
[attr.height]="data.height ?? undefined"
|
|
137
|
-
[ngClass]="imgClass"
|
|
138
|
-
src="{{ data.url }}"
|
|
139
|
-
/>
|
|
140
|
-
</picture>
|
|
141
|
-
`,
|
|
142
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
143
|
-
encapsulation: ViewEncapsulation.None,
|
|
144
|
-
standalone: true,
|
|
145
|
-
imports: [NgIf, NgClass],
|
|
146
|
-
}]
|
|
147
|
-
}], propDecorators: { data: [{
|
|
148
|
-
type: Input
|
|
149
|
-
}], imgClass: [{
|
|
150
|
-
type: Input
|
|
151
|
-
}], pictureClass: [{
|
|
152
|
-
type: Input
|
|
153
|
-
}] } });
|
|
154
|
-
|
|
155
|
-
class ContentfulVideoComponent {
|
|
156
|
-
constructor() {
|
|
157
|
-
this._richTextData = inject(RICH_TEXT_RENDERER_COMPONENT_DATA, { optional: true });
|
|
158
|
-
this._data = null;
|
|
159
|
-
this.videoClass = null;
|
|
160
|
-
}
|
|
161
|
-
get data() {
|
|
162
|
-
return this._data;
|
|
163
|
-
}
|
|
164
|
-
set data(v) {
|
|
165
|
-
if (v && !v.contentType) {
|
|
166
|
-
this._data = null;
|
|
167
|
-
console.warn('The provided asset is invalid', v);
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
if (v && !v.contentType.startsWith('video/')) {
|
|
171
|
-
throw new Error('The provided asset is not an video');
|
|
172
|
-
}
|
|
173
|
-
this._data = v !== null && v !== void 0 ? v : null;
|
|
174
|
-
}
|
|
175
|
-
ngOnInit() {
|
|
176
|
-
if (this._richTextData && !this.data) {
|
|
177
|
-
this.data = this._richTextData;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
ContentfulVideoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.9", ngImport: i0, type: ContentfulVideoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
182
|
-
ContentfulVideoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.9", type: ContentfulVideoComponent, isStandalone: true, selector: "et-contentful-video", inputs: { data: "data", videoClass: "videoClass" }, ngImport: i0, template: `
|
|
183
|
-
<video *ngIf="data" [ngClass]="videoClass" controls>
|
|
184
|
-
<source src="{{ data.url }}" type="{{ data.contentType }}" />
|
|
185
|
-
</video>
|
|
186
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
187
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImport: i0, type: ContentfulVideoComponent, decorators: [{
|
|
188
|
-
type: Component,
|
|
189
|
-
args: [{
|
|
190
|
-
selector: 'et-contentful-video',
|
|
191
|
-
template: `
|
|
192
|
-
<video *ngIf="data" [ngClass]="videoClass" controls>
|
|
193
|
-
<source src="{{ data.url }}" type="{{ data.contentType }}" />
|
|
194
|
-
</video>
|
|
195
|
-
`,
|
|
196
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
197
|
-
encapsulation: ViewEncapsulation.None,
|
|
198
|
-
standalone: true,
|
|
199
|
-
imports: [NgIf, NgClass],
|
|
200
|
-
}]
|
|
201
|
-
}], propDecorators: { data: [{
|
|
202
|
-
type: Input
|
|
203
|
-
}], videoClass: [{
|
|
204
|
-
type: Input
|
|
205
|
-
}] } });
|
|
206
|
-
|
|
207
23
|
const createRenderCommandsFromContentfulRichText = (options) => {
|
|
208
24
|
const { data, config } = options;
|
|
209
25
|
const commands = [];
|
|
210
|
-
const assetComponents = getAssetComponentsFromConfig(config);
|
|
211
26
|
const resourceMap = createContentfulResourceMap(data.links);
|
|
212
|
-
createContentfulRenderCommand(data.json, { children: commands, payload: data.json.nodeType }, resourceMap, config.useTailwindClasses,
|
|
27
|
+
createContentfulRenderCommand(data.json, { children: commands, payload: data.json.nodeType }, resourceMap, config.useTailwindClasses, config.components, config.customComponents);
|
|
213
28
|
return commands;
|
|
214
29
|
};
|
|
215
30
|
const createContentfulRenderCommand = (node, parent, resourceMap, useTailwindClasses, assetComponents, customComponents) => {
|
|
@@ -295,15 +110,6 @@ const getContentfulNodeProps = (node) => {
|
|
|
295
110
|
value,
|
|
296
111
|
};
|
|
297
112
|
};
|
|
298
|
-
const getAssetComponentsFromConfig = (config) => {
|
|
299
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
300
|
-
return {
|
|
301
|
-
file: (_b = (_a = config.components) === null || _a === void 0 ? void 0 : _a.file) !== null && _b !== void 0 ? _b : ContentfulFileComponent,
|
|
302
|
-
image: (_d = (_c = config.components) === null || _c === void 0 ? void 0 : _c.image) !== null && _d !== void 0 ? _d : ContentfulImageComponent,
|
|
303
|
-
video: (_f = (_e = config.components) === null || _e === void 0 ? void 0 : _e.video) !== null && _f !== void 0 ? _f : ContentfulVideoComponent,
|
|
304
|
-
audio: (_h = (_g = config.components) === null || _g === void 0 ? void 0 : _g.audio) !== null && _h !== void 0 ? _h : ContentfulAudioComponent,
|
|
305
|
-
};
|
|
306
|
-
};
|
|
307
113
|
const transformContentfulMarks = (marks, useTailwindClasses) => {
|
|
308
114
|
return marks
|
|
309
115
|
.map((mark) => {
|
|
@@ -369,7 +175,6 @@ const translateContentfulNodeTypeToHtmlTag = (nodeType) => {
|
|
|
369
175
|
// Will be ignored by the renderer
|
|
370
176
|
case 'document':
|
|
371
177
|
return 'document';
|
|
372
|
-
// TODO(TRB): These should render components
|
|
373
178
|
case BLOCKS.EMBEDDED_ENTRY:
|
|
374
179
|
return 'div';
|
|
375
180
|
case INLINES.EMBEDDED_ENTRY:
|
|
@@ -413,15 +218,18 @@ class ContentfulRichTextRendererComponent {
|
|
|
413
218
|
this._document = inject(DOCUMENT);
|
|
414
219
|
this._appRef = inject(ApplicationRef);
|
|
415
220
|
this._injector = inject(Injector);
|
|
416
|
-
this._config = (_a = inject(CONTENTFUL_CONFIG, { optional: true })) !== null && _a !== void 0 ? _a :
|
|
221
|
+
this._config = (_a = inject(CONTENTFUL_CONFIG, { optional: true })) !== null && _a !== void 0 ? _a : createContentfulConfig();
|
|
417
222
|
}
|
|
418
223
|
get richText() {
|
|
419
224
|
return this._richText;
|
|
420
225
|
}
|
|
421
226
|
set richText(v) {
|
|
422
227
|
this._richText = v !== null && v !== void 0 ? v : null;
|
|
423
|
-
// clear
|
|
424
|
-
this.
|
|
228
|
+
// clear childNodes to prevent appending new richtext elements to existing one
|
|
229
|
+
const childElements = this._elementRef.nativeElement.childNodes;
|
|
230
|
+
for (const child of childElements) {
|
|
231
|
+
this._renderer.removeChild(this._elementRef.nativeElement, child);
|
|
232
|
+
}
|
|
425
233
|
if (!v) {
|
|
426
234
|
return;
|
|
427
235
|
}
|
|
@@ -478,9 +286,9 @@ class ContentfulRichTextRendererComponent {
|
|
|
478
286
|
}
|
|
479
287
|
}
|
|
480
288
|
}
|
|
481
|
-
ContentfulRichTextRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
482
|
-
ContentfulRichTextRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
483
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
289
|
+
ContentfulRichTextRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ContentfulRichTextRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
290
|
+
ContentfulRichTextRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.2", type: ContentfulRichTextRendererComponent, isStandalone: true, selector: "et-contentful-rich-text-renderer", inputs: { richText: "richText" }, host: { classAttribute: "et-contentful-rich-text-renderer" }, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
291
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ContentfulRichTextRendererComponent, decorators: [{
|
|
484
292
|
type: Component,
|
|
485
293
|
args: [{
|
|
486
294
|
selector: 'et-contentful-rich-text-renderer',
|
|
@@ -524,14 +332,14 @@ class ContentfulAudioComponent {
|
|
|
524
332
|
}
|
|
525
333
|
}
|
|
526
334
|
}
|
|
527
|
-
ContentfulAudioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
528
|
-
ContentfulAudioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
335
|
+
ContentfulAudioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ContentfulAudioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
336
|
+
ContentfulAudioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.2", type: ContentfulAudioComponent, isStandalone: true, selector: "et-contentful-audio", inputs: { data: "data", audioClass: "audioClass", figureClass: "figureClass", figcaptionClass: "figcaptionClass" }, ngImport: i0, template: `
|
|
529
337
|
<figure *ngIf="data" [ngClass]="figureClass">
|
|
530
338
|
<figcaption [ngClass]="figcaptionClass">{{ data.title }}</figcaption>
|
|
531
339
|
<audio [ngClass]="audioClass" controls src="{{ data.url }}"></audio>
|
|
532
340
|
</figure>
|
|
533
341
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
534
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ContentfulAudioComponent, decorators: [{
|
|
535
343
|
type: Component,
|
|
536
344
|
args: [{
|
|
537
345
|
selector: 'et-contentful-audio',
|
|
@@ -556,10 +364,195 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImpor
|
|
|
556
364
|
type: Input
|
|
557
365
|
}] } });
|
|
558
366
|
|
|
367
|
+
class ContentfulFileComponent {
|
|
368
|
+
constructor() {
|
|
369
|
+
this._richTextData = inject(RICH_TEXT_RENDERER_COMPONENT_DATA, { optional: true });
|
|
370
|
+
this._data = null;
|
|
371
|
+
this.fileClass = null;
|
|
372
|
+
}
|
|
373
|
+
get data() {
|
|
374
|
+
return this._data;
|
|
375
|
+
}
|
|
376
|
+
set data(v) {
|
|
377
|
+
if (v && !v.contentType) {
|
|
378
|
+
this._data = null;
|
|
379
|
+
console.warn('The provided asset is invalid', v);
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
this._data = v !== null && v !== void 0 ? v : null;
|
|
383
|
+
}
|
|
384
|
+
ngOnInit() {
|
|
385
|
+
if (this._richTextData && !this.data) {
|
|
386
|
+
this.data = this._richTextData;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
ContentfulFileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ContentfulFileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
391
|
+
ContentfulFileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.2", type: ContentfulFileComponent, isStandalone: true, selector: "et-contentful-file", inputs: { data: "data", fileClass: "fileClass" }, ngImport: i0, template: `
|
|
392
|
+
<a *ngIf="data" [href]="data.url" [ngClass]="fileClass" class="underline" target="_blank">
|
|
393
|
+
{{ data.title }} ({{ data.size }} Bytes)
|
|
394
|
+
</a>
|
|
395
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
396
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ContentfulFileComponent, decorators: [{
|
|
397
|
+
type: Component,
|
|
398
|
+
args: [{
|
|
399
|
+
selector: 'et-contentful-file',
|
|
400
|
+
template: `
|
|
401
|
+
<a *ngIf="data" [href]="data.url" [ngClass]="fileClass" class="underline" target="_blank">
|
|
402
|
+
{{ data.title }} ({{ data.size }} Bytes)
|
|
403
|
+
</a>
|
|
404
|
+
`,
|
|
405
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
406
|
+
encapsulation: ViewEncapsulation.None,
|
|
407
|
+
standalone: true,
|
|
408
|
+
imports: [NgIf, NgClass],
|
|
409
|
+
}]
|
|
410
|
+
}], propDecorators: { data: [{
|
|
411
|
+
type: Input
|
|
412
|
+
}], fileClass: [{
|
|
413
|
+
type: Input
|
|
414
|
+
}] } });
|
|
415
|
+
|
|
416
|
+
class ContentfulImageComponent {
|
|
417
|
+
constructor() {
|
|
418
|
+
this._richTextData = inject(RICH_TEXT_RENDERER_COMPONENT_DATA, { optional: true });
|
|
419
|
+
this._data = null;
|
|
420
|
+
this.imgClass = null;
|
|
421
|
+
this.pictureClass = null;
|
|
422
|
+
this._priority = false;
|
|
423
|
+
}
|
|
424
|
+
get data() {
|
|
425
|
+
return this._data;
|
|
426
|
+
}
|
|
427
|
+
set data(v) {
|
|
428
|
+
if (v && !v.contentType) {
|
|
429
|
+
this._data = null;
|
|
430
|
+
console.warn('The provided asset is invalid', v);
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
if (v && !v.contentType.startsWith('image/')) {
|
|
434
|
+
throw new Error('The provided asset is not an image');
|
|
435
|
+
}
|
|
436
|
+
this._data = v !== null && v !== void 0 ? v : null;
|
|
437
|
+
}
|
|
438
|
+
get priority() {
|
|
439
|
+
return this._priority;
|
|
440
|
+
}
|
|
441
|
+
set priority(value) {
|
|
442
|
+
this._priority = coerceBooleanProperty(value);
|
|
443
|
+
}
|
|
444
|
+
ngOnInit() {
|
|
445
|
+
if (this._richTextData && !this.data) {
|
|
446
|
+
this.data = this._richTextData;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
ContentfulImageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ContentfulImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
451
|
+
ContentfulImageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.2", type: ContentfulImageComponent, isStandalone: true, selector: "et-contentful-image", inputs: { data: "data", imgClass: "imgClass", pictureClass: "pictureClass", priority: "priority" }, ngImport: i0, template: `
|
|
452
|
+
<picture *ngIf="data" [ngClass]="pictureClass">
|
|
453
|
+
<source srcset="{{ data.url }}?fm=avif" type="image/avif" />
|
|
454
|
+
<source srcset="{{ data.url }}?fm=webp" type="image/webp" />
|
|
455
|
+
<source srcset="{{ data.url }}?fm=jpg" type="image/jpeg" />
|
|
456
|
+
<img
|
|
457
|
+
[attr.alt]="data.description ?? undefined"
|
|
458
|
+
[width]="data.width ?? undefined"
|
|
459
|
+
[height]="data.height ?? undefined"
|
|
460
|
+
[priority]="data.priority ?? priority"
|
|
461
|
+
[ngClass]="imgClass"
|
|
462
|
+
ngSrc="{{ data.url }}"
|
|
463
|
+
/>
|
|
464
|
+
</picture>
|
|
465
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "loading", "priority", "disableOptimizedSrcset", "fill", "src", "srcset"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
466
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ContentfulImageComponent, decorators: [{
|
|
467
|
+
type: Component,
|
|
468
|
+
args: [{
|
|
469
|
+
selector: 'et-contentful-image',
|
|
470
|
+
template: `
|
|
471
|
+
<picture *ngIf="data" [ngClass]="pictureClass">
|
|
472
|
+
<source srcset="{{ data.url }}?fm=avif" type="image/avif" />
|
|
473
|
+
<source srcset="{{ data.url }}?fm=webp" type="image/webp" />
|
|
474
|
+
<source srcset="{{ data.url }}?fm=jpg" type="image/jpeg" />
|
|
475
|
+
<img
|
|
476
|
+
[attr.alt]="data.description ?? undefined"
|
|
477
|
+
[width]="data.width ?? undefined"
|
|
478
|
+
[height]="data.height ?? undefined"
|
|
479
|
+
[priority]="data.priority ?? priority"
|
|
480
|
+
[ngClass]="imgClass"
|
|
481
|
+
ngSrc="{{ data.url }}"
|
|
482
|
+
/>
|
|
483
|
+
</picture>
|
|
484
|
+
`,
|
|
485
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
486
|
+
encapsulation: ViewEncapsulation.None,
|
|
487
|
+
standalone: true,
|
|
488
|
+
imports: [NgIf, NgClass, NgOptimizedImage],
|
|
489
|
+
}]
|
|
490
|
+
}], propDecorators: { data: [{
|
|
491
|
+
type: Input
|
|
492
|
+
}], imgClass: [{
|
|
493
|
+
type: Input
|
|
494
|
+
}], pictureClass: [{
|
|
495
|
+
type: Input
|
|
496
|
+
}], priority: [{
|
|
497
|
+
type: Input
|
|
498
|
+
}] } });
|
|
499
|
+
|
|
500
|
+
class ContentfulVideoComponent {
|
|
501
|
+
constructor() {
|
|
502
|
+
this._richTextData = inject(RICH_TEXT_RENDERER_COMPONENT_DATA, { optional: true });
|
|
503
|
+
this._data = null;
|
|
504
|
+
this.videoClass = null;
|
|
505
|
+
}
|
|
506
|
+
get data() {
|
|
507
|
+
return this._data;
|
|
508
|
+
}
|
|
509
|
+
set data(v) {
|
|
510
|
+
if (v && !v.contentType) {
|
|
511
|
+
this._data = null;
|
|
512
|
+
console.warn('The provided asset is invalid', v);
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
if (v && !v.contentType.startsWith('video/')) {
|
|
516
|
+
throw new Error('The provided asset is not an video');
|
|
517
|
+
}
|
|
518
|
+
this._data = v !== null && v !== void 0 ? v : null;
|
|
519
|
+
}
|
|
520
|
+
ngOnInit() {
|
|
521
|
+
if (this._richTextData && !this.data) {
|
|
522
|
+
this.data = this._richTextData;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
ContentfulVideoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ContentfulVideoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
527
|
+
ContentfulVideoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.2", type: ContentfulVideoComponent, isStandalone: true, selector: "et-contentful-video", inputs: { data: "data", videoClass: "videoClass" }, ngImport: i0, template: `
|
|
528
|
+
<video *ngIf="data" [ngClass]="videoClass" controls>
|
|
529
|
+
<source src="{{ data.url }}" type="{{ data.contentType }}" />
|
|
530
|
+
</video>
|
|
531
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
532
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ContentfulVideoComponent, decorators: [{
|
|
533
|
+
type: Component,
|
|
534
|
+
args: [{
|
|
535
|
+
selector: 'et-contentful-video',
|
|
536
|
+
template: `
|
|
537
|
+
<video *ngIf="data" [ngClass]="videoClass" controls>
|
|
538
|
+
<source src="{{ data.url }}" type="{{ data.contentType }}" />
|
|
539
|
+
</video>
|
|
540
|
+
`,
|
|
541
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
542
|
+
encapsulation: ViewEncapsulation.None,
|
|
543
|
+
standalone: true,
|
|
544
|
+
imports: [NgIf, NgClass],
|
|
545
|
+
}]
|
|
546
|
+
}], propDecorators: { data: [{
|
|
547
|
+
type: Input
|
|
548
|
+
}], videoClass: [{
|
|
549
|
+
type: Input
|
|
550
|
+
}] } });
|
|
551
|
+
|
|
559
552
|
class ContentfulModule {
|
|
560
553
|
}
|
|
561
|
-
ContentfulModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
562
|
-
ContentfulModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
554
|
+
ContentfulModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ContentfulModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
555
|
+
ContentfulModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.2", ngImport: i0, type: ContentfulModule, imports: [ContentfulAudioComponent,
|
|
563
556
|
ContentfulFileComponent,
|
|
564
557
|
ContentfulImageComponent,
|
|
565
558
|
ContentfulVideoComponent,
|
|
@@ -568,12 +561,12 @@ ContentfulModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
|
|
|
568
561
|
ContentfulImageComponent,
|
|
569
562
|
ContentfulVideoComponent,
|
|
570
563
|
ContentfulRichTextRendererComponent] });
|
|
571
|
-
ContentfulModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
564
|
+
ContentfulModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ContentfulModule, imports: [ContentfulAudioComponent,
|
|
572
565
|
ContentfulFileComponent,
|
|
573
566
|
ContentfulImageComponent,
|
|
574
567
|
ContentfulVideoComponent,
|
|
575
568
|
ContentfulRichTextRendererComponent] });
|
|
576
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
569
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.2", ngImport: i0, type: ContentfulModule, decorators: [{
|
|
577
570
|
type: NgModule,
|
|
578
571
|
args: [{
|
|
579
572
|
imports: [
|
|
@@ -593,9 +586,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImpor
|
|
|
593
586
|
}]
|
|
594
587
|
}] });
|
|
595
588
|
|
|
589
|
+
const provideContentfulConfig = (contentfulConfig = {}) => {
|
|
590
|
+
return { provide: CONTENTFUL_CONFIG, useValue: createContentfulConfig(contentfulConfig) };
|
|
591
|
+
};
|
|
592
|
+
|
|
596
593
|
/**
|
|
597
594
|
* Generated bundle index. Do not edit.
|
|
598
595
|
*/
|
|
599
596
|
|
|
600
|
-
export { CONTENTFUL_CONFIG, ContentfulAudioComponent,
|
|
597
|
+
export { CONTENTFUL_CONFIG, ContentfulAudioComponent, ContentfulFileComponent, ContentfulImageComponent, ContentfulModule, ContentfulRichTextRendererComponent, ContentfulVideoComponent, RICH_TEXT_RENDERER_COMPONENT_DATA, createContentfulConfig, createContentfulMap, createContentfulRenderCommand, createContentfulResourceMap, createRenderCommandsFromContentfulRichText, getContentfulNodeProps, provideContentfulConfig, transformContentfulMarks, translateContentfulNodeTypeToHtmlTag };
|
|
601
598
|
//# sourceMappingURL=ethlete-contentful.mjs.map
|