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.
@@ -1183,29 +1183,29 @@ function cleanKeyCombo(combo, mods = KEYS_MODS) {
1183
1183
  };
1184
1184
  return Array.isArray(combo) ? combo.map(clean) : clean(combo);
1185
1185
  }
1186
- function matchKeys(required, actual, strict = false, clean = true) {
1186
+ function matchKeys(required, actual, strict = false, clean = true, allowedMods) {
1187
1187
  if (clean) actual = cleanKeyCombo(actual);
1188
1188
  const match = (req, actual2) => {
1189
1189
  req = cleanKeyCombo(req);
1190
1190
  if (strict) return req === actual2;
1191
1191
  const reqs = req.split("+"), reals = actual2.split("+");
1192
- for (const mod of KEYS_CMODS) if (reals.includes(mod) && !reqs.includes(mod)) return false;
1192
+ for (const mod of KEYS_CMODS) if (reals.includes(mod) && !reqs.includes(mod) && !allowedMods?.includes(mod)) return false;
1193
1193
  return reqs.every((k) => reals.includes(k));
1194
1194
  };
1195
1195
  return Array.isArray(required) ? required.some((req) => match(req, actual)) : match(required, actual);
1196
1196
  }
1197
1197
  function getTermsForKey(combo, settings) {
1198
- const terms = { override: false, block: false, whitelisted: false, action: null }, { overrides = [], shortcuts = {}, blocks = [], strictMatch: stm = false, rankedMatch: ram = true, whitelist = [] } = settings || {};
1198
+ const terms = { override: false, block: false, whitelisted: false, action: null }, { overrides = [], shortcuts = {}, blocks = [], strictMatch: stm = false, rankedMatch: ram = true, whitelist = [], moddedlist = [] } = settings || {};
1199
1199
  combo = cleanKeyCombo(combo);
1200
1200
  if (matchKeys(overrides, combo, stm, false)) terms.override = true;
1201
1201
  if (matchKeys(blocks, combo, stm, false)) terms.block = true;
1202
- if (matchKeys(whitelist, combo, false)) terms.whitelisted = true;
1203
- if (!ram) return terms.action = Object.keys(shortcuts).find((id) => shortcuts[id] && matchKeys(shortcuts[id], combo, stm, false)) || null, terms;
1202
+ if (whitelist.some((w) => matchKeys(w, combo, false, true, moddedlist.includes(cleanKeyCombo(w)) ? KEYS_CMODS : void 0))) terms.whitelisted = true;
1203
+ 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;
1204
1204
  let bestA = null, bestE = false, bestL = 0;
1205
1205
  for (const id of Object.keys(shortcuts))
1206
1206
  for (const c of Array.isArray(shortcuts[id]) ? shortcuts[id] : [shortcuts[id]]) {
1207
1207
  const req = c && cleanKeyCombo(c), isE = req === combo, len = req ? req.split("+").length : 0;
1208
- if (c && matchKeys(req, combo, stm, false) && (!bestA || isE && !bestE || isE === bestE && len > bestL)) bestA = id, bestE = isE, bestL = len;
1208
+ 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;
1209
1209
  }
1210
1210
  return terms.action = bestA, terms;
1211
1211
  }