@candy-kingdom/bonnie 0.24.0 → 0.25.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/README.md +0 -4
- package/fesm2022/candy-kingdom-bonnie.mjs +264 -334
- package/fesm2022/candy-kingdom-bonnie.mjs.map +1 -1
- package/package.json +8 -10
- package/types/candy-kingdom-bonnie.d.ts +596 -0
- package/esm2022/candy-kingdom-bonnie.mjs +0 -5
- package/esm2022/index.mjs +0 -9
- package/esm2022/lib/bonnie.module.mjs +0 -102
- package/esm2022/lib/core/FileSrcFileMeta.mjs +0 -2
- package/esm2022/lib/core/FileSrcImageMeta.mjs +0 -2
- package/esm2022/lib/core/MediaObjectFit.mjs +0 -7
- package/esm2022/lib/core/MediaStatus.mjs +0 -8
- package/esm2022/lib/core/device.service.base.mjs +0 -3
- package/esm2022/lib/core/device.service.mjs +0 -14
- package/esm2022/lib/core/emptyBone.mjs +0 -9
- package/esm2022/lib/core/emptyImage.mjs +0 -8
- package/esm2022/lib/core/emptyLocalizedString.mjs +0 -4
- package/esm2022/lib/core/emptyVideo.mjs +0 -8
- package/esm2022/lib/core/encode-uri.pipe.mjs +0 -14
- package/esm2022/lib/core/index.mjs +0 -16
- package/esm2022/lib/core/intersection.component.mjs +0 -69
- package/esm2022/lib/core/pix-media-union.mjs +0 -2
- package/esm2022/lib/core/src.directive.mjs +0 -128
- package/esm2022/lib/core/unsubscribe.service.mjs +0 -19
- package/esm2022/lib/core/utils.mjs +0 -48
- package/esm2022/lib/generated/bone.mjs +0 -6
- package/esm2022/lib/generated/file-format.mjs +0 -6
- package/esm2022/lib/generated/file-meta.mjs +0 -6
- package/esm2022/lib/generated/file-src-base.mjs +0 -6
- package/esm2022/lib/generated/file-src.mjs +0 -6
- package/esm2022/lib/generated/i-equatable.mjs +0 -6
- package/esm2022/lib/generated/i-have-data-route-with-data.mjs +0 -6
- package/esm2022/lib/generated/i-have-data-route.mjs +0 -6
- package/esm2022/lib/generated/i-have-skeleton.mjs +0 -6
- package/esm2022/lib/generated/i-page.mjs +0 -6
- package/esm2022/lib/generated/image-meta.mjs +0 -6
- package/esm2022/lib/generated/image-source.mjs +0 -6
- package/esm2022/lib/generated/image.mjs +0 -6
- package/esm2022/lib/generated/index.mjs +0 -36
- package/esm2022/lib/generated/localized-object.mjs +0 -6
- package/esm2022/lib/generated/localized-string.mjs +0 -6
- package/esm2022/lib/generated/media-source-base.mjs +0 -6
- package/esm2022/lib/generated/media-source.mjs +0 -6
- package/esm2022/lib/generated/open-graph-data.mjs +0 -6
- package/esm2022/lib/generated/page-base.mjs +0 -6
- package/esm2022/lib/generated/page-data.mjs +0 -6
- package/esm2022/lib/generated/page.mjs +0 -6
- package/esm2022/lib/generated/pix-media.mjs +0 -6
- package/esm2022/lib/generated/pix-meta.mjs +0 -6
- package/esm2022/lib/generated/publish-status.mjs +0 -12
- package/esm2022/lib/generated/sizes-item.mjs +0 -6
- package/esm2022/lib/generated/sizes-width-unit.mjs +0 -11
- package/esm2022/lib/generated/svg-meta.mjs +0 -6
- package/esm2022/lib/generated/video-meta.mjs +0 -6
- package/esm2022/lib/generated/video-source.mjs +0 -6
- package/esm2022/lib/generated/video.mjs +0 -6
- package/esm2022/lib/generated/view.mjs +0 -6
- package/esm2022/lib/localization/LocalizeServiceBase.mjs +0 -19
- package/esm2022/lib/localization/index.mjs +0 -3
- package/esm2022/lib/localization/localize.pipe.mjs +0 -128
- package/esm2022/lib/marcy-image/IHtmlPictureSource.mjs +0 -2
- package/esm2022/lib/marcy-image/getDefaultSrc.mjs +0 -17
- package/esm2022/lib/marcy-image/imgsrc.directive.mjs +0 -20
- package/esm2022/lib/marcy-image/index.mjs +0 -6
- package/esm2022/lib/marcy-image/marcy-image.component.mjs +0 -83
- package/esm2022/lib/marcy-image/toHtmlSources.mjs +0 -16
- package/esm2022/lib/marcy-media/index.mjs +0 -2
- package/esm2022/lib/marcy-media/marcy-media.component.mjs +0 -59
- package/esm2022/lib/marcy-video/index.mjs +0 -3
- package/esm2022/lib/marcy-video/marcy-video.component.mjs +0 -159
- package/esm2022/lib/marcy-video/vidsrc.directive.mjs +0 -20
- package/esm2022/lib/skeleton/BoneMap.mjs +0 -10
- package/esm2022/lib/skeleton/IBoneComponent.mjs +0 -2
- package/esm2022/lib/skeleton/bone.directive.mjs +0 -41
- package/esm2022/lib/skeleton/index.mjs +0 -7
- package/esm2022/lib/skeleton/skeleton-anchor.directive.mjs +0 -17
- package/esm2022/lib/skeleton/skeleton.component.mjs +0 -53
- package/esm2022/lib/skeleton/unknown-bone.component.mjs +0 -25
- package/index.d.ts +0 -8
- package/lib/bonnie.module.d.ts +0 -20
- package/lib/core/FileSrcFileMeta.d.ts +0 -2
- package/lib/core/FileSrcImageMeta.d.ts +0 -2
- package/lib/core/MediaObjectFit.d.ts +0 -5
- package/lib/core/MediaStatus.d.ts +0 -6
- package/lib/core/device.service.base.d.ts +0 -4
- package/lib/core/device.service.d.ts +0 -8
- package/lib/core/emptyBone.d.ts +0 -2
- package/lib/core/emptyImage.d.ts +0 -2
- package/lib/core/emptyLocalizedString.d.ts +0 -2
- package/lib/core/emptyVideo.d.ts +0 -2
- package/lib/core/encode-uri.pipe.d.ts +0 -7
- package/lib/core/index.d.ts +0 -15
- package/lib/core/intersection.component.d.ts +0 -20
- package/lib/core/pix-media-union.d.ts +0 -2
- package/lib/core/src.directive.d.ts +0 -23
- package/lib/core/unsubscribe.service.d.ts +0 -10
- package/lib/core/utils.d.ts +0 -10
- package/lib/generated/bone.d.ts +0 -10
- package/lib/generated/file-format.d.ts +0 -8
- package/lib/generated/file-meta.d.ts +0 -7
- package/lib/generated/file-src-base.d.ts +0 -8
- package/lib/generated/file-src.d.ts +0 -9
- package/lib/generated/i-equatable.d.ts +0 -6
- package/lib/generated/i-have-data-route-with-data.d.ts +0 -8
- package/lib/generated/i-have-data-route.d.ts +0 -7
- package/lib/generated/i-have-skeleton.d.ts +0 -8
- package/lib/generated/i-page.d.ts +0 -8
- package/lib/generated/image-meta.d.ts +0 -7
- package/lib/generated/image-source.d.ts +0 -10
- package/lib/generated/image.d.ts +0 -11
- package/lib/generated/index.d.ts +0 -35
- package/lib/generated/localized-object.d.ts +0 -7
- package/lib/generated/localized-string.d.ts +0 -7
- package/lib/generated/media-source-base.d.ts +0 -8
- package/lib/generated/media-source.d.ts +0 -11
- package/lib/generated/open-graph-data.d.ts +0 -13
- package/lib/generated/page-base.d.ts +0 -19
- package/lib/generated/page-data.d.ts +0 -7
- package/lib/generated/page.d.ts +0 -9
- package/lib/generated/pix-media.d.ts +0 -9
- package/lib/generated/pix-meta.d.ts +0 -10
- package/lib/generated/publish-status.d.ts +0 -10
- package/lib/generated/sizes-item.d.ts +0 -10
- package/lib/generated/sizes-width-unit.d.ts +0 -9
- package/lib/generated/svg-meta.d.ts +0 -9
- package/lib/generated/video-meta.d.ts +0 -11
- package/lib/generated/video-source.d.ts +0 -8
- package/lib/generated/video.d.ts +0 -11
- package/lib/generated/view.d.ts +0 -10
- package/lib/localization/LocalizeServiceBase.d.ts +0 -9
- package/lib/localization/index.d.ts +0 -2
- package/lib/localization/localize.pipe.d.ts +0 -55
- package/lib/marcy-image/IHtmlPictureSource.d.ts +0 -6
- package/lib/marcy-image/getDefaultSrc.d.ts +0 -2
- package/lib/marcy-image/imgsrc.directive.d.ts +0 -9
- package/lib/marcy-image/index.d.ts +0 -5
- package/lib/marcy-image/marcy-image.component.d.ts +0 -30
- package/lib/marcy-image/toHtmlSources.d.ts +0 -3
- package/lib/marcy-media/index.d.ts +0 -1
- package/lib/marcy-media/marcy-media.component.d.ts +0 -24
- package/lib/marcy-video/index.d.ts +0 -2
- package/lib/marcy-video/marcy-video.component.d.ts +0 -33
- package/lib/marcy-video/vidsrc.directive.d.ts +0 -9
- package/lib/skeleton/BoneMap.d.ts +0 -5
- package/lib/skeleton/IBoneComponent.d.ts +0 -4
- package/lib/skeleton/bone.directive.d.ts +0 -17
- package/lib/skeleton/index.d.ts +0 -6
- package/lib/skeleton/skeleton-anchor.directive.d.ts +0 -8
- package/lib/skeleton/skeleton.component.d.ts +0 -18
- package/lib/skeleton/unknown-bone.component.d.ts +0 -14
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, EventEmitter,
|
|
3
|
-
import { Subject, takeUntil,
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
6
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Injectable, EventEmitter, signal, inject, ChangeDetectorRef, effect, Output, Directive, ElementRef, Input, Component, Pipe, ViewChild, ViewContainerRef, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
+
import { Subject, takeUntil, NEVER, fromEvent, merge, BehaviorSubject, filter } from 'rxjs';
|
|
4
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
5
|
+
import * as i1 from '@angular/common';
|
|
6
|
+
import { CommonModule, AsyncPipe, JsonPipe } from '@angular/common';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* This is a TypeGen auto-generated file.
|
|
@@ -227,45 +227,43 @@ function isLocalUrlString(url) {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
class UnsubscriberService {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
this.takeUntilDestroy = (origin) => origin.pipe(takeUntil(this._destroy$));
|
|
233
|
-
}
|
|
230
|
+
_destroy$ = new Subject();
|
|
231
|
+
takeUntilDestroy = (origin) => origin.pipe(takeUntil(this._destroy$));
|
|
234
232
|
ngOnDestroy() {
|
|
235
233
|
this._destroy$.next();
|
|
236
234
|
this._destroy$.complete();
|
|
237
235
|
}
|
|
238
|
-
static
|
|
239
|
-
static
|
|
236
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: UnsubscriberService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
237
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: UnsubscriberService });
|
|
240
238
|
}
|
|
241
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
239
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: UnsubscriberService, decorators: [{
|
|
242
240
|
type: Injectable
|
|
243
241
|
}] });
|
|
244
242
|
|
|
245
243
|
class SrcBaseDirective {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
244
|
+
ratioChange = new EventEmitter();
|
|
245
|
+
srcChange = new EventEmitter();
|
|
246
|
+
_ratio = signal(0, ...(ngDevMode ? [{ debugName: "_ratio" }] : []));
|
|
247
|
+
ratio = this._ratio.asReadonly();
|
|
248
|
+
_queryChangeClearSubject = new Subject();
|
|
249
|
+
_data;
|
|
250
|
+
_u = inject(UnsubscriberService);
|
|
251
|
+
cd = inject(ChangeDetectorRef);
|
|
252
|
+
_effectCleanup;
|
|
253
|
+
constructor() {
|
|
253
254
|
console.log('SrcBaseDirective ctor');
|
|
254
255
|
this.cd.detach();
|
|
256
|
+
// Watch for ratio changes and emit
|
|
257
|
+
this._effectCleanup = effect(() => {
|
|
258
|
+
const ratio = this._ratio();
|
|
259
|
+
this.ratioChange.next(ratio);
|
|
260
|
+
this.cd.detectChanges(); // todo: verify, do i need it here
|
|
261
|
+
}, ...(ngDevMode ? [{ debugName: "_effectCleanup" }] : []));
|
|
255
262
|
}
|
|
256
263
|
ngOnInit() {
|
|
257
264
|
console.log('SrcBaseDirective ngOnInit');
|
|
258
|
-
this._ratioSubject
|
|
259
|
-
.pipe(this._u.takeUntilDestroy)
|
|
260
|
-
.subscribe(x => {
|
|
261
|
-
this.ratioChange.next(x);
|
|
262
|
-
this.cd.detectChanges(); // todo: verify, do i need it here
|
|
263
|
-
});
|
|
264
265
|
this.cd.detectChanges();
|
|
265
266
|
}
|
|
266
|
-
get ratio() {
|
|
267
|
-
return this._ratioSubject.value;
|
|
268
|
-
}
|
|
269
267
|
get data() {
|
|
270
268
|
return this._data;
|
|
271
269
|
}
|
|
@@ -280,32 +278,36 @@ class SrcBaseDirective {
|
|
|
280
278
|
// clear mediaQuery subscriptions
|
|
281
279
|
this._queryChangeClearSubject.next();
|
|
282
280
|
// ratio
|
|
283
|
-
this.
|
|
281
|
+
this._ratio.set(0);
|
|
284
282
|
this.srcChange.next(this._data);
|
|
285
283
|
if (this._data === undefined || this._data.sources.length === 0) {
|
|
286
284
|
return;
|
|
287
285
|
}
|
|
288
286
|
const allRatios = this._data.sources
|
|
289
|
-
.flatMap(x => x.srcSet)
|
|
290
|
-
.map(x => x.meta.ratio)
|
|
287
|
+
.flatMap((x) => x.srcSet)
|
|
288
|
+
.map((x) => x.meta.ratio)
|
|
291
289
|
.filter(distinct);
|
|
292
290
|
if (allRatios.length === 1) {
|
|
293
291
|
// same ratio for all
|
|
294
|
-
this.
|
|
292
|
+
this._ratio.set(allRatios[0]);
|
|
295
293
|
return;
|
|
296
294
|
}
|
|
297
|
-
this.watchMediaQueries()
|
|
298
|
-
|
|
295
|
+
this.watchMediaQueries().subscribe(() => {
|
|
296
|
+
this.calcRatio();
|
|
297
|
+
console.log('watchMediaQueries calcRatio');
|
|
298
|
+
});
|
|
299
299
|
this.calcRatio();
|
|
300
300
|
}
|
|
301
301
|
calcRatio() {
|
|
302
|
-
if (this._data === undefined ||
|
|
302
|
+
if (this._data === undefined ||
|
|
303
|
+
this._data === null ||
|
|
304
|
+
this._data.sources.length === 0)
|
|
303
305
|
return;
|
|
304
306
|
for (let i = 0; i < this._data.sources.length; i++) {
|
|
305
307
|
const source = this._data.sources[i];
|
|
306
308
|
const srcRatios = source.srcSet
|
|
307
|
-
.sort(descendingT(x => x.meta.width))
|
|
308
|
-
.map(x => x.meta.ratio)
|
|
309
|
+
.sort(descendingT((x) => x.meta.width))
|
|
310
|
+
.map((x) => x.meta.ratio)
|
|
309
311
|
.filter(distinct);
|
|
310
312
|
if (srcRatios.length === 0) {
|
|
311
313
|
// console.warn(`each source should have srcSet with same ratio. founded: ${srcRatios.join(', ')}`);
|
|
@@ -316,49 +318,53 @@ class SrcBaseDirective {
|
|
|
316
318
|
}
|
|
317
319
|
const ratio = srcRatios[0]; // most accurate ratio in biggest image
|
|
318
320
|
if (source.mediaQuery.length === 0) {
|
|
319
|
-
this.
|
|
321
|
+
this._ratio.set(ratio);
|
|
320
322
|
return;
|
|
321
323
|
}
|
|
322
|
-
if (typeof window === 'undefined' ||
|
|
324
|
+
if (typeof window === 'undefined' ||
|
|
325
|
+
typeof window.matchMedia === 'undefined')
|
|
323
326
|
return;
|
|
324
327
|
const mediaQueryList = window.matchMedia(source.mediaQuery);
|
|
325
328
|
if (mediaQueryList.matches) {
|
|
326
|
-
this.
|
|
329
|
+
this._ratio.set(ratio);
|
|
327
330
|
return;
|
|
328
331
|
}
|
|
329
332
|
}
|
|
330
333
|
}
|
|
331
334
|
watchMediaQueries() {
|
|
332
335
|
console.log('watchMediaQueries');
|
|
333
|
-
if (this._data === undefined
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
336
|
+
if (this._data === undefined ||
|
|
337
|
+
this._data === null ||
|
|
338
|
+
typeof window === 'undefined' ||
|
|
339
|
+
typeof window.matchMedia === 'undefined')
|
|
337
340
|
return NEVER.pipe(this._u.takeUntilDestroy, takeUntil(this._queryChangeClearSubject));
|
|
338
341
|
const mediaQueries = this._data.sources
|
|
339
|
-
.map(x => x.mediaQuery)
|
|
342
|
+
.map((x) => x.mediaQuery)
|
|
340
343
|
.filter(distinct)
|
|
341
|
-
.filter(x => x.length > 0);
|
|
344
|
+
.filter((x) => x.length > 0);
|
|
342
345
|
console.log('watchMediaQueries mediaQueries', mediaQueries);
|
|
343
|
-
const queryObservables = mediaQueries.map(media => {
|
|
346
|
+
const queryObservables = mediaQueries.map((media) => {
|
|
344
347
|
const queryList = window.matchMedia(media);
|
|
345
|
-
const observable = fromEvent(queryList, 'change')
|
|
346
|
-
.pipe(this._u.takeUntilDestroy, takeUntil(this._queryChangeClearSubject));
|
|
348
|
+
const observable = fromEvent(queryList, 'change').pipe(this._u.takeUntilDestroy, takeUntil(this._queryChangeClearSubject));
|
|
347
349
|
return observable;
|
|
348
350
|
});
|
|
349
351
|
const combinedObservable = merge(...queryObservables);
|
|
350
352
|
return combinedObservable;
|
|
351
353
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
+
ngOnDestroy() {
|
|
355
|
+
this._effectCleanup?.destroy();
|
|
356
|
+
}
|
|
357
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SrcBaseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
358
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: SrcBaseDirective, isStandalone: true, selector: "[bonSrcBase]", outputs: { ratioChange: "ratioChange", srcChange: "srcChange" }, providers: [UnsubscriberService], ngImport: i0 });
|
|
354
359
|
}
|
|
355
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
360
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SrcBaseDirective, decorators: [{
|
|
356
361
|
type: Directive,
|
|
357
362
|
args: [{
|
|
363
|
+
standalone: true,
|
|
358
364
|
selector: '[bonSrcBase]',
|
|
359
|
-
providers: [UnsubscriberService]
|
|
365
|
+
providers: [UnsubscriberService],
|
|
360
366
|
}]
|
|
361
|
-
}], ctorParameters: () => [
|
|
367
|
+
}], ctorParameters: () => [], propDecorators: { ratioChange: [{
|
|
362
368
|
type: Output
|
|
363
369
|
}], srcChange: [{
|
|
364
370
|
type: Output
|
|
@@ -380,14 +386,12 @@ var MediaObjectFit;
|
|
|
380
386
|
})(MediaObjectFit || (MediaObjectFit = {}));
|
|
381
387
|
|
|
382
388
|
class DeviceService {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: DeviceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
388
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: DeviceService }); }
|
|
389
|
+
devicePixelRatio = typeof window === 'undefined' ? 1 : window.devicePixelRatio;
|
|
390
|
+
isSSR = typeof window === 'undefined';
|
|
391
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: DeviceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
392
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: DeviceService });
|
|
389
393
|
}
|
|
390
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
394
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: DeviceService, decorators: [{
|
|
391
395
|
type: Injectable
|
|
392
396
|
}] });
|
|
393
397
|
|
|
@@ -395,23 +399,31 @@ class DeviceServiceBase {
|
|
|
395
399
|
}
|
|
396
400
|
|
|
397
401
|
class IntersectionComponent {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
402
|
+
intersected = new EventEmitter();
|
|
403
|
+
_hostRef = inject(ElementRef);
|
|
404
|
+
_u = inject(UnsubscriberService);
|
|
405
|
+
_cd = inject(ChangeDetectorRef);
|
|
406
|
+
intersectionObserver;
|
|
407
|
+
_intersected = signal(false, ...(ngDevMode ? [{ debugName: "_intersected" }] : []));
|
|
408
|
+
intersectedOnce = this._intersected.asReadonly();
|
|
409
|
+
_session;
|
|
410
|
+
_effectCleanup;
|
|
411
|
+
constructor() {
|
|
412
|
+
this._cd.detach();
|
|
404
413
|
// no template with variables, so we don't need to call changeDetection
|
|
405
414
|
if (typeof window === 'undefined' || typeof IntersectionObserver === 'undefined') {
|
|
406
415
|
// call intersection without any
|
|
407
416
|
return;
|
|
408
417
|
}
|
|
409
418
|
this.intersectionObserver = new IntersectionObserver(this.onIntersection.bind(this));
|
|
419
|
+
// Watch for intersection changes and emit when it becomes true
|
|
420
|
+
this._effectCleanup = effect(() => {
|
|
421
|
+
if (this._intersected()) {
|
|
422
|
+
this.intersected.next();
|
|
423
|
+
}
|
|
424
|
+
}, ...(ngDevMode ? [{ debugName: "_effectCleanup" }] : []));
|
|
410
425
|
}
|
|
411
426
|
ngOnInit() {
|
|
412
|
-
this._intersectSubject
|
|
413
|
-
.pipe(this._u.takeUntilDestroy, filter(x => x === true))
|
|
414
|
-
.subscribe(x => this.intersected.next());
|
|
415
427
|
}
|
|
416
428
|
set session(newSession) {
|
|
417
429
|
if (this._session === newSession)
|
|
@@ -420,14 +432,11 @@ class IntersectionComponent {
|
|
|
420
432
|
this._session = newSession;
|
|
421
433
|
this.reset();
|
|
422
434
|
}
|
|
423
|
-
get intersectedOnce() {
|
|
424
|
-
return this._intersectSubject.value;
|
|
425
|
-
}
|
|
426
435
|
reset() {
|
|
427
436
|
if (this.intersectionObserver === undefined || this.intersectionObserver === null)
|
|
428
437
|
return;
|
|
429
438
|
this.intersectionObserver.unobserve(this._hostRef.nativeElement);
|
|
430
|
-
this.
|
|
439
|
+
this._intersected.set(false);
|
|
431
440
|
this.intersectionObserver.observe(this._hostRef.nativeElement);
|
|
432
441
|
}
|
|
433
442
|
onIntersection(entries, observer) {
|
|
@@ -435,7 +444,7 @@ class IntersectionComponent {
|
|
|
435
444
|
console.warn('multi entries!');
|
|
436
445
|
}
|
|
437
446
|
const isIntersecting = entries[0].isIntersecting;
|
|
438
|
-
this.
|
|
447
|
+
this._intersected.set(isIntersecting);
|
|
439
448
|
console.log(`intersected ${isIntersecting}`, this._hostRef.nativeElement);
|
|
440
449
|
// only once will recieve intersection
|
|
441
450
|
if (isIntersecting) {
|
|
@@ -443,16 +452,16 @@ class IntersectionComponent {
|
|
|
443
452
|
}
|
|
444
453
|
}
|
|
445
454
|
ngOnDestroy() {
|
|
446
|
-
this.
|
|
455
|
+
this._effectCleanup?.destroy();
|
|
447
456
|
this.intersectionObserver?.disconnect();
|
|
448
457
|
}
|
|
449
|
-
static
|
|
450
|
-
static
|
|
458
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: IntersectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
459
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: IntersectionComponent, isStandalone: true, selector: "bon-intersection", inputs: { session: "session" }, outputs: { intersected: "intersected" }, providers: [UnsubscriberService], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{display:block}\n"] });
|
|
451
460
|
}
|
|
452
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
461
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: IntersectionComponent, decorators: [{
|
|
453
462
|
type: Component,
|
|
454
|
-
args: [{ selector: 'bon-intersection', template: '<ng-content></ng-content>', providers: [UnsubscriberService], styles: [":host{display:block}\n"] }]
|
|
455
|
-
}], ctorParameters: () => [
|
|
463
|
+
args: [{ selector: 'bon-intersection', standalone: true, template: '<ng-content></ng-content>', providers: [UnsubscriberService], styles: [":host{display:block}\n"] }]
|
|
464
|
+
}], ctorParameters: () => [], propDecorators: { intersected: [{
|
|
456
465
|
type: Output
|
|
457
466
|
}], session: [{
|
|
458
467
|
type: Input
|
|
@@ -462,17 +471,17 @@ class EncodeURIComponentPipe {
|
|
|
462
471
|
transform(value) {
|
|
463
472
|
return encodeURIComponent(value);
|
|
464
473
|
}
|
|
465
|
-
static
|
|
466
|
-
static
|
|
474
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: EncodeURIComponentPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
475
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: EncodeURIComponentPipe, isStandalone: true, name: "encodeURIComponent" });
|
|
467
476
|
}
|
|
468
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
477
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: EncodeURIComponentPipe, decorators: [{
|
|
469
478
|
type: Pipe,
|
|
470
|
-
args: [{ name: 'encodeURIComponent', pure: true }]
|
|
479
|
+
args: [{ name: 'encodeURIComponent', standalone: true, pure: true }]
|
|
471
480
|
}] });
|
|
472
481
|
|
|
473
482
|
function emptyImage() {
|
|
474
483
|
return {
|
|
475
|
-
$type: 'image',
|
|
484
|
+
$type: 'image', // todo: remove
|
|
476
485
|
type: 'image',
|
|
477
486
|
sources: [],
|
|
478
487
|
};
|
|
@@ -480,7 +489,7 @@ function emptyImage() {
|
|
|
480
489
|
|
|
481
490
|
function emptyVideo() {
|
|
482
491
|
return {
|
|
483
|
-
$type: 'video',
|
|
492
|
+
$type: 'video', // todo: remove
|
|
484
493
|
type: 'video',
|
|
485
494
|
sources: [],
|
|
486
495
|
};
|
|
@@ -503,7 +512,7 @@ class LocalizeServiceBase {
|
|
|
503
512
|
getLocalized(value, defaultValue, locale) {
|
|
504
513
|
if (value === undefined)
|
|
505
514
|
return defaultValue;
|
|
506
|
-
locale = locale ?? this.locale;
|
|
515
|
+
locale = locale ?? this.locale();
|
|
507
516
|
const obj = value[locale] ?? defaultValue;
|
|
508
517
|
return obj;
|
|
509
518
|
}
|
|
@@ -518,41 +527,35 @@ class LocalizeServiceBase {
|
|
|
518
527
|
}
|
|
519
528
|
|
|
520
529
|
class LocalizePipe {
|
|
521
|
-
|
|
522
|
-
this.localizeService = localizeService;
|
|
523
|
-
}
|
|
530
|
+
localizeService = inject(LocalizeServiceBase);
|
|
524
531
|
transform(value, locale) {
|
|
525
532
|
if (value === undefined || value === null)
|
|
526
533
|
return '';
|
|
527
534
|
return this.localizeService.getLocalizedText(value, locale);
|
|
528
535
|
}
|
|
529
|
-
static
|
|
530
|
-
static
|
|
536
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LocalizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
537
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: LocalizePipe, isStandalone: true, name: "localize", pure: false });
|
|
531
538
|
}
|
|
532
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
539
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LocalizePipe, decorators: [{
|
|
533
540
|
type: Pipe,
|
|
534
|
-
args: [{ name: 'localize', pure: false }]
|
|
535
|
-
}]
|
|
541
|
+
args: [{ name: 'localize', standalone: true, pure: false }]
|
|
542
|
+
}] });
|
|
536
543
|
class LocalizeObjectPipe {
|
|
537
|
-
|
|
538
|
-
this.localizeService = localizeService;
|
|
539
|
-
}
|
|
544
|
+
localizeService = inject(LocalizeServiceBase);
|
|
540
545
|
transform(object, locale) {
|
|
541
546
|
if (object === undefined || object === null)
|
|
542
547
|
return undefined;
|
|
543
548
|
return this.localizeService.getLocalized(object, undefined, locale);
|
|
544
549
|
}
|
|
545
|
-
static
|
|
546
|
-
static
|
|
550
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LocalizeObjectPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
551
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: LocalizeObjectPipe, isStandalone: true, name: "localizeObject", pure: false });
|
|
547
552
|
}
|
|
548
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
553
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LocalizeObjectPipe, decorators: [{
|
|
549
554
|
type: Pipe,
|
|
550
|
-
args: [{ name: 'localizeObject', pure: false }]
|
|
551
|
-
}]
|
|
555
|
+
args: [{ name: 'localizeObject', standalone: true, pure: false }]
|
|
556
|
+
}] });
|
|
552
557
|
class LocalizationIsNotEmptyPipe {
|
|
553
|
-
|
|
554
|
-
this.localizeService = localizeService;
|
|
555
|
-
}
|
|
558
|
+
localizeService = inject(LocalizeServiceBase);
|
|
556
559
|
transform(value, locale) {
|
|
557
560
|
if (value === undefined || value === null)
|
|
558
561
|
return false;
|
|
@@ -560,17 +563,15 @@ class LocalizationIsNotEmptyPipe {
|
|
|
560
563
|
const isNotEmpty = text.trim().length > 0;
|
|
561
564
|
return isNotEmpty;
|
|
562
565
|
}
|
|
563
|
-
static
|
|
564
|
-
static
|
|
566
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LocalizationIsNotEmptyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
567
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: LocalizationIsNotEmptyPipe, isStandalone: true, name: "localizationIsNotEmpty", pure: false });
|
|
565
568
|
}
|
|
566
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
569
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LocalizationIsNotEmptyPipe, decorators: [{
|
|
567
570
|
type: Pipe,
|
|
568
|
-
args: [{ name: 'localizationIsNotEmpty', pure: false }]
|
|
569
|
-
}]
|
|
571
|
+
args: [{ name: 'localizationIsNotEmpty', standalone: true, pure: false }]
|
|
572
|
+
}] });
|
|
570
573
|
class LocalizationIsEmptyPipe {
|
|
571
|
-
|
|
572
|
-
this.localizeService = localizeService;
|
|
573
|
-
}
|
|
574
|
+
localizeService = inject(LocalizeServiceBase);
|
|
574
575
|
transform(value, locale) {
|
|
575
576
|
if (value === undefined || value === null)
|
|
576
577
|
return true;
|
|
@@ -578,18 +579,16 @@ class LocalizationIsEmptyPipe {
|
|
|
578
579
|
const isEmpty = text.trim().length === 0;
|
|
579
580
|
return isEmpty;
|
|
580
581
|
}
|
|
581
|
-
static
|
|
582
|
-
static
|
|
582
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LocalizationIsEmptyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
583
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: LocalizationIsEmptyPipe, isStandalone: true, name: "localizationIsEmpty", pure: false });
|
|
583
584
|
}
|
|
584
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
585
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LocalizationIsEmptyPipe, decorators: [{
|
|
585
586
|
type: Pipe,
|
|
586
|
-
args: [{ name: 'localizationIsEmpty', pure: false }]
|
|
587
|
-
}]
|
|
587
|
+
args: [{ name: 'localizationIsEmpty', standalone: true, pure: false }]
|
|
588
|
+
}] });
|
|
588
589
|
class LocalizeUrlPipe {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
this.domSanitizer = domSanitizer;
|
|
592
|
-
}
|
|
590
|
+
localizeService = inject(LocalizeServiceBase);
|
|
591
|
+
domSanitizer = inject(DomSanitizer);
|
|
593
592
|
transform(value, locale) {
|
|
594
593
|
if (value === undefined || value === null)
|
|
595
594
|
return '';
|
|
@@ -597,60 +596,57 @@ class LocalizeUrlPipe {
|
|
|
597
596
|
const safeUrl = this.domSanitizer.bypassSecurityTrustResourceUrl(urlString);
|
|
598
597
|
return safeUrl;
|
|
599
598
|
}
|
|
600
|
-
static
|
|
601
|
-
static
|
|
599
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LocalizeUrlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
600
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: LocalizeUrlPipe, isStandalone: true, name: "localizeUrl", pure: false });
|
|
602
601
|
}
|
|
603
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
602
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LocalizeUrlPipe, decorators: [{
|
|
604
603
|
type: Pipe,
|
|
605
|
-
args: [{ name: 'localizeUrl', pure: false }]
|
|
606
|
-
}]
|
|
604
|
+
args: [{ name: 'localizeUrl', standalone: true, pure: false }]
|
|
605
|
+
}] });
|
|
607
606
|
class IsLocalUrlPipe {
|
|
608
|
-
|
|
609
|
-
this.localizeService = localizeService;
|
|
610
|
-
}
|
|
607
|
+
localizeService = inject(LocalizeServiceBase);
|
|
611
608
|
transform(value, locale) {
|
|
612
609
|
if (value === undefined || value === null)
|
|
613
610
|
return false;
|
|
614
611
|
const isLocal = this.localizeService.isLocalUrl(value, locale);
|
|
615
612
|
return isLocal;
|
|
616
613
|
}
|
|
617
|
-
static
|
|
618
|
-
static
|
|
614
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: IsLocalUrlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
615
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: IsLocalUrlPipe, isStandalone: true, name: "isLocalUrl", pure: false });
|
|
619
616
|
}
|
|
620
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
617
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: IsLocalUrlPipe, decorators: [{
|
|
621
618
|
type: Pipe,
|
|
622
|
-
args: [{ name: 'isLocalUrl', pure: false }]
|
|
623
|
-
}]
|
|
619
|
+
args: [{ name: 'isLocalUrl', standalone: true, pure: false }]
|
|
620
|
+
}] });
|
|
624
621
|
class IsNotLocalUrlPipe {
|
|
625
|
-
|
|
626
|
-
this.localizeService = localizeService;
|
|
627
|
-
}
|
|
622
|
+
localizeService = inject(LocalizeServiceBase);
|
|
628
623
|
transform(value, locale) {
|
|
629
624
|
if (value === undefined || value === null)
|
|
630
625
|
return false;
|
|
631
626
|
const isLocal = this.localizeService.isLocalUrl(value, locale);
|
|
632
627
|
return !isLocal;
|
|
633
628
|
}
|
|
634
|
-
static
|
|
635
|
-
static
|
|
629
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: IsNotLocalUrlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
630
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: IsNotLocalUrlPipe, isStandalone: true, name: "isNotLocalUrl", pure: false });
|
|
636
631
|
}
|
|
637
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
632
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: IsNotLocalUrlPipe, decorators: [{
|
|
638
633
|
type: Pipe,
|
|
639
|
-
args: [{ name: 'isNotLocalUrl', pure: false }]
|
|
640
|
-
}]
|
|
634
|
+
args: [{ name: 'isNotLocalUrl', standalone: true, pure: false }]
|
|
635
|
+
}] });
|
|
641
636
|
|
|
642
637
|
class ImageSrcDirective extends SrcBaseDirective {
|
|
643
638
|
set imgsrc(value) {
|
|
644
639
|
console.log('set imgsrc', value);
|
|
645
640
|
this.data = value;
|
|
646
641
|
}
|
|
647
|
-
static
|
|
648
|
-
static
|
|
642
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ImageSrcDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
643
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: ImageSrcDirective, isStandalone: true, selector: "[imgsrc]", inputs: { imgsrc: "imgsrc" }, usesInheritance: true, ngImport: i0 });
|
|
649
644
|
}
|
|
650
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
645
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ImageSrcDirective, decorators: [{
|
|
651
646
|
type: Directive,
|
|
652
647
|
args: [{
|
|
653
|
-
|
|
648
|
+
standalone: true,
|
|
649
|
+
selector: '[imgsrc]',
|
|
654
650
|
}]
|
|
655
651
|
}], propDecorators: { imgsrc: [{
|
|
656
652
|
type: Input
|
|
@@ -688,26 +684,28 @@ function getDefaultSrc(image) {
|
|
|
688
684
|
}
|
|
689
685
|
|
|
690
686
|
class MarcyImageComponent {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
687
|
+
MediaStatus = MediaStatus;
|
|
688
|
+
MarcyObjectFit = MediaObjectFit;
|
|
689
|
+
isLoaded = new EventEmitter();
|
|
690
|
+
sources = [];
|
|
691
|
+
$status = new BehaviorSubject(MediaStatus.NotSet);
|
|
692
|
+
defaultSrc = '';
|
|
693
|
+
_objectFit = MediaObjectFit.Original;
|
|
694
|
+
src;
|
|
695
|
+
device = inject(DeviceServiceBase);
|
|
696
|
+
cd = inject(ChangeDetectorRef);
|
|
697
|
+
_u = inject(UnsubscriberService);
|
|
698
|
+
_srcDir = inject(ImageSrcDirective, { optional: true });
|
|
699
|
+
constructor() {
|
|
702
700
|
console.log('MarcyImageComponent ctor');
|
|
703
|
-
if (
|
|
701
|
+
if (this._srcDir === undefined || this._srcDir === null)
|
|
704
702
|
throw new Error(`${MarcyImageComponent.name} should have [imgsrc] directive as source object`);
|
|
705
|
-
this.src =
|
|
703
|
+
this.src = this._srcDir;
|
|
706
704
|
// bind src changes
|
|
707
705
|
this.src.srcChange
|
|
708
706
|
.pipe(this._u.takeUntilDestroy)
|
|
709
707
|
.subscribe(this.onSrcChange.bind(this));
|
|
710
|
-
cd.detach();
|
|
708
|
+
this.cd.detach();
|
|
711
709
|
}
|
|
712
710
|
ngOnInit() {
|
|
713
711
|
// bind loaded event
|
|
@@ -741,15 +739,13 @@ class MarcyImageComponent {
|
|
|
741
739
|
onLoad() {
|
|
742
740
|
this.$status.next(MediaStatus.Loaded);
|
|
743
741
|
}
|
|
744
|
-
static
|
|
745
|
-
static
|
|
742
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MarcyImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
743
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: MarcyImageComponent, isStandalone: true, selector: "bon-image", inputs: { objectFit: "objectFit" }, outputs: { isLoaded: "isLoaded" }, providers: [UnsubscriberService], ngImport: i0, template: "<div *ngIf=\"sources.length > 0\"\n [class.knownRatio]=\"src.ratio() > 0 && objectFit === MarcyObjectFit.Original\"\n [class.cover]=\"objectFit === MarcyObjectFit.Cover\"\n [class.contain]=\"objectFit === MarcyObjectFit.Contain\"\n [class.loaded]=\"($status | async) === MediaStatus.Loaded\"\n class=\"picture-container\">\n\n <ng-template #pictureTemplate>\n <picture>\n <source *ngFor=\"let source of sources\"\n [srcset]=\"source.srcSet\"\n [attr.media]=\"source.media.length > 0 ? source.media : undefined\"\n [attr.type]=\"source.mime.length > 0 ? source.mime : undefined\"\n [attr.sizes]=\"source.sizes.length > 0 ? source.sizes : undefined\" />\n\n <img [src]=\"defaultSrc\" (load)=\"onLoad()\" />\n </picture>\n </ng-template>\n\n <noscript *ngIf=\"device.isSSR\">\n <ng-container *ngTemplateOutlet=\"pictureTemplate\"></ng-container>\n </noscript>\n\n <bon-intersection #intersectionZone *ngIf=\"!device.isSSR\" [session]=\"src\" (intersected)=\"cd.detectChanges()\">\n\n <ng-container *ngIf=\"intersectionZone.intersectedOnce()\">\n <ng-container *ngTemplateOutlet=\"pictureTemplate\"></ng-container>\n </ng-container>\n\n </bon-intersection>\n\n <div *ngIf=\"src.ratio() > 0 && objectFit === MarcyObjectFit.Original\" [style.padding-top]=\"100 / src.ratio() +'%'\"></div>\n</div>\n", styles: [":host{display:block}.picture-container{overflow:hidden}.picture-container.cover picture,.picture-container.cover bon-intersection,.picture-container.contain picture,.picture-container.contain bon-intersection,.picture-container.knownRatio picture,.picture-container.knownRatio bon-intersection{width:100%;height:100%}.picture-container.cover picture>img,.picture-container.cover bon-intersection>img,.picture-container.contain picture>img,.picture-container.contain bon-intersection>img,.picture-container.knownRatio picture>img,.picture-container.knownRatio bon-intersection>img{height:100%}.picture-container.cover{height:100%}.picture-container.cover picture>img{object-fit:cover}.picture-container.contain{height:100%}.picture-container.contain picture>img{object-fit:contain}.picture-container.knownRatio{position:relative}.picture-container.knownRatio picture{position:absolute}.picture-container.knownRatio picture>img{object-fit:fill}picture{display:block;backface-visibility:hidden}picture>img{display:block;width:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IntersectionComponent, selector: "bon-intersection", inputs: ["session"], outputs: ["intersected"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] });
|
|
746
744
|
}
|
|
747
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
745
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MarcyImageComponent, decorators: [{
|
|
748
746
|
type: Component,
|
|
749
|
-
args: [{ selector: 'bon-image', providers: [UnsubscriberService], template: "<div *ngIf=\"sources.length > 0\"\
|
|
750
|
-
}], ctorParameters: () => [
|
|
751
|
-
type: Optional
|
|
752
|
-
}] }], propDecorators: { isLoaded: [{
|
|
747
|
+
args: [{ selector: 'bon-image', standalone: true, imports: [CommonModule, AsyncPipe, IntersectionComponent], providers: [UnsubscriberService], template: "<div *ngIf=\"sources.length > 0\"\n [class.knownRatio]=\"src.ratio() > 0 && objectFit === MarcyObjectFit.Original\"\n [class.cover]=\"objectFit === MarcyObjectFit.Cover\"\n [class.contain]=\"objectFit === MarcyObjectFit.Contain\"\n [class.loaded]=\"($status | async) === MediaStatus.Loaded\"\n class=\"picture-container\">\n\n <ng-template #pictureTemplate>\n <picture>\n <source *ngFor=\"let source of sources\"\n [srcset]=\"source.srcSet\"\n [attr.media]=\"source.media.length > 0 ? source.media : undefined\"\n [attr.type]=\"source.mime.length > 0 ? source.mime : undefined\"\n [attr.sizes]=\"source.sizes.length > 0 ? source.sizes : undefined\" />\n\n <img [src]=\"defaultSrc\" (load)=\"onLoad()\" />\n </picture>\n </ng-template>\n\n <noscript *ngIf=\"device.isSSR\">\n <ng-container *ngTemplateOutlet=\"pictureTemplate\"></ng-container>\n </noscript>\n\n <bon-intersection #intersectionZone *ngIf=\"!device.isSSR\" [session]=\"src\" (intersected)=\"cd.detectChanges()\">\n\n <ng-container *ngIf=\"intersectionZone.intersectedOnce()\">\n <ng-container *ngTemplateOutlet=\"pictureTemplate\"></ng-container>\n </ng-container>\n\n </bon-intersection>\n\n <div *ngIf=\"src.ratio() > 0 && objectFit === MarcyObjectFit.Original\" [style.padding-top]=\"100 / src.ratio() +'%'\"></div>\n</div>\n", styles: [":host{display:block}.picture-container{overflow:hidden}.picture-container.cover picture,.picture-container.cover bon-intersection,.picture-container.contain picture,.picture-container.contain bon-intersection,.picture-container.knownRatio picture,.picture-container.knownRatio bon-intersection{width:100%;height:100%}.picture-container.cover picture>img,.picture-container.cover bon-intersection>img,.picture-container.contain picture>img,.picture-container.contain bon-intersection>img,.picture-container.knownRatio picture>img,.picture-container.knownRatio bon-intersection>img{height:100%}.picture-container.cover{height:100%}.picture-container.cover picture>img{object-fit:cover}.picture-container.contain{height:100%}.picture-container.contain picture>img{object-fit:contain}.picture-container.knownRatio{position:relative}.picture-container.knownRatio picture{position:absolute}.picture-container.knownRatio picture>img{object-fit:fill}picture{display:block;backface-visibility:hidden}picture>img{display:block;width:100%}\n"] }]
|
|
748
|
+
}], ctorParameters: () => [], propDecorators: { isLoaded: [{
|
|
753
749
|
type: Output
|
|
754
750
|
}], objectFit: [{
|
|
755
751
|
type: Input
|
|
@@ -760,13 +756,14 @@ class VideoSrcDirective extends SrcBaseDirective {
|
|
|
760
756
|
this.data = value;
|
|
761
757
|
console.log('set vidsrc', value);
|
|
762
758
|
}
|
|
763
|
-
static
|
|
764
|
-
static
|
|
759
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: VideoSrcDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
760
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: VideoSrcDirective, isStandalone: true, selector: "[vidsrc]", inputs: { vidsrc: "vidsrc" }, usesInheritance: true, ngImport: i0 });
|
|
765
761
|
}
|
|
766
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
762
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: VideoSrcDirective, decorators: [{
|
|
767
763
|
type: Directive,
|
|
768
764
|
args: [{
|
|
769
|
-
|
|
765
|
+
standalone: true,
|
|
766
|
+
selector: '[vidsrc]',
|
|
770
767
|
}]
|
|
771
768
|
}], propDecorators: { vidsrc: [{
|
|
772
769
|
type: Input
|
|
@@ -776,27 +773,34 @@ function isWebM(src) {
|
|
|
776
773
|
return src.mimeType === 'video/webm';
|
|
777
774
|
}
|
|
778
775
|
class MarcyVideoComponent {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
776
|
+
MediaStatus = MediaStatus;
|
|
777
|
+
MarcyObjectFit = MediaObjectFit;
|
|
778
|
+
videoRef;
|
|
779
|
+
isLoaded = new EventEmitter();
|
|
780
|
+
$status = signal(MediaStatus.NotSet, ...(ngDevMode ? [{ debugName: "$status" }] : []));
|
|
781
|
+
src;
|
|
782
|
+
_effectCleanup;
|
|
783
|
+
source;
|
|
784
|
+
_objectFit = MediaObjectFit.Original;
|
|
785
|
+
device = inject(DeviceServiceBase);
|
|
786
|
+
cd = inject(ChangeDetectorRef);
|
|
787
|
+
_u = inject(UnsubscriberService);
|
|
788
|
+
_srcDir = inject(VideoSrcDirective, { optional: true });
|
|
789
|
+
constructor() {
|
|
788
790
|
console.log('MarcyVideoComponent ctor');
|
|
789
|
-
if (
|
|
791
|
+
if (this._srcDir === undefined || this._srcDir === null)
|
|
790
792
|
throw new Error(`${MarcyVideoComponent.name} should have [vidsrc] directive as source object`);
|
|
791
|
-
this.src =
|
|
792
|
-
cd.detach();
|
|
793
|
+
this.src = this._srcDir;
|
|
794
|
+
this.cd.detach();
|
|
795
|
+
// Watch for status changes and emit when loaded
|
|
796
|
+
this._effectCleanup = effect(() => {
|
|
797
|
+
if (this.$status() === MediaStatus.Loaded) {
|
|
798
|
+
this.isLoaded.next();
|
|
799
|
+
}
|
|
800
|
+
}, ...(ngDevMode ? [{ debugName: "_effectCleanup" }] : []));
|
|
793
801
|
}
|
|
794
802
|
ngOnInit() {
|
|
795
803
|
console.log('MarcyVideoComponent ngOnInit');
|
|
796
|
-
// bind loaded event
|
|
797
|
-
this.$status
|
|
798
|
-
.pipe(this._u.takeUntilDestroy, filter(status => status === MediaStatus.Loaded))
|
|
799
|
-
.subscribe(() => this.isLoaded.next());
|
|
800
804
|
this.cd.detectChanges();
|
|
801
805
|
}
|
|
802
806
|
ngAfterViewInit() {
|
|
@@ -826,15 +830,15 @@ class MarcyVideoComponent {
|
|
|
826
830
|
console.log('MarcyVideoComponent updateSources');
|
|
827
831
|
this.source = this.findMoreSuitableSource();
|
|
828
832
|
console.log('MarcyVideoComponent new source', this.source);
|
|
829
|
-
if (this.$status
|
|
833
|
+
if (this.$status() === MediaStatus.NotSet && this.source === undefined) {
|
|
830
834
|
return;
|
|
831
835
|
}
|
|
832
836
|
if (this.source === undefined) {
|
|
833
|
-
this.$status.
|
|
837
|
+
this.$status.set(MediaStatus.NotSet);
|
|
834
838
|
this.cd.detectChanges();
|
|
835
839
|
return;
|
|
836
840
|
}
|
|
837
|
-
this.$status.
|
|
841
|
+
this.$status.set(MediaStatus.NotLoaded);
|
|
838
842
|
this.cd.detectChanges();
|
|
839
843
|
}
|
|
840
844
|
set objectFit(val) {
|
|
@@ -845,7 +849,7 @@ class MarcyVideoComponent {
|
|
|
845
849
|
return this._objectFit;
|
|
846
850
|
}
|
|
847
851
|
onLoad() {
|
|
848
|
-
this.$status.
|
|
852
|
+
this.$status.set(MediaStatus.Loaded);
|
|
849
853
|
}
|
|
850
854
|
findMoreSuitableSource() {
|
|
851
855
|
if (this.videoRef === undefined) {
|
|
@@ -900,15 +904,16 @@ class MarcyVideoComponent {
|
|
|
900
904
|
}
|
|
901
905
|
return undefined;
|
|
902
906
|
}
|
|
903
|
-
|
|
904
|
-
|
|
907
|
+
ngOnDestroy() {
|
|
908
|
+
this._effectCleanup?.destroy();
|
|
909
|
+
}
|
|
910
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MarcyVideoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
911
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: MarcyVideoComponent, isStandalone: true, selector: "bon-video", inputs: { objectFit: "objectFit" }, outputs: { isLoaded: "isLoaded" }, providers: [UnsubscriberService], viewQueries: [{ propertyName: "videoRef", first: true, predicate: ["video"], descendants: true }], ngImport: i0, template: "<div [class.knownRatio]=\"src.ratio() > 0 && objectFit === MarcyObjectFit.Original\"\n [class.cover]=\"objectFit === MarcyObjectFit.Cover\"\n [class.contain]=\"objectFit === MarcyObjectFit.Contain\"\n [class.loaded]=\"$status() === MediaStatus.Loaded\"\n class=\"video-container\">\n\n <ng-container *ngIf=\"device.isSSR ; then ssrTemplate else browserTemplate\"></ng-container>\n\n <ng-template #videoTemplate>\n <video #video\n [src]=\"source !== undefined ? source.url :'' \"\n (load)=\"onLoad()\"\n (canplay)=\"video.muted=true;video.play();\"\n playsInline\n autoplay\n loop\n muted> </video>\n </ng-template>\n\n <ng-template #ssrTemplate>\n <noscript *ngIf=\"device.isSSR\">\n <ng-container *ngTemplateOutlet=\"videoTemplate\"></ng-container>\n </noscript>\n </ng-template>\n\n <ng-template #browserTemplate>\n <bon-intersection #intersectionZone [session]=\"src\" (intersected)=\"cd.detectChanges()\">\n <ng-container *ngTemplateOutlet=\"videoTemplate\"></ng-container>\n </bon-intersection>\n </ng-template>\n\n <div *ngIf=\"src.ratio() > 0 && objectFit === MarcyObjectFit.Original\" [style.padding-top]=\"100 / src.ratio() +'%'\"></div>\n</div>\n", styles: [":host{display:block}.video-container{background-color:#000;overflow:hidden}.video-container.cover video,.video-container.cover bon-intersection,.video-container.contain video,.video-container.contain bon-intersection,.video-container.knownRatio video,.video-container.knownRatio bon-intersection{width:100%;height:100%}.video-container.cover{height:100%}.video-container.cover video{object-fit:cover}.video-container.contain{height:100%}.video-container.contain video{object-fit:contain}.video-container.knownRatio{position:relative}.video-container.knownRatio video{position:absolute;object-fit:fill}video{display:block;width:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IntersectionComponent, selector: "bon-intersection", inputs: ["session"], outputs: ["intersected"] }] });
|
|
905
912
|
}
|
|
906
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
913
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MarcyVideoComponent, decorators: [{
|
|
907
914
|
type: Component,
|
|
908
|
-
args: [{ selector: 'bon-video', providers: [UnsubscriberService], template: "<div [class.knownRatio]=\"src.ratio > 0 && objectFit === MarcyObjectFit.Original\"\
|
|
909
|
-
}], ctorParameters: () => [
|
|
910
|
-
type: Optional
|
|
911
|
-
}] }], propDecorators: { videoRef: [{
|
|
915
|
+
args: [{ selector: 'bon-video', standalone: true, imports: [CommonModule, IntersectionComponent], providers: [UnsubscriberService], template: "<div [class.knownRatio]=\"src.ratio() > 0 && objectFit === MarcyObjectFit.Original\"\n [class.cover]=\"objectFit === MarcyObjectFit.Cover\"\n [class.contain]=\"objectFit === MarcyObjectFit.Contain\"\n [class.loaded]=\"$status() === MediaStatus.Loaded\"\n class=\"video-container\">\n\n <ng-container *ngIf=\"device.isSSR ; then ssrTemplate else browserTemplate\"></ng-container>\n\n <ng-template #videoTemplate>\n <video #video\n [src]=\"source !== undefined ? source.url :'' \"\n (load)=\"onLoad()\"\n (canplay)=\"video.muted=true;video.play();\"\n playsInline\n autoplay\n loop\n muted> </video>\n </ng-template>\n\n <ng-template #ssrTemplate>\n <noscript *ngIf=\"device.isSSR\">\n <ng-container *ngTemplateOutlet=\"videoTemplate\"></ng-container>\n </noscript>\n </ng-template>\n\n <ng-template #browserTemplate>\n <bon-intersection #intersectionZone [session]=\"src\" (intersected)=\"cd.detectChanges()\">\n <ng-container *ngTemplateOutlet=\"videoTemplate\"></ng-container>\n </bon-intersection>\n </ng-template>\n\n <div *ngIf=\"src.ratio() > 0 && objectFit === MarcyObjectFit.Original\" [style.padding-top]=\"100 / src.ratio() +'%'\"></div>\n</div>\n", styles: [":host{display:block}.video-container{background-color:#000;overflow:hidden}.video-container.cover video,.video-container.cover bon-intersection,.video-container.contain video,.video-container.contain bon-intersection,.video-container.knownRatio video,.video-container.knownRatio bon-intersection{width:100%;height:100%}.video-container.cover{height:100%}.video-container.cover video{object-fit:cover}.video-container.contain{height:100%}.video-container.contain video{object-fit:contain}.video-container.knownRatio{position:relative}.video-container.knownRatio video{position:absolute;object-fit:fill}video{display:block;width:100%}\n"] }]
|
|
916
|
+
}], ctorParameters: () => [], propDecorators: { videoRef: [{
|
|
912
917
|
type: ViewChild,
|
|
913
918
|
args: ['video']
|
|
914
919
|
}], isLoaded: [{
|
|
@@ -918,13 +923,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
|
|
|
918
923
|
}] } });
|
|
919
924
|
|
|
920
925
|
class MarcyMediaComponent {
|
|
926
|
+
device;
|
|
927
|
+
cd;
|
|
928
|
+
_u;
|
|
929
|
+
MarcyObjectFit = MediaObjectFit;
|
|
930
|
+
isLoaded = new EventEmitter();
|
|
931
|
+
_objectFit = MediaObjectFit.Original;
|
|
932
|
+
_src;
|
|
921
933
|
constructor(device, cd, _u) {
|
|
922
934
|
this.device = device;
|
|
923
935
|
this.cd = cd;
|
|
924
936
|
this._u = _u;
|
|
925
|
-
this.MarcyObjectFit = MediaObjectFit;
|
|
926
|
-
this.isLoaded = new EventEmitter();
|
|
927
|
-
this._objectFit = MediaObjectFit.Original;
|
|
928
937
|
console.log('MarcyMediaComponent ctor');
|
|
929
938
|
cd.detach();
|
|
930
939
|
}
|
|
@@ -950,12 +959,12 @@ class MarcyMediaComponent {
|
|
|
950
959
|
onLoad() {
|
|
951
960
|
this.isLoaded.next();
|
|
952
961
|
}
|
|
953
|
-
static
|
|
954
|
-
static
|
|
962
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MarcyMediaComponent, deps: [{ token: DeviceServiceBase }, { token: i0.ChangeDetectorRef }, { token: UnsubscriberService }], target: i0.ɵɵFactoryTarget.Component });
|
|
963
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: MarcyMediaComponent, isStandalone: true, selector: "bon-media", inputs: { src: "src", objectFit: "objectFit" }, outputs: { isLoaded: "isLoaded" }, providers: [UnsubscriberService], ngImport: i0, template: "<bon-image *ngIf=\"src && src.type==='image'\"\n [imgsrc]=\"src\"\n [objectFit]=\"objectFit\"\n (isLoaded)=\"onLoad()\"></bon-image>\n\n<bon-video *ngIf=\"src && src.type==='video'\"\n [vidsrc]=\"src\"\n [objectFit]=\"objectFit\"\n (isLoaded)=\"onLoad()\"></bon-video>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MarcyImageComponent, selector: "bon-image", inputs: ["objectFit"], outputs: ["isLoaded"] }, { kind: "component", type: MarcyVideoComponent, selector: "bon-video", inputs: ["objectFit"], outputs: ["isLoaded"] }, { kind: "directive", type: VideoSrcDirective, selector: "[vidsrc]", inputs: ["vidsrc"] }, { kind: "directive", type: ImageSrcDirective, selector: "[imgsrc]", inputs: ["imgsrc"] }] });
|
|
955
964
|
}
|
|
956
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
965
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MarcyMediaComponent, decorators: [{
|
|
957
966
|
type: Component,
|
|
958
|
-
args: [{ selector: 'bon-media', providers: [UnsubscriberService], template: "<bon-image *ngIf=\"src && src.type==='image'\"\
|
|
967
|
+
args: [{ selector: 'bon-media', standalone: true, imports: [CommonModule, MarcyImageComponent, MarcyVideoComponent, VideoSrcDirective, ImageSrcDirective], providers: [UnsubscriberService], template: "<bon-image *ngIf=\"src && src.type==='image'\"\n [imgsrc]=\"src\"\n [objectFit]=\"objectFit\"\n (isLoaded)=\"onLoad()\"></bon-image>\n\n<bon-video *ngIf=\"src && src.type==='video'\"\n [vidsrc]=\"src\"\n [objectFit]=\"objectFit\"\n (isLoaded)=\"onLoad()\"></bon-video>\n", styles: [":host{display:block}\n"] }]
|
|
959
968
|
}], ctorParameters: () => [{ type: DeviceServiceBase }, { type: i0.ChangeDetectorRef }, { type: UnsubscriberService }], propDecorators: { isLoaded: [{
|
|
960
969
|
type: Output
|
|
961
970
|
}], src: [{
|
|
@@ -965,19 +974,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
|
|
|
965
974
|
}] } });
|
|
966
975
|
|
|
967
976
|
class BoneDirective {
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
977
|
+
_bone;
|
|
978
|
+
cd = inject(ChangeDetectorRef);
|
|
979
|
+
localizationService = inject(LocalizeServiceBase);
|
|
980
|
+
_effectCleanup;
|
|
981
|
+
constructor() {
|
|
972
982
|
this.cd.detach();
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
this.
|
|
976
|
-
|
|
977
|
-
.
|
|
983
|
+
// todo: check if this is needed
|
|
984
|
+
// Watch locale changes using signal
|
|
985
|
+
this._effectCleanup = effect(() => {
|
|
986
|
+
// Access the signal to track changes
|
|
987
|
+
this.localizationService.locale();
|
|
978
988
|
// need to detect changes in our detached components
|
|
979
989
|
this.cd.detectChanges();
|
|
980
|
-
});
|
|
990
|
+
}, ...(ngDevMode ? [{ debugName: "_effectCleanup" }] : []));
|
|
991
|
+
}
|
|
992
|
+
ngOnInit() {
|
|
981
993
|
}
|
|
982
994
|
set bone(value) {
|
|
983
995
|
this._bone = value;
|
|
@@ -988,58 +1000,59 @@ class BoneDirective {
|
|
|
988
1000
|
throw new Error('The property "bone" should be set at least once. For example in skeleton');
|
|
989
1001
|
return this._bone;
|
|
990
1002
|
}
|
|
991
|
-
|
|
992
|
-
|
|
1003
|
+
ngOnDestroy() {
|
|
1004
|
+
this._effectCleanup?.destroy();
|
|
1005
|
+
}
|
|
1006
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BoneDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1007
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: BoneDirective, isStandalone: true, selector: "[bonBoneDir]", ngImport: i0 });
|
|
993
1008
|
}
|
|
994
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1009
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BoneDirective, decorators: [{
|
|
995
1010
|
type: Directive,
|
|
996
1011
|
args: [{
|
|
997
1012
|
selector: '[bonBoneDir]',
|
|
998
1013
|
standalone: true
|
|
999
1014
|
}]
|
|
1000
|
-
}], ctorParameters: () => [
|
|
1015
|
+
}], ctorParameters: () => [] });
|
|
1001
1016
|
|
|
1002
1017
|
class SkeletonAnchorDirective {
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
}
|
|
1006
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: SkeletonAnchorDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1007
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.8", type: SkeletonAnchorDirective, isStandalone: true, selector: "[bonSkeletonAnchor]", ngImport: i0 }); }
|
|
1018
|
+
viewContainerRef = inject(ViewContainerRef);
|
|
1019
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SkeletonAnchorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1020
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: SkeletonAnchorDirective, isStandalone: true, selector: "[bonSkeletonAnchor]", ngImport: i0 });
|
|
1008
1021
|
}
|
|
1009
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1022
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SkeletonAnchorDirective, decorators: [{
|
|
1010
1023
|
type: Directive,
|
|
1011
1024
|
args: [{
|
|
1012
1025
|
selector: '[bonSkeletonAnchor]',
|
|
1013
1026
|
standalone: true
|
|
1014
1027
|
}]
|
|
1015
|
-
}]
|
|
1028
|
+
}] });
|
|
1016
1029
|
|
|
1017
1030
|
class UnknownBoneComponent {
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
console.log('BoneDirective', bd);
|
|
1022
|
-
cd.detach();
|
|
1031
|
+
cd = inject(ChangeDetectorRef);
|
|
1032
|
+
bd = inject((BoneDirective), { host: true });
|
|
1033
|
+
constructor() {
|
|
1034
|
+
console.log('BoneDirective', this.bd);
|
|
1035
|
+
this.cd.detach();
|
|
1023
1036
|
}
|
|
1024
1037
|
ngOnInit() {
|
|
1025
1038
|
this.cd.detectChanges();
|
|
1026
1039
|
}
|
|
1027
|
-
static
|
|
1028
|
-
static
|
|
1029
|
-
<div>{{bd.bone | json}}</div>`, isInline: true, styles: [":host{display:block;border:2px solid red;box-sizing:border-box}\n"], dependencies: [{ kind: "pipe", type:
|
|
1040
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: UnknownBoneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1041
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: UnknownBoneComponent, isStandalone: true, selector: "bon-unknown-bone", hostDirectives: [{ directive: BoneDirective }], ngImport: i0, template: `<h2>unknown bone {{bd.bone.type}}</h2>
|
|
1042
|
+
<div>{{bd.bone | json}}</div>`, isInline: true, styles: [":host{display:block;border:2px solid red;box-sizing:border-box}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.JsonPipe, name: "json" }] });
|
|
1030
1043
|
}
|
|
1031
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1044
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: UnknownBoneComponent, decorators: [{
|
|
1032
1045
|
type: Component,
|
|
1033
|
-
args: [{ selector: 'bon-unknown-bone', hostDirectives: [BoneDirective], template: `<h2>unknown bone {{bd.bone.type}}</h2>
|
|
1046
|
+
args: [{ selector: 'bon-unknown-bone', standalone: true, imports: [CommonModule, JsonPipe], hostDirectives: [BoneDirective], template: `<h2>unknown bone {{bd.bone.type}}</h2>
|
|
1034
1047
|
<div>{{bd.bone | json}}</div>`, styles: [":host{display:block;border:2px solid red;box-sizing:border-box}\n"] }]
|
|
1035
|
-
}], ctorParameters: () => [
|
|
1048
|
+
}], ctorParameters: () => [] });
|
|
1036
1049
|
|
|
1037
1050
|
class SkeletonComponent {
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1051
|
+
skeletonAnchor;
|
|
1052
|
+
map;
|
|
1053
|
+
_bones = [];
|
|
1054
|
+
iniailized = false;
|
|
1055
|
+
cd = inject(ChangeDetectorRef);
|
|
1043
1056
|
ngOnInit() {
|
|
1044
1057
|
this.iniailized = true;
|
|
1045
1058
|
this.fillComponentFromBones();
|
|
@@ -1066,13 +1079,13 @@ class SkeletonComponent {
|
|
|
1066
1079
|
boneComponentRef.instance.bd.bone = bone;
|
|
1067
1080
|
}
|
|
1068
1081
|
}
|
|
1069
|
-
static
|
|
1070
|
-
static
|
|
1082
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SkeletonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1083
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: SkeletonComponent, isStandalone: true, selector: "bon-skeleton", inputs: { map: "map", bones: "bones" }, viewQueries: [{ propertyName: "skeletonAnchor", first: true, predicate: SkeletonAnchorDirective, descendants: true, static: true }], ngImport: i0, template: "<ng-template bonSkeletonAnchor></ng-template>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: SkeletonAnchorDirective, selector: "[bonSkeletonAnchor]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1071
1084
|
}
|
|
1072
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1085
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SkeletonComponent, decorators: [{
|
|
1073
1086
|
type: Component,
|
|
1074
|
-
args: [{ selector: 'bon-skeleton', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template bonSkeletonAnchor></ng-template>\
|
|
1075
|
-
}],
|
|
1087
|
+
args: [{ selector: 'bon-skeleton', standalone: true, imports: [SkeletonAnchorDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template bonSkeletonAnchor></ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
1088
|
+
}], propDecorators: { skeletonAnchor: [{
|
|
1076
1089
|
type: ViewChild,
|
|
1077
1090
|
args: [SkeletonAnchorDirective, { static: true }]
|
|
1078
1091
|
}], map: [{
|
|
@@ -1092,92 +1105,9 @@ class BoneMap extends Map {
|
|
|
1092
1105
|
}
|
|
1093
1106
|
}
|
|
1094
1107
|
|
|
1095
|
-
const components = [
|
|
1096
|
-
MarcyImageComponent,
|
|
1097
|
-
MarcyVideoComponent,
|
|
1098
|
-
MarcyMediaComponent,
|
|
1099
|
-
IntersectionComponent,
|
|
1100
|
-
//
|
|
1101
|
-
SkeletonComponent,
|
|
1102
|
-
UnknownBoneComponent
|
|
1103
|
-
];
|
|
1104
|
-
const directives = [
|
|
1105
|
-
SrcBaseDirective,
|
|
1106
|
-
ImageSrcDirective,
|
|
1107
|
-
VideoSrcDirective,
|
|
1108
|
-
];
|
|
1109
|
-
const standAloneDirectives = [
|
|
1110
|
-
SkeletonAnchorDirective,
|
|
1111
|
-
BoneDirective
|
|
1112
|
-
];
|
|
1113
|
-
const pipes = [
|
|
1114
|
-
EncodeURIComponentPipe,
|
|
1115
|
-
LocalizePipe,
|
|
1116
|
-
LocalizationIsNotEmptyPipe
|
|
1117
|
-
];
|
|
1118
|
-
class BonnieModule {
|
|
1119
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: BonnieModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1120
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: BonnieModule, declarations: [MarcyImageComponent,
|
|
1121
|
-
MarcyVideoComponent,
|
|
1122
|
-
MarcyMediaComponent,
|
|
1123
|
-
IntersectionComponent,
|
|
1124
|
-
//
|
|
1125
|
-
SkeletonComponent,
|
|
1126
|
-
UnknownBoneComponent, SrcBaseDirective,
|
|
1127
|
-
ImageSrcDirective,
|
|
1128
|
-
VideoSrcDirective, EncodeURIComponentPipe,
|
|
1129
|
-
LocalizePipe,
|
|
1130
|
-
LocalizationIsNotEmptyPipe], imports: [CommonModule, SkeletonAnchorDirective,
|
|
1131
|
-
BoneDirective], exports: [CommonModule, EncodeURIComponentPipe,
|
|
1132
|
-
LocalizePipe,
|
|
1133
|
-
LocalizationIsNotEmptyPipe, MarcyImageComponent,
|
|
1134
|
-
MarcyVideoComponent,
|
|
1135
|
-
MarcyMediaComponent,
|
|
1136
|
-
IntersectionComponent,
|
|
1137
|
-
//
|
|
1138
|
-
SkeletonComponent,
|
|
1139
|
-
UnknownBoneComponent, SrcBaseDirective,
|
|
1140
|
-
ImageSrcDirective,
|
|
1141
|
-
VideoSrcDirective, SkeletonAnchorDirective,
|
|
1142
|
-
BoneDirective] }); }
|
|
1143
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: BonnieModule, providers: [
|
|
1144
|
-
...pipes,
|
|
1145
|
-
UnsubscriberService,
|
|
1146
|
-
DeviceService,
|
|
1147
|
-
{ provide: DeviceServiceBase, useExisting: DeviceService },
|
|
1148
|
-
], imports: [CommonModule, CommonModule] }); }
|
|
1149
|
-
} // todo: move to standalone
|
|
1150
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: BonnieModule, decorators: [{
|
|
1151
|
-
type: NgModule,
|
|
1152
|
-
args: [{
|
|
1153
|
-
declarations: [
|
|
1154
|
-
...components,
|
|
1155
|
-
...directives,
|
|
1156
|
-
...pipes,
|
|
1157
|
-
],
|
|
1158
|
-
providers: [
|
|
1159
|
-
...pipes,
|
|
1160
|
-
UnsubscriberService,
|
|
1161
|
-
DeviceService,
|
|
1162
|
-
{ provide: DeviceServiceBase, useExisting: DeviceService },
|
|
1163
|
-
],
|
|
1164
|
-
imports: [
|
|
1165
|
-
CommonModule,
|
|
1166
|
-
...standAloneDirectives
|
|
1167
|
-
],
|
|
1168
|
-
exports: [
|
|
1169
|
-
CommonModule,
|
|
1170
|
-
...pipes,
|
|
1171
|
-
...components,
|
|
1172
|
-
...directives,
|
|
1173
|
-
...standAloneDirectives
|
|
1174
|
-
]
|
|
1175
|
-
}]
|
|
1176
|
-
}] });
|
|
1177
|
-
|
|
1178
1108
|
/**
|
|
1179
1109
|
* Generated bundle index. Do not edit.
|
|
1180
1110
|
*/
|
|
1181
1111
|
|
|
1182
|
-
export { BoneDirective, BoneMap,
|
|
1112
|
+
export { BoneDirective, BoneMap, DeviceService, DeviceServiceBase, EncodeURIComponentPipe, ImageSrcDirective, IntersectionComponent, IsLocalUrlPipe, IsNotLocalUrlPipe, LocalizationIsEmptyPipe, LocalizationIsNotEmptyPipe, LocalizeObjectPipe, LocalizePipe, LocalizeServiceBase, LocalizeUrlPipe, MarcyImageComponent, MarcyMediaComponent, MarcyVideoComponent, MediaObjectFit, MediaStatus, PublishStatus, SizesWidthUnit, SkeletonAnchorDirective, SkeletonComponent, SrcBaseDirective, UnknownBoneComponent, UnsubscriberService, VideoSrcDirective, emptyBone, emptyImage, emptyLocalizedString, emptyVideo, getDefaultSrc, toHtmlPictureSources };
|
|
1183
1113
|
//# sourceMappingURL=candy-kingdom-bonnie.mjs.map
|