@mastergo/plugin-typings 2.18.0 → 2.18.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.d.ts +28 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1339,6 +1339,8 @@ declare global {
1339
1339
 
1340
1340
  readonly clientStorage: ClientStorageAPI
1341
1341
 
1342
+ readonly WebSocket: WebSocketAPI
1343
+
1342
1344
  readonly currentUser: User | null
1343
1345
 
1344
1346
  readonly viewport: ViewportAPI
@@ -1374,6 +1376,8 @@ declare global {
1374
1376
 
1375
1377
  getNodeById<T extends SceneNode>(id: string): T | null
1376
1378
  getNodeByPosition(position: { x: number; y: number }): SceneNode | null
1379
+ getRootNodeById<T extends SceneNode>(id: string): T | null
1380
+ getRootParentLayerId(id: string): string | null
1377
1381
  createRectangle(): RectangleNode
1378
1382
  createLine(): LineNode
1379
1383
  createEllipse(): EllipseNode
@@ -1590,6 +1594,29 @@ declare global {
1590
1594
  keysAsync(): Promise<string[]>
1591
1595
  }
1592
1596
 
1597
+ interface WebSocketHandle {
1598
+ readonly readyState: number
1599
+ readonly url: string
1600
+ readonly protocol: string
1601
+
1602
+ onopen: ((self: WebSocketHandle, event: { type: string }) => void) | undefined
1603
+ onmessage: ((self: WebSocketHandle, data: any) => void) | undefined
1604
+ onclose: ((self: WebSocketHandle, event: { code: number; reason: string; wasClean: boolean }) => void) | undefined
1605
+ onerror: ((self: WebSocketHandle, event: { type: string }) => void) | undefined
1606
+
1607
+ send(data: any): void
1608
+ close(code?: number, reason?: string): void
1609
+ }
1610
+
1611
+ interface WebSocketAPI {
1612
+ CONNECTING: 0
1613
+ OPEN: 1
1614
+ CLOSING: 2
1615
+ CLOSED: 3
1616
+
1617
+ connect(url: string, protocols?: string | string[]): WebSocketHandle
1618
+ }
1619
+
1593
1620
  type ShowUIOptions = {
1594
1621
  width?: number
1595
1622
  height?: number
@@ -2291,6 +2318,7 @@ declare global {
2291
2318
  alignSelf: 'STRETCH' | 'INHERIT' // applicable only inside auto-layout frames
2292
2319
  flexGrow: 0 | 1 // applicable only inside auto-layout frames
2293
2320
  rescale(scale: number, scaleOption?: ScaleOption): void
2321
+ resize(width: number, height: number): void
2294
2322
  scaleFactor: number // The default value is 1
2295
2323
  flip(direction: 'VERTICAL' | 'HORIZONTAL'): void
2296
2324
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastergo/plugin-typings",
3
- "version": "2.18.0",
3
+ "version": "2.18.2-beta.0",
4
4
  "description": "MasterGo插件API声明文件",
5
5
  "type": "module",
6
6
  "main": "",