@blocklet/pages-kit 0.2.320 → 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 +32 -58
- package/lib/cjs/builtin/async/ai-runtime/locales/index.js +4 -0
- 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/builtin/async/ai-runtime/runtime-components/V0/Input.js +29 -17
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Output.js +36 -17
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Page.js +84 -77
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +2 -2
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +7 -5
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +4 -4
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +4 -1
- package/lib/cjs/builtin/iconify/react.js +8 -2
- package/lib/cjs/components/CustomComponentRenderer/state.js +14 -0
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/inject-global-components-dump-json.js +8 -3
- package/lib/esm/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +2 -5
- package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +31 -60
- package/lib/esm/builtin/async/ai-runtime/locales/index.js +4 -0
- 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/builtin/async/ai-runtime/runtime-components/V0/Input.js +29 -17
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Output.js +36 -17
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Page.js +84 -78
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +2 -2
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +7 -5
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +4 -4
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +4 -1
- package/lib/esm/builtin/iconify/react.js +7 -1
- package/lib/esm/components/CustomComponentRenderer/state.js +11 -0
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/inject-global-components-dump-json.js +8 -3
- 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/locales/index.d.ts +4 -0
- 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/builtin/async/ai-runtime/runtime-components/V0/Page.d.ts +1 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.d.ts +1 -0
- package/lib/types/builtin/iconify/react.d.ts +2 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -45,7 +45,7 @@ const UserQuestion_1 = __importDefault(require("./components/UserQuestion"));
|
|
|
45
45
|
const V0Runtime_1 = require("./contexts/V0Runtime");
|
|
46
46
|
const utils_1 = require("./utils");
|
|
47
47
|
const sliderWidth = 200;
|
|
48
|
-
function V0Page({ textColor = '#333', primaryColor }) {
|
|
48
|
+
function V0Page({ textColor = '#333', primaryColor = '#333' }) {
|
|
49
49
|
const inheritedTheme = (0, material_1.useTheme)();
|
|
50
50
|
const theme = (0, react_2.useMemo)(() => {
|
|
51
51
|
let { primary } = inheritedTheme.palette;
|
|
@@ -58,7 +58,7 @@ function V0Page({ textColor = '#333', primaryColor }) {
|
|
|
58
58
|
console.error('augment primary color error', { error });
|
|
59
59
|
}
|
|
60
60
|
return (0, material_1.createTheme)(inheritedTheme, {
|
|
61
|
-
palette: { primary, textColor, background: { block: '#
|
|
61
|
+
palette: { primary, textColor, background: { block: '#f6f6f6' } },
|
|
62
62
|
shape: {
|
|
63
63
|
borderRadius: 8,
|
|
64
64
|
},
|
|
@@ -69,30 +69,36 @@ function V0Page({ textColor = '#333', primaryColor }) {
|
|
|
69
69
|
});
|
|
70
70
|
const { currentSessionId } = (0, session_1.useSessionState)((s) => s) || {};
|
|
71
71
|
const { activeAgentId } = (0, ActiveAgent_1.useActiveAgent)();
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
72
|
+
const { isMobile } = (0, V0Runtime_1.useV0RuntimeContext)();
|
|
73
|
+
return ((0, jsx_runtime_1.jsx)(material_1.ThemeProvider, { theme: theme, children: (0, jsx_runtime_1.jsx)(CurrentAgent_1.default, { agentId: activeAgentId, children: (0, jsx_runtime_1.jsx)(material_1.Box, { flex: 1, children: (0, jsx_runtime_1.jsxs)(material_1.Container, { sx: {
|
|
74
|
+
height: 'calc(100vh - 64px - 1px)',
|
|
75
|
+
textAlign: 'center',
|
|
76
|
+
pt: 3,
|
|
77
|
+
gap: 2,
|
|
78
|
+
display: 'flex',
|
|
79
|
+
flexDirection: 'column',
|
|
80
|
+
position: 'relative',
|
|
81
|
+
'.code-preview-wrapper': {},
|
|
82
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
83
|
+
flex: 1,
|
|
84
|
+
height: !isMobile && currentSessionId ? 'calc(100% - 48px - 16px - 16px)' : 'unset',
|
|
85
|
+
}, children: currentSessionId ? (0, jsx_runtime_1.jsx)(V0DetailRender, {}) : (0, jsx_runtime_1.jsx)(V0ListRender, {}) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
86
|
+
position: 'sticky',
|
|
87
|
+
bottom: 0,
|
|
88
|
+
backgroundColor: 'white',
|
|
89
|
+
py: 2,
|
|
90
|
+
pt: currentSessionId ? 0 : 2,
|
|
91
|
+
zIndex: 1100,
|
|
92
|
+
}, children: (0, jsx_runtime_1.jsx)(AgentInputRender, {}) })] }) }) }) }));
|
|
93
|
+
}
|
|
94
|
+
function Page() {
|
|
95
|
+
return ((0, jsx_runtime_1.jsx)(V0Runtime_1.V0RuntimeProvider, { children: (0, jsx_runtime_1.jsx)(V0Page, {}) }));
|
|
91
96
|
}
|
|
92
|
-
exports.default =
|
|
97
|
+
exports.default = Page;
|
|
93
98
|
function V0ListRender() {
|
|
94
99
|
const ConfirmDialogRef = (0, react_2.useRef)();
|
|
95
100
|
const { sessions: sessionsList, setCurrentSessionId, loadLatestMessagesForAllSessions, sessionMap, deleteSession, loading, } = (0, session_1.useSessionState)((s) => s) || {};
|
|
101
|
+
const { isMobile } = (0, V0Runtime_1.useV0RuntimeContext)();
|
|
96
102
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
97
103
|
(0, react_2.useEffect)(() => {
|
|
98
104
|
const loadData = () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -102,13 +108,16 @@ function V0ListRender() {
|
|
|
102
108
|
});
|
|
103
109
|
loadData();
|
|
104
110
|
}, [sessionsList === null || sessionsList === void 0 ? void 0 : sessionsList.length]);
|
|
105
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h2", color: "textColor", sx: { fontWeight: 'bold', mt: 6 }, children: t('v0.title') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h5", color: "textColor", sx: Object.assign(Object.assign({}, (0, utils_1.getLineClamp)(5)), { mt: 2 }), children: t('v0.description') }), loading ? ((0, jsx_runtime_1.jsx)(Loading_1.default, { sx: {
|
|
111
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h2", color: "textColor", sx: { fontWeight: 'bold', mt: isMobile ? 3 : 6 }, children: t('v0.title') }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h5", color: "textColor", sx: Object.assign(Object.assign({}, (0, utils_1.getLineClamp)(5)), { mt: 2 }), children: t('v0.description') }), loading ? ((0, jsx_runtime_1.jsx)(Loading_1.default, { sx: {
|
|
106
112
|
position: 'relative',
|
|
107
113
|
height: '40vh',
|
|
108
114
|
width: '100%',
|
|
109
115
|
} })) : ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
110
|
-
mt: 8,
|
|
111
|
-
|
|
116
|
+
mt: isMobile ? 4 : 8,
|
|
117
|
+
display: 'flex',
|
|
118
|
+
alignContent: 'center',
|
|
119
|
+
justifyContent: 'center',
|
|
120
|
+
}, children: [(sessionsList === null || sessionsList === void 0 ? void 0 : sessionsList.length) ? ((0, jsx_runtime_1.jsx)(lab_1.Masonry, { columns: { xs: 1, sm: 2, md: 4, lg: 4 }, sequential: true, spacing: 2, children: sessionsList === null || sessionsList === void 0 ? void 0 : sessionsList.map((item) => {
|
|
112
121
|
var _a, _b;
|
|
113
122
|
const { name, id } = item;
|
|
114
123
|
const latestMessage = (_b = (_a = sessionMap === null || sessionMap === void 0 ? void 0 : sessionMap[id]) === null || _a === void 0 ? void 0 : _a.messages) === null || _b === void 0 ? void 0 : _b.at(-1);
|
|
@@ -128,8 +137,9 @@ function V0ListRender() {
|
|
|
128
137
|
cursor: 'pointer',
|
|
129
138
|
transition: 'all 0.3s',
|
|
130
139
|
overflow: 'hidden',
|
|
131
|
-
minHeight: sliderWidth,
|
|
132
|
-
maxHeight: '50vh',
|
|
140
|
+
// minHeight: sliderWidth,
|
|
141
|
+
// maxHeight: '50vh',
|
|
142
|
+
height: 300,
|
|
133
143
|
'&:hover': {
|
|
134
144
|
borderColor: 'primary.main',
|
|
135
145
|
},
|
|
@@ -168,7 +178,8 @@ function V0ListRender() {
|
|
|
168
178
|
function V0DetailRender() {
|
|
169
179
|
const { setCurrentSessionId } = (0, session_1.useSessionState)((s) => s) || {};
|
|
170
180
|
const { messages: messagesList, loading } = (0, session_1.useCurrentSessionState)((s) => s) || {};
|
|
171
|
-
const { currentMessageTaskId, setCurrentMessageTaskId, propertiesValueMap } = (0, V0Runtime_1.useV0RuntimeContext)();
|
|
181
|
+
const { currentMessageTaskId, setCurrentMessageTaskId, propertiesValueMap, isMobile } = (0, V0Runtime_1.useV0RuntimeContext)();
|
|
182
|
+
const [sliderOpenInMobile, setSliderOpenInMobile] = (0, react_2.useState)(!isMobile);
|
|
172
183
|
const { t } = (0, locale_1.useLocaleContext)();
|
|
173
184
|
const currentMessage = messagesList === null || messagesList === void 0 ? void 0 : messagesList.find((item) => item.taskId === currentMessageTaskId);
|
|
174
185
|
(0, react_2.useEffect)(() => {
|
|
@@ -181,48 +192,48 @@ function V0DetailRender() {
|
|
|
181
192
|
}
|
|
182
193
|
}
|
|
183
194
|
}, [messagesList, currentMessageTaskId]);
|
|
195
|
+
const sliderOpen = isMobile ? sliderOpenInMobile : true;
|
|
196
|
+
const sliderWrapperSx = {
|
|
197
|
+
height: isMobile ? 'unset' : '100%',
|
|
198
|
+
backgroundColor: 'background.block',
|
|
199
|
+
borderRadius: 1,
|
|
200
|
+
p: 2,
|
|
201
|
+
position: 'relative',
|
|
202
|
+
};
|
|
184
203
|
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { flex: 1, sx: {
|
|
185
204
|
display: 'flex',
|
|
186
205
|
gap: 2,
|
|
187
206
|
height: '100%',
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
right: 0,
|
|
211
|
-
bottom: 0,
|
|
212
|
-
margin: 'auto',
|
|
213
|
-
background: 'rgba(255, 255, 255, 0.8)',
|
|
214
|
-
opacity: 0.8,
|
|
215
|
-
borderRadius: 1,
|
|
216
|
-
boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)',
|
|
217
|
-
} })), (0, jsx_runtime_1.jsx)(material_1.Stack, { spacing: 2, sx: {
|
|
207
|
+
flexDirection: isMobile ? 'column' : 'row',
|
|
208
|
+
}, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: Object.assign({ width: isMobile ? '100%' : sliderWidth, gap: 2, display: 'flex', flexDirection: 'column' }, (isMobile ? {} : Object.assign({}, sliderWrapperSx))), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
209
|
+
display: 'flex',
|
|
210
|
+
justifyContent: 'space-between',
|
|
211
|
+
alignItems: 'center',
|
|
212
|
+
gap: 2,
|
|
213
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "outlined", size: "small", startIcon: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:chevron-left" }), onClick: () => {
|
|
214
|
+
setCurrentMessageTaskId(undefined);
|
|
215
|
+
setCurrentSessionId('');
|
|
216
|
+
}, sx: {
|
|
217
|
+
backgroundColor: 'white',
|
|
218
|
+
width: isMobile ? 'auto' : '100%',
|
|
219
|
+
}, children: t('back') }), isMobile ? ((0, jsx_runtime_1.jsx)(material_1.Button, { startIcon: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: sliderOpenInMobile ? 'tabler:chevron-up' : 'tabler:chevron-down' }), size: "small", onClick: () => setSliderOpenInMobile(!sliderOpenInMobile), children: sliderOpenInMobile ? t('v0.hideSlider') : t('v0.showSlider') })) : null, loading && ((0, jsx_runtime_1.jsx)(Loading_1.default, { sx: Object.assign({ position: 'absolute', zIndex: 99999, top: 0, left: 0, right: 0, bottom: 0, margin: 'auto', background: 'rgba(255, 255, 255, 0.8)', opacity: 0.8, borderRadius: 1, boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)' }, (isMobile
|
|
220
|
+
? {
|
|
221
|
+
width: '40px',
|
|
222
|
+
height: '40px',
|
|
223
|
+
}
|
|
224
|
+
: {
|
|
225
|
+
width: '80px',
|
|
226
|
+
height: '80px',
|
|
227
|
+
})) }))] }), sliderOpen && ((0, jsx_runtime_1.jsx)(material_1.Stack, { spacing: 2, direction: isMobile ? 'row' : 'column', sx: Object.assign(Object.assign({}, (isMobile
|
|
228
|
+
? Object.assign({ overflowY: 'hidden', overflowX: 'auto' }, sliderWrapperSx) : {
|
|
218
229
|
overflowY: 'auto',
|
|
219
230
|
overflowX: 'hidden',
|
|
231
|
+
})), {
|
|
220
232
|
// scrollbarWidth: 'thin',
|
|
221
233
|
// scrollbarColor: 'grey transparent',
|
|
222
234
|
'&::-webkit-scrollbar': {
|
|
223
235
|
display: 'none',
|
|
224
|
-
},
|
|
225
|
-
}, children: messagesList === null || messagesList === void 0 ? void 0 : messagesList.map((item, i) => {
|
|
236
|
+
} }), children: messagesList === null || messagesList === void 0 ? void 0 : messagesList.map((item, i) => {
|
|
226
237
|
const { parameters, taskId, updatedAt } = item;
|
|
227
238
|
const isCurrent = taskId === (currentMessageTaskId || undefined);
|
|
228
239
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
@@ -233,21 +244,17 @@ function V0DetailRender() {
|
|
|
233
244
|
}, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { onClick: () => {
|
|
234
245
|
// @ts-ignore
|
|
235
246
|
setCurrentMessageTaskId(item.taskId);
|
|
236
|
-
}, sx: {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
},
|
|
248
|
-
minHeight: sliderWidth / 2,
|
|
249
|
-
maxHeight: '50vh',
|
|
250
|
-
}, children: [(0, jsx_runtime_1.jsx)(CodePreview_1.CodeRenderByMessageMemo, { zoom: 0.25, message: item, sx: {
|
|
247
|
+
}, sx: Object.assign({ cursor: 'pointer', color: 'textColor', borderRadius: 1, border: 1, borderColor: isCurrent ? 'primary.main' : 'background.block', backgroundColor: 'white', position: 'relative', transition: 'all 0.3s', '&:hover': {
|
|
248
|
+
borderColor: 'primary.main',
|
|
249
|
+
} }, (isMobile
|
|
250
|
+
? {
|
|
251
|
+
width: sliderWidth / 2,
|
|
252
|
+
height: sliderWidth / 2,
|
|
253
|
+
}
|
|
254
|
+
: {
|
|
255
|
+
minHeight: sliderWidth / 2,
|
|
256
|
+
maxHeight: '50vh',
|
|
257
|
+
})), children: [(0, jsx_runtime_1.jsx)(CodePreview_1.CodeRenderByMessageMemo, { zoom: 0.25, message: item, sx: {
|
|
251
258
|
pointerEvents: 'none',
|
|
252
259
|
}, propertiesValueMap: propertiesValueMap }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { placement: "right", arrow: true, PopperProps: {
|
|
253
260
|
// disablePortal: true,
|
|
@@ -276,11 +283,11 @@ function V0DetailRender() {
|
|
|
276
283
|
color: isCurrent ? 'primary.main' : 'textColor',
|
|
277
284
|
borderRadius: 1,
|
|
278
285
|
} }) }, taskId)] }, taskId) }, taskId));
|
|
279
|
-
}) })] }, "slider"), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
286
|
+
}) }))] }, "slider"), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
280
287
|
borderRadius: 1,
|
|
281
288
|
backgroundColor: 'background.block',
|
|
282
289
|
flex: 1,
|
|
283
|
-
maxWidth: `calc(100% - ${sliderWidth}px - 16px)`,
|
|
290
|
+
maxWidth: isMobile ? '100%' : `calc(100% - ${sliderWidth}px - 16px)`,
|
|
284
291
|
}, children: (0, jsx_runtime_1.jsx)(AgentOutputRender, { message: currentMessage }) })] }));
|
|
285
292
|
}
|
|
286
293
|
function AgentInputRender(_a) {
|
|
@@ -79,11 +79,11 @@ function CodeRenderByMessage({ zoom, message, minHeight = 200, sx, propertiesVal
|
|
|
79
79
|
} }) }));
|
|
80
80
|
}
|
|
81
81
|
return (_d = (_c = message === null || message === void 0 ? void 0 : message.result) === null || _c === void 0 ? void 0 : _c.objects) === null || _d === void 0 ? void 0 : _d.map((item) => {
|
|
82
|
-
var _a, _b;
|
|
82
|
+
var _a, _b, _c;
|
|
83
83
|
const { taskId } = item;
|
|
84
84
|
// @ts-ignore
|
|
85
85
|
const code = (_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a[codeField];
|
|
86
|
-
return ((0, jsx_runtime_1.jsx)(exports.CodePreviewMemo, { componentId: `code-preview-${taskId}`, code: code, propertiesValue: (_b = propertiesValueMap === null || propertiesValueMap === void 0 ? void 0 : propertiesValueMap[taskId]) === null || _b === void 0 ? void 0 : _b[locale] }, item.taskId));
|
|
86
|
+
return ((0, jsx_runtime_1.jsx)(exports.CodePreviewMemo, { componentId: `code-preview-${taskId}`, code: code, propertiesValue: ((_b = propertiesValueMap === null || propertiesValueMap === void 0 ? void 0 : propertiesValueMap[taskId]) === null || _b === void 0 ? void 0 : _b[locale]) || ((_c = propertiesValueMap === null || propertiesValueMap === void 0 ? void 0 : propertiesValueMap[taskId]) === null || _c === void 0 ? void 0 : _c.en) || {} }, item.taskId));
|
|
87
87
|
});
|
|
88
88
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
89
89
|
}, [isMessageLoading, (_a = message === null || message === void 0 ? void 0 : message.result) === null || _a === void 0 ? void 0 : _a.objects, propertiesValueMap, locale]);
|
|
@@ -81,29 +81,31 @@ function AIRunningLoading(props) {
|
|
|
81
81
|
backgroundColor: 'grey.200',
|
|
82
82
|
} }),
|
|
83
83
|
(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", sx: {
|
|
84
|
-
width:
|
|
84
|
+
width: 90,
|
|
85
85
|
height: 50,
|
|
86
86
|
borderRadius: 1,
|
|
87
87
|
backgroundColor: 'grey.200',
|
|
88
88
|
} }),
|
|
89
89
|
(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", sx: {
|
|
90
|
-
width:
|
|
90
|
+
width: 120,
|
|
91
91
|
height: 50,
|
|
92
92
|
borderRadius: 1,
|
|
93
93
|
backgroundColor: 'grey.200',
|
|
94
94
|
} }),
|
|
95
95
|
],
|
|
96
96
|
sx: {
|
|
97
|
-
|
|
97
|
+
px: 2,
|
|
98
|
+
py: 1,
|
|
98
99
|
display: 'flex',
|
|
99
100
|
gap: 1.5,
|
|
100
101
|
justifyContent: 'space-between',
|
|
102
|
+
overflow: 'hidden',
|
|
101
103
|
},
|
|
102
104
|
},
|
|
103
105
|
},
|
|
104
106
|
{
|
|
105
107
|
time: 60,
|
|
106
|
-
width:
|
|
108
|
+
width: 290,
|
|
107
109
|
height: 150,
|
|
108
110
|
extraProps: {
|
|
109
111
|
sx: {
|
|
@@ -112,7 +114,7 @@ function AIRunningLoading(props) {
|
|
|
112
114
|
},
|
|
113
115
|
},
|
|
114
116
|
];
|
|
115
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: Object.assign({ flex: 1, display: 'inline-flex', justifyContent: 'center', alignItems: 'center', backgroundColor: 'white', flexDirection: 'column', gap: 1.5, '@keyframes loading': {
|
|
117
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: Object.assign({ flex: 1, display: 'inline-flex', justifyContent: 'center', alignItems: 'center', backgroundColor: 'white', flexDirection: 'column', gap: 1.5, width: '100%', overflow: 'hidden', '@keyframes loading': {
|
|
116
118
|
'0%': {
|
|
117
119
|
transform: 'translateY(-8px) scaleX(1.3)',
|
|
118
120
|
opacity: 0,
|
|
@@ -19,14 +19,14 @@ function UserQuestion({ question }) {
|
|
|
19
19
|
display: 'flex',
|
|
20
20
|
alignItems: 'center',
|
|
21
21
|
gap: 1,
|
|
22
|
-
}, children: [((_a = authSession === null || authSession === void 0 ? void 0 : authSession.user) === null || _a === void 0 ? void 0 : _a.did) && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
22
|
+
}, children: [((_a = authSession === null || authSession === void 0 ? void 0 : authSession.user) === null || _a === void 0 ? void 0 : _a.did) && ((0, jsx_runtime_1.jsx)(material_1.Box, { className: "user", sx: {
|
|
23
23
|
width: 30,
|
|
24
24
|
height: 30,
|
|
25
|
-
}, children: (0, jsx_runtime_1.jsx)(ux_1.Avatar, { size: 30, did: user === null || user === void 0 ? void 0 : user.did, variant: "circle", shape: "circle", src: user === null || user === void 0 ? void 0 : user.avatar }) })), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
26
|
-
padding: '6px
|
|
25
|
+
}, children: (0, jsx_runtime_1.jsx)(ux_1.Avatar, { size: 30, did: user === null || user === void 0 ? void 0 : user.did, variant: "circle", shape: "circle", src: user === null || user === void 0 ? void 0 : user.avatar }) })), (0, jsx_runtime_1.jsx)(material_1.Box, { className: "question", sx: {
|
|
26
|
+
padding: '6px 12px',
|
|
27
27
|
borderRadius: 1,
|
|
28
28
|
// borderTopLeftRadius: 0,
|
|
29
29
|
backgroundColor: 'grey.200',
|
|
30
|
-
}, children: (0, jsx_runtime_1.jsx)(ClickToCopy_1.default, { locale: locale, unstyled: true, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: Object.assign({ fontWeight: 500, fontSize: 13, maxWidth: 300, color: 'textColor' }, (0, utils_1.getLineClamp)(1)), children: question }) }) })] }));
|
|
30
|
+
}, children: (0, jsx_runtime_1.jsx)(ClickToCopy_1.default, { locale: locale, unstyled: true, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: Object.assign({ fontWeight: 500, fontSize: 13, maxWidth: 300, color: 'textColor', textAlign: 'left' }, (0, utils_1.getLineClamp)(1)), children: question }) }) })] }));
|
|
31
31
|
}
|
|
32
32
|
exports.default = UserQuestion;
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useV0RuntimeContext = exports.V0RuntimeProvider = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const context = (0, react_1.createContext)(undefined);
|
|
7
8
|
let cancelAutoScrollTimer;
|
|
8
9
|
function V0RuntimeProvider({ children }) {
|
|
9
10
|
const [currentMessageTaskId, setCurrentMessageTaskId] = (0, react_1.useState)();
|
|
10
11
|
const [propertiesValueMap, setPropertiesValueMap] = (0, react_1.useState)({});
|
|
12
|
+
const isMobile = (0, material_1.useMediaQuery)((theme) => theme.breakpoints.down('sm'));
|
|
11
13
|
const state = (0, react_1.useMemo)(() => ({
|
|
12
14
|
setCurrentMessageTaskId: (taskId) => {
|
|
13
15
|
setCurrentMessageTaskId(taskId);
|
|
@@ -40,7 +42,8 @@ function V0RuntimeProvider({ children }) {
|
|
|
40
42
|
setPropertiesValueMap: (valueMap) => {
|
|
41
43
|
setPropertiesValueMap(Object.assign(Object.assign({}, propertiesValueMap), valueMap));
|
|
42
44
|
},
|
|
43
|
-
|
|
45
|
+
isMobile,
|
|
46
|
+
}), [setCurrentMessageTaskId, currentMessageTaskId, propertiesValueMap, setPropertiesValueMap, isMobile]);
|
|
44
47
|
return (0, jsx_runtime_1.jsx)(context.Provider, { value: state, children: children });
|
|
45
48
|
}
|
|
46
49
|
exports.V0RuntimeProvider = V0RuntimeProvider;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Icon = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("@iconify/react");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
function Icon(props) {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_1.Icon }, props));
|
|
9
|
+
}
|
|
10
|
+
exports.Icon = Icon;
|
|
11
|
+
exports.default = Icon;
|
|
@@ -42,8 +42,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
42
42
|
}
|
|
43
43
|
return t;
|
|
44
44
|
};
|
|
45
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
|
+
};
|
|
45
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
49
|
exports.transpileAndLoadScript = exports.useComponent = exports.customComponentStates = void 0;
|
|
50
|
+
const set_1 = __importDefault(require("lodash/set"));
|
|
47
51
|
const react_1 = require("react");
|
|
48
52
|
const zustand_1 = require("zustand");
|
|
49
53
|
const immer_1 = require("zustand/middleware/immer");
|
|
@@ -203,6 +207,16 @@ function useTranspileComponent({ componentId, locale, properties, dev: { default
|
|
|
203
207
|
if (typeof (m === null || m === void 0 ? void 0 : m.PROPERTIES_SCHEMA) === 'object' && (m === null || m === void 0 ? void 0 : m.PROPERTIES_SCHEMA.length)) {
|
|
204
208
|
propertiesFromCode = {};
|
|
205
209
|
m.PROPERTIES_SCHEMA.forEach((data, index) => {
|
|
210
|
+
var _a, _b, _c;
|
|
211
|
+
// @ts-ignore
|
|
212
|
+
(_c = (_b = (_a = window === null || window === void 0 ? void 0 : window.blocklet) === null || _a === void 0 ? void 0 : _a.languages) === null || _b === void 0 ? void 0 : _b.forEach) === null || _c === void 0 ? void 0 : _c.call(_b, (item) => {
|
|
213
|
+
var _a, _b;
|
|
214
|
+
const { code: localKey } = item;
|
|
215
|
+
if (!((_a = data === null || data === void 0 ? void 0 : data.locales) === null || _a === void 0 ? void 0 : _a[localKey])) {
|
|
216
|
+
// fallback to en
|
|
217
|
+
(0, set_1.default)(data, `locales.${localKey}`, (_b = data.locales) === null || _b === void 0 ? void 0 : _b.en);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
206
220
|
propertiesFromCode[data.id] = {
|
|
207
221
|
index,
|
|
208
222
|
data,
|