hookery 0.0.1 → 1.0.0

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.
Files changed (98) hide show
  1. package/README.md +72 -11
  2. package/dist/bridges/auth0.d.mts +16 -0
  3. package/dist/bridges/auth0.d.ts +16 -0
  4. package/dist/bridges/auth0.js +3015 -0
  5. package/dist/bridges/auth0.js.map +1 -0
  6. package/dist/bridges/auth0.mjs +2977 -0
  7. package/dist/bridges/auth0.mjs.map +1 -0
  8. package/dist/bridges/axios.d.mts +17 -0
  9. package/dist/bridges/axios.d.ts +17 -0
  10. package/dist/bridges/axios.js +15351 -0
  11. package/dist/bridges/axios.js.map +1 -0
  12. package/dist/bridges/axios.mjs +15347 -0
  13. package/dist/bridges/axios.mjs.map +1 -0
  14. package/dist/bridges/clerk.d.mts +1 -0
  15. package/dist/bridges/clerk.d.ts +1 -0
  16. package/dist/bridges/clerk.js +5991 -0
  17. package/dist/bridges/clerk.js.map +1 -0
  18. package/dist/bridges/clerk.mjs +5985 -0
  19. package/dist/bridges/clerk.mjs.map +1 -0
  20. package/dist/bridges/firebase.d.mts +14 -0
  21. package/dist/bridges/firebase.d.ts +14 -0
  22. package/dist/bridges/firebase.js +52 -0
  23. package/dist/bridges/firebase.js.map +1 -0
  24. package/dist/bridges/firebase.mjs +25 -0
  25. package/dist/bridges/firebase.mjs.map +1 -0
  26. package/dist/bridges/jotai.d.mts +11 -0
  27. package/dist/bridges/jotai.d.ts +11 -0
  28. package/dist/bridges/jotai.js +870 -0
  29. package/dist/bridges/jotai.js.map +1 -0
  30. package/dist/bridges/jotai.mjs +827 -0
  31. package/dist/bridges/jotai.mjs.map +1 -0
  32. package/dist/bridges/motion.d.mts +6 -0
  33. package/dist/bridges/motion.d.ts +6 -0
  34. package/dist/bridges/motion.js +3752 -0
  35. package/dist/bridges/motion.js.map +1 -0
  36. package/dist/bridges/motion.mjs +3721 -0
  37. package/dist/bridges/motion.mjs.map +1 -0
  38. package/dist/bridges/next.d.mts +10 -0
  39. package/dist/bridges/next.d.ts +10 -0
  40. package/dist/bridges/next.js +2588 -0
  41. package/dist/bridges/next.js.map +1 -0
  42. package/dist/bridges/next.mjs +2582 -0
  43. package/dist/bridges/next.mjs.map +1 -0
  44. package/dist/bridges/redux.d.mts +15 -0
  45. package/dist/bridges/redux.d.ts +15 -0
  46. package/dist/bridges/redux.js +410 -0
  47. package/dist/bridges/redux.js.map +1 -0
  48. package/dist/bridges/redux.mjs +402 -0
  49. package/dist/bridges/redux.mjs.map +1 -0
  50. package/dist/bridges/remix.d.mts +1 -0
  51. package/dist/bridges/remix.d.ts +1 -0
  52. package/dist/bridges/remix.js +2215 -0
  53. package/dist/bridges/remix.js.map +1 -0
  54. package/dist/bridges/remix.mjs +2174 -0
  55. package/dist/bridges/remix.mjs.map +1 -0
  56. package/dist/bridges/stripe.d.mts +15 -0
  57. package/dist/bridges/stripe.d.ts +15 -0
  58. package/dist/bridges/stripe.js +1572 -0
  59. package/dist/bridges/stripe.js.map +1 -0
  60. package/dist/bridges/stripe.mjs +1556 -0
  61. package/dist/bridges/stripe.mjs.map +1 -0
  62. package/dist/bridges/supabase.d.mts +13 -0
  63. package/dist/bridges/supabase.d.ts +13 -0
  64. package/dist/bridges/supabase.js +51 -0
  65. package/dist/bridges/supabase.js.map +1 -0
  66. package/dist/bridges/supabase.mjs +24 -0
  67. package/dist/bridges/supabase.mjs.map +1 -0
  68. package/dist/bridges/tanstack.d.mts +3 -0
  69. package/dist/bridges/tanstack.d.ts +3 -0
  70. package/dist/bridges/tanstack.js +1319 -0
  71. package/dist/bridges/tanstack.js.map +1 -0
  72. package/dist/bridges/tanstack.mjs +1281 -0
  73. package/dist/bridges/tanstack.mjs.map +1 -0
  74. package/dist/bridges/yup.d.mts +16 -0
  75. package/dist/bridges/yup.d.ts +16 -0
  76. package/dist/bridges/yup.js +80 -0
  77. package/dist/bridges/yup.js.map +1 -0
  78. package/dist/bridges/yup.mjs +43 -0
  79. package/dist/bridges/yup.mjs.map +1 -0
  80. package/dist/bridges/zod.d.mts +19 -0
  81. package/dist/bridges/zod.d.ts +19 -0
  82. package/dist/bridges/zod.js +66 -0
  83. package/dist/bridges/zod.js.map +1 -0
  84. package/dist/bridges/zod.mjs +39 -0
  85. package/dist/bridges/zod.mjs.map +1 -0
  86. package/dist/bridges/zustand.d.mts +14 -0
  87. package/dist/bridges/zustand.d.ts +14 -0
  88. package/dist/bridges/zustand.js +58 -0
  89. package/dist/bridges/zustand.js.map +1 -0
  90. package/dist/bridges/zustand.mjs +21 -0
  91. package/dist/bridges/zustand.mjs.map +1 -0
  92. package/dist/index.d.mts +3124 -8
  93. package/dist/index.d.ts +3124 -8
  94. package/dist/index.js +4290 -10
  95. package/dist/index.js.map +1 -0
  96. package/dist/index.mjs +4172 -7
  97. package/dist/index.mjs.map +1 -0
  98. package/package.json +131 -6
@@ -0,0 +1,402 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ // node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js
34
+ var require_use_sync_external_store_with_selector_production = __commonJS({
35
+ "node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js"(exports) {
36
+ "use strict";
37
+ var React2 = __require("react");
38
+ function is(x, y) {
39
+ return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
40
+ }
41
+ var objectIs = "function" === typeof Object.is ? Object.is : is;
42
+ var useSyncExternalStore2 = React2.useSyncExternalStore;
43
+ var useRef2 = React2.useRef;
44
+ var useEffect2 = React2.useEffect;
45
+ var useMemo2 = React2.useMemo;
46
+ var useDebugValue2 = React2.useDebugValue;
47
+ exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
48
+ var instRef = useRef2(null);
49
+ if (null === instRef.current) {
50
+ var inst = { hasValue: false, value: null };
51
+ instRef.current = inst;
52
+ } else inst = instRef.current;
53
+ instRef = useMemo2(
54
+ function() {
55
+ function memoizedSelector(nextSnapshot) {
56
+ if (!hasMemo) {
57
+ hasMemo = true;
58
+ memoizedSnapshot = nextSnapshot;
59
+ nextSnapshot = selector(nextSnapshot);
60
+ if (void 0 !== isEqual && inst.hasValue) {
61
+ var currentSelection = inst.value;
62
+ if (isEqual(currentSelection, nextSnapshot))
63
+ return memoizedSelection = currentSelection;
64
+ }
65
+ return memoizedSelection = nextSnapshot;
66
+ }
67
+ currentSelection = memoizedSelection;
68
+ if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
69
+ var nextSelection = selector(nextSnapshot);
70
+ if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
71
+ return memoizedSnapshot = nextSnapshot, currentSelection;
72
+ memoizedSnapshot = nextSnapshot;
73
+ return memoizedSelection = nextSelection;
74
+ }
75
+ var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
76
+ return [
77
+ function() {
78
+ return memoizedSelector(getSnapshot());
79
+ },
80
+ null === maybeGetServerSnapshot ? void 0 : function() {
81
+ return memoizedSelector(maybeGetServerSnapshot());
82
+ }
83
+ ];
84
+ },
85
+ [getSnapshot, getServerSnapshot, selector, isEqual]
86
+ );
87
+ var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]);
88
+ useEffect2(
89
+ function() {
90
+ inst.hasValue = true;
91
+ inst.value = value;
92
+ },
93
+ [value]
94
+ );
95
+ useDebugValue2(value);
96
+ return value;
97
+ };
98
+ }
99
+ });
100
+
101
+ // node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js
102
+ var require_use_sync_external_store_with_selector_development = __commonJS({
103
+ "node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js"(exports) {
104
+ "use strict";
105
+ "production" !== process.env.NODE_ENV && (function() {
106
+ function is(x, y) {
107
+ return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
108
+ }
109
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
110
+ var React2 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore2 = React2.useSyncExternalStore, useRef2 = React2.useRef, useEffect2 = React2.useEffect, useMemo2 = React2.useMemo, useDebugValue2 = React2.useDebugValue;
111
+ exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
112
+ var instRef = useRef2(null);
113
+ if (null === instRef.current) {
114
+ var inst = { hasValue: false, value: null };
115
+ instRef.current = inst;
116
+ } else inst = instRef.current;
117
+ instRef = useMemo2(
118
+ function() {
119
+ function memoizedSelector(nextSnapshot) {
120
+ if (!hasMemo) {
121
+ hasMemo = true;
122
+ memoizedSnapshot = nextSnapshot;
123
+ nextSnapshot = selector(nextSnapshot);
124
+ if (void 0 !== isEqual && inst.hasValue) {
125
+ var currentSelection = inst.value;
126
+ if (isEqual(currentSelection, nextSnapshot))
127
+ return memoizedSelection = currentSelection;
128
+ }
129
+ return memoizedSelection = nextSnapshot;
130
+ }
131
+ currentSelection = memoizedSelection;
132
+ if (objectIs(memoizedSnapshot, nextSnapshot))
133
+ return currentSelection;
134
+ var nextSelection = selector(nextSnapshot);
135
+ if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
136
+ return memoizedSnapshot = nextSnapshot, currentSelection;
137
+ memoizedSnapshot = nextSnapshot;
138
+ return memoizedSelection = nextSelection;
139
+ }
140
+ var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
141
+ return [
142
+ function() {
143
+ return memoizedSelector(getSnapshot());
144
+ },
145
+ null === maybeGetServerSnapshot ? void 0 : function() {
146
+ return memoizedSelector(maybeGetServerSnapshot());
147
+ }
148
+ ];
149
+ },
150
+ [getSnapshot, getServerSnapshot, selector, isEqual]
151
+ );
152
+ var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]);
153
+ useEffect2(
154
+ function() {
155
+ inst.hasValue = true;
156
+ inst.value = value;
157
+ },
158
+ [value]
159
+ );
160
+ useDebugValue2(value);
161
+ return value;
162
+ };
163
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
164
+ })();
165
+ }
166
+ });
167
+
168
+ // node_modules/use-sync-external-store/with-selector.js
169
+ var require_with_selector = __commonJS({
170
+ "node_modules/use-sync-external-store/with-selector.js"(exports, module) {
171
+ "use strict";
172
+ if (process.env.NODE_ENV === "production") {
173
+ module.exports = require_use_sync_external_store_with_selector_production();
174
+ } else {
175
+ module.exports = require_use_sync_external_store_with_selector_development();
176
+ }
177
+ }
178
+ });
179
+
180
+ // node_modules/react-redux/dist/react-redux.mjs
181
+ var import_with_selector = __toESM(require_with_selector(), 1);
182
+ import * as React from "react";
183
+ var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
184
+ var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
185
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
186
+ var Memo = REACT_MEMO_TYPE;
187
+ var FORWARD_REF_STATICS = {
188
+ $$typeof: true,
189
+ render: true,
190
+ defaultProps: true,
191
+ displayName: true,
192
+ propTypes: true
193
+ };
194
+ var MEMO_STATICS = {
195
+ $$typeof: true,
196
+ compare: true,
197
+ defaultProps: true,
198
+ displayName: true,
199
+ propTypes: true,
200
+ type: true
201
+ };
202
+ var TYPE_STATICS = {
203
+ [ForwardRef]: FORWARD_REF_STATICS,
204
+ [Memo]: MEMO_STATICS
205
+ };
206
+ var objectPrototype = Object.prototype;
207
+ var ContextKey = /* @__PURE__ */ Symbol.for(`react-redux-context`);
208
+ var gT = typeof globalThis !== "undefined" ? globalThis : (
209
+ /* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
210
+ {}
211
+ );
212
+ function getContext() {
213
+ if (!React.createContext) return {};
214
+ const contextMap = gT[ContextKey] ?? (gT[ContextKey] = /* @__PURE__ */ new Map());
215
+ let realContext = contextMap.get(React.createContext);
216
+ if (!realContext) {
217
+ realContext = React.createContext(
218
+ null
219
+ );
220
+ if (process.env.NODE_ENV !== "production") {
221
+ realContext.displayName = "ReactRedux";
222
+ }
223
+ contextMap.set(React.createContext, realContext);
224
+ }
225
+ return realContext;
226
+ }
227
+ var ReactReduxContext = /* @__PURE__ */ getContext();
228
+ function createReduxContextHook(context = ReactReduxContext) {
229
+ return function useReduxContext2() {
230
+ const contextValue = React.useContext(context);
231
+ if (process.env.NODE_ENV !== "production" && !contextValue) {
232
+ throw new Error(
233
+ "could not find react-redux context value; please ensure the component is wrapped in a <Provider>"
234
+ );
235
+ }
236
+ return contextValue;
237
+ };
238
+ }
239
+ var useReduxContext = /* @__PURE__ */ createReduxContextHook();
240
+ function createStoreHook(context = ReactReduxContext) {
241
+ const useReduxContext2 = context === ReactReduxContext ? useReduxContext : (
242
+ // @ts-ignore
243
+ createReduxContextHook(context)
244
+ );
245
+ const useStore2 = () => {
246
+ const { store } = useReduxContext2();
247
+ return store;
248
+ };
249
+ Object.assign(useStore2, {
250
+ withTypes: () => useStore2
251
+ });
252
+ return useStore2;
253
+ }
254
+ var useStore = /* @__PURE__ */ createStoreHook();
255
+ function createDispatchHook(context = ReactReduxContext) {
256
+ const useStore2 = context === ReactReduxContext ? useStore : createStoreHook(context);
257
+ const useDispatch2 = () => {
258
+ const store = useStore2();
259
+ return store.dispatch;
260
+ };
261
+ Object.assign(useDispatch2, {
262
+ withTypes: () => useDispatch2
263
+ });
264
+ return useDispatch2;
265
+ }
266
+ var useDispatch = /* @__PURE__ */ createDispatchHook();
267
+ var refEquality = (a, b) => a === b;
268
+ function createSelectorHook(context = ReactReduxContext) {
269
+ const useReduxContext2 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
270
+ const useSelector2 = (selector, equalityFnOrOptions = {}) => {
271
+ const { equalityFn = refEquality } = typeof equalityFnOrOptions === "function" ? { equalityFn: equalityFnOrOptions } : equalityFnOrOptions;
272
+ if (process.env.NODE_ENV !== "production") {
273
+ if (!selector) {
274
+ throw new Error(`You must pass a selector to useSelector`);
275
+ }
276
+ if (typeof selector !== "function") {
277
+ throw new Error(`You must pass a function as a selector to useSelector`);
278
+ }
279
+ if (typeof equalityFn !== "function") {
280
+ throw new Error(
281
+ `You must pass a function as an equality function to useSelector`
282
+ );
283
+ }
284
+ }
285
+ const reduxContext = useReduxContext2();
286
+ const { store, subscription, getServerState } = reduxContext;
287
+ const firstRun = React.useRef(true);
288
+ const wrappedSelector = React.useCallback(
289
+ {
290
+ [selector.name](state) {
291
+ const selected = selector(state);
292
+ if (process.env.NODE_ENV !== "production") {
293
+ const { devModeChecks = {} } = typeof equalityFnOrOptions === "function" ? {} : equalityFnOrOptions;
294
+ const { identityFunctionCheck, stabilityCheck } = reduxContext;
295
+ const {
296
+ identityFunctionCheck: finalIdentityFunctionCheck,
297
+ stabilityCheck: finalStabilityCheck
298
+ } = {
299
+ stabilityCheck,
300
+ identityFunctionCheck,
301
+ ...devModeChecks
302
+ };
303
+ if (finalStabilityCheck === "always" || finalStabilityCheck === "once" && firstRun.current) {
304
+ const toCompare = selector(state);
305
+ if (!equalityFn(selected, toCompare)) {
306
+ let stack = void 0;
307
+ try {
308
+ throw new Error();
309
+ } catch (e) {
310
+ ;
311
+ ({ stack } = e);
312
+ }
313
+ console.warn(
314
+ "Selector " + (selector.name || "unknown") + " returned a different result when called with the same parameters. This can lead to unnecessary rerenders.\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization",
315
+ {
316
+ state,
317
+ selected,
318
+ selected2: toCompare,
319
+ stack
320
+ }
321
+ );
322
+ }
323
+ }
324
+ if (finalIdentityFunctionCheck === "always" || finalIdentityFunctionCheck === "once" && firstRun.current) {
325
+ if (selected === state) {
326
+ let stack = void 0;
327
+ try {
328
+ throw new Error();
329
+ } catch (e) {
330
+ ;
331
+ ({ stack } = e);
332
+ }
333
+ console.warn(
334
+ "Selector " + (selector.name || "unknown") + " returned the root state when called. This can lead to unnecessary rerenders.\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.",
335
+ { stack }
336
+ );
337
+ }
338
+ }
339
+ if (firstRun.current) firstRun.current = false;
340
+ }
341
+ return selected;
342
+ }
343
+ }[selector.name],
344
+ [selector]
345
+ );
346
+ const selectedState = (0, import_with_selector.useSyncExternalStoreWithSelector)(
347
+ subscription.addNestedSub,
348
+ store.getState,
349
+ getServerState || store.getState,
350
+ wrappedSelector,
351
+ equalityFn
352
+ );
353
+ React.useDebugValue(selectedState);
354
+ return selectedState;
355
+ };
356
+ Object.assign(useSelector2, {
357
+ withTypes: () => useSelector2
358
+ });
359
+ return useSelector2;
360
+ }
361
+ var useSelector = /* @__PURE__ */ createSelectorHook();
362
+
363
+ // src/bridges/redux/useRedux.ts
364
+ function useRedux() {
365
+ const dispatch = useDispatch();
366
+ const selector = useSelector;
367
+ return {
368
+ dispatch,
369
+ useSelector: selector,
370
+ // Expose typed selector
371
+ select: selector
372
+ // Alias
373
+ };
374
+ }
375
+ export {
376
+ useRedux
377
+ };
378
+ /*! Bundled license information:
379
+
380
+ use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js:
381
+ (**
382
+ * @license React
383
+ * use-sync-external-store-with-selector.production.js
384
+ *
385
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
386
+ *
387
+ * This source code is licensed under the MIT license found in the
388
+ * LICENSE file in the root directory of this source tree.
389
+ *)
390
+
391
+ use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js:
392
+ (**
393
+ * @license React
394
+ * use-sync-external-store-with-selector.development.js
395
+ *
396
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
397
+ *
398
+ * This source code is licensed under the MIT license found in the
399
+ * LICENSE file in the root directory of this source tree.
400
+ *)
401
+ */
402
+ //# sourceMappingURL=redux.mjs.map