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.
- package/lib/019e34e85139cfc611bf23efa096c980.js +18 -0
- package/lib/07567125b93045706d81f17f7d04e262.js +120 -0
- package/lib/0d56a1f26e052a1bafd10a87782fc74b.js +3380 -0
- package/lib/27846e85433e54a3ec0ab34d62233dc5.js +186 -0
- package/lib/2f25a4dc442bc9aebc58cae30c50c3e2.js +192 -0
- package/lib/2f55cddc8eb85b63ee5b4ce0e5488230.js +67 -0
- package/lib/2fe2904fc024afaf81732563cb83e547.js +116 -0
- package/lib/3b02cca9e95276a74f3ed2bbc7a64ce6.js +409 -0
- package/lib/70efbabef77fb217f904f41dbf7fe8bf.js +380 -0
- package/lib/7cec85e554cfaf2464511da505025098.js +74 -0
- package/lib/852f0ecd7b17e3bfd700a821ff438f7e.js +330 -0
- package/lib/88730abfeb4a23e692ac7933882f12eb.js +255 -0
- package/lib/8b8336037f074d9dcbd20eab535b803f.js +227 -0
- package/lib/9979f39c4d2773e02151a6cf1558101b.js +768 -0
- package/lib/af6e31c060c273848b5fec9fdba8814d.js +3066 -0
- package/lib/babd8df6809ef43238f1b280c2cebfe3.js +265 -0
- package/lib/bb1365c0983ce5ad50060b24788b9630.js +459 -0
- package/lib/c0a8aa1d5e0611259e47c2008cb203ee.js +197 -0
- package/lib/c530988d2b1966fd10a4d99fa3877e1b.js +9 -0
- package/lib/c8acc93023012737a3bf8fb767b66838.js +1293 -0
- package/lib/d0415105402964718010284fcfa8b2ea.js +48 -0
- package/lib/d11ab4aa7dd9123fdecb075ff5c5a748.js +790 -0
- package/lib/d1907231dc06c32481fefd6d47da973b.js +344 -0
- package/lib/d429602e0ebf3c1ec040e070e9b05b9b.js +184 -0
- package/lib/e4fc956693373117f057fe9914e983fc.js +7090 -0
- package/lib/f15362a7feef894b2e7f706252e6c510.js +45 -0
- package/lib/f666b5647087bcfdf6623f8b14d56657.js +136 -0
- package/lib/fac0ce75e0690947a9e9e6f5b35c1ea8.js +1067 -0
- package/lib/fec23c6964d6cf25681d1f3e24b076a4.js +56 -0
- package/lib/yks.js +1 -1
- package/package.json +1 -1
- package/lib/6c6d192b6860b4508a14c2d04769a35e.js +0 -15404
- package/lib/c3832579be376308fa819b04e7b0c66f.js +0 -3788
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
ace.define("ace/ext/elastic_tabstops_lite",["require","exports","module","ace/editor","ace/config"], function(require, exports, module){"use strict";
|
|
2
|
+
var ElasticTabstopsLite = /** @class */ (function () {
|
|
3
|
+
function ElasticTabstopsLite(editor) {
|
|
4
|
+
this.$editor = editor;
|
|
5
|
+
var self = this;
|
|
6
|
+
var changedRows = [];
|
|
7
|
+
var recordChanges = false;
|
|
8
|
+
this.onAfterExec = function () {
|
|
9
|
+
recordChanges = false;
|
|
10
|
+
self.processRows(changedRows);
|
|
11
|
+
changedRows = [];
|
|
12
|
+
};
|
|
13
|
+
this.onExec = function () {
|
|
14
|
+
recordChanges = true;
|
|
15
|
+
};
|
|
16
|
+
this.onChange = function (delta) {
|
|
17
|
+
if (recordChanges) {
|
|
18
|
+
if (changedRows.indexOf(delta.start.row) == -1)
|
|
19
|
+
changedRows.push(delta.start.row);
|
|
20
|
+
if (delta.end.row != delta.start.row)
|
|
21
|
+
changedRows.push(delta.end.row);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
ElasticTabstopsLite.prototype.processRows = function (rows) {
|
|
26
|
+
this.$inChange = true;
|
|
27
|
+
var checkedRows = [];
|
|
28
|
+
for (var r = 0, rowCount = rows.length; r < rowCount; r++) {
|
|
29
|
+
var row = rows[r];
|
|
30
|
+
if (checkedRows.indexOf(row) > -1)
|
|
31
|
+
continue;
|
|
32
|
+
var cellWidthObj = this.$findCellWidthsForBlock(row);
|
|
33
|
+
var cellWidths = this.$setBlockCellWidthsToMax(cellWidthObj.cellWidths);
|
|
34
|
+
var rowIndex = cellWidthObj.firstRow;
|
|
35
|
+
for (var w = 0, l = cellWidths.length; w < l; w++) {
|
|
36
|
+
var widths = cellWidths[w];
|
|
37
|
+
checkedRows.push(rowIndex);
|
|
38
|
+
this.$adjustRow(rowIndex, widths);
|
|
39
|
+
rowIndex++;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
this.$inChange = false;
|
|
43
|
+
};
|
|
44
|
+
ElasticTabstopsLite.prototype.$findCellWidthsForBlock = function (row) {
|
|
45
|
+
var cellWidths = [], widths;
|
|
46
|
+
var rowIter = row;
|
|
47
|
+
while (rowIter >= 0) {
|
|
48
|
+
widths = this.$cellWidthsForRow(rowIter);
|
|
49
|
+
if (widths.length == 0)
|
|
50
|
+
break;
|
|
51
|
+
cellWidths.unshift(widths);
|
|
52
|
+
rowIter--;
|
|
53
|
+
}
|
|
54
|
+
var firstRow = rowIter + 1;
|
|
55
|
+
rowIter = row;
|
|
56
|
+
var numRows = this.$editor.session.getLength();
|
|
57
|
+
while (rowIter < numRows - 1) {
|
|
58
|
+
rowIter++;
|
|
59
|
+
widths = this.$cellWidthsForRow(rowIter);
|
|
60
|
+
if (widths.length == 0)
|
|
61
|
+
break;
|
|
62
|
+
cellWidths.push(widths);
|
|
63
|
+
}
|
|
64
|
+
return { cellWidths: cellWidths, firstRow: firstRow };
|
|
65
|
+
};
|
|
66
|
+
ElasticTabstopsLite.prototype.$cellWidthsForRow = function (row) {
|
|
67
|
+
var selectionColumns = this.$selectionColumnsForRow(row);
|
|
68
|
+
var tabs = [-1].concat(this.$tabsForRow(row));
|
|
69
|
+
var widths = tabs.map(function (el) { return 0; }).slice(1);
|
|
70
|
+
var line = this.$editor.session.getLine(row);
|
|
71
|
+
for (var i = 0, len = tabs.length - 1; i < len; i++) {
|
|
72
|
+
var leftEdge = tabs[i] + 1;
|
|
73
|
+
var rightEdge = tabs[i + 1];
|
|
74
|
+
var rightmostSelection = this.$rightmostSelectionInCell(selectionColumns, rightEdge);
|
|
75
|
+
var cell = line.substring(leftEdge, rightEdge);
|
|
76
|
+
widths[i] = Math.max(cell.replace(/\s+$/g, '').length, rightmostSelection - leftEdge);
|
|
77
|
+
}
|
|
78
|
+
return widths;
|
|
79
|
+
};
|
|
80
|
+
ElasticTabstopsLite.prototype.$selectionColumnsForRow = function (row) {
|
|
81
|
+
var selections = [], cursor = this.$editor.getCursorPosition();
|
|
82
|
+
if (this.$editor.session.getSelection().isEmpty()) {
|
|
83
|
+
if (row == cursor.row)
|
|
84
|
+
selections.push(cursor.column);
|
|
85
|
+
}
|
|
86
|
+
return selections;
|
|
87
|
+
};
|
|
88
|
+
ElasticTabstopsLite.prototype.$setBlockCellWidthsToMax = function (cellWidths) {
|
|
89
|
+
var startingNewBlock = true, blockStartRow, blockEndRow, maxWidth;
|
|
90
|
+
var columnInfo = this.$izip_longest(cellWidths);
|
|
91
|
+
for (var c = 0, l = columnInfo.length; c < l; c++) {
|
|
92
|
+
var column = columnInfo[c];
|
|
93
|
+
if (!column.push) {
|
|
94
|
+
console.error(column);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
column.push(NaN);
|
|
98
|
+
for (var r = 0, s = column.length; r < s; r++) {
|
|
99
|
+
var width = column[r];
|
|
100
|
+
if (startingNewBlock) {
|
|
101
|
+
blockStartRow = r;
|
|
102
|
+
maxWidth = 0;
|
|
103
|
+
startingNewBlock = false;
|
|
104
|
+
}
|
|
105
|
+
if (isNaN(width)) {
|
|
106
|
+
blockEndRow = r;
|
|
107
|
+
for (var j = blockStartRow; j < blockEndRow; j++) {
|
|
108
|
+
cellWidths[j][c] = maxWidth;
|
|
109
|
+
}
|
|
110
|
+
startingNewBlock = true;
|
|
111
|
+
}
|
|
112
|
+
maxWidth = Math.max(maxWidth, width);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return cellWidths;
|
|
116
|
+
};
|
|
117
|
+
ElasticTabstopsLite.prototype.$rightmostSelectionInCell = function (selectionColumns, cellRightEdge) {
|
|
118
|
+
var rightmost = 0;
|
|
119
|
+
if (selectionColumns.length) {
|
|
120
|
+
var lengths = [];
|
|
121
|
+
for (var s = 0, length = selectionColumns.length; s < length; s++) {
|
|
122
|
+
if (selectionColumns[s] <= cellRightEdge)
|
|
123
|
+
lengths.push(s);
|
|
124
|
+
else
|
|
125
|
+
lengths.push(0);
|
|
126
|
+
}
|
|
127
|
+
rightmost = Math.max.apply(Math, lengths);
|
|
128
|
+
}
|
|
129
|
+
return rightmost;
|
|
130
|
+
};
|
|
131
|
+
ElasticTabstopsLite.prototype.$tabsForRow = function (row) {
|
|
132
|
+
var rowTabs = [], line = this.$editor.session.getLine(row), re = /\t/g, match;
|
|
133
|
+
while ((match = re.exec(line)) != null) {
|
|
134
|
+
rowTabs.push(match.index);
|
|
135
|
+
}
|
|
136
|
+
return rowTabs;
|
|
137
|
+
};
|
|
138
|
+
ElasticTabstopsLite.prototype.$adjustRow = function (row, widths) {
|
|
139
|
+
var rowTabs = this.$tabsForRow(row);
|
|
140
|
+
if (rowTabs.length == 0)
|
|
141
|
+
return;
|
|
142
|
+
var bias = 0, location = -1;
|
|
143
|
+
var expandedSet = this.$izip(widths, rowTabs);
|
|
144
|
+
for (var i = 0, l = expandedSet.length; i < l; i++) {
|
|
145
|
+
var w = expandedSet[i][0], it = expandedSet[i][1];
|
|
146
|
+
location += 1 + w;
|
|
147
|
+
it += bias;
|
|
148
|
+
var difference = location - it;
|
|
149
|
+
if (difference == 0)
|
|
150
|
+
continue;
|
|
151
|
+
var partialLine = this.$editor.session.getLine(row).substr(0, it);
|
|
152
|
+
var strippedPartialLine = partialLine.replace(/\s*$/g, "");
|
|
153
|
+
var ispaces = partialLine.length - strippedPartialLine.length;
|
|
154
|
+
if (difference > 0) {
|
|
155
|
+
this.$editor.session.getDocument().insertInLine({ row: row, column: it + 1 }, Array(difference + 1).join(" ") + "\t");
|
|
156
|
+
this.$editor.session.getDocument().removeInLine(row, it, it + 1);
|
|
157
|
+
bias += difference;
|
|
158
|
+
}
|
|
159
|
+
if (difference < 0 && ispaces >= -difference) {
|
|
160
|
+
this.$editor.session.getDocument().removeInLine(row, it + difference, it);
|
|
161
|
+
bias += difference;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
ElasticTabstopsLite.prototype.$izip_longest = function (iterables) {
|
|
166
|
+
if (!iterables[0])
|
|
167
|
+
return [];
|
|
168
|
+
var longest = iterables[0].length;
|
|
169
|
+
var iterablesLength = iterables.length;
|
|
170
|
+
for (var i = 1; i < iterablesLength; i++) {
|
|
171
|
+
var iLength = iterables[i].length;
|
|
172
|
+
if (iLength > longest)
|
|
173
|
+
longest = iLength;
|
|
174
|
+
}
|
|
175
|
+
var expandedSet = [];
|
|
176
|
+
for (var l = 0; l < longest; l++) {
|
|
177
|
+
var set = [];
|
|
178
|
+
for (var i = 0; i < iterablesLength; i++) {
|
|
179
|
+
if (iterables[i][l] === "")
|
|
180
|
+
set.push(NaN);
|
|
181
|
+
else
|
|
182
|
+
set.push(iterables[i][l]);
|
|
183
|
+
}
|
|
184
|
+
expandedSet.push(set);
|
|
185
|
+
}
|
|
186
|
+
return expandedSet;
|
|
187
|
+
};
|
|
188
|
+
ElasticTabstopsLite.prototype.$izip = function (widths, tabs) {
|
|
189
|
+
var size = widths.length >= tabs.length ? tabs.length : widths.length;
|
|
190
|
+
var expandedSet = [];
|
|
191
|
+
for (var i = 0; i < size; i++) {
|
|
192
|
+
var set = [widths[i], tabs[i]];
|
|
193
|
+
expandedSet.push(set);
|
|
194
|
+
}
|
|
195
|
+
return expandedSet;
|
|
196
|
+
};
|
|
197
|
+
return ElasticTabstopsLite;
|
|
198
|
+
}());
|
|
199
|
+
exports.ElasticTabstopsLite = ElasticTabstopsLite;
|
|
200
|
+
var Editor = require("../editor").Editor;
|
|
201
|
+
require("../config").defineOptions(Editor.prototype, "editor", {
|
|
202
|
+
useElasticTabstops: {
|
|
203
|
+
set: function (val) {
|
|
204
|
+
if (val) {
|
|
205
|
+
if (!this.elasticTabstops)
|
|
206
|
+
this.elasticTabstops = new ElasticTabstopsLite(this);
|
|
207
|
+
this.commands.on("afterExec", this.elasticTabstops.onAfterExec);
|
|
208
|
+
this.commands.on("exec", this.elasticTabstops.onExec);
|
|
209
|
+
this.on("change", this.elasticTabstops.onChange);
|
|
210
|
+
}
|
|
211
|
+
else if (this.elasticTabstops) {
|
|
212
|
+
this.commands.removeListener("afterExec", this.elasticTabstops.onAfterExec);
|
|
213
|
+
this.commands.removeListener("exec", this.elasticTabstops.onExec);
|
|
214
|
+
this.removeListener("change", this.elasticTabstops.onChange);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
}); (function() {
|
|
221
|
+
ace.require(["ace/ext/elastic_tabstops_lite"], function(m) {
|
|
222
|
+
if (typeof module == "object" && typeof exports == "object" && module) {
|
|
223
|
+
module.exports = m;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
})();
|
|
227
|
+
|