@mastergo/plugin-typings 1.16.0 → 1.17.1

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 CHANGED
@@ -1,3 +1,42 @@
1
+ ## [1.17.1](https://github.com/mastergo-design/plugin-typings/compare/v1.17.0...v1.17.1) (2023-03-30)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * getSharedPluginDataKeys返回错误 ([cb9c3cd](https://github.com/mastergo-design/plugin-typings/commit/cb9c3cd15fede7584fe1b253b91fbc67bd1ed993))
7
+
8
+
9
+
10
+ # [1.17.0](https://github.com/mastergo-design/plugin-typings/compare/v1.16.1...v1.17.0) (2023-03-30)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * 完善flatten返回值类型 ([687ff5d](https://github.com/mastergo-design/plugin-typings/commit/687ff5de547be6f6ccc6d2f9b5c50dcbb1c014c0))
16
+ * 修复布尔组的childrenMixin的错误 ([25c6588](https://github.com/mastergo-design/plugin-typings/commit/25c6588c0a774733770a4eced4887a6f55024832))
17
+ * 修复instance的swapComponent和detachInstance类型错误 ([c8aa208](https://github.com/mastergo-design/plugin-typings/commit/c8aa208700fc4f5323bffc41737199360ee13f6b))
18
+ * userenderBounds注释错误 ([caae3fb](https://github.com/mastergo-design/plugin-typings/commit/caae3fbd654bfc970cedabc62bc1b548a78419f5))
19
+
20
+
21
+ ### Features
22
+
23
+ * 实例切换首选项和公开嵌套实例 ([a821c55](https://github.com/mastergo-design/plugin-typings/commit/a821c55e7388286f9673da006659e51ea052883d))
24
+ * 移除group和布尔组的约束属性 ([a636dd4](https://github.com/mastergo-design/plugin-typings/commit/a636dd4d7fc2bb9ba1dff8550e5acef9401c4605))
25
+
26
+ ## [1.16.2](https://github.com/mastergo-design/plugin-typings/compare/v1.16.1...v1.16.2) (2023-03-23)
27
+ ### Bug Fixes
28
+
29
+ * 修复instance的swapComponent和detachInstance类型错误 ([c8aa208](https://github.com/mastergo-design/plugin-typings/commit/c8aa208700fc4f5323bffc41737199360ee13f6b))
30
+
31
+ ## [1.16.1](https://github.com/mastergo-design/plugin-typings/compare/v1.16.0...v1.16.1) (2023-03-22)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * groupNode和booleanOperation移除frameContainerMixin ([de52f6c](https://github.com/mastergo-design/plugin-typings/commit/de52f6cbb991c812de6fe7579293b16e336bde20))
37
+
38
+
39
+
1
40
  # [1.16.0](https://github.com/mastergo-design/plugin-typings/compare/v1.15.1...v1.16.0) (2023-03-21)
2
41
 
3
42
 
package/dist/index.d.ts CHANGED
@@ -89,7 +89,7 @@ declare global {
89
89
  subtract(children: SceneNode[]): BooleanOperationNode
90
90
  intersect(children: SceneNode[]): BooleanOperationNode
91
91
  exclude(children: SceneNode[]): BooleanOperationNode
92
- flatten(nodes: SceneNode[]): PenNode
92
+ flatten(nodes: SceneNode[]): PenNode | null
93
93
 
94
94
  saveVersionHistoryAsync(desc: string): Promise<void>
95
95
 
@@ -167,7 +167,7 @@ declare global {
167
167
  readonly isSuffix?: boolean
168
168
  readonly fileName?: string
169
169
  readonly constraint?: ExportSettingsConstraints
170
- readonly useAbsoluteBounds?: boolean // defaults to false
170
+ readonly useAbsoluteBounds?: boolean // defaults to true
171
171
  readonly useRenderBounds?: boolean // default to true
172
172
  }
173
173
  interface ExportSettingsSVG {
@@ -180,7 +180,7 @@ declare global {
180
180
  readonly format: 'PDF'
181
181
  readonly isSuffix?: string
182
182
  readonly fileName?: string
183
- readonly useAbsoluteBounds?: boolean // defaults to false
183
+ readonly useAbsoluteBounds?: boolean // defaults to true
184
184
  readonly useRenderBounds?: boolean // default to true
185
185
  }
186
186
 
@@ -480,7 +480,7 @@ declare global {
480
480
  clearPluginData(): void
481
481
  getSharedPluginData(namespace: string, key: string): string
482
482
  setSharedPluginData(namespace: string, key: string, value: string): void
483
- getSharedPluginDataKeys(namespace: string): void
483
+ getSharedPluginDataKeys(namespace: string): string[]
484
484
  removeSharedPluginData(namespace: string, key: string): void
485
485
  clearSharedPluginData(namespace: string): void
486
486
  }
@@ -781,11 +781,6 @@ declare global {
781
781
  resizeToFit(): void
782
782
  }
783
783
 
784
- interface GroupNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin {
785
- readonly type: 'GROUP'
786
- clone(): GroupNode
787
- }
788
-
789
784
  interface RectangleNode
790
785
  extends DefaultShapeMixin,
791
786
  ConstraintMixin,
@@ -849,14 +844,22 @@ declare global {
849
844
 
850
845
  interface BooleanOperationNode
851
846
  extends DefaultShapeMixin,
852
- FrameContainerMixin,
853
- Omit<ChildrenMixin, 'appendChild' | 'insertChild'>,
847
+ ChildrenMixin,
854
848
  CornerMixin {
855
849
  readonly type: 'BOOLEAN_OPERATION'
856
850
  booleanOperation: 'UNION' | 'INTERSECT' | 'SUBTRACT' | 'EXCLUDE'
857
851
  clone(): BooleanOperationNode
858
852
  }
859
853
 
854
+
855
+ interface GroupNode
856
+ extends DefaultShapeMixin,
857
+ ChildrenMixin,
858
+ CornerMixin {
859
+ readonly type: 'GROUP'
860
+ clone(): GroupNode
861
+ }
862
+
860
863
  interface TextRangeStyle {
861
864
  fontName: FontName
862
865
  fontSize: number
@@ -966,12 +969,14 @@ declare global {
966
969
  propertyName: string,
967
970
  type: Exclude<ComponentPropertyType, 'VARIANT'>,
968
971
  defaultValue: string | boolean,
972
+ options?: ComponentPropertyOptions,
969
973
  ): string
970
974
  editComponentProperty(
971
975
  propertyId: string,
972
976
  newValue: {
973
977
  name?: string
974
978
  defaultValue?: string | boolean
979
+ preferredValues?: InstanceSwapPreferredValue[]
975
980
  },
976
981
  ): string
977
982
  deleteComponentProperty(propertyId: string): void
@@ -985,15 +990,23 @@ declare global {
985
990
  defaultValue: string | boolean
986
991
  id?: string
987
992
  variantOptions?: string[]
993
+ preferredValues?: InstanceSwapPreferredValue[]
988
994
  }
989
995
 
990
996
  type ComponentPropertyType = 'BOOLEAN' | 'TEXT' | 'INSTANCE_SWAP' | 'VARIANT'
991
-
997
+ type InstanceSwapPreferredValue = {
998
+ type: 'COMPONENT' | 'COMPONENT_SET'
999
+ key: string
1000
+ }
1001
+ type ComponentPropertyOptions = {
1002
+ preferredValues?: InstanceSwapPreferredValue[]
1003
+ }
992
1004
  type ComponentProperties = {
993
1005
  name: string
994
1006
  id?: string
995
1007
  type: ComponentPropertyType
996
1008
  value: boolean | string
1009
+ preferredValues?: InstanceSwapPreferredValue[]
997
1010
  }
998
1011
 
999
1012
  interface ComponentNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin, ComponentPropertiesMixin {
@@ -1023,17 +1036,20 @@ declare global {
1023
1036
  interface InstanceNode extends Omit<DefaultContainerMixin, 'appendChild' | 'insertChild'>, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
1024
1037
  readonly type: 'INSTANCE'
1025
1038
  readonly variantProperties: Array<VariantProperty> | undefined
1039
+
1026
1040
  setVariantPropertyValues(property: Record<string, string>): void
1027
1041
 
1028
1042
  readonly componentProperties: Array<ComponentProperties>
1029
1043
  setProperties(properties: { [propertyId: string]: string | boolean }): void
1030
-
1044
+ readonly exposedInstances: InstanceNode[]
1045
+ isExposedInstance: boolean
1046
+
1031
1047
  clone(): InstanceNode
1032
1048
  /**
1033
1049
  * this is an async func
1034
1050
  */
1035
- swapComponent(): void
1036
- detachInstance(): InstanceNode
1051
+ swapComponent(component: ComponentNode): void
1052
+ detachInstance(): FrameNode
1037
1053
  mainComponent: ComponentNode | null
1038
1054
  }
1039
1055
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastergo/plugin-typings",
3
- "version": "1.16.0",
3
+ "version": "1.17.1",
4
4
  "description": "MasterGo插件API声明文件",
5
5
  "main": "",
6
6
  "types": "dist/index.d.ts",