@codemirror/view 6.29.1 → 6.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _codemirror_state from '@codemirror/state';
2
- import { RangeSet, RangeValue, Range, EditorState, Extension, Transaction, ChangeSet, SelectionRange, ChangeDesc, EditorSelection, EditorStateConfig, StateEffect, TransactionSpec, Line, Facet } from '@codemirror/state';
2
+ import { RangeSet, RangeValue, Range, EditorState, Extension, Transaction, ChangeSet, SelectionRange, ChangeDesc, EditorSelection, EditorStateConfig, StateEffect, TransactionSpec, Line, Facet, StateField } from '@codemirror/state';
3
3
  import { StyleModule, StyleSpec } from 'style-mod';
4
4
 
5
5
  /**
@@ -869,7 +869,7 @@ declare class EditorView {
869
869
  /**
870
870
  Find the line block around the given document position. A line
871
871
  block is a range delimited on both sides by either a
872
- non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^replace) line breaks, or the
872
+ non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^replace) line break, or the
873
873
  start/end of the document. It will usually just hold a line of
874
874
  text, but may be broken into multiple textblocks by block
875
875
  widgets.
@@ -1948,6 +1948,11 @@ pointer is before the position, 1 if after the position.
1948
1948
  Note that all hover tooltips are hosted within a single tooltip
1949
1949
  container element. This allows multiple tooltips over the same
1950
1950
  range to be "merged" together without overlapping.
1951
+
1952
+ The return value is a valid [editor extension](https://codemirror.net/6/docs/ref/#state.Extension)
1953
+ but also provides an `active` property holding a state field that
1954
+ can be used to read the currently active tooltips produced by this
1955
+ extension.
1951
1956
  */
1952
1957
  declare function hoverTooltip(source: HoverTooltipSource, options?: {
1953
1958
  /**
@@ -1965,7 +1970,9 @@ declare function hoverTooltip(source: HoverTooltipSource, options?: {
1965
1970
  milliseconds. Defaults to 300ms.
1966
1971
  */
1967
1972
  hoverTime?: number;
1968
- }): Extension;
1973
+ }): Extension & {
1974
+ active: StateField<readonly Tooltip[]>;
1975
+ };
1969
1976
  /**
1970
1977
  Get the active tooltip view for a given tooltip, if available.
1971
1978
  */
@@ -2161,6 +2168,10 @@ Facet used to provide markers to the line number gutter.
2161
2168
  */
2162
2169
  declare const lineNumberMarkers: Facet<RangeSet<GutterMarker>, readonly RangeSet<GutterMarker>[]>;
2163
2170
  /**
2171
+ Facet used to create markers in the line number gutter next to widgets.
2172
+ */
2173
+ declare const lineNumberWidgetMarker: Facet<(view: EditorView, widget: WidgetType, block: BlockInfo) => GutterMarker | null, readonly ((view: EditorView, widget: WidgetType, block: BlockInfo) => GutterMarker | null)[]>;
2174
+ /**
2164
2175
  Create a line number gutter extension.
2165
2176
  */
2166
2177
  declare function lineNumbers(config?: LineNumberConfig): Extension;
@@ -2184,4 +2195,4 @@ trailing whitespace.
2184
2195
  */
2185
2196
  declare function highlightTrailingWhitespace(): Extension;
2186
2197
 
2187
- export { BidiSpan, BlockInfo, BlockType, type Command, type DOMEventHandlers, type DOMEventMap, Decoration, type DecorationSet, Direction, EditorView, type EditorViewConfig, GutterMarker, type HoverTooltipSource, type KeyBinding, type LayerMarker, MatchDecorator, type MouseSelectionStyle, type Panel, type PanelConstructor, type PluginSpec, type PluginValue, type Rect, RectangleMarker, type Tooltip, type TooltipView, ViewPlugin, ViewUpdate, WidgetType, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };
2198
+ export { BidiSpan, BlockInfo, BlockType, type Command, type DOMEventHandlers, type DOMEventMap, Decoration, type DecorationSet, Direction, EditorView, type EditorViewConfig, GutterMarker, type HoverTooltipSource, type KeyBinding, type LayerMarker, MatchDecorator, type MouseSelectionStyle, type Panel, type PanelConstructor, type PluginSpec, type PluginValue, type Rect, RectangleMarker, type Tooltip, type TooltipView, ViewPlugin, ViewUpdate, WidgetType, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumberWidgetMarker, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _codemirror_state from '@codemirror/state';
2
- import { RangeSet, RangeValue, Range, EditorState, Extension, Transaction, ChangeSet, SelectionRange, ChangeDesc, EditorSelection, EditorStateConfig, StateEffect, TransactionSpec, Line, Facet } from '@codemirror/state';
2
+ import { RangeSet, RangeValue, Range, EditorState, Extension, Transaction, ChangeSet, SelectionRange, ChangeDesc, EditorSelection, EditorStateConfig, StateEffect, TransactionSpec, Line, Facet, StateField } from '@codemirror/state';
3
3
  import { StyleModule, StyleSpec } from 'style-mod';
4
4
 
5
5
  /**
@@ -869,7 +869,7 @@ declare class EditorView {
869
869
  /**
870
870
  Find the line block around the given document position. A line
871
871
  block is a range delimited on both sides by either a
872
- non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^replace) line breaks, or the
872
+ non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^replace) line break, or the
873
873
  start/end of the document. It will usually just hold a line of
874
874
  text, but may be broken into multiple textblocks by block
875
875
  widgets.
@@ -1948,6 +1948,11 @@ pointer is before the position, 1 if after the position.
1948
1948
  Note that all hover tooltips are hosted within a single tooltip
1949
1949
  container element. This allows multiple tooltips over the same
1950
1950
  range to be "merged" together without overlapping.
1951
+
1952
+ The return value is a valid [editor extension](https://codemirror.net/6/docs/ref/#state.Extension)
1953
+ but also provides an `active` property holding a state field that
1954
+ can be used to read the currently active tooltips produced by this
1955
+ extension.
1951
1956
  */
1952
1957
  declare function hoverTooltip(source: HoverTooltipSource, options?: {
1953
1958
  /**
@@ -1965,7 +1970,9 @@ declare function hoverTooltip(source: HoverTooltipSource, options?: {
1965
1970
  milliseconds. Defaults to 300ms.
1966
1971
  */
1967
1972
  hoverTime?: number;
1968
- }): Extension;
1973
+ }): Extension & {
1974
+ active: StateField<readonly Tooltip[]>;
1975
+ };
1969
1976
  /**
1970
1977
  Get the active tooltip view for a given tooltip, if available.
1971
1978
  */
@@ -2161,6 +2168,10 @@ Facet used to provide markers to the line number gutter.
2161
2168
  */
2162
2169
  declare const lineNumberMarkers: Facet<RangeSet<GutterMarker>, readonly RangeSet<GutterMarker>[]>;
2163
2170
  /**
2171
+ Facet used to create markers in the line number gutter next to widgets.
2172
+ */
2173
+ declare const lineNumberWidgetMarker: Facet<(view: EditorView, widget: WidgetType, block: BlockInfo) => GutterMarker | null, readonly ((view: EditorView, widget: WidgetType, block: BlockInfo) => GutterMarker | null)[]>;
2174
+ /**
2164
2175
  Create a line number gutter extension.
2165
2176
  */
2166
2177
  declare function lineNumbers(config?: LineNumberConfig): Extension;
@@ -2184,4 +2195,4 @@ trailing whitespace.
2184
2195
  */
2185
2196
  declare function highlightTrailingWhitespace(): Extension;
2186
2197
 
2187
- export { BidiSpan, BlockInfo, BlockType, type Command, type DOMEventHandlers, type DOMEventMap, Decoration, type DecorationSet, Direction, EditorView, type EditorViewConfig, GutterMarker, type HoverTooltipSource, type KeyBinding, type LayerMarker, MatchDecorator, type MouseSelectionStyle, type Panel, type PanelConstructor, type PluginSpec, type PluginValue, type Rect, RectangleMarker, type Tooltip, type TooltipView, ViewPlugin, ViewUpdate, WidgetType, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };
2198
+ export { BidiSpan, BlockInfo, BlockType, type Command, type DOMEventHandlers, type DOMEventMap, Decoration, type DecorationSet, Direction, EditorView, type EditorViewConfig, GutterMarker, type HoverTooltipSource, type KeyBinding, type LayerMarker, MatchDecorator, type MouseSelectionStyle, type Panel, type PanelConstructor, type PluginSpec, type PluginValue, type Rect, RectangleMarker, type Tooltip, type TooltipView, ViewPlugin, ViewUpdate, WidgetType, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumberWidgetMarker, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };