@tamagui/use-event 1.124.17 → 1.124.18

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.124.17",
3
+ "version": "1.124.18",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -18,11 +18,11 @@
18
18
  "clean:build": "tamagui-build clean:build"
19
19
  },
20
20
  "devDependencies": {
21
- "@tamagui/build": "1.124.17",
21
+ "@tamagui/build": "1.124.18",
22
22
  "react": "*"
23
23
  },
24
24
  "dependencies": {
25
- "@tamagui/constants": "1.124.17"
25
+ "@tamagui/constants": "1.124.18"
26
26
  },
27
27
  "exports": {
28
28
  "./package.json": "./package.json",
package/types/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- export * from './useEvent';
2
- export * from './useGet';
1
+ export * from "./useEvent";
2
+ export * from "./useGet";
3
+
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1,11 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
1
+ {
2
+ "mappings": "AAAA,cAAc;AACd,cAAc",
3
+ "names": [],
4
+ "sources": [
5
+ "src/index.ts"
6
+ ],
7
+ "sourcesContent": [
8
+ "export * from './useEvent'\nexport * from './useGet'\n"
9
+ ],
10
+ "version": 3
11
+ }
@@ -1,4 +1,5 @@
1
1
  type AnyFunction = (...args: any[]) => any;
2
2
  export declare function useEvent<T extends AnyFunction>(callback?: T): T;
3
3
  export {};
4
+
4
5
  //# sourceMappingURL=useEvent.d.ts.map
@@ -1 +1,13 @@
1
- {"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../src/useEvent.ts"],"names":[],"mappings":"AAEA,KAAK,WAAW,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;AAE1C,wBAAgB,QAAQ,CAAC,CAAC,SAAS,WAAW,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAE/D"}
1
+ {
2
+ "mappings": "KAEK,eAAe,GAAG;AAEvB,OAAO,iBAAS,SAAS,UAAU,aAAaA,WAAW,IAAI",
3
+ "names": [
4
+ "callback?: T"
5
+ ],
6
+ "sources": [
7
+ "src/useEvent.ts"
8
+ ],
9
+ "sourcesContent": [
10
+ "import { useGet } from './useGet'\n\ntype AnyFunction = (...args: any[]) => any\n\nexport function useEvent<T extends AnyFunction>(callback?: T): T {\n return useGet(callback, defaultValue, true) as T\n}\n\nconst defaultValue = () => {\n throw new Error('Cannot call an event handler while rendering.')\n}\n"
11
+ ],
12
+ "version": 3
13
+ }
package/types/useGet.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export declare function useGet<A>(currentValue: A, initialValue?: any, forwardToFunction?: boolean): () => A;
2
+
2
3
  //# sourceMappingURL=useGet.d.ts.map
@@ -1 +1,15 @@
1
- {"version":3,"file":"useGet.d.ts","sourceRoot":"","sources":["../src/useGet.ts"],"names":[],"mappings":"AAKA,wBAAgB,MAAM,CAAC,CAAC,EACtB,YAAY,EAAE,CAAC,EACf,YAAY,CAAC,EAAE,GAAG,EAClB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,MAAM,CAAC,CAYT"}
1
+ {
2
+ "mappings": "AAKA,OAAO,iBAAS,OAAO,GACrBA,cAAc,GACdC,oBACAC,oCACO",
3
+ "names": [
4
+ "currentValue: A",
5
+ "initialValue?: any",
6
+ "forwardToFunction?: boolean"
7
+ ],
8
+ "sources": [
9
+ "src/useGet.ts"
10
+ ],
11
+ "sourcesContent": [
12
+ "import { useIsomorphicLayoutEffect } from '@tamagui/constants'\nimport * as React from 'react'\n\n// keeps a reference to the current value easily\n\nexport function useGet<A>(\n currentValue: A,\n initialValue?: any,\n forwardToFunction?: boolean\n): () => A {\n const curRef = React.useRef<any>(initialValue ?? currentValue)\n useIsomorphicLayoutEffect(() => {\n curRef.current = currentValue\n })\n\n return React.useCallback(\n forwardToFunction\n ? (...args) => curRef.current?.apply(null, args)\n : () => curRef.current,\n []\n )\n}\n"
13
+ ],
14
+ "version": 3
15
+ }