@next-core/brick-kit 2.97.0 → 2.98.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,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.98.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.97.0...@next-core/brick-kit@2.98.0) (2021-12-30)
7
+
8
+
9
+ ### Features
10
+
11
+ * support dark-v2 ([0434b7e](https://github.com/easyops-cn/next-core/commit/0434b7e34c441c28ceb75ba753f46e3cd5ccc5c8))
12
+
13
+
14
+
15
+
16
+
6
17
  # [2.97.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.96.0...@next-core/brick-kit@2.97.0) (2021-12-29)
7
18
 
8
19
 
@@ -286,7 +286,7 @@
286
286
  var DEFAULT_THEME = "light";
287
287
  var theme = DEFAULT_THEME;
288
288
  function setTheme(value) {
289
- if (value !== "dark" && value !== "light") {
289
+ if (value !== "dark" && value !== "light" && value !== "dark-v2") {
290
290
  throw new Error("Unsupported theme: ".concat(value));
291
291
  }
292
292
 
@@ -5302,6 +5302,9 @@
5302
5302
  applyTheme(handler.action === "theme.setDarkTheme" ? "dark" : "light");
5303
5303
  };
5304
5304
 
5305
+ case "theme.setTheme":
5306
+ return builtinThemeListenerFactory(handler.args, handler, context);
5307
+
5305
5308
  case "mode.setDashboardMode":
5306
5309
  case "mode.setDefaultMode":
5307
5310
  return event => {
@@ -5595,6 +5598,19 @@
5595
5598
  };
5596
5599
  }
5597
5600
 
5601
+ function builtinThemeListenerFactory(args, ifContainer, context) {
5602
+ return function (event) {
5603
+ if (!looseCheckIf(ifContainer, _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
5604
+ event
5605
+ }))) {
5606
+ return;
5607
+ }
5608
+
5609
+ var [theme] = argsFactory(args, context, event);
5610
+ applyTheme(theme);
5611
+ };
5612
+ }
5613
+
5598
5614
  function findRefElement(brick, ref) {
5599
5615
  var _getParentTemplate, _getParentTemplate$$$;
5600
5616
 
@@ -9400,7 +9416,7 @@
9400
9416
  };
9401
9417
 
9402
9418
  if (storyboard) {
9403
- var _currentApp$breadcrum, _currentApp$breadcrum2;
9419
+ var _currentApp$breadcrum, _currentApp$breadcrum2, _currentApp$theme;
9404
9420
 
9405
9421
  if (appChanged && currentApp.id && isLoggedIn()) {
9406
9422
  var usedCustomApis = brickUtils.mapCustomApisToNameAndNamespace(brickUtils.scanCustomApisInStoryboard(storyboard));
@@ -9499,7 +9515,7 @@
9499
9515
  legacy: actualLegacy
9500
9516
  });
9501
9517
 
9502
- setTheme("light");
9518
+ setTheme((_currentApp$theme = currentApp.theme) !== null && _currentApp$theme !== void 0 ? _currentApp$theme : "light");
9503
9519
  setMode("default"); // There is a window to set theme and mode by `lifeCycle.onBeforePageLoad`.
9504
9520
 
9505
9521
  _this3.locationContext.handleBeforePageLoad();