angular-three 1.6.11 → 1.7.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.
@@ -1556,10 +1556,15 @@ class NgtRendererStore {
1556
1556
  if (!rendererNode['ownerDocument']) {
1557
1557
  rendererNode['ownerDocument'] = this.root.document;
1558
1558
  }
1559
- if (state[0 /* NgtRendererClassId.type */] === 'comment') {
1559
+ // assign injectorFactory on non-three type since
1560
+ // rendererNode is an instance of DOM Node
1561
+ if (state[0 /* NgtRendererClassId.type */] !== 'three') {
1560
1562
  state[13 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(rendererNode).injector;
1563
+ }
1564
+ if (state[0 /* NgtRendererClassId.type */] === 'comment') {
1561
1565
  // we attach an arrow function to the Comment node
1562
1566
  // In our directives, we can call this function to then start tracking the RendererNode
1567
+ // this is done to limit the amount of Nodes we need to process for getCreationState
1563
1568
  rendererNode['__ngt_renderer_add_comment__'] = (portalNode) => {
1564
1569
  if (portalNode && portalNode.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'portal') {
1565
1570
  this.portals.push(portalNode);
@@ -1570,10 +1575,6 @@ class NgtRendererStore {
1570
1575
  };
1571
1576
  return rendererNode;
1572
1577
  }
1573
- if (state[0 /* NgtRendererClassId.type */] === 'portal') {
1574
- state[13 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(rendererNode).injector;
1575
- return rendererNode;
1576
- }
1577
1578
  if (state[0 /* NgtRendererClassId.type */] === 'compound') {
1578
1579
  state[7 /* NgtRendererClassId.queueOps */] = new Set();
1579
1580
  state[8 /* NgtRendererClassId.attributes */] = {};
@@ -1599,17 +1600,18 @@ class NgtRendererStore {
1599
1600
  }
1600
1601
  }
1601
1602
  setCompound(compound, instance) {
1602
- compound.__ngt_renderer__[6 /* NgtRendererClassId.compounded */] = instance;
1603
- const attributes = Object.keys(compound.__ngt_renderer__[8 /* NgtRendererClassId.attributes */]);
1604
- const properties = Object.keys(compound.__ngt_renderer__[9 /* NgtRendererClassId.properties */]);
1603
+ const rS = compound.__ngt_renderer__;
1604
+ rS[6 /* NgtRendererClassId.compounded */] = instance;
1605
+ const attributes = Object.keys(rS[8 /* NgtRendererClassId.attributes */]);
1606
+ const properties = Object.keys(rS[9 /* NgtRendererClassId.properties */]);
1605
1607
  if (attributes.length) {
1606
1608
  for (const key of attributes) {
1607
- this.applyAttribute(instance, key, compound.__ngt_renderer__[8 /* NgtRendererClassId.attributes */][key]);
1609
+ this.applyAttribute(instance, key, rS[8 /* NgtRendererClassId.attributes */][key]);
1608
1610
  }
1609
1611
  }
1610
1612
  if (properties.length) {
1611
1613
  for (const key of properties) {
1612
- this.applyProperty(instance, key, compound.__ngt_renderer__[9 /* NgtRendererClassId.properties */][key]);
1614
+ this.applyProperty(instance, key, rS[9 /* NgtRendererClassId.properties */][key]);
1613
1615
  }
1614
1616
  }
1615
1617
  this.executeOperation(compound);
@@ -1619,11 +1621,12 @@ class NgtRendererStore {
1619
1621
  }
1620
1622
  executeOperation(node, type = 'op') {
1621
1623
  var _a;
1622
- if ((_a = node.__ngt_renderer__[7 /* NgtRendererClassId.queueOps */]) === null || _a === void 0 ? void 0 : _a.size) {
1623
- node.__ngt_renderer__[7 /* NgtRendererClassId.queueOps */].forEach((op) => {
1624
+ const rS = node.__ngt_renderer__;
1625
+ if ((_a = rS[7 /* NgtRendererClassId.queueOps */]) === null || _a === void 0 ? void 0 : _a.size) {
1626
+ rS[7 /* NgtRendererClassId.queueOps */].forEach((op) => {
1624
1627
  if (op[0 /* NgtQueueOpClassId.type */] === type) {
1625
1628
  op[1 /* NgtQueueOpClassId.op */]();
1626
- node.__ngt_renderer__[7 /* NgtRendererClassId.queueOps */].delete(op);
1629
+ rS[7 /* NgtRendererClassId.queueOps */].delete(op);
1627
1630
  }
1628
1631
  });
1629
1632
  }
@@ -1642,7 +1645,8 @@ class NgtRendererStore {
1642
1645
  portal.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */] = this.createNode('three', portalContainer);
1643
1646
  }
1644
1647
  applyAttribute(node, name, value) {
1645
- if (node.__ngt_renderer__[3 /* NgtRendererClassId.destroyed */])
1648
+ const rS = node.__ngt_renderer__;
1649
+ if (rS[3 /* NgtRendererClassId.destroyed */])
1646
1650
  return;
1647
1651
  if (name === SPECIAL_PROPERTIES.RENDER_PRIORITY) {
1648
1652
  // priority needs to be set as an attribute string so that they can be set as early as possible
@@ -1656,7 +1660,7 @@ class NgtRendererStore {
1656
1660
  }
1657
1661
  if (name === SPECIAL_PROPERTIES.COMPOUND) {
1658
1662
  // we set the compound property on instance node now so we know that this instance is being compounded
1659
- node.__ngt_renderer__[4 /* NgtRendererClassId.compound */] = [value === '' || value === 'first', {}];
1663
+ rS[4 /* NgtRendererClassId.compound */] = [value === '' || value === 'first', {}];
1660
1664
  return;
1661
1665
  }
1662
1666
  if (name === SPECIAL_PROPERTIES.ATTACH) {
@@ -1675,24 +1679,25 @@ class NgtRendererStore {
1675
1679
  else if (!isNaN(Number(maybeCoerced))) {
1676
1680
  maybeCoerced = Number(maybeCoerced);
1677
1681
  }
1678
- node.__ngt_renderer__[10 /* NgtRendererClassId.rawValue */] = maybeCoerced;
1682
+ rS[10 /* NgtRendererClassId.rawValue */] = maybeCoerced;
1679
1683
  return;
1680
1684
  }
1681
1685
  applyProps(node, { [name]: value });
1682
1686
  }
1683
1687
  applyProperty(node, name, value) {
1684
- if (node.__ngt_renderer__[3 /* NgtRendererClassId.destroyed */])
1688
+ const rS = node.__ngt_renderer__;
1689
+ if (rS[3 /* NgtRendererClassId.destroyed */])
1685
1690
  return;
1686
1691
  // [ref]
1687
1692
  if (name === SPECIAL_PROPERTIES.REF && is.ref(value)) {
1688
- node.__ngt_renderer__[11 /* NgtRendererClassId.ref */] = value;
1693
+ rS[11 /* NgtRendererClassId.ref */] = value;
1689
1694
  value.nativeElement = node;
1690
1695
  return;
1691
1696
  }
1692
- const parent = getLocalState(node).parent || node.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
1697
+ const parent = getLocalState(node).parent || rS[1 /* NgtRendererClassId.parent */];
1693
1698
  // [rawValue]
1694
1699
  if (getLocalState(node).isRaw && name === SPECIAL_PROPERTIES.VALUE) {
1695
- node.__ngt_renderer__[10 /* NgtRendererClassId.rawValue */] = value;
1700
+ rS[10 /* NgtRendererClassId.rawValue */] = value;
1696
1701
  if (parent)
1697
1702
  attachThreeChild(parent, node);
1698
1703
  return;
@@ -1704,7 +1709,7 @@ class NgtRendererStore {
1704
1709
  attachThreeChild(parent, node);
1705
1710
  return;
1706
1711
  }
1707
- const compound = node.__ngt_renderer__[4 /* NgtRendererClassId.compound */];
1712
+ const compound = rS[4 /* NgtRendererClassId.compound */];
1708
1713
  if ((compound === null || compound === void 0 ? void 0 : compound[1 /* NgtCompoundClassId.props */]) &&
1709
1714
  name in compound[1 /* NgtCompoundClassId.props */] &&
1710
1715
  !compound[0 /* NgtCompoundClassId.applyFirst */]) {
@@ -1716,9 +1721,9 @@ class NgtRendererStore {
1716
1721
  return this.root.compoundPrefixes.some((prefix) => name.startsWith(prefix));
1717
1722
  }
1718
1723
  isDOM(node) {
1719
- const rendererNode = node['__ngt_renderer__'];
1720
- return (!rendererNode ||
1721
- (rendererNode[0 /* NgtRendererClassId.type */] !== 'compound' &&
1724
+ const rS = node['__ngt_renderer__'];
1725
+ return (!rS ||
1726
+ (rS[0 /* NgtRendererClassId.type */] !== 'compound' &&
1722
1727
  (node instanceof Element || node instanceof Document || node instanceof Window)));
1723
1728
  }
1724
1729
  get rootScene() {
@@ -1773,12 +1778,12 @@ class NgtRendererStore {
1773
1778
  return { injectedArgs, store };
1774
1779
  }
1775
1780
  destroy(node, parent) {
1776
- const state = node.__ngt_renderer__;
1777
- if (state[3 /* NgtRendererClassId.destroyed */])
1781
+ const rS = node.__ngt_renderer__;
1782
+ if (rS[3 /* NgtRendererClassId.destroyed */])
1778
1783
  return;
1779
- if (state[0 /* NgtRendererClassId.type */] === 'three') {
1780
- state[4 /* NgtRendererClassId.compound */] = undefined;
1781
- state[5 /* NgtRendererClassId.compoundParent */] = undefined;
1784
+ if (rS[0 /* NgtRendererClassId.type */] === 'three') {
1785
+ rS[4 /* NgtRendererClassId.compound */] = undefined;
1786
+ rS[5 /* NgtRendererClassId.compoundParent */] = undefined;
1782
1787
  const localState = getLocalState(node);
1783
1788
  if (localState.objects) {
1784
1789
  localState.objects.value.forEach((obj) => this.destroy(obj, parent));
@@ -1804,44 +1809,44 @@ class NgtRendererStore {
1804
1809
  delete node['__ngt__'];
1805
1810
  }
1806
1811
  }
1807
- if (state[0 /* NgtRendererClassId.type */] === 'comment') {
1808
- state[13 /* NgtRendererClassId.injectorFactory */] = null;
1812
+ if (rS[0 /* NgtRendererClassId.type */] === 'comment') {
1813
+ rS[13 /* NgtRendererClassId.injectorFactory */] = null;
1809
1814
  delete node['__ngt_renderer_add_comment__'];
1810
1815
  const index = this.comments.findIndex((comment) => comment === node);
1811
1816
  if (index > -1) {
1812
1817
  this.comments.splice(index, 1);
1813
1818
  }
1814
1819
  }
1815
- if (state[0 /* NgtRendererClassId.type */] === 'portal') {
1816
- state[13 /* NgtRendererClassId.injectorFactory */] = null;
1820
+ if (rS[0 /* NgtRendererClassId.type */] === 'portal') {
1821
+ rS[13 /* NgtRendererClassId.injectorFactory */] = null;
1817
1822
  const index = this.portals.findIndex((portal) => portal === node);
1818
1823
  if (index > -1) {
1819
1824
  this.portals.splice(index, 1);
1820
1825
  }
1821
1826
  }
1822
- if (state[0 /* NgtRendererClassId.type */] === 'compound') {
1823
- state[6 /* NgtRendererClassId.compounded */] = undefined;
1824
- state[8 /* NgtRendererClassId.attributes */] = null;
1825
- state[9 /* NgtRendererClassId.properties */] = null;
1827
+ if (rS[0 /* NgtRendererClassId.type */] === 'compound') {
1828
+ rS[6 /* NgtRendererClassId.compounded */] = undefined;
1829
+ rS[8 /* NgtRendererClassId.attributes */] = null;
1830
+ rS[9 /* NgtRendererClassId.properties */] = null;
1826
1831
  this.executeOperation(node, 'cleanUp');
1827
- state[7 /* NgtRendererClassId.queueOps */].clear();
1828
- state[7 /* NgtRendererClassId.queueOps */] = null;
1832
+ rS[7 /* NgtRendererClassId.queueOps */].clear();
1833
+ rS[7 /* NgtRendererClassId.queueOps */] = null;
1829
1834
  }
1830
- if (state[11 /* NgtRendererClassId.ref */]) {
1835
+ if (rS[11 /* NgtRendererClassId.ref */]) {
1831
1836
  // nullify ref
1832
- state[11 /* NgtRendererClassId.ref */].nativeElement = null;
1833
- state[11 /* NgtRendererClassId.ref */] = undefined;
1837
+ rS[11 /* NgtRendererClassId.ref */].nativeElement = null;
1838
+ rS[11 /* NgtRendererClassId.ref */] = undefined;
1834
1839
  }
1835
1840
  // nullify parent
1836
- state[1 /* NgtRendererClassId.parent */] = null;
1837
- for (const renderChild of state[2 /* NgtRendererClassId.children */] || []) {
1841
+ rS[1 /* NgtRendererClassId.parent */] = null;
1842
+ for (const renderChild of rS[2 /* NgtRendererClassId.children */] || []) {
1838
1843
  if (renderChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' && parent) {
1839
1844
  removeThreeChild(parent, renderChild, true);
1840
1845
  }
1841
1846
  this.destroy(renderChild, parent);
1842
1847
  }
1843
- state[2 /* NgtRendererClassId.children */] = [];
1844
- state[3 /* NgtRendererClassId.destroyed */] = true;
1848
+ rS[2 /* NgtRendererClassId.children */] = [];
1849
+ rS[3 /* NgtRendererClassId.destroyed */] = true;
1845
1850
  if (parent) {
1846
1851
  this.removeChild(parent, node);
1847
1852
  }
@@ -1923,7 +1928,7 @@ class NgtRendererFactory {
1923
1928
  compoundPrefixes: this.compoundPrefixes,
1924
1929
  document: this.document,
1925
1930
  });
1926
- renderer = new NgtRenderer(delegateRenderer, store, this.catalogue, true);
1931
+ renderer = new NgtRenderer(delegateRenderer, store, this.catalogue);
1927
1932
  this.rendererMap.set(type.id, renderer);
1928
1933
  }
1929
1934
  if (!renderer) {
@@ -1934,7 +1939,7 @@ class NgtRendererFactory {
1934
1939
  compoundPrefixes: this.compoundPrefixes,
1935
1940
  document: this.document,
1936
1941
  });
1937
- renderer = new NgtRenderer(delegateRenderer, store, this.catalogue);
1942
+ renderer = new NgtRenderer(delegateRenderer, store, this.catalogue, false);
1938
1943
  this.rendererMap.set(type.id, renderer);
1939
1944
  }
1940
1945
  return renderer;
@@ -1945,8 +1950,11 @@ NgtRendererFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", v
1945
1950
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtRendererFactory, decorators: [{
1946
1951
  type: Injectable
1947
1952
  }] });
1953
+ /**
1954
+ * Anything abbreviated with rS/RS stands for RendererState
1955
+ */
1948
1956
  class NgtRenderer {
1949
- constructor(delegate, store, catalogue, root = false) {
1957
+ constructor(delegate, store, catalogue, root = true) {
1950
1958
  this.delegate = delegate;
1951
1959
  this.store = store;
1952
1960
  this.catalogue = catalogue;
@@ -1975,9 +1983,7 @@ class NgtRenderer {
1975
1983
  }
1976
1984
  // handle compound
1977
1985
  if (this.store.isCompound(name)) {
1978
- const compound = this.store.createNode('compound', element);
1979
- compound.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(element).injector;
1980
- return compound;
1986
+ return this.store.createNode('compound', element);
1981
1987
  }
1982
1988
  // handle portal
1983
1989
  if (name === SPECIAL_DOM_TAG.NGT_PORTAL) {
@@ -2018,50 +2024,48 @@ class NgtRenderer {
2018
2024
  }
2019
2025
  return node;
2020
2026
  }
2021
- const domNode = this.store.createNode('dom', element);
2022
- domNode.__ngt_renderer__[13 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(element).injector;
2023
- return domNode;
2027
+ return this.store.createNode('dom', element);
2024
2028
  }
2025
2029
  createComment(value) {
2026
- const comment = this.delegate.createComment(value);
2027
- return this.store.createNode('comment', comment);
2030
+ return this.store.createNode('comment', this.delegate.createComment(value));
2028
2031
  }
2029
2032
  appendChild(parent, newChild) {
2030
2033
  // TODO: just ignore text node for now
2031
2034
  if (newChild instanceof Text)
2032
2035
  return;
2033
- if (newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'comment') {
2036
+ const cRS = newChild.__ngt_renderer__;
2037
+ const pRS = parent.__ngt_renderer__;
2038
+ if (cRS[0 /* NgtRendererClassId.type */] === 'comment') {
2034
2039
  this.store.setParent(newChild, parent);
2035
2040
  return;
2036
2041
  }
2037
2042
  this.store.setParent(newChild, parent);
2038
2043
  this.store.addChild(parent, newChild);
2039
2044
  // if new child is a portal
2040
- if (newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'portal') {
2045
+ if (cRS[0 /* NgtRendererClassId.type */] === 'portal') {
2041
2046
  this.store.processPortalContainer(newChild);
2042
- if (newChild.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */]) {
2043
- this.appendChild(parent, newChild.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */]);
2047
+ if (cRS[12 /* NgtRendererClassId.portalContainer */]) {
2048
+ this.appendChild(parent, cRS[12 /* NgtRendererClassId.portalContainer */]);
2044
2049
  }
2045
2050
  return;
2046
2051
  }
2047
2052
  // if parent is a portal
2048
- if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'portal') {
2053
+ if (pRS[0 /* NgtRendererClassId.type */] === 'portal') {
2049
2054
  this.store.processPortalContainer(parent);
2050
- if (parent.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */]) {
2051
- this.appendChild(parent.__ngt_renderer__[12 /* NgtRendererClassId.portalContainer */], newChild);
2055
+ if (pRS[12 /* NgtRendererClassId.portalContainer */]) {
2056
+ this.appendChild(pRS[12 /* NgtRendererClassId.portalContainer */], newChild);
2052
2057
  }
2053
2058
  return;
2054
2059
  }
2055
2060
  // if both are three instances, straightforward case
2056
- if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' &&
2057
- newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three') {
2061
+ if (pRS[0 /* NgtRendererClassId.type */] === 'three' && cRS[0 /* NgtRendererClassId.type */] === 'three') {
2058
2062
  // if child already attached to a parent, skip
2059
2063
  if (getLocalState(newChild).parent)
2060
2064
  return;
2061
2065
  // attach THREE child
2062
2066
  attachThreeChild(parent, newChild);
2063
2067
  // here, we handle the special case of if the parent has a compoundParent, which means this child is part of a compound parent template
2064
- if (!newChild.__ngt_renderer__[4 /* NgtRendererClassId.compound */])
2068
+ if (!cRS[4 /* NgtRendererClassId.compound */])
2065
2069
  return;
2066
2070
  const closestGrandparentWithCompound = this.store.getClosestParentWithCompound(parent);
2067
2071
  if (!closestGrandparentWithCompound)
@@ -2070,53 +2074,43 @@ class NgtRenderer {
2070
2074
  return;
2071
2075
  }
2072
2076
  // if only the parent is the THREE instance
2073
- if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three') {
2074
- if (newChild.__ngt_renderer__[2 /* NgtRendererClassId.children */].length) {
2075
- for (const renderChild of newChild.__ngt_renderer__[2 /* NgtRendererClassId.children */]) {
2076
- this.appendChild(parent, renderChild);
2077
- }
2077
+ if (pRS[0 /* NgtRendererClassId.type */] === 'three') {
2078
+ for (const renderChild of cRS[2 /* NgtRendererClassId.children */]) {
2079
+ this.appendChild(parent, renderChild);
2078
2080
  }
2079
2081
  }
2080
2082
  // if parent is a compound
2081
- if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'compound') {
2083
+ if (pRS[0 /* NgtRendererClassId.type */] === 'compound') {
2082
2084
  // if compound doesn't have a THREE instance set yet
2083
- if (!parent.__ngt_renderer__[6 /* NgtRendererClassId.compounded */] &&
2084
- newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three') {
2085
+ if (!pRS[6 /* NgtRendererClassId.compounded */] && cRS[0 /* NgtRendererClassId.type */] === 'three') {
2085
2086
  // if child is indeed an ngtCompound
2086
- if (newChild.__ngt_renderer__[4 /* NgtRendererClassId.compound */]) {
2087
+ if (cRS[4 /* NgtRendererClassId.compound */])
2087
2088
  this.store.setCompound(parent, newChild);
2088
- }
2089
- else {
2090
- // if not, we track the parent (that is supposedly the compound component) on this three instance
2091
- if (!newChild.__ngt_renderer__[5 /* NgtRendererClassId.compoundParent */]) {
2092
- newChild.__ngt_renderer__[5 /* NgtRendererClassId.compoundParent */] = parent;
2093
- }
2094
- }
2089
+ // if not, we track the parent (that is supposedly the compound component) on this three instance
2090
+ else if (!cRS[5 /* NgtRendererClassId.compoundParent */])
2091
+ cRS[5 /* NgtRendererClassId.compoundParent */] = parent;
2095
2092
  }
2096
2093
  // reset the compound if it's changed
2097
- if (parent.__ngt_renderer__[6 /* NgtRendererClassId.compounded */] &&
2098
- newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' &&
2099
- newChild.__ngt_renderer__[4 /* NgtRendererClassId.compound */] &&
2100
- parent.__ngt_renderer__[6 /* NgtRendererClassId.compounded */] !== newChild) {
2094
+ if (pRS[6 /* NgtRendererClassId.compounded */] &&
2095
+ cRS[0 /* NgtRendererClassId.type */] === 'three' &&
2096
+ cRS[4 /* NgtRendererClassId.compound */] &&
2097
+ pRS[6 /* NgtRendererClassId.compounded */] !== newChild) {
2101
2098
  this.store.setCompound(parent, newChild);
2102
2099
  }
2103
2100
  }
2104
2101
  const shouldFindGrandparentInstance =
2105
2102
  // if child is three but haven't been attached to a parent yet
2106
- (newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' && !getLocalState(newChild).parent) ||
2103
+ (cRS[0 /* NgtRendererClassId.type */] === 'three' && !getLocalState(newChild).parent) ||
2107
2104
  // or both parent and child are DOM elements
2108
- ((parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom' ||
2109
- (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'compound' &&
2110
- !parent.__ngt_renderer__[6 /* NgtRendererClassId.compounded */])) &&
2111
- (newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'dom' ||
2112
- (newChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'compound' &&
2113
- !newChild.__ngt_renderer__[6 /* NgtRendererClassId.compounded */])));
2105
+ ((pRS[0 /* NgtRendererClassId.type */] === 'dom' ||
2106
+ (pRS[0 /* NgtRendererClassId.type */] === 'compound' && !pRS[6 /* NgtRendererClassId.compounded */])) &&
2107
+ (cRS[0 /* NgtRendererClassId.type */] === 'dom' ||
2108
+ (cRS[0 /* NgtRendererClassId.type */] === 'compound' && !cRS[6 /* NgtRendererClassId.compounded */])));
2114
2109
  if (shouldFindGrandparentInstance) {
2115
2110
  // we'll try to get the grandparent instance here so that we can run appendChild with both instances
2116
2111
  const closestGrandparentInstance = this.store.getClosestParentWithInstance(parent);
2117
- if (closestGrandparentInstance) {
2112
+ if (closestGrandparentInstance)
2118
2113
  this.appendChild(closestGrandparentInstance, newChild);
2119
- }
2120
2114
  }
2121
2115
  }
2122
2116
  insertBefore(parent, newChild
@@ -2129,71 +2123,71 @@ class NgtRenderer {
2129
2123
  this.appendChild(parent, newChild);
2130
2124
  }
2131
2125
  removeChild(parent, oldChild, isHostElement) {
2132
- if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' &&
2133
- oldChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three') {
2126
+ const pRS = parent.__ngt_renderer__;
2127
+ const cRS = oldChild.__ngt_renderer__;
2128
+ if (pRS[0 /* NgtRendererClassId.type */] === 'three' && cRS[0 /* NgtRendererClassId.type */] === 'three') {
2134
2129
  removeThreeChild(parent, oldChild, true);
2135
2130
  this.store.destroy(oldChild, parent);
2136
2131
  return;
2137
2132
  }
2138
- if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'compound' &&
2139
- parent.__ngt_renderer__[1 /* NgtRendererClassId.parent */]) {
2140
- this.removeChild(parent.__ngt_renderer__[1 /* NgtRendererClassId.parent */], oldChild, isHostElement);
2133
+ if (pRS[0 /* NgtRendererClassId.type */] === 'compound' && pRS[1 /* NgtRendererClassId.parent */]) {
2134
+ this.removeChild(pRS[1 /* NgtRendererClassId.parent */], oldChild, isHostElement);
2141
2135
  return;
2142
2136
  }
2143
- if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three') {
2137
+ if (pRS[0 /* NgtRendererClassId.type */] === 'three') {
2144
2138
  this.store.destroy(oldChild, parent);
2145
2139
  return;
2146
2140
  }
2147
2141
  const closestGrandparentInstance = this.store.getClosestParentWithInstance(parent);
2148
- if (closestGrandparentInstance) {
2142
+ if (closestGrandparentInstance)
2149
2143
  this.removeChild(closestGrandparentInstance, oldChild, isHostElement);
2150
- }
2151
2144
  this.store.destroy(oldChild, closestGrandparentInstance);
2152
2145
  }
2153
2146
  parentNode(node) {
2154
- var _a;
2155
- if ((_a = node.__ngt_renderer__) === null || _a === void 0 ? void 0 : _a[1 /* NgtRendererClassId.parent */])
2156
- return node.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
2147
+ const rS = node.__ngt_renderer__;
2148
+ if (rS === null || rS === void 0 ? void 0 : rS[1 /* NgtRendererClassId.parent */])
2149
+ return rS[1 /* NgtRendererClassId.parent */];
2157
2150
  return this.delegate.parentNode(node);
2158
2151
  }
2159
2152
  setAttribute(el, name, value, namespace) {
2160
- if (el.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'compound') {
2153
+ const rS = el.__ngt_renderer__;
2154
+ if (rS[0 /* NgtRendererClassId.type */] === 'compound') {
2161
2155
  // we don't have the compound instance yet
2162
- el.__ngt_renderer__[8 /* NgtRendererClassId.attributes */][name] = value;
2163
- if (!el.__ngt_renderer__[6 /* NgtRendererClassId.compounded */]) {
2156
+ rS[8 /* NgtRendererClassId.attributes */][name] = value;
2157
+ if (!rS[6 /* NgtRendererClassId.compounded */]) {
2164
2158
  this.store.queueOperation(el, ['op', () => this.setAttribute(el, name, value, namespace)]);
2165
2159
  return;
2166
2160
  }
2167
- this.setAttribute(el.__ngt_renderer__[6 /* NgtRendererClassId.compounded */], name, value, namespace);
2161
+ this.setAttribute(rS[6 /* NgtRendererClassId.compounded */], name, value, namespace);
2168
2162
  return;
2169
2163
  }
2170
- if (el.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three') {
2164
+ if (rS[0 /* NgtRendererClassId.type */] === 'three')
2171
2165
  this.store.applyAttribute(el, name, value);
2172
- }
2173
2166
  }
2174
2167
  setProperty(el, name, value) {
2175
- if (el.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'compound') {
2168
+ const rS = el.__ngt_renderer__;
2169
+ if (rS[0 /* NgtRendererClassId.type */] === 'compound') {
2176
2170
  // we don't have the compound instance yet
2177
- el.__ngt_renderer__[9 /* NgtRendererClassId.properties */][name] = value;
2178
- if (!el.__ngt_renderer__[6 /* NgtRendererClassId.compounded */]) {
2171
+ rS[9 /* NgtRendererClassId.properties */][name] = value;
2172
+ if (!rS[6 /* NgtRendererClassId.compounded */]) {
2179
2173
  this.store.queueOperation(el, ['op', () => this.setProperty(el, name, value)]);
2180
2174
  return;
2181
2175
  }
2182
- if (el.__ngt_renderer__[6 /* NgtRendererClassId.compounded */].__ngt_renderer__[4 /* NgtRendererClassId.compound */]) {
2183
- Object.assign(el.__ngt_renderer__[6 /* NgtRendererClassId.compounded */].__ngt_renderer__[4 /* NgtRendererClassId.compound */], {
2184
- props: Object.assign(Object.assign({}, el.__ngt_renderer__[6 /* NgtRendererClassId.compounded */].__ngt_renderer__[4 /* NgtRendererClassId.compound */]), { [name]: value }),
2176
+ if (rS[6 /* NgtRendererClassId.compounded */].__ngt_renderer__[4 /* NgtRendererClassId.compound */]) {
2177
+ Object.assign(rS[6 /* NgtRendererClassId.compounded */].__ngt_renderer__[4 /* NgtRendererClassId.compound */], {
2178
+ props: Object.assign(Object.assign({}, rS[6 /* NgtRendererClassId.compounded */].__ngt_renderer__[4 /* NgtRendererClassId.compound */]), { [name]: value }),
2185
2179
  });
2186
2180
  }
2187
- this.setProperty(el.__ngt_renderer__[6 /* NgtRendererClassId.compounded */], name, value);
2181
+ this.setProperty(rS[6 /* NgtRendererClassId.compounded */], name, value);
2188
2182
  return;
2189
2183
  }
2190
- if (el.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three') {
2184
+ if (rS[0 /* NgtRendererClassId.type */] === 'three')
2191
2185
  this.store.applyProperty(el, name, value);
2192
- }
2193
2186
  }
2194
2187
  listen(target, eventName, callback) {
2195
- var _a, _b;
2196
- const targetCdr = (_b = (_a = target.__ngt_renderer__) === null || _a === void 0 ? void 0 : _a[13 /* NgtRendererClassId.injectorFactory */]) === null || _b === void 0 ? void 0 : _b.call(_a).get(ChangeDetectorRef, null);
2188
+ var _a;
2189
+ const rS = target.__ngt_renderer__;
2190
+ 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);
2197
2191
  // if target is DOM node, then we pass that to delegate Renderer
2198
2192
  const callbackWithCdr = (event) => {
2199
2193
  const value = callback(event);
@@ -2217,15 +2211,13 @@ class NgtRenderer {
2217
2211
  : target['ownerDocument'];
2218
2212
  return this.delegate.listen(eventTarget, event, callbackWithCdr);
2219
2213
  }
2220
- if (target.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' ||
2221
- (target.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'compound' &&
2222
- target.__ngt_renderer__[6 /* NgtRendererClassId.compounded */])) {
2223
- const instance = target.__ngt_renderer__[6 /* NgtRendererClassId.compounded */] || target;
2214
+ if (rS[0 /* NgtRendererClassId.type */] === 'three' ||
2215
+ (rS[0 /* NgtRendererClassId.type */] === 'compound' && rS[6 /* NgtRendererClassId.compounded */])) {
2216
+ const instance = rS[6 /* NgtRendererClassId.compounded */] || target;
2224
2217
  const priority = getLocalState(target).priority;
2225
2218
  return processThreeEvent(instance, priority || 0, eventName, callback, this.store.rootCdr, targetCdr);
2226
2219
  }
2227
- if (target.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'compound' &&
2228
- !target.__ngt_renderer__[6 /* NgtRendererClassId.compounded */]) {
2220
+ if (rS[0 /* NgtRendererClassId.type */] === 'compound' && !rS[6 /* NgtRendererClassId.compounded */]) {
2229
2221
  this.store.queueOperation(target, [
2230
2222
  'op',
2231
2223
  () => this.store.queueOperation(target, ['cleanUp', this.listen(target, eventName, callback)]),
@@ -2330,6 +2322,7 @@ class NgtCanvas extends NgtRxStore {
2330
2322
  this.host = inject(ElementRef);
2331
2323
  this.store = inject(NgtStore);
2332
2324
  this.hostClass = true;
2325
+ this.sceneGraphInputs = {};
2333
2326
  this.compoundPrefixes = [];
2334
2327
  this.created = new EventEmitter();
2335
2328
  this.pointerMissed = new EventEmitter();
@@ -2394,6 +2387,11 @@ class NgtCanvas extends NgtRxStore {
2394
2387
  set performance(performance) {
2395
2388
  this.set({ performance });
2396
2389
  }
2390
+ ngOnChanges(changes) {
2391
+ if (changes['sceneGraphInputs'] && this.glRef) {
2392
+ this.setSceneGraphInputs();
2393
+ }
2394
+ }
2397
2395
  ngOnInit() {
2398
2396
  if (!this.get('eventSource')) {
2399
2397
  // set default event source to the host element
@@ -2461,6 +2459,7 @@ class NgtCanvas extends NgtRxStore {
2461
2459
  environmentInjector: this.glEnvInjector,
2462
2460
  });
2463
2461
  this.glRef.changeDetectorRef.detach();
2462
+ this.setSceneGraphInputs();
2464
2463
  // here, we override the detectChanges to also call detectChanges on the ComponentRef
2465
2464
  this.overrideDetectChanges();
2466
2465
  this.cdr.detectChanges();
@@ -2482,9 +2481,16 @@ class NgtCanvas extends NgtRxStore {
2482
2481
  (_a = this.glRef) === null || _a === void 0 ? void 0 : _a.changeDetectorRef.detectChanges();
2483
2482
  };
2484
2483
  }
2484
+ setSceneGraphInputs() {
2485
+ var _a;
2486
+ for (const key of Object.keys(this.sceneGraphInputs)) {
2487
+ (_a = this.glRef) === null || _a === void 0 ? void 0 : _a.setInput(key, this.sceneGraphInputs[key]);
2488
+ }
2489
+ this.cdr.detectChanges();
2490
+ }
2485
2491
  }
2486
2492
  NgtCanvas.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtCanvas, deps: null, target: i0.ɵɵFactoryTarget.Component });
2487
- NgtCanvas.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", 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: `
2493
+ NgtCanvas.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: NgtCanvas, isStandalone: true, selector: "ngt-canvas", inputs: { sceneGraph: "sceneGraph", sceneGraphInputs: "sceneGraphInputs", 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, usesOnChanges: true, ngImport: i0, template: `
2488
2494
  <div (ngxResize)="onResize($event)" style="height: 100%; width: 100%;">
2489
2495
  <canvas #glCanvas style="display: block;"></canvas>
2490
2496
  </div>
@@ -2504,6 +2510,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
2504
2510
  args: ['style.pointerEvents']
2505
2511
  }], sceneGraph: [{
2506
2512
  type: Input
2513
+ }], sceneGraphInputs: [{
2514
+ type: Input
2507
2515
  }], compoundPrefixes: [{
2508
2516
  type: Input
2509
2517
  }], linear: [{