angular-three 1.6.9 → 1.6.11
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/loader.mjs +5 -1
- package/esm2020/lib/stores/rx-store.mjs +14 -2
- package/fesm2015/angular-three.mjs +18 -2
- package/fesm2015/angular-three.mjs.map +1 -1
- package/fesm2020/angular-three.mjs +17 -2
- 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, Injectable,
|
|
2
|
+
import { inject, ChangeDetectorRef, ElementRef, Injectable, InjectionToken, ViewContainerRef, TemplateRef, Directive, Input, EventEmitter, getDebugNode, RendererFactory2, 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';
|
|
@@ -59,6 +59,7 @@ function makeObjectGraph(object) {
|
|
|
59
59
|
const cached = new Map();
|
|
60
60
|
function injectLoader(loaderConstructorFactory, input, extensions, onProgress) {
|
|
61
61
|
const urls$ = isObservable(input) ? input : of(input);
|
|
62
|
+
const cdr = inject(ChangeDetectorRef);
|
|
62
63
|
return urls$.pipe(map((inputs) => {
|
|
63
64
|
const loaderConstructor = loaderConstructorFactory(inputs);
|
|
64
65
|
const loader = new loaderConstructor();
|
|
@@ -91,6 +92,8 @@ function injectLoader(loaderConstructorFactory, input, extensions, onProgress) {
|
|
|
91
92
|
result[key] = results[keys.indexOf(key)];
|
|
92
93
|
return result;
|
|
93
94
|
}, {});
|
|
95
|
+
}), tap(() => {
|
|
96
|
+
requestAnimationFrame(() => cdr.detectChanges());
|
|
94
97
|
}));
|
|
95
98
|
}));
|
|
96
99
|
}
|
|
@@ -516,6 +519,7 @@ function tapEffect(effectFn) {
|
|
|
516
519
|
class NgtRxStore extends RxState {
|
|
517
520
|
constructor() {
|
|
518
521
|
super();
|
|
522
|
+
this.cache = {};
|
|
519
523
|
// set a dummy property so that initial this.get() won't return undefined
|
|
520
524
|
this.set({ __ngt_dummy__: '__ngt_dummy__' });
|
|
521
525
|
// call initialize that might be setup by derived Stores
|
|
@@ -555,6 +559,17 @@ class NgtRxStore extends RxState {
|
|
|
555
559
|
requestAnimationFrame(() => void cdr.detectChanges());
|
|
556
560
|
});
|
|
557
561
|
}
|
|
562
|
+
key$(...keys) {
|
|
563
|
+
const key = keys.join('.');
|
|
564
|
+
if (!this.cache[key]) {
|
|
565
|
+
this.cache[key] = this.select(...keys).pipe(startWith(this.get(...keys) ?? undefined), distinctUntilChanged());
|
|
566
|
+
}
|
|
567
|
+
return this.cache[key];
|
|
568
|
+
}
|
|
569
|
+
ngOnDestroy() {
|
|
570
|
+
this.cache = {};
|
|
571
|
+
super.ngOnDestroy();
|
|
572
|
+
}
|
|
558
573
|
}
|
|
559
574
|
NgtRxStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtRxStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
560
575
|
NgtRxStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtRxStore });
|