Skip to content

Commit 02bbc13

Browse files
committed
fix(soba): adjust type for all attach input to NgtAttachable
1 parent 7b7230a commit 02bbc13

File tree

9 files changed

+18
-12
lines changed

9 files changed

+18
-12
lines changed

libs/core/src/lib/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ export type NgtAttachFunction<TChild = any, TParent = any> = (
191191
store: NgtSignalStore<NgtState>,
192192
) => void | (() => void);
193193

194+
export type NgtAttachable<TChild = any, TParent = any> = NgtAttachFunction<TChild, TParent> | string | string[];
195+
194196
export interface NgtAfterAttach<
195197
TChild extends NgtInstanceNode = NgtInstanceNode,
196198
TParent extends NgtInstanceNode = NgtInstanceNode,

libs/soba/abstractions/src/lib/gradient-texture.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
input,
99
untracked,
1010
} from '@angular/core';
11-
import { extend, injectStore, NgtArgs, NgtTexture, omit } from 'angular-three';
11+
import { extend, injectStore, NgtArgs, NgtAttachable, NgtTexture, omit } from 'angular-three';
1212
import { mergeInputs } from 'ngxtension/inject-inputs';
1313
import { CanvasTexture, Color, ColorRepresentation } from 'three';
1414

@@ -46,7 +46,7 @@ const defaultOptions: NgtsGradientTextureOptions = {
4646
imports: [NgtArgs],
4747
})
4848
export class NgtsGradientTexture {
49-
attach = input('map');
49+
attach = input<NgtAttachable>('map');
5050
stops = input.required<Array<number>>();
5151
colors = input.required<Array<ColorRepresentation>>();
5252
options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });

libs/soba/materials/src/lib/custom-shader-material.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
ElementRef,
88
input,
99
} from '@angular/core';
10-
import { is, NgtAnyRecord, NgtArgs, omit, pick } from 'angular-three';
10+
import { is, NgtAnyRecord, NgtArgs, NgtAttachable, omit, pick } from 'angular-three';
1111
import { injectAutoEffect } from 'ngxtension/auto-effect';
1212
import { Material } from 'three';
1313
import CustomShaderMaterial from 'three-custom-shader-material/vanilla';
@@ -26,7 +26,7 @@ import CustomShaderMaterial from 'three-custom-shader-material/vanilla';
2626
})
2727
export class NgtsCustomShaderMaterial {
2828
baseMaterial = input.required<Material | typeof Material | ElementRef<Material>>();
29-
attach = input<string | string[]>('material');
29+
attach = input<NgtAttachable>('material');
3030
options = input({} as Omit<ConstructorParameters<typeof CustomShaderMaterial>[0], 'baseMaterial'>);
3131
parameters = omit(this.options, ['fragmentShader', 'vertexShader', 'uniforms', 'cacheKey']);
3232

libs/soba/materials/src/lib/mesh-distort-material.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ChangeDetectionStrategy, Component, CUSTOM_ELEMENTS_SCHEMA, input } from '@angular/core';
2-
import { injectBeforeRender, NgtArgs, NgtMeshPhysicalMaterial, omit, pick } from 'angular-three';
2+
import { injectBeforeRender, NgtArgs, NgtAttachable, NgtMeshPhysicalMaterial, omit, pick } from 'angular-three';
33
import { MeshDistortMaterial, MeshDistortMaterialParameters } from 'angular-three-soba/vanilla-exports';
44
import { mergeInputs } from 'ngxtension/inject-inputs';
55

@@ -27,7 +27,7 @@ const defaultOptions: NgtsMeshDistortMaterialOptions = {
2727
imports: [NgtArgs],
2828
})
2929
export class NgtsMeshDistortMaterial {
30-
attach = input('material');
30+
attach = input<NgtAttachable>('material');
3131
options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
3232
parameters = omit(this.options, ['speed']);
3333

libs/soba/materials/src/lib/mesh-reflector-material.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
injectStore,
1919
NgtAnyRecord,
2020
NgtArgs,
21+
NgtAttachable,
2122
NgtMeshStandardMaterial,
2223
omit,
2324
pick,
@@ -84,7 +85,7 @@ const defaultOptions: NgtsMeshReflectorMaterialOptions = {
8485
imports: [NgtArgs],
8586
})
8687
export class NgtsMeshReflectorMaterial {
87-
attach = input('material');
88+
attach = input<NgtAttachable>('material');
8889
options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
8990
private parameters = omit(this.options, [
9091
'distortionMap',

libs/soba/materials/src/lib/mesh-refraction-material.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
injectStore,
1818
NgtAnyRecord,
1919
NgtArgs,
20+
NgtAttachable,
2021
NgtShaderMaterial,
2122
omit,
2223
pick,
@@ -78,7 +79,7 @@ function isCubeTexture(def: CubeTexture | Texture): def is CubeTexture {
7879
})
7980
export class NgtsMeshRefractionMaterial {
8081
envMap = input.required<CubeTexture | Texture>();
81-
attach = input('material');
82+
attach = input<NgtAttachable>('material');
8283
options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
8384
parameters = omit(this.options, ['fastChroma', 'aberrationStrength']);
8485

libs/soba/materials/src/lib/mesh-transmission-material.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
injectBeforeRender,
1616
NgtAnyRecord,
1717
NgtArgs,
18+
NgtAttachable,
1819
NgtMeshPhysicalMaterial,
1920
omit,
2021
pick,
@@ -85,7 +86,7 @@ const defaultOptions: NgtsMeshTransmissionMaterialOptions = {
8586
imports: [NgtArgs],
8687
})
8788
export class NgtsMeshTransmissionMaterial {
88-
attach = input('material');
89+
attach = input<NgtAttachable>('material');
8990
options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
9091
parameters = omit(this.options, [
9192
'buffer',

libs/soba/materials/src/lib/mesh-wobble-material.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ChangeDetectionStrategy, Component, CUSTOM_ELEMENTS_SCHEMA, input } from '@angular/core';
2-
import { injectBeforeRender, NgtArgs, NgtMeshStandardMaterial, omit } from 'angular-three';
2+
import { injectBeforeRender, NgtArgs, NgtAttachable, NgtMeshStandardMaterial, omit } from 'angular-three';
33
import { MeshWobbleMaterial, MeshWobbleMaterialParameters } from 'angular-three-soba/vanilla-exports';
44
import { mergeInputs } from 'ngxtension/inject-inputs';
55

@@ -24,7 +24,7 @@ const defaultOptions: NgtsMeshWobbleMaterialOptions = {
2424
changeDetection: ChangeDetectionStrategy.OnPush,
2525
})
2626
export class NgtsMeshWobbleMaterial {
27-
attach = input('material');
27+
attach = input<NgtAttachable>('material');
2828
options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
2929
parameters = omit(this.options, ['speed']);
3030

libs/soba/staging/src/lib/render-texture.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
} from '@angular/core';
1313
import {
1414
NgtArgs,
15+
NgtAttachable,
1516
NgtComputeFunction,
1617
NgtPortal,
1718
NgtPortalContent,
@@ -161,7 +162,7 @@ let incrementId = 0;
161162
changeDetection: ChangeDetectionStrategy.OnPush,
162163
})
163164
export class NgtsRenderTexture {
164-
attach = input<string | string[]>('map');
165+
attach = input<NgtAttachable>('map');
165166
options = input(defaultOptions, { transform: mergeInputs(defaultOptions) });
166167
parameters = omit(this.options, [
167168
'samples',

0 commit comments

Comments
 (0)