@mastergo/plugin-typings 1.5.0 → 1.7.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.
- package/LICENSE +21 -0
- package/README.md +3 -1
- package/dist/index.d.ts +216 -88
- package/package.json +5 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 MasterGo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -25,36 +25,6 @@ declare global {
|
|
|
25
25
|
getBytesAsync(): Promise<Uint8Array>
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
enum LinkFlagEnum {
|
|
29
|
-
CURRPAGE = 'currPage',
|
|
30
|
-
OTHERPAGE = 'otherPage',
|
|
31
|
-
PROTOTYPE = 'prototype',
|
|
32
|
-
OUTFILE = 'outFile',
|
|
33
|
-
OWNWEBSITE = 'ownWebsite',
|
|
34
|
-
OTHERLINK = 'otherLink',
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface Superlink {
|
|
38
|
-
start: number
|
|
39
|
-
end: number
|
|
40
|
-
superlink: {
|
|
41
|
-
layerId?: string
|
|
42
|
-
link: string
|
|
43
|
-
linkFlag: LinkFlagEnum
|
|
44
|
-
pageId: string
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface Hyperlink {
|
|
49
|
-
type: 'PAGE' | 'NODE' | 'URL',
|
|
50
|
-
value: string
|
|
51
|
-
}
|
|
52
|
-
interface HyperlinkWithRange {
|
|
53
|
-
start: number
|
|
54
|
-
end: number
|
|
55
|
-
hyperlink: Hyperlink
|
|
56
|
-
}
|
|
57
|
-
|
|
58
28
|
type PluginEventType = 'selectionchange' | 'currentpagechange' | 'close' | 'themechange' | 'drop' | 'run'
|
|
59
29
|
type ThemeColor = 'dark' | 'light'
|
|
60
30
|
|
|
@@ -133,6 +103,14 @@ declare global {
|
|
|
133
103
|
createImage(imageData: Uint8Array): Promise<Image>
|
|
134
104
|
getImageByHref(href: string): Image
|
|
135
105
|
|
|
106
|
+
/**
|
|
107
|
+
* 订阅团队库数据
|
|
108
|
+
*/
|
|
109
|
+
teamLibrary: TeamLibrary,
|
|
110
|
+
importComponentByKeyAsync(ukey: string): Promise<ComponentNode>,
|
|
111
|
+
importComponentSetByKeyAsync(ukey: string): Promise<ComponentSetNode>,
|
|
112
|
+
importStyleByKeyAsync(ukey: string): Promise<BaseStyle>,
|
|
113
|
+
|
|
136
114
|
hexToRGBA(hex: string): RGBA
|
|
137
115
|
RGBAToHex(rgba: RGBA): string
|
|
138
116
|
}
|
|
@@ -148,6 +126,8 @@ declare global {
|
|
|
148
126
|
center: Vector
|
|
149
127
|
zoom: number
|
|
150
128
|
readonly bound: Rect
|
|
129
|
+
rulerVisible: boolean
|
|
130
|
+
layoutGridVisible: boolean
|
|
151
131
|
scrollAndZoomIntoView(nodes: ReadonlyArray<BaseNode>): void
|
|
152
132
|
}
|
|
153
133
|
|
|
@@ -160,6 +140,8 @@ declare global {
|
|
|
160
140
|
width?: number
|
|
161
141
|
height?: number
|
|
162
142
|
visible?: boolean
|
|
143
|
+
x?: number | string
|
|
144
|
+
y?: number | string
|
|
163
145
|
}
|
|
164
146
|
|
|
165
147
|
interface ExportSettingsConstraints {
|
|
@@ -177,7 +159,7 @@ declare global {
|
|
|
177
159
|
|
|
178
160
|
interface ExportMixin {
|
|
179
161
|
exportSettings: ReadonlyArray<ExportSettings>
|
|
180
|
-
export(settings?: ExportSettings):
|
|
162
|
+
export(settings?: ExportSettings): Uint8Array | string // Defaults to PNG format
|
|
181
163
|
}
|
|
182
164
|
|
|
183
165
|
interface NotifyOptions {
|
|
@@ -194,18 +176,20 @@ declare global {
|
|
|
194
176
|
postMessage(pluginMessage: any, origin?: string): void
|
|
195
177
|
onmessage: ((pluginMessage: any, origin: string) => void) | undefined
|
|
196
178
|
}
|
|
197
|
-
|
|
198
|
-
/// /////////////////////////////////////////////////////////////////////////////
|
|
199
|
-
// Styles
|
|
179
|
+
type PublishStatus = 'UNPUBLISHED' | 'CURRENT' | 'CHANGED'
|
|
200
180
|
interface PublishableMixin {
|
|
201
181
|
description: string
|
|
202
182
|
/**
|
|
203
|
-
*
|
|
183
|
+
* 是否为团队库组件/样式
|
|
204
184
|
*/
|
|
205
185
|
readonly isExternal: boolean
|
|
206
186
|
readonly ukey: string
|
|
187
|
+
readonly publishStatus: PublishStatus
|
|
207
188
|
}
|
|
208
189
|
|
|
190
|
+
/// /////////////////////////////////////////////////////////////////////////////
|
|
191
|
+
// Styles
|
|
192
|
+
|
|
209
193
|
type StyleType = 'PAINT' | 'TEXT' | 'EFFECT' | 'GRID'
|
|
210
194
|
|
|
211
195
|
interface BaseStyle extends PublishableMixin {
|
|
@@ -240,6 +224,13 @@ declare global {
|
|
|
240
224
|
fills: Paint[]
|
|
241
225
|
}
|
|
242
226
|
|
|
227
|
+
interface ListStyle {
|
|
228
|
+
start: number
|
|
229
|
+
end: number
|
|
230
|
+
level: number
|
|
231
|
+
type: 'ORDERED' | 'BULLETED' | 'NONE'
|
|
232
|
+
}
|
|
233
|
+
|
|
243
234
|
interface EffectStyle extends BaseStyle {
|
|
244
235
|
type: 'EFFECT'
|
|
245
236
|
effects: ReadonlyArray<Effect>
|
|
@@ -248,12 +239,11 @@ declare global {
|
|
|
248
239
|
interface TextStyle extends BaseStyle {
|
|
249
240
|
type: 'TEXT'
|
|
250
241
|
decoration: TextDecoration
|
|
251
|
-
description: string
|
|
252
242
|
fontSize: number
|
|
253
|
-
isExternal: boolean
|
|
254
243
|
letterSpacing: number
|
|
255
244
|
letterSpacingUnit: NumValue['unit']
|
|
256
245
|
textCase: TextCase
|
|
246
|
+
lineHeight: LineHeight
|
|
257
247
|
}
|
|
258
248
|
|
|
259
249
|
interface FontAlias {
|
|
@@ -439,7 +429,7 @@ declare global {
|
|
|
439
429
|
interface BaseNodeMixin {
|
|
440
430
|
readonly id: string
|
|
441
431
|
readonly parent: (BaseNode & ChildrenMixin) | void
|
|
442
|
-
name: string
|
|
432
|
+
name: string
|
|
443
433
|
removed: boolean
|
|
444
434
|
remove(): void
|
|
445
435
|
getPluginData(key: string): string
|
|
@@ -681,17 +671,29 @@ declare global {
|
|
|
681
671
|
/// /////////////////////////////////////////////////////////////////////////////
|
|
682
672
|
// Nodes
|
|
683
673
|
|
|
684
|
-
interface DocumentNode
|
|
674
|
+
interface DocumentNode {
|
|
685
675
|
readonly type: 'DOCUMENT'
|
|
686
|
-
currentPage: PageNode
|
|
687
676
|
name: string
|
|
677
|
+
|
|
678
|
+
currentPage: PageNode
|
|
679
|
+
|
|
680
|
+
readonly children: ReadonlyArray<PageNode>
|
|
681
|
+
|
|
682
|
+
findAll(callback?: (node: SceneNode) => boolean): ReadonlyArray<SceneNode>
|
|
683
|
+
findOne(callback: (node: SceneNode) => boolean): SceneNode | null
|
|
688
684
|
}
|
|
689
685
|
|
|
690
686
|
interface PageNode
|
|
691
|
-
extends
|
|
687
|
+
extends
|
|
692
688
|
ChildrenMixin<SceneNode> {
|
|
693
689
|
readonly type: 'PAGE'
|
|
694
690
|
|
|
691
|
+
readonly id: string
|
|
692
|
+
readonly parent: DocumentNode
|
|
693
|
+
name: string
|
|
694
|
+
removed: boolean
|
|
695
|
+
remove(): void
|
|
696
|
+
|
|
695
697
|
selection: ReadonlyArray<SceneNode>
|
|
696
698
|
clone(): PageNode
|
|
697
699
|
/**
|
|
@@ -715,6 +717,7 @@ declare global {
|
|
|
715
717
|
interface FrameNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
|
|
716
718
|
readonly type: 'FRAME'
|
|
717
719
|
clone(): FrameNode
|
|
720
|
+
resizeToFit(): void
|
|
718
721
|
}
|
|
719
722
|
|
|
720
723
|
interface GroupNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin {
|
|
@@ -806,6 +809,36 @@ declare global {
|
|
|
806
809
|
letterSpacing: LetterSpacing
|
|
807
810
|
}
|
|
808
811
|
|
|
812
|
+
enum LinkFlagEnum {
|
|
813
|
+
CURRPAGE = 'currPage',
|
|
814
|
+
OTHERPAGE = 'otherPage',
|
|
815
|
+
PROTOTYPE = 'prototype',
|
|
816
|
+
OUTFILE = 'outFile',
|
|
817
|
+
OWNWEBSITE = 'ownWebsite',
|
|
818
|
+
OTHERLINK = 'otherLink',
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
interface Superlink {
|
|
822
|
+
start: number
|
|
823
|
+
end: number
|
|
824
|
+
superlink: {
|
|
825
|
+
layerId?: string
|
|
826
|
+
link: string
|
|
827
|
+
linkFlag: LinkFlagEnum
|
|
828
|
+
pageId: string
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
interface Hyperlink {
|
|
833
|
+
type: 'PAGE' | 'NODE' | 'URL',
|
|
834
|
+
value: string
|
|
835
|
+
}
|
|
836
|
+
interface HyperlinkWithRange {
|
|
837
|
+
start: number
|
|
838
|
+
end: number
|
|
839
|
+
hyperlink: Hyperlink
|
|
840
|
+
}
|
|
841
|
+
|
|
809
842
|
interface TextNode extends DefaultShapeMixin, ConstraintMixin {
|
|
810
843
|
readonly type: 'TEXT'
|
|
811
844
|
characters: string
|
|
@@ -821,6 +854,7 @@ declare global {
|
|
|
821
854
|
textAutoResize: 'NONE' | 'WIDTH_AND_HEIGHT' | 'HEIGHT'
|
|
822
855
|
paragraphSpacing: number
|
|
823
856
|
readonly textStyles: ReadonlyArray<TextSegStyle>
|
|
857
|
+
readonly listStyles: ReadonlyArray<ListStyle>
|
|
824
858
|
clone(): TextNode
|
|
825
859
|
|
|
826
860
|
insertCharacters(start: number, characters: string): void
|
|
@@ -847,18 +881,19 @@ declare global {
|
|
|
847
881
|
setRangeSuperLink(start: number, end: number, link: string | null): void
|
|
848
882
|
setRangeHyperLink(start: number, end: number, hyperlink: Hyperlink | null): void
|
|
849
883
|
setRangeTextCase(start: number, end: number, textCase: TextCase): void
|
|
884
|
+
setRangeListStyle(start: number, end: number, type: 'ORDERED' | 'BULLETED' | 'NONE'): void
|
|
850
885
|
}
|
|
851
886
|
|
|
852
|
-
interface ComponentNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
|
|
887
|
+
interface ComponentNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin {
|
|
853
888
|
readonly type: 'COMPONENT'
|
|
854
889
|
readonly variantProperties: Array<Record<string, string>>
|
|
855
|
-
description: string
|
|
856
890
|
setVariantPropertyValues(property: Record<string, string>): void
|
|
857
891
|
clone(): ComponentNode
|
|
858
892
|
createInstance(): InstanceNode
|
|
893
|
+
resizeToFit(): void
|
|
859
894
|
}
|
|
860
895
|
|
|
861
|
-
interface ComponentSetNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
|
|
896
|
+
interface ComponentSetNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin {
|
|
862
897
|
readonly type: 'COMPONENT_SET'
|
|
863
898
|
readonly componentPropertyDefinitions: Array<Record<string, Array<string> | string>>
|
|
864
899
|
clone(): ComponentSetNode
|
|
@@ -867,6 +902,7 @@ declare global {
|
|
|
867
902
|
editVariantProperties(properties: Record<string, string>): void
|
|
868
903
|
editVariantPropertyValues(properties: Record<string, { oldValue: string, newValue: string }>): void
|
|
869
904
|
deleteVariantProperty(property: string): void
|
|
905
|
+
resizeToFit(): void
|
|
870
906
|
}
|
|
871
907
|
|
|
872
908
|
interface InstanceNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
|
|
@@ -1025,6 +1061,34 @@ declare global {
|
|
|
1025
1061
|
dropMetadata?: any
|
|
1026
1062
|
}
|
|
1027
1063
|
|
|
1064
|
+
interface TeamLibraryComponent {
|
|
1065
|
+
readonly id: string;
|
|
1066
|
+
readonly name: string;
|
|
1067
|
+
readonly ukey: string;
|
|
1068
|
+
readonly description: string;
|
|
1069
|
+
readonly type: "COMPONENT" | 'COMPONENT_SET'
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
interface TeamLibraryStyle {
|
|
1073
|
+
readonly id: string;
|
|
1074
|
+
readonly name: string;
|
|
1075
|
+
readonly ukey: string;
|
|
1076
|
+
readonly description: string;
|
|
1077
|
+
readonly type: StyleType;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
type TeamLibrary = ReadonlyArray<{
|
|
1081
|
+
readonly name: string;
|
|
1082
|
+
readonly id: string;
|
|
1083
|
+
readonly componentList: TeamLibraryComponent[]
|
|
1084
|
+
readonly style: {
|
|
1085
|
+
paints: ReadonlyArray<TeamLibraryStyle>
|
|
1086
|
+
effects: ReadonlyArray<TeamLibraryStyle>
|
|
1087
|
+
texts: ReadonlyArray<TeamLibraryStyle>
|
|
1088
|
+
grids: ReadonlyArray<TeamLibraryStyle>
|
|
1089
|
+
}
|
|
1090
|
+
}>
|
|
1091
|
+
|
|
1028
1092
|
type BaseNode = DocumentNode | PageNode | SceneNode
|
|
1029
1093
|
|
|
1030
1094
|
/**
|
|
@@ -1094,36 +1158,6 @@ declare global {
|
|
|
1094
1158
|
getBytesAsync(): Promise<Uint8Array>
|
|
1095
1159
|
}
|
|
1096
1160
|
|
|
1097
|
-
enum LinkFlagEnum {
|
|
1098
|
-
CURRPAGE = 'currPage',
|
|
1099
|
-
OTHERPAGE = 'otherPage',
|
|
1100
|
-
PROTOTYPE = 'prototype',
|
|
1101
|
-
OUTFILE = 'outFile',
|
|
1102
|
-
OWNWEBSITE = 'ownWebsite',
|
|
1103
|
-
OTHERLINK = 'otherLink',
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
interface Superlink {
|
|
1107
|
-
start: number
|
|
1108
|
-
end: number
|
|
1109
|
-
superlink: {
|
|
1110
|
-
layerId?: string
|
|
1111
|
-
link: string
|
|
1112
|
-
linkFlag: LinkFlagEnum
|
|
1113
|
-
pageId: string
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
interface Hyperlink {
|
|
1118
|
-
type: 'PAGE' | 'NODE' | 'URL',
|
|
1119
|
-
value: string
|
|
1120
|
-
}
|
|
1121
|
-
interface HyperlinkWithRange {
|
|
1122
|
-
start: number
|
|
1123
|
-
end: number
|
|
1124
|
-
hyperlink: Hyperlink
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
1161
|
type PluginEventType = 'selectionchange' | 'currentpagechange' | 'close' | 'themechange' | 'drop' | 'run'
|
|
1128
1162
|
type ThemeColor = 'dark' | 'light'
|
|
1129
1163
|
|
|
@@ -1202,6 +1236,14 @@ declare global {
|
|
|
1202
1236
|
createImage(imageData: Uint8Array): Promise<Image>
|
|
1203
1237
|
getImageByHref(href: string): Image
|
|
1204
1238
|
|
|
1239
|
+
/**
|
|
1240
|
+
* 订阅团队库数据
|
|
1241
|
+
*/
|
|
1242
|
+
teamLibrary: TeamLibrary,
|
|
1243
|
+
importComponentByKeyAsync(ukey: string): Promise<ComponentNode>,
|
|
1244
|
+
importComponentSetByKeyAsync(ukey: string): Promise<ComponentSetNode>,
|
|
1245
|
+
importStyleByKeyAsync(ukey: string): Promise<BaseStyle>,
|
|
1246
|
+
|
|
1205
1247
|
hexToRGBA(hex: string): RGBA
|
|
1206
1248
|
RGBAToHex(rgba: RGBA): string
|
|
1207
1249
|
}
|
|
@@ -1217,6 +1259,8 @@ declare global {
|
|
|
1217
1259
|
center: Vector
|
|
1218
1260
|
zoom: number
|
|
1219
1261
|
readonly bound: Rect
|
|
1262
|
+
rulerVisible: boolean
|
|
1263
|
+
layoutGridVisible: boolean
|
|
1220
1264
|
scrollAndZoomIntoView(nodes: ReadonlyArray<BaseNode>): void
|
|
1221
1265
|
}
|
|
1222
1266
|
|
|
@@ -1229,6 +1273,8 @@ declare global {
|
|
|
1229
1273
|
width?: number
|
|
1230
1274
|
height?: number
|
|
1231
1275
|
visible?: boolean
|
|
1276
|
+
x?: number | string
|
|
1277
|
+
y?: number | string
|
|
1232
1278
|
}
|
|
1233
1279
|
|
|
1234
1280
|
interface ExportSettingsConstraints {
|
|
@@ -1246,7 +1292,7 @@ declare global {
|
|
|
1246
1292
|
|
|
1247
1293
|
interface ExportMixin {
|
|
1248
1294
|
exportSettings: ReadonlyArray<ExportSettings>
|
|
1249
|
-
export(settings?: ExportSettings):
|
|
1295
|
+
export(settings?: ExportSettings): Uint8Array | string // Defaults to PNG format
|
|
1250
1296
|
}
|
|
1251
1297
|
|
|
1252
1298
|
interface NotifyOptions {
|
|
@@ -1263,18 +1309,20 @@ declare global {
|
|
|
1263
1309
|
postMessage(pluginMessage: any, origin?: string): void
|
|
1264
1310
|
onmessage: ((pluginMessage: any, origin: string) => void) | undefined
|
|
1265
1311
|
}
|
|
1266
|
-
|
|
1267
|
-
/// /////////////////////////////////////////////////////////////////////////////
|
|
1268
|
-
// Styles
|
|
1312
|
+
type PublishStatus = 'UNPUBLISHED' | 'CURRENT' | 'CHANGED'
|
|
1269
1313
|
interface PublishableMixin {
|
|
1270
1314
|
description: string
|
|
1271
1315
|
/**
|
|
1272
|
-
*
|
|
1316
|
+
* 是否为团队库组件/样式
|
|
1273
1317
|
*/
|
|
1274
1318
|
readonly isExternal: boolean
|
|
1275
1319
|
readonly ukey: string
|
|
1320
|
+
readonly publishStatus: PublishStatus
|
|
1276
1321
|
}
|
|
1277
1322
|
|
|
1323
|
+
/// /////////////////////////////////////////////////////////////////////////////
|
|
1324
|
+
// Styles
|
|
1325
|
+
|
|
1278
1326
|
type StyleType = 'PAINT' | 'TEXT' | 'EFFECT' | 'GRID'
|
|
1279
1327
|
|
|
1280
1328
|
interface BaseStyle extends PublishableMixin {
|
|
@@ -1309,6 +1357,13 @@ declare global {
|
|
|
1309
1357
|
fills: Paint[]
|
|
1310
1358
|
}
|
|
1311
1359
|
|
|
1360
|
+
interface ListStyle {
|
|
1361
|
+
start: number
|
|
1362
|
+
end: number
|
|
1363
|
+
level: number
|
|
1364
|
+
type: 'ORDERED' | 'BULLETED' | 'NONE'
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1312
1367
|
interface EffectStyle extends BaseStyle {
|
|
1313
1368
|
type: 'EFFECT'
|
|
1314
1369
|
effects: ReadonlyArray<Effect>
|
|
@@ -1317,12 +1372,11 @@ declare global {
|
|
|
1317
1372
|
interface TextStyle extends BaseStyle {
|
|
1318
1373
|
type: 'TEXT'
|
|
1319
1374
|
decoration: TextDecoration
|
|
1320
|
-
description: string
|
|
1321
1375
|
fontSize: number
|
|
1322
|
-
isExternal: boolean
|
|
1323
1376
|
letterSpacing: number
|
|
1324
1377
|
letterSpacingUnit: NumValue['unit']
|
|
1325
1378
|
textCase: TextCase
|
|
1379
|
+
lineHeight: LineHeight
|
|
1326
1380
|
}
|
|
1327
1381
|
|
|
1328
1382
|
interface FontAlias {
|
|
@@ -1508,7 +1562,7 @@ declare global {
|
|
|
1508
1562
|
interface BaseNodeMixin {
|
|
1509
1563
|
readonly id: string
|
|
1510
1564
|
readonly parent: (BaseNode & ChildrenMixin) | void
|
|
1511
|
-
name: string
|
|
1565
|
+
name: string
|
|
1512
1566
|
removed: boolean
|
|
1513
1567
|
remove(): void
|
|
1514
1568
|
getPluginData(key: string): string
|
|
@@ -1750,17 +1804,29 @@ declare global {
|
|
|
1750
1804
|
/// /////////////////////////////////////////////////////////////////////////////
|
|
1751
1805
|
// Nodes
|
|
1752
1806
|
|
|
1753
|
-
interface DocumentNode
|
|
1807
|
+
interface DocumentNode {
|
|
1754
1808
|
readonly type: 'DOCUMENT'
|
|
1755
|
-
currentPage: PageNode
|
|
1756
1809
|
name: string
|
|
1810
|
+
|
|
1811
|
+
currentPage: PageNode
|
|
1812
|
+
|
|
1813
|
+
readonly children: ReadonlyArray<PageNode>
|
|
1814
|
+
|
|
1815
|
+
findAll(callback?: (node: SceneNode) => boolean): ReadonlyArray<SceneNode>
|
|
1816
|
+
findOne(callback: (node: SceneNode) => boolean): SceneNode | null
|
|
1757
1817
|
}
|
|
1758
1818
|
|
|
1759
1819
|
interface PageNode
|
|
1760
|
-
extends
|
|
1820
|
+
extends
|
|
1761
1821
|
ChildrenMixin<SceneNode> {
|
|
1762
1822
|
readonly type: 'PAGE'
|
|
1763
1823
|
|
|
1824
|
+
readonly id: string
|
|
1825
|
+
readonly parent: DocumentNode
|
|
1826
|
+
name: string
|
|
1827
|
+
removed: boolean
|
|
1828
|
+
remove(): void
|
|
1829
|
+
|
|
1764
1830
|
selection: ReadonlyArray<SceneNode>
|
|
1765
1831
|
clone(): PageNode
|
|
1766
1832
|
/**
|
|
@@ -1784,6 +1850,7 @@ declare global {
|
|
|
1784
1850
|
interface FrameNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
|
|
1785
1851
|
readonly type: 'FRAME'
|
|
1786
1852
|
clone(): FrameNode
|
|
1853
|
+
resizeToFit(): void
|
|
1787
1854
|
}
|
|
1788
1855
|
|
|
1789
1856
|
interface GroupNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin {
|
|
@@ -1875,6 +1942,36 @@ declare global {
|
|
|
1875
1942
|
letterSpacing: LetterSpacing
|
|
1876
1943
|
}
|
|
1877
1944
|
|
|
1945
|
+
enum LinkFlagEnum {
|
|
1946
|
+
CURRPAGE = 'currPage',
|
|
1947
|
+
OTHERPAGE = 'otherPage',
|
|
1948
|
+
PROTOTYPE = 'prototype',
|
|
1949
|
+
OUTFILE = 'outFile',
|
|
1950
|
+
OWNWEBSITE = 'ownWebsite',
|
|
1951
|
+
OTHERLINK = 'otherLink',
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
interface Superlink {
|
|
1955
|
+
start: number
|
|
1956
|
+
end: number
|
|
1957
|
+
superlink: {
|
|
1958
|
+
layerId?: string
|
|
1959
|
+
link: string
|
|
1960
|
+
linkFlag: LinkFlagEnum
|
|
1961
|
+
pageId: string
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
interface Hyperlink {
|
|
1966
|
+
type: 'PAGE' | 'NODE' | 'URL',
|
|
1967
|
+
value: string
|
|
1968
|
+
}
|
|
1969
|
+
interface HyperlinkWithRange {
|
|
1970
|
+
start: number
|
|
1971
|
+
end: number
|
|
1972
|
+
hyperlink: Hyperlink
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1878
1975
|
interface TextNode extends DefaultShapeMixin, ConstraintMixin {
|
|
1879
1976
|
readonly type: 'TEXT'
|
|
1880
1977
|
characters: string
|
|
@@ -1890,6 +1987,7 @@ declare global {
|
|
|
1890
1987
|
textAutoResize: 'NONE' | 'WIDTH_AND_HEIGHT' | 'HEIGHT'
|
|
1891
1988
|
paragraphSpacing: number
|
|
1892
1989
|
readonly textStyles: ReadonlyArray<TextSegStyle>
|
|
1990
|
+
readonly listStyles: ReadonlyArray<ListStyle>
|
|
1893
1991
|
clone(): TextNode
|
|
1894
1992
|
|
|
1895
1993
|
insertCharacters(start: number, characters: string): void
|
|
@@ -1916,18 +2014,19 @@ declare global {
|
|
|
1916
2014
|
setRangeSuperLink(start: number, end: number, link: string | null): void
|
|
1917
2015
|
setRangeHyperLink(start: number, end: number, hyperlink: Hyperlink | null): void
|
|
1918
2016
|
setRangeTextCase(start: number, end: number, textCase: TextCase): void
|
|
2017
|
+
setRangeListStyle(start: number, end: number, type: 'ORDERED' | 'BULLETED' | 'NONE'): void
|
|
1919
2018
|
}
|
|
1920
2019
|
|
|
1921
|
-
interface ComponentNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
|
|
2020
|
+
interface ComponentNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin {
|
|
1922
2021
|
readonly type: 'COMPONENT'
|
|
1923
2022
|
readonly variantProperties: Array<Record<string, string>>
|
|
1924
|
-
description: string
|
|
1925
2023
|
setVariantPropertyValues(property: Record<string, string>): void
|
|
1926
2024
|
clone(): ComponentNode
|
|
1927
2025
|
createInstance(): InstanceNode
|
|
2026
|
+
resizeToFit(): void
|
|
1928
2027
|
}
|
|
1929
2028
|
|
|
1930
|
-
interface ComponentSetNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
|
|
2029
|
+
interface ComponentSetNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin {
|
|
1931
2030
|
readonly type: 'COMPONENT_SET'
|
|
1932
2031
|
readonly componentPropertyDefinitions: Array<Record<string, Array<string> | string>>
|
|
1933
2032
|
clone(): ComponentSetNode
|
|
@@ -1936,6 +2035,7 @@ declare global {
|
|
|
1936
2035
|
editVariantProperties(properties: Record<string, string>): void
|
|
1937
2036
|
editVariantPropertyValues(properties: Record<string, { oldValue: string, newValue: string }>): void
|
|
1938
2037
|
deleteVariantProperty(property: string): void
|
|
2038
|
+
resizeToFit(): void
|
|
1939
2039
|
}
|
|
1940
2040
|
|
|
1941
2041
|
interface InstanceNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
|
|
@@ -2094,6 +2194,34 @@ declare global {
|
|
|
2094
2194
|
dropMetadata?: any
|
|
2095
2195
|
}
|
|
2096
2196
|
|
|
2197
|
+
interface TeamLibraryComponent {
|
|
2198
|
+
readonly id: string;
|
|
2199
|
+
readonly name: string;
|
|
2200
|
+
readonly ukey: string;
|
|
2201
|
+
readonly description: string;
|
|
2202
|
+
readonly type: "COMPONENT" | 'COMPONENT_SET'
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
interface TeamLibraryStyle {
|
|
2206
|
+
readonly id: string;
|
|
2207
|
+
readonly name: string;
|
|
2208
|
+
readonly ukey: string;
|
|
2209
|
+
readonly description: string;
|
|
2210
|
+
readonly type: StyleType;
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
type TeamLibrary = ReadonlyArray<{
|
|
2214
|
+
readonly name: string;
|
|
2215
|
+
readonly id: string;
|
|
2216
|
+
readonly componentList: TeamLibraryComponent[]
|
|
2217
|
+
readonly style: {
|
|
2218
|
+
paints: ReadonlyArray<TeamLibraryStyle>
|
|
2219
|
+
effects: ReadonlyArray<TeamLibraryStyle>
|
|
2220
|
+
texts: ReadonlyArray<TeamLibraryStyle>
|
|
2221
|
+
grids: ReadonlyArray<TeamLibraryStyle>
|
|
2222
|
+
}
|
|
2223
|
+
}>
|
|
2224
|
+
|
|
2097
2225
|
type BaseNode = DocumentNode | PageNode | SceneNode
|
|
2098
2226
|
|
|
2099
2227
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastergo/plugin-typings",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "MasterGo插件API声明文件",
|
|
5
5
|
"main": "",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
],
|
|
25
25
|
"author": "MasterGo",
|
|
26
26
|
"license": "MIT",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/mastergo-design/plugin-typings"
|
|
30
|
+
},
|
|
27
31
|
"directories": {
|
|
28
32
|
"lib": "lib"
|
|
29
33
|
},
|