dozy 1.0.67 → 1.0.69
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/dist/index.d.ts +605 -46
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,17 @@ export { customAlphabet, nanoid, urlAlphabet } from 'nanoid';
|
|
|
14
14
|
type DozyConfigItem = {};
|
|
15
15
|
type DozyConfig = Partial<DozyConfigItem>;
|
|
16
16
|
declare class Dozy {
|
|
17
|
+
/**
|
|
18
|
+
* 将用户传入的配置合并到当前运行时配置对象中。
|
|
19
|
+
*
|
|
20
|
+
* 行为说明:
|
|
21
|
+
* - 通过 `$loadOpt` 逐字段合并。
|
|
22
|
+
* - 当两边字段都是对象时,会继续执行嵌套合并。
|
|
23
|
+
* - 现有属性可能会被新值覆盖。
|
|
24
|
+
*
|
|
25
|
+
* @param config 要合并进 `this.config` 的部分配置对象。
|
|
26
|
+
* @returns 无返回值;内部 `config` 会被原地更新。
|
|
27
|
+
*/
|
|
17
28
|
loadConfig(config: DozyConfig): void;
|
|
18
29
|
config: DozyConfig;
|
|
19
30
|
}
|
|
@@ -21,6 +32,18 @@ declare const dozy: Dozy;
|
|
|
21
32
|
|
|
22
33
|
type Any = Items<any>;
|
|
23
34
|
type Null = undefined | null | void;
|
|
35
|
+
/**
|
|
36
|
+
* 判断一个值在本包语义下是否属于空值。
|
|
37
|
+
*
|
|
38
|
+
* 该函数会把以下值视为空值:
|
|
39
|
+
* - `null`
|
|
40
|
+
* - `undefined`
|
|
41
|
+
* - `void 0`
|
|
42
|
+
*
|
|
43
|
+
* @typeParam T 原始候选类型。
|
|
44
|
+
* @param v 要检测的值。
|
|
45
|
+
* @returns 当 `v` 是 `null` 或 `undefined` 时返回 `true`,否则返回 `false`。
|
|
46
|
+
*/
|
|
24
47
|
declare function isNull<T>(v: T | Null): v is Null;
|
|
25
48
|
type Nullable<T> = T | Null;
|
|
26
49
|
type Items<T> = {
|
|
@@ -33,60 +56,444 @@ type Coord3 = [number, number, number];
|
|
|
33
56
|
type IOpt = Object | undefined;
|
|
34
57
|
type Atoa<T> = (i: T) => T;
|
|
35
58
|
|
|
59
|
+
/**
|
|
60
|
+
* 判断一个值是否为非 `null` 的对象。
|
|
61
|
+
*
|
|
62
|
+
* @param value 要检测的值。
|
|
63
|
+
* @returns 当值是对象且不为 `null` 时返回 `true`,否则返回 `false`。
|
|
64
|
+
*/
|
|
36
65
|
declare function $isObject(value: unknown): value is Record<string, unknown>;
|
|
66
|
+
/**
|
|
67
|
+
* 使用当前运行环境中可用的最佳方式深拷贝一个值。
|
|
68
|
+
*
|
|
69
|
+
* 行为说明:
|
|
70
|
+
* - 优先使用 `structuredClone`。
|
|
71
|
+
* - 不可用时回退到 `JSON.stringify` / `JSON.parse`。
|
|
72
|
+
* - JSON 方案会丢失函数、`undefined`、循环引用以及部分类实例信息。
|
|
73
|
+
*
|
|
74
|
+
* @typeParam T 输入与返回值的类型。
|
|
75
|
+
* @param value 源值。
|
|
76
|
+
* @returns 返回深拷贝后的结果,但具体保真度取决于底层拷贝方案。
|
|
77
|
+
*/
|
|
37
78
|
declare function $deepClone<T>(value: T): T;
|
|
79
|
+
/**
|
|
80
|
+
* 将字符串首字母转为大写。
|
|
81
|
+
*
|
|
82
|
+
* @param s 输入字符串。
|
|
83
|
+
* @returns 如果输入为空则原样返回;否则返回首字符大写后的字符串。
|
|
84
|
+
*/
|
|
38
85
|
declare function $capitalize(s: string): string;
|
|
86
|
+
/**
|
|
87
|
+
* 将数字限制在闭区间 `[min, max]` 内。
|
|
88
|
+
*
|
|
89
|
+
* @param n 输入数字。
|
|
90
|
+
* @param min 最小值。
|
|
91
|
+
* @param max 最大值。
|
|
92
|
+
* @returns 小于最小值时返回 `min`,大于最大值时返回 `max`,否则返回原值。
|
|
93
|
+
*/
|
|
39
94
|
declare function $clamp(n: number, min: number, max: number): number;
|
|
95
|
+
/**
|
|
96
|
+
* 将一个对象中的配置项合并到目标对象中。
|
|
97
|
+
*
|
|
98
|
+
* 行为说明:
|
|
99
|
+
* - 如果 `obj` 不存在,则直接返回 `thiz`。
|
|
100
|
+
* - 当源字段和目标字段都是对象时,会尝试调用目标上的 `$loadOpt` 继续递归合并。
|
|
101
|
+
* - 否则直接覆盖赋值。
|
|
102
|
+
*
|
|
103
|
+
* @param thiz 目标对象,会被原地修改。
|
|
104
|
+
* @param obj 可选的源对象。
|
|
105
|
+
* @returns 返回被修改后的目标对象 `thiz`。
|
|
106
|
+
*/
|
|
40
107
|
declare function $loadOpt(thiz: Object, obj?: Object): any;
|
|
108
|
+
/**
|
|
109
|
+
* 抛出一个带指定消息的 `Error`。
|
|
110
|
+
*
|
|
111
|
+
* @param msg 错误消息。
|
|
112
|
+
* @returns 不会返回。
|
|
113
|
+
* @throws 始终抛出 `Error`。
|
|
114
|
+
*/
|
|
41
115
|
declare function errMsg(msg: string): void;
|
|
116
|
+
/**
|
|
117
|
+
* 去掉 HTML 标记并返回纯文本内容。
|
|
118
|
+
*
|
|
119
|
+
* @param fragment HTML 片段字符串。
|
|
120
|
+
* @returns 返回去除换行并裁剪首尾空白后的纯文本。
|
|
121
|
+
*/
|
|
42
122
|
declare function $pureText(fragment: string): string;
|
|
123
|
+
/**
|
|
124
|
+
* 判断一个值是否为普通对象记录。
|
|
125
|
+
*
|
|
126
|
+
* @param o 要检测的值。
|
|
127
|
+
* @returns 非 `null` 对象时返回 `true`,否则返回 `false`。
|
|
128
|
+
*/
|
|
43
129
|
declare function $oc(o: any): o is Record<string, any>;
|
|
130
|
+
/**
|
|
131
|
+
* 判断一个值是否为字符串,并可选要求其非空。
|
|
132
|
+
*
|
|
133
|
+
* @param s 要检测的值。
|
|
134
|
+
* @param val 为真时,除了要求是字符串外,还要求 `!!s` 为真。
|
|
135
|
+
* @returns 是否满足对应的字符串条件。
|
|
136
|
+
*/
|
|
44
137
|
declare function $s(s: any, val?: boolean): s is string;
|
|
138
|
+
/**
|
|
139
|
+
* 判断一个值是否为有限数字。
|
|
140
|
+
*
|
|
141
|
+
* @param n 要检测的值。
|
|
142
|
+
* @returns 只有在值是数字且不是 `NaN`、`Infinity`、`-Infinity` 时才返回 `true`。
|
|
143
|
+
*/
|
|
45
144
|
declare function $sc(n: any): n is number;
|
|
145
|
+
/**
|
|
146
|
+
* 对循环索引执行加减步进,并保证结果始终落在循环范围内。
|
|
147
|
+
*
|
|
148
|
+
* @param v 当前值。
|
|
149
|
+
* @param t 循环长度,也可理解为上边界(不包含)。
|
|
150
|
+
* @param plus 步进值,默认为 `1`。
|
|
151
|
+
* @returns 返回落在 `[0, t)` 区间内的循环结果。
|
|
152
|
+
*/
|
|
46
153
|
declare function $lplus(v: number, t: number, plus?: number): number;
|
|
154
|
+
/**
|
|
155
|
+
* 使用循环索引方式读取数组项。
|
|
156
|
+
*
|
|
157
|
+
* @param arr 源数组。
|
|
158
|
+
* @param i 目标索引,可以是负数,也可以超过数组长度。
|
|
159
|
+
* @returns 返回折算后的数组项;如果数组为空则返回 `undefined`。
|
|
160
|
+
*/
|
|
47
161
|
declare function $lindex(arr: Array<any>, i: number): any;
|
|
162
|
+
/**
|
|
163
|
+
* 校验一个简单标识符是否合法。
|
|
164
|
+
*
|
|
165
|
+
* 允许字符:字母、数字、连字符 `-`、下划线 `_`。
|
|
166
|
+
*
|
|
167
|
+
* @param id 待校验的标识符。
|
|
168
|
+
* @returns 当 `id` 非空且符合规则时返回 `true`,否则返回 `false`。
|
|
169
|
+
*/
|
|
48
170
|
declare function $validName(id?: string): id is string;
|
|
49
171
|
type FileType = 'text' | 'image' | 'audio' | 'video' | 'font' | 'unknown';
|
|
172
|
+
/**
|
|
173
|
+
* 根据文件扩展名推断文件的大致类型。
|
|
174
|
+
*
|
|
175
|
+
* @param fileName 文件名或路径。
|
|
176
|
+
* @returns 可能返回 `text`、`image`、`audio`、`video`、`font` 或 `unknown`。
|
|
177
|
+
*/
|
|
50
178
|
declare function $getFileType(fileName: string): FileType;
|
|
179
|
+
/**
|
|
180
|
+
* 判断一个字符串是否看起来像 URL,允许省略协议头。
|
|
181
|
+
*
|
|
182
|
+
* @param url 待检测的 URL 字符串。
|
|
183
|
+
* @returns 输入为空时返回 `false`;否则返回是否匹配内部 URL 规则。
|
|
184
|
+
*/
|
|
51
185
|
declare function $isValidOrBriefURL(url?: string): boolean;
|
|
186
|
+
/**
|
|
187
|
+
* 将 tick 时间格式化为可读字符串。
|
|
188
|
+
*
|
|
189
|
+
* @param stampTicks 时间值,默认规则下 40 tick = 1 秒。
|
|
190
|
+
* @param short 为 `true` 时返回 `MM:SS`,否则返回 `HH:MM:SS`。
|
|
191
|
+
* @param unitS 为 `true` 时表示传入值单位是秒,函数内部会自动换算成 tick。
|
|
192
|
+
* @param exact 为 `true` 时会在末尾追加 `%xx`,表示更细的余数信息。
|
|
193
|
+
* @returns 返回格式化后的时间字符串;若输入不是有效数字,则按 `short` 返回 `00:00` 或 `00:00:00`。
|
|
194
|
+
*/
|
|
52
195
|
declare function $getTimeString(stampTicks: number, short: boolean, unitS?: boolean, exact?: boolean): string;
|
|
196
|
+
/**
|
|
197
|
+
* 在指定范围内生成随机整数。
|
|
198
|
+
*
|
|
199
|
+
* 参数语义:
|
|
200
|
+
* - 只传 `start` 时,返回 `[0, start)` 范围内的整数。
|
|
201
|
+
* - 同时传 `start`、`end` 时,返回 `[start, end)` 范围内的整数。
|
|
202
|
+
*
|
|
203
|
+
* @param start 当 `end` 省略时表示上限;否则表示下限。
|
|
204
|
+
* @param end 可选的上限(不包含)。
|
|
205
|
+
* @returns 返回目标范围内的随机整数;当范围无效时返回 `0`。
|
|
206
|
+
*/
|
|
53
207
|
declare function $magic(start: number, end?: number): number;
|
|
208
|
+
/**
|
|
209
|
+
* 生成指定长度的伪随机字母数字字符串。
|
|
210
|
+
*
|
|
211
|
+
* @param len 目标长度,小于 `1` 时会被强制改为 `1`。
|
|
212
|
+
* @returns 返回长度恰好为 `len` 的随机字符串。
|
|
213
|
+
*/
|
|
54
214
|
declare function $randomByte(len?: number): string;
|
|
215
|
+
/**
|
|
216
|
+
* 解析 JSON 字符串,并读取其中某个点路径对应的值。
|
|
217
|
+
*
|
|
218
|
+
* @param s JSON 字符串。
|
|
219
|
+
* @param path 可选的点分隔路径,如 `a.b.c`。
|
|
220
|
+
* @param def 当输入为空或路径读取失败时使用的默认值。
|
|
221
|
+
* @returns 返回读取到的值;如果失败则返回 `def`。
|
|
222
|
+
*/
|
|
55
223
|
declare function $rsValue(s?: string, path?: string, def?: any): any;
|
|
224
|
+
/**
|
|
225
|
+
* 按点路径给对象设置嵌套值。
|
|
226
|
+
*
|
|
227
|
+
* @param obj 目标对象。
|
|
228
|
+
* @param path 点分隔属性路径。
|
|
229
|
+
* @param value 要设置的值。
|
|
230
|
+
* @returns 返回最终写入的值。
|
|
231
|
+
*/
|
|
56
232
|
declare function $rsetValue(obj: Object, path: string, value: any): any;
|
|
233
|
+
/**
|
|
234
|
+
* 使用点路径读取或设置对象中的嵌套属性。
|
|
235
|
+
*
|
|
236
|
+
* @param obj 目标对象。
|
|
237
|
+
* @param path 可选的点分隔路径;如果不传,则直接返回 `obj` 本身。
|
|
238
|
+
* @param def 默认值;在设置模式下也会作为要写入的值。
|
|
239
|
+
* @param sdef 为 `true` 时,缺失的中间对象或最终值可以按需用 `def` 创建。
|
|
240
|
+
* @param set 为 `true` 时强制进入设置模式,并把 `def` 写入最终路径。
|
|
241
|
+
* @returns 可能返回读取到的值、写入的值、默认值 `def`,或者原对象 `obj`,具体取决于路径情况与参数组合。
|
|
242
|
+
*/
|
|
57
243
|
declare function $rvalue(obj: Object, path?: string, def?: any, sdef?: boolean, set?: boolean): any;
|
|
244
|
+
/**
|
|
245
|
+
* 判断对象是否直接拥有某个属性。
|
|
246
|
+
*
|
|
247
|
+
* @param obj 要检查的对象。
|
|
248
|
+
* @param key 属性名。
|
|
249
|
+
* @returns 只有当属性是对象自身属性时才返回 `true`。
|
|
250
|
+
*/
|
|
58
251
|
declare function $hasKey(obj: Object, key: string): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* `_maybeString` 的对外包装函数。
|
|
254
|
+
*
|
|
255
|
+
* @param a 要转成字符串的值。
|
|
256
|
+
* @param maxLength 最大输出长度,默认为 `600`。
|
|
257
|
+
* @returns 返回相对安全的字符串表示。
|
|
258
|
+
*/
|
|
59
259
|
declare function maybeString(a: any, maxLength?: number): string;
|
|
260
|
+
/**
|
|
261
|
+
* 将未知错误尽量转换为可读的错误消息。
|
|
262
|
+
*
|
|
263
|
+
* @param e 未知的错误值。
|
|
264
|
+
* @returns 返回尽可能提取出的错误消息;若是 Axios 错误且响应中存在 `data.msg`,会优先使用它。
|
|
265
|
+
*/
|
|
60
266
|
declare function errToString(e: unknown): string;
|
|
267
|
+
/**
|
|
268
|
+
* 以一个固定的小概率返回 `true`。
|
|
269
|
+
*
|
|
270
|
+
* @returns 当 `Math.random() > 0.8` 时返回 `true`,否则返回 `false`。
|
|
271
|
+
*/
|
|
61
272
|
declare function smallChance(): boolean;
|
|
273
|
+
/**
|
|
274
|
+
* 判断一个值是否是指定构造函数的普通实例。
|
|
275
|
+
*
|
|
276
|
+
* @param obj 要检测的值。
|
|
277
|
+
* @param clas 期望的构造函数,默认为 `Object`。
|
|
278
|
+
* @returns 当 `obj` 非空且其 `constructor === clas` 时返回 `true`。
|
|
279
|
+
*/
|
|
62
280
|
declare function $isPlainClass(obj: any, clas?: Function): boolean;
|
|
281
|
+
/**
|
|
282
|
+
* 将 Unicode 字符串编码为 Base64。
|
|
283
|
+
*
|
|
284
|
+
* @param str 源字符串。
|
|
285
|
+
* @returns 返回 Base64 字符串。
|
|
286
|
+
*/
|
|
63
287
|
declare function $encodeUnicodeToBase64(str: string): string;
|
|
288
|
+
/**
|
|
289
|
+
* 将 Base64 字符串解码回 Unicode 文本。
|
|
290
|
+
*
|
|
291
|
+
* @param base64 Base64 编码字符串。
|
|
292
|
+
* @returns 返回解码后的 Unicode 字符串。
|
|
293
|
+
*/
|
|
64
294
|
declare function $decodeBase64ToUnicode(base64: string): string;
|
|
295
|
+
/**
|
|
296
|
+
* 读取浏览器 `File`,并返回不带 data URL 前缀的纯 Base64 内容。
|
|
297
|
+
*
|
|
298
|
+
* @param file 要读取的文件对象。
|
|
299
|
+
* @returns 返回一个 Promise,成功时得到纯 Base64 字符串。
|
|
300
|
+
* @throws 当文件读取失败或结果不是字符串时,Promise 会被拒绝。
|
|
301
|
+
*/
|
|
65
302
|
declare function $fileToBase64(file: File): Promise<string>;
|
|
303
|
+
/**
|
|
304
|
+
* 将 Base64 字符串解码为原始字节数组。
|
|
305
|
+
*
|
|
306
|
+
* @param base64 纯 Base64 字符串。
|
|
307
|
+
* @returns 返回解码后的 `Uint8Array`。
|
|
308
|
+
*/
|
|
66
309
|
declare function $decodeBase64ToBinary(base64: string): Uint8Array<ArrayBuffer>;
|
|
310
|
+
/**
|
|
311
|
+
* 仅在边界值有效时,将数字限制到对应范围内。
|
|
312
|
+
*
|
|
313
|
+
* @param v 输入值。
|
|
314
|
+
* @param min 可选最小值。
|
|
315
|
+
* @param max 可选最大值。
|
|
316
|
+
* @returns 返回处理后的结果值。
|
|
317
|
+
*/
|
|
67
318
|
declare function $setRange(v: number, min?: number, max?: number): number;
|
|
319
|
+
/**
|
|
320
|
+
* 判断一个值是否位于某个中心点的对称范围内。
|
|
321
|
+
*
|
|
322
|
+
* @param v 要检测的值。
|
|
323
|
+
* @param mid 中心值。
|
|
324
|
+
* @param range 左右两侧允许的偏移范围。
|
|
325
|
+
* @returns 当 `v` 位于 `[mid - range, mid + range]` 区间内时返回 `true`。
|
|
326
|
+
*/
|
|
68
327
|
declare function $inRange2(v: number, mid: number, range: number): boolean;
|
|
328
|
+
/**
|
|
329
|
+
* 判断一个数是否位于可选的最小值和最大值之间。
|
|
330
|
+
*
|
|
331
|
+
* @param v 要检测的值。
|
|
332
|
+
* @param min 可选最小值。
|
|
333
|
+
* @param max 可选最大值。
|
|
334
|
+
* @returns 如果违反任一已提供边界则返回 `false`,否则返回 `true`。
|
|
335
|
+
*/
|
|
69
336
|
declare function $inRange(v: number, min?: number, max?: number): boolean;
|
|
337
|
+
/**
|
|
338
|
+
* 按指定分隔符拆分字符串。
|
|
339
|
+
*
|
|
340
|
+
* @param str 原始字符串。
|
|
341
|
+
* @param cut 分隔符,默认为 `^`。
|
|
342
|
+
* @returns 返回 `str.split(cut)` 的结果数组。
|
|
343
|
+
*/
|
|
70
344
|
declare function $strings(str: string, cut?: string): string[];
|
|
345
|
+
/**
|
|
346
|
+
* 生成一个按成对字符串参数进行处理的辅助函数。
|
|
347
|
+
*
|
|
348
|
+
* 规则说明:
|
|
349
|
+
* - 如果只传了一个参数且其中包含 `^`,会先按 `^` 拆分。
|
|
350
|
+
* - 然后按 `(s1, s2)` 两两配对执行处理。
|
|
351
|
+
* - 如果某组缺少第二项,运行时该参数会是 `undefined`。
|
|
352
|
+
*
|
|
353
|
+
* @param f 成对处理函数。
|
|
354
|
+
* @param gap 每组结果之间插入的分隔字符串。
|
|
355
|
+
* @returns 返回一个新函数,用于把字符串列表合成为最终字符串。
|
|
356
|
+
*/
|
|
71
357
|
declare function $genSSF(f: (s1: string, s2: string) => string, gap?: string): (...args: string[]) => string;
|
|
358
|
+
/**
|
|
359
|
+
* 规范化多行字符串中的空白字符。
|
|
360
|
+
*
|
|
361
|
+
* @param s 输入字符串。
|
|
362
|
+
* @returns 返回压缩多余空行、规范行内空白并去除首尾空白后的字符串。
|
|
363
|
+
*/
|
|
72
364
|
declare function xtrim(s: string): string;
|
|
365
|
+
/**
|
|
366
|
+
* 根据键值选择映射项,并在映射值为函数时执行它。
|
|
367
|
+
*
|
|
368
|
+
* @typeParam T 键类型。
|
|
369
|
+
* @typeParam V 非函数映射值类型。
|
|
370
|
+
* @param val 当前要选择的键。
|
|
371
|
+
* @param fs 键到函数或普通值的映射表。
|
|
372
|
+
* @returns 如果命中项是函数则返回函数执行结果,否则返回映射值本身。
|
|
373
|
+
*/
|
|
73
374
|
declare function $if<T extends string | number | symbol, V>(val: T, fs: Record<T, Function | V>): any;
|
|
375
|
+
/**
|
|
376
|
+
* 获取数组或长度值对应的最后一个有效索引。
|
|
377
|
+
*
|
|
378
|
+
* @param items 数组本身或数字长度。
|
|
379
|
+
* @returns 返回 `max(length - 1, 0)` 的结果。
|
|
380
|
+
*/
|
|
74
381
|
declare function $lastIndex(items: Array<any> | number): number;
|
|
382
|
+
/**
|
|
383
|
+
* 将稀疏数组中的空洞补成显式的 `undefined`。
|
|
384
|
+
*
|
|
385
|
+
* 注意:该函数会修改原数组,同时返回一个浅拷贝。
|
|
386
|
+
*
|
|
387
|
+
* @typeParam T 元素类型。
|
|
388
|
+
* @param arr 可能包含空洞的数组。
|
|
389
|
+
* @returns 返回浅拷贝后的数组。
|
|
390
|
+
*/
|
|
75
391
|
declare function $replaceHolesWithUndefined<T>(arr: Array<T | undefined>): Array<T | undefined>;
|
|
392
|
+
/**
|
|
393
|
+
* 将字符串稳定映射到 `[0, max)` 范围内的整数。
|
|
394
|
+
*
|
|
395
|
+
* @param str 源字符串。
|
|
396
|
+
* @param max 上界(不包含)。
|
|
397
|
+
* @returns 返回确定性的整数结果;即使字符串为空,也会得到合法范围内的值。
|
|
398
|
+
*/
|
|
76
399
|
declare function $stringToRange(str: string, max: number): number;
|
|
400
|
+
/**
|
|
401
|
+
* 去掉路径开头的 `/`。
|
|
402
|
+
*
|
|
403
|
+
* @param path 输入路径。
|
|
404
|
+
* @returns 如果路径有前导斜杠则返回去掉后的结果,否则原样返回。
|
|
405
|
+
*/
|
|
77
406
|
declare function $rmvSlash(path: string): string;
|
|
407
|
+
/**
|
|
408
|
+
* 解析紧凑编码的路径参数字符串。
|
|
409
|
+
*
|
|
410
|
+
* 规则:
|
|
411
|
+
* - 单个 `-` 表示参数分隔。
|
|
412
|
+
* - 双 `--` 表示字面量 `-`。
|
|
413
|
+
* - `_` 与 `%20` 会被还原为空格。
|
|
414
|
+
* - 双下划线 `__` 用于保留字面量下划线。
|
|
415
|
+
*
|
|
416
|
+
* @param path 编码后的路径字符串。
|
|
417
|
+
* @returns 返回解码后的参数数组。
|
|
418
|
+
*/
|
|
78
419
|
declare function $parseParams(path: string): (string | undefined)[];
|
|
420
|
+
/**
|
|
421
|
+
* 给数字或数字字符串添加千分位分隔符。
|
|
422
|
+
*
|
|
423
|
+
* @param num 数字或可转为字符串的数字值。
|
|
424
|
+
* @returns 返回带千分位逗号的字符串。
|
|
425
|
+
*/
|
|
79
426
|
declare function $formatWithCommas(num: number | string): string;
|
|
427
|
+
/**
|
|
428
|
+
* 校验邮箱地址是否符合支持 Unicode 字母的规则。
|
|
429
|
+
*
|
|
430
|
+
* @param email 待校验邮箱。
|
|
431
|
+
* @returns 符合规则时返回 `true`,否则返回 `false`。
|
|
432
|
+
*/
|
|
80
433
|
declare function $isValidEmailWithUnicode(email?: string): boolean;
|
|
434
|
+
/**
|
|
435
|
+
* 校验邮箱格式,不合法时直接抛错。
|
|
436
|
+
*
|
|
437
|
+
* @param email 待校验邮箱。
|
|
438
|
+
* @returns 合法时无返回值。
|
|
439
|
+
* @throws 当邮箱不合法时抛出错误。
|
|
440
|
+
*/
|
|
81
441
|
declare function $checkValidEmailWithUnicode(email?: string): void;
|
|
442
|
+
declare const shanghaiDateFormatter: Intl.DateTimeFormat;
|
|
443
|
+
/**
|
|
444
|
+
* 将日期输入格式化为 `YYYY年M月D日 HH:mm`。
|
|
445
|
+
*
|
|
446
|
+
* @param dateInput 任何可被 `Date` 构造函数接受的输入。
|
|
447
|
+
* @returns 返回格式化后的日期字符串。
|
|
448
|
+
*/
|
|
82
449
|
declare function $formatDate(dateInput: string | number | Date): string;
|
|
450
|
+
/**
|
|
451
|
+
* 将错误转换成一个始终包含 `msg` 字段的对象。
|
|
452
|
+
*
|
|
453
|
+
* @typeParam T 附加字段对象类型。
|
|
454
|
+
* @param error 错误来源。
|
|
455
|
+
* @param defVal 可选的附加字段对象。
|
|
456
|
+
* @returns 返回 `{ msg }` 或 `{ msg, ...defVal }`。
|
|
457
|
+
*/
|
|
83
458
|
declare function errCode<T extends Any>(error: any, defVal?: T): {
|
|
84
459
|
msg: string;
|
|
85
460
|
};
|
|
461
|
+
/**
|
|
462
|
+
* 抛出统一的“内容不正确”错误。
|
|
463
|
+
*
|
|
464
|
+
* @returns 不会返回。
|
|
465
|
+
* @throws 始终抛出错误。
|
|
466
|
+
*/
|
|
86
467
|
declare function errContent(): void;
|
|
468
|
+
/**
|
|
469
|
+
* 抛出统一的“参数不正确”错误。
|
|
470
|
+
*
|
|
471
|
+
* @returns 不会返回。
|
|
472
|
+
* @throws 始终抛出错误。
|
|
473
|
+
*/
|
|
87
474
|
declare function errArg(): void;
|
|
475
|
+
/**
|
|
476
|
+
* 抛出统一的“未登录”错误。
|
|
477
|
+
*
|
|
478
|
+
* @returns 不会返回。
|
|
479
|
+
* @throws 始终抛出错误。
|
|
480
|
+
*/
|
|
88
481
|
declare function errNotLoggedIn(): void;
|
|
482
|
+
/**
|
|
483
|
+
* 抛出统一的“没有权限”错误。
|
|
484
|
+
*
|
|
485
|
+
* @returns 不会返回。
|
|
486
|
+
* @throws 始终抛出错误。
|
|
487
|
+
*/
|
|
89
488
|
declare function err403(): void;
|
|
489
|
+
/**
|
|
490
|
+
* 判断当前 UTC 时间是否接近指定的 UTC 整点。
|
|
491
|
+
*
|
|
492
|
+
* 当前实现允许前后约 3 分钟误差,并处理跨天情况。
|
|
493
|
+
*
|
|
494
|
+
* @param targetHour 目标 UTC 小时,通常应在 `0-23` 范围内。
|
|
495
|
+
* @returns 如果当前 UTC 时间与目标小时足够接近,则返回 `true`。
|
|
496
|
+
*/
|
|
90
497
|
declare function isNowAroundUtcHour(targetHour: number): boolean;
|
|
91
498
|
/**
|
|
92
499
|
* 清洗 base64 输入,统一得到“纯 base64”(不含 data URL 前缀)。
|
|
@@ -129,7 +536,23 @@ declare const $getHue: (json: Object) => number;
|
|
|
129
536
|
declare const $borderColor: (json: any) => string;
|
|
130
537
|
declare const $backgroundColor: (json: any) => string;
|
|
131
538
|
|
|
539
|
+
/**
|
|
540
|
+
* 将当前历史记录替换为规范化后的路径。
|
|
541
|
+
*
|
|
542
|
+
* @param s 目标路径;如果没有以 `/` 开头会自动补上。
|
|
543
|
+
* @returns 无返回值。
|
|
544
|
+
*/
|
|
132
545
|
declare function web$setPathTarget(s: string): void;
|
|
546
|
+
/**
|
|
547
|
+
* 读取并规范化当前浏览器地址信息。
|
|
548
|
+
*
|
|
549
|
+
* 行为说明:
|
|
550
|
+
* - 会识别 `#/...` 这种 hash 路由跳转,并把地址改写成规范路径。
|
|
551
|
+
* - 会去掉 `path` 前导 `/` 以及结尾的 `.html` / `.htm`。
|
|
552
|
+
* - 会去掉 `search` 前面的 `?`。
|
|
553
|
+
*
|
|
554
|
+
* @returns 返回一个描述当前地址状态的对象,包含 `href`、`origin`、`target`、`host`、`path`、`search`、`standardJump` 等字段。
|
|
555
|
+
*/
|
|
133
556
|
declare function web$pathStartData(): {
|
|
134
557
|
href: string;
|
|
135
558
|
origin: string;
|
|
@@ -139,13 +562,74 @@ declare function web$pathStartData(): {
|
|
|
139
562
|
search: string;
|
|
140
563
|
standardJump: boolean;
|
|
141
564
|
};
|
|
565
|
+
/**
|
|
566
|
+
* 在浏览器中开启轻量级的生产环境防调试保护。
|
|
567
|
+
*
|
|
568
|
+
* 副作用包括:
|
|
569
|
+
* - 禁用右键菜单。
|
|
570
|
+
* - 阻止 `F12` 和 `Ctrl+Shift+I`。
|
|
571
|
+
* - 周期性检测开发者工具是否可能被打开,若触发则跳转离开当前页。
|
|
572
|
+
*
|
|
573
|
+
* @returns 无返回值;在服务端环境下不会执行任何逻辑。
|
|
574
|
+
*/
|
|
142
575
|
declare function web$enableProdProtector(): void;
|
|
576
|
+
/**
|
|
577
|
+
* 在浏览器环境下把 `http:` 页面自动重定向到 `https:`。
|
|
578
|
+
*
|
|
579
|
+
* 例外情况:
|
|
580
|
+
* - `localhost`
|
|
581
|
+
* - `127.0.0.1`
|
|
582
|
+
*
|
|
583
|
+
* @returns 无返回值。
|
|
584
|
+
*/
|
|
143
585
|
declare function web$enableHttpsRedirect(): void;
|
|
586
|
+
/**
|
|
587
|
+
* 将当前页面重定向到另一个域名,同时保留路径、查询参数和哈希。
|
|
588
|
+
*
|
|
589
|
+
* @param newDomain 目标域名,可以带或不带结尾斜杠。
|
|
590
|
+
* @returns 无返回值;在服务端环境下直接返回。
|
|
591
|
+
*/
|
|
144
592
|
declare function web$redirectToDomain(newDomain: string): void;
|
|
593
|
+
/**
|
|
594
|
+
* 将文本复制到系统剪贴板。
|
|
595
|
+
*
|
|
596
|
+
* 行为说明:
|
|
597
|
+
* - 会先对传入内容执行 `trim()`。
|
|
598
|
+
* - 优先使用 `navigator.clipboard.writeText`。
|
|
599
|
+
* - 现代剪贴板接口失败时会回退到 `$fallbackCopy`。
|
|
600
|
+
* - 非浏览器环境下返回 `undefined`。
|
|
601
|
+
*
|
|
602
|
+
* @param content 要复制的文本内容。
|
|
603
|
+
* @returns 成功时返回 `true`,回退复制失败时返回 `false`,非浏览器环境下返回 `undefined`。
|
|
604
|
+
*/
|
|
145
605
|
declare function $copy(content: string): Promise<boolean | undefined>;
|
|
606
|
+
/**
|
|
607
|
+
* 使用隐藏的 `<textarea>` 作为兼容方案执行复制。
|
|
608
|
+
*
|
|
609
|
+
* @param content 要复制的文本,会先被 `trim()` 处理。
|
|
610
|
+
* @returns 当 `document.execCommand('copy')` 返回成功时为 `true`,否则为 `false`。
|
|
611
|
+
*/
|
|
146
612
|
declare function $fallbackCopy(content: string): boolean;
|
|
613
|
+
/**
|
|
614
|
+
* 将当前页面的路径、查询参数和哈希编码成一个 URI 片段字符串。
|
|
615
|
+
*
|
|
616
|
+
* @param hash 可选的替代 hash;如果传入时没有 `#` 前缀会自动补上。
|
|
617
|
+
* @returns 编码后的 URI 组件字符串。
|
|
618
|
+
* @throws 在非浏览器环境中会抛出空字符串。
|
|
619
|
+
*/
|
|
147
620
|
declare function web$encodeURI(hash?: string): string;
|
|
148
621
|
declare const $compressImageDefaultOptions: Options;
|
|
622
|
+
/**
|
|
623
|
+
* 压缩 Base64 图片并以 data URL 形式返回。
|
|
624
|
+
*
|
|
625
|
+
* 说明:
|
|
626
|
+
* - 同时支持纯 Base64 和已有 data URL 两种输入。
|
|
627
|
+
* - 如果输入无法被规范化为合法 data URL,则返回空字符串。
|
|
628
|
+
*
|
|
629
|
+
* @param base64 输入的图片数据。
|
|
630
|
+
* @param options 可选压缩配置,会覆盖默认配置。
|
|
631
|
+
* @returns 返回压缩后的 data URL;如果输入无效则返回空字符串。
|
|
632
|
+
*/
|
|
149
633
|
declare function $compressImageBase64(base64: string, options?: Options): Promise<string>;
|
|
150
634
|
declare function $compressImage(file: File, options?: Options): Promise<File>;
|
|
151
635
|
declare function $compressImage(files: File[], options?: Options): Promise<File[]>;
|
|
@@ -230,6 +714,16 @@ declare const $Response: {
|
|
|
230
714
|
json(data: any, init?: ResponseInit): Response;
|
|
231
715
|
redirect(url: string | URL, status?: number): Response;
|
|
232
716
|
} | undefined;
|
|
717
|
+
/**
|
|
718
|
+
* 输出一个值到控制台,并原样返回该值。
|
|
719
|
+
*
|
|
720
|
+
* 适合在表达式链中做内联调试。
|
|
721
|
+
*
|
|
722
|
+
* @typeParam T 第一个参数的类型。
|
|
723
|
+
* @param a 主要输出值,同时也是返回值。
|
|
724
|
+
* @param x 其余会继续传给 `console.log` 的附加参数。
|
|
725
|
+
* @returns 原样返回传入的 `a`。
|
|
726
|
+
*/
|
|
233
727
|
declare const $log: <T>(a?: T, ...x: any[]) => T | undefined;
|
|
234
728
|
declare const $crypto: Crypto | undefined;
|
|
235
729
|
|
|
@@ -248,19 +742,50 @@ declare class Scaler {
|
|
|
248
742
|
set scaleComputer(val: ScaleComputer);
|
|
249
743
|
onMainScaleChange?: (scale: number) => void;
|
|
250
744
|
innerContainer: HTMLElement;
|
|
745
|
+
/**
|
|
746
|
+
* 创建内部缩放器状态对象。
|
|
747
|
+
*
|
|
748
|
+
* @param innerContainer 需要接收宽度与 transform 更新的内部元素。
|
|
749
|
+
*/
|
|
251
750
|
constructor(innerContainer: HTMLElement);
|
|
252
751
|
}
|
|
752
|
+
/**
|
|
753
|
+
* 为固定宽度的内部容器启用响应式缩放行为。
|
|
754
|
+
*
|
|
755
|
+
* 典型结构:
|
|
756
|
+
* - `outerContainer` 作为高度占位容器。
|
|
757
|
+
* - 第一个子元素或显式传入的 `innerContainer` 会通过 CSS transform 进行视觉缩放。
|
|
758
|
+
*
|
|
759
|
+
* 运行时行为:
|
|
760
|
+
* - 在非浏览器环境下会直接返回 `undefined`。
|
|
761
|
+
* - 如果无法解析出有效的内部容器,会直接抛错。
|
|
762
|
+
* - 会挂载 `resize` 和 `ResizeObserver` 监听。
|
|
763
|
+
*
|
|
764
|
+
* @param outerContainer 外层包裹元素。
|
|
765
|
+
* @param initer 可选初始化器,用于配置内部 `Scaler` 实例。
|
|
766
|
+
* @param innerContainer 可选的内部缩放元素,默认取 `outerContainer.children[0]`。
|
|
767
|
+
* @returns 在浏览器环境下返回包含 `resizer`、`clean`、`setBase` 方法的对象;否则返回 `undefined`。
|
|
768
|
+
*/
|
|
253
769
|
declare function enableScaler(outerContainer: HTMLElement, initer?: ScaleIniter, innerContainer?: HTMLElement): {
|
|
254
770
|
resizer: () => void;
|
|
255
771
|
clean: () => void;
|
|
256
772
|
setBase: (val: number) => void;
|
|
257
773
|
} | undefined;
|
|
258
774
|
/**
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
* @
|
|
775
|
+
* 构建一个适用于常见视口布局的标准缩放初始化器。
|
|
776
|
+
*
|
|
777
|
+
* 返回的初始化器会配置宽高测量元素,并根据可用宽度与可选的最大宽高比计算缩放比例。
|
|
778
|
+
*
|
|
779
|
+
* @param args 初始化配置项。
|
|
780
|
+
* @param args.maxAspectRatio 计算可用宽度时允许的最大 `width / height` 比例,默认 `Infinity`。
|
|
781
|
+
* @param args.setFullScreenWidth 可选回调,用于接收计算后的可用宽度。
|
|
782
|
+
* @param args.setFullContentHeight 可选回调,用于接收缩放后的虚拟内容高度。
|
|
783
|
+
* @param args.setMainScale 可选回调,在主缩放值变化时触发。
|
|
784
|
+
* @param args.offsetHorizontal 可选的水平补偿值。
|
|
785
|
+
* @param args.heightElement 可选高度测量元素,默认使用 `document.documentElement`。
|
|
786
|
+
* @param args.widthElement 可选宽度测量元素,默认使用 `document.documentElement`。
|
|
787
|
+
* @param args.base 可选基础内容宽度。
|
|
788
|
+
* @returns 返回一个可供 `enableScaler` 使用的 `ScaleIniter` 函数。
|
|
264
789
|
*/
|
|
265
790
|
declare const standardIniter: (args: {
|
|
266
791
|
maxAspectRatio?: number;
|
|
@@ -276,9 +801,45 @@ declare const standardIniter: (args: {
|
|
|
276
801
|
declare class StringObfuscator {
|
|
277
802
|
key: string;
|
|
278
803
|
length: number;
|
|
804
|
+
/**
|
|
805
|
+
* 创建一个基于 XOR + Base64 的字符串混淆器。
|
|
806
|
+
*
|
|
807
|
+
* @param key 用于逐字符 XOR 的密钥。
|
|
808
|
+
* @param length 可选的固定输出长度;传 `-1` 表示关闭固定长度模式。
|
|
809
|
+
*/
|
|
279
810
|
constructor(key: string, length?: number);
|
|
811
|
+
/**
|
|
812
|
+
* 用给定密钥对字符串的每个字符执行 XOR,必要时循环使用密钥。
|
|
813
|
+
*
|
|
814
|
+
* @param str 需要转换的源文本。
|
|
815
|
+
* @param key 循环参与 XOR 的密钥。
|
|
816
|
+
* @returns 返回 XOR 处理后的字符串;结果更像二进制文本,不保证可直接阅读。
|
|
817
|
+
*/
|
|
280
818
|
xors(str: string, key: string): string;
|
|
819
|
+
/**
|
|
820
|
+
* 将明文混淆成一个适合放在 URL 中的 Base64 风格字符串。
|
|
821
|
+
*
|
|
822
|
+
* 行为说明:
|
|
823
|
+
* - 固定长度模式下,输入会先用空格补齐再进行 XOR。
|
|
824
|
+
* - 结果会移除 `=` 补位,并把 `/` 替换为 `-`、`+` 替换为 `_`。
|
|
825
|
+
* - 固定长度模式下,Base64 输出还会被截断到配置长度。
|
|
826
|
+
*
|
|
827
|
+
* @param input 要混淆的明文。
|
|
828
|
+
* @returns 返回适合常见 URL/路径场景使用的混淆字符串。
|
|
829
|
+
*/
|
|
281
830
|
en(input: string): string;
|
|
831
|
+
/**
|
|
832
|
+
* 从混淆字符串中恢复原始明文。
|
|
833
|
+
*
|
|
834
|
+
* 说明:
|
|
835
|
+
* - 会先把 URL 安全替换恢复后再做 Base64 解码。
|
|
836
|
+
* - 反混淆后会去掉尾部空格,这对固定长度模式很重要。
|
|
837
|
+
* - 如果输入格式不正确,底层解码步骤可能会抛错。
|
|
838
|
+
*
|
|
839
|
+
* @param obfuscated 由 `en` 生成的混淆字符串。
|
|
840
|
+
* @returns 返回解码后的原文,尾部补位空格会被移除。
|
|
841
|
+
* @throws 输入无效时会继续向外抛出底层解码错误。
|
|
842
|
+
*/
|
|
282
843
|
de(obfuscated: string): string;
|
|
283
844
|
}
|
|
284
845
|
|
|
@@ -305,77 +866,75 @@ declare let _res: (x: string) => string;
|
|
|
305
866
|
declare function __GensDirectives(): Items<(...args: string[]) => string>;
|
|
306
867
|
|
|
307
868
|
/**
|
|
308
|
-
*
|
|
309
|
-
* @param name
|
|
310
|
-
* @param color
|
|
869
|
+
* 注册一个自定义颜色别名。
|
|
870
|
+
* @param name 别名名称,例如 `abc`、`myColor`。
|
|
871
|
+
* @param color 别名实际映射到的合法颜色字符串,例如 `#ff0000`、`red`。
|
|
311
872
|
*/
|
|
312
873
|
declare function registerCustomColor(name: string, color: string): void;
|
|
313
874
|
/**
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* -
|
|
317
|
-
* -
|
|
318
|
-
* -
|
|
319
|
-
* -
|
|
875
|
+
* 智能解析颜色字符串。
|
|
876
|
+
* 支持:
|
|
877
|
+
* - 通过 culori 解析所有标准 CSS 颜色(名称、hex、rgb、hsl、oklch 等)。
|
|
878
|
+
* - 不带 `#` 的十六进制字符串(如 `ff5555`、`abc`、`aabbccdd`)。
|
|
879
|
+
* - 通过 `registerCustomColor` 注册的自定义别名。
|
|
880
|
+
* - 已经是 `Color` 对象的输入(直接透传)。
|
|
320
881
|
*
|
|
321
|
-
* @param input
|
|
322
|
-
* @param fallback
|
|
323
|
-
* @returns
|
|
882
|
+
* @param input 要解析的颜色字符串或 `Color` 对象。
|
|
883
|
+
* @param fallback 解析失败时可选的兜底颜色字符串。
|
|
884
|
+
* @returns 解析成功时返回 `Color` 对象,失败时返回 `undefined`。
|
|
324
885
|
*/
|
|
325
886
|
declare function smartParse(input: string | Color | any, fallback?: string): Color | undefined;
|
|
326
887
|
/**
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
* @param input
|
|
888
|
+
* 智能解析颜色并返回对应的 CSS 字符串。
|
|
889
|
+
* 对 sRGB 颜色通常会输出 Hex,其它颜色空间可能输出 CSS 函数形式(如 oklch)。
|
|
890
|
+
* @param input 颜色字符串或颜色对象。
|
|
330
891
|
*/
|
|
331
892
|
declare function smartString(input: string | Color | any, fallback?: string): string | undefined;
|
|
332
893
|
/**
|
|
333
|
-
*
|
|
334
|
-
* @param input
|
|
894
|
+
* 智能判断一个颜色输入是否有效。
|
|
895
|
+
* @param input 颜色字符串或颜色对象。
|
|
335
896
|
*/
|
|
336
897
|
declare function isValidColor(input: string | Color | any): boolean;
|
|
337
898
|
/**
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
899
|
+
* 计算颜色的亮度。
|
|
900
|
+
* 使用 Rec. 601 亮度公式:`(R * 299 + G * 587 + B * 114) / 1000`。
|
|
901
|
+
* 返回值范围通常在 0(黑)到 1(白)之间。
|
|
341
902
|
*
|
|
342
|
-
* @param input
|
|
343
|
-
* @returns
|
|
903
|
+
* @param input 要检测的颜色字符串或对象。
|
|
904
|
+
* @returns 返回亮度值(0-1);如果颜色无效则返回 `0`。
|
|
344
905
|
*/
|
|
345
906
|
declare function getBrightness(input: string | Color | any): number;
|
|
346
907
|
/**
|
|
347
|
-
*
|
|
348
|
-
* RGB
|
|
908
|
+
* 将颜色转换为 RGBA 数组 `[r, g, b, a]`。
|
|
909
|
+
* 其中 RGB 范围是 0-255,Alpha 范围是 0-1。
|
|
349
910
|
*
|
|
350
|
-
* @param input
|
|
351
|
-
* @returns [r, g, b, a]
|
|
911
|
+
* @param input 要转换的颜色字符串或对象。
|
|
912
|
+
* @returns 转换成功时返回 `[r, g, b, a]`,无效时返回 `undefined`。
|
|
352
913
|
*/
|
|
353
914
|
declare function toRgbaArray(input: string | Color | any): [number, number, number, number] | undefined;
|
|
354
915
|
/**
|
|
355
|
-
*
|
|
356
|
-
* @param input
|
|
357
|
-
* @returns
|
|
916
|
+
* 将颜色转换为 Hex 字符串。
|
|
917
|
+
* @param input 颜色字符串或颜色对象。
|
|
918
|
+
* @returns 成功时返回如 `#ff0000` 这样的字符串,失败时返回 `undefined`。
|
|
358
919
|
*/
|
|
359
920
|
declare function toHexString(input: string | Color | any): string | undefined;
|
|
360
921
|
/**
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
* Note: culori's formatRgb might use space-separated syntax (CSS Color 4).
|
|
364
|
-
* This function forces comma-separated legacy syntax: rgb(r, g, b) or rgba(r, g, b, a).
|
|
922
|
+
* 将颜色转换为 RGB/RGBA 字符串。
|
|
923
|
+
* 为兼容性考虑,这里强制输出旧式逗号分隔语法:`rgb(r, g, b)` 或 `rgba(r, g, b, a)`。
|
|
365
924
|
*
|
|
366
|
-
* @param input
|
|
367
|
-
* @returns RGB/RGBA
|
|
925
|
+
* @param input 颜色字符串或颜色对象。
|
|
926
|
+
* @returns 成功时返回 RGB/RGBA 字符串,失败时返回 `undefined`。
|
|
368
927
|
*/
|
|
369
928
|
declare function toRgbString(input: string | Color | any): string | undefined;
|
|
370
929
|
/**
|
|
371
|
-
*
|
|
372
|
-
*
|
|
930
|
+
* 将颜色转换为 HSL/HSLA 字符串。
|
|
931
|
+
* 这里强制输出旧式逗号分隔语法:`hsl(h, s%, l%)` 或 `hsla(h, s%, l%, a)`。
|
|
373
932
|
*
|
|
374
|
-
* @param input
|
|
375
|
-
* @returns HSL/HSLA
|
|
933
|
+
* @param input 颜色字符串或颜色对象。
|
|
934
|
+
* @returns 成功时返回 HSL/HSLA 字符串,失败时返回 `undefined`。
|
|
376
935
|
*/
|
|
377
936
|
declare function toHslString(input: string | Color | any): string | undefined;
|
|
378
937
|
|
|
379
|
-
declare const DOZY = "1.0.
|
|
938
|
+
declare const DOZY = "1.0.69";
|
|
380
939
|
|
|
381
|
-
export { $Headers, $Request, $Response, $URL, $URLSearchParams, $arrayFrom, $arrayIsArray, $assign, $backgroundColor, $borderColor, $capitalize, $checkValidEmailWithUnicode, $clamp, $clearInterval, $clearTimeout, $clone, $compressImage, $compressImageBase64, $compressImageDefaultOptions, $copy, $crypto, $date, $decodeBase64ToBinary, $decodeBase64ToUnicode, $deepClone, $defineProperty, $document, $encodeUnicodeToBase64, $entries, $escapeHTML, $fallbackCopy, $fetch, $fileToBase64, $formatDate, $formatWithCommas, $freeze, $genSSF, $getFileType, $getHue, $getTimeString, $hasKey, $if, $inRange, $inRange2, $inferMimeTypeFormPureBase64, $is, $isObject, $isPlainClass, $isValidEmailWithUnicode, $isValidOrBriefURL, $jsonParse, $jsonStringify, $keys, $lastIndex, $lindex, $loadOpt, $location, $log, $lplus, $magic, $math, $now, $numberIsFinite, $numberIsNaN, $oc, $open, $parseParams, $promise, $pureText, $purifyBase64, $randomByte, $replaceHolesWithUndefined, $rmvSlash, $rsValue, $rsetValue, $rvalue, $s, $sc, $setInterval, $setRange, $setTimeout, $stringFromCharCode, $stringFromCodePoint, $stringToRange, $strings, $toDataUrlFromBase64, $validName, $values, $window, type Any, type Atoa, type Coord, type Coord3, DOZY, type DozyConfig, type DozyConfigItem, type FileType, Gens, type Hel, type IOpt, type Items, type Null, type Nullable, RainbowGen, type ScaleComputer, type ScaleIniter, StringObfuscator, type UNumber, __GensDirectives, _res, boxShadow, dozy, enableScaler, err403, errArg, errCode, errContent, errMsg, errNotLoggedIn, errToString, getBrightness, getColorMap, isNowAroundUtcHour, isNull, isValidColor, maybeString, registerCustomColor, s, smallChance, smartParse, smartString, standardIniter, textShadow, toHexString, toHslString, toRgbString, toRgbaArray, web$enableHttpsRedirect, web$enableProdProtector, web$encodeURI, web$pathStartData, web$redirectToDomain, web$setPathTarget, xtrim };
|
|
940
|
+
export { $Headers, $Request, $Response, $URL, $URLSearchParams, $arrayFrom, $arrayIsArray, $assign, $backgroundColor, $borderColor, $capitalize, $checkValidEmailWithUnicode, $clamp, $clearInterval, $clearTimeout, $clone, $compressImage, $compressImageBase64, $compressImageDefaultOptions, $copy, $crypto, $date, $decodeBase64ToBinary, $decodeBase64ToUnicode, $deepClone, $defineProperty, $document, $encodeUnicodeToBase64, $entries, $escapeHTML, $fallbackCopy, $fetch, $fileToBase64, $formatDate, $formatWithCommas, $freeze, $genSSF, $getFileType, $getHue, $getTimeString, $hasKey, $if, $inRange, $inRange2, $inferMimeTypeFormPureBase64, $is, $isObject, $isPlainClass, $isValidEmailWithUnicode, $isValidOrBriefURL, $jsonParse, $jsonStringify, $keys, $lastIndex, $lindex, $loadOpt, $location, $log, $lplus, $magic, $math, $now, $numberIsFinite, $numberIsNaN, $oc, $open, $parseParams, $promise, $pureText, $purifyBase64, $randomByte, $replaceHolesWithUndefined, $rmvSlash, $rsValue, $rsetValue, $rvalue, $s, $sc, $setInterval, $setRange, $setTimeout, $stringFromCharCode, $stringFromCodePoint, $stringToRange, $strings, $toDataUrlFromBase64, $validName, $values, $window, type Any, type Atoa, type Coord, type Coord3, DOZY, type DozyConfig, type DozyConfigItem, type FileType, Gens, type Hel, type IOpt, type Items, type Null, type Nullable, RainbowGen, type ScaleComputer, type ScaleIniter, StringObfuscator, type UNumber, __GensDirectives, _res, boxShadow, dozy, enableScaler, err403, errArg, errCode, errContent, errMsg, errNotLoggedIn, errToString, getBrightness, getColorMap, isNowAroundUtcHour, isNull, isValidColor, maybeString, registerCustomColor, s, shanghaiDateFormatter, smallChance, smartParse, smartString, standardIniter, textShadow, toHexString, toHslString, toRgbString, toRgbaArray, web$enableHttpsRedirect, web$enableProdProtector, web$encodeURI, web$pathStartData, web$redirectToDomain, web$setPathTarget, xtrim };
|