svedit 0.12.0 → 0.13.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.
Files changed (86) hide show
  1. package/README.md +33 -21
  2. package/dist/Command.svelte.d.ts +38 -30
  3. package/dist/Command.svelte.d.ts.map +1 -1
  4. package/dist/Command.svelte.js +271 -326
  5. package/dist/CustomProperty.svelte +3 -5
  6. package/dist/CustomProperty.svelte.d.ts +3 -6
  7. package/dist/CustomProperty.svelte.d.ts.map +1 -1
  8. package/dist/KeyMapper.svelte.d.ts +19 -6
  9. package/dist/KeyMapper.svelte.d.ts.map +1 -1
  10. package/dist/KeyMapper.svelte.js +95 -112
  11. package/dist/Node.svelte +16 -13
  12. package/dist/Node.svelte.d.ts +3 -5
  13. package/dist/Node.svelte.d.ts.map +1 -1
  14. package/dist/NodeArrayProperty.svelte +39 -22
  15. package/dist/NodeArrayProperty.svelte.d.ts +3 -5
  16. package/dist/NodeArrayProperty.svelte.d.ts.map +1 -1
  17. package/dist/NodeCaret.svelte +1 -1
  18. package/dist/NodeCaret.svelte.d.ts +6 -14
  19. package/dist/NodeCaret.svelte.d.ts.map +1 -1
  20. package/dist/NodeGap.svelte +12 -6
  21. package/dist/NodeGap.svelte.d.ts +7 -14
  22. package/dist/NodeGap.svelte.d.ts.map +1 -1
  23. package/dist/NodeGapMarkers.svelte +19 -10
  24. package/dist/NodeGapMarkers.svelte.d.ts +6 -11
  25. package/dist/NodeGapMarkers.svelte.d.ts.map +1 -1
  26. package/dist/NodeSelectionMarkers.svelte +20 -6
  27. package/dist/NodeSelectionMarkers.svelte.d.ts +2 -5
  28. package/dist/NodeSelectionMarkers.svelte.d.ts.map +1 -1
  29. package/dist/Session.svelte.d.ts +81 -129
  30. package/dist/Session.svelte.d.ts.map +1 -1
  31. package/dist/Session.svelte.js +542 -648
  32. package/dist/Svedit.svelte +144 -138
  33. package/dist/Svedit.svelte.d.ts +30 -10
  34. package/dist/Svedit.svelte.d.ts.map +1 -1
  35. package/dist/TextProperty.svelte +32 -18
  36. package/dist/TextProperty.svelte.d.ts +3 -5
  37. package/dist/TextProperty.svelte.d.ts.map +1 -1
  38. package/dist/Transaction.svelte.d.ts +64 -127
  39. package/dist/Transaction.svelte.d.ts.map +1 -1
  40. package/dist/Transaction.svelte.js +839 -1001
  41. package/dist/UnknownNode.svelte +4 -3
  42. package/dist/UnknownNode.svelte.d.ts +5 -9
  43. package/dist/UnknownNode.svelte.d.ts.map +1 -1
  44. package/dist/doc_utils.d.ts +67 -155
  45. package/dist/doc_utils.d.ts.map +1 -1
  46. package/dist/doc_utils.js +619 -863
  47. package/dist/index.d.ts +20 -17
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +1 -17
  50. package/dist/node_visibility.svelte.d.ts +110 -9
  51. package/dist/node_visibility.svelte.d.ts.map +1 -1
  52. package/dist/node_visibility.svelte.js +473 -544
  53. package/dist/paste_utils.d.ts +11 -44
  54. package/dist/paste_utils.d.ts.map +1 -1
  55. package/dist/paste_utils.js +111 -152
  56. package/dist/transforms.svelte.d.ts +9 -7
  57. package/dist/transforms.svelte.d.ts.map +1 -1
  58. package/dist/transforms.svelte.js +125 -150
  59. package/dist/types.d.ts +277 -309
  60. package/dist/types.d.ts.map +1 -0
  61. package/dist/types.js +1 -0
  62. package/dist/utils.d.ts +40 -119
  63. package/dist/utils.d.ts.map +1 -1
  64. package/dist/utils.js +346 -473
  65. package/package.json +69 -70
  66. package/src/lib/{Command.svelte.js → Command.svelte.ts} +29 -17
  67. package/src/lib/CustomProperty.svelte +3 -5
  68. package/src/lib/{KeyMapper.svelte.js → KeyMapper.svelte.ts} +28 -11
  69. package/src/lib/Node.svelte +16 -13
  70. package/src/lib/NodeArrayProperty.svelte +39 -22
  71. package/src/lib/NodeCaret.svelte +1 -1
  72. package/src/lib/NodeGap.svelte +12 -6
  73. package/src/lib/NodeGapMarkers.svelte +19 -10
  74. package/src/lib/NodeSelectionMarkers.svelte +20 -6
  75. package/src/lib/{Session.svelte.js → Session.svelte.ts} +130 -127
  76. package/src/lib/Svedit.svelte +144 -138
  77. package/src/lib/TextProperty.svelte +32 -18
  78. package/src/lib/{Transaction.svelte.js → Transaction.svelte.ts} +139 -143
  79. package/src/lib/UnknownNode.svelte +4 -3
  80. package/src/lib/{doc_utils.js → doc_utils.ts} +247 -206
  81. package/src/lib/{index.js → index.ts} +47 -0
  82. package/src/lib/{node_visibility.svelte.js → node_visibility.svelte.ts} +68 -92
  83. package/src/lib/{paste_utils.js → paste_utils.ts} +47 -58
  84. package/src/lib/{transforms.svelte.js → transforms.svelte.ts} +39 -21
  85. package/src/lib/{types.d.ts → types.ts} +143 -66
  86. package/src/lib/{utils.js → utils.ts} +110 -129
@@ -1,9 +1,10 @@
1
- <script>
1
+ <script lang="ts">
2
2
  import { getContext } from 'svelte';
3
3
  import Node from './Node.svelte';
4
+ import type { DocumentPath, SveditContext } from './types.js';
4
5
 
5
- const svedit = getContext('svedit');
6
- let { path } = $props();
6
+ const svedit = getContext<SveditContext>('svedit');
7
+ let { path }: { path: DocumentPath } = $props();
7
8
  let node = $derived(svedit.session.get(path));
8
9
  </script>
9
10
 
@@ -1,12 +1,8 @@
1
- export default UnknownNode;
2
- type UnknownNode = {
3
- $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<$$ComponentProps>): void;
5
- };
6
- declare const UnknownNode: import("svelte").Component<{
7
- path: any;
8
- }, {}, "">;
1
+ import type { DocumentPath } from './types.js';
9
2
  type $$ComponentProps = {
10
- path: any;
3
+ path: DocumentPath;
11
4
  };
5
+ declare const UnknownNode: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type UnknownNode = ReturnType<typeof UnknownNode>;
7
+ export default UnknownNode;
12
8
  //# sourceMappingURL=UnknownNode.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnknownNode.svelte.d.ts","sourceRoot":"","sources":["../src/lib/UnknownNode.svelte.js"],"names":[],"mappings":";;;;;AAqBA;UAV0B,GAAG;WAU6B;wBAVxC;IAAE,IAAI,EAAE,GAAG,CAAA;CAAE"}
1
+ {"version":3,"file":"UnknownNode.svelte.d.ts","sourceRoot":"","sources":["../src/lib/UnknownNode.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,YAAY,CAAC;AAE7D,KAAK,gBAAgB,GAAI;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC;AAiBjD,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
@@ -1,29 +1,25 @@
1
+ /**
2
+ * Shared document utilities used by both Session and Transaction.
3
+ *
4
+ * These functions operate on the core document state (schema, doc, selection, config)
5
+ * without any history management or transaction tracking.
6
+ */
7
+ import type { NodeId, DocumentPath, PrimitiveType, PropertyDefinition, NodeProperty, NodeArrayProperty, NodeSchema, NodeKind, DocumentSchema, Selection, Attachment, Document, DocumentNode, ValidateDocumentSchema, Inspection, DocumentOperation, SessionConfig } from './types.js';
1
8
  /**
2
9
  * Identity function — keeps schema at runtime & makes IDE infer types.
3
10
  * Similar to your define_schema pattern but for document schemas.
4
- *
5
- * @template {Record<string, NodeSchema>} S
6
- * @param {S & ValidateDocumentSchema<S>} schema - The document schema to validate
7
- * @returns {S} The same schema, but with type information preserved
8
11
  */
9
- export function define_document_schema<S extends Record<string, NodeSchema>>(schema: S & ValidateDocumentSchema<S>): S;
12
+ export declare function define_document_schema<S extends Record<string, NodeSchema>>(schema: S & ValidateDocumentSchema<S>): S;
10
13
  /**
11
14
  * Check if a string represents a valid primitive type.
12
- * @param {string} type - The type string to check
13
- * @returns {type is PrimitiveType} True if it's a valid primitive type
14
15
  */
15
- export function is_primitive_type(type: string): type is PrimitiveType;
16
+ export declare function is_primitive_type(type: string): type is PrimitiveType;
16
17
  /**
17
18
  * Get the default node type for a property that references nodes.
18
- * @param {NodeProperty | NodeArrayProperty} property_definition - The property definition
19
- * @returns {string | null} The default node type, or null if none specified
19
+ * Returns null if none specified.
20
20
  */
21
- export function get_default_node_type(property_definition: NodeProperty | NodeArrayProperty): string | null;
22
- /**
23
- * @param {import('./types').PropertyDefinition} property_definition
24
- * @returns {any}
25
- */
26
- export function get_property_default(property_definition: import("./types").PropertyDefinition): any;
21
+ export declare function get_default_node_type(property_definition: NodeProperty | NodeArrayProperty): string | null;
22
+ export declare function get_property_default(property_definition: PropertyDefinition): any;
27
23
  /**
28
24
  * Fill omitted properties with schema defaults and Svedit's built-in type defaults.
29
25
  *
@@ -32,11 +28,9 @@ export function get_property_default(property_definition: import("./types").Prop
32
28
  * schema changes cannot be represented by defaults, such as property renames or
33
29
  * data transformations.
34
30
  *
35
- * @param {any} node - The node to fill defaults for
36
- * @param {DocumentSchema} schema - The document schema
37
- * @returns {any} A shallow copy of the node with cloned default values filled in
31
+ * @returns A shallow copy of the node with cloned default values filled in
38
32
  */
39
- export function fill_node_defaults(node: any, schema: DocumentSchema): any;
33
+ export declare function fill_node_defaults(node: DocumentNode, schema: DocumentSchema): DocumentNode;
40
34
  /**
41
35
  * Fill omitted properties with schema defaults and Svedit's built-in type defaults across a document.
42
36
  *
@@ -44,90 +38,63 @@ export function fill_node_defaults(node: any, schema: DocumentSchema): any;
44
38
  * by itself. Call this as one step in an explicit document migration when it is
45
39
  * appropriate.
46
40
  *
47
- * @param {Document} doc - The document to fill defaults for
48
- * @param {DocumentSchema} schema - The document schema
49
- * @returns {Document} A document copy with cloned default values filled in
41
+ * @returns A document copy with cloned default values filled in
50
42
  */
51
- export function fill_document_defaults(doc: Document, schema: DocumentSchema): Document;
43
+ export declare function fill_document_defaults(doc: Document, schema: DocumentSchema): Document;
52
44
  /**
53
45
  * Validate a document schema to ensure all referenced node types exist.
54
- * @param {DocumentSchema} document_schema - The document schema to validate
55
46
  * @throws {Error} Throws if the document schema is invalid
56
47
  */
57
- export function validate_document_schema(document_schema: DocumentSchema): void;
48
+ export declare function validate_document_schema(document_schema: DocumentSchema): void;
58
49
  /**
59
50
  * Validate that no annotation node type has a registered component.
60
51
  *
61
52
  * Marks render in-place via components; annotations are data-only overlay
62
53
  * ranges that must be interpreted by the app (via CSS classes or props).
63
54
  *
64
- * @param {DocumentSchema} schema - The document schema
65
- * @param {any} config - The Svedit config
66
55
  * @throws {Error} Throws if a kind 'annotation' type has a registered component
67
56
  */
68
- export function validate_config_components(schema: DocumentSchema, config: any): void;
69
- /**
70
- * @param {string} id
71
- * @returns {boolean}
72
- */
73
- export function is_id_valid(id: string): boolean;
57
+ export declare function validate_config_components(schema: DocumentSchema, config: SessionConfig): void;
58
+ export declare function is_id_valid(id: string): boolean;
74
59
  /**
75
60
  * Validate a node against its schema.
76
- * @param {any} node - The node to validate
77
- * @param {DocumentSchema} schema - The document schema
78
- * @param {Record<string, any>} all_nodes - All nodes in the document to check references
79
- * @param {{ require_references?: boolean }} [options] - Validation options
61
+ *
62
+ * @param node - The node to validate
63
+ * @param schema - The document schema
64
+ * @param all_nodes - All nodes in the document to check references
65
+ * @param options - Validation options
80
66
  * @throws {Error} Throws if the node is invalid
81
67
  */
82
- export function validate_node(node: any, schema: DocumentSchema, all_nodes?: Record<string, any>, options?: {
68
+ export declare function validate_node(node: DocumentNode, schema: DocumentSchema, all_nodes?: Record<string, DocumentNode>, options?: {
83
69
  require_references?: boolean;
84
70
  }): void;
85
71
  /**
86
72
  * Validate a document against its schema.
87
73
  *
88
- * @param {Document} doc - The document to validate
89
- * @param {DocumentSchema} schema - The document schema
90
74
  * @throws {Error} Throws if the document is invalid
91
75
  */
92
- export function validate_document(doc: Document, schema: DocumentSchema): void;
76
+ export declare function validate_document(doc: Document, schema: DocumentSchema): void;
93
77
  /**
94
78
  * Gets a value from the document at the specified path.
95
79
  *
96
- * @param {DocumentSchema} schema - The document schema
97
- * @param {Document} doc - The document containing nodes
98
- * @param {DocumentPath|string} path - Array path to the value, or a string node ID
99
- * @returns {any} The value at the specified path
80
+ * @param schema - The document schema
81
+ * @param doc - The document containing nodes
82
+ * @param path - Array path to the value, or a string node ID
83
+ * @returns The value at the specified path
100
84
  */
101
- export function get(schema: DocumentSchema, doc: Document, path: DocumentPath | string): any;
85
+ export declare function get(schema: DocumentSchema, doc: Document, path: DocumentPath | string): any;
102
86
  /**
103
87
  * Gets the type of a property from the schema.
104
- *
105
- * @param {object} schema - The document schema
106
- * @param {string} type - The node type
107
- * @param {string} property - The property name
108
- * @returns {string} The property type
109
88
  */
110
- export function property_type(schema: object, type: string, property: string): string;
89
+ export declare function property_type(schema: DocumentSchema, type: string, property: string): string;
111
90
  /**
112
- * Determines the kind of a node ('block', 'text', 'mark', or 'annotation').
113
- *
114
- * @param {object} schema - The document schema
115
- * @param {any} node - The node to check
116
- * @returns {'block'|'text'|'mark'|'annotation'} The node kind
91
+ * Determines the kind of a node ('document', 'block', 'text', 'mark', or 'annotation').
117
92
  */
118
- export function kind(schema: object, node: any): "block" | "text" | "mark" | "annotation";
93
+ export declare function kind(schema: DocumentSchema, node: DocumentNode): NodeKind;
119
94
  /**
120
95
  * Inspects a path to get metadata about the value at that location.
121
- *
122
- * @param {DocumentSchema} schema - The document schema
123
- * @param {Document} doc - The document containing nodes
124
- * @param {DocumentPath} path - The path to inspect
125
- * @returns {{kind: 'property'|'node', [key: string]: any}} Metadata about the path
126
96
  */
127
- export function inspect(schema: DocumentSchema, doc: Document, path: DocumentPath): {
128
- kind: "property" | "node";
129
- [key: string]: any;
130
- };
97
+ export declare function inspect(schema: DocumentSchema, doc: Document, path: DocumentPath): Inspection;
131
98
  /**
132
99
  * Creates a mutable draft of a document: a new document object with a new
133
100
  * nodes map, sharing the (immutable) node objects with the original.
@@ -137,10 +104,9 @@ export function inspect(schema: DocumentSchema, doc: Document, path: DocumentPat
137
104
  * (fine-grained rendering relies on this) and the original document is
138
105
  * never touched.
139
106
  *
140
- * @param {Document} doc - The document to create a draft of
141
- * @returns {Document} A draft document safe to mutate via apply_op_to_draft
107
+ * @returns A draft document safe to mutate via apply_op_to_draft
142
108
  */
143
- export function create_document_draft(doc: Document): Document;
109
+ export declare function create_document_draft(doc: Document): Document;
144
110
  /**
145
111
  * Applies an operation to a document draft in place.
146
112
  *
@@ -149,132 +115,78 @@ export function create_document_draft(doc: Document): Document;
149
115
  * previous one-copy-per-op behavior, which made transactions with many ops
150
116
  * (paste, cascade delete) O(N·ops).
151
117
  *
152
- * @param {Document} draft - A draft created via create_document_draft
153
- * @param {Array} op - The operation to apply [type, ...args]
154
- * @returns {Document} The same draft, for convenience
118
+ * @param draft - A draft created via create_document_draft
119
+ * @param op - The operation to apply [type, ...args]
120
+ * @returns The same draft, for convenience
155
121
  */
156
- export function apply_op_to_draft(draft: Document, op: any[]): Document;
122
+ export declare function apply_op_to_draft(draft: Document, op: DocumentOperation): Document;
157
123
  /**
158
124
  * Applies an operation to a document and returns the new document.
159
125
  * Uses copy-on-write semantics.
160
126
  *
161
- * @param {Document} doc - The document to apply the operation to
162
- * @param {Array} op - The operation to apply [type, ...args]
163
- * @returns {Document} The new document with the operation applied
127
+ * @param doc - The document to apply the operation to
128
+ * @param op - The operation to apply [type, ...args]
129
+ * @returns The new document with the operation applied
164
130
  */
165
- export function apply_op(doc: Document, op: any[]): Document;
131
+ export declare function apply_op(doc: Document, op: DocumentOperation): Document;
166
132
  /**
167
133
  * Counts how many times a node is referenced in the document.
168
- *
169
- * @param {DocumentSchema} schema - The document schema
170
- * @param {Document} doc - The document containing nodes
171
- * @param {NodeId} node_id - The node ID to count references for
172
- * @returns {number} The number of references
173
134
  */
174
- export function count_references(schema: DocumentSchema, doc: Document, node_id: NodeId): number;
135
+ export declare function count_references(schema: DocumentSchema, doc: Document, node_id: NodeId): number;
175
136
  /**
176
- * @param {DocumentSchema} schema - The document schema
177
- * @param {string} from_type - Current mark type
178
- * @param {string} to_type - Target mark type
179
- * @returns {boolean} Whether a mark can be switched between these types
137
+ * Whether a mark can be switched between these types.
180
138
  */
181
- export function can_switch_mark_type(schema: DocumentSchema, from_type: string, to_type: string): boolean;
139
+ export declare function can_switch_mark_type(schema: DocumentSchema, from_type: string, to_type: string): boolean;
182
140
  /**
183
- * Gets marks touched by the current selection.
184
- *
185
- * @param {DocumentSchema} schema - The document schema
186
- * @param {Document} doc - The document containing nodes
187
- * @param {Selection} [selection] - The current selection
188
- * @returns {(Mark & { index: number, node: any })[]} Selected mark records
141
+ * An attachment (mark or annotation) enriched with its index in the parent
142
+ * attachment array and the resolved payload node.
189
143
  */
190
- export function get_selected_marks(schema: DocumentSchema, doc: Document, selection?: Selection): (Mark & {
144
+ export type SelectedAttachment = Attachment & {
191
145
  index: number;
192
- node: any;
193
- })[];
146
+ node: DocumentNode;
147
+ };
148
+ /**
149
+ * Gets marks touched by the current selection.
150
+ */
151
+ export declare function get_selected_marks(schema: DocumentSchema, doc: Document, selection?: Selection | null): SelectedAttachment[];
194
152
  /**
195
153
  * Gets annotations touched by the current selection.
196
- *
197
- * @param {DocumentSchema} schema - The document schema
198
- * @param {Document} doc - The document containing nodes
199
- * @param {Selection} [selection] - The current selection
200
- * @returns {(Annotation & { index: number, node: any })[]} Selected annotation records
201
154
  */
202
- export function get_selected_annotations(schema: DocumentSchema, doc: Document, selection?: Selection): (Annotation & {
203
- index: number;
204
- node: any;
205
- })[];
155
+ export declare function get_selected_annotations(schema: DocumentSchema, doc: Document, selection?: Selection | null): SelectedAttachment[];
206
156
  /**
207
- * @param {(Attachment & { index: number, node: any })[]} selected_ranges
208
- * @returns {Set<string>} Node types represented in the selected ranges
157
+ * Node types represented in the selected ranges.
209
158
  */
210
- export function get_selected_range_types(selected_ranges: (Attachment & {
211
- index: number;
212
- node: any;
213
- })[]): Set<string>;
159
+ export declare function get_selected_range_types(selected_ranges: SelectedAttachment[]): Set<string>;
214
160
  /**
215
161
  * Counts references to a node, excluding nodes marked for deletion.
216
- *
217
- * @param {DocumentSchema} schema - The document schema
218
- * @param {Document} doc - The document containing nodes
219
- * @param {NodeId} target_node_id - The node ID to count references for
220
- * @param {Record<NodeId, boolean>} nodes_to_delete - Nodes marked for deletion
221
- * @returns {number} The number of references excluding deleted nodes
222
162
  */
223
- export function count_references_excluding_deleted(schema: DocumentSchema, doc: Document, target_node_id: NodeId, nodes_to_delete: Record<NodeId, boolean>): number;
163
+ export declare function count_references_excluding_deleted(schema: DocumentSchema, doc: Document, target_node_id: NodeId, nodes_to_delete: Record<NodeId, boolean>): number;
224
164
  /**
225
165
  * Iterates all node references going out of a node, invoking the visitor
226
166
  * once per occurrence (multiplicity matters for reference counting).
227
167
  * Covers the same reference kinds as count_references_excluding_deleted:
228
168
  * a `node` property, `node_array` .nodes ids, and the mark/annotation
229
169
  * node_ids carried on `text` and `node_array` properties.
230
- *
231
- * @param {DocumentSchema} schema - The document schema
232
- * @param {any} node - The node whose outgoing references to visit
233
- * @param {(referenced_id: NodeId) => void} visit - Called per reference occurrence
234
170
  */
235
- export function visit_node_references(schema: DocumentSchema, node: any, visit: (referenced_id: NodeId) => void): void;
171
+ export declare function visit_node_references(schema: DocumentSchema, node: DocumentNode, visit: (referenced_id: NodeId) => void): void;
236
172
  /**
237
173
  * Builds reference counts for every referenced node in one full-document
238
174
  * scan. Used by cascade deletion so the fixpoint can decrement counts
239
175
  * incrementally instead of re-scanning the document per candidate node.
240
- *
241
- * @param {DocumentSchema} schema - The document schema
242
- * @param {Document} doc - The document containing nodes
243
- * @returns {Map<NodeId, number>} Reference count per referenced node id
244
176
  */
245
- export function build_reference_counts(schema: DocumentSchema, doc: Document): Map<NodeId, number>;
177
+ export declare function build_reference_counts(schema: DocumentSchema, doc: Document): Map<NodeId, number>;
246
178
  /**
247
179
  * Gets ids of nodes that reference any of the target nodes.
248
- *
249
- * @param {DocumentSchema} schema - The document schema
250
- * @param {Document} doc - The document containing nodes
251
- * @param {Iterable<NodeId>} target_node_ids - Node IDs to find referrers for
252
- * @returns {NodeId[]} IDs of nodes with references to any target node
253
180
  */
254
- export function get_referencing_node_ids(schema: DocumentSchema, doc: Document, target_node_ids: Iterable<NodeId>): NodeId[];
181
+ export declare function get_referencing_node_ids(schema: DocumentSchema, doc: Document, target_node_ids: Iterable<NodeId>): NodeId[];
255
182
  /**
256
183
  * Validates a selection against the current document state.
257
184
  * Works with any object that implements get() and inspect() (Session or Transaction).
258
185
  *
259
- * @param {Selection} selection - The selection to validate
260
- * @param {{ get: Function, inspect: Function }} session_or_transaction - A Session or Transaction instance
261
186
  * @throws {Error} Throws if the selection is invalid
262
187
  */
263
- export function validate_selection(selection: Selection, session_or_transaction: {
264
- get: Function;
265
- inspect: Function;
188
+ export declare function validate_selection(selection: Selection | null | undefined, session_or_transaction: {
189
+ get: (path: DocumentPath) => any;
190
+ inspect: (path: DocumentPath) => Inspection;
266
191
  }): void;
267
- import type { NodeSchema } from './types';
268
- import type { ValidateDocumentSchema } from './types';
269
- import type { PrimitiveType } from './types';
270
- import type { NodeProperty } from './types';
271
- import type { NodeArrayProperty } from './types';
272
- import type { DocumentSchema } from './types';
273
- import type { Document } from './types';
274
- import type { DocumentPath } from './types';
275
- import type { NodeId } from './types';
276
- import type { Selection } from './types';
277
- import type { Mark } from './types';
278
- import type { Annotation } from './types';
279
- import type { Attachment } from './types';
280
192
  //# sourceMappingURL=doc_utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"doc_utils.d.ts","sourceRoot":"","sources":["../src/lib/doc_utils.js"],"names":[],"mappings":"AAkBA;;;;;;;GAOG;AACH,uCAJ0C,CAAC,SAA7B,MAAM,CAAC,MAAM,EAAE,UAAU,CAAE,UAC9B,CAAC,GAAG,uBAAuB,CAAC,CAAC,GAC3B,CAAC,CAIb;AAED;;;;GAIG;AACH,wCAHW,MAAM,GACJ,IAAI,IAAI,aAAa,CAejC;AAED;;;;GAIG;AACH,2DAHW,YAAY,GAAG,iBAAiB,GAC9B,MAAM,GAAG,IAAI,CAWzB;AAED;;;GAGG;AACH,0DAHW,OAAO,SAAS,EAAE,kBAAkB,GAClC,GAAG,CAqBf;AAED;;;;;;;;;;;GAWG;AACH,yC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