@mastergo/plugin-typings 1.12.0 → 1.13.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 CHANGED
@@ -1,3 +1,28 @@
1
+ # [1.13.0](https://github.com/mastergo-design/plugin-typings/compare/v1.12.0...v1.13.0) (2023-01-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * 修复组件图层clone方法返回值类型错误问题 ([3558202](https://github.com/mastergo-design/plugin-typings/commit/35582022c3f5d201559efbbeb1e452d5838eef15))
7
+ * 修改错误componentPropertyReferences类型 ([dcdb0b8](https://github.com/mastergo-design/plugin-typings/commit/dcdb0b8a1fc22785c8bbf9add75b1a7b46215178))
8
+
9
+
10
+ ### Features
11
+
12
+ * 补充组件属性类型 ([a58b2da](https://github.com/mastergo-design/plugin-typings/commit/a58b2da55d45c202ab4a593aa0aeb6d7e7feb844))
13
+ * 导出设置增加useRenderBounds, 增加不同类型区分导出数据 ([852044d](https://github.com/mastergo-design/plugin-typings/commit/852044dfd9047cec5f9e2414b0bf2455728b439f))
14
+ * 更改componentPropertyReferences类型 ([3e67ca1](https://github.com/mastergo-design/plugin-typings/commit/3e67ca1214cfee6838ab7188d40729d1154dbc46))
15
+ * 更换子组件props命名 ([76a1b75](https://github.com/mastergo-design/plugin-typings/commit/76a1b75469cb769fe86638f7d412442f23423849))
16
+ * 合并webp为image ([e4d1c13](https://github.com/mastergo-design/plugin-typings/commit/e4d1c133c566a2481799802cfb6991481e639cfa))
17
+ * 合并webp为image ([627bfa0](https://github.com/mastergo-design/plugin-typings/commit/627bfa04da410b661936c115b210a6431528cd77))
18
+ * 添加absoluteRenderBounds和absoluteBoundingBox接口 ([924b83a](https://github.com/mastergo-design/plugin-typings/commit/924b83a0d84896c05046bc83386570c039e502cc))
19
+ * 文字样式增加fontName ([8d72a18](https://github.com/mastergo-design/plugin-typings/commit/8d72a1849ef6666622a6efb403f4648ccaaa8c2a))
20
+ * 新增组件属性相关types ([a7f4e67](https://github.com/mastergo-design/plugin-typings/commit/a7f4e676f04f504d172402d74ccc8d5111867142))
21
+ * 修改absoluteRenderBounds和absoluteBoundingBox返回类型 ([b90dd96](https://github.com/mastergo-design/plugin-typings/commit/b90dd96c99e392ba9bbdb54260c13573dd02ba28))
22
+ * absoluteBoundingBox去除null返回值 ([7e903ef](https://github.com/mastergo-design/plugin-typings/commit/7e903ef72d059d0822ac6f1a6ad035e84392327d))
23
+
24
+
25
+
1
26
  # [1.12.0](https://github.com/mastergo-design/plugin-typings/compare/v1.11.0...v1.12.0) (2022-12-20)
2
27
 
3
28
 
package/dist/index.d.ts CHANGED
@@ -157,14 +157,31 @@ declare global {
157
157
  type: 'SCALE' | 'WIDTH' | 'HEIGHT'
158
158
  value: number
159
159
  }
160
- type ExportFileFormat = 'PNG' | 'JPG' | 'SVG' | 'PDF' | 'WEBP'
161
- type ExportSettings = {
162
- format: ExportFileFormat
163
- constraint?: ExportSettingsConstraints
164
- isSuffix?: boolean
165
- fileName?: string
166
- readonly useAbsoluteBounds?: boolean
160
+
161
+ interface ExportSettingsImage {
162
+ readonly format: 'JPG' | 'PNG' | 'WEBP'
163
+ readonly isSuffix?: boolean
164
+ readonly fileName?: string
165
+ readonly constraint?: ExportSettingsConstraints
166
+ readonly useAbsoluteBounds?: boolean // defaults to false
167
+ readonly useRenderBounds?: boolean // default to true
168
+ }
169
+ interface ExportSettingsSVG {
170
+ readonly format: 'SVG'
171
+ readonly isSuffix?: boolean
172
+ readonly fileName?: string
167
173
  }
174
+
175
+ interface ExportSettingsPDF {
176
+ readonly format: 'PDF'
177
+ readonly isSuffix?: string
178
+ readonly fileName?: string
179
+ readonly useAbsoluteBounds?: boolean // defaults to false
180
+ readonly useRenderBounds?: boolean // default to true
181
+ }
182
+
183
+ type ExportSettings = ExportSettingsImage | ExportSettingsSVG | ExportSettingsPDF
184
+
168
185
 
169
186
  interface ExportMixin {
170
187
  exportSettings: ReadonlyArray<ExportSettings>
@@ -261,6 +278,7 @@ declare global {
261
278
  letterSpacingUnit: NumValue['unit']
262
279
  textCase: TextCase
263
280
  lineHeight: LineHeight
281
+ fontName: FontName
264
282
  }
265
283
 
266
284
  interface FontAlias {
@@ -467,6 +485,11 @@ declare global {
467
485
  interface SceneNodeMixin {
468
486
  isVisible: boolean
469
487
  isLocked: boolean
488
+ componentPropertyReferences: {
489
+ isVisible?: string,
490
+ characters?: string,
491
+ mainComponent?: string
492
+ } | null
470
493
  }
471
494
 
472
495
  interface ChildrenMixin<ChildrenNode = SceneNode> {
@@ -504,6 +527,8 @@ declare global {
504
527
  interface LayoutMixin {
505
528
  absoluteTransform: Transform
506
529
  relativeTransform: Transform
530
+ readonly absoluteRenderBounds: Bound | null
531
+ readonly absoluteBoundingBox: Bound
507
532
  bound: Bound
508
533
  x: number
509
534
  y: number
@@ -668,6 +693,8 @@ declare global {
668
693
  interface OpaqueNodeMixin extends BaseNodeMixin, SceneNodeMixin, ExportMixin {
669
694
  readonly absoluteTransform: Transform
670
695
  relativeTransform: Transform
696
+ readonly absoluteRenderBounds: Bound | null
697
+ readonly absoluteBoundingBox: Bound
671
698
  x: number
672
699
  y: number
673
700
  readonly width: number
@@ -917,16 +944,6 @@ declare global {
917
944
  setRangeTextStyleId(start: number, end: number, textStyleId: string): void
918
945
  }
919
946
 
920
- interface ComponentNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin {
921
- readonly type: 'COMPONENT'
922
- readonly variantProperties: Array<VariantProperty> | undefined
923
- setVariantPropertyValues(property: Record<string, string>): void
924
- clone(): ComponentNode
925
- createInstance(): InstanceNode
926
- resizeToFit(): void
927
- }
928
-
929
-
930
947
  type VariantMixin = {
931
948
  property: string
932
949
  type: 'variant'
@@ -938,10 +955,62 @@ declare global {
938
955
  value: string
939
956
  }
940
957
 
958
+ /**
959
+ * @deprecated
960
+ *
961
+ */
941
962
  type ComponentPropertyDefinitions = Array<VariantMixin>
942
963
 
943
- interface ComponentSetNode extends Omit<DefaultContainerMixin, 'appendChild' | 'insertChild'>, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin {
964
+ interface ComponentPropertiesMixin {
965
+ readonly componentPropertyValues: ComponentPropertyValues
966
+ addComponentProperty(
967
+ propertyName: string,
968
+ type: Exclude<ComponentPropertyType, 'VARIANT'>,
969
+ defaultValue: string | boolean,
970
+ ): string
971
+ editComponentProperty(
972
+ propertyId: string,
973
+ newValue: {
974
+ name?: string
975
+ defaultValue?: string | boolean
976
+ },
977
+ ): string
978
+ deleteComponentProperty(propertyId: string): void
979
+ }
980
+
981
+ type ComponentPropertyValues = Array<ComponentPropertyValue>
982
+
983
+ type ComponentPropertyValue = {
984
+ name: string
985
+ type: ComponentPropertyType
986
+ defaultValue: string | boolean
987
+ id?: string
988
+ variantOptions?: string[]
989
+ }
990
+
991
+ type ComponentPropertyType = 'BOOLEAN' | 'TEXT' | 'INSTANCE_SWAP' | 'VARIANT'
992
+
993
+ type ComponentProperties = {
994
+ name: string
995
+ id?: string
996
+ type: ComponentPropertyType
997
+ value: boolean | string
998
+ }
999
+
1000
+ interface ComponentNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin, ComponentPropertiesMixin {
1001
+ readonly type: 'COMPONENT'
1002
+ readonly variantProperties: Array<VariantProperty> | undefined
1003
+ setVariantPropertyValues(property: Record<string, string>): void
1004
+ clone(): InstanceNode
1005
+ createInstance(): InstanceNode
1006
+ resizeToFit(): void
1007
+ }
1008
+
1009
+ interface ComponentSetNode extends Omit<DefaultContainerMixin, 'appendChild' | 'insertChild'>, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin, PublishableMixin, ComponentPropertiesMixin {
944
1010
  readonly type: 'COMPONENT_SET'
1011
+ /**
1012
+ * @deprecated
1013
+ */
945
1014
  readonly componentPropertyDefinitions: ComponentPropertyDefinitions
946
1015
  clone(): ComponentSetNode
947
1016
  createVariantComponent(): void
@@ -956,6 +1025,10 @@ declare global {
956
1025
  readonly type: 'INSTANCE'
957
1026
  readonly variantProperties: Array<VariantProperty> | undefined
958
1027
  setVariantPropertyValues(property: Record<string, string>): void
1028
+
1029
+ readonly componentProperties: Array<ComponentProperties>
1030
+ setProperties(properties: { [propertyId: string]: string | boolean }): void
1031
+
959
1032
  clone(): InstanceNode
960
1033
  /**
961
1034
  * this is an async func
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastergo/plugin-typings",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "MasterGo插件API声明文件",
5
5
  "main": "",
6
6
  "types": "dist/index.d.ts",