@mastergo/plugin-typings 1.2.0 → 1.3.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,39 @@
1
+ ## [1.3.1](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.35.0...v1.3.1) (2022-10-08)
2
+
3
+
4
+ ### Features
5
+
6
+ * 调试流水线 ([bd41734](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/bd4173429650c2e525f5160392aed7760c0e86f4))
7
+ * 调整changelog ([8af8768](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/8af876856e6ec1729c70cf84180ad7afd6504340))
8
+ * 放开publish ([34efcd8](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/34efcd8db8e8d842ebf73c591716b015497c1d0c))
9
+ * 连接线增加bound ([034c933](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/034c933eb4a9fe36daed102051e44de9cd171797))
10
+ * 配置流水线yml和打包脚本 ([a8b8690](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/a8b8690d3fe9e2b2b3a88fd756c877bf89573647))
11
+ * 删除密码 ([39ca320](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/39ca320f21a06b17c4b8c241e8d64bfed61999bf))
12
+ * 限定master ([954c82f](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/954c82feb286d5da749b8b4e5516fd939c39978f))
13
+ * 修复loadFontAsync的返回类型错误问题 ([6cf2e61](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/6cf2e61ed46cfe49a9cc6e0e305f74c8cd7fc7e7))
14
+ * 移除test ([8c809e5](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/8c809e503f4d586cb15326ed5f7fd968cb0307f9))
15
+ * 增加锁定比例字段 ([722beee](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/722beee358cc912dbee60317986e6dbf49fd042c))
16
+ * 增加自动布局相关定义 ([03395ba](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/03395bad21c96da46632fdc213f1163e7d4d6181))
17
+ * 增加ignore ([5ae6f1a](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/5ae6f1a0dbd60e6af08ec03d34541ca007175ca0))
18
+ * 指定node版本 ([2ef59c2](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/2ef59c2b41fc26079c5a02e5c8f0a15c6f6a3549))
19
+ * 指定node版本 ([07d627d](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/07d627d578f1318083554467b44037cf806e99cf))
20
+ * 指定node版本 ([fb84aba](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/fb84aba7a0e0f2a824530ef2394449059226b37f))
21
+ * 指定node版本 ([e779846](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/e779846c00b6b903e6a0264114048590e4ed9684))
22
+ * 指定node版本 ([fd20e10](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/fd20e10535ad2efc4b79916babf6ecc9ac3c982f))
23
+ * yml升级 ([5823c94](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/5823c944d67afa2fa8d27c0333c47c4d53b3792b))
24
+
25
+
26
+
27
+ # [1.3.0](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.35.0...v1.3.0) (2022-09-30)
28
+
29
+
30
+ ### Features
31
+
32
+ * 连接线增加bound ([034c933](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/034c933eb4a9fe36daed102051e44de9cd171797))
33
+ * 修复loadFontAsync的返回类型错误问题 ([6cf2e61](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/6cf2e61ed46cfe49a9cc6e0e305f74c8cd7fc7e7))
34
+ * 增加锁定比例字段 ([722beee](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/722beee358cc912dbee60317986e6dbf49fd042c))
35
+ * 增加自动布局相关定义 ([03395ba](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/commit/03395bad21c96da46632fdc213f1163e7d4d6181))
36
+
1
37
  # [1.2.0](https://gitlab.lanhuapp.com/master/frontend/master-plugin-utils/compare/v0.35.0...v1.2.0) (2022-09-25)
2
38
 
3
39
 
package/dist/index.d.ts CHANGED
@@ -25,10 +25,34 @@ 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
+
28
37
  interface Superlink {
29
38
  start: number
30
39
  end: number
31
- superlink: string
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
32
56
  }
33
57
 
34
58
  type PluginEventType = 'selectionchange' | 'currentpagechange' | 'close' | 'themechange'
@@ -103,7 +127,7 @@ declare global {
103
127
  getLocalGridStyles(): GridStyle[]
104
128
 
105
129
  listAvailableFontsAsync(): Promise<Font[]>
106
- loadFontAsync(fontName: FontName): Promise<void>
130
+ loadFontAsync(fontName: FontName): Promise<boolean>
107
131
  createImage(imageData: Uint8Array): Promise<Image>
108
132
  getImageByHref(href: string): Image
109
133
 
@@ -313,6 +337,10 @@ declare global {
313
337
  readonly color: RGBA
314
338
 
315
339
  readonly isVisible?: boolean
340
+ /**
341
+ * It always be 1 when type is 'SOLID', please modify the alpha field in color instead.
342
+ * 纯色模式下alpha始终为1, 请设置color中的alpha.
343
+ */
316
344
  readonly alpha?: number
317
345
  readonly blendMode?: BlendMode
318
346
  }
@@ -463,6 +491,8 @@ declare global {
463
491
  width: number
464
492
  height: number
465
493
  rotation: number // In degrees
494
+ constrainProportions: boolean
495
+ layoutPositioning: 'AUTO' | 'ABSOLUTE' // applicable only inside auto-layout frames
466
496
  alignSelf: 'STRETCH' | 'INHERIT' // applicable only inside auto-layout frames
467
497
  flexGrow: 0 | 1 // applicable only inside auto-layout frames
468
498
  }
@@ -557,6 +587,8 @@ declare global {
557
587
  crossAxisAlignItems: 'FLEX_START' | 'FLEX_END' | 'CENTER'
558
588
  mainAxisSizingMode: 'FIXED' | 'AUTO'
559
589
  crossAxisSizingMode: 'FIXED' | 'AUTO'
590
+ strokesIncludedInLayout: boolean
591
+ itemReverseZIndex: boolean
560
592
  paddingTop: number
561
593
  paddingRight: number
562
594
  paddingBottom: number
@@ -619,6 +651,7 @@ declare global {
619
651
  y: number
620
652
  readonly width: number
621
653
  readonly height: number
654
+ readonly bound: Bound
622
655
  }
623
656
 
624
657
  interface MinimalBlendMixin {
@@ -682,17 +715,6 @@ declare global {
682
715
  clone(): FrameNode
683
716
  }
684
717
 
685
- interface ComponentSetNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
686
- readonly type: 'COMPONENT_SET'
687
- readonly componentPropertyDefinitions: Array<Record<string, Array<string> | string>>
688
- clone(): ComponentSetNode
689
- createVariantComponent(): void
690
- createVariantProperties(properties: Array<string>): void
691
- editVariantProperties(properties: Record<string, string>): void
692
- editVariantPropertyValues(properties: Record<string, { oldValue: string, newValue: string }>): void
693
- deleteVariantProperty(property: string): void
694
- }
695
-
696
718
  interface GroupNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin {
697
719
  readonly type: 'GROUP'
698
720
  clone(): GroupNode
@@ -786,7 +808,12 @@ declare global {
786
808
  readonly type: 'TEXT'
787
809
  characters: string
788
810
  readonly hasMissingFont: boolean
811
+ /**
812
+ * @deprecated
813
+ * This attribute is deprecared, please use hyperlinks instead.
814
+ */
789
815
  readonly superlinks: Array<Superlink>
816
+ readonly hyperlinks: Array<HyperlinkWithRange>
790
817
  textAlignHorizontal: 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFIED'
791
818
  textAlignVertical: 'TOP' | 'CENTER' | 'BOTTOM'
792
819
  textAutoResize: 'NONE' | 'WIDTH_AND_HEIGHT' | 'HEIGHT'
@@ -811,7 +838,12 @@ declare global {
811
838
  ): void
812
839
  setRangeLineHeight(start: number, end: number, value: LineHeight): void
813
840
  setRangeFills(start: number, end: number, paints: Paint[]): void
841
+ /**
842
+ * @deprecated
843
+ * This function is deprecared, please use setRangeHyperLink instead.
844
+ */
814
845
  setRangeSuperLink(start: number, end: number, link: string | null): void
846
+ setRangeHyperLink(start: number, end: number, hyperlink: Hyperlink | null): void
815
847
  setRangeTextCase(start: number, end: number, textCase: TextCase): void
816
848
  }
817
849
 
@@ -824,6 +856,17 @@ declare global {
824
856
  createInstance(): InstanceNode
825
857
  }
826
858
 
859
+ interface ComponentSetNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
860
+ readonly type: 'COMPONENT_SET'
861
+ readonly componentPropertyDefinitions: Array<Record<string, Array<string> | string>>
862
+ clone(): ComponentSetNode
863
+ createVariantComponent(): void
864
+ createVariantProperties(properties: Array<string>): void
865
+ editVariantProperties(properties: Record<string, string>): void
866
+ editVariantPropertyValues(properties: Record<string, { oldValue: string, newValue: string }>): void
867
+ deleteVariantProperty(property: string): void
868
+ }
869
+
827
870
  interface InstanceNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
828
871
  readonly type: 'INSTANCE'
829
872
  readonly variantProperties: Array<Record<string, string>>
@@ -862,6 +905,7 @@ declare global {
862
905
  readonly textAlignHorizontal: 'CENTER'
863
906
  readonly textAlignVertical: 'CENTER'
864
907
  readonly textAutoResize: 'WIDTH_AND_HEIGHT'
908
+ readonly hyperlinks: Array<HyperlinkWithRange>
865
909
 
866
910
  readonly textStyles: ReadonlyArray<TextSegStyle>
867
911
 
@@ -885,6 +929,7 @@ declare global {
885
929
  ): void
886
930
  setRangeLineHeight(start: number, end: number, value: LineHeight): void
887
931
  setRangeFills(start: number, end: number, paints: Paint[]): void
932
+ setRangeHyperLink(start: number, end: number, hyperlink: Hyperlink | null): void
888
933
  setRangeTextCase(start: number, end: number, textCase: TextCase): void
889
934
  }
890
935
 
@@ -1034,10 +1079,34 @@ declare global {
1034
1079
  getBytesAsync(): Promise<Uint8Array>
1035
1080
  }
1036
1081
 
1082
+ enum LinkFlagEnum {
1083
+ CURRPAGE = 'currPage',
1084
+ OTHERPAGE = 'otherPage',
1085
+ PROTOTYPE = 'prototype',
1086
+ OUTFILE = 'outFile',
1087
+ OWNWEBSITE = 'ownWebsite',
1088
+ OTHERLINK = 'otherLink',
1089
+ }
1090
+
1037
1091
  interface Superlink {
1038
1092
  start: number
1039
1093
  end: number
1040
- superlink: string
1094
+ superlink: {
1095
+ layerId?: string
1096
+ link: string
1097
+ linkFlag: LinkFlagEnum
1098
+ pageId: string
1099
+ }
1100
+ }
1101
+
1102
+ interface Hyperlink {
1103
+ type: 'PAGE' | 'NODE' | 'URL',
1104
+ value: string
1105
+ }
1106
+ interface HyperlinkWithRange {
1107
+ start: number
1108
+ end: number
1109
+ hyperlink: Hyperlink
1041
1110
  }
1042
1111
 
1043
1112
  type PluginEventType = 'selectionchange' | 'currentpagechange' | 'close' | 'themechange'
@@ -1112,7 +1181,7 @@ declare global {
1112
1181
  getLocalGridStyles(): GridStyle[]
1113
1182
 
1114
1183
  listAvailableFontsAsync(): Promise<Font[]>
1115
- loadFontAsync(fontName: FontName): Promise<void>
1184
+ loadFontAsync(fontName: FontName): Promise<boolean>
1116
1185
  createImage(imageData: Uint8Array): Promise<Image>
1117
1186
  getImageByHref(href: string): Image
1118
1187
 
@@ -1322,6 +1391,10 @@ declare global {
1322
1391
  readonly color: RGBA
1323
1392
 
1324
1393
  readonly isVisible?: boolean
1394
+ /**
1395
+ * It always be 1 when type is 'SOLID', please modify the alpha field in color instead.
1396
+ * 纯色模式下alpha始终为1, 请设置color中的alpha.
1397
+ */
1325
1398
  readonly alpha?: number
1326
1399
  readonly blendMode?: BlendMode
1327
1400
  }
@@ -1472,6 +1545,8 @@ declare global {
1472
1545
  width: number
1473
1546
  height: number
1474
1547
  rotation: number // In degrees
1548
+ constrainProportions: boolean
1549
+ layoutPositioning: 'AUTO' | 'ABSOLUTE' // applicable only inside auto-layout frames
1475
1550
  alignSelf: 'STRETCH' | 'INHERIT' // applicable only inside auto-layout frames
1476
1551
  flexGrow: 0 | 1 // applicable only inside auto-layout frames
1477
1552
  }
@@ -1566,6 +1641,8 @@ declare global {
1566
1641
  crossAxisAlignItems: 'FLEX_START' | 'FLEX_END' | 'CENTER'
1567
1642
  mainAxisSizingMode: 'FIXED' | 'AUTO'
1568
1643
  crossAxisSizingMode: 'FIXED' | 'AUTO'
1644
+ strokesIncludedInLayout: boolean
1645
+ itemReverseZIndex: boolean
1569
1646
  paddingTop: number
1570
1647
  paddingRight: number
1571
1648
  paddingBottom: number
@@ -1628,6 +1705,7 @@ declare global {
1628
1705
  y: number
1629
1706
  readonly width: number
1630
1707
  readonly height: number
1708
+ readonly bound: Bound
1631
1709
  }
1632
1710
 
1633
1711
  interface MinimalBlendMixin {
@@ -1691,17 +1769,6 @@ declare global {
1691
1769
  clone(): FrameNode
1692
1770
  }
1693
1771
 
1694
- interface ComponentSetNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
1695
- readonly type: 'COMPONENT_SET'
1696
- readonly componentPropertyDefinitions: Array<Record<string, Array<string> | string>>
1697
- clone(): ComponentSetNode
1698
- createVariantComponent(): void
1699
- createVariantProperties(properties: Array<string>): void
1700
- editVariantProperties(properties: Record<string, string>): void
1701
- editVariantPropertyValues(properties: Record<string, { oldValue: string, newValue: string }>): void
1702
- deleteVariantProperty(property: string): void
1703
- }
1704
-
1705
1772
  interface GroupNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin {
1706
1773
  readonly type: 'GROUP'
1707
1774
  clone(): GroupNode
@@ -1795,7 +1862,12 @@ declare global {
1795
1862
  readonly type: 'TEXT'
1796
1863
  characters: string
1797
1864
  readonly hasMissingFont: boolean
1865
+ /**
1866
+ * @deprecated
1867
+ * This attribute is deprecared, please use hyperlinks instead.
1868
+ */
1798
1869
  readonly superlinks: Array<Superlink>
1870
+ readonly hyperlinks: Array<HyperlinkWithRange>
1799
1871
  textAlignHorizontal: 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFIED'
1800
1872
  textAlignVertical: 'TOP' | 'CENTER' | 'BOTTOM'
1801
1873
  textAutoResize: 'NONE' | 'WIDTH_AND_HEIGHT' | 'HEIGHT'
@@ -1820,7 +1892,12 @@ declare global {
1820
1892
  ): void
1821
1893
  setRangeLineHeight(start: number, end: number, value: LineHeight): void
1822
1894
  setRangeFills(start: number, end: number, paints: Paint[]): void
1895
+ /**
1896
+ * @deprecated
1897
+ * This function is deprecared, please use setRangeHyperLink instead.
1898
+ */
1823
1899
  setRangeSuperLink(start: number, end: number, link: string | null): void
1900
+ setRangeHyperLink(start: number, end: number, hyperlink: Hyperlink | null): void
1824
1901
  setRangeTextCase(start: number, end: number, textCase: TextCase): void
1825
1902
  }
1826
1903
 
@@ -1833,6 +1910,17 @@ declare global {
1833
1910
  createInstance(): InstanceNode
1834
1911
  }
1835
1912
 
1913
+ interface ComponentSetNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
1914
+ readonly type: 'COMPONENT_SET'
1915
+ readonly componentPropertyDefinitions: Array<Record<string, Array<string> | string>>
1916
+ clone(): ComponentSetNode
1917
+ createVariantComponent(): void
1918
+ createVariantProperties(properties: Array<string>): void
1919
+ editVariantProperties(properties: Record<string, string>): void
1920
+ editVariantPropertyValues(properties: Record<string, { oldValue: string, newValue: string }>): void
1921
+ deleteVariantProperty(property: string): void
1922
+ }
1923
+
1836
1924
  interface InstanceNode extends DefaultContainerMixin, GeometryMixin, FrameContainerMixin, RectangleStrokeWeightMixin {
1837
1925
  readonly type: 'INSTANCE'
1838
1926
  readonly variantProperties: Array<Record<string, string>>
@@ -1871,6 +1959,7 @@ declare global {
1871
1959
  readonly textAlignHorizontal: 'CENTER'
1872
1960
  readonly textAlignVertical: 'CENTER'
1873
1961
  readonly textAutoResize: 'WIDTH_AND_HEIGHT'
1962
+ readonly hyperlinks: Array<HyperlinkWithRange>
1874
1963
 
1875
1964
  readonly textStyles: ReadonlyArray<TextSegStyle>
1876
1965
 
@@ -1894,6 +1983,7 @@ declare global {
1894
1983
  ): void
1895
1984
  setRangeLineHeight(start: number, end: number, value: LineHeight): void
1896
1985
  setRangeFills(start: number, end: number, paints: Paint[]): void
1986
+ setRangeHyperLink(start: number, end: number, hyperlink: Hyperlink | null): void
1897
1987
  setRangeTextCase(start: number, end: number, textCase: TextCase): void
1898
1988
  }
1899
1989
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastergo/plugin-typings",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "MasterGo插件API声明文件",
5
5
  "main": "",
6
6
  "types": "dist/index.d.ts",
@@ -10,6 +10,7 @@
10
10
  "build": "node scripts/build.js",
11
11
  "postbuild": "node scripts/concat-typings.js",
12
12
  "release": "node scripts/release.js",
13
+ "publish-to-npm": "node scripts/publish.js",
13
14
  "verify-commit": "node scripts/verify-commit.js",
14
15
  "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
15
16
  },
@@ -33,9 +34,10 @@
33
34
  "@rollup/plugin-node-resolve": "^13.0.4",
34
35
  "chalk": "^4.1.2",
35
36
  "conventional-changelog-cli": "^2.1.1",
36
- "enquirer": "^2.3.6",
37
37
  "execa": "^5.1.1",
38
38
  "husky": "^7.0.2",
39
+ "inquirer": "^8.0.0",
40
+ "inquirer-autocomplete-prompt": "^2.0.0",
39
41
  "lint-staged": "^11.1.2",
40
42
  "prettier": "^2.4.1",
41
43
  "rollup": "^2.56.3",
@@ -43,6 +45,7 @@
43
45
  "rollup-plugin-polyfill-node": "^0.7.0",
44
46
  "rollup-plugin-typescript2": "^0.30.0",
45
47
  "semver": "^7.3.5",
48
+ "shelljs": "^0.8.5",
46
49
  "typescript": "^4.4.3"
47
50
  },
48
51
  "lint-staged": {