@baleada/logic 0.20.31 → 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 +162 -21
- package/lib/index.js +157 -16
- 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,7 @@ 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
173
|
};
|
|
174
174
|
}
|
|
175
175
|
function createToEntries() {
|
|
@@ -246,8 +246,6 @@ function toEvent(eventType, options) {
|
|
|
246
246
|
return new InputEvent(eventType, options.init);
|
|
247
247
|
if (eventType === "blur")
|
|
248
248
|
return new FocusEvent(eventType, options.init);
|
|
249
|
-
if (eventType === "cancel")
|
|
250
|
-
return new Event(eventType, options.init);
|
|
251
249
|
if (eventType === "canplay")
|
|
252
250
|
return new Event(eventType, options.init);
|
|
253
251
|
if (eventType === "canplaythrough")
|
|
@@ -276,8 +274,6 @@ function toEvent(eventType, options) {
|
|
|
276
274
|
return new DragEvent(eventType, options.init);
|
|
277
275
|
if (eventType === "dragenter")
|
|
278
276
|
return new DragEvent(eventType, options.init);
|
|
279
|
-
if (eventType === "dragexit")
|
|
280
|
-
return new Event(eventType, options.init);
|
|
281
277
|
if (eventType === "dragleave")
|
|
282
278
|
return new DragEvent(eventType, options.init);
|
|
283
279
|
if (eventType === "dragover")
|
|
@@ -500,7 +496,7 @@ function toCombo(type) {
|
|
|
500
496
|
function fromComboItemNameToType(name) {
|
|
501
497
|
return lazyCollections.find((type) => predicatesByType[type](name))(listenableComboItemTypes) ?? "custom";
|
|
502
498
|
}
|
|
503
|
-
const listenableComboItemTypes = new Set(["singleCharacter", "arrow", "other", "modifier", "click", "pointer"]);
|
|
499
|
+
const listenableComboItemTypes = /* @__PURE__ */ new Set(["singleCharacter", "arrow", "other", "modifier", "click", "pointer"]);
|
|
504
500
|
const predicatesByType = {
|
|
505
501
|
singleCharacter: (name) => typeREs["singleCharacter"].test(name),
|
|
506
502
|
arrow: (name) => typeREs["arrow"].test(name),
|
|
@@ -596,6 +592,10 @@ function isString(value) {
|
|
|
596
592
|
}
|
|
597
593
|
|
|
598
594
|
class Recognizeable {
|
|
595
|
+
maxSequenceLength;
|
|
596
|
+
effects;
|
|
597
|
+
effectApi;
|
|
598
|
+
toType;
|
|
599
599
|
constructor(sequence, options = { effectsIncludeCombos: true }) {
|
|
600
600
|
const defaultOptions = {
|
|
601
601
|
maxSequenceLength: true,
|
|
@@ -619,6 +619,7 @@ class Recognizeable {
|
|
|
619
619
|
};
|
|
620
620
|
this.ready();
|
|
621
621
|
}
|
|
622
|
+
computedMetadata;
|
|
622
623
|
resetComputedMetadata() {
|
|
623
624
|
this.computedMetadata = {};
|
|
624
625
|
}
|
|
@@ -628,6 +629,7 @@ class Recognizeable {
|
|
|
628
629
|
denied() {
|
|
629
630
|
this.computedStatus = "denied";
|
|
630
631
|
}
|
|
632
|
+
computedStatus;
|
|
631
633
|
ready() {
|
|
632
634
|
this.computedStatus = "ready";
|
|
633
635
|
}
|
|
@@ -643,6 +645,7 @@ class Recognizeable {
|
|
|
643
645
|
get metadata() {
|
|
644
646
|
return this.computedMetadata;
|
|
645
647
|
}
|
|
648
|
+
computedSequence;
|
|
646
649
|
setSequence(sequence) {
|
|
647
650
|
this.computedSequence = sequence;
|
|
648
651
|
return this;
|
|
@@ -746,9 +749,12 @@ function createToType({
|
|
|
746
749
|
}
|
|
747
750
|
};
|
|
748
751
|
}
|
|
749
|
-
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);
|
|
750
753
|
|
|
751
754
|
class Listenable {
|
|
755
|
+
computedRecognizeable;
|
|
756
|
+
recognizeableEffectsKeys;
|
|
757
|
+
computedActive;
|
|
752
758
|
constructor(type, options) {
|
|
753
759
|
if (type === "recognizeable") {
|
|
754
760
|
const recognizeableOptions = {
|
|
@@ -761,10 +767,11 @@ class Listenable {
|
|
|
761
767
|
this.computedRecognizeable = new Recognizeable([], recognizeableOptions);
|
|
762
768
|
this.recognizeableEffectsKeys = Object.keys(recognizeableOptions.effects);
|
|
763
769
|
}
|
|
764
|
-
this.computedActive = new Set();
|
|
770
|
+
this.computedActive = /* @__PURE__ */ new Set();
|
|
765
771
|
this.setType(type);
|
|
766
772
|
this.ready();
|
|
767
773
|
}
|
|
774
|
+
computedStatus;
|
|
768
775
|
ready() {
|
|
769
776
|
this.computedStatus = "ready";
|
|
770
777
|
}
|
|
@@ -783,6 +790,8 @@ class Listenable {
|
|
|
783
790
|
get recognizeable() {
|
|
784
791
|
return this.computedRecognizeable;
|
|
785
792
|
}
|
|
793
|
+
computedType;
|
|
794
|
+
implementation;
|
|
786
795
|
setType(type) {
|
|
787
796
|
this.stop();
|
|
788
797
|
this.computedType = type;
|
|
@@ -975,7 +984,7 @@ function stop(stoppable) {
|
|
|
975
984
|
function toImplementation(type) {
|
|
976
985
|
return lazyCollections.find((implementation) => predicatesByImplementation.get(implementation)(type))(predicatesByImplementation.keys());
|
|
977
986
|
}
|
|
978
|
-
const predicatesByImplementation = new Map([
|
|
987
|
+
const predicatesByImplementation = /* @__PURE__ */ new Map([
|
|
979
988
|
[
|
|
980
989
|
"recognizeable",
|
|
981
990
|
(type) => type === "recognizeable"
|
|
@@ -1025,7 +1034,7 @@ const predicatesByImplementation = new Map([
|
|
|
1025
1034
|
() => true
|
|
1026
1035
|
]
|
|
1027
1036
|
]);
|
|
1028
|
-
const documentEvents = new Set([
|
|
1037
|
+
const documentEvents = /* @__PURE__ */ new Set([
|
|
1029
1038
|
"fullscreenchange",
|
|
1030
1039
|
"fullscreenerror",
|
|
1031
1040
|
"pointerlockchange",
|
|
@@ -1048,6 +1057,11 @@ function eventMatchesKeycombo({ event, keycombo }) {
|
|
|
1048
1057
|
return lazyCollections.every(({ name, type }, index) => {
|
|
1049
1058
|
switch (type) {
|
|
1050
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();
|
|
1051
1065
|
case "other":
|
|
1052
1066
|
if (name === "!") {
|
|
1053
1067
|
return event.key === "!";
|
|
@@ -1063,7 +1077,34 @@ function eventMatchesKeycombo({ event, keycombo }) {
|
|
|
1063
1077
|
}
|
|
1064
1078
|
})(keycombo);
|
|
1065
1079
|
}
|
|
1066
|
-
|
|
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([
|
|
1067
1108
|
[
|
|
1068
1109
|
"arrow",
|
|
1069
1110
|
({ event }) => arrows.has(event.key.toLowerCase())
|
|
@@ -1093,9 +1134,9 @@ const predicatesByArrow = new Map([
|
|
|
1093
1134
|
({ event, name }) => name.startsWith("!") ? event.key.toLowerCase() !== `arrow${name.toLowerCase()}` : event.key.toLowerCase() === `arrow${name.toLowerCase()}`
|
|
1094
1135
|
]
|
|
1095
1136
|
]);
|
|
1096
|
-
const arrows = new Set(["arrowup", "arrowright", "arrowdown", "arrowleft"]);
|
|
1097
|
-
const verticalArrows = new Set(["arrowup", "arrowdown"]);
|
|
1098
|
-
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"]);
|
|
1099
1140
|
function eventMatchesClickcombo({ event, clickcombo }) {
|
|
1100
1141
|
return lazyCollections.every((name) => fromComboItemNameToType(name) === "click" || name.startsWith("!") && !isModified({ alias: name.slice(1), event }) || !name.startsWith("!") && isModified({ alias: name, event }))(clickcombo);
|
|
1101
1142
|
}
|
|
@@ -1120,6 +1161,21 @@ const defaultOptions$6 = {
|
|
|
1120
1161
|
alternates: false
|
|
1121
1162
|
};
|
|
1122
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;
|
|
1123
1179
|
constructor(keyframes, options = {}) {
|
|
1124
1180
|
this.initialDuration = options?.duration || defaultOptions$6.duration;
|
|
1125
1181
|
this.controlPoints = fromTimingToControlPoints(options?.timing || defaultOptions$6.timing);
|
|
@@ -1143,21 +1199,25 @@ class Animateable {
|
|
|
1143
1199
|
this.resetProgress();
|
|
1144
1200
|
this.resetIterations();
|
|
1145
1201
|
}
|
|
1202
|
+
computedStatus;
|
|
1146
1203
|
ready() {
|
|
1147
1204
|
this.computedStatus = "ready";
|
|
1148
1205
|
}
|
|
1206
|
+
computedTime;
|
|
1149
1207
|
resetTime() {
|
|
1150
1208
|
this.computedTime = {
|
|
1151
1209
|
elapsed: 0,
|
|
1152
1210
|
remaining: this.duration
|
|
1153
1211
|
};
|
|
1154
1212
|
}
|
|
1213
|
+
computedProgress;
|
|
1155
1214
|
resetProgress() {
|
|
1156
1215
|
this.computedProgress = {
|
|
1157
1216
|
time: 0,
|
|
1158
1217
|
animation: 0
|
|
1159
1218
|
};
|
|
1160
1219
|
}
|
|
1220
|
+
computedIterations;
|
|
1161
1221
|
resetIterations() {
|
|
1162
1222
|
this.computedIterations = 0;
|
|
1163
1223
|
}
|
|
@@ -1188,6 +1248,11 @@ class Animateable {
|
|
|
1188
1248
|
get progress() {
|
|
1189
1249
|
return this.computedProgress;
|
|
1190
1250
|
}
|
|
1251
|
+
computedKeyframes;
|
|
1252
|
+
reversedKeyframes;
|
|
1253
|
+
properties;
|
|
1254
|
+
easeables;
|
|
1255
|
+
reversedEaseables;
|
|
1191
1256
|
setKeyframes(keyframes) {
|
|
1192
1257
|
this.stop();
|
|
1193
1258
|
this.computedKeyframes = Array.from(keyframes).sort(({ progress: progressA }, { progress: progressB }) => progressA - progressB);
|
|
@@ -1197,6 +1262,9 @@ class Animateable {
|
|
|
1197
1262
|
this.reversedEaseables = this.getReversedEaseables({ keyframes: this.reversedKeyframes, properties: this.properties });
|
|
1198
1263
|
return this;
|
|
1199
1264
|
}
|
|
1265
|
+
computedPlaybackRate;
|
|
1266
|
+
duration;
|
|
1267
|
+
totalTimeInvisible;
|
|
1200
1268
|
setPlaybackRate(playbackRate) {
|
|
1201
1269
|
const ensuredPlaybackRate = Math.max(0, playbackRate);
|
|
1202
1270
|
this.computedPlaybackRate = ensuredPlaybackRate;
|
|
@@ -1342,6 +1410,7 @@ class Animateable {
|
|
|
1342
1410
|
reversed() {
|
|
1343
1411
|
this.computedStatus = "reversed";
|
|
1344
1412
|
}
|
|
1413
|
+
invisibleAt;
|
|
1345
1414
|
listenForVisibilitychange() {
|
|
1346
1415
|
if (this.visibilitychange.active.size === 0) {
|
|
1347
1416
|
this.totalTimeInvisible = 0;
|
|
@@ -1357,6 +1426,7 @@ class Animateable {
|
|
|
1357
1426
|
});
|
|
1358
1427
|
}
|
|
1359
1428
|
}
|
|
1429
|
+
computedRequest;
|
|
1360
1430
|
createAnimate(type) {
|
|
1361
1431
|
return (effect, options = {}) => {
|
|
1362
1432
|
const { interpolate: interpolateOptions } = options;
|
|
@@ -1377,6 +1447,7 @@ class Animateable {
|
|
|
1377
1447
|
return this;
|
|
1378
1448
|
};
|
|
1379
1449
|
}
|
|
1450
|
+
startTime;
|
|
1380
1451
|
setStartTimeAndStatus(type, timestamp) {
|
|
1381
1452
|
switch (type) {
|
|
1382
1453
|
case "play":
|
|
@@ -1743,7 +1814,7 @@ function createGetEaseables(fromKeyframeToControlPoints) {
|
|
|
1743
1814
|
};
|
|
1744
1815
|
}
|
|
1745
1816
|
function toProperties(keyframes) {
|
|
1746
|
-
const properties = new Set();
|
|
1817
|
+
const properties = /* @__PURE__ */ new Set();
|
|
1747
1818
|
for (const keyframe of keyframes) {
|
|
1748
1819
|
for (const property in keyframe.properties) {
|
|
1749
1820
|
if (!properties.has(property)) {
|
|
@@ -1768,7 +1839,7 @@ function fromControlPointsToReversedControlPoints(points) {
|
|
|
1768
1839
|
}
|
|
1769
1840
|
function createToAnimationProgress(points) {
|
|
1770
1841
|
const { 0: { x: point1x, y: point1y }, 1: { x: point2x, y: point2y } } = points;
|
|
1771
|
-
return BezierEasing__default[
|
|
1842
|
+
return BezierEasing__default["default"](point1x, point1y, point2x, point2y);
|
|
1772
1843
|
}
|
|
1773
1844
|
function toInterpolated({ previous, next, progress }, options = {}) {
|
|
1774
1845
|
if (isUndefined(previous)) {
|
|
@@ -1981,6 +2052,10 @@ const defaultCompleteOptions = {
|
|
|
1981
2052
|
select: "completionEnd"
|
|
1982
2053
|
};
|
|
1983
2054
|
class Completeable {
|
|
2055
|
+
segmentFrom;
|
|
2056
|
+
segmentTo;
|
|
2057
|
+
divider;
|
|
2058
|
+
computedDividerIndices;
|
|
1984
2059
|
constructor(string, options = {}) {
|
|
1985
2060
|
this.constructing();
|
|
1986
2061
|
this.segmentFrom = options?.segment?.from || defaultOptions$5.segment.from;
|
|
@@ -1994,6 +2069,7 @@ class Completeable {
|
|
|
1994
2069
|
constructing() {
|
|
1995
2070
|
this.computedStatus = "constructing";
|
|
1996
2071
|
}
|
|
2072
|
+
computedStatus;
|
|
1997
2073
|
ready() {
|
|
1998
2074
|
this.computedStatus = "ready";
|
|
1999
2075
|
}
|
|
@@ -2038,6 +2114,7 @@ class Completeable {
|
|
|
2038
2114
|
return this.dividerIndices.after;
|
|
2039
2115
|
}
|
|
2040
2116
|
}
|
|
2117
|
+
computedString;
|
|
2041
2118
|
setString(string) {
|
|
2042
2119
|
this.computedString = string;
|
|
2043
2120
|
switch (this.status) {
|
|
@@ -2049,6 +2126,7 @@ class Completeable {
|
|
|
2049
2126
|
}
|
|
2050
2127
|
return this;
|
|
2051
2128
|
}
|
|
2129
|
+
computedSelection;
|
|
2052
2130
|
setSelection(selection) {
|
|
2053
2131
|
this.computedSelection = selection;
|
|
2054
2132
|
this.setDividerIndices();
|
|
@@ -2135,6 +2213,10 @@ function toNextMatch({ string, re, from }) {
|
|
|
2135
2213
|
}
|
|
2136
2214
|
|
|
2137
2215
|
class Copyable {
|
|
2216
|
+
computedIsClipboardText;
|
|
2217
|
+
copyListenable;
|
|
2218
|
+
cutListenable;
|
|
2219
|
+
copyAndCutEffect;
|
|
2138
2220
|
constructor(string, options = {}) {
|
|
2139
2221
|
this.computedIsClipboardText = false;
|
|
2140
2222
|
this.copyListenable = new Listenable("copy");
|
|
@@ -2146,6 +2228,7 @@ class Copyable {
|
|
|
2146
2228
|
this.setString(string);
|
|
2147
2229
|
this.ready();
|
|
2148
2230
|
}
|
|
2231
|
+
computedStatus;
|
|
2149
2232
|
ready() {
|
|
2150
2233
|
this.computedStatus = "ready";
|
|
2151
2234
|
}
|
|
@@ -2167,10 +2250,13 @@ class Copyable {
|
|
|
2167
2250
|
get error() {
|
|
2168
2251
|
return this.computedError;
|
|
2169
2252
|
}
|
|
2253
|
+
computedString;
|
|
2170
2254
|
setString(string) {
|
|
2171
2255
|
this.computedString = string;
|
|
2172
2256
|
return this;
|
|
2173
2257
|
}
|
|
2258
|
+
computedResponse;
|
|
2259
|
+
computedError;
|
|
2174
2260
|
async copy(options = { type: "clipboard" }) {
|
|
2175
2261
|
this.copying();
|
|
2176
2262
|
const { type } = options;
|
|
@@ -2223,6 +2309,7 @@ const defaultOptions$4 = {
|
|
|
2223
2309
|
executions: 1
|
|
2224
2310
|
};
|
|
2225
2311
|
class Delayable {
|
|
2312
|
+
animateable;
|
|
2226
2313
|
constructor(effect, options = {}) {
|
|
2227
2314
|
this.animateable = new Animateable([
|
|
2228
2315
|
{ progress: 0, properties: { progress: 0 } },
|
|
@@ -2234,6 +2321,7 @@ class Delayable {
|
|
|
2234
2321
|
this.setEffect(effect);
|
|
2235
2322
|
this.ready();
|
|
2236
2323
|
}
|
|
2324
|
+
computedStatus;
|
|
2237
2325
|
ready() {
|
|
2238
2326
|
this.computedStatus = "ready";
|
|
2239
2327
|
}
|
|
@@ -2255,12 +2343,14 @@ class Delayable {
|
|
|
2255
2343
|
get progress() {
|
|
2256
2344
|
return this.animateable.progress.time;
|
|
2257
2345
|
}
|
|
2346
|
+
computedEffect;
|
|
2258
2347
|
setEffect(effect) {
|
|
2259
2348
|
this.stop();
|
|
2260
2349
|
this.computedEffect = effect;
|
|
2261
2350
|
this.setFrameEffect(effect);
|
|
2262
2351
|
return this;
|
|
2263
2352
|
}
|
|
2353
|
+
frameEffect;
|
|
2264
2354
|
setFrameEffect(effect) {
|
|
2265
2355
|
this.frameEffect = (frame) => {
|
|
2266
2356
|
const { properties: { progress }, timestamp } = frame;
|
|
@@ -2363,6 +2453,7 @@ class Dispatchable {
|
|
|
2363
2453
|
this.setType(type);
|
|
2364
2454
|
this.ready();
|
|
2365
2455
|
}
|
|
2456
|
+
computedStatus;
|
|
2366
2457
|
ready() {
|
|
2367
2458
|
this.computedStatus = "ready";
|
|
2368
2459
|
}
|
|
@@ -2378,10 +2469,12 @@ class Dispatchable {
|
|
|
2378
2469
|
get status() {
|
|
2379
2470
|
return this.computedStatus;
|
|
2380
2471
|
}
|
|
2472
|
+
computedType;
|
|
2381
2473
|
setType(type) {
|
|
2382
2474
|
this.computedType = type;
|
|
2383
2475
|
return this;
|
|
2384
2476
|
}
|
|
2477
|
+
computedCancelled;
|
|
2385
2478
|
dispatch(options = {}) {
|
|
2386
2479
|
const { target = window, ...rest } = options, event = toEvent(this.type, rest);
|
|
2387
2480
|
this.computedCancelled = !target.dispatchEvent(event);
|
|
@@ -2397,11 +2490,14 @@ const defaultOptions$3 = {
|
|
|
2397
2490
|
toD: (stroke) => stroke.length === 0 ? "" : toD(stroke)
|
|
2398
2491
|
};
|
|
2399
2492
|
class Drawable {
|
|
2493
|
+
computedD;
|
|
2494
|
+
toD;
|
|
2400
2495
|
constructor(stroke, options = {}) {
|
|
2401
2496
|
this.toD = options?.toD || defaultOptions$3.toD;
|
|
2402
2497
|
this.setStroke(stroke);
|
|
2403
2498
|
this.ready();
|
|
2404
2499
|
}
|
|
2500
|
+
computedStatus;
|
|
2405
2501
|
ready() {
|
|
2406
2502
|
this.computedStatus = "ready";
|
|
2407
2503
|
}
|
|
@@ -2417,6 +2513,7 @@ class Drawable {
|
|
|
2417
2513
|
get d() {
|
|
2418
2514
|
return this.computedD;
|
|
2419
2515
|
}
|
|
2516
|
+
computedStroke;
|
|
2420
2517
|
setStroke(stroke) {
|
|
2421
2518
|
this.computedStroke = stroke;
|
|
2422
2519
|
this.computedD = this.toD(stroke);
|
|
@@ -2445,7 +2542,7 @@ function toFlattenedD(stroke) {
|
|
|
2445
2542
|
if (stroke.length === 0) {
|
|
2446
2543
|
return "";
|
|
2447
2544
|
}
|
|
2448
|
-
const multiPolygon = polygonClipping__default[
|
|
2545
|
+
const multiPolygon = polygonClipping__default["default"].union([stroke]);
|
|
2449
2546
|
return createReduce((dFromMultiPolygon, polygon) => {
|
|
2450
2547
|
return dFromMultiPolygon + createReduce((dFromRing, points) => {
|
|
2451
2548
|
return dFromRing + toD(points);
|
|
@@ -2458,6 +2555,7 @@ class Resolveable {
|
|
|
2458
2555
|
this.setGetPromise(getPromise);
|
|
2459
2556
|
this.ready();
|
|
2460
2557
|
}
|
|
2558
|
+
computedStatus;
|
|
2461
2559
|
ready() {
|
|
2462
2560
|
this.computedStatus = "ready";
|
|
2463
2561
|
}
|
|
@@ -2473,10 +2571,12 @@ class Resolveable {
|
|
|
2473
2571
|
get value() {
|
|
2474
2572
|
return this.computedValue;
|
|
2475
2573
|
}
|
|
2574
|
+
computedGetPromise;
|
|
2476
2575
|
setGetPromise(getPromise) {
|
|
2477
2576
|
this.computedGetPromise = getPromise;
|
|
2478
2577
|
return this;
|
|
2479
2578
|
}
|
|
2579
|
+
computedValue;
|
|
2480
2580
|
async resolve(...args) {
|
|
2481
2581
|
this.resolving();
|
|
2482
2582
|
try {
|
|
@@ -2501,6 +2601,11 @@ class Resolveable {
|
|
|
2501
2601
|
}
|
|
2502
2602
|
|
|
2503
2603
|
class Fetchable {
|
|
2604
|
+
computedArrayBuffer;
|
|
2605
|
+
computedBlob;
|
|
2606
|
+
computedFormData;
|
|
2607
|
+
computedJson;
|
|
2608
|
+
computedText;
|
|
2504
2609
|
constructor(resource, options = {}) {
|
|
2505
2610
|
this.setResource(resource);
|
|
2506
2611
|
this.computedArrayBuffer = new Resolveable(async () => "arrayBuffer" in this.response ? await this.response.arrayBuffer() : await void 0);
|
|
@@ -2510,6 +2615,7 @@ class Fetchable {
|
|
|
2510
2615
|
this.computedText = new Resolveable(async () => "text" in this.response ? await this.response.text() : await void 0);
|
|
2511
2616
|
this.ready();
|
|
2512
2617
|
}
|
|
2618
|
+
computedStatus;
|
|
2513
2619
|
ready() {
|
|
2514
2620
|
this.computedStatus = "ready";
|
|
2515
2621
|
}
|
|
@@ -2519,6 +2625,7 @@ class Fetchable {
|
|
|
2519
2625
|
set resource(resource) {
|
|
2520
2626
|
this.setResource(resource);
|
|
2521
2627
|
}
|
|
2628
|
+
computedAbortController;
|
|
2522
2629
|
get abortController() {
|
|
2523
2630
|
if (!this.computedAbortController) {
|
|
2524
2631
|
this.computedAbortController = new AbortController();
|
|
@@ -2564,10 +2671,13 @@ class Fetchable {
|
|
|
2564
2671
|
return resolveable;
|
|
2565
2672
|
}
|
|
2566
2673
|
}
|
|
2674
|
+
computedResource;
|
|
2567
2675
|
setResource(resource) {
|
|
2568
2676
|
this.computedResource = resource;
|
|
2569
2677
|
return this;
|
|
2570
2678
|
}
|
|
2679
|
+
computedResponse;
|
|
2680
|
+
computedError;
|
|
2571
2681
|
async fetch(options = {}) {
|
|
2572
2682
|
this.computedStatus = "fetching";
|
|
2573
2683
|
try {
|
|
@@ -2622,6 +2732,7 @@ class Fullscreenable {
|
|
|
2622
2732
|
this.setGetElement(getElement);
|
|
2623
2733
|
this.ready();
|
|
2624
2734
|
}
|
|
2735
|
+
computedStatus;
|
|
2625
2736
|
ready() {
|
|
2626
2737
|
this.computedStatus = "ready";
|
|
2627
2738
|
}
|
|
@@ -2640,6 +2751,7 @@ class Fullscreenable {
|
|
|
2640
2751
|
get error() {
|
|
2641
2752
|
return this.computedError;
|
|
2642
2753
|
}
|
|
2754
|
+
computedGetElement;
|
|
2643
2755
|
setGetElement(getElement) {
|
|
2644
2756
|
this.computedGetElement = () => getElement();
|
|
2645
2757
|
return this;
|
|
@@ -2648,6 +2760,7 @@ class Fullscreenable {
|
|
|
2648
2760
|
await this.fullscreen(options);
|
|
2649
2761
|
return this;
|
|
2650
2762
|
}
|
|
2763
|
+
computedError;
|
|
2651
2764
|
async fullscreen(options = {}) {
|
|
2652
2765
|
try {
|
|
2653
2766
|
await this.element.requestFullscreen(options);
|
|
@@ -2684,6 +2797,7 @@ class Grantable {
|
|
|
2684
2797
|
this.setDescriptor(descriptor);
|
|
2685
2798
|
this.ready();
|
|
2686
2799
|
}
|
|
2800
|
+
computedStatus;
|
|
2687
2801
|
ready() {
|
|
2688
2802
|
this.computedStatus = "ready";
|
|
2689
2803
|
}
|
|
@@ -2699,10 +2813,12 @@ class Grantable {
|
|
|
2699
2813
|
get status() {
|
|
2700
2814
|
return this.computedStatus;
|
|
2701
2815
|
}
|
|
2816
|
+
computedDescriptor;
|
|
2702
2817
|
setDescriptor(descriptor) {
|
|
2703
2818
|
this.computedDescriptor = descriptor;
|
|
2704
2819
|
return this;
|
|
2705
2820
|
}
|
|
2821
|
+
computedPermission;
|
|
2706
2822
|
async query() {
|
|
2707
2823
|
this.querying();
|
|
2708
2824
|
try {
|
|
@@ -2739,15 +2855,18 @@ class Navigateable {
|
|
|
2739
2855
|
this.navigate(options?.initialLocation ?? defaultOptions$2.initialLocation);
|
|
2740
2856
|
this.ready();
|
|
2741
2857
|
}
|
|
2858
|
+
computedStatus;
|
|
2742
2859
|
ready() {
|
|
2743
2860
|
this.computedStatus = "ready";
|
|
2744
2861
|
}
|
|
2862
|
+
computedArray;
|
|
2745
2863
|
get array() {
|
|
2746
2864
|
return this.computedArray;
|
|
2747
2865
|
}
|
|
2748
2866
|
set array(value) {
|
|
2749
2867
|
this.setArray(value);
|
|
2750
2868
|
}
|
|
2869
|
+
computedLocation;
|
|
2751
2870
|
get location() {
|
|
2752
2871
|
return this.computedLocation;
|
|
2753
2872
|
}
|
|
@@ -2871,29 +2990,33 @@ const defaultOptions$1 = {
|
|
|
2871
2990
|
};
|
|
2872
2991
|
class Pickable {
|
|
2873
2992
|
constructor(array, options = {}) {
|
|
2874
|
-
this.toItems = createMap((index) => this.array[index]);
|
|
2875
2993
|
this.setArray(array);
|
|
2876
2994
|
this.pick(options.initialPicks ?? defaultOptions$1.initialPicks);
|
|
2877
2995
|
this.ready();
|
|
2878
2996
|
}
|
|
2997
|
+
computedStatus;
|
|
2879
2998
|
ready() {
|
|
2880
2999
|
this.computedStatus = "ready";
|
|
2881
3000
|
}
|
|
3001
|
+
computedArray;
|
|
2882
3002
|
get array() {
|
|
2883
3003
|
return this.computedArray;
|
|
2884
3004
|
}
|
|
2885
3005
|
set array(array) {
|
|
2886
3006
|
this.setArray(array);
|
|
2887
3007
|
}
|
|
3008
|
+
computedPicks;
|
|
2888
3009
|
get picks() {
|
|
2889
3010
|
return this.computedPicks;
|
|
2890
3011
|
}
|
|
2891
3012
|
set picks(indices) {
|
|
2892
3013
|
this.pick(indices);
|
|
2893
3014
|
}
|
|
3015
|
+
computedFirst;
|
|
2894
3016
|
get first() {
|
|
2895
3017
|
return this.computedFirst;
|
|
2896
3018
|
}
|
|
3019
|
+
computedLast;
|
|
2897
3020
|
get last() {
|
|
2898
3021
|
return this.computedLast;
|
|
2899
3022
|
}
|
|
@@ -2909,9 +3032,11 @@ class Pickable {
|
|
|
2909
3032
|
get items() {
|
|
2910
3033
|
return this.toItems(this.picks);
|
|
2911
3034
|
}
|
|
3035
|
+
toItems = createMap((index) => this.array[index]);
|
|
2912
3036
|
get multiple() {
|
|
2913
3037
|
return this.picks.length > 1;
|
|
2914
3038
|
}
|
|
3039
|
+
toPossiblePicks;
|
|
2915
3040
|
setArray(array) {
|
|
2916
3041
|
this.computedArray = array;
|
|
2917
3042
|
this.toPossiblePicks = createFilter((index) => index >= 0 && index < array.length);
|
|
@@ -2987,14 +3112,17 @@ function ensureIndices(indexOrIndices) {
|
|
|
2987
3112
|
const toUnique = createUnique();
|
|
2988
3113
|
|
|
2989
3114
|
class Sanitizeable {
|
|
3115
|
+
domPurifyConfig;
|
|
2990
3116
|
constructor(html, options) {
|
|
2991
3117
|
this.computedHtml = html;
|
|
2992
3118
|
this.domPurifyConfig = options;
|
|
2993
3119
|
this.ready();
|
|
2994
3120
|
}
|
|
3121
|
+
computedDompurify;
|
|
3122
|
+
computedStatus;
|
|
2995
3123
|
ready() {
|
|
2996
3124
|
if (domIsAvailable()) {
|
|
2997
|
-
this.computedDompurify = createDOMPurify__default[
|
|
3125
|
+
this.computedDompurify = createDOMPurify__default["default"]();
|
|
2998
3126
|
this.computedDompurify.setConfig(this.domPurifyConfig);
|
|
2999
3127
|
}
|
|
3000
3128
|
this.computedStatus = "ready";
|
|
@@ -3007,7 +3135,7 @@ class Sanitizeable {
|
|
|
3007
3135
|
}
|
|
3008
3136
|
get dompurify() {
|
|
3009
3137
|
if (!this.computedDompurify && domIsAvailable()) {
|
|
3010
|
-
this.computedDompurify = createDOMPurify__default[
|
|
3138
|
+
this.computedDompurify = createDOMPurify__default["default"]();
|
|
3011
3139
|
this.computedDompurify.setConfig(this.domPurifyConfig);
|
|
3012
3140
|
}
|
|
3013
3141
|
return this.computedDompurify;
|
|
@@ -3015,6 +3143,7 @@ class Sanitizeable {
|
|
|
3015
3143
|
get status() {
|
|
3016
3144
|
return this.computedStatus;
|
|
3017
3145
|
}
|
|
3146
|
+
computedHtml;
|
|
3018
3147
|
setHtml(html) {
|
|
3019
3148
|
this.computedHtml = html;
|
|
3020
3149
|
return this;
|
|
@@ -3030,15 +3159,19 @@ class Sanitizeable {
|
|
|
3030
3159
|
}
|
|
3031
3160
|
|
|
3032
3161
|
class Searchable {
|
|
3162
|
+
searcherOptions;
|
|
3163
|
+
computedResults;
|
|
3033
3164
|
constructor(candidates, options = {}) {
|
|
3034
3165
|
this.searcherOptions = options;
|
|
3035
3166
|
this.setCandidates(candidates);
|
|
3036
3167
|
this.computedResults = [];
|
|
3037
3168
|
this.ready();
|
|
3038
3169
|
}
|
|
3170
|
+
computedStatus;
|
|
3039
3171
|
ready() {
|
|
3040
3172
|
this.computedStatus = "ready";
|
|
3041
3173
|
}
|
|
3174
|
+
computedCandidates;
|
|
3042
3175
|
get candidates() {
|
|
3043
3176
|
return this.computedCandidates;
|
|
3044
3177
|
}
|
|
@@ -3054,6 +3187,7 @@ class Searchable {
|
|
|
3054
3187
|
get status() {
|
|
3055
3188
|
return this.computedStatus;
|
|
3056
3189
|
}
|
|
3190
|
+
computedSearcher;
|
|
3057
3191
|
setCandidates(candidates) {
|
|
3058
3192
|
this.computedCandidates = Array.from(candidates);
|
|
3059
3193
|
this.computedSearcher = new fastFuzzy.Searcher(candidates, this.searcherOptions);
|
|
@@ -3074,6 +3208,8 @@ const defaultOptions = {
|
|
|
3074
3208
|
statusKeySuffix: " status"
|
|
3075
3209
|
};
|
|
3076
3210
|
class Storeable {
|
|
3211
|
+
type;
|
|
3212
|
+
statusKeySuffix;
|
|
3077
3213
|
constructor(key, options = {}) {
|
|
3078
3214
|
this.constructing();
|
|
3079
3215
|
this.type = options.type ?? defaultOptions.type;
|
|
@@ -3084,6 +3220,7 @@ class Storeable {
|
|
|
3084
3220
|
constructing() {
|
|
3085
3221
|
this.computedStatus = "constructing";
|
|
3086
3222
|
}
|
|
3223
|
+
computedStatus;
|
|
3087
3224
|
ready() {
|
|
3088
3225
|
this.computedStatus = "ready";
|
|
3089
3226
|
if (domIsAvailable()) {
|
|
@@ -3121,6 +3258,8 @@ class Storeable {
|
|
|
3121
3258
|
get error() {
|
|
3122
3259
|
return this.computedError;
|
|
3123
3260
|
}
|
|
3261
|
+
computedKey;
|
|
3262
|
+
computedStatusKey;
|
|
3124
3263
|
setKey(key) {
|
|
3125
3264
|
let string;
|
|
3126
3265
|
switch (this.status) {
|
|
@@ -3146,6 +3285,8 @@ class Storeable {
|
|
|
3146
3285
|
}
|
|
3147
3286
|
return this;
|
|
3148
3287
|
}
|
|
3288
|
+
computedString;
|
|
3289
|
+
computedError;
|
|
3149
3290
|
store(string) {
|
|
3150
3291
|
try {
|
|
3151
3292
|
this.storage.setItem(this.key, string);
|
package/lib/index.js
CHANGED
|
@@ -158,7 +158,7 @@ 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
162
|
};
|
|
163
163
|
}
|
|
164
164
|
function createToEntries() {
|
|
@@ -235,8 +235,6 @@ function toEvent(eventType, options) {
|
|
|
235
235
|
return new InputEvent(eventType, options.init);
|
|
236
236
|
if (eventType === "blur")
|
|
237
237
|
return new FocusEvent(eventType, options.init);
|
|
238
|
-
if (eventType === "cancel")
|
|
239
|
-
return new Event(eventType, options.init);
|
|
240
238
|
if (eventType === "canplay")
|
|
241
239
|
return new Event(eventType, options.init);
|
|
242
240
|
if (eventType === "canplaythrough")
|
|
@@ -265,8 +263,6 @@ function toEvent(eventType, options) {
|
|
|
265
263
|
return new DragEvent(eventType, options.init);
|
|
266
264
|
if (eventType === "dragenter")
|
|
267
265
|
return new DragEvent(eventType, options.init);
|
|
268
|
-
if (eventType === "dragexit")
|
|
269
|
-
return new Event(eventType, options.init);
|
|
270
266
|
if (eventType === "dragleave")
|
|
271
267
|
return new DragEvent(eventType, options.init);
|
|
272
268
|
if (eventType === "dragover")
|
|
@@ -489,7 +485,7 @@ function toCombo(type) {
|
|
|
489
485
|
function fromComboItemNameToType(name) {
|
|
490
486
|
return find((type) => predicatesByType[type](name))(listenableComboItemTypes) ?? "custom";
|
|
491
487
|
}
|
|
492
|
-
const listenableComboItemTypes = new Set(["singleCharacter", "arrow", "other", "modifier", "click", "pointer"]);
|
|
488
|
+
const listenableComboItemTypes = /* @__PURE__ */ new Set(["singleCharacter", "arrow", "other", "modifier", "click", "pointer"]);
|
|
493
489
|
const predicatesByType = {
|
|
494
490
|
singleCharacter: (name) => typeREs["singleCharacter"].test(name),
|
|
495
491
|
arrow: (name) => typeREs["arrow"].test(name),
|
|
@@ -585,6 +581,10 @@ function isString(value) {
|
|
|
585
581
|
}
|
|
586
582
|
|
|
587
583
|
class Recognizeable {
|
|
584
|
+
maxSequenceLength;
|
|
585
|
+
effects;
|
|
586
|
+
effectApi;
|
|
587
|
+
toType;
|
|
588
588
|
constructor(sequence, options = { effectsIncludeCombos: true }) {
|
|
589
589
|
const defaultOptions = {
|
|
590
590
|
maxSequenceLength: true,
|
|
@@ -608,6 +608,7 @@ class Recognizeable {
|
|
|
608
608
|
};
|
|
609
609
|
this.ready();
|
|
610
610
|
}
|
|
611
|
+
computedMetadata;
|
|
611
612
|
resetComputedMetadata() {
|
|
612
613
|
this.computedMetadata = {};
|
|
613
614
|
}
|
|
@@ -617,6 +618,7 @@ class Recognizeable {
|
|
|
617
618
|
denied() {
|
|
618
619
|
this.computedStatus = "denied";
|
|
619
620
|
}
|
|
621
|
+
computedStatus;
|
|
620
622
|
ready() {
|
|
621
623
|
this.computedStatus = "ready";
|
|
622
624
|
}
|
|
@@ -632,6 +634,7 @@ class Recognizeable {
|
|
|
632
634
|
get metadata() {
|
|
633
635
|
return this.computedMetadata;
|
|
634
636
|
}
|
|
637
|
+
computedSequence;
|
|
635
638
|
setSequence(sequence) {
|
|
636
639
|
this.computedSequence = sequence;
|
|
637
640
|
return this;
|
|
@@ -735,9 +738,12 @@ function createToType({
|
|
|
735
738
|
}
|
|
736
739
|
};
|
|
737
740
|
}
|
|
738
|
-
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);
|
|
739
742
|
|
|
740
743
|
class Listenable {
|
|
744
|
+
computedRecognizeable;
|
|
745
|
+
recognizeableEffectsKeys;
|
|
746
|
+
computedActive;
|
|
741
747
|
constructor(type, options) {
|
|
742
748
|
if (type === "recognizeable") {
|
|
743
749
|
const recognizeableOptions = {
|
|
@@ -750,10 +756,11 @@ class Listenable {
|
|
|
750
756
|
this.computedRecognizeable = new Recognizeable([], recognizeableOptions);
|
|
751
757
|
this.recognizeableEffectsKeys = Object.keys(recognizeableOptions.effects);
|
|
752
758
|
}
|
|
753
|
-
this.computedActive = new Set();
|
|
759
|
+
this.computedActive = /* @__PURE__ */ new Set();
|
|
754
760
|
this.setType(type);
|
|
755
761
|
this.ready();
|
|
756
762
|
}
|
|
763
|
+
computedStatus;
|
|
757
764
|
ready() {
|
|
758
765
|
this.computedStatus = "ready";
|
|
759
766
|
}
|
|
@@ -772,6 +779,8 @@ class Listenable {
|
|
|
772
779
|
get recognizeable() {
|
|
773
780
|
return this.computedRecognizeable;
|
|
774
781
|
}
|
|
782
|
+
computedType;
|
|
783
|
+
implementation;
|
|
775
784
|
setType(type) {
|
|
776
785
|
this.stop();
|
|
777
786
|
this.computedType = type;
|
|
@@ -964,7 +973,7 @@ function stop(stoppable) {
|
|
|
964
973
|
function toImplementation(type) {
|
|
965
974
|
return find((implementation) => predicatesByImplementation.get(implementation)(type))(predicatesByImplementation.keys());
|
|
966
975
|
}
|
|
967
|
-
const predicatesByImplementation = new Map([
|
|
976
|
+
const predicatesByImplementation = /* @__PURE__ */ new Map([
|
|
968
977
|
[
|
|
969
978
|
"recognizeable",
|
|
970
979
|
(type) => type === "recognizeable"
|
|
@@ -1014,7 +1023,7 @@ const predicatesByImplementation = new Map([
|
|
|
1014
1023
|
() => true
|
|
1015
1024
|
]
|
|
1016
1025
|
]);
|
|
1017
|
-
const documentEvents = new Set([
|
|
1026
|
+
const documentEvents = /* @__PURE__ */ new Set([
|
|
1018
1027
|
"fullscreenchange",
|
|
1019
1028
|
"fullscreenerror",
|
|
1020
1029
|
"pointerlockchange",
|
|
@@ -1037,6 +1046,11 @@ function eventMatchesKeycombo({ event, keycombo }) {
|
|
|
1037
1046
|
return every(({ name, type }, index) => {
|
|
1038
1047
|
switch (type) {
|
|
1039
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();
|
|
1040
1054
|
case "other":
|
|
1041
1055
|
if (name === "!") {
|
|
1042
1056
|
return event.key === "!";
|
|
@@ -1052,7 +1066,34 @@ function eventMatchesKeycombo({ event, keycombo }) {
|
|
|
1052
1066
|
}
|
|
1053
1067
|
})(keycombo);
|
|
1054
1068
|
}
|
|
1055
|
-
|
|
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([
|
|
1056
1097
|
[
|
|
1057
1098
|
"arrow",
|
|
1058
1099
|
({ event }) => arrows.has(event.key.toLowerCase())
|
|
@@ -1082,9 +1123,9 @@ const predicatesByArrow = new Map([
|
|
|
1082
1123
|
({ event, name }) => name.startsWith("!") ? event.key.toLowerCase() !== `arrow${name.toLowerCase()}` : event.key.toLowerCase() === `arrow${name.toLowerCase()}`
|
|
1083
1124
|
]
|
|
1084
1125
|
]);
|
|
1085
|
-
const arrows = new Set(["arrowup", "arrowright", "arrowdown", "arrowleft"]);
|
|
1086
|
-
const verticalArrows = new Set(["arrowup", "arrowdown"]);
|
|
1087
|
-
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"]);
|
|
1088
1129
|
function eventMatchesClickcombo({ event, clickcombo }) {
|
|
1089
1130
|
return every((name) => fromComboItemNameToType(name) === "click" || name.startsWith("!") && !isModified({ alias: name.slice(1), event }) || !name.startsWith("!") && isModified({ alias: name, event }))(clickcombo);
|
|
1090
1131
|
}
|
|
@@ -1109,6 +1150,21 @@ const defaultOptions$6 = {
|
|
|
1109
1150
|
alternates: false
|
|
1110
1151
|
};
|
|
1111
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;
|
|
1112
1168
|
constructor(keyframes, options = {}) {
|
|
1113
1169
|
this.initialDuration = options?.duration || defaultOptions$6.duration;
|
|
1114
1170
|
this.controlPoints = fromTimingToControlPoints(options?.timing || defaultOptions$6.timing);
|
|
@@ -1132,21 +1188,25 @@ class Animateable {
|
|
|
1132
1188
|
this.resetProgress();
|
|
1133
1189
|
this.resetIterations();
|
|
1134
1190
|
}
|
|
1191
|
+
computedStatus;
|
|
1135
1192
|
ready() {
|
|
1136
1193
|
this.computedStatus = "ready";
|
|
1137
1194
|
}
|
|
1195
|
+
computedTime;
|
|
1138
1196
|
resetTime() {
|
|
1139
1197
|
this.computedTime = {
|
|
1140
1198
|
elapsed: 0,
|
|
1141
1199
|
remaining: this.duration
|
|
1142
1200
|
};
|
|
1143
1201
|
}
|
|
1202
|
+
computedProgress;
|
|
1144
1203
|
resetProgress() {
|
|
1145
1204
|
this.computedProgress = {
|
|
1146
1205
|
time: 0,
|
|
1147
1206
|
animation: 0
|
|
1148
1207
|
};
|
|
1149
1208
|
}
|
|
1209
|
+
computedIterations;
|
|
1150
1210
|
resetIterations() {
|
|
1151
1211
|
this.computedIterations = 0;
|
|
1152
1212
|
}
|
|
@@ -1177,6 +1237,11 @@ class Animateable {
|
|
|
1177
1237
|
get progress() {
|
|
1178
1238
|
return this.computedProgress;
|
|
1179
1239
|
}
|
|
1240
|
+
computedKeyframes;
|
|
1241
|
+
reversedKeyframes;
|
|
1242
|
+
properties;
|
|
1243
|
+
easeables;
|
|
1244
|
+
reversedEaseables;
|
|
1180
1245
|
setKeyframes(keyframes) {
|
|
1181
1246
|
this.stop();
|
|
1182
1247
|
this.computedKeyframes = Array.from(keyframes).sort(({ progress: progressA }, { progress: progressB }) => progressA - progressB);
|
|
@@ -1186,6 +1251,9 @@ class Animateable {
|
|
|
1186
1251
|
this.reversedEaseables = this.getReversedEaseables({ keyframes: this.reversedKeyframes, properties: this.properties });
|
|
1187
1252
|
return this;
|
|
1188
1253
|
}
|
|
1254
|
+
computedPlaybackRate;
|
|
1255
|
+
duration;
|
|
1256
|
+
totalTimeInvisible;
|
|
1189
1257
|
setPlaybackRate(playbackRate) {
|
|
1190
1258
|
const ensuredPlaybackRate = Math.max(0, playbackRate);
|
|
1191
1259
|
this.computedPlaybackRate = ensuredPlaybackRate;
|
|
@@ -1331,6 +1399,7 @@ class Animateable {
|
|
|
1331
1399
|
reversed() {
|
|
1332
1400
|
this.computedStatus = "reversed";
|
|
1333
1401
|
}
|
|
1402
|
+
invisibleAt;
|
|
1334
1403
|
listenForVisibilitychange() {
|
|
1335
1404
|
if (this.visibilitychange.active.size === 0) {
|
|
1336
1405
|
this.totalTimeInvisible = 0;
|
|
@@ -1346,6 +1415,7 @@ class Animateable {
|
|
|
1346
1415
|
});
|
|
1347
1416
|
}
|
|
1348
1417
|
}
|
|
1418
|
+
computedRequest;
|
|
1349
1419
|
createAnimate(type) {
|
|
1350
1420
|
return (effect, options = {}) => {
|
|
1351
1421
|
const { interpolate: interpolateOptions } = options;
|
|
@@ -1366,6 +1436,7 @@ class Animateable {
|
|
|
1366
1436
|
return this;
|
|
1367
1437
|
};
|
|
1368
1438
|
}
|
|
1439
|
+
startTime;
|
|
1369
1440
|
setStartTimeAndStatus(type, timestamp) {
|
|
1370
1441
|
switch (type) {
|
|
1371
1442
|
case "play":
|
|
@@ -1732,7 +1803,7 @@ function createGetEaseables(fromKeyframeToControlPoints) {
|
|
|
1732
1803
|
};
|
|
1733
1804
|
}
|
|
1734
1805
|
function toProperties(keyframes) {
|
|
1735
|
-
const properties = new Set();
|
|
1806
|
+
const properties = /* @__PURE__ */ new Set();
|
|
1736
1807
|
for (const keyframe of keyframes) {
|
|
1737
1808
|
for (const property in keyframe.properties) {
|
|
1738
1809
|
if (!properties.has(property)) {
|
|
@@ -1970,6 +2041,10 @@ const defaultCompleteOptions = {
|
|
|
1970
2041
|
select: "completionEnd"
|
|
1971
2042
|
};
|
|
1972
2043
|
class Completeable {
|
|
2044
|
+
segmentFrom;
|
|
2045
|
+
segmentTo;
|
|
2046
|
+
divider;
|
|
2047
|
+
computedDividerIndices;
|
|
1973
2048
|
constructor(string, options = {}) {
|
|
1974
2049
|
this.constructing();
|
|
1975
2050
|
this.segmentFrom = options?.segment?.from || defaultOptions$5.segment.from;
|
|
@@ -1983,6 +2058,7 @@ class Completeable {
|
|
|
1983
2058
|
constructing() {
|
|
1984
2059
|
this.computedStatus = "constructing";
|
|
1985
2060
|
}
|
|
2061
|
+
computedStatus;
|
|
1986
2062
|
ready() {
|
|
1987
2063
|
this.computedStatus = "ready";
|
|
1988
2064
|
}
|
|
@@ -2027,6 +2103,7 @@ class Completeable {
|
|
|
2027
2103
|
return this.dividerIndices.after;
|
|
2028
2104
|
}
|
|
2029
2105
|
}
|
|
2106
|
+
computedString;
|
|
2030
2107
|
setString(string) {
|
|
2031
2108
|
this.computedString = string;
|
|
2032
2109
|
switch (this.status) {
|
|
@@ -2038,6 +2115,7 @@ class Completeable {
|
|
|
2038
2115
|
}
|
|
2039
2116
|
return this;
|
|
2040
2117
|
}
|
|
2118
|
+
computedSelection;
|
|
2041
2119
|
setSelection(selection) {
|
|
2042
2120
|
this.computedSelection = selection;
|
|
2043
2121
|
this.setDividerIndices();
|
|
@@ -2124,6 +2202,10 @@ function toNextMatch({ string, re, from }) {
|
|
|
2124
2202
|
}
|
|
2125
2203
|
|
|
2126
2204
|
class Copyable {
|
|
2205
|
+
computedIsClipboardText;
|
|
2206
|
+
copyListenable;
|
|
2207
|
+
cutListenable;
|
|
2208
|
+
copyAndCutEffect;
|
|
2127
2209
|
constructor(string, options = {}) {
|
|
2128
2210
|
this.computedIsClipboardText = false;
|
|
2129
2211
|
this.copyListenable = new Listenable("copy");
|
|
@@ -2135,6 +2217,7 @@ class Copyable {
|
|
|
2135
2217
|
this.setString(string);
|
|
2136
2218
|
this.ready();
|
|
2137
2219
|
}
|
|
2220
|
+
computedStatus;
|
|
2138
2221
|
ready() {
|
|
2139
2222
|
this.computedStatus = "ready";
|
|
2140
2223
|
}
|
|
@@ -2156,10 +2239,13 @@ class Copyable {
|
|
|
2156
2239
|
get error() {
|
|
2157
2240
|
return this.computedError;
|
|
2158
2241
|
}
|
|
2242
|
+
computedString;
|
|
2159
2243
|
setString(string) {
|
|
2160
2244
|
this.computedString = string;
|
|
2161
2245
|
return this;
|
|
2162
2246
|
}
|
|
2247
|
+
computedResponse;
|
|
2248
|
+
computedError;
|
|
2163
2249
|
async copy(options = { type: "clipboard" }) {
|
|
2164
2250
|
this.copying();
|
|
2165
2251
|
const { type } = options;
|
|
@@ -2212,6 +2298,7 @@ const defaultOptions$4 = {
|
|
|
2212
2298
|
executions: 1
|
|
2213
2299
|
};
|
|
2214
2300
|
class Delayable {
|
|
2301
|
+
animateable;
|
|
2215
2302
|
constructor(effect, options = {}) {
|
|
2216
2303
|
this.animateable = new Animateable([
|
|
2217
2304
|
{ progress: 0, properties: { progress: 0 } },
|
|
@@ -2223,6 +2310,7 @@ class Delayable {
|
|
|
2223
2310
|
this.setEffect(effect);
|
|
2224
2311
|
this.ready();
|
|
2225
2312
|
}
|
|
2313
|
+
computedStatus;
|
|
2226
2314
|
ready() {
|
|
2227
2315
|
this.computedStatus = "ready";
|
|
2228
2316
|
}
|
|
@@ -2244,12 +2332,14 @@ class Delayable {
|
|
|
2244
2332
|
get progress() {
|
|
2245
2333
|
return this.animateable.progress.time;
|
|
2246
2334
|
}
|
|
2335
|
+
computedEffect;
|
|
2247
2336
|
setEffect(effect) {
|
|
2248
2337
|
this.stop();
|
|
2249
2338
|
this.computedEffect = effect;
|
|
2250
2339
|
this.setFrameEffect(effect);
|
|
2251
2340
|
return this;
|
|
2252
2341
|
}
|
|
2342
|
+
frameEffect;
|
|
2253
2343
|
setFrameEffect(effect) {
|
|
2254
2344
|
this.frameEffect = (frame) => {
|
|
2255
2345
|
const { properties: { progress }, timestamp } = frame;
|
|
@@ -2352,6 +2442,7 @@ class Dispatchable {
|
|
|
2352
2442
|
this.setType(type);
|
|
2353
2443
|
this.ready();
|
|
2354
2444
|
}
|
|
2445
|
+
computedStatus;
|
|
2355
2446
|
ready() {
|
|
2356
2447
|
this.computedStatus = "ready";
|
|
2357
2448
|
}
|
|
@@ -2367,10 +2458,12 @@ class Dispatchable {
|
|
|
2367
2458
|
get status() {
|
|
2368
2459
|
return this.computedStatus;
|
|
2369
2460
|
}
|
|
2461
|
+
computedType;
|
|
2370
2462
|
setType(type) {
|
|
2371
2463
|
this.computedType = type;
|
|
2372
2464
|
return this;
|
|
2373
2465
|
}
|
|
2466
|
+
computedCancelled;
|
|
2374
2467
|
dispatch(options = {}) {
|
|
2375
2468
|
const { target = window, ...rest } = options, event = toEvent(this.type, rest);
|
|
2376
2469
|
this.computedCancelled = !target.dispatchEvent(event);
|
|
@@ -2386,11 +2479,14 @@ const defaultOptions$3 = {
|
|
|
2386
2479
|
toD: (stroke) => stroke.length === 0 ? "" : toD(stroke)
|
|
2387
2480
|
};
|
|
2388
2481
|
class Drawable {
|
|
2482
|
+
computedD;
|
|
2483
|
+
toD;
|
|
2389
2484
|
constructor(stroke, options = {}) {
|
|
2390
2485
|
this.toD = options?.toD || defaultOptions$3.toD;
|
|
2391
2486
|
this.setStroke(stroke);
|
|
2392
2487
|
this.ready();
|
|
2393
2488
|
}
|
|
2489
|
+
computedStatus;
|
|
2394
2490
|
ready() {
|
|
2395
2491
|
this.computedStatus = "ready";
|
|
2396
2492
|
}
|
|
@@ -2406,6 +2502,7 @@ class Drawable {
|
|
|
2406
2502
|
get d() {
|
|
2407
2503
|
return this.computedD;
|
|
2408
2504
|
}
|
|
2505
|
+
computedStroke;
|
|
2409
2506
|
setStroke(stroke) {
|
|
2410
2507
|
this.computedStroke = stroke;
|
|
2411
2508
|
this.computedD = this.toD(stroke);
|
|
@@ -2447,6 +2544,7 @@ class Resolveable {
|
|
|
2447
2544
|
this.setGetPromise(getPromise);
|
|
2448
2545
|
this.ready();
|
|
2449
2546
|
}
|
|
2547
|
+
computedStatus;
|
|
2450
2548
|
ready() {
|
|
2451
2549
|
this.computedStatus = "ready";
|
|
2452
2550
|
}
|
|
@@ -2462,10 +2560,12 @@ class Resolveable {
|
|
|
2462
2560
|
get value() {
|
|
2463
2561
|
return this.computedValue;
|
|
2464
2562
|
}
|
|
2563
|
+
computedGetPromise;
|
|
2465
2564
|
setGetPromise(getPromise) {
|
|
2466
2565
|
this.computedGetPromise = getPromise;
|
|
2467
2566
|
return this;
|
|
2468
2567
|
}
|
|
2568
|
+
computedValue;
|
|
2469
2569
|
async resolve(...args) {
|
|
2470
2570
|
this.resolving();
|
|
2471
2571
|
try {
|
|
@@ -2490,6 +2590,11 @@ class Resolveable {
|
|
|
2490
2590
|
}
|
|
2491
2591
|
|
|
2492
2592
|
class Fetchable {
|
|
2593
|
+
computedArrayBuffer;
|
|
2594
|
+
computedBlob;
|
|
2595
|
+
computedFormData;
|
|
2596
|
+
computedJson;
|
|
2597
|
+
computedText;
|
|
2493
2598
|
constructor(resource, options = {}) {
|
|
2494
2599
|
this.setResource(resource);
|
|
2495
2600
|
this.computedArrayBuffer = new Resolveable(async () => "arrayBuffer" in this.response ? await this.response.arrayBuffer() : await void 0);
|
|
@@ -2499,6 +2604,7 @@ class Fetchable {
|
|
|
2499
2604
|
this.computedText = new Resolveable(async () => "text" in this.response ? await this.response.text() : await void 0);
|
|
2500
2605
|
this.ready();
|
|
2501
2606
|
}
|
|
2607
|
+
computedStatus;
|
|
2502
2608
|
ready() {
|
|
2503
2609
|
this.computedStatus = "ready";
|
|
2504
2610
|
}
|
|
@@ -2508,6 +2614,7 @@ class Fetchable {
|
|
|
2508
2614
|
set resource(resource) {
|
|
2509
2615
|
this.setResource(resource);
|
|
2510
2616
|
}
|
|
2617
|
+
computedAbortController;
|
|
2511
2618
|
get abortController() {
|
|
2512
2619
|
if (!this.computedAbortController) {
|
|
2513
2620
|
this.computedAbortController = new AbortController();
|
|
@@ -2553,10 +2660,13 @@ class Fetchable {
|
|
|
2553
2660
|
return resolveable;
|
|
2554
2661
|
}
|
|
2555
2662
|
}
|
|
2663
|
+
computedResource;
|
|
2556
2664
|
setResource(resource) {
|
|
2557
2665
|
this.computedResource = resource;
|
|
2558
2666
|
return this;
|
|
2559
2667
|
}
|
|
2668
|
+
computedResponse;
|
|
2669
|
+
computedError;
|
|
2560
2670
|
async fetch(options = {}) {
|
|
2561
2671
|
this.computedStatus = "fetching";
|
|
2562
2672
|
try {
|
|
@@ -2611,6 +2721,7 @@ class Fullscreenable {
|
|
|
2611
2721
|
this.setGetElement(getElement);
|
|
2612
2722
|
this.ready();
|
|
2613
2723
|
}
|
|
2724
|
+
computedStatus;
|
|
2614
2725
|
ready() {
|
|
2615
2726
|
this.computedStatus = "ready";
|
|
2616
2727
|
}
|
|
@@ -2629,6 +2740,7 @@ class Fullscreenable {
|
|
|
2629
2740
|
get error() {
|
|
2630
2741
|
return this.computedError;
|
|
2631
2742
|
}
|
|
2743
|
+
computedGetElement;
|
|
2632
2744
|
setGetElement(getElement) {
|
|
2633
2745
|
this.computedGetElement = () => getElement();
|
|
2634
2746
|
return this;
|
|
@@ -2637,6 +2749,7 @@ class Fullscreenable {
|
|
|
2637
2749
|
await this.fullscreen(options);
|
|
2638
2750
|
return this;
|
|
2639
2751
|
}
|
|
2752
|
+
computedError;
|
|
2640
2753
|
async fullscreen(options = {}) {
|
|
2641
2754
|
try {
|
|
2642
2755
|
await this.element.requestFullscreen(options);
|
|
@@ -2673,6 +2786,7 @@ class Grantable {
|
|
|
2673
2786
|
this.setDescriptor(descriptor);
|
|
2674
2787
|
this.ready();
|
|
2675
2788
|
}
|
|
2789
|
+
computedStatus;
|
|
2676
2790
|
ready() {
|
|
2677
2791
|
this.computedStatus = "ready";
|
|
2678
2792
|
}
|
|
@@ -2688,10 +2802,12 @@ class Grantable {
|
|
|
2688
2802
|
get status() {
|
|
2689
2803
|
return this.computedStatus;
|
|
2690
2804
|
}
|
|
2805
|
+
computedDescriptor;
|
|
2691
2806
|
setDescriptor(descriptor) {
|
|
2692
2807
|
this.computedDescriptor = descriptor;
|
|
2693
2808
|
return this;
|
|
2694
2809
|
}
|
|
2810
|
+
computedPermission;
|
|
2695
2811
|
async query() {
|
|
2696
2812
|
this.querying();
|
|
2697
2813
|
try {
|
|
@@ -2728,15 +2844,18 @@ class Navigateable {
|
|
|
2728
2844
|
this.navigate(options?.initialLocation ?? defaultOptions$2.initialLocation);
|
|
2729
2845
|
this.ready();
|
|
2730
2846
|
}
|
|
2847
|
+
computedStatus;
|
|
2731
2848
|
ready() {
|
|
2732
2849
|
this.computedStatus = "ready";
|
|
2733
2850
|
}
|
|
2851
|
+
computedArray;
|
|
2734
2852
|
get array() {
|
|
2735
2853
|
return this.computedArray;
|
|
2736
2854
|
}
|
|
2737
2855
|
set array(value) {
|
|
2738
2856
|
this.setArray(value);
|
|
2739
2857
|
}
|
|
2858
|
+
computedLocation;
|
|
2740
2859
|
get location() {
|
|
2741
2860
|
return this.computedLocation;
|
|
2742
2861
|
}
|
|
@@ -2860,29 +2979,33 @@ const defaultOptions$1 = {
|
|
|
2860
2979
|
};
|
|
2861
2980
|
class Pickable {
|
|
2862
2981
|
constructor(array, options = {}) {
|
|
2863
|
-
this.toItems = createMap((index) => this.array[index]);
|
|
2864
2982
|
this.setArray(array);
|
|
2865
2983
|
this.pick(options.initialPicks ?? defaultOptions$1.initialPicks);
|
|
2866
2984
|
this.ready();
|
|
2867
2985
|
}
|
|
2986
|
+
computedStatus;
|
|
2868
2987
|
ready() {
|
|
2869
2988
|
this.computedStatus = "ready";
|
|
2870
2989
|
}
|
|
2990
|
+
computedArray;
|
|
2871
2991
|
get array() {
|
|
2872
2992
|
return this.computedArray;
|
|
2873
2993
|
}
|
|
2874
2994
|
set array(array) {
|
|
2875
2995
|
this.setArray(array);
|
|
2876
2996
|
}
|
|
2997
|
+
computedPicks;
|
|
2877
2998
|
get picks() {
|
|
2878
2999
|
return this.computedPicks;
|
|
2879
3000
|
}
|
|
2880
3001
|
set picks(indices) {
|
|
2881
3002
|
this.pick(indices);
|
|
2882
3003
|
}
|
|
3004
|
+
computedFirst;
|
|
2883
3005
|
get first() {
|
|
2884
3006
|
return this.computedFirst;
|
|
2885
3007
|
}
|
|
3008
|
+
computedLast;
|
|
2886
3009
|
get last() {
|
|
2887
3010
|
return this.computedLast;
|
|
2888
3011
|
}
|
|
@@ -2898,9 +3021,11 @@ class Pickable {
|
|
|
2898
3021
|
get items() {
|
|
2899
3022
|
return this.toItems(this.picks);
|
|
2900
3023
|
}
|
|
3024
|
+
toItems = createMap((index) => this.array[index]);
|
|
2901
3025
|
get multiple() {
|
|
2902
3026
|
return this.picks.length > 1;
|
|
2903
3027
|
}
|
|
3028
|
+
toPossiblePicks;
|
|
2904
3029
|
setArray(array) {
|
|
2905
3030
|
this.computedArray = array;
|
|
2906
3031
|
this.toPossiblePicks = createFilter((index) => index >= 0 && index < array.length);
|
|
@@ -2976,11 +3101,14 @@ function ensureIndices(indexOrIndices) {
|
|
|
2976
3101
|
const toUnique = createUnique();
|
|
2977
3102
|
|
|
2978
3103
|
class Sanitizeable {
|
|
3104
|
+
domPurifyConfig;
|
|
2979
3105
|
constructor(html, options) {
|
|
2980
3106
|
this.computedHtml = html;
|
|
2981
3107
|
this.domPurifyConfig = options;
|
|
2982
3108
|
this.ready();
|
|
2983
3109
|
}
|
|
3110
|
+
computedDompurify;
|
|
3111
|
+
computedStatus;
|
|
2984
3112
|
ready() {
|
|
2985
3113
|
if (domIsAvailable()) {
|
|
2986
3114
|
this.computedDompurify = createDOMPurify();
|
|
@@ -3004,6 +3132,7 @@ class Sanitizeable {
|
|
|
3004
3132
|
get status() {
|
|
3005
3133
|
return this.computedStatus;
|
|
3006
3134
|
}
|
|
3135
|
+
computedHtml;
|
|
3007
3136
|
setHtml(html) {
|
|
3008
3137
|
this.computedHtml = html;
|
|
3009
3138
|
return this;
|
|
@@ -3019,15 +3148,19 @@ class Sanitizeable {
|
|
|
3019
3148
|
}
|
|
3020
3149
|
|
|
3021
3150
|
class Searchable {
|
|
3151
|
+
searcherOptions;
|
|
3152
|
+
computedResults;
|
|
3022
3153
|
constructor(candidates, options = {}) {
|
|
3023
3154
|
this.searcherOptions = options;
|
|
3024
3155
|
this.setCandidates(candidates);
|
|
3025
3156
|
this.computedResults = [];
|
|
3026
3157
|
this.ready();
|
|
3027
3158
|
}
|
|
3159
|
+
computedStatus;
|
|
3028
3160
|
ready() {
|
|
3029
3161
|
this.computedStatus = "ready";
|
|
3030
3162
|
}
|
|
3163
|
+
computedCandidates;
|
|
3031
3164
|
get candidates() {
|
|
3032
3165
|
return this.computedCandidates;
|
|
3033
3166
|
}
|
|
@@ -3043,6 +3176,7 @@ class Searchable {
|
|
|
3043
3176
|
get status() {
|
|
3044
3177
|
return this.computedStatus;
|
|
3045
3178
|
}
|
|
3179
|
+
computedSearcher;
|
|
3046
3180
|
setCandidates(candidates) {
|
|
3047
3181
|
this.computedCandidates = Array.from(candidates);
|
|
3048
3182
|
this.computedSearcher = new Searcher(candidates, this.searcherOptions);
|
|
@@ -3063,6 +3197,8 @@ const defaultOptions = {
|
|
|
3063
3197
|
statusKeySuffix: " status"
|
|
3064
3198
|
};
|
|
3065
3199
|
class Storeable {
|
|
3200
|
+
type;
|
|
3201
|
+
statusKeySuffix;
|
|
3066
3202
|
constructor(key, options = {}) {
|
|
3067
3203
|
this.constructing();
|
|
3068
3204
|
this.type = options.type ?? defaultOptions.type;
|
|
@@ -3073,6 +3209,7 @@ class Storeable {
|
|
|
3073
3209
|
constructing() {
|
|
3074
3210
|
this.computedStatus = "constructing";
|
|
3075
3211
|
}
|
|
3212
|
+
computedStatus;
|
|
3076
3213
|
ready() {
|
|
3077
3214
|
this.computedStatus = "ready";
|
|
3078
3215
|
if (domIsAvailable()) {
|
|
@@ -3110,6 +3247,8 @@ class Storeable {
|
|
|
3110
3247
|
get error() {
|
|
3111
3248
|
return this.computedError;
|
|
3112
3249
|
}
|
|
3250
|
+
computedKey;
|
|
3251
|
+
computedStatusKey;
|
|
3113
3252
|
setKey(key) {
|
|
3114
3253
|
let string;
|
|
3115
3254
|
switch (this.status) {
|
|
@@ -3135,6 +3274,8 @@ class Storeable {
|
|
|
3135
3274
|
}
|
|
3136
3275
|
return this;
|
|
3137
3276
|
}
|
|
3277
|
+
computedString;
|
|
3278
|
+
computedError;
|
|
3138
3279
|
store(string) {
|
|
3139
3280
|
try {
|
|
3140
3281
|
this.storage.setItem(this.key, string);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baleada/logic",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.33",
|
|
4
4
|
"description": "UI logic for the Baleada toolkit",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -44,16 +44,16 @@
|
|
|
44
44
|
"homepage": "https://baleada.netlify.com",
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@baleada/animateable-utils": "^0.0.2",
|
|
47
|
-
"@baleada/prepare": "^0.5.
|
|
47
|
+
"@baleada/prepare": "^0.5.20",
|
|
48
48
|
"@types/node": "^14.14.41",
|
|
49
49
|
"@vue/compiler-sfc": "^3.2.9",
|
|
50
50
|
"esbuild": "^0.9.7",
|
|
51
51
|
"esbuild-register": "^2.6.0",
|
|
52
52
|
"rollup": "^2.56.3",
|
|
53
53
|
"tailwindcss": "^2.1.1",
|
|
54
|
-
"typescript": "^4.
|
|
54
|
+
"typescript": "^4.5.5",
|
|
55
55
|
"uvu": "^0.5.1",
|
|
56
|
-
"vite": "^2.
|
|
56
|
+
"vite": "^2.7.2",
|
|
57
57
|
"vue": "^3.2.12",
|
|
58
58
|
"vue-router": "^4.0.3"
|
|
59
59
|
},
|