@g9tm/lynxcontrols-code 0.0.0-stage → 2.10.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.
@@ -0,0 +1,124 @@
1
+ /** A place in the document: 0-based line and column (UTF-16 units). */
2
+ export interface G9TextPos {
3
+ readonly line: number;
4
+ readonly col: number;
5
+ }
6
+ /** A selection: where it started (`anchor`) and where the caret is (`head`); equal = a caret. */
7
+ export interface G9TextSelection {
8
+ readonly anchor: G9TextPos;
9
+ readonly head: G9TextPos;
10
+ }
11
+ /** One edit: the range it replaced (before), the text it removed and the text it put there. */
12
+ export interface G9TextChange {
13
+ readonly from: G9TextPos;
14
+ readonly to: G9TextPos;
15
+ readonly removed: string;
16
+ readonly inserted: string;
17
+ }
18
+ /** Splits a text into lines on `\r\n`, `\n` or `\r`. */
19
+ export declare function splitLines(text: string): string[];
20
+ /** The line break a text uses most (`\n` when it has none). */
21
+ export declare function detectEol(text: string): '\n' | '\r\n';
22
+ /** Compares two positions. */
23
+ export declare function comparePos(a: G9TextPos, b: G9TextPos): number;
24
+ /** A selection's start and end in document order. */
25
+ export declare function orderedRange(sel: G9TextSelection): {
26
+ readonly from: G9TextPos;
27
+ readonly to: G9TextPos;
28
+ };
29
+ /** True when the selection is a caret. */
30
+ export declare function isCaret(sel: G9TextSelection): boolean;
31
+ /** A caret at `pos`. */
32
+ export declare function caretAt(pos: G9TextPos): G9TextSelection;
33
+ /** Keeps a position inside the document. */
34
+ export declare function clampPos(lines: readonly string[], pos: G9TextPos): G9TextPos;
35
+ /** The text between two positions (in order). */
36
+ export declare function textInRange(lines: readonly string[], from: G9TextPos, to: G9TextPos, eol?: string): string;
37
+ /** Replaces `from`–`to` with `text`: the new lines (the untouched ones shared) and where the inserted text ends. */
38
+ export declare function replaceRange(lines: readonly string[], from: G9TextPos, to: G9TextPos, text: string): {
39
+ readonly lines: string[];
40
+ readonly end: G9TextPos;
41
+ };
42
+ /** Applies a change; answers the new lines and the inverse change (undo). */
43
+ export declare function applyChange(lines: readonly string[], change: Pick<G9TextChange, 'from' | 'to' | 'inserted'>, eol?: string): {
44
+ readonly lines: string[];
45
+ readonly change: G9TextChange;
46
+ readonly inverse: G9TextChange;
47
+ };
48
+ /** A caret move. */
49
+ export type G9CaretMove = 'left' | 'right' | 'up' | 'down' | 'lineStart' | 'lineEnd' | 'docStart' | 'docEnd' | 'wordLeft' | 'wordRight' | 'pageUp' | 'pageDown';
50
+ /**
51
+ * Where a caret goes. `goal` is the column up / down aim for (kept across short lines); `page` the rows of a page.
52
+ * Line start goes to the first non-blank column, and from there to column 0.
53
+ */
54
+ export declare function moveCaret(lines: readonly string[], pos: G9TextPos, move: G9CaretMove, goal?: number, page?: number): G9TextPos;
55
+ /** The word around a position (a double click), as a selection; a caret where there is no word. */
56
+ export declare function wordAt(lines: readonly string[], pos: G9TextPos): G9TextSelection;
57
+ /** The leading blanks of a line. */
58
+ export declare function indentOf(line: string): string;
59
+ /**
60
+ * What Enter inserts at `pos`: a line break and the line's indent, one step more after an opening bracket; between a
61
+ * bracket pair the closing one moves to its own line. Answers the text and where the caret goes inside it.
62
+ */
63
+ export declare function newlineText(lines: readonly string[], pos: G9TextPos, tab?: string): {
64
+ readonly text: string;
65
+ readonly caret: number;
66
+ };
67
+ /** A find hit: its line, column and length. */
68
+ export interface G9FindMatch {
69
+ readonly line: number;
70
+ readonly col: number;
71
+ readonly length: number;
72
+ }
73
+ /** Every hit of `query` (one line, no break), in document order; case-insensitive unless `caseSensitive`. */
74
+ export declare function findAll(lines: readonly string[], query: string, options?: {
75
+ readonly caseSensitive?: boolean;
76
+ readonly limit?: number;
77
+ }): G9FindMatch[];
78
+ /** The hit after (or before, `dir` -1) a position, wrapping around; -1 when there are none. */
79
+ export declare function nextMatchIndex(matches: readonly G9FindMatch[], pos: G9TextPos, dir: 1 | -1): number;
80
+ /** What an undo or a redo answers: the lines and the selection to show. */
81
+ export interface G9HistoryStep {
82
+ readonly lines: string[];
83
+ readonly selection: G9TextSelection;
84
+ }
85
+ /**
86
+ * Undo and redo. Typing in a row (same `kind`, within `groupMs`) is one step; any other kind starts a new one. A new
87
+ * change clears the redo side. At most `limit` steps are kept.
88
+ */
89
+ export declare class G9EditHistory {
90
+ private readonly limit;
91
+ private readonly groupMs;
92
+ private done;
93
+ private undone;
94
+ constructor(limit?: number, groupMs?: number);
95
+ /** Records an applied change. */
96
+ record(change: G9TextChange, inverse: G9TextChange, before: G9TextSelection, after: G9TextSelection, kind: string, now: number): void;
97
+ get canUndo(): boolean;
98
+ get canRedo(): boolean;
99
+ /** Undoes the last step on `lines`; null when there is none. */
100
+ undo(lines: readonly string[], eol?: string): G9HistoryStep | null;
101
+ /** Redoes the last undone step on `lines`; null when there is none. */
102
+ redo(lines: readonly string[], eol?: string): G9HistoryStep | null;
103
+ /** Forgets everything (a new document). */
104
+ clear(): void;
105
+ }
106
+ /** What a token is, for its colour. */
107
+ export type G9TokenKind = 'key' | 'string' | 'number' | 'boolean' | 'null' | 'punctuation' | 'comment' | 'plain';
108
+ /** A coloured stretch of a line: [start, end) and its kind. */
109
+ export interface G9Token {
110
+ readonly start: number;
111
+ readonly end: number;
112
+ readonly kind: G9TokenKind;
113
+ }
114
+ /** Splits a line into tokens (an app's own language: the same shape). */
115
+ export type G9Tokenizer = (line: string) => G9Token[];
116
+ /**
117
+ * The JSON tokenizer (JSONC comments too): keys (a string followed by `:`), strings, numbers, true / false, null,
118
+ * punctuation, `//` comments; anything else plain. A JSON string never holds a raw line break, so each line is
119
+ * tokenized alone, in one pass (a minified megabyte on one line costs linear time).
120
+ */
121
+ export declare const tokenizeJsonLine: G9Tokenizer;
122
+ /** No colours: the whole line plain. */
123
+ export declare const tokenizePlainLine: G9Tokenizer;
124
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/editor/model.ts"],"names":[],"mappings":"AAKA,uEAAuE;AACvE,MAAM,WAAW,SAAS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EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV,IAAI;IAcP,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,gEAAgE;IAChE,IAAI,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,SAAO,GAAG,aAAa,GAAG,IAAI;IAShE,uEAAuE;IACvE,IAAI,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,SAAO,GAAG,aAAa,GAAG,IAAI;IAShE,2CAA2C;IAC3C,KAAK,IAAI,IAAI;CAId;AAED,uCAAuC;AACvC,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjH,+DAA+D;AAC/D,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B;AAED,yEAAyE;AACzE,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,EAAE,CAAC;AAKtD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,WA+D9B,CAAC;AAEF,wCAAwC;AACxC,eAAO,MAAM,iBAAiB,EAAE,WAAqF,CAAC"}
@@ -0,0 +1,437 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) Object.defineProperty(obj, key, {
3
+ value: value,
4
+ enumerable: true,
5
+ configurable: true,
6
+ writable: true
7
+ });
8
+ else obj[key] = value;
9
+ return obj;
10
+ }
11
+ function splitLines(text) {
12
+ return text.split(/\r\n|\n|\r/);
13
+ }
14
+ function detectEol(text) {
15
+ var _text_match, _text_match1;
16
+ const crlf = (null != (_text_match = text.match(/\r\n/g)) ? _text_match : []).length;
17
+ const lf = (null != (_text_match1 = text.match(/\n/g)) ? _text_match1 : []).length - crlf;
18
+ return crlf > lf ? '\r\n' : '\n';
19
+ }
20
+ function comparePos(a, b) {
21
+ return a.line - b.line || a.col - b.col;
22
+ }
23
+ function orderedRange(sel) {
24
+ return comparePos(sel.anchor, sel.head) <= 0 ? {
25
+ from: sel.anchor,
26
+ to: sel.head
27
+ } : {
28
+ from: sel.head,
29
+ to: sel.anchor
30
+ };
31
+ }
32
+ function isCaret(sel) {
33
+ return 0 === comparePos(sel.anchor, sel.head);
34
+ }
35
+ function caretAt(pos) {
36
+ return {
37
+ anchor: pos,
38
+ head: pos
39
+ };
40
+ }
41
+ function clampPos(lines, pos) {
42
+ var _lines_line;
43
+ const line = Math.max(0, Math.min(lines.length - 1, pos.line));
44
+ return {
45
+ line,
46
+ col: Math.max(0, Math.min((null != (_lines_line = lines[line]) ? _lines_line : '').length, pos.col))
47
+ };
48
+ }
49
+ function textInRange(lines, from, to, eol = '\n') {
50
+ var _lines_from_line, _lines_from_line1, _lines_l, _lines_to_line;
51
+ if (from.line === to.line) return (null != (_lines_from_line = lines[from.line]) ? _lines_from_line : '').slice(from.col, to.col);
52
+ const out = [
53
+ (null != (_lines_from_line1 = lines[from.line]) ? _lines_from_line1 : '').slice(from.col)
54
+ ];
55
+ for(let l = from.line + 1; l < to.line; l++)out.push(null != (_lines_l = lines[l]) ? _lines_l : '');
56
+ out.push((null != (_lines_to_line = lines[to.line]) ? _lines_to_line : '').slice(0, to.col));
57
+ return out.join(eol);
58
+ }
59
+ function replaceRange(lines, from, to, text) {
60
+ var _lines_from_line, _lines_to_line;
61
+ const head = (null != (_lines_from_line = lines[from.line]) ? _lines_from_line : '').slice(0, from.col);
62
+ const tail = (null != (_lines_to_line = lines[to.line]) ? _lines_to_line : '').slice(to.col);
63
+ const parts = splitLines(text);
64
+ const middle = parts.slice();
65
+ middle[0] = head + middle[0];
66
+ const lastIndex = middle.length - 1;
67
+ const endCol = middle[lastIndex].length;
68
+ middle[lastIndex] = middle[lastIndex] + tail;
69
+ const next = lines.slice(0, from.line).concat(middle, lines.slice(to.line + 1));
70
+ return {
71
+ lines: next,
72
+ end: {
73
+ line: from.line + lastIndex,
74
+ col: endCol
75
+ }
76
+ };
77
+ }
78
+ function applyChange(lines, change, eol = '\n') {
79
+ const removed = textInRange(lines, change.from, change.to, eol);
80
+ const r = replaceRange(lines, change.from, change.to, change.inserted);
81
+ const done = {
82
+ from: change.from,
83
+ to: change.to,
84
+ removed,
85
+ inserted: change.inserted
86
+ };
87
+ return {
88
+ lines: r.lines,
89
+ change: done,
90
+ inverse: {
91
+ from: change.from,
92
+ to: r.end,
93
+ removed: change.inserted,
94
+ inserted: removed
95
+ }
96
+ };
97
+ }
98
+ const WORD = /[A-Za-z0-9_$؀-ۿ]/;
99
+ function moveCaret(lines, pos, move, goal = pos.col, page = 20) {
100
+ var _lines_pos_line;
101
+ const line = null != (_lines_pos_line = lines[pos.line]) ? _lines_pos_line : '';
102
+ const last = lines.length - 1;
103
+ switch(move){
104
+ case 'left':
105
+ var _lines_;
106
+ if (pos.col > 0) return {
107
+ line: pos.line,
108
+ col: pos.col - 1
109
+ };
110
+ return pos.line > 0 ? {
111
+ line: pos.line - 1,
112
+ col: (null != (_lines_ = lines[pos.line - 1]) ? _lines_ : '').length
113
+ } : pos;
114
+ case 'right':
115
+ if (pos.col < line.length) return {
116
+ line: pos.line,
117
+ col: pos.col + 1
118
+ };
119
+ return pos.line < last ? {
120
+ line: pos.line + 1,
121
+ col: 0
122
+ } : pos;
123
+ case 'up':
124
+ case 'down':
125
+ case 'pageUp':
126
+ case 'pageDown':
127
+ {
128
+ var _lines_last, _lines_target;
129
+ const by = 'up' === move ? -1 : 'down' === move ? 1 : 'pageUp' === move ? -page : page;
130
+ const target = Math.max(0, Math.min(last, pos.line + by));
131
+ if (target === pos.line) return by < 0 ? {
132
+ line: 0,
133
+ col: 0
134
+ } : {
135
+ line: last,
136
+ col: (null != (_lines_last = lines[last]) ? _lines_last : '').length
137
+ };
138
+ return {
139
+ line: target,
140
+ col: Math.min(goal, (null != (_lines_target = lines[target]) ? _lines_target : '').length)
141
+ };
142
+ }
143
+ case 'lineStart':
144
+ {
145
+ const indent = line.length - line.trimStart().length;
146
+ return {
147
+ line: pos.line,
148
+ col: pos.col === indent ? 0 : indent
149
+ };
150
+ }
151
+ case 'lineEnd':
152
+ return {
153
+ line: pos.line,
154
+ col: line.length
155
+ };
156
+ case 'docStart':
157
+ return {
158
+ line: 0,
159
+ col: 0
160
+ };
161
+ case 'docEnd':
162
+ var _lines_last1;
163
+ return {
164
+ line: last,
165
+ col: (null != (_lines_last1 = lines[last]) ? _lines_last1 : '').length
166
+ };
167
+ case 'wordLeft':
168
+ {
169
+ if (0 === pos.col) return moveCaret(lines, pos, 'left');
170
+ let c = pos.col;
171
+ while(c > 0 && !WORD.test(line[c - 1]))c--;
172
+ while(c > 0 && WORD.test(line[c - 1]))c--;
173
+ return {
174
+ line: pos.line,
175
+ col: c
176
+ };
177
+ }
178
+ default:
179
+ {
180
+ if (pos.col >= line.length) return moveCaret(lines, pos, 'right');
181
+ let c = pos.col;
182
+ while(c < line.length && !WORD.test(line[c]))c++;
183
+ while(c < line.length && WORD.test(line[c]))c++;
184
+ return {
185
+ line: pos.line,
186
+ col: c
187
+ };
188
+ }
189
+ }
190
+ }
191
+ function wordAt(lines, pos) {
192
+ var _lines_pos_line;
193
+ const line = null != (_lines_pos_line = lines[pos.line]) ? _lines_pos_line : '';
194
+ let a = pos.col;
195
+ let b = pos.col;
196
+ while(a > 0 && WORD.test(line[a - 1]))a--;
197
+ while(b < line.length && WORD.test(line[b]))b++;
198
+ return {
199
+ anchor: {
200
+ line: pos.line,
201
+ col: a
202
+ },
203
+ head: {
204
+ line: pos.line,
205
+ col: b
206
+ }
207
+ };
208
+ }
209
+ function indentOf(line) {
210
+ return line.slice(0, line.length - line.trimStart().length);
211
+ }
212
+ function newlineText(lines, pos, tab = ' ') {
213
+ var _lines_pos_line;
214
+ const line = null != (_lines_pos_line = lines[pos.line]) ? _lines_pos_line : '';
215
+ const indent = indentOf(line);
216
+ const before = line.slice(0, pos.col).trimEnd();
217
+ const after = line.slice(pos.col).trimStart();
218
+ const opens = /[[{(]$/.test(before);
219
+ if (opens && /^[\]})]/.test(after)) {
220
+ const text = `\n${indent}${tab}\n${indent}`;
221
+ return {
222
+ text,
223
+ caret: 1 + indent.length + tab.length
224
+ };
225
+ }
226
+ const text = `\n${indent}${opens ? tab : ''}`;
227
+ return {
228
+ text,
229
+ caret: text.length
230
+ };
231
+ }
232
+ function findAll(lines, query, options = {}) {
233
+ var _options_limit;
234
+ if (!query || /[\r\n]/.test(query)) return [];
235
+ const q = options.caseSensitive ? query : query.toLowerCase();
236
+ const limit = null != (_options_limit = options.limit) ? _options_limit : 10000;
237
+ const out = [];
238
+ for(let l = 0; l < lines.length && out.length < limit; l++){
239
+ const text = options.caseSensitive ? lines[l] : lines[l].toLowerCase();
240
+ let at = text.indexOf(q);
241
+ while(at >= 0 && out.length < limit){
242
+ out.push({
243
+ line: l,
244
+ col: at,
245
+ length: q.length
246
+ });
247
+ at = text.indexOf(q, at + Math.max(1, q.length));
248
+ }
249
+ }
250
+ return out;
251
+ }
252
+ function nextMatchIndex(matches, pos, dir) {
253
+ if (0 === matches.length) return -1;
254
+ if (1 === dir) {
255
+ const i = matches.findIndex((m)=>comparePos({
256
+ line: m.line,
257
+ col: m.col
258
+ }, pos) > 0);
259
+ return i < 0 ? 0 : i;
260
+ }
261
+ for(let i = matches.length - 1; i >= 0; i--){
262
+ const m = matches[i];
263
+ if (comparePos({
264
+ line: m.line,
265
+ col: m.col
266
+ }, pos) < 0) return i;
267
+ }
268
+ return matches.length - 1;
269
+ }
270
+ class G9EditHistory {
271
+ record(change, inverse, before, after, kind, now) {
272
+ this.undone = [];
273
+ const last = this.done[this.done.length - 1];
274
+ if (last && 'other' !== kind && last.kind === kind && now - last.time <= this.groupMs) {
275
+ last.changes.push(change);
276
+ last.inverses.push(inverse);
277
+ last.after = after;
278
+ last.time = now;
279
+ return;
280
+ }
281
+ this.done.push({
282
+ changes: [
283
+ change
284
+ ],
285
+ inverses: [
286
+ inverse
287
+ ],
288
+ before,
289
+ after,
290
+ kind,
291
+ time: now
292
+ });
293
+ if (this.done.length > this.limit) this.done.shift();
294
+ }
295
+ get canUndo() {
296
+ return this.done.length > 0;
297
+ }
298
+ get canRedo() {
299
+ return this.undone.length > 0;
300
+ }
301
+ undo(lines, eol = '\n') {
302
+ const e = this.done.pop();
303
+ if (!e) return null;
304
+ let cur = lines;
305
+ for(let i = e.inverses.length - 1; i >= 0; i--)cur = applyChange(cur, e.inverses[i], eol).lines;
306
+ this.undone.push(e);
307
+ return {
308
+ lines: cur,
309
+ selection: e.before
310
+ };
311
+ }
312
+ redo(lines, eol = '\n') {
313
+ const e = this.undone.pop();
314
+ if (!e) return null;
315
+ let cur = lines;
316
+ for (const c of e.changes)cur = applyChange(cur, c, eol).lines;
317
+ this.done.push(e);
318
+ return {
319
+ lines: cur,
320
+ selection: e.after
321
+ };
322
+ }
323
+ clear() {
324
+ this.done = [];
325
+ this.undone = [];
326
+ }
327
+ constructor(limit = 500, groupMs = 800){
328
+ _define_property(this, "limit", void 0);
329
+ _define_property(this, "groupMs", void 0);
330
+ _define_property(this, "done", void 0);
331
+ _define_property(this, "undone", void 0);
332
+ this.limit = limit;
333
+ this.groupMs = groupMs;
334
+ this.done = [];
335
+ this.undone = [];
336
+ }
337
+ }
338
+ const NUM = /-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/y;
339
+ const IDENT = /[A-Za-z_][A-Za-z0-9_]*/y;
340
+ const tokenizeJsonLine = (line)=>{
341
+ const out = [];
342
+ const n = line.length;
343
+ let i = 0;
344
+ let plainFrom = -1;
345
+ const flush = (to)=>{
346
+ if (plainFrom >= 0 && to > plainFrom) out.push({
347
+ start: plainFrom,
348
+ end: to,
349
+ kind: 'plain'
350
+ });
351
+ plainFrom = -1;
352
+ };
353
+ while(i < n){
354
+ const ch = line[i];
355
+ if (' ' === ch || '\t' === ch) {
356
+ flush(i);
357
+ i++;
358
+ continue;
359
+ }
360
+ if ('/' === ch && '/' === line[i + 1]) {
361
+ flush(i);
362
+ out.push({
363
+ start: i,
364
+ end: n,
365
+ kind: 'comment'
366
+ });
367
+ return out;
368
+ }
369
+ if ('"' === ch) {
370
+ flush(i);
371
+ let j = i + 1;
372
+ while(j < n && '"' !== line[j])j += '\\' === line[j] ? 2 : 1;
373
+ const end = Math.min(n, j + 1);
374
+ let k = end;
375
+ while(k < n && (' ' === line[k] || '\t' === line[k]))k++;
376
+ out.push({
377
+ start: i,
378
+ end,
379
+ kind: ':' === line[k] ? 'key' : 'string'
380
+ });
381
+ i = end;
382
+ continue;
383
+ }
384
+ if ('{}[]:,'.includes(ch)) {
385
+ flush(i);
386
+ out.push({
387
+ start: i,
388
+ end: i + 1,
389
+ kind: 'punctuation'
390
+ });
391
+ i++;
392
+ continue;
393
+ }
394
+ NUM.lastIndex = i;
395
+ const num = NUM.exec(line);
396
+ if (num && plainFrom < 0) {
397
+ const end = i + num[0].length;
398
+ if (end === n || !/[A-Za-z0-9_]/.test(line[end])) {
399
+ flush(i);
400
+ out.push({
401
+ start: i,
402
+ end,
403
+ kind: 'number'
404
+ });
405
+ i = end;
406
+ continue;
407
+ }
408
+ }
409
+ IDENT.lastIndex = i;
410
+ const word = IDENT.exec(line);
411
+ if (word && plainFrom < 0) {
412
+ const w = word[0];
413
+ const kind = 'true' === w || 'false' === w ? 'boolean' : 'null' === w ? 'null' : 'plain';
414
+ out.push({
415
+ start: i,
416
+ end: i + w.length,
417
+ kind
418
+ });
419
+ i += w.length;
420
+ continue;
421
+ }
422
+ if (plainFrom < 0) plainFrom = i;
423
+ i++;
424
+ }
425
+ flush(n);
426
+ return out;
427
+ };
428
+ const tokenizePlainLine = (line)=>line ? [
429
+ {
430
+ start: 0,
431
+ end: line.length,
432
+ kind: 'plain'
433
+ }
434
+ ] : [];
435
+ export { G9EditHistory, applyChange, caretAt, clampPos, comparePos, detectEol, findAll, indentOf, isCaret, moveCaret, newlineText, nextMatchIndex, orderedRange, replaceRange, splitLines, textInRange, tokenizeJsonLine, tokenizePlainLine, wordAt };
436
+
437
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sources":["../../src/editor/model.ts"],"sourcesContent":["// The plain-TypeScript model of G9CodeEditor (2.9.0, G9ProxyManager): a document as lines, positions and selections,\n// edits that answer their own inverse (undo / redo), caret moves, find, and the JSON tokenizer the colours come from.\n// No JSX and no runtime import: Node tests it whole, and a 1 MB text is a 30 000-line array whose edits copy pointers,\n// never characters.\n\n/** A place in the document: 0-based line and column (UTF-16 units). */\nexport interface G9TextPos {\n readonly line: number;\n readonly col: number;\n}\n\n/** A selection: where it started (`anchor`) and where the caret is (`head`); equal = a caret. */\nexport interface G9TextSelection {\n readonly anchor: G9TextPos;\n readonly head: G9TextPos;\n}\n\n/** One edit: the range it replaced (before), the text it removed and the text it put there. */\nexport interface G9TextChange {\n readonly from: G9TextPos;\n readonly to: G9TextPos;\n readonly removed: string;\n readonly inserted: string;\n}\n\n/** Splits a text into lines on `\\r\\n`, `\\n` or `\\r`. */\nexport function splitLines(text: string): string[] {\n return text.split(/\\r\\n|\\n|\\r/);\n}\n\n/** The line break a text uses most (`\\n` when it has none). */\nexport function detectEol(text: string): '\\n' | '\\r\\n' {\n const crlf = (text.match(/\\r\\n/g) ?? []).length;\n const lf = (text.match(/\\n/g) ?? []).length - crlf;\n return crlf > lf ? '\\r\\n' : '\\n';\n}\n\n/** Compares two positions. */\nexport function comparePos(a: G9TextPos, b: G9TextPos): number {\n return a.line - b.line || a.col - b.col;\n}\n\n/** A selection's start and end in document order. */\nexport function orderedRange(sel: G9TextSelection): { readonly from: G9TextPos; readonly to: G9TextPos } {\n return comparePos(sel.anchor, sel.head) <= 0\n ? { from: sel.anchor, to: sel.head }\n : { from: sel.head, to: sel.anchor };\n}\n\n/** True when the selection is a caret. */\nexport function isCaret(sel: G9TextSelection): boolean {\n return comparePos(sel.anchor, sel.head) === 0;\n}\n\n/** A caret at `pos`. */\nexport function caretAt(pos: G9TextPos): G9TextSelection {\n return { anchor: pos, head: pos };\n}\n\n/** Keeps a position inside the document. */\nexport function clampPos(lines: readonly string[], pos: G9TextPos): G9TextPos {\n const line = Math.max(0, Math.min(lines.length - 1, pos.line));\n return { line, col: Math.max(0, Math.min((lines[line] ?? '').length, pos.col)) };\n}\n\n/** The text between two positions (in order). */\nexport function textInRange(lines: readonly string[], from: G9TextPos, to: G9TextPos, eol = '\\n'): string {\n if (from.line === to.line) return (lines[from.line] ?? '').slice(from.col, to.col);\n const out = [(lines[from.line] ?? '').slice(from.col)];\n for (let l = from.line + 1; l < to.line; l++) out.push(lines[l] ?? '');\n out.push((lines[to.line] ?? '').slice(0, to.col));\n return out.join(eol);\n}\n\n/** Replaces `from`–`to` with `text`: the new lines (the untouched ones shared) and where the inserted text ends. */\nexport function replaceRange(\n lines: readonly string[],\n from: G9TextPos,\n to: G9TextPos,\n text: string,\n): { readonly lines: string[]; readonly end: G9TextPos } {\n const head = (lines[from.line] ?? '').slice(0, from.col);\n const tail = (lines[to.line] ?? '').slice(to.col);\n const parts = splitLines(text);\n const middle = parts.slice();\n middle[0] = head + middle[0];\n const lastIndex = middle.length - 1;\n const endCol = (middle[lastIndex] as string).length;\n middle[lastIndex] = middle[lastIndex] + tail;\n const next = lines.slice(0, from.line).concat(middle, lines.slice(to.line + 1));\n return { lines: next, end: { line: from.line + lastIndex, col: endCol } };\n}\n\n/** Applies a change; answers the new lines and the inverse change (undo). */\nexport function applyChange(\n lines: readonly string[],\n change: Pick<G9TextChange, 'from' | 'to' | 'inserted'>,\n eol = '\\n',\n): { readonly lines: string[]; readonly change: G9TextChange; readonly inverse: G9TextChange } {\n const removed = textInRange(lines, change.from, change.to, eol);\n const r = replaceRange(lines, change.from, change.to, change.inserted);\n const done: G9TextChange = { from: change.from, to: change.to, removed, inserted: change.inserted };\n return {\n lines: r.lines,\n change: done,\n inverse: { from: change.from, to: r.end, removed: change.inserted, inserted: removed },\n };\n}\n\nconst WORD = /[A-Za-z0-9_$؀-ۿ]/;\n\n/** A caret move. */\nexport type G9CaretMove =\n | 'left'\n | 'right'\n | 'up'\n | 'down'\n | 'lineStart'\n | 'lineEnd'\n | 'docStart'\n | 'docEnd'\n | 'wordLeft'\n | 'wordRight'\n | 'pageUp'\n | 'pageDown';\n\n/**\n * Where a caret goes. `goal` is the column up / down aim for (kept across short lines); `page` the rows of a page.\n * Line start goes to the first non-blank column, and from there to column 0.\n */\nexport function moveCaret(\n lines: readonly string[],\n pos: G9TextPos,\n move: G9CaretMove,\n goal = pos.col,\n page = 20,\n): G9TextPos {\n const line = lines[pos.line] ?? '';\n const last = lines.length - 1;\n switch (move) {\n case 'left':\n if (pos.col > 0) return { line: pos.line, col: pos.col - 1 };\n return pos.line > 0 ? { line: pos.line - 1, col: (lines[pos.line - 1] ?? '').length } : pos;\n case 'right':\n if (pos.col < line.length) return { line: pos.line, col: pos.col + 1 };\n return pos.line < last ? { line: pos.line + 1, col: 0 } : pos;\n case 'up':\n case 'down':\n case 'pageUp':\n case 'pageDown': {\n const by = move === 'up' ? -1 : move === 'down' ? 1 : move === 'pageUp' ? -page : page;\n const target = Math.max(0, Math.min(last, pos.line + by));\n if (target === pos.line) return by < 0 ? { line: 0, col: 0 } : { line: last, col: (lines[last] ?? '').length };\n return { line: target, col: Math.min(goal, (lines[target] ?? '').length) };\n }\n case 'lineStart': {\n const indent = line.length - line.trimStart().length;\n return { line: pos.line, col: pos.col === indent ? 0 : indent };\n }\n case 'lineEnd':\n return { line: pos.line, col: line.length };\n case 'docStart':\n return { line: 0, col: 0 };\n case 'docEnd':\n return { line: last, col: (lines[last] ?? '').length };\n case 'wordLeft': {\n if (pos.col === 0) return moveCaret(lines, pos, 'left');\n let c = pos.col;\n while (c > 0 && !WORD.test(line[c - 1] as string)) c--;\n while (c > 0 && WORD.test(line[c - 1] as string)) c--;\n return { line: pos.line, col: c };\n }\n default: {\n if (pos.col >= line.length) return moveCaret(lines, pos, 'right');\n let c = pos.col;\n while (c < line.length && !WORD.test(line[c] as string)) c++;\n while (c < line.length && WORD.test(line[c] as string)) c++;\n return { line: pos.line, col: c };\n }\n }\n}\n\n/** The word around a position (a double click), as a selection; a caret where there is no word. */\nexport function wordAt(lines: readonly string[], pos: G9TextPos): G9TextSelection {\n const line = lines[pos.line] ?? '';\n let a = pos.col;\n let b = pos.col;\n while (a > 0 && WORD.test(line[a - 1] as string)) a--;\n while (b < line.length && WORD.test(line[b] as string)) b++;\n return { anchor: { line: pos.line, col: a }, head: { line: pos.line, col: b } };\n}\n\n/** The leading blanks of a line. */\nexport function indentOf(line: string): string {\n return line.slice(0, line.length - line.trimStart().length);\n}\n\n/**\n * What Enter inserts at `pos`: a line break and the line's indent, one step more after an opening bracket; between a\n * bracket pair the closing one moves to its own line. Answers the text and where the caret goes inside it.\n */\nexport function newlineText(\n lines: readonly string[],\n pos: G9TextPos,\n tab = ' ',\n): { readonly text: string; readonly caret: number } {\n const line = lines[pos.line] ?? '';\n const indent = indentOf(line);\n const before = line.slice(0, pos.col).trimEnd();\n const after = line.slice(pos.col).trimStart();\n const opens = /[[{(]$/.test(before);\n if (opens && /^[\\]})]/.test(after)) {\n const text = `\\n${indent}${tab}\\n${indent}`;\n return { text, caret: 1 + indent.length + tab.length };\n }\n const text = `\\n${indent}${opens ? tab : ''}`;\n return { text, caret: text.length };\n}\n\n/** A find hit: its line, column and length. */\nexport interface G9FindMatch {\n readonly line: number;\n readonly col: number;\n readonly length: number;\n}\n\n/** Every hit of `query` (one line, no break), in document order; case-insensitive unless `caseSensitive`. */\nexport function findAll(\n lines: readonly string[],\n query: string,\n options: { readonly caseSensitive?: boolean; readonly limit?: number } = {},\n): G9FindMatch[] {\n if (!query || /[\\r\\n]/.test(query)) return [];\n const q = options.caseSensitive ? query : query.toLowerCase();\n const limit = options.limit ?? 10000;\n const out: G9FindMatch[] = [];\n for (let l = 0; l < lines.length && out.length < limit; l++) {\n const text = options.caseSensitive ? (lines[l] as string) : (lines[l] as string).toLowerCase();\n let at = text.indexOf(q);\n while (at >= 0 && out.length < limit) {\n out.push({ line: l, col: at, length: q.length });\n at = text.indexOf(q, at + Math.max(1, q.length));\n }\n }\n return out;\n}\n\n/** The hit after (or before, `dir` -1) a position, wrapping around; -1 when there are none. */\nexport function nextMatchIndex(matches: readonly G9FindMatch[], pos: G9TextPos, dir: 1 | -1): number {\n if (matches.length === 0) return -1;\n if (dir === 1) {\n const i = matches.findIndex((m) => comparePos({ line: m.line, col: m.col }, pos) > 0);\n return i < 0 ? 0 : i;\n }\n for (let i = matches.length - 1; i >= 0; i--) {\n const m = matches[i] as G9FindMatch;\n if (comparePos({ line: m.line, col: m.col }, pos) < 0) return i;\n }\n return matches.length - 1;\n}\n\n/** One entry of the undo stack: the change and its inverse with the selections around them. */\ninterface HistoryEntry {\n readonly changes: G9TextChange[];\n readonly inverses: G9TextChange[];\n readonly before: G9TextSelection;\n after: G9TextSelection;\n readonly kind: string;\n time: number;\n}\n\n/** What an undo or a redo answers: the lines and the selection to show. */\nexport interface G9HistoryStep {\n readonly lines: string[];\n readonly selection: G9TextSelection;\n}\n\n/**\n * Undo and redo. Typing in a row (same `kind`, within `groupMs`) is one step; any other kind starts a new one. A new\n * change clears the redo side. At most `limit` steps are kept.\n */\nexport class G9EditHistory {\n private done: HistoryEntry[] = [];\n private undone: HistoryEntry[] = [];\n constructor(\n private readonly limit = 500,\n private readonly groupMs = 800,\n ) {}\n\n /** Records an applied change. */\n record(\n change: G9TextChange,\n inverse: G9TextChange,\n before: G9TextSelection,\n after: G9TextSelection,\n kind: string,\n now: number,\n ): void {\n this.undone = [];\n const last = this.done[this.done.length - 1];\n if (last && kind !== 'other' && last.kind === kind && now - last.time <= this.groupMs) {\n last.changes.push(change);\n last.inverses.push(inverse);\n last.after = after;\n last.time = now;\n return;\n }\n this.done.push({ changes: [change], inverses: [inverse], before, after, kind, time: now });\n if (this.done.length > this.limit) this.done.shift();\n }\n\n get canUndo(): boolean {\n return this.done.length > 0;\n }\n\n get canRedo(): boolean {\n return this.undone.length > 0;\n }\n\n /** Undoes the last step on `lines`; null when there is none. */\n undo(lines: readonly string[], eol = '\\n'): G9HistoryStep | null {\n const e = this.done.pop();\n if (!e) return null;\n let cur = lines as string[];\n for (let i = e.inverses.length - 1; i >= 0; i--) cur = applyChange(cur, e.inverses[i] as G9TextChange, eol).lines;\n this.undone.push(e);\n return { lines: cur, selection: e.before };\n }\n\n /** Redoes the last undone step on `lines`; null when there is none. */\n redo(lines: readonly string[], eol = '\\n'): G9HistoryStep | null {\n const e = this.undone.pop();\n if (!e) return null;\n let cur = lines as string[];\n for (const c of e.changes) cur = applyChange(cur, c, eol).lines;\n this.done.push(e);\n return { lines: cur, selection: e.after };\n }\n\n /** Forgets everything (a new document). */\n clear(): void {\n this.done = [];\n this.undone = [];\n }\n}\n\n/** What a token is, for its colour. */\nexport type G9TokenKind = 'key' | 'string' | 'number' | 'boolean' | 'null' | 'punctuation' | 'comment' | 'plain';\n\n/** A coloured stretch of a line: [start, end) and its kind. */\nexport interface G9Token {\n readonly start: number;\n readonly end: number;\n readonly kind: G9TokenKind;\n}\n\n/** Splits a line into tokens (an app's own language: the same shape). */\nexport type G9Tokenizer = (line: string) => G9Token[];\n\nconst NUM = /-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/y;\nconst IDENT = /[A-Za-z_][A-Za-z0-9_]*/y;\n\n/**\n * The JSON tokenizer (JSONC comments too): keys (a string followed by `:`), strings, numbers, true / false, null,\n * punctuation, `//` comments; anything else plain. A JSON string never holds a raw line break, so each line is\n * tokenized alone, in one pass (a minified megabyte on one line costs linear time).\n */\nexport const tokenizeJsonLine: G9Tokenizer = (line) => {\n const out: G9Token[] = [];\n const n = line.length;\n let i = 0;\n let plainFrom = -1;\n const flush = (to: number) => {\n if (plainFrom >= 0 && to > plainFrom) out.push({ start: plainFrom, end: to, kind: 'plain' });\n plainFrom = -1;\n };\n while (i < n) {\n const ch = line[i] as string;\n if (ch === ' ' || ch === '\\t') {\n flush(i);\n i++;\n continue;\n }\n if (ch === '/' && line[i + 1] === '/') {\n flush(i);\n out.push({ start: i, end: n, kind: 'comment' });\n return out;\n }\n if (ch === '\"') {\n flush(i);\n let j = i + 1;\n while (j < n && line[j] !== '\"') j += line[j] === '\\\\' ? 2 : 1;\n const end = Math.min(n, j + 1);\n let k = end;\n while (k < n && (line[k] === ' ' || line[k] === '\\t')) k++;\n out.push({ start: i, end, kind: line[k] === ':' ? 'key' : 'string' });\n i = end;\n continue;\n }\n if ('{}[]:,'.includes(ch)) {\n flush(i);\n out.push({ start: i, end: i + 1, kind: 'punctuation' });\n i++;\n continue;\n }\n NUM.lastIndex = i;\n const num = NUM.exec(line);\n if (num && plainFrom < 0) {\n const end = i + num[0].length;\n if (end === n || !/[A-Za-z0-9_]/.test(line[end] as string)) {\n flush(i);\n out.push({ start: i, end, kind: 'number' });\n i = end;\n continue;\n }\n }\n IDENT.lastIndex = i;\n const word = IDENT.exec(line);\n if (word && plainFrom < 0) {\n const w = word[0];\n const kind: G9TokenKind = w === 'true' || w === 'false' ? 'boolean' : w === 'null' ? 'null' : 'plain';\n out.push({ start: i, end: i + w.length, kind });\n i += w.length;\n continue;\n }\n if (plainFrom < 0) plainFrom = i;\n i++;\n }\n flush(n);\n return out;\n};\n\n/** No colours: the whole line plain. */\nexport const tokenizePlainLine: G9Tokenizer = (line) => (line ? [{ start: 0, end: line.length, kind: 'plain' }] : []);\n"],"names":["splitLines","text","detectEol","_text_match","_text_match1","crlf","lf","comparePos","a","b","orderedRange","sel","isCaret","caretAt","pos","clampPos","lines","_lines_line","line","Math","textInRange","from","to","eol","_lines_from_line","_lines_from_line1","_lines_l","_lines_to_line","out","l","replaceRange","head","tail","parts","middle","lastIndex","endCol","next","applyChange","change","removed","r","done","WORD","moveCaret","move","goal","page","_lines_pos_line","last","_lines_","_lines_last","_lines_target","by","target","indent","_lines_last1","c","wordAt","indentOf","newlineText","tab","before","after","opens","findAll","query","options","_options_limit","q","limit","at","nextMatchIndex","matches","dir","i","m","G9EditHistory","inverse","kind","now","e","cur","groupMs","NUM","IDENT","tokenizeJsonLine","n","plainFrom","flush","ch","j","end","k","num","word","w","tokenizePlainLine"],"mappings":"AAKqE;;;;;;;;;;AAqB9D,SAASA,WAAWC,IAAY;IACrC,OAAOA,KAAK,KAAK,CAAC;AACpB;AAGO,SAASC,UAAUD,IAAY;QACtBE,aACFC;IADZ,MAAMC,OAAO,AAAC,SAAAF,CAAAA,cAAAA,KAAK,KAAK,CAAC,QAAO,IAAlBA,cAAuB,EAAE,AAAD,EAAG,MAAM;IAC/C,MAAMG,KAAK,AAAC,SAAAF,CAAAA,eAAAA,KAAK,KAAK,CAAC,MAAK,IAAhBA,eAAqB,EAAE,AAAD,EAAG,MAAM,GAAGC;IAC9C,OAAOA,OAAOC,KAAK,SAAS;AAC9B;AAGO,SAASC,WAAWC,CAAY,EAAEC,CAAY;IACnD,OAAOD,EAAE,IAAI,GAAGC,EAAE,IAAI,IAAID,EAAE,GAAG,GAAGC,EAAE,GAAG;AACzC;AAGO,SAASC,aAAaC,GAAoB;IAC/C,OAAOJ,WAAWI,IAAI,MAAM,EAAEA,IAAI,IAAI,KAAK,IACvC;QAAE,MAAMA,IAAI,MAAM;QAAE,IAAIA,IAAI,IAAI;IAAC,IACjC;QAAE,MAAMA,IAAI,IAAI;QAAE,IAAIA,IAAI,MAAM;IAAC;AACvC;AAGO,SAASC,QAAQD,GAAoB;IAC1C,OAAOJ,AAAqC,MAArCA,WAAWI,IAAI,MAAM,EAAEA,IAAI,IAAI;AACxC;AAGO,SAASE,QAAQC,GAAc;IACpC,OAAO;QAAE,QAAQA;QAAK,MAAMA;IAAI;AAClC;AAGO,SAASC,SAASC,KAAwB,EAAEF,GAAc;QAErBG;IAD1C,MAAMC,OAAOC,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC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