@blocklet/pages-kit-block-studio 0.4.145 → 0.4.147
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.
|
@@ -135,6 +135,9 @@ function Layout({ loadState, loadedData }) {
|
|
|
135
135
|
},
|
|
136
136
|
};
|
|
137
137
|
}, [staticData, location.pathname]);
|
|
138
|
+
const notSelectedBlock = useMemo(() => {
|
|
139
|
+
return !currentPage?.blockName || !currentPage?.code;
|
|
140
|
+
}, [currentPage]);
|
|
138
141
|
const getStaticData = useCallback(() => {
|
|
139
142
|
return staticData[location.pathname]?.main || {};
|
|
140
143
|
}, [staticData, location.pathname]);
|
|
@@ -384,6 +387,44 @@ function Layout({ loadState, loadedData }) {
|
|
|
384
387
|
const initialLocale = url.searchParams.get('locale') || locale || 'en';
|
|
385
388
|
return (_jsx(Box, { className: "custom-component-root", sx: { height: '100%', width: '100%', overflow: 'auto' }, children: _jsx(ThemeProvider, { theme: pagesTheme, children: _jsx(Suspense, { fallback: _jsx(CircularProgress, {}), children: _jsx(CustomComponentRenderer, { locale: initialLocale, componentId: initialComponentId || state.metadata.id, dev: { mode: 'draft', components: mergedAllBlocks, defaultLocale }, properties: mergedPropertiesValues }, `custom-${renderComponentTrigger}`) }) }) }));
|
|
386
389
|
}
|
|
390
|
+
// 没有匹配到路由,使用欢迎页面
|
|
391
|
+
if (notSelectedBlock) {
|
|
392
|
+
return (_jsxs(Box, { width: "100%", height: "100%", display: "flex", flexDirection: "column", justifyContent: "center", alignItems: "center", sx: {
|
|
393
|
+
backgroundColor: 'background.default',
|
|
394
|
+
p: 3,
|
|
395
|
+
textAlign: 'center',
|
|
396
|
+
}, children: [_jsx(Box, { component: "img", src: "https://api.iconify.design/fluent-emoji:waving-hand.svg", sx: { width: 64, height: 64, mb: 3 }, alt: "Welcome" }), _jsx(Typography, { variant: "h4", sx: { mb: 2, fontWeight: 'bold', color: 'primary.main' }, children: t('themeTranslations.welcomeTitle') }), _jsx(Typography, { variant: "body1", sx: { mb: 4, color: 'text.secondary', maxWidth: 600 }, children: t('themeTranslations.welcomeDescription') }), _jsxs(Box, { sx: { display: 'flex', gap: 2, mb: 4 }, children: [_jsx(Button, { variant: "contained", startIcon: _jsx(AddIcon, {}), onClick: () => {
|
|
397
|
+
state.createBlockOpen = true;
|
|
398
|
+
}, children: t('themeTranslations.createBlock') }), _jsx(Button, { variant: "outlined", component: "a", href: "https://community.arcblock.io/", target: "_blank", rel: "noopener", children: t('themeTranslations.getHelp') })] }), _jsxs(Box, { sx: {
|
|
399
|
+
display: 'flex',
|
|
400
|
+
flexDirection: 'column',
|
|
401
|
+
gap: 2,
|
|
402
|
+
p: 3,
|
|
403
|
+
bgcolor: 'background.paper',
|
|
404
|
+
borderRadius: 2,
|
|
405
|
+
boxShadow: 1,
|
|
406
|
+
maxWidth: 600,
|
|
407
|
+
mx: 2,
|
|
408
|
+
width: 'calc(100% - 32px)',
|
|
409
|
+
mt: 2,
|
|
410
|
+
}, children: [_jsx(Typography, { variant: "h6", sx: { color: 'primary.main', mb: 1, textAlign: 'center' }, children: t('themeTranslations.quickStart') }), _jsx(Stack, { spacing: 2.5, children: [1, 2, 3].map((step) => (_jsxs(Box, { sx: { display: 'flex', gap: 2 }, children: [_jsx(Box, { sx: {
|
|
411
|
+
bgcolor: 'primary.main',
|
|
412
|
+
color: 'primary.contrastText',
|
|
413
|
+
width: 24,
|
|
414
|
+
height: 24,
|
|
415
|
+
borderRadius: '50%',
|
|
416
|
+
display: 'flex',
|
|
417
|
+
alignItems: 'center',
|
|
418
|
+
justifyContent: 'center',
|
|
419
|
+
fontWeight: 'bold',
|
|
420
|
+
flexShrink: 0,
|
|
421
|
+
}, children: step }), _jsx(Typography, { sx: {
|
|
422
|
+
flex: 1,
|
|
423
|
+
minWidth: 0,
|
|
424
|
+
wordBreak: 'break-word',
|
|
425
|
+
textAlign: 'left',
|
|
426
|
+
}, children: t(`themeTranslations.step${step}`) })] }, step))) })] })] }, "content-welcome"));
|
|
427
|
+
}
|
|
387
428
|
// 外部容器,包含设备切换按钮和iframe
|
|
388
429
|
return (_jsxs(Box, { sx: { height: '100%', display: 'flex', flexDirection: 'column' }, children: [_jsx(Box, { sx: { p: 1, display: 'flex', justifyContent: 'center', borderBottom: '1px solid #e0e0e0' }, children: _jsxs(ToggleButtonGroup, { size: "small", exclusive: true, color: "primary", value: state.simulatorType, onChange: (_, value) => (state.simulatorType = value ?? state.simulatorType), sx: {
|
|
389
430
|
'& > button': {
|
|
@@ -474,7 +515,7 @@ function Layout({ loadState, loadedData }) {
|
|
|
474
515
|
display: state.draggingSplitPane ? 'none' : 'flex',
|
|
475
516
|
}, onLoad: () => {
|
|
476
517
|
state.iframeLoaded = true;
|
|
477
|
-
}, title: "Component Preview" })] })] }) })] }, "middle-panel"));
|
|
518
|
+
}, title: "Component Preview" })] })] }) }, "content-iframe")] }, "middle-panel"));
|
|
478
519
|
}, [
|
|
479
520
|
loadedData,
|
|
480
521
|
loadState,
|
|
@@ -490,7 +531,20 @@ function Layout({ loadState, loadedData }) {
|
|
|
490
531
|
if (state.draggingSplitPane) {
|
|
491
532
|
return DraggingSplitPlaceholder;
|
|
492
533
|
}
|
|
493
|
-
return (_jsxs(List, { sx: {
|
|
534
|
+
return (_jsxs(List, { sx: {
|
|
535
|
+
height: '100%',
|
|
536
|
+
overflowY: 'auto',
|
|
537
|
+
display: 'flex',
|
|
538
|
+
flexDirection: 'column',
|
|
539
|
+
gap: 1,
|
|
540
|
+
// add disabled backdrop if not selected block
|
|
541
|
+
'& .MuiListItem-root': {
|
|
542
|
+
pointerEvents: notSelectedBlock ? 'none' : 'auto',
|
|
543
|
+
opacity: notSelectedBlock ? 0.5 : 1,
|
|
544
|
+
backdropFilter: notSelectedBlock ? 'blur(10px) !important' : 'none',
|
|
545
|
+
userSelect: notSelectedBlock ? 'none' : 'auto',
|
|
546
|
+
},
|
|
547
|
+
}, children: [_jsx(ListItem, { children: _jsx(Box, { sx: { width: '100%' }, children: _jsx(BasicInfo, { config: state.metadata }) }) }), _jsx(ListItem, { children: _jsxs(Box, { sx: { width: '100%' }, children: [_jsx(PropertiesConfig, { config: state.metadata, currentLocale: locale, defaultLocale: defaultLocale, allComponents: mergedAllBlocks, onUpdateConfig: (updater) => {
|
|
494
548
|
updater(state.metadata);
|
|
495
549
|
}, useI18nEditor: false }), _jsxs(Stack, { direction: "column", spacing: 1, sx: { mt: 1 }, children: [_jsx(Button, { variant: "contained", size: "small", color: "primary", onClick: async () => {
|
|
496
550
|
try {
|
|
@@ -764,14 +818,14 @@ function CreateResource({ open, onClose }) {
|
|
|
764
818
|
// 这里我们在运行时扩展 translations 对象,而不是修改源文件
|
|
765
819
|
if (!translations.en.themeTranslations) {
|
|
766
820
|
translations.en.themeTranslations = {
|
|
767
|
-
search: 'Search
|
|
768
|
-
createNewBlock: 'Create New
|
|
821
|
+
search: 'Search Components...',
|
|
822
|
+
createNewBlock: 'Create New Component',
|
|
769
823
|
name: 'Name',
|
|
770
824
|
description: 'Description',
|
|
771
825
|
create: 'Create',
|
|
772
|
-
blockNameRequired: '
|
|
773
|
-
blockNameExists: '
|
|
774
|
-
failedCreateBlock: 'Failed to create
|
|
826
|
+
blockNameRequired: 'Component name is required',
|
|
827
|
+
blockNameExists: 'Component name already exists, please try another name',
|
|
828
|
+
failedCreateBlock: 'Failed to create component',
|
|
775
829
|
createResource: 'Create Resource',
|
|
776
830
|
failedLoadCode: 'Failed to load component code',
|
|
777
831
|
interfaceToProperties: 'Interface → Properties',
|
|
@@ -800,6 +854,14 @@ if (!translations.en.themeTranslations) {
|
|
|
800
854
|
configUpdateConfirmation: 'Configuration will be updated after confirmation.',
|
|
801
855
|
operationFailed: 'Operation failed',
|
|
802
856
|
noRoutesFound: 'No Components Found',
|
|
857
|
+
welcomeTitle: 'Welcome to Component Studio',
|
|
858
|
+
welcomeDescription: 'Create, customize, and manage your components with ease. Select an existing component or create a new one to start your creative journey.',
|
|
859
|
+
createBlock: 'Create Component',
|
|
860
|
+
getHelp: 'Community Support',
|
|
861
|
+
quickStart: 'Quick Start Guide',
|
|
862
|
+
step1: 'Browse and select components from the left menu, or create your own',
|
|
863
|
+
step2: 'Preview your component in the center area with responsive design views',
|
|
864
|
+
step3: 'Customize properties and configurations in the right panel to bring your ideas to life',
|
|
803
865
|
};
|
|
804
866
|
}
|
|
805
867
|
if (!translations.zh.themeTranslations) {
|
|
@@ -809,8 +871,8 @@ if (!translations.zh.themeTranslations) {
|
|
|
809
871
|
name: '名称',
|
|
810
872
|
description: '描述',
|
|
811
873
|
create: '创建',
|
|
812
|
-
blockNameRequired: '
|
|
813
|
-
blockNameExists: '
|
|
874
|
+
blockNameRequired: '组件名称不能为空',
|
|
875
|
+
blockNameExists: '组件名称已存在,请尝试其他名称',
|
|
814
876
|
failedCreateBlock: '创建组件失败',
|
|
815
877
|
createResource: '创建资源',
|
|
816
878
|
failedLoadCode: '加载组件代码失败',
|
|
@@ -840,5 +902,13 @@ if (!translations.zh.themeTranslations) {
|
|
|
840
902
|
configUpdateConfirmation: '确认后将更新配置。',
|
|
841
903
|
operationFailed: '执行操作失败',
|
|
842
904
|
noRoutesFound: '未找到组件',
|
|
905
|
+
welcomeTitle: '欢迎使用 Block Studio',
|
|
906
|
+
welcomeDescription: '轻松创建、自定义和管理您的组件。选择现有组件或创建新组件,开启您的创意之旅。',
|
|
907
|
+
createBlock: '创建组件',
|
|
908
|
+
getHelp: '社区支持',
|
|
909
|
+
quickStart: '快速入门指南',
|
|
910
|
+
step1: '从左侧菜单浏览并选择组件,或创建您自己的组件',
|
|
911
|
+
step2: '在中央区域预览您的组件,支持响应式设计视图',
|
|
912
|
+
step3: '在右侧面板自定义属性和配置,让您的创意变为现实',
|
|
843
913
|
};
|
|
844
914
|
}
|