@blocklet/pages-kit 0.4.100 → 0.4.102
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/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/common.js +8 -0
- package/lib/cjs/utils/property.js +8 -8
- package/lib/cjs/utils/style.js +5 -0
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/common.js +4 -0
- package/lib/esm/utils/property.js +6 -5
- package/lib/esm/utils/style.js +5 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/lib/types/utils/common.d.ts +2 -0
- package/lib/types/utils/property.d.ts +0 -1
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBrowserEnv = exports.COLOR_CONVERT_FUNCTION_NAME = void 0;
|
|
4
|
+
exports.COLOR_CONVERT_FUNCTION_NAME = 'colorConvert';
|
|
5
|
+
const isBrowserEnv = () => {
|
|
6
|
+
return typeof globalThis.window !== 'undefined' && typeof globalThis.document !== 'undefined';
|
|
7
|
+
};
|
|
8
|
+
exports.isBrowserEnv = isBrowserEnv;
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.initDynamicParsePropertyValueHandlers = exports.
|
|
29
|
+
exports.initDynamicParsePropertyValueHandlers = exports.RenderNestedComponent = void 0;
|
|
30
30
|
exports.componentUMDName = componentUMDName;
|
|
31
31
|
exports.mergeComponent = mergeComponent;
|
|
32
32
|
exports.safeJSONParse = safeJSONParse;
|
|
@@ -36,6 +36,7 @@ exports.assignNullableFields = assignNullableFields;
|
|
|
36
36
|
exports.getComponentDependencies = getComponentDependencies;
|
|
37
37
|
const isNil_1 = __importDefault(require("lodash/isNil"));
|
|
38
38
|
const yaml = __importStar(require("yaml"));
|
|
39
|
+
const common_1 = require("./common");
|
|
39
40
|
function componentUMDName({ componentId }) {
|
|
40
41
|
return `PagesCustomComponent${componentId}`;
|
|
41
42
|
}
|
|
@@ -102,10 +103,6 @@ function safeYamlParse(value) {
|
|
|
102
103
|
}
|
|
103
104
|
return yaml.parse(value);
|
|
104
105
|
}
|
|
105
|
-
const isBrowserEnv = () => {
|
|
106
|
-
return typeof globalThis.window !== 'undefined' && typeof globalThis.document !== 'undefined';
|
|
107
|
-
};
|
|
108
|
-
exports.isBrowserEnv = isBrowserEnv;
|
|
109
106
|
let dynamicPropertyHandlers = null;
|
|
110
107
|
let initDynamicPropertyHandlersPromise = null;
|
|
111
108
|
// 根据前后端环境初始化动态的属性处理函数
|
|
@@ -115,10 +112,13 @@ const initDynamicParsePropertyValueHandlers = () => {
|
|
|
115
112
|
if (!initDynamicPropertyHandlersPromise) {
|
|
116
113
|
initDynamicPropertyHandlersPromise = (async () => {
|
|
117
114
|
dynamicPropertyHandlers = {};
|
|
118
|
-
if ((0,
|
|
115
|
+
if ((0, common_1.isBrowserEnv)()) {
|
|
119
116
|
// colorConvert 需要前端环境才能处理,依赖 mui theme
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
// @ts-ignore
|
|
118
|
+
const colorConvertFn = globalThis[common_1.COLOR_CONVERT_FUNCTION_NAME];
|
|
119
|
+
if (typeof colorConvertFn === 'function') {
|
|
120
|
+
dynamicPropertyHandlers.color = (value) => colorConvertFn(value);
|
|
121
|
+
}
|
|
122
122
|
}
|
|
123
123
|
return dynamicPropertyHandlers;
|
|
124
124
|
})();
|
package/lib/cjs/utils/style.js
CHANGED
|
@@ -14,6 +14,7 @@ const Theme_1 = require("@arcblock/ux/lib/Theme");
|
|
|
14
14
|
const gradient_parser_1 = __importDefault(require("gradient-parser"));
|
|
15
15
|
const get_1 = __importDefault(require("lodash/get"));
|
|
16
16
|
const tinycolor2_1 = __importDefault(require("tinycolor2"));
|
|
17
|
+
const common_1 = require("./common");
|
|
17
18
|
const GRADIENT_START = 0;
|
|
18
19
|
const GRADIENT_END = 100;
|
|
19
20
|
const baseTheme = (0, Theme_1.createTheme)({});
|
|
@@ -165,3 +166,7 @@ function colorConvert(color, _theme = blockletTheme) {
|
|
|
165
166
|
}
|
|
166
167
|
return color || '';
|
|
167
168
|
}
|
|
169
|
+
if ((0, common_1.isBrowserEnv)()) {
|
|
170
|
+
// @ts-ignore inject colorConvert to globalThis
|
|
171
|
+
globalThis[common_1.COLOR_CONVERT_FUNCTION_NAME] = colorConvert;
|
|
172
|
+
}
|