@kerebron/extension-codejar 0.4.5 → 0.4.6

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/esm/{extension-codejar/src/CodeJar.d.ts → CodeJar.d.ts} +1 -1
  2. package/esm/CodeJar.d.ts.map +1 -0
  3. package/esm/{extension-codejar/src/CodeJar.js → CodeJar.js} +1 -1
  4. package/esm/Decorator.d.ts.map +1 -0
  5. package/esm/{extension-codejar/src/ExtensionCodeJar.d.ts → ExtensionCodeJar.d.ts} +1 -1
  6. package/esm/ExtensionCodeJar.d.ts.map +1 -0
  7. package/esm/{extension-codejar/src/ExtensionCodeJar.js → ExtensionCodeJar.js} +2 -2
  8. package/esm/{extension-codejar/src/NodeCodeJar.d.ts → NodeCodeJar.d.ts} +3 -3
  9. package/esm/NodeCodeJar.d.ts.map +1 -0
  10. package/esm/{extension-codejar/src/NodeCodeJar.js → NodeCodeJar.js} +3 -3
  11. package/esm/{extension-codejar/src/TreeSitterHighlighter.d.ts → TreeSitterHighlighter.d.ts} +1 -1
  12. package/esm/TreeSitterHighlighter.d.ts.map +1 -0
  13. package/esm/{extension-codejar/src/TreeSitterHighlighter.js → TreeSitterHighlighter.js} +3 -8
  14. package/esm/{extension-codejar/src/codeJarBlockNodeView.d.ts → codeJarBlockNodeView.d.ts} +1 -1
  15. package/esm/codeJarBlockNodeView.d.ts.map +1 -0
  16. package/esm/{extension-codejar/src/codeJarBlockNodeView.js → codeJarBlockNodeView.js} +2 -2
  17. package/esm/codeJarLineNumbers.d.ts.map +1 -0
  18. package/esm/mod.d.ts +2 -0
  19. package/esm/mod.d.ts.map +1 -0
  20. package/esm/{extension-codejar/src/mod.js → mod.js} +0 -1
  21. package/esm/utils.d.ts.map +1 -0
  22. package/package.json +10 -6
  23. package/esm/_dnt.polyfills.d.ts +0 -101
  24. package/esm/_dnt.polyfills.d.ts.map +0 -1
  25. package/esm/_dnt.polyfills.js +0 -127
  26. package/esm/editor/src/CoreEditor.d.ts +0 -40
  27. package/esm/editor/src/CoreEditor.d.ts.map +0 -1
  28. package/esm/editor/src/CoreEditor.js +0 -252
  29. package/esm/editor/src/DummyEditorView.d.ts +0 -60
  30. package/esm/editor/src/DummyEditorView.d.ts.map +0 -1
  31. package/esm/editor/src/DummyEditorView.js +0 -277
  32. package/esm/editor/src/Extension.d.ts +0 -31
  33. package/esm/editor/src/Extension.d.ts.map +0 -1
  34. package/esm/editor/src/Extension.js +0 -53
  35. package/esm/editor/src/ExtensionManager.d.ts +0 -32
  36. package/esm/editor/src/ExtensionManager.d.ts.map +0 -1
  37. package/esm/editor/src/ExtensionManager.js +0 -260
  38. package/esm/editor/src/Mark.d.ts +0 -23
  39. package/esm/editor/src/Mark.d.ts.map +0 -1
  40. package/esm/editor/src/Mark.js +0 -51
  41. package/esm/editor/src/Node.d.ts +0 -32
  42. package/esm/editor/src/Node.d.ts.map +0 -1
  43. package/esm/editor/src/Node.js +0 -60
  44. package/esm/editor/src/commands/CommandManager.d.ts +0 -23
  45. package/esm/editor/src/commands/CommandManager.d.ts.map +0 -1
  46. package/esm/editor/src/commands/CommandManager.js +0 -118
  47. package/esm/editor/src/commands/baseCommandFactories.d.ts +0 -3
  48. package/esm/editor/src/commands/baseCommandFactories.d.ts.map +0 -1
  49. package/esm/editor/src/commands/baseCommandFactories.js +0 -836
  50. package/esm/editor/src/commands/createChainableState.d.ts +0 -3
  51. package/esm/editor/src/commands/createChainableState.d.ts.map +0 -1
  52. package/esm/editor/src/commands/createChainableState.js +0 -29
  53. package/esm/editor/src/commands/keyCommandFactories.d.ts +0 -3
  54. package/esm/editor/src/commands/keyCommandFactories.d.ts.map +0 -1
  55. package/esm/editor/src/commands/keyCommandFactories.js +0 -10
  56. package/esm/editor/src/commands/mod.d.ts +0 -7
  57. package/esm/editor/src/commands/mod.d.ts.map +0 -1
  58. package/esm/editor/src/commands/mod.js +0 -76
  59. package/esm/editor/src/commands/replaceCommandFactories.d.ts +0 -3
  60. package/esm/editor/src/commands/replaceCommandFactories.d.ts.map +0 -1
  61. package/esm/editor/src/commands/replaceCommandFactories.js +0 -94
  62. package/esm/editor/src/commands/types.d.ts +0 -18
  63. package/esm/editor/src/commands/types.d.ts.map +0 -1
  64. package/esm/editor/src/commands/types.js +0 -1
  65. package/esm/editor/src/mod.d.ts +0 -9
  66. package/esm/editor/src/mod.d.ts.map +0 -1
  67. package/esm/editor/src/mod.js +0 -8
  68. package/esm/editor/src/nodeToTreeString.d.ts +0 -10
  69. package/esm/editor/src/nodeToTreeString.d.ts.map +0 -1
  70. package/esm/editor/src/nodeToTreeString.js +0 -74
  71. package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts +0 -6
  72. package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts.map +0 -1
  73. package/esm/editor/src/plugins/TrackSelecionPlugin.js +0 -24
  74. package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts +0 -23
  75. package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts.map +0 -1
  76. package/esm/editor/src/plugins/input-rules/InputRulesPlugin.js +0 -163
  77. package/esm/editor/src/plugins/input-rules/mod.d.ts +0 -3
  78. package/esm/editor/src/plugins/input-rules/mod.d.ts.map +0 -1
  79. package/esm/editor/src/plugins/input-rules/mod.js +0 -2
  80. package/esm/editor/src/plugins/input-rules/rulebuilders.d.ts +0 -5
  81. package/esm/editor/src/plugins/input-rules/rulebuilders.d.ts.map +0 -1
  82. package/esm/editor/src/plugins/input-rules/rulebuilders.js +0 -50
  83. package/esm/editor/src/plugins/keymap/keymap.d.ts +0 -11
  84. package/esm/editor/src/plugins/keymap/keymap.d.ts.map +0 -1
  85. package/esm/editor/src/plugins/keymap/keymap.js +0 -125
  86. package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts +0 -4
  87. package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts.map +0 -1
  88. package/esm/editor/src/plugins/keymap/w3c-keyname.js +0 -124
  89. package/esm/editor/src/types.d.ts +0 -52
  90. package/esm/editor/src/types.d.ts.map +0 -1
  91. package/esm/editor/src/types.js +0 -1
  92. package/esm/editor/src/ui.d.ts +0 -15
  93. package/esm/editor/src/ui.d.ts.map +0 -1
  94. package/esm/editor/src/ui.js +0 -16
  95. package/esm/editor/src/utilities/SmartOutput.d.ts +0 -41
  96. package/esm/editor/src/utilities/SmartOutput.d.ts.map +0 -1
  97. package/esm/editor/src/utilities/SmartOutput.js +0 -228
  98. package/esm/editor/src/utilities/createNodeFromContent.d.ts +0 -9
  99. package/esm/editor/src/utilities/createNodeFromContent.d.ts.map +0 -1
  100. package/esm/editor/src/utilities/createNodeFromContent.js +0 -32
  101. package/esm/editor/src/utilities/getHtmlAttributes.d.ts +0 -9
  102. package/esm/editor/src/utilities/getHtmlAttributes.d.ts.map +0 -1
  103. package/esm/editor/src/utilities/getHtmlAttributes.js +0 -47
  104. package/esm/editor/src/utilities/getShadowRoot.d.ts +0 -2
  105. package/esm/editor/src/utilities/getShadowRoot.d.ts.map +0 -1
  106. package/esm/editor/src/utilities/getShadowRoot.js +0 -16
  107. package/esm/editor/src/utilities/mod.d.ts +0 -6
  108. package/esm/editor/src/utilities/mod.d.ts.map +0 -1
  109. package/esm/editor/src/utilities/mod.js +0 -5
  110. package/esm/editor/src/utilities/toRawTextResult.d.ts +0 -3
  111. package/esm/editor/src/utilities/toRawTextResult.d.ts.map +0 -1
  112. package/esm/editor/src/utilities/toRawTextResult.js +0 -21
  113. package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts +0 -8
  114. package/esm/extension-autocomplete/src/AutocompletePlugin.d.ts.map +0 -1
  115. package/esm/extension-autocomplete/src/AutocompletePlugin.js +0 -232
  116. package/esm/extension-autocomplete/src/DefaultRenderer.d.ts +0 -17
  117. package/esm/extension-autocomplete/src/DefaultRenderer.d.ts.map +0 -1
  118. package/esm/extension-autocomplete/src/DefaultRenderer.js +0 -137
  119. package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts +0 -26
  120. package/esm/extension-autocomplete/src/ExtensionAutocomplete.d.ts.map +0 -1
  121. package/esm/extension-autocomplete/src/ExtensionAutocomplete.js +0 -30
  122. package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts +0 -11
  123. package/esm/extension-autocomplete/src/createDefaultMatcher.d.ts.map +0 -1
  124. package/esm/extension-autocomplete/src/createDefaultMatcher.js +0 -58
  125. package/esm/extension-autocomplete/src/createRegexMatcher.d.ts +0 -4
  126. package/esm/extension-autocomplete/src/createRegexMatcher.d.ts.map +0 -1
  127. package/esm/extension-autocomplete/src/createRegexMatcher.js +0 -50
  128. package/esm/extension-autocomplete/src/mod.d.ts +0 -3
  129. package/esm/extension-autocomplete/src/mod.d.ts.map +0 -1
  130. package/esm/extension-autocomplete/src/mod.js +0 -2
  131. package/esm/extension-autocomplete/src/types.d.ts +0 -60
  132. package/esm/extension-autocomplete/src/types.d.ts.map +0 -1
  133. package/esm/extension-autocomplete/src/types.js +0 -1
  134. package/esm/extension-basic-editor/src/ExtensionHtml.d.ts +0 -15
  135. package/esm/extension-basic-editor/src/ExtensionHtml.d.ts.map +0 -1
  136. package/esm/extension-basic-editor/src/ExtensionHtml.js +0 -108
  137. package/esm/extension-basic-editor/src/NodeCodeBlock.d.ts +0 -9
  138. package/esm/extension-basic-editor/src/NodeCodeBlock.d.ts.map +0 -1
  139. package/esm/extension-basic-editor/src/NodeCodeBlock.js +0 -58
  140. package/esm/extension-codejar/src/CodeJar.d.ts.map +0 -1
  141. package/esm/extension-codejar/src/Decorator.d.ts.map +0 -1
  142. package/esm/extension-codejar/src/ExtensionCodeJar.d.ts.map +0 -1
  143. package/esm/extension-codejar/src/NodeCodeJar.d.ts.map +0 -1
  144. package/esm/extension-codejar/src/TreeSitterHighlighter.d.ts.map +0 -1
  145. package/esm/extension-codejar/src/codeJarBlockNodeView.d.ts.map +0 -1
  146. package/esm/extension-codejar/src/codeJarLineNumbers.d.ts.map +0 -1
  147. package/esm/extension-codejar/src/mod.d.ts +0 -3
  148. package/esm/extension-codejar/src/mod.d.ts.map +0 -1
  149. package/esm/extension-codejar/src/utils.d.ts.map +0 -1
  150. package/esm/extension-lsp/src/DiagnosticPlugin.d.ts +0 -32
  151. package/esm/extension-lsp/src/DiagnosticPlugin.d.ts.map +0 -1
  152. package/esm/extension-lsp/src/DiagnosticPlugin.js +0 -131
  153. package/esm/extension-lsp/src/ExtensionLsp.d.ts +0 -25
  154. package/esm/extension-lsp/src/ExtensionLsp.d.ts.map +0 -1
  155. package/esm/extension-lsp/src/ExtensionLsp.js +0 -126
  156. package/esm/extension-lsp/src/LSPClient.d.ts +0 -56
  157. package/esm/extension-lsp/src/LSPClient.d.ts.map +0 -1
  158. package/esm/extension-lsp/src/LSPClient.js +0 -449
  159. package/esm/extension-lsp/src/computeIncrementalChanges.d.ts +0 -8
  160. package/esm/extension-lsp/src/computeIncrementalChanges.d.ts.map +0 -1
  161. package/esm/extension-lsp/src/computeIncrementalChanges.js +0 -82
  162. package/esm/extension-lsp/src/createLspAutocomplete.d.ts +0 -23
  163. package/esm/extension-lsp/src/createLspAutocomplete.d.ts.map +0 -1
  164. package/esm/extension-lsp/src/createLspAutocomplete.js +0 -68
  165. package/esm/extension-lsp/src/mod.d.ts +0 -4
  166. package/esm/extension-lsp/src/mod.d.ts.map +0 -1
  167. package/esm/extension-lsp/src/mod.js +0 -3
  168. package/esm/extension-lsp/src/workspace.d.ts +0 -62
  169. package/esm/extension-lsp/src/workspace.d.ts.map +0 -1
  170. package/esm/extension-lsp/src/workspace.js +0 -168
  171. package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts +0 -36
  172. package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.d.ts.map +0 -1
  173. package/esm/extension-markdown/src/DocumentMarkdownInlineTokenizer.js +0 -240
  174. package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts +0 -26
  175. package/esm/extension-markdown/src/DocumentMarkdownTokenizer.d.ts.map +0 -1
  176. package/esm/extension-markdown/src/DocumentMarkdownTokenizer.js +0 -115
  177. package/esm/extension-markdown/src/ExtensionMarkdown.d.ts +0 -22
  178. package/esm/extension-markdown/src/ExtensionMarkdown.d.ts.map +0 -1
  179. package/esm/extension-markdown/src/ExtensionMarkdown.js +0 -48
  180. package/esm/extension-markdown/src/MarkdownParser.d.ts +0 -61
  181. package/esm/extension-markdown/src/MarkdownParser.d.ts.map +0 -1
  182. package/esm/extension-markdown/src/MarkdownParser.js +0 -249
  183. package/esm/extension-markdown/src/MarkdownSerializer.d.ts +0 -42
  184. package/esm/extension-markdown/src/MarkdownSerializer.d.ts.map +0 -1
  185. package/esm/extension-markdown/src/MarkdownSerializer.js +0 -325
  186. package/esm/extension-markdown/src/PositionMapper.d.ts +0 -15
  187. package/esm/extension-markdown/src/PositionMapper.d.ts.map +0 -1
  188. package/esm/extension-markdown/src/PositionMapper.js +0 -100
  189. package/esm/extension-markdown/src/TokenSource.d.ts +0 -11
  190. package/esm/extension-markdown/src/TokenSource.d.ts.map +0 -1
  191. package/esm/extension-markdown/src/TokenSource.js +0 -39
  192. package/esm/extension-markdown/src/mdToPmConverter.d.ts +0 -5
  193. package/esm/extension-markdown/src/mdToPmConverter.d.ts.map +0 -1
  194. package/esm/extension-markdown/src/mdToPmConverter.js +0 -111
  195. package/esm/extension-markdown/src/pmToMdConverter.d.ts +0 -16
  196. package/esm/extension-markdown/src/pmToMdConverter.d.ts.map +0 -1
  197. package/esm/extension-markdown/src/pmToMdConverter.js +0 -433
  198. package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts +0 -4
  199. package/esm/extension-markdown/src/token_handlers/basic_token_handlers.d.ts.map +0 -1
  200. package/esm/extension-markdown/src/token_handlers/basic_token_handlers.js +0 -151
  201. package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts +0 -3
  202. package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.d.ts.map +0 -1
  203. package/esm/extension-markdown/src/token_handlers/footnote_token_handlers.js +0 -34
  204. package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts +0 -6
  205. package/esm/extension-markdown/src/token_handlers/inline_token_handlers.d.ts.map +0 -1
  206. package/esm/extension-markdown/src/token_handlers/inline_token_handlers.js +0 -380
  207. package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts +0 -3
  208. package/esm/extension-markdown/src/token_handlers/lists_token_handlers.d.ts.map +0 -1
  209. package/esm/extension-markdown/src/token_handlers/lists_token_handlers.js +0 -323
  210. package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts +0 -9
  211. package/esm/extension-markdown/src/token_handlers/table_token_handlers.d.ts.map +0 -1
  212. package/esm/extension-markdown/src/token_handlers/table_token_handlers.js +0 -308
  213. package/esm/extension-markdown/src/treeSitterTokenizer.d.ts +0 -5
  214. package/esm/extension-markdown/src/treeSitterTokenizer.d.ts.map +0 -1
  215. package/esm/extension-markdown/src/treeSitterTokenizer.js +0 -769
  216. package/esm/extension-markdown/src/types.d.ts +0 -28
  217. package/esm/extension-markdown/src/types.d.ts.map +0 -1
  218. package/esm/extension-markdown/src/types.js +0 -131
  219. package/esm/extension-markdown/src/utils.d.ts +0 -8
  220. package/esm/extension-markdown/src/utils.d.ts.map +0 -1
  221. package/esm/extension-markdown/src/utils.js +0 -86
  222. package/esm/tree-sitter-shim/src/main.d.ts +0 -15
  223. package/esm/tree-sitter-shim/src/main.d.ts.map +0 -1
  224. package/esm/tree-sitter-shim/src/main.js +0 -25
  225. package/esm/tree-sitter-shim/src/tree_sitter/language.d.ts +0 -7
  226. package/esm/tree-sitter-shim/src/tree_sitter/language.d.ts.map +0 -1
  227. package/esm/tree-sitter-shim/src/tree_sitter/language.js +0 -5
  228. package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts +0 -6
  229. package/esm/tree-sitter-shim/src/tree_sitter/node.d.ts.map +0 -1
  230. package/esm/tree-sitter-shim/src/tree_sitter/node.js +0 -1
  231. package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts +0 -7
  232. package/esm/tree-sitter-shim/src/tree_sitter/parser.d.ts.map +0 -1
  233. package/esm/tree-sitter-shim/src/tree_sitter/parser.js +0 -5
  234. package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts +0 -6
  235. package/esm/tree-sitter-shim/src/tree_sitter/tree.d.ts.map +0 -1
  236. package/esm/tree-sitter-shim/src/tree_sitter/tree.js +0 -1
  237. package/esm/wasm/src/mod.d.ts +0 -12
  238. package/esm/wasm/src/mod.d.ts.map +0 -1
  239. package/esm/wasm/src/mod.js +0 -48
  240. package/esm/wasm/wasm.d.ts +0 -138
  241. package/esm/wasm/wasm.d.ts.map +0 -1
  242. package/esm/wasm/wasm.js +0 -120
  243. /package/esm/{extension-codejar/src/Decorator.d.ts → Decorator.d.ts} +0 -0
  244. /package/esm/{extension-codejar/src/Decorator.js → Decorator.js} +0 -0
  245. /package/esm/{extension-codejar/src/codeJarLineNumbers.d.ts → codeJarLineNumbers.d.ts} +0 -0
  246. /package/esm/{extension-codejar/src/codeJarLineNumbers.js → codeJarLineNumbers.js} +0 -0
  247. /package/esm/{extension-codejar/src/utils.d.ts → utils.d.ts} +0 -0
  248. /package/esm/{extension-codejar/src/utils.js → utils.js} +0 -0
@@ -1,228 +0,0 @@
1
- export class SmartOutput {
2
- constructor() {
3
- Object.defineProperty(this, "_rowPos", {
4
- enumerable: true,
5
- configurable: true,
6
- writable: true,
7
- value: 0
8
- });
9
- Object.defineProperty(this, "_colPos", {
10
- enumerable: true,
11
- configurable: true,
12
- writable: true,
13
- value: 0
14
- });
15
- Object.defineProperty(this, "_pos", {
16
- enumerable: true,
17
- configurable: true,
18
- writable: true,
19
- value: 0
20
- });
21
- Object.defineProperty(this, "chunks", {
22
- enumerable: true,
23
- configurable: true,
24
- writable: true,
25
- value: []
26
- });
27
- Object.defineProperty(this, "metas", {
28
- enumerable: true,
29
- configurable: true,
30
- writable: true,
31
- value: []
32
- });
33
- }
34
- log(text, item) {
35
- if (text.length === 0) {
36
- return;
37
- }
38
- this.chunks.push(text);
39
- this.metas.push({
40
- pos: this._pos,
41
- colPos: this._colPos,
42
- rowPos: this._rowPos,
43
- item,
44
- });
45
- const lines = text.split('\n');
46
- if (lines.length === 1) {
47
- this._colPos += lines[lines.length - 1].length;
48
- }
49
- else {
50
- this._rowPos += lines.length - 1;
51
- this._colPos = lines[lines.length - 1].length;
52
- }
53
- this._pos += text.length;
54
- }
55
- getMetas() {
56
- return this.metas;
57
- }
58
- get chunkPos() {
59
- return this.chunks.length;
60
- }
61
- rollback(pos) {
62
- this.chunks.splice(pos);
63
- this.metas.splice(pos);
64
- }
65
- get rowPos() {
66
- return this._rowPos;
67
- }
68
- get colPos() {
69
- return this._colPos;
70
- }
71
- get pos() {
72
- return this._pos;
73
- }
74
- endsWith(text) {
75
- return this.chunks.join('').endsWith(text);
76
- }
77
- toString() {
78
- return this.chunks.join('');
79
- }
80
- getSourceMap(mapper) {
81
- const mappingRows = [];
82
- let lastRow = -1;
83
- let lastCol = -1;
84
- let prevSourceNo = 0;
85
- let prevSourceRowPos = 0;
86
- let prevSourceColPos = 0;
87
- let prevColPos = 0;
88
- for (const meta of this.metas) {
89
- while (meta.rowPos >= mappingRows.length) {
90
- mappingRows.push([]);
91
- }
92
- if (lastRow != meta.rowPos || lastCol != meta.colPos) {
93
- const currentRow = mappingRows[meta.rowPos];
94
- if (lastRow != meta.rowPos) {
95
- prevColPos = 0;
96
- }
97
- const mapping = mapper(meta.rowPos, meta.colPos, meta.pos, meta.item);
98
- if (mapping) {
99
- currentRow.push([
100
- meta.colPos - prevColPos,
101
- mapping.sourceNo - prevSourceNo,
102
- mapping.sourceRowPos - prevSourceRowPos,
103
- mapping.sourceColPos - prevSourceColPos,
104
- ]);
105
- prevColPos = meta.colPos;
106
- prevSourceNo = mapping.sourceNo;
107
- prevSourceRowPos = mapping.sourceRowPos;
108
- prevSourceColPos = mapping.sourceColPos;
109
- }
110
- }
111
- lastRow = meta.rowPos;
112
- lastCol = meta.colPos;
113
- }
114
- const mappings = mappingRows
115
- .map((row) => row.map((group) => encode(group))
116
- .join(','))
117
- .join(';');
118
- return {
119
- version: 3,
120
- file: '',
121
- sourceRoot: '',
122
- sources: [],
123
- sourcesContent: [],
124
- names: [],
125
- mappings,
126
- };
127
- }
128
- }
129
- const BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
130
- function toVLQ(value) {
131
- const vlq = [];
132
- const isNegative = value < 0;
133
- value = Math.abs(value);
134
- if (value === 0) {
135
- vlq.push(0);
136
- return vlq;
137
- }
138
- while (value > 0) {
139
- let digit = value & 0x1F;
140
- value >>= 5;
141
- if (value > 0) {
142
- digit |= 0x20;
143
- }
144
- vlq.push(digit);
145
- if (vlq.length === 1) {
146
- digit = isNegative ? (digit | 0x1) : (digit & ~0x1);
147
- vlq[0] = digit;
148
- }
149
- }
150
- return vlq;
151
- }
152
- function encodeVLQ(input) {
153
- const numbers = Array.isArray(input) ? input : [input];
154
- let result = '';
155
- for (const num of numbers) {
156
- const vlq = toVLQ(num);
157
- for (const digit of vlq) {
158
- result += BASE64_CHARS[digit];
159
- }
160
- }
161
- return result;
162
- }
163
- const char_to_integer = {};
164
- const integer_to_char = {};
165
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
166
- .split('')
167
- .forEach(function (char, i) {
168
- char_to_integer[char] = i;
169
- integer_to_char[i] = char;
170
- });
171
- export function decode(string) {
172
- let result = [];
173
- let shift = 0;
174
- let value = 0;
175
- for (let i = 0; i < string.length; i += 1) {
176
- let integer = char_to_integer[string[i]];
177
- if (integer === undefined) {
178
- throw new Error('Invalid character (' + string[i] + ')');
179
- }
180
- const has_continuation_bit = integer & 32;
181
- integer &= 31;
182
- value += integer << shift;
183
- if (has_continuation_bit) {
184
- shift += 5;
185
- }
186
- else {
187
- const should_negate = value & 1;
188
- value >>>= 1;
189
- if (should_negate) {
190
- result.push(value === 0 ? -0x80000000 : -value);
191
- }
192
- else {
193
- result.push(value);
194
- }
195
- // reset
196
- value = shift = 0;
197
- }
198
- }
199
- return result;
200
- }
201
- export function encode(value) {
202
- if (typeof value === 'number') {
203
- return encode_integer(value);
204
- }
205
- let result = '';
206
- for (let i = 0; i < value.length; i += 1) {
207
- result += encode_integer(value[i]);
208
- }
209
- return result;
210
- }
211
- function encode_integer(num) {
212
- let result = '';
213
- if (num < 0) {
214
- num = (-num << 1) | 1;
215
- }
216
- else {
217
- num <<= 1;
218
- }
219
- do {
220
- let clamped = num & 31;
221
- num >>>= 5;
222
- if (num > 0) {
223
- clamped |= 32;
224
- }
225
- result += integer_to_char[clamped];
226
- } while (num > 0);
227
- return result;
228
- }
@@ -1,9 +0,0 @@
1
- import { Fragment, Node as ProseMirrorNode, Schema } from 'prosemirror-model';
2
- import type { JSONContent } from '../types.js';
3
- export type CreateNodeFromContentOptions = {
4
- errorOnInvalidContent?: boolean;
5
- };
6
- export declare function createNodeFromObject(content: JSONContent | ProseMirrorNode | Fragment, schema: Schema, options?: CreateNodeFromContentOptions): ProseMirrorNode;
7
- export declare function createNodeFromArray(content: JSONContent[], schema: Schema): Fragment;
8
- export declare function createNodeFromContent(content: JSONContent | ProseMirrorNode | Fragment, schema: Schema, options?: CreateNodeFromContentOptions): ProseMirrorNode | Fragment;
9
- //# sourceMappingURL=createNodeFromContent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createNodeFromContent.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/createNodeFromContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,4BAA4B,GAAG;IACzC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,WAAW,GAAG,eAAe,GAAG,QAAQ,EACjD,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,4BAA4B,GACrC,eAAe,CA0BjB;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,EAAE,EACtB,MAAM,EAAE,MAAM,GACb,QAAQ,CAIV;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,WAAW,GAAG,eAAe,GAAG,QAAQ,EACjD,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,4BAA4B,GACrC,eAAe,GAAG,QAAQ,CAY5B"}
@@ -1,32 +0,0 @@
1
- import { Fragment, Node as ProseMirrorNode } from 'prosemirror-model';
2
- export function createNodeFromObject(content, schema, options) {
3
- try {
4
- const node = schema.nodeFromJSON(content);
5
- if (options?.errorOnInvalidContent) {
6
- node.check();
7
- }
8
- return node;
9
- }
10
- catch (error) {
11
- if (options?.errorOnInvalidContent) {
12
- throw new Error('Invalid JSON content', {
13
- cause: error,
14
- });
15
- }
16
- console.warn('Invalid content.', 'Passed value:', content, 'Error:', error);
17
- return schema.topNodeType.createAndFill(null, []);
18
- }
19
- }
20
- export function createNodeFromArray(content, schema) {
21
- return Fragment.fromArray(content.map((item) => schema.nodeFromJSON(item)));
22
- }
23
- export function createNodeFromContent(content, schema, options) {
24
- if (content instanceof ProseMirrorNode || content instanceof Fragment) {
25
- return content;
26
- }
27
- const isJSONContent = typeof content === 'object' && content !== null;
28
- if (isJSONContent) {
29
- return createNodeFromObject(content, schema, options);
30
- }
31
- return schema.topNodeType.createAndFill(null, []);
32
- }
@@ -1,9 +0,0 @@
1
- import type { MarkSpec, Node as ProseMirrorNode, NodeSpec } from 'prosemirror-model';
2
- import type { Mark } from '../Mark.js';
3
- import type { Node } from '../Node.js';
4
- type MarkOfNode = Mark | Node;
5
- export declare function getHtmlAttributes(extension: MarkOfNode, node: ProseMirrorNode): Record<string, any>;
6
- export declare function setHtmlAttributes(extension: MarkOfNode, element: HTMLElement): Record<string, any>;
7
- export declare function addAttributesToSchema(spec: MarkSpec | NodeSpec, extension: MarkOfNode): void;
8
- export {};
9
- //# sourceMappingURL=getHtmlAttributes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getHtmlAttributes.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/getHtmlAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,IAAI,IAAI,eAAe,EACvB,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9B,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,UAAU,EACrB,IAAI,EAAE,eAAe,uBAmBtB;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,uBAc5E;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,QAAQ,GAAG,QAAQ,EACzB,SAAS,EAAE,UAAU,QAetB"}
@@ -1,47 +0,0 @@
1
- export function getHtmlAttributes(extension, node) {
2
- const attrs = {};
3
- if (extension.attributes) {
4
- for (const [key, value] of Object.entries(extension.attributes)) {
5
- if ('undefined' !== typeof node.attrs[key]) {
6
- attrs[key] = node.attrs[key];
7
- }
8
- else {
9
- if (value.toDom) {
10
- attrs[key] = value.toDom(node);
11
- }
12
- else {
13
- attrs[key] = value.default;
14
- }
15
- }
16
- }
17
- }
18
- return attrs;
19
- }
20
- export function setHtmlAttributes(extension, element) {
21
- const attrs = {};
22
- if (extension.attributes) {
23
- for (const [key, value] of Object.entries(extension.attributes)) {
24
- if (value.fromDom) {
25
- attrs[key] = value.fromDom(element);
26
- }
27
- else {
28
- attrs[key] = value.default;
29
- }
30
- }
31
- }
32
- return attrs;
33
- }
34
- export function addAttributesToSchema(spec, extension) {
35
- const attrs = {};
36
- if (extension.attributes) {
37
- if (!spec.attrs) {
38
- spec.attrs = {};
39
- }
40
- for (const [key, value] of Object.entries(extension.attributes)) {
41
- spec.attrs[key] = value;
42
- if (!value.toDom) {
43
- value.toDom = (node) => node.attrs[key];
44
- }
45
- }
46
- }
47
- }
@@ -1,2 +0,0 @@
1
- export declare function getShadowRoot(element?: Element): ShadowRoot | undefined;
2
- //# sourceMappingURL=getShadowRoot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getShadowRoot.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/getShadowRoot.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAiBvE"}
@@ -1,16 +0,0 @@
1
- export function getShadowRoot(element) {
2
- let current = element;
3
- while (current) {
4
- if (current.toString() === '[object ShadowRoot]') {
5
- return current;
6
- }
7
- if (current instanceof ShadowRoot) {
8
- if (current.host) {
9
- return current.host.shadowRoot || undefined;
10
- }
11
- }
12
- current = current.parentElement ||
13
- ((current instanceof ShadowRoot) ? current.host : undefined);
14
- }
15
- return undefined;
16
- }
@@ -1,6 +0,0 @@
1
- export * from './getHtmlAttributes.js';
2
- export * from './createNodeFromContent.js';
3
- export * from './SmartOutput.js';
4
- export * from './getShadowRoot.js';
5
- export * from './toRawTextResult.js';
6
- //# sourceMappingURL=mod.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/mod.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
@@ -1,5 +0,0 @@
1
- export * from './getHtmlAttributes.js';
2
- export * from './createNodeFromContent.js';
3
- export * from './SmartOutput.js';
4
- export * from './getShadowRoot.js';
5
- export * from './toRawTextResult.js';
@@ -1,3 +0,0 @@
1
- import { RawTextResult } from '../types.js';
2
- export declare function toRawTextResult(content: string, nodeIdx?: number): RawTextResult;
3
- //# sourceMappingURL=toRawTextResult.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toRawTextResult.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/toRawTextResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAE7D,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,aAAa,CAwB3E"}
@@ -1,21 +0,0 @@
1
- export function toRawTextResult(content, nodeIdx = 0) {
2
- const lines = content.split('\n');
3
- const rawTextMap = [];
4
- let targetPos = 0;
5
- let targetRow = 0;
6
- for (const line of lines) {
7
- rawTextMap.push({
8
- nodeIdx,
9
- targetRow,
10
- targetCol: 0,
11
- targetPos,
12
- });
13
- targetRow++;
14
- targetPos += line.length + 1;
15
- nodeIdx += line.length + 1;
16
- }
17
- return {
18
- content,
19
- rawTextMap,
20
- };
21
- }
@@ -1,8 +0,0 @@
1
- import { Plugin, PluginKey } from 'prosemirror-state';
2
- import { type CoreEditor } from '../../editor/src/mod.js';
3
- import type { AutocompleteConfig } from './ExtensionAutocomplete.js';
4
- export declare const AutocompletePluginKey: PluginKey<any>;
5
- export declare class AutocompletePlugin<Item, TSelected> extends Plugin {
6
- constructor(config: AutocompleteConfig, editor: CoreEditor);
7
- }
8
- //# sourceMappingURL=AutocompletePlugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutocompletePlugin.d.ts","sourceRoot":"","sources":["../../../src/extension-autocomplete/src/AutocompletePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EAAE,KAAK,UAAU,EAAkB,MAAM,yBAAyB,CAAC;AAE1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AASrE,eAAO,MAAM,qBAAqB,gBAAgC,CAAC;AAEnE,qBAAa,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAE,SAAQ,MAAM;gBACjD,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,UAAU;CA2R3D"}
@@ -1,232 +0,0 @@
1
- import { Plugin, PluginKey } from 'prosemirror-state';
2
- import { Decoration, DecorationSet } from 'prosemirror-view';
3
- import { createDefaultMatcher } from './createDefaultMatcher.js';
4
- import { DefaultRenderer } from './DefaultRenderer.js';
5
- export const AutocompletePluginKey = new PluginKey('autocomplete');
6
- export class AutocompletePlugin extends Plugin {
7
- constructor(config, editor) {
8
- let props;
9
- const renderer = config.renderer ||
10
- new DefaultRenderer(editor);
11
- super({
12
- key: AutocompletePluginKey,
13
- view() {
14
- return {
15
- update: async (view, prevState) => {
16
- const prev = this.key?.getState(prevState);
17
- const next = this.key?.getState(view.state);
18
- const moved = prev.active && next.active &&
19
- prev.range.from !== next.range.from;
20
- const started = !prev.active && next.active;
21
- const stopped = prev.active && !next.active;
22
- const changed = !started && !stopped && prev.query !== next.query;
23
- const handleStart = started || (moved && changed);
24
- const handleChange = changed || moved;
25
- let handleExit = stopped || (moved && changed);
26
- if (!handleStart && !handleChange && !handleExit) {
27
- return;
28
- }
29
- const state = handleExit && !handleStart ? prev : next;
30
- // await new Promise(r => setTimeout(r, 100));
31
- const decorationNode = view.dom.querySelector(`[data-decoration-id="${state.decorationId}"]`);
32
- props = {
33
- range: state.range,
34
- query: state.query,
35
- text: state.text,
36
- items: [],
37
- command: (selected) => {
38
- if (!config.onSelect) {
39
- return () => { };
40
- }
41
- return config.onSelect(selected, state.range);
42
- },
43
- decorationNode,
44
- // virtual node for popper.js or tippy.js
45
- // this can be used for building popups without a DOM node
46
- clientRect: decorationNode
47
- ? () => {
48
- // because of `items` can be asynchrounous we’ll search for the current decoration node
49
- const { decorationId } = this.key?.getState(editor.state); // eslint-disable-line
50
- const currentDecorationNode = view.dom.querySelector(`[data-decoration-id="${decorationId}"]`);
51
- return currentDecorationNode?.getBoundingClientRect() || null;
52
- }
53
- : null,
54
- };
55
- if (handleStart) {
56
- renderer?.onBeforeStart?.(props);
57
- }
58
- if (handleChange) {
59
- renderer?.onBeforeUpdate?.(props);
60
- }
61
- if (handleChange || handleStart) {
62
- if (config.getItems) {
63
- try {
64
- const ctx = { state, range: state.range, isActive: true };
65
- props.items = await config.getItems(state.query, ctx);
66
- }
67
- catch (err) {
68
- if (err.isLSP) {
69
- props.items = [];
70
- console.error('LSP error config.getItems()', err.message, config.getItems);
71
- }
72
- else {
73
- throw err;
74
- }
75
- }
76
- if (props.items.length === 0) {
77
- handleExit = true;
78
- }
79
- }
80
- }
81
- if (handleExit) {
82
- renderer?.onExit?.(props);
83
- }
84
- if (handleChange) {
85
- renderer?.onUpdate?.(props);
86
- }
87
- if (handleStart) {
88
- renderer?.onStart?.(props);
89
- }
90
- },
91
- destroy: () => {
92
- if (!props) {
93
- return;
94
- }
95
- renderer?.onExit?.(props);
96
- },
97
- };
98
- },
99
- state: {
100
- // Initialize the plugin's internal state.
101
- init() {
102
- const state = {
103
- manual: false,
104
- active: false,
105
- range: {
106
- from: 0,
107
- to: 0,
108
- },
109
- query: null,
110
- text: null,
111
- composing: false,
112
- };
113
- return state;
114
- },
115
- // Apply changes to the plugin state from a view transaction.
116
- apply(transaction, prev, _oldState, state) {
117
- // const { isEditable } = editor; // TODO
118
- const isEditable = true;
119
- const { composing } = editor.view;
120
- const { selection } = transaction;
121
- const { empty, from } = selection;
122
- const next = { ...prev };
123
- const meta = transaction.getMeta(AutocompletePluginKey);
124
- if (!meta && !transaction.isGeneric) {
125
- return next;
126
- }
127
- if (meta?.type === 'deactivate') {
128
- console.info('Deactivate autocomplete');
129
- next.active = false;
130
- return next;
131
- }
132
- if (meta?.type === 'activate') {
133
- console.info('Trigger manual autocomplete');
134
- next.range = { from: selection.from, to: selection.to };
135
- next.active = true;
136
- next.manual = true;
137
- next.query = null;
138
- return next;
139
- }
140
- next.composing = composing;
141
- const parentNode = selection.$anchor.parent;
142
- if (!['code_block'].includes(parentNode?.type.name) && isEditable &&
143
- (empty || editor.view.composing)) {
144
- // Reset active state if we just left the previous suggestion range
145
- if ((from < prev.range.from || from > prev.range.to) && !composing &&
146
- !prev.composing) {
147
- next.active = false;
148
- }
149
- const matchers = config.matchers ||
150
- [createDefaultMatcher()];
151
- let match = undefined;
152
- for (const matcher of matchers) {
153
- match = matcher(selection.$from);
154
- if (match) {
155
- break;
156
- }
157
- }
158
- const decorationId = `id_${Math.floor(Math.random() * 0xffffffff)}`;
159
- // If we found a match, update the current state to show it
160
- if (match && (!config.allow || config.allow({
161
- state,
162
- range: match.range,
163
- isActive: prev.active,
164
- }))) {
165
- console.info('Trigger matcher autocomplete', match);
166
- next.active = true;
167
- next.decorationId = prev.decorationId
168
- ? prev.decorationId
169
- : decorationId;
170
- next.range = match.range;
171
- next.query = match.query;
172
- next.text = match.text;
173
- }
174
- else {
175
- next.active = false;
176
- }
177
- }
178
- else {
179
- next.active = false;
180
- }
181
- next.manual = false;
182
- // Make sure to empty the range if suggestion is inactive
183
- if (!next.active) {
184
- next.decorationId = null;
185
- next.range = { from: 0, to: 0 };
186
- next.query = null;
187
- next.text = null;
188
- }
189
- return next;
190
- },
191
- },
192
- props: {
193
- // Call the keydown hook if suggestion is active.
194
- handleKeyDown(view, event) {
195
- const { active, range } = this.getState(view.state);
196
- if (event.key === ' ' && event.ctrlKey) {
197
- const tr = view.state.tr.setMeta(AutocompletePluginKey, {
198
- type: 'activate',
199
- });
200
- console.info('Manual autocomplete key');
201
- view.dispatch(tr);
202
- return true;
203
- }
204
- if (active) {
205
- return renderer?.onKeyDown?.({ view, event, range }) || false;
206
- }
207
- return false;
208
- },
209
- // Setup decorator on the currently active suggestion.
210
- decorations(state) {
211
- const { active, range, decorationId } = this.getState(state);
212
- if (!active) {
213
- return null;
214
- }
215
- const node = document.createElement('span');
216
- node.className = config.decorationClass || 'kb-autocomplete--decor';
217
- node.setAttribute('data-decoration-id', decorationId);
218
- return DecorationSet.create(state.doc, [
219
- Decoration.widget(range.from, node),
220
- ]);
221
- },
222
- },
223
- });
224
- renderer.addEventListener('close', () => {
225
- const tr = editor.state.tr.setMeta(AutocompletePluginKey, {
226
- type: 'deactivate',
227
- });
228
- console.info('Manual autocomplete deactivate');
229
- editor.view.dispatch(tr);
230
- });
231
- }
232
- }
@@ -1,17 +0,0 @@
1
- import { CoreEditor } from '../../editor/src/mod.js';
2
- import { AutocompleteRenderer, SuggestionKeyDownProps, SuggestionProps } from './types.js';
3
- export declare class DefaultRenderer<Item> extends EventTarget implements AutocompleteRenderer {
4
- private editor;
5
- command: (props: any) => void;
6
- wrapper: HTMLElement | undefined;
7
- items: Array<Item>;
8
- pos: number;
9
- constructor(editor: CoreEditor);
10
- onStart(props: SuggestionProps<Item>): void;
11
- onUpdate(props: SuggestionProps<Item>): void;
12
- onExit(): void;
13
- onKeyDown(props: SuggestionKeyDownProps): boolean;
14
- createListItem(item: Item, cnt: number): any;
15
- recreateList(props?: SuggestionProps<Item>): void;
16
- }
17
- //# sourceMappingURL=DefaultRenderer.d.ts.map