@noldova/code.editor 0.0.0-stage → 0.0.1

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 (248) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4 -2
  3. package/api/index.d.ts +6288 -0
  4. package/api/index.js +80 -0
  5. package/api/index.js.map +1 -0
  6. package/enums/edit-kind.js +14 -0
  7. package/enums/edit-kind.js.map +1 -0
  8. package/enums/key-dispatch-result.js +15 -0
  9. package/enums/key-dispatch-result.js.map +1 -0
  10. package/enums/worker-job-answer.js +14 -0
  11. package/enums/worker-job-answer.js.map +1 -0
  12. package/exceptions/condition-syntax.exception.js +20 -0
  13. package/exceptions/condition-syntax.exception.js.map +1 -0
  14. package/exceptions/edits-overlap.exception.js +20 -0
  15. package/exceptions/edits-overlap.exception.js.map +1 -0
  16. package/exceptions/key-syntax.exception.js +18 -0
  17. package/exceptions/key-syntax.exception.js.map +1 -0
  18. package/exceptions/registration-exists.exception.js +20 -0
  19. package/exceptions/registration-exists.exception.js.map +1 -0
  20. package/exceptions/registration-missing.exception.js +20 -0
  21. package/exceptions/registration-missing.exception.js.map +1 -0
  22. package/exceptions/search-pattern.exception.js +18 -0
  23. package/exceptions/search-pattern.exception.js.map +1 -0
  24. package/exceptions/value-missing.exception.js +16 -0
  25. package/exceptions/value-missing.exception.js.map +1 -0
  26. package/interfaces/background/i-background-job.js +9 -0
  27. package/interfaces/background/i-background-job.js.map +1 -0
  28. package/interfaces/background/i-background-runner.js +9 -0
  29. package/interfaces/background/i-background-runner.js.map +1 -0
  30. package/interfaces/background/i-message-post-options.js +9 -0
  31. package/interfaces/background/i-message-post-options.js.map +1 -0
  32. package/interfaces/background/i-message-scope.js +9 -0
  33. package/interfaces/background/i-message-scope.js.map +1 -0
  34. package/interfaces/background/i-worker-job-failure.js +9 -0
  35. package/interfaces/background/i-worker-job-failure.js.map +1 -0
  36. package/interfaces/background/i-worker-job-message.js +9 -0
  37. package/interfaces/background/i-worker-job-message.js.map +1 -0
  38. package/interfaces/background/i-worker-job-missing.js +9 -0
  39. package/interfaces/background/i-worker-job-missing.js.map +1 -0
  40. package/interfaces/background/i-worker-job-output.js +9 -0
  41. package/interfaces/background/i-worker-job-output.js.map +1 -0
  42. package/interfaces/background/i-worker-job-request.js +9 -0
  43. package/interfaces/background/i-worker-job-request.js.map +1 -0
  44. package/interfaces/i-command.js +9 -0
  45. package/interfaces/i-command.js.map +1 -0
  46. package/interfaces/i-condition-node.js +9 -0
  47. package/interfaces/i-condition-node.js.map +1 -0
  48. package/interfaces/i-diff-algorithm.js +9 -0
  49. package/interfaces/i-diff-algorithm.js.map +1 -0
  50. package/interfaces/i-editor-contribution.js +9 -0
  51. package/interfaces/i-editor-contribution.js.map +1 -0
  52. package/interfaces/i-key-binding-rule.js +9 -0
  53. package/interfaces/i-key-binding-rule.js.map +1 -0
  54. package/interfaces/i-language-definition.js +9 -0
  55. package/interfaces/i-language-definition.js.map +1 -0
  56. package/interfaces/i-move-command.js +9 -0
  57. package/interfaces/i-move-command.js.map +1 -0
  58. package/interfaces/i-plural-phrase.js +9 -0
  59. package/interfaces/i-plural-phrase.js.map +1 -0
  60. package/interfaces/tokens/i-highlighter.js +9 -0
  61. package/interfaces/tokens/i-highlighter.js.map +1 -0
  62. package/interfaces/tokens/i-line-tokenizer.js +9 -0
  63. package/interfaces/tokens/i-line-tokenizer.js.map +1 -0
  64. package/interfaces/tokens/i-token-modifier-definition.js +9 -0
  65. package/interfaces/tokens/i-token-modifier-definition.js.map +1 -0
  66. package/interfaces/tokens/i-token-type-definition.js +9 -0
  67. package/interfaces/tokens/i-token-type-definition.js.map +1 -0
  68. package/interfaces/tokens/i-tokenizer-state.js +9 -0
  69. package/interfaces/tokens/i-tokenizer-state.js.map +1 -0
  70. package/models/commands/command-context.js +30 -0
  71. package/models/commands/command-context.js.map +1 -0
  72. package/models/commands/session-command.js +22 -0
  73. package/models/commands/session-command.js.map +1 -0
  74. package/models/commands/session-move-command.js +17 -0
  75. package/models/commands/session-move-command.js.map +1 -0
  76. package/models/conditions/condition-and.js +20 -0
  77. package/models/conditions/condition-and.js.map +1 -0
  78. package/models/conditions/condition-equals.js +21 -0
  79. package/models/conditions/condition-equals.js.map +1 -0
  80. package/models/conditions/condition-key.js +18 -0
  81. package/models/conditions/condition-key.js.map +1 -0
  82. package/models/conditions/condition-literal.js +17 -0
  83. package/models/conditions/condition-literal.js.map +1 -0
  84. package/models/conditions/condition-name.js +17 -0
  85. package/models/conditions/condition-name.js.map +1 -0
  86. package/models/conditions/condition-not.js +18 -0
  87. package/models/conditions/condition-not.js.map +1 -0
  88. package/models/conditions/condition-or.js +20 -0
  89. package/models/conditions/condition-or.js.map +1 -0
  90. package/models/conditions/condition-token.js +18 -0
  91. package/models/conditions/condition-token.js.map +1 -0
  92. package/models/conditions/condition-truth.js +18 -0
  93. package/models/conditions/condition-truth.js.map +1 -0
  94. package/models/conditions/condition-value.js +9 -0
  95. package/models/conditions/condition-value.js.map +1 -0
  96. package/models/conditions/condition.js +44 -0
  97. package/models/conditions/condition.js.map +1 -0
  98. package/models/diff-span.js +20 -0
  99. package/models/diff-span.js.map +1 -0
  100. package/models/editing/applied-edit.js +22 -0
  101. package/models/editing/applied-edit.js.map +1 -0
  102. package/models/editing/edit-transaction.js +22 -0
  103. package/models/editing/edit-transaction.js.map +1 -0
  104. package/models/editing/undo-step.js +24 -0
  105. package/models/editing/undo-step.js.map +1 -0
  106. package/models/editor-feature-set.js +18 -0
  107. package/models/editor-feature-set.js.map +1 -0
  108. package/models/editor-feature.js +24 -0
  109. package/models/editor-feature.js.map +1 -0
  110. package/models/keys/key-binding-entry.js +57 -0
  111. package/models/keys/key-binding-entry.js.map +1 -0
  112. package/models/keys/key-binding-rule.js +20 -0
  113. package/models/keys/key-binding-rule.js.map +1 -0
  114. package/models/keys/key-binding-source.js +16 -0
  115. package/models/keys/key-binding-source.js.map +1 -0
  116. package/models/keys/key-chord.js +74 -0
  117. package/models/keys/key-chord.js.map +1 -0
  118. package/models/keys/key-dispatcher.js +42 -0
  119. package/models/keys/key-dispatcher.js.map +1 -0
  120. package/models/keys/key-press.js +24 -0
  121. package/models/keys/key-press.js.map +1 -0
  122. package/models/keys/key-sequence.js +37 -0
  123. package/models/keys/key-sequence.js.map +1 -0
  124. package/models/languages/block-comment.js +16 -0
  125. package/models/languages/block-comment.js.map +1 -0
  126. package/models/languages/bracket-pair.js +16 -0
  127. package/models/languages/bracket-pair.js.map +1 -0
  128. package/models/languages/language-definition.js +32 -0
  129. package/models/languages/language-definition.js.map +1 -0
  130. package/models/languages/language-file.js +29 -0
  131. package/models/languages/language-file.js.map +1 -0
  132. package/models/phrase-set.js +16 -0
  133. package/models/phrase-set.js.map +1 -0
  134. package/models/phrase-text.js +9 -0
  135. package/models/phrase-text.js.map +1 -0
  136. package/models/plural-phrase.js +24 -0
  137. package/models/plural-phrase.js.map +1 -0
  138. package/models/registration.js +21 -0
  139. package/models/registration.js.map +1 -0
  140. package/models/search-query.js +20 -0
  141. package/models/search-query.js.map +1 -0
  142. package/models/setting.js +39 -0
  143. package/models/setting.js.map +1 -0
  144. package/models/text/line-chunk.js +115 -0
  145. package/models/text/line-chunk.js.map +1 -0
  146. package/models/text/line-segment.js +22 -0
  147. package/models/text/line-segment.js.map +1 -0
  148. package/models/text/line-split.js +32 -0
  149. package/models/text/line-split.js.map +1 -0
  150. package/models/text/text-change.js +20 -0
  151. package/models/text/text-change.js.map +1 -0
  152. package/models/text/text-document.js +265 -0
  153. package/models/text/text-document.js.map +1 -0
  154. package/models/text/text-edit.js +16 -0
  155. package/models/text/text-edit.js.map +1 -0
  156. package/models/text/text-position.js +30 -0
  157. package/models/text/text-position.js.map +1 -0
  158. package/models/text/text-range.js +30 -0
  159. package/models/text/text-range.js.map +1 -0
  160. package/models/text/text-selection.js +22 -0
  161. package/models/text/text-selection.js.map +1 -0
  162. package/models/tokens/highlighter-assignment.js +16 -0
  163. package/models/tokens/highlighter-assignment.js.map +1 -0
  164. package/models/tokens/line-token.js +22 -0
  165. package/models/tokens/line-token.js.map +1 -0
  166. package/models/tokens/line-tokens.js +16 -0
  167. package/models/tokens/line-tokens.js.map +1 -0
  168. package/models/tokens/stale-state.js +13 -0
  169. package/models/tokens/stale-state.js.map +1 -0
  170. package/models/tokens/token-modifier-definition.js +16 -0
  171. package/models/tokens/token-modifier-definition.js.map +1 -0
  172. package/models/tokens/token-type-definition.js +18 -0
  173. package/models/tokens/token-type-definition.js.map +1 -0
  174. package/models/worker-job-response.js +9 -0
  175. package/models/worker-job-response.js.map +1 -0
  176. package/package.json +27 -4
  177. package/resources.js +384 -0
  178. package/resources.js.map +1 -0
  179. package/services/background/background-job-registry.js +29 -0
  180. package/services/background/background-job-registry.js.map +1 -0
  181. package/services/background/sliced-runner.js +35 -0
  182. package/services/background/sliced-runner.js.map +1 -0
  183. package/services/background/worker-job-host.js +46 -0
  184. package/services/background/worker-job-host.js.map +1 -0
  185. package/services/commands/command-registry.js +31 -0
  186. package/services/commands/command-registry.js.map +1 -0
  187. package/services/commands/core-commands.js +55 -0
  188. package/services/commands/core-commands.js.map +1 -0
  189. package/services/commands/selection-moves.js +126 -0
  190. package/services/commands/selection-moves.js.map +1 -0
  191. package/services/conditions/condition-parser.js +105 -0
  192. package/services/conditions/condition-parser.js.map +1 -0
  193. package/services/conditions/condition-registry.js +25 -0
  194. package/services/conditions/condition-registry.js.map +1 -0
  195. package/services/conditions/condition-values.js +23 -0
  196. package/services/conditions/condition-values.js.map +1 -0
  197. package/services/conditions/core-conditions.js +24 -0
  198. package/services/conditions/core-conditions.js.map +1 -0
  199. package/services/core-contribution.js +27 -0
  200. package/services/core-contribution.js.map +1 -0
  201. package/services/core-key-bindings.js +70 -0
  202. package/services/core-key-bindings.js.map +1 -0
  203. package/services/core-settings.js +18 -0
  204. package/services/core-settings.js.map +1 -0
  205. package/services/diff-algorithm-registry.js +38 -0
  206. package/services/diff-algorithm-registry.js.map +1 -0
  207. package/services/editing/editor-session.js +165 -0
  208. package/services/editing/editor-session.js.map +1 -0
  209. package/services/editing/position-mapper.js +38 -0
  210. package/services/editing/position-mapper.js.map +1 -0
  211. package/services/editing/text-editing.js +120 -0
  212. package/services/editing/text-editing.js.map +1 -0
  213. package/services/editing/undo-history.js +85 -0
  214. package/services/editing/undo-history.js.map +1 -0
  215. package/services/editor-features.js +13 -0
  216. package/services/editor-features.js.map +1 -0
  217. package/services/editor-registries.js +56 -0
  218. package/services/editor-registries.js.map +1 -0
  219. package/services/key-binding-registry.js +76 -0
  220. package/services/key-binding-registry.js.map +1 -0
  221. package/services/language-registry.js +56 -0
  222. package/services/language-registry.js.map +1 -0
  223. package/services/phrase-registry.js +82 -0
  224. package/services/phrase-registry.js.map +1 -0
  225. package/services/platforms.js +16 -0
  226. package/services/platforms.js.map +1 -0
  227. package/services/registry-entries.js +45 -0
  228. package/services/registry-entries.js.map +1 -0
  229. package/services/required.js +25 -0
  230. package/services/required.js.map +1 -0
  231. package/services/search-results.js +128 -0
  232. package/services/search-results.js.map +1 -0
  233. package/services/setting-registry.js +105 -0
  234. package/services/setting-registry.js.map +1 -0
  235. package/services/text-search.js +66 -0
  236. package/services/text-search.js.map +1 -0
  237. package/services/tokens/built-in-token-types.js +41 -0
  238. package/services/tokens/built-in-token-types.js.map +1 -0
  239. package/services/tokens/highlighter-registry.js +55 -0
  240. package/services/tokens/highlighter-registry.js.map +1 -0
  241. package/services/tokens/token-cache.js +118 -0
  242. package/services/tokens/token-cache.js.map +1 -0
  243. package/services/tokens/token-segments.js +29 -0
  244. package/services/tokens/token-segments.js.map +1 -0
  245. package/services/tokens/token-styles.js +41 -0
  246. package/services/tokens/token-styles.js.map +1 -0
  247. package/services/tokens/token-type-registry.js +63 -0
  248. package/services/tokens/token-type-registry.js.map +1 -0
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { List } from "@noldova/context.collections";
9
+ import { SessionCommand } from "../../models/commands/session-command.js";
10
+ import { SessionMoveCommand } from "../../models/commands/session-move-command.js";
11
+ import { Resources } from "../../resources.js";
12
+ import { CoreSettings } from "../core-settings.js";
13
+ export class CoreCommands {
14
+ static cursorLeft = new SessionMoveCommand(Resources.cursorLeftCommand, (s, extend) => s.moveLeft(extend, false));
15
+ static cursorWordLeft = new SessionMoveCommand(Resources.cursorWordLeftCommand, (s, extend) => s.moveLeft(extend, true));
16
+ static cursorRight = new SessionMoveCommand(Resources.cursorRightCommand, (s, extend) => s.moveRight(extend, false));
17
+ static cursorWordRight = new SessionMoveCommand(Resources.cursorWordRightCommand, (s, extend) => s.moveRight(extend, true));
18
+ static cursorUp = new SessionMoveCommand(Resources.cursorUpCommand, (s, extend) => s.moveLines(-1, extend));
19
+ static cursorDown = new SessionMoveCommand(Resources.cursorDownCommand, (s, extend) => s.moveLines(1, extend));
20
+ static cursorPageUp = new SessionMoveCommand(Resources.cursorPageUpCommand, (s, extend, c) => s.moveLines(-Math.max(1, c.pageLines), extend));
21
+ static cursorPageDown = new SessionMoveCommand(Resources.cursorPageDownCommand, (s, extend, c) => s.moveLines(Math.max(1, c.pageLines), extend));
22
+ static cursorHome = new SessionMoveCommand(Resources.cursorHomeCommand, (s, extend) => s.moveLineStart(extend));
23
+ static cursorEnd = new SessionMoveCommand(Resources.cursorEndCommand, (s, extend) => s.moveLineEnd(extend));
24
+ static cursorLineStart = new SessionMoveCommand(Resources.cursorLineStartCommand, (s, extend) => s.moveLineFirstColumn(extend));
25
+ static cursorTop = new SessionMoveCommand(Resources.cursorTopCommand, (s, extend) => s.moveDocumentStart(extend));
26
+ static cursorBottom = new SessionMoveCommand(Resources.cursorBottomCommand, (s, extend) => s.moveDocumentEnd(extend));
27
+ static selectAll = new SessionCommand(Resources.selectAllCommand, s => s.selectAll());
28
+ static cancelSelection = new SessionCommand(Resources.cancelSelectionCommand, s => s.collapse());
29
+ static deleteLeft = new SessionCommand(Resources.deleteLeftCommand, (s, c) => s.deleteBackward(false, c.time));
30
+ static deleteRight = new SessionCommand(Resources.deleteRightCommand, (s, c) => s.deleteForward(false, c.time));
31
+ static deleteWordLeft = new SessionCommand(Resources.deleteWordLeftCommand, (s, c) => s.deleteBackward(true, c.time));
32
+ static deleteWordRight = new SessionCommand(Resources.deleteWordRightCommand, (s, c) => s.deleteForward(true, c.time));
33
+ static deleteAllLeft = new SessionCommand(Resources.deleteAllLeftCommand, (s, c) => s.deleteToLineStart(c.time));
34
+ static deleteAllRight = new SessionCommand(Resources.deleteAllRightCommand, (s, c) => s.deleteToLineEnd(c.time));
35
+ static newLine = new SessionCommand(Resources.newLineCommand, (s, c) => s.newLine(c.time));
36
+ static indent = new SessionCommand(Resources.indentCommand, (s, c) => s.indent(CoreCommands.indentUnit(c), c.time));
37
+ static outdent = new SessionCommand(Resources.outdentCommand, (s, c) => s.outdent(CoreCommands.indentUnit(c), c.time));
38
+ static undo = new SessionCommand(Resources.undoCommand, s => s.undo());
39
+ static redo = new SessionCommand(Resources.redoCommand, s => s.redo());
40
+ static moves = new List([
41
+ CoreCommands.cursorLeft, CoreCommands.cursorWordLeft, CoreCommands.cursorRight, CoreCommands.cursorWordRight, CoreCommands.cursorUp,
42
+ CoreCommands.cursorDown, CoreCommands.cursorPageUp, CoreCommands.cursorPageDown, CoreCommands.cursorHome, CoreCommands.cursorEnd,
43
+ CoreCommands.cursorLineStart, CoreCommands.cursorTop, CoreCommands.cursorBottom
44
+ ]);
45
+ static all = new List([
46
+ ...CoreCommands.moves.selectMany(t => [t, t.select]),
47
+ CoreCommands.selectAll, CoreCommands.cancelSelection, CoreCommands.deleteLeft, CoreCommands.deleteRight, CoreCommands.deleteWordLeft,
48
+ CoreCommands.deleteWordRight, CoreCommands.deleteAllLeft, CoreCommands.deleteAllRight, CoreCommands.newLine, CoreCommands.indent,
49
+ CoreCommands.outdent, CoreCommands.undo, CoreCommands.redo
50
+ ]);
51
+ static indentUnit(context) {
52
+ return context.setting(CoreSettings.insertSpaces) ? Resources.space.repeat(context.setting(CoreSettings.indentSize)) : Resources.tab;
53
+ }
54
+ }
55
+ //# sourceMappingURL=core-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-commands.js","sourceRoot":"","sources":["../../../../../src/noldova.code.editor/src/services/commands/core-commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAsB,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAKxE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,OAAO,YAAY;IAChB,MAAM,CAAU,UAAU,GAAiB,IAAI,kBAAkB,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IACzI,MAAM,CAAU,cAAc,GAAiB,IAAI,kBAAkB,CAAC,SAAS,CAAC,qBAAqB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAChJ,MAAM,CAAU,WAAW,GAAiB,IAAI,kBAAkB,CAAC,SAAS,CAAC,kBAAkB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IAC5I,MAAM,CAAU,eAAe,GAAiB,IAAI,kBAAkB,CAAC,SAAS,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,I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AAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC;IACvI,CAAC"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import "@noldova/context.core";
9
+ import { List } from "@noldova/context.collections";
10
+ import { TextPosition } from "../../models/text/text-position.js";
11
+ import { TextSelection } from "../../models/text/text-selection.js";
12
+ import { Resources } from "../../resources.js";
13
+ export class SelectionMoves {
14
+ static startOf(selection) {
15
+ return selection.anchor.compareTo(selection.head) <= 0 ? selection.anchor : selection.head;
16
+ }
17
+ static endOf(selection) {
18
+ return selection.anchor.compareTo(selection.head) <= 0 ? selection.head : selection.anchor;
19
+ }
20
+ static left(document, selection, extend, word) {
21
+ if (!extend && !word && !selection.anchor.equals(selection.head))
22
+ return new TextSelection(SelectionMoves.startOf(selection));
23
+ return SelectionMoves.to(selection, SelectionMoves.before(document, selection.head, word), extend);
24
+ }
25
+ static right(document, selection, extend, word) {
26
+ if (!extend && !word && !selection.anchor.equals(selection.head))
27
+ return new TextSelection(SelectionMoves.endOf(selection));
28
+ return SelectionMoves.to(selection, SelectionMoves.after(document, selection.head, word), extend);
29
+ }
30
+ static vertical(document, selection, lines, goalColumn, extend) {
31
+ const line = Math.min(document.lineCount - 1, Math.max(0, selection.head.line + lines));
32
+ if (line === selection.head.line && lines !== 0)
33
+ return SelectionMoves.to(selection, lines < 0 ? new TextPosition(0, 0) : new TextPosition(line, document.lineText(line).length), extend);
34
+ return SelectionMoves.to(selection, SelectionMoves.columnIn(document, line, goalColumn), extend);
35
+ }
36
+ static lineStart(document, selection, extend) {
37
+ const text = document.lineText(selection.head.line);
38
+ const indent = text.length - text.trimStart().length;
39
+ const column = selection.head.column === indent ? 0 : indent;
40
+ return SelectionMoves.to(selection, new TextPosition(selection.head.line, column), extend);
41
+ }
42
+ static lineEnd(document, selection, extend) {
43
+ return SelectionMoves.to(selection, new TextPosition(selection.head.line, document.lineText(selection.head.line).length), extend);
44
+ }
45
+ static lineFirstColumn(selection, extend) {
46
+ return SelectionMoves.to(selection, new TextPosition(selection.head.line, 0), extend);
47
+ }
48
+ static documentStart(selection, extend) {
49
+ return SelectionMoves.to(selection, new TextPosition(0, 0), extend);
50
+ }
51
+ static documentEnd(document, selection, extend) {
52
+ const line = document.lineCount - 1;
53
+ return SelectionMoves.to(selection, new TextPosition(line, document.lineText(line).length), extend);
54
+ }
55
+ static all(document) {
56
+ const line = document.lineCount - 1;
57
+ return new TextSelection(new TextPosition(0, 0), new TextPosition(line, document.lineText(line).length));
58
+ }
59
+ static columnIn(document, line, column) {
60
+ const text = document.lineText(line);
61
+ const clamped = Math.min(column, text.length);
62
+ return new TextPosition(line, SelectionMoves.splitsPair(text, clamped) ? clamped - 1 : clamped);
63
+ }
64
+ static merge(selections) {
65
+ const sorted = selections.orderBy(t => SelectionMoves.startOf(t), (a, b) => a.compareTo(b));
66
+ const merged = new List();
67
+ for (const selection of sorted) {
68
+ const last = merged.tryGet(merged.count() - 1);
69
+ if (!Object.isUndefined(last) && SelectionMoves.overlaps(last, selection))
70
+ merged.set(merged.count() - 1, SelectionMoves.join(last, selection));
71
+ else
72
+ merged.add(selection);
73
+ }
74
+ return merged;
75
+ }
76
+ static overlaps(first, second) {
77
+ const end = SelectionMoves.endOf(first);
78
+ const start = SelectionMoves.startOf(second);
79
+ return start.compareTo(end) < 0 || start.equals(end) && (first.anchor.equals(first.head) || second.anchor.equals(second.head));
80
+ }
81
+ static join(first, second) {
82
+ const start = SelectionMoves.startOf(first);
83
+ const end = SelectionMoves.endOf(first).compareTo(SelectionMoves.endOf(second)) >= 0 ? SelectionMoves.endOf(first) : SelectionMoves.endOf(second);
84
+ return first.anchor.compareTo(first.head) <= 0 ? new TextSelection(start, end) : new TextSelection(end, start);
85
+ }
86
+ static to(selection, head, extend) {
87
+ return extend ? new TextSelection(selection.anchor, head) : new TextSelection(head);
88
+ }
89
+ static before(document, position, word) {
90
+ if (position.column === 0)
91
+ return position.line === 0 ? position : new TextPosition(position.line - 1, document.lineText(position.line - 1).length);
92
+ const text = document.lineText(position.line);
93
+ if (!word)
94
+ return new TextPosition(position.line, position.column - (SelectionMoves.splitsPair(text, position.column - 1) ? Resources.surrogatePairLength : 1));
95
+ let column = position.column;
96
+ while (column > 0 && Resources.spacePattern.test(text.charAt(column - 1)))
97
+ column--;
98
+ const kind = SelectionMoves.kindOf(text.charAt(column - 1));
99
+ while (column > 0 && SelectionMoves.kindOf(text.charAt(column - 1)) === kind)
100
+ column--;
101
+ return new TextPosition(position.line, column);
102
+ }
103
+ static after(document, position, word) {
104
+ const text = document.lineText(position.line);
105
+ if (position.column === text.length)
106
+ return position.line === document.lineCount - 1 ? position : new TextPosition(position.line + 1, 0);
107
+ if (!word)
108
+ return new TextPosition(position.line, position.column + (SelectionMoves.splitsPair(text, position.column + 1) ? Resources.surrogatePairLength : 1));
109
+ let column = position.column;
110
+ while (column < text.length && Resources.spacePattern.test(text.charAt(column)))
111
+ column++;
112
+ const kind = SelectionMoves.kindOf(text.charAt(column));
113
+ while (column < text.length && SelectionMoves.kindOf(text.charAt(column)) === kind)
114
+ column++;
115
+ return new TextPosition(position.line, column);
116
+ }
117
+ static kindOf(character) {
118
+ return Resources.spacePattern.test(character) ? Resources.spaceCharacterKind : Resources.wordCharacterPattern.test(character) ? Resources.wordCharacterKind : Resources.otherCharacterKind;
119
+ }
120
+ static splitsPair(text, column) {
121
+ const before = text.charCodeAt(column - 1);
122
+ const after = text.charCodeAt(column);
123
+ return before >= Resources.highSurrogateFirst && before <= Resources.highSurrogateLast && after >= Resources.lowSurrogateFirst && after <= Resources.lowSurrogateLast;
124
+ }
125
+ }
126
+ //# sourceMappingURL=selection-moves.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection-moves.js","sourceRoot":"","sources":["../../../../../src/noldova.code.editor/src/services/commands/selection-moves.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAuC,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAGzF,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,cAAc;IAClB,MAAM,CAAC,OAAO,CAAC,SAAwB;QAC5C,OAAO,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC;IAC7F,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,SAAwB;QAC1C,OAAO,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC;IAC7F,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,QAAsB,EAAE,SAAwB,EAAE,MAAe,EAAE,IAAa;QACjG,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;YAC9D,OAAO,IAAI,aAAa,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;QAE9D,OAAO,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,CA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root directory of this source tree.
7
+ */
8
+ import "@noldova/context.core";
9
+ import { ConditionSyntaxException } from "../../exceptions/condition-syntax.exception.js";
10
+ import { ConditionAnd } from "../../models/conditions/condition-and.js";
11
+ import { ConditionEquals } from "../../models/conditions/condition-equals.js";
12
+ import { ConditionLiteral } from "../../models/conditions/condition-literal.js";
13
+ import { ConditionName } from "../../models/conditions/condition-name.js";
14
+ import { ConditionNot } from "../../models/conditions/condition-not.js";
15
+ import { ConditionOr } from "../../models/conditions/condition-or.js";
16
+ import { ConditionToken } from "../../models/conditions/condition-token.js";
17
+ import { Resources } from "../../resources.js";
18
+ import { Required } from "../required.js";
19
+ export class ConditionParser {
20
+ text;
21
+ tokens;
22
+ index = 0;
23
+ constructor(text) {
24
+ this.text = text;
25
+ this.tokens = ConditionParser.tokensOf(text);
26
+ }
27
+ static parse(text) {
28
+ return new ConditionParser(text).whole();
29
+ }
30
+ static tokensOf(text) {
31
+ const tokens = [];
32
+ for (const match of text.matchAll(Resources.conditionTokenPattern)) {
33
+ const token = Required.value(match[1]);
34
+ const offset = match.index + match[0].length - token.length;
35
+ if (Resources.conditionStrayCharacters.includes(token))
36
+ throw new ConditionSyntaxException(text, offset);
37
+ tokens.push(new ConditionToken(token, offset, token.startsWith(Resources.conditionQuote)));
38
+ }
39
+ return tokens;
40
+ }
41
+ whole() {
42
+ if (this.tokens.length === 0)
43
+ return new ConditionLiteral(true);
44
+ const node = this.or();
45
+ const rest = this.tokens[this.index];
46
+ if (!Object.isUndefined(rest))
47
+ throw new ConditionSyntaxException(this.text, rest.offset);
48
+ return node;
49
+ }
50
+ or() {
51
+ let node = this.and();
52
+ while (this.accept(Resources.conditionOr))
53
+ node = new ConditionOr(node, this.and());
54
+ return node;
55
+ }
56
+ and() {
57
+ let node = this.unary();
58
+ while (this.accept(Resources.conditionAnd))
59
+ node = new ConditionAnd(node, this.unary());
60
+ return node;
61
+ }
62
+ unary() {
63
+ if (this.accept(Resources.conditionNot))
64
+ return new ConditionNot(this.unary());
65
+ return this.primary();
66
+ }
67
+ primary() {
68
+ if (this.accept(Resources.conditionOpen)) {
69
+ const node = this.or();
70
+ if (!this.accept(Resources.conditionClose))
71
+ throw new ConditionSyntaxException(this.text, this.offsetHere());
72
+ return node;
73
+ }
74
+ const left = this.operand(false);
75
+ if (this.accept(Resources.conditionEquals))
76
+ return new ConditionEquals(left, this.operand(true), false);
77
+ if (this.accept(Resources.conditionNotEquals))
78
+ return new ConditionEquals(left, this.operand(true), true);
79
+ return left;
80
+ }
81
+ operand(bareIsText) {
82
+ const token = this.tokens[this.index];
83
+ if (Object.isUndefined(token) || !token.quoted && Resources.conditionOperators.includes(token.text))
84
+ throw new ConditionSyntaxException(this.text, this.offsetHere());
85
+ this.index++;
86
+ if (token.quoted)
87
+ return new ConditionLiteral(token.text.slice(1, -1));
88
+ if (token.text === Resources.conditionTrue || token.text === Resources.conditionFalse)
89
+ return new ConditionLiteral(token.text === Resources.conditionTrue);
90
+ if (Resources.conditionNumberPattern.test(token.text))
91
+ return new ConditionLiteral(Number(token.text));
92
+ return bareIsText ? new ConditionLiteral(token.text) : new ConditionName(token.text);
93
+ }
94
+ accept(operator) {
95
+ const token = this.tokens[this.index];
96
+ if (Object.isUndefined(token) || token.quoted || token.text !== operator)
97
+ return false;
98
+ this.index++;
99
+ return true;
100
+ }
101
+ offsetHere() {
102
+ return this.tokens[this.index]?.offset ?? this.text.length;
103
+ }
104
+ }
105
+ //# sourceMappingURL=condition-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"condition-parser.js","sourceRoot":"","sources":["../../../../../src/noldova.code.editor/src/services/conditions/condition-parser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAE1F,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,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O,IAAI,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACvD,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,aAAa,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,cAAc;YACnF,OAAO,IAAI,gBAAgB,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,aAAa,CAAC,CAAC;QACtE,IAAI,SAAS,CAAC,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACnD,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAElD,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvF,CAAC;IAEO,MAAM,CAAC,QAAgB;QAC7B,MAAM,KAAK,GAA+B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClE,IAAI,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;YACtE,OAAO,KAAK,CAAC;QACf,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,UAAU;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC7D,CAAC;CACF"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Resources } from "../../resources.js";
9
+ import { RegistryEntries } from "../registry-entries.js";
10
+ export class ConditionRegistry {
11
+ entries;
12
+ constructor(parent = null) {
13
+ this.entries = new RegistryEntries(Resources.conditionRegistry, t => t.name, parent?.entries ?? null);
14
+ }
15
+ register(key) {
16
+ return this.entries.add(key);
17
+ }
18
+ find(name) {
19
+ return this.entries.find(name);
20
+ }
21
+ names() {
22
+ return this.entries.all().select(t => t.name).toList();
23
+ }
24
+ }
25
+ //# sourceMappingURL=condition-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"condition-registry.js","sourceRoot":"","sources":["../../../../../src/noldova.code.editor/src/services/conditions/condition-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,OAAO,iBAAiB;IACX,OAAO,CAAgD;IAExE,YAAmB,SAAmC,IAAI;QACxD,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAA+B,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC;IACtI,CAAC;IAEM,QAAQ,CAAC,GAAiC;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAEM,IAAI,CAAC,IAAY;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAEM,KAAK;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IACzD,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export class ConditionValues {
9
+ registry;
10
+ parent;
11
+ values = new Map();
12
+ constructor(registry, parent = null) {
13
+ this.registry = registry;
14
+ this.parent = parent;
15
+ }
16
+ set(key, value) {
17
+ this.values.set(key.name, value);
18
+ }
19
+ get(name) {
20
+ return this.values.get(name) ?? this.parent?.get(name) ?? this.registry.find(name)?.defaultValue ?? false;
21
+ }
22
+ }
23
+ //# sourceMappingURL=condition-values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"condition-values.js","sourceRoot":"","sources":["../../../../../src/noldova.code.editor/src/services/conditions/condition-values.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,OAAO,eAAe;IACT,QAAQ,CAAoB;IAC5B,MAAM,CAAyB;IAC/B,MAAM,GAAgC,IAAI,GAAG,EAA0B,CAAC;IAEzF,YAAmB,QAA2B,EAAE,SAAiC,IAAI;QACnF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEM,GAAG,CAA2B,GAAoB,EAAE,KAAQ;QACjE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAEM,GAAG,CAAC,IAAY;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,YAAY,IAAI,KAAK,CAAC;IAC5G,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { List } from "@noldova/context.collections";
9
+ import { Condition } from "../../models/conditions/condition.js";
10
+ import { ConditionKey } from "../../models/conditions/condition-key.js";
11
+ import { Resources } from "../../resources.js";
12
+ import { Platforms } from "../platforms.js";
13
+ export class CoreConditions {
14
+ static readOnly = new ConditionKey(Resources.readOnlyCondition, false, Resources.readOnlyDescription);
15
+ static hasSelection = new ConditionKey(Resources.hasSelectionCondition, false, Resources.hasSelectionDescription);
16
+ static hasMultipleSelections = new ConditionKey(Resources.hasMultipleSelectionsCondition, false, Resources.hasMultipleSelectionsDescription);
17
+ static tabIndents = new ConditionKey(Resources.tabIndentsCondition, false, Resources.tabIndentsDescription);
18
+ static platform = new ConditionKey(Resources.platformCondition, Platforms.of(globalThis.navigator.platform), Resources.platformDescription);
19
+ static all = new List([CoreConditions.readOnly, CoreConditions.hasSelection, CoreConditions.hasMultipleSelections, CoreConditions.tabIndents,
20
+ CoreConditions.platform]);
21
+ static onMac = Condition.equals(CoreConditions.platform, Resources.platformMac);
22
+ static offMac = Condition.notEquals(CoreConditions.platform, Resources.platformMac);
23
+ }
24
+ //# sourceMappingURL=core-conditions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-conditions.js","sourceRoot":"","sources":["../../../../../src/noldova.code.editor/src/services/conditions/core-conditions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAsB,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,cAAc;IAClB,MAAM,CAAU,QAAQ,GAA0B,IAAI,YAAY,CAAU,SAAS,CAAC,iBAAiB,EAAE,KAAK,EAAE,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAC/I,MAAM,CAAU,YAAY,GAA0B,IAAI,YAAY,CAAU,SAAS,CAAC,qBAAqB,EAAE,KAAK,EAAE,SAAS,CAAC,uBAAuB,CAAC,CAAC;IAC3J,MAAM,CAAU,qBAAqB,GAA0B,IAAI,YAAY,CAAU,SAAS,CAAC,8BAA8B,EAAE,KAAK,EAAE,SAAS,CAAC,gCAAgC,CAAC,CAAC;IACtL,MAAM,CAAU,UAAU,GAA0B,IAAI,YAAY,CAAU,SAAS,CAAC,mBAAmB,EAAE,KAAK,EAAE,SAAS,CAAC,qBAAqB,CAAC,CAAC;IACrJ,MAAM,CAAU,QAAQ,GAAyB,IAAI,YAAY,CAAS,SAAS,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,EACvJ,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAE1B,MAAM,CAAU,GAAG,GAAgD,IAAI,IAAI,CAA+B,CAAC,cAAc,CAAC,QAAQ,EAAE,cAAc,CAAC,YAAY,EAAE,cAAc,CAAC,qBAAqB,EAAE,cAAc,CAAC,UAAU;QACrO,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IAErB,MAAM,CAAU,KAAK,GAAc,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACpG,MAAM,CAAU,MAAM,GAAc,SAAS,CAAC,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Resources } from "../resources.js";
9
+ import { BuiltInTokenTypes } from "./tokens/built-in-token-types.js";
10
+ import { CoreCommands } from "./commands/core-commands.js";
11
+ import { CoreConditions } from "./conditions/core-conditions.js";
12
+ import { CoreKeyBindings } from "./core-key-bindings.js";
13
+ import { CoreSettings } from "./core-settings.js";
14
+ export class CoreContribution {
15
+ id = Resources.coreContribution;
16
+ contribute(registries) {
17
+ for (const command of CoreCommands.all)
18
+ registries.commands.register(command);
19
+ for (const condition of CoreConditions.all)
20
+ registries.conditions.register(condition);
21
+ for (const setting of CoreSettings.all)
22
+ registries.settings.declare(setting);
23
+ registries.keyBindings.addDefaults(this.id, CoreKeyBindings.rules);
24
+ BuiltInTokenTypes.register(registries.tokenTypes);
25
+ }
26
+ }
27
+ //# sourceMappingURL=core-contribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-contribution.js","sourceRoot":"","sources":["../../../../src/noldova.code.editor/src/services/core-contribution.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,OAAO,gBAAgB;IACX,EAAE,GAAW,SAAS,CAAC,gBAAgB,CAAC;IAEjD,UAAU,CAAC,UAA4B;QAC5C,KAAK,MAAM,OAAO,IAAI,YAAY,CAAC,GAAG;YACpC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACxC,KAAK,MAAM,SAAS,IAAI,cAAc,CAAC,GAAG;YACxC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC5C,KAAK,MAAM,OAAO,IAAI,YAAY,CAAC,GAAG;YACpC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvC,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;QACnE,iBAAiB,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC;CACF"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import "@noldova/context.core";
9
+ import { List } from "@noldova/context.collections";
10
+ import { Condition } from "../models/conditions/condition.js";
11
+ import { KeyBindingRule } from "../models/keys/key-binding-rule.js";
12
+ import { Resources } from "../resources.js";
13
+ import { CoreCommands } from "./commands/core-commands.js";
14
+ import { CoreConditions } from "./conditions/core-conditions.js";
15
+ export class CoreKeyBindings {
16
+ static TAB_INDENTS = Condition.has(CoreConditions.tabIndents);
17
+ static rules = new List([
18
+ ...CoreKeyBindings.moves(Resources.leftKey, CoreCommands.cursorLeft),
19
+ ...CoreKeyBindings.moves(Resources.ctrlLeftKey, CoreCommands.cursorWordLeft, CoreConditions.offMac),
20
+ ...CoreKeyBindings.moves(Resources.altLeftKey, CoreCommands.cursorWordLeft, CoreConditions.onMac),
21
+ ...CoreKeyBindings.moves(Resources.cmdLeftKey, CoreCommands.cursorHome, CoreConditions.onMac),
22
+ ...CoreKeyBindings.moves(Resources.rightKey, CoreCommands.cursorRight),
23
+ ...CoreKeyBindings.moves(Resources.ctrlRightKey, CoreCommands.cursorWordRight, CoreConditions.offMac),
24
+ ...CoreKeyBindings.moves(Resources.altRightKey, CoreCommands.cursorWordRight, CoreConditions.onMac),
25
+ ...CoreKeyBindings.moves(Resources.cmdRightKey, CoreCommands.cursorEnd, CoreConditions.onMac),
26
+ ...CoreKeyBindings.moves(Resources.upKey, CoreCommands.cursorUp),
27
+ ...CoreKeyBindings.moves(Resources.downKey, CoreCommands.cursorDown),
28
+ ...CoreKeyBindings.moves(Resources.ctrlUpKey, CoreCommands.cursorTop, CoreConditions.offMac),
29
+ ...CoreKeyBindings.moves(Resources.cmdUpKey, CoreCommands.cursorTop, CoreConditions.onMac),
30
+ ...CoreKeyBindings.moves(Resources.ctrlDownKey, CoreCommands.cursorBottom, CoreConditions.offMac),
31
+ ...CoreKeyBindings.moves(Resources.cmdDownKey, CoreCommands.cursorBottom, CoreConditions.onMac),
32
+ ...CoreKeyBindings.moves(Resources.pageUpKey, CoreCommands.cursorPageUp),
33
+ ...CoreKeyBindings.moves(Resources.pageDownKey, CoreCommands.cursorPageDown),
34
+ ...CoreKeyBindings.moves(Resources.homeKey, CoreCommands.cursorHome),
35
+ ...CoreKeyBindings.moves(Resources.endKey, CoreCommands.cursorEnd),
36
+ ...CoreKeyBindings.moves(Resources.ctrlHomeKey, CoreCommands.cursorTop, CoreConditions.offMac),
37
+ ...CoreKeyBindings.moves(Resources.ctrlEndKey, CoreCommands.cursorBottom, CoreConditions.offMac),
38
+ new KeyBindingRule(CoreCommands.deleteLeft.id, Resources.backspaceKey),
39
+ new KeyBindingRule(CoreCommands.deleteLeft.id, Resources.shiftBackspaceKey),
40
+ new KeyBindingRule(CoreCommands.deleteWordLeft.id, Resources.ctrlBackspaceKey, CoreConditions.offMac),
41
+ new KeyBindingRule(CoreCommands.deleteWordLeft.id, Resources.altBackspaceKey, CoreConditions.onMac),
42
+ new KeyBindingRule(CoreCommands.deleteRight.id, Resources.deleteKey),
43
+ new KeyBindingRule(CoreCommands.deleteWordRight.id, Resources.ctrlDeleteKey, CoreConditions.offMac),
44
+ new KeyBindingRule(CoreCommands.deleteWordRight.id, Resources.altDeleteKey, CoreConditions.onMac),
45
+ new KeyBindingRule(CoreCommands.deleteAllLeft.id, Resources.cmdBackspaceKey, CoreConditions.onMac),
46
+ new KeyBindingRule(CoreCommands.deleteAllRight.id, Resources.cmdDeleteKey, CoreConditions.onMac),
47
+ new KeyBindingRule(CoreCommands.cursorLineStart.id, Resources.ctrlAKey, CoreConditions.onMac),
48
+ new KeyBindingRule(CoreCommands.cursorEnd.id, Resources.ctrlEKey, CoreConditions.onMac),
49
+ new KeyBindingRule(CoreCommands.cursorRight.id, Resources.ctrlFKey, CoreConditions.onMac),
50
+ new KeyBindingRule(CoreCommands.cursorLeft.id, Resources.ctrlBKey, CoreConditions.onMac),
51
+ new KeyBindingRule(CoreCommands.cursorDown.id, Resources.ctrlNKey, CoreConditions.onMac),
52
+ new KeyBindingRule(CoreCommands.cursorUp.id, Resources.ctrlPKey, CoreConditions.onMac),
53
+ new KeyBindingRule(CoreCommands.deleteRight.id, Resources.ctrlDKey, CoreConditions.onMac),
54
+ new KeyBindingRule(CoreCommands.deleteLeft.id, Resources.ctrlHKey, CoreConditions.onMac),
55
+ new KeyBindingRule(CoreCommands.deleteAllRight.id, Resources.ctrlKKey, CoreConditions.onMac),
56
+ new KeyBindingRule(CoreCommands.newLine.id, Resources.enterKey),
57
+ new KeyBindingRule(CoreCommands.newLine.id, Resources.shiftEnterKey),
58
+ new KeyBindingRule(CoreCommands.indent.id, Resources.tabKey, CoreKeyBindings.TAB_INDENTS),
59
+ new KeyBindingRule(CoreCommands.outdent.id, Resources.shiftTabKey, CoreKeyBindings.TAB_INDENTS),
60
+ new KeyBindingRule(CoreCommands.cancelSelection.id, Resources.escapeKey),
61
+ new KeyBindingRule(CoreCommands.selectAll.id, Resources.modAKey),
62
+ new KeyBindingRule(CoreCommands.undo.id, Resources.modZKey),
63
+ new KeyBindingRule(CoreCommands.redo.id, Resources.modShiftZKey),
64
+ new KeyBindingRule(CoreCommands.redo.id, Resources.ctrlYKey, CoreConditions.offMac)
65
+ ]);
66
+ static moves(key, command, when = undefined) {
67
+ return [new KeyBindingRule(command.id, key, when), new KeyBindingRule(command.select.id, Resources.shiftPrefix + key, when)];
68
+ }
69
+ }
70
+ //# sourceMappingURL=core-key-bindings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-key-bindings.js","sourceRoot":"","sources":["../../../../src/noldova.code.editor/src/services/core-key-bindings.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OA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;QAChE,IAAI,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,OAAO,CAAC;QAC3D,IAAI,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,YAAY,CAAC;QAChE,IAAI,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC;KACpF,CAAC,CAAC;IAEK,MAAM,CAAC,KAAK,CAAC,GAAW,EAAE,OAAqB,EAAE,OAA8B,SAAS;QAC9F,OAAO,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/H,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { List } from "@noldova/context.collections";
9
+ import { Setting } from "../models/setting.js";
10
+ import { Resources } from "../resources.js";
11
+ export class CoreSettings {
12
+ static indentSize = Setting.integer(Resources.indentSizeSetting, Resources.defaultIndentSize, Resources.indentSizeDescription, Resources.minimumIndentSize, Resources.maximumIndentSize);
13
+ static insertSpaces = Setting.boolean(Resources.insertSpacesSetting, Resources.defaultInsertSpaces, Resources.insertSpacesDescription);
14
+ static undoGroupMilliseconds = Setting.integer(Resources.undoGroupMillisecondsSetting, Resources.undoGroupMilliseconds, Resources.undoGroupDescription, Resources.minimumUndoGroupMilliseconds);
15
+ static undoLimit = Setting.integer(Resources.undoLimitSetting, Resources.undoLimit, Resources.undoLimitDescription, Resources.minimumUndoLimit);
16
+ static all = new List([CoreSettings.indentSize, CoreSettings.insertSpaces, CoreSettings.undoGroupMilliseconds, CoreSettings.undoLimit]);
17
+ }
18
+ //# sourceMappingURL=core-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-settings.js","sourceRoot":"","sources":["../../../../src/noldova.code.editor/src/services/core-settings.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAsB,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,YAAY;IAChB,MAAM,CAAU,UAAU,GAAoB,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,iBAAiB,EAAE,SAAS,CAAC,iBAAiB,EAAE,SAAS,CAAC,qBAAqB,EAAE,SAAS,CAAC,iBAAiB,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;IACnN,MAAM,CAAU,YAAY,GAAqB,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,mBAAmB,EAAE,SAAS,CAAC,mBAAmB,EAAE,SAAS,CAAC,uBAAuB,CAAC,CAAC;IAClK,MAAM,CAAU,qBAAqB,GAAoB,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,4BAA4B,EAAE,SAAS,CAAC,qBAAqB,EAAE,SAAS,CAAC,oBAAoB,EAAE,SAAS,CAAC,4BAA4B,CAAC,CAAC;IAC1N,MAAM,CAAU,SAAS,GAAoB,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,oBAAoB,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAE1K,MAAM,CAAU,GAAG,GAAoC,IAAI,IAAI,CAAmB,CAAC,YAAY,CAAC,UAAU,EAAE,YAAY,CAAC,YAAY,EAAE,YAAY,CAAC,qBAAqB,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import "@noldova/context.core";
9
+ import { Enumerable } from "@noldova/context.collections";
10
+ import { RegistrationMissingException } from "../exceptions/registration-missing.exception.js";
11
+ import { Resources } from "../resources.js";
12
+ import { RegistryEntries } from "./registry-entries.js";
13
+ export class DiffAlgorithmRegistry {
14
+ entries;
15
+ constructor(parent = null) {
16
+ this.entries = new RegistryEntries(Resources.diffAlgorithmRegistry, t => t.id, parent?.entries ?? null);
17
+ }
18
+ register(algorithm) {
19
+ return this.entries.add(algorithm);
20
+ }
21
+ find(id) {
22
+ return this.entries.find(id);
23
+ }
24
+ get(id) {
25
+ return this.entries.get(id);
26
+ }
27
+ ids() {
28
+ return Enumerable.from(this.entries.all()).select(t => t.id).toList();
29
+ }
30
+ current(id = null) {
31
+ const named = Object.isNull(id) ? null : this.entries.find(id);
32
+ const algorithm = named ?? Enumerable.from(this.entries.all()).lastOrDefault();
33
+ if (Object.isUndefined(algorithm))
34
+ throw new RegistrationMissingException(Resources.diffAlgorithmRegistry, id ?? Resources.anyAlgorithm);
35
+ return algorithm;
36
+ }
37
+ }
38
+ //# sourceMappingURL=diff-algorithm-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-algorithm-registry.js","sourceRoot":"","sources":["../../../../src/noldova.code.editor/src/services/diff-algorithm-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAsB,MAAM,8BAA8B,CAAC;AAE9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAC;AAE/F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,OAAO,qBAAqB;IACf,OAAO,CAAkC;IAE1D,YAAmB,SAAu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