@mastergo/plugin-typings 2.8.2 → 2.8.4-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,8 @@ declare global {
1113
1113
  */
1114
1114
  readonly codegen?: CodegenAPI
1115
1115
 
1116
+ readonly snippetgent?: SnippetgenAPI
1117
+
1116
1118
  readonly mode?: "inspect" | "design" | "codegen" | "snippetgen"
1117
1119
 
1118
1120
  closePlugin(): void
@@ -1126,7 +1128,7 @@ declare global {
1126
1128
 
1127
1129
  showUI(html: string, options?: ShowUIOptions): void
1128
1130
 
1129
- getNodeById(id: string): SceneNode | null
1131
+ getNodeById<T extends SceneNode>(id: string): T | null
1130
1132
  getNodeByPosition(position: { x: number, y: number }): SceneNode | null
1131
1133
  createRectangle(): RectangleNode
1132
1134
  createLine(): LineNode
@@ -2444,6 +2446,8 @@ declare global {
2444
2446
  readonly cover: string
2445
2447
  readonly width: number
2446
2448
  readonly height: number
2449
+ /** 如果 Component 属于某一个 ComponentSet,则 componentSetUkey 为 ComponentSet 的 ukey, 否则为空字符串 */
2450
+ readonly componentSetUkey: string
2447
2451
  }
2448
2452
 
2449
2453
  interface TeamLibraryStyle {
@@ -2581,6 +2585,27 @@ declare global {
2581
2585
  getCodeByDSL(data: MGDSL.MGDSLData, type: MGDSL.Framework): Promise<CodeFile | null>;
2582
2586
  }
2583
2587
 
2588
+ interface SnippetgenData {
2589
+ language: string;
2590
+ layerId: string;
2591
+ preferences: Record<string, string>;
2592
+ unit: Record<string, string>;
2593
+ }
2594
+
2595
+ interface SnippetGenResult {
2596
+ language: string;
2597
+ code: string;
2598
+ title: string;
2599
+ }
2600
+
2601
+ interface SnippetgenAPI {
2602
+ on(type: 'generate', event: (data: SnippetgenData, callback: (modifiedData: SnippetGenResult[]) => void) => void): void
2603
+ off(type: 'generate', event: (data: SnippetgenData, callback: (modifiedData: SnippetGenResult[]) => void) => void): void
2604
+
2605
+ on(type: 'action', event: (value: string) => void): void
2606
+ off(type: 'action', event: (value: string) => void): void
2607
+ }
2608
+
2584
2609
  type StyleReturnType<T extends StyleType> =
2585
2610
  T extends 'PAINT' ? PaintStyle :
2586
2611
  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",
3
+ "version": "2.8.4-beta.0",
4
4
  "description": "MasterGo插件API声明文件",
5
5
  "main": "",
6
6
  "types": "dist/index.d.ts",