@collabchron/notiq 1.1.10 → 1.1.11
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 +281 -259
- package/dist/AICommandBarPlugin-TADJ3X2Y.mjs +12 -0
- package/dist/AIDialog-2WZUFWSC.mjs +325 -0
- package/dist/AudioComponent-CKLMLB5T.mjs +278 -0
- package/dist/CodeActionMenuPlugin-MRKY67ED.mjs +14 -0
- package/dist/CollaborationPlugin-TIZOQBUT.mjs +405 -0
- package/dist/CollaboratorsBar-TMKBOBJI.mjs +20 -0
- package/dist/CommentsPlugin-5M4RD6YO.mjs +19 -0
- package/dist/DynamicBlockComponent-2LOADZUX.mjs +221 -0
- package/dist/{EquationComponent-CB6DFIHV.mjs → EquationComponent-4NFG55NQ.mjs} +82 -46
- package/dist/ExcalidrawComponent-SIMURTCA.mjs +662 -0
- package/dist/ExcalidrawPlugin-2SGPIQ6U.mjs +14 -0
- package/dist/ExportPlugin-OKZOLBGS.mjs +42 -0
- package/dist/FileComponent-Y56MX5QD.mjs +200 -0
- package/dist/FloatingLinkEditorPlugin-MABB34L7.mjs +12 -0
- package/dist/FloatingTextFormatToolbarPlugin-SO5VON7Q.mjs +45 -0
- package/dist/HintComponet-ET7M2Q7S.mjs +288 -0
- package/dist/InlineCopilotPlugin-PNS5Y6OO.mjs +360 -0
- package/dist/{InlineImageComponent-UWIUWBHI.mjs → InlineImageComponent-FVTA4LXZ.mjs} +129 -99
- package/dist/MobileToolbar-JKP2MLQJ.mjs +984 -0
- package/dist/SlashCommand-2TNOOUBM.mjs +39 -0
- package/dist/StoryBuilderComponent-WQSNFPMM.mjs +816 -0
- package/dist/{TableCellActionMenuPlugin-PGK2K3VG.mjs → TableCellActionMenuPlugin-YWBA64J7.mjs} +328 -157
- package/dist/{TableHoverActionsPlugin-GJVE6VRW.mjs → TableHoverActionsPlugin-2EIXHEXN.mjs} +43 -36
- package/dist/{TemplatePlugin-ZD3QEVTI.mjs → TemplatePlugin-HNTPEXBB.mjs} +2 -2
- package/dist/ToolbarPlugin-IIAOU4P5.mjs +35 -0
- package/dist/VersionHistoryPlugin-23MAZB4G.mjs +371 -0
- package/dist/babel-RJXDAKDM.mjs +7287 -0
- package/dist/background-color-OZJCBYCT.mjs +425 -0
- package/dist/block-format-MTSIXWID.mjs +14 -0
- package/dist/chunk-2KESP7OU.mjs +809 -0
- package/dist/chunk-3AHNLIME.mjs +1701 -0
- package/dist/{chunk-GK35L7UY.mjs → chunk-3IILA3IP.mjs} +1 -1
- package/dist/chunk-3JN6QEJR.mjs +31 -0
- package/dist/{chunk-5BAKY5KN.mjs → chunk-43Z4Z2KD.mjs} +5 -8
- package/dist/{chunk-GXYD4VZM.mjs → chunk-4DVIYZVB.mjs} +1 -1
- package/dist/{chunk-7NZAPJ4G.mjs → chunk-4FFTOZGJ.mjs} +4 -3
- package/dist/chunk-4UMUPCDK.mjs +68 -0
- package/dist/{chunk-POGRR73N.mjs → chunk-5NRAXWYA.mjs} +4 -3
- package/dist/{chunk-PZSUSXQG.mjs → chunk-6D6QLRYR.mjs} +2 -2
- package/dist/chunk-6SRMKQSD.mjs +682 -0
- package/dist/{chunk-3CPBODXA.mjs → chunk-6UVNHT3T.mjs} +7 -27
- package/dist/{chunk-G53GLEAY.mjs → chunk-7QRJVZQY.mjs} +47 -22
- package/dist/chunk-ACV47ZKE.mjs +201 -0
- package/dist/{chunk-FSM26655.mjs → chunk-AMXRQ2TK.mjs} +4 -4
- package/dist/chunk-AYNKORDO.mjs +6 -0
- package/dist/{chunk-YUDCJRJM.mjs → chunk-BGV62GC2.mjs} +3 -2
- package/dist/{chunk-TCYK7DM7.mjs → chunk-CDAMHK63.mjs} +4 -3
- package/dist/{chunk-QHIQKMVN.mjs → chunk-D3IOUQFR.mjs} +125 -111
- package/dist/chunk-EEBA6OAH.mjs +59 -0
- package/dist/{chunk-YKC3SO4Z.mjs → chunk-EIZMKFHF.mjs} +1 -1
- package/dist/{chunk-4EXYCTGJ.mjs → chunk-EVPWKNE4.mjs} +3 -3
- package/dist/{chunk-K36V4SIW.mjs → chunk-FMJ7DGWP.mjs} +23 -20
- package/dist/{chunk-RBWZGXPF.mjs → chunk-FYLRS4BG.mjs} +5 -5
- package/dist/{chunk-N3WN46VL.mjs → chunk-GYYLZ3MQ.mjs} +23 -22
- package/dist/{chunk-WDG7J2DY.mjs → chunk-H3P47YXJ.mjs} +30 -19
- package/dist/chunk-HOZ4QRFV.mjs +536 -0
- package/dist/{chunk-5QSNIVIG.mjs → chunk-IAFCQV3Z.mjs} +94 -78
- package/dist/{chunk-64Z3FI7T.mjs → chunk-IIVB6JNE.mjs} +5 -4
- package/dist/chunk-IU2N42JJ.mjs +1763 -0
- package/dist/chunk-IUOUIDEQ.mjs +70 -0
- package/dist/chunk-J6ZUY5BY.mjs +202 -0
- package/dist/{chunk-YHPNOWFH.mjs → chunk-JHXDLYEV.mjs} +1 -1
- package/dist/{chunk-ZB5LZQKC.mjs → chunk-K5OAFEVY.mjs} +1 -1
- package/dist/chunk-KDA7ZYMJ.mjs +431 -0
- package/dist/{chunk-3JVFG7ER.mjs → chunk-KNW2CGIP.mjs} +7 -64
- package/dist/{chunk-4HBCVSE6.mjs → chunk-KXRLARGI.mjs} +1 -1
- package/dist/chunk-LAUAYRPC.mjs +944 -0
- package/dist/chunk-LLCP7NVE.mjs +449 -0
- package/dist/chunk-LU2XWLOE.mjs +219 -0
- package/dist/chunk-MPTE332I.mjs +787 -0
- package/dist/{chunk-456TN7IM.mjs → chunk-MTQZWJHR.mjs} +17 -16
- package/dist/{chunk-LGG4IUIA.mjs → chunk-MW6MAUY3.mjs} +2 -2
- package/dist/chunk-N3WTT2U6.mjs +21 -0
- package/dist/{chunk-GZPNVR7L.mjs → chunk-N6ILV6NF.mjs} +7 -6
- package/dist/{chunk-QEIFVK5M.mjs → chunk-NBE6FF6L.mjs} +4 -4
- package/dist/{chunk-BIU7WTLX.mjs → chunk-OE5JRLCN.mjs} +21 -18
- package/dist/chunk-OXWTZV3U.mjs +174 -0
- package/dist/{chunk-Z4EWP7BI.mjs → chunk-PD5K4AGP.mjs} +22 -23
- package/dist/chunk-PFH63ZU4.mjs +33 -0
- package/dist/chunk-PHRVYPVM.mjs +808 -0
- package/dist/chunk-R7WFRENU.mjs +262 -0
- package/dist/{chunk-4VWFVWYP.mjs → chunk-RAVYEEIC.mjs} +1 -1
- package/dist/chunk-RJQTA6HG.mjs +358 -0
- package/dist/{chunk-7VUMHWWL.mjs → chunk-SAOJHVPE.mjs} +5 -4
- package/dist/chunk-TC3IISJZ.mjs +408 -0
- package/dist/chunk-VGAX6YEY.mjs +399 -0
- package/dist/chunk-W6GAJXUS.mjs +334 -0
- package/dist/{chunk-U47ABU5Z.mjs → chunk-W6VQSFE5.mjs} +2 -2
- package/dist/chunk-WYCFGRFJ.mjs +118 -0
- package/dist/chunk-XAVQAXOJ.mjs +419 -0
- package/dist/chunk-XYDBUQ6Z.mjs +1978 -0
- package/dist/chunk-XYMXGU4T.mjs +129 -0
- package/dist/chunk-XYT6XM5S.mjs +496 -0
- package/dist/{chunk-HJPPNHYM.mjs → chunk-XZXGYNTY.mjs} +4 -3
- package/dist/{chunk-4GFXER7R.mjs → chunk-YDDBQZ77.mjs} +141 -89
- package/dist/{chunk-2FNEAMSP.mjs → chunk-YE7M2VKR.mjs} +52 -47
- package/dist/{chunk-3G37YKTV.mjs → chunk-YR2DD74C.mjs} +9 -8
- package/dist/{chunk-4MEDW3T6.mjs → chunk-YTLUQJE2.mjs} +5 -4
- package/dist/{chunk-DSFQHA7I.mjs → chunk-Z6JAFF55.mjs} +118 -295
- package/dist/chunk-ZFV2HGD3.mjs +143 -0
- package/dist/{chunk-77UA6HYR.mjs → chunk-ZKZ7MLSS.mjs} +1 -1
- package/dist/color-23323E3B.mjs +13 -0
- package/dist/components/canvas/CanvasMode.d.ts +18 -0
- package/dist/components/editor/Core.d.ts +6 -0
- package/dist/components/editor/index.d.ts +27 -0
- package/dist/components/editor/lexical-on-change.d.ts +1 -0
- package/dist/components/editor/nodes/AudioNode/AudioComponent.d.ts +15 -0
- package/dist/components/editor/nodes/AudioNode/index.d.ts +36 -0
- package/dist/components/editor/nodes/CollapsibleNode/CollapsibleContainerNode.d.ts +22 -0
- package/dist/components/editor/nodes/CollapsibleNode/CollapsibleContentNode.d.ts +18 -0
- package/dist/components/editor/nodes/CollapsibleNode/CollapsibleTitleNode.d.ts +19 -0
- package/dist/components/editor/nodes/DynamicBlockNode/DynamicBlockComponent.d.ts +7 -0
- package/dist/components/editor/nodes/DynamicBlockNode/DynamicBlockNode.d.ts +49 -0
- package/dist/components/editor/nodes/EquationNode/EquationComponent.d.ts +16 -0
- package/dist/components/editor/nodes/EquationNode/EquationNode.d.ts +33 -0
- package/dist/components/editor/nodes/ExcalidrawNode/ExcalidrawComponent.d.ts +15 -0
- package/dist/components/editor/nodes/ExcalidrawNode/ExcalidrawImage.d.ts +57 -0
- package/dist/components/editor/nodes/ExcalidrawNode/ImageResizer.d.ts +24 -0
- package/dist/components/editor/nodes/ExcalidrawNode/index.d.ts +39 -0
- package/dist/components/editor/nodes/FigmaNode/FigmaNode.d.ts +27 -0
- package/dist/components/editor/nodes/FileNode/FileComponent.d.ts +16 -0
- package/dist/components/editor/nodes/FileNode/index.d.ts +39 -0
- package/dist/components/editor/nodes/Hint/HintComponet.d.ts +20 -0
- package/dist/components/editor/nodes/Hint/index.d.ts +33 -0
- package/dist/components/editor/nodes/ImageNode/index.d.ts +62 -0
- package/dist/components/editor/nodes/InlineImageNode/InlineImageComponent.d.ts +25 -0
- package/dist/components/editor/nodes/InlineImageNode/InlineImageNode.d.ts +66 -0
- package/dist/components/editor/nodes/LayoutNode/LayoutContainerNode.d.ts +31 -0
- package/dist/components/editor/nodes/LayoutNode/LayoutItemNode.d.ts +21 -0
- package/dist/components/editor/nodes/PollNode/index.d.ts +34 -0
- package/dist/components/editor/nodes/Stepper/index.d.ts +66 -0
- package/dist/components/editor/nodes/StoryBuilderNode/StoryBuilderComponent.d.ts +10 -0
- package/dist/components/editor/nodes/StoryBuilderNode/StoryBuilderNode.d.ts +59 -0
- package/dist/components/editor/nodes/TweetNode/index.d.ts +21 -0
- package/dist/components/editor/nodes/index.d.ts +4 -0
- package/dist/components/editor/plugins/AICommandBarPlugin/index.d.ts +7 -0
- package/dist/components/editor/plugins/AudioPlugin/index.d.ts +1 -0
- package/dist/components/editor/plugins/AutoEmbedPlugin/index.d.ts +19 -0
- package/dist/components/editor/plugins/AutoLinkPlugin/index.d.ts +1 -0
- package/dist/components/editor/plugins/CodeActionMenuPlugin/components/CopyButton.d.ts +8 -0
- package/dist/components/editor/plugins/CodeActionMenuPlugin/components/PrettierButton.d.ts +9 -0
- package/dist/components/editor/plugins/CodeActionMenuPlugin/index.d.ts +4 -0
- package/dist/components/editor/plugins/CodeActionMenuPlugin/utils.d.ts +1 -0
- package/dist/components/editor/plugins/CodeHighlightPlugin/index.d.ts +11 -0
- package/dist/components/editor/plugins/CollaborationPlugin/CollaboratorsBar.d.ts +9 -0
- package/dist/components/editor/plugins/CollaborationPlugin/index.d.ts +8 -0
- package/dist/components/editor/plugins/CollapsiblePlugin/index.d.ts +4 -0
- package/dist/components/editor/plugins/CommentsPlugin/CommentThreadItem.d.ts +7 -0
- package/dist/components/editor/plugins/CommentsPlugin/CommentsSidebar.d.ts +2 -0
- package/dist/components/editor/plugins/CommentsPlugin/MentionsAutocomplete.d.ts +22 -0
- package/dist/components/editor/plugins/CommentsPlugin/NewCommentDialog.d.ts +2 -0
- package/dist/components/editor/plugins/CommentsPlugin/index.d.ts +5 -0
- package/dist/components/editor/plugins/ContentAnalyticsPlugin/index.d.ts +1 -0
- package/dist/components/editor/plugins/DragDropPastePlugin/index.d.ts +1 -0
- package/dist/components/editor/plugins/DraggableBlockPlugin/index.d.ts +5 -0
- package/dist/components/editor/plugins/DynamicBlockPlugin/index.d.ts +7 -0
- package/dist/components/editor/plugins/EquationsPlugin/index.d.ts +20 -0
- package/dist/components/editor/plugins/ExcalidrawPlugin/index.d.ts +5 -0
- package/dist/components/editor/plugins/ExportPlugin/ImportExportModal.d.ts +9 -0
- package/dist/components/editor/plugins/ExportPlugin/index.d.ts +28 -0
- package/dist/components/editor/plugins/FigmaPlugin/index.d.ts +11 -0
- package/dist/components/editor/plugins/FilePlugin/index.d.ts +1 -0
- package/dist/components/editor/plugins/FloatingLinkEditorPlugin/index.d.ts +6 -0
- package/dist/components/editor/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +6 -0
- package/dist/components/editor/plugins/ImagesPlugin/index.d.ts +14 -0
- package/dist/components/editor/plugins/InlineCopilotPlugin/index.d.ts +32 -0
- package/dist/components/editor/plugins/InlineImagePlugin/index.d.ts +16 -0
- package/dist/components/editor/plugins/LayoutPlugin/index.d.ts +14 -0
- package/dist/components/editor/plugins/LinkPlugin/index.d.ts +13 -0
- package/dist/components/editor/plugins/LinkWithMetaData/index.d.ts +46 -0
- package/dist/components/editor/plugins/MarkdownShortcutPlugin/index.d.ts +2 -0
- package/dist/components/editor/plugins/MarkdownTransformers/index.d.ts +12 -0
- package/dist/components/editor/plugins/PollPlugin/index.d.ts +4 -0
- package/dist/components/editor/plugins/ShortcutsPlugin/index.d.ts +13 -0
- package/dist/components/editor/plugins/ShortcutsPlugin/shortcuts.d.ts +58 -0
- package/dist/components/editor/plugins/SlashCommand/index.d.ts +25 -0
- package/dist/components/editor/plugins/SpeechToTextPlugin/index.d.ts +5 -0
- package/dist/components/editor/plugins/StoryBuilderPlugin/index.d.ts +7 -0
- package/dist/components/editor/plugins/TabFocusPlugin/index.d.ts +1 -0
- package/dist/components/editor/plugins/TableCellActionMenuPlugin/index.d.ts +5 -0
- package/dist/components/editor/plugins/TableCellResizer/index.d.ts +2 -0
- package/dist/components/editor/plugins/TableHoverActionsPlugin/index.d.ts +4 -0
- package/dist/components/editor/plugins/TablePlugin/index.d.ts +27 -0
- package/dist/components/editor/plugins/TemplatePlugin/TemplateDialog.d.ts +1 -0
- package/dist/components/editor/plugins/TemplatePlugin/index.d.ts +3 -0
- package/dist/components/editor/plugins/ToolbarPlugin/MobileToolbar.d.ts +10 -0
- package/dist/components/editor/plugins/ToolbarPlugin/index.d.ts +11 -0
- package/dist/components/editor/plugins/TwitterPlugin/index.d.ts +4 -0
- package/dist/components/editor/plugins/VersionHistoryPlugin/NameVersionModal.d.ts +2 -0
- package/dist/components/editor/plugins/VersionHistoryPlugin/VersionHistoryDrawer.d.ts +2 -0
- package/dist/components/editor/plugins/VersionHistoryPlugin/index.d.ts +2 -0
- package/dist/components/editor/plugins/YouTubeNode/index.d.ts +22 -0
- package/dist/components/editor/plugins/YouTubePlugin/index.d.ts +11 -0
- package/dist/components/editor/templates/data.d.ts +7 -0
- package/dist/components/editor/themes/editor-theme.d.ts +3 -0
- package/dist/components/editor/utils/ai.d.ts +27 -0
- package/dist/components/editor/utils/canUseDOM.d.ts +8 -0
- package/dist/components/editor/utils/codeLanguages.d.ts +3 -0
- package/dist/components/editor/utils/diffUtils.d.ts +10 -0
- package/dist/components/editor/utils/editorFormatting.d.ts +26 -0
- package/dist/components/editor/utils/environment.d.ts +17 -0
- package/dist/components/editor/utils/extract-data.d.ts +8 -0
- package/dist/components/editor/utils/getAllLexicalChildren.d.ts +6 -0
- package/dist/components/editor/utils/getDOMRangeRect.d.ts +8 -0
- package/dist/components/editor/utils/getSelectedNode.d.ts +2 -0
- package/dist/components/editor/utils/gif.d.ts +7 -0
- package/dist/components/editor/utils/importUtils.d.ts +27 -0
- package/dist/components/editor/utils/invariant.d.ts +1 -0
- package/dist/components/editor/utils/markdownTransformers.d.ts +20 -0
- package/dist/components/editor/utils/setFloatingElemPosition.d.ts +1 -0
- package/dist/components/editor/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -0
- package/dist/components/editor/utils/setNodePlaceholderFromSelection/getNodePlaceholder.d.ts +2 -0
- package/dist/components/editor/utils/setNodePlaceholderFromSelection/setNodePlaceholderFromSelection.d.ts +2 -0
- package/dist/components/editor/utils/setNodePlaceholderFromSelection/setPlaceholderOnSelection.d.ts +5 -0
- package/dist/components/editor/utils/url.d.ts +11 -0
- package/dist/components/editor/utils/useLayoutEffect.d.ts +3 -0
- package/dist/components/providers/AIContext.d.ts +21 -0
- package/dist/components/providers/CollabContext.d.ts +92 -0
- package/dist/components/providers/CommentsContext.d.ts +48 -0
- package/dist/components/providers/QueryProvider.d.ts +5 -0
- package/dist/components/providers/SharedHistoryContext.d.ts +11 -0
- package/dist/components/providers/ToolbarContext.d.ts +61 -0
- package/dist/components/providers/UploadContext.d.ts +29 -0
- package/dist/components/providers/VersionHistoryContext.d.ts +33 -0
- package/dist/components/providers/theme-provider.d.ts +3 -0
- package/dist/components/theme/ModeToggle.d.ts +2 -0
- package/dist/components/ui/ContentEditable.d.ts +15 -0
- package/dist/components/ui/FileInput.d.ts +16 -0
- package/dist/components/ui/Modal.d.ts +15 -0
- package/dist/components/ui/Select.d.ts +14 -0
- package/dist/components/ui/TextInput.d.ts +19 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/ai/AIDialog.d.ts +9 -0
- package/dist/components/ui/ai/ai-button.d.ts +5 -0
- package/dist/components/ui/ai/border.d.ts +8 -0
- package/dist/components/ui/ai/placeholder-input-vanish.d.ts +6 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/button.d.ts +12 -0
- package/dist/components/ui/card.d.ts +8 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/command.d.ts +80 -0
- package/dist/components/ui/dialog/Dialog.d.ts +16 -0
- package/dist/components/ui/dialog.d.ts +19 -0
- package/dist/components/ui/drop-downs/background-color.d.ts +12 -0
- package/dist/components/ui/drop-downs/block-format.d.ts +25 -0
- package/dist/components/ui/drop-downs/code.d.ts +6 -0
- package/dist/components/ui/drop-downs/codeTheme.d.ts +8 -0
- package/dist/components/ui/drop-downs/color.d.ts +12 -0
- package/dist/components/ui/drop-downs/font-size.d.ts +10 -0
- package/dist/components/ui/drop-downs/font.d.ts +11 -0
- package/dist/components/ui/drop-downs/index.d.ts +24 -0
- package/dist/components/ui/drop-downs/insert-node.d.ts +6 -0
- package/dist/components/ui/drop-downs/table-dropdown.d.ts +10 -0
- package/dist/components/ui/drop-downs/text-align.d.ts +8 -0
- package/dist/components/ui/drop-downs/text-format.d.ts +11 -0
- package/dist/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/equation/EquationEditor.d.ts +14 -0
- package/dist/components/ui/equation/KatexEquationAlterer.d.ts +14 -0
- package/dist/components/ui/equation/KatexRenderer.d.ts +13 -0
- package/dist/components/ui/excalidraw/ExcalidrawModal.d.ts +48 -0
- package/dist/components/ui/excalidraw/Modal.d.ts +16 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/icons/brand-icons.d.ts +5 -0
- package/dist/components/ui/image/error-image.d.ts +2 -0
- package/dist/components/ui/image/file-upload.d.ts +8 -0
- package/dist/components/ui/image/image-resizer.d.ts +10 -0
- package/dist/components/ui/image/image-toolbar.d.ts +8 -0
- package/dist/components/ui/image/index.d.ts +16 -0
- package/dist/components/ui/image/lazy-image.d.ts +10 -0
- package/dist/components/ui/image/lazy-video.d.ts +11 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/models/custom-dialog.d.ts +58 -0
- package/dist/components/ui/models/insert-audio.d.ts +7 -0
- package/dist/components/ui/models/insert-file.d.ts +7 -0
- package/dist/components/ui/models/insert-gif.d.ts +7 -0
- package/dist/components/ui/models/insert-image.d.ts +6 -0
- package/dist/components/ui/models/insert-poll.d.ts +5 -0
- package/dist/components/ui/models/insert-table.d.ts +6 -0
- package/dist/components/ui/models/use-model.d.ts +6 -0
- package/dist/components/ui/poll/poll-component.d.ts +8 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/sonner.d.ts +4 -0
- package/dist/components/ui/stepper/step.d.ts +11 -0
- package/dist/components/ui/stepper/stepper.d.ts +6 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/toggle.d.ts +14 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/write/text-format-floating.d.ts +27 -0
- package/dist/components/ui/write/text-format-floting-toolbar.d.ts +26 -0
- package/dist/core/chain.d.ts +4 -0
- package/dist/core/editor.d.ts +42 -0
- package/dist/core/extension.d.ts +20 -0
- package/dist/core/extensions/blocks-kit.d.ts +14 -0
- package/dist/core/extensions/copilot-and-collab.d.ts +10 -0
- package/dist/core/extensions/nodes-and-marks.d.ts +36 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/react/BubbleMenu.d.ts +13 -0
- package/dist/core/react/FloatingMenu.d.ts +12 -0
- package/dist/core/react/NotiqContent.d.ts +11 -0
- package/dist/core/react/NotiqEditor.d.ts +29 -0
- package/dist/core/react/context.d.ts +15 -0
- package/dist/core/react/index.d.ts +8 -0
- package/dist/core/react/useNotiq.d.ts +16 -0
- package/dist/core/types.d.ts +88 -0
- package/dist/core.d.ts +1 -0
- package/dist/core.js +67719 -0
- package/dist/core.mjs +132 -0
- package/dist/estree-QRALCFII.mjs +5029 -0
- package/dist/font-IJKFR4BM.mjs +12 -0
- package/dist/font-size-GTL6UVQL.mjs +15 -0
- package/dist/hooks/instructions-messages.d.ts +11 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/useModal.d.ts +12 -0
- package/dist/hooks/useReport.d.ts +8 -0
- package/dist/hooks/useResizeObservert.d.ts +1 -0
- package/dist/html-CE2S5FIJ.mjs +3185 -0
- package/dist/{image-2PJIAYAT.mjs → image-TPW7PZZK.mjs} +360 -325
- package/dist/index.d.ts +13 -145
- package/dist/index.js +61780 -44629
- package/dist/index.mjs +1157 -736
- package/dist/insert-audio-C66RZRKY.mjs +180 -0
- package/dist/insert-file-3DTGRO7W.mjs +190 -0
- package/dist/insert-gif-FIMCCBAI.mjs +112 -0
- package/dist/insert-image-CZV6HWQZ.mjs +348 -0
- package/dist/insert-node-MA3FXEYN.mjs +245 -0
- package/dist/insert-poll-6BCIFY5G.mjs +36 -0
- package/dist/insert-table-ZRJP6X52.mjs +70 -0
- package/dist/lib/edgestore.d.ts +2 -0
- package/dist/lib/index.d.ts +0 -0
- package/dist/lib/pinecone-client.d.ts +3 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/markdown-GMCB4RDA.mjs +6753 -0
- package/dist/{poll-component-2R4MDLHS.mjs → poll-component-VHMM5KKZ.mjs} +126 -95
- package/dist/{postcss-ONF3VDIM.mjs → postcss-GH4QXSB5.mjs} +1879 -1697
- package/dist/react.d.ts +1 -0
- package/dist/react.js +67651 -0
- package/dist/react.mjs +61 -0
- package/dist/standalone-A6VDOPCZ.mjs +2506 -0
- package/dist/stepper-4AO5XMO7.mjs +356 -0
- package/dist/styles/notiq.css +2 -2
- package/dist/styles/tailwind-plugin.d.ts +4 -0
- package/dist/table-dropdown-4VCRSQB6.mjs +391 -0
- package/dist/{text-align-VLECWO4H.mjs → text-align-CSDLJUDA.mjs} +24 -21
- package/dist/text-format-6L5N3CHZ.mjs +15 -0
- package/dist/typescript-CGC67LRI.mjs +13392 -0
- package/dist/utils/docSerialization.d.ts +10 -0
- package/dist/utils/emoji-list.d.ts +27 -0
- package/dist/utils/getDOMRangeRect.d.ts +8 -0
- package/dist/utils/getSelectedNode.d.ts +2 -0
- package/dist/utils/getThemeSelector.d.ts +9 -0
- package/dist/utils/html.d.ts +9 -0
- package/dist/utils/htmlExport.d.ts +9 -0
- package/dist/utils/isMobileWidth.d.ts +7 -0
- package/dist/utils/joinClasses.d.ts +8 -0
- package/dist/utils/setFloatingElemPosition.d.ts +1 -0
- package/dist/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -0
- package/dist/utils/swipe.d.ts +11 -0
- package/dist/utils/url.d.ts +9 -0
- package/package.json +128 -105
- package/src/styles/notiq.css +1315 -1150
- package/dist/CodeActionMenuPlugin-EINOY4U4.mjs +0 -15
- package/dist/DynamicBlockComponent-NRQJ4WW4.mjs +0 -161
- package/dist/ExcalidrawComponent-LUZJNFWV.mjs +0 -528
- package/dist/ExcalidrawPlugin-HC2L43YG.mjs +0 -14
- package/dist/ExportPlugin-V2RLM63S.mjs +0 -11
- package/dist/FloatingLinkEditorPlugin-TRTCMSP4.mjs +0 -12
- package/dist/FloatingTextFormatToolbarPlugin-ENECEZSX.mjs +0 -30
- package/dist/HintComponet-BRL6EAMS.mjs +0 -217
- package/dist/MobileToolbar-BOOZAMQE.mjs +0 -268
- package/dist/SlashCommand-FHEWHFZU.mjs +0 -28
- package/dist/StoryBuilderComponent-JGDBM5JU.mjs +0 -562
- package/dist/ToolbarPlugin-2VP7FDWD.mjs +0 -1547
- package/dist/babel-JZ2EV6AX.mjs +0 -7233
- package/dist/background-color-XZTYLGO2.mjs +0 -362
- package/dist/block-format-YJCV2DIY.mjs +0 -15
- package/dist/chunk-77KXU36M.mjs +0 -64
- package/dist/chunk-AMMKBSST.mjs +0 -1256
- package/dist/chunk-EGMI62PP.mjs +0 -83
- package/dist/chunk-JXDPPUJI.mjs +0 -52
- package/dist/chunk-KJ6AJ44Q.mjs +0 -128
- package/dist/chunk-NOJDE3CE.mjs +0 -1906
- package/dist/chunk-NZXC6FGU.mjs +0 -214
- package/dist/chunk-PBD6LMLC.mjs +0 -366
- package/dist/chunk-TTHQCW5F.mjs +0 -47
- package/dist/chunk-V2NIZOSQ.mjs +0 -538
- package/dist/chunk-WAK5JGNJ.mjs +0 -315
- package/dist/chunk-YMBXLRW5.mjs +0 -374
- package/dist/chunk-YPHOEJ46.mjs +0 -64
- package/dist/chunk-ZJRKATOJ.mjs +0 -65
- package/dist/color-BPKOPQKN.mjs +0 -12
- package/dist/estree-XC56IUFX.mjs +0 -4414
- package/dist/font-FEZ3GKSF.mjs +0 -13
- package/dist/font-size-EK775WRH.mjs +0 -15
- package/dist/html-S3ACX7NI.mjs +0 -2738
- package/dist/index.d.mts +0 -145
- package/dist/insert-gif-SAIDYURE.mjs +0 -100
- package/dist/insert-image-U3RJN3OW.mjs +0 -259
- package/dist/insert-node-WXW4ZER4.mjs +0 -201
- package/dist/insert-poll-HCPM7MO6.mjs +0 -33
- package/dist/insert-table-24XYUS2W.mjs +0 -66
- package/dist/markdown-SNVBOSRA.mjs +0 -3487
- package/dist/standalone-EOIALU3M.mjs +0 -2373
- package/dist/stepper-JDEE26TX.mjs +0 -304
- package/dist/text-format-BG5WOOPZ.mjs +0 -16
- package/dist/typescript-AMPI6OVS.mjs +0 -13135
|
@@ -0,0 +1,1701 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TextFormat
|
|
3
|
+
} from "./chunk-MTQZWJHR.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Font
|
|
6
|
+
} from "./chunk-SAOJHVPE.mjs";
|
|
7
|
+
import {
|
|
8
|
+
FontSize
|
|
9
|
+
} from "./chunk-YE7M2VKR.mjs";
|
|
10
|
+
import {
|
|
11
|
+
ExtractData,
|
|
12
|
+
getSelectedText,
|
|
13
|
+
insertText,
|
|
14
|
+
insertTextUnderSelected,
|
|
15
|
+
replaceSelectedText
|
|
16
|
+
} from "./chunk-XAVQAXOJ.mjs";
|
|
17
|
+
import {
|
|
18
|
+
BlockFormatDropDown
|
|
19
|
+
} from "./chunk-FMJ7DGWP.mjs";
|
|
20
|
+
import {
|
|
21
|
+
INSERT_COMMENT_COMMAND
|
|
22
|
+
} from "./chunk-LAUAYRPC.mjs";
|
|
23
|
+
import {
|
|
24
|
+
Color
|
|
25
|
+
} from "./chunk-KDA7ZYMJ.mjs";
|
|
26
|
+
import {
|
|
27
|
+
useAI
|
|
28
|
+
} from "./chunk-BGV62GC2.mjs";
|
|
29
|
+
import {
|
|
30
|
+
Toggle
|
|
31
|
+
} from "./chunk-PD5K4AGP.mjs";
|
|
32
|
+
import {
|
|
33
|
+
getSelectedNode
|
|
34
|
+
} from "./chunk-KXRLARGI.mjs";
|
|
35
|
+
import {
|
|
36
|
+
SHORTCUTS
|
|
37
|
+
} from "./chunk-K5OAFEVY.mjs";
|
|
38
|
+
import {
|
|
39
|
+
Command,
|
|
40
|
+
CommandEmpty,
|
|
41
|
+
CommandGroup,
|
|
42
|
+
CommandInput,
|
|
43
|
+
CommandItem,
|
|
44
|
+
CommandList,
|
|
45
|
+
CommandSeparator
|
|
46
|
+
} from "./chunk-LU2XWLOE.mjs";
|
|
47
|
+
import {
|
|
48
|
+
Separator
|
|
49
|
+
} from "./chunk-CDAMHK63.mjs";
|
|
50
|
+
import {
|
|
51
|
+
sanitizeUrl
|
|
52
|
+
} from "./chunk-RAVYEEIC.mjs";
|
|
53
|
+
import {
|
|
54
|
+
Popover,
|
|
55
|
+
PopoverContent,
|
|
56
|
+
PopoverTrigger
|
|
57
|
+
} from "./chunk-IIVB6JNE.mjs";
|
|
58
|
+
import {
|
|
59
|
+
cn
|
|
60
|
+
} from "./chunk-JHXDLYEV.mjs";
|
|
61
|
+
import {
|
|
62
|
+
__objRest,
|
|
63
|
+
__spreadProps,
|
|
64
|
+
__spreadValues,
|
|
65
|
+
init_react_shim
|
|
66
|
+
} from "./chunk-WYCFGRFJ.mjs";
|
|
67
|
+
|
|
68
|
+
// src/components/editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx
|
|
69
|
+
init_react_shim();
|
|
70
|
+
import { $isCodeHighlightNode } from "@lexical/code";
|
|
71
|
+
import { $isLinkNode } from "@lexical/link";
|
|
72
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
73
|
+
import {
|
|
74
|
+
$findMatchingParent,
|
|
75
|
+
$getNearestNodeOfType,
|
|
76
|
+
mergeRegister as mergeRegister2
|
|
77
|
+
} from "@lexical/utils";
|
|
78
|
+
import {
|
|
79
|
+
$getSelection as $getSelection2,
|
|
80
|
+
$isParagraphNode,
|
|
81
|
+
$isRangeSelection,
|
|
82
|
+
$isRootOrShadowRoot,
|
|
83
|
+
$isTextNode,
|
|
84
|
+
getDOMSelection as getDOMSelection2
|
|
85
|
+
} from "lexical";
|
|
86
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useState as useState5 } from "react";
|
|
87
|
+
import { createPortal } from "react-dom";
|
|
88
|
+
import {
|
|
89
|
+
$getSelectionStyleValueForProperty
|
|
90
|
+
} from "@lexical/selection";
|
|
91
|
+
import { useRef as useRef4 } from "react";
|
|
92
|
+
import { $isTableNode } from "@lexical/table";
|
|
93
|
+
import { $isListNode, ListNode } from "@lexical/list";
|
|
94
|
+
import { $isHeadingNode } from "@lexical/rich-text";
|
|
95
|
+
|
|
96
|
+
// src/components/ui/write/text-format-floting-toolbar.tsx
|
|
97
|
+
init_react_shim();
|
|
98
|
+
import {
|
|
99
|
+
$getSelection,
|
|
100
|
+
COMMAND_PRIORITY_LOW,
|
|
101
|
+
FORMAT_TEXT_COMMAND,
|
|
102
|
+
getDOMSelection,
|
|
103
|
+
SELECTION_CHANGE_COMMAND
|
|
104
|
+
} from "lexical";
|
|
105
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef3 } from "react";
|
|
106
|
+
import { TOGGLE_LINK_COMMAND } from "@lexical/link";
|
|
107
|
+
|
|
108
|
+
// src/components/editor/utils/getDOMRangeRect.ts
|
|
109
|
+
init_react_shim();
|
|
110
|
+
function getDOMRangeRect(nativeSelection, rootElement) {
|
|
111
|
+
const domRange = nativeSelection.getRangeAt(0);
|
|
112
|
+
let rect;
|
|
113
|
+
if (nativeSelection.anchorNode === rootElement) {
|
|
114
|
+
let inner = rootElement;
|
|
115
|
+
while (inner.firstElementChild != null) {
|
|
116
|
+
inner = inner.firstElementChild;
|
|
117
|
+
}
|
|
118
|
+
rect = inner.getBoundingClientRect();
|
|
119
|
+
} else {
|
|
120
|
+
rect = domRange.getBoundingClientRect();
|
|
121
|
+
}
|
|
122
|
+
return rect;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// src/components/editor/utils/setFloatingElemPosition.ts
|
|
126
|
+
init_react_shim();
|
|
127
|
+
var VERTICAL_GAP = 10;
|
|
128
|
+
var HORIZONTAL_OFFSET = 5;
|
|
129
|
+
function isKeyboardOpen() {
|
|
130
|
+
if (typeof window === "undefined") return false;
|
|
131
|
+
const isMobile = window.innerWidth < 768;
|
|
132
|
+
if (!isMobile) return false;
|
|
133
|
+
const activeElement = document.activeElement;
|
|
134
|
+
const isInputFocused = activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA" || activeElement instanceof HTMLElement && activeElement.contentEditable === "true" || activeElement.getAttribute("contenteditable") === "true");
|
|
135
|
+
return !!isInputFocused;
|
|
136
|
+
}
|
|
137
|
+
function getKeyboardHeight() {
|
|
138
|
+
if (typeof window === "undefined") return 0;
|
|
139
|
+
const isMobile = window.innerWidth < 768;
|
|
140
|
+
if (!isMobile) return 0;
|
|
141
|
+
return 280;
|
|
142
|
+
}
|
|
143
|
+
function setFloatingElemPosition(targetRect, floatingElem, anchorElem, verticalGap = VERTICAL_GAP, horizontalOffset = HORIZONTAL_OFFSET) {
|
|
144
|
+
const scrollerElem = anchorElem.parentElement;
|
|
145
|
+
if (targetRect === null || !scrollerElem) {
|
|
146
|
+
floatingElem.style.opacity = "0";
|
|
147
|
+
floatingElem.style.transform = "translate(-10000px, -10000px)";
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const floatingElemRect = floatingElem.getBoundingClientRect();
|
|
151
|
+
const anchorElementRect = anchorElem.getBoundingClientRect();
|
|
152
|
+
const editorScrollerRect = scrollerElem.getBoundingClientRect();
|
|
153
|
+
const isMobile = window.innerWidth < 768;
|
|
154
|
+
const keyboardOpen = isKeyboardOpen();
|
|
155
|
+
const keyboardHeight = keyboardOpen ? getKeyboardHeight() : 0;
|
|
156
|
+
let top = targetRect.bottom + verticalGap;
|
|
157
|
+
let left = targetRect.left + horizontalOffset;
|
|
158
|
+
if (isMobile && keyboardOpen) {
|
|
159
|
+
const viewportHeight = window.innerHeight;
|
|
160
|
+
const toolbarHeight = floatingElemRect.height;
|
|
161
|
+
const keyboardTop = viewportHeight - keyboardHeight;
|
|
162
|
+
top = keyboardTop - toolbarHeight - 20;
|
|
163
|
+
left = (window.innerWidth - floatingElemRect.width) / 2;
|
|
164
|
+
top -= anchorElementRect.top;
|
|
165
|
+
left -= anchorElementRect.left;
|
|
166
|
+
} else {
|
|
167
|
+
if (top + floatingElemRect.height > editorScrollerRect.bottom) {
|
|
168
|
+
top = targetRect.top - floatingElemRect.height - verticalGap;
|
|
169
|
+
}
|
|
170
|
+
if (left + floatingElemRect.width > editorScrollerRect.right) {
|
|
171
|
+
left = editorScrollerRect.right - floatingElemRect.width - horizontalOffset;
|
|
172
|
+
}
|
|
173
|
+
if (left < editorScrollerRect.left) {
|
|
174
|
+
left = editorScrollerRect.left + horizontalOffset;
|
|
175
|
+
}
|
|
176
|
+
top -= anchorElementRect.top;
|
|
177
|
+
left -= anchorElementRect.left;
|
|
178
|
+
}
|
|
179
|
+
floatingElem.style.transition = "transform 0.2s ease-in-out, opacity 0.2s ease-in-out";
|
|
180
|
+
floatingElem.style.opacity = "1";
|
|
181
|
+
floatingElem.style.transform = `translate(${left}px, ${top}px)`;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// src/components/ui/write/text-format-floting-toolbar.tsx
|
|
185
|
+
import { mergeRegister } from "@lexical/utils";
|
|
186
|
+
|
|
187
|
+
// src/hooks/use-mobile.ts
|
|
188
|
+
init_react_shim();
|
|
189
|
+
import * as React2 from "react";
|
|
190
|
+
var MOBILE_BREAKPOINT = 768;
|
|
191
|
+
function useIsMobile() {
|
|
192
|
+
const [isMobile, setIsMobile] = React2.useState(void 0);
|
|
193
|
+
React2.useEffect(() => {
|
|
194
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
195
|
+
const onChange = () => {
|
|
196
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
197
|
+
};
|
|
198
|
+
mql.addEventListener("change", onChange);
|
|
199
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
200
|
+
return () => mql.removeEventListener("change", onChange);
|
|
201
|
+
}, []);
|
|
202
|
+
return !!isMobile;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// src/components/ui/write/text-format-floting-toolbar.tsx
|
|
206
|
+
import { Bold, Code, Italic, Link, UnderlineIcon, MessageSquarePlus } from "lucide-react";
|
|
207
|
+
|
|
208
|
+
// src/components/ui/ai/ai-button.tsx
|
|
209
|
+
init_react_shim();
|
|
210
|
+
import { Loader2, RotateCcw, StarsIcon, WandSparkles } from "lucide-react";
|
|
211
|
+
import { useMemo, useState as useState4 } from "react";
|
|
212
|
+
|
|
213
|
+
// src/components/ui/hover-card.tsx
|
|
214
|
+
init_react_shim();
|
|
215
|
+
import * as React3 from "react";
|
|
216
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
217
|
+
import { jsx } from "react/jsx-runtime";
|
|
218
|
+
var HoverCard = HoverCardPrimitive.Root;
|
|
219
|
+
var HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
220
|
+
var HoverCardContent = React3.forwardRef((_a, ref) => {
|
|
221
|
+
var _b = _a, { className, align = "center", sideOffset = 4 } = _b, props = __objRest(_b, ["className", "align", "sideOffset"]);
|
|
222
|
+
return /* @__PURE__ */ jsx(
|
|
223
|
+
HoverCardPrimitive.Content,
|
|
224
|
+
__spreadValues({
|
|
225
|
+
ref,
|
|
226
|
+
align,
|
|
227
|
+
sideOffset,
|
|
228
|
+
className: cn(
|
|
229
|
+
"z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
230
|
+
className
|
|
231
|
+
)
|
|
232
|
+
}, props)
|
|
233
|
+
);
|
|
234
|
+
});
|
|
235
|
+
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
|
|
236
|
+
|
|
237
|
+
// src/components/ui/ai/border.tsx
|
|
238
|
+
init_react_shim();
|
|
239
|
+
import { useState as useState2, useEffect as useEffect2 } from "react";
|
|
240
|
+
import { motion } from "framer-motion";
|
|
241
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
242
|
+
function HoverBorderGradient(_a) {
|
|
243
|
+
var _b = _a, {
|
|
244
|
+
children,
|
|
245
|
+
containerClassName,
|
|
246
|
+
className,
|
|
247
|
+
as: Tag = "button",
|
|
248
|
+
duration = 1,
|
|
249
|
+
clockwise = true
|
|
250
|
+
} = _b, props = __objRest(_b, [
|
|
251
|
+
"children",
|
|
252
|
+
"containerClassName",
|
|
253
|
+
"className",
|
|
254
|
+
"as",
|
|
255
|
+
"duration",
|
|
256
|
+
"clockwise"
|
|
257
|
+
]);
|
|
258
|
+
const [hovered, setHovered] = useState2(false);
|
|
259
|
+
const [direction, setDirection] = useState2("TOP");
|
|
260
|
+
const rotateDirection = (currentDirection) => {
|
|
261
|
+
const directions = ["TOP", "LEFT", "BOTTOM", "RIGHT"];
|
|
262
|
+
const currentIndex = directions.indexOf(currentDirection);
|
|
263
|
+
const nextIndex = clockwise ? (currentIndex - 1 + directions.length) % directions.length : (currentIndex + 1) % directions.length;
|
|
264
|
+
return directions[nextIndex];
|
|
265
|
+
};
|
|
266
|
+
const movingMap = {
|
|
267
|
+
TOP: "radial-gradient(20.7% 50% at 50% 0%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)",
|
|
268
|
+
LEFT: "radial-gradient(16.6% 43.1% at 0% 50%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)",
|
|
269
|
+
BOTTOM: "radial-gradient(20.7% 50% at 50% 100%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)",
|
|
270
|
+
RIGHT: "radial-gradient(16.2% 41.199999999999996% at 100% 50%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)"
|
|
271
|
+
};
|
|
272
|
+
const highlight = "radial-gradient(75% 181.15942028985506% at 50% 50%, #3275F8 0%, rgba(255, 255, 255, 0) 100%)";
|
|
273
|
+
useEffect2(() => {
|
|
274
|
+
if (!hovered) {
|
|
275
|
+
const interval = setInterval(() => {
|
|
276
|
+
setDirection((prevState) => rotateDirection(prevState));
|
|
277
|
+
}, duration * 1e3);
|
|
278
|
+
return () => clearInterval(interval);
|
|
279
|
+
}
|
|
280
|
+
}, [hovered]);
|
|
281
|
+
return /* @__PURE__ */ jsxs(
|
|
282
|
+
Tag,
|
|
283
|
+
__spreadProps(__spreadValues({
|
|
284
|
+
onMouseEnter: (event) => {
|
|
285
|
+
setHovered(true);
|
|
286
|
+
},
|
|
287
|
+
onMouseLeave: () => setHovered(false),
|
|
288
|
+
className: cn(
|
|
289
|
+
"relative flex rounded-full border content-center bg-black/20 hover:bg-black/10 transition duration-500 dark:bg-white/20 items-center flex-col flex-nowrap justify-center overflow-visible p-px decoration-clone w-fit",
|
|
290
|
+
containerClassName
|
|
291
|
+
)
|
|
292
|
+
}, props), {
|
|
293
|
+
children: [
|
|
294
|
+
/* @__PURE__ */ jsx2(
|
|
295
|
+
"div",
|
|
296
|
+
{
|
|
297
|
+
className: cn(
|
|
298
|
+
"w-auto text-white z-10 bg-black rounded-[inherit]",
|
|
299
|
+
className
|
|
300
|
+
),
|
|
301
|
+
children
|
|
302
|
+
}
|
|
303
|
+
),
|
|
304
|
+
/* @__PURE__ */ jsx2(
|
|
305
|
+
motion.div,
|
|
306
|
+
{
|
|
307
|
+
className: cn(
|
|
308
|
+
"flex-none inset-0 overflow-hidden absolute z-0 rounded-[inherit]"
|
|
309
|
+
),
|
|
310
|
+
style: {
|
|
311
|
+
filter: "blur(2px)",
|
|
312
|
+
position: "absolute",
|
|
313
|
+
width: "100%",
|
|
314
|
+
height: "100%"
|
|
315
|
+
},
|
|
316
|
+
initial: { background: movingMap[direction] },
|
|
317
|
+
animate: {
|
|
318
|
+
background: hovered ? [movingMap[direction], highlight] : movingMap[direction]
|
|
319
|
+
},
|
|
320
|
+
transition: { ease: "linear", duration: duration != null ? duration : 1 }
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
/* @__PURE__ */ jsx2("div", { className: "bg-black absolute z-1 flex-none inset-[2px] rounded-[100px]" })
|
|
324
|
+
]
|
|
325
|
+
})
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// src/components/ui/ai/placeholder-input-vanish.tsx
|
|
330
|
+
init_react_shim();
|
|
331
|
+
import { AnimatePresence, motion as motion2 } from "framer-motion";
|
|
332
|
+
import { useCallback, useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
|
|
333
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
334
|
+
function PlaceholdersAndVanishInput({
|
|
335
|
+
placeholders: placeholders2,
|
|
336
|
+
onChange,
|
|
337
|
+
onSubmit,
|
|
338
|
+
disabled
|
|
339
|
+
}) {
|
|
340
|
+
const [currentPlaceholder, setCurrentPlaceholder] = useState3(0);
|
|
341
|
+
const intervalRef = useRef2(null);
|
|
342
|
+
const startAnimation = () => {
|
|
343
|
+
intervalRef.current = setInterval(() => {
|
|
344
|
+
setCurrentPlaceholder((prev) => (prev + 1) % placeholders2.length);
|
|
345
|
+
}, 3e3);
|
|
346
|
+
};
|
|
347
|
+
const handleVisibilityChange = () => {
|
|
348
|
+
if (document.visibilityState !== "visible" && intervalRef.current) {
|
|
349
|
+
clearInterval(intervalRef.current);
|
|
350
|
+
intervalRef.current = null;
|
|
351
|
+
} else if (document.visibilityState === "visible") {
|
|
352
|
+
startAnimation();
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
useEffect3(() => {
|
|
356
|
+
startAnimation();
|
|
357
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
358
|
+
return () => {
|
|
359
|
+
if (intervalRef.current) {
|
|
360
|
+
clearInterval(intervalRef.current);
|
|
361
|
+
}
|
|
362
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
363
|
+
};
|
|
364
|
+
}, [placeholders2]);
|
|
365
|
+
const canvasRef = useRef2(null);
|
|
366
|
+
const newDataRef = useRef2([]);
|
|
367
|
+
const inputRef = useRef2(null);
|
|
368
|
+
const [value, setValue] = useState3("");
|
|
369
|
+
const [animating, setAnimating] = useState3(false);
|
|
370
|
+
const draw = useCallback(() => {
|
|
371
|
+
if (!inputRef.current) return;
|
|
372
|
+
const canvas = canvasRef.current;
|
|
373
|
+
if (!canvas) return;
|
|
374
|
+
const ctx = canvas.getContext("2d");
|
|
375
|
+
if (!ctx) return;
|
|
376
|
+
canvas.width = 800;
|
|
377
|
+
canvas.height = 800;
|
|
378
|
+
ctx.clearRect(0, 0, 800, 800);
|
|
379
|
+
const computedStyles = getComputedStyle(inputRef.current);
|
|
380
|
+
const fontSize = parseFloat(computedStyles.getPropertyValue("font-size"));
|
|
381
|
+
ctx.font = `${fontSize * 2}px ${computedStyles.fontFamily}`;
|
|
382
|
+
ctx.fillStyle = "#FFF";
|
|
383
|
+
ctx.fillText(value, 16, 40);
|
|
384
|
+
const imageData = ctx.getImageData(0, 0, 800, 800);
|
|
385
|
+
const pixelData = imageData.data;
|
|
386
|
+
const newData = [];
|
|
387
|
+
for (let t = 0; t < 800; t++) {
|
|
388
|
+
let i = 4 * t * 800;
|
|
389
|
+
for (let n = 0; n < 800; n++) {
|
|
390
|
+
let e = i + 4 * n;
|
|
391
|
+
if (pixelData[e] !== 0 && pixelData[e + 1] !== 0 && pixelData[e + 2] !== 0) {
|
|
392
|
+
newData.push({
|
|
393
|
+
x: n,
|
|
394
|
+
y: t,
|
|
395
|
+
color: [
|
|
396
|
+
pixelData[e],
|
|
397
|
+
pixelData[e + 1],
|
|
398
|
+
pixelData[e + 2],
|
|
399
|
+
pixelData[e + 3]
|
|
400
|
+
]
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
newDataRef.current = newData.map(({ x, y, color }) => ({
|
|
406
|
+
x,
|
|
407
|
+
y,
|
|
408
|
+
r: 1,
|
|
409
|
+
color: `rgba(${color[0]}, ${color[1]}, ${color[2]}, ${color[3]})`
|
|
410
|
+
}));
|
|
411
|
+
}, [value]);
|
|
412
|
+
useEffect3(() => {
|
|
413
|
+
draw();
|
|
414
|
+
}, [value, draw]);
|
|
415
|
+
const animate = (start) => {
|
|
416
|
+
const animateFrame = (pos = 0) => {
|
|
417
|
+
requestAnimationFrame(() => {
|
|
418
|
+
var _a;
|
|
419
|
+
const newArr = [];
|
|
420
|
+
for (let i = 0; i < newDataRef.current.length; i++) {
|
|
421
|
+
const current = newDataRef.current[i];
|
|
422
|
+
if (current.x < pos) {
|
|
423
|
+
newArr.push(current);
|
|
424
|
+
} else {
|
|
425
|
+
if (current.r <= 0) {
|
|
426
|
+
current.r = 0;
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
current.x += Math.random() > 0.5 ? 1 : -1;
|
|
430
|
+
current.y += Math.random() > 0.5 ? 1 : -1;
|
|
431
|
+
current.r -= 0.05 * Math.random();
|
|
432
|
+
newArr.push(current);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
newDataRef.current = newArr;
|
|
436
|
+
const ctx = (_a = canvasRef.current) == null ? void 0 : _a.getContext("2d");
|
|
437
|
+
if (ctx) {
|
|
438
|
+
ctx.clearRect(pos, 0, 800, 800);
|
|
439
|
+
newDataRef.current.forEach((t) => {
|
|
440
|
+
const { x: n, y: i, r: s, color } = t;
|
|
441
|
+
if (n > pos) {
|
|
442
|
+
ctx.beginPath();
|
|
443
|
+
ctx.rect(n, i, s, s);
|
|
444
|
+
ctx.fillStyle = color;
|
|
445
|
+
ctx.strokeStyle = color;
|
|
446
|
+
ctx.stroke();
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
if (newDataRef.current.length > 0) {
|
|
451
|
+
animateFrame(pos - 8);
|
|
452
|
+
} else {
|
|
453
|
+
setValue("");
|
|
454
|
+
setAnimating(false);
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
};
|
|
458
|
+
animateFrame(start);
|
|
459
|
+
};
|
|
460
|
+
const handleKeyDown = (e) => {
|
|
461
|
+
if (e.key === "Enter" && !animating) {
|
|
462
|
+
vanishAndSubmit();
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
const vanishAndSubmit = () => {
|
|
466
|
+
var _a;
|
|
467
|
+
setAnimating(true);
|
|
468
|
+
draw();
|
|
469
|
+
const value2 = ((_a = inputRef.current) == null ? void 0 : _a.value) || "";
|
|
470
|
+
if (value2 && inputRef.current) {
|
|
471
|
+
const maxX = newDataRef.current.reduce(
|
|
472
|
+
(prev, current) => current.x > prev ? current.x : prev,
|
|
473
|
+
0
|
|
474
|
+
);
|
|
475
|
+
animate(maxX);
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
const handleSubmit = (e) => {
|
|
479
|
+
e.preventDefault();
|
|
480
|
+
vanishAndSubmit();
|
|
481
|
+
onSubmit && onSubmit(e);
|
|
482
|
+
};
|
|
483
|
+
return /* @__PURE__ */ jsxs2(
|
|
484
|
+
"form",
|
|
485
|
+
{
|
|
486
|
+
suppressHydrationWarning: true,
|
|
487
|
+
className: cn(
|
|
488
|
+
"w-full relative max-w-xl mx-auto h-9 rounded-sm overflow-hidden shadow-[0px_2px_3px_-1px_rgba(0,0,0,0.1),_0px_1px_0px_0px_rgba(25,28,33,0.02),_0px_0px_0px_1px_rgba(25,28,33,0.08)] transition duration-200"
|
|
489
|
+
),
|
|
490
|
+
onSubmit: handleSubmit,
|
|
491
|
+
children: [
|
|
492
|
+
/* @__PURE__ */ jsx3(
|
|
493
|
+
"canvas",
|
|
494
|
+
{
|
|
495
|
+
className: cn(
|
|
496
|
+
"absolute pointer-events-none text-base transform scale-50 top-[20%] left-2 sm:left-8 origin-top-left filter invert dark:invert-0 pr-20",
|
|
497
|
+
!animating ? "opacity-0" : "opacity-100"
|
|
498
|
+
),
|
|
499
|
+
ref: canvasRef
|
|
500
|
+
}
|
|
501
|
+
),
|
|
502
|
+
/* @__PURE__ */ jsx3(
|
|
503
|
+
"input",
|
|
504
|
+
{
|
|
505
|
+
disabled,
|
|
506
|
+
onChange: (e) => {
|
|
507
|
+
if (!animating) {
|
|
508
|
+
setValue(e.target.value);
|
|
509
|
+
onChange && onChange(e);
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
onKeyDown: handleKeyDown,
|
|
513
|
+
ref: inputRef,
|
|
514
|
+
value,
|
|
515
|
+
type: "text",
|
|
516
|
+
className: cn(
|
|
517
|
+
"w-full relative text-sm sm:text-base z-50 border-none dark:text-white bg-transparent text-black h-full focus:outline-none focus:ring-0 pl-4 sm:pl-10 pr-20",
|
|
518
|
+
animating && "text-transparent dark:text-transparent"
|
|
519
|
+
)
|
|
520
|
+
}
|
|
521
|
+
),
|
|
522
|
+
/* @__PURE__ */ jsx3(
|
|
523
|
+
"button",
|
|
524
|
+
{
|
|
525
|
+
disabled: !value || disabled,
|
|
526
|
+
type: "submit",
|
|
527
|
+
className: "absolute right-2 top-1/2 z-50 -translate-y-1/2 h-5 w-5 rounded-full disabled:bg-gray-100 bg-black dark:bg-zinc-900 dark:disabled:bg-zinc-800 transition duration-200 flex items-center justify-center",
|
|
528
|
+
children: /* @__PURE__ */ jsxs2(
|
|
529
|
+
motion2.svg,
|
|
530
|
+
{
|
|
531
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
532
|
+
width: "24",
|
|
533
|
+
height: "24",
|
|
534
|
+
viewBox: "0 0 24 24",
|
|
535
|
+
fill: "none",
|
|
536
|
+
stroke: "currentColor",
|
|
537
|
+
strokeWidth: "2",
|
|
538
|
+
strokeLinecap: "round",
|
|
539
|
+
strokeLinejoin: "round",
|
|
540
|
+
className: "text-gray-300 h-4 w-4",
|
|
541
|
+
children: [
|
|
542
|
+
/* @__PURE__ */ jsx3("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
543
|
+
/* @__PURE__ */ jsx3(
|
|
544
|
+
motion2.path,
|
|
545
|
+
{
|
|
546
|
+
d: "M5 12l14 0",
|
|
547
|
+
initial: {
|
|
548
|
+
strokeDasharray: "50%",
|
|
549
|
+
strokeDashoffset: "50%"
|
|
550
|
+
},
|
|
551
|
+
animate: {
|
|
552
|
+
strokeDashoffset: value ? 0 : "50%"
|
|
553
|
+
},
|
|
554
|
+
transition: {
|
|
555
|
+
duration: 0.3,
|
|
556
|
+
ease: "linear"
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
),
|
|
560
|
+
/* @__PURE__ */ jsx3("path", { d: "M13 18l6 -6" }),
|
|
561
|
+
/* @__PURE__ */ jsx3("path", { d: "M13 6l6 6" })
|
|
562
|
+
]
|
|
563
|
+
}
|
|
564
|
+
)
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
/* @__PURE__ */ jsx3("div", { className: "absolute inset-0 flex items-center rounded-full pointer-events-none", children: /* @__PURE__ */ jsx3(AnimatePresence, { mode: "wait", children: !value && /* @__PURE__ */ jsx3(
|
|
568
|
+
motion2.p,
|
|
569
|
+
{
|
|
570
|
+
initial: {
|
|
571
|
+
y: 5,
|
|
572
|
+
opacity: 0
|
|
573
|
+
},
|
|
574
|
+
animate: {
|
|
575
|
+
y: 0,
|
|
576
|
+
opacity: 1
|
|
577
|
+
},
|
|
578
|
+
exit: {
|
|
579
|
+
y: -15,
|
|
580
|
+
opacity: 0
|
|
581
|
+
},
|
|
582
|
+
transition: {
|
|
583
|
+
duration: 0.3,
|
|
584
|
+
ease: "linear"
|
|
585
|
+
},
|
|
586
|
+
className: "dark:text-zinc-500 text-sm sm:text-base font-normal text-neutral-500 pl-4 sm:pl-12 text-left w-[calc(100%-2rem)] truncate",
|
|
587
|
+
children: placeholders2[currentPlaceholder]
|
|
588
|
+
},
|
|
589
|
+
`current-placeholder-${currentPlaceholder}`
|
|
590
|
+
) }) })
|
|
591
|
+
]
|
|
592
|
+
}
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// src/components/ui/ai/ai-button.tsx
|
|
597
|
+
import { motion as motion3 } from "framer-motion";
|
|
598
|
+
import { useCompletion } from "@ai-sdk/react";
|
|
599
|
+
import { toast } from "sonner";
|
|
600
|
+
import ReactMarkdown from "react-markdown";
|
|
601
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
602
|
+
var placeholders = [
|
|
603
|
+
"Chat with what you are writing.",
|
|
604
|
+
"Click on the stepper to generate tasks step by step.",
|
|
605
|
+
"Click on autocomplete to complete sentences.",
|
|
606
|
+
"Is your text too long? Do you want to make it shorter?"
|
|
607
|
+
];
|
|
608
|
+
function AiButton({ editor }) {
|
|
609
|
+
const [actionType, setActionType] = useState4(null);
|
|
610
|
+
const [streamedResponse, setStreamedResponse] = useState4("");
|
|
611
|
+
const { apiEndpoint } = useAI();
|
|
612
|
+
const { completion, isLoading, complete, handleInputChange, input } = useCompletion({
|
|
613
|
+
api: apiEndpoint,
|
|
614
|
+
streamProtocol: "text",
|
|
615
|
+
onError: (err) => {
|
|
616
|
+
toast.error(err.message);
|
|
617
|
+
},
|
|
618
|
+
onResponse: (response2) => {
|
|
619
|
+
setStreamedResponse("");
|
|
620
|
+
},
|
|
621
|
+
onFinish: (prompt, completion2) => {
|
|
622
|
+
if (actionType === "Steps") {
|
|
623
|
+
setStreamedResponse(completion2);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
const handleAction = async (action, payload) => {
|
|
628
|
+
try {
|
|
629
|
+
const savedProvider = typeof window !== "undefined" ? localStorage.getItem("notiq_ai_provider") : void 0;
|
|
630
|
+
const savedKey = typeof window !== "undefined" ? localStorage.getItem("notiq_ai_api_key") : void 0;
|
|
631
|
+
await complete("", {
|
|
632
|
+
body: __spreadValues({
|
|
633
|
+
action,
|
|
634
|
+
modelProvider: savedProvider && savedProvider !== "auto" ? savedProvider : void 0,
|
|
635
|
+
apiKey: savedKey || void 0
|
|
636
|
+
}, payload)
|
|
637
|
+
});
|
|
638
|
+
setActionType(action);
|
|
639
|
+
} catch (err) {
|
|
640
|
+
toast.error("Failed to process AI action. Please try again.");
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
const handleRegeneration = async () => {
|
|
644
|
+
if (!completion) {
|
|
645
|
+
toast.error("No content to regenerate");
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
await handleAction("GenerateAgain", { prompt: completion });
|
|
649
|
+
};
|
|
650
|
+
const handleAutoComplete = async () => {
|
|
651
|
+
const selectedText = getSelectedText(editor, 30);
|
|
652
|
+
await handleAction("autoComplete", { prompt: selectedText });
|
|
653
|
+
};
|
|
654
|
+
const handleImproveWriting = async () => {
|
|
655
|
+
const selectedText = getSelectedText(editor);
|
|
656
|
+
await handleAction("ImproveWriting", { prompt: selectedText });
|
|
657
|
+
};
|
|
658
|
+
const handleSimplifyLanguage = async () => {
|
|
659
|
+
const selectedText = getSelectedText(editor);
|
|
660
|
+
await handleAction("SimplifyLanguage", { prompt: selectedText });
|
|
661
|
+
};
|
|
662
|
+
const handleMakeLong = async () => {
|
|
663
|
+
const selectedText = getSelectedText(editor);
|
|
664
|
+
await handleAction("MakeLong", { prompt: selectedText });
|
|
665
|
+
};
|
|
666
|
+
const handleMakeShort = async () => {
|
|
667
|
+
const selectedText = getSelectedText(editor);
|
|
668
|
+
await handleAction("MakeShort", { prompt: selectedText });
|
|
669
|
+
};
|
|
670
|
+
const handleFixSpellingGrammar = async () => {
|
|
671
|
+
const selectedText = getSelectedText(editor);
|
|
672
|
+
await handleAction("FixSpellingGrammar", { prompt: selectedText });
|
|
673
|
+
};
|
|
674
|
+
const handleSummarize = async () => {
|
|
675
|
+
const selectedText = getSelectedText(editor);
|
|
676
|
+
await handleAction("Summarize", { prompt: selectedText });
|
|
677
|
+
};
|
|
678
|
+
const handleTranslate = async (lang = "Spanish") => {
|
|
679
|
+
const selectedText = getSelectedText(editor);
|
|
680
|
+
await handleAction("Translate", { prompt: `Translate the following text into ${lang}:
|
|
681
|
+
|
|
682
|
+
${selectedText}` });
|
|
683
|
+
};
|
|
684
|
+
const handleSubmit = async (e) => {
|
|
685
|
+
e.preventDefault();
|
|
686
|
+
if (!input || !input.trim()) {
|
|
687
|
+
toast.error("Please enter a question or instruction");
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
const data = ExtractData(editor);
|
|
691
|
+
const selectedText = getSelectedText(editor, 30);
|
|
692
|
+
await handleAction(actionType === "Steps" ? "Steps" : "ChatWithSelectedString", {
|
|
693
|
+
prompt: input.trim(),
|
|
694
|
+
context: selectedText ? `Selected: ${selectedText}
|
|
695
|
+
|
|
696
|
+
Doc:
|
|
697
|
+
${data}` : data
|
|
698
|
+
});
|
|
699
|
+
};
|
|
700
|
+
const renderSteps = () => {
|
|
701
|
+
if (!streamedResponse) return null;
|
|
702
|
+
try {
|
|
703
|
+
const steps = JSON.parse(streamedResponse);
|
|
704
|
+
return /* @__PURE__ */ jsx4("ul", { className: "list-none space-y-2", children: steps.map((step) => /* @__PURE__ */ jsxs3("li", { className: "rounded-md shadow-md p-1", children: [
|
|
705
|
+
/* @__PURE__ */ jsxs3("h3", { className: "font-semibold text-lg", children: [
|
|
706
|
+
step.id + 1,
|
|
707
|
+
". ",
|
|
708
|
+
step.title
|
|
709
|
+
] }),
|
|
710
|
+
/* @__PURE__ */ jsx4("p", { className: "text-gray-600 dark:text-gray-300 mtx-2", children: step.content })
|
|
711
|
+
] }, step.id)) });
|
|
712
|
+
} catch (error) {
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
const Actions = useMemo(
|
|
717
|
+
() => ({
|
|
718
|
+
suggestion: [
|
|
719
|
+
{
|
|
720
|
+
icon: /* @__PURE__ */ jsx4(
|
|
721
|
+
"svg",
|
|
722
|
+
{
|
|
723
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
724
|
+
className: "size-5 text-purple-500",
|
|
725
|
+
viewBox: "0 0 24 24",
|
|
726
|
+
children: /* @__PURE__ */ jsx4(
|
|
727
|
+
"path",
|
|
728
|
+
{
|
|
729
|
+
fill: "currentColor",
|
|
730
|
+
d: "m19 9l-1.25-2.75L15 5l2.75-1.25L19 1l1.25 2.75L23 5l-2.75 1.25Zm0 14l-1.25-2.75L15 19l2.75-1.25L19 15l1.25 2.75L23 19l-2.75 1.25ZM4.8 16L8 7h2l3.2 9h-1.9l-.7-2H7.4l-.7 2Zm3.05-3.35h2.3L9 9ZM9 18q2.5 0 4.25-1.75T15 12q0-2.5-1.75-4.25T9 6Q6.5 6 4.75 7.75T3 12q0 2.5 1.75 4.25T9 18Zm0 2q-3.35 0-5.675-2.325Q1 15.35 1 12q0-3.35 2.325-5.675Q5.65 4 9 4q3.35 0 5.675 2.325Q17 8.65 17 12q0 3.35-2.325 5.675Q12.35 20 9 20Z"
|
|
731
|
+
}
|
|
732
|
+
)
|
|
733
|
+
}
|
|
734
|
+
),
|
|
735
|
+
label: "auto compeletion",
|
|
736
|
+
HoverCard: {
|
|
737
|
+
desc: "Improve your sentences effortlessly\u2014just select the text you want to refine, and let AI work its magic! \u2728"
|
|
738
|
+
},
|
|
739
|
+
onClick: handleAutoComplete
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
icon: /* @__PURE__ */ jsx4(
|
|
743
|
+
"svg",
|
|
744
|
+
{
|
|
745
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
746
|
+
className: "size-5 text-purple-500",
|
|
747
|
+
viewBox: "0 0 24 24",
|
|
748
|
+
children: /* @__PURE__ */ jsx4(
|
|
749
|
+
"path",
|
|
750
|
+
{
|
|
751
|
+
fill: "currentColor",
|
|
752
|
+
d: "M7.5 5.6L10 7L8.6 4.5L10 2L7.5 3.4L5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96a.996.996 0 0 0 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05a.996.996 0 0 0 0-1.41zm-1.03 5.49l-2.12-2.12l2.44-2.44l2.12 2.12z"
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
}
|
|
756
|
+
),
|
|
757
|
+
label: "Improve Writing",
|
|
758
|
+
HoverCard: {
|
|
759
|
+
desc: " Simply select the text you want, and let our AI refine your writing effortlessly! \u{1F4DD}\u{1F680}"
|
|
760
|
+
},
|
|
761
|
+
onClick: handleImproveWriting
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
icon: /* @__PURE__ */ jsx4(
|
|
765
|
+
"svg",
|
|
766
|
+
{
|
|
767
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
768
|
+
className: "size-5 text-purple-500",
|
|
769
|
+
viewBox: "0 0 24 24",
|
|
770
|
+
children: /* @__PURE__ */ jsx4(
|
|
771
|
+
"path",
|
|
772
|
+
{
|
|
773
|
+
fill: "currentColor",
|
|
774
|
+
d: "m9 16.2l-3.5-3.5a.984.984 0 0 0-1.4 0a.984.984 0 0 0 0 1.4l4.19 4.19c.39.39 1.02.39 1.41 0L20.3 7.7a.984.984 0 0 0 0-1.4a.984.984 0 0 0-1.4 0z"
|
|
775
|
+
}
|
|
776
|
+
)
|
|
777
|
+
}
|
|
778
|
+
),
|
|
779
|
+
label: "Fix spelling & grammar",
|
|
780
|
+
HoverCard: {
|
|
781
|
+
desc: "\u{1F4DD} Select your messy text, and let AI transform it into perfection! \u{1F680}"
|
|
782
|
+
},
|
|
783
|
+
onClick: handleFixSpellingGrammar
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
icon: /* @__PURE__ */ jsx4(
|
|
787
|
+
"svg",
|
|
788
|
+
{
|
|
789
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
790
|
+
className: "size-5 text-purple-500",
|
|
791
|
+
viewBox: "0 0 24 24",
|
|
792
|
+
children: /* @__PURE__ */ jsx4(
|
|
793
|
+
"path",
|
|
794
|
+
{
|
|
795
|
+
fill: "currentColor",
|
|
796
|
+
d: "M4 5h16v2H4zm0 6h16v2H4zm0 6h10v2H4z"
|
|
797
|
+
}
|
|
798
|
+
)
|
|
799
|
+
}
|
|
800
|
+
),
|
|
801
|
+
label: "Summarize selection",
|
|
802
|
+
HoverCard: {
|
|
803
|
+
desc: "Extract key takeaways and core insights from your selected text. \u26A1"
|
|
804
|
+
},
|
|
805
|
+
onClick: handleSummarize
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
icon: /* @__PURE__ */ jsx4(
|
|
809
|
+
"svg",
|
|
810
|
+
{
|
|
811
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
812
|
+
className: "size-5 text-purple-500",
|
|
813
|
+
viewBox: "0 0 24 24",
|
|
814
|
+
children: /* @__PURE__ */ jsx4(
|
|
815
|
+
"path",
|
|
816
|
+
{
|
|
817
|
+
fill: "currentColor",
|
|
818
|
+
d: "m12.87 15.07l-2.54-2.51.03-.08c1.74-1.94 2.98-4.17 3.71-6.48H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04M18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12m-2.62 7l1.62-4.33L19.12 17h-3.24Z"
|
|
819
|
+
}
|
|
820
|
+
)
|
|
821
|
+
}
|
|
822
|
+
),
|
|
823
|
+
label: "Translate selection",
|
|
824
|
+
HoverCard: {
|
|
825
|
+
desc: "Translate highlighted passage to Spanish or other languages. \u{1F310}"
|
|
826
|
+
},
|
|
827
|
+
onClick: () => handleTranslate("Spanish")
|
|
828
|
+
}
|
|
829
|
+
],
|
|
830
|
+
Edit: [
|
|
831
|
+
{
|
|
832
|
+
icon: /* @__PURE__ */ jsx4(
|
|
833
|
+
"svg",
|
|
834
|
+
{
|
|
835
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
836
|
+
className: "h-4 flex-shrink-0 w-4 block text-green-400",
|
|
837
|
+
viewBox: "0 0 20 20",
|
|
838
|
+
children: /* @__PURE__ */ jsx4(
|
|
839
|
+
"path",
|
|
840
|
+
{
|
|
841
|
+
fill: "currentColor",
|
|
842
|
+
d: "M3.5 5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1zm0 7h7.002l.416-1H3.5a.5.5 0 0 0 0 1m8.668-4l-.416 1H3.5a.5.5 0 0 1 0-1zm-.667 6.012h1.75l-.59 2.363c-.121.485.462.828.826.488l4.873-4.556c.497-.466.169-1.301-.512-1.301H16.75l.781-2.347a.5.5 0 0 0-.474-.659h-3.473a.5.5 0 0 0-.462.308l-2.083 5.01a.5.5 0 0 0 .462.694"
|
|
843
|
+
}
|
|
844
|
+
)
|
|
845
|
+
}
|
|
846
|
+
),
|
|
847
|
+
label: "Make longer",
|
|
848
|
+
HoverCard: {
|
|
849
|
+
desc: "Enhance your text by adding more detail and context. Let AI expand your ideas! \u{1F680}"
|
|
850
|
+
},
|
|
851
|
+
onClick: handleMakeLong
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
icon: /* @__PURE__ */ jsx4(
|
|
855
|
+
"svg",
|
|
856
|
+
{
|
|
857
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
858
|
+
className: "h-4 flex-shrink-0 w-4 block text-green-400",
|
|
859
|
+
viewBox: "0 0 32 32",
|
|
860
|
+
children: /* @__PURE__ */ jsx4("path", { fill: "currentColor", d: "M6 18h14v2H6zm0-6h20v2H6z" })
|
|
861
|
+
}
|
|
862
|
+
),
|
|
863
|
+
label: "Make shorter",
|
|
864
|
+
HoverCard: {
|
|
865
|
+
desc: "Select your dummy short paragraph and let our AI expand it while preserving its original content! \u{1F680}\u2728"
|
|
866
|
+
},
|
|
867
|
+
onClick: handleMakeShort
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
icon: /* @__PURE__ */ jsx4(
|
|
871
|
+
"svg",
|
|
872
|
+
{
|
|
873
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
874
|
+
className: "h-4 flex-shrink-0 w-4 block text-green-400",
|
|
875
|
+
viewBox: "0 0 24 24",
|
|
876
|
+
children: /* @__PURE__ */ jsx4(
|
|
877
|
+
"path",
|
|
878
|
+
{
|
|
879
|
+
fill: "currentColor",
|
|
880
|
+
fillRule: "evenodd",
|
|
881
|
+
d: "M12.75 18.96V22h-1.5v-3.04A7 7 0 0 1 5 12v-2h1.5v2a5.5 5.5 0 0 0 11 0v-2H19v2a7 7 0 0 1-6.25 6.96M8 6a4 4 0 1 1 8 0v6a4 4 0 1 1-8 0z"
|
|
882
|
+
}
|
|
883
|
+
)
|
|
884
|
+
}
|
|
885
|
+
),
|
|
886
|
+
label: "Simplify Language",
|
|
887
|
+
HoverCard: {
|
|
888
|
+
desc: "If you're using overly complex language and want to simplify it for easier understanding, let our AI transform your text into clear, concise, and engaging content! \u{1F60A}\u2728"
|
|
889
|
+
},
|
|
890
|
+
onClick: handleSimplifyLanguage
|
|
891
|
+
}
|
|
892
|
+
],
|
|
893
|
+
format_block: [
|
|
894
|
+
{
|
|
895
|
+
icon: /* @__PURE__ */ jsx4(
|
|
896
|
+
"svg",
|
|
897
|
+
{
|
|
898
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
899
|
+
className: "size-5 text-yellow-400",
|
|
900
|
+
viewBox: "0 0 24 24",
|
|
901
|
+
children: /* @__PURE__ */ jsxs3("g", { fill: "none", children: [
|
|
902
|
+
/* @__PURE__ */ jsx4("path", { d: "m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z" }),
|
|
903
|
+
/* @__PURE__ */ jsx4(
|
|
904
|
+
"path",
|
|
905
|
+
{
|
|
906
|
+
fill: "currentColor",
|
|
907
|
+
d: "M5.436 16.72a1.466 1.466 0 0 1 1.22 2.275a1.466 1.466 0 0 1-1.22 2.275c-.587 0-1.134-.21-1.38-.79c-.153-.361-.112-.79.297-.963a.65.65 0 0 1 .852.344a.18.18 0 0 0 .165.11c.114-.003.23-.026.23-.168c0-.1-.073-.143-.156-.155l-.051-.003a.65.65 0 0 1-.112-1.29l.112-.01c.102 0 .207-.037.207-.158c0-.141-.116-.165-.23-.168a.18.18 0 0 0-.164.11a.65.65 0 0 1-.853.345c-.409-.174-.45-.603-.297-.963c.246-.58.793-.79 1.38-.79ZM20 17.5a1.5 1.5 0 0 1 0 3H9a1.5 1.5 0 0 1 0-3zM6.08 9.945a1.552 1.552 0 0 1 .43 2.442l-.554.593h.47a.65.65 0 1 1 0 1.3H4.573a.655.655 0 0 1-.655-.654c0-.207.029-.399.177-.557L5.559 11.5c.142-.152.03-.473-.203-.415c-.087.022-.123.089-.134.165l-.004.059a.65.65 0 1 1-1.3 0c0-.692.439-1.314 1.123-1.485c.35-.088.718-.04 1.04.121ZM20 10.5a1.5 1.5 0 0 1 .144 2.993L20 13.5H9a1.5 1.5 0 0 1-.144-2.993L9 10.5zM6.15 3.39v3.24a.65.65 0 0 1-1.3 0V4.523a.65.65 0 0 1-.46-1.184l.742-.494a.655.655 0 0 1 1.018.544ZM20 3.5a1.5 1.5 0 0 1 .144 2.993L20 6.5H9a1.5 1.5 0 0 1-.144-2.993L9 3.5z"
|
|
908
|
+
}
|
|
909
|
+
)
|
|
910
|
+
] })
|
|
911
|
+
}
|
|
912
|
+
),
|
|
913
|
+
label: "Step-by-Step Guide",
|
|
914
|
+
HoverCard: {
|
|
915
|
+
desc: "Need a clear roadmap to programming mastery? step-by-step guide that breaks down complex topics into simple, actionable steps. Let it light your path to coding success! \u{1F680}\u{1F4BB}"
|
|
916
|
+
},
|
|
917
|
+
onClick: () => setActionType("Steps")
|
|
918
|
+
}
|
|
919
|
+
]
|
|
920
|
+
}),
|
|
921
|
+
[]
|
|
922
|
+
);
|
|
923
|
+
const response = useMemo(
|
|
924
|
+
() => [
|
|
925
|
+
{
|
|
926
|
+
icon: /* @__PURE__ */ jsxs3(
|
|
927
|
+
"svg",
|
|
928
|
+
{
|
|
929
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
930
|
+
className: "text-[#8d5bc1] size-5",
|
|
931
|
+
viewBox: "0 0 16 16",
|
|
932
|
+
children: [
|
|
933
|
+
/* @__PURE__ */ jsx4(
|
|
934
|
+
"path",
|
|
935
|
+
{
|
|
936
|
+
fill: "currentColor",
|
|
937
|
+
fillRule: "evenodd",
|
|
938
|
+
d: "M0 3.2c0-1.12 0-1.68.218-2.11C.41.714.716.408 1.092.216c.428-.218.988-.218 2.11-.218h.6c1.12 0 1.68 0 2.11.218c.376.192.682.498.874.874c.218.428.218.988.218 2.11v.6c0 1.12 0 1.68-.218 2.11a2 2 0 0 1-.874.874c-.428.218-.988.218-2.11.218h-.6c-1.12 0-1.68 0-2.11-.218a2 2 0 0 1-.874-.874C0 5.482 0 4.922 0 3.8zM3.2 1h.6c.577 0 .949 0 1.23.024c.272.022.372.06.422.085c.188.096.341.249.437.437c.025.05.063.15.085.422c.023.283.024.656.024 1.23v.6c0 .577 0 .949-.024 1.23c-.022.272-.06.372-.085.422a1 1 0 0 1-.437.437c-.05.025-.15.063-.422.085c-.283.023-.656.024-1.23.024h-.6c-.577 0-.949 0-1.23-.024c-.272-.022-.372-.06-.422-.085a1 1 0 0 1-.437-.437c-.025-.05-.063-.15-.085-.422a17 17 0 0 1-.024-1.23v-.6c0-.577 0-.949.024-1.23c.022-.272.06-.372.085-.422c.096-.188.249-.341.437-.437c.05-.025.15-.063.422-.085C2.253 1 2.626 1 3.2 1M9 12.2c0-1.12 0-1.68.218-2.11c.192-.376.498-.682.874-.874c.428-.218.988-.218 2.11-.218h.6c1.12 0 1.68 0 2.11.218c.376.192.682.498.874.874c.218.428.218.988.218 2.11v.6c0 1.12 0 1.68-.218 2.11a2 2 0 0 1-.874.874c-.428.218-.988.218-2.11.218h-.6c-1.12 0-1.68 0-2.11-.218a2 2 0 0 1-.874-.874C9 14.482 9 13.922 9 12.8zm3.8-2.2c.577 0 .949 0 1.23.024c.272.022.372.06.422.085c.188.096.341.249.437.437c.025.05.063.15.085.422c.023.283.024.656.024 1.23v.6c0 .577 0 .949-.024 1.23c-.022.272-.06.372-.085.422a1 1 0 0 1-.437.437c-.05.025-.15.063-.422.085c-.283.023-.656.024-1.23.024h-.6c-.577 0-.949 0-1.23-.024c-.272-.022-.372-.06-.422-.085a1 1 0 0 1-.437-.437c-.025-.05-.063-.15-.085-.422a17 17 0 0 1-.024-1.23v-.6c0-.577 0-.949.024-1.23c.022-.272.06-.372.085-.422c.096-.188.249-.341.437-.437c.05-.025.15-.063.422-.085c.283-.023.656-.024 1.23-.024z",
|
|
939
|
+
clipRule: "evenodd"
|
|
940
|
+
}
|
|
941
|
+
),
|
|
942
|
+
/* @__PURE__ */ jsx4(
|
|
943
|
+
"path",
|
|
944
|
+
{
|
|
945
|
+
fill: "currentColor",
|
|
946
|
+
d: "M8 2.5a.5.5 0 0 1 .5-.5h2A2.5 2.5 0 0 1 13 4.5v1.79l1.15-1.15a.5.5 0 0 1 .707.707l-2 2a.5.5 0 0 1-.707 0l-2-2a.5.5 0 0 1 .707-.707l1.15 1.15V4.5a1.5 1.5 0 0 0-1.5-1.5h-2a.5.5 0 0 1-.5-.5zM3.31 8.04a.5.5 0 0 1 .188-.038h.006a.5.5 0 0 1 .351.146l2 2a.5.5 0 0 1-.707.707l-1.15-1.15v1.79a1.5 1.5 0 0 0 1.5 1.5h2a.5.5 0 0 1 0 1h-2a2.5 2.5 0 0 1-2.5-2.5v-1.79l-1.15 1.15a.5.5 0 0 1-.707-.707l2-2a.5.5 0 0 1 .162-.109z"
|
|
947
|
+
}
|
|
948
|
+
)
|
|
949
|
+
]
|
|
950
|
+
}
|
|
951
|
+
),
|
|
952
|
+
label: "Replace text",
|
|
953
|
+
HoverCard: {
|
|
954
|
+
desc: "Select your text and let our AI replace it with a polished, enhanced version! \u{1F680}\u2728"
|
|
955
|
+
},
|
|
956
|
+
func: () => replaceSelectedText(completion, editor)
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
icon: /* @__PURE__ */ jsx4(
|
|
960
|
+
"svg",
|
|
961
|
+
{
|
|
962
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
963
|
+
className: "text-[#8d5bc1] size-5",
|
|
964
|
+
viewBox: "0 0 56 56",
|
|
965
|
+
children: /* @__PURE__ */ jsx4(
|
|
966
|
+
"path",
|
|
967
|
+
{
|
|
968
|
+
fill: "currentColor",
|
|
969
|
+
d: "M33.8 11.36h16.01c1.008 0 1.804-.774 1.804-1.782c0-.984-.797-1.758-1.804-1.758H33.8c-1.008 0-1.782.774-1.782 1.758c0 1.008.774 1.781 1.782 1.781M7.083 26.944c1.71 0 2.695-1.195 2.695-3.093v-4.477c0-.516.235-.82.797-.82h6.375v2.343c0 1.852 1.875 2.555 3.281 1.43l6.352-5.062c.96-.774.96-2.11 0-2.86L20.23 9.32c-1.453-1.195-3.28-.469-3.28 1.43v2.438h-6.891c-3.305 0-5.672 2.039-5.672 5.367v5.297c0 1.898.984 3.093 2.695 3.093m26.719-3.304h16.008c1.008 0 1.804-.774 1.804-1.782c0-.984-.797-1.758-1.804-1.758H33.8c-1.008 0-1.782.774-1.782 1.758c0 1.008.774 1.782 1.782 1.782M6.168 35.92h43.64a1.786 1.786 0 0 0 1.805-1.78c0-.985-.797-1.758-1.804-1.758H6.168c-1.008 0-1.781.773-1.781 1.758c0 .984.773 1.78 1.78 1.78m0 12.259h43.64c1.008 0 1.805-.774 1.805-1.758s-.797-1.781-1.804-1.781H6.168a1.766 1.766 0 0 0-1.781 1.78c0 .985.773 1.759 1.78 1.759"
|
|
970
|
+
}
|
|
971
|
+
)
|
|
972
|
+
}
|
|
973
|
+
),
|
|
974
|
+
label: "Insert text",
|
|
975
|
+
HoverCard: {
|
|
976
|
+
desc: "Text will be inserted immediately following your selection."
|
|
977
|
+
},
|
|
978
|
+
func: () => insertText(completion, editor)
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
icon: /* @__PURE__ */ jsx4(
|
|
982
|
+
"svg",
|
|
983
|
+
{
|
|
984
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
985
|
+
className: "text-[#8d5bc1] size-5",
|
|
986
|
+
viewBox: "0 0 14 14",
|
|
987
|
+
children: /* @__PURE__ */ jsxs3(
|
|
988
|
+
"g",
|
|
989
|
+
{
|
|
990
|
+
fill: "none",
|
|
991
|
+
stroke: "currentColor",
|
|
992
|
+
strokeLinecap: "round",
|
|
993
|
+
strokeLinejoin: "round",
|
|
994
|
+
children: [
|
|
995
|
+
/* @__PURE__ */ jsx4("path", { d: "M9.5 6.5h-9m13-3H.5m13-3H.5" }),
|
|
996
|
+
/* @__PURE__ */ jsx4(
|
|
997
|
+
"rect",
|
|
998
|
+
{
|
|
999
|
+
width: "4",
|
|
1000
|
+
height: "13",
|
|
1001
|
+
x: "5",
|
|
1002
|
+
y: "5",
|
|
1003
|
+
rx: ".5",
|
|
1004
|
+
transform: "rotate(-90 7 11.5)"
|
|
1005
|
+
}
|
|
1006
|
+
)
|
|
1007
|
+
]
|
|
1008
|
+
}
|
|
1009
|
+
)
|
|
1010
|
+
}
|
|
1011
|
+
),
|
|
1012
|
+
label: "Insert below",
|
|
1013
|
+
HoverCard: {
|
|
1014
|
+
desc: "Text will be inserted below your selection."
|
|
1015
|
+
},
|
|
1016
|
+
func: () => insertTextUnderSelected(completion, editor)
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
icon: /* @__PURE__ */ jsx4(RotateCcw, { className: "text-[#8d5bc1] size-4" }),
|
|
1020
|
+
label: "Try again",
|
|
1021
|
+
HoverCard: {
|
|
1022
|
+
desc: "Didn't like the AI response? Try generating again."
|
|
1023
|
+
},
|
|
1024
|
+
func: handleRegeneration
|
|
1025
|
+
}
|
|
1026
|
+
],
|
|
1027
|
+
[completion]
|
|
1028
|
+
);
|
|
1029
|
+
return /* @__PURE__ */ jsxs3(Popover, { children: [
|
|
1030
|
+
/* @__PURE__ */ jsx4(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx4("button", { className: "inline-flex px-6 max-sm:py-2 max-sm:px-[5px] h-6 animate-background-shine items-center justify-center rounded-md border border-gray-800 bg-[linear-gradient(110deg,#000103,45%,#1e2631,55%,#000103)] bg-[length:200%_100%] font-medium text-gray-400 transition-colors focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 focus:ring-offset-gray-50", children: /* @__PURE__ */ jsx4(WandSparkles, { className: " size-4 text-purple-400" }) }) }),
|
|
1031
|
+
/* @__PURE__ */ jsx4(PopoverContent, { className: "absolute max-h-[300px] h-fit shadow-sm shadow-black dark:shadow-gray-500 p-0 w-[420px] max-sm:w-[200px] min-w-[200px] max-w-[420px] top-[10px] max-sm:left-6 -left-7 AI-format", children: /* @__PURE__ */ jsxs3("div", { className: "w-full relative", children: [
|
|
1032
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-start justify-between", children: [
|
|
1033
|
+
(completion || isLoading || actionType === "Steps") && /* @__PURE__ */ jsx4(
|
|
1034
|
+
motion3.div,
|
|
1035
|
+
{
|
|
1036
|
+
initial: { opacity: 0, y: 10 },
|
|
1037
|
+
animate: { opacity: 1, y: 0 },
|
|
1038
|
+
transition: { duration: 0.3, ease: "easeOut" },
|
|
1039
|
+
className: "cursor-text w-full p-2.5 z-20 break-words max-h-64 h-fit overflow-y-auto border-b border-border/40 bg-muted/20",
|
|
1040
|
+
children: isLoading && !completion ? /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 py-2 text-xs text-muted-foreground animate-pulse", children: [
|
|
1041
|
+
/* @__PURE__ */ jsx4(Loader2, { className: "size-3.5 animate-spin text-purple-500" }),
|
|
1042
|
+
/* @__PURE__ */ jsx4("span", { children: "Thinking and generating..." })
|
|
1043
|
+
] }) : streamedResponse !== "" ? renderSteps() : /* @__PURE__ */ jsx4(ReactMarkdown, { children: completion || "Ask for a step-by-step guide on any programming topic. Example: 'How can I become a backend developer?'" })
|
|
1044
|
+
}
|
|
1045
|
+
),
|
|
1046
|
+
/* @__PURE__ */ jsxs3("div", { className: "relative w-full", children: [
|
|
1047
|
+
/* @__PURE__ */ jsx4("div", { className: " absolute top-1/2 -translate-y-1/2 left-2", children: /* @__PURE__ */ jsx4(
|
|
1048
|
+
HoverBorderGradient,
|
|
1049
|
+
{
|
|
1050
|
+
duration: 2,
|
|
1051
|
+
clockwise: false,
|
|
1052
|
+
containerClassName: "rounded-full border-0",
|
|
1053
|
+
as: "button",
|
|
1054
|
+
className: "dark:bg-white size-5 bg-black dark:text-white flex justify-center items-center",
|
|
1055
|
+
children: isLoading ? /* @__PURE__ */ jsx4(Loader2, { className: "size-3 dark:text-black text-white animate-spin" }) : /* @__PURE__ */ jsx4(StarsIcon, { className: "dark:text-purple-600 text-purple-300 size-3" })
|
|
1056
|
+
}
|
|
1057
|
+
) }),
|
|
1058
|
+
/* @__PURE__ */ jsx4(
|
|
1059
|
+
PlaceholdersAndVanishInput,
|
|
1060
|
+
{
|
|
1061
|
+
placeholders,
|
|
1062
|
+
onChange: handleInputChange,
|
|
1063
|
+
onSubmit: handleSubmit,
|
|
1064
|
+
disabled: isLoading
|
|
1065
|
+
}
|
|
1066
|
+
)
|
|
1067
|
+
] })
|
|
1068
|
+
] }),
|
|
1069
|
+
/* @__PURE__ */ jsx4("div", { className: "w-full max-h-[220px] z-50 rounded border mt-2 overflow-hidden bg-popover", children: !completion ? /* @__PURE__ */ jsxs3(Command, { id: "toolbar", className: "w-full ", children: [
|
|
1070
|
+
/* @__PURE__ */ jsx4(CommandInput, { placeholder: "Type a command" }),
|
|
1071
|
+
/* @__PURE__ */ jsxs3(CommandList, { children: [
|
|
1072
|
+
/* @__PURE__ */ jsx4(CommandEmpty, { children: "No results found." }),
|
|
1073
|
+
/* @__PURE__ */ jsx4(CommandGroup, { heading: "Suggested", children: Actions.suggestion.map((sug) => /* @__PURE__ */ jsxs3(HoverCard, { children: [
|
|
1074
|
+
/* @__PURE__ */ jsx4(HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(
|
|
1075
|
+
CommandItem,
|
|
1076
|
+
{
|
|
1077
|
+
className: "w-full cursor-pointer",
|
|
1078
|
+
onSelect: () => sug.onClick(),
|
|
1079
|
+
onClick: () => sug.onClick(),
|
|
1080
|
+
children: [
|
|
1081
|
+
/* @__PURE__ */ jsx4("div", { children: sug.icon }),
|
|
1082
|
+
/* @__PURE__ */ jsx4("span", { children: sug.label })
|
|
1083
|
+
]
|
|
1084
|
+
}
|
|
1085
|
+
) }),
|
|
1086
|
+
/* @__PURE__ */ jsx4(
|
|
1087
|
+
HoverCardContent,
|
|
1088
|
+
{
|
|
1089
|
+
className: " p-2",
|
|
1090
|
+
side: "right",
|
|
1091
|
+
alignOffset: 60,
|
|
1092
|
+
sideOffset: 30,
|
|
1093
|
+
children: /* @__PURE__ */ jsx4("span", { className: "text-sm break-words text-muted-foreground", children: sug.HoverCard.desc })
|
|
1094
|
+
}
|
|
1095
|
+
)
|
|
1096
|
+
] }, sug.label)) }),
|
|
1097
|
+
/* @__PURE__ */ jsx4(CommandSeparator, {}),
|
|
1098
|
+
/* @__PURE__ */ jsx4(CommandGroup, { heading: "format block", children: Actions.format_block.map((sug) => /* @__PURE__ */ jsxs3(HoverCard, { children: [
|
|
1099
|
+
/* @__PURE__ */ jsx4(HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(
|
|
1100
|
+
CommandItem,
|
|
1101
|
+
{
|
|
1102
|
+
className: "w-full cursor-pointer",
|
|
1103
|
+
onSelect: () => sug.onClick(),
|
|
1104
|
+
onClick: () => sug.onClick(),
|
|
1105
|
+
children: [
|
|
1106
|
+
/* @__PURE__ */ jsx4("div", { children: sug.icon }),
|
|
1107
|
+
/* @__PURE__ */ jsx4("span", { children: sug.label })
|
|
1108
|
+
]
|
|
1109
|
+
}
|
|
1110
|
+
) }),
|
|
1111
|
+
/* @__PURE__ */ jsx4(
|
|
1112
|
+
HoverCardContent,
|
|
1113
|
+
{
|
|
1114
|
+
className: " p-2",
|
|
1115
|
+
side: "right",
|
|
1116
|
+
alignOffset: 60,
|
|
1117
|
+
sideOffset: 30,
|
|
1118
|
+
children: /* @__PURE__ */ jsx4("span", { className: "text-sm break-words text-muted-foreground", children: sug.HoverCard.desc })
|
|
1119
|
+
}
|
|
1120
|
+
)
|
|
1121
|
+
] }, sug.label)) }),
|
|
1122
|
+
/* @__PURE__ */ jsx4(CommandSeparator, {}),
|
|
1123
|
+
/* @__PURE__ */ jsx4(CommandGroup, { heading: "Edit", children: Actions.Edit.map((sug) => /* @__PURE__ */ jsxs3(HoverCard, { children: [
|
|
1124
|
+
/* @__PURE__ */ jsx4(HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(
|
|
1125
|
+
CommandItem,
|
|
1126
|
+
{
|
|
1127
|
+
className: "w-full cursor-pointer",
|
|
1128
|
+
onSelect: () => sug.onClick(),
|
|
1129
|
+
onClick: () => sug.onClick(),
|
|
1130
|
+
children: [
|
|
1131
|
+
/* @__PURE__ */ jsx4("div", { children: sug.icon }),
|
|
1132
|
+
/* @__PURE__ */ jsx4("span", { children: sug.label })
|
|
1133
|
+
]
|
|
1134
|
+
}
|
|
1135
|
+
) }),
|
|
1136
|
+
/* @__PURE__ */ jsx4(
|
|
1137
|
+
HoverCardContent,
|
|
1138
|
+
{
|
|
1139
|
+
className: "p-2",
|
|
1140
|
+
side: "right",
|
|
1141
|
+
alignOffset: 60,
|
|
1142
|
+
sideOffset: 30,
|
|
1143
|
+
children: /* @__PURE__ */ jsx4("span", { className: "text-sm text-muted-foreground", children: sug.HoverCard.desc })
|
|
1144
|
+
}
|
|
1145
|
+
)
|
|
1146
|
+
] }, sug.label)) })
|
|
1147
|
+
] })
|
|
1148
|
+
] }) : /* @__PURE__ */ jsxs3(Command, { id: "toolbar", className: "w-full", children: [
|
|
1149
|
+
/* @__PURE__ */ jsx4(CommandInput, { placeholder: "Type a command" }),
|
|
1150
|
+
/* @__PURE__ */ jsxs3(CommandList, { children: [
|
|
1151
|
+
/* @__PURE__ */ jsx4(CommandEmpty, { children: "No results found." }),
|
|
1152
|
+
/* @__PURE__ */ jsx4(CommandGroup, { children: response.map((sug) => /* @__PURE__ */ jsxs3(HoverCard, { children: [
|
|
1153
|
+
/* @__PURE__ */ jsx4(HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(
|
|
1154
|
+
CommandItem,
|
|
1155
|
+
{
|
|
1156
|
+
disabled: isLoading,
|
|
1157
|
+
className: "w-full cursor-pointer",
|
|
1158
|
+
onSelect: () => sug.func(),
|
|
1159
|
+
onClick: () => sug.func(),
|
|
1160
|
+
children: [
|
|
1161
|
+
/* @__PURE__ */ jsx4("div", { children: sug.icon }),
|
|
1162
|
+
/* @__PURE__ */ jsx4("span", { children: sug.label })
|
|
1163
|
+
]
|
|
1164
|
+
}
|
|
1165
|
+
) }),
|
|
1166
|
+
/* @__PURE__ */ jsx4(
|
|
1167
|
+
HoverCardContent,
|
|
1168
|
+
{
|
|
1169
|
+
className: " p-2",
|
|
1170
|
+
side: "right",
|
|
1171
|
+
alignOffset: 60,
|
|
1172
|
+
sideOffset: 30,
|
|
1173
|
+
children: /* @__PURE__ */ jsx4("span", { className: "text-sm break-words text-muted-foreground", children: sug.HoverCard.desc })
|
|
1174
|
+
}
|
|
1175
|
+
)
|
|
1176
|
+
] }, sug.label)) })
|
|
1177
|
+
] })
|
|
1178
|
+
] }) })
|
|
1179
|
+
] }) })
|
|
1180
|
+
] });
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
// src/components/ui/write/text-format-floting-toolbar.tsx
|
|
1184
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1185
|
+
function TextFormatFloatingToolbar({
|
|
1186
|
+
editor,
|
|
1187
|
+
anchorElem,
|
|
1188
|
+
isLink,
|
|
1189
|
+
isBold,
|
|
1190
|
+
isItalic,
|
|
1191
|
+
isUnderline,
|
|
1192
|
+
isUppercase,
|
|
1193
|
+
isLowercase,
|
|
1194
|
+
isCapitalize,
|
|
1195
|
+
isCode,
|
|
1196
|
+
fontColor,
|
|
1197
|
+
isStrikethrough,
|
|
1198
|
+
isSubscript,
|
|
1199
|
+
isSuperscript,
|
|
1200
|
+
bgColor,
|
|
1201
|
+
setIsLinkEditMode,
|
|
1202
|
+
blockType,
|
|
1203
|
+
fontFamily,
|
|
1204
|
+
rootType,
|
|
1205
|
+
textAlign,
|
|
1206
|
+
fontSize
|
|
1207
|
+
}) {
|
|
1208
|
+
const popupCharStylesEditorRef = useRef3(null);
|
|
1209
|
+
const isSmall = useIsMobile();
|
|
1210
|
+
const insertLink = useCallback2(() => {
|
|
1211
|
+
if (!isLink) {
|
|
1212
|
+
setIsLinkEditMode(true);
|
|
1213
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, sanitizeUrl("https://"));
|
|
1214
|
+
} else {
|
|
1215
|
+
setIsLinkEditMode(false);
|
|
1216
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
1217
|
+
}
|
|
1218
|
+
}, [editor, setIsLinkEditMode, isLink]);
|
|
1219
|
+
function mouseMoveListener(e) {
|
|
1220
|
+
if ((popupCharStylesEditorRef == null ? void 0 : popupCharStylesEditorRef.current) && (e.buttons === 1 || e.buttons === 3)) {
|
|
1221
|
+
if (popupCharStylesEditorRef.current.style.pointerEvents !== "none") {
|
|
1222
|
+
const x = e.clientX;
|
|
1223
|
+
const y = e.clientY;
|
|
1224
|
+
const elementUnderMouse = document.elementFromPoint(x, y);
|
|
1225
|
+
if (!popupCharStylesEditorRef.current.contains(elementUnderMouse)) {
|
|
1226
|
+
popupCharStylesEditorRef.current.style.pointerEvents = "none";
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
function mouseUpListener(e) {
|
|
1232
|
+
if (popupCharStylesEditorRef == null ? void 0 : popupCharStylesEditorRef.current) {
|
|
1233
|
+
if (popupCharStylesEditorRef.current.style.pointerEvents !== "auto") {
|
|
1234
|
+
popupCharStylesEditorRef.current.style.pointerEvents = "auto";
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
useEffect4(() => {
|
|
1239
|
+
if (popupCharStylesEditorRef == null ? void 0 : popupCharStylesEditorRef.current) {
|
|
1240
|
+
popupCharStylesEditorRef.current.style.pointerEvents = "auto";
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1243
|
+
useEffect4(() => {
|
|
1244
|
+
if (popupCharStylesEditorRef == null ? void 0 : popupCharStylesEditorRef.current) {
|
|
1245
|
+
document.addEventListener("mousemove", mouseMoveListener);
|
|
1246
|
+
document.addEventListener("mouseup", mouseUpListener);
|
|
1247
|
+
return () => {
|
|
1248
|
+
document.removeEventListener("mousemove", mouseMoveListener);
|
|
1249
|
+
document.removeEventListener("mouseup", mouseUpListener);
|
|
1250
|
+
if (popupCharStylesEditorRef.current) {
|
|
1251
|
+
popupCharStylesEditorRef.current.style.pointerEvents = "auto";
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
}, [popupCharStylesEditorRef]);
|
|
1256
|
+
const $updateTextFormatFloatingToolbar = useCallback2(() => {
|
|
1257
|
+
const selection = $getSelection();
|
|
1258
|
+
const popupCharStylesEditorElem = popupCharStylesEditorRef.current;
|
|
1259
|
+
const nativeSelection = getDOMSelection(editor._window);
|
|
1260
|
+
if (!popupCharStylesEditorElem) return;
|
|
1261
|
+
const rootElement = editor.getRootElement();
|
|
1262
|
+
if (selection && nativeSelection && !nativeSelection.isCollapsed && rootElement && rootElement.contains(nativeSelection.anchorNode)) {
|
|
1263
|
+
const rangeRect = getDOMRangeRect(nativeSelection, rootElement);
|
|
1264
|
+
setFloatingElemPosition(rangeRect, popupCharStylesEditorElem, anchorElem);
|
|
1265
|
+
}
|
|
1266
|
+
}, [editor, anchorElem]);
|
|
1267
|
+
useEffect4(() => {
|
|
1268
|
+
const scrollerElem = anchorElem.parentElement;
|
|
1269
|
+
const update = () => {
|
|
1270
|
+
editor.getEditorState().read(() => {
|
|
1271
|
+
$updateTextFormatFloatingToolbar();
|
|
1272
|
+
});
|
|
1273
|
+
};
|
|
1274
|
+
window.addEventListener("resize", update);
|
|
1275
|
+
if (scrollerElem) {
|
|
1276
|
+
scrollerElem.addEventListener("scroll", update);
|
|
1277
|
+
}
|
|
1278
|
+
return () => {
|
|
1279
|
+
window.removeEventListener("resize", update);
|
|
1280
|
+
if (scrollerElem) {
|
|
1281
|
+
scrollerElem.removeEventListener("scroll", update);
|
|
1282
|
+
}
|
|
1283
|
+
};
|
|
1284
|
+
}, [editor, $updateTextFormatFloatingToolbar, anchorElem]);
|
|
1285
|
+
useEffect4(() => {
|
|
1286
|
+
editor.getEditorState().read(() => {
|
|
1287
|
+
$updateTextFormatFloatingToolbar();
|
|
1288
|
+
});
|
|
1289
|
+
return mergeRegister(
|
|
1290
|
+
editor.registerUpdateListener(({ editorState }) => {
|
|
1291
|
+
editorState.read(() => {
|
|
1292
|
+
$updateTextFormatFloatingToolbar();
|
|
1293
|
+
});
|
|
1294
|
+
}),
|
|
1295
|
+
editor.registerCommand(
|
|
1296
|
+
SELECTION_CHANGE_COMMAND,
|
|
1297
|
+
() => {
|
|
1298
|
+
$updateTextFormatFloatingToolbar();
|
|
1299
|
+
return false;
|
|
1300
|
+
},
|
|
1301
|
+
COMMAND_PRIORITY_LOW
|
|
1302
|
+
)
|
|
1303
|
+
);
|
|
1304
|
+
}, [editor, $updateTextFormatFloatingToolbar]);
|
|
1305
|
+
return /* @__PURE__ */ jsxs4(
|
|
1306
|
+
"div",
|
|
1307
|
+
{
|
|
1308
|
+
id: "toolbar",
|
|
1309
|
+
ref: popupCharStylesEditorRef,
|
|
1310
|
+
className: `
|
|
1311
|
+
z-[50] h-[30px] p-1 px-2 max-sm:p-2 max-sm:h-[295px] max-sm:w-[32px] max-sm:overflow-y-auto
|
|
1312
|
+
border dark:border-zinc-800 dark:bg-zinc-900 text-zinc-950 dark:text-zinc-50 border-zinc-200 bg-white/90
|
|
1313
|
+
inline-flex flex-row max-sm:flex-col items-center shadow-md absolute top-0 left-0 text-sm rounded-[6px]
|
|
1314
|
+
`,
|
|
1315
|
+
children: [
|
|
1316
|
+
/* @__PURE__ */ jsx5(AiButton, { editor }),
|
|
1317
|
+
/* @__PURE__ */ jsx5(
|
|
1318
|
+
Separator,
|
|
1319
|
+
{
|
|
1320
|
+
orientation: "vertical",
|
|
1321
|
+
className: "max-sm:h-[1px] max-sm:my-1 max-sm:w-5 h-5 mx-1"
|
|
1322
|
+
}
|
|
1323
|
+
),
|
|
1324
|
+
/* @__PURE__ */ jsx5(
|
|
1325
|
+
BlockFormatDropDown,
|
|
1326
|
+
{
|
|
1327
|
+
editor,
|
|
1328
|
+
blockType,
|
|
1329
|
+
style: { height: "25px" },
|
|
1330
|
+
ShowChevronsUpDown: false,
|
|
1331
|
+
side: isSmall ? "right" : "bottom",
|
|
1332
|
+
sideOffset: isSmall ? 10 : 5
|
|
1333
|
+
}
|
|
1334
|
+
),
|
|
1335
|
+
/* @__PURE__ */ jsx5(
|
|
1336
|
+
Separator,
|
|
1337
|
+
{
|
|
1338
|
+
orientation: "vertical",
|
|
1339
|
+
className: "max-sm:h-[1px] max-sm:my-1 max-sm:w-5 h-5 mx-1"
|
|
1340
|
+
}
|
|
1341
|
+
),
|
|
1342
|
+
/* @__PURE__ */ jsx5(
|
|
1343
|
+
FontSize,
|
|
1344
|
+
{
|
|
1345
|
+
selectionFontSize: fontSize.slice(0, -2),
|
|
1346
|
+
editor,
|
|
1347
|
+
disabled: false,
|
|
1348
|
+
className: "h-[25px]",
|
|
1349
|
+
classNameContent: "max-sm:flex-col"
|
|
1350
|
+
}
|
|
1351
|
+
),
|
|
1352
|
+
/* @__PURE__ */ jsx5(
|
|
1353
|
+
Separator,
|
|
1354
|
+
{
|
|
1355
|
+
orientation: "vertical",
|
|
1356
|
+
className: "max-sm:h-[1px] max-sm:my-1 max-sm:w-5 h-5 mx-1"
|
|
1357
|
+
}
|
|
1358
|
+
),
|
|
1359
|
+
/* @__PURE__ */ jsx5(
|
|
1360
|
+
Font,
|
|
1361
|
+
{
|
|
1362
|
+
disabled: false,
|
|
1363
|
+
style: { fontFamily, height: "25px", padding: "0px 13px" },
|
|
1364
|
+
value: fontFamily,
|
|
1365
|
+
editor,
|
|
1366
|
+
ShowChevronsUpDown: false,
|
|
1367
|
+
side: isSmall ? "right" : "bottom",
|
|
1368
|
+
sideOffset: isSmall ? 10 : 5
|
|
1369
|
+
}
|
|
1370
|
+
),
|
|
1371
|
+
/* @__PURE__ */ jsx5(
|
|
1372
|
+
Separator,
|
|
1373
|
+
{
|
|
1374
|
+
orientation: "vertical",
|
|
1375
|
+
className: "max-sm:h-[1px] max-sm:my-1 max-sm:w-5 h-5 mx-1"
|
|
1376
|
+
}
|
|
1377
|
+
),
|
|
1378
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-row max-sm:flex-col gap-1 items-center justify-center", children: [
|
|
1379
|
+
/* @__PURE__ */ jsx5(
|
|
1380
|
+
Toggle,
|
|
1381
|
+
{
|
|
1382
|
+
variant: "outline",
|
|
1383
|
+
size: "floting",
|
|
1384
|
+
pressed: isBold,
|
|
1385
|
+
onPressedChange: () => {
|
|
1386
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
|
|
1387
|
+
},
|
|
1388
|
+
tip: `Bold ${SHORTCUTS.BOLD}`,
|
|
1389
|
+
"aria-label": `Format text as bold. Shortcut: ${SHORTCUTS.BOLD}`,
|
|
1390
|
+
children: /* @__PURE__ */ jsx5(Bold, {})
|
|
1391
|
+
}
|
|
1392
|
+
),
|
|
1393
|
+
/* @__PURE__ */ jsx5(
|
|
1394
|
+
Toggle,
|
|
1395
|
+
{
|
|
1396
|
+
variant: "outline",
|
|
1397
|
+
size: "floting",
|
|
1398
|
+
pressed: isItalic,
|
|
1399
|
+
onPressedChange: () => {
|
|
1400
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic");
|
|
1401
|
+
},
|
|
1402
|
+
tip: `Italic (${SHORTCUTS.ITALIC})`,
|
|
1403
|
+
type: "button",
|
|
1404
|
+
"aria-label": `Format text as italics. Shortcut: ${SHORTCUTS.ITALIC}`,
|
|
1405
|
+
children: /* @__PURE__ */ jsx5(Italic, {})
|
|
1406
|
+
}
|
|
1407
|
+
),
|
|
1408
|
+
/* @__PURE__ */ jsx5(
|
|
1409
|
+
Toggle,
|
|
1410
|
+
{
|
|
1411
|
+
variant: "outline",
|
|
1412
|
+
size: "floting",
|
|
1413
|
+
pressed: isUnderline,
|
|
1414
|
+
onPressedChange: () => {
|
|
1415
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline");
|
|
1416
|
+
},
|
|
1417
|
+
tip: `Underline (${SHORTCUTS.UNDERLINE})`,
|
|
1418
|
+
type: "button",
|
|
1419
|
+
"aria-label": `Format text to underlined. Shortcut: ${SHORTCUTS.UNDERLINE}`,
|
|
1420
|
+
children: /* @__PURE__ */ jsx5(UnderlineIcon, {})
|
|
1421
|
+
}
|
|
1422
|
+
),
|
|
1423
|
+
/* @__PURE__ */ jsx5(
|
|
1424
|
+
Toggle,
|
|
1425
|
+
{
|
|
1426
|
+
variant: "outline",
|
|
1427
|
+
size: "floting",
|
|
1428
|
+
pressed: isCode,
|
|
1429
|
+
onPressedChange: () => {
|
|
1430
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "code");
|
|
1431
|
+
},
|
|
1432
|
+
tip: `Insert code block (${SHORTCUTS.INSERT_CODE_BLOCK})`,
|
|
1433
|
+
type: "button",
|
|
1434
|
+
"aria-label": "Insert code block",
|
|
1435
|
+
children: /* @__PURE__ */ jsx5(Code, {})
|
|
1436
|
+
}
|
|
1437
|
+
),
|
|
1438
|
+
/* @__PURE__ */ jsx5(
|
|
1439
|
+
Toggle,
|
|
1440
|
+
{
|
|
1441
|
+
variant: "outline",
|
|
1442
|
+
size: "floting",
|
|
1443
|
+
onPressedChange: insertLink,
|
|
1444
|
+
pressed: isLink,
|
|
1445
|
+
"aria-label": "Insert link",
|
|
1446
|
+
tip: `Insert link (${SHORTCUTS.INSERT_LINK})`,
|
|
1447
|
+
type: "button",
|
|
1448
|
+
children: /* @__PURE__ */ jsx5(Link, {})
|
|
1449
|
+
}
|
|
1450
|
+
),
|
|
1451
|
+
/* @__PURE__ */ jsx5(
|
|
1452
|
+
Toggle,
|
|
1453
|
+
{
|
|
1454
|
+
variant: "outline",
|
|
1455
|
+
size: "floting",
|
|
1456
|
+
onPressedChange: () => {
|
|
1457
|
+
editor.dispatchCommand(INSERT_COMMENT_COMMAND, void 0);
|
|
1458
|
+
},
|
|
1459
|
+
pressed: false,
|
|
1460
|
+
"aria-label": "Add comment",
|
|
1461
|
+
tip: "Add comment (Ctrl+Alt+M)",
|
|
1462
|
+
type: "button",
|
|
1463
|
+
children: /* @__PURE__ */ jsx5(MessageSquarePlus, {})
|
|
1464
|
+
}
|
|
1465
|
+
)
|
|
1466
|
+
] }),
|
|
1467
|
+
/* @__PURE__ */ jsx5(
|
|
1468
|
+
Separator,
|
|
1469
|
+
{
|
|
1470
|
+
orientation: "vertical",
|
|
1471
|
+
className: "max-sm:h-[1px] max-sm:my-1 max-sm:w-5 h-5 mx-1"
|
|
1472
|
+
}
|
|
1473
|
+
),
|
|
1474
|
+
/* @__PURE__ */ jsx5(
|
|
1475
|
+
Color,
|
|
1476
|
+
{
|
|
1477
|
+
disabled: false,
|
|
1478
|
+
side: isSmall ? "right" : "bottom",
|
|
1479
|
+
sideOffset: isSmall ? 10 : 5,
|
|
1480
|
+
style: { height: "25px" },
|
|
1481
|
+
color: fontColor,
|
|
1482
|
+
bgColor,
|
|
1483
|
+
editor
|
|
1484
|
+
}
|
|
1485
|
+
),
|
|
1486
|
+
/* @__PURE__ */ jsx5(
|
|
1487
|
+
Separator,
|
|
1488
|
+
{
|
|
1489
|
+
orientation: "vertical",
|
|
1490
|
+
className: "max-sm:h-[1px] max-sm:my-1 max-sm:w-5 h-5 mx-1"
|
|
1491
|
+
}
|
|
1492
|
+
),
|
|
1493
|
+
/* @__PURE__ */ jsx5(
|
|
1494
|
+
TextFormat,
|
|
1495
|
+
{
|
|
1496
|
+
disabled: false,
|
|
1497
|
+
editor,
|
|
1498
|
+
ShowChevronsUpDown: false,
|
|
1499
|
+
side: isSmall ? "right" : "bottom",
|
|
1500
|
+
sideOffset: isSmall ? 10 : 5,
|
|
1501
|
+
style: { height: "25px" },
|
|
1502
|
+
toolbarState: {
|
|
1503
|
+
isLowercase,
|
|
1504
|
+
isUppercase,
|
|
1505
|
+
isCapitalize,
|
|
1506
|
+
isStrikethrough,
|
|
1507
|
+
isSubscript,
|
|
1508
|
+
isSuperscript
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
)
|
|
1512
|
+
]
|
|
1513
|
+
}
|
|
1514
|
+
);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
// src/components/editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx
|
|
1518
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1519
|
+
function useFloatingTextFormatToolbar(editor, anchorElem, setIsLinkEditMode) {
|
|
1520
|
+
const [isText, setIsText] = useState5(false);
|
|
1521
|
+
const [isLink, setIsLink] = useState5(false);
|
|
1522
|
+
const [isBold, setIsBold] = useState5(false);
|
|
1523
|
+
const [isItalic, setIsItalic] = useState5(false);
|
|
1524
|
+
const [isUnderline, setIsUnderline] = useState5(false);
|
|
1525
|
+
const [isStrikethrough, setIsStrikethrough] = useState5(false);
|
|
1526
|
+
const [isCode, setIsCode] = useState5(false);
|
|
1527
|
+
const [fontColor, setFontColor] = useState5("#000000");
|
|
1528
|
+
const [bgColor, setBgColor] = useState5("#ffffff");
|
|
1529
|
+
const [fontFamily, setFontFamily] = useState5("Arial");
|
|
1530
|
+
const [blockType, setBlockType] = useState5("paragraph");
|
|
1531
|
+
const [isUppercase, setIsUppercase] = useState5(false);
|
|
1532
|
+
const [isLowercase, setIsLowercase] = useState5(false);
|
|
1533
|
+
const [isCapitalize, setIsCapitalize] = useState5(false);
|
|
1534
|
+
const [isSubscript, setIsSubscript] = useState5(false);
|
|
1535
|
+
const [isSuperscript, setIsSuperscript] = useState5(false);
|
|
1536
|
+
const [rootType, setRootType] = useState5("root");
|
|
1537
|
+
const [textAlign, setTextAlign] = useState5(null);
|
|
1538
|
+
const [fontSize, setFontSize] = useState5("16px");
|
|
1539
|
+
const toolbarRef = useRef4(null);
|
|
1540
|
+
const updatePopup = useCallback3(() => {
|
|
1541
|
+
editor.getEditorState().read(() => {
|
|
1542
|
+
var _a;
|
|
1543
|
+
if (editor.isComposing()) {
|
|
1544
|
+
return;
|
|
1545
|
+
}
|
|
1546
|
+
const selection = $getSelection2();
|
|
1547
|
+
const nativeSelection = getDOMSelection2(editor._window);
|
|
1548
|
+
const rootElement = editor.getRootElement();
|
|
1549
|
+
const aiElement = document.querySelector(".AI-format");
|
|
1550
|
+
if (nativeSelection && nativeSelection.anchorNode instanceof HTMLElement && nativeSelection.anchorNode.closest(".dropdown-portal")) {
|
|
1551
|
+
return;
|
|
1552
|
+
}
|
|
1553
|
+
if (nativeSelection !== null && (!$isRangeSelection(selection) || rootElement === null || !rootElement.contains(nativeSelection.anchorNode)) && !((_a = toolbarRef == null ? void 0 : toolbarRef.current) == null ? void 0 : _a.contains(nativeSelection.anchorNode)) && !(aiElement && aiElement.contains(nativeSelection.anchorNode))) {
|
|
1554
|
+
setIsText(false);
|
|
1555
|
+
return;
|
|
1556
|
+
}
|
|
1557
|
+
if (!$isRangeSelection(selection)) {
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
const node = getSelectedNode(selection);
|
|
1561
|
+
setIsBold(selection.hasFormat("bold"));
|
|
1562
|
+
setIsItalic(selection.hasFormat("italic"));
|
|
1563
|
+
setIsUnderline(selection.hasFormat("underline"));
|
|
1564
|
+
setIsStrikethrough(selection.hasFormat("strikethrough"));
|
|
1565
|
+
setIsSubscript(selection.hasFormat("subscript"));
|
|
1566
|
+
setIsLowercase(selection.hasFormat("lowercase"));
|
|
1567
|
+
setIsUppercase(selection.hasFormat("uppercase"));
|
|
1568
|
+
setIsCapitalize(selection.hasFormat("capitalize"));
|
|
1569
|
+
setIsSubscript(selection.hasFormat("subscript"));
|
|
1570
|
+
setIsSuperscript(selection.hasFormat("superscript"));
|
|
1571
|
+
setIsCode(selection.hasFormat("code"));
|
|
1572
|
+
const size = $getSelectionStyleValueForProperty(
|
|
1573
|
+
selection,
|
|
1574
|
+
"font-size",
|
|
1575
|
+
"16px"
|
|
1576
|
+
);
|
|
1577
|
+
setFontSize(size);
|
|
1578
|
+
const alignment = $getSelectionStyleValueForProperty(
|
|
1579
|
+
selection,
|
|
1580
|
+
"text-align",
|
|
1581
|
+
"left"
|
|
1582
|
+
);
|
|
1583
|
+
setTextAlign(alignment);
|
|
1584
|
+
const parent = node.getParent();
|
|
1585
|
+
if ($isLinkNode(parent) || $isLinkNode(node)) {
|
|
1586
|
+
setIsLink(true);
|
|
1587
|
+
} else {
|
|
1588
|
+
setIsLink(false);
|
|
1589
|
+
}
|
|
1590
|
+
if (!$isCodeHighlightNode(selection.anchor.getNode()) && selection.getTextContent() !== "") {
|
|
1591
|
+
setIsText($isTextNode(node) || $isParagraphNode(node));
|
|
1592
|
+
} else {
|
|
1593
|
+
setIsText(false);
|
|
1594
|
+
}
|
|
1595
|
+
const rawTextContent = selection.getTextContent().replace(/\n/g, "");
|
|
1596
|
+
if (!selection.isCollapsed() && rawTextContent === "") {
|
|
1597
|
+
setIsText(false);
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
setFontFamily(
|
|
1601
|
+
$getSelectionStyleValueForProperty(selection, "font-family", "Arial")
|
|
1602
|
+
);
|
|
1603
|
+
setFontColor($getSelectionStyleValueForProperty(selection, "color"));
|
|
1604
|
+
setBgColor(
|
|
1605
|
+
$getSelectionStyleValueForProperty(selection, "background-color")
|
|
1606
|
+
);
|
|
1607
|
+
const tableNode = $findMatchingParent(node, $isTableNode);
|
|
1608
|
+
if ($isTableNode(tableNode)) {
|
|
1609
|
+
setRootType("table");
|
|
1610
|
+
} else {
|
|
1611
|
+
setRootType("root");
|
|
1612
|
+
}
|
|
1613
|
+
const anchorNode = selection.anchor.getNode();
|
|
1614
|
+
let element = anchorNode.getKey() === "root" ? anchorNode : $findMatchingParent(anchorNode, (e) => {
|
|
1615
|
+
const parent2 = e.getParent();
|
|
1616
|
+
return parent2 !== null && $isRootOrShadowRoot(parent2);
|
|
1617
|
+
});
|
|
1618
|
+
if ($isListNode(element)) {
|
|
1619
|
+
const parentList = $getNearestNodeOfType(
|
|
1620
|
+
anchorNode,
|
|
1621
|
+
ListNode
|
|
1622
|
+
);
|
|
1623
|
+
const type = parentList ? parentList.getListType() : element.getListType();
|
|
1624
|
+
setBlockType(type);
|
|
1625
|
+
} else {
|
|
1626
|
+
const type = $isHeadingNode(element) ? element.getTag() : (
|
|
1627
|
+
// @ts-ignore
|
|
1628
|
+
element.getType()
|
|
1629
|
+
);
|
|
1630
|
+
setBlockType(type);
|
|
1631
|
+
}
|
|
1632
|
+
});
|
|
1633
|
+
}, [editor]);
|
|
1634
|
+
useEffect5(() => {
|
|
1635
|
+
const handleSelectionChange = () => {
|
|
1636
|
+
if (toolbarRef.current && toolbarRef.current.contains(document.activeElement)) {
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
updatePopup();
|
|
1640
|
+
};
|
|
1641
|
+
document.addEventListener("selectionchange", handleSelectionChange);
|
|
1642
|
+
return () => {
|
|
1643
|
+
document.removeEventListener("selectionchange", handleSelectionChange);
|
|
1644
|
+
};
|
|
1645
|
+
}, [updatePopup]);
|
|
1646
|
+
useEffect5(() => {
|
|
1647
|
+
return mergeRegister2(
|
|
1648
|
+
editor.registerUpdateListener(() => {
|
|
1649
|
+
updatePopup();
|
|
1650
|
+
}),
|
|
1651
|
+
editor.registerRootListener(() => {
|
|
1652
|
+
if (editor.getRootElement() === null) {
|
|
1653
|
+
setIsText(false);
|
|
1654
|
+
}
|
|
1655
|
+
})
|
|
1656
|
+
);
|
|
1657
|
+
}, [editor, updatePopup]);
|
|
1658
|
+
if (!isText) {
|
|
1659
|
+
return null;
|
|
1660
|
+
}
|
|
1661
|
+
return createPortal(
|
|
1662
|
+
/* @__PURE__ */ jsx6("div", { ref: toolbarRef, className: "hidden md:block", children: /* @__PURE__ */ jsx6(
|
|
1663
|
+
TextFormatFloatingToolbar,
|
|
1664
|
+
{
|
|
1665
|
+
editor,
|
|
1666
|
+
anchorElem,
|
|
1667
|
+
isLink,
|
|
1668
|
+
isBold,
|
|
1669
|
+
isItalic,
|
|
1670
|
+
isStrikethrough,
|
|
1671
|
+
isUnderline,
|
|
1672
|
+
isCode,
|
|
1673
|
+
fontColor,
|
|
1674
|
+
bgColor,
|
|
1675
|
+
blockType,
|
|
1676
|
+
fontFamily,
|
|
1677
|
+
setIsLinkEditMode,
|
|
1678
|
+
isUppercase,
|
|
1679
|
+
rootType,
|
|
1680
|
+
textAlign,
|
|
1681
|
+
isLowercase,
|
|
1682
|
+
isCapitalize,
|
|
1683
|
+
isSubscript,
|
|
1684
|
+
fontSize,
|
|
1685
|
+
isSuperscript
|
|
1686
|
+
}
|
|
1687
|
+
) }),
|
|
1688
|
+
anchorElem
|
|
1689
|
+
);
|
|
1690
|
+
}
|
|
1691
|
+
function FloatingTextFormatToolbarPlugin({
|
|
1692
|
+
anchorElem = document.body,
|
|
1693
|
+
setIsLinkEditMode
|
|
1694
|
+
}) {
|
|
1695
|
+
const [editor] = useLexicalComposerContext();
|
|
1696
|
+
return useFloatingTextFormatToolbar(editor, anchorElem, setIsLinkEditMode);
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
export {
|
|
1700
|
+
FloatingTextFormatToolbarPlugin
|
|
1701
|
+
};
|