Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mastergo/plugin-typings",
"version": "2.18.1",
"version": "2.18.4-beta.0",
"description": "MasterGo插件API声明文件",
"type": "module",
"main": "",
Expand Down
44 changes: 44 additions & 0 deletions plugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ declare global {

readonly clientStorage: ClientStorageAPI

readonly WebSocket: WebSocketAPI

readonly currentUser: User | null

readonly viewport: ViewportAPI
Expand Down Expand Up @@ -496,6 +498,7 @@ declare global {
importComponentByKeyAsync(ukey: string): Promise<ComponentNode>
importComponentSetByKeyAsync(ukey: string): Promise<ComponentSetNode>
importStyleByKeyAsync(ukey: string): Promise<Style>
getComponentListVal(): ComponentItemVal[]
/**
* @deprecated
*
Expand Down Expand Up @@ -568,6 +571,29 @@ declare global {
keysAsync(): Promise<string[]>
}

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
Expand Down Expand Up @@ -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
Expand Down