nhanh-pure-function 3.0.6-beta.1 → 3.0.6-beta.3

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.
@@ -14,7 +14,18 @@ type ConstructorOption = ConstructorParameters<typeof QuickMethod>[0] & {
14
14
  /** 轴线显示属性 */
15
15
  axisShow?: Parameters<_Canvas["toggleAxis"]>[0];
16
16
  };
17
- /** 你好啊你好的画布工具 */
17
+ /**
18
+ * 你好啊你好的画布工具类
19
+ * 提供图形绘制、动态渲染等画布相关功能,支持复杂场景下的可视化展示
20
+ *
21
+ * 使用示例:
22
+ * - GitHub演示:
23
+ * - 基础画布: https://adminnhanh.github.io/nhanh-frontend-view/#/canvas/_Canvas
24
+ * - 动态图表(月牙定理): https://adminnhanh.github.io/nhanh-frontend-view/#/math/DynamicDiagram/%E6%9C%88%E7%89%99%E5%AE%9A%E7%90%86
25
+ * - 阿里云演示:
26
+ * - 基础画布: https://nhanh.xin/#/canvas/_Canvas
27
+ * - 动态图表(月牙定理): https://nhanh.xin/#/math/DynamicDiagram/%E6%9C%88%E7%89%99%E5%AE%9A%E7%90%86
28
+ */
18
29
  export declare class _Canvas extends QuickMethod {
19
30
  /** 图层群组 */
20
31
  static LayerGroup: typeof LayerGroup;
@@ -5,11 +5,21 @@
5
5
  */
6
6
  export declare function _File_Read(src: string): Promise<string>;
7
7
  /**
8
- * 下载文件
9
- * @param {string} href - 文件路径
10
- * @param {string} [fileName] - 导出文件名
8
+ * 下载文件并支持进度监控、超时控制和主动中止
9
+ *
10
+ * @param {string} href - 文件的 URL 路径或下载地址,需确保跨域权限或同源
11
+ * @param {string} [fileName] - 可选,指定导出的文件名(不含扩展名时会自动从 href 提取)
12
+ * @param {Function} [onProgress] - 可选,下载进度回调函数
13
+ * @param {number} [onProgress.progress] - 进度百分比(0-100)
14
+ * @param {number} [timeout=30000] - 可选,超时时间(毫秒),默认 30 秒
15
+ * @returns {Object} 返回包含两个属性的对象:
16
+ * - promise: Promise 对象,成功时 resolve 下载的 Blob 数据,失败时 reject 错误信息
17
+ * - abort: 中止下载的函数,调用后会触发 abort 错误
11
18
  */
12
- export declare function _File_Download(href: string, fileName?: string): Promise<unknown>;
19
+ export declare function _File_Download(href: string, fileName?: string, onProgress?: (progress: number) => void, timeout?: number): {
20
+ promise: Promise<Blob>;
21
+ abort: () => false | void;
22
+ };
13
23
  /**
14
24
  * 创建文件并下载
15
25
  * @param {BlobPart[]} content 文件内容
@@ -48,3 +48,9 @@ export declare function _Math_GetMidpoint(x1: number, y1: number, x2: number, y2
48
48
  * @returns 与边界的交点坐标
49
49
  */
50
50
  export declare function _Math_GetBoundaryIntersection(startPoint: [number, number], direction: [number, number], canvasWidth: number, canvasHeight: number): [number, number];
51
+ /**
52
+ * 角度制数学工具代理
53
+ * 对于三角函数:自动将输入的角度转换为弧度
54
+ * 对于其他方法:直接调用原生Math方法
55
+ */
56
+ export declare const _Math_Degree: Math;
@@ -3,4 +3,4 @@ export interface Point {
3
3
  y: number;
4
4
  }
5
5
  /** 定义所有可能的数据类型字符串 */
6
- export type DataType = "null" | "undefined" | "boolean" | "number" | "string" | "symbol" | "bigint" | "function" | "array" | "object" | "date" | "regexp" | "map" | "set" | "error" | "promise" | "weakmap" | "weakset" | "arraybuffer" | "dataview" | "int8array" | "uint8array" | "uint8clampedarray" | "int16array" | "uint16array" | "int32array" | "uint32array" | "float32array" | "float64array" | "bigint64array" | "biguint64array";
6
+ export type DataType = "null" | "undefined" | "boolean" | "number" | "string" | "symbol" | "bigint" | "function" | "array" | "object" | "date" | "regexp" | "map" | "set" | "error" | "promise" | "weakmap" | "weakset" | "file" | "arraybuffer" | "dataview" | "int8array" | "uint8array" | "uint8clampedarray" | "int16array" | "uint16array" | "int32array" | "uint32array" | "float32array" | "float64array" | "bigint64array" | "biguint64array";