@mastergo/plugin-typings 2.15.1 → 2.16.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +2 -367
  2. package/package.json +18 -19
package/dist/index.d.ts CHANGED
@@ -1095,231 +1095,6 @@ declare global {
1095
1095
 
1096
1096
  type PluginEventType = keyof MGEventCallbackMap
1097
1097
 
1098
- interface VariableAPI {
1099
- // --- Collection ---
1100
- createCollection(name?: string): Promise<Collection | null>
1101
- getCollections(includeExternal?: boolean): Collection[]
1102
- getCollectionById(id?: string): Collection | null
1103
- deleteCollection(collectionId: string): void
1104
- renameCollection(collectionId: string, name: string): void
1105
- moveCollection(
1106
- collectionId: string,
1107
- options?: { afterId?: string; index?: number }
1108
- ): void
1109
-
1110
- // --- Mode ---
1111
- getModes(collectionId?: string): CollectionMode[]
1112
- getModeById(
1113
- collectionId?: string,
1114
- modeId?: string
1115
- ): CollectionMode | null
1116
- addMode(
1117
- collectionId: string,
1118
- name?: string
1119
- ): Promise<CollectionMode | null>
1120
- renameMode(collectionId: string, modeId: string, name: string): void
1121
- deleteMode(collectionId: string, modeId: string): void
1122
- setVariableMode(collectionId: string, modeId: string): void
1123
- setPageVariableMode(
1124
- collectionId: string,
1125
- modeId: string,
1126
- pageId?: string
1127
- ): void
1128
-
1129
- // --- Group ---
1130
- getGroupList(collectionId?: string): GroupNode[]
1131
- createGroup(
1132
- collectionId: string,
1133
- variableIds: string[],
1134
- groupName?: string
1135
- ): void
1136
- addVariablesToGroup(
1137
- collectionId: string,
1138
- groupPath: string,
1139
- variableIds: string[]
1140
- ): void
1141
- removeVariablesFromGroup(
1142
- collectionId: string,
1143
- groupPath: string,
1144
- variableIds: string[]
1145
- ): void
1146
- disbandGroup(
1147
- collectionId: string,
1148
- groupPath?: string,
1149
- variableIds?: string[]
1150
- ): void
1151
- renameGroup(
1152
- collectionId: string,
1153
- newName: string,
1154
- groupPath?: string,
1155
- variableIds?: string[]
1156
- ): void
1157
- deleteGroup(
1158
- collectionId: string,
1159
- groupPath?: string,
1160
- variableIds?: string[]
1161
- ): void
1162
-
1163
- // --- Variable ---
1164
- createVariable(options: {
1165
- name: string
1166
- type: VariableType
1167
- value?: any
1168
- description?: string
1169
- collectionId?: string
1170
- }): Promise<Variable | null>
1171
- getVariableById(id: string): Variable | null
1172
- getVariables(options?: {
1173
- collectionId?: string
1174
- groupPath?: string
1175
- type?: VariableType
1176
- scopeType?: string
1177
- }): Variable[]
1178
- setVariableReference(options: {
1179
- id: string
1180
- reference: string | object
1181
- modeId?: string
1182
- index?: string
1183
- textProperty?: string
1184
- strokeProperty?: string
1185
- radiusProperty?: string
1186
- paddingProperty?: string
1187
- gridProperty?: string
1188
- effectProperty?: string
1189
- }): void
1190
- unlinkVariable(options: {
1191
- id: string
1192
- modeId?: string
1193
- }): Promise<void>
1194
- renameVariable(variableId: string, name: string): void
1195
- setVariableValue(options: {
1196
- id: string
1197
- value: any
1198
- modeId: string
1199
- }): Variable | null
1200
- addVariableValue(options: {
1201
- id: string
1202
- value?: any
1203
- modeId: string
1204
- }): Variable | null
1205
- deleteVariableValue(options: {
1206
- id: string
1207
- index: string | string[]
1208
- modeId: string
1209
- }): Variable | null
1210
- deleteVariable(variableId: string): void
1211
- moveVariable(
1212
- variableId: string,
1213
- options?: { afterId?: string; index?: number }
1214
- ): Promise<void>
1215
-
1216
- // --- Variable Description / Alias ---
1217
- getVariableDescription(variableId: string): string | null
1218
- setVariableDescription(
1219
- variableId: string,
1220
- value: string
1221
- ): Promise<Variable | null>
1222
- resetVariableDescription(
1223
- variableId: string
1224
- ): Promise<Variable | null>
1225
- getVariableAlias(variableId: string): string | null
1226
- setVariableAlias(
1227
- variableId: string,
1228
- value: string
1229
- ): Promise<Variable | null>
1230
- resetVariableAlias(variableId: string): Promise<Variable | null>
1231
-
1232
- // --- Component Property Variable ---
1233
- setVariableInComponent(options: {
1234
- id: string
1235
- propertyId: string
1236
- type: 'BOOLEAN' | 'CONTENT'
1237
- }): void
1238
- unlinkVariableInComponent(options: {
1239
- propertyId: string
1240
- type: 'BOOLEAN' | 'CONTENT'
1241
- }): void
1242
- createVariableInComponent(options: {
1243
- name: string
1244
- description?: string
1245
- collectionId?: string
1246
- layerId: string
1247
- type: 'BOOLEAN' | 'CONTENT'
1248
- value?: any
1249
- }): Promise<string | null>
1250
-
1251
- // --- Layer Property Variable ---
1252
- createVariableInLayer(options: {
1253
- name: string
1254
- description?: string
1255
- collectionId?: string
1256
- layerId: string
1257
- value?: any
1258
- strokeProperty?: string
1259
- radiusProperty?: string
1260
- paddingProperty?: string
1261
- dimensionProperty?: string
1262
- baseProperty?: string
1263
- effectProperty?: string
1264
- gridProperty?: string
1265
- textProperty?: string
1266
- index?: number
1267
- }): Promise<Variable | null>
1268
- setVariableReferenceInLayer(options: {
1269
- id: string
1270
- layerId: string
1271
- strokeProperty?: string
1272
- radiusProperty?: string
1273
- paddingProperty?: string
1274
- dimensionProperty?: string
1275
- baseProperty?: string
1276
- effectProperty?: string
1277
- gridProperty?: string
1278
- textProperty?: string
1279
- index?: number
1280
- }): Promise<void>
1281
- unlinkVariableReferenceInLayer(options: {
1282
- layerId: string
1283
- strokeProperty?: string
1284
- radiusProperty?: string
1285
- paddingProperty?: string
1286
- dimensionProperty?: string
1287
- baseProperty?: string
1288
- effectProperty?: string
1289
- gridProperty?: string
1290
- textProperty?: string
1291
- index?: number
1292
- }): Promise<void>
1293
-
1294
- // --- Variable Code Syntax ---
1295
- getCodeSyntax(variableId: string): VariableCodeSyntax | null
1296
- setCodeSyntax(
1297
- variableId: string,
1298
- codeSyntax: { web?: string; android?: string; ios?: string }
1299
- ): Promise<Variable | null>
1300
- resetCodeSyntax(
1301
- variableId: string,
1302
- platform?: string
1303
- ): Promise<Variable | null>
1304
-
1305
- // --- Variable Scopes ---
1306
- getVariableScopes(variableId: string): ScopeName[]
1307
- setVariableScopes(
1308
- variableId: string,
1309
- scopes: ScopeName[]
1310
- ): Promise<Variable | null>
1311
-
1312
- // --- Variable Indexes ---
1313
- getVariableIndexes(
1314
- variableId: string,
1315
- modeId?: string
1316
- ): string[]
1317
-
1318
- // --- Font ---
1319
- getFontFamilies(): FontFamilyInfo[]
1320
- getFontWeights(fontFamily: string): FontWeightInfo[]
1321
- }
1322
-
1323
1098
  interface PluginAPI {
1324
1099
  readonly document: DocumentNode
1325
1100
 
@@ -1450,14 +1225,12 @@ declare global {
1450
1225
  * @param type NodeStyleType
1451
1226
  * @param styleName
1452
1227
  * @param description optional
1453
- * @param collectionId optional
1454
1228
  */
1455
1229
  createStyleByLayer<T extends NodeStyleType>(
1456
1230
  layerId: string,
1457
1231
  type: T,
1458
1232
  styleName: string,
1459
- description?: string,
1460
- collectionId?: string
1233
+ description?: string
1461
1234
  ): NodeStyleReturnType<T>
1462
1235
 
1463
1236
  /**
@@ -1466,13 +1239,11 @@ declare global {
1466
1239
  * @param type styleType
1467
1240
  * @param styleName
1468
1241
  * @param description optional
1469
- * @param collectionId optional
1470
1242
  */
1471
1243
  createStyle<T extends StyleType>(
1472
1244
  type: T,
1473
1245
  styleName: string,
1474
- description?: string,
1475
- collectionId?: string
1246
+ description?: string
1476
1247
  ): StyleReturnType<T>
1477
1248
  /**
1478
1249
  * 创建某一个样式的副本
@@ -1496,21 +1267,10 @@ declare global {
1496
1267
  getLocalPaddingStyles(): PaddingStyle[]
1497
1268
  getLocalSpacingStyles(): SpacingStyle[]
1498
1269
 
1499
- readonly variables: VariableAPI
1500
-
1501
1270
  listAvailableFontsAsync(): Promise<Font[]>
1502
1271
  loadFontAsync(fontName: FontName): Promise<boolean>
1503
1272
  createImage(imageData: Uint8Array, isSync?: boolean): Promise<Image>
1504
1273
  getImageByHref(href: string): Image
1505
- /**
1506
- * 导出多个图层组成的png图片, 可过滤图层id,设置导出图片的缩放倍率
1507
- */
1508
- exportPng(params: GlobalExportPngSetting): string;
1509
- /**
1510
- * 导出多个图层组成的svg图片
1511
- * @param layerIds 图层id数组
1512
- */
1513
- exportSvgByLayerIds(layerIds: string[]): string
1514
1274
 
1515
1275
  getTeamLibraryAsync(): Promise<TeamLibrary>
1516
1276
  importComponentByKeyAsync(ukey: string): Promise<ComponentNode>
@@ -1537,12 +1297,6 @@ declare global {
1537
1297
  ) => void
1538
1298
  }
1539
1299
 
1540
- interface GlobalExportPngSetting {
1541
- ids?: string[];
1542
- filterIds?: string[];
1543
- scale?: number;
1544
- }
1545
-
1546
1300
  interface User {
1547
1301
  id: string | null
1548
1302
  name: string | 'Anonymous'
@@ -1632,7 +1386,6 @@ declare global {
1632
1386
  exportSettings: ReadonlyArray<ExportSettings>
1633
1387
  export(settings?: ExportSettings): Uint8Array | string // Defaults to PNG format
1634
1388
  exportAsync(settings?: ExportSettings): Promise<Uint8Array | string>
1635
- exportPng(settings?: Omit<GlobalExportPngSetting, 'ids'>): string
1636
1389
  }
1637
1390
 
1638
1391
  interface NotifyOptions {
@@ -1731,10 +1484,6 @@ declare global {
1731
1484
  | 'CORNER_RADIUS'
1732
1485
  | 'PADDING'
1733
1486
  | 'SPACING'
1734
- | 'NUMBER'
1735
- | 'STRING'
1736
- | 'BOOLEAN'
1737
- | 'COLOR'
1738
1487
  type NodeStyleType =
1739
1488
  | 'fill'
1740
1489
  | 'strokeFill'
@@ -1742,106 +1491,6 @@ declare global {
1742
1491
  | 'cornerRadius'
1743
1492
  | 'padding'
1744
1493
  | 'spacing'
1745
- | 'effect'
1746
- | 'text'
1747
- | 'grid'
1748
-
1749
- // #region Variable / Collection / Mode / Group types
1750
-
1751
- type VariableType =
1752
- | 'STRING'
1753
- | 'BOOLEAN'
1754
- | 'COLOR'
1755
- | 'NUMBER'
1756
- | 'PAINT'
1757
- | 'TEXT'
1758
- | 'EFFECT'
1759
- | 'GRID'
1760
- | 'STROKE_WIDTH'
1761
- | 'CORNER_RADIUS'
1762
- | 'PADDING'
1763
- | 'SPACING'
1764
-
1765
- type ScopeName =
1766
- | 'all'
1767
- | 'fill'
1768
- | 'fillAll'
1769
- | 'shapeFill'
1770
- | 'textFill'
1771
- | 'stroke'
1772
- | 'effect'
1773
- | 'grid'
1774
- | 'widthHeight'
1775
- | 'cornerRadius'
1776
- | 'opacity'
1777
- | 'layoutSpacing'
1778
- | 'layoutPadding'
1779
- | 'fontSize'
1780
- | 'fontWeight'
1781
- | 'textLineHeight'
1782
- | 'textLetterSpacing'
1783
- | 'textParagraphSpacing'
1784
- | 'fontFamily'
1785
- | 'textContent'
1786
-
1787
- interface VariableCodeSyntax {
1788
- readonly web?: string
1789
- readonly android?: string
1790
- readonly ios?: string
1791
- }
1792
-
1793
- interface Variable {
1794
- readonly id: string
1795
- readonly name: string
1796
- readonly description: string
1797
- readonly alias: string
1798
- readonly type: VariableType
1799
- readonly collectionId: string
1800
- readonly isExternal: boolean
1801
- readonly supportScope: boolean
1802
- readonly codeSyntax?: VariableCodeSyntax
1803
- readonly scopes?: ReadonlyArray<ScopeName>
1804
- readonly modes: Record<string, ReadonlyArray<any>>
1805
- }
1806
-
1807
- interface Collection {
1808
- readonly id: string
1809
- readonly name: string
1810
- readonly isExternal: boolean
1811
- readonly modes: ReadonlyArray<CollectionMode>
1812
- }
1813
-
1814
- interface CollectionMode {
1815
- readonly id: string
1816
- readonly name: string
1817
- readonly collectionId: string
1818
- }
1819
-
1820
- interface GroupNode {
1821
- readonly id: string
1822
- readonly name: string
1823
- readonly currentPath?: string
1824
- readonly level: number
1825
- readonly isLeaf: boolean
1826
- readonly children?: ReadonlyArray<GroupNode>
1827
- }
1828
-
1829
- interface FontFamilyInfo {
1830
- readonly family: string
1831
- readonly label: string
1832
- readonly lang: string
1833
- readonly isVariable: boolean
1834
- }
1835
-
1836
- interface FontWeightInfo {
1837
- readonly postscriptName: string
1838
- readonly label: string
1839
- readonly style: string
1840
- readonly weight: number
1841
- readonly slant: number
1842
- }
1843
-
1844
- // #endregion
1845
1494
 
1846
1495
  interface BaseStyle extends Omit<PublishableMixin, 'documentationLinks'> {
1847
1496
  readonly id: string
@@ -1942,7 +1591,6 @@ declare global {
1942
1591
  | CornerRadiusStyle
1943
1592
  | PaddingStyle
1944
1593
  | SpacingStyle
1945
- | Variable
1946
1594
 
1947
1595
  /// /////////////////////////////////////////////////////////////////////////////
1948
1596
  // Datatypes
@@ -2956,7 +2604,6 @@ declare global {
2956
2604
  */
2957
2605
  id: string
2958
2606
  description?: string
2959
- collectionId?: string
2960
2607
  }
2961
2608
 
2962
2609
  interface FlowStartingPoint {
@@ -3100,10 +2747,6 @@ declare global {
3100
2747
  cornerRadiuses: ReadonlyArray<TeamLibraryStyle>
3101
2748
  paddings: ReadonlyArray<TeamLibraryStyle>
3102
2749
  spacings: ReadonlyArray<TeamLibraryStyle>
3103
- numbers: ReadonlyArray<TeamLibraryStyle>
3104
- strings: ReadonlyArray<TeamLibraryStyle>
3105
- bools: ReadonlyArray<TeamLibraryStyle>
3106
- colors: ReadonlyArray<TeamLibraryStyle>
3107
2750
  }
3108
2751
  }>
3109
2752
 
@@ -3296,8 +2939,6 @@ declare global {
3296
2939
  ? PaddingStyle
3297
2940
  : T extends 'SPACING'
3298
2941
  ? SpacingStyle
3299
- : T extends 'NUMBER' | 'STRING' | 'BOOLEAN' | 'COLOR'
3300
- ? Variable
3301
2942
  : never
3302
2943
 
3303
2944
  type NodeStyleReturnType<T extends NodeStyleType> = T extends 'fill'
@@ -3312,11 +2953,5 @@ declare global {
3312
2953
  ? PaddingStyle
3313
2954
  : T extends 'spacing'
3314
2955
  ? SpacingStyle
3315
- : T extends 'effect'
3316
- ? EffectStyle
3317
- : T extends 'text'
3318
- ? TextStyle
3319
- : T extends 'grid'
3320
- ? GridStyle
3321
2956
  : never
3322
2957
  }
package/package.json CHANGED
@@ -1,15 +1,14 @@
1
1
  {
2
2
  "name": "@mastergo/plugin-typings",
3
- "version": "2.15.1",
3
+ "version": "2.16.0",
4
4
  "description": "MasterGo插件API声明文件",
5
- "type": "module",
6
5
  "main": "",
7
6
  "types": "dist/index.d.ts",
8
7
  "scripts": {
9
8
  "prepare": "husky install",
10
9
  "dev": "rollup -c --environment NODE_ENV=development",
11
10
  "build": "rollup -c --environment NODE_ENV=production",
12
- "release": "node scripts/release.cjs",
11
+ "release": "node scripts/release.js",
13
12
  "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
14
13
  "commit": "git-cz"
15
14
  },
@@ -27,34 +26,35 @@
27
26
  "license": "MIT",
28
27
  "repository": {
29
28
  "type": "git",
30
- "url": "git+https://github.com/mastergo-design/plugin-typings.git"
29
+ "url": "https://github.com/mastergo-design/plugin-typings"
31
30
  },
32
31
  "directories": {
33
32
  "lib": "lib"
34
33
  },
35
34
  "devDependencies": {
36
- "@commitlint/cli": "^17.0.0",
37
- "@commitlint/config-conventional": "^17.0.0",
38
- "@rollup/plugin-commonjs": "^29.0.2",
39
- "@rollup/plugin-json": "^6.1.0",
40
- "@rollup/plugin-node-resolve": "^15.2.0",
35
+ "@rollup/plugin-commonjs": "^20.0.0",
36
+ "@rollup/plugin-json": "^4.1.0",
37
+ "@rollup/plugin-node-resolve": "^13.0.4",
41
38
  "chalk": "^4.1.2",
42
- "commitizen": "^4.2.4",
43
- "conventional-changelog-cli": "^3.0.0",
44
- "csstype": "^3.1.3",
45
- "cz-conventional-changelog": "^3.3.0",
39
+ "conventional-changelog-cli": "^2.1.1",
46
40
  "execa": "^5.1.1",
47
41
  "husky": "^7.0.2",
48
42
  "inquirer": "^8.0.0",
49
43
  "inquirer-autocomplete-prompt": "^2.0.0",
50
44
  "lint-staged": "^11.1.2",
51
45
  "prettier": "^2.4.1",
52
- "rollup": "^4.59.0",
53
- "rollup-plugin-dts": "^6.4.0",
54
- "rollup-plugin-typescript2": "^0.36.0",
46
+ "rollup": "^2.56.3",
47
+ "rollup-plugin-dts": "^4.0.0",
48
+ "rollup-plugin-polyfill-node": "^0.7.0",
49
+ "rollup-plugin-typescript2": "^0.30.0",
55
50
  "semver": "^7.3.5",
56
51
  "shelljs": "^0.8.5",
57
- "typescript": "^5.9.3"
52
+ "typescript": "^4.4.3",
53
+ "@commitlint/cli": "^17.0.0",
54
+ "@commitlint/config-conventional": "^17.0.0",
55
+ "commitizen": "^4.2.4",
56
+ "cz-conventional-changelog": "^3.3.0",
57
+ "csstype": "^3.1.3"
58
58
  },
59
59
  "lint-staged": {
60
60
  "*.js": [
@@ -68,6 +68,5 @@
68
68
  "commitizen": {
69
69
  "path": "cz-conventional-changelog"
70
70
  }
71
- },
72
- "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
71
+ }
73
72
  }