@blocklet/pages-kit 0.2.321 → 0.2.322
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/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +1 -4
- package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +21 -54
- package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +2 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime/Runtime/index.js +2 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +2 -20
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +2 -20
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +2 -20
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +2 -5
- package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +20 -56
- package/lib/esm/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +2 -1
- package/lib/esm/builtin/async/ai-runtime/runtime/Runtime/index.js +2 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +4 -22
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +4 -22
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +4 -22
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/builtin/async/ai-runtime/api/agent.d.ts +1 -0
- package/lib/types/builtin/async/ai-runtime/components/ThemeProvider.d.ts +1 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.d.ts +1 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +1 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimplePage/index.d.ts +1 -2
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import { CircularProgress, Stack } from '@mui/material';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
5
4
|
import { Result } from '../../../arcblock/ux';
|
|
6
5
|
import { LocaleProvider, useLocaleContext } from '../../../locale';
|
|
7
6
|
import { translations } from '../locales';
|
|
8
|
-
import GlobalLoading from './GlobalLoading';
|
|
9
|
-
import ThemeProvider from './ThemeProvider';
|
|
10
7
|
export default function RuntimeCommonProvider({ children }) {
|
|
11
|
-
return (_jsx(RuntimeLocaleProvider, { children: _jsx(
|
|
8
|
+
return (_jsx(RuntimeLocaleProvider, { children: _jsx(ErrorBoundary, { FallbackComponent: ErrorRender, children: _jsx(React.Suspense, { children: children }) }) }));
|
|
12
9
|
}
|
|
13
10
|
function ErrorRender({ error }) {
|
|
14
11
|
return (_jsx(Result, { status: error.status || 'error', description: error.message, sx: { bgcolor: 'transparent', mt: '20%' } }));
|
|
@@ -11,35 +11,23 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { ArrowDropDownRounded } from '@mui/icons-material';
|
|
14
|
-
import { GlobalStyles, ThemeProvider as MuiThemeProvider, alpha, createTheme, inputBaseClasses, useTheme, } from '@mui/material';
|
|
15
|
-
import { useMemo } from 'react';
|
|
16
|
-
|
|
14
|
+
import { CircularProgress, GlobalStyles, ThemeProvider as MuiThemeProvider, Stack, alpha, createTheme, inputBaseClasses, useTheme, } from '@mui/material';
|
|
15
|
+
import { Suspense, useMemo } from 'react';
|
|
16
|
+
import { useRuntimeState } from '../state/runtime';
|
|
17
|
+
import GlobalLoading from './GlobalLoading';
|
|
18
|
+
export default function ThemeProvider({ children }) {
|
|
19
|
+
const { primaryColor } = useRuntimeState().agent.project;
|
|
17
20
|
const theme = useTheme();
|
|
18
|
-
const colors = {
|
|
19
|
-
default: {
|
|
20
|
-
color: undefined,
|
|
21
|
-
bg: '#ffffff',
|
|
22
|
-
// primary: '#333843',
|
|
23
|
-
primary: '#3B82F6',
|
|
24
|
-
},
|
|
25
|
-
blue: {
|
|
26
|
-
color: 'white',
|
|
27
|
-
bg: 'linear-gradient(180deg, #0D60FF 0%, #E2EDFE 100%)',
|
|
28
|
-
primary: '#0D60FF',
|
|
29
|
-
},
|
|
30
|
-
red: {
|
|
31
|
-
color: 'white',
|
|
32
|
-
bg: 'linear-gradient(180deg, #F65F84 0%, #817DE6 100%), linear-gradient(180deg, #9300FF 0%, #D900FF 100%)',
|
|
33
|
-
primary: '#F65F84',
|
|
34
|
-
},
|
|
35
|
-
green: {
|
|
36
|
-
color: 'white',
|
|
37
|
-
bg: 'linear-gradient(180deg, #149E8C 0%, #35E77D 100%)',
|
|
38
|
-
primary: '#149E8C',
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
const color = colors[template] || colors.default;
|
|
42
21
|
const newTheme = useMemo(() => {
|
|
22
|
+
let { primary } = theme.palette;
|
|
23
|
+
try {
|
|
24
|
+
if (primaryColor) {
|
|
25
|
+
primary = theme.palette.augmentColor({ color: { main: primaryColor } });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error('augment primary color error', { error });
|
|
30
|
+
}
|
|
43
31
|
const themeOptions = {
|
|
44
32
|
components: {
|
|
45
33
|
MuiSelect: {
|
|
@@ -107,9 +95,7 @@ export default function ThemeProvider({ children, template, transparentHeaderBg,
|
|
|
107
95
|
};
|
|
108
96
|
const paletteTheme = createTheme({
|
|
109
97
|
palette: {
|
|
110
|
-
primary
|
|
111
|
-
main: color.primary,
|
|
112
|
-
},
|
|
98
|
+
primary,
|
|
113
99
|
secondary: {
|
|
114
100
|
main: '#010714',
|
|
115
101
|
},
|
|
@@ -132,7 +118,7 @@ export default function ThemeProvider({ children, template, transparentHeaderBg,
|
|
|
132
118
|
// @ts-ignore
|
|
133
119
|
black: paletteTheme.palette.black,
|
|
134
120
|
background: {
|
|
135
|
-
default:
|
|
121
|
+
default: '#ffffff',
|
|
136
122
|
},
|
|
137
123
|
},
|
|
138
124
|
shape: {
|
|
@@ -147,30 +133,8 @@ export default function ThemeProvider({ children, template, transparentHeaderBg,
|
|
|
147
133
|
});
|
|
148
134
|
}, [theme]);
|
|
149
135
|
return (_jsxs(MuiThemeProvider, { theme: newTheme, children: [_jsx(GlobalStyles, { styles: {
|
|
150
|
-
'.page-header':
|
|
151
|
-
|
|
152
|
-
backgroundColor: 'transparent !important',
|
|
153
|
-
color: color.color,
|
|
154
|
-
button: {
|
|
155
|
-
color: color.color,
|
|
156
|
-
},
|
|
157
|
-
}
|
|
158
|
-
: {
|
|
159
|
-
// with border bottom
|
|
160
|
-
borderBottom: '1px solid rgba(229, 231, 235, 1)',
|
|
161
|
-
},
|
|
162
|
-
body: {
|
|
163
|
-
background: 'transparent !important',
|
|
164
|
-
'&:before': {
|
|
165
|
-
content: '""',
|
|
166
|
-
position: 'fixed',
|
|
167
|
-
left: 0,
|
|
168
|
-
top: 0,
|
|
169
|
-
right: 0,
|
|
170
|
-
bottom: 0,
|
|
171
|
-
background: color.bg,
|
|
172
|
-
zIndex: -1,
|
|
173
|
-
},
|
|
136
|
+
'.page-header': {
|
|
137
|
+
borderBottom: '1px solid rgba(229, 231, 235, 1)',
|
|
174
138
|
},
|
|
175
139
|
'.white-tooltip .MuiTooltip-tooltip': {
|
|
176
140
|
background: 'white !important',
|
|
@@ -178,5 +142,5 @@ export default function ThemeProvider({ children, template, transparentHeaderBg,
|
|
|
178
142
|
border: '1px solid rgba(229, 231, 235, 1)',
|
|
179
143
|
padding: 4,
|
|
180
144
|
},
|
|
181
|
-
} }), children] }));
|
|
145
|
+
} }), _jsx(GlobalLoading, { sx: { position: 'fixed', left: 0, top: 0, width: '100%', zIndex: 'snackbar' } }), _jsx(Suspense, { fallback: _jsx(Stack, { flexGrow: 1, alignItems: "center", justifyContent: "center", children: _jsx(CircularProgress, { size: 24 }) }), children: children })] }));
|
|
182
146
|
}
|
|
@@ -19,6 +19,7 @@ import PopperMenuButton from '../../components/PopperMenuButton';
|
|
|
19
19
|
import LoadingMenuItem from '../../components/PopperMenuButton/LoadingMenuItem';
|
|
20
20
|
import RuntimeCommonProvider from '../../components/RuntimeCommonProvider';
|
|
21
21
|
import ScrollView from '../../components/ScrollView';
|
|
22
|
+
import ThemeProvider from '../../components/ThemeProvider';
|
|
22
23
|
import { DEFAULT_PAGE_COMPONENT_ID } from '../../constants';
|
|
23
24
|
import ActiveAgentProvider from '../../contexts/ActiveAgent';
|
|
24
25
|
import RuntimeProvider from '../../contexts/Runtime';
|
|
@@ -26,7 +27,7 @@ import useAppearances, { useProfile } from '../../hooks/use-appearances';
|
|
|
26
27
|
import { useRuntimeState } from '../../state/runtime';
|
|
27
28
|
import { useAutoLoadSessionState, useSessionState } from '../../state/session';
|
|
28
29
|
export default function ChatBotButton({ aid, working }) {
|
|
29
|
-
return (_jsx(RuntimeCommonProvider, { children: _jsx(RuntimeProvider, { aid: aid, working: working, children: _jsx(ActiveAgentProvider, { children: _jsx(ChatBotContent, {}) }) }) }));
|
|
30
|
+
return (_jsx(RuntimeCommonProvider, { children: _jsx(RuntimeProvider, { aid: aid, working: working, children: _jsx(ThemeProvider, { children: _jsx(ActiveAgentProvider, { children: _jsx(ChatBotContent, {}) }) }) }) }));
|
|
30
31
|
}
|
|
31
32
|
function ChatBotContent() {
|
|
32
33
|
var _a, _b;
|
|
@@ -9,6 +9,7 @@ import { useHeader } from '../../../../page/header';
|
|
|
9
9
|
import { getComponentMountPoint } from '../../../../utils';
|
|
10
10
|
import RuntimeCommonProvider, { RuntimeLocaleProvider } from '../../components/RuntimeCommonProvider';
|
|
11
11
|
import SocialShare from '../../components/SocialShare';
|
|
12
|
+
import ThemeProvider from '../../components/ThemeProvider';
|
|
12
13
|
import { AI_STUDIO_DID, DEFAULT_PAGE_COMPONENT_ID } from '../../constants';
|
|
13
14
|
import ActiveAgentProvider from '../../contexts/ActiveAgent';
|
|
14
15
|
import RuntimeProvider, { RuntimeProviderFromUrl } from '../../contexts/Runtime';
|
|
@@ -20,7 +21,7 @@ function AgentCreatedBy({ did }) {
|
|
|
20
21
|
return (_jsxs(_Fragment, { children: [t('by'), " ", _jsx(Box, { component: DID, did: did, copyable: false, responsive: true })] }));
|
|
21
22
|
}
|
|
22
23
|
export default function Runtime({ aid, working }) {
|
|
23
|
-
const children = (_jsx(ActiveAgentProvider, { children: _jsx(RuntimeView, {}) }));
|
|
24
|
+
const children = (_jsx(ThemeProvider, { children: _jsx(ActiveAgentProvider, { children: _jsx(RuntimeView, {}) }) }));
|
|
24
25
|
return (_jsx(RuntimeCommonProvider, { children: aid ? (_jsx(RuntimeProvider, { aid: aid, working: working, children: children })) : (_jsx(RuntimeProviderFromUrl, { children: children })) }));
|
|
25
26
|
}
|
|
26
27
|
function RuntimeView() {
|
|
@@ -11,8 +11,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { Masonry } from '@mui/lab';
|
|
14
|
-
import { Box, Skeleton, Stack,
|
|
15
|
-
import { Suspense, memo,
|
|
14
|
+
import { Box, Skeleton, Stack, Typography } from '@mui/material';
|
|
15
|
+
import { Suspense, memo, useRef } from 'react';
|
|
16
16
|
import Balancer from 'react-wrap-balancer';
|
|
17
17
|
import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
|
|
18
18
|
import { useLocaleContext } from '../../../../locale';
|
|
@@ -24,28 +24,10 @@ import CurrentMessageProvider from '../../contexts/CurrentMessage';
|
|
|
24
24
|
import useAppearances from '../../hooks/use-appearances';
|
|
25
25
|
import { useAutoLoadSessionState, useCurrentSessionState, useSessionState } from '../../state/session';
|
|
26
26
|
import mapRight from '../../utils/map-right';
|
|
27
|
-
export default function PhotoGallery({ resultTitle
|
|
27
|
+
export default function PhotoGallery({ resultTitle }) {
|
|
28
28
|
const { activeAgentId } = useActiveAgent();
|
|
29
29
|
useAutoLoadSessionState();
|
|
30
|
-
|
|
31
|
-
const theme = useMemo(() => {
|
|
32
|
-
let { primary } = inheritedTheme.palette;
|
|
33
|
-
try {
|
|
34
|
-
if (primaryColor) {
|
|
35
|
-
primary = inheritedTheme.palette.augmentColor({ color: { main: primaryColor } });
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
console.error('augment primary color error', { error });
|
|
40
|
-
}
|
|
41
|
-
return createTheme(inheritedTheme, {
|
|
42
|
-
palette: { primary },
|
|
43
|
-
shape: {
|
|
44
|
-
borderRadius: 8,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
}, [inheritedTheme, primaryColor]);
|
|
48
|
-
return (_jsx(ThemeProvider, { theme: theme, children: _jsxs(Stack, { className: "aigne-layout aigne-photo-wall-layout", children: [_jsx(SimpleHeader, { TitleProps: { fontSize: 48 }, DescriptionProps: { fontSize: 20 }, maxWidth: "md", mx: "auto", width: "100%", px: { xs: 2, sm: 3 } }), _jsx(CurrentAgentProvider, { agentId: activeAgentId, children: _jsx(AgentInputRender, { className: "aigne-inputs aigne-photo-wall-inputs", maxWidth: "md", mx: "auto", width: "100%", px: { xs: 2, sm: 3 } }) }), _jsx(OutputView, { resultTitle: resultTitle, className: "aigne-outputs aigne-photo-wall-outputs", gap: 2 })] }) }));
|
|
30
|
+
return (_jsxs(Stack, { className: "aigne-layout aigne-photo-wall-layout", children: [_jsx(SimpleHeader, { TitleProps: { fontSize: 48 }, DescriptionProps: { fontSize: 20 }, maxWidth: "md", mx: "auto", width: "100%", px: { xs: 2, sm: 3 } }), _jsx(CurrentAgentProvider, { agentId: activeAgentId, children: _jsx(AgentInputRender, { className: "aigne-inputs aigne-photo-wall-inputs", maxWidth: "md", mx: "auto", width: "100%", px: { xs: 2, sm: 3 } }) }), _jsx(OutputView, { resultTitle: resultTitle, className: "aigne-outputs aigne-photo-wall-outputs", gap: 2 })] }));
|
|
49
31
|
}
|
|
50
32
|
function AgentInputRender(_a) {
|
|
51
33
|
var props = __rest(_a, []);
|
|
@@ -10,8 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
-
import { Box, CircularProgress,
|
|
14
|
-
import { useEffect
|
|
13
|
+
import { Box, CircularProgress, alpha } from '@mui/material';
|
|
14
|
+
import { useEffect } from 'react';
|
|
15
15
|
import { useScrollToBottom } from 'react-scroll-to-bottom';
|
|
16
16
|
import SimpleHeader from '../../components/Header/SimpleHeader';
|
|
17
17
|
import SimpleLayout from '../../components/Layout/SimpleLayout';
|
|
@@ -25,27 +25,9 @@ import BackgroundImage from './BackgroundImage';
|
|
|
25
25
|
import InputsView from './InputsView';
|
|
26
26
|
import MessagesView from './MessagesView';
|
|
27
27
|
export default function SimpleChat(_a) {
|
|
28
|
-
var {
|
|
28
|
+
var { scrollViewProps = { scroll: 'window', initialScrollBehavior: 'auto' } } = _a, preferences = __rest(_a, ["scrollViewProps"]);
|
|
29
29
|
useAutoLoadSessionState();
|
|
30
|
-
|
|
31
|
-
const theme = useMemo(() => {
|
|
32
|
-
let { primary } = inheritedTheme.palette;
|
|
33
|
-
try {
|
|
34
|
-
if (primaryColor) {
|
|
35
|
-
primary = inheritedTheme.palette.augmentColor({ color: { main: primaryColor } });
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
console.error('augment primary color error', { error });
|
|
40
|
-
}
|
|
41
|
-
return createTheme(inheritedTheme, {
|
|
42
|
-
palette: { primary },
|
|
43
|
-
shape: {
|
|
44
|
-
borderRadius: 8,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
}, [inheritedTheme, primaryColor]);
|
|
48
|
-
return (_jsx(ComponentPreferencesProvider, Object.assign({}, preferences, { children: _jsx(ScrollView, Object.assign({}, scrollViewProps, { children: _jsxs(ThemeProvider, { theme: theme, children: [_jsx(BackgroundImage, {}), _jsx(SimpleChatView, {})] }) })) })));
|
|
30
|
+
return (_jsx(ComponentPreferencesProvider, Object.assign({}, preferences, { children: _jsxs(ScrollView, Object.assign({}, scrollViewProps, { children: [_jsx(BackgroundImage, {}), _jsx(SimpleChatView, {})] })) })));
|
|
49
31
|
}
|
|
50
32
|
function SimpleChatView() {
|
|
51
33
|
const { activeAgentId } = useActiveAgent();
|
|
@@ -10,8 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
-
import { Stack,
|
|
14
|
-
import { Suspense, memo
|
|
13
|
+
import { Stack, Typography } from '@mui/material';
|
|
14
|
+
import { Suspense, memo } from 'react';
|
|
15
15
|
import Balancer from 'react-wrap-balancer';
|
|
16
16
|
import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
|
|
17
17
|
import SimpleHeader from '../../components/Header/SimpleHeader';
|
|
@@ -21,28 +21,10 @@ import CurrentAgentProvider from '../../contexts/CurrentAgent';
|
|
|
21
21
|
import CurrentMessageProvider from '../../contexts/CurrentMessage';
|
|
22
22
|
import useAppearances from '../../hooks/use-appearances';
|
|
23
23
|
import { useAutoLoadSessionState, useCurrentSessionState } from '../../state/session';
|
|
24
|
-
export default function SimplePage({ resultTitle
|
|
24
|
+
export default function SimplePage({ resultTitle }) {
|
|
25
25
|
const { activeAgentId } = useActiveAgent();
|
|
26
26
|
useAutoLoadSessionState();
|
|
27
|
-
|
|
28
|
-
const theme = useMemo(() => {
|
|
29
|
-
let { primary } = inheritedTheme.palette;
|
|
30
|
-
try {
|
|
31
|
-
if (primaryColor) {
|
|
32
|
-
primary = inheritedTheme.palette.augmentColor({ color: { main: primaryColor } });
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
console.error('augment primary color error', { error });
|
|
37
|
-
}
|
|
38
|
-
return createTheme(inheritedTheme, {
|
|
39
|
-
palette: { primary },
|
|
40
|
-
shape: {
|
|
41
|
-
borderRadius: 8,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
}, [inheritedTheme, primaryColor]);
|
|
45
|
-
return (_jsx(ThemeProvider, { theme: theme, children: _jsxs(SimpleLayout, { pb: 4, children: [_jsx(SimpleHeader, {}), _jsx(CurrentAgentProvider, { agentId: activeAgentId, children: _jsx(AgentInputRender, { className: "aigne-inputs aigne-simple-page-inputs" }) }), _jsx(OutputView, { className: "aigne-outputs aigne-simple-page-outputs", resultTitle: resultTitle })] }) }));
|
|
27
|
+
return (_jsxs(SimpleLayout, { pb: 4, children: [_jsx(SimpleHeader, {}), _jsx(CurrentAgentProvider, { agentId: activeAgentId, children: _jsx(AgentInputRender, { className: "aigne-inputs aigne-simple-page-inputs" }) }), _jsx(OutputView, { className: "aigne-outputs aigne-simple-page-outputs", resultTitle: resultTitle })] }));
|
|
46
28
|
}
|
|
47
29
|
function AgentInputRender(_a) {
|
|
48
30
|
var props = __rest(_a, []);
|