@tamagui/use-constant 1.129.4 → 1.129.5-1751174117974
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/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +1 -1
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -1
- package/types/index.d.ts.map +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -37,7 +37,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
37
37
|
var React = __toESM(require("react"));
|
|
38
38
|
function useConstant(fn) {
|
|
39
39
|
if (typeof document > "u") return React.useMemo(() => fn(), []);
|
|
40
|
-
const ref = React.useRef();
|
|
40
|
+
const ref = React.useRef(void 0);
|
|
41
41
|
return ref.current || (ref.current = {
|
|
42
42
|
v: fn()
|
|
43
43
|
}), ref.current.v;
|
package/dist/cjs/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var React = __toESM(require("react"));
|
|
|
29
29
|
function useConstant(fn) {
|
|
30
30
|
if (typeof document > "u")
|
|
31
31
|
return React.useMemo(() => fn(), []);
|
|
32
|
-
const ref = React.useRef();
|
|
32
|
+
const ref = React.useRef(void 0);
|
|
33
33
|
return ref.current || (ref.current = { v: fn() }), ref.current.v;
|
|
34
34
|
}
|
|
35
35
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AAIhB,SAAS,YAAe,IAAgB;AAE7C,MAAI,OAAO,WAAa;AACtB,WAAO,MAAM,QAAQ,MAAM,GAAG,GAAG,CAAC,CAAC;AAGrC,QAAM,MAAM,MAAM,OAAqB;
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AAIhB,SAAS,YAAe,IAAgB;AAE7C,MAAI,OAAO,WAAa;AACtB,WAAO,MAAM,QAAQ,MAAM,GAAG,GAAG,CAAC,CAAC;AAGrC,QAAM,MAAM,MAAM,OAAqB,MAAS;AAEhD,SAAK,IAAI,YACP,IAAI,UAAU,EAAE,GAAG,GAAG,EAAE,IAGnB,IAAI,QAAQ;AACrB;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;YAAuB;AAIhB,SAASA,YAAeC,IAAW;AAExC,MAAI,OAAOC,WAAa;AACtB,WAAOC,MAAMC,QAAQ,WAAA;aAAMH,GAAAA;OAAM,CAAA,CAAE;AAGrC,MAAMI,MAAMF,MAAMG,
|
|
5
|
-
"names": ["useConstant", "fn", "document", "React", "useMemo", "ref", "useRef", "current", "v"]
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;YAAuB;AAIhB,SAASA,YAAeC,IAAW;AAExC,MAAI,OAAOC,WAAa;AACtB,WAAOC,MAAMC,QAAQ,WAAA;aAAMH,GAAAA;OAAM,CAAA,CAAE;AAGrC,MAAMI,MAAMF,MAAMG,OAAqBC,MAAAA;AAEvC,SAAKF,IAAIG,YACPH,IAAIG,UAAU;IAAEC,GAAGR,GAAAA;EAAK,IAGnBI,IAAIG,QAAQC;AACrB;",
|
|
5
|
+
"names": ["useConstant", "fn", "document", "React", "useMemo", "ref", "useRef", "undefined", "current", "v"]
|
|
6
6
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
function useConstant(fn) {
|
|
3
3
|
if (typeof document > "u")
|
|
4
4
|
return React.useMemo(() => fn(), []);
|
|
5
|
-
const ref = React.useRef();
|
|
5
|
+
const ref = React.useRef(void 0);
|
|
6
6
|
return ref.current || (ref.current = { v: fn() }), ref.current.v;
|
|
7
7
|
}
|
|
8
8
|
export {
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "AAAA,YAAY,WAAW;AAIhB,SAAS,YAAe,IAAgB;AAE7C,MAAI,OAAO,WAAa;AACtB,WAAO,MAAM,QAAQ,MAAM,GAAG,GAAG,CAAC,CAAC;AAGrC,QAAM,MAAM,MAAM,OAAqB;
|
|
4
|
+
"mappings": "AAAA,YAAY,WAAW;AAIhB,SAAS,YAAe,IAAgB;AAE7C,MAAI,OAAO,WAAa;AACtB,WAAO,MAAM,QAAQ,MAAM,GAAG,GAAG,CAAC,CAAC;AAGrC,QAAM,MAAM,MAAM,OAAqB,MAAS;AAEhD,SAAK,IAAI,YACP,IAAI,UAAU,EAAE,GAAG,GAAG,EAAE,IAGnB,IAAI,QAAQ;AACrB;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/index.mjs
CHANGED
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useConstant","fn","document","useMemo","ref","useRef","current","v"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAIhB,SAASC,YAAeC,EAAA,EAAgB;EAE7C,IAAI,OAAOC,QAAA,GAAa,KACtB,OAAOH,KAAA,CAAMI,OAAA,CAAQ,MAAMF,EAAA,CAAG,GAAG,EAAE;EAGrC,MAAMG,GAAA,GAAML,KAAA,CAAMM,MAAA,CAAqB;
|
|
1
|
+
{"version":3,"names":["React","useConstant","fn","document","useMemo","ref","useRef","current","v"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,YAAYA,KAAA,MAAW;AAIhB,SAASC,YAAeC,EAAA,EAAgB;EAE7C,IAAI,OAAOC,QAAA,GAAa,KACtB,OAAOH,KAAA,CAAMI,OAAA,CAAQ,MAAMF,EAAA,CAAG,GAAG,EAAE;EAGrC,MAAMG,GAAA,GAAML,KAAA,CAAMM,MAAA,CAAqB,MAAS;EAEhD,OAAKD,GAAA,CAAIE,OAAA,KACPF,GAAA,CAAIE,OAAA,GAAU;IAAEC,CAAA,EAAGN,EAAA,CAAG;EAAE,IAGnBG,GAAA,CAAIE,OAAA,CAAQC,CAAA;AACrB","ignoreList":[]}
|
package/dist/esm/index.native.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-constant",
|
|
3
|
-
"version": "1.129.
|
|
3
|
+
"version": "1.129.5-1751174117974",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@tamagui/build": "1.129.
|
|
34
|
+
"@tamagui/build": "1.129.5-1751174117974",
|
|
35
35
|
"react": "*"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
package/src/index.ts
CHANGED
package/types/index.d.ts.map
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"src/index.ts"
|
|
8
8
|
],
|
|
9
9
|
"sourcesContent": [
|
|
10
|
-
"import * as React from 'react'\n\ntype ResultBox<T> = { v: T }\n\nexport function useConstant<T>(fn: () => T): T {\n // RSC compat\n if (typeof document === 'undefined') {\n return React.useMemo(() => fn(), [])\n }\n\n const ref = React.useRef<ResultBox<T>>()\n\n if (!ref.current) {\n ref.current = { v: fn() }\n }\n\n return ref.current.v\n}\n"
|
|
10
|
+
"import * as React from 'react'\n\ntype ResultBox<T> = { v: T }\n\nexport function useConstant<T>(fn: () => T): T {\n // RSC compat\n if (typeof document === 'undefined') {\n return React.useMemo(() => fn(), [])\n }\n\n const ref = React.useRef<ResultBox<T>>(undefined)\n\n if (!ref.current) {\n ref.current = { v: fn() }\n }\n\n return ref.current.v\n}\n"
|
|
11
11
|
],
|
|
12
12
|
"version": 3
|
|
13
13
|
}
|