@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/dist/index.esm.js CHANGED
@@ -287,7 +287,7 @@ function registerBrickTemplate(name, factory) {
287
287
  var DEFAULT_THEME = "light";
288
288
  var theme = DEFAULT_THEME;
289
289
  function setTheme(value) {
290
- if (value !== "dark" && value !== "light") {
290
+ if (value !== "dark" && value !== "light" && value !== "dark-v2") {
291
291
  throw new Error("Unsupported theme: ".concat(value));
292
292
  }
293
293
 
@@ -5303,6 +5303,9 @@ function listenerFactory(handler, context, runtimeBrick) {
5303
5303
  applyTheme(handler.action === "theme.setDarkTheme" ? "dark" : "light");
5304
5304
  };
5305
5305
 
5306
+ case "theme.setTheme":
5307
+ return builtinThemeListenerFactory(handler.args, handler, context);
5308
+
5306
5309
  case "mode.setDashboardMode":
5307
5310
  case "mode.setDefaultMode":
5308
5311
  return event => {
@@ -5596,6 +5599,19 @@ function builtinAnalyticsListenerFactory(args, ifContainer, context) {
5596
5599
  };
5597
5600
  }
5598
5601
 
5602
+ function builtinThemeListenerFactory(args, ifContainer, context) {
5603
+ return function (event) {
5604
+ if (!looseCheckIf(ifContainer, _objectSpread(_objectSpread({}, context), {}, {
5605
+ event
5606
+ }))) {
5607
+ return;
5608
+ }
5609
+
5610
+ var [theme] = argsFactory(args, context, event);
5611
+ applyTheme(theme);
5612
+ };
5613
+ }
5614
+
5599
5615
  function findRefElement(brick, ref) {
5600
5616
  var _getParentTemplate, _getParentTemplate$$$;
5601
5617
 
@@ -9401,7 +9417,7 @@ class Router {
9401
9417
  };
9402
9418
 
9403
9419
  if (storyboard) {
9404
- var _currentApp$breadcrum, _currentApp$breadcrum2;
9420
+ var _currentApp$breadcrum, _currentApp$breadcrum2, _currentApp$theme;
9405
9421
 
9406
9422
  if (appChanged && currentApp.id && isLoggedIn()) {
9407
9423
  var usedCustomApis = mapCustomApisToNameAndNamespace(scanCustomApisInStoryboard(storyboard));
@@ -9500,7 +9516,7 @@ class Router {
9500
9516
  legacy: actualLegacy
9501
9517
  });
9502
9518
 
9503
- setTheme("light");
9519
+ setTheme((_currentApp$theme = currentApp.theme) !== null && _currentApp$theme !== void 0 ? _currentApp$theme : "light");
9504
9520
  setMode("default"); // There is a window to set theme and mode by `lifeCycle.onBeforePageLoad`.
9505
9521
 
9506
9522
  _this3.locationContext.handleBeforePageLoad();