ddan-js 2.9.0 → 2.9.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/bin/ddan-js.browser.js +1 -1
- package/bin/ddan-js.esm.js +1 -1
- package/bin/ddan-js.js +1 -1
- package/bin/lib/modules/convert/index.js +2 -0
- package/bin/lib/modules/convert/md5.js +222 -0
- package/bin/lib/modules/hook/modules/bezier.js +1 -1
- package/bin/lib/modules/html.js +44 -16
- package/bin/lib/modules/string/index.js +10 -1
- package/bin/types/browser.d.ts +17 -2
- package/bin/types/index.d.ts +17 -2
- package/bin/types/modules/convert/index.d.ts +2 -0
- package/bin/types/modules/convert/md5.d.ts +5 -0
- package/bin/types/modules/hook/index.d.ts +1 -1
- package/bin/types/modules/hook/modules/bezier.d.ts +1 -1
- package/bin/types/modules/html.d.ts +2 -4
- package/bin/types/modules/string/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utf8_1 = require("./utf8");
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
const base64_1 = require("./base64");
|
|
6
|
+
function rotateLeft(lValue, iShiftBits) {
|
|
7
|
+
return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
|
|
8
|
+
}
|
|
9
|
+
function addUnsigned(lX, lY) {
|
|
10
|
+
let lX4;
|
|
11
|
+
let lY4;
|
|
12
|
+
let lX8;
|
|
13
|
+
let lY8;
|
|
14
|
+
let lResult;
|
|
15
|
+
lX8 = lX & 0x80000000;
|
|
16
|
+
lY8 = lY & 0x80000000;
|
|
17
|
+
lX4 = lX & 0x40000000;
|
|
18
|
+
lY4 = lY & 0x40000000;
|
|
19
|
+
lResult = (lX & 0x3fffffff) + (lY & 0x3fffffff);
|
|
20
|
+
if (lX4 & lY4) {
|
|
21
|
+
return lResult ^ 0x80000000 ^ lX8 ^ lY8;
|
|
22
|
+
}
|
|
23
|
+
if (lX4 | lY4) {
|
|
24
|
+
if (lResult & 0x40000000) {
|
|
25
|
+
return lResult ^ 0xc0000000 ^ lX8 ^ lY8;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return lResult ^ 0x40000000 ^ lX8 ^ lY8;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return lResult ^ lX8 ^ lY8;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function F(x, y, z) {
|
|
36
|
+
return (x & y) | (~x & z);
|
|
37
|
+
}
|
|
38
|
+
function G(x, y, z) {
|
|
39
|
+
return (x & z) | (y & ~z);
|
|
40
|
+
}
|
|
41
|
+
function H(x, y, z) {
|
|
42
|
+
return x ^ y ^ z;
|
|
43
|
+
}
|
|
44
|
+
function I(x, y, z) {
|
|
45
|
+
return y ^ (x | ~z);
|
|
46
|
+
}
|
|
47
|
+
function FF(a, b, c, d, x, s, ac) {
|
|
48
|
+
a = addUnsigned(a, addUnsigned(addUnsigned(F(b, c, d), x), ac));
|
|
49
|
+
return addUnsigned(rotateLeft(a, s), b);
|
|
50
|
+
}
|
|
51
|
+
function GG(a, b, c, d, x, s, ac) {
|
|
52
|
+
a = addUnsigned(a, addUnsigned(addUnsigned(G(b, c, d), x), ac));
|
|
53
|
+
return addUnsigned(rotateLeft(a, s), b);
|
|
54
|
+
}
|
|
55
|
+
function HH(a, b, c, d, x, s, ac) {
|
|
56
|
+
a = addUnsigned(a, addUnsigned(addUnsigned(H(b, c, d), x), ac));
|
|
57
|
+
return addUnsigned(rotateLeft(a, s), b);
|
|
58
|
+
}
|
|
59
|
+
function II(a, b, c, d, x, s, ac) {
|
|
60
|
+
a = addUnsigned(a, addUnsigned(addUnsigned(I(b, c, d), x), ac));
|
|
61
|
+
return addUnsigned(rotateLeft(a, s), b);
|
|
62
|
+
}
|
|
63
|
+
function convertToWordArray(data) {
|
|
64
|
+
let lWordCount;
|
|
65
|
+
const lMessageLength = data.length;
|
|
66
|
+
const lNumberOfWordsTemp1 = lMessageLength + 8;
|
|
67
|
+
const lNumberOfWordsTemp2 = (lNumberOfWordsTemp1 - (lNumberOfWordsTemp1 % 64)) / 64;
|
|
68
|
+
const lNumberOfWords = (lNumberOfWordsTemp2 + 1) * 16;
|
|
69
|
+
const lWordArray = Array(lNumberOfWords - 1).fill(0);
|
|
70
|
+
let lBytePosition = 0;
|
|
71
|
+
let lByteCount = 0;
|
|
72
|
+
// Process each byte from the Uint8Array
|
|
73
|
+
while (lByteCount < lMessageLength) {
|
|
74
|
+
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
|
|
75
|
+
lBytePosition = (lByteCount % 4) * 8;
|
|
76
|
+
lWordArray[lWordCount] = lWordArray[lWordCount] | (data[lByteCount] << lBytePosition);
|
|
77
|
+
lByteCount++;
|
|
78
|
+
}
|
|
79
|
+
// Append padding bits
|
|
80
|
+
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
|
|
81
|
+
lBytePosition = (lByteCount % 4) * 8;
|
|
82
|
+
lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
|
|
83
|
+
// Append message length in bits
|
|
84
|
+
lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
|
|
85
|
+
lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
|
|
86
|
+
return lWordArray;
|
|
87
|
+
}
|
|
88
|
+
function wordToHex(lValue) {
|
|
89
|
+
let wordToHexValue = '';
|
|
90
|
+
let wordToHexValueTemp = '';
|
|
91
|
+
let lByte;
|
|
92
|
+
let lCount;
|
|
93
|
+
for (lCount = 0; lCount <= 3; lCount++) {
|
|
94
|
+
lByte = (lValue >>> (lCount * 8)) & 255;
|
|
95
|
+
wordToHexValueTemp = '0' + lByte.toString(16);
|
|
96
|
+
wordToHexValue = wordToHexValue + wordToHexValueTemp.substr(wordToHexValueTemp.length - 2, 2);
|
|
97
|
+
}
|
|
98
|
+
return wordToHexValue;
|
|
99
|
+
}
|
|
100
|
+
function hash(bytes) {
|
|
101
|
+
let x = [];
|
|
102
|
+
let k;
|
|
103
|
+
let AA;
|
|
104
|
+
let BB;
|
|
105
|
+
let CC;
|
|
106
|
+
let DD;
|
|
107
|
+
let a;
|
|
108
|
+
let b;
|
|
109
|
+
let c;
|
|
110
|
+
let d;
|
|
111
|
+
const S11 = 7;
|
|
112
|
+
const S12 = 12;
|
|
113
|
+
const S13 = 17;
|
|
114
|
+
const S14 = 22;
|
|
115
|
+
const S21 = 5;
|
|
116
|
+
const S22 = 9;
|
|
117
|
+
const S23 = 14;
|
|
118
|
+
const S24 = 20;
|
|
119
|
+
const S31 = 4;
|
|
120
|
+
const S32 = 11;
|
|
121
|
+
const S33 = 16;
|
|
122
|
+
const S34 = 23;
|
|
123
|
+
const S41 = 6;
|
|
124
|
+
const S42 = 10;
|
|
125
|
+
const S43 = 15;
|
|
126
|
+
const S44 = 21;
|
|
127
|
+
x = convertToWordArray(bytes);
|
|
128
|
+
a = 0x67452301;
|
|
129
|
+
b = 0xefcdab89;
|
|
130
|
+
c = 0x98badcfe;
|
|
131
|
+
d = 0x10325476;
|
|
132
|
+
for (k = 0; k < x.length; k += 16) {
|
|
133
|
+
AA = a;
|
|
134
|
+
BB = b;
|
|
135
|
+
CC = c;
|
|
136
|
+
DD = d;
|
|
137
|
+
a = FF(a, b, c, d, x[k + 0], S11, 0xd76aa478);
|
|
138
|
+
d = FF(d, a, b, c, x[k + 1], S12, 0xe8c7b756);
|
|
139
|
+
c = FF(c, d, a, b, x[k + 2], S13, 0x242070db);
|
|
140
|
+
b = FF(b, c, d, a, x[k + 3], S14, 0xc1bdceee);
|
|
141
|
+
a = FF(a, b, c, d, x[k + 4], S11, 0xf57c0faf);
|
|
142
|
+
d = FF(d, a, b, c, x[k + 5], S12, 0x4787c62a);
|
|
143
|
+
c = FF(c, d, a, b, x[k + 6], S13, 0xa8304613);
|
|
144
|
+
b = FF(b, c, d, a, x[k + 7], S14, 0xfd469501);
|
|
145
|
+
a = FF(a, b, c, d, x[k + 8], S11, 0x698098d8);
|
|
146
|
+
d = FF(d, a, b, c, x[k + 9], S12, 0x8b44f7af);
|
|
147
|
+
c = FF(c, d, a, b, x[k + 10], S13, 0xffff5bb1);
|
|
148
|
+
b = FF(b, c, d, a, x[k + 11], S14, 0x895cd7be);
|
|
149
|
+
a = FF(a, b, c, d, x[k + 12], S11, 0x6b901122);
|
|
150
|
+
d = FF(d, a, b, c, x[k + 13], S12, 0xfd987193);
|
|
151
|
+
c = FF(c, d, a, b, x[k + 14], S13, 0xa679438e);
|
|
152
|
+
b = FF(b, c, d, a, x[k + 15], S14, 0x49b40821);
|
|
153
|
+
a = GG(a, b, c, d, x[k + 1], S21, 0xf61e2562);
|
|
154
|
+
d = GG(d, a, b, c, x[k + 6], S22, 0xc040b340);
|
|
155
|
+
c = GG(c, d, a, b, x[k + 11], S23, 0x265e5a51);
|
|
156
|
+
b = GG(b, c, d, a, x[k + 0], S24, 0xe9b6c7aa);
|
|
157
|
+
a = GG(a, b, c, d, x[k + 5], S21, 0xd62f105d);
|
|
158
|
+
d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);
|
|
159
|
+
c = GG(c, d, a, b, x[k + 15], S23, 0xd8a1e681);
|
|
160
|
+
b = GG(b, c, d, a, x[k + 4], S24, 0xe7d3fbc8);
|
|
161
|
+
a = GG(a, b, c, d, x[k + 9], S21, 0x21e1cde6);
|
|
162
|
+
d = GG(d, a, b, c, x[k + 14], S22, 0xc33707d6);
|
|
163
|
+
c = GG(c, d, a, b, x[k + 3], S23, 0xf4d50d87);
|
|
164
|
+
b = GG(b, c, d, a, x[k + 8], S24, 0x455a14ed);
|
|
165
|
+
a = GG(a, b, c, d, x[k + 13], S21, 0xa9e3e905);
|
|
166
|
+
d = GG(d, a, b, c, x[k + 2], S22, 0xfcefa3f8);
|
|
167
|
+
c = GG(c, d, a, b, x[k + 7], S23, 0x676f02d9);
|
|
168
|
+
b = GG(b, c, d, a, x[k + 12], S24, 0x8d2a4c8a);
|
|
169
|
+
a = HH(a, b, c, d, x[k + 5], S31, 0xfffa3942);
|
|
170
|
+
d = HH(d, a, b, c, x[k + 8], S32, 0x8771f681);
|
|
171
|
+
c = HH(c, d, a, b, x[k + 11], S33, 0x6d9d6122);
|
|
172
|
+
b = HH(b, c, d, a, x[k + 14], S34, 0xfde5380c);
|
|
173
|
+
a = HH(a, b, c, d, x[k + 1], S31, 0xa4beea44);
|
|
174
|
+
d = HH(d, a, b, c, x[k + 4], S32, 0x4bdecfa9);
|
|
175
|
+
c = HH(c, d, a, b, x[k + 7], S33, 0xf6bb4b60);
|
|
176
|
+
b = HH(b, c, d, a, x[k + 10], S34, 0xbebfbc70);
|
|
177
|
+
a = HH(a, b, c, d, x[k + 13], S31, 0x289b7ec6);
|
|
178
|
+
d = HH(d, a, b, c, x[k + 0], S32, 0xeaa127fa);
|
|
179
|
+
c = HH(c, d, a, b, x[k + 3], S33, 0xd4ef3085);
|
|
180
|
+
b = HH(b, c, d, a, x[k + 6], S34, 0x4881d05);
|
|
181
|
+
a = HH(a, b, c, d, x[k + 9], S31, 0xd9d4d039);
|
|
182
|
+
d = HH(d, a, b, c, x[k + 12], S32, 0xe6db99e5);
|
|
183
|
+
c = HH(c, d, a, b, x[k + 15], S33, 0x1fa27cf8);
|
|
184
|
+
b = HH(b, c, d, a, x[k + 2], S34, 0xc4ac5665);
|
|
185
|
+
a = II(a, b, c, d, x[k + 0], S41, 0xf4292244);
|
|
186
|
+
d = II(d, a, b, c, x[k + 7], S42, 0x432aff97);
|
|
187
|
+
c = II(c, d, a, b, x[k + 14], S43, 0xab9423a7);
|
|
188
|
+
b = II(b, c, d, a, x[k + 5], S44, 0xfc93a039);
|
|
189
|
+
a = II(a, b, c, d, x[k + 12], S41, 0x655b59c3);
|
|
190
|
+
d = II(d, a, b, c, x[k + 3], S42, 0x8f0ccc92);
|
|
191
|
+
c = II(c, d, a, b, x[k + 10], S43, 0xffeff47d);
|
|
192
|
+
b = II(b, c, d, a, x[k + 1], S44, 0x85845dd1);
|
|
193
|
+
a = II(a, b, c, d, x[k + 8], S41, 0x6fa87e4f);
|
|
194
|
+
d = II(d, a, b, c, x[k + 15], S42, 0xfe2ce6e0);
|
|
195
|
+
c = II(c, d, a, b, x[k + 6], S43, 0xa3014314);
|
|
196
|
+
b = II(b, c, d, a, x[k + 13], S44, 0x4e0811a1);
|
|
197
|
+
a = II(a, b, c, d, x[k + 4], S41, 0xf7537e82);
|
|
198
|
+
d = II(d, a, b, c, x[k + 11], S42, 0xbd3af235);
|
|
199
|
+
c = II(c, d, a, b, x[k + 2], S43, 0x2ad7d2bb);
|
|
200
|
+
b = II(b, c, d, a, x[k + 9], S44, 0xeb86d391);
|
|
201
|
+
a = addUnsigned(a, AA);
|
|
202
|
+
b = addUnsigned(b, BB);
|
|
203
|
+
c = addUnsigned(c, CC);
|
|
204
|
+
d = addUnsigned(d, DD);
|
|
205
|
+
}
|
|
206
|
+
return wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d);
|
|
207
|
+
}
|
|
208
|
+
const md5 = (input) => {
|
|
209
|
+
if (typeof input !== 'string' && !(input instanceof Uint8Array)) {
|
|
210
|
+
return '';
|
|
211
|
+
}
|
|
212
|
+
const bytes = typeof input === 'string' ? utf8_1.default.toUtf8Bytes(input) : input;
|
|
213
|
+
return hash(bytes);
|
|
214
|
+
};
|
|
215
|
+
const md5Base64 = (input) => {
|
|
216
|
+
const hex = md5(input);
|
|
217
|
+
if (!hex)
|
|
218
|
+
return '';
|
|
219
|
+
const bytes = base_1.default.hex2bytes(hex);
|
|
220
|
+
return base64_1.default.bytesToBase64(bytes);
|
|
221
|
+
};
|
|
222
|
+
exports.default = { md5, md5Base64 };
|
package/bin/lib/modules/html.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAllowed = exports.queryPermission = exports.legacyCopy = exports.copyText = void 0;
|
|
4
3
|
// import math from './math'
|
|
5
4
|
const qs_1 = require("./qs");
|
|
6
5
|
// interface IDowloadCallback {
|
|
@@ -58,7 +57,13 @@ const _downloadUrl = (url, filename) => {
|
|
|
58
57
|
console.error(`[ddan] _downloadUrl ${url}`, err);
|
|
59
58
|
}
|
|
60
59
|
};
|
|
61
|
-
const downloadUrl = (url, filename = '', checkSomeOrigin = false
|
|
60
|
+
const downloadUrl = (url, filename = '', checkSomeOrigin = false
|
|
61
|
+
// opts?: {
|
|
62
|
+
// success?: () => void
|
|
63
|
+
// progress?: (percentage: number, current: number, total: number) => void
|
|
64
|
+
// fail?: (error: any) => void
|
|
65
|
+
// }
|
|
66
|
+
) => {
|
|
62
67
|
try {
|
|
63
68
|
if (!url)
|
|
64
69
|
return;
|
|
@@ -183,27 +188,26 @@ const watermark = (text, { width = 400, height = 300, angle = 0, fillStyle = 'rg
|
|
|
183
188
|
const copyText = (text, legacy = false) => {
|
|
184
189
|
return new Promise((resolve) => {
|
|
185
190
|
if (legacy || !navigator.clipboard) {
|
|
186
|
-
resolve(
|
|
191
|
+
resolve(legacyCopy(text));
|
|
187
192
|
return;
|
|
188
193
|
}
|
|
189
|
-
|
|
194
|
+
queryPermission('clipboard-write')
|
|
190
195
|
.then((state) => {
|
|
191
|
-
if (
|
|
196
|
+
if (isAllowed(state, false)) {
|
|
192
197
|
navigator.clipboard
|
|
193
198
|
.writeText(text)
|
|
194
199
|
.then(() => resolve(true))
|
|
195
|
-
.catch(() => resolve(
|
|
200
|
+
.catch(() => resolve(legacyCopy(text)));
|
|
196
201
|
}
|
|
197
202
|
else {
|
|
198
|
-
resolve(
|
|
203
|
+
resolve(legacyCopy(text));
|
|
199
204
|
}
|
|
200
205
|
})
|
|
201
206
|
.catch(() => {
|
|
202
|
-
resolve(
|
|
207
|
+
resolve(legacyCopy(text));
|
|
203
208
|
});
|
|
204
209
|
});
|
|
205
210
|
};
|
|
206
|
-
exports.copyText = copyText;
|
|
207
211
|
const legacyCopy = (text) => {
|
|
208
212
|
try {
|
|
209
213
|
const _textarea = document.createElement('textarea');
|
|
@@ -228,7 +232,6 @@ const legacyCopy = (text) => {
|
|
|
228
232
|
return false;
|
|
229
233
|
}
|
|
230
234
|
};
|
|
231
|
-
exports.legacyCopy = legacyCopy;
|
|
232
235
|
const queryPermission = (name, def = 'denied') => {
|
|
233
236
|
return new Promise((resolve) => {
|
|
234
237
|
const permissions = navigator?.permissions;
|
|
@@ -241,13 +244,36 @@ const queryPermission = (name, def = 'denied') => {
|
|
|
241
244
|
.catch(() => resolve(def));
|
|
242
245
|
});
|
|
243
246
|
};
|
|
244
|
-
exports.queryPermission = queryPermission;
|
|
245
247
|
const isAllowed = (status, prompt = true) => {
|
|
246
248
|
if (prompt && status === 'prompt')
|
|
247
249
|
return true;
|
|
248
250
|
return status === 'granted';
|
|
249
251
|
};
|
|
250
|
-
|
|
252
|
+
const takeHtmlLinks = (htmlContent) => {
|
|
253
|
+
if (!htmlContent)
|
|
254
|
+
return [];
|
|
255
|
+
const regexs = [
|
|
256
|
+
/<script[^>]+src="([^"]+)"/g,
|
|
257
|
+
/<link[^>]+rel="stylesheet"[^>]+href="([^"]+)"/g,
|
|
258
|
+
/<link[^>]+rel="icon"[^>]+href="([^"]+)"/g,
|
|
259
|
+
];
|
|
260
|
+
const results = [];
|
|
261
|
+
regexs.forEach((e) => {
|
|
262
|
+
const r = takeHtml(htmlContent, e);
|
|
263
|
+
results.push(r);
|
|
264
|
+
});
|
|
265
|
+
return [].concat(...results);
|
|
266
|
+
};
|
|
267
|
+
const takeHtml = (htmlContent, regex) => {
|
|
268
|
+
if (!htmlContent || !regex)
|
|
269
|
+
return [];
|
|
270
|
+
const results = [];
|
|
271
|
+
let match;
|
|
272
|
+
while ((match = regex.exec(htmlContent)) !== null) {
|
|
273
|
+
results.push(match[1]);
|
|
274
|
+
}
|
|
275
|
+
return results;
|
|
276
|
+
};
|
|
251
277
|
exports.default = {
|
|
252
278
|
dataURLtoFile,
|
|
253
279
|
dataURLtoBlob,
|
|
@@ -258,8 +284,10 @@ exports.default = {
|
|
|
258
284
|
downloadFile,
|
|
259
285
|
downloadImage,
|
|
260
286
|
watermark,
|
|
261
|
-
copyText
|
|
262
|
-
queryPermission
|
|
263
|
-
isAllowed
|
|
264
|
-
legacyCopy
|
|
287
|
+
copyText,
|
|
288
|
+
queryPermission,
|
|
289
|
+
isAllowed,
|
|
290
|
+
legacyCopy,
|
|
291
|
+
takeHtmlLinks,
|
|
292
|
+
takeHtml,
|
|
265
293
|
};
|
|
@@ -95,6 +95,14 @@ const jsonFormat = (jsonString) => {
|
|
|
95
95
|
return jsonString;
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
+
const toLines = (content, separator = '\n') => {
|
|
99
|
+
if (!content)
|
|
100
|
+
return [];
|
|
101
|
+
return content
|
|
102
|
+
.split(separator)
|
|
103
|
+
.map((line) => line.trim())
|
|
104
|
+
.filter((txt) => !!txt);
|
|
105
|
+
};
|
|
98
106
|
exports.default = {
|
|
99
107
|
toString,
|
|
100
108
|
startCase,
|
|
@@ -108,5 +116,6 @@ exports.default = {
|
|
|
108
116
|
splitOnFirst,
|
|
109
117
|
parseValue,
|
|
110
118
|
replace,
|
|
111
|
-
jsonFormat
|
|
119
|
+
jsonFormat,
|
|
120
|
+
toLines,
|
|
112
121
|
};
|
package/bin/types/browser.d.ts
CHANGED
|
@@ -88,6 +88,8 @@ declare const dUtil: {
|
|
|
88
88
|
textEncode: (text: string) => Uint8Array;
|
|
89
89
|
textDecode: (buf: ArrayBufferLike) => string;
|
|
90
90
|
toDataUrl: (textOrBuf: string | ArrayBuffer, contentType?: string) => string;
|
|
91
|
+
md5: (input: string | Uint8Array) => string;
|
|
92
|
+
md5Base64: (input: string | Uint8Array) => string;
|
|
91
93
|
toBase64: (input?: string) => string;
|
|
92
94
|
fromBase64: (input?: string) => string;
|
|
93
95
|
bytesToBase64: (bytes: Uint8Array) => string;
|
|
@@ -164,6 +166,7 @@ declare const dUtil: {
|
|
|
164
166
|
}) => any;
|
|
165
167
|
replace: (source: string, rules: import("./typings").Ddan.IRegexRule | import("./typings").Ddan.IRegexRule[]) => string;
|
|
166
168
|
jsonFormat: (jsonString: string) => string;
|
|
169
|
+
toLines: (content: string, separator?: string | RegExp) => string[];
|
|
167
170
|
};
|
|
168
171
|
time: {
|
|
169
172
|
now: () => import("./modules/time/dtime").default;
|
|
@@ -323,6 +326,7 @@ declare const dHook: {
|
|
|
323
326
|
}) => any;
|
|
324
327
|
replace: (source: string, rules: import("./typings").Ddan.IRegexRule | import("./typings").Ddan.IRegexRule[]) => string;
|
|
325
328
|
jsonFormat: (jsonString: string) => string;
|
|
329
|
+
toLines: (content: string, separator?: string | RegExp) => string[];
|
|
326
330
|
sleep: (ms?: number) => Promise<unknown>;
|
|
327
331
|
run: <T_1 = any>(task?: import("./typings").Ddan.PFunction<T_1> | undefined, wait?: number) => Promise<[any, undefined] | [null, T_1]>;
|
|
328
332
|
exec: (func: import("./typings").Ddan.Function, taskId?: string) => import("./typings").Ddan.PSafeResult<any>;
|
|
@@ -339,7 +343,7 @@ declare const dHook: {
|
|
|
339
343
|
bezier3: (p0: import("./typings").Ddan.IPoint, p1: import("./typings").Ddan.IPoint, p2: import("./typings").Ddan.IPoint, p3: import("./typings").Ddan.IPoint, t: number) => import("./typings").Ddan.IPoint;
|
|
340
344
|
bezier: (points: import("./typings").Ddan.IPoint[], t: number) => import("./typings").Ddan.IPoint;
|
|
341
345
|
bezierCurve: (points: import("./typings").Ddan.IPoint[], t: number) => import("./typings").Ddan.IPoint;
|
|
342
|
-
lerpAverage: (points: import("./typings").Ddan.IPoint[], step: number, type?: "" | "
|
|
346
|
+
lerpAverage: (points: import("./typings").Ddan.IPoint[], step: number, type?: "" | "lerp") => number;
|
|
343
347
|
proportion: (start: number, end: number, current: number) => number;
|
|
344
348
|
logString: (data: any) => string;
|
|
345
349
|
logParse: (logStr: string) => string;
|
|
@@ -381,6 +385,8 @@ declare const dHook: {
|
|
|
381
385
|
textEncode: (text: string) => Uint8Array;
|
|
382
386
|
textDecode: (buf: ArrayBufferLike) => string;
|
|
383
387
|
toDataUrl: (textOrBuf: string | ArrayBuffer, contentType?: string) => string;
|
|
388
|
+
md5: (input: string | Uint8Array) => string;
|
|
389
|
+
md5Base64: (input: string | Uint8Array) => string;
|
|
384
390
|
toBase64: (input?: string) => string;
|
|
385
391
|
fromBase64: (input?: string) => string;
|
|
386
392
|
bytesToBase64: (bytes: Uint8Array) => string;
|
|
@@ -495,6 +501,8 @@ declare const dMini: {
|
|
|
495
501
|
queryPermission: (name: string, def?: PermissionState) => Promise<PermissionState>;
|
|
496
502
|
isAllowed: (status: PermissionState | undefined, prompt?: boolean) => boolean;
|
|
497
503
|
legacyCopy: (text: string) => boolean;
|
|
504
|
+
takeHtmlLinks: (htmlContent: string) => never[];
|
|
505
|
+
takeHtml: (htmlContent: string, regex: RegExp) => string[];
|
|
498
506
|
};
|
|
499
507
|
};
|
|
500
508
|
declare const dCdn: {
|
|
@@ -637,6 +645,8 @@ declare const dWeb: {
|
|
|
637
645
|
queryPermission: (name: string, def?: PermissionState) => Promise<PermissionState>;
|
|
638
646
|
isAllowed: (status: PermissionState | undefined, prompt?: boolean) => boolean;
|
|
639
647
|
legacyCopy: (text: string) => boolean;
|
|
648
|
+
takeHtmlLinks: (htmlContent: string) => never[];
|
|
649
|
+
takeHtml: (htmlContent: string, regex: RegExp) => string[];
|
|
640
650
|
};
|
|
641
651
|
rsa: {
|
|
642
652
|
generateKeys: () => Promise<{
|
|
@@ -698,7 +708,7 @@ declare const _default: {
|
|
|
698
708
|
bezier: (points: import("./typings").Ddan.IPoint[], t: number) => import("./typings").Ddan.IPoint;
|
|
699
709
|
bezierCurve: (points: import("./typings").Ddan.IPoint[], t: number) => import("./typings").Ddan.IPoint;
|
|
700
710
|
lerp: (start: number, end: number, t: number) => number;
|
|
701
|
-
lerpAverage: (points: import("./typings").Ddan.IPoint[], step: number, type?: "" | "
|
|
711
|
+
lerpAverage: (points: import("./typings").Ddan.IPoint[], step: number, type?: "" | "lerp") => number;
|
|
702
712
|
proportion: (start: number, end: number, current: number) => number;
|
|
703
713
|
logString: (data: any) => string;
|
|
704
714
|
logParse: (logStr: string) => string;
|
|
@@ -814,6 +824,7 @@ declare const _default: {
|
|
|
814
824
|
}) => any;
|
|
815
825
|
replace: (source: string, rules: import("./typings").Ddan.IRegexRule | import("./typings").Ddan.IRegexRule[]) => string;
|
|
816
826
|
jsonFormat: (jsonString: string) => string;
|
|
827
|
+
toLines: (content: string, separator?: string | RegExp) => string[];
|
|
817
828
|
};
|
|
818
829
|
obj: {
|
|
819
830
|
copy: (source: any, options?: {
|
|
@@ -964,6 +975,8 @@ declare const _default: {
|
|
|
964
975
|
queryPermission: (name: string, def?: PermissionState) => Promise<PermissionState>;
|
|
965
976
|
isAllowed: (status: PermissionState | undefined, prompt?: boolean) => boolean;
|
|
966
977
|
legacyCopy: (text: string) => boolean;
|
|
978
|
+
takeHtmlLinks: (htmlContent: string) => never[];
|
|
979
|
+
takeHtml: (htmlContent: string, regex: RegExp) => string[];
|
|
967
980
|
};
|
|
968
981
|
icon: import("./class/icon").DIcon;
|
|
969
982
|
rule: {
|
|
@@ -1000,6 +1013,8 @@ declare const _default: {
|
|
|
1000
1013
|
textEncode: (text: string) => Uint8Array;
|
|
1001
1014
|
textDecode: (buf: ArrayBufferLike) => string;
|
|
1002
1015
|
toDataUrl: (textOrBuf: string | ArrayBuffer, contentType?: string) => string;
|
|
1016
|
+
md5: (input: string | Uint8Array) => string;
|
|
1017
|
+
md5Base64: (input: string | Uint8Array) => string;
|
|
1003
1018
|
toBase64: (input?: string) => string;
|
|
1004
1019
|
fromBase64: (input?: string) => string;
|
|
1005
1020
|
bytesToBase64: (bytes: Uint8Array) => string;
|
package/bin/types/index.d.ts
CHANGED
|
@@ -88,6 +88,8 @@ declare const dUtil: {
|
|
|
88
88
|
textEncode: (text: string) => Uint8Array;
|
|
89
89
|
textDecode: (buf: ArrayBufferLike) => string;
|
|
90
90
|
toDataUrl: (textOrBuf: string | ArrayBuffer, contentType?: string) => string;
|
|
91
|
+
md5: (input: string | Uint8Array) => string;
|
|
92
|
+
md5Base64: (input: string | Uint8Array) => string;
|
|
91
93
|
toBase64: (input?: string) => string;
|
|
92
94
|
fromBase64: (input?: string) => string;
|
|
93
95
|
bytesToBase64: (bytes: Uint8Array) => string;
|
|
@@ -164,6 +166,7 @@ declare const dUtil: {
|
|
|
164
166
|
}) => any;
|
|
165
167
|
replace: (source: string, rules: import("./typings").Ddan.IRegexRule | import("./typings").Ddan.IRegexRule[]) => string;
|
|
166
168
|
jsonFormat: (jsonString: string) => string;
|
|
169
|
+
toLines: (content: string, separator?: string | RegExp) => string[];
|
|
167
170
|
};
|
|
168
171
|
time: {
|
|
169
172
|
now: () => import("./modules/time/dtime").default;
|
|
@@ -323,6 +326,7 @@ declare const dHook: {
|
|
|
323
326
|
}) => any;
|
|
324
327
|
replace: (source: string, rules: import("./typings").Ddan.IRegexRule | import("./typings").Ddan.IRegexRule[]) => string;
|
|
325
328
|
jsonFormat: (jsonString: string) => string;
|
|
329
|
+
toLines: (content: string, separator?: string | RegExp) => string[];
|
|
326
330
|
sleep: (ms?: number) => Promise<unknown>;
|
|
327
331
|
run: <T_1 = any>(task?: import("./typings").Ddan.PFunction<T_1> | undefined, wait?: number) => Promise<[any, undefined] | [null, T_1]>;
|
|
328
332
|
exec: (func: import("./typings").Ddan.Function, taskId?: string) => import("./typings").Ddan.PSafeResult<any>;
|
|
@@ -339,7 +343,7 @@ declare const dHook: {
|
|
|
339
343
|
bezier3: (p0: import("./typings").Ddan.IPoint, p1: import("./typings").Ddan.IPoint, p2: import("./typings").Ddan.IPoint, p3: import("./typings").Ddan.IPoint, t: number) => import("./typings").Ddan.IPoint;
|
|
340
344
|
bezier: (points: import("./typings").Ddan.IPoint[], t: number) => import("./typings").Ddan.IPoint;
|
|
341
345
|
bezierCurve: (points: import("./typings").Ddan.IPoint[], t: number) => import("./typings").Ddan.IPoint;
|
|
342
|
-
lerpAverage: (points: import("./typings").Ddan.IPoint[], step: number, type?: "" | "
|
|
346
|
+
lerpAverage: (points: import("./typings").Ddan.IPoint[], step: number, type?: "" | "lerp") => number;
|
|
343
347
|
proportion: (start: number, end: number, current: number) => number;
|
|
344
348
|
logString: (data: any) => string;
|
|
345
349
|
logParse: (logStr: string) => string;
|
|
@@ -381,6 +385,8 @@ declare const dHook: {
|
|
|
381
385
|
textEncode: (text: string) => Uint8Array;
|
|
382
386
|
textDecode: (buf: ArrayBufferLike) => string;
|
|
383
387
|
toDataUrl: (textOrBuf: string | ArrayBuffer, contentType?: string) => string;
|
|
388
|
+
md5: (input: string | Uint8Array) => string;
|
|
389
|
+
md5Base64: (input: string | Uint8Array) => string;
|
|
384
390
|
toBase64: (input?: string) => string;
|
|
385
391
|
fromBase64: (input?: string) => string;
|
|
386
392
|
bytesToBase64: (bytes: Uint8Array) => string;
|
|
@@ -495,6 +501,8 @@ declare const dMini: {
|
|
|
495
501
|
queryPermission: (name: string, def?: PermissionState) => Promise<PermissionState>;
|
|
496
502
|
isAllowed: (status: PermissionState | undefined, prompt?: boolean) => boolean;
|
|
497
503
|
legacyCopy: (text: string) => boolean;
|
|
504
|
+
takeHtmlLinks: (htmlContent: string) => never[];
|
|
505
|
+
takeHtml: (htmlContent: string, regex: RegExp) => string[];
|
|
498
506
|
};
|
|
499
507
|
};
|
|
500
508
|
declare const dCdn: {
|
|
@@ -637,6 +645,8 @@ declare const dWeb: {
|
|
|
637
645
|
queryPermission: (name: string, def?: PermissionState) => Promise<PermissionState>;
|
|
638
646
|
isAllowed: (status: PermissionState | undefined, prompt?: boolean) => boolean;
|
|
639
647
|
legacyCopy: (text: string) => boolean;
|
|
648
|
+
takeHtmlLinks: (htmlContent: string) => never[];
|
|
649
|
+
takeHtml: (htmlContent: string, regex: RegExp) => string[];
|
|
640
650
|
};
|
|
641
651
|
rsa: {
|
|
642
652
|
generateKeys: () => Promise<{
|
|
@@ -734,7 +744,7 @@ declare const _default: {
|
|
|
734
744
|
bezier: (points: import("./typings").Ddan.IPoint[], t: number) => import("./typings").Ddan.IPoint;
|
|
735
745
|
bezierCurve: (points: import("./typings").Ddan.IPoint[], t: number) => import("./typings").Ddan.IPoint;
|
|
736
746
|
lerp: (start: number, end: number, t: number) => number;
|
|
737
|
-
lerpAverage: (points: import("./typings").Ddan.IPoint[], step: number, type?: "" | "
|
|
747
|
+
lerpAverage: (points: import("./typings").Ddan.IPoint[], step: number, type?: "" | "lerp") => number;
|
|
738
748
|
proportion: (start: number, end: number, current: number) => number;
|
|
739
749
|
logString: (data: any) => string;
|
|
740
750
|
logParse: (logStr: string) => string;
|
|
@@ -850,6 +860,7 @@ declare const _default: {
|
|
|
850
860
|
}) => any;
|
|
851
861
|
replace: (source: string, rules: import("./typings").Ddan.IRegexRule | import("./typings").Ddan.IRegexRule[]) => string;
|
|
852
862
|
jsonFormat: (jsonString: string) => string;
|
|
863
|
+
toLines: (content: string, separator?: string | RegExp) => string[];
|
|
853
864
|
};
|
|
854
865
|
obj: {
|
|
855
866
|
copy: (source: any, options?: {
|
|
@@ -1000,6 +1011,8 @@ declare const _default: {
|
|
|
1000
1011
|
queryPermission: (name: string, def?: PermissionState) => Promise<PermissionState>;
|
|
1001
1012
|
isAllowed: (status: PermissionState | undefined, prompt?: boolean) => boolean;
|
|
1002
1013
|
legacyCopy: (text: string) => boolean;
|
|
1014
|
+
takeHtmlLinks: (htmlContent: string) => never[];
|
|
1015
|
+
takeHtml: (htmlContent: string, regex: RegExp) => string[];
|
|
1003
1016
|
};
|
|
1004
1017
|
icon: import("./class/icon").DIcon;
|
|
1005
1018
|
rule: {
|
|
@@ -1036,6 +1049,8 @@ declare const _default: {
|
|
|
1036
1049
|
textEncode: (text: string) => Uint8Array;
|
|
1037
1050
|
textDecode: (buf: ArrayBufferLike) => string;
|
|
1038
1051
|
toDataUrl: (textOrBuf: string | ArrayBuffer, contentType?: string) => string;
|
|
1052
|
+
md5: (input: string | Uint8Array) => string;
|
|
1053
|
+
md5Base64: (input: string | Uint8Array) => string;
|
|
1039
1054
|
toBase64: (input?: string) => string;
|
|
1040
1055
|
fromBase64: (input?: string) => string;
|
|
1041
1056
|
bytesToBase64: (bytes: Uint8Array) => string;
|
|
@@ -7,6 +7,8 @@ declare const _default: {
|
|
|
7
7
|
textEncode: (text: string) => Uint8Array;
|
|
8
8
|
textDecode: (buf: ArrayBufferLike) => string;
|
|
9
9
|
toDataUrl: (textOrBuf: string | ArrayBuffer, contentType?: string) => string;
|
|
10
|
+
md5: (input: string | Uint8Array) => string;
|
|
11
|
+
md5Base64: (input: string | Uint8Array) => string;
|
|
10
12
|
toBase64: (input?: string) => string;
|
|
11
13
|
fromBase64: (input?: string) => string;
|
|
12
14
|
bytesToBase64: (bytes: Uint8Array) => string;
|
|
@@ -31,7 +31,7 @@ declare const _default: {
|
|
|
31
31
|
bezier: (points: Ddan.IPoint[], t: number) => Ddan.IPoint;
|
|
32
32
|
bezierCurve: (points: Ddan.IPoint[], t: number) => Ddan.IPoint;
|
|
33
33
|
lerp: (start: number, end: number, t: number) => number;
|
|
34
|
-
lerpAverage: (points: Ddan.IPoint[], step: number, type?: "" | "
|
|
34
|
+
lerpAverage: (points: Ddan.IPoint[], step: number, type?: "" | "lerp") => number;
|
|
35
35
|
proportion: (start: number, end: number, current: number) => number;
|
|
36
36
|
logString: (data: any) => string;
|
|
37
37
|
logParse: (logStr: string) => string;
|
|
@@ -6,7 +6,7 @@ declare const _default: {
|
|
|
6
6
|
bezier: (points: Ddan.IPoint[], t: number) => Ddan.IPoint;
|
|
7
7
|
bezierCurve: (points: Ddan.IPoint[], t: number) => Ddan.IPoint;
|
|
8
8
|
lerp: (start: number, end: number, t: number) => number;
|
|
9
|
-
lerpAverage: (points: Ddan.IPoint[], step: number, type?: "" | "
|
|
9
|
+
lerpAverage: (points: Ddan.IPoint[], step: number, type?: "" | "lerp") => number;
|
|
10
10
|
proportion: (start: number, end: number, current: number) => number;
|
|
11
11
|
};
|
|
12
12
|
export default _default;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
export declare const copyText: (text: string, legacy?: boolean) => Promise<boolean>;
|
|
2
|
-
export declare const legacyCopy: (text: string) => boolean;
|
|
3
|
-
export declare const queryPermission: (name: string, def?: PermissionState) => Promise<PermissionState>;
|
|
4
|
-
export declare const isAllowed: (status: PermissionState | undefined, prompt?: boolean) => boolean;
|
|
5
1
|
declare const _default: {
|
|
6
2
|
dataURLtoFile: (dataurl: any, filename: any) => File;
|
|
7
3
|
dataURLtoBlob: (dataurl: any) => Blob;
|
|
@@ -24,5 +20,7 @@ declare const _default: {
|
|
|
24
20
|
queryPermission: (name: string, def?: PermissionState) => Promise<PermissionState>;
|
|
25
21
|
isAllowed: (status: PermissionState | undefined, prompt?: boolean) => boolean;
|
|
26
22
|
legacyCopy: (text: string) => boolean;
|
|
23
|
+
takeHtmlLinks: (htmlContent: string) => never[];
|
|
24
|
+
takeHtml: (htmlContent: string, regex: RegExp) => string[];
|
|
27
25
|
};
|
|
28
26
|
export default _default;
|
|
@@ -17,5 +17,6 @@ declare const _default: {
|
|
|
17
17
|
}) => any;
|
|
18
18
|
replace: (source: string, rules: Ddan.IRegexRule | Ddan.IRegexRule[]) => string;
|
|
19
19
|
jsonFormat: (jsonString: string) => string;
|
|
20
|
+
toLines: (content: string, separator?: string | RegExp) => string[];
|
|
20
21
|
};
|
|
21
22
|
export default _default;
|