@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/dist/index.esm.js CHANGED
@@ -4,8 +4,8 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
4
4
  import _asyncToGenerator$4 from '@babel/runtime/helpers/asyncToGenerator';
5
5
  import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
6
6
  import React, { useState, useEffect, useRef, forwardRef, useImperativeHandle, useMemo, useContext, createContext } from 'react';
7
+ import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, scanRouteAliasInStoryboard, loadScript, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, getDllAndDepsByResource, matchPath, asyncProcessBrick, restoreDynamicTemplates, mapCustomApisToNameAndNamespace, scanCustomApisInStoryboard } from '@next-core/brick-utils';
7
8
  import lodash, { set, get, difference, identity, uniqueId, cloneDeep, isNil, sortBy, merge, orderBy, omit, clamp, isEmpty, noop } from 'lodash';
8
- import { toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, scanRouteAliasInStoryboard, loadScript, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, getDllAndDepsByResource, matchPath, asyncProcessBrick, restoreDynamicTemplates, mapCustomApisToNameAndNamespace, scanCustomApisInStoryboard } from '@next-core/brick-utils';
9
9
  import { http, HttpResponseError, HttpFetchError } from '@next-core/brick-http';
10
10
  import moment from 'moment';
11
11
  import { pipes } from '@next-core/pipes';
@@ -333,9 +333,10 @@ function registerBrickTemplate(name, factory) {
333
333
  brickTemplateRegistry.set(name, factory);
334
334
  }
335
335
 
336
- // Themes.
337
336
  var DEFAULT_THEME = "light";
338
337
  var theme = DEFAULT_THEME;
338
+ var storage = new JsonStorage(localStorage);
339
+ var LOCAL_STORAGE_APPS_THEME_KEY = "apps-theme";
339
340
  function setTheme(value) {
340
341
  if (value !== "dark" && value !== "light" && value !== "dark-v2") {
341
342
  throw new Error("Unsupported theme: ".concat(value));
@@ -376,6 +377,21 @@ function useCurrentTheme() {
376
377
  };
377
378
  }, []);
378
379
  return currentTheme;
380
+ }
381
+ function batchSetAppsLocalTheme(appsTheme) {
382
+ storage.setItem(LOCAL_STORAGE_APPS_THEME_KEY, _objectSpread(_objectSpread({}, getLocalAppsTheme()), appsTheme));
383
+ }
384
+ function getLocalAppsTheme() {
385
+ var result;
386
+
387
+ try {
388
+ result = storage.getItem(LOCAL_STORAGE_APPS_THEME_KEY);
389
+ } catch (_unused) {
390
+ // eslint-disable-next-line no-console
391
+ console.error("JSON parse error inside `getLocalAppsTheme()`");
392
+ }
393
+
394
+ return result || {};
379
395
  } // Modes.
380
396
 
381
397
  var DEFAULT_MODE = "default";
@@ -9812,7 +9828,7 @@ class Router {
9812
9828
  var _this3 = this;
9813
9829
 
9814
9830
  return _asyncToGenerator$4(function* () {
9815
- var _apiAnalyzer$getInsta;
9831
+ var _apiAnalyzer$getInsta, _getLocalAppsTheme;
9816
9832
 
9817
9833
  _this3.state = "initial";
9818
9834
  _this3.renderId = uniqueId("render-id-");
@@ -9863,7 +9879,7 @@ class Router {
9863
9879
  var legacy = currentApp ? currentApp.legacy : undefined;
9864
9880
  _this3.kernel.nextApp = currentApp;
9865
9881
  var layoutType = (currentApp === null || currentApp === void 0 ? void 0 : currentApp.layoutType) || "console";
9866
- setTheme((currentApp === null || currentApp === void 0 ? void 0 : currentApp.theme) || "light");
9882
+ 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");
9867
9883
  setMode("default");
9868
9884
  devtoolsHookEmit("rendering");
9869
9885
  unmountTree(mountPoints.bg);
@@ -12070,7 +12086,7 @@ function EmptySvg(props) {
12070
12086
  y1: "4.31113823%",
12071
12087
  x2: "82.851613%",
12072
12088
  y2: "88.6978534%",
12073
- id: createNewId("inearGradient-1")
12089
+ id: createNewId("linearGradient-1")
12074
12090
  }, /*#__PURE__*/React.createElement("stop", {
12075
12091
  stopColor: "#545454",
12076
12092
  offset: "0%"
@@ -12082,7 +12098,7 @@ function EmptySvg(props) {
12082
12098
  y1: "4.31113823%",
12083
12099
  x2: "84.2061777%",
12084
12100
  y2: "88.6978534%",
12085
- id: createNewId("inearGradient-2")
12101
+ id: createNewId("linearGradient-2")
12086
12102
  }, /*#__PURE__*/React.createElement("stop", {
12087
12103
  stopColor: "#515151",
12088
12104
  offset: "0%"
@@ -12166,7 +12182,7 @@ function EmptySvg(props) {
12166
12182
  transform: "translate(345.000000, 239.000000)"
12167
12183
  }, /*#__PURE__*/React.createElement("path", {
12168
12184
  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",
12169
- id: "Fill-3",
12185
+ id: createNewId("Fill-3"),
12170
12186
  fill: "#313131"
12171
12187
  }), /*#__PURE__*/React.createElement("path", {
12172
12188
  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",
@@ -13158,5 +13174,5 @@ var ModalElement = _decorate(null, function (_initialize, _UpdatingElement) {
13158
13174
  };
13159
13175
  }, UpdatingElement);
13160
13176
 
13161
- export { BrickAsComponent, BrickWrapper, DisplayByFeatureFlags, EasyopsEmpty, ErrorBoundary, FeatureFlagsProvider, ForwardRefSingleBrickAsComponent, ModalElement, SingleBrickAsComponent, StoryboardFunctionRegistryFactory, UpdatingElement, authenticate, checkIf, checkIfByTransform, createHistory, createRuntime, developHelper, doTransform, event, getAuth, getCssPropertyValue, getHistory, getMockInfo, getRuntime, handleHttpError, httpErrorToString, i18nText, initI18n, isLoggedIn, logout, looseCheckIf, looseCheckIfByTransform, looseCheckIfOfComputed, method, preprocessTransformProperties, property, reTransformForDevtools, renderEasyopsEmpty, transformElementProperties, transformIntermediateData, transformProperties, useApplyPageTitle, useCurrentApp, useCurrentMode, useCurrentTheme, useFeatureFlags, useLocation, useRecentApps };
13177
+ export { BrickAsComponent, BrickWrapper, DisplayByFeatureFlags, EasyopsEmpty, ErrorBoundary, FeatureFlagsProvider, ForwardRefSingleBrickAsComponent, ModalElement, SingleBrickAsComponent, StoryboardFunctionRegistryFactory, UpdatingElement, authenticate, batchSetAppsLocalTheme, checkIf, checkIfByTransform, createHistory, createRuntime, developHelper, doTransform, event, getAuth, getCssPropertyValue, getCurrentTheme, getHistory, getMockInfo, getRuntime, handleHttpError, httpErrorToString, i18nText, initI18n, isLoggedIn, logout, looseCheckIf, looseCheckIfByTransform, looseCheckIfOfComputed, method, preprocessTransformProperties, property, reTransformForDevtools, renderEasyopsEmpty, transformElementProperties, transformIntermediateData, transformProperties, useApplyPageTitle, useCurrentApp, useCurrentMode, useCurrentTheme, useFeatureFlags, useLocation, useRecentApps };
13162
13178
  //# sourceMappingURL=index.esm.js.map