fix(core): Cocos Creator 兼容性 - 类型导出修复

- 将 export interface 转换为 export type 以兼容 Rollup
- 分离类型导入/导出使用 import type 和 export type
- 修复 QueryCondition, QueryResult, SupportedTypedArray 等类型的重导出
This commit is contained in:
yhh
2025-12-22 14:54:38 +08:00
parent 66d9f428b3
commit 2381919a5c
53 changed files with 154 additions and 145 deletions

View File

@@ -18,7 +18,7 @@ const updatableMetadata = new WeakMap<Constructor, UpdatableMetadata>();
/** /**
* 可注入元数据接口 * 可注入元数据接口
*/ */
export interface InjectableMetadata { export type InjectableMetadata = {
/** /**
* 是否可注入 * 是否可注入
*/ */
@@ -39,7 +39,7 @@ export interface InjectableMetadata {
/** /**
* 可更新元数据接口 * 可更新元数据接口
*/ */
export interface UpdatableMetadata { export type UpdatableMetadata = {
/** /**
* 是否可更新 * 是否可更新
*/ */

View File

@@ -51,7 +51,7 @@ export enum PluginState {
* } * }
* ``` * ```
*/ */
export interface IPlugin { export type IPlugin = {
/** /**
* 插件唯一名称 * 插件唯一名称
* *
@@ -96,7 +96,7 @@ export interface IPlugin {
/** /**
* 插件元数据 * 插件元数据
*/ */
export interface IPluginMetadata { export type IPluginMetadata = {
/** /**
* 插件名称 * 插件名称
*/ */

View File

@@ -28,7 +28,7 @@
* Note: __phantom is a required property to ensure TypeScript preserves generic * Note: __phantom is a required property to ensure TypeScript preserves generic
* type information across packages. * type information across packages.
*/ */
export interface ServiceToken<T> { export type ServiceToken<T> = {
readonly id: symbol; readonly id: symbol;
readonly name: string; readonly name: string;
/** /**

View File

@@ -39,7 +39,7 @@ import { createServiceToken } from './PluginServiceRegistry';
* 运行时模式接口 * 运行时模式接口
* Runtime mode interface * Runtime mode interface
*/ */
export interface IRuntimeMode { export type IRuntimeMode = {
/** /**
* 是否为编辑器模式 * 是否为编辑器模式
* Whether in editor mode * Whether in editor mode
@@ -110,7 +110,7 @@ type ModeChangeCallback = (mode: IRuntimeMode) => void;
* 运行时模式服务配置 * 运行时模式服务配置
* Runtime mode service configuration * Runtime mode service configuration
*/ */
export interface RuntimeModeConfig { export type RuntimeModeConfig = {
/** 是否为编辑器模式 | Whether in editor mode */ /** 是否为编辑器模式 | Whether in editor mode */
isEditor?: boolean; isEditor?: boolean;
/** 是否正在播放 | Whether playing */ /** 是否正在播放 | Whether playing */

View File

@@ -7,7 +7,7 @@ const logger = createLogger('ServiceContainer');
* 服务基础接口 * 服务基础接口
* 所有通过 ServiceContainer 管理的服务都应该实现此接口 * 所有通过 ServiceContainer 管理的服务都应该实现此接口
*/ */
export interface IService { export type IService = {
/** /**
* 释放服务占用的资源 * 释放服务占用的资源
* 当服务被注销或容器被清空时调用 * 当服务被注销或容器被清空时调用

View File

@@ -11,7 +11,7 @@ export type ArchetypeId = BitMask64Data;
/** /**
* 原型数据结构 * 原型数据结构
*/ */
export interface Archetype { export type Archetype = {
/** 原型唯一标识符 */ /** 原型唯一标识符 */
id: ArchetypeId; id: ArchetypeId;
/** 包含的组件类型 */ /** 包含的组件类型 */
@@ -23,7 +23,7 @@ export interface Archetype {
/** /**
* 原型查询结果 * 原型查询结果
*/ */
export interface ArchetypeQueryResult { export type ArchetypeQueryResult = {
/** 匹配的原型列表 */ /** 匹配的原型列表 */
archetypes: Archetype[]; archetypes: Archetype[];
/** 所有匹配实体的总数 */ /** 所有匹配实体的总数 */

View File

@@ -25,7 +25,7 @@ export enum CommandType {
* 延迟命令接口 * 延迟命令接口
* Deferred command interface * Deferred command interface
*/ */
export interface DeferredCommand { export type DeferredCommand = {
/** 命令类型 | Command type */ /** 命令类型 | Command type */
type: CommandType; type: CommandType;
/** 目标实体 | Target entity */ /** 目标实体 | Target entity */

View File

@@ -1,6 +1,7 @@
import { Component } from '../Component'; import { Component } from '../Component';
import { BitMask64Utils, BitMask64Data } from '../Utils/BigIntCompatibility'; import { BitMask64Utils, BitMask64Data } from '../Utils/BigIntCompatibility';
import { SoAStorage, SupportedTypedArray } from './SoAStorage'; import { SoAStorage } from './SoAStorage';
import type { SupportedTypedArray } from './SoAStorage';
import { createLogger } from '../../Utils/Logger'; import { createLogger } from '../../Utils/Logger';
import { getComponentTypeName, ComponentType } from '../Decorators'; import { getComponentTypeName, ComponentType } from '../Decorators';
import { ComponentRegistry, GlobalComponentRegistry } from './ComponentStorage/ComponentRegistry'; import { ComponentRegistry, GlobalComponentRegistry } from './ComponentStorage/ComponentRegistry';

View File

@@ -43,7 +43,7 @@ export const COMPONENT_EDITOR_OPTIONS = Symbol('ComponentEditorOptions');
* 组件编辑器选项 * 组件编辑器选项
* Component editor options * Component editor options
*/ */
export interface ComponentEditorOptions { export type ComponentEditorOptions = {
/** /**
* 是否在 Inspector 中隐藏此组件 * 是否在 Inspector 中隐藏此组件
* Whether to hide this component in Inspector * Whether to hide this component in Inspector
@@ -72,7 +72,7 @@ export interface ComponentEditorOptions {
* 使用 Symbol 索引签名来类型安全地访问装饰器存储的元数据 * 使用 Symbol 索引签名来类型安全地访问装饰器存储的元数据
* Uses Symbol index signature to safely access decorator-stored metadata * Uses Symbol index signature to safely access decorator-stored metadata
*/ */
export interface ComponentTypeMetadata { export type ComponentTypeMetadata = {
readonly [COMPONENT_TYPE_NAME]?: string; readonly [COMPONENT_TYPE_NAME]?: string;
readonly [COMPONENT_DEPENDENCIES]?: string[]; readonly [COMPONENT_DEPENDENCIES]?: string[];
readonly [COMPONENT_EDITOR_OPTIONS]?: ComponentEditorOptions; readonly [COMPONENT_EDITOR_OPTIONS]?: ComponentEditorOptions;
@@ -82,7 +82,7 @@ export interface ComponentTypeMetadata {
* 可写的组件类型元数据(用于装饰器设置) * 可写的组件类型元数据(用于装饰器设置)
* Writable component type metadata (for decorator setting) * Writable component type metadata (for decorator setting)
*/ */
export interface WritableComponentTypeMetadata { export type WritableComponentTypeMetadata = {
[COMPONENT_TYPE_NAME]?: string; [COMPONENT_TYPE_NAME]?: string;
[COMPONENT_DEPENDENCIES]?: string[]; [COMPONENT_DEPENDENCIES]?: string[];
[COMPONENT_EDITOR_OPTIONS]?: ComponentEditorOptions; [COMPONENT_EDITOR_OPTIONS]?: ComponentEditorOptions;

View File

@@ -16,7 +16,7 @@ import type { ComponentType } from './ComponentTypeUtils';
* Component Registry Interface. * Component Registry Interface.
* 组件注册表接口。 * 组件注册表接口。
*/ */
export interface IComponentRegistry { export type IComponentRegistry = {
/** /**
* Register component type and allocate bitmask. * Register component type and allocate bitmask.
* 注册组件类型并分配位掩码。 * 注册组件类型并分配位掩码。

View File

@@ -13,7 +13,7 @@ export type AsyncEventHandler<T> = (event: T) => Promise<void>;
/** /**
* 事件监听器配置 * 事件监听器配置
*/ */
export interface EventListenerConfig { export type EventListenerConfig = {
/** 是否只执行一次 */ /** 是否只执行一次 */
once?: boolean; once?: boolean;
/** 优先级(数字越大优先级越高) */ /** 优先级(数字越大优先级越高) */
@@ -41,7 +41,7 @@ interface InternalEventListener {
/** /**
* 事件统计信息 * 事件统计信息
*/ */
export interface EventStats { export type EventStats = {
/** 事件类型 */ /** 事件类型 */
eventType: string; eventType: string;
/** 监听器数量 */ /** 监听器数量 */
@@ -59,7 +59,7 @@ export interface EventStats {
/** /**
* 事件批处理配置 * 事件批处理配置
*/ */
export interface EventBatchConfig { export type EventBatchConfig = {
/** 批处理大小 */ /** 批处理大小 */
batchSize: number; batchSize: number;
/** 批处理延迟(毫秒) */ /** 批处理延迟(毫秒) */

View File

@@ -1,2 +1,3 @@
export { EventBus, GlobalEventBus } from '../EventBus'; export { EventBus, GlobalEventBus } from '../EventBus';
export { TypeSafeEventSystem, EventListenerConfig, EventStats } from '../EventSystem'; export { TypeSafeEventSystem } from '../EventSystem';
export type { EventListenerConfig, EventStats } from '../EventSystem';

View File

@@ -6,10 +6,12 @@ import { createLogger } from '../../Utils/Logger';
import { getComponentTypeName } from '../Decorators'; import { getComponentTypeName } from '../Decorators';
import { Archetype, ArchetypeSystem } from './ArchetypeSystem'; import { Archetype, ArchetypeSystem } from './ArchetypeSystem';
import { ReactiveQuery, ReactiveQueryConfig } from './ReactiveQuery'; import { ReactiveQuery, ReactiveQueryConfig } from './ReactiveQuery';
import { QueryCondition, QueryConditionType, QueryResult } from './QueryTypes'; import type { QueryCondition, QueryResult } from './QueryTypes';
import { QueryConditionType } from './QueryTypes';
import { CompiledQuery } from './Query/CompiledQuery'; import { CompiledQuery } from './Query/CompiledQuery';
export { QueryCondition, QueryConditionType, QueryResult }; export { QueryConditionType };
export type { QueryCondition, QueryResult };
export { CompiledQuery }; export { CompiledQuery };
/** /**

View File

@@ -17,7 +17,7 @@ export enum QueryConditionType {
/** /**
* 查询条件接口 * 查询条件接口
*/ */
export interface QueryCondition { export type QueryCondition = {
type: QueryConditionType; type: QueryConditionType;
componentTypes: ComponentType[]; componentTypes: ComponentType[];
mask: BitMask64Data; mask: BitMask64Data;
@@ -26,7 +26,7 @@ export interface QueryCondition {
/** /**
* 实体查询结果接口 * 实体查询结果接口
*/ */
export interface QueryResult { export type QueryResult = {
entities: readonly Entity[]; entities: readonly Entity[];
count: number; count: number;
/** 查询执行时间(毫秒) */ /** 查询执行时间(毫秒) */

View File

@@ -1,5 +1,6 @@
import { Entity } from '../Entity'; import { Entity } from '../Entity';
import { QueryCondition, QueryConditionType } from './QueryTypes'; import type { QueryCondition } from './QueryTypes';
import { QueryConditionType } from './QueryTypes';
import { BitMask64Utils } from '../Utils/BigIntCompatibility'; import { BitMask64Utils } from '../Utils/BigIntCompatibility';
import { createLogger } from '../../Utils/Logger'; import { createLogger } from '../../Utils/Logger';
@@ -20,7 +21,7 @@ export enum ReactiveQueryChangeType {
/** /**
* 响应式查询变化事件 * 响应式查询变化事件
*/ */
export interface ReactiveQueryChange { export type ReactiveQueryChange = {
/** 变化类型 */ /** 变化类型 */
type: ReactiveQueryChangeType; type: ReactiveQueryChangeType;
/** 变化的实体 */ /** 变化的实体 */
@@ -41,7 +42,7 @@ export type ReactiveQueryListener = (change: ReactiveQueryChange) => void;
/** /**
* 响应式查询配置 * 响应式查询配置
*/ */
export interface ReactiveQueryConfig { export type ReactiveQueryConfig = {
/** 是否启用批量模式(减少通知频率) */ /** 是否启用批量模式(减少通知频率) */
enableBatchMode?: boolean; enableBatchMode?: boolean;
/** 批量模式的延迟时间(毫秒) */ /** 批量模式的延迟时间(毫秒) */

View File

@@ -54,7 +54,7 @@ const WeakRefImpl: IWeakRefConstructor = (
/** /**
* Entity引用记录 * Entity引用记录
*/ */
export interface EntityRefRecord { export type EntityRefRecord = {
component: IWeakRef<Component>; component: IWeakRef<Component>;
propertyKey: string; propertyKey: string;
} }

View File

@@ -8,7 +8,7 @@ import {
import { SoASerializer } from './SoASerializer'; import { SoASerializer } from './SoASerializer';
// 重新导出类型,保持向后兼容 // 重新导出类型,保持向后兼容
export { SupportedTypedArray, TypedArrayTypeName } from './SoATypeRegistry'; export type { SupportedTypedArray, TypedArrayTypeName } from './SoATypeRegistry';
export { SoATypeRegistry } from './SoATypeRegistry'; export { SoATypeRegistry } from './SoATypeRegistry';
export { SoASerializer } from './SoASerializer'; export { SoASerializer } from './SoASerializer';

View File

@@ -40,7 +40,7 @@ export type TypedArrayTypeName =
/** /**
* 字段元数据 * 字段元数据
*/ */
export interface FieldMetadata { export type FieldMetadata = {
name: string; name: string;
type: 'number' | 'boolean' | 'string' | 'object'; type: 'number' | 'boolean' | 'string' | 'object';
arrayType?: TypedArrayTypeName; arrayType?: TypedArrayTypeName;

View File

@@ -1,4 +1,5 @@
export { ComponentPool, ComponentPoolManager } from '../ComponentPool'; export { ComponentPoolManager } from '../ComponentPool';
export type { ComponentPool } from '../ComponentPool';
export { ComponentStorage, ComponentRegistry, GlobalComponentRegistry } from '../ComponentStorage'; export { ComponentStorage, ComponentRegistry, GlobalComponentRegistry } from '../ComponentStorage';
export type { IComponentRegistry } from '../ComponentStorage'; export type { IComponentRegistry } from '../ComponentStorage';
export { EnableSoA, Float64, Float32, Int32, SerializeMap, SoAStorage } from '../SoAStorage'; export { EnableSoA, Float64, Float32, Int32, SerializeMap, SoAStorage } from '../SoAStorage';

View File

@@ -17,12 +17,8 @@
* ``` * ```
*/ */
// 从SoAStorage导入所有装饰器和类型
export { export {
// 启用装饰器
EnableSoA, EnableSoA,
// 数值类型装饰器
Float64, Float64,
Float32, Float32,
Int32, Int32,
@@ -32,13 +28,10 @@ export {
Int8, Int8,
Uint8, Uint8,
Uint8Clamped, Uint8Clamped,
// 序列化装饰器
SerializeMap, SerializeMap,
SerializeSet, SerializeSet,
SerializeArray, SerializeArray,
DeepCopy, DeepCopy
// 类型定义
SupportedTypedArray
} from './SoAStorage'; } from './SoAStorage';
export type { SupportedTypedArray } from './SoAStorage';

View File

@@ -48,7 +48,7 @@ interface GraphNode {
* 系统依赖信息 * 系统依赖信息
* System dependency info * System dependency info
*/ */
export interface SystemDependencyInfo { export type SystemDependencyInfo = {
/** 系统名称 | System name */ /** 系统名称 | System name */
name: string; name: string;
/** 在这些系统之前执行 | Execute before these systems */ /** 在这些系统之前执行 | Execute before these systems */

View File

@@ -53,7 +53,7 @@ export const DEFAULT_STAGE_ORDER: readonly SystemStage[] = [
* 系统调度元数据 * 系统调度元数据
* System scheduling metadata * System scheduling metadata
*/ */
export interface SystemSchedulingMetadata { export type SystemSchedulingMetadata = {
/** 执行阶段 | Execution stage */ /** 执行阶段 | Execution stage */
stage: SystemStage; stage: SystemStage;
/** 在这些系统之前执行 | Execute before these systems */ /** 在这些系统之前执行 | Execute before these systems */

View File

@@ -18,7 +18,7 @@ const ENTITY_REF_VALUES = Symbol('EntityRefValues');
/** /**
* EntityRef元数据 * EntityRef元数据
*/ */
export interface EntityRefMetadata { export type EntityRefMetadata = {
properties: Set<string>; properties: Set<string>;
} }

View File

@@ -1,4 +1,8 @@
import 'reflect-metadata'; /**
* 属性元数据存储
* Property metadata storage
*/
const metadataStorage = new WeakMap<Function, Record<string, unknown>>();
export type PropertyType = 'number' | 'integer' | 'string' | 'boolean' | 'color' | 'vector2' | 'vector3' | 'vector4' | 'enum' | 'asset' | 'array' | 'animationClips' | 'collisionLayer' | 'collisionMask' | 'entityRef'; export type PropertyType = 'number' | 'integer' | 'string' | 'boolean' | 'color' | 'vector2' | 'vector3' | 'vector4' | 'enum' | 'asset' | 'array' | 'animationClips' | 'collisionLayer' | 'collisionMask' | 'entityRef';
@@ -21,7 +25,7 @@ export type EnumOption = string | { label: string; value: any };
* Action button configuration for property fields * Action button configuration for property fields
* 属性字段的操作按钮配置 * 属性字段的操作按钮配置
*/ */
export interface PropertyAction { export type PropertyAction = {
/** Action identifier | 操作标识符 */ /** Action identifier | 操作标识符 */
id: string; id: string;
/** Button label | 按钮标签 */ /** Button label | 按钮标签 */
@@ -36,7 +40,7 @@ export interface PropertyAction {
* 控制关系声明 * 控制关系声明
* Control relationship declaration * Control relationship declaration
*/ */
export interface PropertyControl { export type PropertyControl = {
/** 被控制的组件名称 | Target component name */ /** 被控制的组件名称 | Target component name */
component: string; component: string;
/** 被控制的属性名称 | Target property name */ /** 被控制的属性名称 | Target property name */
@@ -253,25 +257,27 @@ export const PROPERTY_METADATA = Symbol.for('@esengine/property:metadata');
*/ */
export function Property(options: PropertyOptions): PropertyDecorator { export function Property(options: PropertyOptions): PropertyDecorator {
return (target: object, propertyKey: string | symbol) => { return (target: object, propertyKey: string | symbol) => {
const constructor = target.constructor; const constructor = target.constructor as Function;
const existingMetadata = Reflect.getMetadata(PROPERTY_METADATA, constructor) || {}; const existingMetadata = metadataStorage.get(constructor) || {};
existingMetadata[propertyKey as string] = options; existingMetadata[propertyKey as string] = options;
Reflect.defineMetadata(PROPERTY_METADATA, existingMetadata, constructor); metadataStorage.set(constructor, existingMetadata);
}; };
} }
/** /**
* 获取组件类的所有属性元数据 * 获取组件类的所有属性元数据
* Get all property metadata for a component class
*/ */
export function getPropertyMetadata(target: Function): Record<string, PropertyOptions> | undefined { export function getPropertyMetadata(target: Function): Record<string, PropertyOptions> | undefined {
return Reflect.getMetadata(PROPERTY_METADATA, target); return metadataStorage.get(target) as Record<string, PropertyOptions> | undefined;
} }
/** /**
* 检查组件类是否有属性元数据 * 检查组件类是否有属性元数据
* Check if a component class has property metadata
*/ */
export function hasPropertyMetadata(target: Function): boolean { export function hasPropertyMetadata(target: Function): boolean {
return Reflect.hasMetadata(PROPERTY_METADATA, target); return metadataStorage.has(target);
} }

View File

@@ -30,7 +30,7 @@ export const SYSTEM_TYPE_NAME = Symbol('SystemTypeName');
* 系统类型元数据接口 * 系统类型元数据接口
* System type metadata interface * System type metadata interface
*/ */
export interface SystemTypeMetadata { export type SystemTypeMetadata = {
readonly [SYSTEM_TYPE_NAME]?: string; readonly [SYSTEM_TYPE_NAME]?: string;
readonly __systemMetadata__?: SystemMetadata; readonly __systemMetadata__?: SystemMetadata;
} }
@@ -74,7 +74,7 @@ type SystemConstructor<T extends EntitySystem = EntitySystem> = new (...args: an
* 组件装饰器配置选项 * 组件装饰器配置选项
* Component decorator options * Component decorator options
*/ */
export interface ComponentOptions { export type ComponentOptions = {
/** 依赖的其他组件名称列表 | List of required component names */ /** 依赖的其他组件名称列表 | List of required component names */
requires?: string[]; requires?: string[];
@@ -150,7 +150,7 @@ export function ECSComponent(typeName: string, options?: ComponentOptions) {
* System 元数据配置 * System 元数据配置
* System metadata configuration * System metadata configuration
*/ */
export interface SystemMetadata { export type SystemMetadata = {
/** /**
* 更新顺序数值越小越先执行默认0 * 更新顺序数值越小越先执行默认0
* Update order (lower values execute first, default 0) * Update order (lower values execute first, default 0)

View File

@@ -18,7 +18,7 @@ import type { IncrementalSnapshot, IncrementalSerializationOptions } from './Ser
* *
* 定义场景应该实现的核心功能和属性,使用接口而非继承提供更灵活的实现方式。 * 定义场景应该实现的核心功能和属性,使用接口而非继承提供更灵活的实现方式。
*/ */
export interface IScene { export type IScene = {
/** /**
* 场景名称 * 场景名称
*/ */
@@ -362,7 +362,7 @@ export interface IScene {
/** /**
* 场景工厂接口 * 场景工厂接口
*/ */
export interface ISceneFactory<T extends IScene> { export type ISceneFactory<T extends IScene> = {
/** /**
* 创建场景实例 * 创建场景实例
*/ */
@@ -373,7 +373,7 @@ export interface ISceneFactory<T extends IScene> {
* 场景配置接口 * 场景配置接口
* Scene configuration interface * Scene configuration interface
*/ */
export interface ISceneConfig { export type ISceneConfig = {
/** /**
* 场景名称 * 场景名称
* Scene name * Scene name

View File

@@ -14,7 +14,7 @@ import type { SerializationContext, SerializedEntityRef } from './SerializationC
export type { SerializableValue } from './ValueSerializer'; export type { SerializableValue } from './ValueSerializer';
export interface SerializedComponent { export type SerializedComponent = {
type: string; type: string;
version: number; version: number;
data: Record<string, SerializableValue>; data: Record<string, SerializableValue>;

View File

@@ -15,7 +15,7 @@ import { SerializationContext } from './SerializationContext';
/** /**
* 序列化后的实体数据 * 序列化后的实体数据
*/ */
export interface SerializedEntity { export type SerializedEntity = {
/** /**
* 实体ID运行时ID * 实体ID运行时ID
* *

View File

@@ -37,7 +37,7 @@ export enum ChangeOperation {
/** /**
* 实体变更记录 * 实体变更记录
*/ */
export interface EntityChange { export type EntityChange = {
/** 操作类型 */ /** 操作类型 */
operation: ChangeOperation; operation: ChangeOperation;
/** 实体ID */ /** 实体ID */
@@ -51,7 +51,7 @@ export interface EntityChange {
/** /**
* 组件变更记录 * 组件变更记录
*/ */
export interface ComponentChange { export type ComponentChange = {
/** 操作类型 */ /** 操作类型 */
operation: ChangeOperation; operation: ChangeOperation;
/** 实体ID */ /** 实体ID */
@@ -65,7 +65,7 @@ export interface ComponentChange {
/** /**
* 场景数据变更记录 * 场景数据变更记录
*/ */
export interface SceneDataChange { export type SceneDataChange = {
/** 操作类型 */ /** 操作类型 */
operation: ChangeOperation; operation: ChangeOperation;
/** 变更的键 */ /** 变更的键 */
@@ -79,7 +79,7 @@ export interface SceneDataChange {
/** /**
* 增量序列化数据 * 增量序列化数据
*/ */
export interface IncrementalSnapshot { export type IncrementalSnapshot = {
/** 快照版本号 */ /** 快照版本号 */
version: number; version: number;
/** 时间戳 */ /** 时间戳 */
@@ -127,7 +127,7 @@ export type IncrementalSerializationFormat = 'json' | 'binary';
/** /**
* 增量序列化选项 * 增量序列化选项
*/ */
export interface IncrementalSerializationOptions { export type IncrementalSerializationOptions = {
/** /**
* 是否包含组件数据的深度对比 * 是否包含组件数据的深度对比
* 默认true设为false可提升性能但可能漏掉组件内部字段变更 * 默认true设为false可提升性能但可能漏掉组件内部字段变更

View File

@@ -35,7 +35,7 @@ export interface SerializedPrefabEntity extends SerializedEntity {
* 预制体元数据 * 预制体元数据
* Prefab metadata * Prefab metadata
*/ */
export interface PrefabMetadata { export type PrefabMetadata = {
/** 预制体名称 | Prefab name */ /** 预制体名称 | Prefab name */
name: string; name: string;
/** 资产 GUID | Asset GUID */ /** 资产 GUID | Asset GUID */
@@ -58,7 +58,7 @@ export interface PrefabMetadata {
* 组件类型注册条目 * 组件类型注册条目
* Component type registry entry * Component type registry entry
*/ */
export interface PrefabComponentTypeEntry { export type PrefabComponentTypeEntry = {
/** 组件类型名称 | Component type name */ /** 组件类型名称 | Component type name */
typeName: string; typeName: string;
/** 组件版本号 | Component version number */ /** 组件版本号 | Component version number */
@@ -69,7 +69,7 @@ export interface PrefabComponentTypeEntry {
* 预制体数据格式 * 预制体数据格式
* Prefab data format * Prefab data format
*/ */
export interface PrefabData { export type PrefabData = {
/** 预制体格式版本号 | Prefab format version number */ /** 预制体格式版本号 | Prefab format version number */
version: number; version: number;
/** 预制体元数据 | Prefab metadata */ /** 预制体元数据 | Prefab metadata */
@@ -84,7 +84,7 @@ export interface PrefabData {
* 预制体创建选项 * 预制体创建选项
* Prefab creation options * Prefab creation options
*/ */
export interface PrefabCreateOptions { export type PrefabCreateOptions = {
/** 预制体名称 | Prefab name */ /** 预制体名称 | Prefab name */
name: string; name: string;
/** 预制体描述 | Prefab description */ /** 预制体描述 | Prefab description */
@@ -99,7 +99,7 @@ export interface PrefabCreateOptions {
* 预制体实例化选项 * 预制体实例化选项
* Prefab instantiation options * Prefab instantiation options
*/ */
export interface PrefabInstantiateOptions { export type PrefabInstantiateOptions = {
/** 父实体 ID | Parent entity ID */ /** 父实体 ID | Parent entity ID */
parentId?: number; parentId?: number;
/** 位置覆盖 | Position override */ /** 位置覆盖 | Position override */

View File

@@ -38,7 +38,7 @@ export type MigrationFunction = (
/** /**
* 场景序列化选项 * 场景序列化选项
*/ */
export interface SceneSerializationOptions { export type SceneSerializationOptions = {
/** /**
* 要序列化的组件类型列表 * 要序列化的组件类型列表
* 如果未指定,则序列化所有可序列化的组件 * 如果未指定,则序列化所有可序列化的组件
@@ -69,7 +69,7 @@ export interface SceneSerializationOptions {
/** /**
* 场景反序列化选项 * 场景反序列化选项
*/ */
export interface SceneDeserializationOptions { export type SceneDeserializationOptions = {
/** /**
* 反序列化策略 * 反序列化策略
* - 'merge': 合并到现有场景 * - 'merge': 合并到现有场景
@@ -97,7 +97,7 @@ export interface SceneDeserializationOptions {
/** /**
* 序列化后的场景数据 * 序列化后的场景数据
*/ */
export interface SerializedScene { export type SerializedScene = {
/** /**
* 场景名称 * 场景名称
*/ */

View File

@@ -6,7 +6,7 @@ import type { Component } from '../Component';
* *
* Serialized entity reference format. * Serialized entity reference format.
*/ */
export interface SerializedEntityRef { export type SerializedEntityRef = {
/** /**
* 运行时 ID向后兼容 * 运行时 ID向后兼容
* *

View File

@@ -16,7 +16,7 @@ export const SERIALIZE_OPTIONS = Symbol('SerializeOptions');
/** /**
* 可序列化配置选项 * 可序列化配置选项
*/ */
export interface SerializableOptions { export type SerializableOptions = {
/** /**
* 序列化版本号,用于数据迁移 * 序列化版本号,用于数据迁移
*/ */
@@ -31,7 +31,7 @@ export interface SerializableOptions {
/** /**
* 字段序列化配置 * 字段序列化配置
*/ */
export interface FieldSerializeOptions { export type FieldSerializeOptions = {
/** /**
* 自定义序列化器 * 自定义序列化器
*/ */
@@ -51,7 +51,7 @@ export interface FieldSerializeOptions {
/** /**
* 序列化元数据 * 序列化元数据
*/ */
export interface SerializationMetadata { export type SerializationMetadata = {
options: SerializableOptions; options: SerializableOptions;
fields: Map<string | symbol, FieldSerializeOptions>; fields: Map<string | symbol, FieldSerializeOptions>;
ignoredFields: Set<string | symbol>; ignoredFields: Set<string | symbol>;

View File

@@ -19,7 +19,7 @@ export type WorkerProcessFunction<T extends Record<string, any> = any> = (
/** /**
* Worker配置接口 * Worker配置接口
*/ */
export interface WorkerSystemConfig { export type WorkerSystemConfig = {
/** 是否启用Worker并行处理 */ /** 是否启用Worker并行处理 */
enableWorker?: boolean; enableWorker?: boolean;
/** Worker数量默认为CPU核心数自动限制在系统最大值内 */ /** Worker数量默认为CPU核心数自动限制在系统最大值内 */

View File

@@ -17,7 +17,7 @@ export type BitMask64Segment = [number,number]
* 扩展模式128+位base[lo , hi] 作为第一段segments 存储额外的 64 位段 * 扩展模式128+位base[lo , hi] 作为第一段segments 存储额外的 64 位段
* segments[0] 对应 bit 64-127segments[1] 对应 bit 128-191以此类推 * segments[0] 对应 bit 64-127segments[1] 对应 bit 128-191以此类推
*/ */
export interface BitMask64Data { export type BitMask64Data = {
base: BitMask64Segment; base: BitMask64Segment;
/** 扩展段数组,每个元素是一个 64 位段,用于超过 64 位的场景 */ /** 扩展段数组,每个元素是一个 64 位段,用于超过 64 位的场景 */
segments?: BitMask64Segment[]; segments?: BitMask64Segment[];

View File

@@ -4,7 +4,7 @@ import { getComponentTypeName } from '../Decorators';
/** /**
* 查询条件类型 * 查询条件类型
*/ */
export interface QueryCondition { export type QueryCondition = {
all: ComponentType[]; all: ComponentType[];
any: ComponentType[]; any: ComponentType[];
none: ComponentType[]; none: ComponentType[];

View File

@@ -4,6 +4,7 @@ export { EntityProcessorList } from './EntityProcessorList';
export { IdentifierPool } from './IdentifierPool'; export { IdentifierPool } from './IdentifierPool';
export { Matcher } from './Matcher'; export { Matcher } from './Matcher';
export { Bits } from './Bits'; export { Bits } from './Bits';
export { BitMask64Utils, BitMask64Data } from './BigIntCompatibility'; export { BitMask64Utils } from './BigIntCompatibility';
export type { BitMask64Data } from './BigIntCompatibility';
export { SparseSet } from './SparseSet'; export { SparseSet } from './SparseSet';
export { ComponentSparseSet } from './ComponentSparseSet'; export { ComponentSparseSet } from './ComponentSparseSet';

View File

@@ -10,7 +10,7 @@ const logger = createLogger('World');
* 全局系统接口 * 全局系统接口
* 全局系统是在World级别运行的系统不依赖特定Scene * 全局系统是在World级别运行的系统不依赖特定Scene
*/ */
export interface IGlobalSystem { export type IGlobalSystem = {
/** /**
* 系统名称 * 系统名称
*/ */
@@ -40,7 +40,7 @@ export interface IGlobalSystem {
/** /**
* World配置接口 * World配置接口
*/ */
export interface IWorldConfig { export type IWorldConfig = {
/** /**
* World名称 * World名称
*/ */

View File

@@ -7,7 +7,7 @@ const logger = createLogger('WorldManager');
/** /**
* WorldManager配置接口 * WorldManager配置接口
*/ */
export interface IWorldManagerConfig { export type IWorldManagerConfig = {
/** /**
* 最大World数量 * 最大World数量
*/ */

View File

@@ -7,10 +7,12 @@ export * from './Utils';
export * from './Decorators'; export * from './Decorators';
export * from './Components'; export * from './Components';
export { Scene } from './Scene'; export { Scene } from './Scene';
export { IScene, ISceneFactory, ISceneConfig } from './IScene'; export type { IScene, ISceneFactory, ISceneConfig } from './IScene';
export { SceneManager } from './SceneManager'; export { SceneManager } from './SceneManager';
export { World, IWorldConfig } from './World'; export { World } from './World';
export { WorldManager, IWorldManagerConfig } from './WorldManager'; export type { IWorldConfig } from './World';
export { WorldManager } from './WorldManager';
export type { IWorldManagerConfig } from './WorldManager';
export * from './Core/Events'; export * from './Core/Events';
export * from './Core/Query'; export * from './Core/Query';
export * from './Core/Storage'; export * from './Core/Storage';

View File

@@ -2,7 +2,7 @@
* 平台适配器接口 * 平台适配器接口
* 用于适配不同的运行环境(浏览器、微信小游戏、字节跳动小游戏等) * 用于适配不同的运行环境(浏览器、微信小游戏、字节跳动小游戏等)
*/ */
export interface IPlatformAdapter { export type IPlatformAdapter = {
/** /**
* 平台名称 * 平台名称
*/ */
@@ -60,7 +60,7 @@ export interface IPlatformAdapter {
/** /**
* Worker创建选项 * Worker创建选项
*/ */
export interface WorkerCreationOptions { export type WorkerCreationOptions = {
/** /**
* Worker类型 * Worker类型
*/ */
@@ -80,7 +80,7 @@ export interface WorkerCreationOptions {
/** /**
* 平台Worker接口 * 平台Worker接口
*/ */
export interface PlatformWorker { export type PlatformWorker = {
/** /**
* 发送消息到Worker * 发送消息到Worker
*/ */
@@ -110,7 +110,7 @@ export interface PlatformWorker {
/** /**
* 平台配置 * 平台配置
*/ */
export interface PlatformConfig { export type PlatformConfig = {
/** /**
* 最大Worker数量限制 * 最大Worker数量限制
*/ */
@@ -175,7 +175,7 @@ export interface PlatformConfig {
/** /**
* 平台检测结果 * 平台检测结果
*/ */
export interface PlatformDetectionResult { export type PlatformDetectionResult = {
/** /**
* 平台类型 * 平台类型
*/ */

View File

@@ -14,7 +14,7 @@ const logger = createLogger('DebugPlugin');
/** /**
* ECS 调试插件统计信息 * ECS 调试插件统计信息
*/ */
export interface ECSDebugStats { export type ECSDebugStats = {
scenes: SceneDebugInfo[]; scenes: SceneDebugInfo[];
totalEntities: number; totalEntities: number;
totalSystems: number; totalSystems: number;
@@ -24,7 +24,7 @@ export interface ECSDebugStats {
/** /**
* 场景调试信息 * 场景调试信息
*/ */
export interface SceneDebugInfo { export type SceneDebugInfo = {
name: string; name: string;
entityCount: number; entityCount: number;
systems: SystemDebugInfo[]; systems: SystemDebugInfo[];
@@ -34,7 +34,7 @@ export interface SceneDebugInfo {
/** /**
* 系统调试信息 * 系统调试信息
*/ */
export interface SystemDebugInfo { export type SystemDebugInfo = {
name: string; name: string;
enabled: boolean; enabled: boolean;
updateOrder: number; updateOrder: number;
@@ -49,7 +49,7 @@ export interface SystemDebugInfo {
/** /**
* 实体调试信息 * 实体调试信息
*/ */
export interface EntityDebugInfo { export type EntityDebugInfo = {
id: number; id: number;
name: string; name: string;
enabled: boolean; enabled: boolean;
@@ -61,7 +61,7 @@ export interface EntityDebugInfo {
/** /**
* 组件调试信息 * 组件调试信息
*/ */
export interface ComponentDebugInfo { export type ComponentDebugInfo = {
type: string; type: string;
data: any; data: any;
} }

View File

@@ -3,7 +3,7 @@
* *
* 实现此接口的服务将在每帧被Core自动调用update方法 * 实现此接口的服务将在每帧被Core自动调用update方法
*/ */
export interface IUpdatable { export type IUpdatable = {
/** /**
* 每帧更新方法 * 每帧更新方法
* *

View File

@@ -48,7 +48,7 @@ export type ComponentTypeMap<T extends readonly ComponentConstructor[]> = {
* 实体with组件的类型 * 实体with组件的类型
* 表示一个实体确定拥有某些组件 * 表示一个实体确定拥有某些组件
*/ */
export interface EntityWithComponents<T extends readonly ComponentConstructor[]> { export type EntityWithComponents<T extends readonly ComponentConstructor[]> = {
readonly id: number; readonly id: number;
readonly name: string; readonly name: string;
@@ -163,7 +163,7 @@ export type TypedEventHandler<T> = (data: T) => void | Promise<void>;
/** /**
* 系统生命周期钩子类型 * 系统生命周期钩子类型
*/ */
export interface SystemLifecycleHooks<T extends readonly ComponentConstructor[]> { export type SystemLifecycleHooks<T extends readonly ComponentConstructor[]> = {
/** /**
* 实体添加到系统时调用 * 实体添加到系统时调用
*/ */
@@ -188,7 +188,7 @@ export interface SystemLifecycleHooks<T extends readonly ComponentConstructor[]>
/** /**
* Fluent API构建器类型 * Fluent API构建器类型
*/ */
export interface TypeSafeBuilder<T> { export type TypeSafeBuilder<T> = {
/** /**
* 完成构建 * 完成构建
*/ */
@@ -198,7 +198,7 @@ export interface TypeSafeBuilder<T> {
/** /**
* 组件池类型 * 组件池类型
*/ */
export interface ComponentPool<T extends IComponent> { export type ComponentPool<T extends IComponent> = {
/** /**
* 从池中获取组件实例 * 从池中获取组件实例
*/ */
@@ -223,11 +223,11 @@ export interface ComponentPool<T extends IComponent> {
/** /**
* 实体查询条件类型 * 实体查询条件类型
*/ */
export interface TypedQueryCondition< export type TypedQueryCondition<
All extends readonly ComponentConstructor[] = [], All extends readonly ComponentConstructor[] = [],
Any extends readonly ComponentConstructor[] = [], Any extends readonly ComponentConstructor[] = [],
None extends readonly ComponentConstructor[] = [] None extends readonly ComponentConstructor[] = []
> { > = {
all: All; all: All;
any: Any; any: Any;
none: None; none: None;

View File

@@ -14,7 +14,7 @@ export * from './IUpdatable';
* 定义组件的基本契约。 * 定义组件的基本契约。
* 在 ECS 架构中,组件应该是纯数据容器,不包含业务逻辑。 * 在 ECS 架构中,组件应该是纯数据容器,不包含业务逻辑。
*/ */
export interface IComponent { export type IComponent = {
/** 组件唯一标识符 */ /** 组件唯一标识符 */
readonly id: number; readonly id: number;
/** 组件所属的实体ID */ /** 组件所属的实体ID */
@@ -49,7 +49,7 @@ export interface IComponent {
* *
* 为现有的EntitySystem类提供类型定义 * 为现有的EntitySystem类提供类型定义
*/ */
export interface ISystemBase { export type ISystemBase = {
/** 系统名称 */ /** 系统名称 */
readonly systemName: string; readonly systemName: string;
/** 更新顺序/优先级 */ /** 更新顺序/优先级 */
@@ -69,7 +69,7 @@ export interface ISystemBase {
* 事件总线接口 * 事件总线接口
* 提供类型安全的事件发布订阅机制 * 提供类型安全的事件发布订阅机制
*/ */
export interface IEventBus { export type IEventBus = {
/** /**
* 发射事件 * 发射事件
* @param eventType 事件类型 * @param eventType 事件类型
@@ -145,7 +145,7 @@ export interface IEventBus {
/** /**
* 事件监听器配置接口 * 事件监听器配置接口
*/ */
export interface IEventListenerConfig { export type IEventListenerConfig = {
/** 是否只执行一次 */ /** 是否只执行一次 */
once?: boolean; once?: boolean;
/** 优先级(数字越大优先级越高) */ /** 优先级(数字越大优先级越高) */
@@ -159,7 +159,7 @@ export interface IEventListenerConfig {
/** /**
* 事件统计信息接口 * 事件统计信息接口
*/ */
export interface IEventStats { export type IEventStats = {
/** 事件类型 */ /** 事件类型 */
eventType: string; eventType: string;
/** 监听器数量 */ /** 监听器数量 */
@@ -177,7 +177,7 @@ export interface IEventStats {
/** /**
* 事件数据基类接口 * 事件数据基类接口
*/ */
export interface IEventData { export type IEventData = {
/** 事件时间戳 */ /** 事件时间戳 */
timestamp: number; timestamp: number;
/** 事件来源 */ /** 事件来源 */
@@ -245,7 +245,7 @@ export interface IPerformanceEventData extends IEventData {
/** /**
* ECS调试配置接口 * ECS调试配置接口
*/ */
export interface IECSDebugConfig { export type IECSDebugConfig = {
/** 是否启用调试 */ /** 是否启用调试 */
enabled: boolean; enabled: boolean;
/** WebSocket服务器URL */ /** WebSocket服务器URL */
@@ -269,7 +269,7 @@ export interface IECSDebugConfig {
/** /**
* Core配置接口 * Core配置接口
*/ */
export interface ICoreConfig { export type ICoreConfig = {
/** 是否启用调试模式 */ /** 是否启用调试模式 */
debug?: boolean; debug?: boolean;
/** 调试配置 */ /** 调试配置 */
@@ -281,7 +281,7 @@ export interface ICoreConfig {
/** /**
* ECS调试数据接口 * ECS调试数据接口
*/ */
export interface IECSDebugData { export type IECSDebugData = {
/** 时间戳 */ /** 时间戳 */
timestamp: number; timestamp: number;
/** 框架版本 */ /** 框架版本 */
@@ -307,7 +307,7 @@ export interface IECSDebugData {
/** /**
* 实体层次结构节点接口 * 实体层次结构节点接口
*/ */
export interface IEntityHierarchyNode { export type IEntityHierarchyNode = {
id: number; id: number;
name: string; name: string;
active: boolean; active: boolean;
@@ -325,7 +325,7 @@ export interface IEntityHierarchyNode {
/** /**
* 实体调试数据接口 * 实体调试数据接口
*/ */
export interface IEntityDebugData { export type IEntityDebugData = {
/** 总实体数 */ /** 总实体数 */
totalEntities: number; totalEntities: number;
/** 激活实体数 */ /** 激活实体数 */
@@ -399,7 +399,7 @@ export interface IEntityDebugData {
/** /**
* 系统调试数据接口 * 系统调试数据接口
*/ */
export interface ISystemDebugData { export type ISystemDebugData = {
/** 总系统数 */ /** 总系统数 */
totalSystems: number; totalSystems: number;
/** 系统信息列表 */ /** 系统信息列表 */
@@ -422,7 +422,7 @@ export interface ISystemDebugData {
/** /**
* 性能调试数据接口 * 性能调试数据接口
*/ */
export interface IPerformanceDebugData { export type IPerformanceDebugData = {
/** ECS框架执行时间毫秒 */ /** ECS框架执行时间毫秒 */
frameTime: number; frameTime: number;
/** 引擎总帧时间(毫秒) */ /** 引擎总帧时间(毫秒) */
@@ -472,7 +472,7 @@ export interface IPerformanceDebugData {
/** /**
* 组件调试数据接口 * 组件调试数据接口
*/ */
export interface IComponentDebugData { export type IComponentDebugData = {
/** 组件类型数 */ /** 组件类型数 */
componentTypes: number; componentTypes: number;
/** 组件实例总数 */ /** 组件实例总数 */
@@ -492,7 +492,7 @@ export interface IComponentDebugData {
/** /**
* 场景调试数据接口 * 场景调试数据接口
*/ */
export interface ISceneDebugData { export type ISceneDebugData = {
/** 当前场景名称 */ /** 当前场景名称 */
currentSceneName: string; currentSceneName: string;
/** 场景是否已初始化 */ /** 场景是否已初始化 */

View File

@@ -17,7 +17,7 @@ import { Time } from '../Time';
/** /**
* 旧版 PerformanceMonitor 接口 (用于兼容) * 旧版 PerformanceMonitor 接口 (用于兼容)
*/ */
export interface ILegacyPerformanceMonitor { export type ILegacyPerformanceMonitor = {
getAllSystemStats?: () => Map<string, { getAllSystemStats?: () => Map<string, {
averageTime: number; averageTime: number;
minTime?: number; minTime?: number;
@@ -33,7 +33,7 @@ export interface ILegacyPerformanceMonitor {
/** /**
* 热点函数项(支持递归层级) * 热点函数项(支持递归层级)
*/ */
export interface IHotspotItem { export type IHotspotItem = {
name: string; name: string;
category: string; category: string;
inclusiveTime: number; inclusiveTime: number;
@@ -51,7 +51,7 @@ export interface IHotspotItem {
/** /**
* 高级性能数据接口 * 高级性能数据接口
*/ */
export interface IAdvancedProfilerData { export type IAdvancedProfilerData = {
/** 当前帧信息 */ /** 当前帧信息 */
currentFrame: { currentFrame: {
frameNumber: number; frameNumber: number;

View File

@@ -3,7 +3,7 @@ import type { LogLevel } from './Constants';
/** /**
* 日志接口 * 日志接口
*/ */
export interface ILogger { export type ILogger = {
debug(...args: unknown[]): void; debug(...args: unknown[]): void;
info(...args: unknown[]): void; info(...args: unknown[]): void;
warn(...args: unknown[]): void; warn(...args: unknown[]): void;
@@ -14,7 +14,7 @@ export interface ILogger {
/** /**
* 日志颜色配置接口 * 日志颜色配置接口
*/ */
export interface LoggerColorConfig { export type LoggerColorConfig = {
debug?: string; debug?: string;
info?: string; info?: string;
warn?: string; warn?: string;
@@ -26,7 +26,7 @@ export interface LoggerColorConfig {
/** /**
* 日志配置 * 日志配置
*/ */
export interface LoggerConfig { export type LoggerConfig = {
/** 日志级别 */ /** 日志级别 */
level: LogLevel; level: LogLevel;
/** 是否启用时间戳 */ /** 是否启用时间戳 */

View File

@@ -1,7 +1,7 @@
/** /**
* 性能监控数据 * 性能监控数据
*/ */
export interface PerformanceData { export type PerformanceData = {
/** 系统名称 */ /** 系统名称 */
name: string; name: string;
/** 执行时间(毫秒) */ /** 执行时间(毫秒) */
@@ -21,7 +21,7 @@ export interface PerformanceData {
/** /**
* 性能统计信息 * 性能统计信息
*/ */
export interface PerformanceStats { export type PerformanceStats = {
/** 总执行时间 */ /** 总执行时间 */
totalTime: number; totalTime: number;
/** 平均执行时间 */ /** 平均执行时间 */
@@ -57,7 +57,7 @@ export enum PerformanceWarningType {
/** /**
* 性能警告 * 性能警告
*/ */
export interface PerformanceWarning { export type PerformanceWarning = {
type: PerformanceWarningType; type: PerformanceWarningType;
systemName: string; systemName: string;
message: string; message: string;
@@ -71,7 +71,7 @@ export interface PerformanceWarning {
/** /**
* 性能阈值配置 * 性能阈值配置
*/ */
export interface PerformanceThresholds { export type PerformanceThresholds = {
/** 执行时间阈值(毫秒) */ /** 执行时间阈值(毫秒) */
executionTime: { executionTime: {
warning: number; warning: number;

View File

@@ -1,7 +1,7 @@
/** /**
* 可池化对象接口 * 可池化对象接口
*/ */
export interface IPoolable { export type IPoolable = {
/** /**
* 重置对象状态,准备重用 * 重置对象状态,准备重用
*/ */
@@ -11,7 +11,7 @@ export interface IPoolable {
/** /**
* 对象池统计信息 * 对象池统计信息
*/ */
export interface PoolStats { export type PoolStats = {
/** 池中对象数量 */ /** 池中对象数量 */
size: number; size: number;
/** 池的最大大小 */ /** 池的最大大小 */

View File

@@ -15,7 +15,7 @@ import { ProfileCategory } from './ProfilerTypes';
/** /**
* 自动分析配置 * 自动分析配置
*/ */
export interface AutoProfilerConfig { export type AutoProfilerConfig = {
/** 是否启用自动包装 */ /** 是否启用自动包装 */
enabled: boolean; enabled: boolean;
/** 采样间隔(毫秒),用于采样分析器 */ /** 采样间隔(毫秒),用于采样分析器 */

View File

@@ -35,7 +35,7 @@ export enum ProfileCategory {
/** /**
* 采样句柄 * 采样句柄
*/ */
export interface SampleHandle { export type SampleHandle = {
id: string; id: string;
name: string; name: string;
category: ProfileCategory; category: ProfileCategory;
@@ -47,7 +47,7 @@ export interface SampleHandle {
/** /**
* 性能采样数据 * 性能采样数据
*/ */
export interface ProfileSample { export type ProfileSample = {
id: string; id: string;
name: string; name: string;
category: ProfileCategory; category: ProfileCategory;
@@ -66,7 +66,7 @@ export interface ProfileSample {
/** /**
* 聚合后的采样统计 * 聚合后的采样统计
*/ */
export interface ProfileSampleStats { export type ProfileSampleStats = {
name: string; name: string;
category: ProfileCategory; category: ProfileCategory;
/** 包含时间(包含子调用) */ /** 包含时间(包含子调用) */
@@ -94,7 +94,7 @@ export interface ProfileSampleStats {
/** /**
* 内存快照 * 内存快照
*/ */
export interface MemorySnapshot { export type MemorySnapshot = {
timestamp: number; timestamp: number;
/** 已使用堆内存 (bytes) */ /** 已使用堆内存 (bytes) */
usedHeapSize: number; usedHeapSize: number;
@@ -111,7 +111,7 @@ export interface MemorySnapshot {
/** /**
* 计数器数据 * 计数器数据
*/ */
export interface ProfileCounter { export type ProfileCounter = {
name: string; name: string;
category: ProfileCategory; category: ProfileCategory;
value: number; value: number;
@@ -122,7 +122,7 @@ export interface ProfileCounter {
/** /**
* 单帧性能数据 * 单帧性能数据
*/ */
export interface ProfileFrame { export type ProfileFrame = {
frameNumber: number; frameNumber: number;
startTime: number; startTime: number;
endTime: number; endTime: number;
@@ -142,7 +142,7 @@ export interface ProfileFrame {
/** /**
* 分析器配置 * 分析器配置
*/ */
export interface ProfilerConfig { export type ProfilerConfig = {
/** 是否启用 */ /** 是否启用 */
enabled: boolean; enabled: boolean;
/** 最大历史帧数 */ /** 最大历史帧数 */
@@ -164,7 +164,7 @@ export interface ProfilerConfig {
/** /**
* 长任务信息 * 长任务信息
*/ */
export interface LongTaskInfo { export type LongTaskInfo = {
startTime: number; startTime: number;
duration: number; duration: number;
attribution: string[]; attribution: string[];
@@ -173,7 +173,7 @@ export interface LongTaskInfo {
/** /**
* 调用关系节点 * 调用关系节点
*/ */
export interface CallGraphNode { export type CallGraphNode = {
name: string; name: string;
category: ProfileCategory; category: ProfileCategory;
/** 被调用次数 */ /** 被调用次数 */
@@ -189,7 +189,7 @@ export interface CallGraphNode {
/** /**
* 性能分析报告 * 性能分析报告
*/ */
export interface ProfileReport { export type ProfileReport = {
startTime: number; startTime: number;
endTime: number; endTime: number;
totalFrames: number; totalFrames: number;

View File

@@ -1,4 +1,4 @@
export interface ITimer<TContext = unknown> { export type ITimer<TContext = unknown> = {
context: TContext; context: TContext;
/** /**

View File

@@ -48,7 +48,7 @@ export type { InjectableMetadata, UpdatableMetadata } from './Core/DI';
export { Emitter, FuncPack } from './Utils/Emitter'; export { Emitter, FuncPack } from './Utils/Emitter';
export { GlobalManager } from './Utils/GlobalManager'; export { GlobalManager } from './Utils/GlobalManager';
export { TimerManager } from './Utils/Timers/TimerManager'; export { TimerManager } from './Utils/Timers/TimerManager';
export { ITimer } from './Utils/Timers/ITimer'; export type { ITimer } from './Utils/Timers/ITimer';
export { Timer } from './Utils/Timers/Timer'; export { Timer } from './Utils/Timers/Timer';
// 日志系统 // 日志系统
@@ -77,7 +77,8 @@ export * from './Utils';
export * from './Types'; export * from './Types';
// 显式导出ComponentPool类解决与Types中ComponentPool接口的命名冲突 // 显式导出ComponentPool类解决与Types中ComponentPool接口的命名冲突
export { ComponentPool, ComponentPoolManager } from './ECS/Core/Storage'; export { ComponentPoolManager } from './ECS/Core/Storage';
export type { ComponentPool } from './ECS/Core/Storage';
// 平台适配 // 平台适配
export * from './Platform'; export * from './Platform';