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

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
@@ -1170,15 +1184,14 @@ declare global {
1170
1184
  * @param styleName
1171
1185
  * @param description
1172
1186
  */
1173
- createStyleCopy<T extends StyleType = StyleType>(sourceStyleId: string, type: T, styleName?: string, description?: string): StyleReturnType<T>
1187
+ createStyleCopy<T extends StyleType = "PAINT">(sourceStyleId: string, styleName?: string, description?: string): StyleReturnType<T>
1174
1188
  /**
1175
1189
  * 创建某一个样式引用
1176
1190
  * @param sourceStyleId 引用源样式id
1177
- * @param type
1178
1191
  * @param styleName
1179
1192
  * @param description
1180
1193
  */
1181
- createStyleRef<T extends StyleType = StyleType>(sourceStyleId: string, type: T, styleName?: string, description?: string): StyleReturnType<T>
1194
+ createStyleRef<T extends StyleType = "PAINT">(sourceStyleId: string, styleName?: string, description?: string): StyleReturnType<T>
1182
1195
 
1183
1196
  getLocalPaintStyles(): PaintStyle[]
1184
1197
  getLocalEffectStyles(): EffectStyle[]
@@ -1348,7 +1361,7 @@ declare global {
1348
1361
  type StyleType = 'PAINT' | 'TEXT' | 'EFFECT' | 'GRID' | 'STROKE_WIDTH' | 'CORNER_RADIUS' | 'PADDING' | 'SPACING'
1349
1362
  type NodeStyleType = 'fill' | 'strokeFill' | 'strokeWidth' | 'cornerRadius' | 'padding' | 'spacing'
1350
1363
 
1351
- interface BaseStyle extends Omit<PublishableMixin, 'documentationLinks' | 'alias'> {
1364
+ interface BaseStyle extends Omit<PublishableMixin, 'documentationLinks'> {
1352
1365
  readonly id: string
1353
1366
  readonly type: StyleType
1354
1367
  name: string
@@ -1782,7 +1795,6 @@ declare global {
1782
1795
  strokeStyleId: string
1783
1796
  strokeFillStyleId: string
1784
1797
  strokeWidthStyleId: string
1785
- borderStyleId: string
1786
1798
  paddingStyleId: string
1787
1799
  spacingStyleId: string
1788
1800
  cornerRadiusStyleId: string
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.3",
4
4
  "description": "MasterGo插件API声明文件",
5
5
  "main": "",
6
6
  "types": "dist/index.d.ts",