@difizen/libro-codemirror 0.0.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +0 -0
  3. package/es/auto-complete/closebrackets.d.ts +12 -0
  4. package/es/auto-complete/closebrackets.d.ts.map +1 -0
  5. package/es/auto-complete/closebrackets.js +408 -0
  6. package/es/auto-complete/completion.d.ts +57 -0
  7. package/es/auto-complete/completion.d.ts.map +1 -0
  8. package/es/auto-complete/completion.js +265 -0
  9. package/es/auto-complete/config.d.ts +22 -0
  10. package/es/auto-complete/config.d.ts.map +1 -0
  11. package/es/auto-complete/config.js +44 -0
  12. package/es/auto-complete/filter.d.ts +13 -0
  13. package/es/auto-complete/filter.d.ts.map +1 -0
  14. package/es/auto-complete/filter.js +191 -0
  15. package/es/auto-complete/index.d.ts +17 -0
  16. package/es/auto-complete/index.d.ts.map +1 -0
  17. package/es/auto-complete/index.js +107 -0
  18. package/es/auto-complete/snippet.d.ts +14 -0
  19. package/es/auto-complete/snippet.d.ts.map +1 -0
  20. package/es/auto-complete/snippet.js +447 -0
  21. package/es/auto-complete/state.d.ts +63 -0
  22. package/es/auto-complete/state.d.ts.map +1 -0
  23. package/es/auto-complete/state.js +452 -0
  24. package/es/auto-complete/theme.d.ts +6 -0
  25. package/es/auto-complete/theme.d.ts.map +1 -0
  26. package/es/auto-complete/theme.js +151 -0
  27. package/es/auto-complete/tooltip.d.ts +5 -0
  28. package/es/auto-complete/tooltip.d.ts.map +1 -0
  29. package/es/auto-complete/tooltip.js +365 -0
  30. package/es/auto-complete/view.d.ts +43 -0
  31. package/es/auto-complete/view.d.ts.map +1 -0
  32. package/es/auto-complete/view.js +372 -0
  33. package/es/auto-complete/word.d.ts +3 -0
  34. package/es/auto-complete/word.d.ts.map +1 -0
  35. package/es/auto-complete/word.js +119 -0
  36. package/es/completion.d.ts +6 -0
  37. package/es/completion.d.ts.map +1 -0
  38. package/es/completion.js +84 -0
  39. package/es/config.d.ts +184 -0
  40. package/es/config.d.ts.map +1 -0
  41. package/es/config.js +473 -0
  42. package/es/editor.d.ts +361 -0
  43. package/es/editor.d.ts.map +1 -0
  44. package/es/editor.js +1126 -0
  45. package/es/factory.d.ts +3 -0
  46. package/es/factory.d.ts.map +1 -0
  47. package/es/factory.js +12 -0
  48. package/es/hyperlink.d.ts +15 -0
  49. package/es/hyperlink.d.ts.map +1 -0
  50. package/es/hyperlink.js +120 -0
  51. package/es/indent.d.ts +8 -0
  52. package/es/indent.d.ts.map +1 -0
  53. package/es/indent.js +58 -0
  54. package/es/indentation-markers/config.d.ts +17 -0
  55. package/es/indentation-markers/config.d.ts.map +1 -0
  56. package/es/indentation-markers/config.js +10 -0
  57. package/es/indentation-markers/index.d.ts +3 -0
  58. package/es/indentation-markers/index.d.ts.map +1 -0
  59. package/es/indentation-markers/index.js +160 -0
  60. package/es/indentation-markers/map.d.ts +77 -0
  61. package/es/indentation-markers/map.d.ts.map +1 -0
  62. package/es/indentation-markers/map.js +265 -0
  63. package/es/indentation-markers/utils.d.ts +27 -0
  64. package/es/indentation-markers/utils.d.ts.map +1 -0
  65. package/es/indentation-markers/utils.js +91 -0
  66. package/es/index.d.ts +11 -0
  67. package/es/index.d.ts.map +1 -0
  68. package/es/index.js +10 -0
  69. package/es/libro-icon.d.ts +3 -0
  70. package/es/libro-icon.d.ts.map +1 -0
  71. package/es/libro-icon.js +2 -0
  72. package/es/mimetype.d.ts +22 -0
  73. package/es/mimetype.d.ts.map +1 -0
  74. package/es/mimetype.js +59 -0
  75. package/es/mode.d.ts +86 -0
  76. package/es/mode.d.ts.map +1 -0
  77. package/es/mode.js +284 -0
  78. package/es/monitor.d.ts +32 -0
  79. package/es/monitor.d.ts.map +1 -0
  80. package/es/monitor.js +129 -0
  81. package/es/python-lang.d.ts +3 -0
  82. package/es/python-lang.d.ts.map +1 -0
  83. package/es/python-lang.js +7 -0
  84. package/es/style/base.css +131 -0
  85. package/es/style/theme.css +12 -0
  86. package/es/style/variables.css +403 -0
  87. package/es/theme.d.ts +35 -0
  88. package/es/theme.d.ts.map +1 -0
  89. package/es/theme.js +225 -0
  90. package/es/tooltip.d.ts +10 -0
  91. package/es/tooltip.d.ts.map +1 -0
  92. package/es/tooltip.js +170 -0
  93. package/package.json +74 -0
  94. package/src/auto-complete/README.md +71 -0
  95. package/src/auto-complete/closebrackets.ts +423 -0
  96. package/src/auto-complete/completion.ts +345 -0
  97. package/src/auto-complete/config.ts +101 -0
  98. package/src/auto-complete/filter.ts +215 -0
  99. package/src/auto-complete/index.ts +112 -0
  100. package/src/auto-complete/snippet.ts +394 -0
  101. package/src/auto-complete/state.ts +472 -0
  102. package/src/auto-complete/theme.ts +126 -0
  103. package/src/auto-complete/tooltip.ts +386 -0
  104. package/src/auto-complete/view.ts +343 -0
  105. package/src/auto-complete/word.ts +118 -0
  106. package/src/completion.ts +61 -0
  107. package/src/config.ts +689 -0
  108. package/src/editor.ts +1078 -0
  109. package/src/factory.ts +10 -0
  110. package/src/hyperlink.ts +95 -0
  111. package/src/indent.ts +69 -0
  112. package/src/indentation-markers/config.ts +31 -0
  113. package/src/indentation-markers/index.ts +192 -0
  114. package/src/indentation-markers/map.ts +273 -0
  115. package/src/indentation-markers/utils.ts +84 -0
  116. package/src/index.ts +11 -0
  117. package/src/libro-icon.ts +4 -0
  118. package/src/mimetype.ts +49 -0
  119. package/src/mode.ts +269 -0
  120. package/src/monitor.ts +105 -0
  121. package/src/python-lang.ts +7 -0
  122. package/src/style/base.css +129 -0
  123. package/src/style/theme.css +12 -0
  124. package/src/style/variables.css +405 -0
  125. package/src/theme.ts +231 -0
  126. package/src/tooltip.ts +145 -0
@@ -0,0 +1,365 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
5
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
+ /* eslint-disable no-param-reassign */
15
+ /* eslint-disable @typescript-eslint/no-parameter-properties */
16
+ /* eslint-disable @typescript-eslint/parameter-properties */
17
+ /* eslint-disable prefer-const */
18
+
19
+ import { Direction, logException } from '@codemirror/view';
20
+ import { applyCompletion } from "./completion.js";
21
+ import { completionConfig } from "./config.js";
22
+ import { Info } from "./theme.js";
23
+ function optionContent(config) {
24
+ var content = config.addToOptions.slice();
25
+ if (config.icons) {
26
+ content.push({
27
+ render: function render(completion) {
28
+ var icon = document.createElement('div');
29
+ icon.classList.add('cm-completionIcon');
30
+ if (completion.type) {
31
+ var _icon$classList;
32
+ (_icon$classList = icon.classList).add.apply(_icon$classList, _toConsumableArray(completion.type.split(/\s+/g).map(function (cls) {
33
+ return 'cm-completionIcon-' + cls;
34
+ })));
35
+ }
36
+ icon.setAttribute('aria-hidden', 'true');
37
+ return icon;
38
+ },
39
+ position: 20
40
+ });
41
+ }
42
+ content.push({
43
+ render: function render(completion, _s, match) {
44
+ var labelElt = document.createElement('span');
45
+ labelElt.className = 'cm-completionLabel';
46
+ var label = completion.label,
47
+ off = 0;
48
+ for (var j = 1; j < match.length;) {
49
+ var from = match[j++],
50
+ to = match[j++];
51
+ if (from > off) {
52
+ labelElt.appendChild(document.createTextNode(label.slice(off, from)));
53
+ }
54
+ var span = labelElt.appendChild(document.createElement('span'));
55
+ span.appendChild(document.createTextNode(label.slice(from, to)));
56
+ span.className = 'cm-completionMatchedText';
57
+ off = to;
58
+ }
59
+ if (off < label.length) {
60
+ labelElt.appendChild(document.createTextNode(label.slice(off)));
61
+ }
62
+ return labelElt;
63
+ },
64
+ position: 50
65
+ }, {
66
+ render: function render(completion) {
67
+ if (!completion.detail) {
68
+ return null;
69
+ }
70
+ var detailElt = document.createElement('span');
71
+ detailElt.className = 'cm-completionDetail';
72
+ detailElt.textContent = completion.detail;
73
+ return detailElt;
74
+ },
75
+ position: 80
76
+ });
77
+ return content.sort(function (a, b) {
78
+ return a.position - b.position;
79
+ }).map(function (a) {
80
+ return a.render;
81
+ });
82
+ }
83
+ function rangeAroundSelected(total, selected, max) {
84
+ if (total <= max) {
85
+ return {
86
+ from: 0,
87
+ to: total
88
+ };
89
+ }
90
+ if (selected < 0) {
91
+ selected = 0;
92
+ }
93
+ if (selected <= total >> 1) {
94
+ var _off = Math.floor(selected / max);
95
+ return {
96
+ from: _off * max,
97
+ to: (_off + 1) * max
98
+ };
99
+ }
100
+ var off = Math.floor((total - selected) / max);
101
+ return {
102
+ from: total - (off + 1) * max,
103
+ to: total - off * max
104
+ };
105
+ }
106
+ var CompletionTooltip = /*#__PURE__*/function () {
107
+ function CompletionTooltip(view, stateField) {
108
+ var _this = this;
109
+ _classCallCheck(this, CompletionTooltip);
110
+ this.view = view;
111
+ this.stateField = stateField;
112
+ this.info = null;
113
+ this.placeInfo = {
114
+ read: function read() {
115
+ return _this.measureInfo();
116
+ },
117
+ write: function write(pos) {
118
+ return _this.positionInfo(pos);
119
+ },
120
+ key: this
121
+ };
122
+ var cState = view.state.field(stateField);
123
+ var _ref = cState.open,
124
+ options = _ref.options,
125
+ selected = _ref.selected;
126
+ var config = view.state.facet(completionConfig);
127
+ this.optionContent = optionContent(config);
128
+ this.optionClass = config.optionClass;
129
+ this.range = rangeAroundSelected(options.length, selected, config.maxRenderedOptions);
130
+ this.dom = document.createElement('div');
131
+ this.dom.className = 'cm-tooltip-autocomplete';
132
+ this.dom.addEventListener('mousedown', function (e) {
133
+ for (var dom = e.target, _match; dom && dom !== _this.dom; dom = dom.parentNode) {
134
+ if (dom.nodeName === 'LI' && (_match = /-(\d+)$/.exec(dom.id)) && +_match[1] < options.length) {
135
+ applyCompletion(view, options[+_match[1]]);
136
+ e.preventDefault();
137
+ return;
138
+ }
139
+ }
140
+ });
141
+ this.list = this.dom.appendChild(this.createListBox(options, cState.id, this.range));
142
+ this.list.addEventListener('scroll', function () {
143
+ if (_this.info) {
144
+ _this.view.requestMeasure(_this.placeInfo);
145
+ }
146
+ });
147
+ }
148
+ _createClass(CompletionTooltip, [{
149
+ key: "mount",
150
+ value: function mount() {
151
+ this.updateSel();
152
+ }
153
+ }, {
154
+ key: "update",
155
+ value: function update(_update) {
156
+ if (_update.state.field(this.stateField) !== _update.startState.field(this.stateField)) {
157
+ this.updateSel();
158
+ }
159
+ }
160
+ }, {
161
+ key: "positioned",
162
+ value: function positioned() {
163
+ if (this.info) {
164
+ this.view.requestMeasure(this.placeInfo);
165
+ }
166
+ }
167
+ }, {
168
+ key: "updateSel",
169
+ value: function updateSel() {
170
+ var _this2 = this;
171
+ var cState = this.view.state.field(this.stateField),
172
+ open = cState.open;
173
+ if (open.selected > -1 && open.selected < this.range.from || open.selected >= this.range.to) {
174
+ this.range = rangeAroundSelected(open.options.length, open.selected, this.view.state.facet(completionConfig).maxRenderedOptions);
175
+ this.list.remove();
176
+ this.list = this.dom.appendChild(this.createListBox(open.options, cState.id, this.range));
177
+ this.list.addEventListener('scroll', function () {
178
+ if (_this2.info) {
179
+ _this2.view.requestMeasure(_this2.placeInfo);
180
+ }
181
+ });
182
+ }
183
+ if (this.updateSelectedOption(open.selected)) {
184
+ if (this.info) {
185
+ this.info.remove();
186
+ this.info = null;
187
+ }
188
+ var _completion = open.options[open.selected].completion;
189
+ var info = _completion.info;
190
+ if (!info) {
191
+ return;
192
+ }
193
+ var infoResult = typeof info === 'string' ? document.createTextNode(info) : info(_completion);
194
+ if (!infoResult) {
195
+ return;
196
+ }
197
+ if ('then' in infoResult) {
198
+ infoResult.then(function (node) {
199
+ if (node && _this2.view.state.field(_this2.stateField, false) === cState) {
200
+ return _this2.addInfoPane(node);
201
+ }
202
+ return undefined;
203
+ }).catch(function (e) {
204
+ return logException(_this2.view.state, e, 'completion info');
205
+ });
206
+ } else {
207
+ this.addInfoPane(infoResult);
208
+ }
209
+ }
210
+ }
211
+ }, {
212
+ key: "addInfoPane",
213
+ value: function addInfoPane(content) {
214
+ var dom = this.info = document.createElement('div');
215
+ dom.className = 'cm-tooltip cm-completionInfo';
216
+ dom.appendChild(content);
217
+ this.dom.appendChild(dom);
218
+ this.view.requestMeasure(this.placeInfo);
219
+ }
220
+ }, {
221
+ key: "updateSelectedOption",
222
+ value: function updateSelectedOption(selected) {
223
+ var set = null;
224
+ for (var opt = this.list.firstChild, i = this.range.from; opt; opt = opt.nextSibling, i++) {
225
+ if (i === selected) {
226
+ if (!opt.hasAttribute('aria-selected')) {
227
+ opt.setAttribute('aria-selected', 'true');
228
+ set = opt;
229
+ }
230
+ } else {
231
+ if (opt.hasAttribute('aria-selected')) {
232
+ opt.removeAttribute('aria-selected');
233
+ }
234
+ }
235
+ }
236
+ if (set) {
237
+ scrollIntoView(this.list, set);
238
+ }
239
+ return set;
240
+ }
241
+ }, {
242
+ key: "measureInfo",
243
+ value: function measureInfo() {
244
+ var sel = this.dom.querySelector('[aria-selected]');
245
+ if (!sel || !this.info) {
246
+ return null;
247
+ }
248
+ var win = this.dom.ownerDocument.defaultView || window;
249
+ var listRect = this.dom.getBoundingClientRect();
250
+ var infoRect = this.info.getBoundingClientRect();
251
+ var selRect = sel.getBoundingClientRect();
252
+ if (selRect.top > Math.min(win.innerHeight, listRect.bottom) - 10 || selRect.bottom < Math.max(0, listRect.top) + 10) {
253
+ return null;
254
+ }
255
+ var rtl = this.view.textDirection === Direction.RTL,
256
+ left = rtl,
257
+ narrow = false,
258
+ maxWidth;
259
+ var top = '',
260
+ bottom = '';
261
+ var spaceLeft = listRect.left,
262
+ spaceRight = win.innerWidth - listRect.right;
263
+ if (left && spaceLeft < Math.min(infoRect.width, spaceRight)) {
264
+ left = false;
265
+ } else if (!left && spaceRight < Math.min(infoRect.width, spaceLeft)) {
266
+ left = true;
267
+ }
268
+ if (infoRect.width <= (left ? spaceLeft : spaceRight)) {
269
+ top = Math.max(0, Math.min(selRect.top, win.innerHeight - infoRect.height)) - listRect.top + 'px';
270
+ maxWidth = Math.min(Info.Width, left ? spaceLeft : spaceRight) + 'px';
271
+ } else {
272
+ narrow = true;
273
+ maxWidth = Math.min(Info.Width, (rtl ? listRect.right : win.innerWidth - listRect.left) - Info.Margin) + 'px';
274
+ var spaceBelow = win.innerHeight - listRect.bottom;
275
+ if (spaceBelow >= infoRect.height || spaceBelow > listRect.top) {
276
+ // Below the completion
277
+ top = selRect.bottom - listRect.top + 'px';
278
+ }
279
+ // Above it
280
+ else {
281
+ bottom = listRect.bottom - selRect.top + 'px';
282
+ }
283
+ }
284
+ return {
285
+ top: top,
286
+ bottom: bottom,
287
+ maxWidth: maxWidth,
288
+ class: narrow ? rtl ? 'left-narrow' : 'right-narrow' : left ? 'left' : 'right'
289
+ };
290
+ }
291
+ }, {
292
+ key: "positionInfo",
293
+ value: function positionInfo(pos) {
294
+ if (this.info) {
295
+ if (pos) {
296
+ this.info.style.top = pos.top;
297
+ this.info.style.bottom = pos.bottom;
298
+ this.info.style.maxWidth = pos.maxWidth;
299
+ this.info.className = 'cm-tooltip cm-completionInfo cm-completionInfo-' + pos.class;
300
+ } else {
301
+ this.info.style.top = '-1e6px';
302
+ }
303
+ }
304
+ }
305
+ }, {
306
+ key: "createListBox",
307
+ value: function createListBox(options, id, range) {
308
+ var ul = document.createElement('ul');
309
+ ul.id = id;
310
+ ul.setAttribute('role', 'listbox');
311
+ ul.setAttribute('aria-expanded', 'true');
312
+ ul.setAttribute('aria-label', this.view.state.phrase('Completions'));
313
+ for (var i = range.from; i < range.to; i++) {
314
+ var _options$i = options[i],
315
+ _completion2 = _options$i.completion,
316
+ _match2 = _options$i.match;
317
+ var li = ul.appendChild(document.createElement('li'));
318
+ li.id = id + '-' + i;
319
+ li.setAttribute('role', 'option');
320
+ var cls = this.optionClass(_completion2);
321
+ if (cls) {
322
+ li.className = cls;
323
+ }
324
+ var _iterator = _createForOfIteratorHelper(this.optionContent),
325
+ _step;
326
+ try {
327
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
328
+ var source = _step.value;
329
+ var node = source(_completion2, this.view.state, _match2);
330
+ if (node) {
331
+ li.appendChild(node);
332
+ }
333
+ }
334
+ } catch (err) {
335
+ _iterator.e(err);
336
+ } finally {
337
+ _iterator.f();
338
+ }
339
+ }
340
+ if (range.from) {
341
+ ul.classList.add('cm-completionListIncompleteTop');
342
+ }
343
+ if (range.to < options.length) {
344
+ ul.classList.add('cm-completionListIncompleteBottom');
345
+ }
346
+ return ul;
347
+ }
348
+ }]);
349
+ return CompletionTooltip;
350
+ }(); // We allocate a new function instance every time the completion
351
+ // changes to force redrawing/repositioning of the tooltip
352
+ export function completionTooltip(stateField) {
353
+ return function (view) {
354
+ return new CompletionTooltip(view, stateField);
355
+ };
356
+ }
357
+ function scrollIntoView(container, element) {
358
+ var parent = container.getBoundingClientRect();
359
+ var self = element.getBoundingClientRect();
360
+ if (self.top < parent.top) {
361
+ container.scrollTop -= parent.top - self.top;
362
+ } else if (self.bottom > parent.bottom) {
363
+ container.scrollTop += self.bottom - parent.bottom;
364
+ }
365
+ }
@@ -0,0 +1,43 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ /// <reference types="node" resolution-mode="require"/>
3
+ /// <reference types="node" resolution-mode="require"/>
4
+ /// <reference types="node" resolution-mode="require"/>
5
+ /// <reference types="node" resolution-mode="require"/>
6
+ import type { Transaction } from '@codemirror/state';
7
+ import type { EditorView, Command, ViewUpdate } from '@codemirror/view';
8
+ import { ViewPlugin } from '@codemirror/view';
9
+ import type { CompletionResult } from './completion.js';
10
+ import { CompletionContext } from './completion.js';
11
+ import { ActiveSource } from './state.js';
12
+ export declare function moveCompletionSelection(forward: boolean, by?: 'option' | 'page'): Command;
13
+ export declare const acceptCompletion: Command;
14
+ export declare const startCompletion: Command;
15
+ export declare const closeCompletion: Command;
16
+ declare class RunningQuery {
17
+ readonly active: ActiveSource;
18
+ readonly context: CompletionContext;
19
+ time: number;
20
+ updates: Transaction[];
21
+ done: undefined | CompletionResult | null;
22
+ constructor(active: ActiveSource, context: CompletionContext);
23
+ }
24
+ declare const enum CompositionState {
25
+ None = 0,
26
+ Started = 1,
27
+ Changed = 2,
28
+ ChangedAndMoved = 3
29
+ }
30
+ export declare const completionPlugin: ViewPlugin<{
31
+ debounceUpdate: NodeJS.Timeout | -1;
32
+ running: RunningQuery[];
33
+ debounceAccept: NodeJS.Timeout | -1;
34
+ composing: CompositionState;
35
+ readonly view: EditorView;
36
+ update(update: ViewUpdate): void;
37
+ startUpdate(): void;
38
+ startQuery(active: ActiveSource): void;
39
+ scheduleAccept(): void;
40
+ accept(): void;
41
+ }>;
42
+ export {};
43
+ //# sourceMappingURL=view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/auto-complete/view.ts"],"names":[],"mappings":";;;;;AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EACV,UAAU,EACV,OAAO,EAEP,UAAU,EAEX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAA4B,MAAM,kBAAkB,CAAC;AAExE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAO,iBAAiB,EAAmB,MAAM,iBAAiB,CAAC;AAE1E,OAAO,EAOL,YAAY,EAGb,MAAM,YAAY,CAAC;AAIpB,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,EAAE,GAAE,QAAQ,GAAG,MAAiB,GAC/B,OAAO,CAqCT;AAGD,eAAO,MAAM,gBAAgB,EAAE,OAc9B,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,OAO7B,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,OAO7B,CAAC;AAEF,cAAM,YAAY;IAQd,QAAQ,CAAC,MAAM,EAAE,YAAY;IAC7B,QAAQ,CAAC,OAAO,EAAE,iBAAiB;IARrC,IAAI,SAAc;IAClB,OAAO,EAAE,WAAW,EAAE,CAAM;IAG5B,IAAI,EAAE,SAAS,GAAG,gBAAgB,GAAG,IAAI,CAAa;gBAG3C,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,iBAAiB;CAEtC;AAMD,mBAAW,gBAAgB;IACzB,IAAI,IAAA;IACJ,OAAO,IAAA;IACP,OAAO,IAAA;IACP,eAAe,IAAA;CAChB;AAED,eAAO,MAAM,gBAAgB;oBAET,OAAO,OAAO,GAAG,CAAC,CAAC;aAC1B,YAAY,EAAE;oBACP,OAAO,OAAO,GAAG,CAAC,CAAC;;mBAGR,UAAU;mBAQtB,UAAU;;uBAsEN,YAAY;;;EA6HlC,CAAC"}