@blocklet/pages-kit 0.2.320 → 0.2.321
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 +11 -4
- package/lib/cjs/builtin/async/ai-runtime/locales/index.js +4 -0
- 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/ThemeProvider.js +11 -4
- package/lib/esm/builtin/async/ai-runtime/locales/index.js +4 -0
- 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/locales/index.d.ts +4 -0
- 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
|
@@ -14,13 +14,13 @@ export default function UserQuestion({ question }) {
|
|
|
14
14
|
display: 'flex',
|
|
15
15
|
alignItems: 'center',
|
|
16
16
|
gap: 1,
|
|
17
|
-
}, children: [((_a = authSession === null || authSession === void 0 ? void 0 : authSession.user) === null || _a === void 0 ? void 0 : _a.did) && (_jsx(Box, { sx: {
|
|
17
|
+
}, children: [((_a = authSession === null || authSession === void 0 ? void 0 : authSession.user) === null || _a === void 0 ? void 0 : _a.did) && (_jsx(Box, { className: "user", sx: {
|
|
18
18
|
width: 30,
|
|
19
19
|
height: 30,
|
|
20
|
-
}, children: _jsx(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 }) })), _jsx(Box, { sx: {
|
|
21
|
-
padding: '6px
|
|
20
|
+
}, children: _jsx(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 }) })), _jsx(Box, { className: "question", sx: {
|
|
21
|
+
padding: '6px 12px',
|
|
22
22
|
borderRadius: 1,
|
|
23
23
|
// borderTopLeftRadius: 0,
|
|
24
24
|
backgroundColor: 'grey.200',
|
|
25
|
-
}, children: _jsx(ClickToCopy, { locale: locale, unstyled: true, children: _jsx(Typography, { sx: Object.assign({ fontWeight: 500, fontSize: 13, maxWidth: 300, color: 'textColor' }, getLineClamp(1)), children: question }) }) })] }));
|
|
25
|
+
}, children: _jsx(ClickToCopy, { locale: locale, unstyled: true, children: _jsx(Typography, { sx: Object.assign({ fontWeight: 500, fontSize: 13, maxWidth: 300, color: 'textColor', textAlign: 'left' }, getLineClamp(1)), children: question }) }) })] }));
|
|
26
26
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMediaQuery } from '@mui/material';
|
|
2
3
|
import { createContext, useContext, useMemo, useState } from 'react';
|
|
3
4
|
const context = createContext(undefined);
|
|
4
5
|
let cancelAutoScrollTimer;
|
|
5
6
|
export function V0RuntimeProvider({ children }) {
|
|
6
7
|
const [currentMessageTaskId, setCurrentMessageTaskId] = useState();
|
|
7
8
|
const [propertiesValueMap, setPropertiesValueMap] = useState({});
|
|
9
|
+
const isMobile = useMediaQuery((theme) => theme.breakpoints.down('sm'));
|
|
8
10
|
const state = useMemo(() => ({
|
|
9
11
|
setCurrentMessageTaskId: (taskId) => {
|
|
10
12
|
setCurrentMessageTaskId(taskId);
|
|
@@ -37,7 +39,8 @@ export function V0RuntimeProvider({ children }) {
|
|
|
37
39
|
setPropertiesValueMap: (valueMap) => {
|
|
38
40
|
setPropertiesValueMap(Object.assign(Object.assign({}, propertiesValueMap), valueMap));
|
|
39
41
|
},
|
|
40
|
-
|
|
42
|
+
isMobile,
|
|
43
|
+
}), [setCurrentMessageTaskId, currentMessageTaskId, propertiesValueMap, setPropertiesValueMap, isMobile]);
|
|
41
44
|
return _jsx(context.Provider, { value: state, children: children });
|
|
42
45
|
}
|
|
43
46
|
export function useV0RuntimeContext() {
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Icon as IconifyIcon } from '@iconify/react';
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
|
+
export function Icon(props) {
|
|
5
|
+
return _jsx(Box, Object.assign({ component: IconifyIcon }, props));
|
|
6
|
+
}
|
|
7
|
+
export default Icon;
|
|
@@ -18,6 +18,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
|
+
import set from 'lodash/set';
|
|
21
22
|
import { useDeferredValue, useEffect, useRef, useState } from 'react';
|
|
22
23
|
import { create } from 'zustand';
|
|
23
24
|
import { immer } from 'zustand/middleware/immer';
|
|
@@ -175,6 +176,16 @@ function useTranspileComponent({ componentId, locale, properties, dev: { default
|
|
|
175
176
|
if (typeof (m === null || m === void 0 ? void 0 : m.PROPERTIES_SCHEMA) === 'object' && (m === null || m === void 0 ? void 0 : m.PROPERTIES_SCHEMA.length)) {
|
|
176
177
|
propertiesFromCode = {};
|
|
177
178
|
m.PROPERTIES_SCHEMA.forEach((data, index) => {
|
|
179
|
+
var _a, _b, _c;
|
|
180
|
+
// @ts-ignore
|
|
181
|
+
(_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) => {
|
|
182
|
+
var _a, _b;
|
|
183
|
+
const { code: localKey } = item;
|
|
184
|
+
if (!((_a = data === null || data === void 0 ? void 0 : data.locales) === null || _a === void 0 ? void 0 : _a[localKey])) {
|
|
185
|
+
// fallback to en
|
|
186
|
+
set(data, `locales.${localKey}`, (_b = data.locales) === null || _b === void 0 ? void 0 : _b.en);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
178
189
|
propertiesFromCode[data.id] = {
|
|
179
190
|
index,
|
|
180
191
|
data,
|