@tamagui/use-event 2.0.0-rc.3 → 2.0.0-rc.31

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.
@@ -34,11 +34,12 @@ __export(useGet_exports, {
34
34
  useGet: () => useGet
35
35
  });
36
36
  module.exports = __toCommonJS(useGet_exports);
37
- var import_constants = require("@tamagui/constants"),
38
- React = __toESM(require("react"), 1);
37
+ var React = __toESM(require("react"), 1);
38
+ const isServer = typeof window > "u",
39
+ useIsomorphicInsertionEffect = isServer ? React.useEffect : React.useInsertionEffect || React.useLayoutEffect;
39
40
  function useGet(currentValue, initialValue, forwardToFunction) {
40
41
  const curRef = React.useRef(initialValue ?? currentValue);
41
- return (0, import_constants.useIsomorphicLayoutEffect)(() => {
42
+ return useIsomorphicInsertionEffect(() => {
42
43
  curRef.current = currentValue;
43
44
  }), React.useCallback(forwardToFunction ? (...args) => curRef.current?.apply(null, args) : () => curRef.current, []);
44
45
  }
@@ -36,11 +36,12 @@ __export(useGet_exports, {
36
36
  useGet: () => useGet
37
37
  });
38
38
  module.exports = __toCommonJS(useGet_exports);
39
- var import_constants = require("@tamagui/constants"),
40
- React = __toESM(require("react"), 1);
39
+ var React = __toESM(require("react"), 1),
40
+ isServer = typeof window > "u",
41
+ useIsomorphicInsertionEffect = isServer ? React.useEffect : React.useInsertionEffect || React.useLayoutEffect;
41
42
  function useGet(currentValue, initialValue, forwardToFunction) {
42
43
  var curRef = React.useRef(initialValue ?? currentValue);
43
- return (0, import_constants.useIsomorphicLayoutEffect)(function () {
44
+ return useIsomorphicInsertionEffect(function () {
44
45
  curRef.current = currentValue;
45
46
  }), React.useCallback(forwardToFunction ? function () {
46
47
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useGet_exports","__export","useGet","module","exports","import_constants","require","React","__toESM","currentValue","initialValue","forwardToFunction","curRef","useRef","useIsomorphicLayoutEffect","current","useCallback","_len","arguments","length","args","Array","_key","_curRef_current"],"sources":["../../src/useGet.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,cAAA;AAAAC,QAAA,CAAAD,cAAA;EAAAE,MAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAA0C,CAAAK,cAAA;AAKnC,IAAAK,gBACL,GAAAC,OACA,qBACA;EAAAC,KAAA,GAAAC,OACS,CAAAF,OAAA;AACT,SAAMJ,OAAAO,YAAe,EAAYC,YAAA,EAAAC,iBAA4B;EAC7D,IAAAC,MAAA,GAAAL,KAAA,CAAAM,MAAA,CAAAH,YAAA,IAAAD,YAAA,CAA0B;EACxB,SAAO,EAAAJ,gBAAU,CAAAS,yBAAA;IAClBF,MAEM,CAAAG,OAAM,GAAAN,YAAA;EAAA,EACX,EAAAF,KAAA,CAAAS,WAAA,CACIL,iBAAa,GAAO,YAAS;IAEjC,KAAC,IAAAM,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA,IACHF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IACF,IAAAC,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useGet_exports","__export","useGet","module","exports","React","__toESM","require","isServer","window","useIsomorphicInsertionEffect","useEffect","useInsertionEffect","useLayoutEffect","currentValue","initialValue","forwardToFunction","curRef","useRef","current","useCallback","_len","arguments","length","args","Array","_key","_curRef_current","apply"],"sources":["../../src/useGet.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,cAAA;AAAAC,QAAA,CAAAD,cAAA;EAAAE,MAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAuB,GAAAT,YAAA,CAAAK,cAAA;AAEvB,IAAAK,KAAM,GAAAC,OAAW,CAAAC,OAAO,QAAW,GAM7B;EAAAC,QAAA,UAAAC,MAAA,GAA+B;EAAAC,4BAEjC,GAAMF,QAAA,GAAAH,KAAA,CAAAM,SAAsB,GAAMN,KAAA,CAAAO,kBAAA,IAAAP,KAAA,CAAAQ,eAAA;AAI/B,SAASX,OACdY,YAAA,EACAC,YAAA,EACAC,iBAAA,EACS;EACT,IAAAC,MAAM,GAAAZ,KAAS,CAAAa,MAAM,CAAAH,YAAY,IAAAD,YAAgB;EACjD,OAAAJ,4BAAA,CAA6B,YAAM;IACjCO,MAAA,CAAOE,OAAA,GAAUL,YAAA;EACnB,CAAC,GAEMT,KAAA,CAAMe,WAAA,CAAAJ,iBAAA;IACX,SAAAK,IAAA,GAAAC,SACQ,CAAAC,MAAA,EAASC,IAAA,GAAO,IAAAC,KAAS,CAAAJ,IAAM,GAAAK,IAAM,GAAI,GAAAA,IAC7C,GAAML,IAAA,EAAAK,IAAO,IAChBF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IACH,IAAAC,eAAA;IACF,QAAAA,eAAA,GAAAV,MAAA,CAAAE,OAAA,cAAAQ,eAAA,uBAAAA,eAAA,CAAAC,KAAA,OAAAJ,IAAA","ignoreList":[]}
package/dist/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./useEvent";
2
- export * from "./useGet";
1
+ export * from "./useEvent.mjs";
2
+ export * from "./useGet.mjs";
3
3
  //# sourceMappingURL=index.js.map
@@ -1,6 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "mappings": "AAAA,cAAc;AACd,cAAc;",
5
- "names": []
6
- }
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc","ignoreList":[]}
@@ -1,8 +1,9 @@
1
- import { useIsomorphicLayoutEffect } from "@tamagui/constants";
2
1
  import * as React from "react";
2
+ const isServer = typeof window > "u",
3
+ useIsomorphicInsertionEffect = isServer ? React.useEffect : React.useInsertionEffect || React.useLayoutEffect;
3
4
  function useGet(currentValue, initialValue, forwardToFunction) {
4
5
  const curRef = React.useRef(initialValue ?? currentValue);
5
- return useIsomorphicLayoutEffect(() => {
6
+ return useIsomorphicInsertionEffect(() => {
6
7
  curRef.current = currentValue;
7
8
  }), React.useCallback(forwardToFunction ? (...args) => curRef.current?.apply(null, args) : () => curRef.current, []);
8
9
  }
@@ -1 +1 @@
1
- {"version":3,"names":["useIsomorphicLayoutEffect","React","useGet","currentValue","initialValue","forwardToFunction","curRef","useRef","current","useCallback","args","apply"],"sources":["../../src/useGet.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,yBAAA,QAAiC;AAC1C,YAAYC,KAAA,MAAW;AAIhB,SAASC,OACdC,YAAA,EACAC,YAAA,EACAC,iBAAA,EACS;EACT,MAAMC,MAAA,GAASL,KAAA,CAAMM,MAAA,CAAYH,YAAA,IAAgBD,YAAY;EAC7D,OAAAH,yBAAA,CAA0B,MAAM;IAC9BM,MAAA,CAAOE,OAAA,GAAUL,YAAA;EACnB,CAAC,GAEMF,KAAA,CAAMQ,WAAA,CACXJ,iBAAA,GACI,IAAIK,IAAA,KAASJ,MAAA,CAAOE,OAAA,EAASG,KAAA,CAAM,MAAMD,IAAI,IAC7C,MAAMJ,MAAA,CAAOE,OAAA,EACjB,EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["React","isServer","window","useIsomorphicInsertionEffect","useEffect","useInsertionEffect","useLayoutEffect","useGet","currentValue","initialValue","forwardToFunction","curRef","useRef","current","useCallback","args","apply"],"sources":["../../src/useGet.ts"],"sourcesContent":[null],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAEvB,MAAMC,QAAA,GAAW,OAAOC,MAAA,GAAW;EAM7BC,4BAAA,GAA+BF,QAAA,GACjCD,KAAA,CAAMI,SAAA,GACNJ,KAAA,CAAMK,kBAAA,IAAsBL,KAAA,CAAMM,eAAA;AAI/B,SAASC,OACdC,YAAA,EACAC,YAAA,EACAC,iBAAA,EACS;EACT,MAAMC,MAAA,GAASX,KAAA,CAAMY,MAAA,CAAYH,YAAA,IAAgBD,YAAY;EAC7D,OAAAL,4BAAA,CAA6B,MAAM;IACjCQ,MAAA,CAAOE,OAAA,GAAUL,YAAA;EACnB,CAAC,GAEMR,KAAA,CAAMc,WAAA,CACXJ,iBAAA,GACI,IAAIK,IAAA,KAASJ,MAAA,CAAOE,OAAA,EAASG,KAAA,CAAM,MAAMD,IAAI,IAC7C,MAAMJ,MAAA,CAAOE,OAAA,EACjB,EACF;AACF","ignoreList":[]}
@@ -1,8 +1,9 @@
1
- import { useIsomorphicLayoutEffect } from "@tamagui/constants";
2
1
  import * as React from "react";
2
+ var isServer = typeof window > "u",
3
+ useIsomorphicInsertionEffect = isServer ? React.useEffect : React.useInsertionEffect || React.useLayoutEffect;
3
4
  function useGet(currentValue, initialValue, forwardToFunction) {
4
5
  var curRef = React.useRef(initialValue ?? currentValue);
5
- return useIsomorphicLayoutEffect(function () {
6
+ return useIsomorphicInsertionEffect(function () {
6
7
  curRef.current = currentValue;
7
8
  }), React.useCallback(forwardToFunction ? function () {
8
9
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
@@ -1 +1 @@
1
- {"version":3,"names":["useIsomorphicLayoutEffect","React","useGet","currentValue","initialValue","forwardToFunction","curRef","useRef","current","useCallback","_len","arguments","length","args","Array","_key","_curRef_current","apply"],"sources":["../../src/useGet.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,yBAAA,QAAiC;AAC1C,YAAYC,KAAA,MAAW;AAIhB,SAASC,OACdC,YAAA,EACAC,YAAA,EACAC,iBAAA,EACS;EACT,IAAAC,MAAM,GAAAL,KAAS,CAAAM,MAAM,CAAAH,YAAY,IAAAD,YAAgB;EACjD,OAAAH,yBAAA,CAA0B,YAAM;IAC9BM,MAAA,CAAOE,OAAA,GAAUL,YAAA;EACnB,CAAC,GAEMF,KAAA,CAAMQ,WAAA,CAAAJ,iBAAA;IACX,SAAAK,IAAA,GAAAC,SACQ,CAAAC,MAAA,EAASC,IAAA,GAAO,IAAAC,KAAS,CAAAJ,IAAM,GAAAK,IAAM,GAAI,GAAAA,IAC7C,GAAML,IAAA,EAAAK,IAAO,IAChBF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IACH,IAAAC,eAAA;IACF,QAAAA,eAAA,GAAAV,MAAA,CAAAE,OAAA,cAAAQ,eAAA,uBAAAA,eAAA,CAAAC,KAAA,OAAAJ,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["React","isServer","window","useIsomorphicInsertionEffect","useEffect","useInsertionEffect","useLayoutEffect","useGet","currentValue","initialValue","forwardToFunction","curRef","useRef","current","useCallback","_len","arguments","length","args","Array","_key","_curRef_current","apply"],"sources":["../../src/useGet.ts"],"sourcesContent":[null],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAEvB,IAAAC,QAAM,UAAWC,MAAO,MAAW;EAAAC,4BAM7B,GAAAF,QAA+B,GAAAD,KACjC,CAAAI,SAAM,GAAAJ,KACN,CAAAK,kBAAM,IAAAL,KAAsB,CAAAM,eAAM;AAI/B,SAASC,OACdC,YAAA,EACAC,YAAA,EACAC,iBAAA,EACS;EACT,IAAAC,MAAM,GAAAX,KAAS,CAAAY,MAAM,CAAAH,YAAY,IAAAD,YAAgB;EACjD,OAAAL,4BAAA,CAA6B,YAAM;IACjCQ,MAAA,CAAOE,OAAA,GAAUL,YAAA;EACnB,CAAC,GAEMR,KAAA,CAAMc,WAAA,CAAAJ,iBAAA;IACX,SAAAK,IAAA,GAAAC,SACQ,CAAAC,MAAA,EAASC,IAAA,GAAO,IAAAC,KAAS,CAAAJ,IAAM,GAAAK,IAAM,GAAI,GAAAA,IAC7C,GAAML,IAAA,EAAAK,IAAO,IAChBF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IACH,IAAAC,eAAA;IACF,QAAAA,eAAA,GAAAV,MAAA,CAAAE,OAAA,cAAAQ,eAAA,uBAAAA,eAAA,CAAAC,KAAA,OAAAJ,IAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/use-event",
3
- "version": "2.0.0-rc.3",
3
+ "version": "2.0.0-rc.31",
4
4
  "files": [
5
5
  "src",
6
6
  "types",
@@ -15,15 +15,12 @@
15
15
  "./package.json": "./package.json",
16
16
  ".": {
17
17
  "types": "./types/index.d.ts",
18
- "react-native": {
19
- "module": "./dist/esm/index.native.js",
20
- "import": "./dist/esm/index.native.js",
21
- "require": "./dist/cjs/index.native.js"
22
- },
18
+ "react-native": "./dist/esm/index.native.js",
19
+ "browser": "./dist/esm/index.mjs",
23
20
  "module": "./dist/esm/index.mjs",
24
21
  "import": "./dist/esm/index.mjs",
25
22
  "require": "./dist/cjs/index.cjs",
26
- "default": "./dist/cjs/index.native.js"
23
+ "default": "./dist/esm/index.mjs"
27
24
  }
28
25
  },
29
26
  "publishConfig": {
@@ -35,11 +32,9 @@
35
32
  "clean": "tamagui-build clean",
36
33
  "clean:build": "tamagui-build clean:build"
37
34
  },
38
- "dependencies": {
39
- "@tamagui/constants": "2.0.0-rc.3"
40
- },
35
+ "dependencies": {},
41
36
  "devDependencies": {
42
- "@tamagui/build": "2.0.0-rc.3",
37
+ "@tamagui/build": "2.0.0-rc.31",
43
38
  "react": ">=19"
44
39
  },
45
40
  "peerDependencies": {
package/src/useGet.ts CHANGED
@@ -1,6 +1,15 @@
1
- import { useIsomorphicLayoutEffect } from '@tamagui/constants'
2
1
  import * as React from 'react'
3
2
 
3
+ const isServer = typeof window === 'undefined'
4
+
5
+ // Use useInsertionEffect on the client to ensure the ref is updated before any
6
+ // useLayoutEffect reads the returned callback. This fixes a React 19 timing
7
+ // issue where a consumer's useLayoutEffect could fire before this ref update,
8
+ // causing stale values. Falls back to useLayoutEffect for React < 18.3.
9
+ const useIsomorphicInsertionEffect = isServer
10
+ ? React.useEffect
11
+ : React.useInsertionEffect || React.useLayoutEffect
12
+
4
13
  // keeps a reference to the current value easily
5
14
 
6
15
  export function useGet<A>(
@@ -9,7 +18,7 @@ export function useGet<A>(
9
18
  forwardToFunction?: boolean
10
19
  ): () => A {
11
20
  const curRef = React.useRef<any>(initialValue ?? currentValue)
12
- useIsomorphicLayoutEffect(() => {
21
+ useIsomorphicInsertionEffect(() => {
13
22
  curRef.current = currentValue
14
23
  })
15
24
 
@@ -4,8 +4,8 @@
4
4
  "sources": [
5
5
  "src/index.ts"
6
6
  ],
7
+ "version": 3,
7
8
  "sourcesContent": [
8
9
  "export * from './useEvent'\nexport * from './useGet'\n"
9
- ],
10
- "version": 3
10
+ ]
11
11
  }
@@ -4,8 +4,8 @@
4
4
  "sources": [
5
5
  "src/useEvent.ts"
6
6
  ],
7
+ "version": 3,
7
8
  "sourcesContent": [
8
9
  "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"
9
- ],
10
- "version": 3
10
+ ]
11
11
  }
@@ -1,11 +1,11 @@
1
1
  {
2
- "mappings": "AAKA,OAAO,iBAAS,OAAO,GACrB,cAAc,GACd,oBACA,oCACO",
2
+ "mappings": "AAcA,OAAO,iBAAS,OAAO,GACrB,cAAc,GACd,oBACA,oCACO",
3
3
  "names": [],
4
4
  "sources": [
5
5
  "src/useGet.ts"
6
6
  ],
7
+ "version": 3,
7
8
  "sourcesContent": [
8
- "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"
9
- ],
10
- "version": 3
9
+ "import * as React from 'react'\n\nconst isServer = typeof window === 'undefined'\n\n// Use useInsertionEffect on the client to ensure the ref is updated before any\n// useLayoutEffect reads the returned callback. This fixes a React 19 timing\n// issue where a consumer's useLayoutEffect could fire before this ref update,\n// causing stale values. Falls back to useLayoutEffect for React < 18.3.\nconst useIsomorphicInsertionEffect = isServer\n ? React.useEffect\n : React.useInsertionEffect || React.useLayoutEffect\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 useIsomorphicInsertionEffect(() => {\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"
10
+ ]
11
11
  }
package/dist/cjs/index.js DELETED
@@ -1,16 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function")
7
- for (let key of __getOwnPropNames(from))
8
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
- return to;
10
- }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
- var index_exports = {};
13
- module.exports = __toCommonJS(index_exports);
14
- __reExport(index_exports, require("./useEvent"), module.exports);
15
- __reExport(index_exports, require("./useGet"), module.exports);
16
- //# sourceMappingURL=index.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,uBAAd;AACA,0BAAc,qBADd;",
5
- "names": []
6
- }
@@ -1,27 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: !0 });
8
- }, __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from == "object" || typeof from == "function")
10
- for (let key of __getOwnPropNames(from))
11
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
- var useEvent_exports = {};
16
- __export(useEvent_exports, {
17
- useEvent: () => useEvent
18
- });
19
- module.exports = __toCommonJS(useEvent_exports);
20
- var import_useGet = require("./useGet");
21
- function useEvent(callback) {
22
- return (0, import_useGet.useGet)(callback, defaultValue, !0);
23
- }
24
- const defaultValue = () => {
25
- throw new Error("Cannot call an event handler while rendering.");
26
- };
27
- //# sourceMappingURL=useEvent.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/useEvent.ts"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AAIhB,SAAS,SAAgC,UAAiB;AAC/D,aAAO,sBAAO,UAAU,cAAc,EAAI;AAC5C;AAEA,MAAM,eAAe,MAAM;AACzB,QAAM,IAAI,MAAM,+CAA+C;AACjE;",
5
- "names": []
6
- }
@@ -1,38 +0,0 @@
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, __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
- var useGet_exports = {};
24
- __export(useGet_exports, {
25
- useGet: () => useGet
26
- });
27
- module.exports = __toCommonJS(useGet_exports);
28
- var import_constants = require("@tamagui/constants"), React = __toESM(require("react"), 1);
29
- function useGet(currentValue, initialValue, forwardToFunction) {
30
- const curRef = React.useRef(initialValue ?? currentValue);
31
- return (0, import_constants.useIsomorphicLayoutEffect)(() => {
32
- curRef.current = currentValue;
33
- }), React.useCallback(
34
- forwardToFunction ? (...args) => curRef.current?.apply(null, args) : () => curRef.current,
35
- []
36
- );
37
- }
38
- //# sourceMappingURL=useGet.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/useGet.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0C,+BAC1C,QAAuB;AAIhB,SAAS,OACd,cACA,cACA,mBACS;AACT,QAAM,SAAS,MAAM,OAAY,gBAAgB,YAAY;AAC7D,yDAA0B,MAAM;AAC9B,WAAO,UAAU;AAAA,EACnB,CAAC,GAEM,MAAM;AAAA,IACX,oBACI,IAAI,SAAS,OAAO,SAAS,MAAM,MAAM,IAAI,IAC7C,MAAM,OAAO;AAAA,IACjB,CAAC;AAAA,EACH;AACF;",
5
- "names": []
6
- }
@@ -1,11 +0,0 @@
1
- import { useGet } from "./useGet";
2
- function useEvent(callback) {
3
- return useGet(callback, defaultValue, !0);
4
- }
5
- const defaultValue = () => {
6
- throw new Error("Cannot call an event handler while rendering.");
7
- };
8
- export {
9
- useEvent
10
- };
11
- //# sourceMappingURL=useEvent.js.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,EAAI;AAC5C;AAEA,MAAM,eAAe,MAAM;AACzB,QAAM,IAAI,MAAM,+CAA+C;AACjE;",
5
- "names": []
6
- }
@@ -1,15 +0,0 @@
1
- import { useIsomorphicLayoutEffect } from "@tamagui/constants";
2
- import * as React from "react";
3
- function useGet(currentValue, initialValue, forwardToFunction) {
4
- const curRef = React.useRef(initialValue ?? currentValue);
5
- return useIsomorphicLayoutEffect(() => {
6
- curRef.current = currentValue;
7
- }), React.useCallback(
8
- forwardToFunction ? (...args) => curRef.current?.apply(null, args) : () => curRef.current,
9
- []
10
- );
11
- }
12
- export {
13
- useGet
14
- };
15
- //# sourceMappingURL=useGet.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/useGet.ts"],
4
- "mappings": "AAAA,SAAS,iCAAiC;AAC1C,YAAY,WAAW;AAIhB,SAAS,OACd,cACA,cACA,mBACS;AACT,QAAM,SAAS,MAAM,OAAY,gBAAgB,YAAY;AAC7D,mCAA0B,MAAM;AAC9B,WAAO,UAAU;AAAA,EACnB,CAAC,GAEM,MAAM;AAAA,IACX,oBACI,IAAI,SAAS,OAAO,SAAS,MAAM,MAAM,IAAI,IAC7C,MAAM,OAAO;AAAA,IACjB,CAAC;AAAA,EACH;AACF;",
5
- "names": []
6
- }