@kky42/pievo-server 2.3.0 → 2.4.2

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 (199) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/MachinesModal-CSbnrUER.js +1 -0
  3. package/.output/public/assets/SignIn-0Tjqs-Ma.js +1 -0
  4. package/.output/public/assets/actionUi-DpwGIGpw.js +1 -0
  5. package/.output/public/assets/app-CaZpuwOS.css +2 -0
  6. package/.output/public/assets/index-CaS_SmDq.js +10 -0
  7. package/.output/public/assets/invite._token-Btg_0aLp.js +1 -0
  8. package/.output/public/assets/invite._token-KMD2JAgE.js +1 -0
  9. package/.output/public/assets/lifecycleUi-C7dwHtbw.js +1 -0
  10. package/.output/public/assets/loops._loopId-D5usF3DO.js +67 -0
  11. package/.output/public/assets/loops._loopId_.runs._runId-DRCgXaCq.js +3 -0
  12. package/.output/public/assets/preload-helper-DsxECZIS.js +5 -0
  13. package/.output/public/assets/routes-CtFgwdgW.js +1 -0
  14. package/.output/public/assets/routes-LDbnnQ3f.js +1 -0
  15. package/.output/public/assets/t._teamId-D41xcbsF.js +1 -0
  16. package/.output/public/assets/t._teamId-DUena1pV.js +1 -0
  17. package/.output/public/assets/ui-Do4gqMyP.js +1 -0
  18. package/.output/server/_libs/@base-ui/react+[...].mjs +4130 -4130
  19. package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
  20. package/.output/server/_libs/drizzle-orm+postgres.mjs +28 -1
  21. package/.output/server/_ssr/DashboardView-C2LdV6J0.mjs +914 -0
  22. package/.output/server/_ssr/{notifyFns-DuPR1zd7.mjs → MachinesModal-BjkcVjjx.mjs} +55 -35
  23. package/.output/server/_ssr/{SignIn-RmpWm9uy.mjs → SignIn-DEGrvJvb.mjs} +10 -24
  24. package/.output/server/_ssr/SocialLinks-Cm4H8pUJ.mjs +1044 -0
  25. package/.output/server/_ssr/{actionUi-BN55TNYE.mjs → actionUi-DJBWuNwr.mjs} +3 -3
  26. package/.output/server/_ssr/{artifactFiles-BCaIIrrT.mjs → artifactFiles-DtpRidFZ.mjs} +7 -8
  27. package/.output/server/_ssr/{artifactKind-BW0isV8L.mjs → artifactKind-FBYbgSuf.mjs} +27 -2
  28. package/.output/server/_ssr/artifacts-BR3jj0NC.mjs +2 -0
  29. package/.output/server/_ssr/{auth-30Z4lV1w.mjs → auth-C0zoZCGe.mjs} +16 -19
  30. package/.output/server/_ssr/boot-CdOO4xOo.mjs +2 -0
  31. package/.output/server/_ssr/{boot-3BNKujyp.mjs → boot-sNlIkoLe.mjs} +1331 -3927
  32. package/.output/server/_ssr/{bun-sqlite-dialect-BW9W1_Ps-_7tfuNRi.mjs → bun-sqlite-dialect-BW9W1_Ps-DmlZWqO7.mjs} +2 -2
  33. package/.output/server/_ssr/{d1-sqlite-dialect-BLC8LXE6-ucDUbeBk.mjs → d1-sqlite-dialect-BLC8LXE6-CCNzqZwZ.mjs} +2 -2
  34. package/.output/server/_ssr/db-CwLD-5w1.mjs +2 -0
  35. package/.output/server/_ssr/{dist-Cd6nlLlO.mjs → dist-B3SxDOpW.mjs} +2 -2
  36. package/.output/server/_ssr/{factory-CWWwV7XZ.mjs → factory-Dv3Zopis.mjs} +2 -2
  37. package/.output/server/_ssr/invite._token-CJ6-H-s3.mjs +20 -0
  38. package/.output/server/_ssr/{invite._token-SdWXemIc.mjs → invite._token-dLKDJKVs.mjs} +9 -17
  39. package/.output/server/_ssr/{invite._token-BKlz0R2f.mjs → invite._token-l1SjouDz.mjs} +6 -15
  40. package/.output/server/_ssr/{kysely-adapter-C8iS51DB.mjs → kysely-adapter-nL7WKSgw.mjs} +1 -1
  41. package/.output/server/_ssr/{lifecycleUi-DgBQAYzp.mjs → lifecycleUi-Dad3hvhm.mjs} +11 -11
  42. package/.output/server/_ssr/logger-B8m8F1Qu.mjs +2 -0
  43. package/.output/server/_ssr/loopApi-BKyFB4KM.mjs +342 -0
  44. package/.output/server/_ssr/{adapters-BoLkOf1T.mjs → loopProjection-B8a829ij.mjs} +25 -55
  45. package/.output/server/_ssr/loops._loopId-DS16Phmq.mjs +1271 -0
  46. package/.output/server/_ssr/{loops._loopId_.runs._runId-PUGBrD5q.mjs → loops._loopId_.runs._runId-BEJI6iK5.mjs} +23 -74
  47. package/.output/server/_ssr/{loops._loopId_.runs._runId-Ymy4lwee.mjs → loops._loopId_.runs._runId-CduETLqH.mjs} +4 -5
  48. package/.output/server/_ssr/{machineFns-BZ9puxDt.mjs → machineFns-ByMsgG12.mjs} +3 -5
  49. package/.output/server/_ssr/{node-sqlite-dialect-D_3JmkMo.mjs → node-sqlite-dialect-CjNineno.mjs} +2 -2
  50. package/.output/server/_ssr/router-CXyrnvx-.mjs +565 -0
  51. package/.output/server/_ssr/{routes-ClZEdsnB.mjs → routes-BulNEUEE.mjs} +6 -10
  52. package/.output/server/_ssr/{routes-ComqHvCL.mjs → routes-DD94baie.mjs} +3 -3
  53. package/.output/server/_ssr/{routes-D5jJJ-30.mjs → routes-Wjexi35W.mjs} +6 -6
  54. package/.output/server/_ssr/runDiff-Ba8Lg1vg.mjs +2 -0
  55. package/.output/server/_ssr/ssr.mjs +60 -100
  56. package/.output/server/_ssr/store-Cujtg2QE.mjs +2 -0
  57. package/.output/server/_ssr/{t._teamId-BgHV_KFP.mjs → t._teamId-1CreIlPV.mjs} +7 -11
  58. package/.output/server/_ssr/{t._teamId-DDERNgfn.mjs → t._teamId-Bd6-zZsy.mjs} +4 -4
  59. package/.output/server/_ssr/{t._teamId-DRJvKHZn.mjs → t._teamId-COuMKQ4r.mjs} +7 -7
  60. package/.output/server/_ssr/{teamFns-Bp81UO-x.mjs → teamFns-H438WnZC.mjs} +12 -30
  61. package/.output/server/_ssr/{teamFns-bm82twd5.mjs → teamFns-j2JKjorZ.mjs} +2 -2
  62. package/.output/server/_ssr/tokens-DgG_Syq3.mjs +2 -0
  63. package/.output/server/_ssr/{ui-Ww2tTM2u.mjs → ui-D5KWstlb.mjs} +26 -48
  64. package/.output/server/{_tanstack-start-manifest_v-DwKENYCN.mjs → _tanstack-start-manifest_v-3H7yBKLz.mjs} +25 -35
  65. package/{drizzle/0000_round_marauders.sql → .output/server/drizzle/0000_baseline.sql} +102 -44
  66. package/.output/server/drizzle/meta/_journal.json +3 -115
  67. package/.output/server/index.mjs +83 -132
  68. package/{.output/server/drizzle/0000_round_marauders.sql → drizzle/0000_baseline.sql} +102 -44
  69. package/drizzle/meta/_journal.json +3 -115
  70. package/package.json +2 -11
  71. package/scripts/pievo-server.mjs +3 -1
  72. package/scripts/server-cli-lib.mjs +23 -16
  73. package/.output/public/assets/CodeField-dOzyFQNH.js +0 -34
  74. package/.output/public/assets/LoopView-DjVHUyrR.js +0 -59
  75. package/.output/public/assets/Modal-CCRvx959.js +0 -1
  76. package/.output/public/assets/SignIn-Qxw5zDFq.js +0 -1
  77. package/.output/public/assets/actionUi-CXxhzYe2.js +0 -1
  78. package/.output/public/assets/app-D1cij_NJ.css +0 -2
  79. package/.output/public/assets/artifactView-Cd5wWPil.js +0 -66
  80. package/.output/public/assets/index-BRN_CQ8U.js +0 -12
  81. package/.output/public/assets/invite._token-BIxr8DlP.js +0 -1
  82. package/.output/public/assets/invite._token-j2BTCeG1.js +0 -1
  83. package/.output/public/assets/jsx-runtime-BseJUIpC.js +0 -1
  84. package/.output/public/assets/lifecycleUi-Qy_8beQK.js +0 -1
  85. package/.output/public/assets/loopApi-CT1mMhlb.js +0 -3
  86. package/.output/public/assets/loops._loopId-BRBQzioy.js +0 -4
  87. package/.output/public/assets/loops._loopId_.runs._runId-CMnOJkem.js +0 -3
  88. package/.output/public/assets/notifyFns-DYD4EKaG.js +0 -1
  89. package/.output/public/assets/preload-helper-DFkkpP6W.js +0 -3
  90. package/.output/public/assets/routes-3nuEJGdo.js +0 -1
  91. package/.output/public/assets/routes-DORLim-C.js +0 -1
  92. package/.output/public/assets/t._teamId-F5f4K8kd.js +0 -1
  93. package/.output/public/assets/t._teamId-XfE_S1Fo.js +0 -1
  94. package/.output/public/assets/ui-Dhsx6SW0.js +0 -1
  95. package/.output/public/assets/useRouter-DsjH8G0p.js +0 -1
  96. package/.output/server/_libs/@codemirror/autocomplete+[...].mjs +0 -19713
  97. package/.output/server/_libs/@codemirror/lang-css+[...].mjs +0 -2636
  98. package/.output/server/_libs/@codemirror/lang-html+[...].mjs +0 -2247
  99. package/.output/server/_libs/@codemirror/lang-json+[...].mjs +0 -79
  100. package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +0 -1736
  101. package/.output/server/_libs/@uiw/codemirror-extensions-basic-setup+[...].mjs +0 -76
  102. package/.output/server/_libs/babel__runtime.mjs +0 -30
  103. package/.output/server/_libs/clsx.mjs +0 -16
  104. package/.output/server/_libs/codemirror__commands.mjs +0 -1725
  105. package/.output/server/_libs/codemirror__lint.mjs +0 -565
  106. package/.output/server/_libs/codemirror__search.mjs +0 -1138
  107. package/.output/server/_libs/codemirror__theme-one-dark.mjs +0 -161
  108. package/.output/server/_libs/d3-array.mjs +0 -231
  109. package/.output/server/_libs/d3-color.mjs +0 -330
  110. package/.output/server/_libs/d3-format.mjs +0 -252
  111. package/.output/server/_libs/d3-interpolate.mjs +0 -163
  112. package/.output/server/_libs/d3-path.mjs +0 -77
  113. package/.output/server/_libs/d3-scale+[...].mjs +0 -1907
  114. package/.output/server/_libs/d3-shape.mjs +0 -818
  115. package/.output/server/_libs/decimal.js-light.mjs +0 -884
  116. package/.output/server/_libs/dom-serializer+[...].mjs +0 -708
  117. package/.output/server/_libs/domhandler.mjs +0 -461
  118. package/.output/server/_libs/domutils.mjs +0 -868
  119. package/.output/server/_libs/es-toolkit.mjs +0 -1737
  120. package/.output/server/_libs/eventemitter3.mjs +0 -236
  121. package/.output/server/_libs/html-dom-parser+htmlparser2.mjs +0 -1560
  122. package/.output/server/_libs/html-react-parser+[...].mjs +0 -1360
  123. package/.output/server/_libs/react-is.mjs +0 -48
  124. package/.output/server/_libs/react-redux+[...].mjs +0 -205
  125. package/.output/server/_libs/recharts+victory-vendor.mjs +0 -17303
  126. package/.output/server/_libs/uiw__codemirror-themes.mjs +0 -32
  127. package/.output/server/_libs/uiw__react-codemirror.mjs +0 -354
  128. package/.output/server/_ssr/CodeField-B7oOmmwH.mjs +0 -143
  129. package/.output/server/_ssr/DashboardView-BF7PciP7.mjs +0 -2736
  130. package/.output/server/_ssr/LoopPlaybook-DC7QVvPY.mjs +0 -2105
  131. package/.output/server/_ssr/LoopView-DwSrm9Ja.mjs +0 -1300
  132. package/.output/server/_ssr/Modal-MaCG52Pv.mjs +0 -49
  133. package/.output/server/_ssr/artifactView-iuPsp5aa.mjs +0 -304
  134. package/.output/server/_ssr/artifacts-jQ-bfdhI.mjs +0 -2
  135. package/.output/server/_ssr/boot-CsEFT53K.mjs +0 -2
  136. package/.output/server/_ssr/db-CXownd1H.mjs +0 -2
  137. package/.output/server/_ssr/invite._token-CWl6kipD.mjs +0 -28
  138. package/.output/server/_ssr/logger-Gy-47z3k.mjs +0 -2
  139. package/.output/server/_ssr/loopApi-8_KgBapr.mjs +0 -109
  140. package/.output/server/_ssr/loopApi-ABi9SgWS.mjs +0 -564
  141. package/.output/server/_ssr/loops._loopId-SON_t43g.mjs +0 -30
  142. package/.output/server/_ssr/loops._loopId-p1KWsvMM.mjs +0 -1477
  143. package/.output/server/_ssr/notifyFns-BUCePuF3.mjs +0 -118
  144. package/.output/server/_ssr/router-Czxvra6l.mjs +0 -685
  145. package/.output/server/_ssr/runDiff--qLtU4FI.mjs +0 -2
  146. package/.output/server/_ssr/store-40eVzW1S.mjs +0 -2
  147. package/.output/server/_ssr/tokens-CbfoRC_s.mjs +0 -2
  148. package/.output/server/drizzle/0001_naive_silver_fox.sql +0 -25
  149. package/.output/server/drizzle/0002_funny_sage.sql +0 -12
  150. package/.output/server/drizzle/0003_optimal_slapstick.sql +0 -102
  151. package/.output/server/drizzle/0004_remove_grok_agent.sql +0 -5
  152. package/.output/server/drizzle/0005_heavy_gauntlet.sql +0 -8
  153. package/.output/server/drizzle/0006_tranquil_sharon_carter.sql +0 -1
  154. package/.output/server/drizzle/0007_faulty_starbolt.sql +0 -30
  155. package/.output/server/drizzle/0008_durable_lifecycle_evidence.sql +0 -15
  156. package/.output/server/drizzle/0009_ordinary_electro.sql +0 -1
  157. package/.output/server/drizzle/0010_workable_rage.sql +0 -14
  158. package/.output/server/drizzle/0011_steep_marvel_zombies.sql +0 -3
  159. package/.output/server/drizzle/0012_blocked_run_status.sql +0 -12
  160. package/.output/server/drizzle/0013_drop_run_outcome.sql +0 -2
  161. package/.output/server/drizzle/0014_luxuriant_scrambler.sql +0 -5
  162. package/.output/server/drizzle/0015_run_history_foundation.sql +0 -43
  163. package/.output/server/drizzle/0016_plural_machine_runs.sql +0 -4
  164. package/.output/server/drizzle/meta/0000_snapshot.json +0 -1333
  165. package/.output/server/drizzle/meta/0001_snapshot.json +0 -1498
  166. package/.output/server/drizzle/meta/0002_snapshot.json +0 -1576
  167. package/.output/server/drizzle/meta/0003_snapshot.json +0 -1666
  168. package/.output/server/drizzle/meta/0005_snapshot.json +0 -1666
  169. package/.output/server/drizzle/meta/0006_snapshot.json +0 -1672
  170. package/.output/server/drizzle/meta/0007_snapshot.json +0 -1787
  171. package/.output/server/drizzle/meta/0009_snapshot.json +0 -1793
  172. package/.output/server/drizzle/meta/0010_snapshot.json +0 -1891
  173. package/.output/server/drizzle/meta/0011_snapshot.json +0 -1872
  174. package/drizzle/0001_naive_silver_fox.sql +0 -25
  175. package/drizzle/0002_funny_sage.sql +0 -12
  176. package/drizzle/0003_optimal_slapstick.sql +0 -102
  177. package/drizzle/0004_remove_grok_agent.sql +0 -5
  178. package/drizzle/0005_heavy_gauntlet.sql +0 -8
  179. package/drizzle/0006_tranquil_sharon_carter.sql +0 -1
  180. package/drizzle/0007_faulty_starbolt.sql +0 -30
  181. package/drizzle/0008_durable_lifecycle_evidence.sql +0 -15
  182. package/drizzle/0009_ordinary_electro.sql +0 -1
  183. package/drizzle/0010_workable_rage.sql +0 -14
  184. package/drizzle/0011_steep_marvel_zombies.sql +0 -3
  185. package/drizzle/0012_blocked_run_status.sql +0 -12
  186. package/drizzle/0013_drop_run_outcome.sql +0 -2
  187. package/drizzle/0014_luxuriant_scrambler.sql +0 -5
  188. package/drizzle/0015_run_history_foundation.sql +0 -43
  189. package/drizzle/0016_plural_machine_runs.sql +0 -4
  190. package/drizzle/meta/0000_snapshot.json +0 -1333
  191. package/drizzle/meta/0001_snapshot.json +0 -1498
  192. package/drizzle/meta/0002_snapshot.json +0 -1576
  193. package/drizzle/meta/0003_snapshot.json +0 -1666
  194. package/drizzle/meta/0005_snapshot.json +0 -1666
  195. package/drizzle/meta/0006_snapshot.json +0 -1672
  196. package/drizzle/meta/0007_snapshot.json +0 -1787
  197. package/drizzle/meta/0009_snapshot.json +0 -1793
  198. package/drizzle/meta/0010_snapshot.json +0 -1891
  199. package/drizzle/meta/0011_snapshot.json +0 -1872
@@ -1,1725 +0,0 @@
1
- import { C as getIndentUnit, Ct as Text, D as indentString, Dt as combineConfig, G as Direction, K as EditorView, L as NodeProp, M as syntaxTree, O as indentUnit, Ot as countColumn, St as StateField, ft as Annotation, gt as EditorSelection, k as matchBrackets, kt as findClusterBreak, l as IndentContext, mt as ChangeSet, pt as ChangeDesc, vt as Facet, w as getIndentation, wt as Transaction, xt as StateEffect } from "./@codemirror/autocomplete+[...].mjs";
2
- //#region ../../node_modules/.pnpm/@codemirror+commands@6.10.4/node_modules/@codemirror/commands/dist/index.js
3
- /**
4
- Comment or uncomment the current selection. Will use line comments
5
- if available, otherwise falling back to block comments.
6
- */
7
- var toggleComment = (target) => {
8
- let { state } = target, line = state.doc.lineAt(state.selection.main.from), config = getConfig(target.state, line.from);
9
- return config.line ? toggleLineComment(target) : config.block ? toggleBlockCommentByLine(target) : false;
10
- };
11
- function command(f, option) {
12
- return ({ state, dispatch }) => {
13
- if (state.readOnly) return false;
14
- let tr = f(option, state);
15
- if (!tr) return false;
16
- dispatch(state.update(tr));
17
- return true;
18
- };
19
- }
20
- /**
21
- Comment or uncomment the current selection using line comments.
22
- The line comment syntax is taken from the
23
- [`commentTokens`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) [language
24
- data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt).
25
- */
26
- var toggleLineComment = /*@__PURE__*/ command(changeLineComment, 0);
27
- /**
28
- Comment or uncomment the current selection using block comments.
29
- The block comment syntax is taken from the
30
- [`commentTokens`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) [language
31
- data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt).
32
- */
33
- var toggleBlockComment = /*@__PURE__*/ command(changeBlockComment, 0);
34
- /**
35
- Comment or uncomment the lines around the current selection using
36
- block comments.
37
- */
38
- var toggleBlockCommentByLine = /*@__PURE__*/ command((o, s) => changeBlockComment(o, s, selectedLineRanges(s)), 0);
39
- function getConfig(state, pos) {
40
- let data = state.languageDataAt("commentTokens", pos, 1);
41
- return data.length ? data[0] : {};
42
- }
43
- var SearchMargin = 50;
44
- /**
45
- Determines if the given range is block-commented in the given
46
- state.
47
- */
48
- function findBlockComment(state, { open, close }, from, to) {
49
- let textBefore = state.sliceDoc(from - SearchMargin, from);
50
- let textAfter = state.sliceDoc(to, to + SearchMargin);
51
- let spaceBefore = /\s*$/.exec(textBefore)[0].length, spaceAfter = /^\s*/.exec(textAfter)[0].length;
52
- let beforeOff = textBefore.length - spaceBefore;
53
- if (textBefore.slice(beforeOff - open.length, beforeOff) == open && textAfter.slice(spaceAfter, spaceAfter + close.length) == close) return {
54
- open: {
55
- pos: from - spaceBefore,
56
- margin: spaceBefore && 1
57
- },
58
- close: {
59
- pos: to + spaceAfter,
60
- margin: spaceAfter && 1
61
- }
62
- };
63
- let startText, endText;
64
- if (to - from <= 2 * SearchMargin) startText = endText = state.sliceDoc(from, to);
65
- else {
66
- startText = state.sliceDoc(from, from + SearchMargin);
67
- endText = state.sliceDoc(to - SearchMargin, to);
68
- }
69
- let startSpace = /^\s*/.exec(startText)[0].length, endSpace = /\s*$/.exec(endText)[0].length;
70
- let endOff = endText.length - endSpace - close.length;
71
- if (startText.slice(startSpace, startSpace + open.length) == open && endText.slice(endOff, endOff + close.length) == close) return {
72
- open: {
73
- pos: from + startSpace + open.length,
74
- margin: /\s/.test(startText.charAt(startSpace + open.length)) ? 1 : 0
75
- },
76
- close: {
77
- pos: to - endSpace - close.length,
78
- margin: /\s/.test(endText.charAt(endOff - 1)) ? 1 : 0
79
- }
80
- };
81
- return null;
82
- }
83
- function selectedLineRanges(state) {
84
- let ranges = [];
85
- for (let r of state.selection.ranges) {
86
- let fromLine = state.doc.lineAt(r.from);
87
- let toLine = r.to <= fromLine.to ? fromLine : state.doc.lineAt(r.to);
88
- if (toLine.from > fromLine.from && toLine.from == r.to) toLine = r.to == fromLine.to + 1 ? fromLine : state.doc.lineAt(r.to - 1);
89
- let last = ranges.length - 1;
90
- if (last >= 0 && ranges[last].to > fromLine.from) ranges[last].to = toLine.to;
91
- else ranges.push({
92
- from: fromLine.from + /^\s*/.exec(fromLine.text)[0].length,
93
- to: toLine.to
94
- });
95
- }
96
- return ranges;
97
- }
98
- function changeBlockComment(option, state, ranges = state.selection.ranges) {
99
- let tokens = ranges.map((r) => getConfig(state, r.from).block);
100
- if (!tokens.every((c) => c)) return null;
101
- let comments = ranges.map((r, i) => findBlockComment(state, tokens[i], r.from, r.to));
102
- if (option != 2 && !comments.every((c) => c)) return { changes: state.changes(ranges.map((range, i) => {
103
- if (comments[i]) return [];
104
- return [{
105
- from: range.from,
106
- insert: tokens[i].open + " "
107
- }, {
108
- from: range.to,
109
- insert: " " + tokens[i].close
110
- }];
111
- })) };
112
- else if (option != 1 && comments.some((c) => c)) {
113
- let changes = [];
114
- for (let i = 0, comment; i < comments.length; i++) if (comment = comments[i]) {
115
- let token = tokens[i], { open, close } = comment;
116
- changes.push({
117
- from: open.pos - token.open.length,
118
- to: open.pos + open.margin
119
- }, {
120
- from: close.pos - close.margin,
121
- to: close.pos + token.close.length
122
- });
123
- }
124
- return { changes };
125
- }
126
- return null;
127
- }
128
- function changeLineComment(option, state, ranges = state.selection.ranges) {
129
- let lines = [];
130
- let prevLine = -1;
131
- ranges: for (let { from, to } of ranges) {
132
- let startI = lines.length, minIndent = 1e9, token;
133
- for (let pos = from; pos <= to;) {
134
- let line = state.doc.lineAt(pos);
135
- if (token == void 0) {
136
- token = getConfig(state, line.from).line;
137
- if (!token) continue ranges;
138
- }
139
- if (line.from > prevLine && (from == to || to > line.from)) {
140
- prevLine = line.from;
141
- let indent = /^\s*/.exec(line.text)[0].length;
142
- let empty = indent == line.length;
143
- let comment = line.text.slice(indent, indent + token.length) == token ? indent : -1;
144
- if (indent < line.text.length && indent < minIndent) minIndent = indent;
145
- lines.push({
146
- line,
147
- comment,
148
- token,
149
- indent,
150
- empty,
151
- single: false
152
- });
153
- }
154
- pos = line.to + 1;
155
- }
156
- if (minIndent < 1e9) {
157
- for (let i = startI; i < lines.length; i++) if (lines[i].indent < lines[i].line.text.length) lines[i].indent = minIndent;
158
- }
159
- if (lines.length == startI + 1) lines[startI].single = true;
160
- }
161
- if (option != 2 && lines.some((l) => l.comment < 0 && (!l.empty || l.single))) {
162
- let changes = [];
163
- for (let { line, token, indent, empty, single } of lines) if (single || !empty) changes.push({
164
- from: line.from + indent,
165
- insert: token + " "
166
- });
167
- let changeSet = state.changes(changes);
168
- return {
169
- changes: changeSet,
170
- selection: state.selection.map(changeSet, 1)
171
- };
172
- } else if (option != 1 && lines.some((l) => l.comment >= 0)) {
173
- let changes = [];
174
- for (let { line, comment, token } of lines) if (comment >= 0) {
175
- let from = line.from + comment, to = from + token.length;
176
- if (line.text[to - line.from] == " ") to++;
177
- changes.push({
178
- from,
179
- to
180
- });
181
- }
182
- return { changes };
183
- }
184
- return null;
185
- }
186
- var fromHistory = /*@__PURE__*/ Annotation.define();
187
- /**
188
- Transaction annotation that will prevent that transaction from
189
- being combined with other transactions in the undo history. Given
190
- `"before"`, it'll prevent merging with previous transactions. With
191
- `"after"`, subsequent transactions won't be combined with this
192
- one. With `"full"`, the transaction is isolated on both sides.
193
- */
194
- var isolateHistory = /*@__PURE__*/ Annotation.define();
195
- /**
196
- This facet provides a way to register functions that, given a
197
- transaction, provide a set of effects that the history should
198
- store when inverting the transaction. This can be used to
199
- integrate some kinds of effects in the history, so that they can
200
- be undone (and redone again).
201
- */
202
- var invertedEffects = /*@__PURE__*/ Facet.define();
203
- var historyConfig = /*@__PURE__*/ Facet.define({ combine(configs) {
204
- return combineConfig(configs, {
205
- minDepth: 100,
206
- newGroupDelay: 500,
207
- joinToEvent: (_t, isAdjacent) => isAdjacent
208
- }, {
209
- minDepth: Math.max,
210
- newGroupDelay: Math.min,
211
- joinToEvent: (a, b) => (tr, adj) => a(tr, adj) || b(tr, adj)
212
- });
213
- } });
214
- var historyField_ = /*@__PURE__*/ StateField.define({
215
- create() {
216
- return HistoryState.empty;
217
- },
218
- update(state, tr) {
219
- let config = tr.state.facet(historyConfig);
220
- let fromHist = tr.annotation(fromHistory);
221
- if (fromHist) {
222
- let item = HistEvent.fromTransaction(tr, fromHist.selection), from = fromHist.side;
223
- let other = from == 0 ? state.undone : state.done;
224
- if (item) other = updateBranch(other, other.length, config.minDepth, item);
225
- else other = addSelection(other, tr.startState.selection);
226
- return new HistoryState(from == 0 ? fromHist.rest : other, from == 0 ? other : fromHist.rest);
227
- }
228
- let isolate = tr.annotation(isolateHistory);
229
- if (isolate == "full" || isolate == "before") state = state.isolate();
230
- if (tr.annotation(Transaction.addToHistory) === false) return !tr.changes.empty ? state.addMapping(tr.changes.desc) : state;
231
- let event = HistEvent.fromTransaction(tr);
232
- let time = tr.annotation(Transaction.time), userEvent = tr.annotation(Transaction.userEvent);
233
- if (event) state = state.addChanges(event, time, userEvent, config, tr);
234
- else if (tr.selection) state = state.addSelection(tr.startState.selection, time, userEvent, config.newGroupDelay);
235
- if (isolate == "full" || isolate == "after") state = state.isolate();
236
- return state;
237
- },
238
- toJSON(value) {
239
- return {
240
- done: value.done.map((e) => e.toJSON()),
241
- undone: value.undone.map((e) => e.toJSON())
242
- };
243
- },
244
- fromJSON(json) {
245
- return new HistoryState(json.done.map(HistEvent.fromJSON), json.undone.map(HistEvent.fromJSON));
246
- }
247
- });
248
- /**
249
- Create a history extension with the given configuration.
250
- */
251
- function history(config = {}) {
252
- return [
253
- historyField_,
254
- historyConfig.of(config),
255
- EditorView.domEventHandlers({ beforeinput(e, view) {
256
- let command = e.inputType == "historyUndo" ? undo : e.inputType == "historyRedo" ? redo : null;
257
- if (!command) return false;
258
- e.preventDefault();
259
- return command(view);
260
- } })
261
- ];
262
- }
263
- function cmd(side, selection) {
264
- return function({ state, dispatch }) {
265
- if (!selection && state.readOnly) return false;
266
- let historyState = state.field(historyField_, false);
267
- if (!historyState) return false;
268
- let tr = historyState.pop(side, state, selection);
269
- if (!tr) return false;
270
- dispatch(tr);
271
- return true;
272
- };
273
- }
274
- /**
275
- Undo a single group of history events. Returns false if no group
276
- was available.
277
- */
278
- var undo = /*@__PURE__*/ cmd(0, false);
279
- /**
280
- Redo a group of history events. Returns false if no group was
281
- available.
282
- */
283
- var redo = /*@__PURE__*/ cmd(1, false);
284
- /**
285
- Undo a change or selection change.
286
- */
287
- var undoSelection = /*@__PURE__*/ cmd(0, true);
288
- /**
289
- Redo a change or selection change.
290
- */
291
- var redoSelection = /*@__PURE__*/ cmd(1, true);
292
- var HistEvent = class HistEvent {
293
- constructor(changes, effects, mapped, startSelection, selectionsAfter) {
294
- this.changes = changes;
295
- this.effects = effects;
296
- this.mapped = mapped;
297
- this.startSelection = startSelection;
298
- this.selectionsAfter = selectionsAfter;
299
- }
300
- setSelAfter(after) {
301
- return new HistEvent(this.changes, this.effects, this.mapped, this.startSelection, after);
302
- }
303
- toJSON() {
304
- var _a, _b, _c;
305
- return {
306
- changes: (_a = this.changes) === null || _a === void 0 ? void 0 : _a.toJSON(),
307
- mapped: (_b = this.mapped) === null || _b === void 0 ? void 0 : _b.toJSON(),
308
- startSelection: (_c = this.startSelection) === null || _c === void 0 ? void 0 : _c.toJSON(),
309
- selectionsAfter: this.selectionsAfter.map((s) => s.toJSON())
310
- };
311
- }
312
- static fromJSON(json) {
313
- return new HistEvent(json.changes && ChangeSet.fromJSON(json.changes), [], json.mapped && ChangeDesc.fromJSON(json.mapped), json.startSelection && EditorSelection.fromJSON(json.startSelection), json.selectionsAfter.map(EditorSelection.fromJSON));
314
- }
315
- static fromTransaction(tr, selection) {
316
- let effects = none;
317
- for (let invert of tr.startState.facet(invertedEffects)) {
318
- let result = invert(tr);
319
- if (result.length) effects = effects.concat(result);
320
- }
321
- if (!effects.length && tr.changes.empty) return null;
322
- return new HistEvent(tr.changes.invert(tr.startState.doc), effects, void 0, selection || tr.startState.selection, none);
323
- }
324
- static selection(selections) {
325
- return new HistEvent(void 0, none, void 0, void 0, selections);
326
- }
327
- };
328
- function updateBranch(branch, to, maxLen, newEvent) {
329
- let start = to + 1 > maxLen + 20 ? to - maxLen - 1 : 0;
330
- let newBranch = branch.slice(start, to);
331
- newBranch.push(newEvent);
332
- return newBranch;
333
- }
334
- function isAdjacent(a, b) {
335
- let ranges = [], isAdjacent = false;
336
- a.iterChangedRanges((f, t) => ranges.push(f, t));
337
- b.iterChangedRanges((_f, _t, f, t) => {
338
- for (let i = 0; i < ranges.length;) {
339
- let from = ranges[i++], to = ranges[i++];
340
- if (t >= from && f <= to) isAdjacent = true;
341
- }
342
- });
343
- return isAdjacent;
344
- }
345
- function eqSelectionShape(a, b) {
346
- return a.ranges.length == b.ranges.length && a.ranges.filter((r, i) => r.empty != b.ranges[i].empty).length === 0;
347
- }
348
- function conc(a, b) {
349
- return !a.length ? b : !b.length ? a : a.concat(b);
350
- }
351
- var none = [];
352
- var MaxSelectionsPerEvent = 200;
353
- function addSelection(branch, selection) {
354
- if (!branch.length) return [HistEvent.selection([selection])];
355
- else {
356
- let lastEvent = branch[branch.length - 1];
357
- let sels = lastEvent.selectionsAfter.slice(Math.max(0, lastEvent.selectionsAfter.length - MaxSelectionsPerEvent));
358
- if (sels.length && sels[sels.length - 1].eq(selection)) return branch;
359
- sels.push(selection);
360
- return updateBranch(branch, branch.length - 1, 1e9, lastEvent.setSelAfter(sels));
361
- }
362
- }
363
- function popSelection(branch) {
364
- let last = branch[branch.length - 1];
365
- let newBranch = branch.slice();
366
- newBranch[branch.length - 1] = last.setSelAfter(last.selectionsAfter.slice(0, last.selectionsAfter.length - 1));
367
- return newBranch;
368
- }
369
- function addMappingToBranch(branch, mapping) {
370
- if (!branch.length) return branch;
371
- let length = branch.length, selections = none;
372
- while (length) {
373
- let event = mapEvent(branch[length - 1], mapping, selections);
374
- if (event.changes && !event.changes.empty || event.effects.length) {
375
- let result = branch.slice(0, length);
376
- result[length - 1] = event;
377
- return result;
378
- } else {
379
- mapping = event.mapped;
380
- length--;
381
- selections = event.selectionsAfter;
382
- }
383
- }
384
- return selections.length ? [HistEvent.selection(selections)] : none;
385
- }
386
- function mapEvent(event, mapping, extraSelections) {
387
- let selections = conc(event.selectionsAfter.length ? event.selectionsAfter.map((s) => s.map(mapping)) : none, extraSelections);
388
- if (!event.changes) return HistEvent.selection(selections);
389
- let mappedChanges = event.changes.map(mapping), before = mapping.mapDesc(event.changes, true);
390
- let fullMapping = event.mapped ? event.mapped.composeDesc(before) : before;
391
- return new HistEvent(mappedChanges, StateEffect.mapEffects(event.effects, mapping), fullMapping, event.startSelection.map(before), selections);
392
- }
393
- var joinableUserEvent = /^(input\.type|delete)($|\.)/;
394
- var HistoryState = class HistoryState {
395
- constructor(done, undone, prevTime = 0, prevUserEvent = void 0) {
396
- this.done = done;
397
- this.undone = undone;
398
- this.prevTime = prevTime;
399
- this.prevUserEvent = prevUserEvent;
400
- }
401
- isolate() {
402
- return this.prevTime ? new HistoryState(this.done, this.undone) : this;
403
- }
404
- addChanges(event, time, userEvent, config, tr) {
405
- let done = this.done, lastEvent = done[done.length - 1];
406
- if (lastEvent && lastEvent.changes && !lastEvent.changes.empty && event.changes && (!userEvent || joinableUserEvent.test(userEvent)) && (!lastEvent.selectionsAfter.length && time - this.prevTime < config.newGroupDelay && config.joinToEvent(tr, isAdjacent(lastEvent.changes, event.changes)) || userEvent == "input.type.compose")) done = updateBranch(done, done.length - 1, config.minDepth, new HistEvent(event.changes.compose(lastEvent.changes), conc(StateEffect.mapEffects(event.effects, lastEvent.changes), lastEvent.effects), lastEvent.mapped, lastEvent.startSelection, none));
407
- else done = updateBranch(done, done.length, config.minDepth, event);
408
- return new HistoryState(done, none, time, userEvent);
409
- }
410
- addSelection(selection, time, userEvent, newGroupDelay) {
411
- let last = this.done.length ? this.done[this.done.length - 1].selectionsAfter : none;
412
- if (last.length > 0 && time - this.prevTime < newGroupDelay && userEvent == this.prevUserEvent && userEvent && /^select($|\.)/.test(userEvent) && eqSelectionShape(last[last.length - 1], selection)) return this;
413
- return new HistoryState(addSelection(this.done, selection), this.undone, time, userEvent);
414
- }
415
- addMapping(mapping) {
416
- return new HistoryState(addMappingToBranch(this.done, mapping), addMappingToBranch(this.undone, mapping), this.prevTime, this.prevUserEvent);
417
- }
418
- pop(side, state, onlySelection) {
419
- let branch = side == 0 ? this.done : this.undone;
420
- if (branch.length == 0) return null;
421
- let event = branch[branch.length - 1], selection = event.selectionsAfter[0] || (event.startSelection ? event.startSelection.map(event.changes.invertedDesc, 1) : state.selection);
422
- if (onlySelection && event.selectionsAfter.length) return state.update({
423
- selection: event.selectionsAfter[event.selectionsAfter.length - 1],
424
- annotations: fromHistory.of({
425
- side,
426
- rest: popSelection(branch),
427
- selection
428
- }),
429
- userEvent: side == 0 ? "select.undo" : "select.redo",
430
- scrollIntoView: true
431
- });
432
- else if (!event.changes) return null;
433
- else {
434
- let rest = branch.length == 1 ? none : branch.slice(0, branch.length - 1);
435
- if (event.mapped) rest = addMappingToBranch(rest, event.mapped);
436
- return state.update({
437
- changes: event.changes,
438
- selection: event.startSelection,
439
- effects: event.effects,
440
- annotations: fromHistory.of({
441
- side,
442
- rest,
443
- selection
444
- }),
445
- filter: false,
446
- userEvent: side == 0 ? "undo" : "redo",
447
- scrollIntoView: true
448
- });
449
- }
450
- }
451
- };
452
- HistoryState.empty = /*@__PURE__*/ new HistoryState(none, none);
453
- /**
454
- Default key bindings for the undo history.
455
-
456
- - Mod-z: [`undo`](https://codemirror.net/6/docs/ref/#commands.undo).
457
- - Mod-y (Mod-Shift-z on macOS) + Ctrl-Shift-z on Linux: [`redo`](https://codemirror.net/6/docs/ref/#commands.redo).
458
- - Mod-u: [`undoSelection`](https://codemirror.net/6/docs/ref/#commands.undoSelection).
459
- - Alt-u (Mod-Shift-u on macOS): [`redoSelection`](https://codemirror.net/6/docs/ref/#commands.redoSelection).
460
- */
461
- var historyKeymap = [
462
- {
463
- key: "Mod-z",
464
- run: undo,
465
- preventDefault: true
466
- },
467
- {
468
- key: "Mod-y",
469
- mac: "Mod-Shift-z",
470
- run: redo,
471
- preventDefault: true
472
- },
473
- {
474
- linux: "Ctrl-Shift-z",
475
- run: redo,
476
- preventDefault: true
477
- },
478
- {
479
- key: "Mod-u",
480
- run: undoSelection,
481
- preventDefault: true
482
- },
483
- {
484
- key: "Alt-u",
485
- mac: "Mod-Shift-u",
486
- run: redoSelection,
487
- preventDefault: true
488
- }
489
- ];
490
- function updateSel(sel, by) {
491
- return EditorSelection.create(sel.ranges.map(by), sel.mainIndex);
492
- }
493
- function setSel(state, selection) {
494
- return state.update({
495
- selection,
496
- scrollIntoView: true,
497
- userEvent: "select"
498
- });
499
- }
500
- function moveSel({ state, dispatch }, how) {
501
- let selection = updateSel(state.selection, how);
502
- if (selection.eq(state.selection, true)) return false;
503
- dispatch(setSel(state, selection));
504
- return true;
505
- }
506
- function rangeEnd(range, forward) {
507
- return EditorSelection.cursor(forward ? range.to : range.from);
508
- }
509
- function cursorByChar(view, forward) {
510
- return moveSel(view, (range) => range.empty ? view.moveByChar(range, forward) : rangeEnd(range, forward));
511
- }
512
- function ltrAtCursor(view) {
513
- return view.textDirectionAt(view.state.selection.main.head) == Direction.LTR;
514
- }
515
- /**
516
- Move the selection one character to the left (which is backward in
517
- left-to-right text, forward in right-to-left text).
518
- */
519
- var cursorCharLeft = (view) => cursorByChar(view, !ltrAtCursor(view));
520
- /**
521
- Move the selection one character to the right.
522
- */
523
- var cursorCharRight = (view) => cursorByChar(view, ltrAtCursor(view));
524
- function cursorByGroup(view, forward) {
525
- return moveSel(view, (range) => range.empty ? view.moveByGroup(range, forward) : rangeEnd(range, forward));
526
- }
527
- /**
528
- Move the selection to the left across one group of word or
529
- non-word (but also non-space) characters.
530
- */
531
- var cursorGroupLeft = (view) => cursorByGroup(view, !ltrAtCursor(view));
532
- /**
533
- Move the selection one group to the right.
534
- */
535
- var cursorGroupRight = (view) => cursorByGroup(view, ltrAtCursor(view));
536
- typeof Intl != "undefined" && Intl.Segmenter;
537
- function interestingNode(state, node, bracketProp) {
538
- if (node.type.prop(bracketProp)) return true;
539
- let len = node.to - node.from;
540
- return len && (len > 2 || /[^\s,.;:]/.test(state.sliceDoc(node.from, node.to))) || node.firstChild;
541
- }
542
- function moveBySyntax(state, start, forward) {
543
- let pos = syntaxTree(state).resolveInner(start.head);
544
- let bracketProp = forward ? NodeProp.closedBy : NodeProp.openedBy;
545
- for (let at = start.head;;) {
546
- let next = forward ? pos.childAfter(at) : pos.childBefore(at);
547
- if (!next) break;
548
- if (interestingNode(state, next, bracketProp)) pos = next;
549
- else at = forward ? next.to : next.from;
550
- }
551
- let bracket = pos.type.prop(bracketProp), match, newPos;
552
- if (bracket && (match = forward ? matchBrackets(state, pos.from, 1) : matchBrackets(state, pos.to, -1)) && match.matched) newPos = forward ? match.end.to : match.end.from;
553
- else newPos = forward ? pos.to : pos.from;
554
- return EditorSelection.cursor(newPos, forward ? -1 : 1);
555
- }
556
- /**
557
- Move the cursor over the next syntactic element to the left.
558
- */
559
- var cursorSyntaxLeft = (view) => moveSel(view, (range) => moveBySyntax(view.state, range, !ltrAtCursor(view)));
560
- /**
561
- Move the cursor over the next syntactic element to the right.
562
- */
563
- var cursorSyntaxRight = (view) => moveSel(view, (range) => moveBySyntax(view.state, range, ltrAtCursor(view)));
564
- function cursorByLine(view, forward) {
565
- return moveSel(view, (range) => {
566
- if (!range.empty) return rangeEnd(range, forward);
567
- let moved = view.moveVertically(range, forward);
568
- return moved.head != range.head ? moved : view.moveToLineBoundary(range, forward);
569
- });
570
- }
571
- /**
572
- Move the selection one line up.
573
- */
574
- var cursorLineUp = (view) => cursorByLine(view, false);
575
- /**
576
- Move the selection one line down.
577
- */
578
- var cursorLineDown = (view) => cursorByLine(view, true);
579
- function pageInfo(view) {
580
- let selfScroll = view.scrollDOM.clientHeight < view.scrollDOM.scrollHeight - 2;
581
- let marginTop = 0, marginBottom = 0, height;
582
- if (selfScroll) {
583
- for (let source of view.state.facet(EditorView.scrollMargins)) {
584
- let margins = source(view);
585
- if (margins === null || margins === void 0 ? void 0 : margins.top) marginTop = Math.max(margins === null || margins === void 0 ? void 0 : margins.top, marginTop);
586
- if (margins === null || margins === void 0 ? void 0 : margins.bottom) marginBottom = Math.max(margins === null || margins === void 0 ? void 0 : margins.bottom, marginBottom);
587
- }
588
- height = view.scrollDOM.clientHeight - marginTop - marginBottom;
589
- } else height = (view.dom.ownerDocument.defaultView || window).innerHeight;
590
- return {
591
- marginTop,
592
- marginBottom,
593
- selfScroll,
594
- height: Math.max(view.defaultLineHeight, height - 5)
595
- };
596
- }
597
- function cursorByPage(view, forward) {
598
- let page = pageInfo(view);
599
- let { state } = view, selection = updateSel(state.selection, (range) => {
600
- return range.empty ? view.moveVertically(range, forward, page.height) : rangeEnd(range, forward);
601
- });
602
- if (selection.eq(state.selection)) return false;
603
- let effect;
604
- if (page.selfScroll) {
605
- let startPos = view.coordsAtPos(state.selection.main.head);
606
- let scrollRect = view.scrollDOM.getBoundingClientRect();
607
- let scrollTop = scrollRect.top + page.marginTop, scrollBottom = scrollRect.bottom - page.marginBottom;
608
- if (startPos && startPos.top > scrollTop && startPos.bottom < scrollBottom) effect = EditorView.scrollIntoView(selection.main.head, {
609
- y: "start",
610
- yMargin: startPos.top - scrollTop
611
- });
612
- }
613
- view.dispatch(setSel(state, selection), { effects: effect });
614
- return true;
615
- }
616
- /**
617
- Move the selection one page up.
618
- */
619
- var cursorPageUp = (view) => cursorByPage(view, false);
620
- /**
621
- Move the selection one page down.
622
- */
623
- var cursorPageDown = (view) => cursorByPage(view, true);
624
- function moveByLineBoundary(view, start, forward) {
625
- let line = view.lineBlockAt(start.head), moved = view.moveToLineBoundary(start, forward);
626
- if (moved.head == start.head && moved.head != (forward ? line.to : line.from)) moved = view.moveToLineBoundary(start, forward, false);
627
- if (!forward && moved.head == line.from && line.length) {
628
- let space = /^\s*/.exec(view.state.sliceDoc(line.from, Math.min(line.from + 100, line.to)))[0].length;
629
- if (space && start.head != line.from + space) moved = EditorSelection.cursor(line.from + space);
630
- }
631
- return moved;
632
- }
633
- /**
634
- Move the selection to the next line wrap point, or to the end of
635
- the line if there isn't one left on this line.
636
- */
637
- var cursorLineBoundaryForward = (view) => moveSel(view, (range) => moveByLineBoundary(view, range, true));
638
- /**
639
- Move the selection to previous line wrap point, or failing that to
640
- the start of the line. If the line is indented, and the cursor
641
- isn't already at the end of the indentation, this will move to the
642
- end of the indentation instead of the start of the line.
643
- */
644
- var cursorLineBoundaryBackward = (view) => moveSel(view, (range) => moveByLineBoundary(view, range, false));
645
- /**
646
- Move the selection one line wrap point to the left.
647
- */
648
- var cursorLineBoundaryLeft = (view) => moveSel(view, (range) => moveByLineBoundary(view, range, !ltrAtCursor(view)));
649
- /**
650
- Move the selection one line wrap point to the right.
651
- */
652
- var cursorLineBoundaryRight = (view) => moveSel(view, (range) => moveByLineBoundary(view, range, ltrAtCursor(view)));
653
- /**
654
- Move the selection to the start of the line.
655
- */
656
- var cursorLineStart = (view) => moveSel(view, (range) => EditorSelection.cursor(view.lineBlockAt(range.head).from, 1));
657
- /**
658
- Move the selection to the end of the line.
659
- */
660
- var cursorLineEnd = (view) => moveSel(view, (range) => EditorSelection.cursor(view.lineBlockAt(range.head).to, -1));
661
- function toMatchingBracket(state, dispatch, extend) {
662
- let found = false, selection = updateSel(state.selection, (range) => {
663
- let matching = matchBrackets(state, range.head, -1) || matchBrackets(state, range.head, 1) || range.head > 0 && matchBrackets(state, range.head - 1, 1) || range.head < state.doc.length && matchBrackets(state, range.head + 1, -1);
664
- if (!matching || !matching.end) return range;
665
- found = true;
666
- let head = matching.start.from == range.head ? matching.end.to : matching.end.from;
667
- return extend ? EditorSelection.range(range.anchor, head) : EditorSelection.cursor(head);
668
- });
669
- if (!found) return false;
670
- dispatch(setSel(state, selection));
671
- return true;
672
- }
673
- /**
674
- Move the selection to the bracket matching the one it is currently
675
- on, if any.
676
- */
677
- var cursorMatchingBracket = ({ state, dispatch }) => toMatchingBracket(state, dispatch, false);
678
- function extendSel(target, forward, how) {
679
- let selection = updateSel(target.state.selection, (range) => {
680
- if (range.undirectional && range.head >= range.anchor != forward) range = EditorSelection.range(range.head, range.anchor);
681
- let head = how(range);
682
- return EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || void 0, head.assoc);
683
- });
684
- if (selection.eq(target.state.selection)) return false;
685
- target.dispatch(setSel(target.state, selection));
686
- return true;
687
- }
688
- function selectByChar(view, forward) {
689
- return extendSel(view, forward, (range) => view.moveByChar(range, forward));
690
- }
691
- /**
692
- Move the selection head one character to the left, while leaving
693
- the anchor in place.
694
- */
695
- var selectCharLeft = (view) => selectByChar(view, !ltrAtCursor(view));
696
- /**
697
- Move the selection head one character to the right.
698
- */
699
- var selectCharRight = (view) => selectByChar(view, ltrAtCursor(view));
700
- function selectByGroup(view, forward) {
701
- return extendSel(view, forward, (range) => view.moveByGroup(range, forward));
702
- }
703
- /**
704
- Move the selection head one [group](https://codemirror.net/6/docs/ref/#commands.cursorGroupLeft) to
705
- the left.
706
- */
707
- var selectGroupLeft = (view) => selectByGroup(view, !ltrAtCursor(view));
708
- /**
709
- Move the selection head one group to the right.
710
- */
711
- var selectGroupRight = (view) => selectByGroup(view, ltrAtCursor(view));
712
- /**
713
- Move the selection head over the next syntactic element to the left.
714
- */
715
- var selectSyntaxLeft = (view) => {
716
- let forward = !ltrAtCursor(view);
717
- return extendSel(view, forward, (range) => moveBySyntax(view.state, range, forward));
718
- };
719
- /**
720
- Move the selection head over the next syntactic element to the right.
721
- */
722
- var selectSyntaxRight = (view) => {
723
- let forward = ltrAtCursor(view);
724
- return extendSel(view, forward, (range) => moveBySyntax(view.state, range, forward));
725
- };
726
- function selectByLine(view, forward) {
727
- return extendSel(view, forward, (range) => view.moveVertically(range, forward));
728
- }
729
- /**
730
- Move the selection head one line up.
731
- */
732
- var selectLineUp = (view) => selectByLine(view, false);
733
- /**
734
- Move the selection head one line down.
735
- */
736
- var selectLineDown = (view) => selectByLine(view, true);
737
- function selectByPage(view, forward) {
738
- return extendSel(view, forward, (range) => view.moveVertically(range, forward, pageInfo(view).height));
739
- }
740
- /**
741
- Move the selection head one page up.
742
- */
743
- var selectPageUp = (view) => selectByPage(view, false);
744
- /**
745
- Move the selection head one page down.
746
- */
747
- var selectPageDown = (view) => selectByPage(view, true);
748
- /**
749
- Move the selection head to the next line boundary.
750
- */
751
- var selectLineBoundaryForward = (view) => extendSel(view, true, (range) => moveByLineBoundary(view, range, true));
752
- /**
753
- Move the selection head to the previous line boundary.
754
- */
755
- var selectLineBoundaryBackward = (view) => extendSel(view, false, (range) => moveByLineBoundary(view, range, false));
756
- /**
757
- Move the selection head one line boundary to the left.
758
- */
759
- var selectLineBoundaryLeft = (view) => {
760
- let forward = !ltrAtCursor(view);
761
- return extendSel(view, forward, (range) => moveByLineBoundary(view, range, forward));
762
- };
763
- /**
764
- Move the selection head one line boundary to the right.
765
- */
766
- var selectLineBoundaryRight = (view) => {
767
- let forward = ltrAtCursor(view);
768
- return extendSel(view, forward, (range) => moveByLineBoundary(view, range, forward));
769
- };
770
- /**
771
- Move the selection head to the start of the line.
772
- */
773
- var selectLineStart = (view) => extendSel(view, false, (range) => EditorSelection.cursor(view.lineBlockAt(range.head).from));
774
- /**
775
- Move the selection head to the end of the line.
776
- */
777
- var selectLineEnd = (view) => extendSel(view, true, (range) => EditorSelection.cursor(view.lineBlockAt(range.head).to));
778
- /**
779
- Move the selection to the start of the document.
780
- */
781
- var cursorDocStart = ({ state, dispatch }) => {
782
- dispatch(setSel(state, { anchor: 0 }));
783
- return true;
784
- };
785
- /**
786
- Move the selection to the end of the document.
787
- */
788
- var cursorDocEnd = ({ state, dispatch }) => {
789
- dispatch(setSel(state, { anchor: state.doc.length }));
790
- return true;
791
- };
792
- /**
793
- Move the selection head to the start of the document.
794
- */
795
- var selectDocStart = ({ state, dispatch }) => {
796
- dispatch(setSel(state, {
797
- anchor: state.selection.main.anchor,
798
- head: 0
799
- }));
800
- return true;
801
- };
802
- /**
803
- Move the selection head to the end of the document.
804
- */
805
- var selectDocEnd = ({ state, dispatch }) => {
806
- dispatch(setSel(state, {
807
- anchor: state.selection.main.anchor,
808
- head: state.doc.length
809
- }));
810
- return true;
811
- };
812
- /**
813
- Select the entire document.
814
- */
815
- var selectAll = ({ state, dispatch }) => {
816
- dispatch(state.update({
817
- selection: {
818
- anchor: 0,
819
- head: state.doc.length
820
- },
821
- userEvent: "select"
822
- }));
823
- return true;
824
- };
825
- /**
826
- Expand the selection to cover entire lines.
827
- */
828
- var selectLine = ({ state, dispatch }) => {
829
- let ranges = selectedLineBlocks(state).map(({ from, to }) => EditorSelection.range(from, Math.min(to + 1, state.doc.length)));
830
- dispatch(state.update({
831
- selection: EditorSelection.create(ranges),
832
- userEvent: "select"
833
- }));
834
- return true;
835
- };
836
- /**
837
- Select the next syntactic construct that is larger than the
838
- selection. Note that this will only work insofar as the language
839
- [provider](https://codemirror.net/6/docs/ref/#language.language) you use builds up a full
840
- syntax tree.
841
- */
842
- var selectParentSyntax = ({ state, dispatch }) => {
843
- let selection = updateSel(state.selection, (range) => {
844
- let tree = syntaxTree(state), stack = tree.resolveStack(range.from, 1);
845
- if (range.empty) {
846
- let stackBefore = tree.resolveStack(range.from, -1);
847
- if (stackBefore.node.from >= stack.node.from && stackBefore.node.to <= stack.node.to) stack = stackBefore;
848
- }
849
- for (let cur = stack; cur; cur = cur.next) {
850
- let { node } = cur;
851
- if ((node.from < range.from && node.to >= range.to || node.to > range.to && node.from <= range.from) && cur.next) return EditorSelection.range(node.to, node.from);
852
- }
853
- return range;
854
- });
855
- if (selection.eq(state.selection)) return false;
856
- dispatch(setSel(state, selection));
857
- return true;
858
- };
859
- function addCursorVertically(view, forward) {
860
- let { state } = view, sel = state.selection, ranges = state.selection.ranges.slice();
861
- for (let range of state.selection.ranges) {
862
- let line = state.doc.lineAt(range.head);
863
- if (forward ? line.to < view.state.doc.length : line.from > 0) for (let cur = range;;) {
864
- let next = view.moveVertically(cur, forward);
865
- if (next.head < line.from || next.head > line.to) {
866
- if (!ranges.some((r) => r.head == next.head)) ranges.push(next);
867
- break;
868
- } else if (next.head == cur.head) break;
869
- else cur = next;
870
- }
871
- }
872
- if (ranges.length == sel.ranges.length) return false;
873
- view.dispatch(setSel(state, EditorSelection.create(ranges, ranges.length - 1)));
874
- return true;
875
- }
876
- /**
877
- Expand the selection by adding a cursor above the heads of
878
- currently selected ranges.
879
- */
880
- var addCursorAbove = (view) => addCursorVertically(view, false);
881
- /**
882
- Expand the selection by adding a cursor below the heads of
883
- currently selected ranges.
884
- */
885
- var addCursorBelow = (view) => addCursorVertically(view, true);
886
- /**
887
- Simplify the current selection. When multiple ranges are selected,
888
- reduce it to its main range. Otherwise, if the selection is
889
- non-empty, convert it to a cursor selection.
890
- */
891
- var simplifySelection = ({ state, dispatch }) => {
892
- let cur = state.selection, selection = null;
893
- if (cur.ranges.length > 1) selection = EditorSelection.create([cur.main]);
894
- else if (!cur.main.empty) selection = EditorSelection.create([EditorSelection.cursor(cur.main.head)]);
895
- if (!selection) return false;
896
- dispatch(setSel(state, selection));
897
- return true;
898
- };
899
- function deleteBy(target, by) {
900
- if (target.state.readOnly) return false;
901
- let event = "delete.selection", { state } = target;
902
- let changes = state.changeByRange((range) => {
903
- let { from, to } = range;
904
- if (from == to) {
905
- let towards = by(range);
906
- if (towards < from) {
907
- event = "delete.backward";
908
- towards = skipAtomic(target, towards, false);
909
- } else if (towards > from) {
910
- event = "delete.forward";
911
- towards = skipAtomic(target, towards, true);
912
- }
913
- from = Math.min(from, towards);
914
- to = Math.max(to, towards);
915
- } else {
916
- from = skipAtomic(target, from, false);
917
- to = skipAtomic(target, to, true);
918
- }
919
- return from == to ? { range } : {
920
- changes: {
921
- from,
922
- to
923
- },
924
- range: EditorSelection.cursor(from, from < range.head ? -1 : 1)
925
- };
926
- });
927
- if (changes.changes.empty) return false;
928
- target.dispatch(state.update(changes, {
929
- scrollIntoView: true,
930
- userEvent: event,
931
- effects: event == "delete.selection" ? EditorView.announce.of(state.phrase("Selection deleted")) : void 0
932
- }));
933
- return true;
934
- }
935
- function skipAtomic(target, pos, forward) {
936
- if (target instanceof EditorView) for (let ranges of target.state.facet(EditorView.atomicRanges).map((f) => f(target))) ranges.between(pos, pos, (from, to) => {
937
- if (from < pos && to > pos) pos = forward ? to : from;
938
- });
939
- return pos;
940
- }
941
- var deleteByChar = (target, forward, byIndentUnit) => deleteBy(target, (range) => {
942
- let pos = range.from, { state } = target, line = state.doc.lineAt(pos), before, targetPos;
943
- if (byIndentUnit && !forward && pos > line.from && pos < line.from + 200 && !/[^ \t]/.test(before = line.text.slice(0, pos - line.from))) {
944
- if (before[before.length - 1] == " ") return pos - 1;
945
- let drop = countColumn(before, state.tabSize) % getIndentUnit(state) || getIndentUnit(state);
946
- for (let i = 0; i < drop && before[before.length - 1 - i] == " "; i++) pos--;
947
- targetPos = pos;
948
- } else {
949
- targetPos = findClusterBreak(line.text, pos - line.from, forward, forward) + line.from;
950
- if (targetPos == pos && line.number != (forward ? state.doc.lines : 1)) targetPos += forward ? 1 : -1;
951
- else if (!forward && /[\ufe00-\ufe0f]/.test(line.text.slice(targetPos - line.from, pos - line.from))) targetPos = findClusterBreak(line.text, targetPos - line.from, false, false) + line.from;
952
- }
953
- return targetPos;
954
- });
955
- /**
956
- Delete the selection, or, for cursor selections, the character or
957
- indentation unit before the cursor.
958
- */
959
- var deleteCharBackward = (view) => deleteByChar(view, false, true);
960
- /**
961
- Delete the selection or the character after the cursor.
962
- */
963
- var deleteCharForward = (view) => deleteByChar(view, true, false);
964
- var deleteByGroup = (target, forward) => deleteBy(target, (range) => {
965
- let pos = range.head, { state } = target, line = state.doc.lineAt(pos);
966
- let categorize = state.charCategorizer(pos);
967
- for (let cat = null;;) {
968
- if (pos == (forward ? line.to : line.from)) {
969
- if (pos == range.head && line.number != (forward ? state.doc.lines : 1)) pos += forward ? 1 : -1;
970
- break;
971
- }
972
- let next = findClusterBreak(line.text, pos - line.from, forward) + line.from;
973
- let nextChar = line.text.slice(Math.min(pos, next) - line.from, Math.max(pos, next) - line.from);
974
- let nextCat = categorize(nextChar);
975
- if (cat != null && nextCat != cat) break;
976
- if (nextChar != " " || pos != range.head) cat = nextCat;
977
- pos = next;
978
- }
979
- return pos;
980
- });
981
- /**
982
- Delete the selection or backward until the end of the next
983
- [group](https://codemirror.net/6/docs/ref/#view.EditorView.moveByGroup), only skipping groups of
984
- whitespace when they consist of a single space.
985
- */
986
- var deleteGroupBackward = (target) => deleteByGroup(target, false);
987
- /**
988
- Delete the selection or forward until the end of the next group.
989
- */
990
- var deleteGroupForward = (target) => deleteByGroup(target, true);
991
- /**
992
- Delete the selection, or, if it is a cursor selection, delete to
993
- the end of the line. If the cursor is directly at the end of the
994
- line, delete the line break after it.
995
- */
996
- var deleteToLineEnd = (view) => deleteBy(view, (range) => {
997
- let lineEnd = view.lineBlockAt(range.head).to;
998
- return range.head < lineEnd ? lineEnd : Math.min(view.state.doc.length, range.head + 1);
999
- });
1000
- /**
1001
- Delete the selection, or, if it is a cursor selection, delete to
1002
- the start of the line or the next line wrap before the cursor.
1003
- */
1004
- var deleteLineBoundaryBackward = (view) => deleteBy(view, (range) => {
1005
- let lineStart = view.moveToLineBoundary(range, false).head;
1006
- return range.head > lineStart ? lineStart : Math.max(0, range.head - 1);
1007
- });
1008
- /**
1009
- Delete the selection, or, if it is a cursor selection, delete to
1010
- the end of the line or the next line wrap after the cursor.
1011
- */
1012
- var deleteLineBoundaryForward = (view) => deleteBy(view, (range) => {
1013
- let lineStart = view.moveToLineBoundary(range, true).head;
1014
- return range.head < lineStart ? lineStart : Math.min(view.state.doc.length, range.head + 1);
1015
- });
1016
- /**
1017
- Replace each selection range with a line break, leaving the cursor
1018
- on the line before the break.
1019
- */
1020
- var splitLine = ({ state, dispatch }) => {
1021
- if (state.readOnly) return false;
1022
- let changes = state.changeByRange((range) => {
1023
- return {
1024
- changes: {
1025
- from: range.from,
1026
- to: range.to,
1027
- insert: Text.of(["", ""])
1028
- },
1029
- range: EditorSelection.cursor(range.from)
1030
- };
1031
- });
1032
- dispatch(state.update(changes, {
1033
- scrollIntoView: true,
1034
- userEvent: "input"
1035
- }));
1036
- return true;
1037
- };
1038
- /**
1039
- Flip the characters before and after the cursor(s).
1040
- */
1041
- var transposeChars = ({ state, dispatch }) => {
1042
- if (state.readOnly) return false;
1043
- let changes = state.changeByRange((range) => {
1044
- if (!range.empty || range.from == 0 || range.from == state.doc.length) return { range };
1045
- let pos = range.from, line = state.doc.lineAt(pos);
1046
- let from = pos == line.from ? pos - 1 : findClusterBreak(line.text, pos - line.from, false) + line.from;
1047
- let to = pos == line.to ? pos + 1 : findClusterBreak(line.text, pos - line.from, true) + line.from;
1048
- return {
1049
- changes: {
1050
- from,
1051
- to,
1052
- insert: state.doc.slice(pos, to).append(state.doc.slice(from, pos))
1053
- },
1054
- range: EditorSelection.cursor(to)
1055
- };
1056
- });
1057
- if (changes.changes.empty) return false;
1058
- dispatch(state.update(changes, {
1059
- scrollIntoView: true,
1060
- userEvent: "move.character"
1061
- }));
1062
- return true;
1063
- };
1064
- function selectedLineBlocks(state) {
1065
- let blocks = [], upto = -1;
1066
- for (let range of state.selection.ranges) {
1067
- let startLine = state.doc.lineAt(range.from), endLine = state.doc.lineAt(range.to);
1068
- if (!range.empty && range.to == endLine.from) endLine = state.doc.lineAt(range.to - 1);
1069
- if (upto >= startLine.number) {
1070
- let prev = blocks[blocks.length - 1];
1071
- prev.to = endLine.to;
1072
- prev.ranges.push(range);
1073
- } else blocks.push({
1074
- from: startLine.from,
1075
- to: endLine.to,
1076
- ranges: [range]
1077
- });
1078
- upto = endLine.number + 1;
1079
- }
1080
- return blocks;
1081
- }
1082
- function moveLine(state, dispatch, forward) {
1083
- if (state.readOnly) return false;
1084
- let changes = [], ranges = [];
1085
- for (let block of selectedLineBlocks(state)) {
1086
- if (forward ? block.to == state.doc.length : block.from == 0) continue;
1087
- let nextLine = state.doc.lineAt(forward ? block.to + 1 : block.from - 1);
1088
- let size = nextLine.length + 1;
1089
- if (forward) {
1090
- changes.push({
1091
- from: block.to,
1092
- to: nextLine.to
1093
- }, {
1094
- from: block.from,
1095
- insert: nextLine.text + state.lineBreak
1096
- });
1097
- for (let r of block.ranges) ranges.push(EditorSelection.range(Math.min(state.doc.length, r.anchor + size), Math.min(state.doc.length, r.head + size)));
1098
- } else {
1099
- changes.push({
1100
- from: nextLine.from,
1101
- to: block.from
1102
- }, {
1103
- from: block.to,
1104
- insert: state.lineBreak + nextLine.text
1105
- });
1106
- for (let r of block.ranges) ranges.push(EditorSelection.range(r.anchor - size, r.head - size));
1107
- }
1108
- }
1109
- if (!changes.length) return false;
1110
- dispatch(state.update({
1111
- changes,
1112
- scrollIntoView: true,
1113
- selection: EditorSelection.create(ranges, state.selection.mainIndex),
1114
- userEvent: "move.line"
1115
- }));
1116
- return true;
1117
- }
1118
- /**
1119
- Move the selected lines up one line.
1120
- */
1121
- var moveLineUp = ({ state, dispatch }) => moveLine(state, dispatch, false);
1122
- /**
1123
- Move the selected lines down one line.
1124
- */
1125
- var moveLineDown = ({ state, dispatch }) => moveLine(state, dispatch, true);
1126
- function copyLine(state, dispatch, forward) {
1127
- if (state.readOnly) return false;
1128
- let changes = [];
1129
- for (let block of selectedLineBlocks(state)) if (forward) changes.push({
1130
- from: block.from,
1131
- insert: state.doc.slice(block.from, block.to) + state.lineBreak
1132
- });
1133
- else changes.push({
1134
- from: block.to,
1135
- insert: state.lineBreak + state.doc.slice(block.from, block.to)
1136
- });
1137
- let changeSet = state.changes(changes);
1138
- dispatch(state.update({
1139
- changes: changeSet,
1140
- selection: state.selection.map(changeSet, forward ? 1 : -1),
1141
- scrollIntoView: true,
1142
- userEvent: "input.copyline"
1143
- }));
1144
- return true;
1145
- }
1146
- /**
1147
- Create a copy of the selected lines. Keep the selection in the top copy.
1148
- */
1149
- var copyLineUp = ({ state, dispatch }) => copyLine(state, dispatch, false);
1150
- /**
1151
- Create a copy of the selected lines. Keep the selection in the bottom copy.
1152
- */
1153
- var copyLineDown = ({ state, dispatch }) => copyLine(state, dispatch, true);
1154
- /**
1155
- Delete selected lines.
1156
- */
1157
- var deleteLine = (view) => {
1158
- if (view.state.readOnly) return false;
1159
- let { state } = view, changes = state.changes(selectedLineBlocks(state).map(({ from, to }) => {
1160
- if (from > 0) from--;
1161
- else if (to < state.doc.length) to++;
1162
- return {
1163
- from,
1164
- to
1165
- };
1166
- }));
1167
- let selection = updateSel(state.selection, (range) => {
1168
- let dist = void 0;
1169
- if (view.lineWrapping) {
1170
- let block = view.lineBlockAt(range.head), pos = view.coordsAtPos(range.head, range.assoc || 1);
1171
- if (pos) dist = block.bottom + view.documentTop - pos.bottom + view.defaultLineHeight / 2;
1172
- }
1173
- return view.moveVertically(range, true, dist);
1174
- }).map(changes);
1175
- view.dispatch({
1176
- changes,
1177
- selection,
1178
- scrollIntoView: true,
1179
- userEvent: "delete.line"
1180
- });
1181
- return true;
1182
- };
1183
- function isBetweenBrackets(state, pos) {
1184
- if (/\(\)|\[\]|\{\}/.test(state.sliceDoc(pos - 1, pos + 1))) return {
1185
- from: pos,
1186
- to: pos
1187
- };
1188
- let context = syntaxTree(state).resolveInner(pos);
1189
- let before = context.childBefore(pos), after = context.childAfter(pos), closedBy;
1190
- if (before && after && before.to <= pos && after.from >= pos && (closedBy = before.type.prop(NodeProp.closedBy)) && closedBy.indexOf(after.name) > -1 && state.doc.lineAt(before.to).from == state.doc.lineAt(after.from).from && !/\S/.test(state.sliceDoc(before.to, after.from))) return {
1191
- from: before.to,
1192
- to: after.from
1193
- };
1194
- return null;
1195
- }
1196
- /**
1197
- Replace the selection with a newline and indent the newly created
1198
- line(s). If the current line consists only of whitespace, this
1199
- will also delete that whitespace. When the cursor is between
1200
- matching brackets, an additional newline will be inserted after
1201
- the cursor.
1202
- */
1203
- var insertNewlineAndIndent = /*@__PURE__*/ newlineAndIndent(false);
1204
- /**
1205
- Create a blank, indented line below the current line.
1206
- */
1207
- var insertBlankLine = /*@__PURE__*/ newlineAndIndent(true);
1208
- function newlineAndIndent(atEof) {
1209
- return ({ state, dispatch }) => {
1210
- if (state.readOnly) return false;
1211
- let changes = state.changeByRange((range) => {
1212
- let { from, to } = range, line = state.doc.lineAt(from);
1213
- let explode = !atEof && from == to && isBetweenBrackets(state, from);
1214
- if (atEof) from = to = (to <= line.to ? line : state.doc.lineAt(to)).to;
1215
- let cx = new IndentContext(state, {
1216
- simulateBreak: from,
1217
- simulateDoubleBreak: !!explode
1218
- });
1219
- let indent = getIndentation(cx, from);
1220
- if (indent == null) indent = countColumn(/^\s*/.exec(state.doc.lineAt(from).text)[0], state.tabSize);
1221
- while (to < line.to && /\s/.test(line.text[to - line.from])) to++;
1222
- if (explode) ({from, to} = explode);
1223
- else if (from > line.from && from < line.from + 100 && !/\S/.test(line.text.slice(0, from))) from = line.from;
1224
- let insert = ["", indentString(state, indent)];
1225
- if (explode) insert.push(indentString(state, cx.lineIndent(line.from, -1)));
1226
- return {
1227
- changes: {
1228
- from,
1229
- to,
1230
- insert: Text.of(insert)
1231
- },
1232
- range: EditorSelection.cursor(from + 1 + insert[1].length)
1233
- };
1234
- });
1235
- dispatch(state.update(changes, {
1236
- scrollIntoView: true,
1237
- userEvent: "input"
1238
- }));
1239
- return true;
1240
- };
1241
- }
1242
- function changeBySelectedLine(state, f) {
1243
- let atLine = -1;
1244
- return state.changeByRange((range) => {
1245
- let changes = [];
1246
- for (let pos = range.from; pos <= range.to;) {
1247
- let line = state.doc.lineAt(pos);
1248
- if (line.number > atLine && (range.empty || range.to > line.from)) {
1249
- f(line, changes, range);
1250
- atLine = line.number;
1251
- }
1252
- pos = line.to + 1;
1253
- }
1254
- let changeSet = state.changes(changes);
1255
- return {
1256
- changes,
1257
- range: EditorSelection.range(changeSet.mapPos(range.anchor, 1), changeSet.mapPos(range.head, 1))
1258
- };
1259
- });
1260
- }
1261
- /**
1262
- Auto-indent the selected lines. This uses the [indentation service
1263
- facet](https://codemirror.net/6/docs/ref/#language.indentService) as source for auto-indent
1264
- information.
1265
- */
1266
- var indentSelection = ({ state, dispatch }) => {
1267
- if (state.readOnly) return false;
1268
- let updated = Object.create(null);
1269
- let context = new IndentContext(state, { overrideIndentation: (start) => {
1270
- let found = updated[start];
1271
- return found == null ? -1 : found;
1272
- } });
1273
- let changes = changeBySelectedLine(state, (line, changes, range) => {
1274
- let indent = getIndentation(context, line.from);
1275
- if (indent == null) return;
1276
- if (!/\S/.test(line.text)) indent = 0;
1277
- let cur = /^\s*/.exec(line.text)[0];
1278
- let norm = indentString(state, indent);
1279
- if (cur != norm || range.from < line.from + cur.length) {
1280
- updated[line.from] = indent;
1281
- changes.push({
1282
- from: line.from,
1283
- to: line.from + cur.length,
1284
- insert: norm
1285
- });
1286
- }
1287
- });
1288
- if (!changes.changes.empty) dispatch(state.update(changes, { userEvent: "indent" }));
1289
- return true;
1290
- };
1291
- /**
1292
- Add a [unit](https://codemirror.net/6/docs/ref/#language.indentUnit) of indentation to all selected
1293
- lines.
1294
- */
1295
- var indentMore = ({ state, dispatch }) => {
1296
- if (state.readOnly) return false;
1297
- dispatch(state.update(changeBySelectedLine(state, (line, changes) => {
1298
- changes.push({
1299
- from: line.from,
1300
- insert: state.facet(indentUnit)
1301
- });
1302
- }), { userEvent: "input.indent" }));
1303
- return true;
1304
- };
1305
- /**
1306
- Remove a [unit](https://codemirror.net/6/docs/ref/#language.indentUnit) of indentation from all
1307
- selected lines.
1308
- */
1309
- var indentLess = ({ state, dispatch }) => {
1310
- if (state.readOnly) return false;
1311
- dispatch(state.update(changeBySelectedLine(state, (line, changes) => {
1312
- let space = /^\s*/.exec(line.text)[0];
1313
- if (!space) return;
1314
- let col = countColumn(space, state.tabSize), keep = 0;
1315
- let insert = indentString(state, Math.max(0, col - getIndentUnit(state)));
1316
- while (keep < space.length && keep < insert.length && space.charCodeAt(keep) == insert.charCodeAt(keep)) keep++;
1317
- changes.push({
1318
- from: line.from + keep,
1319
- to: line.from + space.length,
1320
- insert: insert.slice(keep)
1321
- });
1322
- }), { userEvent: "delete.dedent" }));
1323
- return true;
1324
- };
1325
- /**
1326
- Enables or disables
1327
- [tab-focus mode](https://codemirror.net/6/docs/ref/#view.EditorView.setTabFocusMode). While on, this
1328
- prevents the editor's key bindings from capturing Tab or
1329
- Shift-Tab, making it possible for the user to move focus out of
1330
- the editor with the keyboard.
1331
- */
1332
- var toggleTabFocusMode = (view) => {
1333
- view.setTabFocusMode();
1334
- return true;
1335
- };
1336
- /**
1337
- Array of key bindings containing the Emacs-style bindings that are
1338
- available on macOS by default.
1339
-
1340
- - Ctrl-b: [`cursorCharLeft`](https://codemirror.net/6/docs/ref/#commands.cursorCharLeft) ([`selectCharLeft`](https://codemirror.net/6/docs/ref/#commands.selectCharLeft) with Shift)
1341
- - Ctrl-f: [`cursorCharRight`](https://codemirror.net/6/docs/ref/#commands.cursorCharRight) ([`selectCharRight`](https://codemirror.net/6/docs/ref/#commands.selectCharRight) with Shift)
1342
- - Ctrl-p: [`cursorLineUp`](https://codemirror.net/6/docs/ref/#commands.cursorLineUp) ([`selectLineUp`](https://codemirror.net/6/docs/ref/#commands.selectLineUp) with Shift)
1343
- - Ctrl-n: [`cursorLineDown`](https://codemirror.net/6/docs/ref/#commands.cursorLineDown) ([`selectLineDown`](https://codemirror.net/6/docs/ref/#commands.selectLineDown) with Shift)
1344
- - Ctrl-a: [`cursorLineStart`](https://codemirror.net/6/docs/ref/#commands.cursorLineStart) ([`selectLineStart`](https://codemirror.net/6/docs/ref/#commands.selectLineStart) with Shift)
1345
- - Ctrl-e: [`cursorLineEnd`](https://codemirror.net/6/docs/ref/#commands.cursorLineEnd) ([`selectLineEnd`](https://codemirror.net/6/docs/ref/#commands.selectLineEnd) with Shift)
1346
- - Ctrl-d: [`deleteCharForward`](https://codemirror.net/6/docs/ref/#commands.deleteCharForward)
1347
- - Ctrl-h: [`deleteCharBackward`](https://codemirror.net/6/docs/ref/#commands.deleteCharBackward)
1348
- - Ctrl-k: [`deleteToLineEnd`](https://codemirror.net/6/docs/ref/#commands.deleteToLineEnd)
1349
- - Ctrl-Alt-h: [`deleteGroupBackward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupBackward)
1350
- - Ctrl-o: [`splitLine`](https://codemirror.net/6/docs/ref/#commands.splitLine)
1351
- - Ctrl-t: [`transposeChars`](https://codemirror.net/6/docs/ref/#commands.transposeChars)
1352
- - Ctrl-v: [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown)
1353
- - Alt-v: [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp)
1354
- */
1355
- var emacsStyleKeymap = [
1356
- {
1357
- key: "Ctrl-b",
1358
- run: cursorCharLeft,
1359
- shift: selectCharLeft,
1360
- preventDefault: true
1361
- },
1362
- {
1363
- key: "Ctrl-f",
1364
- run: cursorCharRight,
1365
- shift: selectCharRight
1366
- },
1367
- {
1368
- key: "Ctrl-p",
1369
- run: cursorLineUp,
1370
- shift: selectLineUp
1371
- },
1372
- {
1373
- key: "Ctrl-n",
1374
- run: cursorLineDown,
1375
- shift: selectLineDown
1376
- },
1377
- {
1378
- key: "Ctrl-a",
1379
- run: cursorLineStart,
1380
- shift: selectLineStart
1381
- },
1382
- {
1383
- key: "Ctrl-e",
1384
- run: cursorLineEnd,
1385
- shift: selectLineEnd
1386
- },
1387
- {
1388
- key: "Ctrl-d",
1389
- run: deleteCharForward
1390
- },
1391
- {
1392
- key: "Ctrl-h",
1393
- run: deleteCharBackward
1394
- },
1395
- {
1396
- key: "Ctrl-k",
1397
- run: deleteToLineEnd
1398
- },
1399
- {
1400
- key: "Ctrl-Alt-h",
1401
- run: deleteGroupBackward
1402
- },
1403
- {
1404
- key: "Ctrl-o",
1405
- run: splitLine
1406
- },
1407
- {
1408
- key: "Ctrl-t",
1409
- run: transposeChars
1410
- },
1411
- {
1412
- key: "Ctrl-v",
1413
- run: cursorPageDown
1414
- }
1415
- ];
1416
- /**
1417
- An array of key bindings closely sticking to platform-standard or
1418
- widely used bindings. (This includes the bindings from
1419
- [`emacsStyleKeymap`](https://codemirror.net/6/docs/ref/#commands.emacsStyleKeymap), with their `key`
1420
- property changed to `mac`.)
1421
-
1422
- - ArrowLeft: [`cursorCharLeft`](https://codemirror.net/6/docs/ref/#commands.cursorCharLeft) ([`selectCharLeft`](https://codemirror.net/6/docs/ref/#commands.selectCharLeft) with Shift)
1423
- - ArrowRight: [`cursorCharRight`](https://codemirror.net/6/docs/ref/#commands.cursorCharRight) ([`selectCharRight`](https://codemirror.net/6/docs/ref/#commands.selectCharRight) with Shift)
1424
- - Ctrl-ArrowLeft (Alt-ArrowLeft on macOS): [`cursorGroupLeft`](https://codemirror.net/6/docs/ref/#commands.cursorGroupLeft) ([`selectGroupLeft`](https://codemirror.net/6/docs/ref/#commands.selectGroupLeft) with Shift)
1425
- - Ctrl-ArrowRight (Alt-ArrowRight on macOS): [`cursorGroupRight`](https://codemirror.net/6/docs/ref/#commands.cursorGroupRight) ([`selectGroupRight`](https://codemirror.net/6/docs/ref/#commands.selectGroupRight) with Shift)
1426
- - Cmd-ArrowLeft (on macOS): [`cursorLineStart`](https://codemirror.net/6/docs/ref/#commands.cursorLineStart) ([`selectLineStart`](https://codemirror.net/6/docs/ref/#commands.selectLineStart) with Shift)
1427
- - Cmd-ArrowRight (on macOS): [`cursorLineEnd`](https://codemirror.net/6/docs/ref/#commands.cursorLineEnd) ([`selectLineEnd`](https://codemirror.net/6/docs/ref/#commands.selectLineEnd) with Shift)
1428
- - ArrowUp: [`cursorLineUp`](https://codemirror.net/6/docs/ref/#commands.cursorLineUp) ([`selectLineUp`](https://codemirror.net/6/docs/ref/#commands.selectLineUp) with Shift)
1429
- - ArrowDown: [`cursorLineDown`](https://codemirror.net/6/docs/ref/#commands.cursorLineDown) ([`selectLineDown`](https://codemirror.net/6/docs/ref/#commands.selectLineDown) with Shift)
1430
- - Cmd-ArrowUp (on macOS): [`cursorDocStart`](https://codemirror.net/6/docs/ref/#commands.cursorDocStart) ([`selectDocStart`](https://codemirror.net/6/docs/ref/#commands.selectDocStart) with Shift)
1431
- - Cmd-ArrowDown (on macOS): [`cursorDocEnd`](https://codemirror.net/6/docs/ref/#commands.cursorDocEnd) ([`selectDocEnd`](https://codemirror.net/6/docs/ref/#commands.selectDocEnd) with Shift)
1432
- - Ctrl-ArrowUp (on macOS): [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp) ([`selectPageUp`](https://codemirror.net/6/docs/ref/#commands.selectPageUp) with Shift)
1433
- - Ctrl-ArrowDown (on macOS): [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown) ([`selectPageDown`](https://codemirror.net/6/docs/ref/#commands.selectPageDown) with Shift)
1434
- - PageUp: [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp) ([`selectPageUp`](https://codemirror.net/6/docs/ref/#commands.selectPageUp) with Shift)
1435
- - PageDown: [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown) ([`selectPageDown`](https://codemirror.net/6/docs/ref/#commands.selectPageDown) with Shift)
1436
- - Home: [`cursorLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.cursorLineBoundaryBackward) ([`selectLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.selectLineBoundaryBackward) with Shift)
1437
- - End: [`cursorLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.cursorLineBoundaryForward) ([`selectLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.selectLineBoundaryForward) with Shift)
1438
- - Ctrl-Home (Cmd-Home on macOS): [`cursorDocStart`](https://codemirror.net/6/docs/ref/#commands.cursorDocStart) ([`selectDocStart`](https://codemirror.net/6/docs/ref/#commands.selectDocStart) with Shift)
1439
- - Ctrl-End (Cmd-Home on macOS): [`cursorDocEnd`](https://codemirror.net/6/docs/ref/#commands.cursorDocEnd) ([`selectDocEnd`](https://codemirror.net/6/docs/ref/#commands.selectDocEnd) with Shift)
1440
- - Enter and Shift-Enter: [`insertNewlineAndIndent`](https://codemirror.net/6/docs/ref/#commands.insertNewlineAndIndent)
1441
- - Ctrl-a (Cmd-a on macOS): [`selectAll`](https://codemirror.net/6/docs/ref/#commands.selectAll)
1442
- - Backspace: [`deleteCharBackward`](https://codemirror.net/6/docs/ref/#commands.deleteCharBackward)
1443
- - Delete: [`deleteCharForward`](https://codemirror.net/6/docs/ref/#commands.deleteCharForward)
1444
- - Ctrl-Backspace (Alt-Backspace on macOS): [`deleteGroupBackward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupBackward)
1445
- - Ctrl-Delete (Alt-Delete on macOS): [`deleteGroupForward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupForward)
1446
- - Cmd-Backspace (macOS): [`deleteLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.deleteLineBoundaryBackward).
1447
- - Cmd-Delete (macOS): [`deleteLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.deleteLineBoundaryForward).
1448
- */
1449
- var standardKeymap = /*@__PURE__*/ [
1450
- {
1451
- key: "ArrowLeft",
1452
- run: cursorCharLeft,
1453
- shift: selectCharLeft,
1454
- preventDefault: true
1455
- },
1456
- {
1457
- key: "Mod-ArrowLeft",
1458
- mac: "Alt-ArrowLeft",
1459
- run: cursorGroupLeft,
1460
- shift: selectGroupLeft,
1461
- preventDefault: true
1462
- },
1463
- {
1464
- mac: "Cmd-ArrowLeft",
1465
- run: cursorLineBoundaryLeft,
1466
- shift: selectLineBoundaryLeft,
1467
- preventDefault: true
1468
- },
1469
- {
1470
- key: "ArrowRight",
1471
- run: cursorCharRight,
1472
- shift: selectCharRight,
1473
- preventDefault: true
1474
- },
1475
- {
1476
- key: "Mod-ArrowRight",
1477
- mac: "Alt-ArrowRight",
1478
- run: cursorGroupRight,
1479
- shift: selectGroupRight,
1480
- preventDefault: true
1481
- },
1482
- {
1483
- mac: "Cmd-ArrowRight",
1484
- run: cursorLineBoundaryRight,
1485
- shift: selectLineBoundaryRight,
1486
- preventDefault: true
1487
- },
1488
- {
1489
- key: "ArrowUp",
1490
- run: cursorLineUp,
1491
- shift: selectLineUp,
1492
- preventDefault: true
1493
- },
1494
- {
1495
- mac: "Cmd-ArrowUp",
1496
- run: cursorDocStart,
1497
- shift: selectDocStart
1498
- },
1499
- {
1500
- mac: "Ctrl-ArrowUp",
1501
- run: cursorPageUp,
1502
- shift: selectPageUp
1503
- },
1504
- {
1505
- key: "ArrowDown",
1506
- run: cursorLineDown,
1507
- shift: selectLineDown,
1508
- preventDefault: true
1509
- },
1510
- {
1511
- mac: "Cmd-ArrowDown",
1512
- run: cursorDocEnd,
1513
- shift: selectDocEnd
1514
- },
1515
- {
1516
- mac: "Ctrl-ArrowDown",
1517
- run: cursorPageDown,
1518
- shift: selectPageDown
1519
- },
1520
- {
1521
- key: "PageUp",
1522
- run: cursorPageUp,
1523
- shift: selectPageUp
1524
- },
1525
- {
1526
- key: "PageDown",
1527
- run: cursorPageDown,
1528
- shift: selectPageDown
1529
- },
1530
- {
1531
- key: "Home",
1532
- run: cursorLineBoundaryBackward,
1533
- shift: selectLineBoundaryBackward,
1534
- preventDefault: true
1535
- },
1536
- {
1537
- key: "Mod-Home",
1538
- run: cursorDocStart,
1539
- shift: selectDocStart
1540
- },
1541
- {
1542
- key: "End",
1543
- run: cursorLineBoundaryForward,
1544
- shift: selectLineBoundaryForward,
1545
- preventDefault: true
1546
- },
1547
- {
1548
- key: "Mod-End",
1549
- run: cursorDocEnd,
1550
- shift: selectDocEnd
1551
- },
1552
- {
1553
- key: "Enter",
1554
- run: insertNewlineAndIndent,
1555
- shift: insertNewlineAndIndent
1556
- },
1557
- {
1558
- key: "Mod-a",
1559
- run: selectAll
1560
- },
1561
- {
1562
- key: "Backspace",
1563
- run: deleteCharBackward,
1564
- shift: deleteCharBackward,
1565
- preventDefault: true
1566
- },
1567
- {
1568
- key: "Delete",
1569
- run: deleteCharForward,
1570
- preventDefault: true
1571
- },
1572
- {
1573
- key: "Mod-Backspace",
1574
- mac: "Alt-Backspace",
1575
- run: deleteGroupBackward,
1576
- preventDefault: true
1577
- },
1578
- {
1579
- key: "Mod-Delete",
1580
- mac: "Alt-Delete",
1581
- run: deleteGroupForward,
1582
- preventDefault: true
1583
- },
1584
- {
1585
- mac: "Mod-Backspace",
1586
- run: deleteLineBoundaryBackward,
1587
- preventDefault: true
1588
- },
1589
- {
1590
- mac: "Mod-Delete",
1591
- run: deleteLineBoundaryForward,
1592
- preventDefault: true
1593
- }
1594
- ].concat(/*@__PURE__*/ emacsStyleKeymap.map((b) => ({
1595
- mac: b.key,
1596
- run: b.run,
1597
- shift: b.shift
1598
- })));
1599
- /**
1600
- The default keymap. Includes all bindings from
1601
- [`standardKeymap`](https://codemirror.net/6/docs/ref/#commands.standardKeymap) plus the following:
1602
-
1603
- - Alt-ArrowLeft (Ctrl-ArrowLeft on macOS): [`cursorSyntaxLeft`](https://codemirror.net/6/docs/ref/#commands.cursorSyntaxLeft) ([`selectSyntaxLeft`](https://codemirror.net/6/docs/ref/#commands.selectSyntaxLeft) with Shift)
1604
- - Alt-ArrowRight (Ctrl-ArrowRight on macOS): [`cursorSyntaxRight`](https://codemirror.net/6/docs/ref/#commands.cursorSyntaxRight) ([`selectSyntaxRight`](https://codemirror.net/6/docs/ref/#commands.selectSyntaxRight) with Shift)
1605
- - Alt-ArrowUp: [`moveLineUp`](https://codemirror.net/6/docs/ref/#commands.moveLineUp)
1606
- - Alt-ArrowDown: [`moveLineDown`](https://codemirror.net/6/docs/ref/#commands.moveLineDown)
1607
- - Shift-Alt-ArrowUp: [`copyLineUp`](https://codemirror.net/6/docs/ref/#commands.copyLineUp)
1608
- - Shift-Alt-ArrowDown: [`copyLineDown`](https://codemirror.net/6/docs/ref/#commands.copyLineDown)
1609
- - Ctrl-Alt-ArrowUp (Cmd-Alt-ArrowUp on macOS): [`addCursorAbove`](https://codemirror.net/6/docs/ref/#commands.addCursorAbove).
1610
- - Ctrl-Alt-ArrowDown (Cmd-Alt-ArrowDown on macOS): [`addCursorBelow`](https://codemirror.net/6/docs/ref/#commands.addCursorBelow).
1611
- - Escape: [`simplifySelection`](https://codemirror.net/6/docs/ref/#commands.simplifySelection)
1612
- - Ctrl-Enter (Cmd-Enter on macOS): [`insertBlankLine`](https://codemirror.net/6/docs/ref/#commands.insertBlankLine)
1613
- - Alt-l (Ctrl-l on macOS): [`selectLine`](https://codemirror.net/6/docs/ref/#commands.selectLine)
1614
- - Ctrl-i (Cmd-i on macOS): [`selectParentSyntax`](https://codemirror.net/6/docs/ref/#commands.selectParentSyntax)
1615
- - Ctrl-[ (Cmd-[ on macOS): [`indentLess`](https://codemirror.net/6/docs/ref/#commands.indentLess)
1616
- - Ctrl-] (Cmd-] on macOS): [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore)
1617
- - Ctrl-Alt-\\ (Cmd-Alt-\\ on macOS): [`indentSelection`](https://codemirror.net/6/docs/ref/#commands.indentSelection)
1618
- - Shift-Ctrl-k (Shift-Cmd-k on macOS): [`deleteLine`](https://codemirror.net/6/docs/ref/#commands.deleteLine)
1619
- - Shift-Ctrl-\\ (Shift-Cmd-\\ on macOS): [`cursorMatchingBracket`](https://codemirror.net/6/docs/ref/#commands.cursorMatchingBracket)
1620
- - Ctrl-/ (Cmd-/ on macOS): [`toggleComment`](https://codemirror.net/6/docs/ref/#commands.toggleComment).
1621
- - Shift-Alt-a: [`toggleBlockComment`](https://codemirror.net/6/docs/ref/#commands.toggleBlockComment).
1622
- - Ctrl-m (Alt-Shift-m on macOS): [`toggleTabFocusMode`](https://codemirror.net/6/docs/ref/#commands.toggleTabFocusMode).
1623
- */
1624
- var defaultKeymap = /*@__PURE__*/ [
1625
- {
1626
- key: "Alt-ArrowLeft",
1627
- mac: "Ctrl-ArrowLeft",
1628
- run: cursorSyntaxLeft,
1629
- shift: selectSyntaxLeft
1630
- },
1631
- {
1632
- key: "Alt-ArrowRight",
1633
- mac: "Ctrl-ArrowRight",
1634
- run: cursorSyntaxRight,
1635
- shift: selectSyntaxRight
1636
- },
1637
- {
1638
- key: "Alt-ArrowUp",
1639
- run: moveLineUp
1640
- },
1641
- {
1642
- key: "Shift-Alt-ArrowUp",
1643
- run: copyLineUp
1644
- },
1645
- {
1646
- key: "Alt-ArrowDown",
1647
- run: moveLineDown
1648
- },
1649
- {
1650
- key: "Shift-Alt-ArrowDown",
1651
- run: copyLineDown
1652
- },
1653
- {
1654
- key: "Mod-Alt-ArrowUp",
1655
- run: addCursorAbove
1656
- },
1657
- {
1658
- key: "Mod-Alt-ArrowDown",
1659
- run: addCursorBelow
1660
- },
1661
- {
1662
- key: "Escape",
1663
- run: simplifySelection
1664
- },
1665
- {
1666
- key: "Mod-Enter",
1667
- run: insertBlankLine
1668
- },
1669
- {
1670
- key: "Alt-l",
1671
- mac: "Ctrl-l",
1672
- run: selectLine
1673
- },
1674
- {
1675
- key: "Mod-i",
1676
- run: selectParentSyntax,
1677
- preventDefault: true
1678
- },
1679
- {
1680
- key: "Mod-[",
1681
- run: indentLess
1682
- },
1683
- {
1684
- key: "Mod-]",
1685
- run: indentMore
1686
- },
1687
- {
1688
- key: "Mod-Alt-\\",
1689
- run: indentSelection
1690
- },
1691
- {
1692
- key: "Shift-Mod-k",
1693
- run: deleteLine
1694
- },
1695
- {
1696
- key: "Shift-Mod-\\",
1697
- run: cursorMatchingBracket
1698
- },
1699
- {
1700
- key: "Mod-/",
1701
- run: toggleComment
1702
- },
1703
- {
1704
- key: "Alt-A",
1705
- run: toggleBlockComment
1706
- },
1707
- {
1708
- key: "Ctrl-m",
1709
- mac: "Shift-Alt-m",
1710
- run: toggleTabFocusMode
1711
- }
1712
- ].concat(standardKeymap);
1713
- /**
1714
- A binding that binds Tab to [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore) and
1715
- Shift-Tab to [`indentLess`](https://codemirror.net/6/docs/ref/#commands.indentLess).
1716
- Please see the [Tab example](../../examples/tab/) before using
1717
- this.
1718
- */
1719
- var indentWithTab = {
1720
- key: "Tab",
1721
- run: indentMore,
1722
- shift: indentLess
1723
- };
1724
- //#endregion
1725
- export { indentWithTab as i, history as n, historyKeymap as r, defaultKeymap as t };