angular-three 1.4.5 → 1.5.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/args.mjs +8 -21
- package/esm2020/lib/directives/common.mjs +30 -0
- package/esm2020/lib/directives/ref.mjs +31 -0
- package/esm2020/lib/renderer/renderer.mjs +10 -3
- package/esm2020/lib/renderer/state.mjs +9 -8
- package/fesm2015/angular-three.mjs +72 -22
- package/fesm2015/angular-three.mjs.map +1 -1
- package/fesm2020/angular-three.mjs +71 -21
- package/fesm2020/angular-three.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/lib/directives/args.d.ts +2 -7
- package/lib/directives/common.d.ts +14 -0
- package/lib/directives/ref.d.ts +11 -0
- package/lib/renderer/state.d.ts +1 -0
- package/package.json +1 -1
- package/plugin/package.json +1 -1
|
@@ -911,18 +911,39 @@ function extend(objects) {
|
|
|
911
911
|
}
|
|
912
912
|
const NGT_CATALOGUE = new InjectionToken('THREE Constructors Catalogue', { factory: () => catalogue });
|
|
913
913
|
|
|
914
|
-
class
|
|
914
|
+
class NgtCommonDirective {
|
|
915
915
|
constructor() {
|
|
916
916
|
this.vcr = inject(ViewContainerRef);
|
|
917
917
|
this.template = inject(TemplateRef);
|
|
918
|
-
this.injectedArgs = [];
|
|
919
918
|
this.injected = false;
|
|
919
|
+
this.shouldCreateView = true;
|
|
920
920
|
const commentNode = this.vcr.element.nativeElement;
|
|
921
921
|
if (commentNode['__ngt_renderer_add_comment__']) {
|
|
922
922
|
commentNode['__ngt_renderer_add_comment__']();
|
|
923
923
|
delete commentNode['__ngt_renderer_add_comment__'];
|
|
924
924
|
}
|
|
925
925
|
}
|
|
926
|
+
createView() {
|
|
927
|
+
if (this.shouldCreateView) {
|
|
928
|
+
if (this.view && !this.view.destroyed) {
|
|
929
|
+
this.view.destroy();
|
|
930
|
+
}
|
|
931
|
+
this.view = this.vcr.createEmbeddedView(this.template);
|
|
932
|
+
this.view.detectChanges();
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
NgtCommonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtCommonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
937
|
+
NgtCommonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.3", type: NgtCommonDirective, ngImport: i0 });
|
|
938
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtCommonDirective, decorators: [{
|
|
939
|
+
type: Directive
|
|
940
|
+
}], ctorParameters: function () { return []; } });
|
|
941
|
+
|
|
942
|
+
class NgtArgs extends NgtCommonDirective {
|
|
943
|
+
constructor() {
|
|
944
|
+
super(...arguments);
|
|
945
|
+
this.injectedArgs = [];
|
|
946
|
+
}
|
|
926
947
|
set args(args) {
|
|
927
948
|
if (args == null || !Array.isArray(args))
|
|
928
949
|
return;
|
|
@@ -942,20 +963,41 @@ class NgtArgs {
|
|
|
942
963
|
validate() {
|
|
943
964
|
return !this.injected && !!this.injectedArgs.length;
|
|
944
965
|
}
|
|
945
|
-
createView() {
|
|
946
|
-
if (this.view && !this.view.destroyed) {
|
|
947
|
-
this.view.destroy();
|
|
948
|
-
}
|
|
949
|
-
this.view = this.vcr.createEmbeddedView(this.template);
|
|
950
|
-
this.view.detectChanges();
|
|
951
|
-
}
|
|
952
966
|
}
|
|
953
|
-
NgtArgs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtArgs, deps:
|
|
954
|
-
NgtArgs.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.3", type: NgtArgs, isStandalone: true, selector: "[args]", inputs: { args: "args" }, ngImport: i0 });
|
|
967
|
+
NgtArgs.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtArgs, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
968
|
+
NgtArgs.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.3", type: NgtArgs, isStandalone: true, selector: "[args]", inputs: { args: "args" }, usesInheritance: true, ngImport: i0 });
|
|
955
969
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtArgs, decorators: [{
|
|
956
970
|
type: Directive,
|
|
957
971
|
args: [{ selector: '[args]', standalone: true }]
|
|
958
|
-
}],
|
|
972
|
+
}], propDecorators: { args: [{
|
|
973
|
+
type: Input
|
|
974
|
+
}] } });
|
|
975
|
+
|
|
976
|
+
class NgtRef extends NgtCommonDirective {
|
|
977
|
+
set ref(ref) {
|
|
978
|
+
if (!ref || ref == null)
|
|
979
|
+
return;
|
|
980
|
+
this.injected = false;
|
|
981
|
+
this.injectedRef = ref;
|
|
982
|
+
this.createView();
|
|
983
|
+
}
|
|
984
|
+
get ref() {
|
|
985
|
+
if (this.validate()) {
|
|
986
|
+
this.injected = true;
|
|
987
|
+
return this.injectedRef;
|
|
988
|
+
}
|
|
989
|
+
return null;
|
|
990
|
+
}
|
|
991
|
+
validate() {
|
|
992
|
+
return !this.injected && !!this.injectedRef && !this.injectedRef.nativeElement;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
NgtRef.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtRef, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
996
|
+
NgtRef.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.3", type: NgtRef, isStandalone: true, selector: "[ref]", inputs: { ref: "ref" }, usesInheritance: true, ngImport: i0 });
|
|
997
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: NgtRef, decorators: [{
|
|
998
|
+
type: Directive,
|
|
999
|
+
args: [{ selector: '[ref]', standalone: true }]
|
|
1000
|
+
}], propDecorators: { ref: [{
|
|
959
1001
|
type: Input
|
|
960
1002
|
}] } });
|
|
961
1003
|
|
|
@@ -1655,11 +1697,11 @@ class NgtRendererStore {
|
|
|
1655
1697
|
return;
|
|
1656
1698
|
// setup [ref] here
|
|
1657
1699
|
// ref should never change
|
|
1658
|
-
if (name === SPECIAL_PROPERTIES.REF && is.ref(value)) {
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
}
|
|
1700
|
+
// if (name === SPECIAL_PROPERTIES.REF && is.ref(value)) {
|
|
1701
|
+
// node.__ngt_renderer__[NgtRendererClassId.ref] = value;
|
|
1702
|
+
// value.nativeElement = node;
|
|
1703
|
+
// return;
|
|
1704
|
+
// }
|
|
1663
1705
|
const parent = getLocalState(node).parent || node.__ngt_renderer__[1 /* NgtRendererClassId.parent */];
|
|
1664
1706
|
// rawValue
|
|
1665
1707
|
if (getLocalState(node).isRaw && name === SPECIAL_PROPERTIES.VALUE) {
|
|
@@ -1735,10 +1777,11 @@ class NgtRendererStore {
|
|
|
1735
1777
|
return null;
|
|
1736
1778
|
}
|
|
1737
1779
|
getCreationState() {
|
|
1738
|
-
var _a;
|
|
1780
|
+
var _a, _b;
|
|
1739
1781
|
const injectedArgs = ((_a = this.firstNonInjectedDirective(NgtArgs)) === null || _a === void 0 ? void 0 : _a.args) || [];
|
|
1782
|
+
const injectedRef = ((_b = this.firstNonInjectedDirective(NgtRef)) === null || _b === void 0 ? void 0 : _b.ref) || null;
|
|
1740
1783
|
const store = this.tryGetPortalStore();
|
|
1741
|
-
return { injectedArgs, store };
|
|
1784
|
+
return { injectedArgs, injectedRef, store };
|
|
1742
1785
|
}
|
|
1743
1786
|
destroy(node, parent) {
|
|
1744
1787
|
const state = node.__ngt_renderer__;
|
|
@@ -1955,7 +1998,7 @@ class NgtRenderer {
|
|
|
1955
1998
|
if (name === SPECIAL_DOM_TAG.NGT_VALUE) {
|
|
1956
1999
|
return this.store.createNode('three', Object.assign({ __ngt_renderer__: { rawValue: undefined } }, { __ngt__: { isRaw: true } }));
|
|
1957
2000
|
}
|
|
1958
|
-
const { injectedArgs, store } = this.store.getCreationState();
|
|
2001
|
+
const { injectedArgs, injectedRef, store } = this.store.getCreationState();
|
|
1959
2002
|
// handle primitive
|
|
1960
2003
|
if (name === SPECIAL_DOM_TAG.NGT_PRIMITIVE) {
|
|
1961
2004
|
if (!injectedArgs[0])
|
|
@@ -1968,7 +2011,10 @@ class NgtRenderer {
|
|
|
1968
2011
|
}
|
|
1969
2012
|
if (!localState.store)
|
|
1970
2013
|
localState.store = store;
|
|
1971
|
-
|
|
2014
|
+
const primitiveNode = this.store.createNode('three', object);
|
|
2015
|
+
if (injectedRef)
|
|
2016
|
+
injectedRef.nativeElement = primitiveNode;
|
|
2017
|
+
return primitiveNode;
|
|
1972
2018
|
}
|
|
1973
2019
|
const threeTag = name.startsWith('ngt') ? name.slice(4) : name;
|
|
1974
2020
|
const threeName = kebabToPascal(threeTag);
|
|
@@ -1984,6 +2030,10 @@ class NgtRenderer {
|
|
|
1984
2030
|
else if (is.material(instance)) {
|
|
1985
2031
|
localState.attach = ['material'];
|
|
1986
2032
|
}
|
|
2033
|
+
if (injectedRef) {
|
|
2034
|
+
injectedRef.nativeElement = node;
|
|
2035
|
+
node.__ngt_renderer__[11 /* NgtRendererClassId.ref */] = injectedRef;
|
|
2036
|
+
}
|
|
1987
2037
|
return node;
|
|
1988
2038
|
}
|
|
1989
2039
|
const domNode = this.store.createNode('dom', element);
|
|
@@ -2878,5 +2928,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
|
|
|
2878
2928
|
* Generated bundle index. Do not edit.
|
|
2879
2929
|
*/
|
|
2880
2930
|
|
|
2881
|
-
export { NGT_CATALOGUE, NgtArgs, NgtCanvas, NgtPortal, NgtPortalBeforeRender, NgtPortalContent, NgtPush, NgtRepeat, NgtRxStore, NgtStore, addAfterEffect, addEffect, addTail, applyProps, checkNeedsUpdate, checkUpdate, createAttachFunction, createLoop, extend, flushGlobalEffects, getLocalState, injectBeforeRender, injectNgtDestroy, injectNgtLoader, injectNgtRef, invalidateInstance, is, makeDefaultCamera, makeDefaultRenderer, makeDpr, makeId, makeObjectGraph, prepare, rootStateMap, safeDetectChanges, startWithUndefined, tapEffect, updateCamera };
|
|
2931
|
+
export { NGT_CATALOGUE, NgtArgs, NgtCanvas, NgtPortal, NgtPortalBeforeRender, NgtPortalContent, NgtPush, NgtRef, NgtRepeat, NgtRxStore, NgtStore, addAfterEffect, addEffect, addTail, applyProps, checkNeedsUpdate, checkUpdate, createAttachFunction, createLoop, extend, flushGlobalEffects, getLocalState, injectBeforeRender, injectNgtDestroy, injectNgtLoader, injectNgtRef, invalidateInstance, is, makeDefaultCamera, makeDefaultRenderer, makeDpr, makeId, makeObjectGraph, prepare, rootStateMap, safeDetectChanges, startWithUndefined, tapEffect, updateCamera };
|
|
2882
2932
|
//# sourceMappingURL=angular-three.mjs.map
|