lib0 0.2.115-1 → 0.2.115-3
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/coverage/tmp/{coverage-27668-1761218485882-0.json → coverage-32703-1763495370274-0.json} +1 -1
- package/delta/abstract.d.ts +2 -2
- package/delta/abstract.d.ts.map +1 -1
- package/delta/d2.d.ts +318 -112
- package/delta/d2.d.ts.map +1 -1
- package/delta/d2.js +837 -155
- package/delta/d2.test.d.ts +6 -1
- package/delta/d2.test.d.ts.map +1 -1
- package/delta/map.d.ts +19 -23
- package/delta/map.d.ts.map +1 -1
- package/delta/map.js +1 -1
- package/delta/node.d.ts +8 -10
- package/delta/node.d.ts.map +1 -1
- package/delta/ops.d.ts +26 -28
- package/delta/ops.d.ts.map +1 -1
- package/delta/t2.d.ts +184 -0
- package/delta/t2.d.ts.map +1 -0
- package/delta/t2.js +890 -0
- package/delta/t3.test.d.ts +19 -0
- package/delta/t3.test.d.ts.map +1 -0
- package/dist/aes-gcm.cjs +2 -2
- package/dist/binding.cjs +1 -1
- package/dist/{broadcastchannel-b4eaea6e.cjs → broadcastchannel-d0c108a2.cjs} +2 -2
- package/dist/{broadcastchannel-b4eaea6e.cjs.map → broadcastchannel-d0c108a2.cjs.map} +1 -1
- package/dist/broadcastchannel.cjs +4 -4
- package/dist/{buffer-adc4e6ea.cjs → buffer-7f6fa8fa.cjs} +3 -3
- package/dist/{buffer-adc4e6ea.cjs.map → buffer-7f6fa8fa.cjs.map} +1 -1
- package/dist/buffer.cjs +3 -3
- package/dist/component.cjs +1 -1
- package/dist/d2.cjs +845 -159
- package/dist/d2.cjs.map +1 -1
- package/dist/{decoding-50b9ce38.cjs → decoding-76e75827.cjs} +2 -2
- package/dist/{decoding-50b9ce38.cjs.map → decoding-76e75827.cjs.map} +1 -1
- package/dist/decoding.cjs +2 -2
- package/dist/delta/abstract.d.ts +2 -2
- package/dist/delta/abstract.d.ts.map +1 -1
- package/dist/delta/d2.d.ts +318 -112
- package/dist/delta/d2.d.ts.map +1 -1
- package/dist/delta/d2.test.d.ts +6 -1
- package/dist/delta/d2.test.d.ts.map +1 -1
- package/dist/delta/map.d.ts +19 -23
- package/dist/delta/map.d.ts.map +1 -1
- package/dist/delta/node.d.ts +8 -10
- package/dist/delta/node.d.ts.map +1 -1
- package/dist/delta/ops.d.ts +26 -28
- package/dist/delta/ops.d.ts.map +1 -1
- package/dist/delta/t2.d.ts +184 -0
- package/dist/delta/t2.d.ts.map +1 -0
- package/dist/delta/t3.test.d.ts +19 -0
- package/dist/delta/t3.test.d.ts.map +1 -0
- package/dist/{dom-2b123630.cjs → dom-f5047a64.cjs} +1 -1
- package/dist/{dom-2b123630.cjs.map → dom-f5047a64.cjs.map} +1 -1
- package/dist/dom.cjs +1 -1
- package/dist/{encoding-7f85922c.cjs → encoding-1a745c43.cjs} +10 -2
- package/dist/encoding-1a745c43.cjs.map +1 -0
- package/dist/encoding.cjs +1 -1
- package/dist/encoding.d.ts +5 -3
- package/dist/encoding.d.ts.map +1 -1
- package/dist/encoding.test.d.ts.map +1 -1
- package/dist/index.cjs +6 -6
- package/dist/jwt.cjs +3 -3
- package/dist/list.test.d.ts +1 -0
- package/dist/list.test.d.ts.map +1 -1
- package/dist/logging.cjs +1 -1
- package/dist/map.cjs +1 -1
- package/dist/map.cjs.map +1 -1
- package/dist/mutex.test.d.ts +3 -0
- package/dist/mutex.test.d.ts.map +1 -0
- package/dist/{prng-004c76e8.cjs → prng-99204216.cjs} +2 -2
- package/dist/{prng-004c76e8.cjs.map → prng-99204216.cjs.map} +1 -1
- package/dist/prng.cjs +4 -4
- package/dist/rabin-gf2-polynomial.cjs +3 -3
- package/dist/rabin-uncached.cjs +3 -3
- package/dist/rabin.cjs +3 -3
- package/dist/schema.cjs +72 -11
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.d.ts +21 -13
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.test.d.ts +2 -0
- package/dist/schema.test.d.ts.map +1 -1
- package/dist/t2.cjs +932 -0
- package/dist/t2.cjs.map +1 -0
- package/dist/testing.cjs +4 -4
- package/encoding.d.ts +5 -3
- package/encoding.d.ts.map +1 -1
- package/encoding.js +9 -1
- package/encoding.test.d.ts.map +1 -1
- package/list.test.d.ts +1 -0
- package/list.test.d.ts.map +1 -1
- package/mutex.test.d.ts +3 -0
- package/mutex.test.d.ts.map +1 -0
- package/package.json +1 -1
- package/schema.d.ts +21 -13
- package/schema.d.ts.map +1 -1
- package/schema.js +68 -11
- package/schema.test.d.ts +2 -0
- package/schema.test.d.ts.map +1 -1
- package/test.js +3 -1
- package/coverage/tmp/coverage-27667-1761218530660-0.json +0 -1
- package/dist/encoding-7f85922c.cjs.map +0 -1
package/delta/d2.d.ts
CHANGED
|
@@ -20,8 +20,9 @@ export const $attribution: s.Schema<Attribution>;
|
|
|
20
20
|
*/
|
|
21
21
|
/**
|
|
22
22
|
* @typedef {{
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* type: 'delta',
|
|
24
|
+
* name?: string,
|
|
25
|
+
* attrs?: { [Key in string|number]: DeltaAttrOpJSON },
|
|
25
26
|
* children?: Array<DeltaListOpJSON>
|
|
26
27
|
* }} DeltaJSON
|
|
27
28
|
*/
|
|
@@ -31,10 +32,22 @@ export const $attribution: s.Schema<Attribution>;
|
|
|
31
32
|
/**
|
|
32
33
|
* @typedef {{ type: 'insert', value: any, prevValue?: any, attribution?: Attribution } | { type: 'delete', prevValue?: any, attribution?: Attribution } | { type: 'modify', value: DeltaJSON }} DeltaAttrOpJSON
|
|
33
34
|
*/
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {TextOp|InsertOp<any>|DeleteOp|RetainOp|ModifyOp<any>} ChildrenOpAny
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* @typedef {AttrInsertOp<any>|AttrDeleteOp<any>|AttrModifyOp} AttrOpAny
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* @typedef {ChildrenOpAny|AttrOpAny} _OpAny
|
|
43
|
+
*/
|
|
34
44
|
/**
|
|
35
45
|
* @type {s.Schema<DeltaAttrOpJSON>}
|
|
36
46
|
*/
|
|
37
47
|
export const $deltaMapChangeJson: s.Schema<DeltaAttrOpJSON>;
|
|
48
|
+
/**
|
|
49
|
+
* @typedef {unknown & DeltaAny} Q
|
|
50
|
+
*/
|
|
38
51
|
export class TextOp extends list.ListNode {
|
|
39
52
|
/**
|
|
40
53
|
* @param {string} insert
|
|
@@ -42,21 +55,38 @@ export class TextOp extends list.ListNode {
|
|
|
42
55
|
* @param {Attribution?} attribution
|
|
43
56
|
*/
|
|
44
57
|
constructor(insert: string, format: FormattingAttributes | null, attribution: Attribution | null);
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
/**
|
|
59
|
+
* @readonly
|
|
60
|
+
* @type {string}
|
|
61
|
+
*/
|
|
62
|
+
readonly insert: string;
|
|
63
|
+
/**
|
|
64
|
+
* @readonly
|
|
65
|
+
* @type {FormattingAttributes|null}
|
|
66
|
+
*/
|
|
67
|
+
readonly format: FormattingAttributes | null;
|
|
47
68
|
attribution: Attribution | null;
|
|
69
|
+
/**
|
|
70
|
+
* @type {string?}
|
|
71
|
+
*/
|
|
72
|
+
_fingerprint: string | null;
|
|
73
|
+
/**
|
|
74
|
+
* @param {string} newVal
|
|
75
|
+
*/
|
|
76
|
+
_updateInsert(newVal: string): void;
|
|
48
77
|
/**
|
|
49
78
|
* @return {'insert'}
|
|
50
79
|
*/
|
|
51
80
|
get type(): "insert";
|
|
52
81
|
get length(): number;
|
|
82
|
+
get fingerprint(): string;
|
|
53
83
|
/**
|
|
54
84
|
* Remove a part of the operation (similar to Array.splice)
|
|
55
85
|
*
|
|
56
86
|
* @param {number} offset
|
|
57
87
|
* @param {number} len
|
|
58
88
|
*/
|
|
59
|
-
_splice(offset: number, len: number):
|
|
89
|
+
_splice(offset: number, len: number): this;
|
|
60
90
|
/**
|
|
61
91
|
* @return {DeltaListOpJSON}
|
|
62
92
|
*/
|
|
@@ -64,37 +94,63 @@ export class TextOp extends list.ListNode {
|
|
|
64
94
|
/**
|
|
65
95
|
* @return {TextOp}
|
|
66
96
|
*/
|
|
67
|
-
clone(): TextOp;
|
|
97
|
+
clone(start?: number, end?: number): TextOp;
|
|
68
98
|
/**
|
|
69
99
|
* @param {TextOp} other
|
|
70
100
|
*/
|
|
71
101
|
[traits.EqualityTraitSymbol](other: TextOp): boolean;
|
|
72
102
|
}
|
|
73
103
|
/**
|
|
74
|
-
* @template ArrayContent
|
|
104
|
+
* @template {encoding.AnyEncodable|DeltaAny} ArrayContent
|
|
75
105
|
*/
|
|
76
|
-
export class InsertOp<ArrayContent> extends list.ListNode {
|
|
106
|
+
export class InsertOp<ArrayContent extends encoding.AnyEncodable | DeltaAny> extends list.ListNode {
|
|
77
107
|
/**
|
|
78
108
|
* @param {Array<ArrayContent>} insert
|
|
79
109
|
* @param {FormattingAttributes|null} format
|
|
80
110
|
* @param {Attribution?} attribution
|
|
81
111
|
*/
|
|
82
112
|
constructor(insert: Array<ArrayContent>, format: FormattingAttributes | null, attribution: Attribution | null);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
113
|
+
/**
|
|
114
|
+
* @readonly
|
|
115
|
+
* @type {Array<ArrayContent>}
|
|
116
|
+
*/
|
|
117
|
+
readonly insert: Array<ArrayContent>;
|
|
118
|
+
/**
|
|
119
|
+
* @readonly
|
|
120
|
+
* @type {FormattingAttributes?}
|
|
121
|
+
*/
|
|
122
|
+
readonly format: FormattingAttributes | null;
|
|
123
|
+
/**
|
|
124
|
+
* @readonly
|
|
125
|
+
* @type {Attribution?}
|
|
126
|
+
*/
|
|
127
|
+
readonly attribution: Attribution | null;
|
|
128
|
+
/**
|
|
129
|
+
* @type {string?}
|
|
130
|
+
*/
|
|
131
|
+
_fingerprint: string | null;
|
|
132
|
+
/**
|
|
133
|
+
* @param {ArrayContent} newVal
|
|
134
|
+
*/
|
|
135
|
+
_updateInsert(newVal: ArrayContent): void;
|
|
86
136
|
/**
|
|
87
137
|
* @return {'insert'}
|
|
88
138
|
*/
|
|
89
139
|
get type(): "insert";
|
|
90
140
|
get length(): number;
|
|
141
|
+
/**
|
|
142
|
+
* @param {number} i
|
|
143
|
+
* @return {Extract<ArrayContent,DeltaAny>}
|
|
144
|
+
*/
|
|
145
|
+
_modValue(i: number): Extract<ArrayContent, DeltaAny>;
|
|
146
|
+
get fingerprint(): string;
|
|
91
147
|
/**
|
|
92
148
|
* Remove a part of the operation (similar to Array.splice)
|
|
93
149
|
*
|
|
94
150
|
* @param {number} offset
|
|
95
151
|
* @param {number} len
|
|
96
152
|
*/
|
|
97
|
-
_splice(offset: number, len: number):
|
|
153
|
+
_splice(offset: number, len: number): this;
|
|
98
154
|
/**
|
|
99
155
|
* @return {DeltaListOpJSON}
|
|
100
156
|
*/
|
|
@@ -102,35 +158,48 @@ export class InsertOp<ArrayContent> extends list.ListNode {
|
|
|
102
158
|
/**
|
|
103
159
|
* @return {InsertOp<ArrayContent>}
|
|
104
160
|
*/
|
|
105
|
-
clone(): InsertOp<ArrayContent>;
|
|
161
|
+
clone(start?: number, end?: number): InsertOp<ArrayContent>;
|
|
106
162
|
/**
|
|
107
163
|
* @param {InsertOp<ArrayContent>} other
|
|
108
164
|
*/
|
|
109
165
|
[traits.EqualityTraitSymbol](other: InsertOp<ArrayContent>): boolean;
|
|
110
166
|
}
|
|
111
|
-
|
|
167
|
+
/**
|
|
168
|
+
* @template {encoding.AnyEncodable|DeltaAny} [Children=never]
|
|
169
|
+
* @template {string} [Text=never]
|
|
170
|
+
*/
|
|
171
|
+
export class DeleteOp<Children extends encoding.AnyEncodable | DeltaAny = never, Text extends string = never> extends list.ListNode {
|
|
112
172
|
/**
|
|
113
173
|
* @param {number} len
|
|
114
174
|
*/
|
|
115
175
|
constructor(len: number);
|
|
116
176
|
delete: number;
|
|
177
|
+
/**
|
|
178
|
+
* @type {(Children|Text) extends never ? null : (Delta<any,{},Children,Text>?)}
|
|
179
|
+
*/
|
|
180
|
+
prevValue: (Children | Text) extends never ? null : (Delta<any, {}, Children, Text> | null);
|
|
181
|
+
/**
|
|
182
|
+
* @type {string|null}
|
|
183
|
+
*/
|
|
184
|
+
_fingerprint: string | null;
|
|
117
185
|
/**
|
|
118
186
|
* @return {'delete'}
|
|
119
187
|
*/
|
|
120
188
|
get type(): "delete";
|
|
121
189
|
get length(): number;
|
|
190
|
+
get fingerprint(): string;
|
|
122
191
|
/**
|
|
123
192
|
* Remove a part of the operation (similar to Array.splice)
|
|
124
193
|
*
|
|
125
194
|
* @param {number} _offset
|
|
126
195
|
* @param {number} len
|
|
127
196
|
*/
|
|
128
|
-
_splice(_offset: number, len: number):
|
|
197
|
+
_splice(_offset: number, len: number): this;
|
|
129
198
|
/**
|
|
130
199
|
* @return {DeltaListOpJSON}
|
|
131
200
|
*/
|
|
132
201
|
toJSON(): DeltaListOpJSON;
|
|
133
|
-
clone(): DeleteOp
|
|
202
|
+
clone(start?: number, end?: number): DeleteOp<never, never>;
|
|
134
203
|
/**
|
|
135
204
|
* @param {DeleteOp} other
|
|
136
205
|
*/
|
|
@@ -143,26 +212,43 @@ export class RetainOp extends list.ListNode {
|
|
|
143
212
|
* @param {Attribution?} attribution
|
|
144
213
|
*/
|
|
145
214
|
constructor(retain: number, format: FormattingAttributes | null, attribution: Attribution | null);
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
215
|
+
/**
|
|
216
|
+
* @readonly
|
|
217
|
+
* @type {number}
|
|
218
|
+
*/
|
|
219
|
+
readonly retain: number;
|
|
220
|
+
/**
|
|
221
|
+
* @readonly
|
|
222
|
+
* @type {FormattingAttributes?}
|
|
223
|
+
*/
|
|
224
|
+
readonly format: FormattingAttributes | null;
|
|
225
|
+
/**
|
|
226
|
+
* @readonly
|
|
227
|
+
* @type {Attribution?}
|
|
228
|
+
*/
|
|
229
|
+
readonly attribution: Attribution | null;
|
|
230
|
+
/**
|
|
231
|
+
* @type {string|null}
|
|
232
|
+
*/
|
|
233
|
+
_fingerprint: string | null;
|
|
149
234
|
/**
|
|
150
235
|
* @return {'retain'}
|
|
151
236
|
*/
|
|
152
237
|
get type(): "retain";
|
|
153
238
|
get length(): number;
|
|
239
|
+
get fingerprint(): string;
|
|
154
240
|
/**
|
|
155
241
|
* Remove a part of the operation (similar to Array.splice)
|
|
156
242
|
*
|
|
157
243
|
* @param {number} _offset
|
|
158
244
|
* @param {number} len
|
|
159
245
|
*/
|
|
160
|
-
_splice(_offset: number, len: number):
|
|
246
|
+
_splice(_offset: number, len: number): this;
|
|
161
247
|
/**
|
|
162
248
|
* @return {DeltaListOpJSON}
|
|
163
249
|
*/
|
|
164
250
|
toJSON(): DeltaListOpJSON;
|
|
165
|
-
clone(): RetainOp;
|
|
251
|
+
clone(start?: number, end?: number): RetainOp;
|
|
166
252
|
/**
|
|
167
253
|
* @param {RetainOp} other
|
|
168
254
|
*/
|
|
@@ -171,30 +257,51 @@ export class RetainOp extends list.ListNode {
|
|
|
171
257
|
/**
|
|
172
258
|
* Delta that can be applied on a YType Embed
|
|
173
259
|
*
|
|
174
|
-
* @template {
|
|
260
|
+
* @template {DeltaAny} [DTypes=DeltaAny]
|
|
175
261
|
*/
|
|
176
|
-
export class ModifyOp<DTypes extends
|
|
262
|
+
export class ModifyOp<DTypes extends DeltaAny = DeltaAny> extends list.ListNode {
|
|
177
263
|
/**
|
|
178
264
|
* @param {DTypes} delta
|
|
179
265
|
* @param {FormattingAttributes|null} format
|
|
180
266
|
* @param {Attribution?} attribution
|
|
181
267
|
*/
|
|
182
268
|
constructor(delta: DTypes, format: FormattingAttributes | null, attribution: Attribution | null);
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
269
|
+
/**
|
|
270
|
+
* @readonly
|
|
271
|
+
* @type {DTypes}
|
|
272
|
+
*/
|
|
273
|
+
readonly value: DTypes;
|
|
274
|
+
/**
|
|
275
|
+
* @readonly
|
|
276
|
+
* @type {FormattingAttributes?}
|
|
277
|
+
*/
|
|
278
|
+
readonly format: FormattingAttributes | null;
|
|
279
|
+
/**
|
|
280
|
+
* @readonly
|
|
281
|
+
* @type {Attribution?}
|
|
282
|
+
*/
|
|
283
|
+
readonly attribution: Attribution | null;
|
|
284
|
+
/**
|
|
285
|
+
* @type {string|null}
|
|
286
|
+
*/
|
|
287
|
+
_fingerprint: string | null;
|
|
186
288
|
/**
|
|
187
289
|
* @return {'modify'}
|
|
188
290
|
*/
|
|
189
291
|
get type(): "modify";
|
|
190
292
|
get length(): number;
|
|
293
|
+
/**
|
|
294
|
+
* @type {DeltaBuilderAny}
|
|
295
|
+
*/
|
|
296
|
+
get _modValue(): DeltaBuilderAny;
|
|
297
|
+
get fingerprint(): string;
|
|
191
298
|
/**
|
|
192
299
|
* Remove a part of the operation (similar to Array.splice)
|
|
193
300
|
*
|
|
194
301
|
* @param {number} _offset
|
|
195
302
|
* @param {number} _len
|
|
196
303
|
*/
|
|
197
|
-
_splice(_offset: number, _len: number):
|
|
304
|
+
_splice(_offset: number, _len: number): this;
|
|
198
305
|
/**
|
|
199
306
|
* @return {DeltaListOpJSON}
|
|
200
307
|
*/
|
|
@@ -209,10 +316,10 @@ export class ModifyOp<DTypes extends Delta<any, any, any, any, any>> extends lis
|
|
|
209
316
|
[traits.EqualityTraitSymbol](other: ModifyOp<any>): boolean;
|
|
210
317
|
}
|
|
211
318
|
/**
|
|
212
|
-
* @template V
|
|
213
|
-
* @template {string|number
|
|
319
|
+
* @template {encoding.AnyEncodable|DeltaAny} V
|
|
320
|
+
* @template {string|number} [K=any]
|
|
214
321
|
*/
|
|
215
|
-
export class
|
|
322
|
+
export class AttrInsertOp<V extends encoding.AnyEncodable | DeltaAny, K extends string | number = any> {
|
|
216
323
|
/**
|
|
217
324
|
* @param {K} key
|
|
218
325
|
* @param {V} value
|
|
@@ -221,22 +328,38 @@ export class MapInsertOp<V, K extends string | number | symbol = any> {
|
|
|
221
328
|
*/
|
|
222
329
|
constructor(key: K, value: V, prevValue: V | undefined, attribution: Attribution | null);
|
|
223
330
|
/**
|
|
331
|
+
* @readonly
|
|
224
332
|
* @type {K}
|
|
225
333
|
*/
|
|
226
|
-
key: K;
|
|
334
|
+
readonly key: K;
|
|
227
335
|
/**
|
|
336
|
+
* @readonly
|
|
228
337
|
* @type {V}
|
|
229
338
|
*/
|
|
230
|
-
value: V;
|
|
339
|
+
readonly value: V;
|
|
231
340
|
/**
|
|
341
|
+
* @readonly
|
|
232
342
|
* @type {V|undefined}
|
|
233
343
|
*/
|
|
234
|
-
prevValue: V | undefined;
|
|
235
|
-
|
|
344
|
+
readonly prevValue: V | undefined;
|
|
345
|
+
/**
|
|
346
|
+
* @readonly
|
|
347
|
+
* @type {Attribution?}
|
|
348
|
+
*/
|
|
349
|
+
readonly attribution: Attribution | null;
|
|
350
|
+
/**
|
|
351
|
+
* @type {string|null}
|
|
352
|
+
*/
|
|
353
|
+
_fingerprint: string | null;
|
|
236
354
|
/**
|
|
237
355
|
* @return {'insert'}
|
|
238
356
|
*/
|
|
239
357
|
get type(): "insert";
|
|
358
|
+
/**
|
|
359
|
+
* @type {DeltaBuilderAny}
|
|
360
|
+
*/
|
|
361
|
+
get _modValue(): DeltaBuilderAny;
|
|
362
|
+
get fingerprint(): string;
|
|
240
363
|
toJSON(): {
|
|
241
364
|
type: "insert";
|
|
242
365
|
value: V | DeltaJSON;
|
|
@@ -245,24 +368,24 @@ export class MapInsertOp<V, K extends string | number | symbol = any> {
|
|
|
245
368
|
} | {
|
|
246
369
|
attribution?: undefined;
|
|
247
370
|
}) & ({
|
|
248
|
-
prevValue: V &
|
|
371
|
+
prevValue: V & {};
|
|
249
372
|
} | {
|
|
250
373
|
prevValue?: undefined;
|
|
251
374
|
}));
|
|
252
375
|
/**
|
|
253
|
-
* @return {
|
|
376
|
+
* @return {AttrInsertOp<V,K>}
|
|
254
377
|
*/
|
|
255
|
-
clone():
|
|
378
|
+
clone(): AttrInsertOp<V, K>;
|
|
256
379
|
/**
|
|
257
|
-
* @param {
|
|
380
|
+
* @param {AttrInsertOp<V>} other
|
|
258
381
|
*/
|
|
259
|
-
[traits.EqualityTraitSymbol](other:
|
|
382
|
+
[traits.EqualityTraitSymbol](other: AttrInsertOp<V>): boolean;
|
|
260
383
|
}
|
|
261
384
|
/**
|
|
262
385
|
* @template V
|
|
263
|
-
* @template [K=string]
|
|
386
|
+
* @template {string|number} [K=string]
|
|
264
387
|
*/
|
|
265
|
-
export class
|
|
388
|
+
export class AttrDeleteOp<V, K extends string | number = string> {
|
|
266
389
|
/**
|
|
267
390
|
* @param {K} key
|
|
268
391
|
* @param {V|undefined} prevValue
|
|
@@ -278,65 +401,81 @@ export class MapDeleteOp<V, K = string> {
|
|
|
278
401
|
*/
|
|
279
402
|
prevValue: V | undefined;
|
|
280
403
|
attribution: Attribution | null;
|
|
404
|
+
/**
|
|
405
|
+
* @type {string|null}
|
|
406
|
+
*/
|
|
407
|
+
_fingerprint: string | null;
|
|
281
408
|
get value(): undefined;
|
|
282
409
|
/**
|
|
283
410
|
* @type {'delete'}
|
|
284
411
|
*/
|
|
285
412
|
get type(): "delete";
|
|
413
|
+
get fingerprint(): string;
|
|
286
414
|
/**
|
|
287
415
|
* @return {DeltaAttrOpJSON}
|
|
288
416
|
*/
|
|
289
417
|
toJSON(): DeltaAttrOpJSON;
|
|
290
|
-
clone():
|
|
418
|
+
clone(): AttrDeleteOp<V, K>;
|
|
291
419
|
/**
|
|
292
|
-
* @param {
|
|
420
|
+
* @param {AttrDeleteOp<V>} other
|
|
293
421
|
*/
|
|
294
|
-
[traits.EqualityTraitSymbol](other:
|
|
422
|
+
[traits.EqualityTraitSymbol](other: AttrDeleteOp<V>): boolean;
|
|
295
423
|
}
|
|
296
424
|
/**
|
|
297
|
-
* @template {DeltaAny} Modifier
|
|
298
|
-
* @template [K=string]
|
|
425
|
+
* @template {DeltaAny} [Modifier=DeltaAny]
|
|
426
|
+
* @template {string|number} [K=string]
|
|
299
427
|
*/
|
|
300
|
-
export class
|
|
428
|
+
export class AttrModifyOp<Modifier extends DeltaAny = DeltaAny, K extends string | number = string> {
|
|
301
429
|
/**
|
|
302
430
|
* @param {K} key
|
|
303
431
|
* @param {Modifier} delta
|
|
304
432
|
*/
|
|
305
433
|
constructor(key: K, delta: Modifier);
|
|
306
434
|
/**
|
|
435
|
+
* @readonly
|
|
307
436
|
* @type {K}
|
|
308
437
|
*/
|
|
309
|
-
key: K;
|
|
438
|
+
readonly key: K;
|
|
310
439
|
/**
|
|
440
|
+
* @readonly
|
|
311
441
|
* @type {Modifier}
|
|
312
442
|
*/
|
|
313
|
-
value: Modifier;
|
|
443
|
+
readonly value: Modifier;
|
|
444
|
+
/**
|
|
445
|
+
* @type {string|null}
|
|
446
|
+
*/
|
|
447
|
+
_fingerprint: string | null;
|
|
314
448
|
/**
|
|
315
449
|
* @type {'modify'}
|
|
316
450
|
*/
|
|
317
451
|
get type(): "modify";
|
|
452
|
+
get fingerprint(): string;
|
|
453
|
+
/**
|
|
454
|
+
* @return {DeltaBuilder}
|
|
455
|
+
*/
|
|
456
|
+
get _modValue(): DeltaBuilder;
|
|
318
457
|
/**
|
|
319
458
|
* @return {DeltaAttrOpJSON}
|
|
320
459
|
*/
|
|
321
460
|
toJSON(): DeltaAttrOpJSON;
|
|
322
461
|
/**
|
|
323
|
-
* @return {
|
|
462
|
+
* @return {AttrModifyOp<Modifier,K>}
|
|
324
463
|
*/
|
|
325
|
-
clone():
|
|
464
|
+
clone(): AttrModifyOp<Modifier, K>;
|
|
326
465
|
/**
|
|
327
|
-
* @param {
|
|
466
|
+
* @param {AttrModifyOp<Modifier>} other
|
|
328
467
|
*/
|
|
329
|
-
[traits.EqualityTraitSymbol](other:
|
|
468
|
+
[traits.EqualityTraitSymbol](other: AttrModifyOp<Modifier>): boolean;
|
|
330
469
|
}
|
|
331
470
|
/**
|
|
332
|
-
* @type {s.Schema<
|
|
471
|
+
* @type {s.Schema<AttrDeleteOp<any> | DeleteOp>}
|
|
333
472
|
*/
|
|
334
|
-
export const $deleteOp: s.Schema<
|
|
473
|
+
export const $deleteOp: s.Schema<AttrDeleteOp<any> | DeleteOp>;
|
|
335
474
|
/**
|
|
336
|
-
* @type {s.Schema<
|
|
475
|
+
* @type {s.Schema<AttrInsertOp<any> | InsertOp<any>>}
|
|
337
476
|
*/
|
|
338
|
-
export const $insertOp: s.Schema<
|
|
339
|
-
export function $insertOpWith<Content>($content: s.Schema<Content>): s.Schema<
|
|
477
|
+
export const $insertOp: s.Schema<AttrInsertOp<any> | InsertOp<any>>;
|
|
478
|
+
export function $insertOpWith<Content extends encoding.AnyEncodable | DeltaAny>($content: s.Schema<Content>): s.Schema<AttrInsertOp<Content> | InsertOp<Content>>;
|
|
340
479
|
/**
|
|
341
480
|
* @type {s.Schema<TextOp>}
|
|
342
481
|
*/
|
|
@@ -346,24 +485,53 @@ export const $textOp: s.Schema<TextOp>;
|
|
|
346
485
|
*/
|
|
347
486
|
export const $retainOp: s.Schema<RetainOp>;
|
|
348
487
|
/**
|
|
349
|
-
* @type {s.Schema<
|
|
488
|
+
* @type {s.Schema<AttrModifyOp | ModifyOp>}
|
|
489
|
+
*/
|
|
490
|
+
export const $modifyOp: s.Schema<AttrModifyOp | ModifyOp>;
|
|
491
|
+
export function $modifyOpWith<Modify extends DeltaAny>($content: s.Schema<Modify>): s.Schema<AttrModifyOp<Modify> | ModifyOp<Modify>>;
|
|
492
|
+
export const $anyOp: s.Schema<AttrInsertOp<any, any> | InsertOp<any> | AttrDeleteOp<any, string> | DeleteOp<never, never> | TextOp | AttrModifyOp<DeltaAny, string> | ModifyOp<DeltaAny>>;
|
|
493
|
+
/**
|
|
494
|
+
* @template {Array<any>|string} C1
|
|
495
|
+
* @template {Array<any>|string} C2
|
|
496
|
+
* @typedef {Extract<C1 | C2, Array<any>> extends never
|
|
497
|
+
* ? never
|
|
498
|
+
* : (Array<(Extract<C1 | C2,Array<any>> extends Array<infer AC1> ? (unknown extends AC1 ? never : AC1) : never)>)} MergeListArrays
|
|
499
|
+
*/
|
|
500
|
+
/**
|
|
501
|
+
* @template {{[Key in string|number]: any}} Attrs
|
|
502
|
+
* @template {string|number} Key
|
|
503
|
+
* @template {any} Val
|
|
504
|
+
* @typedef {{ [K in (Key | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (Key extends K ? Val : never) }} AddToAttrs
|
|
505
|
+
*/
|
|
506
|
+
/**
|
|
507
|
+
* @template {{[Key in string|number|symbol]: any}} Attrs
|
|
508
|
+
* @template {{[Key in string|number|symbol]: any}} NewAttrs
|
|
509
|
+
* @typedef {{ [K in (keyof NewAttrs | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (unknown extends NewAttrs[K] ? never : NewAttrs[K]) }} MergeAttrs
|
|
510
|
+
*/
|
|
511
|
+
/**
|
|
512
|
+
* @template X
|
|
513
|
+
* @typedef {0 extends (1 & X) ? null : X} _AnyToNull
|
|
514
|
+
*/
|
|
515
|
+
/**
|
|
516
|
+
* @template {s.Schema<Delta<any,any,any,any,any>>|null} Schema
|
|
517
|
+
* @typedef {_AnyToNull<Schema> extends null ? Delta<any,{[key:string|number]:any},any,string> : (Schema extends s.Schema<infer D> ? D : never)} AllowedDeltaFromSchema
|
|
518
|
+
*/
|
|
519
|
+
/**
|
|
520
|
+
* @typedef {Delta<any,{ [k:string|number]: any },any,any,any>} DeltaAny
|
|
521
|
+
*/
|
|
522
|
+
/**
|
|
523
|
+
* @typedef {DeltaBuilder<any,{ [k:string|number]: any },any,any,any>} DeltaBuilderAny
|
|
350
524
|
*/
|
|
351
|
-
export const $modifyOp: s.Schema<MapModifyOp<any> | ModifyOp<any>>;
|
|
352
|
-
export function $modifyOpWith<Modify extends DeltaAny>($content: s.Schema<Modify>): s.Schema<MapModifyOp<Modify> | ModifyOp<Modify>>;
|
|
353
|
-
export const $anyOp: s.Schema<MapInsertOp<any, any> | InsertOp<any> | MapDeleteOp<any, string> | DeleteOp | TextOp | MapModifyOp<any, string> | ModifyOp<any>>;
|
|
354
|
-
export function forEachAttr<Attrs_1 extends {
|
|
355
|
-
[key: string | number | symbol]: any;
|
|
356
|
-
} = {}>(d: Delta<any, Attrs_1, any, any, any>, handler: (v: { [K in keyof Attrs_1]: MapInsertOp<Attrs_1[K], K> | MapDeleteOp<Attrs_1[K], K> | (Delta extends Attrs_1[K] ? MapModifyOp<Extract<Attrs_1[K], Delta>, K> : never); }[keyof Attrs_1]) => any): void;
|
|
357
525
|
/**
|
|
358
526
|
* @template {string} [NodeName=any]
|
|
359
|
-
* @template {{[
|
|
360
|
-
* @template {
|
|
527
|
+
* @template {{[k:string|number]:any}} [Attrs={}]
|
|
528
|
+
* @template {encoding.AnyEncodable|DeltaAny|never} [Children=never]
|
|
361
529
|
* @template {string|never} [Text=never]
|
|
362
530
|
* @template {s.Schema<Delta<any,any,any,any,any>>|null} [Schema=any]
|
|
363
531
|
*/
|
|
364
532
|
export class Delta<NodeName extends string = any, Attrs extends {
|
|
365
|
-
[
|
|
366
|
-
} = {}, Children extends
|
|
533
|
+
[k: string | number]: any;
|
|
534
|
+
} = {}, Children extends encoding.AnyEncodable | DeltaAny | never = never, Text extends string | never = never, Schema extends s.Schema<Delta<any, any, any, any, any>> | null = any> {
|
|
367
535
|
/**
|
|
368
536
|
* @param {NodeName} [name]
|
|
369
537
|
* @param {Schema} [$schema]
|
|
@@ -372,10 +540,12 @@ export class Delta<NodeName extends string = any, Attrs extends {
|
|
|
372
540
|
name: NodeName | null;
|
|
373
541
|
$schema: NonNullable<Schema> | null;
|
|
374
542
|
/**
|
|
375
|
-
* @type {{ [K in keyof Attrs]?:
|
|
543
|
+
* @type {{ [K in keyof Attrs]?: K extends string|number ? (AttrInsertOp<Attrs[K],K>|AttrDeleteOp<Attrs[K],K>|(Delta extends Attrs[K] ? AttrModifyOp<Extract<Attrs[K],DeltaAny>,K> : never)) : never }
|
|
544
|
+
* & { [Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]: K extends string|number ? (AttrInsertOp<Attrs[K],K>|AttrDeleteOp<Attrs[K],K>|(Delta extends Attrs[K] ? AttrModifyOp<Extract<Attrs[K],DeltaAny>,K> : never)) : never }[keyof Attrs]> }
|
|
545
|
+
* }
|
|
376
546
|
*/
|
|
377
|
-
attrs: { [K in keyof Attrs]?:
|
|
378
|
-
[Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]:
|
|
547
|
+
attrs: { [K in keyof Attrs]?: K extends string | number ? (AttrInsertOp<Attrs[K], K> | AttrDeleteOp<Attrs[K], K> | (Delta extends Attrs[K] ? AttrModifyOp<Extract<Attrs[K], DeltaAny>, K> : never)) : never; } & {
|
|
548
|
+
[Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]: K extends string | number ? (AttrInsertOp<Attrs[K], K> | AttrDeleteOp<Attrs[K], K> | (Delta extends Attrs[K] ? AttrModifyOp<Extract<Attrs[K], DeltaAny>, K> : never)) : never; }[keyof Attrs]>;
|
|
379
549
|
};
|
|
380
550
|
/**
|
|
381
551
|
* @type {list.List<
|
|
@@ -387,10 +557,20 @@ export class Delta<NodeName extends string = any, Attrs extends {
|
|
|
387
557
|
* >}
|
|
388
558
|
*/
|
|
389
559
|
children: list.List<RetainOp | DeleteOp | (Text extends never ? never : TextOp) | (Children extends never ? never : InsertOp<Children>) | (Delta extends Children ? ModifyOp<Extract<Children, Delta<any, any, any, any, any>>> : never)>;
|
|
560
|
+
childCnt: number;
|
|
390
561
|
/**
|
|
391
562
|
* @type {any}
|
|
392
563
|
*/
|
|
393
564
|
origin: any;
|
|
565
|
+
/**
|
|
566
|
+
* @type {string|null}
|
|
567
|
+
*/
|
|
568
|
+
_fingerprint: string | null;
|
|
569
|
+
isDone: boolean;
|
|
570
|
+
/**
|
|
571
|
+
* @type {string}
|
|
572
|
+
*/
|
|
573
|
+
get fingerprint(): string;
|
|
394
574
|
isEmpty(): boolean;
|
|
395
575
|
/**
|
|
396
576
|
* @return {DeltaJSON}
|
|
@@ -402,26 +582,37 @@ export class Delta<NodeName extends string = any, Attrs extends {
|
|
|
402
582
|
*/
|
|
403
583
|
equals(other: Delta<any, any, any, any, any>): boolean;
|
|
404
584
|
/**
|
|
405
|
-
* @
|
|
585
|
+
* @param {number} start
|
|
586
|
+
* @param {number} end
|
|
587
|
+
* @return {Delta<NodeName,Attrs,Children,Text,Schema>}
|
|
588
|
+
*/
|
|
589
|
+
slice(start?: number, end?: number): Delta<NodeName, Attrs, Children, Text, Schema>;
|
|
590
|
+
/**
|
|
591
|
+
* Mark this delta as done and perform some cleanup (e.g. remove appended retains without
|
|
592
|
+
* formats&attributions). In the future, there might be additional merge operations that can be
|
|
593
|
+
* performed to result in smaller deltas. Set `markAsDone=false` to only perform the cleanup.
|
|
594
|
+
*
|
|
595
|
+
* @return {Delta<NodeName,Attrs,Children,Text,Schema>}
|
|
406
596
|
*/
|
|
407
|
-
|
|
597
|
+
done(markAsDone?: boolean): Delta<NodeName, Attrs, Children, Text, Schema>;
|
|
408
598
|
/**
|
|
409
599
|
* @param {any} other
|
|
410
600
|
* @return {boolean}
|
|
411
601
|
*/
|
|
412
602
|
[traits.EqualityTraitSymbol](other: any): boolean;
|
|
413
603
|
}
|
|
604
|
+
export function clone<D extends DeltaAny>(d: D): D extends Delta<infer NodeName_1, infer Attrs_1, infer Children_1, infer Text, infer Schema_1> ? DeltaBuilder<NodeName_1, Attrs_1, Children_1, Text, Schema_1> : never;
|
|
414
605
|
/**
|
|
415
606
|
* @template {string} [NodeName=any]
|
|
416
|
-
* @template {{[key:string|number
|
|
417
|
-
* @template {
|
|
607
|
+
* @template {{[key:string|number]:any}} [Attrs={}]
|
|
608
|
+
* @template {encoding.AnyEncodable|DeltaAny|never} [Children=never]
|
|
418
609
|
* @template {string|never} [Text=never]
|
|
419
610
|
* @template {s.Schema<Delta<any,any,any,any,any>>|null} [Schema=any]
|
|
420
611
|
* @extends {Delta<NodeName,Attrs,Children,Text,Schema>}
|
|
421
612
|
*/
|
|
422
613
|
export class DeltaBuilder<NodeName extends string = any, Attrs extends {
|
|
423
|
-
[key: string | number
|
|
424
|
-
} = {}, Children extends
|
|
614
|
+
[key: string | number]: any;
|
|
615
|
+
} = {}, Children extends encoding.AnyEncodable | DeltaAny | never = never, Text extends string | never = never, Schema extends s.Schema<Delta<any, any, any, any, any>> | null = any> extends Delta<NodeName, Attrs, Children, Text, Schema> {
|
|
425
616
|
/**
|
|
426
617
|
* @type {FormattingAttributes?}
|
|
427
618
|
*/
|
|
@@ -459,11 +650,11 @@ export class DeltaBuilder<NodeName extends string = any, Attrs extends {
|
|
|
459
650
|
* NodeName,
|
|
460
651
|
* Attrs,
|
|
461
652
|
* Exclude<NewContent,string>[number]|Children,
|
|
462
|
-
* (Extract<NewContent,string>|Text) extends
|
|
653
|
+
* (Extract<NewContent,string>|Text) extends never ? never : string,
|
|
463
654
|
* Schema
|
|
464
655
|
* >}
|
|
465
656
|
*/
|
|
466
|
-
insert<NewContent extends AllowedDeltaFromSchema<Schema> extends Delta<any, any, infer Children_1, infer Text_1, infer Schema_1> ? ((Children_1 extends never ? never : Array<Children_1>) | Text_1) : never>(insert: NewContent, formatting?: FormattingAttributes | null, attribution?: Attribution | null): DeltaBuilder<NodeName, Attrs, Exclude<NewContent, string>[number] | Children, (Extract<NewContent, string> | Text) extends
|
|
657
|
+
insert<NewContent extends AllowedDeltaFromSchema<Schema> extends Delta<any, any, infer Children_1, infer Text_1, infer Schema_1> ? ((Children_1 extends never ? never : Array<Children_1>) | Text_1) : never>(insert: NewContent, formatting?: FormattingAttributes | null, attribution?: Attribution | null): DeltaBuilder<NodeName, Attrs, Exclude<NewContent, string>[number] | Children, (Extract<NewContent, string> | Text) extends never ? never : string, Schema>;
|
|
467
658
|
/**
|
|
468
659
|
* @template {AllowedDeltaFromSchema<Schema> extends Delta<any,any,infer Children,any,any> ? Extract<Children,Delta<any,any,any,any,any>> : never} NewContent
|
|
469
660
|
* @param {NewContent} modify
|
|
@@ -550,24 +741,29 @@ export class DeltaBuilder<NodeName extends string = any, Attrs extends {
|
|
|
550
741
|
*/
|
|
551
742
|
apply(other: Delta<NodeName, Attrs, Children, Text, any>): this;
|
|
552
743
|
/**
|
|
553
|
-
* @param {
|
|
744
|
+
* @param {DeltaAny} other
|
|
554
745
|
* @param {boolean} priority
|
|
555
746
|
*/
|
|
556
|
-
rebase(other:
|
|
747
|
+
rebase(other: DeltaAny, priority: boolean): this;
|
|
557
748
|
/**
|
|
558
|
-
*
|
|
749
|
+
* Same as doing `delta.rebase(other.inverse())`, without creating a temporary delta.
|
|
750
|
+
*
|
|
751
|
+
* @param {DeltaAny} other
|
|
752
|
+
* @param {boolean} priority
|
|
559
753
|
*/
|
|
560
|
-
|
|
754
|
+
rebaseOnInverse(other: DeltaAny, priority: boolean): this;
|
|
561
755
|
}
|
|
562
|
-
export function $delta<
|
|
563
|
-
[key: string | number
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
756
|
+
export function $delta<NodeNameSchema extends s.Schema<string> | string | Array<string> = s.Schema<any>, AttrsSchema extends s.Schema<{
|
|
757
|
+
[key: string | number]: any;
|
|
758
|
+
}> | {
|
|
759
|
+
[key: string | number]: any;
|
|
760
|
+
} = s.Schema<{}>, ChildrenSchema extends unknown = s.Schema<never>, HasText extends boolean = false, Recursive extends boolean = false>({ name, attrs, children, text, recursive }: {
|
|
761
|
+
name?: NodeNameSchema | null | undefined;
|
|
762
|
+
attrs?: AttrsSchema | null | undefined;
|
|
763
|
+
children?: ChildrenSchema | null | undefined;
|
|
764
|
+
text?: HasText | undefined;
|
|
569
765
|
recursive?: Recursive | undefined;
|
|
570
|
-
}): s.Schema<Delta<NodeName_1, Attrs_1, Children_1 | (Recursive extends true ? RecursiveDelta<NodeName_1, Attrs_1, Children_1, HasText extends true ? string : never> : never), HasText extends true ? string : never
|
|
766
|
+
}): [s.Unwrap<s.ReadSchema<NodeNameSchema>>, s.Unwrap<s.ReadSchema<AttrsSchema>>, s.Unwrap<s.ReadSchema<ChildrenSchema>>] extends [infer NodeName_1, infer Attrs_1, infer Children_1] ? s.Schema<Delta<NodeName_1, Attrs_1, Children_1 | (Recursive extends true ? RecursiveDelta<NodeName_1, Attrs_1, Children_1, HasText extends true ? string : never> : never), HasText extends true ? string : never>> : never;
|
|
571
767
|
/**
|
|
572
768
|
* @type {s.Schema<DeltaAny>}
|
|
573
769
|
*/
|
|
@@ -575,7 +771,7 @@ export const $deltaAny: s.Schema<DeltaAny>;
|
|
|
575
771
|
export function mergeAttrs<T extends {
|
|
576
772
|
[key: string]: any;
|
|
577
773
|
}>(a: T | null, b: T | null): T | null;
|
|
578
|
-
export function mergeDeltas<D extends
|
|
774
|
+
export function mergeDeltas<D extends DeltaAny | null>(a: D, b: D): D;
|
|
579
775
|
/**
|
|
580
776
|
* @overload
|
|
581
777
|
* @return {DeltaBuilder<any,{},never,never,null>}
|
|
@@ -606,8 +802,8 @@ export function create<NodeName extends string, Schema extends s.Schema<DeltaAny
|
|
|
606
802
|
export function create<Schema extends s.Schema<DeltaAny>>(schema: Schema): Schema extends s.Schema<Delta<infer N, infer Attrs_1, infer Children_1, infer Text, any>> ? DeltaBuilder<N, Attrs_1, Children_1, Text, Schema> : never;
|
|
607
803
|
/**
|
|
608
804
|
* @template {string|null} NodeName
|
|
609
|
-
* @template {{[k:string|number
|
|
610
|
-
* @template {Array<any>|string} Children
|
|
805
|
+
* @template {{[k:string|number]:any}|null} Attrs
|
|
806
|
+
* @template {Array<any>|string} [Children=never]
|
|
611
807
|
* @overload
|
|
612
808
|
* @param {NodeName} nodeName
|
|
613
809
|
* @param {Attrs} attrs
|
|
@@ -621,17 +817,18 @@ export function create<Schema extends s.Schema<DeltaAny>>(schema: Schema): Schem
|
|
|
621
817
|
* >}
|
|
622
818
|
*/
|
|
623
819
|
export function create<NodeName extends string, Attrs extends {
|
|
624
|
-
[k: string | number
|
|
625
|
-
} | null, Children extends Array<any> | string>(nodeName: NodeName, attrs: Attrs, children?: Children | undefined): DeltaBuilder<NodeName extends null ? any : NodeName, Attrs extends null ? {} : Attrs, Extract<Children, Array<any>> extends Array<infer Ac> ? (unknown extends Ac ? never : Ac) : never, Extract<Children, string>, null>;
|
|
820
|
+
[k: string | number]: any;
|
|
821
|
+
} | null, Children extends Array<any> | string = never>(nodeName: NodeName, attrs: Attrs, children?: Children | undefined): DeltaBuilder<NodeName extends null ? any : NodeName, Attrs extends null ? {} : Attrs, Extract<Children, Array<any>> extends Array<infer Ac> ? (unknown extends Ac ? never : Ac) : never, Extract<Children, string>, null>;
|
|
626
822
|
export function $text<$Embeds extends Array<s.Schema<any>> = any>(...$embeds: $Embeds): s.Schema<TextDelta<_AnyToNull<$Embeds> extends null ? never : ($Embeds extends Array<s.Schema<infer $C>> ? $C : never)>>;
|
|
627
823
|
export const $textOnly: s.Schema<TextDelta<unknown>>;
|
|
628
824
|
export function text<Schema_1 extends s.Schema<Delta<any, {}, any, any, null>> = s.Schema<Delta<any, {}, never, string, null>>>($schema?: Schema_1): Schema_1 extends s.Schema<Delta<infer N, infer Attrs_1, infer Children_1, infer Text, any>> ? DeltaBuilder<N, Attrs_1, Children_1, Text, Schema_1> : never;
|
|
629
|
-
export function $array<$Children extends
|
|
825
|
+
export function $array<$Children extends unknown>($children?: $Children): s.Schema<ArrayDelta<s.Unwrap<s.ReadSchema<$Children>>>>;
|
|
630
826
|
export function array<$Schema extends s.Schema<ArrayDelta<any>> = never>($schema: $Schema): $Schema extends never ? ArrayDeltaBuilder<never> : DeltaBuilder<any, {}, never, never, $Schema>;
|
|
631
827
|
export function $map<$Attrs extends {
|
|
632
|
-
[K: string | number
|
|
828
|
+
[K: string | number]: any;
|
|
633
829
|
}>($attrs: s.Schema<$Attrs>): s.Schema<MapDelta<$Attrs>>;
|
|
634
830
|
export function map<$Schema extends s.Schema<MapDelta<any>> | undefined = undefined>($schema?: $Schema): $Schema extends s.Schema<MapDelta<infer Attrs_1>> ? DeltaBuilder<any, Attrs_1, never, never, $Schema> : MapDeltaBuilder<{}>;
|
|
831
|
+
export function diff<D extends DeltaAny>(d1: D, d2: NoInfer<D>): D;
|
|
635
832
|
export type Attribution = {
|
|
636
833
|
insert?: string[];
|
|
637
834
|
insertAt?: number;
|
|
@@ -640,13 +837,14 @@ export type Attribution = {
|
|
|
640
837
|
format?: Record<string, string[]>;
|
|
641
838
|
formatAt?: number;
|
|
642
839
|
};
|
|
643
|
-
export type DeltaOps = s.Unwrap<s.Schema<
|
|
840
|
+
export type DeltaOps = s.Unwrap<s.Schema<AttrInsertOp<any, any> | InsertOp<any> | AttrDeleteOp<any, string> | DeleteOp<never, never> | TextOp | AttrModifyOp<DeltaAny, string> | ModifyOp<DeltaAny>>>;
|
|
644
841
|
export type FormattingAttributes = {
|
|
645
842
|
[key: string]: any;
|
|
646
843
|
};
|
|
647
844
|
export type DeltaJSON = {
|
|
845
|
+
type: "delta";
|
|
648
846
|
name?: string;
|
|
649
|
-
attrs?: { [Key in string | number
|
|
847
|
+
attrs?: { [Key in string | number]: DeltaAttrOpJSON; };
|
|
650
848
|
children?: Array<DeltaListOpJSON>;
|
|
651
849
|
};
|
|
652
850
|
export type DeltaListOpJSON = {
|
|
@@ -682,30 +880,38 @@ export type DeltaAttrOpJSON = {
|
|
|
682
880
|
type: "modify";
|
|
683
881
|
value: DeltaJSON;
|
|
684
882
|
};
|
|
883
|
+
export type ChildrenOpAny = TextOp | InsertOp<any> | DeleteOp | RetainOp | ModifyOp<any>;
|
|
884
|
+
export type AttrOpAny = AttrInsertOp<any> | AttrDeleteOp<any> | AttrModifyOp;
|
|
885
|
+
export type _OpAny = ChildrenOpAny | AttrOpAny;
|
|
886
|
+
export type Q = unknown & DeltaAny;
|
|
685
887
|
export type MergeListArrays<C1 extends Array<any> | string, C2 extends Array<any> | string> = Extract<C1 | C2, Array<any>> extends never ? never : (Array<(Extract<C1 | C2, Array<any>> extends Array<infer AC1> ? (unknown extends AC1 ? never : AC1) : never)>);
|
|
686
|
-
export type AddToAttrs<Attrs_1 extends { [Key in string | number
|
|
888
|
+
export type AddToAttrs<Attrs_1 extends { [Key in string | number]: any; }, Key extends string | number, Val extends unknown> = { [K in (Key | keyof Attrs_1)]: (unknown extends Attrs_1[K] ? never : Attrs_1[K]) | (Key extends K ? Val : never); };
|
|
687
889
|
export type MergeAttrs<Attrs_1 extends { [Key in string | number | symbol]: any; }, NewAttrs extends { [Key in string | number | symbol]: any; }> = { [K in (keyof NewAttrs | keyof Attrs_1)]: (unknown extends Attrs_1[K] ? never : Attrs_1[K]) | (unknown extends NewAttrs[K] ? never : NewAttrs[K]); };
|
|
688
890
|
export type _AnyToNull<X> = 0 extends (1 & X) ? null : X;
|
|
689
891
|
export type AllowedDeltaFromSchema<Schema_1 extends s.Schema<Delta<any, any, any, any, any>> | null> = _AnyToNull<Schema_1> extends null ? Delta<any, {
|
|
690
|
-
[key: string | number
|
|
892
|
+
[key: string | number]: any;
|
|
691
893
|
}, any, string> : (Schema_1 extends s.Schema<infer D> ? D : never);
|
|
692
894
|
export type DeltaAny = Delta<any, {
|
|
693
|
-
[k: string]: any;
|
|
895
|
+
[k: string | number]: any;
|
|
896
|
+
}, any, any, any>;
|
|
897
|
+
export type DeltaBuilderAny = DeltaBuilder<any, {
|
|
898
|
+
[k: string | number]: any;
|
|
694
899
|
}, any, any, any>;
|
|
695
900
|
export type RecursiveDelta<NodeName_1 extends string, Attrs_1 extends {
|
|
696
|
-
[key: string | number
|
|
697
|
-
} = {}, Children_1 extends
|
|
698
|
-
export type TextDelta<Embeds = never> = Delta<any, {}, Embeds, string>;
|
|
699
|
-
export type TextDeltaBuilder<Embeds = never> = DeltaBuilder<any, {}, Embeds, string>;
|
|
700
|
-
export type ArrayDelta<Children_1 extends
|
|
701
|
-
export type ArrayDeltaBuilder<Children_1 extends
|
|
901
|
+
[key: string | number]: any;
|
|
902
|
+
} = {}, Children_1 extends encoding.AnyEncodable | DeltaAny | never = never, Text extends string | never = never> = Delta<NodeName_1, Attrs_1, Children_1 | Delta<NodeName_1, Attrs_1, Children_1, Text> | RecursiveDelta<NodeName_1, Attrs_1, Children_1, Text>, Text>;
|
|
903
|
+
export type TextDelta<Embeds extends encoding.AnyEncodable | DeltaAny = never> = Delta<any, {}, Embeds, string>;
|
|
904
|
+
export type TextDeltaBuilder<Embeds extends encoding.AnyEncodable | DeltaAny = never> = DeltaBuilder<any, {}, Embeds, string>;
|
|
905
|
+
export type ArrayDelta<Children_1 extends encoding.AnyEncodable | DeltaAny> = Delta<any, {}, Children_1, never>;
|
|
906
|
+
export type ArrayDeltaBuilder<Children_1 extends encoding.AnyEncodable | DeltaAny> = DeltaBuilder<any, {}, Children_1, never>;
|
|
702
907
|
export type MapDelta<Attrs_1 extends {
|
|
703
|
-
[K: string | number
|
|
908
|
+
[K: string | number]: any;
|
|
704
909
|
}> = Delta<any, Attrs_1, never, never>;
|
|
705
910
|
export type MapDeltaBuilder<Attrs_1 extends {
|
|
706
|
-
[K: string | number
|
|
911
|
+
[K: string | number]: any;
|
|
707
912
|
}> = DeltaBuilder<any, Attrs_1, never, never>;
|
|
708
913
|
import * as s from '../schema.js';
|
|
709
914
|
import * as list from '../list.js';
|
|
710
915
|
import * as traits from '../traits.js';
|
|
916
|
+
import * as encoding from '../encoding.js';
|
|
711
917
|
//# sourceMappingURL=d2.d.ts.map
|