@thomasfosterau/effect-richtext 0.0.0-stage → 0.1.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/LICENSE +48 -0
- package/README.md +118 -2
- package/dist/_virtual/_rolldown/runtime.js +12 -0
- package/dist/commands/commands.d.ts +323 -0
- package/dist/commands/commands.js +722 -0
- package/dist/commands/internal.js +43 -0
- package/dist/commands/keymaps.d.ts +46 -0
- package/dist/commands/keymaps.js +64 -0
- package/dist/commands.d.ts +3 -0
- package/dist/commands.js +3 -0
- package/dist/compat/commands.d.ts +250 -0
- package/dist/compat/commands.js +275 -0
- package/dist/compat/internal/core.d.ts +20 -0
- package/dist/compat/internal/core.js +148 -0
- package/dist/compat/internal/props.js +82 -0
- package/dist/compat/keymap.d.ts +21 -0
- package/dist/compat/keymap.js +38 -0
- package/dist/compat/model.d.ts +893 -0
- package/dist/compat/model.js +1212 -0
- package/dist/compat/orderedmap.d.ts +74 -0
- package/dist/compat/orderedmap.js +124 -0
- package/dist/compat/schema-basic.d.ts +38 -0
- package/dist/compat/schema-basic.js +238 -0
- package/dist/compat/schema-list.d.ts +81 -0
- package/dist/compat/schema-list.js +156 -0
- package/dist/compat/state.d.ts +415 -0
- package/dist/compat/state.js +689 -0
- package/dist/compat/test-builder.d.ts +98 -0
- package/dist/compat/test-builder.js +197 -0
- package/dist/compat/transform.d.ts +458 -0
- package/dist/compat/transform.js +803 -0
- package/dist/compat/view.d.ts +411 -0
- package/dist/compat/view.js +409 -0
- package/dist/dropcursor.d.ts +46 -0
- package/dist/dropcursor.js +176 -0
- package/dist/extensions/defaults.d.ts +716 -0
- package/dist/extensions/defaults.js +209 -0
- package/dist/extensions/editor.d.ts +246 -0
- package/dist/extensions/editor.js +271 -0
- package/dist/extensions/extension.d.ts +375 -0
- package/dist/extensions/extension.js +233 -0
- package/dist/extensions.d.ts +4 -0
- package/dist/extensions.js +4 -0
- package/dist/gapcursor.d.ts +66 -0
- package/dist/gapcursor.js +273 -0
- package/dist/history.d.ts +178 -0
- package/dist/history.js +412 -0
- package/dist/html.d.ts +158 -0
- package/dist/html.js +164 -0
- package/dist/inputrules.d.ts +271 -0
- package/dist/inputrules.js +321 -0
- package/dist/internal/attempt.js +15 -0
- package/dist/internal/json.js +29 -0
- package/dist/keymap/keymap.d.ts +130 -0
- package/dist/keymap/keymap.js +159 -0
- package/dist/keymap.d.ts +2 -0
- package/dist/keymap.js +1 -0
- package/dist/markdown/errors.d.ts +23 -0
- package/dist/markdown/errors.js +26 -0
- package/dist/markdown/from_markdown.d.ts +185 -0
- package/dist/markdown/from_markdown.js +266 -0
- package/dist/markdown/schema.d.ts +522 -0
- package/dist/markdown/schema.js +292 -0
- package/dist/markdown/to_markdown.d.ts +251 -0
- package/dist/markdown/to_markdown.js +413 -0
- package/dist/markdown.d.ts +5 -0
- package/dist/markdown.js +5 -0
- package/dist/model/attrsCodec.js +48 -0
- package/dist/model/comparedeep.js +17 -0
- package/dist/model/content.d.ts +232 -0
- package/dist/model/content.js +630 -0
- package/dist/model/diff.js +66 -0
- package/dist/model/dom.d.ts +3 -0
- package/dist/model/errors.d.ts +90 -0
- package/dist/model/errors.js +76 -0
- package/dist/model/fragment.d.ts +131 -0
- package/dist/model/fragment.js +262 -0
- package/dist/model/from_dom.d.ts +299 -0
- package/dist/model/from_dom.js +618 -0
- package/dist/model/json.d.ts +37 -0
- package/dist/model/json.js +126 -0
- package/dist/model/mark.d.ts +73 -0
- package/dist/model/mark.js +121 -0
- package/dist/model/node.d.ts +267 -0
- package/dist/model/node.js +434 -0
- package/dist/model/replace.d.ts +78 -0
- package/dist/model/replace.js +207 -0
- package/dist/model/resolvedpos.d.ts +196 -0
- package/dist/model/resolvedpos.js +305 -0
- package/dist/model/schema.d.ts +740 -0
- package/dist/model/schema.js +451 -0
- package/dist/model/to_dom.d.ts +169 -0
- package/dist/model/to_dom.js +238 -0
- package/dist/model.d.ts +12 -0
- package/dist/model.js +12 -0
- package/dist/placeholder.d.ts +53 -0
- package/dist/placeholder.js +79 -0
- package/dist/reactive/observer.d.ts +54 -0
- package/dist/reactive/observer.js +61 -0
- package/dist/reactive/selectors.d.ts +22 -0
- package/dist/reactive/selectors.js +61 -0
- package/dist/reactive/stateref.d.ts +72 -0
- package/dist/reactive/stateref.js +71 -0
- package/dist/reactive/streams.d.ts +83 -0
- package/dist/reactive/streams.js +85 -0
- package/dist/reactive.d.ts +16 -0
- package/dist/reactive.js +26 -0
- package/dist/schema-basic.d.ts +448 -0
- package/dist/schema-basic.js +269 -0
- package/dist/schema-list/commands.d.ts +66 -0
- package/dist/schema-list/commands.js +203 -0
- package/dist/schema-list.d.ts +92 -0
- package/dist/schema-list.js +100 -0
- package/dist/state/errors.d.ts +39 -0
- package/dist/state/errors.js +32 -0
- package/dist/state/plugin.d.ts +232 -0
- package/dist/state/plugin.js +82 -0
- package/dist/state/selection.d.ts +297 -0
- package/dist/state/selection.js +486 -0
- package/dist/state/state.d.ts +212 -0
- package/dist/state/state.js +489 -0
- package/dist/state/transaction.d.ts +145 -0
- package/dist/state/transaction.js +195 -0
- package/dist/state.d.ts +6 -0
- package/dist/state.js +6 -0
- package/dist/test-builder.d.ts +3582 -0
- package/dist/test-builder.js +239 -0
- package/dist/transform/attr_step.d.ts +60 -0
- package/dist/transform/attr_step.js +105 -0
- package/dist/transform/errors.d.ts +50 -0
- package/dist/transform/errors.js +35 -0
- package/dist/transform/map.d.ts +182 -0
- package/dist/transform/map.js +280 -0
- package/dist/transform/mark.js +98 -0
- package/dist/transform/mark_set_step.js +69 -0
- package/dist/transform/mark_step.d.ts +113 -0
- package/dist/transform/mark_step.js +225 -0
- package/dist/transform/replace.d.ts +18 -0
- package/dist/transform/replace.js +381 -0
- package/dist/transform/replace_step.d.ts +109 -0
- package/dist/transform/replace_step.js +175 -0
- package/dist/transform/step.d.ts +157 -0
- package/dist/transform/step.js +168 -0
- package/dist/transform/structure.d.ts +89 -0
- package/dist/transform/structure.js +350 -0
- package/dist/transform/transform.d.ts +248 -0
- package/dist/transform/transform.js +373 -0
- package/dist/transform.d.ts +10 -0
- package/dist/transform.js +10 -0
- package/dist/view/browser.js +39 -0
- package/dist/view/capturekeys.js +282 -0
- package/dist/view/clipboard.d.ts +8 -0
- package/dist/view/clipboard.js +245 -0
- package/dist/view/decoration.d.ts +339 -0
- package/dist/view/decoration.js +566 -0
- package/dist/view/dom.d.ts +18 -0
- package/dist/view/dom.js +140 -0
- package/dist/view/domchange.js +295 -0
- package/dist/view/domcoords.d.ts +22 -0
- package/dist/view/domcoords.js +448 -0
- package/dist/view/domobserver.d.ts +47 -0
- package/dist/view/domobserver.js +328 -0
- package/dist/view/errors.d.ts +18 -0
- package/dist/view/errors.js +21 -0
- package/dist/view/input.d.ts +58 -0
- package/dist/view/input.js +704 -0
- package/dist/view/selection.js +198 -0
- package/dist/view/view.d.ts +699 -0
- package/dist/view/view.js +623 -0
- package/dist/view/viewdesc.d.ts +236 -0
- package/dist/view/viewdesc.js +1205 -0
- package/dist/view-css.d.ts +43 -0
- package/dist/view-css.js +124 -0
- package/dist/view.d.ts +6 -0
- package/dist/view.js +4 -0
- package/package.json +206 -3
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { Mark } from "../model/mark.js";
|
|
2
|
+
import { Node } from "../model/node.js";
|
|
3
|
+
import { Fragment } from "../model/fragment.js";
|
|
4
|
+
import "../model.js";
|
|
5
|
+
import { Mappable, Mapping } from "../transform/map.js";
|
|
6
|
+
import "../transform.js";
|
|
7
|
+
import { DOMNode } from "./dom.js";
|
|
8
|
+
import { EditorView } from "./view.js";
|
|
9
|
+
declare class FragmentCursor {
|
|
10
|
+
readonly frag: Fragment<any, any>;
|
|
11
|
+
index: number;
|
|
12
|
+
off: number;
|
|
13
|
+
constructor(frag: Fragment<any, any>);
|
|
14
|
+
spansNode(from: number, to: number): boolean;
|
|
15
|
+
}
|
|
16
|
+
/** @internal */
|
|
17
|
+
export interface DecorationType {
|
|
18
|
+
spec: any;
|
|
19
|
+
map(mapping: Mappable, span: Decoration, offset: number, oldOffset: number): Decoration | null;
|
|
20
|
+
valid(node: Node<any, any>, span: Decoration, cursor: FragmentCursor): boolean;
|
|
21
|
+
eq(other: DecorationType): boolean;
|
|
22
|
+
destroy(dom: DOMNode): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The DOM content of a widget decoration: either a DOM node, or a
|
|
26
|
+
* function that renders it (lazily, when the widget is drawn). The
|
|
27
|
+
* `getPos` argument can be used to find the widget's current document
|
|
28
|
+
* position (it returns `undefined` when the widget is not in the
|
|
29
|
+
* document).
|
|
30
|
+
*
|
|
31
|
+
* @since 0.1.0
|
|
32
|
+
* @category models
|
|
33
|
+
*/
|
|
34
|
+
export type WidgetConstructor = ((view: EditorView<any, any, any>, getPos: () => number | undefined) => DOMNode) | DOMNode;
|
|
35
|
+
/** @internal */
|
|
36
|
+
export declare class WidgetType implements DecorationType {
|
|
37
|
+
readonly toDOM: WidgetConstructor;
|
|
38
|
+
spec: any;
|
|
39
|
+
side: number;
|
|
40
|
+
constructor(toDOM: WidgetConstructor, spec: any);
|
|
41
|
+
map(mapping: Mappable, span: Decoration, offset: number, oldOffset: number): Decoration | null;
|
|
42
|
+
valid(): boolean;
|
|
43
|
+
eq(other: WidgetType): boolean;
|
|
44
|
+
destroy(node: DOMNode): void;
|
|
45
|
+
}
|
|
46
|
+
/** @internal */
|
|
47
|
+
export declare class InlineType implements DecorationType {
|
|
48
|
+
readonly attrs: DecorationAttrs;
|
|
49
|
+
spec: any;
|
|
50
|
+
constructor(attrs: DecorationAttrs, spec: any);
|
|
51
|
+
map(mapping: Mappable, span: Decoration, offset: number, oldOffset: number): Decoration | null;
|
|
52
|
+
valid(_: Node<any, any>, span: Decoration): boolean;
|
|
53
|
+
eq(other: DecorationType): boolean;
|
|
54
|
+
static is(span: Decoration): boolean;
|
|
55
|
+
destroy(): void;
|
|
56
|
+
}
|
|
57
|
+
/** @internal */
|
|
58
|
+
export declare class NodeType implements DecorationType {
|
|
59
|
+
readonly attrs: DecorationAttrs;
|
|
60
|
+
spec: any;
|
|
61
|
+
constructor(attrs: DecorationAttrs, spec: any);
|
|
62
|
+
map(mapping: Mappable, span: Decoration, offset: number, oldOffset: number): Decoration | null;
|
|
63
|
+
valid(_node: Node<any, any>, span: Decoration, cursor: FragmentCursor): boolean;
|
|
64
|
+
eq(other: DecorationType): boolean;
|
|
65
|
+
destroy(): void;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The spec of a widget decoration (see `Decoration.widget`).
|
|
69
|
+
*
|
|
70
|
+
* @since 0.1.0
|
|
71
|
+
* @category models
|
|
72
|
+
*/
|
|
73
|
+
export interface WidgetDecorationSpec {
|
|
74
|
+
/**
|
|
75
|
+
* Controls which side of the document position this widget is
|
|
76
|
+
* associated with. When negative, it is drawn before a cursor at its
|
|
77
|
+
* position, and content inserted at that position ends up after the
|
|
78
|
+
* widget. When zero (the default) or positive, the widget is drawn
|
|
79
|
+
* after the cursor and content inserted there ends up before the
|
|
80
|
+
* widget.
|
|
81
|
+
*
|
|
82
|
+
* When there are multiple widgets at a given position, their `side`
|
|
83
|
+
* values determine the order in which they appear. Those with lower
|
|
84
|
+
* values appear first. The ordering of widgets with the same `side`
|
|
85
|
+
* value is unspecified.
|
|
86
|
+
*
|
|
87
|
+
* When `marks` is null, `side` also determines the marks that the
|
|
88
|
+
* widget is wrapped in—those of the node before when negative, those
|
|
89
|
+
* of the node after when positive.
|
|
90
|
+
*/
|
|
91
|
+
readonly side?: number | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* By default, the cursor, when at the position of the widget, will be
|
|
94
|
+
* strictly kept on the side indicated by `side`. Set this to true to
|
|
95
|
+
* allow the DOM selection to stay on the other side if the client
|
|
96
|
+
* sets it there.
|
|
97
|
+
*/
|
|
98
|
+
readonly relaxedSide?: boolean | undefined;
|
|
99
|
+
/** The precise set of marks to draw around the widget. */
|
|
100
|
+
readonly marks?: ReadonlyArray<Mark<any, any>> | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Can be used to control which DOM events, when they bubble out of
|
|
103
|
+
* this widget, the editor view should ignore.
|
|
104
|
+
*/
|
|
105
|
+
readonly stopEvent?: ((event: Event) => boolean) | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* When set (defaults to false), selection changes inside the widget
|
|
108
|
+
* are ignored, and don't cause the view to try and re-sync the
|
|
109
|
+
* selection with its selection state.
|
|
110
|
+
*/
|
|
111
|
+
readonly ignoreSelection?: boolean | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* When comparing decorations of this type (in order to decide whether
|
|
114
|
+
* it needs to be redrawn), the view will by default compare the widget
|
|
115
|
+
* DOM node by identity. If you pass a key, that key will be compared
|
|
116
|
+
* instead, which can be useful when you generate decorations on the
|
|
117
|
+
* fly and don't want to store and reuse DOM nodes. Make sure that any
|
|
118
|
+
* widgets with the same key are interchangeable.
|
|
119
|
+
*/
|
|
120
|
+
readonly key?: string | undefined;
|
|
121
|
+
/** Called when the widget decoration is removed or the editor is destroyed. */
|
|
122
|
+
readonly destroy?: ((node: DOMNode) => void) | undefined;
|
|
123
|
+
/** Specs allow arbitrary additional properties. */
|
|
124
|
+
readonly [key: string]: any;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The spec of an inline decoration (see `Decoration.inline`).
|
|
128
|
+
*
|
|
129
|
+
* @since 0.1.0
|
|
130
|
+
* @category models
|
|
131
|
+
*/
|
|
132
|
+
export interface InlineDecorationSpec {
|
|
133
|
+
/**
|
|
134
|
+
* Determines how the left side of the decoration is mapped when
|
|
135
|
+
* content is inserted directly at that position. By default, the
|
|
136
|
+
* decoration won't include the new content, but you can set this to
|
|
137
|
+
* `true` to make it inclusive.
|
|
138
|
+
*/
|
|
139
|
+
readonly inclusiveStart?: boolean | undefined;
|
|
140
|
+
/** Determines how the right side of the decoration is mapped. */
|
|
141
|
+
readonly inclusiveEnd?: boolean | undefined;
|
|
142
|
+
/** Specs may have arbitrary additional properties. */
|
|
143
|
+
readonly [key: string]: any;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Decoration objects can be provided to the view through the
|
|
147
|
+
* `decorations` prop. They come in several variants—see the static
|
|
148
|
+
* members of this class for details.
|
|
149
|
+
*
|
|
150
|
+
* @since 0.1.0
|
|
151
|
+
* @category models
|
|
152
|
+
*/
|
|
153
|
+
export declare class Decoration {
|
|
154
|
+
/** The start position of the decoration. */
|
|
155
|
+
readonly from: number;
|
|
156
|
+
/** The end position. Will be the same as `from` for widget decorations. */
|
|
157
|
+
readonly to: number;
|
|
158
|
+
/** @internal */
|
|
159
|
+
readonly type: DecorationType;
|
|
160
|
+
/** @internal */
|
|
161
|
+
constructor(
|
|
162
|
+
/** The start position of the decoration. */
|
|
163
|
+
from: number,
|
|
164
|
+
/** The end position. Will be the same as `from` for widget decorations. */
|
|
165
|
+
to: number,
|
|
166
|
+
/** @internal */
|
|
167
|
+
type: DecorationType);
|
|
168
|
+
/** @internal */
|
|
169
|
+
copy(from: number, to: number): Decoration;
|
|
170
|
+
/** @internal */
|
|
171
|
+
eq(other: Decoration, offset?: number): boolean;
|
|
172
|
+
/** @internal */
|
|
173
|
+
map(mapping: Mappable, offset: number, oldOffset: number): Decoration | null;
|
|
174
|
+
/**
|
|
175
|
+
* Creates a widget decoration, which is a DOM node that's shown in
|
|
176
|
+
* the document at the given position. It is recommended that you
|
|
177
|
+
* delay rendering the widget by passing a function that will be
|
|
178
|
+
* called when the widget is actually drawn in a view, but you can
|
|
179
|
+
* also directly pass a DOM node. `getPos` can be used to find the
|
|
180
|
+
* widget's current document position.
|
|
181
|
+
*/
|
|
182
|
+
static widget(pos: number, toDOM: WidgetConstructor, spec?: WidgetDecorationSpec): Decoration;
|
|
183
|
+
/**
|
|
184
|
+
* Creates an inline decoration, which adds the given attributes to
|
|
185
|
+
* each inline node between `from` and `to`.
|
|
186
|
+
*/
|
|
187
|
+
static inline(from: number, to: number, attrs: DecorationAttrs, spec?: InlineDecorationSpec): Decoration;
|
|
188
|
+
/**
|
|
189
|
+
* Creates a node decoration. `from` and `to` should point precisely
|
|
190
|
+
* before and after a node in the document. That node, and only that
|
|
191
|
+
* node, will receive the given attributes.
|
|
192
|
+
*/
|
|
193
|
+
static node(from: number, to: number, attrs: DecorationAttrs, spec?: any): Decoration;
|
|
194
|
+
/**
|
|
195
|
+
* The spec provided when creating this decoration. Can be useful if
|
|
196
|
+
* you've stored extra information in that object.
|
|
197
|
+
*/
|
|
198
|
+
get spec(): any;
|
|
199
|
+
/** @internal */
|
|
200
|
+
get inline(): boolean;
|
|
201
|
+
/** @internal */
|
|
202
|
+
get widget(): boolean;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* A set of attributes to add to a decorated node. Most properties
|
|
206
|
+
* simply directly correspond to DOM attributes of the same name, which
|
|
207
|
+
* will be set to the property's value. These are exceptions:
|
|
208
|
+
*
|
|
209
|
+
* - `nodeName`: when non-null, the target node is wrapped in a DOM
|
|
210
|
+
* element of this type (and the other attributes are applied to this
|
|
211
|
+
* element).
|
|
212
|
+
* - `class`: a CSS class name or a space-separated set of class names
|
|
213
|
+
* to be _added_ to the classes that the node already had.
|
|
214
|
+
* - `style`: a string of CSS to be _added_ to the node's existing
|
|
215
|
+
* `style` property.
|
|
216
|
+
*
|
|
217
|
+
* @since 0.1.0
|
|
218
|
+
* @category models
|
|
219
|
+
*/
|
|
220
|
+
export type DecorationAttrs = {
|
|
221
|
+
readonly nodeName?: string | undefined;
|
|
222
|
+
readonly class?: string | undefined;
|
|
223
|
+
readonly style?: string | undefined;
|
|
224
|
+
readonly [attribute: string]: string | undefined;
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* An object that can provide decorations. Implemented by
|
|
228
|
+
* `DecorationSet`, and passed to node views.
|
|
229
|
+
*
|
|
230
|
+
* @since 0.1.0
|
|
231
|
+
* @category models
|
|
232
|
+
*/
|
|
233
|
+
export interface DecorationSource {
|
|
234
|
+
/** Map the set of decorations in response to a change in the document. */
|
|
235
|
+
readonly map: (mapping: Mapping, node: Node<any, any>) => DecorationSource;
|
|
236
|
+
/** @internal */
|
|
237
|
+
locals(node: Node<any, any>): ReadonlyArray<Decoration>;
|
|
238
|
+
/** Extract a DecorationSource containing decorations for the given child node at the given offset. */
|
|
239
|
+
forChild(offset: number, child: Node<any, any>): DecorationSource;
|
|
240
|
+
/** @internal */
|
|
241
|
+
eq(other: DecorationSource): boolean;
|
|
242
|
+
/** Call the given function for each decoration set in the group. */
|
|
243
|
+
forEachSet(f: (set: DecorationSet) => void): void;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Options for `DecorationSet.map`.
|
|
247
|
+
*
|
|
248
|
+
* @since 0.1.0
|
|
249
|
+
* @category models
|
|
250
|
+
*/
|
|
251
|
+
export interface DecorationMapOptions {
|
|
252
|
+
/**
|
|
253
|
+
* When given, this function will be called for each decoration that
|
|
254
|
+
* gets dropped as a result of the mapping, passing the spec of that
|
|
255
|
+
* decoration.
|
|
256
|
+
*/
|
|
257
|
+
readonly onRemove?: ((decorationSpec: any) => void) | undefined;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* A collection of decorations, organized in such a way that the
|
|
261
|
+
* drawing algorithm can efficiently use and compare them. This is a
|
|
262
|
+
* persistent data structure—it is not modified, updates create a new
|
|
263
|
+
* value.
|
|
264
|
+
*
|
|
265
|
+
* @since 0.1.0
|
|
266
|
+
* @category models
|
|
267
|
+
*/
|
|
268
|
+
export declare class DecorationSet implements DecorationSource {
|
|
269
|
+
/** @internal */
|
|
270
|
+
local: ReadonlyArray<Decoration>;
|
|
271
|
+
/** @internal */
|
|
272
|
+
children: ReadonlyArray<number | DecorationSet>;
|
|
273
|
+
/** @internal */
|
|
274
|
+
constructor(local: ReadonlyArray<Decoration>, children: ReadonlyArray<number | DecorationSet>);
|
|
275
|
+
/**
|
|
276
|
+
* Create a set of decorations, using the structure of the given
|
|
277
|
+
* document. This will consume (modify) the `decorations` array, so you
|
|
278
|
+
* must make a copy if you want need to preserve that.
|
|
279
|
+
*/
|
|
280
|
+
static create(doc: Node<any, any>, decorations: Array<Decoration>): DecorationSet;
|
|
281
|
+
/**
|
|
282
|
+
* Find all decorations in this set which touch the given range
|
|
283
|
+
* (including decorations that start or end directly at the
|
|
284
|
+
* boundaries) and match the given predicate on their spec. When
|
|
285
|
+
* `start` and `end` are omitted, all decorations in the set are
|
|
286
|
+
* considered. When `predicate` isn't given, all decorations are
|
|
287
|
+
* assumed to match.
|
|
288
|
+
*/
|
|
289
|
+
find(start?: number, end?: number, predicate?: (spec: any) => boolean): Array<Decoration>;
|
|
290
|
+
private findInner;
|
|
291
|
+
/** Map the set of decorations in response to a change in the document. */
|
|
292
|
+
map(mapping: Mapping, doc: Node<any, any>, options?: DecorationMapOptions): DecorationSet;
|
|
293
|
+
/** @internal */
|
|
294
|
+
mapInner(mapping: Mapping, node: Node<any, any>, offset: number, oldOffset: number, options: DecorationMapOptions): DecorationSet;
|
|
295
|
+
/**
|
|
296
|
+
* Add the given array of decorations to the ones in the set, producing
|
|
297
|
+
* a new set. Consumes the `decorations` array. Needs access to the
|
|
298
|
+
* current document to create the appropriate tree structure.
|
|
299
|
+
*/
|
|
300
|
+
add(doc: Node<any, any>, decorations: Array<Decoration>): DecorationSet;
|
|
301
|
+
private addInner;
|
|
302
|
+
/**
|
|
303
|
+
* Create a new set that contains the decorations in this set, minus
|
|
304
|
+
* the ones in the given array.
|
|
305
|
+
*/
|
|
306
|
+
remove(decorations: Array<Decoration>): DecorationSet;
|
|
307
|
+
private removeInner;
|
|
308
|
+
forChild(offset: number, node: Node<any, any>): DecorationSource;
|
|
309
|
+
/** @internal */
|
|
310
|
+
eq(other: DecorationSource): boolean;
|
|
311
|
+
/** @internal */
|
|
312
|
+
locals(node: Node<any, any>): ReadonlyArray<Decoration>;
|
|
313
|
+
/** @internal */
|
|
314
|
+
localsInner(node: Node<any, any>): ReadonlyArray<Decoration>;
|
|
315
|
+
/** The empty set of decorations. */
|
|
316
|
+
static empty: DecorationSet;
|
|
317
|
+
/** @internal */
|
|
318
|
+
static removeOverlap: typeof removeOverlap;
|
|
319
|
+
forEachSet(f: (set: DecorationSet) => void): void;
|
|
320
|
+
}
|
|
321
|
+
/** @internal */
|
|
322
|
+
export declare class DecorationGroup implements DecorationSource {
|
|
323
|
+
readonly members: ReadonlyArray<DecorationSet>;
|
|
324
|
+
constructor(members: ReadonlyArray<DecorationSet>);
|
|
325
|
+
map(mapping: Mapping, doc: Node<any, any>): DecorationSource;
|
|
326
|
+
forChild(offset: number, child: Node<any, any>): DecorationSource;
|
|
327
|
+
eq(other: DecorationSource): boolean;
|
|
328
|
+
locals(node: Node<any, any>): ReadonlyArray<Decoration>;
|
|
329
|
+
static from(members: ReadonlyArray<DecorationSource>): DecorationSource;
|
|
330
|
+
forEachSet(f: (set: DecorationSet) => void): void;
|
|
331
|
+
}
|
|
332
|
+
declare function removeOverlap(spans: ReadonlyArray<Decoration>): Array<Decoration>;
|
|
333
|
+
/**
|
|
334
|
+
* Get the decorations associated with the current props of a view.
|
|
335
|
+
*
|
|
336
|
+
* @internal
|
|
337
|
+
*/
|
|
338
|
+
export declare function viewDecorations(view: EditorView<any, any, any>): DecorationSource;
|
|
339
|
+
export {};
|