@mastergo/plugin-typings 2.10.0 → 2.14.0-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 +502 -214
  2. package/package.json +17 -17
package/dist/index.d.ts CHANGED
@@ -1071,23 +1071,26 @@ declare global {
1071
1071
  type ThemeColor = 'dark' | 'light'
1072
1072
 
1073
1073
  type LayoutInfo = {
1074
- leftbar: number;
1075
- rightbar: number;
1076
- canvas: number;
1077
- window: number;
1078
- height: number;
1079
- topbar: number;
1074
+ leftbar: number
1075
+ rightbar: number
1076
+ canvas: number
1077
+ window: number
1078
+ height: number
1079
+ topbar: number
1080
1080
  }
1081
1081
 
1082
1082
  type MGEventCallbackMap = {
1083
- 'selectionchange': (selectionLayerIds: string[]) => void;
1084
- 'layoutchange': (layoutInfo: LayoutInfo) => void;
1085
- 'currentpagechange': (pageId: string) => void;
1086
- 'themechange': (theme: ThemeColor) => void;
1087
- 'drop': (event: DropEvent) => void;
1088
- 'run': (command: { command: string }) => void;
1089
- 'close': () => void;
1090
- 'beforeReadyForDev': (sectionLayerId: string, callback: (setReady: boolean) => void) => void;
1083
+ selectionchange: (selectionLayerIds: string[]) => void
1084
+ layoutchange: (layoutInfo: LayoutInfo) => void
1085
+ currentpagechange: (pageId: string) => void
1086
+ themechange: (theme: ThemeColor) => void
1087
+ drop: (event: DropEvent) => void
1088
+ run: (command: { command: string }) => void
1089
+ close: () => void
1090
+ beforeReadyForDev: (
1091
+ sectionLayerId: string,
1092
+ callback: (setReady: boolean) => void
1093
+ ) => void
1091
1094
  }
1092
1095
 
1093
1096
  type PluginEventType = keyof MGEventCallbackMap
@@ -1122,13 +1125,22 @@ declare global {
1122
1125
 
1123
1126
  readonly snippetgen?: SnippetgenAPI
1124
1127
 
1125
- readonly mode?: "inspect" | "design" | "codegen" | "snippetgen"
1128
+ readonly mode?: 'inspect' | 'design' | 'codegen' | 'snippetgen'
1126
1129
 
1127
1130
  closePlugin(): void
1128
1131
 
1129
- on<T extends PluginEventType>(type: T, callback: MGEventCallbackMap[T]): void
1130
- once<T extends PluginEventType>(type: T, callback: MGEventCallbackMap[T]): void
1131
- off<T extends PluginEventType>(type?: T, callback?: MGEventCallbackMap[T]): void
1132
+ on<T extends PluginEventType>(
1133
+ type: T,
1134
+ callback: MGEventCallbackMap[T]
1135
+ ): void
1136
+ once<T extends PluginEventType>(
1137
+ type: T,
1138
+ callback: MGEventCallbackMap[T]
1139
+ ): void
1140
+ off<T extends PluginEventType>(
1141
+ type?: T,
1142
+ callback?: MGEventCallbackMap[T]
1143
+ ): void
1132
1144
 
1133
1145
  commitUndo(): void
1134
1146
  triggerUndo(): void
@@ -1136,7 +1148,7 @@ declare global {
1136
1148
  showUI(html: string, options?: ShowUIOptions): void
1137
1149
 
1138
1150
  getNodeById<T extends SceneNode>(id: string): T | null
1139
- getNodeByPosition(position: { x: number, y: number }): SceneNode | null
1151
+ getNodeByPosition(position: { x: number; y: number }): SceneNode | null
1140
1152
  createRectangle(): RectangleNode
1141
1153
  createLine(): LineNode
1142
1154
  createEllipse(): EllipseNode
@@ -1175,10 +1187,22 @@ declare global {
1175
1187
 
1176
1188
  getStyleById(id: string): Style | null
1177
1189
  getStyleCodeById(id: string, options?: StyleCodeOptions): CodeString | null
1178
- getWebStyleCodeById(id: string, options?: WebStyleCodeOptions): CodeString | null
1179
- getAndroidStyleCodeById(id: string, options?: AndroidStyleCodeOptions): CodeString | null
1180
- getIOSStyleCodeById(id: string, options?: IOSStyleCodeOptions): CodeString | null
1181
- getTitleByFontFamilyAndStyle(fontFamily: string, fontStyle: string): FontAlias | null
1190
+ getWebStyleCodeById(
1191
+ id: string,
1192
+ options?: WebStyleCodeOptions
1193
+ ): CodeString | null
1194
+ getAndroidStyleCodeById(
1195
+ id: string,
1196
+ options?: AndroidStyleCodeOptions
1197
+ ): CodeString | null
1198
+ getIOSStyleCodeById(
1199
+ id: string,
1200
+ options?: IOSStyleCodeOptions
1201
+ ): CodeString | null
1202
+ getTitleByFontFamilyAndStyle(
1203
+ fontFamily: string,
1204
+ fontStyle: string
1205
+ ): FontAlias | null
1182
1206
 
1183
1207
  createFillStyle(config: CreateStyleConfig): PaintStyle
1184
1208
  createEffectStyle(config: CreateStyleConfig): EffectStyle
@@ -1197,12 +1221,17 @@ declare global {
1197
1221
 
1198
1222
  /**
1199
1223
  * createFillStyle/createStrokeFillStyle 这些函数的聚合函数,传入不同的 type,返回对应的 style
1200
- * @param layerId
1224
+ * @param layerId
1201
1225
  * @param type NodeStyleType
1202
1226
  * @param styleName
1203
1227
  * @param description optional
1204
1228
  */
1205
- createStyleByLayer<T extends NodeStyleType>(layerId: string, type: T, styleName: string, description?: string): NodeStyleReturnType<T>
1229
+ createStyleByLayer<T extends NodeStyleType>(
1230
+ layerId: string,
1231
+ type: T,
1232
+ styleName: string,
1233
+ description?: string
1234
+ ): NodeStyleReturnType<T>
1206
1235
 
1207
1236
  /**
1208
1237
  * 创建一个新的默认样式,不依赖某一个图层中的样式,
@@ -1211,15 +1240,23 @@ declare global {
1211
1240
  * @param styleName
1212
1241
  * @param description optional
1213
1242
  */
1214
- createStyle<T extends StyleType>(type: T, styleName: string, description?: string): StyleReturnType<T>
1243
+ createStyle<T extends StyleType>(
1244
+ type: T,
1245
+ styleName: string,
1246
+ description?: string
1247
+ ): StyleReturnType<T>
1215
1248
  /**
1216
1249
  * 创建某一个样式的副本
1217
1250
  * @param sourceStyleId 副本的源样式id
1218
- * @param type
1219
- * @param styleName
1220
- * @param description
1251
+ * @param type
1252
+ * @param styleName
1253
+ * @param description
1221
1254
  */
1222
- createStyleCopy<T extends StyleType = "PAINT">(sourceStyleId: string, styleName?: string, description?: string): StyleReturnType<T>
1255
+ createStyleCopy<T extends StyleType = 'PAINT'>(
1256
+ sourceStyleId: string,
1257
+ styleName?: string,
1258
+ description?: string
1259
+ ): StyleReturnType<T>
1223
1260
 
1224
1261
  getLocalPaintStyles(): PaintStyle[]
1225
1262
  getLocalEffectStyles(): EffectStyle[]
@@ -1234,24 +1271,45 @@ declare global {
1234
1271
  loadFontAsync(fontName: FontName): Promise<boolean>
1235
1272
  createImage(imageData: Uint8Array, isSync?: boolean): Promise<Image>
1236
1273
  getImageByHref(href: string): Image
1274
+ /**
1275
+ * 导出多个图层组成的png图片, 可过滤图层id,设置导出图片的缩放倍率
1276
+ */
1277
+ exportPng(params: GlobalExportPngSetting): string;
1278
+ /**
1279
+ * 导出多个图层组成的svg图片
1280
+ * @param layerIds 图层id数组
1281
+ */
1282
+ exportSvgByLayerIds(layerIds: string[]): string
1237
1283
 
1238
-
1239
- getTeamLibraryAsync(): Promise<TeamLibrary>,
1240
- importComponentByKeyAsync(ukey: string): Promise<ComponentNode>,
1241
- importComponentSetByKeyAsync(ukey: string): Promise<ComponentSetNode>,
1242
- importStyleByKeyAsync(ukey: string): Promise<Style>,
1284
+ getTeamLibraryAsync(): Promise<TeamLibrary>
1285
+ importComponentByKeyAsync(ukey: string): Promise<ComponentNode>
1286
+ importComponentSetByKeyAsync(ukey: string): Promise<ComponentSetNode>
1287
+ importStyleByKeyAsync(ukey: string): Promise<Style>
1243
1288
  /**
1244
1289
  * @deprecated
1245
- *
1290
+ *
1246
1291
  * This attribute is deprecated, please use getTeamLibraryAsync instead.
1247
1292
  */
1248
- teamLibrary: TeamLibrary,
1293
+ teamLibrary: TeamLibrary
1249
1294
 
1250
1295
  hexToRGBA(hex: string): RGBA
1251
1296
  RGBAToHex(rgba: RGBA): string
1252
1297
 
1253
- confirm: (message: string, options: [ConfirmAction, ...ConfirmAction[]]) => void
1254
- prompt: (message: string, defaultValue: string, options: [PromptAction, ...PromptAction[]]) => void
1298
+ confirm: (
1299
+ message: string,
1300
+ options: [ConfirmAction, ...ConfirmAction[]]
1301
+ ) => void
1302
+ prompt: (
1303
+ message: string,
1304
+ defaultValue: string,
1305
+ options: [PromptAction, ...PromptAction[]]
1306
+ ) => void
1307
+ }
1308
+
1309
+ interface GlobalExportPngSetting {
1310
+ ids?: string[];
1311
+ filterIds?: string[];
1312
+ scale?: number;
1255
1313
  }
1256
1314
 
1257
1315
  interface User {
@@ -1260,7 +1318,7 @@ declare global {
1260
1318
  photoUrl: string | null
1261
1319
  }
1262
1320
 
1263
- interface Rect extends Readonly<Bound> { }
1321
+ interface Rect extends Readonly<Bound> {}
1264
1322
  interface NotificationHandler {
1265
1323
  cancel: () => void
1266
1324
  }
@@ -1317,7 +1375,7 @@ declare global {
1317
1375
  readonly isSuffix?: boolean
1318
1376
  readonly fileName?: string
1319
1377
  readonly constraint?: ExportSettingsConstraints
1320
- readonly useAbsoluteBounds?: boolean // defaults to true
1378
+ readonly useAbsoluteBounds?: boolean // defaults to true
1321
1379
  readonly useRenderBounds?: boolean // default to true
1322
1380
  }
1323
1381
  interface ExportSettingsSVG {
@@ -1334,13 +1392,16 @@ declare global {
1334
1392
  readonly useRenderBounds?: boolean // default to true
1335
1393
  }
1336
1394
 
1337
- type ExportSettings = ExportSettingsImage | ExportSettingsSVG | ExportSettingsPDF
1338
-
1395
+ type ExportSettings =
1396
+ | ExportSettingsImage
1397
+ | ExportSettingsSVG
1398
+ | ExportSettingsPDF
1339
1399
 
1340
1400
  interface ExportMixin {
1341
1401
  exportSettings: ReadonlyArray<ExportSettings>
1342
1402
  export(settings?: ExportSettings): Uint8Array | string // Defaults to PNG format
1343
1403
  exportAsync(settings?: ExportSettings): Promise<Uint8Array | string>
1404
+ exportPng(settings?: Omit<GlobalExportPngSetting, 'ids'>): string
1344
1405
  }
1345
1406
 
1346
1407
  interface NotifyOptions {
@@ -1384,10 +1445,10 @@ declare global {
1384
1445
  }
1385
1446
 
1386
1447
  type CodeData = {
1387
- layout?: string;
1388
- style?: string;
1389
- typography?: string;
1390
- other?: string;
1448
+ layout?: string
1449
+ style?: string
1450
+ typography?: string
1451
+ other?: string
1391
1452
  }
1392
1453
  interface CodeString {
1393
1454
  type: 'CSS' | 'iOS' | 'Android'
@@ -1430,8 +1491,22 @@ declare global {
1430
1491
  }
1431
1492
 
1432
1493
  // Styles
1433
- type StyleType = 'PAINT' | 'TEXT' | 'EFFECT' | 'GRID' | 'STROKE_WIDTH' | 'CORNER_RADIUS' | 'PADDING' | 'SPACING'
1434
- type NodeStyleType = 'fill' | 'strokeFill' | 'strokeWidth' | 'cornerRadius' | 'padding' | 'spacing'
1494
+ type StyleType =
1495
+ | 'PAINT'
1496
+ | 'TEXT'
1497
+ | 'EFFECT'
1498
+ | 'GRID'
1499
+ | 'STROKE_WIDTH'
1500
+ | 'CORNER_RADIUS'
1501
+ | 'PADDING'
1502
+ | 'SPACING'
1503
+ type NodeStyleType =
1504
+ | 'fill'
1505
+ | 'strokeFill'
1506
+ | 'strokeWidth'
1507
+ | 'cornerRadius'
1508
+ | 'padding'
1509
+ | 'spacing'
1435
1510
 
1436
1511
  interface BaseStyle extends Omit<PublishableMixin, 'documentationLinks'> {
1437
1512
  readonly id: string
@@ -1523,9 +1598,15 @@ declare global {
1523
1598
  layoutGrids: ReadonlyArray<LayoutGrid>
1524
1599
  }
1525
1600
 
1526
- type Style = PaintStyle | EffectStyle | TextStyle |
1527
- GridStyle | StrokeWidthStyle | CornerRadiusStyle |
1528
- PaddingStyle | SpacingStyle
1601
+ type Style =
1602
+ | PaintStyle
1603
+ | EffectStyle
1604
+ | TextStyle
1605
+ | GridStyle
1606
+ | StrokeWidthStyle
1607
+ | CornerRadiusStyle
1608
+ | PaddingStyle
1609
+ | SpacingStyle
1529
1610
 
1530
1611
  /// /////////////////////////////////////////////////////////////////////////////
1531
1612
  // Datatypes
@@ -1555,7 +1636,7 @@ declare global {
1555
1636
  readonly style: string
1556
1637
  }
1557
1638
 
1558
- type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE';
1639
+ type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE'
1559
1640
 
1560
1641
  type TextDecoration = 'NONE' | 'UNDERLINE' | 'STRIKETHROUGH'
1561
1642
 
@@ -1577,9 +1658,46 @@ declare global {
1577
1658
  readonly radius: number
1578
1659
  readonly isVisible: boolean
1579
1660
  readonly blendMode: BlendMode
1661
+ readonly gradient: PluginGradientEffect
1662
+ }
1663
+
1664
+ interface PluginGradientEffect {
1665
+ readonly mode: 'EVEN' | 'PROGRESSIVE'
1666
+ readonly gradientStops?: ReadonlyArray<PluginGradientStopItem>
1667
+ readonly gradientHandlePositions?: [Point, Point]
1668
+ readonly transform?: Transform
1669
+ }
1670
+
1671
+ interface PluginGradientStopItem {
1672
+ readonly position: number
1673
+ readonly value: number
1674
+ }
1675
+
1676
+ interface Point {
1677
+ readonly x: number
1678
+ readonly y: number
1679
+ }
1680
+
1681
+ interface LiquidGlassEffect {
1682
+ readonly type: 'LIQUID_GLASS'
1683
+ readonly depth: number
1684
+ readonly dispersion: number
1685
+ readonly refraction: number
1686
+ readonly lightIntensity: number
1687
+ readonly lightAngle: number
1688
+ readonly isVisible: boolean
1689
+ readonly radius: number
1690
+ readonly blendMode: BlendMode
1691
+ }
1692
+
1693
+ interface MotionBlurEffect {
1694
+ readonly isVisible: boolean
1695
+ readonly radius: number
1696
+ readonly angle: number
1697
+ readonly blendMode: BlendMode
1580
1698
  }
1581
1699
 
1582
- type Effect = ShadowEffect | BlurEffect
1700
+ type Effect = ShadowEffect | BlurEffect | LiquidGlassEffect | MotionBlurEffect
1583
1701
 
1584
1702
  // 待确认
1585
1703
  type ConstraintType = 'START' | 'END' | 'STARTANDEND' | 'CENTER' | 'SCALE'
@@ -1610,13 +1728,16 @@ declare global {
1610
1728
 
1611
1729
  interface GradientPaint {
1612
1730
  readonly type:
1613
- | 'GRADIENT_LINEAR'
1614
- | 'GRADIENT_RADIAL'
1615
- | 'GRADIENT_ANGULAR'
1616
- | 'GRADIENT_DIAMOND'
1731
+ | 'GRADIENT_LINEAR'
1732
+ | 'GRADIENT_RADIAL'
1733
+ | 'GRADIENT_ANGULAR'
1734
+ | 'GRADIENT_DIAMOND'
1617
1735
  readonly transform: Transform
1618
1736
  readonly gradientStops: ReadonlyArray<ColorStop>
1619
- readonly gradientHandlePositions?: [{ x: number, y: number }, { x: number, y: number }];
1737
+ readonly gradientHandlePositions?: [
1738
+ { x: number; y: number },
1739
+ { x: number; y: number }
1740
+ ]
1620
1741
  readonly isVisible?: boolean
1621
1742
  readonly alpha?: number
1622
1743
  readonly blendMode?: BlendMode
@@ -1650,22 +1771,26 @@ declare global {
1650
1771
 
1651
1772
  type Paint = SolidPaint | GradientPaint | ImagePaint
1652
1773
 
1653
- type CSSWidthSetter = number | [number, number] | [number, number, number] | [number, number, number, number]
1774
+ type CSSWidthSetter =
1775
+ | number
1776
+ | [number, number]
1777
+ | [number, number, number]
1778
+ | [number, number, number, number]
1654
1779
 
1655
1780
  interface StrokeWidth {
1656
- width: CSSWidthSetter,
1781
+ width: CSSWidthSetter
1657
1782
  }
1658
1783
 
1659
1784
  interface Padding {
1660
- padding: CSSWidthSetter,
1785
+ padding: CSSWidthSetter
1661
1786
  }
1662
1787
 
1663
1788
  interface Spacing {
1664
- spacing: CSSWidthSetter,
1789
+ spacing: CSSWidthSetter
1665
1790
  }
1666
1791
 
1667
1792
  interface CornerRadius {
1668
- cornerRadius: CSSWidthSetter,
1793
+ cornerRadius: CSSWidthSetter
1669
1794
  }
1670
1795
 
1671
1796
  type WindingRule = 'Nonzero' | 'Evenodd'
@@ -1696,12 +1821,12 @@ declare global {
1696
1821
 
1697
1822
  type LineHeight =
1698
1823
  | {
1699
- readonly value: number
1700
- readonly unit: 'PIXELS' | 'PERCENT'
1701
- }
1824
+ readonly value: number
1825
+ readonly unit: 'PIXELS' | 'PERCENT'
1826
+ }
1702
1827
  | {
1703
- readonly unit: 'AUTO'
1704
- }
1828
+ readonly unit: 'AUTO'
1829
+ }
1705
1830
 
1706
1831
  type BlendMode =
1707
1832
  | 'NORMAL'
@@ -1758,8 +1883,8 @@ declare global {
1758
1883
  isLocked: boolean
1759
1884
  readonly attachedConnectors: ConnectorNode[]
1760
1885
  componentPropertyReferences: {
1761
- isVisible?: string,
1762
- characters?: string,
1886
+ isVisible?: string
1887
+ characters?: string
1763
1888
  mainComponent?: string
1764
1889
  } | null
1765
1890
  slotInfo: { slotName: string; slotAlias: string } | null
@@ -1777,7 +1902,9 @@ declare global {
1777
1902
 
1778
1903
  findAll(callback?: (node: SceneNode) => boolean): ReadonlyArray<SceneNode>
1779
1904
  findOne(callback: (node: SceneNode) => boolean): SceneNode | null
1780
- findAllWithCriteria<T extends NodeType[]>(criteria: { types: T }): Array<{ type: T[number] } & SceneNode>
1905
+ findAllWithCriteria<T extends NodeType[]>(criteria: {
1906
+ types: T
1907
+ }): Array<{ type: T[number] } & SceneNode>
1781
1908
  }
1782
1909
 
1783
1910
  interface ConstraintMixin {
@@ -1791,7 +1918,16 @@ declare global {
1791
1918
  height: number
1792
1919
  }
1793
1920
 
1794
- type ScaleCenter = 'TOPLEFT' | 'TOP' | 'TOPRIGHT' | 'LEFT' | 'CENTER' | 'RIGHT' | 'BOTTOMLEFT' | 'BOTTOM' | 'BOTTOMRIGHT'
1921
+ type ScaleCenter =
1922
+ | 'TOPLEFT'
1923
+ | 'TOP'
1924
+ | 'TOPRIGHT'
1925
+ | 'LEFT'
1926
+ | 'CENTER'
1927
+ | 'RIGHT'
1928
+ | 'BOTTOMLEFT'
1929
+ | 'BOTTOM'
1930
+ | 'BOTTOMRIGHT'
1795
1931
 
1796
1932
  interface ScaleOption {
1797
1933
  scaleCenter?: ScaleCenter
@@ -1831,7 +1967,16 @@ declare global {
1831
1967
  effectStyleId: string
1832
1968
  }
1833
1969
 
1834
- type StrokeCap = 'NONE' | 'ROUND' | 'SQUARE' | 'LINE_ARROW' | 'TRIANGLE_ARROW' | 'ROUND_ARROW' | 'RING' | 'DIAMOND' | 'LINE'
1970
+ type StrokeCap =
1971
+ | 'NONE'
1972
+ | 'ROUND'
1973
+ | 'SQUARE'
1974
+ | 'LINE_ARROW'
1975
+ | 'TRIANGLE_ARROW'
1976
+ | 'ROUND_ARROW'
1977
+ | 'RING'
1978
+ | 'DIAMOND'
1979
+ | 'LINE'
1835
1980
  type StrokeJoin = 'MITER' | 'BEVEL' | 'ROUND'
1836
1981
  type StrokeAlign = 'CENTER' | 'INSIDE' | 'OUTSIDE'
1837
1982
  type DashCap = 'NONE' | 'ROUND' | 'SQUARE'
@@ -1848,7 +1993,6 @@ declare global {
1848
1993
  readonly magnet: 'TOP' | 'LEFT' | 'BOTTOM' | 'RIGHT'
1849
1994
  }
1850
1995
 
1851
-
1852
1996
  type ConnectorEndpoint =
1853
1997
  | ConnectorEndpointPosition
1854
1998
  | ConnectorEndpointConnected
@@ -1900,24 +2044,24 @@ declare global {
1900
2044
 
1901
2045
  interface DefaultShapeMixin
1902
2046
  extends BaseNodeMixin,
1903
- SceneNodeMixin,
1904
- BlendMixin,
1905
- GeometryMixin,
1906
- LayoutMixin,
1907
- ReactionMixin,
1908
- ExportMixin { }
2047
+ SceneNodeMixin,
2048
+ BlendMixin,
2049
+ GeometryMixin,
2050
+ LayoutMixin,
2051
+ ReactionMixin,
2052
+ ExportMixin {}
1909
2053
 
1910
2054
  interface DefaultContainerMixin
1911
2055
  extends BaseNodeMixin,
1912
- ContainerMixin,
1913
- ReactionMixin,
1914
- SceneNodeMixin,
1915
- ChildrenMixin,
1916
- BlendMixin,
1917
- CornerMixin,
1918
- ConstraintMixin,
1919
- LayoutMixin,
1920
- ExportMixin { }
2056
+ ContainerMixin,
2057
+ ReactionMixin,
2058
+ SceneNodeMixin,
2059
+ ChildrenMixin,
2060
+ BlendMixin,
2061
+ CornerMixin,
2062
+ ConstraintMixin,
2063
+ LayoutMixin,
2064
+ ExportMixin {}
1921
2065
  interface ContainerMixin {
1922
2066
  expanded: boolean
1923
2067
  }
@@ -1940,9 +2084,9 @@ declare global {
1940
2084
  }
1941
2085
 
1942
2086
  interface RowsColsLayoutGrid {
1943
- readonly gridType: "ROWS" | "COLUMNS"
2087
+ readonly gridType: 'ROWS' | 'COLUMNS'
1944
2088
 
1945
- readonly alignment: "LEFT" | "RIGHT" | "STRETCH" | "CENTER"
2089
+ readonly alignment: 'LEFT' | 'RIGHT' | 'STRETCH' | 'CENTER'
1946
2090
  readonly gutterSize: number
1947
2091
  readonly count: number
1948
2092
  readonly sectionSize?: number | null
@@ -1955,7 +2099,7 @@ declare global {
1955
2099
  }
1956
2100
 
1957
2101
  interface GridLayoutGrid {
1958
- readonly gridType: "GRID"
2102
+ readonly gridType: 'GRID'
1959
2103
 
1960
2104
  readonly sectionSize: number
1961
2105
 
@@ -1965,7 +2109,6 @@ declare global {
1965
2109
  readonly name?: string
1966
2110
  }
1967
2111
 
1968
-
1969
2112
  type LayoutGrid = RowsColsLayoutGrid | GridLayoutGrid
1970
2113
 
1971
2114
  interface FrameContainerMixin extends AutoLayout {
@@ -1975,7 +2118,7 @@ declare global {
1975
2118
  overflowDirection: OverflowDirection
1976
2119
  }
1977
2120
 
1978
- type OverflowDirection = "NONE" | "HORIZONTAL" | "VERTICAL" | "BOTH"
2121
+ type OverflowDirection = 'NONE' | 'HORIZONTAL' | 'VERTICAL' | 'BOTH'
1979
2122
 
1980
2123
  interface ReactionMixin {
1981
2124
  reactions: ReadonlyArray<Reaction>
@@ -2030,12 +2173,12 @@ declare global {
2030
2173
 
2031
2174
  findAll(callback?: (node: SceneNode) => boolean): ReadonlyArray<SceneNode>
2032
2175
  findOne(callback: (node: SceneNode) => boolean): SceneNode | null
2033
- findAllWithCriteria<T extends NodeType[]>(criteria: { types: T }): Array<{ type: T[number] } & SceneNode>
2176
+ findAllWithCriteria<T extends NodeType[]>(criteria: {
2177
+ types: T
2178
+ }): Array<{ type: T[number] } & SceneNode>
2034
2179
  }
2035
2180
 
2036
- interface PageNode
2037
- extends
2038
- ChildrenMixin<SceneNode> {
2181
+ interface PageNode extends ChildrenMixin<SceneNode> {
2039
2182
  readonly type: 'PAGE'
2040
2183
 
2041
2184
  readonly id: string
@@ -2064,12 +2207,29 @@ declare global {
2064
2207
  label: 'NONE' | 'BLUE' | 'GREEN' | 'RED' | 'YELLOW' | 'PURPLE' | 'GRAY'
2065
2208
  }
2066
2209
 
2067
- interface SectionNode extends Omit<DefaultContainerMixin, 'opacity' | 'blendMode' | 'isMask' | 'isMaskOutline' | 'isMaskVisible' | 'effects' | 'effectStyleId'>, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
2210
+ interface SectionNode
2211
+ extends Omit<
2212
+ DefaultContainerMixin,
2213
+ | 'opacity'
2214
+ | 'blendMode'
2215
+ | 'isMask'
2216
+ | 'isMaskOutline'
2217
+ | 'isMaskVisible'
2218
+ | 'effects'
2219
+ | 'effectStyleId'
2220
+ >,
2221
+ GeometryMixin,
2222
+ FrameContainerMixin,
2223
+ RectangleStrokeWeightMixin {
2068
2224
  readonly type: 'SECTION'
2069
2225
  clone(): SectionNode
2070
2226
  }
2071
2227
 
2072
- interface FrameNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
2228
+ interface FrameNode
2229
+ extends DefaultContainerMixin,
2230
+ GeometryMixin,
2231
+ FrameContainerMixin,
2232
+ RectangleStrokeWeightMixin {
2073
2233
  readonly type: 'FRAME'
2074
2234
  clone(): FrameNode
2075
2235
  resizeToFit(): void
@@ -2077,9 +2237,9 @@ declare global {
2077
2237
 
2078
2238
  interface RectangleNode
2079
2239
  extends DefaultShapeMixin,
2080
- ConstraintMixin,
2081
- CornerMixin,
2082
- RectangleStrokeWeightMixin {
2240
+ ConstraintMixin,
2241
+ CornerMixin,
2242
+ RectangleStrokeWeightMixin {
2083
2243
  readonly type: 'RECTANGLE'
2084
2244
  clone(): RectangleNode
2085
2245
  }
@@ -2098,7 +2258,10 @@ declare global {
2098
2258
  arcData: ArcData
2099
2259
  }
2100
2260
 
2101
- interface PolygonNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin {
2261
+ interface PolygonNode
2262
+ extends DefaultShapeMixin,
2263
+ ConstraintMixin,
2264
+ CornerMixin {
2102
2265
  readonly type: 'POLYGON'
2103
2266
  pointCount: number
2104
2267
  clone(): PolygonNode
@@ -2137,20 +2300,19 @@ declare global {
2137
2300
 
2138
2301
  interface BooleanOperationNode
2139
2302
  extends DefaultShapeMixin,
2140
- ContainerMixin,
2141
- ChildrenMixin,
2142
- CornerMixin {
2303
+ ContainerMixin,
2304
+ ChildrenMixin,
2305
+ CornerMixin {
2143
2306
  readonly type: 'BOOLEAN_OPERATION'
2144
2307
  booleanOperation: 'UNION' | 'INTERSECT' | 'SUBTRACT' | 'EXCLUDE'
2145
2308
  clone(): BooleanOperationNode
2146
2309
  }
2147
2310
 
2148
-
2149
2311
  interface GroupNode
2150
2312
  extends DefaultShapeMixin,
2151
- ContainerMixin,
2152
- ChildrenMixin,
2153
- CornerMixin {
2313
+ ContainerMixin,
2314
+ ChildrenMixin,
2315
+ CornerMixin {
2154
2316
  readonly type: 'GROUP'
2155
2317
  clone(): GroupNode
2156
2318
  }
@@ -2169,7 +2331,7 @@ declare global {
2169
2331
  PROTOTYPE = 'prototype',
2170
2332
  OUTFILE = 'outFile',
2171
2333
  OWNWEBSITE = 'ownWebsite',
2172
- OTHERLINK = 'otherLink',
2334
+ OTHERLINK = 'otherLink'
2173
2335
  }
2174
2336
 
2175
2337
  interface Superlink {
@@ -2184,7 +2346,7 @@ declare global {
2184
2346
  }
2185
2347
 
2186
2348
  interface Hyperlink {
2187
- type: 'PAGE' | 'NODE' | 'URL',
2349
+ type: 'PAGE' | 'NODE' | 'URL'
2188
2350
  value: string
2189
2351
  }
2190
2352
  interface HyperlinkWithRange {
@@ -2233,9 +2395,17 @@ declare global {
2233
2395
  * This function is deprecated, please use setRangeHyperlink instead.
2234
2396
  */
2235
2397
  setRangeSuperLink(start: number, end: number, link: string | null): void
2236
- setRangeHyperlink(start: number, end: number, hyperlink: Hyperlink | null): void
2398
+ setRangeHyperlink(
2399
+ start: number,
2400
+ end: number,
2401
+ hyperlink: Hyperlink | null
2402
+ ): void
2237
2403
  setRangeTextCase(start: number, end: number, textCase: TextCase): void
2238
- setRangeListStyle(start: number, end: number, type: 'ORDERED' | 'BULLETED' | 'NONE'): void
2404
+ setRangeListStyle(
2405
+ start: number,
2406
+ end: number,
2407
+ type: 'ORDERED' | 'BULLETED' | 'NONE'
2408
+ ): void
2239
2409
 
2240
2410
  setRangeFillStyleId(start: number, end: number, fillStyleId: string): void
2241
2411
  setRangeTextStyleId(start: number, end: number, textStyleId: string): void
@@ -2260,7 +2430,7 @@ declare global {
2260
2430
  propertyName: string,
2261
2431
  type: Exclude<ComponentPropertyType, 'VARIANT'>,
2262
2432
  defaultValue: string | boolean,
2263
- options?: ComponentPropertyOptions,
2433
+ options?: ComponentPropertyOptions
2264
2434
  ): string
2265
2435
  editComponentProperty(
2266
2436
  propertyId: string,
@@ -2269,7 +2439,7 @@ declare global {
2269
2439
  defaultValue?: string | boolean
2270
2440
  preferredValues?: InstanceSwapPreferredValue[]
2271
2441
  alias?: string
2272
- },
2442
+ }
2273
2443
  ): string
2274
2444
  deleteComponentProperty(propertyId: string): void
2275
2445
  }
@@ -2305,7 +2475,13 @@ declare global {
2305
2475
  valueAlias?: string
2306
2476
  }
2307
2477
 
2308
- interface ComponentNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin, ComponentPropertiesMixin {
2478
+ interface ComponentNode
2479
+ extends DefaultContainerMixin,
2480
+ GeometryMixin,
2481
+ FrameContainerMixin,
2482
+ RectangleStrokeWeightMixin,
2483
+ PublishableMixin,
2484
+ ComponentPropertiesMixin {
2309
2485
  readonly type: 'COMPONENT'
2310
2486
  readonly variantProperties: Array<VariantProperty> | undefined
2311
2487
  setVariantPropertyValues(property: Record<string, string>): void
@@ -2314,20 +2490,34 @@ declare global {
2314
2490
  resizeToFit(): void
2315
2491
  }
2316
2492
 
2317
- interface ComponentSetNode extends Omit<DefaultContainerMixin, 'appendChild' | 'insertChild'>, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin, ComponentPropertiesMixin {
2493
+ interface ComponentSetNode
2494
+ extends Omit<DefaultContainerMixin, 'appendChild' | 'insertChild'>,
2495
+ GeometryMixin,
2496
+ FrameContainerMixin,
2497
+ RectangleStrokeWeightMixin,
2498
+ PublishableMixin,
2499
+ ComponentPropertiesMixin {
2318
2500
  readonly type: 'COMPONENT_SET'
2319
2501
  clone(): ComponentSetNode
2320
2502
  createVariantComponent(): void
2321
2503
  createVariantProperties(properties: Array<string>): void
2322
2504
  editVariantProperties(properties: Record<string, string>): void
2323
- editVariantPropertyValues(properties: Record<string, { oldValue: string, newValue: string }>): void
2505
+ editVariantPropertyValues(
2506
+ properties: Record<string, { oldValue: string; newValue: string }>
2507
+ ): void
2324
2508
  editVariantPropertiesAlias(properties: Record<string, string>): void
2325
- editVariantPropertyValuesAlias(properties: Record<string, { name: string, alias: string }>): void
2509
+ editVariantPropertyValuesAlias(
2510
+ properties: Record<string, { name: string; alias: string }>
2511
+ ): void
2326
2512
  deleteVariantProperty(property: string): void
2327
2513
  resizeToFit(): void
2328
2514
  }
2329
2515
 
2330
- interface InstanceNode extends Omit<DefaultContainerMixin, 'appendChild' | 'insertChild'>, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
2516
+ interface InstanceNode
2517
+ extends Omit<DefaultContainerMixin, 'appendChild' | 'insertChild'>,
2518
+ GeometryMixin,
2519
+ FrameContainerMixin,
2520
+ RectangleStrokeWeightMixin {
2331
2521
  readonly type: 'INSTANCE'
2332
2522
  readonly variantProperties: Array<VariantProperty> | undefined
2333
2523
 
@@ -2349,13 +2539,21 @@ declare global {
2349
2539
  mainComponent: ComponentNode | null
2350
2540
  }
2351
2541
 
2352
- interface SliceNode extends BaseNodeMixin, LayoutMixin, ConstraintMixin, SceneNodeMixin, ExportMixin {
2542
+ interface SliceNode
2543
+ extends BaseNodeMixin,
2544
+ LayoutMixin,
2545
+ ConstraintMixin,
2546
+ SceneNodeMixin,
2547
+ ExportMixin {
2353
2548
  readonly type: 'SLICE'
2354
2549
  clone(): SliceNode
2355
2550
  isPreserveRatio: boolean
2356
2551
  }
2357
2552
 
2358
- interface ConnectorNode extends OpaqueNodeMixin, Pick<MinimalBlendMixin, 'opacity'>, Omit<MinimalStrokesMixin, 'strokeAlign'> {
2553
+ interface ConnectorNode
2554
+ extends OpaqueNodeMixin,
2555
+ Pick<MinimalBlendMixin, 'opacity'>,
2556
+ Omit<MinimalStrokesMixin, 'strokeAlign'> {
2359
2557
  readonly type: 'CONNECTOR'
2360
2558
  createText(): TextSublayerNode
2361
2559
  readonly text: TextSublayerNode | null
@@ -2398,23 +2596,30 @@ declare global {
2398
2596
  ): void
2399
2597
  setRangeLineHeight(start: number, end: number, value: LineHeight): void
2400
2598
  setRangeFills(start: number, end: number, paints: Paint[]): void
2401
- setRangeHyperlink(start: number, end: number, hyperlink: Hyperlink | null): void
2599
+ setRangeHyperlink(
2600
+ start: number,
2601
+ end: number,
2602
+ hyperlink: Hyperlink | null
2603
+ ): void
2402
2604
  setRangeTextCase(start: number, end: number, textCase: TextCase): void
2403
2605
 
2404
- setRangeListStyle(start: number, end: number, type: 'ORDERED' | 'BULLETED' | 'NONE'): void
2606
+ setRangeListStyle(
2607
+ start: number,
2608
+ end: number,
2609
+ type: 'ORDERED' | 'BULLETED' | 'NONE'
2610
+ ): void
2405
2611
 
2406
2612
  setRangeFillStyleId(start: number, end: number, fillStyleId: string): void
2407
2613
  setRangeTextStyleId(start: number, end: number, textStyleId: string): void
2408
2614
  }
2409
2615
 
2410
-
2411
2616
  interface CreateStyleConfig {
2412
- name: string;
2617
+ name: string
2413
2618
  /**
2414
2619
  * layerId
2415
2620
  */
2416
- id: string;
2417
- description?: string;
2621
+ id: string
2622
+ description?: string
2418
2623
  }
2419
2624
 
2420
2625
  interface FlowStartingPoint {
@@ -2424,49 +2629,76 @@ declare global {
2424
2629
  description: string
2425
2630
  }
2426
2631
  interface Reaction {
2427
- readonly trigger: Trigger;
2428
- readonly action?: Action;
2632
+ readonly trigger: Trigger
2633
+ readonly action?: Action
2429
2634
  }
2430
2635
  interface Action {
2431
- readonly type: ActionType;
2432
- readonly destinationId: string;
2433
- readonly navigation: Navigation;
2434
- readonly transition: Transition;
2435
- readonly url: string;
2436
- readonly scrollToXOffset?: number;
2437
- readonly scrollToYOffset?: number;
2636
+ readonly type: ActionType
2637
+ readonly destinationId: string
2638
+ readonly navigation: Navigation
2639
+ readonly transition: Transition
2640
+ readonly url: string
2641
+ readonly scrollToXOffset?: number
2642
+ readonly scrollToYOffset?: number
2438
2643
  }
2439
2644
 
2440
- type ActionType = 'BACK' | 'NODE' | 'URL' | 'CLOSE' | 'NONE';
2645
+ type ActionType = 'BACK' | 'NODE' | 'URL' | 'CLOSE' | 'NONE'
2441
2646
 
2442
- type Navigation = 'NAVIGATE' | 'OVERLAY' | 'SWAP_OVERLAY' | 'SCROLL_TO';
2647
+ type Navigation = 'NAVIGATE' | 'OVERLAY' | 'SWAP_OVERLAY' | 'SCROLL_TO'
2443
2648
 
2444
2649
  interface Transition {
2445
- readonly type: TransitionType;
2446
- readonly duration: number;
2447
- readonly direction: TransitionDirection;
2448
- readonly easing: Easing;
2449
- }
2450
-
2451
- type TransitionType = 'TANS_NONE' | 'INSTANT' | 'DISSOLVE' | 'SMART_ANIMATE' | 'MOVE_IN' | 'MOVE_OUT' | 'PUSH' | 'SLIDE_IN' | 'SLIDE_OUT' | 'DISPLACE'
2650
+ readonly type: TransitionType
2651
+ readonly duration: number
2652
+ readonly direction: TransitionDirection
2653
+ readonly easing: Easing
2654
+ }
2655
+
2656
+ type TransitionType =
2657
+ | 'TANS_NONE'
2658
+ | 'INSTANT'
2659
+ | 'DISSOLVE'
2660
+ | 'SMART_ANIMATE'
2661
+ | 'MOVE_IN'
2662
+ | 'MOVE_OUT'
2663
+ | 'PUSH'
2664
+ | 'SLIDE_IN'
2665
+ | 'SLIDE_OUT'
2666
+ | 'DISPLACE'
2452
2667
 
2453
2668
  type TransitionDirection = 'LEFT' | 'RIGHT' | 'TOP' | 'BOTTOM'
2454
2669
  interface Easing {
2455
- readonly type: EasingType;
2670
+ readonly type: EasingType
2456
2671
  readonly easingFunctionCubicBezier: {
2457
- x1: number;
2458
- x2: number;
2459
- y1: number;
2460
- y2: number;
2461
- };
2672
+ x1: number
2673
+ x2: number
2674
+ y1: number
2675
+ y2: number
2676
+ }
2462
2677
  }
2463
2678
 
2464
- type EasingType = 'LINEAR' | 'EASE_IN' | 'EASE_OUT' | 'EASE_IN_AND_OUT' | 'EASE_IN_BACK' | 'EASE_OUT_BACK' | 'EASE_IN_AND_OUT_BACK' | 'CUSTOM_CUBIC_BEZIER'
2679
+ type EasingType =
2680
+ | 'LINEAR'
2681
+ | 'EASE_IN'
2682
+ | 'EASE_OUT'
2683
+ | 'EASE_IN_AND_OUT'
2684
+ | 'EASE_IN_BACK'
2685
+ | 'EASE_OUT_BACK'
2686
+ | 'EASE_IN_AND_OUT_BACK'
2687
+ | 'CUSTOM_CUBIC_BEZIER'
2465
2688
  interface Trigger {
2466
- readonly type: TriggerType;
2467
- readonly delay: number;
2468
- }
2469
- type TriggerType = 'ON_CLICK' | 'ON_DRAG' | 'ON_HOVER' | 'ON_PRESS' | 'MOUSE_ENTER' | 'MOUSE_LEAVE' | 'MOUSE_DOWN' | 'MOUSE_UP' | 'AFTER_DELAY'
2689
+ readonly type: TriggerType
2690
+ readonly delay: number
2691
+ }
2692
+ type TriggerType =
2693
+ | 'ON_CLICK'
2694
+ | 'ON_DRAG'
2695
+ | 'ON_HOVER'
2696
+ | 'ON_PRESS'
2697
+ | 'MOUSE_ENTER'
2698
+ | 'MOUSE_LEAVE'
2699
+ | 'MOUSE_DOWN'
2700
+ | 'MOUSE_UP'
2701
+ | 'AFTER_DELAY'
2470
2702
 
2471
2703
  interface ArcData {
2472
2704
  /**
@@ -2502,7 +2734,7 @@ declare global {
2502
2734
  readonly name: string
2503
2735
  readonly ukey: string
2504
2736
  readonly description: string
2505
- readonly type: "COMPONENT" | 'COMPONENT_SET'
2737
+ readonly type: 'COMPONENT' | 'COMPONENT_SET'
2506
2738
  readonly cover: string
2507
2739
  readonly width: number
2508
2740
  readonly height: number
@@ -2511,16 +2743,16 @@ declare global {
2511
2743
  }
2512
2744
 
2513
2745
  interface TeamLibraryStyle {
2514
- readonly id: string;
2515
- readonly name: string;
2516
- readonly ukey: string;
2517
- readonly description: string;
2518
- readonly type: StyleType;
2746
+ readonly id: string
2747
+ readonly name: string
2748
+ readonly ukey: string
2749
+ readonly description: string
2750
+ readonly type: StyleType
2519
2751
  }
2520
2752
 
2521
2753
  type TeamLibrary = ReadonlyArray<{
2522
- readonly name: string;
2523
- readonly id: string;
2754
+ readonly name: string
2755
+ readonly id: string
2524
2756
  readonly componentList: TeamLibraryComponent[]
2525
2757
  readonly style: {
2526
2758
  paints: ReadonlyArray<TeamLibraryStyle>
@@ -2577,44 +2809,68 @@ declare global {
2577
2809
  | 'CONNECTOR'
2578
2810
  | 'SECTION'
2579
2811
 
2580
-
2581
2812
  // d2c
2582
2813
  type CodeFile = {
2583
2814
  /**
2584
2815
  * import third-party paths
2585
2816
  */
2586
2817
  importPath?: {
2587
- name: string;
2588
- path: string;
2589
- type: 'script' | 'style';
2590
- }[];
2591
- importType?: 'GLOBAL' | 'IMPORT';
2818
+ name: string
2819
+ path: string
2820
+ type: 'script' | 'style'
2821
+ }[]
2822
+ importType?: 'GLOBAL' | 'IMPORT'
2592
2823
  // absolute path
2593
- path: string;
2824
+ path: string
2594
2825
  // relative to the relative path of the imported file
2595
- relativePath: string;
2596
- fileName: string;
2597
- type: 'css' | 'js' | 'typescript' | 'ts-definition' | 'static' | 'vue' | 'react' | 'java' | 'kt' | 'xml';
2826
+ relativePath: string
2827
+ fileName: string
2828
+ type:
2829
+ | 'css'
2830
+ | 'js'
2831
+ | 'typescript'
2832
+ | 'ts-definition'
2833
+ | 'static'
2834
+ | 'vue'
2835
+ | 'react'
2836
+ | 'java'
2837
+ | 'kt'
2838
+ | 'xml'
2598
2839
  // code
2599
- code: string;
2840
+ code: string
2600
2841
  // parsed code
2601
- parsedCode?: string;
2842
+ parsedCode?: string
2602
2843
  // import
2603
- chunks?: CodeFile[];
2604
- };
2844
+ chunks?: CodeFile[]
2845
+ }
2605
2846
  interface CodegenAPI {
2606
2847
  /**
2607
2848
  * @param event a callback function that is triggered when the plugin generates the DSL, and the parameter of the callback function is the modified DSL data
2608
2849
  */
2609
- on(type: 'generateDSL', event: (generateData: { data: MGDSL.MGDSLData, callback: (modifiedData: MGDSL.MGDSLData) => void }) => void): void
2850
+ on(
2851
+ type: 'generateDSL',
2852
+ event: (generateData: {
2853
+ data: MGDSL.MGDSLData
2854
+ callback: (modifiedData: MGDSL.MGDSLData) => void
2855
+ }) => void
2856
+ ): void
2610
2857
  /**
2611
2858
  * @param event a callback function that is triggered when the plugin generates the DSL, and the parameter of the callback function is the custom code, and when the callback returns the custom code, the custom code will be used as the standard, and the code will not be generated according to the DSL
2612
2859
  */
2613
- on(type: 'generate', event: (generateData: { data: MGDSL.MGDSLData, callback: (modifiedData: MGDSL.CustomCode) => void }) => void): void
2860
+ on(
2861
+ type: 'generate',
2862
+ event: (generateData: {
2863
+ data: MGDSL.MGDSLData
2864
+ callback: (modifiedData: MGDSL.CustomCode) => void
2865
+ }) => void
2866
+ ): void
2614
2867
  /**
2615
2868
  * @param event a callback function that is triggered when the plugin generates the code, and the parameter of the callback function is the generated code
2616
2869
  */
2617
- on(type: 'codeChange', event: (data: MGDSL.CustomCode['data']) => void): void
2870
+ on(
2871
+ type: 'codeChange',
2872
+ event: (data: MGDSL.CustomCode['data']) => void
2873
+ ): void
2618
2874
  /**
2619
2875
  * Set the component template
2620
2876
  * @description used to set the component mapping relationship
@@ -2627,59 +2883,91 @@ declare global {
2627
2883
  * @param type framework type
2628
2884
  * @returns code file
2629
2885
  */
2630
- getCode(layerId: string, type: MGDSL.Framework): Promise<CodeFile | null>;
2886
+ getCode(layerId: string, type: MGDSL.Framework): Promise<CodeFile | null>
2631
2887
  /**
2632
2888
  * Get DSL by id and framework
2633
2889
  * @param layerId layer id
2634
2890
  * @param type framework type
2635
2891
  * @returns DSL data
2636
2892
  */
2637
- getDSL(layerId: string, type: MGDSL.Framework): Promise<MGDSL.MGDSLData | null>;
2893
+ getDSL(
2894
+ layerId: string,
2895
+ type: MGDSL.Framework
2896
+ ): Promise<MGDSL.MGDSLData | null>
2638
2897
  /**
2639
2898
  * Get code by DSL
2640
2899
  * @param data DSL data
2641
2900
  * @param type framework type
2642
2901
  * @returns code file
2643
2902
  */
2644
- getCodeByDSL(data: MGDSL.MGDSLData, type: MGDSL.Framework): Promise<CodeFile | null>;
2903
+ getCodeByDSL(
2904
+ data: MGDSL.MGDSLData,
2905
+ type: MGDSL.Framework
2906
+ ): Promise<CodeFile | null>
2645
2907
  }
2646
2908
 
2647
2909
  interface SnippetgenData {
2648
- language: string;
2649
- layerId: string;
2650
- preferences: Record<string, string>;
2651
- unit: Record<string, string>;
2910
+ language: string
2911
+ layerId: string
2912
+ preferences: Record<string, string>
2913
+ unit: Record<string, string>
2652
2914
  }
2653
2915
 
2654
2916
  interface SnippetGenResult {
2655
- language: string;
2656
- code: string;
2657
- title: string;
2917
+ language: string
2918
+ code: string
2919
+ title: string
2658
2920
  }
2659
2921
 
2660
2922
  interface SnippetgenAPI {
2661
- on(type: 'generate', event: (data: SnippetgenData, callback: (modifiedData: SnippetGenResult[]) => void) => void): void
2662
- off(type: 'generate', event: (data: SnippetgenData, callback: (modifiedData: SnippetGenResult[]) => void) => void): void
2923
+ on(
2924
+ type: 'generate',
2925
+ event: (
2926
+ data: SnippetgenData,
2927
+ callback: (modifiedData: SnippetGenResult[]) => void
2928
+ ) => void
2929
+ ): void
2930
+ off(
2931
+ type: 'generate',
2932
+ event: (
2933
+ data: SnippetgenData,
2934
+ callback: (modifiedData: SnippetGenResult[]) => void
2935
+ ) => void
2936
+ ): void
2663
2937
 
2664
2938
  on(type: 'action', event: (value: string) => void): void
2665
2939
  off(type: 'action', event: (value: string) => void): void
2666
2940
  }
2667
2941
 
2668
- type StyleReturnType<T extends StyleType> =
2669
- T extends 'PAINT' ? PaintStyle :
2670
- T extends 'TEXT' ? TextStyle :
2671
- T extends 'EFFECT' ? EffectStyle :
2672
- T extends 'GRID' ? GridStyle :
2673
- T extends 'STROKE_WIDTH' ? StrokeWidthStyle :
2674
- T extends 'CORNER_RADIUS' ? CornerRadiusStyle :
2675
- T extends 'PADDING' ? PaddingStyle :
2676
- T extends 'SPACING' ? SpacingStyle : never
2677
-
2678
- type NodeStyleReturnType<T extends NodeStyleType> =
2679
- T extends 'fill' ? PaintStyle :
2680
- T extends 'strokeFill' ? PaintStyle :
2681
- T extends 'strokeWidth' ? StrokeWidthStyle :
2682
- T extends 'cornerRadius' ? CornerRadiusStyle :
2683
- T extends 'padding' ? PaddingStyle :
2684
- T extends 'spacing' ? SpacingStyle : never
2942
+ type StyleReturnType<T extends StyleType> = T extends 'PAINT'
2943
+ ? PaintStyle
2944
+ : T extends 'TEXT'
2945
+ ? TextStyle
2946
+ : T extends 'EFFECT'
2947
+ ? EffectStyle
2948
+ : T extends 'GRID'
2949
+ ? GridStyle
2950
+ : T extends 'STROKE_WIDTH'
2951
+ ? StrokeWidthStyle
2952
+ : T extends 'CORNER_RADIUS'
2953
+ ? CornerRadiusStyle
2954
+ : T extends 'PADDING'
2955
+ ? PaddingStyle
2956
+ : T extends 'SPACING'
2957
+ ? SpacingStyle
2958
+ : never
2959
+
2960
+ type NodeStyleReturnType<T extends NodeStyleType> = T extends 'fill'
2961
+ ? PaintStyle
2962
+ : T extends 'strokeFill'
2963
+ ? PaintStyle
2964
+ : T extends 'strokeWidth'
2965
+ ? StrokeWidthStyle
2966
+ : T extends 'cornerRadius'
2967
+ ? CornerRadiusStyle
2968
+ : T extends 'padding'
2969
+ ? PaddingStyle
2970
+ : T extends 'spacing'
2971
+ ? SpacingStyle
2972
+ : never
2685
2973
  }
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@mastergo/plugin-typings",
3
- "version": "2.10.0",
3
+ "version": "2.14.0-beta.0",
4
4
  "description": "MasterGo插件API声明文件",
5
+ "type": "module",
5
6
  "main": "",
6
7
  "types": "dist/index.d.ts",
7
8
  "scripts": {
8
9
  "prepare": "husky install",
9
10
  "dev": "rollup -c --environment NODE_ENV=development",
10
11
  "build": "rollup -c --environment NODE_ENV=production",
11
- "release": "node scripts/release.js",
12
+ "release": "node scripts/release.cjs",
12
13
  "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
13
14
  "commit": "git-cz"
14
15
  },
@@ -26,35 +27,34 @@
26
27
  "license": "MIT",
27
28
  "repository": {
28
29
  "type": "git",
29
- "url": "https://github.com/mastergo-design/plugin-typings"
30
+ "url": "git+https://github.com/mastergo-design/plugin-typings.git"
30
31
  },
31
32
  "directories": {
32
33
  "lib": "lib"
33
34
  },
34
35
  "devDependencies": {
35
- "@rollup/plugin-commonjs": "^20.0.0",
36
- "@rollup/plugin-json": "^4.1.0",
37
- "@rollup/plugin-node-resolve": "^13.0.4",
36
+ "@commitlint/cli": "^17.0.0",
37
+ "@commitlint/config-conventional": "^17.0.0",
38
+ "@rollup/plugin-commonjs": "^29.0.2",
39
+ "@rollup/plugin-json": "^6.1.0",
40
+ "@rollup/plugin-node-resolve": "^15.2.0",
38
41
  "chalk": "^4.1.2",
39
- "conventional-changelog-cli": "^2.1.1",
42
+ "commitizen": "^4.2.4",
43
+ "conventional-changelog-cli": "^3.0.0",
44
+ "csstype": "^3.1.3",
45
+ "cz-conventional-changelog": "^3.3.0",
40
46
  "execa": "^5.1.1",
41
47
  "husky": "^7.0.2",
42
48
  "inquirer": "^8.0.0",
43
49
  "inquirer-autocomplete-prompt": "^2.0.0",
44
50
  "lint-staged": "^11.1.2",
45
51
  "prettier": "^2.4.1",
46
- "rollup": "^2.56.3",
47
- "rollup-plugin-dts": "^4.0.0",
48
- "rollup-plugin-polyfill-node": "^0.7.0",
49
- "rollup-plugin-typescript2": "^0.30.0",
52
+ "rollup": "^4.59.0",
53
+ "rollup-plugin-dts": "^6.4.0",
54
+ "rollup-plugin-typescript2": "^0.36.0",
50
55
  "semver": "^7.3.5",
51
56
  "shelljs": "^0.8.5",
52
- "typescript": "^4.4.3",
53
- "@commitlint/cli": "^17.0.0",
54
- "@commitlint/config-conventional": "^17.0.0",
55
- "commitizen": "^4.2.4",
56
- "cz-conventional-changelog": "^3.3.0",
57
- "csstype": "^3.1.3"
57
+ "typescript": "^5.9.3"
58
58
  },
59
59
  "lint-staged": {
60
60
  "*.js": [