@baleada/logic 0.20.28 → 0.20.33
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 +177 -32
- package/lib/index.d.ts +5 -3
- package/lib/index.js +172 -28
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -158,7 +158,16 @@ function createDetermine(potentialities) {
|
|
|
158
158
|
function createRename({ from, to }) {
|
|
159
159
|
return (map2) => {
|
|
160
160
|
const keys = [...map2.keys()], keyToRenameIndex = findIndex((k) => k === from)(keys), newKeys = createReplace({ index: keyToRenameIndex, item: to })(keys), values = [...map2.values()];
|
|
161
|
-
return createReduce((renamed, key, index) => renamed.set(key, values[index]), new Map())(newKeys);
|
|
161
|
+
return createReduce((renamed, key, index) => renamed.set(key, values[index]), /* @__PURE__ */ new Map())(newKeys);
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function createToEntries() {
|
|
165
|
+
return (object) => {
|
|
166
|
+
const entries = [];
|
|
167
|
+
for (const key in object) {
|
|
168
|
+
entries.push([key, object[key]]);
|
|
169
|
+
}
|
|
170
|
+
return entries;
|
|
162
171
|
};
|
|
163
172
|
}
|
|
164
173
|
class Pipeable {
|
|
@@ -226,8 +235,6 @@ function toEvent(eventType, options) {
|
|
|
226
235
|
return new InputEvent(eventType, options.init);
|
|
227
236
|
if (eventType === "blur")
|
|
228
237
|
return new FocusEvent(eventType, options.init);
|
|
229
|
-
if (eventType === "cancel")
|
|
230
|
-
return new Event(eventType, options.init);
|
|
231
238
|
if (eventType === "canplay")
|
|
232
239
|
return new Event(eventType, options.init);
|
|
233
240
|
if (eventType === "canplaythrough")
|
|
@@ -256,8 +263,6 @@ function toEvent(eventType, options) {
|
|
|
256
263
|
return new DragEvent(eventType, options.init);
|
|
257
264
|
if (eventType === "dragenter")
|
|
258
265
|
return new DragEvent(eventType, options.init);
|
|
259
|
-
if (eventType === "dragexit")
|
|
260
|
-
return new Event(eventType, options.init);
|
|
261
266
|
if (eventType === "dragleave")
|
|
262
267
|
return new DragEvent(eventType, options.init);
|
|
263
268
|
if (eventType === "dragover")
|
|
@@ -480,7 +485,7 @@ function toCombo(type) {
|
|
|
480
485
|
function fromComboItemNameToType(name) {
|
|
481
486
|
return find((type) => predicatesByType[type](name))(listenableComboItemTypes) ?? "custom";
|
|
482
487
|
}
|
|
483
|
-
const listenableComboItemTypes = new Set(["singleCharacter", "arrow", "other", "modifier", "click", "pointer"]);
|
|
488
|
+
const listenableComboItemTypes = /* @__PURE__ */ new Set(["singleCharacter", "arrow", "other", "modifier", "click", "pointer"]);
|
|
484
489
|
const predicatesByType = {
|
|
485
490
|
singleCharacter: (name) => typeREs["singleCharacter"].test(name),
|
|
486
491
|
arrow: (name) => typeREs["arrow"].test(name),
|
|
@@ -576,6 +581,10 @@ function isString(value) {
|
|
|
576
581
|
}
|
|
577
582
|
|
|
578
583
|
class Recognizeable {
|
|
584
|
+
maxSequenceLength;
|
|
585
|
+
effects;
|
|
586
|
+
effectApi;
|
|
587
|
+
toType;
|
|
579
588
|
constructor(sequence, options = { effectsIncludeCombos: true }) {
|
|
580
589
|
const defaultOptions = {
|
|
581
590
|
maxSequenceLength: true,
|
|
@@ -599,6 +608,7 @@ class Recognizeable {
|
|
|
599
608
|
};
|
|
600
609
|
this.ready();
|
|
601
610
|
}
|
|
611
|
+
computedMetadata;
|
|
602
612
|
resetComputedMetadata() {
|
|
603
613
|
this.computedMetadata = {};
|
|
604
614
|
}
|
|
@@ -608,6 +618,7 @@ class Recognizeable {
|
|
|
608
618
|
denied() {
|
|
609
619
|
this.computedStatus = "denied";
|
|
610
620
|
}
|
|
621
|
+
computedStatus;
|
|
611
622
|
ready() {
|
|
612
623
|
this.computedStatus = "ready";
|
|
613
624
|
}
|
|
@@ -623,6 +634,7 @@ class Recognizeable {
|
|
|
623
634
|
get metadata() {
|
|
624
635
|
return this.computedMetadata;
|
|
625
636
|
}
|
|
637
|
+
computedSequence;
|
|
626
638
|
setSequence(sequence) {
|
|
627
639
|
this.computedSequence = sequence;
|
|
628
640
|
return this;
|
|
@@ -726,9 +738,12 @@ function createToType({
|
|
|
726
738
|
}
|
|
727
739
|
};
|
|
728
740
|
}
|
|
729
|
-
const leftclickcomboEventTypes = new Set(["click", "mousedown", "mouseup", "dblclick"]), rightclickComboEventTypes = new Set(["contextmenu"]), keycomboEventTypes = new Set(["keydown", "keyup"]), toJoinedClickcombo = join("+"), toJoinedKeycombo = pipe(map(({ name }) => name), toJoinedClickcombo);
|
|
741
|
+
const leftclickcomboEventTypes = /* @__PURE__ */ new Set(["click", "mousedown", "mouseup", "dblclick"]), rightclickComboEventTypes = /* @__PURE__ */ new Set(["contextmenu"]), keycomboEventTypes = /* @__PURE__ */ new Set(["keydown", "keyup"]), toJoinedClickcombo = join("+"), toJoinedKeycombo = pipe(map(({ name }) => name), toJoinedClickcombo);
|
|
730
742
|
|
|
731
743
|
class Listenable {
|
|
744
|
+
computedRecognizeable;
|
|
745
|
+
recognizeableEffectsKeys;
|
|
746
|
+
computedActive;
|
|
732
747
|
constructor(type, options) {
|
|
733
748
|
if (type === "recognizeable") {
|
|
734
749
|
const recognizeableOptions = {
|
|
@@ -741,10 +756,11 @@ class Listenable {
|
|
|
741
756
|
this.computedRecognizeable = new Recognizeable([], recognizeableOptions);
|
|
742
757
|
this.recognizeableEffectsKeys = Object.keys(recognizeableOptions.effects);
|
|
743
758
|
}
|
|
744
|
-
this.computedActive = new Set();
|
|
759
|
+
this.computedActive = /* @__PURE__ */ new Set();
|
|
745
760
|
this.setType(type);
|
|
746
761
|
this.ready();
|
|
747
762
|
}
|
|
763
|
+
computedStatus;
|
|
748
764
|
ready() {
|
|
749
765
|
this.computedStatus = "ready";
|
|
750
766
|
}
|
|
@@ -763,6 +779,8 @@ class Listenable {
|
|
|
763
779
|
get recognizeable() {
|
|
764
780
|
return this.computedRecognizeable;
|
|
765
781
|
}
|
|
782
|
+
computedType;
|
|
783
|
+
implementation;
|
|
766
784
|
setType(type) {
|
|
767
785
|
this.stop();
|
|
768
786
|
this.computedType = type;
|
|
@@ -955,7 +973,7 @@ function stop(stoppable) {
|
|
|
955
973
|
function toImplementation(type) {
|
|
956
974
|
return find((implementation) => predicatesByImplementation.get(implementation)(type))(predicatesByImplementation.keys());
|
|
957
975
|
}
|
|
958
|
-
const predicatesByImplementation = new Map([
|
|
976
|
+
const predicatesByImplementation = /* @__PURE__ */ new Map([
|
|
959
977
|
[
|
|
960
978
|
"recognizeable",
|
|
961
979
|
(type) => type === "recognizeable"
|
|
@@ -1005,7 +1023,7 @@ const predicatesByImplementation = new Map([
|
|
|
1005
1023
|
() => true
|
|
1006
1024
|
]
|
|
1007
1025
|
]);
|
|
1008
|
-
const documentEvents = new Set([
|
|
1026
|
+
const documentEvents = /* @__PURE__ */ new Set([
|
|
1009
1027
|
"fullscreenchange",
|
|
1010
1028
|
"fullscreenerror",
|
|
1011
1029
|
"pointerlockchange",
|
|
@@ -1028,6 +1046,11 @@ function eventMatchesKeycombo({ event, keycombo }) {
|
|
|
1028
1046
|
return every(({ name, type }, index) => {
|
|
1029
1047
|
switch (type) {
|
|
1030
1048
|
case "singleCharacter":
|
|
1049
|
+
if (name === "!") {
|
|
1050
|
+
return event.key === "!";
|
|
1051
|
+
}
|
|
1052
|
+
const keyToTest = event.altKey && fromComboItemNameToType(event.key) === "custom" ? fromCodeToSingleCharacter(event.code) : event.key.toLowerCase();
|
|
1053
|
+
return name.startsWith("!") ? keyToTest !== toKey(name.slice(1)).toLowerCase() : keyToTest === toKey(name).toLowerCase();
|
|
1031
1054
|
case "other":
|
|
1032
1055
|
if (name === "!") {
|
|
1033
1056
|
return event.key === "!";
|
|
@@ -1043,7 +1066,34 @@ function eventMatchesKeycombo({ event, keycombo }) {
|
|
|
1043
1066
|
}
|
|
1044
1067
|
})(keycombo);
|
|
1045
1068
|
}
|
|
1046
|
-
|
|
1069
|
+
function fromCodeToSingleCharacter(code) {
|
|
1070
|
+
for (const c in aliasesByCode) {
|
|
1071
|
+
if (c === code) {
|
|
1072
|
+
return aliasesByCode[c];
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
for (const prefix of ["Key", "Digit"]) {
|
|
1076
|
+
const re = new RegExp(`^${prefix}`);
|
|
1077
|
+
if (re.test(code)) {
|
|
1078
|
+
return createClip(re)(code).toLowerCase();
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
return code;
|
|
1082
|
+
}
|
|
1083
|
+
const aliasesByCode = {
|
|
1084
|
+
"Backquote": "`",
|
|
1085
|
+
"Minus": "-",
|
|
1086
|
+
"Equal": "=",
|
|
1087
|
+
"BracketLeft": "[",
|
|
1088
|
+
"BracketRight": "]",
|
|
1089
|
+
"Backslash": "\\",
|
|
1090
|
+
"Semicolon": ";",
|
|
1091
|
+
"Quote": "'",
|
|
1092
|
+
"Comma": ",",
|
|
1093
|
+
"Period": ".",
|
|
1094
|
+
"Slash": "/"
|
|
1095
|
+
};
|
|
1096
|
+
const predicatesByArrow = /* @__PURE__ */ new Map([
|
|
1047
1097
|
[
|
|
1048
1098
|
"arrow",
|
|
1049
1099
|
({ event }) => arrows.has(event.key.toLowerCase())
|
|
@@ -1073,9 +1123,9 @@ const predicatesByArrow = new Map([
|
|
|
1073
1123
|
({ event, name }) => name.startsWith("!") ? event.key.toLowerCase() !== `arrow${name.toLowerCase()}` : event.key.toLowerCase() === `arrow${name.toLowerCase()}`
|
|
1074
1124
|
]
|
|
1075
1125
|
]);
|
|
1076
|
-
const arrows = new Set(["arrowup", "arrowright", "arrowdown", "arrowleft"]);
|
|
1077
|
-
const verticalArrows = new Set(["arrowup", "arrowdown"]);
|
|
1078
|
-
const horizontalArrows = new Set(["arrowright", "arrowleft"]);
|
|
1126
|
+
const arrows = /* @__PURE__ */ new Set(["arrowup", "arrowright", "arrowdown", "arrowleft"]);
|
|
1127
|
+
const verticalArrows = /* @__PURE__ */ new Set(["arrowup", "arrowdown"]);
|
|
1128
|
+
const horizontalArrows = /* @__PURE__ */ new Set(["arrowright", "arrowleft"]);
|
|
1079
1129
|
function eventMatchesClickcombo({ event, clickcombo }) {
|
|
1080
1130
|
return every((name) => fromComboItemNameToType(name) === "click" || name.startsWith("!") && !isModified({ alias: name.slice(1), event }) || !name.startsWith("!") && isModified({ alias: name, event }))(clickcombo);
|
|
1081
1131
|
}
|
|
@@ -1100,6 +1150,21 @@ const defaultOptions$6 = {
|
|
|
1100
1150
|
alternates: false
|
|
1101
1151
|
};
|
|
1102
1152
|
class Animateable {
|
|
1153
|
+
initialDuration;
|
|
1154
|
+
iterationLimit;
|
|
1155
|
+
alternates;
|
|
1156
|
+
controlPoints;
|
|
1157
|
+
reversedControlPoints;
|
|
1158
|
+
toAnimationProgress;
|
|
1159
|
+
reversedToAnimationProgress;
|
|
1160
|
+
playCache;
|
|
1161
|
+
reverseCache;
|
|
1162
|
+
pauseCache;
|
|
1163
|
+
seekCache;
|
|
1164
|
+
alternateCache;
|
|
1165
|
+
visibilitychange;
|
|
1166
|
+
getEaseables;
|
|
1167
|
+
getReversedEaseables;
|
|
1103
1168
|
constructor(keyframes, options = {}) {
|
|
1104
1169
|
this.initialDuration = options?.duration || defaultOptions$6.duration;
|
|
1105
1170
|
this.controlPoints = fromTimingToControlPoints(options?.timing || defaultOptions$6.timing);
|
|
@@ -1123,21 +1188,25 @@ class Animateable {
|
|
|
1123
1188
|
this.resetProgress();
|
|
1124
1189
|
this.resetIterations();
|
|
1125
1190
|
}
|
|
1191
|
+
computedStatus;
|
|
1126
1192
|
ready() {
|
|
1127
1193
|
this.computedStatus = "ready";
|
|
1128
1194
|
}
|
|
1195
|
+
computedTime;
|
|
1129
1196
|
resetTime() {
|
|
1130
1197
|
this.computedTime = {
|
|
1131
1198
|
elapsed: 0,
|
|
1132
1199
|
remaining: this.duration
|
|
1133
1200
|
};
|
|
1134
1201
|
}
|
|
1202
|
+
computedProgress;
|
|
1135
1203
|
resetProgress() {
|
|
1136
1204
|
this.computedProgress = {
|
|
1137
1205
|
time: 0,
|
|
1138
1206
|
animation: 0
|
|
1139
1207
|
};
|
|
1140
1208
|
}
|
|
1209
|
+
computedIterations;
|
|
1141
1210
|
resetIterations() {
|
|
1142
1211
|
this.computedIterations = 0;
|
|
1143
1212
|
}
|
|
@@ -1168,6 +1237,11 @@ class Animateable {
|
|
|
1168
1237
|
get progress() {
|
|
1169
1238
|
return this.computedProgress;
|
|
1170
1239
|
}
|
|
1240
|
+
computedKeyframes;
|
|
1241
|
+
reversedKeyframes;
|
|
1242
|
+
properties;
|
|
1243
|
+
easeables;
|
|
1244
|
+
reversedEaseables;
|
|
1171
1245
|
setKeyframes(keyframes) {
|
|
1172
1246
|
this.stop();
|
|
1173
1247
|
this.computedKeyframes = Array.from(keyframes).sort(({ progress: progressA }, { progress: progressB }) => progressA - progressB);
|
|
@@ -1177,6 +1251,9 @@ class Animateable {
|
|
|
1177
1251
|
this.reversedEaseables = this.getReversedEaseables({ keyframes: this.reversedKeyframes, properties: this.properties });
|
|
1178
1252
|
return this;
|
|
1179
1253
|
}
|
|
1254
|
+
computedPlaybackRate;
|
|
1255
|
+
duration;
|
|
1256
|
+
totalTimeInvisible;
|
|
1180
1257
|
setPlaybackRate(playbackRate) {
|
|
1181
1258
|
const ensuredPlaybackRate = Math.max(0, playbackRate);
|
|
1182
1259
|
this.computedPlaybackRate = ensuredPlaybackRate;
|
|
@@ -1322,6 +1399,7 @@ class Animateable {
|
|
|
1322
1399
|
reversed() {
|
|
1323
1400
|
this.computedStatus = "reversed";
|
|
1324
1401
|
}
|
|
1402
|
+
invisibleAt;
|
|
1325
1403
|
listenForVisibilitychange() {
|
|
1326
1404
|
if (this.visibilitychange.active.size === 0) {
|
|
1327
1405
|
this.totalTimeInvisible = 0;
|
|
@@ -1337,6 +1415,7 @@ class Animateable {
|
|
|
1337
1415
|
});
|
|
1338
1416
|
}
|
|
1339
1417
|
}
|
|
1418
|
+
computedRequest;
|
|
1340
1419
|
createAnimate(type) {
|
|
1341
1420
|
return (effect, options = {}) => {
|
|
1342
1421
|
const { interpolate: interpolateOptions } = options;
|
|
@@ -1357,6 +1436,7 @@ class Animateable {
|
|
|
1357
1436
|
return this;
|
|
1358
1437
|
};
|
|
1359
1438
|
}
|
|
1439
|
+
startTime;
|
|
1360
1440
|
setStartTimeAndStatus(type, timestamp) {
|
|
1361
1441
|
switch (type) {
|
|
1362
1442
|
case "play":
|
|
@@ -1723,7 +1803,7 @@ function createGetEaseables(fromKeyframeToControlPoints) {
|
|
|
1723
1803
|
};
|
|
1724
1804
|
}
|
|
1725
1805
|
function toProperties(keyframes) {
|
|
1726
|
-
const properties = new Set();
|
|
1806
|
+
const properties = /* @__PURE__ */ new Set();
|
|
1727
1807
|
for (const keyframe of keyframes) {
|
|
1728
1808
|
for (const property in keyframe.properties) {
|
|
1729
1809
|
if (!properties.has(property)) {
|
|
@@ -1961,6 +2041,10 @@ const defaultCompleteOptions = {
|
|
|
1961
2041
|
select: "completionEnd"
|
|
1962
2042
|
};
|
|
1963
2043
|
class Completeable {
|
|
2044
|
+
segmentFrom;
|
|
2045
|
+
segmentTo;
|
|
2046
|
+
divider;
|
|
2047
|
+
computedDividerIndices;
|
|
1964
2048
|
constructor(string, options = {}) {
|
|
1965
2049
|
this.constructing();
|
|
1966
2050
|
this.segmentFrom = options?.segment?.from || defaultOptions$5.segment.from;
|
|
@@ -1974,6 +2058,7 @@ class Completeable {
|
|
|
1974
2058
|
constructing() {
|
|
1975
2059
|
this.computedStatus = "constructing";
|
|
1976
2060
|
}
|
|
2061
|
+
computedStatus;
|
|
1977
2062
|
ready() {
|
|
1978
2063
|
this.computedStatus = "ready";
|
|
1979
2064
|
}
|
|
@@ -2018,6 +2103,7 @@ class Completeable {
|
|
|
2018
2103
|
return this.dividerIndices.after;
|
|
2019
2104
|
}
|
|
2020
2105
|
}
|
|
2106
|
+
computedString;
|
|
2021
2107
|
setString(string) {
|
|
2022
2108
|
this.computedString = string;
|
|
2023
2109
|
switch (this.status) {
|
|
@@ -2029,6 +2115,7 @@ class Completeable {
|
|
|
2029
2115
|
}
|
|
2030
2116
|
return this;
|
|
2031
2117
|
}
|
|
2118
|
+
computedSelection;
|
|
2032
2119
|
setSelection(selection) {
|
|
2033
2120
|
this.computedSelection = selection;
|
|
2034
2121
|
this.setDividerIndices();
|
|
@@ -2115,6 +2202,10 @@ function toNextMatch({ string, re, from }) {
|
|
|
2115
2202
|
}
|
|
2116
2203
|
|
|
2117
2204
|
class Copyable {
|
|
2205
|
+
computedIsClipboardText;
|
|
2206
|
+
copyListenable;
|
|
2207
|
+
cutListenable;
|
|
2208
|
+
copyAndCutEffect;
|
|
2118
2209
|
constructor(string, options = {}) {
|
|
2119
2210
|
this.computedIsClipboardText = false;
|
|
2120
2211
|
this.copyListenable = new Listenable("copy");
|
|
@@ -2126,6 +2217,7 @@ class Copyable {
|
|
|
2126
2217
|
this.setString(string);
|
|
2127
2218
|
this.ready();
|
|
2128
2219
|
}
|
|
2220
|
+
computedStatus;
|
|
2129
2221
|
ready() {
|
|
2130
2222
|
this.computedStatus = "ready";
|
|
2131
2223
|
}
|
|
@@ -2147,10 +2239,13 @@ class Copyable {
|
|
|
2147
2239
|
get error() {
|
|
2148
2240
|
return this.computedError;
|
|
2149
2241
|
}
|
|
2242
|
+
computedString;
|
|
2150
2243
|
setString(string) {
|
|
2151
2244
|
this.computedString = string;
|
|
2152
2245
|
return this;
|
|
2153
2246
|
}
|
|
2247
|
+
computedResponse;
|
|
2248
|
+
computedError;
|
|
2154
2249
|
async copy(options = { type: "clipboard" }) {
|
|
2155
2250
|
this.copying();
|
|
2156
2251
|
const { type } = options;
|
|
@@ -2203,6 +2298,7 @@ const defaultOptions$4 = {
|
|
|
2203
2298
|
executions: 1
|
|
2204
2299
|
};
|
|
2205
2300
|
class Delayable {
|
|
2301
|
+
animateable;
|
|
2206
2302
|
constructor(effect, options = {}) {
|
|
2207
2303
|
this.animateable = new Animateable([
|
|
2208
2304
|
{ progress: 0, properties: { progress: 0 } },
|
|
@@ -2214,6 +2310,7 @@ class Delayable {
|
|
|
2214
2310
|
this.setEffect(effect);
|
|
2215
2311
|
this.ready();
|
|
2216
2312
|
}
|
|
2313
|
+
computedStatus;
|
|
2217
2314
|
ready() {
|
|
2218
2315
|
this.computedStatus = "ready";
|
|
2219
2316
|
}
|
|
@@ -2235,12 +2332,14 @@ class Delayable {
|
|
|
2235
2332
|
get progress() {
|
|
2236
2333
|
return this.animateable.progress.time;
|
|
2237
2334
|
}
|
|
2335
|
+
computedEffect;
|
|
2238
2336
|
setEffect(effect) {
|
|
2239
2337
|
this.stop();
|
|
2240
2338
|
this.computedEffect = effect;
|
|
2241
2339
|
this.setFrameEffect(effect);
|
|
2242
2340
|
return this;
|
|
2243
2341
|
}
|
|
2342
|
+
frameEffect;
|
|
2244
2343
|
setFrameEffect(effect) {
|
|
2245
2344
|
this.frameEffect = (frame) => {
|
|
2246
2345
|
const { properties: { progress }, timestamp } = frame;
|
|
@@ -2343,6 +2442,7 @@ class Dispatchable {
|
|
|
2343
2442
|
this.setType(type);
|
|
2344
2443
|
this.ready();
|
|
2345
2444
|
}
|
|
2445
|
+
computedStatus;
|
|
2346
2446
|
ready() {
|
|
2347
2447
|
this.computedStatus = "ready";
|
|
2348
2448
|
}
|
|
@@ -2358,10 +2458,12 @@ class Dispatchable {
|
|
|
2358
2458
|
get status() {
|
|
2359
2459
|
return this.computedStatus;
|
|
2360
2460
|
}
|
|
2461
|
+
computedType;
|
|
2361
2462
|
setType(type) {
|
|
2362
2463
|
this.computedType = type;
|
|
2363
2464
|
return this;
|
|
2364
2465
|
}
|
|
2466
|
+
computedCancelled;
|
|
2365
2467
|
dispatch(options = {}) {
|
|
2366
2468
|
const { target = window, ...rest } = options, event = toEvent(this.type, rest);
|
|
2367
2469
|
this.computedCancelled = !target.dispatchEvent(event);
|
|
@@ -2377,11 +2479,14 @@ const defaultOptions$3 = {
|
|
|
2377
2479
|
toD: (stroke) => stroke.length === 0 ? "" : toD(stroke)
|
|
2378
2480
|
};
|
|
2379
2481
|
class Drawable {
|
|
2482
|
+
computedD;
|
|
2483
|
+
toD;
|
|
2380
2484
|
constructor(stroke, options = {}) {
|
|
2381
2485
|
this.toD = options?.toD || defaultOptions$3.toD;
|
|
2382
2486
|
this.setStroke(stroke);
|
|
2383
2487
|
this.ready();
|
|
2384
2488
|
}
|
|
2489
|
+
computedStatus;
|
|
2385
2490
|
ready() {
|
|
2386
2491
|
this.computedStatus = "ready";
|
|
2387
2492
|
}
|
|
@@ -2397,6 +2502,7 @@ class Drawable {
|
|
|
2397
2502
|
get d() {
|
|
2398
2503
|
return this.computedD;
|
|
2399
2504
|
}
|
|
2505
|
+
computedStroke;
|
|
2400
2506
|
setStroke(stroke) {
|
|
2401
2507
|
this.computedStroke = stroke;
|
|
2402
2508
|
this.computedD = this.toD(stroke);
|
|
@@ -2438,6 +2544,7 @@ class Resolveable {
|
|
|
2438
2544
|
this.setGetPromise(getPromise);
|
|
2439
2545
|
this.ready();
|
|
2440
2546
|
}
|
|
2547
|
+
computedStatus;
|
|
2441
2548
|
ready() {
|
|
2442
2549
|
this.computedStatus = "ready";
|
|
2443
2550
|
}
|
|
@@ -2453,10 +2560,12 @@ class Resolveable {
|
|
|
2453
2560
|
get value() {
|
|
2454
2561
|
return this.computedValue;
|
|
2455
2562
|
}
|
|
2563
|
+
computedGetPromise;
|
|
2456
2564
|
setGetPromise(getPromise) {
|
|
2457
2565
|
this.computedGetPromise = getPromise;
|
|
2458
2566
|
return this;
|
|
2459
2567
|
}
|
|
2568
|
+
computedValue;
|
|
2460
2569
|
async resolve(...args) {
|
|
2461
2570
|
this.resolving();
|
|
2462
2571
|
try {
|
|
@@ -2481,6 +2590,11 @@ class Resolveable {
|
|
|
2481
2590
|
}
|
|
2482
2591
|
|
|
2483
2592
|
class Fetchable {
|
|
2593
|
+
computedArrayBuffer;
|
|
2594
|
+
computedBlob;
|
|
2595
|
+
computedFormData;
|
|
2596
|
+
computedJson;
|
|
2597
|
+
computedText;
|
|
2484
2598
|
constructor(resource, options = {}) {
|
|
2485
2599
|
this.setResource(resource);
|
|
2486
2600
|
this.computedArrayBuffer = new Resolveable(async () => "arrayBuffer" in this.response ? await this.response.arrayBuffer() : await void 0);
|
|
@@ -2490,6 +2604,7 @@ class Fetchable {
|
|
|
2490
2604
|
this.computedText = new Resolveable(async () => "text" in this.response ? await this.response.text() : await void 0);
|
|
2491
2605
|
this.ready();
|
|
2492
2606
|
}
|
|
2607
|
+
computedStatus;
|
|
2493
2608
|
ready() {
|
|
2494
2609
|
this.computedStatus = "ready";
|
|
2495
2610
|
}
|
|
@@ -2499,6 +2614,7 @@ class Fetchable {
|
|
|
2499
2614
|
set resource(resource) {
|
|
2500
2615
|
this.setResource(resource);
|
|
2501
2616
|
}
|
|
2617
|
+
computedAbortController;
|
|
2502
2618
|
get abortController() {
|
|
2503
2619
|
if (!this.computedAbortController) {
|
|
2504
2620
|
this.computedAbortController = new AbortController();
|
|
@@ -2544,10 +2660,13 @@ class Fetchable {
|
|
|
2544
2660
|
return resolveable;
|
|
2545
2661
|
}
|
|
2546
2662
|
}
|
|
2663
|
+
computedResource;
|
|
2547
2664
|
setResource(resource) {
|
|
2548
2665
|
this.computedResource = resource;
|
|
2549
2666
|
return this;
|
|
2550
2667
|
}
|
|
2668
|
+
computedResponse;
|
|
2669
|
+
computedError;
|
|
2551
2670
|
async fetch(options = {}) {
|
|
2552
2671
|
this.computedStatus = "fetching";
|
|
2553
2672
|
try {
|
|
@@ -2602,6 +2721,7 @@ class Fullscreenable {
|
|
|
2602
2721
|
this.setGetElement(getElement);
|
|
2603
2722
|
this.ready();
|
|
2604
2723
|
}
|
|
2724
|
+
computedStatus;
|
|
2605
2725
|
ready() {
|
|
2606
2726
|
this.computedStatus = "ready";
|
|
2607
2727
|
}
|
|
@@ -2620,6 +2740,7 @@ class Fullscreenable {
|
|
|
2620
2740
|
get error() {
|
|
2621
2741
|
return this.computedError;
|
|
2622
2742
|
}
|
|
2743
|
+
computedGetElement;
|
|
2623
2744
|
setGetElement(getElement) {
|
|
2624
2745
|
this.computedGetElement = () => getElement();
|
|
2625
2746
|
return this;
|
|
@@ -2628,6 +2749,7 @@ class Fullscreenable {
|
|
|
2628
2749
|
await this.fullscreen(options);
|
|
2629
2750
|
return this;
|
|
2630
2751
|
}
|
|
2752
|
+
computedError;
|
|
2631
2753
|
async fullscreen(options = {}) {
|
|
2632
2754
|
try {
|
|
2633
2755
|
await this.element.requestFullscreen(options);
|
|
@@ -2664,6 +2786,7 @@ class Grantable {
|
|
|
2664
2786
|
this.setDescriptor(descriptor);
|
|
2665
2787
|
this.ready();
|
|
2666
2788
|
}
|
|
2789
|
+
computedStatus;
|
|
2667
2790
|
ready() {
|
|
2668
2791
|
this.computedStatus = "ready";
|
|
2669
2792
|
}
|
|
@@ -2679,10 +2802,12 @@ class Grantable {
|
|
|
2679
2802
|
get status() {
|
|
2680
2803
|
return this.computedStatus;
|
|
2681
2804
|
}
|
|
2805
|
+
computedDescriptor;
|
|
2682
2806
|
setDescriptor(descriptor) {
|
|
2683
2807
|
this.computedDescriptor = descriptor;
|
|
2684
2808
|
return this;
|
|
2685
2809
|
}
|
|
2810
|
+
computedPermission;
|
|
2686
2811
|
async query() {
|
|
2687
2812
|
this.querying();
|
|
2688
2813
|
try {
|
|
@@ -2719,15 +2844,18 @@ class Navigateable {
|
|
|
2719
2844
|
this.navigate(options?.initialLocation ?? defaultOptions$2.initialLocation);
|
|
2720
2845
|
this.ready();
|
|
2721
2846
|
}
|
|
2847
|
+
computedStatus;
|
|
2722
2848
|
ready() {
|
|
2723
2849
|
this.computedStatus = "ready";
|
|
2724
2850
|
}
|
|
2851
|
+
computedArray;
|
|
2725
2852
|
get array() {
|
|
2726
2853
|
return this.computedArray;
|
|
2727
2854
|
}
|
|
2728
2855
|
set array(value) {
|
|
2729
2856
|
this.setArray(value);
|
|
2730
2857
|
}
|
|
2858
|
+
computedLocation;
|
|
2731
2859
|
get location() {
|
|
2732
2860
|
return this.computedLocation;
|
|
2733
2861
|
}
|
|
@@ -2773,10 +2901,7 @@ class Navigateable {
|
|
|
2773
2901
|
this.computedLocation = ensuredLocation;
|
|
2774
2902
|
}
|
|
2775
2903
|
next(options = {}) {
|
|
2776
|
-
const { distance, loops
|
|
2777
|
-
if (allow === "any") {
|
|
2778
|
-
return this.location + distance;
|
|
2779
|
-
}
|
|
2904
|
+
const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
|
|
2780
2905
|
const lastLocation = this.array.length - 1;
|
|
2781
2906
|
if (this.location + distance <= lastLocation) {
|
|
2782
2907
|
return this.location + distance;
|
|
@@ -2792,7 +2917,7 @@ class Navigateable {
|
|
|
2792
2917
|
return newLocation2;
|
|
2793
2918
|
})();
|
|
2794
2919
|
})();
|
|
2795
|
-
this._navigate(newLocation
|
|
2920
|
+
this._navigate(newLocation);
|
|
2796
2921
|
this.nexted();
|
|
2797
2922
|
return this;
|
|
2798
2923
|
}
|
|
@@ -2800,10 +2925,7 @@ class Navigateable {
|
|
|
2800
2925
|
this.computedStatus = "navigated to next";
|
|
2801
2926
|
}
|
|
2802
2927
|
previous(options = {}) {
|
|
2803
|
-
const { distance, loops
|
|
2804
|
-
if (allow === "any") {
|
|
2805
|
-
return this.location - distance;
|
|
2806
|
-
}
|
|
2928
|
+
const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
|
|
2807
2929
|
if (this.location - distance >= 0) {
|
|
2808
2930
|
return this.location - distance;
|
|
2809
2931
|
}
|
|
@@ -2818,7 +2940,7 @@ class Navigateable {
|
|
|
2818
2940
|
return newLocation2;
|
|
2819
2941
|
})();
|
|
2820
2942
|
})();
|
|
2821
|
-
this._navigate(newLocation
|
|
2943
|
+
this._navigate(newLocation);
|
|
2822
2944
|
this.previoused();
|
|
2823
2945
|
return this;
|
|
2824
2946
|
}
|
|
@@ -2857,29 +2979,33 @@ const defaultOptions$1 = {
|
|
|
2857
2979
|
};
|
|
2858
2980
|
class Pickable {
|
|
2859
2981
|
constructor(array, options = {}) {
|
|
2860
|
-
this.toItems = createMap((index) => this.array[index]);
|
|
2861
2982
|
this.setArray(array);
|
|
2862
2983
|
this.pick(options.initialPicks ?? defaultOptions$1.initialPicks);
|
|
2863
2984
|
this.ready();
|
|
2864
2985
|
}
|
|
2986
|
+
computedStatus;
|
|
2865
2987
|
ready() {
|
|
2866
2988
|
this.computedStatus = "ready";
|
|
2867
2989
|
}
|
|
2990
|
+
computedArray;
|
|
2868
2991
|
get array() {
|
|
2869
2992
|
return this.computedArray;
|
|
2870
2993
|
}
|
|
2871
2994
|
set array(array) {
|
|
2872
2995
|
this.setArray(array);
|
|
2873
2996
|
}
|
|
2997
|
+
computedPicks;
|
|
2874
2998
|
get picks() {
|
|
2875
2999
|
return this.computedPicks;
|
|
2876
3000
|
}
|
|
2877
3001
|
set picks(indices) {
|
|
2878
3002
|
this.pick(indices);
|
|
2879
3003
|
}
|
|
3004
|
+
computedFirst;
|
|
2880
3005
|
get first() {
|
|
2881
3006
|
return this.computedFirst;
|
|
2882
3007
|
}
|
|
3008
|
+
computedLast;
|
|
2883
3009
|
get last() {
|
|
2884
3010
|
return this.computedLast;
|
|
2885
3011
|
}
|
|
@@ -2895,9 +3021,11 @@ class Pickable {
|
|
|
2895
3021
|
get items() {
|
|
2896
3022
|
return this.toItems(this.picks);
|
|
2897
3023
|
}
|
|
3024
|
+
toItems = createMap((index) => this.array[index]);
|
|
2898
3025
|
get multiple() {
|
|
2899
3026
|
return this.picks.length > 1;
|
|
2900
3027
|
}
|
|
3028
|
+
toPossiblePicks;
|
|
2901
3029
|
setArray(array) {
|
|
2902
3030
|
this.computedArray = array;
|
|
2903
3031
|
this.toPossiblePicks = createFilter((index) => index >= 0 && index < array.length);
|
|
@@ -2912,7 +3040,7 @@ class Pickable {
|
|
|
2912
3040
|
if (replace === "all") {
|
|
2913
3041
|
return toUnique(possiblePicks);
|
|
2914
3042
|
}
|
|
2915
|
-
const possibleWithoutDuplicates = createFilter((possiblePick) =>
|
|
3043
|
+
const possibleWithoutDuplicates = createFilter((possiblePick) => typeof find((pick) => pick === possiblePick)(this.picks || []) !== "number")(possiblePicks);
|
|
2916
3044
|
switch (replace) {
|
|
2917
3045
|
case "none":
|
|
2918
3046
|
return createConcat(this.picks || [], possibleWithoutDuplicates)([]);
|
|
@@ -2973,11 +3101,14 @@ function ensureIndices(indexOrIndices) {
|
|
|
2973
3101
|
const toUnique = createUnique();
|
|
2974
3102
|
|
|
2975
3103
|
class Sanitizeable {
|
|
3104
|
+
domPurifyConfig;
|
|
2976
3105
|
constructor(html, options) {
|
|
2977
3106
|
this.computedHtml = html;
|
|
2978
3107
|
this.domPurifyConfig = options;
|
|
2979
3108
|
this.ready();
|
|
2980
3109
|
}
|
|
3110
|
+
computedDompurify;
|
|
3111
|
+
computedStatus;
|
|
2981
3112
|
ready() {
|
|
2982
3113
|
if (domIsAvailable()) {
|
|
2983
3114
|
this.computedDompurify = createDOMPurify();
|
|
@@ -3001,6 +3132,7 @@ class Sanitizeable {
|
|
|
3001
3132
|
get status() {
|
|
3002
3133
|
return this.computedStatus;
|
|
3003
3134
|
}
|
|
3135
|
+
computedHtml;
|
|
3004
3136
|
setHtml(html) {
|
|
3005
3137
|
this.computedHtml = html;
|
|
3006
3138
|
return this;
|
|
@@ -3016,15 +3148,19 @@ class Sanitizeable {
|
|
|
3016
3148
|
}
|
|
3017
3149
|
|
|
3018
3150
|
class Searchable {
|
|
3151
|
+
searcherOptions;
|
|
3152
|
+
computedResults;
|
|
3019
3153
|
constructor(candidates, options = {}) {
|
|
3020
3154
|
this.searcherOptions = options;
|
|
3021
3155
|
this.setCandidates(candidates);
|
|
3022
3156
|
this.computedResults = [];
|
|
3023
3157
|
this.ready();
|
|
3024
3158
|
}
|
|
3159
|
+
computedStatus;
|
|
3025
3160
|
ready() {
|
|
3026
3161
|
this.computedStatus = "ready";
|
|
3027
3162
|
}
|
|
3163
|
+
computedCandidates;
|
|
3028
3164
|
get candidates() {
|
|
3029
3165
|
return this.computedCandidates;
|
|
3030
3166
|
}
|
|
@@ -3040,6 +3176,7 @@ class Searchable {
|
|
|
3040
3176
|
get status() {
|
|
3041
3177
|
return this.computedStatus;
|
|
3042
3178
|
}
|
|
3179
|
+
computedSearcher;
|
|
3043
3180
|
setCandidates(candidates) {
|
|
3044
3181
|
this.computedCandidates = Array.from(candidates);
|
|
3045
3182
|
this.computedSearcher = new Searcher(candidates, this.searcherOptions);
|
|
@@ -3060,6 +3197,8 @@ const defaultOptions = {
|
|
|
3060
3197
|
statusKeySuffix: " status"
|
|
3061
3198
|
};
|
|
3062
3199
|
class Storeable {
|
|
3200
|
+
type;
|
|
3201
|
+
statusKeySuffix;
|
|
3063
3202
|
constructor(key, options = {}) {
|
|
3064
3203
|
this.constructing();
|
|
3065
3204
|
this.type = options.type ?? defaultOptions.type;
|
|
@@ -3070,6 +3209,7 @@ class Storeable {
|
|
|
3070
3209
|
constructing() {
|
|
3071
3210
|
this.computedStatus = "constructing";
|
|
3072
3211
|
}
|
|
3212
|
+
computedStatus;
|
|
3073
3213
|
ready() {
|
|
3074
3214
|
this.computedStatus = "ready";
|
|
3075
3215
|
if (domIsAvailable()) {
|
|
@@ -3107,6 +3247,8 @@ class Storeable {
|
|
|
3107
3247
|
get error() {
|
|
3108
3248
|
return this.computedError;
|
|
3109
3249
|
}
|
|
3250
|
+
computedKey;
|
|
3251
|
+
computedStatusKey;
|
|
3110
3252
|
setKey(key) {
|
|
3111
3253
|
let string;
|
|
3112
3254
|
switch (this.status) {
|
|
@@ -3132,6 +3274,8 @@ class Storeable {
|
|
|
3132
3274
|
}
|
|
3133
3275
|
return this;
|
|
3134
3276
|
}
|
|
3277
|
+
computedString;
|
|
3278
|
+
computedError;
|
|
3135
3279
|
store(string) {
|
|
3136
3280
|
try {
|
|
3137
3281
|
this.storage.setItem(this.key, string);
|
|
@@ -3169,4 +3313,4 @@ class Storeable {
|
|
|
3169
3313
|
}
|
|
3170
3314
|
}
|
|
3171
3315
|
|
|
3172
|
-
export { Animateable, Completeable, Copyable, Delayable, Dispatchable, Drawable, Fetchable, Fullscreenable, Grantable, Listenable, Navigateable, Pickable, Pipeable, Recognizeable, Resolveable, Sanitizeable, Searchable, Storeable, createClamp, createClip, createConcat, createDelete, createDetermine, createFilter, createFilterAsync, createForEachAsync, createInsert, createMap, createMapAsync, createReduce, createReduceAsync, createRename, createReorder, createReplace, createReverse, createSlice, createSlug, createSwap, createUnique, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, ensureKeycombo, eventMatchesKeycombo, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
|
|
3316
|
+
export { Animateable, Completeable, Copyable, Delayable, Dispatchable, Drawable, Fetchable, Fullscreenable, Grantable, Listenable, Navigateable, Pickable, Pipeable, Recognizeable, Resolveable, Sanitizeable, Searchable, Storeable, createClamp, createClip, createConcat, createDelete, createDetermine, createFilter, createFilterAsync, createForEachAsync, createInsert, createMap, createMapAsync, createReduce, createReduceAsync, createRename, createReorder, createReplace, createReverse, createSlice, createSlug, createSwap, createToEntries, createUnique, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, ensureKeycombo, eventMatchesKeycombo, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
|