@procedures/collections 0.47.1 → 0.47.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -8
- package/README.md +2 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +1 -59
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -95
- package/dist/index.js.map +1 -1
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/memory.d.ts +1 -1
- package/dist/storage/memory.d.ts.map +1 -1
- package/dist/storage/memory.js +1 -1
- package/dist/storage/memory.js.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/storage-contract.js +1 -1
- package/dist/testing/storage-contract.js.map +1 -1
- package/dist/undo/index.d.ts +1 -1
- package/dist/undo/index.js +1 -1
- package/dist/undo/undo-log.d.ts +1 -1
- package/dist/undo/undo-log.js +1 -1
- package/package.json +4 -4
- package/src/index.ts +338 -214
- package/src/storage/index.ts +2 -2
- package/src/storage/memory.ts +1 -1
- package/src/testing/index.ts +1 -1
- package/src/testing/storage-contract.ts +1 -1
- package/src/undo/index.ts +1 -1
- package/src/undo/undo-log.ts +1 -1
- package/dist/async/async-queue.d.ts +0 -170
- package/dist/async/async-queue.d.ts.map +0 -1
- package/dist/async/async-queue.js +0 -404
- package/dist/async/async-queue.js.map +0 -1
- package/dist/async/channels.d.ts +0 -211
- package/dist/async/channels.d.ts.map +0 -1
- package/dist/async/channels.js +0 -393
- package/dist/async/channels.js.map +0 -1
- package/dist/async/settled.d.ts +0 -23
- package/dist/async/settled.d.ts.map +0 -1
- package/dist/async/settled.js +0 -32
- package/dist/async/settled.js.map +0 -1
- package/dist/behaviors/bounded.d.ts +0 -79
- package/dist/behaviors/bounded.d.ts.map +0 -1
- package/dist/behaviors/bounded.js +0 -393
- package/dist/behaviors/bounded.js.map +0 -1
- package/dist/behaviors/composite.d.ts +0 -17
- package/dist/behaviors/composite.d.ts.map +0 -1
- package/dist/behaviors/composite.js +0 -93
- package/dist/behaviors/composite.js.map +0 -1
- package/dist/behaviors/evented.d.ts +0 -154
- package/dist/behaviors/evented.d.ts.map +0 -1
- package/dist/behaviors/evented.js +0 -299
- package/dist/behaviors/evented.js.map +0 -1
- package/dist/behaviors/lru.d.ts +0 -84
- package/dist/behaviors/lru.d.ts.map +0 -1
- package/dist/behaviors/lru.js +0 -376
- package/dist/behaviors/lru.js.map +0 -1
- package/dist/behaviors/readonly.d.ts +0 -73
- package/dist/behaviors/readonly.d.ts.map +0 -1
- package/dist/behaviors/readonly.js +0 -189
- package/dist/behaviors/readonly.js.map +0 -1
- package/dist/behaviors/safe.d.ts +0 -163
- package/dist/behaviors/safe.d.ts.map +0 -1
- package/dist/behaviors/safe.js +0 -176
- package/dist/behaviors/safe.js.map +0 -1
- package/dist/behaviors/synchronized.d.ts +0 -88
- package/dist/behaviors/synchronized.d.ts.map +0 -1
- package/dist/behaviors/synchronized.js +0 -285
- package/dist/behaviors/synchronized.js.map +0 -1
- package/dist/behaviors/ttl.d.ts +0 -118
- package/dist/behaviors/ttl.d.ts.map +0 -1
- package/dist/behaviors/ttl.js +0 -354
- package/dist/behaviors/ttl.js.map +0 -1
- package/dist/contracts/model.d.ts +0 -29
- package/dist/contracts/model.d.ts.map +0 -1
- package/dist/contracts/model.js +0 -26
- package/dist/contracts/model.js.map +0 -1
- package/dist/core/effects.d.ts +0 -176
- package/dist/core/effects.d.ts.map +0 -1
- package/dist/core/effects.js +0 -180
- package/dist/core/effects.js.map +0 -1
- package/dist/core/events.d.ts +0 -192
- package/dist/core/events.d.ts.map +0 -1
- package/dist/core/events.js +0 -291
- package/dist/core/events.js.map +0 -1
- package/dist/core/middleware.d.ts +0 -231
- package/dist/core/middleware.d.ts.map +0 -1
- package/dist/core/middleware.js +0 -161
- package/dist/core/middleware.js.map +0 -1
- package/dist/core/policies.d.ts +0 -220
- package/dist/core/policies.d.ts.map +0 -1
- package/dist/core/policies.js +0 -48
- package/dist/core/policies.js.map +0 -1
- package/dist/core/traits.d.ts +0 -142
- package/dist/core/traits.d.ts.map +0 -1
- package/dist/core/traits.js +0 -8
- package/dist/core/traits.js.map +0 -1
- package/dist/fx/collectors.d.ts +0 -193
- package/dist/fx/collectors.d.ts.map +0 -1
- package/dist/fx/collectors.js +0 -375
- package/dist/fx/collectors.js.map +0 -1
- package/dist/fx/iter.d.ts +0 -166
- package/dist/fx/iter.d.ts.map +0 -1
- package/dist/fx/iter.js +0 -421
- package/dist/fx/iter.js.map +0 -1
- package/dist/impl/array-deque.d.ts +0 -112
- package/dist/impl/array-deque.d.ts.map +0 -1
- package/dist/impl/array-deque.js +0 -380
- package/dist/impl/array-deque.js.map +0 -1
- package/dist/impl/array-list.d.ts +0 -101
- package/dist/impl/array-list.d.ts.map +0 -1
- package/dist/impl/array-list.js +0 -387
- package/dist/impl/array-list.js.map +0 -1
- package/dist/impl/hash-map.d.ts +0 -149
- package/dist/impl/hash-map.d.ts.map +0 -1
- package/dist/impl/hash-map.js +0 -473
- package/dist/impl/hash-map.js.map +0 -1
- package/dist/impl/hash-set.d.ts +0 -125
- package/dist/impl/hash-set.d.ts.map +0 -1
- package/dist/impl/hash-set.js +0 -264
- package/dist/impl/hash-set.js.map +0 -1
- package/dist/impl/linked-hash-map.d.ts +0 -141
- package/dist/impl/linked-hash-map.d.ts.map +0 -1
- package/dist/impl/linked-hash-map.js +0 -442
- package/dist/impl/linked-hash-map.js.map +0 -1
- package/dist/impl/linked-list.d.ts +0 -109
- package/dist/impl/linked-list.d.ts.map +0 -1
- package/dist/impl/linked-list.js +0 -494
- package/dist/impl/linked-list.js.map +0 -1
- package/dist/impl/priority-queue.d.ts +0 -139
- package/dist/impl/priority-queue.d.ts.map +0 -1
- package/dist/impl/priority-queue.js +0 -343
- package/dist/impl/priority-queue.js.map +0 -1
- package/dist/impl/summary-tree.d.ts +0 -146
- package/dist/impl/summary-tree.d.ts.map +0 -1
- package/dist/impl/summary-tree.js +0 -524
- package/dist/impl/summary-tree.js.map +0 -1
- package/dist/impl/tree-map.d.ts +0 -153
- package/dist/impl/tree-map.d.ts.map +0 -1
- package/dist/impl/tree-map.js +0 -788
- package/dist/impl/tree-map.js.map +0 -1
- package/dist/impl/tree-set.d.ts +0 -112
- package/dist/impl/tree-set.d.ts.map +0 -1
- package/dist/impl/tree-set.js +0 -374
- package/dist/impl/tree-set.js.map +0 -1
- package/dist/interfaces/collection.d.ts +0 -119
- package/dist/interfaces/collection.d.ts.map +0 -1
- package/dist/interfaces/collection.js +0 -8
- package/dist/interfaces/collection.js.map +0 -1
- package/dist/interfaces/list.d.ts +0 -247
- package/dist/interfaces/list.d.ts.map +0 -1
- package/dist/interfaces/list.js +0 -8
- package/dist/interfaces/list.js.map +0 -1
- package/dist/interfaces/map.d.ts +0 -344
- package/dist/interfaces/map.d.ts.map +0 -1
- package/dist/interfaces/map.js +0 -8
- package/dist/interfaces/map.js.map +0 -1
- package/dist/interfaces/queue.d.ts +0 -304
- package/dist/interfaces/queue.d.ts.map +0 -1
- package/dist/interfaces/queue.js +0 -8
- package/dist/interfaces/queue.js.map +0 -1
- package/dist/interfaces/set.d.ts +0 -137
- package/dist/interfaces/set.d.ts.map +0 -1
- package/dist/interfaces/set.js +0 -8
- package/dist/interfaces/set.js.map +0 -1
- package/dist/order/index.d.ts +0 -7
- package/dist/order/index.d.ts.map +0 -1
- package/dist/order/index.js +0 -7
- package/dist/order/index.js.map +0 -1
- package/dist/order/rank.d.ts +0 -100
- package/dist/order/rank.d.ts.map +0 -1
- package/dist/order/rank.js +0 -286
- package/dist/order/rank.js.map +0 -1
- package/dist/storage/listeners.d.ts +0 -39
- package/dist/storage/listeners.d.ts.map +0 -1
- package/dist/storage/listeners.js +0 -65
- package/dist/storage/listeners.js.map +0 -1
- package/dist/testing/check.d.ts +0 -25
- package/dist/testing/check.d.ts.map +0 -1
- package/dist/testing/check.js +0 -85
- package/dist/testing/check.js.map +0 -1
- package/dist/utils/defaults.d.ts +0 -135
- package/dist/utils/defaults.d.ts.map +0 -1
- package/dist/utils/defaults.js +0 -322
- package/dist/utils/defaults.js.map +0 -1
- package/dist/utils/factories.d.ts +0 -144
- package/dist/utils/factories.d.ts.map +0 -1
- package/dist/utils/factories.js +0 -293
- package/dist/utils/factories.js.map +0 -1
- package/dist/utils/helpers.d.ts +0 -137
- package/dist/utils/helpers.d.ts.map +0 -1
- package/dist/utils/helpers.js +0 -221
- package/dist/utils/helpers.js.map +0 -1
- package/src/async/async-queue.ts +0 -481
- package/src/async/channels.ts +0 -450
- package/src/async/settled.ts +0 -41
- package/src/behaviors/bounded.ts +0 -485
- package/src/behaviors/composite.ts +0 -99
- package/src/behaviors/evented.ts +0 -464
- package/src/behaviors/lru.ts +0 -447
- package/src/behaviors/readonly.ts +0 -236
- package/src/behaviors/safe.ts +0 -372
- package/src/behaviors/synchronized.ts +0 -316
- package/src/behaviors/ttl.ts +0 -462
- package/src/contracts/model.ts +0 -44
- package/src/core/effects.ts +0 -323
- package/src/core/events.ts +0 -356
- package/src/core/middleware.ts +0 -415
- package/src/core/policies.ts +0 -316
- package/src/core/traits.ts +0 -164
- package/src/fx/collectors.ts +0 -500
- package/src/fx/iter.ts +0 -536
- package/src/impl/array-deque.ts +0 -463
- package/src/impl/array-list.ts +0 -490
- package/src/impl/hash-map.ts +0 -623
- package/src/impl/hash-set.ts +0 -342
- package/src/impl/linked-hash-map.ts +0 -572
- package/src/impl/linked-list.ts +0 -606
- package/src/impl/priority-queue.ts +0 -448
- package/src/impl/summary-tree.ts +0 -586
- package/src/impl/tree-map.ts +0 -912
- package/src/impl/tree-set.ts +0 -469
- package/src/interfaces/collection.ts +0 -141
- package/src/interfaces/list.ts +0 -281
- package/src/interfaces/map.ts +0 -405
- package/src/interfaces/queue.ts +0 -353
- package/src/interfaces/set.ts +0 -158
- package/src/order/index.ts +0 -6
- package/src/order/rank.ts +0 -271
- package/src/storage/listeners.ts +0 -72
- package/src/testing/check.ts +0 -81
- package/src/utils/defaults.ts +0 -345
- package/src/utils/factories.ts +0 -357
- package/src/utils/helpers.ts +0 -248
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Queue and Deque interfaces that mirror Java's Queue and Deque.
|
|
3
|
-
*
|
|
4
|
-
* Queues are collections designed for holding elements prior to processing.
|
|
5
|
-
* Deques (double-ended queues) allow efficient insertion/removal at both ends.
|
|
6
|
-
*/
|
|
7
|
-
import type { Collection, ReadonlyCollection } from "./collection.js";
|
|
8
|
-
import type { Compare } from "../core/traits.js";
|
|
9
|
-
/**
|
|
10
|
-
* ReadonlyQueue<T> - Readonly FIFO (First-In-First-Out) queue.
|
|
11
|
-
*
|
|
12
|
-
* Provides read-only access to queue operations.
|
|
13
|
-
*/
|
|
14
|
-
export interface ReadonlyQueue<T> extends ReadonlyCollection<T> {
|
|
15
|
-
/**
|
|
16
|
-
* Retrieves, but does not remove, the head of this queue.
|
|
17
|
-
*
|
|
18
|
-
* @returns The head element
|
|
19
|
-
* @throws Error if queue is empty
|
|
20
|
-
*/
|
|
21
|
-
peek(): T;
|
|
22
|
-
/**
|
|
23
|
-
* Returns the head element without throwing if empty.
|
|
24
|
-
* Returns undefined if queue is empty.
|
|
25
|
-
*/
|
|
26
|
-
peekOrUndefined(): T | undefined;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Queue<T> - FIFO (First-In-First-Out) queue.
|
|
30
|
-
*
|
|
31
|
-
* Mirrors java.util.Queue.
|
|
32
|
-
* Elements are processed in the order they were added.
|
|
33
|
-
*/
|
|
34
|
-
export interface Queue<T> extends ReadonlyQueue<T>, Collection<T> {
|
|
35
|
-
/**
|
|
36
|
-
* Inserts an element into the queue.
|
|
37
|
-
* For bounded queues with overflow='throw', throws if queue is full.
|
|
38
|
-
*
|
|
39
|
-
* @param element The element to add
|
|
40
|
-
* @returns true if element was added
|
|
41
|
-
* @throws Error if queue is full (bounded with throw policy)
|
|
42
|
-
*/
|
|
43
|
-
offer(element: T): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Retrieves and removes the head of this queue.
|
|
46
|
-
*
|
|
47
|
-
* @returns The head element
|
|
48
|
-
* @throws Error if queue is empty
|
|
49
|
-
*/
|
|
50
|
-
poll(): T;
|
|
51
|
-
/**
|
|
52
|
-
* Retrieves and removes the head of this queue, or returns undefined if empty.
|
|
53
|
-
*/
|
|
54
|
-
pollOrUndefined(): T | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* Alias for offer(). Adds element to end of queue.
|
|
57
|
-
* Included for consistency with standard queue terminology.
|
|
58
|
-
*/
|
|
59
|
-
enqueue(element: T): boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Alias for poll(). Removes and returns element from front of queue.
|
|
62
|
-
* Included for consistency with standard queue terminology.
|
|
63
|
-
*/
|
|
64
|
-
dequeue(): T;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Deque<T> - Double-ended queue.
|
|
68
|
-
*
|
|
69
|
-
* Mirrors java.util.Deque.
|
|
70
|
-
* Supports insertion and removal at both ends.
|
|
71
|
-
* Can be used as a queue (FIFO) or stack (LIFO).
|
|
72
|
-
*/
|
|
73
|
-
export interface Deque<T> extends Queue<T> {
|
|
74
|
-
/**
|
|
75
|
-
* Inserts element at the front of this deque.
|
|
76
|
-
*
|
|
77
|
-
* @param element The element to add
|
|
78
|
-
* @throws Error if deque is full (bounded with throw policy)
|
|
79
|
-
*/
|
|
80
|
-
addFirst(element: T): void;
|
|
81
|
-
/**
|
|
82
|
-
* Inserts element at the front, returning false if full.
|
|
83
|
-
*/
|
|
84
|
-
offerFirst(element: T): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Retrieves and removes the first element.
|
|
87
|
-
*
|
|
88
|
-
* @throws Error if deque is empty
|
|
89
|
-
*/
|
|
90
|
-
removeFirst(): T;
|
|
91
|
-
/**
|
|
92
|
-
* Retrieves and removes the first element, or undefined if empty.
|
|
93
|
-
*/
|
|
94
|
-
pollFirst(): T | undefined;
|
|
95
|
-
/**
|
|
96
|
-
* Retrieves but does not remove the first element.
|
|
97
|
-
*
|
|
98
|
-
* @throws Error if deque is empty
|
|
99
|
-
*/
|
|
100
|
-
peekFirst(): T;
|
|
101
|
-
/**
|
|
102
|
-
* Retrieves but does not remove the first element, or undefined if empty.
|
|
103
|
-
*/
|
|
104
|
-
peekFirstOrUndefined(): T | undefined;
|
|
105
|
-
/**
|
|
106
|
-
* Inserts element at the end of this deque.
|
|
107
|
-
*
|
|
108
|
-
* @param element The element to add
|
|
109
|
-
* @throws Error if deque is full (bounded with throw policy)
|
|
110
|
-
*/
|
|
111
|
-
addLast(element: T): void;
|
|
112
|
-
/**
|
|
113
|
-
* Inserts element at the end, returning false if full.
|
|
114
|
-
*/
|
|
115
|
-
offerLast(element: T): boolean;
|
|
116
|
-
/**
|
|
117
|
-
* Retrieves and removes the last element.
|
|
118
|
-
*
|
|
119
|
-
* @throws Error if deque is empty
|
|
120
|
-
*/
|
|
121
|
-
removeLast(): T;
|
|
122
|
-
/**
|
|
123
|
-
* Retrieves and removes the last element, or undefined if empty.
|
|
124
|
-
*/
|
|
125
|
-
pollLast(): T | undefined;
|
|
126
|
-
/**
|
|
127
|
-
* Retrieves but does not remove the last element.
|
|
128
|
-
*
|
|
129
|
-
* @throws Error if deque is empty
|
|
130
|
-
*/
|
|
131
|
-
peekLast(): T;
|
|
132
|
-
/**
|
|
133
|
-
* Retrieves but does not remove the last element, or undefined if empty.
|
|
134
|
-
*/
|
|
135
|
-
peekLastOrUndefined(): T | undefined;
|
|
136
|
-
/**
|
|
137
|
-
* Pushes element onto the stack represented by this deque.
|
|
138
|
-
* Equivalent to addLast().
|
|
139
|
-
*
|
|
140
|
-
* @param element The element to push
|
|
141
|
-
*/
|
|
142
|
-
push(element: T): void;
|
|
143
|
-
/**
|
|
144
|
-
* Pops an element from the stack represented by this deque.
|
|
145
|
-
* Equivalent to removeLast().
|
|
146
|
-
*
|
|
147
|
-
* @returns The popped element
|
|
148
|
-
* @throws Error if deque is empty
|
|
149
|
-
*/
|
|
150
|
-
pop(): T;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* BlockingQueue<T> - Queue that supports blocking operations.
|
|
154
|
-
*
|
|
155
|
-
* Mirrors java.util.concurrent.BlockingQueue.
|
|
156
|
-
* Useful for producer-consumer patterns.
|
|
157
|
-
*/
|
|
158
|
-
export interface BlockingQueue<T> extends Queue<T> {
|
|
159
|
-
/**
|
|
160
|
-
* Inserts element, waiting if necessary for space to become available.
|
|
161
|
-
*
|
|
162
|
-
* @param element The element to add
|
|
163
|
-
* @param timeoutMs Optional timeout in milliseconds
|
|
164
|
-
* @returns Promise that resolves to true when element is added
|
|
165
|
-
* @throws Error if timeout expires
|
|
166
|
-
*/
|
|
167
|
-
put(element: T, timeoutMs?: number): Promise<void>;
|
|
168
|
-
/**
|
|
169
|
-
* Retrieves and removes the head, waiting if necessary until an element is available.
|
|
170
|
-
*
|
|
171
|
-
* @param timeoutMs Optional timeout in milliseconds
|
|
172
|
-
* @returns Promise that resolves to the head element
|
|
173
|
-
* @throws Error if timeout expires
|
|
174
|
-
*/
|
|
175
|
-
take(timeoutMs?: number): Promise<T>;
|
|
176
|
-
/**
|
|
177
|
-
* Returns the remaining capacity.
|
|
178
|
-
* Returns Infinity for unbounded queues.
|
|
179
|
-
*/
|
|
180
|
-
readonly remainingCapacity: number;
|
|
181
|
-
/**
|
|
182
|
-
* Removes all available elements and adds them to the given array.
|
|
183
|
-
* Returns the number of elements transferred.
|
|
184
|
-
*/
|
|
185
|
-
drainTo(target: T[], maxElements?: number): number;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* PriorityQueue<T> - Queue that orders elements by priority.
|
|
189
|
-
*
|
|
190
|
-
* Mirrors java.util.PriorityQueue.
|
|
191
|
-
* Elements are removed in priority order (not insertion order).
|
|
192
|
-
* Requires a comparison function to determine priority.
|
|
193
|
-
*/
|
|
194
|
-
export interface PriorityQueue<T> extends Queue<T> {
|
|
195
|
-
/**
|
|
196
|
-
* The comparison function used to determine priority.
|
|
197
|
-
* Elements with lower compare value have higher priority.
|
|
198
|
-
*/
|
|
199
|
-
readonly compare: Compare<T>;
|
|
200
|
-
/**
|
|
201
|
-
* Returns the comparator used to order elements, or undefined if natural ordering.
|
|
202
|
-
*/
|
|
203
|
-
readonly comparator: Compare<T> | undefined;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* AsyncQueue<T> - Async iterable queue.
|
|
207
|
-
*
|
|
208
|
-
* Designed for async/await patterns and streaming data.
|
|
209
|
-
* Implements AsyncIterable for use with for-await-of loops.
|
|
210
|
-
*/
|
|
211
|
-
export interface AsyncQueue<T> extends AsyncIterable<T> {
|
|
212
|
-
/** Number of elements currently in queue */
|
|
213
|
-
readonly size: number;
|
|
214
|
-
/** True if queue is empty */
|
|
215
|
-
readonly isEmpty: boolean;
|
|
216
|
-
/**
|
|
217
|
-
* Adds element to queue.
|
|
218
|
-
* For bounded queues, may wait for space to become available.
|
|
219
|
-
*/
|
|
220
|
-
put(element: T): Promise<void>;
|
|
221
|
-
/**
|
|
222
|
-
* Removes and returns next element.
|
|
223
|
-
* Waits for an element if queue is empty.
|
|
224
|
-
*/
|
|
225
|
-
take(): Promise<T>;
|
|
226
|
-
/**
|
|
227
|
-
* Attempts to add element without waiting.
|
|
228
|
-
* Returns false if queue is full.
|
|
229
|
-
*/
|
|
230
|
-
tryPut(element: T): boolean;
|
|
231
|
-
/**
|
|
232
|
-
* Attempts to remove element without waiting.
|
|
233
|
-
* Returns undefined if queue is empty.
|
|
234
|
-
*/
|
|
235
|
-
tryTake(): T | undefined;
|
|
236
|
-
/**
|
|
237
|
-
* Returns next element without removing it.
|
|
238
|
-
* Waits for an element if queue is empty.
|
|
239
|
-
*/
|
|
240
|
-
peek(): Promise<T>;
|
|
241
|
-
/**
|
|
242
|
-
* Closes the queue, preventing further additions.
|
|
243
|
-
* Allows existing elements to be consumed.
|
|
244
|
-
*/
|
|
245
|
-
close(): void;
|
|
246
|
-
/**
|
|
247
|
-
* Returns true if queue is closed.
|
|
248
|
-
*/
|
|
249
|
-
readonly isClosed: boolean;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* TransferQueue<T> - Queue where producers can wait for consumers.
|
|
253
|
-
*
|
|
254
|
-
* Mirrors java.util.concurrent.TransferQueue.
|
|
255
|
-
* Useful for direct handoff between producer and consumer threads.
|
|
256
|
-
*/
|
|
257
|
-
export interface TransferQueue<T> extends BlockingQueue<T> {
|
|
258
|
-
/**
|
|
259
|
-
* Transfers element to consumer, waiting if necessary.
|
|
260
|
-
* Waits for a consumer to receive the element.
|
|
261
|
-
*
|
|
262
|
-
* @param element The element to transfer
|
|
263
|
-
* @returns Promise that resolves when element is received
|
|
264
|
-
*/
|
|
265
|
-
transfer(element: T): Promise<void>;
|
|
266
|
-
/**
|
|
267
|
-
* Attempts to transfer element to waiting consumer.
|
|
268
|
-
* Returns false immediately if no consumer is waiting.
|
|
269
|
-
*
|
|
270
|
-
* @param element The element to transfer
|
|
271
|
-
* @param timeoutMs Optional timeout in milliseconds
|
|
272
|
-
*/
|
|
273
|
-
tryTransfer(element: T, timeoutMs?: number): Promise<boolean>;
|
|
274
|
-
/**
|
|
275
|
-
* Returns true if there are consumers waiting to receive elements.
|
|
276
|
-
*/
|
|
277
|
-
readonly hasWaitingConsumer: boolean;
|
|
278
|
-
/**
|
|
279
|
-
* Returns an estimate of the number of consumers waiting to receive elements.
|
|
280
|
-
*/
|
|
281
|
-
readonly waitingConsumerCount: number;
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* DelayQueue<T> - Queue where elements become available after a delay.
|
|
285
|
-
*
|
|
286
|
-
* Mirrors java.util.concurrent.DelayQueue.
|
|
287
|
-
* Elements can only be removed once their delay has expired.
|
|
288
|
-
*/
|
|
289
|
-
export interface DelayQueue<T> extends BlockingQueue<T> {
|
|
290
|
-
/**
|
|
291
|
-
* Adds element with specified delay.
|
|
292
|
-
*
|
|
293
|
-
* @param element The element to add
|
|
294
|
-
* @param delayMs Delay in milliseconds before element becomes available (defaults to 0)
|
|
295
|
-
*/
|
|
296
|
-
offer(element: T, delayMs?: number): boolean;
|
|
297
|
-
/**
|
|
298
|
-
* Returns the delay (in ms) until next element becomes available.
|
|
299
|
-
* Returns 0 if element is ready now.
|
|
300
|
-
* Returns Infinity if queue is empty.
|
|
301
|
-
*/
|
|
302
|
-
readonly nextDelay: number;
|
|
303
|
-
}
|
|
304
|
-
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/interfaces/queue.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,CAAE,SAAQ,kBAAkB,CAAC,CAAC,CAAC;IAC7D;;;;;OAKG;IACH,IAAI,IAAI,CAAC,CAAC;IAEV;;;OAGG;IACH,eAAe,IAAI,CAAC,GAAG,SAAS,CAAC;CAClC;AAED;;;;;GAKG;AACH,MAAM,WAAW,KAAK,CAAC,CAAC,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;IAC/D;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;IAE3B;;;;;OAKG;IACH,IAAI,IAAI,CAAC,CAAC;IAEV;;OAEG;IACH,eAAe,IAAI,CAAC,GAAG,SAAS,CAAC;IAEjC;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,C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,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC;;;;;;OAMG;IACH,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9D;;OAEG;IACH,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;CACvC;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IACrD;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAE7C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B"}
|
package/dist/interfaces/queue.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Queue and Deque interfaces that mirror Java's Queue and Deque.
|
|
3
|
-
*
|
|
4
|
-
* Queues are collections designed for holding elements prior to processing.
|
|
5
|
-
* Deques (double-ended queues) allow efficient insertion/removal at both ends.
|
|
6
|
-
*/
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=queue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../src/interfaces/queue.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/dist/interfaces/set.d.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Set interfaces that mirror Java's Set interface hierarchy.
|
|
3
|
-
*
|
|
4
|
-
* Sets are collections that contain no duplicate elements.
|
|
5
|
-
* They provide efficient membership testing.
|
|
6
|
-
*/
|
|
7
|
-
import type { Collection, ReadonlyCollection } from "./collection.js";
|
|
8
|
-
import type { Compare } from "../core/traits.js";
|
|
9
|
-
/**
|
|
10
|
-
* ReadonlySet<T> - Readonly set with no duplicates.
|
|
11
|
-
*/
|
|
12
|
-
export interface ReadonlySet<T> extends ReadonlyCollection<T> {
|
|
13
|
-
/**
|
|
14
|
-
* Returns true if this set contains the specified element.
|
|
15
|
-
*/
|
|
16
|
-
contains(element: T): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Returns true if this set contains all elements in the specified collection.
|
|
19
|
-
*/
|
|
20
|
-
containsAll(other: Iterable<T>): boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Set<T> - Mutable set with no duplicates.
|
|
24
|
-
*
|
|
25
|
-
* Mirrors java.util.Set.
|
|
26
|
-
* Elements are unique based on the set's equality function.
|
|
27
|
-
*/
|
|
28
|
-
export interface Set<T> extends ReadonlySet<T>, Collection<T> {
|
|
29
|
-
/**
|
|
30
|
-
* Adds the specified element to this set if it is not already present.
|
|
31
|
-
*
|
|
32
|
-
* @returns true if this set did not already contain the element
|
|
33
|
-
*/
|
|
34
|
-
add(element: T): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Removes the specified element from this set if it is present.
|
|
37
|
-
*
|
|
38
|
-
* @returns true if this set contained the element
|
|
39
|
-
*/
|
|
40
|
-
remove(element: T): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Adds all elements in the specified collection to this set.
|
|
43
|
-
* This is a union operation.
|
|
44
|
-
*
|
|
45
|
-
* @returns true if this set changed
|
|
46
|
-
*/
|
|
47
|
-
addAll(other: Iterable<T>): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Removes from this set all of its elements that are contained in the specified collection.
|
|
50
|
-
* This is a difference operation.
|
|
51
|
-
*
|
|
52
|
-
* @returns true if this set changed
|
|
53
|
-
*/
|
|
54
|
-
removeAll(other: Iterable<T>): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Retains only the elements in this set that are contained in the specified collection.
|
|
57
|
-
* This is an intersection operation.
|
|
58
|
-
*
|
|
59
|
-
* @returns true if this set changed
|
|
60
|
-
*/
|
|
61
|
-
retainAll(other: Iterable<T>): boolean;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* SortedSet<T> - Set that maintains elements in sorted order.
|
|
65
|
-
*
|
|
66
|
-
* Mirrors java.util.SortedSet.
|
|
67
|
-
*/
|
|
68
|
-
export interface SortedSet<T> extends Set<T> {
|
|
69
|
-
/**
|
|
70
|
-
* Returns the comparator used to order elements in this set.
|
|
71
|
-
*/
|
|
72
|
-
readonly comparator: Compare<T>;
|
|
73
|
-
/**
|
|
74
|
-
* Returns the first (lowest) element in this set.
|
|
75
|
-
*
|
|
76
|
-
* @throws Error if set is empty
|
|
77
|
-
*/
|
|
78
|
-
first(): T;
|
|
79
|
-
/**
|
|
80
|
-
* Returns the last (highest) element in this set.
|
|
81
|
-
*
|
|
82
|
-
* @throws Error if set is empty
|
|
83
|
-
*/
|
|
84
|
-
last(): T;
|
|
85
|
-
/**
|
|
86
|
-
* Returns a view of the portion of this set whose elements are strictly less than toElement.
|
|
87
|
-
*/
|
|
88
|
-
headSet(toElement: T): SortedSet<T>;
|
|
89
|
-
/**
|
|
90
|
-
* Returns a view of the portion of this set whose elements are greater than or equal to fromElement.
|
|
91
|
-
*/
|
|
92
|
-
tailSet(fromElement: T): SortedSet<T>;
|
|
93
|
-
/**
|
|
94
|
-
* Returns a view of the portion of this set whose elements range from fromElement to toElement.
|
|
95
|
-
*/
|
|
96
|
-
subSet(fromElement: T, toElement: T): SortedSet<T>;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* NavigableSet<T> - Extended sorted set with navigation methods.
|
|
100
|
-
*
|
|
101
|
-
* Mirrors java.util.NavigableSet.
|
|
102
|
-
*/
|
|
103
|
-
export interface NavigableSet<T> extends SortedSet<T> {
|
|
104
|
-
/**
|
|
105
|
-
* Returns the greatest element less than or equal to the given element, or undefined if none.
|
|
106
|
-
*/
|
|
107
|
-
floor(element: T): T | undefined;
|
|
108
|
-
/**
|
|
109
|
-
* Returns the least element greater than or equal to the given element, or undefined if none.
|
|
110
|
-
*/
|
|
111
|
-
ceiling(element: T): T | undefined;
|
|
112
|
-
/**
|
|
113
|
-
* Returns the greatest element strictly less than the given element, or undefined if none.
|
|
114
|
-
*/
|
|
115
|
-
lower(element: T): T | undefined;
|
|
116
|
-
/**
|
|
117
|
-
* Returns the least element strictly greater than the given element, or undefined if none.
|
|
118
|
-
*/
|
|
119
|
-
higher(element: T): T | undefined;
|
|
120
|
-
/**
|
|
121
|
-
* Retrieves and removes the first (lowest) element, or returns undefined if empty.
|
|
122
|
-
*/
|
|
123
|
-
pollFirst(): T | undefined;
|
|
124
|
-
/**
|
|
125
|
-
* Retrieves and removes the last (highest) element, or returns undefined if empty.
|
|
126
|
-
*/
|
|
127
|
-
pollLast(): T | undefined;
|
|
128
|
-
/**
|
|
129
|
-
* Returns a reverse order view of this set.
|
|
130
|
-
*/
|
|
131
|
-
descendingSet(): NavigableSet<T>;
|
|
132
|
-
/**
|
|
133
|
-
* Returns a reverse order iterator over the elements in this set.
|
|
134
|
-
*/
|
|
135
|
-
descendingIterator(): Iterator<T>;
|
|
136
|
-
}
|
|
137
|
-
//# sourceMappingURL=set.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/interfaces/set.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,CAAE,SAAQ,kBAAkB,CAAC,CAAC,CAAC;IAC3D;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;IAE9B;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC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CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAEjC;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAEnC;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAEjC;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAElC;;OAEG;IACH,SAAS,IAAI,CAAC,GAAG,SAAS,CAAC;IAE3B;;OAEG;IACH,QAAQ,IAAI,CAAC,GAAG,SAAS,CAAC;IAE1B;;OAEG;IACH,aAAa,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;IAEjC;;OAEG;IACH,kBAAkB,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;CACnC"}
|
package/dist/interfaces/set.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"set.js","sourceRoot":"","sources":["../../src/interfaces/set.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/dist/order/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The order of a list as data (Graph's split, wave 2, W1). Each item keeps a string key, and the list
|
|
3
|
-
* sorts by it. An item that moves between two others gets a key between theirs, so a move writes one
|
|
4
|
-
* item and no other.
|
|
5
|
-
*/
|
|
6
|
-
export { KEY_DIGITS, keyBetween, keysBetween, keysForDrop, compareKeys, isValidKey, dropIndex, type KeyCheckOptions, type KeyedItem, type Point } from "./rank.js";
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/order/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,KAAK,SAAS,EAAE,KAAK,KAAK,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/order/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The order of a list as data (Graph's split, wave 2, W1). Each item keeps a string key, and the list
|
|
3
|
-
* sorts by it. An item that moves between two others gets a key between theirs, so a move writes one
|
|
4
|
-
* item and no other.
|
|
5
|
-
*/
|
|
6
|
-
export { KEY_DIGITS, keyBetween, keysBetween, keysForDrop, compareKeys, isValidKey, dropIndex } from "./rank.js";
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
package/dist/order/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/order/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAoD,MAAM,WAAW,CAAC"}
|
package/dist/order/rank.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The keys of an ordered list (Graph's split, wave 2, W1): fractional indexing with base-62 keys. A
|
|
3
|
-
* key is a string. Each item of the list keeps one, and the list sorts by it. An item that moves
|
|
4
|
-
* between two others gets a key between theirs, so a move writes one item and no other.
|
|
5
|
-
*
|
|
6
|
-
* - A key has an integer part and a fraction part. The first character of the integer part gives its
|
|
7
|
-
* length. An insertion at an end changes the integer part, so the keys stay short. An insertion
|
|
8
|
-
* between two keys uses the fraction part, which can grow without a limit: the keys never run out,
|
|
9
|
-
* and the list needs no rebalance.
|
|
10
|
-
* - Compare two keys by the code units of the strings (`a < b`), never with `localeCompare`.
|
|
11
|
-
* - Two writers that move items into the same gap at the same time can get the same key. Sort by the
|
|
12
|
-
* key, then by the id of the item, so each reader sees one order.
|
|
13
|
-
*
|
|
14
|
-
* The algorithm is the one of the `fractional-indexing` package of Rocicorp (CC0), after the article
|
|
15
|
-
* "Implementing Fractional Indexing" of David Greenspan.
|
|
16
|
-
*/
|
|
17
|
-
/** The digits of a key, in ascending order of their code units. */
|
|
18
|
-
export declare const KEY_DIGITS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
19
|
-
/**
|
|
20
|
-
* This function gives a key strictly between two keys. Without `prev`, the key comes before `next`.
|
|
21
|
-
* Without `next`, it comes after `prev`. Without both, it gives the first key of a list ("a0").
|
|
22
|
-
*
|
|
23
|
-
* @throws RangeError when a key is not valid, or when `prev` is not before `next`
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts
|
|
27
|
-
* keyBetween(undefined, undefined); // "a0"
|
|
28
|
-
* keyBetween("a0", undefined); // "a1", after a0
|
|
29
|
-
* keyBetween("a0", "a1"); // "a0V"
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function keyBetween(prev: string | null | undefined, next: string | null | undefined): string;
|
|
33
|
-
/**
|
|
34
|
-
* This function gives `count` keys in ascending order, strictly between two keys, for example to put
|
|
35
|
-
* several items at one place, or to give keys to the items of a list for the first time.
|
|
36
|
-
*
|
|
37
|
-
* @throws RangeError as `keyBetween`, or when `count` is not an integer of 0 or more
|
|
38
|
-
*/
|
|
39
|
-
export declare function keysBetween(prev: string | null | undefined, next: string | null | undefined, count: number): string[];
|
|
40
|
-
/** The options of `isValidKey`. */
|
|
41
|
-
export interface KeyCheckOptions {
|
|
42
|
-
/** The longest key that the check accepts. The default is 1024 characters. */
|
|
43
|
-
readonly maxLength?: number;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* This function tells if a value is a valid key, for example a key that a client writes. A key that
|
|
47
|
-
* is longer than `maxLength` is not valid.
|
|
48
|
-
*/
|
|
49
|
-
export declare function isValidKey(key: unknown, options?: KeyCheckOptions): key is string;
|
|
50
|
-
/** An item of an ordered list: its id and its key. */
|
|
51
|
-
export interface KeyedItem {
|
|
52
|
-
readonly id: string;
|
|
53
|
-
readonly key: string;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* This function gives the writes of a move: the new key of the item that moves, and new keys for the
|
|
57
|
-
* neighbors that need them. Give the other items of the list in order (by key, then by id), without
|
|
58
|
-
* the item that moves, and the index of the drop from 0 to their number (`dropIndex`).
|
|
59
|
-
*
|
|
60
|
-
* Two writers can give two items one key. A drop between two such items has no key between them, so
|
|
61
|
-
* the helper first gives new keys to the items after the drop that have the key of the item before
|
|
62
|
-
* it. Each write is `{ id, key }`. The writes of the neighbors come first, and the write of the item
|
|
63
|
-
* that moves comes last.
|
|
64
|
-
*
|
|
65
|
-
* @throws RangeError when the index is outside the list, when the list holds the item that moves, or
|
|
66
|
-
* when a key is not valid
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```ts
|
|
70
|
-
* const index = dropIndex(pointer, others.map(centerOf));
|
|
71
|
-
* for (const { id, key } of keysForDrop(others, index, dragged.id)) await save(id, { rank: key });
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
export declare function keysForDrop(items: readonly KeyedItem[], index: number, movingId: string): Array<{
|
|
75
|
-
id: string;
|
|
76
|
-
key: string;
|
|
77
|
-
}>;
|
|
78
|
-
/** The order of two keys: the code units of the strings, as the keys need (never `localeCompare`). */
|
|
79
|
-
export declare function compareKeys(a: string, b: string): number;
|
|
80
|
-
/** A point, for example the center of an item on the screen. */
|
|
81
|
-
export interface Point {
|
|
82
|
-
readonly x: number;
|
|
83
|
-
readonly y: number;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* This function gives the index at which a point goes among the items of a list on the screen, in
|
|
87
|
-
* reading order: the rows from top to bottom, and each row from left to right. It is the index of the
|
|
88
|
-
* first item whose center comes after the point, from 0 to the number of items. A center within
|
|
89
|
-
* `rowTolerance` of the point on the vertical axis is in the row of the point.
|
|
90
|
-
*
|
|
91
|
-
* Give the centers in reading order, the same order as the keys, and without the item that moves.
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* ```ts
|
|
95
|
-
* const index = dropIndex(pointer, others.map(centerOf));
|
|
96
|
-
* const key = keyBetween(keys[index - 1], keys[index]);
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
export declare function dropIndex(point: Point, centers: readonly Point[], rowTolerance?: number): number;
|
|
100
|
-
//# sourceMappingURL=rank.d.ts.map
|
package/dist/order/rank.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rank.d.ts","sourceRoot":"","sources":["../../src/order/rank.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,mEAAmE;AACnE,eAAO,MAAM,UAAU,mEAAmE,CAAC;AAuF3F;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CA6BnG;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBrH;AAED,mCAAmC;AACnC,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,GAAE,eAAoB,GAAG,GAAG,IAAI,MAAM,CAQrF;AAED,sDAAsD;AACtD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;GAkBG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