@galacean/engine-core 1.6.7 → 1.6.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-core",
3
- "version": "1.6.7",
3
+ "version": "1.6.9",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -18,10 +18,10 @@
18
18
  "types/**/*"
19
19
  ],
20
20
  "dependencies": {
21
- "@galacean/engine-math": "1.6.7"
21
+ "@galacean/engine-math": "1.6.9"
22
22
  },
23
23
  "devDependencies": {
24
- "@galacean/engine-design": "1.6.7"
24
+ "@galacean/engine-design": "1.6.9"
25
25
  },
26
26
  "scripts": {
27
27
  "b:types": "tsc"
@@ -1,6 +1,4 @@
1
- import { Component } from "./Component";
2
- import { Entity } from "./Entity";
3
- type ComponentConstructor = new (entity: Entity) => Component;
1
+ import { ComponentConstructor } from "./Entity";
4
2
  /**
5
3
  * Declare dependent component.
6
4
  * @param component - Dependent component
@@ -22,4 +20,3 @@ export declare enum DependentMode {
22
20
  /** Auto add if dependent components do not exist. */
23
21
  AutoAdd = 1
24
22
  }
25
- export {};
package/types/Entity.d.ts CHANGED
@@ -68,27 +68,27 @@ export declare class Entity extends EngineObject {
68
68
  * @param args - The arguments of the component
69
69
  * @returns The component which has been added
70
70
  */
71
- addComponent<T extends new (entity: Entity, ...args: any[]) => Component>(type: T, ...args: ComponentArguments<T>): InstanceType<T>;
71
+ addComponent<T extends ComponentConstructor>(type: T, ...args: ComponentArguments<T>): InstanceType<T>;
72
72
  /**
73
73
  * Get component which match the type.
74
74
  * @param type - The type of the component
75
75
  * @returns The first component which match type
76
76
  */
77
- getComponent<T extends Component>(type: new (entity: Entity) => T): T | null;
77
+ getComponent<T extends Component>(type: ComponentConstructor<T>): T | null;
78
78
  /**
79
79
  * Get components which match the type.
80
80
  * @param type - The type of the component
81
81
  * @param results - The components which match type
82
82
  * @returns The components which match type
83
83
  */
84
- getComponents<T extends Component>(type: new (entity: Entity) => T, results: T[]): T[];
84
+ getComponents<T extends Component>(type: ComponentConstructor<T>, results: T[]): T[];
85
85
  /**
86
86
  * Get the components which match the type of the entity and it's children.
87
87
  * @param type - The component type
88
88
  * @param results - The components collection
89
89
  * @returns The components collection which match the type
90
90
  */
91
- getComponentsIncludeChildren<T extends Component>(type: new (entity: Entity) => T, results: T[]): T[];
91
+ getComponentsIncludeChildren<T extends Component>(type: ComponentConstructor<T>, results: T[]): T[];
92
92
  /**
93
93
  * Add child entity.
94
94
  * @param child - The child entity which want to be added
@@ -166,6 +166,5 @@ export declare class Entity extends EngineObject {
166
166
  */
167
167
  getInvModelMatrix(): Matrix;
168
168
  }
169
- type ComponentArguments<T extends new (entity: Entity, ...args: any[]) => Component> = T extends new (entity: Entity, ...args: infer P) => Component ? P : never;
170
- type ComponentConstructor = new (entity: Entity) => Component;
171
- export {};
169
+ export type ComponentArguments<T extends new (entity: Entity, ...args: any[]) => Component> = T extends new (entity: Entity, ...args: infer P) => Component ? P : never;
170
+ export type ComponentConstructor<T extends Component = Component> = new (entity: Entity, ...args: any[]) => T;
@@ -1,6 +1,6 @@
1
1
  import { EngineObject } from "../base/EngineObject";
2
2
  import { Component } from "../Component";
3
- import { Entity } from "../Entity";
3
+ import { ComponentConstructor } from "../Entity";
4
4
  import { AnimationClipCurveBinding } from "./AnimationClipCurveBinding";
5
5
  import { AnimationCurve } from "./animationCurve/AnimationCurve";
6
6
  import { AnimationEvent } from "./AnimationEvent";
@@ -51,7 +51,7 @@ export declare class AnimationClip extends EngineObject {
51
51
  * @param propertyPath - The path to the property being animated, support "a.b" and "a.b[x]" description mode
52
52
  * @param curve - The animation curve
53
53
  */
54
- addCurveBinding<T extends Component>(entityPath: string, componentType: new (entity: Entity) => T, propertyPath: string, curve: AnimationCurve<KeyframeValueType>): void;
54
+ addCurveBinding<T extends Component>(entityPath: string, componentType: ComponentConstructor<T>, propertyPath: string, curve: AnimationCurve<KeyframeValueType>): void;
55
55
  /**
56
56
  * Add curve binding for the clip.
57
57
  * @param entityPath - Path to the game object this curve applies to. The entityPath is formatted similar to a pathname, e.g. "/root/spine/leftArm"
@@ -60,7 +60,7 @@ export declare class AnimationClip extends EngineObject {
60
60
  * @param getPropertyPath - The path to get the value when being animated, support "a.b", "a.b[x]" and "a.b('c', 0, $value)" description mode
61
61
  * @param curve - The animation curve
62
62
  */
63
- addCurveBinding<T extends Component>(entityPath: string, componentType: new (entity: Entity) => T, setPropertyPath: string, getPropertyPath: string, curve: AnimationCurve<KeyframeValueType>): void;
63
+ addCurveBinding<T extends Component>(entityPath: string, componentType: ComponentConstructor<T>, setPropertyPath: string, getPropertyPath: string, curve: AnimationCurve<KeyframeValueType>): void;
64
64
  /**
65
65
  * Add curve binding for the clip.
66
66
  * @param entityPath - Path to the game object this curve applies to. The entityPath is formatted similar to a pathname, e.g. "/root/spine/leftArm"
@@ -69,7 +69,7 @@ export declare class AnimationClip extends EngineObject {
69
69
  * @param propertyPath - The path to the property being animated, support "a.b" and "a.b[x]" description mode
70
70
  * @param curve - The animation curve
71
71
  */
72
- addCurveBinding<T extends Component>(entityPath: string, componentType: new (entity: Entity) => T, componentIndex: number, propertyPath: string, curve: AnimationCurve<KeyframeValueType>): void;
72
+ addCurveBinding<T extends Component>(entityPath: string, componentType: ComponentConstructor<T>, componentIndex: number, propertyPath: string, curve: AnimationCurve<KeyframeValueType>): void;
73
73
  /**
74
74
  * Add curve binding for the clip.
75
75
  * @param entityPath - Path to the game object this curve applies to. The entityPath is formatted similar to a pathname, e.g. "/root/spine/leftArm"
@@ -79,7 +79,7 @@ export declare class AnimationClip extends EngineObject {
79
79
  * @param getPropertyPath - The path to get the value when being animated, support "a.b", "a.b[x]" and "a.b('c', 0, $value)" description mode
80
80
  * @param curve - The animation curve
81
81
  */
82
- addCurveBinding<T extends Component>(entityPath: string, componentType: new (entity: Entity) => T, componentIndex: number, setPropertyPath: string, getPropertyPath: string, curve: AnimationCurve<KeyframeValueType>): void;
82
+ addCurveBinding<T extends Component>(entityPath: string, componentType: ComponentConstructor<T>, componentIndex: number, setPropertyPath: string, getPropertyPath: string, curve: AnimationCurve<KeyframeValueType>): void;
83
83
  /**
84
84
  * Clears all curve bindings from the clip.
85
85
  */
@@ -1,5 +1,4 @@
1
- import { Component } from "../Component";
2
- import { Entity } from "../Entity";
1
+ import { ComponentConstructor } from "../Entity";
3
2
  import { KeyframeValueType } from "./Keyframe";
4
3
  import { AnimationCurve } from "./animationCurve";
5
4
  /**
@@ -12,7 +11,7 @@ export declare class AnimationClipCurveBinding {
12
11
  */
13
12
  relativePath: string;
14
13
  /** The class type of the component that is animated. */
15
- type: new (entity: Entity) => Component;
14
+ type: ComponentConstructor;
16
15
  /** The index of the component that is animated. */
17
16
  typeIndex: number;
18
17
  /**
package/types/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export { Transform, TransformModifyFlags } from "./Transform";
15
15
  export { BoolUpdateFlag } from "./BoolUpdateFlag";
16
16
  export type { EngineSettings } from "./EngineSettings";
17
17
  export type { EngineConfiguration } from "./Engine";
18
+ export type { ComponentConstructor } from "./Entity";
18
19
  export { request } from "./asset/request";
19
20
  export type { RequestConfig } from "./asset/request";
20
21
  export { Loader } from "./asset/Loader";