@next-core/brick-utils 2.35.1 → 2.36.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,36 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.36.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.35.3...@next-core/brick-utils@2.36.0) (2022-03-18)
7
+
8
+
9
+ ### Features
10
+
11
+ * new util function: debounceByAnimationFrame ([d47d032](https://github.com/easyops-cn/next-core/commit/d47d032dea4f9a55e8b642b0d2af926e808c716f))
12
+
13
+
14
+
15
+
16
+
17
+ ## [2.35.3](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.35.2...@next-core/brick-utils@2.35.3) (2022-03-15)
18
+
19
+ **Note:** Version bump only for package @next-core/brick-utils
20
+
21
+
22
+
23
+
24
+
25
+ ## [2.35.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.35.1...@next-core/brick-utils@2.35.2) (2022-03-07)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * fix get deps when brick package has no editors ([833739d](https://github.com/easyops-cn/next-core/commit/833739de875706666a8555d1becb35043f88efc6))
31
+
32
+
33
+
34
+
35
+
6
36
  ## [2.35.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.35.0...@next-core/brick-utils@2.35.1) (2022-02-28)
7
37
 
8
38
  **Note:** Version bump only for package @next-core/brick-utils
@@ -20280,11 +20280,13 @@
20280
20280
  // istanbul ignore else
20281
20281
  if (editor.includes(".")) {
20282
20282
  var namespace = editor.split(".")[0];
20283
- var find = brickMap.get(namespace);
20283
+ var find = brickMap.get(namespace); // There maybe no `editorsJsFilePath`.
20284
20284
 
20285
20285
  if (find) {
20286
- deps.add(find.editorsJsFilePath);
20287
- dll.add("editor-bricks-helper");
20286
+ if (find.editorsJsFilePath) {
20287
+ deps.add(find.editorsJsFilePath);
20288
+ dll.add("editor-bricks-helper");
20289
+ }
20288
20290
  } else {
20289
20291
  // eslint-disable-next-line no-console
20290
20292
  console.error("the name of editor is `".concat(editor, "` and it don't match any editor package"));
@@ -22141,6 +22143,29 @@
22141
22143
  return false;
22142
22144
  }
22143
22145
 
22146
+ // The debounce function receives our function as a parameter
22147
+ function debounceByAnimationFrame(fn) {
22148
+ // This holds the requestAnimationFrame reference, so we can cancel it if we wish
22149
+ var frame; // The debounce function returns a new function that can receive a variable number of arguments
22150
+
22151
+ return function () {
22152
+ for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
22153
+ params[_key] = arguments[_key];
22154
+ }
22155
+
22156
+ // If the frame variable has been defined, clear it now, and queue for next frame
22157
+ if (frame) {
22158
+ cancelAnimationFrame(frame);
22159
+ } // Queue our function call for the next frame
22160
+
22161
+
22162
+ frame = requestAnimationFrame(() => {
22163
+ // Call our function and pass any params we received
22164
+ fn(...params);
22165
+ });
22166
+ };
22167
+ }
22168
+
22144
22169
  Object.defineProperty(exports, 'pipes', {
22145
22170
  enumerable: true,
22146
22171
  get: function () { return pipes.pipes; }
@@ -22154,6 +22179,7 @@
22154
22179
  exports.convertValueByPrecision = convertValueByPrecision;
22155
22180
  exports.cook = cook;
22156
22181
  exports.createProviderClass = createProviderClass;
22182
+ exports.debounceByAnimationFrame = debounceByAnimationFrame;
22157
22183
  exports.deepFreeze = deepFreeze;
22158
22184
  exports.formatValue = formatValue;
22159
22185
  exports.getDependencyMapOfContext = getDependencyMapOfContext;