@blocklet/pages-kit 0.2.335 → 0.2.337
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/ThemeProvider.js +31 -17
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +3 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +31 -17
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +3 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -13,11 +13,25 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { ArrowDropDownRounded } from '@mui/icons-material';
|
|
14
14
|
import { CircularProgress, CssBaseline, GlobalStyles, ThemeProvider as MuiThemeProvider, Stack, alpha, createTheme, inputBaseClasses, useTheme, } from '@mui/material';
|
|
15
15
|
import { Suspense, useMemo } from 'react';
|
|
16
|
+
import { Helmet } from 'react-helmet';
|
|
16
17
|
import { useRuntimeState } from '../state/runtime';
|
|
17
18
|
import GlobalLoading from './GlobalLoading';
|
|
19
|
+
const getFontUrl = (fontList) => {
|
|
20
|
+
var _a;
|
|
21
|
+
if (!fontList.length)
|
|
22
|
+
return;
|
|
23
|
+
const BASE_URL = 'https://fonts.googleapis.com/css?family=';
|
|
24
|
+
const newFontList = (_a = fontList
|
|
25
|
+
.filter((font) => typeof font === 'string')) === null || _a === void 0 ? void 0 : _a.map((font) => font.replace(/ /g, '+')).join('|');
|
|
26
|
+
// eslint-disable-next-line consistent-return
|
|
27
|
+
return `${BASE_URL}${newFontList}`;
|
|
28
|
+
};
|
|
18
29
|
export default function ThemeProvider({ children }) {
|
|
30
|
+
var _a, _b, _c;
|
|
19
31
|
const { appearance } = useRuntimeState().agent.project;
|
|
20
32
|
const theme = useTheme();
|
|
33
|
+
const titleFont = (_a = appearance === null || appearance === void 0 ? void 0 : appearance.typography) === null || _a === void 0 ? void 0 : _a.fontFamily;
|
|
34
|
+
const headFont = (_c = (_b = appearance === null || appearance === void 0 ? void 0 : appearance.typography) === null || _b === void 0 ? void 0 : _b.heading) === null || _c === void 0 ? void 0 : _c.fontFamily;
|
|
21
35
|
const newTheme = useMemo(() => {
|
|
22
36
|
var _a, _b, _c, _d, _e, _f;
|
|
23
37
|
let { primary } = theme.palette;
|
|
@@ -144,21 +158,21 @@ export default function ThemeProvider({ children }) {
|
|
|
144
158
|
],
|
|
145
159
|
});
|
|
146
160
|
}, [theme]);
|
|
147
|
-
return (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
return (_jsxs(MuiThemeProvider, { theme: newTheme, children: [_jsx(Helmet, { children: _jsx("link", { rel: "stylesheet", href: getFontUrl([titleFont, headFont]) }) }), _jsxs(CssBaseline, { children: [_jsx(GlobalStyles, { styles: (theme) => theme.unstable_sx({
|
|
162
|
+
'h1,h2,h3,h4,h5': {
|
|
163
|
+
fontFamily: `${theme.typography.h1.fontFamily} !important`,
|
|
164
|
+
},
|
|
165
|
+
body: {
|
|
166
|
+
fontFamily: `${theme.typography.fontFamily} !important`,
|
|
167
|
+
},
|
|
168
|
+
'.page-header': {
|
|
169
|
+
borderBottom: '1px solid rgba(229, 231, 235, 1)',
|
|
170
|
+
},
|
|
171
|
+
'.white-tooltip .MuiTooltip-tooltip': {
|
|
172
|
+
background: 'white !important',
|
|
173
|
+
boxShadow: '0px 4px 8px 0px rgba(3, 7, 18, 0.08)',
|
|
174
|
+
border: '1px solid rgba(229, 231, 235, 1)',
|
|
175
|
+
padding: 4,
|
|
176
|
+
},
|
|
177
|
+
}) }), _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 })] })] }));
|
|
164
178
|
}
|
|
@@ -11,7 +11,9 @@ export default function UserMessageView() {
|
|
|
11
11
|
const { agent } = useCurrentAgent();
|
|
12
12
|
const params = useMemo(() => {
|
|
13
13
|
var _a;
|
|
14
|
-
|
|
14
|
+
const inputs = (_a = agent.parameters) === null || _a === void 0 ? void 0 : _a.filter(isValidInput).map((i) => { var _a, _b; return [((_a = i.label) === null || _a === void 0 ? void 0 : _a.trim()) || i.key, (_b = message.parameters) === null || _b === void 0 ? void 0 : _b[i.key]]; }).filter((i) => i[1]);
|
|
15
|
+
const q = inputs === null || inputs === void 0 ? void 0 : inputs.find((i) => i[0] === 'question');
|
|
16
|
+
return q ? [q] : inputs;
|
|
15
17
|
}, [agent.parameters, message.parameters]);
|
|
16
18
|
if ((params === null || params === void 0 ? void 0 : params.length) === 1) {
|
|
17
19
|
return _jsx(MarkdownRenderer, { children: (_a = params[0]) === null || _a === void 0 ? void 0 : _a[1] });
|