@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,2748 @@
|
|
|
1
|
+
import { i as __toESM } from "../../_runtime.mjs";
|
|
2
|
+
import { X as require_react, q as require_react_dom } from "../@base-ui/react+[...].mjs";
|
|
3
|
+
import { n as LiveRegion, r as useAnnouncement, t as HiddenText } from "../dnd-kit__accessibility.mjs";
|
|
4
|
+
//#region node_modules/.pnpm/@dnd-kit+utilities@3.2.2_react@19.2.5/node_modules/@dnd-kit/utilities/dist/utilities.esm.js
|
|
5
|
+
var import_react_dom = /* @__PURE__ */ __toESM(require_react_dom());
|
|
6
|
+
var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
7
|
+
function useCombinedRefs() {
|
|
8
|
+
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) refs[_key] = arguments[_key];
|
|
9
|
+
return (0, import_react.useMemo)(() => (node) => {
|
|
10
|
+
refs.forEach((ref) => ref(node));
|
|
11
|
+
}, refs);
|
|
12
|
+
}
|
|
13
|
+
var canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
14
|
+
function isWindow(element) {
|
|
15
|
+
const elementString = Object.prototype.toString.call(element);
|
|
16
|
+
return elementString === "[object Window]" || elementString === "[object global]";
|
|
17
|
+
}
|
|
18
|
+
function isNode(node) {
|
|
19
|
+
return "nodeType" in node;
|
|
20
|
+
}
|
|
21
|
+
function getWindow(target) {
|
|
22
|
+
var _target$ownerDocument, _target$ownerDocument2;
|
|
23
|
+
if (!target) return window;
|
|
24
|
+
if (isWindow(target)) return target;
|
|
25
|
+
if (!isNode(target)) return window;
|
|
26
|
+
return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window;
|
|
27
|
+
}
|
|
28
|
+
function isDocument(node) {
|
|
29
|
+
const { Document } = getWindow(node);
|
|
30
|
+
return node instanceof Document;
|
|
31
|
+
}
|
|
32
|
+
function isHTMLElement(node) {
|
|
33
|
+
if (isWindow(node)) return false;
|
|
34
|
+
return node instanceof getWindow(node).HTMLElement;
|
|
35
|
+
}
|
|
36
|
+
function isSVGElement(node) {
|
|
37
|
+
return node instanceof getWindow(node).SVGElement;
|
|
38
|
+
}
|
|
39
|
+
function getOwnerDocument(target) {
|
|
40
|
+
if (!target) return document;
|
|
41
|
+
if (isWindow(target)) return target.document;
|
|
42
|
+
if (!isNode(target)) return document;
|
|
43
|
+
if (isDocument(target)) return target;
|
|
44
|
+
if (isHTMLElement(target) || isSVGElement(target)) return target.ownerDocument;
|
|
45
|
+
return document;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A hook that resolves to useEffect on the server and useLayoutEffect on the client
|
|
49
|
+
* @param callback {function} Callback function that is invoked when the dependencies of the hook change
|
|
50
|
+
*/
|
|
51
|
+
var useIsomorphicLayoutEffect = canUseDOM ? import_react.useLayoutEffect : import_react.useEffect;
|
|
52
|
+
function useEvent(handler) {
|
|
53
|
+
const handlerRef = (0, import_react.useRef)(handler);
|
|
54
|
+
useIsomorphicLayoutEffect(() => {
|
|
55
|
+
handlerRef.current = handler;
|
|
56
|
+
});
|
|
57
|
+
return (0, import_react.useCallback)(function() {
|
|
58
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
59
|
+
return handlerRef.current == null ? void 0 : handlerRef.current(...args);
|
|
60
|
+
}, []);
|
|
61
|
+
}
|
|
62
|
+
function useInterval() {
|
|
63
|
+
const intervalRef = (0, import_react.useRef)(null);
|
|
64
|
+
return [(0, import_react.useCallback)((listener, duration) => {
|
|
65
|
+
intervalRef.current = setInterval(listener, duration);
|
|
66
|
+
}, []), (0, import_react.useCallback)(() => {
|
|
67
|
+
if (intervalRef.current !== null) {
|
|
68
|
+
clearInterval(intervalRef.current);
|
|
69
|
+
intervalRef.current = null;
|
|
70
|
+
}
|
|
71
|
+
}, [])];
|
|
72
|
+
}
|
|
73
|
+
function useLatestValue(value, dependencies) {
|
|
74
|
+
if (dependencies === void 0) dependencies = [value];
|
|
75
|
+
const valueRef = (0, import_react.useRef)(value);
|
|
76
|
+
useIsomorphicLayoutEffect(() => {
|
|
77
|
+
if (valueRef.current !== value) valueRef.current = value;
|
|
78
|
+
}, dependencies);
|
|
79
|
+
return valueRef;
|
|
80
|
+
}
|
|
81
|
+
function useLazyMemo(callback, dependencies) {
|
|
82
|
+
const valueRef = (0, import_react.useRef)();
|
|
83
|
+
return (0, import_react.useMemo)(() => {
|
|
84
|
+
const newValue = callback(valueRef.current);
|
|
85
|
+
valueRef.current = newValue;
|
|
86
|
+
return newValue;
|
|
87
|
+
}, [...dependencies]);
|
|
88
|
+
}
|
|
89
|
+
function useNodeRef(onChange) {
|
|
90
|
+
const onChangeHandler = useEvent(onChange);
|
|
91
|
+
const node = (0, import_react.useRef)(null);
|
|
92
|
+
return [node, (0, import_react.useCallback)((element) => {
|
|
93
|
+
if (element !== node.current) onChangeHandler?.(element, node.current);
|
|
94
|
+
node.current = element;
|
|
95
|
+
}, [])];
|
|
96
|
+
}
|
|
97
|
+
function usePrevious(value) {
|
|
98
|
+
const ref = (0, import_react.useRef)();
|
|
99
|
+
(0, import_react.useEffect)(() => {
|
|
100
|
+
ref.current = value;
|
|
101
|
+
}, [value]);
|
|
102
|
+
return ref.current;
|
|
103
|
+
}
|
|
104
|
+
var ids = {};
|
|
105
|
+
function useUniqueId(prefix, value) {
|
|
106
|
+
return (0, import_react.useMemo)(() => {
|
|
107
|
+
if (value) return value;
|
|
108
|
+
const id = ids[prefix] == null ? 0 : ids[prefix] + 1;
|
|
109
|
+
ids[prefix] = id;
|
|
110
|
+
return prefix + "-" + id;
|
|
111
|
+
}, [prefix, value]);
|
|
112
|
+
}
|
|
113
|
+
function createAdjustmentFn(modifier) {
|
|
114
|
+
return function(object) {
|
|
115
|
+
for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) adjustments[_key - 1] = arguments[_key];
|
|
116
|
+
return adjustments.reduce((accumulator, adjustment) => {
|
|
117
|
+
const entries = Object.entries(adjustment);
|
|
118
|
+
for (const [key, valueAdjustment] of entries) {
|
|
119
|
+
const value = accumulator[key];
|
|
120
|
+
if (value != null) accumulator[key] = value + modifier * valueAdjustment;
|
|
121
|
+
}
|
|
122
|
+
return accumulator;
|
|
123
|
+
}, { ...object });
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
var add = /* @__PURE__ */ createAdjustmentFn(1);
|
|
127
|
+
var subtract = /* @__PURE__ */ createAdjustmentFn(-1);
|
|
128
|
+
function hasViewportRelativeCoordinates(event) {
|
|
129
|
+
return "clientX" in event && "clientY" in event;
|
|
130
|
+
}
|
|
131
|
+
function isKeyboardEvent(event) {
|
|
132
|
+
if (!event) return false;
|
|
133
|
+
const { KeyboardEvent } = getWindow(event.target);
|
|
134
|
+
return KeyboardEvent && event instanceof KeyboardEvent;
|
|
135
|
+
}
|
|
136
|
+
function isTouchEvent(event) {
|
|
137
|
+
if (!event) return false;
|
|
138
|
+
const { TouchEvent } = getWindow(event.target);
|
|
139
|
+
return TouchEvent && event instanceof TouchEvent;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Returns the normalized x and y coordinates for mouse and touch events.
|
|
143
|
+
*/
|
|
144
|
+
function getEventCoordinates(event) {
|
|
145
|
+
if (isTouchEvent(event)) {
|
|
146
|
+
if (event.touches && event.touches.length) {
|
|
147
|
+
const { clientX: x, clientY: y } = event.touches[0];
|
|
148
|
+
return {
|
|
149
|
+
x,
|
|
150
|
+
y
|
|
151
|
+
};
|
|
152
|
+
} else if (event.changedTouches && event.changedTouches.length) {
|
|
153
|
+
const { clientX: x, clientY: y } = event.changedTouches[0];
|
|
154
|
+
return {
|
|
155
|
+
x,
|
|
156
|
+
y
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (hasViewportRelativeCoordinates(event)) return {
|
|
161
|
+
x: event.clientX,
|
|
162
|
+
y: event.clientY
|
|
163
|
+
};
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
var CSS = /* @__PURE__ */ Object.freeze({
|
|
167
|
+
Translate: { toString(transform) {
|
|
168
|
+
if (!transform) return;
|
|
169
|
+
const { x, y } = transform;
|
|
170
|
+
return "translate3d(" + (x ? Math.round(x) : 0) + "px, " + (y ? Math.round(y) : 0) + "px, 0)";
|
|
171
|
+
} },
|
|
172
|
+
Scale: { toString(transform) {
|
|
173
|
+
if (!transform) return;
|
|
174
|
+
const { scaleX, scaleY } = transform;
|
|
175
|
+
return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")";
|
|
176
|
+
} },
|
|
177
|
+
Transform: { toString(transform) {
|
|
178
|
+
if (!transform) return;
|
|
179
|
+
return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(" ");
|
|
180
|
+
} },
|
|
181
|
+
Transition: { toString(_ref) {
|
|
182
|
+
let { property, duration, easing } = _ref;
|
|
183
|
+
return property + " " + duration + "ms " + easing;
|
|
184
|
+
} }
|
|
185
|
+
});
|
|
186
|
+
var SELECTOR = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
|
|
187
|
+
function findFirstFocusableNode(element) {
|
|
188
|
+
if (element.matches(SELECTOR)) return element;
|
|
189
|
+
return element.querySelector(SELECTOR);
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region node_modules/.pnpm/@dnd-kit+core@6.3.1_react-dom@19.2.5_react@19.2.5__react@19.2.5/node_modules/@dnd-kit/core/dist/core.esm.js
|
|
193
|
+
var DndMonitorContext = /* @__PURE__ */ (0, import_react.createContext)(null);
|
|
194
|
+
function useDndMonitor(listener) {
|
|
195
|
+
const registerListener = (0, import_react.useContext)(DndMonitorContext);
|
|
196
|
+
(0, import_react.useEffect)(() => {
|
|
197
|
+
if (!registerListener) throw new Error("useDndMonitor must be used within a children of <DndContext>");
|
|
198
|
+
return registerListener(listener);
|
|
199
|
+
}, [listener, registerListener]);
|
|
200
|
+
}
|
|
201
|
+
function useDndMonitorProvider() {
|
|
202
|
+
const [listeners] = (0, import_react.useState)(() => /* @__PURE__ */ new Set());
|
|
203
|
+
const registerListener = (0, import_react.useCallback)((listener) => {
|
|
204
|
+
listeners.add(listener);
|
|
205
|
+
return () => listeners.delete(listener);
|
|
206
|
+
}, [listeners]);
|
|
207
|
+
return [(0, import_react.useCallback)((_ref) => {
|
|
208
|
+
let { type, event } = _ref;
|
|
209
|
+
listeners.forEach((listener) => {
|
|
210
|
+
var _listener$type;
|
|
211
|
+
return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event);
|
|
212
|
+
});
|
|
213
|
+
}, [listeners]), registerListener];
|
|
214
|
+
}
|
|
215
|
+
var defaultScreenReaderInstructions = { draggable: "\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n " };
|
|
216
|
+
var defaultAnnouncements = {
|
|
217
|
+
onDragStart(_ref) {
|
|
218
|
+
let { active } = _ref;
|
|
219
|
+
return "Picked up draggable item " + active.id + ".";
|
|
220
|
+
},
|
|
221
|
+
onDragOver(_ref2) {
|
|
222
|
+
let { active, over } = _ref2;
|
|
223
|
+
if (over) return "Draggable item " + active.id + " was moved over droppable area " + over.id + ".";
|
|
224
|
+
return "Draggable item " + active.id + " is no longer over a droppable area.";
|
|
225
|
+
},
|
|
226
|
+
onDragEnd(_ref3) {
|
|
227
|
+
let { active, over } = _ref3;
|
|
228
|
+
if (over) return "Draggable item " + active.id + " was dropped over droppable area " + over.id;
|
|
229
|
+
return "Draggable item " + active.id + " was dropped.";
|
|
230
|
+
},
|
|
231
|
+
onDragCancel(_ref4) {
|
|
232
|
+
let { active } = _ref4;
|
|
233
|
+
return "Dragging was cancelled. Draggable item " + active.id + " was dropped.";
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
function Accessibility(_ref) {
|
|
237
|
+
let { announcements = defaultAnnouncements, container, hiddenTextDescribedById, screenReaderInstructions = defaultScreenReaderInstructions } = _ref;
|
|
238
|
+
const { announce, announcement } = useAnnouncement();
|
|
239
|
+
const liveRegionId = useUniqueId("DndLiveRegion");
|
|
240
|
+
const [mounted, setMounted] = (0, import_react.useState)(false);
|
|
241
|
+
(0, import_react.useEffect)(() => {
|
|
242
|
+
setMounted(true);
|
|
243
|
+
}, []);
|
|
244
|
+
useDndMonitor((0, import_react.useMemo)(() => ({
|
|
245
|
+
onDragStart(_ref2) {
|
|
246
|
+
let { active } = _ref2;
|
|
247
|
+
announce(announcements.onDragStart({ active }));
|
|
248
|
+
},
|
|
249
|
+
onDragMove(_ref3) {
|
|
250
|
+
let { active, over } = _ref3;
|
|
251
|
+
if (announcements.onDragMove) announce(announcements.onDragMove({
|
|
252
|
+
active,
|
|
253
|
+
over
|
|
254
|
+
}));
|
|
255
|
+
},
|
|
256
|
+
onDragOver(_ref4) {
|
|
257
|
+
let { active, over } = _ref4;
|
|
258
|
+
announce(announcements.onDragOver({
|
|
259
|
+
active,
|
|
260
|
+
over
|
|
261
|
+
}));
|
|
262
|
+
},
|
|
263
|
+
onDragEnd(_ref5) {
|
|
264
|
+
let { active, over } = _ref5;
|
|
265
|
+
announce(announcements.onDragEnd({
|
|
266
|
+
active,
|
|
267
|
+
over
|
|
268
|
+
}));
|
|
269
|
+
},
|
|
270
|
+
onDragCancel(_ref6) {
|
|
271
|
+
let { active, over } = _ref6;
|
|
272
|
+
announce(announcements.onDragCancel({
|
|
273
|
+
active,
|
|
274
|
+
over
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
277
|
+
}), [announce, announcements]));
|
|
278
|
+
if (!mounted) return null;
|
|
279
|
+
const markup = import_react.createElement(import_react.Fragment, null, import_react.createElement(HiddenText, {
|
|
280
|
+
id: hiddenTextDescribedById,
|
|
281
|
+
value: screenReaderInstructions.draggable
|
|
282
|
+
}), import_react.createElement(LiveRegion, {
|
|
283
|
+
id: liveRegionId,
|
|
284
|
+
announcement
|
|
285
|
+
}));
|
|
286
|
+
return container ? (0, import_react_dom.createPortal)(markup, container) : markup;
|
|
287
|
+
}
|
|
288
|
+
var Action;
|
|
289
|
+
(function(Action) {
|
|
290
|
+
Action["DragStart"] = "dragStart";
|
|
291
|
+
Action["DragMove"] = "dragMove";
|
|
292
|
+
Action["DragEnd"] = "dragEnd";
|
|
293
|
+
Action["DragCancel"] = "dragCancel";
|
|
294
|
+
Action["DragOver"] = "dragOver";
|
|
295
|
+
Action["RegisterDroppable"] = "registerDroppable";
|
|
296
|
+
Action["SetDroppableDisabled"] = "setDroppableDisabled";
|
|
297
|
+
Action["UnregisterDroppable"] = "unregisterDroppable";
|
|
298
|
+
})(Action || (Action = {}));
|
|
299
|
+
function noop() {}
|
|
300
|
+
function useSensor(sensor, options) {
|
|
301
|
+
return (0, import_react.useMemo)(() => ({
|
|
302
|
+
sensor,
|
|
303
|
+
options: options != null ? options : {}
|
|
304
|
+
}), [sensor, options]);
|
|
305
|
+
}
|
|
306
|
+
function useSensors() {
|
|
307
|
+
for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) sensors[_key] = arguments[_key];
|
|
308
|
+
return (0, import_react.useMemo)(() => [...sensors].filter((sensor) => sensor != null), [...sensors]);
|
|
309
|
+
}
|
|
310
|
+
var defaultCoordinates = /* @__PURE__ */ Object.freeze({
|
|
311
|
+
x: 0,
|
|
312
|
+
y: 0
|
|
313
|
+
});
|
|
314
|
+
/**
|
|
315
|
+
* Returns the distance between two points
|
|
316
|
+
*/
|
|
317
|
+
function distanceBetween(p1, p2) {
|
|
318
|
+
return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
|
|
319
|
+
}
|
|
320
|
+
function getRelativeTransformOrigin(event, rect) {
|
|
321
|
+
const eventCoordinates = getEventCoordinates(event);
|
|
322
|
+
if (!eventCoordinates) return "0 0";
|
|
323
|
+
const transformOrigin = {
|
|
324
|
+
x: (eventCoordinates.x - rect.left) / rect.width * 100,
|
|
325
|
+
y: (eventCoordinates.y - rect.top) / rect.height * 100
|
|
326
|
+
};
|
|
327
|
+
return transformOrigin.x + "% " + transformOrigin.y + "%";
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Sort collisions from smallest to greatest value
|
|
331
|
+
*/
|
|
332
|
+
function sortCollisionsAsc(_ref, _ref2) {
|
|
333
|
+
let { data: { value: a } } = _ref;
|
|
334
|
+
let { data: { value: b } } = _ref2;
|
|
335
|
+
return a - b;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Sort collisions from greatest to smallest value
|
|
339
|
+
*/
|
|
340
|
+
function sortCollisionsDesc(_ref3, _ref4) {
|
|
341
|
+
let { data: { value: a } } = _ref3;
|
|
342
|
+
let { data: { value: b } } = _ref4;
|
|
343
|
+
return b - a;
|
|
344
|
+
}
|
|
345
|
+
function getFirstCollision(collisions, property) {
|
|
346
|
+
if (!collisions || collisions.length === 0) return null;
|
|
347
|
+
const [firstCollision] = collisions;
|
|
348
|
+
return property ? firstCollision[property] : firstCollision;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Returns the coordinates of the center of a given ClientRect
|
|
352
|
+
*/
|
|
353
|
+
function centerOfRectangle(rect, left, top) {
|
|
354
|
+
if (left === void 0) left = rect.left;
|
|
355
|
+
if (top === void 0) top = rect.top;
|
|
356
|
+
return {
|
|
357
|
+
x: left + rect.width * .5,
|
|
358
|
+
y: top + rect.height * .5
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Returns the closest rectangles from an array of rectangles to the center of a given
|
|
363
|
+
* rectangle.
|
|
364
|
+
*/
|
|
365
|
+
var closestCenter = (_ref) => {
|
|
366
|
+
let { collisionRect, droppableRects, droppableContainers } = _ref;
|
|
367
|
+
const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top);
|
|
368
|
+
const collisions = [];
|
|
369
|
+
for (const droppableContainer of droppableContainers) {
|
|
370
|
+
const { id } = droppableContainer;
|
|
371
|
+
const rect = droppableRects.get(id);
|
|
372
|
+
if (rect) {
|
|
373
|
+
const distBetween = distanceBetween(centerOfRectangle(rect), centerRect);
|
|
374
|
+
collisions.push({
|
|
375
|
+
id,
|
|
376
|
+
data: {
|
|
377
|
+
droppableContainer,
|
|
378
|
+
value: distBetween
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return collisions.sort(sortCollisionsAsc);
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* Returns the intersecting rectangle area between two rectangles
|
|
387
|
+
*/
|
|
388
|
+
function getIntersectionRatio(entry, target) {
|
|
389
|
+
const top = Math.max(target.top, entry.top);
|
|
390
|
+
const left = Math.max(target.left, entry.left);
|
|
391
|
+
const right = Math.min(target.left + target.width, entry.left + entry.width);
|
|
392
|
+
const bottom = Math.min(target.top + target.height, entry.top + entry.height);
|
|
393
|
+
const width = right - left;
|
|
394
|
+
const height = bottom - top;
|
|
395
|
+
if (left < right && top < bottom) {
|
|
396
|
+
const targetArea = target.width * target.height;
|
|
397
|
+
const entryArea = entry.width * entry.height;
|
|
398
|
+
const intersectionArea = width * height;
|
|
399
|
+
const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea);
|
|
400
|
+
return Number(intersectionRatio.toFixed(4));
|
|
401
|
+
}
|
|
402
|
+
return 0;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Returns the rectangles that has the greatest intersection area with a given
|
|
406
|
+
* rectangle in an array of rectangles.
|
|
407
|
+
*/
|
|
408
|
+
var rectIntersection = (_ref) => {
|
|
409
|
+
let { collisionRect, droppableRects, droppableContainers } = _ref;
|
|
410
|
+
const collisions = [];
|
|
411
|
+
for (const droppableContainer of droppableContainers) {
|
|
412
|
+
const { id } = droppableContainer;
|
|
413
|
+
const rect = droppableRects.get(id);
|
|
414
|
+
if (rect) {
|
|
415
|
+
const intersectionRatio = getIntersectionRatio(rect, collisionRect);
|
|
416
|
+
if (intersectionRatio > 0) collisions.push({
|
|
417
|
+
id,
|
|
418
|
+
data: {
|
|
419
|
+
droppableContainer,
|
|
420
|
+
value: intersectionRatio
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return collisions.sort(sortCollisionsDesc);
|
|
426
|
+
};
|
|
427
|
+
function adjustScale(transform, rect1, rect2) {
|
|
428
|
+
return {
|
|
429
|
+
...transform,
|
|
430
|
+
scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1,
|
|
431
|
+
scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function getRectDelta(rect1, rect2) {
|
|
435
|
+
return rect1 && rect2 ? {
|
|
436
|
+
x: rect1.left - rect2.left,
|
|
437
|
+
y: rect1.top - rect2.top
|
|
438
|
+
} : defaultCoordinates;
|
|
439
|
+
}
|
|
440
|
+
function createRectAdjustmentFn(modifier) {
|
|
441
|
+
return function adjustClientRect(rect) {
|
|
442
|
+
for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) adjustments[_key - 1] = arguments[_key];
|
|
443
|
+
return adjustments.reduce((acc, adjustment) => ({
|
|
444
|
+
...acc,
|
|
445
|
+
top: acc.top + modifier * adjustment.y,
|
|
446
|
+
bottom: acc.bottom + modifier * adjustment.y,
|
|
447
|
+
left: acc.left + modifier * adjustment.x,
|
|
448
|
+
right: acc.right + modifier * adjustment.x
|
|
449
|
+
}), { ...rect });
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
var getAdjustedRect = /* @__PURE__ */ createRectAdjustmentFn(1);
|
|
453
|
+
function parseTransform(transform) {
|
|
454
|
+
if (transform.startsWith("matrix3d(")) {
|
|
455
|
+
const transformArray = transform.slice(9, -1).split(/, /);
|
|
456
|
+
return {
|
|
457
|
+
x: +transformArray[12],
|
|
458
|
+
y: +transformArray[13],
|
|
459
|
+
scaleX: +transformArray[0],
|
|
460
|
+
scaleY: +transformArray[5]
|
|
461
|
+
};
|
|
462
|
+
} else if (transform.startsWith("matrix(")) {
|
|
463
|
+
const transformArray = transform.slice(7, -1).split(/, /);
|
|
464
|
+
return {
|
|
465
|
+
x: +transformArray[4],
|
|
466
|
+
y: +transformArray[5],
|
|
467
|
+
scaleX: +transformArray[0],
|
|
468
|
+
scaleY: +transformArray[3]
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
return null;
|
|
472
|
+
}
|
|
473
|
+
function inverseTransform(rect, transform, transformOrigin) {
|
|
474
|
+
const parsedTransform = parseTransform(transform);
|
|
475
|
+
if (!parsedTransform) return rect;
|
|
476
|
+
const { scaleX, scaleY, x: translateX, y: translateY } = parsedTransform;
|
|
477
|
+
const x = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);
|
|
478
|
+
const y = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(" ") + 1));
|
|
479
|
+
const w = scaleX ? rect.width / scaleX : rect.width;
|
|
480
|
+
const h = scaleY ? rect.height / scaleY : rect.height;
|
|
481
|
+
return {
|
|
482
|
+
width: w,
|
|
483
|
+
height: h,
|
|
484
|
+
top: y,
|
|
485
|
+
right: x + w,
|
|
486
|
+
bottom: y + h,
|
|
487
|
+
left: x
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
var defaultOptions = { ignoreTransform: false };
|
|
491
|
+
/**
|
|
492
|
+
* Returns the bounding client rect of an element relative to the viewport.
|
|
493
|
+
*/
|
|
494
|
+
function getClientRect(element, options) {
|
|
495
|
+
if (options === void 0) options = defaultOptions;
|
|
496
|
+
let rect = element.getBoundingClientRect();
|
|
497
|
+
if (options.ignoreTransform) {
|
|
498
|
+
const { transform, transformOrigin } = getWindow(element).getComputedStyle(element);
|
|
499
|
+
if (transform) rect = inverseTransform(rect, transform, transformOrigin);
|
|
500
|
+
}
|
|
501
|
+
const { top, left, width, height, bottom, right } = rect;
|
|
502
|
+
return {
|
|
503
|
+
top,
|
|
504
|
+
left,
|
|
505
|
+
width,
|
|
506
|
+
height,
|
|
507
|
+
bottom,
|
|
508
|
+
right
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Returns the bounding client rect of an element relative to the viewport.
|
|
513
|
+
*
|
|
514
|
+
* @remarks
|
|
515
|
+
* The ClientRect returned by this method does not take into account transforms
|
|
516
|
+
* applied to the element it measures.
|
|
517
|
+
*
|
|
518
|
+
*/
|
|
519
|
+
function getTransformAgnosticClientRect(element) {
|
|
520
|
+
return getClientRect(element, { ignoreTransform: true });
|
|
521
|
+
}
|
|
522
|
+
function getWindowClientRect(element) {
|
|
523
|
+
const width = element.innerWidth;
|
|
524
|
+
const height = element.innerHeight;
|
|
525
|
+
return {
|
|
526
|
+
top: 0,
|
|
527
|
+
left: 0,
|
|
528
|
+
right: width,
|
|
529
|
+
bottom: height,
|
|
530
|
+
width,
|
|
531
|
+
height
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
function isFixed(node, computedStyle) {
|
|
535
|
+
if (computedStyle === void 0) computedStyle = getWindow(node).getComputedStyle(node);
|
|
536
|
+
return computedStyle.position === "fixed";
|
|
537
|
+
}
|
|
538
|
+
function isScrollable(element, computedStyle) {
|
|
539
|
+
if (computedStyle === void 0) computedStyle = getWindow(element).getComputedStyle(element);
|
|
540
|
+
const overflowRegex = /(auto|scroll|overlay)/;
|
|
541
|
+
return [
|
|
542
|
+
"overflow",
|
|
543
|
+
"overflowX",
|
|
544
|
+
"overflowY"
|
|
545
|
+
].some((property) => {
|
|
546
|
+
const value = computedStyle[property];
|
|
547
|
+
return typeof value === "string" ? overflowRegex.test(value) : false;
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
function getScrollableAncestors(element, limit) {
|
|
551
|
+
const scrollParents = [];
|
|
552
|
+
function findScrollableAncestors(node) {
|
|
553
|
+
if (limit != null && scrollParents.length >= limit) return scrollParents;
|
|
554
|
+
if (!node) return scrollParents;
|
|
555
|
+
if (isDocument(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) {
|
|
556
|
+
scrollParents.push(node.scrollingElement);
|
|
557
|
+
return scrollParents;
|
|
558
|
+
}
|
|
559
|
+
if (!isHTMLElement(node) || isSVGElement(node)) return scrollParents;
|
|
560
|
+
if (scrollParents.includes(node)) return scrollParents;
|
|
561
|
+
const computedStyle = getWindow(element).getComputedStyle(node);
|
|
562
|
+
if (node !== element) {
|
|
563
|
+
if (isScrollable(node, computedStyle)) scrollParents.push(node);
|
|
564
|
+
}
|
|
565
|
+
if (isFixed(node, computedStyle)) return scrollParents;
|
|
566
|
+
return findScrollableAncestors(node.parentNode);
|
|
567
|
+
}
|
|
568
|
+
if (!element) return scrollParents;
|
|
569
|
+
return findScrollableAncestors(element);
|
|
570
|
+
}
|
|
571
|
+
function getFirstScrollableAncestor(node) {
|
|
572
|
+
const [firstScrollableAncestor] = getScrollableAncestors(node, 1);
|
|
573
|
+
return firstScrollableAncestor != null ? firstScrollableAncestor : null;
|
|
574
|
+
}
|
|
575
|
+
function getScrollableElement(element) {
|
|
576
|
+
if (!canUseDOM || !element) return null;
|
|
577
|
+
if (isWindow(element)) return element;
|
|
578
|
+
if (!isNode(element)) return null;
|
|
579
|
+
if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) return window;
|
|
580
|
+
if (isHTMLElement(element)) return element;
|
|
581
|
+
return null;
|
|
582
|
+
}
|
|
583
|
+
function getScrollXCoordinate(element) {
|
|
584
|
+
if (isWindow(element)) return element.scrollX;
|
|
585
|
+
return element.scrollLeft;
|
|
586
|
+
}
|
|
587
|
+
function getScrollYCoordinate(element) {
|
|
588
|
+
if (isWindow(element)) return element.scrollY;
|
|
589
|
+
return element.scrollTop;
|
|
590
|
+
}
|
|
591
|
+
function getScrollCoordinates(element) {
|
|
592
|
+
return {
|
|
593
|
+
x: getScrollXCoordinate(element),
|
|
594
|
+
y: getScrollYCoordinate(element)
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
var Direction;
|
|
598
|
+
(function(Direction) {
|
|
599
|
+
Direction[Direction["Forward"] = 1] = "Forward";
|
|
600
|
+
Direction[Direction["Backward"] = -1] = "Backward";
|
|
601
|
+
})(Direction || (Direction = {}));
|
|
602
|
+
function isDocumentScrollingElement(element) {
|
|
603
|
+
if (!canUseDOM || !element) return false;
|
|
604
|
+
return element === document.scrollingElement;
|
|
605
|
+
}
|
|
606
|
+
function getScrollPosition(scrollingContainer) {
|
|
607
|
+
const minScroll = {
|
|
608
|
+
x: 0,
|
|
609
|
+
y: 0
|
|
610
|
+
};
|
|
611
|
+
const dimensions = isDocumentScrollingElement(scrollingContainer) ? {
|
|
612
|
+
height: window.innerHeight,
|
|
613
|
+
width: window.innerWidth
|
|
614
|
+
} : {
|
|
615
|
+
height: scrollingContainer.clientHeight,
|
|
616
|
+
width: scrollingContainer.clientWidth
|
|
617
|
+
};
|
|
618
|
+
const maxScroll = {
|
|
619
|
+
x: scrollingContainer.scrollWidth - dimensions.width,
|
|
620
|
+
y: scrollingContainer.scrollHeight - dimensions.height
|
|
621
|
+
};
|
|
622
|
+
return {
|
|
623
|
+
isTop: scrollingContainer.scrollTop <= minScroll.y,
|
|
624
|
+
isLeft: scrollingContainer.scrollLeft <= minScroll.x,
|
|
625
|
+
isBottom: scrollingContainer.scrollTop >= maxScroll.y,
|
|
626
|
+
isRight: scrollingContainer.scrollLeft >= maxScroll.x,
|
|
627
|
+
maxScroll,
|
|
628
|
+
minScroll
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
var defaultThreshold = {
|
|
632
|
+
x: .2,
|
|
633
|
+
y: .2
|
|
634
|
+
};
|
|
635
|
+
function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) {
|
|
636
|
+
let { top, left, right, bottom } = _ref;
|
|
637
|
+
if (acceleration === void 0) acceleration = 10;
|
|
638
|
+
if (thresholdPercentage === void 0) thresholdPercentage = defaultThreshold;
|
|
639
|
+
const { isTop, isBottom, isLeft, isRight } = getScrollPosition(scrollContainer);
|
|
640
|
+
const direction = {
|
|
641
|
+
x: 0,
|
|
642
|
+
y: 0
|
|
643
|
+
};
|
|
644
|
+
const speed = {
|
|
645
|
+
x: 0,
|
|
646
|
+
y: 0
|
|
647
|
+
};
|
|
648
|
+
const threshold = {
|
|
649
|
+
height: scrollContainerRect.height * thresholdPercentage.y,
|
|
650
|
+
width: scrollContainerRect.width * thresholdPercentage.x
|
|
651
|
+
};
|
|
652
|
+
if (!isTop && top <= scrollContainerRect.top + threshold.height) {
|
|
653
|
+
direction.y = Direction.Backward;
|
|
654
|
+
speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top) / threshold.height);
|
|
655
|
+
} else if (!isBottom && bottom >= scrollContainerRect.bottom - threshold.height) {
|
|
656
|
+
direction.y = Direction.Forward;
|
|
657
|
+
speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom) / threshold.height);
|
|
658
|
+
}
|
|
659
|
+
if (!isRight && right >= scrollContainerRect.right - threshold.width) {
|
|
660
|
+
direction.x = Direction.Forward;
|
|
661
|
+
speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width);
|
|
662
|
+
} else if (!isLeft && left <= scrollContainerRect.left + threshold.width) {
|
|
663
|
+
direction.x = Direction.Backward;
|
|
664
|
+
speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left) / threshold.width);
|
|
665
|
+
}
|
|
666
|
+
return {
|
|
667
|
+
direction,
|
|
668
|
+
speed
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
function getScrollElementRect(element) {
|
|
672
|
+
if (element === document.scrollingElement) {
|
|
673
|
+
const { innerWidth, innerHeight } = window;
|
|
674
|
+
return {
|
|
675
|
+
top: 0,
|
|
676
|
+
left: 0,
|
|
677
|
+
right: innerWidth,
|
|
678
|
+
bottom: innerHeight,
|
|
679
|
+
width: innerWidth,
|
|
680
|
+
height: innerHeight
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
const { top, left, right, bottom } = element.getBoundingClientRect();
|
|
684
|
+
return {
|
|
685
|
+
top,
|
|
686
|
+
left,
|
|
687
|
+
right,
|
|
688
|
+
bottom,
|
|
689
|
+
width: element.clientWidth,
|
|
690
|
+
height: element.clientHeight
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
function getScrollOffsets(scrollableAncestors) {
|
|
694
|
+
return scrollableAncestors.reduce((acc, node) => {
|
|
695
|
+
return add(acc, getScrollCoordinates(node));
|
|
696
|
+
}, defaultCoordinates);
|
|
697
|
+
}
|
|
698
|
+
function getScrollXOffset(scrollableAncestors) {
|
|
699
|
+
return scrollableAncestors.reduce((acc, node) => {
|
|
700
|
+
return acc + getScrollXCoordinate(node);
|
|
701
|
+
}, 0);
|
|
702
|
+
}
|
|
703
|
+
function getScrollYOffset(scrollableAncestors) {
|
|
704
|
+
return scrollableAncestors.reduce((acc, node) => {
|
|
705
|
+
return acc + getScrollYCoordinate(node);
|
|
706
|
+
}, 0);
|
|
707
|
+
}
|
|
708
|
+
function scrollIntoViewIfNeeded(element, measure) {
|
|
709
|
+
if (measure === void 0) measure = getClientRect;
|
|
710
|
+
if (!element) return;
|
|
711
|
+
const { top, left, bottom, right } = measure(element);
|
|
712
|
+
if (!getFirstScrollableAncestor(element)) return;
|
|
713
|
+
if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) element.scrollIntoView({
|
|
714
|
+
block: "center",
|
|
715
|
+
inline: "center"
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
var properties = [[
|
|
719
|
+
"x",
|
|
720
|
+
["left", "right"],
|
|
721
|
+
getScrollXOffset
|
|
722
|
+
], [
|
|
723
|
+
"y",
|
|
724
|
+
["top", "bottom"],
|
|
725
|
+
getScrollYOffset
|
|
726
|
+
]];
|
|
727
|
+
var Rect = class {
|
|
728
|
+
constructor(rect, element) {
|
|
729
|
+
this.rect = void 0;
|
|
730
|
+
this.width = void 0;
|
|
731
|
+
this.height = void 0;
|
|
732
|
+
this.top = void 0;
|
|
733
|
+
this.bottom = void 0;
|
|
734
|
+
this.right = void 0;
|
|
735
|
+
this.left = void 0;
|
|
736
|
+
const scrollableAncestors = getScrollableAncestors(element);
|
|
737
|
+
const scrollOffsets = getScrollOffsets(scrollableAncestors);
|
|
738
|
+
this.rect = { ...rect };
|
|
739
|
+
this.width = rect.width;
|
|
740
|
+
this.height = rect.height;
|
|
741
|
+
for (const [axis, keys, getScrollOffset] of properties) for (const key of keys) Object.defineProperty(this, key, {
|
|
742
|
+
get: () => {
|
|
743
|
+
const currentOffsets = getScrollOffset(scrollableAncestors);
|
|
744
|
+
const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets;
|
|
745
|
+
return this.rect[key] + scrollOffsetsDeltla;
|
|
746
|
+
},
|
|
747
|
+
enumerable: true
|
|
748
|
+
});
|
|
749
|
+
Object.defineProperty(this, "rect", { enumerable: false });
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
var Listeners = class {
|
|
753
|
+
constructor(target) {
|
|
754
|
+
this.target = void 0;
|
|
755
|
+
this.listeners = [];
|
|
756
|
+
this.removeAll = () => {
|
|
757
|
+
this.listeners.forEach((listener) => {
|
|
758
|
+
var _this$target;
|
|
759
|
+
return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener);
|
|
760
|
+
});
|
|
761
|
+
};
|
|
762
|
+
this.target = target;
|
|
763
|
+
}
|
|
764
|
+
add(eventName, handler, options) {
|
|
765
|
+
var _this$target2;
|
|
766
|
+
(_this$target2 = this.target) == null || _this$target2.addEventListener(eventName, handler, options);
|
|
767
|
+
this.listeners.push([
|
|
768
|
+
eventName,
|
|
769
|
+
handler,
|
|
770
|
+
options
|
|
771
|
+
]);
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
function getEventListenerTarget(target) {
|
|
775
|
+
const { EventTarget } = getWindow(target);
|
|
776
|
+
return target instanceof EventTarget ? target : getOwnerDocument(target);
|
|
777
|
+
}
|
|
778
|
+
function hasExceededDistance(delta, measurement) {
|
|
779
|
+
const dx = Math.abs(delta.x);
|
|
780
|
+
const dy = Math.abs(delta.y);
|
|
781
|
+
if (typeof measurement === "number") return Math.sqrt(dx ** 2 + dy ** 2) > measurement;
|
|
782
|
+
if ("x" in measurement && "y" in measurement) return dx > measurement.x && dy > measurement.y;
|
|
783
|
+
if ("x" in measurement) return dx > measurement.x;
|
|
784
|
+
if ("y" in measurement) return dy > measurement.y;
|
|
785
|
+
return false;
|
|
786
|
+
}
|
|
787
|
+
var EventName;
|
|
788
|
+
(function(EventName) {
|
|
789
|
+
EventName["Click"] = "click";
|
|
790
|
+
EventName["DragStart"] = "dragstart";
|
|
791
|
+
EventName["Keydown"] = "keydown";
|
|
792
|
+
EventName["ContextMenu"] = "contextmenu";
|
|
793
|
+
EventName["Resize"] = "resize";
|
|
794
|
+
EventName["SelectionChange"] = "selectionchange";
|
|
795
|
+
EventName["VisibilityChange"] = "visibilitychange";
|
|
796
|
+
})(EventName || (EventName = {}));
|
|
797
|
+
function preventDefault(event) {
|
|
798
|
+
event.preventDefault();
|
|
799
|
+
}
|
|
800
|
+
function stopPropagation(event) {
|
|
801
|
+
event.stopPropagation();
|
|
802
|
+
}
|
|
803
|
+
var KeyboardCode;
|
|
804
|
+
(function(KeyboardCode) {
|
|
805
|
+
KeyboardCode["Space"] = "Space";
|
|
806
|
+
KeyboardCode["Down"] = "ArrowDown";
|
|
807
|
+
KeyboardCode["Right"] = "ArrowRight";
|
|
808
|
+
KeyboardCode["Left"] = "ArrowLeft";
|
|
809
|
+
KeyboardCode["Up"] = "ArrowUp";
|
|
810
|
+
KeyboardCode["Esc"] = "Escape";
|
|
811
|
+
KeyboardCode["Enter"] = "Enter";
|
|
812
|
+
KeyboardCode["Tab"] = "Tab";
|
|
813
|
+
})(KeyboardCode || (KeyboardCode = {}));
|
|
814
|
+
var defaultKeyboardCodes = {
|
|
815
|
+
start: [KeyboardCode.Space, KeyboardCode.Enter],
|
|
816
|
+
cancel: [KeyboardCode.Esc],
|
|
817
|
+
end: [
|
|
818
|
+
KeyboardCode.Space,
|
|
819
|
+
KeyboardCode.Enter,
|
|
820
|
+
KeyboardCode.Tab
|
|
821
|
+
]
|
|
822
|
+
};
|
|
823
|
+
var defaultKeyboardCoordinateGetter = (event, _ref) => {
|
|
824
|
+
let { currentCoordinates } = _ref;
|
|
825
|
+
switch (event.code) {
|
|
826
|
+
case KeyboardCode.Right: return {
|
|
827
|
+
...currentCoordinates,
|
|
828
|
+
x: currentCoordinates.x + 25
|
|
829
|
+
};
|
|
830
|
+
case KeyboardCode.Left: return {
|
|
831
|
+
...currentCoordinates,
|
|
832
|
+
x: currentCoordinates.x - 25
|
|
833
|
+
};
|
|
834
|
+
case KeyboardCode.Down: return {
|
|
835
|
+
...currentCoordinates,
|
|
836
|
+
y: currentCoordinates.y + 25
|
|
837
|
+
};
|
|
838
|
+
case KeyboardCode.Up: return {
|
|
839
|
+
...currentCoordinates,
|
|
840
|
+
y: currentCoordinates.y - 25
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
};
|
|
844
|
+
var KeyboardSensor = class {
|
|
845
|
+
constructor(props) {
|
|
846
|
+
this.props = void 0;
|
|
847
|
+
this.autoScrollEnabled = false;
|
|
848
|
+
this.referenceCoordinates = void 0;
|
|
849
|
+
this.listeners = void 0;
|
|
850
|
+
this.windowListeners = void 0;
|
|
851
|
+
this.props = props;
|
|
852
|
+
const { event: { target } } = props;
|
|
853
|
+
this.props = props;
|
|
854
|
+
this.listeners = new Listeners(getOwnerDocument(target));
|
|
855
|
+
this.windowListeners = new Listeners(getWindow(target));
|
|
856
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
857
|
+
this.handleCancel = this.handleCancel.bind(this);
|
|
858
|
+
this.attach();
|
|
859
|
+
}
|
|
860
|
+
attach() {
|
|
861
|
+
this.handleStart();
|
|
862
|
+
this.windowListeners.add(EventName.Resize, this.handleCancel);
|
|
863
|
+
this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
|
|
864
|
+
setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));
|
|
865
|
+
}
|
|
866
|
+
handleStart() {
|
|
867
|
+
const { activeNode, onStart } = this.props;
|
|
868
|
+
const node = activeNode.node.current;
|
|
869
|
+
if (node) scrollIntoViewIfNeeded(node);
|
|
870
|
+
onStart(defaultCoordinates);
|
|
871
|
+
}
|
|
872
|
+
handleKeyDown(event) {
|
|
873
|
+
if (isKeyboardEvent(event)) {
|
|
874
|
+
const { active, context, options } = this.props;
|
|
875
|
+
const { keyboardCodes = defaultKeyboardCodes, coordinateGetter = defaultKeyboardCoordinateGetter, scrollBehavior = "smooth" } = options;
|
|
876
|
+
const { code } = event;
|
|
877
|
+
if (keyboardCodes.end.includes(code)) {
|
|
878
|
+
this.handleEnd(event);
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
if (keyboardCodes.cancel.includes(code)) {
|
|
882
|
+
this.handleCancel(event);
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
const { collisionRect } = context.current;
|
|
886
|
+
const currentCoordinates = collisionRect ? {
|
|
887
|
+
x: collisionRect.left,
|
|
888
|
+
y: collisionRect.top
|
|
889
|
+
} : defaultCoordinates;
|
|
890
|
+
if (!this.referenceCoordinates) this.referenceCoordinates = currentCoordinates;
|
|
891
|
+
const newCoordinates = coordinateGetter(event, {
|
|
892
|
+
active,
|
|
893
|
+
context: context.current,
|
|
894
|
+
currentCoordinates
|
|
895
|
+
});
|
|
896
|
+
if (newCoordinates) {
|
|
897
|
+
const coordinatesDelta = subtract(newCoordinates, currentCoordinates);
|
|
898
|
+
const scrollDelta = {
|
|
899
|
+
x: 0,
|
|
900
|
+
y: 0
|
|
901
|
+
};
|
|
902
|
+
const { scrollableAncestors } = context.current;
|
|
903
|
+
for (const scrollContainer of scrollableAncestors) {
|
|
904
|
+
const direction = event.code;
|
|
905
|
+
const { isTop, isRight, isLeft, isBottom, maxScroll, minScroll } = getScrollPosition(scrollContainer);
|
|
906
|
+
const scrollElementRect = getScrollElementRect(scrollContainer);
|
|
907
|
+
const clampedCoordinates = {
|
|
908
|
+
x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)),
|
|
909
|
+
y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y))
|
|
910
|
+
};
|
|
911
|
+
const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft;
|
|
912
|
+
const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop;
|
|
913
|
+
if (canScrollX && clampedCoordinates.x !== newCoordinates.x) {
|
|
914
|
+
const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x;
|
|
915
|
+
const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x;
|
|
916
|
+
if (canScrollToNewCoordinates && !coordinatesDelta.y) {
|
|
917
|
+
scrollContainer.scrollTo({
|
|
918
|
+
left: newScrollCoordinates,
|
|
919
|
+
behavior: scrollBehavior
|
|
920
|
+
});
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
if (canScrollToNewCoordinates) scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates;
|
|
924
|
+
else scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x;
|
|
925
|
+
if (scrollDelta.x) scrollContainer.scrollBy({
|
|
926
|
+
left: -scrollDelta.x,
|
|
927
|
+
behavior: scrollBehavior
|
|
928
|
+
});
|
|
929
|
+
break;
|
|
930
|
+
} else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) {
|
|
931
|
+
const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y;
|
|
932
|
+
const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y;
|
|
933
|
+
if (canScrollToNewCoordinates && !coordinatesDelta.x) {
|
|
934
|
+
scrollContainer.scrollTo({
|
|
935
|
+
top: newScrollCoordinates,
|
|
936
|
+
behavior: scrollBehavior
|
|
937
|
+
});
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
if (canScrollToNewCoordinates) scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates;
|
|
941
|
+
else scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y;
|
|
942
|
+
if (scrollDelta.y) scrollContainer.scrollBy({
|
|
943
|
+
top: -scrollDelta.y,
|
|
944
|
+
behavior: scrollBehavior
|
|
945
|
+
});
|
|
946
|
+
break;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
this.handleMove(event, add(subtract(newCoordinates, this.referenceCoordinates), scrollDelta));
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
handleMove(event, coordinates) {
|
|
954
|
+
const { onMove } = this.props;
|
|
955
|
+
event.preventDefault();
|
|
956
|
+
onMove(coordinates);
|
|
957
|
+
}
|
|
958
|
+
handleEnd(event) {
|
|
959
|
+
const { onEnd } = this.props;
|
|
960
|
+
event.preventDefault();
|
|
961
|
+
this.detach();
|
|
962
|
+
onEnd();
|
|
963
|
+
}
|
|
964
|
+
handleCancel(event) {
|
|
965
|
+
const { onCancel } = this.props;
|
|
966
|
+
event.preventDefault();
|
|
967
|
+
this.detach();
|
|
968
|
+
onCancel();
|
|
969
|
+
}
|
|
970
|
+
detach() {
|
|
971
|
+
this.listeners.removeAll();
|
|
972
|
+
this.windowListeners.removeAll();
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
KeyboardSensor.activators = [{
|
|
976
|
+
eventName: "onKeyDown",
|
|
977
|
+
handler: (event, _ref, _ref2) => {
|
|
978
|
+
let { keyboardCodes = defaultKeyboardCodes, onActivation } = _ref;
|
|
979
|
+
let { active } = _ref2;
|
|
980
|
+
const { code } = event.nativeEvent;
|
|
981
|
+
if (keyboardCodes.start.includes(code)) {
|
|
982
|
+
const activator = active.activatorNode.current;
|
|
983
|
+
if (activator && event.target !== activator) return false;
|
|
984
|
+
event.preventDefault();
|
|
985
|
+
onActivation?.({ event: event.nativeEvent });
|
|
986
|
+
return true;
|
|
987
|
+
}
|
|
988
|
+
return false;
|
|
989
|
+
}
|
|
990
|
+
}];
|
|
991
|
+
function isDistanceConstraint(constraint) {
|
|
992
|
+
return Boolean(constraint && "distance" in constraint);
|
|
993
|
+
}
|
|
994
|
+
function isDelayConstraint(constraint) {
|
|
995
|
+
return Boolean(constraint && "delay" in constraint);
|
|
996
|
+
}
|
|
997
|
+
var AbstractPointerSensor = class {
|
|
998
|
+
constructor(props, events, listenerTarget) {
|
|
999
|
+
var _getEventCoordinates;
|
|
1000
|
+
if (listenerTarget === void 0) listenerTarget = getEventListenerTarget(props.event.target);
|
|
1001
|
+
this.props = void 0;
|
|
1002
|
+
this.events = void 0;
|
|
1003
|
+
this.autoScrollEnabled = true;
|
|
1004
|
+
this.document = void 0;
|
|
1005
|
+
this.activated = false;
|
|
1006
|
+
this.initialCoordinates = void 0;
|
|
1007
|
+
this.timeoutId = null;
|
|
1008
|
+
this.listeners = void 0;
|
|
1009
|
+
this.documentListeners = void 0;
|
|
1010
|
+
this.windowListeners = void 0;
|
|
1011
|
+
this.props = props;
|
|
1012
|
+
this.events = events;
|
|
1013
|
+
const { event } = props;
|
|
1014
|
+
const { target } = event;
|
|
1015
|
+
this.props = props;
|
|
1016
|
+
this.events = events;
|
|
1017
|
+
this.document = getOwnerDocument(target);
|
|
1018
|
+
this.documentListeners = new Listeners(this.document);
|
|
1019
|
+
this.listeners = new Listeners(listenerTarget);
|
|
1020
|
+
this.windowListeners = new Listeners(getWindow(target));
|
|
1021
|
+
this.initialCoordinates = (_getEventCoordinates = getEventCoordinates(event)) != null ? _getEventCoordinates : defaultCoordinates;
|
|
1022
|
+
this.handleStart = this.handleStart.bind(this);
|
|
1023
|
+
this.handleMove = this.handleMove.bind(this);
|
|
1024
|
+
this.handleEnd = this.handleEnd.bind(this);
|
|
1025
|
+
this.handleCancel = this.handleCancel.bind(this);
|
|
1026
|
+
this.handleKeydown = this.handleKeydown.bind(this);
|
|
1027
|
+
this.removeTextSelection = this.removeTextSelection.bind(this);
|
|
1028
|
+
this.attach();
|
|
1029
|
+
}
|
|
1030
|
+
attach() {
|
|
1031
|
+
const { events, props: { options: { activationConstraint, bypassActivationConstraint } } } = this;
|
|
1032
|
+
this.listeners.add(events.move.name, this.handleMove, { passive: false });
|
|
1033
|
+
this.listeners.add(events.end.name, this.handleEnd);
|
|
1034
|
+
if (events.cancel) this.listeners.add(events.cancel.name, this.handleCancel);
|
|
1035
|
+
this.windowListeners.add(EventName.Resize, this.handleCancel);
|
|
1036
|
+
this.windowListeners.add(EventName.DragStart, preventDefault);
|
|
1037
|
+
this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
|
|
1038
|
+
this.windowListeners.add(EventName.ContextMenu, preventDefault);
|
|
1039
|
+
this.documentListeners.add(EventName.Keydown, this.handleKeydown);
|
|
1040
|
+
if (activationConstraint) {
|
|
1041
|
+
if (bypassActivationConstraint != null && bypassActivationConstraint({
|
|
1042
|
+
event: this.props.event,
|
|
1043
|
+
activeNode: this.props.activeNode,
|
|
1044
|
+
options: this.props.options
|
|
1045
|
+
})) return this.handleStart();
|
|
1046
|
+
if (isDelayConstraint(activationConstraint)) {
|
|
1047
|
+
this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay);
|
|
1048
|
+
this.handlePending(activationConstraint);
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
if (isDistanceConstraint(activationConstraint)) {
|
|
1052
|
+
this.handlePending(activationConstraint);
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
this.handleStart();
|
|
1057
|
+
}
|
|
1058
|
+
detach() {
|
|
1059
|
+
this.listeners.removeAll();
|
|
1060
|
+
this.windowListeners.removeAll();
|
|
1061
|
+
setTimeout(this.documentListeners.removeAll, 50);
|
|
1062
|
+
if (this.timeoutId !== null) {
|
|
1063
|
+
clearTimeout(this.timeoutId);
|
|
1064
|
+
this.timeoutId = null;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
handlePending(constraint, offset) {
|
|
1068
|
+
const { active, onPending } = this.props;
|
|
1069
|
+
onPending(active, constraint, this.initialCoordinates, offset);
|
|
1070
|
+
}
|
|
1071
|
+
handleStart() {
|
|
1072
|
+
const { initialCoordinates } = this;
|
|
1073
|
+
const { onStart } = this.props;
|
|
1074
|
+
if (initialCoordinates) {
|
|
1075
|
+
this.activated = true;
|
|
1076
|
+
this.documentListeners.add(EventName.Click, stopPropagation, { capture: true });
|
|
1077
|
+
this.removeTextSelection();
|
|
1078
|
+
this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection);
|
|
1079
|
+
onStart(initialCoordinates);
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
handleMove(event) {
|
|
1083
|
+
var _getEventCoordinates2;
|
|
1084
|
+
const { activated, initialCoordinates, props } = this;
|
|
1085
|
+
const { onMove, options: { activationConstraint } } = props;
|
|
1086
|
+
if (!initialCoordinates) return;
|
|
1087
|
+
const coordinates = (_getEventCoordinates2 = getEventCoordinates(event)) != null ? _getEventCoordinates2 : defaultCoordinates;
|
|
1088
|
+
const delta = subtract(initialCoordinates, coordinates);
|
|
1089
|
+
if (!activated && activationConstraint) {
|
|
1090
|
+
if (isDistanceConstraint(activationConstraint)) {
|
|
1091
|
+
if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) return this.handleCancel();
|
|
1092
|
+
if (hasExceededDistance(delta, activationConstraint.distance)) return this.handleStart();
|
|
1093
|
+
}
|
|
1094
|
+
if (isDelayConstraint(activationConstraint)) {
|
|
1095
|
+
if (hasExceededDistance(delta, activationConstraint.tolerance)) return this.handleCancel();
|
|
1096
|
+
}
|
|
1097
|
+
this.handlePending(activationConstraint, delta);
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
if (event.cancelable) event.preventDefault();
|
|
1101
|
+
onMove(coordinates);
|
|
1102
|
+
}
|
|
1103
|
+
handleEnd() {
|
|
1104
|
+
const { onAbort, onEnd } = this.props;
|
|
1105
|
+
this.detach();
|
|
1106
|
+
if (!this.activated) onAbort(this.props.active);
|
|
1107
|
+
onEnd();
|
|
1108
|
+
}
|
|
1109
|
+
handleCancel() {
|
|
1110
|
+
const { onAbort, onCancel } = this.props;
|
|
1111
|
+
this.detach();
|
|
1112
|
+
if (!this.activated) onAbort(this.props.active);
|
|
1113
|
+
onCancel();
|
|
1114
|
+
}
|
|
1115
|
+
handleKeydown(event) {
|
|
1116
|
+
if (event.code === KeyboardCode.Esc) this.handleCancel();
|
|
1117
|
+
}
|
|
1118
|
+
removeTextSelection() {
|
|
1119
|
+
var _this$document$getSel;
|
|
1120
|
+
(_this$document$getSel = this.document.getSelection()) == null || _this$document$getSel.removeAllRanges();
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
var events = {
|
|
1124
|
+
cancel: { name: "pointercancel" },
|
|
1125
|
+
move: { name: "pointermove" },
|
|
1126
|
+
end: { name: "pointerup" }
|
|
1127
|
+
};
|
|
1128
|
+
var PointerSensor = class extends AbstractPointerSensor {
|
|
1129
|
+
constructor(props) {
|
|
1130
|
+
const { event } = props;
|
|
1131
|
+
const listenerTarget = getOwnerDocument(event.target);
|
|
1132
|
+
super(props, events, listenerTarget);
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
PointerSensor.activators = [{
|
|
1136
|
+
eventName: "onPointerDown",
|
|
1137
|
+
handler: (_ref, _ref2) => {
|
|
1138
|
+
let { nativeEvent: event } = _ref;
|
|
1139
|
+
let { onActivation } = _ref2;
|
|
1140
|
+
if (!event.isPrimary || event.button !== 0) return false;
|
|
1141
|
+
onActivation?.({ event });
|
|
1142
|
+
return true;
|
|
1143
|
+
}
|
|
1144
|
+
}];
|
|
1145
|
+
var events$1 = {
|
|
1146
|
+
move: { name: "mousemove" },
|
|
1147
|
+
end: { name: "mouseup" }
|
|
1148
|
+
};
|
|
1149
|
+
var MouseButton;
|
|
1150
|
+
(function(MouseButton) {
|
|
1151
|
+
MouseButton[MouseButton["RightClick"] = 2] = "RightClick";
|
|
1152
|
+
})(MouseButton || (MouseButton = {}));
|
|
1153
|
+
var MouseSensor = class extends AbstractPointerSensor {
|
|
1154
|
+
constructor(props) {
|
|
1155
|
+
super(props, events$1, getOwnerDocument(props.event.target));
|
|
1156
|
+
}
|
|
1157
|
+
};
|
|
1158
|
+
MouseSensor.activators = [{
|
|
1159
|
+
eventName: "onMouseDown",
|
|
1160
|
+
handler: (_ref, _ref2) => {
|
|
1161
|
+
let { nativeEvent: event } = _ref;
|
|
1162
|
+
let { onActivation } = _ref2;
|
|
1163
|
+
if (event.button === MouseButton.RightClick) return false;
|
|
1164
|
+
onActivation?.({ event });
|
|
1165
|
+
return true;
|
|
1166
|
+
}
|
|
1167
|
+
}];
|
|
1168
|
+
var events$2 = {
|
|
1169
|
+
cancel: { name: "touchcancel" },
|
|
1170
|
+
move: { name: "touchmove" },
|
|
1171
|
+
end: { name: "touchend" }
|
|
1172
|
+
};
|
|
1173
|
+
var TouchSensor = class extends AbstractPointerSensor {
|
|
1174
|
+
constructor(props) {
|
|
1175
|
+
super(props, events$2);
|
|
1176
|
+
}
|
|
1177
|
+
static setup() {
|
|
1178
|
+
window.addEventListener(events$2.move.name, noop, {
|
|
1179
|
+
capture: false,
|
|
1180
|
+
passive: false
|
|
1181
|
+
});
|
|
1182
|
+
return function teardown() {
|
|
1183
|
+
window.removeEventListener(events$2.move.name, noop);
|
|
1184
|
+
};
|
|
1185
|
+
function noop() {}
|
|
1186
|
+
}
|
|
1187
|
+
};
|
|
1188
|
+
TouchSensor.activators = [{
|
|
1189
|
+
eventName: "onTouchStart",
|
|
1190
|
+
handler: (_ref, _ref2) => {
|
|
1191
|
+
let { nativeEvent: event } = _ref;
|
|
1192
|
+
let { onActivation } = _ref2;
|
|
1193
|
+
const { touches } = event;
|
|
1194
|
+
if (touches.length > 1) return false;
|
|
1195
|
+
onActivation?.({ event });
|
|
1196
|
+
return true;
|
|
1197
|
+
}
|
|
1198
|
+
}];
|
|
1199
|
+
var AutoScrollActivator;
|
|
1200
|
+
(function(AutoScrollActivator) {
|
|
1201
|
+
AutoScrollActivator[AutoScrollActivator["Pointer"] = 0] = "Pointer";
|
|
1202
|
+
AutoScrollActivator[AutoScrollActivator["DraggableRect"] = 1] = "DraggableRect";
|
|
1203
|
+
})(AutoScrollActivator || (AutoScrollActivator = {}));
|
|
1204
|
+
var TraversalOrder;
|
|
1205
|
+
(function(TraversalOrder) {
|
|
1206
|
+
TraversalOrder[TraversalOrder["TreeOrder"] = 0] = "TreeOrder";
|
|
1207
|
+
TraversalOrder[TraversalOrder["ReversedTreeOrder"] = 1] = "ReversedTreeOrder";
|
|
1208
|
+
})(TraversalOrder || (TraversalOrder = {}));
|
|
1209
|
+
function useAutoScroller(_ref) {
|
|
1210
|
+
let { acceleration, activator = AutoScrollActivator.Pointer, canScroll, draggingRect, enabled, interval = 5, order = TraversalOrder.TreeOrder, pointerCoordinates, scrollableAncestors, scrollableAncestorRects, delta, threshold } = _ref;
|
|
1211
|
+
const scrollIntent = useScrollIntent({
|
|
1212
|
+
delta,
|
|
1213
|
+
disabled: !enabled
|
|
1214
|
+
});
|
|
1215
|
+
const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval();
|
|
1216
|
+
const scrollSpeed = (0, import_react.useRef)({
|
|
1217
|
+
x: 0,
|
|
1218
|
+
y: 0
|
|
1219
|
+
});
|
|
1220
|
+
const scrollDirection = (0, import_react.useRef)({
|
|
1221
|
+
x: 0,
|
|
1222
|
+
y: 0
|
|
1223
|
+
});
|
|
1224
|
+
const rect = (0, import_react.useMemo)(() => {
|
|
1225
|
+
switch (activator) {
|
|
1226
|
+
case AutoScrollActivator.Pointer: return pointerCoordinates ? {
|
|
1227
|
+
top: pointerCoordinates.y,
|
|
1228
|
+
bottom: pointerCoordinates.y,
|
|
1229
|
+
left: pointerCoordinates.x,
|
|
1230
|
+
right: pointerCoordinates.x
|
|
1231
|
+
} : null;
|
|
1232
|
+
case AutoScrollActivator.DraggableRect: return draggingRect;
|
|
1233
|
+
}
|
|
1234
|
+
}, [
|
|
1235
|
+
activator,
|
|
1236
|
+
draggingRect,
|
|
1237
|
+
pointerCoordinates
|
|
1238
|
+
]);
|
|
1239
|
+
const scrollContainerRef = (0, import_react.useRef)(null);
|
|
1240
|
+
const autoScroll = (0, import_react.useCallback)(() => {
|
|
1241
|
+
const scrollContainer = scrollContainerRef.current;
|
|
1242
|
+
if (!scrollContainer) return;
|
|
1243
|
+
const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x;
|
|
1244
|
+
const scrollTop = scrollSpeed.current.y * scrollDirection.current.y;
|
|
1245
|
+
scrollContainer.scrollBy(scrollLeft, scrollTop);
|
|
1246
|
+
}, []);
|
|
1247
|
+
const sortedScrollableAncestors = (0, import_react.useMemo)(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]);
|
|
1248
|
+
(0, import_react.useEffect)(() => {
|
|
1249
|
+
if (!enabled || !scrollableAncestors.length || !rect) {
|
|
1250
|
+
clearAutoScrollInterval();
|
|
1251
|
+
return;
|
|
1252
|
+
}
|
|
1253
|
+
for (const scrollContainer of sortedScrollableAncestors) {
|
|
1254
|
+
if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) continue;
|
|
1255
|
+
const scrollContainerRect = scrollableAncestorRects[scrollableAncestors.indexOf(scrollContainer)];
|
|
1256
|
+
if (!scrollContainerRect) continue;
|
|
1257
|
+
const { direction, speed } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold);
|
|
1258
|
+
for (const axis of ["x", "y"]) if (!scrollIntent[axis][direction[axis]]) {
|
|
1259
|
+
speed[axis] = 0;
|
|
1260
|
+
direction[axis] = 0;
|
|
1261
|
+
}
|
|
1262
|
+
if (speed.x > 0 || speed.y > 0) {
|
|
1263
|
+
clearAutoScrollInterval();
|
|
1264
|
+
scrollContainerRef.current = scrollContainer;
|
|
1265
|
+
setAutoScrollInterval(autoScroll, interval);
|
|
1266
|
+
scrollSpeed.current = speed;
|
|
1267
|
+
scrollDirection.current = direction;
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
scrollSpeed.current = {
|
|
1272
|
+
x: 0,
|
|
1273
|
+
y: 0
|
|
1274
|
+
};
|
|
1275
|
+
scrollDirection.current = {
|
|
1276
|
+
x: 0,
|
|
1277
|
+
y: 0
|
|
1278
|
+
};
|
|
1279
|
+
clearAutoScrollInterval();
|
|
1280
|
+
}, [
|
|
1281
|
+
acceleration,
|
|
1282
|
+
autoScroll,
|
|
1283
|
+
canScroll,
|
|
1284
|
+
clearAutoScrollInterval,
|
|
1285
|
+
enabled,
|
|
1286
|
+
interval,
|
|
1287
|
+
JSON.stringify(rect),
|
|
1288
|
+
JSON.stringify(scrollIntent),
|
|
1289
|
+
setAutoScrollInterval,
|
|
1290
|
+
scrollableAncestors,
|
|
1291
|
+
sortedScrollableAncestors,
|
|
1292
|
+
scrollableAncestorRects,
|
|
1293
|
+
JSON.stringify(threshold)
|
|
1294
|
+
]);
|
|
1295
|
+
}
|
|
1296
|
+
var defaultScrollIntent = {
|
|
1297
|
+
x: {
|
|
1298
|
+
[Direction.Backward]: false,
|
|
1299
|
+
[Direction.Forward]: false
|
|
1300
|
+
},
|
|
1301
|
+
y: {
|
|
1302
|
+
[Direction.Backward]: false,
|
|
1303
|
+
[Direction.Forward]: false
|
|
1304
|
+
}
|
|
1305
|
+
};
|
|
1306
|
+
function useScrollIntent(_ref2) {
|
|
1307
|
+
let { delta, disabled } = _ref2;
|
|
1308
|
+
const previousDelta = usePrevious(delta);
|
|
1309
|
+
return useLazyMemo((previousIntent) => {
|
|
1310
|
+
if (disabled || !previousDelta || !previousIntent) return defaultScrollIntent;
|
|
1311
|
+
const direction = {
|
|
1312
|
+
x: Math.sign(delta.x - previousDelta.x),
|
|
1313
|
+
y: Math.sign(delta.y - previousDelta.y)
|
|
1314
|
+
};
|
|
1315
|
+
return {
|
|
1316
|
+
x: {
|
|
1317
|
+
[Direction.Backward]: previousIntent.x[Direction.Backward] || direction.x === -1,
|
|
1318
|
+
[Direction.Forward]: previousIntent.x[Direction.Forward] || direction.x === 1
|
|
1319
|
+
},
|
|
1320
|
+
y: {
|
|
1321
|
+
[Direction.Backward]: previousIntent.y[Direction.Backward] || direction.y === -1,
|
|
1322
|
+
[Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1
|
|
1323
|
+
}
|
|
1324
|
+
};
|
|
1325
|
+
}, [
|
|
1326
|
+
disabled,
|
|
1327
|
+
delta,
|
|
1328
|
+
previousDelta
|
|
1329
|
+
]);
|
|
1330
|
+
}
|
|
1331
|
+
function useCachedNode(draggableNodes, id) {
|
|
1332
|
+
const draggableNode = id != null ? draggableNodes.get(id) : void 0;
|
|
1333
|
+
const node = draggableNode ? draggableNode.node.current : null;
|
|
1334
|
+
return useLazyMemo((cachedNode) => {
|
|
1335
|
+
var _ref;
|
|
1336
|
+
if (id == null) return null;
|
|
1337
|
+
return (_ref = node != null ? node : cachedNode) != null ? _ref : null;
|
|
1338
|
+
}, [node, id]);
|
|
1339
|
+
}
|
|
1340
|
+
function useCombineActivators(sensors, getSyntheticHandler) {
|
|
1341
|
+
return (0, import_react.useMemo)(() => sensors.reduce((accumulator, sensor) => {
|
|
1342
|
+
const { sensor: Sensor } = sensor;
|
|
1343
|
+
const sensorActivators = Sensor.activators.map((activator) => ({
|
|
1344
|
+
eventName: activator.eventName,
|
|
1345
|
+
handler: getSyntheticHandler(activator.handler, sensor)
|
|
1346
|
+
}));
|
|
1347
|
+
return [...accumulator, ...sensorActivators];
|
|
1348
|
+
}, []), [sensors, getSyntheticHandler]);
|
|
1349
|
+
}
|
|
1350
|
+
var MeasuringStrategy;
|
|
1351
|
+
(function(MeasuringStrategy) {
|
|
1352
|
+
MeasuringStrategy[MeasuringStrategy["Always"] = 0] = "Always";
|
|
1353
|
+
MeasuringStrategy[MeasuringStrategy["BeforeDragging"] = 1] = "BeforeDragging";
|
|
1354
|
+
MeasuringStrategy[MeasuringStrategy["WhileDragging"] = 2] = "WhileDragging";
|
|
1355
|
+
})(MeasuringStrategy || (MeasuringStrategy = {}));
|
|
1356
|
+
var MeasuringFrequency;
|
|
1357
|
+
(function(MeasuringFrequency) {
|
|
1358
|
+
MeasuringFrequency["Optimized"] = "optimized";
|
|
1359
|
+
})(MeasuringFrequency || (MeasuringFrequency = {}));
|
|
1360
|
+
var defaultValue = /* @__PURE__ */ new Map();
|
|
1361
|
+
function useDroppableMeasuring(containers, _ref) {
|
|
1362
|
+
let { dragging, dependencies, config } = _ref;
|
|
1363
|
+
const [queue, setQueue] = (0, import_react.useState)(null);
|
|
1364
|
+
const { frequency, measure, strategy } = config;
|
|
1365
|
+
const containersRef = (0, import_react.useRef)(containers);
|
|
1366
|
+
const disabled = isDisabled();
|
|
1367
|
+
const disabledRef = useLatestValue(disabled);
|
|
1368
|
+
const measureDroppableContainers = (0, import_react.useCallback)(function(ids) {
|
|
1369
|
+
if (ids === void 0) ids = [];
|
|
1370
|
+
if (disabledRef.current) return;
|
|
1371
|
+
setQueue((value) => {
|
|
1372
|
+
if (value === null) return ids;
|
|
1373
|
+
return value.concat(ids.filter((id) => !value.includes(id)));
|
|
1374
|
+
});
|
|
1375
|
+
}, [disabledRef]);
|
|
1376
|
+
const timeoutId = (0, import_react.useRef)(null);
|
|
1377
|
+
const droppableRects = useLazyMemo((previousValue) => {
|
|
1378
|
+
if (disabled && !dragging) return defaultValue;
|
|
1379
|
+
if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) {
|
|
1380
|
+
const map = /* @__PURE__ */ new Map();
|
|
1381
|
+
for (let container of containers) {
|
|
1382
|
+
if (!container) continue;
|
|
1383
|
+
if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) {
|
|
1384
|
+
map.set(container.id, container.rect.current);
|
|
1385
|
+
continue;
|
|
1386
|
+
}
|
|
1387
|
+
const node = container.node.current;
|
|
1388
|
+
const rect = node ? new Rect(measure(node), node) : null;
|
|
1389
|
+
container.rect.current = rect;
|
|
1390
|
+
if (rect) map.set(container.id, rect);
|
|
1391
|
+
}
|
|
1392
|
+
return map;
|
|
1393
|
+
}
|
|
1394
|
+
return previousValue;
|
|
1395
|
+
}, [
|
|
1396
|
+
containers,
|
|
1397
|
+
queue,
|
|
1398
|
+
dragging,
|
|
1399
|
+
disabled,
|
|
1400
|
+
measure
|
|
1401
|
+
]);
|
|
1402
|
+
(0, import_react.useEffect)(() => {
|
|
1403
|
+
containersRef.current = containers;
|
|
1404
|
+
}, [containers]);
|
|
1405
|
+
(0, import_react.useEffect)(() => {
|
|
1406
|
+
if (disabled) return;
|
|
1407
|
+
measureDroppableContainers();
|
|
1408
|
+
}, [dragging, disabled]);
|
|
1409
|
+
(0, import_react.useEffect)(() => {
|
|
1410
|
+
if (queue && queue.length > 0) setQueue(null);
|
|
1411
|
+
}, [JSON.stringify(queue)]);
|
|
1412
|
+
(0, import_react.useEffect)(() => {
|
|
1413
|
+
if (disabled || typeof frequency !== "number" || timeoutId.current !== null) return;
|
|
1414
|
+
timeoutId.current = setTimeout(() => {
|
|
1415
|
+
measureDroppableContainers();
|
|
1416
|
+
timeoutId.current = null;
|
|
1417
|
+
}, frequency);
|
|
1418
|
+
}, [
|
|
1419
|
+
frequency,
|
|
1420
|
+
disabled,
|
|
1421
|
+
measureDroppableContainers,
|
|
1422
|
+
...dependencies
|
|
1423
|
+
]);
|
|
1424
|
+
return {
|
|
1425
|
+
droppableRects,
|
|
1426
|
+
measureDroppableContainers,
|
|
1427
|
+
measuringScheduled: queue != null
|
|
1428
|
+
};
|
|
1429
|
+
function isDisabled() {
|
|
1430
|
+
switch (strategy) {
|
|
1431
|
+
case MeasuringStrategy.Always: return false;
|
|
1432
|
+
case MeasuringStrategy.BeforeDragging: return dragging;
|
|
1433
|
+
default: return !dragging;
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
function useInitialValue(value, computeFn) {
|
|
1438
|
+
return useLazyMemo((previousValue) => {
|
|
1439
|
+
if (!value) return null;
|
|
1440
|
+
if (previousValue) return previousValue;
|
|
1441
|
+
return typeof computeFn === "function" ? computeFn(value) : value;
|
|
1442
|
+
}, [computeFn, value]);
|
|
1443
|
+
}
|
|
1444
|
+
function useInitialRect(node, measure) {
|
|
1445
|
+
return useInitialValue(node, measure);
|
|
1446
|
+
}
|
|
1447
|
+
/**
|
|
1448
|
+
* Returns a new MutationObserver instance.
|
|
1449
|
+
* If `MutationObserver` is undefined in the execution environment, returns `undefined`.
|
|
1450
|
+
*/
|
|
1451
|
+
function useMutationObserver(_ref) {
|
|
1452
|
+
let { callback, disabled } = _ref;
|
|
1453
|
+
const handleMutations = useEvent(callback);
|
|
1454
|
+
const mutationObserver = (0, import_react.useMemo)(() => {
|
|
1455
|
+
if (disabled || typeof window === "undefined" || typeof window.MutationObserver === "undefined") return;
|
|
1456
|
+
const { MutationObserver } = window;
|
|
1457
|
+
return new MutationObserver(handleMutations);
|
|
1458
|
+
}, [handleMutations, disabled]);
|
|
1459
|
+
(0, import_react.useEffect)(() => {
|
|
1460
|
+
return () => mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
1461
|
+
}, [mutationObserver]);
|
|
1462
|
+
return mutationObserver;
|
|
1463
|
+
}
|
|
1464
|
+
/**
|
|
1465
|
+
* Returns a new ResizeObserver instance bound to the `onResize` callback.
|
|
1466
|
+
* If `ResizeObserver` is undefined in the execution environment, returns `undefined`.
|
|
1467
|
+
*/
|
|
1468
|
+
function useResizeObserver(_ref) {
|
|
1469
|
+
let { callback, disabled } = _ref;
|
|
1470
|
+
const handleResize = useEvent(callback);
|
|
1471
|
+
const resizeObserver = (0, import_react.useMemo)(() => {
|
|
1472
|
+
if (disabled || typeof window === "undefined" || typeof window.ResizeObserver === "undefined") return;
|
|
1473
|
+
const { ResizeObserver } = window;
|
|
1474
|
+
return new ResizeObserver(handleResize);
|
|
1475
|
+
}, [disabled]);
|
|
1476
|
+
(0, import_react.useEffect)(() => {
|
|
1477
|
+
return () => resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
1478
|
+
}, [resizeObserver]);
|
|
1479
|
+
return resizeObserver;
|
|
1480
|
+
}
|
|
1481
|
+
function defaultMeasure(element) {
|
|
1482
|
+
return new Rect(getClientRect(element), element);
|
|
1483
|
+
}
|
|
1484
|
+
function useRect(element, measure, fallbackRect) {
|
|
1485
|
+
if (measure === void 0) measure = defaultMeasure;
|
|
1486
|
+
const [rect, setRect] = (0, import_react.useState)(null);
|
|
1487
|
+
function measureRect() {
|
|
1488
|
+
setRect((currentRect) => {
|
|
1489
|
+
if (!element) return null;
|
|
1490
|
+
if (element.isConnected === false) {
|
|
1491
|
+
var _ref;
|
|
1492
|
+
return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
|
|
1493
|
+
}
|
|
1494
|
+
const newRect = measure(element);
|
|
1495
|
+
if (JSON.stringify(currentRect) === JSON.stringify(newRect)) return currentRect;
|
|
1496
|
+
return newRect;
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
const mutationObserver = useMutationObserver({ callback(records) {
|
|
1500
|
+
if (!element) return;
|
|
1501
|
+
for (const record of records) {
|
|
1502
|
+
const { type, target } = record;
|
|
1503
|
+
if (type === "childList" && target instanceof HTMLElement && target.contains(element)) {
|
|
1504
|
+
measureRect();
|
|
1505
|
+
break;
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
} });
|
|
1509
|
+
const resizeObserver = useResizeObserver({ callback: measureRect });
|
|
1510
|
+
useIsomorphicLayoutEffect(() => {
|
|
1511
|
+
measureRect();
|
|
1512
|
+
if (element) {
|
|
1513
|
+
resizeObserver?.observe(element);
|
|
1514
|
+
mutationObserver?.observe(document.body, {
|
|
1515
|
+
childList: true,
|
|
1516
|
+
subtree: true
|
|
1517
|
+
});
|
|
1518
|
+
} else {
|
|
1519
|
+
resizeObserver?.disconnect();
|
|
1520
|
+
mutationObserver?.disconnect();
|
|
1521
|
+
}
|
|
1522
|
+
}, [element]);
|
|
1523
|
+
return rect;
|
|
1524
|
+
}
|
|
1525
|
+
function useRectDelta(rect) {
|
|
1526
|
+
return getRectDelta(rect, useInitialValue(rect));
|
|
1527
|
+
}
|
|
1528
|
+
var defaultValue$1 = [];
|
|
1529
|
+
function useScrollableAncestors(node) {
|
|
1530
|
+
const previousNode = (0, import_react.useRef)(node);
|
|
1531
|
+
const ancestors = useLazyMemo((previousValue) => {
|
|
1532
|
+
if (!node) return defaultValue$1;
|
|
1533
|
+
if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) return previousValue;
|
|
1534
|
+
return getScrollableAncestors(node);
|
|
1535
|
+
}, [node]);
|
|
1536
|
+
(0, import_react.useEffect)(() => {
|
|
1537
|
+
previousNode.current = node;
|
|
1538
|
+
}, [node]);
|
|
1539
|
+
return ancestors;
|
|
1540
|
+
}
|
|
1541
|
+
function useScrollOffsets(elements) {
|
|
1542
|
+
const [scrollCoordinates, setScrollCoordinates] = (0, import_react.useState)(null);
|
|
1543
|
+
const prevElements = (0, import_react.useRef)(elements);
|
|
1544
|
+
const handleScroll = (0, import_react.useCallback)((event) => {
|
|
1545
|
+
const scrollingElement = getScrollableElement(event.target);
|
|
1546
|
+
if (!scrollingElement) return;
|
|
1547
|
+
setScrollCoordinates((scrollCoordinates) => {
|
|
1548
|
+
if (!scrollCoordinates) return null;
|
|
1549
|
+
scrollCoordinates.set(scrollingElement, getScrollCoordinates(scrollingElement));
|
|
1550
|
+
return new Map(scrollCoordinates);
|
|
1551
|
+
});
|
|
1552
|
+
}, []);
|
|
1553
|
+
(0, import_react.useEffect)(() => {
|
|
1554
|
+
const previousElements = prevElements.current;
|
|
1555
|
+
if (elements !== previousElements) {
|
|
1556
|
+
cleanup(previousElements);
|
|
1557
|
+
const entries = elements.map((element) => {
|
|
1558
|
+
const scrollableElement = getScrollableElement(element);
|
|
1559
|
+
if (scrollableElement) {
|
|
1560
|
+
scrollableElement.addEventListener("scroll", handleScroll, { passive: true });
|
|
1561
|
+
return [scrollableElement, getScrollCoordinates(scrollableElement)];
|
|
1562
|
+
}
|
|
1563
|
+
return null;
|
|
1564
|
+
}).filter((entry) => entry != null);
|
|
1565
|
+
setScrollCoordinates(entries.length ? new Map(entries) : null);
|
|
1566
|
+
prevElements.current = elements;
|
|
1567
|
+
}
|
|
1568
|
+
return () => {
|
|
1569
|
+
cleanup(elements);
|
|
1570
|
+
cleanup(previousElements);
|
|
1571
|
+
};
|
|
1572
|
+
function cleanup(elements) {
|
|
1573
|
+
elements.forEach((element) => {
|
|
1574
|
+
getScrollableElement(element)?.removeEventListener("scroll", handleScroll);
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1577
|
+
}, [handleScroll, elements]);
|
|
1578
|
+
return (0, import_react.useMemo)(() => {
|
|
1579
|
+
if (elements.length) return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements);
|
|
1580
|
+
return defaultCoordinates;
|
|
1581
|
+
}, [elements, scrollCoordinates]);
|
|
1582
|
+
}
|
|
1583
|
+
function useScrollOffsetsDelta(scrollOffsets, dependencies) {
|
|
1584
|
+
if (dependencies === void 0) dependencies = [];
|
|
1585
|
+
const initialScrollOffsets = (0, import_react.useRef)(null);
|
|
1586
|
+
(0, import_react.useEffect)(() => {
|
|
1587
|
+
initialScrollOffsets.current = null;
|
|
1588
|
+
}, dependencies);
|
|
1589
|
+
(0, import_react.useEffect)(() => {
|
|
1590
|
+
const hasScrollOffsets = scrollOffsets !== defaultCoordinates;
|
|
1591
|
+
if (hasScrollOffsets && !initialScrollOffsets.current) initialScrollOffsets.current = scrollOffsets;
|
|
1592
|
+
if (!hasScrollOffsets && initialScrollOffsets.current) initialScrollOffsets.current = null;
|
|
1593
|
+
}, [scrollOffsets]);
|
|
1594
|
+
return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates;
|
|
1595
|
+
}
|
|
1596
|
+
function useSensorSetup(sensors) {
|
|
1597
|
+
(0, import_react.useEffect)(() => {
|
|
1598
|
+
if (!canUseDOM) return;
|
|
1599
|
+
const teardownFns = sensors.map((_ref) => {
|
|
1600
|
+
let { sensor } = _ref;
|
|
1601
|
+
return sensor.setup == null ? void 0 : sensor.setup();
|
|
1602
|
+
});
|
|
1603
|
+
return () => {
|
|
1604
|
+
for (const teardown of teardownFns) teardown?.();
|
|
1605
|
+
};
|
|
1606
|
+
}, sensors.map((_ref2) => {
|
|
1607
|
+
let { sensor } = _ref2;
|
|
1608
|
+
return sensor;
|
|
1609
|
+
}));
|
|
1610
|
+
}
|
|
1611
|
+
function useSyntheticListeners(listeners, id) {
|
|
1612
|
+
return (0, import_react.useMemo)(() => {
|
|
1613
|
+
return listeners.reduce((acc, _ref) => {
|
|
1614
|
+
let { eventName, handler } = _ref;
|
|
1615
|
+
acc[eventName] = (event) => {
|
|
1616
|
+
handler(event, id);
|
|
1617
|
+
};
|
|
1618
|
+
return acc;
|
|
1619
|
+
}, {});
|
|
1620
|
+
}, [listeners, id]);
|
|
1621
|
+
}
|
|
1622
|
+
function useWindowRect(element) {
|
|
1623
|
+
return (0, import_react.useMemo)(() => element ? getWindowClientRect(element) : null, [element]);
|
|
1624
|
+
}
|
|
1625
|
+
var defaultValue$2 = [];
|
|
1626
|
+
function useRects(elements, measure) {
|
|
1627
|
+
if (measure === void 0) measure = getClientRect;
|
|
1628
|
+
const [firstElement] = elements;
|
|
1629
|
+
const windowRect = useWindowRect(firstElement ? getWindow(firstElement) : null);
|
|
1630
|
+
const [rects, setRects] = (0, import_react.useState)(defaultValue$2);
|
|
1631
|
+
function measureRects() {
|
|
1632
|
+
setRects(() => {
|
|
1633
|
+
if (!elements.length) return defaultValue$2;
|
|
1634
|
+
return elements.map((element) => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
const resizeObserver = useResizeObserver({ callback: measureRects });
|
|
1638
|
+
useIsomorphicLayoutEffect(() => {
|
|
1639
|
+
resizeObserver?.disconnect();
|
|
1640
|
+
measureRects();
|
|
1641
|
+
elements.forEach((element) => resizeObserver == null ? void 0 : resizeObserver.observe(element));
|
|
1642
|
+
}, [elements]);
|
|
1643
|
+
return rects;
|
|
1644
|
+
}
|
|
1645
|
+
function getMeasurableNode(node) {
|
|
1646
|
+
if (!node) return null;
|
|
1647
|
+
if (node.children.length > 1) return node;
|
|
1648
|
+
const firstChild = node.children[0];
|
|
1649
|
+
return isHTMLElement(firstChild) ? firstChild : node;
|
|
1650
|
+
}
|
|
1651
|
+
function useDragOverlayMeasuring(_ref) {
|
|
1652
|
+
let { measure } = _ref;
|
|
1653
|
+
const [rect, setRect] = (0, import_react.useState)(null);
|
|
1654
|
+
const resizeObserver = useResizeObserver({ callback: (0, import_react.useCallback)((entries) => {
|
|
1655
|
+
for (const { target } of entries) if (isHTMLElement(target)) {
|
|
1656
|
+
setRect((rect) => {
|
|
1657
|
+
const newRect = measure(target);
|
|
1658
|
+
return rect ? {
|
|
1659
|
+
...rect,
|
|
1660
|
+
width: newRect.width,
|
|
1661
|
+
height: newRect.height
|
|
1662
|
+
} : newRect;
|
|
1663
|
+
});
|
|
1664
|
+
break;
|
|
1665
|
+
}
|
|
1666
|
+
}, [measure]) });
|
|
1667
|
+
const [nodeRef, setRef] = useNodeRef((0, import_react.useCallback)((element) => {
|
|
1668
|
+
const node = getMeasurableNode(element);
|
|
1669
|
+
resizeObserver?.disconnect();
|
|
1670
|
+
if (node) resizeObserver?.observe(node);
|
|
1671
|
+
setRect(node ? measure(node) : null);
|
|
1672
|
+
}, [measure, resizeObserver]));
|
|
1673
|
+
return (0, import_react.useMemo)(() => ({
|
|
1674
|
+
nodeRef,
|
|
1675
|
+
rect,
|
|
1676
|
+
setRef
|
|
1677
|
+
}), [
|
|
1678
|
+
rect,
|
|
1679
|
+
nodeRef,
|
|
1680
|
+
setRef
|
|
1681
|
+
]);
|
|
1682
|
+
}
|
|
1683
|
+
var defaultSensors = [{
|
|
1684
|
+
sensor: PointerSensor,
|
|
1685
|
+
options: {}
|
|
1686
|
+
}, {
|
|
1687
|
+
sensor: KeyboardSensor,
|
|
1688
|
+
options: {}
|
|
1689
|
+
}];
|
|
1690
|
+
var defaultData = { current: {} };
|
|
1691
|
+
var defaultMeasuringConfiguration = {
|
|
1692
|
+
draggable: { measure: getTransformAgnosticClientRect },
|
|
1693
|
+
droppable: {
|
|
1694
|
+
measure: getTransformAgnosticClientRect,
|
|
1695
|
+
strategy: MeasuringStrategy.WhileDragging,
|
|
1696
|
+
frequency: MeasuringFrequency.Optimized
|
|
1697
|
+
},
|
|
1698
|
+
dragOverlay: { measure: getClientRect }
|
|
1699
|
+
};
|
|
1700
|
+
var DroppableContainersMap = class extends Map {
|
|
1701
|
+
get(id) {
|
|
1702
|
+
var _super$get;
|
|
1703
|
+
return id != null ? (_super$get = super.get(id)) != null ? _super$get : void 0 : void 0;
|
|
1704
|
+
}
|
|
1705
|
+
toArray() {
|
|
1706
|
+
return Array.from(this.values());
|
|
1707
|
+
}
|
|
1708
|
+
getEnabled() {
|
|
1709
|
+
return this.toArray().filter((_ref) => {
|
|
1710
|
+
let { disabled } = _ref;
|
|
1711
|
+
return !disabled;
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1714
|
+
getNodeFor(id) {
|
|
1715
|
+
var _this$get$node$curren, _this$get;
|
|
1716
|
+
return (_this$get$node$curren = (_this$get = this.get(id)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : void 0;
|
|
1717
|
+
}
|
|
1718
|
+
};
|
|
1719
|
+
var defaultPublicContext = {
|
|
1720
|
+
activatorEvent: null,
|
|
1721
|
+
active: null,
|
|
1722
|
+
activeNode: null,
|
|
1723
|
+
activeNodeRect: null,
|
|
1724
|
+
collisions: null,
|
|
1725
|
+
containerNodeRect: null,
|
|
1726
|
+
draggableNodes: /* @__PURE__ */ new Map(),
|
|
1727
|
+
droppableRects: /* @__PURE__ */ new Map(),
|
|
1728
|
+
droppableContainers: /* @__PURE__ */ new DroppableContainersMap(),
|
|
1729
|
+
over: null,
|
|
1730
|
+
dragOverlay: {
|
|
1731
|
+
nodeRef: { current: null },
|
|
1732
|
+
rect: null,
|
|
1733
|
+
setRef: noop
|
|
1734
|
+
},
|
|
1735
|
+
scrollableAncestors: [],
|
|
1736
|
+
scrollableAncestorRects: [],
|
|
1737
|
+
measuringConfiguration: defaultMeasuringConfiguration,
|
|
1738
|
+
measureDroppableContainers: noop,
|
|
1739
|
+
windowRect: null,
|
|
1740
|
+
measuringScheduled: false
|
|
1741
|
+
};
|
|
1742
|
+
var defaultInternalContext = {
|
|
1743
|
+
activatorEvent: null,
|
|
1744
|
+
activators: [],
|
|
1745
|
+
active: null,
|
|
1746
|
+
activeNodeRect: null,
|
|
1747
|
+
ariaDescribedById: { draggable: "" },
|
|
1748
|
+
dispatch: noop,
|
|
1749
|
+
draggableNodes: /* @__PURE__ */ new Map(),
|
|
1750
|
+
over: null,
|
|
1751
|
+
measureDroppableContainers: noop
|
|
1752
|
+
};
|
|
1753
|
+
var InternalContext = /* @__PURE__ */ (0, import_react.createContext)(defaultInternalContext);
|
|
1754
|
+
var PublicContext = /* @__PURE__ */ (0, import_react.createContext)(defaultPublicContext);
|
|
1755
|
+
function getInitialState() {
|
|
1756
|
+
return {
|
|
1757
|
+
draggable: {
|
|
1758
|
+
active: null,
|
|
1759
|
+
initialCoordinates: {
|
|
1760
|
+
x: 0,
|
|
1761
|
+
y: 0
|
|
1762
|
+
},
|
|
1763
|
+
nodes: /* @__PURE__ */ new Map(),
|
|
1764
|
+
translate: {
|
|
1765
|
+
x: 0,
|
|
1766
|
+
y: 0
|
|
1767
|
+
}
|
|
1768
|
+
},
|
|
1769
|
+
droppable: { containers: new DroppableContainersMap() }
|
|
1770
|
+
};
|
|
1771
|
+
}
|
|
1772
|
+
function reducer(state, action) {
|
|
1773
|
+
switch (action.type) {
|
|
1774
|
+
case Action.DragStart: return {
|
|
1775
|
+
...state,
|
|
1776
|
+
draggable: {
|
|
1777
|
+
...state.draggable,
|
|
1778
|
+
initialCoordinates: action.initialCoordinates,
|
|
1779
|
+
active: action.active
|
|
1780
|
+
}
|
|
1781
|
+
};
|
|
1782
|
+
case Action.DragMove:
|
|
1783
|
+
if (state.draggable.active == null) return state;
|
|
1784
|
+
return {
|
|
1785
|
+
...state,
|
|
1786
|
+
draggable: {
|
|
1787
|
+
...state.draggable,
|
|
1788
|
+
translate: {
|
|
1789
|
+
x: action.coordinates.x - state.draggable.initialCoordinates.x,
|
|
1790
|
+
y: action.coordinates.y - state.draggable.initialCoordinates.y
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
};
|
|
1794
|
+
case Action.DragEnd:
|
|
1795
|
+
case Action.DragCancel: return {
|
|
1796
|
+
...state,
|
|
1797
|
+
draggable: {
|
|
1798
|
+
...state.draggable,
|
|
1799
|
+
active: null,
|
|
1800
|
+
initialCoordinates: {
|
|
1801
|
+
x: 0,
|
|
1802
|
+
y: 0
|
|
1803
|
+
},
|
|
1804
|
+
translate: {
|
|
1805
|
+
x: 0,
|
|
1806
|
+
y: 0
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
};
|
|
1810
|
+
case Action.RegisterDroppable: {
|
|
1811
|
+
const { element } = action;
|
|
1812
|
+
const { id } = element;
|
|
1813
|
+
const containers = new DroppableContainersMap(state.droppable.containers);
|
|
1814
|
+
containers.set(id, element);
|
|
1815
|
+
return {
|
|
1816
|
+
...state,
|
|
1817
|
+
droppable: {
|
|
1818
|
+
...state.droppable,
|
|
1819
|
+
containers
|
|
1820
|
+
}
|
|
1821
|
+
};
|
|
1822
|
+
}
|
|
1823
|
+
case Action.SetDroppableDisabled: {
|
|
1824
|
+
const { id, key, disabled } = action;
|
|
1825
|
+
const element = state.droppable.containers.get(id);
|
|
1826
|
+
if (!element || key !== element.key) return state;
|
|
1827
|
+
const containers = new DroppableContainersMap(state.droppable.containers);
|
|
1828
|
+
containers.set(id, {
|
|
1829
|
+
...element,
|
|
1830
|
+
disabled
|
|
1831
|
+
});
|
|
1832
|
+
return {
|
|
1833
|
+
...state,
|
|
1834
|
+
droppable: {
|
|
1835
|
+
...state.droppable,
|
|
1836
|
+
containers
|
|
1837
|
+
}
|
|
1838
|
+
};
|
|
1839
|
+
}
|
|
1840
|
+
case Action.UnregisterDroppable: {
|
|
1841
|
+
const { id, key } = action;
|
|
1842
|
+
const element = state.droppable.containers.get(id);
|
|
1843
|
+
if (!element || key !== element.key) return state;
|
|
1844
|
+
const containers = new DroppableContainersMap(state.droppable.containers);
|
|
1845
|
+
containers.delete(id);
|
|
1846
|
+
return {
|
|
1847
|
+
...state,
|
|
1848
|
+
droppable: {
|
|
1849
|
+
...state.droppable,
|
|
1850
|
+
containers
|
|
1851
|
+
}
|
|
1852
|
+
};
|
|
1853
|
+
}
|
|
1854
|
+
default: return state;
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
function RestoreFocus(_ref) {
|
|
1858
|
+
let { disabled } = _ref;
|
|
1859
|
+
const { active, activatorEvent, draggableNodes } = (0, import_react.useContext)(InternalContext);
|
|
1860
|
+
const previousActivatorEvent = usePrevious(activatorEvent);
|
|
1861
|
+
const previousActiveId = usePrevious(active == null ? void 0 : active.id);
|
|
1862
|
+
(0, import_react.useEffect)(() => {
|
|
1863
|
+
if (disabled) return;
|
|
1864
|
+
if (!activatorEvent && previousActivatorEvent && previousActiveId != null) {
|
|
1865
|
+
if (!isKeyboardEvent(previousActivatorEvent)) return;
|
|
1866
|
+
if (document.activeElement === previousActivatorEvent.target) return;
|
|
1867
|
+
const draggableNode = draggableNodes.get(previousActiveId);
|
|
1868
|
+
if (!draggableNode) return;
|
|
1869
|
+
const { activatorNode, node } = draggableNode;
|
|
1870
|
+
if (!activatorNode.current && !node.current) return;
|
|
1871
|
+
requestAnimationFrame(() => {
|
|
1872
|
+
for (const element of [activatorNode.current, node.current]) {
|
|
1873
|
+
if (!element) continue;
|
|
1874
|
+
const focusableNode = findFirstFocusableNode(element);
|
|
1875
|
+
if (focusableNode) {
|
|
1876
|
+
focusableNode.focus();
|
|
1877
|
+
break;
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1882
|
+
}, [
|
|
1883
|
+
activatorEvent,
|
|
1884
|
+
disabled,
|
|
1885
|
+
draggableNodes,
|
|
1886
|
+
previousActiveId,
|
|
1887
|
+
previousActivatorEvent
|
|
1888
|
+
]);
|
|
1889
|
+
return null;
|
|
1890
|
+
}
|
|
1891
|
+
function applyModifiers(modifiers, _ref) {
|
|
1892
|
+
let { transform, ...args } = _ref;
|
|
1893
|
+
return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => {
|
|
1894
|
+
return modifier({
|
|
1895
|
+
transform: accumulator,
|
|
1896
|
+
...args
|
|
1897
|
+
});
|
|
1898
|
+
}, transform) : transform;
|
|
1899
|
+
}
|
|
1900
|
+
function useMeasuringConfiguration(config) {
|
|
1901
|
+
return (0, import_react.useMemo)(() => ({
|
|
1902
|
+
draggable: {
|
|
1903
|
+
...defaultMeasuringConfiguration.draggable,
|
|
1904
|
+
...config == null ? void 0 : config.draggable
|
|
1905
|
+
},
|
|
1906
|
+
droppable: {
|
|
1907
|
+
...defaultMeasuringConfiguration.droppable,
|
|
1908
|
+
...config == null ? void 0 : config.droppable
|
|
1909
|
+
},
|
|
1910
|
+
dragOverlay: {
|
|
1911
|
+
...defaultMeasuringConfiguration.dragOverlay,
|
|
1912
|
+
...config == null ? void 0 : config.dragOverlay
|
|
1913
|
+
}
|
|
1914
|
+
}), [
|
|
1915
|
+
config == null ? void 0 : config.draggable,
|
|
1916
|
+
config == null ? void 0 : config.droppable,
|
|
1917
|
+
config == null ? void 0 : config.dragOverlay
|
|
1918
|
+
]);
|
|
1919
|
+
}
|
|
1920
|
+
function useLayoutShiftScrollCompensation(_ref) {
|
|
1921
|
+
let { activeNode, measure, initialRect, config = true } = _ref;
|
|
1922
|
+
const initialized = (0, import_react.useRef)(false);
|
|
1923
|
+
const { x, y } = typeof config === "boolean" ? {
|
|
1924
|
+
x: config,
|
|
1925
|
+
y: config
|
|
1926
|
+
} : config;
|
|
1927
|
+
useIsomorphicLayoutEffect(() => {
|
|
1928
|
+
if (!x && !y || !activeNode) {
|
|
1929
|
+
initialized.current = false;
|
|
1930
|
+
return;
|
|
1931
|
+
}
|
|
1932
|
+
if (initialized.current || !initialRect) return;
|
|
1933
|
+
const node = activeNode == null ? void 0 : activeNode.node.current;
|
|
1934
|
+
if (!node || node.isConnected === false) return;
|
|
1935
|
+
const rectDelta = getRectDelta(measure(node), initialRect);
|
|
1936
|
+
if (!x) rectDelta.x = 0;
|
|
1937
|
+
if (!y) rectDelta.y = 0;
|
|
1938
|
+
initialized.current = true;
|
|
1939
|
+
if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) {
|
|
1940
|
+
const firstScrollableAncestor = getFirstScrollableAncestor(node);
|
|
1941
|
+
if (firstScrollableAncestor) firstScrollableAncestor.scrollBy({
|
|
1942
|
+
top: rectDelta.y,
|
|
1943
|
+
left: rectDelta.x
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
}, [
|
|
1947
|
+
activeNode,
|
|
1948
|
+
x,
|
|
1949
|
+
y,
|
|
1950
|
+
initialRect,
|
|
1951
|
+
measure
|
|
1952
|
+
]);
|
|
1953
|
+
}
|
|
1954
|
+
var ActiveDraggableContext = /* @__PURE__ */ (0, import_react.createContext)({
|
|
1955
|
+
...defaultCoordinates,
|
|
1956
|
+
scaleX: 1,
|
|
1957
|
+
scaleY: 1
|
|
1958
|
+
});
|
|
1959
|
+
var Status;
|
|
1960
|
+
(function(Status) {
|
|
1961
|
+
Status[Status["Uninitialized"] = 0] = "Uninitialized";
|
|
1962
|
+
Status[Status["Initializing"] = 1] = "Initializing";
|
|
1963
|
+
Status[Status["Initialized"] = 2] = "Initialized";
|
|
1964
|
+
})(Status || (Status = {}));
|
|
1965
|
+
var DndContext = /* @__PURE__ */ (0, import_react.memo)(function DndContext(_ref) {
|
|
1966
|
+
var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect;
|
|
1967
|
+
let { id, accessibility, autoScroll = true, children, sensors = defaultSensors, collisionDetection = rectIntersection, measuring, modifiers, ...props } = _ref;
|
|
1968
|
+
const [state, dispatch] = (0, import_react.useReducer)(reducer, void 0, getInitialState);
|
|
1969
|
+
const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider();
|
|
1970
|
+
const [status, setStatus] = (0, import_react.useState)(Status.Uninitialized);
|
|
1971
|
+
const isInitialized = status === Status.Initialized;
|
|
1972
|
+
const { draggable: { active: activeId, nodes: draggableNodes, translate }, droppable: { containers: droppableContainers } } = state;
|
|
1973
|
+
const node = activeId != null ? draggableNodes.get(activeId) : null;
|
|
1974
|
+
const activeRects = (0, import_react.useRef)({
|
|
1975
|
+
initial: null,
|
|
1976
|
+
translated: null
|
|
1977
|
+
});
|
|
1978
|
+
const active = (0, import_react.useMemo)(() => {
|
|
1979
|
+
var _node$data;
|
|
1980
|
+
return activeId != null ? {
|
|
1981
|
+
id: activeId,
|
|
1982
|
+
data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData,
|
|
1983
|
+
rect: activeRects
|
|
1984
|
+
} : null;
|
|
1985
|
+
}, [activeId, node]);
|
|
1986
|
+
const activeRef = (0, import_react.useRef)(null);
|
|
1987
|
+
const [activeSensor, setActiveSensor] = (0, import_react.useState)(null);
|
|
1988
|
+
const [activatorEvent, setActivatorEvent] = (0, import_react.useState)(null);
|
|
1989
|
+
const latestProps = useLatestValue(props, Object.values(props));
|
|
1990
|
+
const draggableDescribedById = useUniqueId("DndDescribedBy", id);
|
|
1991
|
+
const enabledDroppableContainers = (0, import_react.useMemo)(() => droppableContainers.getEnabled(), [droppableContainers]);
|
|
1992
|
+
const measuringConfiguration = useMeasuringConfiguration(measuring);
|
|
1993
|
+
const { droppableRects, measureDroppableContainers, measuringScheduled } = useDroppableMeasuring(enabledDroppableContainers, {
|
|
1994
|
+
dragging: isInitialized,
|
|
1995
|
+
dependencies: [translate.x, translate.y],
|
|
1996
|
+
config: measuringConfiguration.droppable
|
|
1997
|
+
});
|
|
1998
|
+
const activeNode = useCachedNode(draggableNodes, activeId);
|
|
1999
|
+
const activationCoordinates = (0, import_react.useMemo)(() => activatorEvent ? getEventCoordinates(activatorEvent) : null, [activatorEvent]);
|
|
2000
|
+
const autoScrollOptions = getAutoScrollerOptions();
|
|
2001
|
+
const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);
|
|
2002
|
+
useLayoutShiftScrollCompensation({
|
|
2003
|
+
activeNode: activeId != null ? draggableNodes.get(activeId) : null,
|
|
2004
|
+
config: autoScrollOptions.layoutShiftCompensation,
|
|
2005
|
+
initialRect: initialActiveNodeRect,
|
|
2006
|
+
measure: measuringConfiguration.draggable.measure
|
|
2007
|
+
});
|
|
2008
|
+
const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect);
|
|
2009
|
+
const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null);
|
|
2010
|
+
const sensorContext = (0, import_react.useRef)({
|
|
2011
|
+
activatorEvent: null,
|
|
2012
|
+
active: null,
|
|
2013
|
+
activeNode,
|
|
2014
|
+
collisionRect: null,
|
|
2015
|
+
collisions: null,
|
|
2016
|
+
droppableRects,
|
|
2017
|
+
draggableNodes,
|
|
2018
|
+
draggingNode: null,
|
|
2019
|
+
draggingNodeRect: null,
|
|
2020
|
+
droppableContainers,
|
|
2021
|
+
over: null,
|
|
2022
|
+
scrollableAncestors: [],
|
|
2023
|
+
scrollAdjustedTranslate: null
|
|
2024
|
+
});
|
|
2025
|
+
const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id);
|
|
2026
|
+
const dragOverlay = useDragOverlayMeasuring({ measure: measuringConfiguration.dragOverlay.measure });
|
|
2027
|
+
const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode;
|
|
2028
|
+
const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null;
|
|
2029
|
+
const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect);
|
|
2030
|
+
const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect);
|
|
2031
|
+
const windowRect = useWindowRect(draggingNode ? getWindow(draggingNode) : null);
|
|
2032
|
+
const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null);
|
|
2033
|
+
const scrollableAncestorRects = useRects(scrollableAncestors);
|
|
2034
|
+
const modifiedTranslate = applyModifiers(modifiers, {
|
|
2035
|
+
transform: {
|
|
2036
|
+
x: translate.x - nodeRectDelta.x,
|
|
2037
|
+
y: translate.y - nodeRectDelta.y,
|
|
2038
|
+
scaleX: 1,
|
|
2039
|
+
scaleY: 1
|
|
2040
|
+
},
|
|
2041
|
+
activatorEvent,
|
|
2042
|
+
active,
|
|
2043
|
+
activeNodeRect,
|
|
2044
|
+
containerNodeRect,
|
|
2045
|
+
draggingNodeRect,
|
|
2046
|
+
over: sensorContext.current.over,
|
|
2047
|
+
overlayNodeRect: dragOverlay.rect,
|
|
2048
|
+
scrollableAncestors,
|
|
2049
|
+
scrollableAncestorRects,
|
|
2050
|
+
windowRect
|
|
2051
|
+
});
|
|
2052
|
+
const pointerCoordinates = activationCoordinates ? add(activationCoordinates, translate) : null;
|
|
2053
|
+
const scrollOffsets = useScrollOffsets(scrollableAncestors);
|
|
2054
|
+
const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets);
|
|
2055
|
+
const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]);
|
|
2056
|
+
const scrollAdjustedTranslate = add(modifiedTranslate, scrollAdjustment);
|
|
2057
|
+
const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null;
|
|
2058
|
+
const collisions = active && collisionRect ? collisionDetection({
|
|
2059
|
+
active,
|
|
2060
|
+
collisionRect,
|
|
2061
|
+
droppableRects,
|
|
2062
|
+
droppableContainers: enabledDroppableContainers,
|
|
2063
|
+
pointerCoordinates
|
|
2064
|
+
}) : null;
|
|
2065
|
+
const overId = getFirstCollision(collisions, "id");
|
|
2066
|
+
const [over, setOver] = (0, import_react.useState)(null);
|
|
2067
|
+
const transform = adjustScale(usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta), (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);
|
|
2068
|
+
const activeSensorRef = (0, import_react.useRef)(null);
|
|
2069
|
+
const instantiateSensor = (0, import_react.useCallback)((event, _ref2) => {
|
|
2070
|
+
let { sensor: Sensor, options } = _ref2;
|
|
2071
|
+
if (activeRef.current == null) return;
|
|
2072
|
+
const activeNode = draggableNodes.get(activeRef.current);
|
|
2073
|
+
if (!activeNode) return;
|
|
2074
|
+
const activatorEvent = event.nativeEvent;
|
|
2075
|
+
activeSensorRef.current = new Sensor({
|
|
2076
|
+
active: activeRef.current,
|
|
2077
|
+
activeNode,
|
|
2078
|
+
event: activatorEvent,
|
|
2079
|
+
options,
|
|
2080
|
+
context: sensorContext,
|
|
2081
|
+
onAbort(id) {
|
|
2082
|
+
if (!draggableNodes.get(id)) return;
|
|
2083
|
+
const { onDragAbort } = latestProps.current;
|
|
2084
|
+
const event = { id };
|
|
2085
|
+
onDragAbort?.(event);
|
|
2086
|
+
dispatchMonitorEvent({
|
|
2087
|
+
type: "onDragAbort",
|
|
2088
|
+
event
|
|
2089
|
+
});
|
|
2090
|
+
},
|
|
2091
|
+
onPending(id, constraint, initialCoordinates, offset) {
|
|
2092
|
+
if (!draggableNodes.get(id)) return;
|
|
2093
|
+
const { onDragPending } = latestProps.current;
|
|
2094
|
+
const event = {
|
|
2095
|
+
id,
|
|
2096
|
+
constraint,
|
|
2097
|
+
initialCoordinates,
|
|
2098
|
+
offset
|
|
2099
|
+
};
|
|
2100
|
+
onDragPending?.(event);
|
|
2101
|
+
dispatchMonitorEvent({
|
|
2102
|
+
type: "onDragPending",
|
|
2103
|
+
event
|
|
2104
|
+
});
|
|
2105
|
+
},
|
|
2106
|
+
onStart(initialCoordinates) {
|
|
2107
|
+
const id = activeRef.current;
|
|
2108
|
+
if (id == null) return;
|
|
2109
|
+
const draggableNode = draggableNodes.get(id);
|
|
2110
|
+
if (!draggableNode) return;
|
|
2111
|
+
const { onDragStart } = latestProps.current;
|
|
2112
|
+
const event = {
|
|
2113
|
+
activatorEvent,
|
|
2114
|
+
active: {
|
|
2115
|
+
id,
|
|
2116
|
+
data: draggableNode.data,
|
|
2117
|
+
rect: activeRects
|
|
2118
|
+
}
|
|
2119
|
+
};
|
|
2120
|
+
(0, import_react_dom.unstable_batchedUpdates)(() => {
|
|
2121
|
+
onDragStart?.(event);
|
|
2122
|
+
setStatus(Status.Initializing);
|
|
2123
|
+
dispatch({
|
|
2124
|
+
type: Action.DragStart,
|
|
2125
|
+
initialCoordinates,
|
|
2126
|
+
active: id
|
|
2127
|
+
});
|
|
2128
|
+
dispatchMonitorEvent({
|
|
2129
|
+
type: "onDragStart",
|
|
2130
|
+
event
|
|
2131
|
+
});
|
|
2132
|
+
setActiveSensor(activeSensorRef.current);
|
|
2133
|
+
setActivatorEvent(activatorEvent);
|
|
2134
|
+
});
|
|
2135
|
+
},
|
|
2136
|
+
onMove(coordinates) {
|
|
2137
|
+
dispatch({
|
|
2138
|
+
type: Action.DragMove,
|
|
2139
|
+
coordinates
|
|
2140
|
+
});
|
|
2141
|
+
},
|
|
2142
|
+
onEnd: createHandler(Action.DragEnd),
|
|
2143
|
+
onCancel: createHandler(Action.DragCancel)
|
|
2144
|
+
});
|
|
2145
|
+
function createHandler(type) {
|
|
2146
|
+
return async function handler() {
|
|
2147
|
+
const { active, collisions, over, scrollAdjustedTranslate } = sensorContext.current;
|
|
2148
|
+
let event = null;
|
|
2149
|
+
if (active && scrollAdjustedTranslate) {
|
|
2150
|
+
const { cancelDrop } = latestProps.current;
|
|
2151
|
+
event = {
|
|
2152
|
+
activatorEvent,
|
|
2153
|
+
active,
|
|
2154
|
+
collisions,
|
|
2155
|
+
delta: scrollAdjustedTranslate,
|
|
2156
|
+
over
|
|
2157
|
+
};
|
|
2158
|
+
if (type === Action.DragEnd && typeof cancelDrop === "function") {
|
|
2159
|
+
if (await Promise.resolve(cancelDrop(event))) type = Action.DragCancel;
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
activeRef.current = null;
|
|
2163
|
+
(0, import_react_dom.unstable_batchedUpdates)(() => {
|
|
2164
|
+
dispatch({ type });
|
|
2165
|
+
setStatus(Status.Uninitialized);
|
|
2166
|
+
setOver(null);
|
|
2167
|
+
setActiveSensor(null);
|
|
2168
|
+
setActivatorEvent(null);
|
|
2169
|
+
activeSensorRef.current = null;
|
|
2170
|
+
const eventName = type === Action.DragEnd ? "onDragEnd" : "onDragCancel";
|
|
2171
|
+
if (event) {
|
|
2172
|
+
const handler = latestProps.current[eventName];
|
|
2173
|
+
handler?.(event);
|
|
2174
|
+
dispatchMonitorEvent({
|
|
2175
|
+
type: eventName,
|
|
2176
|
+
event
|
|
2177
|
+
});
|
|
2178
|
+
}
|
|
2179
|
+
});
|
|
2180
|
+
};
|
|
2181
|
+
}
|
|
2182
|
+
}, [draggableNodes]);
|
|
2183
|
+
const activators = useCombineActivators(sensors, (0, import_react.useCallback)((handler, sensor) => {
|
|
2184
|
+
return (event, active) => {
|
|
2185
|
+
const nativeEvent = event.nativeEvent;
|
|
2186
|
+
const activeDraggableNode = draggableNodes.get(active);
|
|
2187
|
+
if (activeRef.current !== null || !activeDraggableNode || nativeEvent.dndKit || nativeEvent.defaultPrevented) return;
|
|
2188
|
+
const activationContext = { active: activeDraggableNode };
|
|
2189
|
+
if (handler(event, sensor.options, activationContext) === true) {
|
|
2190
|
+
nativeEvent.dndKit = { capturedBy: sensor.sensor };
|
|
2191
|
+
activeRef.current = active;
|
|
2192
|
+
instantiateSensor(event, sensor);
|
|
2193
|
+
}
|
|
2194
|
+
};
|
|
2195
|
+
}, [draggableNodes, instantiateSensor]));
|
|
2196
|
+
useSensorSetup(sensors);
|
|
2197
|
+
useIsomorphicLayoutEffect(() => {
|
|
2198
|
+
if (activeNodeRect && status === Status.Initializing) setStatus(Status.Initialized);
|
|
2199
|
+
}, [activeNodeRect, status]);
|
|
2200
|
+
(0, import_react.useEffect)(() => {
|
|
2201
|
+
const { onDragMove } = latestProps.current;
|
|
2202
|
+
const { active, activatorEvent, collisions, over } = sensorContext.current;
|
|
2203
|
+
if (!active || !activatorEvent) return;
|
|
2204
|
+
const event = {
|
|
2205
|
+
active,
|
|
2206
|
+
activatorEvent,
|
|
2207
|
+
collisions,
|
|
2208
|
+
delta: {
|
|
2209
|
+
x: scrollAdjustedTranslate.x,
|
|
2210
|
+
y: scrollAdjustedTranslate.y
|
|
2211
|
+
},
|
|
2212
|
+
over
|
|
2213
|
+
};
|
|
2214
|
+
(0, import_react_dom.unstable_batchedUpdates)(() => {
|
|
2215
|
+
onDragMove?.(event);
|
|
2216
|
+
dispatchMonitorEvent({
|
|
2217
|
+
type: "onDragMove",
|
|
2218
|
+
event
|
|
2219
|
+
});
|
|
2220
|
+
});
|
|
2221
|
+
}, [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y]);
|
|
2222
|
+
(0, import_react.useEffect)(() => {
|
|
2223
|
+
const { active, activatorEvent, collisions, droppableContainers, scrollAdjustedTranslate } = sensorContext.current;
|
|
2224
|
+
if (!active || activeRef.current == null || !activatorEvent || !scrollAdjustedTranslate) return;
|
|
2225
|
+
const { onDragOver } = latestProps.current;
|
|
2226
|
+
const overContainer = droppableContainers.get(overId);
|
|
2227
|
+
const over = overContainer && overContainer.rect.current ? {
|
|
2228
|
+
id: overContainer.id,
|
|
2229
|
+
rect: overContainer.rect.current,
|
|
2230
|
+
data: overContainer.data,
|
|
2231
|
+
disabled: overContainer.disabled
|
|
2232
|
+
} : null;
|
|
2233
|
+
const event = {
|
|
2234
|
+
active,
|
|
2235
|
+
activatorEvent,
|
|
2236
|
+
collisions,
|
|
2237
|
+
delta: {
|
|
2238
|
+
x: scrollAdjustedTranslate.x,
|
|
2239
|
+
y: scrollAdjustedTranslate.y
|
|
2240
|
+
},
|
|
2241
|
+
over
|
|
2242
|
+
};
|
|
2243
|
+
(0, import_react_dom.unstable_batchedUpdates)(() => {
|
|
2244
|
+
setOver(over);
|
|
2245
|
+
onDragOver?.(event);
|
|
2246
|
+
dispatchMonitorEvent({
|
|
2247
|
+
type: "onDragOver",
|
|
2248
|
+
event
|
|
2249
|
+
});
|
|
2250
|
+
});
|
|
2251
|
+
}, [overId]);
|
|
2252
|
+
useIsomorphicLayoutEffect(() => {
|
|
2253
|
+
sensorContext.current = {
|
|
2254
|
+
activatorEvent,
|
|
2255
|
+
active,
|
|
2256
|
+
activeNode,
|
|
2257
|
+
collisionRect,
|
|
2258
|
+
collisions,
|
|
2259
|
+
droppableRects,
|
|
2260
|
+
draggableNodes,
|
|
2261
|
+
draggingNode,
|
|
2262
|
+
draggingNodeRect,
|
|
2263
|
+
droppableContainers,
|
|
2264
|
+
over,
|
|
2265
|
+
scrollableAncestors,
|
|
2266
|
+
scrollAdjustedTranslate
|
|
2267
|
+
};
|
|
2268
|
+
activeRects.current = {
|
|
2269
|
+
initial: draggingNodeRect,
|
|
2270
|
+
translated: collisionRect
|
|
2271
|
+
};
|
|
2272
|
+
}, [
|
|
2273
|
+
active,
|
|
2274
|
+
activeNode,
|
|
2275
|
+
collisions,
|
|
2276
|
+
collisionRect,
|
|
2277
|
+
draggableNodes,
|
|
2278
|
+
draggingNode,
|
|
2279
|
+
draggingNodeRect,
|
|
2280
|
+
droppableRects,
|
|
2281
|
+
droppableContainers,
|
|
2282
|
+
over,
|
|
2283
|
+
scrollableAncestors,
|
|
2284
|
+
scrollAdjustedTranslate
|
|
2285
|
+
]);
|
|
2286
|
+
useAutoScroller({
|
|
2287
|
+
...autoScrollOptions,
|
|
2288
|
+
delta: translate,
|
|
2289
|
+
draggingRect: collisionRect,
|
|
2290
|
+
pointerCoordinates,
|
|
2291
|
+
scrollableAncestors,
|
|
2292
|
+
scrollableAncestorRects
|
|
2293
|
+
});
|
|
2294
|
+
const publicContext = (0, import_react.useMemo)(() => {
|
|
2295
|
+
return {
|
|
2296
|
+
active,
|
|
2297
|
+
activeNode,
|
|
2298
|
+
activeNodeRect,
|
|
2299
|
+
activatorEvent,
|
|
2300
|
+
collisions,
|
|
2301
|
+
containerNodeRect,
|
|
2302
|
+
dragOverlay,
|
|
2303
|
+
draggableNodes,
|
|
2304
|
+
droppableContainers,
|
|
2305
|
+
droppableRects,
|
|
2306
|
+
over,
|
|
2307
|
+
measureDroppableContainers,
|
|
2308
|
+
scrollableAncestors,
|
|
2309
|
+
scrollableAncestorRects,
|
|
2310
|
+
measuringConfiguration,
|
|
2311
|
+
measuringScheduled,
|
|
2312
|
+
windowRect
|
|
2313
|
+
};
|
|
2314
|
+
}, [
|
|
2315
|
+
active,
|
|
2316
|
+
activeNode,
|
|
2317
|
+
activeNodeRect,
|
|
2318
|
+
activatorEvent,
|
|
2319
|
+
collisions,
|
|
2320
|
+
containerNodeRect,
|
|
2321
|
+
dragOverlay,
|
|
2322
|
+
draggableNodes,
|
|
2323
|
+
droppableContainers,
|
|
2324
|
+
droppableRects,
|
|
2325
|
+
over,
|
|
2326
|
+
measureDroppableContainers,
|
|
2327
|
+
scrollableAncestors,
|
|
2328
|
+
scrollableAncestorRects,
|
|
2329
|
+
measuringConfiguration,
|
|
2330
|
+
measuringScheduled,
|
|
2331
|
+
windowRect
|
|
2332
|
+
]);
|
|
2333
|
+
const internalContext = (0, import_react.useMemo)(() => {
|
|
2334
|
+
return {
|
|
2335
|
+
activatorEvent,
|
|
2336
|
+
activators,
|
|
2337
|
+
active,
|
|
2338
|
+
activeNodeRect,
|
|
2339
|
+
ariaDescribedById: { draggable: draggableDescribedById },
|
|
2340
|
+
dispatch,
|
|
2341
|
+
draggableNodes,
|
|
2342
|
+
over,
|
|
2343
|
+
measureDroppableContainers
|
|
2344
|
+
};
|
|
2345
|
+
}, [
|
|
2346
|
+
activatorEvent,
|
|
2347
|
+
activators,
|
|
2348
|
+
active,
|
|
2349
|
+
activeNodeRect,
|
|
2350
|
+
dispatch,
|
|
2351
|
+
draggableDescribedById,
|
|
2352
|
+
draggableNodes,
|
|
2353
|
+
over,
|
|
2354
|
+
measureDroppableContainers
|
|
2355
|
+
]);
|
|
2356
|
+
return import_react.createElement(DndMonitorContext.Provider, { value: registerMonitorListener }, import_react.createElement(InternalContext.Provider, { value: internalContext }, import_react.createElement(PublicContext.Provider, { value: publicContext }, import_react.createElement(ActiveDraggableContext.Provider, { value: transform }, children)), import_react.createElement(RestoreFocus, { disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false })), import_react.createElement(Accessibility, {
|
|
2357
|
+
...accessibility,
|
|
2358
|
+
hiddenTextDescribedById: draggableDescribedById
|
|
2359
|
+
}));
|
|
2360
|
+
function getAutoScrollerOptions() {
|
|
2361
|
+
const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false;
|
|
2362
|
+
const autoScrollGloballyDisabled = typeof autoScroll === "object" ? autoScroll.enabled === false : autoScroll === false;
|
|
2363
|
+
const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled;
|
|
2364
|
+
if (typeof autoScroll === "object") return {
|
|
2365
|
+
...autoScroll,
|
|
2366
|
+
enabled
|
|
2367
|
+
};
|
|
2368
|
+
return { enabled };
|
|
2369
|
+
}
|
|
2370
|
+
});
|
|
2371
|
+
var NullContext = /* @__PURE__ */ (0, import_react.createContext)(null);
|
|
2372
|
+
var defaultRole = "button";
|
|
2373
|
+
var ID_PREFIX = "Draggable";
|
|
2374
|
+
function useDraggable(_ref) {
|
|
2375
|
+
let { id, data, disabled = false, attributes } = _ref;
|
|
2376
|
+
const key = useUniqueId(ID_PREFIX);
|
|
2377
|
+
const { activators, activatorEvent, active, activeNodeRect, ariaDescribedById, draggableNodes, over } = (0, import_react.useContext)(InternalContext);
|
|
2378
|
+
const { role = defaultRole, roleDescription = "draggable", tabIndex = 0 } = attributes != null ? attributes : {};
|
|
2379
|
+
const isDragging = (active == null ? void 0 : active.id) === id;
|
|
2380
|
+
const transform = (0, import_react.useContext)(isDragging ? ActiveDraggableContext : NullContext);
|
|
2381
|
+
const [node, setNodeRef] = useNodeRef();
|
|
2382
|
+
const [activatorNode, setActivatorNodeRef] = useNodeRef();
|
|
2383
|
+
const listeners = useSyntheticListeners(activators, id);
|
|
2384
|
+
const dataRef = useLatestValue(data);
|
|
2385
|
+
useIsomorphicLayoutEffect(() => {
|
|
2386
|
+
draggableNodes.set(id, {
|
|
2387
|
+
id,
|
|
2388
|
+
key,
|
|
2389
|
+
node,
|
|
2390
|
+
activatorNode,
|
|
2391
|
+
data: dataRef
|
|
2392
|
+
});
|
|
2393
|
+
return () => {
|
|
2394
|
+
const node = draggableNodes.get(id);
|
|
2395
|
+
if (node && node.key === key) draggableNodes.delete(id);
|
|
2396
|
+
};
|
|
2397
|
+
}, [draggableNodes, id]);
|
|
2398
|
+
return {
|
|
2399
|
+
active,
|
|
2400
|
+
activatorEvent,
|
|
2401
|
+
activeNodeRect,
|
|
2402
|
+
attributes: (0, import_react.useMemo)(() => ({
|
|
2403
|
+
role,
|
|
2404
|
+
tabIndex,
|
|
2405
|
+
"aria-disabled": disabled,
|
|
2406
|
+
"aria-pressed": isDragging && role === defaultRole ? true : void 0,
|
|
2407
|
+
"aria-roledescription": roleDescription,
|
|
2408
|
+
"aria-describedby": ariaDescribedById.draggable
|
|
2409
|
+
}), [
|
|
2410
|
+
disabled,
|
|
2411
|
+
role,
|
|
2412
|
+
tabIndex,
|
|
2413
|
+
isDragging,
|
|
2414
|
+
roleDescription,
|
|
2415
|
+
ariaDescribedById.draggable
|
|
2416
|
+
]),
|
|
2417
|
+
isDragging,
|
|
2418
|
+
listeners: disabled ? void 0 : listeners,
|
|
2419
|
+
node,
|
|
2420
|
+
over,
|
|
2421
|
+
setNodeRef,
|
|
2422
|
+
setActivatorNodeRef,
|
|
2423
|
+
transform
|
|
2424
|
+
};
|
|
2425
|
+
}
|
|
2426
|
+
function useDndContext() {
|
|
2427
|
+
return (0, import_react.useContext)(PublicContext);
|
|
2428
|
+
}
|
|
2429
|
+
var ID_PREFIX$1 = "Droppable";
|
|
2430
|
+
var defaultResizeObserverConfig = { timeout: 25 };
|
|
2431
|
+
function useDroppable(_ref) {
|
|
2432
|
+
let { data, disabled = false, id, resizeObserverConfig } = _ref;
|
|
2433
|
+
const key = useUniqueId(ID_PREFIX$1);
|
|
2434
|
+
const { active, dispatch, over, measureDroppableContainers } = (0, import_react.useContext)(InternalContext);
|
|
2435
|
+
const previous = (0, import_react.useRef)({ disabled });
|
|
2436
|
+
const resizeObserverConnected = (0, import_react.useRef)(false);
|
|
2437
|
+
const rect = (0, import_react.useRef)(null);
|
|
2438
|
+
const callbackId = (0, import_react.useRef)(null);
|
|
2439
|
+
const { disabled: resizeObserverDisabled, updateMeasurementsFor, timeout: resizeObserverTimeout } = {
|
|
2440
|
+
...defaultResizeObserverConfig,
|
|
2441
|
+
...resizeObserverConfig
|
|
2442
|
+
};
|
|
2443
|
+
const ids = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id);
|
|
2444
|
+
const resizeObserver = useResizeObserver({
|
|
2445
|
+
callback: (0, import_react.useCallback)(() => {
|
|
2446
|
+
if (!resizeObserverConnected.current) {
|
|
2447
|
+
resizeObserverConnected.current = true;
|
|
2448
|
+
return;
|
|
2449
|
+
}
|
|
2450
|
+
if (callbackId.current != null) clearTimeout(callbackId.current);
|
|
2451
|
+
callbackId.current = setTimeout(() => {
|
|
2452
|
+
measureDroppableContainers(Array.isArray(ids.current) ? ids.current : [ids.current]);
|
|
2453
|
+
callbackId.current = null;
|
|
2454
|
+
}, resizeObserverTimeout);
|
|
2455
|
+
}, [resizeObserverTimeout]),
|
|
2456
|
+
disabled: resizeObserverDisabled || !active
|
|
2457
|
+
});
|
|
2458
|
+
const [nodeRef, setNodeRef] = useNodeRef((0, import_react.useCallback)((newElement, previousElement) => {
|
|
2459
|
+
if (!resizeObserver) return;
|
|
2460
|
+
if (previousElement) {
|
|
2461
|
+
resizeObserver.unobserve(previousElement);
|
|
2462
|
+
resizeObserverConnected.current = false;
|
|
2463
|
+
}
|
|
2464
|
+
if (newElement) resizeObserver.observe(newElement);
|
|
2465
|
+
}, [resizeObserver]));
|
|
2466
|
+
const dataRef = useLatestValue(data);
|
|
2467
|
+
(0, import_react.useEffect)(() => {
|
|
2468
|
+
if (!resizeObserver || !nodeRef.current) return;
|
|
2469
|
+
resizeObserver.disconnect();
|
|
2470
|
+
resizeObserverConnected.current = false;
|
|
2471
|
+
resizeObserver.observe(nodeRef.current);
|
|
2472
|
+
}, [nodeRef, resizeObserver]);
|
|
2473
|
+
(0, import_react.useEffect)(() => {
|
|
2474
|
+
dispatch({
|
|
2475
|
+
type: Action.RegisterDroppable,
|
|
2476
|
+
element: {
|
|
2477
|
+
id,
|
|
2478
|
+
key,
|
|
2479
|
+
disabled,
|
|
2480
|
+
node: nodeRef,
|
|
2481
|
+
rect,
|
|
2482
|
+
data: dataRef
|
|
2483
|
+
}
|
|
2484
|
+
});
|
|
2485
|
+
return () => dispatch({
|
|
2486
|
+
type: Action.UnregisterDroppable,
|
|
2487
|
+
key,
|
|
2488
|
+
id
|
|
2489
|
+
});
|
|
2490
|
+
}, [id]);
|
|
2491
|
+
(0, import_react.useEffect)(() => {
|
|
2492
|
+
if (disabled !== previous.current.disabled) {
|
|
2493
|
+
dispatch({
|
|
2494
|
+
type: Action.SetDroppableDisabled,
|
|
2495
|
+
id,
|
|
2496
|
+
key,
|
|
2497
|
+
disabled
|
|
2498
|
+
});
|
|
2499
|
+
previous.current.disabled = disabled;
|
|
2500
|
+
}
|
|
2501
|
+
}, [
|
|
2502
|
+
id,
|
|
2503
|
+
key,
|
|
2504
|
+
disabled,
|
|
2505
|
+
dispatch
|
|
2506
|
+
]);
|
|
2507
|
+
return {
|
|
2508
|
+
active,
|
|
2509
|
+
rect,
|
|
2510
|
+
isOver: (over == null ? void 0 : over.id) === id,
|
|
2511
|
+
node: nodeRef,
|
|
2512
|
+
over,
|
|
2513
|
+
setNodeRef
|
|
2514
|
+
};
|
|
2515
|
+
}
|
|
2516
|
+
function AnimationManager(_ref) {
|
|
2517
|
+
let { animation, children } = _ref;
|
|
2518
|
+
const [clonedChildren, setClonedChildren] = (0, import_react.useState)(null);
|
|
2519
|
+
const [element, setElement] = (0, import_react.useState)(null);
|
|
2520
|
+
const previousChildren = usePrevious(children);
|
|
2521
|
+
if (!children && !clonedChildren && previousChildren) setClonedChildren(previousChildren);
|
|
2522
|
+
useIsomorphicLayoutEffect(() => {
|
|
2523
|
+
if (!element) return;
|
|
2524
|
+
const key = clonedChildren == null ? void 0 : clonedChildren.key;
|
|
2525
|
+
const id = clonedChildren == null ? void 0 : clonedChildren.props.id;
|
|
2526
|
+
if (key == null || id == null) {
|
|
2527
|
+
setClonedChildren(null);
|
|
2528
|
+
return;
|
|
2529
|
+
}
|
|
2530
|
+
Promise.resolve(animation(id, element)).then(() => {
|
|
2531
|
+
setClonedChildren(null);
|
|
2532
|
+
});
|
|
2533
|
+
}, [
|
|
2534
|
+
animation,
|
|
2535
|
+
clonedChildren,
|
|
2536
|
+
element
|
|
2537
|
+
]);
|
|
2538
|
+
return import_react.createElement(import_react.Fragment, null, children, clonedChildren ? (0, import_react.cloneElement)(clonedChildren, { ref: setElement }) : null);
|
|
2539
|
+
}
|
|
2540
|
+
var defaultTransform = {
|
|
2541
|
+
x: 0,
|
|
2542
|
+
y: 0,
|
|
2543
|
+
scaleX: 1,
|
|
2544
|
+
scaleY: 1
|
|
2545
|
+
};
|
|
2546
|
+
function NullifiedContextProvider(_ref) {
|
|
2547
|
+
let { children } = _ref;
|
|
2548
|
+
return import_react.createElement(InternalContext.Provider, { value: defaultInternalContext }, import_react.createElement(ActiveDraggableContext.Provider, { value: defaultTransform }, children));
|
|
2549
|
+
}
|
|
2550
|
+
var baseStyles = {
|
|
2551
|
+
position: "fixed",
|
|
2552
|
+
touchAction: "none"
|
|
2553
|
+
};
|
|
2554
|
+
var defaultTransition = (activatorEvent) => {
|
|
2555
|
+
return isKeyboardEvent(activatorEvent) ? "transform 250ms ease" : void 0;
|
|
2556
|
+
};
|
|
2557
|
+
var PositionedOverlay = /* @__PURE__ */ (0, import_react.forwardRef)((_ref, ref) => {
|
|
2558
|
+
let { as, activatorEvent, adjustScale, children, className, rect, style, transform, transition = defaultTransition } = _ref;
|
|
2559
|
+
if (!rect) return null;
|
|
2560
|
+
const scaleAdjustedTransform = adjustScale ? transform : {
|
|
2561
|
+
...transform,
|
|
2562
|
+
scaleX: 1,
|
|
2563
|
+
scaleY: 1
|
|
2564
|
+
};
|
|
2565
|
+
const styles = {
|
|
2566
|
+
...baseStyles,
|
|
2567
|
+
width: rect.width,
|
|
2568
|
+
height: rect.height,
|
|
2569
|
+
top: rect.top,
|
|
2570
|
+
left: rect.left,
|
|
2571
|
+
transform: CSS.Transform.toString(scaleAdjustedTransform),
|
|
2572
|
+
transformOrigin: adjustScale && activatorEvent ? getRelativeTransformOrigin(activatorEvent, rect) : void 0,
|
|
2573
|
+
transition: typeof transition === "function" ? transition(activatorEvent) : transition,
|
|
2574
|
+
...style
|
|
2575
|
+
};
|
|
2576
|
+
return import_react.createElement(as, {
|
|
2577
|
+
className,
|
|
2578
|
+
style: styles,
|
|
2579
|
+
ref
|
|
2580
|
+
}, children);
|
|
2581
|
+
});
|
|
2582
|
+
var defaultDropAnimationSideEffects = (options) => (_ref) => {
|
|
2583
|
+
let { active, dragOverlay } = _ref;
|
|
2584
|
+
const originalStyles = {};
|
|
2585
|
+
const { styles, className } = options;
|
|
2586
|
+
if (styles != null && styles.active) for (const [key, value] of Object.entries(styles.active)) {
|
|
2587
|
+
if (value === void 0) continue;
|
|
2588
|
+
originalStyles[key] = active.node.style.getPropertyValue(key);
|
|
2589
|
+
active.node.style.setProperty(key, value);
|
|
2590
|
+
}
|
|
2591
|
+
if (styles != null && styles.dragOverlay) for (const [key, value] of Object.entries(styles.dragOverlay)) {
|
|
2592
|
+
if (value === void 0) continue;
|
|
2593
|
+
dragOverlay.node.style.setProperty(key, value);
|
|
2594
|
+
}
|
|
2595
|
+
if (className != null && className.active) active.node.classList.add(className.active);
|
|
2596
|
+
if (className != null && className.dragOverlay) dragOverlay.node.classList.add(className.dragOverlay);
|
|
2597
|
+
return function cleanup() {
|
|
2598
|
+
for (const [key, value] of Object.entries(originalStyles)) active.node.style.setProperty(key, value);
|
|
2599
|
+
if (className != null && className.active) active.node.classList.remove(className.active);
|
|
2600
|
+
};
|
|
2601
|
+
};
|
|
2602
|
+
var defaultKeyframeResolver = (_ref2) => {
|
|
2603
|
+
let { transform: { initial, final } } = _ref2;
|
|
2604
|
+
return [{ transform: CSS.Transform.toString(initial) }, { transform: CSS.Transform.toString(final) }];
|
|
2605
|
+
};
|
|
2606
|
+
var defaultDropAnimationConfiguration = {
|
|
2607
|
+
duration: 250,
|
|
2608
|
+
easing: "ease",
|
|
2609
|
+
keyframes: defaultKeyframeResolver,
|
|
2610
|
+
sideEffects: /* @__PURE__ */ defaultDropAnimationSideEffects({ styles: { active: { opacity: "0" } } })
|
|
2611
|
+
};
|
|
2612
|
+
function useDropAnimation(_ref3) {
|
|
2613
|
+
let { config, draggableNodes, droppableContainers, measuringConfiguration } = _ref3;
|
|
2614
|
+
return useEvent((id, node) => {
|
|
2615
|
+
if (config === null) return;
|
|
2616
|
+
const activeDraggable = draggableNodes.get(id);
|
|
2617
|
+
if (!activeDraggable) return;
|
|
2618
|
+
const activeNode = activeDraggable.node.current;
|
|
2619
|
+
if (!activeNode) return;
|
|
2620
|
+
const measurableNode = getMeasurableNode(node);
|
|
2621
|
+
if (!measurableNode) return;
|
|
2622
|
+
const { transform } = getWindow(node).getComputedStyle(node);
|
|
2623
|
+
const parsedTransform = parseTransform(transform);
|
|
2624
|
+
if (!parsedTransform) return;
|
|
2625
|
+
const animation = typeof config === "function" ? config : createDefaultDropAnimation(config);
|
|
2626
|
+
scrollIntoViewIfNeeded(activeNode, measuringConfiguration.draggable.measure);
|
|
2627
|
+
return animation({
|
|
2628
|
+
active: {
|
|
2629
|
+
id,
|
|
2630
|
+
data: activeDraggable.data,
|
|
2631
|
+
node: activeNode,
|
|
2632
|
+
rect: measuringConfiguration.draggable.measure(activeNode)
|
|
2633
|
+
},
|
|
2634
|
+
draggableNodes,
|
|
2635
|
+
dragOverlay: {
|
|
2636
|
+
node,
|
|
2637
|
+
rect: measuringConfiguration.dragOverlay.measure(measurableNode)
|
|
2638
|
+
},
|
|
2639
|
+
droppableContainers,
|
|
2640
|
+
measuringConfiguration,
|
|
2641
|
+
transform: parsedTransform
|
|
2642
|
+
});
|
|
2643
|
+
});
|
|
2644
|
+
}
|
|
2645
|
+
function createDefaultDropAnimation(options) {
|
|
2646
|
+
const { duration, easing, sideEffects, keyframes } = {
|
|
2647
|
+
...defaultDropAnimationConfiguration,
|
|
2648
|
+
...options
|
|
2649
|
+
};
|
|
2650
|
+
return (_ref4) => {
|
|
2651
|
+
let { active, dragOverlay, transform, ...rest } = _ref4;
|
|
2652
|
+
if (!duration) return;
|
|
2653
|
+
const delta = {
|
|
2654
|
+
x: dragOverlay.rect.left - active.rect.left,
|
|
2655
|
+
y: dragOverlay.rect.top - active.rect.top
|
|
2656
|
+
};
|
|
2657
|
+
const scale = {
|
|
2658
|
+
scaleX: transform.scaleX !== 1 ? active.rect.width * transform.scaleX / dragOverlay.rect.width : 1,
|
|
2659
|
+
scaleY: transform.scaleY !== 1 ? active.rect.height * transform.scaleY / dragOverlay.rect.height : 1
|
|
2660
|
+
};
|
|
2661
|
+
const finalTransform = {
|
|
2662
|
+
x: transform.x - delta.x,
|
|
2663
|
+
y: transform.y - delta.y,
|
|
2664
|
+
...scale
|
|
2665
|
+
};
|
|
2666
|
+
const animationKeyframes = keyframes({
|
|
2667
|
+
...rest,
|
|
2668
|
+
active,
|
|
2669
|
+
dragOverlay,
|
|
2670
|
+
transform: {
|
|
2671
|
+
initial: transform,
|
|
2672
|
+
final: finalTransform
|
|
2673
|
+
}
|
|
2674
|
+
});
|
|
2675
|
+
const [firstKeyframe] = animationKeyframes;
|
|
2676
|
+
const lastKeyframe = animationKeyframes[animationKeyframes.length - 1];
|
|
2677
|
+
if (JSON.stringify(firstKeyframe) === JSON.stringify(lastKeyframe)) return;
|
|
2678
|
+
const cleanup = sideEffects == null ? void 0 : sideEffects({
|
|
2679
|
+
active,
|
|
2680
|
+
dragOverlay,
|
|
2681
|
+
...rest
|
|
2682
|
+
});
|
|
2683
|
+
const animation = dragOverlay.node.animate(animationKeyframes, {
|
|
2684
|
+
duration,
|
|
2685
|
+
easing,
|
|
2686
|
+
fill: "forwards"
|
|
2687
|
+
});
|
|
2688
|
+
return new Promise((resolve) => {
|
|
2689
|
+
animation.onfinish = () => {
|
|
2690
|
+
cleanup?.();
|
|
2691
|
+
resolve();
|
|
2692
|
+
};
|
|
2693
|
+
});
|
|
2694
|
+
};
|
|
2695
|
+
}
|
|
2696
|
+
var key = 0;
|
|
2697
|
+
function useKey(id) {
|
|
2698
|
+
return (0, import_react.useMemo)(() => {
|
|
2699
|
+
if (id == null) return;
|
|
2700
|
+
key++;
|
|
2701
|
+
return key;
|
|
2702
|
+
}, [id]);
|
|
2703
|
+
}
|
|
2704
|
+
var DragOverlay = /* @__PURE__ */ import_react.memo((_ref) => {
|
|
2705
|
+
let { adjustScale = false, children, dropAnimation: dropAnimationConfig, style, transition, modifiers, wrapperElement = "div", className, zIndex = 999 } = _ref;
|
|
2706
|
+
const { activatorEvent, active, activeNodeRect, containerNodeRect, draggableNodes, droppableContainers, dragOverlay, over, measuringConfiguration, scrollableAncestors, scrollableAncestorRects, windowRect } = useDndContext();
|
|
2707
|
+
const transform = (0, import_react.useContext)(ActiveDraggableContext);
|
|
2708
|
+
const key = useKey(active == null ? void 0 : active.id);
|
|
2709
|
+
const modifiedTransform = applyModifiers(modifiers, {
|
|
2710
|
+
activatorEvent,
|
|
2711
|
+
active,
|
|
2712
|
+
activeNodeRect,
|
|
2713
|
+
containerNodeRect,
|
|
2714
|
+
draggingNodeRect: dragOverlay.rect,
|
|
2715
|
+
over,
|
|
2716
|
+
overlayNodeRect: dragOverlay.rect,
|
|
2717
|
+
scrollableAncestors,
|
|
2718
|
+
scrollableAncestorRects,
|
|
2719
|
+
transform,
|
|
2720
|
+
windowRect
|
|
2721
|
+
});
|
|
2722
|
+
const initialRect = useInitialValue(activeNodeRect);
|
|
2723
|
+
const dropAnimation = useDropAnimation({
|
|
2724
|
+
config: dropAnimationConfig,
|
|
2725
|
+
draggableNodes,
|
|
2726
|
+
droppableContainers,
|
|
2727
|
+
measuringConfiguration
|
|
2728
|
+
});
|
|
2729
|
+
const ref = initialRect ? dragOverlay.setRef : void 0;
|
|
2730
|
+
return import_react.createElement(NullifiedContextProvider, null, import_react.createElement(AnimationManager, { animation: dropAnimation }, active && key ? import_react.createElement(PositionedOverlay, {
|
|
2731
|
+
key,
|
|
2732
|
+
id: active.id,
|
|
2733
|
+
ref,
|
|
2734
|
+
as: wrapperElement,
|
|
2735
|
+
activatorEvent,
|
|
2736
|
+
adjustScale,
|
|
2737
|
+
className,
|
|
2738
|
+
transition,
|
|
2739
|
+
rect: initialRect,
|
|
2740
|
+
style: {
|
|
2741
|
+
zIndex,
|
|
2742
|
+
...style
|
|
2743
|
+
},
|
|
2744
|
+
transform: modifiedTransform
|
|
2745
|
+
}, children) : null));
|
|
2746
|
+
});
|
|
2747
|
+
//#endregion
|
|
2748
|
+
export { closestCenter as a, useDraggable as c, useSensors as d, CSS as f, useUniqueId as g, useIsomorphicLayoutEffect as h, PointerSensor as i, useDroppable as l, useCombinedRefs as m, DragOverlay as n, getClientRect as o, isKeyboardEvent as p, KeyboardCode as r, useDndContext as s, DndContext as t, useSensor as u };
|