@mastergo/plugin-typings 1.8.0 → 1.10.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/CHANGELOG.md +30 -0
- package/dist/index.d.ts +63 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
# [1.10.0](https://github.com/mastergo-design/plugin-typings/compare/v1.9.0...v1.10.0) (2022-12-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* 文字分段样式增加fontWeight字重字段 ([3619b51](https://github.com/mastergo-design/plugin-typings/commit/3619b518fcd8cbd137df5fa0387bc8162fb53940))
|
|
7
|
+
* 文字新增百分比行高 ([a560491](https://github.com/mastergo-design/plugin-typings/commit/a560491b9fb146184fdce13d48b6eb58be4b6949))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# [1.9.0](https://github.com/mastergo-design/plugin-typings/compare/v1.8.0...v1.9.0) (2022-11-24)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* 修复ComponentPropertyDefinitions类型不清晰的问题 ([dd8ad00](https://github.com/mastergo-design/plugin-typings/commit/dd8ad0049e2edfe48c18118991f15f0f97b90f87))
|
|
17
|
+
* 修复variantProperties类型不清晰问题 ([1da5b1d](https://github.com/mastergo-design/plugin-typings/commit/1da5b1dc57f3ad8b2116523e03e62165084d0453))
|
|
18
|
+
* 移除BooleanOperationNode, ComponentSetNode, InstanceNode无效的appendChild, insertChild方法 ([c3da0cd](https://github.com/mastergo-design/plugin-typings/commit/c3da0cdc00eb37728f816a05dbcd81fb4dd256b6))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* 添加flatten和rescale接口 ([dc87721](https://github.com/mastergo-design/plugin-typings/commit/dc87721478c725285e3e903beab045c6f175360c))
|
|
24
|
+
* 图层新增翻转接口/新增findAllWithCriteria接口/全局创建组件和创建容器方法新增可选参数 ([a318458](https://github.com/mastergo-design/plugin-typings/commit/a318458714cadf0e1c16613c73b3d77f866a3b70))
|
|
25
|
+
* 新增setRangeTextStyleId设置分段文字样式 ([7cd5e9c](https://github.com/mastergo-design/plugin-typings/commit/7cd5e9c59cc54a63f2c0a22cf992dcce5b2184ea))
|
|
26
|
+
* 与group等接口统一类型 ([4107784](https://github.com/mastergo-design/plugin-typings/commit/410778431defb243d3cc3a191d5fb9790f5ea26e))
|
|
27
|
+
* textNode增加setRangeFillStyleId ([f03314b](https://github.com/mastergo-design/plugin-typings/commit/f03314b1e32eb9c327b31ac487dbcb3148781da4))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
1
31
|
# [1.8.0](https://github.com/mastergo-design/plugin-typings/compare/v1.7.1...v1.8.0) (2022-11-18)
|
|
2
32
|
|
|
3
33
|
|
package/dist/index.d.ts
CHANGED
|
@@ -64,8 +64,8 @@ declare global {
|
|
|
64
64
|
createStar(): StarNode
|
|
65
65
|
createPen(): PenNode
|
|
66
66
|
createText(): TextNode
|
|
67
|
-
createFrame(): FrameNode
|
|
68
|
-
createComponent(): ComponentNode
|
|
67
|
+
createFrame(children?: SceneNode[]): FrameNode
|
|
68
|
+
createComponent(children?: SceneNode[]): ComponentNode
|
|
69
69
|
createPage(): PageNode
|
|
70
70
|
createSlice(): SliceNode
|
|
71
71
|
createConnector(): ConnectorNode
|
|
@@ -73,13 +73,18 @@ declare global {
|
|
|
73
73
|
|
|
74
74
|
getHoverLayer(): PageNode | SceneNode
|
|
75
75
|
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated
|
|
78
|
+
* This function is deprecated, please use viewport.layoutGridVisible instead.
|
|
79
|
+
*/
|
|
76
80
|
showGrid(show: boolean): void
|
|
77
81
|
|
|
78
|
-
group(children:
|
|
79
|
-
union(children:
|
|
80
|
-
subtract(children:
|
|
81
|
-
intersect(children:
|
|
82
|
-
exclude(children:
|
|
82
|
+
group(children: SceneNode[]): GroupNode
|
|
83
|
+
union(children: SceneNode[]): BooleanOperationNode
|
|
84
|
+
subtract(children: SceneNode[]): BooleanOperationNode
|
|
85
|
+
intersect(children: SceneNode[]): BooleanOperationNode
|
|
86
|
+
exclude(children: SceneNode[]): BooleanOperationNode
|
|
87
|
+
flatten(nodes: SceneNode[]): PenNode
|
|
83
88
|
|
|
84
89
|
saveVersionHistoryAsync(desc: string): Promise<void>
|
|
85
90
|
|
|
@@ -109,7 +114,7 @@ declare global {
|
|
|
109
114
|
teamLibrary: TeamLibrary,
|
|
110
115
|
importComponentByKeyAsync(ukey: string): Promise<ComponentNode>,
|
|
111
116
|
importComponentSetByKeyAsync(ukey: string): Promise<ComponentSetNode>,
|
|
112
|
-
importStyleByKeyAsync(ukey: string): Promise<
|
|
117
|
+
importStyleByKeyAsync(ukey: string): Promise<Style>,
|
|
113
118
|
|
|
114
119
|
hexToRGBA(hex: string): RGBA
|
|
115
120
|
RGBAToHex(rgba: RGBA): string
|
|
@@ -128,7 +133,7 @@ declare global {
|
|
|
128
133
|
readonly bound: Rect
|
|
129
134
|
rulerVisible: boolean
|
|
130
135
|
layoutGridVisible: boolean
|
|
131
|
-
scrollAndZoomIntoView(nodes:
|
|
136
|
+
scrollAndZoomIntoView(nodes: SceneNode[]): void
|
|
132
137
|
}
|
|
133
138
|
|
|
134
139
|
interface ClientStorageAPI {
|
|
@@ -222,6 +227,7 @@ declare global {
|
|
|
222
227
|
lineHeight: LineHeight
|
|
223
228
|
textDecoration: TextDecoration
|
|
224
229
|
textCase: TextCase
|
|
230
|
+
fontWeight: number
|
|
225
231
|
}
|
|
226
232
|
fills: Paint[]
|
|
227
233
|
}
|
|
@@ -394,10 +400,14 @@ declare global {
|
|
|
394
400
|
readonly unit: 'PIXELS' | 'PERCENT'
|
|
395
401
|
}
|
|
396
402
|
|
|
397
|
-
type LineHeight =
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
403
|
+
type LineHeight =
|
|
404
|
+
| {
|
|
405
|
+
readonly value: number
|
|
406
|
+
readonly unit: 'PIXELS' | 'PERCENT'
|
|
407
|
+
}
|
|
408
|
+
| {
|
|
409
|
+
readonly unit: 'AUTO'
|
|
410
|
+
}
|
|
401
411
|
|
|
402
412
|
type BlendMode =
|
|
403
413
|
| 'NORMAL'
|
|
@@ -462,6 +472,7 @@ declare global {
|
|
|
462
472
|
|
|
463
473
|
findAll(callback?: (node: SceneNode) => boolean): ReadonlyArray<SceneNode>
|
|
464
474
|
findOne(callback: (node: SceneNode) => boolean): SceneNode | null
|
|
475
|
+
findAllWithCriteria<T extends NodeType[]>(criteria: { types: T }): Array<{ type: T[number] } & SceneNode>
|
|
465
476
|
}
|
|
466
477
|
|
|
467
478
|
interface ConstraintMixin {
|
|
@@ -475,6 +486,12 @@ declare global {
|
|
|
475
486
|
height: number
|
|
476
487
|
}
|
|
477
488
|
|
|
489
|
+
type ScaleCenter = 'TOPLEFT' | 'TOP' | 'TOPRIGHT' | 'LEFT' | 'CENTER' | 'RIGHT' | 'BOTTOMLEFT' | 'BOTTOM' | 'BOTTOMRIGHT'
|
|
490
|
+
|
|
491
|
+
interface ScaleOption {
|
|
492
|
+
scaleCenter?: ScaleCenter
|
|
493
|
+
}
|
|
494
|
+
|
|
478
495
|
interface LayoutMixin {
|
|
479
496
|
absoluteTransform: Transform
|
|
480
497
|
relativeTransform: Transform
|
|
@@ -488,6 +505,8 @@ declare global {
|
|
|
488
505
|
layoutPositioning: 'AUTO' | 'ABSOLUTE' // applicable only inside auto-layout frames
|
|
489
506
|
alignSelf: 'STRETCH' | 'INHERIT' // applicable only inside auto-layout frames
|
|
490
507
|
flexGrow: 0 | 1 // applicable only inside auto-layout frames
|
|
508
|
+
rescale(scale: number, scaleOption?: ScaleOption): void
|
|
509
|
+
flip(direction: 'VERTICAL' | 'HORIZONTAL'): void
|
|
491
510
|
}
|
|
492
511
|
|
|
493
512
|
interface BlendMixin {
|
|
@@ -682,6 +701,7 @@ declare global {
|
|
|
682
701
|
|
|
683
702
|
findAll(callback?: (node: SceneNode) => boolean): ReadonlyArray<SceneNode>
|
|
684
703
|
findOne(callback: (node: SceneNode) => boolean): SceneNode | null
|
|
704
|
+
findAllWithCriteria<T extends NodeType[]>(criteria: { types: T }): Array<{ type: T[number] } & SceneNode>
|
|
685
705
|
}
|
|
686
706
|
|
|
687
707
|
interface PageNode
|
|
@@ -795,7 +815,7 @@ declare global {
|
|
|
795
815
|
interface BooleanOperationNode
|
|
796
816
|
extends DefaultShapeMixin,
|
|
797
817
|
FrameContainerMixin,
|
|
798
|
-
ChildrenMixin,
|
|
818
|
+
Omit<ChildrenMixin, 'appendChild' | 'insertChild'>,
|
|
799
819
|
CornerMixin {
|
|
800
820
|
readonly type: 'BOOLEAN_OPERATION'
|
|
801
821
|
booleanOperation: 'UNION' | 'INTERSECT' | 'SUBTRACT' | 'EXCLUDE'
|
|
@@ -846,7 +866,7 @@ declare global {
|
|
|
846
866
|
readonly hasMissingFont: boolean
|
|
847
867
|
/**
|
|
848
868
|
* @deprecated
|
|
849
|
-
* This attribute is
|
|
869
|
+
* This attribute is deprecated, please use hyperlinks instead.
|
|
850
870
|
*/
|
|
851
871
|
readonly superlinks: Array<Superlink>
|
|
852
872
|
readonly hyperlinks: Array<HyperlinkWithRange>
|
|
@@ -877,26 +897,43 @@ declare global {
|
|
|
877
897
|
setRangeFills(start: number, end: number, paints: Paint[]): void
|
|
878
898
|
/**
|
|
879
899
|
* @deprecated
|
|
880
|
-
* This function is
|
|
900
|
+
* This function is deprecated, please use setRangeHyperlink instead.
|
|
881
901
|
*/
|
|
882
902
|
setRangeSuperLink(start: number, end: number, link: string | null): void
|
|
883
903
|
setRangeHyperlink(start: number, end: number, hyperlink: Hyperlink | null): void
|
|
884
904
|
setRangeTextCase(start: number, end: number, textCase: TextCase): void
|
|
885
905
|
setRangeListStyle(start: number, end: number, type: 'ORDERED' | 'BULLETED' | 'NONE'): void
|
|
906
|
+
|
|
907
|
+
setRangeFillStyleId(start: number, end: number, fillStyleId: string): void
|
|
908
|
+
setRangeTextStyleId(start: number, end: number, textStyleId: string): void
|
|
886
909
|
}
|
|
887
910
|
|
|
888
911
|
interface ComponentNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin {
|
|
889
912
|
readonly type: 'COMPONENT'
|
|
890
|
-
readonly variantProperties: Array<
|
|
913
|
+
readonly variantProperties: Array<VariantProperty> | undefined
|
|
891
914
|
setVariantPropertyValues(property: Record<string, string>): void
|
|
892
915
|
clone(): ComponentNode
|
|
893
916
|
createInstance(): InstanceNode
|
|
894
917
|
resizeToFit(): void
|
|
895
918
|
}
|
|
896
919
|
|
|
897
|
-
|
|
920
|
+
|
|
921
|
+
type VariantMixin = {
|
|
922
|
+
property: string
|
|
923
|
+
type: 'variant'
|
|
924
|
+
values: string[]
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
interface VariantProperty {
|
|
928
|
+
property: string
|
|
929
|
+
value: string
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
type ComponentPropertyDefinitions = Array<VariantMixin>
|
|
933
|
+
|
|
934
|
+
interface ComponentSetNode extends Omit<DefaultContainerMixin, 'appendChild' | 'insertChild'>, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin {
|
|
898
935
|
readonly type: 'COMPONENT_SET'
|
|
899
|
-
readonly componentPropertyDefinitions:
|
|
936
|
+
readonly componentPropertyDefinitions: ComponentPropertyDefinitions
|
|
900
937
|
clone(): ComponentSetNode
|
|
901
938
|
createVariantComponent(): void
|
|
902
939
|
createVariantProperties(properties: Array<string>): void
|
|
@@ -906,9 +943,9 @@ declare global {
|
|
|
906
943
|
resizeToFit(): void
|
|
907
944
|
}
|
|
908
945
|
|
|
909
|
-
interface InstanceNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
|
|
946
|
+
interface InstanceNode extends Omit<DefaultContainerMixin, 'appendChild' | 'insertChild'>, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
|
|
910
947
|
readonly type: 'INSTANCE'
|
|
911
|
-
readonly variantProperties: Array<
|
|
948
|
+
readonly variantProperties: Array<VariantProperty> | undefined
|
|
912
949
|
setVariantPropertyValues(property: Record<string, string>): void
|
|
913
950
|
clone(): InstanceNode
|
|
914
951
|
/**
|
|
@@ -970,6 +1007,11 @@ declare global {
|
|
|
970
1007
|
setRangeFills(start: number, end: number, paints: Paint[]): void
|
|
971
1008
|
setRangeHyperlink(start: number, end: number, hyperlink: Hyperlink | null): void
|
|
972
1009
|
setRangeTextCase(start: number, end: number, textCase: TextCase): void
|
|
1010
|
+
|
|
1011
|
+
setRangeListStyle(start: number, end: number, type: 'ORDERED' | 'BULLETED' | 'NONE'): void
|
|
1012
|
+
|
|
1013
|
+
setRangeFillStyleId(start: number, end: number, fillStyleId: string): void
|
|
1014
|
+
setRangeTextStyleId(start: number, end: number, textStyleId: string): void
|
|
973
1015
|
}
|
|
974
1016
|
|
|
975
1017
|
|