@blocklet/pages-kit 0.4.125 → 0.4.127

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.
@@ -2,3 +2,13 @@ export const COLOR_CONVERT_FUNCTION_NAME = 'colorConvert';
2
2
  export const isBrowserEnv = () => {
3
3
  return typeof globalThis.window !== 'undefined' && typeof globalThis.document !== 'undefined';
4
4
  };
5
+ /**
6
+ * 检查字符串是否为有效的MUI颜色键
7
+ */
8
+ export function isMuiColorKey(value) {
9
+ // special case
10
+ if (value === 'transparent') {
11
+ return true;
12
+ }
13
+ return /^(primary|secondary|error|warning|info|success|grey|background|text|action)\.[a-z0-9]+$/.test(value);
14
+ }
@@ -20,6 +20,7 @@ ${script}
20
20
  </script>
21
21
  `)
22
22
  .join('\n')}
23
+
23
24
  <script>
24
25
  var ${PreloadComponentsStateGlobalVariableName} = ${JSON.stringify(injectState)}
25
26
  </script>
@@ -78,7 +78,7 @@ export const initDynamicParsePropertyValueHandlers = () => {
78
78
  initDynamicPropertyHandlersPromise = (async () => {
79
79
  dynamicPropertyHandlers = {};
80
80
  if (isBrowserEnv()) {
81
- // colorConvert 需要前端环境才能处理,依赖 mui theme
81
+ // colorConvert 目前需要前端环境才能处理,依赖 mui theme
82
82
  // @ts-ignore
83
83
  const colorConvertFn = globalThis[COLOR_CONVERT_FUNCTION_NAME];
84
84
  if (typeof colorConvertFn === 'function') {
@@ -2,7 +2,7 @@ import { createTheme } from '@arcblock/ux/lib/Theme';
2
2
  import gradient from 'gradient-parser';
3
3
  import get from 'lodash/get';
4
4
  import tinycolor from 'tinycolor2';
5
- import { isBrowserEnv, COLOR_CONVERT_FUNCTION_NAME } from './common';
5
+ import { isBrowserEnv, COLOR_CONVERT_FUNCTION_NAME, isMuiColorKey } from './common';
6
6
  const GRADIENT_START = 0;
7
7
  const GRADIENT_END = 100;
8
8
  const baseTheme = createTheme({});
@@ -47,16 +47,6 @@ export function isColorString(color) {
47
47
  }
48
48
  return false;
49
49
  }
50
- /**
51
- * 检查字符串是否为有效的MUI颜色键
52
- */
53
- export function isMuiColorKey(value) {
54
- // special case
55
- if (value === 'transparent') {
56
- return true;
57
- }
58
- return /^(primary|secondary|error|warning|info|success|grey|background|text|action)\.[a-z0-9]+$/.test(value);
59
- }
60
50
  /**
61
51
  * 处理渐变的解析,并转换为rgba格式
62
52
  */
@@ -164,3 +154,4 @@ if (isBrowserEnv()) {
164
154
  export function getTransparentBackground() {
165
155
  return 'repeating-conic-gradient(#CCCCCC 0% 25%, #FFFFFF 0% 50%) 50% / 10px 10px';
166
156
  }
157
+ export { isMuiColorKey };