@mastergo/plugin-typings 2.8.2-beta.0 → 2.8.3-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 +26 -1
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1113,6 +1113,10 @@ declare global {
1113
1113
  */
1114
1114
  readonly codegen?: CodegenAPI
1115
1115
 
1116
+ readonly snippetgent?: SnippetgenAPI
1117
+
1118
+ readonly mode?: "inspect" | "design" | "codegen" | "snippetgen"
1119
+
1116
1120
  closePlugin(): void
1117
1121
 
1118
1122
  on<T extends PluginEventType>(type: T, callback: MGEventCallbackMap[T]): void
@@ -1124,7 +1128,7 @@ declare global {
1124
1128
 
1125
1129
  showUI(html: string, options?: ShowUIOptions): void
1126
1130
 
1127
- getNodeById(id: string): SceneNode | null
1131
+ getNodeById<T extends SceneNode>(id: string): T | null
1128
1132
  getNodeByPosition(position: { x: number, y: number }): SceneNode | null
1129
1133
  createRectangle(): RectangleNode
1130
1134
  createLine(): LineNode
@@ -2579,6 +2583,27 @@ declare global {
2579
2583
  getCodeByDSL(data: MGDSL.MGDSLData, type: MGDSL.Framework): Promise<CodeFile | null>;
2580
2584
  }
2581
2585
 
2586
+ interface SnippetgenData {
2587
+ language: string;
2588
+ layerId: string;
2589
+ preferences: Record<string, string>;
2590
+ unit: Record<string, string>;
2591
+ }
2592
+
2593
+ interface SnippetGenResult {
2594
+ language: string;
2595
+ code: string;
2596
+ title: string;
2597
+ }
2598
+
2599
+ interface SnippetgenAPI {
2600
+ on(type: 'generate', event: (data: SnippetgenData, callback: (modifiedData: SnippetGenResult[]) => void) => void): void
2601
+ off(type: 'generate', event: (data: SnippetgenData, callback: (modifiedData: SnippetGenResult[]) => void) => void): void
2602
+
2603
+ on(type: 'action', event: (value: string) => void): void
2604
+ off(type: 'action', event: (value: string) => void): void
2605
+ }
2606
+
2582
2607
  type StyleReturnType<T extends StyleType> =
2583
2608
  T extends 'PAINT' ? PaintStyle :
2584
2609
  T extends 'TEXT' ? TextStyle :
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastergo/plugin-typings",
3
- "version": "2.8.2-beta.0",
3
+ "version": "2.8.3-beta.0",
4
4
  "description": "MasterGo插件API声明文件",
5
5
  "main": "",
6
6
  "types": "dist/index.d.ts",