nhanh-pure-function 3.0.5 → 3.0.6-beta.2

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 ADMINnhanh
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ADMINnhanh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
- # nhanh-pure-function
2
-
3
- 纯函数工具库,提供了一些常用的纯函数工具,帮助您在 JavaScript/TypeScript 项目中更高效地处理数据。
4
-
5
- ## 安装
6
-
7
- 您可以通过 npm 安装该库:
8
-
9
- ```bash
10
- npm install nhanh-pure-function
11
- ```
12
-
13
- ## 功能介绍
14
-
15
- `nhanh-pure-function` 库旨在提供一系列纯函数,这些函数在处理数据时不会产生副作用,确保函数的输入和输出之间的映射关系是确定的。这使得代码更易于测试、维护和复用。
16
-
17
- ## 许可证
18
-
1
+ # nhanh-pure-function
2
+
3
+ 纯函数工具库,提供了一些常用的纯函数工具,帮助您在 JavaScript/TypeScript 项目中更高效地处理数据。
4
+
5
+ ## 安装
6
+
7
+ 您可以通过 npm 安装该库:
8
+
9
+ ```bash
10
+ npm install nhanh-pure-function
11
+ ```
12
+
13
+ ## 功能介绍
14
+
15
+ `nhanh-pure-function` 库旨在提供一系列纯函数,这些函数在处理数据时不会产生副作用,确保函数的输入和输出之间的映射关系是确定的。这使得代码更易于测试、维护和复用。
16
+
17
+ ## 许可证
18
+
19
19
  [MIT](https://opensource.org/licenses/MIT)
package/package.json CHANGED
@@ -1,45 +1,46 @@
1
- {
2
- "name": "nhanh-pure-function",
3
- "version": "3.0.5",
4
- "description": "纯函数工具",
5
- "main": "./dist/index.cjs.js",
6
- "module": "./dist/index.es.js",
7
- "types": "./dist/index.d.ts",
8
- "files": [
9
- "dist"
10
- ],
11
- "scripts": {
12
- "build": "vite build",
13
- "test": "jest --coverage"
14
- },
15
- "devDependencies": {
16
- "@babel/core": "^7.26.9",
17
- "@babel/preset-env": "^7.26.9",
18
- "@types/jest": "^29.5.14",
19
- "babel-jest": "^29.7.0",
20
- "jest": "^29.7.0",
21
- "jest-environment-jsdom": "^29.7.0",
22
- "less": "^4.2.2",
23
- "ts-jest": "^29.2.5",
24
- "ts-node": "^10.9.2",
25
- "typescript": "^5.7.3",
26
- "vite": "^6.1.0",
27
- "vite-plugin-css-injected-by-js": "^3.5.2",
28
- "vite-plugin-dts": "^4.5.0",
29
- "vite-tsconfig-paths": "^5.1.4"
30
- },
31
- "keywords": [
32
- "pure-function",
33
- "format"
34
- ],
35
- "author": "nhanh",
36
- "license": "MIT",
37
- "repository": {
38
- "type": "git",
39
- "url": "git+https://github.com/ADMINnhanh/nhanh-pure-function.git"
40
- },
41
- "bugs": {
42
- "url": "https://github.com/ADMINnhanh/nhanh-pure-function/issues"
43
- },
44
- "homepage": "https://github.com/ADMINnhanh/nhanh-pure-function#readme"
45
- }
1
+ {
2
+ "name": "nhanh-pure-function",
3
+ "version": "3.0.6-beta.2",
4
+ "description": "纯函数工具",
5
+ "main": "./dist/index.cjs.js",
6
+ "module": "./dist/index.es.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "build": "vite build",
13
+ "build:dev": "vite build --mode development",
14
+ "test": "jest --coverage"
15
+ },
16
+ "devDependencies": {
17
+ "@babel/core": "^7.26.9",
18
+ "@babel/preset-env": "^7.26.9",
19
+ "@types/jest": "^29.5.14",
20
+ "babel-jest": "^29.7.0",
21
+ "jest": "^29.7.0",
22
+ "jest-environment-jsdom": "^29.7.0",
23
+ "less": "^4.2.2",
24
+ "ts-jest": "^29.2.5",
25
+ "ts-node": "^10.9.2",
26
+ "typescript": "^5.7.3",
27
+ "vite": "^6.1.0",
28
+ "vite-plugin-css-injected-by-js": "^3.5.2",
29
+ "vite-plugin-dts": "^4.5.0",
30
+ "vite-tsconfig-paths": "^5.1.4"
31
+ },
32
+ "keywords": [
33
+ "pure-function",
34
+ "format"
35
+ ],
36
+ "author": "nhanh",
37
+ "license": "MIT",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/ADMINnhanh/nhanh-pure-function.git"
41
+ },
42
+ "bugs": {
43
+ "url": "https://github.com/ADMINnhanh/nhanh-pure-function/issues"
44
+ },
45
+ "homepage": "https://github.com/ADMINnhanh/nhanh-pure-function#readme"
46
+ }
@@ -1,45 +0,0 @@
1
- /**
2
- * 进度
3
- * @param {(schedule)=>void} callback callback( 进度百分比 )
4
- * @param {Number} TIME 总时长
5
- * @returns {Function} 停止函数
6
- */
7
- export declare function _Animate_Schedule(callback: (schedule: number) => void, TIME?: number): () => boolean;
8
- /**
9
- * 创建指定范围的振荡器,在最小值和最大值之间循环变化
10
- * @param initialMin - 振荡器初始最小值
11
- * @param initialMax - 振荡器初始最大值
12
- * @param initialSteps - 从最小值到最大值所需的动画步数
13
- * @param callback - 每帧更新时的回调函数,接收当前振荡值
14
- * @param precision - 数值精度(保留小数位数,默认2位)
15
- * @returns 振荡器控制对象,包含播放/暂停/参数更新等方法
16
- */
17
- export declare function _Animate_CreateOscillator(initialMin: number, initialMax: number, initialSteps: number, callback: (value: number) => void, precision?: number): {
18
- /** 启动/继续动画 */
19
- play(target?: number): void;
20
- /** 暂停动画 */
21
- pause(): void;
22
- /** 获取当前值 */
23
- getCurrent: () => number;
24
- /** 是否正在运行 */
25
- isPlaying: () => boolean;
26
- /** 更新参数(不中断动画) */
27
- updateParams: (newMin: number, newMax: number, newSteps: number) => boolean;
28
- /** 获取当前参数 */
29
- getParams: () => {
30
- min: number;
31
- max: number;
32
- steps: number;
33
- precision: number;
34
- stepSize: number;
35
- };
36
- };
37
- /**
38
- * 动画过渡数值变化
39
- * @param startValue - 起始值
40
- * @param targetValue - 目标值
41
- * @param stepCount - 动画步数
42
- * @param callback - 每帧回调函数
43
- * @param precision - 数值精度(默认2位小数)
44
- */
45
- export declare function _Animate_NumericTransition(startValue: number, targetValue: number, stepCount: number, callback: (currentValue: number) => void, precision?: number): void;
File without changes
@@ -1,10 +0,0 @@
1
- /**
2
- * 将不同格式的数据转换为图像 URL
3
- * 此函数支持多种类型的数据输入,包括字符串(Base64/Data URL)、ArrayBuffer、Uint8Array和File,
4
- * 并尝试将这些数据转换为指定MIME类型的图像URL
5
- *
6
- * @param data - 输入数据,可以是字符串(Base64/Data URL)、ArrayBuffer、Uint8Array或File实例
7
- * @param mimeType - 期望的图像MIME类型,默认为'image/png'
8
- * @returns 成功时返回图像的URL,失败时返回null
9
- */
10
- export declare function _Blob_ConvertDataToImageUrl(data: string | ArrayBuffer | Uint8Array | File, mimeType?: string): string | void | null;
File without changes
@@ -1,77 +0,0 @@
1
- import { PaperType, WindowTarget } from '../Constant';
2
- /**
3
- * 获取帧率
4
- * @param {(fps , frameTime)=>void} callback callback( 帧率 , 每帧时间 )
5
- * @param {Number} referenceNode 参考节点数量
6
- */
7
- export declare function _Browser_GetFrameRate(callback: (fps: number, frameTime: number) => void, referenceNode?: number): void;
8
- /**
9
- * 复制到剪贴板
10
- * @param {string} text
11
- */
12
- export declare function _Browser_CopyToClipboard(text: string): Promise<void>;
13
- /**
14
- * 管理通过键值对打开的窗口
15
- */
16
- export declare class _Browser_KeyedWindowManager {
17
- private static keys;
18
- /** 请使用静态方法 */
19
- private constructor();
20
- /** 添加已有窗口 */
21
- static add(key: string, win: Window): void;
22
- /**
23
- * 根据键打开或聚焦窗口
24
- * @param key 窗口的唯一键
25
- * @param url 要打开的URL
26
- * @param target 窗口的目标
27
- * @param windowFeatures 新窗口的特性
28
- * @returns 返回已打开或新打开的窗口
29
- */
30
- static open(key: string, url?: string | URL, target?: WindowTarget, windowFeatures?: string): Window | undefined;
31
- /**
32
- * 检查指定键的窗口是否打开
33
- * @param key 窗口的唯一键
34
- * @returns 如果窗口打开则返回true,否则返回false
35
- */
36
- static isOpen(key: string): boolean;
37
- /**
38
- * 获取与指定键关联的窗口
39
- * @param key 窗口的唯一键
40
- * @returns 返回对应的窗口,如果窗口已关闭则返回undefined
41
- */
42
- static getWindow(key: string): Window | undefined;
43
- /**
44
- * 关闭与指定键关联的窗口
45
- * @param key 窗口的唯一键
46
- */
47
- static close(key: string): void;
48
- /**
49
- * 关闭所有打开的窗口并清空Map
50
- */
51
- static closeAll(): void;
52
- }
53
- /**
54
- * 计算纸张内容可用宽高及边距(考虑设备DPI)
55
- * 确保:contentWidth + 2*paddingPx = 纸张宽度像素
56
- * @param type 纸张类型
57
- * @param padding 边距(毫米)
58
- * @returns {
59
- * contentWidth: number; // 内容可用宽度(px)
60
- * contentHeight: number; // 内容可用高度(px)
61
- * paddingPx: number; // 边距(px) - 单边值
62
- * paperWidthPx: number; // 纸张总宽度(px)
63
- * paperHeightPx: number; // 纸张总高度(px)
64
- * }
65
- */
66
- export declare function _Browser_CalculatePrintableArea(type: PaperType, padding: number): {
67
- /** 内容宽度(像素) */
68
- contentWidth: number;
69
- /** 内容高度(像素) */
70
- contentHeight: number;
71
- /** 边距(像素) */
72
- paddingPx: number;
73
- /** 纸张宽度(像素) */
74
- paperWidthPx: number;
75
- /** 纸张高度(像素) */
76
- paperHeightPx: number;
77
- };
File without changes
@@ -1,256 +0,0 @@
1
- export declare const EXTENSION_TO_MIME: {
2
- ".mp3": string;
3
- ".mp4": string;
4
- ".m4a": string;
5
- ".aac": string;
6
- ".ogg": string;
7
- ".wav": string;
8
- ".flac": string;
9
- ".opus": string;
10
- ".webm": string;
11
- ".avi": string;
12
- ".mov": string;
13
- ".wmv": string;
14
- ".png": string;
15
- ".jpg": string;
16
- ".jpeg": string;
17
- ".gif": string;
18
- ".bmp": string;
19
- ".tiff": string;
20
- ".ico": string;
21
- ".svg": string;
22
- ".webp": string;
23
- ".heif": string;
24
- ".heic": string;
25
- ".json": string;
26
- ".xml": string;
27
- ".html": string;
28
- ".htm": string;
29
- ".css": string;
30
- ".js": string;
31
- ".ts": string;
32
- ".csv": string;
33
- ".tsv": string;
34
- ".txt": string;
35
- ".md": string;
36
- ".rtf": string;
37
- ".pdf": string;
38
- ".zip": string;
39
- ".rar": string;
40
- ".tar": string;
41
- ".gz": string;
42
- ".7z": string;
43
- ".exe": string;
44
- ".apk": string;
45
- ".doc": string;
46
- ".docx": string;
47
- ".xls": string;
48
- ".xlsx": string;
49
- ".ppt": string;
50
- ".pptx": string;
51
- ".odt": string;
52
- ".ods": string;
53
- ".odp": string;
54
- ".jsonld": string;
55
- ".yaml": string;
56
- ".yml": string;
57
- ".woff": string;
58
- ".woff2": string;
59
- ".ttf": string;
60
- ".otf": string;
61
- ".eot": string;
62
- ".map": string;
63
- };
64
- /** 文件扩展名对应的MIME类型 */
65
- export declare const FILE_EXTENSIONS: {
66
- image: string[];
67
- ppt: string[];
68
- word: string[];
69
- excel: string[];
70
- pdf: string[];
71
- text: string[];
72
- audio: string[];
73
- video: string[];
74
- archive: string[];
75
- code: string[];
76
- font: string[];
77
- database: string[];
78
- markup: string[];
79
- configuration: string[];
80
- logs: string[];
81
- script: string[];
82
- };
83
- /** 文件扩展名 */
84
- export type FileType = keyof typeof FILE_EXTENSIONS;
85
- /** 单位标签 */
86
- export declare const UNIT_LABELS: readonly ["", "万", "亿", "兆", "京", "垓", "秭", "穰", "沟", "涧", "正", "载", "极"];
87
- /** 浏览器窗口目标 */
88
- export declare const WINDOW_TARGET: readonly ["_self", "_blank", "_parent", "_top"];
89
- /** 浏览器窗口目标类型 */
90
- export type WindowTarget = (typeof WINDOW_TARGET)[number];
91
- /** 纸张尺寸 */
92
- export declare const PAPER_SIZE_DEFINITIONS: {
93
- readonly Letter: {
94
- readonly width: 215.9;
95
- readonly height: 279.4;
96
- };
97
- readonly Legal: {
98
- readonly width: 215.9;
99
- readonly height: 355.6;
100
- };
101
- readonly Tabloid: {
102
- readonly width: 279.4;
103
- readonly height: 431.8;
104
- };
105
- readonly Ledger: {
106
- readonly width: 431.8;
107
- readonly height: 279.4;
108
- };
109
- readonly Executive: {
110
- readonly width: 184.2;
111
- readonly height: 266.7;
112
- };
113
- readonly Folio: {
114
- readonly width: 215.9;
115
- readonly height: 330.2;
116
- };
117
- readonly Quarto: {
118
- readonly width: 215;
119
- readonly height: 275;
120
- };
121
- readonly "Government-Letter": {
122
- readonly width: 203.2;
123
- readonly height: 266.7;
124
- };
125
- readonly A0: {
126
- readonly width: 841;
127
- readonly height: 1189;
128
- };
129
- readonly A1: {
130
- readonly width: 594;
131
- readonly height: 841;
132
- };
133
- readonly A2: {
134
- readonly width: 420;
135
- readonly height: 594;
136
- };
137
- readonly A3: {
138
- readonly width: 297;
139
- readonly height: 420;
140
- };
141
- readonly A4: {
142
- readonly width: 210;
143
- readonly height: 297;
144
- };
145
- readonly A5: {
146
- readonly width: 148;
147
- readonly height: 210;
148
- };
149
- readonly A6: {
150
- readonly width: 105;
151
- readonly height: 148;
152
- };
153
- readonly A7: {
154
- readonly width: 74;
155
- readonly height: 105;
156
- };
157
- readonly A8: {
158
- readonly width: 52;
159
- readonly height: 74;
160
- };
161
- readonly A9: {
162
- readonly width: 37;
163
- readonly height: 52;
164
- };
165
- readonly A10: {
166
- readonly width: 26;
167
- readonly height: 37;
168
- };
169
- readonly B0: {
170
- readonly width: 1000;
171
- readonly height: 1414;
172
- };
173
- readonly B1: {
174
- readonly width: 707;
175
- readonly height: 1000;
176
- };
177
- readonly B2: {
178
- readonly width: 500;
179
- readonly height: 707;
180
- };
181
- readonly B3: {
182
- readonly width: 353;
183
- readonly height: 500;
184
- };
185
- readonly B4: {
186
- readonly width: 250;
187
- readonly height: 353;
188
- };
189
- readonly B5: {
190
- readonly width: 176;
191
- readonly height: 250;
192
- };
193
- readonly B6: {
194
- readonly width: 125;
195
- readonly height: 176;
196
- };
197
- readonly B7: {
198
- readonly width: 88;
199
- readonly height: 125;
200
- };
201
- readonly B8: {
202
- readonly width: 62;
203
- readonly height: 88;
204
- };
205
- readonly B9: {
206
- readonly width: 44;
207
- readonly height: 62;
208
- };
209
- readonly B10: {
210
- readonly width: 31;
211
- readonly height: 44;
212
- };
213
- readonly C0: {
214
- readonly width: 917;
215
- readonly height: 1297;
216
- };
217
- readonly C1: {
218
- readonly width: 648;
219
- readonly height: 917;
220
- };
221
- readonly C2: {
222
- readonly width: 458;
223
- readonly height: 648;
224
- };
225
- readonly C3: {
226
- readonly width: 324;
227
- readonly height: 458;
228
- };
229
- readonly C4: {
230
- readonly width: 229;
231
- readonly height: 324;
232
- };
233
- readonly C5: {
234
- readonly width: 162;
235
- readonly height: 229;
236
- };
237
- readonly C6: {
238
- readonly width: 114;
239
- readonly height: 162;
240
- };
241
- readonly C7: {
242
- readonly width: 81;
243
- readonly height: 114;
244
- };
245
- readonly C8: {
246
- readonly width: 57;
247
- readonly height: 81;
248
- };
249
- };
250
- /** 纸张尺寸 */
251
- export type PaperType = keyof typeof PAPER_SIZE_DEFINITIONS;
252
- /** 纸张尺寸列表 */
253
- export declare const PAPER_SIZE_OPTIONS: {
254
- value: string;
255
- label: string;
256
- }[];
@@ -1,91 +0,0 @@
1
- import { DragOption, LocalDragOptions, UiLibrary } from './type';
2
- /**
3
- * 滚动结束监听器
4
- * @param {(trigger: "vertical" | "horizontal") => void} callback
5
- */
6
- export declare function _Element_ScrollEndListener(callback: (trigger: "vertical" | "horizontal") => void): (payload: Event) => void;
7
- /**
8
- * 点击非指定dom(包含子级dom)时执行 callback
9
- * @param querySelector 允许点击的 dom 顶层祖先元素选择器
10
- * @param callback 满足条件时执行的回调
11
- *
12
- * @param options 其他配置
13
- * @param options.uiLibrary 项目使用的 ui库 , 用于排除 ui库 创建的元素 , 避免点击 ui库 创建的元素时意外的执行 callback
14
- * @param options.isClickAllowed 是否允许该点击 ( 如果不确定可以返回 undefined )
15
- */
16
- export declare function _Element_CloseOnOutsideClick(querySelector: string[], callback: Function, options?: {
17
- uiLibrary?: UiLibrary[];
18
- isClickAllowed?: (event: MouseEvent) => boolean | undefined;
19
- }): void;
20
- /** 拖拽dom */
21
- export declare class _Element_Drag {
22
- #private;
23
- init(dom: HTMLElement, option?: DragOption): void;
24
- finish(): void;
25
- bindOrUnbindEvent(type: "bind" | "unbind"): void;
26
- alterLocation(): void;
27
- mousedown(event: Event): void;
28
- mousemove(event: Event): void;
29
- mouseup(): void;
30
- }
31
- /** 局部拖拽 计算位置距离/百分比 */
32
- export declare class _Element_LocalDrag {
33
- #private;
34
- init(parentDom: HTMLElement, options?: LocalDragOptions): void;
35
- finish(): void;
36
- bindOrUnbindEvent(type: "bind" | "unbind"): void;
37
- updateValue(): {
38
- top: number;
39
- left: number;
40
- percentage: {
41
- top: number;
42
- left: number;
43
- };
44
- };
45
- alterLocation(): void;
46
- mousedown(event: Event): void;
47
- mousemove(event: Event): void;
48
- mouseup(): void;
49
- }
50
- /** 进入全屏模式 */
51
- export declare function _Element_EnterFullscreen(element?: HTMLElement | string): Promise<void>;
52
- /** 退出全屏模式 */
53
- export declare function _Element_ExitFullscreen(): Promise<void>;
54
- /** 判断是否处于全屏模式 */
55
- export declare function _Element_IsFullscreen(element?: HTMLElement | string): boolean;
56
- /**
57
- * 返回一个用于切换全屏模式的函数
58
- * @param {HTMLElement} content - 需要进入全屏的元素
59
- * 该函数通过检查不同浏览器的特定方法来实现全屏切换
60
- */
61
- export declare function _Element_Fullscreen(element?: HTMLElement | string): () => void;
62
- /**
63
- * 元素全屏状态观察器
64
- * 监听元素的全屏状态变化,并通过回调函数通知状态改变
65
- * @param notify - 全屏状态变化回调函数,接收一个布尔值参数表示当前是否为全屏状态
66
- * @param selectors - 要观察的元素或元素选择器,默认为document.documentElement
67
- * @returns 返回一个清理函数,调用后可移除所有事件监听器
68
- */
69
- export declare function _Element_FullscreenObserver(notify: (isFull: boolean) => void, selectors?: HTMLElement | string): () => void;
70
- /**
71
- * 单位转换 12** -> **px
72
- * @param {string} width
73
- * @returns 对应的单位为px的宽
74
- */
75
- export declare function _Element_GetOtherSizeInPixels(width: string, target?: HTMLElement): number;
76
- /**
77
- * 根据给定的宽高比和目标元素或尺寸,计算画布的尺寸
78
- * 此函数旨在适应不同场景下,如何根据宽高比约束,计算出适合的画布大小
79
- *
80
- * @param aspectRatio 宽高比,表示期望的画布宽度与高度的比例
81
- * @param target 目标元素或尺寸,可以是DOM元素、选择器字符串或尺寸数组
82
- * @returns 返回计算后的画布尺寸,格式为[宽度, 高度]
83
- */
84
- export declare function _Element_CalculateCanvasSize(aspectRatio: number, target: Element | string | [number, number]): number[] | undefined;
85
- /**
86
- * 异步加载图片,并返回图片对象及其宽高比
87
- * @param src 图片的URL地址
88
- * @param timeout 超时时间,单位为毫秒,默认为5000ms
89
- * @returns 一个Promise对象,包含加载的图片对象及其宽高比
90
- */
91
- export declare function _Element_LoadImage(src: string, timeout?: number): Promise<[HTMLImageElement, number]>;