UNPKG

next-flow-interface

Version:

Interface package for NEXT FlOW. You can use this package to build your own plugin that can control anything.

2,011 lines (1,808 loc) 139 kB
import { AnimationGroup, ArcRotateCamera, BaseTexture, Color3, Color4, CubeTexture, DynamicTexture, Engine, InputBlock, Light, Material, Mesh, Node as Node_2, NodeMaterial, NodeMaterialBlock, NodeMaterialBlockConnectionPointTypes, PBRMaterial, Quaternion, Scene, ShadowGenerator, StandardMaterial, Texture, TransformNode, Animation as Animation_2, AbstractMesh, Vector2, Vector3, WebGPUEngine, } from '@babylonjs/core' import { WebXRDefaultExperience } from '@babylonjs/core/XR/webXRDefaultExperience' import { EmptyProps, InputNumberProps, SelectProps, SwitchProps } from 'antd' import { Color, ColorPickerProps } from 'antd/es/color-picker' import { DefaultOptionType } from 'antd/es/select' import { Attributes, DetailedHTMLProps, FunctionComponent, HTMLAttributes, JSX, MouseEvent as MouseEvent_2, MouseEventHandler, default as React_2, ReactNode, ReactPortal, } from 'react' import { Root } from 'react-dom/client' import { Awareness, EventType, RecursiveArray, RecursiveCrossRhineVar, RecursiveMap, RecursiveObject, RhineVarArray, RhineVarMap, RvPath, StoredRhineVar, } from 'rhine-var' import { AnyWebByteStream } from 'strtok3' /** * @public */ export declare const AcceptMime: { ANY: string UNKNOWN: string SCENE: string MESH: string LIGHT: string CAMERA: string TEXTURE: string MATERIAL: string UV: string ANIMATION: string GLB: string GLTF: string STL: string OBJ: string MP3: string WAV: string AAC: string OGG: string FLAC: string OPUS: string JPG: string PNG: string GIF: string BMP: string WebP: string SVG: string TIFF: string ICO: string HEIF: string AVIF: string MP4: string WebM: string AVI: string MPEG: string MOV: string WMV: string FLV: string OGV: string GP3: string MKV: string JSON: string NF: string TXT: string MARKDOWN: string SUPPORT_IMAGE_LIST: string[] SUPPORT_MODEL_LIST: string[] SUPPORT_VIDEO_LIST: string[] SUPPORT_BABYLON_LIST: string[] SUPPORT_AUDIO_LIST: string[] SUPPORT_TEXT_LIST: string[] SUPPORT_JSON_LIST: string[] SUPPORT_NEXTFLOW_LIST: string[] SUPPORT_ALL_LIST: string[] SUPPORT_FILE_LIST: string[] SUPPORT_RENDER_LIST: string[] SUPPORT_TEXTURE_LIST: string[] ATTACH_LIST: string[] getMimeByBlob: typeof getMimeByBlob getMimeByPath: typeof getMimeByPath getMimeByUrl: typeof getMimeByUrl getMimeByBuffer: typeof getMimeByBuffer getMimeByStream: typeof getMimeByStream getMime: typeof getMime getExtension: typeof getExtension isSupport: typeof isSupport isSupportFile: typeof isSupportFile isSupportImage: typeof isSupportImage isSupportModel: typeof isSupportModel isSupportVideo: typeof isSupportVideo isSupportText: typeof isSupportText isSupportJson: typeof isSupportJson isBabylon: typeof isBabylon isSupportAudio: typeof isSupportAudio isSupportRender: typeof isSupportRender isSupportTexture: typeof isSupportTexture isTexture: typeof isTexture isMaterial: typeof isMaterial isUV: typeof isUV isAttach: typeof isAttach } /** * @public */ export declare interface AddLocalDataOption extends Omit<LocalData, 'status' | 'progress'> { status?: LocalDataStatus progress?: number } /** * @public */ export declare function Anchor(props: AnchorProps): JSX.Element /** * @public */ export declare interface AnchorProps extends DivProps { list: string[] value: number onSelectChange: (value: number) => void middle?: boolean } /** * @public */ export declare enum AnimationDuration { BETWEEN = 1200, OPERATE = 350, FIRST = 700, IMMEDIATELY = 0, RESET = 300, IMMEDIATELY_MODE_THRESHOLD = 67, } /** * @public */ export declare class AnimationNativeAttribute extends NodeAttribute<RvNative> { path: string[] defaultValue: RvNative generate(sid: string, nid: string): RvNative } /** * @public */ export declare function AntCheckbox(props: AntCheckboxProps): React_2.JSX.Element /** * @public */ export declare interface AntCheckboxProps extends SwitchProps { value: boolean onChange: (value: boolean) => void className?: string | undefined label?: string } /** * @public */ export declare function AntColor(props: AntColorProps): React_2.JSX.Element /** * @public */ export declare interface AntColorProps extends ColorPickerProps { value: Color | string | null onColorChange: (value: string) => void className?: string classNameInner?: string theme?: string } /** * @public */ export declare function AntEmpty(props: AntEmptyProps): JSX.Element /** * @public */ export declare interface AntEmptyProps extends EmptyProps { className?: string classNameInner?: string image?: ReactNode description?: ReactNode children?: ReactNode } /** * @public */ export declare function AntNumber(props: AntNumberProps): React_2.JSX.Element /** * @public */ export declare interface AntNumberProps extends Omit<InputNumberProps, 'onChange'> { value: number | null onChange: (value: number | null) => void placeholder?: string className?: string classNameInner?: string theme?: string } /** * @public */ export declare function AntSelect<ValueType>(props: AntSelectProps<ValueType>): React_2.JSX.Element /** * @public */ export declare interface AntSelectProps<ValueType> extends SelectProps<ValueType> { value?: ValueType onChange?: (value: ValueType, option?: DefaultOptionType | DefaultOptionType[]) => void showSearch?: boolean onClick?: MouseEventHandler<HTMLDivElement> className?: string classNameInner?: string placeholder?: string optionFilterProp?: string size?: 'small' | 'middle' | 'large' | undefined options?: DefaultOptionType[] } /** * @public */ export declare function AntSwitch(props: AntSwitchProps): React_2.JSX.Element /** * @public */ export declare interface AntSwitchProps extends SwitchProps { value: boolean onChange: (value: boolean) => void className?: string | undefined } declare function approximatelyEqual(n1: number, n2: number, bias?: number): boolean /** * @public */ export declare type Attribute<T extends object = never> = NodeAttribute<T> | StepAttribute<T> | GlobalAttribute<T> /** * @public */ export declare class AttributeService { static get instance(): AttributeService private constructor() /** 黑名单 */ commonBlacklist: RvPath[] nodeBlacklist: RvPath[] stepBlacklist: RvPath[] globalBlacklist: RvPath[] /** 属性存储 */ nodeAttributes: NodeAttribute<any>[] stepAttributes: StepAttribute<any>[] globalAttributes: GlobalAttribute<any>[] /** 注册属性 */ register<T extends object = never>(attribute: Attribute<T>): void /** 通过路径精确匹配获取属性 */ get<T extends object = never>(type: AttributeType, path: RvPath | string): Attribute<T> | undefined /** 通过路径获取 NodeAttribute */ getNodeAttribute<T extends object = never>(path: RvPath | string): NodeAttribute<T> | undefined /** 通过路径获取 StepAttribute */ getStepAttribute<T extends object = never>(path: RvPath | string): StepAttribute<T> | undefined /** 通过路径获取 GlobalAttribute */ getGlobalAttribute<T extends object = never>(path: RvPath | string): GlobalAttribute<T> | undefined /** 根据类型获取属性列表,不传入类型的时候返回所有 */ getList(type?: AttributeType): Attribute<any>[] isPathConflict(type: AttributeType, path: RvPath): boolean createContainer(source: StoredRhineVar, path: RvPath): RecursiveMap<unknown> } /** * @public */ export declare enum AttributeType { Global = 'GLOBAL', Step = 'STEP', Node = 'NODE', } /** * @public */ export declare class AutoPlayService { static get instance(): AutoPlayService private constructor() next(interval: number, loop: boolean): void hasNextStep(loop: boolean): boolean tryNextStep(loop: boolean): true | undefined } /** * @public */ export declare interface AwarenessChanges { added: number[] updated: number[] removed: number[] } /** * @public */ export declare type AwarenessChangeSubscriber = ( changeStates: Map<number, RvAwareness>, changes: AwarenessChanges, ) => void /** * @public */ export declare class AwarenessService { DEFAULT_UPDATE_INTERVAL: number static get instance(): AwarenessService private constructor() name: string color: string static COLORS: string[] awareness: Awareness | undefined states: Map<number, RvAwareness> setLocalState(state?: RvAwareness): void setLocalStateCamera(state?: RvCameraLocation): void setLocalStateField(field: string, state: unknown): void getLocalState(): Record<string, any> | null startUpdate(): void stopUpdate(): void setUpdateInterval(interval: number): void resetUpdateInterval(): void subscribeChange(subscriber: AwarenessChangeSubscriber): () => void unsubscribeChange(subscriber: AwarenessChangeSubscriber): void getCurrentRvAwareness(): RvAwareness CLICK_RETENTION_PERIOD: number CLICK_MAX_COUNT: number addClick(position: V3): void } /** * @public */ export declare abstract class BaseAttribute<T extends object = never> { abstract type: AttributeType abstract path: RvPath defaultValue: T getPathString(): string isMyPath(path: string | RvPath): boolean } /** * @public */ export declare interface BasePlugin { id: string version: string namespace: string intl?: Intl_2 createIntl: (namespace: string) => Intl_2 name: string description: string type: PluginType theme: ThemeColor data?: Record<string, unknown> messages?: Record<Locale, MessageTree> onInstall?: () => Promise<void> onEnable?: () => Promise<void> onDisable?: () => Promise<void> onUninstall?: () => Promise<void> } /** * @public */ export declare function BatchApply(props: BatchApplyProps): React_2.JSX.Element /** * @public */ export declare interface BatchApplyProps extends DivProps { tip?: string onConfirm?: () => void onCancel?: () => void } /** * @public */ export declare class BatchApplyService { static get instance(): BatchApplyService _selected: string[] private constructor() get selected(): string[] set selected(selected: string[]) selectAll(): void unselectAll(): void isAllSelected(): boolean subscribe(subscriber: BatchApplySubscriber): () => void unsubscribe(subscriber: BatchApplySubscriber): void forEach(f: (rvStep: StoredRhineVar<RvStep>) => void): void forEachAttributes(f: (rvNode: StoredRhineVar<RvNode>) => void): void } /** * @public */ export declare type BatchApplySubscriber = (selected: string[]) => void /** * @public */ export declare interface C3 { r: number g: number b: number } /** * @public */ export declare interface C4 { r: number g: number b: number a: number } /** * @public */ export declare class CameraConfigurationAnimation { static get instance(): CameraConfigurationAnimation private constructor() play(data: CameraConfigurationData, duration?: number, quickMode?: boolean): void distanceMin(value: number, duration?: number, quickMode?: boolean): void distanceMax(value: number, duration?: number, quickMode?: boolean): void fov(value: number, duration?: number, quickMode?: boolean): void } /** * @public */ export declare class CameraLocationAnimation { static get instance(): CameraLocationAnimation private constructor() cameraAnimation: AnimationGroup | null play(data: RvCameraLocation, duration?: number, enableNear?: boolean): void playEasy(data: RvCameraLocation, duration: number): void makeCameraAnimationsEase(data: RvCameraLocation, duration?: number): Animation_2[] } declare function check(str: string): boolean /** * 检查路径是否与目标列表中的任意路径重叠 * @param from - 要检查的路径 * @param targetList - 目标路径列表 * @returns 如果与任意目标路径重叠则返回 true */ declare function checkAnyRvPathOverlay(from: RvPath | string, targetList: (RvPath | string)[]): boolean /** * 检查路径是否与目标列表中的任意路径完全相同 * @param from - 要检查的路径 * @param targetList - 目标路径列表 * @returns 如果与任意目标路径相同则返回 true */ declare function checkAnyRvPathSame(from: RvPath | string, targetList: (RvPath | string)[]): boolean /** * @public */ export declare function CheckboxLine(): JSX.Element /** * 检查两段路径是否完全重叠 * 长度可不同,从开头开始每一项比较,直到有一方结束,是否全部相同 * @param from - 第一个路径 * @param target - 第二个路径 * @returns 如果路径重叠则返回 true * @example * ```ts * RvUtils.checkRvPathOverlay("a.b", "a.b.c") // true * RvUtils.checkRvPathOverlay("a.b", "a.c") // false * ``` */ declare function checkRvPathOverlay(from: RvPath | string, target: RvPath | string): boolean /** * 检查两段路径是否完全相同 * @param from - 第一个路径 * @param target - 第二个路径 * @returns 如果路径完全相同则返回 true * @example * ```ts * RvUtils.checkRvPathSame("a.b", "a.b") // true * RvUtils.checkRvPathSame("a.b", "a.b.c") // false * ``` */ declare function checkRvPathSame(from: RvPath | string, target: RvPath | string): boolean declare function checkRvPathStartWith(from: RvPath | string, target: RvPath | string): boolean declare function chunkHash(file: File): Promise<string> declare function computeSHA256(buffer: BufferSource): Promise<string> /** * @public */ export declare class ContextMenu { options: ContextMenuCreateOptions id: string lines: MenuLine[] showIcon: boolean x: number y: number closeOnOutsideClick: boolean theme?: ThemeColor | undefined controller: ContextMenuController | null createTime: Date constructor( options: ContextMenuCreateOptions, id: string, lines?: MenuLine[], showIcon?: boolean, x?: number, y?: number, closeOnOutsideClick?: boolean, theme?: ThemeColor | undefined, controller?: ContextMenuController | null, createTime?: Date, ) static fromOptions(id: string, options: ContextMenuCreateOptions, menuLines?: MenuLine[]): ContextMenu } /** * @public */ export declare interface ContextMenuController { contextMenu: ContextMenu show(): void destroy(): void } /** * @public */ export declare interface ContextMenuCreateOptions { id?: string lines?: MenuLineCreateOptions[] showIcon?: boolean x?: number y?: number closeOnOutsideClick?: boolean theme?: ThemeColor onClose?: () => void } /** * @public */ export declare class ContextMenuService { static get instance(): ContextMenuService private constructor() contextMenus: ContextMenu[] create(options: ContextMenuCreateOptions): ContextMenuController get(id: string): ContextMenu | undefined close(contextMenu: string | ContextMenu): Promise<boolean> closeAll(): Promise<number> } declare function convertBytesToHigherUnit(bn: number): string declare function convertTimeText(seconds: number): string declare function copyCurrentUrlToClipboard(): Promise<boolean> declare function copyText(text: string): Promise<boolean> /** * @public */ export declare const CryptoUtils: { computeSHA256: typeof computeSHA256 } /** * @public */ export declare const DataUtils: { recursPathValue: typeof recursPathValue } declare function degreesToQuaternion(v: V3): Quaternion declare function degreeToRadians(v: V3): V3 /** * @public */ export declare class Dialog { options: DialogCreateOptions id: string title: string titleIcon: FunctionComponent | string | undefined content: string contentAlign: DialogContentAlign contentView: FunctionComponent | string | undefined icon: FunctionComponent | string | undefined view: FunctionComponent | string | undefined theme: ThemeColor leftMode: boolean className: string style: object confirmText: string cancelText: string enableInput: boolean defaultValue: string inputPlaceholder: string autoFocus: boolean allowEmpty: boolean onChange: (value: string) => void onCheck: (value: string) => boolean enableCloseButton: boolean onConfirm: (value: string) => void onCancel: () => void onClose: () => void onConfirmButtonClick: () => void onCancelButtonClick: () => void onOutsideClick: () => void onCloseButtonClick: () => void onRender: () => void onEffect: () => () => void closeOnConfirm: boolean closeOnCancel: boolean closeOnOutsideClick: boolean closeOnCloseButtonClick: boolean alignButton: boolean inputValue: string createTime: Date focusInput: () => void elements: Map<string, HTMLElement> constructor( options: DialogCreateOptions, id: string, title?: string, titleIcon?: FunctionComponent | string | undefined, content?: string, contentAlign?: DialogContentAlign, contentView?: FunctionComponent | string | undefined, icon?: FunctionComponent | string | undefined, view?: FunctionComponent | string | undefined, theme?: ThemeColor, leftMode?: boolean, className?: string, style?: object, confirmText?: string, cancelText?: string, enableInput?: boolean, defaultValue?: string, inputPlaceholder?: string, autoFocus?: boolean, allowEmpty?: boolean, onChange?: (value: string) => void, onCheck?: (value: string) => boolean, enableCloseButton?: boolean, onConfirm?: (value: string) => void, onCancel?: () => void, onClose?: () => void, onConfirmButtonClick?: () => void, onCancelButtonClick?: () => void, onOutsideClick?: () => void, onCloseButtonClick?: () => void, onRender?: () => void, onEffect?: () => () => void, closeOnConfirm?: boolean, closeOnCancel?: boolean, closeOnOutsideClick?: boolean, closeOnCloseButtonClick?: boolean, alignButton?: boolean, inputValue?: string, createTime?: Date, focusInput?: () => void, elements?: Map<string, HTMLElement>, ) static fromOptions(id: string, options: DialogCreateOptions): Dialog setHide: (value: boolean) => void } /** * @public */ export declare enum DialogContentAlign { LEFT = 'LEFT', CENTER = 'CENTER', RIGHT = 'RIGHT', } /** * @public */ export declare interface DialogCreateOptions { id?: string title?: string titleIcon?: FunctionComponent | string content?: string contentAlign?: DialogContentAlign contentView?: FunctionComponent | string icon?: FunctionComponent | string view?: FunctionComponent | string theme?: ThemeColor leftMode?: boolean className?: string style?: object confirmText?: string cancelText?: string enableCloseButton?: boolean enableInput?: boolean defaultValue?: string inputPlaceholder?: string autoFocus?: boolean allowEmpty?: boolean onChange?: (value: string) => void onCheck?: (value: string) => boolean onConfirm?: (value: string) => void onCancel?: () => void onClose?: () => void onConfirmButtonClick?: () => void onCancelButtonClick?: () => void onOutsideClick?: () => void onCloseButtonClick?: () => void onRender?: () => void onEffect?: () => () => void closeOnConfirm?: boolean closeOnCancel?: boolean closeOnOutsideClick?: boolean closeOnCloseButtonClick?: boolean alignButton?: boolean } /** * @public */ export declare interface DialogPlugin extends IconPlugin { options: DialogCreateOptions view: MixView<PluginViewProps> onRender?: () => void } /** * @public */ export declare class DialogService { static get instance(): DialogService private constructor() create(options: DialogCreateOptions, show?: boolean): Promise<Dialog> dialogs: Dialog[] renderer: DialogViewRenderer confirm( options: { title: string titleIcon?: FunctionComponent | string content?: string contentView?: FunctionComponent | string icon?: FunctionComponent | string theme?: ThemeColor confirmText?: string cancelText?: string leftMode?: boolean className?: string style?: object onConfirm?: () => void onCancel?: () => void onClose?: () => void closeOnOutsideClick?: boolean enableCloseButton?: boolean }, show?: boolean, ): Promise<boolean> input( options: { title: string titleIcon?: FunctionComponent | string content?: string contentView?: FunctionComponent | string icon?: FunctionComponent | string theme?: ThemeColor leftMode?: boolean className?: string style?: object confirmText?: string cancelText?: string defaultValue?: string inputPlaceholder?: string autoFocus?: boolean allowEmpty?: boolean onChange?: (value: string) => void onCheck?: (value: string) => boolean onConfirm?: (value: string) => void onCancel?: () => void onClose?: () => void closeOnOutsideClick?: boolean enableCloseButton?: boolean }, show?: boolean, ): Promise<string | undefined> get(id: string): Dialog | undefined open(dialog: Dialog | string): Promise<boolean> close(dialog: Dialog | string): Promise<boolean> closeAll(): Promise<number> } /** * @public */ export declare type DivProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> /** * @public */ export declare type DivPropsSimple = Omit<DivProps, 'onChange' | 'defaultValue'> /** * @public */ export declare class DomNotFoundError extends NotFoundError { constructor(message: string) } /** * @public */ export declare interface DrawerPlugin extends IconPlugin { title: string tip: string weight: number drawer: MixView<PluginViewProps> onRender?: () => void onTitleClick?: () => void onTitleContextMenu?: () => void } /** * @public */ export declare class EasyPropertyAnimation { static get instance(): EasyPropertyAnimation private constructor() animationMap: Map< string, { animationGroup?: AnimationGroup timeout?: ReturnType<typeof setTimeout> } > play( id: string, type: number, node: SupportAnimationTarget, keys: string[], to: number | Quaternion | Color3 | Color4 | Vector2 | Vector3, duration?: number, quickMode?: boolean, from?: number | Quaternion | Color3 | Color4 | Vector2 | Vector3 | undefined, ease?: boolean, ): void playSplit(id: string, callback: () => void, duration?: number, quickMode?: boolean): void stop(id: string): boolean } /** * @public */ export declare enum EnableLevel { NONE = 'NONE', INSTALL = 'INSTALL', ENABLE = 'ENABLE', OPEN = 'OPEN', } declare function ensureFileArray(files: File | File[] | FileList | null | undefined): File[] /** * 确保路径为 RvPath 数组格式 * @param path - 字符串路径或 RvPath 数组 * @returns RvPath 数组 */ declare function ensureRvPath(path: string | RvPath): RvPath /** * 确保路径为字符串格式 * @param path - 字符串路径或 RvPath 数组 * @returns 字符串路径 */ declare function ensureRvPathString(path: string | RvPath): string declare function extractFilenameFromUrl(url: string, includeExtension?: boolean): string declare function fetchBlobWithRetry(url: string, retries?: number): Promise<Blob> declare function fetchJsonWithRetry(url: string, retries?: number): Promise<unknown> /** * @public */ export declare interface FileData { fid: string status: LocalDataStatus name: string progress: number mime: string filename?: string extension?: string description?: string size?: string preview?: string } /** * @public */ export declare function FileProgressBar(props: FileProgressBarProps): React_2.JSX.Element /** * @public */ export declare interface FileProgressBarProps extends DivProps { size: string value: number className?: string theme?: string } /** * @public */ export declare const FileUtils: { to3n: typeof to3n convertBytesToHigherUnit: typeof convertBytesToHigherUnit splitName: typeof splitName ensureFileArray: typeof ensureFileArray chunkHash: typeof chunkHash isSameFile: typeof isSameFile getFileInfo: typeof getFileInfo } /** * @public */ export declare class FirstLoadModelService { static get instance(): FirstLoadModelService private constructor() status: FirstLoadModelServiceStatus rsModelList: RsModel[] loadingNumber: number loadedNumber: number errorNumber: number canceledNumber: number totalSize: number loadedSize: number startTime: number start(): void subscribe(subscriber: FirstLoadModelServiceSubscriber): () => void unsubscribe(subscriber: FirstLoadModelServiceSubscriber): void } /** * @public */ export declare enum FirstLoadModelServiceEventType { START = 'START', PROGRESS = 'PROGRESS', LOADED = 'LOADED', ERROR = 'ERROR', CANCELED = 'CANCELED', } /** * @public */ export declare enum FirstLoadModelServiceStatus { WAITING = 'WAITING', LOADING = 'LOADING', LOADED = 'LOADED', ERROR = 'ERROR', CANCELED = 'CANCELED', } /** * @public */ export declare type FirstLoadModelServiceSubscriber = (type: FirstLoadModelServiceEventType) => void /** * @public */ export declare class FirstLoadService { static get instance(): FirstLoadService private constructor() status: FirstLoadServiceStatus localDataList: LocalData[] loadingNumber: number loadedNumber: number errorNumber: number canceledNumber: number totalSize: number loadedSize: number startTime: number start(): void subscribe(subscriber: FirstLoadServiceSubscriber): () => void unsubscribe(subscriber: FirstLoadServiceSubscriber): void } /** * @public */ export declare enum FirstLoadServiceEventType { START = 'START', PROGRESS = 'PROGRESS', LOADED = 'LOADED', ERROR = 'ERROR', CANCELED = 'CANCELED', } /** * @public */ export declare enum FirstLoadServiceStatus { WAITING = 'WAITING', LOADING = 'LOADING', LOADED = 'LOADED', ERROR = 'ERROR', CANCELED = 'CANCELED', } /** * @public */ export declare type FirstLoadServiceSubscriber = (type: FirstLoadServiceEventType) => void /** * @public */ export declare function FlexGrow(props: { value?: number }): JSX.Element /** * @public */ export declare interface FlexGrowProps { value?: number } /** * @public */ export declare enum FocusMode { DEFAULT = 'DEFAULT', DESCRIPTION = 'DESCRIPTION', } /** * @public */ export declare class FogAnimation { static get instance(): FogAnimation private constructor() play(data: FogData, duration?: number, quickMode?: boolean): void enableAndDensity(enable: boolean, value: number, duration?: number, quickMode?: boolean): void color(color: Color3 | string, duration?: number, quickMode?: boolean): void } declare function formatDateTo17Digits(date?: Date): string declare function formatDuration(startTimestamp: number, endTimestamp: number): string declare function fromQuaternion(q: Quaternion): V4 declare function fromVector3(v: Vector3): V3 /** * @public */ export declare function getBlockDiagonalLength( x1: number, y1: number, z1: number, x2: number, y2: number, z2: number, ): number /** * 根据路径从对象中获取值 * @typeParam T - 返回值的类型 * @param source - 源对象 * @param path - 访问路径 * @returns 路径对应的值,如果路径不存在则返回 undefined * @example * ```ts * RvUtils.getByRvPath({ a: { b: 1 } }, "a.b") // 1 * ``` */ declare function getByRvPath<T = unknown>(source: StoredRhineVar, path: string | RvPath): T | undefined declare function getDistance(x1: number, y1: number, x2: number, y2: number): number declare function getDistance3d(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): number declare function getDistanceBetweenEvents(e1: ReactEvent | NativeEvent, e2: ReactEvent | NativeEvent): number declare function getEventPosition(e: ReactEvent | NativeEvent): [x: number, y: number] declare function getExtension(mime?: string): Promise<string> declare function getFileInfo(url: string): Promise<{ name: string size: number }> declare function getHashParam(name: string): string declare function getMime( input?: File | Blob | string | ArrayBuffer | Uint8Array | AnyWebByteStream | BaseTexture | Material, ): Promise<string> declare function getMimeByBlob(object?: File | Blob): Promise<string> declare function getMimeByBuffer(buffer?: ArrayBuffer | Uint8Array): Promise<string> declare function getMimeByPath(path?: string): Promise<string> declare function getMimeByStream(stream: AnyWebByteStream): Promise<string> declare function getMimeByUrl(url?: string): Promise<string> /** * @public */ export declare function getNearestAngle(source: number, target: number): number /** * @public */ export declare function getNearestAngleVector3(source: Vector3, target: Vector3): Vector3 declare function getNearestNumberIndex(x: number, list: number[]): number declare function getPageTypeBySpaceText(space: string): PageType declare function getParam(name: string): string /** * @public */ export declare function getPointDistance(p1: Vector3, p2: Vector3): number declare function getSearchParams(key: string): string | undefined /** * @public */ export declare abstract class GlobalAttribute<T extends object = never> extends BaseAttribute<T> { type: AttributeType generate(): T initialize(): void isInitialized(): boolean mark(path: string | RvPath): void get(): RecursiveCrossRhineVar<T> | undefined set(path: string | RvPath, value: unknown): void read(): T | RecursiveCrossRhineVar<T> edit(path: string | RvPath, value: unknown): void editMany(list: [string | RvPath, unknown][]): void subscribe(subscriber: GlobalAttributeSubscriber<T>): () => void unsubscribe(subscriber: GlobalAttributeSubscriber<T>): void } /** * @public */ export declare type GlobalAttributeSubscriber<T> = ( type: EventType, path: RvPath, value: unknown, oldValue: unknown, ) => void /** * @public */ export declare class GroundAnimation { static get instance(): GroundAnimation private constructor() play(data: RvEnvironment['ground'], duration?: number, quickMode?: boolean): void opacityRate(value: number, duration?: number, quickMode?: boolean): void baseColor(color: Color3 | string, duration?: number, quickMode?: boolean): void enableOnViewerMode(value: boolean, duration?: number, quickMode?: boolean): void enableOnEditorMode(value: boolean, duration?: number, quickMode?: boolean): void } /** * @public */ export declare function hasGeometry(mesh: AbstractMesh): boolean /** * @public */ export declare interface HighLightInfo { uid: number color: string } /** * @public */ export declare class HistoryService { static get instance(): HistoryService private constructor() operate: string stateList: unknown[] undo(from?: string): void redo(from?: string): void canUndo(): boolean canRedo(): boolean pushState(state: unknown): void mark(operate: string, forceStop?: boolean): void markAttribute(attributePath: string | RvPath, path: string | RvPath, sidList?: string[], nidList?: string[]): void stop(): void clear(): void removeLast(operate?: string): boolean removeFirst(operate?: string): boolean clearUndoStack(): void clearRedoStack(): void subscribe(subscriber: HistoryServiceSubscriber): () => void unsubscribe(subscriber: HistoryServiceSubscriber): void subscribeState(subscriber: HistoryServiceStateSubscriber): () => void unsubscribeState(subscriber: HistoryServiceStateSubscriber): void white(): void } /** * @public */ export declare enum HistoryServiceEventType { 'UNDO' = 'UNDO', 'REDO' = 'REDO', } /** * @public */ export declare type HistoryServiceStateSubscriber = (state: unknown) => void /** * @public */ export declare type HistoryServiceSubscriber = (type: HistoryServiceEventType, operate: string) => void /** * @public */ export declare interface IconPlugin extends BasePlugin { position: IconPluginPosition group: string label: string color: ThemeColor open: boolean icon: MixView<IconViewProps> onEnabledChange?: (value: boolean, e: MouseEvent) => void onIconClick?: (e: MouseEvent) => void onIconClickRouter?: (e: MouseEvent) => string onIconContextMenu?: (e: MouseEvent) => void } /** * @public */ export declare enum IconPluginPosition { TOP = 0, RIGHT = 1, BOTTOM = 2, LEFT = 3, TOP_LEFT = 4, BOTTOM_LEFT = 5, TOP_RIGHT = 6, BOTTOM_RIGHT = 7, UNKNOWN = 8, } /** * @public */ export declare interface IconViewProps extends DivProps { plugin: IconPlugin } /** * @public */ export declare function InternationalizationProvider(props: InternationalizationProviderProps): JSX.Element /** * @public */ export declare interface InternationalizationProviderProps { children?: ReactNode } /** * @public */ export declare class InternationalizationService { static get instance(): InternationalizationService private constructor() ALL_SUPPORT: Locale[] DEFAULT_SUPPORT: Locale locale: Locale messages: MessageTree load(messages: MessageTree, namespace?: string): boolean createIntl(namespace?: string): Intl_2 hasIntlCached(namespace?: string): boolean deleteIntlCached(namespace?: string): boolean clearIntlCached(namespace?: string): void createIntlWithWait(namespace?: string): Promise<Intl_2> subscribe(subscriber: NamespaceSubscriber): () => void unsubscribe(subscriber: NamespaceSubscriber): void wait(namespace: string): Promise<void> } /** * @public */ declare type Intl_2 = (strings: TemplateStringsArray, ...values: unknown[]) => string export { Intl_2 as Intl } /** * @public */ export declare function isAbstractMesh(node: Node_2): node is Mesh | AbstractMesh declare function isAttach(mime?: string): boolean declare function isBabylon(mime?: string): boolean declare function isChangeEventType( type: EventType | string, ): type is EventType.ADD | EventType.UPDATE | EventType.DELETE /** * @public */ export declare function isEqualColor3(c1: Color3, c2: Color3): boolean /** * @public */ export declare function isEqualColor3AndHex(c: Color3, hex: string): boolean /** * @public */ export declare function isEqualColor4(c1: Color4, c2: Color4): boolean declare function isFiniteVector(v: V3): boolean declare function isMaterial(mime?: string): boolean /** * @public */ export declare function isMesh(node: Node_2): node is Mesh /** * 判断两个文件是否相同 * * @param file - 目标文件 * @param name - 另一个文件的名称 * @param size - 另一个文件的大小 * @param hash - 另一个文件的哈希 (可选) (通过上方 chunkHash 函数计算得出) * * @returns 是否相同 */ declare function isSameFile(file: File, name: string, size: number, hash?: string): Promise<boolean> declare function isSupport(mime?: string): boolean declare function isSupportAudio(mime?: string): boolean declare function isSupportFile(mime?: string): boolean declare function isSupportImage(mime?: string): boolean declare function isSupportJson(mime?: string): boolean declare function isSupportModel(mime?: string): boolean declare function isSupportRender(mime?: string): boolean declare function isSupportText(mime?: string): boolean declare function isSupportTexture(mime?: string): boolean declare function isSupportVideo(mime?: string): boolean declare function isTexture(mime?: string): boolean declare function isUV(mime?: string): boolean declare function isValidNumber(value: unknown): value is number /** * @public */ export declare function joinPath(...args: (string | URL | JoinPathOptions)[]): string /** * 一律用正斜杠(/)的智能路径拼接(URL 或 文件路径)。 * * 设计要点 * - 传入任意数量的段,顺序拼接 * - 自动识别 URL(含 protocol-relative 的 //host)与 file:// * - 文件路径(POSIX/Windows/UNC/驱动器号)统一输出为正斜杠 * - 规范化重复斜杠、"."、".." * - 末尾斜杠可选(默认不保留) * - ?query 与 #hash 以最后一个非空段为准(URL 模式才生效) * */ declare interface JoinPathOptions { /** 是否保留末尾斜杠(默认 false) */ keepTrailingSlash?: boolean /** 强制作为 URL 处理(默认自动识别) */ treatAsUrl?: boolean } /** * @public */ export declare class LabelInfo { nid: string node: TransformNode | null text: string theme: LabelTheme x: number y: number parentElement: HTMLDivElement | null pointElement: HTMLDivElement | null lineElement: HTMLDivElement | null blockElement: HTMLDivElement | null textElement: HTMLDivElement | null validate: boolean always: boolean show: boolean lastClickTime: number lastSp: Vector3 | null constructor(nid: string, node?: TransformNode | null, text?: string, theme?: LabelTheme, x?: number, y?: number) } /** * @public */ export declare enum LabelTheme { Default = 'Default', } /** * @public */ export declare type LastSubscriber = (value: RsSelectionNodeInfo | null) => void /** * @public */ export declare class LightAnimation { static get instance(): LightAnimation private constructor() play(data: LightAnimationData, duration?: number, quickMode?: boolean): void intensity(value: number, duration?: number, quickMode?: boolean): void diffuseColor(color: Color3 | string, duration?: number, quickMode?: boolean): void specularColor(color: Color3 | string, duration?: number, quickMode?: boolean): void } /** * 定义光照动画数据接口 * @public */ declare interface LightAnimationData { intensity?: number diffuseColor?: Color3 | string specularColor?: Color3 | string } /** * @public */ export declare interface LocalData { fid: string type: LocalDataType mime: string status: LocalDataStatus progress: number url?: string blob?: Blob text?: string json?: unknown texture?: BaseTexture material?: Material uv?: unknown object?: unknown } /** * @public */ export declare class LocalDataService { static get instance(): LocalDataService private constructor() files: Map<string, LocalData> get(fid: string): LocalData | undefined has(fid: string): boolean add(option: AddLocalDataOption): LocalData /** * 加载一个文件到本地 * * @param fid - 文件在rv中的fid * @param url - 文件的直接下载链接或者oss链接 * @Param mime - 文件类型 */ load(fid: string, url: string, mime?: string): Promise<LocalData> loadByFile(fid: string, file: File, mime?: string): Promise<LocalData> processAfterLoad(localData: LocalData): Promise<boolean> remove(fid: string): boolean pause(fid: string): boolean resume(fid: string): boolean cancel(fid: string): boolean getLocalUrl(fid: string): string releaseLocalUrl(fid: string): boolean subscribe(subscriber: LocalDataServiceSubscriber): () => void unsubscribe(subscriber: LocalDataServiceSubscriber): void subscribeSingle(fid: string, subscriber: LocalDataServiceSubscriber): () => void unsubscribeSingle(fid: string, subscriber: LocalDataServiceSubscriber): void publish(fid: string, type: LocalDataServiceEventType, localData: LocalData): void afterLoaded(fid: string, subscriber: (localData: LocalData) => void): void waitLoaded(fid: string): Promise<LocalData> isLoaded(fid: string): boolean | undefined } /** * @public */ export declare enum LocalDataServiceEventType { ADD = 'ADD', REMOVE = 'REMOVE', START = 'START', PROGRESS = 'PROGRESS', PAUSE = 'PAUSE', RESUME = 'RESUME', LOADED = 'LOADED', ERROR = 'ERROR', CANCELED = 'CANCELED', } /** * @public */ export declare type LocalDataServiceSubscriber = (type: LocalDataServiceEventType, LocalData: LocalData) => void /** * @public */ export declare enum LocalDataStatus { WAITING = 'WAITING', LOADING = 'LOADING', PAUSED = 'PAUSED', LOADED = 'LOADED', FAILED = 'FAILED', CANCELED = 'CANCELED', } /** * @public */ export declare enum LocalDataType { BLOB = 'BLOB', OBJECT = 'OBJECT', } /** * @public */ export declare enum Locale { ZH = 'zh', EN = 'en', } /** * @public */ export declare function MainPortal(props: MainPortalProps): ReactPortal /** * @public */ export declare interface MainPortalProps { children: ReactNode } /** * 将字符串路径转换为 RvPath 数组 * @param path - 以点分隔的路径字符串,如 "a.0.b" * @returns RvPath 数组,数字字符串会被转换为数字类型 * @example * RvUtils.makeRvPath("a.0.b") // ['a', 0, 'b'] */ declare function makeRvPath(path: string): RvPath /** * 将 RvPath 数组转换为字符串路径 * @param path - RvPath 数组 * @returns 以点分隔的路径字符串 * @example * RvUtils.makeRvPathString(['a', 0, 'b']) // "a.0.b" */ declare function makeRvPathString(path: RvPath): string /** * @public */ export declare function MaterialSymbol(props: MaterialSymbolProps): React_2.JSX.Element /** * @public */ export declare function materialSymbol( icon: string, options?: MaterialSymbolOptions, ): FunctionComponent<Record<string, never>> /** * @public */ export declare type MaterialSymbolFunction = (icon: string, options?: MaterialSymbolOptions) => FunctionComponent /** * @public */ export declare interface MaterialSymbolOptions { fill?: boolean size?: string color?: string className?: string style?: React_2.CSSProperties } /** * @public */ export declare interface MaterialSymbolProps extends SpanProps { size?: string color?: string className?: string fill?: boolean } /** * @public */ export declare const MathUtils: { toDegrees: typeof toDegrees toRadians: typeof toRadians approximatelyEqual: typeof approximatelyEqual getDistance: typeof getDistance getDistance3d: typeof getDistance3d getNearestNumberIndex: typeof getNearestNumberIndex } /** * @public */ export declare class MeetingService { static get instance(): MeetingService private constructor() static PRESENTER_UPDATE_INTERVAL: number static VISITOR_ANIMATION_DURATION: number static CLICK_STORAGE_TIME: number static CLICK_STORAGE_NUMBER: number static CLICK_ANIMATION_DURATION: number static CLICK_ALLOW_DELAY: number state: MeetingState setActiveMeeting(meetingId?: string): void getActiveRvMeeting(): StoredRhineVar<RvMeeting> | null readonly IN_MEETING_STATUS: MeetingStatus[] inMeeting(): boolean isPresenter(): boolean isVisitor(): boolean isFollowingVisitor(): boolean isUnfollowingVisitor(): boolean subscribe(subscriber: MeetingStateSubscriber): () => void unsubscribe(subscriber: MeetingStateSubscriber): void getInvitationLink(): string } /** * @public */ export declare interface MeetingState { meetingId: string presenterId: number status: MeetingStatus startTime: number peopleCount: number forceFollow: boolean clickShareMode: ShareMode cursorShareMode: ShareMode selfFollow: boolean } /** * @public */ export declare type MeetingStateSubscriber = (state: MeetingState) => void /** * @public */ export declare enum MeetingStatus { PENDING = 'PENDING', PROGRESSING = 'PROGRESSING', ENDED = 'ENDED', CANCELED = 'CANCELED', BANNED = 'BANNED', } /** * @public */ export declare class MenuLine { options: MenuLineCreateOptions id: string type: MenuLineType text: string tip: string icon: FunctionComponent | undefined view: FunctionComponent | undefined color: string disabled: boolean shortcut: string onClick: (e: MouseEvent_2) => void onMouseOver: (e: MouseEvent_2) => void onMouseOut: (e: MouseEvent_2) => void closeAllOnClick: boolean checkboxDefaultValue: boolean onCheckboxChange: (value: boolean) => void sub: ContextMenuCreateOptions | undefined createTime: Date constructor( options: MenuLineCreateOptions, id: string, type?: MenuLineType, text?: string, tip?: string, icon?: FunctionComponent | undefined, view?: FunctionComponent | undefined, color?: string, disabled?: boolean, shortcut?: string, onClick?: (e: MouseEvent_2) => void, onMouseOver?: (e: MouseEvent_2) => void, onMouseOut?: (e: MouseEvent_2) => void, closeAllOnClick?: boolean, checkboxDefaultValue?: boolean, onCheckboxChange?: (value: boolean) => void, sub?: ContextMenuCreateOptions | undefined, // 子菜单项 createTime?: Date, ) static fromOptions(id: string, options: MenuLineCreateOptions): MenuLine } /** * @public */ export declare interface MenuLineCreateOptions { id?: string type?: MenuLineType text?: string tip?: string icon?: FunctionComponent view?: FunctionComponent color?: string disabled?: boolean shortcut?: string onClick?: (e: MouseEvent_2) => void onMouseOver?: (e: MouseEvent_2) => void onMouseOut?: (e: MouseEvent_2) => void closeAllOnClick?: boolean checkboxDefaultValue?: boolean onCheckboxChange?: (value: boolean) => void sub?: ContextMenuCreateOptions } /** * @public */ export declare enum MenuLineType { BUTTON = 'BUTTON', // 单个点击用按钮 DIVIDER = 'DIVIDER', // 分割线 CHECKBOX = 'CHECKBOX', // 单个可选中复选框 SUB = 'SUB', // 二级菜单 VIEW = 'VIEW', } /** * @public */ export declare class Message { text: string type: MessageType duration: number id: number show: boolean height: number opacity: number constructor(text: string, type: MessageType, duration: number, id: number) } /** * @public */ export declare type MessageLeaf = string /** * @public */ export declare type MessageLoader = (locale: Locale) => Promise<MessageTree> /** * @public */ export declare class MessageService { static get instance(): MessageService private constructor() messages: Message[] info(text: string, translateNamespace?: string, duration?: number): void success(text: string, translateNamespace?: string, duration?: number): void warning(text: string, translateNamespace?: string, duration?: number): void error(text: string, translateNamespace?: string, duration?: number): void showWithTranslate(text: string, type: MessageType, translateNamespace?: string, duration?: number): Promise<void> show(text: string, type: MessageType, duration?: number): Promise<void> } /** * @public */ export declare type MessageState = 'before' | 'show' | 'after' /** * @public */ export declare interface MessageTree { [key: string]: MessageTree | MessageLeaf } /** * @public */ export declare type MessageType = 'info' | 'warning' | 'error' | 'success' /** * @public */ export declare type MixView<T extends Attributes | null = null> = string | FunctionComponent<T> /** * @public */ export declare type NamespaceSubscriber = (namespaces: string[]) => void /** * @public */ export declare type NativeAnyEventSubscriber = (e: Event | null) => void /** * @public */ export declare type NativeDragEventSubscriber = (e: DragEvent) => void declare type NativeEvent = MouseEvent | DragEvent | TouchEvent | WheelEvent /** * @public */ export declare class NativeEventService { static get instance(): NativeEventService PLAYER_ID: string CANVAS_ID: string private constructor() subscribeClick(subscriber: NativeMouseEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribeClick(subscriber: NativeMouseEventSubscriber): void subscribeContextMenu(subscriber: NativeMouseEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribeContextMenu(subscriber: NativeMouseEventSubscriber): void subscribeDoubleClick(subscriber: NativeMouseEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribeDoubleClick(subscriber: NativeMouseEventSubscriber): void subscribeDrag(subscriber: NativeDragEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribeDrag(subscriber: NativeDragEventSubscriber): void subscribeDrop(subscriber: NativeDragEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribeDrop(subscriber: NativeDragEventSubscriber): void subscribeWheel(subscriber: NativeWheelEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribeWheel(subscriber: NativeWheelEventSubscriber): void subscribePointerDown(subscriber: NativePointerEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribePointerDown(subscriber: NativePointerEventSubscriber): void subscribePointerMove(subscriber: NativePointerEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribePointerMove(subscriber: NativePointerEventSubscriber): void subscribePointerUp(subscriber: NativePointerEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribePointerUp(subscriber: NativePointerEventSubscriber): void subscribePointerCancel(subscriber: NativePointerEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribePointerCancel(subscriber: NativePointerEventSubscriber): void subscribePointerEnter(subscriber: NativePointerEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribePointerEnter(subscriber: NativePointerEventSubscriber): void subscribePointerLeave(subscriber: NativePointerEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribePointerLeave(subscriber: NativePointerEventSubscriber): void subscribeKeyDown(subscriber: NativeKeyboardEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribeKeyDown(subscriber: NativeKeyboardEventSubscriber): void subscribeKeyUp(subscriber: NativeKeyboardEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribeKeyUp(subscriber: NativeKeyboardEventSubscriber): void subscribeKeyDownExceptInput( subscriber: NativeKeyboardEventSubscriber, option?: NativeEventSubscribeOption, ): () => void unsubscribeKeyDownExceptInput(subscriber: NativeKeyboardEventSubscriber): void subscribeKeyUpExceptInput(subscriber: NativeKeyboardEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribeKeyUpExceptInput(subscriber: NativeKeyboardEventSubscriber): void subscribeFocus(subscriber: NativeFocusEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribeFocus(subscriber: NativeFocusEventSubscriber): void subscribeBlur(subscriber: NativeFocusEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribeBlur(subscriber: NativeFocusEventSubscriber): void subscribeScroll(subscriber: NativeUIEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribeScroll(subscriber: NativeUIEventSubscriber): void subscribeResize(subscriber: NativeAnyEventSubscriber, option?: NativeEventSubscribeOption): () => void unsubscribeResize(subscriber: NativeAnyEventSubscriber): void } /** * @public */ export declare interface NativeEventSubscribeOption { canvasOnly?: boolean once?: boolean capture?: boolean } /** * @public */ export declare const NativeEventUtils: { getEventPosition: typeof getEventPosition getDistanceBetweenEvents: typeof getDistanceBetweenEvents