@pstdio/ui 0.47.0 → 0.48.0-nightly.20261116135425
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/README.md +38 -1
- package/dist/EquationComponent-Z97D8pim.js +63 -0
- package/dist/EquationComponent-Z97D8pim.js.map +1 -0
- package/dist/{MermaidComponent-DShUsYzu.js → MermaidComponent-8xl4vVSb.js} +15 -15
- package/dist/MermaidComponent-8xl4vVSb.js.map +1 -0
- package/dist/TreeViewPlugin-DSH4hyym.js +2368 -0
- package/dist/TreeViewPlugin-DSH4hyym.js.map +1 -0
- package/dist/activity-timeline-CcQuzTTV.js +451 -0
- package/dist/activity-timeline-CcQuzTTV.js.map +1 -0
- package/dist/{apply-theme-preference-B12rKqN-.d.ts → apply-theme-preference-D-v0L_AE.d.ts} +2 -0
- package/dist/attachment-chip-CHS9xVDZ.js +331 -0
- package/dist/attachment-chip-CHS9xVDZ.js.map +1 -0
- package/dist/canvas.js +96 -96
- package/dist/{chart-BUL8MVmQ.js → chart-B1Xo0fQV.js} +11 -11
- package/dist/{chart-BUL8MVmQ.js.map → chart-B1Xo0fQV.js.map} +1 -1
- package/dist/charts.js +71 -71
- package/dist/charts.js.map +1 -1
- package/dist/chat-skeleton.js +20 -20
- package/dist/chat-ui.d.ts +3 -2
- package/dist/chat-ui.js +1691 -1734
- package/dist/chat-ui.js.map +1 -1
- package/dist/collection-page-ByY_SbYH.js +109 -0
- package/dist/collection-page-ByY_SbYH.js.map +1 -0
- package/dist/collection-page-Du7onATW.d.ts +16 -0
- package/dist/collection-view-bar-vKtmm17P.js +2089 -0
- package/dist/collection-view-bar-vKtmm17P.js.map +1 -0
- package/dist/collection-view-fields-B5Ojr0HA.d.ts +45 -0
- package/dist/collection-view.d.ts +2 -1
- package/dist/collection-view.js +42 -42
- package/dist/collection-view.js.map +1 -1
- package/dist/command-form.js +52 -52
- package/dist/command-form.js.map +1 -1
- package/dist/dashboard-renderer.d.ts +53 -0
- package/dist/dashboard-renderer.js +1279 -0
- package/dist/dashboard-renderer.js.map +1 -0
- package/dist/data-table-Cjz1bXUz.js +1988 -0
- package/dist/data-table-Cjz1bXUz.js.map +1 -0
- package/dist/{data-table-stat-chart-content-Bhuo6-I-.js → data-table-stat-chart-content-Bt-FQZWe.js} +33 -32
- package/dist/data-table-stat-chart-content-Bt-FQZWe.js.map +1 -0
- package/dist/data-table.d.ts +5 -184
- package/dist/data-table.js +33 -2011
- package/dist/data-table.js.map +1 -1
- package/dist/dependency-timeline.js +419 -419
- package/dist/dependency-timeline.js.map +1 -1
- package/dist/dialog-accept-shortcut-C-6PS8wx.js +238 -0
- package/dist/dialog-accept-shortcut-C-6PS8wx.js.map +1 -0
- package/dist/{diff-bubble-B5f57DzL.js → diff-bubble-DietCcSc.js} +8 -8
- package/dist/{diff-bubble-B5f57DzL.js.map → diff-bubble-DietCcSc.js.map} +1 -1
- package/dist/{diff-drawer-C2jpz_lo.js → diff-drawer-Bw2dJa9G.js} +227 -227
- package/dist/{diff-drawer-C2jpz_lo.js.map → diff-drawer-Bw2dJa9G.js.map} +1 -1
- package/dist/{diff-editor-BMBk4KXR.js → diff-editor-Cmv1kjQs.js} +6 -6
- package/dist/{diff-editor-BMBk4KXR.js.map → diff-editor-Cmv1kjQs.js.map} +1 -1
- package/dist/diff-viewer-Cd5ZW5oy.js +582 -0
- package/dist/diff-viewer-Cd5ZW5oy.js.map +1 -0
- package/dist/diff.d.ts +2 -0
- package/dist/diff.js +56 -56
- package/dist/diff.js.map +1 -1
- package/dist/{display-sort-control-r0Bekjiq.js → display-sort-control-D6-wIVzA.js} +182 -182
- package/dist/display-sort-control-D6-wIVzA.js.map +1 -0
- package/dist/{document-participants-BCOSU4cs.d.ts → document-participants-DlcDIm0z.d.ts} +3 -1
- package/dist/{drop-indicator-CIAhxOTV.js → drop-indicator-66rhST1K.js} +5 -5
- package/dist/{drop-indicator-CIAhxOTV.js.map → drop-indicator-66rhST1K.js.map} +1 -1
- package/dist/edit-mode-data-table-yzUcZMDi.js +1550 -0
- package/dist/edit-mode-data-table-yzUcZMDi.js.map +1 -0
- package/dist/empty-state-DA0bpVLM.js +37 -0
- package/dist/{empty-state-C1y8bo5I.js.map → empty-state-DA0bpVLM.js.map} +1 -1
- package/dist/host-storage-Cs_ffpHI.js +115 -0
- package/dist/{host-storage-BR1xka3g.js.map → host-storage-Cs_ffpHI.js.map} +1 -1
- package/dist/{index-Bl0e8xU8.d.ts → index-C4YIzNtA.d.ts} +5 -54
- package/dist/{index-ga5IV_D5.d.ts → index-DNaIFsuN.d.ts} +5 -15
- package/dist/{index-GgKLIwLP.d.ts → index-t_lINlvd.d.ts} +1 -1
- package/dist/index.d.ts +26 -8
- package/dist/index.js +2636 -2662
- package/dist/index.js.map +1 -1
- package/dist/kanban-renderer.d.ts +3 -2
- package/dist/kanban-renderer.js +687 -687
- package/dist/kanban-renderer.js.map +1 -1
- package/dist/keyframe-timeline.js +328 -328
- package/dist/keyframe-timeline.js.map +1 -1
- package/dist/{lazy-markdown-editor-DMYoFpcc.d.ts → lazy-markdown-editor-CdSqnZTe.d.ts} +8 -5
- package/dist/lazy-markdown-editor.d.ts +1 -1
- package/dist/lazy-markdown-editor.js +166 -55
- package/dist/lazy-markdown-editor.js.map +1 -1
- package/dist/list-row-reLqS8lN.js +1416 -0
- package/dist/list-row-reLqS8lN.js.map +1 -0
- package/dist/markdown-editor-DkvlJHhv.js +136 -0
- package/dist/markdown-editor-DkvlJHhv.js.map +1 -0
- package/dist/markdown-presence-plugin-BKD9fXsw.js +1890 -0
- package/dist/markdown-presence-plugin-BKD9fXsw.js.map +1 -0
- package/dist/mermaid.js +211 -211
- package/dist/mermaid.js.map +1 -1
- package/dist/{number-input-B5Yj1fNy.js → number-input-plDJZMhO.js} +83 -83
- package/dist/number-input-plDJZMhO.js.map +1 -0
- package/dist/{param-editor-field-DXrRC_jW.js → param-editor-field-3FzTgKqz.js} +996 -996
- package/dist/param-editor-field-3FzTgKqz.js.map +1 -0
- package/dist/{param-editor-label-C0mKLafZ.js → param-editor-label-BqzErdV4.js} +12 -12
- package/dist/{param-editor-label-C0mKLafZ.js.map → param-editor-label-BqzErdV4.js.map} +1 -1
- package/dist/param-editor.js +242 -219
- package/dist/param-editor.js.map +1 -1
- package/dist/popover-header-CNq-hak8.js +86 -0
- package/dist/popover-header-CNq-hak8.js.map +1 -0
- package/dist/{resolve-icon-component-CQ-Nf6-e.js → resolve-icon-component-C--fooDW.js} +2 -2
- package/dist/{resolve-icon-component-CQ-Nf6-e.js.map → resolve-icon-component-C--fooDW.js.map} +1 -1
- package/dist/{index-DS0jqJkR.d.ts → rich-message-DOFmj_Hs.d.ts} +62 -2
- package/dist/rich-message-DmwpjNaQ.js +477 -0
- package/dist/rich-message-DmwpjNaQ.js.map +1 -0
- package/dist/rich-text.d.ts +4 -2
- package/dist/rich-text.js +404 -865
- package/dist/rich-text.js.map +1 -1
- package/dist/{scroll-area-BHnMgUdI.js → scroll-area-COUxxkfk.js} +14 -14
- package/dist/{scroll-area-BHnMgUdI.js.map → scroll-area-COUxxkfk.js.map} +1 -1
- package/dist/send-button-DiktCc_p.js +135 -0
- package/dist/send-button-DiktCc_p.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/terminal.d.ts +1 -1
- package/dist/terminal.js +31 -31
- package/dist/{theme-CYP_q726.js → theme-XmyuJ-K6.js} +606 -312
- package/dist/theme-XmyuJ-K6.js.map +1 -0
- package/dist/{theme-preference-Du2MzhvY.js → theme-preference-hN_UQk_U.js} +54 -54
- package/dist/theme-preference-hN_UQk_U.js.map +1 -0
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +1 -1
- package/dist/tooltip-CllSsbFk.js +183 -0
- package/dist/{tooltip-D17siZKU.js.map → tooltip-CllSsbFk.js.map} +1 -1
- package/dist/{tree-list-CosvDPpE.js → tree-list-BhA5aNBf.js} +578 -569
- package/dist/tree-list-BhA5aNBf.js.map +1 -0
- package/dist/tree-list-reveal-DF7uJR3P.js +28 -0
- package/dist/tree-list-reveal-DF7uJR3P.js.map +1 -0
- package/dist/{collection-view-fields-D6YMyPNm.d.ts → types-Cso5DsRn.d.ts} +2 -43
- package/dist/types-D3gLtohy.d.ts +187 -0
- package/dist/ui-scope-BkCOxHgh.js +62 -0
- package/dist/ui-scope-BkCOxHgh.js.map +1 -0
- package/package.json +7 -2
- package/dist/EquationComponent-BtOgXA3g.js +0 -63
- package/dist/EquationComponent-BtOgXA3g.js.map +0 -1
- package/dist/MermaidComponent-DShUsYzu.js.map +0 -1
- package/dist/activity-timeline-CIIjPU3x.js +0 -349
- package/dist/activity-timeline-CIIjPU3x.js.map +0 -1
- package/dist/collection-page-V_oXHgvV.js +0 -109
- package/dist/collection-page-V_oXHgvV.js.map +0 -1
- package/dist/collection-view-search-Bmo7i7VP.js +0 -2086
- package/dist/collection-view-search-Bmo7i7VP.js.map +0 -1
- package/dist/data-table-stat-chart-content-Bhuo6-I-.js.map +0 -1
- package/dist/diff-viewer-D8sdwDCm.js +0 -570
- package/dist/diff-viewer-D8sdwDCm.js.map +0 -1
- package/dist/display-sort-control-r0Bekjiq.js.map +0 -1
- package/dist/edit-mode-data-table-CuyOb00_.js +0 -1548
- package/dist/edit-mode-data-table-CuyOb00_.js.map +0 -1
- package/dist/empty-state-C1y8bo5I.js +0 -37
- package/dist/host-storage-BR1xka3g.js +0 -115
- package/dist/markdown-editor-C-JLbsiT.js +0 -134
- package/dist/markdown-editor-C-JLbsiT.js.map +0 -1
- package/dist/markdown-presence-plugin-BVLbEQwH.js +0 -4240
- package/dist/markdown-presence-plugin-BVLbEQwH.js.map +0 -1
- package/dist/number-input-B5Yj1fNy.js.map +0 -1
- package/dist/param-editor-field-DXrRC_jW.js.map +0 -1
- package/dist/prism-DlytVLYv.js +0 -107
- package/dist/prism-DlytVLYv.js.map +0 -1
- package/dist/radio-BW2YfNhe.js +0 -53
- package/dist/radio-BW2YfNhe.js.map +0 -1
- package/dist/resource-context-menu-Bm49Ijfc.js +0 -1418
- package/dist/resource-context-menu-Bm49Ijfc.js.map +0 -1
- package/dist/switch-C2TYNXl1.js +0 -331
- package/dist/switch-C2TYNXl1.js.map +0 -1
- package/dist/theme-CYP_q726.js.map +0 -1
- package/dist/theme-preference-Du2MzhvY.js.map +0 -1
- package/dist/tooltip-D17siZKU.js +0 -183
- package/dist/tree-list-CosvDPpE.js.map +0 -1
- package/dist/tree-list-reveal-DxyLxB6n.js +0 -24
- package/dist/tree-list-reveal-DxyLxB6n.js.map +0 -1
- package/dist/ui-scope-Dgo4QJEg.js +0 -51
- package/dist/ui-scope-Dgo4QJEg.js.map +0 -1
- package/dist/workspace-badge-BNWaBxft.js +0 -238
- package/dist/workspace-badge-BNWaBxft.js.map +0 -1
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ See [Canvas coverage](../../documentation/guides/development/0003-canvas-coverag
|
|
|
29
29
|
The root entry holds the light, widely reused components. A feature that pulls a
|
|
30
30
|
heavy dependency, such as the Lexical editor, Monaco, Mermaid, or the terminal,
|
|
31
31
|
gets its own entry: `./rich-text`, `./param-editor`, `./kanban-renderer`,
|
|
32
|
-
`./data-table`, `./charts`, `./chat-ui`, `./diff`, `./mermaid`, `./terminal`. Nothing reachable
|
|
32
|
+
`./data-table`, `./charts`, `./dashboard-renderer`, `./chat-ui`, `./diff`, `./mermaid`, `./terminal`. Nothing reachable
|
|
33
33
|
from the root entry may import one of those, or every consumer's bundler emits the
|
|
34
34
|
heavy chunks even when the consumer never renders the feature.
|
|
35
35
|
|
|
@@ -135,3 +135,40 @@ See **Components/Media/Keyframe Timeline** for Animation, ReadOnly, Empty, and L
|
|
|
135
135
|
## Charts
|
|
136
136
|
|
|
137
137
|
Use the themed TanStack components from `@pstdio/ui/charts`. See the [chart guide](src/components/charts/README.md) for sizing, palettes, tooltips, and Gantt dependencies.
|
|
138
|
+
|
|
139
|
+
## Dashboard renderer
|
|
140
|
+
|
|
141
|
+
Import `DashboardRenderer`, `DashboardDefinition`, and `DashboardDataSource` from
|
|
142
|
+
`@pstdio/ui/dashboard-renderer`. Render inside the usual `ChakraProvider` with
|
|
143
|
+
`psTheme`, in a parent with a bounded height. The renderer fills that parent and
|
|
144
|
+
keeps its toolbar above the scrolling widgets.
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
const [value, setValue] = useState<DashboardDefinition>({
|
|
148
|
+
mode: "vertical",
|
|
149
|
+
widgets: [{ id: "orders", title: "Orders", kind: "metric", source: "sales",
|
|
150
|
+
layout: { x: 0, y: 0, w: 4, h: 3 } }],
|
|
151
|
+
});
|
|
152
|
+
const sources: DashboardDataSource[] = [{
|
|
153
|
+
id: "sales", name: "Sales", metric: { value: 1240, description: "+12% this week" },
|
|
154
|
+
series: [{ label: "Monday", value: 120 }, { label: "Tuesday", value: 140 }],
|
|
155
|
+
table: { data: [{ Day: "Monday", Orders: 120 }], columnTypes: { Orders: "number" } },
|
|
156
|
+
}];
|
|
157
|
+
return <DashboardRenderer title="Sales" value={value} sources={sources} onChange={setValue} />;
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Sources provide metric values, labeled numeric series, and/or read-only table data.
|
|
161
|
+
Grouped bars stack points by `label` and `group`. Source IDs are application-owned
|
|
162
|
+
strings. Updating sources refreshes content without discarding layout edits. Pass
|
|
163
|
+
filters or refresh controls in `actions`; fetching and errors belong to the caller.
|
|
164
|
+
|
|
165
|
+
Omit `onChange` for read-only use. With it, Edit dashboard opens a draft; Apply emits
|
|
166
|
+
the complete definition and Cancel emits nothing. The caller owns the saved value,
|
|
167
|
+
persistence, permissions, and undo. An async `onChange` can reject to retain the
|
|
168
|
+
draft and display its error with Retry. Use stable unique widget IDs. Titles may
|
|
169
|
+
be empty. Layout coordinates use a 12-column grid with widths from 3 to 12 and
|
|
170
|
+
heights of at least 3 rows. Narrow presentation preserves those saved widths.
|
|
171
|
+
Modes are `vertical` (Compact up), `horizontal` (Compact left), and `free`.
|
|
172
|
+
|
|
173
|
+
See **Design system/Components/Data display/Dashboard**, frame **Editable dashboard**. It replaces
|
|
174
|
+
the PS-1177 proposal frame and retains its `Dashboard` export and frame ID.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Component as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
+
import { c as i } from "react/compiler-runtime";
|
|
3
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
4
|
+
import c from "katex";
|
|
5
|
+
import { useLexicalComposerContext as l } from "@lexical/react/LexicalComposerContext";
|
|
6
|
+
import "katex/dist/katex.css";
|
|
7
|
+
// src/components/rich-text/shared/plugins/EquationPlugin/KatexRenderer.tsx
|
|
8
|
+
function u(e) {
|
|
9
|
+
let r = i(5), { equation: l, inline: u } = e, d = n(null), f, p;
|
|
10
|
+
r[0] !== l || r[1] !== u ? (f = () => {
|
|
11
|
+
let e = d.current;
|
|
12
|
+
e !== null && c.render(l, e, {
|
|
13
|
+
displayMode: !u,
|
|
14
|
+
errorColor: "#cc0000",
|
|
15
|
+
output: "html",
|
|
16
|
+
strict: "warn",
|
|
17
|
+
throwOnError: !1,
|
|
18
|
+
trust: !1
|
|
19
|
+
});
|
|
20
|
+
}, p = [l, u], r[0] = l, r[1] = u, r[2] = f, r[3] = p) : (f = r[2], p = r[3]), t(f, p);
|
|
21
|
+
let m;
|
|
22
|
+
return r[4] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ s(a, { children: [
|
|
23
|
+
/* @__PURE__ */ o("img", {
|
|
24
|
+
src: "#",
|
|
25
|
+
alt: ""
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ o("span", { ref: d }),
|
|
28
|
+
/* @__PURE__ */ o("img", {
|
|
29
|
+
src: "#",
|
|
30
|
+
alt: ""
|
|
31
|
+
})
|
|
32
|
+
] }), r[4] = m) : m = r[4], m;
|
|
33
|
+
}
|
|
34
|
+
// src/components/rich-text/shared/plugins/EquationPlugin/EquationComponent.tsx
|
|
35
|
+
var d = class extends e {
|
|
36
|
+
state = { hasError: !1 };
|
|
37
|
+
static getDerivedStateFromError() {
|
|
38
|
+
return { hasError: !0 };
|
|
39
|
+
}
|
|
40
|
+
componentDidCatch(e) {
|
|
41
|
+
this.props.onError(e);
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
return this.state.hasError ? null : this.props.children;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
function f(e) {
|
|
48
|
+
let t = i(8), { equation: n, inline: a } = e, [s] = l(), [c] = r(n), f;
|
|
49
|
+
t[0] === s ? f = t[1] : (f = (e) => s._onError(e), t[0] = s, t[1] = f);
|
|
50
|
+
let p;
|
|
51
|
+
t[2] !== c || t[3] !== a ? (p = /* @__PURE__ */ o(u, {
|
|
52
|
+
equation: c,
|
|
53
|
+
inline: a
|
|
54
|
+
}), t[2] = c, t[3] = a, t[4] = p) : p = t[4];
|
|
55
|
+
let m;
|
|
56
|
+
return t[5] !== f || t[6] !== p ? (m = /* @__PURE__ */ o(d, {
|
|
57
|
+
onError: f,
|
|
58
|
+
children: p
|
|
59
|
+
}), t[5] = f, t[6] = p, t[7] = m) : m = t[7], m;
|
|
60
|
+
}
|
|
61
|
+
export { f as default };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=EquationComponent-Z97D8pim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EquationComponent-Z97D8pim.js","names":["katex","useEffect","useRef","KatexRenderer","t0","$","_c","equation","inline","katexElementRef","t1","t2","katexElement","current","render","displayMode","errorColor","output","strict","throwOnError","trust","t3","Symbol","for","_c","_Fragment","useLexicalComposerContext","ReactNode","Component","useState","KatexRenderer","EquationComponentProps","equation","inline","EditorErrorBoundaryProps","children","onError","error","Error","EditorErrorBoundaryState","hasError","EditorErrorBoundary","state","getDerivedStateFromError","componentDidCatch","props","render","EquationComponent","t0","$","_c","editor","equationValue","t1","e","_onError","t2","t3","_c","Fragment$1","katex","KatexRenderer","$","c","t0","katexElementRef","useRef","t1","t2","equation","inline","katexElement","useEffect","t3","EditorErrorBoundary","Component","error","EquationComponent","editor","useLexicalComposerContext","equationValue","useState"],"sources":["../src/components/rich-text/shared/plugins/EquationPlugin/KatexRenderer.tsx","../src/components/rich-text/shared/plugins/EquationPlugin/EquationComponent.tsx"],"sourcesContent":["import \"katex/dist/katex.css\";\n\nimport katex from \"katex\";\nimport { useEffect, useRef } from \"react\";\n\nexport default function KatexRenderer({\n equation,\n inline,\n}: Readonly<{\n equation: string;\n inline: boolean;\n}>) {\n const katexElementRef = useRef(null);\n\n useEffect(() => {\n const katexElement = katexElementRef.current;\n\n if (katexElement !== null) {\n katex.render(equation, katexElement, {\n displayMode: !inline, // true === block display //\n errorColor: \"#cc0000\",\n output: \"html\",\n strict: \"warn\",\n throwOnError: false,\n trust: false,\n });\n }\n }, [equation, inline]);\n\n return (\n // We use an empty image tag either side to ensure Android doesn't try and compose from the\n // inner text from Katex. There didn't seem to be any other way of making this work,\n // without having a physical space.\n <>\n <img src=\"#\" alt=\"\" />\n <span ref={katexElementRef} />\n <img src=\"#\" alt=\"\" />\n </>\n );\n}\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport type { ReactNode } from \"react\";\nimport { Component, useState } from \"react\";\n\nimport KatexRenderer from \"./KatexRenderer\";\n\ntype EquationComponentProps = {\n equation: string;\n inline: boolean;\n};\n\ninterface EditorErrorBoundaryProps {\n children: ReactNode;\n onError: (error: Error) => void;\n}\n\ninterface EditorErrorBoundaryState {\n hasError: boolean;\n}\n\nclass EditorErrorBoundary extends Component<EditorErrorBoundaryProps, EditorErrorBoundaryState> {\n state = { hasError: false };\n\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(error: Error) {\n this.props.onError(error);\n }\n\n render() {\n if (this.state.hasError) return null;\n return this.props.children;\n }\n}\n\nexport default function EquationComponent({ equation, inline }: EquationComponentProps) {\n const [editor] = useLexicalComposerContext();\n const [equationValue, _setEquationValue] = useState(equation);\n return (\n <EditorErrorBoundary onError={(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MF,WAAiB,OACzB,KAAKK,MAAMV;CACpB;AACF;AAEA,SAAeY,EAAAC,GAAA;CAAA,IAAAC,IAAAC,EAAA,CAAA,GAA2B,EAAAlB,aAAAC,cAAAe,GACxC,CAAAG,KAAiBzB,EAA0B,GAC3C,CAAA0B,KAA2CvB,EAASG,CAAQ,GAAEqB;CAAA,AAAAJ,EAAA,OAAAE,IAELE,IAAAJ,EAAA,MAAzBI,KAAAC,MAAOH,EAAMI,SAAUD,CAAC,GAACL,EAAA,KAAAE,GAAAF,EAAA,KAAAI;CAAA,IAAAG;CAAA,AAAAP,EAAA,OAAAG,KAAAH,EAAA,OAAAhB,KACrDuB,IAAA,kBAACK,GAAD;EAAyBT,UAAAA;EAAuBnB;CAAM,CAAA,GAAIgB,EAAA,KAAAG,GAAAH,EAAA,KAAAhB,GAAAgB,EAAA,KAAAO,KAAAA,IAAAP,EAAA;CAAA,IAAAQ;CACtC,OADsCR,EAAA,OAAAI,KAAAJ,EAAA,OAAAO,KAD5DC,IAAA,kBAACiB,GAAD;EAA8B,SAAArB;EAC5BG,UAAAA;CADkB,CAAA,GAEEP,EAAA,KAAAI,GAAAJ,EAAA,KAAAO,GAAAP,EAAA,KAAAQ,KAAAA,IAAAR,EAAA,IAFtBQ;AAEsB"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as e } from "./TreeViewPlugin-DSH4hyym.js";
|
|
2
2
|
import { MermaidRenderer as t } from "./mermaid.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { Box as n, Button as r, Flex as i, Textarea as a } from "@chakra-ui/react";
|
|
4
|
+
import { useEffect as o, useState as s } from "react";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
6
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
7
|
import { $getNodeByKey as d } from "lexical";
|
|
8
8
|
import { useLexicalComposerContext as f } from "@lexical/react/LexicalComposerContext";
|
|
9
9
|
import { useLexicalEditable as p } from "@lexical/react/useLexicalEditable";
|
|
10
10
|
// src/components/rich-text/shared/plugins/MermaidPlugin/MermaidComponent.tsx
|
|
11
11
|
function m(m) {
|
|
12
|
-
let h =
|
|
12
|
+
let h = c(28), { code: g, nodeKey: _ } = m, [v] = f(), y = p(), [b, x] = s(!1), [S, C] = s(g), [w, T] = s(g), E, D;
|
|
13
13
|
h[0] === g ? (E = h[1], D = h[2]) : (E = () => {
|
|
14
14
|
C(g), T(g);
|
|
15
|
-
}, D = [g], h[0] = g, h[1] = E, h[2] = D),
|
|
15
|
+
}, D = [g], h[0] = g, h[1] = E, h[2] = D), o(E, D);
|
|
16
16
|
let O;
|
|
17
17
|
h[3] !== S || h[4] !== v || h[5] !== _ ? (O = () => {
|
|
18
18
|
v.update(() => {
|
|
@@ -29,27 +29,27 @@ function m(m) {
|
|
|
29
29
|
let e;
|
|
30
30
|
h[9] === y ? e = h[10] : (e = y ? () => x(!0) : void 0, h[9] = y, h[10] = e);
|
|
31
31
|
let n;
|
|
32
|
-
return h[11] !== y || h[12] !== w || h[13] !== e ? (n = /* @__PURE__ */
|
|
32
|
+
return h[11] !== y || h[12] !== w || h[13] !== e ? (n = /* @__PURE__ */ l(t, {
|
|
33
33
|
code: w,
|
|
34
34
|
isEditable: y,
|
|
35
35
|
onRequestEdit: e
|
|
36
36
|
}, w), h[11] = y, h[12] = w, h[13] = e, h[14] = n) : n = h[14], n;
|
|
37
37
|
}
|
|
38
38
|
let M;
|
|
39
|
-
h[15] === j ? M = h[16] : (M = /* @__PURE__ */
|
|
39
|
+
h[15] === j ? M = h[16] : (M = /* @__PURE__ */ l(r, {
|
|
40
40
|
size: "xs",
|
|
41
41
|
variant: "subtle",
|
|
42
42
|
onClick: j,
|
|
43
43
|
children: "Cancel"
|
|
44
44
|
}), h[15] = j, h[16] = M);
|
|
45
45
|
let N;
|
|
46
|
-
h[17] === k ? N = h[18] : (N = /* @__PURE__ */
|
|
46
|
+
h[17] === k ? N = h[18] : (N = /* @__PURE__ */ l(r, {
|
|
47
47
|
size: "xs",
|
|
48
48
|
onClick: k,
|
|
49
49
|
children: "Preview"
|
|
50
50
|
}), h[17] = k, h[18] = N);
|
|
51
51
|
let P;
|
|
52
|
-
h[19] !== M || h[20] !== N ? (P = /* @__PURE__ */
|
|
52
|
+
h[19] !== M || h[20] !== N ? (P = /* @__PURE__ */ u(i, {
|
|
53
53
|
justifyContent: "flex-end",
|
|
54
54
|
alignItems: "center",
|
|
55
55
|
gap: "xs",
|
|
@@ -61,10 +61,10 @@ function m(m) {
|
|
|
61
61
|
let F;
|
|
62
62
|
h[22] === Symbol.for("react.memo_cache_sentinel") ? (F = (e) => C(e.target.value), h[22] = F) : F = h[22];
|
|
63
63
|
let I;
|
|
64
|
-
h[23] === S ? I = h[24] : (I = /* @__PURE__ */
|
|
64
|
+
h[23] === S ? I = h[24] : (I = /* @__PURE__ */ l(n, {
|
|
65
65
|
padding: "sm",
|
|
66
66
|
bg: "bg.muted",
|
|
67
|
-
children: /* @__PURE__ */
|
|
67
|
+
children: /* @__PURE__ */ l(a, {
|
|
68
68
|
value: S,
|
|
69
69
|
onChange: F,
|
|
70
70
|
minHeight: "180px",
|
|
@@ -75,7 +75,7 @@ function m(m) {
|
|
|
75
75
|
})
|
|
76
76
|
}), h[23] = S, h[24] = I);
|
|
77
77
|
let L;
|
|
78
|
-
return h[25] !== P || h[26] !== I ? (L = /* @__PURE__ */
|
|
78
|
+
return h[25] !== P || h[26] !== I ? (L = /* @__PURE__ */ u(n, {
|
|
79
79
|
borderWidth: "1px",
|
|
80
80
|
borderColor: "border.subtle",
|
|
81
81
|
borderRadius: "md",
|
|
@@ -86,4 +86,4 @@ function m(m) {
|
|
|
86
86
|
}
|
|
87
87
|
export { m as default };
|
|
88
88
|
|
|
89
|
-
//# sourceMappingURL=MermaidComponent-
|
|
89
|
+
//# sourceMappingURL=MermaidComponent-8xl4vVSb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MermaidComponent-8xl4vVSb.js","names":["Box","Button","Flex","Textarea","useLexicalComposerContext","useLexicalEditable","$getNodeByKey","useEffect","useState","MermaidRenderer","$isMermaidNode","MermaidComponentProps","code","nodeKey","MermaidComponent","props","$","_c","editor","isEditable","isEditing","setIsEditing","draftCode","setDraftCode","previewCode","setPreviewCode","t0","t1","t2","update","node","setCode","commitCodeChanges","t3","cancelEditing","t4","undefined","t5","t6","t7","Symbol","for","event","target","value","t8","t9","_c","$isMermaidNode","MermaidComponent","$","props","editor","useLexicalComposerContext","isEditable","useLexicalEditable","isEditing","setIsEditing","useState","draftCode","setDraftCode","code","previewCode","setPreviewCode","t0","t1","useEffect","t2","nodeKey","node","$getNodeByKey","commitCodeChanges","t3","cancelEditing","t4","t5","MermaidRenderer","Button","t6","Flex","t7","event","t8","Box","Textarea","t9"],"sources":["../src/components/rich-text/shared/plugins/MermaidPlugin/MermaidComponent.tsx"],"sourcesContent":["import { Box, Button, Flex, Textarea } from \"@chakra-ui/react\";\nimport { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { useLexicalEditable } from \"@lexical/react/useLexicalEditable\";\nimport { $getNodeByKey } from \"lexical\";\nimport { useEffect, useState } from \"react\";\nimport { MermaidRenderer } from \"@/components/mermaid-renderer\";\nimport { $isMermaidNode } from \"./MermaidNode\";\n\ninterface MermaidComponentProps {\n code: string;\n nodeKey: string;\n}\n\nexport default function MermaidComponent(props: MermaidComponentProps) {\n const { code, nodeKey } = props;\n const [editor] = useLexicalComposerContext();\n const isEditable = useLexicalEditable();\n const [isEditing, setIsEditing] = useState(false);\n const [draftCode, setDraftCode] = useState(code);\n const [previewCode, setPreviewCode] = useState(code);\n\n useEffect(() => {\n setDraftCode(code);\n setPreviewCode(code);\n }, [code]);\n\n const commitCodeChanges = () => {\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if ($isMermaidNode(node)) {\n node.setCode(draftCode);\n }\n });\n\n setPreviewCode(draftCode);\n setIsEditing(false);\n };\n\n const cancelEditing = () => {\n setDraftCode(previewCode);\n setIsEditing(false);\n };\n\n if (!isEditing) {\n return (\n <MermaidRenderer\n key={previewCode}\n code={previewCode}\n isEditable={isEditable}\n onRequestEdit={isEditable ? () => setIsEditing(true) : undefined}\n />\n );\n }\n\n return (\n <Box borderWidth=\"1px\" borderColor=\"border.subtle\" borderRadius=\"md\" overflow=\"hidden\" width=\"100%\">\n <Flex justifyContent=\"flex-end\" alignItems=\"center\" gap=\"xs\" paddingX=\"sm\" paddingY=\"xs\" bg=\"bg.muted\">\n <Button size=\"xs\" variant=\"subtle\" onClick={cancelEditing}>\n Cancel\n </Button>\n <Button size=\"xs\" onClick={commitCodeChanges}>\n Preview\n </Button>\n </Flex>\n <Box padding=\"sm\" bg=\"bg.muted\">\n <Textarea\n value={draftCode}\n onChange={(event) => setDraftCode(event.target.value)}\n minHeight=\"180px\"\n resize=\"vertical\"\n fontFamily=\"mono\"\n fontSize=\"sm\"\n spellCheck={false}\n />\n </Box>\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;;AAaA,SAAec,EAAAC,GAAA;CAAA,IAAAC,IAAAC,EAAA,EAAA,GACb,EAAAL,SAAAC,eAA0BE,GAC1B,CAAAG,KAAiBd,EAA0B,GAC3Ce,IAAmBd,EAAmB,GACtC,CAAAe,GAAAC,KAAkCb,EAAS,EAAK,GAChD,CAAAc,GAAAC,KAAkCf,EAASI,CAAI,GAC/C,CAAAY,GAAAC,KAAsCjB,EAASI,CAAI,GAAEc,GAAAC;CAErDpB,AAFqDS,EAAA,OAAAJ,KAK5Cc,IAAAV,EAAA,IAAAW,IAAAX,EAAA,OAHCU,UAAA;EAERD,AADAF,EAAaX,CAAI,GACjBa,EAAeb,CAAI;CAAC,GACnBe,IAAA,CAACf,CAAI,GAACI,EAAA,KAAAJ,GAAAI,EAAA,KAAAU,GAAAV,EAAA,KAAAW,IAHTpB,EAAUmB,GAGPC,CAAM;CAAC,IAAAC;CAA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