angular-three 2.0.0-beta.0 → 2.0.0-beta.2
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/esm2022/index.mjs +4 -1
- package/esm2022/lib/di/before-render.mjs +5 -4
- package/esm2022/lib/di/ref.mjs +10 -5
- package/esm2022/lib/loader.mjs +26 -22
- package/esm2022/lib/renderer/renderer.mjs +6 -3
- package/esm2022/lib/renderer/store.mjs +2 -1
- package/esm2022/lib/renderer/utils.mjs +10 -6
- package/esm2022/lib/stores/signal.store.mjs +28 -7
- package/esm2022/lib/stores/store.mjs +8 -10
- package/esm2022/lib/three-types.mjs +1 -1
- package/esm2022/lib/types.mjs +1 -1
- package/esm2022/lib/utils/apply-props.mjs +9 -5
- package/esm2022/lib/utils/assert-in-injection-context.mjs +14 -0
- package/esm2022/lib/utils/instance.mjs +7 -4
- package/esm2022/lib/utils/safe-detect-changes.mjs +2 -2
- package/esm2022/lib/utils/signal.mjs +24 -0
- package/esm2022/lib/utils/timing.mjs +21 -0
- package/fesm2022/angular-three.mjs +197 -107
- package/fesm2022/angular-three.mjs.map +1 -1
- package/index.d.ts +3 -0
- package/lib/di/before-render.d.ts +2 -2
- package/lib/di/ref.d.ts +2 -1
- package/lib/loader.d.ts +1 -1
- package/lib/renderer/utils.d.ts +1 -1
- package/lib/stores/signal.store.d.ts +1 -0
- package/lib/three-types.d.ts +1 -1
- package/lib/types.d.ts +3 -1
- package/lib/utils/assert-in-injection-context.d.ts +2 -0
- package/lib/utils/signal.d.ts +2 -0
- package/lib/utils/timing.d.ts +4 -0
- package/metadata.json +1 -1
- package/package.json +1 -1
- package/plugin/package.json +1 -1
- package/web-types.json +1 -1
package/index.d.ts
CHANGED
|
@@ -14,9 +14,12 @@ export * from './lib/stores/store';
|
|
|
14
14
|
export * from './lib/three-types';
|
|
15
15
|
export * from './lib/types';
|
|
16
16
|
export * from './lib/utils/apply-props';
|
|
17
|
+
export * from './lib/utils/assert-in-injection-context';
|
|
17
18
|
export { createAttachFunction } from './lib/utils/attach';
|
|
18
19
|
export * from './lib/utils/instance';
|
|
19
20
|
export * from './lib/utils/is';
|
|
20
21
|
export * from './lib/utils/make';
|
|
21
22
|
export * from './lib/utils/safe-detect-changes';
|
|
23
|
+
export * from './lib/utils/signal';
|
|
24
|
+
export * from './lib/utils/timing';
|
|
22
25
|
export * from './lib/utils/update';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Injector } from '@angular/core';
|
|
2
2
|
import { NgtBeforeRenderRecord } from '../types';
|
|
3
|
-
export declare function injectBeforeRender(cb: NgtBeforeRenderRecord['callback'], { priority, injector
|
|
3
|
+
export declare function injectBeforeRender(cb: NgtBeforeRenderRecord['callback'], { priority, injector }?: {
|
|
4
4
|
priority?: number;
|
|
5
|
-
injector?: Injector
|
|
5
|
+
injector?: Injector;
|
|
6
6
|
}): () => void;
|
package/lib/di/ref.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ import { ElementRef, Injector, Signal } from '@angular/core';
|
|
|
2
2
|
import { NgtInstanceNode } from '../types';
|
|
3
3
|
export type NgtInjectedRef<TElement> = ElementRef<TElement> & {
|
|
4
4
|
children: (type?: 'objects' | 'nonObjects' | 'both') => Signal<NgtInstanceNode[]>;
|
|
5
|
+
untracked: TElement;
|
|
5
6
|
};
|
|
6
|
-
export declare function injectNgtRef<TElement>(initial?: ElementRef<TElement> | TElement, injector?: Injector
|
|
7
|
+
export declare function injectNgtRef<TElement>(initial?: ElementRef<TElement> | TElement, injector?: Injector): NgtInjectedRef<TElement>;
|
package/lib/loader.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export type NgtLoaderResults<TInput extends string | string[] | Record<string, s
|
|
|
7
7
|
export declare function injectNgtLoader<TData, TUrl extends string | string[] | Record<string, string>, TLoaderConstructor extends NgtLoaderProto<TData>, TReturn = NgtLoaderReturnType<TData, TLoaderConstructor>>(loaderConstructorFactory: (inputs: string[]) => TLoaderConstructor, inputs: () => TUrl, { extensions, onProgress, injector, }?: {
|
|
8
8
|
extensions?: NgtLoaderExtensions<TLoaderConstructor>;
|
|
9
9
|
onProgress?: (event: ProgressEvent) => void;
|
|
10
|
-
injector?: Injector
|
|
10
|
+
injector?: Injector;
|
|
11
11
|
}): Signal<NgtLoaderResults<TUrl, NgtBranchingReturn<TReturn, GLTF, GLTF & NgtObjectMap>>>;
|
package/lib/renderer/utils.d.ts
CHANGED
|
@@ -17,6 +17,6 @@ export declare const SPECIAL_PROPERTIES: {
|
|
|
17
17
|
};
|
|
18
18
|
export declare function attachThreeChild(parent: NgtInstanceNode, child: NgtInstanceNode): void;
|
|
19
19
|
export declare function removeThreeChild(parent: NgtInstanceNode, child: NgtInstanceNode, dispose?: boolean): void;
|
|
20
|
-
export declare function processThreeEvent(instance: NgtInstanceNode, priority: number, eventName: string, callback: (event: any) => void, zone: NgZone, cdr: ChangeDetectorRef): () => void;
|
|
20
|
+
export declare function processThreeEvent(instance: NgtInstanceNode, priority: number, eventName: string, callback: (event: any) => void, zone: NgZone, cdr: ChangeDetectorRef, targetCdr?: ChangeDetectorRef | null): () => void;
|
|
21
21
|
export declare function eventToHandler(callback: (event: any) => void): (event: Parameters<Exclude<NgtEventHandlers[(typeof supportedEvents)[number]], undefined>>[0]) => void;
|
|
22
22
|
export declare function kebabToPascal(str: string): string;
|
|
@@ -14,6 +14,7 @@ export declare class NgtSignalStore<TState extends object> {
|
|
|
14
14
|
get<TKey extends keyof TState>(key: TKey): TState[TKey];
|
|
15
15
|
get(): TState;
|
|
16
16
|
set(state: Partial<TState> | ((previous: TState) => Partial<TState>)): void;
|
|
17
|
+
patch(state: Partial<TState>): void;
|
|
17
18
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgtSignalStore<any>, [{ optional: true; }]>;
|
|
18
19
|
static ɵprov: i0.ɵɵInjectableDeclaration<NgtSignalStore<any>>;
|
|
19
20
|
}
|
package/lib/three-types.d.ts
CHANGED
|
@@ -117,7 +117,7 @@ export type NgtMeshBasicMaterial = NgtMaterial<THREE.MeshBasicMaterial, [THREE.M
|
|
|
117
117
|
export type NgtMeshMatcapMaterial = NgtMaterial<THREE.MeshMatcapMaterial, [THREE.MeshMatcapMaterialParameters]>;
|
|
118
118
|
export type NgtLineDashedMaterial = NgtMaterial<THREE.LineDashedMaterial, [THREE.LineDashedMaterialParameters]>;
|
|
119
119
|
export type NgtLineBasicMaterial = NgtMaterial<THREE.LineBasicMaterial, [THREE.LineBasicMaterialParameters]>;
|
|
120
|
-
export type NgtPrimitive = NgtAnyRecord
|
|
120
|
+
export type NgtPrimitive = NgtNodeElement<NgtAnyRecord, any>;
|
|
121
121
|
export type NgtValue = NgtNode<{
|
|
122
122
|
rawValue: any;
|
|
123
123
|
}, {}>;
|
package/lib/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { ElementRef, EventEmitter, WritableSignal } from '@angular/core';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
import type { NgtSignalStore } from './stores/signal.store';
|
|
5
|
+
import { NgtObject3DNode } from './three-types';
|
|
5
6
|
export type NgtAnyRecord = Record<string, any>;
|
|
6
7
|
export type NgtProperties<T> = Pick<T, {
|
|
7
8
|
[K in keyof T]: T[K] extends (_: any) => any ? never : K;
|
|
@@ -226,6 +227,7 @@ export type NgtInstanceLocalState = {
|
|
|
226
227
|
objects: WritableSignal<NgtInstanceNode[]>;
|
|
227
228
|
add: (instance: NgtInstanceNode, type: 'objects' | 'nonObjects') => void;
|
|
228
229
|
remove: (instance: NgtInstanceNode, type: 'objects' | 'nonObjects') => void;
|
|
230
|
+
nativeProps: NgtSignalStore<NgtAnyRecord>;
|
|
229
231
|
parent: WritableSignal<NgtInstanceNode | null>;
|
|
230
232
|
primitive?: boolean;
|
|
231
233
|
eventCount: number;
|
|
@@ -292,7 +294,7 @@ export type NgtCanvasInputs = {
|
|
|
292
294
|
/** A `THREE.Scene` instance or props that go into the default scene */
|
|
293
295
|
scene?: THREE.Scene | Partial<THREE.Scene>;
|
|
294
296
|
/** A `Camera` instance or props that go into the default camera */
|
|
295
|
-
camera?: (NgtCamera | Partial<THREE.Camera>) & {
|
|
297
|
+
camera?: (NgtCamera | Partial<NgtObject3DNode<THREE.Camera, typeof THREE.Camera> & NgtObject3DNode<THREE.PerspectiveCamera, typeof THREE.PerspectiveCamera> & NgtObject3DNode<THREE.OrthographicCamera, typeof THREE.OrthographicCamera>>) & {
|
|
296
298
|
/** Flags the camera as manual, putting projection into your own hands */
|
|
297
299
|
manual?: boolean;
|
|
298
300
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
2
|
+
export declare function requestAnimationInInjectionContext(cb: () => void, injector?: Injector): number;
|
|
3
|
+
export declare function queueMicrotaskInInjectionContext(cb: () => void, injector?: Injector): void;
|
|
4
|
+
export declare function queueMacrotaskInInjectionContext(cb: () => void, injector?: Injector): number;
|