@jlceda/pro-api-types 0.2.66 → 0.2.68

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/index.d.ts +273 -17
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -502,7 +502,7 @@ declare global {
502
502
  * @param libraryUuid - 库 UUID,可以使用 {@link LIB_LibrariesList} 内的接口获取
503
503
  * @param targetLibraryUuid - 目标库 UUID
504
504
  * @param targetClassification - 目标库内的分类
505
- * @param newSymbolName - 新符号名称,如若目标库内存在重名���号将导致复制失败
505
+ * @param newSymbolName - 新符号名称,如若目标库内存在重名符号将导致复制失败
506
506
  * @returns 目标库内新符号的 UUID
507
507
  */
508
508
  copy(symbolUuid: string, libraryUuid: string, targetLibraryUuid: string, targetClassification?: ILIB_ClassificationIndex | Array<string>, newSymbolName?: string): Promise<string | undefined>;
@@ -975,7 +975,7 @@ declare global {
975
975
  * 文档树 / 编辑器控制类
976
976
  *
977
977
  * @public
978
- * @remarks 此处编辑器控制基于��前已打开的工程设计下的图页,其它任何 `documentUuid` 都将被认为是不存在的文档页
978
+ * @remarks 此处编辑器控制基于当前已打开的工程设计下的图页,其它任何 `documentUuid` 都将被认为是不存在的文档页
979
979
  */
980
980
  class DMT_EditorControl {
981
981
  /**
@@ -1381,7 +1381,7 @@ declare global {
1381
1381
  */
1382
1382
  createPanel(): Promise<string | undefined>;
1383
1383
  /**
1384
- * 修改面板名称
1384
+ * 修改面板���称
1385
1385
  *
1386
1386
  * @public
1387
1387
  * @param panelUuid - 面板 UUID
@@ -2390,8 +2390,8 @@ declare global {
2390
2390
  * @param libraryUuid - 库 UUID,可以使用 {@link LIB_LibrariesList} 内的接口获取
2391
2391
  * @param targetLibraryUuid - 目标库 UUID
2392
2392
  * @param targetClassification - 目标库内的分类
2393
- * @param newDeviceName - 新器件名称,如若目标库内存在重名器件将��致复制失败
2394
- * @returns 目标库内新器件的 UUID
2393
+ * @param newDeviceName - 新器件名称,如若目标库内存在重名器件将导致复制失败
2394
+ * @returns ���标库内新器件的 UUID
2395
2395
  */
2396
2396
  copy(deviceUuid: string, libraryUuid: string, targetLibraryUuid: string, targetClassification?: ILIB_ClassificationIndex | Array<string>, newDeviceName?: string): Promise<string | undefined>;
2397
2397
  /**
@@ -2869,7 +2869,7 @@ declare global {
2869
2869
  */
2870
2870
  getSupportedSymbolTypes: () => Promise<Array<ELIB_SymbolType>>;
2871
2871
  /**
2872
- * 获���支持的预览类型
2872
+ * 获取支持的预览类型
2873
2873
  *
2874
2874
  * @returns 预览类型数组
2875
2875
  */
@@ -4417,7 +4417,7 @@ declare global {
4417
4417
  * 停止飞线计算功能
4418
4418
  *
4419
4419
  * @public
4420
- * @returns 操作是否成功
4420
+ * @returns 操作��否成功
4421
4421
  */
4422
4422
  stopCalculatingRatline(): Promise<boolean>;
4423
4423
  /**
@@ -5657,7 +5657,7 @@ declare global {
5657
5657
  * @beta
5658
5658
  * @remarks 可以使用 {@link SYS_FileSystem.saveFile} 接口将文件导出到本地文件系统
5659
5659
  * @param fileName - 文件名
5660
- * @param colorSilkscreen - 是否生成彩色丝印制造文件(嘉立创专用文件)
5660
+ * @param colorSilkscreen - 是否生成彩色丝印制造��件(嘉立创专用文件)
5661
5661
  * @param unit - 单位
5662
5662
  * @param digitalFormat - 数字格式
5663
5663
  * @param other - 其它
@@ -7609,7 +7609,7 @@ declare global {
7609
7609
  *
7610
7610
  * @beta
7611
7611
  * @param primitiveIds - 文本的图元 ID,可以为字符串或字符串数组,如若为数组,则返回的也是数组
7612
- * @returns 文本图元对象,`undefined` 表示获取失败
7612
+ * @returns 文本图��对象,`undefined` 表示获取失败
7613
7613
  */
7614
7614
  get(primitiveIds: string): Promise<IPCB_PrimitiveString | undefined>;
7615
7615
  /**
@@ -8789,8 +8789,8 @@ declare global {
8789
8789
  * @remarks
8790
8790
  * 仅当 `ruleType` 为 {@link EPCB_PrimitiveRegionRuleType.FOLLOW_REGION_RULE} 时有效,用于匹配区域 DRC 规则
8791
8791
  *
8792
- * 如若 `ruleType` 为 {@link EPCB_PrimitiveRegionRuleType.FOLLOW_REGION_RULE} 但 `regionName` 为空,则系统将会自动分配��称
8793
- * @param regionName - 区域名称
8792
+ * 如若 `ruleType` 为 {@link EPCB_PrimitiveRegionRuleType.FOLLOW_REGION_RULE} 但 `regionName` 为空,则系统将会自动分配名称
8793
+ * @param regionName - ��域名称
8794
8794
  * @returns 区域图元对象
8795
8795
  */
8796
8796
  setState_RegionName(regionName?: string): IPCB_PrimitiveRegion;
@@ -10455,7 +10455,7 @@ declare global {
10455
10455
  */
10456
10456
  setState_Layer(): IPCB_PrimitiveComponentPad;
10457
10457
  /**
10458
- * 设置属性状态:焊盘编号
10458
+ * 设��属性状态:焊盘编号
10459
10459
  *
10460
10460
  * @internal
10461
10461
  * @remarks 本器件焊盘图元属性不支持修改,本接口调用将不会有任何效果
@@ -13714,7 +13714,7 @@ declare global {
13714
13714
  *
13715
13715
  * @beta
13716
13716
  * @remarks 如若传入多个图元 ID,任意图元 ID 未匹配到不影响其它图元的返回,即可能返回少于传入的图元 ID 数量的图元对象
13717
- * @param primitiveIds - 属性的图元 ID,可以为字符串或字符���数组,如若为数组,则返回的也是数组
13717
+ * @param primitiveIds - 属性的图元 ID,可以为字符串或字符串数组,如若为数组,则��回的也是数组
13718
13718
  * @returns 属性图元对象,空数组表示获取失败
13719
13719
  */
13720
13720
  get(primitiveIds: Array<string>): Promise<Array<ISCH_PrimitiveAttribute>>;
@@ -14865,7 +14865,7 @@ declare global {
14865
14865
  [key: string]: string | number | boolean;
14866
14866
  } | undefined;
14867
14867
  /**
14868
- * 设置属性状态:坐标 X
14868
+ * 设置��性状态:坐标 X
14869
14869
  *
14870
14870
  * @beta
14871
14871
  * @param x - 坐标 X
@@ -15920,7 +15920,7 @@ declare global {
15920
15920
  uuid: string;
15921
15921
  } | ILIB_DeviceItem | ILIB_DeviceSearchItem): Promise<boolean>;
15922
15922
  /**
15923
- * 设置在扩展 API 中 AnalogGround 网络标识关联的器件 UUID
15923
+ * 设置在扩展 API 中 AnalogGround 网络标识关联的���件 UUID
15924
15924
  *
15925
15925
  * @beta
15926
15926
  * @param component - 关联库器件
@@ -18060,7 +18060,7 @@ declare global {
18060
18060
  }
18061
18061
  /** 单元格内容类型枚举 */
18062
18062
  enum CellContentType {
18063
- /** 纯���本 */
18063
+ /** 纯文本 */
18064
18064
  TEXT = "TEXT",
18065
18065
  /** 输入框 */
18066
18066
  INPUT = "INPUT",
@@ -19438,6 +19438,20 @@ declare global {
19438
19438
  * @returns 删除操作是否成功
19439
19439
  */
19440
19440
  deleteFileInFileSystem(uri: string, force?: boolean): Promise<boolean>;
19441
+ /**
19442
+ * 在文件系统内创建文件夹
19443
+ *
19444
+ * @beta
19445
+ * @remarks
19446
+ * 支持递归创建多层目录
19447
+ *
19448
+ * 注意 1:本接口仅客户端有效,在浏览器环境内调用将始终 `throw Error`
19449
+ *
19450
+ * 注意 2:本接口需要使用者启用扩展的外部交互权限,如若未启用将始终 `throw Error`
19451
+ * @param folderPath - 文件夹路径
19452
+ * @returns 创建操作是否成功
19453
+ */
19454
+ createDirectoryInFileSystem(folderPath: string): Promise<boolean>;
19441
19455
  /**
19442
19456
  * 获取 EDA 文档目录路径
19443
19457
  *
@@ -19536,7 +19550,7 @@ declare global {
19536
19550
  */
19537
19551
  convertAltiumDesignerLibrariesToEasyEDASingleFile(file: File | Array<File>): Promise<File | undefined>;
19538
19552
  /**
19539
- * 转换 Altium Designer 库到多个嘉立创库文件(每个器件一个文件)
19553
+ * 转换 Altium Designer 库到多个嘉立创库文件��每个器件一个文件)
19540
19554
  *
19541
19555
  * @beta
19542
19556
  * @param file - Altium Designer 库文件
@@ -19984,6 +19998,18 @@ declare global {
19984
19998
  grayscaleMask?: boolean;
19985
19999
  /** IFrame 标题 */
19986
20000
  title?: string;
20001
+ /**
20002
+ * 窗口左上点所处页面视口 SVG 坐标 X(单位:像素)
20003
+ *
20004
+ * @remarks ADD since EDA v4
20005
+ */
20006
+ x?: number;
20007
+ /**
20008
+ * 窗口左上点所处页面视口 SVG 坐标 Y(单位:像素)
20009
+ *
20010
+ * @remarks ADD since EDA v4
20011
+ */
20012
+ y?: number;
19987
20013
  }): Promise<boolean>;
19988
20014
  /**
19989
20015
  * 关闭内联框架窗口
@@ -20173,6 +20199,225 @@ declare global {
20173
20199
  }>, types?: ESYS_LogType | Array<ESYS_LogType>): Promise<Array<ISYS_LogLine>>;
20174
20200
  }
20175
20201
 
20202
+ /**
20203
+ * 离散点
20204
+ *
20205
+ * @public
20206
+ */
20207
+ interface ISYS_MathPoint {
20208
+ /** X 坐标 */
20209
+ x: number;
20210
+ /** Y 坐标 */
20211
+ y: number;
20212
+ }
20213
+ /**
20214
+ * BBox(最小外接矩形)
20215
+ *
20216
+ * @public
20217
+ */
20218
+ interface ISYS_MathBBox {
20219
+ /** 最小 X 坐标 */
20220
+ minX: number;
20221
+ /** 最小 Y 坐标 */
20222
+ minY: number;
20223
+ /** 最大 X 坐标 */
20224
+ maxX: number;
20225
+ /** 最大 Y 坐标 */
20226
+ maxY: number;
20227
+ }
20228
+ /**
20229
+ * 多边形输入类型
20230
+ *
20231
+ * @public
20232
+ * @remarks 支持以下输入格式:
20233
+ * - 离散点数组:`[{x, y}, {x, y}, ...]`
20234
+ * - 单多边形源数组:{@link TPCB_PolygonSourceArray}
20235
+ * - 单多边形对象:{@link IPCB_Polygon}
20236
+ * - 复杂多边形对象:{@link IPCB_ComplexPolygon}
20237
+ */
20238
+ type TSYS_MathPolygonInput = Array<ISYS_MathPoint> | TPCB_PolygonSourceArray | IPCB_Polygon | IPCB_ComplexPolygon;
20239
+ /**
20240
+ * 系统 / 数学计算类
20241
+ *
20242
+ * @public
20243
+ * @remarks 提供多边形几何计算方法,支持离散点坐标和 {@link TPCB_PolygonSourceArray} 多边形数据
20244
+ */
20245
+ class SYS_Math {
20246
+ /**
20247
+ * 判断点是否在多边形内部
20248
+ *
20249
+ * @public
20250
+ * @remarks 使用射线法(Ray Casting)判断点是否在多边形内部,边界上的点视为不在内部
20251
+ * @param polygon - 多边形
20252
+ * @param point - 待判断的点
20253
+ * @returns 是否在多边形内部
20254
+ */
20255
+ containsPoint(polygon: TSYS_MathPolygonInput, point: ISYS_MathPoint): boolean;
20256
+ /**
20257
+ * 计算点到多边形边界的最短距离
20258
+ *
20259
+ * @public
20260
+ * @param polygon - 多边形
20261
+ * @param point - 待计算的点
20262
+ * @returns 最短距离,如点在多边形内部则返回 `0`
20263
+ */
20264
+ distanceToPoint(polygon: TSYS_MathPolygonInput, point: ISYS_MathPoint): number;
20265
+ /**
20266
+ * 判断两个多边形是否相交
20267
+ *
20268
+ * @public
20269
+ * @remarks 判断两个多边形的区域是否有任何重叠(包括包含、部分相交、边界接触)
20270
+ * @param polygon1 - 多边形 1
20271
+ * @param polygon2 - 多边形 2
20272
+ * @returns 是否相交
20273
+ */
20274
+ intersects(polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput): boolean;
20275
+ /**
20276
+ * 判断 polygon1 是否完全包含 polygon2
20277
+ *
20278
+ * @public
20279
+ * @param polygon1 - 外部多边形
20280
+ * @param polygon2 - 内部多边形
20281
+ * @returns polygon1 是否完全包含 polygon2
20282
+ */
20283
+ contains(polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput): boolean;
20284
+ /**
20285
+ * 获取多边形的最小外接矩形(BBox)
20286
+ *
20287
+ * @public
20288
+ * @param polygon - 多边形
20289
+ * @returns BBox
20290
+ */
20291
+ getBBox(polygon: TSYS_MathPolygonInput): ISYS_MathBBox;
20292
+ /**
20293
+ * 快速判断两个 BBox 是否相交
20294
+ *
20295
+ * @public
20296
+ * @param bbox1 - BBox 1
20297
+ * @param bbox2 - BBox 2
20298
+ * @returns 是否相交
20299
+ */
20300
+ bboxIntersects(bbox1: ISYS_MathBBox, bbox2: ISYS_MathBBox): boolean;
20301
+ /**
20302
+ * 计算多边形面积
20303
+ *
20304
+ * @public
20305
+ * @remarks 使用 Shoelace 公式计算,结果为绝对值
20306
+ * @param polygon - 多边形
20307
+ * @returns 面积
20308
+ */
20309
+ calculateArea(polygon: TSYS_MathPolygonInput): number;
20310
+ /**
20311
+ * 计算多边形周长
20312
+ *
20313
+ * @public
20314
+ * @param polygon - 多边形
20315
+ * @returns 周长
20316
+ */
20317
+ calculatePerimeter(polygon: TSYS_MathPolygonInput): number;
20318
+ /**
20319
+ * 计算多边形质心
20320
+ *
20321
+ * @public
20322
+ * @param polygon - 多边形
20323
+ * @returns 质心坐标
20324
+ */
20325
+ getCentroid(polygon: TSYS_MathPolygonInput): ISYS_MathPoint;
20326
+ /**
20327
+ * 平移多边形
20328
+ *
20329
+ * @public
20330
+ * @param polygon - 多边形
20331
+ * @param dx - X 方向偏移量
20332
+ * @param dy - Y 方向偏移量
20333
+ * @returns 平移后的离散点数组
20334
+ */
20335
+ translate(polygon: TSYS_MathPolygonInput, dx: number, dy: number): Array<ISYS_MathPoint>;
20336
+ /**
20337
+ * 旋转多边形
20338
+ *
20339
+ * @public
20340
+ * @param polygon - 多边形
20341
+ * @param angle - 旋转角度(角度制,正值为逆时针)
20342
+ * @param centerX - 旋转中心 X 坐标,默认为质心
20343
+ * @param centerY - 旋转中心 Y 坐标,默认为质心
20344
+ * @returns 旋转后的离散点数组
20345
+ */
20346
+ rotate(polygon: TSYS_MathPolygonInput, angle: number, centerX?: number, centerY?: number): Array<ISYS_MathPoint>;
20347
+ /**
20348
+ * 缩放多边形
20349
+ *
20350
+ * @public
20351
+ * @param polygon - 多边形
20352
+ * @param scaleX - X 方向缩放比例
20353
+ * @param scaleY - Y 方向缩放比例,默认与 scaleX 相同
20354
+ * @param centerX - 缩放中心 X 坐标,默认为质心
20355
+ * @param centerY - 缩放中心 Y 坐标,默认为质心
20356
+ * @returns 缩放后的离散点数组
20357
+ */
20358
+ scale(polygon: TSYS_MathPolygonInput, scaleX: number, scaleY?: number, centerX?: number, centerY?: number): Array<ISYS_MathPoint>;
20359
+ /**
20360
+ * 计算两个多边形的并集
20361
+ *
20362
+ * @public
20363
+ * @param polygon1 - 多边形 1
20364
+ * @param polygon2 - 多边形 2
20365
+ * @returns 并集结果的离散点环数组,每个环为一个独立的多边形
20366
+ */
20367
+ union(polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput): Array<Array<ISYS_MathPoint>>;
20368
+ /**
20369
+ * 计算两个多边形的差集(polygon1 - polygon2)
20370
+ *
20371
+ * @public
20372
+ * @param polygon1 - 被减多边形
20373
+ * @param polygon2 - 减去的多边形
20374
+ * @returns 差集结果的离散点环数组
20375
+ */
20376
+ subtract(polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput): Array<Array<ISYS_MathPoint>>;
20377
+ /**
20378
+ * 计算两个多边形的交集
20379
+ *
20380
+ * @public
20381
+ * @param polygon1 - 多边形 1
20382
+ * @param polygon2 - 多边形 2
20383
+ * @returns 交集结果的离散点环数组,空数组表示无交集
20384
+ */
20385
+ intersection(polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput): Array<Array<ISYS_MathPoint>>;
20386
+ /**
20387
+ * 计算两个多边形的对称差集(异或)
20388
+ *
20389
+ * @public
20390
+ * @param polygon1 - 多边形 1
20391
+ * @param polygon2 - 多边形 2
20392
+ * @returns 对称差集结果的离散点环数组
20393
+ */
20394
+ xor(polygon1: TSYS_MathPolygonInput, polygon2: TSYS_MathPolygonInput): Array<Array<ISYS_MathPoint>>;
20395
+ /**
20396
+ * 将任意多边形输入归一化为离散点数组
20397
+ *
20398
+ * @internal
20399
+ * @param input - 多边形输入,支持离散点数组、{@link TPCB_PolygonSourceArray}、{@link IPCB_Polygon}、{@link IPCB_ComplexPolygon}
20400
+ * @returns 离散点数组
20401
+ */
20402
+ private normalizeToPoints;
20403
+ /**
20404
+ * 将任意多边形输入归一化为 d3-polygon 所需的坐标对数组 `[[x, y], ...]`
20405
+ *
20406
+ * @internal
20407
+ * @param input - 多边形输入
20408
+ * @returns d3-polygon 格式的坐标对数组
20409
+ */
20410
+ private normalizeToD3Polygon;
20411
+ /**
20412
+ * 将任意多边形输入归一化为 martinez 所需的多环格式 `[[[x, y], ...]]`
20413
+ *
20414
+ * @internal
20415
+ * @param input - 多边形输入
20416
+ * @returns martinez 格式的多环坐标数组
20417
+ */
20418
+ private normalizeToMartinez;
20419
+ }
20420
+
20176
20421
  /**
20177
20422
  * 左侧面板标签页
20178
20423
  *
@@ -21187,6 +21432,16 @@ declare global {
21187
21432
  * @param url - URL
21188
21433
  */
21189
21434
  urlReplaceState(url: string): void;
21435
+ /**
21436
+ * 获取页面当前视口大小
21437
+ *
21438
+ * @public
21439
+ * @returns 视口宽高(单位:像素)
21440
+ */
21441
+ getViewportSize(): {
21442
+ width: number;
21443
+ height: number;
21444
+ };
21190
21445
  }
21191
21446
 
21192
21447
  /**
@@ -21274,6 +21529,7 @@ declare global {
21274
21529
  sys_IFrame: SYS_IFrame;
21275
21530
  sys_LoadingAndProgressBar: SYS_LoadingAndProgressBar;
21276
21531
  sys_Log: SYS_Log;
21532
+ sys_Math: SYS_Math;
21277
21533
  sys_Message: SYS_Message;
21278
21534
  sys_MessageBox: SYS_MessageBox;
21279
21535
  sys_MessageBus: SYS_MessageBus;
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@jlceda/pro-api-types", "type": "module", "version": "0.2.66", "description": "嘉立创EDA & EasyEDA 专业版扩展 API 接口类型定义", "typings": "index.d.ts", "author": "JLCEDA <support@lceda.cn>", "license": "Apache-2.0", "homepage": "https://pro.lceda.cn/", "keywords": ["jlceda", "pro-api"], "scripts": { "lint": "eslint", "fix": "eslint --fix", "build": "ts-node ./build/build.ts" }, "devDependencies": { "@antfu/eslint-config": "^5.4.1", "@types/fast-text-encoding": "^1.0.3", "@types/fs-extra": "^11.0.4", "dotenv": "^16.4.7", "eslint": "^9.37.0", "fast-text-encoding": "^1.0.6", "fs-extra": "^11.3.0", "lint-staged": "^16.2.3", "simple-git-hooks": "^2.13.1", "ts-node": "^10.9.2", "typescript": "^5.7.3" }, "simple-git-hooks": { "pre-commit": "npx lint-staged" }, "lint-staged": { "*": "eslint --fix" } }
1
+ { "name": "@jlceda/pro-api-types", "type": "module", "version": "0.2.68", "description": "嘉立创EDA & EasyEDA 专业版扩展 API 接口类型定义", "typings": "index.d.ts", "author": "JLCEDA <support@lceda.cn>", "license": "Apache-2.0", "homepage": "https://pro.lceda.cn/", "keywords": ["jlceda", "pro-api"], "scripts": { "lint": "eslint", "fix": "eslint --fix", "build": "ts-node ./build/build.ts" }, "devDependencies": { "@antfu/eslint-config": "^5.4.1", "@types/fast-text-encoding": "^1.0.3", "@types/fs-extra": "^11.0.4", "dotenv": "^16.4.7", "eslint": "^9.37.0", "fast-text-encoding": "^1.0.6", "fs-extra": "^11.3.0", "lint-staged": "^16.2.3", "simple-git-hooks": "^2.13.1", "ts-node": "^10.9.2", "typescript": "^5.7.3" }, "simple-git-hooks": { "pre-commit": "npx lint-staged" }, "lint-staged": { "*": "eslint --fix" } }