reaxify 0.0.84 → 0.0.86
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/Alert/index.cjs.js +1 -0
- package/dist/components/Alert/index.es.js +8 -0
- package/dist/components/Badge/index.cjs.js +1 -1
- package/dist/components/Badge/index.es.js +36 -36
- package/dist/components/Button/index.cjs.js +1 -1
- package/dist/components/Button/index.es.js +75 -57
- package/dist/components/Drawer/index.cjs.js +1 -1
- package/dist/components/Drawer/index.es.js +75 -71
- package/dist/components/Menu/index.cjs.js +1 -1
- package/dist/components/Menu/index.es.js +91 -88
- package/dist/components/Modal/index.cjs.js +1 -1
- package/dist/components/Modal/index.es.js +76 -69
- package/dist/components/Progress/index.cjs.js +1 -1
- package/dist/components/Progress/index.es.js +21 -21
- package/dist/components/Spacer/index.cjs.js +1 -1
- package/dist/components/Spacer/index.es.js +13 -7
- package/dist/components/Stack/index.cjs.js +1 -1
- package/dist/components/Stack/index.es.js +28 -28
- package/dist/components/Switch/index.cjs.js +1 -1
- package/dist/components/Switch/index.es.js +1 -1
- package/dist/components/Tabs/index.cjs.js +1 -1
- package/dist/components/Tabs/index.es.js +9 -9
- package/dist/helpers/scrollIntoView.cjs.js +1 -1
- package/dist/helpers/scrollIntoView.es.js +4 -3
- package/dist/hooks/index.cjs.js +1 -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/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.cjs.js +1 -1
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.es.js +2 -2
- package/dist/node_modules/react-transition-group/esm/Transition.cjs.js +1 -1
- package/dist/node_modules/react-transition-group/esm/Transition.es.js +2 -2
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.cjs.js +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.es.js +745 -553
- package/dist/reaxify.css +1 -1
- package/dist/{axios → src/axios}/AxiosProvider.d.ts +1 -1
- package/dist/{components → src/components}/Accordion/index.d.ts +1 -1
- package/dist/src/components/Alert/index.d.ts +26 -0
- package/dist/{components → src/components}/Badge/index.d.ts +1 -1
- package/dist/{components → src/components}/Button/index.d.ts +3 -3
- package/dist/{components → src/components}/ButtonGroup/index.d.ts +1 -1
- package/dist/{components → src/components}/Card/index.d.ts +1 -1
- package/dist/{components → src/components}/Drawer/index.d.ts +6 -6
- package/dist/src/components/Fill/index.d.ts +3 -0
- package/dist/{components → src/components}/InputGroup/index.d.ts +1 -1
- package/dist/src/components/Menu/index.d.ts +16 -0
- package/dist/{components → src/components}/Modal/index.d.ts +5 -6
- package/dist/{components → src/components}/Portal/index.d.ts +1 -1
- package/dist/{components → src/components}/Progress/index.d.ts +1 -1
- package/dist/src/components/Spacer/index.d.ts +6 -0
- package/dist/{components → src/components}/Spinner/index.d.ts +1 -1
- package/dist/src/components/Stack/index.d.ts +10 -0
- package/dist/{components → src/components}/Switch/index.d.ts +1 -1
- package/dist/{components → src/components}/Tabs/index.d.ts +1 -1
- package/dist/{components → src/components}/Tooltip/index.d.ts +2 -2
- package/dist/{components → src/components}/Typography/index.d.ts +1 -1
- package/dist/src/helpers/scrollIntoView.d.ts +1 -0
- package/dist/{hooks → src/hooks}/index.d.ts +0 -1
- package/dist/{hooks → src/hooks}/useClasses.d.ts +2 -2
- package/dist/{providers → src/providers}/ThemeProvider.d.ts +28 -5
- package/dist/{types → src/types}/index.d.ts +8 -3
- package/package.json +26 -26
- package/dist/components/Menu/index.d.ts +0 -15
- package/dist/components/Spacer/index.d.ts +0 -6
- package/dist/components/Stack/index.d.ts +0 -10
- package/dist/helpers/scrollIntoView.d.ts +0 -1
- package/dist/hooks/useKeyDown.cjs.js +0 -1
- package/dist/hooks/useKeyDown.d.ts +0 -6
- package/dist/hooks/useKeyDown.es.js +0 -17
- /package/dist/{axios → src/axios}/index.d.ts +0 -0
- /package/dist/{axios → src/axios}/types.d.ts +0 -0
- /package/dist/{axios → src/axios}/useAxios.d.ts +0 -0
- /package/dist/{components → src/components}/Skeleton/index.d.ts +0 -0
- /package/dist/{components → src/components}/Table/index.d.ts +0 -0
- /package/dist/{components → src/components}/index.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/cn.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/copy.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/index.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/isEmpty.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/isServer.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/randomID.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/replaceNonDigits.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/replacePersianNumbers.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/twoDigitNumber.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/wait.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useCreateRipple.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useDebounce.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useDocumentVisible.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useIsOffline.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/usePersistedState.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useToggle.d.ts +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{providers → src/providers}/index.d.ts +0 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var T = (a) => {
|
|
3
|
+
throw TypeError(a);
|
|
4
|
+
};
|
|
5
|
+
var I = (a, t, e) => t.has(a) || T("Cannot " + e);
|
|
6
|
+
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) ? T("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, e), H = (a, t, e, r) => (I(a, t, "write to private field"), r ? r.call(a, e) : t.set(a, e), e), f = (a, t, e) => (I(a, t, "access private method"), e);
|
|
7
|
+
import { detectPlatform as B, normalizeKeyName as N } from "./constants.es.js";
|
|
8
|
+
import { parseHotkey as $, rawHotkeyToParsedHotkey as j } from "./parse.es.js";
|
|
9
|
+
import { formatHotkey as G } from "./format.es.js";
|
|
10
|
+
import { matchesKeyboardEvent as F } from "./match.es.js";
|
|
11
|
+
import { handleConflict as J, getDefaultIgnoreInputs as Q, defaultHotkeyOptions as V, isEventForTarget as W, shouldIgnoreInputEvent as X } from "./manager.utils.es.js";
|
|
12
|
+
import { Store as Y } from "../../store/dist/esm/store.es.js";
|
|
13
|
+
let Z = 0;
|
|
14
|
+
function L() {
|
|
15
|
+
return `hotkey_${++Z}`;
|
|
16
|
+
}
|
|
17
|
+
var c, p, w, d, l, i, R, D, M, C, K, P, x, q, z, _ = (c = class {
|
|
18
|
+
constructor() {
|
|
19
|
+
k(this, i);
|
|
20
|
+
k(this, w);
|
|
21
|
+
k(this, d, /* @__PURE__ */ new Map());
|
|
22
|
+
k(this, l, /* @__PURE__ */ new Map());
|
|
23
|
+
this.registrations = new Y(/* @__PURE__ */ new Map()), H(this, w, B());
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets the singleton instance of HotkeyManager.
|
|
27
|
+
*/
|
|
28
|
+
static getInstance() {
|
|
29
|
+
return o(c, p) || H(c, p, new c()), o(c, p);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Resets the singleton instance. Useful for testing.
|
|
33
|
+
*/
|
|
34
|
+
static resetInstance() {
|
|
35
|
+
o(c, p) && (o(c, p).destroy(), H(c, p, null));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Registers a hotkey handler and returns a handle for updating the registration.
|
|
39
|
+
*
|
|
40
|
+
* The returned handle allows updating the callback and options without
|
|
41
|
+
* re-registering, which is useful for avoiding stale closures in React.
|
|
42
|
+
*
|
|
43
|
+
* @param hotkey - The hotkey string (e.g., 'Mod+S') or RawHotkey object
|
|
44
|
+
* @param callback - The function to call when the hotkey is pressed
|
|
45
|
+
* @param options - Options for the hotkey behavior
|
|
46
|
+
* @returns A handle for managing the registration
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const handle = manager.register('Mod+S', callback)
|
|
51
|
+
*
|
|
52
|
+
* // Update callback without re-registering (avoids stale closures)
|
|
53
|
+
* handle.callback = newCallback
|
|
54
|
+
*
|
|
55
|
+
* // Update options
|
|
56
|
+
* handle.setOptions({ enabled: false })
|
|
57
|
+
*
|
|
58
|
+
* // Unregister when done
|
|
59
|
+
* handle.unregister()
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
register(t, e, r = {}) {
|
|
63
|
+
if (typeof document > "u" && !r.target) {
|
|
64
|
+
let u = e;
|
|
65
|
+
return {
|
|
66
|
+
id: L(),
|
|
67
|
+
unregister: () => {
|
|
68
|
+
},
|
|
69
|
+
get callback() {
|
|
70
|
+
return u;
|
|
71
|
+
},
|
|
72
|
+
set callback(y) {
|
|
73
|
+
u = y;
|
|
74
|
+
},
|
|
75
|
+
setOptions: () => {
|
|
76
|
+
},
|
|
77
|
+
get isActive() {
|
|
78
|
+
return !1;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const s = L(), g = r.platform ?? o(this, w), n = typeof t == "string" ? $(t, g) : j(t, g), v = typeof t == "string" ? t : G(n), h = r.target ?? document, A = r.conflictBehavior ?? "warn", E = f(this, i, q).call(this, v, h);
|
|
83
|
+
E && J(E.id, v, A, (u) => f(this, i, R).call(this, u));
|
|
84
|
+
const O = r.ignoreInputs ?? Q(n), U = {
|
|
85
|
+
id: s,
|
|
86
|
+
hotkey: v,
|
|
87
|
+
parsedHotkey: n,
|
|
88
|
+
callback: e,
|
|
89
|
+
options: {
|
|
90
|
+
...V,
|
|
91
|
+
requireReset: !1,
|
|
92
|
+
...r,
|
|
93
|
+
platform: g,
|
|
94
|
+
ignoreInputs: O
|
|
95
|
+
},
|
|
96
|
+
hasFired: !1,
|
|
97
|
+
triggerCount: 0,
|
|
98
|
+
target: h
|
|
99
|
+
};
|
|
100
|
+
this.registrations.setState((u) => new Map(u).set(s, U)), o(this, l).has(h) || o(this, l).set(h, /* @__PURE__ */ new Set()), o(this, l).get(h).add(s), f(this, i, D).call(this, h);
|
|
101
|
+
const m = this;
|
|
102
|
+
return {
|
|
103
|
+
get id() {
|
|
104
|
+
return s;
|
|
105
|
+
},
|
|
106
|
+
unregister: () => {
|
|
107
|
+
var u;
|
|
108
|
+
f(u = m, i, R).call(u, s);
|
|
109
|
+
},
|
|
110
|
+
get callback() {
|
|
111
|
+
var u;
|
|
112
|
+
return ((u = m.registrations.state.get(s)) == null ? void 0 : u.callback) ?? e;
|
|
113
|
+
},
|
|
114
|
+
set callback(u) {
|
|
115
|
+
const y = m.registrations.state.get(s);
|
|
116
|
+
y && (y.callback = u);
|
|
117
|
+
},
|
|
118
|
+
setOptions: (u) => {
|
|
119
|
+
m.registrations.setState((y) => {
|
|
120
|
+
const b = y.get(s);
|
|
121
|
+
if (b) {
|
|
122
|
+
const S = new Map(y);
|
|
123
|
+
return S.set(s, {
|
|
124
|
+
...b,
|
|
125
|
+
options: {
|
|
126
|
+
...b.options,
|
|
127
|
+
...u
|
|
128
|
+
}
|
|
129
|
+
}), S;
|
|
130
|
+
}
|
|
131
|
+
return y;
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
get isActive() {
|
|
135
|
+
return m.registrations.state.has(s);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Triggers a registration's callback programmatically from devtools.
|
|
141
|
+
* Creates a synthetic KeyboardEvent and invokes the callback.
|
|
142
|
+
*
|
|
143
|
+
* @param id - The registration ID to trigger
|
|
144
|
+
* @returns True if the registration was found and triggered
|
|
145
|
+
*/
|
|
146
|
+
triggerRegistration(t) {
|
|
147
|
+
const e = this.registrations.state.get(t);
|
|
148
|
+
if (!e) return !1;
|
|
149
|
+
const r = e.parsedHotkey, s = new KeyboardEvent(e.options.eventType ?? "keydown", {
|
|
150
|
+
key: r.key,
|
|
151
|
+
ctrlKey: r.ctrl,
|
|
152
|
+
shiftKey: r.shift,
|
|
153
|
+
altKey: r.alt,
|
|
154
|
+
metaKey: r.meta,
|
|
155
|
+
bubbles: !0,
|
|
156
|
+
cancelable: !0
|
|
157
|
+
});
|
|
158
|
+
return e.triggerCount++, this.registrations.setState((g) => new Map(g)), e.callback(s, {
|
|
159
|
+
hotkey: e.hotkey,
|
|
160
|
+
parsedHotkey: e.parsedHotkey
|
|
161
|
+
}), !0;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Gets the number of registered hotkeys.
|
|
165
|
+
*/
|
|
166
|
+
getRegistrationCount() {
|
|
167
|
+
return this.registrations.state.size;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Checks if a specific hotkey is registered.
|
|
171
|
+
*
|
|
172
|
+
* @param hotkey - The hotkey string to check
|
|
173
|
+
* @param target - Optional target element to match (if provided, both hotkey and target must match)
|
|
174
|
+
* @returns True if a matching registration exists
|
|
175
|
+
*/
|
|
176
|
+
isRegistered(t, e) {
|
|
177
|
+
for (const r of this.registrations.state.values()) if (r.hotkey === t && (e === void 0 || r.target === e))
|
|
178
|
+
return !0;
|
|
179
|
+
return !1;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Destroys the manager and removes all listeners.
|
|
183
|
+
*/
|
|
184
|
+
destroy() {
|
|
185
|
+
for (const t of o(this, d).keys()) f(this, i, M).call(this, t);
|
|
186
|
+
this.registrations.setState(() => /* @__PURE__ */ new Map()), o(this, d).clear(), o(this, l).clear();
|
|
187
|
+
}
|
|
188
|
+
}, p = new WeakMap(), w = new WeakMap(), d = new WeakMap(), l = new WeakMap(), i = new WeakSet(), /**
|
|
189
|
+
* Unregisters a hotkey by its registration ID.
|
|
190
|
+
*/
|
|
191
|
+
R = function(t) {
|
|
192
|
+
const e = this.registrations.state.get(t);
|
|
193
|
+
if (!e) return;
|
|
194
|
+
const r = e.target;
|
|
195
|
+
this.registrations.setState((g) => {
|
|
196
|
+
const n = new Map(g);
|
|
197
|
+
return n.delete(t), n;
|
|
198
|
+
});
|
|
199
|
+
const s = o(this, l).get(r);
|
|
200
|
+
s && (s.delete(t), s.size === 0 && f(this, i, M).call(this, r));
|
|
201
|
+
}, /**
|
|
202
|
+
* Ensures event listeners are attached for a specific target.
|
|
203
|
+
*/
|
|
204
|
+
D = function(t) {
|
|
205
|
+
if (typeof document > "u" || o(this, d).has(t)) return;
|
|
206
|
+
const e = f(this, i, P).call(this, t), r = f(this, i, x).call(this, t);
|
|
207
|
+
t.addEventListener("keydown", e), t.addEventListener("keyup", r), o(this, d).set(t, {
|
|
208
|
+
keydown: e,
|
|
209
|
+
keyup: r
|
|
210
|
+
});
|
|
211
|
+
}, /**
|
|
212
|
+
* Removes event listeners for a specific target.
|
|
213
|
+
*/
|
|
214
|
+
M = function(t) {
|
|
215
|
+
if (typeof document > "u") return;
|
|
216
|
+
const e = o(this, d).get(t);
|
|
217
|
+
e && (t.removeEventListener("keydown", e.keydown), t.removeEventListener("keyup", e.keyup), o(this, d).delete(t), o(this, l).delete(t));
|
|
218
|
+
}, /**
|
|
219
|
+
* Processes keyboard events for a specific target and event type.
|
|
220
|
+
*/
|
|
221
|
+
C = function(t, e, r) {
|
|
222
|
+
const s = o(this, l).get(e);
|
|
223
|
+
if (s)
|
|
224
|
+
for (const g of s) {
|
|
225
|
+
const n = this.registrations.state.get(g);
|
|
226
|
+
if (n && W(t, e) && n.options.enabled && !(n.options.ignoreInputs !== !1 && X(t, e, n.target)))
|
|
227
|
+
if (r === "keydown") {
|
|
228
|
+
if (n.options.eventType !== "keydown") continue;
|
|
229
|
+
F(t, n.parsedHotkey, n.options.platform) && (n.options.preventDefault && t.preventDefault(), n.options.stopPropagation && t.stopPropagation(), (!n.options.requireReset || !n.hasFired) && (f(this, i, K).call(this, n, t), n.options.requireReset && (n.hasFired = !0)));
|
|
230
|
+
} else
|
|
231
|
+
n.options.eventType === "keyup" && F(t, n.parsedHotkey, n.options.platform) && f(this, i, K).call(this, n, t), n.options.requireReset && n.hasFired && f(this, i, z).call(this, n, t) && (n.hasFired = !1);
|
|
232
|
+
}
|
|
233
|
+
}, /**
|
|
234
|
+
* Executes a hotkey callback with proper event handling.
|
|
235
|
+
*/
|
|
236
|
+
K = function(t, e) {
|
|
237
|
+
t.options.preventDefault && e.preventDefault(), t.options.stopPropagation && e.stopPropagation(), t.triggerCount++, this.registrations.setState((s) => new Map(s));
|
|
238
|
+
const r = {
|
|
239
|
+
hotkey: t.hotkey,
|
|
240
|
+
parsedHotkey: t.parsedHotkey
|
|
241
|
+
};
|
|
242
|
+
t.callback(e, r);
|
|
243
|
+
}, /**
|
|
244
|
+
* Creates a keydown handler for a specific target.
|
|
245
|
+
*/
|
|
246
|
+
P = function(t) {
|
|
247
|
+
return (e) => {
|
|
248
|
+
f(this, i, C).call(this, e, t, "keydown");
|
|
249
|
+
};
|
|
250
|
+
}, /**
|
|
251
|
+
* Creates a keyup handler for a specific target.
|
|
252
|
+
*/
|
|
253
|
+
x = function(t) {
|
|
254
|
+
return (e) => {
|
|
255
|
+
f(this, i, C).call(this, e, t, "keyup");
|
|
256
|
+
};
|
|
257
|
+
}, /**
|
|
258
|
+
* Finds an existing registration with the same hotkey and target.
|
|
259
|
+
*/
|
|
260
|
+
q = function(t, e) {
|
|
261
|
+
for (const r of this.registrations.state.values()) if (r.hotkey === t && r.target === e) return r;
|
|
262
|
+
return null;
|
|
263
|
+
}, /**
|
|
264
|
+
* Determines if a registration should be reset based on the keyup event.
|
|
265
|
+
*/
|
|
266
|
+
z = function(t, e) {
|
|
267
|
+
const r = t.parsedHotkey, s = N(e.key), g = r.key.length === 1 ? r.key.toUpperCase() : r.key;
|
|
268
|
+
return !!((s.length === 1 ? s.toUpperCase() : s) === g || r.ctrl && s === "Control" || r.shift && s === "Shift" || r.alt && s === "Alt" || r.meta && s === "Meta");
|
|
269
|
+
}, k(c, p, null), c);
|
|
270
|
+
function at() {
|
|
271
|
+
return _.getInstance();
|
|
272
|
+
}
|
|
273
|
+
export {
|
|
274
|
+
_ as HotkeyManager,
|
|
275
|
+
at as getHotkeyManager
|
|
276
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i={preventDefault:!0,stopPropagation:!0,eventType:"keydown",enabled:!0,ignoreInputs:!0,conflictBehavior:"warn"};function l(e){return!(e.ctrl||e.meta||e.key==="Escape")}function o(e){if(!e)return!1;if(e instanceof HTMLInputElement){const n=e.type.toLowerCase();return!(n==="button"||n==="submit"||n==="reset")}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function c(e){return typeof document>"u"?null:typeof Document<"u"&&e instanceof Document||typeof Node<"u"&&e.nodeType===Node.DOCUMENT_NODE?e.activeElement:typeof HTMLElement<"u"&&e instanceof HTMLElement?e.ownerDocument.activeElement??null:e.document.activeElement??null}function f(e,n,t){const r=c(n);return r&&o(r)&&r!==t||e.composedPath().some(u=>o(u)&&u!==t)?!0:o(e.target)&&e.target!==t}function a(e,n){return n===document||n===window?e.currentTarget===n||e.currentTarget===document.documentElement:n===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(n instanceof HTMLElement&&(e.currentTarget===n||e.target instanceof Node&&n.contains(e.target)))}function s(e,n,t,r){if(t!=="allow"){if(t==="warn"){console.warn(`'${n}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);return}if(t==="error")throw new Error(`'${n}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}exports.defaultHotkeyOptions=i;exports.getDefaultIgnoreInputs=l;exports.handleConflict=s;exports.isEventForTarget=a;exports.isInputElement=o;exports.shouldIgnoreInputEvent=f;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const c = {
|
|
3
|
+
preventDefault: !0,
|
|
4
|
+
stopPropagation: !0,
|
|
5
|
+
eventType: "keydown",
|
|
6
|
+
enabled: !0,
|
|
7
|
+
ignoreInputs: !0,
|
|
8
|
+
conflictBehavior: "warn"
|
|
9
|
+
};
|
|
10
|
+
function f(e) {
|
|
11
|
+
return !(e.ctrl || e.meta || e.key === "Escape");
|
|
12
|
+
}
|
|
13
|
+
function o(e) {
|
|
14
|
+
if (!e) return !1;
|
|
15
|
+
if (e instanceof HTMLInputElement) {
|
|
16
|
+
const n = e.type.toLowerCase();
|
|
17
|
+
return !(n === "button" || n === "submit" || n === "reset");
|
|
18
|
+
}
|
|
19
|
+
return !!(e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement || e instanceof HTMLElement && e.isContentEditable);
|
|
20
|
+
}
|
|
21
|
+
function i(e) {
|
|
22
|
+
return typeof document > "u" ? null : typeof Document < "u" && e instanceof Document || typeof Node < "u" && e.nodeType === Node.DOCUMENT_NODE ? e.activeElement : typeof HTMLElement < "u" && e instanceof HTMLElement ? e.ownerDocument.activeElement ?? null : e.document.activeElement ?? null;
|
|
23
|
+
}
|
|
24
|
+
function l(e, n, t) {
|
|
25
|
+
const r = i(n);
|
|
26
|
+
return r && o(r) && r !== t || e.composedPath().some((u) => o(u) && u !== t) ? !0 : o(e.target) && e.target !== t;
|
|
27
|
+
}
|
|
28
|
+
function a(e, n) {
|
|
29
|
+
return n === document || n === window ? e.currentTarget === n || e.currentTarget === document.documentElement : n === window ? e.currentTarget === window || e.currentTarget === document || e.currentTarget === document.documentElement : !!(n instanceof HTMLElement && (e.currentTarget === n || e.target instanceof Node && n.contains(e.target)));
|
|
30
|
+
}
|
|
31
|
+
function s(e, n, t, r) {
|
|
32
|
+
if (t !== "allow") {
|
|
33
|
+
if (t === "warn") {
|
|
34
|
+
console.warn(`'${n}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (t === "error") throw new Error(`'${n}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);
|
|
38
|
+
r(e);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
c as defaultHotkeyOptions,
|
|
43
|
+
f as getDefaultIgnoreInputs,
|
|
44
|
+
s as handleConflict,
|
|
45
|
+
a as isEventForTarget,
|
|
46
|
+
o as isInputElement,
|
|
47
|
+
l as shouldIgnoreInputEvent
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./constants.cjs.js"),l=require("./parse.cjs.js");function n(e,o,c=a.detectPlatform()){const i=typeof o=="string"?l.parseHotkey(o,c):o;if(e.ctrlKey!==i.ctrl||e.shiftKey!==i.shift||e.altKey!==i.alt||e.metaKey!==i.meta)return!1;const t=a.normalizeKeyName(e.key),r=i.key;if(t!=="Dead"&&t.length===1&&r.length===1){if(t.toUpperCase()===r.toUpperCase())return!0;if(a.isSingleLetterKey(t)&&(/^[A-Za-z]$/.test(t)||!e.altKey))return!1}if(e.code&&(t==="Dead"||t.length===1&&r.length===1)){if(e.code.startsWith("Key")){const s=e.code.slice(3);if(s.length===1&&/^[A-Za-z]$/.test(s))return s.toUpperCase()===r.toUpperCase()}if(e.code.startsWith("Digit")){const s=e.code.slice(5);if(s.length===1&&/^[0-9]$/.test(s))return s===r}return e.code in a.PUNCTUATION_CODE_MAP?a.PUNCTUATION_CODE_MAP[e.code]===r:!1}return t===r}exports.matchesKeyboardEvent=n;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { normalizeKeyName as l, isSingleLetterKey as c, PUNCTUATION_CODE_MAP as o, detectPlatform as n } from "./constants.es.js";
|
|
3
|
+
import { parseHotkey as d } from "./parse.es.js";
|
|
4
|
+
function y(e, a, f = n()) {
|
|
5
|
+
const s = typeof a == "string" ? d(a, f) : a;
|
|
6
|
+
if (e.ctrlKey !== s.ctrl || e.shiftKey !== s.shift || e.altKey !== s.alt || e.metaKey !== s.meta) return !1;
|
|
7
|
+
const t = l(e.key), r = s.key;
|
|
8
|
+
if (t !== "Dead" && t.length === 1 && r.length === 1) {
|
|
9
|
+
if (t.toUpperCase() === r.toUpperCase()) return !0;
|
|
10
|
+
if (c(t) && (/^[A-Za-z]$/.test(t) || !e.altKey)) return !1;
|
|
11
|
+
}
|
|
12
|
+
if (e.code && (t === "Dead" || t.length === 1 && r.length === 1)) {
|
|
13
|
+
if (e.code.startsWith("Key")) {
|
|
14
|
+
const i = e.code.slice(3);
|
|
15
|
+
if (i.length === 1 && /^[A-Za-z]$/.test(i)) return i.toUpperCase() === r.toUpperCase();
|
|
16
|
+
}
|
|
17
|
+
if (e.code.startsWith("Digit")) {
|
|
18
|
+
const i = e.code.slice(5);
|
|
19
|
+
if (i.length === 1 && /^[0-9]$/.test(i)) return i === r;
|
|
20
|
+
}
|
|
21
|
+
return e.code in o ? o[e.code] === r : !1;
|
|
22
|
+
}
|
|
23
|
+
return t === r;
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
y as matchesKeyboardEvent
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./constants.cjs.js");function f(e,l=o.detectPlatform()){const r=e.split("+"),t=new Set;let i="";for(let n=0;n<r.length;n++){const s=r[n].trim();if(n===r.length-1)i=o.normalizeKeyName(s);else{const a=o.MODIFIER_ALIASES[s]??o.MODIFIER_ALIASES[s.toLowerCase()];if(a){const m=o.resolveModifier(a,l);t.add(m)}else r.length===1&&(i=o.normalizeKeyName(s))}}return!i&&r.length>0&&(i=o.normalizeKeyName(r[r.length-1].trim())),{key:i,ctrl:t.has("Control"),shift:t.has("Shift"),alt:t.has("Alt"),meta:t.has("Meta"),modifiers:o.MODIFIER_ORDER.filter(n=>t.has(n))}}function u(e,l=o.detectPlatform()){let r=e.ctrl??!1;const t=e.shift??!1,i=e.alt??!1;let n=e.meta??!1;e.mod&&(o.resolveModifier("Mod",l)==="Control"?r=!0:n=!0);const s=o.MODIFIER_ORDER.filter(a=>{switch(a){case"Control":return r;case"Shift":return t;case"Alt":return i;case"Meta":return n;default:return!1}});return{key:e.key,ctrl:r,shift:t,alt:i,meta:n,modifiers:s}}function h(e,l){const r=l==="mac"?e.meta&&!e.ctrl:e.ctrl&&!e.meta,t=[];if(r)t.push("Mod"),e.alt&&t.push("Alt"),e.shift&&t.push("Shift");else for(const i of o.MODIFIER_ORDER)e.modifiers.includes(i)&&t.push(i);return t.push(o.normalizeKeyName(e.key)),t.join("+")}function c(e,l=o.detectPlatform()){return h(f(e,l),l)}function y(e,l=o.detectPlatform()){return c(e,l)}exports.normalizeHotkey=c;exports.normalizeRegisterableHotkey=y;exports.parseHotkey=f;exports.rawHotkeyToParsedHotkey=u;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { detectPlatform as a, normalizeKeyName as f, MODIFIER_ALIASES as u, resolveModifier as h, MODIFIER_ORDER as c } from "./constants.es.js";
|
|
3
|
+
function d(t, r = a()) {
|
|
4
|
+
const o = t.split("+"), e = /* @__PURE__ */ new Set();
|
|
5
|
+
let i = "";
|
|
6
|
+
for (let s = 0; s < o.length; s++) {
|
|
7
|
+
const n = o[s].trim();
|
|
8
|
+
if (s === o.length - 1) i = f(n);
|
|
9
|
+
else {
|
|
10
|
+
const l = u[n] ?? u[n.toLowerCase()];
|
|
11
|
+
if (l) {
|
|
12
|
+
const m = h(l, r);
|
|
13
|
+
e.add(m);
|
|
14
|
+
} else o.length === 1 && (i = f(n));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return !i && o.length > 0 && (i = f(o[o.length - 1].trim())), {
|
|
18
|
+
key: i,
|
|
19
|
+
ctrl: e.has("Control"),
|
|
20
|
+
shift: e.has("Shift"),
|
|
21
|
+
alt: e.has("Alt"),
|
|
22
|
+
meta: e.has("Meta"),
|
|
23
|
+
modifiers: c.filter((s) => e.has(s))
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function g(t, r = a()) {
|
|
27
|
+
let o = t.ctrl ?? !1;
|
|
28
|
+
const e = t.shift ?? !1, i = t.alt ?? !1;
|
|
29
|
+
let s = t.meta ?? !1;
|
|
30
|
+
t.mod && (h("Mod", r) === "Control" ? o = !0 : s = !0);
|
|
31
|
+
const n = c.filter((l) => {
|
|
32
|
+
switch (l) {
|
|
33
|
+
case "Control":
|
|
34
|
+
return o;
|
|
35
|
+
case "Shift":
|
|
36
|
+
return e;
|
|
37
|
+
case "Alt":
|
|
38
|
+
return i;
|
|
39
|
+
case "Meta":
|
|
40
|
+
return s;
|
|
41
|
+
default:
|
|
42
|
+
return !1;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
key: t.key,
|
|
47
|
+
ctrl: o,
|
|
48
|
+
shift: e,
|
|
49
|
+
alt: i,
|
|
50
|
+
meta: s,
|
|
51
|
+
modifiers: n
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function y(t, r) {
|
|
55
|
+
const o = r === "mac" ? t.meta && !t.ctrl : t.ctrl && !t.meta, e = [];
|
|
56
|
+
if (o)
|
|
57
|
+
e.push("Mod"), t.alt && e.push("Alt"), t.shift && e.push("Shift");
|
|
58
|
+
else for (const i of c) t.modifiers.includes(i) && e.push(i);
|
|
59
|
+
return e.push(f(t.key)), e.join("+");
|
|
60
|
+
}
|
|
61
|
+
function k(t, r = a()) {
|
|
62
|
+
return y(d(t, r), r);
|
|
63
|
+
}
|
|
64
|
+
function S(t, r = a()) {
|
|
65
|
+
return k(t, r);
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
k as normalizeHotkey,
|
|
69
|
+
S as normalizeRegisterableHotkey,
|
|
70
|
+
d as parseHotkey,
|
|
71
|
+
g as rawHotkeyToParsedHotkey
|
|
72
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),o=e.createContext(null);function n(){var t;return((t=e.useContext(o))==null?void 0:t.defaultOptions)??{}}exports.useDefaultHotkeysOptions=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./HotkeysProvider.cjs.js"),q=require("./utils.cjs.js"),A=require("../../hotkeys/dist/constants.cjs.js"),O=require("../../hotkeys/dist/parse.cjs.js"),T=require("../../hotkeys/dist/hotkey-manager.cjs.js"),t=require("react");function b(k,i,p={}){var g;const n={...H.useDefaultHotkeysOptions().hotkey,...p},l=T.getHotkeyManager(),e=t.useRef(null),a=t.useRef(i),r=t.useRef(n),f=t.useRef(l);a.current=i,r.current=n,f.current=l;const u=t.useRef(null),c=t.useRef(null),s=O.normalizeRegisterableHotkey(k,n.platform??A.detectPlatform()),{target:M,...v}=n;t.useEffect(()=>{var R,y;const o=q.isRef(r.current.target)?r.current.target.current:r.current.target??(typeof document<"u"?document:null);if(!o){(R=e.current)!=null&&R.isActive&&(e.current.unregister(),e.current=null),u.current=null,c.current=null;return}const m=u.current!==null&&u.current!==o,h=c.current!==null&&c.current!==s;return(y=e.current)!=null&&y.isActive&&(m||h)&&(e.current.unregister(),e.current=null),(!e.current||!e.current.isActive)&&(e.current=f.current.register(s,a.current,{...r.current,target:o})),u.current=o,c.current=s,()=>{var d;(d=e.current)!=null&&d.isActive&&(e.current.unregister(),e.current=null)}},[s]),(g=e.current)!=null&&g.isActive&&(e.current.callback=i,e.current.setOptions(v))}exports.useHotkey=b;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useDefaultHotkeysOptions as A } from "./HotkeysProvider.es.js";
|
|
3
|
+
import { isRef as H } from "./utils.es.js";
|
|
4
|
+
import { detectPlatform as O } from "../../hotkeys/dist/constants.es.js";
|
|
5
|
+
import { normalizeRegisterableHotkey as T } from "../../hotkeys/dist/parse.es.js";
|
|
6
|
+
import { getHotkeyManager as C } from "../../hotkeys/dist/hotkey-manager.es.js";
|
|
7
|
+
import { useRef as t, useEffect as b } from "react";
|
|
8
|
+
function W(y, s, R = {}) {
|
|
9
|
+
var g;
|
|
10
|
+
const n = {
|
|
11
|
+
...A().hotkey,
|
|
12
|
+
...R
|
|
13
|
+
}, l = C(), r = t(null), f = t(s), e = t(n), a = t(l);
|
|
14
|
+
f.current = s, e.current = n, a.current = l;
|
|
15
|
+
const u = t(null), c = t(null), o = T(y, n.platform ?? O()), { target: x, ...k } = n;
|
|
16
|
+
b(() => {
|
|
17
|
+
var m, p;
|
|
18
|
+
const i = H(e.current.target) ? e.current.target.current : e.current.target ?? (typeof document < "u" ? document : null);
|
|
19
|
+
if (!i) {
|
|
20
|
+
(m = r.current) != null && m.isActive && (r.current.unregister(), r.current = null), u.current = null, c.current = null;
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const v = u.current !== null && u.current !== i, h = c.current !== null && c.current !== o;
|
|
24
|
+
return (p = r.current) != null && p.isActive && (v || h) && (r.current.unregister(), r.current = null), (!r.current || !r.current.isActive) && (r.current = a.current.register(o, f.current, {
|
|
25
|
+
...e.current,
|
|
26
|
+
target: i
|
|
27
|
+
})), u.current = i, c.current = o, () => {
|
|
28
|
+
var d;
|
|
29
|
+
(d = r.current) != null && d.isActive && (r.current.unregister(), r.current = null);
|
|
30
|
+
};
|
|
31
|
+
}, [o]), (g = r.current) != null && g.isActive && (r.current.callback = s, r.current.setOptions(k));
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
W as useHotkey
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(e){return e!==null&&typeof e=="object"&&"current"in e}exports.isRef=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var b=(u=>(u[u.None=0]="None",u[u.Mutable=1]="Mutable",u[u.Watching=2]="Watching",u[u.RecursedCheck=4]="RecursedCheck",u[u.Recursed=8]="Recursed",u[u.Dirty=16]="Dirty",u[u.Pending=32]="Pending",u))(b||{});function T({update:u,notify:p,unwatched:l}){return{link:S,unlink:x,propagate:a,checkDirty:D,shallowPropagate:d};function S(e,s,i){const n=s.depsTail;if(n!==void 0&&n.dep===e)return;const t=n!==void 0?n.nextDep:s.deps;if(t!==void 0&&t.dep===e){t.version=i,s.depsTail=t;return}const o=e.subsTail;if(o!==void 0&&o.version===i&&o.sub===s)return;const f=s.depsTail=e.subsTail={version:i,dep:e,sub:s,prevDep:n,nextDep:t,prevSub:o,nextSub:void 0};t!==void 0&&(t.prevDep=f),n!==void 0?n.nextDep=f:s.deps=f,o!==void 0?o.nextSub=f:e.subs=f}function x(e,s=e.sub){const i=e.dep,n=e.prevDep,t=e.nextDep,o=e.nextSub,f=e.prevSub;return t!==void 0?t.prevDep=n:s.depsTail=n,n!==void 0?n.nextDep=t:s.deps=t,o!==void 0?o.prevSub=f:i.subsTail=f,f!==void 0?f.nextSub=o:(i.subs=o)===void 0&&l(i),t}function a(e){let s=e.nextSub,i;e:do{const n=e.sub;let t=n.flags;if(t&60?t&12?t&4?!(t&48)&&h(e,n)?(n.flags=t|40,t&=1):t=0:n.flags=t&-9|32:t=0:n.flags=t|32,t&2&&p(n),t&1){const o=n.subs;if(o!==void 0){const f=(e=o).nextSub;f!==void 0&&(i={value:s,prev:i},s=f);continue}}if((e=s)!==void 0){s=e.nextSub;continue}for(;i!==void 0;)if(e=i.value,i=i.prev,e!==void 0){s=e.nextSub;continue e}break}while(!0)}function D(e,s){let i,n=0,t=!1;e:do{const o=e.dep,f=o.flags;if(s.flags&16)t=!0;else if((f&17)===17){if(u(o)){const r=o.subs;r.nextSub!==void 0&&d(r),t=!0}}else if((f&33)===33){(e.nextSub!==void 0||e.prevSub!==void 0)&&(i={value:e,prev:i}),e=o.deps,s=o,++n;continue}if(!t){const r=e.nextDep;if(r!==void 0){e=r;continue}}for(;n--;){const r=s.subs,c=r.nextSub!==void 0;if(c?(e=i.value,i=i.prev):e=r,t){if(u(s)){c&&d(r),s=e.sub;continue}t=!1}else s.flags&=-33;s=e.sub;const v=e.nextDep;if(v!==void 0){e=v;continue e}}return t}while(!0)}function d(e){do{const s=e.sub,i=s.flags;(i&48)===32&&(s.flags=i|16,(i&6)===2&&p(s))}while((e=e.nextSub)!==void 0)}function h(e,s){let i=s.depsTail;for(;i!==void 0;){if(i===e)return!0;i=i.prevDep}return!1}}exports.ReactiveFlags=b;exports.createReactiveSystem=T;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var h = /* @__PURE__ */ ((u) => (u[u.None = 0] = "None", u[u.Mutable = 1] = "Mutable", u[u.Watching = 2] = "Watching", u[u.RecursedCheck = 4] = "RecursedCheck", u[u.Recursed = 8] = "Recursed", u[u.Dirty = 16] = "Dirty", u[u.Pending = 32] = "Pending", u))(h || {});
|
|
3
|
+
// @__NO_SIDE_EFFECTS__
|
|
4
|
+
function w({
|
|
5
|
+
update: u,
|
|
6
|
+
notify: p,
|
|
7
|
+
unwatched: b
|
|
8
|
+
}) {
|
|
9
|
+
return {
|
|
10
|
+
link: x,
|
|
11
|
+
unlink: l,
|
|
12
|
+
propagate: S,
|
|
13
|
+
checkDirty: D,
|
|
14
|
+
shallowPropagate: d
|
|
15
|
+
};
|
|
16
|
+
function x(e, s, n) {
|
|
17
|
+
const i = s.depsTail;
|
|
18
|
+
if (i !== void 0 && i.dep === e)
|
|
19
|
+
return;
|
|
20
|
+
const t = i !== void 0 ? i.nextDep : s.deps;
|
|
21
|
+
if (t !== void 0 && t.dep === e) {
|
|
22
|
+
t.version = n, s.depsTail = t;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const o = e.subsTail;
|
|
26
|
+
if (o !== void 0 && o.version === n && o.sub === s)
|
|
27
|
+
return;
|
|
28
|
+
const f = s.depsTail = e.subsTail = {
|
|
29
|
+
version: n,
|
|
30
|
+
dep: e,
|
|
31
|
+
sub: s,
|
|
32
|
+
prevDep: i,
|
|
33
|
+
nextDep: t,
|
|
34
|
+
prevSub: o,
|
|
35
|
+
nextSub: void 0
|
|
36
|
+
};
|
|
37
|
+
t !== void 0 && (t.prevDep = f), i !== void 0 ? i.nextDep = f : s.deps = f, o !== void 0 ? o.nextSub = f : e.subs = f;
|
|
38
|
+
}
|
|
39
|
+
function l(e, s = e.sub) {
|
|
40
|
+
const n = e.dep, i = e.prevDep, t = e.nextDep, o = e.nextSub, f = e.prevSub;
|
|
41
|
+
return t !== void 0 ? t.prevDep = i : s.depsTail = i, i !== void 0 ? i.nextDep = t : s.deps = t, o !== void 0 ? o.prevSub = f : n.subsTail = f, f !== void 0 ? f.nextSub = o : (n.subs = o) === void 0 && b(n), t;
|
|
42
|
+
}
|
|
43
|
+
function S(e) {
|
|
44
|
+
let s = e.nextSub, n;
|
|
45
|
+
e: do {
|
|
46
|
+
const i = e.sub;
|
|
47
|
+
let t = i.flags;
|
|
48
|
+
if (t & 60 ? t & 12 ? t & 4 ? !(t & 48) && a(e, i) ? (i.flags = t | 40, t &= 1) : t = 0 : i.flags = t & -9 | 32 : t = 0 : i.flags = t | 32, t & 2 && p(i), t & 1) {
|
|
49
|
+
const o = i.subs;
|
|
50
|
+
if (o !== void 0) {
|
|
51
|
+
const f = (e = o).nextSub;
|
|
52
|
+
f !== void 0 && (n = { value: s, prev: n }, s = f);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if ((e = s) !== void 0) {
|
|
57
|
+
s = e.nextSub;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
for (; n !== void 0; )
|
|
61
|
+
if (e = n.value, n = n.prev, e !== void 0) {
|
|
62
|
+
s = e.nextSub;
|
|
63
|
+
continue e;
|
|
64
|
+
}
|
|
65
|
+
break;
|
|
66
|
+
} while (!0);
|
|
67
|
+
}
|
|
68
|
+
function D(e, s) {
|
|
69
|
+
let n, i = 0, t = !1;
|
|
70
|
+
e: do {
|
|
71
|
+
const o = e.dep, f = o.flags;
|
|
72
|
+
if (s.flags & 16)
|
|
73
|
+
t = !0;
|
|
74
|
+
else if ((f & 17) === 17) {
|
|
75
|
+
if (u(o)) {
|
|
76
|
+
const r = o.subs;
|
|
77
|
+
r.nextSub !== void 0 && d(r), t = !0;
|
|
78
|
+
}
|
|
79
|
+
} else if ((f & 33) === 33) {
|
|
80
|
+
(e.nextSub !== void 0 || e.prevSub !== void 0) && (n = { value: e, prev: n }), e = o.deps, s = o, ++i;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (!t) {
|
|
84
|
+
const r = e.nextDep;
|
|
85
|
+
if (r !== void 0) {
|
|
86
|
+
e = r;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
for (; i--; ) {
|
|
91
|
+
const r = s.subs, c = r.nextSub !== void 0;
|
|
92
|
+
if (c ? (e = n.value, n = n.prev) : e = r, t) {
|
|
93
|
+
if (u(s)) {
|
|
94
|
+
c && d(r), s = e.sub;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
t = !1;
|
|
98
|
+
} else
|
|
99
|
+
s.flags &= -33;
|
|
100
|
+
s = e.sub;
|
|
101
|
+
const v = e.nextDep;
|
|
102
|
+
if (v !== void 0) {
|
|
103
|
+
e = v;
|
|
104
|
+
continue e;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return t;
|
|
108
|
+
} while (!0);
|
|
109
|
+
}
|
|
110
|
+
function d(e) {
|
|
111
|
+
do {
|
|
112
|
+
const s = e.sub, n = s.flags;
|
|
113
|
+
(n & 48) === 32 && (s.flags = n | 16, (n & 6) === 2 && p(s));
|
|
114
|
+
} while ((e = e.nextSub) !== void 0);
|
|
115
|
+
}
|
|
116
|
+
function a(e, s) {
|
|
117
|
+
let n = s.depsTail;
|
|
118
|
+
for (; n !== void 0; ) {
|
|
119
|
+
if (n === e)
|
|
120
|
+
return !0;
|
|
121
|
+
n = n.prevDep;
|
|
122
|
+
}
|
|
123
|
+
return !1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
h as ReactiveFlags,
|
|
128
|
+
w as createReactiveSystem
|
|
129
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./alien.cjs.js");function F(t,l,i){var a,c,r;const o=typeof t=="object",e=o?t:void 0;return{next:(a=o?t.next:t)==null?void 0:a.bind(e),error:(c=o?t.error:l)==null?void 0:c.bind(e),complete:(r=o?t.complete:i)==null?void 0:r.bind(e)}}const p=[];let v=0;const{link:R,unlink:_,propagate:k,checkDirty:y,shallowPropagate:b}=s.createReactiveSystem({update(t){return t._update()},notify(t){p[h++]=t,t.flags&=~s.ReactiveFlags.Watching},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=s.ReactiveFlags.Mutable|s.ReactiveFlags.Dirty,g(t))}});let d=0,h=0,n;function g(t){const l=t.depsTail;let i=l!==void 0?l.nextDep:t.deps;for(;i!==void 0;)i=_(i,t)}function T(){for(;d<h;){const t=p[d];p[d++]=void 0,t.notify()}d=0,h=0}function D(t,l){const i=typeof t=="function",o=t,e={_snapshot:i?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:i?s.ReactiveFlags.None:s.ReactiveFlags.Mutable,get(){return n!==void 0&&R(e,n,v),e._snapshot},subscribe(a){const c=F(a),r={current:!1},f=m(()=>{var u;e.get(),r.current?(u=c.next)==null||u.call(c,e._snapshot):r.current=!0});return{unsubscribe:()=>{f.stop()}}},_update(a){const c=n,r=Object.is;if(i)n=e,++v,e.depsTail=void 0;else if(a===void 0)return!1;i&&(e.flags=s.ReactiveFlags.Mutable|s.ReactiveFlags.RecursedCheck);try{const f=e._snapshot,u=typeof a=="function"?a(f):a===void 0&&i?o(f):a;return f===void 0||!r(f,u)?(e._snapshot=u,!0):!1}finally{n=c,i&&(e.flags&=~s.ReactiveFlags.RecursedCheck),g(e)}}};return i?(e.flags=s.ReactiveFlags.Mutable|s.ReactiveFlags.Dirty,e.get=function(){const a=e.flags;if(a&s.ReactiveFlags.Dirty||a&s.ReactiveFlags.Pending&&y(e.deps,e)){if(e._update()){const c=e.subs;c!==void 0&&b(c)}}else a&s.ReactiveFlags.Pending&&(e.flags=a&~s.ReactiveFlags.Pending);return n!==void 0&&R(e,n,v),e._snapshot}):e.set=function(a){if(e._update(a)){const c=e.subs;c!==void 0&&(k(c),b(c),T())}},e}function m(t){const l=()=>{const o=n;n=i,++v,i.depsTail=void 0,i.flags=s.ReactiveFlags.Watching|s.ReactiveFlags.RecursedCheck;try{return t()}finally{n=o,i.flags&=~s.ReactiveFlags.RecursedCheck,g(i)}},i={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:s.ReactiveFlags.Watching|s.ReactiveFlags.RecursedCheck,notify(){const o=this.flags;o&s.ReactiveFlags.Dirty||o&s.ReactiveFlags.Pending&&y(this.deps,this)?l():this.flags=s.ReactiveFlags.Watching},stop(){this.flags=s.ReactiveFlags.None,this.depsTail=void 0,g(this)}};return l(),i}exports.createAtom=D;exports.flush=T;exports.toObserver=F;
|