@uiw/react-codemirror 4.25.10 → 4.25.12

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.
@@ -30,7 +30,7 @@ __webpack_require__.r(__webpack_exports__);
30
30
  /* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_codemirror_state__WEBPACK_IMPORTED_MODULE_4__);
31
31
  /* harmony import */ var _theme_light__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(806);
32
32
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
33
- /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_3__) if(["default","getDefaultExtensions"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_3__[__WEBPACK_IMPORT_KEY__]
33
+ /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_3__) if(["getDefaultExtensions","default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_3__[__WEBPACK_IMPORT_KEY__]
34
34
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
35
35
  var getDefaultExtensions=function getDefaultExtensions(){var optios=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var _optios$indentWithTab=optios.indentWithTab,defaultIndentWithTab=_optios$indentWithTab===void 0?true:_optios$indentWithTab,_optios$editable=optios.editable,editable=_optios$editable===void 0?true:_optios$editable,_optios$readOnly=optios.readOnly,readOnly=_optios$readOnly===void 0?false:_optios$readOnly,_optios$theme=optios.theme,theme=_optios$theme===void 0?'light':_optios$theme,_optios$placeholder=optios.placeholder,placeholderStr=_optios$placeholder===void 0?'':_optios$placeholder,_optios$basicSetup=optios.basicSetup,defaultBasicSetup=_optios$basicSetup===void 0?true:_optios$basicSetup;var getExtensions=[];if(defaultIndentWithTab){getExtensions.unshift(_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.keymap.of([_codemirror_commands__WEBPACK_IMPORTED_MODULE_0__/* .indentWithTab */ .Yc]));}if(defaultBasicSetup){if(typeof defaultBasicSetup==='boolean'){getExtensions.unshift((0,_uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_1__/* .basicSetup */ .o)());}else{getExtensions.unshift((0,_uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_1__/* .basicSetup */ .o)(defaultBasicSetup));}}if(placeholderStr){getExtensions.unshift((0,_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.placeholder)(placeholderStr));}switch(theme){case'light':getExtensions.push(_theme_light__WEBPACK_IMPORTED_MODULE_5__/* .defaultLightThemeOption */ .c);break;case'dark':getExtensions.push(_codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_3__.oneDark);break;case'none':break;default:getExtensions.push(theme);break;}if(editable===false){getExtensions.push(_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.editable.of(false));}if(readOnly){getExtensions.push(_codemirror_state__WEBPACK_IMPORTED_MODULE_4__.EditorState.readOnly.of(true));}return[].concat(getExtensions);};
36
36
 
@@ -48,7 +48,7 @@ var defaultLightThemeOption=_codemirror_view__WEBPACK_IMPORTED_MODULE_0__.Editor
48
48
 
49
49
  /***/ },
50
50
 
51
- /***/ 341
51
+ /***/ 637
52
52
  (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
53
53
 
54
54
 
@@ -183,11 +183,13 @@ function _createClass(e, r, t) {
183
183
  // Setting / Unsetting timeouts for every keystroke was a significant overhead
184
184
  // Inspired from https://github.com/iostreamer-X/timeout-latch
185
185
  var TimeoutLatch=/*#__PURE__*/function(){function TimeoutLatch(callback,timeoutMS){_classCallCheck(this,TimeoutLatch);this.timeLeftMS=void 0;this.timeoutMS=void 0;this.isCancelled=false;this.isTimeExhausted=false;this.callbacks=[];this.timeLeftMS=timeoutMS;this.timeoutMS=timeoutMS;this.callbacks.push(callback);}return _createClass(TimeoutLatch,[{key:"tick",value:function tick(){if(!this.isCancelled&&!this.isTimeExhausted){this.timeLeftMS--;if(this.timeLeftMS<=0){this.isTimeExhausted=true;var callbacks=this.callbacks.slice();this.callbacks.length=0;callbacks.forEach(function(callback){try{callback();}catch(error){console.error('TimeoutLatch callback error:',error);}});}}}},{key:"cancel",value:function cancel(){this.isCancelled=true;this.callbacks.length=0;}},{key:"reset",value:function reset(){this.timeLeftMS=this.timeoutMS;this.isCancelled=false;this.isTimeExhausted=false;}},{key:"isDone",get:function get(){return this.isCancelled||this.isTimeExhausted;}}]);}();var Scheduler=/*#__PURE__*/function(){function Scheduler(){_classCallCheck(this,Scheduler);this.interval=null;this.latches=new Set();}return _createClass(Scheduler,[{key:"add",value:function add(latch){this.latches.add(latch);this.start();}},{key:"remove",value:function remove(latch){this.latches["delete"](latch);if(this.latches.size===0){this.stop();}}},{key:"start",value:function start(){var _this=this;if(this.interval===null){this.interval=setInterval(function(){_this.latches.forEach(function(latch){latch.tick();if(latch.isDone){_this.remove(latch);}});},1);}}},{key:"stop",value:function stop(){if(this.interval!==null){clearInterval(this.interval);this.interval=null;}}}]);}();var globalScheduler=null;var getScheduler=function getScheduler(){if(typeof window==='undefined'){return new Scheduler();}if(!globalScheduler){globalScheduler=new Scheduler();}return globalScheduler;};
186
+ ;// ./src/theme/dimensionTheme.ts
187
+ var scrollerTheme=view_.EditorView.theme({'& .cm-scroller':{height:'100% !important'}});var lastDimensionKey=null;var lastDimensionTheme=null;function getDimensionTheme(height,minHeight,maxHeight,width,minWidth,maxWidth){if(!height&&!minHeight&&!maxHeight&&!width&&!minWidth&&!maxWidth){return null;}var cacheKey=JSON.stringify({height:height,minHeight:minHeight,maxHeight:maxHeight,width:width,minWidth:minWidth,maxWidth:maxWidth});if(cacheKey===lastDimensionKey){return lastDimensionTheme;}lastDimensionKey=cacheKey;lastDimensionTheme=view_.EditorView.theme({'&':{height:height,minHeight:minHeight,maxHeight:maxHeight,width:width,minWidth:minWidth,maxWidth:maxWidth}});return lastDimensionTheme;}
186
188
  ;// ./src/useCodeMirror.ts
187
189
  var ExternalChange=state_.Annotation.define();var TYPING_TIMOUT=200;// ms
188
- var emptyExtensions=[];function useCodeMirror(props){var value=props.value,selection=props.selection,onChange=props.onChange,onStatistics=props.onStatistics,onCreateEditor=props.onCreateEditor,onUpdate=props.onUpdate,_props$extensions=props.extensions,extensions=_props$extensions===void 0?emptyExtensions:_props$extensions,autoFocus=props.autoFocus,_props$theme=props.theme,theme=_props$theme===void 0?'light':_props$theme,_props$height=props.height,height=_props$height===void 0?null:_props$height,_props$minHeight=props.minHeight,minHeight=_props$minHeight===void 0?null:_props$minHeight,_props$maxHeight=props.maxHeight,maxHeight=_props$maxHeight===void 0?null:_props$maxHeight,_props$width=props.width,width=_props$width===void 0?null:_props$width,_props$minWidth=props.minWidth,minWidth=_props$minWidth===void 0?null:_props$minWidth,_props$maxWidth=props.maxWidth,maxWidth=_props$maxWidth===void 0?null:_props$maxWidth,_props$placeholder=props.placeholder,placeholderStr=_props$placeholder===void 0?'':_props$placeholder,_props$editable=props.editable,editable=_props$editable===void 0?true:_props$editable,_props$readOnly=props.readOnly,readOnly=_props$readOnly===void 0?false:_props$readOnly,_props$indentWithTab=props.indentWithTab,defaultIndentWithTab=_props$indentWithTab===void 0?true:_props$indentWithTab,_props$basicSetup=props.basicSetup,defaultBasicSetup=_props$basicSetup===void 0?true:_props$basicSetup,root=props.root,initialState=props.initialState;var _useState=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState2=_slicedToArray(_useState,2),container=_useState2[0],setContainer=_useState2[1];var _useState3=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState4=_slicedToArray(_useState3,2),view=_useState4[0],setView=_useState4[1];var _useState5=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState6=_slicedToArray(_useState5,2),state=_useState6[0],setState=_useState6[1];var typingLatch=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(function(){return{current:null};})[0];var pendingUpdate=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(function(){return{current:null};})[0];var defaultThemeOption=view_.EditorView.theme({'&':{height:height,minHeight:minHeight,maxHeight:maxHeight,width:width,minWidth:minWidth,maxWidth:maxWidth},'& .cm-scroller':{height:'100% !important'}});var updateListener=view_.EditorView.updateListener.of(function(vu){if(vu.docChanged&&typeof onChange==='function'&&// Fix echoing of the remote changes:
190
+ var emptyExtensions=[];function useCodeMirror(props){var value=props.value,selection=props.selection,onChange=props.onChange,onStatistics=props.onStatistics,onCreateEditor=props.onCreateEditor,onUpdate=props.onUpdate,_props$extensions=props.extensions,extensions=_props$extensions===void 0?emptyExtensions:_props$extensions,autoFocus=props.autoFocus,_props$theme=props.theme,theme=_props$theme===void 0?'light':_props$theme,_props$height=props.height,height=_props$height===void 0?null:_props$height,_props$minHeight=props.minHeight,minHeight=_props$minHeight===void 0?null:_props$minHeight,_props$maxHeight=props.maxHeight,maxHeight=_props$maxHeight===void 0?null:_props$maxHeight,_props$width=props.width,width=_props$width===void 0?null:_props$width,_props$minWidth=props.minWidth,minWidth=_props$minWidth===void 0?null:_props$minWidth,_props$maxWidth=props.maxWidth,maxWidth=_props$maxWidth===void 0?null:_props$maxWidth,_props$placeholder=props.placeholder,placeholderStr=_props$placeholder===void 0?'':_props$placeholder,_props$editable=props.editable,editable=_props$editable===void 0?true:_props$editable,_props$readOnly=props.readOnly,readOnly=_props$readOnly===void 0?false:_props$readOnly,_props$indentWithTab=props.indentWithTab,defaultIndentWithTab=_props$indentWithTab===void 0?true:_props$indentWithTab,_props$basicSetup=props.basicSetup,defaultBasicSetup=_props$basicSetup===void 0?true:_props$basicSetup,root=props.root,initialState=props.initialState;var _useState=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState2=_slicedToArray(_useState,2),container=_useState2[0],setContainer=_useState2[1];var _useState3=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState4=_slicedToArray(_useState3,2),view=_useState4[0],setView=_useState4[1];var _useState5=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(),_useState6=_slicedToArray(_useState5,2),state=_useState6[0],setState=_useState6[1];var typingLatch=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(function(){return{current:null};})[0];var pendingUpdate=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(function(){return{current:null};})[0];var defaultThemeOption=getDimensionTheme(height,minHeight,maxHeight,width,minWidth,maxWidth);var updateListener=view_.EditorView.updateListener.of(function(vu){if(vu.docChanged&&typeof onChange==='function'&&// Fix echoing of the remote changes:
189
191
  // If transaction is market as remote we don't have to call `onChange` handler again
190
- !vu.transactions.some(function(tr){return tr.annotation(ExternalChange);})){if(typingLatch.current){typingLatch.current.reset();}else{typingLatch.current=new TimeoutLatch(function(){if(pendingUpdate.current){var forceUpdate=pendingUpdate.current;pendingUpdate.current=null;forceUpdate();}typingLatch.current=null;},TYPING_TIMOUT);getScheduler().add(typingLatch.current);}var doc=vu.state.doc;var _value=doc.toString();onChange(_value,vu);}onStatistics&&onStatistics((0,utils/* getStatistics */.m)(vu));});var defaultExtensions=(0,getDefaultExtensions.getDefaultExtensions)({theme:theme,editable:editable,readOnly:readOnly,placeholder:placeholderStr,indentWithTab:defaultIndentWithTab,basicSetup:defaultBasicSetup});var getExtensions=[updateListener,defaultThemeOption].concat(_toConsumableArray(defaultExtensions));if(onUpdate&&typeof onUpdate==='function'){getExtensions.push(view_.EditorView.updateListener.of(onUpdate));}getExtensions=getExtensions.concat(extensions);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function(){if(container&&!state){var config={doc:value,selection:selection,extensions:getExtensions};var stateCurrent=initialState?state_.EditorState.fromJSON(initialState.json,config,initialState.fields):state_.EditorState.create(config);setState(stateCurrent);if(!view){var viewCurrent=new view_.EditorView({state:stateCurrent,parent:container,root:root});setView(viewCurrent);onCreateEditor&&onCreateEditor(viewCurrent,stateCurrent);}}return function(){if(view){setState(undefined);setView(undefined);}};},[container,state]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(props.container){setContainer(props.container);}},[props.container]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){return function(){if(view){view.destroy();setView(undefined);}if(typingLatch.current){typingLatch.current.cancel();typingLatch.current=null;}};},[view]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(autoFocus&&view){view.focus();}},[autoFocus,view]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(view){view.dispatch({effects:state_.StateEffect.reconfigure.of(getExtensions)});}// eslint-disable-next-line react-hooks/exhaustive-deps
192
+ !vu.transactions.some(function(tr){return tr.annotation(ExternalChange);})){if(typingLatch.current){typingLatch.current.reset();}else{typingLatch.current=new TimeoutLatch(function(){if(pendingUpdate.current){var forceUpdate=pendingUpdate.current;pendingUpdate.current=null;forceUpdate();}typingLatch.current=null;},TYPING_TIMOUT);getScheduler().add(typingLatch.current);}var doc=vu.state.doc;var _value=doc.toString();onChange(_value,vu);}onStatistics&&onStatistics((0,utils/* getStatistics */.m)(vu));});var defaultExtensions=(0,getDefaultExtensions.getDefaultExtensions)({theme:theme,editable:editable,readOnly:readOnly,placeholder:placeholderStr,indentWithTab:defaultIndentWithTab,basicSetup:defaultBasicSetup});var getExtensions=[updateListener].concat(_toConsumableArray(defaultThemeOption?[defaultThemeOption]:[]),[scrollerTheme],_toConsumableArray(defaultExtensions));if(onUpdate&&typeof onUpdate==='function'){getExtensions.push(view_.EditorView.updateListener.of(onUpdate));}getExtensions=getExtensions.concat(extensions);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function(){if(container&&!state){var config={doc:value,selection:selection,extensions:getExtensions};var stateCurrent=initialState?state_.EditorState.fromJSON(initialState.json,config,initialState.fields):state_.EditorState.create(config);setState(stateCurrent);if(!view){var viewCurrent=new view_.EditorView({state:stateCurrent,parent:container,root:root});setView(viewCurrent);onCreateEditor&&onCreateEditor(viewCurrent,stateCurrent);}}return function(){if(view){setState(undefined);setView(undefined);}};},[container,state]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(props.container){setContainer(props.container);}},[props.container]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){return function(){if(view){view.destroy();setView(undefined);}if(typingLatch.current){typingLatch.current.cancel();typingLatch.current=null;}};},[view]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(autoFocus&&view){view.focus();}},[autoFocus,view]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(view){view.dispatch({effects:state_.StateEffect.reconfigure.of(getExtensions)});}// eslint-disable-next-line react-hooks/exhaustive-deps
191
193
  },[theme,extensions,height,minHeight,maxHeight,width,minWidth,maxWidth,placeholderStr,editable,readOnly,defaultIndentWithTab,defaultBasicSetup,onChange,onUpdate]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(value===undefined){return;}var currentValue=view?view.state.doc.toString():'';if(view&&value!==currentValue){var isTyping=typingLatch.current&&!typingLatch.current.isDone;var forceUpdate=function forceUpdate(){if(view&&value!==view.state.doc.toString()){view.dispatch({changes:{from:0,to:view.state.doc.toString().length,insert:value||''},annotations:[ExternalChange.of(true)]});}};if(!isTyping){forceUpdate();}else{pendingUpdate.current=forceUpdate;}}},[value,view]);return{state:state,setState:setState,view:view,setView:setView,container:container,setContainer:setContainer};}
192
194
 
193
195
  /***/ },
@@ -610,9 +612,17 @@ column position by adding `:` and a second number after the line
610
612
  number.
611
613
  */
612
614
  const gotoLine = view => {
615
+ let open = (0,view_.getDialog)(view, "cm-goto-line");
616
+ if (open) {
617
+ let field = open.dom.querySelector("input[type=text]");
618
+ if (field)
619
+ field.select();
620
+ return true;
621
+ }
613
622
  let { state } = view;
614
623
  let line = String(state.doc.lineAt(view.state.selection.main.head).number);
615
624
  let { close, result } = (0,view_.showDialog)(view, {
625
+ class: "cm-goto-line",
616
626
  label: state.phrase("Go to line"),
617
627
  input: { type: "text", name: "line", value: line },
618
628
  focus: true,
@@ -1214,6 +1224,7 @@ const replaceNext = /*@__PURE__*/searchCommand((view, { query }) => {
1214
1224
  else if (next.from == from && next.to == to) {
1215
1225
  replacement = state.toText(query.getReplacement(next));
1216
1226
  changes.push({ from: next.from, to: next.to, insert: replacement });
1227
+ next = query.nextMatch(state, next.from, next.to);
1217
1228
  effects.push(view_.EditorView.announce.of(state.phrase("replaced match on line $", state.doc.lineAt(from).number) + "."));
1218
1229
  }
1219
1230
  let changeSet = view.state.changes(changes);
@@ -2560,7 +2571,7 @@ class ActiveResult extends ActiveSource {
2560
2571
  let result = this.result.map ? this.result.map(this.result, mapping) : this.result;
2561
2572
  if (!result)
2562
2573
  return new ActiveSource(this.source, 0 /* State.Inactive */);
2563
- return new ActiveResult(this.source, this.explicit, mapping.mapPos(this.limit), this.result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));
2574
+ return new ActiveResult(this.source, this.explicit, mapping.mapPos(this.limit), result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));
2564
2575
  }
2565
2576
  touches(tr) {
2566
2577
  return tr.changes.touchesRange(this.from, this.to);
@@ -2696,7 +2707,7 @@ const completionPlugin = /*@__PURE__*/view_.ViewPlugin.fromClass(class {
2696
2707
  handler();
2697
2708
  }
2698
2709
  catch (e) {
2699
- (0,view_.logException)(this.view.state, e);
2710
+ ;(0,view_.logException)(this.view.state, e);
2700
2711
  }
2701
2712
  }
2702
2713
  query.context.abortListeners = null;
@@ -3012,6 +3023,9 @@ class Snippet {
3012
3023
  for (let line of template.split(/\r\n?|\n/)) {
3013
3024
  while (m = /[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(line)) {
3014
3025
  let seq = m[1] ? +m[1] : null, rawName = m[2] || m[3] || "", found = -1;
3026
+ // `${0}` is the cursor's final position, after every other tab stop.
3027
+ if (seq === 0)
3028
+ seq = 1e9;
3015
3029
  let name = rawName.replace(/\\[{}]/g, m => m[1]);
3016
3030
  for (let i = 0; i < fields.length; i++) {
3017
3031
  if (seq != null ? fields[i].seq == seq : name ? fields[i].name == name : false)
@@ -3126,7 +3140,8 @@ cursor out of the current field deactivates the fields.
3126
3140
 
3127
3141
  The order of fields defaults to textual order, but you can add
3128
3142
  numbers to placeholders (`${1}` or `${1:defaultText}`) to provide
3129
- a custom order.
3143
+ a custom order. `${0}` is special—it is always the last stop, where
3144
+ the cursor ends up after tabbing through the other fields.
3130
3145
 
3131
3146
  To include a literal `{` or `}` in your template, put a backslash
3132
3147
  in front of it. This will be removed and the brace will not be
@@ -3866,7 +3881,7 @@ function lintTooltip(view, pos, side) {
3866
3881
  return {
3867
3882
  pos: start,
3868
3883
  end: end,
3869
- above: view.state.doc.lineAt(start).to < end,
3884
+ above: true,
3870
3885
  create() {
3871
3886
  return { dom: diagnosticsTooltip(view, found) };
3872
3887
  }
@@ -4880,12 +4895,9 @@ function toPropertyKey(t) {
4880
4895
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
4881
4896
 
4882
4897
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4883
- /* harmony export */ Yc: () => (/* binding */ indentWithTab),
4884
- /* harmony export */ b6: () => (/* binding */ history),
4885
- /* harmony export */ cL: () => (/* binding */ historyKeymap),
4886
- /* harmony export */ pw: () => (/* binding */ defaultKeymap)
4898
+ /* harmony export */ b6: () => (/* binding */ history)
4887
4899
  /* harmony export */ });
4888
- /* unused harmony exports addCursorAbove, addCursorBelow, blockComment, blockUncomment, copyLineDown, copyLineUp, cursorCharBackward, cursorCharBackwardLogical, cursorCharForward, cursorCharForwardLogical, cursorCharLeft, cursorCharRight, cursorDocEnd, cursorDocStart, cursorGroupBackward, cursorGroupForward, cursorGroupForwardWin, cursorGroupLeft, cursorGroupRight, cursorLineBoundaryBackward, cursorLineBoundaryForward, cursorLineBoundaryLeft, cursorLineBoundaryRight, cursorLineDown, cursorLineEnd, cursorLineStart, cursorLineUp, cursorMatchingBracket, cursorPageDown, cursorPageUp, cursorSubwordBackward, cursorSubwordForward, cursorSyntaxLeft, cursorSyntaxRight, deleteCharBackward, deleteCharBackwardStrict, deleteCharForward, deleteGroupBackward, deleteGroupForward, deleteGroupForwardWin, 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, selectCharBackwardLogical, selectCharForward, selectCharForwardLogical, selectCharLeft, selectCharRight, selectDocEnd, selectDocStart, selectGroupBackward, selectGroupForward, selectGroupForwardWin, 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 */
4900
+ /* unused harmony exports addCursorAbove, addCursorBelow, blockComment, blockUncomment, canRedoSelection, canUndoSelection, copyLineDown, copyLineUp, cursorCharBackward, cursorCharBackwardLogical, cursorCharForward, cursorCharForwardLogical, cursorCharLeft, cursorCharRight, cursorDocEnd, cursorDocStart, cursorGroupBackward, cursorGroupForward, cursorGroupForwardWin, cursorGroupLeft, cursorGroupRight, cursorLineBoundaryBackward, cursorLineBoundaryForward, cursorLineBoundaryLeft, cursorLineBoundaryRight, cursorLineDown, cursorLineEnd, cursorLineStart, cursorLineUp, cursorMatchingBracket, cursorPageDown, cursorPageUp, cursorSubwordBackward, cursorSubwordForward, cursorSyntaxLeft, cursorSyntaxRight, deleteCharBackward, deleteCharBackwardStrict, deleteCharForward, deleteGroupBackward, deleteGroupForward, deleteGroupForwardWin, 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, selectCharBackwardLogical, selectCharForward, selectCharForwardLogical, selectCharLeft, selectCharRight, selectDocEnd, selectDocStart, selectGroupBackward, selectGroupForward, selectGroupForwardWin, 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 */
4889
4901
  /* unused harmony import specifier */ var findClusterBreak;
4890
4902
  /* unused harmony import specifier */ var EditorSelection;
4891
4903
  /* unused harmony import specifier */ var CharCategory;
@@ -5226,6 +5238,23 @@ const undoDepth = /*@__PURE__*/(/* unused pure expression or super */ null && (d
5226
5238
  The amount of redoable change events available in a given state.
5227
5239
  */
5228
5240
  const redoDepth = /*@__PURE__*/(/* unused pure expression or super */ null && (depth(1 /* BranchName.Undone */)));
5241
+ function hasSelection(side) {
5242
+ return function (state) {
5243
+ let histState = state.field(historyField_, false);
5244
+ if (!histState)
5245
+ return false;
5246
+ let branch = side == 0 /* BranchName.Done */ ? histState.done : histState.undone;
5247
+ return branch.length > 0 && branch[0].selectionsAfter.length > 0;
5248
+ };
5249
+ }
5250
+ /**
5251
+ Test whether there is an undoable selection available.
5252
+ */
5253
+ const canUndoSelection = /*@__PURE__*/(/* unused pure expression or super */ null && (hasSelection(0 /* BranchName.Done */)));
5254
+ /**
5255
+ Test whether there is a redoable selection available.
5256
+ */
5257
+ const canRedoSelection = /*@__PURE__*/(/* unused pure expression or super */ null && (hasSelection(0 /* BranchName.Done */)));
5229
5258
  // History events store groups of changes or effects that need to be
5230
5259
  // undone/redone together.
5231
5260
  class HistEvent {
@@ -5750,11 +5779,11 @@ const cursorLineBoundaryRight = view => moveSel(view, range => moveByLineBoundar
5750
5779
  /**
5751
5780
  Move the selection to the start of the line.
5752
5781
  */
5753
- const cursorLineStart = view => moveSel(view, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.cursor(view.lineBlockAt(range.head).from, 1));
5782
+ const cursorLineStart = view => moveSel(view, range => view.moveToLineBoundary(range, false, false));
5754
5783
  /**
5755
5784
  Move the selection to the end of the line.
5756
5785
  */
5757
- const cursorLineEnd = view => moveSel(view, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.cursor(view.lineBlockAt(range.head).to, -1));
5786
+ const cursorLineEnd = view => moveSel(view, range => view.moveToLineBoundary(range, true, false));
5758
5787
  function toMatchingBracket(state, dispatch, extend) {
5759
5788
  let found = false, selection = updateSel(state.selection, range => {
5760
5789
  let matching = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_2__/* .matchBrackets */ .jU)(state, range.head, -1)
@@ -5782,8 +5811,10 @@ Extend the selection to the bracket matching the one the selection
5782
5811
  head is currently on, if any.
5783
5812
  */
5784
5813
  const selectMatchingBracket = ({ state, dispatch }) => toMatchingBracket(state, dispatch, true);
5785
- function extendSel(target, how) {
5814
+ function extendSel(target, forward, how) {
5786
5815
  let selection = updateSel(target.state.selection, range => {
5816
+ if (range.undirectional && (range.head >= range.anchor) != forward)
5817
+ range = _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.range(range.head, range.anchor);
5787
5818
  let head = how(range);
5788
5819
  return _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined, head.assoc);
5789
5820
  });
@@ -5793,7 +5824,7 @@ function extendSel(target, how) {
5793
5824
  return true;
5794
5825
  }
5795
5826
  function selectByChar(view, forward) {
5796
- return extendSel(view, range => view.moveByChar(range, forward));
5827
+ return extendSel(view, forward, range => view.moveByChar(range, forward));
5797
5828
  }
5798
5829
  /**
5799
5830
  Move the selection head one character to the left, while leaving
@@ -5816,14 +5847,14 @@ const selectCharBackward = view => selectByChar(view, false);
5816
5847
  Move the selection head one character forward by logical
5817
5848
  (non-direction aware) string index order.
5818
5849
  */
5819
- const selectCharForwardLogical = target => extendSel(target, range => byCharLogical(target.state, range, true));
5850
+ const selectCharForwardLogical = target => extendSel(target, true, range => byCharLogical(target.state, range, true));
5820
5851
  /**
5821
5852
  Move the selection head one character backward by logical string
5822
5853
  index order.
5823
5854
  */
5824
- const selectCharBackwardLogical = target => extendSel(target, range => byCharLogical(target.state, range, false));
5855
+ const selectCharBackwardLogical = target => extendSel(target, false, range => byCharLogical(target.state, range, false));
5825
5856
  function selectByGroup(view, forward) {
5826
- return extendSel(view, range => view.moveByGroup(range, forward));
5857
+ return extendSel(view, forward, range => view.moveByGroup(range, forward));
5827
5858
  }
5828
5859
  /**
5829
5860
  Move the selection head one [group](https://codemirror.net/6/docs/ref/#commands.cursorGroupLeft) to
@@ -5847,10 +5878,10 @@ Move the selection head one group forward in the default Windows
5847
5878
  style, skipping to the start of the next group.
5848
5879
  */
5849
5880
  const selectGroupForwardWin = view => {
5850
- return extendSel(view, range => view.moveByChar(range, true, start => toGroupStart(view, range.head, start)));
5881
+ return extendSel(view, true, range => view.moveByChar(range, true, start => toGroupStart(view, range.head, start)));
5851
5882
  };
5852
5883
  function selectBySubword(view, forward) {
5853
- return extendSel(view, range => moveBySubword(view, range, forward));
5884
+ return extendSel(view, forward, range => moveBySubword(view, range, forward));
5854
5885
  }
5855
5886
  /**
5856
5887
  Move the selection head one group or camel-case subword forward.
@@ -5863,13 +5894,19 @@ const selectSubwordBackward = view => selectBySubword(view, false);
5863
5894
  /**
5864
5895
  Move the selection head over the next syntactic element to the left.
5865
5896
  */
5866
- const selectSyntaxLeft = view => extendSel(view, range => moveBySyntax(view.state, range, !ltrAtCursor(view)));
5897
+ const selectSyntaxLeft = view => {
5898
+ let forward = !ltrAtCursor(view);
5899
+ return extendSel(view, forward, range => moveBySyntax(view.state, range, forward));
5900
+ };
5867
5901
  /**
5868
5902
  Move the selection head over the next syntactic element to the right.
5869
5903
  */
5870
- const selectSyntaxRight = view => extendSel(view, range => moveBySyntax(view.state, range, ltrAtCursor(view)));
5904
+ const selectSyntaxRight = view => {
5905
+ let forward = ltrAtCursor(view);
5906
+ return extendSel(view, forward, range => moveBySyntax(view.state, range, forward));
5907
+ };
5871
5908
  function selectByLine(view, forward) {
5872
- return extendSel(view, range => view.moveVertically(range, forward));
5909
+ return extendSel(view, forward, range => view.moveVertically(range, forward));
5873
5910
  }
5874
5911
  /**
5875
5912
  Move the selection head one line up.
@@ -5880,7 +5917,7 @@ Move the selection head one line down.
5880
5917
  */
5881
5918
  const selectLineDown = view => selectByLine(view, true);
5882
5919
  function selectByPage(view, forward) {
5883
- return extendSel(view, range => view.moveVertically(range, forward, pageInfo(view).height));
5920
+ return extendSel(view, forward, range => view.moveVertically(range, forward, pageInfo(view).height));
5884
5921
  }
5885
5922
  /**
5886
5923
  Move the selection head one page up.
@@ -5893,27 +5930,33 @@ const selectPageDown = view => selectByPage(view, true);
5893
5930
  /**
5894
5931
  Move the selection head to the next line boundary.
5895
5932
  */
5896
- const selectLineBoundaryForward = view => extendSel(view, range => moveByLineBoundary(view, range, true));
5933
+ const selectLineBoundaryForward = view => extendSel(view, true, range => moveByLineBoundary(view, range, true));
5897
5934
  /**
5898
5935
  Move the selection head to the previous line boundary.
5899
5936
  */
5900
- const selectLineBoundaryBackward = view => extendSel(view, range => moveByLineBoundary(view, range, false));
5937
+ const selectLineBoundaryBackward = view => extendSel(view, false, range => moveByLineBoundary(view, range, false));
5901
5938
  /**
5902
5939
  Move the selection head one line boundary to the left.
5903
5940
  */
5904
- const selectLineBoundaryLeft = view => extendSel(view, range => moveByLineBoundary(view, range, !ltrAtCursor(view)));
5941
+ const selectLineBoundaryLeft = view => {
5942
+ let forward = !ltrAtCursor(view);
5943
+ return extendSel(view, forward, range => moveByLineBoundary(view, range, forward));
5944
+ };
5905
5945
  /**
5906
5946
  Move the selection head one line boundary to the right.
5907
5947
  */
5908
- const selectLineBoundaryRight = view => extendSel(view, range => moveByLineBoundary(view, range, ltrAtCursor(view)));
5948
+ const selectLineBoundaryRight = view => {
5949
+ let forward = ltrAtCursor(view);
5950
+ return extendSel(view, forward, range => moveByLineBoundary(view, range, forward));
5951
+ };
5909
5952
  /**
5910
5953
  Move the selection head to the start of the line.
5911
5954
  */
5912
- const selectLineStart = view => extendSel(view, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.cursor(view.lineBlockAt(range.head).from));
5955
+ const selectLineStart = view => extendSel(view, false, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.cursor(view.lineBlockAt(range.head).from));
5913
5956
  /**
5914
5957
  Move the selection head to the end of the line.
5915
5958
  */
5916
- const selectLineEnd = view => extendSel(view, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.cursor(view.lineBlockAt(range.head).to));
5959
+ const selectLineEnd = view => extendSel(view, true, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.cursor(view.lineBlockAt(range.head).to));
5917
5960
  /**
5918
5961
  Move the selection to the start of the document.
5919
5962
  */
@@ -5953,7 +5996,7 @@ const selectAll = ({ state, dispatch }) => {
5953
5996
  Expand the selection to cover entire lines.
5954
5997
  */
5955
5998
  const selectLine = ({ state, dispatch }) => {
5956
- let ranges = selectedLineBlocks(state).map(({ from, to }) => _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.range(from, Math.min(to + 1, state.doc.length)));
5999
+ let ranges = selectedLineBlocks(state).map(({ from, to }) => _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.undirectionalRange(from, Math.min(to + 1, state.doc.length)));
5957
6000
  dispatch(state.update({ selection: _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.create(ranges), userEvent: "select" }));
5958
6001
  return true;
5959
6002
  };
@@ -5976,7 +6019,7 @@ const selectParentSyntax = ({ state, dispatch }) => {
5976
6019
  if (((node.from < range.from && node.to >= range.to) ||
5977
6020
  (node.to > range.to && node.from <= range.from)) &&
5978
6021
  cur.next)
5979
- return _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.range(node.to, node.from);
6022
+ return _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorSelection.undirectionalRange(node.from, node.to);
5980
6023
  }
5981
6024
  return range;
5982
6025
  });
@@ -6654,7 +6697,7 @@ The default keymap. Includes all bindings from
6654
6697
  - Shift-Ctrl-k (Shift-Cmd-k on macOS): [`deleteLine`](https://codemirror.net/6/docs/ref/#commands.deleteLine)
6655
6698
  - Shift-Ctrl-\\ (Shift-Cmd-\\ on macOS): [`cursorMatchingBracket`](https://codemirror.net/6/docs/ref/#commands.cursorMatchingBracket)
6656
6699
  - Ctrl-/ (Cmd-/ on macOS): [`toggleComment`](https://codemirror.net/6/docs/ref/#commands.toggleComment).
6657
- - Shift-Alt-a: [`toggleBlockComment`](https://codemirror.net/6/docs/ref/#commands.toggleBlockComment).
6700
+ - Shift-Alt-a (Shift-Ctrl-a on macOS): [`toggleBlockComment`](https://codemirror.net/6/docs/ref/#commands.toggleBlockComment).
6658
6701
  - Ctrl-m (Alt-Shift-m on macOS): [`toggleTabFocusMode`](https://codemirror.net/6/docs/ref/#commands.toggleTabFocusMode).
6659
6702
  */
6660
6703
  const defaultKeymap = /*@__PURE__*/[
@@ -6676,7 +6719,7 @@ const defaultKeymap = /*@__PURE__*/[
6676
6719
  { key: "Shift-Mod-k", run: deleteLine },
6677
6720
  { key: "Shift-Mod-\\", run: cursorMatchingBracket },
6678
6721
  { key: "Mod-/", run: toggleComment },
6679
- { key: "Alt-A", run: toggleBlockComment },
6722
+ { key: "Alt-A", mac: "Ctrl-A", run: toggleBlockComment },
6680
6723
  { key: "Ctrl-m", mac: "Shift-Alt-m", run: toggleTabFocusMode },
6681
6724
  ].concat(standardKeymap);
6682
6725
  /**
@@ -6689,6 +6732,12 @@ const indentWithTab = { key: "Tab", run: indentMore, shift: indentLess };
6689
6732
 
6690
6733
 
6691
6734
 
6735
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, [
6736
+ /* harmony export */ "Yc", 0, /* binding */ indentWithTab,
6737
+ /* harmony export */ "cL", 0, /* binding */ historyKeymap,
6738
+ /* harmony export */ "pw", 0, /* binding */ defaultKeymap
6739
+ /* harmony export */ ]);
6740
+
6692
6741
 
6693
6742
  /***/ },
6694
6743
 
@@ -6947,7 +6996,7 @@ const ruleNodeProp = new dist/* NodeProp */.uY({
6947
6996
  combine(a, b) {
6948
6997
  let cur, root, take;
6949
6998
  while (a || b) {
6950
- if (!a || b && a.depth >= b.depth) {
6999
+ if (!a || b && a.depth < b.depth) {
6951
7000
  take = b;
6952
7001
  b = b.next;
6953
7002
  }
@@ -7184,7 +7233,7 @@ and necessarily incomplete. A full ontology of syntactic
7184
7233
  constructs would fill a stack of books, and be impractical to
7185
7234
  write themes for. So try to make do with this set. If all else
7186
7235
  fails, [open an
7187
- issue](https://github.com/codemirror/codemirror.next) to propose a
7236
+ issue](https://code.haverbeke.berlin/codemirror/dev/issues) to propose a
7188
7237
  new tag, or [define](#highlight.Tag^define) a local custom tag for
7189
7238
  your use case.
7190
7239
 
@@ -7760,15 +7809,18 @@ class StyleSet {
7760
7809
  mount(modules, root) {
7761
7810
  let sheet = this.sheet
7762
7811
  let pos = 0 /* Current rule offset */, j = 0 /* Index into this.modules */
7812
+ let changed = false
7763
7813
  for (let i = 0; i < modules.length; i++) {
7764
7814
  let mod = modules[i], index = this.modules.indexOf(mod)
7765
7815
  if (index < j && index > -1) { // Ordering conflict
7766
7816
  this.modules.splice(index, 1)
7817
+ changed = true
7767
7818
  j--
7768
7819
  index = -1
7769
7820
  }
7770
7821
  if (index == -1) {
7771
7822
  this.modules.splice(j++, 0, mod)
7823
+ changed = true
7772
7824
  if (sheet) for (let k = 0; k < mod.rules.length; k++)
7773
7825
  sheet.insertRule(mod.rules[k], pos++)
7774
7826
  } else {
@@ -7782,10 +7834,12 @@ class StyleSet {
7782
7834
  if (root.adoptedStyleSheets.indexOf(this.sheet) < 0)
7783
7835
  root.adoptedStyleSheets = [this.sheet, ...root.adoptedStyleSheets]
7784
7836
  } else {
7785
- let text = ""
7786
- for (let i = 0; i < this.modules.length; i++)
7787
- text += this.modules[i].getRules() + "\n"
7788
- this.styleTag.textContent = text
7837
+ if (changed) {
7838
+ let text = ""
7839
+ for (let i = 0; i < this.modules.length; i++)
7840
+ text += this.modules[i].getRules() + "\n"
7841
+ this.styleTag.textContent = text
7842
+ }
7789
7843
  let target = root.head || root
7790
7844
  if (this.styleTag.parentNode != target)
7791
7845
  target.insertBefore(this.styleTag, target.firstChild)
@@ -7988,8 +8042,7 @@ function topNodeAt(state, pos, side) {
7988
8042
  }
7989
8043
  /**
7990
8044
  A subclass of [`Language`](https://codemirror.net/6/docs/ref/#language.Language) for use with Lezer
7991
- [LR parsers](https://lezer.codemirror.net/docs/ref#lr.LRParser)
7992
- parsers.
8045
+ [LR parsers](https://lezer.codemirror.net/docs/ref#lr.LRParser).
7993
8046
  */
7994
8047
  class LRLanguage extends Language {
7995
8048
  constructor(data, parser, name) {
@@ -9155,18 +9208,25 @@ const foldState = /*@__PURE__*/state_.StateField.define({
9155
9208
  if (tr.isUserEvent("delete"))
9156
9209
  tr.changes.iterChangedRanges((fromA, toA) => folded = clearTouchedFolds(folded, fromA, toA));
9157
9210
  folded = folded.map(tr.changes);
9211
+ let rangesToFold = [];
9158
9212
  for (let e of tr.effects) {
9159
9213
  if (e.is(foldEffect) && !foldExists(folded, e.value.from, e.value.to)) {
9160
- let { preparePlaceholder } = tr.state.facet(foldConfig);
9161
- let widget = !preparePlaceholder ? foldWidget :
9162
- view_.Decoration.replace({ widget: new PreparedFoldWidget(preparePlaceholder(tr.state, e.value)) });
9163
- folded = folded.update({ add: [widget.range(e.value.from, e.value.to)] });
9214
+ rangesToFold.push(e.value);
9164
9215
  }
9165
9216
  else if (e.is(unfoldEffect)) {
9166
9217
  folded = folded.update({ filter: (from, to) => e.value.from != from || e.value.to != to,
9167
9218
  filterFrom: e.value.from, filterTo: e.value.to });
9168
9219
  }
9169
9220
  }
9221
+ if (rangesToFold.length) {
9222
+ let { preparePlaceholder } = tr.state.facet(foldConfig);
9223
+ let decorations = rangesToFold.map(value => {
9224
+ let widget = !preparePlaceholder ? foldWidget :
9225
+ view_.Decoration.replace({ widget: new PreparedFoldWidget(preparePlaceholder(tr.state, value)) });
9226
+ return widget.range(value.from, value.to);
9227
+ });
9228
+ folded = folded.update({ add: decorations });
9229
+ }
9170
9230
  // Clear folded ranges that cover the selection head
9171
9231
  if (tr.selection)
9172
9232
  folded = clearTouchedFolds(folded, tr.selection.main.head);
@@ -9526,7 +9586,7 @@ class HighlightStyle {
9526
9586
  or array of tags in their `tag` property, and either a single
9527
9587
  `class` property providing a static CSS class (for highlighter
9528
9588
  that rely on external styling), or a
9529
- [`style-mod`](https://github.com/marijnh/style-mod#documentation)-style
9589
+ [`style-mod`](https://code.haverbeke.berlin/marijn/style-mod#documentation)-style
9530
9590
  set of CSS properties (which define the styling for those tags).
9531
9591
 
9532
9592
  The CSS rules created for a highlighter will be emitted in the
@@ -12563,14 +12623,14 @@ class StructureCursor {
12563
12623
  constructor(root, offset) {
12564
12624
  this.offset = offset;
12565
12625
  this.done = false;
12566
- this.cursor = root.cursor(IterMode.IncludeAnonymous | IterMode.IgnoreMounts);
12626
+ this.cursor = root.cursor(IterMode.IncludeAnonymous | IterMode.IgnoreMounts | IterMode.ExcludeBuffers);
12567
12627
  }
12568
12628
  // Move to the first node (in pre-order) that starts at or after `pos`.
12569
12629
  moveTo(pos) {
12570
12630
  let { cursor } = this, p = pos - this.offset;
12571
12631
  while (!this.done && cursor.from < p) {
12572
- if (cursor.to >= pos && cursor.enter(p, 1, IterMode.IgnoreOverlays | IterMode.ExcludeBuffers)) ;
12573
- else if (cursor.to <= pos) {
12632
+ if (cursor.to >= p && cursor.enter(p, 1, IterMode.IncludeAnonymous | IterMode.IgnoreOverlays | IterMode.ExcludeBuffers)) ;
12633
+ else if (cursor.to <= p) {
12574
12634
  if (!cursor.next(false))
12575
12635
  this.done = true;
12576
12636
  // Moved to next node
@@ -12747,17 +12807,17 @@ function enterFragments(mounts, ranges) {
12747
12807
  /******/ });
12748
12808
  /************************************************************************/
12749
12809
  /******/ // The module cache
12750
- /******/ var __webpack_module_cache__ = {};
12810
+ /******/ const __webpack_module_cache__ = {};
12751
12811
  /******/
12752
12812
  /******/ // The require function
12753
12813
  /******/ function __webpack_require__(moduleId) {
12754
12814
  /******/ // Check if module is in cache
12755
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
12815
+ /******/ const cachedModule = __webpack_module_cache__[moduleId];
12756
12816
  /******/ if (cachedModule !== undefined) {
12757
12817
  /******/ return cachedModule.exports;
12758
12818
  /******/ }
12759
12819
  /******/ // Create a new module (and put it into the cache)
12760
- /******/ var module = __webpack_module_cache__[moduleId] = {
12820
+ /******/ const module = __webpack_module_cache__[moduleId] = {
12761
12821
  /******/ // no module.id needed
12762
12822
  /******/ // no module.loaded needed
12763
12823
  /******/ exports: {}
@@ -12772,52 +12832,51 @@ function enterFragments(mounts, ranges) {
12772
12832
  /******/
12773
12833
  /************************************************************************/
12774
12834
  /******/ /* webpack/runtime/compat get default export */
12775
- /******/ (() => {
12776
- /******/ // getDefaultExport function for compatibility with non-harmony modules
12777
- /******/ __webpack_require__.n = (module) => {
12778
- /******/ var getter = module && module.__esModule ?
12779
- /******/ () => (module['default']) :
12780
- /******/ () => (module);
12781
- /******/ __webpack_require__.d(getter, { a: getter });
12782
- /******/ return getter;
12783
- /******/ };
12784
- /******/ })();
12835
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
12836
+ /******/ __webpack_require__.n = (module) => {
12837
+ /******/ const getter = module && module.__esModule ?
12838
+ /******/ () => (module['default']) :
12839
+ /******/ () => (module);
12840
+ /******/ __webpack_require__.d(getter, { a: getter });
12841
+ /******/ return getter;
12842
+ /******/ };
12785
12843
  /******/
12786
12844
  /******/ /* webpack/runtime/define property getters */
12787
- /******/ (() => {
12788
- /******/ // define getter functions for harmony exports
12789
- /******/ __webpack_require__.d = (exports, definition) => {
12845
+ /******/ // define getter/value functions for harmony exports
12846
+ /******/ __webpack_require__.d = (exports, definition) => {
12847
+ /******/ if(Array.isArray(definition)) {
12848
+ /******/ var i = 0;
12849
+ /******/ while(i < definition.length) {
12850
+ /******/ var key = definition[i++];
12851
+ /******/ var binding = definition[i++];
12852
+ /******/ var descriptor = binding === 0 ? { enumerable: true, value: definition[i++] } : { enumerable: true, get: binding };
12853
+ /******/ if(!__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, descriptor);
12854
+ /******/ }
12855
+ /******/ } else {
12790
12856
  /******/ for(var key in definition) {
12791
12857
  /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
12792
12858
  /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
12793
12859
  /******/ }
12794
12860
  /******/ }
12795
- /******/ };
12796
- /******/ })();
12861
+ /******/ }
12862
+ /******/ };
12797
12863
  /******/
12798
12864
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
12799
- /******/ (() => {
12800
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
12801
- /******/ })();
12865
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop));
12802
12866
  /******/
12803
12867
  /******/ /* webpack/runtime/make namespace object */
12804
- /******/ (() => {
12805
- /******/ // define __esModule on exports
12806
- /******/ __webpack_require__.r = (exports) => {
12807
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
12808
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
12809
- /******/ }
12810
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
12811
- /******/ };
12812
- /******/ })();
12868
+ /******/ // define __esModule on exports
12869
+ /******/ __webpack_require__.r = (exports) => {
12870
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
12871
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
12872
+ /******/ };
12813
12873
  /******/
12814
12874
  /************************************************************************/
12815
- var __webpack_exports__ = {};
12875
+ let __webpack_exports__ = {};
12816
12876
  __webpack_require__.r(__webpack_exports__);
12817
12877
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
12818
12878
  /* harmony export */ ExternalChange: () => (/* reexport safe */ _useCodeMirror__WEBPACK_IMPORTED_MODULE_3__.Q),
12819
12879
  /* harmony export */ basicSetup: () => (/* reexport safe */ _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_7__.o),
12820
- /* harmony export */ "default": () => (src),
12821
12880
  /* harmony export */ getStatistics: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.m),
12822
12881
  /* harmony export */ minimalSetup: () => (/* reexport safe */ _uiw_codemirror_extensions_basic_setup__WEBPACK_IMPORTED_MODULE_7__.V),
12823
12882
  /* harmony export */ useCodeMirror: () => (/* reexport safe */ _useCodeMirror__WEBPACK_IMPORTED_MODULE_3__.q)
@@ -12826,7 +12885,7 @@ __webpack_require__.r(__webpack_exports__);
12826
12885
  /* harmony import */ var _home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectWithoutProperties_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(644);
12827
12886
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(442);
12828
12887
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
12829
- /* harmony import */ var _useCodeMirror__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(341);
12888
+ /* harmony import */ var _useCodeMirror__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(637);
12830
12889
  /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(742);
12831
12890
  /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__);
12832
12891
  /* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(730);
@@ -12847,6 +12906,10 @@ __webpack_require__.r(__webpack_exports__);
12847
12906
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(369);
12848
12907
  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_2__.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_1__/* ["default"] */ .A)(props,_excluded);var editor=(0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);var _useCodeMirror=(0,_useCodeMirror__WEBPACK_IMPORTED_MODULE_3__/* .useCodeMirror */ .q)({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,setContainer=_useCodeMirror.setContainer;(0,react__WEBPACK_IMPORTED_MODULE_2__.useImperativeHandle)(ref,function(){return{editor:editor.current,state:state,view:view};},[editor,container,state,view]);var setEditorRef=(0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function(el){editor.current=el;setContainer(el);},[setContainer]);// check type of value
12849
12908
  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_4__.jsx)("div",(0,_home_runner_work_react_codemirror_react_codemirror_node_modules_babel_runtime_helpers_esm_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A)({ref:setEditorRef,className:"".concat(defaultClassNames).concat(className?" ".concat(className):'')},other));});ReactCodeMirror.displayName='CodeMirror';/* harmony default export */ const src = (ReactCodeMirror);
12909
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, [
12910
+ /* harmony export */ "default", 0, src
12911
+ /* harmony export */ ]);
12912
+
12850
12913
  /******/ return __webpack_exports__;
12851
12914
  /******/ })()
12852
12915
  ;