@next-core/brick-kit 2.107.2 → 2.107.3
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 +11 -0
- package/dist/index.bundle.js +25 -7
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +21 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/themeAndMode.d.ts +2 -0
- package/dist/types/themeAndMode.d.ts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.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)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* switch dark theme ([00ebb32](https://github.com/easyops-cn/next-core/commit/00ebb32101d86dcf05942746a25258cb9e84b699))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [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)
|
|
7
18
|
|
|
8
19
|
|
package/dist/index.bundle.js
CHANGED
|
@@ -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('
|
|
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', '
|
|
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.
|
|
5
|
-
})(this, (function (exports, history$1, _objectSpread, _objectWithoutProperties, _asyncToGenerator$4, _defineProperty$1, React,
|
|
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);
|
|
@@ -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;
|