@mastergo/plugin-typings 2.8.0-beta.0 → 2.8.0-beta.2

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.
package/README-en.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Publish to NPM](https://github.com/mastergo-design/plugin-typings/actions/workflows/publish.yaml/badge.svg)](https://github.com/mastergo-design/plugin-typings/actions/workflows/publish.yaml)
2
+
1
3
  **English** | [中文](./README.md)
2
4
 
3
5
  # MasterGo Plugin Typings
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Publish to NPM](https://github.com/mastergo-design/plugin-typings/actions/workflows/publish.yaml/badge.svg)](https://github.com/mastergo-design/plugin-typings/actions/workflows/publish.yaml)
2
+
1
3
  **中文** | [English](./README-en.md)
2
4
 
3
5
  # MasterGo插件API声明文件
package/dist/index.d.ts CHANGED
@@ -1041,15 +1041,29 @@ declare global {
1041
1041
  getBytesAsync(): Promise<Uint8Array>
1042
1042
  }
1043
1043
 
1044
- type GuardEventType = 'beforeReadyForDev'
1044
+ type ThemeColor = 'dark' | 'light'
1045
1045
 
1046
- type PluginEventType =
1047
- 'selectionchange' | 'layoutchange' |
1048
- 'currentpagechange' | 'close' |
1049
- 'themechange' | 'drop' |
1050
- 'run' | 'readyForDev' | GuardEventType
1046
+ type LayoutInfo = {
1047
+ leftbar: number;
1048
+ rightbar: number;
1049
+ canvas: number;
1050
+ window: number;
1051
+ height: number;
1052
+ topbar: number;
1053
+ }
1051
1054
 
1052
- type ThemeColor = 'dark' | 'light'
1055
+ type MGEventCallbackMap = {
1056
+ 'selectionchange': (selectionLayerIds: string[]) => void;
1057
+ 'layoutchange': (layoutInfo: LayoutInfo) => void;
1058
+ 'currentpagechange': (pageId: string) => void;
1059
+ 'themechange': (theme: ThemeColor) => void;
1060
+ 'drop': (event: DropEvent) => void;
1061
+ 'run': (command: { command: string }) => void;
1062
+ 'close': () => void;
1063
+ 'beforeReadyForDev': (sectionLayerId: string, callback: (setReady: boolean) => void) => void;
1064
+ }
1065
+
1066
+ type PluginEventType = keyof MGEventCallbackMap
1053
1067
 
1054
1068
  interface PluginAPI {
1055
1069
  readonly document: DocumentNode
@@ -1081,9 +1095,9 @@ declare global {
1081
1095
 
1082
1096
  closePlugin(): void
1083
1097
 
1084
- on(type: PluginEventType, callback: CallableFunction): void
1085
- once(type: PluginEventType, callback: CallableFunction): void
1086
- off(type?: PluginEventType, callback?: CallableFunction): void
1098
+ on<T extends PluginEventType>(type: T, callback: MGEventCallbackMap[T]): void
1099
+ once<T extends PluginEventType>(type: T, callback: MGEventCallbackMap[T]): void
1100
+ off<T extends PluginEventType>(type?: T, callback?: MGEventCallbackMap[T]): void
1087
1101
 
1088
1102
  commitUndo(): void
1089
1103
  triggerUndo(): void
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastergo/plugin-typings",
3
- "version": "2.8.0-beta.0",
3
+ "version": "2.8.0-beta.2",
4
4
  "description": "MasterGo插件API声明文件",
5
5
  "main": "",
6
6
  "types": "dist/index.d.ts",