sculp-js 1.13.1 → 1.13.3-beta.0

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 (127) hide show
  1. package/README.md +10 -11
  2. package/dist/cjs/_virtual/_commonjsHelpers.js +13 -0
  3. package/{lib → dist}/cjs/array.js +1 -1
  4. package/{lib → dist}/cjs/async.js +1 -1
  5. package/{lib/cjs/we-decode.js → dist/cjs/base64.js} +53 -44
  6. package/{lib → dist}/cjs/clipboard.js +4 -2
  7. package/{lib → dist}/cjs/cloneDeep.js +1 -1
  8. package/{lib → dist}/cjs/cookie.js +1 -1
  9. package/{lib → dist}/cjs/date.js +1 -1
  10. package/{lib → dist}/cjs/dom.js +1 -1
  11. package/{lib → dist}/cjs/download.js +4 -2
  12. package/dist/cjs/easing.js +75 -0
  13. package/{lib → dist}/cjs/file.js +7 -3
  14. package/{lib → dist}/cjs/func.js +1 -1
  15. package/{lib → dist}/cjs/index.js +11 -8
  16. package/{lib → dist}/cjs/math.js +1 -1
  17. package/dist/cjs/node_modules/bezier-easing/src/index.js +123 -0
  18. package/{lib → dist}/cjs/number.js +1 -1
  19. package/{lib → dist}/cjs/object.js +1 -1
  20. package/{lib → dist}/cjs/path.js +1 -1
  21. package/{lib → dist}/cjs/qs.js +1 -1
  22. package/{lib → dist}/cjs/random.js +1 -1
  23. package/{lib → dist}/cjs/string.js +1 -1
  24. package/{lib → dist}/cjs/tooltip.js +5 -2
  25. package/{lib → dist}/cjs/tree.js +9 -23
  26. package/{lib → dist}/cjs/type.js +8 -1
  27. package/{lib → dist}/cjs/unique.js +1 -1
  28. package/{lib → dist}/cjs/url.js +1 -1
  29. package/{lib → dist}/cjs/validator.js +1 -1
  30. package/{lib → dist}/cjs/variable.js +1 -1
  31. package/{lib → dist}/cjs/watermark.js +4 -2
  32. package/{lib/es → dist/esm}/array.js +1 -1
  33. package/{lib/es → dist/esm}/async.js +1 -1
  34. package/{lib/es/we-decode.js → dist/esm/base64.js} +52 -45
  35. package/{lib/es → dist/esm}/clipboard.js +4 -2
  36. package/{lib/es → dist/esm}/cloneDeep.js +1 -1
  37. package/{lib/es → dist/esm}/cookie.js +1 -1
  38. package/{lib/es → dist/esm}/date.js +1 -1
  39. package/{lib/es → dist/esm}/dom.js +1 -1
  40. package/{lib/es → dist/esm}/download.js +4 -2
  41. package/{lib/es → dist/esm}/easing.js +34 -2
  42. package/{lib/es → dist/esm}/file.js +7 -3
  43. package/{lib/es → dist/esm}/func.js +1 -1
  44. package/{lib/es → dist/esm}/index.js +4 -5
  45. package/{lib/es → dist/esm}/math.js +1 -1
  46. package/{lib/es → dist/esm}/number.js +1 -1
  47. package/{lib/es → dist/esm}/object.js +1 -1
  48. package/{lib/es → dist/esm}/path.js +1 -1
  49. package/{lib/es → dist/esm}/qs.js +1 -1
  50. package/{lib/es → dist/esm}/random.js +1 -1
  51. package/{lib/es → dist/esm}/string.js +1 -1
  52. package/{lib/es → dist/esm}/tooltip.js +5 -2
  53. package/{lib/es → dist/esm}/tree.js +10 -24
  54. package/{lib/es → dist/esm}/type.js +8 -2
  55. package/{lib/es → dist/esm}/unique.js +1 -1
  56. package/{lib/es → dist/esm}/url.js +1 -1
  57. package/{lib/es → dist/esm}/validator.js +1 -1
  58. package/{lib/es → dist/esm}/variable.js +1 -1
  59. package/{lib/es → dist/esm}/watermark.js +4 -2
  60. package/dist/types/array.d.ts +50 -0
  61. package/dist/types/array.d.ts.map +1 -0
  62. package/dist/types/async.d.ts +37 -0
  63. package/dist/types/async.d.ts.map +1 -0
  64. package/dist/types/base64.d.ts +25 -0
  65. package/dist/types/base64.d.ts.map +1 -0
  66. package/dist/types/clipboard.d.ts +20 -0
  67. package/dist/types/clipboard.d.ts.map +1 -0
  68. package/dist/types/cloneDeep.d.ts +12 -0
  69. package/dist/types/cloneDeep.d.ts.map +1 -0
  70. package/dist/types/cookie.d.ts +19 -0
  71. package/dist/types/cookie.d.ts.map +1 -0
  72. package/dist/types/core-index.d.ts +17 -0
  73. package/dist/types/core-index.d.ts.map +1 -0
  74. package/dist/types/date.d.ts +74 -0
  75. package/dist/types/date.d.ts.map +1 -0
  76. package/dist/types/dom.d.ts +74 -0
  77. package/dist/types/dom.d.ts.map +1 -0
  78. package/dist/types/download.d.ts +47 -0
  79. package/dist/types/download.d.ts.map +1 -0
  80. package/dist/types/easing.d.ts +32 -0
  81. package/dist/types/easing.d.ts.map +1 -0
  82. package/dist/types/file.d.ts +44 -0
  83. package/dist/types/file.d.ts.map +1 -0
  84. package/dist/types/func.d.ts +50 -0
  85. package/dist/types/func.d.ts.map +1 -0
  86. package/dist/types/index.d.ts +28 -0
  87. package/dist/types/index.d.ts.map +1 -0
  88. package/dist/types/index.js +3278 -0
  89. package/dist/types/math.d.ts +36 -0
  90. package/dist/types/math.d.ts.map +1 -0
  91. package/dist/types/number.d.ts +49 -0
  92. package/dist/types/number.d.ts.map +1 -0
  93. package/dist/types/object.d.ts +70 -0
  94. package/dist/types/object.d.ts.map +1 -0
  95. package/dist/types/path.d.ts +14 -0
  96. package/dist/types/path.d.ts.map +1 -0
  97. package/dist/types/qs.d.ts +22 -0
  98. package/dist/types/qs.d.ts.map +1 -0
  99. package/dist/types/random.d.ts +27 -0
  100. package/dist/types/random.d.ts.map +1 -0
  101. package/dist/types/string.d.ts +67 -0
  102. package/dist/types/string.d.ts.map +1 -0
  103. package/dist/types/tooltip.d.ts +36 -0
  104. package/dist/types/tooltip.d.ts.map +1 -0
  105. package/dist/types/tree.d.ts +99 -0
  106. package/dist/types/tree.d.ts.map +1 -0
  107. package/dist/types/type.d.ts +128 -0
  108. package/dist/types/type.d.ts.map +1 -0
  109. package/dist/types/unique.d.ts +21 -0
  110. package/dist/types/unique.d.ts.map +1 -0
  111. package/dist/types/url.d.ts +46 -0
  112. package/dist/types/url.d.ts.map +1 -0
  113. package/dist/types/validator.d.ts +67 -0
  114. package/dist/types/validator.d.ts.map +1 -0
  115. package/dist/types/variable.d.ts +71 -0
  116. package/dist/types/variable.d.ts.map +1 -0
  117. package/dist/types/watermark.d.ts +19 -0
  118. package/dist/types/watermark.d.ts.map +1 -0
  119. package/dist/umd/index.min.js +6 -0
  120. package/package.json +234 -17
  121. package/lib/cjs/base64.js +0 -62
  122. package/lib/cjs/easing.js +0 -40
  123. package/lib/cjs/isEqual.js +0 -133
  124. package/lib/es/base64.js +0 -59
  125. package/lib/es/isEqual.js +0 -131
  126. package/lib/index.d.ts +0 -1214
  127. package/lib/umd/index.js +0 -6
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.1
2
+ * sculp-js v1.13.3-beta.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -17,7 +17,7 @@ const defaultSearchTreeOptions = {
17
17
  ignoreCase: true
18
18
  };
19
19
  /**
20
- * 树遍历函数(支持continue和break操作), 可用于insert tree item remove tree item
20
+ * 树遍历函数(支持continue和break操作), 可用于遍历ArrayNodeList类型的数据
21
21
  * @param {ArrayLike<V>} tree 树形数据
22
22
  * @param {Function} iterator 迭代函数, 返回值为true时continue, 返回值为false时break
23
23
  * @param {options} options 支持定制子元素名称、反向遍历、广度优先遍历,默认{
@@ -30,9 +30,10 @@ const defaultSearchTreeOptions = {
30
30
  function forEachDeep(tree, iterator, options = {
31
31
  childField: 'children',
32
32
  reverse: false,
33
- breadthFirst: false
33
+ breadthFirst: false,
34
+ isDomNode: false
34
35
  }) {
35
- const { childField = 'children', reverse = false, breadthFirst = false } = type.isObject(options) ? options : {};
36
+ const { childField = 'children', reverse = false, breadthFirst = false, isDomNode = false } = type.isObject(options) ? options : {};
36
37
  let isBreak = false;
37
38
  const queue = [];
38
39
  const walk = (arr, parent, level = 0) => {
@@ -55,9 +56,7 @@ function forEachDeep(tree, iterator, options = {
55
56
  else if (re === true) {
56
57
  continue;
57
58
  }
58
- // @ts-ignore
59
- if (item && Array.isArray(item[childField])) {
60
- // @ts-ignore
59
+ if (item && (isDomNode ? type.isNodeList(item[childField]) : Array.isArray(item[childField]))) {
61
60
  walk(item[childField], item, level + 1);
62
61
  }
63
62
  }
@@ -66,8 +65,6 @@ function forEachDeep(tree, iterator, options = {
66
65
  // Process queue
67
66
  while (queue.length > 0 && !isBreak) {
68
67
  const current = queue.shift();
69
- // iterate(info);
70
- // @ts-ignore
71
68
  const { item, index, array, tree, parent, level } = current;
72
69
  const re = iterator(item, index, array, tree, parent, level);
73
70
  if (re === false) {
@@ -77,9 +74,7 @@ function forEachDeep(tree, iterator, options = {
77
74
  else if (re === true) {
78
75
  continue;
79
76
  }
80
- // @ts-ignore
81
- if (item && Array.isArray(item[childField])) {
82
- // @ts-ignore
77
+ if (item && (isDomNode ? type.isNodeList(item[childField]) : Array.isArray(item[childField]))) {
83
78
  walk(item[childField], item, level + 1);
84
79
  }
85
80
  }
@@ -105,9 +100,7 @@ function forEachDeep(tree, iterator, options = {
105
100
  else if (re === true) {
106
101
  continue;
107
102
  }
108
- // @ts-ignore
109
- if (item && Array.isArray(item[childField])) {
110
- // @ts-ignore
103
+ if (item && (isDomNode ? type.isNodeList(item[childField]) : Array.isArray(item[childField]))) {
111
104
  walk(item[childField], item, level + 1);
112
105
  }
113
106
  }
@@ -117,7 +110,6 @@ function forEachDeep(tree, iterator, options = {
117
110
  const current = queue.shift();
118
111
  if (!current)
119
112
  break;
120
- // @ts-ignore
121
113
  const { item, index, array, tree, parent, level } = current;
122
114
  const re = iterator(item, index, array, tree, parent, level);
123
115
  if (re === false) {
@@ -127,9 +119,7 @@ function forEachDeep(tree, iterator, options = {
127
119
  else if (re === true) {
128
120
  continue;
129
121
  }
130
- // @ts-ignore
131
- if (item && Array.isArray(item[childField])) {
132
- // @ts-ignore
122
+ if (item && (isDomNode ? type.isNodeList(item[childField]) : Array.isArray(item[childField]))) {
133
123
  walk(item[childField], item, level + 1);
134
124
  }
135
125
  }
@@ -175,10 +165,8 @@ function mapDeep(tree, iterator, options = {
175
165
  continue;
176
166
  }
177
167
  newTree.push(object.objectOmit(re, [childField]));
178
- // @ts-ignore
179
168
  if (item && Array.isArray(item[childField])) {
180
169
  newTree[newTree.length - 1][childField] = [];
181
- // @ts-ignore
182
170
  walk(item[childField], item, newTree[newTree.length - 1][childField], level + 1);
183
171
  }
184
172
  else {
@@ -202,10 +190,8 @@ function mapDeep(tree, iterator, options = {
202
190
  continue;
203
191
  }
204
192
  newTree.push(object.objectOmit(re, [childField]));
205
- // @ts-ignore
206
193
  if (item && Array.isArray(item[childField])) {
207
194
  newTree[newTree.length - 1][childField] = [];
208
- // @ts-ignore
209
195
  walk(item[childField], item, newTree[newTree.length - 1][childField], level + 1);
210
196
  }
211
197
  else {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.1
2
+ * sculp-js v1.13.3-beta.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -128,6 +128,12 @@ function isEmpty(value) {
128
128
  }
129
129
  return !Object.keys(value).length;
130
130
  }
131
+ /**
132
+ * Checks if `value` is an NodeList object
133
+ */
134
+ function isNodeList(value) {
135
+ return isUndefined(NodeList) ? false : NodeList.prototype.isPrototypeOf(value);
136
+ }
131
137
 
132
138
  exports.arrayLike = arrayLike;
133
139
  exports.default = typeIs;
@@ -140,6 +146,7 @@ exports.isError = isError;
140
146
  exports.isFunction = isFunction;
141
147
  exports.isJsonString = isJsonString;
142
148
  exports.isNaN = isNaN;
149
+ exports.isNodeList = isNodeList;
143
150
  exports.isNull = isNull;
144
151
  exports.isNullOrUnDef = isNullOrUnDef;
145
152
  exports.isNullish = isNullOrUnDef;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -62,7 +62,7 @@ function genCanvasWM(content = '请勿外传', canvasWM) {
62
62
  const MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
63
63
  if (MutationObserver) {
64
64
  let mo = new MutationObserver(function () {
65
- const __wm = document.querySelector(`#${watermarkId}`); // 只在__wm元素变动才重新调用 __canvasWM
65
+ let __wm = document.querySelector(`#${watermarkId}`); // 只在__wm元素变动才重新调用 __canvasWM
66
66
  if (!__wm) {
67
67
  // 避免一直触发
68
68
  // console.log('regenerate watermark by delete::')
@@ -80,6 +80,8 @@ function genCanvasWM(content = '请勿外传', canvasWM) {
80
80
  mo.disconnect();
81
81
  mo = null;
82
82
  container.removeChild(__wm);
83
+ // @ts-ignore
84
+ __wm = null;
83
85
  genCanvasWM(content, canvasWM);
84
86
  }
85
87
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,9 +1,12 @@
1
1
  /*!
2
- * sculp-js v1.13.1
2
+ * sculp-js v1.13.3-beta.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
7
+ import { getGlobal } from './func.js';
8
+ import { isNullOrUnDef } from './type.js';
9
+
7
10
  const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
8
11
  // eslint-disable-next-line
9
12
  const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
@@ -57,48 +60,52 @@ function weAtob(string) {
57
60
  }
58
61
  return result;
59
62
  }
60
- // function b64DecodeUnicode(str) {
61
- // return decodeURIComponent(
62
- // exports.weAtob(str).replace(/(.)/g, function (p) {
63
- // let code = p.charCodeAt(0).toString(16).toUpperCase();
64
- // if (code.length < 2) {
65
- // code = '0' + code;
66
- // }
67
- // return '%' + code;
68
- // })
69
- // );
70
- // }
71
- // function base64_url_decode(str) {
72
- // let output = str.replace(/-/g, '+').replace(/_/g, '/');
73
- // switch (output.length % 4) {
74
- // case 0:
75
- // break;
76
- // case 2:
77
- // output += '==';
78
- // break;
79
- // case 3:
80
- // output += '=';
81
- // break;
82
- // default:
83
- // throw new Error('Illegal base64url string!');
84
- // }
85
- // try {
86
- // return b64DecodeUnicode(output);
87
- // } catch (err) {
88
- // return exports.weAtob(output);
89
- // }
90
- // }
91
- // export function weAppJwtDecode(token, options) {
92
- // if (typeof token !== 'string') {
93
- // throw new Error('Invalid token specified');
94
- // }
95
- // options = options || {};
96
- // const pos = options.header === true ? 0 : 1;
97
- // try {
98
- // return JSON.parse(base64_url_decode(token.split('.')[pos]));
99
- // } catch (e) {
100
- // throw new Error('Invalid token specified: ' + (e as Error).message);
101
- // }
102
- // }
63
+ function stringToUint8Array(str) {
64
+ const utf8 = encodeURIComponent(str); // 将字符串转换为 UTF-8 编码
65
+ const uint8Array = new Uint8Array(utf8.length); // 创建 Uint8Array
66
+ for (let i = 0; i < utf8.length; i++) {
67
+ uint8Array[i] = utf8.charCodeAt(i); // 填充 Uint8Array
68
+ }
69
+ return uint8Array;
70
+ }
71
+ function uint8ArrayToString(uint8Array) {
72
+ const utf8 = String.fromCharCode.apply(null, uint8Array); // 将 Uint8Array 转为字符串
73
+ return decodeURIComponent(utf8); // 将 UTF-8 字符串解码回正常字符串
74
+ }
75
+ /**
76
+ * 将base64编码的字符串转换为原始字符串,包括对中文内容的处理(高性能,且支持Web、Node、小程序等任意平台)
77
+ * @param base64 base64编码的字符串
78
+ * @returns 原始字符串,包括中文内容
79
+ */
80
+ function b64decode(base64) {
81
+ const binaryString = !isNullOrUnDef(getGlobal('atob')) ? getGlobal('atob')(base64) : weAtob(base64);
82
+ const len = binaryString.length;
83
+ const bytes = new Uint8Array(len);
84
+ for (let i = 0; i < len; i++) {
85
+ bytes[i] = binaryString.charCodeAt(i);
86
+ }
87
+ // 使用TextDecoder将Uint8Array转换为原始字符串,包括中文内容
88
+ return !isNullOrUnDef(getGlobal('TextDecoder'))
89
+ ? new (getGlobal('TextDecoder'))('utf-8').decode(bytes)
90
+ : uint8ArrayToString(bytes);
91
+ }
92
+ /**
93
+ * 将原始字符串,包括中文内容,转换为base64编码的字符串(高性能,且支持Web、Node、小程序等任意平台)
94
+ * @param rawStr 原始字符串,包括中文内容
95
+ * @returns base64编码的字符串
96
+ */
97
+ function b64encode(rawStr) {
98
+ const utf8Array = !isNullOrUnDef(getGlobal('TextEncoder'))
99
+ ? new (getGlobal('TextEncoder'))().encode(rawStr)
100
+ : stringToUint8Array(rawStr);
101
+ // 将 Uint8Array 转换为二进制字符串
102
+ let binaryString = '';
103
+ const len = utf8Array.length;
104
+ for (let i = 0; i < len; i++) {
105
+ binaryString += String.fromCharCode(utf8Array[i]);
106
+ }
107
+ // 将二进制字符串转换为base64编码的字符串
108
+ return !isNullOrUnDef(getGlobal('btoa')) ? getGlobal('btoa')(binaryString) : weBtoa(binaryString);
109
+ }
103
110
 
104
- export { weAtob, weBtoa };
111
+ export { b64decode, b64encode, weAtob, weBtoa };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.1
2
+ * sculp-js v1.13.3-beta.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -40,7 +40,7 @@ function copyText(text, options) {
40
40
  */
41
41
  function fallbackCopyText(text, options) {
42
42
  const { successCallback = void 0, failCallback = void 0, container = document.body } = isNullOrUnDef(options) ? {} : options;
43
- const textEl = createFakeElement(text);
43
+ let textEl = createFakeElement(text);
44
44
  container.appendChild(textEl);
45
45
  select(textEl);
46
46
  try {
@@ -56,6 +56,8 @@ function fallbackCopyText(text, options) {
56
56
  }
57
57
  finally {
58
58
  container.removeChild(textEl);
59
+ // @ts-ignore
60
+ textEl = null;
59
61
  window.getSelection()?.removeAllRanges(); // 清除选区
60
62
  }
61
63
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -22,7 +22,7 @@ function downloadURL(url, params) {
22
22
  * @param {Function} callback
23
23
  */
24
24
  function downloadHref(href, filename, callback) {
25
- const eleLink = document.createElement('a');
25
+ let eleLink = document.createElement('a');
26
26
  eleLink.download = filename;
27
27
  eleLink.style.display = 'none';
28
28
  eleLink.href = href;
@@ -30,6 +30,8 @@ function downloadHref(href, filename, callback) {
30
30
  eleLink.click();
31
31
  setTimeout(() => {
32
32
  document.body.removeChild(eleLink);
33
+ // @ts-ignore
34
+ eleLink = null;
33
35
  if (isFunction(callback)) {
34
36
  callback();
35
37
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.1
2
+ * sculp-js v1.13.3-beta.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -15,6 +15,19 @@ const easingDefines = {
15
15
  'ease-out': [0, 0, 0.58, 1],
16
16
  'ease-in-out': [0.42, 0, 0.58, 1]
17
17
  };
18
+ /**
19
+ * 设置缓存定义
20
+ * @param {string} name
21
+ * @param {EasingDefine} define
22
+ */
23
+ function setEasing(name, define) {
24
+ easingDefines[name] = define;
25
+ }
26
+ function getEasing(name) {
27
+ if (name)
28
+ return easingDefines[name];
29
+ return easingDefines;
30
+ }
18
31
  /**
19
32
  * 缓冲函数化,用于 js 计算缓冲进度
20
33
  * @param {EasingNameOrDefine} [name=linear]
@@ -34,5 +47,24 @@ function easingFunctional(name) {
34
47
  }
35
48
  return (input) => fn(Math.max(0, Math.min(input, 1)));
36
49
  }
50
+ /**
51
+ * 缓冲字符化,用于 css 设置缓冲属性
52
+ * @param {EasingNameOrDefine} name
53
+ * @returns {string}
54
+ */
55
+ function easingStringify(name) {
56
+ let bezierDefine;
57
+ if (isArray(name)) {
58
+ bezierDefine = name;
59
+ }
60
+ else {
61
+ const define = easingDefines[name];
62
+ if (!define) {
63
+ throw new Error(`${name} 缓冲函数未定义`);
64
+ }
65
+ bezierDefine = define;
66
+ }
67
+ return `cubic-bezier(${bezierDefine.join(',')})`;
68
+ }
37
69
 
38
- export { easingFunctional };
70
+ export { easingFunctional, easingStringify, getEasing, setEasing };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.1
2
+ * sculp-js v1.13.3-beta.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -20,7 +20,7 @@ function supportCanvas() {
20
20
  * @returns {HTMLInputElement}
21
21
  */
22
22
  function chooseLocalFile(accept, changeCb) {
23
- const inputObj = document.createElement('input');
23
+ let inputObj = document.createElement('input');
24
24
  inputObj.setAttribute('id', String(Date.now()));
25
25
  inputObj.setAttribute('type', 'file');
26
26
  inputObj.setAttribute('style', 'visibility:hidden');
@@ -30,7 +30,11 @@ function chooseLocalFile(accept, changeCb) {
30
30
  // @ts-ignore
31
31
  inputObj.onchange = (e) => {
32
32
  changeCb(e.target.files);
33
- setTimeout(() => document.body.removeChild(inputObj));
33
+ setTimeout(() => {
34
+ document.body.removeChild(inputObj);
35
+ // @ts-ignore
36
+ inputObj = null;
37
+ });
34
38
  };
35
39
  }
36
40
  /**
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -14,7 +14,7 @@ export { isPlainObject, objectAssign, objectEach, objectEachAsync, objectFill, o
14
14
  export { pathJoin, pathNormalize } from './path.js';
15
15
  export { qsParse, qsStringify } from './qs.js';
16
16
  export { STRING_ARABIC_NUMERALS, STRING_LOWERCASE_ALPHA, STRING_UPPERCASE_ALPHA, parseQueryParams, stringAssign, stringCamelCase, stringEscapeHtml, stringFill, stringFormat, stringKebabCase } from './string.js';
17
- export { arrayLike, isArray, isBigInt, isBoolean, isDate, isEmpty, isError, isFunction, isJsonString, isNaN, isNull, isNullOrUnDef, isNullOrUnDef as isNullish, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isUndefined, objectHas, typeIs } from './type.js';
17
+ export { arrayLike, isArray, isBigInt, isBoolean, isDate, isEmpty, isError, isFunction, isJsonString, isNaN, isNodeList, isNull, isNullOrUnDef, isNullOrUnDef as isNullish, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isUndefined, objectHas, typeIs } from './type.js';
18
18
  export { urlDelParams, urlParse, urlSetParams, urlStringify } from './url.js';
19
19
  export { asyncMap, safeAwait, wait } from './async.js';
20
20
  export { chooseLocalFile, compressImg, supportCanvas } from './file.js';
@@ -26,9 +26,8 @@ export { UNIQUE_NUMBER_SAFE_LENGTH, uniqueNumber, uniqueString } from './unique.
26
26
  export { tooltipEvent } from './tooltip.js';
27
27
  export { flatTree, forEachDeep, formatTree, fuzzySearchTree, mapDeep, searchTreeById } from './tree.js';
28
28
  export { add, divide, multiply, strip, subtract } from './math.js';
29
- export { weAtob, weBtoa } from './we-decode.js';
30
- export { decodeFromBase64, encodeToBase64 } from './base64.js';
29
+ export { b64decode, b64encode, weAtob, weBtoa } from './base64.js';
31
30
  export { EMAIL_REGEX, HTTP_URL_REGEX, IPV4_REGEX, IPV6_REGEX, PHONE_REGEX, URL_REGEX, isDigit, isEmail, isFloat, isIdNo, isInteger, isIpV4, isIpV6, isNumerical, isPhone, isUrl } from './validator.js';
32
31
  export { escapeRegExp, executeInScope, parseVarFromString, replaceVarFromString, uniqueSymbol } from './variable.js';
33
32
  export { cloneDeep } from './cloneDeep.js';
34
- export { isEqual } from './isEqual.js';
33
+ export { easingFunctional, easingStringify, getEasing, setEasing } from './easing.js';
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
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.13.1
2
+ * sculp-js v1.13.3-beta.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -113,9 +113,12 @@ function mouseenter($customTitle, title, e) {
113
113
  * @returns {*}
114
114
  */
115
115
  function handleMouseLeave(rootContainer = '#root') {
116
- const rootEl = isString(rootContainer) ? document.querySelector(rootContainer) : rootContainer, titleEl = document.querySelector('#customTitle1494304949567');
116
+ const rootEl = isString(rootContainer) ? document.querySelector(rootContainer) : rootContainer;
117
+ let titleEl = document.querySelector('#customTitle1494304949567');
117
118
  if (rootEl && titleEl) {
118
119
  rootEl.removeChild(titleEl);
120
+ // @ts-ignore
121
+ titleEl = null;
119
122
  }
120
123
  }
121
124
  const tooltipEvent = { handleMouseEnter, handleMouseLeave };