diff --git a/CHANGELOG.md b/CHANGELOG.md index abafd63..397343c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## [2.18.3-beta.0](https://github.com/mastergo-design/plugin-typings/compare/v2.18.1...v2.18.3-beta.0) (2026-06-12) + + +### Features + +* 修改版本号 ([d10347e](https://github.com/mastergo-design/plugin-typings/commit/d10347e4acaf7645ddf588d915f293440278fac6)) +* add getComponentListVal method and ComponentItemVal type ([a3f3bf4](https://github.com/mastergo-design/plugin-typings/commit/a3f3bf4351fbdd9c50f198753c27ea161996e1b6)) +* **types:** add WebSocket API type definitions ([9f7ee75](https://github.com/mastergo-design/plugin-typings/commit/9f7ee7543ef4959620cb2f36f39f6ab0df59b8fe)) + + + ## [2.18.1](https://github.com/mastergo-design/plugin-typings/compare/v2.18.0...v2.18.1) (2026-06-05) diff --git a/package-lock.json b/package-lock.json index 5340b4b..33651cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mastergo/plugin-typings", - "version": "2.18.1", + "version": "2.18.3-beta.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mastergo/plugin-typings", - "version": "2.18.1", + "version": "2.18.3-beta.0", "license": "MIT", "devDependencies": { "@commitlint/cli": "^17.0.0", diff --git a/package.json b/package.json index b1017e2..a7323eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mastergo/plugin-typings", - "version": "2.18.1", + "version": "2.18.3-beta.0", "description": "MasterGo插件API声明文件", "type": "module", "main": "", diff --git a/plugin.d.ts b/plugin.d.ts index a3aa6e6..3fc3027 100644 --- a/plugin.d.ts +++ b/plugin.d.ts @@ -315,6 +315,8 @@ declare global { readonly clientStorage: ClientStorageAPI + readonly WebSocket: WebSocketAPI + readonly currentUser: User | null readonly viewport: ViewportAPI @@ -568,6 +570,29 @@ declare global { keysAsync(): Promise } + interface WebSocketHandle { + readonly readyState: number + readonly url: string + readonly protocol: string + + onopen: ((self: WebSocketHandle, event: { type: string }) => void) | undefined + onmessage: ((self: WebSocketHandle, data: any) => void) | undefined + onclose: ((self: WebSocketHandle, event: { code: number; reason: string; wasClean: boolean }) => void) | undefined + onerror: ((self: WebSocketHandle, event: { type: string }) => void) | undefined + + send(data: any): void + close(code?: number, reason?: string): void + } + + interface WebSocketAPI { + CONNECTING: 0 + OPEN: 1 + CLOSING: 2 + CLOSED: 3 + + connect(url: string, protocols?: string | string[]): WebSocketHandle + } + type ShowUIOptions = { width?: number height?: number @@ -1771,6 +1796,7 @@ declare global { } ): string deleteComponentProperty(propertyId: string): void + getComponentListVal(): ComponentItemVal[] } type ComponentPropertyValues = Array @@ -1794,6 +1820,24 @@ declare global { type ComponentPropertyOptions = { preferredValues?: InstanceSwapPreferredValue[] } + type ComponentItemVal = { + id: string + name: string + componentSignature: string + cover: string + description: string + documentationLinks: Array<{ url: string }> + height: number + width: number + isExternal: boolean + isHidden: boolean + pageId: string + pageName: string + ukey: string + version: number + componentNameAlias: string + parentId?: string + } type ComponentProperties = { name: string id?: string