@tamagui/use-did-finish-ssr 1.30.3 → 1.30.5

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.js CHANGED
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var src_exports = {};
20
20
  __export(src_exports, {
21
+ useClientValue: () => useClientValue,
21
22
  useDidFinishSSR: () => useDidFinishSSR
22
23
  });
23
24
  module.exports = __toCommonJS(src_exports);
@@ -35,8 +36,19 @@ function useDidFinishSSR() {
35
36
  }, []);
36
37
  return did;
37
38
  }
39
+ function useClientValue(value) {
40
+ if (import_constants.isServer || import_constants.isRSC) {
41
+ return void 0;
42
+ }
43
+ const [v, setV] = (0, import_react.useState)(void 0);
44
+ (0, import_constants.useIsomorphicLayoutEffect)(() => {
45
+ setV(value);
46
+ }, []);
47
+ return v;
48
+ }
38
49
  // Annotate the CommonJS export names for ESM import in node:
39
50
  0 && (module.exports = {
51
+ useClientValue,
40
52
  useDidFinishSSR
41
53
  });
42
54
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA2D;AAC3D,mBAA0C;AAEnC,SAAS,kBAAkB;AAEhC,MAAI,6BAAY,wBAAO;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,KAAK,MAAM,QAAI,uBAAkB,KAAK;AAE7C,kDAA0B,MAAM;AAC9B,sCAAgB,MAAM;AACpB,aAAO,IAAI;AAAA,IACb,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
4
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA2D;AAC3D,mBAA0C;AAEnC,SAAS,kBAAkB;AAEhC,MAAI,6BAAY,wBAAO;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,KAAK,MAAM,QAAI,uBAAkB,KAAK;AAE7C,kDAA0B,MAAM;AAC9B,sCAAgB,MAAM;AACpB,aAAO,IAAI;AAAA,IACb,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;AAEO,SAAS,eAAkC,OAAkC;AAClF,MAAI,6BAAY,wBAAO;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,GAAG,IAAI,QAAI,uBAA4B,MAAS;AAEvD,kDAA0B,MAAM;AAC9B,SAAK,KAAK;AAAA,EACZ,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
5
5
  "names": []
6
6
  }
package/dist/esm/index.js CHANGED
@@ -12,7 +12,18 @@ function useDidFinishSSR() {
12
12
  }, []);
13
13
  return did;
14
14
  }
15
+ function useClientValue(value) {
16
+ if (isServer || isRSC) {
17
+ return void 0;
18
+ }
19
+ const [v, setV] = useState(void 0);
20
+ useIsomorphicLayoutEffect(() => {
21
+ setV(value);
22
+ }, []);
23
+ return v;
24
+ }
15
25
  export {
26
+ useClientValue,
16
27
  useDidFinishSSR
17
28
  };
18
29
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "mappings": "AAAA,SAAS,OAAO,UAAU,iCAAiC;AAC3D,SAAS,iBAAiB,gBAAgB;AAEnC,SAAS,kBAAkB;AAEhC,MAAI,YAAY,OAAO;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,KAAK,MAAM,IAAI,SAAkB,KAAK;AAE7C,4BAA0B,MAAM;AAC9B,oBAAgB,MAAM;AACpB,aAAO,IAAI;AAAA,IACb,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
4
+ "mappings": "AAAA,SAAS,OAAO,UAAU,iCAAiC;AAC3D,SAAS,iBAAiB,gBAAgB;AAEnC,SAAS,kBAAkB;AAEhC,MAAI,YAAY,OAAO;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,KAAK,MAAM,IAAI,SAAkB,KAAK;AAE7C,4BAA0B,MAAM;AAC9B,oBAAgB,MAAM;AACpB,aAAO,IAAI;AAAA,IACb,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;AAEO,SAAS,eAAkC,OAAkC;AAClF,MAAI,YAAY,OAAO;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,GAAG,IAAI,IAAI,SAA4B,MAAS;AAEvD,4BAA0B,MAAM;AAC9B,SAAK,KAAK;AAAA,EACZ,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
5
5
  "names": []
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/use-did-finish-ssr",
3
- "version": "1.30.3",
3
+ "version": "1.30.5",
4
4
  "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
@@ -26,10 +26,10 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@tamagui/constants": "1.30.3"
29
+ "@tamagui/constants": "1.30.5"
30
30
  },
31
31
  "devDependencies": {
32
- "@tamagui/build": "1.30.3",
32
+ "@tamagui/build": "1.30.5",
33
33
  "@types/react": "^18.0.15",
34
34
  "react": "^18.2.0"
35
35
  },
package/src/index.ts CHANGED
@@ -17,3 +17,17 @@ export function useDidFinishSSR() {
17
17
 
18
18
  return did
19
19
  }
20
+
21
+ export function useClientValue<Value extends any>(value?: Value): Value | undefined {
22
+ if (isServer || isRSC) {
23
+ return undefined
24
+ }
25
+
26
+ const [v, setV] = useState<Value | undefined>(undefined)
27
+
28
+ useIsomorphicLayoutEffect(() => {
29
+ setV(value)
30
+ }, [])
31
+
32
+ return v
33
+ }
package/types/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export declare function useDidFinishSSR(): boolean;
2
+ export declare function useClientValue<Value extends any>(value?: Value): Value | undefined;
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,YAe9B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,YAe9B;AAED,wBAAgB,cAAc,CAAC,KAAK,SAAS,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CAYlF"}