angular-three 1.8.1 → 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.
- package/esm2020/index.mjs +2 -1
- package/esm2020/lib/directives/parent.mjs +35 -0
- package/esm2020/lib/renderer/enums.mjs +1 -1
- package/esm2020/lib/renderer/renderer.mjs +58 -33
- package/esm2020/lib/renderer/state.mjs +60 -57
- package/esm2020/lib/renderer/utils.mjs +2 -2
- package/fesm2015/angular-three.mjs +150 -92
- package/fesm2015/angular-three.mjs.map +1 -1
- package/fesm2020/angular-three.mjs +149 -91
- package/fesm2020/angular-three.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/lib/directives/parent.d.ts +11 -0
- package/lib/renderer/enums.d.ts +13 -12
- package/lib/renderer/renderer.d.ts +3 -3
- package/lib/renderer/state.d.ts +3 -0
- package/package.json +1 -1
- package/plugin/package.json +1 -1
|
@@ -1022,6 +1022,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
|
|
|
1022
1022
|
type: Input
|
|
1023
1023
|
}] } });
|
|
1024
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
|
+
|
|
1025
1057
|
function releaseInternalPointerCapture(capturedMap, obj, captures, pointerId) {
|
|
1026
1058
|
const captureData = captures.get(obj);
|
|
1027
1059
|
if (captureData) {
|
|
@@ -1443,9 +1475,9 @@ function attachThreeChild(parent, child) {
|
|
|
1443
1475
|
if (cLS.isRaw) {
|
|
1444
1476
|
cLS.parent = parent;
|
|
1445
1477
|
// at this point we don't have rawValue yet, so we bail and wait until the Renderer recalls attach
|
|
1446
|
-
if (child.__ngt_renderer__[
|
|
1478
|
+
if (child.__ngt_renderer__[11 /* NgtRendererClassId.rawValue */] === undefined)
|
|
1447
1479
|
return;
|
|
1448
|
-
attach(parent, child.__ngt_renderer__[
|
|
1480
|
+
attach(parent, child.__ngt_renderer__[11 /* NgtRendererClassId.rawValue */], attachProp);
|
|
1449
1481
|
}
|
|
1450
1482
|
else {
|
|
1451
1483
|
attach(parent, child, attachProp);
|
|
@@ -1571,6 +1603,7 @@ class NgtRendererStore {
|
|
|
1571
1603
|
const state = [
|
|
1572
1604
|
type,
|
|
1573
1605
|
null,
|
|
1606
|
+
null,
|
|
1574
1607
|
[],
|
|
1575
1608
|
false,
|
|
1576
1609
|
undefined,
|
|
@@ -1592,7 +1625,7 @@ class NgtRendererStore {
|
|
|
1592
1625
|
// assign injectorFactory on non-three type since
|
|
1593
1626
|
// rendererNode is an instance of DOM Node
|
|
1594
1627
|
if (state[0 /* NgtRendererClassId.type */] !== 'three') {
|
|
1595
|
-
state[
|
|
1628
|
+
state[14 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(rendererNode).injector;
|
|
1596
1629
|
}
|
|
1597
1630
|
if (state[0 /* NgtRendererClassId.type */] === 'comment') {
|
|
1598
1631
|
// we attach an arrow function to the Comment node
|
|
@@ -1609,9 +1642,9 @@ class NgtRendererStore {
|
|
|
1609
1642
|
return rendererNode;
|
|
1610
1643
|
}
|
|
1611
1644
|
if (state[0 /* NgtRendererClassId.type */] === 'compound') {
|
|
1612
|
-
state[
|
|
1613
|
-
state[
|
|
1614
|
-
state[
|
|
1645
|
+
state[8 /* NgtRendererClassId.queueOps */] = new Set();
|
|
1646
|
+
state[9 /* NgtRendererClassId.attributes */] = {};
|
|
1647
|
+
state[10 /* NgtRendererClassId.properties */] = {};
|
|
1615
1648
|
return rendererNode;
|
|
1616
1649
|
}
|
|
1617
1650
|
return rendererNode;
|
|
@@ -1622,50 +1655,50 @@ class NgtRendererStore {
|
|
|
1622
1655
|
}
|
|
1623
1656
|
}
|
|
1624
1657
|
addChild(node, child) {
|
|
1625
|
-
if (!node.__ngt_renderer__[
|
|
1626
|
-
node.__ngt_renderer__[
|
|
1658
|
+
if (!node.__ngt_renderer__[3 /* NgtRendererClassId.children */].includes(child)) {
|
|
1659
|
+
node.__ngt_renderer__[3 /* NgtRendererClassId.children */].push(child);
|
|
1627
1660
|
}
|
|
1628
1661
|
}
|
|
1629
1662
|
removeChild(node, child) {
|
|
1630
|
-
const index = node.__ngt_renderer__[
|
|
1663
|
+
const index = node.__ngt_renderer__[3 /* NgtRendererClassId.children */].findIndex((c) => child === c);
|
|
1631
1664
|
if (index >= 0) {
|
|
1632
|
-
node.__ngt_renderer__[
|
|
1665
|
+
node.__ngt_renderer__[3 /* NgtRendererClassId.children */].splice(index, 1);
|
|
1633
1666
|
}
|
|
1634
1667
|
}
|
|
1635
1668
|
setCompound(compound, instance) {
|
|
1636
1669
|
const rS = compound.__ngt_renderer__;
|
|
1637
|
-
rS[
|
|
1638
|
-
const attributes = Object.keys(rS[
|
|
1639
|
-
const properties = Object.keys(rS[
|
|
1670
|
+
rS[7 /* NgtRendererClassId.compounded */] = instance;
|
|
1671
|
+
const attributes = Object.keys(rS[9 /* NgtRendererClassId.attributes */]);
|
|
1672
|
+
const properties = Object.keys(rS[10 /* NgtRendererClassId.properties */]);
|
|
1640
1673
|
if (attributes.length) {
|
|
1641
1674
|
for (const key of attributes) {
|
|
1642
|
-
this.applyAttribute(instance, key, rS[
|
|
1675
|
+
this.applyAttribute(instance, key, rS[9 /* NgtRendererClassId.attributes */][key]);
|
|
1643
1676
|
}
|
|
1644
1677
|
}
|
|
1645
1678
|
if (properties.length) {
|
|
1646
1679
|
for (const key of properties) {
|
|
1647
|
-
this.applyProperty(instance, key, rS[
|
|
1680
|
+
this.applyProperty(instance, key, rS[10 /* NgtRendererClassId.properties */][key]);
|
|
1648
1681
|
}
|
|
1649
1682
|
}
|
|
1650
1683
|
this.executeOperation(compound);
|
|
1651
1684
|
}
|
|
1652
1685
|
queueOperation(node, op) {
|
|
1653
|
-
node.__ngt_renderer__[
|
|
1686
|
+
node.__ngt_renderer__[8 /* NgtRendererClassId.queueOps */].add(op);
|
|
1654
1687
|
}
|
|
1655
1688
|
executeOperation(node, type = 'op') {
|
|
1656
1689
|
var _a;
|
|
1657
1690
|
const rS = node.__ngt_renderer__;
|
|
1658
|
-
if ((_a = rS[
|
|
1659
|
-
rS[
|
|
1691
|
+
if ((_a = rS[8 /* NgtRendererClassId.queueOps */]) === null || _a === void 0 ? void 0 : _a.size) {
|
|
1692
|
+
rS[8 /* NgtRendererClassId.queueOps */].forEach((op) => {
|
|
1660
1693
|
if (op[0 /* NgtQueueOpClassId.type */] === type) {
|
|
1661
1694
|
op[1 /* NgtQueueOpClassId.op */]();
|
|
1662
|
-
rS[
|
|
1695
|
+
rS[8 /* NgtRendererClassId.queueOps */].delete(op);
|
|
1663
1696
|
}
|
|
1664
1697
|
});
|
|
1665
1698
|
}
|
|
1666
1699
|
}
|
|
1667
1700
|
processPortalContainer(portal) {
|
|
1668
|
-
const injectorFactory = portal.__ngt_renderer__[
|
|
1701
|
+
const injectorFactory = portal.__ngt_renderer__[14 /* NgtRendererClassId.injectorFactory */];
|
|
1669
1702
|
const injector = injectorFactory === null || injectorFactory === void 0 ? void 0 : injectorFactory();
|
|
1670
1703
|
if (!injector)
|
|
1671
1704
|
return;
|
|
@@ -1675,11 +1708,11 @@ class NgtRendererStore {
|
|
|
1675
1708
|
const portalContainer = portalStore.get('scene');
|
|
1676
1709
|
if (!portalContainer)
|
|
1677
1710
|
return;
|
|
1678
|
-
portal.__ngt_renderer__[
|
|
1711
|
+
portal.__ngt_renderer__[13 /* NgtRendererClassId.portalContainer */] = this.createNode('three', portalContainer);
|
|
1679
1712
|
}
|
|
1680
1713
|
applyAttribute(node, name, value) {
|
|
1681
1714
|
const rS = node.__ngt_renderer__;
|
|
1682
|
-
if (rS[
|
|
1715
|
+
if (rS[4 /* NgtRendererClassId.destroyed */])
|
|
1683
1716
|
return;
|
|
1684
1717
|
if (name === SPECIAL_PROPERTIES.RENDER_PRIORITY) {
|
|
1685
1718
|
// priority needs to be set as an attribute string so that they can be set as early as possible
|
|
@@ -1693,7 +1726,7 @@ class NgtRendererStore {
|
|
|
1693
1726
|
}
|
|
1694
1727
|
if (name === SPECIAL_PROPERTIES.COMPOUND) {
|
|
1695
1728
|
// we set the compound property on instance node now so we know that this instance is being compounded
|
|
1696
|
-
rS[
|
|
1729
|
+
rS[5 /* NgtRendererClassId.compound */] = [value === '' || value === 'first', {}];
|
|
1697
1730
|
return;
|
|
1698
1731
|
}
|
|
1699
1732
|
if (name === SPECIAL_PROPERTIES.ATTACH) {
|
|
@@ -1712,25 +1745,25 @@ class NgtRendererStore {
|
|
|
1712
1745
|
else if (!isNaN(Number(maybeCoerced))) {
|
|
1713
1746
|
maybeCoerced = Number(maybeCoerced);
|
|
1714
1747
|
}
|
|
1715
|
-
rS[
|
|
1748
|
+
rS[11 /* NgtRendererClassId.rawValue */] = maybeCoerced;
|
|
1716
1749
|
return;
|
|
1717
1750
|
}
|
|
1718
1751
|
applyProps(node, { [name]: value });
|
|
1719
1752
|
}
|
|
1720
1753
|
applyProperty(node, name, value) {
|
|
1721
1754
|
const rS = node.__ngt_renderer__;
|
|
1722
|
-
if (rS[
|
|
1755
|
+
if (rS[4 /* NgtRendererClassId.destroyed */])
|
|
1723
1756
|
return;
|
|
1724
1757
|
// [ref]
|
|
1725
1758
|
if (name === SPECIAL_PROPERTIES.REF && is.ref(value)) {
|
|
1726
|
-
rS[
|
|
1759
|
+
rS[12 /* NgtRendererClassId.ref */] = value;
|
|
1727
1760
|
value.nativeElement = node;
|
|
1728
1761
|
return;
|
|
1729
1762
|
}
|
|
1730
1763
|
const parent = getLocalState(node).parent || rS[1 /* NgtRendererClassId.parent */];
|
|
1731
1764
|
// [rawValue]
|
|
1732
1765
|
if (getLocalState(node).isRaw && name === SPECIAL_PROPERTIES.VALUE) {
|
|
1733
|
-
rS[
|
|
1766
|
+
rS[11 /* NgtRendererClassId.rawValue */] = value;
|
|
1734
1767
|
if (parent)
|
|
1735
1768
|
attachThreeChild(parent, node);
|
|
1736
1769
|
return;
|
|
@@ -1742,7 +1775,7 @@ class NgtRendererStore {
|
|
|
1742
1775
|
attachThreeChild(parent, node);
|
|
1743
1776
|
return;
|
|
1744
1777
|
}
|
|
1745
|
-
const compound = rS[
|
|
1778
|
+
const compound = rS[5 /* NgtRendererClassId.compound */];
|
|
1746
1779
|
if ((compound === null || compound === void 0 ? void 0 : compound[1 /* NgtCompoundClassId.props */]) &&
|
|
1747
1780
|
name in compound[1 /* NgtCompoundClassId.props */] &&
|
|
1748
1781
|
!compound[0 /* NgtCompoundClassId.applyFirst */]) {
|
|
@@ -1771,52 +1804,53 @@ class NgtRendererStore {
|
|
|
1771
1804
|
getClosestParentWithInstance(node) {
|
|
1772
1805
|
let parent = node.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
|
|
1773
1806
|
while (parent && parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] !== 'three') {
|
|
1774
|
-
parent = parent.__ngt_renderer__[
|
|
1775
|
-
? parent.__ngt_renderer__[
|
|
1807
|
+
parent = parent.__ngt_renderer__[13 /* NgtRendererClassId.portalContainer */]
|
|
1808
|
+
? parent.__ngt_renderer__[13 /* NgtRendererClassId.portalContainer */]
|
|
1776
1809
|
: parent.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
|
|
1777
1810
|
}
|
|
1778
1811
|
return parent;
|
|
1779
1812
|
}
|
|
1780
1813
|
getClosestParentWithCompound(node) {
|
|
1781
|
-
if (node.__ngt_renderer__[
|
|
1782
|
-
return node.__ngt_renderer__[
|
|
1814
|
+
if (node.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */]) {
|
|
1815
|
+
return node.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */];
|
|
1783
1816
|
}
|
|
1784
1817
|
let parent = node.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
|
|
1785
1818
|
if (parent &&
|
|
1786
1819
|
parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'compound' &&
|
|
1787
|
-
!parent.__ngt_renderer__[
|
|
1820
|
+
!parent.__ngt_renderer__[7 /* NgtRendererClassId.compounded */]) {
|
|
1788
1821
|
return parent;
|
|
1789
1822
|
}
|
|
1790
1823
|
while (parent &&
|
|
1791
1824
|
(parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' ||
|
|
1792
|
-
!parent.__ngt_renderer__[
|
|
1825
|
+
!parent.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */] ||
|
|
1793
1826
|
parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] !== 'compound')) {
|
|
1794
1827
|
parent = parent.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
|
|
1795
1828
|
}
|
|
1796
1829
|
if (!parent)
|
|
1797
1830
|
return;
|
|
1798
1831
|
if (parent.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' &&
|
|
1799
|
-
parent.__ngt_renderer__[
|
|
1800
|
-
return parent.__ngt_renderer__[
|
|
1832
|
+
parent.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */]) {
|
|
1833
|
+
return parent.__ngt_renderer__[6 /* NgtRendererClassId.compoundParent */];
|
|
1801
1834
|
}
|
|
1802
|
-
if (!parent.__ngt_renderer__[
|
|
1835
|
+
if (!parent.__ngt_renderer__[7 /* NgtRendererClassId.compounded */]) {
|
|
1803
1836
|
return parent;
|
|
1804
1837
|
}
|
|
1805
1838
|
return null;
|
|
1806
1839
|
}
|
|
1807
1840
|
getCreationState() {
|
|
1808
|
-
var _a;
|
|
1841
|
+
var _a, _b;
|
|
1809
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;
|
|
1810
1844
|
const store = this.tryGetPortalStore();
|
|
1811
|
-
return { injectedArgs, store };
|
|
1845
|
+
return { injectedArgs, injectedParent, store };
|
|
1812
1846
|
}
|
|
1813
1847
|
destroy(node, parent) {
|
|
1814
1848
|
const rS = node.__ngt_renderer__;
|
|
1815
|
-
if (rS[
|
|
1849
|
+
if (rS[4 /* NgtRendererClassId.destroyed */])
|
|
1816
1850
|
return;
|
|
1817
1851
|
if (rS[0 /* NgtRendererClassId.type */] === 'three') {
|
|
1818
|
-
rS[
|
|
1819
|
-
rS[
|
|
1852
|
+
rS[5 /* NgtRendererClassId.compound */] = undefined;
|
|
1853
|
+
rS[6 /* NgtRendererClassId.compoundParent */] = undefined;
|
|
1820
1854
|
const localState = getLocalState(node);
|
|
1821
1855
|
if (localState.objects) {
|
|
1822
1856
|
localState.objects.value.forEach((obj) => this.destroy(obj, parent));
|
|
@@ -1843,7 +1877,7 @@ class NgtRendererStore {
|
|
|
1843
1877
|
}
|
|
1844
1878
|
}
|
|
1845
1879
|
if (rS[0 /* NgtRendererClassId.type */] === 'comment') {
|
|
1846
|
-
rS[
|
|
1880
|
+
rS[14 /* NgtRendererClassId.injectorFactory */] = null;
|
|
1847
1881
|
delete node['__ngt_renderer_add_comment__'];
|
|
1848
1882
|
const index = this.comments.findIndex((comment) => comment === node);
|
|
1849
1883
|
if (index > -1) {
|
|
@@ -1851,35 +1885,35 @@ class NgtRendererStore {
|
|
|
1851
1885
|
}
|
|
1852
1886
|
}
|
|
1853
1887
|
if (rS[0 /* NgtRendererClassId.type */] === 'portal') {
|
|
1854
|
-
rS[
|
|
1888
|
+
rS[14 /* NgtRendererClassId.injectorFactory */] = null;
|
|
1855
1889
|
const index = this.portals.findIndex((portal) => portal === node);
|
|
1856
1890
|
if (index > -1) {
|
|
1857
1891
|
this.portals.splice(index, 1);
|
|
1858
1892
|
}
|
|
1859
1893
|
}
|
|
1860
1894
|
if (rS[0 /* NgtRendererClassId.type */] === 'compound') {
|
|
1861
|
-
rS[
|
|
1862
|
-
rS[
|
|
1863
|
-
rS[
|
|
1895
|
+
rS[7 /* NgtRendererClassId.compounded */] = undefined;
|
|
1896
|
+
rS[9 /* NgtRendererClassId.attributes */] = null;
|
|
1897
|
+
rS[10 /* NgtRendererClassId.properties */] = null;
|
|
1864
1898
|
this.executeOperation(node, 'cleanUp');
|
|
1865
|
-
rS[
|
|
1866
|
-
rS[
|
|
1899
|
+
rS[8 /* NgtRendererClassId.queueOps */].clear();
|
|
1900
|
+
rS[8 /* NgtRendererClassId.queueOps */] = null;
|
|
1867
1901
|
}
|
|
1868
|
-
if (rS[
|
|
1902
|
+
if (rS[12 /* NgtRendererClassId.ref */]) {
|
|
1869
1903
|
// nullify ref
|
|
1870
|
-
rS[
|
|
1871
|
-
rS[
|
|
1904
|
+
rS[12 /* NgtRendererClassId.ref */].nativeElement = null;
|
|
1905
|
+
rS[12 /* NgtRendererClassId.ref */] = undefined;
|
|
1872
1906
|
}
|
|
1873
1907
|
// nullify parent
|
|
1874
1908
|
rS[1 /* NgtRendererClassId.parent */] = null;
|
|
1875
|
-
for (const renderChild of rS[
|
|
1909
|
+
for (const renderChild of rS[3 /* NgtRendererClassId.children */] || []) {
|
|
1876
1910
|
if (renderChild.__ngt_renderer__[0 /* NgtRendererClassId.type */] === 'three' && parent) {
|
|
1877
1911
|
removeThreeChild(parent, renderChild, true);
|
|
1878
1912
|
}
|
|
1879
1913
|
this.destroy(renderChild, parent);
|
|
1880
1914
|
}
|
|
1881
|
-
rS[
|
|
1882
|
-
rS[
|
|
1915
|
+
rS[3 /* NgtRendererClassId.children */] = [];
|
|
1916
|
+
rS[4 /* NgtRendererClassId.destroyed */] = true;
|
|
1883
1917
|
if (parent) {
|
|
1884
1918
|
this.removeChild(parent, node);
|
|
1885
1919
|
}
|
|
@@ -1889,11 +1923,11 @@ class NgtRendererStore {
|
|
|
1889
1923
|
let i = this.comments.length - 1;
|
|
1890
1924
|
while (i >= 0) {
|
|
1891
1925
|
const comment = this.comments[i];
|
|
1892
|
-
if (comment.__ngt_renderer__[
|
|
1926
|
+
if (comment.__ngt_renderer__[4 /* NgtRendererClassId.destroyed */]) {
|
|
1893
1927
|
i--;
|
|
1894
1928
|
continue;
|
|
1895
1929
|
}
|
|
1896
|
-
const injector = comment.__ngt_renderer__[
|
|
1930
|
+
const injector = comment.__ngt_renderer__[14 /* NgtRendererClassId.injectorFactory */]();
|
|
1897
1931
|
if (!injector) {
|
|
1898
1932
|
i--;
|
|
1899
1933
|
continue;
|
|
@@ -1914,11 +1948,11 @@ class NgtRendererStore {
|
|
|
1914
1948
|
while (i >= 0) {
|
|
1915
1949
|
// loop through the portal state backwards to find the closest NgtStore
|
|
1916
1950
|
const portal = this.portals[i];
|
|
1917
|
-
if (portal.__ngt_renderer__[
|
|
1951
|
+
if (portal.__ngt_renderer__[4 /* NgtRendererClassId.destroyed */]) {
|
|
1918
1952
|
i--;
|
|
1919
1953
|
continue;
|
|
1920
1954
|
}
|
|
1921
|
-
const injector = portal.__ngt_renderer__[
|
|
1955
|
+
const injector = portal.__ngt_renderer__[14 /* NgtRendererClassId.injectorFactory */]();
|
|
1922
1956
|
if (!injector) {
|
|
1923
1957
|
i--;
|
|
1924
1958
|
continue;
|
|
@@ -2003,7 +2037,7 @@ class NgtRenderer {
|
|
|
2003
2037
|
if (this.root) {
|
|
2004
2038
|
this.root = false;
|
|
2005
2039
|
const node = this.store.createNode('three', this.store.rootScene);
|
|
2006
|
-
node.__ngt_renderer__[
|
|
2040
|
+
node.__ngt_renderer__[14 /* NgtRendererClassId.injectorFactory */] = () => getDebugNode(element).injector;
|
|
2007
2041
|
return node;
|
|
2008
2042
|
}
|
|
2009
2043
|
// handle compound
|
|
@@ -2018,7 +2052,13 @@ class NgtRenderer {
|
|
|
2018
2052
|
if (name === SPECIAL_DOM_TAG.NGT_VALUE) {
|
|
2019
2053
|
return this.store.createNode('three', Object.assign({ __ngt_renderer__: { rawValue: undefined } }, { __ngt__: { isRaw: true } }));
|
|
2020
2054
|
}
|
|
2021
|
-
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
|
+
}
|
|
2022
2062
|
// handle primitive
|
|
2023
2063
|
if (name === SPECIAL_DOM_TAG.NGT_PRIMITIVE) {
|
|
2024
2064
|
if (!injectedArgs[0])
|
|
@@ -2031,7 +2071,11 @@ class NgtRenderer {
|
|
|
2031
2071
|
}
|
|
2032
2072
|
if (!localState.store)
|
|
2033
2073
|
localState.store = store;
|
|
2034
|
-
|
|
2074
|
+
const node = this.store.createNode('three', object);
|
|
2075
|
+
if (parent) {
|
|
2076
|
+
node.__ngt_renderer__[2 /* NgtRendererClassId.injectedParent */] = parent;
|
|
2077
|
+
}
|
|
2078
|
+
return node;
|
|
2035
2079
|
}
|
|
2036
2080
|
const threeTag = name.startsWith('ngt') ? name.slice(4) : name;
|
|
2037
2081
|
const threeName = kebabToPascal(threeTag);
|
|
@@ -2047,6 +2091,9 @@ class NgtRenderer {
|
|
|
2047
2091
|
else if (is.material(instance)) {
|
|
2048
2092
|
localState.attach = ['material'];
|
|
2049
2093
|
}
|
|
2094
|
+
if (parent) {
|
|
2095
|
+
node.__ngt_renderer__[2 /* NgtRendererClassId.injectedParent */] = parent;
|
|
2096
|
+
}
|
|
2050
2097
|
return node;
|
|
2051
2098
|
}
|
|
2052
2099
|
return this.store.createNode('dom', element);
|
|
@@ -2064,21 +2111,32 @@ class NgtRenderer {
|
|
|
2064
2111
|
this.store.setParent(newChild, parent);
|
|
2065
2112
|
return;
|
|
2066
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
|
+
}
|
|
2067
2125
|
this.store.setParent(newChild, parent);
|
|
2068
2126
|
this.store.addChild(parent, newChild);
|
|
2069
2127
|
// if new child is a portal
|
|
2070
2128
|
if (cRS[0 /* NgtRendererClassId.type */] === 'portal') {
|
|
2071
2129
|
this.store.processPortalContainer(newChild);
|
|
2072
|
-
if (cRS[
|
|
2073
|
-
this.appendChild(parent, cRS[
|
|
2130
|
+
if (cRS[13 /* NgtRendererClassId.portalContainer */]) {
|
|
2131
|
+
this.appendChild(parent, cRS[13 /* NgtRendererClassId.portalContainer */]);
|
|
2074
2132
|
}
|
|
2075
2133
|
return;
|
|
2076
2134
|
}
|
|
2077
2135
|
// if parent is a portal
|
|
2078
2136
|
if (pRS[0 /* NgtRendererClassId.type */] === 'portal') {
|
|
2079
2137
|
this.store.processPortalContainer(parent);
|
|
2080
|
-
if (pRS[
|
|
2081
|
-
this.appendChild(pRS[
|
|
2138
|
+
if (pRS[13 /* NgtRendererClassId.portalContainer */]) {
|
|
2139
|
+
this.appendChild(pRS[13 /* NgtRendererClassId.portalContainer */], newChild);
|
|
2082
2140
|
}
|
|
2083
2141
|
return;
|
|
2084
2142
|
}
|
|
@@ -2090,7 +2148,7 @@ class NgtRenderer {
|
|
|
2090
2148
|
// attach THREE child
|
|
2091
2149
|
attachThreeChild(parent, newChild);
|
|
2092
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
|
|
2093
|
-
if (!cRS[
|
|
2151
|
+
if (!cRS[5 /* NgtRendererClassId.compound */])
|
|
2094
2152
|
return;
|
|
2095
2153
|
const closestGrandparentWithCompound = this.store.getClosestParentWithCompound(parent);
|
|
2096
2154
|
if (!closestGrandparentWithCompound)
|
|
@@ -2100,26 +2158,26 @@ class NgtRenderer {
|
|
|
2100
2158
|
}
|
|
2101
2159
|
// if only the parent is the THREE instance
|
|
2102
2160
|
if (pRS[0 /* NgtRendererClassId.type */] === 'three') {
|
|
2103
|
-
for (const renderChild of cRS[
|
|
2161
|
+
for (const renderChild of cRS[3 /* NgtRendererClassId.children */]) {
|
|
2104
2162
|
this.appendChild(parent, renderChild);
|
|
2105
2163
|
}
|
|
2106
2164
|
}
|
|
2107
2165
|
// if parent is a compound
|
|
2108
2166
|
if (pRS[0 /* NgtRendererClassId.type */] === 'compound') {
|
|
2109
2167
|
// if compound doesn't have a THREE instance set yet
|
|
2110
|
-
if (!pRS[
|
|
2168
|
+
if (!pRS[7 /* NgtRendererClassId.compounded */] && cRS[0 /* NgtRendererClassId.type */] === 'three') {
|
|
2111
2169
|
// if child is indeed an ngtCompound
|
|
2112
|
-
if (cRS[
|
|
2170
|
+
if (cRS[5 /* NgtRendererClassId.compound */])
|
|
2113
2171
|
this.store.setCompound(parent, newChild);
|
|
2114
2172
|
// if not, we track the parent (that is supposedly the compound component) on this three instance
|
|
2115
|
-
else if (!cRS[
|
|
2116
|
-
cRS[
|
|
2173
|
+
else if (!cRS[6 /* NgtRendererClassId.compoundParent */])
|
|
2174
|
+
cRS[6 /* NgtRendererClassId.compoundParent */] = parent;
|
|
2117
2175
|
}
|
|
2118
2176
|
// reset the compound if it's changed
|
|
2119
|
-
if (pRS[
|
|
2177
|
+
if (pRS[7 /* NgtRendererClassId.compounded */] &&
|
|
2120
2178
|
cRS[0 /* NgtRendererClassId.type */] === 'three' &&
|
|
2121
|
-
cRS[
|
|
2122
|
-
pRS[
|
|
2179
|
+
cRS[5 /* NgtRendererClassId.compound */] &&
|
|
2180
|
+
pRS[7 /* NgtRendererClassId.compounded */] !== newChild) {
|
|
2123
2181
|
this.store.setCompound(parent, newChild);
|
|
2124
2182
|
}
|
|
2125
2183
|
}
|
|
@@ -2128,9 +2186,9 @@ class NgtRenderer {
|
|
|
2128
2186
|
(cRS[0 /* NgtRendererClassId.type */] === 'three' && !getLocalState(newChild).parent) ||
|
|
2129
2187
|
// or both parent and child are DOM elements
|
|
2130
2188
|
((pRS[0 /* NgtRendererClassId.type */] === 'dom' ||
|
|
2131
|
-
(pRS[0 /* NgtRendererClassId.type */] === 'compound' && !pRS[
|
|
2189
|
+
(pRS[0 /* NgtRendererClassId.type */] === 'compound' && !pRS[7 /* NgtRendererClassId.compounded */])) &&
|
|
2132
2190
|
(cRS[0 /* NgtRendererClassId.type */] === 'dom' ||
|
|
2133
|
-
(cRS[0 /* NgtRendererClassId.type */] === 'compound' && !cRS[
|
|
2191
|
+
(cRS[0 /* NgtRendererClassId.type */] === 'compound' && !cRS[7 /* NgtRendererClassId.compounded */])));
|
|
2134
2192
|
if (shouldFindGrandparentInstance) {
|
|
2135
2193
|
// we'll try to get the grandparent instance here so that we can run appendChild with both instances
|
|
2136
2194
|
const closestGrandparentInstance = this.store.getClosestParentWithInstance(parent);
|
|
@@ -2143,7 +2201,7 @@ class NgtRenderer {
|
|
|
2143
2201
|
// refChild: NgtRendererNode
|
|
2144
2202
|
// isMove?: boolean | undefined
|
|
2145
2203
|
) {
|
|
2146
|
-
if (!parent.__ngt_renderer__ || parent === newChild)
|
|
2204
|
+
if (parent == null || !parent.__ngt_renderer__ || parent === newChild)
|
|
2147
2205
|
return;
|
|
2148
2206
|
this.appendChild(parent, newChild);
|
|
2149
2207
|
}
|
|
@@ -2178,12 +2236,12 @@ class NgtRenderer {
|
|
|
2178
2236
|
const rS = el.__ngt_renderer__;
|
|
2179
2237
|
if (rS[0 /* NgtRendererClassId.type */] === 'compound') {
|
|
2180
2238
|
// we don't have the compound instance yet
|
|
2181
|
-
rS[
|
|
2182
|
-
if (!rS[
|
|
2239
|
+
rS[9 /* NgtRendererClassId.attributes */][name] = value;
|
|
2240
|
+
if (!rS[7 /* NgtRendererClassId.compounded */]) {
|
|
2183
2241
|
this.store.queueOperation(el, ['op', () => this.setAttribute(el, name, value, namespace)]);
|
|
2184
2242
|
return;
|
|
2185
2243
|
}
|
|
2186
|
-
this.setAttribute(rS[
|
|
2244
|
+
this.setAttribute(rS[7 /* NgtRendererClassId.compounded */], name, value, namespace);
|
|
2187
2245
|
return;
|
|
2188
2246
|
}
|
|
2189
2247
|
if (rS[0 /* NgtRendererClassId.type */] === 'three')
|
|
@@ -2193,17 +2251,17 @@ class NgtRenderer {
|
|
|
2193
2251
|
const rS = el.__ngt_renderer__;
|
|
2194
2252
|
if (rS[0 /* NgtRendererClassId.type */] === 'compound') {
|
|
2195
2253
|
// we don't have the compound instance yet
|
|
2196
|
-
rS[
|
|
2197
|
-
if (!rS[
|
|
2254
|
+
rS[10 /* NgtRendererClassId.properties */][name] = value;
|
|
2255
|
+
if (!rS[7 /* NgtRendererClassId.compounded */]) {
|
|
2198
2256
|
this.store.queueOperation(el, ['op', () => this.setProperty(el, name, value)]);
|
|
2199
2257
|
return;
|
|
2200
2258
|
}
|
|
2201
|
-
if (rS[
|
|
2202
|
-
Object.assign(rS[
|
|
2203
|
-
props: Object.assign(Object.assign({}, rS[
|
|
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 }),
|
|
2204
2262
|
});
|
|
2205
2263
|
}
|
|
2206
|
-
this.setProperty(rS[
|
|
2264
|
+
this.setProperty(rS[7 /* NgtRendererClassId.compounded */], name, value);
|
|
2207
2265
|
return;
|
|
2208
2266
|
}
|
|
2209
2267
|
if (rS[0 /* NgtRendererClassId.type */] === 'three')
|
|
@@ -2212,7 +2270,7 @@ class NgtRenderer {
|
|
|
2212
2270
|
listen(target, eventName, callback) {
|
|
2213
2271
|
var _a;
|
|
2214
2272
|
const rS = target.__ngt_renderer__;
|
|
2215
|
-
const targetCdr = (_a = rS === null || rS === void 0 ? void 0 : rS[
|
|
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);
|
|
2216
2274
|
// if target is DOM node, then we pass that to delegate Renderer
|
|
2217
2275
|
const callbackWithCdr = (event) => {
|
|
2218
2276
|
const value = callback(event);
|
|
@@ -2237,12 +2295,12 @@ class NgtRenderer {
|
|
|
2237
2295
|
return this.delegate.listen(eventTarget, event, callbackWithCdr);
|
|
2238
2296
|
}
|
|
2239
2297
|
if (rS[0 /* NgtRendererClassId.type */] === 'three' ||
|
|
2240
|
-
(rS[0 /* NgtRendererClassId.type */] === 'compound' && rS[
|
|
2241
|
-
const instance = rS[
|
|
2298
|
+
(rS[0 /* NgtRendererClassId.type */] === 'compound' && rS[7 /* NgtRendererClassId.compounded */])) {
|
|
2299
|
+
const instance = rS[7 /* NgtRendererClassId.compounded */] || target;
|
|
2242
2300
|
const priority = getLocalState(target).priority;
|
|
2243
2301
|
return processThreeEvent(instance, priority || 0, eventName, callback, this.store.rootCdr, targetCdr);
|
|
2244
2302
|
}
|
|
2245
|
-
if (rS[0 /* NgtRendererClassId.type */] === 'compound' && !rS[
|
|
2303
|
+
if (rS[0 /* NgtRendererClassId.type */] === 'compound' && !rS[7 /* NgtRendererClassId.compounded */]) {
|
|
2246
2304
|
this.store.queueOperation(target, [
|
|
2247
2305
|
'op',
|
|
2248
2306
|
() => this.store.queueOperation(target, ['cleanUp', this.listen(target, eventName, callback)]),
|
|
@@ -3009,5 +3067,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
|
|
|
3009
3067
|
* Generated bundle index. Do not edit.
|
|
3010
3068
|
*/
|
|
3011
3069
|
|
|
3012
|
-
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 };
|
|
3013
3071
|
//# sourceMappingURL=angular-three.mjs.map
|