angular-three 3.7.0 → 4.0.0-next.1

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.
Files changed (53) hide show
  1. package/dom/README.md +3 -0
  2. package/dom/index.d.ts +2 -0
  3. package/dom/lib/canvas.d.ts +49 -0
  4. package/{lib/dom → dom/lib}/events.d.ts +2 -3
  5. package/dom/lib/renderer.d.ts +1 -0
  6. package/fesm2022/angular-three-dom.mjs +278 -0
  7. package/fesm2022/angular-three-dom.mjs.map +1 -0
  8. package/fesm2022/angular-three-testing.mjs +45 -28
  9. package/fesm2022/angular-three-testing.mjs.map +1 -1
  10. package/fesm2022/angular-three.mjs +2671 -3006
  11. package/fesm2022/angular-three.mjs.map +1 -1
  12. package/index.d.ts +5 -3
  13. package/lib/directives/args.d.ts +4 -8
  14. package/lib/directives/common.d.ts +20 -0
  15. package/lib/directives/parent.d.ts +7 -11
  16. package/lib/events.d.ts +5 -5
  17. package/lib/html.d.ts +4 -7
  18. package/lib/instance.d.ts +8 -4
  19. package/lib/loop.d.ts +13 -25
  20. package/lib/portal.d.ts +26 -45
  21. package/lib/renderer/catalogue.d.ts +4 -12
  22. package/lib/renderer/constants.d.ts +11 -22
  23. package/lib/renderer/renderer.d.ts +53 -0
  24. package/lib/renderer/state.d.ts +62 -22
  25. package/lib/renderer/utils.d.ts +10 -10
  26. package/lib/roots.d.ts +2 -6
  27. package/lib/routed-scene.d.ts +2 -10
  28. package/lib/store.d.ts +7 -12
  29. package/lib/three-types.d.ts +225 -404
  30. package/lib/types.d.ts +168 -162
  31. package/lib/utils/apply-props.d.ts +4 -2
  32. package/lib/utils/attach.d.ts +5 -5
  33. package/lib/utils/before-render.d.ts +1 -1
  34. package/lib/utils/is.d.ts +12 -11
  35. package/lib/utils/make.d.ts +7 -7
  36. package/lib/utils/object-events.d.ts +4 -4
  37. package/lib/utils/parameters.d.ts +11 -11
  38. package/lib/utils/signal-state.d.ts +27 -0
  39. package/lib/utils/update.d.ts +2 -2
  40. package/package.json +79 -97
  41. package/testing/lib/test-bed.d.ts +12 -9
  42. package/testing/lib/test-canvas.d.ts +8 -5
  43. package/LICENSE +0 -21
  44. package/fesm2022/angular-three-nativescript.mjs +0 -134
  45. package/fesm2022/angular-three-nativescript.mjs.map +0 -1
  46. package/lib/canvas.d.ts +0 -368
  47. package/lib/renderer/index.d.ts +0 -65
  48. package/lib/utils/signal-store.d.ts +0 -26
  49. package/metadata.json +0 -1
  50. package/nativescript/README.md +0 -5
  51. package/nativescript/index.d.ts +0 -1
  52. package/nativescript/lib/canvas.d.ts +0 -359
  53. package/web-types.json +0 -1
package/package.json CHANGED
@@ -1,98 +1,80 @@
1
1
  {
2
- "name": "angular-three",
3
- "version": "3.7.0",
4
- "publishConfig": {
5
- "access": "public"
6
- },
7
- "type": "module",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/angular-threejs/angular-three/tree/main/libs/core"
11
- },
12
- "author": {
13
- "name": "Chau Tran",
14
- "email": "nartc7789@gmail.com",
15
- "url": "https://nartc.me"
16
- },
17
- "description": "Angular Renderer for THREE.js",
18
- "keywords": [
19
- "angular",
20
- "threejs",
21
- "renderer"
22
- ],
23
- "license": "MIT",
24
- "peerDependencies": {
25
- "@angular/common": ">=19.0.0 <20.0.0",
26
- "@angular/core": ">=19.0.0 <20.0.0",
27
- "ngxtension": ">=3.0.0",
28
- "three": ">=0.148.0 <0.173.0",
29
- "@nativescript/angular": ">=18.0.0 <19.0.0",
30
- "@nativescript/canvas": "2.0.0-webgpu.11",
31
- "@nativescript/canvas-three": "2.0.0-webgpu.11",
32
- "@nativescript/canvas-media": "2.0.0-webgpu.11"
33
- },
34
- "peerDependenciesMeta": {
35
- "@nativescript/angular": {
36
- "optional": true
37
- },
38
- "@nativescript/canvas": {
39
- "optional": true
40
- },
41
- "@nativescript/canvas-three": {
42
- "optional": true
43
- },
44
- "@nativescript/canvas-media": {
45
- "optional": true
46
- }
47
- },
48
- "dependencies": {
49
- "tslib": "^2.7.0",
50
- "@nx/devkit": "^20.0.0",
51
- "@phenomnomnominal/tsquery": "^6.0.0",
52
- "nx": "^20.0.0"
53
- },
54
- "generators": "./plugin/generators.json",
55
- "schematics": "./plugin/generators.json",
56
- "nx-migrations": {
57
- "migrations": "./plugin/migrations.json",
58
- "packageGroup": [
59
- "angular-three-soba",
60
- "angular-three-postprocessing",
61
- "angular-three-cannon",
62
- "angular-three-rapier"
63
- ]
64
- },
65
- "ng-update": {
66
- "migrations": "./plugin/migrations.json",
67
- "packageGroup": [
68
- "angular-three-soba",
69
- "angular-three-postprocessing",
70
- "angular-three-cannon",
71
- "angular-three-rapier"
72
- ]
73
- },
74
- "web-types": [
75
- "./web-types.json",
76
- "../../node_modules/angular-three/web-types.json"
77
- ],
78
- "module": "fesm2022/angular-three.mjs",
79
- "typings": "index.d.ts",
80
- "exports": {
81
- "./package.json": {
82
- "default": "./package.json"
83
- },
84
- ".": {
85
- "types": "./index.d.ts",
86
- "default": "./fesm2022/angular-three.mjs"
87
- },
88
- "./nativescript": {
89
- "types": "./nativescript/index.d.ts",
90
- "default": "./fesm2022/angular-three-nativescript.mjs"
91
- },
92
- "./testing": {
93
- "types": "./testing/index.d.ts",
94
- "default": "./fesm2022/angular-three-testing.mjs"
95
- }
96
- },
97
- "sideEffects": false
98
- }
2
+ "name": "angular-three",
3
+ "version": "4.0.0-next.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/angular-threejs/angular-three/tree/main/libs/core"
11
+ },
12
+ "author": {
13
+ "name": "Chau Tran",
14
+ "email": "nartc7789@gmail.com",
15
+ "url": "https://nartc.me"
16
+ },
17
+ "description": "Angular Renderer for THREE.js",
18
+ "keywords": [
19
+ "angular",
20
+ "threejs",
21
+ "renderer"
22
+ ],
23
+ "license": "MIT",
24
+ "peerDependencies": {
25
+ "@angular/common": ">=19.0.0 <20.0.0",
26
+ "@angular/core": ">=19.0.0 <20.0.0",
27
+ "ngxtension": ">=3.0.0",
28
+ "three": ">=0.156.0 <0.173.0"
29
+ },
30
+ "dependencies": {
31
+ "tslib": "^2.7.0",
32
+ "@nx/devkit": "^20.0.0",
33
+ "@phenomnomnominal/tsquery": "^6.0.0",
34
+ "nx": "^20.0.0"
35
+ },
36
+ "generators": "./plugin/generators.json",
37
+ "schematics": "./plugin/generators.json",
38
+ "nx-migrations": {
39
+ "migrations": "./plugin/migrations.json",
40
+ "packageGroup": [
41
+ "angular-three-soba",
42
+ "angular-three-postprocessing",
43
+ "angular-three-cannon",
44
+ "angular-three-rapier"
45
+ ]
46
+ },
47
+ "ng-update": {
48
+ "migrations": "./plugin/migrations.json",
49
+ "packageGroup": [
50
+ "angular-three-soba",
51
+ "angular-three-postprocessing",
52
+ "angular-three-cannon",
53
+ "angular-three-rapier"
54
+ ]
55
+ },
56
+ "web-types": [
57
+ "./web-types.json",
58
+ "../../node_modules/angular-three/web-types.json"
59
+ ],
60
+ "module": "fesm2022/angular-three.mjs",
61
+ "typings": "index.d.ts",
62
+ "exports": {
63
+ "./package.json": {
64
+ "default": "./package.json"
65
+ },
66
+ ".": {
67
+ "types": "./index.d.ts",
68
+ "default": "./fesm2022/angular-three.mjs"
69
+ },
70
+ "./dom": {
71
+ "types": "./dom/index.d.ts",
72
+ "default": "./fesm2022/angular-three-dom.mjs"
73
+ },
74
+ "./testing": {
75
+ "types": "./testing/index.d.ts",
76
+ "default": "./fesm2022/angular-three-testing.mjs"
77
+ }
78
+ },
79
+ "sideEffects": false
80
+ }
@@ -1,6 +1,7 @@
1
- import { Type } from '@angular/core';
1
+ import { ComponentRef, Type } from '@angular/core';
2
2
  import { ComponentFixture, TestBed } from '@angular/core/testing';
3
- import { NgtAnyRecord, NgtCanvasOptions, NgtEventHandlers, NgtInstanceNode, NgtSignalStore, NgtState } from 'angular-three';
3
+ import { type NgtAnyRecord, type NgtCanvasOptions, type NgtEventHandlers, type NgtInstanceNode, type NgtState, type SignalState } from 'angular-three';
4
+ import type * as THREE from 'three';
4
5
  import { NgtTestCanvas } from './test-canvas';
5
6
  export interface NgtTestGraphedObject {
6
7
  type: string;
@@ -8,7 +9,8 @@ export interface NgtTestGraphedObject {
8
9
  children: NgtTestGraphedObject[];
9
10
  }
10
11
  export declare class NgtTestBed {
11
- static create<T extends Type<any>>(sceneGraph: T, { mockCanvasOptions, canvasConfiguration, errorOnUnknownElements, providers, declarations, imports, teardown, deferBlockBehavior, }?: {
12
+ static create<T extends Type<any>>(sceneGraph: T, { sceneGraphInputs, mockCanvasOptions, canvasConfiguration, errorOnUnknownElements, providers, declarations, imports, teardown, deferBlockBehavior, }?: {
13
+ sceneGraphInputs?: NgtAnyRecord;
12
14
  mockCanvasOptions?: {
13
15
  width?: number;
14
16
  height?: number;
@@ -16,10 +18,11 @@ export declare class NgtTestBed {
16
18
  };
17
19
  canvasConfiguration?: Partial<Omit<NgtCanvasOptions, 'frameloop' | 'size' | 'events'>>;
18
20
  } & Omit<Parameters<TestBed['configureTestingModule']>[0], 'schemas'>): {
19
- store: NgtSignalStore<NgtState>;
21
+ store: SignalState<NgtState>;
20
22
  fixture: ComponentFixture<NgtTestCanvas>;
21
- scene: import("three").Scene;
22
- sceneInstanceNode: import("angular-three").NgtLocalState;
23
+ sceneGraphComponentRef: ComponentRef<T>;
24
+ scene: THREE.Scene;
25
+ sceneInstanceNode: import("angular-three").NgtInstanceState<THREE.Scene>;
23
26
  canvas: HTMLCanvasElement;
24
27
  destroy: () => void;
25
28
  fireEvent: {
@@ -29,9 +32,9 @@ export declare class NgtTestBed {
29
32
  advance: (frames: number, delta?: number | number[]) => Promise<void>;
30
33
  toGraph: () => NgtTestGraphedObject[];
31
34
  };
32
- static createToGraph(store: NgtSignalStore<NgtState>): () => NgtTestGraphedObject[];
33
- static createAdvance(store: NgtSignalStore<NgtState>): (frames: number, delta?: number | number[]) => Promise<void>;
34
- static createEventFirer(store: NgtSignalStore<NgtState>, fixture: ComponentFixture<NgtTestCanvas>): {
35
+ static createToGraph(store: SignalState<NgtState>): () => NgtTestGraphedObject[];
36
+ static createAdvance(store: SignalState<NgtState>): (frames: number, delta?: number | number[]) => Promise<void>;
37
+ static createEventFirer(store: SignalState<NgtState>, fixture: ComponentFixture<NgtTestCanvas>): {
35
38
  (el: NgtInstanceNode, eventName: keyof NgtEventHandlers, eventData?: NgtAnyRecord): Promise<void>;
36
39
  setAutoDetectChanges(auto: boolean): void;
37
40
  };
@@ -1,11 +1,14 @@
1
- import { Type } from '@angular/core';
1
+ import { ComponentRef, Type } from '@angular/core';
2
+ import { NgtAnyRecord } from 'angular-three';
2
3
  import * as i0 from "@angular/core";
3
4
  export declare class NgtTestCanvas {
4
- sceneGraph: import("@angular/core").InputSignal<Type<any>>;
5
- private ref?;
6
- private environmentInjector?;
5
+ sceneGraph: import("@angular/core").InputSignal<Type<unknown>>;
6
+ sceneGraphInputs: import("@angular/core").InputSignal<NgtAnyRecord>;
7
+ private anchorRef;
8
+ private store;
9
+ sceneRef?: ComponentRef<unknown>;
7
10
  constructor();
8
11
  destroy(): void;
9
12
  static ɵfac: i0.ɵɵFactoryDeclaration<NgtTestCanvas, never>;
10
- static ɵcmp: i0.ɵɵComponentDeclaration<NgtTestCanvas, "ngt-test-canvas", never, { "sceneGraph": { "alias": "sceneGraph"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
13
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgtTestCanvas, "ngt-test-canvas", never, { "sceneGraph": { "alias": "sceneGraph"; "required": true; "isSignal": true; }; "sceneGraphInputs": { "alias": "sceneGraphInputs"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
11
14
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Angular Three
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,134 +0,0 @@
1
- import '@nativescript/canvas-three';
2
- import { DOCUMENT } from '@angular/common';
3
- import * as i0 from '@angular/core';
4
- import { input, booleanAttribute, output, inject, Injector, EnvironmentInjector, DestroyRef, NgZone, viewChild, ViewContainerRef, untracked, createEnvironmentInjector, Component, NO_ERRORS_SCHEMA, ChangeDetectionStrategy } from '@angular/core';
5
- import { registerElement } from '@nativescript/angular';
6
- import { Canvas } from '@nativescript/canvas';
7
- import { NgtRoutedScene, injectStore, injectCanvasRootInitializer, makeDpr, provideNgtRenderer, provideStore } from 'angular-three';
8
- import { WebGLRenderer } from 'three';
9
-
10
- registerElement('Canvas', () => Canvas);
11
- class NgtCanvasNative {
12
- constructor() {
13
- this.sceneGraph = input.required({
14
- transform: (value) => {
15
- if (value === 'routed')
16
- return NgtRoutedScene;
17
- return value;
18
- },
19
- });
20
- this.gl = input();
21
- this.size = input();
22
- this.shadows = input(false, {
23
- transform: (value) => {
24
- if (value === '')
25
- return booleanAttribute(value);
26
- return value;
27
- },
28
- });
29
- this.legacy = input(false, { transform: booleanAttribute });
30
- this.linear = input(false, { transform: booleanAttribute });
31
- this.flat = input(false, { transform: booleanAttribute });
32
- this.orthographic = input(false, { transform: booleanAttribute });
33
- this.frameloop = input('always');
34
- this.performance = input();
35
- this.dpr = input([1, 2]);
36
- this.raycaster = input();
37
- this.scene = input();
38
- this.camera = input();
39
- this.lookAt = input();
40
- this.created = output();
41
- this.store = injectStore();
42
- this.initRoot = injectCanvasRootInitializer();
43
- this.injector = inject(Injector);
44
- this.environmentInjector = inject(EnvironmentInjector);
45
- this.destroyRef = inject(DestroyRef);
46
- this.zone = inject(NgZone);
47
- this.canvasViewContainerRef = viewChild.required('canvas', { read: ViewContainerRef });
48
- this.destroyRef.onDestroy(() => {
49
- this.glRef?.destroy();
50
- this.glEnvironmentInjector?.destroy();
51
- this.configurator?.destroy();
52
- });
53
- }
54
- onReady(event) {
55
- const canvas = event.object;
56
- const dpr = makeDpr(untracked(this.dpr), window);
57
- const canvasWidth = canvas.clientWidth * dpr;
58
- const canvasHeight = canvas.clientHeight * dpr;
59
- Object.assign(canvas, { width: canvasWidth, height: canvasHeight });
60
- const context = canvas.getContext('webgl2');
61
- const gl = new WebGLRenderer({
62
- canvas,
63
- context: context,
64
- powerPreference: 'high-performance',
65
- antialias: true,
66
- alpha: true,
67
- ...untracked(this.gl),
68
- });
69
- gl.setSize(canvasWidth, canvasHeight);
70
- this.zone.runOutsideAngular(() => {
71
- this.configurator = this.initRoot(canvas);
72
- this.configurator.configure({
73
- gl,
74
- size: { width: canvasWidth, height: canvasHeight, top: 0, left: 0 },
75
- shadows: untracked(this.shadows),
76
- legacy: untracked(this.legacy),
77
- linear: untracked(this.linear),
78
- flat: untracked(this.flat),
79
- orthographic: untracked(this.orthographic),
80
- frameloop: untracked(this.frameloop),
81
- performance: untracked(this.performance),
82
- dpr: untracked(this.dpr),
83
- raycaster: untracked(this.raycaster),
84
- scene: untracked(this.scene),
85
- camera: untracked(this.camera),
86
- lookAt: untracked(this.lookAt),
87
- });
88
- untracked(this.noZoneRender.bind(this));
89
- });
90
- }
91
- noZoneRender() {
92
- // NOTE: destroy previous instances if existed
93
- this.glEnvironmentInjector?.destroy();
94
- this.glRef?.destroy();
95
- // NOTE: Flag the canvas active, rendering will now begin
96
- this.store.update((state) => ({ internal: { ...state.internal, active: true } }));
97
- // emit created event if observed
98
- this.created.emit(this.store.snapshot);
99
- this.glEnvironmentInjector = createEnvironmentInjector([{ provide: DOCUMENT, useValue: document }, provideNgtRenderer(this.store)], this.environmentInjector);
100
- this.glRef = untracked(this.canvasViewContainerRef).createComponent(untracked(this.sceneGraph), {
101
- environmentInjector: this.glEnvironmentInjector,
102
- injector: this.injector,
103
- });
104
- this.glRef.changeDetectorRef.detectChanges();
105
- }
106
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtCanvasNative, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
107
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.0.6", type: NgtCanvasNative, isStandalone: true, selector: "NgtCanvas", inputs: { sceneGraph: { classPropertyName: "sceneGraph", publicName: "sceneGraph", isSignal: true, isRequired: true, transformFunction: null }, gl: { classPropertyName: "gl", publicName: "gl", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, shadows: { classPropertyName: "shadows", publicName: "shadows", isSignal: true, isRequired: false, transformFunction: null }, legacy: { classPropertyName: "legacy", publicName: "legacy", isSignal: true, isRequired: false, transformFunction: null }, linear: { classPropertyName: "linear", publicName: "linear", isSignal: true, isRequired: false, transformFunction: null }, flat: { classPropertyName: "flat", publicName: "flat", isSignal: true, isRequired: false, transformFunction: null }, orthographic: { classPropertyName: "orthographic", publicName: "orthographic", isSignal: true, isRequired: false, transformFunction: null }, frameloop: { classPropertyName: "frameloop", publicName: "frameloop", isSignal: true, isRequired: false, transformFunction: null }, performance: { classPropertyName: "performance", publicName: "performance", isSignal: true, isRequired: false, transformFunction: null }, dpr: { classPropertyName: "dpr", publicName: "dpr", isSignal: true, isRequired: false, transformFunction: null }, raycaster: { classPropertyName: "raycaster", publicName: "raycaster", isSignal: true, isRequired: false, transformFunction: null }, scene: { classPropertyName: "scene", publicName: "scene", isSignal: true, isRequired: false, transformFunction: null }, camera: { classPropertyName: "camera", publicName: "camera", isSignal: true, isRequired: false, transformFunction: null }, lookAt: { classPropertyName: "lookAt", publicName: "lookAt", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { created: "created" }, providers: [{ provide: DOCUMENT, useValue: document }, provideStore()], viewQueries: [{ propertyName: "canvasViewContainerRef", first: true, predicate: ["canvas"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: `
108
- <GridLayout>
109
- <Canvas #canvas style="width: 100%; height: auto" (ready)="onReady($event)"></Canvas>
110
- </GridLayout>
111
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
112
- }
113
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: NgtCanvasNative, decorators: [{
114
- type: Component,
115
- args: [{
116
- selector: 'NgtCanvas',
117
- standalone: true,
118
- template: `
119
- <GridLayout>
120
- <Canvas #canvas style="width: 100%; height: auto" (ready)="onReady($event)"></Canvas>
121
- </GridLayout>
122
- `,
123
- providers: [{ provide: DOCUMENT, useValue: document }, provideStore()],
124
- schemas: [NO_ERRORS_SCHEMA],
125
- changeDetection: ChangeDetectionStrategy.OnPush,
126
- }]
127
- }], ctorParameters: () => [] });
128
-
129
- /**
130
- * Generated bundle index. Do not edit.
131
- */
132
-
133
- export { NgtCanvasNative };
134
- //# sourceMappingURL=angular-three-nativescript.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"angular-three-nativescript.mjs","sources":["../../../../libs/core/nativescript/src/lib/canvas.ts","../../../../libs/core/nativescript/src/angular-three-nativescript.ts"],"sourcesContent":["import '@nativescript/canvas-three';\n\nimport { DOCUMENT } from '@angular/common';\nimport {\n\tbooleanAttribute,\n\tChangeDetectionStrategy,\n\tComponent,\n\tComponentRef,\n\tcreateEnvironmentInjector,\n\tDestroyRef,\n\tEnvironmentInjector,\n\tinject,\n\tInjector,\n\tinput,\n\tNgZone,\n\tNO_ERRORS_SCHEMA,\n\toutput,\n\tType,\n\tuntracked,\n\tviewChild,\n\tViewContainerRef,\n} from '@angular/core';\nimport { registerElement } from '@nativescript/angular';\nimport { Canvas } from '@nativescript/canvas';\nimport {\n\tinjectCanvasRootInitializer,\n\tinjectStore,\n\tmakeDpr,\n\tNgtCanvasConfigurator,\n\tNgtCanvasOptions,\n\tNgtDpr,\n\tNgtGLOptions,\n\tNgtPerformance,\n\tNgtRoutedScene,\n\tNgtSize,\n\tNgtState,\n\tprovideNgtRenderer,\n\tprovideStore,\n} from 'angular-three';\nimport { Raycaster, Scene, Vector3, WebGLRenderer } from 'three';\n\nregisterElement('Canvas', () => Canvas);\n\n@Component({\n\tselector: 'NgtCanvas',\n\tstandalone: true,\n\ttemplate: `\n\t\t<GridLayout>\n\t\t\t<Canvas #canvas style=\"width: 100%; height: auto\" (ready)=\"onReady($event)\"></Canvas>\n\t\t</GridLayout>\n\t`,\n\tproviders: [{ provide: DOCUMENT, useValue: document }, provideStore()],\n\tschemas: [NO_ERRORS_SCHEMA],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NgtCanvasNative {\n\tsceneGraph = input.required<Type<any>, Type<any> | 'routed'>({\n\t\ttransform: (value) => {\n\t\t\tif (value === 'routed') return NgtRoutedScene;\n\t\t\treturn value;\n\t\t},\n\t});\n\tgl = input<NgtGLOptions>();\n\tsize = input<NgtSize>();\n\tshadows = input(false, {\n\t\ttransform: (value) => {\n\t\t\tif (value === '') return booleanAttribute(value);\n\t\t\treturn value as NonNullable<NgtCanvasOptions['shadows']>;\n\t\t},\n\t});\n\tlegacy = input(false, { transform: booleanAttribute });\n\tlinear = input(false, { transform: booleanAttribute });\n\tflat = input(false, { transform: booleanAttribute });\n\torthographic = input(false, { transform: booleanAttribute });\n\tframeloop = input<NonNullable<NgtCanvasOptions['frameloop']>>('always');\n\tperformance = input<Partial<Omit<NgtPerformance, 'regress'>>>();\n\tdpr = input<NgtDpr>([1, 2]);\n\traycaster = input<Partial<Raycaster>>();\n\tscene = input<Scene | Partial<Scene>>();\n\tcamera = input<NonNullable<NgtCanvasOptions['camera']>>();\n\tlookAt = input<Vector3 | Parameters<Vector3['set']>>();\n\tcreated = output<NgtState>();\n\n\tprivate store = injectStore();\n\tprivate initRoot = injectCanvasRootInitializer();\n\tprivate injector = inject(Injector);\n\tprivate environmentInjector = inject(EnvironmentInjector);\n\tprivate destroyRef = inject(DestroyRef);\n\tprivate zone = inject(NgZone);\n\n\tprivate canvasViewContainerRef = viewChild.required('canvas', { read: ViewContainerRef });\n\n\tprivate configurator?: NgtCanvasConfigurator;\n\tprivate glEnvironmentInjector?: EnvironmentInjector;\n\tprivate glRef?: ComponentRef<any>;\n\n\tconstructor() {\n\t\tthis.destroyRef.onDestroy(() => {\n\t\t\tthis.glRef?.destroy();\n\t\t\tthis.glEnvironmentInjector?.destroy();\n\t\t\tthis.configurator?.destroy();\n\t\t});\n\t}\n\n\tonReady(event: any) {\n\t\tconst canvas = event.object;\n\t\tconst dpr = makeDpr(untracked(this.dpr), window);\n\t\tconst canvasWidth = canvas.clientWidth * dpr;\n\t\tconst canvasHeight = canvas.clientHeight * dpr;\n\t\tObject.assign(canvas, { width: canvasWidth, height: canvasHeight });\n\n\t\tconst context = canvas.getContext('webgl2');\n\t\tconst gl = new WebGLRenderer({\n\t\t\tcanvas,\n\t\t\tcontext: context as unknown as WebGLRenderingContext,\n\t\t\tpowerPreference: 'high-performance',\n\t\t\tantialias: true,\n\t\t\talpha: true,\n\t\t\t...untracked(this.gl),\n\t\t});\n\t\tgl.setSize(canvasWidth, canvasHeight);\n\n\t\tthis.zone.runOutsideAngular(() => {\n\t\t\tthis.configurator = this.initRoot(canvas);\n\t\t\tthis.configurator.configure({\n\t\t\t\tgl,\n\t\t\t\tsize: { width: canvasWidth, height: canvasHeight, top: 0, left: 0 },\n\t\t\t\tshadows: untracked(this.shadows),\n\t\t\t\tlegacy: untracked(this.legacy),\n\t\t\t\tlinear: untracked(this.linear),\n\t\t\t\tflat: untracked(this.flat),\n\t\t\t\torthographic: untracked(this.orthographic),\n\t\t\t\tframeloop: untracked(this.frameloop),\n\t\t\t\tperformance: untracked(this.performance),\n\t\t\t\tdpr: untracked(this.dpr),\n\t\t\t\traycaster: untracked(this.raycaster),\n\t\t\t\tscene: untracked(this.scene),\n\t\t\t\tcamera: untracked(this.camera),\n\t\t\t\tlookAt: untracked(this.lookAt),\n\t\t\t});\n\t\t\tuntracked(this.noZoneRender.bind(this));\n\t\t});\n\t}\n\n\tprivate noZoneRender() {\n\t\t// NOTE: destroy previous instances if existed\n\t\tthis.glEnvironmentInjector?.destroy();\n\t\tthis.glRef?.destroy();\n\n\t\t// NOTE: Flag the canvas active, rendering will now begin\n\t\tthis.store.update((state) => ({ internal: { ...state.internal, active: true } }));\n\n\t\t// emit created event if observed\n\t\tthis.created.emit(this.store.snapshot);\n\n\t\tthis.glEnvironmentInjector = createEnvironmentInjector(\n\t\t\t[{ provide: DOCUMENT, useValue: document }, provideNgtRenderer(this.store)],\n\t\t\tthis.environmentInjector,\n\t\t);\n\t\tthis.glRef = untracked(this.canvasViewContainerRef).createComponent(untracked(this.sceneGraph), {\n\t\t\tenvironmentInjector: this.glEnvironmentInjector,\n\t\t\tinjector: this.injector,\n\t\t});\n\n\t\tthis.glRef.changeDetectorRef.detectChanges();\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAyCA,eAAe,CAAC,QAAQ,EAAE,MAAM,MAAM,CAAC;MAc1B,eAAe,CAAA;AAyC3B,IAAA,WAAA,GAAA;AAxCA,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAkC;AAC5D,YAAA,SAAS,EAAE,CAAC,KAAK,K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