@codemirror/view 6.38.8 → 6.39.0-beta.2

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
@@ -355,6 +355,39 @@ declare abstract class Decoration extends RangeValue {
355
355
  */
356
356
  static none: DecorationSet;
357
357
  }
358
+ interface BlockWrapperSpec {
359
+ /**
360
+ Tag name of the wrapping element.
361
+ */
362
+ tagName: string;
363
+ /**
364
+ DOM attributes to add to the wrapping element.
365
+ */
366
+ attributes?: {
367
+ [key: string]: string;
368
+ };
369
+ }
370
+ /**
371
+ A block wrapper defines a DOM node that wraps lines or other block
372
+ wrappers at the top of the document. It affects any line or block
373
+ widget that starts inside its range, including blocks starting
374
+ directly at `from` but not including `to`.
375
+ */
376
+ declare class BlockWrapper extends RangeValue {
377
+ readonly tagName: string;
378
+ readonly attributes: Attrs;
379
+ private constructor();
380
+ eq(other: RangeValue): boolean;
381
+ /**
382
+ Create a block wrapper object with the given tag name and
383
+ attributes.
384
+ */
385
+ static create(spec: BlockWrapperSpec): BlockWrapper;
386
+ /**
387
+ Create a range set from the given block wrapper ranges.
388
+ */
389
+ static set(of: Range<BlockWrapper> | readonly Range<BlockWrapper>[], sort?: boolean): RangeSet<BlockWrapper>;
390
+ }
358
391
 
359
392
  /**
360
393
  Command functions are used in key bindings and other types of user
@@ -958,7 +991,7 @@ declare class EditorView {
958
991
  meaningful (it may just point before or after a placeholder
959
992
  element).
960
993
  */
961
- domAtPos(pos: number): {
994
+ domAtPos(pos: number, side?: -1 | 1): {
962
995
  node: Node;
963
996
  offset: number;
964
997
  };
@@ -1261,6 +1294,14 @@ declare class EditorView {
1261
1294
  */
1262
1295
  static decorations: Facet<DecorationSet | ((view: EditorView) => DecorationSet), readonly (DecorationSet | ((view: EditorView) => DecorationSet))[]>;
1263
1296
  /**
1297
+ [Block wrappers](https://codemirror.net/6/docs/ref/#view.BlockWrapper) provide a way to add DOM
1298
+ structure around editor lines and block widgets. Sets of
1299
+ wrappers are provided in a similar way to decorations, and are
1300
+ nested in a similar way when they overlap. A wrapper affects all
1301
+ lines and block widgets that start inside its range.
1302
+ */
1303
+ static blockWrappers: Facet<_codemirror_state.RangeSet<BlockWrapper> | ((view: EditorView) => _codemirror_state.RangeSet<BlockWrapper>), readonly (_codemirror_state.RangeSet<BlockWrapper> | ((view: EditorView) => _codemirror_state.RangeSet<BlockWrapper>))[]>;
1304
+ /**
1264
1305
  Facet that works much like
1265
1306
  [`decorations`](https://codemirror.net/6/docs/ref/#view.EditorView^decorations), but puts its
1266
1307
  inputs at the very bottom of the precedence stack, meaning mark
@@ -2303,4 +2344,4 @@ trailing whitespace.
2303
2344
  */
2304
2345
  declare function highlightTrailingWhitespace(): Extension;
2305
2346
 
2306
- 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, getDialog, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutterWidgetClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumberWidgetMarker, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showDialog, showPanel, showTooltip, tooltips };
2347
+ export { BidiSpan, BlockInfo, BlockType, BlockWrapper, 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, getDialog, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutterWidgetClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumberWidgetMarker, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showDialog, showPanel, showTooltip, tooltips };
package/dist/index.d.ts CHANGED
@@ -355,6 +355,39 @@ declare abstract class Decoration extends RangeValue {
355
355
  */
356
356
  static none: DecorationSet;
357
357
  }
358
+ interface BlockWrapperSpec {
359
+ /**
360
+ Tag name of the wrapping element.
361
+ */
362
+ tagName: string;
363
+ /**
364
+ DOM attributes to add to the wrapping element.
365
+ */
366
+ attributes?: {
367
+ [key: string]: string;
368
+ };
369
+ }
370
+ /**
371
+ A block wrapper defines a DOM node that wraps lines or other block
372
+ wrappers at the top of the document. It affects any line or block
373
+ widget that starts inside its range, including blocks starting
374
+ directly at `from` but not including `to`.
375
+ */
376
+ declare class BlockWrapper extends RangeValue {
377
+ readonly tagName: string;
378
+ readonly attributes: Attrs;
379
+ private constructor();
380
+ eq(other: RangeValue): boolean;
381
+ /**
382
+ Create a block wrapper object with the given tag name and
383
+ attributes.
384
+ */
385
+ static create(spec: BlockWrapperSpec): BlockWrapper;
386
+ /**
387
+ Create a range set from the given block wrapper ranges.
388
+ */
389
+ static set(of: Range<BlockWrapper> | readonly Range<BlockWrapper>[], sort?: boolean): RangeSet<BlockWrapper>;
390
+ }
358
391
 
359
392
  /**
360
393
  Command functions are used in key bindings and other types of user
@@ -958,7 +991,7 @@ declare class EditorView {
958
991
  meaningful (it may just point before or after a placeholder
959
992
  element).
960
993
  */
961
- domAtPos(pos: number): {
994
+ domAtPos(pos: number, side?: -1 | 1): {
962
995
  node: Node;
963
996
  offset: number;
964
997
  };
@@ -1261,6 +1294,14 @@ declare class EditorView {
1261
1294
  */
1262
1295
  static decorations: Facet<DecorationSet | ((view: EditorView) => DecorationSet), readonly (DecorationSet | ((view: EditorView) => DecorationSet))[]>;
1263
1296
  /**
1297
+ [Block wrappers](https://codemirror.net/6/docs/ref/#view.BlockWrapper) provide a way to add DOM
1298
+ structure around editor lines and block widgets. Sets of
1299
+ wrappers are provided in a similar way to decorations, and are
1300
+ nested in a similar way when they overlap. A wrapper affects all
1301
+ lines and block widgets that start inside its range.
1302
+ */
1303
+ static blockWrappers: Facet<_codemirror_state.RangeSet<BlockWrapper> | ((view: EditorView) => _codemirror_state.RangeSet<BlockWrapper>), readonly (_codemirror_state.RangeSet<BlockWrapper> | ((view: EditorView) => _codemirror_state.RangeSet<BlockWrapper>))[]>;
1304
+ /**
1264
1305
  Facet that works much like
1265
1306
  [`decorations`](https://codemirror.net/6/docs/ref/#view.EditorView^decorations), but puts its
1266
1307
  inputs at the very bottom of the precedence stack, meaning mark
@@ -2303,4 +2344,4 @@ trailing whitespace.
2303
2344
  */
2304
2345
  declare function highlightTrailingWhitespace(): Extension;
2305
2346
 
2306
- 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, getDialog, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutterWidgetClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumberWidgetMarker, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showDialog, showPanel, showTooltip, tooltips };
2347
+ export { BidiSpan, BlockInfo, BlockType, BlockWrapper, 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, getDialog, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutterWidgetClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumberWidgetMarker, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showDialog, showPanel, showTooltip, tooltips };