@inkandswitch/patchwork-pkg-base 0.0.17 → 0.0.19
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/init.js +0 -1
- package/modules.json +1 -11
- package/package.json +1 -1
- package/packages/raw/raw-editor.js +2 -2
- package/packages/account-picker/dist/AccountPicker-7VBUJTTB.js +0 -8860
- package/packages/account-picker/dist/AccountPicker-7VBUJTTB.js.map +0 -7
- package/packages/account-picker/dist/AccountPicker-CN73XGEW.css +0 -371
- package/packages/account-picker/dist/AccountPicker-CN73XGEW.css.map +0 -7
- package/packages/account-picker/dist/chunk-5WRI5ZAA.js +0 -31
- package/packages/account-picker/dist/chunk-5WRI5ZAA.js.map +0 -7
- package/packages/account-picker/dist/tool.css +0 -371
- package/packages/account-picker/dist/tool.css.map +0 -7
- package/packages/account-picker/dist/tool.js +0 -19
- package/packages/account-picker/dist/tool.js.map +0 -7
- package/packages/account-picker/package.json +0 -39
- package/packages/codemirror-base/dist/chunk-KMEIRH3R.js +0 -490
- package/packages/codemirror-base/dist/chunk-KMEIRH3R.js.map +0 -7
- package/packages/codemirror-base/dist/lib/codemirror.js +0 -7
- package/packages/codemirror-base/dist/lib/codemirror.js.map +0 -7
- package/packages/codemirror-base/dist/main.js +0 -17
- package/packages/codemirror-base/dist/main.js.map +0 -7
- package/packages/codemirror-base/dist/tool.js +0 -1799
- package/packages/codemirror-base/dist/tool.js.map +0 -7
- package/packages/codemirror-base/package.json +0 -55
- package/packages/codemirror-markdown/dist/apl-QAIM2KBM.js +0 -142
- package/packages/codemirror-markdown/dist/apl-QAIM2KBM.js.map +0 -7
- package/packages/codemirror-markdown/dist/asciiarmor-G7UKQURA.js +0 -58
- package/packages/codemirror-markdown/dist/asciiarmor-G7UKQURA.js.map +0 -7
- package/packages/codemirror-markdown/dist/asn1-JTUXKWKT.js +0 -144
- package/packages/codemirror-markdown/dist/asn1-JTUXKWKT.js.map +0 -7
- package/packages/codemirror-markdown/dist/asterisk-NM6JCXOL.js +0 -351
- package/packages/codemirror-markdown/dist/asterisk-NM6JCXOL.js.map +0 -7
- package/packages/codemirror-markdown/dist/brainfuck-X7FFM55E.js +0 -55
- package/packages/codemirror-markdown/dist/brainfuck-X7FFM55E.js.map +0 -7
- package/packages/codemirror-markdown/dist/chunk-46Z6CXSY.js +0 -1062
- package/packages/codemirror-markdown/dist/chunk-46Z6CXSY.js.map +0 -7
- package/packages/codemirror-markdown/dist/chunk-6JT2ASRP.js +0 -1111
- package/packages/codemirror-markdown/dist/chunk-6JT2ASRP.js.map +0 -7
- package/packages/codemirror-markdown/dist/chunk-CSJO4DNL.js +0 -1424
- package/packages/codemirror-markdown/dist/chunk-CSJO4DNL.js.map +0 -7
- package/packages/codemirror-markdown/dist/chunk-FLC3A4DL.js +0 -133
- package/packages/codemirror-markdown/dist/chunk-FLC3A4DL.js.map +0 -7
- package/packages/codemirror-markdown/dist/chunk-M3X2FRO3.js +0 -998
- package/packages/codemirror-markdown/dist/chunk-M3X2FRO3.js.map +0 -7
- package/packages/codemirror-markdown/dist/chunk-MAW6NPUW.js +0 -4930
- package/packages/codemirror-markdown/dist/chunk-MAW6NPUW.js.map +0 -7
- package/packages/codemirror-markdown/dist/chunk-MBTMKYFQ.js +0 -1779
- package/packages/codemirror-markdown/dist/chunk-MBTMKYFQ.js.map +0 -7
- package/packages/codemirror-markdown/dist/chunk-NEI7FGV4.js +0 -697
- package/packages/codemirror-markdown/dist/chunk-NEI7FGV4.js.map +0 -7
- package/packages/codemirror-markdown/dist/chunk-PPGERYN5.js +0 -2528
- package/packages/codemirror-markdown/dist/chunk-PPGERYN5.js.map +0 -7
- package/packages/codemirror-markdown/dist/clike-DOBZTBQN.js +0 -808
- package/packages/codemirror-markdown/dist/clike-DOBZTBQN.js.map +0 -7
- package/packages/codemirror-markdown/dist/clojure-PTADSDNF.js +0 -851
- package/packages/codemirror-markdown/dist/clojure-PTADSDNF.js.map +0 -7
- package/packages/codemirror-markdown/dist/cmake-5HAC7YMH.js +0 -73
- package/packages/codemirror-markdown/dist/cmake-5HAC7YMH.js.map +0 -7
- package/packages/codemirror-markdown/dist/cobol-HAM4C42S.js +0 -131
- package/packages/codemirror-markdown/dist/cobol-HAM4C42S.js.map +0 -7
- package/packages/codemirror-markdown/dist/coffeescript-IBRKASSJ.js +0 -310
- package/packages/codemirror-markdown/dist/coffeescript-IBRKASSJ.js.map +0 -7
- package/packages/codemirror-markdown/dist/commonlisp-KMRPB5EW.js +0 -132
- package/packages/codemirror-markdown/dist/commonlisp-KMRPB5EW.js.map +0 -7
- package/packages/codemirror-markdown/dist/crystal-2MDF4EKJ.js +0 -400
- package/packages/codemirror-markdown/dist/crystal-2MDF4EKJ.js.map +0 -7
- package/packages/codemirror-markdown/dist/css-VQQXA3AY.js +0 -1795
- package/packages/codemirror-markdown/dist/css-VQQXA3AY.js.map +0 -7
- package/packages/codemirror-markdown/dist/cypher-ZZEGDGDJ.js +0 -123
- package/packages/codemirror-markdown/dist/cypher-ZZEGDGDJ.js.map +0 -7
- package/packages/codemirror-markdown/dist/d-5S6PJOOT.js +0 -187
- package/packages/codemirror-markdown/dist/d-5S6PJOOT.js.map +0 -7
- package/packages/codemirror-markdown/dist/datatype.js +0 -48
- package/packages/codemirror-markdown/dist/datatype.js.map +0 -7
- package/packages/codemirror-markdown/dist/diff-S77XBOWF.js +0 -27
- package/packages/codemirror-markdown/dist/diff-S77XBOWF.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-2C6IPJHB.js +0 -98
- package/packages/codemirror-markdown/dist/dist-2C6IPJHB.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-2H653DKD.js +0 -170
- package/packages/codemirror-markdown/dist/dist-2H653DKD.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-2O4EI6YQ.js +0 -140
- package/packages/codemirror-markdown/dist/dist-2O4EI6YQ.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-2UJRV4FH.js +0 -75
- package/packages/codemirror-markdown/dist/dist-2UJRV4FH.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-52S6W6Z3.js +0 -15
- package/packages/codemirror-markdown/dist/dist-52S6W6Z3.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-5KN6ODPO.js +0 -340
- package/packages/codemirror-markdown/dist/dist-5KN6ODPO.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-BOGB4NCA.js +0 -20
- package/packages/codemirror-markdown/dist/dist-BOGB4NCA.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-DZ4PW5HP.js +0 -318
- package/packages/codemirror-markdown/dist/dist-DZ4PW5HP.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-FDBKXKIA.js +0 -100
- package/packages/codemirror-markdown/dist/dist-FDBKXKIA.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-G2KVVLNT.js +0 -381
- package/packages/codemirror-markdown/dist/dist-G2KVVLNT.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-HHNZE2GE.js +0 -193
- package/packages/codemirror-markdown/dist/dist-HHNZE2GE.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-HNH74YPL.js +0 -32
- package/packages/codemirror-markdown/dist/dist-HNH74YPL.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-LBQUKRIG.js +0 -27
- package/packages/codemirror-markdown/dist/dist-LBQUKRIG.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-MFKCWPLQ.js +0 -416
- package/packages/codemirror-markdown/dist/dist-MFKCWPLQ.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-NISFJM3T.js +0 -423
- package/packages/codemirror-markdown/dist/dist-NISFJM3T.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-Q7P6VH6H.js +0 -786
- package/packages/codemirror-markdown/dist/dist-Q7P6VH6H.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-RWF5A5GN.js +0 -451
- package/packages/codemirror-markdown/dist/dist-RWF5A5GN.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-UHUU7KLC.js +0 -748
- package/packages/codemirror-markdown/dist/dist-UHUU7KLC.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-WJMBFK7W.js +0 -360
- package/packages/codemirror-markdown/dist/dist-WJMBFK7W.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-XJYSXJ7H.js +0 -115
- package/packages/codemirror-markdown/dist/dist-XJYSXJ7H.js.map +0 -7
- package/packages/codemirror-markdown/dist/dist-YY24ZXZD.js +0 -212
- package/packages/codemirror-markdown/dist/dist-YY24ZXZD.js.map +0 -7
- package/packages/codemirror-markdown/dist/dockerfile-JECCOJWP.js +0 -209
- package/packages/codemirror-markdown/dist/dockerfile-JECCOJWP.js.map +0 -7
- package/packages/codemirror-markdown/dist/dtd-MNDWTW4Z.js +0 -116
- package/packages/codemirror-markdown/dist/dtd-MNDWTW4Z.js.map +0 -7
- package/packages/codemirror-markdown/dist/dylan-VQ4IHJDS.js +0 -317
- package/packages/codemirror-markdown/dist/dylan-VQ4IHJDS.js.map +0 -7
- package/packages/codemirror-markdown/dist/ebnf-IDZBFTCG.js +0 -142
- package/packages/codemirror-markdown/dist/ebnf-IDZBFTCG.js.map +0 -7
- package/packages/codemirror-markdown/dist/ecl-X3ROY7E6.js +0 -180
- package/packages/codemirror-markdown/dist/ecl-X3ROY7E6.js.map +0 -7
- package/packages/codemirror-markdown/dist/eiffel-WB3M7Y2E.js +0 -136
- package/packages/codemirror-markdown/dist/eiffel-WB3M7Y2E.js.map +0 -7
- package/packages/codemirror-markdown/dist/elm-VHXR6ZA3.js +0 -178
- package/packages/codemirror-markdown/dist/elm-VHXR6ZA3.js.map +0 -7
- package/packages/codemirror-markdown/dist/erlang-7ZBDDQDV.js +0 -676
- package/packages/codemirror-markdown/dist/erlang-7ZBDDQDV.js.map +0 -7
- package/packages/codemirror-markdown/dist/extensions/embed.js +0 -325
- package/packages/codemirror-markdown/dist/extensions/embed.js.map +0 -7
- package/packages/codemirror-markdown/dist/extensions/links.js +0 -118
- package/packages/codemirror-markdown/dist/extensions/links.js.map +0 -7
- package/packages/codemirror-markdown/dist/extensions/markdown.js +0 -3476
- package/packages/codemirror-markdown/dist/extensions/markdown.js.map +0 -7
- package/packages/codemirror-markdown/dist/factor-IKT2GQE2.js +0 -70
- package/packages/codemirror-markdown/dist/factor-IKT2GQE2.js.map +0 -7
- package/packages/codemirror-markdown/dist/fcl-CNBUVGUC.js +0 -143
- package/packages/codemirror-markdown/dist/fcl-CNBUVGUC.js.map +0 -7
- package/packages/codemirror-markdown/dist/forth-4BTPWSFZ.js +0 -118
- package/packages/codemirror-markdown/dist/forth-4BTPWSFZ.js.map +0 -7
- package/packages/codemirror-markdown/dist/fortran-V6F5DQPK.js +0 -469
- package/packages/codemirror-markdown/dist/fortran-V6F5DQPK.js.map +0 -7
- package/packages/codemirror-markdown/dist/gas-4DLP6BC4.js +0 -296
- package/packages/codemirror-markdown/dist/gas-4DLP6BC4.js.map +0 -7
- package/packages/codemirror-markdown/dist/gherkin-OSGPX6HI.js +0 -117
- package/packages/codemirror-markdown/dist/gherkin-OSGPX6HI.js.map +0 -7
- package/packages/codemirror-markdown/dist/groovy-R2JW63QF.js +0 -225
- package/packages/codemirror-markdown/dist/groovy-R2JW63QF.js.map +0 -7
- package/packages/codemirror-markdown/dist/haskell-GG7T4J6H.js +0 -461
- package/packages/codemirror-markdown/dist/haskell-GG7T4J6H.js.map +0 -7
- package/packages/codemirror-markdown/dist/haxe-ESFUJKSE.js +0 -521
- package/packages/codemirror-markdown/dist/haxe-ESFUJKSE.js.map +0 -7
- package/packages/codemirror-markdown/dist/http-SZLSACOW.js +0 -81
- package/packages/codemirror-markdown/dist/http-SZLSACOW.js.map +0 -7
- package/packages/codemirror-markdown/dist/idl-V7UH35RP.js +0 -987
- package/packages/codemirror-markdown/dist/idl-V7UH35RP.js.map +0 -7
- package/packages/codemirror-markdown/dist/javascript-MGRPKFDN.js +0 -13
- package/packages/codemirror-markdown/dist/javascript-MGRPKFDN.js.map +0 -7
- package/packages/codemirror-markdown/dist/julia-CWCVZVPG.js +0 -409
- package/packages/codemirror-markdown/dist/julia-CWCVZVPG.js.map +0 -7
- package/packages/codemirror-markdown/dist/livescript-IGKT2FL7.js +0 -303
- package/packages/codemirror-markdown/dist/livescript-IGKT2FL7.js.map +0 -7
- package/packages/codemirror-markdown/dist/lua-GHK7GCTS.js +0 -258
- package/packages/codemirror-markdown/dist/lua-GHK7GCTS.js.map +0 -7
- package/packages/codemirror-markdown/dist/main.js +0 -58
- package/packages/codemirror-markdown/dist/main.js.map +0 -7
- package/packages/codemirror-markdown/dist/mathematica-W5LMQI3M.js +0 -112
- package/packages/codemirror-markdown/dist/mathematica-W5LMQI3M.js.map +0 -7
- package/packages/codemirror-markdown/dist/mbox-A7CXJ4HZ.js +0 -119
- package/packages/codemirror-markdown/dist/mbox-A7CXJ4HZ.js.map +0 -7
- package/packages/codemirror-markdown/dist/mirc-WYJEQUBY.js +0 -109
- package/packages/codemirror-markdown/dist/mirc-WYJEQUBY.js.map +0 -7
- package/packages/codemirror-markdown/dist/mllike-C2YS6SJI.js +0 -340
- package/packages/codemirror-markdown/dist/mllike-C2YS6SJI.js.map +0 -7
- package/packages/codemirror-markdown/dist/modelica-BMJSLZS7.js +0 -149
- package/packages/codemirror-markdown/dist/modelica-BMJSLZS7.js.map +0 -7
- package/packages/codemirror-markdown/dist/mscgen-5BORDYHW.js +0 -137
- package/packages/codemirror-markdown/dist/mscgen-5BORDYHW.js.map +0 -7
- package/packages/codemirror-markdown/dist/mumps-BYE6H7ZX.js +0 -95
- package/packages/codemirror-markdown/dist/mumps-BYE6H7ZX.js.map +0 -7
- package/packages/codemirror-markdown/dist/nginx-Y54HR7MQ.js +0 -143
- package/packages/codemirror-markdown/dist/nginx-Y54HR7MQ.js.map +0 -7
- package/packages/codemirror-markdown/dist/nsis-UZLPE2DL.js +0 -67
- package/packages/codemirror-markdown/dist/nsis-UZLPE2DL.js.map +0 -7
- package/packages/codemirror-markdown/dist/ntriples-SAI3J2VH.js +0 -155
- package/packages/codemirror-markdown/dist/ntriples-SAI3J2VH.js.map +0 -7
- package/packages/codemirror-markdown/dist/octave-TLUBYOUX.js +0 -213
- package/packages/codemirror-markdown/dist/octave-TLUBYOUX.js.map +0 -7
- package/packages/codemirror-markdown/dist/oz-F6LNIR6Q.js +0 -233
- package/packages/codemirror-markdown/dist/oz-F6LNIR6Q.js.map +0 -7
- package/packages/codemirror-markdown/dist/pascal-WINE2FE6.js +0 -107
- package/packages/codemirror-markdown/dist/pascal-WINE2FE6.js.map +0 -7
- package/packages/codemirror-markdown/dist/perl-NZG3EIBE.js +0 -1107
- package/packages/codemirror-markdown/dist/perl-NZG3EIBE.js.map +0 -7
- package/packages/codemirror-markdown/dist/pig-U7OFLRCV.js +0 -105
- package/packages/codemirror-markdown/dist/pig-U7OFLRCV.js.map +0 -7
- package/packages/codemirror-markdown/dist/powershell-ZSUS7P6D.js +0 -330
- package/packages/codemirror-markdown/dist/powershell-ZSUS7P6D.js.map +0 -7
- package/packages/codemirror-markdown/dist/properties-IJRU6UJW.js +0 -60
- package/packages/codemirror-markdown/dist/properties-IJRU6UJW.js.map +0 -7
- package/packages/codemirror-markdown/dist/protobuf-2KETQIQ5.js +0 -80
- package/packages/codemirror-markdown/dist/protobuf-2KETQIQ5.js.map +0 -7
- package/packages/codemirror-markdown/dist/pug-IQCJJAZU.js +0 -410
- package/packages/codemirror-markdown/dist/pug-IQCJJAZU.js.map +0 -7
- package/packages/codemirror-markdown/dist/puppet-YIIDDH6A.js +0 -139
- package/packages/codemirror-markdown/dist/puppet-YIIDDH6A.js.map +0 -7
- package/packages/codemirror-markdown/dist/python-A6P3XTMX.js +0 -429
- package/packages/codemirror-markdown/dist/python-A6P3XTMX.js.map +0 -7
- package/packages/codemirror-markdown/dist/q-2KXN5RX7.js +0 -135
- package/packages/codemirror-markdown/dist/q-2KXN5RX7.js.map +0 -7
- package/packages/codemirror-markdown/dist/r-BB4MIIBH.js +0 -174
- package/packages/codemirror-markdown/dist/r-BB4MIIBH.js.map +0 -7
- package/packages/codemirror-markdown/dist/rpm-LMR25AQ3.js +0 -111
- package/packages/codemirror-markdown/dist/rpm-LMR25AQ3.js.map +0 -7
- package/packages/codemirror-markdown/dist/ruby-TSD6FT73.js +0 -333
- package/packages/codemirror-markdown/dist/ruby-TSD6FT73.js.map +0 -7
- package/packages/codemirror-markdown/dist/sas-6X4WWIGV.js +0 -209
- package/packages/codemirror-markdown/dist/sas-6X4WWIGV.js.map +0 -7
- package/packages/codemirror-markdown/dist/scheme-E3I46HBL.js +0 -230
- package/packages/codemirror-markdown/dist/scheme-E3I46HBL.js.map +0 -7
- package/packages/codemirror-markdown/dist/shell-GX3PRI4I.js +0 -224
- package/packages/codemirror-markdown/dist/shell-GX3PRI4I.js.map +0 -7
- package/packages/codemirror-markdown/dist/sieve-V65ZPL4F.js +0 -137
- package/packages/codemirror-markdown/dist/sieve-V65ZPL4F.js.map +0 -7
- package/packages/codemirror-markdown/dist/smalltalk-OVKP2CVW.js +0 -123
- package/packages/codemirror-markdown/dist/smalltalk-OVKP2CVW.js.map +0 -7
- package/packages/codemirror-markdown/dist/solr-C4DLQJCF.js +0 -71
- package/packages/codemirror-markdown/dist/solr-C4DLQJCF.js.map +0 -7
- package/packages/codemirror-markdown/dist/sparql-REKUW7B3.js +0 -251
- package/packages/codemirror-markdown/dist/sparql-REKUW7B3.js.map +0 -7
- package/packages/codemirror-markdown/dist/spreadsheet-S7NN2YTQ.js +0 -89
- package/packages/codemirror-markdown/dist/spreadsheet-S7NN2YTQ.js.map +0 -7
- package/packages/codemirror-markdown/dist/sql-ML2Q43YF.js +0 -358
- package/packages/codemirror-markdown/dist/sql-ML2Q43YF.js.map +0 -7
- package/packages/codemirror-markdown/dist/stex-TCOGKBT4.js +0 -233
- package/packages/codemirror-markdown/dist/stex-TCOGKBT4.js.map +0 -7
- package/packages/codemirror-markdown/dist/stylus-3ONNYZOM.js +0 -591
- package/packages/codemirror-markdown/dist/stylus-3ONNYZOM.js.map +0 -7
- package/packages/codemirror-markdown/dist/swift-CNWGZ22Y.js +0 -293
- package/packages/codemirror-markdown/dist/swift-CNWGZ22Y.js.map +0 -7
- package/packages/codemirror-markdown/dist/tcl-77IMAZYE.js +0 -116
- package/packages/codemirror-markdown/dist/tcl-77IMAZYE.js.map +0 -7
- package/packages/codemirror-markdown/dist/textile-6IWIIKFM.js +0 -416
- package/packages/codemirror-markdown/dist/textile-6IWIIKFM.js.map +0 -7
- package/packages/codemirror-markdown/dist/tiddlywiki-IJSZMUSA.js +0 -231
- package/packages/codemirror-markdown/dist/tiddlywiki-IJSZMUSA.js.map +0 -7
- package/packages/codemirror-markdown/dist/tiki-HG37JJIT.js +0 -276
- package/packages/codemirror-markdown/dist/tiki-HG37JJIT.js.map +0 -7
- package/packages/codemirror-markdown/dist/toml-NINU2IMM.js +0 -78
- package/packages/codemirror-markdown/dist/toml-NINU2IMM.js.map +0 -7
- package/packages/codemirror-markdown/dist/troff-AOQJ4Q4C.js +0 -63
- package/packages/codemirror-markdown/dist/troff-AOQJ4Q4C.js.map +0 -7
- package/packages/codemirror-markdown/dist/ttcn-TLOZ3FX3.js +0 -211
- package/packages/codemirror-markdown/dist/ttcn-TLOZ3FX3.js.map +0 -7
- package/packages/codemirror-markdown/dist/ttcn-cfg-3B6QY7QE.js +0 -141
- package/packages/codemirror-markdown/dist/ttcn-cfg-3B6QY7QE.js.map +0 -7
- package/packages/codemirror-markdown/dist/turtle-3N5KCGXP.js +0 -132
- package/packages/codemirror-markdown/dist/turtle-3N5KCGXP.js.map +0 -7
- package/packages/codemirror-markdown/dist/vb-I7M5DRLP.js +0 -204
- package/packages/codemirror-markdown/dist/vb-I7M5DRLP.js.map +0 -7
- package/packages/codemirror-markdown/dist/vbscript-U2ARSJLD.js +0 -482
- package/packages/codemirror-markdown/dist/vbscript-U2ARSJLD.js.map +0 -7
- package/packages/codemirror-markdown/dist/velocity-R3AYP5XJ.js +0 -151
- package/packages/codemirror-markdown/dist/velocity-R3AYP5XJ.js.map +0 -7
- package/packages/codemirror-markdown/dist/verilog-7VEWVDW6.js +0 -456
- package/packages/codemirror-markdown/dist/verilog-7VEWVDW6.js.map +0 -7
- package/packages/codemirror-markdown/dist/vhdl-JZUPPGBA.js +0 -162
- package/packages/codemirror-markdown/dist/vhdl-JZUPPGBA.js.map +0 -7
- package/packages/codemirror-markdown/dist/webidl-SLQFEELK.js +0 -206
- package/packages/codemirror-markdown/dist/webidl-SLQFEELK.js.map +0 -7
- package/packages/codemirror-markdown/dist/xquery-VXP5KJ6N.js +0 -532
- package/packages/codemirror-markdown/dist/xquery-VXP5KJ6N.js.map +0 -7
- package/packages/codemirror-markdown/dist/yacas-JRBC4BEV.js +0 -132
- package/packages/codemirror-markdown/dist/yacas-JRBC4BEV.js.map +0 -7
- package/packages/codemirror-markdown/dist/z80-AJF6WLUV.js +0 -95
- package/packages/codemirror-markdown/dist/z80-AJF6WLUV.js.map +0 -7
- package/packages/codemirror-markdown/example.js +0 -46
- package/packages/codemirror-markdown/package.json +0 -62
- package/packages/commands/dist/main.js +0 -504
- package/packages/commands/dist/main.js.map +0 -7
- package/packages/commands/package.json +0 -28
- package/packages/contact/dist/ContactAvatar-FP32ZZH2.js +0 -161
- package/packages/contact/dist/ContactAvatar-FP32ZZH2.js.map +0 -7
- package/packages/contact/dist/ContactViewer-ZHEE6INW.js +0 -60
- package/packages/contact/dist/ContactViewer-ZHEE6INW.js.map +0 -7
- package/packages/contact/dist/InlineContactAvatar-VZDPEZV2.js +0 -46
- package/packages/contact/dist/InlineContactAvatar-VZDPEZV2.js.map +0 -7
- package/packages/contact/dist/chunk-MOZI4Y4O.js +0 -54
- package/packages/contact/dist/chunk-MOZI4Y4O.js.map +0 -7
- package/packages/contact/dist/datatype-ABVDVPWS.js +0 -27
- package/packages/contact/dist/datatype-ABVDVPWS.js.map +0 -7
- package/packages/contact/dist/tool.css +0 -81
- package/packages/contact/dist/tool.css.map +0 -7
- package/packages/contact/dist/tool.js +0 -70
- package/packages/contact/dist/tool.js.map +0 -7
- package/packages/contact/package.json +0 -46
- package/packages/folder/dist/datatype-HWGUFBTQ.js +0 -27
- package/packages/folder/dist/datatype-HWGUFBTQ.js.map +0 -7
- package/packages/folder/dist/index.js +0 -27
- package/packages/folder/dist/index.js.map +0 -7
- package/packages/folder/dist/tool-62JZAZRP.js +0 -366
- package/packages/folder/dist/tool-62JZAZRP.js.map +0 -7
- package/packages/folder/package.json +0 -32
- package/packages/sideboard/dist/account-bar-OJQC3J6W.js +0 -2
- package/packages/sideboard/dist/account-bar-OJQC3J6W.js.map +0 -7
- package/packages/sideboard/dist/chunk-32FICX7K.js +0 -26
- package/packages/sideboard/dist/chunk-32FICX7K.js.map +0 -7
- package/packages/sideboard/dist/chunk-3OYP6TVA.js +0 -2
- package/packages/sideboard/dist/chunk-3OYP6TVA.js.map +0 -7
- package/packages/sideboard/dist/chunk-FW4363Y4.js +0 -2
- package/packages/sideboard/dist/chunk-FW4363Y4.js.map +0 -7
- package/packages/sideboard/dist/chunk-QKYKEZU4.js +0 -2
- package/packages/sideboard/dist/chunk-QKYKEZU4.js.map +0 -7
- package/packages/sideboard/dist/document-list-panel-42LSXXCO.js +0 -2
- package/packages/sideboard/dist/document-list-panel-42LSXXCO.js.map +0 -7
- package/packages/sideboard/dist/index.css +0 -2
- package/packages/sideboard/dist/index.css.map +0 -7
- package/packages/sideboard/dist/index.js +0 -2
- package/packages/sideboard/dist/index.js.map +0 -7
- package/packages/sideboard/dist/sideboard/sideboard.js +0 -2
- package/packages/sideboard/dist/sideboard/sideboard.js.map +0 -7
- package/packages/sideboard/package.json +0 -56
- package/packages/theming/dist/active-theme-K27UXDBG.js +0 -26
- package/packages/theming/dist/active-theme-K27UXDBG.js.map +0 -7
- package/packages/theming/dist/chunk-K4OOO2TK.js +0 -281
- package/packages/theming/dist/chunk-K4OOO2TK.js.map +0 -7
- package/packages/theming/dist/chunk-RATW7VZI.js +0 -11
- package/packages/theming/dist/chunk-RATW7VZI.js.map +0 -7
- package/packages/theming/dist/chunk-U7SC4JPE.js +0 -86
- package/packages/theming/dist/chunk-U7SC4JPE.js.map +0 -7
- package/packages/theming/dist/codemirror-theme.js +0 -2415
- package/packages/theming/dist/codemirror-theme.js.map +0 -7
- package/packages/theming/dist/datatype-UUJVIZM7.js +0 -16
- package/packages/theming/dist/datatype-UUJVIZM7.js.map +0 -7
- package/packages/theming/dist/gloom-JYQPEOHI.css +0 -102
- package/packages/theming/dist/lychee-BMLMUNP6.css +0 -114
- package/packages/theming/dist/main.js +0 -112
- package/packages/theming/dist/main.js.map +0 -7
- package/packages/theming/dist/theme-RC7MV6WP.css +0 -691
- package/packages/theming/dist/theme-editor-datatype-CIXRKEFF.js +0 -11
- package/packages/theming/dist/theme-editor-datatype-CIXRKEFF.js.map +0 -7
- package/packages/theming/dist/theme-editor.js +0 -576
- package/packages/theming/dist/theme-editor.js.map +0 -7
- package/packages/theming/dist/theme-titlebar-P2CODQGF.js +0 -21
- package/packages/theming/dist/theme-titlebar-P2CODQGF.js.map +0 -7
- package/packages/theming/dist/theme-tray-5L2KGCGD.js +0 -351
- package/packages/theming/dist/theme-tray-5L2KGCGD.js.map +0 -7
- package/packages/theming/dist/tool.js +0 -405
- package/packages/theming/dist/tool.js.map +0 -7
- package/packages/theming/package.json +0 -48
- package/packages/threepane/dist/IsolatedDocumentArea-LFSDWMIY.js +0 -2
- package/packages/threepane/dist/IsolatedDocumentArea-LFSDWMIY.js.map +0 -7
- package/packages/threepane/dist/PatchworkFrame-JTNZ6365.js +0 -2
- package/packages/threepane/dist/PatchworkFrame-JTNZ6365.js.map +0 -7
- package/packages/threepane/dist/chunk-7YXO2YGV.js +0 -2
- package/packages/threepane/dist/chunk-7YXO2YGV.js.map +0 -7
- package/packages/threepane/dist/chunk-FOMAU6H2.js +0 -972
- package/packages/threepane/dist/chunk-FOMAU6H2.js.map +0 -7
- package/packages/threepane/dist/chunk-FW4363Y4.js +0 -2
- package/packages/threepane/dist/chunk-FW4363Y4.js.map +0 -7
- package/packages/threepane/dist/datatypes-FKBTWAO7.js +0 -2
- package/packages/threepane/dist/datatypes-FKBTWAO7.js.map +0 -7
- package/packages/threepane/dist/index.js +0 -2
- package/packages/threepane/dist/index.js.map +0 -7
- package/packages/threepane/package.json +0 -42
- package/packages/tldraw4/dist/chunk-IKZWERSR.js +0 -38
- package/packages/tldraw4/dist/chunk-IKZWERSR.js.map +0 -7
- package/packages/tldraw4/dist/chunk-VF5CY24G.js +0 -140894
- package/packages/tldraw4/dist/chunk-VF5CY24G.js.map +0 -7
- package/packages/tldraw4/dist/datatype.js +0 -46
- package/packages/tldraw4/dist/datatype.js.map +0 -7
- package/packages/tldraw4/dist/main.css +0 -3202
- package/packages/tldraw4/dist/main.css.map +0 -7
- package/packages/tldraw4/dist/main.js +0 -42
- package/packages/tldraw4/dist/main.js.map +0 -7
- package/packages/tldraw4/dist/tool.js +0 -8767
- package/packages/tldraw4/dist/tool.js.map +0 -7
- package/packages/tldraw4/package.json +0 -62
|
@@ -1,1799 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CodeMirror
|
|
3
|
-
} from "./chunk-KMEIRH3R.js";
|
|
4
|
-
|
|
5
|
-
// src/tool.tsx
|
|
6
|
-
import { template as _$template } from "solid-js/web";
|
|
7
|
-
import { insert as _$insert } from "solid-js/web";
|
|
8
|
-
import { createComponent as _$createComponent } from "solid-js/web";
|
|
9
|
-
import { render } from "solid-js/web";
|
|
10
|
-
import { RangeSet } from "@codemirror/state";
|
|
11
|
-
import { Decoration } from "@codemirror/view";
|
|
12
|
-
|
|
13
|
-
// src/lib/extensions/commentUI.ts
|
|
14
|
-
import {
|
|
15
|
-
StateEffect,
|
|
16
|
-
StateField
|
|
17
|
-
} from "@codemirror/state";
|
|
18
|
-
import {
|
|
19
|
-
EditorView,
|
|
20
|
-
showTooltip
|
|
21
|
-
} from "@codemirror/view";
|
|
22
|
-
|
|
23
|
-
// src/lib/extensions/comments.ts
|
|
24
|
-
import {
|
|
25
|
-
cursor
|
|
26
|
-
} from "@automerge/automerge-repo";
|
|
27
|
-
var COMMENT_THREAD_TYPE = "comment-thread";
|
|
28
|
-
function createCommentForRange(handle, path, from, to, contactUrl) {
|
|
29
|
-
const targetUrl = handle.sub(...path, cursor(from, to)).url;
|
|
30
|
-
const threadId = crypto.randomUUID();
|
|
31
|
-
const commentId = crypto.randomUUID();
|
|
32
|
-
handle.change((doc) => {
|
|
33
|
-
doc["@comments"] ??= { threads: [] };
|
|
34
|
-
doc["@comments"].threads.push({
|
|
35
|
-
id: threadId,
|
|
36
|
-
refs: [targetUrl],
|
|
37
|
-
isResolved: false,
|
|
38
|
-
comments: [
|
|
39
|
-
{
|
|
40
|
-
id: commentId,
|
|
41
|
-
contactUrl,
|
|
42
|
-
timestamp: Date.now()
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"@patchwork": { type: COMMENT_THREAD_TYPE }
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
return handle.sub("@comments", "threads", { id: threadId }).url;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// src/lib/extensions/commentUI.ts
|
|
52
|
-
var openPopover = StateEffect.define();
|
|
53
|
-
var closePopover = StateEffect.define();
|
|
54
|
-
var dismissButton = StateEffect.define();
|
|
55
|
-
var POPOVER_CLASS = "cm-comment-popover";
|
|
56
|
-
var buildCommentButton = (from, to, head, view, options) => {
|
|
57
|
-
const button = document.createElement("button");
|
|
58
|
-
button.className = "cm-comment-button";
|
|
59
|
-
button.setAttribute("aria-label", "Comment");
|
|
60
|
-
button.innerHTML = `
|
|
61
|
-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none"
|
|
62
|
-
xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
63
|
-
<path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"
|
|
64
|
-
fill="currentColor" stroke="none"/>
|
|
65
|
-
</svg>
|
|
66
|
-
<span>Comment</span>
|
|
67
|
-
`;
|
|
68
|
-
button.addEventListener("mousedown", (e) => {
|
|
69
|
-
e.preventDefault();
|
|
70
|
-
e.stopPropagation();
|
|
71
|
-
});
|
|
72
|
-
button.addEventListener("click", (e) => {
|
|
73
|
-
e.preventDefault();
|
|
74
|
-
e.stopPropagation();
|
|
75
|
-
const threadUrl = options.createThreadForRange(from, to);
|
|
76
|
-
if (!threadUrl) return;
|
|
77
|
-
view.dispatch({ effects: openPopover.of({ threadUrl, anchor: head }) });
|
|
78
|
-
});
|
|
79
|
-
return button;
|
|
80
|
-
};
|
|
81
|
-
var buildThreadPopover = (view, state, options, ui) => {
|
|
82
|
-
const dom = document.createElement("div");
|
|
83
|
-
dom.className = POPOVER_CLASS;
|
|
84
|
-
const threadView = document.createElement("patchwork-view");
|
|
85
|
-
threadView.setAttribute("doc-url", state.threadUrl);
|
|
86
|
-
threadView.setAttribute("tool-id", COMMENT_THREAD_TYPE);
|
|
87
|
-
dom.append(threadView);
|
|
88
|
-
const close = () => view.dispatch({ effects: closePopover.of(null) });
|
|
89
|
-
const onOutsideMouseDown = (event) => {
|
|
90
|
-
if (!dom.contains(event.target)) close();
|
|
91
|
-
};
|
|
92
|
-
const onKeyDown = (event) => {
|
|
93
|
-
if (event.key === "Escape") close();
|
|
94
|
-
};
|
|
95
|
-
const doc = view.win.document;
|
|
96
|
-
const armTimer = view.win.setTimeout(() => {
|
|
97
|
-
doc.addEventListener("mousedown", onOutsideMouseDown, true);
|
|
98
|
-
doc.addEventListener("keydown", onKeyDown, true);
|
|
99
|
-
}, 0);
|
|
100
|
-
const stopWatch = options.watchThreadForClose(state.threadUrl, close);
|
|
101
|
-
return {
|
|
102
|
-
dom,
|
|
103
|
-
destroy() {
|
|
104
|
-
view.win.clearTimeout(armTimer);
|
|
105
|
-
doc.removeEventListener("mousedown", onOutsideMouseDown, true);
|
|
106
|
-
doc.removeEventListener("keydown", onKeyDown, true);
|
|
107
|
-
stopWatch();
|
|
108
|
-
ui.suppressed = state.threadUrl;
|
|
109
|
-
options.onClose(state.threadUrl);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
var buttonTooltip = (state, options) => {
|
|
114
|
-
const sel = state.selection.main;
|
|
115
|
-
if (sel.empty) return null;
|
|
116
|
-
return {
|
|
117
|
-
pos: sel.head,
|
|
118
|
-
above: true,
|
|
119
|
-
strictSide: false,
|
|
120
|
-
arrow: false,
|
|
121
|
-
create: (view) => ({
|
|
122
|
-
dom: buildCommentButton(sel.from, sel.to, sel.head, view, options)
|
|
123
|
-
})
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
var popoverTooltip = (state, options, ui) => ({
|
|
127
|
-
pos: state.anchor,
|
|
128
|
-
above: false,
|
|
129
|
-
// comes out underneath the anchor
|
|
130
|
-
strictSide: false,
|
|
131
|
-
arrow: false,
|
|
132
|
-
create: (view) => buildThreadPopover(view, state, options, ui)
|
|
133
|
-
});
|
|
134
|
-
var commentUIField = (options, ui) => StateField.define({
|
|
135
|
-
create: (state) => ({
|
|
136
|
-
popover: null,
|
|
137
|
-
buttonDismissed: false,
|
|
138
|
-
tooltip: buttonTooltip(state, options)
|
|
139
|
-
}),
|
|
140
|
-
update(value, tr) {
|
|
141
|
-
let popover = value.popover;
|
|
142
|
-
let buttonDismissed = value.buttonDismissed;
|
|
143
|
-
let popoverChanged = false;
|
|
144
|
-
if (popover && tr.docChanged) {
|
|
145
|
-
popover = { ...popover, anchor: tr.changes.mapPos(popover.anchor) };
|
|
146
|
-
popoverChanged = true;
|
|
147
|
-
}
|
|
148
|
-
for (const effect of tr.effects) {
|
|
149
|
-
if (effect.is(openPopover)) {
|
|
150
|
-
popover = effect.value;
|
|
151
|
-
popoverChanged = true;
|
|
152
|
-
} else if (effect.is(closePopover)) {
|
|
153
|
-
popover = null;
|
|
154
|
-
popoverChanged = true;
|
|
155
|
-
buttonDismissed = true;
|
|
156
|
-
} else if (effect.is(dismissButton)) {
|
|
157
|
-
buttonDismissed = true;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (tr.selection) buttonDismissed = false;
|
|
161
|
-
if (popover) {
|
|
162
|
-
if (!popoverChanged) {
|
|
163
|
-
return buttonDismissed === value.buttonDismissed ? value : { ...value, buttonDismissed };
|
|
164
|
-
}
|
|
165
|
-
return {
|
|
166
|
-
popover,
|
|
167
|
-
buttonDismissed,
|
|
168
|
-
tooltip: popoverTooltip(popover, options, ui)
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
if (!popoverChanged && !tr.docChanged && !tr.selection && buttonDismissed === value.buttonDismissed) {
|
|
172
|
-
return value;
|
|
173
|
-
}
|
|
174
|
-
return {
|
|
175
|
-
popover: null,
|
|
176
|
-
buttonDismissed,
|
|
177
|
-
tooltip: buttonDismissed ? null : buttonTooltip(tr.state, options)
|
|
178
|
-
};
|
|
179
|
-
},
|
|
180
|
-
provide: (field) => showTooltip.from(field, (value) => value.tooltip)
|
|
181
|
-
});
|
|
182
|
-
var commentInteractions = (options, ui, field) => EditorView.domEventHandlers({
|
|
183
|
-
mousedown(event, view) {
|
|
184
|
-
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) {
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
if (event.target?.closest("." + POPOVER_CLASS)) {
|
|
188
|
-
return false;
|
|
189
|
-
}
|
|
190
|
-
const pos = view.posAtCoords({ x: event.clientX, y: event.clientY });
|
|
191
|
-
if (pos == null) return false;
|
|
192
|
-
const hit = options.threadAtPos(pos);
|
|
193
|
-
if (!hit) {
|
|
194
|
-
ui.suppressed = null;
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
if (hit.threadUrl === ui.suppressed) return false;
|
|
198
|
-
ui.suppressed = null;
|
|
199
|
-
view.dispatch({
|
|
200
|
-
effects: openPopover.of({ threadUrl: hit.threadUrl, anchor: hit.from })
|
|
201
|
-
});
|
|
202
|
-
return false;
|
|
203
|
-
},
|
|
204
|
-
keydown(event, view) {
|
|
205
|
-
if (event.key !== "Escape") return false;
|
|
206
|
-
const state = view.state.field(field, false);
|
|
207
|
-
if (!state || state.popover || !state.tooltip) return false;
|
|
208
|
-
view.dispatch({ effects: dismissButton.of(null) });
|
|
209
|
-
return true;
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
var COMMENT_BUTTON_VARS_ID = "cm-comment-button-vars";
|
|
213
|
-
var ensureCommentButtonVars = () => {
|
|
214
|
-
if (typeof document === "undefined" || document.getElementById(COMMENT_BUTTON_VARS_ID)) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
const style = document.createElement("style");
|
|
218
|
-
style.id = COMMENT_BUTTON_VARS_ID;
|
|
219
|
-
style.textContent = `
|
|
220
|
-
:root, :host, [theme] {
|
|
221
|
-
/* the button sits on the editor surface: bg is the plain editor fill,
|
|
222
|
-
text is the editor ink, and hover lifts a gentle one step up the fill
|
|
223
|
-
ramp. see --text-editor-* in the theme. */
|
|
224
|
-
--cm-comment-button-fg: var(--text-editor-line, #0a2b23);
|
|
225
|
-
--cm-comment-button-bg: var(--text-editor-fill, #35f7ca);
|
|
226
|
-
--cm-comment-button-bg-hover: var(--text-editor-fill-offset-10, #2ce0b6);
|
|
227
|
-
}
|
|
228
|
-
`;
|
|
229
|
-
document.head.append(style);
|
|
230
|
-
};
|
|
231
|
-
var commentUITheme = EditorView.baseTheme({
|
|
232
|
-
".cm-tooltip:has(.cm-comment-button)": {
|
|
233
|
-
border: "none",
|
|
234
|
-
background: "transparent",
|
|
235
|
-
boxShadow: "none"
|
|
236
|
-
},
|
|
237
|
-
".cm-comment-button": {
|
|
238
|
-
display: "inline-flex",
|
|
239
|
-
alignItems: "center",
|
|
240
|
-
gap: "5px",
|
|
241
|
-
padding: "4px 9px",
|
|
242
|
-
font: "inherit",
|
|
243
|
-
fontSize: "12px",
|
|
244
|
-
fontWeight: "500",
|
|
245
|
-
lineHeight: "1",
|
|
246
|
-
color: "var(--cm-comment-button-fg)",
|
|
247
|
-
background: "var(--cm-comment-button-bg)",
|
|
248
|
-
border: "none",
|
|
249
|
-
borderRadius: "6px",
|
|
250
|
-
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.25)",
|
|
251
|
-
cursor: "pointer",
|
|
252
|
-
userSelect: "none",
|
|
253
|
-
whiteSpace: "nowrap",
|
|
254
|
-
transition: "background-color 0.15s"
|
|
255
|
-
},
|
|
256
|
-
".cm-comment-button:hover": {
|
|
257
|
-
background: "var(--cm-comment-button-bg-hover)"
|
|
258
|
-
},
|
|
259
|
-
".cm-comment-button svg": {
|
|
260
|
-
display: "block"
|
|
261
|
-
},
|
|
262
|
-
// The thread tool carries its own card (background, border, padding), so the
|
|
263
|
-
// tooltip wrapper is just a transparent, softly-lifted host for it.
|
|
264
|
-
".cm-tooltip:has(.cm-comment-popover)": {
|
|
265
|
-
border: "none",
|
|
266
|
-
background: "transparent",
|
|
267
|
-
boxShadow: "none"
|
|
268
|
-
},
|
|
269
|
-
".cm-comment-popover": {
|
|
270
|
-
width: "min(360px, 92vw)",
|
|
271
|
-
marginTop: "6px",
|
|
272
|
-
fontFamily: "var(--editor-family)",
|
|
273
|
-
filter: "drop-shadow(0 4px 14px rgba(0, 0, 0, 0.25))"
|
|
274
|
-
},
|
|
275
|
-
// The popover supplies its own frame (the tooltip wrapper's shadow), so the
|
|
276
|
-
// thread card inside drops its own border and shadow to avoid doubling up.
|
|
277
|
-
".cm-comment-popover .comments-thread-card": {
|
|
278
|
-
border: "0",
|
|
279
|
-
boxShadow: "none"
|
|
280
|
-
},
|
|
281
|
-
// The draft textarea is width:100% with its own padding + border; without
|
|
282
|
-
// border-box it spills out of the card's right edge (the card's own reset is
|
|
283
|
-
// scoped to the sidebar panel, which the popover isn't inside).
|
|
284
|
-
".cm-comment-popover .comment-draft-textarea": {
|
|
285
|
-
boxSizing: "border-box",
|
|
286
|
-
maxWidth: "100%"
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
var commentUI = (options) => {
|
|
290
|
-
ensureCommentButtonVars();
|
|
291
|
-
const ui = { suppressed: null };
|
|
292
|
-
const field = commentUIField(options, ui);
|
|
293
|
-
return [field, commentInteractions(options, ui, field), commentUITheme];
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
// src/tool.tsx
|
|
297
|
-
import { cursor as cursor2 } from "@automerge/automerge-repo";
|
|
298
|
-
import { getRegistry } from "@inkandswitch/patchwork-plugins";
|
|
299
|
-
|
|
300
|
-
// ../node_modules/.pnpm/@inkandswitch+patchwork-providers-solid@0.2.3_@automerge+automerge-repo-solid-primitive_28dd2c0a72a3f744c852d31b58e8c7bb/node_modules/@inkandswitch/patchwork-providers-solid/dist/index.js
|
|
301
|
-
import { createSignal as createSignal2, onCleanup as onCleanup2, onMount } from "solid-js";
|
|
302
|
-
import { createStore as createStore2, reconcile as reconcile2 } from "solid-js/store";
|
|
303
|
-
|
|
304
|
-
// ../node_modules/.pnpm/@automerge+automerge-repo-solid-primitives@2.5.6_@automerge+automerge@3.3.0-fragments.1_solid-js@1.9.14/node_modules/@automerge/automerge-repo-solid-primitives/dist/index.js
|
|
305
|
-
import { onCleanup, createMemo, createContext, useContext, createResource, createEffect, createSignal } from "solid-js";
|
|
306
|
-
import { createStore, produce, reconcile } from "solid-js/store";
|
|
307
|
-
var STATE = Symbol.for("_am_meta");
|
|
308
|
-
var TRACE = Symbol.for("_am_trace");
|
|
309
|
-
var OBJECT_ID = Symbol.for("_am_objectId");
|
|
310
|
-
var IS_PROXY = Symbol.for("_am_isProxy");
|
|
311
|
-
var CLEAR_CACHE = Symbol.for("_am_clearCache");
|
|
312
|
-
var UINT = Symbol.for("_am_uint");
|
|
313
|
-
var INT = Symbol.for("_am_int");
|
|
314
|
-
var F64 = Symbol.for("_am_f64");
|
|
315
|
-
var COUNTER = Symbol.for("_am_counter");
|
|
316
|
-
var IMMUTABLE_STRING = Symbol.for("_am_immutableString");
|
|
317
|
-
var Counter = class {
|
|
318
|
-
constructor(value) {
|
|
319
|
-
this.value = value || 0;
|
|
320
|
-
Reflect.defineProperty(this, COUNTER, { value: true });
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* A peculiar JavaScript language feature from its early days: if the object
|
|
324
|
-
* `x` has a `valueOf()` method that returns a number, you can use numerical
|
|
325
|
-
* operators on the object `x` directly, such as `x + 1` or `x < 4`.
|
|
326
|
-
* This method is also called when coercing a value to a string by
|
|
327
|
-
* concatenating it with another string, as in `x + ''`.
|
|
328
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/valueOf
|
|
329
|
-
*/
|
|
330
|
-
valueOf() {
|
|
331
|
-
return this.value;
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Returns the counter value as a decimal string. If `x` is a counter object,
|
|
335
|
-
* this method is called e.g. when you do `['value: ', x].join('')` or when
|
|
336
|
-
* you use string interpolation: `value: ${x}`.
|
|
337
|
-
*/
|
|
338
|
-
toString() {
|
|
339
|
-
return this.valueOf().toString();
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Returns the counter value, so that a JSON serialization of an Automerge
|
|
343
|
-
* document represents the counter simply as an integer.
|
|
344
|
-
*/
|
|
345
|
-
toJSON() {
|
|
346
|
-
return this.value;
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Increases the value of the counter by `delta`. If `delta` is not given,
|
|
350
|
-
* increases the value of the counter by 1.
|
|
351
|
-
*
|
|
352
|
-
* Will throw an error if used outside of a change callback.
|
|
353
|
-
*/
|
|
354
|
-
increment(_delta) {
|
|
355
|
-
throw new Error("Counters should not be incremented outside of a change callback");
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Decreases the value of the counter by `delta`. If `delta` is not given,
|
|
359
|
-
* decreases the value of the counter by 1.
|
|
360
|
-
*
|
|
361
|
-
* Will throw an error if used outside of a change callback.
|
|
362
|
-
*/
|
|
363
|
-
decrement(_delta) {
|
|
364
|
-
throw new Error("Counters should not be decremented outside of a change callback");
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
var WriteableCounter = class extends Counter {
|
|
368
|
-
constructor(value, context, path, objectId, key) {
|
|
369
|
-
super(value);
|
|
370
|
-
this.context = context;
|
|
371
|
-
this.path = path;
|
|
372
|
-
this.objectId = objectId;
|
|
373
|
-
this.key = key;
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Increases the value of the counter by `delta`. If `delta` is not given,
|
|
377
|
-
* increases the value of the counter by 1.
|
|
378
|
-
*/
|
|
379
|
-
increment(delta) {
|
|
380
|
-
delta = typeof delta === "number" ? delta : 1;
|
|
381
|
-
this.context.increment(this.objectId, this.key, delta);
|
|
382
|
-
this.value += delta;
|
|
383
|
-
return this.value;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Decreases the value of the counter by `delta`. If `delta` is not given,
|
|
387
|
-
* decreases the value of the counter by 1.
|
|
388
|
-
*/
|
|
389
|
-
decrement(delta) {
|
|
390
|
-
return this.increment(typeof delta === "number" ? -delta : -1);
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
function getWriteableCounter(value, context, path, objectId, key) {
|
|
394
|
-
return new WriteableCounter(value, context, path, objectId, key);
|
|
395
|
-
}
|
|
396
|
-
var _a;
|
|
397
|
-
var ImmutableString = class {
|
|
398
|
-
constructor(val) {
|
|
399
|
-
this[_a] = true;
|
|
400
|
-
this.val = val;
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Returns the content of the ImmutableString object as a simple string
|
|
404
|
-
*/
|
|
405
|
-
toString() {
|
|
406
|
-
return this.val;
|
|
407
|
-
}
|
|
408
|
-
toJSON() {
|
|
409
|
-
return this.val;
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
_a = IMMUTABLE_STRING;
|
|
413
|
-
function parseListIndex(key) {
|
|
414
|
-
if (typeof key === "string" && /^[0-9]+$/.test(key))
|
|
415
|
-
key = parseInt(key, 10);
|
|
416
|
-
if (typeof key !== "number") {
|
|
417
|
-
return key;
|
|
418
|
-
}
|
|
419
|
-
if (key < 0 || isNaN(key) || key === Infinity || key === -Infinity) {
|
|
420
|
-
throw new RangeError("A list index must be positive, but you passed " + key);
|
|
421
|
-
}
|
|
422
|
-
return key;
|
|
423
|
-
}
|
|
424
|
-
function valueAt(target, prop) {
|
|
425
|
-
const { context, objectId, path } = target;
|
|
426
|
-
const value = context.getWithType(objectId, prop);
|
|
427
|
-
if (value === null) {
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
const datatype = value[0];
|
|
431
|
-
const val = value[1];
|
|
432
|
-
switch (datatype) {
|
|
433
|
-
case void 0:
|
|
434
|
-
return;
|
|
435
|
-
case "map":
|
|
436
|
-
return mapProxy(context, val, [...path, prop]);
|
|
437
|
-
case "list":
|
|
438
|
-
return listProxy(context, val, [...path, prop]);
|
|
439
|
-
case "text":
|
|
440
|
-
return context.text(val);
|
|
441
|
-
case "str":
|
|
442
|
-
return new ImmutableString(val);
|
|
443
|
-
case "uint":
|
|
444
|
-
return val;
|
|
445
|
-
case "int":
|
|
446
|
-
return val;
|
|
447
|
-
case "f64":
|
|
448
|
-
return val;
|
|
449
|
-
case "boolean":
|
|
450
|
-
return val;
|
|
451
|
-
case "null":
|
|
452
|
-
return null;
|
|
453
|
-
case "bytes":
|
|
454
|
-
return val;
|
|
455
|
-
case "timestamp":
|
|
456
|
-
return val;
|
|
457
|
-
case "counter": {
|
|
458
|
-
const counter = getWriteableCounter(val, context, path, objectId, prop);
|
|
459
|
-
return counter;
|
|
460
|
-
}
|
|
461
|
-
default:
|
|
462
|
-
throw RangeError(`datatype ${datatype} unimplemented`);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
function import_value(value, path, context) {
|
|
466
|
-
const type = typeof value;
|
|
467
|
-
switch (type) {
|
|
468
|
-
case "object":
|
|
469
|
-
if (value == null) {
|
|
470
|
-
return [null, "null"];
|
|
471
|
-
} else if (value[UINT]) {
|
|
472
|
-
return [value.value, "uint"];
|
|
473
|
-
} else if (value[INT]) {
|
|
474
|
-
return [value.value, "int"];
|
|
475
|
-
} else if (value[F64]) {
|
|
476
|
-
return [value.value, "f64"];
|
|
477
|
-
} else if (value[COUNTER]) {
|
|
478
|
-
return [value.value, "counter"];
|
|
479
|
-
} else if (value instanceof Date) {
|
|
480
|
-
return [value.getTime(), "timestamp"];
|
|
481
|
-
} else if (isImmutableString(value)) {
|
|
482
|
-
return [value.toString(), "str"];
|
|
483
|
-
} else if (value instanceof Uint8Array) {
|
|
484
|
-
return [value, "bytes"];
|
|
485
|
-
} else if (value instanceof Array) {
|
|
486
|
-
return [value, "list"];
|
|
487
|
-
} else if (Object.prototype.toString.call(value) === "[object Object]") {
|
|
488
|
-
return [value, "map"];
|
|
489
|
-
} else if (isSameDocument(value, context)) {
|
|
490
|
-
throw new RangeError("Cannot create a reference to an existing document object");
|
|
491
|
-
} else {
|
|
492
|
-
throw new RangeError(`Cannot assign unknown object: ${value}`);
|
|
493
|
-
}
|
|
494
|
-
case "boolean":
|
|
495
|
-
return [value, "boolean"];
|
|
496
|
-
case "number":
|
|
497
|
-
if (Number.isInteger(value)) {
|
|
498
|
-
return [value, "int"];
|
|
499
|
-
} else {
|
|
500
|
-
return [value, "f64"];
|
|
501
|
-
}
|
|
502
|
-
case "string":
|
|
503
|
-
return [value, "text"];
|
|
504
|
-
case "undefined":
|
|
505
|
-
throw new RangeError([
|
|
506
|
-
`Cannot assign undefined value at ${printPath(path)}, `,
|
|
507
|
-
"because `undefined` is not a valid JSON data type. ",
|
|
508
|
-
"You might consider setting the property's value to `null`, ",
|
|
509
|
-
"or using `delete` to remove it altogether."
|
|
510
|
-
].join(""));
|
|
511
|
-
default:
|
|
512
|
-
throw new RangeError([
|
|
513
|
-
`Cannot assign ${type} value at ${printPath(path)}. `,
|
|
514
|
-
`All JSON primitive datatypes (object, array, string, number, boolean, null) `,
|
|
515
|
-
`are supported in an Automerge document; ${type} values are not. `
|
|
516
|
-
].join(""));
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
function isSameDocument(val, context) {
|
|
520
|
-
var _b, _c;
|
|
521
|
-
if (val instanceof Date) {
|
|
522
|
-
return false;
|
|
523
|
-
}
|
|
524
|
-
if (val && ((_c = (_b = val[STATE]) === null || _b === void 0 ? void 0 : _b.handle) === null || _c === void 0 ? void 0 : _c.__wbg_ptr) === context.__wbg_ptr) {
|
|
525
|
-
return true;
|
|
526
|
-
}
|
|
527
|
-
return false;
|
|
528
|
-
}
|
|
529
|
-
var MapHandler = {
|
|
530
|
-
get(target, key) {
|
|
531
|
-
const { context, objectId, cache: cache2 } = target;
|
|
532
|
-
if (key === Symbol.toStringTag) {
|
|
533
|
-
return target[Symbol.toStringTag];
|
|
534
|
-
}
|
|
535
|
-
if (key === OBJECT_ID)
|
|
536
|
-
return objectId;
|
|
537
|
-
if (key === IS_PROXY)
|
|
538
|
-
return true;
|
|
539
|
-
if (key === TRACE)
|
|
540
|
-
return target.trace;
|
|
541
|
-
if (key === STATE)
|
|
542
|
-
return { handle: context };
|
|
543
|
-
if (!cache2[key]) {
|
|
544
|
-
cache2[key] = valueAt(target, key);
|
|
545
|
-
}
|
|
546
|
-
return cache2[key];
|
|
547
|
-
},
|
|
548
|
-
set(target, key, val) {
|
|
549
|
-
const { context, objectId, path } = target;
|
|
550
|
-
target.cache = {};
|
|
551
|
-
if (isSameDocument(val, context)) {
|
|
552
|
-
throw new RangeError("Cannot create a reference to an existing document object");
|
|
553
|
-
}
|
|
554
|
-
if (key === TRACE) {
|
|
555
|
-
target.trace = val;
|
|
556
|
-
return true;
|
|
557
|
-
}
|
|
558
|
-
if (key === CLEAR_CACHE) {
|
|
559
|
-
return true;
|
|
560
|
-
}
|
|
561
|
-
const [value, datatype] = import_value(val, [...path, key], context);
|
|
562
|
-
switch (datatype) {
|
|
563
|
-
case "list": {
|
|
564
|
-
const list = context.putObject(objectId, key, []);
|
|
565
|
-
const proxyList = listProxy(context, list, [...path, key]);
|
|
566
|
-
for (let i = 0; i < value.length; i++) {
|
|
567
|
-
proxyList[i] = value[i];
|
|
568
|
-
}
|
|
569
|
-
break;
|
|
570
|
-
}
|
|
571
|
-
case "text": {
|
|
572
|
-
context.putObject(objectId, key, value);
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
case "map": {
|
|
576
|
-
const map = context.putObject(objectId, key, {});
|
|
577
|
-
const proxyMap = mapProxy(context, map, [...path, key]);
|
|
578
|
-
for (const key2 in value) {
|
|
579
|
-
proxyMap[key2] = value[key2];
|
|
580
|
-
}
|
|
581
|
-
break;
|
|
582
|
-
}
|
|
583
|
-
default:
|
|
584
|
-
context.put(objectId, key, value, datatype);
|
|
585
|
-
}
|
|
586
|
-
return true;
|
|
587
|
-
},
|
|
588
|
-
deleteProperty(target, key) {
|
|
589
|
-
const { context, objectId } = target;
|
|
590
|
-
target.cache = {};
|
|
591
|
-
context.delete(objectId, key);
|
|
592
|
-
return true;
|
|
593
|
-
},
|
|
594
|
-
has(target, key) {
|
|
595
|
-
const value = this.get(target, key);
|
|
596
|
-
return value !== void 0;
|
|
597
|
-
},
|
|
598
|
-
getOwnPropertyDescriptor(target, key) {
|
|
599
|
-
const value = this.get(target, key);
|
|
600
|
-
if (typeof value !== "undefined") {
|
|
601
|
-
return {
|
|
602
|
-
configurable: true,
|
|
603
|
-
enumerable: true,
|
|
604
|
-
value
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
},
|
|
608
|
-
ownKeys(target) {
|
|
609
|
-
const { context, objectId } = target;
|
|
610
|
-
const keys = context.keys(objectId);
|
|
611
|
-
return [...new Set(keys)];
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
var ListHandler = {
|
|
615
|
-
get(target, index) {
|
|
616
|
-
const { context, objectId } = target;
|
|
617
|
-
index = parseListIndex(index);
|
|
618
|
-
if (index === Symbol.hasInstance) {
|
|
619
|
-
return (instance) => {
|
|
620
|
-
return Array.isArray(instance);
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
if (index === Symbol.toStringTag) {
|
|
624
|
-
return target[Symbol.toStringTag];
|
|
625
|
-
}
|
|
626
|
-
if (index === OBJECT_ID)
|
|
627
|
-
return objectId;
|
|
628
|
-
if (index === IS_PROXY)
|
|
629
|
-
return true;
|
|
630
|
-
if (index === TRACE)
|
|
631
|
-
return target.trace;
|
|
632
|
-
if (index === STATE)
|
|
633
|
-
return { handle: context };
|
|
634
|
-
if (index === "length")
|
|
635
|
-
return context.length(objectId);
|
|
636
|
-
if (typeof index === "number") {
|
|
637
|
-
return valueAt(target, index);
|
|
638
|
-
} else {
|
|
639
|
-
return listMethods(target)[index];
|
|
640
|
-
}
|
|
641
|
-
},
|
|
642
|
-
set(target, index, val) {
|
|
643
|
-
const { context, objectId, path } = target;
|
|
644
|
-
index = parseListIndex(index);
|
|
645
|
-
if (isSameDocument(val, context)) {
|
|
646
|
-
throw new RangeError("Cannot create a reference to an existing document object");
|
|
647
|
-
}
|
|
648
|
-
if (index === CLEAR_CACHE) {
|
|
649
|
-
return true;
|
|
650
|
-
}
|
|
651
|
-
if (index === TRACE) {
|
|
652
|
-
target.trace = val;
|
|
653
|
-
return true;
|
|
654
|
-
}
|
|
655
|
-
if (typeof index == "string") {
|
|
656
|
-
throw new RangeError("list index must be a number");
|
|
657
|
-
}
|
|
658
|
-
const [value, datatype] = import_value(val, [...path, index], context);
|
|
659
|
-
switch (datatype) {
|
|
660
|
-
case "list": {
|
|
661
|
-
let list;
|
|
662
|
-
if (index >= context.length(objectId)) {
|
|
663
|
-
list = context.insertObject(objectId, index, []);
|
|
664
|
-
} else {
|
|
665
|
-
list = context.putObject(objectId, index, []);
|
|
666
|
-
}
|
|
667
|
-
const proxyList = listProxy(context, list, [...path, index]);
|
|
668
|
-
proxyList.splice(0, 0, ...value);
|
|
669
|
-
break;
|
|
670
|
-
}
|
|
671
|
-
case "text": {
|
|
672
|
-
if (index >= context.length(objectId)) {
|
|
673
|
-
context.insertObject(objectId, index, value);
|
|
674
|
-
} else {
|
|
675
|
-
context.putObject(objectId, index, value);
|
|
676
|
-
}
|
|
677
|
-
break;
|
|
678
|
-
}
|
|
679
|
-
case "map": {
|
|
680
|
-
let map;
|
|
681
|
-
if (index >= context.length(objectId)) {
|
|
682
|
-
map = context.insertObject(objectId, index, {});
|
|
683
|
-
} else {
|
|
684
|
-
map = context.putObject(objectId, index, {});
|
|
685
|
-
}
|
|
686
|
-
const proxyMap = mapProxy(context, map, [...path, index]);
|
|
687
|
-
for (const key in value) {
|
|
688
|
-
proxyMap[key] = value[key];
|
|
689
|
-
}
|
|
690
|
-
break;
|
|
691
|
-
}
|
|
692
|
-
default:
|
|
693
|
-
if (index >= context.length(objectId)) {
|
|
694
|
-
context.insert(objectId, index, value, datatype);
|
|
695
|
-
} else {
|
|
696
|
-
context.put(objectId, index, value, datatype);
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
return true;
|
|
700
|
-
},
|
|
701
|
-
deleteProperty(target, index) {
|
|
702
|
-
const { context, objectId } = target;
|
|
703
|
-
index = parseListIndex(index);
|
|
704
|
-
const elem = context.get(objectId, index);
|
|
705
|
-
if (elem != null && elem[0] == "counter") {
|
|
706
|
-
throw new TypeError("Unsupported operation: deleting a counter from a list");
|
|
707
|
-
}
|
|
708
|
-
context.delete(objectId, index);
|
|
709
|
-
return true;
|
|
710
|
-
},
|
|
711
|
-
has(target, index) {
|
|
712
|
-
const { context, objectId } = target;
|
|
713
|
-
index = parseListIndex(index);
|
|
714
|
-
if (typeof index === "number") {
|
|
715
|
-
return index < context.length(objectId);
|
|
716
|
-
}
|
|
717
|
-
return index === "length";
|
|
718
|
-
},
|
|
719
|
-
getOwnPropertyDescriptor(target, index) {
|
|
720
|
-
const { context, objectId } = target;
|
|
721
|
-
if (index === "length")
|
|
722
|
-
return { writable: true, value: context.length(objectId) };
|
|
723
|
-
if (index === OBJECT_ID)
|
|
724
|
-
return { configurable: false, enumerable: false, value: objectId };
|
|
725
|
-
index = parseListIndex(index);
|
|
726
|
-
const value = valueAt(target, index);
|
|
727
|
-
return { configurable: true, enumerable: true, value };
|
|
728
|
-
},
|
|
729
|
-
getPrototypeOf(target) {
|
|
730
|
-
return Object.getPrototypeOf(target);
|
|
731
|
-
},
|
|
732
|
-
ownKeys() {
|
|
733
|
-
const keys = [];
|
|
734
|
-
keys.push("length");
|
|
735
|
-
return keys;
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
Object.assign({}, ListHandler, {
|
|
739
|
-
get(target, index) {
|
|
740
|
-
const { context, objectId } = target;
|
|
741
|
-
index = parseListIndex(index);
|
|
742
|
-
if (index === Symbol.hasInstance) {
|
|
743
|
-
return (instance) => {
|
|
744
|
-
return Array.isArray(instance);
|
|
745
|
-
};
|
|
746
|
-
}
|
|
747
|
-
if (index === Symbol.toStringTag) {
|
|
748
|
-
return target[Symbol.toStringTag];
|
|
749
|
-
}
|
|
750
|
-
if (index === OBJECT_ID)
|
|
751
|
-
return objectId;
|
|
752
|
-
if (index === IS_PROXY)
|
|
753
|
-
return true;
|
|
754
|
-
if (index === TRACE)
|
|
755
|
-
return target.trace;
|
|
756
|
-
if (index === STATE)
|
|
757
|
-
return { handle: context };
|
|
758
|
-
if (index === "length")
|
|
759
|
-
return context.length(objectId);
|
|
760
|
-
if (typeof index === "number") {
|
|
761
|
-
return valueAt(target, index);
|
|
762
|
-
} else {
|
|
763
|
-
return textMethods(target)[index] || listMethods(target)[index];
|
|
764
|
-
}
|
|
765
|
-
},
|
|
766
|
-
getPrototypeOf() {
|
|
767
|
-
return Object.getPrototypeOf(new Text());
|
|
768
|
-
}
|
|
769
|
-
});
|
|
770
|
-
function mapProxy(context, objectId, path) {
|
|
771
|
-
const target = {
|
|
772
|
-
context,
|
|
773
|
-
objectId,
|
|
774
|
-
path: path || [],
|
|
775
|
-
cache: {}
|
|
776
|
-
};
|
|
777
|
-
const proxied = {};
|
|
778
|
-
Object.assign(proxied, target);
|
|
779
|
-
const result = new Proxy(proxied, MapHandler);
|
|
780
|
-
return result;
|
|
781
|
-
}
|
|
782
|
-
function listProxy(context, objectId, path) {
|
|
783
|
-
const target = {
|
|
784
|
-
context,
|
|
785
|
-
objectId,
|
|
786
|
-
path: path || [],
|
|
787
|
-
cache: {}
|
|
788
|
-
};
|
|
789
|
-
const proxied = [];
|
|
790
|
-
Object.assign(proxied, target);
|
|
791
|
-
return new Proxy(proxied, ListHandler);
|
|
792
|
-
}
|
|
793
|
-
function listMethods(target) {
|
|
794
|
-
const { context, objectId, path } = target;
|
|
795
|
-
const methods = {
|
|
796
|
-
at(index) {
|
|
797
|
-
return valueAt(target, index);
|
|
798
|
-
},
|
|
799
|
-
deleteAt(index, numDelete) {
|
|
800
|
-
if (typeof numDelete === "number") {
|
|
801
|
-
context.splice(objectId, index, numDelete);
|
|
802
|
-
} else {
|
|
803
|
-
context.delete(objectId, index);
|
|
804
|
-
}
|
|
805
|
-
return this;
|
|
806
|
-
},
|
|
807
|
-
fill(val, start, end) {
|
|
808
|
-
const [value, datatype] = import_value(val, [...path, start], context);
|
|
809
|
-
const length = context.length(objectId);
|
|
810
|
-
start = parseListIndex(start || 0);
|
|
811
|
-
end = parseListIndex(end || length);
|
|
812
|
-
for (let i = start; i < Math.min(end, length); i++) {
|
|
813
|
-
if (datatype === "list" || datatype === "map") {
|
|
814
|
-
context.putObject(objectId, i, value);
|
|
815
|
-
} else if (datatype === "text") {
|
|
816
|
-
context.putObject(objectId, i, value);
|
|
817
|
-
} else {
|
|
818
|
-
context.put(objectId, i, value, datatype);
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
return this;
|
|
822
|
-
},
|
|
823
|
-
indexOf(searchElement, start = 0) {
|
|
824
|
-
const length = context.length(objectId);
|
|
825
|
-
for (let i = start; i < length; i++) {
|
|
826
|
-
const valueWithType = context.getWithType(objectId, i);
|
|
827
|
-
if (!valueWithType) {
|
|
828
|
-
continue;
|
|
829
|
-
}
|
|
830
|
-
const [valType, value] = valueWithType;
|
|
831
|
-
const isObject2 = ["map", "list", "text"].includes(valType);
|
|
832
|
-
if (!isObject2) {
|
|
833
|
-
if (value === searchElement) {
|
|
834
|
-
return i;
|
|
835
|
-
} else {
|
|
836
|
-
continue;
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
if (valType === "text" && typeof searchElement === "string") {
|
|
840
|
-
if (searchElement === valueAt(target, i)) {
|
|
841
|
-
return i;
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
if (searchElement[OBJECT_ID] === value) {
|
|
845
|
-
return i;
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
return -1;
|
|
849
|
-
},
|
|
850
|
-
insertAt(index, ...values) {
|
|
851
|
-
this.splice(index, 0, ...values);
|
|
852
|
-
return this;
|
|
853
|
-
},
|
|
854
|
-
pop() {
|
|
855
|
-
const length = context.length(objectId);
|
|
856
|
-
if (length == 0) {
|
|
857
|
-
return void 0;
|
|
858
|
-
}
|
|
859
|
-
const last = valueAt(target, length - 1);
|
|
860
|
-
context.delete(objectId, length - 1);
|
|
861
|
-
return last;
|
|
862
|
-
},
|
|
863
|
-
push(...values) {
|
|
864
|
-
const len = context.length(objectId);
|
|
865
|
-
this.splice(len, 0, ...values);
|
|
866
|
-
return context.length(objectId);
|
|
867
|
-
},
|
|
868
|
-
shift() {
|
|
869
|
-
if (context.length(objectId) == 0)
|
|
870
|
-
return;
|
|
871
|
-
const first = valueAt(target, 0);
|
|
872
|
-
context.delete(objectId, 0);
|
|
873
|
-
return first;
|
|
874
|
-
},
|
|
875
|
-
splice(index, del, ...vals) {
|
|
876
|
-
index = parseListIndex(index);
|
|
877
|
-
if (typeof del !== "number") {
|
|
878
|
-
del = context.length(objectId) - index;
|
|
879
|
-
}
|
|
880
|
-
del = parseListIndex(del);
|
|
881
|
-
for (const val of vals) {
|
|
882
|
-
if (isSameDocument(val, context)) {
|
|
883
|
-
throw new RangeError("Cannot create a reference to an existing document object");
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
const result = [];
|
|
887
|
-
for (let i = 0; i < del; i++) {
|
|
888
|
-
const value = valueAt(target, index);
|
|
889
|
-
if (value !== void 0) {
|
|
890
|
-
result.push(value);
|
|
891
|
-
}
|
|
892
|
-
context.delete(objectId, index);
|
|
893
|
-
}
|
|
894
|
-
const values = vals.map((val, index2) => {
|
|
895
|
-
try {
|
|
896
|
-
return import_value(val, [...path], context);
|
|
897
|
-
} catch (e) {
|
|
898
|
-
if (e instanceof RangeError) {
|
|
899
|
-
throw new RangeError(`${e.message} (at index ${index2} in the input)`);
|
|
900
|
-
} else {
|
|
901
|
-
throw e;
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
});
|
|
905
|
-
for (const [value, datatype] of values) {
|
|
906
|
-
switch (datatype) {
|
|
907
|
-
case "list": {
|
|
908
|
-
const list = context.insertObject(objectId, index, []);
|
|
909
|
-
const proxyList = listProxy(context, list, [...path, index]);
|
|
910
|
-
proxyList.splice(0, 0, ...value);
|
|
911
|
-
break;
|
|
912
|
-
}
|
|
913
|
-
case "text": {
|
|
914
|
-
context.insertObject(objectId, index, value);
|
|
915
|
-
break;
|
|
916
|
-
}
|
|
917
|
-
case "map": {
|
|
918
|
-
const map = context.insertObject(objectId, index, {});
|
|
919
|
-
const proxyMap = mapProxy(context, map, [...path, index]);
|
|
920
|
-
for (const key in value) {
|
|
921
|
-
proxyMap[key] = value[key];
|
|
922
|
-
}
|
|
923
|
-
break;
|
|
924
|
-
}
|
|
925
|
-
default:
|
|
926
|
-
context.insert(objectId, index, value, datatype);
|
|
927
|
-
}
|
|
928
|
-
index += 1;
|
|
929
|
-
}
|
|
930
|
-
return result;
|
|
931
|
-
},
|
|
932
|
-
unshift(...values) {
|
|
933
|
-
this.splice(0, 0, ...values);
|
|
934
|
-
return context.length(objectId);
|
|
935
|
-
},
|
|
936
|
-
entries() {
|
|
937
|
-
let i = 0;
|
|
938
|
-
const iterator = {
|
|
939
|
-
next: () => {
|
|
940
|
-
const value = valueAt(target, i);
|
|
941
|
-
if (value === void 0) {
|
|
942
|
-
return { value: void 0, done: true };
|
|
943
|
-
} else {
|
|
944
|
-
return { value: [i++, value], done: false };
|
|
945
|
-
}
|
|
946
|
-
},
|
|
947
|
-
[Symbol.iterator]() {
|
|
948
|
-
return this;
|
|
949
|
-
}
|
|
950
|
-
};
|
|
951
|
-
return iterator;
|
|
952
|
-
},
|
|
953
|
-
keys() {
|
|
954
|
-
let i = 0;
|
|
955
|
-
const len = context.length(objectId);
|
|
956
|
-
const iterator = {
|
|
957
|
-
next: () => {
|
|
958
|
-
if (i < len) {
|
|
959
|
-
return { value: i++, done: false };
|
|
960
|
-
}
|
|
961
|
-
return { value: void 0, done: true };
|
|
962
|
-
},
|
|
963
|
-
[Symbol.iterator]() {
|
|
964
|
-
return this;
|
|
965
|
-
}
|
|
966
|
-
};
|
|
967
|
-
return iterator;
|
|
968
|
-
},
|
|
969
|
-
values() {
|
|
970
|
-
let i = 0;
|
|
971
|
-
const iterator = {
|
|
972
|
-
next: () => {
|
|
973
|
-
const value = valueAt(target, i++);
|
|
974
|
-
if (value === void 0) {
|
|
975
|
-
return { value: void 0, done: true };
|
|
976
|
-
} else {
|
|
977
|
-
return { value, done: false };
|
|
978
|
-
}
|
|
979
|
-
},
|
|
980
|
-
[Symbol.iterator]() {
|
|
981
|
-
return this;
|
|
982
|
-
}
|
|
983
|
-
};
|
|
984
|
-
return iterator;
|
|
985
|
-
},
|
|
986
|
-
toArray() {
|
|
987
|
-
const list = [];
|
|
988
|
-
let value;
|
|
989
|
-
do {
|
|
990
|
-
value = valueAt(target, list.length);
|
|
991
|
-
if (value !== void 0) {
|
|
992
|
-
list.push(value);
|
|
993
|
-
}
|
|
994
|
-
} while (value !== void 0);
|
|
995
|
-
return list;
|
|
996
|
-
},
|
|
997
|
-
map(f) {
|
|
998
|
-
return this.toArray().map(f);
|
|
999
|
-
},
|
|
1000
|
-
toString() {
|
|
1001
|
-
return this.toArray().toString();
|
|
1002
|
-
},
|
|
1003
|
-
toLocaleString() {
|
|
1004
|
-
return this.toArray().toLocaleString();
|
|
1005
|
-
},
|
|
1006
|
-
forEach(f) {
|
|
1007
|
-
return this.toArray().forEach(f);
|
|
1008
|
-
},
|
|
1009
|
-
// todo: real concat function is different
|
|
1010
|
-
concat(other) {
|
|
1011
|
-
return this.toArray().concat(other);
|
|
1012
|
-
},
|
|
1013
|
-
every(f) {
|
|
1014
|
-
return this.toArray().every(f);
|
|
1015
|
-
},
|
|
1016
|
-
filter(f) {
|
|
1017
|
-
return this.toArray().filter(f);
|
|
1018
|
-
},
|
|
1019
|
-
find(f) {
|
|
1020
|
-
let index = 0;
|
|
1021
|
-
for (const v of this) {
|
|
1022
|
-
if (f(v, index)) {
|
|
1023
|
-
return v;
|
|
1024
|
-
}
|
|
1025
|
-
index += 1;
|
|
1026
|
-
}
|
|
1027
|
-
},
|
|
1028
|
-
findIndex(f) {
|
|
1029
|
-
let index = 0;
|
|
1030
|
-
for (const v of this) {
|
|
1031
|
-
if (f(v, index)) {
|
|
1032
|
-
return index;
|
|
1033
|
-
}
|
|
1034
|
-
index += 1;
|
|
1035
|
-
}
|
|
1036
|
-
return -1;
|
|
1037
|
-
},
|
|
1038
|
-
includes(elem) {
|
|
1039
|
-
return this.find((e) => e === elem) !== void 0;
|
|
1040
|
-
},
|
|
1041
|
-
join(sep) {
|
|
1042
|
-
return this.toArray().join(sep);
|
|
1043
|
-
},
|
|
1044
|
-
reduce(f, initialValue) {
|
|
1045
|
-
return this.toArray().reduce(f, initialValue);
|
|
1046
|
-
},
|
|
1047
|
-
reduceRight(f, initialValue) {
|
|
1048
|
-
return this.toArray().reduceRight(f, initialValue);
|
|
1049
|
-
},
|
|
1050
|
-
lastIndexOf(search, fromIndex = Infinity) {
|
|
1051
|
-
return this.toArray().lastIndexOf(search, fromIndex);
|
|
1052
|
-
},
|
|
1053
|
-
slice(index, num) {
|
|
1054
|
-
return this.toArray().slice(index, num);
|
|
1055
|
-
},
|
|
1056
|
-
some(f) {
|
|
1057
|
-
let index = 0;
|
|
1058
|
-
for (const v of this) {
|
|
1059
|
-
if (f(v, index)) {
|
|
1060
|
-
return true;
|
|
1061
|
-
}
|
|
1062
|
-
index += 1;
|
|
1063
|
-
}
|
|
1064
|
-
return false;
|
|
1065
|
-
},
|
|
1066
|
-
[Symbol.iterator]: function* () {
|
|
1067
|
-
let i = 0;
|
|
1068
|
-
let value = valueAt(target, i);
|
|
1069
|
-
while (value !== void 0) {
|
|
1070
|
-
yield value;
|
|
1071
|
-
i += 1;
|
|
1072
|
-
value = valueAt(target, i);
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
};
|
|
1076
|
-
return methods;
|
|
1077
|
-
}
|
|
1078
|
-
function textMethods(target) {
|
|
1079
|
-
const { context, objectId } = target;
|
|
1080
|
-
const methods = {
|
|
1081
|
-
set(index, value) {
|
|
1082
|
-
return this[index] = value;
|
|
1083
|
-
},
|
|
1084
|
-
get(index) {
|
|
1085
|
-
return this[index];
|
|
1086
|
-
},
|
|
1087
|
-
toString() {
|
|
1088
|
-
return context.text(objectId).replace(//g, "");
|
|
1089
|
-
},
|
|
1090
|
-
toSpans() {
|
|
1091
|
-
const spans = [];
|
|
1092
|
-
let chars = "";
|
|
1093
|
-
const length = context.length(objectId);
|
|
1094
|
-
for (let i = 0; i < length; i++) {
|
|
1095
|
-
const value = this[i];
|
|
1096
|
-
if (typeof value === "string") {
|
|
1097
|
-
chars += value;
|
|
1098
|
-
} else {
|
|
1099
|
-
if (chars.length > 0) {
|
|
1100
|
-
spans.push(chars);
|
|
1101
|
-
chars = "";
|
|
1102
|
-
}
|
|
1103
|
-
spans.push(value);
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
if (chars.length > 0) {
|
|
1107
|
-
spans.push(chars);
|
|
1108
|
-
}
|
|
1109
|
-
return spans;
|
|
1110
|
-
},
|
|
1111
|
-
toJSON() {
|
|
1112
|
-
return this.toString();
|
|
1113
|
-
},
|
|
1114
|
-
indexOf(o, start = 0) {
|
|
1115
|
-
const text = context.text(objectId);
|
|
1116
|
-
return text.indexOf(o, start);
|
|
1117
|
-
},
|
|
1118
|
-
insertAt(index, ...values) {
|
|
1119
|
-
if (values.every((v) => typeof v === "string")) {
|
|
1120
|
-
context.splice(objectId, index, 0, values.join(""));
|
|
1121
|
-
} else {
|
|
1122
|
-
listMethods(target).insertAt(index, ...values);
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
};
|
|
1126
|
-
return methods;
|
|
1127
|
-
}
|
|
1128
|
-
function printPath(path) {
|
|
1129
|
-
const jsonPointerComponents = path.map((component) => {
|
|
1130
|
-
if (typeof component === "number") {
|
|
1131
|
-
return component.toString();
|
|
1132
|
-
} else if (typeof component === "string") {
|
|
1133
|
-
return component.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
1134
|
-
}
|
|
1135
|
-
});
|
|
1136
|
-
if (path.length === 0) {
|
|
1137
|
-
return "";
|
|
1138
|
-
} else {
|
|
1139
|
-
return "/" + jsonPointerComponents.join("/");
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
function isImmutableString(obj) {
|
|
1143
|
-
return typeof obj === "object" && obj !== null && Object.prototype.hasOwnProperty.call(obj, IMMUTABLE_STRING);
|
|
1144
|
-
}
|
|
1145
|
-
function isCounter(obj) {
|
|
1146
|
-
return typeof obj === "object" && obj !== null && Object.prototype.hasOwnProperty.call(obj, COUNTER);
|
|
1147
|
-
}
|
|
1148
|
-
var wasm;
|
|
1149
|
-
var cachedTextEncoder = typeof TextEncoder !== "undefined" ? new TextEncoder("utf-8") : { encode: () => {
|
|
1150
|
-
throw Error("TextEncoder not available");
|
|
1151
|
-
} };
|
|
1152
|
-
typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
|
|
1153
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
1154
|
-
} : function(arg, view) {
|
|
1155
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
1156
|
-
view.set(buf);
|
|
1157
|
-
return {
|
|
1158
|
-
read: arg.length,
|
|
1159
|
-
written: buf.length
|
|
1160
|
-
};
|
|
1161
|
-
};
|
|
1162
|
-
var cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {
|
|
1163
|
-
throw Error("TextDecoder not available");
|
|
1164
|
-
} };
|
|
1165
|
-
if (typeof TextDecoder !== "undefined") {
|
|
1166
|
-
cachedTextDecoder.decode();
|
|
1167
|
-
}
|
|
1168
|
-
typeof FinalizationRegistry === "undefined" ? {} : new FinalizationRegistry((ptr) => wasm.__wbg_automerge_free(ptr >>> 0, 1));
|
|
1169
|
-
typeof FinalizationRegistry === "undefined" ? {} : new FinalizationRegistry((ptr) => wasm.__wbg_syncstate_free(ptr >>> 0, 1));
|
|
1170
|
-
function _state(doc, checkroot = true) {
|
|
1171
|
-
if (typeof doc !== "object") {
|
|
1172
|
-
throw new RangeError("must be the document root");
|
|
1173
|
-
}
|
|
1174
|
-
const state = Reflect.get(doc, STATE);
|
|
1175
|
-
if (state === void 0 || state == null || checkroot && _obj(doc) !== "_root") {
|
|
1176
|
-
throw new RangeError("must be the document root");
|
|
1177
|
-
}
|
|
1178
|
-
return state;
|
|
1179
|
-
}
|
|
1180
|
-
function _clear_cache(doc) {
|
|
1181
|
-
Reflect.set(doc, CLEAR_CACHE, true);
|
|
1182
|
-
}
|
|
1183
|
-
function _obj(doc) {
|
|
1184
|
-
if (!(typeof doc === "object") || doc === null) {
|
|
1185
|
-
return null;
|
|
1186
|
-
}
|
|
1187
|
-
return Reflect.get(doc, OBJECT_ID);
|
|
1188
|
-
}
|
|
1189
|
-
function _is_proxy(doc) {
|
|
1190
|
-
return !!Reflect.get(doc, IS_PROXY);
|
|
1191
|
-
}
|
|
1192
|
-
function applyPatch(doc, patch) {
|
|
1193
|
-
let path = resolvePath(doc, patch.path);
|
|
1194
|
-
if (patch.action === "put") {
|
|
1195
|
-
applyPutPatch(doc, path, patch);
|
|
1196
|
-
} else if (patch.action === "insert") {
|
|
1197
|
-
applyInsertPatch(doc, path, patch);
|
|
1198
|
-
} else if (patch.action === "del") {
|
|
1199
|
-
applyDelPatch(doc, path, patch);
|
|
1200
|
-
} else if (patch.action === "splice") {
|
|
1201
|
-
applySplicePatch(doc, path, patch);
|
|
1202
|
-
} else if (patch.action === "inc") {
|
|
1203
|
-
applyIncPatch(doc, path, patch);
|
|
1204
|
-
} else if (patch.action === "mark") {
|
|
1205
|
-
applyMarkPatch(doc, path, patch);
|
|
1206
|
-
} else if (patch.action === "unmark") {
|
|
1207
|
-
applyUnmarkPatch(doc, path, patch);
|
|
1208
|
-
} else if (patch.action === "conflict") ;
|
|
1209
|
-
else {
|
|
1210
|
-
throw new RangeError(`unsupported patch: ${patch}`);
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
function applyPutPatch(doc, path, patch) {
|
|
1214
|
-
let { obj: parent, prop } = pathElemAt(path, -1);
|
|
1215
|
-
parent[prop] = patch.value;
|
|
1216
|
-
}
|
|
1217
|
-
function applyInsertPatch(doc, path, patch) {
|
|
1218
|
-
let { obj: parent, prop } = pathElemAt(path, -1);
|
|
1219
|
-
if (!Array.isArray(parent)) {
|
|
1220
|
-
throw new RangeError(`target is not an array for patch`);
|
|
1221
|
-
}
|
|
1222
|
-
if (!(typeof prop === "number")) {
|
|
1223
|
-
throw new RangeError(`index is not a number for patch`);
|
|
1224
|
-
}
|
|
1225
|
-
parent.splice(prop, 0, ...patch.values);
|
|
1226
|
-
}
|
|
1227
|
-
function applyDelPatch(doc, path, patch) {
|
|
1228
|
-
let { obj: parent, prop, parentPath } = pathElemAt(path, -1);
|
|
1229
|
-
if (!(typeof prop === "number")) {
|
|
1230
|
-
throw new RangeError(`index is not a number for patch`);
|
|
1231
|
-
}
|
|
1232
|
-
if (Array.isArray(parent)) {
|
|
1233
|
-
parent.splice(prop, patch.length || 1);
|
|
1234
|
-
} else if (typeof parent === "string") {
|
|
1235
|
-
if (isAutomerge(doc)) {
|
|
1236
|
-
splice(doc, parentPath, prop, patch.length || 1);
|
|
1237
|
-
} else {
|
|
1238
|
-
let { obj: grandParent, prop: grandParentProp } = pathElemAt(path, -2);
|
|
1239
|
-
if (typeof prop !== "number") {
|
|
1240
|
-
throw new RangeError(`index is not a number for patch`);
|
|
1241
|
-
}
|
|
1242
|
-
let target = grandParent[grandParentProp];
|
|
1243
|
-
if (target == null || typeof target !== "string") {
|
|
1244
|
-
throw new RangeError(`target is not a string for patch`);
|
|
1245
|
-
}
|
|
1246
|
-
let newString = target.slice(0, prop) + target.slice(prop + (patch.length || 1));
|
|
1247
|
-
grandParent[grandParentProp] = newString;
|
|
1248
|
-
}
|
|
1249
|
-
} else {
|
|
1250
|
-
throw new RangeError(`target is not an array or string for patch`);
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
function applySplicePatch(doc, path, patch) {
|
|
1254
|
-
if (isAutomerge(doc)) {
|
|
1255
|
-
let { obj: parent, prop, parentPath } = pathElemAt(path, -1);
|
|
1256
|
-
if (!(typeof prop === "number")) {
|
|
1257
|
-
throw new RangeError(`index is not a number for patch`);
|
|
1258
|
-
}
|
|
1259
|
-
splice(doc, parentPath, prop, 0, patch.value);
|
|
1260
|
-
} else {
|
|
1261
|
-
let { obj: parent, prop } = pathElemAt(path, -1);
|
|
1262
|
-
let { obj: grandParent, prop: grandParentProp } = pathElemAt(path, -2);
|
|
1263
|
-
if (typeof prop !== "number") {
|
|
1264
|
-
throw new RangeError(`index is not a number for patch`);
|
|
1265
|
-
}
|
|
1266
|
-
let target = grandParent[grandParentProp];
|
|
1267
|
-
if (target == null || typeof target !== "string") {
|
|
1268
|
-
throw new RangeError(`target is not a string for patch`);
|
|
1269
|
-
}
|
|
1270
|
-
let newString = target.slice(0, prop) + patch.value + target.slice(prop);
|
|
1271
|
-
grandParent[grandParentProp] = newString;
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
function applyIncPatch(doc, path, patch) {
|
|
1275
|
-
let { obj: parent, prop } = pathElemAt(path, -1);
|
|
1276
|
-
const counter = parent[prop];
|
|
1277
|
-
if (isAutomerge(doc)) {
|
|
1278
|
-
if (!isCounter(counter)) {
|
|
1279
|
-
throw new RangeError(`target is not a counter for patch`);
|
|
1280
|
-
}
|
|
1281
|
-
counter.increment(patch.value);
|
|
1282
|
-
} else {
|
|
1283
|
-
if (!(typeof counter === "number")) {
|
|
1284
|
-
throw new RangeError(`target is not a number for patch`);
|
|
1285
|
-
}
|
|
1286
|
-
parent[prop] = counter + patch.value;
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
function applyMarkPatch(doc, path, patch) {
|
|
1290
|
-
let { obj: parent, prop } = pathElemAt(path, -1);
|
|
1291
|
-
if (!isAutomerge(doc)) {
|
|
1292
|
-
return;
|
|
1293
|
-
}
|
|
1294
|
-
for (const markSpec of patch.marks) {
|
|
1295
|
-
mark(
|
|
1296
|
-
doc,
|
|
1297
|
-
patch.path,
|
|
1298
|
-
// TODO: add mark expansion to patches. This will require emitting
|
|
1299
|
-
// the expand values in patches.
|
|
1300
|
-
{ start: markSpec.start, end: markSpec.end, expand: "none" },
|
|
1301
|
-
markSpec.name,
|
|
1302
|
-
markSpec.value
|
|
1303
|
-
);
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
function applyUnmarkPatch(doc, path, patch) {
|
|
1307
|
-
if (!isAutomerge(doc)) {
|
|
1308
|
-
return;
|
|
1309
|
-
}
|
|
1310
|
-
unmark(doc, patch.path, { start: patch.start, end: patch.end, expand: "none" }, patch.name);
|
|
1311
|
-
}
|
|
1312
|
-
function applyPatches(doc, patches) {
|
|
1313
|
-
for (const patch of patches) {
|
|
1314
|
-
applyPatch(doc, patch);
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
function resolvePath(doc, path) {
|
|
1318
|
-
const result = [];
|
|
1319
|
-
let current = doc;
|
|
1320
|
-
let currentPath = [];
|
|
1321
|
-
for (const [index, prop] of path.entries()) {
|
|
1322
|
-
result.push({ obj: current, prop, parentPath: currentPath.slice() });
|
|
1323
|
-
currentPath.push(prop);
|
|
1324
|
-
if (index !== path.length - 1) {
|
|
1325
|
-
if (current == null || typeof current != "object") {
|
|
1326
|
-
throw new Error(`Invalid path: ${path}`);
|
|
1327
|
-
}
|
|
1328
|
-
current = current[prop];
|
|
1329
|
-
} else {
|
|
1330
|
-
break;
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
return result;
|
|
1334
|
-
}
|
|
1335
|
-
function pathElemAt(resolved, index) {
|
|
1336
|
-
let result = resolved.at(index);
|
|
1337
|
-
if (result == void 0) {
|
|
1338
|
-
throw new Error("invalid path");
|
|
1339
|
-
}
|
|
1340
|
-
return result;
|
|
1341
|
-
}
|
|
1342
|
-
function cursorToIndex(state, value, index) {
|
|
1343
|
-
if (typeof index == "string") {
|
|
1344
|
-
if (/^-?[0-9]+@[0-9a-zA-Z]+$|^[se]$/.test(index)) {
|
|
1345
|
-
return state.handle.getCursorPosition(value, index);
|
|
1346
|
-
} else {
|
|
1347
|
-
throw new RangeError("index must be a number or cursor");
|
|
1348
|
-
}
|
|
1349
|
-
} else {
|
|
1350
|
-
return index;
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
function getObjectId(doc, prop) {
|
|
1354
|
-
{
|
|
1355
|
-
return _obj(doc);
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
function diff(doc, before, after) {
|
|
1359
|
-
checkHeads(before, "before");
|
|
1360
|
-
checkHeads(after, "after");
|
|
1361
|
-
const state = _state(doc);
|
|
1362
|
-
if (state.mostRecentPatch && equals(state.mostRecentPatch.before, before) && equals(state.mostRecentPatch.after, after)) {
|
|
1363
|
-
return state.mostRecentPatch.patches;
|
|
1364
|
-
}
|
|
1365
|
-
return state.handle.diff(before, after);
|
|
1366
|
-
}
|
|
1367
|
-
function checkHeads(heads, fieldname) {
|
|
1368
|
-
if (!Array.isArray(heads)) {
|
|
1369
|
-
throw new Error(`${fieldname} must be an array`);
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
function equals(val1, val2) {
|
|
1373
|
-
if (!isObject(val1) || !isObject(val2))
|
|
1374
|
-
return val1 === val2;
|
|
1375
|
-
const keys1 = Object.keys(val1).sort(), keys2 = Object.keys(val2).sort();
|
|
1376
|
-
if (keys1.length !== keys2.length)
|
|
1377
|
-
return false;
|
|
1378
|
-
for (let i = 0; i < keys1.length; i++) {
|
|
1379
|
-
if (keys1[i] !== keys2[i])
|
|
1380
|
-
return false;
|
|
1381
|
-
if (!equals(val1[keys1[i]], val2[keys2[i]]))
|
|
1382
|
-
return false;
|
|
1383
|
-
}
|
|
1384
|
-
return true;
|
|
1385
|
-
}
|
|
1386
|
-
function getHeads(doc) {
|
|
1387
|
-
const state = _state(doc);
|
|
1388
|
-
return state.heads || state.handle.getHeads();
|
|
1389
|
-
}
|
|
1390
|
-
function isAutomerge(doc) {
|
|
1391
|
-
if (typeof doc == "object" && doc !== null) {
|
|
1392
|
-
return getObjectId(doc) === "_root" && !!Reflect.get(doc, STATE);
|
|
1393
|
-
} else {
|
|
1394
|
-
return false;
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1397
|
-
function isObject(obj) {
|
|
1398
|
-
return typeof obj === "object" && obj !== null;
|
|
1399
|
-
}
|
|
1400
|
-
function splice(doc, path, index, del, newText) {
|
|
1401
|
-
const objPath = absoluteObjPath(doc, path, "splice");
|
|
1402
|
-
if (!_is_proxy(doc)) {
|
|
1403
|
-
throw new RangeError("object cannot be modified outside of a change block");
|
|
1404
|
-
}
|
|
1405
|
-
const state = _state(doc, false);
|
|
1406
|
-
_clear_cache(doc);
|
|
1407
|
-
index = cursorToIndex(state, objPath, index);
|
|
1408
|
-
try {
|
|
1409
|
-
return state.handle.splice(objPath, index, del, newText);
|
|
1410
|
-
} catch (e) {
|
|
1411
|
-
throw new RangeError(`Cannot splice: ${e}`);
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
function mark(doc, path, range, name, value) {
|
|
1415
|
-
const objPath = absoluteObjPath(doc, path, "mark");
|
|
1416
|
-
if (!_is_proxy(doc)) {
|
|
1417
|
-
throw new RangeError("object cannot be modified outside of a change block");
|
|
1418
|
-
}
|
|
1419
|
-
const state = _state(doc, false);
|
|
1420
|
-
try {
|
|
1421
|
-
return state.handle.mark(objPath, range, name, value);
|
|
1422
|
-
} catch (e) {
|
|
1423
|
-
throw new RangeError(`Cannot mark: ${e}`);
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
function unmark(doc, path, range, name) {
|
|
1427
|
-
const objPath = absoluteObjPath(doc, path, "unmark");
|
|
1428
|
-
if (!_is_proxy(doc)) {
|
|
1429
|
-
throw new RangeError("object cannot be modified outside of a change block");
|
|
1430
|
-
}
|
|
1431
|
-
const state = _state(doc, false);
|
|
1432
|
-
try {
|
|
1433
|
-
return state.handle.unmark(objPath, range, name);
|
|
1434
|
-
} catch (e) {
|
|
1435
|
-
throw new RangeError(`Cannot unmark: ${e}`);
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
function absoluteObjPath(doc, path, functionName) {
|
|
1439
|
-
path = path.slice();
|
|
1440
|
-
const objectId = _obj(doc);
|
|
1441
|
-
if (!objectId) {
|
|
1442
|
-
throw new RangeError(`invalid object for ${functionName}`);
|
|
1443
|
-
}
|
|
1444
|
-
path.unshift(objectId);
|
|
1445
|
-
return path.join("/");
|
|
1446
|
-
}
|
|
1447
|
-
function autoproduce(payload) {
|
|
1448
|
-
return (doc) => applyPatches(doc, payload.patches);
|
|
1449
|
-
}
|
|
1450
|
-
var cache = /* @__PURE__ */ new WeakMap();
|
|
1451
|
-
function initial(handle) {
|
|
1452
|
-
const template = {};
|
|
1453
|
-
applyPatches(template, diff(handle.doc(), [], getHeads(handle.doc())));
|
|
1454
|
-
return template;
|
|
1455
|
-
}
|
|
1456
|
-
function makeDocumentProjection(handle) {
|
|
1457
|
-
onCleanup(() => {
|
|
1458
|
-
const item = cache.get(handle);
|
|
1459
|
-
if (!item) return;
|
|
1460
|
-
if (!item.refs--) {
|
|
1461
|
-
item.cleanup();
|
|
1462
|
-
}
|
|
1463
|
-
});
|
|
1464
|
-
if (cache.has(handle)) {
|
|
1465
|
-
const item = cache.get(handle);
|
|
1466
|
-
item.refs++;
|
|
1467
|
-
return item.store;
|
|
1468
|
-
}
|
|
1469
|
-
const [doc, set] = createStore(initial(handle));
|
|
1470
|
-
cache.set(handle, {
|
|
1471
|
-
refs: 0,
|
|
1472
|
-
store: doc,
|
|
1473
|
-
cleanup() {
|
|
1474
|
-
handle.off("change", patch);
|
|
1475
|
-
handle.off("delete", ondelete);
|
|
1476
|
-
cache.delete(handle);
|
|
1477
|
-
}
|
|
1478
|
-
});
|
|
1479
|
-
function patch(payload) {
|
|
1480
|
-
set(produce(autoproduce(payload)));
|
|
1481
|
-
}
|
|
1482
|
-
function ondelete() {
|
|
1483
|
-
set(reconcile({}));
|
|
1484
|
-
}
|
|
1485
|
-
handle.on("change", patch);
|
|
1486
|
-
handle.on("delete", ondelete);
|
|
1487
|
-
return doc;
|
|
1488
|
-
}
|
|
1489
|
-
function createDocumentProjection(handle) {
|
|
1490
|
-
const projection = createMemo(() => {
|
|
1491
|
-
const unwrappedHandle = typeof handle == "function" ? handle() : handle;
|
|
1492
|
-
return unwrappedHandle && makeDocumentProjection(unwrappedHandle);
|
|
1493
|
-
});
|
|
1494
|
-
return projection;
|
|
1495
|
-
}
|
|
1496
|
-
var RepoContext = createContext(
|
|
1497
|
-
null
|
|
1498
|
-
);
|
|
1499
|
-
|
|
1500
|
-
// ../node_modules/.pnpm/@inkandswitch+patchwork-providers@0.2.2_@automerge+automerge-repo@2.6.0-subduction.39_supports-color@7.2.0_/node_modules/@inkandswitch/patchwork-providers/dist/index.js
|
|
1501
|
-
function subscribe(element, selector, listener) {
|
|
1502
|
-
const view = element.closest("patchwork-view");
|
|
1503
|
-
const dispatchEl = view ?? element;
|
|
1504
|
-
const channel = new MessageChannel();
|
|
1505
|
-
const port = channel.port2;
|
|
1506
|
-
const controller = new AbortController();
|
|
1507
|
-
const { signal } = controller;
|
|
1508
|
-
port.addEventListener("message", (event) => {
|
|
1509
|
-
if (event.data?.type === "change")
|
|
1510
|
-
listener(event.data.value);
|
|
1511
|
-
}, { signal });
|
|
1512
|
-
port.start();
|
|
1513
|
-
const detail = {
|
|
1514
|
-
selector,
|
|
1515
|
-
port: channel.port1
|
|
1516
|
-
};
|
|
1517
|
-
dispatchEl.dispatchEvent(new CustomEvent("patchwork:subscribe", {
|
|
1518
|
-
detail,
|
|
1519
|
-
bubbles: true,
|
|
1520
|
-
composed: true
|
|
1521
|
-
}));
|
|
1522
|
-
return () => {
|
|
1523
|
-
if (signal.aborted)
|
|
1524
|
-
return;
|
|
1525
|
-
controller.abort();
|
|
1526
|
-
port.postMessage({ type: "unsubscribe" });
|
|
1527
|
-
port.close();
|
|
1528
|
-
};
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
// ../node_modules/.pnpm/@inkandswitch+patchwork-providers-solid@0.2.3_@automerge+automerge-repo-solid-primitive_28dd2c0a72a3f744c852d31b58e8c7bb/node_modules/@inkandswitch/patchwork-providers-solid/dist/index.js
|
|
1532
|
-
function resolveElement(source) {
|
|
1533
|
-
return typeof source === "function" ? source() : source;
|
|
1534
|
-
}
|
|
1535
|
-
function subscribe2(element, selector, initialValue) {
|
|
1536
|
-
const [value, setValue] = createSignal2(initialValue);
|
|
1537
|
-
onMount(() => {
|
|
1538
|
-
const target = resolveElement(element);
|
|
1539
|
-
if (!target)
|
|
1540
|
-
return;
|
|
1541
|
-
const unsubscribe = subscribe(target, selector, setValue);
|
|
1542
|
-
onCleanup2(unsubscribe);
|
|
1543
|
-
});
|
|
1544
|
-
return value;
|
|
1545
|
-
}
|
|
1546
|
-
function subscribeDoc(element, selector) {
|
|
1547
|
-
const [handle, setHandle] = createSignal2(void 0);
|
|
1548
|
-
onMount(() => {
|
|
1549
|
-
const target = resolveElement(element);
|
|
1550
|
-
if (!target)
|
|
1551
|
-
return;
|
|
1552
|
-
let canceled = false;
|
|
1553
|
-
const unsubscribe = subscribe(target, selector, (url) => {
|
|
1554
|
-
if (!url)
|
|
1555
|
-
return;
|
|
1556
|
-
const repo = "repo" in window ? window.repo : void 0;
|
|
1557
|
-
if (!repo)
|
|
1558
|
-
return;
|
|
1559
|
-
void Promise.resolve(repo.find(url)).then((h) => {
|
|
1560
|
-
if (canceled)
|
|
1561
|
-
return;
|
|
1562
|
-
setHandle(() => h);
|
|
1563
|
-
});
|
|
1564
|
-
});
|
|
1565
|
-
onCleanup2(() => {
|
|
1566
|
-
canceled = true;
|
|
1567
|
-
unsubscribe();
|
|
1568
|
-
});
|
|
1569
|
-
});
|
|
1570
|
-
const doc = createDocumentProjection(handle);
|
|
1571
|
-
return [doc, handle];
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
// src/tool.tsx
|
|
1575
|
-
import { createMemo as createMemo2, createResource as createResource2, createSignal as createSignal3, onMount as onMount2 } from "solid-js";
|
|
1576
|
-
var _tmpl$ = /* @__PURE__ */ _$template(`<div style="width:100%;height:100%;overflow:auto;position:relative;background:var(--studio-fill, white)"><div style=padding:1rem;height:100%><div style=display:flex;height:100%><div style=position:relative;flex:1;height:100%>`);
|
|
1577
|
-
var PATH = ["content"];
|
|
1578
|
-
function CodeMirrorEditor(props) {
|
|
1579
|
-
const isReadOnly = props.handle.isReadOnly();
|
|
1580
|
-
const baseline = subscribe2(props.element, {
|
|
1581
|
-
type: "draft:baseline",
|
|
1582
|
-
url: props.handle.url
|
|
1583
|
-
}, {
|
|
1584
|
-
heads: null
|
|
1585
|
-
});
|
|
1586
|
-
const commentEntries = subscribe2(props.element, {
|
|
1587
|
-
type: "patchwork:comments"
|
|
1588
|
-
}, []);
|
|
1589
|
-
const [focusDoc, focusHandle] = subscribeDoc(props.element, {
|
|
1590
|
-
type: "patchwork:focus"
|
|
1591
|
-
});
|
|
1592
|
-
const contactUrl = subscribe2(props.element, {
|
|
1593
|
-
type: "patchwork:contact"
|
|
1594
|
-
});
|
|
1595
|
-
const [commentTargets] = createResource2(commentEntries, (entries) => getDedupedCommentTargets(entries, props.handle.url, props.repo), {
|
|
1596
|
-
initialValue: []
|
|
1597
|
-
});
|
|
1598
|
-
const focusRefUrls = createMemo2(() => {
|
|
1599
|
-
const doc = focusDoc();
|
|
1600
|
-
return [...Object.keys(doc?.selection ?? {}), ...Object.keys(doc?.highlight ?? {})];
|
|
1601
|
-
});
|
|
1602
|
-
const [emphasisTargets] = createResource2(focusRefUrls, async (urls) => resolveSubDocUrlsOfDoc(urls, props.handle.url, props.repo), {
|
|
1603
|
-
initialValue: []
|
|
1604
|
-
});
|
|
1605
|
-
const scrollTarget = createMemo2(() => {
|
|
1606
|
-
let from = Infinity;
|
|
1607
|
-
let to = -Infinity;
|
|
1608
|
-
for (const ref of emphasisTargets()) {
|
|
1609
|
-
const positions = ref.rangePositions();
|
|
1610
|
-
if (!positions) continue;
|
|
1611
|
-
const [start, end] = positions;
|
|
1612
|
-
from = Math.min(from, start);
|
|
1613
|
-
to = Math.max(to, end);
|
|
1614
|
-
}
|
|
1615
|
-
return from <= to ? [from, to] : null;
|
|
1616
|
-
});
|
|
1617
|
-
let lastEmittedUrl;
|
|
1618
|
-
const onChangeSelection = (from, to) => {
|
|
1619
|
-
const handle = focusHandle();
|
|
1620
|
-
if (!handle) return;
|
|
1621
|
-
const nextUrl = props.handle.sub(...PATH, cursor2(from, to)).url;
|
|
1622
|
-
if (nextUrl === lastEmittedUrl) return;
|
|
1623
|
-
handle.change((doc) => {
|
|
1624
|
-
doc.selection = {
|
|
1625
|
-
[nextUrl]: true
|
|
1626
|
-
};
|
|
1627
|
-
});
|
|
1628
|
-
lastEmittedUrl = nextUrl;
|
|
1629
|
-
};
|
|
1630
|
-
const decorations = () => {
|
|
1631
|
-
const targetRefs = commentTargets();
|
|
1632
|
-
const emphasisRefs = emphasisTargets();
|
|
1633
|
-
return RangeSet.of(
|
|
1634
|
-
buildCommentDecorations(targetRefs, emphasisRefs),
|
|
1635
|
-
true
|
|
1636
|
-
// sort ranges
|
|
1637
|
-
);
|
|
1638
|
-
};
|
|
1639
|
-
const createThreadForRange = (from, to) => {
|
|
1640
|
-
const url = contactUrl();
|
|
1641
|
-
if (!url) {
|
|
1642
|
-
console.warn("Cannot create comment: no contactUrl available");
|
|
1643
|
-
return null;
|
|
1644
|
-
}
|
|
1645
|
-
return createCommentForRange(props.handle, PATH, from, to, url);
|
|
1646
|
-
};
|
|
1647
|
-
const threadAtPos = (pos) => {
|
|
1648
|
-
const threadByTarget = /* @__PURE__ */ new Map();
|
|
1649
|
-
for (const entry of commentEntries()) {
|
|
1650
|
-
threadByTarget.set(entry.targetUrl, entry.threadUrl);
|
|
1651
|
-
}
|
|
1652
|
-
for (const handle of commentTargets()) {
|
|
1653
|
-
const positions = handle.rangePositions();
|
|
1654
|
-
if (!positions) continue;
|
|
1655
|
-
const [start, end] = positions;
|
|
1656
|
-
if (start === end || pos < start || pos > end) continue;
|
|
1657
|
-
const threadUrl = threadByTarget.get(handle.url);
|
|
1658
|
-
if (threadUrl) return {
|
|
1659
|
-
threadUrl,
|
|
1660
|
-
from: start
|
|
1661
|
-
};
|
|
1662
|
-
}
|
|
1663
|
-
return null;
|
|
1664
|
-
};
|
|
1665
|
-
const findThreadByUrl = (threadUrl) => {
|
|
1666
|
-
const threads = props.handle.doc()?.["@comments"]?.threads ?? [];
|
|
1667
|
-
return threads.find((thread) => props.handle.sub("@comments", "threads", {
|
|
1668
|
-
id: thread.id
|
|
1669
|
-
}).url === threadUrl);
|
|
1670
|
-
};
|
|
1671
|
-
const watchThreadForClose = (threadUrl, close) => {
|
|
1672
|
-
const contact = contactUrl();
|
|
1673
|
-
const hasOwnDraft = (thread) => thread.comments.some((c) => c.contactUrl === contact && (c.draftContent !== void 0 || c.content === void 0));
|
|
1674
|
-
const seed = findThreadByUrl(threadUrl);
|
|
1675
|
-
let sawDraft = seed ? hasOwnDraft(seed) : false;
|
|
1676
|
-
const onChange = () => {
|
|
1677
|
-
const thread = findThreadByUrl(threadUrl);
|
|
1678
|
-
if (!thread) return close();
|
|
1679
|
-
if (hasOwnDraft(thread)) sawDraft = true;
|
|
1680
|
-
else if (sawDraft) close();
|
|
1681
|
-
};
|
|
1682
|
-
props.handle.on("change", onChange);
|
|
1683
|
-
return () => props.handle.off("change", onChange);
|
|
1684
|
-
};
|
|
1685
|
-
const onClosePopover = (threadUrl) => {
|
|
1686
|
-
const contact = contactUrl();
|
|
1687
|
-
const isEmptyOwnDraft = (c) => c.contactUrl === contact && c.content === void 0 && (c.draftContent === void 0 || c.draftContent.trim() === "");
|
|
1688
|
-
const thread = findThreadByUrl(threadUrl);
|
|
1689
|
-
if (!thread || !thread.comments.some(isEmptyOwnDraft)) return;
|
|
1690
|
-
const threadId = thread.id;
|
|
1691
|
-
queueMicrotask(() => {
|
|
1692
|
-
props.handle.change((doc) => {
|
|
1693
|
-
const list = doc["@comments"]?.threads;
|
|
1694
|
-
if (!list) return;
|
|
1695
|
-
const index = list.findIndex((t) => t.id === threadId);
|
|
1696
|
-
if (index === -1) return;
|
|
1697
|
-
const target = list[index];
|
|
1698
|
-
for (let i = target.comments.length - 1; i >= 0; i--) {
|
|
1699
|
-
if (isEmptyOwnDraft(target.comments[i])) target.comments.splice(i, 1);
|
|
1700
|
-
}
|
|
1701
|
-
if (target.comments.length === 0) list.splice(index, 1);
|
|
1702
|
-
});
|
|
1703
|
-
});
|
|
1704
|
-
};
|
|
1705
|
-
const [extensions, setExtensions] = createSignal3([commentUI({
|
|
1706
|
-
createThreadForRange,
|
|
1707
|
-
threadAtPos,
|
|
1708
|
-
watchThreadForClose,
|
|
1709
|
-
onClose: onClosePopover
|
|
1710
|
-
})]);
|
|
1711
|
-
onMount2(async () => {
|
|
1712
|
-
const loaded = await loadCodeMirrorExtensionsForDoc(props.handle);
|
|
1713
|
-
setExtensions((exts) => [...exts, ...loaded]);
|
|
1714
|
-
});
|
|
1715
|
-
return (() => {
|
|
1716
|
-
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild;
|
|
1717
|
-
_$insert(_el$4, _$createComponent(CodeMirror, {
|
|
1718
|
-
get handle() {
|
|
1719
|
-
return props.handle;
|
|
1720
|
-
},
|
|
1721
|
-
path: PATH,
|
|
1722
|
-
decorations,
|
|
1723
|
-
baseline: () => baseline()?.heads ?? null,
|
|
1724
|
-
get extensions() {
|
|
1725
|
-
return extensions();
|
|
1726
|
-
},
|
|
1727
|
-
readOnly: isReadOnly,
|
|
1728
|
-
onChangeSelection,
|
|
1729
|
-
scrollTarget
|
|
1730
|
-
}));
|
|
1731
|
-
return _el$;
|
|
1732
|
-
})();
|
|
1733
|
-
}
|
|
1734
|
-
var mount = (handle, element) => render(() => _$createComponent(CodeMirrorEditor, {
|
|
1735
|
-
handle,
|
|
1736
|
-
get repo() {
|
|
1737
|
-
return element.repo;
|
|
1738
|
-
},
|
|
1739
|
-
element
|
|
1740
|
-
}), element);
|
|
1741
|
-
async function getDedupedCommentTargets(comments, docUrl, repo) {
|
|
1742
|
-
if (!comments) return [];
|
|
1743
|
-
const overlappingRefs = /* @__PURE__ */ new Set();
|
|
1744
|
-
for (const comment of comments) {
|
|
1745
|
-
if (comment.targetUrl.startsWith(docUrl)) {
|
|
1746
|
-
const target = await repo.find(comment.targetUrl);
|
|
1747
|
-
overlappingRefs.add(target);
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
return Array.from(overlappingRefs);
|
|
1751
|
-
}
|
|
1752
|
-
async function resolveSubDocUrlsOfDoc(urls, docUrl, repo) {
|
|
1753
|
-
const refs = /* @__PURE__ */ new Set();
|
|
1754
|
-
for (const url of urls) {
|
|
1755
|
-
if (url.startsWith(docUrl)) {
|
|
1756
|
-
refs.add(await repo.find(url));
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
|
-
return Array.from(refs);
|
|
1760
|
-
}
|
|
1761
|
-
function buildCommentDecorations(targetRefs, emphasisRefs) {
|
|
1762
|
-
const out = [];
|
|
1763
|
-
for (const ref of targetRefs) {
|
|
1764
|
-
const positions = ref.rangePositions();
|
|
1765
|
-
if (!positions) continue;
|
|
1766
|
-
const [start, end] = positions;
|
|
1767
|
-
if (start === end) continue;
|
|
1768
|
-
const isEmphasised = emphasisRefs.some((s) => s.overlaps(ref));
|
|
1769
|
-
out.push(Decoration.mark({
|
|
1770
|
-
attributes: {
|
|
1771
|
-
style: commentTargetStyle(isEmphasised)
|
|
1772
|
-
}
|
|
1773
|
-
}).range(start, end));
|
|
1774
|
-
}
|
|
1775
|
-
return out;
|
|
1776
|
-
}
|
|
1777
|
-
function commentTargetStyle(isEmphasised) {
|
|
1778
|
-
const paper = isEmphasised ? "56%" : "82%";
|
|
1779
|
-
return `
|
|
1780
|
-
border-bottom: 2px solid var(--text-editor-secondary-text);
|
|
1781
|
-
background-color: color-mix(in oklch, var(--studio-secondary), var(--text-editor-fill) ${paper});
|
|
1782
|
-
`;
|
|
1783
|
-
}
|
|
1784
|
-
async function loadCodeMirrorExtensionsForDoc(handle) {
|
|
1785
|
-
const docType = handle.doc()?.["@patchwork"]?.type;
|
|
1786
|
-
const registry = getRegistry("codemirror:extension");
|
|
1787
|
-
const loaded = await registry.loadAll(registry.filter((ext) => {
|
|
1788
|
-
return ext.supportedDatatypes === "*" || Array.isArray(ext.supportedDatatypes) && ext.supportedDatatypes.includes(docType);
|
|
1789
|
-
}));
|
|
1790
|
-
return loaded.flatMap((ext) => {
|
|
1791
|
-
const impl = ext.module;
|
|
1792
|
-
return Array.isArray(impl) ? impl : [impl];
|
|
1793
|
-
});
|
|
1794
|
-
}
|
|
1795
|
-
export {
|
|
1796
|
-
CodeMirrorEditor,
|
|
1797
|
-
mount
|
|
1798
|
-
};
|
|
1799
|
-
//# sourceMappingURL=tool.js.map
|