ssovee-os-web-ui 0.1.79 → 0.1.81

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/dist/index.cjs CHANGED
@@ -1619,30 +1619,45 @@ var Tooltip_default = Tooltip;
1619
1619
  var keyMap = {
1620
1620
  mac: {
1621
1621
  ctrl: "\u2318",
1622
+ cmd: "\u2318",
1623
+ meta: "\u2318",
1622
1624
  alt: "\u2325",
1625
+ option: "\u2325",
1623
1626
  shift: "\u21E7",
1624
1627
  enter: "\u23CE",
1625
1628
  backspace: "\u232B",
1626
1629
  arrowup: "\u2191",
1627
- arrowdown: "\u2193"
1630
+ arrowdown: "\u2193",
1631
+ arrowleft: "\u2190",
1632
+ arrowright: "\u2192"
1628
1633
  },
1629
1634
  windows: {
1630
1635
  ctrl: "Ctrl",
1636
+ cmd: "Ctrl",
1637
+ meta: "Win",
1631
1638
  alt: "Alt",
1639
+ option: "Alt",
1632
1640
  shift: "Shift",
1633
1641
  enter: "Enter",
1634
1642
  backspace: "Backspace",
1635
1643
  arrowup: "\u2191",
1636
- arrowdown: "\u2193"
1644
+ arrowdown: "\u2193",
1645
+ arrowleft: "\u2190",
1646
+ arrowright: "\u2192"
1637
1647
  },
1638
1648
  linux: {
1639
1649
  ctrl: "Ctrl",
1650
+ cmd: "Ctrl",
1651
+ meta: "Super",
1640
1652
  alt: "Alt",
1653
+ option: "Alt",
1641
1654
  shift: "Shift",
1642
1655
  enter: "Enter",
1643
1656
  backspace: "Backspace",
1644
1657
  arrowup: "\u2191",
1645
- arrowdown: "\u2193"
1658
+ arrowdown: "\u2193",
1659
+ arrowleft: "\u2190",
1660
+ arrowright: "\u2192"
1646
1661
  }
1647
1662
  };
1648
1663
  var detectOS = () => {
@@ -1672,7 +1687,7 @@ var matchShortcut = (event, shortcut, os) => {
1672
1687
  };
1673
1688
  var useShortcutFormatter = ({
1674
1689
  globalKeyboardShortcuts: globalKeyboardShortcuts2 = []
1675
- }) => {
1690
+ } = {}) => {
1676
1691
  const [os, setOS] = React23.useState("windows");
1677
1692
  const listenersRef = React23.useRef(
1678
1693
  /* @__PURE__ */ new Map()
@@ -1681,11 +1696,12 @@ var useShortcutFormatter = ({
1681
1696
  setOS(detectOS());
1682
1697
  }, []);
1683
1698
  React23.useEffect(() => {
1699
+ if (!globalKeyboardShortcuts2.length) return;
1684
1700
  const handleKeyDown = (event) => {
1685
1701
  for (const shortcut of globalKeyboardShortcuts2) {
1686
1702
  if (matchShortcut(event, shortcut.shortcut, os)) {
1687
1703
  const listeners = listenersRef.current.get(shortcut.command);
1688
- if (listeners) {
1704
+ if (listeners && listeners.size > 0) {
1689
1705
  event.preventDefault();
1690
1706
  listeners.forEach((cb) => cb(event));
1691
1707
  }
@@ -1696,25 +1712,38 @@ var useShortcutFormatter = ({
1696
1712
  return () => {
1697
1713
  window.removeEventListener("keydown", handleKeyDown);
1698
1714
  };
1699
- }, [os]);
1700
- const formatKeys = (keys = []) => {
1701
- return keys.map((key) => keyMap[os][key.toLowerCase()] || key.toUpperCase()).join(" + ");
1702
- };
1703
- const getShortcutByCommand = (command) => {
1704
- const found = globalKeyboardShortcuts2.find((s) => s.command === command);
1705
- return found ? found.shortcut : [""];
1706
- };
1707
- const addShortcutListener = (command, listener) => {
1708
- if (!listenersRef.current.has(command)) {
1709
- listenersRef.current.set(command, /* @__PURE__ */ new Set());
1710
- }
1711
- listenersRef.current.get(command).add(listener);
1712
- };
1713
- const removeShortcutListener = (command, listener) => {
1714
- if (listenersRef.current.has(command)) {
1715
- listenersRef.current.get(command).delete(listener);
1716
- }
1717
- };
1715
+ }, [os, globalKeyboardShortcuts2]);
1716
+ const formatKeys = React23.useCallback(
1717
+ (keys = []) => {
1718
+ const separator = os === "mac" ? "" : " + ";
1719
+ return keys.map((key) => keyMap[os][key.toLowerCase()] || key.toUpperCase()).join(separator);
1720
+ },
1721
+ [os]
1722
+ );
1723
+ const getShortcutByCommand = React23.useCallback(
1724
+ (command) => {
1725
+ const found = globalKeyboardShortcuts2.find((s) => s.command === command);
1726
+ return found ? found.shortcut : [];
1727
+ },
1728
+ [globalKeyboardShortcuts2]
1729
+ );
1730
+ const addShortcutListener = React23.useCallback(
1731
+ (command, listener) => {
1732
+ if (!listenersRef.current.has(command)) {
1733
+ listenersRef.current.set(command, /* @__PURE__ */ new Set());
1734
+ }
1735
+ listenersRef.current.get(command).add(listener);
1736
+ },
1737
+ []
1738
+ );
1739
+ const removeShortcutListener = React23.useCallback(
1740
+ (command, listener) => {
1741
+ if (listenersRef.current.has(command)) {
1742
+ listenersRef.current.get(command).delete(listener);
1743
+ }
1744
+ },
1745
+ []
1746
+ );
1718
1747
  return {
1719
1748
  formatKeys,
1720
1749
  getShortcutByCommand,