@alivault/pico 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +17 -0
- package/.output/public/apple-touch-icon.png +0 -0
- package/.output/public/assets/abap-smLpETzL.js +1 -0
- package/.output/public/assets/actionscript-3-o-aRvjY5.js +1 -0
- package/.output/public/assets/ada-D5RRX1i4.js +1 -0
- package/.output/public/assets/andromeeda-N4z3YzmR.js +1 -0
- package/.output/public/assets/angular-html-BZNntD0J.js +1 -0
- package/.output/public/assets/angular-ts-SQQMYL2C.js +1 -0
- package/.output/public/assets/apache-DttKlSqg.js +1 -0
- package/.output/public/assets/apex-DL7j-a2n.js +1 -0
- package/.output/public/assets/apl-D5V6uPDr.js +1 -0
- package/.output/public/assets/applescript-DCbL_2FX.js +1 -0
- package/.output/public/assets/ara-DqheWJCe.js +1 -0
- package/.output/public/assets/asciidoc-BH2sf2K4.js +1 -0
- package/.output/public/assets/asm-rfjOMz3U.js +1 -0
- package/.output/public/assets/astro-DeXKSaFP.js +1 -0
- package/.output/public/assets/aurora-x-CND-FqEb.js +1 -0
- package/.output/public/assets/awk-CMV5n9Z7.js +1 -0
- package/.output/public/assets/ayu-dark-on7xzq_B.js +1 -0
- package/.output/public/assets/ayu-light-DnGeGGc2.js +1 -0
- package/.output/public/assets/ayu-mirage-DG3LlYC_.js +1 -0
- package/.output/public/assets/ballerina-BjMqJjlr.js +1 -0
- package/.output/public/assets/bat-BaVbo_qw.js +1 -0
- package/.output/public/assets/beancount-DBt5Mbc_.js +1 -0
- package/.output/public/assets/berry-Cyjuxiss.js +1 -0
- package/.output/public/assets/bibtex-BV_0nsPq.js +1 -0
- package/.output/public/assets/bicep-C2gEwu4J.js +1 -0
- package/.output/public/assets/bird2-BRyaEJd0.js +1 -0
- package/.output/public/assets/blade-Bu5re0Vg.js +1 -0
- package/.output/public/assets/bsl-B1qbqNES.js +1 -0
- package/.output/public/assets/c-Nc9zJT78.js +1 -0
- package/.output/public/assets/c3-DTTbp5N2.js +1 -0
- package/.output/public/assets/cadence-CPz83cmI.js +1 -0
- package/.output/public/assets/cairo-BDj8wWhy.js +1 -0
- package/.output/public/assets/catppuccin-frappe-Dr22sraq.js +1 -0
- package/.output/public/assets/catppuccin-latte-C57EeX8c.js +1 -0
- package/.output/public/assets/catppuccin-macchiato-CpheI4uD.js +1 -0
- package/.output/public/assets/catppuccin-mocha-D8Lmdks_.js +1 -0
- package/.output/public/assets/clarity-CFJ2Yc3q.js +1 -0
- package/.output/public/assets/clojure-6R01QgJC.js +1 -0
- package/.output/public/assets/cmake-D5rSbMir.js +1 -0
- package/.output/public/assets/cobol-nvZDS9LT.js +1 -0
- package/.output/public/assets/codeowners-_3A-ClkN.js +1 -0
- package/.output/public/assets/codeql-DlIhJTR7.js +1 -0
- package/.output/public/assets/coffee-BKLOTq4e.js +1 -0
- package/.output/public/assets/common-lisp-BvQzz173.js +1 -0
- package/.output/public/assets/coq-DTNXReIC.js +1 -0
- package/.output/public/assets/cpp-D6g1DVNt.js +1 -0
- package/.output/public/assets/crystal-DfoZI57w.js +1 -0
- package/.output/public/assets/csharp-BDKQY1K9.js +1 -0
- package/.output/public/assets/css-DRmnABqB.js +1 -0
- package/.output/public/assets/csv-DNUpVBxl.js +1 -0
- package/.output/public/assets/cue-DDdBc2s3.js +1 -0
- package/.output/public/assets/cypher-CguaznO2.js +1 -0
- package/.output/public/assets/d-CHcoyjv3.js +1 -0
- package/.output/public/assets/dark-plus-CqeW_0kH.js +1 -0
- package/.output/public/assets/dart-RM3aRphk.js +1 -0
- package/.output/public/assets/dax-nbnY1d79.js +1 -0
- package/.output/public/assets/desktop-BD76cvxT.js +1 -0
- package/.output/public/assets/diff-CdkWtnkL.js +1 -0
- package/.output/public/assets/docker-ZyPHc6zB.js +1 -0
- package/.output/public/assets/dotenv-BdJZEwA6.js +1 -0
- package/.output/public/assets/dracula-CtqCPLGa.js +1 -0
- package/.output/public/assets/dracula-soft-DmBpwRAy.js +1 -0
- package/.output/public/assets/dream-maker-BJL4qlg3.js +1 -0
- package/.output/public/assets/edge-DwocGnOF.js +1 -0
- package/.output/public/assets/elixir-Dtbfds1r.js +1 -0
- package/.output/public/assets/elm-CpPtm471.js +1 -0
- package/.output/public/assets/emacs-lisp-_LyYa2Ky.js +1 -0
- package/.output/public/assets/erb--z3IM9Cb.js +1 -0
- package/.output/public/assets/erlang-Bc4hQuqa.js +1 -0
- package/.output/public/assets/everforest-dark-CrbyKk4n.js +1 -0
- package/.output/public/assets/everforest-light-DRbSh8Tm.js +1 -0
- package/.output/public/assets/fennel-CC2BkRsS.js +1 -0
- package/.output/public/assets/fish-D2ZCzqcE.js +1 -0
- package/.output/public/assets/fluent-DKAm3m7q.js +1 -0
- package/.output/public/assets/fortran-fixed-form-B02FOYI-.js +1 -0
- package/.output/public/assets/fortran-free-form-BPTf0lbT.js +1 -0
- package/.output/public/assets/fsharp-DhdR18vN.js +1 -0
- package/.output/public/assets/gdresource-DgnrMPIx.js +1 -0
- package/.output/public/assets/gdscript-CsadCSaZ.js +1 -0
- package/.output/public/assets/gdshader-PfnN_8tR.js +1 -0
- package/.output/public/assets/genie-Bj-orPAV.js +1 -0
- package/.output/public/assets/gherkin-COVWpJ-Q.js +1 -0
- package/.output/public/assets/git-commit-DGJi7qBD.js +1 -0
- package/.output/public/assets/git-rebase-Ce47xoa6.js +1 -0
- package/.output/public/assets/github-dark-default-DX3IG_X0.js +1 -0
- package/.output/public/assets/github-dark-dimmed-CH6p_7ez.js +1 -0
- package/.output/public/assets/github-dark-high-contrast-Bg2sSao5.js +1 -0
- package/.output/public/assets/github-dark-ipGuFGYC.js +1 -0
- package/.output/public/assets/github-light-BxjqOQl0.js +1 -0
- package/.output/public/assets/github-light-default-DwpDd1IQ.js +1 -0
- package/.output/public/assets/github-light-high-contrast-C0QeixPf.js +1 -0
- package/.output/public/assets/gleam-BF2NigGj.js +1 -0
- package/.output/public/assets/glimmer-js-C0BuzxQC.js +1 -0
- package/.output/public/assets/glimmer-ts-irOZ-cAQ.js +1 -0
- package/.output/public/assets/glsl-JAhLUe0P.js +1 -0
- package/.output/public/assets/gn-CMIt9roj.js +1 -0
- package/.output/public/assets/gnuplot-DgWlRTEj.js +1 -0
- package/.output/public/assets/go-DLnOLj8q.js +1 -0
- package/.output/public/assets/graphql-D2ba3BkR.js +1 -0
- package/.output/public/assets/groovy-B9qLWIkE.js +1 -0
- package/.output/public/assets/gruvbox-dark-hard-BIMX9ePb.js +1 -0
- package/.output/public/assets/gruvbox-dark-medium-DxuwyVzM.js +1 -0
- package/.output/public/assets/gruvbox-dark-soft-ba2fjht0.js +1 -0
- package/.output/public/assets/gruvbox-light-hard-DAJK2PqC.js +1 -0
- package/.output/public/assets/gruvbox-light-medium-WRifDAJD.js +1 -0
- package/.output/public/assets/gruvbox-light-soft-B0dBOoVB.js +1 -0
- package/.output/public/assets/hack-CgzUpY8l.js +1 -0
- package/.output/public/assets/haml-C-oIZcDo.js +1 -0
- package/.output/public/assets/handlebars-CbP-Mhzf.js +1 -0
- package/.output/public/assets/haskell-BaGpmm_c.js +1 -0
- package/.output/public/assets/haxe-DfXTCEOz.js +1 -0
- package/.output/public/assets/hcl-CbCtpSbi.js +1 -0
- package/.output/public/assets/hjson-_4-w-pHU.js +1 -0
- package/.output/public/assets/hlsl-DpuYn7pp.js +1 -0
- package/.output/public/assets/horizon-C5RtD1fY.js +1 -0
- package/.output/public/assets/horizon-bright-pEOice34.js +1 -0
- package/.output/public/assets/houston-A0zg9vNP.js +1 -0
- package/.output/public/assets/html-ddqpqPg0.js +1 -0
- package/.output/public/assets/html-derivative-DWGxf_At.js +1 -0
- package/.output/public/assets/http-Bg1nG1nG.js +1 -0
- package/.output/public/assets/hurl-zm47Pi1n.js +1 -0
- package/.output/public/assets/hxml-adC65L_J.js +1 -0
- package/.output/public/assets/hy-t9zDXBje.js +1 -0
- package/.output/public/assets/imba-Bxu-TDfw.js +1 -0
- package/.output/public/assets/index-CthXqlK7.js +53 -0
- package/.output/public/assets/ini-D-v34c8N.js +1 -0
- package/.output/public/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/.output/public/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/.output/public/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/.output/public/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/.output/public/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/.output/public/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/.output/public/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/.output/public/assets/java-DVLnIrqC.js +1 -0
- package/.output/public/assets/javascript-Cop1kpy_.js +1 -0
- package/.output/public/assets/jinja-Bnj4awH5.js +1 -0
- package/.output/public/assets/jison-CuCNs9Q3.js +1 -0
- package/.output/public/assets/json-CTw4n7kn.js +1 -0
- package/.output/public/assets/json5-D0XL1D5m.js +1 -0
- package/.output/public/assets/jsonc-BBgf3TX3.js +1 -0
- package/.output/public/assets/jsonl-KrKLbtB7.js +1 -0
- package/.output/public/assets/jsonnet-B2ZwWMOt.js +1 -0
- package/.output/public/assets/jssm-ByRpI9-B.js +1 -0
- package/.output/public/assets/jsx-0oMUGqZj.js +1 -0
- package/.output/public/assets/julia-DNYHzXlE.js +1 -0
- package/.output/public/assets/just-BlWkkmf2.js +1 -0
- package/.output/public/assets/kanagawa-dragon-CtPmcCMp.js +1 -0
- package/.output/public/assets/kanagawa-lotus-DpOXEGCa.js +1 -0
- package/.output/public/assets/kanagawa-wave-CLVCyc-n.js +1 -0
- package/.output/public/assets/kdl-6FPPEH4H.js +1 -0
- package/.output/public/assets/kotlin-D4L3Nd2D.js +1 -0
- package/.output/public/assets/kusto-D-mmc07O.js +1 -0
- package/.output/public/assets/laserwave-7fEj4XGb.js +1 -0
- package/.output/public/assets/latex-DqPzjMIt.js +1 -0
- package/.output/public/assets/lean-BMVMuP2E.js +1 -0
- package/.output/public/assets/less-C95PyOu0.js +1 -0
- package/.output/public/assets/light-plus-DHI2dh3p.js +1 -0
- package/.output/public/assets/liquid-BURJK16h.js +1 -0
- package/.output/public/assets/llvm-Dy3qORTl.js +1 -0
- package/.output/public/assets/log-BQop7fzg.js +1 -0
- package/.output/public/assets/logo-DKtnYmrp.js +1 -0
- package/.output/public/assets/lua-31hdJClp.js +1 -0
- package/.output/public/assets/luau-Dha4KG0q.js +1 -0
- package/.output/public/assets/make-DfmS6buu.js +1 -0
- package/.output/public/assets/markdown-BaI9LyM4.js +1 -0
- package/.output/public/assets/marko-C2ZcdSLh.js +1 -0
- package/.output/public/assets/material-theme-Dm6ETY8i.js +1 -0
- package/.output/public/assets/material-theme-darker-BeyjmM5Z.js +1 -0
- package/.output/public/assets/material-theme-lighter-CCOYYzKL.js +1 -0
- package/.output/public/assets/material-theme-ocean-CUtPiiX3.js +1 -0
- package/.output/public/assets/material-theme-palenight-2L4zMwIM.js +1 -0
- package/.output/public/assets/matlab-BT79Cq_j.js +1 -0
- package/.output/public/assets/mdc-N1ii9pk5.js +1 -0
- package/.output/public/assets/mdx-CxGBwLNt.js +1 -0
- package/.output/public/assets/mermaid-DLf3axBN.js +1 -0
- package/.output/public/assets/min-dark-B8TUPGHg.js +1 -0
- package/.output/public/assets/min-light-BDOoBxcA.js +1 -0
- package/.output/public/assets/mipsasm-DXuU_0cI.js +1 -0
- package/.output/public/assets/mojo-1Omp2pIo.js +1 -0
- package/.output/public/assets/monokai-E_VBmXGZ.js +1 -0
- package/.output/public/assets/moonbit-DZzq699o.js +1 -0
- package/.output/public/assets/move-DxDAOJVd.js +1 -0
- package/.output/public/assets/narrat-CxDcPPb9.js +1 -0
- package/.output/public/assets/nextflow-JEyYUlIq.js +1 -0
- package/.output/public/assets/nextflow-groovy-wvmJO4hi.js +1 -0
- package/.output/public/assets/nginx-BuomO0W8.js +1 -0
- package/.output/public/assets/night-owl-DefhalNX.js +1 -0
- package/.output/public/assets/night-owl-light-byb3AbEn.js +1 -0
- package/.output/public/assets/nim-hKoEPsYL.js +1 -0
- package/.output/public/assets/nix-DsFTDHWT.js +1 -0
- package/.output/public/assets/nord-D5rQzHT-.js +1 -0
- package/.output/public/assets/nushell-BQ_rO0AM.js +1 -0
- package/.output/public/assets/objective-c-BMq6JT_m.js +1 -0
- package/.output/public/assets/objective-cpp-DRwojuGv.js +1 -0
- package/.output/public/assets/ocaml-e4_gKO6E.js +1 -0
- package/.output/public/assets/odin-mdTPwYOg.js +1 -0
- package/.output/public/assets/one-dark-pro-DxXww9jg.js +1 -0
- package/.output/public/assets/one-light-D9c03w7t.js +1 -0
- package/.output/public/assets/openscad-D2aTdNfr.js +1 -0
- package/.output/public/assets/pascal-D4n_G8vj.js +1 -0
- package/.output/public/assets/perl-CAGVW6Ra.js +1 -0
- package/.output/public/assets/php-BycclmzS.js +1 -0
- package/.output/public/assets/pierre-dark-CizZ1Z5z.js +1 -0
- package/.output/public/assets/pierre-light-CHMWfAMe.js +1 -0
- package/.output/public/assets/pkl-DcjhAp0L.js +1 -0
- package/.output/public/assets/plastic-uOsw7z1x.js +1 -0
- package/.output/public/assets/plsql-BSy3Ag0J.js +1 -0
- package/.output/public/assets/po-Be96RYkA.js +1 -0
- package/.output/public/assets/poimandres-CyO4HORD.js +1 -0
- package/.output/public/assets/polar-BmhMKWum.js +1 -0
- package/.output/public/assets/postcss-BTQso3H9.js +1 -0
- package/.output/public/assets/powerquery-DVyQv3M2.js +1 -0
- package/.output/public/assets/powershell-BmtCGJVD.js +1 -0
- package/.output/public/assets/prisma-CCFA9rEj.js +1 -0
- package/.output/public/assets/prolog-DWGEEo78.js +1 -0
- package/.output/public/assets/proto-C3eop1kM.js +1 -0
- package/.output/public/assets/pug-4maJHz9G.js +1 -0
- package/.output/public/assets/puppet-C0_7Nv5A.js +1 -0
- package/.output/public/assets/purescript-Bv-B8yRw.js +1 -0
- package/.output/public/assets/python-CKg5r0C3.js +1 -0
- package/.output/public/assets/qml-JLIQfzyb.js +1 -0
- package/.output/public/assets/qmldir-Cqfb4Lox.js +1 -0
- package/.output/public/assets/qss-Csho9BH8.js +1 -0
- package/.output/public/assets/r-UcxRcvcA.js +1 -0
- package/.output/public/assets/racket-D8-uWeQH.js +1 -0
- package/.output/public/assets/raku-Cj4JSa8p.js +1 -0
- package/.output/public/assets/razor-P8rbooCh.js +1 -0
- package/.output/public/assets/red-z4H4llUY.js +1 -0
- package/.output/public/assets/reg-DXGFiJSl.js +1 -0
- package/.output/public/assets/regexp-3-A0406L.js +1 -0
- package/.output/public/assets/rel-CunnVTBK.js +1 -0
- package/.output/public/assets/riscv-C8BcOCkS.js +1 -0
- package/.output/public/assets/rolldown-runtime-S-ySWqyJ.js +1 -0
- package/.output/public/assets/ron-DiDyR9oa.js +1 -0
- package/.output/public/assets/rose-pine-BADquuIH.js +1 -0
- package/.output/public/assets/rose-pine-dawn-BLcEeBoh.js +1 -0
- package/.output/public/assets/rose-pine-moon-BK_tLY1Y.js +1 -0
- package/.output/public/assets/rosmsg-CHmL1Uyj.js +1 -0
- package/.output/public/assets/routes-Bp0r03R8.js +2147 -0
- package/.output/public/assets/rst-C6GHyL-N.js +1 -0
- package/.output/public/assets/ruby-Cl8PVkbY.js +1 -0
- package/.output/public/assets/rust-DjJFInu3.js +1 -0
- package/.output/public/assets/sas-CXoVwlZN.js +1 -0
- package/.output/public/assets/sass-D3xZ5o-v.js +1 -0
- package/.output/public/assets/scala-B0IRml5w.js +1 -0
- package/.output/public/assets/scheme-BhwcV3Av.js +1 -0
- package/.output/public/assets/scss-DNczJ95n.js +1 -0
- package/.output/public/assets/sdbl-BmWYR-pI.js +1 -0
- package/.output/public/assets/shaderlab-DZ3Lsiak.js +1 -0
- package/.output/public/assets/shellscript-DaVPunOM.js +1 -0
- package/.output/public/assets/shellsession-COm1V40U.js +1 -0
- package/.output/public/assets/slack-dark-DOnVms5P.js +1 -0
- package/.output/public/assets/slack-ochin-DcRTft4q.js +1 -0
- package/.output/public/assets/smalltalk-DVQuUMII.js +1 -0
- package/.output/public/assets/snazzy-light-x9CLJ1W9.js +1 -0
- package/.output/public/assets/solarized-dark-BB1sh-pe.js +1 -0
- package/.output/public/assets/solarized-light-9-RPS998.js +1 -0
- package/.output/public/assets/solidity-gQ4WXILB.js +1 -0
- package/.output/public/assets/soy-DwewhJ_3.js +1 -0
- package/.output/public/assets/sparql-B9c85a_o.js +1 -0
- package/.output/public/assets/splunk-OB48_RcD.js +1 -0
- package/.output/public/assets/sql-CrTmZCMa.js +1 -0
- package/.output/public/assets/ssh-config-DA9YMRGV.js +1 -0
- package/.output/public/assets/stata-Bl--TAbZ.js +1 -0
- package/.output/public/assets/styles-DEX5mU_p.css +2 -0
- package/.output/public/assets/stylus-sKwvsUaC.js +1 -0
- package/.output/public/assets/surrealql-BW79EE-U.js +1 -0
- package/.output/public/assets/svelte-ziMErdPi.js +1 -0
- package/.output/public/assets/swift-C72NbAtg.js +1 -0
- package/.output/public/assets/synthwave-84-eJ9uRN_S.js +1 -0
- package/.output/public/assets/system-verilog-CnWMF7Nq.js +1 -0
- package/.output/public/assets/systemd-DMzItW5N.js +1 -0
- package/.output/public/assets/talonscript-DopQCWDL.js +1 -0
- package/.output/public/assets/tasl-C28SYKbq.js +1 -0
- package/.output/public/assets/tcl-DHq7zmoF.js +1 -0
- package/.output/public/assets/templ-C_9I6ncv.js +1 -0
- package/.output/public/assets/terraform-CogS1YKX.js +1 -0
- package/.output/public/assets/tex-D8LVuLf5.js +1 -0
- package/.output/public/assets/tokyo-night-B9N7LyrF.js +1 -0
- package/.output/public/assets/toml-BH_iPsgK.js +1 -0
- package/.output/public/assets/ts-tags-DKuFCGsc.js +1 -0
- package/.output/public/assets/tsv-BIkdBZX1.js +1 -0
- package/.output/public/assets/tsx-BjkCKOtw.js +1 -0
- package/.output/public/assets/turtle-CqNXyJWZ.js +1 -0
- package/.output/public/assets/twig-Bs1kcsO6.js +1 -0
- package/.output/public/assets/typescript-BoHeP9q1.js +1 -0
- package/.output/public/assets/typespec-CQ9LYD_e.js +1 -0
- package/.output/public/assets/typst-T-Fsk-Sv.js +1 -0
- package/.output/public/assets/v-BhMEOw9x.js +1 -0
- package/.output/public/assets/vala-DzajMnwt.js +1 -0
- package/.output/public/assets/vb-7Xr8dEYW.js +1 -0
- package/.output/public/assets/verilog-AvXtwZir.js +1 -0
- package/.output/public/assets/vesper-CtgQQ2sf.js +1 -0
- package/.output/public/assets/vhdl-BHu0zg1P.js +1 -0
- package/.output/public/assets/viml-Di0QpLfC.js +1 -0
- package/.output/public/assets/vitesse-black-jXdfyqgD.js +1 -0
- package/.output/public/assets/vitesse-dark-B88PxG1r.js +1 -0
- package/.output/public/assets/vitesse-light-BXxZh2iV.js +1 -0
- package/.output/public/assets/vue-Dnf0y5RU.js +1 -0
- package/.output/public/assets/vue-html-CRtKS76J.js +1 -0
- package/.output/public/assets/vue-vine-BxjPqU7T.js +1 -0
- package/.output/public/assets/vyper-C3R5yXgx.js +1 -0
- package/.output/public/assets/wasm-CEUrWlVz.js +1 -0
- package/.output/public/assets/wasm-Chsuwt1A.js +1 -0
- package/.output/public/assets/wenyan-BonVcr2i.js +1 -0
- package/.output/public/assets/wgsl-D59WYmNq.js +1 -0
- package/.output/public/assets/wikitext-ariTI2Wk.js +1 -0
- package/.output/public/assets/wit-EA4fa3Dt.js +1 -0
- package/.output/public/assets/wolfram-DDp7LhyU.js +1 -0
- package/.output/public/assets/xml-eU7M3iZJ.js +1 -0
- package/.output/public/assets/xsl-DSqe4nTO.js +1 -0
- package/.output/public/assets/yaml-BTD1XHJG.js +1 -0
- package/.output/public/assets/zenscript-4WaROUyc.js +1 -0
- package/.output/public/assets/zig-CJoLJGwV.js +1 -0
- package/.output/public/favicon.png +0 -0
- package/.output/public/favicon.svg +7 -0
- package/.output/public/manifest.json +28 -0
- package/.output/public/robots.txt +3 -0
- package/.output/public/screenshots/pico-workspace-alt.png +0 -0
- package/.output/public/screenshots/pico-workspace.png +0 -0
- package/.output/public/sounds/session-done.mp3 +0 -0
- package/.output/server/__23tanstack-start-plugin-adapters-y_fshQDY.mjs +5 -0
- package/.output/server/_chunks/ssr-renderer.mjs +15 -0
- package/.output/server/_libs/@base-ui/react+[...].mjs +14407 -0
- package/.output/server/_libs/@dnd-kit/core+[...].mjs +2748 -0
- package/.output/server/_libs/@pierre/diffs+[...].mjs +19074 -0
- package/.output/server/_libs/@pierre/trees+[...].mjs +9236 -0
- package/.output/server/_libs/@radix-ui/react-dialog+[...].mjs +1789 -0
- package/.output/server/_libs/@radix-ui/react-primitive+[...].mjs +136 -0
- package/.output/server/_libs/@tanstack/devtools-event-client+[...].mjs +196 -0
- package/.output/server/_libs/@tanstack/hotkeys+[...].mjs +1607 -0
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +13950 -0
- package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +90 -0
- package/.output/server/_libs/bail.mjs +13 -0
- package/.output/server/_libs/character-entities.mjs +2135 -0
- package/.output/server/_libs/class-variance-authority+clsx.mjs +69 -0
- package/.output/server/_libs/cmdk.mjs +473 -0
- package/.output/server/_libs/decode-named-character-reference+[...].mjs +19 -0
- package/.output/server/_libs/devlop.mjs +5 -0
- package/.output/server/_libs/diff.mjs +732 -0
- package/.output/server/_libs/dnd-kit__accessibility.mjs +46 -0
- package/.output/server/_libs/dnd-kit__sortable.mjs +400 -0
- package/.output/server/_libs/escape-string-regexp.mjs +7 -0
- package/.output/server/_libs/estree-util-is-identifier-name.mjs +20 -0
- package/.output/server/_libs/extend.mjs +75 -0
- package/.output/server/_libs/h3+rou3+srvx.mjs +1210 -0
- package/.output/server/_libs/hast-util-to-jsx-runtime+[...].mjs +1244 -0
- package/.output/server/_libs/hookable.mjs +41 -0
- package/.output/server/_libs/html-url-attributes.mjs +44 -0
- package/.output/server/_libs/is-plain-obj.mjs +8 -0
- package/.output/server/_libs/longest-streak.mjs +29 -0
- package/.output/server/_libs/lucide-react.mjs +632 -0
- package/.output/server/_libs/markdown-table.mjs +289 -0
- package/.output/server/_libs/mdast-util-find-and-replace+[...].mjs +636 -0
- package/.output/server/_libs/mdast-util-from-markdown+[...].mjs +8409 -0
- package/.output/server/_libs/mdast-util-gfm+[...].mjs +2346 -0
- package/.output/server/_libs/mdast-util-to-hast+[...].mjs +1772 -0
- package/.output/server/_libs/micromark-extension-gfm+[...].mjs +2234 -0
- package/.output/server/_libs/next-themes.mjs +124 -0
- package/.output/server/_libs/pierre__theme.mjs +10 -0
- package/.output/server/_libs/radix-ui__primitive.mjs +9 -0
- package/.output/server/_libs/radix-ui__react-compose-refs.mjs +30 -0
- package/.output/server/_libs/radix-ui__react-context.mjs +88 -0
- package/.output/server/_libs/react-markdown+[...].mjs +2316 -0
- package/.output/server/_libs/remark-gfm.mjs +34 -0
- package/.output/server/_libs/shiki.mjs +16 -0
- package/.output/server/_libs/shikijs__langs.mjs +1355 -0
- package/.output/server/_libs/shikijs__themes.mjs +262 -0
- package/.output/server/_libs/sonner.mjs +908 -0
- package/.output/server/_libs/sugar-high.mjs +1036 -0
- package/.output/server/_libs/tailwind-merge.mjs +1962 -0
- package/.output/server/_libs/tanstack__history.mjs +342 -0
- package/.output/server/_libs/tanstack__pacer.mjs +1111 -0
- package/.output/server/_libs/tanstack__query-core.mjs +2202 -0
- package/.output/server/_libs/tanstack__react-hotkeys.mjs +152 -0
- package/.output/server/_libs/tanstack__react-query.mjs +180 -0
- package/.output/server/_libs/tanstack__react-store.mjs +39 -0
- package/.output/server/_libs/tanstack__router-core.mjs +6 -0
- package/.output/server/_libs/tanstack__store.mjs +28 -0
- package/.output/server/_libs/ufo.mjs +64 -0
- package/.output/server/_libs/unctx.mjs +82 -0
- package/.output/server/_libs/ungap__structured-clone.mjs +197 -0
- package/.output/server/_libs/vaul.mjs +1250 -0
- package/.output/server/_libs/zod.mjs +3341 -0
- package/.output/server/_runtime.mjs +35 -0
- package/.output/server/_ssr/router-Bz70uQ0p.mjs +7231 -0
- package/.output/server/_ssr/routes-C7oV8l68.mjs +21622 -0
- package/.output/server/_ssr/routes-DGvt0TQ-.mjs +1275 -0
- package/.output/server/_ssr/ssr.mjs +5176 -0
- package/.output/server/_ssr/start-C9AjCGlr.mjs +4 -0
- package/.output/server/_tanstack-start-manifest_v-D0yEuwRY.mjs +65 -0
- package/.output/server/index.mjs +2563 -0
- package/.output/server/node_modules/tslib/modules/index.js +70 -0
- package/.output/server/node_modules/tslib/modules/package.json +3 -0
- package/.output/server/node_modules/tslib/package.json +47 -0
- package/.output/server/node_modules/tslib/tslib.js +484 -0
- package/.output/server/package.json +9 -0
- package/LICENSE +8 -0
- package/README.md +111 -0
- package/bin/pico.mjs +206 -0
- package/package.json +105 -0
- package/public/screenshots/pico-workspace-alt.png +0 -0
- package/public/screenshots/pico-workspace.png +0 -0
- package/scripts/patch-react-jsx-dev-runtime.mjs +93 -0
|
@@ -0,0 +1,1250 @@
|
|
|
1
|
+
import { i as __toESM } from "../_runtime.mjs";
|
|
2
|
+
import { X as require_react } from "./@base-ui/react+[...].mjs";
|
|
3
|
+
import { a as Portal$1, c as Trigger, i as Overlay$1, n as Content$1, o as Root$1, r as Description, s as Title, t as Close } from "./@radix-ui/react-dialog+[...].mjs";
|
|
4
|
+
//#region node_modules/.pnpm/vaul@1.1.2_@types+react-dom@19.2.3_@types+react@19.2.14__@types+react@19.2.14_react-dom_d9bfd38a4ee4f41de100e4d447baf4a5/node_modules/vaul/dist/index.mjs
|
|
5
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
6
|
+
function __insertCSS(code) {
|
|
7
|
+
if (!code || typeof document == "undefined") return;
|
|
8
|
+
let head = document.head || document.getElementsByTagName("head")[0];
|
|
9
|
+
let style = document.createElement("style");
|
|
10
|
+
style.type = "text/css";
|
|
11
|
+
head.appendChild(style);
|
|
12
|
+
style.styleSheet ? style.styleSheet.cssText = code : style.appendChild(document.createTextNode(code));
|
|
13
|
+
}
|
|
14
|
+
var DrawerContext = import_react.createContext({
|
|
15
|
+
drawerRef: { current: null },
|
|
16
|
+
overlayRef: { current: null },
|
|
17
|
+
onPress: () => {},
|
|
18
|
+
onRelease: () => {},
|
|
19
|
+
onDrag: () => {},
|
|
20
|
+
onNestedDrag: () => {},
|
|
21
|
+
onNestedOpenChange: () => {},
|
|
22
|
+
onNestedRelease: () => {},
|
|
23
|
+
openProp: void 0,
|
|
24
|
+
dismissible: false,
|
|
25
|
+
isOpen: false,
|
|
26
|
+
isDragging: false,
|
|
27
|
+
keyboardIsOpen: { current: false },
|
|
28
|
+
snapPointsOffset: null,
|
|
29
|
+
snapPoints: null,
|
|
30
|
+
handleOnly: false,
|
|
31
|
+
modal: false,
|
|
32
|
+
shouldFade: false,
|
|
33
|
+
activeSnapPoint: null,
|
|
34
|
+
onOpenChange: () => {},
|
|
35
|
+
setActiveSnapPoint: () => {},
|
|
36
|
+
closeDrawer: () => {},
|
|
37
|
+
direction: "bottom",
|
|
38
|
+
shouldAnimate: { current: true },
|
|
39
|
+
shouldScaleBackground: false,
|
|
40
|
+
setBackgroundColorOnScale: true,
|
|
41
|
+
noBodyStyles: false,
|
|
42
|
+
container: null,
|
|
43
|
+
autoFocus: false
|
|
44
|
+
});
|
|
45
|
+
var useDrawerContext = () => {
|
|
46
|
+
const context = import_react.useContext(DrawerContext);
|
|
47
|
+
if (!context) throw new Error("useDrawerContext must be used within a Drawer.Root");
|
|
48
|
+
return context;
|
|
49
|
+
};
|
|
50
|
+
__insertCSS("[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\n[data-state=closed]\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}");
|
|
51
|
+
function isMobileFirefox() {
|
|
52
|
+
const userAgent = navigator.userAgent;
|
|
53
|
+
return typeof window !== "undefined" && (/Firefox/.test(userAgent) && /Mobile/.test(userAgent) || /FxiOS/.test(userAgent));
|
|
54
|
+
}
|
|
55
|
+
function isMac() {
|
|
56
|
+
return testPlatform(/^Mac/);
|
|
57
|
+
}
|
|
58
|
+
function isIPhone() {
|
|
59
|
+
return testPlatform(/^iPhone/);
|
|
60
|
+
}
|
|
61
|
+
function isSafari() {
|
|
62
|
+
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
63
|
+
}
|
|
64
|
+
function isIPad() {
|
|
65
|
+
return testPlatform(/^iPad/) || isMac() && navigator.maxTouchPoints > 1;
|
|
66
|
+
}
|
|
67
|
+
function isIOS() {
|
|
68
|
+
return isIPhone() || isIPad();
|
|
69
|
+
}
|
|
70
|
+
function testPlatform(re) {
|
|
71
|
+
return typeof window !== "undefined" && window.navigator != null ? re.test(window.navigator.platform) : void 0;
|
|
72
|
+
}
|
|
73
|
+
var KEYBOARD_BUFFER = 24;
|
|
74
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react.useLayoutEffect : import_react.useEffect;
|
|
75
|
+
function chain$1(...callbacks) {
|
|
76
|
+
return (...args) => {
|
|
77
|
+
for (let callback of callbacks) if (typeof callback === "function") callback(...args);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
var visualViewport = typeof document !== "undefined" && window.visualViewport;
|
|
81
|
+
function isScrollable(node) {
|
|
82
|
+
let style = window.getComputedStyle(node);
|
|
83
|
+
return /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
|
|
84
|
+
}
|
|
85
|
+
function getScrollParent(node) {
|
|
86
|
+
if (isScrollable(node)) node = node.parentElement;
|
|
87
|
+
while (node && !isScrollable(node)) node = node.parentElement;
|
|
88
|
+
return node || document.scrollingElement || document.documentElement;
|
|
89
|
+
}
|
|
90
|
+
var nonTextInputTypes = new Set([
|
|
91
|
+
"checkbox",
|
|
92
|
+
"radio",
|
|
93
|
+
"range",
|
|
94
|
+
"color",
|
|
95
|
+
"file",
|
|
96
|
+
"image",
|
|
97
|
+
"button",
|
|
98
|
+
"submit",
|
|
99
|
+
"reset"
|
|
100
|
+
]);
|
|
101
|
+
var preventScrollCount = 0;
|
|
102
|
+
var restore;
|
|
103
|
+
/**
|
|
104
|
+
* Prevents scrolling on the document body on mount, and
|
|
105
|
+
* restores it on unmount. Also ensures that content does not
|
|
106
|
+
* shift due to the scrollbars disappearing.
|
|
107
|
+
*/ function usePreventScroll(options = {}) {
|
|
108
|
+
let { isDisabled } = options;
|
|
109
|
+
useIsomorphicLayoutEffect(() => {
|
|
110
|
+
if (isDisabled) return;
|
|
111
|
+
preventScrollCount++;
|
|
112
|
+
if (preventScrollCount === 1) {
|
|
113
|
+
if (isIOS()) restore = preventScrollMobileSafari();
|
|
114
|
+
}
|
|
115
|
+
return () => {
|
|
116
|
+
preventScrollCount--;
|
|
117
|
+
if (preventScrollCount === 0) restore?.();
|
|
118
|
+
};
|
|
119
|
+
}, [isDisabled]);
|
|
120
|
+
}
|
|
121
|
+
function preventScrollMobileSafari() {
|
|
122
|
+
let scrollable;
|
|
123
|
+
let lastY = 0;
|
|
124
|
+
let onTouchStart = (e) => {
|
|
125
|
+
scrollable = getScrollParent(e.target);
|
|
126
|
+
if (scrollable === document.documentElement && scrollable === document.body) return;
|
|
127
|
+
lastY = e.changedTouches[0].pageY;
|
|
128
|
+
};
|
|
129
|
+
let onTouchMove = (e) => {
|
|
130
|
+
if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
let y = e.changedTouches[0].pageY;
|
|
135
|
+
let scrollTop = scrollable.scrollTop;
|
|
136
|
+
let bottom = scrollable.scrollHeight - scrollable.clientHeight;
|
|
137
|
+
if (bottom === 0) return;
|
|
138
|
+
if (scrollTop <= 0 && y > lastY || scrollTop >= bottom && y < lastY) e.preventDefault();
|
|
139
|
+
lastY = y;
|
|
140
|
+
};
|
|
141
|
+
let onTouchEnd = (e) => {
|
|
142
|
+
let target = e.target;
|
|
143
|
+
if (isInput(target) && target !== document.activeElement) {
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
target.style.transform = "translateY(-2000px)";
|
|
146
|
+
target.focus();
|
|
147
|
+
requestAnimationFrame(() => {
|
|
148
|
+
target.style.transform = "";
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
let onFocus = (e) => {
|
|
153
|
+
let target = e.target;
|
|
154
|
+
if (isInput(target)) {
|
|
155
|
+
target.style.transform = "translateY(-2000px)";
|
|
156
|
+
requestAnimationFrame(() => {
|
|
157
|
+
target.style.transform = "";
|
|
158
|
+
if (visualViewport) if (visualViewport.height < window.innerHeight) requestAnimationFrame(() => {
|
|
159
|
+
scrollIntoView(target);
|
|
160
|
+
});
|
|
161
|
+
else visualViewport.addEventListener("resize", () => scrollIntoView(target), { once: true });
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
let onWindowScroll = () => {
|
|
166
|
+
window.scrollTo(0, 0);
|
|
167
|
+
};
|
|
168
|
+
let scrollX = window.pageXOffset;
|
|
169
|
+
let scrollY = window.pageYOffset;
|
|
170
|
+
let restoreStyles = chain$1(setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`));
|
|
171
|
+
window.scrollTo(0, 0);
|
|
172
|
+
let removeEvents = chain$1(addEvent(document, "touchstart", onTouchStart, {
|
|
173
|
+
passive: false,
|
|
174
|
+
capture: true
|
|
175
|
+
}), addEvent(document, "touchmove", onTouchMove, {
|
|
176
|
+
passive: false,
|
|
177
|
+
capture: true
|
|
178
|
+
}), addEvent(document, "touchend", onTouchEnd, {
|
|
179
|
+
passive: false,
|
|
180
|
+
capture: true
|
|
181
|
+
}), addEvent(document, "focus", onFocus, true), addEvent(window, "scroll", onWindowScroll));
|
|
182
|
+
return () => {
|
|
183
|
+
restoreStyles();
|
|
184
|
+
removeEvents();
|
|
185
|
+
window.scrollTo(scrollX, scrollY);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function setStyle(element, style, value) {
|
|
189
|
+
let cur = element.style[style];
|
|
190
|
+
element.style[style] = value;
|
|
191
|
+
return () => {
|
|
192
|
+
element.style[style] = cur;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function addEvent(target, event, handler, options) {
|
|
196
|
+
target.addEventListener(event, handler, options);
|
|
197
|
+
return () => {
|
|
198
|
+
target.removeEventListener(event, handler, options);
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function scrollIntoView(target) {
|
|
202
|
+
let root = document.scrollingElement || document.documentElement;
|
|
203
|
+
while (target && target !== root) {
|
|
204
|
+
let scrollable = getScrollParent(target);
|
|
205
|
+
if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== target) {
|
|
206
|
+
let scrollableTop = scrollable.getBoundingClientRect().top;
|
|
207
|
+
let targetTop = target.getBoundingClientRect().top;
|
|
208
|
+
if (target.getBoundingClientRect().bottom > scrollable.getBoundingClientRect().bottom + KEYBOARD_BUFFER) scrollable.scrollTop += targetTop - scrollableTop;
|
|
209
|
+
}
|
|
210
|
+
target = scrollable.parentElement;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function isInput(target) {
|
|
214
|
+
return target instanceof HTMLInputElement && !nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Set a given ref to a given value
|
|
218
|
+
* This utility takes care of different types of refs: callback refs and RefObject(s)
|
|
219
|
+
*/ function setRef(ref, value) {
|
|
220
|
+
if (typeof ref === "function") ref(value);
|
|
221
|
+
else if (ref !== null && ref !== void 0) ref.current = value;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* A utility to compose multiple refs together
|
|
225
|
+
* Accepts callback refs and RefObject(s)
|
|
226
|
+
*/ function composeRefs(...refs) {
|
|
227
|
+
return (node) => refs.forEach((ref) => setRef(ref, node));
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* A custom hook that composes multiple refs
|
|
231
|
+
* Accepts callback refs and RefObject(s)
|
|
232
|
+
*/ function useComposedRefs(...refs) {
|
|
233
|
+
return import_react.useCallback(composeRefs(...refs), refs);
|
|
234
|
+
}
|
|
235
|
+
var cache = /* @__PURE__ */ new WeakMap();
|
|
236
|
+
function set(el, styles, ignoreCache = false) {
|
|
237
|
+
if (!el || !(el instanceof HTMLElement)) return;
|
|
238
|
+
let originalStyles = {};
|
|
239
|
+
Object.entries(styles).forEach(([key, value]) => {
|
|
240
|
+
if (key.startsWith("--")) {
|
|
241
|
+
el.style.setProperty(key, value);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
originalStyles[key] = el.style[key];
|
|
245
|
+
el.style[key] = value;
|
|
246
|
+
});
|
|
247
|
+
if (ignoreCache) return;
|
|
248
|
+
cache.set(el, originalStyles);
|
|
249
|
+
}
|
|
250
|
+
function reset(el, prop) {
|
|
251
|
+
if (!el || !(el instanceof HTMLElement)) return;
|
|
252
|
+
let originalStyles = cache.get(el);
|
|
253
|
+
if (!originalStyles) return;
|
|
254
|
+
el.style[prop] = originalStyles[prop];
|
|
255
|
+
}
|
|
256
|
+
var isVertical = (direction) => {
|
|
257
|
+
switch (direction) {
|
|
258
|
+
case "top":
|
|
259
|
+
case "bottom": return true;
|
|
260
|
+
case "left":
|
|
261
|
+
case "right": return false;
|
|
262
|
+
default: return direction;
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
function getTranslate(element, direction) {
|
|
266
|
+
if (!element) return null;
|
|
267
|
+
const style = window.getComputedStyle(element);
|
|
268
|
+
const transform = style.transform || style.webkitTransform || style.mozTransform;
|
|
269
|
+
let mat = transform.match(/^matrix3d\((.+)\)$/);
|
|
270
|
+
if (mat) return parseFloat(mat[1].split(", ")[isVertical(direction) ? 13 : 12]);
|
|
271
|
+
mat = transform.match(/^matrix\((.+)\)$/);
|
|
272
|
+
return mat ? parseFloat(mat[1].split(", ")[isVertical(direction) ? 5 : 4]) : null;
|
|
273
|
+
}
|
|
274
|
+
function dampenValue(v) {
|
|
275
|
+
return 8 * (Math.log(v + 1) - 2);
|
|
276
|
+
}
|
|
277
|
+
function assignStyle(element, style) {
|
|
278
|
+
if (!element) return () => {};
|
|
279
|
+
const prevStyle = element.style.cssText;
|
|
280
|
+
Object.assign(element.style, style);
|
|
281
|
+
return () => {
|
|
282
|
+
element.style.cssText = prevStyle;
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Receives functions as arguments and returns a new function that calls all.
|
|
287
|
+
*/ function chain(...fns) {
|
|
288
|
+
return (...args) => {
|
|
289
|
+
for (const fn of fns) if (typeof fn === "function") fn(...args);
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
var TRANSITIONS = {
|
|
293
|
+
DURATION: .5,
|
|
294
|
+
EASE: [
|
|
295
|
+
.32,
|
|
296
|
+
.72,
|
|
297
|
+
0,
|
|
298
|
+
1
|
|
299
|
+
]
|
|
300
|
+
};
|
|
301
|
+
var VELOCITY_THRESHOLD = .4;
|
|
302
|
+
var CLOSE_THRESHOLD = .25;
|
|
303
|
+
var SCROLL_LOCK_TIMEOUT = 100;
|
|
304
|
+
var BORDER_RADIUS = 8;
|
|
305
|
+
var NESTED_DISPLACEMENT = 16;
|
|
306
|
+
var WINDOW_TOP_OFFSET = 26;
|
|
307
|
+
var DRAG_CLASS = "vaul-dragging";
|
|
308
|
+
function useCallbackRef(callback) {
|
|
309
|
+
const callbackRef = import_react.useRef(callback);
|
|
310
|
+
import_react.useEffect(() => {
|
|
311
|
+
callbackRef.current = callback;
|
|
312
|
+
});
|
|
313
|
+
return import_react.useMemo(() => (...args) => callbackRef.current == null ? void 0 : callbackRef.current.call(callbackRef, ...args), []);
|
|
314
|
+
}
|
|
315
|
+
function useUncontrolledState({ defaultProp, onChange }) {
|
|
316
|
+
const uncontrolledState = import_react.useState(defaultProp);
|
|
317
|
+
const [value] = uncontrolledState;
|
|
318
|
+
const prevValueRef = import_react.useRef(value);
|
|
319
|
+
const handleChange = useCallbackRef(onChange);
|
|
320
|
+
import_react.useEffect(() => {
|
|
321
|
+
if (prevValueRef.current !== value) {
|
|
322
|
+
handleChange(value);
|
|
323
|
+
prevValueRef.current = value;
|
|
324
|
+
}
|
|
325
|
+
}, [
|
|
326
|
+
value,
|
|
327
|
+
prevValueRef,
|
|
328
|
+
handleChange
|
|
329
|
+
]);
|
|
330
|
+
return uncontrolledState;
|
|
331
|
+
}
|
|
332
|
+
function useControllableState({ prop, defaultProp, onChange = () => {} }) {
|
|
333
|
+
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({
|
|
334
|
+
defaultProp,
|
|
335
|
+
onChange
|
|
336
|
+
});
|
|
337
|
+
const isControlled = prop !== void 0;
|
|
338
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
339
|
+
const handleChange = useCallbackRef(onChange);
|
|
340
|
+
return [value, import_react.useCallback((nextValue) => {
|
|
341
|
+
if (isControlled) {
|
|
342
|
+
const value = typeof nextValue === "function" ? nextValue(prop) : nextValue;
|
|
343
|
+
if (value !== prop) handleChange(value);
|
|
344
|
+
} else setUncontrolledProp(nextValue);
|
|
345
|
+
}, [
|
|
346
|
+
isControlled,
|
|
347
|
+
prop,
|
|
348
|
+
setUncontrolledProp,
|
|
349
|
+
handleChange
|
|
350
|
+
])];
|
|
351
|
+
}
|
|
352
|
+
function useSnapPoints({ activeSnapPointProp, setActiveSnapPointProp, snapPoints, drawerRef, overlayRef, fadeFromIndex, onSnapPointChange, direction = "bottom", container, snapToSequentialPoint }) {
|
|
353
|
+
const [activeSnapPoint, setActiveSnapPoint] = useControllableState({
|
|
354
|
+
prop: activeSnapPointProp,
|
|
355
|
+
defaultProp: snapPoints == null ? void 0 : snapPoints[0],
|
|
356
|
+
onChange: setActiveSnapPointProp
|
|
357
|
+
});
|
|
358
|
+
const [windowDimensions, setWindowDimensions] = import_react.useState(typeof window !== "undefined" ? {
|
|
359
|
+
innerWidth: window.innerWidth,
|
|
360
|
+
innerHeight: window.innerHeight
|
|
361
|
+
} : void 0);
|
|
362
|
+
import_react.useEffect(() => {
|
|
363
|
+
function onResize() {
|
|
364
|
+
setWindowDimensions({
|
|
365
|
+
innerWidth: window.innerWidth,
|
|
366
|
+
innerHeight: window.innerHeight
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
window.addEventListener("resize", onResize);
|
|
370
|
+
return () => window.removeEventListener("resize", onResize);
|
|
371
|
+
}, []);
|
|
372
|
+
const isLastSnapPoint = import_react.useMemo(() => activeSnapPoint === (snapPoints == null ? void 0 : snapPoints[snapPoints.length - 1]) || null, [snapPoints, activeSnapPoint]);
|
|
373
|
+
const activeSnapPointIndex = import_react.useMemo(() => {
|
|
374
|
+
var _snapPoints_findIndex;
|
|
375
|
+
return (_snapPoints_findIndex = snapPoints == null ? void 0 : snapPoints.findIndex((snapPoint) => snapPoint === activeSnapPoint)) != null ? _snapPoints_findIndex : null;
|
|
376
|
+
}, [snapPoints, activeSnapPoint]);
|
|
377
|
+
const shouldFade = snapPoints && snapPoints.length > 0 && (fadeFromIndex || fadeFromIndex === 0) && !Number.isNaN(fadeFromIndex) && snapPoints[fadeFromIndex] === activeSnapPoint || !snapPoints;
|
|
378
|
+
const snapPointsOffset = import_react.useMemo(() => {
|
|
379
|
+
const containerSize = container ? {
|
|
380
|
+
width: container.getBoundingClientRect().width,
|
|
381
|
+
height: container.getBoundingClientRect().height
|
|
382
|
+
} : typeof window !== "undefined" ? {
|
|
383
|
+
width: window.innerWidth,
|
|
384
|
+
height: window.innerHeight
|
|
385
|
+
} : {
|
|
386
|
+
width: 0,
|
|
387
|
+
height: 0
|
|
388
|
+
};
|
|
389
|
+
var _snapPoints_map;
|
|
390
|
+
return (_snapPoints_map = snapPoints == null ? void 0 : snapPoints.map((snapPoint) => {
|
|
391
|
+
const isPx = typeof snapPoint === "string";
|
|
392
|
+
let snapPointAsNumber = 0;
|
|
393
|
+
if (isPx) snapPointAsNumber = parseInt(snapPoint, 10);
|
|
394
|
+
if (isVertical(direction)) {
|
|
395
|
+
const height = isPx ? snapPointAsNumber : windowDimensions ? snapPoint * containerSize.height : 0;
|
|
396
|
+
if (windowDimensions) return direction === "bottom" ? containerSize.height - height : -containerSize.height + height;
|
|
397
|
+
return height;
|
|
398
|
+
}
|
|
399
|
+
const width = isPx ? snapPointAsNumber : windowDimensions ? snapPoint * containerSize.width : 0;
|
|
400
|
+
if (windowDimensions) return direction === "right" ? containerSize.width - width : -containerSize.width + width;
|
|
401
|
+
return width;
|
|
402
|
+
})) != null ? _snapPoints_map : [];
|
|
403
|
+
}, [
|
|
404
|
+
snapPoints,
|
|
405
|
+
windowDimensions,
|
|
406
|
+
container
|
|
407
|
+
]);
|
|
408
|
+
const activeSnapPointOffset = import_react.useMemo(() => activeSnapPointIndex !== null ? snapPointsOffset == null ? void 0 : snapPointsOffset[activeSnapPointIndex] : null, [snapPointsOffset, activeSnapPointIndex]);
|
|
409
|
+
const snapToPoint = import_react.useCallback((dimension) => {
|
|
410
|
+
var _snapPointsOffset_findIndex;
|
|
411
|
+
const newSnapPointIndex = (_snapPointsOffset_findIndex = snapPointsOffset == null ? void 0 : snapPointsOffset.findIndex((snapPointDim) => snapPointDim === dimension)) != null ? _snapPointsOffset_findIndex : null;
|
|
412
|
+
onSnapPointChange(newSnapPointIndex);
|
|
413
|
+
set(drawerRef.current, {
|
|
414
|
+
transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`,
|
|
415
|
+
transform: isVertical(direction) ? `translate3d(0, ${dimension}px, 0)` : `translate3d(${dimension}px, 0, 0)`
|
|
416
|
+
});
|
|
417
|
+
if (snapPointsOffset && newSnapPointIndex !== snapPointsOffset.length - 1 && fadeFromIndex !== void 0 && newSnapPointIndex !== fadeFromIndex && newSnapPointIndex < fadeFromIndex) set(overlayRef.current, {
|
|
418
|
+
transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`,
|
|
419
|
+
opacity: "0"
|
|
420
|
+
});
|
|
421
|
+
else set(overlayRef.current, {
|
|
422
|
+
transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`,
|
|
423
|
+
opacity: "1"
|
|
424
|
+
});
|
|
425
|
+
setActiveSnapPoint(snapPoints == null ? void 0 : snapPoints[Math.max(newSnapPointIndex, 0)]);
|
|
426
|
+
}, [
|
|
427
|
+
drawerRef.current,
|
|
428
|
+
snapPoints,
|
|
429
|
+
snapPointsOffset,
|
|
430
|
+
fadeFromIndex,
|
|
431
|
+
overlayRef,
|
|
432
|
+
setActiveSnapPoint
|
|
433
|
+
]);
|
|
434
|
+
import_react.useEffect(() => {
|
|
435
|
+
if (activeSnapPoint || activeSnapPointProp) {
|
|
436
|
+
var _snapPoints_findIndex;
|
|
437
|
+
const newIndex = (_snapPoints_findIndex = snapPoints == null ? void 0 : snapPoints.findIndex((snapPoint) => snapPoint === activeSnapPointProp || snapPoint === activeSnapPoint)) != null ? _snapPoints_findIndex : -1;
|
|
438
|
+
if (snapPointsOffset && newIndex !== -1 && typeof snapPointsOffset[newIndex] === "number") snapToPoint(snapPointsOffset[newIndex]);
|
|
439
|
+
}
|
|
440
|
+
}, [
|
|
441
|
+
activeSnapPoint,
|
|
442
|
+
activeSnapPointProp,
|
|
443
|
+
snapPoints,
|
|
444
|
+
snapPointsOffset,
|
|
445
|
+
snapToPoint
|
|
446
|
+
]);
|
|
447
|
+
function onRelease({ draggedDistance, closeDrawer, velocity, dismissible }) {
|
|
448
|
+
if (fadeFromIndex === void 0) return;
|
|
449
|
+
const currentPosition = direction === "bottom" || direction === "right" ? (activeSnapPointOffset != null ? activeSnapPointOffset : 0) - draggedDistance : (activeSnapPointOffset != null ? activeSnapPointOffset : 0) + draggedDistance;
|
|
450
|
+
const isOverlaySnapPoint = activeSnapPointIndex === fadeFromIndex - 1;
|
|
451
|
+
const isFirst = activeSnapPointIndex === 0;
|
|
452
|
+
const hasDraggedUp = draggedDistance > 0;
|
|
453
|
+
if (isOverlaySnapPoint) set(overlayRef.current, { transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})` });
|
|
454
|
+
if (!snapToSequentialPoint && velocity > 2 && !hasDraggedUp) {
|
|
455
|
+
if (dismissible) closeDrawer();
|
|
456
|
+
else snapToPoint(snapPointsOffset[0]);
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
if (!snapToSequentialPoint && velocity > 2 && hasDraggedUp && snapPointsOffset && snapPoints) {
|
|
460
|
+
snapToPoint(snapPointsOffset[snapPoints.length - 1]);
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
const closestSnapPoint = snapPointsOffset == null ? void 0 : snapPointsOffset.reduce((prev, curr) => {
|
|
464
|
+
if (typeof prev !== "number" || typeof curr !== "number") return prev;
|
|
465
|
+
return Math.abs(curr - currentPosition) < Math.abs(prev - currentPosition) ? curr : prev;
|
|
466
|
+
});
|
|
467
|
+
const dim = isVertical(direction) ? window.innerHeight : window.innerWidth;
|
|
468
|
+
if (velocity > VELOCITY_THRESHOLD && Math.abs(draggedDistance) < dim * .4) {
|
|
469
|
+
const dragDirection = hasDraggedUp ? 1 : -1;
|
|
470
|
+
if (dragDirection > 0 && isLastSnapPoint && snapPoints) {
|
|
471
|
+
snapToPoint(snapPointsOffset[snapPoints.length - 1]);
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
if (isFirst && dragDirection < 0 && dismissible) closeDrawer();
|
|
475
|
+
if (activeSnapPointIndex === null) return;
|
|
476
|
+
snapToPoint(snapPointsOffset[activeSnapPointIndex + dragDirection]);
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
snapToPoint(closestSnapPoint);
|
|
480
|
+
}
|
|
481
|
+
function onDrag({ draggedDistance }) {
|
|
482
|
+
if (activeSnapPointOffset === null) return;
|
|
483
|
+
const newValue = direction === "bottom" || direction === "right" ? activeSnapPointOffset - draggedDistance : activeSnapPointOffset + draggedDistance;
|
|
484
|
+
if ((direction === "bottom" || direction === "right") && newValue < snapPointsOffset[snapPointsOffset.length - 1]) return;
|
|
485
|
+
if ((direction === "top" || direction === "left") && newValue > snapPointsOffset[snapPointsOffset.length - 1]) return;
|
|
486
|
+
set(drawerRef.current, { transform: isVertical(direction) ? `translate3d(0, ${newValue}px, 0)` : `translate3d(${newValue}px, 0, 0)` });
|
|
487
|
+
}
|
|
488
|
+
function getPercentageDragged(absDraggedDistance, isDraggingDown) {
|
|
489
|
+
if (!snapPoints || typeof activeSnapPointIndex !== "number" || !snapPointsOffset || fadeFromIndex === void 0) return null;
|
|
490
|
+
const isOverlaySnapPoint = activeSnapPointIndex === fadeFromIndex - 1;
|
|
491
|
+
if (activeSnapPointIndex >= fadeFromIndex && isDraggingDown) return 0;
|
|
492
|
+
if (isOverlaySnapPoint && !isDraggingDown) return 1;
|
|
493
|
+
if (!shouldFade && !isOverlaySnapPoint) return null;
|
|
494
|
+
const targetSnapPointIndex = isOverlaySnapPoint ? activeSnapPointIndex + 1 : activeSnapPointIndex - 1;
|
|
495
|
+
const snapPointDistance = isOverlaySnapPoint ? snapPointsOffset[targetSnapPointIndex] - snapPointsOffset[targetSnapPointIndex - 1] : snapPointsOffset[targetSnapPointIndex + 1] - snapPointsOffset[targetSnapPointIndex];
|
|
496
|
+
const percentageDragged = absDraggedDistance / Math.abs(snapPointDistance);
|
|
497
|
+
if (isOverlaySnapPoint) return 1 - percentageDragged;
|
|
498
|
+
else return percentageDragged;
|
|
499
|
+
}
|
|
500
|
+
return {
|
|
501
|
+
isLastSnapPoint,
|
|
502
|
+
activeSnapPoint,
|
|
503
|
+
shouldFade,
|
|
504
|
+
getPercentageDragged,
|
|
505
|
+
setActiveSnapPoint,
|
|
506
|
+
activeSnapPointIndex,
|
|
507
|
+
onRelease,
|
|
508
|
+
onDrag,
|
|
509
|
+
snapPointsOffset
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
var noop = () => () => {};
|
|
513
|
+
function useScaleBackground() {
|
|
514
|
+
const { direction, isOpen, shouldScaleBackground, setBackgroundColorOnScale, noBodyStyles } = useDrawerContext();
|
|
515
|
+
const timeoutIdRef = import_react.useRef(null);
|
|
516
|
+
const initialBackgroundColor = (0, import_react.useMemo)(() => document.body.style.backgroundColor, []);
|
|
517
|
+
function getScale() {
|
|
518
|
+
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
519
|
+
}
|
|
520
|
+
import_react.useEffect(() => {
|
|
521
|
+
if (isOpen && shouldScaleBackground) {
|
|
522
|
+
if (timeoutIdRef.current) clearTimeout(timeoutIdRef.current);
|
|
523
|
+
const wrapper = document.querySelector("[data-vaul-drawer-wrapper]") || document.querySelector("[vaul-drawer-wrapper]");
|
|
524
|
+
if (!wrapper) return;
|
|
525
|
+
chain(setBackgroundColorOnScale && !noBodyStyles ? assignStyle(document.body, { background: "black" }) : noop, assignStyle(wrapper, {
|
|
526
|
+
transformOrigin: isVertical(direction) ? "top" : "left",
|
|
527
|
+
transitionProperty: "transform, border-radius",
|
|
528
|
+
transitionDuration: `${TRANSITIONS.DURATION}s`,
|
|
529
|
+
transitionTimingFunction: `cubic-bezier(${TRANSITIONS.EASE.join(",")})`
|
|
530
|
+
}));
|
|
531
|
+
const wrapperStylesCleanup = assignStyle(wrapper, {
|
|
532
|
+
borderRadius: `${BORDER_RADIUS}px`,
|
|
533
|
+
overflow: "hidden",
|
|
534
|
+
...isVertical(direction) ? { transform: `scale(${getScale()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)` } : { transform: `scale(${getScale()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)` }
|
|
535
|
+
});
|
|
536
|
+
return () => {
|
|
537
|
+
wrapperStylesCleanup();
|
|
538
|
+
timeoutIdRef.current = window.setTimeout(() => {
|
|
539
|
+
if (initialBackgroundColor) document.body.style.background = initialBackgroundColor;
|
|
540
|
+
else document.body.style.removeProperty("background");
|
|
541
|
+
}, TRANSITIONS.DURATION * 1e3);
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
}, [
|
|
545
|
+
isOpen,
|
|
546
|
+
shouldScaleBackground,
|
|
547
|
+
initialBackgroundColor
|
|
548
|
+
]);
|
|
549
|
+
}
|
|
550
|
+
var previousBodyPosition = null;
|
|
551
|
+
/**
|
|
552
|
+
* This hook is necessary to prevent buggy behavior on iOS devices (need to test on Android).
|
|
553
|
+
* I won't get into too much detail about what bugs it solves, but so far I've found that setting the body to `position: fixed` is the most reliable way to prevent those bugs.
|
|
554
|
+
* Issues that this hook solves:
|
|
555
|
+
* https://github.com/emilkowalski/vaul/issues/435
|
|
556
|
+
* https://github.com/emilkowalski/vaul/issues/433
|
|
557
|
+
* And more that I discovered, but were just not reported.
|
|
558
|
+
*/ function usePositionFixed({ isOpen, modal, nested, hasBeenOpened, preventScrollRestoration, noBodyStyles }) {
|
|
559
|
+
const [activeUrl, setActiveUrl] = import_react.useState(() => typeof window !== "undefined" ? window.location.href : "");
|
|
560
|
+
const scrollPos = import_react.useRef(0);
|
|
561
|
+
const setPositionFixed = import_react.useCallback(() => {
|
|
562
|
+
if (!isSafari()) return;
|
|
563
|
+
if (previousBodyPosition === null && isOpen && !noBodyStyles) {
|
|
564
|
+
previousBodyPosition = {
|
|
565
|
+
position: document.body.style.position,
|
|
566
|
+
top: document.body.style.top,
|
|
567
|
+
left: document.body.style.left,
|
|
568
|
+
height: document.body.style.height,
|
|
569
|
+
right: "unset"
|
|
570
|
+
};
|
|
571
|
+
const { scrollX, innerHeight } = window;
|
|
572
|
+
document.body.style.setProperty("position", "fixed", "important");
|
|
573
|
+
Object.assign(document.body.style, {
|
|
574
|
+
top: `${-scrollPos.current}px`,
|
|
575
|
+
left: `${-scrollX}px`,
|
|
576
|
+
right: "0px",
|
|
577
|
+
height: "auto"
|
|
578
|
+
});
|
|
579
|
+
window.setTimeout(() => window.requestAnimationFrame(() => {
|
|
580
|
+
const bottomBarHeight = innerHeight - window.innerHeight;
|
|
581
|
+
if (bottomBarHeight && scrollPos.current >= innerHeight) document.body.style.top = `${-(scrollPos.current + bottomBarHeight)}px`;
|
|
582
|
+
}), 300);
|
|
583
|
+
}
|
|
584
|
+
}, [isOpen]);
|
|
585
|
+
const restorePositionSetting = import_react.useCallback(() => {
|
|
586
|
+
if (!isSafari()) return;
|
|
587
|
+
if (previousBodyPosition !== null && !noBodyStyles) {
|
|
588
|
+
const y = -parseInt(document.body.style.top, 10);
|
|
589
|
+
const x = -parseInt(document.body.style.left, 10);
|
|
590
|
+
Object.assign(document.body.style, previousBodyPosition);
|
|
591
|
+
window.requestAnimationFrame(() => {
|
|
592
|
+
if (preventScrollRestoration && activeUrl !== window.location.href) {
|
|
593
|
+
setActiveUrl(window.location.href);
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
window.scrollTo(x, y);
|
|
597
|
+
});
|
|
598
|
+
previousBodyPosition = null;
|
|
599
|
+
}
|
|
600
|
+
}, [activeUrl]);
|
|
601
|
+
import_react.useEffect(() => {
|
|
602
|
+
function onScroll() {
|
|
603
|
+
scrollPos.current = window.scrollY;
|
|
604
|
+
}
|
|
605
|
+
onScroll();
|
|
606
|
+
window.addEventListener("scroll", onScroll);
|
|
607
|
+
return () => {
|
|
608
|
+
window.removeEventListener("scroll", onScroll);
|
|
609
|
+
};
|
|
610
|
+
}, []);
|
|
611
|
+
import_react.useEffect(() => {
|
|
612
|
+
if (!modal) return;
|
|
613
|
+
return () => {
|
|
614
|
+
if (typeof document === "undefined") return;
|
|
615
|
+
if (!!document.querySelector("[data-vaul-drawer]")) return;
|
|
616
|
+
restorePositionSetting();
|
|
617
|
+
};
|
|
618
|
+
}, [modal, restorePositionSetting]);
|
|
619
|
+
import_react.useEffect(() => {
|
|
620
|
+
if (nested || !hasBeenOpened) return;
|
|
621
|
+
if (isOpen) {
|
|
622
|
+
!window.matchMedia("(display-mode: standalone)").matches && setPositionFixed();
|
|
623
|
+
if (!modal) window.setTimeout(() => {
|
|
624
|
+
restorePositionSetting();
|
|
625
|
+
}, 500);
|
|
626
|
+
} else restorePositionSetting();
|
|
627
|
+
}, [
|
|
628
|
+
isOpen,
|
|
629
|
+
hasBeenOpened,
|
|
630
|
+
activeUrl,
|
|
631
|
+
modal,
|
|
632
|
+
nested,
|
|
633
|
+
setPositionFixed,
|
|
634
|
+
restorePositionSetting
|
|
635
|
+
]);
|
|
636
|
+
return { restorePositionSetting };
|
|
637
|
+
}
|
|
638
|
+
function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRelease: onReleaseProp, snapPoints, shouldScaleBackground = false, setBackgroundColorOnScale = true, closeThreshold = CLOSE_THRESHOLD, scrollLockTimeout = SCROLL_LOCK_TIMEOUT, dismissible = true, handleOnly = false, fadeFromIndex = snapPoints && snapPoints.length - 1, activeSnapPoint: activeSnapPointProp, setActiveSnapPoint: setActiveSnapPointProp, fixed, modal = true, onClose, nested, noBodyStyles = false, direction = "bottom", defaultOpen = false, disablePreventScroll = true, snapToSequentialPoint = false, preventScrollRestoration = false, repositionInputs = true, onAnimationEnd, container, autoFocus = false }) {
|
|
639
|
+
var _drawerRef_current, _drawerRef_current1;
|
|
640
|
+
const [isOpen = false, setIsOpen] = useControllableState({
|
|
641
|
+
defaultProp: defaultOpen,
|
|
642
|
+
prop: openProp,
|
|
643
|
+
onChange: (o) => {
|
|
644
|
+
onOpenChange?.(o);
|
|
645
|
+
if (!o && !nested) restorePositionSetting();
|
|
646
|
+
setTimeout(() => {
|
|
647
|
+
onAnimationEnd?.(o);
|
|
648
|
+
}, TRANSITIONS.DURATION * 1e3);
|
|
649
|
+
if (o && !modal) {
|
|
650
|
+
if (typeof window !== "undefined") window.requestAnimationFrame(() => {
|
|
651
|
+
document.body.style.pointerEvents = "auto";
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
if (!o) document.body.style.pointerEvents = "auto";
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
const [hasBeenOpened, setHasBeenOpened] = import_react.useState(false);
|
|
658
|
+
const [isDragging, setIsDragging] = import_react.useState(false);
|
|
659
|
+
const [justReleased, setJustReleased] = import_react.useState(false);
|
|
660
|
+
const overlayRef = import_react.useRef(null);
|
|
661
|
+
const openTime = import_react.useRef(null);
|
|
662
|
+
const dragStartTime = import_react.useRef(null);
|
|
663
|
+
const dragEndTime = import_react.useRef(null);
|
|
664
|
+
const lastTimeDragPrevented = import_react.useRef(null);
|
|
665
|
+
const isAllowedToDrag = import_react.useRef(false);
|
|
666
|
+
const nestedOpenChangeTimer = import_react.useRef(null);
|
|
667
|
+
const pointerStart = import_react.useRef(0);
|
|
668
|
+
const keyboardIsOpen = import_react.useRef(false);
|
|
669
|
+
const shouldAnimate = import_react.useRef(!defaultOpen);
|
|
670
|
+
const previousDiffFromInitial = import_react.useRef(0);
|
|
671
|
+
const drawerRef = import_react.useRef(null);
|
|
672
|
+
const drawerHeightRef = import_react.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);
|
|
673
|
+
const drawerWidthRef = import_react.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);
|
|
674
|
+
const initialDrawerHeight = import_react.useRef(0);
|
|
675
|
+
const { activeSnapPoint, activeSnapPointIndex, setActiveSnapPoint, onRelease: onReleaseSnapPoints, snapPointsOffset, onDrag: onDragSnapPoints, shouldFade, getPercentageDragged: getSnapPointsPercentageDragged } = useSnapPoints({
|
|
676
|
+
snapPoints,
|
|
677
|
+
activeSnapPointProp,
|
|
678
|
+
setActiveSnapPointProp,
|
|
679
|
+
drawerRef,
|
|
680
|
+
fadeFromIndex,
|
|
681
|
+
overlayRef,
|
|
682
|
+
onSnapPointChange: import_react.useCallback((activeSnapPointIndex) => {
|
|
683
|
+
if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = /* @__PURE__ */ new Date();
|
|
684
|
+
}, []),
|
|
685
|
+
direction,
|
|
686
|
+
container,
|
|
687
|
+
snapToSequentialPoint
|
|
688
|
+
});
|
|
689
|
+
usePreventScroll({ isDisabled: !isOpen || isDragging || !modal || justReleased || !hasBeenOpened || !repositionInputs || !disablePreventScroll });
|
|
690
|
+
const { restorePositionSetting } = usePositionFixed({
|
|
691
|
+
isOpen,
|
|
692
|
+
modal,
|
|
693
|
+
nested: nested != null ? nested : false,
|
|
694
|
+
hasBeenOpened,
|
|
695
|
+
preventScrollRestoration,
|
|
696
|
+
noBodyStyles
|
|
697
|
+
});
|
|
698
|
+
function getScale() {
|
|
699
|
+
return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
|
|
700
|
+
}
|
|
701
|
+
function onPress(event) {
|
|
702
|
+
var _drawerRef_current, _drawerRef_current1;
|
|
703
|
+
if (!dismissible && !snapPoints) return;
|
|
704
|
+
if (drawerRef.current && !drawerRef.current.contains(event.target)) return;
|
|
705
|
+
drawerHeightRef.current = ((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0;
|
|
706
|
+
drawerWidthRef.current = ((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0;
|
|
707
|
+
setIsDragging(true);
|
|
708
|
+
dragStartTime.current = /* @__PURE__ */ new Date();
|
|
709
|
+
if (isIOS()) window.addEventListener("touchend", () => isAllowedToDrag.current = false, { once: true });
|
|
710
|
+
event.target.setPointerCapture(event.pointerId);
|
|
711
|
+
pointerStart.current = isVertical(direction) ? event.pageY : event.pageX;
|
|
712
|
+
}
|
|
713
|
+
function shouldDrag(el, isDraggingInDirection) {
|
|
714
|
+
var _window_getSelection;
|
|
715
|
+
let element = el;
|
|
716
|
+
const highlightedText = (_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString();
|
|
717
|
+
const swipeAmount = drawerRef.current ? getTranslate(drawerRef.current, direction) : null;
|
|
718
|
+
const date = /* @__PURE__ */ new Date();
|
|
719
|
+
if (element.tagName === "SELECT") return false;
|
|
720
|
+
if (element.hasAttribute("data-vaul-no-drag") || element.closest("[data-vaul-no-drag]")) return false;
|
|
721
|
+
if (direction === "right" || direction === "left") return true;
|
|
722
|
+
if (openTime.current && date.getTime() - openTime.current.getTime() < 500) return false;
|
|
723
|
+
if (swipeAmount !== null) {
|
|
724
|
+
if (direction === "bottom" ? swipeAmount > 0 : swipeAmount < 0) return true;
|
|
725
|
+
}
|
|
726
|
+
if (highlightedText && highlightedText.length > 0) return false;
|
|
727
|
+
if (lastTimeDragPrevented.current && date.getTime() - lastTimeDragPrevented.current.getTime() < scrollLockTimeout && swipeAmount === 0) {
|
|
728
|
+
lastTimeDragPrevented.current = date;
|
|
729
|
+
return false;
|
|
730
|
+
}
|
|
731
|
+
if (isDraggingInDirection) {
|
|
732
|
+
lastTimeDragPrevented.current = date;
|
|
733
|
+
return false;
|
|
734
|
+
}
|
|
735
|
+
while (element) {
|
|
736
|
+
if (element.scrollHeight > element.clientHeight) {
|
|
737
|
+
if (element.scrollTop !== 0) {
|
|
738
|
+
lastTimeDragPrevented.current = /* @__PURE__ */ new Date();
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
if (element.getAttribute("role") === "dialog") return true;
|
|
742
|
+
}
|
|
743
|
+
element = element.parentNode;
|
|
744
|
+
}
|
|
745
|
+
return true;
|
|
746
|
+
}
|
|
747
|
+
function onDrag(event) {
|
|
748
|
+
if (!drawerRef.current) return;
|
|
749
|
+
if (isDragging) {
|
|
750
|
+
const directionMultiplier = direction === "bottom" || direction === "right" ? 1 : -1;
|
|
751
|
+
const draggedDistance = (pointerStart.current - (isVertical(direction) ? event.pageY : event.pageX)) * directionMultiplier;
|
|
752
|
+
const isDraggingInDirection = draggedDistance > 0;
|
|
753
|
+
const noCloseSnapPointsPreCondition = snapPoints && !dismissible && !isDraggingInDirection;
|
|
754
|
+
if (noCloseSnapPointsPreCondition && activeSnapPointIndex === 0) return;
|
|
755
|
+
const absDraggedDistance = Math.abs(draggedDistance);
|
|
756
|
+
const wrapper = document.querySelector("[data-vaul-drawer-wrapper]");
|
|
757
|
+
let percentageDragged = absDraggedDistance / (direction === "bottom" || direction === "top" ? drawerHeightRef.current : drawerWidthRef.current);
|
|
758
|
+
const snapPointPercentageDragged = getSnapPointsPercentageDragged(absDraggedDistance, isDraggingInDirection);
|
|
759
|
+
if (snapPointPercentageDragged !== null) percentageDragged = snapPointPercentageDragged;
|
|
760
|
+
if (noCloseSnapPointsPreCondition && percentageDragged >= 1) return;
|
|
761
|
+
if (!isAllowedToDrag.current && !shouldDrag(event.target, isDraggingInDirection)) return;
|
|
762
|
+
drawerRef.current.classList.add(DRAG_CLASS);
|
|
763
|
+
isAllowedToDrag.current = true;
|
|
764
|
+
set(drawerRef.current, { transition: "none" });
|
|
765
|
+
set(overlayRef.current, { transition: "none" });
|
|
766
|
+
if (snapPoints) onDragSnapPoints({ draggedDistance });
|
|
767
|
+
if (isDraggingInDirection && !snapPoints) {
|
|
768
|
+
const dampenedDraggedDistance = dampenValue(draggedDistance);
|
|
769
|
+
const translateValue = Math.min(dampenedDraggedDistance * -1, 0) * directionMultiplier;
|
|
770
|
+
set(drawerRef.current, { transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)` });
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
const opacityValue = 1 - percentageDragged;
|
|
774
|
+
if (shouldFade || fadeFromIndex && activeSnapPointIndex === fadeFromIndex - 1) {
|
|
775
|
+
onDragProp?.(event, percentageDragged);
|
|
776
|
+
set(overlayRef.current, {
|
|
777
|
+
opacity: `${opacityValue}`,
|
|
778
|
+
transition: "none"
|
|
779
|
+
}, true);
|
|
780
|
+
}
|
|
781
|
+
if (wrapper && overlayRef.current && shouldScaleBackground) {
|
|
782
|
+
const scaleValue = Math.min(getScale() + percentageDragged * (1 - getScale()), 1);
|
|
783
|
+
const borderRadiusValue = 8 - percentageDragged * 8;
|
|
784
|
+
const translateValue = Math.max(0, 14 - percentageDragged * 14);
|
|
785
|
+
set(wrapper, {
|
|
786
|
+
borderRadius: `${borderRadiusValue}px`,
|
|
787
|
+
transform: isVertical(direction) ? `scale(${scaleValue}) translate3d(0, ${translateValue}px, 0)` : `scale(${scaleValue}) translate3d(${translateValue}px, 0, 0)`,
|
|
788
|
+
transition: "none"
|
|
789
|
+
}, true);
|
|
790
|
+
}
|
|
791
|
+
if (!snapPoints) {
|
|
792
|
+
const translateValue = absDraggedDistance * directionMultiplier;
|
|
793
|
+
set(drawerRef.current, { transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)` });
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
import_react.useEffect(() => {
|
|
798
|
+
window.requestAnimationFrame(() => {
|
|
799
|
+
shouldAnimate.current = true;
|
|
800
|
+
});
|
|
801
|
+
}, []);
|
|
802
|
+
import_react.useEffect(() => {
|
|
803
|
+
var _window_visualViewport;
|
|
804
|
+
function onVisualViewportChange() {
|
|
805
|
+
if (!drawerRef.current || !repositionInputs) return;
|
|
806
|
+
const focusedElement = document.activeElement;
|
|
807
|
+
if (isInput(focusedElement) || keyboardIsOpen.current) {
|
|
808
|
+
var _window_visualViewport;
|
|
809
|
+
const visualViewportHeight = ((_window_visualViewport = window.visualViewport) == null ? void 0 : _window_visualViewport.height) || 0;
|
|
810
|
+
const totalHeight = window.innerHeight;
|
|
811
|
+
let diffFromInitial = totalHeight - visualViewportHeight;
|
|
812
|
+
const drawerHeight = drawerRef.current.getBoundingClientRect().height || 0;
|
|
813
|
+
const isTallEnough = drawerHeight > totalHeight * .8;
|
|
814
|
+
if (!initialDrawerHeight.current) initialDrawerHeight.current = drawerHeight;
|
|
815
|
+
const offsetFromTop = drawerRef.current.getBoundingClientRect().top;
|
|
816
|
+
if (Math.abs(previousDiffFromInitial.current - diffFromInitial) > 60) keyboardIsOpen.current = !keyboardIsOpen.current;
|
|
817
|
+
if (snapPoints && snapPoints.length > 0 && snapPointsOffset && activeSnapPointIndex) {
|
|
818
|
+
const activeSnapPointHeight = snapPointsOffset[activeSnapPointIndex] || 0;
|
|
819
|
+
diffFromInitial += activeSnapPointHeight;
|
|
820
|
+
}
|
|
821
|
+
previousDiffFromInitial.current = diffFromInitial;
|
|
822
|
+
if (drawerHeight > visualViewportHeight || keyboardIsOpen.current) {
|
|
823
|
+
const height = drawerRef.current.getBoundingClientRect().height;
|
|
824
|
+
let newDrawerHeight = height;
|
|
825
|
+
if (height > visualViewportHeight) newDrawerHeight = visualViewportHeight - (isTallEnough ? offsetFromTop : WINDOW_TOP_OFFSET);
|
|
826
|
+
if (fixed) drawerRef.current.style.height = `${height - Math.max(diffFromInitial, 0)}px`;
|
|
827
|
+
else drawerRef.current.style.height = `${Math.max(newDrawerHeight, visualViewportHeight - offsetFromTop)}px`;
|
|
828
|
+
} else if (!isMobileFirefox()) drawerRef.current.style.height = `${initialDrawerHeight.current}px`;
|
|
829
|
+
if (snapPoints && snapPoints.length > 0 && !keyboardIsOpen.current) drawerRef.current.style.bottom = `0px`;
|
|
830
|
+
else drawerRef.current.style.bottom = `${Math.max(diffFromInitial, 0)}px`;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
(_window_visualViewport = window.visualViewport) == null || _window_visualViewport.addEventListener("resize", onVisualViewportChange);
|
|
834
|
+
return () => {
|
|
835
|
+
var _window_visualViewport;
|
|
836
|
+
return (_window_visualViewport = window.visualViewport) == null ? void 0 : _window_visualViewport.removeEventListener("resize", onVisualViewportChange);
|
|
837
|
+
};
|
|
838
|
+
}, [
|
|
839
|
+
activeSnapPointIndex,
|
|
840
|
+
snapPoints,
|
|
841
|
+
snapPointsOffset
|
|
842
|
+
]);
|
|
843
|
+
function closeDrawer(fromWithin) {
|
|
844
|
+
cancelDrag();
|
|
845
|
+
onClose?.();
|
|
846
|
+
if (!fromWithin) setIsOpen(false);
|
|
847
|
+
setTimeout(() => {
|
|
848
|
+
if (snapPoints) setActiveSnapPoint(snapPoints[0]);
|
|
849
|
+
}, TRANSITIONS.DURATION * 1e3);
|
|
850
|
+
}
|
|
851
|
+
function resetDrawer() {
|
|
852
|
+
if (!drawerRef.current) return;
|
|
853
|
+
const wrapper = document.querySelector("[data-vaul-drawer-wrapper]");
|
|
854
|
+
const currentSwipeAmount = getTranslate(drawerRef.current, direction);
|
|
855
|
+
set(drawerRef.current, {
|
|
856
|
+
transform: "translate3d(0, 0, 0)",
|
|
857
|
+
transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`
|
|
858
|
+
});
|
|
859
|
+
set(overlayRef.current, {
|
|
860
|
+
transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`,
|
|
861
|
+
opacity: "1"
|
|
862
|
+
});
|
|
863
|
+
if (shouldScaleBackground && currentSwipeAmount && currentSwipeAmount > 0 && isOpen) set(wrapper, {
|
|
864
|
+
borderRadius: `${BORDER_RADIUS}px`,
|
|
865
|
+
overflow: "hidden",
|
|
866
|
+
...isVertical(direction) ? {
|
|
867
|
+
transform: `scale(${getScale()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,
|
|
868
|
+
transformOrigin: "top"
|
|
869
|
+
} : {
|
|
870
|
+
transform: `scale(${getScale()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,
|
|
871
|
+
transformOrigin: "left"
|
|
872
|
+
},
|
|
873
|
+
transitionProperty: "transform, border-radius",
|
|
874
|
+
transitionDuration: `${TRANSITIONS.DURATION}s`,
|
|
875
|
+
transitionTimingFunction: `cubic-bezier(${TRANSITIONS.EASE.join(",")})`
|
|
876
|
+
}, true);
|
|
877
|
+
}
|
|
878
|
+
function cancelDrag() {
|
|
879
|
+
if (!isDragging || !drawerRef.current) return;
|
|
880
|
+
drawerRef.current.classList.remove(DRAG_CLASS);
|
|
881
|
+
isAllowedToDrag.current = false;
|
|
882
|
+
setIsDragging(false);
|
|
883
|
+
dragEndTime.current = /* @__PURE__ */ new Date();
|
|
884
|
+
}
|
|
885
|
+
function onRelease(event) {
|
|
886
|
+
if (!isDragging || !drawerRef.current) return;
|
|
887
|
+
drawerRef.current.classList.remove(DRAG_CLASS);
|
|
888
|
+
isAllowedToDrag.current = false;
|
|
889
|
+
setIsDragging(false);
|
|
890
|
+
dragEndTime.current = /* @__PURE__ */ new Date();
|
|
891
|
+
const swipeAmount = getTranslate(drawerRef.current, direction);
|
|
892
|
+
if (!event || !shouldDrag(event.target, false) || !swipeAmount || Number.isNaN(swipeAmount)) return;
|
|
893
|
+
if (dragStartTime.current === null) return;
|
|
894
|
+
const timeTaken = dragEndTime.current.getTime() - dragStartTime.current.getTime();
|
|
895
|
+
const distMoved = pointerStart.current - (isVertical(direction) ? event.pageY : event.pageX);
|
|
896
|
+
const velocity = Math.abs(distMoved) / timeTaken;
|
|
897
|
+
if (velocity > .05) {
|
|
898
|
+
setJustReleased(true);
|
|
899
|
+
setTimeout(() => {
|
|
900
|
+
setJustReleased(false);
|
|
901
|
+
}, 200);
|
|
902
|
+
}
|
|
903
|
+
if (snapPoints) {
|
|
904
|
+
onReleaseSnapPoints({
|
|
905
|
+
draggedDistance: distMoved * (direction === "bottom" || direction === "right" ? 1 : -1),
|
|
906
|
+
closeDrawer,
|
|
907
|
+
velocity,
|
|
908
|
+
dismissible
|
|
909
|
+
});
|
|
910
|
+
onReleaseProp?.(event, true);
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
if (direction === "bottom" || direction === "right" ? distMoved > 0 : distMoved < 0) {
|
|
914
|
+
resetDrawer();
|
|
915
|
+
onReleaseProp?.(event, true);
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
if (velocity > VELOCITY_THRESHOLD) {
|
|
919
|
+
closeDrawer();
|
|
920
|
+
onReleaseProp?.(event, false);
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
var _drawerRef_current_getBoundingClientRect_height;
|
|
924
|
+
const visibleDrawerHeight = Math.min((_drawerRef_current_getBoundingClientRect_height = drawerRef.current.getBoundingClientRect().height) != null ? _drawerRef_current_getBoundingClientRect_height : 0, window.innerHeight);
|
|
925
|
+
var _drawerRef_current_getBoundingClientRect_width;
|
|
926
|
+
const visibleDrawerWidth = Math.min((_drawerRef_current_getBoundingClientRect_width = drawerRef.current.getBoundingClientRect().width) != null ? _drawerRef_current_getBoundingClientRect_width : 0, window.innerWidth);
|
|
927
|
+
if (Math.abs(swipeAmount) >= (direction === "left" || direction === "right" ? visibleDrawerWidth : visibleDrawerHeight) * closeThreshold) {
|
|
928
|
+
closeDrawer();
|
|
929
|
+
onReleaseProp?.(event, false);
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
onReleaseProp?.(event, true);
|
|
933
|
+
resetDrawer();
|
|
934
|
+
}
|
|
935
|
+
import_react.useEffect(() => {
|
|
936
|
+
if (isOpen) {
|
|
937
|
+
set(document.documentElement, { scrollBehavior: "auto" });
|
|
938
|
+
openTime.current = /* @__PURE__ */ new Date();
|
|
939
|
+
}
|
|
940
|
+
return () => {
|
|
941
|
+
reset(document.documentElement, "scrollBehavior");
|
|
942
|
+
};
|
|
943
|
+
}, [isOpen]);
|
|
944
|
+
function onNestedOpenChange(o) {
|
|
945
|
+
const scale = o ? (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth : 1;
|
|
946
|
+
const initialTranslate = o ? -NESTED_DISPLACEMENT : 0;
|
|
947
|
+
if (nestedOpenChangeTimer.current) window.clearTimeout(nestedOpenChangeTimer.current);
|
|
948
|
+
set(drawerRef.current, {
|
|
949
|
+
transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`,
|
|
950
|
+
transform: isVertical(direction) ? `scale(${scale}) translate3d(0, ${initialTranslate}px, 0)` : `scale(${scale}) translate3d(${initialTranslate}px, 0, 0)`
|
|
951
|
+
});
|
|
952
|
+
if (!o && drawerRef.current) nestedOpenChangeTimer.current = setTimeout(() => {
|
|
953
|
+
const translateValue = getTranslate(drawerRef.current, direction);
|
|
954
|
+
set(drawerRef.current, {
|
|
955
|
+
transition: "none",
|
|
956
|
+
transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)`
|
|
957
|
+
});
|
|
958
|
+
}, 500);
|
|
959
|
+
}
|
|
960
|
+
function onNestedDrag(_event, percentageDragged) {
|
|
961
|
+
if (percentageDragged < 0) return;
|
|
962
|
+
const initialScale = (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth;
|
|
963
|
+
const newScale = initialScale + percentageDragged * (1 - initialScale);
|
|
964
|
+
const newTranslate = -NESTED_DISPLACEMENT + percentageDragged * NESTED_DISPLACEMENT;
|
|
965
|
+
set(drawerRef.current, {
|
|
966
|
+
transform: isVertical(direction) ? `scale(${newScale}) translate3d(0, ${newTranslate}px, 0)` : `scale(${newScale}) translate3d(${newTranslate}px, 0, 0)`,
|
|
967
|
+
transition: "none"
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
function onNestedRelease(_event, o) {
|
|
971
|
+
const dim = isVertical(direction) ? window.innerHeight : window.innerWidth;
|
|
972
|
+
const scale = o ? (dim - NESTED_DISPLACEMENT) / dim : 1;
|
|
973
|
+
const translate = o ? -NESTED_DISPLACEMENT : 0;
|
|
974
|
+
if (o) set(drawerRef.current, {
|
|
975
|
+
transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(",")})`,
|
|
976
|
+
transform: isVertical(direction) ? `scale(${scale}) translate3d(0, ${translate}px, 0)` : `scale(${scale}) translate3d(${translate}px, 0, 0)`
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
import_react.useEffect(() => {
|
|
980
|
+
if (!modal) window.requestAnimationFrame(() => {
|
|
981
|
+
document.body.style.pointerEvents = "auto";
|
|
982
|
+
});
|
|
983
|
+
}, [modal]);
|
|
984
|
+
return /* @__PURE__ */ import_react.createElement(Root$1, {
|
|
985
|
+
defaultOpen,
|
|
986
|
+
onOpenChange: (open) => {
|
|
987
|
+
if (!dismissible && !open) return;
|
|
988
|
+
if (open) setHasBeenOpened(true);
|
|
989
|
+
else closeDrawer(true);
|
|
990
|
+
setIsOpen(open);
|
|
991
|
+
},
|
|
992
|
+
open: isOpen
|
|
993
|
+
}, /* @__PURE__ */ import_react.createElement(DrawerContext.Provider, { value: {
|
|
994
|
+
activeSnapPoint,
|
|
995
|
+
snapPoints,
|
|
996
|
+
setActiveSnapPoint,
|
|
997
|
+
drawerRef,
|
|
998
|
+
overlayRef,
|
|
999
|
+
onOpenChange,
|
|
1000
|
+
onPress,
|
|
1001
|
+
onRelease,
|
|
1002
|
+
onDrag,
|
|
1003
|
+
dismissible,
|
|
1004
|
+
shouldAnimate,
|
|
1005
|
+
handleOnly,
|
|
1006
|
+
isOpen,
|
|
1007
|
+
isDragging,
|
|
1008
|
+
shouldFade,
|
|
1009
|
+
closeDrawer,
|
|
1010
|
+
onNestedDrag,
|
|
1011
|
+
onNestedOpenChange,
|
|
1012
|
+
onNestedRelease,
|
|
1013
|
+
keyboardIsOpen,
|
|
1014
|
+
modal,
|
|
1015
|
+
snapPointsOffset,
|
|
1016
|
+
activeSnapPointIndex,
|
|
1017
|
+
direction,
|
|
1018
|
+
shouldScaleBackground,
|
|
1019
|
+
setBackgroundColorOnScale,
|
|
1020
|
+
noBodyStyles,
|
|
1021
|
+
container,
|
|
1022
|
+
autoFocus
|
|
1023
|
+
} }, children));
|
|
1024
|
+
}
|
|
1025
|
+
var Overlay = /* @__PURE__ */ import_react.forwardRef(function({ ...rest }, ref) {
|
|
1026
|
+
const { overlayRef, snapPoints, onRelease, shouldFade, isOpen, modal, shouldAnimate } = useDrawerContext();
|
|
1027
|
+
const composedRef = useComposedRefs(ref, overlayRef);
|
|
1028
|
+
const hasSnapPoints = snapPoints && snapPoints.length > 0;
|
|
1029
|
+
if (!modal) return null;
|
|
1030
|
+
const onMouseUp = import_react.useCallback((event) => onRelease(event), [onRelease]);
|
|
1031
|
+
return /* @__PURE__ */ import_react.createElement(Overlay$1, {
|
|
1032
|
+
onMouseUp,
|
|
1033
|
+
ref: composedRef,
|
|
1034
|
+
"data-vaul-overlay": "",
|
|
1035
|
+
"data-vaul-snap-points": isOpen && hasSnapPoints ? "true" : "false",
|
|
1036
|
+
"data-vaul-snap-points-overlay": isOpen && shouldFade ? "true" : "false",
|
|
1037
|
+
"data-vaul-animate": (shouldAnimate == null ? void 0 : shouldAnimate.current) ? "true" : "false",
|
|
1038
|
+
...rest
|
|
1039
|
+
});
|
|
1040
|
+
});
|
|
1041
|
+
Overlay.displayName = "Drawer.Overlay";
|
|
1042
|
+
var Content = /* @__PURE__ */ import_react.forwardRef(function({ onPointerDownOutside, style, onOpenAutoFocus, ...rest }, ref) {
|
|
1043
|
+
const { drawerRef, onPress, onRelease, onDrag, keyboardIsOpen, snapPointsOffset, activeSnapPointIndex, modal, isOpen, direction, snapPoints, container, handleOnly, shouldAnimate, autoFocus } = useDrawerContext();
|
|
1044
|
+
const [delayedSnapPoints, setDelayedSnapPoints] = import_react.useState(false);
|
|
1045
|
+
const composedRef = useComposedRefs(ref, drawerRef);
|
|
1046
|
+
const pointerStartRef = import_react.useRef(null);
|
|
1047
|
+
const lastKnownPointerEventRef = import_react.useRef(null);
|
|
1048
|
+
const wasBeyondThePointRef = import_react.useRef(false);
|
|
1049
|
+
const hasSnapPoints = snapPoints && snapPoints.length > 0;
|
|
1050
|
+
useScaleBackground();
|
|
1051
|
+
const isDeltaInDirection = (delta, direction, threshold = 0) => {
|
|
1052
|
+
if (wasBeyondThePointRef.current) return true;
|
|
1053
|
+
const deltaY = Math.abs(delta.y);
|
|
1054
|
+
const deltaX = Math.abs(delta.x);
|
|
1055
|
+
const isDeltaX = deltaX > deltaY;
|
|
1056
|
+
const dFactor = ["bottom", "right"].includes(direction) ? 1 : -1;
|
|
1057
|
+
if (direction === "left" || direction === "right") {
|
|
1058
|
+
if (!(delta.x * dFactor < 0) && deltaX >= 0 && deltaX <= threshold) return isDeltaX;
|
|
1059
|
+
} else if (!(delta.y * dFactor < 0) && deltaY >= 0 && deltaY <= threshold) return !isDeltaX;
|
|
1060
|
+
wasBeyondThePointRef.current = true;
|
|
1061
|
+
return true;
|
|
1062
|
+
};
|
|
1063
|
+
import_react.useEffect(() => {
|
|
1064
|
+
if (hasSnapPoints) window.requestAnimationFrame(() => {
|
|
1065
|
+
setDelayedSnapPoints(true);
|
|
1066
|
+
});
|
|
1067
|
+
}, []);
|
|
1068
|
+
function handleOnPointerUp(event) {
|
|
1069
|
+
pointerStartRef.current = null;
|
|
1070
|
+
wasBeyondThePointRef.current = false;
|
|
1071
|
+
onRelease(event);
|
|
1072
|
+
}
|
|
1073
|
+
return /* @__PURE__ */ import_react.createElement(Content$1, {
|
|
1074
|
+
"data-vaul-drawer-direction": direction,
|
|
1075
|
+
"data-vaul-drawer": "",
|
|
1076
|
+
"data-vaul-delayed-snap-points": delayedSnapPoints ? "true" : "false",
|
|
1077
|
+
"data-vaul-snap-points": isOpen && hasSnapPoints ? "true" : "false",
|
|
1078
|
+
"data-vaul-custom-container": container ? "true" : "false",
|
|
1079
|
+
"data-vaul-animate": (shouldAnimate == null ? void 0 : shouldAnimate.current) ? "true" : "false",
|
|
1080
|
+
...rest,
|
|
1081
|
+
ref: composedRef,
|
|
1082
|
+
style: snapPointsOffset && snapPointsOffset.length > 0 ? {
|
|
1083
|
+
"--snap-point-height": `${snapPointsOffset[activeSnapPointIndex != null ? activeSnapPointIndex : 0]}px`,
|
|
1084
|
+
...style
|
|
1085
|
+
} : style,
|
|
1086
|
+
onPointerDown: (event) => {
|
|
1087
|
+
if (handleOnly) return;
|
|
1088
|
+
rest.onPointerDown == null || rest.onPointerDown.call(rest, event);
|
|
1089
|
+
pointerStartRef.current = {
|
|
1090
|
+
x: event.pageX,
|
|
1091
|
+
y: event.pageY
|
|
1092
|
+
};
|
|
1093
|
+
onPress(event);
|
|
1094
|
+
},
|
|
1095
|
+
onOpenAutoFocus: (e) => {
|
|
1096
|
+
onOpenAutoFocus?.(e);
|
|
1097
|
+
if (!autoFocus) e.preventDefault();
|
|
1098
|
+
},
|
|
1099
|
+
onPointerDownOutside: (e) => {
|
|
1100
|
+
onPointerDownOutside?.(e);
|
|
1101
|
+
if (!modal || e.defaultPrevented) {
|
|
1102
|
+
e.preventDefault();
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
if (keyboardIsOpen.current) keyboardIsOpen.current = false;
|
|
1106
|
+
},
|
|
1107
|
+
onFocusOutside: (e) => {
|
|
1108
|
+
if (!modal) {
|
|
1109
|
+
e.preventDefault();
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
},
|
|
1113
|
+
onPointerMove: (event) => {
|
|
1114
|
+
lastKnownPointerEventRef.current = event;
|
|
1115
|
+
if (handleOnly) return;
|
|
1116
|
+
rest.onPointerMove == null || rest.onPointerMove.call(rest, event);
|
|
1117
|
+
if (!pointerStartRef.current) return;
|
|
1118
|
+
const yPosition = event.pageY - pointerStartRef.current.y;
|
|
1119
|
+
const xPosition = event.pageX - pointerStartRef.current.x;
|
|
1120
|
+
const swipeStartThreshold = event.pointerType === "touch" ? 10 : 2;
|
|
1121
|
+
if (isDeltaInDirection({
|
|
1122
|
+
x: xPosition,
|
|
1123
|
+
y: yPosition
|
|
1124
|
+
}, direction, swipeStartThreshold)) onDrag(event);
|
|
1125
|
+
else if (Math.abs(xPosition) > swipeStartThreshold || Math.abs(yPosition) > swipeStartThreshold) pointerStartRef.current = null;
|
|
1126
|
+
},
|
|
1127
|
+
onPointerUp: (event) => {
|
|
1128
|
+
rest.onPointerUp == null || rest.onPointerUp.call(rest, event);
|
|
1129
|
+
pointerStartRef.current = null;
|
|
1130
|
+
wasBeyondThePointRef.current = false;
|
|
1131
|
+
onRelease(event);
|
|
1132
|
+
},
|
|
1133
|
+
onPointerOut: (event) => {
|
|
1134
|
+
rest.onPointerOut == null || rest.onPointerOut.call(rest, event);
|
|
1135
|
+
handleOnPointerUp(lastKnownPointerEventRef.current);
|
|
1136
|
+
},
|
|
1137
|
+
onContextMenu: (event) => {
|
|
1138
|
+
rest.onContextMenu == null || rest.onContextMenu.call(rest, event);
|
|
1139
|
+
if (lastKnownPointerEventRef.current) handleOnPointerUp(lastKnownPointerEventRef.current);
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
});
|
|
1143
|
+
Content.displayName = "Drawer.Content";
|
|
1144
|
+
var LONG_HANDLE_PRESS_TIMEOUT = 250;
|
|
1145
|
+
var DOUBLE_TAP_TIMEOUT = 120;
|
|
1146
|
+
var Handle = /* @__PURE__ */ import_react.forwardRef(function({ preventCycle = false, children, ...rest }, ref) {
|
|
1147
|
+
const { closeDrawer, isDragging, snapPoints, activeSnapPoint, setActiveSnapPoint, dismissible, handleOnly, isOpen, onPress, onDrag } = useDrawerContext();
|
|
1148
|
+
const closeTimeoutIdRef = import_react.useRef(null);
|
|
1149
|
+
const shouldCancelInteractionRef = import_react.useRef(false);
|
|
1150
|
+
function handleStartCycle() {
|
|
1151
|
+
if (shouldCancelInteractionRef.current) {
|
|
1152
|
+
handleCancelInteraction();
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
window.setTimeout(() => {
|
|
1156
|
+
handleCycleSnapPoints();
|
|
1157
|
+
}, DOUBLE_TAP_TIMEOUT);
|
|
1158
|
+
}
|
|
1159
|
+
function handleCycleSnapPoints() {
|
|
1160
|
+
if (isDragging || preventCycle || shouldCancelInteractionRef.current) {
|
|
1161
|
+
handleCancelInteraction();
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
handleCancelInteraction();
|
|
1165
|
+
if (!snapPoints || snapPoints.length === 0) {
|
|
1166
|
+
if (!dismissible) closeDrawer();
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
if (activeSnapPoint === snapPoints[snapPoints.length - 1] && dismissible) {
|
|
1170
|
+
closeDrawer();
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
const currentSnapIndex = snapPoints.findIndex((point) => point === activeSnapPoint);
|
|
1174
|
+
if (currentSnapIndex === -1) return;
|
|
1175
|
+
const nextSnapPoint = snapPoints[currentSnapIndex + 1];
|
|
1176
|
+
setActiveSnapPoint(nextSnapPoint);
|
|
1177
|
+
}
|
|
1178
|
+
function handleStartInteraction() {
|
|
1179
|
+
closeTimeoutIdRef.current = window.setTimeout(() => {
|
|
1180
|
+
shouldCancelInteractionRef.current = true;
|
|
1181
|
+
}, LONG_HANDLE_PRESS_TIMEOUT);
|
|
1182
|
+
}
|
|
1183
|
+
function handleCancelInteraction() {
|
|
1184
|
+
if (closeTimeoutIdRef.current) window.clearTimeout(closeTimeoutIdRef.current);
|
|
1185
|
+
shouldCancelInteractionRef.current = false;
|
|
1186
|
+
}
|
|
1187
|
+
return /* @__PURE__ */ import_react.createElement("div", {
|
|
1188
|
+
onClick: handleStartCycle,
|
|
1189
|
+
onPointerCancel: handleCancelInteraction,
|
|
1190
|
+
onPointerDown: (e) => {
|
|
1191
|
+
if (handleOnly) onPress(e);
|
|
1192
|
+
handleStartInteraction();
|
|
1193
|
+
},
|
|
1194
|
+
onPointerMove: (e) => {
|
|
1195
|
+
if (handleOnly) onDrag(e);
|
|
1196
|
+
},
|
|
1197
|
+
ref,
|
|
1198
|
+
"data-vaul-drawer-visible": isOpen ? "true" : "false",
|
|
1199
|
+
"data-vaul-handle": "",
|
|
1200
|
+
"aria-hidden": "true",
|
|
1201
|
+
...rest
|
|
1202
|
+
}, /* @__PURE__ */ import_react.createElement("span", {
|
|
1203
|
+
"data-vaul-handle-hitarea": "",
|
|
1204
|
+
"aria-hidden": "true"
|
|
1205
|
+
}, children));
|
|
1206
|
+
});
|
|
1207
|
+
Handle.displayName = "Drawer.Handle";
|
|
1208
|
+
function NestedRoot({ onDrag, onOpenChange, open: nestedIsOpen, ...rest }) {
|
|
1209
|
+
const { onNestedDrag, onNestedOpenChange, onNestedRelease } = useDrawerContext();
|
|
1210
|
+
if (!onNestedDrag) throw new Error("Drawer.NestedRoot must be placed in another drawer");
|
|
1211
|
+
return /* @__PURE__ */ import_react.createElement(Root, {
|
|
1212
|
+
nested: true,
|
|
1213
|
+
open: nestedIsOpen,
|
|
1214
|
+
onClose: () => {
|
|
1215
|
+
onNestedOpenChange(false);
|
|
1216
|
+
},
|
|
1217
|
+
onDrag: (e, p) => {
|
|
1218
|
+
onNestedDrag(e, p);
|
|
1219
|
+
onDrag?.(e, p);
|
|
1220
|
+
},
|
|
1221
|
+
onOpenChange: (o) => {
|
|
1222
|
+
if (o) onNestedOpenChange(o);
|
|
1223
|
+
onOpenChange?.(o);
|
|
1224
|
+
},
|
|
1225
|
+
onRelease: onNestedRelease,
|
|
1226
|
+
...rest
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
function Portal(props) {
|
|
1230
|
+
const context = useDrawerContext();
|
|
1231
|
+
const { container = context.container, ...portalProps } = props;
|
|
1232
|
+
return /* @__PURE__ */ import_react.createElement(Portal$1, {
|
|
1233
|
+
container,
|
|
1234
|
+
...portalProps
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
var Drawer = {
|
|
1238
|
+
Root,
|
|
1239
|
+
NestedRoot,
|
|
1240
|
+
Content,
|
|
1241
|
+
Overlay,
|
|
1242
|
+
Trigger,
|
|
1243
|
+
Portal,
|
|
1244
|
+
Handle,
|
|
1245
|
+
Close,
|
|
1246
|
+
Title,
|
|
1247
|
+
Description
|
|
1248
|
+
};
|
|
1249
|
+
//#endregion
|
|
1250
|
+
export { Drawer as t };
|