@blocklet/pages-kit 0.6.38 → 0.6.39

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,7 +2,7 @@ import { initSanitize } from '@blocklet/xss';
2
2
  import snakeCase from 'lodash/snakeCase';
3
3
  import * as yaml from 'yaml';
4
4
  import { getMediaKitAbsoluteUrl } from '../builtin/utils';
5
- import { isBrowserEnv, COLOR_CONVERT_FUNCTION_NAME } from './common';
5
+ import { isBrowserEnv } from './common';
6
6
  export const sanitize = initSanitize();
7
7
  export function componentUMDName({ componentId }) {
8
8
  return `PagesCustomComponent${snakeCase(componentId)}`;
@@ -83,12 +83,7 @@ export const initDynamicParsePropertyValueHandlers = () => {
83
83
  initDynamicPropertyHandlersPromise = (async () => {
84
84
  dynamicPropertyHandlers = {};
85
85
  if (isBrowserEnv()) {
86
- // colorConvert 目前需要前端环境才能处理,依赖 mui theme
87
- // @ts-ignore
88
- const colorConvertFn = globalThis[COLOR_CONVERT_FUNCTION_NAME];
89
- if (typeof colorConvertFn === 'function') {
90
- dynamicPropertyHandlers.color = (value) => colorConvertFn(value);
91
- }
86
+ // do nothing
92
87
  }
93
88
  return dynamicPropertyHandlers;
94
89
  })();
@@ -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, isMuiColorKey } from './common';
5
+ import { isMuiColorKey } from './common';
6
6
  const GRADIENT_START = 0;
7
7
  const GRADIENT_END = 100;
8
8
  const baseTheme = createTheme({});
@@ -134,12 +134,12 @@ export function parseColor(color = '') {
134
134
  * @param _theme - 主题对象,默认为全局主题
135
135
  * @returns 转换后的颜色字符串
136
136
  */
137
- export function colorConvert(color, _theme = blockletTheme) {
137
+ export function colorConvert(color, theme = blockletTheme) {
138
138
  if (isMuiColorKey(color)) {
139
139
  if (color === 'transparent') {
140
140
  return 'transparent';
141
141
  }
142
- return get(_theme.palette, color, color);
142
+ return get(theme.palette, color, color);
143
143
  }
144
144
  // 处理渐变和普通颜色
145
145
  if (isGradient(color)) {
@@ -150,10 +150,6 @@ export function colorConvert(color, _theme = blockletTheme) {
150
150
  }
151
151
  return color || '';
152
152
  }
153
- if (isBrowserEnv()) {
154
- // @ts-ignore inject colorConvert to globalThis
155
- globalThis[COLOR_CONVERT_FUNCTION_NAME] = colorConvert;
156
- }
157
153
  export function getTransparentBackground() {
158
154
  return 'repeating-conic-gradient(#CCCCCC 0% 25%, #FFFFFF 0% 50%) 50% / 10px 10px';
159
155
  }