@fuma-content/studio 1.0.0 → 1.0.2
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/build/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/build/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/build/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/build/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/build/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/build/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/build/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/build/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/build/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/build/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/build/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/build/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/build/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/build/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/build/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/build/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/build/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/build/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/build/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/build/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/build/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/build/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/build/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/build/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/build/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/build/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/build/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/build/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/build/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/build/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/build/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/build/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/build/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/build/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/build/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/build/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/build/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/build/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/build/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/build/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/build/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/build/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/build/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/build/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/build/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/build/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/build/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/build/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/build/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/build/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/build/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/build/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/build/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/build/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/build/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/build/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/build/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/build/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/build/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/build/client/assets/QueryClientProvider-DqiXnN2L.js +1 -0
- package/build/client/assets/actions-DkbV2Z0p.js +1 -0
- package/build/client/assets/actions-DpkI7OTF.js +1 -0
- package/build/client/assets/badge-CZkdLoIP.js +1 -0
- package/build/client/assets/button-Bm94vje1.js +41 -0
- package/build/client/assets/client-BWBqEatf.js +1 -0
- package/build/client/assets/client-Crg-pMcu.js +1 -0
- package/build/client/assets/client-DVneG3Rq.css +1 -0
- package/build/client/assets/client-OSVRoCKH.js +569 -0
- package/build/client/assets/dropdown-menu-EF-sTINr.js +1 -0
- package/build/client/assets/entry.rsc-D51PwnQL.js +1 -0
- package/build/client/assets/index-BdrDVoE8.js +1 -0
- package/build/client/assets/index-BpILsqFO.js +1 -0
- package/build/client/assets/index-Bx93mXy1.js +11 -0
- package/build/client/assets/index-CQRgqbuL.js +1 -0
- package/build/client/assets/index-DOs5iMXj.js +1 -0
- package/build/client/assets/index-DTzAH5JX.js +1 -0
- package/build/client/assets/layout-CnpYRqF0.js +1 -0
- package/build/client/assets/mdx-BNErtsK6.js +1 -0
- package/build/client/assets/page-DOzl4Kpa.js +1 -0
- package/build/client/assets/page-uNpJU_rv.js +1 -0
- package/build/client/assets/query-z9oLNeTD.js +1 -0
- package/build/client/assets/react-B8--K7an.js +10 -0
- package/build/client/assets/root-B_CXTQpA.js +1 -0
- package/build/client/assets/root-D3NoAGI1.js +1 -0
- package/build/client/assets/root-z8crlXSh.css +1 -0
- package/build/client/assets/route-DVneG3Rq.css +1 -0
- package/build/client/assets/router-a9jyj9wf.js +10 -0
- package/build/client/assets/separator-tWFpvpUX.js +1 -0
- package/build/client/assets/sidebar-BBYit8gY.js +12 -0
- package/build/client/assets/site-header-DQkKe-WA.js +1 -0
- package/build/client/assets/spinner-BdPhtfsc.js +1 -0
- package/build/client/assets/tooltip-Dvh-iHDG.js +16 -0
- package/build/client/assets/use-sync-ZgcwUdu_.js +9 -0
- package/build/client/assets/yaml-Cloe7OVn.js +32 -0
- package/build/server/__ssr_build/__vite_rsc_assets_manifest.js +268 -0
- package/build/server/__ssr_build/assets/QueryClientProvider-DlvBH3OQ.js +30 -0
- package/build/server/__ssr_build/assets/actions-B50-3n-a.js +63 -0
- package/build/server/__ssr_build/assets/actions-BFtCTvOL.js +21 -0
- package/{src/components/ui/badge.tsx → build/server/__ssr_build/assets/badge-DYFvBSp8.js} +23 -28
- package/build/server/__ssr_build/assets/button-C_-b_vqm.js +4098 -0
- package/build/server/__ssr_build/assets/client--HXec13w.js +130 -0
- package/build/server/__ssr_build/assets/client-BqW9rGyi.js +116885 -0
- package/build/server/__ssr_build/assets/client-CU90j0R8.js +154 -0
- package/build/server/__ssr_build/assets/dropdown-menu-D2YyT3lP.js +1312 -0
- package/build/server/__ssr_build/assets/entry.rsc-Cg_DxYkh.js +12 -0
- package/build/server/__ssr_build/assets/index-B-gno69w.js +58 -0
- package/build/server/__ssr_build/assets/index-DBc0nhEL.js +288 -0
- package/build/server/__ssr_build/assets/index-Dtw6X3NW.js +1092 -0
- package/build/server/__ssr_build/assets/index-DvVNShHF.js +86 -0
- package/build/server/__ssr_build/assets/index-PpqpVA51.js +612 -0
- package/build/server/__ssr_build/assets/layout-CPnSx9PI.js +454 -0
- package/build/server/__ssr_build/assets/mdx-bmeV1kyx.js +44 -0
- package/build/server/__ssr_build/assets/page-BwoghW3K.js +38 -0
- package/build/server/__ssr_build/assets/page-HxttullC.js +89 -0
- package/build/server/__ssr_build/assets/query-C1_xUNXy.js +1975 -0
- package/build/server/__ssr_build/assets/root-CS7F-km4.js +16 -0
- package/build/server/__ssr_build/assets/root-D-Y-rGw5.js +73 -0
- package/build/server/__ssr_build/assets/separator-8UA_ceSq.js +49 -0
- package/build/server/__ssr_build/assets/sidebar-BzNOZeBO.js +13194 -0
- package/build/server/__ssr_build/assets/site-header-CXHKSzqk.js +13 -0
- package/build/server/__ssr_build/assets/spinner-BXcLlTNs.js +1291 -0
- package/build/server/__ssr_build/assets/tooltip-DZ4WdJt-.js +9553 -0
- package/build/server/__ssr_build/assets/use-sync-TRS0zL-Y.js +3404 -0
- package/build/server/__ssr_build/assets/yaml-BEdFfhvc.js +63 -0
- package/build/server/__ssr_build/index.js +36076 -0
- package/build/server/__vite_rsc_assets_manifest.js +268 -0
- package/build/server/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/build/server/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/build/server/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/build/server/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/build/server/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/build/server/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/build/server/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/build/server/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/build/server/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/build/server/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/build/server/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/build/server/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/build/server/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/build/server/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/build/server/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/build/server/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/build/server/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/build/server/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/build/server/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/build/server/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/build/server/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/build/server/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/build/server/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/build/server/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/build/server/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/build/server/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/build/server/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/build/server/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/build/server/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/build/server/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/build/server/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/build/server/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/build/server/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/build/server/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/build/server/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/build/server/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/build/server/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/build/server/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/build/server/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/build/server/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/build/server/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/build/server/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/build/server/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/build/server/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/build/server/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/build/server/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/build/server/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/build/server/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/build/server/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/build/server/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/build/server/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/build/server/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/build/server/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/build/server/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/build/server/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/build/server/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/build/server/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/build/server/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/build/server/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/build/server/assets/actions-C92yn6jE.js +61 -0
- package/build/server/assets/actions-CWWFIcb1.js +46 -0
- package/build/server/assets/actions-DZdN0IBq.js +73 -0
- package/build/server/assets/client-BdxXy6rH.js +13 -0
- package/build/server/assets/client-DLzFPnCR.js +13 -0
- package/build/server/assets/config-Cb909uq6.js +257 -0
- package/build/server/assets/index-X49ifkk3.js +9 -0
- package/build/server/assets/jsx-runtime.react-server-D3We4JeM.js +324 -0
- package/build/server/assets/layout-CRw_6FCt.js +2071 -0
- package/build/server/assets/page-BcrsPZbM.js +9 -0
- package/build/server/assets/page-zlF_Ew1s.js +72 -0
- package/build/server/assets/root-CVOXO6T9.js +23 -0
- package/build/server/assets/root-dGb6ch_9.js +38 -0
- package/build/server/assets/root-z8crlXSh.css +1 -0
- package/build/server/assets/route-DVneG3Rq.css +1 -0
- package/build/server/assets/route-Ds0B4hTo.js +44 -0
- package/build/server/assets/route-DvwlfKZg.js +21 -0
- package/build/server/assets/route-o-6k10r9.js +70774 -0
- package/build/server/index.js +17032 -0
- package/dist/bin/cli.d.mts +1 -0
- package/dist/bin/cli.mjs +71 -0
- package/dist/bin.mjs +14 -40
- package/dist/package.mjs +1 -1
- package/package.json +33 -32
- package/dist/index.d.mts +0 -52
- package/dist/index.mjs +0 -67
- package/dist/mdx/actions.mjs +0 -32
- package/dist/mdx/client.mjs +0 -167
- package/dist/src/components/code-editor/mdx.lazy.mjs +0 -19
- package/dist/src/components/code-editor/mdx.mjs +0 -44
- package/dist/src/components/code-editor/yaml.lazy.mjs +0 -22
- package/dist/src/components/code-editor/yaml.mjs +0 -63
- package/dist/src/components/editor/editor-base-kit.mjs +0 -41
- package/dist/src/components/editor/editor-kit.mjs +0 -73
- package/dist/src/components/editor/md.mjs +0 -42
- package/dist/src/components/editor/plugins/ai-kit.mjs +0 -68
- package/dist/src/components/editor/plugins/align-base-kit.mjs +0 -28
- package/dist/src/components/editor/plugins/align-kit.mjs +0 -30
- package/dist/src/components/editor/plugins/autoformat-kit.mjs +0 -214
- package/dist/src/components/editor/plugins/basic-blocks-base-kit.mjs +0 -22
- package/dist/src/components/editor/plugins/basic-blocks-kit.mjs +0 -51
- package/dist/src/components/editor/plugins/basic-marks-base-kit.mjs +0 -20
- package/dist/src/components/editor/plugins/basic-marks-kit.mjs +0 -28
- package/dist/src/components/editor/plugins/block-menu-kit.mjs +0 -11
- package/dist/src/components/editor/plugins/block-placeholder-kit.mjs +0 -14
- package/dist/src/components/editor/plugins/block-selection-kit.mjs +0 -48
- package/dist/src/components/editor/plugins/callout-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/callout-kit.mjs +0 -10
- package/dist/src/components/editor/plugins/code-block-base-kit.mjs +0 -16
- package/dist/src/components/editor/plugins/code-block-kit.mjs +0 -19
- package/dist/src/components/editor/plugins/column-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/column-kit.mjs +0 -10
- package/dist/src/components/editor/plugins/comment-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/comment-kit.mjs +0 -53
- package/dist/src/components/editor/plugins/copilot-kit.mjs +0 -49
- package/dist/src/components/editor/plugins/cursor-overlay-kit.mjs +0 -11
- package/dist/src/components/editor/plugins/date-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/date-kit.mjs +0 -10
- package/dist/src/components/editor/plugins/discussion-kit.mjs +0 -94
- package/dist/src/components/editor/plugins/dnd-kit.mjs +0 -31
- package/dist/src/components/editor/plugins/emoji-kit.mjs +0 -11
- package/dist/src/components/editor/plugins/exit-break-kit.mjs +0 -12
- package/dist/src/components/editor/plugins/fixed-toolbar-kit.mjs +0 -15
- package/dist/src/components/editor/plugins/floating-toolbar-kit.mjs +0 -15
- package/dist/src/components/editor/plugins/font-base-kit.mjs +0 -14
- package/dist/src/components/editor/plugins/font-kit.mjs +0 -19
- package/dist/src/components/editor/plugins/indent-base-kit.mjs +0 -17
- package/dist/src/components/editor/plugins/indent-kit.mjs +0 -20
- package/dist/src/components/editor/plugins/line-height-base-kit.mjs +0 -20
- package/dist/src/components/editor/plugins/line-height-kit.mjs +0 -22
- package/dist/src/components/editor/plugins/link-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/link-kit.mjs +0 -15
- package/dist/src/components/editor/plugins/list-base-kit.mjs +0 -19
- package/dist/src/components/editor/plugins/list-kit.mjs +0 -22
- package/dist/src/components/editor/plugins/markdown-kit.mjs +0 -17
- package/dist/src/components/editor/plugins/math-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/math-kit.mjs +0 -10
- package/dist/src/components/editor/plugins/media-base-kit.mjs +0 -23
- package/dist/src/components/editor/plugins/media-kit.mjs +0 -37
- package/dist/src/components/editor/plugins/slash-kit.mjs +0 -11
- package/dist/src/components/editor/plugins/suggestion-base-kit.mjs +0 -8
- package/dist/src/components/editor/plugins/suggestion-kit.mjs +0 -50
- package/dist/src/components/editor/plugins/table-base-kit.mjs +0 -13
- package/dist/src/components/editor/plugins/table-kit.mjs +0 -15
- package/dist/src/components/editor/transforms.mjs +0 -125
- package/dist/src/components/editor/ui/ai-chat-editor.mjs +0 -21
- package/dist/src/components/editor/ui/ai-menu.mjs +0 -488
- package/dist/src/components/editor/ui/ai-node.mjs +0 -24
- package/dist/src/components/editor/ui/ai-toolbar-button.mjs +0 -23
- package/dist/src/components/editor/ui/align-toolbar-button.mjs +0 -71
- package/dist/src/components/editor/ui/block-context-menu.mjs +0 -130
- package/dist/src/components/editor/ui/block-discussion.mjs +0 -200
- package/dist/src/components/editor/ui/block-draggable.mjs +0 -265
- package/dist/src/components/editor/ui/block-list-static.mjs +0 -48
- package/dist/src/components/editor/ui/block-list.mjs +0 -47
- package/dist/src/components/editor/ui/block-selection.mjs +0 -28
- package/dist/src/components/editor/ui/block-suggestion.mjs +0 -319
- package/dist/src/components/editor/ui/blockquote-node-static.mjs +0 -14
- package/dist/src/components/editor/ui/blockquote-node.mjs +0 -16
- package/dist/src/components/editor/ui/callout-node-static.mjs +0 -29
- package/dist/src/components/editor/ui/callout-node.mjs +0 -50
- package/dist/src/components/editor/ui/caption.mjs +0 -39
- package/dist/src/components/editor/ui/code-block-node-static.mjs +0 -30
- package/dist/src/components/editor/ui/code-block-node.mjs +0 -121
- package/dist/src/components/editor/ui/code-node-static.mjs +0 -15
- package/dist/src/components/editor/ui/code-node.mjs +0 -17
- package/dist/src/components/editor/ui/column-node-static.mjs +0 -32
- package/dist/src/components/editor/ui/column-node.mjs +0 -229
- package/dist/src/components/editor/ui/comment-node-static.mjs +0 -14
- package/dist/src/components/editor/ui/comment-node.mjs +0 -33
- package/dist/src/components/editor/ui/comment-toolbar-button.mjs +0 -23
- package/dist/src/components/editor/ui/comment.mjs +0 -422
- package/dist/src/components/editor/ui/cursor-overlay.mjs +0 -36
- package/dist/src/components/editor/ui/date-node-static.mjs +0 -32
- package/dist/src/components/editor/ui/date-node.mjs +0 -60
- package/dist/src/components/editor/ui/editor-static.mjs +0 -31
- package/dist/src/components/editor/ui/editor.mjs +0 -60
- package/dist/src/components/editor/ui/emoji-node.mjs +0 -46
- package/dist/src/components/editor/ui/emoji-toolbar-button.mjs +0 -415
- package/dist/src/components/editor/ui/equation-node-static.mjs +0 -65
- package/dist/src/components/editor/ui/equation-node.mjs +0 -159
- package/dist/src/components/editor/ui/equation-toolbar-button.mjs +0 -23
- package/dist/src/components/editor/ui/fixed-toolbar-buttons.mjs +0 -109
- package/dist/src/components/editor/ui/fixed-toolbar.mjs +0 -16
- package/dist/src/components/editor/ui/floating-toolbar-buttons.mjs +0 -54
- package/dist/src/components/editor/ui/floating-toolbar.mjs +0 -51
- package/dist/src/components/editor/ui/font-color-toolbar-button.mjs +0 -637
- package/dist/src/components/editor/ui/font-size-toolbar-button.mjs +0 -83
- package/dist/src/components/editor/ui/ghost-text.mjs +0 -22
- package/dist/src/components/editor/ui/heading-node-static.mjs +0 -60
- package/dist/src/components/editor/ui/heading-node.mjs +0 -62
- package/dist/src/components/editor/ui/highlight-node-static.mjs +0 -15
- package/dist/src/components/editor/ui/highlight-node.mjs +0 -17
- package/dist/src/components/editor/ui/history-toolbar-button.mjs +0 -35
- package/dist/src/components/editor/ui/hr-node-static.mjs +0 -18
- package/dist/src/components/editor/ui/hr-node.mjs +0 -23
- package/dist/src/components/editor/ui/indent-toolbar-button.mjs +0 -29
- package/dist/src/components/editor/ui/inline-combobox.mjs +0 -148
- package/dist/src/components/editor/ui/insert-toolbar-button.mjs +0 -199
- package/dist/src/components/editor/ui/kbd-node-static.mjs +0 -15
- package/dist/src/components/editor/ui/kbd-node.mjs +0 -17
- package/dist/src/components/editor/ui/line-height-toolbar-button.mjs +0 -56
- package/dist/src/components/editor/ui/link-node-static.mjs +0 -20
- package/dist/src/components/editor/ui/link-node.mjs +0 -28
- package/dist/src/components/editor/ui/link-toolbar-button.mjs +0 -21
- package/dist/src/components/editor/ui/link-toolbar.mjs +0 -141
- package/dist/src/components/editor/ui/list-toolbar-button.mjs +0 -131
- package/dist/src/components/editor/ui/mark-toolbar-button.mjs +0 -20
- package/dist/src/components/editor/ui/media-image-node-static.mjs +0 -32
- package/dist/src/components/editor/ui/media-image-node.mjs +0 -64
- package/dist/src/components/editor/ui/media-placeholder-node.mjs +0 -184
- package/dist/src/components/editor/ui/media-preview-dialog.mjs +0 -113
- package/dist/src/components/editor/ui/media-toolbar-button.mjs +0 -156
- package/dist/src/components/editor/ui/media-toolbar.mjs +0 -80
- package/dist/src/components/editor/ui/media-upload-toast.mjs +0 -39
- package/dist/src/components/editor/ui/media-video-node-static.mjs +0 -27
- package/dist/src/components/editor/ui/mode-toolbar-button.mjs +0 -112
- package/dist/src/components/editor/ui/paragraph-node-static.mjs +0 -15
- package/dist/src/components/editor/ui/paragraph-node.mjs +0 -17
- package/dist/src/components/editor/ui/resize-handle.mjs +0 -43
- package/dist/src/components/editor/ui/slash-node.mjs +0 -228
- package/dist/src/components/editor/ui/suggestion-node-static.mjs +0 -24
- package/dist/src/components/editor/ui/suggestion-node.mjs +0 -111
- package/dist/src/components/editor/ui/suggestion-toolbar-button.mjs +0 -24
- package/dist/src/components/editor/ui/table-icons.mjs +0 -1310
- package/dist/src/components/editor/ui/table-node-static.mjs +0 -68
- package/dist/src/components/editor/ui/table-node.mjs +0 -375
- package/dist/src/components/editor/ui/table-toolbar-button.mjs +0 -190
- package/dist/src/components/editor/ui/turn-into-toolbar-button.mjs +0 -168
- package/dist/src/components/editor/use-chat.mjs +0 -80
- package/dist/src/components/json-schema-editor/client.mjs +0 -46
- package/dist/src/components/json-schema-editor/components/inputs.mjs +0 -438
- package/dist/src/components/json-schema-editor/get-default-values.mjs +0 -23
- package/dist/src/components/json-schema-editor/schema.mjs +0 -131
- package/dist/src/components/json-schema-editor/utils/merge-schema.mjs +0 -134
- package/dist/src/components/json-schema-editor/utils/schema-to-string.mjs +0 -53
- package/dist/src/components/ui/alert-dialog.mjs +0 -90
- package/dist/src/components/ui/avatar.mjs +0 -32
- package/dist/src/components/ui/button.mjs +0 -48
- package/dist/src/components/ui/calendar.mjs +0 -108
- package/dist/src/components/ui/checkbox.mjs +0 -23
- package/dist/src/components/ui/combobox.mjs +0 -53
- package/dist/src/components/ui/command.mjs +0 -42
- package/dist/src/components/ui/context-menu.mjs +0 -67
- package/dist/src/components/ui/dialog.mjs +0 -9
- package/dist/src/components/ui/dropdown-menu.mjs +0 -122
- package/dist/src/components/ui/input-group.mjs +0 -31
- package/dist/src/components/ui/input.mjs +0 -15
- package/dist/src/components/ui/label.mjs +0 -19
- package/dist/src/components/ui/popover.mjs +0 -37
- package/dist/src/components/ui/select.mjs +0 -80
- package/dist/src/components/ui/separator.mjs +0 -19
- package/dist/src/components/ui/spinner.mjs +0 -16
- package/dist/src/components/ui/tabs.mjs +0 -39
- package/dist/src/components/ui/textarea.mjs +0 -14
- package/dist/src/components/ui/toolbar.mjs +0 -183
- package/dist/src/components/ui/tooltip.mjs +0 -38
- package/dist/src/hooks/editor/use-is-creator.mjs +0 -19
- package/dist/src/hooks/use-upload-file.mjs +0 -73
- package/dist/src/lib/config.mjs +0 -34
- package/dist/src/lib/data/store.d.mts +0 -15
- package/dist/src/lib/lowlight.mjs +0 -7
- package/dist/src/lib/utils/deep-equal.mjs +0 -18
- package/dist/src/lib/utils/remove-undefined.mjs +0 -18
- package/dist/src/lib/utils.mjs +0 -10
- package/next.config.ts +0 -23
- package/postcss.config.mjs +0 -7
- package/src/app/(dashboard)/collection/[name]/[...slug]/page.client.tsx +0 -26
- package/src/app/(dashboard)/collection/[name]/[...slug]/page.tsx +0 -18
- package/src/app/(dashboard)/collection/[name]/page.client.tsx +0 -82
- package/src/app/(dashboard)/collection/[name]/page.tsx +0 -11
- package/src/app/(dashboard)/layout.tsx +0 -34
- package/src/app/(dashboard)/page.tsx +0 -38
- package/src/app/api/ai/command/prompts.ts +0 -313
- package/src/app/api/ai/command/route.ts +0 -203
- package/src/app/api/ai/command/utils.ts +0 -242
- package/src/app/api/ai/copilot/route.ts +0 -33
- package/src/app/api/uploadthing/route.ts +0 -5
- package/src/app/codeblock/LICENSE +0 -21
- package/src/app/codeblock/styles.css +0 -289
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +0 -223
- package/src/app/layout.client.tsx +0 -15
- package/src/app/layout.tsx +0 -30
- package/src/components/app-sidebar.tsx +0 -162
- package/src/components/code-editor/mdx.lazy.tsx +0 -18
- package/src/components/code-editor/mdx.tsx +0 -48
- package/src/components/code-editor/yaml.lazy.tsx +0 -20
- package/src/components/code-editor/yaml.tsx +0 -71
- package/src/components/collection/actions.tsx +0 -41
- package/src/components/collection/client.tsx +0 -63
- package/src/components/collection/context.tsx +0 -24
- package/src/components/collection/document/actions.tsx +0 -83
- package/src/components/editor/editor-base-kit.tsx +0 -37
- package/src/components/editor/editor-kit.tsx +0 -87
- package/src/components/editor/md.tsx +0 -60
- package/src/components/editor/plugins/ai-kit.tsx +0 -102
- package/src/components/editor/plugins/align-base-kit.tsx +0 -16
- package/src/components/editor/plugins/align-kit.tsx +0 -18
- package/src/components/editor/plugins/autoformat-kit.tsx +0 -236
- package/src/components/editor/plugins/basic-blocks-base-kit.tsx +0 -34
- package/src/components/editor/plugins/basic-blocks-kit.tsx +0 -87
- package/src/components/editor/plugins/basic-marks-base-kit.tsx +0 -26
- package/src/components/editor/plugins/basic-marks-kit.tsx +0 -40
- package/src/components/editor/plugins/basic-nodes-kit.tsx +0 -6
- package/src/components/editor/plugins/block-menu-kit.tsx +0 -14
- package/src/components/editor/plugins/block-placeholder-kit.tsx +0 -17
- package/src/components/editor/plugins/block-selection-kit.tsx +0 -54
- package/src/components/editor/plugins/callout-base-kit.tsx +0 -5
- package/src/components/editor/plugins/callout-kit.tsx +0 -7
- package/src/components/editor/plugins/code-block-base-kit.tsx +0 -16
- package/src/components/editor/plugins/code-block-kit.tsx +0 -19
- package/src/components/editor/plugins/column-base-kit.tsx +0 -11
- package/src/components/editor/plugins/column-kit.tsx +0 -10
- package/src/components/editor/plugins/comment-base-kit.tsx +0 -5
- package/src/components/editor/plugins/comment-kit.tsx +0 -92
- package/src/components/editor/plugins/copilot-kit.tsx +0 -70
- package/src/components/editor/plugins/cursor-overlay-kit.tsx +0 -13
- package/src/components/editor/plugins/date-base-kit.tsx +0 -5
- package/src/components/editor/plugins/date-kit.tsx +0 -7
- package/src/components/editor/plugins/discussion-kit.tsx +0 -142
- package/src/components/editor/plugins/dnd-kit.tsx +0 -25
- package/src/components/editor/plugins/emoji-kit.tsx +0 -13
- package/src/components/editor/plugins/exit-break-kit.tsx +0 -12
- package/src/components/editor/plugins/fixed-toolbar-kit.tsx +0 -19
- package/src/components/editor/plugins/floating-toolbar-kit.tsx +0 -19
- package/src/components/editor/plugins/font-base-kit.tsx +0 -20
- package/src/components/editor/plugins/font-kit.tsx +0 -29
- package/src/components/editor/plugins/indent-base-kit.tsx +0 -13
- package/src/components/editor/plugins/indent-kit.tsx +0 -22
- package/src/components/editor/plugins/line-height-base-kit.tsx +0 -14
- package/src/components/editor/plugins/line-height-kit.tsx +0 -16
- package/src/components/editor/plugins/link-base-kit.tsx +0 -5
- package/src/components/editor/plugins/link-kit.tsx +0 -15
- package/src/components/editor/plugins/list-base-kit.tsx +0 -17
- package/src/components/editor/plugins/list-kit.tsx +0 -26
- package/src/components/editor/plugins/markdown-kit.tsx +0 -13
- package/src/components/editor/plugins/math-base-kit.tsx +0 -11
- package/src/components/editor/plugins/math-kit.tsx +0 -10
- package/src/components/editor/plugins/media-base-kit.tsx +0 -25
- package/src/components/editor/plugins/media-kit.tsx +0 -28
- package/src/components/editor/plugins/slash-kit.tsx +0 -18
- package/src/components/editor/plugins/suggestion-base-kit.tsx +0 -5
- package/src/components/editor/plugins/suggestion-kit.tsx +0 -83
- package/src/components/editor/plugins/table-base-kit.tsx +0 -20
- package/src/components/editor/plugins/table-kit.tsx +0 -22
- package/src/components/editor/settings-dialog.tsx +0 -418
- package/src/components/editor/transforms.ts +0 -193
- package/src/components/editor/types.ts +0 -149
- package/src/components/editor/ui/ai-chat-editor.tsx +0 -20
- package/src/components/editor/ui/ai-menu.tsx +0 -663
- package/src/components/editor/ui/ai-node.tsx +0 -40
- package/src/components/editor/ui/ai-toolbar-button.tsx +0 -23
- package/src/components/editor/ui/align-toolbar-button.tsx +0 -78
- package/src/components/editor/ui/block-context-menu.tsx +0 -154
- package/src/components/editor/ui/block-discussion.tsx +0 -318
- package/src/components/editor/ui/block-draggable.tsx +0 -464
- package/src/components/editor/ui/block-list-static.tsx +0 -75
- package/src/components/editor/ui/block-list.tsx +0 -72
- package/src/components/editor/ui/block-selection.tsx +0 -37
- package/src/components/editor/ui/block-suggestion.tsx +0 -438
- package/src/components/editor/ui/blockquote-node-static.tsx +0 -5
- package/src/components/editor/ui/blockquote-node.tsx +0 -7
- package/src/components/editor/ui/callout-node-static.tsx +0 -30
- package/src/components/editor/ui/callout-node.tsx +0 -64
- package/src/components/editor/ui/caption.tsx +0 -55
- package/src/components/editor/ui/code-block-node-static.tsx +0 -33
- package/src/components/editor/ui/code-block-node.tsx +0 -161
- package/src/components/editor/ui/code-node-static.tsx +0 -15
- package/src/components/editor/ui/code-node.tsx +0 -17
- package/src/components/editor/ui/column-node-static.tsx +0 -27
- package/src/components/editor/ui/column-node.tsx +0 -285
- package/src/components/editor/ui/comment-node-static.tsx +0 -12
- package/src/components/editor/ui/comment-node.tsx +0 -43
- package/src/components/editor/ui/comment-toolbar-button.tsx +0 -24
- package/src/components/editor/ui/comment.tsx +0 -577
- package/src/components/editor/ui/cursor-overlay.tsx +0 -66
- package/src/components/editor/ui/date-node-static.tsx +0 -45
- package/src/components/editor/ui/date-node.tsx +0 -86
- package/src/components/editor/ui/editor-static.tsx +0 -47
- package/src/components/editor/ui/editor.tsx +0 -120
- package/src/components/editor/ui/emoji-node.tsx +0 -65
- package/src/components/editor/ui/emoji-toolbar-button.tsx +0 -582
- package/src/components/editor/ui/equation-node-static.tsx +0 -94
- package/src/components/editor/ui/equation-node.tsx +0 -218
- package/src/components/editor/ui/equation-toolbar-button.tsx +0 -24
- package/src/components/editor/ui/fixed-toolbar-buttons.tsx +0 -135
- package/src/components/editor/ui/fixed-toolbar.tsx +0 -17
- package/src/components/editor/ui/floating-toolbar-buttons.tsx +0 -72
- package/src/components/editor/ui/floating-toolbar.tsx +0 -76
- package/src/components/editor/ui/font-color-toolbar-button.tsx +0 -804
- package/src/components/editor/ui/font-size-toolbar-button.tsx +0 -102
- package/src/components/editor/ui/ghost-text.tsx +0 -27
- package/src/components/editor/ui/heading-node-static.tsx +0 -54
- package/src/components/editor/ui/heading-node.tsx +0 -54
- package/src/components/editor/ui/highlight-node-static.tsx +0 -11
- package/src/components/editor/ui/highlight-node.tsx +0 -13
- package/src/components/editor/ui/history-toolbar-button.tsx +0 -41
- package/src/components/editor/ui/hr-node-static.tsx +0 -16
- package/src/components/editor/ui/hr-node.tsx +0 -28
- package/src/components/editor/ui/indent-toolbar-button.tsx +0 -27
- package/src/components/editor/ui/inline-combobox.tsx +0 -251
- package/src/components/editor/ui/insert-toolbar-button.tsx +0 -242
- package/src/components/editor/ui/kbd-node-static.tsx +0 -15
- package/src/components/editor/ui/kbd-node.tsx +0 -17
- package/src/components/editor/ui/line-height-toolbar-button.tsx +0 -66
- package/src/components/editor/ui/link-node-static.tsx +0 -21
- package/src/components/editor/ui/link-node.tsx +0 -37
- package/src/components/editor/ui/link-toolbar-button.tsx +0 -18
- package/src/components/editor/ui/link-toolbar.tsx +0 -196
- package/src/components/editor/ui/list-toolbar-button.tsx +0 -195
- package/src/components/editor/ui/mark-toolbar-button.tsx +0 -20
- package/src/components/editor/ui/media-image-node-static.tsx +0 -33
- package/src/components/editor/ui/media-image-node.tsx +0 -75
- package/src/components/editor/ui/media-placeholder-node.tsx +0 -235
- package/src/components/editor/ui/media-preview-dialog.tsx +0 -145
- package/src/components/editor/ui/media-toolbar-button.tsx +0 -202
- package/src/components/editor/ui/media-toolbar.tsx +0 -100
- package/src/components/editor/ui/media-upload-toast.tsx +0 -59
- package/src/components/editor/ui/media-video-node-static.tsx +0 -23
- package/src/components/editor/ui/mode-toolbar-button.tsx +0 -121
- package/src/components/editor/ui/paragraph-node-static.tsx +0 -13
- package/src/components/editor/ui/paragraph-node.tsx +0 -15
- package/src/components/editor/ui/resize-handle.tsx +0 -79
- package/src/components/editor/ui/slash-node.tsx +0 -274
- package/src/components/editor/ui/suggestion-node-static.tsx +0 -30
- package/src/components/editor/ui/suggestion-node.tsx +0 -157
- package/src/components/editor/ui/suggestion-toolbar-button.tsx +0 -25
- package/src/components/editor/ui/table-icons.tsx +0 -685
- package/src/components/editor/ui/table-node-static.tsx +0 -86
- package/src/components/editor/ui/table-node.tsx +0 -569
- package/src/components/editor/ui/table-toolbar-button.tsx +0 -260
- package/src/components/editor/ui/turn-into-toolbar-button.tsx +0 -176
- package/src/components/editor/use-chat.ts +0 -120
- package/src/components/icons/logo.tsx +0 -37
- package/src/components/json-schema-editor/client.tsx +0 -55
- package/src/components/json-schema-editor/components/inputs.tsx +0 -612
- package/src/components/json-schema-editor/get-default-values.ts +0 -29
- package/src/components/json-schema-editor/schema.tsx +0 -206
- package/src/components/json-schema-editor/utils/merge-schema.ts +0 -167
- package/src/components/json-schema-editor/utils/schema-to-string.ts +0 -87
- package/src/components/nav-user.tsx +0 -102
- package/src/components/site-header.tsx +0 -13
- package/src/components/ui/alert-dialog.tsx +0 -182
- package/src/components/ui/avatar.tsx +0 -96
- package/src/components/ui/button.tsx +0 -65
- package/src/components/ui/calendar.tsx +0 -186
- package/src/components/ui/checkbox.tsx +0 -29
- package/src/components/ui/combobox.tsx +0 -267
- package/src/components/ui/command.tsx +0 -180
- package/src/components/ui/context-menu.tsx +0 -161
- package/src/components/ui/dialog.tsx +0 -142
- package/src/components/ui/drawer.tsx +0 -120
- package/src/components/ui/dropdown-menu.tsx +0 -239
- package/src/components/ui/field.tsx +0 -224
- package/src/components/ui/input-group.tsx +0 -144
- package/src/components/ui/input.tsx +0 -19
- package/src/components/ui/label.tsx +0 -18
- package/src/components/ui/popover.tsx +0 -76
- package/src/components/ui/select.tsx +0 -182
- package/src/components/ui/separator.tsx +0 -28
- package/src/components/ui/sheet.tsx +0 -130
- package/src/components/ui/sidebar.tsx +0 -608
- package/src/components/ui/sonner.tsx +0 -45
- package/src/components/ui/spinner.tsx +0 -15
- package/src/components/ui/table.tsx +0 -89
- package/src/components/ui/tabs.tsx +0 -60
- package/src/components/ui/textarea.tsx +0 -18
- package/src/components/ui/toggle-group.tsx +0 -86
- package/src/components/ui/toggle.tsx +0 -45
- package/src/components/ui/toolbar.tsx +0 -365
- package/src/components/ui/tooltip.tsx +0 -57
- package/src/hooks/editor/use-is-creator.ts +0 -21
- package/src/hooks/use-mobile.ts +0 -19
- package/src/hooks/use-mounted.ts +0 -11
- package/src/hooks/use-upload-file.ts +0 -121
- package/src/lib/ai/markdown-joiner-transform.ts +0 -235
- package/src/lib/config.ts +0 -42
- package/src/lib/data/actions.ts +0 -46
- package/src/lib/data/boundary.client.tsx +0 -22
- package/src/lib/data/boundary.tsx +0 -22
- package/src/lib/data/query.ts +0 -9
- package/src/lib/data/store.ts +0 -52
- package/src/lib/lowlight.ts +0 -3
- package/src/lib/uploadthing.ts +0 -19
- package/src/lib/utils/deep-equal.ts +0 -37
- package/src/lib/utils/remove-undefined.ts +0 -21
- package/src/lib/utils/urls.ts +0 -6
- package/src/lib/utils.ts +0 -6
- package/tsconfig.build.json +0 -24
- package/tsconfig.json +0 -37
|
@@ -0,0 +1,1092 @@
|
|
|
1
|
+
import { c as createLucideIcon } from "./button-C_-b_vqm.js";
|
|
2
|
+
import { d as We, R as ReactDOM } from "../index.js";
|
|
3
|
+
const __iconNode = [
|
|
4
|
+
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
5
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
6
|
+
];
|
|
7
|
+
const Search = createLucideIcon("search", __iconNode);
|
|
8
|
+
function __insertCSS(code) {
|
|
9
|
+
if (typeof document == "undefined") return;
|
|
10
|
+
let head = document.head || document.getElementsByTagName("head")[0];
|
|
11
|
+
let style = document.createElement("style");
|
|
12
|
+
style.type = "text/css";
|
|
13
|
+
head.appendChild(style);
|
|
14
|
+
style.styleSheet ? style.styleSheet.cssText = code : style.appendChild(document.createTextNode(code));
|
|
15
|
+
}
|
|
16
|
+
const getAsset = (type) => {
|
|
17
|
+
switch (type) {
|
|
18
|
+
case "success":
|
|
19
|
+
return SuccessIcon;
|
|
20
|
+
case "info":
|
|
21
|
+
return InfoIcon;
|
|
22
|
+
case "warning":
|
|
23
|
+
return WarningIcon;
|
|
24
|
+
case "error":
|
|
25
|
+
return ErrorIcon;
|
|
26
|
+
default:
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const bars = Array(12).fill(0);
|
|
31
|
+
const Loader = ({ visible, className }) => {
|
|
32
|
+
return /* @__PURE__ */ We.createElement("div", {
|
|
33
|
+
className: [
|
|
34
|
+
"sonner-loading-wrapper",
|
|
35
|
+
className
|
|
36
|
+
].filter(Boolean).join(" "),
|
|
37
|
+
"data-visible": visible
|
|
38
|
+
}, /* @__PURE__ */ We.createElement("div", {
|
|
39
|
+
className: "sonner-spinner"
|
|
40
|
+
}, bars.map((_, i) => /* @__PURE__ */ We.createElement("div", {
|
|
41
|
+
className: "sonner-loading-bar",
|
|
42
|
+
key: `spinner-bar-${i}`
|
|
43
|
+
}))));
|
|
44
|
+
};
|
|
45
|
+
const SuccessIcon = /* @__PURE__ */ We.createElement("svg", {
|
|
46
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
47
|
+
viewBox: "0 0 20 20",
|
|
48
|
+
fill: "currentColor",
|
|
49
|
+
height: "20",
|
|
50
|
+
width: "20"
|
|
51
|
+
}, /* @__PURE__ */ We.createElement("path", {
|
|
52
|
+
fillRule: "evenodd",
|
|
53
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
|
|
54
|
+
clipRule: "evenodd"
|
|
55
|
+
}));
|
|
56
|
+
const WarningIcon = /* @__PURE__ */ We.createElement("svg", {
|
|
57
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
58
|
+
viewBox: "0 0 24 24",
|
|
59
|
+
fill: "currentColor",
|
|
60
|
+
height: "20",
|
|
61
|
+
width: "20"
|
|
62
|
+
}, /* @__PURE__ */ We.createElement("path", {
|
|
63
|
+
fillRule: "evenodd",
|
|
64
|
+
d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
|
|
65
|
+
clipRule: "evenodd"
|
|
66
|
+
}));
|
|
67
|
+
const InfoIcon = /* @__PURE__ */ We.createElement("svg", {
|
|
68
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
69
|
+
viewBox: "0 0 20 20",
|
|
70
|
+
fill: "currentColor",
|
|
71
|
+
height: "20",
|
|
72
|
+
width: "20"
|
|
73
|
+
}, /* @__PURE__ */ We.createElement("path", {
|
|
74
|
+
fillRule: "evenodd",
|
|
75
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
|
|
76
|
+
clipRule: "evenodd"
|
|
77
|
+
}));
|
|
78
|
+
const ErrorIcon = /* @__PURE__ */ We.createElement("svg", {
|
|
79
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
80
|
+
viewBox: "0 0 20 20",
|
|
81
|
+
fill: "currentColor",
|
|
82
|
+
height: "20",
|
|
83
|
+
width: "20"
|
|
84
|
+
}, /* @__PURE__ */ We.createElement("path", {
|
|
85
|
+
fillRule: "evenodd",
|
|
86
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
|
|
87
|
+
clipRule: "evenodd"
|
|
88
|
+
}));
|
|
89
|
+
const CloseIcon = /* @__PURE__ */ We.createElement("svg", {
|
|
90
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
91
|
+
width: "12",
|
|
92
|
+
height: "12",
|
|
93
|
+
viewBox: "0 0 24 24",
|
|
94
|
+
fill: "none",
|
|
95
|
+
stroke: "currentColor",
|
|
96
|
+
strokeWidth: "1.5",
|
|
97
|
+
strokeLinecap: "round",
|
|
98
|
+
strokeLinejoin: "round"
|
|
99
|
+
}, /* @__PURE__ */ We.createElement("line", {
|
|
100
|
+
x1: "18",
|
|
101
|
+
y1: "6",
|
|
102
|
+
x2: "6",
|
|
103
|
+
y2: "18"
|
|
104
|
+
}), /* @__PURE__ */ We.createElement("line", {
|
|
105
|
+
x1: "6",
|
|
106
|
+
y1: "6",
|
|
107
|
+
x2: "18",
|
|
108
|
+
y2: "18"
|
|
109
|
+
}));
|
|
110
|
+
const useIsDocumentHidden = () => {
|
|
111
|
+
const [isDocumentHidden, setIsDocumentHidden] = We.useState(document.hidden);
|
|
112
|
+
We.useEffect(() => {
|
|
113
|
+
const callback = () => {
|
|
114
|
+
setIsDocumentHidden(document.hidden);
|
|
115
|
+
};
|
|
116
|
+
document.addEventListener("visibilitychange", callback);
|
|
117
|
+
return () => window.removeEventListener("visibilitychange", callback);
|
|
118
|
+
}, []);
|
|
119
|
+
return isDocumentHidden;
|
|
120
|
+
};
|
|
121
|
+
let toastsCounter = 1;
|
|
122
|
+
class Observer {
|
|
123
|
+
constructor() {
|
|
124
|
+
this.subscribe = (subscriber) => {
|
|
125
|
+
this.subscribers.push(subscriber);
|
|
126
|
+
return () => {
|
|
127
|
+
const index = this.subscribers.indexOf(subscriber);
|
|
128
|
+
this.subscribers.splice(index, 1);
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
this.publish = (data) => {
|
|
132
|
+
this.subscribers.forEach((subscriber) => subscriber(data));
|
|
133
|
+
};
|
|
134
|
+
this.addToast = (data) => {
|
|
135
|
+
this.publish(data);
|
|
136
|
+
this.toasts = [
|
|
137
|
+
...this.toasts,
|
|
138
|
+
data
|
|
139
|
+
];
|
|
140
|
+
};
|
|
141
|
+
this.create = (data) => {
|
|
142
|
+
var _data_id;
|
|
143
|
+
const { message, ...rest } = data;
|
|
144
|
+
const id = typeof (data == null ? void 0 : data.id) === "number" || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
|
|
145
|
+
const alreadyExists = this.toasts.find((toast2) => {
|
|
146
|
+
return toast2.id === id;
|
|
147
|
+
});
|
|
148
|
+
const dismissible = data.dismissible === void 0 ? true : data.dismissible;
|
|
149
|
+
if (this.dismissedToasts.has(id)) {
|
|
150
|
+
this.dismissedToasts.delete(id);
|
|
151
|
+
}
|
|
152
|
+
if (alreadyExists) {
|
|
153
|
+
this.toasts = this.toasts.map((toast2) => {
|
|
154
|
+
if (toast2.id === id) {
|
|
155
|
+
this.publish({
|
|
156
|
+
...toast2,
|
|
157
|
+
...data,
|
|
158
|
+
id,
|
|
159
|
+
title: message
|
|
160
|
+
});
|
|
161
|
+
return {
|
|
162
|
+
...toast2,
|
|
163
|
+
...data,
|
|
164
|
+
id,
|
|
165
|
+
dismissible,
|
|
166
|
+
title: message
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
return toast2;
|
|
170
|
+
});
|
|
171
|
+
} else {
|
|
172
|
+
this.addToast({
|
|
173
|
+
title: message,
|
|
174
|
+
...rest,
|
|
175
|
+
dismissible,
|
|
176
|
+
id
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return id;
|
|
180
|
+
};
|
|
181
|
+
this.dismiss = (id) => {
|
|
182
|
+
if (id) {
|
|
183
|
+
this.dismissedToasts.add(id);
|
|
184
|
+
requestAnimationFrame(() => this.subscribers.forEach((subscriber) => subscriber({
|
|
185
|
+
id,
|
|
186
|
+
dismiss: true
|
|
187
|
+
})));
|
|
188
|
+
} else {
|
|
189
|
+
this.toasts.forEach((toast2) => {
|
|
190
|
+
this.subscribers.forEach((subscriber) => subscriber({
|
|
191
|
+
id: toast2.id,
|
|
192
|
+
dismiss: true
|
|
193
|
+
}));
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
return id;
|
|
197
|
+
};
|
|
198
|
+
this.message = (message, data) => {
|
|
199
|
+
return this.create({
|
|
200
|
+
...data,
|
|
201
|
+
message
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
this.error = (message, data) => {
|
|
205
|
+
return this.create({
|
|
206
|
+
...data,
|
|
207
|
+
message,
|
|
208
|
+
type: "error"
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
this.success = (message, data) => {
|
|
212
|
+
return this.create({
|
|
213
|
+
...data,
|
|
214
|
+
type: "success",
|
|
215
|
+
message
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
this.info = (message, data) => {
|
|
219
|
+
return this.create({
|
|
220
|
+
...data,
|
|
221
|
+
type: "info",
|
|
222
|
+
message
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
this.warning = (message, data) => {
|
|
226
|
+
return this.create({
|
|
227
|
+
...data,
|
|
228
|
+
type: "warning",
|
|
229
|
+
message
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
this.loading = (message, data) => {
|
|
233
|
+
return this.create({
|
|
234
|
+
...data,
|
|
235
|
+
type: "loading",
|
|
236
|
+
message
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
this.promise = (promise, data) => {
|
|
240
|
+
if (!data) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
let id = void 0;
|
|
244
|
+
if (data.loading !== void 0) {
|
|
245
|
+
id = this.create({
|
|
246
|
+
...data,
|
|
247
|
+
promise,
|
|
248
|
+
type: "loading",
|
|
249
|
+
message: data.loading,
|
|
250
|
+
description: typeof data.description !== "function" ? data.description : void 0
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
const p = Promise.resolve(promise instanceof Function ? promise() : promise);
|
|
254
|
+
let shouldDismiss = id !== void 0;
|
|
255
|
+
let result;
|
|
256
|
+
const originalPromise = p.then(async (response) => {
|
|
257
|
+
result = [
|
|
258
|
+
"resolve",
|
|
259
|
+
response
|
|
260
|
+
];
|
|
261
|
+
const isReactElementResponse = We.isValidElement(response);
|
|
262
|
+
if (isReactElementResponse) {
|
|
263
|
+
shouldDismiss = false;
|
|
264
|
+
this.create({
|
|
265
|
+
id,
|
|
266
|
+
type: "default",
|
|
267
|
+
message: response
|
|
268
|
+
});
|
|
269
|
+
} else if (isHttpResponse(response) && !response.ok) {
|
|
270
|
+
shouldDismiss = false;
|
|
271
|
+
const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
|
|
272
|
+
const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
|
|
273
|
+
const isExtendedResult = typeof promiseData === "object" && !We.isValidElement(promiseData);
|
|
274
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
275
|
+
message: promiseData
|
|
276
|
+
};
|
|
277
|
+
this.create({
|
|
278
|
+
id,
|
|
279
|
+
type: "error",
|
|
280
|
+
description,
|
|
281
|
+
...toastSettings
|
|
282
|
+
});
|
|
283
|
+
} else if (response instanceof Error) {
|
|
284
|
+
shouldDismiss = false;
|
|
285
|
+
const promiseData = typeof data.error === "function" ? await data.error(response) : data.error;
|
|
286
|
+
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
287
|
+
const isExtendedResult = typeof promiseData === "object" && !We.isValidElement(promiseData);
|
|
288
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
289
|
+
message: promiseData
|
|
290
|
+
};
|
|
291
|
+
this.create({
|
|
292
|
+
id,
|
|
293
|
+
type: "error",
|
|
294
|
+
description,
|
|
295
|
+
...toastSettings
|
|
296
|
+
});
|
|
297
|
+
} else if (data.success !== void 0) {
|
|
298
|
+
shouldDismiss = false;
|
|
299
|
+
const promiseData = typeof data.success === "function" ? await data.success(response) : data.success;
|
|
300
|
+
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
301
|
+
const isExtendedResult = typeof promiseData === "object" && !We.isValidElement(promiseData);
|
|
302
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
303
|
+
message: promiseData
|
|
304
|
+
};
|
|
305
|
+
this.create({
|
|
306
|
+
id,
|
|
307
|
+
type: "success",
|
|
308
|
+
description,
|
|
309
|
+
...toastSettings
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}).catch(async (error) => {
|
|
313
|
+
result = [
|
|
314
|
+
"reject",
|
|
315
|
+
error
|
|
316
|
+
];
|
|
317
|
+
if (data.error !== void 0) {
|
|
318
|
+
shouldDismiss = false;
|
|
319
|
+
const promiseData = typeof data.error === "function" ? await data.error(error) : data.error;
|
|
320
|
+
const description = typeof data.description === "function" ? await data.description(error) : data.description;
|
|
321
|
+
const isExtendedResult = typeof promiseData === "object" && !We.isValidElement(promiseData);
|
|
322
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
323
|
+
message: promiseData
|
|
324
|
+
};
|
|
325
|
+
this.create({
|
|
326
|
+
id,
|
|
327
|
+
type: "error",
|
|
328
|
+
description,
|
|
329
|
+
...toastSettings
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}).finally(() => {
|
|
333
|
+
if (shouldDismiss) {
|
|
334
|
+
this.dismiss(id);
|
|
335
|
+
id = void 0;
|
|
336
|
+
}
|
|
337
|
+
data.finally == null ? void 0 : data.finally.call(data);
|
|
338
|
+
});
|
|
339
|
+
const unwrap = () => new Promise((resolve, reject) => originalPromise.then(() => result[0] === "reject" ? reject(result[1]) : resolve(result[1])).catch(reject));
|
|
340
|
+
if (typeof id !== "string" && typeof id !== "number") {
|
|
341
|
+
return {
|
|
342
|
+
unwrap
|
|
343
|
+
};
|
|
344
|
+
} else {
|
|
345
|
+
return Object.assign(id, {
|
|
346
|
+
unwrap
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
this.custom = (jsx, data) => {
|
|
351
|
+
const id = (data == null ? void 0 : data.id) || toastsCounter++;
|
|
352
|
+
this.create({
|
|
353
|
+
jsx: jsx(id),
|
|
354
|
+
id,
|
|
355
|
+
...data
|
|
356
|
+
});
|
|
357
|
+
return id;
|
|
358
|
+
};
|
|
359
|
+
this.getActiveToasts = () => {
|
|
360
|
+
return this.toasts.filter((toast2) => !this.dismissedToasts.has(toast2.id));
|
|
361
|
+
};
|
|
362
|
+
this.subscribers = [];
|
|
363
|
+
this.toasts = [];
|
|
364
|
+
this.dismissedToasts = /* @__PURE__ */ new Set();
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
const ToastState = new Observer();
|
|
368
|
+
const toastFunction = (message, data) => {
|
|
369
|
+
const id = (data == null ? void 0 : data.id) || toastsCounter++;
|
|
370
|
+
ToastState.addToast({
|
|
371
|
+
title: message,
|
|
372
|
+
...data,
|
|
373
|
+
id
|
|
374
|
+
});
|
|
375
|
+
return id;
|
|
376
|
+
};
|
|
377
|
+
const isHttpResponse = (data) => {
|
|
378
|
+
return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
|
|
379
|
+
};
|
|
380
|
+
const basicToast = toastFunction;
|
|
381
|
+
const getHistory = () => ToastState.toasts;
|
|
382
|
+
const getToasts = () => ToastState.getActiveToasts();
|
|
383
|
+
const toast = Object.assign(basicToast, {
|
|
384
|
+
success: ToastState.success,
|
|
385
|
+
info: ToastState.info,
|
|
386
|
+
warning: ToastState.warning,
|
|
387
|
+
error: ToastState.error,
|
|
388
|
+
custom: ToastState.custom,
|
|
389
|
+
message: ToastState.message,
|
|
390
|
+
promise: ToastState.promise,
|
|
391
|
+
dismiss: ToastState.dismiss,
|
|
392
|
+
loading: ToastState.loading
|
|
393
|
+
}, {
|
|
394
|
+
getHistory,
|
|
395
|
+
getToasts
|
|
396
|
+
});
|
|
397
|
+
__insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
|
|
398
|
+
function isAction(action) {
|
|
399
|
+
return action.label !== void 0;
|
|
400
|
+
}
|
|
401
|
+
const VISIBLE_TOASTS_AMOUNT = 3;
|
|
402
|
+
const VIEWPORT_OFFSET = "24px";
|
|
403
|
+
const MOBILE_VIEWPORT_OFFSET = "16px";
|
|
404
|
+
const TOAST_LIFETIME = 4e3;
|
|
405
|
+
const TOAST_WIDTH = 356;
|
|
406
|
+
const GAP = 14;
|
|
407
|
+
const SWIPE_THRESHOLD = 45;
|
|
408
|
+
const TIME_BEFORE_UNMOUNT = 200;
|
|
409
|
+
function cn(...classes) {
|
|
410
|
+
return classes.filter(Boolean).join(" ");
|
|
411
|
+
}
|
|
412
|
+
function getDefaultSwipeDirections(position) {
|
|
413
|
+
const [y, x] = position.split("-");
|
|
414
|
+
const directions = [];
|
|
415
|
+
if (y) {
|
|
416
|
+
directions.push(y);
|
|
417
|
+
}
|
|
418
|
+
if (x) {
|
|
419
|
+
directions.push(x);
|
|
420
|
+
}
|
|
421
|
+
return directions;
|
|
422
|
+
}
|
|
423
|
+
const Toast = (props) => {
|
|
424
|
+
var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
|
|
425
|
+
const { invert: ToasterInvert, toast: toast2, unstyled, interacting, setHeights, visibleToasts, heights, index, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = "", descriptionClassName = "", duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = "Close toast" } = props;
|
|
426
|
+
const [swipeDirection, setSwipeDirection] = We.useState(null);
|
|
427
|
+
const [swipeOutDirection, setSwipeOutDirection] = We.useState(null);
|
|
428
|
+
const [mounted, setMounted] = We.useState(false);
|
|
429
|
+
const [removed, setRemoved] = We.useState(false);
|
|
430
|
+
const [swiping, setSwiping] = We.useState(false);
|
|
431
|
+
const [swipeOut, setSwipeOut] = We.useState(false);
|
|
432
|
+
const [isSwiped, setIsSwiped] = We.useState(false);
|
|
433
|
+
const [offsetBeforeRemove, setOffsetBeforeRemove] = We.useState(0);
|
|
434
|
+
const [initialHeight, setInitialHeight] = We.useState(0);
|
|
435
|
+
const remainingTime = We.useRef(toast2.duration || durationFromToaster || TOAST_LIFETIME);
|
|
436
|
+
const dragStartTime = We.useRef(null);
|
|
437
|
+
const toastRef = We.useRef(null);
|
|
438
|
+
const isFront = index === 0;
|
|
439
|
+
const isVisible = index + 1 <= visibleToasts;
|
|
440
|
+
const toastType = toast2.type;
|
|
441
|
+
const dismissible = toast2.dismissible !== false;
|
|
442
|
+
const toastClassname = toast2.className || "";
|
|
443
|
+
const toastDescriptionClassname = toast2.descriptionClassName || "";
|
|
444
|
+
const heightIndex = We.useMemo(() => heights.findIndex((height) => height.toastId === toast2.id) || 0, [
|
|
445
|
+
heights,
|
|
446
|
+
toast2.id
|
|
447
|
+
]);
|
|
448
|
+
const closeButton = We.useMemo(() => {
|
|
449
|
+
var _toast_closeButton;
|
|
450
|
+
return (_toast_closeButton = toast2.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
|
|
451
|
+
}, [
|
|
452
|
+
toast2.closeButton,
|
|
453
|
+
closeButtonFromToaster
|
|
454
|
+
]);
|
|
455
|
+
const duration = We.useMemo(() => toast2.duration || durationFromToaster || TOAST_LIFETIME, [
|
|
456
|
+
toast2.duration,
|
|
457
|
+
durationFromToaster
|
|
458
|
+
]);
|
|
459
|
+
const closeTimerStartTimeRef = We.useRef(0);
|
|
460
|
+
const offset = We.useRef(0);
|
|
461
|
+
const lastCloseTimerStartTimeRef = We.useRef(0);
|
|
462
|
+
const pointerStartRef = We.useRef(null);
|
|
463
|
+
const [y, x] = position.split("-");
|
|
464
|
+
const toastsHeightBefore = We.useMemo(() => {
|
|
465
|
+
return heights.reduce((prev, curr, reducerIndex) => {
|
|
466
|
+
if (reducerIndex >= heightIndex) {
|
|
467
|
+
return prev;
|
|
468
|
+
}
|
|
469
|
+
return prev + curr.height;
|
|
470
|
+
}, 0);
|
|
471
|
+
}, [
|
|
472
|
+
heights,
|
|
473
|
+
heightIndex
|
|
474
|
+
]);
|
|
475
|
+
const isDocumentHidden = useIsDocumentHidden();
|
|
476
|
+
const invert = toast2.invert || ToasterInvert;
|
|
477
|
+
const disabled = toastType === "loading";
|
|
478
|
+
offset.current = We.useMemo(() => heightIndex * gap + toastsHeightBefore, [
|
|
479
|
+
heightIndex,
|
|
480
|
+
toastsHeightBefore
|
|
481
|
+
]);
|
|
482
|
+
We.useEffect(() => {
|
|
483
|
+
remainingTime.current = duration;
|
|
484
|
+
}, [
|
|
485
|
+
duration
|
|
486
|
+
]);
|
|
487
|
+
We.useEffect(() => {
|
|
488
|
+
setMounted(true);
|
|
489
|
+
}, []);
|
|
490
|
+
We.useEffect(() => {
|
|
491
|
+
const toastNode = toastRef.current;
|
|
492
|
+
if (toastNode) {
|
|
493
|
+
const height = toastNode.getBoundingClientRect().height;
|
|
494
|
+
setInitialHeight(height);
|
|
495
|
+
setHeights((h) => [
|
|
496
|
+
{
|
|
497
|
+
toastId: toast2.id,
|
|
498
|
+
height,
|
|
499
|
+
position: toast2.position
|
|
500
|
+
},
|
|
501
|
+
...h
|
|
502
|
+
]);
|
|
503
|
+
return () => setHeights((h) => h.filter((height2) => height2.toastId !== toast2.id));
|
|
504
|
+
}
|
|
505
|
+
}, [
|
|
506
|
+
setHeights,
|
|
507
|
+
toast2.id
|
|
508
|
+
]);
|
|
509
|
+
We.useLayoutEffect(() => {
|
|
510
|
+
if (!mounted) return;
|
|
511
|
+
const toastNode = toastRef.current;
|
|
512
|
+
const originalHeight = toastNode.style.height;
|
|
513
|
+
toastNode.style.height = "auto";
|
|
514
|
+
const newHeight = toastNode.getBoundingClientRect().height;
|
|
515
|
+
toastNode.style.height = originalHeight;
|
|
516
|
+
setInitialHeight(newHeight);
|
|
517
|
+
setHeights((heights2) => {
|
|
518
|
+
const alreadyExists = heights2.find((height) => height.toastId === toast2.id);
|
|
519
|
+
if (!alreadyExists) {
|
|
520
|
+
return [
|
|
521
|
+
{
|
|
522
|
+
toastId: toast2.id,
|
|
523
|
+
height: newHeight,
|
|
524
|
+
position: toast2.position
|
|
525
|
+
},
|
|
526
|
+
...heights2
|
|
527
|
+
];
|
|
528
|
+
} else {
|
|
529
|
+
return heights2.map((height) => height.toastId === toast2.id ? {
|
|
530
|
+
...height,
|
|
531
|
+
height: newHeight
|
|
532
|
+
} : height);
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
}, [
|
|
536
|
+
mounted,
|
|
537
|
+
toast2.title,
|
|
538
|
+
toast2.description,
|
|
539
|
+
setHeights,
|
|
540
|
+
toast2.id,
|
|
541
|
+
toast2.jsx,
|
|
542
|
+
toast2.action,
|
|
543
|
+
toast2.cancel
|
|
544
|
+
]);
|
|
545
|
+
const deleteToast = We.useCallback(() => {
|
|
546
|
+
setRemoved(true);
|
|
547
|
+
setOffsetBeforeRemove(offset.current);
|
|
548
|
+
setHeights((h) => h.filter((height) => height.toastId !== toast2.id));
|
|
549
|
+
setTimeout(() => {
|
|
550
|
+
removeToast(toast2);
|
|
551
|
+
}, TIME_BEFORE_UNMOUNT);
|
|
552
|
+
}, [
|
|
553
|
+
toast2,
|
|
554
|
+
removeToast,
|
|
555
|
+
setHeights,
|
|
556
|
+
offset
|
|
557
|
+
]);
|
|
558
|
+
We.useEffect(() => {
|
|
559
|
+
if (toast2.promise && toastType === "loading" || toast2.duration === Infinity || toast2.type === "loading") return;
|
|
560
|
+
let timeoutId;
|
|
561
|
+
const pauseTimer = () => {
|
|
562
|
+
if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
|
|
563
|
+
const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - closeTimerStartTimeRef.current;
|
|
564
|
+
remainingTime.current = remainingTime.current - elapsedTime;
|
|
565
|
+
}
|
|
566
|
+
lastCloseTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
|
|
567
|
+
};
|
|
568
|
+
const startTimer = () => {
|
|
569
|
+
if (remainingTime.current === Infinity) return;
|
|
570
|
+
closeTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
|
|
571
|
+
timeoutId = setTimeout(() => {
|
|
572
|
+
toast2.onAutoClose == null ? void 0 : toast2.onAutoClose.call(toast2, toast2);
|
|
573
|
+
deleteToast();
|
|
574
|
+
}, remainingTime.current);
|
|
575
|
+
};
|
|
576
|
+
if (expanded || interacting || isDocumentHidden) {
|
|
577
|
+
pauseTimer();
|
|
578
|
+
} else {
|
|
579
|
+
startTimer();
|
|
580
|
+
}
|
|
581
|
+
return () => clearTimeout(timeoutId);
|
|
582
|
+
}, [
|
|
583
|
+
expanded,
|
|
584
|
+
interacting,
|
|
585
|
+
toast2,
|
|
586
|
+
toastType,
|
|
587
|
+
isDocumentHidden,
|
|
588
|
+
deleteToast
|
|
589
|
+
]);
|
|
590
|
+
We.useEffect(() => {
|
|
591
|
+
if (toast2.delete) {
|
|
592
|
+
deleteToast();
|
|
593
|
+
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
594
|
+
}
|
|
595
|
+
}, [
|
|
596
|
+
deleteToast,
|
|
597
|
+
toast2.delete
|
|
598
|
+
]);
|
|
599
|
+
function getLoadingIcon() {
|
|
600
|
+
var _toast_classNames9;
|
|
601
|
+
if (icons == null ? void 0 : icons.loading) {
|
|
602
|
+
var _toast_classNames12;
|
|
603
|
+
return /* @__PURE__ */ We.createElement("div", {
|
|
604
|
+
className: cn(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames12 = toast2.classNames) == null ? void 0 : _toast_classNames12.loader, "sonner-loader"),
|
|
605
|
+
"data-visible": toastType === "loading"
|
|
606
|
+
}, icons.loading);
|
|
607
|
+
}
|
|
608
|
+
return /* @__PURE__ */ We.createElement(Loader, {
|
|
609
|
+
className: cn(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames9 = toast2.classNames) == null ? void 0 : _toast_classNames9.loader),
|
|
610
|
+
visible: toastType === "loading"
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
const icon = toast2.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
|
|
614
|
+
var _toast_richColors, _icons_close;
|
|
615
|
+
return /* @__PURE__ */ We.createElement("li", {
|
|
616
|
+
tabIndex: 0,
|
|
617
|
+
ref: toastRef,
|
|
618
|
+
className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast2 == null ? void 0 : (_toast_classNames = toast2.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast2 == null ? void 0 : (_toast_classNames1 = toast2.classNames) == null ? void 0 : _toast_classNames1[toastType]),
|
|
619
|
+
"data-sonner-toast": "",
|
|
620
|
+
"data-rich-colors": (_toast_richColors = toast2.richColors) != null ? _toast_richColors : defaultRichColors,
|
|
621
|
+
"data-styled": !Boolean(toast2.jsx || toast2.unstyled || unstyled),
|
|
622
|
+
"data-mounted": mounted,
|
|
623
|
+
"data-promise": Boolean(toast2.promise),
|
|
624
|
+
"data-swiped": isSwiped,
|
|
625
|
+
"data-removed": removed,
|
|
626
|
+
"data-visible": isVisible,
|
|
627
|
+
"data-y-position": y,
|
|
628
|
+
"data-x-position": x,
|
|
629
|
+
"data-index": index,
|
|
630
|
+
"data-front": isFront,
|
|
631
|
+
"data-swiping": swiping,
|
|
632
|
+
"data-dismissible": dismissible,
|
|
633
|
+
"data-type": toastType,
|
|
634
|
+
"data-invert": invert,
|
|
635
|
+
"data-swipe-out": swipeOut,
|
|
636
|
+
"data-swipe-direction": swipeOutDirection,
|
|
637
|
+
"data-expanded": Boolean(expanded || expandByDefault && mounted),
|
|
638
|
+
"data-testid": toast2.testId,
|
|
639
|
+
style: {
|
|
640
|
+
"--index": index,
|
|
641
|
+
"--toasts-before": index,
|
|
642
|
+
"--z-index": toasts.length - index,
|
|
643
|
+
"--offset": `${removed ? offsetBeforeRemove : offset.current}px`,
|
|
644
|
+
"--initial-height": expandByDefault ? "auto" : `${initialHeight}px`,
|
|
645
|
+
...style,
|
|
646
|
+
...toast2.style
|
|
647
|
+
},
|
|
648
|
+
onDragEnd: () => {
|
|
649
|
+
setSwiping(false);
|
|
650
|
+
setSwipeDirection(null);
|
|
651
|
+
pointerStartRef.current = null;
|
|
652
|
+
},
|
|
653
|
+
onPointerDown: (event) => {
|
|
654
|
+
if (event.button === 2) return;
|
|
655
|
+
if (disabled || !dismissible) return;
|
|
656
|
+
dragStartTime.current = /* @__PURE__ */ new Date();
|
|
657
|
+
setOffsetBeforeRemove(offset.current);
|
|
658
|
+
event.target.setPointerCapture(event.pointerId);
|
|
659
|
+
if (event.target.tagName === "BUTTON") return;
|
|
660
|
+
setSwiping(true);
|
|
661
|
+
pointerStartRef.current = {
|
|
662
|
+
x: event.clientX,
|
|
663
|
+
y: event.clientY
|
|
664
|
+
};
|
|
665
|
+
},
|
|
666
|
+
onPointerUp: () => {
|
|
667
|
+
var _toastRef_current, _toastRef_current1, _dragStartTime_current;
|
|
668
|
+
if (swipeOut || !dismissible) return;
|
|
669
|
+
pointerStartRef.current = null;
|
|
670
|
+
const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0);
|
|
671
|
+
const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0);
|
|
672
|
+
const timeTaken = (/* @__PURE__ */ new Date()).getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());
|
|
673
|
+
const swipeAmount = swipeDirection === "x" ? swipeAmountX : swipeAmountY;
|
|
674
|
+
const velocity = Math.abs(swipeAmount) / timeTaken;
|
|
675
|
+
if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
|
|
676
|
+
setOffsetBeforeRemove(offset.current);
|
|
677
|
+
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
678
|
+
if (swipeDirection === "x") {
|
|
679
|
+
setSwipeOutDirection(swipeAmountX > 0 ? "right" : "left");
|
|
680
|
+
} else {
|
|
681
|
+
setSwipeOutDirection(swipeAmountY > 0 ? "down" : "up");
|
|
682
|
+
}
|
|
683
|
+
deleteToast();
|
|
684
|
+
setSwipeOut(true);
|
|
685
|
+
return;
|
|
686
|
+
} else {
|
|
687
|
+
var _toastRef_current2, _toastRef_current3;
|
|
688
|
+
(_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty("--swipe-amount-x", `0px`);
|
|
689
|
+
(_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty("--swipe-amount-y", `0px`);
|
|
690
|
+
}
|
|
691
|
+
setIsSwiped(false);
|
|
692
|
+
setSwiping(false);
|
|
693
|
+
setSwipeDirection(null);
|
|
694
|
+
},
|
|
695
|
+
onPointerMove: (event) => {
|
|
696
|
+
var _window_getSelection, _toastRef_current, _toastRef_current1;
|
|
697
|
+
if (!pointerStartRef.current || !dismissible) return;
|
|
698
|
+
const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0;
|
|
699
|
+
if (isHighlighted) return;
|
|
700
|
+
const yDelta = event.clientY - pointerStartRef.current.y;
|
|
701
|
+
const xDelta = event.clientX - pointerStartRef.current.x;
|
|
702
|
+
var _props_swipeDirections;
|
|
703
|
+
const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position);
|
|
704
|
+
if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {
|
|
705
|
+
setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? "x" : "y");
|
|
706
|
+
}
|
|
707
|
+
let swipeAmount = {
|
|
708
|
+
x: 0,
|
|
709
|
+
y: 0
|
|
710
|
+
};
|
|
711
|
+
const getDampening = (delta) => {
|
|
712
|
+
const factor = Math.abs(delta) / 20;
|
|
713
|
+
return 1 / (1.5 + factor);
|
|
714
|
+
};
|
|
715
|
+
if (swipeDirection === "y") {
|
|
716
|
+
if (swipeDirections.includes("top") || swipeDirections.includes("bottom")) {
|
|
717
|
+
if (swipeDirections.includes("top") && yDelta < 0 || swipeDirections.includes("bottom") && yDelta > 0) {
|
|
718
|
+
swipeAmount.y = yDelta;
|
|
719
|
+
} else {
|
|
720
|
+
const dampenedDelta = yDelta * getDampening(yDelta);
|
|
721
|
+
swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
} else if (swipeDirection === "x") {
|
|
725
|
+
if (swipeDirections.includes("left") || swipeDirections.includes("right")) {
|
|
726
|
+
if (swipeDirections.includes("left") && xDelta < 0 || swipeDirections.includes("right") && xDelta > 0) {
|
|
727
|
+
swipeAmount.x = xDelta;
|
|
728
|
+
} else {
|
|
729
|
+
const dampenedDelta = xDelta * getDampening(xDelta);
|
|
730
|
+
swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {
|
|
735
|
+
setIsSwiped(true);
|
|
736
|
+
}
|
|
737
|
+
(_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty("--swipe-amount-x", `${swipeAmount.x}px`);
|
|
738
|
+
(_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty("--swipe-amount-y", `${swipeAmount.y}px`);
|
|
739
|
+
}
|
|
740
|
+
}, closeButton && !toast2.jsx && toastType !== "loading" ? /* @__PURE__ */ We.createElement("button", {
|
|
741
|
+
"aria-label": closeButtonAriaLabel,
|
|
742
|
+
"data-disabled": disabled,
|
|
743
|
+
"data-close-button": true,
|
|
744
|
+
onClick: disabled || !dismissible ? () => {
|
|
745
|
+
} : () => {
|
|
746
|
+
deleteToast();
|
|
747
|
+
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
748
|
+
},
|
|
749
|
+
className: cn(classNames == null ? void 0 : classNames.closeButton, toast2 == null ? void 0 : (_toast_classNames2 = toast2.classNames) == null ? void 0 : _toast_classNames2.closeButton)
|
|
750
|
+
}, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast2.icon || toast2.promise) && toast2.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast2.icon) ? /* @__PURE__ */ We.createElement("div", {
|
|
751
|
+
"data-icon": "",
|
|
752
|
+
className: cn(classNames == null ? void 0 : classNames.icon, toast2 == null ? void 0 : (_toast_classNames3 = toast2.classNames) == null ? void 0 : _toast_classNames3.icon)
|
|
753
|
+
}, toast2.promise || toast2.type === "loading" && !toast2.icon ? toast2.icon || getLoadingIcon() : null, toast2.type !== "loading" ? icon : null) : null, /* @__PURE__ */ We.createElement("div", {
|
|
754
|
+
"data-content": "",
|
|
755
|
+
className: cn(classNames == null ? void 0 : classNames.content, toast2 == null ? void 0 : (_toast_classNames4 = toast2.classNames) == null ? void 0 : _toast_classNames4.content)
|
|
756
|
+
}, /* @__PURE__ */ We.createElement("div", {
|
|
757
|
+
"data-title": "",
|
|
758
|
+
className: cn(classNames == null ? void 0 : classNames.title, toast2 == null ? void 0 : (_toast_classNames5 = toast2.classNames) == null ? void 0 : _toast_classNames5.title)
|
|
759
|
+
}, toast2.jsx ? toast2.jsx : typeof toast2.title === "function" ? toast2.title() : toast2.title), toast2.description ? /* @__PURE__ */ We.createElement("div", {
|
|
760
|
+
"data-description": "",
|
|
761
|
+
className: cn(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast2 == null ? void 0 : (_toast_classNames6 = toast2.classNames) == null ? void 0 : _toast_classNames6.description)
|
|
762
|
+
}, typeof toast2.description === "function" ? toast2.description() : toast2.description) : null), /* @__PURE__ */ We.isValidElement(toast2.cancel) ? toast2.cancel : toast2.cancel && isAction(toast2.cancel) ? /* @__PURE__ */ We.createElement("button", {
|
|
763
|
+
"data-button": true,
|
|
764
|
+
"data-cancel": true,
|
|
765
|
+
style: toast2.cancelButtonStyle || cancelButtonStyle,
|
|
766
|
+
onClick: (event) => {
|
|
767
|
+
if (!isAction(toast2.cancel)) return;
|
|
768
|
+
if (!dismissible) return;
|
|
769
|
+
toast2.cancel.onClick == null ? void 0 : toast2.cancel.onClick.call(toast2.cancel, event);
|
|
770
|
+
deleteToast();
|
|
771
|
+
},
|
|
772
|
+
className: cn(classNames == null ? void 0 : classNames.cancelButton, toast2 == null ? void 0 : (_toast_classNames7 = toast2.classNames) == null ? void 0 : _toast_classNames7.cancelButton)
|
|
773
|
+
}, toast2.cancel.label) : null, /* @__PURE__ */ We.isValidElement(toast2.action) ? toast2.action : toast2.action && isAction(toast2.action) ? /* @__PURE__ */ We.createElement("button", {
|
|
774
|
+
"data-button": true,
|
|
775
|
+
"data-action": true,
|
|
776
|
+
style: toast2.actionButtonStyle || actionButtonStyle,
|
|
777
|
+
onClick: (event) => {
|
|
778
|
+
if (!isAction(toast2.action)) return;
|
|
779
|
+
toast2.action.onClick == null ? void 0 : toast2.action.onClick.call(toast2.action, event);
|
|
780
|
+
if (event.defaultPrevented) return;
|
|
781
|
+
deleteToast();
|
|
782
|
+
},
|
|
783
|
+
className: cn(classNames == null ? void 0 : classNames.actionButton, toast2 == null ? void 0 : (_toast_classNames8 = toast2.classNames) == null ? void 0 : _toast_classNames8.actionButton)
|
|
784
|
+
}, toast2.action.label) : null);
|
|
785
|
+
};
|
|
786
|
+
function getDocumentDirection() {
|
|
787
|
+
if (typeof window === "undefined") return "ltr";
|
|
788
|
+
if (typeof document === "undefined") return "ltr";
|
|
789
|
+
const dirAttribute = document.documentElement.getAttribute("dir");
|
|
790
|
+
if (dirAttribute === "auto" || !dirAttribute) {
|
|
791
|
+
return window.getComputedStyle(document.documentElement).direction;
|
|
792
|
+
}
|
|
793
|
+
return dirAttribute;
|
|
794
|
+
}
|
|
795
|
+
function assignOffset(defaultOffset, mobileOffset) {
|
|
796
|
+
const styles = {};
|
|
797
|
+
[
|
|
798
|
+
defaultOffset,
|
|
799
|
+
mobileOffset
|
|
800
|
+
].forEach((offset, index) => {
|
|
801
|
+
const isMobile = index === 1;
|
|
802
|
+
const prefix = isMobile ? "--mobile-offset" : "--offset";
|
|
803
|
+
const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;
|
|
804
|
+
function assignAll(offset2) {
|
|
805
|
+
[
|
|
806
|
+
"top",
|
|
807
|
+
"right",
|
|
808
|
+
"bottom",
|
|
809
|
+
"left"
|
|
810
|
+
].forEach((key) => {
|
|
811
|
+
styles[`${prefix}-${key}`] = typeof offset2 === "number" ? `${offset2}px` : offset2;
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
if (typeof offset === "number" || typeof offset === "string") {
|
|
815
|
+
assignAll(offset);
|
|
816
|
+
} else if (typeof offset === "object") {
|
|
817
|
+
[
|
|
818
|
+
"top",
|
|
819
|
+
"right",
|
|
820
|
+
"bottom",
|
|
821
|
+
"left"
|
|
822
|
+
].forEach((key) => {
|
|
823
|
+
if (offset[key] === void 0) {
|
|
824
|
+
styles[`${prefix}-${key}`] = defaultValue;
|
|
825
|
+
} else {
|
|
826
|
+
styles[`${prefix}-${key}`] = typeof offset[key] === "number" ? `${offset[key]}px` : offset[key];
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
} else {
|
|
830
|
+
assignAll(defaultValue);
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
return styles;
|
|
834
|
+
}
|
|
835
|
+
const Toaster = /* @__PURE__ */ We.forwardRef(function Toaster2(props, ref) {
|
|
836
|
+
const { id, invert, position = "bottom-right", hotkey = [
|
|
837
|
+
"altKey",
|
|
838
|
+
"KeyT"
|
|
839
|
+
], expand, closeButton, className, offset, mobileOffset, theme = "light", richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = "Notifications" } = props;
|
|
840
|
+
const [toasts, setToasts] = We.useState([]);
|
|
841
|
+
const filteredToasts = We.useMemo(() => {
|
|
842
|
+
if (id) {
|
|
843
|
+
return toasts.filter((toast2) => toast2.toasterId === id);
|
|
844
|
+
}
|
|
845
|
+
return toasts.filter((toast2) => !toast2.toasterId);
|
|
846
|
+
}, [
|
|
847
|
+
toasts,
|
|
848
|
+
id
|
|
849
|
+
]);
|
|
850
|
+
const possiblePositions = We.useMemo(() => {
|
|
851
|
+
return Array.from(new Set([
|
|
852
|
+
position
|
|
853
|
+
].concat(filteredToasts.filter((toast2) => toast2.position).map((toast2) => toast2.position))));
|
|
854
|
+
}, [
|
|
855
|
+
filteredToasts,
|
|
856
|
+
position
|
|
857
|
+
]);
|
|
858
|
+
const [heights, setHeights] = We.useState([]);
|
|
859
|
+
const [expanded, setExpanded] = We.useState(false);
|
|
860
|
+
const [interacting, setInteracting] = We.useState(false);
|
|
861
|
+
const [actualTheme, setActualTheme] = We.useState(theme !== "system" ? theme : typeof window !== "undefined" ? window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "light");
|
|
862
|
+
const listRef = We.useRef(null);
|
|
863
|
+
const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
864
|
+
const lastFocusedElementRef = We.useRef(null);
|
|
865
|
+
const isFocusWithinRef = We.useRef(false);
|
|
866
|
+
const removeToast = We.useCallback((toastToRemove) => {
|
|
867
|
+
setToasts((toasts2) => {
|
|
868
|
+
var _toasts_find;
|
|
869
|
+
if (!((_toasts_find = toasts2.find((toast2) => toast2.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
|
|
870
|
+
ToastState.dismiss(toastToRemove.id);
|
|
871
|
+
}
|
|
872
|
+
return toasts2.filter(({ id: id2 }) => id2 !== toastToRemove.id);
|
|
873
|
+
});
|
|
874
|
+
}, []);
|
|
875
|
+
We.useEffect(() => {
|
|
876
|
+
return ToastState.subscribe((toast2) => {
|
|
877
|
+
if (toast2.dismiss) {
|
|
878
|
+
requestAnimationFrame(() => {
|
|
879
|
+
setToasts((toasts2) => toasts2.map((t) => t.id === toast2.id ? {
|
|
880
|
+
...t,
|
|
881
|
+
delete: true
|
|
882
|
+
} : t));
|
|
883
|
+
});
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
setTimeout(() => {
|
|
887
|
+
ReactDOM.flushSync(() => {
|
|
888
|
+
setToasts((toasts2) => {
|
|
889
|
+
const indexOfExistingToast = toasts2.findIndex((t) => t.id === toast2.id);
|
|
890
|
+
if (indexOfExistingToast !== -1) {
|
|
891
|
+
return [
|
|
892
|
+
...toasts2.slice(0, indexOfExistingToast),
|
|
893
|
+
{
|
|
894
|
+
...toasts2[indexOfExistingToast],
|
|
895
|
+
...toast2
|
|
896
|
+
},
|
|
897
|
+
...toasts2.slice(indexOfExistingToast + 1)
|
|
898
|
+
];
|
|
899
|
+
}
|
|
900
|
+
return [
|
|
901
|
+
toast2,
|
|
902
|
+
...toasts2
|
|
903
|
+
];
|
|
904
|
+
});
|
|
905
|
+
});
|
|
906
|
+
});
|
|
907
|
+
});
|
|
908
|
+
}, [
|
|
909
|
+
toasts
|
|
910
|
+
]);
|
|
911
|
+
We.useEffect(() => {
|
|
912
|
+
if (theme !== "system") {
|
|
913
|
+
setActualTheme(theme);
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
if (theme === "system") {
|
|
917
|
+
if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
|
918
|
+
setActualTheme("dark");
|
|
919
|
+
} else {
|
|
920
|
+
setActualTheme("light");
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
if (typeof window === "undefined") return;
|
|
924
|
+
const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
925
|
+
try {
|
|
926
|
+
darkMediaQuery.addEventListener("change", ({ matches }) => {
|
|
927
|
+
if (matches) {
|
|
928
|
+
setActualTheme("dark");
|
|
929
|
+
} else {
|
|
930
|
+
setActualTheme("light");
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
} catch (error) {
|
|
934
|
+
darkMediaQuery.addListener(({ matches }) => {
|
|
935
|
+
try {
|
|
936
|
+
if (matches) {
|
|
937
|
+
setActualTheme("dark");
|
|
938
|
+
} else {
|
|
939
|
+
setActualTheme("light");
|
|
940
|
+
}
|
|
941
|
+
} catch (e) {
|
|
942
|
+
console.error(e);
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
}, [
|
|
947
|
+
theme
|
|
948
|
+
]);
|
|
949
|
+
We.useEffect(() => {
|
|
950
|
+
if (toasts.length <= 1) {
|
|
951
|
+
setExpanded(false);
|
|
952
|
+
}
|
|
953
|
+
}, [
|
|
954
|
+
toasts
|
|
955
|
+
]);
|
|
956
|
+
We.useEffect(() => {
|
|
957
|
+
const handleKeyDown = (event) => {
|
|
958
|
+
var _listRef_current;
|
|
959
|
+
const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
|
|
960
|
+
if (isHotkeyPressed) {
|
|
961
|
+
var _listRef_current1;
|
|
962
|
+
setExpanded(true);
|
|
963
|
+
(_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus();
|
|
964
|
+
}
|
|
965
|
+
if (event.code === "Escape" && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) {
|
|
966
|
+
setExpanded(false);
|
|
967
|
+
}
|
|
968
|
+
};
|
|
969
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
970
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
971
|
+
}, [
|
|
972
|
+
hotkey
|
|
973
|
+
]);
|
|
974
|
+
We.useEffect(() => {
|
|
975
|
+
if (listRef.current) {
|
|
976
|
+
return () => {
|
|
977
|
+
if (lastFocusedElementRef.current) {
|
|
978
|
+
lastFocusedElementRef.current.focus({
|
|
979
|
+
preventScroll: true
|
|
980
|
+
});
|
|
981
|
+
lastFocusedElementRef.current = null;
|
|
982
|
+
isFocusWithinRef.current = false;
|
|
983
|
+
}
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
}, [
|
|
987
|
+
listRef.current
|
|
988
|
+
]);
|
|
989
|
+
return (
|
|
990
|
+
// Remove item from normal navigation flow, only available via hotkey
|
|
991
|
+
/* @__PURE__ */ We.createElement("section", {
|
|
992
|
+
ref,
|
|
993
|
+
"aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
|
|
994
|
+
tabIndex: -1,
|
|
995
|
+
"aria-live": "polite",
|
|
996
|
+
"aria-relevant": "additions text",
|
|
997
|
+
"aria-atomic": "false",
|
|
998
|
+
suppressHydrationWarning: true
|
|
999
|
+
}, possiblePositions.map((position2, index) => {
|
|
1000
|
+
var _heights_;
|
|
1001
|
+
const [y, x] = position2.split("-");
|
|
1002
|
+
if (!filteredToasts.length) return null;
|
|
1003
|
+
return /* @__PURE__ */ We.createElement("ol", {
|
|
1004
|
+
key: position2,
|
|
1005
|
+
dir: dir === "auto" ? getDocumentDirection() : dir,
|
|
1006
|
+
tabIndex: -1,
|
|
1007
|
+
ref: listRef,
|
|
1008
|
+
className,
|
|
1009
|
+
"data-sonner-toaster": true,
|
|
1010
|
+
"data-sonner-theme": actualTheme,
|
|
1011
|
+
"data-y-position": y,
|
|
1012
|
+
"data-x-position": x,
|
|
1013
|
+
style: {
|
|
1014
|
+
"--front-toast-height": `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`,
|
|
1015
|
+
"--width": `${TOAST_WIDTH}px`,
|
|
1016
|
+
"--gap": `${gap}px`,
|
|
1017
|
+
...style,
|
|
1018
|
+
...assignOffset(offset, mobileOffset)
|
|
1019
|
+
},
|
|
1020
|
+
onBlur: (event) => {
|
|
1021
|
+
if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {
|
|
1022
|
+
isFocusWithinRef.current = false;
|
|
1023
|
+
if (lastFocusedElementRef.current) {
|
|
1024
|
+
lastFocusedElementRef.current.focus({
|
|
1025
|
+
preventScroll: true
|
|
1026
|
+
});
|
|
1027
|
+
lastFocusedElementRef.current = null;
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
},
|
|
1031
|
+
onFocus: (event) => {
|
|
1032
|
+
const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
|
|
1033
|
+
if (isNotDismissible) return;
|
|
1034
|
+
if (!isFocusWithinRef.current) {
|
|
1035
|
+
isFocusWithinRef.current = true;
|
|
1036
|
+
lastFocusedElementRef.current = event.relatedTarget;
|
|
1037
|
+
}
|
|
1038
|
+
},
|
|
1039
|
+
onMouseEnter: () => setExpanded(true),
|
|
1040
|
+
onMouseMove: () => setExpanded(true),
|
|
1041
|
+
onMouseLeave: () => {
|
|
1042
|
+
if (!interacting) {
|
|
1043
|
+
setExpanded(false);
|
|
1044
|
+
}
|
|
1045
|
+
},
|
|
1046
|
+
onDragEnd: () => setExpanded(false),
|
|
1047
|
+
onPointerDown: (event) => {
|
|
1048
|
+
const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
|
|
1049
|
+
if (isNotDismissible) return;
|
|
1050
|
+
setInteracting(true);
|
|
1051
|
+
},
|
|
1052
|
+
onPointerUp: () => setInteracting(false)
|
|
1053
|
+
}, filteredToasts.filter((toast2) => !toast2.position && index === 0 || toast2.position === position2).map((toast2, index2) => {
|
|
1054
|
+
var _toastOptions_duration, _toastOptions_closeButton;
|
|
1055
|
+
return /* @__PURE__ */ We.createElement(Toast, {
|
|
1056
|
+
key: toast2.id,
|
|
1057
|
+
icons,
|
|
1058
|
+
index: index2,
|
|
1059
|
+
toast: toast2,
|
|
1060
|
+
defaultRichColors: richColors,
|
|
1061
|
+
duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration,
|
|
1062
|
+
className: toastOptions == null ? void 0 : toastOptions.className,
|
|
1063
|
+
descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName,
|
|
1064
|
+
invert,
|
|
1065
|
+
visibleToasts,
|
|
1066
|
+
closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton,
|
|
1067
|
+
interacting,
|
|
1068
|
+
position: position2,
|
|
1069
|
+
style: toastOptions == null ? void 0 : toastOptions.style,
|
|
1070
|
+
unstyled: toastOptions == null ? void 0 : toastOptions.unstyled,
|
|
1071
|
+
classNames: toastOptions == null ? void 0 : toastOptions.classNames,
|
|
1072
|
+
cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle,
|
|
1073
|
+
actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
|
|
1074
|
+
closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
|
|
1075
|
+
removeToast,
|
|
1076
|
+
toasts: filteredToasts.filter((t) => t.position == toast2.position),
|
|
1077
|
+
heights: heights.filter((h) => h.position == toast2.position),
|
|
1078
|
+
setHeights,
|
|
1079
|
+
expandByDefault: expand,
|
|
1080
|
+
gap,
|
|
1081
|
+
expanded,
|
|
1082
|
+
swipeDirections: props.swipeDirections
|
|
1083
|
+
});
|
|
1084
|
+
}));
|
|
1085
|
+
}))
|
|
1086
|
+
);
|
|
1087
|
+
});
|
|
1088
|
+
export {
|
|
1089
|
+
Search as S,
|
|
1090
|
+
Toaster as T,
|
|
1091
|
+
toast as t
|
|
1092
|
+
};
|