sia-reactor 0.0.48 → 0.0.49

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.
@@ -2,9 +2,9 @@ import {
2
2
  Autotracker,
3
3
  TimeTravelConsole,
4
4
  withTracker
5
- } from "../chunk-IYAWNLD2.js";
6
- import "../chunk-3IIYJ6B4.js";
7
- import "../chunk-U4SR3CZF.js";
5
+ } from "../chunk-ZTUAHMMN.js";
6
+ import "../chunk-GC754LMW.js";
7
+ import "../chunk-2EAHPVH6.js";
8
8
  import {
9
9
  CTX,
10
10
  NIL,
@@ -1103,29 +1103,29 @@ function cleanKeyCombo(combo, mods = KEYS_MODS) {
1103
1103
  };
1104
1104
  return Array.isArray(combo) ? combo.map(clean) : clean(combo);
1105
1105
  }
1106
- function matchKeys(required, actual, strict = false, clean = true) {
1106
+ function matchKeys(required, actual, strict = false, clean = true, allowedMods) {
1107
1107
  if (clean) actual = cleanKeyCombo(actual);
1108
1108
  const match = (req, actual2) => {
1109
1109
  req = cleanKeyCombo(req);
1110
1110
  if (strict) return req === actual2;
1111
1111
  const reqs = req.split("+"), reals = actual2.split("+");
1112
- for (const mod of KEYS_CMODS) if (reals.includes(mod) && !reqs.includes(mod)) return false;
1112
+ for (const mod of KEYS_CMODS) if (reals.includes(mod) && !reqs.includes(mod) && !allowedMods?.includes(mod)) return false;
1113
1113
  return reqs.every((k) => reals.includes(k));
1114
1114
  };
1115
1115
  return Array.isArray(required) ? required.some((req) => match(req, actual)) : match(required, actual);
1116
1116
  }
1117
1117
  function getTermsForKey(combo, settings) {
1118
- const terms = { override: false, block: false, whitelisted: false, action: null }, { overrides = [], shortcuts = {}, blocks = [], strictMatch: stm = false, rankedMatch: ram = true, whitelist = [] } = settings || {};
1118
+ const terms = { override: false, block: false, whitelisted: false, action: null }, { overrides = [], shortcuts = {}, blocks = [], strictMatch: stm = false, rankedMatch: ram = true, whitelist = [], moddedlist = [] } = settings || {};
1119
1119
  combo = cleanKeyCombo(combo);
1120
1120
  if (matchKeys(overrides, combo, stm, false)) terms.override = true;
1121
1121
  if (matchKeys(blocks, combo, stm, false)) terms.block = true;
1122
- if (matchKeys(whitelist, combo, false)) terms.whitelisted = true;
1123
- if (!ram) return terms.action = Object.keys(shortcuts).find((id) => shortcuts[id] && matchKeys(shortcuts[id], combo, stm, false)) || null, terms;
1122
+ if (whitelist.some((w) => matchKeys(w, combo, false, true, moddedlist.includes(cleanKeyCombo(w)) ? KEYS_CMODS : void 0))) terms.whitelisted = true;
1123
+ if (!ram) return terms.action = Object.keys(shortcuts).find((id) => shortcuts[id] && matchKeys(shortcuts[id], combo, stm, false, moddedlist.includes(id) ? KEYS_CMODS : void 0)) || null, terms;
1124
1124
  let bestA = null, bestE = false, bestL = 0;
1125
1125
  for (const id of Object.keys(shortcuts))
1126
1126
  for (const c of Array.isArray(shortcuts[id]) ? shortcuts[id] : [shortcuts[id]]) {
1127
1127
  const req = c && cleanKeyCombo(c), isE = req === combo, len = req ? req.split("+").length : 0;
1128
- if (c && matchKeys(req, combo, stm, false) && (!bestA || isE && !bestE || isE === bestE && len > bestL)) bestA = id, bestE = isE, bestL = len;
1128
+ if (c && matchKeys(req, combo, stm, false, moddedlist.includes(id) ? KEYS_CMODS : void 0) && (!bestA || isE && !bestE || isE === bestE && len > bestL)) bestA = id, bestE = isE, bestL = len;
1129
1129
  }
1130
1130
  return terms.action = bestA, terms;
1131
1131
  }