@next-core/brick-utils 2.35.3 → 2.37.1

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,39 @@
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.37.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.37.0...@next-core/brick-utils@2.37.1) (2022-03-24)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * ignore `previewSettings` when building route node ([8cffb40](https://github.com/easyops-cn/next-core/commit/8cffb40b0c583a989c29518a1ed3ef2c8b24ad62))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.37.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.36.0...@next-core/brick-utils@2.37.0) (2022-03-24)
18
+
19
+
20
+ ### Features
21
+
22
+ * support APP.getMenu ([#1651](https://github.com/easyops-cn/next-core/issues/1651)) ([5b9f53a](https://github.com/easyops-cn/next-core/commit/5b9f53a3367087a062f415dd68070f15b98bf966))
23
+
24
+
25
+
26
+
27
+
28
+ # [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)
29
+
30
+
31
+ ### Features
32
+
33
+ * new util function: debounceByAnimationFrame ([d47d032](https://github.com/easyops-cn/next-core/commit/d47d032dea4f9a55e8b642b0d2af926e808c716f))
34
+
35
+
36
+
37
+
38
+
6
39
  ## [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)
7
40
 
8
41
  **Note:** Version bump only for package @next-core/brick-utils
@@ -21058,6 +21058,46 @@
21058
21058
  };
21059
21059
  }
21060
21060
 
21061
+ var APP = "APP";
21062
+ var GET_MENUS = "getMenu";
21063
+ function scanAppGetMenuInStoryboard(storyboard) {
21064
+ var _storyboard$meta;
21065
+
21066
+ var collection = new Set();
21067
+ var beforeVisitPermissions = beforeVisitAppFactory(collection);
21068
+ var {
21069
+ customTemplates,
21070
+ functions
21071
+ } = (_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 ? _storyboard$meta : {};
21072
+ visitStoryboardExpressions([storyboard.routes, customTemplates], beforeVisitPermissions, APP);
21073
+ visitStoryboardFunctions(functions, beforeVisitPermissions);
21074
+ return Array.from(collection);
21075
+ }
21076
+ function scanAppGetMenuInAny(data) {
21077
+ var collection = new Set();
21078
+ visitStoryboardExpressions(data, beforeVisitAppFactory(collection), APP);
21079
+ return Array.from(collection);
21080
+ }
21081
+
21082
+ function beforeVisitAppFactory(collection) {
21083
+ return function beforeVisitAPP(node, parent) {
21084
+ if (node.name === APP) {
21085
+ var memberParent = parent[parent.length - 1];
21086
+ var callParent = parent[parent.length - 2];
21087
+
21088
+ if ((callParent === null || callParent === void 0 ? void 0 : callParent.node.type) === "CallExpression" && (callParent === null || callParent === void 0 ? void 0 : callParent.key) === "callee" && (memberParent === null || memberParent === void 0 ? void 0 : memberParent.node.type) === "MemberExpression" && memberParent.key === "object" && !memberParent.node.computed && memberParent.node.property.type === "Identifier" && memberParent.node.property.name === GET_MENUS) {
21089
+ if (callParent.node.arguments.length === 1) {
21090
+ var menuId = callParent.node.arguments[0];
21091
+
21092
+ if (menuId.type === "Literal" && typeof menuId.value === "string") {
21093
+ collection.add(menuId.value);
21094
+ }
21095
+ }
21096
+ }
21097
+ }
21098
+ };
21099
+ }
21100
+
21061
21101
  var LexicalStatus;
21062
21102
 
21063
21103
  (function (LexicalStatus) {
@@ -21960,7 +22000,7 @@
21960
22000
 
21961
22001
  var yamlFieldsInBrick = ["permissionsPreCheck", "transformFrom"]; // Fields started with `_` will be removed by default.
21962
22002
 
21963
- var baseFieldsToRemove = ["appId", "children", "creator", "ctime", "id", "graphInfo", "modifier", "mountPoint", "mtime", "org", "parent", "sort", "name", "providersBak", "providers_bak", "deleteAuthorizers", "readAuthorizers", "updateAuthorizers"];
22003
+ var baseFieldsToRemove = ["appId", "children", "creator", "ctime", "id", "graphInfo", "modifier", "mountPoint", "mtime", "org", "parent", "sort", "name", "providersBak", "providers_bak", "previewSettings", "deleteAuthorizers", "readAuthorizers", "updateAuthorizers"];
21964
22004
  var fieldsToRemoveInRoute = baseFieldsToRemove.concat("instanceId");
21965
22005
  var fieldsToRemoveInBrick = baseFieldsToRemove.concat("type", "alias"); // Those fields can be disposed if value is null.
21966
22006
 
@@ -22143,6 +22183,29 @@
22143
22183
  return false;
22144
22184
  }
22145
22185
 
22186
+ // The debounce function receives our function as a parameter
22187
+ function debounceByAnimationFrame(fn) {
22188
+ // This holds the requestAnimationFrame reference, so we can cancel it if we wish
22189
+ var frame; // The debounce function returns a new function that can receive a variable number of arguments
22190
+
22191
+ return function () {
22192
+ for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
22193
+ params[_key] = arguments[_key];
22194
+ }
22195
+
22196
+ // If the frame variable has been defined, clear it now, and queue for next frame
22197
+ if (frame) {
22198
+ cancelAnimationFrame(frame);
22199
+ } // Queue our function call for the next frame
22200
+
22201
+
22202
+ frame = requestAnimationFrame(() => {
22203
+ // Call our function and pass any params we received
22204
+ fn(...params);
22205
+ });
22206
+ };
22207
+ }
22208
+
22146
22209
  Object.defineProperty(exports, 'pipes', {
22147
22210
  enumerable: true,
22148
22211
  get: function () { return pipes.pipes; }
@@ -22156,6 +22219,7 @@
22156
22219
  exports.convertValueByPrecision = convertValueByPrecision;
22157
22220
  exports.cook = cook;
22158
22221
  exports.createProviderClass = createProviderClass;
22222
+ exports.debounceByAnimationFrame = debounceByAnimationFrame;
22159
22223
  exports.deepFreeze = deepFreeze;
22160
22224
  exports.formatValue = formatValue;
22161
22225
  exports.getDependencyMapOfContext = getDependencyMapOfContext;
@@ -22185,6 +22249,8 @@
22185
22249
  exports.prefetchScript = prefetchScript;
22186
22250
  exports.resolveContextConcurrently = resolveContextConcurrently;
22187
22251
  exports.restoreDynamicTemplates = restoreDynamicTemplates;
22252
+ exports.scanAppGetMenuInAny = scanAppGetMenuInAny;
22253
+ exports.scanAppGetMenuInStoryboard = scanAppGetMenuInStoryboard;
22188
22254
  exports.scanBricksInBrickConf = scanBricksInBrickConf;
22189
22255
  exports.scanBricksInStoryboard = scanBricksInStoryboard;
22190
22256
  exports.scanCustomApisInStoryboard = scanCustomApisInStoryboard;