@mastergo/plugin-typings 2.10.0-beta.0 → 2.13.2-beta.10
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/dist/index.d.ts +497 -214
- 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
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
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?:
|
|
1128
|
+
readonly mode?: 'inspect' | 'design' | 'codegen' | 'snippetgen'
|
|
1126
1129
|
|
|
1127
1130
|
closePlugin(): void
|
|
1128
1131
|
|
|
1129
|
-
on<T extends PluginEventType>(
|
|
1130
|
-
|
|
1131
|
-
|
|
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
|
|
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(
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
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>(
|
|
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>(
|
|
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 =
|
|
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,41 @@ 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图片
|
|
1276
|
+
* @param layerIds 图层id数组
|
|
1277
|
+
* @param scale 缩放比例
|
|
1278
|
+
*/
|
|
1279
|
+
exportPngByLayerIds(layerIds: string[], scale?: number): string
|
|
1280
|
+
/**
|
|
1281
|
+
* 导出多个图层组成的svg图片
|
|
1282
|
+
* @param layerIds 图层id数组
|
|
1283
|
+
*/
|
|
1284
|
+
exportSvgByLayerIds(layerIds: string[]): string
|
|
1237
1285
|
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
importStyleByKeyAsync(ukey: string): Promise<Style>,
|
|
1286
|
+
getTeamLibraryAsync(): Promise<TeamLibrary>
|
|
1287
|
+
importComponentByKeyAsync(ukey: string): Promise<ComponentNode>
|
|
1288
|
+
importComponentSetByKeyAsync(ukey: string): Promise<ComponentSetNode>
|
|
1289
|
+
importStyleByKeyAsync(ukey: string): Promise<Style>
|
|
1243
1290
|
/**
|
|
1244
1291
|
* @deprecated
|
|
1245
|
-
*
|
|
1292
|
+
*
|
|
1246
1293
|
* This attribute is deprecated, please use getTeamLibraryAsync instead.
|
|
1247
1294
|
*/
|
|
1248
|
-
teamLibrary: TeamLibrary
|
|
1295
|
+
teamLibrary: TeamLibrary
|
|
1249
1296
|
|
|
1250
1297
|
hexToRGBA(hex: string): RGBA
|
|
1251
1298
|
RGBAToHex(rgba: RGBA): string
|
|
1252
1299
|
|
|
1253
|
-
confirm: (
|
|
1254
|
-
|
|
1300
|
+
confirm: (
|
|
1301
|
+
message: string,
|
|
1302
|
+
options: [ConfirmAction, ...ConfirmAction[]]
|
|
1303
|
+
) => void
|
|
1304
|
+
prompt: (
|
|
1305
|
+
message: string,
|
|
1306
|
+
defaultValue: string,
|
|
1307
|
+
options: [PromptAction, ...PromptAction[]]
|
|
1308
|
+
) => void
|
|
1255
1309
|
}
|
|
1256
1310
|
|
|
1257
1311
|
interface User {
|
|
@@ -1260,7 +1314,7 @@ declare global {
|
|
|
1260
1314
|
photoUrl: string | null
|
|
1261
1315
|
}
|
|
1262
1316
|
|
|
1263
|
-
interface Rect extends Readonly<Bound> {
|
|
1317
|
+
interface Rect extends Readonly<Bound> {}
|
|
1264
1318
|
interface NotificationHandler {
|
|
1265
1319
|
cancel: () => void
|
|
1266
1320
|
}
|
|
@@ -1317,7 +1371,7 @@ declare global {
|
|
|
1317
1371
|
readonly isSuffix?: boolean
|
|
1318
1372
|
readonly fileName?: string
|
|
1319
1373
|
readonly constraint?: ExportSettingsConstraints
|
|
1320
|
-
readonly useAbsoluteBounds?: boolean
|
|
1374
|
+
readonly useAbsoluteBounds?: boolean // defaults to true
|
|
1321
1375
|
readonly useRenderBounds?: boolean // default to true
|
|
1322
1376
|
}
|
|
1323
1377
|
interface ExportSettingsSVG {
|
|
@@ -1334,8 +1388,10 @@ declare global {
|
|
|
1334
1388
|
readonly useRenderBounds?: boolean // default to true
|
|
1335
1389
|
}
|
|
1336
1390
|
|
|
1337
|
-
type ExportSettings =
|
|
1338
|
-
|
|
1391
|
+
type ExportSettings =
|
|
1392
|
+
| ExportSettingsImage
|
|
1393
|
+
| ExportSettingsSVG
|
|
1394
|
+
| ExportSettingsPDF
|
|
1339
1395
|
|
|
1340
1396
|
interface ExportMixin {
|
|
1341
1397
|
exportSettings: ReadonlyArray<ExportSettings>
|
|
@@ -1384,10 +1440,10 @@ declare global {
|
|
|
1384
1440
|
}
|
|
1385
1441
|
|
|
1386
1442
|
type CodeData = {
|
|
1387
|
-
layout?: string
|
|
1388
|
-
style?: string
|
|
1389
|
-
typography?: string
|
|
1390
|
-
other?: string
|
|
1443
|
+
layout?: string
|
|
1444
|
+
style?: string
|
|
1445
|
+
typography?: string
|
|
1446
|
+
other?: string
|
|
1391
1447
|
}
|
|
1392
1448
|
interface CodeString {
|
|
1393
1449
|
type: 'CSS' | 'iOS' | 'Android'
|
|
@@ -1430,8 +1486,22 @@ declare global {
|
|
|
1430
1486
|
}
|
|
1431
1487
|
|
|
1432
1488
|
// Styles
|
|
1433
|
-
type StyleType =
|
|
1434
|
-
|
|
1489
|
+
type StyleType =
|
|
1490
|
+
| 'PAINT'
|
|
1491
|
+
| 'TEXT'
|
|
1492
|
+
| 'EFFECT'
|
|
1493
|
+
| 'GRID'
|
|
1494
|
+
| 'STROKE_WIDTH'
|
|
1495
|
+
| 'CORNER_RADIUS'
|
|
1496
|
+
| 'PADDING'
|
|
1497
|
+
| 'SPACING'
|
|
1498
|
+
type NodeStyleType =
|
|
1499
|
+
| 'fill'
|
|
1500
|
+
| 'strokeFill'
|
|
1501
|
+
| 'strokeWidth'
|
|
1502
|
+
| 'cornerRadius'
|
|
1503
|
+
| 'padding'
|
|
1504
|
+
| 'spacing'
|
|
1435
1505
|
|
|
1436
1506
|
interface BaseStyle extends Omit<PublishableMixin, 'documentationLinks'> {
|
|
1437
1507
|
readonly id: string
|
|
@@ -1523,9 +1593,15 @@ declare global {
|
|
|
1523
1593
|
layoutGrids: ReadonlyArray<LayoutGrid>
|
|
1524
1594
|
}
|
|
1525
1595
|
|
|
1526
|
-
type Style =
|
|
1527
|
-
|
|
1528
|
-
|
|
1596
|
+
type Style =
|
|
1597
|
+
| PaintStyle
|
|
1598
|
+
| EffectStyle
|
|
1599
|
+
| TextStyle
|
|
1600
|
+
| GridStyle
|
|
1601
|
+
| StrokeWidthStyle
|
|
1602
|
+
| CornerRadiusStyle
|
|
1603
|
+
| PaddingStyle
|
|
1604
|
+
| SpacingStyle
|
|
1529
1605
|
|
|
1530
1606
|
/// /////////////////////////////////////////////////////////////////////////////
|
|
1531
1607
|
// Datatypes
|
|
@@ -1555,7 +1631,7 @@ declare global {
|
|
|
1555
1631
|
readonly style: string
|
|
1556
1632
|
}
|
|
1557
1633
|
|
|
1558
|
-
type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE'
|
|
1634
|
+
type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE'
|
|
1559
1635
|
|
|
1560
1636
|
type TextDecoration = 'NONE' | 'UNDERLINE' | 'STRIKETHROUGH'
|
|
1561
1637
|
|
|
@@ -1577,9 +1653,46 @@ declare global {
|
|
|
1577
1653
|
readonly radius: number
|
|
1578
1654
|
readonly isVisible: boolean
|
|
1579
1655
|
readonly blendMode: BlendMode
|
|
1656
|
+
readonly gradient: PluginGradientEffect
|
|
1580
1657
|
}
|
|
1581
1658
|
|
|
1582
|
-
|
|
1659
|
+
interface PluginGradientEffect {
|
|
1660
|
+
readonly mode: 'EVEN' | 'PROGRESSIVE'
|
|
1661
|
+
readonly gradientStops?: ReadonlyArray<PluginGradientStopItem>
|
|
1662
|
+
readonly gradientHandlePositions?: [Point, Point]
|
|
1663
|
+
readonly transform?: Transform
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
interface PluginGradientStopItem {
|
|
1667
|
+
readonly position: number
|
|
1668
|
+
readonly value: number
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
interface Point {
|
|
1672
|
+
readonly x: number
|
|
1673
|
+
readonly y: number
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
interface LiquidGlassEffect {
|
|
1677
|
+
readonly type: 'LIQUID_GLASS'
|
|
1678
|
+
readonly depth: number
|
|
1679
|
+
readonly dispersion: number
|
|
1680
|
+
readonly refraction: number
|
|
1681
|
+
readonly lightIntensity: number
|
|
1682
|
+
readonly lightAngle: number
|
|
1683
|
+
readonly isVisible: boolean
|
|
1684
|
+
readonly radius: number
|
|
1685
|
+
readonly blendMode: BlendMode
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
interface MotionBlurEffect {
|
|
1689
|
+
readonly isVisible: boolean
|
|
1690
|
+
readonly radius: number
|
|
1691
|
+
readonly angle: number
|
|
1692
|
+
readonly blendMode: BlendMode
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
type Effect = ShadowEffect | BlurEffect | LiquidGlassEffect | MotionBlurEffect
|
|
1583
1696
|
|
|
1584
1697
|
// 待确认
|
|
1585
1698
|
type ConstraintType = 'START' | 'END' | 'STARTANDEND' | 'CENTER' | 'SCALE'
|
|
@@ -1610,13 +1723,16 @@ declare global {
|
|
|
1610
1723
|
|
|
1611
1724
|
interface GradientPaint {
|
|
1612
1725
|
readonly type:
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1726
|
+
| 'GRADIENT_LINEAR'
|
|
1727
|
+
| 'GRADIENT_RADIAL'
|
|
1728
|
+
| 'GRADIENT_ANGULAR'
|
|
1729
|
+
| 'GRADIENT_DIAMOND'
|
|
1617
1730
|
readonly transform: Transform
|
|
1618
1731
|
readonly gradientStops: ReadonlyArray<ColorStop>
|
|
1619
|
-
readonly gradientHandlePositions?: [
|
|
1732
|
+
readonly gradientHandlePositions?: [
|
|
1733
|
+
{ x: number; y: number },
|
|
1734
|
+
{ x: number; y: number }
|
|
1735
|
+
]
|
|
1620
1736
|
readonly isVisible?: boolean
|
|
1621
1737
|
readonly alpha?: number
|
|
1622
1738
|
readonly blendMode?: BlendMode
|
|
@@ -1650,22 +1766,26 @@ declare global {
|
|
|
1650
1766
|
|
|
1651
1767
|
type Paint = SolidPaint | GradientPaint | ImagePaint
|
|
1652
1768
|
|
|
1653
|
-
type CSSWidthSetter =
|
|
1769
|
+
type CSSWidthSetter =
|
|
1770
|
+
| number
|
|
1771
|
+
| [number, number]
|
|
1772
|
+
| [number, number, number]
|
|
1773
|
+
| [number, number, number, number]
|
|
1654
1774
|
|
|
1655
1775
|
interface StrokeWidth {
|
|
1656
|
-
width: CSSWidthSetter
|
|
1776
|
+
width: CSSWidthSetter
|
|
1657
1777
|
}
|
|
1658
1778
|
|
|
1659
1779
|
interface Padding {
|
|
1660
|
-
padding: CSSWidthSetter
|
|
1780
|
+
padding: CSSWidthSetter
|
|
1661
1781
|
}
|
|
1662
1782
|
|
|
1663
1783
|
interface Spacing {
|
|
1664
|
-
spacing: CSSWidthSetter
|
|
1784
|
+
spacing: CSSWidthSetter
|
|
1665
1785
|
}
|
|
1666
1786
|
|
|
1667
1787
|
interface CornerRadius {
|
|
1668
|
-
cornerRadius: CSSWidthSetter
|
|
1788
|
+
cornerRadius: CSSWidthSetter
|
|
1669
1789
|
}
|
|
1670
1790
|
|
|
1671
1791
|
type WindingRule = 'Nonzero' | 'Evenodd'
|
|
@@ -1696,12 +1816,12 @@ declare global {
|
|
|
1696
1816
|
|
|
1697
1817
|
type LineHeight =
|
|
1698
1818
|
| {
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1819
|
+
readonly value: number
|
|
1820
|
+
readonly unit: 'PIXELS' | 'PERCENT'
|
|
1821
|
+
}
|
|
1702
1822
|
| {
|
|
1703
|
-
|
|
1704
|
-
|
|
1823
|
+
readonly unit: 'AUTO'
|
|
1824
|
+
}
|
|
1705
1825
|
|
|
1706
1826
|
type BlendMode =
|
|
1707
1827
|
| 'NORMAL'
|
|
@@ -1758,8 +1878,8 @@ declare global {
|
|
|
1758
1878
|
isLocked: boolean
|
|
1759
1879
|
readonly attachedConnectors: ConnectorNode[]
|
|
1760
1880
|
componentPropertyReferences: {
|
|
1761
|
-
isVisible?: string
|
|
1762
|
-
characters?: string
|
|
1881
|
+
isVisible?: string
|
|
1882
|
+
characters?: string
|
|
1763
1883
|
mainComponent?: string
|
|
1764
1884
|
} | null
|
|
1765
1885
|
slotInfo: { slotName: string; slotAlias: string } | null
|
|
@@ -1777,7 +1897,9 @@ declare global {
|
|
|
1777
1897
|
|
|
1778
1898
|
findAll(callback?: (node: SceneNode) => boolean): ReadonlyArray<SceneNode>
|
|
1779
1899
|
findOne(callback: (node: SceneNode) => boolean): SceneNode | null
|
|
1780
|
-
findAllWithCriteria<T extends NodeType[]>(criteria: {
|
|
1900
|
+
findAllWithCriteria<T extends NodeType[]>(criteria: {
|
|
1901
|
+
types: T
|
|
1902
|
+
}): Array<{ type: T[number] } & SceneNode>
|
|
1781
1903
|
}
|
|
1782
1904
|
|
|
1783
1905
|
interface ConstraintMixin {
|
|
@@ -1791,7 +1913,16 @@ declare global {
|
|
|
1791
1913
|
height: number
|
|
1792
1914
|
}
|
|
1793
1915
|
|
|
1794
|
-
type ScaleCenter =
|
|
1916
|
+
type ScaleCenter =
|
|
1917
|
+
| 'TOPLEFT'
|
|
1918
|
+
| 'TOP'
|
|
1919
|
+
| 'TOPRIGHT'
|
|
1920
|
+
| 'LEFT'
|
|
1921
|
+
| 'CENTER'
|
|
1922
|
+
| 'RIGHT'
|
|
1923
|
+
| 'BOTTOMLEFT'
|
|
1924
|
+
| 'BOTTOM'
|
|
1925
|
+
| 'BOTTOMRIGHT'
|
|
1795
1926
|
|
|
1796
1927
|
interface ScaleOption {
|
|
1797
1928
|
scaleCenter?: ScaleCenter
|
|
@@ -1831,7 +1962,16 @@ declare global {
|
|
|
1831
1962
|
effectStyleId: string
|
|
1832
1963
|
}
|
|
1833
1964
|
|
|
1834
|
-
type StrokeCap =
|
|
1965
|
+
type StrokeCap =
|
|
1966
|
+
| 'NONE'
|
|
1967
|
+
| 'ROUND'
|
|
1968
|
+
| 'SQUARE'
|
|
1969
|
+
| 'LINE_ARROW'
|
|
1970
|
+
| 'TRIANGLE_ARROW'
|
|
1971
|
+
| 'ROUND_ARROW'
|
|
1972
|
+
| 'RING'
|
|
1973
|
+
| 'DIAMOND'
|
|
1974
|
+
| 'LINE'
|
|
1835
1975
|
type StrokeJoin = 'MITER' | 'BEVEL' | 'ROUND'
|
|
1836
1976
|
type StrokeAlign = 'CENTER' | 'INSIDE' | 'OUTSIDE'
|
|
1837
1977
|
type DashCap = 'NONE' | 'ROUND' | 'SQUARE'
|
|
@@ -1848,7 +1988,6 @@ declare global {
|
|
|
1848
1988
|
readonly magnet: 'TOP' | 'LEFT' | 'BOTTOM' | 'RIGHT'
|
|
1849
1989
|
}
|
|
1850
1990
|
|
|
1851
|
-
|
|
1852
1991
|
type ConnectorEndpoint =
|
|
1853
1992
|
| ConnectorEndpointPosition
|
|
1854
1993
|
| ConnectorEndpointConnected
|
|
@@ -1900,24 +2039,24 @@ declare global {
|
|
|
1900
2039
|
|
|
1901
2040
|
interface DefaultShapeMixin
|
|
1902
2041
|
extends BaseNodeMixin,
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
2042
|
+
SceneNodeMixin,
|
|
2043
|
+
BlendMixin,
|
|
2044
|
+
GeometryMixin,
|
|
2045
|
+
LayoutMixin,
|
|
2046
|
+
ReactionMixin,
|
|
2047
|
+
ExportMixin {}
|
|
1909
2048
|
|
|
1910
2049
|
interface DefaultContainerMixin
|
|
1911
2050
|
extends BaseNodeMixin,
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
2051
|
+
ContainerMixin,
|
|
2052
|
+
ReactionMixin,
|
|
2053
|
+
SceneNodeMixin,
|
|
2054
|
+
ChildrenMixin,
|
|
2055
|
+
BlendMixin,
|
|
2056
|
+
CornerMixin,
|
|
2057
|
+
ConstraintMixin,
|
|
2058
|
+
LayoutMixin,
|
|
2059
|
+
ExportMixin {}
|
|
1921
2060
|
interface ContainerMixin {
|
|
1922
2061
|
expanded: boolean
|
|
1923
2062
|
}
|
|
@@ -1940,9 +2079,9 @@ declare global {
|
|
|
1940
2079
|
}
|
|
1941
2080
|
|
|
1942
2081
|
interface RowsColsLayoutGrid {
|
|
1943
|
-
readonly gridType:
|
|
2082
|
+
readonly gridType: 'ROWS' | 'COLUMNS'
|
|
1944
2083
|
|
|
1945
|
-
readonly alignment:
|
|
2084
|
+
readonly alignment: 'LEFT' | 'RIGHT' | 'STRETCH' | 'CENTER'
|
|
1946
2085
|
readonly gutterSize: number
|
|
1947
2086
|
readonly count: number
|
|
1948
2087
|
readonly sectionSize?: number | null
|
|
@@ -1955,7 +2094,7 @@ declare global {
|
|
|
1955
2094
|
}
|
|
1956
2095
|
|
|
1957
2096
|
interface GridLayoutGrid {
|
|
1958
|
-
readonly gridType:
|
|
2097
|
+
readonly gridType: 'GRID'
|
|
1959
2098
|
|
|
1960
2099
|
readonly sectionSize: number
|
|
1961
2100
|
|
|
@@ -1965,7 +2104,6 @@ declare global {
|
|
|
1965
2104
|
readonly name?: string
|
|
1966
2105
|
}
|
|
1967
2106
|
|
|
1968
|
-
|
|
1969
2107
|
type LayoutGrid = RowsColsLayoutGrid | GridLayoutGrid
|
|
1970
2108
|
|
|
1971
2109
|
interface FrameContainerMixin extends AutoLayout {
|
|
@@ -1975,7 +2113,7 @@ declare global {
|
|
|
1975
2113
|
overflowDirection: OverflowDirection
|
|
1976
2114
|
}
|
|
1977
2115
|
|
|
1978
|
-
type OverflowDirection =
|
|
2116
|
+
type OverflowDirection = 'NONE' | 'HORIZONTAL' | 'VERTICAL' | 'BOTH'
|
|
1979
2117
|
|
|
1980
2118
|
interface ReactionMixin {
|
|
1981
2119
|
reactions: ReadonlyArray<Reaction>
|
|
@@ -2030,12 +2168,12 @@ declare global {
|
|
|
2030
2168
|
|
|
2031
2169
|
findAll(callback?: (node: SceneNode) => boolean): ReadonlyArray<SceneNode>
|
|
2032
2170
|
findOne(callback: (node: SceneNode) => boolean): SceneNode | null
|
|
2033
|
-
findAllWithCriteria<T extends NodeType[]>(criteria: {
|
|
2171
|
+
findAllWithCriteria<T extends NodeType[]>(criteria: {
|
|
2172
|
+
types: T
|
|
2173
|
+
}): Array<{ type: T[number] } & SceneNode>
|
|
2034
2174
|
}
|
|
2035
2175
|
|
|
2036
|
-
interface PageNode
|
|
2037
|
-
extends
|
|
2038
|
-
ChildrenMixin<SceneNode> {
|
|
2176
|
+
interface PageNode extends ChildrenMixin<SceneNode> {
|
|
2039
2177
|
readonly type: 'PAGE'
|
|
2040
2178
|
|
|
2041
2179
|
readonly id: string
|
|
@@ -2064,12 +2202,29 @@ declare global {
|
|
|
2064
2202
|
label: 'NONE' | 'BLUE' | 'GREEN' | 'RED' | 'YELLOW' | 'PURPLE' | 'GRAY'
|
|
2065
2203
|
}
|
|
2066
2204
|
|
|
2067
|
-
interface SectionNode
|
|
2205
|
+
interface SectionNode
|
|
2206
|
+
extends Omit<
|
|
2207
|
+
DefaultContainerMixin,
|
|
2208
|
+
| 'opacity'
|
|
2209
|
+
| 'blendMode'
|
|
2210
|
+
| 'isMask'
|
|
2211
|
+
| 'isMaskOutline'
|
|
2212
|
+
| 'isMaskVisible'
|
|
2213
|
+
| 'effects'
|
|
2214
|
+
| 'effectStyleId'
|
|
2215
|
+
>,
|
|
2216
|
+
GeometryMixin,
|
|
2217
|
+
FrameContainerMixin,
|
|
2218
|
+
RectangleStrokeWeightMixin {
|
|
2068
2219
|
readonly type: 'SECTION'
|
|
2069
2220
|
clone(): SectionNode
|
|
2070
2221
|
}
|
|
2071
2222
|
|
|
2072
|
-
interface FrameNode
|
|
2223
|
+
interface FrameNode
|
|
2224
|
+
extends DefaultContainerMixin,
|
|
2225
|
+
GeometryMixin,
|
|
2226
|
+
FrameContainerMixin,
|
|
2227
|
+
RectangleStrokeWeightMixin {
|
|
2073
2228
|
readonly type: 'FRAME'
|
|
2074
2229
|
clone(): FrameNode
|
|
2075
2230
|
resizeToFit(): void
|
|
@@ -2077,9 +2232,9 @@ declare global {
|
|
|
2077
2232
|
|
|
2078
2233
|
interface RectangleNode
|
|
2079
2234
|
extends DefaultShapeMixin,
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2235
|
+
ConstraintMixin,
|
|
2236
|
+
CornerMixin,
|
|
2237
|
+
RectangleStrokeWeightMixin {
|
|
2083
2238
|
readonly type: 'RECTANGLE'
|
|
2084
2239
|
clone(): RectangleNode
|
|
2085
2240
|
}
|
|
@@ -2098,7 +2253,10 @@ declare global {
|
|
|
2098
2253
|
arcData: ArcData
|
|
2099
2254
|
}
|
|
2100
2255
|
|
|
2101
|
-
interface PolygonNode
|
|
2256
|
+
interface PolygonNode
|
|
2257
|
+
extends DefaultShapeMixin,
|
|
2258
|
+
ConstraintMixin,
|
|
2259
|
+
CornerMixin {
|
|
2102
2260
|
readonly type: 'POLYGON'
|
|
2103
2261
|
pointCount: number
|
|
2104
2262
|
clone(): PolygonNode
|
|
@@ -2137,20 +2295,19 @@ declare global {
|
|
|
2137
2295
|
|
|
2138
2296
|
interface BooleanOperationNode
|
|
2139
2297
|
extends DefaultShapeMixin,
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2298
|
+
ContainerMixin,
|
|
2299
|
+
ChildrenMixin,
|
|
2300
|
+
CornerMixin {
|
|
2143
2301
|
readonly type: 'BOOLEAN_OPERATION'
|
|
2144
2302
|
booleanOperation: 'UNION' | 'INTERSECT' | 'SUBTRACT' | 'EXCLUDE'
|
|
2145
2303
|
clone(): BooleanOperationNode
|
|
2146
2304
|
}
|
|
2147
2305
|
|
|
2148
|
-
|
|
2149
2306
|
interface GroupNode
|
|
2150
2307
|
extends DefaultShapeMixin,
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2308
|
+
ContainerMixin,
|
|
2309
|
+
ChildrenMixin,
|
|
2310
|
+
CornerMixin {
|
|
2154
2311
|
readonly type: 'GROUP'
|
|
2155
2312
|
clone(): GroupNode
|
|
2156
2313
|
}
|
|
@@ -2169,7 +2326,7 @@ declare global {
|
|
|
2169
2326
|
PROTOTYPE = 'prototype',
|
|
2170
2327
|
OUTFILE = 'outFile',
|
|
2171
2328
|
OWNWEBSITE = 'ownWebsite',
|
|
2172
|
-
OTHERLINK = 'otherLink'
|
|
2329
|
+
OTHERLINK = 'otherLink'
|
|
2173
2330
|
}
|
|
2174
2331
|
|
|
2175
2332
|
interface Superlink {
|
|
@@ -2184,7 +2341,7 @@ declare global {
|
|
|
2184
2341
|
}
|
|
2185
2342
|
|
|
2186
2343
|
interface Hyperlink {
|
|
2187
|
-
type: 'PAGE' | 'NODE' | 'URL'
|
|
2344
|
+
type: 'PAGE' | 'NODE' | 'URL'
|
|
2188
2345
|
value: string
|
|
2189
2346
|
}
|
|
2190
2347
|
interface HyperlinkWithRange {
|
|
@@ -2233,9 +2390,17 @@ declare global {
|
|
|
2233
2390
|
* This function is deprecated, please use setRangeHyperlink instead.
|
|
2234
2391
|
*/
|
|
2235
2392
|
setRangeSuperLink(start: number, end: number, link: string | null): void
|
|
2236
|
-
setRangeHyperlink(
|
|
2393
|
+
setRangeHyperlink(
|
|
2394
|
+
start: number,
|
|
2395
|
+
end: number,
|
|
2396
|
+
hyperlink: Hyperlink | null
|
|
2397
|
+
): void
|
|
2237
2398
|
setRangeTextCase(start: number, end: number, textCase: TextCase): void
|
|
2238
|
-
setRangeListStyle(
|
|
2399
|
+
setRangeListStyle(
|
|
2400
|
+
start: number,
|
|
2401
|
+
end: number,
|
|
2402
|
+
type: 'ORDERED' | 'BULLETED' | 'NONE'
|
|
2403
|
+
): void
|
|
2239
2404
|
|
|
2240
2405
|
setRangeFillStyleId(start: number, end: number, fillStyleId: string): void
|
|
2241
2406
|
setRangeTextStyleId(start: number, end: number, textStyleId: string): void
|
|
@@ -2260,7 +2425,7 @@ declare global {
|
|
|
2260
2425
|
propertyName: string,
|
|
2261
2426
|
type: Exclude<ComponentPropertyType, 'VARIANT'>,
|
|
2262
2427
|
defaultValue: string | boolean,
|
|
2263
|
-
options?: ComponentPropertyOptions
|
|
2428
|
+
options?: ComponentPropertyOptions
|
|
2264
2429
|
): string
|
|
2265
2430
|
editComponentProperty(
|
|
2266
2431
|
propertyId: string,
|
|
@@ -2269,7 +2434,7 @@ declare global {
|
|
|
2269
2434
|
defaultValue?: string | boolean
|
|
2270
2435
|
preferredValues?: InstanceSwapPreferredValue[]
|
|
2271
2436
|
alias?: string
|
|
2272
|
-
}
|
|
2437
|
+
}
|
|
2273
2438
|
): string
|
|
2274
2439
|
deleteComponentProperty(propertyId: string): void
|
|
2275
2440
|
}
|
|
@@ -2305,7 +2470,13 @@ declare global {
|
|
|
2305
2470
|
valueAlias?: string
|
|
2306
2471
|
}
|
|
2307
2472
|
|
|
2308
|
-
interface ComponentNode
|
|
2473
|
+
interface ComponentNode
|
|
2474
|
+
extends DefaultContainerMixin,
|
|
2475
|
+
GeometryMixin,
|
|
2476
|
+
FrameContainerMixin,
|
|
2477
|
+
RectangleStrokeWeightMixin,
|
|
2478
|
+
PublishableMixin,
|
|
2479
|
+
ComponentPropertiesMixin {
|
|
2309
2480
|
readonly type: 'COMPONENT'
|
|
2310
2481
|
readonly variantProperties: Array<VariantProperty> | undefined
|
|
2311
2482
|
setVariantPropertyValues(property: Record<string, string>): void
|
|
@@ -2314,20 +2485,34 @@ declare global {
|
|
|
2314
2485
|
resizeToFit(): void
|
|
2315
2486
|
}
|
|
2316
2487
|
|
|
2317
|
-
interface ComponentSetNode
|
|
2488
|
+
interface ComponentSetNode
|
|
2489
|
+
extends Omit<DefaultContainerMixin, 'appendChild' | 'insertChild'>,
|
|
2490
|
+
GeometryMixin,
|
|
2491
|
+
FrameContainerMixin,
|
|
2492
|
+
RectangleStrokeWeightMixin,
|
|
2493
|
+
PublishableMixin,
|
|
2494
|
+
ComponentPropertiesMixin {
|
|
2318
2495
|
readonly type: 'COMPONENT_SET'
|
|
2319
2496
|
clone(): ComponentSetNode
|
|
2320
2497
|
createVariantComponent(): void
|
|
2321
2498
|
createVariantProperties(properties: Array<string>): void
|
|
2322
2499
|
editVariantProperties(properties: Record<string, string>): void
|
|
2323
|
-
editVariantPropertyValues(
|
|
2500
|
+
editVariantPropertyValues(
|
|
2501
|
+
properties: Record<string, { oldValue: string; newValue: string }>
|
|
2502
|
+
): void
|
|
2324
2503
|
editVariantPropertiesAlias(properties: Record<string, string>): void
|
|
2325
|
-
editVariantPropertyValuesAlias(
|
|
2504
|
+
editVariantPropertyValuesAlias(
|
|
2505
|
+
properties: Record<string, { name: string; alias: string }>
|
|
2506
|
+
): void
|
|
2326
2507
|
deleteVariantProperty(property: string): void
|
|
2327
2508
|
resizeToFit(): void
|
|
2328
2509
|
}
|
|
2329
2510
|
|
|
2330
|
-
interface InstanceNode
|
|
2511
|
+
interface InstanceNode
|
|
2512
|
+
extends Omit<DefaultContainerMixin, 'appendChild' | 'insertChild'>,
|
|
2513
|
+
GeometryMixin,
|
|
2514
|
+
FrameContainerMixin,
|
|
2515
|
+
RectangleStrokeWeightMixin {
|
|
2331
2516
|
readonly type: 'INSTANCE'
|
|
2332
2517
|
readonly variantProperties: Array<VariantProperty> | undefined
|
|
2333
2518
|
|
|
@@ -2349,13 +2534,21 @@ declare global {
|
|
|
2349
2534
|
mainComponent: ComponentNode | null
|
|
2350
2535
|
}
|
|
2351
2536
|
|
|
2352
|
-
interface SliceNode
|
|
2537
|
+
interface SliceNode
|
|
2538
|
+
extends BaseNodeMixin,
|
|
2539
|
+
LayoutMixin,
|
|
2540
|
+
ConstraintMixin,
|
|
2541
|
+
SceneNodeMixin,
|
|
2542
|
+
ExportMixin {
|
|
2353
2543
|
readonly type: 'SLICE'
|
|
2354
2544
|
clone(): SliceNode
|
|
2355
2545
|
isPreserveRatio: boolean
|
|
2356
2546
|
}
|
|
2357
2547
|
|
|
2358
|
-
interface ConnectorNode
|
|
2548
|
+
interface ConnectorNode
|
|
2549
|
+
extends OpaqueNodeMixin,
|
|
2550
|
+
Pick<MinimalBlendMixin, 'opacity'>,
|
|
2551
|
+
Omit<MinimalStrokesMixin, 'strokeAlign'> {
|
|
2359
2552
|
readonly type: 'CONNECTOR'
|
|
2360
2553
|
createText(): TextSublayerNode
|
|
2361
2554
|
readonly text: TextSublayerNode | null
|
|
@@ -2398,23 +2591,30 @@ declare global {
|
|
|
2398
2591
|
): void
|
|
2399
2592
|
setRangeLineHeight(start: number, end: number, value: LineHeight): void
|
|
2400
2593
|
setRangeFills(start: number, end: number, paints: Paint[]): void
|
|
2401
|
-
setRangeHyperlink(
|
|
2594
|
+
setRangeHyperlink(
|
|
2595
|
+
start: number,
|
|
2596
|
+
end: number,
|
|
2597
|
+
hyperlink: Hyperlink | null
|
|
2598
|
+
): void
|
|
2402
2599
|
setRangeTextCase(start: number, end: number, textCase: TextCase): void
|
|
2403
2600
|
|
|
2404
|
-
setRangeListStyle(
|
|
2601
|
+
setRangeListStyle(
|
|
2602
|
+
start: number,
|
|
2603
|
+
end: number,
|
|
2604
|
+
type: 'ORDERED' | 'BULLETED' | 'NONE'
|
|
2605
|
+
): void
|
|
2405
2606
|
|
|
2406
2607
|
setRangeFillStyleId(start: number, end: number, fillStyleId: string): void
|
|
2407
2608
|
setRangeTextStyleId(start: number, end: number, textStyleId: string): void
|
|
2408
2609
|
}
|
|
2409
2610
|
|
|
2410
|
-
|
|
2411
2611
|
interface CreateStyleConfig {
|
|
2412
|
-
name: string
|
|
2612
|
+
name: string
|
|
2413
2613
|
/**
|
|
2414
2614
|
* layerId
|
|
2415
2615
|
*/
|
|
2416
|
-
id: string
|
|
2417
|
-
description?: string
|
|
2616
|
+
id: string
|
|
2617
|
+
description?: string
|
|
2418
2618
|
}
|
|
2419
2619
|
|
|
2420
2620
|
interface FlowStartingPoint {
|
|
@@ -2424,49 +2624,76 @@ declare global {
|
|
|
2424
2624
|
description: string
|
|
2425
2625
|
}
|
|
2426
2626
|
interface Reaction {
|
|
2427
|
-
readonly trigger: Trigger
|
|
2428
|
-
readonly action?: Action
|
|
2627
|
+
readonly trigger: Trigger
|
|
2628
|
+
readonly action?: Action
|
|
2429
2629
|
}
|
|
2430
2630
|
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
|
|
2631
|
+
readonly type: ActionType
|
|
2632
|
+
readonly destinationId: string
|
|
2633
|
+
readonly navigation: Navigation
|
|
2634
|
+
readonly transition: Transition
|
|
2635
|
+
readonly url: string
|
|
2636
|
+
readonly scrollToXOffset?: number
|
|
2637
|
+
readonly scrollToYOffset?: number
|
|
2438
2638
|
}
|
|
2439
2639
|
|
|
2440
|
-
type ActionType = 'BACK' | 'NODE' | 'URL' | 'CLOSE' | 'NONE'
|
|
2640
|
+
type ActionType = 'BACK' | 'NODE' | 'URL' | 'CLOSE' | 'NONE'
|
|
2441
2641
|
|
|
2442
|
-
type Navigation = 'NAVIGATE' | 'OVERLAY' | 'SWAP_OVERLAY' | 'SCROLL_TO'
|
|
2642
|
+
type Navigation = 'NAVIGATE' | 'OVERLAY' | 'SWAP_OVERLAY' | 'SCROLL_TO'
|
|
2443
2643
|
|
|
2444
2644
|
interface Transition {
|
|
2445
|
-
readonly type: TransitionType
|
|
2446
|
-
readonly duration: number
|
|
2447
|
-
readonly direction: TransitionDirection
|
|
2448
|
-
readonly easing: Easing
|
|
2449
|
-
}
|
|
2450
|
-
|
|
2451
|
-
type TransitionType =
|
|
2645
|
+
readonly type: TransitionType
|
|
2646
|
+
readonly duration: number
|
|
2647
|
+
readonly direction: TransitionDirection
|
|
2648
|
+
readonly easing: Easing
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
type TransitionType =
|
|
2652
|
+
| 'TANS_NONE'
|
|
2653
|
+
| 'INSTANT'
|
|
2654
|
+
| 'DISSOLVE'
|
|
2655
|
+
| 'SMART_ANIMATE'
|
|
2656
|
+
| 'MOVE_IN'
|
|
2657
|
+
| 'MOVE_OUT'
|
|
2658
|
+
| 'PUSH'
|
|
2659
|
+
| 'SLIDE_IN'
|
|
2660
|
+
| 'SLIDE_OUT'
|
|
2661
|
+
| 'DISPLACE'
|
|
2452
2662
|
|
|
2453
2663
|
type TransitionDirection = 'LEFT' | 'RIGHT' | 'TOP' | 'BOTTOM'
|
|
2454
2664
|
interface Easing {
|
|
2455
|
-
readonly type: EasingType
|
|
2665
|
+
readonly type: EasingType
|
|
2456
2666
|
readonly easingFunctionCubicBezier: {
|
|
2457
|
-
x1: number
|
|
2458
|
-
x2: number
|
|
2459
|
-
y1: number
|
|
2460
|
-
y2: number
|
|
2461
|
-
}
|
|
2667
|
+
x1: number
|
|
2668
|
+
x2: number
|
|
2669
|
+
y1: number
|
|
2670
|
+
y2: number
|
|
2671
|
+
}
|
|
2462
2672
|
}
|
|
2463
2673
|
|
|
2464
|
-
type EasingType =
|
|
2674
|
+
type EasingType =
|
|
2675
|
+
| 'LINEAR'
|
|
2676
|
+
| 'EASE_IN'
|
|
2677
|
+
| 'EASE_OUT'
|
|
2678
|
+
| 'EASE_IN_AND_OUT'
|
|
2679
|
+
| 'EASE_IN_BACK'
|
|
2680
|
+
| 'EASE_OUT_BACK'
|
|
2681
|
+
| 'EASE_IN_AND_OUT_BACK'
|
|
2682
|
+
| 'CUSTOM_CUBIC_BEZIER'
|
|
2465
2683
|
interface Trigger {
|
|
2466
|
-
readonly type: TriggerType
|
|
2467
|
-
readonly delay: number
|
|
2468
|
-
}
|
|
2469
|
-
type TriggerType =
|
|
2684
|
+
readonly type: TriggerType
|
|
2685
|
+
readonly delay: number
|
|
2686
|
+
}
|
|
2687
|
+
type TriggerType =
|
|
2688
|
+
| 'ON_CLICK'
|
|
2689
|
+
| 'ON_DRAG'
|
|
2690
|
+
| 'ON_HOVER'
|
|
2691
|
+
| 'ON_PRESS'
|
|
2692
|
+
| 'MOUSE_ENTER'
|
|
2693
|
+
| 'MOUSE_LEAVE'
|
|
2694
|
+
| 'MOUSE_DOWN'
|
|
2695
|
+
| 'MOUSE_UP'
|
|
2696
|
+
| 'AFTER_DELAY'
|
|
2470
2697
|
|
|
2471
2698
|
interface ArcData {
|
|
2472
2699
|
/**
|
|
@@ -2502,7 +2729,7 @@ declare global {
|
|
|
2502
2729
|
readonly name: string
|
|
2503
2730
|
readonly ukey: string
|
|
2504
2731
|
readonly description: string
|
|
2505
|
-
readonly type:
|
|
2732
|
+
readonly type: 'COMPONENT' | 'COMPONENT_SET'
|
|
2506
2733
|
readonly cover: string
|
|
2507
2734
|
readonly width: number
|
|
2508
2735
|
readonly height: number
|
|
@@ -2511,16 +2738,16 @@ declare global {
|
|
|
2511
2738
|
}
|
|
2512
2739
|
|
|
2513
2740
|
interface TeamLibraryStyle {
|
|
2514
|
-
readonly id: string
|
|
2515
|
-
readonly name: string
|
|
2516
|
-
readonly ukey: string
|
|
2517
|
-
readonly description: string
|
|
2518
|
-
readonly type: StyleType
|
|
2741
|
+
readonly id: string
|
|
2742
|
+
readonly name: string
|
|
2743
|
+
readonly ukey: string
|
|
2744
|
+
readonly description: string
|
|
2745
|
+
readonly type: StyleType
|
|
2519
2746
|
}
|
|
2520
2747
|
|
|
2521
2748
|
type TeamLibrary = ReadonlyArray<{
|
|
2522
|
-
readonly name: string
|
|
2523
|
-
readonly id: string
|
|
2749
|
+
readonly name: string
|
|
2750
|
+
readonly id: string
|
|
2524
2751
|
readonly componentList: TeamLibraryComponent[]
|
|
2525
2752
|
readonly style: {
|
|
2526
2753
|
paints: ReadonlyArray<TeamLibraryStyle>
|
|
@@ -2577,44 +2804,68 @@ declare global {
|
|
|
2577
2804
|
| 'CONNECTOR'
|
|
2578
2805
|
| 'SECTION'
|
|
2579
2806
|
|
|
2580
|
-
|
|
2581
2807
|
// d2c
|
|
2582
2808
|
type CodeFile = {
|
|
2583
2809
|
/**
|
|
2584
2810
|
* import third-party paths
|
|
2585
2811
|
*/
|
|
2586
2812
|
importPath?: {
|
|
2587
|
-
name: string
|
|
2588
|
-
path: string
|
|
2589
|
-
type: 'script' | 'style'
|
|
2590
|
-
}[]
|
|
2591
|
-
importType?: 'GLOBAL' | 'IMPORT'
|
|
2813
|
+
name: string
|
|
2814
|
+
path: string
|
|
2815
|
+
type: 'script' | 'style'
|
|
2816
|
+
}[]
|
|
2817
|
+
importType?: 'GLOBAL' | 'IMPORT'
|
|
2592
2818
|
// absolute path
|
|
2593
|
-
path: string
|
|
2819
|
+
path: string
|
|
2594
2820
|
// relative to the relative path of the imported file
|
|
2595
|
-
relativePath: string
|
|
2596
|
-
fileName: string
|
|
2597
|
-
type:
|
|
2821
|
+
relativePath: string
|
|
2822
|
+
fileName: string
|
|
2823
|
+
type:
|
|
2824
|
+
| 'css'
|
|
2825
|
+
| 'js'
|
|
2826
|
+
| 'typescript'
|
|
2827
|
+
| 'ts-definition'
|
|
2828
|
+
| 'static'
|
|
2829
|
+
| 'vue'
|
|
2830
|
+
| 'react'
|
|
2831
|
+
| 'java'
|
|
2832
|
+
| 'kt'
|
|
2833
|
+
| 'xml'
|
|
2598
2834
|
// code
|
|
2599
|
-
code: string
|
|
2835
|
+
code: string
|
|
2600
2836
|
// parsed code
|
|
2601
|
-
parsedCode?: string
|
|
2837
|
+
parsedCode?: string
|
|
2602
2838
|
// import
|
|
2603
|
-
chunks?: CodeFile[]
|
|
2604
|
-
}
|
|
2839
|
+
chunks?: CodeFile[]
|
|
2840
|
+
}
|
|
2605
2841
|
interface CodegenAPI {
|
|
2606
2842
|
/**
|
|
2607
2843
|
* @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
2844
|
*/
|
|
2609
|
-
on(
|
|
2845
|
+
on(
|
|
2846
|
+
type: 'generateDSL',
|
|
2847
|
+
event: (generateData: {
|
|
2848
|
+
data: MGDSL.MGDSLData
|
|
2849
|
+
callback: (modifiedData: MGDSL.MGDSLData) => void
|
|
2850
|
+
}) => void
|
|
2851
|
+
): void
|
|
2610
2852
|
/**
|
|
2611
2853
|
* @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
2854
|
*/
|
|
2613
|
-
on(
|
|
2855
|
+
on(
|
|
2856
|
+
type: 'generate',
|
|
2857
|
+
event: (generateData: {
|
|
2858
|
+
data: MGDSL.MGDSLData
|
|
2859
|
+
callback: (modifiedData: MGDSL.CustomCode) => void
|
|
2860
|
+
}) => void
|
|
2861
|
+
): void
|
|
2614
2862
|
/**
|
|
2615
2863
|
* @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
2864
|
*/
|
|
2617
|
-
on(
|
|
2865
|
+
on(
|
|
2866
|
+
type: 'codeChange',
|
|
2867
|
+
event: (data: MGDSL.CustomCode['data']) => void
|
|
2868
|
+
): void
|
|
2618
2869
|
/**
|
|
2619
2870
|
* Set the component template
|
|
2620
2871
|
* @description used to set the component mapping relationship
|
|
@@ -2627,59 +2878,91 @@ declare global {
|
|
|
2627
2878
|
* @param type framework type
|
|
2628
2879
|
* @returns code file
|
|
2629
2880
|
*/
|
|
2630
|
-
getCode(layerId: string, type: MGDSL.Framework): Promise<CodeFile | null
|
|
2881
|
+
getCode(layerId: string, type: MGDSL.Framework): Promise<CodeFile | null>
|
|
2631
2882
|
/**
|
|
2632
2883
|
* Get DSL by id and framework
|
|
2633
2884
|
* @param layerId layer id
|
|
2634
2885
|
* @param type framework type
|
|
2635
2886
|
* @returns DSL data
|
|
2636
2887
|
*/
|
|
2637
|
-
getDSL(
|
|
2888
|
+
getDSL(
|
|
2889
|
+
layerId: string,
|
|
2890
|
+
type: MGDSL.Framework
|
|
2891
|
+
): Promise<MGDSL.MGDSLData | null>
|
|
2638
2892
|
/**
|
|
2639
2893
|
* Get code by DSL
|
|
2640
2894
|
* @param data DSL data
|
|
2641
2895
|
* @param type framework type
|
|
2642
2896
|
* @returns code file
|
|
2643
2897
|
*/
|
|
2644
|
-
getCodeByDSL(
|
|
2898
|
+
getCodeByDSL(
|
|
2899
|
+
data: MGDSL.MGDSLData,
|
|
2900
|
+
type: MGDSL.Framework
|
|
2901
|
+
): Promise<CodeFile | null>
|
|
2645
2902
|
}
|
|
2646
2903
|
|
|
2647
2904
|
interface SnippetgenData {
|
|
2648
|
-
language: string
|
|
2649
|
-
layerId: string
|
|
2650
|
-
preferences: Record<string, string
|
|
2651
|
-
unit: Record<string, string
|
|
2905
|
+
language: string
|
|
2906
|
+
layerId: string
|
|
2907
|
+
preferences: Record<string, string>
|
|
2908
|
+
unit: Record<string, string>
|
|
2652
2909
|
}
|
|
2653
2910
|
|
|
2654
2911
|
interface SnippetGenResult {
|
|
2655
|
-
language: string
|
|
2656
|
-
code: string
|
|
2657
|
-
title: string
|
|
2912
|
+
language: string
|
|
2913
|
+
code: string
|
|
2914
|
+
title: string
|
|
2658
2915
|
}
|
|
2659
2916
|
|
|
2660
2917
|
interface SnippetgenAPI {
|
|
2661
|
-
on(
|
|
2662
|
-
|
|
2918
|
+
on(
|
|
2919
|
+
type: 'generate',
|
|
2920
|
+
event: (
|
|
2921
|
+
data: SnippetgenData,
|
|
2922
|
+
callback: (modifiedData: SnippetGenResult[]) => void
|
|
2923
|
+
) => void
|
|
2924
|
+
): void
|
|
2925
|
+
off(
|
|
2926
|
+
type: 'generate',
|
|
2927
|
+
event: (
|
|
2928
|
+
data: SnippetgenData,
|
|
2929
|
+
callback: (modifiedData: SnippetGenResult[]) => void
|
|
2930
|
+
) => void
|
|
2931
|
+
): void
|
|
2663
2932
|
|
|
2664
2933
|
on(type: 'action', event: (value: string) => void): void
|
|
2665
2934
|
off(type: 'action', event: (value: string) => void): void
|
|
2666
2935
|
}
|
|
2667
2936
|
|
|
2668
|
-
type StyleReturnType<T extends StyleType> =
|
|
2669
|
-
|
|
2670
|
-
T extends 'TEXT'
|
|
2671
|
-
|
|
2672
|
-
T extends '
|
|
2673
|
-
|
|
2674
|
-
T extends '
|
|
2675
|
-
|
|
2676
|
-
T extends '
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
T extends '
|
|
2681
|
-
|
|
2682
|
-
T extends '
|
|
2683
|
-
|
|
2684
|
-
|
|
2937
|
+
type StyleReturnType<T extends StyleType> = T extends 'PAINT'
|
|
2938
|
+
? PaintStyle
|
|
2939
|
+
: T extends 'TEXT'
|
|
2940
|
+
? TextStyle
|
|
2941
|
+
: T extends 'EFFECT'
|
|
2942
|
+
? EffectStyle
|
|
2943
|
+
: T extends 'GRID'
|
|
2944
|
+
? GridStyle
|
|
2945
|
+
: T extends 'STROKE_WIDTH'
|
|
2946
|
+
? StrokeWidthStyle
|
|
2947
|
+
: T extends 'CORNER_RADIUS'
|
|
2948
|
+
? CornerRadiusStyle
|
|
2949
|
+
: T extends 'PADDING'
|
|
2950
|
+
? PaddingStyle
|
|
2951
|
+
: T extends 'SPACING'
|
|
2952
|
+
? SpacingStyle
|
|
2953
|
+
: never
|
|
2954
|
+
|
|
2955
|
+
type NodeStyleReturnType<T extends NodeStyleType> = T extends 'fill'
|
|
2956
|
+
? PaintStyle
|
|
2957
|
+
: T extends 'strokeFill'
|
|
2958
|
+
? PaintStyle
|
|
2959
|
+
: T extends 'strokeWidth'
|
|
2960
|
+
? StrokeWidthStyle
|
|
2961
|
+
: T extends 'cornerRadius'
|
|
2962
|
+
? CornerRadiusStyle
|
|
2963
|
+
: T extends 'padding'
|
|
2964
|
+
? PaddingStyle
|
|
2965
|
+
: T extends 'spacing'
|
|
2966
|
+
? SpacingStyle
|
|
2967
|
+
: never
|
|
2685
2968
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastergo/plugin-typings",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.2-beta.10",
|
|
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.
|
|
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
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@rollup/plugin-
|
|
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
|
-
"
|
|
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": "^
|
|
47
|
-
"rollup-plugin-dts": "^4.0
|
|
48
|
-
"rollup-plugin-
|
|
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": "^
|
|
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": [
|