@muze-nl/simplystore 0.3.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/package.json +2 -2
  2. package/package.json~ +33 -0
  3. package/src/server.mjs +68 -61
  4. package/www/codemirror/addon/comment/comment.js +0 -211
  5. package/www/codemirror/addon/comment/continuecomment.js +0 -114
  6. package/www/codemirror/addon/dialog/dialog.css +0 -32
  7. package/www/codemirror/addon/dialog/dialog.js +0 -163
  8. package/www/codemirror/addon/display/autorefresh.js +0 -47
  9. package/www/codemirror/addon/display/fullscreen.css +0 -6
  10. package/www/codemirror/addon/display/fullscreen.js +0 -41
  11. package/www/codemirror/addon/display/panel.js +0 -133
  12. package/www/codemirror/addon/display/placeholder.js +0 -78
  13. package/www/codemirror/addon/display/rulers.js +0 -51
  14. package/www/codemirror/addon/edit/closebrackets.js +0 -201
  15. package/www/codemirror/addon/edit/closetag.js +0 -185
  16. package/www/codemirror/addon/edit/continuelist.js +0 -101
  17. package/www/codemirror/addon/edit/matchbrackets.js +0 -160
  18. package/www/codemirror/addon/edit/matchtags.js +0 -66
  19. package/www/codemirror/addon/edit/trailingspace.js +0 -27
  20. package/www/codemirror/addon/fold/brace-fold.js +0 -119
  21. package/www/codemirror/addon/fold/comment-fold.js +0 -59
  22. package/www/codemirror/addon/fold/foldcode.js +0 -159
  23. package/www/codemirror/addon/fold/foldgutter.css +0 -20
  24. package/www/codemirror/addon/fold/foldgutter.js +0 -169
  25. package/www/codemirror/addon/fold/indent-fold.js +0 -48
  26. package/www/codemirror/addon/fold/markdown-fold.js +0 -49
  27. package/www/codemirror/addon/fold/xml-fold.js +0 -184
  28. package/www/codemirror/addon/hint/anyword-hint.js +0 -41
  29. package/www/codemirror/addon/hint/css-hint.js +0 -66
  30. package/www/codemirror/addon/hint/html-hint.js +0 -351
  31. package/www/codemirror/addon/hint/javascript-hint.js +0 -162
  32. package/www/codemirror/addon/hint/show-hint.css +0 -37
  33. package/www/codemirror/addon/hint/show-hint.js +0 -523
  34. package/www/codemirror/addon/hint/sql-hint.js +0 -304
  35. package/www/codemirror/addon/hint/xml-hint.js +0 -132
  36. package/www/codemirror/addon/lint/coffeescript-lint.js +0 -47
  37. package/www/codemirror/addon/lint/css-lint.js +0 -40
  38. package/www/codemirror/addon/lint/html-lint.js +0 -59
  39. package/www/codemirror/addon/lint/json-lint.js +0 -40
  40. package/www/codemirror/addon/lint/yaml-lint.js +0 -41
  41. package/www/codemirror/addon/merge/merge.css +0 -119
  42. package/www/codemirror/addon/merge/merge.js +0 -1018
  43. package/www/codemirror/addon/mode/loadmode.js +0 -66
  44. package/www/codemirror/addon/mode/multiplex.js +0 -136
  45. package/www/codemirror/addon/mode/multiplex_test.js +0 -49
  46. package/www/codemirror/addon/mode/overlay.js +0 -90
  47. package/www/codemirror/addon/mode/simple.js +0 -216
  48. package/www/codemirror/addon/runmode/colorize.js +0 -40
  49. package/www/codemirror/addon/runmode/runmode-standalone.js +0 -334
  50. package/www/codemirror/addon/runmode/runmode.js +0 -76
  51. package/www/codemirror/addon/runmode/runmode.node.js +0 -329
  52. package/www/codemirror/addon/scroll/annotatescrollbar.js +0 -128
  53. package/www/codemirror/addon/scroll/scrollpastend.js +0 -48
  54. package/www/codemirror/addon/scroll/simplescrollbars.css +0 -66
  55. package/www/codemirror/addon/scroll/simplescrollbars.js +0 -152
  56. package/www/codemirror/addon/search/jump-to-line.js +0 -53
  57. package/www/codemirror/addon/search/match-highlighter.js +0 -167
  58. package/www/codemirror/addon/search/matchesonscrollbar.css +0 -8
  59. package/www/codemirror/addon/search/matchesonscrollbar.js +0 -97
  60. package/www/codemirror/addon/search/search.js +0 -295
  61. package/www/codemirror/addon/search/searchcursor.js +0 -305
  62. package/www/codemirror/addon/selection/active-line.js +0 -72
  63. package/www/codemirror/addon/selection/mark-selection.js +0 -119
  64. package/www/codemirror/addon/selection/selection-pointer.js +0 -98
  65. package/www/codemirror/addon/tern/tern.css +0 -87
  66. package/www/codemirror/addon/tern/tern.js +0 -756
  67. package/www/codemirror/addon/tern/worker.js +0 -44
  68. package/www/codemirror/addon/wrap/hardwrap.js +0 -160
  69. package/www/codemirror/bin/source-highlight +0 -48
  70. package/www/codemirror/keymap/emacs.js +0 -545
  71. package/www/codemirror/keymap/sublime.js +0 -720
  72. package/www/codemirror/keymap/vim.js +0 -5978
  73. package/www/codemirror/mode/apl/apl.js +0 -174
  74. package/www/codemirror/mode/asciiarmor/asciiarmor.js +0 -74
  75. package/www/codemirror/mode/asn.1/asn.1.js +0 -204
  76. package/www/codemirror/mode/asterisk/asterisk.js +0 -220
  77. package/www/codemirror/mode/brainfuck/brainfuck.js +0 -85
  78. package/www/codemirror/mode/clike/clike.js +0 -940
  79. package/www/codemirror/mode/clojure/clojure.js +0 -292
  80. package/www/codemirror/mode/cmake/cmake.js +0 -97
  81. package/www/codemirror/mode/cobol/cobol.js +0 -255
  82. package/www/codemirror/mode/coffeescript/coffeescript.js +0 -359
  83. package/www/codemirror/mode/commonlisp/commonlisp.js +0 -125
  84. package/www/codemirror/mode/crystal/crystal.js +0 -433
  85. package/www/codemirror/mode/css/css.js +0 -862
  86. package/www/codemirror/mode/cypher/cypher.js +0 -152
  87. package/www/codemirror/mode/d/d.js +0 -223
  88. package/www/codemirror/mode/dart/dart.js +0 -166
  89. package/www/codemirror/mode/diff/diff.js +0 -47
  90. package/www/codemirror/mode/django/django.js +0 -356
  91. package/www/codemirror/mode/dockerfile/dockerfile.js +0 -211
  92. package/www/codemirror/mode/dtd/dtd.js +0 -142
  93. package/www/codemirror/mode/dylan/dylan.js +0 -352
  94. package/www/codemirror/mode/ebnf/ebnf.js +0 -195
  95. package/www/codemirror/mode/ecl/ecl.js +0 -206
  96. package/www/codemirror/mode/eiffel/eiffel.js +0 -160
  97. package/www/codemirror/mode/elm/elm.js +0 -245
  98. package/www/codemirror/mode/erlang/erlang.js +0 -619
  99. package/www/codemirror/mode/factor/factor.js +0 -85
  100. package/www/codemirror/mode/fcl/fcl.js +0 -173
  101. package/www/codemirror/mode/forth/forth.js +0 -180
  102. package/www/codemirror/mode/fortran/fortran.js +0 -188
  103. package/www/codemirror/mode/gas/gas.js +0 -353
  104. package/www/codemirror/mode/gfm/gfm.js +0 -129
  105. package/www/codemirror/mode/gherkin/gherkin.js +0 -178
  106. package/www/codemirror/mode/go/go.js +0 -187
  107. package/www/codemirror/mode/groovy/groovy.js +0 -247
  108. package/www/codemirror/mode/haml/haml.js +0 -161
  109. package/www/codemirror/mode/handlebars/handlebars.js +0 -70
  110. package/www/codemirror/mode/haskell/haskell.js +0 -268
  111. package/www/codemirror/mode/haskell-literate/haskell-literate.js +0 -43
  112. package/www/codemirror/mode/haxe/haxe.js +0 -515
  113. package/www/codemirror/mode/htmlembedded/htmlembedded.js +0 -37
  114. package/www/codemirror/mode/htmlmixed/htmlmixed.js +0 -153
  115. package/www/codemirror/mode/http/http.js +0 -113
  116. package/www/codemirror/mode/idl/idl.js +0 -290
  117. package/www/codemirror/mode/jinja2/jinja2.js +0 -193
  118. package/www/codemirror/mode/jsx/jsx.js +0 -148
  119. package/www/codemirror/mode/julia/julia.js +0 -390
  120. package/www/codemirror/mode/livescript/livescript.js +0 -280
  121. package/www/codemirror/mode/lua/lua.js +0 -160
  122. package/www/codemirror/mode/markdown/markdown.js +0 -886
  123. package/www/codemirror/mode/mathematica/mathematica.js +0 -176
  124. package/www/codemirror/mode/mbox/mbox.js +0 -129
  125. package/www/codemirror/mode/meta.js +0 -221
  126. package/www/codemirror/mode/mirc/mirc.js +0 -193
  127. package/www/codemirror/mode/mllike/mllike.js +0 -359
  128. package/www/codemirror/mode/modelica/modelica.js +0 -245
  129. package/www/codemirror/mode/mscgen/mscgen.js +0 -175
  130. package/www/codemirror/mode/mumps/mumps.js +0 -148
  131. package/www/codemirror/mode/nginx/nginx.js +0 -178
  132. package/www/codemirror/mode/nsis/nsis.js +0 -95
  133. package/www/codemirror/mode/ntriples/ntriples.js +0 -195
  134. package/www/codemirror/mode/octave/octave.js +0 -139
  135. package/www/codemirror/mode/oz/oz.js +0 -252
  136. package/www/codemirror/mode/pascal/pascal.js +0 -136
  137. package/www/codemirror/mode/pegjs/pegjs.js +0 -111
  138. package/www/codemirror/mode/perl/perl.js +0 -836
  139. package/www/codemirror/mode/php/php.js +0 -234
  140. package/www/codemirror/mode/pig/pig.js +0 -178
  141. package/www/codemirror/mode/powershell/powershell.js +0 -398
  142. package/www/codemirror/mode/properties/properties.js +0 -78
  143. package/www/codemirror/mode/protobuf/protobuf.js +0 -72
  144. package/www/codemirror/mode/pug/pug.js +0 -591
  145. package/www/codemirror/mode/puppet/puppet.js +0 -220
  146. package/www/codemirror/mode/python/python.js +0 -402
  147. package/www/codemirror/mode/q/q.js +0 -139
  148. package/www/codemirror/mode/r/r.js +0 -190
  149. package/www/codemirror/mode/rpm/changes/index.html +0 -66
  150. package/www/codemirror/mode/rpm/rpm.js +0 -109
  151. package/www/codemirror/mode/rst/rst.js +0 -557
  152. package/www/codemirror/mode/ruby/ruby.js +0 -303
  153. package/www/codemirror/mode/rust/rust.js +0 -72
  154. package/www/codemirror/mode/sas/sas.js +0 -303
  155. package/www/codemirror/mode/sass/sass.js +0 -459
  156. package/www/codemirror/mode/scheme/scheme.js +0 -284
  157. package/www/codemirror/mode/shell/shell.js +0 -168
  158. package/www/codemirror/mode/sieve/sieve.js +0 -193
  159. package/www/codemirror/mode/slim/slim.js +0 -575
  160. package/www/codemirror/mode/smalltalk/smalltalk.js +0 -168
  161. package/www/codemirror/mode/smarty/smarty.js +0 -225
  162. package/www/codemirror/mode/solr/solr.js +0 -104
  163. package/www/codemirror/mode/soy/soy.js +0 -665
  164. package/www/codemirror/mode/sparql/sparql.js +0 -184
  165. package/www/codemirror/mode/spreadsheet/spreadsheet.js +0 -112
  166. package/www/codemirror/mode/sql/sql.js +0 -525
  167. package/www/codemirror/mode/stex/stex.js +0 -264
  168. package/www/codemirror/mode/stylus/stylus.js +0 -775
  169. package/www/codemirror/mode/swift/swift.js +0 -221
  170. package/www/codemirror/mode/tcl/tcl.js +0 -140
  171. package/www/codemirror/mode/textile/textile.js +0 -469
  172. package/www/codemirror/mode/tiddlywiki/tiddlywiki.css +0 -14
  173. package/www/codemirror/mode/tiddlywiki/tiddlywiki.js +0 -308
  174. package/www/codemirror/mode/tiki/tiki.css +0 -26
  175. package/www/codemirror/mode/tiki/tiki.js +0 -312
  176. package/www/codemirror/mode/toml/toml.js +0 -88
  177. package/www/codemirror/mode/tornado/tornado.js +0 -68
  178. package/www/codemirror/mode/troff/troff.js +0 -84
  179. package/www/codemirror/mode/ttcn/ttcn.js +0 -283
  180. package/www/codemirror/mode/ttcn-cfg/ttcn-cfg.js +0 -214
  181. package/www/codemirror/mode/turtle/turtle.js +0 -162
  182. package/www/codemirror/mode/twig/twig.js +0 -141
  183. package/www/codemirror/mode/vb/vb.js +0 -275
  184. package/www/codemirror/mode/vbscript/vbscript.js +0 -350
  185. package/www/codemirror/mode/velocity/velocity.js +0 -202
  186. package/www/codemirror/mode/verilog/verilog.js +0 -781
  187. package/www/codemirror/mode/vhdl/vhdl.js +0 -189
  188. package/www/codemirror/mode/vue/vue.js +0 -77
  189. package/www/codemirror/mode/wast/wast.js +0 -132
  190. package/www/codemirror/mode/webidl/webidl.js +0 -195
  191. package/www/codemirror/mode/xml/xml.js +0 -417
  192. package/www/codemirror/mode/xquery/xquery.js +0 -448
  193. package/www/codemirror/mode/yacas/yacas.js +0 -204
  194. package/www/codemirror/mode/yaml/yaml.js +0 -120
  195. package/www/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +0 -72
  196. package/www/codemirror/mode/z80/z80.js +0 -116
  197. package/www/codemirror/rollup.config.js +0 -52
  198. package/www/codemirror/src/addon/runmode/codemirror-standalone.js +0 -24
  199. package/www/codemirror/src/addon/runmode/codemirror.node.js +0 -21
  200. package/www/codemirror/src/addon/runmode/runmode-standalone.js +0 -2
  201. package/www/codemirror/src/addon/runmode/runmode.node.js +0 -2
  202. package/www/codemirror/src/codemirror.js +0 -3
  203. package/www/codemirror/src/display/Display.js +0 -116
  204. package/www/codemirror/src/display/focus.js +0 -50
  205. package/www/codemirror/src/display/gutters.js +0 -44
  206. package/www/codemirror/src/display/highlight_worker.js +0 -55
  207. package/www/codemirror/src/display/line_numbers.js +0 -48
  208. package/www/codemirror/src/display/mode_state.js +0 -22
  209. package/www/codemirror/src/display/operations.js +0 -206
  210. package/www/codemirror/src/display/scroll_events.js +0 -132
  211. package/www/codemirror/src/display/scrollbars.js +0 -194
  212. package/www/codemirror/src/display/scrolling.js +0 -186
  213. package/www/codemirror/src/display/selection.js +0 -173
  214. package/www/codemirror/src/display/update_display.js +0 -267
  215. package/www/codemirror/src/display/update_line.js +0 -189
  216. package/www/codemirror/src/display/update_lines.js +0 -82
  217. package/www/codemirror/src/display/view_tracking.js +0 -153
  218. package/www/codemirror/src/edit/CodeMirror.js +0 -217
  219. package/www/codemirror/src/edit/commands.js +0 -178
  220. package/www/codemirror/src/edit/deleteNearSelection.js +0 -30
  221. package/www/codemirror/src/edit/drop_events.js +0 -130
  222. package/www/codemirror/src/edit/fromTextArea.js +0 -61
  223. package/www/codemirror/src/edit/global_events.js +0 -45
  224. package/www/codemirror/src/edit/key_events.js +0 -163
  225. package/www/codemirror/src/edit/legacy.js +0 -62
  226. package/www/codemirror/src/edit/main.js +0 -69
  227. package/www/codemirror/src/edit/methods.js +0 -555
  228. package/www/codemirror/src/edit/mouse_events.js +0 -417
  229. package/www/codemirror/src/edit/options.js +0 -194
  230. package/www/codemirror/src/edit/utils.js +0 -7
  231. package/www/codemirror/src/input/ContentEditableInput.js +0 -546
  232. package/www/codemirror/src/input/TextareaInput.js +0 -380
  233. package/www/codemirror/src/input/indent.js +0 -71
  234. package/www/codemirror/src/input/input.js +0 -134
  235. package/www/codemirror/src/input/keymap.js +0 -147
  236. package/www/codemirror/src/input/keynames.js +0 -17
  237. package/www/codemirror/src/input/movement.js +0 -111
  238. package/www/codemirror/src/line/highlight.js +0 -284
  239. package/www/codemirror/src/line/line_data.js +0 -349
  240. package/www/codemirror/src/line/pos.js +0 -40
  241. package/www/codemirror/src/line/saw_special_spans.js +0 -10
  242. package/www/codemirror/src/line/spans.js +0 -390
  243. package/www/codemirror/src/line/utils_line.js +0 -85
  244. package/www/codemirror/src/measurement/position_measurement.js +0 -702
  245. package/www/codemirror/src/measurement/widgets.js +0 -26
  246. package/www/codemirror/src/model/Doc.js +0 -436
  247. package/www/codemirror/src/model/change_measurement.js +0 -61
  248. package/www/codemirror/src/model/changes.js +0 -339
  249. package/www/codemirror/src/model/chunk.js +0 -167
  250. package/www/codemirror/src/model/document_data.js +0 -112
  251. package/www/codemirror/src/model/history.js +0 -228
  252. package/www/codemirror/src/model/line_widget.js +0 -78
  253. package/www/codemirror/src/model/mark_text.js +0 -293
  254. package/www/codemirror/src/model/selection.js +0 -84
  255. package/www/codemirror/src/model/selection_updates.js +0 -216
  256. package/www/codemirror/src/modes.js +0 -96
  257. package/www/codemirror/src/util/StringStream.js +0 -90
  258. package/www/codemirror/src/util/bidi.js +0 -215
  259. package/www/codemirror/src/util/browser.js +0 -34
  260. package/www/codemirror/src/util/dom.js +0 -101
  261. package/www/codemirror/src/util/event.js +0 -103
  262. package/www/codemirror/src/util/feature_detection.js +0 -84
  263. package/www/codemirror/src/util/misc.js +0 -168
  264. package/www/codemirror/src/util/operation_group.js +0 -72
  265. package/www/codemirror/theme/3024-day.css +0 -41
  266. package/www/codemirror/theme/3024-night.css +0 -39
  267. package/www/codemirror/theme/abbott.css +0 -268
  268. package/www/codemirror/theme/abcdef.css +0 -32
  269. package/www/codemirror/theme/ambiance-mobile.css +0 -5
  270. package/www/codemirror/theme/ambiance.css +0 -74
  271. package/www/codemirror/theme/ayu-dark.css +0 -44
  272. package/www/codemirror/theme/ayu-mirage.css +0 -45
  273. package/www/codemirror/theme/base16-dark.css +0 -40
  274. package/www/codemirror/theme/base16-light.css +0 -38
  275. package/www/codemirror/theme/bespin.css +0 -34
  276. package/www/codemirror/theme/blackboard.css +0 -32
  277. package/www/codemirror/theme/cobalt.css +0 -25
  278. package/www/codemirror/theme/colorforth.css +0 -33
  279. package/www/codemirror/theme/darcula.css +0 -53
  280. package/www/codemirror/theme/dracula.css +0 -40
  281. package/www/codemirror/theme/duotone-dark.css +0 -35
  282. package/www/codemirror/theme/duotone-light.css +0 -36
  283. package/www/codemirror/theme/eclipse.css +0 -23
  284. package/www/codemirror/theme/elegant.css +0 -13
  285. package/www/codemirror/theme/erlang-dark.css +0 -34
  286. package/www/codemirror/theme/gruvbox-dark.css +0 -39
  287. package/www/codemirror/theme/hopscotch.css +0 -34
  288. package/www/codemirror/theme/icecoder.css +0 -43
  289. package/www/codemirror/theme/idea.css +0 -42
  290. package/www/codemirror/theme/isotope.css +0 -34
  291. package/www/codemirror/theme/juejin.css +0 -30
  292. package/www/codemirror/theme/lesser-dark.css +0 -47
  293. package/www/codemirror/theme/liquibyte.css +0 -95
  294. package/www/codemirror/theme/lucario.css +0 -37
  295. package/www/codemirror/theme/material-darker.css +0 -135
  296. package/www/codemirror/theme/material-palenight.css +0 -141
  297. package/www/codemirror/theme/material.css +0 -141
  298. package/www/codemirror/theme/mbo.css +0 -37
  299. package/www/codemirror/theme/mdn-like.css +0 -46
  300. package/www/codemirror/theme/midnight.css +0 -39
  301. package/www/codemirror/theme/monokai.css +0 -41
  302. package/www/codemirror/theme/moxer.css +0 -143
  303. package/www/codemirror/theme/neat.css +0 -12
  304. package/www/codemirror/theme/neo.css +0 -43
  305. package/www/codemirror/theme/night.css +0 -27
  306. package/www/codemirror/theme/nord.css +0 -42
  307. package/www/codemirror/theme/oceanic-next.css +0 -46
  308. package/www/codemirror/theme/panda-syntax.css +0 -85
  309. package/www/codemirror/theme/paraiso-dark.css +0 -38
  310. package/www/codemirror/theme/paraiso-light.css +0 -38
  311. package/www/codemirror/theme/pastel-on-dark.css +0 -52
  312. package/www/codemirror/theme/railscasts.css +0 -34
  313. package/www/codemirror/theme/rubyblue.css +0 -25
  314. package/www/codemirror/theme/seti.css +0 -44
  315. package/www/codemirror/theme/shadowfox.css +0 -52
  316. package/www/codemirror/theme/solarized.css +0 -165
  317. package/www/codemirror/theme/ssms.css +0 -16
  318. package/www/codemirror/theme/the-matrix.css +0 -30
  319. package/www/codemirror/theme/tomorrow-night-bright.css +0 -35
  320. package/www/codemirror/theme/tomorrow-night-eighties.css +0 -38
  321. package/www/codemirror/theme/ttcn.css +0 -64
  322. package/www/codemirror/theme/twilight.css +0 -32
  323. package/www/codemirror/theme/vibrant-ink.css +0 -34
  324. package/www/codemirror/theme/xq-dark.css +0 -53
  325. package/www/codemirror/theme/xq-light.css +0 -43
  326. package/www/codemirror/theme/yeti.css +0 -44
  327. package/www/codemirror/theme/yonce.css +0 -59
  328. package/www/codemirror/theme/zenburn.css +0 -37
@@ -1,216 +0,0 @@
1
- import { signalLater } from "../util/operation_group.js"
2
- import { ensureCursorVisible } from "../display/scrolling.js"
3
- import { clipPos, cmp, Pos } from "../line/pos.js"
4
- import { getLine } from "../line/utils_line.js"
5
- import { hasHandler, signal, signalCursorActivity } from "../util/event.js"
6
- import { lst, sel_dontScroll } from "../util/misc.js"
7
-
8
- import { addSelectionToHistory } from "./history.js"
9
- import { normalizeSelection, Range, Selection, simpleSelection } from "./selection.js"
10
-
11
- // The 'scroll' parameter given to many of these indicated whether
12
- // the new cursor position should be scrolled into view after
13
- // modifying the selection.
14
-
15
- // If shift is held or the extend flag is set, extends a range to
16
- // include a given position (and optionally a second position).
17
- // Otherwise, simply returns the range between the given positions.
18
- // Used for cursor motion and such.
19
- export function extendRange(range, head, other, extend) {
20
- if (extend) {
21
- let anchor = range.anchor
22
- if (other) {
23
- let posBefore = cmp(head, anchor) < 0
24
- if (posBefore != (cmp(other, anchor) < 0)) {
25
- anchor = head
26
- head = other
27
- } else if (posBefore != (cmp(head, other) < 0)) {
28
- head = other
29
- }
30
- }
31
- return new Range(anchor, head)
32
- } else {
33
- return new Range(other || head, head)
34
- }
35
- }
36
-
37
- // Extend the primary selection range, discard the rest.
38
- export function extendSelection(doc, head, other, options, extend) {
39
- if (extend == null) extend = doc.cm && (doc.cm.display.shift || doc.extend)
40
- setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options)
41
- }
42
-
43
- // Extend all selections (pos is an array of selections with length
44
- // equal the number of selections)
45
- export function extendSelections(doc, heads, options) {
46
- let out = []
47
- let extend = doc.cm && (doc.cm.display.shift || doc.extend)
48
- for (let i = 0; i < doc.sel.ranges.length; i++)
49
- out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend)
50
- let newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex)
51
- setSelection(doc, newSel, options)
52
- }
53
-
54
- // Updates a single range in the selection.
55
- export function replaceOneSelection(doc, i, range, options) {
56
- let ranges = doc.sel.ranges.slice(0)
57
- ranges[i] = range
58
- setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options)
59
- }
60
-
61
- // Reset the selection to a single range.
62
- export function setSimpleSelection(doc, anchor, head, options) {
63
- setSelection(doc, simpleSelection(anchor, head), options)
64
- }
65
-
66
- // Give beforeSelectionChange handlers a change to influence a
67
- // selection update.
68
- function filterSelectionChange(doc, sel, options) {
69
- let obj = {
70
- ranges: sel.ranges,
71
- update: function(ranges) {
72
- this.ranges = []
73
- for (let i = 0; i < ranges.length; i++)
74
- this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
75
- clipPos(doc, ranges[i].head))
76
- },
77
- origin: options && options.origin
78
- }
79
- signal(doc, "beforeSelectionChange", doc, obj)
80
- if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj)
81
- if (obj.ranges != sel.ranges) return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1)
82
- else return sel
83
- }
84
-
85
- export function setSelectionReplaceHistory(doc, sel, options) {
86
- let done = doc.history.done, last = lst(done)
87
- if (last && last.ranges) {
88
- done[done.length - 1] = sel
89
- setSelectionNoUndo(doc, sel, options)
90
- } else {
91
- setSelection(doc, sel, options)
92
- }
93
- }
94
-
95
- // Set a new selection.
96
- export function setSelection(doc, sel, options) {
97
- setSelectionNoUndo(doc, sel, options)
98
- addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options)
99
- }
100
-
101
- export function setSelectionNoUndo(doc, sel, options) {
102
- if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
103
- sel = filterSelectionChange(doc, sel, options)
104
-
105
- let bias = options && options.bias ||
106
- (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1)
107
- setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true))
108
-
109
- if (!(options && options.scroll === false) && doc.cm && doc.cm.getOption("readOnly") != "nocursor")
110
- ensureCursorVisible(doc.cm)
111
- }
112
-
113
- function setSelectionInner(doc, sel) {
114
- if (sel.equals(doc.sel)) return
115
-
116
- doc.sel = sel
117
-
118
- if (doc.cm) {
119
- doc.cm.curOp.updateInput = 1
120
- doc.cm.curOp.selectionChanged = true
121
- signalCursorActivity(doc.cm)
122
- }
123
- signalLater(doc, "cursorActivity", doc)
124
- }
125
-
126
- // Verify that the selection does not partially select any atomic
127
- // marked ranges.
128
- export function reCheckSelection(doc) {
129
- setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false))
130
- }
131
-
132
- // Return a selection that does not partially select any atomic
133
- // ranges.
134
- function skipAtomicInSelection(doc, sel, bias, mayClear) {
135
- let out
136
- for (let i = 0; i < sel.ranges.length; i++) {
137
- let range = sel.ranges[i]
138
- let old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]
139
- let newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)
140
- let newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear)
141
- if (out || newAnchor != range.anchor || newHead != range.head) {
142
- if (!out) out = sel.ranges.slice(0, i)
143
- out[i] = new Range(newAnchor, newHead)
144
- }
145
- }
146
- return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel
147
- }
148
-
149
- function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
150
- let line = getLine(doc, pos.line)
151
- if (line.markedSpans) for (let i = 0; i < line.markedSpans.length; ++i) {
152
- let sp = line.markedSpans[i], m = sp.marker
153
-
154
- // Determine if we should prevent the cursor being placed to the left/right of an atomic marker
155
- // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it
156
- // is with selectLeft/Right
157
- let preventCursorLeft = ("selectLeft" in m) ? !m.selectLeft : m.inclusiveLeft
158
- let preventCursorRight = ("selectRight" in m) ? !m.selectRight : m.inclusiveRight
159
-
160
- if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
161
- (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
162
- if (mayClear) {
163
- signal(m, "beforeCursorEnter")
164
- if (m.explicitlyCleared) {
165
- if (!line.markedSpans) break
166
- else {--i; continue}
167
- }
168
- }
169
- if (!m.atomic) continue
170
-
171
- if (oldPos) {
172
- let near = m.find(dir < 0 ? 1 : -1), diff
173
- if (dir < 0 ? preventCursorRight : preventCursorLeft)
174
- near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null)
175
- if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
176
- return skipAtomicInner(doc, near, pos, dir, mayClear)
177
- }
178
-
179
- let far = m.find(dir < 0 ? -1 : 1)
180
- if (dir < 0 ? preventCursorLeft : preventCursorRight)
181
- far = movePos(doc, far, dir, far.line == pos.line ? line : null)
182
- return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
183
- }
184
- }
185
- return pos
186
- }
187
-
188
- // Ensure a given position is not inside an atomic range.
189
- export function skipAtomic(doc, pos, oldPos, bias, mayClear) {
190
- let dir = bias || 1
191
- let found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
192
- (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
193
- skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
194
- (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true))
195
- if (!found) {
196
- doc.cantEdit = true
197
- return Pos(doc.first, 0)
198
- }
199
- return found
200
- }
201
-
202
- function movePos(doc, pos, dir, line) {
203
- if (dir < 0 && pos.ch == 0) {
204
- if (pos.line > doc.first) return clipPos(doc, Pos(pos.line - 1))
205
- else return null
206
- } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
207
- if (pos.line < doc.first + doc.size - 1) return Pos(pos.line + 1, 0)
208
- else return null
209
- } else {
210
- return new Pos(pos.line, pos.ch + dir)
211
- }
212
- }
213
-
214
- export function selectAll(cm) {
215
- cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll)
216
- }
@@ -1,96 +0,0 @@
1
- import { copyObj, createObj } from "./util/misc.js"
2
-
3
- // Known modes, by name and by MIME
4
- export let modes = {}, mimeModes = {}
5
-
6
- // Extra arguments are stored as the mode's dependencies, which is
7
- // used by (legacy) mechanisms like loadmode.js to automatically
8
- // load a mode. (Preferred mechanism is the require/define calls.)
9
- export function defineMode(name, mode) {
10
- if (arguments.length > 2)
11
- mode.dependencies = Array.prototype.slice.call(arguments, 2)
12
- modes[name] = mode
13
- }
14
-
15
- export function defineMIME(mime, spec) {
16
- mimeModes[mime] = spec
17
- }
18
-
19
- // Given a MIME type, a {name, ...options} config object, or a name
20
- // string, return a mode config object.
21
- export function resolveMode(spec) {
22
- if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
23
- spec = mimeModes[spec]
24
- } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
25
- let found = mimeModes[spec.name]
26
- if (typeof found == "string") found = {name: found}
27
- spec = createObj(found, spec)
28
- spec.name = found.name
29
- } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
30
- return resolveMode("application/xml")
31
- } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
32
- return resolveMode("application/json")
33
- }
34
- if (typeof spec == "string") return {name: spec}
35
- else return spec || {name: "null"}
36
- }
37
-
38
- // Given a mode spec (anything that resolveMode accepts), find and
39
- // initialize an actual mode object.
40
- export function getMode(options, spec) {
41
- spec = resolveMode(spec)
42
- let mfactory = modes[spec.name]
43
- if (!mfactory) return getMode(options, "text/plain")
44
- let modeObj = mfactory(options, spec)
45
- if (modeExtensions.hasOwnProperty(spec.name)) {
46
- let exts = modeExtensions[spec.name]
47
- for (let prop in exts) {
48
- if (!exts.hasOwnProperty(prop)) continue
49
- if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop]
50
- modeObj[prop] = exts[prop]
51
- }
52
- }
53
- modeObj.name = spec.name
54
- if (spec.helperType) modeObj.helperType = spec.helperType
55
- if (spec.modeProps) for (let prop in spec.modeProps)
56
- modeObj[prop] = spec.modeProps[prop]
57
-
58
- return modeObj
59
- }
60
-
61
- // This can be used to attach properties to mode objects from
62
- // outside the actual mode definition.
63
- export let modeExtensions = {}
64
- export function extendMode(mode, properties) {
65
- let exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {})
66
- copyObj(properties, exts)
67
- }
68
-
69
- export function copyState(mode, state) {
70
- if (state === true) return state
71
- if (mode.copyState) return mode.copyState(state)
72
- let nstate = {}
73
- for (let n in state) {
74
- let val = state[n]
75
- if (val instanceof Array) val = val.concat([])
76
- nstate[n] = val
77
- }
78
- return nstate
79
- }
80
-
81
- // Given a mode and a state (for that mode), find the inner mode and
82
- // state at the position that the state refers to.
83
- export function innerMode(mode, state) {
84
- let info
85
- while (mode.innerMode) {
86
- info = mode.innerMode(state)
87
- if (!info || info.mode == mode) break
88
- state = info.state
89
- mode = info.mode
90
- }
91
- return info || {mode: mode, state: state}
92
- }
93
-
94
- export function startState(mode, a1, a2) {
95
- return mode.startState ? mode.startState(a1, a2) : true
96
- }
@@ -1,90 +0,0 @@
1
- import { countColumn } from "./misc.js"
2
-
3
- // STRING STREAM
4
-
5
- // Fed to the mode parsers, provides helper functions to make
6
- // parsers more succinct.
7
-
8
- class StringStream {
9
- constructor(string, tabSize, lineOracle) {
10
- this.pos = this.start = 0
11
- this.string = string
12
- this.tabSize = tabSize || 8
13
- this.lastColumnPos = this.lastColumnValue = 0
14
- this.lineStart = 0
15
- this.lineOracle = lineOracle
16
- }
17
-
18
- eol() {return this.pos >= this.string.length}
19
- sol() {return this.pos == this.lineStart}
20
- peek() {return this.string.charAt(this.pos) || undefined}
21
- next() {
22
- if (this.pos < this.string.length)
23
- return this.string.charAt(this.pos++)
24
- }
25
- eat(match) {
26
- let ch = this.string.charAt(this.pos)
27
- let ok
28
- if (typeof match == "string") ok = ch == match
29
- else ok = ch && (match.test ? match.test(ch) : match(ch))
30
- if (ok) {++this.pos; return ch}
31
- }
32
- eatWhile(match) {
33
- let start = this.pos
34
- while (this.eat(match)){}
35
- return this.pos > start
36
- }
37
- eatSpace() {
38
- let start = this.pos
39
- while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos
40
- return this.pos > start
41
- }
42
- skipToEnd() {this.pos = this.string.length}
43
- skipTo(ch) {
44
- let found = this.string.indexOf(ch, this.pos)
45
- if (found > -1) {this.pos = found; return true}
46
- }
47
- backUp(n) {this.pos -= n}
48
- column() {
49
- if (this.lastColumnPos < this.start) {
50
- this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue)
51
- this.lastColumnPos = this.start
52
- }
53
- return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
54
- }
55
- indentation() {
56
- return countColumn(this.string, null, this.tabSize) -
57
- (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
58
- }
59
- match(pattern, consume, caseInsensitive) {
60
- if (typeof pattern == "string") {
61
- let cased = str => caseInsensitive ? str.toLowerCase() : str
62
- let substr = this.string.substr(this.pos, pattern.length)
63
- if (cased(substr) == cased(pattern)) {
64
- if (consume !== false) this.pos += pattern.length
65
- return true
66
- }
67
- } else {
68
- let match = this.string.slice(this.pos).match(pattern)
69
- if (match && match.index > 0) return null
70
- if (match && consume !== false) this.pos += match[0].length
71
- return match
72
- }
73
- }
74
- current(){return this.string.slice(this.start, this.pos)}
75
- hideFirstChars(n, inner) {
76
- this.lineStart += n
77
- try { return inner() }
78
- finally { this.lineStart -= n }
79
- }
80
- lookAhead(n) {
81
- let oracle = this.lineOracle
82
- return oracle && oracle.lookAhead(n)
83
- }
84
- baseToken() {
85
- let oracle = this.lineOracle
86
- return oracle && oracle.baseToken(this.pos)
87
- }
88
- }
89
-
90
- export default StringStream
@@ -1,215 +0,0 @@
1
- import { lst } from "./misc.js"
2
-
3
- // BIDI HELPERS
4
-
5
- export function iterateBidiSections(order, from, to, f) {
6
- if (!order) return f(from, to, "ltr", 0)
7
- let found = false
8
- for (let i = 0; i < order.length; ++i) {
9
- let part = order[i]
10
- if (part.from < to && part.to > from || from == to && part.to == from) {
11
- f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr", i)
12
- found = true
13
- }
14
- }
15
- if (!found) f(from, to, "ltr")
16
- }
17
-
18
- export let bidiOther = null
19
- export function getBidiPartAt(order, ch, sticky) {
20
- let found
21
- bidiOther = null
22
- for (let i = 0; i < order.length; ++i) {
23
- let cur = order[i]
24
- if (cur.from < ch && cur.to > ch) return i
25
- if (cur.to == ch) {
26
- if (cur.from != cur.to && sticky == "before") found = i
27
- else bidiOther = i
28
- }
29
- if (cur.from == ch) {
30
- if (cur.from != cur.to && sticky != "before") found = i
31
- else bidiOther = i
32
- }
33
- }
34
- return found != null ? found : bidiOther
35
- }
36
-
37
- // Bidirectional ordering algorithm
38
- // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
39
- // that this (partially) implements.
40
-
41
- // One-char codes used for character types:
42
- // L (L): Left-to-Right
43
- // R (R): Right-to-Left
44
- // r (AL): Right-to-Left Arabic
45
- // 1 (EN): European Number
46
- // + (ES): European Number Separator
47
- // % (ET): European Number Terminator
48
- // n (AN): Arabic Number
49
- // , (CS): Common Number Separator
50
- // m (NSM): Non-Spacing Mark
51
- // b (BN): Boundary Neutral
52
- // s (B): Paragraph Separator
53
- // t (S): Segment Separator
54
- // w (WS): Whitespace
55
- // N (ON): Other Neutrals
56
-
57
- // Returns null if characters are ordered as they appear
58
- // (left-to-right), or an array of sections ({from, to, level}
59
- // objects) in the order in which they occur visually.
60
- let bidiOrdering = (function() {
61
- // Character types for codepoints 0 to 0xff
62
- let lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN"
63
- // Character types for codepoints 0x600 to 0x6f9
64
- let arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111"
65
- function charType(code) {
66
- if (code <= 0xf7) return lowTypes.charAt(code)
67
- else if (0x590 <= code && code <= 0x5f4) return "R"
68
- else if (0x600 <= code && code <= 0x6f9) return arabicTypes.charAt(code - 0x600)
69
- else if (0x6ee <= code && code <= 0x8ac) return "r"
70
- else if (0x2000 <= code && code <= 0x200b) return "w"
71
- else if (code == 0x200c) return "b"
72
- else return "L"
73
- }
74
-
75
- let bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/
76
- let isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/
77
-
78
- function BidiSpan(level, from, to) {
79
- this.level = level
80
- this.from = from; this.to = to
81
- }
82
-
83
- return function(str, direction) {
84
- let outerType = direction == "ltr" ? "L" : "R"
85
-
86
- if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) return false
87
- let len = str.length, types = []
88
- for (let i = 0; i < len; ++i)
89
- types.push(charType(str.charCodeAt(i)))
90
-
91
- // W1. Examine each non-spacing mark (NSM) in the level run, and
92
- // change the type of the NSM to the type of the previous
93
- // character. If the NSM is at the start of the level run, it will
94
- // get the type of sor.
95
- for (let i = 0, prev = outerType; i < len; ++i) {
96
- let type = types[i]
97
- if (type == "m") types[i] = prev
98
- else prev = type
99
- }
100
-
101
- // W2. Search backwards from each instance of a European number
102
- // until the first strong type (R, L, AL, or sor) is found. If an
103
- // AL is found, change the type of the European number to Arabic
104
- // number.
105
- // W3. Change all ALs to R.
106
- for (let i = 0, cur = outerType; i < len; ++i) {
107
- let type = types[i]
108
- if (type == "1" && cur == "r") types[i] = "n"
109
- else if (isStrong.test(type)) { cur = type; if (type == "r") types[i] = "R" }
110
- }
111
-
112
- // W4. A single European separator between two European numbers
113
- // changes to a European number. A single common separator between
114
- // two numbers of the same type changes to that type.
115
- for (let i = 1, prev = types[0]; i < len - 1; ++i) {
116
- let type = types[i]
117
- if (type == "+" && prev == "1" && types[i+1] == "1") types[i] = "1"
118
- else if (type == "," && prev == types[i+1] &&
119
- (prev == "1" || prev == "n")) types[i] = prev
120
- prev = type
121
- }
122
-
123
- // W5. A sequence of European terminators adjacent to European
124
- // numbers changes to all European numbers.
125
- // W6. Otherwise, separators and terminators change to Other
126
- // Neutral.
127
- for (let i = 0; i < len; ++i) {
128
- let type = types[i]
129
- if (type == ",") types[i] = "N"
130
- else if (type == "%") {
131
- let end
132
- for (end = i + 1; end < len && types[end] == "%"; ++end) {}
133
- let replace = (i && types[i-1] == "!") || (end < len && types[end] == "1") ? "1" : "N"
134
- for (let j = i; j < end; ++j) types[j] = replace
135
- i = end - 1
136
- }
137
- }
138
-
139
- // W7. Search backwards from each instance of a European number
140
- // until the first strong type (R, L, or sor) is found. If an L is
141
- // found, then change the type of the European number to L.
142
- for (let i = 0, cur = outerType; i < len; ++i) {
143
- let type = types[i]
144
- if (cur == "L" && type == "1") types[i] = "L"
145
- else if (isStrong.test(type)) cur = type
146
- }
147
-
148
- // N1. A sequence of neutrals takes the direction of the
149
- // surrounding strong text if the text on both sides has the same
150
- // direction. European and Arabic numbers act as if they were R in
151
- // terms of their influence on neutrals. Start-of-level-run (sor)
152
- // and end-of-level-run (eor) are used at level run boundaries.
153
- // N2. Any remaining neutrals take the embedding direction.
154
- for (let i = 0; i < len; ++i) {
155
- if (isNeutral.test(types[i])) {
156
- let end
157
- for (end = i + 1; end < len && isNeutral.test(types[end]); ++end) {}
158
- let before = (i ? types[i-1] : outerType) == "L"
159
- let after = (end < len ? types[end] : outerType) == "L"
160
- let replace = before == after ? (before ? "L" : "R") : outerType
161
- for (let j = i; j < end; ++j) types[j] = replace
162
- i = end - 1
163
- }
164
- }
165
-
166
- // Here we depart from the documented algorithm, in order to avoid
167
- // building up an actual levels array. Since there are only three
168
- // levels (0, 1, 2) in an implementation that doesn't take
169
- // explicit embedding into account, we can build up the order on
170
- // the fly, without following the level-based algorithm.
171
- let order = [], m
172
- for (let i = 0; i < len;) {
173
- if (countsAsLeft.test(types[i])) {
174
- let start = i
175
- for (++i; i < len && countsAsLeft.test(types[i]); ++i) {}
176
- order.push(new BidiSpan(0, start, i))
177
- } else {
178
- let pos = i, at = order.length, isRTL = direction == "rtl" ? 1 : 0
179
- for (++i; i < len && types[i] != "L"; ++i) {}
180
- for (let j = pos; j < i;) {
181
- if (countsAsNum.test(types[j])) {
182
- if (pos < j) { order.splice(at, 0, new BidiSpan(1, pos, j)); at += isRTL }
183
- let nstart = j
184
- for (++j; j < i && countsAsNum.test(types[j]); ++j) {}
185
- order.splice(at, 0, new BidiSpan(2, nstart, j))
186
- at += isRTL
187
- pos = j
188
- } else ++j
189
- }
190
- if (pos < i) order.splice(at, 0, new BidiSpan(1, pos, i))
191
- }
192
- }
193
- if (direction == "ltr") {
194
- if (order[0].level == 1 && (m = str.match(/^\s+/))) {
195
- order[0].from = m[0].length
196
- order.unshift(new BidiSpan(0, 0, m[0].length))
197
- }
198
- if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
199
- lst(order).to -= m[0].length
200
- order.push(new BidiSpan(0, len - m[0].length, len))
201
- }
202
- }
203
-
204
- return direction == "rtl" ? order.reverse() : order
205
- }
206
- })()
207
-
208
- // Get the bidi ordering for the given line (and cache it). Returns
209
- // false for lines that are fully left-to-right, and an array of
210
- // BidiSpan objects otherwise.
211
- export function getOrder(line, direction) {
212
- let order = line.order
213
- if (order == null) order = line.order = bidiOrdering(line.text, direction)
214
- return order
215
- }
@@ -1,34 +0,0 @@
1
- // Kludges for bugs and behavior differences that can't be feature
2
- // detected are enabled based on userAgent etc sniffing.
3
- let userAgent = navigator.userAgent
4
- let platform = navigator.platform
5
-
6
- export let gecko = /gecko\/\d/i.test(userAgent)
7
- let ie_upto10 = /MSIE \d/.test(userAgent)
8
- let ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent)
9
- let edge = /Edge\/(\d+)/.exec(userAgent)
10
- export let ie = ie_upto10 || ie_11up || edge
11
- export let ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1])
12
- export let webkit = !edge && /WebKit\//.test(userAgent)
13
- let qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent)
14
- export let chrome = !edge && /Chrome\/(\d+)/.exec(userAgent)
15
- export let chrome_version = chrome && +chrome[1]
16
- export let presto = /Opera\//.test(userAgent)
17
- export let safari = /Apple Computer/.test(navigator.vendor)
18
- export let mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent)
19
- export let phantom = /PhantomJS/.test(userAgent)
20
-
21
- export let ios = safari && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2)
22
- export let android = /Android/.test(userAgent)
23
- // This is woefully incomplete. Suggestions for alternative methods welcome.
24
- export let mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent)
25
- export let mac = ios || /Mac/.test(platform)
26
- export let chromeOS = /\bCrOS\b/.test(userAgent)
27
- export let windows = /win/i.test(platform)
28
-
29
- let presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/)
30
- if (presto_version) presto_version = Number(presto_version[1])
31
- if (presto_version && presto_version >= 15) { presto = false; webkit = true }
32
- // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
33
- export let flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11))
34
- export let captureRightClick = gecko || (ie && ie_version >= 9)