Skip to content

Commit f785e1d

Browse files
committed
feat: use ngxtension
1 parent 36d2f58 commit f785e1d

File tree

68 files changed

+393
-366
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+393
-366
lines changed

apps/sandbox/src/app/aviator/components/airplane/pilot/pilot.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { CUSTOM_ELEMENTS_SCHEMA, Component, Input, inject } from '@angular/core';
2-
import { NgtArgs, NgtRepeat, type NgtAfterAttach, type NgtBeforeRenderEvent } from 'angular-three';
2+
import { NgtArgs, type NgtAfterAttach, type NgtBeforeRenderEvent } from 'angular-three';
3+
import { Repeat } from 'ngxtension/repeat';
34
import * as THREE from 'three';
45
import { GameService } from '../../../services/game.service';
56
import { Colors } from '../../../utils/colors';
@@ -8,7 +9,7 @@ import { Colors } from '../../../utils/colors';
89
selector: 'app-pilot',
910
standalone: true,
1011
templateUrl: './pilot.component.html',
11-
imports: [NgtArgs, NgtRepeat],
12+
imports: [NgtArgs, Repeat],
1213
schemas: [CUSTOM_ELEMENTS_SCHEMA],
1314
})
1415
export class Pilot {

apps/sandbox/src/app/aviator/components/sky/cloud/cloud.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { NgIf } from '@angular/common';
22
import { CUSTOM_ELEMENTS_SCHEMA, Component, EventEmitter, Output } from '@angular/core';
3-
import { NgtArgs, NgtRepeat, injectNgtRef, type NgtAfterAttach, type NgtBeforeRenderEvent } from 'angular-three';
3+
import { NgtArgs, injectNgtRef, type NgtAfterAttach, type NgtBeforeRenderEvent } from 'angular-three';
4+
import { Repeat } from 'ngxtension/repeat';
45
import { Colors } from '../../../utils/colors';
56

67
@Component({
78
selector: 'app-cloud',
89
standalone: true,
910
templateUrl: './cloud.component.html',
10-
imports: [NgtArgs, NgtRepeat, NgIf],
11+
imports: [NgtArgs, Repeat, NgIf],
1112
schemas: [CUSTOM_ELEMENTS_SCHEMA],
1213
})
1314
export class Cloud {

apps/sandbox/src/app/aviator/components/sky/sky.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { CUSTOM_ELEMENTS_SCHEMA, Component, inject } from '@angular/core';
2-
import { NgtArgs, NgtRepeat, type NgtBeforeRenderEvent } from 'angular-three';
2+
import { NgtArgs, type NgtBeforeRenderEvent } from 'angular-three';
3+
import { Repeat } from 'ngxtension/repeat';
34
import { GameService } from '../../services/game.service';
45
import { WorldService } from '../../services/world.service';
56
import { Cloud } from './cloud/cloud.component';
@@ -8,7 +9,7 @@ import { Cloud } from './cloud/cloud.component';
89
selector: 'app-sky',
910
standalone: true,
1011
templateUrl: './sky.component.html',
11-
imports: [NgtArgs, NgtRepeat, Cloud],
12+
imports: [NgtArgs, Cloud, Repeat],
1213
schemas: [CUSTOM_ELEMENTS_SCHEMA],
1314
})
1415
export class Sky {

apps/sandbox/src/app/skydiving/components/wind-effect.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { CUSTOM_ELEMENTS_SCHEMA, Component, computed } from '@angular/core';
2-
import { NgtArgs, NgtRepeat, injectBeforeRender, injectNgtRef, injectNgtStore } from 'angular-three';
2+
import { NgtArgs, injectBeforeRender, injectNgtRef, injectNgtStore } from 'angular-three';
33
import { NgtsInstance, NgtsInstances, PositionMesh } from 'angular-three-soba/performances';
44
import { NgtsSobaContent } from 'angular-three-soba/utils';
5+
import { Repeat } from 'ngxtension/repeat';
56
import * as THREE from 'three';
67

78
@Component({
@@ -65,7 +66,7 @@ export class WindShape {
6566
</ngts-instances>
6667
</ngt-group>
6768
`,
68-
imports: [NgtsInstances, NgtsSobaContent, NgtArgs, WindShape, NgtRepeat],
69+
imports: [NgtsInstances, NgtsSobaContent, NgtArgs, WindShape, Repeat],
6970
schemas: [CUSTOM_ELEMENTS_SCHEMA],
7071
})
7172
export class WindEffect {

libs/cannon/debug/src/lib/debug.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { Component, CUSTOM_ELEMENTS_SCHEMA, forwardRef, Input, type OnInit } from '@angular/core';
22
import { propsToBody, type BodyProps, type BodyShapeType } from '@pmndrs/cannon-worker-api';
3-
import { createInjectionToken, injectBeforeRender, NgtArgs } from 'angular-three';
3+
import { injectBeforeRender, NgtArgs } from 'angular-three';
44
import { injectNgtcPhysicsApi } from 'angular-three-cannon';
55
import type { Body, Quaternion as CQuarternion, Vec3, World } from 'cannon-es';
66
import CannonDebugger from 'cannon-es-debugger';
7+
import { createInjectionToken } from 'ngxtension/create-injection-token';
78
import * as THREE from 'three';
89

910
const q = new THREE.Quaternion();

libs/cannon/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"angular-three": "^2.0.0",
3030
"cannon-es": "^0.20.0",
3131
"cannon-es-debugger": "^1.0.0",
32+
"ngxtension": "^0.1.0",
3233
"three": ">=0.148.0"
3334
},
3435
"dependencies": {

libs/cannon/services/src/lib/body.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ import type {
2525
Triplet,
2626
VectorName,
2727
} from '@pmndrs/cannon-worker-api';
28-
import { assertInjector, injectNgtRef, type NgtAnyRecord, type NgtInjectedRef } from 'angular-three';
28+
import { injectNgtRef, type NgtAnyRecord, type NgtInjectedRef } from 'angular-three';
2929
import { injectNgtcPhysicsApi, type NgtcCannonEvents } from 'angular-three-cannon';
3030
import { injectNgtcDebugApi } from 'angular-three-cannon/debug';
31+
import { assertInjector } from 'ngxtension/assert-injector';
3132
import * as THREE from 'three';
3233

3334
export type NgtcAtomicApi<K extends AtomicName> = {

libs/cannon/services/src/lib/constraints.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import type {
55
HingeConstraintOpts,
66
PointToPointConstraintOpts,
77
} from '@pmndrs/cannon-worker-api';
8-
import { assertInjector, injectNgtRef, is, makeId, type NgtAnyRecord, type NgtInjectedRef } from 'angular-three';
8+
import { injectNgtRef, is, makeId, type NgtAnyRecord, type NgtInjectedRef } from 'angular-three';
99
import { injectNgtcPhysicsApi } from 'angular-three-cannon';
10+
import { assertInjector } from 'ngxtension/assert-injector';
1011
import * as THREE from 'three';
1112

1213
export type NgtcConstraintApi = {

libs/cannon/services/src/lib/contact-material.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { effect, runInInjectionContext, untracked, type Injector } from '@angular/core';
22
import type { ContactMaterialOptions, MaterialOptions } from '@pmndrs/cannon-worker-api';
3-
import { assertInjector, makeId, type NgtAnyRecord } from 'angular-three';
3+
import { makeId, type NgtAnyRecord } from 'angular-three';
44
import { injectNgtcPhysicsApi } from 'angular-three-cannon';
5+
import { assertInjector } from 'ngxtension/assert-injector';
56

67
export function injectContactMaterial(
78
materialB: MaterialOptions,

libs/cannon/services/src/lib/ray.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { effect, runInInjectionContext, untracked, type Injector } from '@angular/core';
22
import type { RayMode, RayOptions, RayhitEvent } from '@pmndrs/cannon-worker-api';
3-
import { assertInjector, makeId, type NgtAnyRecord } from 'angular-three';
3+
import { makeId, type NgtAnyRecord } from 'angular-three';
44
import { injectNgtcPhysicsApi } from 'angular-three-cannon';
5+
import { assertInjector } from 'ngxtension/assert-injector';
56

67
export type NgtcRayOptions = {
78
options: () => RayOptions;

libs/cannon/services/src/lib/raycast-vehicle.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { effect, runInInjectionContext, untracked, type Injector } from '@angular/core';
22
import type { WheelInfoOptions } from '@pmndrs/cannon-worker-api';
3-
import { assertInjector, injectNgtRef, type NgtAnyRecord, type NgtInjectedRef } from 'angular-three';
3+
import { injectNgtRef, type NgtAnyRecord, type NgtInjectedRef } from 'angular-three';
44
import { injectNgtcPhysicsApi } from 'angular-three-cannon';
5+
import { assertInjector } from 'ngxtension/assert-injector';
56
import * as THREE from 'three';
67
import { getUUID, subscribe } from './body';
78

libs/cannon/services/src/lib/spring.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { effect, runInInjectionContext, untracked, type Injector } from '@angular/core';
22
import type { SpringOptns } from '@pmndrs/cannon-worker-api';
3-
import { assertInjector, injectNgtRef, is, makeId, type NgtAnyRecord, type NgtInjectedRef } from 'angular-three';
3+
import { injectNgtRef, is, makeId, type NgtAnyRecord, type NgtInjectedRef } from 'angular-three';
44
import { injectNgtcPhysicsApi } from 'angular-three-cannon';
5+
import { assertInjector } from 'ngxtension/assert-injector';
56

67
export type NgtcSpringApi = {
78
setDamping: (value: number) => void;

libs/cannon/src/lib/physics.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import {
1818
type WorkerFrameMessage,
1919
type WorkerRayhitEvent,
2020
} from '@pmndrs/cannon-worker-api';
21-
import { createInjectionToken, injectBeforeRender, injectNgtStore, signalStore } from 'angular-three';
21+
import { injectBeforeRender, injectNgtStore, signalStore } from 'angular-three';
22+
import { createInjectionToken } from 'ngxtension/create-injection-token';
2223
import * as THREE from 'three';
2324

2425
const v = new THREE.Vector3();

libs/core/ng-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
"lib": {
55
"entryFile": "src/index.ts"
66
},
7-
"allowedNonPeerDependencies": ["ngx-resize", "@nx/devkit", "nx", "@phenomnomnominal/tsquery"]
7+
"allowedNonPeerDependencies": ["@nx/devkit", "nx", "@phenomnomnominal/tsquery"]
88
}

libs/core/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
"peerDependencies": {
2424
"@angular/common": "^16.0.0",
2525
"@angular/core": "^16.0.0",
26+
"ngxtension": "^0.1.0",
2627
"three": ">=0.148.0"
2728
},
2829
"dependencies": {
29-
"ngx-resize": "^2.0.0",
3030
"tslib": "^2.3.0",
3131
"@nx/devkit": "^16.0.0",
3232
"@phenomnomnominal/tsquery": "^6.0.0",
@@ -35,5 +35,11 @@
3535
"sideEffects": false,
3636
"generators": "./plugin/generators.json",
3737
"schematics": "./plugin/generators.json",
38+
"nx-migrations": {
39+
"migrations": "./migrations.json"
40+
},
41+
"ng-update": {
42+
"migrations": "./migrations.json"
43+
},
3844
"web-types": "./web-types.json"
3945
}

libs/core/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export * from './lib/canvas';
33
export * from './lib/directives/args';
44
export * from './lib/directives/key';
55
export * from './lib/directives/parent';
6-
export * from './lib/directives/repeat';
76
export { type NgtCamera, type NgtThreeEvent } from './lib/events';
87
export * from './lib/instance';
98
export * from './lib/loader';
@@ -16,9 +15,7 @@ export * from './lib/store';
1615
export * from './lib/three-types';
1716
export * from './lib/types';
1817
export * from './lib/utils/apply-props';
19-
export * from './lib/utils/assert-injector';
2018
export { createAttachFunction } from './lib/utils/attach';
21-
export * from './lib/utils/create-injection-token';
2219
export * from './lib/utils/is';
2320
export * from './lib/utils/make';
2421
export * from './lib/utils/safe-detect-changes';

libs/core/src/lib/before-render.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { DestroyRef, Injector, inject, runInInjectionContext } from '@angular/core';
2+
import { assertInjector } from 'ngxtension/assert-injector';
23
import { injectNgtStore, type NgtBeforeRenderRecord } from './store';
3-
import { assertInjector } from './utils/assert-injector';
44

55
export function injectBeforeRender(
66
cb: NgtBeforeRenderRecord['callback'],

libs/core/src/lib/canvas.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
type SimpleChanges,
2424
type Type,
2525
} from '@angular/core';
26-
import { NgxResize, provideNgxResizeOptions, type NgxResizeResult } from 'ngx-resize';
26+
import { NgxResize, provideResizeOptions, type ResizeOptions, type ResizeResult } from 'ngxtension/resize';
2727
import * as THREE from 'three';
2828
import { createPointerEvents } from './dom/events';
2929
import type { NgtCamera, NgtDomEvent, NgtEventManager } from './events';
@@ -120,7 +120,10 @@ export type NgtCanvasInputs = {
120120
</div>
121121
`,
122122
imports: [NgxResize],
123-
providers: [provideNgxResizeOptions({ emitInZone: false, emitInitialResult: true }), provideNgtStore()],
123+
providers: [
124+
provideResizeOptions({ emitInZone: false, emitInitialResult: true } as ResizeOptions),
125+
provideNgtStore(),
126+
],
124127
host: {
125128
style: 'display: block;position: relative;width: 100%;height: 100%;overflow: hidden;',
126129
'[style.pointerEvents]': 'hbPointerEvents()',
@@ -246,7 +249,7 @@ export class NgtCanvas implements OnInit, OnChanges {
246249
}
247250

248251
// NOTE: runs outside of Zone due to emitInZone: false
249-
onResize(result: NgxResizeResult) {
252+
onResize(result: ResizeResult) {
250253
if (result.width > 0 && result.height > 0) {
251254
this.resizeEffectRef?.destroy();
252255

libs/core/src/lib/directives/repeat.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

libs/core/src/lib/loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ChangeDetectorRef, Injector, effect, inject, runInInjectionContext, signal, type Signal } from '@angular/core';
2+
import { assertInjector } from 'ngxtension/assert-injector';
23
import type { GLTF } from 'three/examples/jsm/loaders/GLTFLoader';
34
import type { NgtAnyRecord } from './types';
4-
import { assertInjector } from './utils/assert-injector';
55
import { makeObjectGraph, type NgtObjectMap } from './utils/make';
66
import { safeDetectChanges } from './utils/safe-detect-changes';
77

libs/core/src/lib/loop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { createInjectionToken } from 'ngxtension/create-injection-token';
12
import { roots } from './roots';
23
import type { NgtState } from './store';
3-
import { createInjectionToken } from './utils/create-injection-token';
44
import type { NgtSignalStore } from './utils/signal-store';
55

66
export type NgtGlobalRenderCallback = (timeStamp: number) => void;

libs/core/src/lib/ref.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
type Injector,
1010
type Signal,
1111
} from '@angular/core';
12+
import { assertInjector } from 'ngxtension/assert-injector';
1213
import { getLocalState, type NgtInstanceNode } from './instance';
13-
import { assertInjector } from './utils/assert-injector';
1414
import { is } from './utils/is';
1515

1616
export type NgtInjectedRef<TElement> = ElementRef<TElement> & {
@@ -26,7 +26,7 @@ export function injectNgtRef<TElement>(
2626
initial: ElementRef<TElement> | TElement = null!,
2727
injector?: Injector,
2828
): NgtInjectedRef<TElement> {
29-
injector = assertInjector(injectNgtRef);
29+
injector = assertInjector(injectNgtRef, injector);
3030
const ref = is.ref(initial) ? initial : new ElementRef(initial as TElement);
3131
const signalRef = signal(ref.nativeElement);
3232
const readonlySignal = signalRef.asReadonly();

libs/core/src/lib/renderer/catalogue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createInjectionToken } from '../utils/create-injection-token';
1+
import { createInjectionToken } from 'ngxtension/create-injection-token';
22

33
export type NgtAnyConstructor = new (...args: any[]) => any;
44

libs/core/src/lib/roots.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { DestroyRef, effect, inject, runInInjectionContext, type EffectRef, type Injector } from '@angular/core';
2+
import { assertInjector } from 'ngxtension/assert-injector';
23
import * as THREE from 'three';
34
import type { NgtCanvasInputs } from './canvas';
45
import { prepare } from './instance';
56
import { injectNgtLoop } from './loop';
67
import { injectNgtStore, type NgtSize, type NgtState } from './store';
78
import type { NgtAnyRecord, NgtEquConfig } from './types';
89
import { applyProps } from './utils/apply-props';
9-
import { assertInjector } from './utils/assert-injector';
1010
import { is } from './utils/is';
1111
import { makeDefaultCamera, makeDefaultRenderer, makeDpr } from './utils/make';
1212
import type { NgtSignalStore } from './utils/signal-store';

libs/core/src/lib/store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import {
1010
inject,
1111
runInInjectionContext,
1212
} from '@angular/core';
13+
import { createInjectionToken } from 'ngxtension/create-injection-token';
1314
import { Subject, type Observable } from 'rxjs';
1415
import * as THREE from 'three';
1516
import type { NgtCamera, NgtDomEvent, NgtEventManager, NgtPointerCaptureTarget, NgtThreeEvent } from './events';
1617
import type { NgtInstanceNode } from './instance';
1718
import { NGT_LOOP, type NgtLoop } from './loop';
18-
import { createInjectionToken } from './utils/create-injection-token';
1919
import { is } from './utils/is';
2020
import { makeDpr } from './utils/make';
2121
import { safeDetectChanges } from './utils/safe-detect-changes';

libs/core/src/lib/utils/assert-injector.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)