sculp-js 1.19.12 → 1.19.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/cjs/array.cjs +1 -1
  2. package/dist/cjs/async.cjs +1 -1
  3. package/dist/cjs/base64.cjs +7 -8
  4. package/dist/cjs/clipboard.cjs +1 -1
  5. package/dist/cjs/cloneDeep.cjs +1 -1
  6. package/dist/cjs/cookie.cjs +1 -1
  7. package/dist/cjs/date.cjs +1 -1
  8. package/dist/cjs/dom.cjs +1 -1
  9. package/dist/cjs/download.cjs +1 -1
  10. package/dist/cjs/file.cjs +1 -1
  11. package/dist/cjs/func.cjs +2 -29
  12. package/dist/cjs/index.cjs +1 -3
  13. package/dist/cjs/isEqual.cjs +1 -1
  14. package/dist/cjs/math.cjs +1 -1
  15. package/dist/cjs/number.cjs +3 -3
  16. package/dist/cjs/object.cjs +1 -1
  17. package/dist/cjs/path.cjs +1 -1
  18. package/dist/cjs/qs.cjs +1 -1
  19. package/dist/cjs/random.cjs +1 -1
  20. package/dist/cjs/string.cjs +1 -1
  21. package/dist/cjs/tooltip.cjs +1 -1
  22. package/dist/cjs/tree.cjs +29 -26
  23. package/dist/cjs/type.cjs +1 -1
  24. package/dist/cjs/unicodeToolkit.cjs +1 -1
  25. package/dist/cjs/unique.cjs +1 -1
  26. package/dist/cjs/url.cjs +1 -1
  27. package/dist/cjs/validator.cjs +1 -1
  28. package/dist/cjs/variable.cjs +1 -1
  29. package/dist/cjs/watermark.cjs +1 -1
  30. package/dist/esm/array.mjs +1 -1
  31. package/dist/esm/async.mjs +1 -1
  32. package/dist/esm/base64.mjs +7 -8
  33. package/dist/esm/clipboard.mjs +1 -1
  34. package/dist/esm/cloneDeep.mjs +1 -1
  35. package/dist/esm/cookie.mjs +1 -1
  36. package/dist/esm/date.mjs +1 -1
  37. package/dist/esm/dom.mjs +1 -1
  38. package/dist/esm/download.mjs +1 -1
  39. package/dist/esm/file.mjs +1 -1
  40. package/dist/esm/func.mjs +3 -28
  41. package/dist/esm/index.mjs +2 -2
  42. package/dist/esm/isEqual.mjs +1 -1
  43. package/dist/esm/math.mjs +1 -1
  44. package/dist/esm/number.mjs +3 -3
  45. package/dist/esm/object.mjs +1 -1
  46. package/dist/esm/path.mjs +1 -1
  47. package/dist/esm/qs.mjs +1 -1
  48. package/dist/esm/random.mjs +1 -1
  49. package/dist/esm/string.mjs +1 -1
  50. package/dist/esm/tooltip.mjs +1 -1
  51. package/dist/esm/tree.mjs +29 -26
  52. package/dist/esm/type.mjs +1 -1
  53. package/dist/esm/unicodeToolkit.mjs +1 -1
  54. package/dist/esm/unique.mjs +1 -1
  55. package/dist/esm/url.mjs +1 -1
  56. package/dist/esm/validator.mjs +1 -1
  57. package/dist/esm/variable.mjs +1 -1
  58. package/dist/esm/watermark.mjs +1 -1
  59. package/dist/types/func.d.ts +0 -14
  60. package/dist/types/tree.d.ts +16 -13
  61. package/dist/umd/index.min.js +2 -2
  62. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -8,7 +8,6 @@
8
8
 
9
9
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
10
10
 
11
- var func = require('./func.cjs');
12
11
  var type = require('./type.cjs');
13
12
 
14
13
  const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -155,15 +154,15 @@ function weAtob(string) {
155
154
  */
156
155
  function b64decode(base64) {
157
156
  // 优先使用原生方法(性能最优)
158
- if (!type.isNullOrUnDef(func.getGlobal('atob')) && !type.isNullOrUnDef(func.getGlobal('TextDecoder'))) {
157
+ if (!type.isNullOrUnDef(globalThis.atob) && !type.isNullOrUnDef(globalThis.TextDecoder)) {
159
158
  try {
160
- const binaryString = func.getGlobal('atob')(base64);
159
+ const binaryString = globalThis.atob(base64);
161
160
  const len = binaryString.length;
162
161
  const bytes = new Uint8Array(len);
163
162
  for (let i = 0; i < len; i++) {
164
163
  bytes[i] = binaryString.charCodeAt(i);
165
164
  }
166
- return new (func.getGlobal('TextDecoder'))('utf-8').decode(bytes);
165
+ return new globalThis.TextDecoder('utf-8').decode(bytes);
167
166
  } catch (e) {
168
167
  // 如果原生方法失败,使用降级方案
169
168
  }
@@ -184,15 +183,15 @@ function b64decode(base64) {
184
183
  */
185
184
  function b64encode(rawStr) {
186
185
  // 优先使用原生方法(性能最优)
187
- if (!type.isNullOrUnDef(func.getGlobal('btoa')) && !type.isNullOrUnDef(func.getGlobal('TextEncoder'))) {
186
+ if (!type.isNullOrUnDef(globalThis.btoa) && !type.isNullOrUnDef(globalThis.TextEncoder)) {
188
187
  try {
189
- const utf8Array = new (func.getGlobal('TextEncoder'))().encode(rawStr);
188
+ const utf8Array = new globalThis.TextEncoder().encode(rawStr);
190
189
  let binaryString = '';
191
190
  const len = utf8Array.length;
192
191
  for (let i = 0; i < len; i++) {
193
192
  binaryString += String.fromCharCode(utf8Array[i]);
194
193
  }
195
- return func.getGlobal('btoa')(binaryString);
194
+ return globalThis.btoa(binaryString);
196
195
  } catch (e) {
197
196
  // 如果原生方法失败,使用降级方案
198
197
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/cjs/date.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/cjs/dom.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/cjs/file.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/cjs/func.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -90,40 +90,13 @@ const once = func => {
90
90
  return result;
91
91
  };
92
92
  };
93
- /**
94
- * 设置全局变量
95
- * @param {string | number | symbol} key
96
- * @param val
97
- */
98
- function setGlobal(key, val) {
99
- if (typeof globalThis !== 'undefined') globalThis[key] = val;
100
- else if (typeof window !== 'undefined') window[key] = val;
101
- else if (typeof global !== 'undefined') global[key] = val;
102
- else if (typeof self !== 'undefined') self[key] = val;
103
- else throw new SyntaxError('当前环境下无法设置全局属性');
104
- }
105
- /**
106
- * 获取全局变量
107
- * @param {string | number | symbol} key
108
- * @param val
109
- */
110
- function getGlobal(key) {
111
- if (typeof globalThis !== 'undefined') return globalThis[key];
112
- else if (typeof window !== 'undefined') return window[key];
113
- else if (typeof global !== 'undefined') return global[key];
114
- else if (typeof self !== 'undefined') return self[key];
115
- }
116
93
  var func = {
117
94
  debounce,
118
95
  throttle,
119
- once,
120
- getGlobal,
121
- setGlobal
96
+ once
122
97
  };
123
98
 
124
99
  exports.debounce = debounce;
125
100
  exports.default = func;
126
- exports.getGlobal = getGlobal;
127
101
  exports.once = once;
128
- exports.setGlobal = setGlobal;
129
102
  exports.throttle = throttle;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -166,9 +166,7 @@ exports.compressImg = file.compressImg;
166
166
  exports.supportCanvas = file.supportCanvas;
167
167
  exports.genCanvasWM = watermark.genCanvasWM;
168
168
  exports.debounce = func.debounce;
169
- exports.getGlobal = func.getGlobal;
170
169
  exports.once = func.once;
171
- exports.setGlobal = func.setGlobal;
172
170
  exports.throttle = func.throttle;
173
171
  exports.STRING_POOL = random.STRING_POOL;
174
172
  exports.randomNumber = random.randomNumber;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/cjs/math.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -8,13 +8,13 @@
8
8
 
9
9
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
10
10
 
11
- var func = require('./func.cjs');
12
11
  var string = require('./string.cjs');
13
12
  var type = require('./type.cjs');
14
13
 
15
14
  const HEX_POOL = `${string.STRING_ARABIC_NUMERALS}${string.STRING_UPPERCASE_ALPHA}${string.STRING_LOWERCASE_ALPHA}`;
16
15
  const supportBigInt = typeof BigInt !== 'undefined';
17
- const jsbi = () => func.getGlobal('JSBI');
16
+ // @ts-ignore
17
+ const jsbi = () => globalThis.JSBI;
18
18
  const toBigInt = n => (supportBigInt ? BigInt(n) : jsbi().BigInt(n));
19
19
  const divide = (x, y) => (supportBigInt ? x / y : jsbi().divide(x, y));
20
20
  const remainder = (x, y) => (supportBigInt ? x % y : jsbi().remainder(x, y));
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/cjs/path.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/cjs/qs.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/cjs/tree.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -21,13 +21,13 @@ const defaultSearchTreeOptions = {
21
21
  function getChildNodes(item, childField, isDomNode) {
22
22
  const child = item[childField];
23
23
  if (!child) return null;
24
- return isDomNode && type.isNodeList(child) ? Array.from(child) : Array.isArray(child) ? child : null;
24
+ return isDomNode && type.isNodeList(child) ? child : Array.isArray(child) ? child : null;
25
25
  }
26
26
  /**
27
27
  * Tree traversal function (default DFS, supports continue and break operations).
28
28
  * Can be used to traverse Array and NodeList type data.
29
- * @param {V[]} tree - Tree data
30
- * @param {Function} iterator - Iterator function. Returns true to continue, false to break.
29
+ * @param {ArrayLike<V>} tree - Tree data
30
+ * @param {Function} iteratee - Iteratee function. Returns true to continue, false to break.
31
31
  * @param {object} options - Options to customize child element name, reverse traversal, breadth-first traversal. Default: {
32
32
  childField: 'children',
33
33
  reverse: false,
@@ -38,7 +38,7 @@ function getChildNodes(item, childField, isDomNode) {
38
38
  */
39
39
  function forEachDeep(
40
40
  tree,
41
- iterator,
41
+ iteratee,
42
42
  options = {
43
43
  childField: 'children',
44
44
  reverse: false,
@@ -55,12 +55,12 @@ function forEachDeep(
55
55
  let isBreak = false;
56
56
  const queue = [];
57
57
  const processNode = (item, index, arr, parent, level) => {
58
- const re = iterator(item, index, arr, tree, parent, level);
59
- if (re === false) {
58
+ const result = iteratee(item, index, arr, tree, parent, level);
59
+ if (result === false) {
60
60
  isBreak = true;
61
61
  return;
62
62
  }
63
- if (re === true) return;
63
+ if (result === true) return;
64
64
  const childNodes = getChildNodes(item, childField, isDomNode);
65
65
  if (childNodes) {
66
66
  if (breadthFirst) {
@@ -104,7 +104,7 @@ function forEachDeep(
104
104
  }
105
105
  /**
106
106
  * Tree search function, can be used to search Array and NodeList type data.
107
- * @param {V[]} tree - Tree data
107
+ * @param {ArrayLike<V>} tree - Tree data
108
108
  * @param {Function} predicate - Predicate function
109
109
  * @param {object} options - Options to customize child element name, reverse traversal, breadth-first traversal. Default: {
110
110
  childField: 'children',
@@ -139,7 +139,7 @@ function findDeep(
139
139
  }
140
140
  /**
141
141
  * Tree filter function, can be used to filter Array and NodeList type data.
142
- * @param {V[]} tree - Tree data
142
+ * @param {ArrayLike<V>} tree - Tree data
143
143
  * @param {Function} predicate - Predicate function
144
144
  * @param {object} options - Options to customize child element name, reverse traversal, breadth-first traversal. Default: {
145
145
  childField: 'children',
@@ -176,8 +176,8 @@ function filterDeep(
176
176
  * Can be used for inserting or removing tree items.
177
177
  *
178
178
  * Can traverse any array-like object with a length property and numeric keys.
179
- * @param {V[]} tree - Tree data
180
- * @param {Function} iterator - Iterator function. Returns true to continue, false to break.
179
+ * @param {ArrayLike<V>} tree - Tree data
180
+ * @param {Function} iteratee - Iteratee function. Returns true to continue, false to break.
181
181
  * @param {object} options - Options to customize child element name, reverse traversal. Default: {
182
182
  childField: 'children',
183
183
  reverse: false,
@@ -186,7 +186,7 @@ function filterDeep(
186
186
  */
187
187
  function mapDeep(
188
188
  tree,
189
- iterator,
189
+ iteratee,
190
190
  options = {
191
191
  childField: 'children',
192
192
  reverse: false
@@ -200,13 +200,13 @@ function mapDeep(
200
200
  for (let i = arr.length - 1; i >= 0; i--) {
201
201
  if (isBreak) break;
202
202
  const item = arr[i];
203
- const re = iterator(item, i, arr, tree, parent, level);
204
- if (re === false) {
203
+ const result = iteratee(item, i, arr, tree, parent, level);
204
+ if (result === false) {
205
205
  isBreak = true;
206
206
  break;
207
207
  }
208
- if (re === true) continue;
209
- const newItem = object.objectOmit(re, [childField]);
208
+ if (result === true) continue;
209
+ const newItem = object.objectOmit(result, [childField]);
210
210
  output.push(newItem);
211
211
  const children = item[childField];
212
212
  if (Array.isArray(children)) {
@@ -218,13 +218,13 @@ function mapDeep(
218
218
  for (let i = 0; i < arr.length; i++) {
219
219
  if (isBreak) break;
220
220
  const item = arr[i];
221
- const re = iterator(item, i, arr, tree, parent, level);
222
- if (re === false) {
221
+ const result = iteratee(item, i, arr, tree, parent, level);
222
+ if (result === false) {
223
223
  isBreak = true;
224
224
  break;
225
225
  }
226
- if (re === true) continue;
227
- const newItem = object.objectOmit(re, [childField]);
226
+ if (result === true) continue;
227
+ const newItem = object.objectOmit(result, [childField]);
228
228
  output.push(newItem);
229
229
  const children = item[childField];
230
230
  if (Array.isArray(children)) {
@@ -242,14 +242,14 @@ function mapDeep(
242
242
  /**
243
243
  * Retrieves the path (ancestors + self) for a given node ID.
244
244
  *
245
- * @param {ArrayLike<T>} tree - Tree data
245
+ * @param {ArrayLike<V>} tree - Tree data
246
246
  * @param {number | string} nodeId - Target node ID
247
247
  * @param {ITreeConf} options - Configuration. Default: { childField = 'children', keyField = 'id' }
248
248
  * @returns {[(number | string)[], V[]]} - Array of IDs and Array of Nodes from root to target
249
249
  */
250
250
  function getPathById(tree, nodeId, options = { childField: 'children', keyField: 'id' }) {
251
251
  const { childField = 'children', keyField = 'id' } = type.isObject(options) ? options : {};
252
- const flatMap = {};
252
+ const nodeMap = {};
253
253
  // 扁平化 - 使用迭代而非递归,避免栈溢出
254
254
  const stack = [];
255
255
  const len = tree.length;
@@ -259,7 +259,7 @@ function getPathById(tree, nodeId, options = { childField: 'children', keyField:
259
259
  while (stack.length > 0) {
260
260
  const { node, parentId, parent } = stack.pop();
261
261
  const id = node[keyField];
262
- flatMap[id] = { node, parentId, parent };
262
+ nodeMap[id] = { node, parentId, parent };
263
263
  const children = node[childField];
264
264
  if (Array.isArray(children)) {
265
265
  const childLen = children.length;
@@ -271,13 +271,13 @@ function getPathById(tree, nodeId, options = { childField: 'children', keyField:
271
271
  // 回溯路径
272
272
  const ids = [];
273
273
  const nodes = [];
274
- let current = flatMap[nodeId];
274
+ let current = nodeMap[nodeId];
275
275
  if (!current) return [[], []];
276
276
  ids.push(nodeId);
277
277
  nodes.push(current.node);
278
278
  while (current && current.parentId !== undefined) {
279
279
  ids.unshift(current.parentId);
280
- const parent = flatMap[current.parentId];
280
+ const parent = nodeMap[current.parentId];
281
281
  if (!parent) break;
282
282
  nodes.unshift(parent.node);
283
283
  current = parent;
@@ -421,6 +421,9 @@ var tree = {
421
421
  filterDeep,
422
422
  mapDeep,
423
423
  getPathById,
424
+ /**
425
+ * @deprecated 已废弃,请使用 getPathById
426
+ */
424
427
  searchTreeById: getPathById,
425
428
  formatTree,
426
429
  flatTree,
package/dist/cjs/type.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/cjs/url.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,10 +1,9 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
7
- import { getGlobal } from './func.mjs';
8
7
  import { isNullOrUnDef } from './type.mjs';
9
8
 
10
9
  const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -151,15 +150,15 @@ function weAtob(string) {
151
150
  */
152
151
  function b64decode(base64) {
153
152
  // 优先使用原生方法(性能最优)
154
- if (!isNullOrUnDef(getGlobal('atob')) && !isNullOrUnDef(getGlobal('TextDecoder'))) {
153
+ if (!isNullOrUnDef(globalThis.atob) && !isNullOrUnDef(globalThis.TextDecoder)) {
155
154
  try {
156
- const binaryString = getGlobal('atob')(base64);
155
+ const binaryString = globalThis.atob(base64);
157
156
  const len = binaryString.length;
158
157
  const bytes = new Uint8Array(len);
159
158
  for (let i = 0; i < len; i++) {
160
159
  bytes[i] = binaryString.charCodeAt(i);
161
160
  }
162
- return new (getGlobal('TextDecoder'))('utf-8').decode(bytes);
161
+ return new globalThis.TextDecoder('utf-8').decode(bytes);
163
162
  } catch (e) {
164
163
  // 如果原生方法失败,使用降级方案
165
164
  }
@@ -180,15 +179,15 @@ function b64decode(base64) {
180
179
  */
181
180
  function b64encode(rawStr) {
182
181
  // 优先使用原生方法(性能最优)
183
- if (!isNullOrUnDef(getGlobal('btoa')) && !isNullOrUnDef(getGlobal('TextEncoder'))) {
182
+ if (!isNullOrUnDef(globalThis.btoa) && !isNullOrUnDef(globalThis.TextEncoder)) {
184
183
  try {
185
- const utf8Array = new (getGlobal('TextEncoder'))().encode(rawStr);
184
+ const utf8Array = new globalThis.TextEncoder().encode(rawStr);
186
185
  let binaryString = '';
187
186
  const len = utf8Array.length;
188
187
  for (let i = 0; i < len; i++) {
189
188
  binaryString += String.fromCharCode(utf8Array[i]);
190
189
  }
191
- return getGlobal('btoa')(binaryString);
190
+ return globalThis.btoa(binaryString);
192
191
  } catch (e) {
193
192
  // 如果原生方法失败,使用降级方案
194
193
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/esm/date.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/esm/dom.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/esm/file.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.19.12
2
+ * sculp-js v1.19.14
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */