@marimo-team/islands 0.21.2-dev62 → 0.21.2-dev63
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/dist/{Combination-BBPQRrDo.js → Combination-B_FmEi05.js} +3 -3
- package/dist/{ConnectedDataExplorerComponent-DrWDbHRV.js → ConnectedDataExplorerComponent-DkSulho5.js} +30 -29
- package/dist/{ImageComparisonComponent-BYQfAfSR.js → ImageComparisonComponent-gxt3EfyS.js} +1 -1
- package/dist/{Plot-DfUav0o0.js → Plot-Do8S2SQJ.js} +1 -1
- package/dist/{_baseIsEqual-CvgsjYoW.js → _baseIsEqual-QWfxbVqg.js} +1 -1
- package/dist/_basePickBy-Do49cXgl.js +34 -0
- package/dist/{_baseUniq-BUFhl85h.js → _baseUniq-vFmWNipH.js} +1 -1
- package/dist/{any-language-editor-BRpxklRq.js → any-language-editor-B_YcSEs7.js} +22 -21
- package/dist/apl-Bw2VYJky.js +4 -0
- package/dist/{arc-DXxE-tFl.js → arc-DfkSnvZm.js} +2 -2
- package/dist/architecture-7HQA4BMR-BVuGBj38.js +6 -0
- package/dist/{architectureDiagram-VXUJARFQ-Df0FNeBR.js → architectureDiagram-VXUJARFQ-CTttozWW.js} +19 -19
- package/dist/asciiarmor-eqY4ZaG6.js +4 -0
- package/dist/asn1-Ch439-Sl.js +4 -0
- package/dist/{blockDiagram-VD42YOAC-DszWqlLz.js → blockDiagram-VD42YOAC-DPCYZecD.js} +14 -14
- package/dist/brainfuck-CYhvoM5D.js +4 -0
- package/dist/{button-BKkuUpZh.js → button-B1ZgJ7Cc.js} +2 -2
- package/dist/{c4Diagram-YG6GDRKO-Dyj8LoUX.js → c4Diagram-YG6GDRKO-BAE3Buci.js} +6 -6
- package/dist/capabilities-DAGZLwa6.js +36 -0
- package/dist/{channel-CUFaIkTh.js → channel-DApRnm6b.js} +1 -1
- package/dist/chat-ui-DIuq4Mn6.js +7296 -0
- package/dist/{check-Diwc5emq.js → check-B2OoWw2h.js} +1 -1
- package/dist/{chunk-4BX2VUAB-CwMMQLZ_.js → chunk-4BX2VUAB-BtdcCA7H.js} +1 -1
- package/dist/{chunk-4F5CHEZ2-CRwwZ2ED.js → chunk-4F5CHEZ2-trdcsslU.js} +1 -1
- package/dist/{chunk-55IACEB6-Dj8CzJvE.js → chunk-55IACEB6-hJraQgx2.js} +1 -1
- package/dist/{chunk-5FQGJX7Z-BkzUmppO.js → chunk-5FQGJX7Z-DwBOYBMa.js} +4 -4
- package/dist/{chunk-ABZYJK2D-7QYXAAhe.js → chunk-ABZYJK2D-DFnIGLNd.js} +3 -3
- package/dist/{chunk-ATLVNIR6-pmHPAPSd.js → chunk-ATLVNIR6-4HgRPLgX.js} +2 -2
- package/dist/{chunk-B2363JML-BuBMltZc.js → chunk-B2363JML-BFAcnt5i.js} +1 -1
- package/dist/{chunk-B4BG7PRW-Dbta9cTX.js → chunk-B4BG7PRW-Bp8FDZTb.js} +7 -7
- package/dist/{chunk-CVBHYZKI-D8iwHsLF.js → chunk-CVBHYZKI-B_c5YBcW.js} +1 -1
- package/dist/{chunk-DI55MBZ5-DyKB35wC.js → chunk-DI55MBZ5-CtD9lSpd.js} +6 -6
- package/dist/{chunk-EXTU4WIE-BRFl4iNd.js → chunk-EXTU4WIE-QrN2mPtn.js} +2 -2
- package/dist/{chunk-FMBD7UC4-XTL4xAvH.js → chunk-FMBD7UC4-B34QcQBj.js} +1 -1
- package/dist/{chunk-FRFDVMJY-Bk2LD5Te.js → chunk-FRFDVMJY-Bdi7sRSt.js} +1 -1
- package/dist/{chunk-HN2XXSSU-CzO5Phf0.js → chunk-HN2XXSSU-E3n-Ys7Z.js} +1 -1
- package/dist/{chunk-JA3XYJ7Z-BkrY9SdL.js → chunk-JA3XYJ7Z-B9-EWihm.js} +3 -3
- package/dist/{chunk-JZLCHNYA-Bk_Lil-q.js → chunk-JZLCHNYA-CIx__-bR.js} +6 -6
- package/dist/{chunk-MI3HLSF2-DvCKDmpi.js → chunk-MI3HLSF2-CUYEasXO.js} +1 -1
- package/dist/{chunk-N4CR4FBY-f5n6meOd.js → chunk-N4CR4FBY-Cl9KH_W1.js} +7 -7
- package/dist/{chunk-PL6DKKU2-DiFkzMfM.js → chunk-PL6DKKU2-BBQnb9JJ.js} +1 -1
- package/dist/{chunk-QN33PNHL-CXfJywHv.js → chunk-QN33PNHL-DV6ID85v.js} +2 -2
- package/dist/{chunk-QXUST7PY-D7-26sj3.js → chunk-QXUST7PY-CaiIvoL5.js} +10 -10
- package/dist/{chunk-QZHKN3VN-CYbwZKgJ.js → chunk-QZHKN3VN-CBBP4d0M.js} +1 -1
- package/dist/{chunk-S3R3BYOJ-BRT9vd1R.js → chunk-S3R3BYOJ-CQOhwRBS.js} +6 -6
- package/dist/{chunk-SJTYNZTY-BvVkbShU.js → chunk-SJTYNZTY-upm-bCUI.js} +1 -1
- package/dist/{chunk-TCCFYFTB-DqxhgXG0.js → chunk-TCCFYFTB-C5_FjmXA.js} +15 -14
- package/dist/{chunk-TQ3KTPDO-CPkEruAA.js → chunk-TQ3KTPDO-BYnhW5aQ.js} +1 -1
- package/dist/{chunk-TZMSLE5B-DSfBOnzx.js → chunk-TZMSLE5B-BkqhN89K.js} +3 -3
- package/dist/{chunk-UMXZTB3W-C4ypIY3V.js → chunk-UMXZTB3W-CmrAYToU.js} +1 -1
- package/dist/classDiagram-2ON5EDUG-BKvGPmV7.js +30 -0
- package/dist/classDiagram-v2-WZHVMYZB-CUmRCVhz.js +30 -0
- package/dist/{clike-CLJYUAWw.js → clike-jRoJKo3I.js} +1 -1
- package/dist/clojure-Dlp86hGI.js +4 -0
- package/dist/{clone-CEQ-pda1.js → clone-BM9_Wkaf.js} +1 -1
- package/dist/cmake-CW_qEITI.js +4 -0
- package/dist/cobol-XHu3WWjZ.js +4 -0
- package/dist/{code-block-37QAKDTI-DV_ZyoUh.js → code-block-37QAKDTI-Dae3xvB0.js} +2 -2
- package/dist/coffeescript-Bb6YS_bL.js +4 -0
- package/dist/commonlisp-BjSiOQCp.js +4 -0
- package/dist/{constants-CytQ_3LM.js → constants-LmeAawHa.js} +3 -3
- package/dist/{copy-BjkXCUxP.js → copy-B7XqFjF_.js} +2 -2
- package/dist/{cose-bilkent-S5V4N54A-BCDTZDay.js → cose-bilkent-S5V4N54A-DvPVjKwP.js} +2 -2
- package/dist/crystal-BqTYUvZ7.js +4 -0
- package/dist/css-DADryIYo.js +4 -0
- package/dist/cypher-CNn306Oc.js +4 -0
- package/dist/d-D-tppFsq.js +4 -0
- package/dist/{dagre-6UL2VRFP-DGEbtmgU.js → dagre-6UL2VRFP-ABg-WzQ3.js} +16 -16
- package/dist/{dagre-BVnNvbvD.js → dagre-B3-rUlCT.js} +14 -14
- package/dist/{data-grid-overlay-editor-BD0BFHzy.js → data-grid-overlay-editor-eVOR1Bqn.js} +3 -3
- package/dist/{diagram-PSM6KHXK-CG_usglE.js → diagram-PSM6KHXK-D6zP_W1d.js} +22 -22
- package/dist/{diagram-QEK2KX5R-CtGFEwzJ.js → diagram-QEK2KX5R-CuHhFHzr.js} +17 -17
- package/dist/{diagram-S2PKOQOG-ClKAGmbv.js → diagram-S2PKOQOG-B2AqkaRk.js} +17 -17
- package/dist/diff-BWHM7ple.js +4 -0
- package/dist/{dist-i-ud9aCA.js → dist-9a7ktdXy.js} +1 -1
- package/dist/{dist-D_-CGmlh.js → dist-B1fHT_HN.js} +2 -2
- package/dist/{dist-BpMlUdNO.js → dist-BFe8Nc_2.js} +3 -3
- package/dist/{dist-COpDrwi-.js → dist-BJ43gqCe.js} +1 -1
- package/dist/{dist-B9EjSb9T.js → dist-BS0c9rME.js} +1 -1
- package/dist/{dist-CseYuPtL.js → dist-BU99V51x.js} +2 -2
- package/dist/dist-BV8p87LG.js +5 -0
- package/dist/{dist-CSEWGuDq.js → dist-BYr4a-wE.js} +1 -1
- package/dist/{dist-RNGn_-uD.js → dist-BcxBN3cs.js} +1 -1
- package/dist/{dist-C0Rnbr-_.js → dist-BiNtCiQ9.js} +4 -4
- package/dist/{dist-D4gcY469.js → dist-BrJQDkv_.js} +2 -2
- package/dist/{dist-BSfYc7vq.js → dist-BwZY8Lt9.js} +2 -2
- package/dist/{dist-C4K7pumm.js → dist-C16JG-Ok.js} +2 -2
- package/dist/{dist-DodLQWPg.js → dist-C4UxHJAP.js} +1 -1
- package/dist/dist-C8N7114Z.js +5 -0
- package/dist/dist-CHmkCdpG.js +5 -0
- package/dist/{dist-CDHl2i1x.js → dist-CMY2xBYw.js} +4 -4
- package/dist/{dist-BGZ7TWS9.js → dist-CSiTW5NO.js} +3 -3
- package/dist/{dist-DEj2X26M.js → dist-CWmTJeFK.js} +2 -2
- package/dist/dist-CXayp1fR.js +6 -0
- package/dist/dist-CZ4qwYvJ.js +8 -0
- package/dist/dist-C__dRIDe.js +5 -0
- package/dist/dist-Cbkga3s5.js +5 -0
- package/dist/{dist-D5NMgbbv.js → dist-CiisiGJh.js} +2 -2
- package/dist/{dist-Ux6dL_VB.js → dist-Cm4SOB1A.js} +1 -1
- package/dist/dist-Cxn9man7.js +8 -0
- package/dist/{dist-Bq5eYK43.js → dist-D75XqRaT.js} +2 -2
- package/dist/{dist-HoZO6brh.js → dist-DD2s3ocF.js} +2 -2
- package/dist/dist-DUTgSV0a.js +8 -0
- package/dist/{dist-Bq9zYwJs.js → dist-DUg5n_x5.js} +5 -5
- package/dist/{dist-gc9KgJuA.js → dist-D_qEwdMV.js} +1 -1
- package/dist/{dist-lNe4i1Nm.js → dist-DaQ8gl6t.js} +1 -1
- package/dist/dist-DcoiQ51H.js +6 -0
- package/dist/{dist-CPlGUbk-.js → dist-Dd9vDQtp.js} +2 -2
- package/dist/{dist-CAKwXCWI.js → dist-Ddms9oaj.js} +2 -2
- package/dist/dist-DjYymnvA.js +5 -0
- package/dist/{dist-Cl5iM8xL.js → dist-DkQrPBbq.js} +3 -3
- package/dist/dist-Don9K0di.js +8 -0
- package/dist/dist-E9OVwuXi.js +5 -0
- package/dist/{dist-DUretbKK.js → dist-WV8DSzVp.js} +2 -2
- package/dist/{dist-BFxYppVR.js → dist-XYBhoeSX.js} +4 -4
- package/dist/{dist-BUrWeMEP.js → dist-XpVxGq0K.js} +1 -1
- package/dist/{dist-DERtJN02.js → dist-Y9GfSR6_.js} +2 -2
- package/dist/dist-s8cGIbEf.js +5 -0
- package/dist/{dockerfile-BxhYdLHL.js → dockerfile-Bhphd7by.js} +1 -1
- package/dist/dtd-_uCqoALQ.js +4 -0
- package/dist/dylan-C9RDQBgd.js +4 -0
- package/dist/ecl-D-cNcvrL.js +4 -0
- package/dist/eiffel-pwlnpFTa.js +4 -0
- package/dist/elm-Bw5cHXv0.js +4 -0
- package/dist/{erDiagram-Q2GNP2WA-DPMseVVp.js → erDiagram-Q2GNP2WA-DEGS1PP7.js} +15 -15
- package/dist/erlang-_hA30h6l.js +4 -0
- package/dist/{error-banner-Dmi5ujan.js → error-banner-D-KBGvBj.js} +3 -3
- package/dist/esm-CxoKu9RN.js +2805 -0
- package/dist/esm-dotk-2cB.js +1587 -0
- package/dist/{factor-Png_OsVt.js → factor-DNC3EI9I.js} +1 -1
- package/dist/factor-DmR0sS2X.js +4 -0
- package/dist/{flowDiagram-NV44I4VS-BpAIFwW7.js → flowDiagram-NV44I4VS-_NtC_MIa.js} +17 -17
- package/dist/forth-Cp4B_BYs.js +4 -0
- package/dist/fortran-2KtXs5Vb.js +4 -0
- package/dist/{ganttDiagram-JELNMOA3-DXYghZ9C.js → ganttDiagram-JELNMOA3-0iqJp9II.js} +10 -10
- package/dist/gas-106_zOMN.js +4 -0
- package/dist/gherkin-CHK85w0F.js +4 -0
- package/dist/{gitGraph-G5XIXVHT-ChHUSAop.js → gitGraph-G5XIXVHT-D5dIC-Yj.js} +3 -3
- package/dist/{gitGraphDiagram-V2S2FVAM-CBL-7g3_.js → gitGraphDiagram-V2S2FVAM-DmWsIkI5.js} +17 -17
- package/dist/{glide-data-editor-858wsVkd.js → glide-data-editor-BkO3-23t.js} +94 -93
- package/dist/{graphlib-D18eZCT4.js → graphlib-CIQjMxKw.js} +6 -6
- package/dist/groovy-Bl2mjKn9.js +4 -0
- package/dist/{hasIn-B9AbGLj3.js → hasIn-eLCPDloT.js} +5 -5
- package/dist/haskell-BzHGL977.js +4 -0
- package/dist/haxe-BWQFLp-3.js +5 -0
- package/dist/idl-C28UwC1n.js +4 -0
- package/dist/{info-VBDWY6EO-CwyXEo8E.js → info-VBDWY6EO-DTO3vFfS.js} +3 -3
- package/dist/infoDiagram-HS3SLOUP-UrOFax1c.js +30 -0
- package/dist/{types-CGc7peZV.js → input-B8CM-AuM.js} +208 -405
- package/dist/{isEmpty-C-xMag79.js → isEmpty-CI9akcsL.js} +2 -2
- package/dist/{isString-D-vNYDBA.js → isString-xiQUcgm4.js} +1 -1
- package/dist/{isSymbol-Dyt2NSnN.js → isSymbol-DFp8040B.js} +1 -1
- package/dist/javascript-DgLCEZTn.js +4 -0
- package/dist/{journeyDiagram-XKPGCS4Q-D5BIjS4N.js → journeyDiagram-XKPGCS4Q-m64vZmxT.js} +7 -7
- package/dist/julia-BPiwS_8t.js +4 -0
- package/dist/{kanban-definition-3W4ZIXB7-DhDkqxFB.js → kanban-definition-3W4ZIXB7-ZLe0Kp41.js} +12 -12
- package/dist/{katex-pyO_klYC.js → katex-DAGMFHph.js} +1 -1
- package/dist/{label-BbpGrh4j.js → label-e5-84vsp.js} +10 -10
- package/dist/{line-C1k1rG3Z.js → line-C5s_12ee.js} +3 -3
- package/dist/{linear-DIp6l9sg.js → linear-Cii2AMNm.js} +4 -4
- package/dist/livescript-D--_lQnE.js +4 -0
- package/dist/{loader-CABJs6GU.js → loader-C51Irhxm.js} +3 -3
- package/dist/lua-CsDs748O.js +4 -0
- package/dist/main.js +34824 -70985
- package/dist/mathematica-BYQ9GF6F.js +4 -0
- package/dist/mbox-C7kaFMhK.js +4 -0
- package/dist/{memoize-Cs8aS5RW.js → memoize-zYM53m8l.js} +1 -1
- package/dist/{merge-NuyC7LN7.js → merge-CqBPpP0q.js} +1 -1
- package/dist/mermaid-4DMBBIKO-0oQV6SKJ.js +6 -0
- package/dist/{mermaid-CrKqsE2j.js → mermaid-CP8gAOdP.js} +50 -50
- package/dist/{mermaid-parser.core-OkWZ8nr-.js → mermaid-parser.core-Ldbqm2U2.js} +8 -8
- package/dist/{mhchem-DckvwtV8.js → mhchem-BGHMIfq6.js} +1 -1
- package/dist/{min-ECVRnCdn.js → min-IJGSWMpU.js} +8 -8
- package/dist/{mindmap-definition-VGOIOE7T-BxQi78Vl.js → mindmap-definition-VGOIOE7T-BkJfqjP5.js} +14 -14
- package/dist/mirc-C2209Et3.js +4 -0
- package/dist/mllike-BLT4EygN.js +6 -0
- package/dist/modelica-DdJRZ_hL.js +4 -0
- package/dist/mscgen-CG9noCbk.js +6 -0
- package/dist/mumps-V-rMtaoS.js +4 -0
- package/dist/{now-BC2mX0ZT.js → now-CnuN5fN5.js} +1 -1
- package/dist/nsis-BaCxxbYc.js +4 -0
- package/dist/{nsis-BrAITej_.js → nsis-CROWDZ9a.js} +1 -1
- package/dist/ntriples-2dOF8Rwr.js +4 -0
- package/dist/{number-overlay-editor-CQrncFlP.js → number-overlay-editor-B5y1rc-k.js} +1 -1
- package/dist/octave-DgJBCpUf.js +4 -0
- package/dist/{once-BqS42WgZ.js → once-DjP4Kbhy.js} +1 -1
- package/dist/{ordinal-Dcvf4J1m.js → ordinal-Bz8O-XbW.js} +1 -1
- package/dist/oz-B4DqLn0e.js +4 -0
- package/dist/{packet-DYOGHKS2-C62XQjZh.js → packet-DYOGHKS2-BWNLyWLh.js} +3 -3
- package/dist/pascal-CzxJky4Q.js +4 -0
- package/dist/perl-BXxwSvR1.js +4 -0
- package/dist/{pie-VRWISCQL-nfAKQJw3.js → pie-VRWISCQL-BNm0ZeOM.js} +3 -3
- package/dist/{pieDiagram-ADFJNKIX-DfSJXUHa.js → pieDiagram-ADFJNKIX-CLJoguev.js} +22 -22
- package/dist/pig-C6uUbdgq.js +4 -0
- package/dist/powershell-ByH1IK0s.js +4 -0
- package/dist/{precisionRound-BAc-kQ3q.js → precisionRound-C-DW449D.js} +1 -1
- package/dist/process-output-BzDV74px.js +28595 -0
- package/dist/properties-D9ixNGHK.js +4 -0
- package/dist/protobuf-CL5MO5Bo.js +4 -0
- package/dist/{pug-CH-17az-.js → pug-CSWat1rd.js} +1 -1
- package/dist/pug-j1GtIGnO.js +4 -0
- package/dist/puppet-DAaSZQRF.js +4 -0
- package/dist/python-DWLse_Hh.js +4 -0
- package/dist/q-JRlUfaV4.js +4 -0
- package/dist/{quadrantDiagram-AYHSOK5B-CAcVWXc-.js → quadrantDiagram-AYHSOK5B-Bym-JxLx.js} +5 -5
- package/dist/r-J8uFHie7.js +4 -0
- package/dist/{radar-ZZBFDIW7-lopS8_4j.js → radar-ZZBFDIW7-CEhz-hUS.js} +3 -3
- package/dist/{range-BKaWvVUE.js → range-DffmqG6L.js} +4 -3
- package/dist/react-vega-CY82WAG3.js +9 -0
- package/dist/{react-vega-C6kwcd86.js → react-vega-DZOOS-W4.js} +19 -19
- package/dist/{reduce-CqQo8ppc.js → reduce-CGwzfrDo.js} +5 -5
- package/dist/{requirementDiagram-UZGBJVZJ-BU7dwzFM.js → requirementDiagram-UZGBJVZJ-CD_V4itb.js} +14 -14
- package/dist/rpm-C85hbO48.js +5 -0
- package/dist/ruby-D9HeYYQS.js +4 -0
- package/dist/{sankeyDiagram-TZEHDZUN-BVJnR4_b.js → sankeyDiagram-TZEHDZUN-CW3Bo_62.js} +5 -5
- package/dist/sas-D4mSim4H.js +4 -0
- package/dist/scheme-DNmM-DGy.js +4 -0
- package/dist/{sequenceDiagram-WL72ISMW-CQcFQTwX.js → sequenceDiagram-WL72ISMW-BfAHIhk3.js} +8 -8
- package/dist/shell-BS8ZwLUy.js +4 -0
- package/dist/sieve-B8TCe-_m.js +4 -0
- package/dist/{slides-component-GkilRW21.js → slides-component-oCf7w4PF.js} +3 -3
- package/dist/smalltalk-CkAXTqlf.js +4 -0
- package/dist/sparql-Bt75sj2n.js +4 -0
- package/dist/{spec-oVDndBz4.js → spec-UGFYIDJb.js} +12 -431
- package/dist/{src-CHUphWwL.js → src-Bf2iLOlr.js} +1 -1
- package/dist/{stateDiagram-FKZM4ZOC-Dx9AIGDe.js → stateDiagram-FKZM4ZOC-CCfvnS3_.js} +19 -19
- package/dist/stateDiagram-v2-4FDKWEC3-Dd_xAZiD.js +29 -0
- package/dist/{step-BbmiiQdf.js → step-CWipAYTY.js} +1 -1
- package/dist/stex-BvZqVamL.js +4 -0
- package/dist/style.css +1 -1
- package/dist/stylus-BM4XGc6j.js +4 -0
- package/dist/swift-BRG-gyk5.js +4 -0
- package/dist/tcl-Bp61skpb.js +4 -0
- package/dist/textile-vndc5V2p.js +4 -0
- package/dist/{time-DFFVNc1Q.js → time-B31vFOEZ.js} +4 -4
- package/dist/{timeline-definition-IT6M3QCI-D8B3p7ID.js → timeline-definition-IT6M3QCI-BwyDPLz1.js} +4 -4
- package/dist/toDate-COI3hP-5.js +637 -0
- package/dist/toInteger-BUeg_O0F.js +15 -0
- package/dist/{toNumber-CbZ70FdN.js → toNumber-xFPoy1OI.js} +2 -2
- package/dist/{toString-DbIAWQpF.js → toString-CtXX84W6.js} +2 -2
- package/dist/toml-CMpRzNl5.js +4 -0
- package/dist/{tooltip-CKG75XQa.js → tooltip-DnI4CwIS.js} +4 -4
- package/dist/{treemap-GDKQZRPO-CkR-5ai2.js → treemap-GDKQZRPO-BdsKcX7e.js} +3 -3
- package/dist/troff-BNSfnnQn.js +4 -0
- package/dist/ttcn-CILP7Q2P.js +4 -0
- package/dist/ttcn-cfg-Cs5Ekdhk.js +4 -0
- package/dist/turtle-1zFjsw2L.js +4 -0
- package/dist/types-BqLAaq-i.js +209 -0
- package/dist/{uniq-H2E5nMLq.js → uniq-CCKqEs7T.js} +1 -1
- package/dist/{useAsyncData-CEjJxwFB.js → useAsyncData-BtHYXgXF.js} +2 -2
- package/dist/useDeepCompareMemoize-9dXEtK7u.js +124 -0
- package/dist/useIframeCapabilities-CzVvBDe8.js +13 -0
- package/dist/useLifecycle-Be1LUuEg.js +427 -0
- package/dist/{useTheme-CPybHVFN.js → useTheme-5GTtjXjy.js} +4 -4
- package/dist/vb-CCqDJO0q.js +4 -0
- package/dist/vbscript-CtqCxNqL.js +4 -0
- package/dist/{vega-component-CuPTCRp5.js → vega-component-DX1QtRQE.js} +198 -197
- package/dist/{vega-loader.browser-CQ-lnUkI.js → vega-loader.browser-DnqN5nbz.js} +3 -3
- package/dist/velocity-BRacwoCp.js +4 -0
- package/dist/verilog-CdotQ5hS.js +4 -0
- package/dist/vhdl-CRMFlLc_.js +4 -0
- package/dist/webidl-Bo-4Hfyi.js +4 -0
- package/dist/xquery-CgMQN-7i.js +4 -0
- package/dist/{xychartDiagram-PRI3JC2R-XO8FiQjU.js → xychartDiagram-PRI3JC2R-D-Of-r2y.js} +13 -13
- package/dist/yacas-6ORYe5fj.js +4 -0
- package/dist/z80-tFLqkB9-.js +4 -0
- package/package.json +1 -1
- package/src/components/app-config/__tests__/get-dirty-values.test.ts +1 -1
- package/src/components/app-config/get-dirty-values.ts +100 -0
- package/src/components/app-config/user-config-form.tsx +1 -97
- package/src/components/editor/package-alert.tsx +1 -1
- package/src/plugins/impl/chat/ChatPlugin.tsx +6 -3
- package/dist/_basePickBy-pTDW2_2A.js +0 -47
- package/dist/apl-lHFVoxx7.js +0 -4
- package/dist/architecture-7HQA4BMR-BmtmhGMc.js +0 -6
- package/dist/asciiarmor-DqCdZUHI.js +0 -4
- package/dist/asn1-DEcwtw-q.js +0 -4
- package/dist/brainfuck-Bro9Oz5x.js +0 -4
- package/dist/classDiagram-2ON5EDUG-DphiMW3Y.js +0 -30
- package/dist/classDiagram-v2-WZHVMYZB-BH1x5h4a.js +0 -30
- package/dist/clojure-B2uhdQPa.js +0 -4
- package/dist/cmake-B9WXyQcc.js +0 -4
- package/dist/cobol-CPD3EJfO.js +0 -4
- package/dist/coffeescript-KD9TnEnS.js +0 -4
- package/dist/commonlisp-DNEULz_Q.js +0 -4
- package/dist/crystal-DVPNgAPQ.js +0 -4
- package/dist/css-fq3a1AH1.js +0 -4
- package/dist/cypher-Dtzq0BP7.js +0 -4
- package/dist/d-DcZudIhJ.js +0 -4
- package/dist/diff-D9BPDC3o.js +0 -4
- package/dist/dist-B4MxkKHf.js +0 -8
- package/dist/dist-BYghZv6b.js +0 -5
- package/dist/dist-Be-uQhz5.js +0 -6
- package/dist/dist-CB_xf0ju.js +0 -5
- package/dist/dist-CK0qFAbF.js +0 -8
- package/dist/dist-CYEk-qrr.js +0 -8
- package/dist/dist-CmKoWpMk.js +0 -5
- package/dist/dist-D1nf4IQl.js +0 -5
- package/dist/dist-Df3AcKpt.js +0 -6
- package/dist/dist-DgaFHt_I.js +0 -5
- package/dist/dist-Dk10C3ui.js +0 -5
- package/dist/dist-DtyPVMHR.js +0 -5
- package/dist/dist-ko7WnHAO.js +0 -5
- package/dist/dist-of7gLRFK.js +0 -8
- package/dist/dtd-FhG-tVom.js +0 -4
- package/dist/dylan-HWpZOBPw.js +0 -4
- package/dist/ecl-B_rcje1I.js +0 -4
- package/dist/eiffel-oqHyHs6f.js +0 -4
- package/dist/elm-B62RQEds.js +0 -4
- package/dist/erlang-CjRjjA-B.js +0 -4
- package/dist/esm-No_6eSQS.js +0 -4387
- package/dist/factor-CGH_TnIV.js +0 -4
- package/dist/forth-5N06oHNp.js +0 -4
- package/dist/fortran-wZ-sNg3h.js +0 -4
- package/dist/gas-3H4_FaS8.js +0 -4
- package/dist/gherkin-PEA2uy50.js +0 -4
- package/dist/groovy-DZzbvCP1.js +0 -4
- package/dist/haskell-CExLTzho.js +0 -4
- package/dist/haxe-f3pVb8qU.js +0 -5
- package/dist/idl-BbWlJ0gk.js +0 -4
- package/dist/infoDiagram-HS3SLOUP-BXGbfBss.js +0 -30
- package/dist/javascript-eMOhp6Aq.js +0 -4
- package/dist/julia-C6w3Rvqb.js +0 -4
- package/dist/livescript-ChQl9lD-.js +0 -4
- package/dist/lua-CiDvI96j.js +0 -4
- package/dist/mathematica-ClVO4k7N.js +0 -4
- package/dist/mbox-BEI7DeUg.js +0 -4
- package/dist/mermaid-4DMBBIKO-PVrJfEpX.js +0 -6
- package/dist/mirc-DwidJ3iH.js +0 -4
- package/dist/mllike-Dspdy0xJ.js +0 -6
- package/dist/modelica-CIUejP-L.js +0 -4
- package/dist/mscgen-BWXU4Omp.js +0 -6
- package/dist/mumps-PHFFoPk5.js +0 -4
- package/dist/nsis-B7xooKLf.js +0 -4
- package/dist/ntriples-DnOgtCzG.js +0 -4
- package/dist/octave-Cn5kH_QT.js +0 -4
- package/dist/oz-DR-sROpu.js +0 -4
- package/dist/pascal-CPKK1zcS.js +0 -4
- package/dist/perl-D7FuFdyd.js +0 -4
- package/dist/pig-CEXnOAnI.js +0 -4
- package/dist/powershell-BKvWab7q.js +0 -4
- package/dist/properties-7jnK_vYx.js +0 -4
- package/dist/protobuf-4rslMjEN.js +0 -4
- package/dist/pug-BVwdEv4r.js +0 -4
- package/dist/puppet-iSHg_1Z2.js +0 -4
- package/dist/python-tK3wUCn0.js +0 -4
- package/dist/q-DP_Dcoox.js +0 -4
- package/dist/r-C32wHLYu.js +0 -4
- package/dist/react-vega-CFUuchds.js +0 -9
- package/dist/rpm-BbDBUfs9.js +0 -5
- package/dist/ruby-COfWUiIr.js +0 -4
- package/dist/sas-y_Hue2-X.js +0 -4
- package/dist/scheme-7jTCqHw8.js +0 -4
- package/dist/shell-DAqJWXDk.js +0 -4
- package/dist/sieve-EaqnbCO3.js +0 -4
- package/dist/smalltalk-DL03YKLJ.js +0 -4
- package/dist/sparql-DTA-tQ_q.js +0 -4
- package/dist/stateDiagram-v2-4FDKWEC3-BIeUs-Ed.js +0 -29
- package/dist/stex-KfRnSHzF.js +0 -4
- package/dist/stylus-CfjeFry_.js +0 -4
- package/dist/swift-Dl0RRDbH.js +0 -4
- package/dist/tcl-wv9O7fLZ.js +0 -4
- package/dist/textile-DzMRCBcV.js +0 -4
- package/dist/toml-CyIWqgbe.js +0 -4
- package/dist/troff-_huin_CY.js +0 -4
- package/dist/ttcn-BEiJuYYc.js +0 -4
- package/dist/ttcn-cfg-DB6Ksh67.js +0 -4
- package/dist/turtle-DzhzGEum.js +0 -4
- package/dist/useDeepCompareMemoize-BWUwfh37.js +0 -755
- package/dist/useIframeCapabilities-OQaMKgZl.js +0 -46
- package/dist/vb-CngKZQHu.js +0 -4
- package/dist/vbscript-BV_8nbeM.js +0 -4
- package/dist/velocity-IqE7qYKE.js +0 -4
- package/dist/verilog-xtyaWTnc.js +0 -4
- package/dist/vhdl-BaqXCtf3.js +0 -4
- package/dist/webidl-BDB8PTTO.js +0 -4
- package/dist/xquery-BIC-qj9Z.js +0 -4
- package/dist/yacas-ifv5tftd.js +0 -4
- package/dist/z80-B8zOMVNt.js +0 -4
- /package/dist/{_arrayReduce-BfFy684W.js → _arrayReduce-6BJAuN54.js} +0 -0
- /package/dist/{_baseSlice-BrVixxuc.js → _baseSlice-bwIVgwNq.js} +0 -0
- /package/dist/{_hasUnicode-C32WqUu7.js → _hasUnicode-DOFcQHhs.js} +0 -0
- /package/dist/{apl-DRxKiEot.js → apl-hy2nkDJ0.js} +0 -0
- /package/dist/{array-D-nrDupM.js → array-tvvEqPy7.js} +0 -0
- /package/dist/{asciiarmor-C8HoXFIm.js → asciiarmor-Bp85a1XA.js} +0 -0
- /package/dist/{asn1-9Bo0DYT-.js → asn1-CCINh2Tb.js} +0 -0
- /package/dist/{asterisk-BsiuGzWq.js → asterisk-DaVJJDnV.js} +0 -0
- /package/dist/{brainfuck-Db8njC-p.js → brainfuck-CWERNqpi.js} +0 -0
- /package/dist/{chunk-DR5Q36YT-D4q96vNV.js → chunk-DR5Q36YT-BflwErH1.js} +0 -0
- /package/dist/{click-outside-container-CKfwEZqH.js → click-outside-container-D6Q_AEkf.js} +0 -0
- /package/dist/{clike-CFhUNtI5.js → clike-BclwMGdw.js} +0 -0
- /package/dist/{clojure-CX7oovsp.js → clojure-ygiDe_M6.js} +0 -0
- /package/dist/{clsx-D2KVTYnW.js → clsx-yW_RAw0K.js} +0 -0
- /package/dist/{cmake-C29AR2kk.js → cmake-CqV32d9p.js} +0 -0
- /package/dist/{cobol-CNkuRW9i.js → cobol-BC90RNzo.js} +0 -0
- /package/dist/{coffeescript-BJAbfGam.js → coffeescript-XlUo917R.js} +0 -0
- /package/dist/{colors-6nB_pSln.js → colors-CQAOa8cK.js} +0 -0
- /package/dist/{common-keywords-BAkLFdud.js → common-keywords-FBrXPTcz.js} +0 -0
- /package/dist/{commonlisp-BTNhj2l9.js → commonlisp-BlMWxO2z.js} +0 -0
- /package/dist/{crystal-CZc0nIm9.js → crystal-BJriHwL7.js} +0 -0
- /package/dist/{css-L2-0OTXc.js → css-De5CPzak.js} +0 -0
- /package/dist/{cypher-Dnc6MXl0.js → cypher-CF3pgZHB.js} +0 -0
- /package/dist/{cytoscape.esm-BXzSsA6N.js → cytoscape.esm-GAzDZorR.js} +0 -0
- /package/dist/{d-C6X9iIga.js → d-DnmSJuVB.js} +0 -0
- /package/dist/{defaultLocale-CfQ4kBaV.js → defaultLocale-Dr6Bz4JK.js} +0 -0
- /package/dist/{defaultLocale-Bklbu-Tp.js → defaultLocale-I3_GfJ4U.js} +0 -0
- /package/dist/{diff-ZzKinYqY.js → diff-5fTcVlce.js} +0 -0
- /package/dist/{dist-Bymy0kEH.js → dist-BGdYVvOu.js} +0 -0
- /package/dist/{dist-DOoqn-VL.js → dist-C4EV3aDt.js} +0 -0
- /package/dist/{dtd-CytEpkAo.js → dtd-CExSJ830.js} +0 -0
- /package/dist/{duckdb-keywords-C1WxmSfG.js → duckdb-keywords-CvJhR_Yd.js} +0 -0
- /package/dist/{dylan-CZByFBEQ.js → dylan-D45mme_B.js} +0 -0
- /package/dist/{ebnf-BF2FOt-m.js → ebnf-2D4Ctp3y.js} +0 -0
- /package/dist/{ecl-Cp7L1F5B.js → ecl-Dt8H2ySk.js} +0 -0
- /package/dist/{eiffel-C66yjnFL.js → eiffel-BVH48wKK.js} +0 -0
- /package/dist/{elm-DtHo-73e.js → elm-lLkDwz-w.js} +0 -0
- /package/dist/{emotion-is-prop-valid.esm-DtW2o230.js → emotion-is-prop-valid.esm-CflmeIys.js} +0 -0
- /package/dist/{erlang-C_sj44mF.js → erlang-Ct2FydHU.js} +0 -0
- /package/dist/{esm-BWftfC-A.js → esm-CuMA4YP0.js} +0 -0
- /package/dist/{fcl-BhLcvRo_.js → fcl-Ccj8Z5Xd.js} +0 -0
- /package/dist/{forth-CIDHh56T.js → forth-CXoVo3MY.js} +0 -0
- /package/dist/{fortran-BQrDVXRU.js → fortran-CgtioF-z.js} +0 -0
- /package/dist/{gas-D4HQPB0Q.js → gas-DA6wSQkj.js} +0 -0
- /package/dist/{gherkin-UB2gJHdT.js → gherkin-Cn3rybYZ.js} +0 -0
- /package/dist/{groovy-DVz6jkOx.js → groovy-CGOZjiuH.js} +0 -0
- /package/dist/{haskell-CpUdAPCz.js → haskell-BWI76WET.js} +0 -0
- /package/dist/{haxe-DCV5_cqD.js → haxe-CovtkFbk.js} +0 -0
- /package/dist/{http-C_TDb8VX.js → http-_DVAYWoR.js} +0 -0
- /package/dist/{idl-D7WCIgHw.js → idl-SJSctwSZ.js} +0 -0
- /package/dist/{init-Ci8VD8ZH.js → init-uv0kkh4g.js} +0 -0
- /package/dist/{invariant-D9QLJ4SZ.js → invariant-Ctm_8TNZ.js} +0 -0
- /package/dist/{isArrayLikeObject-BrYl-ETg.js → isArrayLikeObject-C-hFPChh.js} +0 -0
- /package/dist/{javascript-B2Rn0Lmd.js → javascript-BzIdRGKh.js} +0 -0
- /package/dist/{jsx-runtime-CTBg5pdT.js → jsx-runtime-9hcJiI23.js} +0 -0
- /package/dist/{julia-ApprtEaw.js → julia-B3EQ2bxh.js} +0 -0
- /package/dist/{katex-Bk_FvVSR.js → katex-CywHdYBC.js} +0 -0
- /package/dist/{livescript-BMLIlM7C.js → livescript-BtVSE9jj.js} +0 -0
- /package/dist/{lua-DdDaW3tC.js → lua-B1Esbvm1.js} +0 -0
- /package/dist/{main-Tj_-QTyF.js → main-sxFlUO_N.js} +0 -0
- /package/dist/{math-HUZifhTs.js → math-DFcdCCU8.js} +0 -0
- /package/dist/{mathematica-PnNN7c2Z.js → mathematica-BLPJnY-e.js} +0 -0
- /package/dist/{mbox-B84OtHBK.js → mbox-C86ZBpjz.js} +0 -0
- /package/dist/{mirc-BVWXJxIq.js → mirc-Cqv8ECOt.js} +0 -0
- /package/dist/{mllike-BawXWupH.js → mllike-BCn8p2Mf.js} +0 -0
- /package/dist/{modelica-C8-X4Hf_.js → modelica-eD-847KF.js} +0 -0
- /package/dist/{mscgen-BOM6dDj8.js → mscgen-BtzXm_zS.js} +0 -0
- /package/dist/{mumps-DQOY8n05.js → mumps-BUx23-bh.js} +0 -0
- /package/dist/{nginx-DkMgA__9.js → nginx-DasThI7R.js} +0 -0
- /package/dist/{node-sql-parser-D53LM_7b.js → node-sql-parser-CHcmQ9Ms.js} +0 -0
- /package/dist/{ntriples-DU8VrXdW.js → ntriples-naSVo-bH.js} +0 -0
- /package/dist/{octave-BzTIBsQ8.js → octave-B-zftwnK.js} +0 -0
- /package/dist/{oz-DKFcZsoi.js → oz-OUZbVKrv.js} +0 -0
- /package/dist/{pascal-DHBZ15pT.js → pascal-C-c-17Ts.js} +0 -0
- /package/dist/{path-BVI7RNUv.js → path-BGaWgPKg.js} +0 -0
- /package/dist/{perl-75NMI3w0.js → perl-BBIS1zw3.js} +0 -0
- /package/dist/{pig-B-HY1fo_.js → pig-B10mtuLC.js} +0 -0
- /package/dist/{powershell-DEH22U53.js → powershell-SyaENm-A.js} +0 -0
- /package/dist/{properties-B1MzBoJC.js → properties-BiiMVvre.js} +0 -0
- /package/dist/{protobuf-Dr14KV0p.js → protobuf-Cj2_antD.js} +0 -0
- /package/dist/{puppet-C4z38l7v.js → puppet-ZeJ9I40T.js} +0 -0
- /package/dist/{purify.es-DGenX2XH.js → purify.es-Co_dANLh.js} +0 -0
- /package/dist/{python-D2L7Nknt.js → python-mR64qk6D.js} +0 -0
- /package/dist/{q-PxipHfgS.js → q-C_IMU433.js} +0 -0
- /package/dist/{r-CEMMu_Tf.js → r-BKx4ZcIe.js} +0 -0
- /package/dist/{range-BToS7LsA.js → range-Bn3no95s.js} +0 -0
- /package/dist/{react-dom-CqtLRVZP.js → react-dom-BKwCWYPW.js} +0 -0
- /package/dist/{rpm-D3xyahkR.js → rpm-Dc3zEGCn.js} +0 -0
- /package/dist/{ruby-DwEkwdiu.js → ruby-eSClttk1.js} +0 -0
- /package/dist/{sas-L1W0BRft.js → sas-7VEmwDJB.js} +0 -0
- /package/dist/{scheme-CTybTrX0.js → scheme-CpP6oEOD.js} +0 -0
- /package/dist/{shell-BSx3LZnu.js → shell-CfNoZJks.js} +0 -0
- /package/dist/{sieve-BjUfbv-6.js → sieve-dzMMB941.js} +0 -0
- /package/dist/{simple-mode-IPZGFbI6.js → simple-mode-CnNH5BDk.js} +0 -0
- /package/dist/{smalltalk-BlzuYrMv.js → smalltalk-BVDNd2a5.js} +0 -0
- /package/dist/{solr-Cj_9RM4d.js → solr-RZ9uTl59.js} +0 -0
- /package/dist/{sparql-BXKjQ0cK.js → sparql-Br2qWoOi.js} +0 -0
- /package/dist/{spreadsheet-CifI10GO.js → spreadsheet-BNNUNXA2.js} +0 -0
- /package/dist/{sql-B0bFyY1c.js → sql-B4x8IkwU.js} +0 -0
- /package/dist/{stex-BIsgBmK4.js → stex-7yEw16Ww.js} +0 -0
- /package/dist/{stylus-CqrLLVnG.js → stylus-Ca_-WKcu.js} +0 -0
- /package/dist/{swift-DIqvj3_G.js → swift-CiBr8lL9.js} +0 -0
- /package/dist/{tcl-B8bOIGVK.js → tcl-DpMdOyXx.js} +0 -0
- /package/dist/{textile-DZsjavD_.js → textile-Dc0EKY-e.js} +0 -0
- /package/dist/{tiddlywiki-BbGdvEjx.js → tiddlywiki-DI0mF2WJ.js} +0 -0
- /package/dist/{tiki-BYesmRDo.js → tiki-2HU6XLLn.js} +0 -0
- /package/dist/{timer-CPsmIOdm.js → timer-YZl28NYN.js} +0 -0
- /package/dist/{toml-Uc7m08nl.js → toml-Cz56KCq3.js} +0 -0
- /package/dist/{treemap-DMn4tIJ7.js → treemap-D-ka1hvx.js} +0 -0
- /package/dist/{troff-GEl5wcXR.js → troff-QPYfPg8n.js} +0 -0
- /package/dist/{ttcn-pr4FDOLT.js → ttcn-Bd8ZFglh.js} +0 -0
- /package/dist/{ttcn-cfg-dZQ_fWTH.js → ttcn-cfg-BRegYnOz.js} +0 -0
- /package/dist/{turtle-TPRDOknA.js → turtle-BtxTFbJ2.js} +0 -0
- /package/dist/{vb-BJUAeTYr.js → vb-BPcnlamW.js} +0 -0
- /package/dist/{vbscript-CcJ6Z3ic.js → vbscript-RpXS5Rn-.js} +0 -0
- /package/dist/{velocity-pq4ZMzU3.js → velocity-toRwXi-i.js} +0 -0
- /package/dist/{verilog-timMNjHt.js → verilog-B1fdOBGb.js} +0 -0
- /package/dist/{vhdl-DYFbVKNm.js → vhdl-D-vWFb2W.js} +0 -0
- /package/dist/{webidl-pue9oqnb.js → webidl-QJDW0ZyQ.js} +0 -0
- /package/dist/{xquery-DeItGynK.js → xquery-DMMT83Vl.js} +0 -0
- /package/dist/{yacas-By2Qrjba.js → yacas-CvzqlDJ_.js} +0 -0
- /package/dist/{z80-C7iLsyPC.js → z80-DqdgHy0p.js} +0 -0
|
@@ -0,0 +1,2805 @@
|
|
|
1
|
+
import { s as __toESM } from "./chunk-BNovOVIE.js";
|
|
2
|
+
import { t as require_react } from "./react-Bs6Z0kvn.js";
|
|
3
|
+
import { t as require_compiler_runtime } from "./compiler-runtime-B_OLMU9S.js";
|
|
4
|
+
import { n as Copy, r as toast, t as copyToClipboard } from "./copy-B7XqFjF_.js";
|
|
5
|
+
import { t as Check } from "./check-B2OoWw2h.js";
|
|
6
|
+
import { h as Events, y as cn } from "./button-B1ZgJ7Cc.js";
|
|
7
|
+
import { t as require_jsx_runtime } from "./jsx-runtime-9hcJiI23.js";
|
|
8
|
+
import { t as Tooltip } from "./tooltip-DnI4CwIS.js";
|
|
9
|
+
import { $ as ViewPlugin, A as indentString, At as Prec, B as tags, Bt as combineConfig, C as foldKeymap, Ct as ChangeSet, D as getIndentation, Dt as EditorState, E as getIndentUnit, Et as EditorSelection, F as syntaxHighlighting, Ft as StateField, H as NodeProp, Ht as findClusterBreak, I as syntaxTree, It as Text, Lt as Transaction, Mt as RangeSetBuilder, N as matchBrackets, Ot as Facet, Pt as StateEffect, Rt as codePointAt, St as ChangeDesc, Ut as fromCodePoint, Vt as countColumn, X as Direction, Y as Decoration, Z as EditorView, _t as showDialog, a as HighlightStyle, bt as crelt, ct as highlightActiveLineGutter, dt as keymap, et as WidgetType, ft as lineNumbers, g as defaultHighlightStyle, gt as runScopeHandlers, ht as rectangularSelection, it as getPanel, j as indentUnit, jt as RangeSet, k as indentOnInput, lt as highlightSpecialChars, mt as placeholder, nt as drawSelection, o as IndentContext, p as bracketMatching, pt as logException, rt as dropCursor, st as highlightActiveLine, tt as crosshairCursor, ut as hoverTooltip, vt as showPanel, wt as CharCategory, x as foldGutter, xt as Annotation, zt as codePointSize } from "./dist-C4EV3aDt.js";
|
|
10
|
+
import { a as closeBracketsKeymap, c as completionKeymap, i as closeBrackets, r as autocompletion } from "./dist-BYr4a-wE.js";
|
|
11
|
+
var import_compiler_runtime = require_compiler_runtime(), import_react = /* @__PURE__ */ __toESM(require_react(), 1), import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1);
|
|
12
|
+
const CopyClipboardIcon = (e6) => {
|
|
13
|
+
let x = (0, import_compiler_runtime.c)(14), { value: S, className: k, buttonClassName: j, tooltip: M, toastTitle: N, ariaLabel: P } = e6, [F, I] = (0, import_react.useState)(false), L;
|
|
14
|
+
x[0] !== N || x[1] !== S ? (L = Events.stopPropagation(async (e7) => {
|
|
15
|
+
await copyToClipboard(typeof S == "function" ? S(e7) : S).then(() => {
|
|
16
|
+
I(true), setTimeout(() => I(false), 2e3), N && toast({ title: N });
|
|
17
|
+
});
|
|
18
|
+
}), x[0] = N, x[1] = S, x[2] = L) : L = x[2];
|
|
19
|
+
let R = L, z = P ?? "Copy to clipboard", B;
|
|
20
|
+
x[3] !== k || x[4] !== F ? (B = F ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { className: cn(k, "text-(--grass-11)") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Copy, { className: k }), x[3] = k, x[4] = F, x[5] = B) : B = x[5];
|
|
21
|
+
let V;
|
|
22
|
+
x[6] !== j || x[7] !== R || x[8] !== z || x[9] !== B ? (V = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
23
|
+
type: "button",
|
|
24
|
+
onClick: R,
|
|
25
|
+
"aria-label": z,
|
|
26
|
+
className: j,
|
|
27
|
+
children: B
|
|
28
|
+
}), x[6] = j, x[7] = R, x[8] = z, x[9] = B, x[10] = V) : V = x[10];
|
|
29
|
+
let H = V;
|
|
30
|
+
if (M === false) return H;
|
|
31
|
+
let U = F ? "Copied!" : M ?? "Copy to clipboard", W;
|
|
32
|
+
return x[11] !== H || x[12] !== U ? (W = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip, {
|
|
33
|
+
content: U,
|
|
34
|
+
delayDuration: 400,
|
|
35
|
+
children: H
|
|
36
|
+
}), x[11] = H, x[12] = U, x[13] = W) : W = x[13], W;
|
|
37
|
+
};
|
|
38
|
+
var toggleComment = (e6) => {
|
|
39
|
+
let { state: x } = e6, S = x.doc.lineAt(x.selection.main.from), C = getConfig(e6.state, S.from);
|
|
40
|
+
return C.line ? toggleLineComment(e6) : C.block ? toggleBlockCommentByLine(e6) : false;
|
|
41
|
+
};
|
|
42
|
+
function command(e6, x) {
|
|
43
|
+
return ({ state: S, dispatch: C }) => {
|
|
44
|
+
if (S.readOnly) return false;
|
|
45
|
+
let w = e6(x, S);
|
|
46
|
+
return w ? (C(S.update(w)), true) : false;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
var toggleLineComment = /* @__PURE__ */ command(changeLineComment, 0), toggleBlockComment = /* @__PURE__ */ command(changeBlockComment, 0), toggleBlockCommentByLine = /* @__PURE__ */ command((e6, x) => changeBlockComment(e6, x, selectedLineRanges(x)), 0);
|
|
50
|
+
function getConfig(e6, x) {
|
|
51
|
+
let S = e6.languageDataAt("commentTokens", x, 1);
|
|
52
|
+
return S.length ? S[0] : {};
|
|
53
|
+
}
|
|
54
|
+
var SearchMargin = 50;
|
|
55
|
+
function findBlockComment(e6, { open: x, close: S }, C, w) {
|
|
56
|
+
let T = e6.sliceDoc(C - SearchMargin, C), E = e6.sliceDoc(w, w + SearchMargin), D = /\s*$/.exec(T)[0].length, O = /^\s*/.exec(E)[0].length, k = T.length - D;
|
|
57
|
+
if (T.slice(k - x.length, k) == x && E.slice(O, O + S.length) == S) return {
|
|
58
|
+
open: {
|
|
59
|
+
pos: C - D,
|
|
60
|
+
margin: D && 1
|
|
61
|
+
},
|
|
62
|
+
close: {
|
|
63
|
+
pos: w + O,
|
|
64
|
+
margin: O && 1
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
let A, j;
|
|
68
|
+
w - C <= 2 * SearchMargin ? A = j = e6.sliceDoc(C, w) : (A = e6.sliceDoc(C, C + SearchMargin), j = e6.sliceDoc(w - SearchMargin, w));
|
|
69
|
+
let M = /^\s*/.exec(A)[0].length, N = /\s*$/.exec(j)[0].length, P = j.length - N - S.length;
|
|
70
|
+
return A.slice(M, M + x.length) == x && j.slice(P, P + S.length) == S ? {
|
|
71
|
+
open: {
|
|
72
|
+
pos: C + M + x.length,
|
|
73
|
+
margin: /\s/.test(A.charAt(M + x.length)) ? 1 : 0
|
|
74
|
+
},
|
|
75
|
+
close: {
|
|
76
|
+
pos: w - N - S.length,
|
|
77
|
+
margin: /\s/.test(j.charAt(P - 1)) ? 1 : 0
|
|
78
|
+
}
|
|
79
|
+
} : null;
|
|
80
|
+
}
|
|
81
|
+
function selectedLineRanges(e6) {
|
|
82
|
+
let x = [];
|
|
83
|
+
for (let S of e6.selection.ranges) {
|
|
84
|
+
let C = e6.doc.lineAt(S.from), w = S.to <= C.to ? C : e6.doc.lineAt(S.to);
|
|
85
|
+
w.from > C.from && w.from == S.to && (w = S.to == C.to + 1 ? C : e6.doc.lineAt(S.to - 1));
|
|
86
|
+
let T = x.length - 1;
|
|
87
|
+
T >= 0 && x[T].to > C.from ? x[T].to = w.to : x.push({
|
|
88
|
+
from: C.from + /^\s*/.exec(C.text)[0].length,
|
|
89
|
+
to: w.to
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return x;
|
|
93
|
+
}
|
|
94
|
+
function changeBlockComment(e6, x, S = x.selection.ranges) {
|
|
95
|
+
let C = S.map((e7) => getConfig(x, e7.from).block);
|
|
96
|
+
if (!C.every((e7) => e7)) return null;
|
|
97
|
+
let w = S.map((e7, S2) => findBlockComment(x, C[S2], e7.from, e7.to));
|
|
98
|
+
if (e6 != 2 && !w.every((e7) => e7)) return { changes: x.changes(S.map((e7, x2) => w[x2] ? [] : [{
|
|
99
|
+
from: e7.from,
|
|
100
|
+
insert: C[x2].open + " "
|
|
101
|
+
}, {
|
|
102
|
+
from: e7.to,
|
|
103
|
+
insert: " " + C[x2].close
|
|
104
|
+
}])) };
|
|
105
|
+
if (e6 != 1 && w.some((e7) => e7)) {
|
|
106
|
+
let e7 = [];
|
|
107
|
+
for (let x2 = 0, S2; x2 < w.length; x2++) if (S2 = w[x2]) {
|
|
108
|
+
let w2 = C[x2], { open: T, close: E } = S2;
|
|
109
|
+
e7.push({
|
|
110
|
+
from: T.pos - w2.open.length,
|
|
111
|
+
to: T.pos + T.margin
|
|
112
|
+
}, {
|
|
113
|
+
from: E.pos - E.margin,
|
|
114
|
+
to: E.pos + w2.close.length
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return { changes: e7 };
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
function changeLineComment(e6, x, S = x.selection.ranges) {
|
|
122
|
+
let C = [], w = -1;
|
|
123
|
+
ranges: for (let { from: e7, to: T } of S) {
|
|
124
|
+
let S2 = C.length, E = 1e9, D;
|
|
125
|
+
for (let S3 = e7; S3 <= T; ) {
|
|
126
|
+
let O = x.doc.lineAt(S3);
|
|
127
|
+
if (D == null && (D = getConfig(x, O.from).line, !D)) continue ranges;
|
|
128
|
+
if (O.from > w && (e7 == T || T > O.from)) {
|
|
129
|
+
w = O.from;
|
|
130
|
+
let e8 = /^\s*/.exec(O.text)[0].length, x2 = e8 == O.length, S4 = O.text.slice(e8, e8 + D.length) == D ? e8 : -1;
|
|
131
|
+
e8 < O.text.length && e8 < E && (E = e8), C.push({
|
|
132
|
+
line: O,
|
|
133
|
+
comment: S4,
|
|
134
|
+
token: D,
|
|
135
|
+
indent: e8,
|
|
136
|
+
empty: x2,
|
|
137
|
+
single: false
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
S3 = O.to + 1;
|
|
141
|
+
}
|
|
142
|
+
if (E < 1e9) for (let e8 = S2; e8 < C.length; e8++) C[e8].indent < C[e8].line.text.length && (C[e8].indent = E);
|
|
143
|
+
C.length == S2 + 1 && (C[S2].single = true);
|
|
144
|
+
}
|
|
145
|
+
if (e6 != 2 && C.some((e7) => e7.comment < 0 && (!e7.empty || e7.single))) {
|
|
146
|
+
let e7 = [];
|
|
147
|
+
for (let { line: x2, token: S3, indent: w2, empty: T, single: E } of C) (E || !T) && e7.push({
|
|
148
|
+
from: x2.from + w2,
|
|
149
|
+
insert: S3 + " "
|
|
150
|
+
});
|
|
151
|
+
let S2 = x.changes(e7);
|
|
152
|
+
return {
|
|
153
|
+
changes: S2,
|
|
154
|
+
selection: x.selection.map(S2, 1)
|
|
155
|
+
};
|
|
156
|
+
} else if (e6 != 1 && C.some((e7) => e7.comment >= 0)) {
|
|
157
|
+
let e7 = [];
|
|
158
|
+
for (let { line: x2, comment: S2, token: w2 } of C) if (S2 >= 0) {
|
|
159
|
+
let C2 = x2.from + S2, T = C2 + w2.length;
|
|
160
|
+
x2.text[T - x2.from] == " " && T++, e7.push({
|
|
161
|
+
from: C2,
|
|
162
|
+
to: T
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
return { changes: e7 };
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
var fromHistory = /* @__PURE__ */ Annotation.define(), isolateHistory = /* @__PURE__ */ Annotation.define(), invertedEffects = /* @__PURE__ */ Facet.define(), historyConfig = /* @__PURE__ */ Facet.define({ combine(e6) {
|
|
170
|
+
return combineConfig(e6, {
|
|
171
|
+
minDepth: 100,
|
|
172
|
+
newGroupDelay: 500,
|
|
173
|
+
joinToEvent: (e7, x) => x
|
|
174
|
+
}, {
|
|
175
|
+
minDepth: Math.max,
|
|
176
|
+
newGroupDelay: Math.min,
|
|
177
|
+
joinToEvent: (e7, x) => (S, C) => e7(S, C) || x(S, C)
|
|
178
|
+
});
|
|
179
|
+
} }), historyField_ = /* @__PURE__ */ StateField.define({
|
|
180
|
+
create() {
|
|
181
|
+
return HistoryState.empty;
|
|
182
|
+
},
|
|
183
|
+
update(e6, x) {
|
|
184
|
+
let S = x.state.facet(historyConfig), C = x.annotation(fromHistory);
|
|
185
|
+
if (C) {
|
|
186
|
+
let w2 = HistEvent.fromTransaction(x, C.selection), T2 = C.side, E2 = T2 == 0 ? e6.undone : e6.done;
|
|
187
|
+
return E2 = w2 ? updateBranch(E2, E2.length, S.minDepth, w2) : addSelection(E2, x.startState.selection), new HistoryState(T2 == 0 ? C.rest : E2, T2 == 0 ? E2 : C.rest);
|
|
188
|
+
}
|
|
189
|
+
let w = x.annotation(isolateHistory);
|
|
190
|
+
if ((w == "full" || w == "before") && (e6 = e6.isolate()), x.annotation(Transaction.addToHistory) === false) return x.changes.empty ? e6 : e6.addMapping(x.changes.desc);
|
|
191
|
+
let T = HistEvent.fromTransaction(x), E = x.annotation(Transaction.time), D = x.annotation(Transaction.userEvent);
|
|
192
|
+
return T ? e6 = e6.addChanges(T, E, D, S, x) : x.selection && (e6 = e6.addSelection(x.startState.selection, E, D, S.newGroupDelay)), (w == "full" || w == "after") && (e6 = e6.isolate()), e6;
|
|
193
|
+
},
|
|
194
|
+
toJSON(e6) {
|
|
195
|
+
return {
|
|
196
|
+
done: e6.done.map((e7) => e7.toJSON()),
|
|
197
|
+
undone: e6.undone.map((e7) => e7.toJSON())
|
|
198
|
+
};
|
|
199
|
+
},
|
|
200
|
+
fromJSON(e6) {
|
|
201
|
+
return new HistoryState(e6.done.map(HistEvent.fromJSON), e6.undone.map(HistEvent.fromJSON));
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
function history(e6 = {}) {
|
|
205
|
+
return [
|
|
206
|
+
historyField_,
|
|
207
|
+
historyConfig.of(e6),
|
|
208
|
+
EditorView.domEventHandlers({ beforeinput(e7, x) {
|
|
209
|
+
let S = e7.inputType == "historyUndo" ? undo : e7.inputType == "historyRedo" ? redo : null;
|
|
210
|
+
return S ? (e7.preventDefault(), S(x)) : false;
|
|
211
|
+
} })
|
|
212
|
+
];
|
|
213
|
+
}
|
|
214
|
+
var historyField = historyField_;
|
|
215
|
+
function cmd(e6, x) {
|
|
216
|
+
return function({ state: S, dispatch: C }) {
|
|
217
|
+
if (!x && S.readOnly) return false;
|
|
218
|
+
let w = S.field(historyField_, false);
|
|
219
|
+
if (!w) return false;
|
|
220
|
+
let T = w.pop(e6, S, x);
|
|
221
|
+
return T ? (C(T), true) : false;
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
var undo = /* @__PURE__ */ cmd(0, false), redo = /* @__PURE__ */ cmd(1, false), undoSelection = /* @__PURE__ */ cmd(0, true), redoSelection = /* @__PURE__ */ cmd(1, true), HistEvent = class e {
|
|
225
|
+
constructor(e6, x, S, C, w) {
|
|
226
|
+
this.changes = e6, this.effects = x, this.mapped = S, this.startSelection = C, this.selectionsAfter = w;
|
|
227
|
+
}
|
|
228
|
+
setSelAfter(x) {
|
|
229
|
+
return new e(this.changes, this.effects, this.mapped, this.startSelection, x);
|
|
230
|
+
}
|
|
231
|
+
toJSON() {
|
|
232
|
+
var _a, _b, _c;
|
|
233
|
+
return {
|
|
234
|
+
changes: (_a = this.changes) == null ? void 0 : _a.toJSON(),
|
|
235
|
+
mapped: (_b = this.mapped) == null ? void 0 : _b.toJSON(),
|
|
236
|
+
startSelection: (_c = this.startSelection) == null ? void 0 : _c.toJSON(),
|
|
237
|
+
selectionsAfter: this.selectionsAfter.map((e6) => e6.toJSON())
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
static fromJSON(x) {
|
|
241
|
+
return new e(x.changes && ChangeSet.fromJSON(x.changes), [], x.mapped && ChangeDesc.fromJSON(x.mapped), x.startSelection && EditorSelection.fromJSON(x.startSelection), x.selectionsAfter.map(EditorSelection.fromJSON));
|
|
242
|
+
}
|
|
243
|
+
static fromTransaction(x, S) {
|
|
244
|
+
let C = none;
|
|
245
|
+
for (let e6 of x.startState.facet(invertedEffects)) {
|
|
246
|
+
let S2 = e6(x);
|
|
247
|
+
S2.length && (C = C.concat(S2));
|
|
248
|
+
}
|
|
249
|
+
return !C.length && x.changes.empty ? null : new e(x.changes.invert(x.startState.doc), C, void 0, S || x.startState.selection, none);
|
|
250
|
+
}
|
|
251
|
+
static selection(x) {
|
|
252
|
+
return new e(void 0, none, void 0, void 0, x);
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
function updateBranch(e6, x, S, C) {
|
|
256
|
+
let w = x + 1 > S + 20 ? x - S - 1 : 0, T = e6.slice(w, x);
|
|
257
|
+
return T.push(C), T;
|
|
258
|
+
}
|
|
259
|
+
function isAdjacent(e6, x) {
|
|
260
|
+
let S = [], C = false;
|
|
261
|
+
return e6.iterChangedRanges((e7, x2) => S.push(e7, x2)), x.iterChangedRanges((e7, x2, w, T) => {
|
|
262
|
+
for (let e8 = 0; e8 < S.length; ) {
|
|
263
|
+
let x3 = S[e8++], E = S[e8++];
|
|
264
|
+
T >= x3 && w <= E && (C = true);
|
|
265
|
+
}
|
|
266
|
+
}), C;
|
|
267
|
+
}
|
|
268
|
+
function eqSelectionShape(e6, x) {
|
|
269
|
+
return e6.ranges.length == x.ranges.length && e6.ranges.filter((e7, S) => e7.empty != x.ranges[S].empty).length === 0;
|
|
270
|
+
}
|
|
271
|
+
function conc(e6, x) {
|
|
272
|
+
return e6.length ? x.length ? e6.concat(x) : e6 : x;
|
|
273
|
+
}
|
|
274
|
+
var none = [], MaxSelectionsPerEvent = 200;
|
|
275
|
+
function addSelection(e6, x) {
|
|
276
|
+
if (e6.length) {
|
|
277
|
+
let S = e6[e6.length - 1], C = S.selectionsAfter.slice(Math.max(0, S.selectionsAfter.length - MaxSelectionsPerEvent));
|
|
278
|
+
return C.length && C[C.length - 1].eq(x) ? e6 : (C.push(x), updateBranch(e6, e6.length - 1, 1e9, S.setSelAfter(C)));
|
|
279
|
+
} else return [HistEvent.selection([x])];
|
|
280
|
+
}
|
|
281
|
+
function popSelection(e6) {
|
|
282
|
+
let x = e6[e6.length - 1], S = e6.slice();
|
|
283
|
+
return S[e6.length - 1] = x.setSelAfter(x.selectionsAfter.slice(0, x.selectionsAfter.length - 1)), S;
|
|
284
|
+
}
|
|
285
|
+
function addMappingToBranch(e6, x) {
|
|
286
|
+
if (!e6.length) return e6;
|
|
287
|
+
let S = e6.length, C = none;
|
|
288
|
+
for (; S; ) {
|
|
289
|
+
let w = mapEvent(e6[S - 1], x, C);
|
|
290
|
+
if (w.changes && !w.changes.empty || w.effects.length) {
|
|
291
|
+
let x2 = e6.slice(0, S);
|
|
292
|
+
return x2[S - 1] = w, x2;
|
|
293
|
+
} else x = w.mapped, S--, C = w.selectionsAfter;
|
|
294
|
+
}
|
|
295
|
+
return C.length ? [HistEvent.selection(C)] : none;
|
|
296
|
+
}
|
|
297
|
+
function mapEvent(e6, x, S) {
|
|
298
|
+
let C = conc(e6.selectionsAfter.length ? e6.selectionsAfter.map((e7) => e7.map(x)) : none, S);
|
|
299
|
+
if (!e6.changes) return HistEvent.selection(C);
|
|
300
|
+
let w = e6.changes.map(x), T = x.mapDesc(e6.changes, true), E = e6.mapped ? e6.mapped.composeDesc(T) : T;
|
|
301
|
+
return new HistEvent(w, StateEffect.mapEffects(e6.effects, x), E, e6.startSelection.map(T), C);
|
|
302
|
+
}
|
|
303
|
+
var joinableUserEvent = /^(input\.type|delete)($|\.)/, HistoryState = class e2 {
|
|
304
|
+
constructor(e6, x, S = 0, C = void 0) {
|
|
305
|
+
this.done = e6, this.undone = x, this.prevTime = S, this.prevUserEvent = C;
|
|
306
|
+
}
|
|
307
|
+
isolate() {
|
|
308
|
+
return this.prevTime ? new e2(this.done, this.undone) : this;
|
|
309
|
+
}
|
|
310
|
+
addChanges(x, S, C, w, T) {
|
|
311
|
+
let E = this.done, D = E[E.length - 1];
|
|
312
|
+
return E = D && D.changes && !D.changes.empty && x.changes && (!C || joinableUserEvent.test(C)) && (!D.selectionsAfter.length && S - this.prevTime < w.newGroupDelay && w.joinToEvent(T, isAdjacent(D.changes, x.changes)) || C == "input.type.compose") ? updateBranch(E, E.length - 1, w.minDepth, new HistEvent(x.changes.compose(D.changes), conc(StateEffect.mapEffects(x.effects, D.changes), D.effects), D.mapped, D.startSelection, none)) : updateBranch(E, E.length, w.minDepth, x), new e2(E, none, S, C);
|
|
313
|
+
}
|
|
314
|
+
addSelection(x, S, C, w) {
|
|
315
|
+
let T = this.done.length ? this.done[this.done.length - 1].selectionsAfter : none;
|
|
316
|
+
return T.length > 0 && S - this.prevTime < w && C == this.prevUserEvent && C && /^select($|\.)/.test(C) && eqSelectionShape(T[T.length - 1], x) ? this : new e2(addSelection(this.done, x), this.undone, S, C);
|
|
317
|
+
}
|
|
318
|
+
addMapping(x) {
|
|
319
|
+
return new e2(addMappingToBranch(this.done, x), addMappingToBranch(this.undone, x), this.prevTime, this.prevUserEvent);
|
|
320
|
+
}
|
|
321
|
+
pop(e6, x, S) {
|
|
322
|
+
let C = e6 == 0 ? this.done : this.undone;
|
|
323
|
+
if (C.length == 0) return null;
|
|
324
|
+
let w = C[C.length - 1], T = w.selectionsAfter[0] || (w.startSelection ? w.startSelection.map(w.changes.invertedDesc, 1) : x.selection);
|
|
325
|
+
if (S && w.selectionsAfter.length) return x.update({
|
|
326
|
+
selection: w.selectionsAfter[w.selectionsAfter.length - 1],
|
|
327
|
+
annotations: fromHistory.of({
|
|
328
|
+
side: e6,
|
|
329
|
+
rest: popSelection(C),
|
|
330
|
+
selection: T
|
|
331
|
+
}),
|
|
332
|
+
userEvent: e6 == 0 ? "select.undo" : "select.redo",
|
|
333
|
+
scrollIntoView: true
|
|
334
|
+
});
|
|
335
|
+
if (w.changes) {
|
|
336
|
+
let S2 = C.length == 1 ? none : C.slice(0, C.length - 1);
|
|
337
|
+
return w.mapped && (S2 = addMappingToBranch(S2, w.mapped)), x.update({
|
|
338
|
+
changes: w.changes,
|
|
339
|
+
selection: w.startSelection,
|
|
340
|
+
effects: w.effects,
|
|
341
|
+
annotations: fromHistory.of({
|
|
342
|
+
side: e6,
|
|
343
|
+
rest: S2,
|
|
344
|
+
selection: T
|
|
345
|
+
}),
|
|
346
|
+
filter: false,
|
|
347
|
+
userEvent: e6 == 0 ? "undo" : "redo",
|
|
348
|
+
scrollIntoView: true
|
|
349
|
+
});
|
|
350
|
+
} else return null;
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
HistoryState.empty = /* @__PURE__ */ new HistoryState(none, none);
|
|
354
|
+
var historyKeymap = [
|
|
355
|
+
{
|
|
356
|
+
key: "Mod-z",
|
|
357
|
+
run: undo,
|
|
358
|
+
preventDefault: true
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
key: "Mod-y",
|
|
362
|
+
mac: "Mod-Shift-z",
|
|
363
|
+
run: redo,
|
|
364
|
+
preventDefault: true
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
linux: "Ctrl-Shift-z",
|
|
368
|
+
run: redo,
|
|
369
|
+
preventDefault: true
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
key: "Mod-u",
|
|
373
|
+
run: undoSelection,
|
|
374
|
+
preventDefault: true
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
key: "Alt-u",
|
|
378
|
+
mac: "Mod-Shift-u",
|
|
379
|
+
run: redoSelection,
|
|
380
|
+
preventDefault: true
|
|
381
|
+
}
|
|
382
|
+
];
|
|
383
|
+
function updateSel(e6, x) {
|
|
384
|
+
return EditorSelection.create(e6.ranges.map(x), e6.mainIndex);
|
|
385
|
+
}
|
|
386
|
+
function setSel(e6, x) {
|
|
387
|
+
return e6.update({
|
|
388
|
+
selection: x,
|
|
389
|
+
scrollIntoView: true,
|
|
390
|
+
userEvent: "select"
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
function moveSel({ state: e6, dispatch: x }, S) {
|
|
394
|
+
let C = updateSel(e6.selection, S);
|
|
395
|
+
return C.eq(e6.selection, true) ? false : (x(setSel(e6, C)), true);
|
|
396
|
+
}
|
|
397
|
+
function rangeEnd(e6, x) {
|
|
398
|
+
return EditorSelection.cursor(x ? e6.to : e6.from);
|
|
399
|
+
}
|
|
400
|
+
function cursorByChar(e6, x) {
|
|
401
|
+
return moveSel(e6, (S) => S.empty ? e6.moveByChar(S, x) : rangeEnd(S, x));
|
|
402
|
+
}
|
|
403
|
+
function ltrAtCursor(e6) {
|
|
404
|
+
return e6.textDirectionAt(e6.state.selection.main.head) == Direction.LTR;
|
|
405
|
+
}
|
|
406
|
+
var cursorCharLeft = (e6) => cursorByChar(e6, !ltrAtCursor(e6)), cursorCharRight = (e6) => cursorByChar(e6, ltrAtCursor(e6));
|
|
407
|
+
function cursorByGroup(e6, x) {
|
|
408
|
+
return moveSel(e6, (S) => S.empty ? e6.moveByGroup(S, x) : rangeEnd(S, x));
|
|
409
|
+
}
|
|
410
|
+
var cursorGroupLeft = (e6) => cursorByGroup(e6, !ltrAtCursor(e6)), cursorGroupRight = (e6) => cursorByGroup(e6, ltrAtCursor(e6));
|
|
411
|
+
typeof Intl < "u" && Intl.Segmenter;
|
|
412
|
+
function interestingNode(e6, x, S) {
|
|
413
|
+
if (x.type.prop(S)) return true;
|
|
414
|
+
let C = x.to - x.from;
|
|
415
|
+
return C && (C > 2 || /[^\s,.;:]/.test(e6.sliceDoc(x.from, x.to))) || x.firstChild;
|
|
416
|
+
}
|
|
417
|
+
function moveBySyntax(e6, x, S) {
|
|
418
|
+
let C = syntaxTree(e6).resolveInner(x.head), w = S ? NodeProp.closedBy : NodeProp.openedBy;
|
|
419
|
+
for (let T2 = x.head; ; ) {
|
|
420
|
+
let x2 = S ? C.childAfter(T2) : C.childBefore(T2);
|
|
421
|
+
if (!x2) break;
|
|
422
|
+
interestingNode(e6, x2, w) ? C = x2 : T2 = S ? x2.to : x2.from;
|
|
423
|
+
}
|
|
424
|
+
let T = C.type.prop(w), E, D;
|
|
425
|
+
return D = T && (E = S ? matchBrackets(e6, C.from, 1) : matchBrackets(e6, C.to, -1)) && E.matched ? S ? E.end.to : E.end.from : S ? C.to : C.from, EditorSelection.cursor(D, S ? -1 : 1);
|
|
426
|
+
}
|
|
427
|
+
var cursorSyntaxLeft = (e6) => moveSel(e6, (x) => moveBySyntax(e6.state, x, !ltrAtCursor(e6))), cursorSyntaxRight = (e6) => moveSel(e6, (x) => moveBySyntax(e6.state, x, ltrAtCursor(e6)));
|
|
428
|
+
function cursorByLine(e6, x) {
|
|
429
|
+
return moveSel(e6, (S) => {
|
|
430
|
+
if (!S.empty) return rangeEnd(S, x);
|
|
431
|
+
let C = e6.moveVertically(S, x);
|
|
432
|
+
return C.head == S.head ? e6.moveToLineBoundary(S, x) : C;
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
var cursorLineUp = (e6) => cursorByLine(e6, false), cursorLineDown = (e6) => cursorByLine(e6, true);
|
|
436
|
+
function pageInfo(e6) {
|
|
437
|
+
let x = e6.scrollDOM.clientHeight < e6.scrollDOM.scrollHeight - 2, S = 0, C = 0, w;
|
|
438
|
+
if (x) {
|
|
439
|
+
for (let x2 of e6.state.facet(EditorView.scrollMargins)) {
|
|
440
|
+
let w2 = x2(e6);
|
|
441
|
+
(w2 == null ? void 0 : w2.top) && (S = Math.max(w2 == null ? void 0 : w2.top, S)), (w2 == null ? void 0 : w2.bottom) && (C = Math.max(w2 == null ? void 0 : w2.bottom, C));
|
|
442
|
+
}
|
|
443
|
+
w = e6.scrollDOM.clientHeight - S - C;
|
|
444
|
+
} else w = (e6.dom.ownerDocument.defaultView || window).innerHeight;
|
|
445
|
+
return {
|
|
446
|
+
marginTop: S,
|
|
447
|
+
marginBottom: C,
|
|
448
|
+
selfScroll: x,
|
|
449
|
+
height: Math.max(e6.defaultLineHeight, w - 5)
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
function cursorByPage(e6, x) {
|
|
453
|
+
let S = pageInfo(e6), { state: C } = e6, w = updateSel(C.selection, (C2) => C2.empty ? e6.moveVertically(C2, x, S.height) : rangeEnd(C2, x));
|
|
454
|
+
if (w.eq(C.selection)) return false;
|
|
455
|
+
let T;
|
|
456
|
+
if (S.selfScroll) {
|
|
457
|
+
let x2 = e6.coordsAtPos(C.selection.main.head), E = e6.scrollDOM.getBoundingClientRect(), D = E.top + S.marginTop, O = E.bottom - S.marginBottom;
|
|
458
|
+
x2 && x2.top > D && x2.bottom < O && (T = EditorView.scrollIntoView(w.main.head, {
|
|
459
|
+
y: "start",
|
|
460
|
+
yMargin: x2.top - D
|
|
461
|
+
}));
|
|
462
|
+
}
|
|
463
|
+
return e6.dispatch(setSel(C, w), { effects: T }), true;
|
|
464
|
+
}
|
|
465
|
+
var cursorPageUp = (e6) => cursorByPage(e6, false), cursorPageDown = (e6) => cursorByPage(e6, true);
|
|
466
|
+
function moveByLineBoundary(e6, x, S) {
|
|
467
|
+
let C = e6.lineBlockAt(x.head), w = e6.moveToLineBoundary(x, S);
|
|
468
|
+
if (w.head == x.head && w.head != (S ? C.to : C.from) && (w = e6.moveToLineBoundary(x, S, false)), !S && w.head == C.from && C.length) {
|
|
469
|
+
let S2 = /^\s*/.exec(e6.state.sliceDoc(C.from, Math.min(C.from + 100, C.to)))[0].length;
|
|
470
|
+
S2 && x.head != C.from + S2 && (w = EditorSelection.cursor(C.from + S2));
|
|
471
|
+
}
|
|
472
|
+
return w;
|
|
473
|
+
}
|
|
474
|
+
var cursorLineBoundaryForward = (e6) => moveSel(e6, (x) => moveByLineBoundary(e6, x, true)), cursorLineBoundaryBackward = (e6) => moveSel(e6, (x) => moveByLineBoundary(e6, x, false)), cursorLineBoundaryLeft = (e6) => moveSel(e6, (x) => moveByLineBoundary(e6, x, !ltrAtCursor(e6))), cursorLineBoundaryRight = (e6) => moveSel(e6, (x) => moveByLineBoundary(e6, x, ltrAtCursor(e6))), cursorLineStart = (e6) => moveSel(e6, (x) => EditorSelection.cursor(e6.lineBlockAt(x.head).from, 1)), cursorLineEnd = (e6) => moveSel(e6, (x) => EditorSelection.cursor(e6.lineBlockAt(x.head).to, -1));
|
|
475
|
+
function toMatchingBracket(e6, x, S) {
|
|
476
|
+
let C = false, w = updateSel(e6.selection, (x2) => {
|
|
477
|
+
let w2 = matchBrackets(e6, x2.head, -1) || matchBrackets(e6, x2.head, 1) || x2.head > 0 && matchBrackets(e6, x2.head - 1, 1) || x2.head < e6.doc.length && matchBrackets(e6, x2.head + 1, -1);
|
|
478
|
+
if (!w2 || !w2.end) return x2;
|
|
479
|
+
C = true;
|
|
480
|
+
let T = w2.start.from == x2.head ? w2.end.to : w2.end.from;
|
|
481
|
+
return S ? EditorSelection.range(x2.anchor, T) : EditorSelection.cursor(T);
|
|
482
|
+
});
|
|
483
|
+
return C ? (x(setSel(e6, w)), true) : false;
|
|
484
|
+
}
|
|
485
|
+
var cursorMatchingBracket = ({ state: e6, dispatch: x }) => toMatchingBracket(e6, x, false);
|
|
486
|
+
function extendSel(e6, x) {
|
|
487
|
+
let S = updateSel(e6.state.selection, (e7) => {
|
|
488
|
+
let S2 = x(e7);
|
|
489
|
+
return EditorSelection.range(e7.anchor, S2.head, S2.goalColumn, S2.bidiLevel || void 0);
|
|
490
|
+
});
|
|
491
|
+
return S.eq(e6.state.selection) ? false : (e6.dispatch(setSel(e6.state, S)), true);
|
|
492
|
+
}
|
|
493
|
+
function selectByChar(e6, x) {
|
|
494
|
+
return extendSel(e6, (S) => e6.moveByChar(S, x));
|
|
495
|
+
}
|
|
496
|
+
var selectCharLeft = (e6) => selectByChar(e6, !ltrAtCursor(e6)), selectCharRight = (e6) => selectByChar(e6, ltrAtCursor(e6));
|
|
497
|
+
function selectByGroup(e6, x) {
|
|
498
|
+
return extendSel(e6, (S) => e6.moveByGroup(S, x));
|
|
499
|
+
}
|
|
500
|
+
var selectGroupLeft = (e6) => selectByGroup(e6, !ltrAtCursor(e6)), selectGroupRight = (e6) => selectByGroup(e6, ltrAtCursor(e6)), selectSyntaxLeft = (e6) => extendSel(e6, (x) => moveBySyntax(e6.state, x, !ltrAtCursor(e6))), selectSyntaxRight = (e6) => extendSel(e6, (x) => moveBySyntax(e6.state, x, ltrAtCursor(e6)));
|
|
501
|
+
function selectByLine(e6, x) {
|
|
502
|
+
return extendSel(e6, (S) => e6.moveVertically(S, x));
|
|
503
|
+
}
|
|
504
|
+
var selectLineUp = (e6) => selectByLine(e6, false), selectLineDown = (e6) => selectByLine(e6, true);
|
|
505
|
+
function selectByPage(e6, x) {
|
|
506
|
+
return extendSel(e6, (S) => e6.moveVertically(S, x, pageInfo(e6).height));
|
|
507
|
+
}
|
|
508
|
+
var selectPageUp = (e6) => selectByPage(e6, false), selectPageDown = (e6) => selectByPage(e6, true), selectLineBoundaryForward = (e6) => extendSel(e6, (x) => moveByLineBoundary(e6, x, true)), selectLineBoundaryBackward = (e6) => extendSel(e6, (x) => moveByLineBoundary(e6, x, false)), selectLineBoundaryLeft = (e6) => extendSel(e6, (x) => moveByLineBoundary(e6, x, !ltrAtCursor(e6))), selectLineBoundaryRight = (e6) => extendSel(e6, (x) => moveByLineBoundary(e6, x, ltrAtCursor(e6))), selectLineStart = (e6) => extendSel(e6, (x) => EditorSelection.cursor(e6.lineBlockAt(x.head).from)), selectLineEnd = (e6) => extendSel(e6, (x) => EditorSelection.cursor(e6.lineBlockAt(x.head).to)), cursorDocStart = ({ state: e6, dispatch: x }) => (x(setSel(e6, { anchor: 0 })), true), cursorDocEnd = ({ state: e6, dispatch: x }) => (x(setSel(e6, { anchor: e6.doc.length })), true), selectDocStart = ({ state: e6, dispatch: x }) => (x(setSel(e6, {
|
|
509
|
+
anchor: e6.selection.main.anchor,
|
|
510
|
+
head: 0
|
|
511
|
+
})), true), selectDocEnd = ({ state: e6, dispatch: x }) => (x(setSel(e6, {
|
|
512
|
+
anchor: e6.selection.main.anchor,
|
|
513
|
+
head: e6.doc.length
|
|
514
|
+
})), true), selectAll = ({ state: e6, dispatch: x }) => (x(e6.update({
|
|
515
|
+
selection: {
|
|
516
|
+
anchor: 0,
|
|
517
|
+
head: e6.doc.length
|
|
518
|
+
},
|
|
519
|
+
userEvent: "select"
|
|
520
|
+
})), true), selectLine = ({ state: e6, dispatch: x }) => {
|
|
521
|
+
let S = selectedLineBlocks(e6).map(({ from: x2, to: S2 }) => EditorSelection.range(x2, Math.min(S2 + 1, e6.doc.length)));
|
|
522
|
+
return x(e6.update({
|
|
523
|
+
selection: EditorSelection.create(S),
|
|
524
|
+
userEvent: "select"
|
|
525
|
+
})), true;
|
|
526
|
+
}, selectParentSyntax = ({ state: e6, dispatch: x }) => {
|
|
527
|
+
let S = updateSel(e6.selection, (x2) => {
|
|
528
|
+
let S2 = syntaxTree(e6), C = S2.resolveStack(x2.from, 1);
|
|
529
|
+
if (x2.empty) {
|
|
530
|
+
let e7 = S2.resolveStack(x2.from, -1);
|
|
531
|
+
e7.node.from >= C.node.from && e7.node.to <= C.node.to && (C = e7);
|
|
532
|
+
}
|
|
533
|
+
for (let e7 = C; e7; e7 = e7.next) {
|
|
534
|
+
let { node: S3 } = e7;
|
|
535
|
+
if ((S3.from < x2.from && S3.to >= x2.to || S3.to > x2.to && S3.from <= x2.from) && e7.next) return EditorSelection.range(S3.to, S3.from);
|
|
536
|
+
}
|
|
537
|
+
return x2;
|
|
538
|
+
});
|
|
539
|
+
return S.eq(e6.selection) ? false : (x(setSel(e6, S)), true);
|
|
540
|
+
};
|
|
541
|
+
function addCursorVertically(e6, x) {
|
|
542
|
+
let { state: S } = e6, C = S.selection, w = S.selection.ranges.slice();
|
|
543
|
+
for (let C2 of S.selection.ranges) {
|
|
544
|
+
let T = S.doc.lineAt(C2.head);
|
|
545
|
+
if (x ? T.to < e6.state.doc.length : T.from > 0) for (let S2 = C2; ; ) {
|
|
546
|
+
let C3 = e6.moveVertically(S2, x);
|
|
547
|
+
if (C3.head < T.from || C3.head > T.to) {
|
|
548
|
+
w.some((e7) => e7.head == C3.head) || w.push(C3);
|
|
549
|
+
break;
|
|
550
|
+
} else if (C3.head == S2.head) break;
|
|
551
|
+
else S2 = C3;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
return w.length == C.ranges.length ? false : (e6.dispatch(setSel(S, EditorSelection.create(w, w.length - 1))), true);
|
|
555
|
+
}
|
|
556
|
+
var addCursorAbove = (e6) => addCursorVertically(e6, false), addCursorBelow = (e6) => addCursorVertically(e6, true), simplifySelection = ({ state: e6, dispatch: x }) => {
|
|
557
|
+
let S = e6.selection, C = null;
|
|
558
|
+
return S.ranges.length > 1 ? C = EditorSelection.create([S.main]) : S.main.empty || (C = EditorSelection.create([EditorSelection.cursor(S.main.head)])), C ? (x(setSel(e6, C)), true) : false;
|
|
559
|
+
};
|
|
560
|
+
function deleteBy(e6, x) {
|
|
561
|
+
if (e6.state.readOnly) return false;
|
|
562
|
+
let S = "delete.selection", { state: C } = e6, w = C.changeByRange((C2) => {
|
|
563
|
+
let { from: w2, to: T } = C2;
|
|
564
|
+
if (w2 == T) {
|
|
565
|
+
let E = x(C2);
|
|
566
|
+
E < w2 ? (S = "delete.backward", E = skipAtomic(e6, E, false)) : E > w2 && (S = "delete.forward", E = skipAtomic(e6, E, true)), w2 = Math.min(w2, E), T = Math.max(T, E);
|
|
567
|
+
} else w2 = skipAtomic(e6, w2, false), T = skipAtomic(e6, T, true);
|
|
568
|
+
return w2 == T ? { range: C2 } : {
|
|
569
|
+
changes: {
|
|
570
|
+
from: w2,
|
|
571
|
+
to: T
|
|
572
|
+
},
|
|
573
|
+
range: EditorSelection.cursor(w2, w2 < C2.head ? -1 : 1)
|
|
574
|
+
};
|
|
575
|
+
});
|
|
576
|
+
return w.changes.empty ? false : (e6.dispatch(C.update(w, {
|
|
577
|
+
scrollIntoView: true,
|
|
578
|
+
userEvent: S,
|
|
579
|
+
effects: S == "delete.selection" ? EditorView.announce.of(C.phrase("Selection deleted")) : void 0
|
|
580
|
+
})), true);
|
|
581
|
+
}
|
|
582
|
+
function skipAtomic(e6, x, S) {
|
|
583
|
+
if (e6 instanceof EditorView) for (let C of e6.state.facet(EditorView.atomicRanges).map((x2) => x2(e6))) C.between(x, x, (e7, C2) => {
|
|
584
|
+
e7 < x && C2 > x && (x = S ? C2 : e7);
|
|
585
|
+
});
|
|
586
|
+
return x;
|
|
587
|
+
}
|
|
588
|
+
var deleteByChar = (e6, x, S) => deleteBy(e6, (C) => {
|
|
589
|
+
let w = C.from, { state: T } = e6, E = T.doc.lineAt(w), D, O;
|
|
590
|
+
if (S && !x && w > E.from && w < E.from + 200 && !/[^ \t]/.test(D = E.text.slice(0, w - E.from))) {
|
|
591
|
+
if (D[D.length - 1] == " ") return w - 1;
|
|
592
|
+
let e7 = countColumn(D, T.tabSize) % getIndentUnit(T) || getIndentUnit(T);
|
|
593
|
+
for (let x2 = 0; x2 < e7 && D[D.length - 1 - x2] == " "; x2++) w--;
|
|
594
|
+
O = w;
|
|
595
|
+
} else O = findClusterBreak(E.text, w - E.from, x, x) + E.from, O == w && E.number != (x ? T.doc.lines : 1) ? O += x ? 1 : -1 : !x && /[\ufe00-\ufe0f]/.test(E.text.slice(O - E.from, w - E.from)) && (O = findClusterBreak(E.text, O - E.from, false, false) + E.from);
|
|
596
|
+
return O;
|
|
597
|
+
}), deleteCharBackward = (e6) => deleteByChar(e6, false, true), deleteCharForward = (e6) => deleteByChar(e6, true, false), deleteByGroup = (e6, x) => deleteBy(e6, (S) => {
|
|
598
|
+
let C = S.head, { state: w } = e6, T = w.doc.lineAt(C), E = w.charCategorizer(C);
|
|
599
|
+
for (let e7 = null; ; ) {
|
|
600
|
+
if (C == (x ? T.to : T.from)) {
|
|
601
|
+
C == S.head && T.number != (x ? w.doc.lines : 1) && (C += x ? 1 : -1);
|
|
602
|
+
break;
|
|
603
|
+
}
|
|
604
|
+
let D = findClusterBreak(T.text, C - T.from, x) + T.from, O = T.text.slice(Math.min(C, D) - T.from, Math.max(C, D) - T.from), k = E(O);
|
|
605
|
+
if (e7 != null && k != e7) break;
|
|
606
|
+
(O != " " || C != S.head) && (e7 = k), C = D;
|
|
607
|
+
}
|
|
608
|
+
return C;
|
|
609
|
+
}), deleteGroupBackward = (e6) => deleteByGroup(e6, false), deleteGroupForward = (e6) => deleteByGroup(e6, true), deleteToLineEnd = (e6) => deleteBy(e6, (x) => {
|
|
610
|
+
let S = e6.lineBlockAt(x.head).to;
|
|
611
|
+
return x.head < S ? S : Math.min(e6.state.doc.length, x.head + 1);
|
|
612
|
+
}), deleteLineBoundaryBackward = (e6) => deleteBy(e6, (x) => {
|
|
613
|
+
let S = e6.moveToLineBoundary(x, false).head;
|
|
614
|
+
return x.head > S ? S : Math.max(0, x.head - 1);
|
|
615
|
+
}), deleteLineBoundaryForward = (e6) => deleteBy(e6, (x) => {
|
|
616
|
+
let S = e6.moveToLineBoundary(x, true).head;
|
|
617
|
+
return x.head < S ? S : Math.min(e6.state.doc.length, x.head + 1);
|
|
618
|
+
}), splitLine = ({ state: e6, dispatch: x }) => {
|
|
619
|
+
if (e6.readOnly) return false;
|
|
620
|
+
let S = e6.changeByRange((e7) => ({
|
|
621
|
+
changes: {
|
|
622
|
+
from: e7.from,
|
|
623
|
+
to: e7.to,
|
|
624
|
+
insert: Text.of(["", ""])
|
|
625
|
+
},
|
|
626
|
+
range: EditorSelection.cursor(e7.from)
|
|
627
|
+
}));
|
|
628
|
+
return x(e6.update(S, {
|
|
629
|
+
scrollIntoView: true,
|
|
630
|
+
userEvent: "input"
|
|
631
|
+
})), true;
|
|
632
|
+
}, transposeChars = ({ state: e6, dispatch: x }) => {
|
|
633
|
+
if (e6.readOnly) return false;
|
|
634
|
+
let S = e6.changeByRange((x2) => {
|
|
635
|
+
if (!x2.empty || x2.from == 0 || x2.from == e6.doc.length) return { range: x2 };
|
|
636
|
+
let S2 = x2.from, C = e6.doc.lineAt(S2), w = S2 == C.from ? S2 - 1 : findClusterBreak(C.text, S2 - C.from, false) + C.from, T = S2 == C.to ? S2 + 1 : findClusterBreak(C.text, S2 - C.from, true) + C.from;
|
|
637
|
+
return {
|
|
638
|
+
changes: {
|
|
639
|
+
from: w,
|
|
640
|
+
to: T,
|
|
641
|
+
insert: e6.doc.slice(S2, T).append(e6.doc.slice(w, S2))
|
|
642
|
+
},
|
|
643
|
+
range: EditorSelection.cursor(T)
|
|
644
|
+
};
|
|
645
|
+
});
|
|
646
|
+
return S.changes.empty ? false : (x(e6.update(S, {
|
|
647
|
+
scrollIntoView: true,
|
|
648
|
+
userEvent: "move.character"
|
|
649
|
+
})), true);
|
|
650
|
+
};
|
|
651
|
+
function selectedLineBlocks(e6) {
|
|
652
|
+
let x = [], S = -1;
|
|
653
|
+
for (let C of e6.selection.ranges) {
|
|
654
|
+
let w = e6.doc.lineAt(C.from), T = e6.doc.lineAt(C.to);
|
|
655
|
+
if (!C.empty && C.to == T.from && (T = e6.doc.lineAt(C.to - 1)), S >= w.number) {
|
|
656
|
+
let e7 = x[x.length - 1];
|
|
657
|
+
e7.to = T.to, e7.ranges.push(C);
|
|
658
|
+
} else x.push({
|
|
659
|
+
from: w.from,
|
|
660
|
+
to: T.to,
|
|
661
|
+
ranges: [C]
|
|
662
|
+
});
|
|
663
|
+
S = T.number + 1;
|
|
664
|
+
}
|
|
665
|
+
return x;
|
|
666
|
+
}
|
|
667
|
+
function moveLine(e6, x, S) {
|
|
668
|
+
if (e6.readOnly) return false;
|
|
669
|
+
let C = [], w = [];
|
|
670
|
+
for (let x2 of selectedLineBlocks(e6)) {
|
|
671
|
+
if (S ? x2.to == e6.doc.length : x2.from == 0) continue;
|
|
672
|
+
let T = e6.doc.lineAt(S ? x2.to + 1 : x2.from - 1), E = T.length + 1;
|
|
673
|
+
if (S) {
|
|
674
|
+
C.push({
|
|
675
|
+
from: x2.to,
|
|
676
|
+
to: T.to
|
|
677
|
+
}, {
|
|
678
|
+
from: x2.from,
|
|
679
|
+
insert: T.text + e6.lineBreak
|
|
680
|
+
});
|
|
681
|
+
for (let S2 of x2.ranges) w.push(EditorSelection.range(Math.min(e6.doc.length, S2.anchor + E), Math.min(e6.doc.length, S2.head + E)));
|
|
682
|
+
} else {
|
|
683
|
+
C.push({
|
|
684
|
+
from: T.from,
|
|
685
|
+
to: x2.from
|
|
686
|
+
}, {
|
|
687
|
+
from: x2.to,
|
|
688
|
+
insert: e6.lineBreak + T.text
|
|
689
|
+
});
|
|
690
|
+
for (let e7 of x2.ranges) w.push(EditorSelection.range(e7.anchor - E, e7.head - E));
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
return C.length ? (x(e6.update({
|
|
694
|
+
changes: C,
|
|
695
|
+
scrollIntoView: true,
|
|
696
|
+
selection: EditorSelection.create(w, e6.selection.mainIndex),
|
|
697
|
+
userEvent: "move.line"
|
|
698
|
+
})), true) : false;
|
|
699
|
+
}
|
|
700
|
+
var moveLineUp = ({ state: e6, dispatch: x }) => moveLine(e6, x, false), moveLineDown = ({ state: e6, dispatch: x }) => moveLine(e6, x, true);
|
|
701
|
+
function copyLine(e6, x, S) {
|
|
702
|
+
if (e6.readOnly) return false;
|
|
703
|
+
let C = [];
|
|
704
|
+
for (let x2 of selectedLineBlocks(e6)) S ? C.push({
|
|
705
|
+
from: x2.from,
|
|
706
|
+
insert: e6.doc.slice(x2.from, x2.to) + e6.lineBreak
|
|
707
|
+
}) : C.push({
|
|
708
|
+
from: x2.to,
|
|
709
|
+
insert: e6.lineBreak + e6.doc.slice(x2.from, x2.to)
|
|
710
|
+
});
|
|
711
|
+
let w = e6.changes(C);
|
|
712
|
+
return x(e6.update({
|
|
713
|
+
changes: w,
|
|
714
|
+
selection: e6.selection.map(w, S ? 1 : -1),
|
|
715
|
+
scrollIntoView: true,
|
|
716
|
+
userEvent: "input.copyline"
|
|
717
|
+
})), true;
|
|
718
|
+
}
|
|
719
|
+
var copyLineUp = ({ state: e6, dispatch: x }) => copyLine(e6, x, false), copyLineDown = ({ state: e6, dispatch: x }) => copyLine(e6, x, true), deleteLine = (e6) => {
|
|
720
|
+
if (e6.state.readOnly) return false;
|
|
721
|
+
let { state: x } = e6, S = x.changes(selectedLineBlocks(x).map(({ from: e7, to: S2 }) => (e7 > 0 ? e7-- : S2 < x.doc.length && S2++, {
|
|
722
|
+
from: e7,
|
|
723
|
+
to: S2
|
|
724
|
+
}))), C = updateSel(x.selection, (x2) => {
|
|
725
|
+
let S2;
|
|
726
|
+
if (e6.lineWrapping) {
|
|
727
|
+
let C2 = e6.lineBlockAt(x2.head), w = e6.coordsAtPos(x2.head, x2.assoc || 1);
|
|
728
|
+
w && (S2 = C2.bottom + e6.documentTop - w.bottom + e6.defaultLineHeight / 2);
|
|
729
|
+
}
|
|
730
|
+
return e6.moveVertically(x2, true, S2);
|
|
731
|
+
}).map(S);
|
|
732
|
+
return e6.dispatch({
|
|
733
|
+
changes: S,
|
|
734
|
+
selection: C,
|
|
735
|
+
scrollIntoView: true,
|
|
736
|
+
userEvent: "delete.line"
|
|
737
|
+
}), true;
|
|
738
|
+
};
|
|
739
|
+
function isBetweenBrackets(e6, x) {
|
|
740
|
+
if (/\(\)|\[\]|\{\}/.test(e6.sliceDoc(x - 1, x + 1))) return {
|
|
741
|
+
from: x,
|
|
742
|
+
to: x
|
|
743
|
+
};
|
|
744
|
+
let S = syntaxTree(e6).resolveInner(x), C = S.childBefore(x), w = S.childAfter(x), T;
|
|
745
|
+
return C && w && C.to <= x && w.from >= x && (T = C.type.prop(NodeProp.closedBy)) && T.indexOf(w.name) > -1 && e6.doc.lineAt(C.to).from == e6.doc.lineAt(w.from).from && !/\S/.test(e6.sliceDoc(C.to, w.from)) ? {
|
|
746
|
+
from: C.to,
|
|
747
|
+
to: w.from
|
|
748
|
+
} : null;
|
|
749
|
+
}
|
|
750
|
+
var insertNewlineAndIndent = /* @__PURE__ */ newlineAndIndent(false), insertBlankLine = /* @__PURE__ */ newlineAndIndent(true);
|
|
751
|
+
function newlineAndIndent(e6) {
|
|
752
|
+
return ({ state: x, dispatch: S }) => {
|
|
753
|
+
if (x.readOnly) return false;
|
|
754
|
+
let C = x.changeByRange((S2) => {
|
|
755
|
+
let { from: C2, to: w } = S2, T = x.doc.lineAt(C2), E = !e6 && C2 == w && isBetweenBrackets(x, C2);
|
|
756
|
+
e6 && (C2 = w = (w <= T.to ? T : x.doc.lineAt(w)).to);
|
|
757
|
+
let D = new IndentContext(x, {
|
|
758
|
+
simulateBreak: C2,
|
|
759
|
+
simulateDoubleBreak: !!E
|
|
760
|
+
}), O = getIndentation(D, C2);
|
|
761
|
+
for (O ?? (O = countColumn(/^\s*/.exec(x.doc.lineAt(C2).text)[0], x.tabSize)); w < T.to && /\s/.test(T.text[w - T.from]); ) w++;
|
|
762
|
+
E ? { from: C2, to: w } = E : C2 > T.from && C2 < T.from + 100 && !/\S/.test(T.text.slice(0, C2)) && (C2 = T.from);
|
|
763
|
+
let k = ["", indentString(x, O)];
|
|
764
|
+
return E && k.push(indentString(x, D.lineIndent(T.from, -1))), {
|
|
765
|
+
changes: {
|
|
766
|
+
from: C2,
|
|
767
|
+
to: w,
|
|
768
|
+
insert: Text.of(k)
|
|
769
|
+
},
|
|
770
|
+
range: EditorSelection.cursor(C2 + 1 + k[1].length)
|
|
771
|
+
};
|
|
772
|
+
});
|
|
773
|
+
return S(x.update(C, {
|
|
774
|
+
scrollIntoView: true,
|
|
775
|
+
userEvent: "input"
|
|
776
|
+
})), true;
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
function changeBySelectedLine(e6, x) {
|
|
780
|
+
let S = -1;
|
|
781
|
+
return e6.changeByRange((C) => {
|
|
782
|
+
let w = [];
|
|
783
|
+
for (let T2 = C.from; T2 <= C.to; ) {
|
|
784
|
+
let E = e6.doc.lineAt(T2);
|
|
785
|
+
E.number > S && (C.empty || C.to > E.from) && (x(E, w, C), S = E.number), T2 = E.to + 1;
|
|
786
|
+
}
|
|
787
|
+
let T = e6.changes(w);
|
|
788
|
+
return {
|
|
789
|
+
changes: w,
|
|
790
|
+
range: EditorSelection.range(T.mapPos(C.anchor, 1), T.mapPos(C.head, 1))
|
|
791
|
+
};
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
var indentSelection = ({ state: e6, dispatch: x }) => {
|
|
795
|
+
if (e6.readOnly) return false;
|
|
796
|
+
let S = /* @__PURE__ */ Object.create(null), C = new IndentContext(e6, { overrideIndentation: (e7) => S[e7] ?? -1 }), w = changeBySelectedLine(e6, (x2, w2, T) => {
|
|
797
|
+
let E = getIndentation(C, x2.from);
|
|
798
|
+
if (E == null) return;
|
|
799
|
+
/\S/.test(x2.text) || (E = 0);
|
|
800
|
+
let D = /^\s*/.exec(x2.text)[0], O = indentString(e6, E);
|
|
801
|
+
(D != O || T.from < x2.from + D.length) && (S[x2.from] = E, w2.push({
|
|
802
|
+
from: x2.from,
|
|
803
|
+
to: x2.from + D.length,
|
|
804
|
+
insert: O
|
|
805
|
+
}));
|
|
806
|
+
});
|
|
807
|
+
return w.changes.empty || x(e6.update(w, { userEvent: "indent" })), true;
|
|
808
|
+
}, indentMore = ({ state: e6, dispatch: x }) => e6.readOnly ? false : (x(e6.update(changeBySelectedLine(e6, (x2, S) => {
|
|
809
|
+
S.push({
|
|
810
|
+
from: x2.from,
|
|
811
|
+
insert: e6.facet(indentUnit)
|
|
812
|
+
});
|
|
813
|
+
}), { userEvent: "input.indent" })), true), indentLess = ({ state: e6, dispatch: x }) => e6.readOnly ? false : (x(e6.update(changeBySelectedLine(e6, (x2, S) => {
|
|
814
|
+
let C = /^\s*/.exec(x2.text)[0];
|
|
815
|
+
if (!C) return;
|
|
816
|
+
let w = countColumn(C, e6.tabSize), T = 0, E = indentString(e6, Math.max(0, w - getIndentUnit(e6)));
|
|
817
|
+
for (; T < C.length && T < E.length && C.charCodeAt(T) == E.charCodeAt(T); ) T++;
|
|
818
|
+
S.push({
|
|
819
|
+
from: x2.from + T,
|
|
820
|
+
to: x2.from + C.length,
|
|
821
|
+
insert: E.slice(T)
|
|
822
|
+
});
|
|
823
|
+
}), { userEvent: "delete.dedent" })), true), toggleTabFocusMode = (e6) => (e6.setTabFocusMode(), true), insertTab = ({ state: e6, dispatch: x }) => e6.selection.ranges.some((e7) => !e7.empty) ? indentMore({
|
|
824
|
+
state: e6,
|
|
825
|
+
dispatch: x
|
|
826
|
+
}) : (x(e6.update(e6.replaceSelection(" "), {
|
|
827
|
+
scrollIntoView: true,
|
|
828
|
+
userEvent: "input"
|
|
829
|
+
})), true), emacsStyleKeymap = [
|
|
830
|
+
{
|
|
831
|
+
key: "Ctrl-b",
|
|
832
|
+
run: cursorCharLeft,
|
|
833
|
+
shift: selectCharLeft,
|
|
834
|
+
preventDefault: true
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
key: "Ctrl-f",
|
|
838
|
+
run: cursorCharRight,
|
|
839
|
+
shift: selectCharRight
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
key: "Ctrl-p",
|
|
843
|
+
run: cursorLineUp,
|
|
844
|
+
shift: selectLineUp
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
key: "Ctrl-n",
|
|
848
|
+
run: cursorLineDown,
|
|
849
|
+
shift: selectLineDown
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
key: "Ctrl-a",
|
|
853
|
+
run: cursorLineStart,
|
|
854
|
+
shift: selectLineStart
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
key: "Ctrl-e",
|
|
858
|
+
run: cursorLineEnd,
|
|
859
|
+
shift: selectLineEnd
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
key: "Ctrl-d",
|
|
863
|
+
run: deleteCharForward
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
key: "Ctrl-h",
|
|
867
|
+
run: deleteCharBackward
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
key: "Ctrl-k",
|
|
871
|
+
run: deleteToLineEnd
|
|
872
|
+
},
|
|
873
|
+
{
|
|
874
|
+
key: "Ctrl-Alt-h",
|
|
875
|
+
run: deleteGroupBackward
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
key: "Ctrl-o",
|
|
879
|
+
run: splitLine
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
key: "Ctrl-t",
|
|
883
|
+
run: transposeChars
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
key: "Ctrl-v",
|
|
887
|
+
run: cursorPageDown
|
|
888
|
+
}
|
|
889
|
+
], standardKeymap = /* @__PURE__ */ [
|
|
890
|
+
{
|
|
891
|
+
key: "ArrowLeft",
|
|
892
|
+
run: cursorCharLeft,
|
|
893
|
+
shift: selectCharLeft,
|
|
894
|
+
preventDefault: true
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
key: "Mod-ArrowLeft",
|
|
898
|
+
mac: "Alt-ArrowLeft",
|
|
899
|
+
run: cursorGroupLeft,
|
|
900
|
+
shift: selectGroupLeft,
|
|
901
|
+
preventDefault: true
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
mac: "Cmd-ArrowLeft",
|
|
905
|
+
run: cursorLineBoundaryLeft,
|
|
906
|
+
shift: selectLineBoundaryLeft,
|
|
907
|
+
preventDefault: true
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
key: "ArrowRight",
|
|
911
|
+
run: cursorCharRight,
|
|
912
|
+
shift: selectCharRight,
|
|
913
|
+
preventDefault: true
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
key: "Mod-ArrowRight",
|
|
917
|
+
mac: "Alt-ArrowRight",
|
|
918
|
+
run: cursorGroupRight,
|
|
919
|
+
shift: selectGroupRight,
|
|
920
|
+
preventDefault: true
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
mac: "Cmd-ArrowRight",
|
|
924
|
+
run: cursorLineBoundaryRight,
|
|
925
|
+
shift: selectLineBoundaryRight,
|
|
926
|
+
preventDefault: true
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
key: "ArrowUp",
|
|
930
|
+
run: cursorLineUp,
|
|
931
|
+
shift: selectLineUp,
|
|
932
|
+
preventDefault: true
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
mac: "Cmd-ArrowUp",
|
|
936
|
+
run: cursorDocStart,
|
|
937
|
+
shift: selectDocStart
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
mac: "Ctrl-ArrowUp",
|
|
941
|
+
run: cursorPageUp,
|
|
942
|
+
shift: selectPageUp
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
key: "ArrowDown",
|
|
946
|
+
run: cursorLineDown,
|
|
947
|
+
shift: selectLineDown,
|
|
948
|
+
preventDefault: true
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
mac: "Cmd-ArrowDown",
|
|
952
|
+
run: cursorDocEnd,
|
|
953
|
+
shift: selectDocEnd
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
mac: "Ctrl-ArrowDown",
|
|
957
|
+
run: cursorPageDown,
|
|
958
|
+
shift: selectPageDown
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
key: "PageUp",
|
|
962
|
+
run: cursorPageUp,
|
|
963
|
+
shift: selectPageUp
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
key: "PageDown",
|
|
967
|
+
run: cursorPageDown,
|
|
968
|
+
shift: selectPageDown
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
key: "Home",
|
|
972
|
+
run: cursorLineBoundaryBackward,
|
|
973
|
+
shift: selectLineBoundaryBackward,
|
|
974
|
+
preventDefault: true
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
key: "Mod-Home",
|
|
978
|
+
run: cursorDocStart,
|
|
979
|
+
shift: selectDocStart
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
key: "End",
|
|
983
|
+
run: cursorLineBoundaryForward,
|
|
984
|
+
shift: selectLineBoundaryForward,
|
|
985
|
+
preventDefault: true
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
key: "Mod-End",
|
|
989
|
+
run: cursorDocEnd,
|
|
990
|
+
shift: selectDocEnd
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
key: "Enter",
|
|
994
|
+
run: insertNewlineAndIndent,
|
|
995
|
+
shift: insertNewlineAndIndent
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
key: "Mod-a",
|
|
999
|
+
run: selectAll
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
key: "Backspace",
|
|
1003
|
+
run: deleteCharBackward,
|
|
1004
|
+
shift: deleteCharBackward,
|
|
1005
|
+
preventDefault: true
|
|
1006
|
+
},
|
|
1007
|
+
{
|
|
1008
|
+
key: "Delete",
|
|
1009
|
+
run: deleteCharForward,
|
|
1010
|
+
preventDefault: true
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
key: "Mod-Backspace",
|
|
1014
|
+
mac: "Alt-Backspace",
|
|
1015
|
+
run: deleteGroupBackward,
|
|
1016
|
+
preventDefault: true
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
key: "Mod-Delete",
|
|
1020
|
+
mac: "Alt-Delete",
|
|
1021
|
+
run: deleteGroupForward,
|
|
1022
|
+
preventDefault: true
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
mac: "Mod-Backspace",
|
|
1026
|
+
run: deleteLineBoundaryBackward,
|
|
1027
|
+
preventDefault: true
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
mac: "Mod-Delete",
|
|
1031
|
+
run: deleteLineBoundaryForward,
|
|
1032
|
+
preventDefault: true
|
|
1033
|
+
}
|
|
1034
|
+
].concat(/* @__PURE__ */ emacsStyleKeymap.map((e6) => ({
|
|
1035
|
+
mac: e6.key,
|
|
1036
|
+
run: e6.run,
|
|
1037
|
+
shift: e6.shift
|
|
1038
|
+
}))), defaultKeymap = /* @__PURE__ */ [
|
|
1039
|
+
{
|
|
1040
|
+
key: "Alt-ArrowLeft",
|
|
1041
|
+
mac: "Ctrl-ArrowLeft",
|
|
1042
|
+
run: cursorSyntaxLeft,
|
|
1043
|
+
shift: selectSyntaxLeft
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
key: "Alt-ArrowRight",
|
|
1047
|
+
mac: "Ctrl-ArrowRight",
|
|
1048
|
+
run: cursorSyntaxRight,
|
|
1049
|
+
shift: selectSyntaxRight
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
key: "Alt-ArrowUp",
|
|
1053
|
+
run: moveLineUp
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
key: "Shift-Alt-ArrowUp",
|
|
1057
|
+
run: copyLineUp
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
key: "Alt-ArrowDown",
|
|
1061
|
+
run: moveLineDown
|
|
1062
|
+
},
|
|
1063
|
+
{
|
|
1064
|
+
key: "Shift-Alt-ArrowDown",
|
|
1065
|
+
run: copyLineDown
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
key: "Mod-Alt-ArrowUp",
|
|
1069
|
+
run: addCursorAbove
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
key: "Mod-Alt-ArrowDown",
|
|
1073
|
+
run: addCursorBelow
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
key: "Escape",
|
|
1077
|
+
run: simplifySelection
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
key: "Mod-Enter",
|
|
1081
|
+
run: insertBlankLine
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
key: "Alt-l",
|
|
1085
|
+
mac: "Ctrl-l",
|
|
1086
|
+
run: selectLine
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
key: "Mod-i",
|
|
1090
|
+
run: selectParentSyntax,
|
|
1091
|
+
preventDefault: true
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
key: "Mod-[",
|
|
1095
|
+
run: indentLess
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
key: "Mod-]",
|
|
1099
|
+
run: indentMore
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
key: "Mod-Alt-\\",
|
|
1103
|
+
run: indentSelection
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
key: "Shift-Mod-k",
|
|
1107
|
+
run: deleteLine
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
key: "Shift-Mod-\\",
|
|
1111
|
+
run: cursorMatchingBracket
|
|
1112
|
+
},
|
|
1113
|
+
{
|
|
1114
|
+
key: "Mod-/",
|
|
1115
|
+
run: toggleComment
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
key: "Alt-A",
|
|
1119
|
+
run: toggleBlockComment
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
key: "Ctrl-m",
|
|
1123
|
+
mac: "Shift-Alt-m",
|
|
1124
|
+
run: toggleTabFocusMode
|
|
1125
|
+
}
|
|
1126
|
+
].concat(standardKeymap), indentWithTab = {
|
|
1127
|
+
key: "Tab",
|
|
1128
|
+
run: indentMore,
|
|
1129
|
+
shift: indentLess
|
|
1130
|
+
}, SelectedDiagnostic = class {
|
|
1131
|
+
constructor(e6, x, S) {
|
|
1132
|
+
this.from = e6, this.to = x, this.diagnostic = S;
|
|
1133
|
+
}
|
|
1134
|
+
}, LintState = class e3 {
|
|
1135
|
+
constructor(e6, x, S) {
|
|
1136
|
+
this.diagnostics = e6, this.panel = x, this.selected = S;
|
|
1137
|
+
}
|
|
1138
|
+
static init(x, S, C) {
|
|
1139
|
+
let w = C.facet(lintConfig).markerFilter;
|
|
1140
|
+
w && (x = w(x, C));
|
|
1141
|
+
let T = x.slice().sort((e6, x2) => e6.from - x2.from || e6.to - x2.to), E = new RangeSetBuilder(), D = [], O = 0, k = C.doc.iter(), A = 0, j = C.doc.length;
|
|
1142
|
+
for (let e6 = 0; ; ) {
|
|
1143
|
+
let x2 = e6 == T.length ? null : T[e6];
|
|
1144
|
+
if (!x2 && !D.length) break;
|
|
1145
|
+
let S2, C2;
|
|
1146
|
+
if (D.length) S2 = O, C2 = D.reduce((e7, x3) => Math.min(e7, x3.to), x2 && x2.from > S2 ? x2.from : 1e8);
|
|
1147
|
+
else {
|
|
1148
|
+
if (S2 = x2.from, S2 > j) break;
|
|
1149
|
+
C2 = x2.to, D.push(x2), e6++;
|
|
1150
|
+
}
|
|
1151
|
+
for (; e6 < T.length; ) {
|
|
1152
|
+
let x3 = T[e6];
|
|
1153
|
+
if (x3.from == S2 && (x3.to > x3.from || x3.to == S2)) D.push(x3), e6++, C2 = Math.min(x3.to, C2);
|
|
1154
|
+
else {
|
|
1155
|
+
C2 = Math.min(x3.from, C2);
|
|
1156
|
+
break;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
C2 = Math.min(C2, j);
|
|
1160
|
+
let w2 = false;
|
|
1161
|
+
if (D.some((e7) => e7.from == S2 && (e7.to == C2 || C2 == j)) && (w2 = S2 == C2, !w2 && C2 - S2 < 10)) {
|
|
1162
|
+
let e7 = S2 - (A + k.value.length);
|
|
1163
|
+
e7 > 0 && (k.next(e7), A = S2);
|
|
1164
|
+
for (let e8 = S2; ; ) {
|
|
1165
|
+
if (e8 >= C2) {
|
|
1166
|
+
w2 = true;
|
|
1167
|
+
break;
|
|
1168
|
+
}
|
|
1169
|
+
if (!k.lineBreak && A + k.value.length > e8) break;
|
|
1170
|
+
e8 = A + k.value.length, A += k.value.length, k.next();
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
let M2 = maxSeverity(D);
|
|
1174
|
+
if (w2) E.add(S2, S2, Decoration.widget({
|
|
1175
|
+
widget: new DiagnosticWidget(M2),
|
|
1176
|
+
diagnostics: D.slice()
|
|
1177
|
+
}));
|
|
1178
|
+
else {
|
|
1179
|
+
let e7 = D.reduce((e8, x3) => x3.markClass ? e8 + " " + x3.markClass : e8, "");
|
|
1180
|
+
E.add(S2, C2, Decoration.mark({
|
|
1181
|
+
class: "cm-lintRange cm-lintRange-" + M2 + e7,
|
|
1182
|
+
diagnostics: D.slice(),
|
|
1183
|
+
inclusiveEnd: D.some((e8) => e8.to > C2)
|
|
1184
|
+
}));
|
|
1185
|
+
}
|
|
1186
|
+
if (O = C2, O == j) break;
|
|
1187
|
+
for (let e7 = 0; e7 < D.length; e7++) D[e7].to <= O && D.splice(e7--, 1);
|
|
1188
|
+
}
|
|
1189
|
+
let M = E.finish();
|
|
1190
|
+
return new e3(M, S, findDiagnostic(M));
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
function findDiagnostic(e6, x = null, S = 0) {
|
|
1194
|
+
let C = null;
|
|
1195
|
+
return e6.between(S, 1e9, (e7, S2, { spec: w }) => {
|
|
1196
|
+
if (!(x && w.diagnostics.indexOf(x) < 0)) if (!C) C = new SelectedDiagnostic(e7, S2, x || w.diagnostics[0]);
|
|
1197
|
+
else if (w.diagnostics.indexOf(C.diagnostic) < 0) return false;
|
|
1198
|
+
else C = new SelectedDiagnostic(C.from, S2, C.diagnostic);
|
|
1199
|
+
}), C;
|
|
1200
|
+
}
|
|
1201
|
+
function hideTooltip(e6, x) {
|
|
1202
|
+
let S = x.pos, C = x.end || S, w = e6.state.facet(lintConfig).hideOn(e6, S, C);
|
|
1203
|
+
if (w != null) return w;
|
|
1204
|
+
let T = e6.startState.doc.lineAt(x.pos);
|
|
1205
|
+
return !!(e6.effects.some((e7) => e7.is(setDiagnosticsEffect)) || e6.changes.touchesRange(T.from, Math.max(T.to, C)));
|
|
1206
|
+
}
|
|
1207
|
+
function maybeEnableLint(e6, x) {
|
|
1208
|
+
return e6.field(lintState, false) ? x : x.concat(StateEffect.appendConfig.of(lintExtensions));
|
|
1209
|
+
}
|
|
1210
|
+
function setDiagnostics(e6, x) {
|
|
1211
|
+
return { effects: maybeEnableLint(e6, [setDiagnosticsEffect.of(x)]) };
|
|
1212
|
+
}
|
|
1213
|
+
var setDiagnosticsEffect = /* @__PURE__ */ StateEffect.define(), togglePanel$1 = /* @__PURE__ */ StateEffect.define(), movePanelSelection = /* @__PURE__ */ StateEffect.define(), lintState = /* @__PURE__ */ StateField.define({
|
|
1214
|
+
create() {
|
|
1215
|
+
return new LintState(Decoration.none, null, null);
|
|
1216
|
+
},
|
|
1217
|
+
update(e6, x) {
|
|
1218
|
+
if (x.docChanged && e6.diagnostics.size) {
|
|
1219
|
+
let S = e6.diagnostics.map(x.changes), C = null, w = e6.panel;
|
|
1220
|
+
if (e6.selected) {
|
|
1221
|
+
let w2 = x.changes.mapPos(e6.selected.from, 1);
|
|
1222
|
+
C = findDiagnostic(S, e6.selected.diagnostic, w2) || findDiagnostic(S, null, w2);
|
|
1223
|
+
}
|
|
1224
|
+
!S.size && w && x.state.facet(lintConfig).autoPanel && (w = null), e6 = new LintState(S, w, C);
|
|
1225
|
+
}
|
|
1226
|
+
for (let S of x.effects) if (S.is(setDiagnosticsEffect)) {
|
|
1227
|
+
let C = x.state.facet(lintConfig).autoPanel ? S.value.length ? LintPanel.open : null : e6.panel;
|
|
1228
|
+
e6 = LintState.init(S.value, C, x.state);
|
|
1229
|
+
} else S.is(togglePanel$1) ? e6 = new LintState(e6.diagnostics, S.value ? LintPanel.open : null, e6.selected) : S.is(movePanelSelection) && (e6 = new LintState(e6.diagnostics, e6.panel, S.value));
|
|
1230
|
+
return e6;
|
|
1231
|
+
},
|
|
1232
|
+
provide: (e6) => [showPanel.from(e6, (e7) => e7.panel), EditorView.decorations.from(e6, (e7) => e7.diagnostics)]
|
|
1233
|
+
}), activeMark = /* @__PURE__ */ Decoration.mark({ class: "cm-lintRange cm-lintRange-active" });
|
|
1234
|
+
function lintTooltip(e6, x, S) {
|
|
1235
|
+
let { diagnostics: C } = e6.state.field(lintState), w, T = -1, E = -1;
|
|
1236
|
+
C.between(x - (S < 0 ? 1 : 0), x + (S > 0 ? 1 : 0), (e7, C2, { spec: D2 }) => {
|
|
1237
|
+
if (x >= e7 && x <= C2 && (e7 == C2 || (x > e7 || S > 0) && (x < C2 || S < 0))) return w = D2.diagnostics, T = e7, E = C2, false;
|
|
1238
|
+
});
|
|
1239
|
+
let D = e6.state.facet(lintConfig).tooltipFilter;
|
|
1240
|
+
return w && D && (w = D(w, e6.state)), w ? {
|
|
1241
|
+
pos: T,
|
|
1242
|
+
end: E,
|
|
1243
|
+
above: e6.state.doc.lineAt(T).to < E,
|
|
1244
|
+
create() {
|
|
1245
|
+
return { dom: diagnosticsTooltip(e6, w) };
|
|
1246
|
+
}
|
|
1247
|
+
} : null;
|
|
1248
|
+
}
|
|
1249
|
+
function diagnosticsTooltip(e6, x) {
|
|
1250
|
+
return crelt("ul", { class: "cm-tooltip-lint" }, x.map((x2) => renderDiagnostic(e6, x2, false)));
|
|
1251
|
+
}
|
|
1252
|
+
var openLintPanel = (e6) => {
|
|
1253
|
+
let x = e6.state.field(lintState, false);
|
|
1254
|
+
(!x || !x.panel) && e6.dispatch({ effects: maybeEnableLint(e6.state, [togglePanel$1.of(true)]) });
|
|
1255
|
+
let S = getPanel(e6, LintPanel.open);
|
|
1256
|
+
return S && S.dom.querySelector(".cm-panel-lint ul").focus(), true;
|
|
1257
|
+
}, closeLintPanel = (e6) => {
|
|
1258
|
+
let x = e6.state.field(lintState, false);
|
|
1259
|
+
return !x || !x.panel ? false : (e6.dispatch({ effects: togglePanel$1.of(false) }), true);
|
|
1260
|
+
}, lintKeymap = [{
|
|
1261
|
+
key: "Mod-Shift-m",
|
|
1262
|
+
run: openLintPanel,
|
|
1263
|
+
preventDefault: true
|
|
1264
|
+
}, {
|
|
1265
|
+
key: "F8",
|
|
1266
|
+
run: (e6) => {
|
|
1267
|
+
let x = e6.state.field(lintState, false);
|
|
1268
|
+
if (!x) return false;
|
|
1269
|
+
let S = e6.state.selection.main, C = findDiagnostic(x.diagnostics, null, S.to + 1);
|
|
1270
|
+
return !C && (C = findDiagnostic(x.diagnostics, null, 0), !C || C.from == S.from && C.to == S.to) ? false : (e6.dispatch({
|
|
1271
|
+
selection: {
|
|
1272
|
+
anchor: C.from,
|
|
1273
|
+
head: C.to
|
|
1274
|
+
},
|
|
1275
|
+
scrollIntoView: true
|
|
1276
|
+
}), true);
|
|
1277
|
+
}
|
|
1278
|
+
}], lintPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
1279
|
+
constructor(e6) {
|
|
1280
|
+
this.view = e6, this.timeout = -1, this.set = true;
|
|
1281
|
+
let { delay: x } = e6.state.facet(lintConfig);
|
|
1282
|
+
this.lintTime = Date.now() + x, this.run = this.run.bind(this), this.timeout = setTimeout(this.run, x);
|
|
1283
|
+
}
|
|
1284
|
+
run() {
|
|
1285
|
+
clearTimeout(this.timeout);
|
|
1286
|
+
let e6 = Date.now();
|
|
1287
|
+
if (e6 < this.lintTime - 10) this.timeout = setTimeout(this.run, this.lintTime - e6);
|
|
1288
|
+
else {
|
|
1289
|
+
this.set = false;
|
|
1290
|
+
let { state: e7 } = this.view, { sources: x } = e7.facet(lintConfig);
|
|
1291
|
+
x.length && batchResults(x.map((e8) => Promise.resolve(e8(this.view))), (x2) => {
|
|
1292
|
+
this.view.state.doc == e7.doc && this.view.dispatch(setDiagnostics(this.view.state, x2.reduce((e8, x3) => e8.concat(x3))));
|
|
1293
|
+
}, (e8) => {
|
|
1294
|
+
logException(this.view.state, e8);
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
update(e6) {
|
|
1299
|
+
let x = e6.state.facet(lintConfig);
|
|
1300
|
+
(e6.docChanged || x != e6.startState.facet(lintConfig) || x.needsRefresh && x.needsRefresh(e6)) && (this.lintTime = Date.now() + x.delay, this.set || (this.set = true, this.timeout = setTimeout(this.run, x.delay)));
|
|
1301
|
+
}
|
|
1302
|
+
force() {
|
|
1303
|
+
this.set && (this.lintTime = Date.now(), this.run());
|
|
1304
|
+
}
|
|
1305
|
+
destroy() {
|
|
1306
|
+
clearTimeout(this.timeout);
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
function batchResults(e6, x, S) {
|
|
1310
|
+
let C = [], w = -1;
|
|
1311
|
+
for (let T of e6) T.then((S2) => {
|
|
1312
|
+
C.push(S2), clearTimeout(w), C.length == e6.length ? x(C) : w = setTimeout(() => x(C), 200);
|
|
1313
|
+
}, S);
|
|
1314
|
+
}
|
|
1315
|
+
var lintConfig = /* @__PURE__ */ Facet.define({ combine(e6) {
|
|
1316
|
+
return {
|
|
1317
|
+
sources: e6.map((e7) => e7.source).filter((e7) => e7 != null),
|
|
1318
|
+
...combineConfig(e6.map((e7) => e7.config), {
|
|
1319
|
+
delay: 750,
|
|
1320
|
+
markerFilter: null,
|
|
1321
|
+
tooltipFilter: null,
|
|
1322
|
+
needsRefresh: null,
|
|
1323
|
+
hideOn: () => null
|
|
1324
|
+
}, {
|
|
1325
|
+
delay: Math.max,
|
|
1326
|
+
markerFilter: combineFilter,
|
|
1327
|
+
tooltipFilter: combineFilter,
|
|
1328
|
+
needsRefresh: (e7, x) => e7 ? x ? (S) => e7(S) || x(S) : e7 : x,
|
|
1329
|
+
hideOn: (e7, x) => e7 ? x ? (S, C, w) => e7(S, C, w) || x(S, C, w) : e7 : x,
|
|
1330
|
+
autoPanel: (e7, x) => e7 || x
|
|
1331
|
+
})
|
|
1332
|
+
};
|
|
1333
|
+
} });
|
|
1334
|
+
function combineFilter(e6, x) {
|
|
1335
|
+
return e6 ? x ? (S, C) => x(e6(S, C), C) : e6 : x;
|
|
1336
|
+
}
|
|
1337
|
+
function linter(e6, x = {}) {
|
|
1338
|
+
return [
|
|
1339
|
+
lintConfig.of({
|
|
1340
|
+
source: e6,
|
|
1341
|
+
config: x
|
|
1342
|
+
}),
|
|
1343
|
+
lintPlugin,
|
|
1344
|
+
lintExtensions
|
|
1345
|
+
];
|
|
1346
|
+
}
|
|
1347
|
+
function assignKeys(e6) {
|
|
1348
|
+
let x = [];
|
|
1349
|
+
if (e6) actions: for (let { name: S } of e6) {
|
|
1350
|
+
for (let e7 = 0; e7 < S.length; e7++) {
|
|
1351
|
+
let C = S[e7];
|
|
1352
|
+
if (/[a-zA-Z]/.test(C) && !x.some((e8) => e8.toLowerCase() == C.toLowerCase())) {
|
|
1353
|
+
x.push(C);
|
|
1354
|
+
continue actions;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
x.push("");
|
|
1358
|
+
}
|
|
1359
|
+
return x;
|
|
1360
|
+
}
|
|
1361
|
+
function renderDiagnostic(e6, x, S) {
|
|
1362
|
+
var _a;
|
|
1363
|
+
let C = S ? assignKeys(x.actions) : [];
|
|
1364
|
+
return crelt("li", { class: "cm-diagnostic cm-diagnostic-" + x.severity }, crelt("span", { class: "cm-diagnosticText" }, x.renderMessage ? x.renderMessage(e6) : x.message), (_a = x.actions) == null ? void 0 : _a.map((S2, w) => {
|
|
1365
|
+
let T = false, E = (C2) => {
|
|
1366
|
+
if (C2.preventDefault(), T) return;
|
|
1367
|
+
T = true;
|
|
1368
|
+
let w2 = findDiagnostic(e6.state.field(lintState).diagnostics, x);
|
|
1369
|
+
w2 && S2.apply(e6, w2.from, w2.to);
|
|
1370
|
+
}, { name: D } = S2, O = C[w] ? D.indexOf(C[w]) : -1, k = O < 0 ? D : [
|
|
1371
|
+
D.slice(0, O),
|
|
1372
|
+
crelt("u", D.slice(O, O + 1)),
|
|
1373
|
+
D.slice(O + 1)
|
|
1374
|
+
];
|
|
1375
|
+
return crelt("button", {
|
|
1376
|
+
type: "button",
|
|
1377
|
+
class: "cm-diagnosticAction" + (S2.markClass ? " " + S2.markClass : ""),
|
|
1378
|
+
onclick: E,
|
|
1379
|
+
onmousedown: E,
|
|
1380
|
+
"aria-label": ` Action: ${D}${O < 0 ? "" : ` (access key "${C[w]})"`}.`
|
|
1381
|
+
}, k);
|
|
1382
|
+
}), x.source && crelt("div", { class: "cm-diagnosticSource" }, x.source));
|
|
1383
|
+
}
|
|
1384
|
+
var DiagnosticWidget = class extends WidgetType {
|
|
1385
|
+
constructor(e6) {
|
|
1386
|
+
super(), this.sev = e6;
|
|
1387
|
+
}
|
|
1388
|
+
eq(e6) {
|
|
1389
|
+
return e6.sev == this.sev;
|
|
1390
|
+
}
|
|
1391
|
+
toDOM() {
|
|
1392
|
+
return crelt("span", { class: "cm-lintPoint cm-lintPoint-" + this.sev });
|
|
1393
|
+
}
|
|
1394
|
+
}, PanelItem = class {
|
|
1395
|
+
constructor(e6, x) {
|
|
1396
|
+
this.diagnostic = x, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = renderDiagnostic(e6, x, true), this.dom.id = this.id, this.dom.setAttribute("role", "option");
|
|
1397
|
+
}
|
|
1398
|
+
}, LintPanel = class e4 {
|
|
1399
|
+
constructor(e6) {
|
|
1400
|
+
this.view = e6, this.items = [];
|
|
1401
|
+
let x = (x2) => {
|
|
1402
|
+
if (!(x2.ctrlKey || x2.altKey || x2.metaKey)) {
|
|
1403
|
+
if (x2.keyCode == 27) closeLintPanel(this.view), this.view.focus();
|
|
1404
|
+
else if (x2.keyCode == 38 || x2.keyCode == 33) this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);
|
|
1405
|
+
else if (x2.keyCode == 40 || x2.keyCode == 34) this.moveSelection((this.selectedIndex + 1) % this.items.length);
|
|
1406
|
+
else if (x2.keyCode == 36) this.moveSelection(0);
|
|
1407
|
+
else if (x2.keyCode == 35) this.moveSelection(this.items.length - 1);
|
|
1408
|
+
else if (x2.keyCode == 13) this.view.focus();
|
|
1409
|
+
else if (x2.keyCode >= 65 && x2.keyCode <= 90 && this.selectedIndex >= 0) {
|
|
1410
|
+
let { diagnostic: S2 } = this.items[this.selectedIndex], C = assignKeys(S2.actions);
|
|
1411
|
+
for (let w = 0; w < C.length; w++) if (C[w].toUpperCase().charCodeAt(0) == x2.keyCode) {
|
|
1412
|
+
let x3 = findDiagnostic(this.view.state.field(lintState).diagnostics, S2);
|
|
1413
|
+
x3 && S2.actions[w].apply(e6, x3.from, x3.to);
|
|
1414
|
+
}
|
|
1415
|
+
} else return;
|
|
1416
|
+
x2.preventDefault();
|
|
1417
|
+
}
|
|
1418
|
+
}, S = (e7) => {
|
|
1419
|
+
for (let x2 = 0; x2 < this.items.length; x2++) this.items[x2].dom.contains(e7.target) && this.moveSelection(x2);
|
|
1420
|
+
};
|
|
1421
|
+
this.list = crelt("ul", {
|
|
1422
|
+
tabIndex: 0,
|
|
1423
|
+
role: "listbox",
|
|
1424
|
+
"aria-label": this.view.state.phrase("Diagnostics"),
|
|
1425
|
+
onkeydown: x,
|
|
1426
|
+
onclick: S
|
|
1427
|
+
}), this.dom = crelt("div", { class: "cm-panel-lint" }, this.list, crelt("button", {
|
|
1428
|
+
type: "button",
|
|
1429
|
+
name: "close",
|
|
1430
|
+
"aria-label": this.view.state.phrase("close"),
|
|
1431
|
+
onclick: () => closeLintPanel(this.view)
|
|
1432
|
+
}, "\xD7")), this.update();
|
|
1433
|
+
}
|
|
1434
|
+
get selectedIndex() {
|
|
1435
|
+
let e6 = this.view.state.field(lintState).selected;
|
|
1436
|
+
if (!e6) return -1;
|
|
1437
|
+
for (let x = 0; x < this.items.length; x++) if (this.items[x].diagnostic == e6.diagnostic) return x;
|
|
1438
|
+
return -1;
|
|
1439
|
+
}
|
|
1440
|
+
update() {
|
|
1441
|
+
let { diagnostics: e6, selected: x } = this.view.state.field(lintState), S = 0, C = false, w = null, T = /* @__PURE__ */ new Set();
|
|
1442
|
+
for (e6.between(0, this.view.state.doc.length, (e7, E, { spec: D }) => {
|
|
1443
|
+
for (let e8 of D.diagnostics) {
|
|
1444
|
+
if (T.has(e8)) continue;
|
|
1445
|
+
T.add(e8);
|
|
1446
|
+
let E2 = -1, D2;
|
|
1447
|
+
for (let x2 = S; x2 < this.items.length; x2++) if (this.items[x2].diagnostic == e8) {
|
|
1448
|
+
E2 = x2;
|
|
1449
|
+
break;
|
|
1450
|
+
}
|
|
1451
|
+
E2 < 0 ? (D2 = new PanelItem(this.view, e8), this.items.splice(S, 0, D2), C = true) : (D2 = this.items[E2], E2 > S && (this.items.splice(S, E2 - S), C = true)), x && D2.diagnostic == x.diagnostic ? D2.dom.hasAttribute("aria-selected") || (D2.dom.setAttribute("aria-selected", "true"), w = D2) : D2.dom.hasAttribute("aria-selected") && D2.dom.removeAttribute("aria-selected"), S++;
|
|
1452
|
+
}
|
|
1453
|
+
}); S < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0); ) C = true, this.items.pop();
|
|
1454
|
+
this.items.length == 0 && (this.items.push(new PanelItem(this.view, {
|
|
1455
|
+
from: -1,
|
|
1456
|
+
to: -1,
|
|
1457
|
+
severity: "info",
|
|
1458
|
+
message: this.view.state.phrase("No diagnostics")
|
|
1459
|
+
})), C = true), w ? (this.list.setAttribute("aria-activedescendant", w.id), this.view.requestMeasure({
|
|
1460
|
+
key: this,
|
|
1461
|
+
read: () => ({
|
|
1462
|
+
sel: w.dom.getBoundingClientRect(),
|
|
1463
|
+
panel: this.list.getBoundingClientRect()
|
|
1464
|
+
}),
|
|
1465
|
+
write: ({ sel: e7, panel: x2 }) => {
|
|
1466
|
+
let S2 = x2.height / this.list.offsetHeight;
|
|
1467
|
+
e7.top < x2.top ? this.list.scrollTop -= (x2.top - e7.top) / S2 : e7.bottom > x2.bottom && (this.list.scrollTop += (e7.bottom - x2.bottom) / S2);
|
|
1468
|
+
}
|
|
1469
|
+
})) : this.selectedIndex < 0 && this.list.removeAttribute("aria-activedescendant"), C && this.sync();
|
|
1470
|
+
}
|
|
1471
|
+
sync() {
|
|
1472
|
+
let e6 = this.list.firstChild;
|
|
1473
|
+
function x() {
|
|
1474
|
+
let x2 = e6;
|
|
1475
|
+
e6 = x2.nextSibling, x2.remove();
|
|
1476
|
+
}
|
|
1477
|
+
for (let S of this.items) if (S.dom.parentNode == this.list) {
|
|
1478
|
+
for (; e6 != S.dom; ) x();
|
|
1479
|
+
e6 = S.dom.nextSibling;
|
|
1480
|
+
} else this.list.insertBefore(S.dom, e6);
|
|
1481
|
+
for (; e6; ) x();
|
|
1482
|
+
}
|
|
1483
|
+
moveSelection(e6) {
|
|
1484
|
+
if (this.selectedIndex < 0) return;
|
|
1485
|
+
let x = findDiagnostic(this.view.state.field(lintState).diagnostics, this.items[e6].diagnostic);
|
|
1486
|
+
x && this.view.dispatch({
|
|
1487
|
+
selection: {
|
|
1488
|
+
anchor: x.from,
|
|
1489
|
+
head: x.to
|
|
1490
|
+
},
|
|
1491
|
+
scrollIntoView: true,
|
|
1492
|
+
effects: movePanelSelection.of(x)
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
static open(x) {
|
|
1496
|
+
return new e4(x);
|
|
1497
|
+
}
|
|
1498
|
+
};
|
|
1499
|
+
function svg(e6, x = 'viewBox="0 0 40 40"') {
|
|
1500
|
+
return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${x}>${encodeURIComponent(e6)}</svg>')`;
|
|
1501
|
+
}
|
|
1502
|
+
function underline(e6) {
|
|
1503
|
+
return svg(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e6}" fill="none" stroke-width=".7"/>`, 'width="6" height="3"');
|
|
1504
|
+
}
|
|
1505
|
+
var baseTheme$1 = /* @__PURE__ */ EditorView.baseTheme({
|
|
1506
|
+
".cm-diagnostic": {
|
|
1507
|
+
padding: "3px 6px 3px 8px",
|
|
1508
|
+
marginLeft: "-1px",
|
|
1509
|
+
display: "block",
|
|
1510
|
+
whiteSpace: "pre-wrap"
|
|
1511
|
+
},
|
|
1512
|
+
".cm-diagnostic-error": { borderLeft: "5px solid #d11" },
|
|
1513
|
+
".cm-diagnostic-warning": { borderLeft: "5px solid orange" },
|
|
1514
|
+
".cm-diagnostic-info": { borderLeft: "5px solid #999" },
|
|
1515
|
+
".cm-diagnostic-hint": { borderLeft: "5px solid #66d" },
|
|
1516
|
+
".cm-diagnosticAction": {
|
|
1517
|
+
font: "inherit",
|
|
1518
|
+
border: "none",
|
|
1519
|
+
padding: "2px 4px",
|
|
1520
|
+
backgroundColor: "#444",
|
|
1521
|
+
color: "white",
|
|
1522
|
+
borderRadius: "3px",
|
|
1523
|
+
marginLeft: "8px",
|
|
1524
|
+
cursor: "pointer"
|
|
1525
|
+
},
|
|
1526
|
+
".cm-diagnosticSource": {
|
|
1527
|
+
fontSize: "70%",
|
|
1528
|
+
opacity: 0.7
|
|
1529
|
+
},
|
|
1530
|
+
".cm-lintRange": {
|
|
1531
|
+
backgroundPosition: "left bottom",
|
|
1532
|
+
backgroundRepeat: "repeat-x",
|
|
1533
|
+
paddingBottom: "0.7px"
|
|
1534
|
+
},
|
|
1535
|
+
".cm-lintRange-error": { backgroundImage: /* @__PURE__ */ underline("#d11") },
|
|
1536
|
+
".cm-lintRange-warning": { backgroundImage: /* @__PURE__ */ underline("orange") },
|
|
1537
|
+
".cm-lintRange-info": { backgroundImage: /* @__PURE__ */ underline("#999") },
|
|
1538
|
+
".cm-lintRange-hint": { backgroundImage: /* @__PURE__ */ underline("#66d") },
|
|
1539
|
+
".cm-lintRange-active": { backgroundColor: "#ffdd9980" },
|
|
1540
|
+
".cm-tooltip-lint": {
|
|
1541
|
+
padding: 0,
|
|
1542
|
+
margin: 0
|
|
1543
|
+
},
|
|
1544
|
+
".cm-lintPoint": {
|
|
1545
|
+
position: "relative",
|
|
1546
|
+
"&:after": {
|
|
1547
|
+
content: '""',
|
|
1548
|
+
position: "absolute",
|
|
1549
|
+
bottom: 0,
|
|
1550
|
+
left: "-2px",
|
|
1551
|
+
borderLeft: "3px solid transparent",
|
|
1552
|
+
borderRight: "3px solid transparent",
|
|
1553
|
+
borderBottom: "4px solid #d11"
|
|
1554
|
+
}
|
|
1555
|
+
},
|
|
1556
|
+
".cm-lintPoint-warning": { "&:after": { borderBottomColor: "orange" } },
|
|
1557
|
+
".cm-lintPoint-info": { "&:after": { borderBottomColor: "#999" } },
|
|
1558
|
+
".cm-lintPoint-hint": { "&:after": { borderBottomColor: "#66d" } },
|
|
1559
|
+
".cm-panel.cm-panel-lint": {
|
|
1560
|
+
position: "relative",
|
|
1561
|
+
"& ul": {
|
|
1562
|
+
maxHeight: "100px",
|
|
1563
|
+
overflowY: "auto",
|
|
1564
|
+
"& [aria-selected]": {
|
|
1565
|
+
backgroundColor: "#ddd",
|
|
1566
|
+
"& u": { textDecoration: "underline" }
|
|
1567
|
+
},
|
|
1568
|
+
"&:focus [aria-selected]": {
|
|
1569
|
+
background_fallback: "#bdf",
|
|
1570
|
+
backgroundColor: "Highlight",
|
|
1571
|
+
color_fallback: "white",
|
|
1572
|
+
color: "HighlightText"
|
|
1573
|
+
},
|
|
1574
|
+
"& u": { textDecoration: "none" },
|
|
1575
|
+
padding: 0,
|
|
1576
|
+
margin: 0
|
|
1577
|
+
},
|
|
1578
|
+
"& [name=close]": {
|
|
1579
|
+
position: "absolute",
|
|
1580
|
+
top: "0",
|
|
1581
|
+
right: "2px",
|
|
1582
|
+
background: "inherit",
|
|
1583
|
+
border: "none",
|
|
1584
|
+
font: "inherit",
|
|
1585
|
+
padding: 0,
|
|
1586
|
+
margin: 0
|
|
1587
|
+
}
|
|
1588
|
+
},
|
|
1589
|
+
"&dark .cm-lintRange-active": { backgroundColor: "#86714a80" },
|
|
1590
|
+
"&dark .cm-panel.cm-panel-lint ul": { "& [aria-selected]": { backgroundColor: "#2e343e" } }
|
|
1591
|
+
});
|
|
1592
|
+
function severityWeight(e6) {
|
|
1593
|
+
return e6 == "error" ? 4 : e6 == "warning" ? 3 : e6 == "info" ? 2 : 1;
|
|
1594
|
+
}
|
|
1595
|
+
function maxSeverity(e6) {
|
|
1596
|
+
let x = "hint", S = 1;
|
|
1597
|
+
for (let C of e6) {
|
|
1598
|
+
let e7 = severityWeight(C.severity);
|
|
1599
|
+
e7 > S && (S = e7, x = C.severity);
|
|
1600
|
+
}
|
|
1601
|
+
return x;
|
|
1602
|
+
}
|
|
1603
|
+
var lintExtensions = [
|
|
1604
|
+
lintState,
|
|
1605
|
+
/* @__PURE__ */ EditorView.decorations.compute([lintState], (e6) => {
|
|
1606
|
+
let { selected: x, panel: S } = e6.field(lintState);
|
|
1607
|
+
return !x || !S || x.from == x.to ? Decoration.none : Decoration.set([activeMark.range(x.from, x.to)]);
|
|
1608
|
+
}),
|
|
1609
|
+
/* @__PURE__ */ hoverTooltip(lintTooltip, { hideOn: hideTooltip }),
|
|
1610
|
+
baseTheme$1
|
|
1611
|
+
];
|
|
1612
|
+
function forEachDiagnostic(e6, x) {
|
|
1613
|
+
let S = e6.field(lintState, false);
|
|
1614
|
+
if (S && S.diagnostics.size) {
|
|
1615
|
+
let e7 = [], C = [], w = -1;
|
|
1616
|
+
for (let T = RangeSet.iter([S.diagnostics]); ; T.next()) {
|
|
1617
|
+
for (let S2 = 0; S2 < e7.length; S2++) (!T.value || T.value.spec.diagnostics.indexOf(e7[S2]) < 0) && (x(e7[S2], C[S2], w), e7.splice(S2, 1), C.splice(S2--, 1));
|
|
1618
|
+
if (!T.value) break;
|
|
1619
|
+
for (let x2 of T.value.spec.diagnostics) e7.indexOf(x2) < 0 && (e7.push(x2), C.push(T.from));
|
|
1620
|
+
w = T.to;
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
var basicNormalize = typeof String.prototype.normalize == "function" ? (e6) => e6.normalize("NFKD") : (e6) => e6, SearchCursor = class {
|
|
1625
|
+
constructor(e6, x, S = 0, C = e6.length, w, T) {
|
|
1626
|
+
this.test = T, this.value = {
|
|
1627
|
+
from: 0,
|
|
1628
|
+
to: 0
|
|
1629
|
+
}, this.done = false, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e6.iterRange(S, C), this.bufferStart = S, this.normalize = w ? (e7) => w(basicNormalize(e7)) : basicNormalize, this.query = this.normalize(x);
|
|
1630
|
+
}
|
|
1631
|
+
peek() {
|
|
1632
|
+
if (this.bufferPos == this.buffer.length) {
|
|
1633
|
+
if (this.bufferStart += this.buffer.length, this.iter.next(), this.iter.done) return -1;
|
|
1634
|
+
this.bufferPos = 0, this.buffer = this.iter.value;
|
|
1635
|
+
}
|
|
1636
|
+
return codePointAt(this.buffer, this.bufferPos);
|
|
1637
|
+
}
|
|
1638
|
+
next() {
|
|
1639
|
+
for (; this.matches.length; ) this.matches.pop();
|
|
1640
|
+
return this.nextOverlapping();
|
|
1641
|
+
}
|
|
1642
|
+
nextOverlapping() {
|
|
1643
|
+
for (; ; ) {
|
|
1644
|
+
let e6 = this.peek();
|
|
1645
|
+
if (e6 < 0) return this.done = true, this;
|
|
1646
|
+
let x = fromCodePoint(e6), S = this.bufferStart + this.bufferPos;
|
|
1647
|
+
this.bufferPos += codePointSize(e6);
|
|
1648
|
+
let C = this.normalize(x);
|
|
1649
|
+
if (C.length) for (let e7 = 0, w = S; ; e7++) {
|
|
1650
|
+
let T = C.charCodeAt(e7), E = this.match(T, w, this.bufferPos + this.bufferStart);
|
|
1651
|
+
if (e7 == C.length - 1) {
|
|
1652
|
+
if (E) return this.value = E, this;
|
|
1653
|
+
break;
|
|
1654
|
+
}
|
|
1655
|
+
w == S && e7 < x.length && x.charCodeAt(e7) == T && w++;
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
match(e6, x, S) {
|
|
1660
|
+
let C = null;
|
|
1661
|
+
for (let x2 = 0; x2 < this.matches.length; x2 += 2) {
|
|
1662
|
+
let w = this.matches[x2], T = false;
|
|
1663
|
+
this.query.charCodeAt(w) == e6 && (w == this.query.length - 1 ? C = {
|
|
1664
|
+
from: this.matches[x2 + 1],
|
|
1665
|
+
to: S
|
|
1666
|
+
} : (this.matches[x2]++, T = true)), T || (this.matches.splice(x2, 2), x2 -= 2);
|
|
1667
|
+
}
|
|
1668
|
+
return this.query.charCodeAt(0) == e6 && (this.query.length == 1 ? C = {
|
|
1669
|
+
from: x,
|
|
1670
|
+
to: S
|
|
1671
|
+
} : this.matches.push(1, x)), C && this.test && !this.test(C.from, C.to, this.buffer, this.bufferStart) && (C = null), C;
|
|
1672
|
+
}
|
|
1673
|
+
};
|
|
1674
|
+
typeof Symbol < "u" && (SearchCursor.prototype[Symbol.iterator] = function() {
|
|
1675
|
+
return this;
|
|
1676
|
+
});
|
|
1677
|
+
var empty = {
|
|
1678
|
+
from: -1,
|
|
1679
|
+
to: -1,
|
|
1680
|
+
match: /* @__PURE__ */ /.*/.exec("")
|
|
1681
|
+
}, baseFlags = "gm" + (/x/.unicode == null ? "" : "u"), RegExpCursor = class {
|
|
1682
|
+
constructor(e6, x, S, C = 0, w = e6.length) {
|
|
1683
|
+
if (this.text = e6, this.to = w, this.curLine = "", this.done = false, this.value = empty, /\\[sWDnr]|\n|\r|\[\^/.test(x)) return new MultilineRegExpCursor(e6, x, S, C, w);
|
|
1684
|
+
this.re = new RegExp(x, baseFlags + ((S == null ? void 0 : S.ignoreCase) ? "i" : "")), this.test = S == null ? void 0 : S.test, this.iter = e6.iter(), this.curLineStart = e6.lineAt(C).from, this.matchPos = toCharEnd(e6, C), this.getLine(this.curLineStart);
|
|
1685
|
+
}
|
|
1686
|
+
getLine(e6) {
|
|
1687
|
+
this.iter.next(e6), this.iter.lineBreak ? this.curLine = "" : (this.curLine = this.iter.value, this.curLineStart + this.curLine.length > this.to && (this.curLine = this.curLine.slice(0, this.to - this.curLineStart)), this.iter.next());
|
|
1688
|
+
}
|
|
1689
|
+
nextLine() {
|
|
1690
|
+
this.curLineStart = this.curLineStart + this.curLine.length + 1, this.curLineStart > this.to ? this.curLine = "" : this.getLine(0);
|
|
1691
|
+
}
|
|
1692
|
+
next() {
|
|
1693
|
+
for (let e6 = this.matchPos - this.curLineStart; ; ) {
|
|
1694
|
+
this.re.lastIndex = e6;
|
|
1695
|
+
let x = this.matchPos <= this.to && this.re.exec(this.curLine);
|
|
1696
|
+
if (x) {
|
|
1697
|
+
let S = this.curLineStart + x.index, C = S + x[0].length;
|
|
1698
|
+
if (this.matchPos = toCharEnd(this.text, C + (S == C ? 1 : 0)), S == this.curLineStart + this.curLine.length && this.nextLine(), (S < C || S > this.value.to) && (!this.test || this.test(S, C, x))) return this.value = {
|
|
1699
|
+
from: S,
|
|
1700
|
+
to: C,
|
|
1701
|
+
match: x
|
|
1702
|
+
}, this;
|
|
1703
|
+
e6 = this.matchPos - this.curLineStart;
|
|
1704
|
+
} else if (this.curLineStart + this.curLine.length < this.to) this.nextLine(), e6 = 0;
|
|
1705
|
+
else return this.done = true, this;
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
}, flattened = /* @__PURE__ */ new WeakMap(), FlattenedDoc = class e5 {
|
|
1709
|
+
constructor(e6, x) {
|
|
1710
|
+
this.from = e6, this.text = x;
|
|
1711
|
+
}
|
|
1712
|
+
get to() {
|
|
1713
|
+
return this.from + this.text.length;
|
|
1714
|
+
}
|
|
1715
|
+
static get(x, S, C) {
|
|
1716
|
+
let w = flattened.get(x);
|
|
1717
|
+
if (!w || w.from >= C || w.to <= S) {
|
|
1718
|
+
let w2 = new e5(S, x.sliceString(S, C));
|
|
1719
|
+
return flattened.set(x, w2), w2;
|
|
1720
|
+
}
|
|
1721
|
+
if (w.from == S && w.to == C) return w;
|
|
1722
|
+
let { text: T, from: E } = w;
|
|
1723
|
+
return E > S && (T = x.sliceString(S, E) + T, E = S), w.to < C && (T += x.sliceString(w.to, C)), flattened.set(x, new e5(E, T)), new e5(S, T.slice(S - E, C - E));
|
|
1724
|
+
}
|
|
1725
|
+
}, MultilineRegExpCursor = class {
|
|
1726
|
+
constructor(e6, x, S, C, w) {
|
|
1727
|
+
this.text = e6, this.to = w, this.done = false, this.value = empty, this.matchPos = toCharEnd(e6, C), this.re = new RegExp(x, baseFlags + ((S == null ? void 0 : S.ignoreCase) ? "i" : "")), this.test = S == null ? void 0 : S.test, this.flat = FlattenedDoc.get(e6, C, this.chunkEnd(C + 5e3));
|
|
1728
|
+
}
|
|
1729
|
+
chunkEnd(e6) {
|
|
1730
|
+
return e6 >= this.to ? this.to : this.text.lineAt(e6).to;
|
|
1731
|
+
}
|
|
1732
|
+
next() {
|
|
1733
|
+
for (; ; ) {
|
|
1734
|
+
let e6 = this.re.lastIndex = this.matchPos - this.flat.from, x = this.re.exec(this.flat.text);
|
|
1735
|
+
if (x && !x[0] && x.index == e6 && (this.re.lastIndex = e6 + 1, x = this.re.exec(this.flat.text)), x) {
|
|
1736
|
+
let e7 = this.flat.from + x.index, S = e7 + x[0].length;
|
|
1737
|
+
if ((this.flat.to >= this.to || x.index + x[0].length <= this.flat.text.length - 10) && (!this.test || this.test(e7, S, x))) return this.value = {
|
|
1738
|
+
from: e7,
|
|
1739
|
+
to: S,
|
|
1740
|
+
match: x
|
|
1741
|
+
}, this.matchPos = toCharEnd(this.text, S + (e7 == S ? 1 : 0)), this;
|
|
1742
|
+
}
|
|
1743
|
+
if (this.flat.to == this.to) return this.done = true, this;
|
|
1744
|
+
this.flat = FlattenedDoc.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
};
|
|
1748
|
+
typeof Symbol < "u" && (RegExpCursor.prototype[Symbol.iterator] = MultilineRegExpCursor.prototype[Symbol.iterator] = function() {
|
|
1749
|
+
return this;
|
|
1750
|
+
});
|
|
1751
|
+
function validRegExp(e6) {
|
|
1752
|
+
try {
|
|
1753
|
+
return new RegExp(e6, baseFlags), true;
|
|
1754
|
+
} catch {
|
|
1755
|
+
return false;
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
function toCharEnd(e6, x) {
|
|
1759
|
+
if (x >= e6.length) return x;
|
|
1760
|
+
let S = e6.lineAt(x), C;
|
|
1761
|
+
for (; x < S.to && (C = S.text.charCodeAt(x - S.from)) >= 56320 && C < 57344; ) x++;
|
|
1762
|
+
return x;
|
|
1763
|
+
}
|
|
1764
|
+
var gotoLine = (e6) => {
|
|
1765
|
+
let { state: x } = e6, S = String(x.doc.lineAt(e6.state.selection.main.head).number), { close: C, result: w } = showDialog(e6, {
|
|
1766
|
+
label: x.phrase("Go to line"),
|
|
1767
|
+
input: {
|
|
1768
|
+
type: "text",
|
|
1769
|
+
name: "line",
|
|
1770
|
+
value: S
|
|
1771
|
+
},
|
|
1772
|
+
focus: true,
|
|
1773
|
+
submitLabel: x.phrase("go")
|
|
1774
|
+
});
|
|
1775
|
+
return w.then((S2) => {
|
|
1776
|
+
let w2 = S2 && /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(S2.elements.line.value);
|
|
1777
|
+
if (!w2) {
|
|
1778
|
+
e6.dispatch({ effects: C });
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1781
|
+
let T = x.doc.lineAt(x.selection.main.head), [, E, D, O, k] = w2, A = O ? +O.slice(1) : 0, j = D ? +D : T.number;
|
|
1782
|
+
if (D && k) {
|
|
1783
|
+
let e7 = j / 100;
|
|
1784
|
+
E && (e7 = e7 * (E == "-" ? -1 : 1) + T.number / x.doc.lines), j = Math.round(x.doc.lines * e7);
|
|
1785
|
+
} else D && E && (j = j * (E == "-" ? -1 : 1) + T.number);
|
|
1786
|
+
let M = x.doc.line(Math.max(1, Math.min(x.doc.lines, j))), N = EditorSelection.cursor(M.from + Math.max(0, Math.min(A, M.length)));
|
|
1787
|
+
e6.dispatch({
|
|
1788
|
+
effects: [C, EditorView.scrollIntoView(N.from, { y: "center" })],
|
|
1789
|
+
selection: N
|
|
1790
|
+
});
|
|
1791
|
+
}), true;
|
|
1792
|
+
}, defaultHighlightOptions = {
|
|
1793
|
+
highlightWordAroundCursor: false,
|
|
1794
|
+
minSelectionLength: 1,
|
|
1795
|
+
maxMatches: 100,
|
|
1796
|
+
wholeWords: false
|
|
1797
|
+
}, highlightConfig = /* @__PURE__ */ Facet.define({ combine(e6) {
|
|
1798
|
+
return combineConfig(e6, defaultHighlightOptions, {
|
|
1799
|
+
highlightWordAroundCursor: (e7, x) => e7 || x,
|
|
1800
|
+
minSelectionLength: Math.min,
|
|
1801
|
+
maxMatches: Math.min
|
|
1802
|
+
});
|
|
1803
|
+
} });
|
|
1804
|
+
function highlightSelectionMatches(e6) {
|
|
1805
|
+
let x = [defaultTheme, matchHighlighter];
|
|
1806
|
+
return e6 && x.push(highlightConfig.of(e6)), x;
|
|
1807
|
+
}
|
|
1808
|
+
var matchDeco = /* @__PURE__ */ Decoration.mark({ class: "cm-selectionMatch" }), mainMatchDeco = /* @__PURE__ */ Decoration.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
|
|
1809
|
+
function insideWordBoundaries(e6, x, S, C) {
|
|
1810
|
+
return (S == 0 || e6(x.sliceDoc(S - 1, S)) != CharCategory.Word) && (C == x.doc.length || e6(x.sliceDoc(C, C + 1)) != CharCategory.Word);
|
|
1811
|
+
}
|
|
1812
|
+
function insideWord(e6, x, S, C) {
|
|
1813
|
+
return e6(x.sliceDoc(S, S + 1)) == CharCategory.Word && e6(x.sliceDoc(C - 1, C)) == CharCategory.Word;
|
|
1814
|
+
}
|
|
1815
|
+
var matchHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
1816
|
+
constructor(e6) {
|
|
1817
|
+
this.decorations = this.getDeco(e6);
|
|
1818
|
+
}
|
|
1819
|
+
update(e6) {
|
|
1820
|
+
(e6.selectionSet || e6.docChanged || e6.viewportChanged) && (this.decorations = this.getDeco(e6.view));
|
|
1821
|
+
}
|
|
1822
|
+
getDeco(e6) {
|
|
1823
|
+
let x = e6.state.facet(highlightConfig), { state: S } = e6, C = S.selection;
|
|
1824
|
+
if (C.ranges.length > 1) return Decoration.none;
|
|
1825
|
+
let w = C.main, T, E = null;
|
|
1826
|
+
if (w.empty) {
|
|
1827
|
+
if (!x.highlightWordAroundCursor) return Decoration.none;
|
|
1828
|
+
let e7 = S.wordAt(w.head);
|
|
1829
|
+
if (!e7) return Decoration.none;
|
|
1830
|
+
E = S.charCategorizer(w.head), T = S.sliceDoc(e7.from, e7.to);
|
|
1831
|
+
} else {
|
|
1832
|
+
let e7 = w.to - w.from;
|
|
1833
|
+
if (e7 < x.minSelectionLength || e7 > 200) return Decoration.none;
|
|
1834
|
+
if (x.wholeWords) {
|
|
1835
|
+
if (T = S.sliceDoc(w.from, w.to), E = S.charCategorizer(w.head), !(insideWordBoundaries(E, S, w.from, w.to) && insideWord(E, S, w.from, w.to))) return Decoration.none;
|
|
1836
|
+
} else if (T = S.sliceDoc(w.from, w.to), !T) return Decoration.none;
|
|
1837
|
+
}
|
|
1838
|
+
let D = [];
|
|
1839
|
+
for (let C2 of e6.visibleRanges) {
|
|
1840
|
+
let e7 = new SearchCursor(S.doc, T, C2.from, C2.to);
|
|
1841
|
+
for (; !e7.next().done; ) {
|
|
1842
|
+
let { from: C3, to: T2 } = e7.value;
|
|
1843
|
+
if ((!E || insideWordBoundaries(E, S, C3, T2)) && (w.empty && C3 <= w.from && T2 >= w.to ? D.push(mainMatchDeco.range(C3, T2)) : (C3 >= w.to || T2 <= w.from) && D.push(matchDeco.range(C3, T2)), D.length > x.maxMatches)) return Decoration.none;
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
return Decoration.set(D);
|
|
1847
|
+
}
|
|
1848
|
+
}, { decorations: (e6) => e6.decorations }), defaultTheme = /* @__PURE__ */ EditorView.baseTheme({
|
|
1849
|
+
".cm-selectionMatch": { backgroundColor: "#99ff7780" },
|
|
1850
|
+
".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" }
|
|
1851
|
+
}), selectWord = ({ state: e6, dispatch: x }) => {
|
|
1852
|
+
let { selection: S } = e6, C = EditorSelection.create(S.ranges.map((x2) => e6.wordAt(x2.head) || EditorSelection.cursor(x2.head)), S.mainIndex);
|
|
1853
|
+
return C.eq(S) ? false : (x(e6.update({ selection: C })), true);
|
|
1854
|
+
};
|
|
1855
|
+
function findNextOccurrence(e6, x) {
|
|
1856
|
+
let { main: S, ranges: C } = e6.selection, w = e6.wordAt(S.head), T = w && w.from == S.from && w.to == S.to;
|
|
1857
|
+
for (let S2 = false, w2 = new SearchCursor(e6.doc, x, C[C.length - 1].to); ; ) if (w2.next(), w2.done) {
|
|
1858
|
+
if (S2) return null;
|
|
1859
|
+
w2 = new SearchCursor(e6.doc, x, 0, Math.max(0, C[C.length - 1].from - 1)), S2 = true;
|
|
1860
|
+
} else {
|
|
1861
|
+
if (S2 && C.some((e7) => e7.from == w2.value.from)) continue;
|
|
1862
|
+
if (T) {
|
|
1863
|
+
let x2 = e6.wordAt(w2.value.from);
|
|
1864
|
+
if (!x2 || x2.from != w2.value.from || x2.to != w2.value.to) continue;
|
|
1865
|
+
}
|
|
1866
|
+
return w2.value;
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
var selectNextOccurrence = ({ state: e6, dispatch: x }) => {
|
|
1870
|
+
let { ranges: S } = e6.selection;
|
|
1871
|
+
if (S.some((e7) => e7.from === e7.to)) return selectWord({
|
|
1872
|
+
state: e6,
|
|
1873
|
+
dispatch: x
|
|
1874
|
+
});
|
|
1875
|
+
let C = e6.sliceDoc(S[0].from, S[0].to);
|
|
1876
|
+
if (e6.selection.ranges.some((x2) => e6.sliceDoc(x2.from, x2.to) != C)) return false;
|
|
1877
|
+
let w = findNextOccurrence(e6, C);
|
|
1878
|
+
return w ? (x(e6.update({
|
|
1879
|
+
selection: e6.selection.addRange(EditorSelection.range(w.from, w.to), false),
|
|
1880
|
+
effects: EditorView.scrollIntoView(w.to)
|
|
1881
|
+
})), true) : false;
|
|
1882
|
+
}, searchConfigFacet = /* @__PURE__ */ Facet.define({ combine(e6) {
|
|
1883
|
+
return combineConfig(e6, {
|
|
1884
|
+
top: false,
|
|
1885
|
+
caseSensitive: false,
|
|
1886
|
+
literal: false,
|
|
1887
|
+
regexp: false,
|
|
1888
|
+
wholeWord: false,
|
|
1889
|
+
createPanel: (e7) => new SearchPanel(e7),
|
|
1890
|
+
scrollToMatch: (e7) => EditorView.scrollIntoView(e7)
|
|
1891
|
+
});
|
|
1892
|
+
} }), SearchQuery = class {
|
|
1893
|
+
constructor(e6) {
|
|
1894
|
+
this.search = e6.search, this.caseSensitive = !!e6.caseSensitive, this.literal = !!e6.literal, this.regexp = !!e6.regexp, this.replace = e6.replace || "", this.valid = !!this.search && (!this.regexp || validRegExp(this.search)), this.unquoted = this.unquote(this.search), this.wholeWord = !!e6.wholeWord, this.test = e6.test;
|
|
1895
|
+
}
|
|
1896
|
+
unquote(e6) {
|
|
1897
|
+
return this.literal ? e6 : e6.replace(/\\([nrt\\])/g, (e7, x) => x == "n" ? "\n" : x == "r" ? "\r" : x == "t" ? " " : "\\");
|
|
1898
|
+
}
|
|
1899
|
+
eq(e6) {
|
|
1900
|
+
return this.search == e6.search && this.replace == e6.replace && this.caseSensitive == e6.caseSensitive && this.regexp == e6.regexp && this.wholeWord == e6.wholeWord && this.test == e6.test;
|
|
1901
|
+
}
|
|
1902
|
+
create() {
|
|
1903
|
+
return this.regexp ? new RegExpQuery(this) : new StringQuery(this);
|
|
1904
|
+
}
|
|
1905
|
+
getCursor(e6, x = 0, S) {
|
|
1906
|
+
let C = e6.doc ? e6 : EditorState.create({ doc: e6 });
|
|
1907
|
+
return S ?? (S = C.doc.length), this.regexp ? regexpCursor(this, C, x, S) : stringCursor(this, C, x, S);
|
|
1908
|
+
}
|
|
1909
|
+
}, QueryType = class {
|
|
1910
|
+
constructor(e6) {
|
|
1911
|
+
this.spec = e6;
|
|
1912
|
+
}
|
|
1913
|
+
};
|
|
1914
|
+
function wrapStringTest(e6, x, S) {
|
|
1915
|
+
return (C, w, T, E) => S && !S(C, w, T, E) ? false : e6(C >= E && w <= E + T.length ? T.slice(C - E, w - E) : x.doc.sliceString(C, w), x, C, w);
|
|
1916
|
+
}
|
|
1917
|
+
function stringCursor(e6, x, S, C) {
|
|
1918
|
+
let w;
|
|
1919
|
+
return e6.wholeWord && (w = stringWordTest(x.doc, x.charCategorizer(x.selection.main.head))), e6.test && (w = wrapStringTest(e6.test, x, w)), new SearchCursor(x.doc, e6.unquoted, S, C, e6.caseSensitive ? void 0 : (e7) => e7.toLowerCase(), w);
|
|
1920
|
+
}
|
|
1921
|
+
function stringWordTest(e6, x) {
|
|
1922
|
+
return (S, C, w, T) => ((T > S || T + w.length < C) && (T = Math.max(0, S - 2), w = e6.sliceString(T, Math.min(e6.length, C + 2))), (x(charBefore(w, S - T)) != CharCategory.Word || x(charAfter(w, S - T)) != CharCategory.Word) && (x(charAfter(w, C - T)) != CharCategory.Word || x(charBefore(w, C - T)) != CharCategory.Word));
|
|
1923
|
+
}
|
|
1924
|
+
var StringQuery = class extends QueryType {
|
|
1925
|
+
constructor(e6) {
|
|
1926
|
+
super(e6);
|
|
1927
|
+
}
|
|
1928
|
+
nextMatch(e6, x, S) {
|
|
1929
|
+
let C = stringCursor(this.spec, e6, S, e6.doc.length).nextOverlapping();
|
|
1930
|
+
if (C.done) {
|
|
1931
|
+
let S2 = Math.min(e6.doc.length, x + this.spec.unquoted.length);
|
|
1932
|
+
C = stringCursor(this.spec, e6, 0, S2).nextOverlapping();
|
|
1933
|
+
}
|
|
1934
|
+
return C.done || C.value.from == x && C.value.to == S ? null : C.value;
|
|
1935
|
+
}
|
|
1936
|
+
prevMatchInRange(e6, x, S) {
|
|
1937
|
+
for (let C = S; ; ) {
|
|
1938
|
+
let S2 = Math.max(x, C - 1e4 - this.spec.unquoted.length), w = stringCursor(this.spec, e6, S2, C), T = null;
|
|
1939
|
+
for (; !w.nextOverlapping().done; ) T = w.value;
|
|
1940
|
+
if (T) return T;
|
|
1941
|
+
if (S2 == x) return null;
|
|
1942
|
+
C -= 1e4;
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
prevMatch(e6, x, S) {
|
|
1946
|
+
let C = this.prevMatchInRange(e6, 0, x);
|
|
1947
|
+
return C || (C = this.prevMatchInRange(e6, Math.max(0, S - this.spec.unquoted.length), e6.doc.length)), C && (C.from != x || C.to != S) ? C : null;
|
|
1948
|
+
}
|
|
1949
|
+
getReplacement(e6) {
|
|
1950
|
+
return this.spec.unquote(this.spec.replace);
|
|
1951
|
+
}
|
|
1952
|
+
matchAll(e6, x) {
|
|
1953
|
+
let S = stringCursor(this.spec, e6, 0, e6.doc.length), C = [];
|
|
1954
|
+
for (; !S.next().done; ) {
|
|
1955
|
+
if (C.length >= x) return null;
|
|
1956
|
+
C.push(S.value);
|
|
1957
|
+
}
|
|
1958
|
+
return C;
|
|
1959
|
+
}
|
|
1960
|
+
highlight(e6, x, S, C) {
|
|
1961
|
+
let w = stringCursor(this.spec, e6, Math.max(0, x - this.spec.unquoted.length), Math.min(S + this.spec.unquoted.length, e6.doc.length));
|
|
1962
|
+
for (; !w.next().done; ) C(w.value.from, w.value.to);
|
|
1963
|
+
}
|
|
1964
|
+
};
|
|
1965
|
+
function wrapRegexpTest(e6, x, S) {
|
|
1966
|
+
return (C, w, T) => (!S || S(C, w, T)) && e6(T[0], x, C, w);
|
|
1967
|
+
}
|
|
1968
|
+
function regexpCursor(e6, x, S, C) {
|
|
1969
|
+
let w;
|
|
1970
|
+
return e6.wholeWord && (w = regexpWordTest(x.charCategorizer(x.selection.main.head))), e6.test && (w = wrapRegexpTest(e6.test, x, w)), new RegExpCursor(x.doc, e6.search, {
|
|
1971
|
+
ignoreCase: !e6.caseSensitive,
|
|
1972
|
+
test: w
|
|
1973
|
+
}, S, C);
|
|
1974
|
+
}
|
|
1975
|
+
function charBefore(e6, x) {
|
|
1976
|
+
return e6.slice(findClusterBreak(e6, x, false), x);
|
|
1977
|
+
}
|
|
1978
|
+
function charAfter(e6, x) {
|
|
1979
|
+
return e6.slice(x, findClusterBreak(e6, x));
|
|
1980
|
+
}
|
|
1981
|
+
function regexpWordTest(e6) {
|
|
1982
|
+
return (x, S, C) => !C[0].length || (e6(charBefore(C.input, C.index)) != CharCategory.Word || e6(charAfter(C.input, C.index)) != CharCategory.Word) && (e6(charAfter(C.input, C.index + C[0].length)) != CharCategory.Word || e6(charBefore(C.input, C.index + C[0].length)) != CharCategory.Word);
|
|
1983
|
+
}
|
|
1984
|
+
var RegExpQuery = class extends QueryType {
|
|
1985
|
+
nextMatch(e6, x, S) {
|
|
1986
|
+
let C = regexpCursor(this.spec, e6, S, e6.doc.length).next();
|
|
1987
|
+
return C.done && (C = regexpCursor(this.spec, e6, 0, x).next()), C.done ? null : C.value;
|
|
1988
|
+
}
|
|
1989
|
+
prevMatchInRange(e6, x, S) {
|
|
1990
|
+
for (let C = 1; ; C++) {
|
|
1991
|
+
let w = Math.max(x, S - C * 1e4), T = regexpCursor(this.spec, e6, w, S), E = null;
|
|
1992
|
+
for (; !T.next().done; ) E = T.value;
|
|
1993
|
+
if (E && (w == x || E.from > w + 10)) return E;
|
|
1994
|
+
if (w == x) return null;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
prevMatch(e6, x, S) {
|
|
1998
|
+
return this.prevMatchInRange(e6, 0, x) || this.prevMatchInRange(e6, S, e6.doc.length);
|
|
1999
|
+
}
|
|
2000
|
+
getReplacement(e6) {
|
|
2001
|
+
return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g, (x, S) => {
|
|
2002
|
+
if (S == "&") return e6.match[0];
|
|
2003
|
+
if (S == "$") return "$";
|
|
2004
|
+
for (let x2 = S.length; x2 > 0; x2--) {
|
|
2005
|
+
let C = +S.slice(0, x2);
|
|
2006
|
+
if (C > 0 && C < e6.match.length) return e6.match[C] + S.slice(x2);
|
|
2007
|
+
}
|
|
2008
|
+
return x;
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
matchAll(e6, x) {
|
|
2012
|
+
let S = regexpCursor(this.spec, e6, 0, e6.doc.length), C = [];
|
|
2013
|
+
for (; !S.next().done; ) {
|
|
2014
|
+
if (C.length >= x) return null;
|
|
2015
|
+
C.push(S.value);
|
|
2016
|
+
}
|
|
2017
|
+
return C;
|
|
2018
|
+
}
|
|
2019
|
+
highlight(e6, x, S, C) {
|
|
2020
|
+
let w = regexpCursor(this.spec, e6, Math.max(0, x - 250), Math.min(S + 250, e6.doc.length));
|
|
2021
|
+
for (; !w.next().done; ) C(w.value.from, w.value.to);
|
|
2022
|
+
}
|
|
2023
|
+
}, setSearchQuery = /* @__PURE__ */ StateEffect.define(), togglePanel = /* @__PURE__ */ StateEffect.define(), searchState = /* @__PURE__ */ StateField.define({
|
|
2024
|
+
create(e6) {
|
|
2025
|
+
return new SearchState(defaultQuery(e6).create(), null);
|
|
2026
|
+
},
|
|
2027
|
+
update(e6, x) {
|
|
2028
|
+
for (let S of x.effects) S.is(setSearchQuery) ? e6 = new SearchState(S.value.create(), e6.panel) : S.is(togglePanel) && (e6 = new SearchState(e6.query, S.value ? createSearchPanel : null));
|
|
2029
|
+
return e6;
|
|
2030
|
+
},
|
|
2031
|
+
provide: (e6) => showPanel.from(e6, (e7) => e7.panel)
|
|
2032
|
+
}), SearchState = class {
|
|
2033
|
+
constructor(e6, x) {
|
|
2034
|
+
this.query = e6, this.panel = x;
|
|
2035
|
+
}
|
|
2036
|
+
}, matchMark = /* @__PURE__ */ Decoration.mark({ class: "cm-searchMatch" }), selectedMatchMark = /* @__PURE__ */ Decoration.mark({ class: "cm-searchMatch cm-searchMatch-selected" }), searchHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class {
|
|
2037
|
+
constructor(e6) {
|
|
2038
|
+
this.view = e6, this.decorations = this.highlight(e6.state.field(searchState));
|
|
2039
|
+
}
|
|
2040
|
+
update(e6) {
|
|
2041
|
+
let x = e6.state.field(searchState);
|
|
2042
|
+
(x != e6.startState.field(searchState) || e6.docChanged || e6.selectionSet || e6.viewportChanged) && (this.decorations = this.highlight(x));
|
|
2043
|
+
}
|
|
2044
|
+
highlight({ query: e6, panel: x }) {
|
|
2045
|
+
if (!x || !e6.spec.valid) return Decoration.none;
|
|
2046
|
+
let { view: S } = this, C = new RangeSetBuilder();
|
|
2047
|
+
for (let x2 = 0, w = S.visibleRanges, T = w.length; x2 < T; x2++) {
|
|
2048
|
+
let { from: E, to: D } = w[x2];
|
|
2049
|
+
for (; x2 < T - 1 && D > w[x2 + 1].from - 500; ) D = w[++x2].to;
|
|
2050
|
+
e6.highlight(S.state, E, D, (e7, x3) => {
|
|
2051
|
+
let w2 = S.state.selection.ranges.some((S2) => S2.from == e7 && S2.to == x3);
|
|
2052
|
+
C.add(e7, x3, w2 ? selectedMatchMark : matchMark);
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
return C.finish();
|
|
2056
|
+
}
|
|
2057
|
+
}, { decorations: (e6) => e6.decorations });
|
|
2058
|
+
function searchCommand(e6) {
|
|
2059
|
+
return (x) => {
|
|
2060
|
+
let S = x.state.field(searchState, false);
|
|
2061
|
+
return S && S.query.spec.valid ? e6(x, S) : openSearchPanel(x);
|
|
2062
|
+
};
|
|
2063
|
+
}
|
|
2064
|
+
var findNext = /* @__PURE__ */ searchCommand((e6, { query: x }) => {
|
|
2065
|
+
let { to: S } = e6.state.selection.main, C = x.nextMatch(e6.state, S, S);
|
|
2066
|
+
if (!C) return false;
|
|
2067
|
+
let w = EditorSelection.single(C.from, C.to), T = e6.state.facet(searchConfigFacet);
|
|
2068
|
+
return e6.dispatch({
|
|
2069
|
+
selection: w,
|
|
2070
|
+
effects: [announceMatch(e6, C), T.scrollToMatch(w.main, e6)],
|
|
2071
|
+
userEvent: "select.search"
|
|
2072
|
+
}), selectSearchInput(e6), true;
|
|
2073
|
+
}), findPrevious = /* @__PURE__ */ searchCommand((e6, { query: x }) => {
|
|
2074
|
+
let { state: S } = e6, { from: C } = S.selection.main, w = x.prevMatch(S, C, C);
|
|
2075
|
+
if (!w) return false;
|
|
2076
|
+
let T = EditorSelection.single(w.from, w.to), E = e6.state.facet(searchConfigFacet);
|
|
2077
|
+
return e6.dispatch({
|
|
2078
|
+
selection: T,
|
|
2079
|
+
effects: [announceMatch(e6, w), E.scrollToMatch(T.main, e6)],
|
|
2080
|
+
userEvent: "select.search"
|
|
2081
|
+
}), selectSearchInput(e6), true;
|
|
2082
|
+
}), selectMatches = /* @__PURE__ */ searchCommand((e6, { query: x }) => {
|
|
2083
|
+
let S = x.matchAll(e6.state, 1e3);
|
|
2084
|
+
return !S || !S.length ? false : (e6.dispatch({
|
|
2085
|
+
selection: EditorSelection.create(S.map((e7) => EditorSelection.range(e7.from, e7.to))),
|
|
2086
|
+
userEvent: "select.search.matches"
|
|
2087
|
+
}), true);
|
|
2088
|
+
}), selectSelectionMatches = ({ state: e6, dispatch: x }) => {
|
|
2089
|
+
let S = e6.selection;
|
|
2090
|
+
if (S.ranges.length > 1 || S.main.empty) return false;
|
|
2091
|
+
let { from: C, to: w } = S.main, T = [], E = 0;
|
|
2092
|
+
for (let x2 = new SearchCursor(e6.doc, e6.sliceDoc(C, w)); !x2.next().done; ) {
|
|
2093
|
+
if (T.length > 1e3) return false;
|
|
2094
|
+
x2.value.from == C && (E = T.length), T.push(EditorSelection.range(x2.value.from, x2.value.to));
|
|
2095
|
+
}
|
|
2096
|
+
return x(e6.update({
|
|
2097
|
+
selection: EditorSelection.create(T, E),
|
|
2098
|
+
userEvent: "select.search.matches"
|
|
2099
|
+
})), true;
|
|
2100
|
+
}, replaceNext = /* @__PURE__ */ searchCommand((e6, { query: x }) => {
|
|
2101
|
+
let { state: S } = e6, { from: C, to: w } = S.selection.main;
|
|
2102
|
+
if (S.readOnly) return false;
|
|
2103
|
+
let T = x.nextMatch(S, C, C);
|
|
2104
|
+
if (!T) return false;
|
|
2105
|
+
let E = T, D = [], O, k, A = [];
|
|
2106
|
+
E.from == C && E.to == w && (k = S.toText(x.getReplacement(E)), D.push({
|
|
2107
|
+
from: E.from,
|
|
2108
|
+
to: E.to,
|
|
2109
|
+
insert: k
|
|
2110
|
+
}), E = x.nextMatch(S, E.from, E.to), A.push(EditorView.announce.of(S.phrase("replaced match on line $", S.doc.lineAt(C).number) + ".")));
|
|
2111
|
+
let j = e6.state.changes(D);
|
|
2112
|
+
return E && (O = EditorSelection.single(E.from, E.to).map(j), A.push(announceMatch(e6, E)), A.push(S.facet(searchConfigFacet).scrollToMatch(O.main, e6))), e6.dispatch({
|
|
2113
|
+
changes: j,
|
|
2114
|
+
selection: O,
|
|
2115
|
+
effects: A,
|
|
2116
|
+
userEvent: "input.replace"
|
|
2117
|
+
}), true;
|
|
2118
|
+
}), replaceAll = /* @__PURE__ */ searchCommand((e6, { query: x }) => {
|
|
2119
|
+
if (e6.state.readOnly) return false;
|
|
2120
|
+
let S = x.matchAll(e6.state, 1e9).map((e7) => {
|
|
2121
|
+
let { from: S2, to: C2 } = e7;
|
|
2122
|
+
return {
|
|
2123
|
+
from: S2,
|
|
2124
|
+
to: C2,
|
|
2125
|
+
insert: x.getReplacement(e7)
|
|
2126
|
+
};
|
|
2127
|
+
});
|
|
2128
|
+
if (!S.length) return false;
|
|
2129
|
+
let C = e6.state.phrase("replaced $ matches", S.length) + ".";
|
|
2130
|
+
return e6.dispatch({
|
|
2131
|
+
changes: S,
|
|
2132
|
+
effects: EditorView.announce.of(C),
|
|
2133
|
+
userEvent: "input.replace.all"
|
|
2134
|
+
}), true;
|
|
2135
|
+
});
|
|
2136
|
+
function createSearchPanel(e6) {
|
|
2137
|
+
return e6.state.facet(searchConfigFacet).createPanel(e6);
|
|
2138
|
+
}
|
|
2139
|
+
function defaultQuery(e6, x) {
|
|
2140
|
+
let S = e6.selection.main, C = S.empty || S.to > S.from + 100 ? "" : e6.sliceDoc(S.from, S.to);
|
|
2141
|
+
if (x && !C) return x;
|
|
2142
|
+
let w = e6.facet(searchConfigFacet);
|
|
2143
|
+
return new SearchQuery({
|
|
2144
|
+
search: (x == null ? void 0 : x.literal) ?? w.literal ? C : C.replace(/\n/g, "\\n"),
|
|
2145
|
+
caseSensitive: (x == null ? void 0 : x.caseSensitive) ?? w.caseSensitive,
|
|
2146
|
+
literal: (x == null ? void 0 : x.literal) ?? w.literal,
|
|
2147
|
+
regexp: (x == null ? void 0 : x.regexp) ?? w.regexp,
|
|
2148
|
+
wholeWord: (x == null ? void 0 : x.wholeWord) ?? w.wholeWord
|
|
2149
|
+
});
|
|
2150
|
+
}
|
|
2151
|
+
function getSearchInput(e6) {
|
|
2152
|
+
let x = getPanel(e6, createSearchPanel);
|
|
2153
|
+
return x && x.dom.querySelector("[main-field]");
|
|
2154
|
+
}
|
|
2155
|
+
function selectSearchInput(e6) {
|
|
2156
|
+
let x = getSearchInput(e6);
|
|
2157
|
+
x && x == e6.root.activeElement && x.select();
|
|
2158
|
+
}
|
|
2159
|
+
var openSearchPanel = (e6) => {
|
|
2160
|
+
let x = e6.state.field(searchState, false);
|
|
2161
|
+
if (x && x.panel) {
|
|
2162
|
+
let S = getSearchInput(e6);
|
|
2163
|
+
if (S && S != e6.root.activeElement) {
|
|
2164
|
+
let C = defaultQuery(e6.state, x.query.spec);
|
|
2165
|
+
C.valid && e6.dispatch({ effects: setSearchQuery.of(C) }), S.focus(), S.select();
|
|
2166
|
+
}
|
|
2167
|
+
} else e6.dispatch({ effects: [togglePanel.of(true), x ? setSearchQuery.of(defaultQuery(e6.state, x.query.spec)) : StateEffect.appendConfig.of(searchExtensions)] });
|
|
2168
|
+
return true;
|
|
2169
|
+
}, closeSearchPanel = (e6) => {
|
|
2170
|
+
let x = e6.state.field(searchState, false);
|
|
2171
|
+
if (!x || !x.panel) return false;
|
|
2172
|
+
let S = getPanel(e6, createSearchPanel);
|
|
2173
|
+
return S && S.dom.contains(e6.root.activeElement) && e6.focus(), e6.dispatch({ effects: togglePanel.of(false) }), true;
|
|
2174
|
+
}, searchKeymap = [
|
|
2175
|
+
{
|
|
2176
|
+
key: "Mod-f",
|
|
2177
|
+
run: openSearchPanel,
|
|
2178
|
+
scope: "editor search-panel"
|
|
2179
|
+
},
|
|
2180
|
+
{
|
|
2181
|
+
key: "F3",
|
|
2182
|
+
run: findNext,
|
|
2183
|
+
shift: findPrevious,
|
|
2184
|
+
scope: "editor search-panel",
|
|
2185
|
+
preventDefault: true
|
|
2186
|
+
},
|
|
2187
|
+
{
|
|
2188
|
+
key: "Mod-g",
|
|
2189
|
+
run: findNext,
|
|
2190
|
+
shift: findPrevious,
|
|
2191
|
+
scope: "editor search-panel",
|
|
2192
|
+
preventDefault: true
|
|
2193
|
+
},
|
|
2194
|
+
{
|
|
2195
|
+
key: "Escape",
|
|
2196
|
+
run: closeSearchPanel,
|
|
2197
|
+
scope: "editor search-panel"
|
|
2198
|
+
},
|
|
2199
|
+
{
|
|
2200
|
+
key: "Mod-Shift-l",
|
|
2201
|
+
run: selectSelectionMatches
|
|
2202
|
+
},
|
|
2203
|
+
{
|
|
2204
|
+
key: "Mod-Alt-g",
|
|
2205
|
+
run: gotoLine
|
|
2206
|
+
},
|
|
2207
|
+
{
|
|
2208
|
+
key: "Mod-d",
|
|
2209
|
+
run: selectNextOccurrence,
|
|
2210
|
+
preventDefault: true
|
|
2211
|
+
}
|
|
2212
|
+
], SearchPanel = class {
|
|
2213
|
+
constructor(e6) {
|
|
2214
|
+
this.view = e6;
|
|
2215
|
+
let x = this.query = e6.state.field(searchState).query.spec;
|
|
2216
|
+
this.commit = this.commit.bind(this), this.searchField = crelt("input", {
|
|
2217
|
+
value: x.search,
|
|
2218
|
+
placeholder: phrase(e6, "Find"),
|
|
2219
|
+
"aria-label": phrase(e6, "Find"),
|
|
2220
|
+
class: "cm-textfield",
|
|
2221
|
+
name: "search",
|
|
2222
|
+
form: "",
|
|
2223
|
+
"main-field": "true",
|
|
2224
|
+
onchange: this.commit,
|
|
2225
|
+
onkeyup: this.commit
|
|
2226
|
+
}), this.replaceField = crelt("input", {
|
|
2227
|
+
value: x.replace,
|
|
2228
|
+
placeholder: phrase(e6, "Replace"),
|
|
2229
|
+
"aria-label": phrase(e6, "Replace"),
|
|
2230
|
+
class: "cm-textfield",
|
|
2231
|
+
name: "replace",
|
|
2232
|
+
form: "",
|
|
2233
|
+
onchange: this.commit,
|
|
2234
|
+
onkeyup: this.commit
|
|
2235
|
+
}), this.caseField = crelt("input", {
|
|
2236
|
+
type: "checkbox",
|
|
2237
|
+
name: "case",
|
|
2238
|
+
form: "",
|
|
2239
|
+
checked: x.caseSensitive,
|
|
2240
|
+
onchange: this.commit
|
|
2241
|
+
}), this.reField = crelt("input", {
|
|
2242
|
+
type: "checkbox",
|
|
2243
|
+
name: "re",
|
|
2244
|
+
form: "",
|
|
2245
|
+
checked: x.regexp,
|
|
2246
|
+
onchange: this.commit
|
|
2247
|
+
}), this.wordField = crelt("input", {
|
|
2248
|
+
type: "checkbox",
|
|
2249
|
+
name: "word",
|
|
2250
|
+
form: "",
|
|
2251
|
+
checked: x.wholeWord,
|
|
2252
|
+
onchange: this.commit
|
|
2253
|
+
});
|
|
2254
|
+
function S(e7, x2, S2) {
|
|
2255
|
+
return crelt("button", {
|
|
2256
|
+
class: "cm-button",
|
|
2257
|
+
name: e7,
|
|
2258
|
+
onclick: x2,
|
|
2259
|
+
type: "button"
|
|
2260
|
+
}, S2);
|
|
2261
|
+
}
|
|
2262
|
+
this.dom = crelt("div", {
|
|
2263
|
+
onkeydown: (e7) => this.keydown(e7),
|
|
2264
|
+
class: "cm-search"
|
|
2265
|
+
}, [
|
|
2266
|
+
this.searchField,
|
|
2267
|
+
S("next", () => findNext(e6), [phrase(e6, "next")]),
|
|
2268
|
+
S("prev", () => findPrevious(e6), [phrase(e6, "previous")]),
|
|
2269
|
+
S("select", () => selectMatches(e6), [phrase(e6, "all")]),
|
|
2270
|
+
crelt("label", null, [this.caseField, phrase(e6, "match case")]),
|
|
2271
|
+
crelt("label", null, [this.reField, phrase(e6, "regexp")]),
|
|
2272
|
+
crelt("label", null, [this.wordField, phrase(e6, "by word")]),
|
|
2273
|
+
...e6.state.readOnly ? [] : [
|
|
2274
|
+
crelt("br"),
|
|
2275
|
+
this.replaceField,
|
|
2276
|
+
S("replace", () => replaceNext(e6), [phrase(e6, "replace")]),
|
|
2277
|
+
S("replaceAll", () => replaceAll(e6), [phrase(e6, "replace all")])
|
|
2278
|
+
],
|
|
2279
|
+
crelt("button", {
|
|
2280
|
+
name: "close",
|
|
2281
|
+
onclick: () => closeSearchPanel(e6),
|
|
2282
|
+
"aria-label": phrase(e6, "close"),
|
|
2283
|
+
type: "button"
|
|
2284
|
+
}, ["\xD7"])
|
|
2285
|
+
]);
|
|
2286
|
+
}
|
|
2287
|
+
commit() {
|
|
2288
|
+
let e6 = new SearchQuery({
|
|
2289
|
+
search: this.searchField.value,
|
|
2290
|
+
caseSensitive: this.caseField.checked,
|
|
2291
|
+
regexp: this.reField.checked,
|
|
2292
|
+
wholeWord: this.wordField.checked,
|
|
2293
|
+
replace: this.replaceField.value
|
|
2294
|
+
});
|
|
2295
|
+
e6.eq(this.query) || (this.query = e6, this.view.dispatch({ effects: setSearchQuery.of(e6) }));
|
|
2296
|
+
}
|
|
2297
|
+
keydown(e6) {
|
|
2298
|
+
runScopeHandlers(this.view, e6, "search-panel") ? e6.preventDefault() : e6.keyCode == 13 && e6.target == this.searchField ? (e6.preventDefault(), (e6.shiftKey ? findPrevious : findNext)(this.view)) : e6.keyCode == 13 && e6.target == this.replaceField && (e6.preventDefault(), replaceNext(this.view));
|
|
2299
|
+
}
|
|
2300
|
+
update(e6) {
|
|
2301
|
+
for (let x of e6.transactions) for (let e7 of x.effects) e7.is(setSearchQuery) && !e7.value.eq(this.query) && this.setQuery(e7.value);
|
|
2302
|
+
}
|
|
2303
|
+
setQuery(e6) {
|
|
2304
|
+
this.query = e6, this.searchField.value = e6.search, this.replaceField.value = e6.replace, this.caseField.checked = e6.caseSensitive, this.reField.checked = e6.regexp, this.wordField.checked = e6.wholeWord;
|
|
2305
|
+
}
|
|
2306
|
+
mount() {
|
|
2307
|
+
this.searchField.select();
|
|
2308
|
+
}
|
|
2309
|
+
get pos() {
|
|
2310
|
+
return 80;
|
|
2311
|
+
}
|
|
2312
|
+
get top() {
|
|
2313
|
+
return this.view.state.facet(searchConfigFacet).top;
|
|
2314
|
+
}
|
|
2315
|
+
};
|
|
2316
|
+
function phrase(e6, x) {
|
|
2317
|
+
return e6.state.phrase(x);
|
|
2318
|
+
}
|
|
2319
|
+
var AnnounceMargin = 30, Break = /[\s\.,:;?!]/;
|
|
2320
|
+
function announceMatch(e6, { from: x, to: S }) {
|
|
2321
|
+
let C = e6.state.doc.lineAt(x), w = e6.state.doc.lineAt(S).to, T = Math.max(C.from, x - AnnounceMargin), E = Math.min(w, S + AnnounceMargin), D = e6.state.sliceDoc(T, E);
|
|
2322
|
+
if (T != C.from) {
|
|
2323
|
+
for (let e7 = 0; e7 < AnnounceMargin; e7++) if (!Break.test(D[e7 + 1]) && Break.test(D[e7])) {
|
|
2324
|
+
D = D.slice(e7);
|
|
2325
|
+
break;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
if (E != w) {
|
|
2329
|
+
for (let e7 = D.length - 1; e7 > D.length - AnnounceMargin; e7--) if (!Break.test(D[e7 - 1]) && Break.test(D[e7])) {
|
|
2330
|
+
D = D.slice(0, e7);
|
|
2331
|
+
break;
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
return EditorView.announce.of(`${e6.state.phrase("current match")}. ${D} ${e6.state.phrase("on line")} ${C.number}.`);
|
|
2335
|
+
}
|
|
2336
|
+
var baseTheme = /* @__PURE__ */ EditorView.baseTheme({
|
|
2337
|
+
".cm-panel.cm-search": {
|
|
2338
|
+
padding: "2px 6px 4px",
|
|
2339
|
+
position: "relative",
|
|
2340
|
+
"& [name=close]": {
|
|
2341
|
+
position: "absolute",
|
|
2342
|
+
top: "0",
|
|
2343
|
+
right: "4px",
|
|
2344
|
+
backgroundColor: "inherit",
|
|
2345
|
+
border: "none",
|
|
2346
|
+
font: "inherit",
|
|
2347
|
+
padding: 0,
|
|
2348
|
+
margin: 0
|
|
2349
|
+
},
|
|
2350
|
+
"& input, & button, & label": { margin: ".2em .6em .2em 0" },
|
|
2351
|
+
"& input[type=checkbox]": { marginRight: ".2em" },
|
|
2352
|
+
"& label": {
|
|
2353
|
+
fontSize: "80%",
|
|
2354
|
+
whiteSpace: "pre"
|
|
2355
|
+
}
|
|
2356
|
+
},
|
|
2357
|
+
"&light .cm-searchMatch": { backgroundColor: "#ffff0054" },
|
|
2358
|
+
"&dark .cm-searchMatch": { backgroundColor: "#00ffff8a" },
|
|
2359
|
+
"&light .cm-searchMatch-selected": { backgroundColor: "#ff6a0054" },
|
|
2360
|
+
"&dark .cm-searchMatch-selected": { backgroundColor: "#ff00ff8a" }
|
|
2361
|
+
}), searchExtensions = [
|
|
2362
|
+
searchState,
|
|
2363
|
+
/* @__PURE__ */ Prec.low(searchHighlighter),
|
|
2364
|
+
baseTheme
|
|
2365
|
+
];
|
|
2366
|
+
function _extends() {
|
|
2367
|
+
return _extends = Object.assign ? Object.assign.bind() : function(e6) {
|
|
2368
|
+
for (var x = 1; x < arguments.length; x++) {
|
|
2369
|
+
var S = arguments[x];
|
|
2370
|
+
for (var C in S) ({}).hasOwnProperty.call(S, C) && (e6[C] = S[C]);
|
|
2371
|
+
}
|
|
2372
|
+
return e6;
|
|
2373
|
+
}, _extends.apply(null, arguments);
|
|
2374
|
+
}
|
|
2375
|
+
function _objectWithoutPropertiesLoose(e6, x) {
|
|
2376
|
+
if (e6 == null) return {};
|
|
2377
|
+
var S = {};
|
|
2378
|
+
for (var C in e6) if ({}.hasOwnProperty.call(e6, C)) {
|
|
2379
|
+
if (x.indexOf(C) !== -1) continue;
|
|
2380
|
+
S[C] = e6[C];
|
|
2381
|
+
}
|
|
2382
|
+
return S;
|
|
2383
|
+
}
|
|
2384
|
+
var basicSetup = function(e6) {
|
|
2385
|
+
e6 === void 0 && (e6 = {});
|
|
2386
|
+
var { crosshairCursor: x = false } = e6, S = [];
|
|
2387
|
+
e6.closeBracketsKeymap !== false && (S = S.concat(closeBracketsKeymap)), e6.defaultKeymap !== false && (S = S.concat(defaultKeymap)), e6.searchKeymap !== false && (S = S.concat(searchKeymap)), e6.historyKeymap !== false && (S = S.concat(historyKeymap)), e6.foldKeymap !== false && (S = S.concat(foldKeymap)), e6.completionKeymap !== false && (S = S.concat(completionKeymap)), e6.lintKeymap !== false && (S = S.concat(lintKeymap));
|
|
2388
|
+
var C = [];
|
|
2389
|
+
return e6.lineNumbers !== false && C.push(lineNumbers()), e6.highlightActiveLineGutter !== false && C.push(highlightActiveLineGutter()), e6.highlightSpecialChars !== false && C.push(highlightSpecialChars()), e6.history !== false && C.push(history()), e6.foldGutter !== false && C.push(foldGutter()), e6.drawSelection !== false && C.push(drawSelection()), e6.dropCursor !== false && C.push(dropCursor()), e6.allowMultipleSelections !== false && C.push(EditorState.allowMultipleSelections.of(true)), e6.indentOnInput !== false && C.push(indentOnInput()), e6.syntaxHighlighting !== false && C.push(syntaxHighlighting(defaultHighlightStyle, { fallback: true })), e6.bracketMatching !== false && C.push(bracketMatching()), e6.closeBrackets !== false && C.push(closeBrackets()), e6.autocompletion !== false && C.push(autocompletion()), e6.rectangularSelection !== false && C.push(rectangularSelection()), x !== false && C.push(crosshairCursor()), e6.highlightActiveLine !== false && C.push(highlightActiveLine()), e6.highlightSelectionMatches !== false && C.push(highlightSelectionMatches()), e6.tabSize && typeof e6.tabSize == "number" && C.push(indentUnit.of(" ".repeat(e6.tabSize))), C.concat([keymap.of(S.flat())]).filter(Boolean);
|
|
2390
|
+
}, minimalSetup = function(e6) {
|
|
2391
|
+
e6 === void 0 && (e6 = {});
|
|
2392
|
+
var x = [];
|
|
2393
|
+
e6.defaultKeymap !== false && (x = x.concat(defaultKeymap)), e6.historyKeymap !== false && (x = x.concat(historyKeymap));
|
|
2394
|
+
var S = [];
|
|
2395
|
+
return e6.highlightSpecialChars !== false && S.push(highlightSpecialChars()), e6.history !== false && S.push(history()), e6.drawSelection !== false && S.push(drawSelection()), e6.syntaxHighlighting !== false && S.push(syntaxHighlighting(defaultHighlightStyle, { fallback: true })), S.concat([keymap.of(x.flat())]).filter(Boolean);
|
|
2396
|
+
}, chalky = "#e5c07b", coral = "#e06c75", cyan = "#56b6c2", invalid = "#ffffff", ivory = "#abb2bf", stone = "#7d8799", malibu = "#61afef", sage = "#98c379", whiskey = "#d19a66", violet = "#c678dd", darkBackground = "#21252b", highlightBackground = "#2c313a", background = "#282c34", tooltipBackground = "#353a42", selection = "#3E4451", cursor = "#528bff", oneDark = [/* @__PURE__ */ EditorView.theme({
|
|
2397
|
+
"&": {
|
|
2398
|
+
color: ivory,
|
|
2399
|
+
backgroundColor: background
|
|
2400
|
+
},
|
|
2401
|
+
".cm-content": { caretColor: cursor },
|
|
2402
|
+
".cm-cursor, .cm-dropCursor": { borderLeftColor: cursor },
|
|
2403
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: selection },
|
|
2404
|
+
".cm-panels": {
|
|
2405
|
+
backgroundColor: darkBackground,
|
|
2406
|
+
color: ivory
|
|
2407
|
+
},
|
|
2408
|
+
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
2409
|
+
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
2410
|
+
".cm-searchMatch": {
|
|
2411
|
+
backgroundColor: "#72a1ff59",
|
|
2412
|
+
outline: "1px solid #457dff"
|
|
2413
|
+
},
|
|
2414
|
+
".cm-searchMatch.cm-searchMatch-selected": { backgroundColor: "#6199ff2f" },
|
|
2415
|
+
".cm-activeLine": { backgroundColor: "#6699ff0b" },
|
|
2416
|
+
".cm-selectionMatch": { backgroundColor: "#aafe661a" },
|
|
2417
|
+
"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket": { backgroundColor: "#bad0f847" },
|
|
2418
|
+
".cm-gutters": {
|
|
2419
|
+
backgroundColor: background,
|
|
2420
|
+
color: stone,
|
|
2421
|
+
border: "none"
|
|
2422
|
+
},
|
|
2423
|
+
".cm-activeLineGutter": { backgroundColor: highlightBackground },
|
|
2424
|
+
".cm-foldPlaceholder": {
|
|
2425
|
+
backgroundColor: "transparent",
|
|
2426
|
+
border: "none",
|
|
2427
|
+
color: "#ddd"
|
|
2428
|
+
},
|
|
2429
|
+
".cm-tooltip": {
|
|
2430
|
+
border: "none",
|
|
2431
|
+
backgroundColor: tooltipBackground
|
|
2432
|
+
},
|
|
2433
|
+
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
2434
|
+
borderTopColor: "transparent",
|
|
2435
|
+
borderBottomColor: "transparent"
|
|
2436
|
+
},
|
|
2437
|
+
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
2438
|
+
borderTopColor: tooltipBackground,
|
|
2439
|
+
borderBottomColor: tooltipBackground
|
|
2440
|
+
},
|
|
2441
|
+
".cm-tooltip-autocomplete": { "& > ul > li[aria-selected]": {
|
|
2442
|
+
backgroundColor: highlightBackground,
|
|
2443
|
+
color: ivory
|
|
2444
|
+
} }
|
|
2445
|
+
}, { dark: true }), /* @__PURE__ */ syntaxHighlighting(/* @__PURE__ */ HighlightStyle.define([
|
|
2446
|
+
{
|
|
2447
|
+
tag: tags.keyword,
|
|
2448
|
+
color: violet
|
|
2449
|
+
},
|
|
2450
|
+
{
|
|
2451
|
+
tag: [
|
|
2452
|
+
tags.name,
|
|
2453
|
+
tags.deleted,
|
|
2454
|
+
tags.character,
|
|
2455
|
+
tags.propertyName,
|
|
2456
|
+
tags.macroName
|
|
2457
|
+
],
|
|
2458
|
+
color: coral
|
|
2459
|
+
},
|
|
2460
|
+
{
|
|
2461
|
+
tag: [/* @__PURE__ */ tags.function(tags.variableName), tags.labelName],
|
|
2462
|
+
color: malibu
|
|
2463
|
+
},
|
|
2464
|
+
{
|
|
2465
|
+
tag: [
|
|
2466
|
+
tags.color,
|
|
2467
|
+
/* @__PURE__ */ tags.constant(tags.name),
|
|
2468
|
+
/* @__PURE__ */ tags.standard(tags.name)
|
|
2469
|
+
],
|
|
2470
|
+
color: whiskey
|
|
2471
|
+
},
|
|
2472
|
+
{
|
|
2473
|
+
tag: [/* @__PURE__ */ tags.definition(tags.name), tags.separator],
|
|
2474
|
+
color: ivory
|
|
2475
|
+
},
|
|
2476
|
+
{
|
|
2477
|
+
tag: [
|
|
2478
|
+
tags.typeName,
|
|
2479
|
+
tags.className,
|
|
2480
|
+
tags.number,
|
|
2481
|
+
tags.changed,
|
|
2482
|
+
tags.annotation,
|
|
2483
|
+
tags.modifier,
|
|
2484
|
+
tags.self,
|
|
2485
|
+
tags.namespace
|
|
2486
|
+
],
|
|
2487
|
+
color: chalky
|
|
2488
|
+
},
|
|
2489
|
+
{
|
|
2490
|
+
tag: [
|
|
2491
|
+
tags.operator,
|
|
2492
|
+
tags.operatorKeyword,
|
|
2493
|
+
tags.url,
|
|
2494
|
+
tags.escape,
|
|
2495
|
+
tags.regexp,
|
|
2496
|
+
tags.link,
|
|
2497
|
+
/* @__PURE__ */ tags.special(tags.string)
|
|
2498
|
+
],
|
|
2499
|
+
color: cyan
|
|
2500
|
+
},
|
|
2501
|
+
{
|
|
2502
|
+
tag: [tags.meta, tags.comment],
|
|
2503
|
+
color: stone
|
|
2504
|
+
},
|
|
2505
|
+
{
|
|
2506
|
+
tag: tags.strong,
|
|
2507
|
+
fontWeight: "bold"
|
|
2508
|
+
},
|
|
2509
|
+
{
|
|
2510
|
+
tag: tags.emphasis,
|
|
2511
|
+
fontStyle: "italic"
|
|
2512
|
+
},
|
|
2513
|
+
{
|
|
2514
|
+
tag: tags.strikethrough,
|
|
2515
|
+
textDecoration: "line-through"
|
|
2516
|
+
},
|
|
2517
|
+
{
|
|
2518
|
+
tag: tags.link,
|
|
2519
|
+
color: stone,
|
|
2520
|
+
textDecoration: "underline"
|
|
2521
|
+
},
|
|
2522
|
+
{
|
|
2523
|
+
tag: tags.heading,
|
|
2524
|
+
fontWeight: "bold",
|
|
2525
|
+
color: coral
|
|
2526
|
+
},
|
|
2527
|
+
{
|
|
2528
|
+
tag: [
|
|
2529
|
+
tags.atom,
|
|
2530
|
+
tags.bool,
|
|
2531
|
+
/* @__PURE__ */ tags.special(tags.variableName)
|
|
2532
|
+
],
|
|
2533
|
+
color: whiskey
|
|
2534
|
+
},
|
|
2535
|
+
{
|
|
2536
|
+
tag: [
|
|
2537
|
+
tags.processingInstruction,
|
|
2538
|
+
tags.string,
|
|
2539
|
+
tags.inserted
|
|
2540
|
+
],
|
|
2541
|
+
color: sage
|
|
2542
|
+
},
|
|
2543
|
+
{
|
|
2544
|
+
tag: tags.invalid,
|
|
2545
|
+
color: invalid
|
|
2546
|
+
}
|
|
2547
|
+
]))], defaultLightThemeOption = EditorView.theme({ "&": { backgroundColor: "#fff" } }, { dark: false }), getDefaultExtensions = function(e6) {
|
|
2548
|
+
e6 === void 0 && (e6 = {});
|
|
2549
|
+
var { indentWithTab: x = true, editable: S = true, readOnly: C = false, theme: w = "light", placeholder: T = "", basicSetup: E = true } = e6, D = [];
|
|
2550
|
+
switch (x && D.unshift(keymap.of([indentWithTab])), E && (typeof E == "boolean" ? D.unshift(basicSetup()) : D.unshift(basicSetup(E))), T && D.unshift(placeholder(T)), w) {
|
|
2551
|
+
case "light":
|
|
2552
|
+
D.push(defaultLightThemeOption);
|
|
2553
|
+
break;
|
|
2554
|
+
case "dark":
|
|
2555
|
+
D.push(oneDark);
|
|
2556
|
+
break;
|
|
2557
|
+
case "none":
|
|
2558
|
+
break;
|
|
2559
|
+
default:
|
|
2560
|
+
D.push(w);
|
|
2561
|
+
break;
|
|
2562
|
+
}
|
|
2563
|
+
return S === false && D.push(EditorView.editable.of(false)), C && D.push(EditorState.readOnly.of(true)), [...D];
|
|
2564
|
+
}, getStatistics = (e6) => ({
|
|
2565
|
+
line: e6.state.doc.lineAt(e6.state.selection.main.from),
|
|
2566
|
+
lineCount: e6.state.doc.lines,
|
|
2567
|
+
lineBreak: e6.state.lineBreak,
|
|
2568
|
+
length: e6.state.doc.length,
|
|
2569
|
+
readOnly: e6.state.readOnly,
|
|
2570
|
+
tabSize: e6.state.tabSize,
|
|
2571
|
+
selection: e6.state.selection,
|
|
2572
|
+
selectionAsSingle: e6.state.selection.asSingle().main,
|
|
2573
|
+
ranges: e6.state.selection.ranges,
|
|
2574
|
+
selectionCode: e6.state.sliceDoc(e6.state.selection.main.from, e6.state.selection.main.to),
|
|
2575
|
+
selections: e6.state.selection.ranges.map((x) => e6.state.sliceDoc(x.from, x.to)),
|
|
2576
|
+
selectedText: e6.state.selection.ranges.some((e7) => !e7.empty)
|
|
2577
|
+
}), TimeoutLatch = class {
|
|
2578
|
+
constructor(e6, x) {
|
|
2579
|
+
this.timeLeftMS = void 0, this.timeoutMS = void 0, this.isCancelled = false, this.isTimeExhausted = false, this.callbacks = [], this.timeLeftMS = x, this.timeoutMS = x, this.callbacks.push(e6);
|
|
2580
|
+
}
|
|
2581
|
+
tick() {
|
|
2582
|
+
if (!this.isCancelled && !this.isTimeExhausted && (this.timeLeftMS--, this.timeLeftMS <= 0)) {
|
|
2583
|
+
this.isTimeExhausted = true;
|
|
2584
|
+
var e6 = this.callbacks.slice();
|
|
2585
|
+
this.callbacks.length = 0, e6.forEach((e7) => {
|
|
2586
|
+
try {
|
|
2587
|
+
e7();
|
|
2588
|
+
} catch (e8) {
|
|
2589
|
+
console.error("TimeoutLatch callback error:", e8);
|
|
2590
|
+
}
|
|
2591
|
+
});
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
cancel() {
|
|
2595
|
+
this.isCancelled = true, this.callbacks.length = 0;
|
|
2596
|
+
}
|
|
2597
|
+
reset() {
|
|
2598
|
+
this.timeLeftMS = this.timeoutMS, this.isCancelled = false, this.isTimeExhausted = false;
|
|
2599
|
+
}
|
|
2600
|
+
get isDone() {
|
|
2601
|
+
return this.isCancelled || this.isTimeExhausted;
|
|
2602
|
+
}
|
|
2603
|
+
}, Scheduler = class {
|
|
2604
|
+
constructor() {
|
|
2605
|
+
this.interval = null, this.latches = /* @__PURE__ */ new Set();
|
|
2606
|
+
}
|
|
2607
|
+
add(e6) {
|
|
2608
|
+
this.latches.add(e6), this.start();
|
|
2609
|
+
}
|
|
2610
|
+
remove(e6) {
|
|
2611
|
+
this.latches.delete(e6), this.latches.size === 0 && this.stop();
|
|
2612
|
+
}
|
|
2613
|
+
start() {
|
|
2614
|
+
this.interval === null && (this.interval = setInterval(() => {
|
|
2615
|
+
this.latches.forEach((e6) => {
|
|
2616
|
+
e6.tick(), e6.isDone && this.remove(e6);
|
|
2617
|
+
});
|
|
2618
|
+
}, 1));
|
|
2619
|
+
}
|
|
2620
|
+
stop() {
|
|
2621
|
+
this.interval !== null && (clearInterval(this.interval), this.interval = null);
|
|
2622
|
+
}
|
|
2623
|
+
}, globalScheduler = null, getScheduler = () => typeof window > "u" ? new Scheduler() : (globalScheduler || (globalScheduler = new Scheduler()), globalScheduler), ExternalChange = Annotation.define(), TYPING_TIMOUT = 200, emptyExtensions = [];
|
|
2624
|
+
function useCodeMirror(e6) {
|
|
2625
|
+
var { value: x, selection: S, onChange: C, onStatistics: w, onCreateEditor: T, onUpdate: E, extensions: D = emptyExtensions, autoFocus: O, theme: k = "light", height: A = null, minHeight: j = null, maxHeight: M = null, width: N = null, minWidth: P = null, maxWidth: F = null, placeholder: I = "", editable: L = true, readOnly: R = false, indentWithTab: B = true, basicSetup: V = true, root: H, initialState: U } = e6, [W, G] = (0, import_react.useState)(), [K, q] = (0, import_react.useState)(), [J, Y] = (0, import_react.useState)(), X = (0, import_react.useState)(() => ({ current: null }))[0], Z = (0, import_react.useState)(() => ({ current: null }))[0], Q = EditorView.theme({
|
|
2626
|
+
"&": {
|
|
2627
|
+
height: A,
|
|
2628
|
+
minHeight: j,
|
|
2629
|
+
maxHeight: M,
|
|
2630
|
+
width: N,
|
|
2631
|
+
minWidth: P,
|
|
2632
|
+
maxWidth: F
|
|
2633
|
+
},
|
|
2634
|
+
"& .cm-scroller": { height: "100% !important" }
|
|
2635
|
+
}), $ = [
|
|
2636
|
+
EditorView.updateListener.of((e7) => {
|
|
2637
|
+
e7.docChanged && typeof C == "function" && !e7.transactions.some((e8) => e8.annotation(ExternalChange)) && (X.current ? X.current.reset() : (X.current = new TimeoutLatch(() => {
|
|
2638
|
+
if (Z.current) {
|
|
2639
|
+
var e8 = Z.current;
|
|
2640
|
+
Z.current = null, e8();
|
|
2641
|
+
}
|
|
2642
|
+
X.current = null;
|
|
2643
|
+
}, TYPING_TIMOUT), getScheduler().add(X.current)), C(e7.state.doc.toString(), e7)), w && w(getStatistics(e7));
|
|
2644
|
+
}),
|
|
2645
|
+
Q,
|
|
2646
|
+
...getDefaultExtensions({
|
|
2647
|
+
theme: k,
|
|
2648
|
+
editable: L,
|
|
2649
|
+
readOnly: R,
|
|
2650
|
+
placeholder: I,
|
|
2651
|
+
indentWithTab: B,
|
|
2652
|
+
basicSetup: V
|
|
2653
|
+
})
|
|
2654
|
+
];
|
|
2655
|
+
return E && typeof E == "function" && $.push(EditorView.updateListener.of(E)), $ = $.concat(D), (0, import_react.useLayoutEffect)(() => {
|
|
2656
|
+
if (W && !J) {
|
|
2657
|
+
var e7 = {
|
|
2658
|
+
doc: x,
|
|
2659
|
+
selection: S,
|
|
2660
|
+
extensions: $
|
|
2661
|
+
}, C2 = U ? EditorState.fromJSON(U.json, e7, U.fields) : EditorState.create(e7);
|
|
2662
|
+
if (Y(C2), !K) {
|
|
2663
|
+
var w2 = new EditorView({
|
|
2664
|
+
state: C2,
|
|
2665
|
+
parent: W,
|
|
2666
|
+
root: H
|
|
2667
|
+
});
|
|
2668
|
+
q(w2), T && T(w2, C2);
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
return () => {
|
|
2672
|
+
K && (Y(void 0), q(void 0));
|
|
2673
|
+
};
|
|
2674
|
+
}, [W, J]), (0, import_react.useEffect)(() => {
|
|
2675
|
+
e6.container && G(e6.container);
|
|
2676
|
+
}, [e6.container]), (0, import_react.useEffect)(() => () => {
|
|
2677
|
+
K && (K.destroy(), q(void 0)), X.current && (X.current = (X.current.cancel(), null));
|
|
2678
|
+
}, [K]), (0, import_react.useEffect)(() => {
|
|
2679
|
+
O && K && K.focus();
|
|
2680
|
+
}, [O, K]), (0, import_react.useEffect)(() => {
|
|
2681
|
+
K && K.dispatch({ effects: StateEffect.reconfigure.of($) });
|
|
2682
|
+
}, [
|
|
2683
|
+
k,
|
|
2684
|
+
D,
|
|
2685
|
+
A,
|
|
2686
|
+
j,
|
|
2687
|
+
M,
|
|
2688
|
+
N,
|
|
2689
|
+
P,
|
|
2690
|
+
F,
|
|
2691
|
+
I,
|
|
2692
|
+
L,
|
|
2693
|
+
R,
|
|
2694
|
+
B,
|
|
2695
|
+
V,
|
|
2696
|
+
C,
|
|
2697
|
+
E
|
|
2698
|
+
]), (0, import_react.useEffect)(() => {
|
|
2699
|
+
if (x !== void 0) {
|
|
2700
|
+
var e7 = K ? K.state.doc.toString() : "";
|
|
2701
|
+
if (K && x !== e7) {
|
|
2702
|
+
var S2 = X.current && !X.current.isDone, C2 = () => {
|
|
2703
|
+
K && x !== K.state.doc.toString() && K.dispatch({
|
|
2704
|
+
changes: {
|
|
2705
|
+
from: 0,
|
|
2706
|
+
to: K.state.doc.toString().length,
|
|
2707
|
+
insert: x || ""
|
|
2708
|
+
},
|
|
2709
|
+
annotations: [ExternalChange.of(true)]
|
|
2710
|
+
});
|
|
2711
|
+
};
|
|
2712
|
+
S2 ? Z.current = C2 : C2();
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
}, [x, K]), {
|
|
2716
|
+
state: J,
|
|
2717
|
+
setState: Y,
|
|
2718
|
+
view: K,
|
|
2719
|
+
setView: q,
|
|
2720
|
+
container: W,
|
|
2721
|
+
setContainer: G
|
|
2722
|
+
};
|
|
2723
|
+
}
|
|
2724
|
+
var _excluded = [
|
|
2725
|
+
"className",
|
|
2726
|
+
"value",
|
|
2727
|
+
"selection",
|
|
2728
|
+
"extensions",
|
|
2729
|
+
"onChange",
|
|
2730
|
+
"onStatistics",
|
|
2731
|
+
"onCreateEditor",
|
|
2732
|
+
"onUpdate",
|
|
2733
|
+
"autoFocus",
|
|
2734
|
+
"theme",
|
|
2735
|
+
"height",
|
|
2736
|
+
"minHeight",
|
|
2737
|
+
"maxHeight",
|
|
2738
|
+
"width",
|
|
2739
|
+
"minWidth",
|
|
2740
|
+
"maxWidth",
|
|
2741
|
+
"basicSetup",
|
|
2742
|
+
"placeholder",
|
|
2743
|
+
"indentWithTab",
|
|
2744
|
+
"editable",
|
|
2745
|
+
"readOnly",
|
|
2746
|
+
"root",
|
|
2747
|
+
"initialState"
|
|
2748
|
+
], ReactCodeMirror = /* @__PURE__ */ (0, import_react.forwardRef)((e6, x) => {
|
|
2749
|
+
var { className: S, value: C = "", selection: w, extensions: T = [], onChange: E, onStatistics: D, onCreateEditor: O, onUpdate: k, autoFocus: A, theme: j = "light", height: M, minHeight: N, maxHeight: P, width: F, minWidth: I, maxWidth: L, basicSetup: R, placeholder: z, indentWithTab: B, editable: V, readOnly: H, root: U, initialState: W } = e6, G = _objectWithoutPropertiesLoose(e6, _excluded), K = (0, import_react.useRef)(null), { state: q, view: J, container: Y, setContainer: X } = useCodeMirror({
|
|
2750
|
+
root: U,
|
|
2751
|
+
value: C,
|
|
2752
|
+
autoFocus: A,
|
|
2753
|
+
theme: j,
|
|
2754
|
+
height: M,
|
|
2755
|
+
minHeight: N,
|
|
2756
|
+
maxHeight: P,
|
|
2757
|
+
width: F,
|
|
2758
|
+
minWidth: I,
|
|
2759
|
+
maxWidth: L,
|
|
2760
|
+
basicSetup: R,
|
|
2761
|
+
placeholder: z,
|
|
2762
|
+
indentWithTab: B,
|
|
2763
|
+
editable: V,
|
|
2764
|
+
readOnly: H,
|
|
2765
|
+
selection: w,
|
|
2766
|
+
onChange: E,
|
|
2767
|
+
onStatistics: D,
|
|
2768
|
+
onCreateEditor: O,
|
|
2769
|
+
onUpdate: k,
|
|
2770
|
+
extensions: T,
|
|
2771
|
+
initialState: W
|
|
2772
|
+
});
|
|
2773
|
+
(0, import_react.useImperativeHandle)(x, () => ({
|
|
2774
|
+
editor: K.current,
|
|
2775
|
+
state: q,
|
|
2776
|
+
view: J
|
|
2777
|
+
}), [
|
|
2778
|
+
K,
|
|
2779
|
+
Y,
|
|
2780
|
+
q,
|
|
2781
|
+
J
|
|
2782
|
+
]);
|
|
2783
|
+
var Z = (0, import_react.useCallback)((e7) => {
|
|
2784
|
+
K.current = e7, X(e7);
|
|
2785
|
+
}, [X]);
|
|
2786
|
+
if (typeof C != "string") throw Error("value must be typeof string but got " + typeof C);
|
|
2787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", _extends({
|
|
2788
|
+
ref: Z,
|
|
2789
|
+
className: (typeof j == "string" ? "cm-theme-" + j : "cm-theme") + (S ? " " + S : "")
|
|
2790
|
+
}, G));
|
|
2791
|
+
});
|
|
2792
|
+
ReactCodeMirror.displayName = "CodeMirror";
|
|
2793
|
+
var esm_default = ReactCodeMirror;
|
|
2794
|
+
export {
|
|
2795
|
+
linter as a,
|
|
2796
|
+
historyField as c,
|
|
2797
|
+
forEachDiagnostic as i,
|
|
2798
|
+
insertTab as l,
|
|
2799
|
+
minimalSetup as n,
|
|
2800
|
+
setDiagnostics as o,
|
|
2801
|
+
_extends as r,
|
|
2802
|
+
history as s,
|
|
2803
|
+
esm_default as t,
|
|
2804
|
+
CopyClipboardIcon as u
|
|
2805
|
+
};
|