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 { DOCUMENT, NgForOf, NgIf } from '@angular/common';
7
7
  import { RxState, selectSlice } from '@rx-angular/state';
8
8
  import { __classPrivateFieldGet } from 'tslib';
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) {
@@ -1039,6 +1040,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
1039
1040
  type: Input
1040
1041
  }] } });
1041
1042
 
1043
+ class NgtParent extends NgtCommonDirective {
1044
+ constructor() {
1045
+ super(...arguments);
1046
+ this.injectedParent = null;
1047
+ }
1048
+ set parent(parent) {
1049
+ if (!parent)
1050
+ return;
1051
+ this.injected = false;
1052
+ this.injectedParent = parent;
1053
+ this.createView();
1054
+ }
1055
+ get parent() {
1056
+ if (this.validate()) {
1057
+ this.injected = true;
1058
+ return this.injectedParent;
1059
+ }
1060
+ return null;
1061
+ }
1062
+ validate() {
1063
+ return !this.injected && !!this.injectedParent;
1064
+ }
1065
+ }
1066
+ NgtParent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtParent, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1067
+ 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 });
1068
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtParent, decorators: [{
1069
+ type: Directive,
1070
+ args: [{ selector: '[parent]', standalone: true }]
1071
+ }], propDecorators: { parent: [{
1072
+ type: Input
1073
+ }] } });
1074
+
1042
1075
  function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
1043
1076
  const captureData = captures.get(obj);
1044
1077
  if (captureData) {
@@ -1463,9 +1496,9 @@ function attachThreeChild(parent, child) {
1463
1496
  if (cLS.isRaw) {
1464
1497
  cLS.parent = parent;
1465
1498
  // at this point we don't have rawValue yet, so we bail and wait until the Renderer recalls attach
1466
- if (child.__ngt_renderer__[10 /* NgtRendererClassId.rawValue */] === undefined)
1499
+ if (child.__ngt_renderer__[11 /* NgtRendererClassId.rawValue */] === undefined)
1467
1500
  return;
1468
- attach(parent, child.__ngt_renderer__[10 /* NgtRendererClassId.rawValue */], attachProp);
1501
+ attach(parent, child.__ngt_renderer__[11 /* NgtRendererClassId.rawValue */], attachProp);
1469
1502
  }
1470
1503
  else {
1471
1504
  attach(parent, child, attachProp);
@@ -1592,6 +1625,7 @@ class NgtRendererStore {
1592
1625
  const state = [
1593
1626
  type,
1594
1627
  null,
1628
+ null,
1595
1629
  [],
1596
1630
  false,
1597
1631
  undefined,
@@ -1613,7 +1647,7 @@ class NgtRendererStore {
1613
1647
  // assign injectorFactory on non-three type since
1614
1648
  // rendererNode is an instance of DOM Node
1615
1649
  if (state[0 /* NgtRendererClassId.type */] !== 'three') {
1616
- state[13 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(rendererNode).injector;
1650
+ state[14 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(rendererNode).injector;
1617
1651
  }
1618
1652
  if (state[0 /* NgtRendererClassId.type */] === 'comment') {
1619
1653
  // we attach an arrow function to the Comment node
@@ -1630,9 +1664,9 @@ class NgtRendererStore {
1630
1664
  return rendererNode;
1631
1665
  }
1632
1666
  if (state[0 /* NgtRendererClassId.type */] === 'compound') {
1633
- state[7 /* NgtRendererClassId.queueOps */] = new Set();
1634
- state[8 /* NgtRendererClassId.attributes */] = {};
1635
- state[9 /* NgtRendererClassId.properties */] = {};
1667
+ state[8 /* NgtRendererClassId.queueOps */] = new Set();
1668
+ state[9 /* NgtRendererClassId.attributes */] = {};
1669
+ state[10 /* NgtRendererClassId.properties */] = {};
1636
1670
  return rendererNode;
1637
1671
  }
1638
1672
  return rendererNode;
@@ -1643,49 +1677,49 @@ class NgtRendererStore {
1643
1677
  }
1644
1678
  }
1645
1679
  addChild(node, child) {
1646
- if (!node.__ngt_renderer__[2 /* NgtRendererClassId.children */].includes(child)) {
1647
- node.__ngt_renderer__[2 /* NgtRendererClassId.children */].push(child);
1680
+ if (!node.__ngt_renderer__[3 /* NgtRendererClassId.children */].includes(child)) {
1681
+ node.__ngt_renderer__[3 /* NgtRendererClassId.children */].push(child);
1648
1682
  }
1649
1683
  }
1650
1684
  removeChild(node, child) {
1651
- const index = node.__ngt_renderer__[2 /* NgtRendererClassId.children */].findIndex((c) => child === c);
1685
+ const index = node.__ngt_renderer__[3 /* NgtRendererClassId.children */].findIndex((c) => child === c);
1652
1686
  if (index >= 0) {
1653
- node.__ngt_renderer__[2 /* NgtRendererClassId.children */].splice(index, 1);
1687
+ node.__ngt_renderer__[3 /* NgtRendererClassId.children */].splice(index, 1);
1654
1688
  }
1655
1689
  }
1656
1690
  setCompound(compound, instance) {
1657
1691
  const rS = compound.__ngt_renderer__;
1658
- rS[6 /* NgtRendererClassId.compounded */] = instance;
1659
- const attributes = Object.keys(rS[8 /* NgtRendererClassId.attributes */]);
1660
- const properties = Object.keys(rS[9 /* NgtRendererClassId.properties */]);
1692
+ rS[7 /* NgtRendererClassId.compounded */] = instance;
1693
+ const attributes = Object.keys(rS[9 /* NgtRendererClassId.attributes */]);
1694
+ const properties = Object.keys(rS[10 /* NgtRendererClassId.properties */]);
1661
1695
  if (attributes.length) {
1662
1696
  for (const key of attributes) {
1663
- this.applyAttribute(instance, key, rS[8 /* NgtRendererClassId.attributes */][key]);
1697
+ this.applyAttribute(instance, key, rS[9 /* NgtRendererClassId.attributes */][key]);
1664
1698
  }
1665
1699
  }
1666
1700
  if (properties.length) {
1667
1701
  for (const key of properties) {
1668
- this.applyProperty(instance, key, rS[9 /* NgtRendererClassId.properties */][key]);
1702
+ this.applyProperty(instance, key, rS[10 /* NgtRendererClassId.properties */][key]);
1669
1703
  }
1670
1704
  }
1671
1705
  this.executeOperation(compound);
1672
1706
  }
1673
1707
  queueOperation(node, op) {
1674
- node.__ngt_renderer__[7 /* NgtRendererClassId.queueOps */].add(op);
1708
+ node.__ngt_renderer__[8 /* NgtRendererClassId.queueOps */].add(op);
1675
1709
  }
1676
1710
  executeOperation(node, type = 'op') {
1677
1711
  const rS = node.__ngt_renderer__;
1678
- if (rS[7 /* NgtRendererClassId.queueOps */]?.size) {
1679
- rS[7 /* NgtRendererClassId.queueOps */].forEach((op) => {
1712
+ if (rS[8 /* NgtRendererClassId.queueOps */]?.size) {
1713
+ rS[8 /* NgtRendererClassId.queueOps */].forEach((op) => {
1680
1714
  if (op[0 /* NgtQueueOpClassId.type */] === type) {
1681
1715
  op[1 /* NgtQueueOpClassId.op */]();
1682
- rS[7 /* NgtRendererClassId.queueOps */].delete(op);
1716
+ rS[8 /* NgtRendererClassId.queueOps */].delete(op);
1683
1717
  }
1684
1718
  });
1685
1719
  }
1686
1720
  }
1687
1721
  processPortalContainer(portal) {
1688
- const injectorFactory = portal.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */];
1722
+ const injectorFactory = portal.__ngt_renderer__[14 /* NgtRendererClassId.injectorFactory */];
1689
1723
  const injector = injectorFactory?.();
1690
1724
  if (!injector)
1691
1725
  return;
@@ -1695,11 +1729,11 @@ class NgtRendererStore {
1695
1729
  const portalContainer = portalStore.get('scene');
1696
1730
  if (!portalContainer)
1697
1731
  return;
1698
- portal.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */] = this.createNode('three', portalContainer);
1732
+ portal.__ngt_renderer__[13 /* NgtRendererClassId.portalContainer */] = this.createNode('three', portalContainer);
1699
1733
  }
1700
1734
  applyAttribute(node, name, value) {
1701
1735
  const rS = node.__ngt_renderer__;
1702
- if (rS[3 /* NgtRendererClassId.destroyed */])
1736
+ if (rS[4 /* NgtRendererClassId.destroyed */])
1703
1737
  return;
1704
1738
  if (name === SPECIAL_PROPERTIES.RENDER_PRIORITY) {
1705
1739
  // priority needs to be set as an attribute string so that they can be set as early as possible
@@ -1713,7 +1747,7 @@ class NgtRendererStore {
1713
1747
  }
1714
1748
  if (name === SPECIAL_PROPERTIES.COMPOUND) {
1715
1749
  // we set the compound property on instance node now so we know that this instance is being compounded
1716
- rS[4 /* NgtRendererClassId.compound */] = [value === '' || value === 'first', {}];
1750
+ rS[5 /* NgtRendererClassId.compound */] = [value === '' || value === 'first', {}];
1717
1751
  return;
1718
1752
  }
1719
1753
  if (name === SPECIAL_PROPERTIES.ATTACH) {
@@ -1732,25 +1766,25 @@ class NgtRendererStore {
1732
1766
  else if (!isNaN(Number(maybeCoerced))) {
1733
1767
  maybeCoerced = Number(maybeCoerced);
1734
1768
  }
1735
- rS[10 /* NgtRendererClassId.rawValue */] = maybeCoerced;
1769
+ rS[11 /* NgtRendererClassId.rawValue */] = maybeCoerced;
1736
1770
  return;
1737
1771
  }
1738
1772
  applyProps(node, { [name]: value });
1739
1773
  }
1740
1774
  applyProperty(node, name, value) {
1741
1775
  const rS = node.__ngt_renderer__;
1742
- if (rS[3 /* NgtRendererClassId.destroyed */])
1776
+ if (rS[4 /* NgtRendererClassId.destroyed */])
1743
1777
  return;
1744
1778
  // [ref]
1745
1779
  if (name === SPECIAL_PROPERTIES.REF && is.ref(value)) {
1746
- rS[11 /* NgtRendererClassId.ref */] = value;
1780
+ rS[12 /* NgtRendererClassId.ref */] = value;
1747
1781
  value.nativeElement = node;
1748
1782
  return;
1749
1783
  }
1750
1784
  const parent = getLocalState(node).parent || rS[1 /* NgtRendererClassId.parent */];
1751
1785
  // [rawValue]
1752
1786
  if (getLocalState(node).isRaw && name === SPECIAL_PROPERTIES.VALUE) {
1753
- rS[10 /* NgtRendererClassId.rawValue */] = value;
1787
+ rS[11 /* NgtRendererClassId.rawValue */] = value;
1754
1788
  if (parent)
1755
1789
  attachThreeChild(parent, node);
1756
1790
  return;
@@ -1762,7 +1796,7 @@ class NgtRendererStore {
1762
1796
  attachThreeChild(parent, node);
1763
1797
  return;
1764
1798
  }
1765
- const compound = rS[4 /* NgtRendererClassId.compound */];
1799
+ const compound = rS[5 /* NgtRendererClassId.compound */];
1766
1800
  if (compound?.[1 /* NgtCompoundClassId.props */] &&
1767
1801
  name in compound[1 /* NgtCompoundClassId.props */] &&
1768
1802
  !compound[0 /* NgtCompoundClassId.applyFirst */]) {
@@ -1791,51 +1825,52 @@ class NgtRendererStore {
1791
1825
  getClosestParentWithInstance(node) {
1792
1826
  let parent = node.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
1793
1827
  while (parent && parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] !== 'three') {
1794
- parent = parent.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */]
1795
- ? parent.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */]
1828
+ parent = parent.__ngt_renderer__[13 /* NgtRendererClassId.portalContainer */]
1829
+ ? parent.__ngt_renderer__[13 /* NgtRendererClassId.portalContainer */]
1796
1830
  : parent.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
1797
1831
  }
1798
1832
  return parent;
1799
1833
  }
1800
1834
  getClosestParentWithCompound(node) {
1801
- if (node.__ngt_renderer__[5 /* NgtRendererClassId.compoundParent */]) {
1802
- return node.__ngt_renderer__[5 /* NgtRendererClassId.compoundParent */];
1835
+ if (node.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */]) {
1836
+ return node.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */];
1803
1837
  }
1804
1838
  let parent = node.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
1805
1839
  if (parent &&
1806
1840
  parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'compound' &&
1807
- !parent.__ngt_renderer__[6 /* NgtRendererClassId.compounded */]) {
1841
+ !parent.__ngt_renderer__[7 /* NgtRendererClassId.compounded */]) {
1808
1842
  return parent;
1809
1843
  }
1810
1844
  while (parent &&
1811
1845
  (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' ||
1812
- !parent.__ngt_renderer__[5 /* NgtRendererClassId.compoundParent */] ||
1846
+ !parent.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */] ||
1813
1847
  parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] !== 'compound')) {
1814
1848
  parent = parent.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
1815
1849
  }
1816
1850
  if (!parent)
1817
1851
  return;
1818
1852
  if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' &&
1819
- parent.__ngt_renderer__[5 /* NgtRendererClassId.compoundParent */]) {
1820
- return parent.__ngt_renderer__[5 /* NgtRendererClassId.compoundParent */];
1853
+ parent.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */]) {
1854
+ return parent.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */];
1821
1855
  }
1822
- if (!parent.__ngt_renderer__[6 /* NgtRendererClassId.compounded */]) {
1856
+ if (!parent.__ngt_renderer__[7 /* NgtRendererClassId.compounded */]) {
1823
1857
  return parent;
1824
1858
  }
1825
1859
  return null;
1826
1860
  }
1827
1861
  getCreationState() {
1828
1862
  const injectedArgs = this.firstNonInjectedDirective(NgtArgs)?.args || [];
1863
+ const injectedParent = this.firstNonInjectedDirective(NgtParent)?.parent || null;
1829
1864
  const store = this.tryGetPortalStore();
1830
- return { injectedArgs, store };
1865
+ return { injectedArgs, injectedParent, store };
1831
1866
  }
1832
1867
  destroy(node, parent) {
1833
1868
  const rS = node.__ngt_renderer__;
1834
- if (rS[3 /* NgtRendererClassId.destroyed */])
1869
+ if (rS[4 /* NgtRendererClassId.destroyed */])
1835
1870
  return;
1836
1871
  if (rS[0 /* NgtRendererClassId.type */] === 'three') {
1837
- rS[4 /* NgtRendererClassId.compound */] = undefined;
1838
- rS[5 /* NgtRendererClassId.compoundParent */] = undefined;
1872
+ rS[5 /* NgtRendererClassId.compound */] = undefined;
1873
+ rS[6 /* NgtRendererClassId.compoundParent */] = undefined;
1839
1874
  const localState = getLocalState(node);
1840
1875
  if (localState.objects) {
1841
1876
  localState.objects.value.forEach((obj) => this.destroy(obj, parent));
@@ -1862,7 +1897,7 @@ class NgtRendererStore {
1862
1897
  }
1863
1898
  }
1864
1899
  if (rS[0 /* NgtRendererClassId.type */] === 'comment') {
1865
- rS[13 /* NgtRendererClassId.injectorFactory */] = null;
1900
+ rS[14 /* NgtRendererClassId.injectorFactory */] = null;
1866
1901
  delete node['__ngt_renderer_add_comment__'];
1867
1902
  const index = this.comments.findIndex((comment) => comment === node);
1868
1903
  if (index > -1) {
@@ -1870,35 +1905,35 @@ class NgtRendererStore {
1870
1905
  }
1871
1906
  }
1872
1907
  if (rS[0 /* NgtRendererClassId.type */] === 'portal') {
1873
- rS[13 /* NgtRendererClassId.injectorFactory */] = null;
1908
+ rS[14 /* NgtRendererClassId.injectorFactory */] = null;
1874
1909
  const index = this.portals.findIndex((portal) => portal === node);
1875
1910
  if (index > -1) {
1876
1911
  this.portals.splice(index, 1);
1877
1912
  }
1878
1913
  }
1879
1914
  if (rS[0 /* NgtRendererClassId.type */] === 'compound') {
1880
- rS[6 /* NgtRendererClassId.compounded */] = undefined;
1881
- rS[8 /* NgtRendererClassId.attributes */] = null;
1882
- rS[9 /* NgtRendererClassId.properties */] = null;
1915
+ rS[7 /* NgtRendererClassId.compounded */] = undefined;
1916
+ rS[9 /* NgtRendererClassId.attributes */] = null;
1917
+ rS[10 /* NgtRendererClassId.properties */] = null;
1883
1918
  this.executeOperation(node, 'cleanUp');
1884
- rS[7 /* NgtRendererClassId.queueOps */].clear();
1885
- rS[7 /* NgtRendererClassId.queueOps */] = null;
1919
+ rS[8 /* NgtRendererClassId.queueOps */].clear();
1920
+ rS[8 /* NgtRendererClassId.queueOps */] = null;
1886
1921
  }
1887
- if (rS[11 /* NgtRendererClassId.ref */]) {
1922
+ if (rS[12 /* NgtRendererClassId.ref */]) {
1888
1923
  // nullify ref
1889
- rS[11 /* NgtRendererClassId.ref */].nativeElement = null;
1890
- rS[11 /* NgtRendererClassId.ref */] = undefined;
1924
+ rS[12 /* NgtRendererClassId.ref */].nativeElement = null;
1925
+ rS[12 /* NgtRendererClassId.ref */] = undefined;
1891
1926
  }
1892
1927
  // nullify parent
1893
1928
  rS[1 /* NgtRendererClassId.parent */] = null;
1894
- for (const renderChild of rS[2 /* NgtRendererClassId.children */] || []) {
1929
+ for (const renderChild of rS[3 /* NgtRendererClassId.children */] || []) {
1895
1930
  if (renderChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' && parent) {
1896
1931
  removeThreeChild(parent, renderChild, true);
1897
1932
  }
1898
1933
  this.destroy(renderChild, parent);
1899
1934
  }
1900
- rS[2 /* NgtRendererClassId.children */] = [];
1901
- rS[3 /* NgtRendererClassId.destroyed */] = true;
1935
+ rS[3 /* NgtRendererClassId.children */] = [];
1936
+ rS[4 /* NgtRendererClassId.destroyed */] = true;
1902
1937
  if (parent) {
1903
1938
  this.removeChild(parent, node);
1904
1939
  }
@@ -1908,11 +1943,11 @@ class NgtRendererStore {
1908
1943
  let i = this.comments.length - 1;
1909
1944
  while (i >= 0) {
1910
1945
  const comment = this.comments[i];
1911
- if (comment.__ngt_renderer__[3 /* NgtRendererClassId.destroyed */]) {
1946
+ if (comment.__ngt_renderer__[4 /* NgtRendererClassId.destroyed */]) {
1912
1947
  i--;
1913
1948
  continue;
1914
1949
  }
1915
- const injector = comment.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */]();
1950
+ const injector = comment.__ngt_renderer__[14 /* NgtRendererClassId.injectorFactory */]();
1916
1951
  if (!injector) {
1917
1952
  i--;
1918
1953
  continue;
@@ -1933,11 +1968,11 @@ class NgtRendererStore {
1933
1968
  while (i >= 0) {
1934
1969
  // loop through the portal state backwards to find the closest NgtStore
1935
1970
  const portal = this.portals[i];
1936
- if (portal.__ngt_renderer__[3 /* NgtRendererClassId.destroyed */]) {
1971
+ if (portal.__ngt_renderer__[4 /* NgtRendererClassId.destroyed */]) {
1937
1972
  i--;
1938
1973
  continue;
1939
1974
  }
1940
- const injector = portal.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */]();
1975
+ const injector = portal.__ngt_renderer__[14 /* NgtRendererClassId.injectorFactory */]();
1941
1976
  if (!injector) {
1942
1977
  i--;
1943
1978
  continue;
@@ -2022,7 +2057,7 @@ class NgtRenderer {
2022
2057
  if (this.root) {
2023
2058
  this.root = false;
2024
2059
  const node = this.store.createNode('three', this.store.rootScene);
2025
- node.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(element).injector;
2060
+ node.__ngt_renderer__[14 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(element).injector;
2026
2061
  return node;
2027
2062
  }
2028
2063
  // handle compound
@@ -2037,7 +2072,13 @@ class NgtRenderer {
2037
2072
  if (name === SPECIAL_DOM_TAG.NGT_VALUE) {
2038
2073
  return this.store.createNode('three', Object.assign({ __ngt_renderer__: { rawValue: undefined } }, { __ngt__: { isRaw: true } }));
2039
2074
  }
2040
- const { injectedArgs, store } = this.store.getCreationState();
2075
+ const { injectedArgs, injectedParent, store } = this.store.getCreationState();
2076
+ let parent = injectedParent;
2077
+ if (typeof injectedParent === 'string') {
2078
+ parent = store
2079
+ .get('scene')
2080
+ .getObjectByName(injectedParent);
2081
+ }
2041
2082
  // handle primitive
2042
2083
  if (name === SPECIAL_DOM_TAG.NGT_PRIMITIVE) {
2043
2084
  if (!injectedArgs[0])
@@ -2050,7 +2091,11 @@ class NgtRenderer {
2050
2091
  }
2051
2092
  if (!localState.store)
2052
2093
  localState.store = store;
2053
- return this.store.createNode('three', object);
2094
+ const node = this.store.createNode('three', object);
2095
+ if (parent) {
2096
+ node.__ngt_renderer__[2 /* NgtRendererClassId.injectedParent */] = parent;
2097
+ }
2098
+ return node;
2054
2099
  }
2055
2100
  const threeTag = name.startsWith('ngt') ? name.slice(4) : name;
2056
2101
  const threeName = kebabToPascal(threeTag);
@@ -2066,6 +2111,9 @@ class NgtRenderer {
2066
2111
  else if (is.material(instance)) {
2067
2112
  localState.attach = ['material'];
2068
2113
  }
2114
+ if (parent) {
2115
+ node.__ngt_renderer__[2 /* NgtRendererClassId.injectedParent */] = parent;
2116
+ }
2069
2117
  return node;
2070
2118
  }
2071
2119
  return this.store.createNode('dom', element);
@@ -2083,21 +2131,32 @@ class NgtRenderer {
2083
2131
  this.store.setParent(newChild, parent);
2084
2132
  return;
2085
2133
  }
2134
+ if (cRS[2 /* NgtRendererClassId.injectedParent */]) {
2135
+ if (is.ref(cRS[2 /* NgtRendererClassId.injectedParent */])) {
2136
+ cRS[2 /* NgtRendererClassId.injectedParent */].$.pipe(take(1)).subscribe((val) => {
2137
+ this.appendChild(val, newChild);
2138
+ });
2139
+ }
2140
+ else {
2141
+ this.appendChild(cRS[2 /* NgtRendererClassId.injectedParent */], newChild);
2142
+ }
2143
+ return;
2144
+ }
2086
2145
  this.store.setParent(newChild, parent);
2087
2146
  this.store.addChild(parent, newChild);
2088
2147
  // if new child is a portal
2089
2148
  if (cRS[0 /* NgtRendererClassId.type */] === 'portal') {
2090
2149
  this.store.processPortalContainer(newChild);
2091
- if (cRS[12 /* NgtRendererClassId.portalContainer */]) {
2092
- this.appendChild(parent, cRS[12 /* NgtRendererClassId.portalContainer */]);
2150
+ if (cRS[13 /* NgtRendererClassId.portalContainer */]) {
2151
+ this.appendChild(parent, cRS[13 /* NgtRendererClassId.portalContainer */]);
2093
2152
  }
2094
2153
  return;
2095
2154
  }
2096
2155
  // if parent is a portal
2097
2156
  if (pRS[0 /* NgtRendererClassId.type */] === 'portal') {
2098
2157
  this.store.processPortalContainer(parent);
2099
- if (pRS[12 /* NgtRendererClassId.portalContainer */]) {
2100
- this.appendChild(pRS[12 /* NgtRendererClassId.portalContainer */], newChild);
2158
+ if (pRS[13 /* NgtRendererClassId.portalContainer */]) {
2159
+ this.appendChild(pRS[13 /* NgtRendererClassId.portalContainer */], newChild);
2101
2160
  }
2102
2161
  return;
2103
2162
  }
@@ -2109,7 +2168,7 @@ class NgtRenderer {
2109
2168
  // attach THREE child
2110
2169
  attachThreeChild(parent, newChild);
2111
2170
  // here, we handle the special case of if the parent has a compoundParent, which means this child is part of a compound parent template
2112
- if (!cRS[4 /* NgtRendererClassId.compound */])
2171
+ if (!cRS[5 /* NgtRendererClassId.compound */])
2113
2172
  return;
2114
2173
  const closestGrandparentWithCompound = this.store.getClosestParentWithCompound(parent);
2115
2174
  if (!closestGrandparentWithCompound)
@@ -2119,26 +2178,26 @@ class NgtRenderer {
2119
2178
  }
2120
2179
  // if only the parent is the THREE instance
2121
2180
  if (pRS[0 /* NgtRendererClassId.type */] === 'three') {
2122
- for (const renderChild of cRS[2 /* NgtRendererClassId.children */]) {
2181
+ for (const renderChild of cRS[3 /* NgtRendererClassId.children */]) {
2123
2182
  this.appendChild(parent, renderChild);
2124
2183
  }
2125
2184
  }
2126
2185
  // if parent is a compound
2127
2186
  if (pRS[0 /* NgtRendererClassId.type */] === 'compound') {
2128
2187
  // if compound doesn't have a THREE instance set yet
2129
- if (!pRS[6 /* NgtRendererClassId.compounded */] && cRS[0 /* NgtRendererClassId.type */] === 'three') {
2188
+ if (!pRS[7 /* NgtRendererClassId.compounded */] && cRS[0 /* NgtRendererClassId.type */] === 'three') {
2130
2189
  // if child is indeed an ngtCompound
2131
- if (cRS[4 /* NgtRendererClassId.compound */])
2190
+ if (cRS[5 /* NgtRendererClassId.compound */])
2132
2191
  this.store.setCompound(parent, newChild);
2133
2192
  // if not, we track the parent (that is supposedly the compound component) on this three instance
2134
- else if (!cRS[5 /* NgtRendererClassId.compoundParent */])
2135
- cRS[5 /* NgtRendererClassId.compoundParent */] = parent;
2193
+ else if (!cRS[6 /* NgtRendererClassId.compoundParent */])
2194
+ cRS[6 /* NgtRendererClassId.compoundParent */] = parent;
2136
2195
  }
2137
2196
  // reset the compound if it's changed
2138
- if (pRS[6 /* NgtRendererClassId.compounded */] &&
2197
+ if (pRS[7 /* NgtRendererClassId.compounded */] &&
2139
2198
  cRS[0 /* NgtRendererClassId.type */] === 'three' &&
2140
- cRS[4 /* NgtRendererClassId.compound */] &&
2141
- pRS[6 /* NgtRendererClassId.compounded */] !== newChild) {
2199
+ cRS[5 /* NgtRendererClassId.compound */] &&
2200
+ pRS[7 /* NgtRendererClassId.compounded */] !== newChild) {
2142
2201
  this.store.setCompound(parent, newChild);
2143
2202
  }
2144
2203
  }
@@ -2147,9 +2206,9 @@ class NgtRenderer {
2147
2206
  (cRS[0 /* NgtRendererClassId.type */] === 'three' && !getLocalState(newChild).parent) ||
2148
2207
  // or both parent and child are DOM elements
2149
2208
  ((pRS[0 /* NgtRendererClassId.type */] === 'dom' ||
2150
- (pRS[0 /* NgtRendererClassId.type */] === 'compound' && !pRS[6 /* NgtRendererClassId.compounded */])) &&
2209
+ (pRS[0 /* NgtRendererClassId.type */] === 'compound' && !pRS[7 /* NgtRendererClassId.compounded */])) &&
2151
2210
  (cRS[0 /* NgtRendererClassId.type */] === 'dom' ||
2152
- (cRS[0 /* NgtRendererClassId.type */] === 'compound' && !cRS[6 /* NgtRendererClassId.compounded */])));
2211
+ (cRS[0 /* NgtRendererClassId.type */] === 'compound' && !cRS[7 /* NgtRendererClassId.compounded */])));
2153
2212
  if (shouldFindGrandparentInstance) {
2154
2213
  // we'll try to get the grandparent instance here so that we can run appendChild with both instances
2155
2214
  const closestGrandparentInstance = this.store.getClosestParentWithInstance(parent);
@@ -2162,7 +2221,7 @@ class NgtRenderer {
2162
2221
  // refChild: NgtRendererNode
2163
2222
  // isMove?: boolean | undefined
2164
2223
  ) {
2165
- if (!parent.__ngt_renderer__ || parent === newChild)
2224
+ if (parent == null || !parent.__ngt_renderer__ || parent === newChild)
2166
2225
  return;
2167
2226
  this.appendChild(parent, newChild);
2168
2227
  }
@@ -2197,12 +2256,12 @@ class NgtRenderer {
2197
2256
  const rS = el.__ngt_renderer__;
2198
2257
  if (rS[0 /* NgtRendererClassId.type */] === 'compound') {
2199
2258
  // we don't have the compound instance yet
2200
- rS[8 /* NgtRendererClassId.attributes */][name] = value;
2201
- if (!rS[6 /* NgtRendererClassId.compounded */]) {
2259
+ rS[9 /* NgtRendererClassId.attributes */][name] = value;
2260
+ if (!rS[7 /* NgtRendererClassId.compounded */]) {
2202
2261
  this.store.queueOperation(el, ['op', () => this.setAttribute(el, name, value, namespace)]);
2203
2262
  return;
2204
2263
  }
2205
- this.setAttribute(rS[6 /* NgtRendererClassId.compounded */], name, value, namespace);
2264
+ this.setAttribute(rS[7 /* NgtRendererClassId.compounded */], name, value, namespace);
2206
2265
  return;
2207
2266
  }
2208
2267
  if (rS[0 /* NgtRendererClassId.type */] === 'three')
@@ -2212,20 +2271,20 @@ class NgtRenderer {
2212
2271
  const rS = el.__ngt_renderer__;
2213
2272
  if (rS[0 /* NgtRendererClassId.type */] === 'compound') {
2214
2273
  // we don't have the compound instance yet
2215
- rS[9 /* NgtRendererClassId.properties */][name] = value;
2216
- if (!rS[6 /* NgtRendererClassId.compounded */]) {
2274
+ rS[10 /* NgtRendererClassId.properties */][name] = value;
2275
+ if (!rS[7 /* NgtRendererClassId.compounded */]) {
2217
2276
  this.store.queueOperation(el, ['op', () => this.setProperty(el, name, value)]);
2218
2277
  return;
2219
2278
  }
2220
- if (rS[6 /* NgtRendererClassId.compounded */].__ngt_renderer__[4 /* NgtRendererClassId.compound */]) {
2221
- Object.assign(rS[6 /* NgtRendererClassId.compounded */].__ngt_renderer__[4 /* NgtRendererClassId.compound */], {
2279
+ if (rS[7 /* NgtRendererClassId.compounded */].__ngt_renderer__[5 /* NgtRendererClassId.compound */]) {
2280
+ Object.assign(rS[7 /* NgtRendererClassId.compounded */].__ngt_renderer__[5 /* NgtRendererClassId.compound */], {
2222
2281
  props: {
2223
- ...rS[6 /* NgtRendererClassId.compounded */].__ngt_renderer__[4 /* NgtRendererClassId.compound */],
2282
+ ...rS[7 /* NgtRendererClassId.compounded */].__ngt_renderer__[5 /* NgtRendererClassId.compound */],
2224
2283
  [name]: value,
2225
2284
  },
2226
2285
  });
2227
2286
  }
2228
- this.setProperty(rS[6 /* NgtRendererClassId.compounded */], name, value);
2287
+ this.setProperty(rS[7 /* NgtRendererClassId.compounded */], name, value);
2229
2288
  return;
2230
2289
  }
2231
2290
  if (rS[0 /* NgtRendererClassId.type */] === 'three')
@@ -2233,7 +2292,7 @@ class NgtRenderer {
2233
2292
  }
2234
2293
  listen(target, eventName, callback) {
2235
2294
  const rS = target.__ngt_renderer__;
2236
- const targetCdr = rS?.[13 /* NgtRendererClassId.injectorFactory */]?.().get(ChangeDetectorRef, null);
2295
+ const targetCdr = rS?.[14 /* NgtRendererClassId.injectorFactory */]?.().get(ChangeDetectorRef, null);
2237
2296
  // if target is DOM node, then we pass that to delegate Renderer
2238
2297
  const callbackWithCdr = (event) => {
2239
2298
  const value = callback(event);
@@ -2258,12 +2317,12 @@ class NgtRenderer {
2258
2317
  return this.delegate.listen(eventTarget, event, callbackWithCdr);
2259
2318
  }
2260
2319
  if (rS[0 /* NgtRendererClassId.type */] === 'three' ||
2261
- (rS[0 /* NgtRendererClassId.type */] === 'compound' && rS[6 /* NgtRendererClassId.compounded */])) {
2262
- const instance = rS[6 /* NgtRendererClassId.compounded */] || target;
2320
+ (rS[0 /* NgtRendererClassId.type */] === 'compound' && rS[7 /* NgtRendererClassId.compounded */])) {
2321
+ const instance = rS[7 /* NgtRendererClassId.compounded */] || target;
2263
2322
  const priority = getLocalState(target).priority;
2264
2323
  return processThreeEvent(instance, priority || 0, eventName, callback, this.store.rootCdr, targetCdr);
2265
2324
  }
2266
- if (rS[0 /* NgtRendererClassId.type */] === 'compound' && !rS[6 /* NgtRendererClassId.compounded */]) {
2325
+ if (rS[0 /* NgtRendererClassId.type */] === 'compound' && !rS[7 /* NgtRendererClassId.compounded */]) {
2267
2326
  this.store.queueOperation(target, [
2268
2327
  'op',
2269
2328
  () => this.store.queueOperation(target, ['cleanUp', this.listen(target, eventName, callback)]),
@@ -3019,9 +3078,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
3019
3078
  }] } });
3020
3079
 
3021
3080
  class NgtRoutedScene {
3081
+ constructor(router) {
3082
+ const { destroy$, cdr } = injectNgtDestroy();
3083
+ router.events
3084
+ .pipe(filter((event) => event instanceof ActivationEnd), takeUntil(destroy$))
3085
+ .subscribe(() => {
3086
+ cdr.detectChanges();
3087
+ });
3088
+ }
3022
3089
  }
3023
3090
  NgtRoutedScene.isRoutedScene = true;
3024
- NgtRoutedScene.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtRoutedScene, deps: [], target: i0.ɵɵFactoryTarget.Component });
3091
+ NgtRoutedScene.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtRoutedScene, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Component });
3025
3092
  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"] }] });
3026
3093
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtRoutedScene, decorators: [{
3027
3094
  type: Component,
@@ -3031,11 +3098,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
3031
3098
  template: `<router-outlet />`,
3032
3099
  imports: [RouterOutlet],
3033
3100
  }]
3034
- }] });
3101
+ }], ctorParameters: function () { return [{ type: i1.Router }]; } });
3035
3102
 
3036
3103
  /**
3037
3104
  * Generated bundle index. Do not edit.
3038
3105
  */
3039
3106
 
3040
- 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 };
3107
+ 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 };
3041
3108
  //# sourceMappingURL=angular-three.mjs.map