Skip to content

Commit 3878557

Browse files
committed
adjust three types
1 parent f93edd1 commit 3878557

File tree

7 files changed

+69
-441
lines changed

7 files changed

+69
-441
lines changed

apps/astro-docs/astro.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,12 @@ export default defineConfig({
129129
},
130130
{
131131
label: 'Soba',
132+
collapsed: true,
132133
items: [
133134
{ label: 'Introduction', slug: 'soba/introduction' },
134135
{
135136
label: 'Abstractions',
137+
collapsed: true,
136138
items: [
137139
{ label: 'Introduction', slug: 'soba/abstractions/introduction' },
138140
{ label: 'NgtsGradientTexture', slug: 'soba/abstractions/gradient-texture' },

apps/astro-docs/package.json

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@
1111
},
1212
"dependencies": {
1313
"@analogjs/astro-angular": "^1.6.4-beta.1",
14-
"@angular-devkit/build-angular": "^18.1.1",
15-
"@angular/animations": "^18.1.1",
16-
"@angular/common": "^18.1.1",
17-
"@angular/compiler": "^18.1.1",
18-
"@angular/compiler-cli": "^18.1.1",
19-
"@angular/core": "^18.1.1",
20-
"@angular/language-service": "^18.1.1",
21-
"@angular/platform-browser": "^18.1.1",
22-
"@angular/platform-browser-dynamic": "^18.1.1",
23-
"@angular/platform-server": "^18.1.1",
2414
"@astrojs/check": "^0.8.2",
2515
"@astrojs/mdx": "^3.1.3",
2616
"@astrojs/starlight": "^0.25.1",
@@ -30,12 +20,8 @@
3020
"angular-three-postprocessing": "^2.0.0-beta.270",
3121
"angular-three-soba": "^2.0.0-beta.270",
3222
"astro": "^4.10.2",
33-
"rxjs": "^7.8.1",
3423
"sharp": "^0.32.5",
35-
"tailwindcss": "^3.4.6",
36-
"tslib": "^2.6.3",
37-
"typescript": "^5.5.3",
38-
"zone.js": "^0.14.8"
24+
"tailwindcss": "^3.4.6"
3925
},
4026
"nx": {},
4127
"devDependencies": {

apps/kitchen-sink/src/app/soba/basic/basic.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { Experience, bloom, glitch, selectedAction } from './experience';
2626
`,
2727
changeDetection: ChangeDetectionStrategy.OnPush,
2828
imports: [NgtCanvas],
29-
providers: [{ provide: 'MyTest' as any, useValue: 'test' }],
3029
host: { class: 'basic-soba' },
3130
})
3231
export default class Basic {

apps/kitchen-sink/src/app/soba/basic/experience.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,4 @@ export class Experience {
113113
Math = Math;
114114
bloom = bloom;
115115
glitch = glitch;
116-
117-
test = inject('MyTest' as any, { optional: true });
118-
119-
constructor() {
120-
console.log(this.test);
121-
}
122116
}

libs/core/src/lib/three-types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ export interface NgtNodeEventMap<TOriginal> {
178178

179179
export type NgtNodeElement<TOriginal, TConstructor> = {
180180
attach: string | string[] | NgtAttachFunction;
181-
// ref: NgtInjectedRef<TOriginal>;
182181
addEventListener<TEventKey extends keyof NgtNodeEventMap<TOriginal>>(
183182
type: TEventKey,
184183
listener: (this: NgtNodeElement<TOriginal, TConstructor>, ev: NgtNodeEventMap<TOriginal>[TEventKey]) => any,
@@ -196,7 +195,7 @@ export type NgtNode<TOriginal, TConstructor, TNoEvent = NoEvent<TOriginal>> = Ex
196195

197196
export type NgtObject3DEventsMap = {
198197
[TEvent in keyof NgtEventHandlers]-?: Parameters<NonNullable<NgtEventHandlers[TEvent]>>[0];
199-
};
198+
} & NgtNodeEventMap<NgtInstanceNode>;
200199

201200
export type NgtObject3DNode<TOriginal, TConstructor, TNoEvent = NoEvent<TOriginal>> = Expand<
202201
NgtOverwrite<
@@ -499,4 +498,5 @@ export interface ThreeElements {
499498

500499
declare global {
501500
interface HTMLElementTagNameMap extends ThreeElements {}
501+
interface HTMLElementEventMap extends NgtNodeEventMap<NgtInstanceNode> {}
502502
}

libs/core/src/lib/utils/make.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function makeId(event?: NgtIntersection): string {
2323
export function makeDpr(dpr: NgtDpr, window?: Window) {
2424
// Err on the side of progress by assuming 2x dpr if we can't detect it
2525
// This will happen in workers where window is defined but dpr isn't.
26-
const target = typeof window !== 'undefined' ? window.devicePixelRatio ?? 2 : 1;
26+
const target = typeof window !== 'undefined' ? (window.devicePixelRatio ?? 2) : 1;
2727
return Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;
2828
}
2929

@@ -48,8 +48,8 @@ export function makeCameraInstance(isOrthographic: boolean, size: NgtSize) {
4848
}
4949

5050
export type NgtObjectMap = {
51-
nodes: { [name: string]: Object3D };
52-
materials: { [name: string]: Material };
51+
nodes: Record<string, Object3D<any>>;
52+
materials: Record<string, Material>;
5353
[key: string]: any;
5454
};
5555

0 commit comments

Comments
 (0)