sculp-js 0.0.1 → 0.0.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/lib/cjs/index.js +74 -14
- package/lib/es/index.js +14 -28
- package/lib/index.d.ts +1 -140
- package/lib/umd/index.js +74 -145
- package/package.json +6 -3
package/lib/cjs/index.js
CHANGED
|
@@ -24,18 +24,78 @@ var watermark = require('./watermark.js');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
27
|
+
exports.arrayEach = array.arrayEach;
|
|
28
|
+
exports.arrayEachAsync = array.arrayEachAsync;
|
|
29
|
+
exports.arrayInsertBefore = array.arrayInsertBefore;
|
|
30
|
+
exports.arrayLike = array.arrayLike;
|
|
31
|
+
exports.arrayRemove = array.arrayRemove;
|
|
32
|
+
exports.asyncForEach = array.asyncForEach;
|
|
33
|
+
exports.deepTraversal = array.deepTraversal;
|
|
34
|
+
exports.getTreeIds = array.getTreeIds;
|
|
35
|
+
exports.copyText = clipboard.copyText;
|
|
36
|
+
exports.cookieDel = cookie.cookieDel;
|
|
37
|
+
exports.cookieGet = cookie.cookieGet;
|
|
38
|
+
exports.cookieSet = cookie.cookieSet;
|
|
39
|
+
exports.calculateDate = date.calculateDate;
|
|
40
|
+
exports.calculateDateTime = date.calculateDateTime;
|
|
41
|
+
exports.formatDate = date.formatDate;
|
|
42
|
+
exports.addClass = dom.addClass;
|
|
43
|
+
exports.getStyle = dom.getStyle;
|
|
44
|
+
exports.hasClass = dom.hasClass;
|
|
45
|
+
exports.isDomReady = dom.isDomReady;
|
|
46
|
+
exports.onDomReady = dom.onDomReady;
|
|
47
|
+
exports.removeClass = dom.removeClass;
|
|
48
|
+
exports.setStyle = dom.setStyle;
|
|
49
|
+
exports.smoothScroll = dom.smoothScroll;
|
|
50
|
+
exports.downloadBlob = download.downloadBlob;
|
|
51
|
+
exports.downloadData = download.downloadData;
|
|
52
|
+
exports.downloadHref = download.downloadHref;
|
|
53
|
+
exports.downloadURL = download.downloadURL;
|
|
54
|
+
exports.cloneDeep = object.cloneDeep;
|
|
55
|
+
exports.isPlainObject = object.isPlainObject;
|
|
56
|
+
exports.objectAssign = object.objectAssign;
|
|
57
|
+
exports.objectEach = object.objectEach;
|
|
58
|
+
exports.objectEachAsync = object.objectEachAsync;
|
|
59
|
+
exports.objectFill = object.objectFill;
|
|
60
|
+
exports.objectGet = object.objectGet;
|
|
61
|
+
exports.objectHas = object.objectHas;
|
|
62
|
+
exports.objectMap = object.objectMap;
|
|
63
|
+
exports.objectMerge = object.objectAssign;
|
|
64
|
+
exports.objectOmit = object.objectOmit;
|
|
65
|
+
exports.objectPick = object.objectPick;
|
|
66
|
+
exports.pathJoin = path.pathJoin;
|
|
67
|
+
exports.pathNormalize = path.pathNormalize;
|
|
68
|
+
exports.qsParse = qs.qsParse;
|
|
69
|
+
exports.qsStringify = qs.qsStringify;
|
|
70
|
+
exports.STRING_ARABIC_NUMERALS = string.STRING_ARABIC_NUMERALS;
|
|
71
|
+
exports.STRING_LOWERCASE_ALPHA = string.STRING_LOWERCASE_ALPHA;
|
|
72
|
+
exports.STRING_UPPERCASE_ALPHA = string.STRING_UPPERCASE_ALPHA;
|
|
73
|
+
exports.stringAssign = string.stringAssign;
|
|
74
|
+
exports.stringCamelCase = string.stringCamelCase;
|
|
75
|
+
exports.stringEscapeHtml = string.stringEscapeHtml;
|
|
76
|
+
exports.stringFill = string.stringFill;
|
|
77
|
+
exports.stringFormat = string.stringFormat;
|
|
78
|
+
exports.stringKebabCase = string.stringKebabCase;
|
|
79
|
+
exports.isArray = type.isArray;
|
|
80
|
+
exports.isBigInt = type.isBigInt;
|
|
81
|
+
exports.isBoolean = type.isBoolean;
|
|
82
|
+
exports.isDate = type.isDate;
|
|
83
|
+
exports.isError = type.isError;
|
|
84
|
+
exports.isFunction = type.isFunction;
|
|
85
|
+
exports.isNaN = type.isNaN;
|
|
86
|
+
exports.isNull = type.isNull;
|
|
87
|
+
exports.isNumber = type.isNumber;
|
|
88
|
+
exports.isObject = type.isObject;
|
|
89
|
+
exports.isPrimitive = type.isPrimitive;
|
|
90
|
+
exports.isRegExp = type.isRegExp;
|
|
91
|
+
exports.isString = type.isString;
|
|
92
|
+
exports.isSymbol = type.isSymbol;
|
|
93
|
+
exports.isUndefined = type.isUndefined;
|
|
94
|
+
exports.urlDelParams = url.urlDelParams;
|
|
95
|
+
exports.urlParse = url.urlParse;
|
|
96
|
+
exports.urlSetParams = url.urlSetParams;
|
|
97
|
+
exports.urlStringify = url.urlStringify;
|
|
98
|
+
exports.asyncMap = async.asyncMap;
|
|
99
|
+
exports.wait = async.wait;
|
|
100
|
+
exports.chooseLocalFile = file.chooseLocalFile;
|
|
41
101
|
exports.genCanvasWM = watermark.genCanvasWM;
|
package/lib/es/index.js
CHANGED
|
@@ -4,32 +4,18 @@
|
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
|
|
20
|
-
export {
|
|
21
|
-
import * as path from './path.js';
|
|
22
|
-
export { path };
|
|
23
|
-
import * as qs from './qs.js';
|
|
24
|
-
export { qs };
|
|
25
|
-
import * as string from './string.js';
|
|
26
|
-
export { string };
|
|
27
|
-
import * as type from './type.js';
|
|
28
|
-
export { type };
|
|
29
|
-
import * as url from './url.js';
|
|
30
|
-
export { url };
|
|
31
|
-
import * as async from './async.js';
|
|
32
|
-
export { async };
|
|
33
|
-
import * as file from './file.js';
|
|
34
|
-
export { file };
|
|
7
|
+
export { arrayEach, arrayEachAsync, arrayInsertBefore, arrayLike, arrayRemove, asyncForEach, deepTraversal, getTreeIds } from './array.js';
|
|
8
|
+
export { copyText } from './clipboard.js';
|
|
9
|
+
export { cookieDel, cookieGet, cookieSet } from './cookie.js';
|
|
10
|
+
export { calculateDate, calculateDateTime, formatDate } from './date.js';
|
|
11
|
+
export { addClass, getStyle, hasClass, isDomReady, onDomReady, removeClass, setStyle, smoothScroll } from './dom.js';
|
|
12
|
+
export { downloadBlob, downloadData, downloadHref, downloadURL } from './download.js';
|
|
13
|
+
export { cloneDeep, isPlainObject, objectAssign, objectEach, objectEachAsync, objectFill, objectGet, objectHas, objectMap, objectAssign as objectMerge, objectOmit, objectPick } from './object.js';
|
|
14
|
+
export { pathJoin, pathNormalize } from './path.js';
|
|
15
|
+
export { qsParse, qsStringify } from './qs.js';
|
|
16
|
+
export { STRING_ARABIC_NUMERALS, STRING_LOWERCASE_ALPHA, STRING_UPPERCASE_ALPHA, stringAssign, stringCamelCase, stringEscapeHtml, stringFill, stringFormat, stringKebabCase } from './string.js';
|
|
17
|
+
export { isArray, isBigInt, isBoolean, isDate, isError, isFunction, isNaN, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isUndefined } from './type.js';
|
|
18
|
+
export { urlDelParams, urlParse, urlSetParams, urlStringify } from './url.js';
|
|
19
|
+
export { asyncMap, wait } from './async.js';
|
|
20
|
+
export { chooseLocalFile } from './file.js';
|
|
35
21
|
export { genCanvasWM } from './watermark.js';
|
package/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ type AnyObject = Record<string | number, any>;
|
|
|
5
5
|
type PartialDeep<T> = {
|
|
6
6
|
[P in keyof T]?: PartialDeep<T[P]>;
|
|
7
7
|
};
|
|
8
|
-
declare const typeIs: (any: unknown) => string;
|
|
9
8
|
declare const isString: (any: unknown) => any is string;
|
|
10
9
|
declare const isBoolean: (any: unknown) => any is boolean;
|
|
11
10
|
declare const isSymbol: (any: unknown) => any is symbol;
|
|
@@ -22,30 +21,6 @@ declare const isDate: (any: unknown) => any is Date;
|
|
|
22
21
|
declare const isError: (any: unknown) => any is Error;
|
|
23
22
|
declare const isRegExp: (any: unknown) => any is RegExp;
|
|
24
23
|
|
|
25
|
-
type type_AnyArray = AnyArray;
|
|
26
|
-
type type_AnyFunc<R = any> = AnyFunc<R>;
|
|
27
|
-
type type_AnyObject = AnyObject;
|
|
28
|
-
type type_ArrayElements<A> = ArrayElements<A>;
|
|
29
|
-
type type_PartialDeep<T> = PartialDeep<T>;
|
|
30
|
-
declare const type_isArray: typeof isArray;
|
|
31
|
-
declare const type_isBigInt: typeof isBigInt;
|
|
32
|
-
declare const type_isBoolean: typeof isBoolean;
|
|
33
|
-
declare const type_isDate: typeof isDate;
|
|
34
|
-
declare const type_isError: typeof isError;
|
|
35
|
-
declare const type_isFunction: typeof isFunction;
|
|
36
|
-
declare const type_isNaN: typeof isNaN;
|
|
37
|
-
declare const type_isNull: typeof isNull;
|
|
38
|
-
declare const type_isNumber: typeof isNumber;
|
|
39
|
-
declare const type_isObject: typeof isObject;
|
|
40
|
-
declare const type_isPrimitive: typeof isPrimitive;
|
|
41
|
-
declare const type_isRegExp: typeof isRegExp;
|
|
42
|
-
declare const type_isString: typeof isString;
|
|
43
|
-
declare const type_isSymbol: typeof isSymbol;
|
|
44
|
-
declare const type_isUndefined: typeof isUndefined;
|
|
45
|
-
declare namespace type {
|
|
46
|
-
export { type type_AnyArray as AnyArray, type type_AnyFunc as AnyFunc, type type_AnyObject as AnyObject, type type_ArrayElements as ArrayElements, type type_PartialDeep as PartialDeep, typeIs as default, type_isArray as isArray, type_isBigInt as isBigInt, type_isBoolean as isBoolean, type_isDate as isDate, type_isError as isError, type_isFunction as isFunction, type_isNaN as isNaN, type_isNull as isNull, type_isNumber as isNumber, type_isObject as isObject, type_isPrimitive as isPrimitive, type_isRegExp as isRegExp, type_isString as isString, type_isSymbol as isSymbol, type_isUndefined as isUndefined };
|
|
47
|
-
}
|
|
48
|
-
|
|
49
24
|
/**
|
|
50
25
|
* 判断一个对象是否为类数组
|
|
51
26
|
* @param any
|
|
@@ -126,29 +101,12 @@ declare function getTreeIds<V>(tree: ArrayLike<V>, nodeId: IdLike, config?: ITre
|
|
|
126
101
|
*/
|
|
127
102
|
declare function asyncForEach(array: any[], callback: Function): Promise<void>;
|
|
128
103
|
|
|
129
|
-
declare const array_arrayEach: typeof arrayEach;
|
|
130
|
-
declare const array_arrayEachAsync: typeof arrayEachAsync;
|
|
131
|
-
declare const array_arrayInsertBefore: typeof arrayInsertBefore;
|
|
132
|
-
declare const array_arrayLike: typeof arrayLike;
|
|
133
|
-
declare const array_arrayRemove: typeof arrayRemove;
|
|
134
|
-
declare const array_asyncForEach: typeof asyncForEach;
|
|
135
|
-
declare const array_deepTraversal: typeof deepTraversal;
|
|
136
|
-
declare const array_getTreeIds: typeof getTreeIds;
|
|
137
|
-
declare namespace array {
|
|
138
|
-
export { array_arrayEach as arrayEach, array_arrayEachAsync as arrayEachAsync, array_arrayInsertBefore as arrayInsertBefore, array_arrayLike as arrayLike, array_arrayRemove as arrayRemove, array_asyncForEach as asyncForEach, array_deepTraversal as deepTraversal, array_getTreeIds as getTreeIds };
|
|
139
|
-
}
|
|
140
|
-
|
|
141
104
|
/**
|
|
142
105
|
* 复制文本
|
|
143
106
|
* @param {string} text
|
|
144
107
|
*/
|
|
145
108
|
declare const copyText: (text: string) => void;
|
|
146
109
|
|
|
147
|
-
declare const clipboard_copyText: typeof copyText;
|
|
148
|
-
declare namespace clipboard {
|
|
149
|
-
export { clipboard_copyText as copyText };
|
|
150
|
-
}
|
|
151
|
-
|
|
152
110
|
/**
|
|
153
111
|
* 获取cookie
|
|
154
112
|
* @param {string} name
|
|
@@ -168,13 +126,6 @@ declare const cookieSet: (name: string, value: string, maxAge?: number | Date) =
|
|
|
168
126
|
*/
|
|
169
127
|
declare const cookieDel: (name: string) => void;
|
|
170
128
|
|
|
171
|
-
declare const cookie_cookieDel: typeof cookieDel;
|
|
172
|
-
declare const cookie_cookieGet: typeof cookieGet;
|
|
173
|
-
declare const cookie_cookieSet: typeof cookieSet;
|
|
174
|
-
declare namespace cookie {
|
|
175
|
-
export { cookie_cookieDel as cookieDel, cookie_cookieGet as cookieGet, cookie_cookieSet as cookieSet };
|
|
176
|
-
}
|
|
177
|
-
|
|
178
129
|
/**
|
|
179
130
|
* 格式化为日期对象(带自定义格式化模板)
|
|
180
131
|
* @param {DateValue} value 可以是数值、字符串或 Date 对象
|
|
@@ -210,13 +161,6 @@ declare function calculateDate(strDate: string, n: number, sep?: string): string
|
|
|
210
161
|
*/
|
|
211
162
|
declare function calculateDateTime(n: number, dateSep?: string, timeSep?: string): string;
|
|
212
163
|
|
|
213
|
-
declare const date_calculateDate: typeof calculateDate;
|
|
214
|
-
declare const date_calculateDateTime: typeof calculateDateTime;
|
|
215
|
-
declare const date_formatDate: typeof formatDate;
|
|
216
|
-
declare namespace date {
|
|
217
|
-
export { date_calculateDate as calculateDate, date_calculateDateTime as calculateDateTime, date_formatDate as formatDate };
|
|
218
|
-
}
|
|
219
|
-
|
|
220
164
|
type EasingName = 'ease' | 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | string;
|
|
221
165
|
|
|
222
166
|
interface Style {
|
|
@@ -271,18 +215,6 @@ type ReadyCallback = () => void;
|
|
|
271
215
|
declare function isDomReady(): boolean;
|
|
272
216
|
declare function onDomReady(callback: ReadyCallback): void;
|
|
273
217
|
|
|
274
|
-
declare const dom_addClass: typeof addClass;
|
|
275
|
-
declare const dom_getStyle: typeof getStyle;
|
|
276
|
-
declare const dom_hasClass: typeof hasClass;
|
|
277
|
-
declare const dom_isDomReady: typeof isDomReady;
|
|
278
|
-
declare const dom_onDomReady: typeof onDomReady;
|
|
279
|
-
declare const dom_removeClass: typeof removeClass;
|
|
280
|
-
declare const dom_setStyle: typeof setStyle;
|
|
281
|
-
declare const dom_smoothScroll: typeof smoothScroll;
|
|
282
|
-
declare namespace dom {
|
|
283
|
-
export { dom_addClass as addClass, dom_getStyle as getStyle, dom_hasClass as hasClass, dom_isDomReady as isDomReady, dom_onDomReady as onDomReady, dom_removeClass as removeClass, dom_setStyle as setStyle, dom_smoothScroll as smoothScroll };
|
|
284
|
-
}
|
|
285
|
-
|
|
286
218
|
interface Params<T = string | number> {
|
|
287
219
|
[key: string]: T | Array<T>;
|
|
288
220
|
}
|
|
@@ -305,16 +237,6 @@ type Replacer = (value: LooseParamValue) => string | null;
|
|
|
305
237
|
*/
|
|
306
238
|
declare const qsStringify: (query: LooseParams, replacer?: Replacer) => string;
|
|
307
239
|
|
|
308
|
-
type qs_LooseParamValue = LooseParamValue;
|
|
309
|
-
type qs_LooseParams<T = LooseParamValue> = LooseParams<T>;
|
|
310
|
-
type qs_Params<T = string | number> = Params<T>;
|
|
311
|
-
type qs_Replacer = Replacer;
|
|
312
|
-
declare const qs_qsParse: typeof qsParse;
|
|
313
|
-
declare const qs_qsStringify: typeof qsStringify;
|
|
314
|
-
declare namespace qs {
|
|
315
|
-
export { type qs_LooseParamValue as LooseParamValue, type qs_LooseParams as LooseParams, type qs_Params as Params, type qs_Replacer as Replacer, qs_qsParse as qsParse, qs_qsStringify as qsStringify };
|
|
316
|
-
}
|
|
317
|
-
|
|
318
240
|
/**
|
|
319
241
|
* 通过打开新窗口的方式下载
|
|
320
242
|
* @param {string} url
|
|
@@ -343,14 +265,6 @@ type FileType = 'json' | 'csv' | 'xls' | 'xlsx';
|
|
|
343
265
|
*/
|
|
344
266
|
declare const downloadData: (data: AnyObject | AnyObject[], fileType: FileType, filename: string, headers?: string[]) => void;
|
|
345
267
|
|
|
346
|
-
declare const download_downloadBlob: typeof downloadBlob;
|
|
347
|
-
declare const download_downloadData: typeof downloadData;
|
|
348
|
-
declare const download_downloadHref: typeof downloadHref;
|
|
349
|
-
declare const download_downloadURL: typeof downloadURL;
|
|
350
|
-
declare namespace download {
|
|
351
|
-
export { download_downloadBlob as downloadBlob, download_downloadData as downloadData, download_downloadHref as downloadHref, download_downloadURL as downloadURL };
|
|
352
|
-
}
|
|
353
|
-
|
|
354
268
|
/**
|
|
355
269
|
* 判断对象是否为纯对象
|
|
356
270
|
* @param {object} obj
|
|
@@ -427,21 +341,6 @@ declare function objectGet(obj: AnyObject, path: string, strict?: boolean): {
|
|
|
427
341
|
*/
|
|
428
342
|
declare function cloneDeep(obj: Object, map?: WeakMap<WeakKey, any>): Object;
|
|
429
343
|
|
|
430
|
-
declare const object_cloneDeep: typeof cloneDeep;
|
|
431
|
-
declare const object_isPlainObject: typeof isPlainObject;
|
|
432
|
-
declare const object_objectAssign: typeof objectAssign;
|
|
433
|
-
declare const object_objectEach: typeof objectEach;
|
|
434
|
-
declare const object_objectEachAsync: typeof objectEachAsync;
|
|
435
|
-
declare const object_objectFill: typeof objectFill;
|
|
436
|
-
declare const object_objectGet: typeof objectGet;
|
|
437
|
-
declare const object_objectHas: typeof objectHas;
|
|
438
|
-
declare const object_objectMap: typeof objectMap;
|
|
439
|
-
declare const object_objectOmit: typeof objectOmit;
|
|
440
|
-
declare const object_objectPick: typeof objectPick;
|
|
441
|
-
declare namespace object {
|
|
442
|
-
export { object_cloneDeep as cloneDeep, object_isPlainObject as isPlainObject, object_objectAssign as objectAssign, object_objectEach as objectEach, object_objectEachAsync as objectEachAsync, object_objectFill as objectFill, object_objectGet as objectGet, object_objectHas as objectHas, object_objectMap as objectMap, objectAssign as objectMerge, object_objectOmit as objectOmit, object_objectPick as objectPick };
|
|
443
|
-
}
|
|
444
|
-
|
|
445
344
|
/**
|
|
446
345
|
* 标准化路径
|
|
447
346
|
* @param {string} path
|
|
@@ -456,12 +355,6 @@ declare const pathNormalize: (path: string) => string;
|
|
|
456
355
|
*/
|
|
457
356
|
declare const pathJoin: (from: string, ...to: string[]) => string;
|
|
458
357
|
|
|
459
|
-
declare const path_pathJoin: typeof pathJoin;
|
|
460
|
-
declare const path_pathNormalize: typeof pathNormalize;
|
|
461
|
-
declare namespace path {
|
|
462
|
-
export { path_pathJoin as pathJoin, path_pathNormalize as pathNormalize };
|
|
463
|
-
}
|
|
464
|
-
|
|
465
358
|
/**
|
|
466
359
|
* 将字符串转换为驼峰格式
|
|
467
360
|
* @param {string} string
|
|
@@ -522,19 +415,6 @@ declare const stringEscapeHtml: (html: string) => string;
|
|
|
522
415
|
*/
|
|
523
416
|
declare const stringFill: (length: number, value?: string) => string;
|
|
524
417
|
|
|
525
|
-
declare const string_STRING_ARABIC_NUMERALS: typeof STRING_ARABIC_NUMERALS;
|
|
526
|
-
declare const string_STRING_LOWERCASE_ALPHA: typeof STRING_LOWERCASE_ALPHA;
|
|
527
|
-
declare const string_STRING_UPPERCASE_ALPHA: typeof STRING_UPPERCASE_ALPHA;
|
|
528
|
-
declare const string_stringAssign: typeof stringAssign;
|
|
529
|
-
declare const string_stringCamelCase: typeof stringCamelCase;
|
|
530
|
-
declare const string_stringEscapeHtml: typeof stringEscapeHtml;
|
|
531
|
-
declare const string_stringFill: typeof stringFill;
|
|
532
|
-
declare const string_stringFormat: typeof stringFormat;
|
|
533
|
-
declare const string_stringKebabCase: typeof stringKebabCase;
|
|
534
|
-
declare namespace string {
|
|
535
|
-
export { string_STRING_ARABIC_NUMERALS as STRING_ARABIC_NUMERALS, string_STRING_LOWERCASE_ALPHA as STRING_LOWERCASE_ALPHA, string_STRING_UPPERCASE_ALPHA as STRING_UPPERCASE_ALPHA, string_stringAssign as stringAssign, string_stringCamelCase as stringCamelCase, string_stringEscapeHtml as stringEscapeHtml, string_stringFill as stringFill, string_stringFormat as stringFormat, string_stringKebabCase as stringKebabCase };
|
|
536
|
-
}
|
|
537
|
-
|
|
538
418
|
interface Url {
|
|
539
419
|
protocol: string;
|
|
540
420
|
auth: string;
|
|
@@ -578,14 +458,6 @@ declare const urlSetParams: (url: string, setter: AnyObject) => string;
|
|
|
578
458
|
*/
|
|
579
459
|
declare const urlDelParams: (url: string, removeKeys: string[]) => string;
|
|
580
460
|
|
|
581
|
-
declare const url_urlDelParams: typeof urlDelParams;
|
|
582
|
-
declare const url_urlParse: typeof urlParse;
|
|
583
|
-
declare const url_urlSetParams: typeof urlSetParams;
|
|
584
|
-
declare const url_urlStringify: typeof urlStringify;
|
|
585
|
-
declare namespace url {
|
|
586
|
-
export { url_urlDelParams as urlDelParams, url_urlParse as urlParse, url_urlSetParams as urlSetParams, url_urlStringify as urlStringify };
|
|
587
|
-
}
|
|
588
|
-
|
|
589
461
|
/**
|
|
590
462
|
* 等待一段时间
|
|
591
463
|
* @param {number} timeout 等待时间,单位毫秒
|
|
@@ -603,12 +475,6 @@ declare function wait(timeout?: number): Promise<void>;
|
|
|
603
475
|
*/
|
|
604
476
|
declare function asyncMap<T, R>(list: Array<T>, mapper: (val: T, idx: number, list: Array<T>) => Promise<R>, concurrency?: number): Promise<R[]>;
|
|
605
477
|
|
|
606
|
-
declare const async_asyncMap: typeof asyncMap;
|
|
607
|
-
declare const async_wait: typeof wait;
|
|
608
|
-
declare namespace async {
|
|
609
|
-
export { async_asyncMap as asyncMap, async_wait as wait };
|
|
610
|
-
}
|
|
611
|
-
|
|
612
478
|
/**
|
|
613
479
|
* 选择本地文件
|
|
614
480
|
* @param {function} changeCb 选择文件回调
|
|
@@ -618,11 +484,6 @@ declare function chooseLocalFile({ accept }: {
|
|
|
618
484
|
accept: any;
|
|
619
485
|
}, changeCb: (FileList: any) => any): HTMLInputElement;
|
|
620
486
|
|
|
621
|
-
declare const file_chooseLocalFile: typeof chooseLocalFile;
|
|
622
|
-
declare namespace file {
|
|
623
|
-
export { file_chooseLocalFile as chooseLocalFile };
|
|
624
|
-
}
|
|
625
|
-
|
|
626
487
|
interface ICanvasWM {
|
|
627
488
|
container: HTMLElement;
|
|
628
489
|
width: string;
|
|
@@ -641,4 +502,4 @@ interface ICanvasWM {
|
|
|
641
502
|
*/
|
|
642
503
|
declare const genCanvasWM: (canvasWM: ICanvasWM) => void;
|
|
643
504
|
|
|
644
|
-
export {
|
|
505
|
+
export { type AnyArray, type AnyFunc, type AnyObject, type ArrayElements, type LooseParamValue, type LooseParams, type Params, type PartialDeep, type Replacer, STRING_ARABIC_NUMERALS, STRING_LOWERCASE_ALPHA, STRING_UPPERCASE_ALPHA, addClass, arrayEach, arrayEachAsync, arrayInsertBefore, arrayLike, arrayRemove, asyncForEach, asyncMap, calculateDate, calculateDateTime, chooseLocalFile, cloneDeep, cookieDel, cookieGet, cookieSet, copyText, deepTraversal, downloadBlob, downloadData, downloadHref, downloadURL, formatDate, genCanvasWM, getStyle, getTreeIds, hasClass, isArray, isBigInt, isBoolean, isDate, isDomReady, isError, isFunction, isNaN, isNull, isNumber, isObject, isPlainObject, isPrimitive, isRegExp, isString, isSymbol, isUndefined, objectAssign, objectEach, objectEachAsync, objectFill, objectGet, objectHas, objectMap, objectAssign as objectMerge, objectOmit, objectPick, onDomReady, pathJoin, pathNormalize, qsParse, qsStringify, removeClass, setStyle, smoothScroll, stringAssign, stringCamelCase, stringEscapeHtml, stringFill, stringFormat, stringKebabCase, urlDelParams, urlParse, urlSetParams, urlStringify, wait };
|
package/lib/umd/index.js
CHANGED
|
@@ -31,26 +31,6 @@
|
|
|
31
31
|
const isError = (any) => typeIs(any) === 'Error';
|
|
32
32
|
const isRegExp = (any) => typeIs(any) === 'RegExp';
|
|
33
33
|
|
|
34
|
-
var type = /*#__PURE__*/Object.freeze({
|
|
35
|
-
__proto__: null,
|
|
36
|
-
default: typeIs,
|
|
37
|
-
isArray: isArray,
|
|
38
|
-
isBigInt: isBigInt,
|
|
39
|
-
isBoolean: isBoolean,
|
|
40
|
-
isDate: isDate,
|
|
41
|
-
isError: isError,
|
|
42
|
-
isFunction: isFunction,
|
|
43
|
-
isNaN: isNaN,
|
|
44
|
-
isNull: isNull,
|
|
45
|
-
isNumber: isNumber,
|
|
46
|
-
isObject: isObject,
|
|
47
|
-
isPrimitive: isPrimitive,
|
|
48
|
-
isRegExp: isRegExp,
|
|
49
|
-
isString: isString,
|
|
50
|
-
isSymbol: isSymbol,
|
|
51
|
-
isUndefined: isUndefined
|
|
52
|
-
});
|
|
53
|
-
|
|
54
34
|
/**
|
|
55
35
|
* 判断对象是否为纯对象
|
|
56
36
|
* @param {object} obj
|
|
@@ -270,22 +250,6 @@
|
|
|
270
250
|
return cloneObj;
|
|
271
251
|
}
|
|
272
252
|
|
|
273
|
-
var object = /*#__PURE__*/Object.freeze({
|
|
274
|
-
__proto__: null,
|
|
275
|
-
cloneDeep: cloneDeep,
|
|
276
|
-
isPlainObject: isPlainObject,
|
|
277
|
-
objectAssign: objectAssign,
|
|
278
|
-
objectEach: objectEach,
|
|
279
|
-
objectEachAsync: objectEachAsync,
|
|
280
|
-
objectFill: objectFill,
|
|
281
|
-
objectGet: objectGet,
|
|
282
|
-
objectHas: objectHas,
|
|
283
|
-
objectMap: objectMap,
|
|
284
|
-
objectMerge: objectAssign,
|
|
285
|
-
objectOmit: objectOmit,
|
|
286
|
-
objectPick: objectPick
|
|
287
|
-
});
|
|
288
|
-
|
|
289
253
|
/**
|
|
290
254
|
* 判断一个对象是否为类数组
|
|
291
255
|
* @param any
|
|
@@ -484,18 +448,6 @@
|
|
|
484
448
|
}
|
|
485
449
|
}
|
|
486
450
|
|
|
487
|
-
var array = /*#__PURE__*/Object.freeze({
|
|
488
|
-
__proto__: null,
|
|
489
|
-
arrayEach: arrayEach,
|
|
490
|
-
arrayEachAsync: arrayEachAsync,
|
|
491
|
-
arrayInsertBefore: arrayInsertBefore,
|
|
492
|
-
arrayLike: arrayLike,
|
|
493
|
-
arrayRemove: arrayRemove,
|
|
494
|
-
asyncForEach: asyncForEach,
|
|
495
|
-
deepTraversal: deepTraversal,
|
|
496
|
-
getTreeIds: getTreeIds
|
|
497
|
-
});
|
|
498
|
-
|
|
499
451
|
// @ref https://cubic-bezier.com/
|
|
500
452
|
const easingDefines = {
|
|
501
453
|
linear: [0, 0, 1, 1],
|
|
@@ -641,19 +593,6 @@
|
|
|
641
593
|
*/
|
|
642
594
|
const stringFill = (length, value = ' ') => new Array(length).fill(value).join('');
|
|
643
595
|
|
|
644
|
-
var string = /*#__PURE__*/Object.freeze({
|
|
645
|
-
__proto__: null,
|
|
646
|
-
STRING_ARABIC_NUMERALS: STRING_ARABIC_NUMERALS,
|
|
647
|
-
STRING_LOWERCASE_ALPHA: STRING_LOWERCASE_ALPHA,
|
|
648
|
-
STRING_UPPERCASE_ALPHA: STRING_UPPERCASE_ALPHA,
|
|
649
|
-
stringAssign: stringAssign,
|
|
650
|
-
stringCamelCase: stringCamelCase,
|
|
651
|
-
stringEscapeHtml: stringEscapeHtml,
|
|
652
|
-
stringFill: stringFill,
|
|
653
|
-
stringFormat: stringFormat,
|
|
654
|
-
stringKebabCase: stringKebabCase
|
|
655
|
-
});
|
|
656
|
-
|
|
657
596
|
/**
|
|
658
597
|
* 判断元素是否包含某个样式名
|
|
659
598
|
* @param {HTMLElement} el
|
|
@@ -784,18 +723,6 @@
|
|
|
784
723
|
}
|
|
785
724
|
}
|
|
786
725
|
|
|
787
|
-
var dom = /*#__PURE__*/Object.freeze({
|
|
788
|
-
__proto__: null,
|
|
789
|
-
addClass: addClass,
|
|
790
|
-
getStyle: getStyle,
|
|
791
|
-
hasClass: hasClass,
|
|
792
|
-
isDomReady: isDomReady,
|
|
793
|
-
onDomReady: onDomReady,
|
|
794
|
-
removeClass: removeClass,
|
|
795
|
-
setStyle: setStyle,
|
|
796
|
-
smoothScroll: smoothScroll
|
|
797
|
-
});
|
|
798
|
-
|
|
799
726
|
const textEl = document.createElement('textarea');
|
|
800
727
|
setStyle(textEl, {
|
|
801
728
|
position: 'absolute',
|
|
@@ -821,11 +748,6 @@
|
|
|
821
748
|
}
|
|
822
749
|
};
|
|
823
750
|
|
|
824
|
-
var clipboard = /*#__PURE__*/Object.freeze({
|
|
825
|
-
__proto__: null,
|
|
826
|
-
copyText: copyText
|
|
827
|
-
});
|
|
828
|
-
|
|
829
751
|
/**
|
|
830
752
|
* 获取cookie
|
|
831
753
|
* @param {string} name
|
|
@@ -876,13 +798,6 @@
|
|
|
876
798
|
*/
|
|
877
799
|
const cookieDel = (name) => cookieSet(name, '', -1);
|
|
878
800
|
|
|
879
|
-
var cookie = /*#__PURE__*/Object.freeze({
|
|
880
|
-
__proto__: null,
|
|
881
|
-
cookieDel: cookieDel,
|
|
882
|
-
cookieGet: cookieGet,
|
|
883
|
-
cookieSet: cookieSet
|
|
884
|
-
});
|
|
885
|
-
|
|
886
801
|
/**
|
|
887
802
|
* 格式化为日期对象(带自定义格式化模板)
|
|
888
803
|
* @param {DateValue} value 可以是数值、字符串或 Date 对象
|
|
@@ -986,13 +901,6 @@
|
|
|
986
901
|
date.getSeconds());
|
|
987
902
|
}
|
|
988
903
|
|
|
989
|
-
var date = /*#__PURE__*/Object.freeze({
|
|
990
|
-
__proto__: null,
|
|
991
|
-
calculateDate: calculateDate,
|
|
992
|
-
calculateDateTime: calculateDateTime,
|
|
993
|
-
formatDate: formatDate
|
|
994
|
-
});
|
|
995
|
-
|
|
996
904
|
/**
|
|
997
905
|
* 标准化路径
|
|
998
906
|
* @param {string} path
|
|
@@ -1049,12 +957,6 @@
|
|
|
1049
957
|
*/
|
|
1050
958
|
const pathJoin = (from, ...to) => pathNormalize([from, ...to].join('/'));
|
|
1051
959
|
|
|
1052
|
-
var path = /*#__PURE__*/Object.freeze({
|
|
1053
|
-
__proto__: null,
|
|
1054
|
-
pathJoin: pathJoin,
|
|
1055
|
-
pathNormalize: pathNormalize
|
|
1056
|
-
});
|
|
1057
|
-
|
|
1058
960
|
/**
|
|
1059
961
|
* 解析查询参数,内部使用的是浏览器内置的 URLSearchParams 进行处理
|
|
1060
962
|
* @param {string} queryString
|
|
@@ -1113,12 +1015,6 @@
|
|
|
1113
1015
|
return params.toString();
|
|
1114
1016
|
};
|
|
1115
1017
|
|
|
1116
|
-
var qs = /*#__PURE__*/Object.freeze({
|
|
1117
|
-
__proto__: null,
|
|
1118
|
-
qsParse: qsParse,
|
|
1119
|
-
qsStringify: qsStringify
|
|
1120
|
-
});
|
|
1121
|
-
|
|
1122
1018
|
const anchorEl = document.createElement('a');
|
|
1123
1019
|
/**
|
|
1124
1020
|
* url 解析
|
|
@@ -1188,14 +1084,6 @@
|
|
|
1188
1084
|
return urlStringify(p);
|
|
1189
1085
|
};
|
|
1190
1086
|
|
|
1191
|
-
var url = /*#__PURE__*/Object.freeze({
|
|
1192
|
-
__proto__: null,
|
|
1193
|
-
urlDelParams: urlDelParams,
|
|
1194
|
-
urlParse: urlParse,
|
|
1195
|
-
urlSetParams: urlSetParams,
|
|
1196
|
-
urlStringify: urlStringify
|
|
1197
|
-
});
|
|
1198
|
-
|
|
1199
1087
|
/**
|
|
1200
1088
|
* 通过打开新窗口的方式下载
|
|
1201
1089
|
* @param {string} url
|
|
@@ -1264,14 +1152,6 @@
|
|
|
1264
1152
|
}
|
|
1265
1153
|
};
|
|
1266
1154
|
|
|
1267
|
-
var download = /*#__PURE__*/Object.freeze({
|
|
1268
|
-
__proto__: null,
|
|
1269
|
-
downloadBlob: downloadBlob,
|
|
1270
|
-
downloadData: downloadData,
|
|
1271
|
-
downloadHref: downloadHref,
|
|
1272
|
-
downloadURL: downloadURL
|
|
1273
|
-
});
|
|
1274
|
-
|
|
1275
1155
|
/**
|
|
1276
1156
|
* 等待一段时间
|
|
1277
1157
|
* @param {number} timeout 等待时间,单位毫秒
|
|
@@ -1325,12 +1205,6 @@
|
|
|
1325
1205
|
});
|
|
1326
1206
|
}
|
|
1327
1207
|
|
|
1328
|
-
var async = /*#__PURE__*/Object.freeze({
|
|
1329
|
-
__proto__: null,
|
|
1330
|
-
asyncMap: asyncMap,
|
|
1331
|
-
wait: wait
|
|
1332
|
-
});
|
|
1333
|
-
|
|
1334
1208
|
/**
|
|
1335
1209
|
* 选择本地文件
|
|
1336
1210
|
* @param {function} changeCb 选择文件回调
|
|
@@ -1352,11 +1226,6 @@
|
|
|
1352
1226
|
return inputObj;
|
|
1353
1227
|
}
|
|
1354
1228
|
|
|
1355
|
-
var file = /*#__PURE__*/Object.freeze({
|
|
1356
|
-
__proto__: null,
|
|
1357
|
-
chooseLocalFile: chooseLocalFile
|
|
1358
|
-
});
|
|
1359
|
-
|
|
1360
1229
|
/*
|
|
1361
1230
|
* @created: Saturday, 2020-04-18 14:38:23
|
|
1362
1231
|
* @author: chendq
|
|
@@ -1439,20 +1308,80 @@
|
|
|
1439
1308
|
// 调用
|
|
1440
1309
|
// __canvasWM({ content: 'QQMusicFE' })
|
|
1441
1310
|
|
|
1442
|
-
exports.
|
|
1443
|
-
exports.
|
|
1444
|
-
exports.
|
|
1445
|
-
exports.
|
|
1446
|
-
exports.
|
|
1447
|
-
exports.
|
|
1448
|
-
exports.
|
|
1449
|
-
exports.
|
|
1311
|
+
exports.STRING_ARABIC_NUMERALS = STRING_ARABIC_NUMERALS;
|
|
1312
|
+
exports.STRING_LOWERCASE_ALPHA = STRING_LOWERCASE_ALPHA;
|
|
1313
|
+
exports.STRING_UPPERCASE_ALPHA = STRING_UPPERCASE_ALPHA;
|
|
1314
|
+
exports.addClass = addClass;
|
|
1315
|
+
exports.arrayEach = arrayEach;
|
|
1316
|
+
exports.arrayEachAsync = arrayEachAsync;
|
|
1317
|
+
exports.arrayInsertBefore = arrayInsertBefore;
|
|
1318
|
+
exports.arrayLike = arrayLike;
|
|
1319
|
+
exports.arrayRemove = arrayRemove;
|
|
1320
|
+
exports.asyncForEach = asyncForEach;
|
|
1321
|
+
exports.asyncMap = asyncMap;
|
|
1322
|
+
exports.calculateDate = calculateDate;
|
|
1323
|
+
exports.calculateDateTime = calculateDateTime;
|
|
1324
|
+
exports.chooseLocalFile = chooseLocalFile;
|
|
1325
|
+
exports.cloneDeep = cloneDeep;
|
|
1326
|
+
exports.cookieDel = cookieDel;
|
|
1327
|
+
exports.cookieGet = cookieGet;
|
|
1328
|
+
exports.cookieSet = cookieSet;
|
|
1329
|
+
exports.copyText = copyText;
|
|
1330
|
+
exports.deepTraversal = deepTraversal;
|
|
1331
|
+
exports.downloadBlob = downloadBlob;
|
|
1332
|
+
exports.downloadData = downloadData;
|
|
1333
|
+
exports.downloadHref = downloadHref;
|
|
1334
|
+
exports.downloadURL = downloadURL;
|
|
1335
|
+
exports.formatDate = formatDate;
|
|
1450
1336
|
exports.genCanvasWM = genCanvasWM;
|
|
1451
|
-
exports.
|
|
1452
|
-
exports.
|
|
1453
|
-
exports.
|
|
1454
|
-
exports.
|
|
1455
|
-
exports.
|
|
1456
|
-
exports.
|
|
1337
|
+
exports.getStyle = getStyle;
|
|
1338
|
+
exports.getTreeIds = getTreeIds;
|
|
1339
|
+
exports.hasClass = hasClass;
|
|
1340
|
+
exports.isArray = isArray;
|
|
1341
|
+
exports.isBigInt = isBigInt;
|
|
1342
|
+
exports.isBoolean = isBoolean;
|
|
1343
|
+
exports.isDate = isDate;
|
|
1344
|
+
exports.isDomReady = isDomReady;
|
|
1345
|
+
exports.isError = isError;
|
|
1346
|
+
exports.isFunction = isFunction;
|
|
1347
|
+
exports.isNaN = isNaN;
|
|
1348
|
+
exports.isNull = isNull;
|
|
1349
|
+
exports.isNumber = isNumber;
|
|
1350
|
+
exports.isObject = isObject;
|
|
1351
|
+
exports.isPlainObject = isPlainObject;
|
|
1352
|
+
exports.isPrimitive = isPrimitive;
|
|
1353
|
+
exports.isRegExp = isRegExp;
|
|
1354
|
+
exports.isString = isString;
|
|
1355
|
+
exports.isSymbol = isSymbol;
|
|
1356
|
+
exports.isUndefined = isUndefined;
|
|
1357
|
+
exports.objectAssign = objectAssign;
|
|
1358
|
+
exports.objectEach = objectEach;
|
|
1359
|
+
exports.objectEachAsync = objectEachAsync;
|
|
1360
|
+
exports.objectFill = objectFill;
|
|
1361
|
+
exports.objectGet = objectGet;
|
|
1362
|
+
exports.objectHas = objectHas;
|
|
1363
|
+
exports.objectMap = objectMap;
|
|
1364
|
+
exports.objectMerge = objectAssign;
|
|
1365
|
+
exports.objectOmit = objectOmit;
|
|
1366
|
+
exports.objectPick = objectPick;
|
|
1367
|
+
exports.onDomReady = onDomReady;
|
|
1368
|
+
exports.pathJoin = pathJoin;
|
|
1369
|
+
exports.pathNormalize = pathNormalize;
|
|
1370
|
+
exports.qsParse = qsParse;
|
|
1371
|
+
exports.qsStringify = qsStringify;
|
|
1372
|
+
exports.removeClass = removeClass;
|
|
1373
|
+
exports.setStyle = setStyle;
|
|
1374
|
+
exports.smoothScroll = smoothScroll;
|
|
1375
|
+
exports.stringAssign = stringAssign;
|
|
1376
|
+
exports.stringCamelCase = stringCamelCase;
|
|
1377
|
+
exports.stringEscapeHtml = stringEscapeHtml;
|
|
1378
|
+
exports.stringFill = stringFill;
|
|
1379
|
+
exports.stringFormat = stringFormat;
|
|
1380
|
+
exports.stringKebabCase = stringKebabCase;
|
|
1381
|
+
exports.urlDelParams = urlDelParams;
|
|
1382
|
+
exports.urlParse = urlParse;
|
|
1383
|
+
exports.urlSetParams = urlSetParams;
|
|
1384
|
+
exports.urlStringify = urlStringify;
|
|
1385
|
+
exports.wait = wait;
|
|
1457
1386
|
|
|
1458
1387
|
}));
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sculp-js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "js工具库",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "rollup --config rollup.config.js",
|
|
7
|
+
"build:conf": "rollup --config rollup.config.js",
|
|
8
|
+
"build": "node scripts/build.js",
|
|
8
9
|
"test:unit": "jest",
|
|
9
10
|
"test": "jest --coverage",
|
|
10
11
|
"prettier": "prettier -c --write \"**/*.{vue,ts,js,jsx,css,less,scss,json}\""
|
|
@@ -24,7 +25,9 @@
|
|
|
24
25
|
},
|
|
25
26
|
"sideEffects": false,
|
|
26
27
|
"files": [
|
|
27
|
-
"lib"
|
|
28
|
+
"lib",
|
|
29
|
+
"lib/cjs",
|
|
30
|
+
"lib/index.d.ts"
|
|
28
31
|
],
|
|
29
32
|
"keywords": [
|
|
30
33
|
"js-utils",
|