@carto/ps-react-ui 4.14.0 → 4.15.0
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/dist/chat.js +494 -466
- package/dist/chat.js.map +1 -1
- package/dist/components.js +910 -900
- package/dist/components.js.map +1 -1
- package/dist/markdown-DdqANCiN.js +102 -0
- package/dist/markdown-DdqANCiN.js.map +1 -0
- package/dist/markdown-content-Dk2DSgbf.js +10287 -0
- package/dist/markdown-content-Dk2DSgbf.js.map +1 -0
- package/dist/types/chat/bubbles/chat-agent-message-markdown.d.ts +12 -0
- package/dist/types/chat/bubbles/chat-agent-message.d.ts +9 -0
- package/dist/types/chat/bubbles/index.d.ts +1 -0
- package/dist/types/chat/index.d.ts +2 -1
- package/dist/types/chat/types.d.ts +9 -0
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/components/lasso-tool/message.d.ts +7 -0
- package/dist/types/components/lasso-tool/types.d.ts +17 -2
- package/dist/types/widgets-v2/markdown/markdown-content.d.ts +7 -1
- package/dist/widgets-v2/markdown.js +9 -8
- package/dist/widgets-v2/markdown.js.map +1 -1
- package/dist/widgets-v2.js +23 -22
- package/dist/widgets-v2.js.map +1 -1
- package/package.json +3 -2
- package/src/chat/bubbles/chat-agent-message-markdown.test.tsx +38 -0
- package/src/chat/bubbles/chat-agent-message-markdown.tsx +34 -0
- package/src/chat/bubbles/chat-agent-message.test.tsx +12 -0
- package/src/chat/bubbles/chat-agent-message.tsx +21 -1
- package/src/chat/bubbles/index.ts +1 -0
- package/src/chat/index.ts +2 -0
- package/src/chat/types.ts +10 -0
- package/src/components/index.ts +2 -0
- package/src/components/lasso-tool/layer-filters.test.tsx +13 -0
- package/src/components/lasso-tool/layer-filters.tsx +25 -19
- package/src/components/lasso-tool/message.tsx +36 -0
- package/src/components/lasso-tool/types.ts +20 -1
- package/src/widgets-v2/markdown/markdown-content.test.tsx +10 -0
- package/src/widgets-v2/markdown/markdown-content.tsx +9 -0
- package/src/widgets-v2/wrapper/widget-wrapper.tsx +4 -1
- package/dist/markdown-BD1jcknS.js +0 -8326
- package/dist/markdown-BD1jcknS.js.map +0 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { c as l } from "react/compiler-runtime";
|
|
3
|
+
import { u as p } from "./widget-context-DTGO0Yta.js";
|
|
4
|
+
import { v as s } from "./widget-store-registry-_W4Z4xp-.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import "zustand";
|
|
7
|
+
import { Box as c, Typography as d } from "@mui/material";
|
|
8
|
+
import { MarkdownContent as m } from "./markdown-content-Dk2DSgbf.js";
|
|
9
|
+
const a = {
|
|
10
|
+
root: {
|
|
11
|
+
color: "text.primary",
|
|
12
|
+
"& a": {
|
|
13
|
+
color: "primary.main"
|
|
14
|
+
},
|
|
15
|
+
"& code": {
|
|
16
|
+
bgcolor: "action.hover",
|
|
17
|
+
px: 0.5,
|
|
18
|
+
borderRadius: 0.5,
|
|
19
|
+
fontFamily: "monospace",
|
|
20
|
+
fontSize: "0.875em"
|
|
21
|
+
},
|
|
22
|
+
"& pre": {
|
|
23
|
+
bgcolor: "action.hover",
|
|
24
|
+
p: 1.5,
|
|
25
|
+
borderRadius: 1,
|
|
26
|
+
overflowX: "auto"
|
|
27
|
+
},
|
|
28
|
+
"& blockquote": {
|
|
29
|
+
borderLeft: "3px solid",
|
|
30
|
+
borderColor: "divider",
|
|
31
|
+
pl: 1.5,
|
|
32
|
+
ml: 0,
|
|
33
|
+
color: "text.secondary",
|
|
34
|
+
fontStyle: "italic"
|
|
35
|
+
},
|
|
36
|
+
"& ul, & ol": {
|
|
37
|
+
pl: 3,
|
|
38
|
+
my: 1
|
|
39
|
+
},
|
|
40
|
+
"& li": {
|
|
41
|
+
my: 0.25
|
|
42
|
+
},
|
|
43
|
+
"& hr": {
|
|
44
|
+
border: "none",
|
|
45
|
+
borderTop: "1px solid",
|
|
46
|
+
borderColor: "divider",
|
|
47
|
+
my: 1.5
|
|
48
|
+
},
|
|
49
|
+
"& table": {
|
|
50
|
+
borderCollapse: "collapse",
|
|
51
|
+
width: "100%"
|
|
52
|
+
},
|
|
53
|
+
"& th, & td": {
|
|
54
|
+
border: "1px solid",
|
|
55
|
+
borderColor: "divider",
|
|
56
|
+
px: 1,
|
|
57
|
+
py: 0.5,
|
|
58
|
+
textAlign: "left"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
paragraph: {
|
|
62
|
+
my: 1
|
|
63
|
+
},
|
|
64
|
+
heading: {
|
|
65
|
+
mt: 2,
|
|
66
|
+
mb: 1,
|
|
67
|
+
fontWeight: 600
|
|
68
|
+
}
|
|
69
|
+
}, h = {
|
|
70
|
+
h1: (o) => n(o, "h4"),
|
|
71
|
+
h2: (o) => n(o, "h5"),
|
|
72
|
+
h3: (o) => n(o, "h6"),
|
|
73
|
+
h4: (o) => n(o, "subtitle1"),
|
|
74
|
+
h5: (o) => n(o, "subtitle2"),
|
|
75
|
+
h6: (o) => n(o, "subtitle2"),
|
|
76
|
+
p: ({
|
|
77
|
+
children: o
|
|
78
|
+
}) => /* @__PURE__ */ i(d, { variant: "body2", component: "p", sx: a.paragraph, children: o })
|
|
79
|
+
};
|
|
80
|
+
function n(o, t) {
|
|
81
|
+
return /* @__PURE__ */ i(d, { variant: t, component: "div", sx: a.heading, children: o.children });
|
|
82
|
+
}
|
|
83
|
+
function u(o) {
|
|
84
|
+
const t = l(2), {
|
|
85
|
+
content: e
|
|
86
|
+
} = o;
|
|
87
|
+
let r;
|
|
88
|
+
return t[0] !== e ? (r = /* @__PURE__ */ i(c, { sx: a.root, children: /* @__PURE__ */ i(m, { content: e, components: h, allowHtml: !0, allowImages: !0 }) }), t[0] = e, t[1] = r) : r = t[1], r;
|
|
89
|
+
}
|
|
90
|
+
function M() {
|
|
91
|
+
const o = l(2), t = p(), e = s(t, b);
|
|
92
|
+
let r;
|
|
93
|
+
return o[0] !== e ? (r = /* @__PURE__ */ i(u, { content: e }), o[0] = e, o[1] = r) : r = o[1], r;
|
|
94
|
+
}
|
|
95
|
+
function b(o) {
|
|
96
|
+
return o.data?.content ?? "";
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
M,
|
|
100
|
+
u as a
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=markdown-DdqANCiN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-DdqANCiN.js","sources":["../src/widgets-v2/markdown/style.ts","../src/widgets-v2/markdown/markdown-ui.tsx","../src/widgets-v2/markdown/markdown.tsx"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material'\n\nexport const styles = {\n root: {\n color: 'text.primary',\n '& a': { color: 'primary.main' },\n '& code': {\n bgcolor: 'action.hover',\n px: 0.5,\n borderRadius: 0.5,\n fontFamily: 'monospace',\n fontSize: '0.875em',\n },\n '& pre': {\n bgcolor: 'action.hover',\n p: 1.5,\n borderRadius: 1,\n overflowX: 'auto',\n },\n '& blockquote': {\n borderLeft: '3px solid',\n borderColor: 'divider',\n pl: 1.5,\n ml: 0,\n color: 'text.secondary',\n fontStyle: 'italic',\n },\n '& ul, & ol': { pl: 3, my: 1 },\n '& li': { my: 0.25 },\n '& hr': {\n border: 'none',\n borderTop: '1px solid',\n borderColor: 'divider',\n my: 1.5,\n },\n '& table': { borderCollapse: 'collapse', width: '100%' },\n '& th, & td': {\n border: '1px solid',\n borderColor: 'divider',\n px: 1,\n py: 0.5,\n textAlign: 'left',\n },\n },\n paragraph: {\n my: 1,\n },\n heading: {\n mt: 2,\n mb: 1,\n fontWeight: 600,\n },\n} satisfies Record<string, SxProps<Theme>>\n","import { Box, Typography, type TypographyProps } from '@mui/material'\nimport type { Components } from 'react-markdown'\nimport { MarkdownContent } from './markdown-content'\nimport { styles } from './style'\n\nexport interface MarkdownUIProps {\n content: string\n}\n\n/** MUI-styled element mapping for `react-markdown`. */\nconst components: Components = {\n h1: (props) => mdHeading(props, 'h4'),\n h2: (props) => mdHeading(props, 'h5'),\n h3: (props) => mdHeading(props, 'h6'),\n h4: (props) => mdHeading(props, 'subtitle1'),\n h5: (props) => mdHeading(props, 'subtitle2'),\n h6: (props) => mdHeading(props, 'subtitle2'),\n p: ({ children }) => (\n <Typography variant='body2' component='p' sx={styles.paragraph}>\n {children}\n </Typography>\n ),\n}\n\nfunction mdHeading(\n props: { children?: React.ReactNode },\n variant: TypographyProps['variant'],\n) {\n return (\n <Typography variant={variant} component='div' sx={styles.heading}>\n {props.children}\n </Typography>\n )\n}\n\n/**\n * Pure presentational component for the Markdown widget. Delegates the\n * `react-markdown` engine to {@link MarkdownContent} and supplies a\n * document-style MUI element mapping (body2 paragraphs, real heading\n * typography). Opts INTO raw HTML and inline images — the Markdown widget is\n * the one slot in the library where authors can ship rich content. Caption\n * slots like `Note` keep the conservative defaults.\n */\nexport function MarkdownUI({ content }: MarkdownUIProps) {\n return (\n <Box sx={styles.root}>\n <MarkdownContent\n content={content}\n components={components}\n allowHtml\n allowImages\n />\n </Box>\n )\n}\n","import { useWidgetId, useWidget } from '../stores'\nimport { MarkdownUI } from './markdown-ui'\nimport type { MarkdownWidgetData } from './types'\n\n/**\n * Stateful Markdown bridge — reads `data.content` (post-pipeline) from the\n * per-widget store and forwards it to the pure {@link MarkdownUI}. Sits\n * inside `<Widget.Provider>`.\n */\nexport function Markdown() {\n const id = useWidgetId()\n const content = useWidget(id, (s) => {\n const data = s.data as MarkdownWidgetData | undefined\n return data?.content ?? ''\n })\n return <MarkdownUI content={content} />\n}\n"],"names":["styles","root","color","bgcolor","px","borderRadius","fontFamily","fontSize","p","overflowX","borderLeft","borderColor","pl","ml","fontStyle","my","border","borderTop","borderCollapse","width","py","textAlign","paragraph","heading","mt","mb","fontWeight","components","h1","props","mdHeading","h2","h3","h4","h5","h6","children","jsx","Typography","variant","MarkdownUI","t0","$","_c","content","t1","Box","MarkdownContent","Markdown","id","useWidgetId","useWidget","_temp","s","data"],"mappings":";;;;;;;;AAEO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