@jupyterlab/observables 2.1.1-alpha.0 → 2.1.1
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/lib/index.d.ts +6 -6
- package/lib/index.js +15 -15
- package/lib/modeldb.d.ts +427 -427
- package/lib/modeldb.js +294 -294
- package/lib/observablejson.d.ts +61 -61
- package/lib/observablejson.js +54 -54
- package/lib/observablelist.d.ts +504 -504
- package/lib/observablelist.js +384 -384
- package/lib/observablemap.d.ts +226 -226
- package/lib/observablemap.js +180 -180
- package/lib/observablestring.d.ts +147 -147
- package/lib/observablestring.js +109 -109
- package/lib/undoablelist.d.ts +132 -132
- package/lib/undoablelist.js +228 -228
- package/package.json +7 -4
package/lib/observablelist.d.ts
CHANGED
|
@@ -1,504 +1,504 @@
|
|
|
1
|
-
import { IIterator, IterableOrArrayLike } from '@phosphor/algorithm';
|
|
2
|
-
import { IDisposable } from '@phosphor/disposable';
|
|
3
|
-
import { ISignal } from '@phosphor/signaling';
|
|
4
|
-
/**
|
|
5
|
-
* A list which can be observed for changes.
|
|
6
|
-
*/
|
|
7
|
-
export interface IObservableList<T> extends IDisposable {
|
|
8
|
-
/**
|
|
9
|
-
* A signal emitted when the list has changed.
|
|
10
|
-
*/
|
|
11
|
-
readonly changed: ISignal<this, IObservableList.IChangedArgs<T>>;
|
|
12
|
-
/**
|
|
13
|
-
* The type of this object.
|
|
14
|
-
*/
|
|
15
|
-
readonly type: 'List';
|
|
16
|
-
/**
|
|
17
|
-
* The length of the list.
|
|
18
|
-
*
|
|
19
|
-
* #### Notes
|
|
20
|
-
* This is a read-only property.
|
|
21
|
-
*/
|
|
22
|
-
length: number;
|
|
23
|
-
/**
|
|
24
|
-
* Create an iterator over the values in the list.
|
|
25
|
-
*
|
|
26
|
-
* @returns A new iterator starting at the front of the list.
|
|
27
|
-
*
|
|
28
|
-
* #### Complexity
|
|
29
|
-
* Constant.
|
|
30
|
-
*
|
|
31
|
-
* #### Iterator Validity
|
|
32
|
-
* No changes.
|
|
33
|
-
*/
|
|
34
|
-
iter(): IIterator<T>;
|
|
35
|
-
/**
|
|
36
|
-
* Remove all values from the list.
|
|
37
|
-
*
|
|
38
|
-
* #### Complexity
|
|
39
|
-
* Linear.
|
|
40
|
-
*
|
|
41
|
-
* #### Iterator Validity
|
|
42
|
-
* All current iterators are invalidated.
|
|
43
|
-
*/
|
|
44
|
-
clear(): void;
|
|
45
|
-
/**
|
|
46
|
-
* Get the value at the specified index.
|
|
47
|
-
*
|
|
48
|
-
* @param index - The positive integer index of interest.
|
|
49
|
-
*
|
|
50
|
-
* @returns The value at the specified index.
|
|
51
|
-
*
|
|
52
|
-
* #### Undefined Behavior
|
|
53
|
-
* An `index` which is non-integral or out of range.
|
|
54
|
-
*/
|
|
55
|
-
get(index: number): T | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Insert a value into the list at a specific index.
|
|
58
|
-
*
|
|
59
|
-
* @param index - The index at which to insert the value.
|
|
60
|
-
*
|
|
61
|
-
* @param value - The value to set at the specified index.
|
|
62
|
-
*
|
|
63
|
-
* #### Complexity
|
|
64
|
-
* Linear.
|
|
65
|
-
*
|
|
66
|
-
* #### Iterator Validity
|
|
67
|
-
* No changes.
|
|
68
|
-
*
|
|
69
|
-
* #### Notes
|
|
70
|
-
* The `index` will be clamped to the bounds of the list.
|
|
71
|
-
*
|
|
72
|
-
* #### Undefined Behavior
|
|
73
|
-
* An `index` which is non-integral.
|
|
74
|
-
*/
|
|
75
|
-
insert(index: number, value: T): void;
|
|
76
|
-
/**
|
|
77
|
-
* Insert a set of items into the list at the specified index.
|
|
78
|
-
*
|
|
79
|
-
* @param index - The index at which to insert the values.
|
|
80
|
-
*
|
|
81
|
-
* @param values - The values to insert at the specified index.
|
|
82
|
-
*
|
|
83
|
-
* #### Complexity.
|
|
84
|
-
* Linear.
|
|
85
|
-
*
|
|
86
|
-
* #### Iterator Validity
|
|
87
|
-
* No changes.
|
|
88
|
-
*
|
|
89
|
-
* #### Notes
|
|
90
|
-
* The `index` will be clamped to the bounds of the list.
|
|
91
|
-
*
|
|
92
|
-
* #### Undefined Behavior.
|
|
93
|
-
* An `index` which is non-integral.
|
|
94
|
-
*/
|
|
95
|
-
insertAll(index: number, values: IterableOrArrayLike<T>): void;
|
|
96
|
-
/**
|
|
97
|
-
* Move a value from one index to another.
|
|
98
|
-
*
|
|
99
|
-
* @parm fromIndex - The index of the element to move.
|
|
100
|
-
*
|
|
101
|
-
* @param toIndex - The index to move the element to.
|
|
102
|
-
*
|
|
103
|
-
* #### Complexity
|
|
104
|
-
* Constant.
|
|
105
|
-
*
|
|
106
|
-
* #### Iterator Validity
|
|
107
|
-
* Iterators pointing at the lesser of the `fromIndex` and the `toIndex`
|
|
108
|
-
* and beyond are invalidated.
|
|
109
|
-
*
|
|
110
|
-
* #### Undefined Behavior
|
|
111
|
-
* A `fromIndex` or a `toIndex` which is non-integral.
|
|
112
|
-
*/
|
|
113
|
-
move(fromIndex: number, toIndex: number): void;
|
|
114
|
-
/**
|
|
115
|
-
* Add a value to the back of the list.
|
|
116
|
-
*
|
|
117
|
-
* @param value - The value to add to the back of the list.
|
|
118
|
-
*
|
|
119
|
-
* @returns The new length of the list.
|
|
120
|
-
*
|
|
121
|
-
* #### Complexity
|
|
122
|
-
* Constant.
|
|
123
|
-
*
|
|
124
|
-
* #### Iterator Validity
|
|
125
|
-
* No changes.
|
|
126
|
-
*/
|
|
127
|
-
push(value: T): number;
|
|
128
|
-
/**
|
|
129
|
-
* Push a set of values to the back of the list.
|
|
130
|
-
*
|
|
131
|
-
* @param values - An iterable or array-like set of values to add.
|
|
132
|
-
*
|
|
133
|
-
* @returns The new length of the list.
|
|
134
|
-
*
|
|
135
|
-
* #### Complexity
|
|
136
|
-
* Linear.
|
|
137
|
-
*
|
|
138
|
-
* #### Iterator Validity
|
|
139
|
-
* No changes.
|
|
140
|
-
*/
|
|
141
|
-
pushAll(values: IterableOrArrayLike<T>): number;
|
|
142
|
-
/**
|
|
143
|
-
* Remove and return the value at a specific index.
|
|
144
|
-
*
|
|
145
|
-
* @param index - The index of the value of interest.
|
|
146
|
-
*
|
|
147
|
-
* @returns The value at the specified index, or `undefined` if the
|
|
148
|
-
* index is out of range.
|
|
149
|
-
*
|
|
150
|
-
* #### Complexity
|
|
151
|
-
* Constant.
|
|
152
|
-
*
|
|
153
|
-
* #### Iterator Validity
|
|
154
|
-
* Iterators pointing at the removed value and beyond are invalidated.
|
|
155
|
-
*
|
|
156
|
-
* #### Undefined Behavior
|
|
157
|
-
* An `index` which is non-integral.
|
|
158
|
-
*/
|
|
159
|
-
remove(index: number): T | undefined;
|
|
160
|
-
/**
|
|
161
|
-
* Remove a range of items from the list.
|
|
162
|
-
*
|
|
163
|
-
* @param startIndex - The start index of the range to remove (inclusive).
|
|
164
|
-
*
|
|
165
|
-
* @param endIndex - The end index of the range to remove (exclusive).
|
|
166
|
-
*
|
|
167
|
-
* @returns The new length of the list.
|
|
168
|
-
*
|
|
169
|
-
* #### Complexity
|
|
170
|
-
* Linear.
|
|
171
|
-
*
|
|
172
|
-
* #### Iterator Validity
|
|
173
|
-
* Iterators pointing to the first removed value and beyond are invalid.
|
|
174
|
-
*
|
|
175
|
-
* #### Undefined Behavior
|
|
176
|
-
* A `startIndex` or `endIndex` which is non-integral.
|
|
177
|
-
*/
|
|
178
|
-
removeRange(startIndex: number, endIndex: number): number;
|
|
179
|
-
/**
|
|
180
|
-
* Remove the first occurrence of a value from the list.
|
|
181
|
-
*
|
|
182
|
-
* @param value - The value of interest.
|
|
183
|
-
*
|
|
184
|
-
* @returns The index of the removed value, or `-1` if the value
|
|
185
|
-
* is not contained in the list.
|
|
186
|
-
*
|
|
187
|
-
* #### Complexity
|
|
188
|
-
* Linear.
|
|
189
|
-
*
|
|
190
|
-
* #### Iterator Validity
|
|
191
|
-
* Iterators pointing at the removed value and beyond are invalidated.
|
|
192
|
-
*/
|
|
193
|
-
removeValue(value: T): number;
|
|
194
|
-
/**
|
|
195
|
-
* Set the value at the specified index.
|
|
196
|
-
*
|
|
197
|
-
* @param index - The positive integer index of interest.
|
|
198
|
-
*
|
|
199
|
-
* @param value - The value to set at the specified index.
|
|
200
|
-
*
|
|
201
|
-
* #### Complexity
|
|
202
|
-
* Constant.
|
|
203
|
-
*
|
|
204
|
-
* #### Iterator Validity
|
|
205
|
-
* No changes.
|
|
206
|
-
*
|
|
207
|
-
* #### Undefined Behavior
|
|
208
|
-
* An `index` which is non-integral or out of range.
|
|
209
|
-
*/
|
|
210
|
-
set(index: number, value: T): void;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* The namespace for IObservableList related interfaces.
|
|
214
|
-
*/
|
|
215
|
-
export declare namespace IObservableList {
|
|
216
|
-
/**
|
|
217
|
-
* The change types which occur on an observable list.
|
|
218
|
-
*/
|
|
219
|
-
type ChangeType = 'add'
|
|
220
|
-
/**
|
|
221
|
-
* An item was moved within the list.
|
|
222
|
-
*/
|
|
223
|
-
| 'move'
|
|
224
|
-
/**
|
|
225
|
-
* Item(s) were removed from the list.
|
|
226
|
-
*/
|
|
227
|
-
| 'remove'
|
|
228
|
-
/**
|
|
229
|
-
* An item was set in the list.
|
|
230
|
-
*/
|
|
231
|
-
| 'set';
|
|
232
|
-
/**
|
|
233
|
-
* The changed args object which is emitted by an observable list.
|
|
234
|
-
*/
|
|
235
|
-
interface IChangedArgs<T> {
|
|
236
|
-
/**
|
|
237
|
-
* The type of change undergone by the vector.
|
|
238
|
-
*/
|
|
239
|
-
type: ChangeType;
|
|
240
|
-
/**
|
|
241
|
-
* The new index associated with the change.
|
|
242
|
-
*/
|
|
243
|
-
newIndex: number;
|
|
244
|
-
/**
|
|
245
|
-
* The new values associated with the change.
|
|
246
|
-
*
|
|
247
|
-
* #### Notes
|
|
248
|
-
* The values will be contiguous starting at the `newIndex`.
|
|
249
|
-
*/
|
|
250
|
-
newValues: T[];
|
|
251
|
-
/**
|
|
252
|
-
* The old index associated with the change.
|
|
253
|
-
*/
|
|
254
|
-
oldIndex: number;
|
|
255
|
-
/**
|
|
256
|
-
* The old values associated with the change.
|
|
257
|
-
*
|
|
258
|
-
* #### Notes
|
|
259
|
-
* The values will be contiguous starting at the `oldIndex`.
|
|
260
|
-
*/
|
|
261
|
-
oldValues: T[];
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* A concrete implementation of [[IObservableList]].
|
|
266
|
-
*/
|
|
267
|
-
export declare class ObservableList<T> implements IObservableList<T> {
|
|
268
|
-
/**
|
|
269
|
-
* Construct a new observable map.
|
|
270
|
-
*/
|
|
271
|
-
constructor(options?: ObservableList.IOptions<T>);
|
|
272
|
-
/**
|
|
273
|
-
* The type of this object.
|
|
274
|
-
*/
|
|
275
|
-
readonly type: 'List';
|
|
276
|
-
/**
|
|
277
|
-
* A signal emitted when the list has changed.
|
|
278
|
-
*/
|
|
279
|
-
readonly changed: ISignal<this, IObservableList.IChangedArgs<T>>;
|
|
280
|
-
/**
|
|
281
|
-
* The length of the list.
|
|
282
|
-
*/
|
|
283
|
-
readonly length: number;
|
|
284
|
-
/**
|
|
285
|
-
* Test whether the list has been disposed.
|
|
286
|
-
*/
|
|
287
|
-
readonly isDisposed: boolean;
|
|
288
|
-
/**
|
|
289
|
-
* Dispose of the resources held by the list.
|
|
290
|
-
*/
|
|
291
|
-
dispose(): void;
|
|
292
|
-
/**
|
|
293
|
-
* Create an iterator over the values in the list.
|
|
294
|
-
*
|
|
295
|
-
* @returns A new iterator starting at the front of the list.
|
|
296
|
-
*
|
|
297
|
-
* #### Complexity
|
|
298
|
-
* Constant.
|
|
299
|
-
*
|
|
300
|
-
* #### Iterator Validity
|
|
301
|
-
* No changes.
|
|
302
|
-
*/
|
|
303
|
-
iter(): IIterator<T>;
|
|
304
|
-
/**
|
|
305
|
-
* Get the value at the specified index.
|
|
306
|
-
*
|
|
307
|
-
* @param index - The positive integer index of interest.
|
|
308
|
-
*
|
|
309
|
-
* @returns The value at the specified index.
|
|
310
|
-
*
|
|
311
|
-
* #### Undefined Behavior
|
|
312
|
-
* An `index` which is non-integral or out of range.
|
|
313
|
-
*/
|
|
314
|
-
get(index: number): T | undefined;
|
|
315
|
-
/**
|
|
316
|
-
* Set the value at the specified index.
|
|
317
|
-
*
|
|
318
|
-
* @param index - The positive integer index of interest.
|
|
319
|
-
*
|
|
320
|
-
* @param value - The value to set at the specified index.
|
|
321
|
-
*
|
|
322
|
-
* #### Complexity
|
|
323
|
-
* Constant.
|
|
324
|
-
*
|
|
325
|
-
* #### Iterator Validity
|
|
326
|
-
* No changes.
|
|
327
|
-
*
|
|
328
|
-
* #### Undefined Behavior
|
|
329
|
-
* An `index` which is non-integral or out of range.
|
|
330
|
-
*/
|
|
331
|
-
set(index: number, value: T): void;
|
|
332
|
-
/**
|
|
333
|
-
* Add a value to the end of the list.
|
|
334
|
-
*
|
|
335
|
-
* @param value - The value to add to the end of the list.
|
|
336
|
-
*
|
|
337
|
-
* @returns The new length of the list.
|
|
338
|
-
*
|
|
339
|
-
* #### Complexity
|
|
340
|
-
* Constant.
|
|
341
|
-
*
|
|
342
|
-
* #### Iterator Validity
|
|
343
|
-
* No changes.
|
|
344
|
-
*/
|
|
345
|
-
push(value: T): number;
|
|
346
|
-
/**
|
|
347
|
-
* Insert a value into the list at a specific index.
|
|
348
|
-
*
|
|
349
|
-
* @param index - The index at which to insert the value.
|
|
350
|
-
*
|
|
351
|
-
* @param value - The value to set at the specified index.
|
|
352
|
-
*
|
|
353
|
-
* #### Complexity
|
|
354
|
-
* Linear.
|
|
355
|
-
*
|
|
356
|
-
* #### Iterator Validity
|
|
357
|
-
* No changes.
|
|
358
|
-
*
|
|
359
|
-
* #### Notes
|
|
360
|
-
* The `index` will be clamped to the bounds of the list.
|
|
361
|
-
*
|
|
362
|
-
* #### Undefined Behavior
|
|
363
|
-
* An `index` which is non-integral.
|
|
364
|
-
*/
|
|
365
|
-
insert(index: number, value: T): void;
|
|
366
|
-
/**
|
|
367
|
-
* Remove the first occurrence of a value from the list.
|
|
368
|
-
*
|
|
369
|
-
* @param value - The value of interest.
|
|
370
|
-
*
|
|
371
|
-
* @returns The index of the removed value, or `-1` if the value
|
|
372
|
-
* is not contained in the list.
|
|
373
|
-
*
|
|
374
|
-
* #### Complexity
|
|
375
|
-
* Linear.
|
|
376
|
-
*
|
|
377
|
-
* #### Iterator Validity
|
|
378
|
-
* Iterators pointing at the removed value and beyond are invalidated.
|
|
379
|
-
*/
|
|
380
|
-
removeValue(value: T): number;
|
|
381
|
-
/**
|
|
382
|
-
* Remove and return the value at a specific index.
|
|
383
|
-
*
|
|
384
|
-
* @param index - The index of the value of interest.
|
|
385
|
-
*
|
|
386
|
-
* @returns The value at the specified index, or `undefined` if the
|
|
387
|
-
* index is out of range.
|
|
388
|
-
*
|
|
389
|
-
* #### Complexity
|
|
390
|
-
* Constant.
|
|
391
|
-
*
|
|
392
|
-
* #### Iterator Validity
|
|
393
|
-
* Iterators pointing at the removed value and beyond are invalidated.
|
|
394
|
-
*
|
|
395
|
-
* #### Undefined Behavior
|
|
396
|
-
* An `index` which is non-integral.
|
|
397
|
-
*/
|
|
398
|
-
remove(index: number): T | undefined;
|
|
399
|
-
/**
|
|
400
|
-
* Remove all values from the list.
|
|
401
|
-
*
|
|
402
|
-
* #### Complexity
|
|
403
|
-
* Linear.
|
|
404
|
-
*
|
|
405
|
-
* #### Iterator Validity
|
|
406
|
-
* All current iterators are invalidated.
|
|
407
|
-
*/
|
|
408
|
-
clear(): void;
|
|
409
|
-
/**
|
|
410
|
-
* Move a value from one index to another.
|
|
411
|
-
*
|
|
412
|
-
* @parm fromIndex - The index of the element to move.
|
|
413
|
-
*
|
|
414
|
-
* @param toIndex - The index to move the element to.
|
|
415
|
-
*
|
|
416
|
-
* #### Complexity
|
|
417
|
-
* Constant.
|
|
418
|
-
*
|
|
419
|
-
* #### Iterator Validity
|
|
420
|
-
* Iterators pointing at the lesser of the `fromIndex` and the `toIndex`
|
|
421
|
-
* and beyond are invalidated.
|
|
422
|
-
*
|
|
423
|
-
* #### Undefined Behavior
|
|
424
|
-
* A `fromIndex` or a `toIndex` which is non-integral.
|
|
425
|
-
*/
|
|
426
|
-
move(fromIndex: number, toIndex: number): void;
|
|
427
|
-
/**
|
|
428
|
-
* Push a set of values to the back of the list.
|
|
429
|
-
*
|
|
430
|
-
* @param values - An iterable or array-like set of values to add.
|
|
431
|
-
*
|
|
432
|
-
* @returns The new length of the list.
|
|
433
|
-
*
|
|
434
|
-
* #### Complexity
|
|
435
|
-
* Linear.
|
|
436
|
-
*
|
|
437
|
-
* #### Iterator Validity
|
|
438
|
-
* No changes.
|
|
439
|
-
*/
|
|
440
|
-
pushAll(values: IterableOrArrayLike<T>): number;
|
|
441
|
-
/**
|
|
442
|
-
* Insert a set of items into the list at the specified index.
|
|
443
|
-
*
|
|
444
|
-
* @param index - The index at which to insert the values.
|
|
445
|
-
*
|
|
446
|
-
* @param values - The values to insert at the specified index.
|
|
447
|
-
*
|
|
448
|
-
* #### Complexity.
|
|
449
|
-
* Linear.
|
|
450
|
-
*
|
|
451
|
-
* #### Iterator Validity
|
|
452
|
-
* No changes.
|
|
453
|
-
*
|
|
454
|
-
* #### Notes
|
|
455
|
-
* The `index` will be clamped to the bounds of the list.
|
|
456
|
-
*
|
|
457
|
-
* #### Undefined Behavior.
|
|
458
|
-
* An `index` which is non-integral.
|
|
459
|
-
*/
|
|
460
|
-
insertAll(index: number, values: IterableOrArrayLike<T>): void;
|
|
461
|
-
/**
|
|
462
|
-
* Remove a range of items from the list.
|
|
463
|
-
*
|
|
464
|
-
* @param startIndex - The start index of the range to remove (inclusive).
|
|
465
|
-
*
|
|
466
|
-
* @param endIndex - The end index of the range to remove (exclusive).
|
|
467
|
-
*
|
|
468
|
-
* @returns The new length of the list.
|
|
469
|
-
*
|
|
470
|
-
* #### Complexity
|
|
471
|
-
* Linear.
|
|
472
|
-
*
|
|
473
|
-
* #### Iterator Validity
|
|
474
|
-
* Iterators pointing to the first removed value and beyond are invalid.
|
|
475
|
-
*
|
|
476
|
-
* #### Undefined Behavior
|
|
477
|
-
* A `startIndex` or `endIndex` which is non-integral.
|
|
478
|
-
*/
|
|
479
|
-
removeRange(startIndex: number, endIndex: number): number;
|
|
480
|
-
private _array;
|
|
481
|
-
private _isDisposed;
|
|
482
|
-
private _itemCmp;
|
|
483
|
-
private _changed;
|
|
484
|
-
}
|
|
485
|
-
/**
|
|
486
|
-
* The namespace for `ObservableList` class statics.
|
|
487
|
-
*/
|
|
488
|
-
export declare namespace ObservableList {
|
|
489
|
-
/**
|
|
490
|
-
* The options used to initialize an observable map.
|
|
491
|
-
*/
|
|
492
|
-
interface IOptions<T> {
|
|
493
|
-
/**
|
|
494
|
-
* An optional initial set of values.
|
|
495
|
-
*/
|
|
496
|
-
values?: IterableOrArrayLike<T>;
|
|
497
|
-
/**
|
|
498
|
-
* The item comparison function for change detection on `set`.
|
|
499
|
-
*
|
|
500
|
-
* If not given, strict `===` equality will be used.
|
|
501
|
-
*/
|
|
502
|
-
itemCmp?: (first: T, second: T) => boolean;
|
|
503
|
-
}
|
|
504
|
-
}
|
|
1
|
+
import { IIterator, IterableOrArrayLike } from '@phosphor/algorithm';
|
|
2
|
+
import { IDisposable } from '@phosphor/disposable';
|
|
3
|
+
import { ISignal } from '@phosphor/signaling';
|
|
4
|
+
/**
|
|
5
|
+
* A list which can be observed for changes.
|
|
6
|
+
*/
|
|
7
|
+
export interface IObservableList<T> extends IDisposable {
|
|
8
|
+
/**
|
|
9
|
+
* A signal emitted when the list has changed.
|
|
10
|
+
*/
|
|
11
|
+
readonly changed: ISignal<this, IObservableList.IChangedArgs<T>>;
|
|
12
|
+
/**
|
|
13
|
+
* The type of this object.
|
|
14
|
+
*/
|
|
15
|
+
readonly type: 'List';
|
|
16
|
+
/**
|
|
17
|
+
* The length of the list.
|
|
18
|
+
*
|
|
19
|
+
* #### Notes
|
|
20
|
+
* This is a read-only property.
|
|
21
|
+
*/
|
|
22
|
+
length: number;
|
|
23
|
+
/**
|
|
24
|
+
* Create an iterator over the values in the list.
|
|
25
|
+
*
|
|
26
|
+
* @returns A new iterator starting at the front of the list.
|
|
27
|
+
*
|
|
28
|
+
* #### Complexity
|
|
29
|
+
* Constant.
|
|
30
|
+
*
|
|
31
|
+
* #### Iterator Validity
|
|
32
|
+
* No changes.
|
|
33
|
+
*/
|
|
34
|
+
iter(): IIterator<T>;
|
|
35
|
+
/**
|
|
36
|
+
* Remove all values from the list.
|
|
37
|
+
*
|
|
38
|
+
* #### Complexity
|
|
39
|
+
* Linear.
|
|
40
|
+
*
|
|
41
|
+
* #### Iterator Validity
|
|
42
|
+
* All current iterators are invalidated.
|
|
43
|
+
*/
|
|
44
|
+
clear(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Get the value at the specified index.
|
|
47
|
+
*
|
|
48
|
+
* @param index - The positive integer index of interest.
|
|
49
|
+
*
|
|
50
|
+
* @returns The value at the specified index.
|
|
51
|
+
*
|
|
52
|
+
* #### Undefined Behavior
|
|
53
|
+
* An `index` which is non-integral or out of range.
|
|
54
|
+
*/
|
|
55
|
+
get(index: number): T | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Insert a value into the list at a specific index.
|
|
58
|
+
*
|
|
59
|
+
* @param index - The index at which to insert the value.
|
|
60
|
+
*
|
|
61
|
+
* @param value - The value to set at the specified index.
|
|
62
|
+
*
|
|
63
|
+
* #### Complexity
|
|
64
|
+
* Linear.
|
|
65
|
+
*
|
|
66
|
+
* #### Iterator Validity
|
|
67
|
+
* No changes.
|
|
68
|
+
*
|
|
69
|
+
* #### Notes
|
|
70
|
+
* The `index` will be clamped to the bounds of the list.
|
|
71
|
+
*
|
|
72
|
+
* #### Undefined Behavior
|
|
73
|
+
* An `index` which is non-integral.
|
|
74
|
+
*/
|
|
75
|
+
insert(index: number, value: T): void;
|
|
76
|
+
/**
|
|
77
|
+
* Insert a set of items into the list at the specified index.
|
|
78
|
+
*
|
|
79
|
+
* @param index - The index at which to insert the values.
|
|
80
|
+
*
|
|
81
|
+
* @param values - The values to insert at the specified index.
|
|
82
|
+
*
|
|
83
|
+
* #### Complexity.
|
|
84
|
+
* Linear.
|
|
85
|
+
*
|
|
86
|
+
* #### Iterator Validity
|
|
87
|
+
* No changes.
|
|
88
|
+
*
|
|
89
|
+
* #### Notes
|
|
90
|
+
* The `index` will be clamped to the bounds of the list.
|
|
91
|
+
*
|
|
92
|
+
* #### Undefined Behavior.
|
|
93
|
+
* An `index` which is non-integral.
|
|
94
|
+
*/
|
|
95
|
+
insertAll(index: number, values: IterableOrArrayLike<T>): void;
|
|
96
|
+
/**
|
|
97
|
+
* Move a value from one index to another.
|
|
98
|
+
*
|
|
99
|
+
* @parm fromIndex - The index of the element to move.
|
|
100
|
+
*
|
|
101
|
+
* @param toIndex - The index to move the element to.
|
|
102
|
+
*
|
|
103
|
+
* #### Complexity
|
|
104
|
+
* Constant.
|
|
105
|
+
*
|
|
106
|
+
* #### Iterator Validity
|
|
107
|
+
* Iterators pointing at the lesser of the `fromIndex` and the `toIndex`
|
|
108
|
+
* and beyond are invalidated.
|
|
109
|
+
*
|
|
110
|
+
* #### Undefined Behavior
|
|
111
|
+
* A `fromIndex` or a `toIndex` which is non-integral.
|
|
112
|
+
*/
|
|
113
|
+
move(fromIndex: number, toIndex: number): void;
|
|
114
|
+
/**
|
|
115
|
+
* Add a value to the back of the list.
|
|
116
|
+
*
|
|
117
|
+
* @param value - The value to add to the back of the list.
|
|
118
|
+
*
|
|
119
|
+
* @returns The new length of the list.
|
|
120
|
+
*
|
|
121
|
+
* #### Complexity
|
|
122
|
+
* Constant.
|
|
123
|
+
*
|
|
124
|
+
* #### Iterator Validity
|
|
125
|
+
* No changes.
|
|
126
|
+
*/
|
|
127
|
+
push(value: T): number;
|
|
128
|
+
/**
|
|
129
|
+
* Push a set of values to the back of the list.
|
|
130
|
+
*
|
|
131
|
+
* @param values - An iterable or array-like set of values to add.
|
|
132
|
+
*
|
|
133
|
+
* @returns The new length of the list.
|
|
134
|
+
*
|
|
135
|
+
* #### Complexity
|
|
136
|
+
* Linear.
|
|
137
|
+
*
|
|
138
|
+
* #### Iterator Validity
|
|
139
|
+
* No changes.
|
|
140
|
+
*/
|
|
141
|
+
pushAll(values: IterableOrArrayLike<T>): number;
|
|
142
|
+
/**
|
|
143
|
+
* Remove and return the value at a specific index.
|
|
144
|
+
*
|
|
145
|
+
* @param index - The index of the value of interest.
|
|
146
|
+
*
|
|
147
|
+
* @returns The value at the specified index, or `undefined` if the
|
|
148
|
+
* index is out of range.
|
|
149
|
+
*
|
|
150
|
+
* #### Complexity
|
|
151
|
+
* Constant.
|
|
152
|
+
*
|
|
153
|
+
* #### Iterator Validity
|
|
154
|
+
* Iterators pointing at the removed value and beyond are invalidated.
|
|
155
|
+
*
|
|
156
|
+
* #### Undefined Behavior
|
|
157
|
+
* An `index` which is non-integral.
|
|
158
|
+
*/
|
|
159
|
+
remove(index: number): T | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* Remove a range of items from the list.
|
|
162
|
+
*
|
|
163
|
+
* @param startIndex - The start index of the range to remove (inclusive).
|
|
164
|
+
*
|
|
165
|
+
* @param endIndex - The end index of the range to remove (exclusive).
|
|
166
|
+
*
|
|
167
|
+
* @returns The new length of the list.
|
|
168
|
+
*
|
|
169
|
+
* #### Complexity
|
|
170
|
+
* Linear.
|
|
171
|
+
*
|
|
172
|
+
* #### Iterator Validity
|
|
173
|
+
* Iterators pointing to the first removed value and beyond are invalid.
|
|
174
|
+
*
|
|
175
|
+
* #### Undefined Behavior
|
|
176
|
+
* A `startIndex` or `endIndex` which is non-integral.
|
|
177
|
+
*/
|
|
178
|
+
removeRange(startIndex: number, endIndex: number): number;
|
|
179
|
+
/**
|
|
180
|
+
* Remove the first occurrence of a value from the list.
|
|
181
|
+
*
|
|
182
|
+
* @param value - The value of interest.
|
|
183
|
+
*
|
|
184
|
+
* @returns The index of the removed value, or `-1` if the value
|
|
185
|
+
* is not contained in the list.
|
|
186
|
+
*
|
|
187
|
+
* #### Complexity
|
|
188
|
+
* Linear.
|
|
189
|
+
*
|
|
190
|
+
* #### Iterator Validity
|
|
191
|
+
* Iterators pointing at the removed value and beyond are invalidated.
|
|
192
|
+
*/
|
|
193
|
+
removeValue(value: T): number;
|
|
194
|
+
/**
|
|
195
|
+
* Set the value at the specified index.
|
|
196
|
+
*
|
|
197
|
+
* @param index - The positive integer index of interest.
|
|
198
|
+
*
|
|
199
|
+
* @param value - The value to set at the specified index.
|
|
200
|
+
*
|
|
201
|
+
* #### Complexity
|
|
202
|
+
* Constant.
|
|
203
|
+
*
|
|
204
|
+
* #### Iterator Validity
|
|
205
|
+
* No changes.
|
|
206
|
+
*
|
|
207
|
+
* #### Undefined Behavior
|
|
208
|
+
* An `index` which is non-integral or out of range.
|
|
209
|
+
*/
|
|
210
|
+
set(index: number, value: T): void;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* The namespace for IObservableList related interfaces.
|
|
214
|
+
*/
|
|
215
|
+
export declare namespace IObservableList {
|
|
216
|
+
/**
|
|
217
|
+
* The change types which occur on an observable list.
|
|
218
|
+
*/
|
|
219
|
+
type ChangeType = 'add'
|
|
220
|
+
/**
|
|
221
|
+
* An item was moved within the list.
|
|
222
|
+
*/
|
|
223
|
+
| 'move'
|
|
224
|
+
/**
|
|
225
|
+
* Item(s) were removed from the list.
|
|
226
|
+
*/
|
|
227
|
+
| 'remove'
|
|
228
|
+
/**
|
|
229
|
+
* An item was set in the list.
|
|
230
|
+
*/
|
|
231
|
+
| 'set';
|
|
232
|
+
/**
|
|
233
|
+
* The changed args object which is emitted by an observable list.
|
|
234
|
+
*/
|
|
235
|
+
interface IChangedArgs<T> {
|
|
236
|
+
/**
|
|
237
|
+
* The type of change undergone by the vector.
|
|
238
|
+
*/
|
|
239
|
+
type: ChangeType;
|
|
240
|
+
/**
|
|
241
|
+
* The new index associated with the change.
|
|
242
|
+
*/
|
|
243
|
+
newIndex: number;
|
|
244
|
+
/**
|
|
245
|
+
* The new values associated with the change.
|
|
246
|
+
*
|
|
247
|
+
* #### Notes
|
|
248
|
+
* The values will be contiguous starting at the `newIndex`.
|
|
249
|
+
*/
|
|
250
|
+
newValues: T[];
|
|
251
|
+
/**
|
|
252
|
+
* The old index associated with the change.
|
|
253
|
+
*/
|
|
254
|
+
oldIndex: number;
|
|
255
|
+
/**
|
|
256
|
+
* The old values associated with the change.
|
|
257
|
+
*
|
|
258
|
+
* #### Notes
|
|
259
|
+
* The values will be contiguous starting at the `oldIndex`.
|
|
260
|
+
*/
|
|
261
|
+
oldValues: T[];
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* A concrete implementation of [[IObservableList]].
|
|
266
|
+
*/
|
|
267
|
+
export declare class ObservableList<T> implements IObservableList<T> {
|
|
268
|
+
/**
|
|
269
|
+
* Construct a new observable map.
|
|
270
|
+
*/
|
|
271
|
+
constructor(options?: ObservableList.IOptions<T>);
|
|
272
|
+
/**
|
|
273
|
+
* The type of this object.
|
|
274
|
+
*/
|
|
275
|
+
readonly type: 'List';
|
|
276
|
+
/**
|
|
277
|
+
* A signal emitted when the list has changed.
|
|
278
|
+
*/
|
|
279
|
+
readonly changed: ISignal<this, IObservableList.IChangedArgs<T>>;
|
|
280
|
+
/**
|
|
281
|
+
* The length of the list.
|
|
282
|
+
*/
|
|
283
|
+
readonly length: number;
|
|
284
|
+
/**
|
|
285
|
+
* Test whether the list has been disposed.
|
|
286
|
+
*/
|
|
287
|
+
readonly isDisposed: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Dispose of the resources held by the list.
|
|
290
|
+
*/
|
|
291
|
+
dispose(): void;
|
|
292
|
+
/**
|
|
293
|
+
* Create an iterator over the values in the list.
|
|
294
|
+
*
|
|
295
|
+
* @returns A new iterator starting at the front of the list.
|
|
296
|
+
*
|
|
297
|
+
* #### Complexity
|
|
298
|
+
* Constant.
|
|
299
|
+
*
|
|
300
|
+
* #### Iterator Validity
|
|
301
|
+
* No changes.
|
|
302
|
+
*/
|
|
303
|
+
iter(): IIterator<T>;
|
|
304
|
+
/**
|
|
305
|
+
* Get the value at the specified index.
|
|
306
|
+
*
|
|
307
|
+
* @param index - The positive integer index of interest.
|
|
308
|
+
*
|
|
309
|
+
* @returns The value at the specified index.
|
|
310
|
+
*
|
|
311
|
+
* #### Undefined Behavior
|
|
312
|
+
* An `index` which is non-integral or out of range.
|
|
313
|
+
*/
|
|
314
|
+
get(index: number): T | undefined;
|
|
315
|
+
/**
|
|
316
|
+
* Set the value at the specified index.
|
|
317
|
+
*
|
|
318
|
+
* @param index - The positive integer index of interest.
|
|
319
|
+
*
|
|
320
|
+
* @param value - The value to set at the specified index.
|
|
321
|
+
*
|
|
322
|
+
* #### Complexity
|
|
323
|
+
* Constant.
|
|
324
|
+
*
|
|
325
|
+
* #### Iterator Validity
|
|
326
|
+
* No changes.
|
|
327
|
+
*
|
|
328
|
+
* #### Undefined Behavior
|
|
329
|
+
* An `index` which is non-integral or out of range.
|
|
330
|
+
*/
|
|
331
|
+
set(index: number, value: T): void;
|
|
332
|
+
/**
|
|
333
|
+
* Add a value to the end of the list.
|
|
334
|
+
*
|
|
335
|
+
* @param value - The value to add to the end of the list.
|
|
336
|
+
*
|
|
337
|
+
* @returns The new length of the list.
|
|
338
|
+
*
|
|
339
|
+
* #### Complexity
|
|
340
|
+
* Constant.
|
|
341
|
+
*
|
|
342
|
+
* #### Iterator Validity
|
|
343
|
+
* No changes.
|
|
344
|
+
*/
|
|
345
|
+
push(value: T): number;
|
|
346
|
+
/**
|
|
347
|
+
* Insert a value into the list at a specific index.
|
|
348
|
+
*
|
|
349
|
+
* @param index - The index at which to insert the value.
|
|
350
|
+
*
|
|
351
|
+
* @param value - The value to set at the specified index.
|
|
352
|
+
*
|
|
353
|
+
* #### Complexity
|
|
354
|
+
* Linear.
|
|
355
|
+
*
|
|
356
|
+
* #### Iterator Validity
|
|
357
|
+
* No changes.
|
|
358
|
+
*
|
|
359
|
+
* #### Notes
|
|
360
|
+
* The `index` will be clamped to the bounds of the list.
|
|
361
|
+
*
|
|
362
|
+
* #### Undefined Behavior
|
|
363
|
+
* An `index` which is non-integral.
|
|
364
|
+
*/
|
|
365
|
+
insert(index: number, value: T): void;
|
|
366
|
+
/**
|
|
367
|
+
* Remove the first occurrence of a value from the list.
|
|
368
|
+
*
|
|
369
|
+
* @param value - The value of interest.
|
|
370
|
+
*
|
|
371
|
+
* @returns The index of the removed value, or `-1` if the value
|
|
372
|
+
* is not contained in the list.
|
|
373
|
+
*
|
|
374
|
+
* #### Complexity
|
|
375
|
+
* Linear.
|
|
376
|
+
*
|
|
377
|
+
* #### Iterator Validity
|
|
378
|
+
* Iterators pointing at the removed value and beyond are invalidated.
|
|
379
|
+
*/
|
|
380
|
+
removeValue(value: T): number;
|
|
381
|
+
/**
|
|
382
|
+
* Remove and return the value at a specific index.
|
|
383
|
+
*
|
|
384
|
+
* @param index - The index of the value of interest.
|
|
385
|
+
*
|
|
386
|
+
* @returns The value at the specified index, or `undefined` if the
|
|
387
|
+
* index is out of range.
|
|
388
|
+
*
|
|
389
|
+
* #### Complexity
|
|
390
|
+
* Constant.
|
|
391
|
+
*
|
|
392
|
+
* #### Iterator Validity
|
|
393
|
+
* Iterators pointing at the removed value and beyond are invalidated.
|
|
394
|
+
*
|
|
395
|
+
* #### Undefined Behavior
|
|
396
|
+
* An `index` which is non-integral.
|
|
397
|
+
*/
|
|
398
|
+
remove(index: number): T | undefined;
|
|
399
|
+
/**
|
|
400
|
+
* Remove all values from the list.
|
|
401
|
+
*
|
|
402
|
+
* #### Complexity
|
|
403
|
+
* Linear.
|
|
404
|
+
*
|
|
405
|
+
* #### Iterator Validity
|
|
406
|
+
* All current iterators are invalidated.
|
|
407
|
+
*/
|
|
408
|
+
clear(): void;
|
|
409
|
+
/**
|
|
410
|
+
* Move a value from one index to another.
|
|
411
|
+
*
|
|
412
|
+
* @parm fromIndex - The index of the element to move.
|
|
413
|
+
*
|
|
414
|
+
* @param toIndex - The index to move the element to.
|
|
415
|
+
*
|
|
416
|
+
* #### Complexity
|
|
417
|
+
* Constant.
|
|
418
|
+
*
|
|
419
|
+
* #### Iterator Validity
|
|
420
|
+
* Iterators pointing at the lesser of the `fromIndex` and the `toIndex`
|
|
421
|
+
* and beyond are invalidated.
|
|
422
|
+
*
|
|
423
|
+
* #### Undefined Behavior
|
|
424
|
+
* A `fromIndex` or a `toIndex` which is non-integral.
|
|
425
|
+
*/
|
|
426
|
+
move(fromIndex: number, toIndex: number): void;
|
|
427
|
+
/**
|
|
428
|
+
* Push a set of values to the back of the list.
|
|
429
|
+
*
|
|
430
|
+
* @param values - An iterable or array-like set of values to add.
|
|
431
|
+
*
|
|
432
|
+
* @returns The new length of the list.
|
|
433
|
+
*
|
|
434
|
+
* #### Complexity
|
|
435
|
+
* Linear.
|
|
436
|
+
*
|
|
437
|
+
* #### Iterator Validity
|
|
438
|
+
* No changes.
|
|
439
|
+
*/
|
|
440
|
+
pushAll(values: IterableOrArrayLike<T>): number;
|
|
441
|
+
/**
|
|
442
|
+
* Insert a set of items into the list at the specified index.
|
|
443
|
+
*
|
|
444
|
+
* @param index - The index at which to insert the values.
|
|
445
|
+
*
|
|
446
|
+
* @param values - The values to insert at the specified index.
|
|
447
|
+
*
|
|
448
|
+
* #### Complexity.
|
|
449
|
+
* Linear.
|
|
450
|
+
*
|
|
451
|
+
* #### Iterator Validity
|
|
452
|
+
* No changes.
|
|
453
|
+
*
|
|
454
|
+
* #### Notes
|
|
455
|
+
* The `index` will be clamped to the bounds of the list.
|
|
456
|
+
*
|
|
457
|
+
* #### Undefined Behavior.
|
|
458
|
+
* An `index` which is non-integral.
|
|
459
|
+
*/
|
|
460
|
+
insertAll(index: number, values: IterableOrArrayLike<T>): void;
|
|
461
|
+
/**
|
|
462
|
+
* Remove a range of items from the list.
|
|
463
|
+
*
|
|
464
|
+
* @param startIndex - The start index of the range to remove (inclusive).
|
|
465
|
+
*
|
|
466
|
+
* @param endIndex - The end index of the range to remove (exclusive).
|
|
467
|
+
*
|
|
468
|
+
* @returns The new length of the list.
|
|
469
|
+
*
|
|
470
|
+
* #### Complexity
|
|
471
|
+
* Linear.
|
|
472
|
+
*
|
|
473
|
+
* #### Iterator Validity
|
|
474
|
+
* Iterators pointing to the first removed value and beyond are invalid.
|
|
475
|
+
*
|
|
476
|
+
* #### Undefined Behavior
|
|
477
|
+
* A `startIndex` or `endIndex` which is non-integral.
|
|
478
|
+
*/
|
|
479
|
+
removeRange(startIndex: number, endIndex: number): number;
|
|
480
|
+
private _array;
|
|
481
|
+
private _isDisposed;
|
|
482
|
+
private _itemCmp;
|
|
483
|
+
private _changed;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* The namespace for `ObservableList` class statics.
|
|
487
|
+
*/
|
|
488
|
+
export declare namespace ObservableList {
|
|
489
|
+
/**
|
|
490
|
+
* The options used to initialize an observable map.
|
|
491
|
+
*/
|
|
492
|
+
interface IOptions<T> {
|
|
493
|
+
/**
|
|
494
|
+
* An optional initial set of values.
|
|
495
|
+
*/
|
|
496
|
+
values?: IterableOrArrayLike<T>;
|
|
497
|
+
/**
|
|
498
|
+
* The item comparison function for change detection on `set`.
|
|
499
|
+
*
|
|
500
|
+
* If not given, strict `===` equality will be used.
|
|
501
|
+
*/
|
|
502
|
+
itemCmp?: (first: T, second: T) => boolean;
|
|
503
|
+
}
|
|
504
|
+
}
|