@next-core/brick-kit 2.107.1 → 2.107.4

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.107.4](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.107.3...@next-core/brick-kit@2.107.4) (2022-03-15)
7
+
8
+ **Note:** Version bump only for package @next-core/brick-kit
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.107.3](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.107.2...@next-core/brick-kit@2.107.3) (2022-03-15)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * switch dark theme ([00ebb32](https://github.com/easyops-cn/next-core/commit/00ebb32101d86dcf05942746a25258cb9e84b699))
20
+
21
+
22
+
23
+
24
+
25
+ ## [2.107.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.107.1...@next-core/brick-kit@2.107.2) (2022-03-07)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * fix style ([ff394cb](https://github.com/easyops-cn/next-core/commit/ff394cbfc591bc72ad6f0f6f2f761a4d64d9d774))
31
+
32
+
33
+
34
+
35
+
6
36
  ## [2.107.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.107.0...@next-core/brick-kit@2.107.1) (2022-03-07)
7
37
 
8
38
 
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('history'), require('@babel/runtime/helpers/objectSpread2'), require('@babel/runtime/helpers/objectWithoutProperties'), require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/helpers/defineProperty'), require('react'), require('lodash'), require('@next-core/brick-utils'), require('@next-core/brick-http'), require('moment'), require('@next-core/pipes'), require('i18next'), require('@next-core/easyops-analytics'), require('antd'), require('@ant-design/icons'), require('js-yaml'), require('react-i18next'), require('@babel/runtime/helpers/esm/extends'), require('@next-core/illustrations'), require('@babel/runtime/helpers/decorate')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'history', '@babel/runtime/helpers/objectSpread2', '@babel/runtime/helpers/objectWithoutProperties', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/helpers/defineProperty', 'react', 'lodash', '@next-core/brick-utils', '@next-core/brick-http', 'moment', '@next-core/pipes', 'i18next', '@next-core/easyops-analytics', 'antd', '@ant-design/icons', 'js-yaml', 'react-i18next', '@babel/runtime/helpers/esm/extends', '@next-core/illustrations', '@babel/runtime/helpers/decorate'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickKit = {}, global.history$1, global._objectSpread, global._objectWithoutProperties, global._asyncToGenerator$4, global._defineProperty$1, global.React, global.lodash, global.brickUtils, global.brickHttp, global.moment, global.pipes, global.i18next, global.easyopsAnalytics, global.antd, global.icons, global.yaml, global.reactI18next, global._extends, global.illustrations, global._decorate));
5
- })(this, (function (exports, history$1, _objectSpread, _objectWithoutProperties, _asyncToGenerator$4, _defineProperty$1, React, lodash, brickUtils, brickHttp, moment, pipes, i18next, easyopsAnalytics, antd, icons, yaml, reactI18next, _extends, illustrations, _decorate) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('history'), require('@babel/runtime/helpers/objectSpread2'), require('@babel/runtime/helpers/objectWithoutProperties'), require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/helpers/defineProperty'), require('react'), require('@next-core/brick-utils'), require('lodash'), require('@next-core/brick-http'), require('moment'), require('@next-core/pipes'), require('i18next'), require('@next-core/easyops-analytics'), require('antd'), require('@ant-design/icons'), require('js-yaml'), require('react-i18next'), require('@babel/runtime/helpers/esm/extends'), require('@next-core/illustrations'), require('@babel/runtime/helpers/decorate')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'history', '@babel/runtime/helpers/objectSpread2', '@babel/runtime/helpers/objectWithoutProperties', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/helpers/defineProperty', 'react', '@next-core/brick-utils', 'lodash', '@next-core/brick-http', 'moment', '@next-core/pipes', 'i18next', '@next-core/easyops-analytics', 'antd', '@ant-design/icons', 'js-yaml', 'react-i18next', '@babel/runtime/helpers/esm/extends', '@next-core/illustrations', '@babel/runtime/helpers/decorate'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickKit = {}, global.history$1, global._objectSpread, global._objectWithoutProperties, global._asyncToGenerator$4, global._defineProperty$1, global.React, global.brickUtils, global.lodash, global.brickHttp, global.moment, global.pipes, global.i18next, global.easyopsAnalytics, global.antd, global.icons, global.yaml, global.reactI18next, global._extends, global.illustrations, global._decorate));
5
+ })(this, (function (exports, history$1, _objectSpread, _objectWithoutProperties, _asyncToGenerator$4, _defineProperty$1, React, brickUtils, lodash, brickHttp, moment, pipes, i18next, easyopsAnalytics, antd, icons, yaml, reactI18next, _extends, illustrations, _decorate) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -332,9 +332,10 @@
332
332
  brickTemplateRegistry.set(name, factory);
333
333
  }
334
334
 
335
- // Themes.
336
335
  var DEFAULT_THEME = "light";
337
336
  var theme = DEFAULT_THEME;
337
+ var storage = new brickUtils.JsonStorage(localStorage);
338
+ var LOCAL_STORAGE_APPS_THEME_KEY = "apps-theme";
338
339
  function setTheme(value) {
339
340
  if (value !== "dark" && value !== "light" && value !== "dark-v2") {
340
341
  throw new Error("Unsupported theme: ".concat(value));
@@ -375,6 +376,21 @@
375
376
  };
376
377
  }, []);
377
378
  return currentTheme;
379
+ }
380
+ function batchSetAppsLocalTheme(appsTheme) {
381
+ storage.setItem(LOCAL_STORAGE_APPS_THEME_KEY, _objectSpread__default["default"](_objectSpread__default["default"]({}, getLocalAppsTheme()), appsTheme));
382
+ }
383
+ function getLocalAppsTheme() {
384
+ var result;
385
+
386
+ try {
387
+ result = storage.getItem(LOCAL_STORAGE_APPS_THEME_KEY);
388
+ } catch (_unused) {
389
+ // eslint-disable-next-line no-console
390
+ console.error("JSON parse error inside `getLocalAppsTheme()`");
391
+ }
392
+
393
+ return result || {};
378
394
  } // Modes.
379
395
 
380
396
  var DEFAULT_MODE = "default";
@@ -9811,7 +9827,7 @@
9811
9827
  var _this3 = this;
9812
9828
 
9813
9829
  return _asyncToGenerator__default["default"](function* () {
9814
- var _apiAnalyzer$getInsta;
9830
+ var _apiAnalyzer$getInsta, _getLocalAppsTheme;
9815
9831
 
9816
9832
  _this3.state = "initial";
9817
9833
  _this3.renderId = lodash.uniqueId("render-id-");
@@ -9862,7 +9878,7 @@
9862
9878
  var legacy = currentApp ? currentApp.legacy : undefined;
9863
9879
  _this3.kernel.nextApp = currentApp;
9864
9880
  var layoutType = (currentApp === null || currentApp === void 0 ? void 0 : currentApp.layoutType) || "console";
9865
- setTheme((currentApp === null || currentApp === void 0 ? void 0 : currentApp.theme) || "light");
9881
+ setTheme(((_getLocalAppsTheme = getLocalAppsTheme()) === null || _getLocalAppsTheme === void 0 ? void 0 : _getLocalAppsTheme[currentApp === null || currentApp === void 0 ? void 0 : currentApp.id]) || (currentApp === null || currentApp === void 0 ? void 0 : currentApp.theme) || "light");
9866
9882
  setMode("default");
9867
9883
  devtoolsHookEmit("rendering");
9868
9884
  unmountTree(mountPoints.bg);
@@ -12069,7 +12085,7 @@
12069
12085
  y1: "4.31113823%",
12070
12086
  x2: "82.851613%",
12071
12087
  y2: "88.6978534%",
12072
- id: createNewId("inearGradient-1")
12088
+ id: createNewId("linearGradient-1")
12073
12089
  }, /*#__PURE__*/React__default["default"].createElement("stop", {
12074
12090
  stopColor: "#545454",
12075
12091
  offset: "0%"
@@ -12081,7 +12097,7 @@
12081
12097
  y1: "4.31113823%",
12082
12098
  x2: "84.2061777%",
12083
12099
  y2: "88.6978534%",
12084
- id: createNewId("inearGradient-2")
12100
+ id: createNewId("linearGradient-2")
12085
12101
  }, /*#__PURE__*/React__default["default"].createElement("stop", {
12086
12102
  stopColor: "#515151",
12087
12103
  offset: "0%"
@@ -12165,7 +12181,7 @@
12165
12181
  transform: "translate(345.000000, 239.000000)"
12166
12182
  }, /*#__PURE__*/React__default["default"].createElement("path", {
12167
12183
  d: "M63.0027562,53.3770492 L16.3415061,53.3770492 C15.617696,53.3770492 14.9220071,53.6573421 14.4003686,54.1591332 L5.7704918,62.4606569 L5.7704918,62.4606569 L5.7704918,76.6295082 C5.7704918,79.7223028 8.2776972,82.2295082 11.3704918,82.2295082 L67.9737705,82.2295082 C71.0665651,82.2295082 73.5737705,79.7223028 73.5737705,76.6295082 L73.5737705,62.4606569 L73.5737705,62.4606569 L64.9438937,54.1591332 C64.4222552,53.6573421 63.7265663,53.3770492 63.0027562,53.3770492 Z",
12168
- id: "Fill-3",
12184
+ id: createNewId("Fill-3"),
12169
12185
  fill: "#313131"
12170
12186
  }), /*#__PURE__*/React__default["default"].createElement("path", {
12171
12187
  d: "M53.2598788,19.5784543 L64.9180328,31.2366083 L64.9180328,68.3007026 C64.9180328,69.8470999 63.6644301,71.1007026 62.1180328,71.1007026 L17.2262295,71.1007026 C15.6798322,71.1007026 14.4262295,69.8470999 14.4262295,68.3007026 L14.4262295,25.5784543 C14.4262295,22.2647458 17.112521,19.5784543 20.4262295,19.5784543 L53.2598788,19.5784543 Z",
@@ -13169,6 +13185,7 @@
13169
13185
  exports.StoryboardFunctionRegistryFactory = StoryboardFunctionRegistryFactory;
13170
13186
  exports.UpdatingElement = UpdatingElement;
13171
13187
  exports.authenticate = authenticate;
13188
+ exports.batchSetAppsLocalTheme = batchSetAppsLocalTheme;
13172
13189
  exports.checkIf = checkIf;
13173
13190
  exports.checkIfByTransform = checkIfByTransform;
13174
13191
  exports.createHistory = createHistory;
@@ -13178,6 +13195,7 @@
13178
13195
  exports.event = event;
13179
13196
  exports.getAuth = getAuth;
13180
13197
  exports.getCssPropertyValue = getCssPropertyValue;
13198
+ exports.getCurrentTheme = getCurrentTheme;
13181
13199
  exports.getHistory = getHistory;
13182
13200
  exports.getMockInfo = getMockInfo;
13183
13201
  exports.getRuntime = getRuntime;