@baleada/logic 0.22.7 → 0.23.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.cjs +2229 -508
- package/lib/index.d.ts +511 -73
- package/lib/index.js +2172 -500
- package/package.json +28 -16
package/lib/index.cjs
CHANGED
|
@@ -1,52 +1,57 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var lazyCollections = require('lazy-collections');
|
|
4
|
-
var slugify = require('@sindresorhus/slugify');
|
|
5
3
|
var BezierEasing = require('bezier-easing');
|
|
6
4
|
var color = require('@snigo.dev/color');
|
|
5
|
+
var lazyCollections = require('lazy-collections');
|
|
7
6
|
var perfectFreehand = require('perfect-freehand');
|
|
8
7
|
var polygonClipping = require('polygon-clipping');
|
|
8
|
+
var ky = require('ky');
|
|
9
9
|
var createDOMPurify = require('dompurify');
|
|
10
10
|
var fastFuzzy = require('fast-fuzzy');
|
|
11
|
+
var klona = require('klona');
|
|
12
|
+
var dequal = require('dequal');
|
|
13
|
+
var slugify = require('@sindresorhus/slugify');
|
|
14
|
+
var clsx = require('clsx');
|
|
11
15
|
|
|
12
|
-
function
|
|
13
|
-
return
|
|
14
|
-
return
|
|
15
|
-
async (accumulatorPromise, item, index) => {
|
|
16
|
-
const accumulator = await accumulatorPromise;
|
|
17
|
-
return accumulate(accumulator, item, index);
|
|
18
|
-
},
|
|
19
|
-
Promise.resolve(initialValue)
|
|
20
|
-
)(array);
|
|
16
|
+
function createClone() {
|
|
17
|
+
return (any) => {
|
|
18
|
+
return klona.klona(any);
|
|
21
19
|
};
|
|
22
20
|
}
|
|
23
|
-
function
|
|
24
|
-
return (
|
|
21
|
+
function createEqual(compared) {
|
|
22
|
+
return (any) => dequal.dequal(any, compared);
|
|
25
23
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
|
|
25
|
+
function createConcat(...arrays) {
|
|
26
|
+
return (array) => lazyCollections.pipe(
|
|
27
|
+
lazyCollections.concat(array, ...arrays),
|
|
28
|
+
lazyCollections.toArray()
|
|
29
|
+
)();
|
|
31
30
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
resolvedMaps.push(transformed);
|
|
38
|
-
return resolvedMaps;
|
|
39
|
-
},
|
|
40
|
-
[]
|
|
41
|
-
)(array);
|
|
42
|
-
};
|
|
31
|
+
function createFilter(predicate) {
|
|
32
|
+
return (array) => lazyCollections.pipe(
|
|
33
|
+
lazyCollections.filter(predicate),
|
|
34
|
+
lazyCollections.toArray()
|
|
35
|
+
)(array);
|
|
43
36
|
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
46
|
-
const
|
|
47
|
-
return
|
|
37
|
+
function createInsert(item, index) {
|
|
38
|
+
return (array) => {
|
|
39
|
+
const withItems = createConcat(array, [item])([]);
|
|
40
|
+
return createReorder(
|
|
41
|
+
{ start: array.length, itemCount: 1 },
|
|
42
|
+
index
|
|
43
|
+
)(withItems);
|
|
48
44
|
};
|
|
49
45
|
}
|
|
46
|
+
function createMap(transform) {
|
|
47
|
+
return (array) => lazyCollections.pipe(
|
|
48
|
+
lazyCollections.map(transform),
|
|
49
|
+
lazyCollections.toArray()
|
|
50
|
+
)(array);
|
|
51
|
+
}
|
|
52
|
+
function createReduce(accumulate, initialValue) {
|
|
53
|
+
return (array) => lazyCollections.reduce(accumulate, initialValue)(array);
|
|
54
|
+
}
|
|
50
55
|
function createRemove(index) {
|
|
51
56
|
return (array) => {
|
|
52
57
|
return createConcat(
|
|
@@ -55,15 +60,6 @@ function createRemove(index) {
|
|
|
55
60
|
)([]);
|
|
56
61
|
};
|
|
57
62
|
}
|
|
58
|
-
function createInsert(item, index) {
|
|
59
|
-
return (array) => {
|
|
60
|
-
const withItems = createConcat(array, [item])([]);
|
|
61
|
-
return createReorder(
|
|
62
|
-
{ start: array.length, itemCount: 1 },
|
|
63
|
-
index
|
|
64
|
-
)(withItems);
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
63
|
function createReorder(from, to) {
|
|
68
64
|
return (array) => {
|
|
69
65
|
const [itemsToMoveStartIndex, itemsToMoveCount] = predicateObject(from) ? [from.start, from.itemCount] : [from, 1], insertIndex = to;
|
|
@@ -92,8 +88,34 @@ function createReorder(from, to) {
|
|
|
92
88
|
return array;
|
|
93
89
|
};
|
|
94
90
|
}
|
|
95
|
-
function
|
|
96
|
-
return
|
|
91
|
+
function createReplace(index, replacement) {
|
|
92
|
+
return createMap((item, i) => i === index ? replacement : item);
|
|
93
|
+
}
|
|
94
|
+
function createReverse() {
|
|
95
|
+
return (array) => {
|
|
96
|
+
const reversed = [];
|
|
97
|
+
for (let i = array.length - 1; i > -1; i--) {
|
|
98
|
+
reversed.push(array[i]);
|
|
99
|
+
}
|
|
100
|
+
return reversed;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function createSlice(from, to) {
|
|
104
|
+
const toSliced = to ? lazyCollections.slice(from, to - 1) : lazyCollections.slice(from);
|
|
105
|
+
return (array) => {
|
|
106
|
+
return from === to ? [] : lazyCollections.pipe(
|
|
107
|
+
toSliced,
|
|
108
|
+
lazyCollections.toArray()
|
|
109
|
+
)(array);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function createSort(compare) {
|
|
113
|
+
return (array) => {
|
|
114
|
+
return lazyCollections.pipe(
|
|
115
|
+
lazyCollections.sort(compare),
|
|
116
|
+
lazyCollections.toArray()
|
|
117
|
+
)(array);
|
|
118
|
+
};
|
|
97
119
|
}
|
|
98
120
|
function createSwap(indices) {
|
|
99
121
|
return (array) => {
|
|
@@ -115,16 +137,7 @@ function createSwap(indices) {
|
|
|
115
137
|
reorderTo: (array2) => array2
|
|
116
138
|
};
|
|
117
139
|
})();
|
|
118
|
-
return
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
function createReplace(index, item) {
|
|
122
|
-
return (array) => {
|
|
123
|
-
return createConcat(
|
|
124
|
-
createSlice(0, index)(array),
|
|
125
|
-
[item],
|
|
126
|
-
createSlice(index + 1)(array)
|
|
127
|
-
)([]);
|
|
140
|
+
return lazyCollections.pipe(reorderFrom, reorderTo)(array);
|
|
128
141
|
};
|
|
129
142
|
}
|
|
130
143
|
function createUnique() {
|
|
@@ -133,277 +146,1990 @@ function createUnique() {
|
|
|
133
146
|
lazyCollections.toArray()
|
|
134
147
|
)(array);
|
|
135
148
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
149
|
+
|
|
150
|
+
function createFilterAsync(predicate) {
|
|
151
|
+
return async (array) => {
|
|
152
|
+
const transformedAsync = await createMapAsync(predicate)(array);
|
|
153
|
+
return createFilter((_, index) => transformedAsync[index])(array);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function createFindAsync(predicate) {
|
|
157
|
+
return async (array) => {
|
|
158
|
+
for (let i = 0; i < array.length; i++) {
|
|
159
|
+
const item = array[i], is = await predicate(item, i);
|
|
160
|
+
if (is)
|
|
161
|
+
return item;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function createFindIndexAsync(predicate) {
|
|
166
|
+
return async (array) => {
|
|
167
|
+
for (let i = 0; i < array.length; i++) {
|
|
168
|
+
const item = array[i], is = await predicate(item, i);
|
|
169
|
+
if (is)
|
|
170
|
+
return i;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function createForEachAsync(forEach) {
|
|
175
|
+
return async (array) => {
|
|
176
|
+
for (let i = 0; i < array.length; i++) {
|
|
177
|
+
const item = array[i];
|
|
178
|
+
await forEach(item, i);
|
|
179
|
+
}
|
|
180
|
+
return array;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function createMapAsync(transform) {
|
|
184
|
+
return async (array) => {
|
|
185
|
+
return await createReduceAsync(
|
|
186
|
+
async (resolvedMaps, item, index) => {
|
|
187
|
+
const transformed = await transform(item, index);
|
|
188
|
+
resolvedMaps.push(transformed);
|
|
189
|
+
return resolvedMaps;
|
|
190
|
+
},
|
|
191
|
+
[]
|
|
141
192
|
)(array);
|
|
142
193
|
};
|
|
143
194
|
}
|
|
144
|
-
function
|
|
145
|
-
return (array) =>
|
|
146
|
-
lazyCollections.
|
|
147
|
-
|
|
148
|
-
|
|
195
|
+
function createReduceAsync(accumulate, initialValue) {
|
|
196
|
+
return async (array) => {
|
|
197
|
+
return await lazyCollections.reduce(
|
|
198
|
+
async (accumulatorPromise, item, index) => {
|
|
199
|
+
const accumulator = await accumulatorPromise;
|
|
200
|
+
return accumulate(accumulator, item, index);
|
|
201
|
+
},
|
|
202
|
+
Promise.resolve(initialValue)
|
|
203
|
+
)(array);
|
|
204
|
+
};
|
|
149
205
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
206
|
+
|
|
207
|
+
function createClip(required) {
|
|
208
|
+
return (string) => {
|
|
209
|
+
return string.replace(required, "");
|
|
210
|
+
};
|
|
155
211
|
}
|
|
156
|
-
function
|
|
157
|
-
return (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
)();
|
|
212
|
+
function createSlug(options) {
|
|
213
|
+
return (string) => {
|
|
214
|
+
return slugify(string, options);
|
|
215
|
+
};
|
|
161
216
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
217
|
+
|
|
218
|
+
function createClamp(min, max) {
|
|
219
|
+
return (number) => {
|
|
220
|
+
const maxed = Math.max(number, min);
|
|
221
|
+
return Math.min(maxed, max);
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function createDetermine(potentialities) {
|
|
225
|
+
const predicates = createMap(({ outcome, probability }, index) => {
|
|
226
|
+
const lowerBound = index === 0 ? 0 : lazyCollections.pipe(
|
|
227
|
+
lazyCollections.slice(0, index - 1),
|
|
228
|
+
lazyCollections.reduce((lowerBound2, { probability: probability2 }) => lowerBound2 + probability2, 0)
|
|
229
|
+
)(potentialities), upperBound = lowerBound + probability;
|
|
230
|
+
return {
|
|
231
|
+
outcome,
|
|
232
|
+
predicate: (determinant) => determinant >= lowerBound && determinant < upperBound || determinant < 0 && index === 0 || index === predicates.length - 1
|
|
233
|
+
};
|
|
234
|
+
})(potentialities);
|
|
235
|
+
return (determinant) => lazyCollections.find(({ predicate }) => predicate(determinant))(predicates).outcome;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function createEntries() {
|
|
239
|
+
return (object) => {
|
|
240
|
+
const entries = [];
|
|
241
|
+
for (const key in object) {
|
|
242
|
+
entries.push([key, object[key]]);
|
|
243
|
+
}
|
|
244
|
+
return entries;
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
function createKeys() {
|
|
248
|
+
return (object) => {
|
|
249
|
+
const keys = [];
|
|
250
|
+
for (const key in object) {
|
|
251
|
+
keys.push(key);
|
|
252
|
+
}
|
|
253
|
+
return keys;
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function createEvery(predicate) {
|
|
257
|
+
return (object) => {
|
|
258
|
+
for (const key in object) {
|
|
259
|
+
if (!predicate(key, object[key])) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return true;
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
function createSome(predicate) {
|
|
267
|
+
return (object) => {
|
|
268
|
+
for (const key in object) {
|
|
269
|
+
if (predicate(key, object[key]))
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
return false;
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function createRename(from, to) {
|
|
277
|
+
return (map) => {
|
|
278
|
+
const keys = [...map.keys()], keyToRenameIndex = lazyCollections.findIndex((k) => k === from)(keys), newKeys = createReplace(keyToRenameIndex, to)(keys), values = [...map.values()];
|
|
279
|
+
return createReduce((renamed, key, index) => renamed.set(key, values[index]), /* @__PURE__ */ new Map())(newKeys);
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const defaultOptions$m = {
|
|
284
|
+
elementIsCandidate: false,
|
|
285
|
+
// Adapted from React Aria https://github.com/adobe/react-spectrum/blob/b6786da906973130a1746b2bee63215bba013ca4/packages/%40react-aria/focus/src/FocusScope.tsx#L256
|
|
286
|
+
tabbableSelector: lazyCollections.join(':not([hidden]):not([tabindex="-1"]),')([
|
|
287
|
+
"input:not([disabled]):not([type=hidden])",
|
|
288
|
+
"select:not([disabled])",
|
|
289
|
+
"textarea:not([disabled])",
|
|
290
|
+
"button:not([disabled])",
|
|
291
|
+
"a[href]",
|
|
292
|
+
"area[href]",
|
|
293
|
+
"summary",
|
|
294
|
+
"iframe",
|
|
295
|
+
"object",
|
|
296
|
+
"embed",
|
|
297
|
+
"audio[controls]",
|
|
298
|
+
"video[controls]",
|
|
299
|
+
"[contenteditable]",
|
|
300
|
+
"[tabindex]:not([disabled])"
|
|
301
|
+
])
|
|
302
|
+
};
|
|
303
|
+
function createFocusable(order, options = {}) {
|
|
304
|
+
const { elementIsCandidate, tabbableSelector } = { ...defaultOptions$m, ...options }, predicateFocusable = (element) => element.matches(tabbableSelector);
|
|
305
|
+
return (element) => {
|
|
306
|
+
if (elementIsCandidate && predicateFocusable(element))
|
|
307
|
+
return element;
|
|
308
|
+
switch (order) {
|
|
309
|
+
case "first":
|
|
310
|
+
for (let i = 0; i < element.children.length; i++) {
|
|
311
|
+
const focusable = createFocusable(order, { elementIsCandidate: true })(element.children[i]);
|
|
312
|
+
if (focusable)
|
|
313
|
+
return focusable;
|
|
314
|
+
}
|
|
315
|
+
break;
|
|
316
|
+
case "last":
|
|
317
|
+
for (let i = element.children.length - 1; i > -1; i--) {
|
|
318
|
+
const focusable = createFocusable(order, { elementIsCandidate: true })(element.children[i]);
|
|
319
|
+
if (focusable)
|
|
320
|
+
return focusable;
|
|
321
|
+
}
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function createToIndegree(graph) {
|
|
328
|
+
const toIncoming = createToIncoming(graph);
|
|
329
|
+
return (node) => lazyCollections.pipe(
|
|
330
|
+
toIncoming,
|
|
331
|
+
toLength()
|
|
332
|
+
)(node);
|
|
333
|
+
}
|
|
334
|
+
function createToOutdegree(graph) {
|
|
335
|
+
const toOutgoing = createToOutgoing(graph);
|
|
336
|
+
return (node) => lazyCollections.pipe(
|
|
337
|
+
toOutgoing,
|
|
338
|
+
toLength()
|
|
339
|
+
)(node);
|
|
340
|
+
}
|
|
341
|
+
function createToIncoming(graph) {
|
|
342
|
+
const { edges } = graph;
|
|
343
|
+
return function* (node) {
|
|
344
|
+
yield* lazyCollections.filter(
|
|
345
|
+
({ to }) => to === node
|
|
346
|
+
)(edges);
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
function createToOutgoing(graph) {
|
|
350
|
+
const { edges } = graph;
|
|
351
|
+
return function* (node) {
|
|
352
|
+
yield* lazyCollections.filter(
|
|
353
|
+
({ from }) => from === node
|
|
354
|
+
)(edges);
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function createPredicateRoot(graph) {
|
|
358
|
+
const toIndegree = createToIndegree(graph);
|
|
359
|
+
return (node) => toIndegree(node) === 0;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function createFind(node) {
|
|
363
|
+
return (tree) => {
|
|
364
|
+
for (const treeNode of tree) {
|
|
365
|
+
if (treeNode.node === node)
|
|
366
|
+
return treeNode;
|
|
367
|
+
const found = createFind(node)(treeNode.children);
|
|
368
|
+
if (found)
|
|
369
|
+
return found;
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function createToLayers$1(options = {}) {
|
|
375
|
+
const toSteps = createToSteps$2(options.createToSteps);
|
|
376
|
+
return function toLayers(directedAcyclic) {
|
|
377
|
+
const layers = [];
|
|
378
|
+
for (const { path } of toSteps(directedAcyclic)) {
|
|
379
|
+
const node = path.at(-1), depth = path.length - 1;
|
|
380
|
+
(layers[depth] || (layers[depth] = [])).push(node);
|
|
381
|
+
}
|
|
382
|
+
return layers;
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
function createToTree$2(options = {}) {
|
|
386
|
+
const toSteps = createToSteps$2(options.createToSteps);
|
|
387
|
+
return function toTree(directedAcyclic) {
|
|
388
|
+
const firstRoot = lazyCollections.pipe(
|
|
389
|
+
createToRoots(),
|
|
390
|
+
lazyCollections.at(0)
|
|
391
|
+
)(directedAcyclic), tree = [];
|
|
392
|
+
tree.push({
|
|
393
|
+
node: firstRoot,
|
|
394
|
+
children: []
|
|
395
|
+
});
|
|
396
|
+
for (const { path } of toSteps(directedAcyclic)) {
|
|
397
|
+
const node = path.at(-1), parent = path.at(-2);
|
|
398
|
+
if (parent) {
|
|
399
|
+
const parentTreeNode = createFind(parent)(tree);
|
|
400
|
+
if (parentTreeNode) {
|
|
401
|
+
parentTreeNode.children.push({
|
|
402
|
+
node,
|
|
403
|
+
children: []
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return tree;
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
function createToCommonAncestors$2(directedAcyclic) {
|
|
412
|
+
const toNodeSteps = createToNodeSteps$2(directedAcyclic);
|
|
413
|
+
return function* (a, b) {
|
|
414
|
+
for (const { path: aPath } of toNodeSteps(a)) {
|
|
415
|
+
for (const { path: bPath } of toNodeSteps(b)) {
|
|
416
|
+
for (let aPathIndex = aPath.length - 1; aPathIndex >= 0; aPathIndex--) {
|
|
417
|
+
for (let bPathIndex = bPath.length - 1; bPathIndex >= 0; bPathIndex--) {
|
|
418
|
+
if (aPath[aPathIndex] === bPath[bPathIndex] && !lazyCollections.includes(aPath[aPathIndex])([a, b])) {
|
|
419
|
+
yield {
|
|
420
|
+
node: aPath[aPathIndex],
|
|
421
|
+
distances: {
|
|
422
|
+
[a]: aPath.length - aPathIndex - 1,
|
|
423
|
+
[b]: bPath.length - bPathIndex - 1
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
function createPredicateAncestor$2(directedAcyclic) {
|
|
434
|
+
const toNodeSteps = createToNodeSteps$2(directedAcyclic);
|
|
435
|
+
return function(descendant, ancestor) {
|
|
436
|
+
return lazyCollections.pipe(
|
|
437
|
+
toNodeSteps,
|
|
438
|
+
lazyCollections.some(({ path }) => lazyCollections.includes(ancestor)(path))
|
|
439
|
+
)(descendant);
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
function createToNodeSteps$2(directedAcyclic, options = {}) {
|
|
443
|
+
const toSteps = createToSteps$2(options.createToSteps);
|
|
444
|
+
return function* (node) {
|
|
445
|
+
yield* lazyCollections.pipe(
|
|
446
|
+
toSteps,
|
|
447
|
+
lazyCollections.filter(({ path }) => path.at(-1) === node)
|
|
448
|
+
)(directedAcyclic);
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
const defaultCreateToStepsOptions$1 = {
|
|
452
|
+
toUnsetMetadata: () => 0,
|
|
453
|
+
toMockMetadata: (node, totalConnectionsFollowed) => totalConnectionsFollowed,
|
|
454
|
+
kind: "directed acyclic"
|
|
455
|
+
};
|
|
456
|
+
function createToSteps$2(options = {}) {
|
|
457
|
+
const { toUnsetMetadata, toMockMetadata, root, kind } = { ...defaultCreateToStepsOptions$1, ...options };
|
|
458
|
+
return function* (directedAcyclic) {
|
|
459
|
+
const { nodes } = directedAcyclic, toOutdegree = createToOutdegree(directedAcyclic), toPath = createToPath$2(directedAcyclic), roots = lazyCollections.pipe(
|
|
460
|
+
createToRoots({ kind }),
|
|
461
|
+
lazyCollections.toArray()
|
|
462
|
+
)(directedAcyclic), state = {}, totalConnectionsFollowedByNode = {}, predicateExhausted = (node) => {
|
|
463
|
+
return totalConnectionsFollowedByNode[node] === toOutdegree(node);
|
|
464
|
+
};
|
|
465
|
+
for (const node of nodes) {
|
|
466
|
+
state[node] = {
|
|
467
|
+
status: "unset",
|
|
468
|
+
metadata: toUnsetMetadata(node)
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
let location = root || lazyCollections.at(0)(roots);
|
|
472
|
+
const path = toPath(state);
|
|
473
|
+
yield { path, state: JSON.parse(JSON.stringify(state)) };
|
|
474
|
+
function* toStep() {
|
|
475
|
+
if (predicateExhausted(location)) {
|
|
476
|
+
if (lazyCollections.includes(location)(roots))
|
|
477
|
+
return;
|
|
478
|
+
state[location].status = "unset";
|
|
479
|
+
state[location].metadata = toUnsetMetadata(location);
|
|
480
|
+
const path3 = toPath(state);
|
|
481
|
+
location = path3.at(-2);
|
|
482
|
+
yield* toStep();
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
if (!(location in totalConnectionsFollowedByNode))
|
|
486
|
+
totalConnectionsFollowedByNode[location] = 0;
|
|
487
|
+
state[location].status = "set";
|
|
488
|
+
state[location].metadata = toMockMetadata(location, totalConnectionsFollowedByNode[location]);
|
|
489
|
+
const path2 = toPath(state);
|
|
490
|
+
yield { path: path2, state: JSON.parse(JSON.stringify(state)) };
|
|
491
|
+
totalConnectionsFollowedByNode[location]++;
|
|
492
|
+
const newLocation = path2.at(-1);
|
|
493
|
+
if (toOutdegree(newLocation) > 0)
|
|
494
|
+
location = newLocation;
|
|
495
|
+
yield* toStep();
|
|
496
|
+
}
|
|
497
|
+
yield* toStep();
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
function createToPath$2(directedAcyclic) {
|
|
501
|
+
const toOutdegree = createToOutdegree(directedAcyclic), toOutgoing = createToOutgoing(directedAcyclic), firstRoot = lazyCollections.pipe(
|
|
502
|
+
createToRoots(),
|
|
503
|
+
lazyCollections.at(0)
|
|
504
|
+
)(directedAcyclic);
|
|
505
|
+
return (state) => {
|
|
506
|
+
const path = [firstRoot], getLastOutdegree = () => toOutdegree(path.at(-1)), getLastStatus = () => state[path.at(-1)].status;
|
|
507
|
+
while (getLastOutdegree() > 0 && getLastStatus() === "set") {
|
|
508
|
+
const edge = lazyCollections.pipe(
|
|
509
|
+
toOutgoing,
|
|
510
|
+
lazyCollections.find(
|
|
511
|
+
({ predicateTraversable }) => predicateTraversable(state)
|
|
512
|
+
)
|
|
513
|
+
)(path.at(-1));
|
|
514
|
+
path.push(edge.to);
|
|
515
|
+
}
|
|
516
|
+
return path;
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
function createToRoots(options = {}) {
|
|
520
|
+
return function* (directedAcyclic) {
|
|
521
|
+
const { nodes } = directedAcyclic;
|
|
522
|
+
for (const node of nodes) {
|
|
523
|
+
if (createPredicateRoot(directedAcyclic)(node))
|
|
524
|
+
yield node;
|
|
525
|
+
if (options.kind === "arborescence")
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
function createToLayers(options = {}) {
|
|
532
|
+
const toSteps = createToSteps$1(options.createToSteps);
|
|
533
|
+
return async function toLayers(directedAcyclic) {
|
|
534
|
+
const layers = [];
|
|
535
|
+
for await (const { path } of toSteps(directedAcyclic)) {
|
|
536
|
+
const node = path.at(-1), depth = path.length - 1;
|
|
537
|
+
(layers[depth] || (layers[depth] = [])).push(node);
|
|
538
|
+
}
|
|
539
|
+
return layers;
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
function createToTree$1(options = {}) {
|
|
543
|
+
const toSteps = createToSteps$1(options.createToSteps);
|
|
544
|
+
return async function toTree(directedAcyclic) {
|
|
545
|
+
const firstRoot = lazyCollections.pipe(
|
|
546
|
+
createToRoots(),
|
|
547
|
+
lazyCollections.at(0)
|
|
548
|
+
)(directedAcyclic), tree = [];
|
|
549
|
+
tree.push({
|
|
550
|
+
node: firstRoot,
|
|
551
|
+
children: []
|
|
552
|
+
});
|
|
553
|
+
for await (const { path } of toSteps(directedAcyclic)) {
|
|
554
|
+
const node = path.at(-1), parent = path.at(-2);
|
|
555
|
+
if (parent) {
|
|
556
|
+
const parentTreeNode = createFind(parent)(tree);
|
|
557
|
+
if (parentTreeNode) {
|
|
558
|
+
parentTreeNode.children.push({
|
|
559
|
+
node,
|
|
560
|
+
children: []
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
return tree;
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
function createToCommonAncestors$1(directedAcyclic) {
|
|
569
|
+
const toNodeSteps = createToNodeSteps$1(directedAcyclic);
|
|
570
|
+
return async function* (a, b) {
|
|
571
|
+
for await (const { path: aPath } of toNodeSteps(a)) {
|
|
572
|
+
for await (const { path: bPath } of toNodeSteps(b)) {
|
|
573
|
+
for (let aPathIndex = aPath.length - 1; aPathIndex >= 0; aPathIndex--) {
|
|
574
|
+
for (let bPathIndex = bPath.length - 1; bPathIndex >= 0; bPathIndex--) {
|
|
575
|
+
if (aPath[aPathIndex] === bPath[bPathIndex] && !lazyCollections.includes(aPath[aPathIndex])([a, b])) {
|
|
576
|
+
yield {
|
|
577
|
+
node: aPath[aPathIndex],
|
|
578
|
+
distances: {
|
|
579
|
+
[a]: aPath.length - aPathIndex - 1,
|
|
580
|
+
[b]: bPath.length - bPathIndex - 1
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
function createPredicateAncestor$1(directedAcyclic) {
|
|
591
|
+
const toNodeSteps = createToNodeSteps$1(directedAcyclic);
|
|
592
|
+
return async function(descendant, ancestor) {
|
|
593
|
+
return await lazyCollections.pipe(
|
|
594
|
+
toNodeSteps,
|
|
595
|
+
lazyCollections.some(({ path }) => lazyCollections.includes(ancestor)(path))
|
|
596
|
+
)(descendant);
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
function createToNodeSteps$1(directedAcyclic, options = {}) {
|
|
600
|
+
const toSteps = createToSteps$1(options.createToSteps);
|
|
601
|
+
return async function* (node) {
|
|
602
|
+
yield* await lazyCollections.pipe(
|
|
603
|
+
toSteps,
|
|
604
|
+
lazyCollections.filter(({ path }) => path.at(-1) === node)
|
|
605
|
+
)(directedAcyclic);
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
function createToSteps$1(options = {}) {
|
|
609
|
+
const { toUnsetMetadata, toMockMetadata, root, kind } = { ...defaultCreateToStepsOptions$1, ...options };
|
|
610
|
+
return async function* (directedAcyclic) {
|
|
611
|
+
const { nodes } = directedAcyclic, toOutdegree = createToOutdegree(directedAcyclic), toPath = createToPath$1(directedAcyclic), roots = lazyCollections.pipe(
|
|
612
|
+
createToRoots({ kind }),
|
|
613
|
+
lazyCollections.toArray()
|
|
614
|
+
)(directedAcyclic), state = {}, totalConnectionsFollowedByNode = {}, predicateExhausted = (node) => {
|
|
615
|
+
return totalConnectionsFollowedByNode[node] === toOutdegree(node);
|
|
616
|
+
};
|
|
617
|
+
for (const node of nodes) {
|
|
618
|
+
state[node] = {
|
|
619
|
+
status: "unset",
|
|
620
|
+
metadata: toUnsetMetadata(node)
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
let location = root || lazyCollections.at(0)(roots);
|
|
624
|
+
const path = await toPath(state);
|
|
625
|
+
yield { path, state: JSON.parse(JSON.stringify(state)) };
|
|
626
|
+
async function* toStep() {
|
|
627
|
+
if (predicateExhausted(location)) {
|
|
628
|
+
if (lazyCollections.includes(location)(roots))
|
|
629
|
+
return;
|
|
630
|
+
state[location].status = "unset";
|
|
631
|
+
state[location].metadata = toUnsetMetadata(location);
|
|
632
|
+
const path3 = await toPath(state);
|
|
633
|
+
location = path3.at(-2);
|
|
634
|
+
yield* await toStep();
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
if (!(location in totalConnectionsFollowedByNode))
|
|
638
|
+
totalConnectionsFollowedByNode[location] = 0;
|
|
639
|
+
state[location].status = "set";
|
|
640
|
+
state[location].metadata = toMockMetadata(location, totalConnectionsFollowedByNode[location]);
|
|
641
|
+
const path2 = await toPath(state);
|
|
642
|
+
yield { path: path2, state: JSON.parse(JSON.stringify(state)) };
|
|
643
|
+
totalConnectionsFollowedByNode[location]++;
|
|
644
|
+
const newLocation = path2.at(-1);
|
|
645
|
+
if (toOutdegree(newLocation) > 0)
|
|
646
|
+
location = newLocation;
|
|
647
|
+
yield* await toStep();
|
|
648
|
+
}
|
|
649
|
+
yield* await toStep();
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
function createToPath$1(directedAcyclic) {
|
|
653
|
+
const toOutdegree = createToOutdegree(directedAcyclic), toOutgoing = createToOutgoing(directedAcyclic), firstRoot = lazyCollections.pipe(
|
|
654
|
+
createToRoots(),
|
|
655
|
+
lazyCollections.at(0)
|
|
656
|
+
)(directedAcyclic);
|
|
657
|
+
return async (state) => {
|
|
658
|
+
const path = [firstRoot], getLastOutdegree = () => toOutdegree(path.at(-1)), getLastStatus = () => state[path.at(-1)].status;
|
|
659
|
+
while (getLastOutdegree() > 0 && getLastStatus() === "set") {
|
|
660
|
+
const edge = await lazyCollections.pipe(
|
|
661
|
+
toOutgoing,
|
|
662
|
+
lazyCollections.toArray(),
|
|
663
|
+
createFindAsync(
|
|
664
|
+
async ({ predicateTraversable }) => await predicateTraversable(state)
|
|
665
|
+
)
|
|
666
|
+
)(path.at(-1));
|
|
667
|
+
path.push(edge.to);
|
|
668
|
+
}
|
|
669
|
+
return path;
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
const defaultCreateToStepsOptions = {
|
|
674
|
+
priorityBranch: false,
|
|
675
|
+
kind: "directed acyclic"
|
|
676
|
+
};
|
|
677
|
+
function createToTree(options = {}) {
|
|
678
|
+
const withDefaults = {
|
|
679
|
+
...options,
|
|
680
|
+
createToSteps: {
|
|
681
|
+
...defaultCreateToStepsOptions,
|
|
682
|
+
...options.createToSteps
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
return createToTree$2({
|
|
686
|
+
...withDefaults,
|
|
687
|
+
createToSteps: toCreateDirectedAcyclicToStepsOptions(withDefaults.createToSteps)
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
function createToCommonAncestors(...params) {
|
|
691
|
+
return createToCommonAncestors$2(...params);
|
|
692
|
+
}
|
|
693
|
+
function createPredicateAncestor(...params) {
|
|
694
|
+
return createPredicateAncestor$2(...params);
|
|
695
|
+
}
|
|
696
|
+
function createToNodeSteps(decisionTree, options = {}) {
|
|
697
|
+
const withDefaults = {
|
|
698
|
+
...options,
|
|
699
|
+
createToSteps: {
|
|
700
|
+
...defaultCreateToStepsOptions,
|
|
701
|
+
...options.createToSteps
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
return createToNodeSteps$2(
|
|
705
|
+
decisionTree,
|
|
706
|
+
{
|
|
707
|
+
...withDefaults,
|
|
708
|
+
createToSteps: toCreateDirectedAcyclicToStepsOptions(withDefaults.createToSteps)
|
|
709
|
+
}
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
function createToSteps(options = {}) {
|
|
713
|
+
const withDefaults = {
|
|
714
|
+
...defaultCreateToStepsOptions,
|
|
715
|
+
...options
|
|
716
|
+
};
|
|
717
|
+
return createToSteps$2(
|
|
718
|
+
toCreateDirectedAcyclicToStepsOptions(withDefaults)
|
|
719
|
+
);
|
|
720
|
+
}
|
|
721
|
+
function createToPath(...params) {
|
|
722
|
+
return createToPath$2(...params);
|
|
723
|
+
}
|
|
724
|
+
function toCreateDirectedAcyclicToStepsOptions(options) {
|
|
725
|
+
return {
|
|
726
|
+
...defaultCreateToStepsOptions,
|
|
727
|
+
...options,
|
|
728
|
+
...{
|
|
729
|
+
toUnsetMetadata: () => false,
|
|
730
|
+
toMockMetadata: (node, totalConnectionsFollowed) => options.priorityBranch ? !totalConnectionsFollowed : !!totalConnectionsFollowed
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
function createList() {
|
|
736
|
+
return (...classValues) => clsx(...classValues);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
const defaultOptions$l = {
|
|
740
|
+
toId: (node) => node.id,
|
|
741
|
+
toChildren: (node) => node.children
|
|
742
|
+
};
|
|
743
|
+
function createToGraph(options = {}) {
|
|
744
|
+
const { toId, toChildren } = { ...defaultOptions$l, ...options };
|
|
745
|
+
return function* (tree) {
|
|
746
|
+
const root = tree[0], rootId = toId(root);
|
|
747
|
+
function* toPair(node, id) {
|
|
748
|
+
const children = toChildren(node) || [];
|
|
749
|
+
for (const child of children) {
|
|
750
|
+
const childId = toId(child);
|
|
751
|
+
yield {
|
|
752
|
+
node: childId,
|
|
753
|
+
edge: { from: id, to: childId }
|
|
754
|
+
};
|
|
755
|
+
yield* toPair(child, childId);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
yield { node: rootId };
|
|
759
|
+
yield* toPair(root, rootId);
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
const defaultOptions$k = {
|
|
764
|
+
toKey: (alias) => fromAliasToKeyStatusKey(alias)
|
|
765
|
+
};
|
|
766
|
+
const createPredicateKeycomboMatch$1 = (keycombo, options = {}) => {
|
|
767
|
+
const { toKey } = { ...defaultOptions$k, ...options }, keys = lazyCollections.pipe(
|
|
768
|
+
fromComboToAliases,
|
|
769
|
+
lazyCollections.map(toKey)
|
|
770
|
+
)(keycombo);
|
|
771
|
+
return (event) => {
|
|
772
|
+
const { toValue, set } = createKeyStatuses();
|
|
773
|
+
set(fromEventToKeyStatusKey(event), "down");
|
|
774
|
+
for (const modifier of modifiers) {
|
|
775
|
+
if (event[`${modifier.toLowerCase()}Key`])
|
|
776
|
+
set({ key: modifier }, "down");
|
|
777
|
+
}
|
|
778
|
+
return lazyCollections.every(lazyCollections.pipe(
|
|
779
|
+
toValue,
|
|
780
|
+
predicateDown
|
|
781
|
+
))(keys);
|
|
782
|
+
};
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
const defaultOptions$j = {
|
|
786
|
+
initial: [],
|
|
787
|
+
createPredicateKey: (query) => (candidate) => query === candidate
|
|
788
|
+
};
|
|
789
|
+
function createAssociativeArray(options = {}) {
|
|
790
|
+
const { initial, createPredicateKey } = { ...defaultOptions$j, ...options }, entries = [...initial];
|
|
791
|
+
const toValue = (key) => {
|
|
792
|
+
const predicateKey = createPredicateKey(key);
|
|
793
|
+
return lazyCollections.find(
|
|
794
|
+
([candidate]) => predicateKey(candidate)
|
|
795
|
+
)(entries)?.[1];
|
|
796
|
+
};
|
|
797
|
+
const set = (key, value) => {
|
|
798
|
+
const predicateKey = createPredicateKey(key), index = lazyCollections.findIndex(
|
|
799
|
+
([candidate]) => predicateKey(candidate)
|
|
800
|
+
)(entries);
|
|
801
|
+
if (index === -1) {
|
|
802
|
+
entries.push([key, value]);
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
entries[index][1] = value;
|
|
806
|
+
};
|
|
807
|
+
const predicateHas = (key) => {
|
|
808
|
+
const predicateKey = createPredicateKey(key);
|
|
809
|
+
return lazyCollections.findIndex(
|
|
810
|
+
([candidate]) => predicateKey(candidate)
|
|
811
|
+
)(entries) !== -1;
|
|
812
|
+
};
|
|
813
|
+
const clear = () => {
|
|
814
|
+
entries.length = 0;
|
|
815
|
+
};
|
|
816
|
+
const del = (key) => {
|
|
817
|
+
const predicateKey = createPredicateKey(key), index = lazyCollections.findIndex(
|
|
818
|
+
([candidate]) => predicateKey(candidate)
|
|
819
|
+
)(entries);
|
|
820
|
+
if (index === -1) {
|
|
821
|
+
return false;
|
|
822
|
+
}
|
|
823
|
+
entries.splice(index, 1);
|
|
824
|
+
return true;
|
|
825
|
+
};
|
|
826
|
+
const toKeys = () => {
|
|
827
|
+
return createMap(([key]) => key)(entries);
|
|
828
|
+
};
|
|
829
|
+
const toValues = () => {
|
|
830
|
+
return createMap(([, value]) => value)(entries);
|
|
831
|
+
};
|
|
832
|
+
const toEntries = () => {
|
|
833
|
+
return entries;
|
|
834
|
+
};
|
|
835
|
+
return {
|
|
836
|
+
toValue,
|
|
837
|
+
set,
|
|
838
|
+
predicateHas,
|
|
839
|
+
clear,
|
|
840
|
+
delete: del,
|
|
841
|
+
toKeys,
|
|
842
|
+
toValues,
|
|
843
|
+
toEntries
|
|
844
|
+
// get: toValue,
|
|
845
|
+
// has: predicateHas,
|
|
846
|
+
// keys: toKeys,
|
|
847
|
+
// values: toValues,
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
const defaultOptions$i = {
|
|
852
|
+
minDuration: 0,
|
|
853
|
+
preventsDefaultUnlessDenied: true,
|
|
854
|
+
toKey: (alias) => fromAliasToKeyStatusKey(alias),
|
|
855
|
+
toAliases: (event) => fromEventToAliases(event)
|
|
856
|
+
};
|
|
857
|
+
function createKeypress(keycomboOrKeycombos, options = {}) {
|
|
858
|
+
const {
|
|
859
|
+
minDuration,
|
|
860
|
+
preventsDefaultUnlessDenied,
|
|
861
|
+
toKey,
|
|
862
|
+
toAliases,
|
|
863
|
+
onDown,
|
|
864
|
+
onUp,
|
|
865
|
+
onVisibilitychange
|
|
866
|
+
} = { ...defaultOptions$i, ...options }, {
|
|
867
|
+
matchPredicatesByKeycombo,
|
|
868
|
+
getDownCombos,
|
|
869
|
+
predicateValid,
|
|
870
|
+
cleanup,
|
|
871
|
+
statuses
|
|
872
|
+
} = createKeyState({
|
|
873
|
+
keycomboOrKeycombos,
|
|
874
|
+
unsupportedAliases: unsupportedAliases$2,
|
|
875
|
+
toKey,
|
|
876
|
+
toAliases,
|
|
877
|
+
getRequest: () => request
|
|
878
|
+
});
|
|
879
|
+
let request;
|
|
880
|
+
let localStatus;
|
|
881
|
+
const keydown = (event, api) => {
|
|
882
|
+
const { denied, getStatus } = api, key = fromEventToKeyStatusKey(event);
|
|
883
|
+
if (statuses.toValue(key) === "down") {
|
|
884
|
+
onDown?.(toHookApi(api));
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
statuses.set(key, "down");
|
|
888
|
+
if (localStatus === "denied") {
|
|
889
|
+
denied();
|
|
890
|
+
onDown?.(toHookApi(api));
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
const downCombos = getDownCombos();
|
|
894
|
+
if (
|
|
895
|
+
// NOT BUILDING VALID COMBO
|
|
896
|
+
!predicateValid(event) || downCombos.length > 1 && fromComboToAliasesLength(downCombos[0]) === fromComboToAliasesLength(downCombos[1])
|
|
897
|
+
) {
|
|
898
|
+
denied();
|
|
899
|
+
localStatus = getStatus();
|
|
900
|
+
if (lazyCollections.includes(event.key)(unsupportedKeys$2))
|
|
901
|
+
statuses.clear();
|
|
902
|
+
onDown?.(toHookApi(api));
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
if (preventsDefaultUnlessDenied)
|
|
906
|
+
event.preventDefault();
|
|
907
|
+
const { getMetadata } = api, metadata = getMetadata();
|
|
908
|
+
metadata.pressed = downCombos[0];
|
|
909
|
+
localStatus = "recognizing";
|
|
910
|
+
cleanup();
|
|
911
|
+
storeKeyboardTimeMetadata({
|
|
912
|
+
event,
|
|
913
|
+
api,
|
|
914
|
+
getTimeMetadata: getMetadata,
|
|
915
|
+
getShouldStore: () => downCombos.length && getDownCombos()[0] === downCombos[0],
|
|
916
|
+
setRequest: (newRequest) => request = newRequest,
|
|
917
|
+
recognize
|
|
918
|
+
});
|
|
919
|
+
onDown?.(toHookApi(api));
|
|
920
|
+
};
|
|
921
|
+
const recognize = (event, api) => {
|
|
922
|
+
const { getMetadata, recognized } = api, metadata = getMetadata();
|
|
923
|
+
if (metadata.duration >= minDuration) {
|
|
924
|
+
recognized();
|
|
925
|
+
localStatus = "recognized";
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
const keyup = (event, api) => {
|
|
930
|
+
const { denied } = api, key = fromEventToKeyStatusKey(event);
|
|
931
|
+
if (localStatus === "denied") {
|
|
932
|
+
denied();
|
|
933
|
+
if (lazyCollections.includes(event.key)(unsupportedKeys$2))
|
|
934
|
+
statuses.clear();
|
|
935
|
+
else
|
|
936
|
+
statuses.delete(key);
|
|
937
|
+
if (!predicateSomeKeyDown(statuses))
|
|
938
|
+
localStatus = "recognizing";
|
|
939
|
+
onUp?.(toHookApi(api));
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
statuses.delete(key);
|
|
943
|
+
const downCombos = getDownCombos(), matches = matchPredicatesByKeycombo[downCombos[0]]?.(statuses);
|
|
944
|
+
if (downCombos.length && matches) {
|
|
945
|
+
const { getMetadata } = api, metadata = getMetadata();
|
|
946
|
+
metadata.pressed = downCombos[0];
|
|
947
|
+
if (preventsDefaultUnlessDenied)
|
|
948
|
+
event.preventDefault();
|
|
949
|
+
localStatus = "recognizing";
|
|
950
|
+
onUp?.(toHookApi(api));
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
denied();
|
|
954
|
+
cleanup();
|
|
955
|
+
onUp?.(toHookApi(api));
|
|
956
|
+
};
|
|
957
|
+
const visibilitychange = (event, api) => {
|
|
958
|
+
if (document.visibilityState === "hidden") {
|
|
959
|
+
statuses.clear();
|
|
960
|
+
localStatus = "recognizing";
|
|
961
|
+
cleanup();
|
|
962
|
+
}
|
|
963
|
+
onVisibilitychange?.(toHookApi(api));
|
|
964
|
+
};
|
|
965
|
+
return {
|
|
966
|
+
keydown,
|
|
967
|
+
keyup,
|
|
968
|
+
visibilitychange
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
const unsupportedAliases$2 = ["meta", "command", "cmd"];
|
|
972
|
+
const unsupportedKeys$2 = ["Meta"];
|
|
973
|
+
|
|
974
|
+
const defaultOptions$h = {
|
|
975
|
+
minDuration: 0,
|
|
976
|
+
preventsDefaultUnlessDenied: true,
|
|
977
|
+
toKey: (alias) => fromAliasToKeyStatusKey(alias),
|
|
978
|
+
toAliases: (event) => fromEventToAliases(event)
|
|
979
|
+
};
|
|
980
|
+
function createKeyrelease(keycomboOrKeycombos, options = {}) {
|
|
981
|
+
const {
|
|
982
|
+
minDuration,
|
|
983
|
+
preventsDefaultUnlessDenied,
|
|
984
|
+
toKey,
|
|
985
|
+
toAliases,
|
|
986
|
+
onDown,
|
|
987
|
+
onUp,
|
|
988
|
+
onVisibilitychange
|
|
989
|
+
} = { ...defaultOptions$h, ...options }, {
|
|
990
|
+
matchPredicatesByKeycombo,
|
|
991
|
+
getDownCombos,
|
|
992
|
+
predicateValid,
|
|
993
|
+
cleanup,
|
|
994
|
+
statuses
|
|
995
|
+
} = createKeyState({
|
|
996
|
+
keycomboOrKeycombos,
|
|
997
|
+
unsupportedAliases: unsupportedAliases$1,
|
|
998
|
+
toKey,
|
|
999
|
+
toAliases,
|
|
1000
|
+
getRequest: () => request
|
|
1001
|
+
});
|
|
1002
|
+
let request, localStatus;
|
|
1003
|
+
const keydown = (event, api) => {
|
|
1004
|
+
const { denied, getStatus } = api, key = fromEventToKeyStatusKey(event);
|
|
1005
|
+
if (statuses.toValue(key) === "down") {
|
|
1006
|
+
onDown?.(toHookApi(api));
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
statuses.set(key, "down");
|
|
1010
|
+
if (localStatus === "denied") {
|
|
1011
|
+
denied();
|
|
1012
|
+
onDown?.(toHookApi(api));
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
const downCombos = getDownCombos();
|
|
1016
|
+
if (
|
|
1017
|
+
// NOT BUILDING VALID COMBO
|
|
1018
|
+
!predicateValid(event) || downCombos.length > 1 && fromComboToAliasesLength(downCombos[0]) === fromComboToAliasesLength(downCombos[1])
|
|
1019
|
+
) {
|
|
1020
|
+
denied();
|
|
1021
|
+
localStatus = getStatus();
|
|
1022
|
+
if (lazyCollections.includes(event.key)(unsupportedKeys$1))
|
|
1023
|
+
statuses.clear();
|
|
1024
|
+
onDown?.(toHookApi(api));
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
if (preventsDefaultUnlessDenied)
|
|
1028
|
+
event.preventDefault();
|
|
1029
|
+
const { getMetadata } = api;
|
|
1030
|
+
localStatus = "recognizing";
|
|
1031
|
+
cleanup();
|
|
1032
|
+
storeKeyboardTimeMetadata({
|
|
1033
|
+
event,
|
|
1034
|
+
api,
|
|
1035
|
+
getTimeMetadata: getMetadata,
|
|
1036
|
+
getShouldStore: () => downCombos.length && getDownCombos()[0] === downCombos[0],
|
|
1037
|
+
setRequest: (newRequest) => request = newRequest
|
|
1038
|
+
});
|
|
1039
|
+
onDown?.(toHookApi(api));
|
|
1040
|
+
};
|
|
1041
|
+
const keyup = (event, api) => {
|
|
1042
|
+
const {
|
|
1043
|
+
getStatus,
|
|
1044
|
+
getMetadata,
|
|
1045
|
+
denied
|
|
1046
|
+
} = api, metadata = getMetadata(), key = fromEventToKeyStatusKey(event);
|
|
1047
|
+
if (["denied", "recognized"].includes(localStatus)) {
|
|
1048
|
+
if (localStatus === "denied")
|
|
1049
|
+
denied();
|
|
1050
|
+
if (lazyCollections.includes(event.key)(unsupportedKeys$1))
|
|
1051
|
+
statuses.clear();
|
|
1052
|
+
else
|
|
1053
|
+
statuses.delete(key);
|
|
1054
|
+
if (!predicateSomeKeyDown(statuses))
|
|
1055
|
+
localStatus = "recognizing";
|
|
1056
|
+
onUp?.(toHookApi(api));
|
|
1057
|
+
return;
|
|
1058
|
+
}
|
|
1059
|
+
const downCombos = getDownCombos(), matches = matchPredicatesByKeycombo[downCombos[0]]?.(statuses);
|
|
1060
|
+
statuses.delete(key);
|
|
1061
|
+
if (!downCombos.length || !matches) {
|
|
1062
|
+
onUp?.(toHookApi(api));
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
recognize(event, api);
|
|
1066
|
+
const status = getStatus();
|
|
1067
|
+
if (status === "recognized") {
|
|
1068
|
+
localStatus = status;
|
|
1069
|
+
metadata.released = downCombos[0];
|
|
1070
|
+
}
|
|
1071
|
+
if (preventsDefaultUnlessDenied)
|
|
1072
|
+
event.preventDefault();
|
|
1073
|
+
onUp?.(toHookApi(api));
|
|
1074
|
+
};
|
|
1075
|
+
const recognize = (event, api) => {
|
|
1076
|
+
const { getMetadata, recognized, denied } = api, metadata = getMetadata();
|
|
1077
|
+
if (metadata.duration < minDuration) {
|
|
1078
|
+
denied();
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
recognized();
|
|
1082
|
+
};
|
|
1083
|
+
const visibilitychange = (event, api) => {
|
|
1084
|
+
if (document.visibilityState === "hidden") {
|
|
1085
|
+
statuses.clear();
|
|
1086
|
+
localStatus = "recognizing";
|
|
1087
|
+
cleanup();
|
|
1088
|
+
}
|
|
1089
|
+
onVisibilitychange?.(toHookApi(api));
|
|
1090
|
+
};
|
|
1091
|
+
return {
|
|
1092
|
+
keydown,
|
|
1093
|
+
keyup,
|
|
1094
|
+
visibilitychange
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
const unsupportedAliases$1 = ["meta", "command", "cmd"];
|
|
1098
|
+
const unsupportedKeys$1 = ["Meta"];
|
|
1099
|
+
|
|
1100
|
+
const defaultOptions$g = {
|
|
1101
|
+
minDuration: 0,
|
|
1102
|
+
maxInterval: 5e3,
|
|
1103
|
+
// VS Code default
|
|
1104
|
+
preventsDefaultUnlessDenied: true,
|
|
1105
|
+
toKey: (alias) => fromAliasToKeyStatusKey(alias),
|
|
1106
|
+
toAliases: (event) => fromEventToAliases(event)
|
|
1107
|
+
};
|
|
1108
|
+
function createKeychord(keychord, options = {}) {
|
|
1109
|
+
const {
|
|
1110
|
+
minDuration,
|
|
1111
|
+
maxInterval,
|
|
1112
|
+
preventsDefaultUnlessDenied,
|
|
1113
|
+
toKey,
|
|
1114
|
+
toAliases,
|
|
1115
|
+
onDown,
|
|
1116
|
+
onUp,
|
|
1117
|
+
onVisibilitychange
|
|
1118
|
+
} = { ...defaultOptions$g, ...options }, narrowedKeychord = keychord.split(" "), keyStates = createMap((keycombo) => createKeyState({
|
|
1119
|
+
keycomboOrKeycombos: keycombo,
|
|
1120
|
+
unsupportedAliases,
|
|
1121
|
+
toKey,
|
|
1122
|
+
toAliases,
|
|
1123
|
+
getRequest: () => request
|
|
1124
|
+
}))(narrowedKeychord), localStatuses = createMap(
|
|
1125
|
+
() => "recognizing"
|
|
1126
|
+
)(keyStates);
|
|
1127
|
+
let request, playedIndex = 0;
|
|
1128
|
+
const keydown = (event, api) => {
|
|
1129
|
+
const { denied, getStatus } = api, key = fromEventToKeyStatusKey(event);
|
|
1130
|
+
if (keyStates[playedIndex].statuses.toValue(key) === "down") {
|
|
1131
|
+
onDown?.(toHookApi(api));
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
if (localStatuses[playedIndex] === "recognized") {
|
|
1135
|
+
playedIndex++;
|
|
1136
|
+
for (const [key2, status] of keyStates[playedIndex - 1].statuses.toEntries()) {
|
|
1137
|
+
keyStates[playedIndex].statuses.set(key2, status);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
keyStates[playedIndex].statuses.set(key, "down");
|
|
1141
|
+
if (localStatuses[playedIndex] === "denied") {
|
|
1142
|
+
denied();
|
|
1143
|
+
onDown?.(toHookApi(api));
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
const { getMetadata } = api, metadata = getMetadata(), downCombos = keyStates[playedIndex].getDownCombos();
|
|
1147
|
+
if (playedIndex === 0)
|
|
1148
|
+
metadata.played = [];
|
|
1149
|
+
if (
|
|
1150
|
+
// NOT BUILDING VALID COMBO
|
|
1151
|
+
!keyStates[playedIndex].predicateValid(event) || downCombos.length > 1 && fromComboToAliasesLength(downCombos[0]) === fromComboToAliasesLength(downCombos[1]) || playedIndex > 0 && event.timeStamp - metadata.played[playedIndex - 1].times.end > maxInterval
|
|
1152
|
+
) {
|
|
1153
|
+
denied();
|
|
1154
|
+
localStatuses[playedIndex] = getStatus();
|
|
1155
|
+
if (lazyCollections.includes(event.key)(unsupportedKeys)) {
|
|
1156
|
+
for (const { statuses } of keyStates)
|
|
1157
|
+
statuses.clear();
|
|
1158
|
+
}
|
|
1159
|
+
onDown?.(toHookApi(api));
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
if (preventsDefaultUnlessDenied)
|
|
1163
|
+
event.preventDefault();
|
|
1164
|
+
localStatuses[playedIndex] = "recognizing";
|
|
1165
|
+
keyStates[playedIndex].cleanup();
|
|
1166
|
+
storeKeyboardTimeMetadata({
|
|
1167
|
+
event,
|
|
1168
|
+
api,
|
|
1169
|
+
getTimeMetadata: () => {
|
|
1170
|
+
const metadata2 = getMetadata();
|
|
1171
|
+
return metadata2.played[playedIndex] || (metadata2.played[playedIndex] = {});
|
|
1172
|
+
},
|
|
1173
|
+
getShouldStore: () => downCombos.length && keyStates[playedIndex].getDownCombos()[0] === downCombos[0],
|
|
1174
|
+
setRequest: (newRequest) => request = newRequest
|
|
1175
|
+
});
|
|
1176
|
+
onDown?.(toHookApi(api));
|
|
1177
|
+
};
|
|
1178
|
+
const keyup = (event, api) => {
|
|
1179
|
+
const {
|
|
1180
|
+
getStatus,
|
|
1181
|
+
getMetadata,
|
|
1182
|
+
denied
|
|
1183
|
+
} = api, metadata = getMetadata(), key = fromEventToKeyStatusKey(event);
|
|
1184
|
+
if (["denied", "recognized"].includes(localStatuses[playedIndex])) {
|
|
1185
|
+
if (localStatuses[playedIndex] === "denied")
|
|
1186
|
+
denied();
|
|
1187
|
+
for (const { statuses } of keyStates) {
|
|
1188
|
+
if (lazyCollections.includes(event.key)(unsupportedKeys))
|
|
1189
|
+
statuses.clear();
|
|
1190
|
+
else
|
|
1191
|
+
statuses.delete(key);
|
|
1192
|
+
}
|
|
1193
|
+
if (!predicateSomeKeyDown(keyStates[playedIndex].statuses)) {
|
|
1194
|
+
if (localStatuses[playedIndex] === "denied" || playedIndex === narrowedKeychord.length - 1 && localStatuses[playedIndex] === "recognized") {
|
|
1195
|
+
playedIndex = 0;
|
|
1196
|
+
for (let i = 0; i < localStatuses.length; i++)
|
|
1197
|
+
localStatuses[i] = "recognizing";
|
|
1198
|
+
for (const { statuses } of keyStates)
|
|
1199
|
+
statuses.clear();
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
onUp?.(toHookApi(api));
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
const downCombos = keyStates[playedIndex].getDownCombos(), matches = keyStates[playedIndex].matchPredicatesByKeycombo[downCombos[0]]?.(keyStates[playedIndex].statuses);
|
|
1206
|
+
keyStates[playedIndex].statuses.delete(key);
|
|
1207
|
+
if (!downCombos.length || !matches) {
|
|
1208
|
+
onUp?.(toHookApi(api));
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
recognize(event, api);
|
|
1212
|
+
const status = getStatus();
|
|
1213
|
+
if (status === "recognizing" && localStatuses[playedIndex] === "recognized" || status === "recognized") {
|
|
1214
|
+
metadata.played[playedIndex] = {
|
|
1215
|
+
...metadata.played[playedIndex],
|
|
1216
|
+
released: downCombos[0]
|
|
1217
|
+
};
|
|
1218
|
+
}
|
|
1219
|
+
if (preventsDefaultUnlessDenied)
|
|
1220
|
+
event.preventDefault();
|
|
1221
|
+
if (playedIndex === narrowedKeychord.length - 1 && !predicateSomeKeyDown(keyStates[playedIndex].statuses)) {
|
|
1222
|
+
playedIndex = 0;
|
|
1223
|
+
for (let i = 0; i < localStatuses.length; i++)
|
|
1224
|
+
localStatuses[i] = "recognizing";
|
|
1225
|
+
for (const { statuses } of keyStates)
|
|
1226
|
+
statuses.clear();
|
|
1227
|
+
}
|
|
1228
|
+
onUp?.(toHookApi(api));
|
|
1229
|
+
};
|
|
1230
|
+
const recognize = (event, api) => {
|
|
1231
|
+
const { getMetadata, recognized, denied } = api, metadata = getMetadata();
|
|
1232
|
+
if (metadata.played[playedIndex].duration < minDuration) {
|
|
1233
|
+
denied();
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
if (playedIndex === narrowedKeychord.length - 1) {
|
|
1237
|
+
recognized();
|
|
1238
|
+
localStatuses[playedIndex] = "recognized";
|
|
1239
|
+
return;
|
|
1240
|
+
}
|
|
1241
|
+
localStatuses[playedIndex] = "recognized";
|
|
1242
|
+
};
|
|
1243
|
+
const visibilitychange = (event, api) => {
|
|
1244
|
+
if (document.visibilityState === "hidden") {
|
|
1245
|
+
for (const { statuses } of keyStates)
|
|
1246
|
+
statuses.clear();
|
|
1247
|
+
localStatuses[playedIndex] = "recognizing";
|
|
1248
|
+
keyStates[playedIndex].cleanup();
|
|
1249
|
+
playedIndex = 0;
|
|
1250
|
+
}
|
|
1251
|
+
onVisibilitychange?.(toHookApi(api));
|
|
1252
|
+
};
|
|
1253
|
+
return {
|
|
1254
|
+
keydown,
|
|
1255
|
+
keyup,
|
|
1256
|
+
visibilitychange
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
const unsupportedAliases = ["meta", "command", "cmd"];
|
|
1260
|
+
const unsupportedKeys = ["Meta"];
|
|
1261
|
+
|
|
1262
|
+
function createKonami(options = {}) {
|
|
1263
|
+
return createKeychord("up up down down left right left right b a enter", options);
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
const defaultOptions$f = {
|
|
1267
|
+
minDuration: 0,
|
|
1268
|
+
minDistance: 0,
|
|
1269
|
+
getMousemoveTarget: (event) => event.target
|
|
1270
|
+
};
|
|
1271
|
+
function createMousepress(options = {}) {
|
|
1272
|
+
const {
|
|
1273
|
+
minDuration,
|
|
1274
|
+
minDistance,
|
|
1275
|
+
getMousemoveTarget,
|
|
1276
|
+
onDown,
|
|
1277
|
+
onLeave,
|
|
1278
|
+
onMove,
|
|
1279
|
+
onUp
|
|
1280
|
+
} = { ...defaultOptions$f, ...options }, cleanup = (event) => {
|
|
1281
|
+
window.cancelAnimationFrame(request);
|
|
1282
|
+
getMousemoveTarget(event).removeEventListener("mousemove", mousemoveEffect);
|
|
1283
|
+
};
|
|
1284
|
+
let request;
|
|
1285
|
+
let mousemoveEffect;
|
|
1286
|
+
let mouseStatus;
|
|
1287
|
+
const mousedown = (event, api) => {
|
|
1288
|
+
mouseStatus = "down";
|
|
1289
|
+
mousemoveEffect = (event2) => mousemove(event2, api);
|
|
1290
|
+
storePointerStartMetadata(event, api);
|
|
1291
|
+
storePointerMoveMetadata(event, api);
|
|
1292
|
+
storePointerTimeMetadata(
|
|
1293
|
+
event,
|
|
1294
|
+
api,
|
|
1295
|
+
() => mouseStatus === "down",
|
|
1296
|
+
(newRequest) => request = newRequest,
|
|
1297
|
+
recognize
|
|
1298
|
+
);
|
|
1299
|
+
getMousemoveTarget(event).addEventListener("mousemove", mousemoveEffect);
|
|
1300
|
+
onDown?.(toHookApi(api));
|
|
1301
|
+
};
|
|
1302
|
+
const mousemove = (event, api) => {
|
|
1303
|
+
storePointerMoveMetadata(event, api);
|
|
1304
|
+
recognize(event, api);
|
|
1305
|
+
onMove?.(toHookApi(api));
|
|
1306
|
+
};
|
|
1307
|
+
const recognize = (event, api) => {
|
|
1308
|
+
const { getMetadata, recognized } = api, metadata = getMetadata();
|
|
1309
|
+
if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance) {
|
|
1310
|
+
recognized();
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
const mouseleave = (event, api) => {
|
|
1314
|
+
const { denied } = api;
|
|
1315
|
+
if (mouseStatus === "down") {
|
|
1316
|
+
denied();
|
|
1317
|
+
cleanup(event);
|
|
1318
|
+
mouseStatus = "leave";
|
|
1319
|
+
}
|
|
1320
|
+
onLeave?.(toHookApi(api));
|
|
1321
|
+
};
|
|
1322
|
+
const mouseup = (event, api) => {
|
|
1323
|
+
const { denied } = api;
|
|
1324
|
+
if (mouseStatus !== "down")
|
|
1325
|
+
return;
|
|
1326
|
+
denied();
|
|
1327
|
+
cleanup(event);
|
|
1328
|
+
mouseStatus = "up";
|
|
1329
|
+
onUp?.(toHookApi(api));
|
|
1330
|
+
};
|
|
1331
|
+
return {
|
|
1332
|
+
mousedown,
|
|
1333
|
+
mouseleave,
|
|
1334
|
+
mouseup
|
|
1335
|
+
};
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
const defaultOptions$e = {
|
|
1339
|
+
minDuration: 0,
|
|
1340
|
+
minDistance: 0,
|
|
1341
|
+
minVelocity: 0,
|
|
1342
|
+
getMousemoveTarget: (event) => event.target
|
|
1343
|
+
};
|
|
1344
|
+
function createMouserelease(options = {}) {
|
|
1345
|
+
const {
|
|
1346
|
+
minDuration,
|
|
1347
|
+
minDistance,
|
|
1348
|
+
minVelocity,
|
|
1349
|
+
getMousemoveTarget,
|
|
1350
|
+
onDown,
|
|
1351
|
+
onLeave,
|
|
1352
|
+
onMove,
|
|
1353
|
+
onUp
|
|
1354
|
+
} = { ...defaultOptions$e, ...options }, cleanup = (event) => {
|
|
1355
|
+
window.cancelAnimationFrame(request);
|
|
1356
|
+
getMousemoveTarget(event).removeEventListener("mousemove", mousemoveEffect);
|
|
1357
|
+
};
|
|
1358
|
+
let request;
|
|
1359
|
+
let mousemoveEffect;
|
|
1360
|
+
let mouseStatus;
|
|
1361
|
+
const mousedown = (event, api) => {
|
|
1362
|
+
mouseStatus = "down";
|
|
1363
|
+
mousemoveEffect = (event2) => mousemove(event2, api);
|
|
1364
|
+
storePointerStartMetadata(event, api);
|
|
1365
|
+
storePointerMoveMetadata(event, api);
|
|
1366
|
+
storePointerTimeMetadata(
|
|
1367
|
+
event,
|
|
1368
|
+
api,
|
|
1369
|
+
() => mouseStatus === "down",
|
|
1370
|
+
(newRequest) => request = newRequest
|
|
1371
|
+
);
|
|
1372
|
+
getMousemoveTarget(event).addEventListener("mousemove", mousemoveEffect);
|
|
1373
|
+
onDown?.(toHookApi(api));
|
|
1374
|
+
};
|
|
1375
|
+
const mousemove = (event, api) => {
|
|
1376
|
+
storePointerMoveMetadata(event, api);
|
|
1377
|
+
onMove?.(toHookApi(api));
|
|
1378
|
+
};
|
|
1379
|
+
const mouseleave = (event, api) => {
|
|
1380
|
+
const { denied } = api;
|
|
1381
|
+
if (mouseStatus === "down") {
|
|
1382
|
+
denied();
|
|
1383
|
+
cleanup(event);
|
|
1384
|
+
mouseStatus = "leave";
|
|
1385
|
+
}
|
|
1386
|
+
onLeave?.(toHookApi(api));
|
|
1387
|
+
};
|
|
1388
|
+
const mouseup = (event, api) => {
|
|
1389
|
+
if (mouseStatus !== "down")
|
|
1390
|
+
return;
|
|
1391
|
+
storePointerMoveMetadata(event, api);
|
|
1392
|
+
cleanup(event);
|
|
1393
|
+
mouseStatus = "up";
|
|
1394
|
+
recognize(event, api);
|
|
1395
|
+
onUp?.(toHookApi(api));
|
|
1396
|
+
};
|
|
1397
|
+
const recognize = (event, api) => {
|
|
1398
|
+
const { getMetadata, recognized, denied } = api, metadata = getMetadata();
|
|
1399
|
+
if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance && metadata.velocity >= minVelocity) {
|
|
1400
|
+
recognized();
|
|
1401
|
+
} else {
|
|
1402
|
+
denied();
|
|
1403
|
+
}
|
|
1404
|
+
};
|
|
1405
|
+
return {
|
|
1406
|
+
mousedown,
|
|
1407
|
+
mouseleave,
|
|
1408
|
+
mouseup
|
|
1409
|
+
};
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
const defaultOptions$d = {
|
|
1413
|
+
minDuration: 0,
|
|
1414
|
+
minDistance: 0
|
|
1415
|
+
};
|
|
1416
|
+
function createTouchpress(options = {}) {
|
|
1417
|
+
const {
|
|
1418
|
+
minDuration,
|
|
1419
|
+
minDistance,
|
|
1420
|
+
onStart,
|
|
1421
|
+
onCancel,
|
|
1422
|
+
onMove,
|
|
1423
|
+
onEnd
|
|
1424
|
+
} = { ...defaultOptions$d, ...options }, cleanup = () => {
|
|
1425
|
+
window.cancelAnimationFrame(request);
|
|
1426
|
+
};
|
|
1427
|
+
let request;
|
|
1428
|
+
let totalTouches = 0;
|
|
1429
|
+
const touchstart = (event, api) => {
|
|
1430
|
+
const { denied } = api;
|
|
1431
|
+
totalTouches++;
|
|
1432
|
+
if (totalTouches > 1) {
|
|
1433
|
+
cleanup();
|
|
1434
|
+
denied();
|
|
1435
|
+
onStart?.(toHookApi(api));
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
storePointerStartMetadata(event, api);
|
|
1439
|
+
storePointerMoveMetadata(event, api);
|
|
1440
|
+
storePointerTimeMetadata(
|
|
1441
|
+
event,
|
|
1442
|
+
api,
|
|
1443
|
+
() => totalTouches === 1,
|
|
1444
|
+
(newRequest) => request = newRequest,
|
|
1445
|
+
recognize
|
|
1446
|
+
);
|
|
1447
|
+
onStart?.(toHookApi(api));
|
|
1448
|
+
};
|
|
1449
|
+
const touchmove = (event, api) => {
|
|
1450
|
+
const { getStatus } = api;
|
|
1451
|
+
if (getStatus() !== "denied") {
|
|
1452
|
+
storePointerMoveMetadata(event, api);
|
|
1453
|
+
recognize(event, api);
|
|
1454
|
+
}
|
|
1455
|
+
onMove?.(toHookApi(api));
|
|
1456
|
+
};
|
|
1457
|
+
const recognize = (event, api) => {
|
|
1458
|
+
const { getMetadata, recognized } = api, metadata = getMetadata();
|
|
1459
|
+
if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance) {
|
|
1460
|
+
recognized();
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1463
|
+
const touchcancel = (event, api) => {
|
|
1464
|
+
const { denied } = api;
|
|
1465
|
+
cleanup();
|
|
1466
|
+
denied();
|
|
1467
|
+
totalTouches--;
|
|
1468
|
+
onCancel?.(toHookApi(api));
|
|
1469
|
+
};
|
|
1470
|
+
const touchend = (event, api) => {
|
|
1471
|
+
const { denied } = api;
|
|
1472
|
+
cleanup();
|
|
1473
|
+
denied();
|
|
1474
|
+
totalTouches--;
|
|
1475
|
+
onEnd?.(toHookApi(api));
|
|
1476
|
+
};
|
|
1477
|
+
return {
|
|
1478
|
+
touchstart,
|
|
1479
|
+
touchmove,
|
|
1480
|
+
touchcancel,
|
|
1481
|
+
touchend
|
|
1482
|
+
};
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
const defaultOptions$c = {
|
|
1486
|
+
minDuration: 0,
|
|
1487
|
+
minDistance: 0,
|
|
1488
|
+
minVelocity: 0
|
|
1489
|
+
};
|
|
1490
|
+
function createTouchrelease(options = {}) {
|
|
1491
|
+
const {
|
|
1492
|
+
minDuration,
|
|
1493
|
+
minDistance,
|
|
1494
|
+
minVelocity,
|
|
1495
|
+
onStart,
|
|
1496
|
+
onCancel,
|
|
1497
|
+
onMove,
|
|
1498
|
+
onEnd
|
|
1499
|
+
} = { ...defaultOptions$c, ...options }, cleanup = () => {
|
|
1500
|
+
window.cancelAnimationFrame(request);
|
|
1501
|
+
};
|
|
1502
|
+
let request;
|
|
1503
|
+
let totalTouches = 0;
|
|
1504
|
+
const touchstart = (event, api) => {
|
|
1505
|
+
const { denied } = api;
|
|
1506
|
+
totalTouches++;
|
|
1507
|
+
if (totalTouches > 1) {
|
|
1508
|
+
cleanup();
|
|
1509
|
+
denied();
|
|
1510
|
+
onStart?.(toHookApi(api));
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
storePointerStartMetadata(event, api);
|
|
1514
|
+
storePointerMoveMetadata(event, api);
|
|
1515
|
+
storePointerTimeMetadata(
|
|
1516
|
+
event,
|
|
1517
|
+
api,
|
|
1518
|
+
() => totalTouches === 1,
|
|
1519
|
+
(newRequest) => request = newRequest
|
|
1520
|
+
);
|
|
1521
|
+
onStart?.(toHookApi(api));
|
|
1522
|
+
};
|
|
1523
|
+
const touchmove = (event, api) => {
|
|
1524
|
+
const { getStatus } = api;
|
|
1525
|
+
if (getStatus() !== "denied")
|
|
1526
|
+
storePointerMoveMetadata(event, api);
|
|
1527
|
+
onMove?.(toHookApi(api));
|
|
1528
|
+
};
|
|
1529
|
+
const touchcancel = (event, api) => {
|
|
1530
|
+
const { denied } = api;
|
|
1531
|
+
cleanup();
|
|
1532
|
+
denied();
|
|
1533
|
+
totalTouches--;
|
|
1534
|
+
onCancel?.(toHookApi(api));
|
|
1535
|
+
};
|
|
1536
|
+
const touchend = (event, api) => {
|
|
1537
|
+
const { denied } = api;
|
|
1538
|
+
if (totalTouches !== 1) {
|
|
1539
|
+
cleanup();
|
|
1540
|
+
denied();
|
|
1541
|
+
onEnd?.(toHookApi(api));
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
storePointerMoveMetadata(event, api);
|
|
1545
|
+
cleanup();
|
|
1546
|
+
totalTouches--;
|
|
1547
|
+
recognize(event, api);
|
|
1548
|
+
onEnd?.(toHookApi(api));
|
|
1549
|
+
};
|
|
1550
|
+
const recognize = (event, api) => {
|
|
1551
|
+
const { getMetadata, recognized, denied } = api, metadata = getMetadata();
|
|
1552
|
+
if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance && metadata.velocity >= minVelocity) {
|
|
1553
|
+
recognized();
|
|
1554
|
+
} else {
|
|
1555
|
+
denied();
|
|
1556
|
+
}
|
|
1557
|
+
};
|
|
1558
|
+
return {
|
|
1559
|
+
touchstart,
|
|
1560
|
+
touchmove,
|
|
1561
|
+
touchcancel,
|
|
1562
|
+
touchend
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
const defaultOptions$b = {
|
|
1567
|
+
initial: []
|
|
1568
|
+
};
|
|
1569
|
+
function createKeyStatuses(options = {}) {
|
|
1570
|
+
return createAssociativeArray({
|
|
1571
|
+
...defaultOptions$b,
|
|
1572
|
+
...options,
|
|
1573
|
+
createPredicateKey: (query) => (key) => {
|
|
1574
|
+
for (const prop in query) {
|
|
1575
|
+
if (query[prop] !== key[prop]) {
|
|
1576
|
+
return false;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
return true;
|
|
1580
|
+
}
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
function predicateDown(status) {
|
|
1584
|
+
return status === "down";
|
|
1585
|
+
}
|
|
1586
|
+
function predicateSomeKeyDown(statuses) {
|
|
1587
|
+
return lazyCollections.includes("down")(statuses.toValues());
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
function fromComboToAliases(combo) {
|
|
1591
|
+
const delimiter = "+";
|
|
1592
|
+
return lazyCollections.pipe(
|
|
1593
|
+
lazyCollections.unique(),
|
|
1594
|
+
lazyCollections.map((name) => name === "" ? delimiter : name.toLowerCase()),
|
|
1595
|
+
lazyCollections.toArray()
|
|
1596
|
+
)(combo.split(delimiter));
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
function fromAliasToKeyStatusKey(alias) {
|
|
1600
|
+
if (alias in keysByAlias) {
|
|
1601
|
+
return { key: keysByAlias[alias] };
|
|
1602
|
+
}
|
|
1603
|
+
return {
|
|
1604
|
+
code: (() => {
|
|
1605
|
+
if (alias in codesByAlias)
|
|
1606
|
+
return codesByAlias[alias];
|
|
1607
|
+
if (letterRE.test(alias))
|
|
1608
|
+
return `Key${alias.toUpperCase()}`;
|
|
1609
|
+
if (digitRE.test(alias))
|
|
1610
|
+
return `Digit${alias}`;
|
|
1611
|
+
if (functionRE.test(alias))
|
|
1612
|
+
return alias.toUpperCase();
|
|
1613
|
+
return "unsupported";
|
|
1614
|
+
})()
|
|
1615
|
+
};
|
|
1616
|
+
}
|
|
1617
|
+
const digitRE = /^[0-9]$/;
|
|
1618
|
+
const letterRE = /^[a-zA-Z]$/;
|
|
1619
|
+
const functionRE = /^[fF][0-9]{1,2}$/;
|
|
1620
|
+
const codesByAlias = {
|
|
1621
|
+
"`": "Backquote",
|
|
1622
|
+
"~": "Backquote",
|
|
1623
|
+
"-": "Minus",
|
|
1624
|
+
_: "Minus",
|
|
1625
|
+
"=": "Equal",
|
|
1626
|
+
"+": "Equal",
|
|
1627
|
+
"[": "BracketLeft",
|
|
1628
|
+
"{": "BracketLeft",
|
|
1629
|
+
"]": "BracketRight",
|
|
1630
|
+
"}": "BracketRight",
|
|
1631
|
+
"\\": "Backslash",
|
|
1632
|
+
"|": "Backslash",
|
|
1633
|
+
";": "Semicolon",
|
|
1634
|
+
":": "Semicolon",
|
|
1635
|
+
"'": "Quote",
|
|
1636
|
+
'"': "Quote",
|
|
1637
|
+
",": "Comma",
|
|
1638
|
+
"<": "Comma",
|
|
1639
|
+
".": "Period",
|
|
1640
|
+
">": "Period",
|
|
1641
|
+
"/": "Slash",
|
|
1642
|
+
"?": "Slash",
|
|
1643
|
+
"!": "Digit1",
|
|
1644
|
+
"@": "Digit2",
|
|
1645
|
+
"#": "Digit3",
|
|
1646
|
+
$: "Digit4",
|
|
1647
|
+
"%": "Digit5",
|
|
1648
|
+
"^": "Digit6",
|
|
1649
|
+
"&": "Digit7",
|
|
1650
|
+
"*": "Digit8",
|
|
1651
|
+
"(": "Digit9",
|
|
1652
|
+
")": "Digit0",
|
|
1653
|
+
up: "ArrowUp",
|
|
1654
|
+
down: "ArrowDown",
|
|
1655
|
+
left: "ArrowLeft",
|
|
1656
|
+
right: "ArrowRight",
|
|
1657
|
+
enter: "Enter",
|
|
1658
|
+
space: "Space",
|
|
1659
|
+
tab: "Tab",
|
|
1660
|
+
esc: "Escape",
|
|
1661
|
+
backspace: "Backspace",
|
|
1662
|
+
delete: "Delete",
|
|
1663
|
+
home: "Home",
|
|
1664
|
+
end: "End",
|
|
1665
|
+
pagedown: "PageDown",
|
|
1666
|
+
pageup: "PageUp",
|
|
1667
|
+
capslock: "CapsLock",
|
|
1668
|
+
camera: "Camera"
|
|
1669
|
+
};
|
|
1670
|
+
const keysByAlias = {
|
|
1671
|
+
alt: "Alt",
|
|
1672
|
+
opt: "Alt",
|
|
1673
|
+
option: "Alt",
|
|
1674
|
+
ctrl: "Control",
|
|
1675
|
+
control: "Control",
|
|
1676
|
+
meta: "Meta",
|
|
1677
|
+
cmd: "Meta",
|
|
1678
|
+
command: "Meta",
|
|
1679
|
+
shift: "Shift"
|
|
1680
|
+
};
|
|
1681
|
+
|
|
1682
|
+
const defaultOptions$a = {
|
|
1683
|
+
toKey: (alias) => fromAliasToKeyStatusKey(alias)
|
|
1684
|
+
};
|
|
1685
|
+
const createPredicateKeycomboDown = (keycombo, options = {}) => {
|
|
1686
|
+
const { toKey } = { ...defaultOptions$a, ...options }, keys = lazyCollections.pipe(
|
|
1687
|
+
fromComboToAliases,
|
|
1688
|
+
lazyCollections.map(toKey)
|
|
1689
|
+
)(keycombo);
|
|
1690
|
+
return (statuses) => {
|
|
1691
|
+
const { toValue } = statuses;
|
|
1692
|
+
return lazyCollections.every(lazyCollections.pipe(
|
|
1693
|
+
toValue,
|
|
1694
|
+
predicateDown
|
|
1695
|
+
))(keys);
|
|
1696
|
+
};
|
|
1697
|
+
};
|
|
1698
|
+
|
|
1699
|
+
function fromEventToAliases(event) {
|
|
1700
|
+
if (event.shiftKey && event.code in aliasesByShiftCode) {
|
|
1701
|
+
return [aliasesByShiftCode[event.code]];
|
|
1702
|
+
}
|
|
1703
|
+
if (event.key in aliasListsByModifier) {
|
|
1704
|
+
return aliasListsByModifier[event.key];
|
|
1705
|
+
}
|
|
1706
|
+
return event.code in aliasesByCode ? [aliasesByCode[event.code]] : [event.code.match(aliasCaptureRE)?.[1].toLowerCase() || "unsupported"];
|
|
1707
|
+
}
|
|
1708
|
+
const aliasCaptureRE = /^(?:Digit|Key)?(F[0-9]{1,2}|[0-9]|[A-Z])$/;
|
|
1709
|
+
const aliasesByCode = {
|
|
1710
|
+
Backquote: "`",
|
|
1711
|
+
Minus: "-",
|
|
1712
|
+
Equal: "=",
|
|
1713
|
+
BracketLeft: "[",
|
|
1714
|
+
BracketRight: "]",
|
|
1715
|
+
Backslash: "\\",
|
|
1716
|
+
Semicolon: ";",
|
|
1717
|
+
Quote: "'",
|
|
1718
|
+
Comma: ",",
|
|
1719
|
+
Period: ".",
|
|
1720
|
+
Slash: "/",
|
|
1721
|
+
ArrowUp: "up",
|
|
1722
|
+
ArrowDown: "down",
|
|
1723
|
+
ArrowLeft: "left",
|
|
1724
|
+
ArrowRight: "right",
|
|
1725
|
+
Enter: "enter",
|
|
1726
|
+
Space: "space",
|
|
1727
|
+
Tab: "tab",
|
|
1728
|
+
Escape: "esc",
|
|
1729
|
+
Backspace: "backspace",
|
|
1730
|
+
Delete: "delete",
|
|
1731
|
+
Home: "home",
|
|
1732
|
+
End: "end",
|
|
1733
|
+
PageDown: "pagedown",
|
|
1734
|
+
PageUp: "pageup",
|
|
1735
|
+
CapsLock: "capslock",
|
|
1736
|
+
Camera: "camera"
|
|
1737
|
+
};
|
|
1738
|
+
const aliasesByShiftCode = {
|
|
1739
|
+
Backquote: "~",
|
|
1740
|
+
Minus: "_",
|
|
1741
|
+
Equal: "+",
|
|
1742
|
+
BracketLeft: "{",
|
|
1743
|
+
BracketRight: "}",
|
|
1744
|
+
Backslash: "|",
|
|
1745
|
+
Semicolon: ":",
|
|
1746
|
+
Quote: '"',
|
|
1747
|
+
Comma: "<",
|
|
1748
|
+
Period: ">",
|
|
1749
|
+
Slash: "?",
|
|
1750
|
+
Digit1: "!",
|
|
1751
|
+
Digit2: "@",
|
|
1752
|
+
Digit3: "#",
|
|
1753
|
+
Digit4: "$",
|
|
1754
|
+
Digit5: "%",
|
|
1755
|
+
Digit6: "^",
|
|
1756
|
+
Digit7: "&",
|
|
1757
|
+
Digit8: "*",
|
|
1758
|
+
Digit9: "(",
|
|
1759
|
+
Digit0: ")"
|
|
1760
|
+
};
|
|
1761
|
+
const aliasListsByModifier = {
|
|
1762
|
+
Alt: ["alt", "option", "opt"],
|
|
1763
|
+
Control: ["control", "ctrl"],
|
|
1764
|
+
Meta: ["meta", "command", "cmd"],
|
|
1765
|
+
Shift: ["shift"]
|
|
1766
|
+
};
|
|
1767
|
+
|
|
1768
|
+
const defaultOptions$9 = {
|
|
1769
|
+
toKey: (alias) => fromAliasToKeyStatusKey(alias),
|
|
1770
|
+
toAliases: (event) => fromEventToAliases(event)
|
|
1771
|
+
};
|
|
1772
|
+
const createPredicateKeycomboMatch = (keycombo, options = {}) => {
|
|
1773
|
+
const { toKey, toAliases } = { ...defaultOptions$9, ...options }, aliases = fromComboToAliases(keycombo), keys = lazyCollections.map(toKey)(aliases);
|
|
1774
|
+
return (statuses) => {
|
|
1775
|
+
const { toValue } = statuses;
|
|
1776
|
+
return lazyCollections.every(lazyCollections.pipe(
|
|
1777
|
+
toValue,
|
|
1778
|
+
predicateDown
|
|
1779
|
+
))(keys) && lazyCollections.every(
|
|
1780
|
+
([key, value]) => value === "up" || lazyCollections.some(
|
|
1781
|
+
(alias) => lazyCollections.includes(alias)(aliases)
|
|
1782
|
+
)(toAliases(key))
|
|
1783
|
+
)(statuses.toEntries());
|
|
1784
|
+
};
|
|
1785
|
+
};
|
|
1786
|
+
|
|
1787
|
+
function createKeyState({
|
|
1788
|
+
keycomboOrKeycombos,
|
|
1789
|
+
unsupportedAliases,
|
|
1790
|
+
toKey,
|
|
1791
|
+
toAliases,
|
|
1792
|
+
getRequest
|
|
1793
|
+
}) {
|
|
1794
|
+
const narrowedKeycombos = createFilter(
|
|
1795
|
+
(keycombo) => !lazyCollections.some(
|
|
1796
|
+
(alias) => lazyCollections.includes(alias)(unsupportedAliases)
|
|
1797
|
+
)(fromComboToAliases(keycombo))
|
|
1798
|
+
)(Array.isArray(keycomboOrKeycombos) ? keycomboOrKeycombos : [keycomboOrKeycombos]), createPredicateKeycomboDownOptions = { toKey }, downPredicatesByKeycombo = (() => {
|
|
1799
|
+
const predicates = [];
|
|
1800
|
+
for (const keycombo of narrowedKeycombos) {
|
|
1801
|
+
predicates.push([
|
|
1802
|
+
keycombo,
|
|
1803
|
+
createPredicateKeycomboDown(
|
|
1804
|
+
keycombo,
|
|
1805
|
+
createPredicateKeycomboDownOptions
|
|
1806
|
+
)
|
|
1807
|
+
]);
|
|
167
1808
|
}
|
|
168
|
-
return
|
|
1809
|
+
return predicates;
|
|
1810
|
+
})(), createPredicateKeycomboMatchOptions = { ...createPredicateKeycomboDownOptions, toAliases }, matchPredicatesByKeycombo = (() => {
|
|
1811
|
+
const predicates = {};
|
|
1812
|
+
for (const keycombo of narrowedKeycombos) {
|
|
1813
|
+
predicates[keycombo] = createPredicateKeycomboMatch(
|
|
1814
|
+
keycombo,
|
|
1815
|
+
createPredicateKeycomboMatchOptions
|
|
1816
|
+
);
|
|
1817
|
+
}
|
|
1818
|
+
return predicates;
|
|
1819
|
+
})(), validAliases = lazyCollections.pipe(
|
|
1820
|
+
lazyCollections.flatMap(fromComboToAliases),
|
|
1821
|
+
lazyCollections.unique(),
|
|
1822
|
+
lazyCollections.toArray()
|
|
1823
|
+
)(narrowedKeycombos), getDownCombos = () => lazyCollections.pipe(
|
|
1824
|
+
lazyCollections.filter(([, predicate]) => predicate(statuses)),
|
|
1825
|
+
lazyCollections.map(([keycombo]) => [keycombo, fromComboToAliases(keycombo)]),
|
|
1826
|
+
lazyCollections.sort(([, aliasesA], [, aliasesB]) => aliasesB.length - aliasesA.length),
|
|
1827
|
+
lazyCollections.map(([keycombo]) => keycombo),
|
|
1828
|
+
lazyCollections.toArray()
|
|
1829
|
+
)(downPredicatesByKeycombo), predicateValid = (event) => {
|
|
1830
|
+
const aliases = toAliases(event);
|
|
1831
|
+
return lazyCollections.some(
|
|
1832
|
+
(validAlias) => lazyCollections.includes(validAlias)(aliases)
|
|
1833
|
+
)(validAliases);
|
|
1834
|
+
}, cleanup = () => {
|
|
1835
|
+
window.cancelAnimationFrame(getRequest());
|
|
1836
|
+
}, statuses = createKeyStatuses();
|
|
1837
|
+
return {
|
|
1838
|
+
narrowedKeycombos,
|
|
1839
|
+
createPredicateKeycomboDownOptions,
|
|
1840
|
+
downPredicatesByKeycombo,
|
|
1841
|
+
createPredicateKeycomboMatchOptions,
|
|
1842
|
+
matchPredicatesByKeycombo,
|
|
1843
|
+
validAliases,
|
|
1844
|
+
getDownCombos,
|
|
1845
|
+
predicateValid,
|
|
1846
|
+
cleanup,
|
|
1847
|
+
statuses
|
|
169
1848
|
};
|
|
170
1849
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
(sliced) => compare ? sliced.sort(compare) : sliced.sort()
|
|
176
|
-
);
|
|
1850
|
+
|
|
1851
|
+
function toLength() {
|
|
1852
|
+
return function toLengthFn(data) {
|
|
1853
|
+
return [...data].length;
|
|
177
1854
|
};
|
|
178
1855
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
1856
|
+
|
|
1857
|
+
const fromComboToAliasesLength = lazyCollections.pipe(
|
|
1858
|
+
fromComboToAliases,
|
|
1859
|
+
toLength()
|
|
1860
|
+
);
|
|
1861
|
+
|
|
1862
|
+
function fromEventToKeyStatusKey({ key, code }) {
|
|
1863
|
+
return lazyCollections.includes(key)(modifiers) ? { key } : { code };
|
|
183
1864
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
1865
|
+
const modifiers = ["Alt", "Control", "Meta", "Shift"];
|
|
1866
|
+
|
|
1867
|
+
function toDirection(angle, unit = "degrees") {
|
|
1868
|
+
return Object.keys(directions).find((direction) => directions[direction][unit](angle));
|
|
188
1869
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
1870
|
+
const directions = {
|
|
1871
|
+
up: {
|
|
1872
|
+
degrees: (degrees) => degrees >= 67.5 && degrees <= 112.5,
|
|
1873
|
+
radians: (radians) => radians >= 0.375 * Math.PI && radians <= 0.625 * Math.PI
|
|
1874
|
+
},
|
|
1875
|
+
upRight: {
|
|
1876
|
+
degrees: (degrees) => degrees >= 22.5 && degrees < 67.5,
|
|
1877
|
+
radians: (radians) => radians >= 0.125 * Math.PI && radians < 0.375 * Math.PI
|
|
1878
|
+
},
|
|
1879
|
+
right: {
|
|
1880
|
+
degrees: (degrees) => degrees > 337.5 && degrees <= 360 || degrees < 22.5 && degrees >= 0,
|
|
1881
|
+
radians: (radians) => radians > 1.875 * Math.PI && radians <= 2 * Math.PI || radians < 0.125 * Math.PI && radians >= 0
|
|
1882
|
+
},
|
|
1883
|
+
downRight: {
|
|
1884
|
+
degrees: (degrees) => degrees > 292.5 && degrees <= 337.5,
|
|
1885
|
+
radians: (radians) => radians > 1.625 * Math.PI && radians <= 1.875 * Math.PI
|
|
1886
|
+
},
|
|
1887
|
+
down: {
|
|
1888
|
+
degrees: (degrees) => degrees >= 247.5 && degrees <= 292.5,
|
|
1889
|
+
radians: (radians) => radians >= 1.375 * Math.PI && radians <= 1.625 * Math.PI
|
|
1890
|
+
},
|
|
1891
|
+
downLeft: {
|
|
1892
|
+
degrees: (degrees) => degrees >= 202.5 && degrees < 247.5,
|
|
1893
|
+
radians: (radians) => radians >= 1.125 * Math.PI && radians < 1.375 * Math.PI
|
|
1894
|
+
},
|
|
1895
|
+
left: {
|
|
1896
|
+
degrees: (degrees) => degrees > 157.5 && degrees < 202.5,
|
|
1897
|
+
radians: (radians) => radians > 0.875 * Math.PI && radians < 1.125 * Math.PI
|
|
1898
|
+
},
|
|
1899
|
+
upLeft: {
|
|
1900
|
+
degrees: (degrees) => degrees > 112.5 && degrees <= 157.5,
|
|
1901
|
+
radians: (radians) => radians > 0.625 * Math.PI && radians <= 0.875 * Math.PI
|
|
1902
|
+
}
|
|
1903
|
+
};
|
|
1904
|
+
|
|
1905
|
+
function toHookApi({
|
|
1906
|
+
getSequence,
|
|
1907
|
+
getStatus,
|
|
1908
|
+
getMetadata
|
|
1909
|
+
}) {
|
|
1910
|
+
return {
|
|
1911
|
+
sequence: getSequence(),
|
|
1912
|
+
status: getStatus(),
|
|
1913
|
+
metadata: getMetadata()
|
|
193
1914
|
};
|
|
194
1915
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
return {
|
|
202
|
-
outcome,
|
|
203
|
-
predicate: (determinant) => determinant >= lowerBound && determinant < upperBound || determinant < 0 && index === 0 || index === predicates.length - 1
|
|
204
|
-
};
|
|
205
|
-
})(potentialities);
|
|
206
|
-
return (determinant) => lazyCollections.find(({ predicate }) => predicate(determinant))(predicates).outcome;
|
|
1916
|
+
|
|
1917
|
+
function toMousePoint(event) {
|
|
1918
|
+
return {
|
|
1919
|
+
x: event.clientX,
|
|
1920
|
+
y: event.clientY
|
|
1921
|
+
};
|
|
207
1922
|
}
|
|
208
|
-
function
|
|
209
|
-
return
|
|
210
|
-
|
|
211
|
-
|
|
1923
|
+
function toTouchMovePoint(event) {
|
|
1924
|
+
return {
|
|
1925
|
+
x: event.touches.item(0).clientX,
|
|
1926
|
+
y: event.touches.item(0).clientY
|
|
212
1927
|
};
|
|
213
1928
|
}
|
|
214
|
-
function
|
|
215
|
-
return
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
entries.push([key, object[key]]);
|
|
219
|
-
}
|
|
220
|
-
return entries;
|
|
1929
|
+
function toTouchEndPoint(event) {
|
|
1930
|
+
return {
|
|
1931
|
+
x: event.changedTouches.item(0).clientX,
|
|
1932
|
+
y: event.changedTouches.item(0).clientY
|
|
221
1933
|
};
|
|
222
1934
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
return keys;
|
|
1935
|
+
|
|
1936
|
+
function toPolarCoordinates({ xA, xB, yA, yB }) {
|
|
1937
|
+
const distance = Math.hypot(xB - xA, yB - yA), angle = Math.atan2(yA - yB, xB - xA), radians = angle >= 0 ? angle : 2 * Math.PI + angle, degrees = radians * 180 / Math.PI;
|
|
1938
|
+
return {
|
|
1939
|
+
distance,
|
|
1940
|
+
angle: { radians, degrees }
|
|
230
1941
|
};
|
|
231
1942
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
1943
|
+
|
|
1944
|
+
const initialMetadata$3 = {
|
|
1945
|
+
times: {
|
|
1946
|
+
start: 0,
|
|
1947
|
+
end: 0
|
|
1948
|
+
},
|
|
1949
|
+
duration: 0
|
|
1950
|
+
};
|
|
1951
|
+
function storeKeyboardTimeMetadata({
|
|
1952
|
+
event,
|
|
1953
|
+
api,
|
|
1954
|
+
getTimeMetadata,
|
|
1955
|
+
getShouldStore,
|
|
1956
|
+
setRequest,
|
|
1957
|
+
recognize
|
|
1958
|
+
}) {
|
|
1959
|
+
if (!getShouldStore())
|
|
1960
|
+
return;
|
|
1961
|
+
const { getStatus, onRecognized } = api, timeMetadata = getTimeMetadata();
|
|
1962
|
+
if (!timeMetadata.times)
|
|
1963
|
+
timeMetadata.times = createClone()(initialMetadata$3.times);
|
|
1964
|
+
timeMetadata.times.start = Math.round(event.timeStamp);
|
|
1965
|
+
timeMetadata.times.end = Math.round(event.timeStamp);
|
|
1966
|
+
const storeDuration = () => {
|
|
1967
|
+
const request = requestAnimationFrame((timestamp) => {
|
|
1968
|
+
if (!getShouldStore())
|
|
1969
|
+
return;
|
|
1970
|
+
timeMetadata.times.end = Math.round(timestamp);
|
|
1971
|
+
timeMetadata.duration = Math.max(0, timeMetadata.times.end - timeMetadata.times.start);
|
|
1972
|
+
if (recognize) {
|
|
1973
|
+
recognize(event, api);
|
|
1974
|
+
if (getStatus() === "recognized")
|
|
1975
|
+
onRecognized(event);
|
|
237
1976
|
}
|
|
238
|
-
|
|
239
|
-
|
|
1977
|
+
storeDuration();
|
|
1978
|
+
});
|
|
1979
|
+
setRequest(request);
|
|
240
1980
|
};
|
|
1981
|
+
storeDuration();
|
|
241
1982
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
1983
|
+
|
|
1984
|
+
const initialMetadata$2 = {
|
|
1985
|
+
points: {
|
|
1986
|
+
start: { x: 0, y: 0 },
|
|
1987
|
+
end: { x: 0, y: 0 }
|
|
1988
|
+
}
|
|
1989
|
+
};
|
|
1990
|
+
function storePointerStartMetadata(event, api) {
|
|
1991
|
+
const { getMetadata } = api, metadata = getMetadata();
|
|
1992
|
+
const point = event instanceof MouseEvent ? toMousePoint(event) : toTouchMovePoint(event);
|
|
1993
|
+
if (!metadata.points)
|
|
1994
|
+
metadata.points = createClone()(initialMetadata$2.points);
|
|
1995
|
+
metadata.points.start = point;
|
|
1996
|
+
metadata.points.end = point;
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
const initialMetadata$1 = {
|
|
2000
|
+
distance: {
|
|
2001
|
+
straight: {
|
|
2002
|
+
fromStart: 0,
|
|
2003
|
+
fromPrevious: 0
|
|
2004
|
+
},
|
|
2005
|
+
horizontal: {
|
|
2006
|
+
fromStart: 0,
|
|
2007
|
+
fromPrevious: 0
|
|
2008
|
+
},
|
|
2009
|
+
vertical: {
|
|
2010
|
+
fromStart: 0,
|
|
2011
|
+
fromPrevious: 0
|
|
2012
|
+
}
|
|
2013
|
+
},
|
|
2014
|
+
angle: {
|
|
2015
|
+
fromPrevious: { radians: 0, degrees: 0 },
|
|
2016
|
+
fromStart: { radians: 0, degrees: 0 }
|
|
2017
|
+
},
|
|
2018
|
+
direction: {
|
|
2019
|
+
fromPrevious: "up",
|
|
2020
|
+
fromStart: "up"
|
|
2021
|
+
}
|
|
2022
|
+
};
|
|
2023
|
+
function storePointerMoveMetadata(event, api) {
|
|
2024
|
+
const { getMetadata } = api, metadata = getMetadata();
|
|
2025
|
+
if (!metadata.distance) {
|
|
2026
|
+
metadata.distance = createClone()(initialMetadata$1.distance);
|
|
2027
|
+
metadata.angle = createClone()(initialMetadata$1.angle);
|
|
2028
|
+
metadata.direction = createClone()(initialMetadata$1.direction);
|
|
2029
|
+
}
|
|
2030
|
+
const { x: previousX, y: previousY } = metadata.points.end, { x: startX, y: startY } = metadata.points.start, { x: newX, y: newY } = (() => {
|
|
2031
|
+
if (event instanceof MouseEvent) {
|
|
2032
|
+
return toMousePoint(event);
|
|
2033
|
+
}
|
|
2034
|
+
if (event instanceof TouchEvent) {
|
|
2035
|
+
if (event.type === "touchmove") {
|
|
2036
|
+
return toTouchMovePoint(event);
|
|
247
2037
|
}
|
|
2038
|
+
return toTouchEndPoint(event);
|
|
248
2039
|
}
|
|
249
|
-
|
|
2040
|
+
})(), { distance: distanceFromPrevious, angle: angleFromPrevious } = toPolarCoordinates({
|
|
2041
|
+
xA: previousX,
|
|
2042
|
+
xB: newX,
|
|
2043
|
+
yA: previousY,
|
|
2044
|
+
yB: newY
|
|
2045
|
+
}), { distance: distanceFromStart, angle: angleFromStart } = toPolarCoordinates({
|
|
2046
|
+
xA: startX,
|
|
2047
|
+
xB: newX,
|
|
2048
|
+
yA: startY,
|
|
2049
|
+
yB: newY
|
|
2050
|
+
});
|
|
2051
|
+
metadata.distance.straight.fromPrevious = distanceFromPrevious;
|
|
2052
|
+
metadata.distance.horizontal.fromPrevious = newX - previousX;
|
|
2053
|
+
metadata.distance.vertical.fromPrevious = newY - previousY;
|
|
2054
|
+
metadata.angle.fromPrevious = angleFromPrevious;
|
|
2055
|
+
metadata.direction.fromPrevious = toDirection(angleFromPrevious.degrees);
|
|
2056
|
+
metadata.distance.straight.fromStart = distanceFromStart;
|
|
2057
|
+
metadata.distance.horizontal.fromStart = newX - startX;
|
|
2058
|
+
metadata.distance.vertical.fromStart = newY - startY;
|
|
2059
|
+
metadata.angle.fromStart = angleFromStart;
|
|
2060
|
+
metadata.direction.fromStart = toDirection(angleFromStart.degrees);
|
|
2061
|
+
metadata.points.end = { x: newX, y: newY };
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
const initialMetadata = {
|
|
2065
|
+
times: {
|
|
2066
|
+
start: 0,
|
|
2067
|
+
end: 0
|
|
2068
|
+
},
|
|
2069
|
+
duration: 0,
|
|
2070
|
+
velocity: 0
|
|
2071
|
+
};
|
|
2072
|
+
function storePointerTimeMetadata(event, api, getShouldStore, setRequest, recognize) {
|
|
2073
|
+
const { getMetadata, getStatus, onRecognized } = api, metadata = getMetadata();
|
|
2074
|
+
if (!metadata.times) {
|
|
2075
|
+
metadata.times = createClone()(initialMetadata.times);
|
|
2076
|
+
}
|
|
2077
|
+
metadata.times.start = Math.round(event.timeStamp);
|
|
2078
|
+
metadata.times.end = Math.round(event.timeStamp);
|
|
2079
|
+
let previousTime = metadata.times.start;
|
|
2080
|
+
const storeDuration = () => {
|
|
2081
|
+
const request = requestAnimationFrame((timestamp) => {
|
|
2082
|
+
if (getShouldStore()) {
|
|
2083
|
+
previousTime = metadata.times.end;
|
|
2084
|
+
metadata.times.end = Math.round(timestamp);
|
|
2085
|
+
metadata.duration = Math.max(0, metadata.times.end - metadata.times.start);
|
|
2086
|
+
const durationFromPrevious = Math.max(0, metadata.times.end - previousTime);
|
|
2087
|
+
metadata.velocity = metadata.distance.straight.fromPrevious / durationFromPrevious;
|
|
2088
|
+
recognize?.(event, api);
|
|
2089
|
+
if (getStatus() === "recognized")
|
|
2090
|
+
onRecognized(event);
|
|
2091
|
+
storeDuration();
|
|
2092
|
+
}
|
|
2093
|
+
});
|
|
2094
|
+
setRequest(request);
|
|
250
2095
|
};
|
|
2096
|
+
storeDuration();
|
|
251
2097
|
}
|
|
252
|
-
|
|
253
|
-
|
|
2098
|
+
|
|
2099
|
+
function defineGraph(nodes, edges) {
|
|
2100
|
+
return { nodes, edges };
|
|
254
2101
|
}
|
|
255
|
-
function
|
|
256
|
-
return
|
|
2102
|
+
function defineGraphNodes(nodes) {
|
|
2103
|
+
return nodes;
|
|
257
2104
|
}
|
|
258
|
-
function
|
|
259
|
-
return
|
|
2105
|
+
function defineGraphEdges(edges) {
|
|
2106
|
+
return edges;
|
|
260
2107
|
}
|
|
261
|
-
function
|
|
262
|
-
return
|
|
263
|
-
if (elementIsCandidate && predicateFocusable(element))
|
|
264
|
-
return element;
|
|
265
|
-
switch (order) {
|
|
266
|
-
case "first":
|
|
267
|
-
for (let i = 0; i < element.children.length; i++) {
|
|
268
|
-
const focusable = createToFocusable(order, true)(element.children[i]);
|
|
269
|
-
if (focusable)
|
|
270
|
-
return focusable;
|
|
271
|
-
}
|
|
272
|
-
break;
|
|
273
|
-
case "last":
|
|
274
|
-
for (let i = element.children.length - 1; i > -1; i--) {
|
|
275
|
-
const focusable = createToFocusable(order, true)(element.children[i]);
|
|
276
|
-
if (focusable)
|
|
277
|
-
return focusable;
|
|
278
|
-
}
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
};
|
|
2108
|
+
function defineGraphNode(node) {
|
|
2109
|
+
return node;
|
|
282
2110
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
this.state = state;
|
|
286
|
-
}
|
|
287
|
-
pipe(...fns) {
|
|
288
|
-
return createReduce((piped, fn, index) => fn(piped, index), this.state)(fns);
|
|
289
|
-
}
|
|
290
|
-
async pipeAsync(...fns) {
|
|
291
|
-
return await createReduceAsync(
|
|
292
|
-
async (piped, fn, index) => await fn(piped, index),
|
|
293
|
-
this.state
|
|
294
|
-
)(fns);
|
|
295
|
-
}
|
|
2111
|
+
function defineGraphEdge(from, to, predicateTraversable) {
|
|
2112
|
+
return { from, to, predicateTraversable };
|
|
296
2113
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
return name in keysByName ? keysByName[name] : name;
|
|
2114
|
+
function defineAsyncGraph(nodes, edges) {
|
|
2115
|
+
return { nodes, edges };
|
|
300
2116
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
right: "ArrowRight",
|
|
304
|
-
down: "ArrowDown",
|
|
305
|
-
left: "ArrowLeft",
|
|
306
|
-
enter: "Enter",
|
|
307
|
-
backspace: "Backspace",
|
|
308
|
-
tab: "Tab",
|
|
309
|
-
space: " ",
|
|
310
|
-
shift: "Shift",
|
|
311
|
-
meta: "Meta",
|
|
312
|
-
command: "Meta",
|
|
313
|
-
cmd: "Meta",
|
|
314
|
-
control: "Control",
|
|
315
|
-
ctrl: "Control",
|
|
316
|
-
alt: "Alt",
|
|
317
|
-
opt: "Alt",
|
|
318
|
-
option: "Alt",
|
|
319
|
-
fn: "Fn",
|
|
320
|
-
capslock: "CapsLock",
|
|
321
|
-
end: "End",
|
|
322
|
-
home: "Home",
|
|
323
|
-
pagedown: "PageDown",
|
|
324
|
-
pageup: "PageUp",
|
|
325
|
-
esc: "Escape",
|
|
326
|
-
camera: "Camera",
|
|
327
|
-
delete: "Delete",
|
|
328
|
-
f1: "F1",
|
|
329
|
-
f2: "F2",
|
|
330
|
-
f3: "F3",
|
|
331
|
-
f4: "F4",
|
|
332
|
-
f5: "F5",
|
|
333
|
-
f6: "F6",
|
|
334
|
-
f7: "F7",
|
|
335
|
-
f8: "F8",
|
|
336
|
-
f9: "F9",
|
|
337
|
-
f10: "F10",
|
|
338
|
-
f11: "F11",
|
|
339
|
-
f12: "F12",
|
|
340
|
-
f13: "F13",
|
|
341
|
-
f14: "F14",
|
|
342
|
-
f15: "F15",
|
|
343
|
-
f16: "F16",
|
|
344
|
-
f17: "F17",
|
|
345
|
-
f18: "F18",
|
|
346
|
-
f19: "F19",
|
|
347
|
-
f20: "F20"
|
|
348
|
-
};
|
|
349
|
-
const toListenableKeycomboItems = createMap((name) => ({ name, type: fromComboItemNameToType(name) }));
|
|
350
|
-
function narrowKeycombo(type) {
|
|
351
|
-
return new Pipeable(type).pipe(
|
|
352
|
-
toCombo,
|
|
353
|
-
toListenableKeycomboItems
|
|
354
|
-
);
|
|
2117
|
+
function defineAsyncGraphEdges(edges) {
|
|
2118
|
+
return edges;
|
|
355
2119
|
}
|
|
356
|
-
function
|
|
357
|
-
return
|
|
2120
|
+
function defineAsyncGraphEdge(from, to, predicateTraversable) {
|
|
2121
|
+
return { from, to, predicateTraversable };
|
|
358
2122
|
}
|
|
359
|
-
|
|
360
|
-
|
|
2123
|
+
|
|
2124
|
+
function defineAssociativeArrayEntries(entries) {
|
|
2125
|
+
return entries;
|
|
361
2126
|
}
|
|
362
|
-
|
|
363
|
-
const toComboItems = lazyCollections.map((name) => name === "" ? delimiter : name);
|
|
364
|
-
const delimiter = "+";
|
|
365
|
-
function toCombo(type) {
|
|
366
|
-
return lazyCollections.pipe(
|
|
367
|
-
toUnique$1,
|
|
368
|
-
toComboItems,
|
|
369
|
-
lazyCollections.toArray()
|
|
370
|
-
)(type.split(delimiter));
|
|
371
|
-
}
|
|
372
|
-
function fromComboItemNameToType(name) {
|
|
373
|
-
return lazyCollections.find((type) => predicatesByType[type](name))(listenableComboItemTypes) ?? "custom";
|
|
374
|
-
}
|
|
375
|
-
const listenableComboItemTypes = /* @__PURE__ */ new Set(["singleCharacter", "arrow", "other", "modifier", "click", "pointer"]);
|
|
376
|
-
const predicatesByType = {
|
|
377
|
-
singleCharacter: (name) => typeREs["singleCharacter"].test(name),
|
|
378
|
-
arrow: (name) => typeREs["arrow"].test(name),
|
|
379
|
-
other: (name) => typeREs["other"].test(name),
|
|
380
|
-
modifier: (name) => typeREs["modifier"].test(name),
|
|
381
|
-
click: (name) => typeREs["click"].test(name),
|
|
382
|
-
pointer: (name) => typeREs["pointer"].test(name)
|
|
383
|
-
};
|
|
384
|
-
const typeREs = {
|
|
385
|
-
singleCharacter: /^!?[a-zA-Z0-9,<.>/?;:'"[{\]}\\|`~!@#$%^&*()-_=+]$/,
|
|
386
|
-
arrow: /^!?(arrow|vertical|horizontal|up|down|right|left)$/,
|
|
387
|
-
other: /^!?(enter|backspace|space|tab|esc|home|end|pagedown|pageup|capslock|f[0-9]{1,2}|camera|delete)$/,
|
|
388
|
-
modifier: /^!?(cmd|command|meta|shift|ctrl|control|alt|opt|option)$/,
|
|
389
|
-
click: /^!?(rightclick|contextmenu|click|mousedown|mouseup|dblclick)$/,
|
|
390
|
-
pointer: /^!?(pointerdown|pointerup|pointermove|pointerover|pointerout|pointerenter|pointerleave|pointercancel|gotpointercapture|lostpointercapture)$/
|
|
391
|
-
};
|
|
392
|
-
function toModifier(modifierOrAlias) {
|
|
393
|
-
return modifierOrAlias in modifiersByAlias ? modifiersByAlias[modifierOrAlias] : modifierOrAlias;
|
|
394
|
-
}
|
|
395
|
-
const modifiersByAlias = {
|
|
396
|
-
cmd: "meta",
|
|
397
|
-
command: "meta",
|
|
398
|
-
ctrl: "control",
|
|
399
|
-
opt: "alt",
|
|
400
|
-
option: "alt"
|
|
401
|
-
};
|
|
2127
|
+
|
|
402
2128
|
function createExceptAndOnlyEffect(type, effect, options) {
|
|
403
2129
|
const { except = [], only = [] } = options;
|
|
404
2130
|
if (type === "keydown" || type === "keyup") {
|
|
405
2131
|
return (event) => {
|
|
406
|
-
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false,
|
|
2132
|
+
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, false];
|
|
407
2133
|
if (matchesOnly) {
|
|
408
2134
|
effect(event);
|
|
409
2135
|
return;
|
|
@@ -416,7 +2142,7 @@ function createExceptAndOnlyEffect(type, effect, options) {
|
|
|
416
2142
|
}
|
|
417
2143
|
if (type === "click" || type === "dblclick" || type === "contextmenu" || type.startsWith("mouse")) {
|
|
418
2144
|
return (event) => {
|
|
419
|
-
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false,
|
|
2145
|
+
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, false];
|
|
420
2146
|
if (matchesOnly) {
|
|
421
2147
|
effect(event);
|
|
422
2148
|
return;
|
|
@@ -429,7 +2155,7 @@ function createExceptAndOnlyEffect(type, effect, options) {
|
|
|
429
2155
|
}
|
|
430
2156
|
if (type.startsWith("pointer")) {
|
|
431
2157
|
return (event) => {
|
|
432
|
-
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false,
|
|
2158
|
+
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, false];
|
|
433
2159
|
if (matchesOnly) {
|
|
434
2160
|
effect(event);
|
|
435
2161
|
return;
|
|
@@ -441,7 +2167,7 @@ function createExceptAndOnlyEffect(type, effect, options) {
|
|
|
441
2167
|
};
|
|
442
2168
|
}
|
|
443
2169
|
return (event) => {
|
|
444
|
-
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false,
|
|
2170
|
+
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, false];
|
|
445
2171
|
if (matchesOnly) {
|
|
446
2172
|
effect(event, {});
|
|
447
2173
|
return;
|
|
@@ -452,27 +2178,15 @@ function createExceptAndOnlyEffect(type, effect, options) {
|
|
|
452
2178
|
}
|
|
453
2179
|
};
|
|
454
2180
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
}
|
|
458
|
-
const predicatesByModifier = {
|
|
459
|
-
shift: (event) => event.shiftKey,
|
|
460
|
-
cmd: (event) => event.metaKey,
|
|
461
|
-
command: (event) => event.metaKey,
|
|
462
|
-
meta: (event) => event.metaKey,
|
|
463
|
-
ctrl: (event) => event.ctrlKey,
|
|
464
|
-
control: (event) => event.ctrlKey,
|
|
465
|
-
alt: (event) => event.altKey,
|
|
466
|
-
opt: (event) => event.altKey,
|
|
467
|
-
option: (event) => event.altKey
|
|
468
|
-
};
|
|
469
|
-
function domIsAvailable() {
|
|
2181
|
+
|
|
2182
|
+
function getDomAvailability() {
|
|
470
2183
|
try {
|
|
471
|
-
return !!window;
|
|
2184
|
+
return !!window ? "available" : "unavailable";
|
|
472
2185
|
} catch (error) {
|
|
473
|
-
return
|
|
2186
|
+
return "unavailable";
|
|
474
2187
|
}
|
|
475
2188
|
}
|
|
2189
|
+
|
|
476
2190
|
function predicateArray(value) {
|
|
477
2191
|
return Array.isArray(value);
|
|
478
2192
|
}
|
|
@@ -491,24 +2205,8 @@ function predicateNumber(value) {
|
|
|
491
2205
|
function predicateString(value) {
|
|
492
2206
|
return typeof value === "string";
|
|
493
2207
|
}
|
|
494
|
-
|
|
495
|
-
"
|
|
496
|
-
"select:not([disabled])",
|
|
497
|
-
"textarea:not([disabled])",
|
|
498
|
-
"button:not([disabled])",
|
|
499
|
-
"a[href]",
|
|
500
|
-
"area[href]",
|
|
501
|
-
"summary",
|
|
502
|
-
"iframe",
|
|
503
|
-
"object",
|
|
504
|
-
"embed",
|
|
505
|
-
"audio[controls]",
|
|
506
|
-
"video[controls]",
|
|
507
|
-
"[contenteditable]",
|
|
508
|
-
"[tabindex]:not([disabled])"
|
|
509
|
-
]);
|
|
510
|
-
function predicateFocusable(element) {
|
|
511
|
-
return element.matches(tabbableSelector);
|
|
2208
|
+
function predicateObject(value) {
|
|
2209
|
+
return typeof value === "object";
|
|
512
2210
|
}
|
|
513
2211
|
|
|
514
2212
|
class Recognizeable {
|
|
@@ -521,7 +2219,7 @@ class Recognizeable {
|
|
|
521
2219
|
effects: {}
|
|
522
2220
|
};
|
|
523
2221
|
this.maxSequenceLength = options?.maxSequenceLength || defaultOptions.maxSequenceLength;
|
|
524
|
-
this.effects =
|
|
2222
|
+
this.effects = options?.effects || defaultOptions.effects;
|
|
525
2223
|
this.resetComputedMetadata();
|
|
526
2224
|
this.setSequence(sequence);
|
|
527
2225
|
this.effectApi = {
|
|
@@ -530,8 +2228,6 @@ class Recognizeable {
|
|
|
530
2228
|
setMetadata: (metadata) => this.computedMetadata = metadata,
|
|
531
2229
|
recognized: () => this.recognized(),
|
|
532
2230
|
denied: () => this.denied(),
|
|
533
|
-
recognizedUntilReady: () => this.recognizedUntilReady(),
|
|
534
|
-
deniedUntilReady: () => this.deniedUntilReady(),
|
|
535
2231
|
ready: () => this.ready()
|
|
536
2232
|
};
|
|
537
2233
|
this.ready();
|
|
@@ -546,12 +2242,6 @@ class Recognizeable {
|
|
|
546
2242
|
denied() {
|
|
547
2243
|
this.computedStatus = "denied";
|
|
548
2244
|
}
|
|
549
|
-
recognizedUntilReady() {
|
|
550
|
-
this.computedStatus = "recognized until ready";
|
|
551
|
-
}
|
|
552
|
-
deniedUntilReady() {
|
|
553
|
-
this.computedStatus = "denied until ready";
|
|
554
|
-
}
|
|
555
2245
|
computedStatus;
|
|
556
2246
|
ready() {
|
|
557
2247
|
this.computedStatus = "ready";
|
|
@@ -574,8 +2264,7 @@ class Recognizeable {
|
|
|
574
2264
|
return this;
|
|
575
2265
|
}
|
|
576
2266
|
recognize(sequenceItem, { onRecognized } = {}) {
|
|
577
|
-
|
|
578
|
-
this.recognizing();
|
|
2267
|
+
this.recognizing();
|
|
579
2268
|
const type = this.toType(sequenceItem), excess = predicateNumber(this.maxSequenceLength) ? Math.max(0, this.sequence.length - this.maxSequenceLength) : 0, newSequence = createConcat(
|
|
580
2269
|
createSlice(excess)(this.sequence),
|
|
581
2270
|
[sequenceItem]
|
|
@@ -583,11 +2272,10 @@ class Recognizeable {
|
|
|
583
2272
|
this.effectApi.getSequence = () => newSequence;
|
|
584
2273
|
this.effectApi.onRecognized = onRecognized || (() => {
|
|
585
2274
|
});
|
|
586
|
-
this.effects
|
|
2275
|
+
this.effects[type]?.(sequenceItem, { ...this.effectApi });
|
|
587
2276
|
switch (this.status) {
|
|
588
2277
|
case "ready":
|
|
589
2278
|
case "denied":
|
|
590
|
-
case "denied until ready":
|
|
591
2279
|
this.resetComputedMetadata();
|
|
592
2280
|
this.setSequence([]);
|
|
593
2281
|
break;
|
|
@@ -630,8 +2318,8 @@ class Listenable {
|
|
|
630
2318
|
computedActive;
|
|
631
2319
|
constructor(type, options) {
|
|
632
2320
|
if (type === "recognizeable") {
|
|
633
|
-
this.computedRecognizeable = new Recognizeable([], options?.recognizeable
|
|
634
|
-
this.recognizeableEffectsKeys = Object.keys(options?.recognizeable?.effects
|
|
2321
|
+
this.computedRecognizeable = new Recognizeable([], options?.recognizeable);
|
|
2322
|
+
this.recognizeableEffectsKeys = Object.keys(options?.recognizeable?.effects);
|
|
635
2323
|
}
|
|
636
2324
|
this.computedActive = /* @__PURE__ */ new Set();
|
|
637
2325
|
this.setType(type);
|
|
@@ -731,24 +2419,10 @@ class Listenable {
|
|
|
731
2419
|
this.active.add({ target, id: [this.type, effect] });
|
|
732
2420
|
}
|
|
733
2421
|
recognizeableListen(effect, options) {
|
|
734
|
-
let effectStatus = "ready";
|
|
735
2422
|
const guardedEffect = (sequenceItem) => {
|
|
736
2423
|
this.recognizeable.recognize(sequenceItem, { onRecognized: (sequenceItem2) => effect(sequenceItem2) });
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
if (effectStatus === "ready") {
|
|
740
|
-
effect(sequenceItem);
|
|
741
|
-
effectStatus = "performed";
|
|
742
|
-
}
|
|
743
|
-
break;
|
|
744
|
-
case "recognized":
|
|
745
|
-
effect(sequenceItem);
|
|
746
|
-
effectStatus = "ready";
|
|
747
|
-
break;
|
|
748
|
-
default:
|
|
749
|
-
effectStatus = "ready";
|
|
750
|
-
break;
|
|
751
|
-
}
|
|
2424
|
+
if (this.recognizeable.status === "recognized")
|
|
2425
|
+
effect(sequenceItem);
|
|
752
2426
|
};
|
|
753
2427
|
for (const type of this.recognizeableEffectsKeys) {
|
|
754
2428
|
const listenable = new Listenable(type);
|
|
@@ -769,10 +2443,10 @@ class Listenable {
|
|
|
769
2443
|
}
|
|
770
2444
|
addEventListeners(eventListeners, options) {
|
|
771
2445
|
const { target = document } = options;
|
|
772
|
-
|
|
2446
|
+
for (const eventListener of eventListeners) {
|
|
773
2447
|
target.addEventListener(eventListener[0], eventListener[1], eventListener[2]);
|
|
774
2448
|
this.active.add({ target, id: eventListener });
|
|
775
|
-
}
|
|
2449
|
+
}
|
|
776
2450
|
}
|
|
777
2451
|
listening() {
|
|
778
2452
|
this.computedStatus = "listening";
|
|
@@ -884,109 +2558,22 @@ function toAddEventListenerParams(type, effect, options) {
|
|
|
884
2558
|
const { addEventListener, useCapture } = options, exceptAndOnlyEffect = createExceptAndOnlyEffect(type, effect, options), effectOptions = [addEventListener || useCapture];
|
|
885
2559
|
return { exceptAndOnlyEffect, effectOptions };
|
|
886
2560
|
}
|
|
887
|
-
function eventMatchesKeycombo(event, keycombo) {
|
|
888
|
-
return lazyCollections.every(({ name, type }, index) => {
|
|
889
|
-
switch (type) {
|
|
890
|
-
case "singleCharacter":
|
|
891
|
-
if (name === "!")
|
|
892
|
-
return event.key === "!";
|
|
893
|
-
const keyToTest = event.altKey && fromComboItemNameToType(event.key) === "custom" ? fromCodeToSingleCharacter(event.code) : event.key.toLowerCase();
|
|
894
|
-
return name.startsWith("!") ? keyToTest !== toKey(name.slice(1)).toLowerCase() : keyToTest === toKey(name).toLowerCase();
|
|
895
|
-
case "other":
|
|
896
|
-
if (name === "!") {
|
|
897
|
-
return event.key === "!";
|
|
898
|
-
}
|
|
899
|
-
return name.startsWith("!") ? event.key.toLowerCase() !== toKey(name.slice(1)).toLowerCase() : event.key.toLowerCase() === toKey(name).toLowerCase();
|
|
900
|
-
case "arrow":
|
|
901
|
-
return predicatesByArrow.get(name)?.({ event, name }) ?? predicatesByArrow.get("default")({ event, name });
|
|
902
|
-
case "modifier":
|
|
903
|
-
if (index === keycombo.length - 1) {
|
|
904
|
-
return name.startsWith("!") ? event.key.toLowerCase() !== toModifier(name.slice(1)).toLowerCase() : event.key.toLowerCase() === toModifier(name).toLowerCase();
|
|
905
|
-
}
|
|
906
|
-
return name.startsWith("!") ? !predicateModified({ event, alias: name.slice(1) }) : predicateModified({ event, alias: name });
|
|
907
|
-
}
|
|
908
|
-
})(keycombo);
|
|
909
|
-
}
|
|
910
|
-
function fromCodeToSingleCharacter(code) {
|
|
911
|
-
for (const c in aliasesByCode) {
|
|
912
|
-
if (c === code) {
|
|
913
|
-
return aliasesByCode[c];
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
for (const prefix of ["Key", "Digit"]) {
|
|
917
|
-
const re = new RegExp(`^${prefix}`);
|
|
918
|
-
if (re.test(code)) {
|
|
919
|
-
return createClip(re)(code).toLowerCase();
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
return code;
|
|
923
|
-
}
|
|
924
|
-
const aliasesByCode = {
|
|
925
|
-
"Backquote": "`",
|
|
926
|
-
"Minus": "-",
|
|
927
|
-
"Equal": "=",
|
|
928
|
-
"BracketLeft": "[",
|
|
929
|
-
"BracketRight": "]",
|
|
930
|
-
"Backslash": "\\",
|
|
931
|
-
"Semicolon": ";",
|
|
932
|
-
"Quote": "'",
|
|
933
|
-
"Comma": ",",
|
|
934
|
-
"Period": ".",
|
|
935
|
-
"Slash": "/"
|
|
936
|
-
};
|
|
937
|
-
const predicatesByArrow = /* @__PURE__ */ new Map([
|
|
938
|
-
[
|
|
939
|
-
"arrow",
|
|
940
|
-
({ event }) => arrows.has(event.key.toLowerCase())
|
|
941
|
-
],
|
|
942
|
-
[
|
|
943
|
-
"!arrow",
|
|
944
|
-
({ event }) => !arrows.has(event.key.toLowerCase())
|
|
945
|
-
],
|
|
946
|
-
[
|
|
947
|
-
"vertical",
|
|
948
|
-
({ event }) => verticalArrows.has(event.key.toLowerCase())
|
|
949
|
-
],
|
|
950
|
-
[
|
|
951
|
-
"!vertical",
|
|
952
|
-
({ event }) => !verticalArrows.has(event.key.toLowerCase())
|
|
953
|
-
],
|
|
954
|
-
[
|
|
955
|
-
"horizontal",
|
|
956
|
-
({ event }) => horizontalArrows.has(event.key.toLowerCase())
|
|
957
|
-
],
|
|
958
|
-
[
|
|
959
|
-
"!horizontal",
|
|
960
|
-
({ event }) => !horizontalArrows.has(event.key.toLowerCase())
|
|
961
|
-
],
|
|
962
|
-
[
|
|
963
|
-
"default",
|
|
964
|
-
({ event, name }) => name.startsWith("!") ? event.key.toLowerCase() !== `arrow${name.toLowerCase()}` : event.key.toLowerCase() === `arrow${name.toLowerCase()}`
|
|
965
|
-
]
|
|
966
|
-
]);
|
|
967
|
-
const arrows = /* @__PURE__ */ new Set(["arrowup", "arrowright", "arrowdown", "arrowleft"]);
|
|
968
|
-
const verticalArrows = /* @__PURE__ */ new Set(["arrowup", "arrowdown"]);
|
|
969
|
-
const horizontalArrows = /* @__PURE__ */ new Set(["arrowright", "arrowleft"]);
|
|
970
|
-
function eventMatchesMousecombo(event, Mousecombo) {
|
|
971
|
-
return lazyCollections.every((name) => fromComboItemNameToType(name) === "click" || name.startsWith("!") && !predicateModified({ alias: name.slice(1), event }) || !name.startsWith("!") && predicateModified({ alias: name, event }))(Mousecombo);
|
|
972
|
-
}
|
|
973
|
-
function eventMatchesPointercombo(event, pointercombo) {
|
|
974
|
-
return lazyCollections.every((name) => fromComboItemNameToType(name) === "pointer" || name.startsWith("!") && !predicateModified({ alias: name.slice(1), event }) || !name.startsWith("!") && predicateModified({ alias: name, event }))(pointercombo);
|
|
975
|
-
}
|
|
976
2561
|
const observerAssertionsByType = {
|
|
977
2562
|
intersect: (observer) => observer instanceof IntersectionObserver,
|
|
978
2563
|
mutate: (observer) => observer instanceof MutationObserver,
|
|
979
2564
|
resize: (observer) => observer instanceof ResizeObserver
|
|
980
2565
|
};
|
|
981
2566
|
|
|
982
|
-
const defaultOptions$
|
|
2567
|
+
const defaultOptions$8 = {
|
|
983
2568
|
duration: 0,
|
|
2569
|
+
// delay not supported, because it can be effectd by delayable
|
|
984
2570
|
timing: [
|
|
985
2571
|
0,
|
|
986
2572
|
0,
|
|
987
2573
|
1,
|
|
988
2574
|
1
|
|
989
2575
|
],
|
|
2576
|
+
// linear by default
|
|
990
2577
|
iterations: 1,
|
|
991
2578
|
alternates: false
|
|
992
2579
|
};
|
|
@@ -1007,10 +2594,10 @@ class Animateable {
|
|
|
1007
2594
|
getEaseables;
|
|
1008
2595
|
getReversedEaseables;
|
|
1009
2596
|
constructor(keyframes, options = {}) {
|
|
1010
|
-
this.initialDuration = options?.duration || defaultOptions$
|
|
1011
|
-
this.controlPoints = fromTimingToControlPoints(options?.timing || defaultOptions$
|
|
1012
|
-
this.iterationLimit = options?.iterations || defaultOptions$
|
|
1013
|
-
this.alternates = options?.alternates || defaultOptions$
|
|
2597
|
+
this.initialDuration = options?.duration || defaultOptions$8.duration;
|
|
2598
|
+
this.controlPoints = fromTimingToControlPoints(options?.timing || defaultOptions$8.timing);
|
|
2599
|
+
this.iterationLimit = options?.iterations || defaultOptions$8.iterations;
|
|
2600
|
+
this.alternates = options?.alternates || defaultOptions$8.alternates;
|
|
1014
2601
|
this.reversedControlPoints = fromControlPointsToReversedControlPoints(this.controlPoints);
|
|
1015
2602
|
this.toAnimationProgress = createToAnimationProgress(this.controlPoints);
|
|
1016
2603
|
this.reversedToAnimationProgress = createToAnimationProgress(this.reversedControlPoints);
|
|
@@ -1086,10 +2673,11 @@ class Animateable {
|
|
|
1086
2673
|
setKeyframes(keyframes) {
|
|
1087
2674
|
this.stop();
|
|
1088
2675
|
this.computedKeyframes = Array.from(keyframes).sort(({ progress: progressA }, { progress: progressB }) => progressA - progressB);
|
|
1089
|
-
this.reversedKeyframes =
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
2676
|
+
this.reversedKeyframes = lazyCollections.pipe(
|
|
2677
|
+
lazyCollections.reverse(),
|
|
2678
|
+
lazyCollections.map(({ progress, properties }) => ({ progress: 1 - progress, properties })),
|
|
2679
|
+
lazyCollections.toArray()
|
|
2680
|
+
)(this.keyframes);
|
|
1093
2681
|
this.properties = toProperties(this.keyframes);
|
|
1094
2682
|
this.easeables = this.getEaseables({ keyframes: this.keyframes, properties: this.properties });
|
|
1095
2683
|
this.reversedEaseables = this.getReversedEaseables({ keyframes: this.reversedKeyframes, properties: this.properties });
|
|
@@ -1387,7 +2975,7 @@ class Animateable {
|
|
|
1387
2975
|
break;
|
|
1388
2976
|
case "reversing":
|
|
1389
2977
|
this.computedIterations += 1;
|
|
1390
|
-
if (this.
|
|
2978
|
+
if (this.iterationLimit === true || this.iterations < this.iterationLimit) {
|
|
1391
2979
|
this.createAnimate("reverse")(effect, options);
|
|
1392
2980
|
} else {
|
|
1393
2981
|
this.alternateCache.status = "ready";
|
|
@@ -1396,7 +2984,7 @@ class Animateable {
|
|
|
1396
2984
|
}
|
|
1397
2985
|
} else {
|
|
1398
2986
|
this.computedIterations += 1;
|
|
1399
|
-
if (this.
|
|
2987
|
+
if (this.iterationLimit === true || this.iterations < this.iterationLimit) {
|
|
1400
2988
|
this.createAnimate("play")(effect, options);
|
|
1401
2989
|
}
|
|
1402
2990
|
}
|
|
@@ -1412,7 +3000,7 @@ class Animateable {
|
|
|
1412
3000
|
switch (this.alternateCache.status) {
|
|
1413
3001
|
case "playing":
|
|
1414
3002
|
this.computedIterations += 1;
|
|
1415
|
-
if (this.
|
|
3003
|
+
if (this.iterationLimit === true || this.iterations < this.iterationLimit) {
|
|
1416
3004
|
this.createAnimate("play")(effect, options);
|
|
1417
3005
|
} else {
|
|
1418
3006
|
this.alternateCache.status = "ready";
|
|
@@ -1424,7 +3012,7 @@ class Animateable {
|
|
|
1424
3012
|
}
|
|
1425
3013
|
} else {
|
|
1426
3014
|
this.computedIterations += 1;
|
|
1427
|
-
if (this.iterations < this.iterationLimit) {
|
|
3015
|
+
if (this.iterationLimit === true || this.iterations < this.iterationLimit) {
|
|
1428
3016
|
this.createAnimate("reverse")(effect, options);
|
|
1429
3017
|
}
|
|
1430
3018
|
}
|
|
@@ -1633,7 +3221,7 @@ function createGetEaseables(fromKeyframeToControlPoints) {
|
|
|
1633
3221
|
(easeables, property) => {
|
|
1634
3222
|
const propertyKeyframes = createFilter(({ properties: properties2 }) => properties2.hasOwnProperty(property))(keyframes), fromKeyframesToEaseables = createReduce(
|
|
1635
3223
|
(propertyEaseables2, keyframe, index) => {
|
|
1636
|
-
const previous = keyframe.properties[property], next = index === propertyKeyframes.length - 1 ? previous : propertyKeyframes[index + 1].properties[property], start = keyframe.progress, end = index === propertyKeyframes.length - 1 ? 2 : propertyKeyframes[index + 1].progress, hasCustomTiming = !!keyframe.timing, toAnimationProgress = index === propertyKeyframes.length - 1 ? (
|
|
3224
|
+
const previous = keyframe.properties[property], next = index === propertyKeyframes.length - 1 ? previous : propertyKeyframes[index + 1].properties[property], start = keyframe.progress, end = index === propertyKeyframes.length - 1 ? 2 : propertyKeyframes[index + 1].progress, hasCustomTiming = !!keyframe.timing, toAnimationProgress = index === propertyKeyframes.length - 1 ? () => 1 : createToAnimationProgress(fromKeyframeToControlPoints({ keyframe, index, propertyKeyframes }));
|
|
1637
3225
|
propertyEaseables2.push({
|
|
1638
3226
|
property,
|
|
1639
3227
|
value: { previous, next },
|
|
@@ -1648,7 +3236,7 @@ function createGetEaseables(fromKeyframeToControlPoints) {
|
|
|
1648
3236
|
property,
|
|
1649
3237
|
value: { previous: propertyEaseables[0].value.previous, next: propertyEaseables[0].value.previous },
|
|
1650
3238
|
progress: { start: -1, end: propertyEaseables[0].progress.start },
|
|
1651
|
-
toAnimationProgress: (
|
|
3239
|
+
toAnimationProgress: () => 1,
|
|
1652
3240
|
hasCustomTiming: false
|
|
1653
3241
|
};
|
|
1654
3242
|
return createConcat(
|
|
@@ -1893,14 +3481,14 @@ const easingsNetInOutBack = [
|
|
|
1893
3481
|
1.6
|
|
1894
3482
|
];
|
|
1895
3483
|
|
|
1896
|
-
const defaultOptions$
|
|
3484
|
+
const defaultOptions$7 = {
|
|
1897
3485
|
name: "baleada"
|
|
1898
3486
|
};
|
|
1899
3487
|
class Broadcastable {
|
|
1900
3488
|
name;
|
|
1901
3489
|
constructor(state, options = {}) {
|
|
1902
3490
|
this.setState(state);
|
|
1903
|
-
this.name = options.name ?? defaultOptions$
|
|
3491
|
+
this.name = options.name ?? defaultOptions$7.name;
|
|
1904
3492
|
this.ready();
|
|
1905
3493
|
}
|
|
1906
3494
|
computedStatus;
|
|
@@ -1965,12 +3553,69 @@ function toMessageListenParams(instance, effect) {
|
|
|
1965
3553
|
];
|
|
1966
3554
|
}
|
|
1967
3555
|
|
|
3556
|
+
const defaultOptions$6 = {
|
|
3557
|
+
locales: "en",
|
|
3558
|
+
collator: { sensitivity: "base" }
|
|
3559
|
+
};
|
|
3560
|
+
class Compareable {
|
|
3561
|
+
constructor(string, options = {}) {
|
|
3562
|
+
const locales = options.locales || defaultOptions$6.locales, collatorOptions = { ...defaultOptions$6.collator, ...options.collator }, key = locales + lazyCollections.pipe(
|
|
3563
|
+
createEntries(),
|
|
3564
|
+
lazyCollections.sort((a, b) => a[0] < b[0] ? -1 : 1),
|
|
3565
|
+
lazyCollections.join()
|
|
3566
|
+
)(collatorOptions);
|
|
3567
|
+
this.computedCollator = cache[key] || (cache[key] = new Intl.Collator(locales, collatorOptions));
|
|
3568
|
+
this.setString(string);
|
|
3569
|
+
this.ready();
|
|
3570
|
+
}
|
|
3571
|
+
computedStatus;
|
|
3572
|
+
ready() {
|
|
3573
|
+
this.computedStatus = "ready";
|
|
3574
|
+
}
|
|
3575
|
+
get string() {
|
|
3576
|
+
return this.computedString;
|
|
3577
|
+
}
|
|
3578
|
+
set string(string) {
|
|
3579
|
+
this.setString(string);
|
|
3580
|
+
}
|
|
3581
|
+
get status() {
|
|
3582
|
+
return this.computedStatus;
|
|
3583
|
+
}
|
|
3584
|
+
computedCollator;
|
|
3585
|
+
get collator() {
|
|
3586
|
+
return this.computedCollator;
|
|
3587
|
+
}
|
|
3588
|
+
computedComparison;
|
|
3589
|
+
get comparison() {
|
|
3590
|
+
return this.computedComparison;
|
|
3591
|
+
}
|
|
3592
|
+
computedString;
|
|
3593
|
+
setString(string) {
|
|
3594
|
+
this.computedString = string;
|
|
3595
|
+
return this;
|
|
3596
|
+
}
|
|
3597
|
+
compare(compared) {
|
|
3598
|
+
this.comparing();
|
|
3599
|
+
this.computedComparison = this.computedCollator.compare(this.string, compared);
|
|
3600
|
+
this.compared();
|
|
3601
|
+
return this;
|
|
3602
|
+
}
|
|
3603
|
+
comparing() {
|
|
3604
|
+
this.computedStatus = "comparing";
|
|
3605
|
+
}
|
|
3606
|
+
compared() {
|
|
3607
|
+
this.computedStatus = "compared";
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
|
+
const cache = {};
|
|
3611
|
+
|
|
1968
3612
|
const defaultOptions$5 = {
|
|
1969
3613
|
segment: {
|
|
1970
3614
|
from: "start",
|
|
1971
3615
|
to: "end"
|
|
1972
3616
|
},
|
|
1973
3617
|
divider: /\s/
|
|
3618
|
+
// Keep an eye out for use cases where a { before, after } object would be needed, or where multi-character dividers need to be used
|
|
1974
3619
|
};
|
|
1975
3620
|
const defaultCompleteOptions = {
|
|
1976
3621
|
select: "completionEnd"
|
|
@@ -2053,6 +3698,7 @@ class Completeable {
|
|
|
2053
3698
|
}
|
|
2054
3699
|
return this;
|
|
2055
3700
|
}
|
|
3701
|
+
// TODO: Support array of selections for multi cursor editing
|
|
2056
3702
|
computedSelection;
|
|
2057
3703
|
setSelection(selection) {
|
|
2058
3704
|
this.computedSelection = selection;
|
|
@@ -2129,12 +3775,12 @@ function toPreviousMatch({ string, re, from }) {
|
|
|
2129
3775
|
if (!re.test(string.slice(0, from)) || from === 0) {
|
|
2130
3776
|
indexOf = -1;
|
|
2131
3777
|
} else {
|
|
2132
|
-
const reversedStringBeforeFrom =
|
|
3778
|
+
const reversedStringBeforeFrom = lazyCollections.pipe(
|
|
2133
3779
|
(string2) => string2.slice(0, from),
|
|
2134
3780
|
(sliced) => sliced.split(""),
|
|
2135
3781
|
reverse,
|
|
2136
3782
|
toString
|
|
2137
|
-
), toNextMatchIndex = toNextMatch({ string: reversedStringBeforeFrom, re, from: 0 });
|
|
3783
|
+
)(string), toNextMatchIndex = toNextMatch({ string: reversedStringBeforeFrom, re, from: 0 });
|
|
2138
3784
|
indexOf = toNextMatchIndex === -1 ? -1 : reversedStringBeforeFrom.length - 1 - toNextMatchIndex;
|
|
2139
3785
|
}
|
|
2140
3786
|
return indexOf;
|
|
@@ -2505,11 +4151,12 @@ class Fetchable {
|
|
|
2505
4151
|
computedText;
|
|
2506
4152
|
constructor(resource, options = {}) {
|
|
2507
4153
|
this.setResource(resource);
|
|
2508
|
-
this.
|
|
2509
|
-
this.
|
|
2510
|
-
this.
|
|
2511
|
-
this.
|
|
2512
|
-
this.
|
|
4154
|
+
this.computedKy = ky.create(narrowOptions(options.ky));
|
|
4155
|
+
this.computedArrayBuffer = new Resolveable(async () => "arrayBuffer" in this.response ? await this.response.arrayBuffer() : void 0);
|
|
4156
|
+
this.computedBlob = new Resolveable(async () => "blob" in this.response ? await this.response.blob() : void 0);
|
|
4157
|
+
this.computedFormData = new Resolveable(async () => "formData" in this.response ? await this.response.formData() : void 0);
|
|
4158
|
+
this.computedJson = new Resolveable(async () => "json" in this.response ? await this.response.json() : void 0);
|
|
4159
|
+
this.computedText = new Resolveable(async () => "text" in this.response ? await this.response.text() : void 0);
|
|
2513
4160
|
this.ready();
|
|
2514
4161
|
}
|
|
2515
4162
|
computedStatus;
|
|
@@ -2522,6 +4169,10 @@ class Fetchable {
|
|
|
2522
4169
|
set resource(resource) {
|
|
2523
4170
|
this.setResource(resource);
|
|
2524
4171
|
}
|
|
4172
|
+
computedKy;
|
|
4173
|
+
get ky() {
|
|
4174
|
+
return this.computedKy;
|
|
4175
|
+
}
|
|
2525
4176
|
computedAbortController;
|
|
2526
4177
|
get abortController() {
|
|
2527
4178
|
if (!this.computedAbortController) {
|
|
@@ -2535,6 +4186,10 @@ class Fetchable {
|
|
|
2535
4186
|
get response() {
|
|
2536
4187
|
return this.computedResponse;
|
|
2537
4188
|
}
|
|
4189
|
+
computedRetryCount = 0;
|
|
4190
|
+
get retryCount() {
|
|
4191
|
+
return this.computedRetryCount;
|
|
4192
|
+
}
|
|
2538
4193
|
get error() {
|
|
2539
4194
|
return this.computedError;
|
|
2540
4195
|
}
|
|
@@ -2563,7 +4218,23 @@ class Fetchable {
|
|
|
2563
4218
|
async fetch(options = {}) {
|
|
2564
4219
|
this.fetching();
|
|
2565
4220
|
try {
|
|
2566
|
-
this.computedResponse = await
|
|
4221
|
+
this.computedResponse = await this.ky(
|
|
4222
|
+
this.resource,
|
|
4223
|
+
{
|
|
4224
|
+
...options,
|
|
4225
|
+
signal: this.abortController.signal,
|
|
4226
|
+
hooks: {
|
|
4227
|
+
...options.hooks,
|
|
4228
|
+
beforeRetry: [
|
|
4229
|
+
...options.hooks?.beforeRetry || [],
|
|
4230
|
+
({ retryCount }) => {
|
|
4231
|
+
this.retrying();
|
|
4232
|
+
this.computedRetryCount = retryCount;
|
|
4233
|
+
}
|
|
4234
|
+
]
|
|
4235
|
+
}
|
|
4236
|
+
}
|
|
4237
|
+
);
|
|
2567
4238
|
this.fetched();
|
|
2568
4239
|
} catch (error) {
|
|
2569
4240
|
this.computedError = error;
|
|
@@ -2577,6 +4248,9 @@ class Fetchable {
|
|
|
2577
4248
|
fetching() {
|
|
2578
4249
|
this.computedStatus = "fetching";
|
|
2579
4250
|
}
|
|
4251
|
+
retrying() {
|
|
4252
|
+
this.computedStatus = "retrying";
|
|
4253
|
+
}
|
|
2580
4254
|
fetched() {
|
|
2581
4255
|
this.computedStatus = "fetched";
|
|
2582
4256
|
}
|
|
@@ -2587,23 +4261,27 @@ class Fetchable {
|
|
|
2587
4261
|
this.computedStatus = "errored";
|
|
2588
4262
|
}
|
|
2589
4263
|
async get(options = {}) {
|
|
2590
|
-
await this.fetch({ signal: this.abortController.signal, ...
|
|
4264
|
+
await this.fetch({ signal: this.abortController.signal, ...options, method: "get" });
|
|
2591
4265
|
return this;
|
|
2592
4266
|
}
|
|
2593
4267
|
async patch(options = {}) {
|
|
2594
|
-
await this.fetch({ signal: this.abortController.signal, ...
|
|
4268
|
+
await this.fetch({ signal: this.abortController.signal, ...options, method: "patch" });
|
|
2595
4269
|
return this;
|
|
2596
4270
|
}
|
|
2597
4271
|
async post(options = {}) {
|
|
2598
|
-
await this.fetch({ signal: this.abortController.signal, ...
|
|
4272
|
+
await this.fetch({ signal: this.abortController.signal, ...options, method: "post" });
|
|
2599
4273
|
return this;
|
|
2600
4274
|
}
|
|
2601
4275
|
async put(options = {}) {
|
|
2602
|
-
await this.fetch({ signal: this.abortController.signal, ...
|
|
4276
|
+
await this.fetch({ signal: this.abortController.signal, ...options, method: "put" });
|
|
2603
4277
|
return this;
|
|
2604
4278
|
}
|
|
2605
4279
|
async delete(options = {}) {
|
|
2606
|
-
await this.fetch({ signal: this.abortController.signal, ...
|
|
4280
|
+
await this.fetch({ signal: this.abortController.signal, ...options, method: "delete" });
|
|
4281
|
+
return this;
|
|
4282
|
+
}
|
|
4283
|
+
async head(options = {}) {
|
|
4284
|
+
await this.fetch({ signal: this.abortController.signal, ...options, method: "head" });
|
|
2607
4285
|
return this;
|
|
2608
4286
|
}
|
|
2609
4287
|
abort() {
|
|
@@ -2612,16 +4290,9 @@ class Fetchable {
|
|
|
2612
4290
|
}
|
|
2613
4291
|
}
|
|
2614
4292
|
function narrowOptions(options) {
|
|
2615
|
-
|
|
2616
|
-
}
|
|
2617
|
-
|
|
2618
|
-
return {
|
|
2619
|
-
body: JSON.stringify(data),
|
|
2620
|
-
headers: {
|
|
2621
|
-
"Accept": "application/json",
|
|
2622
|
-
"Content-Type": "application/json"
|
|
2623
|
-
}
|
|
2624
|
-
};
|
|
4293
|
+
if (!options)
|
|
4294
|
+
return {};
|
|
4295
|
+
return predicateFunction(options) ? options({ stop: ky.stop }) : options;
|
|
2625
4296
|
}
|
|
2626
4297
|
|
|
2627
4298
|
class Fullscreenable {
|
|
@@ -2949,13 +4620,12 @@ class Pickable {
|
|
|
2949
4620
|
}
|
|
2950
4621
|
pick(indexOrIndices, options = {}) {
|
|
2951
4622
|
const { replace, allowsDuplicates } = { ...defaultPickOptions, ...options };
|
|
2952
|
-
this.computedPicks =
|
|
4623
|
+
this.computedPicks = lazyCollections.pipe(
|
|
2953
4624
|
narrowIndices,
|
|
2954
4625
|
this.toPossiblePicks,
|
|
2955
4626
|
(possiblePicks) => {
|
|
2956
|
-
if (replace === "all")
|
|
4627
|
+
if (replace === "all")
|
|
2957
4628
|
return allowsDuplicates ? possiblePicks : toUnique(possiblePicks);
|
|
2958
|
-
}
|
|
2959
4629
|
const maybeWithoutDuplicates = allowsDuplicates ? possiblePicks : createFilter(
|
|
2960
4630
|
(possiblePick) => typeof lazyCollections.find((pick) => pick === possiblePick)(this.picks || []) !== "number"
|
|
2961
4631
|
)(possiblePicks);
|
|
@@ -2972,10 +4642,11 @@ class Pickable {
|
|
|
2972
4642
|
if (maybeWithoutDuplicates.length > this.picks.length) {
|
|
2973
4643
|
return createSlice(maybeWithoutDuplicates.length - this.picks.length)(maybeWithoutDuplicates);
|
|
2974
4644
|
}
|
|
2975
|
-
return
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
4645
|
+
return lazyCollections.pipe(
|
|
4646
|
+
lazyCollections.slice(maybeWithoutDuplicates.length),
|
|
4647
|
+
(array) => lazyCollections.concat(array, maybeWithoutDuplicates),
|
|
4648
|
+
lazyCollections.toArray()
|
|
4649
|
+
)(this.picks);
|
|
2979
4650
|
case "lifo":
|
|
2980
4651
|
if (maybeWithoutDuplicates.length === 0) {
|
|
2981
4652
|
return this.picks;
|
|
@@ -2986,13 +4657,14 @@ class Pickable {
|
|
|
2986
4657
|
if (maybeWithoutDuplicates.length > this.picks.length) {
|
|
2987
4658
|
return createSlice(0, maybeWithoutDuplicates.length - this.picks.length + 1)(maybeWithoutDuplicates);
|
|
2988
4659
|
}
|
|
2989
|
-
return
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
4660
|
+
return lazyCollections.pipe(
|
|
4661
|
+
lazyCollections.slice(0, this.picks.length - maybeWithoutDuplicates.length - 1),
|
|
4662
|
+
(array) => lazyCollections.concat(array, maybeWithoutDuplicates),
|
|
4663
|
+
lazyCollections.toArray()
|
|
4664
|
+
)(this.picks);
|
|
2993
4665
|
}
|
|
2994
4666
|
}
|
|
2995
|
-
);
|
|
4667
|
+
)(indexOrIndices);
|
|
2996
4668
|
this.computedFirst = Math.min(...this.picks);
|
|
2997
4669
|
this.computedLast = Math.max(...this.picks);
|
|
2998
4670
|
this.computedMultiple = toUnique(this.picks).length > 1;
|
|
@@ -3040,7 +4712,7 @@ class Sanitizeable {
|
|
|
3040
4712
|
computedDompurify;
|
|
3041
4713
|
computedStatus;
|
|
3042
4714
|
ready() {
|
|
3043
|
-
if (
|
|
4715
|
+
if (getDomAvailability() === "available") {
|
|
3044
4716
|
this.computedDompurify = createDOMPurify();
|
|
3045
4717
|
this.computedDompurify.setConfig(this.domPurifyConfig);
|
|
3046
4718
|
}
|
|
@@ -3053,7 +4725,7 @@ class Sanitizeable {
|
|
|
3053
4725
|
this.setHtml(html);
|
|
3054
4726
|
}
|
|
3055
4727
|
get dompurify() {
|
|
3056
|
-
if (!this.computedDompurify &&
|
|
4728
|
+
if (!this.computedDompurify && getDomAvailability() === "available") {
|
|
3057
4729
|
this.computedDompurify = createDOMPurify();
|
|
3058
4730
|
this.computedDompurify.setConfig(this.domPurifyConfig);
|
|
3059
4731
|
}
|
|
@@ -3196,7 +4868,7 @@ class Storeable {
|
|
|
3196
4868
|
computedStatus;
|
|
3197
4869
|
ready() {
|
|
3198
4870
|
this.computedStatus = "ready";
|
|
3199
|
-
if (
|
|
4871
|
+
if (getDomAvailability() === "available") {
|
|
3200
4872
|
if (predicateNull(this.storage.getItem(this.computedStatusKey))) {
|
|
3201
4873
|
this.storeStatus();
|
|
3202
4874
|
}
|
|
@@ -3209,7 +4881,7 @@ class Storeable {
|
|
|
3209
4881
|
this.setKey(key);
|
|
3210
4882
|
}
|
|
3211
4883
|
get status() {
|
|
3212
|
-
if (
|
|
4884
|
+
if (getDomAvailability() === "available") {
|
|
3213
4885
|
const storedStatus = this.storage.getItem(this.computedStatusKey);
|
|
3214
4886
|
if (this.computedStatus !== storedStatus && predicateString(storedStatus)) {
|
|
3215
4887
|
this.computedStatus = storedStatus;
|
|
@@ -3299,6 +4971,7 @@ class Storeable {
|
|
|
3299
4971
|
|
|
3300
4972
|
exports.Animateable = Animateable;
|
|
3301
4973
|
exports.Broadcastable = Broadcastable;
|
|
4974
|
+
exports.Compareable = Compareable;
|
|
3302
4975
|
exports.Completeable = Completeable;
|
|
3303
4976
|
exports.Copyable = Copyable;
|
|
3304
4977
|
exports.Delayable = Delayable;
|
|
@@ -3309,26 +4982,61 @@ exports.Grantable = Grantable;
|
|
|
3309
4982
|
exports.Listenable = Listenable;
|
|
3310
4983
|
exports.Navigateable = Navigateable;
|
|
3311
4984
|
exports.Pickable = Pickable;
|
|
3312
|
-
exports.Pipeable = Pipeable;
|
|
3313
4985
|
exports.Recognizeable = Recognizeable;
|
|
3314
4986
|
exports.Resolveable = Resolveable;
|
|
3315
4987
|
exports.Sanitizeable = Sanitizeable;
|
|
3316
4988
|
exports.Searchable = Searchable;
|
|
3317
4989
|
exports.Shareable = Shareable;
|
|
3318
4990
|
exports.Storeable = Storeable;
|
|
4991
|
+
exports.createAssociativeArray = createAssociativeArray;
|
|
4992
|
+
exports.createAsyncDirectedAcyclicPredicateAncestor = createPredicateAncestor$1;
|
|
4993
|
+
exports.createAsyncDirectedAcyclicToCommonAncestors = createToCommonAncestors$1;
|
|
4994
|
+
exports.createAsyncDirectedAcyclicToLayers = createToLayers;
|
|
4995
|
+
exports.createAsyncDirectedAcyclicToNodeSteps = createToNodeSteps$1;
|
|
4996
|
+
exports.createAsyncDirectedAcyclicToPath = createToPath$1;
|
|
4997
|
+
exports.createAsyncDirectedAcyclicToSteps = createToSteps$1;
|
|
4998
|
+
exports.createAsyncDirectedAcyclicToTree = createToTree$1;
|
|
3319
4999
|
exports.createClamp = createClamp;
|
|
3320
5000
|
exports.createClip = createClip;
|
|
5001
|
+
exports.createClone = createClone;
|
|
3321
5002
|
exports.createConcat = createConcat;
|
|
5003
|
+
exports.createDecisionTreePredicateAncestor = createPredicateAncestor;
|
|
5004
|
+
exports.createDecisionTreeToCommonAncestors = createToCommonAncestors;
|
|
5005
|
+
exports.createDecisionTreeToNodeSteps = createToNodeSteps;
|
|
5006
|
+
exports.createDecisionTreeToPath = createToPath;
|
|
5007
|
+
exports.createDecisionTreeToSteps = createToSteps;
|
|
5008
|
+
exports.createDecisionTreeToTree = createToTree;
|
|
3322
5009
|
exports.createDetermine = createDetermine;
|
|
5010
|
+
exports.createDirectedAcyclicPredicateAncestor = createPredicateAncestor$2;
|
|
5011
|
+
exports.createDirectedAcyclicToCommonAncestors = createToCommonAncestors$2;
|
|
5012
|
+
exports.createDirectedAcyclicToLayers = createToLayers$1;
|
|
5013
|
+
exports.createDirectedAcyclicToNodeSteps = createToNodeSteps$2;
|
|
5014
|
+
exports.createDirectedAcyclicToPath = createToPath$2;
|
|
5015
|
+
exports.createDirectedAcyclicToRoots = createToRoots;
|
|
5016
|
+
exports.createDirectedAcyclicToSteps = createToSteps$2;
|
|
5017
|
+
exports.createDirectedAcyclicToTree = createToTree$2;
|
|
5018
|
+
exports.createEntries = createEntries;
|
|
5019
|
+
exports.createEqual = createEqual;
|
|
5020
|
+
exports.createEvery = createEvery;
|
|
3323
5021
|
exports.createFilter = createFilter;
|
|
3324
5022
|
exports.createFilterAsync = createFilterAsync;
|
|
5023
|
+
exports.createFindAsync = createFindAsync;
|
|
5024
|
+
exports.createFindIndexAsync = createFindIndexAsync;
|
|
5025
|
+
exports.createFocusable = createFocusable;
|
|
3325
5026
|
exports.createForEachAsync = createForEachAsync;
|
|
3326
5027
|
exports.createInsert = createInsert;
|
|
5028
|
+
exports.createKeychord = createKeychord;
|
|
5029
|
+
exports.createKeypress = createKeypress;
|
|
5030
|
+
exports.createKeyrelease = createKeyrelease;
|
|
5031
|
+
exports.createKeys = createKeys;
|
|
5032
|
+
exports.createKonami = createKonami;
|
|
5033
|
+
exports.createList = createList;
|
|
3327
5034
|
exports.createMap = createMap;
|
|
3328
5035
|
exports.createMapAsync = createMapAsync;
|
|
3329
|
-
exports.
|
|
3330
|
-
exports.
|
|
3331
|
-
exports.
|
|
5036
|
+
exports.createMousepress = createMousepress;
|
|
5037
|
+
exports.createMouserelease = createMouserelease;
|
|
5038
|
+
exports.createPredicateKeycomboMatch = createPredicateKeycomboMatch$1;
|
|
5039
|
+
exports.createPredicateRoot = createPredicateRoot;
|
|
3332
5040
|
exports.createReduce = createReduce;
|
|
3333
5041
|
exports.createReduceAsync = createReduceAsync;
|
|
3334
5042
|
exports.createRemove = createRemove;
|
|
@@ -3338,14 +5046,27 @@ exports.createReplace = createReplace;
|
|
|
3338
5046
|
exports.createReverse = createReverse;
|
|
3339
5047
|
exports.createSlice = createSlice;
|
|
3340
5048
|
exports.createSlug = createSlug;
|
|
5049
|
+
exports.createSome = createSome;
|
|
3341
5050
|
exports.createSort = createSort;
|
|
3342
5051
|
exports.createSwap = createSwap;
|
|
3343
|
-
exports.
|
|
3344
|
-
exports.
|
|
3345
|
-
exports.
|
|
3346
|
-
exports.
|
|
3347
|
-
exports.
|
|
5052
|
+
exports.createToGraph = createToGraph;
|
|
5053
|
+
exports.createToIncoming = createToIncoming;
|
|
5054
|
+
exports.createToIndegree = createToIndegree;
|
|
5055
|
+
exports.createToOutdegree = createToOutdegree;
|
|
5056
|
+
exports.createToOutgoing = createToOutgoing;
|
|
5057
|
+
exports.createTouchpress = createTouchpress;
|
|
5058
|
+
exports.createTouchrelease = createTouchrelease;
|
|
5059
|
+
exports.createTreeFind = createFind;
|
|
3348
5060
|
exports.createUnique = createUnique;
|
|
5061
|
+
exports.defineAssociativeArrayEntries = defineAssociativeArrayEntries;
|
|
5062
|
+
exports.defineAsyncGraph = defineAsyncGraph;
|
|
5063
|
+
exports.defineAsyncGraphEdge = defineAsyncGraphEdge;
|
|
5064
|
+
exports.defineAsyncGraphEdges = defineAsyncGraphEdges;
|
|
5065
|
+
exports.defineGraph = defineGraph;
|
|
5066
|
+
exports.defineGraphEdge = defineGraphEdge;
|
|
5067
|
+
exports.defineGraphEdges = defineGraphEdges;
|
|
5068
|
+
exports.defineGraphNode = defineGraphNode;
|
|
5069
|
+
exports.defineGraphNodes = defineGraphNodes;
|
|
3349
5070
|
exports.easingsNetInBack = easingsNetInBack;
|
|
3350
5071
|
exports.easingsNetInCirc = easingsNetInCirc;
|
|
3351
5072
|
exports.easingsNetInCubic = easingsNetInCubic;
|