angular-three 1.6.8 → 1.6.10
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/stores/rx-store.mjs +17 -11
- package/fesm2015/angular-three.mjs +30 -22
- package/fesm2015/angular-three.mjs.map +1 -1
- package/fesm2020/angular-three.mjs +29 -22
- package/fesm2020/angular-three.mjs.map +1 -1
- package/lib/stores/rx-store.d.ts +7 -2
- package/package.json +1 -1
- package/plugin/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { ElementRef,
|
|
2
|
+
import { ElementRef, Injectable, inject, InjectionToken, ViewContainerRef, TemplateRef, Directive, Input, EventEmitter, getDebugNode, RendererFactory2, ChangeDetectorRef, makeEnvironmentProviders, EnvironmentInjector, createEnvironmentInjector, Component, HostBinding, Output, ViewChild, Injector, Pipe, SkipSelf, ContentChild } from '@angular/core';
|
|
3
3
|
import { provideNgxResizeOptions, NgxResize } from 'ngx-resize';
|
|
4
|
-
import { isObservable, of, map, from, tap, retry, catchError, share, ReplaySubject, switchMap, forkJoin, take, BehaviorSubject, startWith, combineLatest,
|
|
4
|
+
import { isObservable, of, map, from, tap, retry, catchError, share, ReplaySubject, switchMap, forkJoin, take, BehaviorSubject, startWith, combineLatest, distinctUntilChanged, filter, takeUntil, merge } from 'rxjs';
|
|
5
5
|
import * as THREE from 'three';
|
|
6
6
|
import { DOCUMENT, NgForOf, NgIf } from '@angular/common';
|
|
7
7
|
import { RxState, selectSlice } from '@rx-angular/state';
|
|
@@ -459,19 +459,6 @@ function applyProps(instance, props) {
|
|
|
459
459
|
return instance;
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
-
function safeDetectChanges(cdr) {
|
|
463
|
-
if (!cdr)
|
|
464
|
-
return;
|
|
465
|
-
try {
|
|
466
|
-
if (cdr['context']) {
|
|
467
|
-
cdr.detectChanges();
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
catch (e) {
|
|
471
|
-
cdr.markForCheck();
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
|
|
475
462
|
const startWithUndefined = () => startWith(undefined);
|
|
476
463
|
/**
|
|
477
464
|
* An extended `tap` operator that accepts an `effectFn` which:
|
|
@@ -529,7 +516,7 @@ function tapEffect(effectFn) {
|
|
|
529
516
|
class NgtRxStore extends RxState {
|
|
530
517
|
constructor() {
|
|
531
518
|
super();
|
|
532
|
-
|
|
519
|
+
this.cache = {};
|
|
533
520
|
// set a dummy property so that initial this.get() won't return undefined
|
|
534
521
|
this.set({ __ngt_dummy__: '__ngt_dummy__' });
|
|
535
522
|
// call initialize that might be setup by derived Stores
|
|
@@ -546,14 +533,10 @@ class NgtRxStore extends RxState {
|
|
|
546
533
|
modded[key] = value === undefined ? this.get(key) : value;
|
|
547
534
|
return modded;
|
|
548
535
|
}, {});
|
|
549
|
-
|
|
550
|
-
safeDetectChanges(cdr);
|
|
551
|
-
return value;
|
|
536
|
+
return originalSet(modArgs);
|
|
552
537
|
}
|
|
553
538
|
// @ts-expect-error not sure why ...args here doesn't pass tuple check
|
|
554
|
-
|
|
555
|
-
safeDetectChanges(cdr);
|
|
556
|
-
return value;
|
|
539
|
+
return originalSet(...args);
|
|
557
540
|
};
|
|
558
541
|
},
|
|
559
542
|
});
|
|
@@ -573,6 +556,17 @@ class NgtRxStore extends RxState {
|
|
|
573
556
|
requestAnimationFrame(() => void cdr.detectChanges());
|
|
574
557
|
});
|
|
575
558
|
}
|
|
559
|
+
key$(...keys) {
|
|
560
|
+
const key = keys.join('.');
|
|
561
|
+
if (!this.cache[key]) {
|
|
562
|
+
this.cache[key] = this.select(...keys).pipe(startWith(this.get(...keys) ?? undefined), distinctUntilChanged());
|
|
563
|
+
}
|
|
564
|
+
return this.cache[key];
|
|
565
|
+
}
|
|
566
|
+
ngOnDestroy() {
|
|
567
|
+
this.cache = {};
|
|
568
|
+
super.ngOnDestroy();
|
|
569
|
+
}
|
|
576
570
|
}
|
|
577
571
|
NgtRxStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtRxStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
578
572
|
NgtRxStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtRxStore });
|
|
@@ -2600,6 +2594,19 @@ function injectBeforeRender(cb, priority = 0) {
|
|
|
2600
2594
|
}
|
|
2601
2595
|
}
|
|
2602
2596
|
|
|
2597
|
+
function safeDetectChanges(cdr) {
|
|
2598
|
+
if (!cdr)
|
|
2599
|
+
return;
|
|
2600
|
+
try {
|
|
2601
|
+
if (cdr['context']) {
|
|
2602
|
+
cdr.detectChanges();
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
catch (e) {
|
|
2606
|
+
cdr.markForCheck();
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2603
2610
|
function injectNgtRef(initialValue = null) {
|
|
2604
2611
|
const ref = is.ref(initialValue) ? initialValue : new ElementRef(initialValue);
|
|
2605
2612
|
let lastValue = ref.nativeElement;
|