UNPKG

miniprogram-api-typings

Version:

Type definitions for APIs of Wechat Mini Program in TypeScript

1,564 lines (1,544 loc) 529 kB
/*! ***************************************************************************** Copyright (c) 2025 Tencent, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ***************************************************************************** */ /// <reference path="./lib.wx.phys3D.d.ts" /> declare type HTMLCanvasElement = any declare type ImageData = any declare type HTMLImageElement = any declare module 'XrFrame' { import * as xrFrameSystem from 'XrFrame/xrFrameSystem' import { IComponentSchema, IEntityComponents } from 'XrFrame/xrFrameSystem' export { IComponentSchema, IEntityComponents, IEffectAsset, IRenderStates, ISubMesh, IVideoTextureOptions, IRenderTarget, IRenderTextureOptions, IGLTFModelOptions, IEnvDataOptions, IKeyframeAnimationData, IKeyframeAnimationInfo, IKeyframeAnimationOptions, IAtlasOptions, IAtlasCreationOptions, IPostProcessOptions, IDataValueHandler, ITextureWrapper, ITextureOptions, IEngineSettings, IHandle, IVertexLayoutOptions, IVertexDataDescriptorOptions, IUniformDescriptorOptions, IImage, IRealDownloader, IDownloader, IFontSetting, IFeatures, IRect, IViewAction, IView, IAttachment, IRenderPassDescriptor, IGlyphInfo, IEventBridge, INativeMap, ILongIntNativeMap, ITransformData, IAssetsData, ICameraData, IGLTFData, ILightData, IAssetMaterialData, IMeshData, ITextData, IAssetRenderTextureData, IEnvData, IAnimatorData, IAnimationPlayOptions, IAnimatorAutoPlay, ICameraOrbitControlData, IARTrackerData, IARTrackerRawData, IShapeData, ISphereShapeData, IMeshShapeData, ICapsuleShapeData, ICubeShapeData, IRigidbodyData, IShapeInteractData, IShapeGizmosData, IAssetPostProcessData, IParticleData, IAssetsSystemData, INodeSystemData, ITickSystemData, IAnimationSystemData, IVideoSystemData, IRenderSystemData, IPhysicsSystemData, IShapeDragEvent, IShapeTouchEvent, IARSystemData, IARRawData, IShareSystemData, IShareCaptureOptions, IShareRecordOptions, IGizmoSystemData, ILoaderOptionsSchema, ITextureLoaderOptions, IImageLoaderOptions, ICubeTextureLoaderOptions, IVideoTextureLoaderOptions, IEnvDataLoaderOptions, IGLTFLoaderOptions, IKeyframeLoaderOptions, IRawLoaderOptions, IAtlasLoaderOptions, TEventCallback, TDirection, Texture, UniformDescriptor, UniformBlock, VertexLayout, TCameraBackground, TTrackMode, EVideoState, EVertexFormat, EVertexStep, EIndexType, ETextureType, ETextureFormat, EWrapMode, EFilterMode, EUniformType, ECullMode, EFaceWinding, ECompareFunc, EStencilOp, EBlendFactor, EBlendEquation, EColorMask, EPixelType, ELoadAction, EDataModelType, EMeshRenderType, EPrimitiveType, EShadowMode, EShadowFitMode, EVertexLayoutUsage, EVertexBatchOperator, EAnimationBlendType, EUseDefaultAddedAction, EUseDefaultRetainedAction, EUseDefaultRemovedAction, EEventType, EARTrackerState, EShapeType, ECapsuleShapeDirection, EShareRecordState } from 'XrFrame/xrFrameSystem' export type Component<IData> = xrFrameSystem.Component<IData> export type Element = xrFrameSystem.Element export type EventManager = xrFrameSystem.EventManager export type Effect = xrFrameSystem.Effect export type Geometry = xrFrameSystem.Geometry export type Material = xrFrameSystem.Material export type VideoTexture = xrFrameSystem.VideoTexture export type RenderTexture = xrFrameSystem.RenderTexture export type GLTFModel = xrFrameSystem.GLTFModel export type EnvData = xrFrameSystem.EnvData export type Animation = xrFrameSystem.Animation export type KeyframeAnimation = xrFrameSystem.KeyframeAnimation export type Atlas = xrFrameSystem.Atlas export type PostProcess = xrFrameSystem.PostProcess export type Vector2 = xrFrameSystem.Vector2 export type Vector3 = xrFrameSystem.Vector3 export type Vector4 = xrFrameSystem.Vector4 export type Quaternion = xrFrameSystem.Quaternion export type Matrix3 = xrFrameSystem.Matrix3 export type Matrix4 = xrFrameSystem.Matrix4 export type Color = xrFrameSystem.Color export type OBB = xrFrameSystem.OBB export type BoundBall = xrFrameSystem.BoundBall export type BoundBox = xrFrameSystem.BoundBox export type Spherical = xrFrameSystem.Spherical export type Transform = xrFrameSystem.Transform export type AssetLoad = xrFrameSystem.AssetLoad export type Assets = xrFrameSystem.Assets export type Camera = xrFrameSystem.Camera export type GLTF = xrFrameSystem.GLTF export type Light = xrFrameSystem.Light export type AssetMaterial = xrFrameSystem.AssetMaterial export type Mesh = xrFrameSystem.Mesh export type Text = xrFrameSystem.Text export type Particle = xrFrameSystem.Particle export type AssetRenderTexture = xrFrameSystem.AssetRenderTexture export type Env = xrFrameSystem.Env export type Animator = xrFrameSystem.Animator export type CameraOrbitControl = xrFrameSystem.CameraOrbitControl export type ARTracker = xrFrameSystem.ARTracker export type Shape = xrFrameSystem.Shape export type SphereShape = xrFrameSystem.SphereShape export type MeshShape = xrFrameSystem.MeshShape export type CapsuleShape = xrFrameSystem.CapsuleShape export type CubeShape = xrFrameSystem.CubeShape export type Rigidbody = xrFrameSystem.Rigidbody export type ShapeInteract = xrFrameSystem.ShapeInteract export type ShapeGizmos = xrFrameSystem.ShapeGizmos export type AssetPostProcess = xrFrameSystem.AssetPostProcess export type Scene = xrFrameSystem.Scene export type XRNode = xrFrameSystem.XRNode export type XRShadow = xrFrameSystem.XRShadow export type XRCamera = xrFrameSystem.XRCamera export type XRMesh = xrFrameSystem.XRMesh export type XRLight = xrFrameSystem.XRLight export type XRGLTF = xrFrameSystem.XRGLTF export type XRMaterial = xrFrameSystem.XRMaterial export type XRAssetRenderTexture = xrFrameSystem.XRAssetRenderTexture export type XRAssetLoad = xrFrameSystem.XRAssetLoad export type XRAssets = xrFrameSystem.XRAssets export type XREnv = xrFrameSystem.XREnv export type XRARTracker = xrFrameSystem.XRARTracker export type XRText = xrFrameSystem.XRText export type XRParticle = xrFrameSystem.XRParticle export type XRAssetPostProcess = xrFrameSystem.XRAssetPostProcess export type AssetsSystem = xrFrameSystem.AssetsSystem export type NodeSystem = xrFrameSystem.NodeSystem export type TickSystem = xrFrameSystem.TickSystem export type AnimationSystem = xrFrameSystem.AnimationSystem export type VideoSystem = xrFrameSystem.VideoSystem export type RenderSystem = xrFrameSystem.RenderSystem export type PhysicsSystem = xrFrameSystem.PhysicsSystem export type ARSystem = xrFrameSystem.ARSystem export type ShareSystem = xrFrameSystem.ShareSystem export type GizmoSystem = xrFrameSystem.GizmoSystem export type AssetLoader<T, ILoadOptions> = xrFrameSystem.AssetLoader< T, ILoadOptions > export type TextureLoader = xrFrameSystem.TextureLoader export type ImageLoader = xrFrameSystem.ImageLoader export type CubeTextureLoader = xrFrameSystem.CubeTextureLoader export type VideoTextureLoader = xrFrameSystem.VideoTextureLoader export type EnvDataLoader = xrFrameSystem.EnvDataLoader export type GLTFLoader = xrFrameSystem.GLTFLoader export type KeyframeLoader = xrFrameSystem.KeyframeLoader export type RawLoader = xrFrameSystem.RawLoader export type AtlasLoader = xrFrameSystem.AtlasLoader export interface IXrFrameSystem { registerComponent: typeof xrFrameSystem.registerComponent registerElement: typeof xrFrameSystem.registerElement registerDataValue: typeof xrFrameSystem.registerDataValue isTextureWrapper: typeof xrFrameSystem.isTextureWrapper genLspMeta: typeof xrFrameSystem.genLspMeta registerEffect: typeof xrFrameSystem.registerEffect registerGeometry: typeof xrFrameSystem.registerGeometry registerTexture: typeof xrFrameSystem.registerTexture registerMaterial: typeof xrFrameSystem.registerMaterial registerUniformDesc: typeof xrFrameSystem.registerUniformDesc registerVertexDataDesc: typeof xrFrameSystem.registerVertexDataDesc registerVertexLayout: typeof xrFrameSystem.registerVertexLayout registerAssetLoader: typeof xrFrameSystem.registerAssetLoader Component: typeof xrFrameSystem.Component Element: typeof xrFrameSystem.Element EventManager: typeof xrFrameSystem.EventManager Effect: typeof xrFrameSystem.Effect Geometry: typeof xrFrameSystem.Geometry Material: typeof xrFrameSystem.Material VideoTexture: typeof xrFrameSystem.VideoTexture RenderTexture: typeof xrFrameSystem.RenderTexture GLTFModel: typeof xrFrameSystem.GLTFModel EnvData: typeof xrFrameSystem.EnvData Animation: typeof xrFrameSystem.Animation KeyframeAnimation: typeof xrFrameSystem.KeyframeAnimation Atlas: typeof xrFrameSystem.Atlas PostProcess: typeof xrFrameSystem.PostProcess Vector2: typeof xrFrameSystem.Vector2 Vector3: typeof xrFrameSystem.Vector3 Vector4: typeof xrFrameSystem.Vector4 Quaternion: typeof xrFrameSystem.Quaternion Matrix3: typeof xrFrameSystem.Matrix3 Matrix4: typeof xrFrameSystem.Matrix4 Color: typeof xrFrameSystem.Color OBB: typeof xrFrameSystem.OBB BoundBall: typeof xrFrameSystem.BoundBall BoundBox: typeof xrFrameSystem.BoundBox Spherical: typeof xrFrameSystem.Spherical RaycastHit: typeof xrFrameSystem.RaycastHit Transform: typeof xrFrameSystem.Transform AssetLoad: typeof xrFrameSystem.AssetLoad Assets: typeof xrFrameSystem.Assets Camera: typeof xrFrameSystem.Camera GLTF: typeof xrFrameSystem.GLTF Light: typeof xrFrameSystem.Light AssetMaterial: typeof xrFrameSystem.AssetMaterial Mesh: typeof xrFrameSystem.Mesh Text: typeof xrFrameSystem.Text Particle: typeof xrFrameSystem.Particle AssetRenderTexture: typeof xrFrameSystem.AssetRenderTexture Env: typeof xrFrameSystem.Env Animator: typeof xrFrameSystem.Animator CameraOrbitControl: typeof xrFrameSystem.CameraOrbitControl ARTracker: typeof xrFrameSystem.ARTracker Shape: typeof xrFrameSystem.Shape SphereShape: typeof xrFrameSystem.SphereShape MeshShape: typeof xrFrameSystem.MeshShape CapsuleShape: typeof xrFrameSystem.CapsuleShape CubeShape: typeof xrFrameSystem.CubeShape Rigidbody: typeof xrFrameSystem.Rigidbody ShapeInteract: typeof xrFrameSystem.ShapeInteract ShapeGizmos: typeof xrFrameSystem.ShapeGizmos AssetPostProcess: typeof xrFrameSystem.AssetPostProcess Scene: typeof xrFrameSystem.Scene XRNode: typeof xrFrameSystem.XRNode XRShadow: typeof xrFrameSystem.XRShadow XRCamera: typeof xrFrameSystem.XRCamera XRMesh: typeof xrFrameSystem.XRMesh XRLight: typeof xrFrameSystem.XRLight XRGLTF: typeof xrFrameSystem.XRGLTF XRMaterial: typeof xrFrameSystem.XRMaterial XRAssetRenderTexture: typeof xrFrameSystem.XRAssetRenderTexture XRAssetLoad: typeof xrFrameSystem.XRAssetLoad XRAssets: typeof xrFrameSystem.XRAssets XREnv: typeof xrFrameSystem.XREnv XRARTracker: typeof xrFrameSystem.XRARTracker XRText: typeof xrFrameSystem.XRText XRParticle: typeof xrFrameSystem.XRParticle XRAssetPostProcess: typeof xrFrameSystem.XRAssetPostProcess AssetsSystem: typeof xrFrameSystem.AssetsSystem NodeSystem: typeof xrFrameSystem.NodeSystem TickSystem: typeof xrFrameSystem.TickSystem AnimationSystem: typeof xrFrameSystem.AnimationSystem VideoSystem: typeof xrFrameSystem.VideoSystem RenderSystem: typeof xrFrameSystem.RenderSystem PhysicsSystem: typeof xrFrameSystem.PhysicsSystem ARSystem: typeof xrFrameSystem.ARSystem ShareSystem: typeof xrFrameSystem.ShareSystem GizmoSystem: typeof xrFrameSystem.GizmoSystem AssetLoader: typeof xrFrameSystem.AssetLoader TextureLoader: typeof xrFrameSystem.TextureLoader ImageLoader: typeof xrFrameSystem.ImageLoader CubeTextureLoader: typeof xrFrameSystem.CubeTextureLoader VideoTextureLoader: typeof xrFrameSystem.VideoTextureLoader EnvDataLoader: typeof xrFrameSystem.EnvDataLoader GLTFLoader: typeof xrFrameSystem.GLTFLoader KeyframeLoader: typeof xrFrameSystem.KeyframeLoader RawLoader: typeof xrFrameSystem.RawLoader AtlasLoader: typeof xrFrameSystem.AtlasLoader EVideoState: typeof xrFrameSystem.EVideoState EVertexFormat: typeof xrFrameSystem.EVertexFormat EVertexStep: typeof xrFrameSystem.EVertexStep EIndexType: typeof xrFrameSystem.EIndexType ETextureType: typeof xrFrameSystem.ETextureType ETextureFormat: typeof xrFrameSystem.ETextureFormat EWrapMode: typeof xrFrameSystem.EWrapMode EFilterMode: typeof xrFrameSystem.EFilterMode EUniformType: typeof xrFrameSystem.EUniformType ECullMode: typeof xrFrameSystem.ECullMode EFaceWinding: typeof xrFrameSystem.EFaceWinding ECompareFunc: typeof xrFrameSystem.ECompareFunc EStencilOp: typeof xrFrameSystem.EStencilOp EBlendFactor: typeof xrFrameSystem.EBlendFactor EBlendEquation: typeof xrFrameSystem.EBlendEquation EColorMask: typeof xrFrameSystem.EColorMask EPixelType: typeof xrFrameSystem.EPixelType ELoadAction: typeof xrFrameSystem.ELoadAction EDataModelType: typeof xrFrameSystem.EDataModelType EMeshRenderType: typeof xrFrameSystem.EMeshRenderType EPrimitiveType: typeof xrFrameSystem.EPrimitiveType EShadowMode: typeof xrFrameSystem.EShadowMode EShadowFitMode: typeof xrFrameSystem.EShadowFitMode EVertexLayoutUsage: typeof xrFrameSystem.EVertexLayoutUsage EVertexBatchOperator: typeof xrFrameSystem.EVertexBatchOperator EAnimationBlendType: typeof xrFrameSystem.EAnimationBlendType EUseDefaultAddedAction: typeof xrFrameSystem.EUseDefaultAddedAction EUseDefaultRetainedAction: typeof xrFrameSystem.EUseDefaultRetainedAction EUseDefaultRemovedAction: typeof xrFrameSystem.EUseDefaultRemovedAction EEventType: typeof xrFrameSystem.EEventType EARTrackerState: typeof xrFrameSystem.EARTrackerState EShapeType: typeof xrFrameSystem.EShapeType ECapsuleShapeDirection: typeof xrFrameSystem.ECapsuleShapeDirection EShareRecordState: typeof xrFrameSystem.EShareRecordState useParamsEaseFuncs: typeof xrFrameSystem.useParamsEaseFuncs noneParamsEaseFuncs: typeof xrFrameSystem.noneParamsEaseFuncs TransformSchema: IComponentSchema AssetLoadSchema: IComponentSchema AssetsSchema: IComponentSchema CameraSchema: IComponentSchema GLTFSchema: IComponentSchema LightSchema: IComponentSchema AssetMaterialSchema: IComponentSchema MeshSchema: IComponentSchema TextSchema: IComponentSchema AssetRenderTextureSchema: IComponentSchema EnvSchema: IComponentSchema AnimatorSchema: IComponentSchema CameraOrbitControlSchema: IComponentSchema ARTrackSchema: IComponentSchema SphereShapeSchema: IComponentSchema MeshShapeSchema: IComponentSchema CapsuleShapeSchema: IComponentSchema CubeShapeSchema: IComponentSchema RigidbodySchema: IComponentSchema ShapeInteractSchema: IComponentSchema ParticleSchema: IComponentSchema RenderSystemSchema: IComponentSchema ARSystemSchema: IComponentSchema BasicDefaultComponents: IEntityComponents SceneDefaultComponents: IEntityComponents NodeDefaultComponents: IEntityComponents ShadowDefaultComponents: IEntityComponents CameraDefaultComponents: IEntityComponents MeshDefaultComponents: IEntityComponents LightDefaultComponents: IEntityComponents GLTFDefaultComponents: IEntityComponents AssetMaterialDefaultComponents: IEntityComponents AssetRenderTextureDefaultComponents: IEntityComponents AssetsDefaultComponents: IEntityComponents EnvDefaultComponents: IEntityComponents ARTrackerDefaultComponents: IEntityComponents TextDefaultComponents: IEntityComponents ParticleDefaultComponents: IEntityComponents AssetPostProcessDefaultComponents: IEntityComponents BasicDataMapping: { [key: string]: string[] } SceneDataMapping: { [key: string]: string[] } NodeDataMapping: { [key: string]: string[] } ShadowDataMapping: { [key: string]: string[] } CameraDataMapping: { [key: string]: string[] } MeshDataMapping: { [key: string]: string[] } LightDataMapping: { [key: string]: string[] } GLTFDataMapping: { [key: string]: string[] } AssetMaterialDataMapping: { [key: string]: string[] } AssetRenderTextureDataMapping: { [key: string]: string[] } AssetLoadDataMapping: { [key: string]: string[] } EnvDataMapping: { [key: string]: string[] } ARTrackerDataMapping: { [key: string]: string[] } TextDataMapping: { [key: string]: string[] } ParticleDataMapping: { [key: string]: string[] } AssetPostProcessDataMapping: { [key: string]: string[] } } } declare module 'XrFrame/xrFrameSystem' { /** * xrFrameSystem.ts * * * @Date : 4/28/2022, 5:02:28 PM */ import { Kanata } from 'XrFrame/ext' export { default as Component, registerComponent, IComponentSchema } from 'XrFrame/core/Component' export { default as Element, registerElement, IEntityComponents, BasicDefaultComponents, BasicDataMapping } from 'XrFrame/core/Element' export { registerDataValue, IDataValueHandler, ITextureWrapper, isTextureWrapper } from 'XrFrame/core/DataValue' export { default as EventManager, TEventCallback } from 'XrFrame/core/EventManager' export { genLspMeta } from 'XrFrame/genLspMeta' export * from 'XrFrame/components' export * from 'XrFrame/elements' export * from 'XrFrame/systems' export * from 'XrFrame/loader' export { default as Effect, IEffectAsset, IRenderStates } from 'XrFrame/assets/Effect' export { default as Geometry, ISubMesh } from 'XrFrame/assets/Geometry' export { default as Material } from 'XrFrame/assets/Material' export { default as VideoTexture, IVideoTextureOptions, EVideoState } from 'XrFrame/assets/VideoTexture' export { default as RenderTexture, IRenderTarget, IRenderTextureOptions } from 'XrFrame/assets/RenderTexture' export { default as GLTFModel, IGLTFModelOptions } from 'XrFrame/assets/GLTFModel' export { default as EnvData, IEnvDataOptions } from 'XrFrame/assets/EnvData' export { default as Animation, TDirection } from 'XrFrame/animation/Animation' export { default as KeyframeAnimation, IKeyframeAnimationData, IKeyframeAnimationInfo, IKeyframeAnimationOptions } from 'XrFrame/animation/KeyframeAnimation' export { default as Atlas, IAtlasOptions, IAtlasCreationOptions } from 'XrFrame/assets/Atlas' export { default as PostProcess, IPostProcessOptions } from 'XrFrame/assets/PostProcess' export { registerEffect, registerGeometry, registerTexture, registerMaterial, registerUniformDesc, registerVertexDataDesc, registerVertexLayout } from 'XrFrame/assets/factories' export { useParamsEaseFuncs, noneParamsEaseFuncs } from 'XrFrame/assets/easeFunctions' export * from 'XrFrame/physics/exports' export { default as Vector2 } from 'XrFrame/math/vector2' export { default as Vector3 } from 'XrFrame/math/vector3' export { default as Vector4 } from 'XrFrame/math/vector4' export { default as Quaternion } from 'XrFrame/math/quaternion' export { default as Matrix3 } from 'XrFrame/math/matrix3' export { default as Matrix4 } from 'XrFrame/math/matrix4' export { default as Color } from 'XrFrame/math/color' export { default as OBB } from 'XrFrame/math/OBB' export { default as BoundBall } from 'XrFrame/math/boundBall' export { default as BoundBox } from 'XrFrame/math/boundBox' export { default as Spherical } from 'XrFrame/math/Spherical' export { ITextureOptions, IEngineSettings, EVertexFormat, EVertexStep, EIndexType, ETextureType, ETextureFormat, EWrapMode, EFilterMode, EUniformType, ECullMode, EFaceWinding, ECompareFunc, EStencilOp, EBlendFactor, EBlendEquation, EColorMask, EPixelType, ELoadAction, EDataModelType, EMeshRenderType, EPrimitiveType, EShadowMode, EShadowFitMode, EVertexLayoutUsage, EVertexBatchOperator, EAnimationBlendType, EUseDefaultAddedAction, EUseDefaultRetainedAction, EUseDefaultRemovedAction, IHandle, IVertexLayoutOptions, IVertexDataDescriptorOptions, IUniformDescriptorOptions, IImage, IRealDownloader, IDownloader, IFontSetting, IFeatures, IRect, IViewAction, IView, IAttachment, IRenderPassDescriptor, EEventType, IGlyphInfo, IEventBridge, INativeMap, ILongIntNativeMap } from 'XrFrame/kanata/lib/kanata' export type Texture = Kanata.Texture export type UniformDescriptor = Kanata.UniformDescriptor export type UniformBlock = Kanata.UniformBlock export type VertexLayout = Kanata.VertexLayout } declare module 'XrFrame/ext' { /** * ext.ts * * * @Date : 2022/3/17下午1:43:48 */ import * as Kanata from 'XrFrame/kanata/lib/kanata' const exparser: any type Scene = import('XrFrame/core/Scene').default const _wx: any const Phys3D: any function addKanata(scene: Scene, kanata: Kanata.IKanataInstance): void function removeKanata(scene: Scene): void function getKanata(scene: Scene): Kanata.IKanataInstance function __getKanataSuperHackDontUseIt(): Kanata.IKanataInstance export { Kanata, exparser, Phys3D, _wx, addKanata, removeKanata, getKanata, __getKanataSuperHackDontUseIt } } declare module 'XrFrame/core/Component' { type Element = import('XrFrame/core/Element').default /** * `Component`属性的注解接口。 * * `key`是可以写在组件对应于`xml`中的属性的名字。 * `type`是属性的类型,由{@link registerDataValue}注册。 * 可选的`defaultValue`可以定义默认值。 */ export interface IComponentSchema { [key: string]: { type: string defaultValue?: any } } /** * 组件,系统核心之一。 * * 组件就是`wxml`的标签上写的那些`attribute`,比如`<xr-element transform="position: 1 1 1" />`中,`transform`就是一个组件,`position`是它的一个属性。 * 这些属性可以在`schema`中被定义,变化时会触发对应的生命周期。 * 自定义组件最后使用{@link registerComponent},组件的属性可以使用代理规则来简化,比如以上的标签可以简化为`<xr-element position="1 1 1" />`,详见{@link Element}。 * * @template IData 组件数据的类型,应当和`schema`中一致,用于TS类型推断。 */ export default class Component<IData> { /** * @internal */ static TYPE: string static EVENTS: string[] /** * @internal */ static SPLIT_DATA(dataStr: string): { [key: string]: string } /** * 自定义组件的`schema`。 */ readonly schema: IComponentSchema /** * 自定义组件的更新优先级。 */ readonly priority: number __DATA_TYPE: IData protected _version: number protected _currentData: IData /** * 挂载的元素。 */ get el(): import('XrFrame/core/Element').default /** * 当前场景。 */ get scene(): import('XrFrame/core/Scene').default /** * 当前版本,每次有数据更新都会增加,可以用作和其他组件合作的依据。 */ get version(): number /** * 不通过`xml`而是直接设置`data`,注意值的类型需要和`schema`中一致。 */ setData(data: Partial<IData>): void /** * 设置一个数据。 */ setDataOne<T extends keyof IData>(key: T, value: IData[T]): void /** * 获取一个当前值。 */ getData<T extends keyof IData>(key: T): IData[T] /** * @internal */ /** * @internal */ /** * @internal */ /** * @internal * 仅针对某些hack情况! */ /** * @internal */ /** * @internal */ /** * @internal */ /** * @internal */ /** * @internal */ /** * @internal */ /** * 所挂载的`element`被挂载到场景时触发的回调。 */ onAdd(parent: Element, data: IData): void /** * 数据更新时触发的回调。 */ onUpdate(data: IData, preData: IData): void /** * 渲染每帧触发的回调。 * @param deltaTime 单位为毫秒(ms)。 */ onTick(deltaTime: number, data: IData): void /** * 所挂载的`element`从父节点`parent`被移除时,或者自己从`element`上被移除时,触发的回调。 * 一般用于消除功能的运作。 * **如果一个组件的元素直接被销毁了,那这个组件就不会经历onRemove而是直接进入onRelease。** */ onRemove(parent: Element, data: IData): void /** * 从被挂载的`element`上被移除,或是`element`被销毁时,触发的回调。 * 一般用于释放持有的资源。 */ onRelease(data: IData): void } export const TABLE: { [type: string]: new () => Component<any> } /** * @internal */ export function getComponent(type: string): new () => Component<any> /** * 向系统中注册一个组件,然后可以在`xml`中使用。 */ export function registerComponent( type: string, clz: new () => Component<any> ): void export {} } declare module 'XrFrame/core/Element' { /** * Element.ts * * * @Date : 2022/4/1上午10:34:06 */ import Component from 'XrFrame/core/Component' import EventManager, { TFrameworkEventTrigger } from 'XrFrame/core/EventManager' /** * `Element`的默认组件集接口。 * * `name`是组件注册时的名字,`key`是要默认设置的组件的属性名字,值是默认值,但应当和`xml`中一致,为**字符串**。 */ export interface IEntityComponents { [name: string]: { [key: string]: string } } /** * 空的默认组件集。 */ export const BasicDefaultComponents: IEntityComponents /** * 空的默认组件映射。 */ export const BasicDataMapping: { [key: string]: string[] } /** * 元素,系统核心之一。 * * 本质上就是对应于`xml`中标签,所有的标签的实现都是继承自`Element`的,其一般不包含逻辑,仅仅是通过`defaultComponents`和`dataMapping`定义组件的集合与映射。 * 自定义元素最后使用{#@link registerElement}。 */ export default class Element { static TYPE: string /** * `Element`的默认组件集合,详见{@link IEntityComponents}。 */ readonly defaultComponents: IEntityComponents /** * `Element`的数据映射。它是为了给组件的属性提供一个方便的用法,比如: * ```ts * { * position: [transform, position] * } * ``` * 就是将`xml`中写在这个`Element`的`position`直接映射到了`transform`组件的`position`属性上。 * * **通常来讲,所有的驼峰如`nodeId`都会被映射为小写加中划线`node-id`**。 */ readonly dataMapping: { [key: string]: string[] } /** * @internal */ readonly neverTick: boolean /** * 名字,写在`xml`上的那个`name`,不唯一。 */ get name(): string set name(value: string) /** * @internal */ /** * 元素是否在`xml`中,若是`xr-shadow`下的节点,则为`false`。 */ get inXML(): boolean /** * 场景实例。 */ get scene(): import('XrFrame/core/Scene').default /** * 父元素。 */ get parent(): Element /** * 事件管理器。 */ get event(): EventManager constructor(_type: string, triggerEvent: TFrameworkEventTrigger) /** * 获取第`index`个子元素。 */ getChildAtIndex<T extends Element = Element>(index: number): T /** * 通过`filter`获取子元素。 */ getChildByFilter<T extends Element = Element>( filter: (child: Element) => boolean ): T /** * 通过`filter`获取子元素列表。 */ getChildrenByFilter(filter: (child: Element) => boolean): Element[] /** * 通过元素的类获取子元素。 */ getChildByClass<T extends Element = Element>( clz: new (...args: any[]) => T ): T /** * 通过元素的名字`name`获取子元素。 */ getChildByName<T extends Element = Element>(name: string): T /** * 通过元素的名字`name`获取子元素们。 */ getChildrenByName(name: string): Element[] /** * 递归遍历元素的所有子孙节点。 */ dfs<T extends any>( callback: (element: Element, params?: T) => T, defaultParams?: T, excludeRoot?: boolean, stop?: (element: Element, params?: T) => boolean ): void /** * 手动添加一个`Component`。 */ addComponent<T extends Component<any>>( clz: new () => T, options?: T['__DATA_TYPE'] ): T /** * 获取一个`Component`,可以使用类或者名字获取。 */ getComponent<T extends Component<any>>(clzName: string): T getComponent<T extends Component<any>>(clz: new () => T): T /** * 手动移除一个`Component`,注意保证其不在`xml`上。 */ removeComponent(clz: new () => Component<any>): void /** * 设置一个属性,对应于`xml`标签中的那些属性,值为字符串。 * **一般建议使用`component`的`setData`方法**!!! */ setAttribute(name: string, value: string): void /** * @internal */ /** * @internal */ /** * @internal */ /** * @internal */ _associateValue(_v: any): void /** * 手动添加一个子节点,**注意需要保证当前节点是`xr-shadow`或其子节点**。 */ addChild(child: Element): void /** * 手动移除一个子节点,**注意需要保证当前节点是`xr-shadow`或其子节点**。 * **只调用removeChild没有办法走进子节点的onRelease里**,需要手动调用子节点的release才行。 */ removeChild(child: Element): void /** * 仅限自己创建的节点使用,否则后果自负。 */ setId(id: string): void /** * 仅限自己创建的节点使用,否则后果自负。 */ release(): void /** * @internal */ _appendChild(_child: Element, custom?: boolean): void /** * @internal */ _removeChild(_child: Element, _index?: number, custom?: boolean): void /** * @internal */ _insertBefore(_child: Element, _before?: Element, _index?: number): void /** * @internal */ _replaceChild( _child: Element, _oldChild?: Element, _index?: number ): void /** * @internal */ _spliceBefore( _before: number | Element, _deleteCount: number, _list: Element ): void /** * @internal */ _spliceAppend(_list: Element): void /** * @internal */ _spliceRemove(_before: Element, _deleteCount: number): void /** * @internal */ _setId(_id: string): void /** * @internal */ _setStyleScope(_styleScope: number): void /** * @internal */ _setStyle(_styleText: string): void /** * @internal */ _addClass(_elementClass: string, _styleScope?: number): void /** * @internal */ _removeClass(_elementClass: string, _styleScope?: number): void /** * @internal */ /** * @internal */ _setAttribute(_name: string, _value: string): void _removeAttribute(_name: string): void _setText(_content: string): void } export const TABLE: { [type: string]: typeof Element } export function getElement(type: string): typeof Element /** * 注册一个自定义元素。 * 注意注册的`type`在`xml`中使用时需要加上`xr-`前缀,比如注册`custom`类型的元素,使用时需要时`xr-custom`。 */ export function registerElement(type: string, clz: typeof Element): void } declare module 'XrFrame/core/DataValue' { /** * DataValue.ts * * * @Date : 2022/3/17下午2:22:19 */ import { Kanata } from 'XrFrame/ext' import Scene from 'XrFrame/core/Scene' /** * 详见{@link registerDataValue}。 */ export interface IDataValueHandler<TDataValue> { create(value: string, defaultValue: any, scene: Scene): TDataValue } export interface ITextureWrapper { texture: Kanata.Texture } export function isTextureWrapper(value: any): value is ITextureWrapper export function isDataValueHandlerExisted(type: string): boolean /** * 为组件在`xml`中写的属性值按类型注册解析器,由于`xml`传入的值全部都是字符串,所以需要解析,比如: * ```ts * registerDataValue('number', {create: (value: string, defaultValue: any, scene: Scene) => { * return value === undefined ? defaultValue : parseFloat(value)); * }}); * ``` * 就是注册了`number`类型,后续在组件的`schema`中写的`number`类型数据,就会走这个解析器。 * **注意最后一个参数`scene`可以用于获取资源等,比如`scene.assets.getAssetWithState(type, value, defaultValue)`。** * **如果是被资源加载器加载的资源,则会在资源加载器注册时自动注册数据类型,详见{@link AssetLoader}**。 * * 已经注册的类型可见[组件数据解析](../../../component/xr-frame/core/data-values)。 */ export function registerDataValue<TDataValue>( type: string, handler: IDataValueHandler<TDataValue> ): void export function parseDataValue<TDataValue>( type: string, value: string, defaultValue: any, scene: Scene ): TDataValue } declare module 'XrFrame/core/EventManager' { /** * EventManager.ts * * * @Date : 2022/3/17下午3:54:03 */ import Observable from 'XrFrame/core/Observable' type Element = import('XrFrame/core/Element').default /** * 事件管理器的回调。 */ export type TEventCallback<TParams> = ( params: TParams, sender: Element ) => void export type TFrameworkEventTrigger = ( name: string, details: any, options: { bubbles?: boolean composed?: boolean capturePhase?: boolean } ) => void /** * 事件管理器。 * * 每个`Element`都有自己的事件管理器,通过参数可以触发到`xml`。 */ export default class EventManager { isEventManager: boolean protected _observables: { [type: string]: Observable } protected _caches: { [type: string]: { value: any toXML: boolean bubbles: boolean } } protected _wxmlBind: { [type: string]: boolean } constructor(_el: Element, _triggerElementEvent: TFrameworkEventTrigger) /** * 添加一个事件监听器。 */ add<TEvent = any>( type: string, callback: TEventCallback<TEvent>, priority?: number ): this /** * 添加一个事件监听器,触发一次后自动移除。 */ addOnce<TEvent = any>( type: string, callback: TEventCallback<TEvent>, priority?: number ): this /** * 移除一个事件监听器。 */ remove<TEvent = any>( type: string, callback: TEventCallback<TEvent> ): this /** * 判断一个事件是否被注册。 * 注册是指用户绑定过了至少一个事件处理器,无论是来自于wxml还是JS。 */ has(type: string): boolean /** * 获取一个事件监听者数量。 * @internal */ getCount(type: string): number /** * 清空某事件的所有监听器。 */ clear(type: string): this /** * 触发一个事件。 * * @param type 要触发的事件类型。 * @param event 事件的值。 * @param immediately 是否要将事件立即分发,如果不则会先缓存,之后在每一帧更新前统一分发,避免不必要的分发。 * @param toXML 是否要派发到`xml`绑定的事件中。 * @param bubbles 是否要进行事件冒泡。 */ trigger<TEvent = any>( type: string, event?: TEvent, immediately?: boolean, toXML?: boolean, bubbles?: boolean ): this /** * 分发某个缓存的事件,一般不需要自行触发。 */ flush(type: string): this /** * 分发所有缓存的事件,一般不需要自行触发。 */ flushAll(): this } export {} } declare module 'XrFrame/genLspMeta' { import { Scene } from 'XrFrame/elements' export interface IXRFrameMeta { elements: { name: string[] meta: { [name: string]: IXRFrameElement } } components: { name: string[] meta: { [name: string]: IXRFrameComponent } } } export interface IXRFrameElement { defaultComps: string[] mappings: { name: string[] meta: { [name: string]: string[] } } events: string[] limitComps?: string[] } export interface IXRFrameComponent { keys: string[] meta: { [key: string]: IXRFrameData } events: string[] } export interface IXRFrameData { type: string defaultValue: any map?: IXRFrameMap enum?: IXRFrameEnum } export interface IXRFrameMap { keys: string[] meta: { [key: string]: { type: string defaultValue?: string | number enum?: IXRFrameEnum } } } export interface IXRFrameEnum { values: Array<{ value: string | number desc?: string }> } export function genLspMeta(scene: Scene): IXRFrameMeta } declare module 'XrFrame/components' { export { default as Transform, ITransformData, TransformSchema } from 'XrFrame/components/Transform' export { default as AssetLoad, AssetLoadSchema } from 'XrFrame/components/AssetLoad' export { default as Assets, IAssetsData, AssetsSchema } from 'XrFrame/components/Assets' export { default as Camera, ICameraData, CameraSchema, TCameraBackground } from 'XrFrame/components/Camera' export { default as GLTF, IGLTFData, GLTFSchema } from 'XrFrame/components/GLTF' export { default as Light, ILightData, LightSchema } from 'XrFrame/components/Light' export { default as AssetMaterial, IAssetMaterialData, AssetMaterialSchema } from 'XrFrame/components/AssetMaterial' export { default as Mesh, IMeshData, MeshSchema } from 'XrFrame/components/Mesh' export { default as Text, ITextData, TextSchema } from 'XrFrame/components/text/Text' export { default as Particle } from 'XrFrame/components/particle/Particle' export { IParticleData, ParticleSchema } from 'XrFrame/components/particle/BasicParticle' export { default as AssetRenderTexture, IAssetRenderTextureData, AssetRenderTextureSchema } from 'XrFrame/components/AssetRenderTexture' export { default as Env, IEnvData, EnvSchema } from 'XrFrame/components/Env' export { default as Animator, IAnimatorData, AnimatorSchema, IAnimationPlayOptions, IAnimatorAutoPlay } from 'XrFrame/components/Animator' export { default as CameraOrbitControl, ICameraOrbitControlData, CameraOrbitControlSchema } from 'XrFrame/components/CameraOrbitControl' export { default as ARTracker, IARTrackerData, ARTrackSchema, TTrackMode, EARTrackerState, IARTrackerRawData } from 'XrFrame/components/ARTracker' export { default as Shape, IShapeData, EShapeType } from 'XrFrame/components/physics/Shape' export { default as SphereShape, ISphereShapeData, SphereShapeSchema } from 'XrFrame/components/physics/SphereShape' export { default as MeshShape, IMeshShapeData, MeshShapeSchema } from 'XrFrame/components/physics/MeshShape' export { default as CapsuleShape, ICapsuleShapeData, CapsuleShapeSchema, ECapsuleShapeDirection } from 'XrFrame/components/physics/CapsuleShape' export { default as CubeShape, ICubeShapeData, CubeShapeSchema } from 'XrFrame/components/physics/CubeShape' export { default as Rigidbody, IRigidbodyData, RigidbodySchema } from 'XrFrame/components/physics/Rigidbody' export { default as ShapeInteract, IShapeInteractData, ShapeInteractSchema } from 'XrFrame/components/physics/ShapeInteract' export { default as ShapeGizmos, IShapeGizmosData } from 'XrFrame/components/gizmo/ShapeGizmos' export { default as AssetPostProcess, IAssetPostProcessData } from 'XrFrame/components/AssetPostProcess' } declare module 'XrFrame/elements' { export { default as Scene, SceneDataMapping, SceneDefaultComponents } from 'XrFrame/core/Scene' export { default as XRNode, NodeDataMapping, NodeDefaultComponents } from 'XrFrame/elements/xr-node' export { default as XRShadow, ShadowDataMapping, ShadowDefaultComponents } from 'XrFrame/elements/xr-shadow' export { default as XRCamera, CameraDataMapping, CameraDefaultComponents } from 'XrFrame/elements/xr-camera' export { default as XRMesh, MeshDataMapping, MeshDefaultComponents } from 'XrFrame/elements/xr-mesh' export { default as XRLight, LightDataMapping, LightDefaultComponents } from 'XrFrame/elements/xr-light' export { default as XRGLTF, GLTFDataMapping, GLTFDefaultComponents } from 'XrFrame/elements/xr-gltf' export { default as XRMaterial, AssetMaterialDataMapping, AssetMaterialDefaultComponents } from 'XrFrame/elements/xr-asset-material' export { default as XRAssetRenderTexture, AssetRenderTextureDataMapping, AssetRenderTextureDefaultComponents } from 'XrFrame/elements/xr-asset-render-texture' export { default as XRAssetLoad, AssetLoadDataMapping } from 'XrFrame/elements/xr-asset-load' export { default as XRAssets, AssetsDefaultComponents } from 'XrFrame/elements/xr-assets' export { default as XREnv, EnvDataMapping, EnvDefaultComponents } from 'XrFrame/elements/xr-env' export { default as XRARTracker, ARTrackerDataMapping, ARTrackerDefaultComponents } from 'XrFrame/elements/xr-ar-tracker' export { default as XRText, TextDataMapping, TextDefaultComponents } from 'XrFrame/elements/xr-text' export { default as XRParticle, ParticleDataMapping, ParticleDefaultComponents } from 'XrFrame/elements/xr-particle' export { default as XRAssetPostProcess, AssetPostProcessDataMapping, AssetPostProcessDefaultComponents } from 'XrFrame/elements/xr-asset-post-process' } declare module 'XrFrame/systems' { export { default as AssetsSystem, IAssetsSystemData } from 'XrFrame/systems/AssetsSystem' export { default as NodeSystem, INodeSystemData } from 'XrFrame/systems/NodeSystem' export { default as TickSystem, ITickSystemData } from 'XrFrame/systems/TickSystem' export { default as AnimationSystem, IAnimationSystemData } from 'XrFrame/systems/AnimationSystem' export { default as VideoSystem, IVideoSystemData } from 'XrFrame/systems/VideoSystem' export { default as RenderSystem, IRenderSystemData, RenderSystemSchema } from 'XrFrame/systems/RenderSystem' export { default as PhysicsSystem, IPhysicsSystemData, IShapeDragEvent, IShapeTouchEvent } from 'XrFrame/systems/PhysicsSystem' export { default as ARSystem, IARSystemData, ARSystemSchema, IARRawData } from 'XrFrame/systems/ARSystem' export { default as ShareSystem, IShareSystemData, IShareCaptureOptions, IShareRecordOptions, EShareRecordState } from 'XrFrame/systems/ShareSystem' export { default as GizmoSystem, IGizmoSystemData } from 'XrFrame/systems/GizmoSystem' } declare module 'XrFrame/loader' { export { default as AssetLoader, ILoaderOptionsSchema, registerAssetLoader } from 'XrFrame/loader/AssetLoader' export { default as TextureLoader, ITextureLoaderOptions } from 'XrFrame/loader/TextureLoader' export { default as ImageLoader, IImageLoaderOptions } from 'XrFrame/loader/ImageLoader' export { default as CubeTextureLoader, ICubeTextureLoaderOptions } from 'XrFrame/loader/CubeTextureLoader' export { default as VideoTextureLoader, IVideoTextureLoaderOptions } from 'XrFrame/loader/VideoTextureLoader' export { default as EnvDataLoader, IEnvDataLoaderOptions } from 'XrFrame/loader/EnvDataLoader' export { default as GLTFLoader, IGLTFLoaderOptions } from 'XrFrame/loader/GlTFLoader' export { default as KeyframeLoader, IKeyframeLoaderOptions } from 'XrFrame/loader/KeyframeLoader' export { default as RawLoader, IRawLoaderOptions } from 'XrFrame/loader/RawLoader' export { default as AtlasLoader, IAtlasLoaderOptions } from 'XrFrame/loader/AtlasLoader' } declare module 'XrFrame/assets/Effect' { /** * Effect.ts * * * @Date : 2022/3/16下午4:44:48 */ import { ITextureWrapper } from 'XrFrame/core/DataValue' import { Kanata } from 'XrFrame/ext' import { IAssetWithState } from 'XrFrame/loader/types' type Scene = import('XrFrame/core/Scene').default /** * 支持定制的渲染状态。 * * 大部分状态会定制的开发者应该看名字就懂,就不详细说明了。 */ export interface IRenderStates { /** * 渲染队列,大于等于`2500`为透明物体,否则为非透明物体。 */ renderQueue?: number blendOn?: boolean /** * 不要使用,使用`blendSrcRGB`。 */ blendSrc?: Kanata.EBlendFactor blendSrcRGB?: Kan