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,410 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
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"(exports2) {
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
+ exports2.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"(exports2) {
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
+ exports2.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"(exports2, module2) {
171
+ "use strict";
172
+ if (process.env.NODE_ENV === "production") {
173
+ module2.exports = require_use_sync_external_store_with_selector_production();
174
+ } else {
175
+ module2.exports = require_use_sync_external_store_with_selector_development();
176
+ }
177
+ }
178
+ });
179
+
180
+ // src/bridges/redux/index.ts
181
+ var redux_exports = {};
182
+ __export(redux_exports, {
183
+ useRedux: () => useRedux
184
+ });
185
+ module.exports = __toCommonJS(redux_exports);
186
+
187
+ // node_modules/react-redux/dist/react-redux.mjs
188
+ var React = __toESM(require("react"), 1);
189
+ var import_with_selector = __toESM(require_with_selector(), 1);
190
+ var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
191
+ var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
192
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
193
+ var Memo = REACT_MEMO_TYPE;
194
+ var FORWARD_REF_STATICS = {
195
+ $$typeof: true,
196
+ render: true,
197
+ defaultProps: true,
198
+ displayName: true,
199
+ propTypes: true
200
+ };
201
+ var MEMO_STATICS = {
202
+ $$typeof: true,
203
+ compare: true,
204
+ defaultProps: true,
205
+ displayName: true,
206
+ propTypes: true,
207
+ type: true
208
+ };
209
+ var TYPE_STATICS = {
210
+ [ForwardRef]: FORWARD_REF_STATICS,
211
+ [Memo]: MEMO_STATICS
212
+ };
213
+ var objectPrototype = Object.prototype;
214
+ var ContextKey = /* @__PURE__ */ Symbol.for(`react-redux-context`);
215
+ var gT = typeof globalThis !== "undefined" ? globalThis : (
216
+ /* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
217
+ {}
218
+ );
219
+ function getContext() {
220
+ if (!React.createContext) return {};
221
+ const contextMap = gT[ContextKey] ?? (gT[ContextKey] = /* @__PURE__ */ new Map());
222
+ let realContext = contextMap.get(React.createContext);
223
+ if (!realContext) {
224
+ realContext = React.createContext(
225
+ null
226
+ );
227
+ if (process.env.NODE_ENV !== "production") {
228
+ realContext.displayName = "ReactRedux";
229
+ }
230
+ contextMap.set(React.createContext, realContext);
231
+ }
232
+ return realContext;
233
+ }
234
+ var ReactReduxContext = /* @__PURE__ */ getContext();
235
+ function createReduxContextHook(context = ReactReduxContext) {
236
+ return function useReduxContext2() {
237
+ const contextValue = React.useContext(context);
238
+ if (process.env.NODE_ENV !== "production" && !contextValue) {
239
+ throw new Error(
240
+ "could not find react-redux context value; please ensure the component is wrapped in a <Provider>"
241
+ );
242
+ }
243
+ return contextValue;
244
+ };
245
+ }
246
+ var useReduxContext = /* @__PURE__ */ createReduxContextHook();
247
+ function createStoreHook(context = ReactReduxContext) {
248
+ const useReduxContext2 = context === ReactReduxContext ? useReduxContext : (
249
+ // @ts-ignore
250
+ createReduxContextHook(context)
251
+ );
252
+ const useStore2 = () => {
253
+ const { store } = useReduxContext2();
254
+ return store;
255
+ };
256
+ Object.assign(useStore2, {
257
+ withTypes: () => useStore2
258
+ });
259
+ return useStore2;
260
+ }
261
+ var useStore = /* @__PURE__ */ createStoreHook();
262
+ function createDispatchHook(context = ReactReduxContext) {
263
+ const useStore2 = context === ReactReduxContext ? useStore : createStoreHook(context);
264
+ const useDispatch2 = () => {
265
+ const store = useStore2();
266
+ return store.dispatch;
267
+ };
268
+ Object.assign(useDispatch2, {
269
+ withTypes: () => useDispatch2
270
+ });
271
+ return useDispatch2;
272
+ }
273
+ var useDispatch = /* @__PURE__ */ createDispatchHook();
274
+ var refEquality = (a, b) => a === b;
275
+ function createSelectorHook(context = ReactReduxContext) {
276
+ const useReduxContext2 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
277
+ const useSelector2 = (selector, equalityFnOrOptions = {}) => {
278
+ const { equalityFn = refEquality } = typeof equalityFnOrOptions === "function" ? { equalityFn: equalityFnOrOptions } : equalityFnOrOptions;
279
+ if (process.env.NODE_ENV !== "production") {
280
+ if (!selector) {
281
+ throw new Error(`You must pass a selector to useSelector`);
282
+ }
283
+ if (typeof selector !== "function") {
284
+ throw new Error(`You must pass a function as a selector to useSelector`);
285
+ }
286
+ if (typeof equalityFn !== "function") {
287
+ throw new Error(
288
+ `You must pass a function as an equality function to useSelector`
289
+ );
290
+ }
291
+ }
292
+ const reduxContext = useReduxContext2();
293
+ const { store, subscription, getServerState } = reduxContext;
294
+ const firstRun = React.useRef(true);
295
+ const wrappedSelector = React.useCallback(
296
+ {
297
+ [selector.name](state) {
298
+ const selected = selector(state);
299
+ if (process.env.NODE_ENV !== "production") {
300
+ const { devModeChecks = {} } = typeof equalityFnOrOptions === "function" ? {} : equalityFnOrOptions;
301
+ const { identityFunctionCheck, stabilityCheck } = reduxContext;
302
+ const {
303
+ identityFunctionCheck: finalIdentityFunctionCheck,
304
+ stabilityCheck: finalStabilityCheck
305
+ } = {
306
+ stabilityCheck,
307
+ identityFunctionCheck,
308
+ ...devModeChecks
309
+ };
310
+ if (finalStabilityCheck === "always" || finalStabilityCheck === "once" && firstRun.current) {
311
+ const toCompare = selector(state);
312
+ if (!equalityFn(selected, toCompare)) {
313
+ let stack = void 0;
314
+ try {
315
+ throw new Error();
316
+ } catch (e) {
317
+ ;
318
+ ({ stack } = e);
319
+ }
320
+ console.warn(
321
+ "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",
322
+ {
323
+ state,
324
+ selected,
325
+ selected2: toCompare,
326
+ stack
327
+ }
328
+ );
329
+ }
330
+ }
331
+ if (finalIdentityFunctionCheck === "always" || finalIdentityFunctionCheck === "once" && firstRun.current) {
332
+ if (selected === state) {
333
+ let stack = void 0;
334
+ try {
335
+ throw new Error();
336
+ } catch (e) {
337
+ ;
338
+ ({ stack } = e);
339
+ }
340
+ console.warn(
341
+ "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.",
342
+ { stack }
343
+ );
344
+ }
345
+ }
346
+ if (firstRun.current) firstRun.current = false;
347
+ }
348
+ return selected;
349
+ }
350
+ }[selector.name],
351
+ [selector]
352
+ );
353
+ const selectedState = (0, import_with_selector.useSyncExternalStoreWithSelector)(
354
+ subscription.addNestedSub,
355
+ store.getState,
356
+ getServerState || store.getState,
357
+ wrappedSelector,
358
+ equalityFn
359
+ );
360
+ React.useDebugValue(selectedState);
361
+ return selectedState;
362
+ };
363
+ Object.assign(useSelector2, {
364
+ withTypes: () => useSelector2
365
+ });
366
+ return useSelector2;
367
+ }
368
+ var useSelector = /* @__PURE__ */ createSelectorHook();
369
+
370
+ // src/bridges/redux/useRedux.ts
371
+ function useRedux() {
372
+ const dispatch = useDispatch();
373
+ const selector = useSelector;
374
+ return {
375
+ dispatch,
376
+ useSelector: selector,
377
+ // Expose typed selector
378
+ select: selector
379
+ // Alias
380
+ };
381
+ }
382
+ // Annotate the CommonJS export names for ESM import in node:
383
+ 0 && (module.exports = {
384
+ useRedux
385
+ });
386
+ /*! Bundled license information:
387
+
388
+ use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js:
389
+ (**
390
+ * @license React
391
+ * use-sync-external-store-with-selector.production.js
392
+ *
393
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
394
+ *
395
+ * This source code is licensed under the MIT license found in the
396
+ * LICENSE file in the root directory of this source tree.
397
+ *)
398
+
399
+ use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js:
400
+ (**
401
+ * @license React
402
+ * use-sync-external-store-with-selector.development.js
403
+ *
404
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
405
+ *
406
+ * This source code is licensed under the MIT license found in the
407
+ * LICENSE file in the root directory of this source tree.
408
+ *)
409
+ */
410
+ //# sourceMappingURL=redux.js.map