yks-element 1.5.2 → 1.5.4

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 (33) hide show
  1. package/lib/019e34e85139cfc611bf23efa096c980.js +18 -0
  2. package/lib/07567125b93045706d81f17f7d04e262.js +120 -0
  3. package/lib/0d56a1f26e052a1bafd10a87782fc74b.js +3380 -0
  4. package/lib/27846e85433e54a3ec0ab34d62233dc5.js +186 -0
  5. package/lib/2f25a4dc442bc9aebc58cae30c50c3e2.js +192 -0
  6. package/lib/2f55cddc8eb85b63ee5b4ce0e5488230.js +67 -0
  7. package/lib/2fe2904fc024afaf81732563cb83e547.js +116 -0
  8. package/lib/3b02cca9e95276a74f3ed2bbc7a64ce6.js +409 -0
  9. package/lib/70efbabef77fb217f904f41dbf7fe8bf.js +380 -0
  10. package/lib/7cec85e554cfaf2464511da505025098.js +74 -0
  11. package/lib/852f0ecd7b17e3bfd700a821ff438f7e.js +330 -0
  12. package/lib/88730abfeb4a23e692ac7933882f12eb.js +255 -0
  13. package/lib/8b8336037f074d9dcbd20eab535b803f.js +227 -0
  14. package/lib/9979f39c4d2773e02151a6cf1558101b.js +768 -0
  15. package/lib/af6e31c060c273848b5fec9fdba8814d.js +3066 -0
  16. package/lib/babd8df6809ef43238f1b280c2cebfe3.js +265 -0
  17. package/lib/bb1365c0983ce5ad50060b24788b9630.js +459 -0
  18. package/lib/c0a8aa1d5e0611259e47c2008cb203ee.js +197 -0
  19. package/lib/c530988d2b1966fd10a4d99fa3877e1b.js +9 -0
  20. package/lib/c8acc93023012737a3bf8fb767b66838.js +1293 -0
  21. package/lib/d0415105402964718010284fcfa8b2ea.js +48 -0
  22. package/lib/d11ab4aa7dd9123fdecb075ff5c5a748.js +790 -0
  23. package/lib/d1907231dc06c32481fefd6d47da973b.js +344 -0
  24. package/lib/d429602e0ebf3c1ec040e070e9b05b9b.js +184 -0
  25. package/lib/e4fc956693373117f057fe9914e983fc.js +7090 -0
  26. package/lib/f15362a7feef894b2e7f706252e6c510.js +45 -0
  27. package/lib/f666b5647087bcfdf6623f8b14d56657.js +136 -0
  28. package/lib/fac0ce75e0690947a9e9e6f5b35c1ea8.js +1067 -0
  29. package/lib/fec23c6964d6cf25681d1f3e24b076a4.js +56 -0
  30. package/lib/yks.js +1 -1
  31. package/package.json +1 -1
  32. package/lib/6c6d192b6860b4508a14c2d04769a35e.js +0 -15404
  33. package/lib/c3832579be376308fa819b04e7b0c66f.js +0 -3788
@@ -0,0 +1,459 @@
1
+ ace.define("ace/ext/command_bar",["require","exports","module","ace/tooltip","ace/lib/event_emitter","ace/lib/lang","ace/lib/dom","ace/lib/oop","ace/lib/useragent"], function(require, exports, module){var __values = (this && this.__values) || function(o) {
2
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
+ if (m) return m.call(o);
4
+ if (o && typeof o.length === "number") return {
5
+ next: function () {
6
+ if (o && i >= o.length) o = void 0;
7
+ return { value: o && o[i++], done: !o };
8
+ }
9
+ };
10
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
+ };
12
+ var Tooltip = require("../tooltip").Tooltip;
13
+ var EventEmitter = require("../lib/event_emitter").EventEmitter;
14
+ var lang = require("../lib/lang");
15
+ var dom = require("../lib/dom");
16
+ var oop = require("../lib/oop");
17
+ var useragent = require("../lib/useragent");
18
+ var BUTTON_CLASS_NAME = 'command_bar_tooltip_button';
19
+ var VALUE_CLASS_NAME = 'command_bar_button_value';
20
+ var CAPTION_CLASS_NAME = 'command_bar_button_caption';
21
+ var KEYBINDING_CLASS_NAME = 'command_bar_keybinding';
22
+ var TOOLTIP_CLASS_NAME = 'command_bar_tooltip';
23
+ var MORE_OPTIONS_BUTTON_ID = 'MoreOptionsButton';
24
+ var defaultDelay = 100;
25
+ var defaultMaxElements = 4;
26
+ var minPosition = function (posA, posB) {
27
+ if (posB.row > posA.row) {
28
+ return posA;
29
+ }
30
+ else if (posB.row === posA.row && posB.column > posA.column) {
31
+ return posA;
32
+ }
33
+ return posB;
34
+ };
35
+ var keyDisplayMap = {
36
+ "Ctrl": { mac: "^" },
37
+ "Option": { mac: "⌥" },
38
+ "Command": { mac: "⌘" },
39
+ "Cmd": { mac: "⌘" },
40
+ "Shift": "⇧",
41
+ "Left": "←",
42
+ "Right": "→",
43
+ "Up": "↑",
44
+ "Down": "↓"
45
+ };
46
+ var CommandBarTooltip = /** @class */ (function () {
47
+ function CommandBarTooltip(parentNode, options) {
48
+ var e_1, _a;
49
+ options = options || {};
50
+ this.parentNode = parentNode;
51
+ this.tooltip = new Tooltip(this.parentNode);
52
+ this.moreOptions = new Tooltip(this.parentNode);
53
+ this.maxElementsOnTooltip = options.maxElementsOnTooltip || defaultMaxElements;
54
+ this.$alwaysShow = options.alwaysShow || false;
55
+ this.eventListeners = {};
56
+ this.elements = {};
57
+ this.commands = {};
58
+ this.tooltipEl = dom.buildDom(['div', { class: TOOLTIP_CLASS_NAME }], this.tooltip.getElement());
59
+ this.moreOptionsEl = dom.buildDom(['div', { class: TOOLTIP_CLASS_NAME + " tooltip_more_options" }], this.moreOptions.getElement());
60
+ this.$showTooltipTimer = lang.delayedCall(this.$showTooltip.bind(this), options.showDelay || defaultDelay);
61
+ this.$hideTooltipTimer = lang.delayedCall(this.$hideTooltip.bind(this), options.hideDelay || defaultDelay);
62
+ this.$tooltipEnter = this.$tooltipEnter.bind(this);
63
+ this.$onMouseMove = this.$onMouseMove.bind(this);
64
+ this.$onChangeScroll = this.$onChangeScroll.bind(this);
65
+ this.$onEditorChangeSession = this.$onEditorChangeSession.bind(this);
66
+ this.$scheduleTooltipForHide = this.$scheduleTooltipForHide.bind(this);
67
+ this.$preventMouseEvent = this.$preventMouseEvent.bind(this);
68
+ try {
69
+ for (var _b = __values(["mousedown", "mouseup", "click"]), _c = _b.next(); !_c.done; _c = _b.next()) {
70
+ var event = _c.value;
71
+ this.tooltip.getElement().addEventListener(event, this.$preventMouseEvent);
72
+ this.moreOptions.getElement().addEventListener(event, this.$preventMouseEvent);
73
+ }
74
+ }
75
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
76
+ finally {
77
+ try {
78
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
79
+ }
80
+ finally { if (e_1) throw e_1.error; }
81
+ }
82
+ }
83
+ CommandBarTooltip.prototype.registerCommand = function (id, command) {
84
+ var registerForMainTooltip = Object.keys(this.commands).length < this.maxElementsOnTooltip;
85
+ if (!registerForMainTooltip && !this.elements[MORE_OPTIONS_BUTTON_ID]) {
86
+ this.$createCommand(MORE_OPTIONS_BUTTON_ID, {
87
+ name: "···",
88
+ exec:
89
+ function () {
90
+ this.$shouldHideMoreOptions = false;
91
+ this.$setMoreOptionsVisibility(!this.isMoreOptionsShown());
92
+ }.bind(this),
93
+ type: "checkbox",
94
+ getValue: function () {
95
+ return this.isMoreOptionsShown();
96
+ }.bind(this),
97
+ enabled: true
98
+ }, true);
99
+ }
100
+ this.$createCommand(id, command, registerForMainTooltip);
101
+ if (this.isShown()) {
102
+ this.updatePosition();
103
+ }
104
+ };
105
+ CommandBarTooltip.prototype.isShown = function () {
106
+ return !!this.tooltip && this.tooltip.isOpen;
107
+ };
108
+ CommandBarTooltip.prototype.isMoreOptionsShown = function () {
109
+ return !!this.moreOptions && this.moreOptions.isOpen;
110
+ };
111
+ CommandBarTooltip.prototype.getAlwaysShow = function () {
112
+ return this.$alwaysShow;
113
+ };
114
+ CommandBarTooltip.prototype.setAlwaysShow = function (alwaysShow) {
115
+ this.$alwaysShow = alwaysShow;
116
+ this.$updateOnHoverHandlers(!this.$alwaysShow);
117
+ this._signal("alwaysShow", this.$alwaysShow);
118
+ };
119
+ CommandBarTooltip.prototype.attach = function (editor) {
120
+ if (!editor || (this.isShown() && this.editor === editor)) {
121
+ return;
122
+ }
123
+ this.detach();
124
+ this.editor = editor;
125
+ this.editor.on("changeSession", this.$onEditorChangeSession);
126
+ if (this.editor.session) {
127
+ this.editor.session.on("changeScrollLeft", this.$onChangeScroll);
128
+ this.editor.session.on("changeScrollTop", this.$onChangeScroll);
129
+ }
130
+ if (this.getAlwaysShow()) {
131
+ this.$showTooltip();
132
+ }
133
+ else {
134
+ this.$updateOnHoverHandlers(true);
135
+ }
136
+ };
137
+ CommandBarTooltip.prototype.updatePosition = function () {
138
+ if (!this.editor) {
139
+ return;
140
+ }
141
+ var renderer = this.editor.renderer;
142
+ var ranges;
143
+ if (this.editor.selection.getAllRanges) {
144
+ ranges = this.editor.selection.getAllRanges();
145
+ }
146
+ else {
147
+ ranges = [this.editor.getSelectionRange()];
148
+ }
149
+ if (!ranges.length) {
150
+ return;
151
+ }
152
+ var minPos = minPosition(ranges[0].start, ranges[0].end);
153
+ for (var i = 0, range; range = ranges[i]; i++) {
154
+ minPos = minPosition(minPos, minPosition(range.start, range.end));
155
+ }
156
+ var pos = renderer.$cursorLayer.getPixelPosition(minPos, true);
157
+ var tooltipEl = this.tooltip.getElement();
158
+ var screenWidth = window.innerWidth;
159
+ var screenHeight = window.innerHeight;
160
+ var rect = this.editor.container.getBoundingClientRect();
161
+ pos.top += rect.top - renderer.layerConfig.offset;
162
+ pos.left += rect.left + renderer.gutterWidth - renderer.scrollLeft;
163
+ var cursorVisible = pos.top >= rect.top && pos.top <= rect.bottom &&
164
+ pos.left >= rect.left + renderer.gutterWidth && pos.left <= rect.right;
165
+ if (!cursorVisible && this.isShown()) {
166
+ this.$hideTooltip();
167
+ return;
168
+ }
169
+ else if (cursorVisible && !this.isShown() && this.getAlwaysShow()) {
170
+ this.$showTooltip();
171
+ return;
172
+ }
173
+ var top = pos.top - tooltipEl.offsetHeight;
174
+ var left = Math.min(screenWidth - tooltipEl.offsetWidth, pos.left);
175
+ var tooltipFits = top >= 0 && top + tooltipEl.offsetHeight <= screenHeight &&
176
+ left >= 0 && left + tooltipEl.offsetWidth <= screenWidth;
177
+ if (!tooltipFits) {
178
+ this.$hideTooltip();
179
+ return;
180
+ }
181
+ this.tooltip.setPosition(left, top);
182
+ if (this.isMoreOptionsShown()) {
183
+ top = top + tooltipEl.offsetHeight;
184
+ left = this.elements[MORE_OPTIONS_BUTTON_ID].getBoundingClientRect().left;
185
+ var moreOptionsEl = this.moreOptions.getElement();
186
+ var screenHeight = window.innerHeight;
187
+ if (top + moreOptionsEl.offsetHeight > screenHeight) {
188
+ top -= tooltipEl.offsetHeight + moreOptionsEl.offsetHeight;
189
+ }
190
+ if (left + moreOptionsEl.offsetWidth > screenWidth) {
191
+ left = screenWidth - moreOptionsEl.offsetWidth;
192
+ }
193
+ this.moreOptions.setPosition(left, top);
194
+ }
195
+ };
196
+ CommandBarTooltip.prototype.update = function () {
197
+ Object.keys(this.elements).forEach(this.$updateElement.bind(this));
198
+ };
199
+ CommandBarTooltip.prototype.detach = function () {
200
+ this.tooltip.hide();
201
+ this.moreOptions.hide();
202
+ this.$updateOnHoverHandlers(false);
203
+ if (this.editor) {
204
+ this.editor.off("changeSession", this.$onEditorChangeSession);
205
+ if (this.editor.session) {
206
+ this.editor.session.off("changeScrollLeft", this.$onChangeScroll);
207
+ this.editor.session.off("changeScrollTop", this.$onChangeScroll);
208
+ }
209
+ }
210
+ this.$mouseInTooltip = false;
211
+ this.editor = null;
212
+ };
213
+ CommandBarTooltip.prototype.destroy = function () {
214
+ if (this.tooltip && this.moreOptions) {
215
+ this.detach();
216
+ this.tooltip.destroy();
217
+ this.moreOptions.destroy();
218
+ }
219
+ this.eventListeners = {};
220
+ this.commands = {};
221
+ this.elements = {};
222
+ this.tooltip = this.moreOptions = this.parentNode = null;
223
+ };
224
+ CommandBarTooltip.prototype.$createCommand = function (id, command, forMainTooltip) {
225
+ var parentEl = forMainTooltip ? this.tooltipEl : this.moreOptionsEl;
226
+ var keyParts = [];
227
+ var bindKey = command.bindKey;
228
+ if (bindKey) {
229
+ if (typeof bindKey === 'object') {
230
+ bindKey = useragent.isMac ? bindKey.mac : bindKey.win;
231
+ }
232
+ bindKey = bindKey.split("|")[0];
233
+ keyParts = bindKey.split("-");
234
+ keyParts = keyParts.map(function (key) {
235
+ if (keyDisplayMap[key]) {
236
+ if (typeof keyDisplayMap[key] === 'string') {
237
+ return keyDisplayMap[key];
238
+ }
239
+ else if (useragent.isMac && keyDisplayMap[key].mac) {
240
+ return keyDisplayMap[key].mac;
241
+ }
242
+ }
243
+ return key;
244
+ });
245
+ }
246
+ var buttonNode;
247
+ if (forMainTooltip && command.iconCssClass) {
248
+ buttonNode = [
249
+ 'div',
250
+ {
251
+ class: ["ace_icon_svg", command.iconCssClass].join(" "),
252
+ "aria-label": command.name + " (" + command.bindKey + ")"
253
+ }
254
+ ];
255
+ }
256
+ else {
257
+ buttonNode = [
258
+ ['div', { class: VALUE_CLASS_NAME }],
259
+ ['div', { class: CAPTION_CLASS_NAME }, command.name]
260
+ ];
261
+ if (keyParts.length) {
262
+ buttonNode.push([
263
+ 'div',
264
+ { class: KEYBINDING_CLASS_NAME },
265
+ keyParts.map(function (keyPart) {
266
+ return ['div', keyPart];
267
+ })
268
+ ]);
269
+ }
270
+ }
271
+ dom.buildDom(['div', { class: [BUTTON_CLASS_NAME, command.cssClass || ""].join(" "), ref: id }, buttonNode], parentEl, this.elements);
272
+ this.commands[id] = command;
273
+ var eventListener =
274
+ function (e) {
275
+ if (this.editor) {
276
+ this.editor.focus();
277
+ }
278
+ this.$shouldHideMoreOptions = this.isMoreOptionsShown();
279
+ if (!this.elements[id].disabled && command.exec) {
280
+ command.exec(this.editor);
281
+ }
282
+ if (this.$shouldHideMoreOptions) {
283
+ this.$setMoreOptionsVisibility(false);
284
+ }
285
+ this.update();
286
+ e.preventDefault();
287
+ }.bind(this);
288
+ this.eventListeners[id] = eventListener;
289
+ this.elements[id].addEventListener('click', eventListener.bind(this));
290
+ this.$updateElement(id);
291
+ };
292
+ CommandBarTooltip.prototype.$setMoreOptionsVisibility = function (visible) {
293
+ if (visible) {
294
+ this.moreOptions.setTheme(this.editor.renderer.theme);
295
+ this.moreOptions.setClassName(TOOLTIP_CLASS_NAME + "_wrapper");
296
+ this.moreOptions.show();
297
+ this.update();
298
+ this.updatePosition();
299
+ }
300
+ else {
301
+ this.moreOptions.hide();
302
+ }
303
+ };
304
+ CommandBarTooltip.prototype.$onEditorChangeSession = function (e) {
305
+ if (e.oldSession) {
306
+ e.oldSession.off("changeScrollTop", this.$onChangeScroll);
307
+ e.oldSession.off("changeScrollLeft", this.$onChangeScroll);
308
+ }
309
+ this.detach();
310
+ };
311
+ CommandBarTooltip.prototype.$onChangeScroll = function () {
312
+ if (this.editor.renderer && (this.isShown() || this.getAlwaysShow())) {
313
+ this.editor.renderer.once("afterRender", this.updatePosition.bind(this));
314
+ }
315
+ };
316
+ CommandBarTooltip.prototype.$onMouseMove = function (e) {
317
+ if (this.$mouseInTooltip) {
318
+ return;
319
+ }
320
+ var cursorPosition = this.editor.getCursorPosition();
321
+ var cursorScreenPosition = this.editor.renderer.textToScreenCoordinates(cursorPosition.row, cursorPosition.column);
322
+ var lineHeight = this.editor.renderer.lineHeight;
323
+ var isInCurrentLine = e.clientY >= cursorScreenPosition.pageY && e.clientY < cursorScreenPosition.pageY + lineHeight;
324
+ if (isInCurrentLine) {
325
+ if (!this.isShown() && !this.$showTooltipTimer.isPending()) {
326
+ this.$showTooltipTimer.delay();
327
+ }
328
+ if (this.$hideTooltipTimer.isPending()) {
329
+ this.$hideTooltipTimer.cancel();
330
+ }
331
+ }
332
+ else {
333
+ if (this.isShown() && !this.$hideTooltipTimer.isPending()) {
334
+ this.$hideTooltipTimer.delay();
335
+ }
336
+ if (this.$showTooltipTimer.isPending()) {
337
+ this.$showTooltipTimer.cancel();
338
+ }
339
+ }
340
+ };
341
+ CommandBarTooltip.prototype.$preventMouseEvent = function (e) {
342
+ if (this.editor) {
343
+ this.editor.focus();
344
+ }
345
+ e.preventDefault();
346
+ };
347
+ CommandBarTooltip.prototype.$scheduleTooltipForHide = function () {
348
+ this.$mouseInTooltip = false;
349
+ this.$showTooltipTimer.cancel();
350
+ this.$hideTooltipTimer.delay();
351
+ };
352
+ CommandBarTooltip.prototype.$tooltipEnter = function () {
353
+ this.$mouseInTooltip = true;
354
+ if (this.$showTooltipTimer.isPending()) {
355
+ this.$showTooltipTimer.cancel();
356
+ }
357
+ if (this.$hideTooltipTimer.isPending()) {
358
+ this.$hideTooltipTimer.cancel();
359
+ }
360
+ };
361
+ CommandBarTooltip.prototype.$updateOnHoverHandlers = function (enableHover) {
362
+ var tooltipEl = this.tooltip.getElement();
363
+ var moreOptionsEl = this.moreOptions.getElement();
364
+ if (enableHover) {
365
+ if (this.editor) {
366
+ this.editor.on("mousemove", this.$onMouseMove);
367
+ this.editor.renderer.getMouseEventTarget().addEventListener("mouseout", this.$scheduleTooltipForHide, true);
368
+ }
369
+ tooltipEl.addEventListener('mouseenter', this.$tooltipEnter);
370
+ tooltipEl.addEventListener('mouseleave', this.$scheduleTooltipForHide);
371
+ moreOptionsEl.addEventListener('mouseenter', this.$tooltipEnter);
372
+ moreOptionsEl.addEventListener('mouseleave', this.$scheduleTooltipForHide);
373
+ }
374
+ else {
375
+ if (this.editor) {
376
+ this.editor.off("mousemove", this.$onMouseMove);
377
+ this.editor.renderer.getMouseEventTarget().removeEventListener("mouseout", this.$scheduleTooltipForHide, true);
378
+ }
379
+ tooltipEl.removeEventListener('mouseenter', this.$tooltipEnter);
380
+ tooltipEl.removeEventListener('mouseleave', this.$scheduleTooltipForHide);
381
+ moreOptionsEl.removeEventListener('mouseenter', this.$tooltipEnter);
382
+ moreOptionsEl.removeEventListener('mouseleave', this.$scheduleTooltipForHide);
383
+ }
384
+ };
385
+ CommandBarTooltip.prototype.$showTooltip = function () {
386
+ if (this.isShown()) {
387
+ return;
388
+ }
389
+ this.tooltip.setTheme(this.editor.renderer.theme);
390
+ this.tooltip.setClassName(TOOLTIP_CLASS_NAME + "_wrapper");
391
+ this.tooltip.show();
392
+ this.update();
393
+ this.updatePosition();
394
+ this._signal("show");
395
+ };
396
+ CommandBarTooltip.prototype.$hideTooltip = function () {
397
+ this.$mouseInTooltip = false;
398
+ if (!this.isShown()) {
399
+ return;
400
+ }
401
+ this.moreOptions.hide();
402
+ this.tooltip.hide();
403
+ this._signal("hide");
404
+ };
405
+ CommandBarTooltip.prototype.$updateElement = function (id) {
406
+ var command = this.commands[id];
407
+ if (!command) {
408
+ return;
409
+ }
410
+ var el = this.elements[id];
411
+ var commandEnabled = command.enabled;
412
+ if (typeof commandEnabled === 'function') {
413
+ commandEnabled = commandEnabled(this.editor);
414
+ }
415
+ if (typeof command.getValue === 'function') {
416
+ var value = command.getValue(this.editor);
417
+ if (command.type === 'text') {
418
+ el.textContent = value;
419
+ }
420
+ else if (command.type === 'checkbox') {
421
+ var domCssFn = value ? dom.addCssClass : dom.removeCssClass;
422
+ var isOnTooltip = el.parentElement === this.tooltipEl;
423
+ el.ariaChecked = value;
424
+ if (isOnTooltip) {
425
+ domCssFn(el, "ace_selected");
426
+ }
427
+ else {
428
+ el = el.querySelector("." + VALUE_CLASS_NAME);
429
+ domCssFn(el, "ace_checkmark");
430
+ }
431
+ }
432
+ }
433
+ if (commandEnabled && el.disabled) {
434
+ dom.removeCssClass(el, "ace_disabled");
435
+ el.ariaDisabled = el.disabled = false;
436
+ el.removeAttribute("disabled");
437
+ }
438
+ else if (!commandEnabled && !el.disabled) {
439
+ dom.addCssClass(el, "ace_disabled");
440
+ el.ariaDisabled = el.disabled = true;
441
+ el.setAttribute("disabled", "");
442
+ }
443
+ };
444
+ return CommandBarTooltip;
445
+ }());
446
+ oop.implement(CommandBarTooltip.prototype, EventEmitter);
447
+ dom.importCssString("\n.ace_tooltip.".concat(TOOLTIP_CLASS_NAME, "_wrapper {\n padding: 0;\n}\n\n.ace_tooltip .").concat(TOOLTIP_CLASS_NAME, " {\n padding: 1px 5px;\n display: flex;\n pointer-events: auto;\n}\n\n.ace_tooltip .").concat(TOOLTIP_CLASS_NAME, ".tooltip_more_options {\n padding: 1px;\n flex-direction: column;\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, " {\n display: inline-flex;\n cursor: pointer;\n margin: 1px;\n border-radius: 2px;\n padding: 2px 5px;\n align-items: center;\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, ".ace_selected,\ndiv.").concat(BUTTON_CLASS_NAME, ":hover:not(.ace_disabled) {\n background-color: rgba(0, 0, 0, 0.1);\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, ".ace_disabled {\n color: #777;\n pointer-events: none;\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, " .ace_icon_svg {\n height: 12px;\n background-color: #000;\n}\n\ndiv.").concat(BUTTON_CLASS_NAME, ".ace_disabled .ace_icon_svg {\n background-color: #777;\n}\n\n.").concat(TOOLTIP_CLASS_NAME, ".tooltip_more_options .").concat(BUTTON_CLASS_NAME, " {\n display: flex;\n}\n\n.").concat(TOOLTIP_CLASS_NAME, ".").concat(VALUE_CLASS_NAME, " {\n display: none;\n}\n\n.").concat(TOOLTIP_CLASS_NAME, ".tooltip_more_options .").concat(VALUE_CLASS_NAME, " {\n display: inline-block;\n width: 12px;\n}\n\n.").concat(CAPTION_CLASS_NAME, " {\n display: inline-block;\n}\n\n.").concat(KEYBINDING_CLASS_NAME, " {\n margin: 0 2px;\n display: inline-block;\n font-size: 8px;\n}\n\n.").concat(TOOLTIP_CLASS_NAME, ".tooltip_more_options .").concat(KEYBINDING_CLASS_NAME, " {\n margin-left: auto;\n}\n\n.").concat(KEYBINDING_CLASS_NAME, " div {\n display: inline-block;\n min-width: 8px;\n padding: 2px;\n margin: 0 1px;\n border-radius: 2px;\n background-color: #ccc;\n text-align: center;\n}\n\n.ace_dark.ace_tooltip .").concat(TOOLTIP_CLASS_NAME, " {\n background-color: #373737;\n color: #eee;\n}\n\n.ace_dark div.").concat(BUTTON_CLASS_NAME, ".ace_disabled {\n color: #979797;\n}\n\n.ace_dark div.").concat(BUTTON_CLASS_NAME, ".ace_selected,\n.ace_dark div.").concat(BUTTON_CLASS_NAME, ":hover:not(.ace_disabled) {\n background-color: rgba(255, 255, 255, 0.1);\n}\n\n.ace_dark div.").concat(BUTTON_CLASS_NAME, " .ace_icon_svg {\n background-color: #eee;\n}\n\n.ace_dark div.").concat(BUTTON_CLASS_NAME, ".ace_disabled .ace_icon_svg {\n background-color: #979797;\n}\n\n.ace_dark .").concat(BUTTON_CLASS_NAME, ".ace_disabled {\n color: #979797;\n}\n\n.ace_dark .").concat(KEYBINDING_CLASS_NAME, " div {\n background-color: #575757;\n}\n\n.ace_checkmark::before {\n content: '\u2713';\n}\n"), "commandbar.css", false);
448
+ exports.CommandBarTooltip = CommandBarTooltip;
449
+ exports.TOOLTIP_CLASS_NAME = TOOLTIP_CLASS_NAME;
450
+ exports.BUTTON_CLASS_NAME = BUTTON_CLASS_NAME;
451
+
452
+ }); (function() {
453
+ ace.require(["ace/ext/command_bar"], function(m) {
454
+ if (typeof module == "object" && typeof exports == "object" && module) {
455
+ module.exports = m;
456
+ }
457
+ });
458
+ })();
459
+
@@ -0,0 +1,197 @@
1
+ ace.define("ace/ext/code_lens",["require","exports","module","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/editor","ace/config"], function(require, exports, module){"use strict";
2
+ var event = require("../lib/event");
3
+ var lang = require("../lib/lang");
4
+ var dom = require("../lib/dom");
5
+ function clearLensElements(renderer) {
6
+ var textLayer = renderer.$textLayer;
7
+ var lensElements = textLayer.$lenses;
8
+ if (lensElements)
9
+ lensElements.forEach(function (el) { el.remove(); });
10
+ textLayer.$lenses = null;
11
+ }
12
+ function renderWidgets(changes, renderer) {
13
+ var changed = changes & renderer.CHANGE_LINES
14
+ || changes & renderer.CHANGE_FULL
15
+ || changes & renderer.CHANGE_SCROLL
16
+ || changes & renderer.CHANGE_TEXT;
17
+ if (!changed)
18
+ return;
19
+ var session = renderer.session;
20
+ var lineWidgets = renderer.session.lineWidgets;
21
+ var textLayer = renderer.$textLayer;
22
+ var lensElements = textLayer.$lenses;
23
+ if (!lineWidgets) {
24
+ if (lensElements)
25
+ clearLensElements(renderer);
26
+ return;
27
+ }
28
+ var textCells = renderer.$textLayer.$lines.cells;
29
+ var config = renderer.layerConfig;
30
+ var padding = renderer.$padding;
31
+ if (!lensElements)
32
+ lensElements = textLayer.$lenses = [];
33
+ var index = 0;
34
+ for (var i = 0; i < textCells.length; i++) {
35
+ var row = textCells[i].row;
36
+ var widget = lineWidgets[row];
37
+ var lenses = widget && widget.lenses;
38
+ if (!lenses || !lenses.length)
39
+ continue;
40
+ var lensContainer = lensElements[index];
41
+ if (!lensContainer) {
42
+ lensContainer = lensElements[index]
43
+ = dom.buildDom(["div", { class: "ace_codeLens" }], renderer.container);
44
+ }
45
+ lensContainer.style.height = config.lineHeight + "px";
46
+ index++;
47
+ for (var j = 0; j < lenses.length; j++) {
48
+ var el = lensContainer.childNodes[2 * j];
49
+ if (!el) {
50
+ if (j != 0)
51
+ lensContainer.appendChild(dom.createTextNode("\xa0|\xa0"));
52
+ el = dom.buildDom(["a"], lensContainer);
53
+ }
54
+ el.textContent = lenses[j].title;
55
+ el.lensCommand = lenses[j];
56
+ }
57
+ while (lensContainer.childNodes.length > 2 * j - 1)
58
+ lensContainer.lastChild.remove();
59
+ var top = renderer.$cursorLayer.getPixelPosition({
60
+ row: row,
61
+ column: 0
62
+ }, true).top - config.lineHeight * widget.rowsAbove - config.offset;
63
+ lensContainer.style.top = top + "px";
64
+ var left = renderer.gutterWidth;
65
+ var indent = session.getLine(row).search(/\S|$/);
66
+ if (indent == -1)
67
+ indent = 0;
68
+ left += indent * config.characterWidth;
69
+ lensContainer.style.paddingLeft = padding + left + "px";
70
+ }
71
+ while (index < lensElements.length)
72
+ lensElements.pop().remove();
73
+ }
74
+ function clearCodeLensWidgets(session) {
75
+ if (!session.lineWidgets)
76
+ return;
77
+ var widgetManager = session.widgetManager;
78
+ session.lineWidgets.forEach(function (widget) {
79
+ if (widget && widget.lenses)
80
+ widgetManager.removeLineWidget(widget);
81
+ });
82
+ }
83
+ exports.setLenses = function (session, lenses) {
84
+ var firstRow = Number.MAX_VALUE;
85
+ clearCodeLensWidgets(session);
86
+ lenses && lenses.forEach(function (lens) {
87
+ var row = lens.start.row;
88
+ var column = lens.start.column;
89
+ var widget = session.lineWidgets && session.lineWidgets[row];
90
+ if (!widget || !widget.lenses) {
91
+ widget = session.widgetManager.$registerLineWidget({
92
+ rowCount: 1,
93
+ rowsAbove: 1,
94
+ row: row,
95
+ column: column,
96
+ lenses: []
97
+ });
98
+ }
99
+ widget.lenses.push(lens.command);
100
+ if (row < firstRow)
101
+ firstRow = row;
102
+ });
103
+ session._emit("changeFold", { data: { start: { row: firstRow } } });
104
+ return firstRow;
105
+ };
106
+ function attachToEditor(editor) {
107
+ editor.codeLensProviders = [];
108
+ editor.renderer.on("afterRender", renderWidgets);
109
+ if (!editor.$codeLensClickHandler) {
110
+ editor.$codeLensClickHandler = function (e) {
111
+ var command = e.target.lensCommand;
112
+ if (!command)
113
+ return;
114
+ editor.execCommand(command.id, command.arguments);
115
+ editor._emit("codeLensClick", e);
116
+ };
117
+ event.addListener(editor.container, "click", editor.$codeLensClickHandler, editor);
118
+ }
119
+ editor.$updateLenses = function () {
120
+ var session = editor.session;
121
+ if (!session)
122
+ return;
123
+ var providersToWaitNum = editor.codeLensProviders.length;
124
+ var lenses = [];
125
+ editor.codeLensProviders.forEach(function (provider) {
126
+ provider.provideCodeLenses(session, function (err, payload) {
127
+ if (err)
128
+ return;
129
+ payload.forEach(function (lens) {
130
+ lenses.push(lens);
131
+ });
132
+ providersToWaitNum--;
133
+ if (providersToWaitNum == 0) {
134
+ applyLenses();
135
+ }
136
+ });
137
+ });
138
+ function applyLenses() {
139
+ var cursor = session.selection.cursor;
140
+ var oldRow = session.documentToScreenRow(cursor);
141
+ var scrollTop = session.getScrollTop();
142
+ var firstRow = exports.setLenses(session, lenses);
143
+ var lastDelta = session.$undoManager && session.$undoManager.$lastDelta;
144
+ if (lastDelta && lastDelta.action == "remove" && lastDelta.lines.length > 1)
145
+ return;
146
+ var row = session.documentToScreenRow(cursor);
147
+ var lineHeight = editor.renderer.layerConfig.lineHeight;
148
+ var top = session.getScrollTop() + (row - oldRow) * lineHeight;
149
+ if (firstRow == 0 && scrollTop < lineHeight / 4 && scrollTop > -lineHeight / 4) {
150
+ top = -lineHeight;
151
+ }
152
+ session.setScrollTop(top);
153
+ }
154
+ };
155
+ var updateLenses = lang.delayedCall(editor.$updateLenses);
156
+ editor.$updateLensesOnInput = function () {
157
+ updateLenses.delay(250);
158
+ };
159
+ editor.on("input", editor.$updateLensesOnInput);
160
+ }
161
+ function detachFromEditor(editor) {
162
+ editor.off("input", editor.$updateLensesOnInput);
163
+ editor.renderer.off("afterRender", renderWidgets);
164
+ if (editor.$codeLensClickHandler)
165
+ editor.container.removeEventListener("click", editor.$codeLensClickHandler);
166
+ }
167
+ exports.registerCodeLensProvider = function (editor, codeLensProvider) {
168
+ editor.setOption("enableCodeLens", true);
169
+ editor.codeLensProviders.push(codeLensProvider);
170
+ editor.$updateLensesOnInput();
171
+ };
172
+ exports.clear = function (session) {
173
+ exports.setLenses(session, null);
174
+ };
175
+ var Editor = require("../editor").Editor;
176
+ require("../config").defineOptions(Editor.prototype, "editor", {
177
+ enableCodeLens: {
178
+ set: function (val) {
179
+ if (val) {
180
+ attachToEditor(this);
181
+ }
182
+ else {
183
+ detachFromEditor(this);
184
+ }
185
+ }
186
+ }
187
+ });
188
+ dom.importCssString("\n.ace_codeLens {\n position: absolute;\n color: #aaa;\n font-size: 88%;\n background: inherit;\n width: 100%;\n display: flex;\n align-items: flex-end;\n pointer-events: none;\n}\n.ace_codeLens > a {\n cursor: pointer;\n pointer-events: auto;\n}\n.ace_codeLens > a:hover {\n color: #0000ff;\n text-decoration: underline;\n}\n.ace_dark > .ace_codeLens > a:hover {\n color: #4e94ce;\n}\n", "codelense.css", false);
189
+
190
+ }); (function() {
191
+ ace.require(["ace/ext/code_lens"], function(m) {
192
+ if (typeof module == "object" && typeof exports == "object" && module) {
193
+ module.exports = m;
194
+ }
195
+ });
196
+ })();
197
+
@@ -0,0 +1,9 @@
1
+
2
+ ; (function() {
3
+ ace.require(["ace/ext/error_marker"], function(m) {
4
+ if (typeof module == "object" && typeof exports == "object" && module) {
5
+ module.exports = m;
6
+ }
7
+ });
8
+ })();
9
+