chrome-devtools-frontend 1.0.1030457 → 1.0.1030946

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.
Files changed (55) hide show
  1. package/front_end/Tests.js +0 -28
  2. package/front_end/core/host/UserMetrics.ts +2 -1
  3. package/front_end/core/i18n/locales/en-US.json +11 -8
  4. package/front_end/core/i18n/locales/en-XL.json +11 -8
  5. package/front_end/core/root/Runtime.ts +1 -0
  6. package/front_end/core/sdk/CSSStyleSheetHeader.ts +0 -4
  7. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +0 -4
  8. package/front_end/core/sdk/NetworkRequest.ts +0 -4
  9. package/front_end/core/sdk/Resource.ts +0 -5
  10. package/front_end/core/sdk/Script.ts +71 -76
  11. package/front_end/entrypoints/main/MainImpl.ts +4 -0
  12. package/front_end/generated/InspectorBackendCommands.js +10 -8
  13. package/front_end/generated/protocol-mapping.d.ts +16 -2
  14. package/front_end/generated/protocol-proxy-api.d.ts +11 -1
  15. package/front_end/generated/protocol.ts +75 -1
  16. package/front_end/models/bindings/CompilerScriptMapping.ts +6 -3
  17. package/front_end/models/bindings/ContentProviderBasedProject.ts +2 -3
  18. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +1 -4
  19. package/front_end/models/bindings/IgnoreListManager.ts +10 -8
  20. package/front_end/models/bindings/ResourceMapping.ts +0 -4
  21. package/front_end/models/bindings/StylesSourceMapping.ts +0 -5
  22. package/front_end/models/extensions/ExtensionServer.ts +2 -3
  23. package/front_end/models/issues_manager/AttributionReportingIssue.ts +8 -0
  24. package/front_end/models/issues_manager/descriptions/arTooManyConcurrentRequests.md +5 -0
  25. package/front_end/models/javascript_metadata/NativeFunctions.js +6 -2
  26. package/front_end/models/persistence/NetworkPersistenceManager.ts +4 -6
  27. package/front_end/models/persistence/PersistenceActions.ts +5 -4
  28. package/front_end/models/text_utils/CodeMirrorUtils.ts +17 -4
  29. package/front_end/models/text_utils/ContentProvider.ts +0 -1
  30. package/front_end/models/text_utils/StaticContentProvider.ts +0 -4
  31. package/front_end/models/workspace/UISourceCode.ts +10 -5
  32. package/front_end/panels/elements/CSSRuleValidator.ts +107 -123
  33. package/front_end/panels/elements/components/CSSHintDetailsView.ts +23 -20
  34. package/front_end/panels/elements/components/cssHintDetailsView.css +2 -0
  35. package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +12 -0
  36. package/front_end/panels/network/components/RequestHeadersView.css +1 -0
  37. package/front_end/panels/network/components/RequestHeadersView.ts +7 -0
  38. package/front_end/panels/sources/NavigatorView.ts +22 -0
  39. package/front_end/third_party/codemirror.next/bundle.ts +1 -1
  40. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  41. package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -2
  42. package/front_end/third_party/codemirror.next/chunk/java.js +1 -2
  43. package/front_end/third_party/codemirror.next/chunk/json.js +1 -2
  44. package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -2
  45. package/front_end/third_party/codemirror.next/chunk/php.js +1 -2
  46. package/front_end/third_party/codemirror.next/chunk/python.js +1 -2
  47. package/front_end/third_party/codemirror.next/chunk/wast.js +1 -2
  48. package/front_end/third_party/codemirror.next/chunk/xml.js +1 -2
  49. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +1247 -116
  50. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -2
  51. package/front_end/ui/components/docs/building-ui-documentation/StylingComponents.md +64 -0
  52. package/front_end/ui/legacy/components/source_frame/ImageView.ts +10 -11
  53. package/front_end/ui/legacy/components/source_frame/PreviewFactory.ts +1 -1
  54. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +49 -0
  55. package/package.json +1 -1
@@ -1877,11 +1877,11 @@ type StyleSpec = {
1877
1877
  [propOrSelector: string]: string | number | StyleSpec | null
1878
1878
  }
1879
1879
 
1880
- declare type Attrs = {
1880
+ declare type Attrs$1 = {
1881
1881
  [name: string]: string;
1882
1882
  };
1883
1883
 
1884
- interface MarkDecorationSpec {
1884
+ interface MarkDecorationSpec$1 {
1885
1885
  /**
1886
1886
  Whether the mark covers its start and end position or not. This
1887
1887
  influences whether content inserted at those positions becomes
@@ -1923,11 +1923,11 @@ interface MarkDecorationSpec {
1923
1923
  */
1924
1924
  [other: string]: any;
1925
1925
  }
1926
- interface WidgetDecorationSpec {
1926
+ interface WidgetDecorationSpec$1 {
1927
1927
  /**
1928
1928
  The type of widget to draw here.
1929
1929
  */
1930
- widget: WidgetType;
1930
+ widget: WidgetType$1;
1931
1931
  /**
1932
1932
  Which side of the given position the widget is on. When this is
1933
1933
  positive, the widget will be drawn after the cursor if the
@@ -1954,12 +1954,12 @@ interface WidgetDecorationSpec {
1954
1954
  */
1955
1955
  [other: string]: any;
1956
1956
  }
1957
- interface ReplaceDecorationSpec {
1957
+ interface ReplaceDecorationSpec$1 {
1958
1958
  /**
1959
1959
  An optional widget to drawn in the place of the replaced
1960
1960
  content.
1961
1961
  */
1962
- widget?: WidgetType;
1962
+ widget?: WidgetType$1;
1963
1963
  /**
1964
1964
  Whether this range covers the positions on its sides. This
1965
1965
  influences whether new content becomes part of the range and
@@ -1984,7 +1984,7 @@ interface ReplaceDecorationSpec {
1984
1984
  */
1985
1985
  [other: string]: any;
1986
1986
  }
1987
- interface LineDecorationSpec {
1987
+ interface LineDecorationSpec$1 {
1988
1988
  /**
1989
1989
  DOM attributes to add to the element wrapping the line.
1990
1990
  */
@@ -2007,11 +2007,11 @@ delay creating of the DOM structure for a widget until it is
2007
2007
  needed, and to avoid redrawing widgets even if the decorations
2008
2008
  that define them are recreated.
2009
2009
  */
2010
- declare abstract class WidgetType {
2010
+ declare abstract class WidgetType$1 {
2011
2011
  /**
2012
2012
  Build the DOM structure for this widget instance.
2013
2013
  */
2014
- abstract toDOM(view: EditorView): HTMLElement;
2014
+ abstract toDOM(view: EditorView$1): HTMLElement;
2015
2015
  /**
2016
2016
  Compare this instance to another instance of the same type.
2017
2017
  (TypeScript can't express this, but only instances of the same
@@ -2021,7 +2021,7 @@ declare abstract class WidgetType {
2021
2021
  returns `false`, which will cause new instances of the widget to
2022
2022
  always be redrawn.
2023
2023
  */
2024
- eq(widget: WidgetType): boolean;
2024
+ eq(widget: WidgetType$1): boolean;
2025
2025
  /**
2026
2026
  Update a DOM element created by a widget of the same type (but
2027
2027
  different, non-`eq` content) to reflect this widget. May return
@@ -2054,11 +2054,11 @@ A decoration set represents a collection of decorated ranges,
2054
2054
  organized for efficient access and mapping. See
2055
2055
  [`RangeSet`](https://codemirror.net/6/docs/ref/#state.RangeSet) for its methods.
2056
2056
  */
2057
- declare type DecorationSet = RangeSet<Decoration>;
2057
+ declare type DecorationSet$1 = RangeSet<Decoration$1>;
2058
2058
  /**
2059
2059
  The different types of blocks that can occur in an editor view.
2060
2060
  */
2061
- declare enum BlockType {
2061
+ declare enum BlockType$1 {
2062
2062
  /**
2063
2063
  A line of text.
2064
2064
  */
@@ -2082,14 +2082,14 @@ of content. You'll usually use it wrapped in a
2082
2082
  [`Range`](https://codemirror.net/6/docs/ref/#state.Range), which adds a start and end position.
2083
2083
  @nonabstract
2084
2084
  */
2085
- declare abstract class Decoration extends RangeValue {
2085
+ declare abstract class Decoration$1 extends RangeValue {
2086
2086
  /**
2087
2087
  The config object used to create this decoration. You can
2088
2088
  include additional properties in there to store metadata about
2089
2089
  your decoration.
2090
2090
  */
2091
2091
  readonly spec: any;
2092
- abstract eq(other: Decoration): boolean;
2092
+ abstract eq(other: Decoration$1): boolean;
2093
2093
  /**
2094
2094
  Create a mark decoration, which influences the styling of the
2095
2095
  content in its range. Nested mark decorations will cause nested
@@ -2099,44 +2099,44 @@ declare abstract class Decoration extends RangeValue {
2099
2099
  Such elements are split on line boundaries and on the boundaries
2100
2100
  of lower-precedence decorations.
2101
2101
  */
2102
- static mark(spec: MarkDecorationSpec): Decoration;
2102
+ static mark(spec: MarkDecorationSpec$1): Decoration$1;
2103
2103
  /**
2104
2104
  Create a widget decoration, which displays a DOM element at the
2105
2105
  given position.
2106
2106
  */
2107
- static widget(spec: WidgetDecorationSpec): Decoration;
2107
+ static widget(spec: WidgetDecorationSpec$1): Decoration$1;
2108
2108
  /**
2109
2109
  Create a replace decoration which replaces the given range with
2110
2110
  a widget, or simply hides it.
2111
2111
  */
2112
- static replace(spec: ReplaceDecorationSpec): Decoration;
2112
+ static replace(spec: ReplaceDecorationSpec$1): Decoration$1;
2113
2113
  /**
2114
2114
  Create a line decoration, which can add DOM attributes to the
2115
2115
  line starting at the given position.
2116
2116
  */
2117
- static line(spec: LineDecorationSpec): Decoration;
2117
+ static line(spec: LineDecorationSpec$1): Decoration$1;
2118
2118
  /**
2119
2119
  Build a [`DecorationSet`](https://codemirror.net/6/docs/ref/#view.DecorationSet) from the given
2120
2120
  decorated range or ranges. If the ranges aren't already sorted,
2121
2121
  pass `true` for `sort` to make the library sort them for you.
2122
2122
  */
2123
- static set(of: Range<Decoration> | readonly Range<Decoration>[], sort?: boolean): DecorationSet;
2123
+ static set(of: Range<Decoration$1> | readonly Range<Decoration$1>[], sort?: boolean): DecorationSet$1;
2124
2124
  /**
2125
2125
  The empty set of decorations.
2126
2126
  */
2127
- static none: DecorationSet;
2127
+ static none: DecorationSet$1;
2128
2128
  }
2129
2129
 
2130
2130
  /**
2131
2131
  Basic rectangle type.
2132
2132
  */
2133
- interface Rect {
2133
+ interface Rect$1 {
2134
2134
  readonly left: number;
2135
2135
  readonly right: number;
2136
2136
  readonly top: number;
2137
2137
  readonly bottom: number;
2138
2138
  }
2139
- declare type ScrollStrategy = "nearest" | "start" | "end" | "center";
2139
+ declare type ScrollStrategy$1 = "nearest" | "start" | "end" | "center";
2140
2140
 
2141
2141
  /**
2142
2142
  Command functions are used in key bindings and other types of user
@@ -2145,11 +2145,11 @@ apply to the editor, and if it can, perform it as a side effect
2145
2145
  (which usually means [dispatching](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch) a
2146
2146
  transaction) and return `true`.
2147
2147
  */
2148
- declare type Command = (target: EditorView) => boolean;
2148
+ declare type Command = (target: EditorView$1) => boolean;
2149
2149
  /**
2150
2150
  This is the interface plugin objects conform to.
2151
2151
  */
2152
- interface PluginValue extends Object {
2152
+ interface PluginValue$1 extends Object {
2153
2153
  /**
2154
2154
  Notifies the plugin of an update that happened in the view. This
2155
2155
  is called _before_ the view updates its own DOM. It is
@@ -2160,7 +2160,7 @@ interface PluginValue extends Object {
2160
2160
  [`requestMeasure`](https://codemirror.net/6/docs/ref/#view.EditorView.requestMeasure) to schedule
2161
2161
  your code in a DOM reading phase if you need to.
2162
2162
  */
2163
- update?(update: ViewUpdate): void;
2163
+ update?(update: ViewUpdate$1): void;
2164
2164
  /**
2165
2165
  Called when the plugin is no longer going to be used. Should
2166
2166
  revert any changes the plugin made to the DOM.
@@ -2171,19 +2171,19 @@ interface PluginValue extends Object {
2171
2171
  Provides additional information when defining a [view
2172
2172
  plugin](https://codemirror.net/6/docs/ref/#view.ViewPlugin).
2173
2173
  */
2174
- interface PluginSpec<V extends PluginValue> {
2174
+ interface PluginSpec$1<V extends PluginValue$1> {
2175
2175
  /**
2176
2176
  Register the given [event
2177
2177
  handlers](https://codemirror.net/6/docs/ref/#view.EditorView^domEventHandlers) for the plugin.
2178
2178
  When called, these will have their `this` bound to the plugin
2179
2179
  value.
2180
2180
  */
2181
- eventHandlers?: DOMEventHandlers<V>;
2181
+ eventHandlers?: DOMEventHandlers$1<V>;
2182
2182
  /**
2183
2183
  Specify that the plugin provides additional extensions when
2184
2184
  added to an editor configuration.
2185
2185
  */
2186
- provide?: (plugin: ViewPlugin<V>) => Extension;
2186
+ provide?: (plugin: ViewPlugin$1<V>) => Extension;
2187
2187
  /**
2188
2188
  Allow the plugin to provide decorations. When given, this should
2189
2189
  a function that take the plugin value and return a [decoration
@@ -2191,14 +2191,14 @@ interface PluginSpec<V extends PluginValue> {
2191
2191
  [layout-changing decorations](https://codemirror.net/6/docs/ref/#view.EditorView^decorations)
2192
2192
  that depend on the view.
2193
2193
  */
2194
- decorations?: (value: V) => DecorationSet;
2194
+ decorations?: (value: V) => DecorationSet$1;
2195
2195
  }
2196
2196
  /**
2197
2197
  View plugins associate stateful values with a view. They can
2198
2198
  influence the way the content is drawn, and are notified of things
2199
2199
  that happen in the view.
2200
2200
  */
2201
- declare class ViewPlugin<V extends PluginValue> {
2201
+ declare class ViewPlugin$1<V extends PluginValue$1> {
2202
2202
  /**
2203
2203
  Instances of this class act as extensions.
2204
2204
  */
@@ -2208,42 +2208,42 @@ declare class ViewPlugin<V extends PluginValue> {
2208
2208
  Define a plugin from a constructor function that creates the
2209
2209
  plugin's value, given an editor view.
2210
2210
  */
2211
- static define<V extends PluginValue>(create: (view: EditorView) => V, spec?: PluginSpec<V>): ViewPlugin<V>;
2211
+ static define<V extends PluginValue$1>(create: (view: EditorView$1) => V, spec?: PluginSpec$1<V>): ViewPlugin$1<V>;
2212
2212
  /**
2213
2213
  Create a plugin for a class whose constructor takes a single
2214
2214
  editor view as argument.
2215
2215
  */
2216
- static fromClass<V extends PluginValue>(cls: {
2217
- new (view: EditorView): V;
2218
- }, spec?: PluginSpec<V>): ViewPlugin<V>;
2216
+ static fromClass<V extends PluginValue$1>(cls: {
2217
+ new (view: EditorView$1): V;
2218
+ }, spec?: PluginSpec$1<V>): ViewPlugin$1<V>;
2219
2219
  }
2220
- interface MeasureRequest<T> {
2220
+ interface MeasureRequest$1<T> {
2221
2221
  /**
2222
2222
  Called in a DOM read phase to gather information that requires
2223
2223
  DOM layout. Should _not_ mutate the document.
2224
2224
  */
2225
- read(view: EditorView): T;
2225
+ read(view: EditorView$1): T;
2226
2226
  /**
2227
2227
  Called in a DOM write phase to update the document. Should _not_
2228
2228
  do anything that triggers DOM layout.
2229
2229
  */
2230
- write?(measure: T, view: EditorView): void;
2230
+ write?(measure: T, view: EditorView$1): void;
2231
2231
  /**
2232
2232
  When multiple requests with the same key are scheduled, only the
2233
2233
  last one will actually be ran.
2234
2234
  */
2235
2235
  key?: any;
2236
2236
  }
2237
- declare type AttrSource = Attrs | ((view: EditorView) => Attrs | null);
2237
+ declare type AttrSource$1 = Attrs$1 | ((view: EditorView$1) => Attrs$1 | null);
2238
2238
  /**
2239
2239
  View [plugins](https://codemirror.net/6/docs/ref/#view.ViewPlugin) are given instances of this
2240
2240
  class, which describe what happened, whenever the view is updated.
2241
2241
  */
2242
- declare class ViewUpdate {
2242
+ declare class ViewUpdate$1 {
2243
2243
  /**
2244
2244
  The editor view that the update is associated with.
2245
2245
  */
2246
- readonly view: EditorView;
2246
+ readonly view: EditorView$1;
2247
2247
  /**
2248
2248
  The new editor state.
2249
2249
  */
@@ -2295,7 +2295,7 @@ Interface that objects registered with
2295
2295
  [`EditorView.mouseSelectionStyle`](https://codemirror.net/6/docs/ref/#view.EditorView^mouseSelectionStyle)
2296
2296
  must conform to.
2297
2297
  */
2298
- interface MouseSelectionStyle {
2298
+ interface MouseSelectionStyle$1 {
2299
2299
  /**
2300
2300
  Return a new selection for the mouse gesture that starts with
2301
2301
  the event that was originally given to the constructor, and ends
@@ -2320,15 +2320,15 @@ interface MouseSelectionStyle {
2320
2320
  using this (where `get` returns a new selection, which will
2321
2321
  trigger `update`, which schedules another `get` in response).
2322
2322
  */
2323
- update: (update: ViewUpdate) => boolean | void;
2323
+ update: (update: ViewUpdate$1) => boolean | void;
2324
2324
  }
2325
- declare type MakeSelectionStyle = (view: EditorView, event: MouseEvent) => MouseSelectionStyle | null;
2325
+ declare type MakeSelectionStyle$1 = (view: EditorView$1, event: MouseEvent) => MouseSelectionStyle$1 | null;
2326
2326
 
2327
2327
  /**
2328
2328
  Record used to represent information about a block-level element
2329
2329
  in the editor view.
2330
2330
  */
2331
- declare class BlockInfo {
2331
+ declare class BlockInfo$1 {
2332
2332
  /**
2333
2333
  The start of the element in the document.
2334
2334
  */
@@ -2350,7 +2350,7 @@ declare class BlockInfo {
2350
2350
  The type of element this is. When querying lines, this may be
2351
2351
  an array of all the blocks that make up the line.
2352
2352
  */
2353
- readonly type: BlockType | readonly BlockInfo[];
2353
+ readonly type: BlockType$1 | readonly BlockInfo$1[];
2354
2354
  /**
2355
2355
  The end of the element as a document position.
2356
2356
  */
@@ -2364,7 +2364,7 @@ declare class BlockInfo {
2364
2364
  /**
2365
2365
  Used to indicate [text direction](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection).
2366
2366
  */
2367
- declare enum Direction {
2367
+ declare enum Direction$1 {
2368
2368
  /**
2369
2369
  Left-to-right.
2370
2370
  */
@@ -2378,7 +2378,7 @@ declare enum Direction {
2378
2378
  Represents a contiguous range of text that has a single direction
2379
2379
  (as in left-to-right or right-to-left).
2380
2380
  */
2381
- declare class BidiSpan {
2381
+ declare class BidiSpan$1 {
2382
2382
  /**
2383
2383
  The start of the span (relative to the start of the line).
2384
2384
  */
@@ -2398,10 +2398,10 @@ declare class BidiSpan {
2398
2398
  /**
2399
2399
  The direction of this span.
2400
2400
  */
2401
- get dir(): Direction;
2401
+ get dir(): Direction$1;
2402
2402
  }
2403
2403
 
2404
- interface EditorConfig {
2404
+ interface EditorConfig$1 {
2405
2405
  /**
2406
2406
  The view's initial state. Defaults to an extension-less state
2407
2407
  with an empty document.
@@ -2436,7 +2436,7 @@ the editable DOM surface, and possibly other elements such as the
2436
2436
  line number gutter. It handles events and dispatches state
2437
2437
  transactions for editing actions.
2438
2438
  */
2439
- declare class EditorView {
2439
+ declare class EditorView$1 {
2440
2440
  /**
2441
2441
  The current editor state.
2442
2442
  */
@@ -2522,7 +2522,7 @@ declare class EditorView {
2522
2522
  /**
2523
2523
  Initialization options.
2524
2524
  */
2525
- config?: EditorConfig);
2525
+ config?: EditorConfig$1);
2526
2526
  /**
2527
2527
  All regular editor state updates should go through this. It
2528
2528
  takes a transaction or transaction spec and updates the view to
@@ -2568,14 +2568,14 @@ declare class EditorView {
2568
2568
  drawing done by other components is synchronized, avoiding
2569
2569
  unnecessary DOM layout computations.
2570
2570
  */
2571
- requestMeasure<T>(request?: MeasureRequest<T>): void;
2571
+ requestMeasure<T>(request?: MeasureRequest$1<T>): void;
2572
2572
  /**
2573
2573
  Get the value of a specific plugin, if present. Note that
2574
2574
  plugins that crash can be dropped from a view, so even when you
2575
2575
  know you registered a given plugin, it is recommended to check
2576
2576
  the return value of this method.
2577
2577
  */
2578
- plugin<T>(plugin: ViewPlugin<T>): T | null;
2578
+ plugin<T>(plugin: ViewPlugin$1<T>): T | null;
2579
2579
  /**
2580
2580
  The top position of the document, in screen coordinates. This
2581
2581
  may be negative when the editor is scrolled down. Points
@@ -2594,20 +2594,20 @@ declare class EditorView {
2594
2594
  position (which is interpreted as relative to the [top of the
2595
2595
  document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop)
2596
2596
  */
2597
- elementAtHeight(height: number): BlockInfo;
2597
+ elementAtHeight(height: number): BlockInfo$1;
2598
2598
  /**
2599
2599
  Find the line block (see
2600
2600
  [`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) at the given
2601
2601
  height.
2602
2602
  */
2603
- lineBlockAtHeight(height: number): BlockInfo;
2603
+ lineBlockAtHeight(height: number): BlockInfo$1;
2604
2604
  /**
2605
2605
  Get the extent and vertical position of all [line
2606
2606
  blocks](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) in the viewport. Positions
2607
2607
  are relative to the [top of the
2608
2608
  document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop);
2609
2609
  */
2610
- get viewportLineBlocks(): BlockInfo[];
2610
+ get viewportLineBlocks(): BlockInfo$1[];
2611
2611
  /**
2612
2612
  Find the line block around the given document position. A line
2613
2613
  block is a range delimited on both sides by either a
@@ -2616,7 +2616,7 @@ declare class EditorView {
2616
2616
  text, but may be broken into multiple textblocks by block
2617
2617
  widgets.
2618
2618
  */
2619
- lineBlockAt(pos: number): BlockInfo;
2619
+ lineBlockAt(pos: number): BlockInfo$1;
2620
2620
  /**
2621
2621
  The editor's total content height.
2622
2622
  */
@@ -2708,7 +2708,7 @@ declare class EditorView {
2708
2708
  available on the given side, the method will transparently use
2709
2709
  another strategy to get reasonable coordinates).
2710
2710
  */
2711
- coordsAtPos(pos: number, side?: -1 | 1): Rect | null;
2711
+ coordsAtPos(pos: number, side?: -1 | 1): Rect$1 | null;
2712
2712
  /**
2713
2713
  The default width of a character in the editor. May not
2714
2714
  accurately reflect the width of all characters (given variable
@@ -2725,7 +2725,7 @@ declare class EditorView {
2725
2725
  ([`direction`](https://developer.mozilla.org/en-US/docs/Web/CSS/direction)
2726
2726
  CSS property) of the editor's content element.
2727
2727
  */
2728
- get textDirection(): Direction;
2728
+ get textDirection(): Direction$1;
2729
2729
  /**
2730
2730
  Find the text direction of the block at the given position, as
2731
2731
  assigned by CSS. If
@@ -2735,7 +2735,7 @@ declare class EditorView {
2735
2735
  [`textDirection`](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection). Note that
2736
2736
  this may trigger a DOM layout.
2737
2737
  */
2738
- textDirectionAt(pos: number): Direction;
2738
+ textDirectionAt(pos: number): Direction$1;
2739
2739
  /**
2740
2740
  Whether this editor [wraps lines](https://codemirror.net/6/docs/ref/#view.EditorView.lineWrapping)
2741
2741
  (as determined by the
@@ -2751,7 +2751,7 @@ declare class EditorView {
2751
2751
  left-to-right, the leftmost spans come first, otherwise the
2752
2752
  rightmost spans come first.
2753
2753
  */
2754
- bidiSpans(line: Line$1): readonly BidiSpan[];
2754
+ bidiSpans(line: Line$1): readonly BidiSpan$1[];
2755
2755
  /**
2756
2756
  Check whether the editor has focus.
2757
2757
  */
@@ -2780,13 +2780,13 @@ declare class EditorView {
2780
2780
  to the top of the view, `"end"` to move it to the bottom, or
2781
2781
  `"center"` to move it to the center.
2782
2782
  */
2783
- y?: ScrollStrategy;
2783
+ y?: ScrollStrategy$1;
2784
2784
  /**
2785
2785
  Effect similar to
2786
2786
  [`y`](https://codemirror.net/6/docs/ref/#view.EditorView^scrollIntoView^options.y), but for the
2787
2787
  horizontal scroll position.
2788
2788
  */
2789
- x?: ScrollStrategy;
2789
+ x?: ScrollStrategy$1;
2790
2790
  /**
2791
2791
  Extra vertical distance to add when moving something into
2792
2792
  view. Not used with the `"center"` strategy. Defaults to 5.
@@ -2818,7 +2818,7 @@ declare class EditorView {
2818
2818
  editor's [scroll element](https://codemirror.net/6/docs/ref/#view.EditorView.scrollDOM) or one of
2819
2819
  its parent nodes is scrolled.
2820
2820
  */
2821
- static domEventHandlers(handlers: DOMEventHandlers<any>): Extension;
2821
+ static domEventHandlers(handlers: DOMEventHandlers$1<any>): Extension;
2822
2822
  /**
2823
2823
  An input handler can override the way changes to the editable
2824
2824
  DOM content are handled. Handlers are passed the document
@@ -2826,7 +2826,7 @@ declare class EditorView {
2826
2826
  content. When one returns true, no further input handlers are
2827
2827
  called and the default behavior is prevented.
2828
2828
  */
2829
- static inputHandler: Facet<(view: EditorView, from: number, to: number, text: string) => boolean, readonly ((view: EditorView, from: number, to: number, text: string) => boolean)[]>;
2829
+ static inputHandler: Facet<(view: EditorView$1, from: number, to: number, text: string) => boolean, readonly ((view: EditorView$1, from: number, to: number, text: string) => boolean)[]>;
2830
2830
  /**
2831
2831
  By default, the editor assumes all its content has the same
2832
2832
  [text direction](https://codemirror.net/6/docs/ref/#view.Direction). Configure this with a `true`
@@ -2846,7 +2846,7 @@ declare class EditorView {
2846
2846
  A facet that can be used to register a function to be called
2847
2847
  every time the view updates.
2848
2848
  */
2849
- static updateListener: Facet<(update: ViewUpdate) => void, readonly ((update: ViewUpdate) => void)[]>;
2849
+ static updateListener: Facet<(update: ViewUpdate$1) => void, readonly ((update: ViewUpdate$1) => void)[]>;
2850
2850
  /**
2851
2851
  Facet that controls whether the editor content DOM is editable.
2852
2852
  When its highest-precedence value is `false`, the element will
@@ -2862,7 +2862,7 @@ declare class EditorView {
2862
2862
  on the editor, and can return an object that overrides the way a
2863
2863
  selection is computed from that mouse click or drag.
2864
2864
  */
2865
- static mouseSelectionStyle: Facet<MakeSelectionStyle, readonly MakeSelectionStyle[]>;
2865
+ static mouseSelectionStyle: Facet<MakeSelectionStyle$1, readonly MakeSelectionStyle$1[]>;
2866
2866
  /**
2867
2867
  Facet used to configure whether a given selection drag event
2868
2868
  should move or copy the selection. The given predicate will be
@@ -2888,7 +2888,7 @@ declare class EditorView {
2888
2888
  and thus **must not** introduce block widgets or replacing
2889
2889
  decorations that cover line breaks.
2890
2890
  */
2891
- static decorations: Facet<DecorationSet | ((view: EditorView) => DecorationSet), readonly (DecorationSet | ((view: EditorView) => DecorationSet))[]>;
2891
+ static decorations: Facet<DecorationSet$1 | ((view: EditorView$1) => DecorationSet$1), readonly (DecorationSet$1 | ((view: EditorView$1) => DecorationSet$1))[]>;
2892
2892
  /**
2893
2893
  Used to provide ranges that should be treated as atoms as far as
2894
2894
  cursor motion is concerned. This causes methods like
@@ -2900,7 +2900,7 @@ declare class EditorView {
2900
2900
  updates](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection) from moving into such
2901
2901
  regions.
2902
2902
  */
2903
- static atomicRanges: Facet<(view: EditorView) => RangeSet<any>, readonly ((view: EditorView) => RangeSet<any>)[]>;
2903
+ static atomicRanges: Facet<(view: EditorView$1) => RangeSet<any>, readonly ((view: EditorView$1) => RangeSet<any>)[]>;
2904
2904
  /**
2905
2905
  Facet that allows extensions to provide additional scroll
2906
2906
  margins (space around the sides of the scrolling element that
@@ -2908,7 +2908,7 @@ declare class EditorView {
2908
2908
  plugin introduces elements that cover part of that element (for
2909
2909
  example a horizontally fixed gutter).
2910
2910
  */
2911
- static scrollMargins: Facet<(view: EditorView) => Partial<Rect> | null, readonly ((view: EditorView) => Partial<Rect> | null)[]>;
2911
+ static scrollMargins: Facet<(view: EditorView$1) => Partial<Rect$1> | null, readonly ((view: EditorView$1) => Partial<Rect$1> | null)[]>;
2912
2912
  /**
2913
2913
  Create a theme extension. The first argument can be a
2914
2914
  [`style-mod`](https://github.com/marijnh/style-mod#documentation)
@@ -2953,12 +2953,12 @@ declare class EditorView {
2953
2953
  Facet that provides additional DOM attributes for the editor's
2954
2954
  editable DOM element.
2955
2955
  */
2956
- static contentAttributes: Facet<AttrSource, readonly AttrSource[]>;
2956
+ static contentAttributes: Facet<AttrSource$1, readonly AttrSource$1[]>;
2957
2957
  /**
2958
2958
  Facet that provides DOM attributes for the editor's outer
2959
2959
  element.
2960
2960
  */
2961
- static editorAttributes: Facet<AttrSource, readonly AttrSource[]>;
2961
+ static editorAttributes: Facet<AttrSource$1, readonly AttrSource$1[]>;
2962
2962
  /**
2963
2963
  An extension that enables line wrapping in the editor (by
2964
2964
  setting CSS `white-space` to `pre-wrap` in the content).
@@ -2978,7 +2978,7 @@ declare class EditorView {
2978
2978
  Helper type that maps event names to event object types, or the
2979
2979
  `any` type for unknown events.
2980
2980
  */
2981
- interface DOMEventMap extends HTMLElementEventMap {
2981
+ interface DOMEventMap$1 extends HTMLElementEventMap {
2982
2982
  [other: string]: any;
2983
2983
  }
2984
2984
  /**
@@ -2988,8 +2988,8 @@ to hold the appropriate event object type. For unknown events, it
2988
2988
  is inferred to `any`, and should be explicitly set if you want type
2989
2989
  checking.
2990
2990
  */
2991
- declare type DOMEventHandlers<This> = {
2992
- [event in keyof DOMEventMap]?: (this: This, event: DOMEventMap[event], view: EditorView) => boolean | void;
2991
+ declare type DOMEventHandlers$1<This> = {
2992
+ [event in keyof DOMEventMap$1]?: (this: This, event: DOMEventMap$1[event], view: EditorView$1) => boolean | void;
2993
2993
  };
2994
2994
 
2995
2995
  /**
@@ -3191,7 +3191,7 @@ declare class MatchDecorator {
3191
3191
  The decoration to apply to matches, either directly or as a
3192
3192
  function of the match.
3193
3193
  */
3194
- decoration: Decoration | ((match: RegExpExecArray, view: EditorView, pos: number) => Decoration);
3194
+ decoration: Decoration$1 | ((match: RegExpExecArray, view: EditorView$1, pos: number) => Decoration$1);
3195
3195
  /**
3196
3196
  By default, changed lines are re-matched entirely. You can
3197
3197
  provide a boundary expression, which should match single
@@ -3213,13 +3213,13 @@ declare class MatchDecorator {
3213
3213
  view's viewport. You'll want to call this when initializing your
3214
3214
  plugin.
3215
3215
  */
3216
- createDeco(view: EditorView): RangeSet<Decoration>;
3216
+ createDeco(view: EditorView$1): RangeSet<Decoration$1>;
3217
3217
  /**
3218
3218
  Update a set of decorations for a view update. `deco` _must_ be
3219
3219
  the set of decorations produced by _this_ `MatchDecorator` for
3220
3220
  the view state before the update.
3221
3221
  */
3222
- updateDeco(update: ViewUpdate, deco: DecorationSet): DecorationSet;
3222
+ updateDeco(update: ViewUpdate$1, deco: DecorationSet$1): DecorationSet$1;
3223
3223
  private updateRange;
3224
3224
  }
3225
3225
 
@@ -3255,7 +3255,7 @@ declare function tooltips(config?: {
3255
3255
  for showing tooltips. You can provide a function here that
3256
3256
  returns an alternative rectangle.
3257
3257
  */
3258
- tooltipSpace?: (view: EditorView) => {
3258
+ tooltipSpace?: (view: EditorView$1) => {
3259
3259
  top: number;
3260
3260
  left: number;
3261
3261
  bottom: number;
@@ -3281,7 +3281,7 @@ interface Tooltip {
3281
3281
  A constructor function that creates the tooltip's [DOM
3282
3282
  representation](https://codemirror.net/6/docs/ref/#view.TooltipView).
3283
3283
  */
3284
- create(view: EditorView): TooltipView;
3284
+ create(view: EditorView$1): TooltipView;
3285
3285
  /**
3286
3286
  Whether the tooltip should be shown above or below the target
3287
3287
  position. Not guaranteed to be respected for hover tooltips
@@ -3327,7 +3327,7 @@ interface TooltipView {
3327
3327
  to make the tooltip view itself responsible for finding its
3328
3328
  screen position.
3329
3329
  */
3330
- getCoords?: (pos: number) => Rect;
3330
+ getCoords?: (pos: number) => Rect$1;
3331
3331
  /**
3332
3332
  By default, tooltips are moved when they overlap with other
3333
3333
  tooltips. Set this to `true` to disable that behavior for this
@@ -3337,11 +3337,11 @@ interface TooltipView {
3337
3337
  /**
3338
3338
  Called after the tooltip is added to the DOM for the first time.
3339
3339
  */
3340
- mount?(view: EditorView): void;
3340
+ mount?(view: EditorView$1): void;
3341
3341
  /**
3342
3342
  Update the DOM element for a change in the view's state.
3343
3343
  */
3344
- update?(update: ViewUpdate): void;
3344
+ update?(update: ViewUpdate$1): void;
3345
3345
  /**
3346
3346
  Called when the tooltip has been (re)positioned.
3347
3347
  */
@@ -3357,7 +3357,7 @@ tooltips. This can be useful when something happens (such as a
3357
3357
  re-positioning or CSS change affecting the editor) that could
3358
3358
  invalidate the existing tooltip positions.
3359
3359
  */
3360
- declare function repositionTooltips(view: EditorView): void;
3360
+ declare function repositionTooltips(view: EditorView$1): void;
3361
3361
  /**
3362
3362
  Object that describes an active panel.
3363
3363
  */
@@ -3374,7 +3374,7 @@ interface Panel {
3374
3374
  /**
3375
3375
  Update the DOM for a given view update.
3376
3376
  */
3377
- update?(update: ViewUpdate): void;
3377
+ update?(update: ViewUpdate$1): void;
3378
3378
  /**
3379
3379
  Called when the panel is removed from the editor or the editor
3380
3380
  is destroyed.
@@ -3390,7 +3390,7 @@ interface Panel {
3390
3390
  A function that initializes a panel. Used in
3391
3391
  [`showPanel`](https://codemirror.net/6/docs/ref/#view.showPanel).
3392
3392
  */
3393
- declare type PanelConstructor = (view: EditorView) => Panel;
3393
+ declare type PanelConstructor = (view: EditorView$1) => Panel;
3394
3394
  /**
3395
3395
  Opening a panel is done by providing a constructor function for
3396
3396
  the panel through this facet. (The panel is closed again when its
@@ -3411,7 +3411,7 @@ declare abstract class GutterMarker extends RangeValue {
3411
3411
  /**
3412
3412
  Render the DOM node for this marker, if any.
3413
3413
  */
3414
- toDOM?(view: EditorView): Node;
3414
+ toDOM?(view: EditorView$1): Node;
3415
3415
  /**
3416
3416
  This property can be used to add CSS classes to the gutter
3417
3417
  element that contains this marker.
@@ -3424,7 +3424,7 @@ declare abstract class GutterMarker extends RangeValue {
3424
3424
  destroy(dom: Node): void;
3425
3425
  }
3426
3426
  declare type Handlers$1 = {
3427
- [event: string]: (view: EditorView, line: BlockInfo, event: Event) => boolean;
3427
+ [event: string]: (view: EditorView$1, line: BlockInfo$1, event: Event) => boolean;
3428
3428
  };
3429
3429
  interface GutterConfig {
3430
3430
  /**
@@ -3440,26 +3440,26 @@ interface GutterConfig {
3440
3440
  /**
3441
3441
  Retrieve a set of markers to use in this gutter.
3442
3442
  */
3443
- markers?: (view: EditorView) => (RangeSet<GutterMarker> | readonly RangeSet<GutterMarker>[]);
3443
+ markers?: (view: EditorView$1) => (RangeSet<GutterMarker> | readonly RangeSet<GutterMarker>[]);
3444
3444
  /**
3445
3445
  Can be used to optionally add a single marker to every line.
3446
3446
  */
3447
- lineMarker?: (view: EditorView, line: BlockInfo, otherMarkers: readonly GutterMarker[]) => GutterMarker | null;
3447
+ lineMarker?: (view: EditorView$1, line: BlockInfo$1, otherMarkers: readonly GutterMarker[]) => GutterMarker | null;
3448
3448
  /**
3449
3449
  If line markers depend on additional state, and should be
3450
3450
  updated when that changes, pass a predicate here that checks
3451
3451
  whether a given view update might change the line markers.
3452
3452
  */
3453
- lineMarkerChange?: null | ((update: ViewUpdate) => boolean);
3453
+ lineMarkerChange?: null | ((update: ViewUpdate$1) => boolean);
3454
3454
  /**
3455
3455
  Add a hidden spacer element that gives the gutter its base
3456
3456
  width.
3457
3457
  */
3458
- initialSpacer?: null | ((view: EditorView) => GutterMarker);
3458
+ initialSpacer?: null | ((view: EditorView$1) => GutterMarker);
3459
3459
  /**
3460
3460
  Update the spacer element when the view is updated.
3461
3461
  */
3462
- updateSpacer?: null | ((spacer: GutterMarker, update: ViewUpdate) => GutterMarker);
3462
+ updateSpacer?: null | ((spacer: GutterMarker, update: ViewUpdate$1) => GutterMarker);
3463
3463
  /**
3464
3464
  Supply event handlers for DOM events on this gutter.
3465
3465
  */
@@ -3959,7 +3959,7 @@ interface FoldConfig {
3959
3959
  When this option isn't given, the `placeholderText` option will
3960
3960
  be used to create the placeholder element.
3961
3961
  */
3962
- placeholderDOM?: ((view: EditorView, onclick: (event: Event) => void) => HTMLElement) | null;
3962
+ placeholderDOM?: ((view: EditorView$1, onclick: (event: Event) => void) => HTMLElement) | null;
3963
3963
  /**
3964
3964
  Text to use as placeholder for folded text. Defaults to `"…"`.
3965
3965
  Will be styled with the `"cm-foldPlaceholder"` class.
@@ -3971,7 +3971,7 @@ Create an extension that configures code folding.
3971
3971
  */
3972
3972
  declare function codeFolding(config?: FoldConfig): Extension;
3973
3973
  declare type Handlers = {
3974
- [event: string]: (view: EditorView, line: BlockInfo, event: Event) => boolean;
3974
+ [event: string]: (view: EditorView$1, line: BlockInfo$1, event: Event) => boolean;
3975
3975
  };
3976
3976
  interface FoldGutterConfig {
3977
3977
  /**
@@ -4120,7 +4120,7 @@ interface Config {
4120
4120
  `cm-matchingBracket` class for matching pairs, and
4121
4121
  `cm-nonmatchingBracket` for mismatched pairs or single brackets.
4122
4122
  */
4123
- renderMatch?: (match: MatchResult, state: EditorState) => readonly Range<Decoration>[];
4123
+ renderMatch?: (match: MatchResult, state: EditorState) => readonly Range<Decoration$1>[];
4124
4124
  }
4125
4125
  /**
4126
4126
  Create an extension that enables bracket matching. Whenever the
@@ -4408,7 +4408,7 @@ interface Completion {
4408
4408
  adding the [`pickedCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.pickedCompletion)
4409
4409
  annotation to it.
4410
4410
  */
4411
- apply?: string | ((view: EditorView, completion: Completion, from: number, to: number) => void);
4411
+ apply?: string | ((view: EditorView$1, completion: Completion, from: number, to: number) => void);
4412
4412
  /**
4413
4413
  The type of the completion. This is used to pick an icon to show
4414
4414
  for the completion. Icons are styled with a CSS class created by
@@ -4975,34 +4975,1165 @@ declare namespace _codemirror_lang_markdown {
4975
4975
  };
4976
4976
  }
4977
4977
 
4978
+ declare type Attrs = {
4979
+ [name: string]: string;
4980
+ };
4981
+
4982
+ interface MarkDecorationSpec {
4983
+ /**
4984
+ Whether the mark covers its start and end position or not. This
4985
+ influences whether content inserted at those positions becomes
4986
+ part of the mark. Defaults to false.
4987
+ */
4988
+ inclusive?: boolean;
4989
+ /**
4990
+ Specify whether the start position of the marked range should be
4991
+ inclusive. Overrides `inclusive`, when both are present.
4992
+ */
4993
+ inclusiveStart?: boolean;
4994
+ /**
4995
+ Whether the end should be inclusive.
4996
+ */
4997
+ inclusiveEnd?: boolean;
4998
+ /**
4999
+ Add attributes to the DOM elements that hold the text in the
5000
+ marked range.
5001
+ */
5002
+ attributes?: {
5003
+ [key: string]: string;
5004
+ };
5005
+ /**
5006
+ Shorthand for `{attributes: {class: value}}`.
5007
+ */
5008
+ class?: string;
5009
+ /**
5010
+ Add a wrapping element around the text in the marked range. Note
5011
+ that there will not necessarily be a single element covering the
5012
+ entire range—other decorations with lower precedence might split
5013
+ this one if they partially overlap it, and line breaks always
5014
+ end decoration elements.
5015
+ */
5016
+ tagName?: string;
5017
+ /**
5018
+ Decoration specs allow extra properties, which can be retrieved
5019
+ through the decoration's [`spec`](https://codemirror.net/6/docs/ref/#view.Decoration.spec)
5020
+ property.
5021
+ */
5022
+ [other: string]: any;
5023
+ }
5024
+ interface WidgetDecorationSpec {
5025
+ /**
5026
+ The type of widget to draw here.
5027
+ */
5028
+ widget: WidgetType;
5029
+ /**
5030
+ Which side of the given position the widget is on. When this is
5031
+ positive, the widget will be drawn after the cursor if the
5032
+ cursor is on the same position. Otherwise, it'll be drawn before
5033
+ it. When multiple widgets sit at the same position, their `side`
5034
+ values will determine their ordering—those with a lower value
5035
+ come first. Defaults to 0.
5036
+ */
5037
+ side?: number;
5038
+ /**
5039
+ Determines whether this is a block widgets, which will be drawn
5040
+ between lines, or an inline widget (the default) which is drawn
5041
+ between the surrounding text.
5042
+
5043
+ Note that block-level decorations should not have vertical
5044
+ margins, and if you dynamically change their height, you should
5045
+ make sure to call
5046
+ [`requestMeasure`](https://codemirror.net/6/docs/ref/#view.EditorView.requestMeasure), so that the
5047
+ editor can update its information about its vertical layout.
5048
+ */
5049
+ block?: boolean;
5050
+ /**
5051
+ Other properties are allowed.
5052
+ */
5053
+ [other: string]: any;
5054
+ }
5055
+ interface ReplaceDecorationSpec {
5056
+ /**
5057
+ An optional widget to drawn in the place of the replaced
5058
+ content.
5059
+ */
5060
+ widget?: WidgetType;
5061
+ /**
5062
+ Whether this range covers the positions on its sides. This
5063
+ influences whether new content becomes part of the range and
5064
+ whether the cursor can be drawn on its sides. Defaults to false
5065
+ for inline replacements, and true for block replacements.
5066
+ */
5067
+ inclusive?: boolean;
5068
+ /**
5069
+ Set inclusivity at the start.
5070
+ */
5071
+ inclusiveStart?: boolean;
5072
+ /**
5073
+ Set inclusivity at the end.
5074
+ */
5075
+ inclusiveEnd?: boolean;
5076
+ /**
5077
+ Whether this is a block-level decoration. Defaults to false.
5078
+ */
5079
+ block?: boolean;
5080
+ /**
5081
+ Other properties are allowed.
5082
+ */
5083
+ [other: string]: any;
5084
+ }
5085
+ interface LineDecorationSpec {
5086
+ /**
5087
+ DOM attributes to add to the element wrapping the line.
5088
+ */
5089
+ attributes?: {
5090
+ [key: string]: string;
5091
+ };
5092
+ /**
5093
+ Shorthand for `{attributes: {class: value}}`.
5094
+ */
5095
+ class?: string;
5096
+ /**
5097
+ Other properties are allowed.
5098
+ */
5099
+ [other: string]: any;
5100
+ }
4978
5101
  /**
4979
- Describes a problem or hint for a piece of code.
5102
+ Widgets added to the content are described by subclasses of this
5103
+ class. Using a description object like that makes it possible to
5104
+ delay creating of the DOM structure for a widget until it is
5105
+ needed, and to avoid redrawing widgets even if the decorations
5106
+ that define them are recreated.
4980
5107
  */
4981
- interface Diagnostic {
5108
+ declare abstract class WidgetType {
4982
5109
  /**
4983
- The start position of the relevant text.
5110
+ Build the DOM structure for this widget instance.
4984
5111
  */
4985
- from: number;
5112
+ abstract toDOM(view: EditorView): HTMLElement;
4986
5113
  /**
4987
- The end position. May be equal to `from`, though actually
4988
- covering text is preferable.
5114
+ Compare this instance to another instance of the same type.
5115
+ (TypeScript can't express this, but only instances of the same
5116
+ specific class will be passed to this method.) This is used to
5117
+ avoid redrawing widgets when they are replaced by a new
5118
+ decoration of the same type. The default implementation just
5119
+ returns `false`, which will cause new instances of the widget to
5120
+ always be redrawn.
4989
5121
  */
4990
- to: number;
5122
+ eq(widget: WidgetType): boolean;
4991
5123
  /**
4992
- The severity of the problem. This will influence how it is
4993
- displayed.
5124
+ Update a DOM element created by a widget of the same type (but
5125
+ different, non-`eq` content) to reflect this widget. May return
5126
+ true to indicate that it could update, false to indicate it
5127
+ couldn't (in which case the widget will be redrawn). The default
5128
+ implementation just returns false.
4994
5129
  */
4995
- severity: "info" | "warning" | "error";
5130
+ updateDOM(dom: HTMLElement): boolean;
4996
5131
  /**
4997
- An optional source string indicating where the diagnostic is
4998
- coming from. You can put the name of your linter here, if
4999
- applicable.
5132
+ The estimated height this widget will have, to be used when
5133
+ estimating the height of content that hasn't been drawn. May
5134
+ return -1 to indicate you don't know. The default implementation
5135
+ returns -1.
5000
5136
  */
5001
- source?: string;
5137
+ get estimatedHeight(): number;
5002
5138
  /**
5003
- The message associated with this diagnostic.
5139
+ Can be used to configure which kinds of events inside the widget
5140
+ should be ignored by the editor. The default is to ignore all
5141
+ events.
5004
5142
  */
5005
- message: string;
5143
+ ignoreEvent(event: Event): boolean;
5144
+ /**
5145
+ This is called when the an instance of the widget is removed
5146
+ from the editor view.
5147
+ */
5148
+ destroy(dom: HTMLElement): void;
5149
+ }
5150
+ /**
5151
+ A decoration set represents a collection of decorated ranges,
5152
+ organized for efficient access and mapping. See
5153
+ [`RangeSet`](https://codemirror.net/6/docs/ref/#state.RangeSet) for its methods.
5154
+ */
5155
+ declare type DecorationSet = RangeSet<Decoration>;
5156
+ /**
5157
+ The different types of blocks that can occur in an editor view.
5158
+ */
5159
+ declare enum BlockType {
5160
+ /**
5161
+ A line of text.
5162
+ */
5163
+ Text = 0,
5164
+ /**
5165
+ A block widget associated with the position after it.
5166
+ */
5167
+ WidgetBefore = 1,
5168
+ /**
5169
+ A block widget associated with the position before it.
5170
+ */
5171
+ WidgetAfter = 2,
5172
+ /**
5173
+ A block widget [replacing](https://codemirror.net/6/docs/ref/#view.Decoration^replace) a range of content.
5174
+ */
5175
+ WidgetRange = 3
5176
+ }
5177
+ /**
5178
+ A decoration provides information on how to draw or style a piece
5179
+ of content. You'll usually use it wrapped in a
5180
+ [`Range`](https://codemirror.net/6/docs/ref/#state.Range), which adds a start and end position.
5181
+ @nonabstract
5182
+ */
5183
+ declare abstract class Decoration extends RangeValue {
5184
+ /**
5185
+ The config object used to create this decoration. You can
5186
+ include additional properties in there to store metadata about
5187
+ your decoration.
5188
+ */
5189
+ readonly spec: any;
5190
+ protected constructor(
5191
+ /**
5192
+ @internal
5193
+ */
5194
+ startSide: number,
5195
+ /**
5196
+ @internal
5197
+ */
5198
+ endSide: number,
5199
+ /**
5200
+ @internal
5201
+ */
5202
+ widget: WidgetType | null,
5203
+ /**
5204
+ The config object used to create this decoration. You can
5205
+ include additional properties in there to store metadata about
5206
+ your decoration.
5207
+ */
5208
+ spec: any);
5209
+ abstract eq(other: Decoration): boolean;
5210
+ /**
5211
+ Create a mark decoration, which influences the styling of the
5212
+ content in its range. Nested mark decorations will cause nested
5213
+ DOM elements to be created. Nesting order is determined by
5214
+ precedence of the [facet](https://codemirror.net/6/docs/ref/#view.EditorView^decorations), with
5215
+ the higher-precedence decorations creating the inner DOM nodes.
5216
+ Such elements are split on line boundaries and on the boundaries
5217
+ of lower-precedence decorations.
5218
+ */
5219
+ static mark(spec: MarkDecorationSpec): Decoration;
5220
+ /**
5221
+ Create a widget decoration, which displays a DOM element at the
5222
+ given position.
5223
+ */
5224
+ static widget(spec: WidgetDecorationSpec): Decoration;
5225
+ /**
5226
+ Create a replace decoration which replaces the given range with
5227
+ a widget, or simply hides it.
5228
+ */
5229
+ static replace(spec: ReplaceDecorationSpec): Decoration;
5230
+ /**
5231
+ Create a line decoration, which can add DOM attributes to the
5232
+ line starting at the given position.
5233
+ */
5234
+ static line(spec: LineDecorationSpec): Decoration;
5235
+ /**
5236
+ Build a [`DecorationSet`](https://codemirror.net/6/docs/ref/#view.DecorationSet) from the given
5237
+ decorated range or ranges. If the ranges aren't already sorted,
5238
+ pass `true` for `sort` to make the library sort them for you.
5239
+ */
5240
+ static set(of: Range<Decoration> | readonly Range<Decoration>[], sort?: boolean): DecorationSet;
5241
+ /**
5242
+ The empty set of decorations.
5243
+ */
5244
+ static none: DecorationSet;
5245
+ }
5246
+
5247
+ /**
5248
+ Basic rectangle type.
5249
+ */
5250
+ interface Rect {
5251
+ readonly left: number;
5252
+ readonly right: number;
5253
+ readonly top: number;
5254
+ readonly bottom: number;
5255
+ }
5256
+ declare type ScrollStrategy = "nearest" | "start" | "end" | "center";
5257
+ /**
5258
+ This is the interface plugin objects conform to.
5259
+ */
5260
+ interface PluginValue extends Object {
5261
+ /**
5262
+ Notifies the plugin of an update that happened in the view. This
5263
+ is called _before_ the view updates its own DOM. It is
5264
+ responsible for updating the plugin's internal state (including
5265
+ any state that may be read by plugin fields) and _writing_ to
5266
+ the DOM for the changes in the update. To avoid unnecessary
5267
+ layout recomputations, it should _not_ read the DOM layout—use
5268
+ [`requestMeasure`](https://codemirror.net/6/docs/ref/#view.EditorView.requestMeasure) to schedule
5269
+ your code in a DOM reading phase if you need to.
5270
+ */
5271
+ update?(update: ViewUpdate): void;
5272
+ /**
5273
+ Called when the plugin is no longer going to be used. Should
5274
+ revert any changes the plugin made to the DOM.
5275
+ */
5276
+ destroy?(): void;
5277
+ }
5278
+ /**
5279
+ Provides additional information when defining a [view
5280
+ plugin](https://codemirror.net/6/docs/ref/#view.ViewPlugin).
5281
+ */
5282
+ interface PluginSpec<V extends PluginValue> {
5283
+ /**
5284
+ Register the given [event
5285
+ handlers](https://codemirror.net/6/docs/ref/#view.EditorView^domEventHandlers) for the plugin.
5286
+ When called, these will have their `this` bound to the plugin
5287
+ value.
5288
+ */
5289
+ eventHandlers?: DOMEventHandlers<V>;
5290
+ /**
5291
+ Specify that the plugin provides additional extensions when
5292
+ added to an editor configuration.
5293
+ */
5294
+ provide?: (plugin: ViewPlugin<V>) => Extension;
5295
+ /**
5296
+ Allow the plugin to provide decorations. When given, this should
5297
+ be a function that take the plugin value and return a
5298
+ [decoration set](https://codemirror.net/6/docs/ref/#view.DecorationSet). See also the caveat about
5299
+ [layout-changing decorations](https://codemirror.net/6/docs/ref/#view.EditorView^decorations) that
5300
+ depend on the view.
5301
+ */
5302
+ decorations?: (value: V) => DecorationSet;
5303
+ }
5304
+ /**
5305
+ View plugins associate stateful values with a view. They can
5306
+ influence the way the content is drawn, and are notified of things
5307
+ that happen in the view.
5308
+ */
5309
+ declare class ViewPlugin<V extends PluginValue> {
5310
+ /**
5311
+ Instances of this class act as extensions.
5312
+ */
5313
+ extension: Extension;
5314
+ private constructor();
5315
+ /**
5316
+ Define a plugin from a constructor function that creates the
5317
+ plugin's value, given an editor view.
5318
+ */
5319
+ static define<V extends PluginValue>(create: (view: EditorView) => V, spec?: PluginSpec<V>): ViewPlugin<V>;
5320
+ /**
5321
+ Create a plugin for a class whose constructor takes a single
5322
+ editor view as argument.
5323
+ */
5324
+ static fromClass<V extends PluginValue>(cls: {
5325
+ new (view: EditorView): V;
5326
+ }, spec?: PluginSpec<V>): ViewPlugin<V>;
5327
+ }
5328
+ interface MeasureRequest<T> {
5329
+ /**
5330
+ Called in a DOM read phase to gather information that requires
5331
+ DOM layout. Should _not_ mutate the document.
5332
+ */
5333
+ read(view: EditorView): T;
5334
+ /**
5335
+ Called in a DOM write phase to update the document. Should _not_
5336
+ do anything that triggers DOM layout.
5337
+ */
5338
+ write?(measure: T, view: EditorView): void;
5339
+ /**
5340
+ When multiple requests with the same key are scheduled, only the
5341
+ last one will actually be ran.
5342
+ */
5343
+ key?: any;
5344
+ }
5345
+ declare type AttrSource = Attrs | ((view: EditorView) => Attrs | null);
5346
+ /**
5347
+ View [plugins](https://codemirror.net/6/docs/ref/#view.ViewPlugin) are given instances of this
5348
+ class, which describe what happened, whenever the view is updated.
5349
+ */
5350
+ declare class ViewUpdate {
5351
+ /**
5352
+ The editor view that the update is associated with.
5353
+ */
5354
+ readonly view: EditorView;
5355
+ /**
5356
+ The new editor state.
5357
+ */
5358
+ readonly state: EditorState;
5359
+ /**
5360
+ The transactions involved in the update. May be empty.
5361
+ */
5362
+ readonly transactions: readonly Transaction[];
5363
+ /**
5364
+ The changes made to the document by this update.
5365
+ */
5366
+ readonly changes: ChangeSet;
5367
+ /**
5368
+ The previous editor state.
5369
+ */
5370
+ readonly startState: EditorState;
5371
+ private constructor();
5372
+ /**
5373
+ Tells you whether the [viewport](https://codemirror.net/6/docs/ref/#view.EditorView.viewport) or
5374
+ [visible ranges](https://codemirror.net/6/docs/ref/#view.EditorView.visibleRanges) changed in this
5375
+ update.
5376
+ */
5377
+ get viewportChanged(): boolean;
5378
+ /**
5379
+ Indicates whether the height of a block element in the editor
5380
+ changed in this update.
5381
+ */
5382
+ get heightChanged(): boolean;
5383
+ /**
5384
+ Returns true when the document was modified or the size of the
5385
+ editor, or elements within the editor, changed.
5386
+ */
5387
+ get geometryChanged(): boolean;
5388
+ /**
5389
+ True when this update indicates a focus change.
5390
+ */
5391
+ get focusChanged(): boolean;
5392
+ /**
5393
+ Whether the document changed in this update.
5394
+ */
5395
+ get docChanged(): boolean;
5396
+ /**
5397
+ Whether the selection was explicitly set in this update.
5398
+ */
5399
+ get selectionSet(): boolean;
5400
+ }
5401
+
5402
+ /**
5403
+ Interface that objects registered with
5404
+ [`EditorView.mouseSelectionStyle`](https://codemirror.net/6/docs/ref/#view.EditorView^mouseSelectionStyle)
5405
+ must conform to.
5406
+ */
5407
+ interface MouseSelectionStyle {
5408
+ /**
5409
+ Return a new selection for the mouse gesture that starts with
5410
+ the event that was originally given to the constructor, and ends
5411
+ with the event passed here. In case of a plain click, those may
5412
+ both be the `mousedown` event, in case of a drag gesture, the
5413
+ latest `mousemove` event will be passed.
5414
+
5415
+ When `extend` is true, that means the new selection should, if
5416
+ possible, extend the start selection. If `multiple` is true, the
5417
+ new selection should be added to the original selection.
5418
+ */
5419
+ get: (curEvent: MouseEvent, extend: boolean, multiple: boolean) => EditorSelection;
5420
+ /**
5421
+ Called when the view is updated while the gesture is in
5422
+ progress. When the document changes, it may be necessary to map
5423
+ some data (like the original selection or start position)
5424
+ through the changes.
5425
+
5426
+ This may return `true` to indicate that the `get` method should
5427
+ get queried again after the update, because something in the
5428
+ update could change its result. Be wary of infinite loops when
5429
+ using this (where `get` returns a new selection, which will
5430
+ trigger `update`, which schedules another `get` in response).
5431
+ */
5432
+ update: (update: ViewUpdate) => boolean | void;
5433
+ }
5434
+ declare type MakeSelectionStyle = (view: EditorView, event: MouseEvent) => MouseSelectionStyle | null;
5435
+
5436
+ /**
5437
+ Record used to represent information about a block-level element
5438
+ in the editor view.
5439
+ */
5440
+ declare class BlockInfo {
5441
+ /**
5442
+ The start of the element in the document.
5443
+ */
5444
+ readonly from: number;
5445
+ /**
5446
+ The length of the element.
5447
+ */
5448
+ readonly length: number;
5449
+ /**
5450
+ The top position of the element (relative to the top of the
5451
+ document).
5452
+ */
5453
+ readonly top: number;
5454
+ /**
5455
+ Its height.
5456
+ */
5457
+ readonly height: number;
5458
+ /**
5459
+ The type of element this is. When querying lines, this may be
5460
+ an array of all the blocks that make up the line.
5461
+ */
5462
+ readonly type: BlockType | readonly BlockInfo[];
5463
+ /**
5464
+ The end of the element as a document position.
5465
+ */
5466
+ get to(): number;
5467
+ /**
5468
+ The bottom position of the element.
5469
+ */
5470
+ get bottom(): number;
5471
+ }
5472
+
5473
+ /**
5474
+ Used to indicate [text direction](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection).
5475
+ */
5476
+ declare enum Direction {
5477
+ /**
5478
+ Left-to-right.
5479
+ */
5480
+ LTR = 0,
5481
+ /**
5482
+ Right-to-left.
5483
+ */
5484
+ RTL = 1
5485
+ }
5486
+ /**
5487
+ Represents a contiguous range of text that has a single direction
5488
+ (as in left-to-right or right-to-left).
5489
+ */
5490
+ declare class BidiSpan {
5491
+ /**
5492
+ The start of the span (relative to the start of the line).
5493
+ */
5494
+ readonly from: number;
5495
+ /**
5496
+ The end of the span.
5497
+ */
5498
+ readonly to: number;
5499
+ /**
5500
+ The ["bidi
5501
+ level"](https://unicode.org/reports/tr9/#Basic_Display_Algorithm)
5502
+ of the span (in this context, 0 means
5503
+ left-to-right, 1 means right-to-left, 2 means left-to-right
5504
+ number inside right-to-left text).
5505
+ */
5506
+ readonly level: number;
5507
+ /**
5508
+ The direction of this span.
5509
+ */
5510
+ get dir(): Direction;
5511
+ }
5512
+
5513
+ interface EditorConfig {
5514
+ /**
5515
+ The view's initial state. Defaults to an extension-less state
5516
+ with an empty document.
5517
+ */
5518
+ state?: EditorState;
5519
+ /**
5520
+ When given, the editor is immediately appended to the given
5521
+ element on creation. (Otherwise, you'll have to place the view's
5522
+ [`dom`](https://codemirror.net/6/docs/ref/#view.EditorView.dom) element in the document yourself.)
5523
+ */
5524
+ parent?: Element | DocumentFragment;
5525
+ /**
5526
+ If the view is going to be mounted in a shadow root or document
5527
+ other than the one held by the global variable `document` (the
5528
+ default), you should pass it here. If you provide `parent`, but
5529
+ not this option, the editor will automatically look up a root
5530
+ from the parent.
5531
+ */
5532
+ root?: Document | ShadowRoot;
5533
+ /**
5534
+ Override the transaction [dispatch
5535
+ function](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch) for this editor view, which
5536
+ is the way updates get routed to the view. Your implementation,
5537
+ if provided, should probably call the view's [`update`
5538
+ method](https://codemirror.net/6/docs/ref/#view.EditorView.update).
5539
+ */
5540
+ dispatch?: (tr: Transaction) => void;
5541
+ }
5542
+ /**
5543
+ An editor view represents the editor's user interface. It holds
5544
+ the editable DOM surface, and possibly other elements such as the
5545
+ line number gutter. It handles events and dispatches state
5546
+ transactions for editing actions.
5547
+ */
5548
+ declare class EditorView {
5549
+ /**
5550
+ The current editor state.
5551
+ */
5552
+ get state(): EditorState;
5553
+ /**
5554
+ To be able to display large documents without consuming too much
5555
+ memory or overloading the browser, CodeMirror only draws the
5556
+ code that is visible (plus a margin around it) to the DOM. This
5557
+ property tells you the extent of the current drawn viewport, in
5558
+ document positions.
5559
+ */
5560
+ get viewport(): {
5561
+ from: number;
5562
+ to: number;
5563
+ };
5564
+ /**
5565
+ When there are, for example, large collapsed ranges in the
5566
+ viewport, its size can be a lot bigger than the actual visible
5567
+ content. Thus, if you are doing something like styling the
5568
+ content in the viewport, it is preferable to only do so for
5569
+ these ranges, which are the subset of the viewport that is
5570
+ actually drawn.
5571
+ */
5572
+ get visibleRanges(): readonly {
5573
+ from: number;
5574
+ to: number;
5575
+ }[];
5576
+ /**
5577
+ Returns false when the editor is entirely scrolled out of view
5578
+ or otherwise hidden.
5579
+ */
5580
+ get inView(): boolean;
5581
+ /**
5582
+ Indicates whether the user is currently composing text via
5583
+ [IME](https://en.wikipedia.org/wiki/Input_method), and at least
5584
+ one change has been made in the current composition.
5585
+ */
5586
+ get composing(): boolean;
5587
+ /**
5588
+ Indicates whether the user is currently in composing state. Note
5589
+ that on some platforms, like Android, this will be the case a
5590
+ lot, since just putting the cursor on a word starts a
5591
+ composition there.
5592
+ */
5593
+ get compositionStarted(): boolean;
5594
+ private _dispatch;
5595
+ /**
5596
+ The document or shadow root that the view lives in.
5597
+ */
5598
+ readonly root: DocumentOrShadowRoot;
5599
+ /**
5600
+ The DOM element that wraps the entire editor view.
5601
+ */
5602
+ readonly dom: HTMLElement;
5603
+ /**
5604
+ The DOM element that can be styled to scroll. (Note that it may
5605
+ not have been, so you can't assume this is scrollable.)
5606
+ */
5607
+ readonly scrollDOM: HTMLElement;
5608
+ /**
5609
+ The editable DOM element holding the editor content. You should
5610
+ not, usually, interact with this content directly though the
5611
+ DOM, since the editor will immediately undo most of the changes
5612
+ you make. Instead, [dispatch](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch)
5613
+ [transactions](https://codemirror.net/6/docs/ref/#state.Transaction) to modify content, and
5614
+ [decorations](https://codemirror.net/6/docs/ref/#view.Decoration) to style it.
5615
+ */
5616
+ readonly contentDOM: HTMLElement;
5617
+ private announceDOM;
5618
+ private plugins;
5619
+ private pluginMap;
5620
+ private editorAttrs;
5621
+ private contentAttrs;
5622
+ private styleModules;
5623
+ private bidiCache;
5624
+ private destroyed;
5625
+ /**
5626
+ Construct a new view. You'll want to either provide a `parent`
5627
+ option, or put `view.dom` into your document after creating a
5628
+ view, so that the user can see the editor.
5629
+ */
5630
+ constructor(
5631
+ /**
5632
+ Initialization options.
5633
+ */
5634
+ config?: EditorConfig);
5635
+ /**
5636
+ All regular editor state updates should go through this. It
5637
+ takes a transaction or transaction spec and updates the view to
5638
+ show the new state produced by that transaction. Its
5639
+ implementation can be overridden with an
5640
+ [option](https://codemirror.net/6/docs/ref/#view.EditorView.constructor^config.dispatch). This
5641
+ function is bound to the view instance, so it does not have to
5642
+ be called as a method.
5643
+ */
5644
+ dispatch(tr: Transaction): void;
5645
+ dispatch(...specs: TransactionSpec[]): void;
5646
+ /**
5647
+ Update the view for the given array of transactions. This will
5648
+ update the visible document and selection to match the state
5649
+ produced by the transactions, and notify view plugins of the
5650
+ change. You should usually call
5651
+ [`dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch) instead, which uses this
5652
+ as a primitive.
5653
+ */
5654
+ update(transactions: readonly Transaction[]): void;
5655
+ /**
5656
+ Reset the view to the given state. (This will cause the entire
5657
+ document to be redrawn and all view plugins to be reinitialized,
5658
+ so you should probably only use it when the new state isn't
5659
+ derived from the old state. Otherwise, use
5660
+ [`dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch) instead.)
5661
+ */
5662
+ setState(newState: EditorState): void;
5663
+ private updatePlugins;
5664
+ /**
5665
+ Get the CSS classes for the currently active editor themes.
5666
+ */
5667
+ get themeClasses(): string;
5668
+ private updateAttrs;
5669
+ private showAnnouncements;
5670
+ private mountStyles;
5671
+ private readMeasured;
5672
+ /**
5673
+ Schedule a layout measurement, optionally providing callbacks to
5674
+ do custom DOM measuring followed by a DOM write phase. Using
5675
+ this is preferable reading DOM layout directly from, for
5676
+ example, an event handler, because it'll make sure measuring and
5677
+ drawing done by other components is synchronized, avoiding
5678
+ unnecessary DOM layout computations.
5679
+ */
5680
+ requestMeasure<T>(request?: MeasureRequest<T>): void;
5681
+ /**
5682
+ Get the value of a specific plugin, if present. Note that
5683
+ plugins that crash can be dropped from a view, so even when you
5684
+ know you registered a given plugin, it is recommended to check
5685
+ the return value of this method.
5686
+ */
5687
+ plugin<T>(plugin: ViewPlugin<T>): T | null;
5688
+ /**
5689
+ The top position of the document, in screen coordinates. This
5690
+ may be negative when the editor is scrolled down. Points
5691
+ directly to the top of the first line, not above the padding.
5692
+ */
5693
+ get documentTop(): number;
5694
+ /**
5695
+ Reports the padding above and below the document.
5696
+ */
5697
+ get documentPadding(): {
5698
+ top: number;
5699
+ bottom: number;
5700
+ };
5701
+ /**
5702
+ Find the text line or block widget at the given vertical
5703
+ position (which is interpreted as relative to the [top of the
5704
+ document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop)
5705
+ */
5706
+ elementAtHeight(height: number): BlockInfo;
5707
+ /**
5708
+ Find the line block (see
5709
+ [`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) at the given
5710
+ height.
5711
+ */
5712
+ lineBlockAtHeight(height: number): BlockInfo;
5713
+ /**
5714
+ Get the extent and vertical position of all [line
5715
+ blocks](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) in the viewport. Positions
5716
+ are relative to the [top of the
5717
+ document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop);
5718
+ */
5719
+ get viewportLineBlocks(): BlockInfo[];
5720
+ /**
5721
+ Find the line block around the given document position. A line
5722
+ block is a range delimited on both sides by either a
5723
+ non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^replace) line breaks, or the
5724
+ start/end of the document. It will usually just hold a line of
5725
+ text, but may be broken into multiple textblocks by block
5726
+ widgets.
5727
+ */
5728
+ lineBlockAt(pos: number): BlockInfo;
5729
+ /**
5730
+ The editor's total content height.
5731
+ */
5732
+ get contentHeight(): number;
5733
+ /**
5734
+ Move a cursor position by [grapheme
5735
+ cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak). `forward` determines whether
5736
+ the motion is away from the line start, or towards it. In
5737
+ bidirectional text, the line is traversed in visual order, using
5738
+ the editor's [text direction](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection).
5739
+ When the start position was the last one on the line, the
5740
+ returned position will be across the line break. If there is no
5741
+ further line, the original position is returned.
5742
+
5743
+ By default, this method moves over a single cluster. The
5744
+ optional `by` argument can be used to move across more. It will
5745
+ be called with the first cluster as argument, and should return
5746
+ a predicate that determines, for each subsequent cluster,
5747
+ whether it should also be moved over.
5748
+ */
5749
+ moveByChar(start: SelectionRange, forward: boolean, by?: (initial: string) => (next: string) => boolean): SelectionRange;
5750
+ /**
5751
+ Move a cursor position across the next group of either
5752
+ [letters](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) or non-letter
5753
+ non-whitespace characters.
5754
+ */
5755
+ moveByGroup(start: SelectionRange, forward: boolean): SelectionRange;
5756
+ /**
5757
+ Move to the next line boundary in the given direction. If
5758
+ `includeWrap` is true, line wrapping is on, and there is a
5759
+ further wrap point on the current line, the wrap point will be
5760
+ returned. Otherwise this function will return the start or end
5761
+ of the line.
5762
+ */
5763
+ moveToLineBoundary(start: SelectionRange, forward: boolean, includeWrap?: boolean): SelectionRange;
5764
+ /**
5765
+ Move a cursor position vertically. When `distance` isn't given,
5766
+ it defaults to moving to the next line (including wrapped
5767
+ lines). Otherwise, `distance` should provide a positive distance
5768
+ in pixels.
5769
+
5770
+ When `start` has a
5771
+ [`goalColumn`](https://codemirror.net/6/docs/ref/#state.SelectionRange.goalColumn), the vertical
5772
+ motion will use that as a target horizontal position. Otherwise,
5773
+ the cursor's own horizontal position is used. The returned
5774
+ cursor will have its goal column set to whichever column was
5775
+ used.
5776
+ */
5777
+ moveVertically(start: SelectionRange, forward: boolean, distance?: number): SelectionRange;
5778
+ /**
5779
+ Find the DOM parent node and offset (child offset if `node` is
5780
+ an element, character offset when it is a text node) at the
5781
+ given document position.
5782
+
5783
+ Note that for positions that aren't currently in
5784
+ `visibleRanges`, the resulting DOM position isn't necessarily
5785
+ meaningful (it may just point before or after a placeholder
5786
+ element).
5787
+ */
5788
+ domAtPos(pos: number): {
5789
+ node: Node;
5790
+ offset: number;
5791
+ };
5792
+ /**
5793
+ Find the document position at the given DOM node. Can be useful
5794
+ for associating positions with DOM events. Will raise an error
5795
+ when `node` isn't part of the editor content.
5796
+ */
5797
+ posAtDOM(node: Node, offset?: number): number;
5798
+ /**
5799
+ Get the document position at the given screen coordinates. For
5800
+ positions not covered by the visible viewport's DOM structure,
5801
+ this will return null, unless `false` is passed as second
5802
+ argument, in which case it'll return an estimated position that
5803
+ would be near the coordinates if it were rendered.
5804
+ */
5805
+ posAtCoords(coords: {
5806
+ x: number;
5807
+ y: number;
5808
+ }, precise: false): number;
5809
+ posAtCoords(coords: {
5810
+ x: number;
5811
+ y: number;
5812
+ }): number | null;
5813
+ /**
5814
+ Get the screen coordinates at the given document position.
5815
+ `side` determines whether the coordinates are based on the
5816
+ element before (-1) or after (1) the position (if no element is
5817
+ available on the given side, the method will transparently use
5818
+ another strategy to get reasonable coordinates).
5819
+ */
5820
+ coordsAtPos(pos: number, side?: -1 | 1): Rect | null;
5821
+ /**
5822
+ The default width of a character in the editor. May not
5823
+ accurately reflect the width of all characters (given variable
5824
+ width fonts or styling of invididual ranges).
5825
+ */
5826
+ get defaultCharacterWidth(): number;
5827
+ /**
5828
+ The default height of a line in the editor. May not be accurate
5829
+ for all lines.
5830
+ */
5831
+ get defaultLineHeight(): number;
5832
+ /**
5833
+ The text direction
5834
+ ([`direction`](https://developer.mozilla.org/en-US/docs/Web/CSS/direction)
5835
+ CSS property) of the editor's content element.
5836
+ */
5837
+ get textDirection(): Direction;
5838
+ /**
5839
+ Find the text direction of the block at the given position, as
5840
+ assigned by CSS. If
5841
+ [`perLineTextDirection`](https://codemirror.net/6/docs/ref/#view.EditorView^perLineTextDirection)
5842
+ isn't enabled, or the given position is outside of the viewport,
5843
+ this will always return the same as
5844
+ [`textDirection`](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection). Note that
5845
+ this may trigger a DOM layout.
5846
+ */
5847
+ textDirectionAt(pos: number): Direction;
5848
+ /**
5849
+ Whether this editor [wraps lines](https://codemirror.net/6/docs/ref/#view.EditorView.lineWrapping)
5850
+ (as determined by the
5851
+ [`white-space`](https://developer.mozilla.org/en-US/docs/Web/CSS/white-space)
5852
+ CSS property of its content element).
5853
+ */
5854
+ get lineWrapping(): boolean;
5855
+ /**
5856
+ Returns the bidirectional text structure of the given line
5857
+ (which should be in the current document) as an array of span
5858
+ objects. The order of these spans matches the [text
5859
+ direction](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection)—if that is
5860
+ left-to-right, the leftmost spans come first, otherwise the
5861
+ rightmost spans come first.
5862
+ */
5863
+ bidiSpans(line: Line$1): readonly BidiSpan[];
5864
+ /**
5865
+ Check whether the editor has focus.
5866
+ */
5867
+ get hasFocus(): boolean;
5868
+ /**
5869
+ Put focus on the editor.
5870
+ */
5871
+ focus(): void;
5872
+ /**
5873
+ Clean up this editor view, removing its element from the
5874
+ document, unregistering event handlers, and notifying
5875
+ plugins. The view instance can no longer be used after
5876
+ calling this.
5877
+ */
5878
+ destroy(): void;
5879
+ /**
5880
+ Returns an effect that can be
5881
+ [added](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) to a transaction to
5882
+ cause it to scroll the given position or range into view.
5883
+ */
5884
+ static scrollIntoView(pos: number | SelectionRange, options?: {
5885
+ /**
5886
+ By default (`"nearest"`) the position will be vertically
5887
+ scrolled only the minimal amount required to move the given
5888
+ position into view. You can set this to `"start"` to move it
5889
+ to the top of the view, `"end"` to move it to the bottom, or
5890
+ `"center"` to move it to the center.
5891
+ */
5892
+ y?: ScrollStrategy;
5893
+ /**
5894
+ Effect similar to
5895
+ [`y`](https://codemirror.net/6/docs/ref/#view.EditorView^scrollIntoView^options.y), but for the
5896
+ horizontal scroll position.
5897
+ */
5898
+ x?: ScrollStrategy;
5899
+ /**
5900
+ Extra vertical distance to add when moving something into
5901
+ view. Not used with the `"center"` strategy. Defaults to 5.
5902
+ */
5903
+ yMargin?: number;
5904
+ /**
5905
+ Extra horizontal distance to add. Not used with the `"center"`
5906
+ strategy. Defaults to 5.
5907
+ */
5908
+ xMargin?: number;
5909
+ }): StateEffect<unknown>;
5910
+ /**
5911
+ Facet to add a [style
5912
+ module](https://github.com/marijnh/style-mod#documentation) to
5913
+ an editor view. The view will ensure that the module is
5914
+ mounted in its [document
5915
+ root](https://codemirror.net/6/docs/ref/#view.EditorView.constructor^config.root).
5916
+ */
5917
+ static styleModule: Facet<StyleModule, readonly StyleModule[]>;
5918
+ /**
5919
+ Returns an extension that can be used to add DOM event handlers.
5920
+ The value should be an object mapping event names to handler
5921
+ functions. For any given event, such functions are ordered by
5922
+ extension precedence, and the first handler to return true will
5923
+ be assumed to have handled that event, and no other handlers or
5924
+ built-in behavior will be activated for it. These are registered
5925
+ on the [content element](https://codemirror.net/6/docs/ref/#view.EditorView.contentDOM), except
5926
+ for `scroll` handlers, which will be called any time the
5927
+ editor's [scroll element](https://codemirror.net/6/docs/ref/#view.EditorView.scrollDOM) or one of
5928
+ its parent nodes is scrolled.
5929
+ */
5930
+ static domEventHandlers(handlers: DOMEventHandlers<any>): Extension;
5931
+ /**
5932
+ An input handler can override the way changes to the editable
5933
+ DOM content are handled. Handlers are passed the document
5934
+ positions between which the change was found, and the new
5935
+ content. When one returns true, no further input handlers are
5936
+ called and the default behavior is prevented.
5937
+ */
5938
+ static inputHandler: Facet<(view: EditorView, from: number, to: number, text: string) => boolean, readonly ((view: EditorView, from: number, to: number, text: string) => boolean)[]>;
5939
+ /**
5940
+ By default, the editor assumes all its content has the same
5941
+ [text direction](https://codemirror.net/6/docs/ref/#view.Direction). Configure this with a `true`
5942
+ value to make it read the text direction of every (rendered)
5943
+ line separately.
5944
+ */
5945
+ static perLineTextDirection: Facet<boolean, boolean>;
5946
+ /**
5947
+ Allows you to provide a function that should be called when the
5948
+ library catches an exception from an extension (mostly from view
5949
+ plugins, but may be used by other extensions to route exceptions
5950
+ from user-code-provided callbacks). This is mostly useful for
5951
+ debugging and logging. See [`logException`](https://codemirror.net/6/docs/ref/#view.logException).
5952
+ */
5953
+ static exceptionSink: Facet<(exception: any) => void, readonly ((exception: any) => void)[]>;
5954
+ /**
5955
+ A facet that can be used to register a function to be called
5956
+ every time the view updates.
5957
+ */
5958
+ static updateListener: Facet<(update: ViewUpdate) => void, readonly ((update: ViewUpdate) => void)[]>;
5959
+ /**
5960
+ Facet that controls whether the editor content DOM is editable.
5961
+ When its highest-precedence value is `false`, the element will
5962
+ not have its `contenteditable` attribute set. (Note that this
5963
+ doesn't affect API calls that change the editor content, even
5964
+ when those are bound to keys or buttons. See the
5965
+ [`readOnly`](https://codemirror.net/6/docs/ref/#state.EditorState.readOnly) facet for that.)
5966
+ */
5967
+ static editable: Facet<boolean, boolean>;
5968
+ /**
5969
+ Allows you to influence the way mouse selection happens. The
5970
+ functions in this facet will be called for a `mousedown` event
5971
+ on the editor, and can return an object that overrides the way a
5972
+ selection is computed from that mouse click or drag.
5973
+ */
5974
+ static mouseSelectionStyle: Facet<MakeSelectionStyle, readonly MakeSelectionStyle[]>;
5975
+ /**
5976
+ Facet used to configure whether a given selection drag event
5977
+ should move or copy the selection. The given predicate will be
5978
+ called with the `mousedown` event, and can return `true` when
5979
+ the drag should move the content.
5980
+ */
5981
+ static dragMovesSelection: Facet<(event: MouseEvent) => boolean, readonly ((event: MouseEvent) => boolean)[]>;
5982
+ /**
5983
+ Facet used to configure whether a given selecting click adds a
5984
+ new range to the existing selection or replaces it entirely. The
5985
+ default behavior is to check `event.metaKey` on macOS, and
5986
+ `event.ctrlKey` elsewhere.
5987
+ */
5988
+ static clickAddsSelectionRange: Facet<(event: MouseEvent) => boolean, readonly ((event: MouseEvent) => boolean)[]>;
5989
+ /**
5990
+ A facet that determines which [decorations](https://codemirror.net/6/docs/ref/#view.Decoration)
5991
+ are shown in the view. Decorations can be provided in two
5992
+ ways—directly, or via a function that takes an editor view.
5993
+
5994
+ Only decoration sets provided directly are allowed to influence
5995
+ the editor's vertical layout structure. The ones provided as
5996
+ functions are called _after_ the new viewport has been computed,
5997
+ and thus **must not** introduce block widgets or replacing
5998
+ decorations that cover line breaks.
5999
+ */
6000
+ static decorations: Facet<DecorationSet | ((view: EditorView) => DecorationSet), readonly (DecorationSet | ((view: EditorView) => DecorationSet))[]>;
6001
+ /**
6002
+ Used to provide ranges that should be treated as atoms as far as
6003
+ cursor motion is concerned. This causes methods like
6004
+ [`moveByChar`](https://codemirror.net/6/docs/ref/#view.EditorView.moveByChar) and
6005
+ [`moveVertically`](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) (and the
6006
+ commands built on top of them) to skip across such regions when
6007
+ a selection endpoint would enter them. This does _not_ prevent
6008
+ direct programmatic [selection
6009
+ updates](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection) from moving into such
6010
+ regions.
6011
+ */
6012
+ static atomicRanges: Facet<(view: EditorView) => RangeSet<any>, readonly ((view: EditorView) => RangeSet<any>)[]>;
6013
+ /**
6014
+ Facet that allows extensions to provide additional scroll
6015
+ margins (space around the sides of the scrolling element that
6016
+ should be considered invisible). This can be useful when the
6017
+ plugin introduces elements that cover part of that element (for
6018
+ example a horizontally fixed gutter).
6019
+ */
6020
+ static scrollMargins: Facet<(view: EditorView) => Partial<Rect> | null, readonly ((view: EditorView) => Partial<Rect> | null)[]>;
6021
+ /**
6022
+ Create a theme extension. The first argument can be a
6023
+ [`style-mod`](https://github.com/marijnh/style-mod#documentation)
6024
+ style spec providing the styles for the theme. These will be
6025
+ prefixed with a generated class for the style.
6026
+
6027
+ Because the selectors will be prefixed with a scope class, rule
6028
+ that directly match the editor's [wrapper
6029
+ element](https://codemirror.net/6/docs/ref/#view.EditorView.dom)—to which the scope class will be
6030
+ added—need to be explicitly differentiated by adding an `&` to
6031
+ the selector for that element—for example
6032
+ `&.cm-focused`.
6033
+
6034
+ When `dark` is set to true, the theme will be marked as dark,
6035
+ which will cause the `&dark` rules from [base
6036
+ themes](https://codemirror.net/6/docs/ref/#view.EditorView^baseTheme) to be used (as opposed to
6037
+ `&light` when a light theme is active).
6038
+ */
6039
+ static theme(spec: {
6040
+ [selector: string]: StyleSpec;
6041
+ }, options?: {
6042
+ dark?: boolean;
6043
+ }): Extension;
6044
+ /**
6045
+ This facet records whether a dark theme is active. The extension
6046
+ returned by [`theme`](https://codemirror.net/6/docs/ref/#view.EditorView^theme) automatically
6047
+ includes an instance of this when the `dark` option is set to
6048
+ true.
6049
+ */
6050
+ static darkTheme: Facet<boolean, boolean>;
6051
+ /**
6052
+ Create an extension that adds styles to the base theme. Like
6053
+ with [`theme`](https://codemirror.net/6/docs/ref/#view.EditorView^theme), use `&` to indicate the
6054
+ place of the editor wrapper element when directly targeting
6055
+ that. You can also use `&dark` or `&light` instead to only
6056
+ target editors with a dark or light theme.
6057
+ */
6058
+ static baseTheme(spec: {
6059
+ [selector: string]: StyleSpec;
6060
+ }): Extension;
6061
+ /**
6062
+ Facet that provides additional DOM attributes for the editor's
6063
+ editable DOM element.
6064
+ */
6065
+ static contentAttributes: Facet<AttrSource, readonly AttrSource[]>;
6066
+ /**
6067
+ Facet that provides DOM attributes for the editor's outer
6068
+ element.
6069
+ */
6070
+ static editorAttributes: Facet<AttrSource, readonly AttrSource[]>;
6071
+ /**
6072
+ An extension that enables line wrapping in the editor (by
6073
+ setting CSS `white-space` to `pre-wrap` in the content).
6074
+ */
6075
+ static lineWrapping: Extension;
6076
+ /**
6077
+ State effect used to include screen reader announcements in a
6078
+ transaction. These will be added to the DOM in a visually hidden
6079
+ element with `aria-live="polite"` set, and should be used to
6080
+ describe effects that are visually obvious but may not be
6081
+ noticed by screen reader users (such as moving to the next
6082
+ search match).
6083
+ */
6084
+ static announce: StateEffectType<string>;
6085
+ }
6086
+ /**
6087
+ Helper type that maps event names to event object types, or the
6088
+ `any` type for unknown events.
6089
+ */
6090
+ interface DOMEventMap extends HTMLElementEventMap {
6091
+ [other: string]: any;
6092
+ }
6093
+ /**
6094
+ Event handlers are specified with objects like this. For event
6095
+ types known by TypeScript, this will infer the event argument type
6096
+ to hold the appropriate event object type. For unknown events, it
6097
+ is inferred to `any`, and should be explicitly set if you want type
6098
+ checking.
6099
+ */
6100
+ declare type DOMEventHandlers<This> = {
6101
+ [event in keyof DOMEventMap]?: (this: This, event: DOMEventMap[event], view: EditorView) => boolean | void;
6102
+ };
6103
+
6104
+ /**
6105
+ Describes a problem or hint for a piece of code.
6106
+ */
6107
+ interface Diagnostic {
6108
+ /**
6109
+ The start position of the relevant text.
6110
+ */
6111
+ from: number;
6112
+ /**
6113
+ The end position. May be equal to `from`, though actually
6114
+ covering text is preferable.
6115
+ */
6116
+ to: number;
6117
+ /**
6118
+ The severity of the problem. This will influence how it is
6119
+ displayed.
6120
+ */
6121
+ severity: "info" | "warning" | "error";
6122
+ /**
6123
+ An optional source string indicating where the diagnostic is
6124
+ coming from. You can put the name of your linter here, if
6125
+ applicable.
6126
+ */
6127
+ source?: string;
6128
+ /**
6129
+ The message associated with this diagnostic.
6130
+ */
6131
+ message: string;
6132
+ /**
6133
+ An optional custom rendering function that displays the message
6134
+ as a DOM node.
6135
+ */
6136
+ renderMessage?: () => Node;
5006
6137
  /**
5007
6138
  An optional array of actions that can be taken on this
5008
6139
  diagnostic.
@@ -5031,7 +6162,7 @@ Calls
5031
6162
  on the document and, if that throws an error, reports it as a
5032
6163
  single diagnostic.
5033
6164
  */
5034
- declare const jsonParseLinter: () => (view: EditorView) => Diagnostic[];
6165
+ declare const jsonParseLinter: () => (view: EditorView$1) => Diagnostic[];
5035
6166
 
5036
6167
  /**
5037
6168
  A language provider that provides JSON parsing.
@@ -5345,7 +6476,7 @@ and
5345
6476
  [eslint4b-prebuilt](https://github.com/marijnh/eslint4b-prebuilt/)
5346
6477
  packages may help with that.
5347
6478
  */
5348
- declare function esLint(eslint: any, config?: any): (view: EditorView) => Diagnostic[];
6479
+ declare function esLint(eslint: any, config?: any): (view: EditorView$1) => Diagnostic[];
5349
6480
 
5350
6481
  declare const index_d_autoCloseTags: typeof autoCloseTags;
5351
6482
  declare const index_d_esLint: typeof esLint;
@@ -5415,4 +6546,4 @@ declare function cssStreamParser(): Promise<any>;
5415
6546
  declare function wast(): Promise<typeof _codemirror_lang_wast>;
5416
6547
  declare function xml(): Promise<typeof _codemirror_lang_xml>;
5417
6548
 
5418
- export { Annotation, AnnotationType, ChangeDesc, ChangeSet, ChangeSpec, Command, Compartment, Completion, CompletionContext, CompletionResult, CompletionSource, Decoration, DecorationSet, EditorSelection, EditorState, EditorStateConfig, EditorView, Extension, Facet, GutterMarker, HighlightStyle, KeyBinding, LRParser, Language, LanguageSupport, Line$1 as Line, MapMode, MatchDecorator, NodeProp, NodeSet, NodeType, Panel, Parser, Prec, Range, RangeSet, RangeSetBuilder, SelectionRange, StateEffect, StateEffectType, StateField, StreamLanguage, StreamParser, StringStream, StyleModule, SyntaxNode, Tag, TagStyle, Text, TextIterator, Tooltip, TooltipView, Transaction, TransactionSpec, Tree, TreeCursor, ViewPlugin, ViewUpdate, WidgetType, acceptCompletion, autocompletion, bracketMatching, clojure, closeBrackets, closeBracketsKeymap, closeCompletion, codeFolding, coffeescript, completeAnyWord, cpp, index_d$2 as css, cssStreamParser, currentCompletions, cursorMatchingBracket, cursorSubwordBackward, cursorSubwordForward, drawSelection, ensureSyntaxTree, foldGutter, foldKeymap, gutter, gutters, highlightSelectionMatches, highlightSpecialChars, highlightTree, history, historyKeymap, index_d$1 as html, ifNotIn, indentLess, indentMore, indentOnInput, indentUnit, insertNewlineAndIndent, java, index_d as javascript, json, keymap, lineNumberMarkers, lineNumbers, markdown, php, placeholder, python, redo, redoSelection, repositionTooltips, scrollPastEnd, selectMatchingBracket, selectNextOccurrence, selectSubwordBackward, selectSubwordForward, selectedCompletion, shell, showPanel, showTooltip, standardKeymap, startCompletion, syntaxHighlighting, syntaxTree, tags, toggleComment, tooltips, undo, undoSelection, wast, xml };
6549
+ export { Annotation, AnnotationType, ChangeDesc, ChangeSet, ChangeSpec, Command, Compartment, Completion, CompletionContext, CompletionResult, CompletionSource, Decoration$1 as Decoration, DecorationSet$1 as DecorationSet, EditorSelection, EditorState, EditorStateConfig, EditorView$1 as EditorView, Extension, Facet, GutterMarker, HighlightStyle, KeyBinding, LRParser, Language, LanguageSupport, Line$1 as Line, MapMode, MatchDecorator, NodeProp, NodeSet, NodeType, Panel, Parser, Prec, Range, RangeSet, RangeSetBuilder, SelectionRange, StateEffect, StateEffectType, StateField, StreamLanguage, StreamParser, StringStream, StyleModule, SyntaxNode, Tag, TagStyle, Text, TextIterator, Tooltip, TooltipView, Transaction, TransactionSpec, Tree, TreeCursor, ViewPlugin$1 as ViewPlugin, ViewUpdate$1 as ViewUpdate, WidgetType$1 as WidgetType, acceptCompletion, autocompletion, bracketMatching, clojure, closeBrackets, closeBracketsKeymap, closeCompletion, codeFolding, coffeescript, completeAnyWord, cpp, index_d$2 as css, cssStreamParser, currentCompletions, cursorMatchingBracket, cursorSubwordBackward, cursorSubwordForward, drawSelection, ensureSyntaxTree, foldGutter, foldKeymap, gutter, gutters, highlightSelectionMatches, highlightSpecialChars, highlightTree, history, historyKeymap, index_d$1 as html, ifNotIn, indentLess, indentMore, indentOnInput, indentUnit, insertNewlineAndIndent, java, index_d as javascript, json, keymap, lineNumberMarkers, lineNumbers, markdown, php, placeholder, python, redo, redoSelection, repositionTooltips, scrollPastEnd, selectMatchingBracket, selectNextOccurrence, selectSubwordBackward, selectSubwordForward, selectedCompletion, shell, showPanel, showTooltip, standardKeymap, startCompletion, syntaxHighlighting, syntaxTree, tags, toggleComment, tooltips, undo, undoSelection, wast, xml };