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.
@@ -57,26 +57,19 @@ function injectLoader(loaderConstructorFactory, input, extensions, onProgress) {
57
57
  return urls$.pipe(map((inputs) => {
58
58
  const loaderConstructor = loaderConstructorFactory(inputs);
59
59
  const loader = new loaderConstructor();
60
- if (extensions) {
60
+ if (extensions)
61
61
  extensions(loader);
62
- }
63
62
  const urls = Array.isArray(inputs) ? inputs : typeof inputs === 'string' ? [inputs] : Object.values(inputs);
64
63
  return [
65
64
  urls.map((url) => {
66
65
  if (!cached.has(url)) {
67
66
  cached.set(url, from(loader.loadAsync(url, onProgress)).pipe(tap((data) => {
68
- if (data.scene) {
67
+ if (data.scene)
69
68
  Object.assign(data, makeObjectGraph(data.scene));
70
- }
71
69
  }), retry(2), catchError((err) => {
72
70
  console.error(`[NGT] Error loading ${url}: ${err.message}`);
73
71
  return of([]);
74
- }), share({
75
- connector: () => new ReplaySubject(1),
76
- resetOnComplete: true,
77
- resetOnError: true,
78
- resetOnRefCountZero: true,
79
- })));
72
+ }), share({ connector: () => new ReplaySubject(1) })));
80
73
  }
81
74
  return cached.get(url);
82
75
  }),
@@ -294,19 +287,16 @@ const is = {
294
287
  function checkNeedsUpdate(value) {
295
288
  if (value !== null && is.obj(value) && 'needsUpdate' in value) {
296
289
  value['needsUpdate'] = true;
297
- if ('uniformsNeedUpdate' in value) {
290
+ if ('uniformsNeedUpdate' in value)
298
291
  value['uniformsNeedUpdate'] = true;
299
- }
300
292
  }
301
293
  }
302
294
  function checkUpdate(value) {
303
- if (is.object3D(value)) {
295
+ if (is.object3D(value))
304
296
  value.updateMatrix();
305
- }
306
297
  if (is.camera(value)) {
307
- if (is.perspectiveCamera(value) || is.orthographicCamera(value)) {
298
+ if (is.perspectiveCamera(value) || is.orthographicCamera(value))
308
299
  value.updateProjectionMatrix();
309
- }
310
300
  value.updateMatrixWorld();
311
301
  }
312
302
  checkNeedsUpdate(value);
@@ -319,9 +309,8 @@ function updateCamera(camera, size) {
319
309
  camera.top = size.height / 2;
320
310
  camera.bottom = size.height / -2;
321
311
  }
322
- else {
312
+ else
323
313
  camera.aspect = size.width / size.height;
324
- }
325
314
  camera.updateProjectionMatrix();
326
315
  camera.updateMatrixWorld();
327
316
  }
@@ -413,9 +402,8 @@ function applyProps(instance, props) {
413
402
  value.constructor &&
414
403
  targetProp.constructor.name === value.constructor.name) {
415
404
  targetProp['copy'](value);
416
- if (!THREE.ColorManagement && !rootState.linear && isColor) {
405
+ if (!THREE.ColorManagement && !rootState.linear && isColor)
417
406
  targetProp['convertSRGBToLinear']();
418
- }
419
407
  }
420
408
  // if nothing else fits, just set the single value, ignore undefined
421
409
  else if (value !== undefined) {
@@ -424,17 +412,14 @@ function applyProps(instance, props) {
424
412
  if (!isColor && targetProp['setScalar'])
425
413
  targetProp['setScalar'](value);
426
414
  // layers have no copy function, copy the mask
427
- else if (targetProp instanceof THREE.Layers && value instanceof THREE.Layers) {
415
+ else if (targetProp instanceof THREE.Layers && value instanceof THREE.Layers)
428
416
  targetProp.mask = value.mask;
429
- }
430
417
  // otherwise just set ...
431
- else {
418
+ else
432
419
  targetProp['set'](value);
433
- }
434
420
  // auto-convert srgb
435
- if (!THREE.ColorManagement && !(rootState === null || rootState === void 0 ? void 0 : rootState.linear) && isColor) {
421
+ if (!THREE.ColorManagement && !(rootState === null || rootState === void 0 ? void 0 : rootState.linear) && isColor)
436
422
  targetProp.convertSRGBToLinear();
437
- }
438
423
  }
439
424
  }
440
425
  // else just overwrite the value
@@ -527,7 +512,7 @@ class NgtRxStore extends RxState {
527
512
  const originalSet = this.set.bind(this);
528
513
  Object.defineProperty(this, 'set', {
529
514
  get: () => {
530
- // Parameters type does not do well with overloads. So we use any[] here
515
+ // Parameters type does not do well with overloads (RxState#set). So we use any[] here
531
516
  return (...args) => {
532
517
  const firstArg = args[0];
533
518
  if (is.obj(firstArg)) {
@@ -537,7 +522,7 @@ class NgtRxStore extends RxState {
537
522
  }, {});
538
523
  return originalSet(modArgs);
539
524
  }
540
- // @ts-ignore
525
+ // @ts-expect-error not sure why ...args here doesn't pass tuple check
541
526
  return originalSet(...args);
542
527
  };
543
528
  },
@@ -550,9 +535,9 @@ class NgtRxStore extends RxState {
550
535
  return this.hold(obs.pipe(tapEffect(sideEffectFn)));
551
536
  }
552
537
  }
553
- NgtRxStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRxStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
554
- NgtRxStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRxStore });
555
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRxStore, decorators: [{
538
+ NgtRxStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRxStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
539
+ NgtRxStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRxStore });
540
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRxStore, decorators: [{
556
541
  type: Injectable
557
542
  }], ctorParameters: function () { return []; } });
558
543
 
@@ -593,15 +578,7 @@ class NgtStore extends NgtRxStore {
593
578
  const fov = (camera.fov * Math.PI) / 180; // convert vertical fov to radians
594
579
  const h = 2 * Math.tan(fov / 2) * distance; // visible height
595
580
  const w = h * aspect;
596
- return {
597
- width: w,
598
- height: h,
599
- top,
600
- left,
601
- factor: width / w,
602
- distance,
603
- aspect,
604
- };
581
+ return { width: w, height: h, top, left, factor: width / w, distance, aspect };
605
582
  };
606
583
  const pointer = new THREE.Vector2();
607
584
  let performanceTimeout;
@@ -774,9 +751,8 @@ class NgtStore extends NgtRxStore {
774
751
  // update projection matrix after applyprops
775
752
  camera.updateProjectionMatrix();
776
753
  }
777
- if (!is.instance(camera)) {
754
+ if (!is.instance(camera))
778
755
  camera = prepare(camera, { store: this });
779
- }
780
756
  stateToUpdate.camera = camera;
781
757
  }
782
758
  // Set up XR (one time only!)
@@ -854,9 +830,8 @@ class NgtStore extends NgtRxStore {
854
830
  applyProps(gl, glOptions);
855
831
  }
856
832
  // Store events internally
857
- if (events && !state.events.handlers) {
833
+ if (events && !state.events.handlers)
858
834
  stateToUpdate.events = events(this);
859
- }
860
835
  // Check performance
861
836
  if (performance && !is.equ(performance, state.performance, shallowLoose)) {
862
837
  stateToUpdate.performance = Object.assign(Object.assign({}, state.performance), performance);
@@ -872,9 +847,8 @@ class NgtStore extends NgtRxStore {
872
847
  // Check frameloop
873
848
  if (state.frameloop !== frameloop)
874
849
  state.setFrameloop(frameloop);
875
- if (!this.get('ready')) {
850
+ if (!this.get('ready'))
876
851
  this.set({ ready: true });
877
- }
878
852
  this.invalidate();
879
853
  }
880
854
  resize() {
@@ -905,9 +879,9 @@ class NgtStore extends NgtRxStore {
905
879
  this.hold(this.select(), () => invalidate(this));
906
880
  }
907
881
  }
908
- NgtStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtStore, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
909
- NgtStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtStore });
910
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtStore, decorators: [{
882
+ NgtStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtStore, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
883
+ NgtStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtStore });
884
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtStore, decorators: [{
911
885
  type: Injectable
912
886
  }] });
913
887
  function computeInitialSize(canvas, defaultSize) {
@@ -968,9 +942,9 @@ class NgtArgs {
968
942
  this.view.detectChanges();
969
943
  }
970
944
  }
971
- NgtArgs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtArgs, deps: [], target: i0.ɵɵFactoryTarget.Directive });
972
- NgtArgs.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.1", type: NgtArgs, isStandalone: true, selector: "[args]", inputs: { args: "args" }, ngImport: i0 });
973
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtArgs, decorators: [{
945
+ NgtArgs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtArgs, deps: [], target: i0.ɵɵFactoryTarget.Directive });
946
+ NgtArgs.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: NgtArgs, isStandalone: true, selector: "[args]", inputs: { args: "args" }, ngImport: i0 });
947
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtArgs, decorators: [{
974
948
  type: Directive,
975
949
  args: [{ selector: '[args]', standalone: true }]
976
950
  }], ctorParameters: function () { return []; }, propDecorators: { args: [{
@@ -1369,7 +1343,8 @@ function attachThreeChild(parent, child) {
1369
1343
  // whether the child is added to the parent with parent.add()
1370
1344
  let added = false;
1371
1345
  // assign store on child if not already exist
1372
- if (!cLS.store) {
1346
+ // or child store is the parent of parent store
1347
+ if (!cLS.store || cLS.store === pLS.store.get('previousStore')) {
1373
1348
  cLS.store = pLS.store;
1374
1349
  }
1375
1350
  if (cLS.attach) {
@@ -1649,7 +1624,6 @@ class NgtRendererStore {
1649
1624
  return;
1650
1625
  }
1651
1626
  if (name === SPECIAL_PROPERTIES.VALUE) {
1652
- // TODO the last time we tried this here, this didn't work
1653
1627
  // coercion
1654
1628
  let maybeCoerced = value;
1655
1629
  if (maybeCoerced === '' || maybeCoerced === 'true' || maybeCoerced === 'false') {
@@ -1848,7 +1822,12 @@ class NgtRendererStore {
1848
1822
  let i = this.portals.length - 1;
1849
1823
  while (i >= 0) {
1850
1824
  // loop through the portal state backwards to find the closest NgtStore
1851
- const injector = this.portals[i].__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */]();
1825
+ const portal = this.portals[i];
1826
+ if (portal.__ngt_renderer__[3 /* NgtRendererClassId.destroyed */]) {
1827
+ i--;
1828
+ continue;
1829
+ }
1830
+ const injector = portal.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */]();
1852
1831
  if (!injector) {
1853
1832
  i--;
1854
1833
  continue;
@@ -1872,31 +1851,47 @@ class NgtRendererFactory {
1872
1851
  this.store = inject(NgtStore);
1873
1852
  this.catalogue = inject(NGT_CATALOGUE);
1874
1853
  this.compoundPrefixes = inject(NGT_COMPOUND_PREFIXES);
1875
- this.rendererStore = new NgtRendererStore({
1876
- store: this.store,
1877
- cdr: this.cdr,
1878
- compoundPrefixes: this.compoundPrefixes,
1879
- });
1854
+ this.rendererMap = new Map();
1880
1855
  }
1881
1856
  createRenderer(hostElement, type) {
1882
- // TODO we might need to check on "type" to return DomRenderer for that particular type to support HTML
1883
- if (!this.renderer) {
1884
- const domRenderer = this.domRendererFactory.createRenderer(hostElement, type);
1885
- this.renderer = new NgtRenderer(domRenderer, this.rendererStore, this.catalogue);
1857
+ const domRenderer = this.domRendererFactory.createRenderer(hostElement, type);
1858
+ if (!type)
1859
+ return domRenderer;
1860
+ let renderer = this.rendererMap.get(type.id);
1861
+ if (renderer)
1862
+ return renderer;
1863
+ if (!hostElement) {
1864
+ const store = new NgtRendererStore({
1865
+ store: this.store,
1866
+ cdr: this.cdr,
1867
+ compoundPrefixes: this.compoundPrefixes,
1868
+ });
1869
+ renderer = new NgtRenderer(domRenderer, store, this.catalogue, true);
1870
+ this.rendererMap.set(type.id, renderer);
1871
+ }
1872
+ if (!renderer) {
1873
+ const store = new NgtRendererStore({
1874
+ store: this.store,
1875
+ cdr: this.cdr,
1876
+ compoundPrefixes: this.compoundPrefixes,
1877
+ });
1878
+ renderer = new NgtRenderer(domRenderer, store, this.catalogue);
1879
+ this.rendererMap.set(type.id, renderer);
1886
1880
  }
1887
- return this.renderer;
1881
+ return renderer;
1888
1882
  }
1889
1883
  }
1890
- NgtRendererFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRendererFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1891
- NgtRendererFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRendererFactory });
1892
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRendererFactory, decorators: [{
1884
+ NgtRendererFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRendererFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1885
+ NgtRendererFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRendererFactory });
1886
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRendererFactory, decorators: [{
1893
1887
  type: Injectable
1894
1888
  }] });
1895
1889
  class NgtRenderer {
1896
- constructor(domRenderer, store, catalogue) {
1890
+ constructor(domRenderer, store, catalogue, root = false) {
1897
1891
  this.domRenderer = domRenderer;
1898
1892
  this.store = store;
1899
1893
  this.catalogue = catalogue;
1894
+ this.root = root;
1900
1895
  this.first = false;
1901
1896
  this.createText = this.domRenderer.createText.bind(this.domRenderer);
1902
1897
  this.destroy = this.domRenderer.destroy.bind(this.domRenderer);
@@ -1913,7 +1908,7 @@ class NgtRenderer {
1913
1908
  createElement(name, namespace) {
1914
1909
  const element = this.domRenderer.createElement(name, namespace);
1915
1910
  // on first pass, we return the Root Scene as the root node
1916
- if (!this.first) {
1911
+ if (this.root && !this.first) {
1917
1912
  this.first = true;
1918
1913
  return this.store.createNode('three', this.store.rootScene);
1919
1914
  }
@@ -1975,7 +1970,7 @@ class NgtRenderer {
1975
1970
  }
1976
1971
  this.store.setParent(newChild, parent);
1977
1972
  this.store.addChild(parent, newChild);
1978
- // if new chlid is a portal
1973
+ // if new child is a portal
1979
1974
  if (newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'portal') {
1980
1975
  this.store.processPortalContainer(newChild);
1981
1976
  if (newChild.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */]) {
@@ -2036,25 +2031,23 @@ class NgtRenderer {
2036
2031
  this.store.setCompound(parent, newChild);
2037
2032
  }
2038
2033
  }
2039
- if (newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' && !getLocalState(newChild).parent) {
2034
+ const shouldFindGrandparentInstance =
2035
+ // if child is three but haven't been attached to a parent yet
2036
+ (newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' && !getLocalState(newChild).parent) ||
2037
+ // or both parent and child are DOM elements
2038
+ (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom' &&
2039
+ newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom');
2040
+ if (shouldFindGrandparentInstance) {
2040
2041
  // we'll try to get the grandparent instance here so that we can run appendChild with both instances
2041
2042
  const closestGrandparentInstance = this.store.getClosestParentWithInstance(parent);
2042
2043
  if (closestGrandparentInstance) {
2043
2044
  this.appendChild(closestGrandparentInstance, newChild);
2044
2045
  }
2045
- return;
2046
- }
2047
- if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom' &&
2048
- newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom') {
2049
- const closestGrandparentInstance = this.store.getClosestParentWithInstance(parent);
2050
- if (closestGrandparentInstance) {
2051
- this.appendChild(closestGrandparentInstance, newChild);
2052
- }
2053
2046
  }
2054
2047
  }
2055
2048
  insertBefore(parent, newChild
2056
2049
  // TODO we might need these?
2057
- // refChild: NgtRendererNode,
2050
+ // refChild: NgtRendererNode
2058
2051
  // isMove?: boolean | undefined
2059
2052
  ) {
2060
2053
  if (!parent.__ngt_renderer__)
@@ -2320,9 +2313,7 @@ class NgtCanvas extends NgtRxStore {
2320
2313
  // set rootStateMap
2321
2314
  rootStateMap.set(this.glCanvas.nativeElement, this.store);
2322
2315
  // subscribe to store to listen for ready state
2323
- this.hold(this.store.select('ready').pipe(filter((ready) => ready)), () => {
2324
- this.storeReady();
2325
- });
2316
+ this.hold(this.store.select('ready').pipe(filter((ready) => ready)), () => this.storeReady());
2326
2317
  }
2327
2318
  onResize({ width, height }) {
2328
2319
  if (width > 0 && height > 0) {
@@ -2357,9 +2348,8 @@ class NgtCanvas extends NgtRxStore {
2357
2348
  this.cdr.detectChanges();
2358
2349
  }
2359
2350
  // render
2360
- if (this.glRef) {
2351
+ if (this.glRef)
2361
2352
  this.glRef.destroy();
2362
- }
2363
2353
  requestAnimationFrame(() => {
2364
2354
  this.glEnvInjector = createEnvironmentInjector([
2365
2355
  provideNgtRenderer({
@@ -2378,12 +2368,10 @@ class NgtCanvas extends NgtRxStore {
2378
2368
  });
2379
2369
  }
2380
2370
  ngOnDestroy() {
2381
- if (this.glRef) {
2371
+ if (this.glRef)
2382
2372
  this.glRef.destroy();
2383
- }
2384
- if (this.glEnvInjector) {
2373
+ if (this.glEnvInjector)
2385
2374
  this.glEnvInjector.destroy();
2386
- }
2387
2375
  injectNgtLoader.destroy();
2388
2376
  super.ngOnDestroy();
2389
2377
  }
@@ -2396,13 +2384,13 @@ class NgtCanvas extends NgtRxStore {
2396
2384
  };
2397
2385
  }
2398
2386
  }
2399
- NgtCanvas.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtCanvas, deps: null, target: i0.ɵɵFactoryTarget.Component });
2400
- 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: `
2387
+ NgtCanvas.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtCanvas, deps: null, target: i0.ɵɵFactoryTarget.Component });
2388
+ 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: `
2401
2389
  <div (ngxResize)="onResize($event)" style="height: 100%; width: 100%;">
2402
2390
  <canvas #glCanvas style="display: block;"></canvas>
2403
2391
  </div>
2404
2392
  `, 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"] }] });
2405
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtCanvas, decorators: [{
2393
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtCanvas, decorators: [{
2406
2394
  type: Component,
2407
2395
  args: [{ selector: 'ngt-canvas', standalone: true, template: `
2408
2396
  <div (ngxResize)="onResize($event)" style="height: 100%; width: 100%;">
@@ -2476,8 +2464,7 @@ function injectNgtDestroy(cb) {
2476
2464
  return { destroy$, cdr };
2477
2465
  }
2478
2466
  catch (e) {
2479
- console.warn(`[NGT] injectNgtDestroy is being called outside of Constructor Context`);
2480
- return {};
2467
+ throw new Error(`[NGT] injectNgtDestroy is being called outside of Constructor Context`);
2481
2468
  }
2482
2469
  }
2483
2470
 
@@ -2494,10 +2481,7 @@ function injectBeforeRender(cb, priority = 0) {
2494
2481
  }
2495
2482
 
2496
2483
  function injectNgtRef(initialValue = null) {
2497
- let ref = new ElementRef(initialValue);
2498
- if (is.ref(initialValue)) {
2499
- ref = initialValue;
2500
- }
2484
+ const ref = is.ref(initialValue) ? initialValue : new ElementRef(initialValue);
2501
2485
  let lastValue = ref.nativeElement;
2502
2486
  const cdRefs = [];
2503
2487
  const ref$ = new BehaviorSubject(lastValue);
@@ -2547,7 +2531,7 @@ function injectNgtRef(initialValue = null) {
2547
2531
  }
2548
2532
  // during creation phase, 'context' on ViewRef will be null
2549
2533
  // we check the "context" to avoid running detectChanges during this phase.
2550
- // becuase there's nothing to check
2534
+ // because there's nothing to check
2551
2535
  if (cd['context']) {
2552
2536
  cd.detectChanges();
2553
2537
  }
@@ -2564,9 +2548,9 @@ class NgtRepeat extends NgForOf {
2564
2548
  this.ngForOf = Number.isInteger(count) ? Array.from({ length: count }, (_, i) => i) : [];
2565
2549
  }
2566
2550
  }
2567
- NgtRepeat.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRepeat, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2568
- 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 });
2569
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtRepeat, decorators: [{
2551
+ NgtRepeat.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRepeat, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2552
+ 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 });
2553
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtRepeat, decorators: [{
2570
2554
  type: Directive,
2571
2555
  args: [{ selector: '[ngFor][ngForRepeat]', standalone: true }]
2572
2556
  }], propDecorators: { ngForRepeat: [{
@@ -2617,9 +2601,9 @@ class NgtPush {
2617
2601
  this.obj = undefined;
2618
2602
  }
2619
2603
  }
2620
- NgtPush.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPush, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2621
- NgtPush.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.1", ngImport: i0, type: NgtPush, isStandalone: true, name: "ngtPush", pure: false });
2622
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPush, decorators: [{
2604
+ NgtPush.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPush, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2605
+ NgtPush.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.2", ngImport: i0, type: NgtPush, isStandalone: true, name: "ngtPush", pure: false });
2606
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPush, decorators: [{
2623
2607
  type: Pipe,
2624
2608
  args: [{ name: 'ngtPush', pure: false, standalone: true }]
2625
2609
  }] });
@@ -2670,9 +2654,9 @@ class NgtPortalBeforeRender {
2670
2654
  (_a = this.subscription) === null || _a === void 0 ? void 0 : _a.call(this);
2671
2655
  }
2672
2656
  }
2673
- NgtPortalBeforeRender.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPortalBeforeRender, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2674
- 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 });
2675
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPortalBeforeRender, decorators: [{
2657
+ NgtPortalBeforeRender.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalBeforeRender, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2658
+ 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 });
2659
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalBeforeRender, decorators: [{
2676
2660
  type: Directive,
2677
2661
  args: [{
2678
2662
  selector: 'ngt-portal-before-render',
@@ -2696,9 +2680,9 @@ class NgtPortalContent {
2696
2680
  }
2697
2681
  }
2698
2682
  }
2699
- 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 });
2700
- NgtPortalContent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.1", type: NgtPortalContent, isStandalone: true, selector: "ng-template[ngtPortalContent]", ngImport: i0 });
2701
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPortalContent, decorators: [{
2683
+ 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 });
2684
+ NgtPortalContent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: NgtPortalContent, isStandalone: true, selector: "ng-template[ngtPortalContent]", ngImport: i0 });
2685
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortalContent, decorators: [{
2702
2686
  type: Directive,
2703
2687
  args: [{ selector: 'ng-template[ngtPortalContent]', standalone: true }]
2704
2688
  }], ctorParameters: function () {
@@ -2785,8 +2769,8 @@ _NgtPortal_instances = new WeakSet(), _NgtPortal_inject = function _NgtPortal_in
2785
2769
  }
2786
2770
  return Object.assign(Object.assign(Object.assign({}, intersect), { scene: is.ref(inputs.container) ? inputs.container.nativeElement : inputs.container, raycaster: this.raycaster, pointer: this.pointer, previousStore: this.parentStore, events: Object.assign(Object.assign(Object.assign({}, rootState.events), ((injectState === null || injectState === void 0 ? void 0 : injectState.events) || {})), events), size: Object.assign(Object.assign({}, rootState.size), size), viewport: Object.assign(Object.assign({}, rootState.viewport), (viewport || {})) }), restInputsState);
2787
2771
  };
2788
- NgtPortal.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPortal, deps: null, target: i0.ɵɵFactoryTarget.Component });
2789
- 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: `
2772
+ NgtPortal.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortal, deps: null, target: i0.ɵɵFactoryTarget.Component });
2773
+ 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: `
2790
2774
  <ng-container #portalContentAnchor>
2791
2775
  <ngt-portal-before-render
2792
2776
  *ngIf="autoRender && portalContentRendered"
@@ -2797,7 +2781,7 @@ NgtPortal.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15
2797
2781
  />
2798
2782
  </ng-container>
2799
2783
  `, 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"] }] });
2800
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.1", ngImport: i0, type: NgtPortal, decorators: [{
2784
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtPortal, decorators: [{
2801
2785
  type: Component,
2802
2786
  args: [{
2803
2787
  selector: 'ngt-portal',