reaxify 0.0.83 → 0.0.85
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/components/Badge/index.cjs.js +1 -1
- package/dist/components/Badge/index.es.js +12 -12
- package/dist/components/Drawer/index.cjs.js +1 -1
- package/dist/components/Drawer/index.d.ts +2 -4
- package/dist/components/Drawer/index.es.js +16 -21
- package/dist/components/Menu/index.cjs.js +1 -1
- package/dist/components/Menu/index.d.ts +3 -3
- package/dist/components/Menu/index.es.js +71 -77
- package/dist/components/Modal/index.cjs.js +1 -1
- package/dist/components/Modal/index.d.ts +2 -4
- package/dist/components/Modal/index.es.js +36 -41
- package/dist/helpers/scrollIntoView.cjs.js +1 -1
- package/dist/helpers/scrollIntoView.d.ts +1 -1
- package/dist/helpers/scrollIntoView.es.js +4 -3
- package/dist/hooks/index.cjs.js +1 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.es.js +6 -8
- package/dist/node_modules/@tanstack/hotkeys/dist/constants.cjs.js +1 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/constants.es.js +206 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/format.cjs.js +1 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/format.es.js +10 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/hotkey-manager.cjs.js +1 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/hotkey-manager.es.js +276 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/manager.utils.cjs.js +1 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/manager.utils.es.js +48 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/match.cjs.js +1 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/match.es.js +27 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/parse.cjs.js +1 -0
- package/dist/node_modules/@tanstack/hotkeys/dist/parse.es.js +72 -0
- package/dist/node_modules/@tanstack/react-hotkeys/dist/HotkeysProvider.cjs.js +1 -0
- package/dist/node_modules/@tanstack/react-hotkeys/dist/HotkeysProvider.es.js +10 -0
- package/dist/node_modules/@tanstack/react-hotkeys/dist/useHotkey.cjs.js +1 -0
- package/dist/node_modules/@tanstack/react-hotkeys/dist/useHotkey.es.js +35 -0
- package/dist/node_modules/@tanstack/react-hotkeys/dist/utils.cjs.js +1 -0
- package/dist/node_modules/@tanstack/react-hotkeys/dist/utils.es.js +7 -0
- package/dist/node_modules/@tanstack/store/dist/esm/alien.cjs.js +1 -0
- package/dist/node_modules/@tanstack/store/dist/esm/alien.es.js +129 -0
- package/dist/node_modules/@tanstack/store/dist/esm/atom.cjs.js +1 -0
- package/dist/node_modules/@tanstack/store/dist/esm/atom.es.js +124 -0
- package/dist/node_modules/@tanstack/store/dist/esm/store.cjs.js +1 -0
- package/dist/node_modules/@tanstack/store/dist/esm/store.es.js +24 -0
- package/dist/types/index.d.ts +2 -2
- package/package.json +4 -3
- package/dist/hooks/useKeyDown.cjs.js +0 -1
- package/dist/hooks/useKeyDown.d.ts +0 -6
- package/dist/hooks/useKeyDown.es.js +0 -17
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import
|
|
2
|
+
import { jsx as a, jsxs as C } from "react/jsx-runtime";
|
|
3
|
+
import b from "../../helpers/cn.es.js";
|
|
4
4
|
import l from "../../hooks/useClasses.es.js";
|
|
5
|
-
import { createContext as
|
|
6
|
-
import
|
|
7
|
-
import { twMerge as
|
|
5
|
+
import { createContext as M, useRef as N, useImperativeHandle as h, useContext as w, useMemo as H } from "react";
|
|
6
|
+
import { useHotkey as k } from "../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.es.js";
|
|
7
|
+
import { twMerge as y } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
|
|
8
8
|
import d from "../Card/index.es.js";
|
|
9
|
-
import
|
|
9
|
+
import D from "../Portal/index.es.js";
|
|
10
10
|
import S from "../../node_modules/react-transition-group/esm/Transition.es.js";
|
|
11
|
-
const v =
|
|
11
|
+
const v = M({
|
|
12
12
|
size: "md",
|
|
13
13
|
open: !1,
|
|
14
14
|
onClose: () => {
|
|
@@ -17,36 +17,31 @@ const v = w({
|
|
|
17
17
|
duration: 300
|
|
18
18
|
});
|
|
19
19
|
function u({
|
|
20
|
-
as:
|
|
20
|
+
as: t,
|
|
21
21
|
ref: o,
|
|
22
22
|
size: n = "md",
|
|
23
|
-
open:
|
|
24
|
-
onClose:
|
|
23
|
+
open: e = !1,
|
|
24
|
+
onClose: i = () => {
|
|
25
25
|
},
|
|
26
26
|
duration: r = 300,
|
|
27
27
|
className: p,
|
|
28
28
|
children: f,
|
|
29
29
|
...x
|
|
30
30
|
}) {
|
|
31
|
-
const m = l((c) => c.modal.base), s = N(null), g =
|
|
31
|
+
const m = l((c) => c.modal.base), s = N(null), g = t || "div", z = {
|
|
32
32
|
entering: "active opacity-100 pointer-events-auto",
|
|
33
33
|
entered: "active opacity-100 pointer-events-auto",
|
|
34
34
|
exiting: "opacity-0 pointer-events-none",
|
|
35
35
|
exited: "opacity-0 pointer-events-none",
|
|
36
36
|
unmounted: ""
|
|
37
37
|
};
|
|
38
|
-
return h(o, () => s.current), C(
|
|
39
|
-
() => {
|
|
40
|
-
a == null || a();
|
|
41
|
-
},
|
|
42
|
-
{ skip: !t, targetKey: "Escape" }
|
|
43
|
-
), /* @__PURE__ */ i(H, { children: /* @__PURE__ */ i(S, { nodeRef: s, in: t, timeout: r, unmountOnExit: !0, children: (c) => /* @__PURE__ */ M(
|
|
38
|
+
return h(o, () => s.current), k("Escape", () => i(), { enabled: e }), /* @__PURE__ */ a(D, { children: /* @__PURE__ */ a(S, { nodeRef: s, in: e, timeout: r, unmountOnExit: !0, children: (c) => /* @__PURE__ */ C(
|
|
44
39
|
g,
|
|
45
40
|
{
|
|
46
41
|
ref: s,
|
|
47
|
-
"data-open":
|
|
42
|
+
"data-open": e,
|
|
48
43
|
style: { transitionDuration: `${r}ms` },
|
|
49
|
-
className:
|
|
44
|
+
className: y(
|
|
50
45
|
"modal fixed size-full inset-0 flex flex-col z-10 bg-black/20 transition-opacity backdrop-blur p-4",
|
|
51
46
|
m,
|
|
52
47
|
z[c],
|
|
@@ -54,18 +49,18 @@ function u({
|
|
|
54
49
|
),
|
|
55
50
|
...x,
|
|
56
51
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ a(
|
|
58
53
|
"button",
|
|
59
54
|
{
|
|
60
55
|
type: "button",
|
|
61
|
-
onClick: () =>
|
|
56
|
+
onClick: () => i(),
|
|
62
57
|
className: "absolute inset-0 cursor-default opacity-0"
|
|
63
58
|
}
|
|
64
59
|
),
|
|
65
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ a(
|
|
66
61
|
v.Provider,
|
|
67
62
|
{
|
|
68
|
-
value: { size: n, open:
|
|
63
|
+
value: { size: n, open: e, onClose: i, transitionState: c, duration: r },
|
|
69
64
|
children: f
|
|
70
65
|
}
|
|
71
66
|
)
|
|
@@ -73,49 +68,49 @@ function u({
|
|
|
73
68
|
}
|
|
74
69
|
) }) });
|
|
75
70
|
}
|
|
76
|
-
function B({ className:
|
|
77
|
-
const
|
|
71
|
+
function B({ className: t, children: o, ...n }) {
|
|
72
|
+
const e = l((m) => m.modal.dialog), { size: i, transitionState: r, duration: p } = w(v), f = {
|
|
78
73
|
entering: "scale-100",
|
|
79
74
|
entered: "scale-100",
|
|
80
75
|
exiting: "scale-75",
|
|
81
76
|
exited: "scale-75",
|
|
82
77
|
unmounted: ""
|
|
83
|
-
}, x =
|
|
78
|
+
}, x = H(() => {
|
|
84
79
|
var s;
|
|
85
80
|
return [{
|
|
86
81
|
sm: "min-[576px]:w-[300px]",
|
|
87
82
|
md: "min-[576px]:w-[500px]",
|
|
88
83
|
lg: "min-[992px]:w-[800px]"
|
|
89
|
-
}[
|
|
90
|
-
}, [
|
|
91
|
-
return /* @__PURE__ */
|
|
84
|
+
}[i], (s = e == null ? void 0 : e.size) == null ? void 0 : s[i]];
|
|
85
|
+
}, [i, e == null ? void 0 : e.size]);
|
|
86
|
+
return /* @__PURE__ */ a(
|
|
92
87
|
d,
|
|
93
88
|
{
|
|
94
89
|
as: "div",
|
|
95
90
|
style: { transitionDuration: `${p}ms` },
|
|
96
|
-
className:
|
|
91
|
+
className: y(
|
|
97
92
|
"max-w-full max-h-full m-auto transition-transform",
|
|
98
|
-
|
|
93
|
+
e == null ? void 0 : e.base,
|
|
99
94
|
x,
|
|
100
95
|
f[r],
|
|
101
|
-
|
|
96
|
+
t
|
|
102
97
|
),
|
|
103
98
|
...n,
|
|
104
99
|
children: o
|
|
105
100
|
}
|
|
106
101
|
);
|
|
107
102
|
}
|
|
108
|
-
function F({ className:
|
|
109
|
-
const n = l((
|
|
110
|
-
return /* @__PURE__ */
|
|
103
|
+
function F({ className: t, ...o }) {
|
|
104
|
+
const n = l((e) => e.modal.header.base);
|
|
105
|
+
return /* @__PURE__ */ a(d.Header, { className: b(n, t), ...o });
|
|
111
106
|
}
|
|
112
|
-
function R({ className:
|
|
113
|
-
const n = l((
|
|
114
|
-
return /* @__PURE__ */
|
|
107
|
+
function R({ className: t, ...o }) {
|
|
108
|
+
const n = l((e) => e.modal.body.base);
|
|
109
|
+
return /* @__PURE__ */ a(d.Body, { className: b(n, t), ...o });
|
|
115
110
|
}
|
|
116
|
-
function j({ className:
|
|
117
|
-
const n = l((
|
|
118
|
-
return /* @__PURE__ */
|
|
111
|
+
function j({ className: t, ...o }) {
|
|
112
|
+
const n = l((e) => e.modal.footer.base);
|
|
113
|
+
return /* @__PURE__ */ a(d.Footer, { className: b(n, t), ...o });
|
|
119
114
|
}
|
|
120
115
|
u.Dialog = B;
|
|
121
116
|
u.Header = F;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";function t
|
|
1
|
+
"use client";"use strict";function i(t,n={block:"center",inline:"center",behavior:"smooth"}){const o=typeof t=="string"?document.querySelector(t):t;o==null||o.scrollIntoView(n)}module.exports=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function scrollIntoView(
|
|
1
|
+
export default function scrollIntoView(el: HTMLElement | string, option?: ScrollIntoViewOptions | boolean | undefined): void;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
function
|
|
2
|
+
function i(t, n = {
|
|
3
3
|
block: "center",
|
|
4
4
|
inline: "center",
|
|
5
5
|
behavior: "smooth"
|
|
6
6
|
}) {
|
|
7
|
-
|
|
7
|
+
const o = typeof t == "string" ? document.querySelector(t) : t;
|
|
8
|
+
o == null || o.scrollIntoView(n);
|
|
8
9
|
}
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
+
i as default
|
|
11
12
|
};
|
package/dist/hooks/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useClasses.cjs.js"),s=require("./useCreateRipple.cjs.js"),u=require("./useDebounce.cjs.js"),t=require("./useDocumentVisible.cjs.js"),r=require("./useIsOffline.cjs.js"),i=require("./
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useClasses.cjs.js"),s=require("./useCreateRipple.cjs.js"),u=require("./useDebounce.cjs.js"),t=require("./useDocumentVisible.cjs.js"),r=require("./useIsOffline.cjs.js"),i=require("./usePersistedState.cjs.js"),o=require("./useToggle.cjs.js");exports.useClasses=e;exports.useCreateRipple=s;exports.useDebounce=u;exports.useDocumentVisible=t;exports.useIsOffline=r;exports.usePersistedState=i;exports.useToggle=o;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -3,6 +3,5 @@ export { default as useCreateRipple } from './useCreateRipple';
|
|
|
3
3
|
export { default as useDebounce } from './useDebounce';
|
|
4
4
|
export { default as useDocumentVisible } from './useDocumentVisible';
|
|
5
5
|
export { default as useIsOffline } from './useIsOffline';
|
|
6
|
-
export { default as useKeyDown } from './useKeyDown';
|
|
7
6
|
export { default as usePersistedState } from './usePersistedState';
|
|
8
7
|
export { default as useToggle } from './useToggle';
|
package/dist/hooks/index.es.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { default as t } from "./useClasses.es.js";
|
|
3
|
-
import { default as
|
|
3
|
+
import { default as o } from "./useCreateRipple.es.js";
|
|
4
4
|
import { default as f } from "./useDebounce.es.js";
|
|
5
5
|
import { default as l } from "./useDocumentVisible.es.js";
|
|
6
6
|
import { default as d } from "./useIsOffline.es.js";
|
|
7
|
-
import { default as x } from "./
|
|
8
|
-
import { default as n } from "./
|
|
9
|
-
import { default as D } from "./useToggle.es.js";
|
|
7
|
+
import { default as x } from "./usePersistedState.es.js";
|
|
8
|
+
import { default as n } from "./useToggle.es.js";
|
|
10
9
|
export {
|
|
11
10
|
t as useClasses,
|
|
12
|
-
|
|
11
|
+
o as useCreateRipple,
|
|
13
12
|
f as useDebounce,
|
|
14
13
|
l as useDocumentVisible,
|
|
15
14
|
d as useIsOffline,
|
|
16
|
-
x as
|
|
17
|
-
n as
|
|
18
|
-
D as useToggle
|
|
15
|
+
x as usePersistedState,
|
|
16
|
+
n as useToggle
|
|
19
17
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function a(){var r,o;if(typeof navigator>"u")return"linux";const e=((r=navigator.platform)==null?void 0:r.toLowerCase())??"",t=((o=navigator.userAgent)==null?void 0:o.toLowerCase())??"";return e.includes("mac")||t.includes("mac")?"mac":e.includes("win")||t.includes("win")?"windows":"linux"}const c=["Control","Alt","Shift","Meta"];new Set(c);const u={Control:"Control",Ctrl:"Control",control:"Control",ctrl:"Control",Shift:"Shift",shift:"Shift",Alt:"Alt",Option:"Alt",alt:"Alt",option:"Alt",Command:"Meta",Cmd:"Meta",Meta:"Meta",command:"Meta",cmd:"Meta",meta:"Meta",OS:"Meta",os:"Meta",Win:"Meta",win:"Meta",CommandOrControl:"Mod",Mod:"Mod",commandorcontrol:"Mod",mod:"Mod"};function A(e,t=a()){return e==="Mod"?t==="mac"?"Meta":"Control":e}const i=new Set(["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),l=new Set(["0","1","2","3","4","5","6","7","8","9"]),s=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),p=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),w=new Set(["Enter","Escape","Space","Tab","Backspace","Delete"]),E=new Set(["/","[","]","\\","=","-",",",".",";","`"]),d={Backquote:"`",Backslash:"\\",BracketLeft:"[",BracketRight:"]",Comma:",",Equal:"=",Minus:"-",Period:".",Semicolon:";",Slash:"/"};[...i,...l,...s,...p,...w,...E];const n={Esc:"Escape",esc:"Escape",escape:"Escape",Return:"Enter",return:"Enter",enter:"Enter"," ":"Space",space:"Space",Spacebar:"Space",spacebar:"Space",tab:"Tab",backspace:"Backspace",Del:"Delete",del:"Delete",delete:"Delete",Up:"ArrowUp",up:"ArrowUp",arrowup:"ArrowUp",Down:"ArrowDown",down:"ArrowDown",arrowdown:"ArrowDown",Left:"ArrowLeft",left:"ArrowLeft",arrowleft:"ArrowLeft",Right:"ArrowRight",right:"ArrowRight",arrowright:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown",PgUp:"PageUp",PgDn:"PageDown",pgup:"PageUp",pgdn:"PageDown"};function S(e){return new RegExp("^\\p{Letter}$","u").test(e)}function f(e){if(!e)return"";if(e in n)return n[e];if(S(e)){const r=e.toUpperCase();return r.length===1?r:e}const t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}exports.EDITING_KEYS=w;exports.FUNCTION_KEYS=s;exports.LETTER_KEYS=i;exports.MODIFIER_ALIASES=u;exports.MODIFIER_ORDER=c;exports.NAVIGATION_KEYS=p;exports.NUMBER_KEYS=l;exports.PUNCTUATION_CODE_MAP=d;exports.PUNCTUATION_KEYS=E;exports.detectPlatform=a;exports.isSingleLetterKey=S;exports.normalizeKeyName=f;exports.resolveModifier=A;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
function a() {
|
|
3
|
+
var r, o;
|
|
4
|
+
if (typeof navigator > "u") return "linux";
|
|
5
|
+
const e = ((r = navigator.platform) == null ? void 0 : r.toLowerCase()) ?? "", t = ((o = navigator.userAgent) == null ? void 0 : o.toLowerCase()) ?? "";
|
|
6
|
+
return e.includes("mac") || t.includes("mac") ? "mac" : e.includes("win") || t.includes("win") ? "windows" : "linux";
|
|
7
|
+
}
|
|
8
|
+
const c = [
|
|
9
|
+
"Control",
|
|
10
|
+
"Alt",
|
|
11
|
+
"Shift",
|
|
12
|
+
"Meta"
|
|
13
|
+
];
|
|
14
|
+
new Set(c);
|
|
15
|
+
const S = {
|
|
16
|
+
Control: "Control",
|
|
17
|
+
Ctrl: "Control",
|
|
18
|
+
control: "Control",
|
|
19
|
+
ctrl: "Control",
|
|
20
|
+
Shift: "Shift",
|
|
21
|
+
shift: "Shift",
|
|
22
|
+
Alt: "Alt",
|
|
23
|
+
Option: "Alt",
|
|
24
|
+
alt: "Alt",
|
|
25
|
+
option: "Alt",
|
|
26
|
+
Command: "Meta",
|
|
27
|
+
Cmd: "Meta",
|
|
28
|
+
Meta: "Meta",
|
|
29
|
+
command: "Meta",
|
|
30
|
+
cmd: "Meta",
|
|
31
|
+
meta: "Meta",
|
|
32
|
+
OS: "Meta",
|
|
33
|
+
os: "Meta",
|
|
34
|
+
Win: "Meta",
|
|
35
|
+
win: "Meta",
|
|
36
|
+
CommandOrControl: "Mod",
|
|
37
|
+
Mod: "Mod",
|
|
38
|
+
commandorcontrol: "Mod",
|
|
39
|
+
mod: "Mod"
|
|
40
|
+
};
|
|
41
|
+
function d(e, t = a()) {
|
|
42
|
+
return e === "Mod" ? t === "mac" ? "Meta" : "Control" : e;
|
|
43
|
+
}
|
|
44
|
+
const i = /* @__PURE__ */ new Set([
|
|
45
|
+
"A",
|
|
46
|
+
"B",
|
|
47
|
+
"C",
|
|
48
|
+
"D",
|
|
49
|
+
"E",
|
|
50
|
+
"F",
|
|
51
|
+
"G",
|
|
52
|
+
"H",
|
|
53
|
+
"I",
|
|
54
|
+
"J",
|
|
55
|
+
"K",
|
|
56
|
+
"L",
|
|
57
|
+
"M",
|
|
58
|
+
"N",
|
|
59
|
+
"O",
|
|
60
|
+
"P",
|
|
61
|
+
"Q",
|
|
62
|
+
"R",
|
|
63
|
+
"S",
|
|
64
|
+
"T",
|
|
65
|
+
"U",
|
|
66
|
+
"V",
|
|
67
|
+
"W",
|
|
68
|
+
"X",
|
|
69
|
+
"Y",
|
|
70
|
+
"Z"
|
|
71
|
+
]), p = /* @__PURE__ */ new Set([
|
|
72
|
+
"0",
|
|
73
|
+
"1",
|
|
74
|
+
"2",
|
|
75
|
+
"3",
|
|
76
|
+
"4",
|
|
77
|
+
"5",
|
|
78
|
+
"6",
|
|
79
|
+
"7",
|
|
80
|
+
"8",
|
|
81
|
+
"9"
|
|
82
|
+
]), s = /* @__PURE__ */ new Set([
|
|
83
|
+
"F1",
|
|
84
|
+
"F2",
|
|
85
|
+
"F3",
|
|
86
|
+
"F4",
|
|
87
|
+
"F5",
|
|
88
|
+
"F6",
|
|
89
|
+
"F7",
|
|
90
|
+
"F8",
|
|
91
|
+
"F9",
|
|
92
|
+
"F10",
|
|
93
|
+
"F11",
|
|
94
|
+
"F12"
|
|
95
|
+
]), w = /* @__PURE__ */ new Set([
|
|
96
|
+
"ArrowUp",
|
|
97
|
+
"ArrowDown",
|
|
98
|
+
"ArrowLeft",
|
|
99
|
+
"ArrowRight",
|
|
100
|
+
"Home",
|
|
101
|
+
"End",
|
|
102
|
+
"PageUp",
|
|
103
|
+
"PageDown"
|
|
104
|
+
]), l = /* @__PURE__ */ new Set([
|
|
105
|
+
"Enter",
|
|
106
|
+
"Escape",
|
|
107
|
+
"Space",
|
|
108
|
+
"Tab",
|
|
109
|
+
"Backspace",
|
|
110
|
+
"Delete"
|
|
111
|
+
]), u = /* @__PURE__ */ new Set([
|
|
112
|
+
"/",
|
|
113
|
+
"[",
|
|
114
|
+
"]",
|
|
115
|
+
"\\",
|
|
116
|
+
"=",
|
|
117
|
+
"-",
|
|
118
|
+
",",
|
|
119
|
+
".",
|
|
120
|
+
";",
|
|
121
|
+
"`"
|
|
122
|
+
]), f = {
|
|
123
|
+
Backquote: "`",
|
|
124
|
+
Backslash: "\\",
|
|
125
|
+
BracketLeft: "[",
|
|
126
|
+
BracketRight: "]",
|
|
127
|
+
Comma: ",",
|
|
128
|
+
Equal: "=",
|
|
129
|
+
Minus: "-",
|
|
130
|
+
Period: ".",
|
|
131
|
+
Semicolon: ";",
|
|
132
|
+
Slash: "/"
|
|
133
|
+
};
|
|
134
|
+
[
|
|
135
|
+
...i,
|
|
136
|
+
...p,
|
|
137
|
+
...s,
|
|
138
|
+
...w,
|
|
139
|
+
...l,
|
|
140
|
+
...u
|
|
141
|
+
];
|
|
142
|
+
const n = {
|
|
143
|
+
Esc: "Escape",
|
|
144
|
+
esc: "Escape",
|
|
145
|
+
escape: "Escape",
|
|
146
|
+
Return: "Enter",
|
|
147
|
+
return: "Enter",
|
|
148
|
+
enter: "Enter",
|
|
149
|
+
" ": "Space",
|
|
150
|
+
space: "Space",
|
|
151
|
+
Spacebar: "Space",
|
|
152
|
+
spacebar: "Space",
|
|
153
|
+
tab: "Tab",
|
|
154
|
+
backspace: "Backspace",
|
|
155
|
+
Del: "Delete",
|
|
156
|
+
del: "Delete",
|
|
157
|
+
delete: "Delete",
|
|
158
|
+
Up: "ArrowUp",
|
|
159
|
+
up: "ArrowUp",
|
|
160
|
+
arrowup: "ArrowUp",
|
|
161
|
+
Down: "ArrowDown",
|
|
162
|
+
down: "ArrowDown",
|
|
163
|
+
arrowdown: "ArrowDown",
|
|
164
|
+
Left: "ArrowLeft",
|
|
165
|
+
left: "ArrowLeft",
|
|
166
|
+
arrowleft: "ArrowLeft",
|
|
167
|
+
Right: "ArrowRight",
|
|
168
|
+
right: "ArrowRight",
|
|
169
|
+
arrowright: "ArrowRight",
|
|
170
|
+
home: "Home",
|
|
171
|
+
end: "End",
|
|
172
|
+
pageup: "PageUp",
|
|
173
|
+
pagedown: "PageDown",
|
|
174
|
+
PgUp: "PageUp",
|
|
175
|
+
PgDn: "PageDown",
|
|
176
|
+
pgup: "PageUp",
|
|
177
|
+
pgdn: "PageDown"
|
|
178
|
+
};
|
|
179
|
+
function A(e) {
|
|
180
|
+
return new RegExp("^\\p{Letter}$", "u").test(e);
|
|
181
|
+
}
|
|
182
|
+
function E(e) {
|
|
183
|
+
if (!e) return "";
|
|
184
|
+
if (e in n) return n[e];
|
|
185
|
+
if (A(e)) {
|
|
186
|
+
const r = e.toUpperCase();
|
|
187
|
+
return r.length === 1 ? r : e;
|
|
188
|
+
}
|
|
189
|
+
const t = e.toUpperCase();
|
|
190
|
+
return /^F([1-9]|1[0-2])$/.test(t) ? t : e;
|
|
191
|
+
}
|
|
192
|
+
export {
|
|
193
|
+
l as EDITING_KEYS,
|
|
194
|
+
s as FUNCTION_KEYS,
|
|
195
|
+
i as LETTER_KEYS,
|
|
196
|
+
S as MODIFIER_ALIASES,
|
|
197
|
+
c as MODIFIER_ORDER,
|
|
198
|
+
w as NAVIGATION_KEYS,
|
|
199
|
+
p as NUMBER_KEYS,
|
|
200
|
+
f as PUNCTUATION_CODE_MAP,
|
|
201
|
+
u as PUNCTUATION_KEYS,
|
|
202
|
+
a as detectPlatform,
|
|
203
|
+
A as isSingleLetterKey,
|
|
204
|
+
E as normalizeKeyName,
|
|
205
|
+
d as resolveModifier
|
|
206
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./constants.cjs.js");function n(o){const t=[];for(const e of i.MODIFIER_ORDER)o.modifiers.includes(e)&&t.push(e);return t.push(o.key),t.join("+")}exports.formatHotkey=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";var q=a=>{throw TypeError(a)};var I=(a,t,e)=>t.has(a)||q("Cannot "+e);var o=(a,t,e)=>(I(a,t,"read from private field"),e?e.call(a):t.get(a)),k=(a,t,e)=>t.has(a)?q("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(a):t.set(a,e),v=(a,t,e,r)=>(I(a,t,"write to private field"),r?r.call(a,e):t.set(a,e),e),c=(a,t,e)=>(I(a,t,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("./constants.cjs.js"),L=require("./parse.cjs.js"),G=require("./format.cjs.js"),P=require("./match.cjs.js"),w=require("./manager.utils.cjs.js"),J=require("../../store/dist/esm/store.cjs.js");let Q=0;function D(){return`hotkey_${++Q}`}var g,p,H,d,l,i,R,z,C,K,S,O,A,U,B,x=(g=class{constructor(){k(this,i);k(this,H);k(this,d,new Map);k(this,l,new Map);this.registrations=new J.Store(new Map),v(this,H,F.detectPlatform())}static getInstance(){return o(g,p)||v(g,p,new g),o(g,p)}static resetInstance(){o(g,p)&&(o(g,p).destroy(),v(g,p,null))}register(t,e,r={}){if(typeof document>"u"&&!r.target){let u=e;return{id:D(),unregister:()=>{},get callback(){return u},set callback(y){u=y},setOptions:()=>{},get isActive(){return!1}}}const s=D(),f=r.platform??o(this,H),n=typeof t=="string"?L.parseHotkey(t,f):L.rawHotkeyToParsedHotkey(t,f),b=typeof t=="string"?t:G.formatHotkey(n),h=r.target??document,N=r.conflictBehavior??"warn",E=c(this,i,U).call(this,b,h);E&&w.handleConflict(E.id,b,N,u=>c(this,i,R).call(this,u));const j=r.ignoreInputs??w.getDefaultIgnoreInputs(n),$={id:s,hotkey:b,parsedHotkey:n,callback:e,options:{...w.defaultHotkeyOptions,requireReset:!1,...r,platform:f,ignoreInputs:j},hasFired:!1,triggerCount:0,target:h};this.registrations.setState(u=>new Map(u).set(s,$)),o(this,l).has(h)||o(this,l).set(h,new Set),o(this,l).get(h).add(s),c(this,i,z).call(this,h);const m=this;return{get id(){return s},unregister:()=>{var u;c(u=m,i,R).call(u,s)},get callback(){var u;return((u=m.registrations.state.get(s))==null?void 0:u.callback)??e},set callback(u){const y=m.registrations.state.get(s);y&&(y.callback=u)},setOptions:u=>{m.registrations.setState(y=>{const M=y.get(s);if(M){const T=new Map(y);return T.set(s,{...M,options:{...M.options,...u}}),T}return y})},get isActive(){return m.registrations.state.has(s)}}}triggerRegistration(t){const e=this.registrations.state.get(t);if(!e)return!1;const r=e.parsedHotkey,s=new KeyboardEvent(e.options.eventType??"keydown",{key:r.key,ctrlKey:r.ctrl,shiftKey:r.shift,altKey:r.alt,metaKey:r.meta,bubbles:!0,cancelable:!0});return e.triggerCount++,this.registrations.setState(f=>new Map(f)),e.callback(s,{hotkey:e.hotkey,parsedHotkey:e.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(t,e){for(const r of this.registrations.state.values())if(r.hotkey===t&&(e===void 0||r.target===e))return!0;return!1}destroy(){for(const t of o(this,d).keys())c(this,i,C).call(this,t);this.registrations.setState(()=>new Map),o(this,d).clear(),o(this,l).clear()}},p=new WeakMap,H=new WeakMap,d=new WeakMap,l=new WeakMap,i=new WeakSet,R=function(t){const e=this.registrations.state.get(t);if(!e)return;const r=e.target;this.registrations.setState(f=>{const n=new Map(f);return n.delete(t),n});const s=o(this,l).get(r);s&&(s.delete(t),s.size===0&&c(this,i,C).call(this,r))},z=function(t){if(typeof document>"u"||o(this,d).has(t))return;const e=c(this,i,O).call(this,t),r=c(this,i,A).call(this,t);t.addEventListener("keydown",e),t.addEventListener("keyup",r),o(this,d).set(t,{keydown:e,keyup:r})},C=function(t){if(typeof document>"u")return;const e=o(this,d).get(t);e&&(t.removeEventListener("keydown",e.keydown),t.removeEventListener("keyup",e.keyup),o(this,d).delete(t),o(this,l).delete(t))},K=function(t,e,r){const s=o(this,l).get(e);if(s)for(const f of s){const n=this.registrations.state.get(f);if(n&&w.isEventForTarget(t,e)&&n.options.enabled&&!(n.options.ignoreInputs!==!1&&w.shouldIgnoreInputEvent(t,e,n.target)))if(r==="keydown"){if(n.options.eventType!=="keydown")continue;P.matchesKeyboardEvent(t,n.parsedHotkey,n.options.platform)&&(n.options.preventDefault&&t.preventDefault(),n.options.stopPropagation&&t.stopPropagation(),(!n.options.requireReset||!n.hasFired)&&(c(this,i,S).call(this,n,t),n.options.requireReset&&(n.hasFired=!0)))}else n.options.eventType==="keyup"&&P.matchesKeyboardEvent(t,n.parsedHotkey,n.options.platform)&&c(this,i,S).call(this,n,t),n.options.requireReset&&n.hasFired&&c(this,i,B).call(this,n,t)&&(n.hasFired=!1)}},S=function(t,e){t.options.preventDefault&&e.preventDefault(),t.options.stopPropagation&&e.stopPropagation(),t.triggerCount++,this.registrations.setState(s=>new Map(s));const r={hotkey:t.hotkey,parsedHotkey:t.parsedHotkey};t.callback(e,r)},O=function(t){return e=>{c(this,i,K).call(this,e,t,"keydown")}},A=function(t){return e=>{c(this,i,K).call(this,e,t,"keyup")}},U=function(t,e){for(const r of this.registrations.state.values())if(r.hotkey===t&&r.target===e)return r;return null},B=function(t,e){const r=t.parsedHotkey,s=F.normalizeKeyName(e.key),f=r.key.length===1?r.key.toUpperCase():r.key;return!!((s.length===1?s.toUpperCase():s)===f||r.ctrl&&s==="Control"||r.shift&&s==="Shift"||r.alt&&s==="Alt"||r.meta&&s==="Meta")},k(g,p,null),g);function V(){return x.getInstance()}exports.HotkeyManager=x;exports.getHotkeyManager=V;
|