@uiw/react-codemirror 4.22.1 → 4.23.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.
@@ -1310,10 +1310,19 @@ class CompletionContext {
1310
1310
  only return completions when either there is part of a
1311
1311
  completable entity before the cursor, or `explicit` is true.
1312
1312
  */
1313
- explicit) {
1313
+ explicit,
1314
+ /**
1315
+ The editor view. May be undefined if the context was created
1316
+ in a situation where there is no such view available, such as
1317
+ in synchronous updates via
1318
+ [`CompletionResult.update`](https://codemirror.net/6/docs/ref/#autocomplete.CompletionResult.update)
1319
+ or when called by test code.
1320
+ */
1321
+ view) {
1314
1322
  this.state = state;
1315
1323
  this.pos = pos;
1316
1324
  this.explicit = explicit;
1325
+ this.view = view;
1317
1326
  /**
1318
1327
  @internal
1319
1328
  */
@@ -2134,7 +2143,7 @@ class CompletionState {
2134
2143
  return active == this.active && open == this.open ? this : new CompletionState(active, this.id, open);
2135
2144
  }
2136
2145
  get tooltip() { return this.open ? this.open.tooltip : null; }
2137
- get attrs() { return this.open ? this.open.attrs : baseAttrs; }
2146
+ get attrs() { return this.open ? this.open.attrs : this.active.length ? baseAttrs : noAttrs; }
2138
2147
  }
2139
2148
  function sameResults(a, b) {
2140
2149
  if (a == b)
@@ -2154,6 +2163,7 @@ function sameResults(a, b) {
2154
2163
  const baseAttrs = {
2155
2164
  "aria-autocomplete": "list"
2156
2165
  };
2166
+ const noAttrs = {};
2157
2167
  function makeAttrs(id, selected) {
2158
2168
  let result = {
2159
2169
  "aria-autocomplete": "list",
@@ -2165,13 +2175,18 @@ function makeAttrs(id, selected) {
2165
2175
  return result;
2166
2176
  }
2167
2177
  const none = [];
2168
- function getUserEvent(tr, conf) {
2178
+ function getUpdateType(tr, conf) {
2169
2179
  if (tr.isUserEvent("input.complete")) {
2170
2180
  let completion = tr.annotation(pickedCompletion);
2171
2181
  if (completion && conf.activateOnCompletion(completion))
2172
- return "input";
2182
+ return 4 /* UpdateType.Activate */ | 8 /* UpdateType.Reset */;
2173
2183
  }
2174
- return tr.isUserEvent("input.type") ? "input" : tr.isUserEvent("delete.backward") ? "delete" : null;
2184
+ let typing = tr.isUserEvent("input.type");
2185
+ return typing && conf.activateOnTyping ? 4 /* UpdateType.Activate */ | 1 /* UpdateType.Typing */
2186
+ : typing ? 1 /* UpdateType.Typing */
2187
+ : tr.isUserEvent("delete.backward") ? 2 /* UpdateType.Backspacing */
2188
+ : tr.selection ? 8 /* UpdateType.Reset */
2189
+ : tr.docChanged ? 16 /* UpdateType.ResetIfTouching */ : 0 /* UpdateType.None */;
2175
2190
  }
2176
2191
  class ActiveSource {
2177
2192
  constructor(source, state, explicitPos = -1) {
@@ -2181,13 +2196,12 @@ class ActiveSource {
2181
2196
  }
2182
2197
  hasResult() { return false; }
2183
2198
  update(tr, conf) {
2184
- let event = getUserEvent(tr, conf), value = this;
2185
- if (event)
2186
- value = value.handleUserEvent(tr, event, conf);
2187
- else if (tr.docChanged)
2188
- value = value.handleChange(tr);
2189
- else if (tr.selection && value.state != 0 /* State.Inactive */)
2199
+ let type = getUpdateType(tr, conf), value = this;
2200
+ if ((type & 8 /* UpdateType.Reset */) || (type & 16 /* UpdateType.ResetIfTouching */) && this.touches(tr))
2190
2201
  value = new ActiveSource(value.source, 0 /* State.Inactive */);
2202
+ if ((type & 4 /* UpdateType.Activate */) && value.state == 0 /* State.Inactive */)
2203
+ value = new ActiveSource(this.source, 1 /* State.Pending */);
2204
+ value = value.updateFor(tr, type);
2191
2205
  for (let effect of tr.effects) {
2192
2206
  if (effect.is(startCompletionEffect))
2193
2207
  value = new ActiveSource(value.source, 1 /* State.Pending */, effect.value ? cur(tr.state) : -1);
@@ -2200,15 +2214,13 @@ class ActiveSource {
2200
2214
  }
2201
2215
  return value;
2202
2216
  }
2203
- handleUserEvent(tr, type, conf) {
2204
- return type == "delete" || !conf.activateOnTyping ? this.map(tr.changes) : new ActiveSource(this.source, 1 /* State.Pending */);
2205
- }
2206
- handleChange(tr) {
2207
- return tr.changes.touchesRange(cur(tr.startState)) ? new ActiveSource(this.source, 0 /* State.Inactive */) : this.map(tr.changes);
2208
- }
2217
+ updateFor(tr, type) { return this.map(tr.changes); }
2209
2218
  map(changes) {
2210
2219
  return changes.empty || this.explicitPos < 0 ? this : new ActiveSource(this.source, this.state, changes.mapPos(this.explicitPos));
2211
2220
  }
2221
+ touches(tr) {
2222
+ return tr.changes.touchesRange(cur(tr.state));
2223
+ }
2212
2224
  }
2213
2225
  class ActiveResult extends ActiveSource {
2214
2226
  constructor(source, explicitPos, result, from, to) {
@@ -2218,8 +2230,10 @@ class ActiveResult extends ActiveSource {
2218
2230
  this.to = to;
2219
2231
  }
2220
2232
  hasResult() { return true; }
2221
- handleUserEvent(tr, type, conf) {
2233
+ updateFor(tr, type) {
2222
2234
  var _a;
2235
+ if (!(type & 3 /* UpdateType.SimpleInteraction */))
2236
+ return this.map(tr.changes);
2223
2237
  let result = this.result;
2224
2238
  if (result.map && !tr.changes.empty)
2225
2239
  result = result.map(result, tr.changes);
@@ -2227,8 +2241,8 @@ class ActiveResult extends ActiveSource {
2227
2241
  let pos = cur(tr.state);
2228
2242
  if ((this.explicitPos < 0 ? pos <= from : pos < this.from) ||
2229
2243
  pos > to || !result ||
2230
- type == "delete" && cur(tr.startState) == this.from)
2231
- return new ActiveSource(this.source, type == "input" && conf.activateOnTyping ? 1 /* State.Pending */ : 0 /* State.Inactive */);
2244
+ (type & 2 /* UpdateType.Backspacing */) && cur(tr.startState) == this.from)
2245
+ return new ActiveSource(this.source, type & 4 /* UpdateType.Activate */ ? 1 /* State.Pending */ : 0 /* State.Inactive */);
2232
2246
  let explicitPos = this.explicitPos < 0 ? -1 : tr.changes.mapPos(this.explicitPos);
2233
2247
  if (checkValid(result.validFor, tr.state, from, to))
2234
2248
  return new ActiveResult(this.source, explicitPos, result, from, to);
@@ -2237,9 +2251,6 @@ class ActiveResult extends ActiveSource {
2237
2251
  return new ActiveResult(this.source, explicitPos, result, result.from, (_a = result.to) !== null && _a !== void 0 ? _a : cur(tr.state));
2238
2252
  return new ActiveSource(this.source, 1 /* State.Pending */, explicitPos);
2239
2253
  }
2240
- handleChange(tr) {
2241
- return tr.changes.touchesRange(this.from, this.to) ? new ActiveSource(this.source, 0 /* State.Inactive */) : this.map(tr.changes);
2242
- }
2243
2254
  map(mapping) {
2244
2255
  if (mapping.empty)
2245
2256
  return this;
@@ -2248,6 +2259,9 @@ class ActiveResult extends ActiveSource {
2248
2259
  return new ActiveSource(this.source, 0 /* State.Inactive */);
2249
2260
  return new ActiveResult(this.source, this.explicitPos < 0 ? -1 : mapping.mapPos(this.explicitPos), this.result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));
2250
2261
  }
2262
+ touches(tr) {
2263
+ return tr.changes.touchesRange(this.from, this.to);
2264
+ }
2251
2265
  }
2252
2266
  function checkValid(validFor, state, from, to) {
2253
2267
  if (!validFor)
@@ -2364,7 +2378,8 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
2364
2378
  if (!update.selectionSet && !update.docChanged && update.startState.field(completionState) == cState)
2365
2379
  return;
2366
2380
  let doesReset = update.transactions.some(tr => {
2367
- return (tr.selection || tr.docChanged) && !getUserEvent(tr, conf);
2381
+ let type = getUpdateType(tr, conf);
2382
+ return (type & 8 /* UpdateType.Reset */) || (tr.selection || tr.docChanged) && !(type & 3 /* UpdateType.SimpleInteraction */);
2368
2383
  });
2369
2384
  for (let i = 0; i < this.running.length; i++) {
2370
2385
  let query = this.running[i];
@@ -2394,7 +2409,7 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
2394
2409
  ? setTimeout(() => this.startUpdate(), delay) : -1;
2395
2410
  if (this.composing != 0 /* CompositionState.None */)
2396
2411
  for (let tr of update.transactions) {
2397
- if (getUserEvent(tr, conf) == "input")
2412
+ if (tr.isUserEvent("input.type"))
2398
2413
  this.composing = 2 /* CompositionState.Changed */;
2399
2414
  else if (this.composing == 2 /* CompositionState.Changed */ && tr.selection)
2400
2415
  this.composing = 3 /* CompositionState.ChangedAndMoved */;
@@ -2411,7 +2426,7 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
2411
2426
  }
2412
2427
  startQuery(active) {
2413
2428
  let { state } = this.view, pos = cur(state);
2414
- let context = new CompletionContext(state, pos, active.explicitPos == pos);
2429
+ let context = new CompletionContext(state, pos, active.explicitPos == pos, this.view);
2415
2430
  let pending = new RunningQuery(active, context);
2416
2431
  this.running.push(pending);
2417
2432
  Promise.resolve(active.source(context)).then(result => {
@@ -2683,8 +2698,9 @@ class Snippet {
2683
2698
  let fields = [];
2684
2699
  let lines = [], positions = [], m;
2685
2700
  for (let line of template.split(/\r\n?|\n/)) {
2686
- while (m = /[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(line)) {
2687
- let seq = m[1] ? +m[1] : null, name = m[2] || m[3] || "", found = -1;
2701
+ while (m = /[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(line)) {
2702
+ let seq = m[1] ? +m[1] : null, rawName = m[2] || m[3] || "", found = -1;
2703
+ let name = rawName.replace(/\\[{}]/g, m => m[1]);
2688
2704
  for (let i = 0; i < fields.length; i++) {
2689
2705
  if (seq != null ? fields[i].seq == seq : name ? fields[i].name == name : false)
2690
2706
  found = i;
@@ -2700,16 +2716,16 @@ class Snippet {
2700
2716
  pos.field++;
2701
2717
  }
2702
2718
  positions.push(new FieldPos(found, lines.length, m.index, m.index + name.length));
2703
- line = line.slice(0, m.index) + name + line.slice(m.index + m[0].length);
2719
+ line = line.slice(0, m.index) + rawName + line.slice(m.index + m[0].length);
2704
2720
  }
2705
- for (let esc; esc = /\\([{}])/.exec(line);) {
2706
- line = line.slice(0, esc.index) + esc[1] + line.slice(esc.index + esc[0].length);
2721
+ line = line.replace(/\\([{}])/g, (_, brace, index) => {
2707
2722
  for (let pos of positions)
2708
- if (pos.line == lines.length && pos.from > esc.index) {
2723
+ if (pos.line == lines.length && pos.from > index) {
2709
2724
  pos.from--;
2710
2725
  pos.to--;
2711
2726
  }
2712
- }
2727
+ return brace;
2728
+ });
2713
2729
  lines.push(line);
2714
2730
  }
2715
2731
  return new Snippet(lines, positions);
@@ -3348,8 +3364,7 @@ class LintState {
3348
3364
  }).range(d.from)
3349
3365
  : view_.Decoration.mark({
3350
3366
  attributes: { class: "cm-lintRange cm-lintRange-" + d.severity + (d.markClass ? " " + d.markClass : "") },
3351
- diagnostic: d,
3352
- inclusive: true
3367
+ diagnostic: d
3353
3368
  }).range(d.from, d.to);
3354
3369
  }), true);
3355
3370
  return new LintState(ranges, panel, findDiagnostic(ranges));
@@ -3398,17 +3413,20 @@ const lintState = /*@__PURE__*/state_.StateField.define({
3398
3413
  return new LintState(view_.Decoration.none, null, null);
3399
3414
  },
3400
3415
  update(value, tr) {
3401
- if (tr.docChanged) {
3402
- let mapped = value.diagnostics.map(tr.changes), selected = null;
3416
+ if (tr.docChanged && value.diagnostics.size) {
3417
+ let mapped = value.diagnostics.map(tr.changes), selected = null, panel = value.panel;
3403
3418
  if (value.selected) {
3404
3419
  let selPos = tr.changes.mapPos(value.selected.from, 1);
3405
3420
  selected = findDiagnostic(mapped, value.selected.diagnostic, selPos) || findDiagnostic(mapped, null, selPos);
3406
3421
  }
3407
- value = new LintState(mapped, value.panel, selected);
3422
+ if (!mapped.size && panel && tr.state.facet(lintConfig).autoPanel)
3423
+ panel = null;
3424
+ value = new LintState(mapped, panel, selected);
3408
3425
  }
3409
3426
  for (let effect of tr.effects) {
3410
3427
  if (effect.is(setDiagnosticsEffect)) {
3411
- value = LintState.init(effect.value, value.panel, tr.state);
3428
+ let panel = !tr.state.facet(lintConfig).autoPanel ? value.panel : effect.value.length ? LintPanel.open : null;
3429
+ value = LintState.init(effect.value, panel, tr.state);
3412
3430
  }
3413
3431
  else if (effect.is(dist_togglePanel)) {
3414
3432
  value = new LintState(value.diagnostics, effect.value ? LintPanel.open : null, value.selected);
@@ -3429,7 +3447,7 @@ function diagnosticCount(state) {
3429
3447
  let lint = state.field(lintState, false);
3430
3448
  return lint ? lint.diagnostics.size : 0;
3431
3449
  }
3432
- const activeMark = /*@__PURE__*/view_.Decoration.mark({ class: "cm-lintRange cm-lintRange-active", inclusive: true });
3450
+ const activeMark = /*@__PURE__*/view_.Decoration.mark({ class: "cm-lintRange cm-lintRange-active" });
3433
3451
  function lintTooltip(view, pos, side) {
3434
3452
  let { diagnostics } = view.state.field(lintState);
3435
3453
  let found = [], stackStart = 2e8, stackEnd = 0;
@@ -4288,46 +4306,52 @@ __webpack_require__.d(__webpack_exports__, {
4288
4306
  });
4289
4307
 
4290
4308
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
4291
- function _arrayLikeToArray(arr, len) {
4292
- if (len == null || len > arr.length) len = arr.length;
4293
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
4294
- return arr2;
4309
+ function _arrayLikeToArray(r, a) {
4310
+ (null == a || a > r.length) && (a = r.length);
4311
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
4312
+ return n;
4295
4313
  }
4314
+
4296
4315
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
4297
4316
 
4298
- function _arrayWithoutHoles(arr) {
4299
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
4317
+ function _arrayWithoutHoles(r) {
4318
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
4300
4319
  }
4320
+
4301
4321
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/iterableToArray.js
4302
- function _iterableToArray(iter) {
4303
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
4322
+ function _iterableToArray(r) {
4323
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
4304
4324
  }
4325
+
4305
4326
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
4306
4327
 
4307
- function _unsupportedIterableToArray(o, minLen) {
4308
- if (!o) return;
4309
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
4310
- var n = Object.prototype.toString.call(o).slice(8, -1);
4311
- if (n === "Object" && o.constructor) n = o.constructor.name;
4312
- if (n === "Map" || n === "Set") return Array.from(o);
4313
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
4328
+ function _unsupportedIterableToArray(r, a) {
4329
+ if (r) {
4330
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
4331
+ var t = {}.toString.call(r).slice(8, -1);
4332
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
4333
+ }
4314
4334
  }
4335
+
4315
4336
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
4316
4337
  function _nonIterableSpread() {
4317
4338
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4318
4339
  }
4340
+
4319
4341
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
4320
4342
 
4321
4343
 
4322
4344
 
4323
4345
 
4324
- function _toConsumableArray(arr) {
4325
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
4346
+ function _toConsumableArray(r) {
4347
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
4326
4348
  }
4349
+
4327
4350
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
4328
- function _arrayWithHoles(arr) {
4329
- if (Array.isArray(arr)) return arr;
4351
+ function _arrayWithHoles(r) {
4352
+ if (Array.isArray(r)) return r;
4330
4353
  }
4354
+
4331
4355
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
4332
4356
  function _iterableToArrayLimit(r, l) {
4333
4357
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
@@ -4356,18 +4380,21 @@ function _iterableToArrayLimit(r, l) {
4356
4380
  return a;
4357
4381
  }
4358
4382
  }
4383
+
4359
4384
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
4360
4385
  function _nonIterableRest() {
4361
4386
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4362
4387
  }
4388
+
4363
4389
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/slicedToArray.js
4364
4390
 
4365
4391
 
4366
4392
 
4367
4393
 
4368
- function _slicedToArray(arr, i) {
4369
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
4394
+ function _slicedToArray(r, e) {
4395
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
4370
4396
  }
4397
+
4371
4398
  // EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
4372
4399
  var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(442);
4373
4400
  // EXTERNAL MODULE: external {"root":["CM","@codemirror/state"],"commonjs":"@codemirror/state","commonjs2":"@codemirror/state"}
@@ -4450,6 +4477,7 @@ function _typeof(o) {
4450
4477
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
4451
4478
  }, _typeof(o);
4452
4479
  }
4480
+
4453
4481
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
4454
4482
 
4455
4483
  function toPrimitive(t, r) {
@@ -4462,6 +4490,7 @@ function toPrimitive(t, r) {
4462
4490
  }
4463
4491
  return ("string" === r ? String : Number)(t);
4464
4492
  }
4493
+
4465
4494
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
4466
4495
 
4467
4496
 
@@ -4469,22 +4498,18 @@ function toPropertyKey(t) {
4469
4498
  var i = toPrimitive(t, "string");
4470
4499
  return "symbol" == _typeof(i) ? i : i + "";
4471
4500
  }
4501
+
4472
4502
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/defineProperty.js
4473
4503
 
4474
- function _defineProperty(obj, key, value) {
4475
- key = toPropertyKey(key);
4476
- if (key in obj) {
4477
- Object.defineProperty(obj, key, {
4478
- value: value,
4479
- enumerable: true,
4480
- configurable: true,
4481
- writable: true
4482
- });
4483
- } else {
4484
- obj[key] = value;
4485
- }
4486
- return obj;
4504
+ function _defineProperty(e, r, t) {
4505
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
4506
+ value: t,
4507
+ enumerable: !0,
4508
+ configurable: !0,
4509
+ writable: !0
4510
+ }) : e[r] = t, e;
4487
4511
  }
4512
+
4488
4513
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/objectSpread2.js
4489
4514
 
4490
4515
  function ownKeys(e, r) {
@@ -4509,6 +4534,7 @@ function _objectSpread2(e) {
4509
4534
  return e;
4510
4535
  }
4511
4536
 
4537
+
4512
4538
  /***/ }),
4513
4539
 
4514
4540
  /***/ 644:
@@ -4521,35 +4547,31 @@ __webpack_require__.d(__webpack_exports__, {
4521
4547
  });
4522
4548
 
4523
4549
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
4524
- function _objectWithoutPropertiesLoose(source, excluded) {
4525
- if (source == null) return {};
4526
- var target = {};
4527
- for (var key in source) {
4528
- if (Object.prototype.hasOwnProperty.call(source, key)) {
4529
- if (excluded.indexOf(key) >= 0) continue;
4530
- target[key] = source[key];
4531
- }
4550
+ function _objectWithoutPropertiesLoose(r, e) {
4551
+ if (null == r) return {};
4552
+ var t = {};
4553
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
4554
+ if (e.indexOf(n) >= 0) continue;
4555
+ t[n] = r[n];
4532
4556
  }
4533
- return target;
4557
+ return t;
4534
4558
  }
4559
+
4535
4560
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
4536
4561
 
4537
- function _objectWithoutProperties(source, excluded) {
4538
- if (source == null) return {};
4539
- var target = _objectWithoutPropertiesLoose(source, excluded);
4540
- var key, i;
4562
+ function _objectWithoutProperties(e, t) {
4563
+ if (null == e) return {};
4564
+ var o,
4565
+ r,
4566
+ i = _objectWithoutPropertiesLoose(e, t);
4541
4567
  if (Object.getOwnPropertySymbols) {
4542
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
4543
- for (i = 0; i < sourceSymbolKeys.length; i++) {
4544
- key = sourceSymbolKeys[i];
4545
- if (excluded.indexOf(key) >= 0) continue;
4546
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
4547
- target[key] = source[key];
4548
- }
4568
+ var n = Object.getOwnPropertySymbols(e);
4569
+ for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
4549
4570
  }
4550
- return target;
4571
+ return i;
4551
4572
  }
4552
4573
 
4574
+
4553
4575
  /***/ }),
4554
4576
 
4555
4577
  /***/ 720:
@@ -4561,7 +4583,7 @@ function _objectWithoutProperties(source, excluded) {
4561
4583
  /* harmony export */ cL: () => (/* binding */ historyKeymap),
4562
4584
  /* harmony export */ pw: () => (/* binding */ defaultKeymap)
4563
4585
  /* harmony export */ });
4564
- /* unused harmony exports blockComment, blockUncomment, copyLineDown, copyLineUp, cursorCharBackward, cursorCharForward, cursorCharLeft, cursorCharRight, cursorDocEnd, cursorDocStart, cursorGroupBackward, cursorGroupForward, cursorGroupLeft, cursorGroupRight, cursorLineBoundaryBackward, cursorLineBoundaryForward, cursorLineBoundaryLeft, cursorLineBoundaryRight, cursorLineDown, cursorLineEnd, cursorLineStart, cursorLineUp, cursorMatchingBracket, cursorPageDown, cursorPageUp, cursorSubwordBackward, cursorSubwordForward, cursorSyntaxLeft, cursorSyntaxRight, deleteCharBackward, deleteCharBackwardStrict, deleteCharForward, deleteGroupBackward, deleteGroupForward, deleteLine, deleteLineBoundaryBackward, deleteLineBoundaryForward, deleteToLineEnd, deleteToLineStart, deleteTrailingWhitespace, emacsStyleKeymap, historyField, indentLess, indentMore, indentSelection, insertBlankLine, insertNewline, insertNewlineAndIndent, insertNewlineKeepIndent, insertTab, invertedEffects, isolateHistory, lineComment, lineUncomment, moveLineDown, moveLineUp, redo, redoDepth, redoSelection, selectAll, selectCharBackward, selectCharForward, selectCharLeft, selectCharRight, selectDocEnd, selectDocStart, selectGroupBackward, selectGroupForward, selectGroupLeft, selectGroupRight, selectLine, selectLineBoundaryBackward, selectLineBoundaryForward, selectLineBoundaryLeft, selectLineBoundaryRight, selectLineDown, selectLineEnd, selectLineStart, selectLineUp, selectMatchingBracket, selectPageDown, selectPageUp, selectParentSyntax, selectSubwordBackward, selectSubwordForward, selectSyntaxLeft, selectSyntaxRight, simplifySelection, splitLine, standardKeymap, toggleBlockComment, toggleBlockCommentByLine, toggleComment, toggleLineComment, transposeChars, undo, undoDepth, undoSelection */
4586
+ /* unused harmony exports blockComment, blockUncomment, copyLineDown, copyLineUp, cursorCharBackward, cursorCharForward, cursorCharLeft, cursorCharRight, cursorDocEnd, cursorDocStart, cursorGroupBackward, cursorGroupForward, cursorGroupLeft, cursorGroupRight, cursorLineBoundaryBackward, cursorLineBoundaryForward, cursorLineBoundaryLeft, cursorLineBoundaryRight, cursorLineDown, cursorLineEnd, cursorLineStart, cursorLineUp, cursorMatchingBracket, cursorPageDown, cursorPageUp, cursorSubwordBackward, cursorSubwordForward, cursorSyntaxLeft, cursorSyntaxRight, deleteCharBackward, deleteCharBackwardStrict, deleteCharForward, deleteGroupBackward, deleteGroupForward, deleteLine, deleteLineBoundaryBackward, deleteLineBoundaryForward, deleteToLineEnd, deleteToLineStart, deleteTrailingWhitespace, emacsStyleKeymap, historyField, indentLess, indentMore, indentSelection, insertBlankLine, insertNewline, insertNewlineAndIndent, insertNewlineKeepIndent, insertTab, invertedEffects, isolateHistory, lineComment, lineUncomment, moveLineDown, moveLineUp, redo, redoDepth, redoSelection, selectAll, selectCharBackward, selectCharForward, selectCharLeft, selectCharRight, selectDocEnd, selectDocStart, selectGroupBackward, selectGroupForward, selectGroupLeft, selectGroupRight, selectLine, selectLineBoundaryBackward, selectLineBoundaryForward, selectLineBoundaryLeft, selectLineBoundaryRight, selectLineDown, selectLineEnd, selectLineStart, selectLineUp, selectMatchingBracket, selectPageDown, selectPageUp, selectParentSyntax, selectSubwordBackward, selectSubwordForward, selectSyntaxLeft, selectSyntaxRight, simplifySelection, splitLine, standardKeymap, temporarilySetTabFocusMode, toggleBlockComment, toggleBlockCommentByLine, toggleComment, toggleLineComment, toggleTabFocusMode, transposeChars, undo, undoDepth, undoSelection */
4565
4587
  /* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(60);
4566
4588
  /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(730);
4567
4589
  /* harmony import */ var _codemirror_language__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(194);
@@ -6064,6 +6086,26 @@ const indentLess = ({ state, dispatch }) => {
6064
6086
  return true;
6065
6087
  };
6066
6088
  /**
6089
+ Enables or disables
6090
+ [tab-focus mode](https://codemirror.net/6/docs/ref/#view.EditorView.setTabFocusMode). While on, this
6091
+ prevents the editor's key bindings from capturing Tab or
6092
+ Shift-Tab, making it possible for the user to move focus out of
6093
+ the editor with the keyboard.
6094
+ */
6095
+ const toggleTabFocusMode = view => {
6096
+ view.setTabFocusMode();
6097
+ return true;
6098
+ };
6099
+ /**
6100
+ Temporarily enables [tab-focus
6101
+ mode](https://codemirror.net/6/docs/ref/#view.EditorView.setTabFocusMode) for two seconds or until
6102
+ another key is pressed.
6103
+ */
6104
+ const temporarilySetTabFocusMode = view => {
6105
+ view.setTabFocusMode(2000);
6106
+ return true;
6107
+ };
6108
+ /**
6067
6109
  Insert a tab character at the cursor or, if something is selected,
6068
6110
  use [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore) to indent the entire
6069
6111
  selection.
@@ -6190,6 +6232,7 @@ The default keymap. Includes all bindings from
6190
6232
  - Shift-Ctrl-\\ (Shift-Cmd-\\ on macOS): [`cursorMatchingBracket`](https://codemirror.net/6/docs/ref/#commands.cursorMatchingBracket)
6191
6233
  - Ctrl-/ (Cmd-/ on macOS): [`toggleComment`](https://codemirror.net/6/docs/ref/#commands.toggleComment).
6192
6234
  - Shift-Alt-a: [`toggleBlockComment`](https://codemirror.net/6/docs/ref/#commands.toggleBlockComment).
6235
+ - Ctrl-m (Alt-Shift-m on macOS): [`toggleTabFocusMode`](https://codemirror.net/6/docs/ref/#commands.toggleTabFocusMode).
6193
6236
  */
6194
6237
  const defaultKeymap = /*@__PURE__*/[
6195
6238
  { key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run: cursorSyntaxLeft, shift: selectSyntaxLeft },
@@ -6208,7 +6251,8 @@ const defaultKeymap = /*@__PURE__*/[
6208
6251
  { key: "Shift-Mod-k", run: deleteLine },
6209
6252
  { key: "Shift-Mod-\\", run: cursorMatchingBracket },
6210
6253
  { key: "Mod-/", run: toggleComment },
6211
- { key: "Alt-A", run: toggleBlockComment }
6254
+ { key: "Alt-A", run: toggleBlockComment },
6255
+ { key: "Ctrl-m", mac: "Shift-Alt-m", run: toggleTabFocusMode },
6212
6256
  ].concat(standardKeymap);
6213
6257
  /**
6214
6258
  A binding that binds Tab to [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore) and
@@ -9938,9 +9982,13 @@ function buildDeco(view, tree, always) {
9938
9982
  function clipRTLLines(ranges, doc) {
9939
9983
  let cur = doc.iter(), pos = 0, result = [], last = null;
9940
9984
  for (let { from, to } of ranges) {
9941
- if (from != pos) {
9942
- if (pos < from)
9943
- cur.next(from - pos);
9985
+ if (last && last.to > from) {
9986
+ from = last.to;
9987
+ if (from >= to)
9988
+ continue;
9989
+ }
9990
+ if (pos + cur.value.length < from) {
9991
+ cur.next(from - (pos + cur.value.length));
9944
9992
  pos = from;
9945
9993
  }
9946
9994
  for (;;) {
@@ -9951,7 +9999,7 @@ function clipRTLLines(ranges, doc) {
9951
9999
  else
9952
10000
  result.push(last = { from: start, to: Math.min(to, end) });
9953
10001
  }
9954
- if (pos >= to)
10002
+ if (end >= to)
9955
10003
  break;
9956
10004
  pos = end;
9957
10005
  cur.next();
@@ -12219,8 +12267,6 @@ function enterFragments(mounts, ranges) {
12219
12267
  /******/
12220
12268
  /************************************************************************/
12221
12269
  var __webpack_exports__ = {};
12222
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
12223
- (() => {
12224
12270
  __webpack_require__.r(__webpack_exports__);
12225
12271
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
12226
12272
  /* harmony export */ basicSetup: () => (/* reexport safe */ _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_5__.o),
@@ -12254,8 +12300,6 @@ __webpack_require__.r(__webpack_exports__);
12254
12300
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(369);
12255
12301
  var _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 ReactCodeMirror=/*#__PURE__*/(0,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,_home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .A)(props,_excluded);var editor=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);var _useCodeMirror=(0,_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,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(ref,function(){return{editor:editor.current,state:state,view:view};},[editor,container,state,view]);// check type of value
12256
12302
  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,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",(0,_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));});ReactCodeMirror.displayName='CodeMirror';/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ReactCodeMirror);
12257
- })();
12258
-
12259
12303
  /******/ return __webpack_exports__;
12260
12304
  /******/ })()
12261
12305
  ;