@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.cjs
CHANGED
|
@@ -142,7 +142,7 @@ function createReverse() {
|
|
|
142
142
|
}
|
|
143
143
|
function createSlug(options) {
|
|
144
144
|
return (string) => {
|
|
145
|
-
return slugify__default[
|
|
145
|
+
return slugify__default["default"](string, options);
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
function createClip(required) {
|
|
@@ -169,7 +169,16 @@ function createDetermine(potentialities) {
|
|
|
169
169
|
function createRename({ from, to }) {
|
|
170
170
|
return (map2) => {
|
|
171
171
|
const keys = [...map2.keys()], keyToRenameIndex = lazyCollections.findIndex((k) => k === from)(keys), newKeys = createReplace({ index: keyToRenameIndex, item: to })(keys), values = [...map2.values()];
|
|
172
|
-
return createReduce((renamed, key, index) => renamed.set(key, values[index]), new Map())(newKeys);
|
|
172
|
+
return createReduce((renamed, key, index) => renamed.set(key, values[index]), /* @__PURE__ */ new Map())(newKeys);
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function createToEntries() {
|
|
176
|
+
return (object) => {
|
|
177
|
+
const entries = [];
|
|
178
|
+
for (const key in object) {
|
|
179
|
+
entries.push([key, object[key]]);
|
|
180
|
+
}
|
|
181
|
+
return entries;
|
|
173
182
|
};
|
|
174
183
|
}
|
|
175
184
|
class Pipeable {
|
|
@@ -237,8 +246,6 @@ function toEvent(eventType, options) {
|
|
|
237
246
|
return new InputEvent(eventType, options.init);
|
|
238
247
|
if (eventType === "blur")
|
|
239
248
|
return new FocusEvent(eventType, options.init);
|
|
240
|
-
if (eventType === "cancel")
|
|
241
|
-
return new Event(eventType, options.init);
|
|
242
249
|
if (eventType === "canplay")
|
|
243
250
|
return new Event(eventType, options.init);
|
|
244
251
|
if (eventType === "canplaythrough")
|
|
@@ -267,8 +274,6 @@ function toEvent(eventType, options) {
|
|
|
267
274
|
return new DragEvent(eventType, options.init);
|
|
268
275
|
if (eventType === "dragenter")
|
|
269
276
|
return new DragEvent(eventType, options.init);
|
|
270
|
-
if (eventType === "dragexit")
|
|
271
|
-
return new Event(eventType, options.init);
|
|
272
277
|
if (eventType === "dragleave")
|
|
273
278
|
return new DragEvent(eventType, options.init);
|
|
274
279
|
if (eventType === "dragover")
|
|
@@ -491,7 +496,7 @@ function toCombo(type) {
|
|
|
491
496
|
function fromComboItemNameToType(name) {
|
|
492
497
|
return lazyCollections.find((type) => predicatesByType[type](name))(listenableComboItemTypes) ?? "custom";
|
|
493
498
|
}
|
|
494
|
-
const listenableComboItemTypes = new Set(["singleCharacter", "arrow", "other", "modifier", "click", "pointer"]);
|
|
499
|
+
const listenableComboItemTypes = /* @__PURE__ */ new Set(["singleCharacter", "arrow", "other", "modifier", "click", "pointer"]);
|
|
495
500
|
const predicatesByType = {
|
|
496
501
|
singleCharacter: (name) => typeREs["singleCharacter"].test(name),
|
|
497
502
|
arrow: (name) => typeREs["arrow"].test(name),
|
|
@@ -587,6 +592,10 @@ function isString(value) {
|
|
|
587
592
|
}
|
|
588
593
|
|
|
589
594
|
class Recognizeable {
|
|
595
|
+
maxSequenceLength;
|
|
596
|
+
effects;
|
|
597
|
+
effectApi;
|
|
598
|
+
toType;
|
|
590
599
|
constructor(sequence, options = { effectsIncludeCombos: true }) {
|
|
591
600
|
const defaultOptions = {
|
|
592
601
|
maxSequenceLength: true,
|
|
@@ -610,6 +619,7 @@ class Recognizeable {
|
|
|
610
619
|
};
|
|
611
620
|
this.ready();
|
|
612
621
|
}
|
|
622
|
+
computedMetadata;
|
|
613
623
|
resetComputedMetadata() {
|
|
614
624
|
this.computedMetadata = {};
|
|
615
625
|
}
|
|
@@ -619,6 +629,7 @@ class Recognizeable {
|
|
|
619
629
|
denied() {
|
|
620
630
|
this.computedStatus = "denied";
|
|
621
631
|
}
|
|
632
|
+
computedStatus;
|
|
622
633
|
ready() {
|
|
623
634
|
this.computedStatus = "ready";
|
|
624
635
|
}
|
|
@@ -634,6 +645,7 @@ class Recognizeable {
|
|
|
634
645
|
get metadata() {
|
|
635
646
|
return this.computedMetadata;
|
|
636
647
|
}
|
|
648
|
+
computedSequence;
|
|
637
649
|
setSequence(sequence) {
|
|
638
650
|
this.computedSequence = sequence;
|
|
639
651
|
return this;
|
|
@@ -737,9 +749,12 @@ function createToType({
|
|
|
737
749
|
}
|
|
738
750
|
};
|
|
739
751
|
}
|
|
740
|
-
const leftclickcomboEventTypes = new Set(["click", "mousedown", "mouseup", "dblclick"]), rightclickComboEventTypes = new Set(["contextmenu"]), keycomboEventTypes = new Set(["keydown", "keyup"]), toJoinedClickcombo = lazyCollections.join("+"), toJoinedKeycombo = lazyCollections.pipe(lazyCollections.map(({ name }) => name), toJoinedClickcombo);
|
|
752
|
+
const leftclickcomboEventTypes = /* @__PURE__ */ new Set(["click", "mousedown", "mouseup", "dblclick"]), rightclickComboEventTypes = /* @__PURE__ */ new Set(["contextmenu"]), keycomboEventTypes = /* @__PURE__ */ new Set(["keydown", "keyup"]), toJoinedClickcombo = lazyCollections.join("+"), toJoinedKeycombo = lazyCollections.pipe(lazyCollections.map(({ name }) => name), toJoinedClickcombo);
|
|
741
753
|
|
|
742
754
|
class Listenable {
|
|
755
|
+
computedRecognizeable;
|
|
756
|
+
recognizeableEffectsKeys;
|
|
757
|
+
computedActive;
|
|
743
758
|
constructor(type, options) {
|
|
744
759
|
if (type === "recognizeable") {
|
|
745
760
|
const recognizeableOptions = {
|
|
@@ -752,10 +767,11 @@ class Listenable {
|
|
|
752
767
|
this.computedRecognizeable = new Recognizeable([], recognizeableOptions);
|
|
753
768
|
this.recognizeableEffectsKeys = Object.keys(recognizeableOptions.effects);
|
|
754
769
|
}
|
|
755
|
-
this.computedActive = new Set();
|
|
770
|
+
this.computedActive = /* @__PURE__ */ new Set();
|
|
756
771
|
this.setType(type);
|
|
757
772
|
this.ready();
|
|
758
773
|
}
|
|
774
|
+
computedStatus;
|
|
759
775
|
ready() {
|
|
760
776
|
this.computedStatus = "ready";
|
|
761
777
|
}
|
|
@@ -774,6 +790,8 @@ class Listenable {
|
|
|
774
790
|
get recognizeable() {
|
|
775
791
|
return this.computedRecognizeable;
|
|
776
792
|
}
|
|
793
|
+
computedType;
|
|
794
|
+
implementation;
|
|
777
795
|
setType(type) {
|
|
778
796
|
this.stop();
|
|
779
797
|
this.computedType = type;
|
|
@@ -966,7 +984,7 @@ function stop(stoppable) {
|
|
|
966
984
|
function toImplementation(type) {
|
|
967
985
|
return lazyCollections.find((implementation) => predicatesByImplementation.get(implementation)(type))(predicatesByImplementation.keys());
|
|
968
986
|
}
|
|
969
|
-
const predicatesByImplementation = new Map([
|
|
987
|
+
const predicatesByImplementation = /* @__PURE__ */ new Map([
|
|
970
988
|
[
|
|
971
989
|
"recognizeable",
|
|
972
990
|
(type) => type === "recognizeable"
|
|
@@ -1016,7 +1034,7 @@ const predicatesByImplementation = new Map([
|
|
|
1016
1034
|
() => true
|
|
1017
1035
|
]
|
|
1018
1036
|
]);
|
|
1019
|
-
const documentEvents = new Set([
|
|
1037
|
+
const documentEvents = /* @__PURE__ */ new Set([
|
|
1020
1038
|
"fullscreenchange",
|
|
1021
1039
|
"fullscreenerror",
|
|
1022
1040
|
"pointerlockchange",
|
|
@@ -1039,6 +1057,11 @@ function eventMatchesKeycombo({ event, keycombo }) {
|
|
|
1039
1057
|
return lazyCollections.every(({ name, type }, index) => {
|
|
1040
1058
|
switch (type) {
|
|
1041
1059
|
case "singleCharacter":
|
|
1060
|
+
if (name === "!") {
|
|
1061
|
+
return event.key === "!";
|
|
1062
|
+
}
|
|
1063
|
+
const keyToTest = event.altKey && fromComboItemNameToType(event.key) === "custom" ? fromCodeToSingleCharacter(event.code) : event.key.toLowerCase();
|
|
1064
|
+
return name.startsWith("!") ? keyToTest !== toKey(name.slice(1)).toLowerCase() : keyToTest === toKey(name).toLowerCase();
|
|
1042
1065
|
case "other":
|
|
1043
1066
|
if (name === "!") {
|
|
1044
1067
|
return event.key === "!";
|
|
@@ -1054,7 +1077,34 @@ function eventMatchesKeycombo({ event, keycombo }) {
|
|
|
1054
1077
|
}
|
|
1055
1078
|
})(keycombo);
|
|
1056
1079
|
}
|
|
1057
|
-
|
|
1080
|
+
function fromCodeToSingleCharacter(code) {
|
|
1081
|
+
for (const c in aliasesByCode) {
|
|
1082
|
+
if (c === code) {
|
|
1083
|
+
return aliasesByCode[c];
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
for (const prefix of ["Key", "Digit"]) {
|
|
1087
|
+
const re = new RegExp(`^${prefix}`);
|
|
1088
|
+
if (re.test(code)) {
|
|
1089
|
+
return createClip(re)(code).toLowerCase();
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
return code;
|
|
1093
|
+
}
|
|
1094
|
+
const aliasesByCode = {
|
|
1095
|
+
"Backquote": "`",
|
|
1096
|
+
"Minus": "-",
|
|
1097
|
+
"Equal": "=",
|
|
1098
|
+
"BracketLeft": "[",
|
|
1099
|
+
"BracketRight": "]",
|
|
1100
|
+
"Backslash": "\\",
|
|
1101
|
+
"Semicolon": ";",
|
|
1102
|
+
"Quote": "'",
|
|
1103
|
+
"Comma": ",",
|
|
1104
|
+
"Period": ".",
|
|
1105
|
+
"Slash": "/"
|
|
1106
|
+
};
|
|
1107
|
+
const predicatesByArrow = /* @__PURE__ */ new Map([
|
|
1058
1108
|
[
|
|
1059
1109
|
"arrow",
|
|
1060
1110
|
({ event }) => arrows.has(event.key.toLowerCase())
|
|
@@ -1084,9 +1134,9 @@ const predicatesByArrow = new Map([
|
|
|
1084
1134
|
({ event, name }) => name.startsWith("!") ? event.key.toLowerCase() !== `arrow${name.toLowerCase()}` : event.key.toLowerCase() === `arrow${name.toLowerCase()}`
|
|
1085
1135
|
]
|
|
1086
1136
|
]);
|
|
1087
|
-
const arrows = new Set(["arrowup", "arrowright", "arrowdown", "arrowleft"]);
|
|
1088
|
-
const verticalArrows = new Set(["arrowup", "arrowdown"]);
|
|
1089
|
-
const horizontalArrows = new Set(["arrowright", "arrowleft"]);
|
|
1137
|
+
const arrows = /* @__PURE__ */ new Set(["arrowup", "arrowright", "arrowdown", "arrowleft"]);
|
|
1138
|
+
const verticalArrows = /* @__PURE__ */ new Set(["arrowup", "arrowdown"]);
|
|
1139
|
+
const horizontalArrows = /* @__PURE__ */ new Set(["arrowright", "arrowleft"]);
|
|
1090
1140
|
function eventMatchesClickcombo({ event, clickcombo }) {
|
|
1091
1141
|
return lazyCollections.every((name) => fromComboItemNameToType(name) === "click" || name.startsWith("!") && !isModified({ alias: name.slice(1), event }) || !name.startsWith("!") && isModified({ alias: name, event }))(clickcombo);
|
|
1092
1142
|
}
|
|
@@ -1111,6 +1161,21 @@ const defaultOptions$6 = {
|
|
|
1111
1161
|
alternates: false
|
|
1112
1162
|
};
|
|
1113
1163
|
class Animateable {
|
|
1164
|
+
initialDuration;
|
|
1165
|
+
iterationLimit;
|
|
1166
|
+
alternates;
|
|
1167
|
+
controlPoints;
|
|
1168
|
+
reversedControlPoints;
|
|
1169
|
+
toAnimationProgress;
|
|
1170
|
+
reversedToAnimationProgress;
|
|
1171
|
+
playCache;
|
|
1172
|
+
reverseCache;
|
|
1173
|
+
pauseCache;
|
|
1174
|
+
seekCache;
|
|
1175
|
+
alternateCache;
|
|
1176
|
+
visibilitychange;
|
|
1177
|
+
getEaseables;
|
|
1178
|
+
getReversedEaseables;
|
|
1114
1179
|
constructor(keyframes, options = {}) {
|
|
1115
1180
|
this.initialDuration = options?.duration || defaultOptions$6.duration;
|
|
1116
1181
|
this.controlPoints = fromTimingToControlPoints(options?.timing || defaultOptions$6.timing);
|
|
@@ -1134,21 +1199,25 @@ class Animateable {
|
|
|
1134
1199
|
this.resetProgress();
|
|
1135
1200
|
this.resetIterations();
|
|
1136
1201
|
}
|
|
1202
|
+
computedStatus;
|
|
1137
1203
|
ready() {
|
|
1138
1204
|
this.computedStatus = "ready";
|
|
1139
1205
|
}
|
|
1206
|
+
computedTime;
|
|
1140
1207
|
resetTime() {
|
|
1141
1208
|
this.computedTime = {
|
|
1142
1209
|
elapsed: 0,
|
|
1143
1210
|
remaining: this.duration
|
|
1144
1211
|
};
|
|
1145
1212
|
}
|
|
1213
|
+
computedProgress;
|
|
1146
1214
|
resetProgress() {
|
|
1147
1215
|
this.computedProgress = {
|
|
1148
1216
|
time: 0,
|
|
1149
1217
|
animation: 0
|
|
1150
1218
|
};
|
|
1151
1219
|
}
|
|
1220
|
+
computedIterations;
|
|
1152
1221
|
resetIterations() {
|
|
1153
1222
|
this.computedIterations = 0;
|
|
1154
1223
|
}
|
|
@@ -1179,6 +1248,11 @@ class Animateable {
|
|
|
1179
1248
|
get progress() {
|
|
1180
1249
|
return this.computedProgress;
|
|
1181
1250
|
}
|
|
1251
|
+
computedKeyframes;
|
|
1252
|
+
reversedKeyframes;
|
|
1253
|
+
properties;
|
|
1254
|
+
easeables;
|
|
1255
|
+
reversedEaseables;
|
|
1182
1256
|
setKeyframes(keyframes) {
|
|
1183
1257
|
this.stop();
|
|
1184
1258
|
this.computedKeyframes = Array.from(keyframes).sort(({ progress: progressA }, { progress: progressB }) => progressA - progressB);
|
|
@@ -1188,6 +1262,9 @@ class Animateable {
|
|
|
1188
1262
|
this.reversedEaseables = this.getReversedEaseables({ keyframes: this.reversedKeyframes, properties: this.properties });
|
|
1189
1263
|
return this;
|
|
1190
1264
|
}
|
|
1265
|
+
computedPlaybackRate;
|
|
1266
|
+
duration;
|
|
1267
|
+
totalTimeInvisible;
|
|
1191
1268
|
setPlaybackRate(playbackRate) {
|
|
1192
1269
|
const ensuredPlaybackRate = Math.max(0, playbackRate);
|
|
1193
1270
|
this.computedPlaybackRate = ensuredPlaybackRate;
|
|
@@ -1333,6 +1410,7 @@ class Animateable {
|
|
|
1333
1410
|
reversed() {
|
|
1334
1411
|
this.computedStatus = "reversed";
|
|
1335
1412
|
}
|
|
1413
|
+
invisibleAt;
|
|
1336
1414
|
listenForVisibilitychange() {
|
|
1337
1415
|
if (this.visibilitychange.active.size === 0) {
|
|
1338
1416
|
this.totalTimeInvisible = 0;
|
|
@@ -1348,6 +1426,7 @@ class Animateable {
|
|
|
1348
1426
|
});
|
|
1349
1427
|
}
|
|
1350
1428
|
}
|
|
1429
|
+
computedRequest;
|
|
1351
1430
|
createAnimate(type) {
|
|
1352
1431
|
return (effect, options = {}) => {
|
|
1353
1432
|
const { interpolate: interpolateOptions } = options;
|
|
@@ -1368,6 +1447,7 @@ class Animateable {
|
|
|
1368
1447
|
return this;
|
|
1369
1448
|
};
|
|
1370
1449
|
}
|
|
1450
|
+
startTime;
|
|
1371
1451
|
setStartTimeAndStatus(type, timestamp) {
|
|
1372
1452
|
switch (type) {
|
|
1373
1453
|
case "play":
|
|
@@ -1734,7 +1814,7 @@ function createGetEaseables(fromKeyframeToControlPoints) {
|
|
|
1734
1814
|
};
|
|
1735
1815
|
}
|
|
1736
1816
|
function toProperties(keyframes) {
|
|
1737
|
-
const properties = new Set();
|
|
1817
|
+
const properties = /* @__PURE__ */ new Set();
|
|
1738
1818
|
for (const keyframe of keyframes) {
|
|
1739
1819
|
for (const property in keyframe.properties) {
|
|
1740
1820
|
if (!properties.has(property)) {
|
|
@@ -1759,7 +1839,7 @@ function fromControlPointsToReversedControlPoints(points) {
|
|
|
1759
1839
|
}
|
|
1760
1840
|
function createToAnimationProgress(points) {
|
|
1761
1841
|
const { 0: { x: point1x, y: point1y }, 1: { x: point2x, y: point2y } } = points;
|
|
1762
|
-
return BezierEasing__default[
|
|
1842
|
+
return BezierEasing__default["default"](point1x, point1y, point2x, point2y);
|
|
1763
1843
|
}
|
|
1764
1844
|
function toInterpolated({ previous, next, progress }, options = {}) {
|
|
1765
1845
|
if (isUndefined(previous)) {
|
|
@@ -1972,6 +2052,10 @@ const defaultCompleteOptions = {
|
|
|
1972
2052
|
select: "completionEnd"
|
|
1973
2053
|
};
|
|
1974
2054
|
class Completeable {
|
|
2055
|
+
segmentFrom;
|
|
2056
|
+
segmentTo;
|
|
2057
|
+
divider;
|
|
2058
|
+
computedDividerIndices;
|
|
1975
2059
|
constructor(string, options = {}) {
|
|
1976
2060
|
this.constructing();
|
|
1977
2061
|
this.segmentFrom = options?.segment?.from || defaultOptions$5.segment.from;
|
|
@@ -1985,6 +2069,7 @@ class Completeable {
|
|
|
1985
2069
|
constructing() {
|
|
1986
2070
|
this.computedStatus = "constructing";
|
|
1987
2071
|
}
|
|
2072
|
+
computedStatus;
|
|
1988
2073
|
ready() {
|
|
1989
2074
|
this.computedStatus = "ready";
|
|
1990
2075
|
}
|
|
@@ -2029,6 +2114,7 @@ class Completeable {
|
|
|
2029
2114
|
return this.dividerIndices.after;
|
|
2030
2115
|
}
|
|
2031
2116
|
}
|
|
2117
|
+
computedString;
|
|
2032
2118
|
setString(string) {
|
|
2033
2119
|
this.computedString = string;
|
|
2034
2120
|
switch (this.status) {
|
|
@@ -2040,6 +2126,7 @@ class Completeable {
|
|
|
2040
2126
|
}
|
|
2041
2127
|
return this;
|
|
2042
2128
|
}
|
|
2129
|
+
computedSelection;
|
|
2043
2130
|
setSelection(selection) {
|
|
2044
2131
|
this.computedSelection = selection;
|
|
2045
2132
|
this.setDividerIndices();
|
|
@@ -2126,6 +2213,10 @@ function toNextMatch({ string, re, from }) {
|
|
|
2126
2213
|
}
|
|
2127
2214
|
|
|
2128
2215
|
class Copyable {
|
|
2216
|
+
computedIsClipboardText;
|
|
2217
|
+
copyListenable;
|
|
2218
|
+
cutListenable;
|
|
2219
|
+
copyAndCutEffect;
|
|
2129
2220
|
constructor(string, options = {}) {
|
|
2130
2221
|
this.computedIsClipboardText = false;
|
|
2131
2222
|
this.copyListenable = new Listenable("copy");
|
|
@@ -2137,6 +2228,7 @@ class Copyable {
|
|
|
2137
2228
|
this.setString(string);
|
|
2138
2229
|
this.ready();
|
|
2139
2230
|
}
|
|
2231
|
+
computedStatus;
|
|
2140
2232
|
ready() {
|
|
2141
2233
|
this.computedStatus = "ready";
|
|
2142
2234
|
}
|
|
@@ -2158,10 +2250,13 @@ class Copyable {
|
|
|
2158
2250
|
get error() {
|
|
2159
2251
|
return this.computedError;
|
|
2160
2252
|
}
|
|
2253
|
+
computedString;
|
|
2161
2254
|
setString(string) {
|
|
2162
2255
|
this.computedString = string;
|
|
2163
2256
|
return this;
|
|
2164
2257
|
}
|
|
2258
|
+
computedResponse;
|
|
2259
|
+
computedError;
|
|
2165
2260
|
async copy(options = { type: "clipboard" }) {
|
|
2166
2261
|
this.copying();
|
|
2167
2262
|
const { type } = options;
|
|
@@ -2214,6 +2309,7 @@ const defaultOptions$4 = {
|
|
|
2214
2309
|
executions: 1
|
|
2215
2310
|
};
|
|
2216
2311
|
class Delayable {
|
|
2312
|
+
animateable;
|
|
2217
2313
|
constructor(effect, options = {}) {
|
|
2218
2314
|
this.animateable = new Animateable([
|
|
2219
2315
|
{ progress: 0, properties: { progress: 0 } },
|
|
@@ -2225,6 +2321,7 @@ class Delayable {
|
|
|
2225
2321
|
this.setEffect(effect);
|
|
2226
2322
|
this.ready();
|
|
2227
2323
|
}
|
|
2324
|
+
computedStatus;
|
|
2228
2325
|
ready() {
|
|
2229
2326
|
this.computedStatus = "ready";
|
|
2230
2327
|
}
|
|
@@ -2246,12 +2343,14 @@ class Delayable {
|
|
|
2246
2343
|
get progress() {
|
|
2247
2344
|
return this.animateable.progress.time;
|
|
2248
2345
|
}
|
|
2346
|
+
computedEffect;
|
|
2249
2347
|
setEffect(effect) {
|
|
2250
2348
|
this.stop();
|
|
2251
2349
|
this.computedEffect = effect;
|
|
2252
2350
|
this.setFrameEffect(effect);
|
|
2253
2351
|
return this;
|
|
2254
2352
|
}
|
|
2353
|
+
frameEffect;
|
|
2255
2354
|
setFrameEffect(effect) {
|
|
2256
2355
|
this.frameEffect = (frame) => {
|
|
2257
2356
|
const { properties: { progress }, timestamp } = frame;
|
|
@@ -2354,6 +2453,7 @@ class Dispatchable {
|
|
|
2354
2453
|
this.setType(type);
|
|
2355
2454
|
this.ready();
|
|
2356
2455
|
}
|
|
2456
|
+
computedStatus;
|
|
2357
2457
|
ready() {
|
|
2358
2458
|
this.computedStatus = "ready";
|
|
2359
2459
|
}
|
|
@@ -2369,10 +2469,12 @@ class Dispatchable {
|
|
|
2369
2469
|
get status() {
|
|
2370
2470
|
return this.computedStatus;
|
|
2371
2471
|
}
|
|
2472
|
+
computedType;
|
|
2372
2473
|
setType(type) {
|
|
2373
2474
|
this.computedType = type;
|
|
2374
2475
|
return this;
|
|
2375
2476
|
}
|
|
2477
|
+
computedCancelled;
|
|
2376
2478
|
dispatch(options = {}) {
|
|
2377
2479
|
const { target = window, ...rest } = options, event = toEvent(this.type, rest);
|
|
2378
2480
|
this.computedCancelled = !target.dispatchEvent(event);
|
|
@@ -2388,11 +2490,14 @@ const defaultOptions$3 = {
|
|
|
2388
2490
|
toD: (stroke) => stroke.length === 0 ? "" : toD(stroke)
|
|
2389
2491
|
};
|
|
2390
2492
|
class Drawable {
|
|
2493
|
+
computedD;
|
|
2494
|
+
toD;
|
|
2391
2495
|
constructor(stroke, options = {}) {
|
|
2392
2496
|
this.toD = options?.toD || defaultOptions$3.toD;
|
|
2393
2497
|
this.setStroke(stroke);
|
|
2394
2498
|
this.ready();
|
|
2395
2499
|
}
|
|
2500
|
+
computedStatus;
|
|
2396
2501
|
ready() {
|
|
2397
2502
|
this.computedStatus = "ready";
|
|
2398
2503
|
}
|
|
@@ -2408,6 +2513,7 @@ class Drawable {
|
|
|
2408
2513
|
get d() {
|
|
2409
2514
|
return this.computedD;
|
|
2410
2515
|
}
|
|
2516
|
+
computedStroke;
|
|
2411
2517
|
setStroke(stroke) {
|
|
2412
2518
|
this.computedStroke = stroke;
|
|
2413
2519
|
this.computedD = this.toD(stroke);
|
|
@@ -2436,7 +2542,7 @@ function toFlattenedD(stroke) {
|
|
|
2436
2542
|
if (stroke.length === 0) {
|
|
2437
2543
|
return "";
|
|
2438
2544
|
}
|
|
2439
|
-
const multiPolygon = polygonClipping__default[
|
|
2545
|
+
const multiPolygon = polygonClipping__default["default"].union([stroke]);
|
|
2440
2546
|
return createReduce((dFromMultiPolygon, polygon) => {
|
|
2441
2547
|
return dFromMultiPolygon + createReduce((dFromRing, points) => {
|
|
2442
2548
|
return dFromRing + toD(points);
|
|
@@ -2449,6 +2555,7 @@ class Resolveable {
|
|
|
2449
2555
|
this.setGetPromise(getPromise);
|
|
2450
2556
|
this.ready();
|
|
2451
2557
|
}
|
|
2558
|
+
computedStatus;
|
|
2452
2559
|
ready() {
|
|
2453
2560
|
this.computedStatus = "ready";
|
|
2454
2561
|
}
|
|
@@ -2464,10 +2571,12 @@ class Resolveable {
|
|
|
2464
2571
|
get value() {
|
|
2465
2572
|
return this.computedValue;
|
|
2466
2573
|
}
|
|
2574
|
+
computedGetPromise;
|
|
2467
2575
|
setGetPromise(getPromise) {
|
|
2468
2576
|
this.computedGetPromise = getPromise;
|
|
2469
2577
|
return this;
|
|
2470
2578
|
}
|
|
2579
|
+
computedValue;
|
|
2471
2580
|
async resolve(...args) {
|
|
2472
2581
|
this.resolving();
|
|
2473
2582
|
try {
|
|
@@ -2492,6 +2601,11 @@ class Resolveable {
|
|
|
2492
2601
|
}
|
|
2493
2602
|
|
|
2494
2603
|
class Fetchable {
|
|
2604
|
+
computedArrayBuffer;
|
|
2605
|
+
computedBlob;
|
|
2606
|
+
computedFormData;
|
|
2607
|
+
computedJson;
|
|
2608
|
+
computedText;
|
|
2495
2609
|
constructor(resource, options = {}) {
|
|
2496
2610
|
this.setResource(resource);
|
|
2497
2611
|
this.computedArrayBuffer = new Resolveable(async () => "arrayBuffer" in this.response ? await this.response.arrayBuffer() : await void 0);
|
|
@@ -2501,6 +2615,7 @@ class Fetchable {
|
|
|
2501
2615
|
this.computedText = new Resolveable(async () => "text" in this.response ? await this.response.text() : await void 0);
|
|
2502
2616
|
this.ready();
|
|
2503
2617
|
}
|
|
2618
|
+
computedStatus;
|
|
2504
2619
|
ready() {
|
|
2505
2620
|
this.computedStatus = "ready";
|
|
2506
2621
|
}
|
|
@@ -2510,6 +2625,7 @@ class Fetchable {
|
|
|
2510
2625
|
set resource(resource) {
|
|
2511
2626
|
this.setResource(resource);
|
|
2512
2627
|
}
|
|
2628
|
+
computedAbortController;
|
|
2513
2629
|
get abortController() {
|
|
2514
2630
|
if (!this.computedAbortController) {
|
|
2515
2631
|
this.computedAbortController = new AbortController();
|
|
@@ -2555,10 +2671,13 @@ class Fetchable {
|
|
|
2555
2671
|
return resolveable;
|
|
2556
2672
|
}
|
|
2557
2673
|
}
|
|
2674
|
+
computedResource;
|
|
2558
2675
|
setResource(resource) {
|
|
2559
2676
|
this.computedResource = resource;
|
|
2560
2677
|
return this;
|
|
2561
2678
|
}
|
|
2679
|
+
computedResponse;
|
|
2680
|
+
computedError;
|
|
2562
2681
|
async fetch(options = {}) {
|
|
2563
2682
|
this.computedStatus = "fetching";
|
|
2564
2683
|
try {
|
|
@@ -2613,6 +2732,7 @@ class Fullscreenable {
|
|
|
2613
2732
|
this.setGetElement(getElement);
|
|
2614
2733
|
this.ready();
|
|
2615
2734
|
}
|
|
2735
|
+
computedStatus;
|
|
2616
2736
|
ready() {
|
|
2617
2737
|
this.computedStatus = "ready";
|
|
2618
2738
|
}
|
|
@@ -2631,6 +2751,7 @@ class Fullscreenable {
|
|
|
2631
2751
|
get error() {
|
|
2632
2752
|
return this.computedError;
|
|
2633
2753
|
}
|
|
2754
|
+
computedGetElement;
|
|
2634
2755
|
setGetElement(getElement) {
|
|
2635
2756
|
this.computedGetElement = () => getElement();
|
|
2636
2757
|
return this;
|
|
@@ -2639,6 +2760,7 @@ class Fullscreenable {
|
|
|
2639
2760
|
await this.fullscreen(options);
|
|
2640
2761
|
return this;
|
|
2641
2762
|
}
|
|
2763
|
+
computedError;
|
|
2642
2764
|
async fullscreen(options = {}) {
|
|
2643
2765
|
try {
|
|
2644
2766
|
await this.element.requestFullscreen(options);
|
|
@@ -2675,6 +2797,7 @@ class Grantable {
|
|
|
2675
2797
|
this.setDescriptor(descriptor);
|
|
2676
2798
|
this.ready();
|
|
2677
2799
|
}
|
|
2800
|
+
computedStatus;
|
|
2678
2801
|
ready() {
|
|
2679
2802
|
this.computedStatus = "ready";
|
|
2680
2803
|
}
|
|
@@ -2690,10 +2813,12 @@ class Grantable {
|
|
|
2690
2813
|
get status() {
|
|
2691
2814
|
return this.computedStatus;
|
|
2692
2815
|
}
|
|
2816
|
+
computedDescriptor;
|
|
2693
2817
|
setDescriptor(descriptor) {
|
|
2694
2818
|
this.computedDescriptor = descriptor;
|
|
2695
2819
|
return this;
|
|
2696
2820
|
}
|
|
2821
|
+
computedPermission;
|
|
2697
2822
|
async query() {
|
|
2698
2823
|
this.querying();
|
|
2699
2824
|
try {
|
|
@@ -2730,15 +2855,18 @@ class Navigateable {
|
|
|
2730
2855
|
this.navigate(options?.initialLocation ?? defaultOptions$2.initialLocation);
|
|
2731
2856
|
this.ready();
|
|
2732
2857
|
}
|
|
2858
|
+
computedStatus;
|
|
2733
2859
|
ready() {
|
|
2734
2860
|
this.computedStatus = "ready";
|
|
2735
2861
|
}
|
|
2862
|
+
computedArray;
|
|
2736
2863
|
get array() {
|
|
2737
2864
|
return this.computedArray;
|
|
2738
2865
|
}
|
|
2739
2866
|
set array(value) {
|
|
2740
2867
|
this.setArray(value);
|
|
2741
2868
|
}
|
|
2869
|
+
computedLocation;
|
|
2742
2870
|
get location() {
|
|
2743
2871
|
return this.computedLocation;
|
|
2744
2872
|
}
|
|
@@ -2784,10 +2912,7 @@ class Navigateable {
|
|
|
2784
2912
|
this.computedLocation = ensuredLocation;
|
|
2785
2913
|
}
|
|
2786
2914
|
next(options = {}) {
|
|
2787
|
-
const { distance, loops
|
|
2788
|
-
if (allow === "any") {
|
|
2789
|
-
return this.location + distance;
|
|
2790
|
-
}
|
|
2915
|
+
const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
|
|
2791
2916
|
const lastLocation = this.array.length - 1;
|
|
2792
2917
|
if (this.location + distance <= lastLocation) {
|
|
2793
2918
|
return this.location + distance;
|
|
@@ -2803,7 +2928,7 @@ class Navigateable {
|
|
|
2803
2928
|
return newLocation2;
|
|
2804
2929
|
})();
|
|
2805
2930
|
})();
|
|
2806
|
-
this._navigate(newLocation
|
|
2931
|
+
this._navigate(newLocation);
|
|
2807
2932
|
this.nexted();
|
|
2808
2933
|
return this;
|
|
2809
2934
|
}
|
|
@@ -2811,10 +2936,7 @@ class Navigateable {
|
|
|
2811
2936
|
this.computedStatus = "navigated to next";
|
|
2812
2937
|
}
|
|
2813
2938
|
previous(options = {}) {
|
|
2814
|
-
const { distance, loops
|
|
2815
|
-
if (allow === "any") {
|
|
2816
|
-
return this.location - distance;
|
|
2817
|
-
}
|
|
2939
|
+
const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
|
|
2818
2940
|
if (this.location - distance >= 0) {
|
|
2819
2941
|
return this.location - distance;
|
|
2820
2942
|
}
|
|
@@ -2829,7 +2951,7 @@ class Navigateable {
|
|
|
2829
2951
|
return newLocation2;
|
|
2830
2952
|
})();
|
|
2831
2953
|
})();
|
|
2832
|
-
this._navigate(newLocation
|
|
2954
|
+
this._navigate(newLocation);
|
|
2833
2955
|
this.previoused();
|
|
2834
2956
|
return this;
|
|
2835
2957
|
}
|
|
@@ -2868,29 +2990,33 @@ const defaultOptions$1 = {
|
|
|
2868
2990
|
};
|
|
2869
2991
|
class Pickable {
|
|
2870
2992
|
constructor(array, options = {}) {
|
|
2871
|
-
this.toItems = createMap((index) => this.array[index]);
|
|
2872
2993
|
this.setArray(array);
|
|
2873
2994
|
this.pick(options.initialPicks ?? defaultOptions$1.initialPicks);
|
|
2874
2995
|
this.ready();
|
|
2875
2996
|
}
|
|
2997
|
+
computedStatus;
|
|
2876
2998
|
ready() {
|
|
2877
2999
|
this.computedStatus = "ready";
|
|
2878
3000
|
}
|
|
3001
|
+
computedArray;
|
|
2879
3002
|
get array() {
|
|
2880
3003
|
return this.computedArray;
|
|
2881
3004
|
}
|
|
2882
3005
|
set array(array) {
|
|
2883
3006
|
this.setArray(array);
|
|
2884
3007
|
}
|
|
3008
|
+
computedPicks;
|
|
2885
3009
|
get picks() {
|
|
2886
3010
|
return this.computedPicks;
|
|
2887
3011
|
}
|
|
2888
3012
|
set picks(indices) {
|
|
2889
3013
|
this.pick(indices);
|
|
2890
3014
|
}
|
|
3015
|
+
computedFirst;
|
|
2891
3016
|
get first() {
|
|
2892
3017
|
return this.computedFirst;
|
|
2893
3018
|
}
|
|
3019
|
+
computedLast;
|
|
2894
3020
|
get last() {
|
|
2895
3021
|
return this.computedLast;
|
|
2896
3022
|
}
|
|
@@ -2906,9 +3032,11 @@ class Pickable {
|
|
|
2906
3032
|
get items() {
|
|
2907
3033
|
return this.toItems(this.picks);
|
|
2908
3034
|
}
|
|
3035
|
+
toItems = createMap((index) => this.array[index]);
|
|
2909
3036
|
get multiple() {
|
|
2910
3037
|
return this.picks.length > 1;
|
|
2911
3038
|
}
|
|
3039
|
+
toPossiblePicks;
|
|
2912
3040
|
setArray(array) {
|
|
2913
3041
|
this.computedArray = array;
|
|
2914
3042
|
this.toPossiblePicks = createFilter((index) => index >= 0 && index < array.length);
|
|
@@ -2923,7 +3051,7 @@ class Pickable {
|
|
|
2923
3051
|
if (replace === "all") {
|
|
2924
3052
|
return toUnique(possiblePicks);
|
|
2925
3053
|
}
|
|
2926
|
-
const possibleWithoutDuplicates = createFilter((possiblePick) =>
|
|
3054
|
+
const possibleWithoutDuplicates = createFilter((possiblePick) => typeof lazyCollections.find((pick) => pick === possiblePick)(this.picks || []) !== "number")(possiblePicks);
|
|
2927
3055
|
switch (replace) {
|
|
2928
3056
|
case "none":
|
|
2929
3057
|
return createConcat(this.picks || [], possibleWithoutDuplicates)([]);
|
|
@@ -2984,14 +3112,17 @@ function ensureIndices(indexOrIndices) {
|
|
|
2984
3112
|
const toUnique = createUnique();
|
|
2985
3113
|
|
|
2986
3114
|
class Sanitizeable {
|
|
3115
|
+
domPurifyConfig;
|
|
2987
3116
|
constructor(html, options) {
|
|
2988
3117
|
this.computedHtml = html;
|
|
2989
3118
|
this.domPurifyConfig = options;
|
|
2990
3119
|
this.ready();
|
|
2991
3120
|
}
|
|
3121
|
+
computedDompurify;
|
|
3122
|
+
computedStatus;
|
|
2992
3123
|
ready() {
|
|
2993
3124
|
if (domIsAvailable()) {
|
|
2994
|
-
this.computedDompurify = createDOMPurify__default[
|
|
3125
|
+
this.computedDompurify = createDOMPurify__default["default"]();
|
|
2995
3126
|
this.computedDompurify.setConfig(this.domPurifyConfig);
|
|
2996
3127
|
}
|
|
2997
3128
|
this.computedStatus = "ready";
|
|
@@ -3004,7 +3135,7 @@ class Sanitizeable {
|
|
|
3004
3135
|
}
|
|
3005
3136
|
get dompurify() {
|
|
3006
3137
|
if (!this.computedDompurify && domIsAvailable()) {
|
|
3007
|
-
this.computedDompurify = createDOMPurify__default[
|
|
3138
|
+
this.computedDompurify = createDOMPurify__default["default"]();
|
|
3008
3139
|
this.computedDompurify.setConfig(this.domPurifyConfig);
|
|
3009
3140
|
}
|
|
3010
3141
|
return this.computedDompurify;
|
|
@@ -3012,6 +3143,7 @@ class Sanitizeable {
|
|
|
3012
3143
|
get status() {
|
|
3013
3144
|
return this.computedStatus;
|
|
3014
3145
|
}
|
|
3146
|
+
computedHtml;
|
|
3015
3147
|
setHtml(html) {
|
|
3016
3148
|
this.computedHtml = html;
|
|
3017
3149
|
return this;
|
|
@@ -3027,15 +3159,19 @@ class Sanitizeable {
|
|
|
3027
3159
|
}
|
|
3028
3160
|
|
|
3029
3161
|
class Searchable {
|
|
3162
|
+
searcherOptions;
|
|
3163
|
+
computedResults;
|
|
3030
3164
|
constructor(candidates, options = {}) {
|
|
3031
3165
|
this.searcherOptions = options;
|
|
3032
3166
|
this.setCandidates(candidates);
|
|
3033
3167
|
this.computedResults = [];
|
|
3034
3168
|
this.ready();
|
|
3035
3169
|
}
|
|
3170
|
+
computedStatus;
|
|
3036
3171
|
ready() {
|
|
3037
3172
|
this.computedStatus = "ready";
|
|
3038
3173
|
}
|
|
3174
|
+
computedCandidates;
|
|
3039
3175
|
get candidates() {
|
|
3040
3176
|
return this.computedCandidates;
|
|
3041
3177
|
}
|
|
@@ -3051,6 +3187,7 @@ class Searchable {
|
|
|
3051
3187
|
get status() {
|
|
3052
3188
|
return this.computedStatus;
|
|
3053
3189
|
}
|
|
3190
|
+
computedSearcher;
|
|
3054
3191
|
setCandidates(candidates) {
|
|
3055
3192
|
this.computedCandidates = Array.from(candidates);
|
|
3056
3193
|
this.computedSearcher = new fastFuzzy.Searcher(candidates, this.searcherOptions);
|
|
@@ -3071,6 +3208,8 @@ const defaultOptions = {
|
|
|
3071
3208
|
statusKeySuffix: " status"
|
|
3072
3209
|
};
|
|
3073
3210
|
class Storeable {
|
|
3211
|
+
type;
|
|
3212
|
+
statusKeySuffix;
|
|
3074
3213
|
constructor(key, options = {}) {
|
|
3075
3214
|
this.constructing();
|
|
3076
3215
|
this.type = options.type ?? defaultOptions.type;
|
|
@@ -3081,6 +3220,7 @@ class Storeable {
|
|
|
3081
3220
|
constructing() {
|
|
3082
3221
|
this.computedStatus = "constructing";
|
|
3083
3222
|
}
|
|
3223
|
+
computedStatus;
|
|
3084
3224
|
ready() {
|
|
3085
3225
|
this.computedStatus = "ready";
|
|
3086
3226
|
if (domIsAvailable()) {
|
|
@@ -3118,6 +3258,8 @@ class Storeable {
|
|
|
3118
3258
|
get error() {
|
|
3119
3259
|
return this.computedError;
|
|
3120
3260
|
}
|
|
3261
|
+
computedKey;
|
|
3262
|
+
computedStatusKey;
|
|
3121
3263
|
setKey(key) {
|
|
3122
3264
|
let string;
|
|
3123
3265
|
switch (this.status) {
|
|
@@ -3143,6 +3285,8 @@ class Storeable {
|
|
|
3143
3285
|
}
|
|
3144
3286
|
return this;
|
|
3145
3287
|
}
|
|
3288
|
+
computedString;
|
|
3289
|
+
computedError;
|
|
3146
3290
|
store(string) {
|
|
3147
3291
|
try {
|
|
3148
3292
|
this.storage.setItem(this.key, string);
|
|
@@ -3218,6 +3362,7 @@ exports.createReverse = createReverse;
|
|
|
3218
3362
|
exports.createSlice = createSlice;
|
|
3219
3363
|
exports.createSlug = createSlug;
|
|
3220
3364
|
exports.createSwap = createSwap;
|
|
3365
|
+
exports.createToEntries = createToEntries;
|
|
3221
3366
|
exports.createUnique = createUnique;
|
|
3222
3367
|
exports.easingsNetInBack = easingsNetInBack;
|
|
3223
3368
|
exports.easingsNetInCirc = easingsNetInCirc;
|