@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/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);
|
|
@@ -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
|