nhanh-pure-function 3.0.6-beta.1 → 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.
Files changed (49) hide show
  1. package/package.json +46 -45
  2. package/dist/Animate/index.d.ts +0 -45
  3. package/dist/Animate/type.d.ts +0 -0
  4. package/dist/Blob/index.d.ts +0 -10
  5. package/dist/Blob/type.d.ts +0 -0
  6. package/dist/Browser/index.d.ts +0 -77
  7. package/dist/Browser/type.d.ts +0 -0
  8. package/dist/Canvas/LayerGroup/index.d.ts +0 -30
  9. package/dist/Canvas/LayerGroup/layer.d.ts +0 -44
  10. package/dist/Canvas/OverlayGroup/arc.d.ts +0 -97
  11. package/dist/Canvas/OverlayGroup/arcTo.d.ts +0 -50
  12. package/dist/Canvas/OverlayGroup/bezierCurve.d.ts +0 -1
  13. package/dist/Canvas/OverlayGroup/custom.d.ts +0 -24
  14. package/dist/Canvas/OverlayGroup/ellipse.d.ts +0 -1
  15. package/dist/Canvas/OverlayGroup/index.d.ts +0 -31
  16. package/dist/Canvas/OverlayGroup/line.d.ts +0 -31
  17. package/dist/Canvas/OverlayGroup/point.d.ts +0 -40
  18. package/dist/Canvas/OverlayGroup/polygon.d.ts +0 -46
  19. package/dist/Canvas/OverlayGroup/public/geometricBoundary.d.ts +0 -70
  20. package/dist/Canvas/OverlayGroup/public/overlay.d.ts +0 -174
  21. package/dist/Canvas/OverlayGroup/text.d.ts +0 -27
  22. package/dist/Canvas/core/axis.d.ts +0 -42
  23. package/dist/Canvas/core/basedata.d.ts +0 -177
  24. package/dist/Canvas/core/draw.d.ts +0 -34
  25. package/dist/Canvas/core/event.d.ts +0 -77
  26. package/dist/Canvas/core/quikmethod.d.ts +0 -104
  27. package/dist/Canvas/core/style.d.ts +0 -22
  28. package/dist/Canvas/index.d.ts +0 -58
  29. package/dist/Canvas/index.types.d.ts +0 -14
  30. package/dist/Canvas/public/basedata.d.ts +0 -64
  31. package/dist/Canvas/public/eventController.d.ts +0 -111
  32. package/dist/Canvas/public/eventControllerBasedata.d.ts +0 -62
  33. package/dist/Canvas/public/tools.d.ts +0 -6
  34. package/dist/Constant.d.ts +0 -256
  35. package/dist/Element/index.d.ts +0 -108
  36. package/dist/Element/type.d.ts +0 -33
  37. package/dist/File/index.d.ts +0 -19
  38. package/dist/File/type.d.ts +0 -0
  39. package/dist/Format/index.d.ts +0 -75
  40. package/dist/Format/type.d.ts +0 -0
  41. package/dist/Math/index.d.ts +0 -50
  42. package/dist/Math/type.d.ts +0 -0
  43. package/dist/Utility/index.d.ts +0 -90
  44. package/dist/Utility/type.d.ts +0 -10
  45. package/dist/Valid/index.d.ts +0 -125
  46. package/dist/Valid/type.d.ts +0 -6
  47. package/dist/index.cjs.js +0 -9
  48. package/dist/index.d.ts +0 -44
  49. package/dist/index.es.js +0 -6133
@@ -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,108 +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]>;
92
- /**
93
- * 检查指定dom内所有图片的加载状态并返回结果
94
- * @param id - 图片ID
95
- * @returns - 图片加载状态信息
96
- */
97
- export declare function _Element_CheckImagesLoaded(id: string): Promise<{
98
- /** 是否全部加载完成 */
99
- allLoaded: boolean;
100
- /** 成功加载的图片数量 */
101
- loaded: number;
102
- /** 加载失败的图片数量 */
103
- failed: number;
104
- /** 总图片数量 */
105
- total: number;
106
- /** 加载失败的图片列表 */
107
- errors: HTMLImageElement[];
108
- }>;
@@ -1,33 +0,0 @@
1
- export type UiLibrary = "naiveUI" | "ElementPlus" | "Element";
2
- export type EventFunctionMap = Partial<Record<"mousedown" | "mousemove" | "mouseup" | "click" | "touchstart" | "touchmove" | "touchend" | "touchcancel", (event: Event) => void>>;
3
- /** 拖拽配置 */
4
- export type DragOption = {
5
- /** 拖拽范围限制 */
6
- limit?: {
7
- max: {
8
- top: number;
9
- left: number;
10
- };
11
- min: {
12
- top: number;
13
- left: number;
14
- };
15
- };
16
- /** 指定的拖拽元素 */
17
- dragDom?: HTMLElement;
18
- };
19
- /** 更新后的位置信息 */
20
- export type UpdateValue = {
21
- top: number;
22
- left: number;
23
- percentage?: {
24
- top: number;
25
- left: number;
26
- };
27
- };
28
- /** 局部拖拽配置 */
29
- export type LocalDragOptions = {
30
- limit?: DragOption["limit"];
31
- update_move?: (value: UpdateValue) => void | undefined;
32
- update_up?: (value: UpdateValue) => void | undefined;
33
- };
@@ -1,19 +0,0 @@
1
- /**
2
- * 读取文件
3
- * @param src 文件地址
4
- * @returns 文件的字符串内容
5
- */
6
- export declare function _File_Read(src: string): Promise<string>;
7
- /**
8
- * 下载文件
9
- * @param {string} href - 文件路径
10
- * @param {string} [fileName] - 导出文件名
11
- */
12
- export declare function _File_Download(href: string, fileName?: string): Promise<unknown>;
13
- /**
14
- * 创建文件并下载
15
- * @param {BlobPart[]} content 文件内容
16
- * @param {string} fileName 文件名称
17
- * @param {BlobPropertyBag} options Blob 配置
18
- */
19
- export declare function _File_CreateAndDownload(content: BlobPart[], fileName: string, options?: BlobPropertyBag): void;
File without changes
@@ -1,75 +0,0 @@
1
- /**
2
- * 首字母大写
3
- * @param str
4
- * @returns string
5
- */
6
- export declare function _Format_CapitalizeFirstLetter(string: string): string;
7
- /**
8
- * 转为百分比字符串
9
- * @param value 分子
10
- * @param totalValue 分母
11
- * @param decimalPlaces 保留小数位
12
- * @returns 10.00%
13
- */
14
- export declare function _Format_Percentage(value: number, totalValue: number, decimalPlaces?: number): string;
15
- /**
16
- * 格式化数字,给数字加上千位分隔符。
17
- * @param {number} number - 要格式化的数字。
18
- * @returns {string} - 格式化后的字符串。
19
- */
20
- export declare function _Format_NumberWithCommas(number: number): string;
21
- /**
22
- * 将纯数字转换为带单位的数字格式
23
- *
24
- * @param value - 要转换的数字或字符串形式的数字
25
- * @param config - 配置对象
26
- * @param config.join - 是否将数字和单位拼接成一个字符串,默认为 `false`
27
- * @param config.suffix - 单位后缀,默认为 `万`
28
- * @param config.decimalPlaces - 保留的小数位数,默认为 `2`
29
- *
30
- * @returns 返回转换后的结果:
31
- * - 如果 `config.join` 为 `true`,返回拼接后的字符串,如 "12.34万"
32
- * - 如果 `config.join` 为 `false`,返回一个数组,如 [ 12.34, '万' ]
33
- */
34
- export declare function _Format_NumberWithUnit(value: string | number, config?: {
35
- join?: boolean;
36
- suffix?: string;
37
- decimalPlaces?: number;
38
- }): string | (string | number)[];
39
- /**
40
- * 格式化文件大小
41
- * @param {number} size
42
- * @returns string
43
- */
44
- export declare function _Format_FileSize(size: number): string;
45
- /**
46
- * 时间戳转换字符串
47
- * @param {Number | Date} time 时间戳或Date对象
48
- * @param {String} template 完整模板 --> YYYY MM DD hh mm ss ms
49
- * @param {Boolean} pad 补0
50
- */
51
- export declare function _Format_Timestamp(time: number | Date, template?: string, pad?: boolean): string;
52
- /**
53
- * 从给定的href中提取名称部分
54
- * 该函数旨在处理URL字符串,并返回URL路径的最后一部分,去除查询参数
55
- *
56
- * @param {string} href - 待处理的URL字符串
57
- * @param {string} [defaultName="file"] - 默认的文件名,当无法提取时使用
58
- * @returns {string} URL路径的最后一部分,不包括查询参数
59
- */
60
- export declare function _Format_HrefName(href: string, defaultName?: string): string;
61
- /**
62
- * 驼峰命名
63
- * @param {字符串} str
64
- * @param {是否删除分割字符} isRemoveDelimiter
65
- * @returns 'wq1wqw-qw2qw' -> 'wq1Wqw-Qw2Qw' / 'wqWqwQwQw'
66
- */
67
- export declare function _Format_CamelCase(str: string, isRemoveDelimiter?: boolean): string;
68
- /**
69
- * 排除子串
70
- * @param inputString 需裁剪字符串
71
- * @param substringToDelete 被裁减字符串
72
- * @param delimiter 分隔符
73
- * @returns 裁减后的字符串
74
- */
75
- export declare function _Format_ExcludeSubstring(inputString: string, substringToDelete: string, delimiter?: string): string;
File without changes
@@ -1,50 +0,0 @@
1
- /**
2
- * 将经纬度转换为平面坐标
3
- * @param lng 经度
4
- * @param lat 纬度
5
- * @returns 平面坐标 [x, y](米)
6
- */
7
- export declare function _Math_LngLatToPlane(lng: number, lat: number): [number, number];
8
- /**
9
- * 将平面坐标转换为经纬度
10
- * @param x 平面坐标 X 值(米)
11
- * @param y 平面坐标 Y 值(米)
12
- * @returns 经纬度 [lng, lat](度)
13
- */
14
- export declare function _Math_PlaneToLngLat(x: number, y: number): [number, number];
15
- /**
16
- * 计算点到线段的距离
17
- * @param point 点击位置
18
- * @param lineStart 线段起点
19
- * @param lineEnd 线段终点
20
- * @returns 点到线段的距离
21
- */
22
- export declare function _Math_PointToLineDistance(point: [number, number], lineStart: [number, number], lineEnd: [number, number]): number;
23
- /**
24
- * 计算圆弧的起点和终点坐标
25
- * @param x 圆心X坐标
26
- * @param y 圆心Y坐标
27
- * @param radius 圆弧半径
28
- * @param startAngle 起始角度(弧度制,0表示X轴正方向)
29
- * @param endAngle 结束角度(弧度制)
30
- * @param axisX X轴方向(1=正方向向右,-1=正方向向左)
31
- * @param axisY Y轴方向(1=正方向向上,-1=正方向向下)
32
- * @returns [起点坐标[x,y], 终点坐标[x,y]]
33
- */
34
- export declare function _Math_GetArcPoints(x: number, y: number, radius: number, startAngle: number, endAngle: number, axisX?: number, axisY?: number): [[number, number], [number, number]];
35
- /** 计算平面直角坐标系中两点的距离 */
36
- export declare function _Math_CalculateDistance2D(x1: number, y1: number, x2: number, y2: number): number;
37
- /** 获取两点的中点 */
38
- export declare function _Math_GetMidpoint(x1: number, y1: number, x2: number, y2: number): {
39
- x: number;
40
- y: number;
41
- };
42
- /**
43
- * 计算从起点沿方向向量延伸后与画布边界的交点
44
- * @param startPoint 线段起点坐标 [x, y]
45
- * @param direction 方向向量 [dx, dy]
46
- * @param canvasWidth 画布宽度
47
- * @param canvasHeight 画布高度
48
- * @returns 与边界的交点坐标
49
- */
50
- export declare function _Math_GetBoundaryIntersection(startPoint: [number, number], direction: [number, number], canvasWidth: number, canvasHeight: number): [number, number];
File without changes
@@ -1,90 +0,0 @@
1
- /**
2
- * 寻找空闲时机执行传入方法
3
- * @param callback 需执行的方法
4
- */
5
- export declare function _Utility_ExecuteWhenIdle(callback: Function): void;
6
- /**
7
- * 等待条件满足
8
- * @param conditionChecker 条件检查器
9
- * @param timeoutMillis 超时毫秒数
10
- * @returns Promise<unknown>
11
- */
12
- export declare function _Utility_WaitForCondition(conditionChecker: () => boolean, timeoutMillis: number): Promise<"完成" | "超时">;
13
- /**
14
- * 合并对象 注意: 本函数会直接操作 A
15
- * @param {Object | Array} A
16
- * @param {Object | Array} B
17
- * @returns (A & B) | A | B | undefined
18
- */
19
- export declare function _Utility_MergeObjects<T, T1>(A: T, B: T1, visitedObjects?: [any, any][], outTime?: number): (T & T1) | T | T1 | undefined;
20
- /**
21
- * 生成一个UUID(通用唯一标识符)字符串
22
- * 可以选择性地在UUID前面添加前缀
23
- *
24
- * @param {string} prefix - 可选参数,要添加到UUID前面的前缀
25
- * @returns {string} 一个带有可选前缀的UUID字符串
26
- */
27
- export declare function _Utility_GenerateUUID(prefix?: string): string;
28
- /**
29
- * 防抖
30
- * @param {Function} fn
31
- * @param {number} delay
32
- * @returns {Function}
33
- */
34
- export declare function _Utility_Debounce<T extends (...args: any[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void;
35
- /**
36
- * 节流
37
- * @param {Function} fn
38
- * @param {number} delay
39
- * @returns {Function}
40
- */
41
- export declare function _Utility_Throttle<T extends (...args: any[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void;
42
- /**
43
- * 根据路径从对象中获取目标值
44
- * @param rootObject - 根对象
45
- * @param path - 访问路径,支持点号和数组索引语法(如 "a1.b2[0].c3")
46
- * @returns 目标值,如果路径无效则返回根对象
47
- */
48
- export declare function _Utility_GetTargetByPath(rootObject: any, path: string): any;
49
- /**
50
- * 根据路径设置对象中的目标值
51
- * @param rootObject - 根对象
52
- * @param path - 访问路径,支持点号和数组索引语法(如 "a1.b2[0].c3")
53
- * @param value - 要设置的值
54
- * @param skipIfExists - 如果为true,当目标位置已有值时跳过设置
55
- * @returns 设置后的根对象
56
- */
57
- export declare function _Utility_SetTargetByPath(rootObject: any, path: string, value: any, skipIfExists?: boolean): any;
58
- /**
59
- * 旋转列表函数
60
- *
61
- * 该函数接受一个列表作为参数,并返回一个二维数组,其中每个内部数组都是原列表的一种旋转形式
62
- * 旋转列表的原理是将原列表分割成两部分,并将这两部分重新组合,形成一个新的列表
63
- *
64
- * @param list T[] - 需要旋转的列表,列表元素类型为泛型T
65
- * @returns T[][] - 返回一个二维数组,每个内部数组代表原列表的一种旋转形式
66
- */
67
- export declare function _Utility_RotateList<T>(list: T[]): T[][];
68
- /**
69
- * 克隆给定值的函数
70
- * 该函数尝试使用window.structuredClone方法进行深克隆,如果失败则使用自定义方法
71
- * @param {any} val - 需要克隆的值
72
- * @returns {any} - 克隆后的值
73
- */
74
- export declare function _Utility_Clone<T>(val: T): T;
75
- /**
76
- * 函数装饰器,用于测量并记录另一个函数的执行时间
77
- * @param func 要测量执行时间的函数
78
- * @param level 耗时与颜色对应的数组,用于在控制台中着色显示
79
- * @param maxHistory 保留的最大历史记录数,默认为30
80
- */
81
- export declare function _Utility_TimeConsumption(func: Function, level: [number, string][], maxHistory?: number): void | ((...args: any[]) => any);
82
- /**
83
- * 暂停执行指定毫秒数的操作
84
- * 此函数通过 busy-wait(忙等待)的方式实现,它会持续执行一些无用的操作以消耗时间
85
- * 这种方法虽然简单,但会占用CPU资源,因此不推荐在实际应用中使用
86
- *
87
- * @param ms 暂停的毫秒数
88
- * @returns 实际暂停的毫秒数
89
- */
90
- export declare function _Utility_Sleep(ms: number): number;
@@ -1,10 +0,0 @@
1
- export declare const PATH_SEGMENT_REGEX: RegExp;
2
- export declare const ARRAY_PATH_REGEX: RegExp;
3
- export declare const ARRAY_PART_REGEX: RegExp;
4
- export declare const INDEX_EXTRACT_REGEX: RegExp;
5
- /**
6
- * 解析路径字符串为路径段数组
7
- * @param path - 需要解析的路径字符串
8
- * @returns 路径段数组,如果路径为空则返回空数组
9
- */
10
- export declare function _parsePathSegments(path: string): string[];