@blocklet/pages-kit 0.5.56 → 0.6.1

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.
@@ -28,7 +28,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.injectGlobalComponents = injectGlobalComponents;
30
30
  require("es-module-shims");
31
- const react_1 = __importDefault(require("react"));
32
31
  const ufo_1 = require("ufo");
33
32
  const arcblockUx = __importStar(require("../builtin/arcblock/ux"));
34
33
  const imagePreview = __importStar(require("../builtin/async/image-preview"));
@@ -76,7 +75,6 @@ function injectGlobalComponents() {
76
75
  // avoid addImportMap error
77
76
  };
78
77
  }
79
- win.React = react_1.default;
80
78
  win[builtin_1.RelativeModulesGlobalVariableName] = {};
81
79
  // create module map
82
80
  const modules = {
@@ -144,7 +142,9 @@ function injectGlobalComponents() {
144
142
  '/';
145
143
  const fullUrl = (0, ufo_1.joinURL)(window.location.origin, relativeChunksMountPoint, 'chunks', fileName);
146
144
  if (!win[builtin_1.RelativeModulesGlobalVariableName][fullUrl]) {
147
- if (enableShim) {
145
+ // @ts-ignore
146
+ if (enableShim && window?.importShim) {
147
+ // @ts-ignore
148
148
  win[builtin_1.RelativeModulesGlobalVariableName][fullUrl] = window.importShim(/* @vite-ignore */ fullUrl);
149
149
  }
150
150
  else {
@@ -258,6 +258,7 @@ export default ${hasDefaultExport ? 'moduleSource.default' : 'moduleSource'};
258
258
  // 添加 resolve 配置
259
259
  const importMap = { imports };
260
260
  win.importMap = importMap;
261
+ // @ts-ignore
261
262
  if (enableShim && !!window?.esmsInitOptions?.shimMode) {
262
263
  try {
263
264
  win.importShim.addImportMap(importMap);
@@ -3,14 +3,14 @@ import Empty from '@arcblock/ux/lib/Empty';
3
3
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
4
4
  import { Box, Button, Dialog, DialogActions, DialogContent, DialogTitle, ButtonGroup, Typography, Tooltip, Skeleton, Alert, } from '@mui/material';
5
5
  import { useBoolean, useLocalStorageState, useReactive } from 'ahooks';
6
- import { Suspense, forwardRef, lazy, useCallback, useImperativeHandle, useRef } from 'react';
6
+ import { Suspense, lazy, useCallback, useImperativeHandle, useRef } from 'react';
7
7
  import tinycolor from 'tinycolor2';
8
8
  import { useMuiColorPalette } from '../contexts/color';
9
9
  import { isColorString, isGradient, getSafeGradient, getTransparentBackground } from '../utils/style';
10
10
  const ColorPickerLib = lazy(() => import('react-best-gradient-color-picker'));
11
11
  const HEIGHT = 400;
12
12
  const WIDTH = 270;
13
- export function AlternateColorIndicator({ value, sx = {} }) {
13
+ export function AlternateColorIndicator({ value = '', sx = {} }) {
14
14
  if (!value)
15
15
  return null;
16
16
  return (_jsx(Box, { sx: {
@@ -119,7 +119,7 @@ export function ColorItem({ color, sx = {}, ...props }) {
119
119
  ...styleMap,
120
120
  }, ...props }));
121
121
  }
122
- export const ConfigColorDialog = forwardRef(function ConfigColorDialog({ onSave, enableMuiPalette = true }, ref) {
122
+ export const ConfigColorDialog = function ConfigColorDialog({ ref, onSave, enableMuiPalette = true, }) {
123
123
  const state = useReactive({
124
124
  value: '',
125
125
  originalMuiKey: null,
@@ -300,7 +300,7 @@ export const ConfigColorDialog = forwardRef(function ConfigColorDialog({ onSave,
300
300
  state.value = value;
301
301
  state.originalMuiKey = null;
302
302
  }, hidePresets: true, hideAdvancedSliders: true, hideColorGuide: true, hideInputType: true }) }) })) })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "outlined", size: "small", onClick: handleClose, children: t('common.cancel') }), _jsx(Button, { variant: "contained", size: "small", onClick: handleSave, children: t('maker.save') })] })] }));
303
- });
303
+ };
304
304
  export function ColorPicker({ value, onChange, style = {}, sx = {} }) {
305
305
  const refDialog = useRef(null);
306
306
  return (_jsxs(_Fragment, { children: [_jsx(ColorItem, { color: value || '', style: { width: '1rem', height: '1rem', padding: 0, marginRight: '0.25rem', ...style }, sx: { ...sx }, onClick: () => {
@@ -3,7 +3,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
4
4
  import { Autocomplete, ListItemIcon, ListItemText, MenuItem, TextField } from '@mui/material';
5
5
  import pick from 'lodash/pick';
6
- import { forwardRef } from 'react';
7
6
  import { languages } from './languages';
8
7
  const filter = (options, state) => {
9
8
  return options.filter((o) => {
@@ -14,7 +13,7 @@ const filter = (options, state) => {
14
13
  return true;
15
14
  });
16
15
  };
17
- const LanguageField = forwardRef(({ readOnly, parameter, onChange, ...props }, ref) => {
16
+ const LanguageField = ({ ref, readOnly, parameter, onChange, ...props }) => {
18
17
  const { locale } = useLocaleContext();
19
18
  const value = props?.value ? languages.find((o) => o.en === props.value) : null;
20
19
  return (_jsx(Autocomplete, { size: "small", ref: ref, ...pick(props, 'autoFocus', 'fullWidth', 'sx', 'className', 'style'), renderInput: (params) => (_jsx(TextField, { ...pick(props, 'inputRef', 'size', 'hiddenLabel', 'helperText', 'error', 'placeholder', 'InputProps', 'inputProps'), ...params })), options: languages, getOptionKey: (i) => i.en, getOptionLabel: (o) => {
@@ -26,5 +25,5 @@ const LanguageField = forwardRef(({ readOnly, parameter, onChange, ...props }, r
26
25
  _jsx(ListItemIcon, { children: _jsx(option.flag, {}) }),
27
26
  _jsx(ListItemText, { primary: `${option.name} ${locale === 'zh' ? option.cn : option.en} (${option.abbr})` })));
28
27
  } }));
29
- });
28
+ };
30
29
  export default LanguageField;
@@ -3,10 +3,10 @@ import { Icon } from '@iconify/react';
3
3
  import { Box, Tooltip } from '@mui/material';
4
4
  import { useRef, useState } from 'react';
5
5
  import LoadingButton from './loading-button';
6
- export default function ActionButton({ tip, tipSucceed, title, titleSucceed, icon, iconSucceed, autoReset, placement = 'top', ...props }) {
6
+ export default function ActionButton({ tip = '', tipSucceed = '', title = '', titleSucceed = '', icon = '', iconSucceed = '', autoReset = false, placement = 'top', ...props }) {
7
7
  const [active, setActive] = useState(false);
8
8
  const [error, setError] = useState();
9
- const timer = useRef();
9
+ const timer = useRef(undefined);
10
10
  const onClose = () => {
11
11
  setError(undefined);
12
12
  if (autoReset) {
@@ -19,7 +19,9 @@ export default function ActionButton({ tip, tipSucceed, title, titleSucceed, ico
19
19
  clearTimeout(timer.current);
20
20
  };
21
21
  const realIcon = active ? iconSucceed : icon;
22
- const toolTipTitleText = error ? _jsx(Box, { color: "error", children: error.message }) : (active && tipSucceed) || tip;
22
+ const toolTipTitleText = error ? (_jsx(Box, { sx: {
23
+ color: 'error',
24
+ }, children: error.message })) : ((active && tipSucceed) || tip);
23
25
  const buttonText = active ? titleSucceed : title;
24
26
  return (_jsx(Tooltip, { title: toolTipTitleText, disableInteractive: true, placement: placement, onClose: onClose, onOpen: onOpen, children: _jsx("span", { children: _jsx(LoadingButton, { startIcon: realIcon && (typeof realIcon === 'string' ? _jsx(Icon, { icon: realIcon }) : realIcon), loadingPosition: realIcon ? 'start' : undefined, ...props, onClick: async (e) => {
25
27
  if (!props.onClick)
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { LoadingButton as MuiLoadingButton } from '@mui/lab';
3
- import { forwardRef, useCallback, useState } from 'react';
4
- const LoadingButton = forwardRef(({ onClick, ...props }, ref) => {
3
+ import { useCallback, useState } from 'react';
4
+ const LoadingButton = ({ ref = undefined, onClick, ...props }) => {
5
5
  const [loading, setLoading] = useState(false);
6
6
  const handleClick = useCallback(async (e) => {
7
7
  try {
@@ -13,5 +13,5 @@ const LoadingButton = forwardRef(({ onClick, ...props }, ref) => {
13
13
  }
14
14
  }, [onClick]);
15
15
  return _jsx(MuiLoadingButton, { ref: ref, ...props, loading: props.loading || loading, onClick: handleClick });
16
- });
16
+ };
17
17
  export default LoadingButton;
@@ -38,7 +38,15 @@ function MarkdownPre({ children }) {
38
38
  borderRadius: 1,
39
39
  bgcolor: 'rgb(245, 242, 240)',
40
40
  '> pre': { mt: '0 !important' },
41
- }, children: [_jsxs(Stack, { direction: "row", alignItems: "center", p: 0.5, pl: 1.5, borderBottom: 1, borderColor: "grey.200", children: [_jsx(Box, { children: language }), _jsx(Box, { flex: 1 }), _jsx(ActionButton, { autoReset: true, title: _jsx(Icon, { icon: "tabler:copy" }), titleSucceed: _jsx(Icon, { icon: "tabler:copy-check" }), sx: { minWidth: 32, minHeight: 32, p: 0, fontSize: 18 }, onClick: () => {
41
+ }, children: [_jsxs(Stack, { direction: "row", sx: {
42
+ alignItems: 'center',
43
+ p: 0.5,
44
+ pl: 1.5,
45
+ borderBottom: 1,
46
+ borderColor: 'grey.200',
47
+ }, children: [_jsx(Box, { children: language }), _jsx(Box, { sx: {
48
+ flex: 1,
49
+ } }), _jsx(ActionButton, { autoReset: true, title: _jsx(Icon, { icon: "tabler:copy" }), titleSucceed: _jsx(Icon, { icon: "tabler:copy-check" }), sx: { minWidth: 32, minHeight: 32, p: 0, fontSize: 18 }, onClick: () => {
42
50
  window.navigator.clipboard.writeText(childrenProps.children);
43
51
  } })] }), children] }));
44
52
  }
@@ -1,2 +1,16 @@
1
- import * as ReactDOM from 'react-dom';
1
+ // React DOM 19
2
+ // Re-export ReactDOM
3
+ import ReactDOM from 'react-dom';
2
4
  export default ReactDOM;
5
+ // Re-export all ReactDOM APIs
6
+ export { createPortal, flushSync,
7
+ // React 19 form APIs
8
+ useFormStatus, requestFormReset,
9
+ // React 19 resource preloading APIs
10
+ preload, preinit, preconnect, prefetchDNS, } from 'react-dom';
11
+ // Re-export React 18+ client APIs
12
+ export { createRoot, hydrateRoot } from 'react-dom/client';
13
+ // Re-export React 19 static APIs
14
+ export { prerender, prerenderToNodeStream } from 'react-dom/static';
15
+ // Export client object for compatibility
16
+ export * as client from 'react-dom/client';
@@ -1,3 +1,10 @@
1
- import * as React from 'react';
1
+ // React 19
2
+ // Re-export React (avoiding TypeScript export conflicts)
3
+ import React from 'react';
2
4
  export default React;
3
- export { Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, startTransition, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, version, } from 'react';
5
+ // Re-export all React named exports
6
+ export { Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, cloneElement, createContext, createElement, createRef, forwardRef, isValidElement, lazy, memo, startTransition, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, version,
7
+ // React 19 APIs
8
+ useActionState, useOptimistic, use, } from 'react';
9
+ // Re-export JSX runtime
10
+ export { jsx, jsxs, Fragment as JSXFragment } from 'react/jsx-runtime';
@@ -287,7 +287,7 @@ const getComponentByComponentId = ({ componentId, locale, instanceId, }) => {
287
287
  return result;
288
288
  };
289
289
  function usePreloadComponent({ instanceId, componentId, properties, locale, dev }) {
290
- const previousRef = useRef();
290
+ const previousRef = useRef(undefined);
291
291
  const realLocale = getRealLocale(locale);
292
292
  const result = getComponentByComponentId({ componentId, locale: realLocale, instanceId });
293
293
  if (result) {