@floegence/floe-webapp-core 0.35.47 → 0.35.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.
@@ -8,6 +8,8 @@ export interface ParsedKeybind {
8
8
  shift: boolean;
9
9
  key: string;
10
10
  }
11
+ export declare function isMacLikePlatform(): boolean;
12
+ export declare function isPrimaryModKeyPressed(event: Pick<KeyboardEvent | MouseEvent, 'metaKey' | 'ctrlKey'>): boolean;
11
13
  /**
12
14
  * Parse a keybind string like "mod+k" or "ctrl+shift+p"
13
15
  */
@@ -1,29 +1,37 @@
1
- const r = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/.test(navigator.userAgent);
2
- function o(s) {
3
- const t = s.toLowerCase().split("+"), e = t.pop() || "";
1
+ const a = /Mac|iPhone|iPad|iPod/;
2
+ function n() {
3
+ return typeof navigator < "u" && a.test(navigator.userAgent);
4
+ }
5
+ function c(e) {
6
+ return n() ? e.metaKey : e.ctrlKey;
7
+ }
8
+ function o(e) {
9
+ const t = e.toLowerCase().split("+"), r = t.pop() || "";
4
10
  return {
5
11
  mod: t.includes("mod"),
6
12
  ctrl: t.includes("ctrl"),
7
13
  alt: t.includes("alt"),
8
14
  shift: t.includes("shift"),
9
- key: e
15
+ key: r
10
16
  };
11
17
  }
12
- function c(s, t) {
13
- const e = typeof t == "string" ? o(t) : t, i = r ? s.metaKey : s.ctrlKey, n = s.key.toLowerCase();
14
- return e.mod && !i || !e.mod && e.ctrl && !s.ctrlKey || e.alt && !s.altKey || e.shift && !s.shiftKey ? !1 : n === e.key;
18
+ function l(e, t) {
19
+ const r = typeof t == "string" ? o(t) : t, s = c(e), i = e.key.toLowerCase();
20
+ return r.mod && !s || !r.mod && r.ctrl && !e.ctrlKey || r.alt && !e.altKey || r.shift && !e.shiftKey ? !1 : i === r.key;
15
21
  }
16
- function l(s) {
17
- const t = o(s), e = [];
18
- t.mod && e.push(r ? "⌘" : "Ctrl"), t.ctrl && !t.mod && e.push(r ? "⌃" : "Ctrl"), t.alt && e.push(r ? "⌥" : "Alt"), t.shift && e.push(r ? "⇧" : "Shift");
19
- const i = t.key.length === 1 ? t.key.toUpperCase() : a(t.key);
20
- return e.push(i), e.join(r ? "" : "+");
22
+ function u(e) {
23
+ const t = o(e), r = [], s = n();
24
+ t.mod && r.push(s ? "⌘" : "Ctrl"), t.ctrl && !t.mod && r.push(s ? "⌃" : "Ctrl"), t.alt && r.push(s ? "⌥" : "Alt"), t.shift && r.push(s ? "⇧" : "Shift");
25
+ const i = t.key.length === 1 ? t.key.toUpperCase() : f(t.key);
26
+ return r.push(i), r.join(s ? "" : "+");
21
27
  }
22
- function a(s) {
23
- return s.charAt(0).toUpperCase() + s.slice(1);
28
+ function f(e) {
29
+ return e.charAt(0).toUpperCase() + e.slice(1);
24
30
  }
25
31
  export {
26
- l as formatKeybind,
27
- c as matchKeybind,
32
+ u as formatKeybind,
33
+ n as isMacLikePlatform,
34
+ c as isPrimaryModKeyPressed,
35
+ l as matchKeybind,
28
36
  o as parseKeybind
29
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.35.47",
3
+ "version": "0.35.49",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",