@uiw/react-codemirror 4.23.6 → 4.23.7
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/dist/codemirror.js +270 -173
- package/dist/codemirror.min.js +1 -1
- package/package.json +2 -2
package/dist/codemirror.js
CHANGED
|
@@ -140,19 +140,20 @@ class SearchCursor {
|
|
|
140
140
|
let str = (0,state_.fromCodePoint)(next), start = this.bufferStart + this.bufferPos;
|
|
141
141
|
this.bufferPos += (0,state_.codePointSize)(next);
|
|
142
142
|
let norm = this.normalize(str);
|
|
143
|
-
|
|
144
|
-
let
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
|
|
143
|
+
if (norm.length)
|
|
144
|
+
for (let i = 0, pos = start;; i++) {
|
|
145
|
+
let code = norm.charCodeAt(i);
|
|
146
|
+
let match = this.match(code, pos, this.bufferPos + this.bufferStart);
|
|
147
|
+
if (i == norm.length - 1) {
|
|
148
|
+
if (match) {
|
|
149
|
+
this.value = match;
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
break;
|
|
150
153
|
}
|
|
151
|
-
|
|
154
|
+
if (pos == start && i < str.length && str.charCodeAt(i) == code)
|
|
155
|
+
pos++;
|
|
152
156
|
}
|
|
153
|
-
if (pos == start && i < str.length && str.charCodeAt(i) == code)
|
|
154
|
-
pos++;
|
|
155
|
-
}
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
match(code, pos, end) {
|
|
@@ -709,9 +710,11 @@ class StringQuery extends QueryType {
|
|
|
709
710
|
}
|
|
710
711
|
nextMatch(state, curFrom, curTo) {
|
|
711
712
|
let cursor = stringCursor(this.spec, state, curTo, state.doc.length).nextOverlapping();
|
|
712
|
-
if (cursor.done)
|
|
713
|
-
|
|
714
|
-
|
|
713
|
+
if (cursor.done) {
|
|
714
|
+
let end = Math.min(state.doc.length, curFrom + this.spec.unquoted.length);
|
|
715
|
+
cursor = stringCursor(this.spec, state, 0, end).nextOverlapping();
|
|
716
|
+
}
|
|
717
|
+
return cursor.done || cursor.value.from == curFrom && cursor.value.to == curTo ? null : cursor.value;
|
|
715
718
|
}
|
|
716
719
|
// Searching in reverse is, rather than implementing an inverted search
|
|
717
720
|
// cursor, done by scanning chunk after chunk forward.
|
|
@@ -729,8 +732,10 @@ class StringQuery extends QueryType {
|
|
|
729
732
|
}
|
|
730
733
|
}
|
|
731
734
|
prevMatch(state, curFrom, curTo) {
|
|
732
|
-
|
|
733
|
-
|
|
735
|
+
let found = this.prevMatchInRange(state, 0, curFrom);
|
|
736
|
+
if (!found)
|
|
737
|
+
found = this.prevMatchInRange(state, Math.max(0, curTo - this.spec.unquoted.length), state.doc.length);
|
|
738
|
+
return found && (found.from != curFrom || found.to != curTo) ? found : null;
|
|
734
739
|
}
|
|
735
740
|
getReplacement(_result) { return this.spec.unquote(this.spec.replace); }
|
|
736
741
|
matchAll(state, limit) {
|
|
@@ -974,9 +979,10 @@ const replaceNext = /*@__PURE__*/searchCommand((view, { query }) => {
|
|
|
974
979
|
let { state } = view, { from, to } = state.selection.main;
|
|
975
980
|
if (state.readOnly)
|
|
976
981
|
return false;
|
|
977
|
-
let
|
|
978
|
-
if (!
|
|
982
|
+
let match = query.nextMatch(state, from, from);
|
|
983
|
+
if (!match)
|
|
979
984
|
return false;
|
|
985
|
+
let next = match;
|
|
980
986
|
let changes = [], selection, replacement;
|
|
981
987
|
let effects = [];
|
|
982
988
|
if (next.from == from && next.to == to) {
|
|
@@ -986,7 +992,7 @@ const replaceNext = /*@__PURE__*/searchCommand((view, { query }) => {
|
|
|
986
992
|
effects.push(view_.EditorView.announce.of(state.phrase("replaced match on line $", state.doc.lineAt(from).number) + "."));
|
|
987
993
|
}
|
|
988
994
|
if (next) {
|
|
989
|
-
let off = changes.length == 0 || changes[0].from >=
|
|
995
|
+
let off = changes.length == 0 || changes[0].from >= match.to ? 0 : match.to - match.from - replacement.length;
|
|
990
996
|
selection = state_.EditorSelection.single(next.from - off, next.to - off);
|
|
991
997
|
effects.push(announceMatch(view, next));
|
|
992
998
|
effects.push(state.facet(searchConfigFacet).scrollToMatch(selection.main, view));
|
|
@@ -2098,12 +2104,12 @@ class CompletionDialog {
|
|
|
2098
2104
|
return selected == this.selected || selected >= this.options.length ? this
|
|
2099
2105
|
: new CompletionDialog(this.options, makeAttrs(id, selected), this.tooltip, this.timestamp, selected, this.disabled);
|
|
2100
2106
|
}
|
|
2101
|
-
static build(active, state, id, prev, conf) {
|
|
2107
|
+
static build(active, state, id, prev, conf, didSetActive) {
|
|
2108
|
+
if (prev && !didSetActive && active.some(s => s.isPending))
|
|
2109
|
+
return prev.setDisabled();
|
|
2102
2110
|
let options = sortOptions(active, state);
|
|
2103
|
-
if (!options.length)
|
|
2104
|
-
return prev && active.some(a => a.
|
|
2105
|
-
new CompletionDialog(prev.options, prev.attrs, prev.tooltip, prev.timestamp, prev.selected, true) : null;
|
|
2106
|
-
}
|
|
2111
|
+
if (!options.length)
|
|
2112
|
+
return prev && active.some(a => a.isPending) ? prev.setDisabled() : null;
|
|
2107
2113
|
let selected = state.facet(completionConfig).selectOnOpen ? 0 : -1;
|
|
2108
2114
|
if (prev && prev.selected != selected && prev.selected != -1) {
|
|
2109
2115
|
let selectedValue = prev.options[prev.selected].completion;
|
|
@@ -2122,6 +2128,9 @@ class CompletionDialog {
|
|
|
2122
2128
|
map(changes) {
|
|
2123
2129
|
return new CompletionDialog(this.options, this.attrs, Object.assign(Object.assign({}, this.tooltip), { pos: changes.mapPos(this.tooltip.pos) }), this.timestamp, this.selected, this.disabled);
|
|
2124
2130
|
}
|
|
2131
|
+
setDisabled() {
|
|
2132
|
+
return new CompletionDialog(this.options, this.attrs, this.tooltip, this.timestamp, this.selected, true);
|
|
2133
|
+
}
|
|
2125
2134
|
}
|
|
2126
2135
|
class CompletionState {
|
|
2127
2136
|
constructor(active, id, open) {
|
|
@@ -2143,15 +2152,15 @@ class CompletionState {
|
|
|
2143
2152
|
});
|
|
2144
2153
|
if (active.length == this.active.length && active.every((a, i) => a == this.active[i]))
|
|
2145
2154
|
active = this.active;
|
|
2146
|
-
let open = this.open;
|
|
2155
|
+
let open = this.open, didSet = tr.effects.some(e => e.is(setActiveEffect));
|
|
2147
2156
|
if (open && tr.docChanged)
|
|
2148
2157
|
open = open.map(tr.changes);
|
|
2149
2158
|
if (tr.selection || active.some(a => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) ||
|
|
2150
|
-
!sameResults(active, this.active))
|
|
2151
|
-
open = CompletionDialog.build(active, state, this.id, open, conf);
|
|
2152
|
-
else if (open && open.disabled && !active.some(a => a.
|
|
2159
|
+
!sameResults(active, this.active) || didSet)
|
|
2160
|
+
open = CompletionDialog.build(active, state, this.id, open, conf, didSet);
|
|
2161
|
+
else if (open && open.disabled && !active.some(a => a.isPending))
|
|
2153
2162
|
open = null;
|
|
2154
|
-
if (!open && active.every(a => a.
|
|
2163
|
+
if (!open && active.every(a => !a.isPending) && active.some(a => a.hasResult()))
|
|
2155
2164
|
active = active.map(a => a.hasResult() ? new ActiveSource(a.source, 0 /* State.Inactive */) : a);
|
|
2156
2165
|
for (let effect of tr.effects)
|
|
2157
2166
|
if (effect.is(setSelectedEffect))
|
|
@@ -2165,9 +2174,9 @@ function sameResults(a, b) {
|
|
|
2165
2174
|
if (a == b)
|
|
2166
2175
|
return true;
|
|
2167
2176
|
for (let iA = 0, iB = 0;;) {
|
|
2168
|
-
while (iA < a.length && !a[iA].hasResult)
|
|
2177
|
+
while (iA < a.length && !a[iA].hasResult())
|
|
2169
2178
|
iA++;
|
|
2170
|
-
while (iB < b.length && !b[iB].hasResult)
|
|
2179
|
+
while (iB < b.length && !b[iB].hasResult())
|
|
2171
2180
|
iB++;
|
|
2172
2181
|
let endA = iA == a.length, endB = iB == b.length;
|
|
2173
2182
|
if (endA || endB)
|
|
@@ -2205,12 +2214,13 @@ function getUpdateType(tr, conf) {
|
|
|
2205
2214
|
: tr.docChanged ? 16 /* UpdateType.ResetIfTouching */ : 0 /* UpdateType.None */;
|
|
2206
2215
|
}
|
|
2207
2216
|
class ActiveSource {
|
|
2208
|
-
constructor(source, state,
|
|
2217
|
+
constructor(source, state, explicit = false) {
|
|
2209
2218
|
this.source = source;
|
|
2210
2219
|
this.state = state;
|
|
2211
|
-
this.
|
|
2220
|
+
this.explicit = explicit;
|
|
2212
2221
|
}
|
|
2213
2222
|
hasResult() { return false; }
|
|
2223
|
+
get isPending() { return this.state == 1 /* State.Pending */; }
|
|
2214
2224
|
update(tr, conf) {
|
|
2215
2225
|
let type = getUpdateType(tr, conf), value = this;
|
|
2216
2226
|
if ((type & 8 /* UpdateType.Reset */) || (type & 16 /* UpdateType.ResetIfTouching */) && this.touches(tr))
|
|
@@ -2220,7 +2230,7 @@ class ActiveSource {
|
|
|
2220
2230
|
value = value.updateFor(tr, type);
|
|
2221
2231
|
for (let effect of tr.effects) {
|
|
2222
2232
|
if (effect.is(startCompletionEffect))
|
|
2223
|
-
value = new ActiveSource(value.source, 1 /* State.Pending */, effect.value
|
|
2233
|
+
value = new ActiveSource(value.source, 1 /* State.Pending */, effect.value);
|
|
2224
2234
|
else if (effect.is(closeCompletionEffect))
|
|
2225
2235
|
value = new ActiveSource(value.source, 0 /* State.Inactive */);
|
|
2226
2236
|
else if (effect.is(setActiveEffect))
|
|
@@ -2231,16 +2241,15 @@ class ActiveSource {
|
|
|
2231
2241
|
return value;
|
|
2232
2242
|
}
|
|
2233
2243
|
updateFor(tr, type) { return this.map(tr.changes); }
|
|
2234
|
-
map(changes) {
|
|
2235
|
-
return changes.empty || this.explicitPos < 0 ? this : new ActiveSource(this.source, this.state, changes.mapPos(this.explicitPos));
|
|
2236
|
-
}
|
|
2244
|
+
map(changes) { return this; }
|
|
2237
2245
|
touches(tr) {
|
|
2238
2246
|
return tr.changes.touchesRange(cur(tr.state));
|
|
2239
2247
|
}
|
|
2240
2248
|
}
|
|
2241
2249
|
class ActiveResult extends ActiveSource {
|
|
2242
|
-
constructor(source,
|
|
2243
|
-
super(source,
|
|
2250
|
+
constructor(source, explicit, limit, result, from, to) {
|
|
2251
|
+
super(source, 3 /* State.Result */, explicit);
|
|
2252
|
+
this.limit = limit;
|
|
2244
2253
|
this.result = result;
|
|
2245
2254
|
this.from = from;
|
|
2246
2255
|
this.to = to;
|
|
@@ -2255,17 +2264,16 @@ class ActiveResult extends ActiveSource {
|
|
|
2255
2264
|
result = result.map(result, tr.changes);
|
|
2256
2265
|
let from = tr.changes.mapPos(this.from), to = tr.changes.mapPos(this.to, 1);
|
|
2257
2266
|
let pos = cur(tr.state);
|
|
2258
|
-
if (
|
|
2259
|
-
|
|
2260
|
-
(type & 2 /* UpdateType.Backspacing */) && cur(tr.startState) == this.from)
|
|
2267
|
+
if (pos > to || !result ||
|
|
2268
|
+
(type & 2 /* UpdateType.Backspacing */) && (cur(tr.startState) == this.from || pos < this.limit))
|
|
2261
2269
|
return new ActiveSource(this.source, type & 4 /* UpdateType.Activate */ ? 1 /* State.Pending */ : 0 /* State.Inactive */);
|
|
2262
|
-
let
|
|
2270
|
+
let limit = tr.changes.mapPos(this.limit);
|
|
2263
2271
|
if (checkValid(result.validFor, tr.state, from, to))
|
|
2264
|
-
return new ActiveResult(this.source,
|
|
2272
|
+
return new ActiveResult(this.source, this.explicit, limit, result, from, to);
|
|
2265
2273
|
if (result.update &&
|
|
2266
|
-
(result = result.update(result, from, to, new CompletionContext(tr.state, pos,
|
|
2267
|
-
return new ActiveResult(this.source,
|
|
2268
|
-
return new ActiveSource(this.source, 1 /* State.Pending */,
|
|
2274
|
+
(result = result.update(result, from, to, new CompletionContext(tr.state, pos, false))))
|
|
2275
|
+
return new ActiveResult(this.source, this.explicit, limit, result, result.from, (_a = result.to) !== null && _a !== void 0 ? _a : cur(tr.state));
|
|
2276
|
+
return new ActiveSource(this.source, 1 /* State.Pending */, this.explicit);
|
|
2269
2277
|
}
|
|
2270
2278
|
map(mapping) {
|
|
2271
2279
|
if (mapping.empty)
|
|
@@ -2273,7 +2281,7 @@ class ActiveResult extends ActiveSource {
|
|
|
2273
2281
|
let result = this.result.map ? this.result.map(this.result, mapping) : this.result;
|
|
2274
2282
|
if (!result)
|
|
2275
2283
|
return new ActiveSource(this.source, 0 /* State.Inactive */);
|
|
2276
|
-
return new ActiveResult(this.source, this.
|
|
2284
|
+
return new ActiveResult(this.source, this.explicit, mapping.mapPos(this.limit), this.result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));
|
|
2277
2285
|
}
|
|
2278
2286
|
touches(tr) {
|
|
2279
2287
|
return tr.changes.touchesRange(this.from, this.to);
|
|
@@ -2385,7 +2393,7 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
|
|
|
2385
2393
|
this.pendingStart = false;
|
|
2386
2394
|
this.composing = 0 /* CompositionState.None */;
|
|
2387
2395
|
for (let active of view.state.field(completionState).active)
|
|
2388
|
-
if (active.
|
|
2396
|
+
if (active.isPending)
|
|
2389
2397
|
this.startQuery(active);
|
|
2390
2398
|
}
|
|
2391
2399
|
update(update) {
|
|
@@ -2422,7 +2430,7 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
|
|
|
2422
2430
|
if (update.transactions.some(tr => tr.effects.some(e => e.is(startCompletionEffect))))
|
|
2423
2431
|
this.pendingStart = true;
|
|
2424
2432
|
let delay = this.pendingStart ? 50 : conf.activateOnTypingDelay;
|
|
2425
|
-
this.debounceUpdate = cState.active.some(a => a.
|
|
2433
|
+
this.debounceUpdate = cState.active.some(a => a.isPending && !this.running.some(q => q.active.source == a.source))
|
|
2426
2434
|
? setTimeout(() => this.startUpdate(), delay) : -1;
|
|
2427
2435
|
if (this.composing != 0 /* CompositionState.None */)
|
|
2428
2436
|
for (let tr of update.transactions) {
|
|
@@ -2437,13 +2445,15 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
|
|
|
2437
2445
|
this.pendingStart = false;
|
|
2438
2446
|
let { state } = this.view, cState = state.field(completionState);
|
|
2439
2447
|
for (let active of cState.active) {
|
|
2440
|
-
if (active.
|
|
2448
|
+
if (active.isPending && !this.running.some(r => r.active.source == active.source))
|
|
2441
2449
|
this.startQuery(active);
|
|
2442
2450
|
}
|
|
2451
|
+
if (this.running.length && cState.open && cState.open.disabled)
|
|
2452
|
+
this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime);
|
|
2443
2453
|
}
|
|
2444
2454
|
startQuery(active) {
|
|
2445
2455
|
let { state } = this.view, pos = cur(state);
|
|
2446
|
-
let context = new CompletionContext(state, pos, active.
|
|
2456
|
+
let context = new CompletionContext(state, pos, active.explicit, this.view);
|
|
2447
2457
|
let pending = new RunningQuery(active, context);
|
|
2448
2458
|
this.running.push(pending);
|
|
2449
2459
|
Promise.resolve(active.source(context)).then(result => {
|
|
@@ -2470,14 +2480,16 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
|
|
|
2470
2480
|
clearTimeout(this.debounceAccept);
|
|
2471
2481
|
this.debounceAccept = -1;
|
|
2472
2482
|
let updated = [];
|
|
2473
|
-
let conf = this.view.state.facet(completionConfig);
|
|
2483
|
+
let conf = this.view.state.facet(completionConfig), cState = this.view.state.field(completionState);
|
|
2474
2484
|
for (let i = 0; i < this.running.length; i++) {
|
|
2475
2485
|
let query = this.running[i];
|
|
2476
2486
|
if (query.done === undefined)
|
|
2477
2487
|
continue;
|
|
2478
2488
|
this.running.splice(i--, 1);
|
|
2479
2489
|
if (query.done) {
|
|
2480
|
-
let
|
|
2490
|
+
let pos = cur(query.updates.length ? query.updates[0].startState : this.view.state);
|
|
2491
|
+
let limit = Math.min(pos, query.done.from + (query.active.explicit ? 0 : 1));
|
|
2492
|
+
let active = new ActiveResult(query.active.source, query.active.explicit, limit, query.done, query.done.from, (_a = query.done.to) !== null && _a !== void 0 ? _a : pos);
|
|
2481
2493
|
// Replay the transactions that happened since the start of
|
|
2482
2494
|
// the request and see if that preserves the result
|
|
2483
2495
|
for (let tr of query.updates)
|
|
@@ -2487,15 +2499,15 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
|
|
|
2487
2499
|
continue;
|
|
2488
2500
|
}
|
|
2489
2501
|
}
|
|
2490
|
-
let current =
|
|
2491
|
-
if (current && current.
|
|
2502
|
+
let current = cState.active.find(a => a.source == query.active.source);
|
|
2503
|
+
if (current && current.isPending) {
|
|
2492
2504
|
if (query.done == null) {
|
|
2493
2505
|
// Explicitly failed. Should clear the pending status if it
|
|
2494
2506
|
// hasn't been re-set in the meantime.
|
|
2495
2507
|
let active = new ActiveSource(query.active.source, 0 /* State.Inactive */);
|
|
2496
2508
|
for (let tr of query.updates)
|
|
2497
2509
|
active = active.update(tr, conf);
|
|
2498
|
-
if (active.
|
|
2510
|
+
if (!active.isPending)
|
|
2499
2511
|
updated.push(active);
|
|
2500
2512
|
}
|
|
2501
2513
|
else {
|
|
@@ -2504,7 +2516,7 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
|
|
|
2504
2516
|
}
|
|
2505
2517
|
}
|
|
2506
2518
|
}
|
|
2507
|
-
if (updated.length)
|
|
2519
|
+
if (updated.length || cState.open && cState.open.disabled)
|
|
2508
2520
|
this.view.dispatch({ effects: setActiveEffect.of(updated) });
|
|
2509
2521
|
}
|
|
2510
2522
|
}, {
|
|
@@ -3306,7 +3318,7 @@ returns `null`.
|
|
|
3306
3318
|
*/
|
|
3307
3319
|
function completionStatus(state) {
|
|
3308
3320
|
let cState = state.field(completionState, false);
|
|
3309
|
-
return cState && cState.active.some(a => a.
|
|
3321
|
+
return cState && cState.active.some(a => a.isPending) ? "pending"
|
|
3310
3322
|
: cState && cState.active.some(a => a.state != 0 /* State.Inactive */) ? "active" : null;
|
|
3311
3323
|
}
|
|
3312
3324
|
const completionArrayCache = /*@__PURE__*/new WeakMap;
|
|
@@ -3374,28 +3386,70 @@ class LintState {
|
|
|
3374
3386
|
let diagnosticFilter = state.facet(lintConfig).markerFilter;
|
|
3375
3387
|
if (diagnosticFilter)
|
|
3376
3388
|
markedDiagnostics = diagnosticFilter(markedDiagnostics, state);
|
|
3377
|
-
let
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3389
|
+
let sorted = diagnostics.slice().sort((a, b) => a.from - b.from || a.to - b.to);
|
|
3390
|
+
let deco = new state_.RangeSetBuilder(), active = [], pos = 0;
|
|
3391
|
+
for (let i = 0;;) {
|
|
3392
|
+
let next = i == sorted.length ? null : sorted[i];
|
|
3393
|
+
if (!next && !active.length)
|
|
3394
|
+
break;
|
|
3395
|
+
let from, to;
|
|
3396
|
+
if (active.length) {
|
|
3397
|
+
from = pos;
|
|
3398
|
+
to = active.reduce((p, d) => Math.min(p, d.to), next && next.from > from ? next.from : 1e8);
|
|
3399
|
+
}
|
|
3400
|
+
else {
|
|
3401
|
+
from = next.from;
|
|
3402
|
+
to = next.to;
|
|
3403
|
+
active.push(next);
|
|
3404
|
+
i++;
|
|
3405
|
+
}
|
|
3406
|
+
while (i < sorted.length) {
|
|
3407
|
+
let next = sorted[i];
|
|
3408
|
+
if (next.from == from && (next.to > next.from || next.to == from)) {
|
|
3409
|
+
active.push(next);
|
|
3410
|
+
i++;
|
|
3411
|
+
to = Math.min(next.to, to);
|
|
3412
|
+
}
|
|
3413
|
+
else {
|
|
3414
|
+
to = Math.min(next.from, to);
|
|
3415
|
+
break;
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
let sev = maxSeverity(active);
|
|
3419
|
+
if (active.some(d => d.from == d.to || (d.from == d.to - 1 && state.doc.lineAt(d.from).to == d.from))) {
|
|
3420
|
+
deco.add(from, from, view_.Decoration.widget({
|
|
3421
|
+
widget: new DiagnosticWidget(sev),
|
|
3422
|
+
diagnostics: active.slice()
|
|
3423
|
+
}));
|
|
3424
|
+
}
|
|
3425
|
+
else {
|
|
3426
|
+
let markClass = active.reduce((c, d) => d.markClass ? c + " " + d.markClass : c, "");
|
|
3427
|
+
deco.add(from, to, view_.Decoration.mark({
|
|
3428
|
+
class: "cm-lintRange cm-lintRange-" + sev + markClass,
|
|
3429
|
+
diagnostics: active.slice(),
|
|
3430
|
+
inclusiveEnd: active.some(a => a.to > to)
|
|
3431
|
+
}));
|
|
3432
|
+
}
|
|
3433
|
+
pos = to;
|
|
3434
|
+
for (let i = 0; i < active.length; i++)
|
|
3435
|
+
if (active[i].to <= pos)
|
|
3436
|
+
active.splice(i--, 1);
|
|
3437
|
+
}
|
|
3438
|
+
let set = deco.finish();
|
|
3439
|
+
return new LintState(set, panel, findDiagnostic(set));
|
|
3390
3440
|
}
|
|
3391
3441
|
}
|
|
3392
3442
|
function findDiagnostic(diagnostics, diagnostic = null, after = 0) {
|
|
3393
3443
|
let found = null;
|
|
3394
3444
|
diagnostics.between(after, 1e9, (from, to, { spec }) => {
|
|
3395
|
-
if (diagnostic && spec.diagnostic
|
|
3445
|
+
if (diagnostic && spec.diagnostics.indexOf(diagnostic) < 0)
|
|
3396
3446
|
return;
|
|
3397
|
-
|
|
3398
|
-
|
|
3447
|
+
if (!found)
|
|
3448
|
+
found = new SelectedDiagnostic(from, to, diagnostic || spec.diagnostics[0]);
|
|
3449
|
+
else if (spec.diagnostics.indexOf(found.diagnostic) < 0)
|
|
3450
|
+
return false;
|
|
3451
|
+
else
|
|
3452
|
+
found = new SelectedDiagnostic(found.from, to, found.diagnostic);
|
|
3399
3453
|
});
|
|
3400
3454
|
return found;
|
|
3401
3455
|
}
|
|
@@ -3469,24 +3523,25 @@ function diagnosticCount(state) {
|
|
|
3469
3523
|
const activeMark = /*@__PURE__*/view_.Decoration.mark({ class: "cm-lintRange cm-lintRange-active" });
|
|
3470
3524
|
function lintTooltip(view, pos, side) {
|
|
3471
3525
|
let { diagnostics } = view.state.field(lintState);
|
|
3472
|
-
let found
|
|
3526
|
+
let found, start = -1, end = -1;
|
|
3473
3527
|
diagnostics.between(pos - (side < 0 ? 1 : 0), pos + (side > 0 ? 1 : 0), (from, to, { spec }) => {
|
|
3474
3528
|
if (pos >= from && pos <= to &&
|
|
3475
3529
|
(from == to || ((pos > from || side > 0) && (pos < to || side < 0)))) {
|
|
3476
|
-
found
|
|
3477
|
-
|
|
3478
|
-
|
|
3530
|
+
found = spec.diagnostics;
|
|
3531
|
+
start = from;
|
|
3532
|
+
end = to;
|
|
3533
|
+
return false;
|
|
3479
3534
|
}
|
|
3480
3535
|
});
|
|
3481
3536
|
let diagnosticFilter = view.state.facet(lintConfig).tooltipFilter;
|
|
3482
|
-
if (diagnosticFilter)
|
|
3537
|
+
if (found && diagnosticFilter)
|
|
3483
3538
|
found = diagnosticFilter(found, view.state);
|
|
3484
|
-
if (!found
|
|
3539
|
+
if (!found)
|
|
3485
3540
|
return null;
|
|
3486
3541
|
return {
|
|
3487
|
-
pos:
|
|
3488
|
-
end:
|
|
3489
|
-
above: view.state.doc.lineAt(
|
|
3542
|
+
pos: start,
|
|
3543
|
+
end: end,
|
|
3544
|
+
above: view.state.doc.lineAt(start).to < end,
|
|
3490
3545
|
create() {
|
|
3491
3546
|
return { dom: diagnosticsTooltip(view, found) };
|
|
3492
3547
|
}
|
|
@@ -3623,7 +3678,7 @@ function batchResults(promises, sink, error) {
|
|
|
3623
3678
|
if (collected.length == promises.length)
|
|
3624
3679
|
sink(collected);
|
|
3625
3680
|
else
|
|
3626
|
-
setTimeout(() => sink(collected), 200);
|
|
3681
|
+
timeout = setTimeout(() => sink(collected), 200);
|
|
3627
3682
|
}, error);
|
|
3628
3683
|
}
|
|
3629
3684
|
const lintConfig = /*@__PURE__*/state_.Facet.define({
|
|
@@ -3703,13 +3758,13 @@ function renderDiagnostic(view, diagnostic, inPanel) {
|
|
|
3703
3758
|
}), diagnostic.source && crelt("div", { class: "cm-diagnosticSource" }, diagnostic.source));
|
|
3704
3759
|
}
|
|
3705
3760
|
class DiagnosticWidget extends view_.WidgetType {
|
|
3706
|
-
constructor(
|
|
3761
|
+
constructor(sev) {
|
|
3707
3762
|
super();
|
|
3708
|
-
this.
|
|
3763
|
+
this.sev = sev;
|
|
3709
3764
|
}
|
|
3710
|
-
eq(other) { return other.
|
|
3765
|
+
eq(other) { return other.sev == this.sev; }
|
|
3711
3766
|
toDOM() {
|
|
3712
|
-
return crelt("span", { class: "cm-lintPoint cm-lintPoint-" + this.
|
|
3767
|
+
return crelt("span", { class: "cm-lintPoint cm-lintPoint-" + this.sev });
|
|
3713
3768
|
}
|
|
3714
3769
|
}
|
|
3715
3770
|
class PanelItem {
|
|
@@ -3792,35 +3847,41 @@ class LintPanel {
|
|
|
3792
3847
|
update() {
|
|
3793
3848
|
let { diagnostics, selected } = this.view.state.field(lintState);
|
|
3794
3849
|
let i = 0, needsSync = false, newSelectedItem = null;
|
|
3850
|
+
let seen = new Set();
|
|
3795
3851
|
diagnostics.between(0, this.view.state.doc.length, (_start, _end, { spec }) => {
|
|
3796
|
-
let
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
if (found > i) {
|
|
3810
|
-
this.items.splice(i, found - i);
|
|
3852
|
+
for (let diagnostic of spec.diagnostics) {
|
|
3853
|
+
if (seen.has(diagnostic))
|
|
3854
|
+
continue;
|
|
3855
|
+
seen.add(diagnostic);
|
|
3856
|
+
let found = -1, item;
|
|
3857
|
+
for (let j = i; j < this.items.length; j++)
|
|
3858
|
+
if (this.items[j].diagnostic == diagnostic) {
|
|
3859
|
+
found = j;
|
|
3860
|
+
break;
|
|
3861
|
+
}
|
|
3862
|
+
if (found < 0) {
|
|
3863
|
+
item = new PanelItem(this.view, diagnostic);
|
|
3864
|
+
this.items.splice(i, 0, item);
|
|
3811
3865
|
needsSync = true;
|
|
3812
3866
|
}
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3867
|
+
else {
|
|
3868
|
+
item = this.items[found];
|
|
3869
|
+
if (found > i) {
|
|
3870
|
+
this.items.splice(i, found - i);
|
|
3871
|
+
needsSync = true;
|
|
3872
|
+
}
|
|
3818
3873
|
}
|
|
3874
|
+
if (selected && item.diagnostic == selected.diagnostic) {
|
|
3875
|
+
if (!item.dom.hasAttribute("aria-selected")) {
|
|
3876
|
+
item.dom.setAttribute("aria-selected", "true");
|
|
3877
|
+
newSelectedItem = item;
|
|
3878
|
+
}
|
|
3879
|
+
}
|
|
3880
|
+
else if (item.dom.hasAttribute("aria-selected")) {
|
|
3881
|
+
item.dom.removeAttribute("aria-selected");
|
|
3882
|
+
}
|
|
3883
|
+
i++;
|
|
3819
3884
|
}
|
|
3820
|
-
else if (item.dom.hasAttribute("aria-selected")) {
|
|
3821
|
-
item.dom.removeAttribute("aria-selected");
|
|
3822
|
-
}
|
|
3823
|
-
i++;
|
|
3824
3885
|
});
|
|
3825
3886
|
while (i < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0)) {
|
|
3826
3887
|
needsSync = true;
|
|
@@ -3989,11 +4050,22 @@ const lint_dist_baseTheme = /*@__PURE__*/view_.EditorView.baseTheme({
|
|
|
3989
4050
|
function severityWeight(sev) {
|
|
3990
4051
|
return sev == "error" ? 4 : sev == "warning" ? 3 : sev == "info" ? 2 : 1;
|
|
3991
4052
|
}
|
|
4053
|
+
function maxSeverity(diagnostics) {
|
|
4054
|
+
let sev = "hint", weight = 1;
|
|
4055
|
+
for (let d of diagnostics) {
|
|
4056
|
+
let w = severityWeight(d.severity);
|
|
4057
|
+
if (w > weight) {
|
|
4058
|
+
weight = w;
|
|
4059
|
+
sev = d.severity;
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
return sev;
|
|
4063
|
+
}
|
|
3992
4064
|
class LintGutterMarker extends view_.GutterMarker {
|
|
3993
4065
|
constructor(diagnostics) {
|
|
3994
4066
|
super();
|
|
3995
4067
|
this.diagnostics = diagnostics;
|
|
3996
|
-
this.severity = diagnostics
|
|
4068
|
+
this.severity = maxSeverity(diagnostics);
|
|
3997
4069
|
}
|
|
3998
4070
|
toDOM(view) {
|
|
3999
4071
|
let elt = document.createElement("div");
|
|
@@ -4031,6 +4103,7 @@ function gutterMarkerMouseOver(view, marker, diagnostics) {
|
|
|
4031
4103
|
view.dispatch({ effects: setLintGutterTooltip.of({
|
|
4032
4104
|
pos: line.from,
|
|
4033
4105
|
above: false,
|
|
4106
|
+
clip: false,
|
|
4034
4107
|
create() {
|
|
4035
4108
|
return {
|
|
4036
4109
|
dom: diagnosticsTooltip(view, diagnostics),
|
|
@@ -4071,7 +4144,8 @@ const lintGutterExtension = /*@__PURE__*/(0,view_.gutter)({
|
|
|
4071
4144
|
widgetMarker: (view, widget, block) => {
|
|
4072
4145
|
let diagnostics = [];
|
|
4073
4146
|
view.state.field(lintGutterMarkers).between(block.from, block.to, (from, to, value) => {
|
|
4074
|
-
|
|
4147
|
+
if (from > block.from && from < block.to)
|
|
4148
|
+
diagnostics.push(...value.diagnostics);
|
|
4075
4149
|
});
|
|
4076
4150
|
return diagnostics.length ? new LintGutterMarker(diagnostics) : null;
|
|
4077
4151
|
}
|
|
@@ -4162,9 +4236,25 @@ arguments hold the diagnostic's current position.
|
|
|
4162
4236
|
*/
|
|
4163
4237
|
function forEachDiagnostic(state, f) {
|
|
4164
4238
|
let lState = state.field(lintState, false);
|
|
4165
|
-
if (lState && lState.diagnostics.size)
|
|
4166
|
-
|
|
4167
|
-
|
|
4239
|
+
if (lState && lState.diagnostics.size) {
|
|
4240
|
+
let pending = [], pendingStart = [], lastEnd = -1;
|
|
4241
|
+
for (let iter = RangeSet.iter([lState.diagnostics]);; iter.next()) {
|
|
4242
|
+
for (let i = 0; i < pending.length; i++)
|
|
4243
|
+
if (!iter.value || iter.value.spec.diagnostics.indexOf(pending[i]) < 0) {
|
|
4244
|
+
f(pending[i], pendingStart[i], lastEnd);
|
|
4245
|
+
pending.splice(i, 1);
|
|
4246
|
+
pendingStart.splice(i--, 1);
|
|
4247
|
+
}
|
|
4248
|
+
if (!iter.value)
|
|
4249
|
+
break;
|
|
4250
|
+
for (let d of iter.value.spec.diagnostics)
|
|
4251
|
+
if (pending.indexOf(d) < 0) {
|
|
4252
|
+
pending.push(d);
|
|
4253
|
+
pendingStart.push(iter.from);
|
|
4254
|
+
}
|
|
4255
|
+
lastEnd = iter.to;
|
|
4256
|
+
}
|
|
4257
|
+
}
|
|
4168
4258
|
}
|
|
4169
4259
|
|
|
4170
4260
|
|
|
@@ -9661,8 +9751,8 @@ class StreamLanguage extends Language {
|
|
|
9661
9751
|
return new Parse(self, input, fragments, ranges);
|
|
9662
9752
|
}
|
|
9663
9753
|
};
|
|
9664
|
-
super(data, impl, [
|
|
9665
|
-
this.topNode = docID(data);
|
|
9754
|
+
super(data, impl, [], parser.name);
|
|
9755
|
+
this.topNode = docID(data, this);
|
|
9666
9756
|
self = this;
|
|
9667
9757
|
this.streamParser = p;
|
|
9668
9758
|
this.stateAfter = new dist/* NodeProp */.uY({ perNode: true });
|
|
@@ -9672,20 +9762,18 @@ class StreamLanguage extends Language {
|
|
|
9672
9762
|
Define a stream language.
|
|
9673
9763
|
*/
|
|
9674
9764
|
static define(spec) { return new StreamLanguage(spec); }
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
if (!at)
|
|
9680
|
-
return null;
|
|
9765
|
+
/**
|
|
9766
|
+
@internal
|
|
9767
|
+
*/
|
|
9768
|
+
getIndent(cx) {
|
|
9681
9769
|
let from = undefined;
|
|
9682
9770
|
let { overrideIndentation } = cx.options;
|
|
9683
9771
|
if (overrideIndentation) {
|
|
9684
9772
|
from = IndentedFrom.get(cx.state);
|
|
9685
|
-
if (from != null && from < pos - 1e4)
|
|
9773
|
+
if (from != null && from < cx.pos - 1e4)
|
|
9686
9774
|
from = undefined;
|
|
9687
9775
|
}
|
|
9688
|
-
let start = findState(this, tree, 0,
|
|
9776
|
+
let start = findState(this, cx.node.tree, 0, cx.node.from, from !== null && from !== void 0 ? from : cx.pos), statePos, state;
|
|
9689
9777
|
if (start) {
|
|
9690
9778
|
state = start.state;
|
|
9691
9779
|
statePos = start.pos + 1;
|
|
@@ -9694,10 +9782,10 @@ class StreamLanguage extends Language {
|
|
|
9694
9782
|
state = this.streamParser.startState(cx.unit);
|
|
9695
9783
|
statePos = 0;
|
|
9696
9784
|
}
|
|
9697
|
-
if (pos - statePos > 10000 /* C.MaxIndentScanDist */)
|
|
9785
|
+
if (cx.pos - statePos > 10000 /* C.MaxIndentScanDist */)
|
|
9698
9786
|
return null;
|
|
9699
|
-
while (statePos < pos) {
|
|
9700
|
-
let line = cx.state.doc.lineAt(statePos), end = Math.min(pos, line.to);
|
|
9787
|
+
while (statePos < cx.pos) {
|
|
9788
|
+
let line = cx.state.doc.lineAt(statePos), end = Math.min(cx.pos, line.to);
|
|
9701
9789
|
if (line.length) {
|
|
9702
9790
|
let indentation = overrideIndentation ? overrideIndentation(line.from) : -1;
|
|
9703
9791
|
let stream = new StringStream(line.text, cx.state.tabSize, cx.unit, indentation < 0 ? undefined : indentation);
|
|
@@ -9707,11 +9795,11 @@ class StreamLanguage extends Language {
|
|
|
9707
9795
|
else {
|
|
9708
9796
|
this.streamParser.blankLine(state, cx.unit);
|
|
9709
9797
|
}
|
|
9710
|
-
if (end == pos)
|
|
9798
|
+
if (end == cx.pos)
|
|
9711
9799
|
break;
|
|
9712
9800
|
statePos = line.to + 1;
|
|
9713
9801
|
}
|
|
9714
|
-
let line = cx.lineAt(pos);
|
|
9802
|
+
let line = cx.lineAt(cx.pos);
|
|
9715
9803
|
if (overrideIndentation && from == null)
|
|
9716
9804
|
IndentedFrom.set(cx.state, line.from);
|
|
9717
9805
|
return this.streamParser.indent(state, /^\s*(.*)/.exec(line.text)[1], cx);
|
|
@@ -9733,7 +9821,7 @@ function findState(lang, tree, off, startPos, before) {
|
|
|
9733
9821
|
function cutTree(lang, tree, from, to, inside) {
|
|
9734
9822
|
if (inside && from <= 0 && to >= tree.length)
|
|
9735
9823
|
return tree;
|
|
9736
|
-
if (!inside && tree.type == lang.topNode)
|
|
9824
|
+
if (!inside && from == 0 && tree.type == lang.topNode)
|
|
9737
9825
|
inside = true;
|
|
9738
9826
|
for (let i = tree.children.length - 1; i >= 0; i--) {
|
|
9739
9827
|
let pos = tree.positions[i], child = tree.children[i], inner;
|
|
@@ -9746,11 +9834,11 @@ function cutTree(lang, tree, from, to, inside) {
|
|
|
9746
9834
|
}
|
|
9747
9835
|
return null;
|
|
9748
9836
|
}
|
|
9749
|
-
function findStartInFragments(lang, fragments, startPos, editorState) {
|
|
9837
|
+
function findStartInFragments(lang, fragments, startPos, endPos, editorState) {
|
|
9750
9838
|
for (let f of fragments) {
|
|
9751
9839
|
let from = f.from + (f.openStart ? 25 : 0), to = f.to - (f.openEnd ? 25 : 0);
|
|
9752
9840
|
let found = from <= startPos && to > startPos && findState(lang, f.tree, 0 - f.offset, startPos, to), tree;
|
|
9753
|
-
if (found && (tree = cutTree(lang, f.tree, startPos + f.offset, found.pos + f.offset, false)))
|
|
9841
|
+
if (found && found.pos <= endPos && (tree = cutTree(lang, f.tree, startPos + f.offset, found.pos + f.offset, false)))
|
|
9754
9842
|
return { state: found.state, tree };
|
|
9755
9843
|
}
|
|
9756
9844
|
return { state: lang.streamParser.startState(editorState ? getIndentUnit(editorState) : 4), tree: dist/* Tree */.PH.empty };
|
|
@@ -9769,14 +9857,15 @@ class Parse {
|
|
|
9769
9857
|
this.rangeIndex = 0;
|
|
9770
9858
|
this.to = ranges[ranges.length - 1].to;
|
|
9771
9859
|
let context = ParseContext.get(), from = ranges[0].from;
|
|
9772
|
-
let { state, tree } = findStartInFragments(lang, fragments, from, context === null || context === void 0 ? void 0 : context.state);
|
|
9860
|
+
let { state, tree } = findStartInFragments(lang, fragments, from, this.to, context === null || context === void 0 ? void 0 : context.state);
|
|
9773
9861
|
this.state = state;
|
|
9774
9862
|
this.parsedPos = this.chunkStart = from + tree.length;
|
|
9775
9863
|
for (let i = 0; i < tree.children.length; i++) {
|
|
9776
9864
|
this.chunks.push(tree.children[i]);
|
|
9777
9865
|
this.chunkPos.push(tree.positions[i]);
|
|
9778
9866
|
}
|
|
9779
|
-
if (context && this.parsedPos < context.viewport.from - 100000 /* C.MaxDistanceBeforeViewport */
|
|
9867
|
+
if (context && this.parsedPos < context.viewport.from - 100000 /* C.MaxDistanceBeforeViewport */ &&
|
|
9868
|
+
ranges.some(r => r.from <= context.viewport.from && r.to >= context.viewport.from)) {
|
|
9780
9869
|
this.state = this.lang.streamParser.startState(getIndentUnit(context.state));
|
|
9781
9870
|
context.skipUntilInView(this.parsedPos, context.viewport.from);
|
|
9782
9871
|
this.parsedPos = context.viewport.from;
|
|
@@ -9847,7 +9936,8 @@ class Parse {
|
|
|
9847
9936
|
while (this.ranges[this.rangeIndex].to < this.parsedPos)
|
|
9848
9937
|
this.rangeIndex++;
|
|
9849
9938
|
}
|
|
9850
|
-
emitToken(id, from, to,
|
|
9939
|
+
emitToken(id, from, to, offset) {
|
|
9940
|
+
let size = 4;
|
|
9851
9941
|
if (this.ranges.length > 1) {
|
|
9852
9942
|
offset = this.skipGapsTo(from, offset, 1);
|
|
9853
9943
|
from += offset;
|
|
@@ -9856,7 +9946,11 @@ class Parse {
|
|
|
9856
9946
|
to += offset;
|
|
9857
9947
|
size += this.chunk.length - len0;
|
|
9858
9948
|
}
|
|
9859
|
-
this.chunk.
|
|
9949
|
+
let last = this.chunk.length - 4;
|
|
9950
|
+
if (size == 4 && last >= 0 && this.chunk[last] == id && this.chunk[last + 2] == from)
|
|
9951
|
+
this.chunk[last + 2] = to;
|
|
9952
|
+
else
|
|
9953
|
+
this.chunk.push(id, from, to, size);
|
|
9860
9954
|
return offset;
|
|
9861
9955
|
}
|
|
9862
9956
|
parseLine(context) {
|
|
@@ -9869,7 +9963,7 @@ class Parse {
|
|
|
9869
9963
|
while (!stream.eol()) {
|
|
9870
9964
|
let token = readToken(streamParser.token, stream, this.state);
|
|
9871
9965
|
if (token)
|
|
9872
|
-
offset = this.emitToken(this.lang.tokenTable.resolve(token), this.parsedPos + stream.start, this.parsedPos + stream.pos,
|
|
9966
|
+
offset = this.emitToken(this.lang.tokenTable.resolve(token), this.parsedPos + stream.start, this.parsedPos + stream.pos, offset);
|
|
9873
9967
|
if (stream.start > 10000 /* C.MaxLineLength */)
|
|
9874
9968
|
break;
|
|
9875
9969
|
}
|
|
@@ -9986,8 +10080,11 @@ function createTokenType(extra, tagStr) {
|
|
|
9986
10080
|
typeArray.push(type);
|
|
9987
10081
|
return type.id;
|
|
9988
10082
|
}
|
|
9989
|
-
function docID(data) {
|
|
9990
|
-
let type = dist/* NodeType */.Z6.define({ id: typeArray.length, name: "Document", props: [
|
|
10083
|
+
function docID(data, lang) {
|
|
10084
|
+
let type = dist/* NodeType */.Z6.define({ id: typeArray.length, name: "Document", props: [
|
|
10085
|
+
languageDataProp.add(() => data),
|
|
10086
|
+
indentNodeProp.add(() => cx => lang.getIndent(cx))
|
|
10087
|
+
], top: true });
|
|
9991
10088
|
typeArray.push(type);
|
|
9992
10089
|
return type;
|
|
9993
10090
|
}
|
|
@@ -12368,37 +12465,37 @@ function enterFragments(mounts, ranges) {
|
|
|
12368
12465
|
var __webpack_exports__ = {};
|
|
12369
12466
|
__webpack_require__.r(__webpack_exports__);
|
|
12370
12467
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12371
|
-
/* harmony export */ basicSetup: () => (/* reexport safe */
|
|
12372
|
-
/* harmony export */ "default": () => (
|
|
12373
|
-
/* harmony export */ getStatistics: () => (/* reexport safe */
|
|
12374
|
-
/* harmony export */ minimalSetup: () => (/* reexport safe */
|
|
12375
|
-
/* harmony export */ useCodeMirror: () => (/* reexport safe */
|
|
12468
|
+
/* harmony export */ basicSetup: () => (/* reexport safe */ src_uiw_codemirror_extensions_basic_setup_WEBPACK_IMPORTED_MODULE_5_.o),
|
|
12469
|
+
/* harmony export */ "default": () => (src),
|
|
12470
|
+
/* harmony export */ getStatistics: () => (/* reexport safe */ src_utils_WEBPACK_IMPORTED_MODULE_7_.m),
|
|
12471
|
+
/* harmony export */ minimalSetup: () => (/* reexport safe */ src_uiw_codemirror_extensions_basic_setup_WEBPACK_IMPORTED_MODULE_5_.V),
|
|
12472
|
+
/* harmony export */ useCodeMirror: () => (/* reexport safe */ src_useCodeMirror_WEBPACK_IMPORTED_MODULE_1_.q)
|
|
12376
12473
|
/* harmony export */ });
|
|
12377
|
-
/* harmony import */ var
|
|
12378
|
-
/* harmony import */ var
|
|
12379
|
-
/* harmony import */ var
|
|
12380
|
-
/* harmony import */ var
|
|
12381
|
-
/* harmony import */ var
|
|
12382
|
-
/* harmony import */ var
|
|
12383
|
-
/* harmony import */ var
|
|
12384
|
-
/* harmony import */ var
|
|
12385
|
-
/* harmony import */ var
|
|
12386
|
-
/* harmony reexport (unknown) */ var
|
|
12387
|
-
/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in
|
|
12388
|
-
/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__,
|
|
12389
|
-
/* harmony import */ var
|
|
12390
|
-
/* harmony import */ var
|
|
12391
|
-
/* harmony reexport (unknown) */ var
|
|
12392
|
-
/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in
|
|
12393
|
-
/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__,
|
|
12394
|
-
/* harmony import */ var
|
|
12395
|
-
/* harmony import */ var
|
|
12396
|
-
/* harmony reexport (unknown) */ var
|
|
12397
|
-
/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in
|
|
12398
|
-
/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__,
|
|
12399
|
-
/* harmony import */ var
|
|
12400
|
-
var
|
|
12401
|
-
if(typeof value!=='string'){throw new Error("value must be typeof string but got ".concat(typeof value));}var defaultClassNames=typeof theme==='string'?"cm-theme-".concat(theme):'cm-theme';return/*#__PURE__*/(0,
|
|
12474
|
+
/* harmony import */ var src_home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectSpread2_js_WEBPACK_IMPORTED_MODULE_9_ = __webpack_require__(957);
|
|
12475
|
+
/* harmony import */ var src_home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js_WEBPACK_IMPORTED_MODULE_8_ = __webpack_require__(644);
|
|
12476
|
+
/* harmony import */ var src_react_WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(442);
|
|
12477
|
+
/* harmony import */ var src_react_WEBPACK_IMPORTED_MODULE_0_default = /*#__PURE__*/__webpack_require__.n(src_react_WEBPACK_IMPORTED_MODULE_0_);
|
|
12478
|
+
/* harmony import */ var src_useCodeMirror_WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(695);
|
|
12479
|
+
/* harmony import */ var src_react_jsx_runtime_WEBPACK_IMPORTED_MODULE_2_ = __webpack_require__(742);
|
|
12480
|
+
/* harmony import */ var src_react_jsx_runtime_WEBPACK_IMPORTED_MODULE_2_default = /*#__PURE__*/__webpack_require__.n(src_react_jsx_runtime_WEBPACK_IMPORTED_MODULE_2_);
|
|
12481
|
+
/* harmony import */ var src_codemirror_view_WEBPACK_IMPORTED_MODULE_3_ = __webpack_require__(730);
|
|
12482
|
+
/* harmony import */ var src_codemirror_view_WEBPACK_IMPORTED_MODULE_3_default = /*#__PURE__*/__webpack_require__.n(src_codemirror_view_WEBPACK_IMPORTED_MODULE_3_);
|
|
12483
|
+
/* harmony reexport (unknown) */ var src_WEBPACK_REEXPORT_OBJECT_ = {};
|
|
12484
|
+
/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in src_codemirror_view_WEBPACK_IMPORTED_MODULE_3_) if(__WEBPACK_IMPORT_KEY__ !== "default") src_WEBPACK_REEXPORT_OBJECT_[__WEBPACK_IMPORT_KEY__] = () => src_codemirror_view_WEBPACK_IMPORTED_MODULE_3_[__WEBPACK_IMPORT_KEY__]
|
|
12485
|
+
/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, src_WEBPACK_REEXPORT_OBJECT_);
|
|
12486
|
+
/* harmony import */ var src_codemirror_state_WEBPACK_IMPORTED_MODULE_4_ = __webpack_require__(60);
|
|
12487
|
+
/* harmony import */ var src_codemirror_state_WEBPACK_IMPORTED_MODULE_4_default = /*#__PURE__*/__webpack_require__.n(src_codemirror_state_WEBPACK_IMPORTED_MODULE_4_);
|
|
12488
|
+
/* harmony reexport (unknown) */ var src_WEBPACK_REEXPORT_OBJECT_ = {};
|
|
12489
|
+
/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in src_codemirror_state_WEBPACK_IMPORTED_MODULE_4_) if(__WEBPACK_IMPORT_KEY__ !== "default") src_WEBPACK_REEXPORT_OBJECT_[__WEBPACK_IMPORT_KEY__] = () => src_codemirror_state_WEBPACK_IMPORTED_MODULE_4_[__WEBPACK_IMPORT_KEY__]
|
|
12490
|
+
/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, src_WEBPACK_REEXPORT_OBJECT_);
|
|
12491
|
+
/* harmony import */ var src_uiw_codemirror_extensions_basic_setup_WEBPACK_IMPORTED_MODULE_5_ = __webpack_require__(368);
|
|
12492
|
+
/* harmony import */ var src_getDefaultExtensions_WEBPACK_IMPORTED_MODULE_6_ = __webpack_require__(89);
|
|
12493
|
+
/* harmony reexport (unknown) */ var src_WEBPACK_REEXPORT_OBJECT_ = {};
|
|
12494
|
+
/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in src_getDefaultExtensions_WEBPACK_IMPORTED_MODULE_6_) if(["default","basicSetup","minimalSetup","useCodeMirror"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) src_WEBPACK_REEXPORT_OBJECT_[__WEBPACK_IMPORT_KEY__] = () => src_getDefaultExtensions_WEBPACK_IMPORTED_MODULE_6_[__WEBPACK_IMPORT_KEY__]
|
|
12495
|
+
/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, src_WEBPACK_REEXPORT_OBJECT_);
|
|
12496
|
+
/* harmony import */ var src_utils_WEBPACK_IMPORTED_MODULE_7_ = __webpack_require__(369);
|
|
12497
|
+
var src_excluded=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"];var src_ReactCodeMirror=/*#__PURE__*/(0,src_react_WEBPACK_IMPORTED_MODULE_0_.forwardRef)(function(props,ref){var className=props.className,_props$value=props.value,value=_props$value===void 0?'':_props$value,selection=props.selection,_props$extensions=props.extensions,extensions=_props$extensions===void 0?[]:_props$extensions,onChange=props.onChange,onStatistics=props.onStatistics,onCreateEditor=props.onCreateEditor,onUpdate=props.onUpdate,autoFocus=props.autoFocus,_props$theme=props.theme,theme=_props$theme===void 0?'light':_props$theme,height=props.height,minHeight=props.minHeight,maxHeight=props.maxHeight,width=props.width,minWidth=props.minWidth,maxWidth=props.maxWidth,basicSetup=props.basicSetup,placeholder=props.placeholder,indentWithTab=props.indentWithTab,editable=props.editable,readOnly=props.readOnly,root=props.root,initialState=props.initialState,other=(0,src_home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js_WEBPACK_IMPORTED_MODULE_8_/* ["default"] */ .A)(props,src_excluded);var editor=(0,src_react_WEBPACK_IMPORTED_MODULE_0_.useRef)(null);var _useCodeMirror=(0,src_useCodeMirror_WEBPACK_IMPORTED_MODULE_1_/* .useCodeMirror */ .q)({container:editor.current,root:root,value:value,autoFocus:autoFocus,theme:theme,height:height,minHeight:minHeight,maxHeight:maxHeight,width:width,minWidth:minWidth,maxWidth:maxWidth,basicSetup:basicSetup,placeholder:placeholder,indentWithTab:indentWithTab,editable:editable,readOnly:readOnly,selection:selection,onChange:onChange,onStatistics:onStatistics,onCreateEditor:onCreateEditor,onUpdate:onUpdate,extensions:extensions,initialState:initialState}),state=_useCodeMirror.state,view=_useCodeMirror.view,container=_useCodeMirror.container;(0,src_react_WEBPACK_IMPORTED_MODULE_0_.useImperativeHandle)(ref,function(){return{editor:editor.current,state:state,view:view};},[editor,container,state,view]);// check type of value
|
|
12498
|
+
if(typeof value!=='string'){throw new Error("value must be typeof string but got ".concat(typeof value));}var defaultClassNames=typeof theme==='string'?"cm-theme-".concat(theme):'cm-theme';return/*#__PURE__*/(0,src_react_jsx_runtime_WEBPACK_IMPORTED_MODULE_2_.jsx)("div",(0,src_home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectSpread2_js_WEBPACK_IMPORTED_MODULE_9_/* ["default"] */ .A)({ref:editor,className:"".concat(defaultClassNames).concat(className?" ".concat(className):'')},other));});src_ReactCodeMirror.displayName='CodeMirror';/* harmony default export */ const src = (src_ReactCodeMirror);
|
|
12402
12499
|
/******/ return __webpack_exports__;
|
|
12403
12500
|
/******/ })()
|
|
12404
12501
|
;
|