angular-three 1.0.2 → 1.2.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.
@@ -63,26 +63,19 @@ function injectLoader(loaderConstructorFactory, input, extensions, onProgress) {
63
63
  return urls$.pipe(map((inputs) => {
64
64
  const loaderConstructor = loaderConstructorFactory(inputs);
65
65
  const loader = new loaderConstructor();
66
- if (extensions) {
66
+ if (extensions)
67
67
  extensions(loader);
68
- }
69
68
  const urls = Array.isArray(inputs) ? inputs : typeof inputs === 'string' ? [inputs] : Object.values(inputs);
70
69
  return [
71
70
  urls.map((url) => {
72
71
  if (!cached.has(url)) {
73
72
  cached.set(url, from(loader.loadAsync(url, onProgress)).pipe(tap((data) => {
74
- if (data.scene) {
73
+ if (data.scene)
75
74
  Object.assign(data, makeObjectGraph(data.scene));
76
- }
77
75
  }), retry(2), catchError((err) => {
78
76
  console.error(`[NGT] Error loading ${url}: ${err.message}`);
79
77
  return of([]);
80
- }), share({
81
- connector: () => new ReplaySubject(1),
82
- resetOnComplete: true,
83
- resetOnError: true,
84
- resetOnRefCountZero: true,
85
- })));
78
+ }), share({ connector: () => new ReplaySubject(1) })));
86
79
  }
87
80
  return cached.get(url);
88
81
  }),
@@ -298,19 +291,16 @@ const is = {
298
291
  function checkNeedsUpdate(value) {
299
292
  if (value !== null && is.obj(value) && 'needsUpdate' in value) {
300
293
  value['needsUpdate'] = true;
301
- if ('uniformsNeedUpdate' in value) {
294
+ if ('uniformsNeedUpdate' in value)
302
295
  value['uniformsNeedUpdate'] = true;
303
- }
304
296
  }
305
297
  }
306
298
  function checkUpdate(value) {
307
- if (is.object3D(value)) {
299
+ if (is.object3D(value))
308
300
  value.updateMatrix();
309
- }
310
301
  if (is.camera(value)) {
311
- if (is.perspectiveCamera(value) || is.orthographicCamera(value)) {
302
+ if (is.perspectiveCamera(value) || is.orthographicCamera(value))
312
303
  value.updateProjectionMatrix();
313
- }
314
304
  value.updateMatrixWorld();
315
305
  }
316
306
  checkNeedsUpdate(value);
@@ -323,9 +313,8 @@ function updateCamera(camera, size) {
323
313
  camera.top = size.height / 2;
324
314
  camera.bottom = size.height / -2;
325
315
  }
326
- else {
316
+ else
327
317
  camera.aspect = size.width / size.height;
328
- }
329
318
  camera.updateProjectionMatrix();
330
319
  camera.updateMatrixWorld();
331
320
  }
@@ -426,9 +415,8 @@ function applyProps(instance, props) {
426
415
  value.constructor &&
427
416
  targetProp.constructor.name === value.constructor.name) {
428
417
  targetProp['copy'](value);
429
- if (!THREE.ColorManagement && !rootState.linear && isColor) {
418
+ if (!THREE.ColorManagement && !rootState.linear && isColor)
430
419
  targetProp['convertSRGBToLinear']();
431
- }
432
420
  }
433
421
  // if nothing else fits, just set the single value, ignore undefined
434
422
  else if (value !== undefined) {
@@ -437,17 +425,14 @@ function applyProps(instance, props) {
437
425
  if (!isColor && targetProp['setScalar'])
438
426
  targetProp['setScalar'](value);
439
427
  // layers have no copy function, copy the mask
440
- else if (targetProp instanceof THREE.Layers && value instanceof THREE.Layers) {
428
+ else if (targetProp instanceof THREE.Layers && value instanceof THREE.Layers)
441
429
  targetProp.mask = value.mask;
442
- }
443
430
  // otherwise just set ...
444
- else {
431
+ else
445
432
  targetProp['set'](value);
446
- }
447
433
  // auto-convert srgb
448
- if (!THREE.ColorManagement && !rootState?.linear && isColor) {
434
+ if (!THREE.ColorManagement && !rootState?.linear && isColor)
449
435
  targetProp.convertSRGBToLinear();
450
- }
451
436
  }
452
437
  }
453
438
  // else just overwrite the value
@@ -540,7 +525,7 @@ class NgtRxStore extends RxState {
540
525
  const originalSet = this.set.bind(this);
541
526
  Object.defineProperty(this, 'set', {
542
527
  get: () => {
543
- // Parameters type does not do well with overloads. So we use any[] here
528
+ // Parameters type does not do well with overloads (RxState#set). So we use any[] here
544
529
  return (...args) => {
545
530
  const firstArg = args[0];
546
531
  if (is.obj(firstArg)) {
@@ -550,7 +535,7 @@ class NgtRxStore extends RxState {
550
535
  }, {});
551
536
  return originalSet(modArgs);
552
537
  }
553
- // @ts-ignore
538
+ // @ts-expect-error not sure why ...args here doesn't pass tuple check
554
539
  return originalSet(...args);
555
540
  };
556
541
  },
@@ -563,9 +548,9 @@ class NgtRxStore extends RxState {
563
548
  return this.hold(obs.pipe(tapEffect(sideEffectFn)));
564
549
  }
565
550
  }
566
- NgtRxStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRxStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
567
- NgtRxStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRxStore });
568
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRxStore, decorators: [{
551
+ NgtRxStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRxStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
552
+ NgtRxStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRxStore });
553
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRxStore, decorators: [{
569
554
  type: Injectable
570
555
  }], ctorParameters: function () { return []; } });
571
556
 
@@ -606,15 +591,7 @@ class NgtStore extends NgtRxStore {
606
591
  const fov = (camera.fov * Math.PI) / 180; // convert vertical fov to radians
607
592
  const h = 2 * Math.tan(fov / 2) * distance; // visible height
608
593
  const w = h * aspect;
609
- return {
610
- width: w,
611
- height: h,
612
- top,
613
- left,
614
- factor: width / w,
615
- distance,
616
- aspect,
617
- };
594
+ return { width: w, height: h, top, left, factor: width / w, distance, aspect };
618
595
  };
619
596
  const pointer = new THREE.Vector2();
620
597
  let performanceTimeout;
@@ -794,9 +771,8 @@ class NgtStore extends NgtRxStore {
794
771
  // update projection matrix after applyprops
795
772
  camera.updateProjectionMatrix();
796
773
  }
797
- if (!is.instance(camera)) {
774
+ if (!is.instance(camera))
798
775
  camera = prepare(camera, { store: this });
799
- }
800
776
  stateToUpdate.camera = camera;
801
777
  }
802
778
  // Set up XR (one time only!)
@@ -874,9 +850,8 @@ class NgtStore extends NgtRxStore {
874
850
  applyProps(gl, glOptions);
875
851
  }
876
852
  // Store events internally
877
- if (events && !state.events.handlers) {
853
+ if (events && !state.events.handlers)
878
854
  stateToUpdate.events = events(this);
879
- }
880
855
  // Check performance
881
856
  if (performance && !is.equ(performance, state.performance, shallowLoose)) {
882
857
  stateToUpdate.performance = { ...state.performance, ...performance };
@@ -892,9 +867,8 @@ class NgtStore extends NgtRxStore {
892
867
  // Check frameloop
893
868
  if (state.frameloop !== frameloop)
894
869
  state.setFrameloop(frameloop);
895
- if (!this.get('ready')) {
870
+ if (!this.get('ready'))
896
871
  this.set({ ready: true });
897
- }
898
872
  this.invalidate();
899
873
  }
900
874
  resize() {
@@ -925,9 +899,9 @@ class NgtStore extends NgtRxStore {
925
899
  this.hold(this.select(), () => invalidate(this));
926
900
  }
927
901
  }
928
- NgtStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtStore, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
929
- NgtStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtStore });
930
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtStore, decorators: [{
902
+ NgtStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtStore, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
903
+ NgtStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtStore });
904
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtStore, decorators: [{
931
905
  type: Injectable
932
906
  }] });
933
907
  function computeInitialSize(canvas, defaultSize) {
@@ -988,9 +962,9 @@ class NgtArgs {
988
962
  this.view.detectChanges();
989
963
  }
990
964
  }
991
- NgtArgs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtArgs, deps: [], target: i0.ɵɵFactoryTarget.Directive });
992
- NgtArgs.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.1", type: NgtArgs, isStandalone: true, selector: "[args]", inputs: { args: "args" }, ngImport: i0 });
993
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtArgs, decorators: [{
965
+ NgtArgs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtArgs, deps: [], target: i0.ɵɵFactoryTarget.Directive });
966
+ NgtArgs.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: NgtArgs, isStandalone: true, selector: "[args]", inputs: { args: "args" }, ngImport: i0 });
967
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtArgs, decorators: [{
994
968
  type: Directive,
995
969
  args: [{ selector: '[args]', standalone: true }]
996
970
  }], ctorParameters: function () { return []; }, propDecorators: { args: [{
@@ -1392,7 +1366,8 @@ function attachThreeChild(parent, child) {
1392
1366
  // whether the child is added to the parent with parent.add()
1393
1367
  let added = false;
1394
1368
  // assign store on child if not already exist
1395
- if (!cLS.store) {
1369
+ // or child store is the parent of parent store
1370
+ if (!cLS.store || cLS.store === pLS.store.get('previousStore')) {
1396
1371
  cLS.store = pLS.store;
1397
1372
  }
1398
1373
  if (cLS.attach) {
@@ -1672,7 +1647,6 @@ class NgtRendererStore {
1672
1647
  return;
1673
1648
  }
1674
1649
  if (name === SPECIAL_PROPERTIES.VALUE) {
1675
- // TODO the last time we tried this here, this didn't work
1676
1650
  // coercion
1677
1651
  let maybeCoerced = value;
1678
1652
  if (maybeCoerced === '' || maybeCoerced === 'true' || maybeCoerced === 'false') {
@@ -1870,7 +1844,12 @@ class NgtRendererStore {
1870
1844
  let i = this.portals.length - 1;
1871
1845
  while (i >= 0) {
1872
1846
  // loop through the portal state backwards to find the closest NgtStore
1873
- const injector = this.portals[i].__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */]();
1847
+ const portal = this.portals[i];
1848
+ if (portal.__ngt_renderer__[3 /* NgtRendererClassId.destroyed */]) {
1849
+ i--;
1850
+ continue;
1851
+ }
1852
+ const injector = portal.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */]();
1874
1853
  if (!injector) {
1875
1854
  i--;
1876
1855
  continue;
@@ -1894,31 +1873,47 @@ class NgtRendererFactory {
1894
1873
  this.store = inject(NgtStore);
1895
1874
  this.catalogue = inject(NGT_CATALOGUE);
1896
1875
  this.compoundPrefixes = inject(NGT_COMPOUND_PREFIXES);
1897
- this.rendererStore = new NgtRendererStore({
1898
- store: this.store,
1899
- cdr: this.cdr,
1900
- compoundPrefixes: this.compoundPrefixes,
1901
- });
1876
+ this.rendererMap = new Map();
1902
1877
  }
1903
1878
  createRenderer(hostElement, type) {
1904
- // TODO we might need to check on "type" to return DomRenderer for that particular type to support HTML
1905
- if (!this.renderer) {
1906
- const domRenderer = this.domRendererFactory.createRenderer(hostElement, type);
1907
- this.renderer = new NgtRenderer(domRenderer, this.rendererStore, this.catalogue);
1879
+ const domRenderer = this.domRendererFactory.createRenderer(hostElement, type);
1880
+ if (!type)
1881
+ return domRenderer;
1882
+ let renderer = this.rendererMap.get(type.id);
1883
+ if (renderer)
1884
+ return renderer;
1885
+ if (!hostElement) {
1886
+ const store = new NgtRendererStore({
1887
+ store: this.store,
1888
+ cdr: this.cdr,
1889
+ compoundPrefixes: this.compoundPrefixes,
1890
+ });
1891
+ renderer = new NgtRenderer(domRenderer, store, this.catalogue, true);
1892
+ this.rendererMap.set(type.id, renderer);
1893
+ }
1894
+ if (!renderer) {
1895
+ const store = new NgtRendererStore({
1896
+ store: this.store,
1897
+ cdr: this.cdr,
1898
+ compoundPrefixes: this.compoundPrefixes,
1899
+ });
1900
+ renderer = new NgtRenderer(domRenderer, store, this.catalogue);
1901
+ this.rendererMap.set(type.id, renderer);
1908
1902
  }
1909
- return this.renderer;
1903
+ return renderer;
1910
1904
  }
1911
1905
  }
1912
- NgtRendererFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRendererFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1913
- NgtRendererFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRendererFactory });
1914
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRendererFactory, decorators: [{
1906
+ NgtRendererFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRendererFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1907
+ NgtRendererFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRendererFactory });
1908
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRendererFactory, decorators: [{
1915
1909
  type: Injectable
1916
1910
  }] });
1917
1911
  class NgtRenderer {
1918
- constructor(domRenderer, store, catalogue) {
1912
+ constructor(domRenderer, store, catalogue, root = false) {
1919
1913
  this.domRenderer = domRenderer;
1920
1914
  this.store = store;
1921
1915
  this.catalogue = catalogue;
1916
+ this.root = root;
1922
1917
  this.first = false;
1923
1918
  this.createText = this.domRenderer.createText.bind(this.domRenderer);
1924
1919
  this.destroy = this.domRenderer.destroy.bind(this.domRenderer);
@@ -1935,7 +1930,7 @@ class NgtRenderer {
1935
1930
  createElement(name, namespace) {
1936
1931
  const element = this.domRenderer.createElement(name, namespace);
1937
1932
  // on first pass, we return the Root Scene as the root node
1938
- if (!this.first) {
1933
+ if (this.root && !this.first) {
1939
1934
  this.first = true;
1940
1935
  return this.store.createNode('three', this.store.rootScene);
1941
1936
  }
@@ -1997,7 +1992,7 @@ class NgtRenderer {
1997
1992
  }
1998
1993
  this.store.setParent(newChild, parent);
1999
1994
  this.store.addChild(parent, newChild);
2000
- // if new chlid is a portal
1995
+ // if new child is a portal
2001
1996
  if (newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'portal') {
2002
1997
  this.store.processPortalContainer(newChild);
2003
1998
  if (newChild.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */]) {
@@ -2058,25 +2053,23 @@ class NgtRenderer {
2058
2053
  this.store.setCompound(parent, newChild);
2059
2054
  }
2060
2055
  }
2061
- if (newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' && !getLocalState(newChild).parent) {
2056
+ const shouldFindGrandparentInstance =
2057
+ // if child is three but haven't been attached to a parent yet
2058
+ (newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' && !getLocalState(newChild).parent) ||
2059
+ // or both parent and child are DOM elements
2060
+ (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom' &&
2061
+ newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom');
2062
+ if (shouldFindGrandparentInstance) {
2062
2063
  // we'll try to get the grandparent instance here so that we can run appendChild with both instances
2063
2064
  const closestGrandparentInstance = this.store.getClosestParentWithInstance(parent);
2064
2065
  if (closestGrandparentInstance) {
2065
2066
  this.appendChild(closestGrandparentInstance, newChild);
2066
2067
  }
2067
- return;
2068
- }
2069
- if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom' &&
2070
- newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom') {
2071
- const closestGrandparentInstance = this.store.getClosestParentWithInstance(parent);
2072
- if (closestGrandparentInstance) {
2073
- this.appendChild(closestGrandparentInstance, newChild);
2074
- }
2075
2068
  }
2076
2069
  }
2077
2070
  insertBefore(parent, newChild
2078
2071
  // TODO we might need these?
2079
- // refChild: NgtRendererNode,
2072
+ // refChild: NgtRendererNode
2080
2073
  // isMove?: boolean | undefined
2081
2074
  ) {
2082
2075
  if (!parent.__ngt_renderer__)
@@ -2342,9 +2335,7 @@ class NgtCanvas extends NgtRxStore {
2342
2335
  // set rootStateMap
2343
2336
  rootStateMap.set(this.glCanvas.nativeElement, this.store);
2344
2337
  // subscribe to store to listen for ready state
2345
- this.hold(this.store.select('ready').pipe(filter((ready) => ready)), () => {
2346
- this.storeReady();
2347
- });
2338
+ this.hold(this.store.select('ready').pipe(filter((ready) => ready)), () => this.storeReady());
2348
2339
  }
2349
2340
  onResize({ width, height }) {
2350
2341
  if (width > 0 && height > 0) {
@@ -2378,9 +2369,8 @@ class NgtCanvas extends NgtRxStore {
2378
2369
  this.cdr.detectChanges();
2379
2370
  }
2380
2371
  // render
2381
- if (this.glRef) {
2372
+ if (this.glRef)
2382
2373
  this.glRef.destroy();
2383
- }
2384
2374
  requestAnimationFrame(() => {
2385
2375
  this.glEnvInjector = createEnvironmentInjector([
2386
2376
  provideNgtRenderer({
@@ -2399,12 +2389,10 @@ class NgtCanvas extends NgtRxStore {
2399
2389
  });
2400
2390
  }
2401
2391
  ngOnDestroy() {
2402
- if (this.glRef) {
2392
+ if (this.glRef)
2403
2393
  this.glRef.destroy();
2404
- }
2405
- if (this.glEnvInjector) {
2394
+ if (this.glEnvInjector)
2406
2395
  this.glEnvInjector.destroy();
2407
- }
2408
2396
  injectNgtLoader.destroy();
2409
2397
  super.ngOnDestroy();
2410
2398
  }
@@ -2416,13 +2404,13 @@ class NgtCanvas extends NgtRxStore {
2416
2404
  };
2417
2405
  }
2418
2406
  }
2419
- NgtCanvas.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtCanvas, deps: null, target: i0.ɵɵFactoryTarget.Component });
2420
- NgtCanvas.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.1", type: NgtCanvas, isStandalone: true, selector: "ngt-canvas", inputs: { sceneGraph: "sceneGraph", compoundPrefixes: "compoundPrefixes", linear: "linear", legacy: "legacy", flat: "flat", orthographic: "orthographic", frameloop: "frameloop", dpr: "dpr", raycaster: "raycaster", shadows: "shadows", camera: "camera", gl: "gl", eventSource: "eventSource", eventPrefix: "eventPrefix", lookAt: "lookAt", performance: "performance" }, outputs: { created: "created", pointerMissed: "pointerMissed" }, host: { properties: { "class.ngt-canvas": "this.hostClass", "style.pointerEvents": "this.pointerEvents" } }, providers: [NgtStore, provideNgxResizeOptions({ emitInZone: false })], viewQueries: [{ propertyName: "glCanvas", first: true, predicate: ["glCanvas"], descendants: true, static: true }, { propertyName: "glAnchor", first: true, predicate: ["glCanvas"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: `
2407
+ NgtCanvas.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtCanvas, deps: null, target: i0.ɵɵFactoryTarget.Component });
2408
+ NgtCanvas.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NgtCanvas, isStandalone: true, selector: "ngt-canvas", inputs: { sceneGraph: "sceneGraph", compoundPrefixes: "compoundPrefixes", linear: "linear", legacy: "legacy", flat: "flat", orthographic: "orthographic", frameloop: "frameloop", dpr: "dpr", raycaster: "raycaster", shadows: "shadows", camera: "camera", gl: "gl", eventSource: "eventSource", eventPrefix: "eventPrefix", lookAt: "lookAt", performance: "performance" }, outputs: { created: "created", pointerMissed: "pointerMissed" }, host: { properties: { "class.ngt-canvas": "this.hostClass", "style.pointerEvents": "this.pointerEvents" } }, providers: [NgtStore, provideNgxResizeOptions({ emitInZone: false })], viewQueries: [{ propertyName: "glCanvas", first: true, predicate: ["glCanvas"], descendants: true, static: true }, { propertyName: "glAnchor", first: true, predicate: ["glCanvas"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: `
2421
2409
  <div (ngxResize)="onResize($event)" style="height: 100%; width: 100%;">
2422
2410
  <canvas #glCanvas style="display: block;"></canvas>
2423
2411
  </div>
2424
2412
  `, isInline: true, styles: [":host{display:block;position:relative;width:100%;height:100%;overflow:hidden}\n"], dependencies: [{ kind: "directive", type: NgxResize, selector: "[ngxResize]", inputs: ["ngxResizeOptions"], outputs: ["ngxResize"] }] });
2425
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtCanvas, decorators: [{
2413
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtCanvas, decorators: [{
2426
2414
  type: Component,
2427
2415
  args: [{ selector: 'ngt-canvas', standalone: true, template: `
2428
2416
  <div (ngxResize)="onResize($event)" style="height: 100%; width: 100%;">
@@ -2496,8 +2484,7 @@ function injectNgtDestroy(cb) {
2496
2484
  return { destroy$, cdr };
2497
2485
  }
2498
2486
  catch (e) {
2499
- console.warn(`[NGT] injectNgtDestroy is being called outside of Constructor Context`);
2500
- return {};
2487
+ throw new Error(`[NGT] injectNgtDestroy is being called outside of Constructor Context`);
2501
2488
  }
2502
2489
  }
2503
2490
 
@@ -2514,10 +2501,7 @@ function injectBeforeRender(cb, priority = 0) {
2514
2501
  }
2515
2502
 
2516
2503
  function injectNgtRef(initialValue = null) {
2517
- let ref = new ElementRef(initialValue);
2518
- if (is.ref(initialValue)) {
2519
- ref = initialValue;
2520
- }
2504
+ const ref = is.ref(initialValue) ? initialValue : new ElementRef(initialValue);
2521
2505
  let lastValue = ref.nativeElement;
2522
2506
  const cdRefs = [];
2523
2507
  const ref$ = new BehaviorSubject(lastValue);
@@ -2567,7 +2551,7 @@ function injectNgtRef(initialValue = null) {
2567
2551
  }
2568
2552
  // during creation phase, 'context' on ViewRef will be null
2569
2553
  // we check the "context" to avoid running detectChanges during this phase.
2570
- // becuase there's nothing to check
2554
+ // because there's nothing to check
2571
2555
  if (cd['context']) {
2572
2556
  cd.detectChanges();
2573
2557
  }
@@ -2584,9 +2568,9 @@ class NgtRepeat extends NgForOf {
2584
2568
  this.ngForOf = Number.isInteger(count) ? Array.from({ length: count }, (_, i) => i) : [];
2585
2569
  }
2586
2570
  }
2587
- NgtRepeat.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRepeat, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2588
- NgtRepeat.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.1", type: NgtRepeat, isStandalone: true, selector: "[ngFor][ngForRepeat]", inputs: { ngForRepeat: "ngForRepeat" }, usesInheritance: true, ngImport: i0 });
2589
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRepeat, decorators: [{
2571
+ NgtRepeat.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRepeat, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2572
+ NgtRepeat.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: NgtRepeat, isStandalone: true, selector: "[ngFor][ngForRepeat]", inputs: { ngForRepeat: "ngForRepeat" }, usesInheritance: true, ngImport: i0 });
2573
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRepeat, decorators: [{
2590
2574
  type: Directive,
2591
2575
  args: [{ selector: '[ngFor][ngForRepeat]', standalone: true }]
2592
2576
  }], propDecorators: { ngForRepeat: [{
@@ -2637,9 +2621,9 @@ class NgtPush {
2637
2621
  this.obj = undefined;
2638
2622
  }
2639
2623
  }
2640
- NgtPush.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPush, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2641
- NgtPush.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.1", ngImport: i0, type: NgtPush, isStandalone: true, name: "ngtPush", pure: false });
2642
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPush, decorators: [{
2624
+ NgtPush.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPush, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2625
+ NgtPush.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.2", ngImport: i0, type: NgtPush, isStandalone: true, name: "ngtPush", pure: false });
2626
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPush, decorators: [{
2643
2627
  type: Pipe,
2644
2628
  args: [{ name: 'ngtPush', pure: false, standalone: true }]
2645
2629
  }] });
@@ -2689,9 +2673,9 @@ class NgtPortalBeforeRender {
2689
2673
  this.subscription?.();
2690
2674
  }
2691
2675
  }
2692
- NgtPortalBeforeRender.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPortalBeforeRender, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2693
- NgtPortalBeforeRender.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.1", type: NgtPortalBeforeRender, isStandalone: true, selector: "ngt-portal-before-render", inputs: { renderPriority: "renderPriority", parentScene: "parentScene", parentCamera: "parentCamera" }, outputs: { beforeRender: "beforeRender" }, ngImport: i0 });
2694
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPortalBeforeRender, decorators: [{
2676
+ NgtPortalBeforeRender.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalBeforeRender, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2677
+ NgtPortalBeforeRender.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: NgtPortalBeforeRender, isStandalone: true, selector: "ngt-portal-before-render", inputs: { renderPriority: "renderPriority", parentScene: "parentScene", parentCamera: "parentCamera" }, outputs: { beforeRender: "beforeRender" }, ngImport: i0 });
2678
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalBeforeRender, decorators: [{
2695
2679
  type: Directive,
2696
2680
  args: [{
2697
2681
  selector: 'ngt-portal-before-render',
@@ -2715,9 +2699,9 @@ class NgtPortalContent {
2715
2699
  }
2716
2700
  }
2717
2701
  }
2718
- NgtPortalContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPortalContent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ViewContainerRef, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive });
2719
- NgtPortalContent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.1", type: NgtPortalContent, isStandalone: true, selector: "ng-template[ngtPortalContent]", ngImport: i0 });
2720
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPortalContent, decorators: [{
2702
+ NgtPortalContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalContent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ViewContainerRef, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive });
2703
+ NgtPortalContent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: NgtPortalContent, isStandalone: true, selector: "ng-template[ngtPortalContent]", ngImport: i0 });
2704
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalContent, decorators: [{
2721
2705
  type: Directive,
2722
2706
  args: [{ selector: 'ng-template[ngtPortalContent]', standalone: true }]
2723
2707
  }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ViewContainerRef, decorators: [{
@@ -2825,8 +2809,8 @@ _NgtPortal_instances = new WeakSet(), _NgtPortal_inject = function _NgtPortal_in
2825
2809
  ...restInputsState,
2826
2810
  };
2827
2811
  };
2828
- NgtPortal.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPortal, deps: null, target: i0.ɵɵFactoryTarget.Component });
2829
- NgtPortal.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.1", type: NgtPortal, isStandalone: true, selector: "ngt-portal", inputs: { container: "container", state: "state", autoRender: "autoRender", autoRenderPriority: "autoRenderPriority" }, outputs: { beforeRender: "beforeRender" }, providers: [NgtStore], queries: [{ propertyName: "portalContentTemplate", first: true, predicate: NgtPortalContent, descendants: true, read: TemplateRef, static: true }], viewQueries: [{ propertyName: "portalContentAnchor", first: true, predicate: ["portalContentAnchor"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: `
2812
+ NgtPortal.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortal, deps: null, target: i0.ɵɵFactoryTarget.Component });
2813
+ NgtPortal.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NgtPortal, isStandalone: true, selector: "ngt-portal", inputs: { container: "container", state: "state", autoRender: "autoRender", autoRenderPriority: "autoRenderPriority" }, outputs: { beforeRender: "beforeRender" }, providers: [NgtStore], queries: [{ propertyName: "portalContentTemplate", first: true, predicate: NgtPortalContent, descendants: true, read: TemplateRef, static: true }], viewQueries: [{ propertyName: "portalContentAnchor", first: true, predicate: ["portalContentAnchor"], descendants: true, read: ViewContainerRef, static: true }], usesInheritance: true, ngImport: i0, template: `
2830
2814
  <ng-container #portalContentAnchor>
2831
2815
  <ngt-portal-before-render
2832
2816
  *ngIf="autoRender && portalContentRendered"
@@ -2837,7 +2821,7 @@ NgtPortal.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15
2837
2821
  />
2838
2822
  </ng-container>
2839
2823
  `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgtPortalBeforeRender, selector: "ngt-portal-before-render", inputs: ["renderPriority", "parentScene", "parentCamera"], outputs: ["beforeRender"] }] });
2840
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPortal, decorators: [{
2824
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortal, decorators: [{
2841
2825
  type: Component,
2842
2826
  args: [{
2843
2827
  selector: 'ngt-portal',