@mastergo/plugin-typings 1.8.0 → 1.9.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 +20 -0
- package/dist/index.d.ts +54 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# [1.9.0](https://github.com/mastergo-design/plugin-typings/compare/v1.8.0...v1.9.0) (2022-11-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 修复ComponentPropertyDefinitions类型不清晰的问题 ([dd8ad00](https://github.com/mastergo-design/plugin-typings/commit/dd8ad0049e2edfe48c18118991f15f0f97b90f87))
|
|
7
|
+
* 修复variantProperties类型不清晰问题 ([1da5b1d](https://github.com/mastergo-design/plugin-typings/commit/1da5b1dc57f3ad8b2116523e03e62165084d0453))
|
|
8
|
+
* 移除BooleanOperationNode, ComponentSetNode, InstanceNode无效的appendChild, insertChild方法 ([c3da0cd](https://github.com/mastergo-design/plugin-typings/commit/c3da0cdc00eb37728f816a05dbcd81fb4dd256b6))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* 添加flatten和rescale接口 ([dc87721](https://github.com/mastergo-design/plugin-typings/commit/dc87721478c725285e3e903beab045c6f175360c))
|
|
14
|
+
* 图层新增翻转接口/新增findAllWithCriteria接口/全局创建组件和创建容器方法新增可选参数 ([a318458](https://github.com/mastergo-design/plugin-typings/commit/a318458714cadf0e1c16613c73b3d77f866a3b70))
|
|
15
|
+
* 新增setRangeTextStyleId设置分段文字样式 ([7cd5e9c](https://github.com/mastergo-design/plugin-typings/commit/7cd5e9c59cc54a63f2c0a22cf992dcce5b2184ea))
|
|
16
|
+
* 与group等接口统一类型 ([4107784](https://github.com/mastergo-design/plugin-typings/commit/410778431defb243d3cc3a191d5fb9790f5ea26e))
|
|
17
|
+
* textNode增加setRangeFillStyleId ([f03314b](https://github.com/mastergo-design/plugin-typings/commit/f03314b1e32eb9c327b31ac487dbcb3148781da4))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
1
21
|
# [1.8.0](https://github.com/mastergo-design/plugin-typings/compare/v1.7.1...v1.8.0) (2022-11-18)
|
|
2
22
|
|
|
3
23
|
|
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 {
|
|
@@ -462,6 +467,7 @@ declare global {
|
|
|
462
467
|
|
|
463
468
|
findAll(callback?: (node: SceneNode) => boolean): ReadonlyArray<SceneNode>
|
|
464
469
|
findOne(callback: (node: SceneNode) => boolean): SceneNode | null
|
|
470
|
+
findAllWithCriteria<T extends NodeType[]>(criteria: { types: T }): Array<{ type: T[number] } & SceneNode>
|
|
465
471
|
}
|
|
466
472
|
|
|
467
473
|
interface ConstraintMixin {
|
|
@@ -475,6 +481,12 @@ declare global {
|
|
|
475
481
|
height: number
|
|
476
482
|
}
|
|
477
483
|
|
|
484
|
+
type ScaleCenter = 'TOPLEFT' | 'TOP' | 'TOPRIGHT' | 'LEFT' | 'CENTER' | 'RIGHT' | 'BOTTOMLEFT' | 'BOTTOM' | 'BOTTOMRIGHT'
|
|
485
|
+
|
|
486
|
+
interface ScaleOption {
|
|
487
|
+
scaleCenter?: ScaleCenter
|
|
488
|
+
}
|
|
489
|
+
|
|
478
490
|
interface LayoutMixin {
|
|
479
491
|
absoluteTransform: Transform
|
|
480
492
|
relativeTransform: Transform
|
|
@@ -488,6 +500,8 @@ declare global {
|
|
|
488
500
|
layoutPositioning: 'AUTO' | 'ABSOLUTE' // applicable only inside auto-layout frames
|
|
489
501
|
alignSelf: 'STRETCH' | 'INHERIT' // applicable only inside auto-layout frames
|
|
490
502
|
flexGrow: 0 | 1 // applicable only inside auto-layout frames
|
|
503
|
+
rescale(scale: number, scaleOption?: ScaleOption): void
|
|
504
|
+
flip(direction: 'VERTICAL' | 'HORIZONTAL'): void
|
|
491
505
|
}
|
|
492
506
|
|
|
493
507
|
interface BlendMixin {
|
|
@@ -682,6 +696,7 @@ declare global {
|
|
|
682
696
|
|
|
683
697
|
findAll(callback?: (node: SceneNode) => boolean): ReadonlyArray<SceneNode>
|
|
684
698
|
findOne(callback: (node: SceneNode) => boolean): SceneNode | null
|
|
699
|
+
findAllWithCriteria<T extends NodeType[]>(criteria: { types: T }): Array<{ type: T[number] } & SceneNode>
|
|
685
700
|
}
|
|
686
701
|
|
|
687
702
|
interface PageNode
|
|
@@ -795,7 +810,7 @@ declare global {
|
|
|
795
810
|
interface BooleanOperationNode
|
|
796
811
|
extends DefaultShapeMixin,
|
|
797
812
|
FrameContainerMixin,
|
|
798
|
-
ChildrenMixin,
|
|
813
|
+
Omit<ChildrenMixin, 'appendChild' | 'insertChild'>,
|
|
799
814
|
CornerMixin {
|
|
800
815
|
readonly type: 'BOOLEAN_OPERATION'
|
|
801
816
|
booleanOperation: 'UNION' | 'INTERSECT' | 'SUBTRACT' | 'EXCLUDE'
|
|
@@ -846,7 +861,7 @@ declare global {
|
|
|
846
861
|
readonly hasMissingFont: boolean
|
|
847
862
|
/**
|
|
848
863
|
* @deprecated
|
|
849
|
-
* This attribute is
|
|
864
|
+
* This attribute is deprecated, please use hyperlinks instead.
|
|
850
865
|
*/
|
|
851
866
|
readonly superlinks: Array<Superlink>
|
|
852
867
|
readonly hyperlinks: Array<HyperlinkWithRange>
|
|
@@ -877,26 +892,43 @@ declare global {
|
|
|
877
892
|
setRangeFills(start: number, end: number, paints: Paint[]): void
|
|
878
893
|
/**
|
|
879
894
|
* @deprecated
|
|
880
|
-
* This function is
|
|
895
|
+
* This function is deprecated, please use setRangeHyperlink instead.
|
|
881
896
|
*/
|
|
882
897
|
setRangeSuperLink(start: number, end: number, link: string | null): void
|
|
883
898
|
setRangeHyperlink(start: number, end: number, hyperlink: Hyperlink | null): void
|
|
884
899
|
setRangeTextCase(start: number, end: number, textCase: TextCase): void
|
|
885
900
|
setRangeListStyle(start: number, end: number, type: 'ORDERED' | 'BULLETED' | 'NONE'): void
|
|
901
|
+
|
|
902
|
+
setRangeFillStyleId(start: number, end: number, fillStyleId: string): void
|
|
903
|
+
setRangeTextStyleId(start: number, end: number, textStyleId: string): void
|
|
886
904
|
}
|
|
887
905
|
|
|
888
906
|
interface ComponentNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin {
|
|
889
907
|
readonly type: 'COMPONENT'
|
|
890
|
-
readonly variantProperties: Array<
|
|
908
|
+
readonly variantProperties: Array<VariantProperty> | undefined
|
|
891
909
|
setVariantPropertyValues(property: Record<string, string>): void
|
|
892
910
|
clone(): ComponentNode
|
|
893
911
|
createInstance(): InstanceNode
|
|
894
912
|
resizeToFit(): void
|
|
895
913
|
}
|
|
896
914
|
|
|
897
|
-
|
|
915
|
+
|
|
916
|
+
type VariantMixin = {
|
|
917
|
+
property: string
|
|
918
|
+
type: 'variant'
|
|
919
|
+
values: string[]
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
interface VariantProperty {
|
|
923
|
+
property: string
|
|
924
|
+
value: string
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
type ComponentPropertyDefinitions = Array<VariantMixin>
|
|
928
|
+
|
|
929
|
+
interface ComponentSetNode extends Omit<DefaultContainerMixin, 'appendChild' | 'insertChild'>, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin {
|
|
898
930
|
readonly type: 'COMPONENT_SET'
|
|
899
|
-
readonly componentPropertyDefinitions:
|
|
931
|
+
readonly componentPropertyDefinitions: ComponentPropertyDefinitions
|
|
900
932
|
clone(): ComponentSetNode
|
|
901
933
|
createVariantComponent(): void
|
|
902
934
|
createVariantProperties(properties: Array<string>): void
|
|
@@ -906,9 +938,9 @@ declare global {
|
|
|
906
938
|
resizeToFit(): void
|
|
907
939
|
}
|
|
908
940
|
|
|
909
|
-
interface InstanceNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
|
|
941
|
+
interface InstanceNode extends Omit<DefaultContainerMixin, 'appendChild' | 'insertChild'>, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
|
|
910
942
|
readonly type: 'INSTANCE'
|
|
911
|
-
readonly variantProperties: Array<
|
|
943
|
+
readonly variantProperties: Array<VariantProperty> | undefined
|
|
912
944
|
setVariantPropertyValues(property: Record<string, string>): void
|
|
913
945
|
clone(): InstanceNode
|
|
914
946
|
/**
|
|
@@ -970,6 +1002,11 @@ declare global {
|
|
|
970
1002
|
setRangeFills(start: number, end: number, paints: Paint[]): void
|
|
971
1003
|
setRangeHyperlink(start: number, end: number, hyperlink: Hyperlink | null): void
|
|
972
1004
|
setRangeTextCase(start: number, end: number, textCase: TextCase): void
|
|
1005
|
+
|
|
1006
|
+
setRangeListStyle(start: number, end: number, type: 'ORDERED' | 'BULLETED' | 'NONE'): void
|
|
1007
|
+
|
|
1008
|
+
setRangeFillStyleId(start: number, end: number, fillStyleId: string): void
|
|
1009
|
+
setRangeTextStyleId(start: number, end: number, textStyleId: string): void
|
|
973
1010
|
}
|
|
974
1011
|
|
|
975
1012
|
|