react-better-hotkeys 0.6.0 → 0.6.1

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.
@@ -25,11 +25,11 @@ class p {
25
25
  }
26
26
  buildInitialMap() {
27
27
  return {
28
- ...Object.entries(a).reduce((t, e) => (e[1].on === "code" && (t[e[0]] = e[1].value.length === 1 ? e[1].value.toUpperCase() : e[1].value), t), {}),
28
+ ...Object.entries(a).reduce((t, e) => (e[1].on === "code" && (t[e[0]] = e[1].value.length === 1 ? e[1].value.toLocaleUpperCase() : e[1].value), t), {}),
29
29
  ...Object.entries(a).reduce((t, e) => {
30
30
  if (e[1].on === "key") {
31
31
  const s = e[0].slice(3);
32
- t[s] = e[1].value.length === 1 ? e[1].value.toUpperCase() : e[1].value;
32
+ t[s] = e[1].value.length === 1 ? e[1].value.toLocaleUpperCase() : e[1].value;
33
33
  }
34
34
  return t;
35
35
  }, {})
@@ -17,21 +17,24 @@ function q(o, d, v) {
17
17
  }),
18
18
  [v]
19
19
  ), a = p(
20
- (e) => w(e) ? r?.textResolver.resolve(e) ?? [
21
- x[`Key${e}`].value,
22
- "unknown"
23
- ] : [x[e].value, "unknown"],
20
+ (t) => {
21
+ let e = w(t) ? r?.textResolver.resolve(t) ?? [
22
+ x[`Key${t}`].value,
23
+ "unknown"
24
+ ] : [x[t].value, "unknown"];
25
+ return e[0].length === 1 && (e = [e[0].toLocaleUpperCase(), e[1]]), e;
26
+ },
24
27
  [r?.textResolver]
25
28
  ), c = p(
26
- (e, t) => {
29
+ (t, e) => {
27
30
  const i = {
28
- ...e,
31
+ ...t,
29
32
  options: l,
30
- id: t == null ? n : `${n}-${t}`,
33
+ id: e == null ? n : `${n}-${e}`,
31
34
  callbackRef: f,
32
35
  toParts: () => [
33
- e.keys.map((u) => a(u)),
34
- r?.textResolver.delimiterForType(e.type) ?? ""
36
+ t.keys.map((u) => a(u)),
37
+ r?.textResolver.delimiterForType(t.type) ?? ""
35
38
  ],
36
39
  toString: () => r?.textResolver.toString(i) ?? ""
37
40
  };
@@ -39,25 +42,25 @@ function q(o, d, v) {
39
42
  },
40
43
  [l, r?.textResolver, n, a]
41
44
  ), y = p(
42
- (e, t) => {
45
+ (t, e) => {
43
46
  const i = {
44
- ...e,
47
+ ...t,
45
48
  options: l,
46
- id: t == null ? n : `${n}-${t}`,
49
+ id: e == null ? n : `${n}-${e}`,
47
50
  callbackRef: f,
48
51
  toParts: () => [
49
52
  [
50
- ...Object.entries(e.modifier).filter((u) => u[1]).map((u) => [u[0], "valid"]),
51
- a(e.keyId)
53
+ ...Object.entries(t.modifier).filter((u) => u[1]).map((u) => [u[0], "valid"]),
54
+ a(t.keyId)
52
55
  ],
53
- r?.textResolver.delimiterForType(e.type) ?? ""
56
+ r?.textResolver.delimiterForType(t.type) ?? ""
54
57
  ],
55
58
  toString: () => r?.textResolver.toString(i) ?? ""
56
59
  };
57
60
  return i;
58
61
  },
59
62
  [l, r?.textResolver, n, a]
60
- ), s = m(() => o == null ? [] : Array.isArray(o) ? o.map((e, t) => e.type === "chord" ? y(e, t) : c(e, t)) : o.type === "chord" ? y(o) : c(o), [y, c, o]);
63
+ ), s = m(() => o == null ? [] : Array.isArray(o) ? o.map((t, e) => t.type === "chord" ? y(t, e) : c(t, e)) : o.type === "chord" ? y(o) : c(o), [y, c, o]);
61
64
  return $(() => {
62
65
  if (r == null) {
63
66
  console.warn(
@@ -65,12 +68,12 @@ function q(o, d, v) {
65
68
  );
66
69
  return;
67
70
  }
68
- const e = Array.isArray(s) ? s : [s];
69
- return e.forEach((t) => {
70
- t.type === "chord" ? r.registry.addChordHotkey(t) : r.registry.addSequenceHotkey(t);
71
+ const t = Array.isArray(s) ? s : [s];
72
+ return t.forEach((e) => {
73
+ e.type === "chord" ? r.registry.addChordHotkey(e) : r.registry.addSequenceHotkey(e);
71
74
  }), () => {
72
- e.forEach((t) => {
73
- t.type === "chord" ? r.registry.removeChordHotkey(t.id) : r.registry.removeSequenceHotkey(t.id);
75
+ t.forEach((e) => {
76
+ e.type === "chord" ? r.registry.removeChordHotkey(e.id) : r.registry.removeSequenceHotkey(e.id);
74
77
  });
75
78
  };
76
79
  }, [s]), o ? s : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-better-hotkeys",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "author": "Christopher Haindl",
6
6
  "repository": {