@tamagui/use-event 1.26.0 → 1.26.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/use-event",
3
- "version": "1.26.0",
3
+ "version": "1.26.1",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -18,7 +18,7 @@
18
18
  "clean:build": "tamagui-build clean:build"
19
19
  },
20
20
  "devDependencies": {
21
- "@tamagui/build": "1.26.0",
21
+ "@tamagui/build": "1.26.1",
22
22
  "react": "^18.2.0"
23
23
  },
24
24
  "peerDependencies": {
@@ -1,3 +0,0 @@
1
- export * from "./useEvent";
2
- export * from "./useGet";
3
- //# sourceMappingURL=index.mjs.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "mappings": "AAAA,cAAc;AACd,cAAc;",
5
- "names": []
6
- }
@@ -1,11 +0,0 @@
1
- import { useGet } from "./useGet";
2
- function useEvent(callback) {
3
- return useGet(callback, defaultValue, true);
4
- }
5
- const defaultValue = () => {
6
- throw new Error("Cannot call an event handler while rendering.");
7
- };
8
- export {
9
- useEvent
10
- };
11
- //# sourceMappingURL=useEvent.mjs.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/useEvent.ts"],
4
- "mappings": "AAAA,SAAS,cAAc;AAIhB,SAAS,SAAgC,UAAiB;AAC/D,SAAO,OAAO,UAAU,cAAc,IAAI;AAC5C;AAEA,MAAM,eAAe,MAAM;AACzB,QAAM,IAAI,MAAM,+CAA+C;AACjE;",
5
- "names": []
6
- }
@@ -1,21 +0,0 @@
1
- import { useCallback, useEffect, useLayoutEffect, useRef } from "react";
2
- const isWeb = process.env.TAMAGUI_TARGET === "web";
3
- const isClient = typeof window !== "undefined";
4
- const useIsomorphicLayoutEffect = !isWeb || isClient ? useLayoutEffect : useEffect;
5
- function useGet(currentValue, initialValue, forwardToFunction) {
6
- const curRef = useRef(initialValue ?? currentValue);
7
- useIsomorphicLayoutEffect(() => {
8
- curRef.current = currentValue;
9
- });
10
- return useCallback(
11
- forwardToFunction ? (...args) => {
12
- var _a;
13
- return (_a = curRef.current) == null ? void 0 : _a.apply(null, args);
14
- } : () => curRef.current,
15
- []
16
- );
17
- }
18
- export {
19
- useGet
20
- };
21
- //# sourceMappingURL=useGet.mjs.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/useGet.ts"],
4
- "mappings": "AAAA,SAAS,aAAa,WAAW,iBAAiB,cAAc;AAEhE,MAAM,QAAQ,QAAQ,IAAI,mBAAmB;AAC7C,MAAM,WAAW,OAAO,WAAW;AACnC,MAAM,4BAA4B,CAAC,SAAS,WAAW,kBAAkB;AAIlE,SAAS,OACd,cACA,cACA,mBACS;AACT,QAAM,SAAS,OAAY,gBAAgB,YAAY;AACvD,4BAA0B,MAAM;AAC9B,WAAO,UAAU;AAAA,EACnB,CAAC;AAED,SAAO;AAAA,IACL,oBACI,IAAI,SAAM;AApBlB;AAoBqB,0BAAO,YAAP,mBAAgB,MAAM,MAAM;AAAA,QACzC,MAAM,OAAO;AAAA,IACjB,CAAC;AAAA,EACH;AACF;",
5
- "names": []
6
- }