@pstdio/ui 0.0.1
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/.storybook/main.ts +28 -0
- package/.storybook/preview.tsx +28 -0
- package/.storybook/vitest.setup.ts +6 -0
- package/README.md +72 -0
- package/package.json +91 -0
- package/src/components/alert.tsx +27 -0
- package/src/components/breadcrumb.stories.tsx +40 -0
- package/src/components/breadcrumb.tsx +67 -0
- package/src/components/button.stories.tsx +151 -0
- package/src/components/chat-ui/agent-types.ts +231 -0
- package/src/components/chat-ui/components/ai-conversation.stories.tsx +49 -0
- package/src/components/chat-ui/components/ai-conversation.tsx +68 -0
- package/src/components/chat-ui/components/ai-message.stories.tsx +60 -0
- package/src/components/chat-ui/components/ai-message.tsx +103 -0
- package/src/components/chat-ui/components/ai-response.stories.tsx +48 -0
- package/src/components/chat-ui/components/ai-response.tsx +19 -0
- package/src/components/chat-ui/components/approval-prompt.tsx +51 -0
- package/src/components/chat-ui/components/attachment-list.stories.tsx +24 -0
- package/src/components/chat-ui/components/attachment-list.tsx +76 -0
- package/src/components/chat-ui/components/auto-scroll.tsx +42 -0
- package/src/components/chat-ui/components/chat-input.stories.tsx +114 -0
- package/src/components/chat-ui/components/chat-input.tsx +142 -0
- package/src/components/chat-ui/components/chat-panel.stories.tsx +396 -0
- package/src/components/chat-ui/components/chat-panel.tsx +97 -0
- package/src/components/chat-ui/components/message-parts-renderer.stories.tsx +59 -0
- package/src/components/chat-ui/components/message-parts-renderer.tsx +133 -0
- package/src/components/chat-ui/components/message-types.ts +40 -0
- package/src/components/chat-ui/components/model-swap-separator.stories.tsx +27 -0
- package/src/components/chat-ui/components/model-swap-separator.tsx +20 -0
- package/src/components/chat-ui/components/send-button.tsx +56 -0
- package/src/components/chat-ui/components/timeline.tsx +414 -0
- package/src/components/chat-ui/components/tool-invocation-timeline.stories.tsx +32 -0
- package/src/components/chat-ui/components/tool-invocation-timeline.tsx +16 -0
- package/src/components/chat-ui/mocks/full-conversation-normalized.json +3557 -0
- package/src/components/chat-ui/tool-rendering/build-timeline.ts +127 -0
- package/src/components/chat-ui/tool-rendering/default-renderers.ts +420 -0
- package/src/components/chat-ui/tool-rendering/index.ts +3 -0
- package/src/components/chat-ui/tool-rendering/types.ts +19 -0
- package/src/components/chat-ui/utils/diff.ts +228 -0
- package/src/components/chat-ui/utils/editor-state.ts +5 -0
- package/src/components/chat-ui/utils/get-icon.ts +81 -0
- package/src/components/code-editor.tsx +147 -0
- package/src/components/column-file-browser.stories.tsx +217 -0
- package/src/components/column-file-browser.tsx +380 -0
- package/src/components/content-placeholder.tsx +21 -0
- package/src/components/data-table/build-columns.tsx +78 -0
- package/src/components/data-table/data-table.css +51 -0
- package/src/components/data-table/data-table.stories.tsx +209 -0
- package/src/components/data-table/data-table.tsx +232 -0
- package/src/components/data-table/helpers.tsx +69 -0
- package/src/components/data-table/index.ts +3 -0
- package/src/components/data-table/pagination-footer.tsx +58 -0
- package/src/components/data-table/selection-toolbar.tsx +26 -0
- package/src/components/data-table/types.ts +21 -0
- package/src/components/delete-confirmation-modal.stories.tsx +46 -0
- package/src/components/delete-confirmation-modal.tsx +56 -0
- package/src/components/diff-bubble.stories.tsx +70 -0
- package/src/components/diff-bubble.tsx +70 -0
- package/src/components/diff-card.tsx +139 -0
- package/src/components/diff-drawer.stories.tsx +106 -0
- package/src/components/diff-drawer.tsx +59 -0
- package/src/components/diff-editor.tsx +55 -0
- package/src/components/drawer-inline.stories.tsx +124 -0
- package/src/components/drawer-inline.tsx +90 -0
- package/src/components/empty-state.stories.tsx +65 -0
- package/src/components/empty-state.tsx +28 -0
- package/src/components/error-boundary.tsx +80 -0
- package/src/components/file-selector.stories.tsx +166 -0
- package/src/components/file-selector.tsx +192 -0
- package/src/components/file-tree-helpers.ts +28 -0
- package/src/components/horizontal-menu-stack.tsx +15 -0
- package/src/components/info-card.stories.tsx +120 -0
- package/src/components/info-card.tsx +60 -0
- package/src/components/item-section.stories.tsx +57 -0
- package/src/components/item-section.tsx +57 -0
- package/src/components/layout.stories.tsx +341 -0
- package/src/components/layout.tsx +67 -0
- package/src/components/menu-item.stories.tsx +162 -0
- package/src/components/menu-item.tsx +207 -0
- package/src/components/number-input.tsx +21 -0
- package/src/components/open-source-notices-screen.stories.tsx +69 -0
- package/src/components/open-source-notices-screen.tsx +154 -0
- package/src/components/panel-menu.stories.tsx +44 -0
- package/src/components/panel-menu.tsx +27 -0
- package/src/components/param-editor-color-input.tsx +98 -0
- package/src/components/param-editor-date-input.tsx +106 -0
- package/src/components/param-editor-horizontal-text-input.tsx +130 -0
- package/src/components/param-editor-horizontal.stories.tsx +545 -0
- package/src/components/param-editor-horizontal.tsx +137 -0
- package/src/components/param-editor-input-group.tsx +145 -0
- package/src/components/param-editor-number-input.tsx +145 -0
- package/src/components/param-editor-selection-input.tsx +181 -0
- package/src/components/param-editor-text-input.tsx +113 -0
- package/src/components/param-editor.stories.tsx +986 -0
- package/src/components/param-editor.tsx +142 -0
- package/src/components/param-editor.types.ts +95 -0
- package/src/components/properties.stories.tsx +108 -0
- package/src/components/properties.tsx +73 -0
- package/src/components/pstdio-logo.tsx +26 -0
- package/src/components/resource-badge.stories.tsx +26 -0
- package/src/components/resource-badge.tsx +173 -0
- package/src/components/rich-text/collaborative-markdown-editor/awareness-cursors.tsx +45 -0
- package/src/components/rich-text/collaborative-markdown-editor/collaborative-markdown-editor.stories.tsx +230 -0
- package/src/components/rich-text/collaborative-markdown-editor/collaborative-markdown-editor.tsx +131 -0
- package/src/components/rich-text/index.ts +14 -0
- package/src/components/rich-text/markdown-editor/markdown-editor.stories.tsx +147 -0
- package/src/components/rich-text/markdown-editor/markdown-editor.tsx +112 -0
- package/src/components/rich-text/markdown-editor/plugins/ReferenceLinkPlugin/ReferenceLinkNode.tsx +100 -0
- package/src/components/rich-text/markdown-editor/plugins/ReferenceLinkPlugin/ReferenceLinkTransformer.ts +32 -0
- package/src/components/rich-text/markdown-editor/plugins/ReferenceLinkPlugin/index.ts +2 -0
- package/src/components/rich-text/prompt-input/commands.ts +44 -0
- package/src/components/rich-text/prompt-input/events.ts +21 -0
- package/src/components/rich-text/prompt-input/plugins/CommentPlugin/CommentPlugin.tsx +8 -0
- package/src/components/rich-text/prompt-input/plugins/CommentPlugin/hooks/useCommentCommands.ts +49 -0
- package/src/components/rich-text/prompt-input/plugins/CommentPlugin/hooks/useCommentSchema.ts +30 -0
- package/src/components/rich-text/prompt-input/plugins/CommentPlugin/nodes/CommentNode/CommentNode.tsx +127 -0
- package/src/components/rich-text/prompt-input/plugins/ImperativeAPIPlugin.tsx +32 -0
- package/src/components/rich-text/prompt-input/plugins/KeyboardShortcutPlugin.tsx +30 -0
- package/src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/ReferenceMenuOption.ts +15 -0
- package/src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/ReferenceMenuPlugin.tsx +88 -0
- package/src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/components/ReferenceMenu/ReferenceMenu.tsx +90 -0
- package/src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/components/ReferenceMenu/ReferenceMenuItem.tsx +50 -0
- package/src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/constants.ts +3 -0
- package/src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/hooks/useContextLookup.tsx +50 -0
- package/src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/utils/checkForTriggers.ts +45 -0
- package/src/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/utils/getSortedMenuOptions.ts +20 -0
- package/src/components/rich-text/prompt-input/plugins/ReferencePlugin/ReferencePlugin.tsx +50 -0
- package/src/components/rich-text/prompt-input/plugins/ReferencePlugin/nodes/ReferenceNode/ReferenceNode.tsx +107 -0
- package/src/components/rich-text/prompt-input/plugins/keyboard-shortcuts.ts +13 -0
- package/src/components/rich-text/prompt-input/prompt-input.stories.tsx +87 -0
- package/src/components/rich-text/prompt-input/prompt-input.tsx +106 -0
- package/src/components/rich-text/prompt-input/theme/prompt-input-theme.css +3 -0
- package/src/components/rich-text/prompt-input/theme/prompt-input-theme.ts +11 -0
- package/src/components/rich-text/prompt-input/utils.ts +158 -0
- package/src/components/rich-text/rich-message/plugins/ReferenceLinkPlugin/ReferenceLinkNode.tsx +100 -0
- package/src/components/rich-text/rich-message/plugins/ReferenceLinkPlugin/ReferenceLinkTransformer.ts +32 -0
- package/src/components/rich-text/rich-message/plugins/ReferenceLinkPlugin/index.ts +2 -0
- package/src/components/rich-text/rich-message/rich-message.stories.tsx +146 -0
- package/src/components/rich-text/rich-message/rich-message.tsx +118 -0
- package/src/components/rich-text/shared/components/content-editable.tsx +28 -0
- package/src/components/rich-text/shared/components/default-rich-text-components.tsx +99 -0
- package/src/components/rich-text/shared/editor-config.ts +38 -0
- package/src/components/rich-text/shared/nodes/DataTableNode.stories.tsx +52 -0
- package/src/components/rich-text/shared/nodes/DataTableNode.tsx +73 -0
- package/src/components/rich-text/shared/plugins/CodePlugin/CodeBlockPlugin.tsx +22 -0
- package/src/components/rich-text/shared/plugins/CodePlugin/CodeNode.tsx +57 -0
- package/src/components/rich-text/shared/plugins/EquationPlugin/EquationComponent.tsx +46 -0
- package/src/components/rich-text/shared/plugins/EquationPlugin/EquationNode.tsx +161 -0
- package/src/components/rich-text/shared/plugins/EquationPlugin/EquationPlugin.css +16 -0
- package/src/components/rich-text/shared/plugins/EquationPlugin/EquationPlugin.tsx +45 -0
- package/src/components/rich-text/shared/plugins/EquationPlugin/KatexRenderer.tsx +40 -0
- package/src/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/FloatingTextFormatToolbarPlugin.css +26 -0
- package/src/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/FloatingTextFormatToolbarPlugin.tsx +414 -0
- package/src/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/index.ts +1 -0
- package/src/components/rich-text/shared/plugins/HorizontalRulePlugin/HorizontalRuleNode.ts +52 -0
- package/src/components/rich-text/shared/plugins/HorizontalRulePlugin/horizontalRule.ts +16 -0
- package/src/components/rich-text/shared/plugins/LinkEditorPlugin/LinkEditorPlugin.css +163 -0
- package/src/components/rich-text/shared/plugins/LinkEditorPlugin/LinkEditorPlugin.tsx +355 -0
- package/src/components/rich-text/shared/plugins/LinkEditorPlugin/LinkPlugin.tsx +6 -0
- package/src/components/rich-text/shared/plugins/LinkEditorPlugin/utils/getSelectedNode.ts +17 -0
- package/src/components/rich-text/shared/plugins/LinkEditorPlugin/utils/setFloatingElemPos.ts +39 -0
- package/src/components/rich-text/shared/plugins/LinkEditorPlugin/utils/url.ts +23 -0
- package/src/components/rich-text/shared/plugins/StateUpdatePlugin.tsx +21 -0
- package/src/components/rich-text/shared/plugins/TableActionMenuPlugin/TableActionMenuPlugin.tsx +224 -0
- package/src/components/rich-text/shared/plugins/TableCellResizerPlugin/TableCellResizerPlugin.css +3 -0
- package/src/components/rich-text/shared/plugins/TableCellResizerPlugin/TableCellResizerPlugin.tsx +315 -0
- package/src/components/rich-text/shared/plugins/ToggleEditablePlugin.tsx +12 -0
- package/src/components/rich-text/shared/plugins/TreeViewPlugin/TreeViewPlugin.tsx +20 -0
- package/src/components/rich-text/shared/transformers/markdown-transformers.ts +123 -0
- package/src/components/rich-text/shared/types/rich-text-components.ts +17 -0
- package/src/components/rich-text/theme/report-theme.tsx +81 -0
- package/src/components/rich-text/theme/rich-text-theme.css +773 -0
- package/src/components/rich-text/theme/rich-text-theme.tsx +81 -0
- package/src/components/rich-text/types.ts +9 -0
- package/src/components/rich-text/utils/inferResourceType.ts +17 -0
- package/src/components/rich-text/utils/markdown.ts +12 -0
- package/src/components/rich-text/utils/mediaType.ts +31 -0
- package/src/components/session-indicator.stories.tsx +46 -0
- package/src/components/session-indicator.tsx +40 -0
- package/src/components/slider.stories.tsx +38 -0
- package/src/components/slider.tsx +20 -0
- package/src/components/style-guide-data.ts +374 -0
- package/src/components/style-guide.stories.tsx +212 -0
- package/src/components/style-guide.tsx +305 -0
- package/src/components/ticket-board.stories.tsx +109 -0
- package/src/components/ticket-board.tsx +167 -0
- package/src/components/ticket-card.stories.tsx +133 -0
- package/src/components/ticket-card.tsx +126 -0
- package/src/components/toaster.stories.tsx +79 -0
- package/src/components/toaster.tsx +26 -0
- package/src/components/tooltip.tsx +43 -0
- package/src/index.ts +16 -0
- package/src/theme/global.ts +49 -0
- package/src/theme/index.ts +10 -0
- package/src/theme/primitives/colors.ts +209 -0
- package/src/theme/primitives/fonts.ts +33 -0
- package/src/theme/primitives/sizes.ts +49 -0
- package/src/theme/recipes/alert.ts +12 -0
- package/src/theme/recipes/button.ts +124 -0
- package/src/theme/recipes/dialog.ts +11 -0
- package/src/theme/recipes/divider.ts +7 -0
- package/src/theme/recipes/drawer.ts +16 -0
- package/src/theme/recipes/editable.ts +42 -0
- package/src/theme/recipes/form.ts +11 -0
- package/src/theme/recipes/input.ts +25 -0
- package/src/theme/recipes/menu.ts +40 -0
- package/src/theme/recipes/popover.ts +46 -0
- package/src/theme/recipes/progress-circle.ts +22 -0
- package/src/theme/recipes/skeleton.ts +8 -0
- package/src/theme/recipes/textarea.ts +29 -0
- package/src/theme/recipes/tooltip.ts +15 -0
- package/src/theme/theme.ts +70 -0
- package/src/theme/tokens/borders.ts +38 -0
- package/src/theme/tokens/colors.ts +488 -0
- package/src/theme/tokens/layer-styles.ts +15 -0
- package/src/theme/tokens/shadows.ts +47 -0
- package/src/theme/tokens/text.ts +236 -0
- package/src/utils/apply-theme-preference.ts +17 -0
- package/src/utils/formats.ts +27 -0
- package/src/utils/get-file-type-icon.ts +52 -0
- package/src/utils/theme-preference.tsx +60 -0
- package/src/vite-env.d.ts +6 -0
- package/storybook-static/assets/CodeBlockPlugin-C3OWpvP8.js +281 -0
- package/storybook-static/assets/CodeBlockPlugin-e2vWgtYm.css +1 -0
- package/storybook-static/assets/DataTableNode.stories-DLgTftOI.js +33 -0
- package/storybook-static/assets/EquationComponent-CUFxwyNf.js +1 -0
- package/storybook-static/assets/EquationComponent-DWZwfaVI.css +1 -0
- package/storybook-static/assets/FloatingTextFormatToolbarPlugin-B6jc8xvg.js +1 -0
- package/storybook-static/assets/FloatingTextFormatToolbarPlugin-D2l3--Te.css +1 -0
- package/storybook-static/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/storybook-static/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/storybook-static/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/storybook-static/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/storybook-static/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/storybook-static/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/storybook-static/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/storybook-static/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/storybook-static/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/storybook-static/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/storybook-static/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/storybook-static/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/storybook-static/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/storybook-static/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/storybook-static/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/storybook-static/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/storybook-static/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/storybook-static/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/storybook-static/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/storybook-static/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/storybook-static/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/storybook-static/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/storybook-static/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/storybook-static/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/storybook-static/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/storybook-static/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/storybook-static/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/storybook-static/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/storybook-static/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/storybook-static/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/storybook-static/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/storybook-static/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/storybook-static/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/storybook-static/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/storybook-static/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/storybook-static/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/storybook-static/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/storybook-static/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/storybook-static/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/storybook-static/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/storybook-static/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/storybook-static/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/storybook-static/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/storybook-static/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/storybook-static/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/storybook-static/assets/LexicalHistoryPlugin.prod-BQAibkDj.js +1 -0
- package/storybook-static/assets/TreeViewPlugin-CyVKCrKJ.js +24 -0
- package/storybook-static/assets/ai-conversation-DcjS--ee.js +1 -0
- package/storybook-static/assets/ai-conversation.stories-COjWuS8V.js +3 -0
- package/storybook-static/assets/ai-message-DLdAGhWH.js +1 -0
- package/storybook-static/assets/ai-message.stories-CRTyreKL.js +3 -0
- package/storybook-static/assets/ai-response-ySM6s0iN.js +1 -0
- package/storybook-static/assets/ai-response.stories-DVBYlrGf.js +11 -0
- package/storybook-static/assets/attachment-list-1p1601I5.js +1 -0
- package/storybook-static/assets/attachment-list.stories-Cydlsnio.js +7 -0
- package/storybook-static/assets/badge-CtgJasjB.js +1 -0
- package/storybook-static/assets/breadcrumb.stories-SAjB-iqH.js +5 -0
- package/storybook-static/assets/button-C7it2n8t.js +1 -0
- package/storybook-static/assets/button.stories-BMVbbb4y.js +72 -0
- package/storybook-static/assets/chat-input-B-915nCM.js +1 -0
- package/storybook-static/assets/chat-input.stories-DrxvpT9p.js +32 -0
- package/storybook-static/assets/chat-panel.stories-D0L6eIte.js +96 -0
- package/storybook-static/assets/chevron-down-BYCAGyCV.js +1 -0
- package/storybook-static/assets/chevron-right-owK1wZnx.js +1 -0
- package/storybook-static/assets/collaborative-markdown-editor-Bj0GvTvv.js +41 -0
- package/storybook-static/assets/collaborative-markdown-editor.stories-B_MUIC5s.js +11 -0
- package/storybook-static/assets/collapsible-DBDG7h1r.js +1 -0
- package/storybook-static/assets/collapsible-content-B1Uq3jUM.js +1 -0
- package/storybook-static/assets/column-file-browser.stories-DPMQnHCw.js +54 -0
- package/storybook-static/assets/compiler-runtime-BXE7OOXE.js +1 -0
- package/storybook-static/assets/computed-style-C0hzrq9-.js +1 -0
- package/storybook-static/assets/create-recipe-context-BU56IzEo.js +1 -0
- package/storybook-static/assets/create-slot-recipe-context-DAhDE6G_.js +1 -0
- package/storybook-static/assets/create-split-props-u5h9OPvL.js +1 -0
- package/storybook-static/assets/createLucideIcon-CcBBUKX8.js +1 -0
- package/storybook-static/assets/data-table-vuIeWXui.css +1 -0
- package/storybook-static/assets/data-table.stories-Cs-q7dpj.js +19 -0
- package/storybook-static/assets/delete-confirmation-modal.stories-C8vDKFRD.js +14 -0
- package/storybook-static/assets/diff-bubble-_zZypMRt.js +1 -0
- package/storybook-static/assets/diff-bubble.stories-DfonanIk.js +39 -0
- package/storybook-static/assets/diff-drawer.stories-CGDWiKD8.js +38 -0
- package/storybook-static/assets/diff-editor-DV9BXqbn.js +11 -0
- package/storybook-static/assets/dismissable-layer-Cc5dFRd8.js +1 -0
- package/storybook-static/assets/drawer-inline.stories-B3Tp7vjL.js +88 -0
- package/storybook-static/assets/empty-state-BXkyq69k.js +1 -0
- package/storybook-static/assets/empty-state.stories-6eYYBOWR.js +29 -0
- package/storybook-static/assets/factory-BR3bc_RM.js +1 -0
- package/storybook-static/assets/factory-DAJZwK4o.js +1 -0
- package/storybook-static/assets/file-selector.stories-PKIGBUd5.js +31 -0
- package/storybook-static/assets/file-text-D5m8MJlG.js +1 -0
- package/storybook-static/assets/flex-DAJL4AFZ.js +1 -0
- package/storybook-static/assets/folder-C5dba_Co.js +1 -0
- package/storybook-static/assets/form-D_Xln9tK.js +1 -0
- package/storybook-static/assets/full-conversation-normalized-LUbl1coD.js +1 -0
- package/storybook-static/assets/grid-7OIKBlfh.js +1 -0
- package/storybook-static/assets/h-stack-DWHd8f97.js +1 -0
- package/storybook-static/assets/horizontal-menu-stack-Cph6x7ui.js +1 -0
- package/storybook-static/assets/icon-C8FN9JqD.js +1 -0
- package/storybook-static/assets/icon-button-DHiUe7rR.js +1 -0
- package/storybook-static/assets/icons-WRA1cA-W.js +1 -0
- package/storybook-static/assets/iframe-2XPD_vrQ.css +1 -0
- package/storybook-static/assets/iframe-B8FSoBNY.js +1075 -0
- package/storybook-static/assets/index-B0y2_lLF.js +1 -0
- package/storybook-static/assets/index-CXwl6T4k.js +1 -0
- package/storybook-static/assets/index-DaXC_qY_.js +1 -0
- package/storybook-static/assets/index-DpB4ozcR.js +1 -0
- package/storybook-static/assets/index-cFwdnc0b.js +1 -0
- package/storybook-static/assets/info-DlgY5-DW.js +1 -0
- package/storybook-static/assets/info-card.stories-Cry0Qfrn.js +55 -0
- package/storybook-static/assets/input-ZSs5cSFQ.js +1 -0
- package/storybook-static/assets/inter-cyrillic-400-normal-HOLc17fK.woff +0 -0
- package/storybook-static/assets/inter-cyrillic-400-normal-obahsSVq.woff2 +0 -0
- package/storybook-static/assets/inter-cyrillic-500-normal-BasfLYem.woff2 +0 -0
- package/storybook-static/assets/inter-cyrillic-500-normal-CxZf_p3X.woff +0 -0
- package/storybook-static/assets/inter-cyrillic-ext-400-normal-BQZuk6qB.woff2 +0 -0
- package/storybook-static/assets/inter-cyrillic-ext-400-normal-DQukG94-.woff +0 -0
- package/storybook-static/assets/inter-cyrillic-ext-500-normal-B0yAr1jD.woff2 +0 -0
- package/storybook-static/assets/inter-cyrillic-ext-500-normal-BmqWE9Dz.woff +0 -0
- package/storybook-static/assets/inter-greek-400-normal-B4URO6DV.woff2 +0 -0
- package/storybook-static/assets/inter-greek-400-normal-q2sYcFCs.woff +0 -0
- package/storybook-static/assets/inter-greek-500-normal-BIZE56-Y.woff2 +0 -0
- package/storybook-static/assets/inter-greek-500-normal-Xzm54t5V.woff +0 -0
- package/storybook-static/assets/inter-greek-ext-400-normal-DGGRlc-M.woff2 +0 -0
- package/storybook-static/assets/inter-greek-ext-400-normal-KugGGMne.woff +0 -0
- package/storybook-static/assets/inter-greek-ext-500-normal-2j5mBUwD.woff +0 -0
- package/storybook-static/assets/inter-greek-ext-500-normal-C4iEst2y.woff2 +0 -0
- package/storybook-static/assets/inter-latin-400-normal-C38fXH4l.woff2 +0 -0
- package/storybook-static/assets/inter-latin-400-normal-CyCys3Eg.woff +0 -0
- package/storybook-static/assets/inter-latin-500-normal-BL9OpVg8.woff +0 -0
- package/storybook-static/assets/inter-latin-500-normal-Cerq10X2.woff2 +0 -0
- package/storybook-static/assets/inter-latin-ext-400-normal-77YHD8bZ.woff +0 -0
- package/storybook-static/assets/inter-latin-ext-400-normal-C1nco2VV.woff2 +0 -0
- package/storybook-static/assets/inter-latin-ext-500-normal-BxGbmqWO.woff +0 -0
- package/storybook-static/assets/inter-latin-ext-500-normal-CV4jyFjo.woff2 +0 -0
- package/storybook-static/assets/inter-vietnamese-400-normal-Bbgyi5SW.woff +0 -0
- package/storybook-static/assets/inter-vietnamese-400-normal-DMkecbls.woff2 +0 -0
- package/storybook-static/assets/inter-vietnamese-500-normal-DOriooB6.woff2 +0 -0
- package/storybook-static/assets/inter-vietnamese-500-normal-mJboJaSs.woff +0 -0
- package/storybook-static/assets/item-section-AoQrVPNJ.js +1 -0
- package/storybook-static/assets/item-section.stories-kYTPHRsx.js +24 -0
- package/storybook-static/assets/layout.stories-DhSjwzU1.js +3 -0
- package/storybook-static/assets/link-DE5grRtm.js +1 -0
- package/storybook-static/assets/markdown-BLUemkxK.js +1 -0
- package/storybook-static/assets/markdown-editor-Y4eMsgVb.js +1 -0
- package/storybook-static/assets/markdown-editor.stories-DIWw-hRP.js +115 -0
- package/storybook-static/assets/menu-item-CrqDaj9K.js +1 -0
- package/storybook-static/assets/menu-item.stories-D9Isjjrf.js +68 -0
- package/storybook-static/assets/message-parts-renderer.stories-CewRvbm7.js +5 -0
- package/storybook-static/assets/message-types-CEyA7Qm7.js +60 -0
- package/storybook-static/assets/model-swap-separator.stories-DrQW2NWQ.js +9 -0
- package/storybook-static/assets/mutation-observer-CAfGweIM.js +1 -0
- package/storybook-static/assets/normalize-props-D7NI5JRu.js +1 -0
- package/storybook-static/assets/number-C92MPsRM.js +1 -0
- package/storybook-static/assets/number-input-D1aC-9ls.js +7 -0
- package/storybook-static/assets/onest-cyrillic-400-normal-BxvCLB5P.woff +0 -0
- package/storybook-static/assets/onest-cyrillic-400-normal-DH8vlB-A.woff2 +0 -0
- package/storybook-static/assets/onest-cyrillic-500-normal-CyY1vN0Q.woff +0 -0
- package/storybook-static/assets/onest-cyrillic-500-normal-DHyr8B2c.woff2 +0 -0
- package/storybook-static/assets/onest-cyrillic-700-normal-CwpXuTGk.woff2 +0 -0
- package/storybook-static/assets/onest-cyrillic-700-normal-DOtXtm0s.woff +0 -0
- package/storybook-static/assets/onest-latin-400-normal-BAzPRZHg.woff +0 -0
- package/storybook-static/assets/onest-latin-400-normal-bladozIj.woff2 +0 -0
- package/storybook-static/assets/onest-latin-500-normal-oFTiz6Nq.woff +0 -0
- package/storybook-static/assets/onest-latin-500-normal-qHiQtL66.woff2 +0 -0
- package/storybook-static/assets/onest-latin-700-normal-Bd6qVL4Q.woff2 +0 -0
- package/storybook-static/assets/onest-latin-700-normal-XTvQgpoh.woff +0 -0
- package/storybook-static/assets/onest-latin-ext-400-normal--mQR5RlC.woff2 +0 -0
- package/storybook-static/assets/onest-latin-ext-400-normal-BbXTNVXw.woff +0 -0
- package/storybook-static/assets/onest-latin-ext-500-normal-BlXa29q8.woff2 +0 -0
- package/storybook-static/assets/onest-latin-ext-500-normal-CoujUMv_.woff +0 -0
- package/storybook-static/assets/onest-latin-ext-700-normal-C-Tcltod.woff2 +0 -0
- package/storybook-static/assets/onest-latin-ext-700-normal-CSGWRWNE.woff +0 -0
- package/storybook-static/assets/open-source-notices-screen.stories-BpdJxDZC.js +21 -0
- package/storybook-static/assets/overflow-CkG1DOya.js +1 -0
- package/storybook-static/assets/panel-menu-CqLSrdTB.js +1 -0
- package/storybook-static/assets/panel-menu.stories-CxdWaWjq.js +14 -0
- package/storybook-static/assets/param-editor-horizontal.stories-C1o-VOjG.js +561 -0
- package/storybook-static/assets/param-editor-selection-input-2pJE1_W1.js +1 -0
- package/storybook-static/assets/param-editor.stories-0ae3y4Vu.js +921 -0
- package/storybook-static/assets/playfair-display-cyrillic-400-normal-CjW2EstV.woff2 +0 -0
- package/storybook-static/assets/playfair-display-cyrillic-400-normal-ZiRag6zj.woff +0 -0
- package/storybook-static/assets/playfair-display-cyrillic-600-normal-DbWAkkgN.woff +0 -0
- package/storybook-static/assets/playfair-display-cyrillic-600-normal-oLY6jnZ7.woff2 +0 -0
- package/storybook-static/assets/playfair-display-cyrillic-700-normal-Dk1mTcxf.woff +0 -0
- package/storybook-static/assets/playfair-display-cyrillic-700-normal-Dw3uKy19.woff2 +0 -0
- package/storybook-static/assets/playfair-display-latin-400-normal-CFtfchNt.woff2 +0 -0
- package/storybook-static/assets/playfair-display-latin-400-normal-DHYHbkg3.woff +0 -0
- package/storybook-static/assets/playfair-display-latin-600-normal-CZLGqjJe.woff2 +0 -0
- package/storybook-static/assets/playfair-display-latin-600-normal-CxxueQ0Z.woff +0 -0
- package/storybook-static/assets/playfair-display-latin-700-normal-Bc_1Q1cG.woff +0 -0
- package/storybook-static/assets/playfair-display-latin-700-normal-CuDiGg7c.woff2 +0 -0
- package/storybook-static/assets/playfair-display-latin-ext-400-normal-BxlSGspa.woff2 +0 -0
- package/storybook-static/assets/playfair-display-latin-ext-400-normal-qdZwdvNS.woff +0 -0
- package/storybook-static/assets/playfair-display-latin-ext-600-normal-BumBfC1v.woff +0 -0
- package/storybook-static/assets/playfair-display-latin-ext-600-normal-CEjQclLc.woff2 +0 -0
- package/storybook-static/assets/playfair-display-latin-ext-700-normal-C58ejOkc.woff2 +0 -0
- package/storybook-static/assets/playfair-display-latin-ext-700-normal-D5HUU8GT.woff +0 -0
- package/storybook-static/assets/playfair-display-vietnamese-400-normal-BV2APVTb.woff2 +0 -0
- package/storybook-static/assets/playfair-display-vietnamese-400-normal-BbvUAu4N.woff +0 -0
- package/storybook-static/assets/playfair-display-vietnamese-600-normal-BPJkAZPN.woff +0 -0
- package/storybook-static/assets/playfair-display-vietnamese-600-normal-ICsRR-qJ.woff2 +0 -0
- package/storybook-static/assets/playfair-display-vietnamese-700-normal-CaKJSIny.woff2 +0 -0
- package/storybook-static/assets/playfair-display-vietnamese-700-normal-Cr1rw0mr.woff +0 -0
- package/storybook-static/assets/portal-CZHfPTRw.js +1 -0
- package/storybook-static/assets/preload-helper-PPVm8Dsz.js +1 -0
- package/storybook-static/assets/prompt-input-BLCttowi.js +14 -0
- package/storybook-static/assets/prompt-input-BVbz9joI.css +1 -0
- package/storybook-static/assets/prompt-input.stories-J8-AMVXy.js +9 -0
- package/storybook-static/assets/properties.stories-Bs7ivKgb.js +59 -0
- package/storybook-static/assets/react-18-KY0R7ltw.js +9 -0
- package/storybook-static/assets/render-strategy-BebqUNCa.js +1 -0
- package/storybook-static/assets/resource-badge-Bw5UoU4J.js +1 -0
- package/storybook-static/assets/resource-badge.stories-DtSh-RX9.js +9 -0
- package/storybook-static/assets/rich-message-BIkzo1SM.js +1 -0
- package/storybook-static/assets/rich-message.stories-C9Wc4d3O.js +115 -0
- package/storybook-static/assets/rich-text-theme-Bkhh9rAZ.js +14 -0
- package/storybook-static/assets/rich-text-theme-K2MBoCbx.css +1 -0
- package/storybook-static/assets/separator-CQkMOHNm.js +1 -0
- package/storybook-static/assets/settings-DUgg22A7.js +1 -0
- package/storybook-static/assets/simple-grid-DIKjhnVI.js +1 -0
- package/storybook-static/assets/spinner-ZYH_gvW-.js +1 -0
- package/storybook-static/assets/stack-CN4X31TA.js +1 -0
- package/storybook-static/assets/star-CvcHIXRa.js +1 -0
- package/storybook-static/assets/style-guide.stories-BUvEhZov.js +6 -0
- package/storybook-static/assets/tabbable-DHAf8oAu.js +1 -0
- package/storybook-static/assets/table-BKNSzs2r.js +1 -0
- package/storybook-static/assets/textarea-rqmaWSc5.js +1 -0
- package/storybook-static/assets/toaster-d9nN0H7K.js +1 -0
- package/storybook-static/assets/toaster.stories-BRVCYyaM.js +52 -0
- package/storybook-static/assets/tool-invocation-timeline-B-cS0W6M.js +59 -0
- package/storybook-static/assets/tool-invocation-timeline.stories-DXO59O73.js +5 -0
- package/storybook-static/assets/tooltip-C_a-XGZ8.js +1 -0
- package/storybook-static/assets/tooltip-DZxUoouw.js +1 -0
- package/storybook-static/assets/trash-2-BO05slEk.js +1 -0
- package/storybook-static/assets/typeahead-CuY9WxfQ.js +1 -0
- package/storybook-static/assets/use-field-context-DoxKQlMm.js +1 -0
- package/storybook-static/assets/use-presence-context-DK2PGZth.js +1 -0
- package/storybook-static/assets/v-stack-Btoq6OB_.js +1 -0
- package/storybook-static/assets/x-D42ziktz.js +1 -0
- package/storybook-static/components/alert.d.ts +9 -0
- package/storybook-static/components/breadcrumb.d.ts +18 -0
- package/storybook-static/components/breadcrumb.stories.d.ts +25 -0
- package/storybook-static/components/chat-ui/agent-types.d.ts +205 -0
- package/storybook-static/components/chat-ui/components/ai-conversation.stories.d.ts +6 -0
- package/storybook-static/components/chat-ui/components/ai-message.d.ts +94 -0
- package/storybook-static/components/chat-ui/components/ai-message.stories.d.ts +6 -0
- package/storybook-static/components/chat-ui/components/ai-response.d.ts +6 -0
- package/storybook-static/components/chat-ui/components/ai-response.stories.d.ts +7 -0
- package/storybook-static/components/chat-ui/components/approval-prompt.d.ts +8 -0
- package/storybook-static/components/chat-ui/components/attachment-list.d.ts +23 -0
- package/storybook-static/components/chat-ui/components/attachment-list.stories.d.ts +6 -0
- package/storybook-static/components/chat-ui/components/auto-scroll.d.ts +10 -0
- package/storybook-static/components/chat-ui/components/chat-input.d.ts +16 -0
- package/storybook-static/components/chat-ui/components/chat-input.stories.d.ts +7 -0
- package/storybook-static/components/chat-ui/components/chat-panel.d.ts +18 -0
- package/storybook-static/components/chat-ui/components/chat-panel.stories.d.ts +8 -0
- package/storybook-static/components/chat-ui/components/message-parts-renderer.d.ts +12 -0
- package/storybook-static/components/chat-ui/components/message-parts-renderer.stories.d.ts +7 -0
- package/storybook-static/components/chat-ui/components/message-types.d.ts +6 -0
- package/storybook-static/components/chat-ui/components/model-swap-separator.d.ts +5 -0
- package/storybook-static/components/chat-ui/components/model-swap-separator.stories.d.ts +6 -0
- package/storybook-static/components/chat-ui/components/send-button.d.ts +7 -0
- package/storybook-static/components/chat-ui/components/timeline.d.ts +86 -0
- package/storybook-static/components/chat-ui/components/tool-invocation-timeline.d.ts +7 -0
- package/storybook-static/components/chat-ui/components/tool-invocation-timeline.stories.d.ts +6 -0
- package/storybook-static/components/chat-ui/mocks/full-conversation-normalized.json.d.ts +3560 -0
- package/storybook-static/components/chat-ui/tool-rendering/build-timeline.d.ts +23 -0
- package/storybook-static/components/chat-ui/tool-rendering/default-renderers.d.ts +9 -0
- package/storybook-static/components/chat-ui/tool-rendering/index.d.ts +3 -0
- package/storybook-static/components/chat-ui/tool-rendering/types.d.ts +13 -0
- package/storybook-static/components/chat-ui/utils/diff.d.ts +21 -0
- package/storybook-static/components/chat-ui/utils/editor-state.d.ts +1 -0
- package/storybook-static/components/code-editor.d.ts +33 -0
- package/storybook-static/components/column-file-browser.d.ts +21 -0
- package/storybook-static/components/content-placeholder.d.ts +5 -0
- package/storybook-static/components/data-table.d.ts +18 -0
- package/storybook-static/components/data-table.stories.d.ts +33 -0
- package/storybook-static/components/delete-confirmation-modal.d.ts +10 -0
- package/storybook-static/components/delete-confirmation-modal.stories.d.ts +11 -0
- package/storybook-static/components/diff-bubble.d.ts +14 -0
- package/storybook-static/components/diff-bubble.stories.d.ts +13 -0
- package/storybook-static/components/diff-card.d.ts +14 -0
- package/storybook-static/components/diff-drawer.d.ts +6 -0
- package/storybook-static/components/diff-drawer.stories.d.ts +8 -0
- package/storybook-static/components/diff-editor.d.ts +9 -0
- package/storybook-static/components/drawer-inline.d.ts +24 -0
- package/storybook-static/components/drawer-inline.stories.d.ts +8 -0
- package/storybook-static/components/empty-state.d.ts +8 -0
- package/storybook-static/components/empty-state.stories.d.ts +34 -0
- package/storybook-static/components/error-boundary.d.ts +26 -0
- package/storybook-static/components/file-selector.d.ts +13 -0
- package/storybook-static/components/file-tree-helpers.d.ts +8 -0
- package/storybook-static/components/horizontal-menu-stack.d.ts +6 -0
- package/storybook-static/components/info-card.d.ts +13 -0
- package/storybook-static/components/item-section.d.ts +11 -0
- package/storybook-static/components/item-section.stories.d.ts +17 -0
- package/storybook-static/components/layout.d.ts +14 -0
- package/storybook-static/components/layout.stories.d.ts +11 -0
- package/storybook-static/components/menu-item.d.ts +40 -0
- package/storybook-static/components/open-source-notices-screen.d.ts +20 -0
- package/storybook-static/components/open-source-notices-screen.stories.d.ts +12 -0
- package/storybook-static/components/panel-menu.d.ts +7 -0
- package/storybook-static/components/panel-menu.stories.d.ts +7 -0
- package/storybook-static/components/param-editor-color-input.d.ts +13 -0
- package/storybook-static/components/param-editor-date-input.d.ts +15 -0
- package/storybook-static/components/param-editor-horizontal-text-input.d.ts +12 -0
- package/storybook-static/components/param-editor-horizontal.d.ts +10 -0
- package/storybook-static/components/param-editor-horizontal.stories.d.ts +19 -0
- package/storybook-static/components/param-editor-input-group.d.ts +10 -0
- package/storybook-static/components/param-editor-number-input.d.ts +17 -0
- package/storybook-static/components/param-editor-selection-input.d.ts +21 -0
- package/storybook-static/components/param-editor-text-input.d.ts +13 -0
- package/storybook-static/components/param-editor.d.ts +10 -0
- package/storybook-static/components/param-editor.stories.d.ts +23 -0
- package/storybook-static/components/param-editor.types.d.ts +71 -0
- package/storybook-static/components/properties.d.ts +18 -0
- package/storybook-static/components/properties.stories.d.ts +17 -0
- package/storybook-static/components/resource-badge.d.ts +62 -0
- package/storybook-static/components/resource-badge.stories.d.ts +7 -0
- package/storybook-static/components/rich-text/collaborative-markdown-editor/awareness-cursors.d.ts +5 -0
- package/storybook-static/components/rich-text/collaborative-markdown-editor/collaborative-markdown-editor.d.ts +8 -0
- package/storybook-static/components/rich-text/collaborative-markdown-editor/collaborative-markdown-editor.stories.d.ts +9 -0
- package/storybook-static/components/rich-text/index.d.ts +14 -0
- package/storybook-static/components/rich-text/markdown-editor/markdown-editor.d.ts +8 -0
- package/storybook-static/components/rich-text/markdown-editor/markdown-editor.stories.d.ts +6 -0
- package/storybook-static/components/rich-text/markdown-editor/plugins/ReferenceLinkPlugin/ReferenceLinkNode.d.ts +21 -0
- package/storybook-static/components/rich-text/markdown-editor/plugins/ReferenceLinkPlugin/ReferenceLinkTransformer.d.ts +2 -0
- package/storybook-static/components/rich-text/markdown-editor/plugins/ReferenceLinkPlugin/index.d.ts +2 -0
- package/storybook-static/components/rich-text/prompt-input/commands.d.ts +19 -0
- package/storybook-static/components/rich-text/prompt-input/events.d.ts +15 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/CommentPlugin/CommentPlugin.d.ts +1 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/CommentPlugin/hooks/useCommentCommands.d.ts +3 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/CommentPlugin/hooks/useCommentSchema.d.ts +1 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/CommentPlugin/nodes/CommentNode/CommentNode.d.ts +17 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/ImperativeAPIPlugin.d.ts +7 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/KeyboardShortcutPlugin.d.ts +4 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/ReferenceMenuOption.d.ts +12 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/ReferenceMenuPlugin.d.ts +10 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/components/ReferenceMenu/ReferenceMenu.d.ts +9 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/components/ReferenceMenu/ReferenceMenuItem.d.ts +12 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/constants.d.ts +2 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/hooks/useContextLookup.d.ts +13 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/utils/checkForTriggers.d.ts +9 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/utils/getSortedMenuOptions.d.ts +2 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/ReferencePlugin/ReferencePlugin.d.ts +6 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/ReferencePlugin/nodes/ReferenceNode/ReferenceNode.d.ts +25 -0
- package/storybook-static/components/rich-text/prompt-input/plugins/keyboard-shortcuts.d.ts +9 -0
- package/storybook-static/components/rich-text/prompt-input/prompt-input.d.ts +24 -0
- package/storybook-static/components/rich-text/prompt-input/prompt-input.stories.d.ts +8 -0
- package/storybook-static/components/rich-text/prompt-input/theme/prompt-input-theme.d.ts +3 -0
- package/storybook-static/components/rich-text/prompt-input/utils.d.ts +23 -0
- package/storybook-static/components/rich-text/rich-message/plugins/ReferenceLinkPlugin/ReferenceLinkNode.d.ts +21 -0
- package/storybook-static/components/rich-text/rich-message/plugins/ReferenceLinkPlugin/ReferenceLinkTransformer.d.ts +2 -0
- package/storybook-static/components/rich-text/rich-message/plugins/ReferenceLinkPlugin/index.d.ts +2 -0
- package/storybook-static/components/rich-text/rich-message/rich-message.d.ts +7 -0
- package/storybook-static/components/rich-text/rich-message/rich-message.stories.d.ts +6 -0
- package/storybook-static/components/rich-text/shared/components/content-editable.d.ts +7 -0
- package/storybook-static/components/rich-text/shared/components/default-rich-text-components.d.ts +3 -0
- package/storybook-static/components/rich-text/shared/editor-config.d.ts +4 -0
- package/storybook-static/components/rich-text/shared/nodes/DataTableNode.d.ts +22 -0
- package/storybook-static/components/rich-text/shared/nodes/DataTableNode.stories.d.ts +7 -0
- package/storybook-static/components/rich-text/shared/plugins/CodePlugin/CodeBlockPlugin.d.ts +1 -0
- package/storybook-static/components/rich-text/shared/plugins/CodePlugin/CodeNode.d.ts +19 -0
- package/storybook-static/components/rich-text/shared/plugins/EquationPlugin/EquationComponent.d.ts +6 -0
- package/storybook-static/components/rich-text/shared/plugins/EquationPlugin/EquationNode.d.ts +26 -0
- package/storybook-static/components/rich-text/shared/plugins/EquationPlugin/EquationPlugin.d.ts +4 -0
- package/storybook-static/components/rich-text/shared/plugins/EquationPlugin/KatexRenderer.d.ts +4 -0
- package/storybook-static/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/FloatingTextFormatToolbarPlugin.d.ts +4 -0
- package/storybook-static/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +1 -0
- package/storybook-static/components/rich-text/shared/plugins/HorizontalRulePlugin/HorizontalRuleNode.d.ts +13 -0
- package/storybook-static/components/rich-text/shared/plugins/HorizontalRulePlugin/horizontalRule.d.ts +2 -0
- package/storybook-static/components/rich-text/shared/plugins/LinkEditorPlugin/LinkEditorPlugin.d.ts +4 -0
- package/storybook-static/components/rich-text/shared/plugins/LinkEditorPlugin/LinkPlugin.d.ts +1 -0
- package/storybook-static/components/rich-text/shared/plugins/LinkEditorPlugin/utils/getSelectedNode.d.ts +2 -0
- package/storybook-static/components/rich-text/shared/plugins/LinkEditorPlugin/utils/setFloatingElemPos.d.ts +1 -0
- package/storybook-static/components/rich-text/shared/plugins/LinkEditorPlugin/utils/url.d.ts +2 -0
- package/storybook-static/components/rich-text/shared/plugins/StateUpdatePlugin.d.ts +6 -0
- package/storybook-static/components/rich-text/shared/plugins/TableActionMenuPlugin/TableActionMenuPlugin.d.ts +5 -0
- package/storybook-static/components/rich-text/shared/plugins/TableCellResizerPlugin/TableCellResizerPlugin.d.ts +2 -0
- package/storybook-static/components/rich-text/shared/plugins/ToggleEditablePlugin.d.ts +3 -0
- package/storybook-static/components/rich-text/shared/plugins/TreeViewPlugin/TreeViewPlugin.d.ts +1 -0
- package/storybook-static/components/rich-text/shared/transformers/markdown-transformers.d.ts +15 -0
- package/storybook-static/components/rich-text/shared/types/rich-text-components.d.ts +15 -0
- package/storybook-static/components/rich-text/theme/report-theme.d.ts +3 -0
- package/storybook-static/components/rich-text/theme/rich-text-theme.d.ts +3 -0
- package/storybook-static/components/rich-text/types.d.ts +8 -0
- package/storybook-static/components/rich-text/utils/inferResourceType.d.ts +1 -0
- package/storybook-static/components/rich-text/utils/markdown.d.ts +4 -0
- package/storybook-static/components/rich-text/utils/mediaType.d.ts +1 -0
- package/storybook-static/components/schub-logo.d.ts +2 -0
- package/storybook-static/components/slider.d.ts +5 -0
- package/storybook-static/components/style-guide-data.d.ts +46 -0
- package/storybook-static/components/style-guide.d.ts +1 -0
- package/storybook-static/components/style-guide.stories.d.ts +14 -0
- package/storybook-static/components/toaster.stories.d.ts +11 -0
- package/storybook-static/components/tooltip.d.ts +12 -0
- package/storybook-static/favicon-wrapper.svg +46 -0
- package/storybook-static/favicon.svg +1 -0
- package/storybook-static/iframe.html +705 -0
- package/storybook-static/index.d.ts +14 -0
- package/storybook-static/index.html +150 -0
- package/storybook-static/index.json +1 -0
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +1 -0
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +628 -0
- package/storybook-static/sb-addons/themes-1/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/vitest-2/manager-bundle.js +3 -0
- package/storybook-static/sb-common-assets/favicon-wrapper.svg +46 -0
- package/storybook-static/sb-common-assets/favicon.svg +1 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/globals-runtime.js +77956 -0
- package/storybook-static/sb-manager/globals.js +24 -0
- package/storybook-static/sb-manager/manager-stores.js +23 -0
- package/storybook-static/sb-manager/runtime.js +20422 -0
- package/storybook-static/theme/applyThemePreference.d.ts +2 -0
- package/storybook-static/theme/global.d.ts +46 -0
- package/storybook-static/theme/index.d.ts +1 -0
- package/storybook-static/theme/primitives/colors.d.ts +958 -0
- package/storybook-static/theme/primitives/fonts.d.ts +81 -0
- package/storybook-static/theme/primitives/sizes.d.ts +89 -0
- package/storybook-static/theme/recipes/alert.d.ts +1 -0
- package/storybook-static/theme/recipes/button.d.ts +129 -0
- package/storybook-static/theme/recipes/dialog.d.ts +1 -0
- package/storybook-static/theme/recipes/divider.d.ts +1 -0
- package/storybook-static/theme/recipes/drawer.d.ts +1 -0
- package/storybook-static/theme/recipes/editable.d.ts +1 -0
- package/storybook-static/theme/recipes/form.d.ts +1 -0
- package/storybook-static/theme/recipes/input.d.ts +7 -0
- package/storybook-static/theme/recipes/menu.d.ts +1 -0
- package/storybook-static/theme/recipes/popover.d.ts +16 -0
- package/storybook-static/theme/recipes/progress-circle.d.ts +28 -0
- package/storybook-static/theme/recipes/skeleton.d.ts +1 -0
- package/storybook-static/theme/recipes/textarea.d.ts +1 -0
- package/storybook-static/theme/recipes/tooltip.d.ts +1 -0
- package/storybook-static/theme/theme-preference.d.ts +15 -0
- package/storybook-static/theme/theme.d.ts +2 -0
- package/storybook-static/theme/tokens/borders.d.ts +38 -0
- package/storybook-static/theme/tokens/colors.d.ts +898 -0
- package/storybook-static/theme/tokens/layer-styles.d.ts +1 -0
- package/storybook-static/theme/tokens/shadows.d.ts +64 -0
- package/storybook-static/theme/tokens/text.d.ts +1 -0
- package/storybook-static/theme/types.d.ts +1 -0
- package/storybook-static/utils/formats.d.ts +7 -0
- package/storybook-static/utils/get-file-type-icon.d.ts +2 -0
- package/storybook-static/vite-inject-mocker-entry.js +2 -0
- package/tsconfig.json +29 -0
- package/vite.config.ts +82 -0
- package/vitest.shims.d.ts +1 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import "./LinkEditorPlugin.css";
|
|
2
|
+
|
|
3
|
+
import { $createLinkNode, $isAutoLinkNode, $isLinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link";
|
|
4
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
5
|
+
import { $findMatchingParent, mergeRegister } from "@lexical/utils";
|
|
6
|
+
import {
|
|
7
|
+
$getSelection,
|
|
8
|
+
$isLineBreakNode,
|
|
9
|
+
$isRangeSelection,
|
|
10
|
+
type BaseSelection,
|
|
11
|
+
CLICK_COMMAND,
|
|
12
|
+
COMMAND_PRIORITY_CRITICAL,
|
|
13
|
+
COMMAND_PRIORITY_HIGH,
|
|
14
|
+
COMMAND_PRIORITY_LOW,
|
|
15
|
+
KEY_ESCAPE_COMMAND,
|
|
16
|
+
type LexicalEditor,
|
|
17
|
+
SELECTION_CHANGE_COMMAND,
|
|
18
|
+
} from "lexical";
|
|
19
|
+
import type React from "react";
|
|
20
|
+
import { type Dispatch, useCallback, useEffect, useRef, useState } from "react";
|
|
21
|
+
import { createPortal } from "react-dom";
|
|
22
|
+
import { getSelectedNode } from "./utils/getSelectedNode";
|
|
23
|
+
import { setFloatingElemPos } from "./utils/setFloatingElemPos";
|
|
24
|
+
import { sanitizeUrl } from "./utils/url";
|
|
25
|
+
|
|
26
|
+
function LinkEditor({
|
|
27
|
+
editor,
|
|
28
|
+
isLink,
|
|
29
|
+
setIsLink,
|
|
30
|
+
anchorElem,
|
|
31
|
+
isLinkEditMode,
|
|
32
|
+
setIsLinkEditMode,
|
|
33
|
+
}: {
|
|
34
|
+
editor: LexicalEditor;
|
|
35
|
+
isLink: boolean;
|
|
36
|
+
setIsLink: Dispatch<boolean>;
|
|
37
|
+
anchorElem: HTMLElement;
|
|
38
|
+
isLinkEditMode: boolean;
|
|
39
|
+
setIsLinkEditMode: Dispatch<boolean>;
|
|
40
|
+
}): React.JSX.Element {
|
|
41
|
+
const editorRef = useRef<HTMLDivElement | null>(null);
|
|
42
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
43
|
+
const [linkUrl, setLinkUrl] = useState("");
|
|
44
|
+
const [editedLinkUrl, setEditedLinkUrl] = useState("https://");
|
|
45
|
+
const [lastSelection, setLastSelection] = useState<BaseSelection | null>(null);
|
|
46
|
+
|
|
47
|
+
const $updateLinkEditor = useCallback(() => {
|
|
48
|
+
const selection = $getSelection();
|
|
49
|
+
if ($isRangeSelection(selection)) {
|
|
50
|
+
const node = getSelectedNode(selection);
|
|
51
|
+
const linkParent = $findMatchingParent(node, $isLinkNode);
|
|
52
|
+
|
|
53
|
+
if (linkParent) {
|
|
54
|
+
setLinkUrl(linkParent.getURL());
|
|
55
|
+
} else if ($isLinkNode(node)) {
|
|
56
|
+
setLinkUrl(node.getURL());
|
|
57
|
+
} else {
|
|
58
|
+
setLinkUrl("");
|
|
59
|
+
}
|
|
60
|
+
if (isLinkEditMode) {
|
|
61
|
+
setEditedLinkUrl(linkUrl);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const editorElem = editorRef.current;
|
|
65
|
+
const nativeSelection = window.getSelection();
|
|
66
|
+
const activeElement = document.activeElement;
|
|
67
|
+
|
|
68
|
+
if (editorElem === null) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const rootElement = editor.getRootElement();
|
|
73
|
+
|
|
74
|
+
if (
|
|
75
|
+
selection !== null &&
|
|
76
|
+
nativeSelection !== null &&
|
|
77
|
+
rootElement !== null &&
|
|
78
|
+
rootElement.contains(nativeSelection.anchorNode) &&
|
|
79
|
+
editor.isEditable()
|
|
80
|
+
) {
|
|
81
|
+
const domRect: DOMRect | undefined = nativeSelection.focusNode?.parentElement?.getBoundingClientRect();
|
|
82
|
+
if (domRect) {
|
|
83
|
+
domRect.y += 40;
|
|
84
|
+
setFloatingElemPos(domRect, editorElem, anchorElem);
|
|
85
|
+
}
|
|
86
|
+
setLastSelection(selection);
|
|
87
|
+
} else if (!activeElement || activeElement.className !== "link-input") {
|
|
88
|
+
if (rootElement !== null) {
|
|
89
|
+
setFloatingElemPos(null, editorElem, anchorElem);
|
|
90
|
+
}
|
|
91
|
+
setLastSelection(null);
|
|
92
|
+
setIsLinkEditMode(false);
|
|
93
|
+
setLinkUrl("");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return true;
|
|
97
|
+
}, [anchorElem, editor, setIsLinkEditMode, isLinkEditMode, linkUrl]);
|
|
98
|
+
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
const scrollerElem = anchorElem.parentElement;
|
|
101
|
+
|
|
102
|
+
const update = () => {
|
|
103
|
+
editor.getEditorState().read(() => {
|
|
104
|
+
$updateLinkEditor();
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
window.addEventListener("resize", update);
|
|
109
|
+
|
|
110
|
+
if (scrollerElem) {
|
|
111
|
+
scrollerElem.addEventListener("scroll", update);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return () => {
|
|
115
|
+
window.removeEventListener("resize", update);
|
|
116
|
+
|
|
117
|
+
if (scrollerElem) {
|
|
118
|
+
scrollerElem.removeEventListener("scroll", update);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}, [anchorElem.parentElement, editor, $updateLinkEditor]);
|
|
122
|
+
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
return mergeRegister(
|
|
125
|
+
editor.registerUpdateListener(({ editorState }) => {
|
|
126
|
+
editorState.read(() => {
|
|
127
|
+
$updateLinkEditor();
|
|
128
|
+
});
|
|
129
|
+
}),
|
|
130
|
+
|
|
131
|
+
editor.registerCommand(
|
|
132
|
+
SELECTION_CHANGE_COMMAND,
|
|
133
|
+
() => {
|
|
134
|
+
$updateLinkEditor();
|
|
135
|
+
return true;
|
|
136
|
+
},
|
|
137
|
+
COMMAND_PRIORITY_LOW,
|
|
138
|
+
),
|
|
139
|
+
editor.registerCommand(
|
|
140
|
+
KEY_ESCAPE_COMMAND,
|
|
141
|
+
() => {
|
|
142
|
+
if (isLink) {
|
|
143
|
+
setIsLink(false);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
147
|
+
},
|
|
148
|
+
COMMAND_PRIORITY_HIGH,
|
|
149
|
+
),
|
|
150
|
+
);
|
|
151
|
+
}, [editor, $updateLinkEditor, setIsLink, isLink]);
|
|
152
|
+
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
editor.getEditorState().read(() => {
|
|
155
|
+
$updateLinkEditor();
|
|
156
|
+
});
|
|
157
|
+
}, [editor, $updateLinkEditor]);
|
|
158
|
+
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
if (isLinkEditMode && inputRef.current) {
|
|
161
|
+
inputRef.current.focus();
|
|
162
|
+
}
|
|
163
|
+
}, [isLinkEditMode]);
|
|
164
|
+
|
|
165
|
+
const monitorInputInteraction = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
|
166
|
+
if (event.key === "Enter") {
|
|
167
|
+
event.preventDefault();
|
|
168
|
+
handleLinkSubmission();
|
|
169
|
+
} else if (event.key === "Escape") {
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
setIsLinkEditMode(false);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const handleLinkSubmission = () => {
|
|
176
|
+
if (lastSelection !== null) {
|
|
177
|
+
if (linkUrl !== "") {
|
|
178
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, sanitizeUrl(editedLinkUrl));
|
|
179
|
+
editor.update(() => {
|
|
180
|
+
const selection = $getSelection();
|
|
181
|
+
if ($isRangeSelection(selection)) {
|
|
182
|
+
const parent = getSelectedNode(selection).getParent();
|
|
183
|
+
if ($isAutoLinkNode(parent)) {
|
|
184
|
+
const linkNode = $createLinkNode(parent.getURL(), {
|
|
185
|
+
rel: parent.__rel,
|
|
186
|
+
target: parent.__target,
|
|
187
|
+
title: parent.__title,
|
|
188
|
+
});
|
|
189
|
+
parent.replace(linkNode, true);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
setEditedLinkUrl("https://");
|
|
195
|
+
setIsLinkEditMode(false);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<div ref={editorRef} className="link-editor">
|
|
201
|
+
{!isLink ? null : isLinkEditMode ? (
|
|
202
|
+
<>
|
|
203
|
+
<input
|
|
204
|
+
ref={inputRef}
|
|
205
|
+
className="link-input"
|
|
206
|
+
value={editedLinkUrl}
|
|
207
|
+
onChange={(event) => {
|
|
208
|
+
setEditedLinkUrl(event.target.value);
|
|
209
|
+
}}
|
|
210
|
+
onKeyDown={(event) => {
|
|
211
|
+
monitorInputInteraction(event);
|
|
212
|
+
}}
|
|
213
|
+
/>
|
|
214
|
+
<div>
|
|
215
|
+
<button
|
|
216
|
+
type="button"
|
|
217
|
+
className="link-cancel icon-close"
|
|
218
|
+
aria-label="Cancel link edit"
|
|
219
|
+
onMouseDown={(event) => event.preventDefault()}
|
|
220
|
+
onClick={() => {
|
|
221
|
+
setIsLinkEditMode(false);
|
|
222
|
+
}}
|
|
223
|
+
/>
|
|
224
|
+
<button
|
|
225
|
+
type="button"
|
|
226
|
+
className="link-confirm icon-check"
|
|
227
|
+
aria-label="Confirm link edit"
|
|
228
|
+
onMouseDown={(event) => event.preventDefault()}
|
|
229
|
+
onClick={handleLinkSubmission}
|
|
230
|
+
/>
|
|
231
|
+
</div>
|
|
232
|
+
</>
|
|
233
|
+
) : (
|
|
234
|
+
<div className="link-view">
|
|
235
|
+
<a href={sanitizeUrl(linkUrl)} target="_blank" rel="noopener noreferrer">
|
|
236
|
+
{linkUrl}
|
|
237
|
+
</a>
|
|
238
|
+
<button
|
|
239
|
+
type="button"
|
|
240
|
+
className="link-edit icon-edit-2"
|
|
241
|
+
aria-label="Edit link"
|
|
242
|
+
onMouseDown={(event) => event.preventDefault()}
|
|
243
|
+
onClick={() => {
|
|
244
|
+
setEditedLinkUrl(linkUrl);
|
|
245
|
+
setIsLinkEditMode(true);
|
|
246
|
+
}}
|
|
247
|
+
/>
|
|
248
|
+
<button
|
|
249
|
+
type="button"
|
|
250
|
+
className="link-trash icon-trash"
|
|
251
|
+
aria-label="Remove link"
|
|
252
|
+
onMouseDown={(event) => event.preventDefault()}
|
|
253
|
+
onClick={() => {
|
|
254
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
255
|
+
}}
|
|
256
|
+
/>
|
|
257
|
+
</div>
|
|
258
|
+
)}
|
|
259
|
+
</div>
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function useLinkEditorToolbar(
|
|
264
|
+
editor: LexicalEditor,
|
|
265
|
+
anchorElem: HTMLElement,
|
|
266
|
+
isLinkEditMode: boolean,
|
|
267
|
+
setIsLinkEditMode: Dispatch<boolean>,
|
|
268
|
+
): React.JSX.Element | null {
|
|
269
|
+
const [activeEditor, setActiveEditor] = useState(editor);
|
|
270
|
+
const [isLink, setIsLink] = useState(false);
|
|
271
|
+
|
|
272
|
+
useEffect(() => {
|
|
273
|
+
function $updateToolbar() {
|
|
274
|
+
const selection = $getSelection();
|
|
275
|
+
if ($isRangeSelection(selection)) {
|
|
276
|
+
const focusNode = getSelectedNode(selection);
|
|
277
|
+
const focusLinkNode = $findMatchingParent(focusNode, $isLinkNode);
|
|
278
|
+
const focusAutoLinkNode = $findMatchingParent(focusNode, $isAutoLinkNode);
|
|
279
|
+
if (!(focusLinkNode || focusAutoLinkNode)) {
|
|
280
|
+
setIsLink(false);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const badNode = selection
|
|
284
|
+
.getNodes()
|
|
285
|
+
.filter((node) => !$isLineBreakNode(node))
|
|
286
|
+
.find((node) => {
|
|
287
|
+
const linkNode = $findMatchingParent(node, $isLinkNode);
|
|
288
|
+
const autoLinkNode = $findMatchingParent(node, $isAutoLinkNode);
|
|
289
|
+
const autoLinkIsUnlinked = $isAutoLinkNode(autoLinkNode) && autoLinkNode.getIsUnlinked();
|
|
290
|
+
return (
|
|
291
|
+
(focusLinkNode && !focusLinkNode.is(linkNode)) ||
|
|
292
|
+
(linkNode && !linkNode.is(focusLinkNode)) ||
|
|
293
|
+
(focusAutoLinkNode && !focusAutoLinkNode.is(autoLinkNode)) ||
|
|
294
|
+
(autoLinkNode && (!autoLinkNode.is(focusAutoLinkNode) || autoLinkIsUnlinked))
|
|
295
|
+
);
|
|
296
|
+
});
|
|
297
|
+
if (!badNode) {
|
|
298
|
+
setIsLink(true);
|
|
299
|
+
} else {
|
|
300
|
+
setIsLink(false);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return mergeRegister(
|
|
305
|
+
editor.registerUpdateListener(({ editorState }) => {
|
|
306
|
+
editorState.read(() => {
|
|
307
|
+
$updateToolbar();
|
|
308
|
+
});
|
|
309
|
+
}),
|
|
310
|
+
editor.registerCommand(
|
|
311
|
+
SELECTION_CHANGE_COMMAND,
|
|
312
|
+
(_payload, newEditor) => {
|
|
313
|
+
$updateToolbar();
|
|
314
|
+
setActiveEditor(newEditor);
|
|
315
|
+
return false;
|
|
316
|
+
},
|
|
317
|
+
COMMAND_PRIORITY_CRITICAL,
|
|
318
|
+
),
|
|
319
|
+
editor.registerCommand(
|
|
320
|
+
CLICK_COMMAND,
|
|
321
|
+
(payload) => {
|
|
322
|
+
const selection = $getSelection();
|
|
323
|
+
if ($isRangeSelection(selection)) {
|
|
324
|
+
const node = getSelectedNode(selection);
|
|
325
|
+
const linkNode = $findMatchingParent(node, $isLinkNode);
|
|
326
|
+
if ($isLinkNode(linkNode) && (payload.metaKey || payload.ctrlKey)) {
|
|
327
|
+
window.open(linkNode.getURL(), "_blank");
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return false;
|
|
332
|
+
},
|
|
333
|
+
COMMAND_PRIORITY_LOW,
|
|
334
|
+
),
|
|
335
|
+
);
|
|
336
|
+
}, [editor]);
|
|
337
|
+
|
|
338
|
+
return createPortal(
|
|
339
|
+
<LinkEditor
|
|
340
|
+
editor={activeEditor}
|
|
341
|
+
isLink={isLink}
|
|
342
|
+
anchorElem={anchorElem}
|
|
343
|
+
setIsLink={setIsLink}
|
|
344
|
+
isLinkEditMode={isLinkEditMode}
|
|
345
|
+
setIsLinkEditMode={setIsLinkEditMode}
|
|
346
|
+
/>,
|
|
347
|
+
anchorElem,
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export default function LinkEditorPlugin({ anchorElem = document.body }: { anchorElem?: HTMLElement }) {
|
|
352
|
+
const [isLinkEditMode, setIsLinkEditMode] = useState(false);
|
|
353
|
+
const [editor] = useLexicalComposerContext();
|
|
354
|
+
return useLinkEditorToolbar(editor, anchorElem, isLinkEditMode, setIsLinkEditMode);
|
|
355
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { $isAtNodeEnd } from "@lexical/selection";
|
|
2
|
+
import type { ElementNode, RangeSelection, TextNode } from "lexical";
|
|
3
|
+
|
|
4
|
+
export function getSelectedNode(selection: RangeSelection): TextNode | ElementNode {
|
|
5
|
+
const anchor = selection.anchor;
|
|
6
|
+
const focus = selection.focus;
|
|
7
|
+
const anchorNode = selection.anchor.getNode();
|
|
8
|
+
const focusNode = selection.focus.getNode();
|
|
9
|
+
if (anchorNode === focusNode) {
|
|
10
|
+
return anchorNode;
|
|
11
|
+
}
|
|
12
|
+
const isBackward = selection.isBackward();
|
|
13
|
+
if (isBackward) {
|
|
14
|
+
return $isAtNodeEnd(focus) ? anchorNode : focusNode;
|
|
15
|
+
}
|
|
16
|
+
return $isAtNodeEnd(anchor) ? anchorNode : focusNode;
|
|
17
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const VERTICAL_GAP = 10;
|
|
2
|
+
const HORIZONTAL_OFFSET = 5;
|
|
3
|
+
|
|
4
|
+
export function setFloatingElemPos(
|
|
5
|
+
targetRect: DOMRect | null,
|
|
6
|
+
floatingElem: HTMLElement,
|
|
7
|
+
anchorElem: HTMLElement,
|
|
8
|
+
verticalGap: number = VERTICAL_GAP,
|
|
9
|
+
horizontalOffset: number = HORIZONTAL_OFFSET,
|
|
10
|
+
): void {
|
|
11
|
+
const scrollerElem = anchorElem.parentElement;
|
|
12
|
+
|
|
13
|
+
if (targetRect === null || !scrollerElem) {
|
|
14
|
+
floatingElem.style.opacity = "0";
|
|
15
|
+
floatingElem.style.transform = "translate(-10000px, -10000px)";
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const floatingElemRect = floatingElem.getBoundingClientRect();
|
|
20
|
+
const anchorElementRect = anchorElem.getBoundingClientRect();
|
|
21
|
+
const editorScrollerRect = scrollerElem.getBoundingClientRect();
|
|
22
|
+
|
|
23
|
+
let top = targetRect.top - verticalGap;
|
|
24
|
+
let left = targetRect.left - horizontalOffset;
|
|
25
|
+
|
|
26
|
+
if (top < editorScrollerRect.top) {
|
|
27
|
+
top += floatingElemRect.height + targetRect.height + verticalGap * 2;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (left + floatingElemRect.width > editorScrollerRect.right) {
|
|
31
|
+
left = editorScrollerRect.right - floatingElemRect.width - horizontalOffset;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
top -= anchorElementRect.top;
|
|
35
|
+
left -= anchorElementRect.left;
|
|
36
|
+
|
|
37
|
+
floatingElem.style.opacity = "1";
|
|
38
|
+
floatingElem.style.transform = `translate(${left}px, ${top}px)`;
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const SUPPORTED_URL_PROTOCOLS = new Set(["http:", "https:", "mailto:", "sms:", "tel:"]);
|
|
2
|
+
|
|
3
|
+
export function sanitizeUrl(url: string): string {
|
|
4
|
+
try {
|
|
5
|
+
const parsedUrl = new URL(url);
|
|
6
|
+
if (!SUPPORTED_URL_PROTOCOLS.has(parsedUrl.protocol)) {
|
|
7
|
+
return "about:blank";
|
|
8
|
+
}
|
|
9
|
+
} catch {
|
|
10
|
+
return url;
|
|
11
|
+
}
|
|
12
|
+
return url;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Source: https://stackoverflow.com/a/8234912/2013580
|
|
16
|
+
const urlRegExp = new RegExp(
|
|
17
|
+
/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/,
|
|
18
|
+
);
|
|
19
|
+
export function validateUrl(url: string): boolean {
|
|
20
|
+
// TODO Fix UI for link insertion; it should never default to an invalid URL such as https://.
|
|
21
|
+
// Maybe show a dialog where they user can type the URL before inserting it.
|
|
22
|
+
return url === "https://" || urlRegExp.test(url);
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
|
|
4
|
+
type StateUpdatePluginProps = {
|
|
5
|
+
value: string;
|
|
6
|
+
onUpdate: (value: string) => void;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default function StateUpdatePlugin({ value, onUpdate }: StateUpdatePluginProps) {
|
|
10
|
+
const [editor] = useLexicalComposerContext();
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!editor) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
editor.update(() => onUpdate(value), { tag: "history-merge" });
|
|
18
|
+
}, [value, editor, onUpdate]);
|
|
19
|
+
|
|
20
|
+
return null;
|
|
21
|
+
}
|
package/src/components/rich-text/shared/plugins/TableActionMenuPlugin/TableActionMenuPlugin.tsx
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { Box, IconButton, Menu, Text } from "@chakra-ui/react";
|
|
2
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
3
|
+
import { useLexicalEditable } from "@lexical/react/useLexicalEditable";
|
|
4
|
+
import {
|
|
5
|
+
$deleteTableColumnAtSelection,
|
|
6
|
+
$deleteTableRowAtSelection,
|
|
7
|
+
$getTableCellNodeFromLexicalNode,
|
|
8
|
+
$insertTableColumnAtSelection,
|
|
9
|
+
$insertTableRowAtSelection,
|
|
10
|
+
TableCellNode,
|
|
11
|
+
} from "@lexical/table";
|
|
12
|
+
import { $getSelection, $isRangeSelection } from "lexical";
|
|
13
|
+
import { useEffect, useRef, useState } from "react";
|
|
14
|
+
import { createPortal } from "react-dom";
|
|
15
|
+
|
|
16
|
+
type TableCellActionMenuProps = Readonly<{
|
|
17
|
+
tableCellNode: TableCellNode;
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
function TableActionMenuItem(props: { label: string; onSelect: () => void; testId: string }) {
|
|
21
|
+
const { label, onSelect, testId } = props;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Menu.Item value={testId} onSelect={onSelect} data-test-id={testId}>
|
|
25
|
+
<Text lineClamp={1} textStyle="label/M/regular">
|
|
26
|
+
{label}
|
|
27
|
+
</Text>
|
|
28
|
+
</Menu.Item>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function TableActionMenu({ tableCellNode: _tableCellNode }: TableCellActionMenuProps) {
|
|
33
|
+
const [editor] = useLexicalComposerContext();
|
|
34
|
+
const [tableCellNode, updateTableCellNode] = useState(_tableCellNode);
|
|
35
|
+
const selectionCounts = { columns: 1, rows: 1 };
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
return editor.registerMutationListener(TableCellNode, (nodeMutations) => {
|
|
39
|
+
const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === "updated";
|
|
40
|
+
|
|
41
|
+
if (nodeUpdated) {
|
|
42
|
+
editor.getEditorState().read(() => {
|
|
43
|
+
updateTableCellNode(tableCellNode.getLatest());
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}, [editor, tableCellNode]);
|
|
48
|
+
|
|
49
|
+
const insertTableRowAtSelection = (shouldInsertAfter: boolean) => {
|
|
50
|
+
editor.update(() => {
|
|
51
|
+
$insertTableRowAtSelection(shouldInsertAfter);
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const insertTableColumnAtSelection = (shouldInsertAfter: boolean) => {
|
|
56
|
+
editor.update(() => {
|
|
57
|
+
for (let i = 0; i < selectionCounts.columns; i++) {
|
|
58
|
+
$insertTableColumnAtSelection(shouldInsertAfter);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const deleteTableRowAtSelection = () => {
|
|
64
|
+
editor.update(() => {
|
|
65
|
+
$deleteTableRowAtSelection();
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const deleteTableColumnAtSelection = () => {
|
|
70
|
+
editor.update(() => {
|
|
71
|
+
$deleteTableColumnAtSelection();
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return createPortal(
|
|
76
|
+
<Menu.Content>
|
|
77
|
+
<TableActionMenuItem
|
|
78
|
+
label={`Insert ${selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`} above`}
|
|
79
|
+
onSelect={() => insertTableRowAtSelection(false)}
|
|
80
|
+
testId="table-insert-row-above"
|
|
81
|
+
/>
|
|
82
|
+
<TableActionMenuItem
|
|
83
|
+
label={`Insert ${selectionCounts.rows === 1 ? "row" : `${selectionCounts.rows} rows`} below`}
|
|
84
|
+
onSelect={() => insertTableRowAtSelection(true)}
|
|
85
|
+
testId="table-insert-row-below"
|
|
86
|
+
/>
|
|
87
|
+
<Menu.Separator />
|
|
88
|
+
<TableActionMenuItem
|
|
89
|
+
label={`Insert ${selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`} left`}
|
|
90
|
+
onSelect={() => insertTableColumnAtSelection(false)}
|
|
91
|
+
testId="table-insert-column-before"
|
|
92
|
+
/>
|
|
93
|
+
<TableActionMenuItem
|
|
94
|
+
label={`Insert ${selectionCounts.columns === 1 ? "column" : `${selectionCounts.columns} columns`} right`}
|
|
95
|
+
onSelect={() => insertTableColumnAtSelection(true)}
|
|
96
|
+
testId="table-insert-column-after"
|
|
97
|
+
/>
|
|
98
|
+
<Menu.Separator />
|
|
99
|
+
<TableActionMenuItem
|
|
100
|
+
label="Delete column"
|
|
101
|
+
onSelect={() => deleteTableColumnAtSelection()}
|
|
102
|
+
testId="table-delete-columns"
|
|
103
|
+
/>
|
|
104
|
+
<TableActionMenuItem label="Delete row" onSelect={() => deleteTableRowAtSelection()} testId="table-delete-rows" />
|
|
105
|
+
</Menu.Content>,
|
|
106
|
+
document.body,
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function TableCellActionMenuContainer({ anchorElem }: { anchorElem: HTMLElement }) {
|
|
111
|
+
const [editor] = useLexicalComposerContext();
|
|
112
|
+
|
|
113
|
+
const menuButtonRef = useRef(null);
|
|
114
|
+
|
|
115
|
+
const [tableCellNode, setTableMenuCellNode] = useState<TableCellNode | null>(null);
|
|
116
|
+
|
|
117
|
+
const moveMenu = () => {
|
|
118
|
+
const menu = menuButtonRef.current;
|
|
119
|
+
const selection = $getSelection();
|
|
120
|
+
const nativeSelection = window.getSelection();
|
|
121
|
+
const activeElement = document.activeElement;
|
|
122
|
+
|
|
123
|
+
if (selection == null || menu == null) {
|
|
124
|
+
setTableMenuCellNode(null);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const rootElement = editor.getRootElement();
|
|
129
|
+
|
|
130
|
+
if (
|
|
131
|
+
$isRangeSelection(selection) &&
|
|
132
|
+
rootElement !== null &&
|
|
133
|
+
nativeSelection !== null &&
|
|
134
|
+
rootElement.contains(nativeSelection.anchorNode)
|
|
135
|
+
) {
|
|
136
|
+
const tableCellNodeFromSelection = $getTableCellNodeFromLexicalNode(selection.anchor.getNode());
|
|
137
|
+
|
|
138
|
+
if (tableCellNodeFromSelection == null) {
|
|
139
|
+
setTableMenuCellNode(null);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const tableCellParentNodeDOM = editor.getElementByKey(tableCellNodeFromSelection.getKey());
|
|
144
|
+
|
|
145
|
+
if (tableCellParentNodeDOM == null) {
|
|
146
|
+
setTableMenuCellNode(null);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
setTableMenuCellNode(tableCellNodeFromSelection);
|
|
151
|
+
} else if (!activeElement) {
|
|
152
|
+
setTableMenuCellNode(null);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
return editor.registerUpdateListener(() => {
|
|
158
|
+
editor.getEditorState().read(() => {
|
|
159
|
+
moveMenu();
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
const menuButtonDOM = menuButtonRef.current as HTMLButtonElement | null;
|
|
166
|
+
|
|
167
|
+
if (menuButtonDOM != null && tableCellNode != null) {
|
|
168
|
+
const tableCellNodeDOM = editor.getElementByKey(tableCellNode.getKey());
|
|
169
|
+
|
|
170
|
+
if (tableCellNodeDOM != null) {
|
|
171
|
+
const tableCellRect = tableCellNodeDOM.getBoundingClientRect();
|
|
172
|
+
const menuRect = menuButtonDOM.getBoundingClientRect();
|
|
173
|
+
const anchorRect = anchorElem.getBoundingClientRect();
|
|
174
|
+
|
|
175
|
+
const top = tableCellRect.top - anchorRect.top + 7;
|
|
176
|
+
const left = tableCellRect.right - menuRect.width - 10 - anchorRect.left;
|
|
177
|
+
|
|
178
|
+
menuButtonDOM.style.opacity = "1";
|
|
179
|
+
menuButtonDOM.style.transform = `translate(${left}px, ${top}px)`;
|
|
180
|
+
} else {
|
|
181
|
+
menuButtonDOM.style.opacity = "0";
|
|
182
|
+
menuButtonDOM.style.transform = "translate(-10000px, -10000px)";
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}, [tableCellNode, editor, anchorElem]);
|
|
186
|
+
|
|
187
|
+
const prevTableCellDOM = useRef(tableCellNode);
|
|
188
|
+
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
if (prevTableCellDOM.current !== tableCellNode) {
|
|
191
|
+
// close menu
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
prevTableCellDOM.current = tableCellNode;
|
|
195
|
+
}, [tableCellNode]);
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<Box position="absolute" top={0} left={0} willChange="transform" ref={menuButtonRef}>
|
|
199
|
+
{tableCellNode != null && (
|
|
200
|
+
<Menu.Root>
|
|
201
|
+
<Menu.Trigger asChild>
|
|
202
|
+
<IconButton size="xs" aria-label="Open table cell action menu">
|
|
203
|
+
<Text fontSize="xs" lineHeight="1">
|
|
204
|
+
...
|
|
205
|
+
</Text>
|
|
206
|
+
</IconButton>
|
|
207
|
+
</Menu.Trigger>
|
|
208
|
+
<Menu.Positioner>
|
|
209
|
+
<TableActionMenu tableCellNode={tableCellNode} />
|
|
210
|
+
</Menu.Positioner>
|
|
211
|
+
</Menu.Root>
|
|
212
|
+
)}
|
|
213
|
+
</Box>
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
interface TableCellActionMenuContainerProps {
|
|
218
|
+
anchorElem?: HTMLElement;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export function TableCellActionMenuPlugin({ anchorElem = document.body }: TableCellActionMenuContainerProps) {
|
|
222
|
+
const isEditable = useLexicalEditable();
|
|
223
|
+
return createPortal(isEditable ? <TableCellActionMenuContainer anchorElem={anchorElem} /> : null, anchorElem);
|
|
224
|
+
}
|