ddan-js 2.2.6 → 2.2.8

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.
@@ -1,8 +1,383 @@
1
- import Event from "./class/event";
2
- import Http from "./modules/http";
3
- import Store from "./class/store";
4
- import Persist from "./class/persist";
5
- export { Xhao } from "./typings/xhao";
1
+ export { Ddan } from './typings';
2
+ import Http from './modules/http';
3
+ import Event from './class/event';
4
+ import Store from './class/store';
5
+ import Persist from './class/persist';
6
+ declare const dUtil: {
7
+ includes: typeof import("./util/includes").default;
8
+ forof: (source: any, cb: (key: any, val: any) => void) => void;
9
+ copy: (source: any, options?: {
10
+ fields?: string[] | undefined;
11
+ camel?: boolean | undefined;
12
+ pure?: boolean | undefined;
13
+ } & import("./typings").dd.IIgnoreParams) => any;
14
+ clone: (source: any) => any;
15
+ merge: (target: any, source: any, options?: import("./typings").dd.IIgnoreParams) => {};
16
+ isEmpty: (source: any) => boolean;
17
+ parseValue: (source: any, { number, boolean }?: {
18
+ number?: boolean | undefined;
19
+ boolean?: boolean | undefined;
20
+ }) => any;
21
+ cloneClass: <T>(source: T) => T;
22
+ combine: (target: any, source: any, options?: import("./typings").dd.IIgnoreParams) => any;
23
+ combines: (objs: any[], options?: import("./typings").dd.IIgnoreParams) => {};
24
+ observe: (obj: any, key: any, watchFun: any, owner: any, deep?: boolean) => void;
25
+ getTag: (value: any) => string;
26
+ getType: (value: any) => string;
27
+ toString: () => string;
28
+ hasOwnProperty: (v: PropertyKey) => boolean;
29
+ propertyIsEnumerable: (v: PropertyKey) => boolean;
30
+ is: (val: any, type: string) => boolean;
31
+ isNumber: (value: any) => boolean;
32
+ isString: (value: any) => boolean;
33
+ isObject: (value: any) => boolean;
34
+ isObjectLike: (value: any) => boolean;
35
+ isPlainObject: (value: any) => boolean;
36
+ isSymbol: (value: any) => boolean;
37
+ isFunction: (value: any) => boolean;
38
+ isArray: (arg: any) => arg is any[];
39
+ isArrayLikeObject: (value: any) => boolean;
40
+ isIndex: (value: any, length: number) => boolean;
41
+ isArrayLike: (value: any) => boolean;
42
+ isPrototype: (value: any) => boolean;
43
+ isArguments: (value: any) => boolean;
44
+ isPromise: (value: any) => boolean;
45
+ gbk: {
46
+ gbkLength: (str: string) => number;
47
+ gbkCut: (source: string, len: number) => string;
48
+ };
49
+ math: {
50
+ random: (max: number) => number;
51
+ randomRange: (min: number, max: number) => number;
52
+ lerp: (start: number, end: number, t: number) => number;
53
+ randoms: (max: number, count?: number, repeat?: boolean) => number[];
54
+ strip: (num: string | number, fractionDigits?: number) => number;
55
+ float: (num: string | number, { fractionDigits, fixed }?: {
56
+ fractionDigits?: number | undefined;
57
+ fixed?: boolean | undefined;
58
+ }) => number;
59
+ radian2degree: (radians: number) => number;
60
+ degree2radian: (degrees: number) => number;
61
+ };
62
+ list: {
63
+ stepAction: <T_1>(list: T_1[], func: import("./typings").Ddan.Task<T_1, void>, stepCount?: number) => void;
64
+ skip: <T_2>(list: T_2[], count: number) => T_2[];
65
+ take: <T_3>(list: T_3[], count: number, skip?: number) => T_3[];
66
+ distinct: <T_4>(list: T_4[]) => T_4[];
67
+ randoms: <T_5>(list: T_5[], count?: number, repeat?: boolean) => T_5[];
68
+ toKV: (list: import("./typings").Ddan.KV<any>[], key: string, value: string) => import("./typings").Ddan.KV<any>;
69
+ groupBy: <T_6>(list: T_6[], key: string) => Record<string, T_6[]>;
70
+ first: <T_7>(list: T_7[]) => T_7 | undefined;
71
+ last: <T_8>(list: T_8[]) => T_8 | undefined;
72
+ toList: <T_9>(val: T_9 | T_9[]) => T_9[];
73
+ };
74
+ string: {
75
+ toString: (value: any) => any;
76
+ startCase: (string: any) => any;
77
+ snakeCase: (string: any) => any;
78
+ kebabCase: (string: any) => any;
79
+ camelCase: (string: any) => any;
80
+ upperCase: (string: any) => any;
81
+ upperFirst: (string: any) => any;
82
+ lowerCase: (string: any) => any;
83
+ lowerFirst: (string: any) => any;
84
+ splitOnFirst: (string: any, separator: any) => string[];
85
+ parseValue: (value?: any, { number, boolean }?: {
86
+ number?: boolean | undefined;
87
+ boolean?: boolean | undefined;
88
+ }) => any;
89
+ replace: (source: string, rules: import("./typings").dd.IRegexRule | import("./typings").dd.IRegexRule[]) => string;
90
+ };
91
+ time: {
92
+ now: () => import("./modules/time/dtime").default;
93
+ isToday: (date: any) => any;
94
+ parseTimestamp: ({ year, month, date, hour, minute, second }: {
95
+ year?: number | undefined;
96
+ month?: number | undefined;
97
+ date?: number | undefined;
98
+ hour?: number | undefined;
99
+ minute?: number | undefined;
100
+ second?: number | undefined;
101
+ }) => number;
102
+ todayZero: () => number;
103
+ format: (time: string | number | Date, reg?: string) => string;
104
+ countdown: (endTime: string | number | Date, reg?: string) => "" | import("./modules/time/dtime").IDCountdownFormat;
105
+ dtime: (time: string | number | Date) => import("./modules/time/dtime").default;
106
+ loopFrame: (interval?: number) => import("./modules/time/frame").default;
107
+ oneDay: number;
108
+ oneHour: number;
109
+ oneMinute: number;
110
+ oneSecond: number;
111
+ };
112
+ obj: {
113
+ copy: (source: any, options?: {
114
+ fields?: string[] | undefined;
115
+ camel?: boolean | undefined;
116
+ pure?: boolean | undefined;
117
+ } & import("./typings").dd.IIgnoreParams) => any;
118
+ clone: (source: any) => any;
119
+ merge: (target: any, source: any, options?: import("./typings").dd.IIgnoreParams) => {};
120
+ isEmpty: (source: any) => boolean;
121
+ parseValue: (source: any, { number, boolean }?: {
122
+ number?: boolean | undefined;
123
+ boolean?: boolean | undefined;
124
+ }) => any;
125
+ cloneClass: <T>(source: T) => T;
126
+ combine: (target: any, source: any, options?: import("./typings").dd.IIgnoreParams) => any;
127
+ combines: (objs: any[], options?: import("./typings").dd.IIgnoreParams) => {};
128
+ observe: (obj: any, key: any, watchFun: any, owner: any, deep?: boolean) => void;
129
+ };
130
+ crypto: {
131
+ base64: {
132
+ encode: (input: string) => string;
133
+ decode: (input: string) => string;
134
+ encodeByOss: (input: string) => string;
135
+ };
136
+ uuid: (len?: number, radix?: number) => string;
137
+ newId: (len: number, prefix?: boolean, sep?: string) => string;
138
+ keyNumber: string;
139
+ keyLower: string;
140
+ keyUpper: string;
141
+ keyChars: string;
142
+ };
143
+ convert: {
144
+ uint8ArrayToString: (arr: any) => string;
145
+ stringToArrayBuffer: (str: any) => ArrayBuffer;
146
+ arrayBufferToString: (data: ArrayBuffer, base64?: boolean) => string;
147
+ };
148
+ rule: {
149
+ validateId: (content: any) => boolean;
150
+ validatePhone: (content: any) => boolean;
151
+ validator: (rules: import("./modules/rule/async-validator").Rules) => import("./modules/rule/async-validator").default;
152
+ validate: (rules: import("./modules/rule/async-validator").Rules, source_: import("./modules/rule/async-validator").Values, o?: any, oc?: any) => Promise<import("./modules/rule/async-validator").Values>;
153
+ isChinese: (content: string) => boolean;
154
+ isNumber: (content: string) => boolean;
155
+ isFloat: (content: string) => boolean;
156
+ isPhoneNumber: (content: any) => boolean;
157
+ };
158
+ regex: {
159
+ pattern: {
160
+ num: string;
161
+ zh: string;
162
+ en: string;
163
+ };
164
+ regex: (patt: string, modifiers?: "i" | "g" | "m" | undefined) => RegExp;
165
+ entire: {
166
+ chinese: RegExp;
167
+ real: RegExp;
168
+ cssReal: RegExp;
169
+ id: RegExp;
170
+ yyyyMMdd: RegExp;
171
+ };
172
+ };
173
+ };
174
+ declare const dHook: {
175
+ sleep: (time?: number) => Promise<unknown>;
176
+ run: (task?: Function | Promise<any> | undefined, wait?: number) => Promise<[null, any] | [any, undefined]>;
177
+ exec: (func: Function, taskId?: string) => Promise<any[]>;
178
+ debounce: typeof import("./modules/hook/debounce").default;
179
+ throttle: typeof import("./modules/hook/throttle").default;
180
+ task: (param?: import("./typings").Ddan.Func1<any, any> | undefined) => import("./class/pipeTask").default;
181
+ delay: (time?: number) => Promise<unknown>;
182
+ mutex: typeof import("./modules/hook/mutex").default;
183
+ to: <T = any, U extends object = any>(promise: Promise<T>, errorExt?: object | undefined) => Promise<[null, T] | [U, undefined]>;
184
+ };
185
+ declare const dMini: {
186
+ mini: {
187
+ diff: typeof import("./modules/mini/diff").default;
188
+ promixify: (miniapi: any) => any;
189
+ run: (func: any, args?: {}) => Promise<[null, any] | [any, undefined]>;
190
+ formatList: (lists: any[], start: any, name: any) => any;
191
+ ruleValidator: (_: any, value: any) => boolean;
192
+ Http: typeof import("./modules/mini/http").default;
193
+ setWatcher: (page: any) => void;
194
+ };
195
+ css: {
196
+ stringify: (styleObj: Record<string, string | number>) => string;
197
+ parse: (styleStr: string, { camel, pure }?: {
198
+ camel?: boolean | undefined;
199
+ pure?: boolean | undefined;
200
+ }) => {} | undefined;
201
+ fixValue: (value: string | number, unit?: string) => string | number;
202
+ style: (cssKV: Record<string, any>, unit?: string) => string;
203
+ commonFields: string[];
204
+ };
205
+ qs: {
206
+ parse: (qs: any, { sep, eq, max, multiple, uri, parseNumber, parseBoolean }?: {
207
+ sep?: string | undefined;
208
+ eq?: string | undefined;
209
+ max?: number | undefined;
210
+ multiple?: boolean | undefined;
211
+ uri?: boolean | undefined;
212
+ parseNumber?: boolean | undefined;
213
+ parseBoolean?: boolean | undefined;
214
+ }) => {};
215
+ stringify: (obj: any, { sep, eq, name, uri, cleanZero, cleanNull, cleanWhitespace }?: {
216
+ sep?: string | undefined;
217
+ eq?: string | undefined;
218
+ name?: null | undefined;
219
+ uri?: boolean | undefined;
220
+ cleanZero?: boolean | undefined;
221
+ cleanNull?: boolean | undefined;
222
+ cleanWhitespace?: boolean | undefined;
223
+ }) => string;
224
+ https: (url: string) => string;
225
+ parseUrl: (url: string) => {
226
+ url: string;
227
+ path: string;
228
+ page: string;
229
+ query: string;
230
+ params: {};
231
+ };
232
+ parsePath: (path: string) => {
233
+ root: string;
234
+ name: string;
235
+ withoutExtension: string;
236
+ extension: string;
237
+ };
238
+ join: (...args: string[]) => string;
239
+ };
240
+ icon: import("./class/icon").DIcon;
241
+ html: {
242
+ dataURLtoFile: (dataurl: any, filename: any) => File;
243
+ dataURLtoBlob: (dataurl: any) => Blob;
244
+ blobToFile: (theBlob: any, fileName: any) => any;
245
+ readAsDataURL: (file: any, cb: any) => void;
246
+ downloadUrl: (filename: string, url: string) => void;
247
+ download: (filename: string, obj: string | Blob | MediaSource) => void;
248
+ downloadImage: (url: string) => Promise<void> | undefined;
249
+ watermark: (text: string, { width, height, angle, fillStyle, font, textAlign, textBaseline }?: {
250
+ width?: number | undefined;
251
+ height?: number | undefined;
252
+ angle?: number | undefined;
253
+ fillStyle?: string | undefined;
254
+ font?: string | undefined;
255
+ textAlign?: "center" | "end" | "left" | "right" | "start" | undefined;
256
+ textBaseline?: "alphabetic" | "bottom" | "hanging" | "ideographic" | "middle" | "top" | undefined;
257
+ }) => string;
258
+ };
259
+ };
260
+ declare const dCdn: {
261
+ cdn: {
262
+ ossImage: (url: string, options?: {
263
+ webp?: boolean | undefined;
264
+ resize?: number | undefined;
265
+ interlace?: boolean | undefined;
266
+ domain?: string | string[] | undefined;
267
+ }) => string;
268
+ ossSnapshot: (url: string, options?: {
269
+ t?: number | undefined;
270
+ w?: number | undefined;
271
+ h?: number | undefined;
272
+ m?: "" | "fast" | undefined;
273
+ f?: "jpg" | "png" | undefined;
274
+ ar?: "auto" | "h" | "w" | undefined;
275
+ }) => string;
276
+ };
277
+ watermark: (bg: string, size?: {
278
+ width?: number | undefined;
279
+ height?: number | undefined;
280
+ } | undefined) => import("./class/watermark").DWatermark;
281
+ };
282
+ declare const dClass: {
283
+ Event: typeof Event;
284
+ Http: typeof Http;
285
+ };
286
+ declare const dStore: {
287
+ Store: typeof Store;
288
+ storeRef: (source: import("./typings").dd.IDStore, persistConfig?: import("./typings").dd.IDPersistConfig | undefined) => any;
289
+ Persist: typeof Persist;
290
+ persistConfig: (key: string, fields: string[], storage: import("./typings").dd.DStorage) => import("./typings").dd.IDPersistConfig;
291
+ };
292
+ declare const dJoker: import("./class/joker").Joker;
293
+ declare const dTracker: import("./class/tracker").DTracker;
294
+ declare const dLogger: {
295
+ override: () => void;
296
+ log: (...args: any[]) => void;
297
+ info: (...args: any[]) => void;
298
+ warn: (...args: any[]) => void;
299
+ error: (...args: any[]) => void;
300
+ config: ({ tag, format }?: {
301
+ tag?: boolean | undefined;
302
+ format?: string | undefined;
303
+ }) => void;
304
+ };
305
+ declare const dWeb: {
306
+ fetch: {
307
+ getDataURL: (url: string) => Promise<[any, undefined] | [null, {
308
+ contentType: string;
309
+ dataUrl: string;
310
+ }]>;
311
+ getArrayBuffer: (url: string) => Promise<[any, undefined] | [null, ArrayBuffer]>;
312
+ getJson: (url: string) => Promise<[null, any] | [any, undefined]>;
313
+ };
314
+ Http: typeof Http;
315
+ css: {
316
+ stringify: (styleObj: Record<string, string | number>) => string;
317
+ parse: (styleStr: string, { camel, pure }?: {
318
+ camel?: boolean | undefined;
319
+ pure?: boolean | undefined;
320
+ }) => {} | undefined;
321
+ fixValue: (value: string | number, unit?: string) => string | number;
322
+ style: (cssKV: Record<string, any>, unit?: string) => string;
323
+ commonFields: string[];
324
+ };
325
+ qs: {
326
+ parse: (qs: any, { sep, eq, max, multiple, uri, parseNumber, parseBoolean }?: {
327
+ sep?: string | undefined;
328
+ eq?: string | undefined;
329
+ max?: number | undefined;
330
+ multiple?: boolean | undefined;
331
+ uri?: boolean | undefined;
332
+ parseNumber?: boolean | undefined;
333
+ parseBoolean?: boolean | undefined;
334
+ }) => {};
335
+ stringify: (obj: any, { sep, eq, name, uri, cleanZero, cleanNull, cleanWhitespace }?: {
336
+ sep?: string | undefined;
337
+ eq?: string | undefined;
338
+ name?: null | undefined;
339
+ uri?: boolean | undefined;
340
+ cleanZero?: boolean | undefined;
341
+ cleanNull?: boolean | undefined;
342
+ cleanWhitespace?: boolean | undefined;
343
+ }) => string;
344
+ https: (url: string) => string;
345
+ parseUrl: (url: string) => {
346
+ url: string;
347
+ path: string;
348
+ page: string;
349
+ query: string;
350
+ params: {};
351
+ };
352
+ parsePath: (path: string) => {
353
+ root: string;
354
+ name: string;
355
+ withoutExtension: string;
356
+ extension: string;
357
+ };
358
+ join: (...args: string[]) => string;
359
+ };
360
+ icon: import("./class/icon").DIcon;
361
+ html: {
362
+ dataURLtoFile: (dataurl: any, filename: any) => File;
363
+ dataURLtoBlob: (dataurl: any) => Blob;
364
+ blobToFile: (theBlob: any, fileName: any) => any;
365
+ readAsDataURL: (file: any, cb: any) => void;
366
+ downloadUrl: (filename: string, url: string) => void;
367
+ download: (filename: string, obj: string | Blob | MediaSource) => void;
368
+ downloadImage: (url: string) => Promise<void> | undefined;
369
+ watermark: (text: string, { width, height, angle, fillStyle, font, textAlign, textBaseline }?: {
370
+ width?: number | undefined;
371
+ height?: number | undefined;
372
+ angle?: number | undefined;
373
+ fillStyle?: string | undefined;
374
+ font?: string | undefined;
375
+ textAlign?: "center" | "end" | "left" | "right" | "start" | undefined;
376
+ textBaseline?: "alphabetic" | "bottom" | "hanging" | "ideographic" | "middle" | "top" | undefined;
377
+ }) => string;
378
+ };
379
+ };
380
+ export { dUtil, dHook, dWeb, dMini, dCdn, dClass, dStore, dJoker, dTracker, dLogger };
6
381
  declare const _default: {
7
382
  gbk: {
8
383
  gbkLength: (str: string) => number;
@@ -35,7 +410,7 @@ declare const _default: {
35
410
  exec: (func: Function, taskId?: string) => Promise<any[]>;
36
411
  debounce: typeof import("./modules/hook/debounce").default;
37
412
  throttle: typeof import("./modules/hook/throttle").default;
38
- task: (param?: import("./typings/xhao").Xhao.Func1<any, any> | undefined) => import("./class/pipeTask").default;
413
+ task: (param?: import("./typings").Ddan.Func1<any, any> | undefined) => import("./class/pipeTask").default;
39
414
  delay: (time?: number) => Promise<unknown>;
40
415
  mutex: typeof import("./modules/hook/mutex").default;
41
416
  to: <T = any, U extends object = any>(promise: Promise<T>, errorExt?: object | undefined) => Promise<[null, T] | [U, undefined]>;
@@ -94,12 +469,12 @@ declare const _default: {
94
469
  isPromise: (value: any) => boolean;
95
470
  };
96
471
  list: {
97
- stepAction: <T_2>(list: T_2[], func: import("./typings/xhao").Xhao.Task<T_2, void>, stepCount?: number) => void;
472
+ stepAction: <T_2>(list: T_2[], func: import("./typings").Ddan.Task<T_2, void>, stepCount?: number) => void;
98
473
  skip: <T_3>(list: T_3[], count: number) => T_3[];
99
474
  take: <T_4>(list: T_4[], count: number, skip?: number) => T_4[];
100
475
  distinct: <T_5>(list: T_5[]) => T_5[];
101
476
  randoms: <T_6>(list: T_6[], count?: number, repeat?: boolean) => T_6[];
102
- toKV: (list: import("./typings/xhao").Xhao.KV<any>[], key: string, value: string) => import("./typings/xhao").Xhao.KV<any>;
477
+ toKV: (list: import("./typings").Ddan.KV<any>[], key: string, value: string) => import("./typings").Ddan.KV<any>;
103
478
  groupBy: <T_7>(list: T_7[], key: string) => Record<string, T_7[]>;
104
479
  first: <T_8>(list: T_8[]) => T_8 | undefined;
105
480
  last: <T_9>(list: T_9[]) => T_9 | undefined;
@@ -240,10 +615,6 @@ declare const _default: {
240
615
  textAlign?: "center" | "end" | "left" | "right" | "start" | undefined;
241
616
  textBaseline?: "alphabetic" | "bottom" | "hanging" | "ideographic" | "middle" | "top" | undefined;
242
617
  }) => string;
243
- fetchDataURL: (url: string) => Promise<{
244
- contentType: string;
245
- dataUrl: string;
246
- }>;
247
618
  };
248
619
  icon: import("./class/icon").DIcon;
249
620
  rule: {
@@ -274,6 +645,7 @@ declare const _default: {
274
645
  convert: {
275
646
  uint8ArrayToString: (arr: any) => string;
276
647
  stringToArrayBuffer: (str: any) => ArrayBuffer;
648
+ arrayBufferToString: (data: ArrayBuffer, base64?: boolean) => string;
277
649
  };
278
650
  Event: typeof Event;
279
651
  Http: typeof Http;
@@ -298,5 +670,13 @@ declare const _default: {
298
670
  format?: string | undefined;
299
671
  }) => void;
300
672
  };
673
+ fetch: {
674
+ getDataURL: (url: string) => Promise<[any, undefined] | [null, {
675
+ contentType: string;
676
+ dataUrl: string;
677
+ }]>;
678
+ getArrayBuffer: (url: string) => Promise<[any, undefined] | [null, ArrayBuffer]>;
679
+ getJson: (url: string) => Promise<[null, any] | [any, undefined]>;
680
+ };
301
681
  };
302
682
  export default _default;
@@ -1,7 +1,9 @@
1
1
  declare function uint8ArrayToString(arr: any): string;
2
2
  declare function stringToArrayBuffer(str: any): ArrayBuffer;
3
+ declare function arrayBufferToString(data: ArrayBuffer, base64?: boolean): string;
3
4
  declare const _default: {
4
5
  uint8ArrayToString: typeof uint8ArrayToString;
5
6
  stringToArrayBuffer: typeof stringToArrayBuffer;
7
+ arrayBufferToString: typeof arrayBufferToString;
6
8
  };
7
9
  export default _default;
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ getDataURL: (url: string) => Promise<[null, {
3
+ contentType: string;
4
+ dataUrl: string;
5
+ }] | [any, undefined]>;
6
+ getArrayBuffer: (url: string) => Promise<[any, undefined] | [null, ArrayBuffer]>;
7
+ getJson: (url: string) => Promise<[any, undefined] | [null, any]>;
8
+ };
9
+ export default _default;
@@ -1,5 +1,5 @@
1
1
  import { dd } from '../../typings';
2
- import { Xhao } from '../../typings/xhao';
2
+ import { Ddan } from '../../typings';
3
3
  /**
4
4
  * 防抖 一段时间内,规定时间间隔多次执行,回调触发一次
5
5
  * @param func
@@ -7,7 +7,7 @@ import { Xhao } from '../../typings/xhao';
7
7
  * @param options 参数:leading 开始执行, trailing结束执行
8
8
  * @returns
9
9
  */
10
- declare function debounce(func: Xhao.Action, wait?: number, options?: dd.IDebounceOption): {
10
+ declare function debounce(func: Ddan.Action, wait?: number, options?: dd.IDebounceOption): {
11
11
  (...debouncedArgs: any[]): any;
12
12
  cancel: () => void;
13
13
  flush: () => any;
@@ -2,14 +2,14 @@ import debounce from "./debounce";
2
2
  import throttle from "./throttle";
3
3
  import mutex from "./mutex";
4
4
  import DPipeTask from "../../class/pipeTask";
5
- import { Xhao } from "../../typings/xhao";
5
+ import { Ddan } from "../../typings";
6
6
  declare const _default: {
7
7
  sleep: (time?: number) => Promise<unknown>;
8
8
  run: (task?: Function | Promise<any> | undefined, wait?: number) => Promise<[null, any] | [any, undefined]>;
9
9
  exec: (func: Function, taskId?: string) => Promise<any[]>;
10
10
  debounce: typeof debounce;
11
11
  throttle: typeof throttle;
12
- task: (param?: Xhao.Func1<any, any> | undefined) => DPipeTask;
12
+ task: (param?: Ddan.Func1<any, any> | undefined) => DPipeTask;
13
13
  delay: (time?: number) => Promise<unknown>;
14
14
  mutex: typeof mutex;
15
15
  to: <T = any, U extends object = any>(promise: Promise<T>, errorExt?: object | undefined) => Promise<[null, T] | [U, undefined]>;
@@ -1,3 +1,3 @@
1
- import { Xhao } from "../../typings/xhao";
2
- declare function mutex(func: Xhao.Action): (...args: any[]) => Promise<false | undefined>;
1
+ import { Ddan } from "../../typings";
2
+ declare function mutex(func: Ddan.Action): (...args: any[]) => Promise<false | undefined>;
3
3
  export default mutex;
@@ -1,5 +1,5 @@
1
1
  import { dd } from "../../typings";
2
- import { Xhao } from "../../typings/xhao";
2
+ import { Ddan } from "../../typings";
3
3
  /**
4
4
  * 节流 每个间隔内,触发一次
5
5
  * @param func
@@ -7,7 +7,7 @@ import { Xhao } from "../../typings/xhao";
7
7
  * @param options 参数:leading 开始执行, trailing结束执行
8
8
  * @returns
9
9
  */
10
- declare function throttle(func: Xhao.Action, wait?: number, options?: Omit<dd.IDebounceOption, 'maxWait'>): {
10
+ declare function throttle(func: Ddan.Action, wait?: number, options?: Omit<dd.IDebounceOption, 'maxWait'>): {
11
11
  (...debouncedArgs: any[]): any;
12
12
  cancel: () => void;
13
13
  flush: () => any;
@@ -15,9 +15,5 @@ declare const _default: {
15
15
  textAlign?: "center" | "end" | "left" | "right" | "start" | undefined;
16
16
  textBaseline?: "alphabetic" | "bottom" | "hanging" | "ideographic" | "middle" | "top" | undefined;
17
17
  }) => string;
18
- fetchDataURL: (url: string) => Promise<{
19
- contentType: string;
20
- dataUrl: string;
21
- }>;
22
18
  };
23
19
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import Interceptor from "./interceptor";
2
2
  import { dd } from "../../typings";
3
- import { Xhao } from "../../typings/xhao";
3
+ import { Ddan } from "../../typings";
4
4
  export default class Http implements dd.IHttp {
5
5
  host: string;
6
6
  reqConfig: {};
@@ -33,5 +33,5 @@ export default class Http implements dd.IHttp {
33
33
  * @param {object} req
34
34
  */
35
35
  getIdFromReqUrl(req: any): any;
36
- fetch(name: string, payload?: Xhao.KV): Promise<any>;
36
+ fetch(name: string, payload?: Ddan.KV): Promise<any>;
37
37
  }
@@ -1,4 +1,4 @@
1
- import { Xhao } from "../../typings/xhao";
1
+ import { Ddan } from "../../typings";
2
2
  /**
3
3
  * 分步动作
4
4
  * @param list 列表
@@ -6,7 +6,7 @@ import { Xhao } from "../../typings/xhao";
6
6
  * @param stepCount 每步数量
7
7
  * @returns
8
8
  */
9
- declare function stepAction<T>(list: T[], func: Xhao.Task<T>, stepCount?: number): void;
9
+ declare function stepAction<T>(list: T[], func: Ddan.Task<T>, stepCount?: number): void;
10
10
  /**
11
11
  * 跳过数据
12
12
  * @param list 列表
@@ -35,7 +35,7 @@ declare const _default: {
35
35
  take: typeof take;
36
36
  distinct: typeof distinct;
37
37
  randoms: typeof randoms;
38
- toKV: (list: Xhao.KV<any>[], key: string, value: string) => Xhao.KV<any>;
38
+ toKV: (list: Ddan.KV<any>[], key: string, value: string) => Ddan.KV<any>;
39
39
  groupBy: <T>(list: T[], key: string) => Record<string, T[]>;
40
40
  first: <T_1>(list: T_1[]) => T_1 | undefined;
41
41
  last: <T_2>(list: T_2[]) => T_2 | undefined;
@@ -1,5 +1,21 @@
1
1
  import DPersist from "../class/persist";
2
- import { Xhao } from "./xhao";
2
+ export declare namespace Ddan {
3
+ type KV<T = any> = Record<string, T>;
4
+ type KeyValueOjbect<T = any> = {
5
+ key: string;
6
+ value: T;
7
+ };
8
+ type KeyValue<T = any> = Required<KeyValueOjbect<T>>;
9
+ type Callback<T extends any[] = unknown[], R = any> = (...args: T) => R;
10
+ type Action<T extends any[] = unknown[]> = Callback<T, void>;
11
+ type Task<T = any, R = void> = Callback<[T[]], R>;
12
+ type Func<R = any> = Callback<[], R>;
13
+ type Func1<T = any, R = any> = Callback<[T], R>;
14
+ type Func2<T0 = any, T1 = any, R = any> = Callback<[T0, T1], R>;
15
+ type Func3<T0 = any, T1 = any, T2 = any, R = any> = Callback<[T0, T1, T2], R>;
16
+ type Func4<T0 = any, T1 = any, T2 = any, T3 = any, R = any> = Callback<[T0, T1, T2, T3], R>;
17
+ type Result<T = any> = T | Promise<T>;
18
+ }
3
19
  export declare namespace dd {
4
20
  type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
5
21
  /**
@@ -46,14 +62,14 @@ export declare namespace dd {
46
62
  interface IHttpApiConfig {
47
63
  [key: string]: IHttpRequestInit;
48
64
  }
49
- type ResponseInterceptFunc = Xhao.Func1<IHttpResponse>;
50
- type RequestInterceptFunc = Xhao.Func1<IHttpRequest, IHttpRequest>;
65
+ type ResponseInterceptFunc = Ddan.Func1<IHttpResponse>;
66
+ type RequestInterceptFunc = Ddan.Func1<IHttpRequest, IHttpRequest>;
51
67
  interface IHttpConfig {
52
68
  host?: string;
53
69
  config: IHttpApiConfig;
54
70
  handleRequest?: RequestInterceptFunc | RequestInterceptFunc[];
55
71
  handleResponse?: ResponseInterceptFunc | ResponseInterceptFunc[];
56
- handleError?: Xhao.Func1;
72
+ handleError?: Ddan.Func1;
57
73
  }
58
74
  interface IHttpRequestInit extends RequestInit {
59
75
  [key: string]: any;
@@ -74,7 +90,7 @@ export declare namespace dd {
74
90
  }
75
91
  interface IHttpResponse {
76
92
  response: Response & Record<string, any>;
77
- config?: Xhao.KV;
93
+ config?: Ddan.KV;
78
94
  refetch: () => Promise<any>;
79
95
  }
80
96
  interface IMiniHttpOptions {
package/package.json CHANGED
@@ -1,8 +1,22 @@
1
1
  {
2
2
  "name": "ddan-js",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "description": "",
5
- "keywords": [],
5
+ "keywords": [
6
+ "ddan-js",
7
+ "ddan",
8
+ "Ddan",
9
+ "dUtil",
10
+ "dHook",
11
+ "dWeb",
12
+ "dMini",
13
+ "dCdn",
14
+ "dClass",
15
+ "dStore",
16
+ "dJoker",
17
+ "dTracker",
18
+ "dLogger"
19
+ ],
6
20
  "main": "bin/ddan-js.js",
7
21
  "module": "bin/ddan-js.esm.js",
8
22
  "typings": "bin/types/index.d.ts",
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });