@baleada/logic 0.22.6 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +2229 -491
- package/lib/index.d.ts +507 -71
- package/lib/index.js +2173 -485
- 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,257 +146,1986 @@ 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
|
-
|
|
206
|
+
|
|
207
|
+
function createClip(required) {
|
|
208
|
+
return (string) => {
|
|
209
|
+
return string.replace(required, "");
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function createSlug(options) {
|
|
213
|
+
return (string) => {
|
|
214
|
+
return slugify(string, options);
|
|
215
|
+
};
|
|
216
|
+
}
|
|
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
|
+
const defaultOptions$f = {
|
|
1263
|
+
minDuration: 0,
|
|
1264
|
+
minDistance: 0,
|
|
1265
|
+
getMousemoveTarget: (event) => event.target
|
|
1266
|
+
};
|
|
1267
|
+
function createMousepress(options = {}) {
|
|
1268
|
+
const {
|
|
1269
|
+
minDuration,
|
|
1270
|
+
minDistance,
|
|
1271
|
+
getMousemoveTarget,
|
|
1272
|
+
onDown,
|
|
1273
|
+
onLeave,
|
|
1274
|
+
onMove,
|
|
1275
|
+
onUp
|
|
1276
|
+
} = { ...defaultOptions$f, ...options }, cleanup = (event) => {
|
|
1277
|
+
window.cancelAnimationFrame(request);
|
|
1278
|
+
getMousemoveTarget(event).removeEventListener("mousemove", mousemoveEffect);
|
|
1279
|
+
};
|
|
1280
|
+
let request;
|
|
1281
|
+
let mousemoveEffect;
|
|
1282
|
+
let mouseStatus;
|
|
1283
|
+
const mousedown = (event, api) => {
|
|
1284
|
+
mouseStatus = "down";
|
|
1285
|
+
mousemoveEffect = (event2) => mousemove(event2, api);
|
|
1286
|
+
storePointerStartMetadata(event, api);
|
|
1287
|
+
storePointerMoveMetadata(event, api);
|
|
1288
|
+
storePointerTimeMetadata(
|
|
1289
|
+
event,
|
|
1290
|
+
api,
|
|
1291
|
+
() => mouseStatus === "down",
|
|
1292
|
+
(newRequest) => request = newRequest,
|
|
1293
|
+
recognize
|
|
1294
|
+
);
|
|
1295
|
+
getMousemoveTarget(event).addEventListener("mousemove", mousemoveEffect);
|
|
1296
|
+
onDown?.(toHookApi(api));
|
|
1297
|
+
};
|
|
1298
|
+
const mousemove = (event, api) => {
|
|
1299
|
+
storePointerMoveMetadata(event, api);
|
|
1300
|
+
recognize(event, api);
|
|
1301
|
+
onMove?.(toHookApi(api));
|
|
1302
|
+
};
|
|
1303
|
+
const recognize = (event, api) => {
|
|
1304
|
+
const { getMetadata, recognized } = api, metadata = getMetadata();
|
|
1305
|
+
if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance) {
|
|
1306
|
+
recognized();
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
const mouseleave = (event, api) => {
|
|
1310
|
+
const { denied } = api;
|
|
1311
|
+
if (mouseStatus === "down") {
|
|
1312
|
+
denied();
|
|
1313
|
+
cleanup(event);
|
|
1314
|
+
mouseStatus = "leave";
|
|
1315
|
+
}
|
|
1316
|
+
onLeave?.(toHookApi(api));
|
|
1317
|
+
};
|
|
1318
|
+
const mouseup = (event, api) => {
|
|
1319
|
+
const { denied } = api;
|
|
1320
|
+
if (mouseStatus !== "down")
|
|
1321
|
+
return;
|
|
1322
|
+
denied();
|
|
1323
|
+
cleanup(event);
|
|
1324
|
+
mouseStatus = "up";
|
|
1325
|
+
onUp?.(toHookApi(api));
|
|
1326
|
+
};
|
|
1327
|
+
return {
|
|
1328
|
+
mousedown,
|
|
1329
|
+
mouseleave,
|
|
1330
|
+
mouseup
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
const defaultOptions$e = {
|
|
1335
|
+
minDuration: 0,
|
|
1336
|
+
minDistance: 0,
|
|
1337
|
+
minVelocity: 0,
|
|
1338
|
+
getMousemoveTarget: (event) => event.target
|
|
1339
|
+
};
|
|
1340
|
+
function createMouserelease(options = {}) {
|
|
1341
|
+
const {
|
|
1342
|
+
minDuration,
|
|
1343
|
+
minDistance,
|
|
1344
|
+
minVelocity,
|
|
1345
|
+
getMousemoveTarget,
|
|
1346
|
+
onDown,
|
|
1347
|
+
onLeave,
|
|
1348
|
+
onMove,
|
|
1349
|
+
onUp
|
|
1350
|
+
} = { ...defaultOptions$e, ...options }, cleanup = (event) => {
|
|
1351
|
+
window.cancelAnimationFrame(request);
|
|
1352
|
+
getMousemoveTarget(event).removeEventListener("mousemove", mousemoveEffect);
|
|
1353
|
+
};
|
|
1354
|
+
let request;
|
|
1355
|
+
let mousemoveEffect;
|
|
1356
|
+
let mouseStatus;
|
|
1357
|
+
const mousedown = (event, api) => {
|
|
1358
|
+
mouseStatus = "down";
|
|
1359
|
+
mousemoveEffect = (event2) => mousemove(event2, api);
|
|
1360
|
+
storePointerStartMetadata(event, api);
|
|
1361
|
+
storePointerMoveMetadata(event, api);
|
|
1362
|
+
storePointerTimeMetadata(
|
|
1363
|
+
event,
|
|
1364
|
+
api,
|
|
1365
|
+
() => mouseStatus === "down",
|
|
1366
|
+
(newRequest) => request = newRequest
|
|
1367
|
+
);
|
|
1368
|
+
getMousemoveTarget(event).addEventListener("mousemove", mousemoveEffect);
|
|
1369
|
+
onDown?.(toHookApi(api));
|
|
1370
|
+
};
|
|
1371
|
+
const mousemove = (event, api) => {
|
|
1372
|
+
storePointerMoveMetadata(event, api);
|
|
1373
|
+
onMove?.(toHookApi(api));
|
|
1374
|
+
};
|
|
1375
|
+
const mouseleave = (event, api) => {
|
|
1376
|
+
const { denied } = api;
|
|
1377
|
+
if (mouseStatus === "down") {
|
|
1378
|
+
denied();
|
|
1379
|
+
cleanup(event);
|
|
1380
|
+
mouseStatus = "leave";
|
|
1381
|
+
}
|
|
1382
|
+
onLeave?.(toHookApi(api));
|
|
1383
|
+
};
|
|
1384
|
+
const mouseup = (event, api) => {
|
|
1385
|
+
if (mouseStatus !== "down")
|
|
1386
|
+
return;
|
|
1387
|
+
storePointerMoveMetadata(event, api);
|
|
1388
|
+
cleanup(event);
|
|
1389
|
+
mouseStatus = "up";
|
|
1390
|
+
recognize(event, api);
|
|
1391
|
+
onUp?.(toHookApi(api));
|
|
1392
|
+
};
|
|
1393
|
+
const recognize = (event, api) => {
|
|
1394
|
+
const { getMetadata, recognized, denied } = api, metadata = getMetadata();
|
|
1395
|
+
if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance && metadata.velocity >= minVelocity) {
|
|
1396
|
+
recognized();
|
|
1397
|
+
} else {
|
|
1398
|
+
denied();
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1401
|
+
return {
|
|
1402
|
+
mousedown,
|
|
1403
|
+
mouseleave,
|
|
1404
|
+
mouseup
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
const defaultOptions$d = {
|
|
1409
|
+
minDuration: 0,
|
|
1410
|
+
minDistance: 0
|
|
1411
|
+
};
|
|
1412
|
+
function createTouchpress(options = {}) {
|
|
1413
|
+
const {
|
|
1414
|
+
minDuration,
|
|
1415
|
+
minDistance,
|
|
1416
|
+
onStart,
|
|
1417
|
+
onCancel,
|
|
1418
|
+
onMove,
|
|
1419
|
+
onEnd
|
|
1420
|
+
} = { ...defaultOptions$d, ...options }, cleanup = () => {
|
|
1421
|
+
window.cancelAnimationFrame(request);
|
|
1422
|
+
};
|
|
1423
|
+
let request;
|
|
1424
|
+
let totalTouches = 0;
|
|
1425
|
+
const touchstart = (event, api) => {
|
|
1426
|
+
const { denied } = api;
|
|
1427
|
+
totalTouches++;
|
|
1428
|
+
if (totalTouches > 1) {
|
|
1429
|
+
cleanup();
|
|
1430
|
+
denied();
|
|
1431
|
+
onStart?.(toHookApi(api));
|
|
1432
|
+
return;
|
|
1433
|
+
}
|
|
1434
|
+
storePointerStartMetadata(event, api);
|
|
1435
|
+
storePointerMoveMetadata(event, api);
|
|
1436
|
+
storePointerTimeMetadata(
|
|
1437
|
+
event,
|
|
1438
|
+
api,
|
|
1439
|
+
() => totalTouches === 1,
|
|
1440
|
+
(newRequest) => request = newRequest,
|
|
1441
|
+
recognize
|
|
1442
|
+
);
|
|
1443
|
+
onStart?.(toHookApi(api));
|
|
1444
|
+
};
|
|
1445
|
+
const touchmove = (event, api) => {
|
|
1446
|
+
const { getStatus } = api;
|
|
1447
|
+
if (getStatus() !== "denied") {
|
|
1448
|
+
storePointerMoveMetadata(event, api);
|
|
1449
|
+
recognize(event, api);
|
|
1450
|
+
}
|
|
1451
|
+
onMove?.(toHookApi(api));
|
|
1452
|
+
};
|
|
1453
|
+
const recognize = (event, api) => {
|
|
1454
|
+
const { getMetadata, recognized } = api, metadata = getMetadata();
|
|
1455
|
+
if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance) {
|
|
1456
|
+
recognized();
|
|
1457
|
+
}
|
|
1458
|
+
};
|
|
1459
|
+
const touchcancel = (event, api) => {
|
|
1460
|
+
const { denied } = api;
|
|
1461
|
+
cleanup();
|
|
1462
|
+
denied();
|
|
1463
|
+
totalTouches--;
|
|
1464
|
+
onCancel?.(toHookApi(api));
|
|
1465
|
+
};
|
|
1466
|
+
const touchend = (event, api) => {
|
|
1467
|
+
const { denied } = api;
|
|
1468
|
+
cleanup();
|
|
1469
|
+
denied();
|
|
1470
|
+
totalTouches--;
|
|
1471
|
+
onEnd?.(toHookApi(api));
|
|
1472
|
+
};
|
|
1473
|
+
return {
|
|
1474
|
+
touchstart,
|
|
1475
|
+
touchmove,
|
|
1476
|
+
touchcancel,
|
|
1477
|
+
touchend
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
const defaultOptions$c = {
|
|
1482
|
+
minDuration: 0,
|
|
1483
|
+
minDistance: 0,
|
|
1484
|
+
minVelocity: 0
|
|
1485
|
+
};
|
|
1486
|
+
function createTouchrelease(options = {}) {
|
|
1487
|
+
const {
|
|
1488
|
+
minDuration,
|
|
1489
|
+
minDistance,
|
|
1490
|
+
minVelocity,
|
|
1491
|
+
onStart,
|
|
1492
|
+
onCancel,
|
|
1493
|
+
onMove,
|
|
1494
|
+
onEnd
|
|
1495
|
+
} = { ...defaultOptions$c, ...options }, cleanup = () => {
|
|
1496
|
+
window.cancelAnimationFrame(request);
|
|
1497
|
+
};
|
|
1498
|
+
let request;
|
|
1499
|
+
let totalTouches = 0;
|
|
1500
|
+
const touchstart = (event, api) => {
|
|
1501
|
+
const { denied } = api;
|
|
1502
|
+
totalTouches++;
|
|
1503
|
+
if (totalTouches > 1) {
|
|
1504
|
+
cleanup();
|
|
1505
|
+
denied();
|
|
1506
|
+
onStart?.(toHookApi(api));
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
storePointerStartMetadata(event, api);
|
|
1510
|
+
storePointerMoveMetadata(event, api);
|
|
1511
|
+
storePointerTimeMetadata(
|
|
1512
|
+
event,
|
|
1513
|
+
api,
|
|
1514
|
+
() => totalTouches === 1,
|
|
1515
|
+
(newRequest) => request = newRequest
|
|
1516
|
+
);
|
|
1517
|
+
onStart?.(toHookApi(api));
|
|
1518
|
+
};
|
|
1519
|
+
const touchmove = (event, api) => {
|
|
1520
|
+
const { getStatus } = api;
|
|
1521
|
+
if (getStatus() !== "denied")
|
|
1522
|
+
storePointerMoveMetadata(event, api);
|
|
1523
|
+
onMove?.(toHookApi(api));
|
|
1524
|
+
};
|
|
1525
|
+
const touchcancel = (event, api) => {
|
|
1526
|
+
const { denied } = api;
|
|
1527
|
+
cleanup();
|
|
1528
|
+
denied();
|
|
1529
|
+
totalTouches--;
|
|
1530
|
+
onCancel?.(toHookApi(api));
|
|
1531
|
+
};
|
|
1532
|
+
const touchend = (event, api) => {
|
|
1533
|
+
const { denied } = api;
|
|
1534
|
+
if (totalTouches !== 1) {
|
|
1535
|
+
cleanup();
|
|
1536
|
+
denied();
|
|
1537
|
+
onEnd?.(toHookApi(api));
|
|
1538
|
+
return;
|
|
1539
|
+
}
|
|
1540
|
+
storePointerMoveMetadata(event, api);
|
|
1541
|
+
cleanup();
|
|
1542
|
+
totalTouches--;
|
|
1543
|
+
recognize(event, api);
|
|
1544
|
+
onEnd?.(toHookApi(api));
|
|
1545
|
+
};
|
|
1546
|
+
const recognize = (event, api) => {
|
|
1547
|
+
const { getMetadata, recognized, denied } = api, metadata = getMetadata();
|
|
1548
|
+
if (metadata.duration >= minDuration && metadata.distance.straight.fromStart >= minDistance && metadata.velocity >= minVelocity) {
|
|
1549
|
+
recognized();
|
|
1550
|
+
} else {
|
|
1551
|
+
denied();
|
|
1552
|
+
}
|
|
1553
|
+
};
|
|
1554
|
+
return {
|
|
1555
|
+
touchstart,
|
|
1556
|
+
touchmove,
|
|
1557
|
+
touchcancel,
|
|
1558
|
+
touchend
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
const defaultOptions$b = {
|
|
1563
|
+
initial: []
|
|
1564
|
+
};
|
|
1565
|
+
function createKeyStatuses(options = {}) {
|
|
1566
|
+
return createAssociativeArray({
|
|
1567
|
+
...defaultOptions$b,
|
|
1568
|
+
...options,
|
|
1569
|
+
createPredicateKey: (query) => (key) => {
|
|
1570
|
+
for (const prop in query) {
|
|
1571
|
+
if (query[prop] !== key[prop]) {
|
|
1572
|
+
return false;
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
return true;
|
|
1576
|
+
}
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
function predicateDown(status) {
|
|
1580
|
+
return status === "down";
|
|
1581
|
+
}
|
|
1582
|
+
function predicateSomeKeyDown(statuses) {
|
|
1583
|
+
return lazyCollections.includes("down")(statuses.toValues());
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
function fromComboToAliases(combo) {
|
|
1587
|
+
const delimiter = "+";
|
|
1588
|
+
return lazyCollections.pipe(
|
|
1589
|
+
lazyCollections.unique(),
|
|
1590
|
+
lazyCollections.map((name) => name === "" ? delimiter : name.toLowerCase()),
|
|
1591
|
+
lazyCollections.toArray()
|
|
1592
|
+
)(combo.split(delimiter));
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
function fromAliasToKeyStatusKey(alias) {
|
|
1596
|
+
if (alias in keysByAlias) {
|
|
1597
|
+
return { key: keysByAlias[alias] };
|
|
1598
|
+
}
|
|
1599
|
+
return {
|
|
1600
|
+
code: (() => {
|
|
1601
|
+
if (alias in codesByAlias)
|
|
1602
|
+
return codesByAlias[alias];
|
|
1603
|
+
if (letterRE.test(alias))
|
|
1604
|
+
return `Key${alias.toUpperCase()}`;
|
|
1605
|
+
if (digitRE.test(alias))
|
|
1606
|
+
return `Digit${alias}`;
|
|
1607
|
+
if (functionRE.test(alias))
|
|
1608
|
+
return alias.toUpperCase();
|
|
1609
|
+
return "unsupported";
|
|
1610
|
+
})()
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
1613
|
+
const digitRE = /^[0-9]$/;
|
|
1614
|
+
const letterRE = /^[a-zA-Z]$/;
|
|
1615
|
+
const functionRE = /^[fF][0-9]{1,2}$/;
|
|
1616
|
+
const codesByAlias = {
|
|
1617
|
+
"`": "Backquote",
|
|
1618
|
+
"~": "Backquote",
|
|
1619
|
+
"-": "Minus",
|
|
1620
|
+
_: "Minus",
|
|
1621
|
+
"=": "Equal",
|
|
1622
|
+
"+": "Equal",
|
|
1623
|
+
"[": "BracketLeft",
|
|
1624
|
+
"{": "BracketLeft",
|
|
1625
|
+
"]": "BracketRight",
|
|
1626
|
+
"}": "BracketRight",
|
|
1627
|
+
"\\": "Backslash",
|
|
1628
|
+
"|": "Backslash",
|
|
1629
|
+
";": "Semicolon",
|
|
1630
|
+
":": "Semicolon",
|
|
1631
|
+
"'": "Quote",
|
|
1632
|
+
'"': "Quote",
|
|
1633
|
+
",": "Comma",
|
|
1634
|
+
"<": "Comma",
|
|
1635
|
+
".": "Period",
|
|
1636
|
+
">": "Period",
|
|
1637
|
+
"/": "Slash",
|
|
1638
|
+
"?": "Slash",
|
|
1639
|
+
"!": "Digit1",
|
|
1640
|
+
"@": "Digit2",
|
|
1641
|
+
"#": "Digit3",
|
|
1642
|
+
$: "Digit4",
|
|
1643
|
+
"%": "Digit5",
|
|
1644
|
+
"^": "Digit6",
|
|
1645
|
+
"&": "Digit7",
|
|
1646
|
+
"*": "Digit8",
|
|
1647
|
+
"(": "Digit9",
|
|
1648
|
+
")": "Digit0",
|
|
1649
|
+
up: "ArrowUp",
|
|
1650
|
+
down: "ArrowDown",
|
|
1651
|
+
left: "ArrowLeft",
|
|
1652
|
+
right: "ArrowRight",
|
|
1653
|
+
enter: "Enter",
|
|
1654
|
+
space: "Space",
|
|
1655
|
+
tab: "Tab",
|
|
1656
|
+
esc: "Escape",
|
|
1657
|
+
backspace: "Backspace",
|
|
1658
|
+
delete: "Delete",
|
|
1659
|
+
home: "Home",
|
|
1660
|
+
end: "End",
|
|
1661
|
+
pagedown: "PageDown",
|
|
1662
|
+
pageup: "PageUp",
|
|
1663
|
+
capslock: "CapsLock",
|
|
1664
|
+
camera: "Camera"
|
|
1665
|
+
};
|
|
1666
|
+
const keysByAlias = {
|
|
1667
|
+
alt: "Alt",
|
|
1668
|
+
opt: "Alt",
|
|
1669
|
+
option: "Alt",
|
|
1670
|
+
ctrl: "Control",
|
|
1671
|
+
control: "Control",
|
|
1672
|
+
meta: "Meta",
|
|
1673
|
+
cmd: "Meta",
|
|
1674
|
+
command: "Meta",
|
|
1675
|
+
shift: "Shift"
|
|
1676
|
+
};
|
|
1677
|
+
|
|
1678
|
+
const defaultOptions$a = {
|
|
1679
|
+
toKey: (alias) => fromAliasToKeyStatusKey(alias)
|
|
1680
|
+
};
|
|
1681
|
+
const createPredicateKeycomboDown = (keycombo, options = {}) => {
|
|
1682
|
+
const { toKey } = { ...defaultOptions$a, ...options }, keys = lazyCollections.pipe(
|
|
1683
|
+
fromComboToAliases,
|
|
1684
|
+
lazyCollections.map(toKey)
|
|
1685
|
+
)(keycombo);
|
|
1686
|
+
return (statuses) => {
|
|
1687
|
+
const { toValue } = statuses;
|
|
1688
|
+
return lazyCollections.every(lazyCollections.pipe(
|
|
1689
|
+
toValue,
|
|
1690
|
+
predicateDown
|
|
1691
|
+
))(keys);
|
|
1692
|
+
};
|
|
1693
|
+
};
|
|
1694
|
+
|
|
1695
|
+
function fromEventToAliases(event) {
|
|
1696
|
+
if (event.shiftKey && event.code in aliasesByShiftCode) {
|
|
1697
|
+
return [aliasesByShiftCode[event.code]];
|
|
1698
|
+
}
|
|
1699
|
+
if (event.key in aliasListsByModifier) {
|
|
1700
|
+
return aliasListsByModifier[event.key];
|
|
1701
|
+
}
|
|
1702
|
+
return event.code in aliasesByCode ? [aliasesByCode[event.code]] : [event.code.match(aliasCaptureRE)?.[1].toLowerCase() || "unsupported"];
|
|
1703
|
+
}
|
|
1704
|
+
const aliasCaptureRE = /^(?:Digit|Key)?(F[0-9]{1,2}|[0-9]|[A-Z])$/;
|
|
1705
|
+
const aliasesByCode = {
|
|
1706
|
+
Backquote: "`",
|
|
1707
|
+
Minus: "-",
|
|
1708
|
+
Equal: "=",
|
|
1709
|
+
BracketLeft: "[",
|
|
1710
|
+
BracketRight: "]",
|
|
1711
|
+
Backslash: "\\",
|
|
1712
|
+
Semicolon: ";",
|
|
1713
|
+
Quote: "'",
|
|
1714
|
+
Comma: ",",
|
|
1715
|
+
Period: ".",
|
|
1716
|
+
Slash: "/",
|
|
1717
|
+
ArrowUp: "up",
|
|
1718
|
+
ArrowDown: "down",
|
|
1719
|
+
ArrowLeft: "left",
|
|
1720
|
+
ArrowRight: "right",
|
|
1721
|
+
Enter: "enter",
|
|
1722
|
+
Space: "space",
|
|
1723
|
+
Tab: "tab",
|
|
1724
|
+
Escape: "esc",
|
|
1725
|
+
Backspace: "backspace",
|
|
1726
|
+
Delete: "delete",
|
|
1727
|
+
Home: "home",
|
|
1728
|
+
End: "end",
|
|
1729
|
+
PageDown: "pagedown",
|
|
1730
|
+
PageUp: "pageup",
|
|
1731
|
+
CapsLock: "capslock",
|
|
1732
|
+
Camera: "camera"
|
|
1733
|
+
};
|
|
1734
|
+
const aliasesByShiftCode = {
|
|
1735
|
+
Backquote: "~",
|
|
1736
|
+
Minus: "_",
|
|
1737
|
+
Equal: "+",
|
|
1738
|
+
BracketLeft: "{",
|
|
1739
|
+
BracketRight: "}",
|
|
1740
|
+
Backslash: "|",
|
|
1741
|
+
Semicolon: ":",
|
|
1742
|
+
Quote: '"',
|
|
1743
|
+
Comma: "<",
|
|
1744
|
+
Period: ">",
|
|
1745
|
+
Slash: "?",
|
|
1746
|
+
Digit1: "!",
|
|
1747
|
+
Digit2: "@",
|
|
1748
|
+
Digit3: "#",
|
|
1749
|
+
Digit4: "$",
|
|
1750
|
+
Digit5: "%",
|
|
1751
|
+
Digit6: "^",
|
|
1752
|
+
Digit7: "&",
|
|
1753
|
+
Digit8: "*",
|
|
1754
|
+
Digit9: "(",
|
|
1755
|
+
Digit0: ")"
|
|
1756
|
+
};
|
|
1757
|
+
const aliasListsByModifier = {
|
|
1758
|
+
Alt: ["alt", "option", "opt"],
|
|
1759
|
+
Control: ["control", "ctrl"],
|
|
1760
|
+
Meta: ["meta", "command", "cmd"],
|
|
1761
|
+
Shift: ["shift"]
|
|
1762
|
+
};
|
|
1763
|
+
|
|
1764
|
+
const defaultOptions$9 = {
|
|
1765
|
+
toKey: (alias) => fromAliasToKeyStatusKey(alias),
|
|
1766
|
+
toAliases: (event) => fromEventToAliases(event)
|
|
1767
|
+
};
|
|
1768
|
+
const createPredicateKeycomboMatch = (keycombo, options = {}) => {
|
|
1769
|
+
const { toKey, toAliases } = { ...defaultOptions$9, ...options }, aliases = fromComboToAliases(keycombo), keys = lazyCollections.map(toKey)(aliases);
|
|
1770
|
+
return (statuses) => {
|
|
1771
|
+
const { toValue } = statuses;
|
|
1772
|
+
return lazyCollections.every(lazyCollections.pipe(
|
|
1773
|
+
toValue,
|
|
1774
|
+
predicateDown
|
|
1775
|
+
))(keys) && lazyCollections.every(
|
|
1776
|
+
([key, value]) => value === "up" || lazyCollections.some(
|
|
1777
|
+
(alias) => lazyCollections.includes(alias)(aliases)
|
|
1778
|
+
)(toAliases(key))
|
|
1779
|
+
)(statuses.toEntries());
|
|
1780
|
+
};
|
|
1781
|
+
};
|
|
1782
|
+
|
|
1783
|
+
function createKeyState({
|
|
1784
|
+
keycomboOrKeycombos,
|
|
1785
|
+
unsupportedAliases,
|
|
1786
|
+
toKey,
|
|
1787
|
+
toAliases,
|
|
1788
|
+
getRequest
|
|
1789
|
+
}) {
|
|
1790
|
+
const narrowedKeycombos = createFilter(
|
|
1791
|
+
(keycombo) => !lazyCollections.some(
|
|
1792
|
+
(alias) => lazyCollections.includes(alias)(unsupportedAliases)
|
|
1793
|
+
)(fromComboToAliases(keycombo))
|
|
1794
|
+
)(Array.isArray(keycomboOrKeycombos) ? keycomboOrKeycombos : [keycomboOrKeycombos]), createPredicateKeycomboDownOptions = { toKey }, downPredicatesByKeycombo = (() => {
|
|
1795
|
+
const predicates = [];
|
|
1796
|
+
for (const keycombo of narrowedKeycombos) {
|
|
1797
|
+
predicates.push([
|
|
1798
|
+
keycombo,
|
|
1799
|
+
createPredicateKeycomboDown(
|
|
1800
|
+
keycombo,
|
|
1801
|
+
createPredicateKeycomboDownOptions
|
|
1802
|
+
)
|
|
1803
|
+
]);
|
|
1804
|
+
}
|
|
1805
|
+
return predicates;
|
|
1806
|
+
})(), createPredicateKeycomboMatchOptions = { ...createPredicateKeycomboDownOptions, toAliases }, matchPredicatesByKeycombo = (() => {
|
|
1807
|
+
const predicates = {};
|
|
1808
|
+
for (const keycombo of narrowedKeycombos) {
|
|
1809
|
+
predicates[keycombo] = createPredicateKeycomboMatch(
|
|
1810
|
+
keycombo,
|
|
1811
|
+
createPredicateKeycomboMatchOptions
|
|
1812
|
+
);
|
|
1813
|
+
}
|
|
1814
|
+
return predicates;
|
|
1815
|
+
})(), validAliases = lazyCollections.pipe(
|
|
1816
|
+
lazyCollections.flatMap(fromComboToAliases),
|
|
1817
|
+
lazyCollections.unique(),
|
|
153
1818
|
lazyCollections.toArray()
|
|
154
|
-
)(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
lazyCollections.
|
|
1819
|
+
)(narrowedKeycombos), getDownCombos = () => lazyCollections.pipe(
|
|
1820
|
+
lazyCollections.filter(([, predicate]) => predicate(statuses)),
|
|
1821
|
+
lazyCollections.map(([keycombo]) => [keycombo, fromComboToAliases(keycombo)]),
|
|
1822
|
+
lazyCollections.sort(([, aliasesA], [, aliasesB]) => aliasesB.length - aliasesA.length),
|
|
1823
|
+
lazyCollections.map(([keycombo]) => keycombo),
|
|
159
1824
|
lazyCollections.toArray()
|
|
160
|
-
)()
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
1825
|
+
)(downPredicatesByKeycombo), predicateValid = (event) => {
|
|
1826
|
+
const aliases = toAliases(event);
|
|
1827
|
+
return lazyCollections.some(
|
|
1828
|
+
(validAlias) => lazyCollections.includes(validAlias)(aliases)
|
|
1829
|
+
)(validAliases);
|
|
1830
|
+
}, cleanup = () => {
|
|
1831
|
+
window.cancelAnimationFrame(getRequest());
|
|
1832
|
+
}, statuses = createKeyStatuses();
|
|
1833
|
+
return {
|
|
1834
|
+
narrowedKeycombos,
|
|
1835
|
+
createPredicateKeycomboDownOptions,
|
|
1836
|
+
downPredicatesByKeycombo,
|
|
1837
|
+
createPredicateKeycomboMatchOptions,
|
|
1838
|
+
matchPredicatesByKeycombo,
|
|
1839
|
+
validAliases,
|
|
1840
|
+
getDownCombos,
|
|
1841
|
+
predicateValid,
|
|
1842
|
+
cleanup,
|
|
1843
|
+
statuses
|
|
169
1844
|
};
|
|
170
1845
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
(sliced) => compare ? sliced.sort(compare) : sliced.sort()
|
|
176
|
-
);
|
|
1846
|
+
|
|
1847
|
+
function toLength() {
|
|
1848
|
+
return function toLengthFn(data) {
|
|
1849
|
+
return [...data].length;
|
|
177
1850
|
};
|
|
178
1851
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
1852
|
+
|
|
1853
|
+
const fromComboToAliasesLength = lazyCollections.pipe(
|
|
1854
|
+
fromComboToAliases,
|
|
1855
|
+
toLength()
|
|
1856
|
+
);
|
|
1857
|
+
|
|
1858
|
+
function fromEventToKeyStatusKey({ key, code }) {
|
|
1859
|
+
return lazyCollections.includes(key)(modifiers) ? { key } : { code };
|
|
1860
|
+
}
|
|
1861
|
+
const modifiers = ["Alt", "Control", "Meta", "Shift"];
|
|
1862
|
+
|
|
1863
|
+
function toDirection(angle, unit = "degrees") {
|
|
1864
|
+
return Object.keys(directions).find((direction) => directions[direction][unit](angle));
|
|
1865
|
+
}
|
|
1866
|
+
const directions = {
|
|
1867
|
+
up: {
|
|
1868
|
+
degrees: (degrees) => degrees >= 67.5 && degrees <= 112.5,
|
|
1869
|
+
radians: (radians) => radians >= 0.375 * Math.PI && radians <= 0.625 * Math.PI
|
|
1870
|
+
},
|
|
1871
|
+
upRight: {
|
|
1872
|
+
degrees: (degrees) => degrees >= 22.5 && degrees < 67.5,
|
|
1873
|
+
radians: (radians) => radians >= 0.125 * Math.PI && radians < 0.375 * Math.PI
|
|
1874
|
+
},
|
|
1875
|
+
right: {
|
|
1876
|
+
degrees: (degrees) => degrees > 337.5 && degrees <= 360 || degrees < 22.5 && degrees >= 0,
|
|
1877
|
+
radians: (radians) => radians > 1.875 * Math.PI && radians <= 2 * Math.PI || radians < 0.125 * Math.PI && radians >= 0
|
|
1878
|
+
},
|
|
1879
|
+
downRight: {
|
|
1880
|
+
degrees: (degrees) => degrees > 292.5 && degrees <= 337.5,
|
|
1881
|
+
radians: (radians) => radians > 1.625 * Math.PI && radians <= 1.875 * Math.PI
|
|
1882
|
+
},
|
|
1883
|
+
down: {
|
|
1884
|
+
degrees: (degrees) => degrees >= 247.5 && degrees <= 292.5,
|
|
1885
|
+
radians: (radians) => radians >= 1.375 * Math.PI && radians <= 1.625 * Math.PI
|
|
1886
|
+
},
|
|
1887
|
+
downLeft: {
|
|
1888
|
+
degrees: (degrees) => degrees >= 202.5 && degrees < 247.5,
|
|
1889
|
+
radians: (radians) => radians >= 1.125 * Math.PI && radians < 1.375 * Math.PI
|
|
1890
|
+
},
|
|
1891
|
+
left: {
|
|
1892
|
+
degrees: (degrees) => degrees > 157.5 && degrees < 202.5,
|
|
1893
|
+
radians: (radians) => radians > 0.875 * Math.PI && radians < 1.125 * Math.PI
|
|
1894
|
+
},
|
|
1895
|
+
upLeft: {
|
|
1896
|
+
degrees: (degrees) => degrees > 112.5 && degrees <= 157.5,
|
|
1897
|
+
radians: (radians) => radians > 0.625 * Math.PI && radians <= 0.875 * Math.PI
|
|
1898
|
+
}
|
|
1899
|
+
};
|
|
1900
|
+
|
|
1901
|
+
function toHookApi({
|
|
1902
|
+
getSequence,
|
|
1903
|
+
getStatus,
|
|
1904
|
+
getMetadata
|
|
1905
|
+
}) {
|
|
1906
|
+
return {
|
|
1907
|
+
sequence: getSequence(),
|
|
1908
|
+
status: getStatus(),
|
|
1909
|
+
metadata: getMetadata()
|
|
182
1910
|
};
|
|
183
1911
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
1912
|
+
|
|
1913
|
+
function toMousePoint(event) {
|
|
1914
|
+
return {
|
|
1915
|
+
x: event.clientX,
|
|
1916
|
+
y: event.clientY
|
|
187
1917
|
};
|
|
188
1918
|
}
|
|
189
|
-
function
|
|
190
|
-
return
|
|
191
|
-
|
|
192
|
-
|
|
1919
|
+
function toTouchMovePoint(event) {
|
|
1920
|
+
return {
|
|
1921
|
+
x: event.touches.item(0).clientX,
|
|
1922
|
+
y: event.touches.item(0).clientY
|
|
193
1923
|
};
|
|
194
1924
|
}
|
|
195
|
-
function
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
)(potentialities), upperBound = lowerBound + probability;
|
|
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;
|
|
1925
|
+
function toTouchEndPoint(event) {
|
|
1926
|
+
return {
|
|
1927
|
+
x: event.changedTouches.item(0).clientX,
|
|
1928
|
+
y: event.changedTouches.item(0).clientY
|
|
1929
|
+
};
|
|
207
1930
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
1931
|
+
|
|
1932
|
+
function toPolarCoordinates({ xA, xB, yA, yB }) {
|
|
1933
|
+
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;
|
|
1934
|
+
return {
|
|
1935
|
+
distance,
|
|
1936
|
+
angle: { radians, degrees }
|
|
212
1937
|
};
|
|
213
1938
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
1939
|
+
|
|
1940
|
+
const initialMetadata$3 = {
|
|
1941
|
+
times: {
|
|
1942
|
+
start: 0,
|
|
1943
|
+
end: 0
|
|
1944
|
+
},
|
|
1945
|
+
duration: 0
|
|
1946
|
+
};
|
|
1947
|
+
function storeKeyboardTimeMetadata({
|
|
1948
|
+
event,
|
|
1949
|
+
api,
|
|
1950
|
+
getTimeMetadata,
|
|
1951
|
+
getShouldStore,
|
|
1952
|
+
setRequest,
|
|
1953
|
+
recognize
|
|
1954
|
+
}) {
|
|
1955
|
+
if (!getShouldStore())
|
|
1956
|
+
return;
|
|
1957
|
+
const { getStatus, onRecognized } = api, timeMetadata = getTimeMetadata();
|
|
1958
|
+
if (!timeMetadata.times)
|
|
1959
|
+
timeMetadata.times = createClone()(initialMetadata$3.times);
|
|
1960
|
+
timeMetadata.times.start = Math.round(event.timeStamp);
|
|
1961
|
+
timeMetadata.times.end = Math.round(event.timeStamp);
|
|
1962
|
+
const storeDuration = () => {
|
|
1963
|
+
const request = requestAnimationFrame((timestamp) => {
|
|
1964
|
+
if (!getShouldStore())
|
|
1965
|
+
return;
|
|
1966
|
+
timeMetadata.times.end = Math.round(timestamp);
|
|
1967
|
+
timeMetadata.duration = Math.max(0, timeMetadata.times.end - timeMetadata.times.start);
|
|
1968
|
+
if (recognize) {
|
|
1969
|
+
recognize(event, api);
|
|
1970
|
+
if (getStatus() === "recognized")
|
|
1971
|
+
onRecognized(event);
|
|
1972
|
+
}
|
|
1973
|
+
storeDuration();
|
|
1974
|
+
});
|
|
1975
|
+
setRequest(request);
|
|
221
1976
|
};
|
|
1977
|
+
storeDuration();
|
|
222
1978
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
1979
|
+
|
|
1980
|
+
const initialMetadata$2 = {
|
|
1981
|
+
points: {
|
|
1982
|
+
start: { x: 0, y: 0 },
|
|
1983
|
+
end: { x: 0, y: 0 }
|
|
1984
|
+
}
|
|
1985
|
+
};
|
|
1986
|
+
function storePointerStartMetadata(event, api) {
|
|
1987
|
+
const { getMetadata } = api, metadata = getMetadata();
|
|
1988
|
+
const point = event instanceof MouseEvent ? toMousePoint(event) : toTouchMovePoint(event);
|
|
1989
|
+
if (!metadata.points)
|
|
1990
|
+
metadata.points = createClone()(initialMetadata$2.points);
|
|
1991
|
+
metadata.points.start = point;
|
|
1992
|
+
metadata.points.end = point;
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
const initialMetadata$1 = {
|
|
1996
|
+
distance: {
|
|
1997
|
+
straight: {
|
|
1998
|
+
fromStart: 0,
|
|
1999
|
+
fromPrevious: 0
|
|
2000
|
+
},
|
|
2001
|
+
horizontal: {
|
|
2002
|
+
fromStart: 0,
|
|
2003
|
+
fromPrevious: 0
|
|
2004
|
+
},
|
|
2005
|
+
vertical: {
|
|
2006
|
+
fromStart: 0,
|
|
2007
|
+
fromPrevious: 0
|
|
228
2008
|
}
|
|
229
|
-
|
|
2009
|
+
},
|
|
2010
|
+
angle: {
|
|
2011
|
+
fromPrevious: { radians: 0, degrees: 0 },
|
|
2012
|
+
fromStart: { radians: 0, degrees: 0 }
|
|
2013
|
+
},
|
|
2014
|
+
direction: {
|
|
2015
|
+
fromPrevious: "up",
|
|
2016
|
+
fromStart: "up"
|
|
2017
|
+
}
|
|
2018
|
+
};
|
|
2019
|
+
function storePointerMoveMetadata(event, api) {
|
|
2020
|
+
const { getMetadata } = api, metadata = getMetadata();
|
|
2021
|
+
if (!metadata.distance) {
|
|
2022
|
+
metadata.distance = createClone()(initialMetadata$1.distance);
|
|
2023
|
+
metadata.angle = createClone()(initialMetadata$1.angle);
|
|
2024
|
+
metadata.direction = createClone()(initialMetadata$1.direction);
|
|
2025
|
+
}
|
|
2026
|
+
const { x: previousX, y: previousY } = metadata.points.end, { x: startX, y: startY } = metadata.points.start, { x: newX, y: newY } = (() => {
|
|
2027
|
+
if (event instanceof MouseEvent) {
|
|
2028
|
+
return toMousePoint(event);
|
|
2029
|
+
}
|
|
2030
|
+
if (event instanceof TouchEvent) {
|
|
2031
|
+
if (event.type === "touchmove") {
|
|
2032
|
+
return toTouchMovePoint(event);
|
|
2033
|
+
}
|
|
2034
|
+
return toTouchEndPoint(event);
|
|
2035
|
+
}
|
|
2036
|
+
})(), { distance: distanceFromPrevious, angle: angleFromPrevious } = toPolarCoordinates({
|
|
2037
|
+
xA: previousX,
|
|
2038
|
+
xB: newX,
|
|
2039
|
+
yA: previousY,
|
|
2040
|
+
yB: newY
|
|
2041
|
+
}), { distance: distanceFromStart, angle: angleFromStart } = toPolarCoordinates({
|
|
2042
|
+
xA: startX,
|
|
2043
|
+
xB: newX,
|
|
2044
|
+
yA: startY,
|
|
2045
|
+
yB: newY
|
|
2046
|
+
});
|
|
2047
|
+
metadata.distance.straight.fromPrevious = distanceFromPrevious;
|
|
2048
|
+
metadata.distance.horizontal.fromPrevious = newX - previousX;
|
|
2049
|
+
metadata.distance.vertical.fromPrevious = newY - previousY;
|
|
2050
|
+
metadata.angle.fromPrevious = angleFromPrevious;
|
|
2051
|
+
metadata.direction.fromPrevious = toDirection(angleFromPrevious.degrees);
|
|
2052
|
+
metadata.distance.straight.fromStart = distanceFromStart;
|
|
2053
|
+
metadata.distance.horizontal.fromStart = newX - startX;
|
|
2054
|
+
metadata.distance.vertical.fromStart = newY - startY;
|
|
2055
|
+
metadata.angle.fromStart = angleFromStart;
|
|
2056
|
+
metadata.direction.fromStart = toDirection(angleFromStart.degrees);
|
|
2057
|
+
metadata.points.end = { x: newX, y: newY };
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
const initialMetadata = {
|
|
2061
|
+
times: {
|
|
2062
|
+
start: 0,
|
|
2063
|
+
end: 0
|
|
2064
|
+
},
|
|
2065
|
+
duration: 0,
|
|
2066
|
+
velocity: 0
|
|
2067
|
+
};
|
|
2068
|
+
function storePointerTimeMetadata(event, api, getShouldStore, setRequest, recognize) {
|
|
2069
|
+
const { getMetadata, getStatus, onRecognized } = api, metadata = getMetadata();
|
|
2070
|
+
if (!metadata.times) {
|
|
2071
|
+
metadata.times = createClone()(initialMetadata.times);
|
|
2072
|
+
}
|
|
2073
|
+
metadata.times.start = Math.round(event.timeStamp);
|
|
2074
|
+
metadata.times.end = Math.round(event.timeStamp);
|
|
2075
|
+
let previousTime = metadata.times.start;
|
|
2076
|
+
const storeDuration = () => {
|
|
2077
|
+
const request = requestAnimationFrame((timestamp) => {
|
|
2078
|
+
if (getShouldStore()) {
|
|
2079
|
+
previousTime = metadata.times.end;
|
|
2080
|
+
metadata.times.end = Math.round(timestamp);
|
|
2081
|
+
metadata.duration = Math.max(0, metadata.times.end - metadata.times.start);
|
|
2082
|
+
const durationFromPrevious = Math.max(0, metadata.times.end - previousTime);
|
|
2083
|
+
metadata.velocity = metadata.distance.straight.fromPrevious / durationFromPrevious;
|
|
2084
|
+
recognize?.(event, api);
|
|
2085
|
+
if (getStatus() === "recognized")
|
|
2086
|
+
onRecognized(event);
|
|
2087
|
+
storeDuration();
|
|
2088
|
+
}
|
|
2089
|
+
});
|
|
2090
|
+
setRequest(request);
|
|
230
2091
|
};
|
|
2092
|
+
storeDuration();
|
|
231
2093
|
}
|
|
232
|
-
|
|
233
|
-
|
|
2094
|
+
|
|
2095
|
+
function defineGraph(nodes, edges) {
|
|
2096
|
+
return { nodes, edges };
|
|
234
2097
|
}
|
|
235
|
-
function
|
|
236
|
-
return
|
|
2098
|
+
function defineGraphNodes(nodes) {
|
|
2099
|
+
return nodes;
|
|
237
2100
|
}
|
|
238
|
-
function
|
|
239
|
-
return
|
|
2101
|
+
function defineGraphEdges(edges) {
|
|
2102
|
+
return edges;
|
|
240
2103
|
}
|
|
241
|
-
function
|
|
242
|
-
return
|
|
243
|
-
if (elementIsCandidate && predicateFocusable(element))
|
|
244
|
-
return element;
|
|
245
|
-
switch (order) {
|
|
246
|
-
case "first":
|
|
247
|
-
for (let i = 0; i < element.children.length; i++) {
|
|
248
|
-
const focusable = createToFocusable(order, true)(element.children[i]);
|
|
249
|
-
if (focusable)
|
|
250
|
-
return focusable;
|
|
251
|
-
}
|
|
252
|
-
break;
|
|
253
|
-
case "last":
|
|
254
|
-
for (let i = element.children.length - 1; i > -1; i--) {
|
|
255
|
-
const focusable = createToFocusable(order, true)(element.children[i]);
|
|
256
|
-
if (focusable)
|
|
257
|
-
return focusable;
|
|
258
|
-
}
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
};
|
|
2104
|
+
function defineGraphNode(node) {
|
|
2105
|
+
return node;
|
|
262
2106
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
this.state = state;
|
|
266
|
-
}
|
|
267
|
-
pipe(...fns) {
|
|
268
|
-
return createReduce((piped, fn, index) => fn(piped, index), this.state)(fns);
|
|
269
|
-
}
|
|
270
|
-
async pipeAsync(...fns) {
|
|
271
|
-
return await createReduceAsync(
|
|
272
|
-
async (piped, fn, index) => await fn(piped, index),
|
|
273
|
-
this.state
|
|
274
|
-
)(fns);
|
|
275
|
-
}
|
|
2107
|
+
function defineGraphEdge(from, to, predicateTraversable) {
|
|
2108
|
+
return { from, to, predicateTraversable };
|
|
276
2109
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
return name in keysByName ? keysByName[name] : name;
|
|
2110
|
+
function defineAsyncGraph(nodes, edges) {
|
|
2111
|
+
return { nodes, edges };
|
|
280
2112
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
right: "ArrowRight",
|
|
284
|
-
down: "ArrowDown",
|
|
285
|
-
left: "ArrowLeft",
|
|
286
|
-
enter: "Enter",
|
|
287
|
-
backspace: "Backspace",
|
|
288
|
-
tab: "Tab",
|
|
289
|
-
space: " ",
|
|
290
|
-
shift: "Shift",
|
|
291
|
-
meta: "Meta",
|
|
292
|
-
command: "Meta",
|
|
293
|
-
cmd: "Meta",
|
|
294
|
-
control: "Control",
|
|
295
|
-
ctrl: "Control",
|
|
296
|
-
alt: "Alt",
|
|
297
|
-
opt: "Alt",
|
|
298
|
-
option: "Alt",
|
|
299
|
-
fn: "Fn",
|
|
300
|
-
capslock: "CapsLock",
|
|
301
|
-
end: "End",
|
|
302
|
-
home: "Home",
|
|
303
|
-
pagedown: "PageDown",
|
|
304
|
-
pageup: "PageUp",
|
|
305
|
-
esc: "Escape",
|
|
306
|
-
camera: "Camera",
|
|
307
|
-
delete: "Delete",
|
|
308
|
-
f1: "F1",
|
|
309
|
-
f2: "F2",
|
|
310
|
-
f3: "F3",
|
|
311
|
-
f4: "F4",
|
|
312
|
-
f5: "F5",
|
|
313
|
-
f6: "F6",
|
|
314
|
-
f7: "F7",
|
|
315
|
-
f8: "F8",
|
|
316
|
-
f9: "F9",
|
|
317
|
-
f10: "F10",
|
|
318
|
-
f11: "F11",
|
|
319
|
-
f12: "F12",
|
|
320
|
-
f13: "F13",
|
|
321
|
-
f14: "F14",
|
|
322
|
-
f15: "F15",
|
|
323
|
-
f16: "F16",
|
|
324
|
-
f17: "F17",
|
|
325
|
-
f18: "F18",
|
|
326
|
-
f19: "F19",
|
|
327
|
-
f20: "F20"
|
|
328
|
-
};
|
|
329
|
-
const toListenableKeycomboItems = createMap((name) => ({ name, type: fromComboItemNameToType(name) }));
|
|
330
|
-
function narrowKeycombo(type) {
|
|
331
|
-
return new Pipeable(type).pipe(
|
|
332
|
-
toCombo,
|
|
333
|
-
toListenableKeycomboItems
|
|
334
|
-
);
|
|
2113
|
+
function defineAsyncGraphEdges(edges) {
|
|
2114
|
+
return edges;
|
|
335
2115
|
}
|
|
336
|
-
function
|
|
337
|
-
return
|
|
2116
|
+
function defineAsyncGraphEdge(from, to, predicateTraversable) {
|
|
2117
|
+
return { from, to, predicateTraversable };
|
|
338
2118
|
}
|
|
339
|
-
|
|
340
|
-
|
|
2119
|
+
|
|
2120
|
+
function defineAssociativeArrayEntries(entries) {
|
|
2121
|
+
return entries;
|
|
341
2122
|
}
|
|
342
|
-
|
|
343
|
-
const toComboItems = lazyCollections.map((name) => name === "" ? delimiter : name);
|
|
344
|
-
const delimiter = "+";
|
|
345
|
-
function toCombo(type) {
|
|
346
|
-
return lazyCollections.pipe(
|
|
347
|
-
toUnique$1,
|
|
348
|
-
toComboItems,
|
|
349
|
-
lazyCollections.toArray()
|
|
350
|
-
)(type.split(delimiter));
|
|
351
|
-
}
|
|
352
|
-
function fromComboItemNameToType(name) {
|
|
353
|
-
return lazyCollections.find((type) => predicatesByType[type](name))(listenableComboItemTypes) ?? "custom";
|
|
354
|
-
}
|
|
355
|
-
const listenableComboItemTypes = /* @__PURE__ */ new Set(["singleCharacter", "arrow", "other", "modifier", "click", "pointer"]);
|
|
356
|
-
const predicatesByType = {
|
|
357
|
-
singleCharacter: (name) => typeREs["singleCharacter"].test(name),
|
|
358
|
-
arrow: (name) => typeREs["arrow"].test(name),
|
|
359
|
-
other: (name) => typeREs["other"].test(name),
|
|
360
|
-
modifier: (name) => typeREs["modifier"].test(name),
|
|
361
|
-
click: (name) => typeREs["click"].test(name),
|
|
362
|
-
pointer: (name) => typeREs["pointer"].test(name)
|
|
363
|
-
};
|
|
364
|
-
const typeREs = {
|
|
365
|
-
singleCharacter: /^!?[a-zA-Z0-9,<.>/?;:'"[{\]}\\|`~!@#$%^&*()-_=+]$/,
|
|
366
|
-
arrow: /^!?(arrow|vertical|horizontal|up|down|right|left)$/,
|
|
367
|
-
other: /^!?(enter|backspace|space|tab|esc|home|end|pagedown|pageup|capslock|f[0-9]{1,2}|camera|delete)$/,
|
|
368
|
-
modifier: /^!?(cmd|command|meta|shift|ctrl|control|alt|opt|option)$/,
|
|
369
|
-
click: /^!?(rightclick|contextmenu|click|mousedown|mouseup|dblclick)$/,
|
|
370
|
-
pointer: /^!?(pointerdown|pointerup|pointermove|pointerover|pointerout|pointerenter|pointerleave|pointercancel|gotpointercapture|lostpointercapture)$/
|
|
371
|
-
};
|
|
372
|
-
function toModifier(modifierOrAlias) {
|
|
373
|
-
return modifierOrAlias in modifiersByAlias ? modifiersByAlias[modifierOrAlias] : modifierOrAlias;
|
|
374
|
-
}
|
|
375
|
-
const modifiersByAlias = {
|
|
376
|
-
cmd: "meta",
|
|
377
|
-
command: "meta",
|
|
378
|
-
ctrl: "control",
|
|
379
|
-
opt: "alt",
|
|
380
|
-
option: "alt"
|
|
381
|
-
};
|
|
2123
|
+
|
|
382
2124
|
function createExceptAndOnlyEffect(type, effect, options) {
|
|
383
2125
|
const { except = [], only = [] } = options;
|
|
384
2126
|
if (type === "keydown" || type === "keyup") {
|
|
385
2127
|
return (event) => {
|
|
386
|
-
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false,
|
|
2128
|
+
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, false];
|
|
387
2129
|
if (matchesOnly) {
|
|
388
2130
|
effect(event);
|
|
389
2131
|
return;
|
|
@@ -396,7 +2138,7 @@ function createExceptAndOnlyEffect(type, effect, options) {
|
|
|
396
2138
|
}
|
|
397
2139
|
if (type === "click" || type === "dblclick" || type === "contextmenu" || type.startsWith("mouse")) {
|
|
398
2140
|
return (event) => {
|
|
399
|
-
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false,
|
|
2141
|
+
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, false];
|
|
400
2142
|
if (matchesOnly) {
|
|
401
2143
|
effect(event);
|
|
402
2144
|
return;
|
|
@@ -409,7 +2151,7 @@ function createExceptAndOnlyEffect(type, effect, options) {
|
|
|
409
2151
|
}
|
|
410
2152
|
if (type.startsWith("pointer")) {
|
|
411
2153
|
return (event) => {
|
|
412
|
-
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false,
|
|
2154
|
+
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, false];
|
|
413
2155
|
if (matchesOnly) {
|
|
414
2156
|
effect(event);
|
|
415
2157
|
return;
|
|
@@ -421,7 +2163,7 @@ function createExceptAndOnlyEffect(type, effect, options) {
|
|
|
421
2163
|
};
|
|
422
2164
|
}
|
|
423
2165
|
return (event) => {
|
|
424
|
-
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false,
|
|
2166
|
+
const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, false];
|
|
425
2167
|
if (matchesOnly) {
|
|
426
2168
|
effect(event, {});
|
|
427
2169
|
return;
|
|
@@ -432,27 +2174,15 @@ function createExceptAndOnlyEffect(type, effect, options) {
|
|
|
432
2174
|
}
|
|
433
2175
|
};
|
|
434
2176
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}
|
|
438
|
-
const predicatesByModifier = {
|
|
439
|
-
shift: (event) => event.shiftKey,
|
|
440
|
-
cmd: (event) => event.metaKey,
|
|
441
|
-
command: (event) => event.metaKey,
|
|
442
|
-
meta: (event) => event.metaKey,
|
|
443
|
-
ctrl: (event) => event.ctrlKey,
|
|
444
|
-
control: (event) => event.ctrlKey,
|
|
445
|
-
alt: (event) => event.altKey,
|
|
446
|
-
opt: (event) => event.altKey,
|
|
447
|
-
option: (event) => event.altKey
|
|
448
|
-
};
|
|
449
|
-
function domIsAvailable() {
|
|
2177
|
+
|
|
2178
|
+
function getDomAvailability() {
|
|
450
2179
|
try {
|
|
451
|
-
return !!window;
|
|
2180
|
+
return !!window ? "available" : "unavailable";
|
|
452
2181
|
} catch (error) {
|
|
453
|
-
return
|
|
2182
|
+
return "unavailable";
|
|
454
2183
|
}
|
|
455
2184
|
}
|
|
2185
|
+
|
|
456
2186
|
function predicateArray(value) {
|
|
457
2187
|
return Array.isArray(value);
|
|
458
2188
|
}
|
|
@@ -471,24 +2201,8 @@ function predicateNumber(value) {
|
|
|
471
2201
|
function predicateString(value) {
|
|
472
2202
|
return typeof value === "string";
|
|
473
2203
|
}
|
|
474
|
-
|
|
475
|
-
"
|
|
476
|
-
"select:not([disabled])",
|
|
477
|
-
"textarea:not([disabled])",
|
|
478
|
-
"button:not([disabled])",
|
|
479
|
-
"a[href]",
|
|
480
|
-
"area[href]",
|
|
481
|
-
"summary",
|
|
482
|
-
"iframe",
|
|
483
|
-
"object",
|
|
484
|
-
"embed",
|
|
485
|
-
"audio[controls]",
|
|
486
|
-
"video[controls]",
|
|
487
|
-
"[contenteditable]",
|
|
488
|
-
"[tabindex]:not([disabled])"
|
|
489
|
-
]);
|
|
490
|
-
function predicateFocusable(element) {
|
|
491
|
-
return element.matches(tabbableSelector);
|
|
2204
|
+
function predicateObject(value) {
|
|
2205
|
+
return typeof value === "object";
|
|
492
2206
|
}
|
|
493
2207
|
|
|
494
2208
|
class Recognizeable {
|
|
@@ -501,7 +2215,7 @@ class Recognizeable {
|
|
|
501
2215
|
effects: {}
|
|
502
2216
|
};
|
|
503
2217
|
this.maxSequenceLength = options?.maxSequenceLength || defaultOptions.maxSequenceLength;
|
|
504
|
-
this.effects =
|
|
2218
|
+
this.effects = options?.effects || defaultOptions.effects;
|
|
505
2219
|
this.resetComputedMetadata();
|
|
506
2220
|
this.setSequence(sequence);
|
|
507
2221
|
this.effectApi = {
|
|
@@ -510,8 +2224,6 @@ class Recognizeable {
|
|
|
510
2224
|
setMetadata: (metadata) => this.computedMetadata = metadata,
|
|
511
2225
|
recognized: () => this.recognized(),
|
|
512
2226
|
denied: () => this.denied(),
|
|
513
|
-
recognizedUntilReady: () => this.recognizedUntilReady(),
|
|
514
|
-
deniedUntilReady: () => this.deniedUntilReady(),
|
|
515
2227
|
ready: () => this.ready()
|
|
516
2228
|
};
|
|
517
2229
|
this.ready();
|
|
@@ -526,12 +2238,6 @@ class Recognizeable {
|
|
|
526
2238
|
denied() {
|
|
527
2239
|
this.computedStatus = "denied";
|
|
528
2240
|
}
|
|
529
|
-
recognizedUntilReady() {
|
|
530
|
-
this.computedStatus = "recognized until ready";
|
|
531
|
-
}
|
|
532
|
-
deniedUntilReady() {
|
|
533
|
-
this.computedStatus = "denied until ready";
|
|
534
|
-
}
|
|
535
2241
|
computedStatus;
|
|
536
2242
|
ready() {
|
|
537
2243
|
this.computedStatus = "ready";
|
|
@@ -554,8 +2260,7 @@ class Recognizeable {
|
|
|
554
2260
|
return this;
|
|
555
2261
|
}
|
|
556
2262
|
recognize(sequenceItem, { onRecognized } = {}) {
|
|
557
|
-
|
|
558
|
-
this.recognizing();
|
|
2263
|
+
this.recognizing();
|
|
559
2264
|
const type = this.toType(sequenceItem), excess = predicateNumber(this.maxSequenceLength) ? Math.max(0, this.sequence.length - this.maxSequenceLength) : 0, newSequence = createConcat(
|
|
560
2265
|
createSlice(excess)(this.sequence),
|
|
561
2266
|
[sequenceItem]
|
|
@@ -563,11 +2268,10 @@ class Recognizeable {
|
|
|
563
2268
|
this.effectApi.getSequence = () => newSequence;
|
|
564
2269
|
this.effectApi.onRecognized = onRecognized || (() => {
|
|
565
2270
|
});
|
|
566
|
-
this.effects
|
|
2271
|
+
this.effects[type]?.(sequenceItem, { ...this.effectApi });
|
|
567
2272
|
switch (this.status) {
|
|
568
2273
|
case "ready":
|
|
569
2274
|
case "denied":
|
|
570
|
-
case "denied until ready":
|
|
571
2275
|
this.resetComputedMetadata();
|
|
572
2276
|
this.setSequence([]);
|
|
573
2277
|
break;
|
|
@@ -610,8 +2314,8 @@ class Listenable {
|
|
|
610
2314
|
computedActive;
|
|
611
2315
|
constructor(type, options) {
|
|
612
2316
|
if (type === "recognizeable") {
|
|
613
|
-
this.computedRecognizeable = new Recognizeable([], options?.recognizeable
|
|
614
|
-
this.recognizeableEffectsKeys = Object.keys(options?.recognizeable?.effects
|
|
2317
|
+
this.computedRecognizeable = new Recognizeable([], options?.recognizeable);
|
|
2318
|
+
this.recognizeableEffectsKeys = Object.keys(options?.recognizeable?.effects);
|
|
615
2319
|
}
|
|
616
2320
|
this.computedActive = /* @__PURE__ */ new Set();
|
|
617
2321
|
this.setType(type);
|
|
@@ -711,24 +2415,10 @@ class Listenable {
|
|
|
711
2415
|
this.active.add({ target, id: [this.type, effect] });
|
|
712
2416
|
}
|
|
713
2417
|
recognizeableListen(effect, options) {
|
|
714
|
-
let effectStatus = "ready";
|
|
715
2418
|
const guardedEffect = (sequenceItem) => {
|
|
716
2419
|
this.recognizeable.recognize(sequenceItem, { onRecognized: (sequenceItem2) => effect(sequenceItem2) });
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
if (effectStatus === "ready") {
|
|
720
|
-
effect(sequenceItem);
|
|
721
|
-
effectStatus = "performed";
|
|
722
|
-
}
|
|
723
|
-
break;
|
|
724
|
-
case "recognized":
|
|
725
|
-
effect(sequenceItem);
|
|
726
|
-
effectStatus = "ready";
|
|
727
|
-
break;
|
|
728
|
-
default:
|
|
729
|
-
effectStatus = "ready";
|
|
730
|
-
break;
|
|
731
|
-
}
|
|
2420
|
+
if (this.recognizeable.status === "recognized")
|
|
2421
|
+
effect(sequenceItem);
|
|
732
2422
|
};
|
|
733
2423
|
for (const type of this.recognizeableEffectsKeys) {
|
|
734
2424
|
const listenable = new Listenable(type);
|
|
@@ -749,10 +2439,10 @@ class Listenable {
|
|
|
749
2439
|
}
|
|
750
2440
|
addEventListeners(eventListeners, options) {
|
|
751
2441
|
const { target = document } = options;
|
|
752
|
-
|
|
2442
|
+
for (const eventListener of eventListeners) {
|
|
753
2443
|
target.addEventListener(eventListener[0], eventListener[1], eventListener[2]);
|
|
754
2444
|
this.active.add({ target, id: eventListener });
|
|
755
|
-
}
|
|
2445
|
+
}
|
|
756
2446
|
}
|
|
757
2447
|
listening() {
|
|
758
2448
|
this.computedStatus = "listening";
|
|
@@ -864,109 +2554,22 @@ function toAddEventListenerParams(type, effect, options) {
|
|
|
864
2554
|
const { addEventListener, useCapture } = options, exceptAndOnlyEffect = createExceptAndOnlyEffect(type, effect, options), effectOptions = [addEventListener || useCapture];
|
|
865
2555
|
return { exceptAndOnlyEffect, effectOptions };
|
|
866
2556
|
}
|
|
867
|
-
function eventMatchesKeycombo(event, keycombo) {
|
|
868
|
-
return lazyCollections.every(({ name, type }, index) => {
|
|
869
|
-
switch (type) {
|
|
870
|
-
case "singleCharacter":
|
|
871
|
-
if (name === "!")
|
|
872
|
-
return event.key === "!";
|
|
873
|
-
const keyToTest = event.altKey && fromComboItemNameToType(event.key) === "custom" ? fromCodeToSingleCharacter(event.code) : event.key.toLowerCase();
|
|
874
|
-
return name.startsWith("!") ? keyToTest !== toKey(name.slice(1)).toLowerCase() : keyToTest === toKey(name).toLowerCase();
|
|
875
|
-
case "other":
|
|
876
|
-
if (name === "!") {
|
|
877
|
-
return event.key === "!";
|
|
878
|
-
}
|
|
879
|
-
return name.startsWith("!") ? event.key.toLowerCase() !== toKey(name.slice(1)).toLowerCase() : event.key.toLowerCase() === toKey(name).toLowerCase();
|
|
880
|
-
case "arrow":
|
|
881
|
-
return predicatesByArrow.get(name)?.({ event, name }) ?? predicatesByArrow.get("default")({ event, name });
|
|
882
|
-
case "modifier":
|
|
883
|
-
if (index === keycombo.length - 1) {
|
|
884
|
-
return name.startsWith("!") ? event.key.toLowerCase() !== toModifier(name.slice(1)).toLowerCase() : event.key.toLowerCase() === toModifier(name).toLowerCase();
|
|
885
|
-
}
|
|
886
|
-
return name.startsWith("!") ? !predicateModified({ event, alias: name.slice(1) }) : predicateModified({ event, alias: name });
|
|
887
|
-
}
|
|
888
|
-
})(keycombo);
|
|
889
|
-
}
|
|
890
|
-
function fromCodeToSingleCharacter(code) {
|
|
891
|
-
for (const c in aliasesByCode) {
|
|
892
|
-
if (c === code) {
|
|
893
|
-
return aliasesByCode[c];
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
for (const prefix of ["Key", "Digit"]) {
|
|
897
|
-
const re = new RegExp(`^${prefix}`);
|
|
898
|
-
if (re.test(code)) {
|
|
899
|
-
return createClip(re)(code).toLowerCase();
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
return code;
|
|
903
|
-
}
|
|
904
|
-
const aliasesByCode = {
|
|
905
|
-
"Backquote": "`",
|
|
906
|
-
"Minus": "-",
|
|
907
|
-
"Equal": "=",
|
|
908
|
-
"BracketLeft": "[",
|
|
909
|
-
"BracketRight": "]",
|
|
910
|
-
"Backslash": "\\",
|
|
911
|
-
"Semicolon": ";",
|
|
912
|
-
"Quote": "'",
|
|
913
|
-
"Comma": ",",
|
|
914
|
-
"Period": ".",
|
|
915
|
-
"Slash": "/"
|
|
916
|
-
};
|
|
917
|
-
const predicatesByArrow = /* @__PURE__ */ new Map([
|
|
918
|
-
[
|
|
919
|
-
"arrow",
|
|
920
|
-
({ event }) => arrows.has(event.key.toLowerCase())
|
|
921
|
-
],
|
|
922
|
-
[
|
|
923
|
-
"!arrow",
|
|
924
|
-
({ event }) => !arrows.has(event.key.toLowerCase())
|
|
925
|
-
],
|
|
926
|
-
[
|
|
927
|
-
"vertical",
|
|
928
|
-
({ event }) => verticalArrows.has(event.key.toLowerCase())
|
|
929
|
-
],
|
|
930
|
-
[
|
|
931
|
-
"!vertical",
|
|
932
|
-
({ event }) => !verticalArrows.has(event.key.toLowerCase())
|
|
933
|
-
],
|
|
934
|
-
[
|
|
935
|
-
"horizontal",
|
|
936
|
-
({ event }) => horizontalArrows.has(event.key.toLowerCase())
|
|
937
|
-
],
|
|
938
|
-
[
|
|
939
|
-
"!horizontal",
|
|
940
|
-
({ event }) => !horizontalArrows.has(event.key.toLowerCase())
|
|
941
|
-
],
|
|
942
|
-
[
|
|
943
|
-
"default",
|
|
944
|
-
({ event, name }) => name.startsWith("!") ? event.key.toLowerCase() !== `arrow${name.toLowerCase()}` : event.key.toLowerCase() === `arrow${name.toLowerCase()}`
|
|
945
|
-
]
|
|
946
|
-
]);
|
|
947
|
-
const arrows = /* @__PURE__ */ new Set(["arrowup", "arrowright", "arrowdown", "arrowleft"]);
|
|
948
|
-
const verticalArrows = /* @__PURE__ */ new Set(["arrowup", "arrowdown"]);
|
|
949
|
-
const horizontalArrows = /* @__PURE__ */ new Set(["arrowright", "arrowleft"]);
|
|
950
|
-
function eventMatchesMousecombo(event, Mousecombo) {
|
|
951
|
-
return lazyCollections.every((name) => fromComboItemNameToType(name) === "click" || name.startsWith("!") && !predicateModified({ alias: name.slice(1), event }) || !name.startsWith("!") && predicateModified({ alias: name, event }))(Mousecombo);
|
|
952
|
-
}
|
|
953
|
-
function eventMatchesPointercombo(event, pointercombo) {
|
|
954
|
-
return lazyCollections.every((name) => fromComboItemNameToType(name) === "pointer" || name.startsWith("!") && !predicateModified({ alias: name.slice(1), event }) || !name.startsWith("!") && predicateModified({ alias: name, event }))(pointercombo);
|
|
955
|
-
}
|
|
956
2557
|
const observerAssertionsByType = {
|
|
957
2558
|
intersect: (observer) => observer instanceof IntersectionObserver,
|
|
958
2559
|
mutate: (observer) => observer instanceof MutationObserver,
|
|
959
2560
|
resize: (observer) => observer instanceof ResizeObserver
|
|
960
2561
|
};
|
|
961
2562
|
|
|
962
|
-
const defaultOptions$
|
|
2563
|
+
const defaultOptions$8 = {
|
|
963
2564
|
duration: 0,
|
|
2565
|
+
// delay not supported, because it can be effectd by delayable
|
|
964
2566
|
timing: [
|
|
965
2567
|
0,
|
|
966
2568
|
0,
|
|
967
2569
|
1,
|
|
968
2570
|
1
|
|
969
2571
|
],
|
|
2572
|
+
// linear by default
|
|
970
2573
|
iterations: 1,
|
|
971
2574
|
alternates: false
|
|
972
2575
|
};
|
|
@@ -987,10 +2590,10 @@ class Animateable {
|
|
|
987
2590
|
getEaseables;
|
|
988
2591
|
getReversedEaseables;
|
|
989
2592
|
constructor(keyframes, options = {}) {
|
|
990
|
-
this.initialDuration = options?.duration || defaultOptions$
|
|
991
|
-
this.controlPoints = fromTimingToControlPoints(options?.timing || defaultOptions$
|
|
992
|
-
this.iterationLimit = options?.iterations || defaultOptions$
|
|
993
|
-
this.alternates = options?.alternates || defaultOptions$
|
|
2593
|
+
this.initialDuration = options?.duration || defaultOptions$8.duration;
|
|
2594
|
+
this.controlPoints = fromTimingToControlPoints(options?.timing || defaultOptions$8.timing);
|
|
2595
|
+
this.iterationLimit = options?.iterations || defaultOptions$8.iterations;
|
|
2596
|
+
this.alternates = options?.alternates || defaultOptions$8.alternates;
|
|
994
2597
|
this.reversedControlPoints = fromControlPointsToReversedControlPoints(this.controlPoints);
|
|
995
2598
|
this.toAnimationProgress = createToAnimationProgress(this.controlPoints);
|
|
996
2599
|
this.reversedToAnimationProgress = createToAnimationProgress(this.reversedControlPoints);
|
|
@@ -1066,10 +2669,11 @@ class Animateable {
|
|
|
1066
2669
|
setKeyframes(keyframes) {
|
|
1067
2670
|
this.stop();
|
|
1068
2671
|
this.computedKeyframes = Array.from(keyframes).sort(({ progress: progressA }, { progress: progressB }) => progressA - progressB);
|
|
1069
|
-
this.reversedKeyframes =
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
2672
|
+
this.reversedKeyframes = lazyCollections.pipe(
|
|
2673
|
+
lazyCollections.reverse(),
|
|
2674
|
+
lazyCollections.map(({ progress, properties }) => ({ progress: 1 - progress, properties })),
|
|
2675
|
+
lazyCollections.toArray()
|
|
2676
|
+
)(this.keyframes);
|
|
1073
2677
|
this.properties = toProperties(this.keyframes);
|
|
1074
2678
|
this.easeables = this.getEaseables({ keyframes: this.keyframes, properties: this.properties });
|
|
1075
2679
|
this.reversedEaseables = this.getReversedEaseables({ keyframes: this.reversedKeyframes, properties: this.properties });
|
|
@@ -1367,7 +2971,7 @@ class Animateable {
|
|
|
1367
2971
|
break;
|
|
1368
2972
|
case "reversing":
|
|
1369
2973
|
this.computedIterations += 1;
|
|
1370
|
-
if (this.
|
|
2974
|
+
if (this.iterationLimit === true || this.iterations < this.iterationLimit) {
|
|
1371
2975
|
this.createAnimate("reverse")(effect, options);
|
|
1372
2976
|
} else {
|
|
1373
2977
|
this.alternateCache.status = "ready";
|
|
@@ -1376,7 +2980,7 @@ class Animateable {
|
|
|
1376
2980
|
}
|
|
1377
2981
|
} else {
|
|
1378
2982
|
this.computedIterations += 1;
|
|
1379
|
-
if (this.
|
|
2983
|
+
if (this.iterationLimit === true || this.iterations < this.iterationLimit) {
|
|
1380
2984
|
this.createAnimate("play")(effect, options);
|
|
1381
2985
|
}
|
|
1382
2986
|
}
|
|
@@ -1392,7 +2996,7 @@ class Animateable {
|
|
|
1392
2996
|
switch (this.alternateCache.status) {
|
|
1393
2997
|
case "playing":
|
|
1394
2998
|
this.computedIterations += 1;
|
|
1395
|
-
if (this.
|
|
2999
|
+
if (this.iterationLimit === true || this.iterations < this.iterationLimit) {
|
|
1396
3000
|
this.createAnimate("play")(effect, options);
|
|
1397
3001
|
} else {
|
|
1398
3002
|
this.alternateCache.status = "ready";
|
|
@@ -1404,7 +3008,7 @@ class Animateable {
|
|
|
1404
3008
|
}
|
|
1405
3009
|
} else {
|
|
1406
3010
|
this.computedIterations += 1;
|
|
1407
|
-
if (this.iterations < this.iterationLimit) {
|
|
3011
|
+
if (this.iterationLimit === true || this.iterations < this.iterationLimit) {
|
|
1408
3012
|
this.createAnimate("reverse")(effect, options);
|
|
1409
3013
|
}
|
|
1410
3014
|
}
|
|
@@ -1613,7 +3217,7 @@ function createGetEaseables(fromKeyframeToControlPoints) {
|
|
|
1613
3217
|
(easeables, property) => {
|
|
1614
3218
|
const propertyKeyframes = createFilter(({ properties: properties2 }) => properties2.hasOwnProperty(property))(keyframes), fromKeyframesToEaseables = createReduce(
|
|
1615
3219
|
(propertyEaseables2, keyframe, index) => {
|
|
1616
|
-
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 ? (
|
|
3220
|
+
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 }));
|
|
1617
3221
|
propertyEaseables2.push({
|
|
1618
3222
|
property,
|
|
1619
3223
|
value: { previous, next },
|
|
@@ -1628,7 +3232,7 @@ function createGetEaseables(fromKeyframeToControlPoints) {
|
|
|
1628
3232
|
property,
|
|
1629
3233
|
value: { previous: propertyEaseables[0].value.previous, next: propertyEaseables[0].value.previous },
|
|
1630
3234
|
progress: { start: -1, end: propertyEaseables[0].progress.start },
|
|
1631
|
-
toAnimationProgress: (
|
|
3235
|
+
toAnimationProgress: () => 1,
|
|
1632
3236
|
hasCustomTiming: false
|
|
1633
3237
|
};
|
|
1634
3238
|
return createConcat(
|
|
@@ -1873,14 +3477,14 @@ const easingsNetInOutBack = [
|
|
|
1873
3477
|
1.6
|
|
1874
3478
|
];
|
|
1875
3479
|
|
|
1876
|
-
const defaultOptions$
|
|
3480
|
+
const defaultOptions$7 = {
|
|
1877
3481
|
name: "baleada"
|
|
1878
3482
|
};
|
|
1879
3483
|
class Broadcastable {
|
|
1880
3484
|
name;
|
|
1881
3485
|
constructor(state, options = {}) {
|
|
1882
3486
|
this.setState(state);
|
|
1883
|
-
this.name = options.name ?? defaultOptions$
|
|
3487
|
+
this.name = options.name ?? defaultOptions$7.name;
|
|
1884
3488
|
this.ready();
|
|
1885
3489
|
}
|
|
1886
3490
|
computedStatus;
|
|
@@ -1945,12 +3549,69 @@ function toMessageListenParams(instance, effect) {
|
|
|
1945
3549
|
];
|
|
1946
3550
|
}
|
|
1947
3551
|
|
|
3552
|
+
const defaultOptions$6 = {
|
|
3553
|
+
locales: "en",
|
|
3554
|
+
collator: { sensitivity: "base" }
|
|
3555
|
+
};
|
|
3556
|
+
class Compareable {
|
|
3557
|
+
constructor(string, options = {}) {
|
|
3558
|
+
const locales = options.locales || defaultOptions$6.locales, collatorOptions = { ...defaultOptions$6.collator, ...options.collator }, key = locales + lazyCollections.pipe(
|
|
3559
|
+
createEntries(),
|
|
3560
|
+
lazyCollections.sort((a, b) => a[0] < b[0] ? -1 : 1),
|
|
3561
|
+
lazyCollections.join()
|
|
3562
|
+
)(collatorOptions);
|
|
3563
|
+
this.computedCollator = cache[key] || (cache[key] = new Intl.Collator(locales, collatorOptions));
|
|
3564
|
+
this.setString(string);
|
|
3565
|
+
this.ready();
|
|
3566
|
+
}
|
|
3567
|
+
computedStatus;
|
|
3568
|
+
ready() {
|
|
3569
|
+
this.computedStatus = "ready";
|
|
3570
|
+
}
|
|
3571
|
+
get string() {
|
|
3572
|
+
return this.computedString;
|
|
3573
|
+
}
|
|
3574
|
+
set string(string) {
|
|
3575
|
+
this.setString(string);
|
|
3576
|
+
}
|
|
3577
|
+
get status() {
|
|
3578
|
+
return this.computedStatus;
|
|
3579
|
+
}
|
|
3580
|
+
computedCollator;
|
|
3581
|
+
get collator() {
|
|
3582
|
+
return this.computedCollator;
|
|
3583
|
+
}
|
|
3584
|
+
computedComparison;
|
|
3585
|
+
get comparison() {
|
|
3586
|
+
return this.computedComparison;
|
|
3587
|
+
}
|
|
3588
|
+
computedString;
|
|
3589
|
+
setString(string) {
|
|
3590
|
+
this.computedString = string;
|
|
3591
|
+
return this;
|
|
3592
|
+
}
|
|
3593
|
+
compare(compared) {
|
|
3594
|
+
this.comparing();
|
|
3595
|
+
this.computedComparison = this.computedCollator.compare(this.string, compared);
|
|
3596
|
+
this.compared();
|
|
3597
|
+
return this;
|
|
3598
|
+
}
|
|
3599
|
+
comparing() {
|
|
3600
|
+
this.computedStatus = "comparing";
|
|
3601
|
+
}
|
|
3602
|
+
compared() {
|
|
3603
|
+
this.computedStatus = "compared";
|
|
3604
|
+
}
|
|
3605
|
+
}
|
|
3606
|
+
const cache = {};
|
|
3607
|
+
|
|
1948
3608
|
const defaultOptions$5 = {
|
|
1949
3609
|
segment: {
|
|
1950
3610
|
from: "start",
|
|
1951
3611
|
to: "end"
|
|
1952
3612
|
},
|
|
1953
3613
|
divider: /\s/
|
|
3614
|
+
// Keep an eye out for use cases where a { before, after } object would be needed, or where multi-character dividers need to be used
|
|
1954
3615
|
};
|
|
1955
3616
|
const defaultCompleteOptions = {
|
|
1956
3617
|
select: "completionEnd"
|
|
@@ -2033,6 +3694,7 @@ class Completeable {
|
|
|
2033
3694
|
}
|
|
2034
3695
|
return this;
|
|
2035
3696
|
}
|
|
3697
|
+
// TODO: Support array of selections for multi cursor editing
|
|
2036
3698
|
computedSelection;
|
|
2037
3699
|
setSelection(selection) {
|
|
2038
3700
|
this.computedSelection = selection;
|
|
@@ -2109,12 +3771,12 @@ function toPreviousMatch({ string, re, from }) {
|
|
|
2109
3771
|
if (!re.test(string.slice(0, from)) || from === 0) {
|
|
2110
3772
|
indexOf = -1;
|
|
2111
3773
|
} else {
|
|
2112
|
-
const reversedStringBeforeFrom =
|
|
3774
|
+
const reversedStringBeforeFrom = lazyCollections.pipe(
|
|
2113
3775
|
(string2) => string2.slice(0, from),
|
|
2114
3776
|
(sliced) => sliced.split(""),
|
|
2115
3777
|
reverse,
|
|
2116
3778
|
toString
|
|
2117
|
-
), toNextMatchIndex = toNextMatch({ string: reversedStringBeforeFrom, re, from: 0 });
|
|
3779
|
+
)(string), toNextMatchIndex = toNextMatch({ string: reversedStringBeforeFrom, re, from: 0 });
|
|
2118
3780
|
indexOf = toNextMatchIndex === -1 ? -1 : reversedStringBeforeFrom.length - 1 - toNextMatchIndex;
|
|
2119
3781
|
}
|
|
2120
3782
|
return indexOf;
|
|
@@ -2485,11 +4147,12 @@ class Fetchable {
|
|
|
2485
4147
|
computedText;
|
|
2486
4148
|
constructor(resource, options = {}) {
|
|
2487
4149
|
this.setResource(resource);
|
|
2488
|
-
this.
|
|
2489
|
-
this.
|
|
2490
|
-
this.
|
|
2491
|
-
this.
|
|
2492
|
-
this.
|
|
4150
|
+
this.computedKy = ky.create(narrowOptions(options.ky));
|
|
4151
|
+
this.computedArrayBuffer = new Resolveable(async () => "arrayBuffer" in this.response ? await this.response.arrayBuffer() : void 0);
|
|
4152
|
+
this.computedBlob = new Resolveable(async () => "blob" in this.response ? await this.response.blob() : void 0);
|
|
4153
|
+
this.computedFormData = new Resolveable(async () => "formData" in this.response ? await this.response.formData() : void 0);
|
|
4154
|
+
this.computedJson = new Resolveable(async () => "json" in this.response ? await this.response.json() : void 0);
|
|
4155
|
+
this.computedText = new Resolveable(async () => "text" in this.response ? await this.response.text() : void 0);
|
|
2493
4156
|
this.ready();
|
|
2494
4157
|
}
|
|
2495
4158
|
computedStatus;
|
|
@@ -2502,6 +4165,10 @@ class Fetchable {
|
|
|
2502
4165
|
set resource(resource) {
|
|
2503
4166
|
this.setResource(resource);
|
|
2504
4167
|
}
|
|
4168
|
+
computedKy;
|
|
4169
|
+
get ky() {
|
|
4170
|
+
return this.computedKy;
|
|
4171
|
+
}
|
|
2505
4172
|
computedAbortController;
|
|
2506
4173
|
get abortController() {
|
|
2507
4174
|
if (!this.computedAbortController) {
|
|
@@ -2515,6 +4182,10 @@ class Fetchable {
|
|
|
2515
4182
|
get response() {
|
|
2516
4183
|
return this.computedResponse;
|
|
2517
4184
|
}
|
|
4185
|
+
computedRetryCount = 0;
|
|
4186
|
+
get retryCount() {
|
|
4187
|
+
return this.computedRetryCount;
|
|
4188
|
+
}
|
|
2518
4189
|
get error() {
|
|
2519
4190
|
return this.computedError;
|
|
2520
4191
|
}
|
|
@@ -2543,7 +4214,23 @@ class Fetchable {
|
|
|
2543
4214
|
async fetch(options = {}) {
|
|
2544
4215
|
this.fetching();
|
|
2545
4216
|
try {
|
|
2546
|
-
this.computedResponse = await
|
|
4217
|
+
this.computedResponse = await this.ky(
|
|
4218
|
+
this.resource,
|
|
4219
|
+
{
|
|
4220
|
+
...options,
|
|
4221
|
+
signal: this.abortController.signal,
|
|
4222
|
+
hooks: {
|
|
4223
|
+
...options.hooks,
|
|
4224
|
+
beforeRetry: [
|
|
4225
|
+
...options.hooks?.beforeRetry || [],
|
|
4226
|
+
({ retryCount }) => {
|
|
4227
|
+
this.retrying();
|
|
4228
|
+
this.computedRetryCount = retryCount;
|
|
4229
|
+
}
|
|
4230
|
+
]
|
|
4231
|
+
}
|
|
4232
|
+
}
|
|
4233
|
+
);
|
|
2547
4234
|
this.fetched();
|
|
2548
4235
|
} catch (error) {
|
|
2549
4236
|
this.computedError = error;
|
|
@@ -2557,6 +4244,9 @@ class Fetchable {
|
|
|
2557
4244
|
fetching() {
|
|
2558
4245
|
this.computedStatus = "fetching";
|
|
2559
4246
|
}
|
|
4247
|
+
retrying() {
|
|
4248
|
+
this.computedStatus = "retrying";
|
|
4249
|
+
}
|
|
2560
4250
|
fetched() {
|
|
2561
4251
|
this.computedStatus = "fetched";
|
|
2562
4252
|
}
|
|
@@ -2567,23 +4257,27 @@ class Fetchable {
|
|
|
2567
4257
|
this.computedStatus = "errored";
|
|
2568
4258
|
}
|
|
2569
4259
|
async get(options = {}) {
|
|
2570
|
-
await this.fetch({ signal: this.abortController.signal, ...
|
|
4260
|
+
await this.fetch({ signal: this.abortController.signal, ...options, method: "get" });
|
|
2571
4261
|
return this;
|
|
2572
4262
|
}
|
|
2573
4263
|
async patch(options = {}) {
|
|
2574
|
-
await this.fetch({ signal: this.abortController.signal, ...
|
|
4264
|
+
await this.fetch({ signal: this.abortController.signal, ...options, method: "patch" });
|
|
2575
4265
|
return this;
|
|
2576
4266
|
}
|
|
2577
4267
|
async post(options = {}) {
|
|
2578
|
-
await this.fetch({ signal: this.abortController.signal, ...
|
|
4268
|
+
await this.fetch({ signal: this.abortController.signal, ...options, method: "post" });
|
|
2579
4269
|
return this;
|
|
2580
4270
|
}
|
|
2581
4271
|
async put(options = {}) {
|
|
2582
|
-
await this.fetch({ signal: this.abortController.signal, ...
|
|
4272
|
+
await this.fetch({ signal: this.abortController.signal, ...options, method: "put" });
|
|
2583
4273
|
return this;
|
|
2584
4274
|
}
|
|
2585
4275
|
async delete(options = {}) {
|
|
2586
|
-
await this.fetch({ signal: this.abortController.signal, ...
|
|
4276
|
+
await this.fetch({ signal: this.abortController.signal, ...options, method: "delete" });
|
|
4277
|
+
return this;
|
|
4278
|
+
}
|
|
4279
|
+
async head(options = {}) {
|
|
4280
|
+
await this.fetch({ signal: this.abortController.signal, ...options, method: "head" });
|
|
2587
4281
|
return this;
|
|
2588
4282
|
}
|
|
2589
4283
|
abort() {
|
|
@@ -2592,16 +4286,9 @@ class Fetchable {
|
|
|
2592
4286
|
}
|
|
2593
4287
|
}
|
|
2594
4288
|
function narrowOptions(options) {
|
|
2595
|
-
|
|
2596
|
-
}
|
|
2597
|
-
|
|
2598
|
-
return {
|
|
2599
|
-
body: JSON.stringify(data),
|
|
2600
|
-
headers: {
|
|
2601
|
-
"Accept": "application/json",
|
|
2602
|
-
"Content-Type": "application/json"
|
|
2603
|
-
}
|
|
2604
|
-
};
|
|
4289
|
+
if (!options)
|
|
4290
|
+
return {};
|
|
4291
|
+
return predicateFunction(options) ? options({ stop: ky.stop }) : options;
|
|
2605
4292
|
}
|
|
2606
4293
|
|
|
2607
4294
|
class Fullscreenable {
|
|
@@ -2929,13 +4616,12 @@ class Pickable {
|
|
|
2929
4616
|
}
|
|
2930
4617
|
pick(indexOrIndices, options = {}) {
|
|
2931
4618
|
const { replace, allowsDuplicates } = { ...defaultPickOptions, ...options };
|
|
2932
|
-
this.computedPicks =
|
|
4619
|
+
this.computedPicks = lazyCollections.pipe(
|
|
2933
4620
|
narrowIndices,
|
|
2934
4621
|
this.toPossiblePicks,
|
|
2935
4622
|
(possiblePicks) => {
|
|
2936
|
-
if (replace === "all")
|
|
4623
|
+
if (replace === "all")
|
|
2937
4624
|
return allowsDuplicates ? possiblePicks : toUnique(possiblePicks);
|
|
2938
|
-
}
|
|
2939
4625
|
const maybeWithoutDuplicates = allowsDuplicates ? possiblePicks : createFilter(
|
|
2940
4626
|
(possiblePick) => typeof lazyCollections.find((pick) => pick === possiblePick)(this.picks || []) !== "number"
|
|
2941
4627
|
)(possiblePicks);
|
|
@@ -2952,10 +4638,11 @@ class Pickable {
|
|
|
2952
4638
|
if (maybeWithoutDuplicates.length > this.picks.length) {
|
|
2953
4639
|
return createSlice(maybeWithoutDuplicates.length - this.picks.length)(maybeWithoutDuplicates);
|
|
2954
4640
|
}
|
|
2955
|
-
return
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
4641
|
+
return lazyCollections.pipe(
|
|
4642
|
+
lazyCollections.slice(maybeWithoutDuplicates.length),
|
|
4643
|
+
(array) => lazyCollections.concat(array, maybeWithoutDuplicates),
|
|
4644
|
+
lazyCollections.toArray()
|
|
4645
|
+
)(this.picks);
|
|
2959
4646
|
case "lifo":
|
|
2960
4647
|
if (maybeWithoutDuplicates.length === 0) {
|
|
2961
4648
|
return this.picks;
|
|
@@ -2966,13 +4653,14 @@ class Pickable {
|
|
|
2966
4653
|
if (maybeWithoutDuplicates.length > this.picks.length) {
|
|
2967
4654
|
return createSlice(0, maybeWithoutDuplicates.length - this.picks.length + 1)(maybeWithoutDuplicates);
|
|
2968
4655
|
}
|
|
2969
|
-
return
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
4656
|
+
return lazyCollections.pipe(
|
|
4657
|
+
lazyCollections.slice(0, this.picks.length - maybeWithoutDuplicates.length - 1),
|
|
4658
|
+
(array) => lazyCollections.concat(array, maybeWithoutDuplicates),
|
|
4659
|
+
lazyCollections.toArray()
|
|
4660
|
+
)(this.picks);
|
|
2973
4661
|
}
|
|
2974
4662
|
}
|
|
2975
|
-
);
|
|
4663
|
+
)(indexOrIndices);
|
|
2976
4664
|
this.computedFirst = Math.min(...this.picks);
|
|
2977
4665
|
this.computedLast = Math.max(...this.picks);
|
|
2978
4666
|
this.computedMultiple = toUnique(this.picks).length > 1;
|
|
@@ -3020,7 +4708,7 @@ class Sanitizeable {
|
|
|
3020
4708
|
computedDompurify;
|
|
3021
4709
|
computedStatus;
|
|
3022
4710
|
ready() {
|
|
3023
|
-
if (
|
|
4711
|
+
if (getDomAvailability() === "available") {
|
|
3024
4712
|
this.computedDompurify = createDOMPurify();
|
|
3025
4713
|
this.computedDompurify.setConfig(this.domPurifyConfig);
|
|
3026
4714
|
}
|
|
@@ -3033,7 +4721,7 @@ class Sanitizeable {
|
|
|
3033
4721
|
this.setHtml(html);
|
|
3034
4722
|
}
|
|
3035
4723
|
get dompurify() {
|
|
3036
|
-
if (!this.computedDompurify &&
|
|
4724
|
+
if (!this.computedDompurify && getDomAvailability() === "available") {
|
|
3037
4725
|
this.computedDompurify = createDOMPurify();
|
|
3038
4726
|
this.computedDompurify.setConfig(this.domPurifyConfig);
|
|
3039
4727
|
}
|
|
@@ -3176,7 +4864,7 @@ class Storeable {
|
|
|
3176
4864
|
computedStatus;
|
|
3177
4865
|
ready() {
|
|
3178
4866
|
this.computedStatus = "ready";
|
|
3179
|
-
if (
|
|
4867
|
+
if (getDomAvailability() === "available") {
|
|
3180
4868
|
if (predicateNull(this.storage.getItem(this.computedStatusKey))) {
|
|
3181
4869
|
this.storeStatus();
|
|
3182
4870
|
}
|
|
@@ -3189,7 +4877,7 @@ class Storeable {
|
|
|
3189
4877
|
this.setKey(key);
|
|
3190
4878
|
}
|
|
3191
4879
|
get status() {
|
|
3192
|
-
if (
|
|
4880
|
+
if (getDomAvailability() === "available") {
|
|
3193
4881
|
const storedStatus = this.storage.getItem(this.computedStatusKey);
|
|
3194
4882
|
if (this.computedStatus !== storedStatus && predicateString(storedStatus)) {
|
|
3195
4883
|
this.computedStatus = storedStatus;
|
|
@@ -3279,6 +4967,7 @@ class Storeable {
|
|
|
3279
4967
|
|
|
3280
4968
|
exports.Animateable = Animateable;
|
|
3281
4969
|
exports.Broadcastable = Broadcastable;
|
|
4970
|
+
exports.Compareable = Compareable;
|
|
3282
4971
|
exports.Completeable = Completeable;
|
|
3283
4972
|
exports.Copyable = Copyable;
|
|
3284
4973
|
exports.Delayable = Delayable;
|
|
@@ -3289,26 +4978,60 @@ exports.Grantable = Grantable;
|
|
|
3289
4978
|
exports.Listenable = Listenable;
|
|
3290
4979
|
exports.Navigateable = Navigateable;
|
|
3291
4980
|
exports.Pickable = Pickable;
|
|
3292
|
-
exports.Pipeable = Pipeable;
|
|
3293
4981
|
exports.Recognizeable = Recognizeable;
|
|
3294
4982
|
exports.Resolveable = Resolveable;
|
|
3295
4983
|
exports.Sanitizeable = Sanitizeable;
|
|
3296
4984
|
exports.Searchable = Searchable;
|
|
3297
4985
|
exports.Shareable = Shareable;
|
|
3298
4986
|
exports.Storeable = Storeable;
|
|
4987
|
+
exports.createAssociativeArray = createAssociativeArray;
|
|
4988
|
+
exports.createAsyncDirectedAcyclicPredicateAncestor = createPredicateAncestor$1;
|
|
4989
|
+
exports.createAsyncDirectedAcyclicToCommonAncestors = createToCommonAncestors$1;
|
|
4990
|
+
exports.createAsyncDirectedAcyclicToLayers = createToLayers;
|
|
4991
|
+
exports.createAsyncDirectedAcyclicToNodeSteps = createToNodeSteps$1;
|
|
4992
|
+
exports.createAsyncDirectedAcyclicToPath = createToPath$1;
|
|
4993
|
+
exports.createAsyncDirectedAcyclicToSteps = createToSteps$1;
|
|
4994
|
+
exports.createAsyncDirectedAcyclicToTree = createToTree$1;
|
|
3299
4995
|
exports.createClamp = createClamp;
|
|
3300
4996
|
exports.createClip = createClip;
|
|
4997
|
+
exports.createClone = createClone;
|
|
3301
4998
|
exports.createConcat = createConcat;
|
|
4999
|
+
exports.createDecisionTreePredicateAncestor = createPredicateAncestor;
|
|
5000
|
+
exports.createDecisionTreeToCommonAncestors = createToCommonAncestors;
|
|
5001
|
+
exports.createDecisionTreeToNodeSteps = createToNodeSteps;
|
|
5002
|
+
exports.createDecisionTreeToPath = createToPath;
|
|
5003
|
+
exports.createDecisionTreeToSteps = createToSteps;
|
|
5004
|
+
exports.createDecisionTreeToTree = createToTree;
|
|
3302
5005
|
exports.createDetermine = createDetermine;
|
|
5006
|
+
exports.createDirectedAcyclicPredicateAncestor = createPredicateAncestor$2;
|
|
5007
|
+
exports.createDirectedAcyclicToCommonAncestors = createToCommonAncestors$2;
|
|
5008
|
+
exports.createDirectedAcyclicToLayers = createToLayers$1;
|
|
5009
|
+
exports.createDirectedAcyclicToNodeSteps = createToNodeSteps$2;
|
|
5010
|
+
exports.createDirectedAcyclicToPath = createToPath$2;
|
|
5011
|
+
exports.createDirectedAcyclicToRoots = createToRoots;
|
|
5012
|
+
exports.createDirectedAcyclicToSteps = createToSteps$2;
|
|
5013
|
+
exports.createDirectedAcyclicToTree = createToTree$2;
|
|
5014
|
+
exports.createEntries = createEntries;
|
|
5015
|
+
exports.createEqual = createEqual;
|
|
5016
|
+
exports.createEvery = createEvery;
|
|
3303
5017
|
exports.createFilter = createFilter;
|
|
3304
5018
|
exports.createFilterAsync = createFilterAsync;
|
|
5019
|
+
exports.createFindAsync = createFindAsync;
|
|
5020
|
+
exports.createFindIndexAsync = createFindIndexAsync;
|
|
5021
|
+
exports.createFocusable = createFocusable;
|
|
3305
5022
|
exports.createForEachAsync = createForEachAsync;
|
|
3306
5023
|
exports.createInsert = createInsert;
|
|
5024
|
+
exports.createKeychord = createKeychord;
|
|
5025
|
+
exports.createKeypress = createKeypress;
|
|
5026
|
+
exports.createKeyrelease = createKeyrelease;
|
|
5027
|
+
exports.createKeys = createKeys;
|
|
5028
|
+
exports.createList = createList;
|
|
3307
5029
|
exports.createMap = createMap;
|
|
3308
5030
|
exports.createMapAsync = createMapAsync;
|
|
3309
|
-
exports.
|
|
3310
|
-
exports.
|
|
3311
|
-
exports.
|
|
5031
|
+
exports.createMousepress = createMousepress;
|
|
5032
|
+
exports.createMouserelease = createMouserelease;
|
|
5033
|
+
exports.createPredicateKeycomboMatch = createPredicateKeycomboMatch$1;
|
|
5034
|
+
exports.createPredicateRoot = createPredicateRoot;
|
|
3312
5035
|
exports.createReduce = createReduce;
|
|
3313
5036
|
exports.createReduceAsync = createReduceAsync;
|
|
3314
5037
|
exports.createRemove = createRemove;
|
|
@@ -3318,12 +5041,27 @@ exports.createReplace = createReplace;
|
|
|
3318
5041
|
exports.createReverse = createReverse;
|
|
3319
5042
|
exports.createSlice = createSlice;
|
|
3320
5043
|
exports.createSlug = createSlug;
|
|
5044
|
+
exports.createSome = createSome;
|
|
3321
5045
|
exports.createSort = createSort;
|
|
3322
5046
|
exports.createSwap = createSwap;
|
|
3323
|
-
exports.
|
|
3324
|
-
exports.
|
|
3325
|
-
exports.
|
|
5047
|
+
exports.createToGraph = createToGraph;
|
|
5048
|
+
exports.createToIncoming = createToIncoming;
|
|
5049
|
+
exports.createToIndegree = createToIndegree;
|
|
5050
|
+
exports.createToOutdegree = createToOutdegree;
|
|
5051
|
+
exports.createToOutgoing = createToOutgoing;
|
|
5052
|
+
exports.createTouchpress = createTouchpress;
|
|
5053
|
+
exports.createTouchrelease = createTouchrelease;
|
|
5054
|
+
exports.createTreeFind = createFind;
|
|
3326
5055
|
exports.createUnique = createUnique;
|
|
5056
|
+
exports.defineAssociativeArrayEntries = defineAssociativeArrayEntries;
|
|
5057
|
+
exports.defineAsyncGraph = defineAsyncGraph;
|
|
5058
|
+
exports.defineAsyncGraphEdge = defineAsyncGraphEdge;
|
|
5059
|
+
exports.defineAsyncGraphEdges = defineAsyncGraphEdges;
|
|
5060
|
+
exports.defineGraph = defineGraph;
|
|
5061
|
+
exports.defineGraphEdge = defineGraphEdge;
|
|
5062
|
+
exports.defineGraphEdges = defineGraphEdges;
|
|
5063
|
+
exports.defineGraphNode = defineGraphNode;
|
|
5064
|
+
exports.defineGraphNodes = defineGraphNodes;
|
|
3327
5065
|
exports.easingsNetInBack = easingsNetInBack;
|
|
3328
5066
|
exports.easingsNetInCirc = easingsNetInCirc;
|
|
3329
5067
|
exports.easingsNetInCubic = easingsNetInCubic;
|