angular-three 1.8.0 → 1.9.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.
@@ -6,7 +6,8 @@ import * as THREE from 'three';
6
6
  import { __rest, __classPrivateFieldGet } from 'tslib';
7
7
  import { DOCUMENT, NgForOf, NgIf } from '@angular/common';
8
8
  import { RxState, selectSlice } from '@rx-angular/state';
9
- import { RouterOutlet } from '@angular/router';
9
+ import * as i1 from '@angular/router';
10
+ import { ActivationEnd, RouterOutlet } from '@angular/router';
10
11
 
11
12
  const idCache = {};
12
13
  function makeId(event) {
@@ -1021,6 +1022,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
1021
1022
  type: Input
1022
1023
  }] } });
1023
1024
 
1025
+ class NgtParent extends NgtCommonDirective {
1026
+ constructor() {
1027
+ super(...arguments);
1028
+ this.injectedParent = null;
1029
+ }
1030
+ set parent(parent) {
1031
+ if (!parent)
1032
+ return;
1033
+ this.injected = false;
1034
+ this.injectedParent = parent;
1035
+ this.createView();
1036
+ }
1037
+ get parent() {
1038
+ if (this.validate()) {
1039
+ this.injected = true;
1040
+ return this.injectedParent;
1041
+ }
1042
+ return null;
1043
+ }
1044
+ validate() {
1045
+ return !this.injected && !!this.injectedParent;
1046
+ }
1047
+ }
1048
+ NgtParent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtParent, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1049
+ NgtParent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.3", type: NgtParent, isStandalone: true, selector: "[parent]", inputs: { parent: "parent" }, usesInheritance: true, ngImport: i0 });
1050
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtParent, decorators: [{
1051
+ type: Directive,
1052
+ args: [{ selector: '[parent]', standalone: true }]
1053
+ }], propDecorators: { parent: [{
1054
+ type: Input
1055
+ }] } });
1056
+
1024
1057
  function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
1025
1058
  const captureData = captures.get(obj);
1026
1059
  if (captureData) {
@@ -1442,9 +1475,9 @@ function attachThreeChild(parent, child) {
1442
1475
  if (cLS.isRaw) {
1443
1476
  cLS.parent = parent;
1444
1477
  // at this point we don't have rawValue yet, so we bail and wait until the Renderer recalls attach
1445
- if (child.__ngt_renderer__[10 /* NgtRendererClassId.rawValue */] === undefined)
1478
+ if (child.__ngt_renderer__[11 /* NgtRendererClassId.rawValue */] === undefined)
1446
1479
  return;
1447
- attach(parent, child.__ngt_renderer__[10 /* NgtRendererClassId.rawValue */], attachProp);
1480
+ attach(parent, child.__ngt_renderer__[11 /* NgtRendererClassId.rawValue */], attachProp);
1448
1481
  }
1449
1482
  else {
1450
1483
  attach(parent, child, attachProp);
@@ -1570,6 +1603,7 @@ class NgtRendererStore {
1570
1603
  const state = [
1571
1604
  type,
1572
1605
  null,
1606
+ null,
1573
1607
  [],
1574
1608
  false,
1575
1609
  undefined,
@@ -1591,7 +1625,7 @@ class NgtRendererStore {
1591
1625
  // assign injectorFactory on non-three type since
1592
1626
  // rendererNode is an instance of DOM Node
1593
1627
  if (state[0 /* NgtRendererClassId.type */] !== 'three') {
1594
- state[13 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(rendererNode).injector;
1628
+ state[14 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(rendererNode).injector;
1595
1629
  }
1596
1630
  if (state[0 /* NgtRendererClassId.type */] === 'comment') {
1597
1631
  // we attach an arrow function to the Comment node
@@ -1608,9 +1642,9 @@ class NgtRendererStore {
1608
1642
  return rendererNode;
1609
1643
  }
1610
1644
  if (state[0 /* NgtRendererClassId.type */] === 'compound') {
1611
- state[7 /* NgtRendererClassId.queueOps */] = new Set();
1612
- state[8 /* NgtRendererClassId.attributes */] = {};
1613
- state[9 /* NgtRendererClassId.properties */] = {};
1645
+ state[8 /* NgtRendererClassId.queueOps */] = new Set();
1646
+ state[9 /* NgtRendererClassId.attributes */] = {};
1647
+ state[10 /* NgtRendererClassId.properties */] = {};
1614
1648
  return rendererNode;
1615
1649
  }
1616
1650
  return rendererNode;
@@ -1621,50 +1655,50 @@ class NgtRendererStore {
1621
1655
  }
1622
1656
  }
1623
1657
  addChild(node, child) {
1624
- if (!node.__ngt_renderer__[2 /* NgtRendererClassId.children */].includes(child)) {
1625
- node.__ngt_renderer__[2 /* NgtRendererClassId.children */].push(child);
1658
+ if (!node.__ngt_renderer__[3 /* NgtRendererClassId.children */].includes(child)) {
1659
+ node.__ngt_renderer__[3 /* NgtRendererClassId.children */].push(child);
1626
1660
  }
1627
1661
  }
1628
1662
  removeChild(node, child) {
1629
- const index = node.__ngt_renderer__[2 /* NgtRendererClassId.children */].findIndex((c) => child === c);
1663
+ const index = node.__ngt_renderer__[3 /* NgtRendererClassId.children */].findIndex((c) => child === c);
1630
1664
  if (index >= 0) {
1631
- node.__ngt_renderer__[2 /* NgtRendererClassId.children */].splice(index, 1);
1665
+ node.__ngt_renderer__[3 /* NgtRendererClassId.children */].splice(index, 1);
1632
1666
  }
1633
1667
  }
1634
1668
  setCompound(compound, instance) {
1635
1669
  const rS = compound.__ngt_renderer__;
1636
- rS[6 /* NgtRendererClassId.compounded */] = instance;
1637
- const attributes = Object.keys(rS[8 /* NgtRendererClassId.attributes */]);
1638
- const properties = Object.keys(rS[9 /* NgtRendererClassId.properties */]);
1670
+ rS[7 /* NgtRendererClassId.compounded */] = instance;
1671
+ const attributes = Object.keys(rS[9 /* NgtRendererClassId.attributes */]);
1672
+ const properties = Object.keys(rS[10 /* NgtRendererClassId.properties */]);
1639
1673
  if (attributes.length) {
1640
1674
  for (const key of attributes) {
1641
- this.applyAttribute(instance, key, rS[8 /* NgtRendererClassId.attributes */][key]);
1675
+ this.applyAttribute(instance, key, rS[9 /* NgtRendererClassId.attributes */][key]);
1642
1676
  }
1643
1677
  }
1644
1678
  if (properties.length) {
1645
1679
  for (const key of properties) {
1646
- this.applyProperty(instance, key, rS[9 /* NgtRendererClassId.properties */][key]);
1680
+ this.applyProperty(instance, key, rS[10 /* NgtRendererClassId.properties */][key]);
1647
1681
  }
1648
1682
  }
1649
1683
  this.executeOperation(compound);
1650
1684
  }
1651
1685
  queueOperation(node, op) {
1652
- node.__ngt_renderer__[7 /* NgtRendererClassId.queueOps */].add(op);
1686
+ node.__ngt_renderer__[8 /* NgtRendererClassId.queueOps */].add(op);
1653
1687
  }
1654
1688
  executeOperation(node, type = 'op') {
1655
1689
  var _a;
1656
1690
  const rS = node.__ngt_renderer__;
1657
- if ((_a = rS[7 /* NgtRendererClassId.queueOps */]) === null || _a === void 0 ? void 0 : _a.size) {
1658
- rS[7 /* NgtRendererClassId.queueOps */].forEach((op) => {
1691
+ if ((_a = rS[8 /* NgtRendererClassId.queueOps */]) === null || _a === void 0 ? void 0 : _a.size) {
1692
+ rS[8 /* NgtRendererClassId.queueOps */].forEach((op) => {
1659
1693
  if (op[0 /* NgtQueueOpClassId.type */] === type) {
1660
1694
  op[1 /* NgtQueueOpClassId.op */]();
1661
- rS[7 /* NgtRendererClassId.queueOps */].delete(op);
1695
+ rS[8 /* NgtRendererClassId.queueOps */].delete(op);
1662
1696
  }
1663
1697
  });
1664
1698
  }
1665
1699
  }
1666
1700
  processPortalContainer(portal) {
1667
- const injectorFactory = portal.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */];
1701
+ const injectorFactory = portal.__ngt_renderer__[14 /* NgtRendererClassId.injectorFactory */];
1668
1702
  const injector = injectorFactory === null || injectorFactory === void 0 ? void 0 : injectorFactory();
1669
1703
  if (!injector)
1670
1704
  return;
@@ -1674,11 +1708,11 @@ class NgtRendererStore {
1674
1708
  const portalContainer = portalStore.get('scene');
1675
1709
  if (!portalContainer)
1676
1710
  return;
1677
- portal.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */] = this.createNode('three', portalContainer);
1711
+ portal.__ngt_renderer__[13 /* NgtRendererClassId.portalContainer */] = this.createNode('three', portalContainer);
1678
1712
  }
1679
1713
  applyAttribute(node, name, value) {
1680
1714
  const rS = node.__ngt_renderer__;
1681
- if (rS[3 /* NgtRendererClassId.destroyed */])
1715
+ if (rS[4 /* NgtRendererClassId.destroyed */])
1682
1716
  return;
1683
1717
  if (name === SPECIAL_PROPERTIES.RENDER_PRIORITY) {
1684
1718
  // priority needs to be set as an attribute string so that they can be set as early as possible
@@ -1692,7 +1726,7 @@ class NgtRendererStore {
1692
1726
  }
1693
1727
  if (name === SPECIAL_PROPERTIES.COMPOUND) {
1694
1728
  // we set the compound property on instance node now so we know that this instance is being compounded
1695
- rS[4 /* NgtRendererClassId.compound */] = [value === '' || value === 'first', {}];
1729
+ rS[5 /* NgtRendererClassId.compound */] = [value === '' || value === 'first', {}];
1696
1730
  return;
1697
1731
  }
1698
1732
  if (name === SPECIAL_PROPERTIES.ATTACH) {
@@ -1711,25 +1745,25 @@ class NgtRendererStore {
1711
1745
  else if (!isNaN(Number(maybeCoerced))) {
1712
1746
  maybeCoerced = Number(maybeCoerced);
1713
1747
  }
1714
- rS[10 /* NgtRendererClassId.rawValue */] = maybeCoerced;
1748
+ rS[11 /* NgtRendererClassId.rawValue */] = maybeCoerced;
1715
1749
  return;
1716
1750
  }
1717
1751
  applyProps(node, { [name]: value });
1718
1752
  }
1719
1753
  applyProperty(node, name, value) {
1720
1754
  const rS = node.__ngt_renderer__;
1721
- if (rS[3 /* NgtRendererClassId.destroyed */])
1755
+ if (rS[4 /* NgtRendererClassId.destroyed */])
1722
1756
  return;
1723
1757
  // [ref]
1724
1758
  if (name === SPECIAL_PROPERTIES.REF && is.ref(value)) {
1725
- rS[11 /* NgtRendererClassId.ref */] = value;
1759
+ rS[12 /* NgtRendererClassId.ref */] = value;
1726
1760
  value.nativeElement = node;
1727
1761
  return;
1728
1762
  }
1729
1763
  const parent = getLocalState(node).parent || rS[1 /* NgtRendererClassId.parent */];
1730
1764
  // [rawValue]
1731
1765
  if (getLocalState(node).isRaw && name === SPECIAL_PROPERTIES.VALUE) {
1732
- rS[10 /* NgtRendererClassId.rawValue */] = value;
1766
+ rS[11 /* NgtRendererClassId.rawValue */] = value;
1733
1767
  if (parent)
1734
1768
  attachThreeChild(parent, node);
1735
1769
  return;
@@ -1741,7 +1775,7 @@ class NgtRendererStore {
1741
1775
  attachThreeChild(parent, node);
1742
1776
  return;
1743
1777
  }
1744
- const compound = rS[4 /* NgtRendererClassId.compound */];
1778
+ const compound = rS[5 /* NgtRendererClassId.compound */];
1745
1779
  if ((compound === null || compound === void 0 ? void 0 : compound[1 /* NgtCompoundClassId.props */]) &&
1746
1780
  name in compound[1 /* NgtCompoundClassId.props */] &&
1747
1781
  !compound[0 /* NgtCompoundClassId.applyFirst */]) {
@@ -1770,52 +1804,53 @@ class NgtRendererStore {
1770
1804
  getClosestParentWithInstance(node) {
1771
1805
  let parent = node.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
1772
1806
  while (parent && parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] !== 'three') {
1773
- parent = parent.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */]
1774
- ? parent.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */]
1807
+ parent = parent.__ngt_renderer__[13 /* NgtRendererClassId.portalContainer */]
1808
+ ? parent.__ngt_renderer__[13 /* NgtRendererClassId.portalContainer */]
1775
1809
  : parent.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
1776
1810
  }
1777
1811
  return parent;
1778
1812
  }
1779
1813
  getClosestParentWithCompound(node) {
1780
- if (node.__ngt_renderer__[5 /* NgtRendererClassId.compoundParent */]) {
1781
- return node.__ngt_renderer__[5 /* NgtRendererClassId.compoundParent */];
1814
+ if (node.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */]) {
1815
+ return node.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */];
1782
1816
  }
1783
1817
  let parent = node.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
1784
1818
  if (parent &&
1785
1819
  parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'compound' &&
1786
- !parent.__ngt_renderer__[6 /* NgtRendererClassId.compounded */]) {
1820
+ !parent.__ngt_renderer__[7 /* NgtRendererClassId.compounded */]) {
1787
1821
  return parent;
1788
1822
  }
1789
1823
  while (parent &&
1790
1824
  (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' ||
1791
- !parent.__ngt_renderer__[5 /* NgtRendererClassId.compoundParent */] ||
1825
+ !parent.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */] ||
1792
1826
  parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] !== 'compound')) {
1793
1827
  parent = parent.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
1794
1828
  }
1795
1829
  if (!parent)
1796
1830
  return;
1797
1831
  if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' &&
1798
- parent.__ngt_renderer__[5 /* NgtRendererClassId.compoundParent */]) {
1799
- return parent.__ngt_renderer__[5 /* NgtRendererClassId.compoundParent */];
1832
+ parent.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */]) {
1833
+ return parent.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */];
1800
1834
  }
1801
- if (!parent.__ngt_renderer__[6 /* NgtRendererClassId.compounded */]) {
1835
+ if (!parent.__ngt_renderer__[7 /* NgtRendererClassId.compounded */]) {
1802
1836
  return parent;
1803
1837
  }
1804
1838
  return null;
1805
1839
  }
1806
1840
  getCreationState() {
1807
- var _a;
1841
+ var _a, _b;
1808
1842
  const injectedArgs = ((_a = this.firstNonInjectedDirective(NgtArgs)) === null || _a === void 0 ? void 0 : _a.args) || [];
1843
+ const injectedParent = ((_b = this.firstNonInjectedDirective(NgtParent)) === null || _b === void 0 ? void 0 : _b.parent) || null;
1809
1844
  const store = this.tryGetPortalStore();
1810
- return { injectedArgs, store };
1845
+ return { injectedArgs, injectedParent, store };
1811
1846
  }
1812
1847
  destroy(node, parent) {
1813
1848
  const rS = node.__ngt_renderer__;
1814
- if (rS[3 /* NgtRendererClassId.destroyed */])
1849
+ if (rS[4 /* NgtRendererClassId.destroyed */])
1815
1850
  return;
1816
1851
  if (rS[0 /* NgtRendererClassId.type */] === 'three') {
1817
- rS[4 /* NgtRendererClassId.compound */] = undefined;
1818
- rS[5 /* NgtRendererClassId.compoundParent */] = undefined;
1852
+ rS[5 /* NgtRendererClassId.compound */] = undefined;
1853
+ rS[6 /* NgtRendererClassId.compoundParent */] = undefined;
1819
1854
  const localState = getLocalState(node);
1820
1855
  if (localState.objects) {
1821
1856
  localState.objects.value.forEach((obj) => this.destroy(obj, parent));
@@ -1842,7 +1877,7 @@ class NgtRendererStore {
1842
1877
  }
1843
1878
  }
1844
1879
  if (rS[0 /* NgtRendererClassId.type */] === 'comment') {
1845
- rS[13 /* NgtRendererClassId.injectorFactory */] = null;
1880
+ rS[14 /* NgtRendererClassId.injectorFactory */] = null;
1846
1881
  delete node['__ngt_renderer_add_comment__'];
1847
1882
  const index = this.comments.findIndex((comment) => comment === node);
1848
1883
  if (index > -1) {
@@ -1850,35 +1885,35 @@ class NgtRendererStore {
1850
1885
  }
1851
1886
  }
1852
1887
  if (rS[0 /* NgtRendererClassId.type */] === 'portal') {
1853
- rS[13 /* NgtRendererClassId.injectorFactory */] = null;
1888
+ rS[14 /* NgtRendererClassId.injectorFactory */] = null;
1854
1889
  const index = this.portals.findIndex((portal) => portal === node);
1855
1890
  if (index > -1) {
1856
1891
  this.portals.splice(index, 1);
1857
1892
  }
1858
1893
  }
1859
1894
  if (rS[0 /* NgtRendererClassId.type */] === 'compound') {
1860
- rS[6 /* NgtRendererClassId.compounded */] = undefined;
1861
- rS[8 /* NgtRendererClassId.attributes */] = null;
1862
- rS[9 /* NgtRendererClassId.properties */] = null;
1895
+ rS[7 /* NgtRendererClassId.compounded */] = undefined;
1896
+ rS[9 /* NgtRendererClassId.attributes */] = null;
1897
+ rS[10 /* NgtRendererClassId.properties */] = null;
1863
1898
  this.executeOperation(node, 'cleanUp');
1864
- rS[7 /* NgtRendererClassId.queueOps */].clear();
1865
- rS[7 /* NgtRendererClassId.queueOps */] = null;
1899
+ rS[8 /* NgtRendererClassId.queueOps */].clear();
1900
+ rS[8 /* NgtRendererClassId.queueOps */] = null;
1866
1901
  }
1867
- if (rS[11 /* NgtRendererClassId.ref */]) {
1902
+ if (rS[12 /* NgtRendererClassId.ref */]) {
1868
1903
  // nullify ref
1869
- rS[11 /* NgtRendererClassId.ref */].nativeElement = null;
1870
- rS[11 /* NgtRendererClassId.ref */] = undefined;
1904
+ rS[12 /* NgtRendererClassId.ref */].nativeElement = null;
1905
+ rS[12 /* NgtRendererClassId.ref */] = undefined;
1871
1906
  }
1872
1907
  // nullify parent
1873
1908
  rS[1 /* NgtRendererClassId.parent */] = null;
1874
- for (const renderChild of rS[2 /* NgtRendererClassId.children */] || []) {
1909
+ for (const renderChild of rS[3 /* NgtRendererClassId.children */] || []) {
1875
1910
  if (renderChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' && parent) {
1876
1911
  removeThreeChild(parent, renderChild, true);
1877
1912
  }
1878
1913
  this.destroy(renderChild, parent);
1879
1914
  }
1880
- rS[2 /* NgtRendererClassId.children */] = [];
1881
- rS[3 /* NgtRendererClassId.destroyed */] = true;
1915
+ rS[3 /* NgtRendererClassId.children */] = [];
1916
+ rS[4 /* NgtRendererClassId.destroyed */] = true;
1882
1917
  if (parent) {
1883
1918
  this.removeChild(parent, node);
1884
1919
  }
@@ -1888,11 +1923,11 @@ class NgtRendererStore {
1888
1923
  let i = this.comments.length - 1;
1889
1924
  while (i >= 0) {
1890
1925
  const comment = this.comments[i];
1891
- if (comment.__ngt_renderer__[3 /* NgtRendererClassId.destroyed */]) {
1926
+ if (comment.__ngt_renderer__[4 /* NgtRendererClassId.destroyed */]) {
1892
1927
  i--;
1893
1928
  continue;
1894
1929
  }
1895
- const injector = comment.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */]();
1930
+ const injector = comment.__ngt_renderer__[14 /* NgtRendererClassId.injectorFactory */]();
1896
1931
  if (!injector) {
1897
1932
  i--;
1898
1933
  continue;
@@ -1913,11 +1948,11 @@ class NgtRendererStore {
1913
1948
  while (i >= 0) {
1914
1949
  // loop through the portal state backwards to find the closest NgtStore
1915
1950
  const portal = this.portals[i];
1916
- if (portal.__ngt_renderer__[3 /* NgtRendererClassId.destroyed */]) {
1951
+ if (portal.__ngt_renderer__[4 /* NgtRendererClassId.destroyed */]) {
1917
1952
  i--;
1918
1953
  continue;
1919
1954
  }
1920
- const injector = portal.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */]();
1955
+ const injector = portal.__ngt_renderer__[14 /* NgtRendererClassId.injectorFactory */]();
1921
1956
  if (!injector) {
1922
1957
  i--;
1923
1958
  continue;
@@ -2002,7 +2037,7 @@ class NgtRenderer {
2002
2037
  if (this.root) {
2003
2038
  this.root = false;
2004
2039
  const node = this.store.createNode('three', this.store.rootScene);
2005
- node.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(element).injector;
2040
+ node.__ngt_renderer__[14 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(element).injector;
2006
2041
  return node;
2007
2042
  }
2008
2043
  // handle compound
@@ -2017,7 +2052,13 @@ class NgtRenderer {
2017
2052
  if (name === SPECIAL_DOM_TAG.NGT_VALUE) {
2018
2053
  return this.store.createNode('three', Object.assign({ __ngt_renderer__: { rawValue: undefined } }, { __ngt__: { isRaw: true } }));
2019
2054
  }
2020
- const { injectedArgs, store } = this.store.getCreationState();
2055
+ const { injectedArgs, injectedParent, store } = this.store.getCreationState();
2056
+ let parent = injectedParent;
2057
+ if (typeof injectedParent === 'string') {
2058
+ parent = store
2059
+ .get('scene')
2060
+ .getObjectByName(injectedParent);
2061
+ }
2021
2062
  // handle primitive
2022
2063
  if (name === SPECIAL_DOM_TAG.NGT_PRIMITIVE) {
2023
2064
  if (!injectedArgs[0])
@@ -2030,7 +2071,11 @@ class NgtRenderer {
2030
2071
  }
2031
2072
  if (!localState.store)
2032
2073
  localState.store = store;
2033
- return this.store.createNode('three', object);
2074
+ const node = this.store.createNode('three', object);
2075
+ if (parent) {
2076
+ node.__ngt_renderer__[2 /* NgtRendererClassId.injectedParent */] = parent;
2077
+ }
2078
+ return node;
2034
2079
  }
2035
2080
  const threeTag = name.startsWith('ngt') ? name.slice(4) : name;
2036
2081
  const threeName = kebabToPascal(threeTag);
@@ -2046,6 +2091,9 @@ class NgtRenderer {
2046
2091
  else if (is.material(instance)) {
2047
2092
  localState.attach = ['material'];
2048
2093
  }
2094
+ if (parent) {
2095
+ node.__ngt_renderer__[2 /* NgtRendererClassId.injectedParent */] = parent;
2096
+ }
2049
2097
  return node;
2050
2098
  }
2051
2099
  return this.store.createNode('dom', element);
@@ -2063,21 +2111,32 @@ class NgtRenderer {
2063
2111
  this.store.setParent(newChild, parent);
2064
2112
  return;
2065
2113
  }
2114
+ if (cRS[2 /* NgtRendererClassId.injectedParent */]) {
2115
+ if (is.ref(cRS[2 /* NgtRendererClassId.injectedParent */])) {
2116
+ cRS[2 /* NgtRendererClassId.injectedParent */].$.pipe(take(1)).subscribe((val) => {
2117
+ this.appendChild(val, newChild);
2118
+ });
2119
+ }
2120
+ else {
2121
+ this.appendChild(cRS[2 /* NgtRendererClassId.injectedParent */], newChild);
2122
+ }
2123
+ return;
2124
+ }
2066
2125
  this.store.setParent(newChild, parent);
2067
2126
  this.store.addChild(parent, newChild);
2068
2127
  // if new child is a portal
2069
2128
  if (cRS[0 /* NgtRendererClassId.type */] === 'portal') {
2070
2129
  this.store.processPortalContainer(newChild);
2071
- if (cRS[12 /* NgtRendererClassId.portalContainer */]) {
2072
- this.appendChild(parent, cRS[12 /* NgtRendererClassId.portalContainer */]);
2130
+ if (cRS[13 /* NgtRendererClassId.portalContainer */]) {
2131
+ this.appendChild(parent, cRS[13 /* NgtRendererClassId.portalContainer */]);
2073
2132
  }
2074
2133
  return;
2075
2134
  }
2076
2135
  // if parent is a portal
2077
2136
  if (pRS[0 /* NgtRendererClassId.type */] === 'portal') {
2078
2137
  this.store.processPortalContainer(parent);
2079
- if (pRS[12 /* NgtRendererClassId.portalContainer */]) {
2080
- this.appendChild(pRS[12 /* NgtRendererClassId.portalContainer */], newChild);
2138
+ if (pRS[13 /* NgtRendererClassId.portalContainer */]) {
2139
+ this.appendChild(pRS[13 /* NgtRendererClassId.portalContainer */], newChild);
2081
2140
  }
2082
2141
  return;
2083
2142
  }
@@ -2089,7 +2148,7 @@ class NgtRenderer {
2089
2148
  // attach THREE child
2090
2149
  attachThreeChild(parent, newChild);
2091
2150
  // here, we handle the special case of if the parent has a compoundParent, which means this child is part of a compound parent template
2092
- if (!cRS[4 /* NgtRendererClassId.compound */])
2151
+ if (!cRS[5 /* NgtRendererClassId.compound */])
2093
2152
  return;
2094
2153
  const closestGrandparentWithCompound = this.store.getClosestParentWithCompound(parent);
2095
2154
  if (!closestGrandparentWithCompound)
@@ -2099,26 +2158,26 @@ class NgtRenderer {
2099
2158
  }
2100
2159
  // if only the parent is the THREE instance
2101
2160
  if (pRS[0 /* NgtRendererClassId.type */] === 'three') {
2102
- for (const renderChild of cRS[2 /* NgtRendererClassId.children */]) {
2161
+ for (const renderChild of cRS[3 /* NgtRendererClassId.children */]) {
2103
2162
  this.appendChild(parent, renderChild);
2104
2163
  }
2105
2164
  }
2106
2165
  // if parent is a compound
2107
2166
  if (pRS[0 /* NgtRendererClassId.type */] === 'compound') {
2108
2167
  // if compound doesn't have a THREE instance set yet
2109
- if (!pRS[6 /* NgtRendererClassId.compounded */] && cRS[0 /* NgtRendererClassId.type */] === 'three') {
2168
+ if (!pRS[7 /* NgtRendererClassId.compounded */] && cRS[0 /* NgtRendererClassId.type */] === 'three') {
2110
2169
  // if child is indeed an ngtCompound
2111
- if (cRS[4 /* NgtRendererClassId.compound */])
2170
+ if (cRS[5 /* NgtRendererClassId.compound */])
2112
2171
  this.store.setCompound(parent, newChild);
2113
2172
  // if not, we track the parent (that is supposedly the compound component) on this three instance
2114
- else if (!cRS[5 /* NgtRendererClassId.compoundParent */])
2115
- cRS[5 /* NgtRendererClassId.compoundParent */] = parent;
2173
+ else if (!cRS[6 /* NgtRendererClassId.compoundParent */])
2174
+ cRS[6 /* NgtRendererClassId.compoundParent */] = parent;
2116
2175
  }
2117
2176
  // reset the compound if it's changed
2118
- if (pRS[6 /* NgtRendererClassId.compounded */] &&
2177
+ if (pRS[7 /* NgtRendererClassId.compounded */] &&
2119
2178
  cRS[0 /* NgtRendererClassId.type */] === 'three' &&
2120
- cRS[4 /* NgtRendererClassId.compound */] &&
2121
- pRS[6 /* NgtRendererClassId.compounded */] !== newChild) {
2179
+ cRS[5 /* NgtRendererClassId.compound */] &&
2180
+ pRS[7 /* NgtRendererClassId.compounded */] !== newChild) {
2122
2181
  this.store.setCompound(parent, newChild);
2123
2182
  }
2124
2183
  }
@@ -2127,9 +2186,9 @@ class NgtRenderer {
2127
2186
  (cRS[0 /* NgtRendererClassId.type */] === 'three' && !getLocalState(newChild).parent) ||
2128
2187
  // or both parent and child are DOM elements
2129
2188
  ((pRS[0 /* NgtRendererClassId.type */] === 'dom' ||
2130
- (pRS[0 /* NgtRendererClassId.type */] === 'compound' && !pRS[6 /* NgtRendererClassId.compounded */])) &&
2189
+ (pRS[0 /* NgtRendererClassId.type */] === 'compound' && !pRS[7 /* NgtRendererClassId.compounded */])) &&
2131
2190
  (cRS[0 /* NgtRendererClassId.type */] === 'dom' ||
2132
- (cRS[0 /* NgtRendererClassId.type */] === 'compound' && !cRS[6 /* NgtRendererClassId.compounded */])));
2191
+ (cRS[0 /* NgtRendererClassId.type */] === 'compound' && !cRS[7 /* NgtRendererClassId.compounded */])));
2133
2192
  if (shouldFindGrandparentInstance) {
2134
2193
  // we'll try to get the grandparent instance here so that we can run appendChild with both instances
2135
2194
  const closestGrandparentInstance = this.store.getClosestParentWithInstance(parent);
@@ -2142,7 +2201,7 @@ class NgtRenderer {
2142
2201
  // refChild: NgtRendererNode
2143
2202
  // isMove?: boolean | undefined
2144
2203
  ) {
2145
- if (!parent.__ngt_renderer__ || parent === newChild)
2204
+ if (parent == null || !parent.__ngt_renderer__ || parent === newChild)
2146
2205
  return;
2147
2206
  this.appendChild(parent, newChild);
2148
2207
  }
@@ -2177,12 +2236,12 @@ class NgtRenderer {
2177
2236
  const rS = el.__ngt_renderer__;
2178
2237
  if (rS[0 /* NgtRendererClassId.type */] === 'compound') {
2179
2238
  // we don't have the compound instance yet
2180
- rS[8 /* NgtRendererClassId.attributes */][name] = value;
2181
- if (!rS[6 /* NgtRendererClassId.compounded */]) {
2239
+ rS[9 /* NgtRendererClassId.attributes */][name] = value;
2240
+ if (!rS[7 /* NgtRendererClassId.compounded */]) {
2182
2241
  this.store.queueOperation(el, ['op', () => this.setAttribute(el, name, value, namespace)]);
2183
2242
  return;
2184
2243
  }
2185
- this.setAttribute(rS[6 /* NgtRendererClassId.compounded */], name, value, namespace);
2244
+ this.setAttribute(rS[7 /* NgtRendererClassId.compounded */], name, value, namespace);
2186
2245
  return;
2187
2246
  }
2188
2247
  if (rS[0 /* NgtRendererClassId.type */] === 'three')
@@ -2192,17 +2251,17 @@ class NgtRenderer {
2192
2251
  const rS = el.__ngt_renderer__;
2193
2252
  if (rS[0 /* NgtRendererClassId.type */] === 'compound') {
2194
2253
  // we don't have the compound instance yet
2195
- rS[9 /* NgtRendererClassId.properties */][name] = value;
2196
- if (!rS[6 /* NgtRendererClassId.compounded */]) {
2254
+ rS[10 /* NgtRendererClassId.properties */][name] = value;
2255
+ if (!rS[7 /* NgtRendererClassId.compounded */]) {
2197
2256
  this.store.queueOperation(el, ['op', () => this.setProperty(el, name, value)]);
2198
2257
  return;
2199
2258
  }
2200
- if (rS[6 /* NgtRendererClassId.compounded */].__ngt_renderer__[4 /* NgtRendererClassId.compound */]) {
2201
- Object.assign(rS[6 /* NgtRendererClassId.compounded */].__ngt_renderer__[4 /* NgtRendererClassId.compound */], {
2202
- props: Object.assign(Object.assign({}, rS[6 /* NgtRendererClassId.compounded */].__ngt_renderer__[4 /* NgtRendererClassId.compound */]), { [name]: value }),
2259
+ if (rS[7 /* NgtRendererClassId.compounded */].__ngt_renderer__[5 /* NgtRendererClassId.compound */]) {
2260
+ Object.assign(rS[7 /* NgtRendererClassId.compounded */].__ngt_renderer__[5 /* NgtRendererClassId.compound */], {
2261
+ props: Object.assign(Object.assign({}, rS[7 /* NgtRendererClassId.compounded */].__ngt_renderer__[5 /* NgtRendererClassId.compound */]), { [name]: value }),
2203
2262
  });
2204
2263
  }
2205
- this.setProperty(rS[6 /* NgtRendererClassId.compounded */], name, value);
2264
+ this.setProperty(rS[7 /* NgtRendererClassId.compounded */], name, value);
2206
2265
  return;
2207
2266
  }
2208
2267
  if (rS[0 /* NgtRendererClassId.type */] === 'three')
@@ -2211,7 +2270,7 @@ class NgtRenderer {
2211
2270
  listen(target, eventName, callback) {
2212
2271
  var _a;
2213
2272
  const rS = target.__ngt_renderer__;
2214
- const targetCdr = (_a = rS === null || rS === void 0 ? void 0 : rS[13 /* NgtRendererClassId.injectorFactory */]) === null || _a === void 0 ? void 0 : _a.call(rS).get(ChangeDetectorRef, null);
2273
+ const targetCdr = (_a = rS === null || rS === void 0 ? void 0 : rS[14 /* NgtRendererClassId.injectorFactory */]) === null || _a === void 0 ? void 0 : _a.call(rS).get(ChangeDetectorRef, null);
2215
2274
  // if target is DOM node, then we pass that to delegate Renderer
2216
2275
  const callbackWithCdr = (event) => {
2217
2276
  const value = callback(event);
@@ -2236,12 +2295,12 @@ class NgtRenderer {
2236
2295
  return this.delegate.listen(eventTarget, event, callbackWithCdr);
2237
2296
  }
2238
2297
  if (rS[0 /* NgtRendererClassId.type */] === 'three' ||
2239
- (rS[0 /* NgtRendererClassId.type */] === 'compound' && rS[6 /* NgtRendererClassId.compounded */])) {
2240
- const instance = rS[6 /* NgtRendererClassId.compounded */] || target;
2298
+ (rS[0 /* NgtRendererClassId.type */] === 'compound' && rS[7 /* NgtRendererClassId.compounded */])) {
2299
+ const instance = rS[7 /* NgtRendererClassId.compounded */] || target;
2241
2300
  const priority = getLocalState(target).priority;
2242
2301
  return processThreeEvent(instance, priority || 0, eventName, callback, this.store.rootCdr, targetCdr);
2243
2302
  }
2244
- if (rS[0 /* NgtRendererClassId.type */] === 'compound' && !rS[6 /* NgtRendererClassId.compounded */]) {
2303
+ if (rS[0 /* NgtRendererClassId.type */] === 'compound' && !rS[7 /* NgtRendererClassId.compounded */]) {
2245
2304
  this.store.queueOperation(target, [
2246
2305
  'op',
2247
2306
  () => this.store.queueOperation(target, ['cleanUp', this.listen(target, eventName, callback)]),
@@ -2982,9 +3041,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
2982
3041
  }] } });
2983
3042
 
2984
3043
  class NgtRoutedScene {
3044
+ constructor(router) {
3045
+ const { destroy$, cdr } = injectNgtDestroy();
3046
+ router.events
3047
+ .pipe(filter((event) => event instanceof ActivationEnd), takeUntil(destroy$))
3048
+ .subscribe(() => {
3049
+ cdr.detectChanges();
3050
+ });
3051
+ }
2985
3052
  }
2986
3053
  NgtRoutedScene.isRoutedScene = true;
2987
- NgtRoutedScene.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtRoutedScene, deps: [], target: i0.ɵɵFactoryTarget.Component });
3054
+ NgtRoutedScene.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtRoutedScene, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Component });
2988
3055
  NgtRoutedScene.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtRoutedScene, isStandalone: true, selector: "ngt-routed-scene", ngImport: i0, template: `<router-outlet />`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2989
3056
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtRoutedScene, decorators: [{
2990
3057
  type: Component,
@@ -2994,11 +3061,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
2994
3061
  template: `<router-outlet />`,
2995
3062
  imports: [RouterOutlet],
2996
3063
  }]
2997
- }] });
3064
+ }], ctorParameters: function () { return [{ type: i1.Router }]; } });
2998
3065
 
2999
3066
  /**
3000
3067
  * Generated bundle index. Do not edit.
3001
3068
  */
3002
3069
 
3003
- export { NGT_CATALOGUE, NgtArgs, NgtCanvas, NgtPortal, NgtPortalBeforeRender, NgtPortalContent, NgtPush, NgtRepeat, NgtRoutedScene, NgtRxStore, NgtStore, addAfterEffect, addEffect, addTail, applyProps, checkNeedsUpdate, checkUpdate, createAttachFunction, createLoop, createRunInContext, extend, flushGlobalEffects, getLocalState, injectBeforeRender, injectNgtDestroy, injectNgtLoader, injectNgtRef, invalidateInstance, is, makeDefaultCamera, makeDefaultRenderer, makeDpr, makeId, makeObjectGraph, prepare, rootStateMap, safeDetectChanges, startWithUndefined, tapEffect, updateCamera };
3070
+ export { NGT_CATALOGUE, NgtArgs, NgtCanvas, NgtParent, NgtPortal, NgtPortalBeforeRender, NgtPortalContent, NgtPush, NgtRepeat, NgtRoutedScene, NgtRxStore, NgtStore, addAfterEffect, addEffect, addTail, applyProps, checkNeedsUpdate, checkUpdate, createAttachFunction, createLoop, createRunInContext, extend, flushGlobalEffects, getLocalState, injectBeforeRender, injectNgtDestroy, injectNgtLoader, injectNgtRef, invalidateInstance, is, makeDefaultCamera, makeDefaultRenderer, makeDpr, makeId, makeObjectGraph, prepare, rootStateMap, safeDetectChanges, startWithUndefined, tapEffect, updateCamera };
3004
3071
  //# sourceMappingURL=angular-three.mjs.map