@tamagui/use-force-update 1.0.1-beta.18 → 1.0.1-beta.180

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
@@ -1,8 +1,8 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
6
  var __export = (target, all) => {
7
7
  for (var name in all)
8
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -18,16 +18,22 @@ 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
+ isServerSide: () => isServerSide,
21
22
  useForceUpdate: () => useForceUpdate
22
23
  });
23
24
  module.exports = __toCommonJS(src_exports);
24
25
  var import_react = require("react");
26
+ const isServerSide = process.env.TAMAGUI_TARGET === "web" && typeof window === "undefined";
25
27
  function useForceUpdate() {
26
- return (0, import_react.useReducer)((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1];
28
+ if (isServerSide) {
29
+ return () => {
30
+ };
31
+ }
32
+ return (0, import_react.useReducer)((x) => x + 1, 0)[1];
27
33
  }
28
- __name(useForceUpdate, "useForceUpdate");
29
34
  // Annotate the CommonJS export names for ESM import in node:
30
35
  0 && (module.exports = {
36
+ isServerSide,
31
37
  useForceUpdate
32
38
  });
33
39
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import { useReducer } from 'react'\n\nexport function useForceUpdate() {\n return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAEpB,0BAA0B;AAC/B,SAAO,6BAAW,CAAC,MAAO,KAAI,KAAK,OAAO,kBAAkB,CAAC,EAAE;AACjE;AAFgB;",
4
+ "sourcesContent": ["import { useReducer } from 'react'\n\nexport const isServerSide = process.env.TAMAGUI_TARGET === 'web' && typeof window === 'undefined'\n\nexport function useForceUpdate() {\n if (isServerSide) {\n return () => {}\n }\n return useReducer((x) => x + 1, 0)[1] as () => void\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAEpB,MAAM,eAAe,QAAQ,IAAI,mBAAmB,SAAS,OAAO,WAAW;AAE/E,SAAS,iBAAiB;AAC/B,MAAI,cAAc;AAChB,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AACA,aAAO,yBAAW,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE;AACrC;",
6
6
  "names": []
7
7
  }
package/dist/esm/index.js CHANGED
@@ -1,11 +1,14 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
1
  import { useReducer } from "react";
2
+ const isServerSide = process.env.TAMAGUI_TARGET === "web" && typeof window === "undefined";
4
3
  function useForceUpdate() {
5
- return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1];
4
+ if (isServerSide) {
5
+ return () => {
6
+ };
7
+ }
8
+ return useReducer((x) => x + 1, 0)[1];
6
9
  }
7
- __name(useForceUpdate, "useForceUpdate");
8
10
  export {
11
+ isServerSide,
9
12
  useForceUpdate
10
13
  };
11
14
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import { useReducer } from 'react'\n\nexport function useForceUpdate() {\n return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1]\n}\n"],
5
- "mappings": ";;AAAA;AAEO,0BAA0B;AAC/B,SAAO,WAAW,CAAC,MAAO,KAAI,KAAK,OAAO,kBAAkB,CAAC,EAAE;AACjE;AAFgB;",
4
+ "sourcesContent": ["import { useReducer } from 'react'\n\nexport const isServerSide = process.env.TAMAGUI_TARGET === 'web' && typeof window === 'undefined'\n\nexport function useForceUpdate() {\n if (isServerSide) {\n return () => {}\n }\n return useReducer((x) => x + 1, 0)[1] as () => void\n}\n"],
5
+ "mappings": "AAAA,SAAS,kBAAkB;AAEpB,MAAM,eAAe,QAAQ,IAAI,mBAAmB,SAAS,OAAO,WAAW;AAE/E,SAAS,iBAAiB;AAC/B,MAAI,cAAc;AAChB,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AACA,SAAO,WAAW,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE;AACrC;",
6
6
  "names": []
7
7
  }
package/dist/jsx/index.js CHANGED
@@ -1,10 +1,14 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
1
  import { useReducer } from "react";
2
+ const isServerSide = process.env.TAMAGUI_TARGET === "web" && typeof window === "undefined";
4
3
  function useForceUpdate() {
5
- return useReducer((x) => (x + 1) % Number.MAX_SAFE_INTEGER, 0)[1];
4
+ if (isServerSide) {
5
+ return () => {
6
+ };
7
+ }
8
+ return useReducer((x) => x + 1, 0)[1];
6
9
  }
7
- __name(useForceUpdate, "useForceUpdate");
8
10
  export {
11
+ isServerSide,
9
12
  useForceUpdate
10
13
  };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": ["import { useReducer } from 'react'\n\nexport const isServerSide = process.env.TAMAGUI_TARGET === 'web' && typeof window === 'undefined'\n\nexport function useForceUpdate() {\n if (isServerSide) {\n return () => {}\n }\n return useReducer((x) => x + 1, 0)[1] as () => void\n}\n"],
5
+ "mappings": "AAAA,SAAS,kBAAkB;AAEpB,MAAM,eAAe,QAAQ,IAAI,mBAAmB,SAAS,OAAO,WAAW;AAE/E,SAAS,iBAAiB;AAC/B,MAAI,cAAc;AAChB,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AACA,SAAO,WAAW,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE;AACrC;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,22 +1,32 @@
1
1
  {
2
2
  "name": "@tamagui/use-force-update",
3
- "version": "1.0.1-beta.18",
4
- "typings": "types",
3
+ "version": "1.0.1-beta.180",
4
+ "types": "./types/index.d.ts",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
7
7
  "module:jsx": "dist/jsx",
8
8
  "files": [
9
+ "src",
9
10
  "types",
10
11
  "dist"
11
12
  ],
12
13
  "scripts": {
13
14
  "build": "tamagui-build",
14
15
  "watch": "tamagui-build --watch",
16
+ "lint": "eslint",
17
+ "lint:fix": "yarn lint --fix",
15
18
  "clean": "tamagui-build clean",
16
19
  "clean:build": "tamagui-build clean:build"
17
20
  },
21
+ "exports": {
22
+ "./package.json": "./package.json",
23
+ ".": {
24
+ "import": "./dist/esm/index.js",
25
+ "require": "./dist/cjs/index.js"
26
+ }
27
+ },
18
28
  "devDependencies": {
19
- "@tamagui/build": "^1.0.1-beta.18",
29
+ "@tamagui/build": "^1.0.1-beta.180",
20
30
  "react": "*"
21
31
  },
22
32
  "peerDependencies": {
package/src/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { useReducer } from 'react'
2
+
3
+ export const isServerSide = process.env.TAMAGUI_TARGET === 'web' && typeof window === 'undefined'
4
+
5
+ export function useForceUpdate() {
6
+ if (isServerSide) {
7
+ return () => {}
8
+ }
9
+ return useReducer((x) => x + 1, 0)[1] as () => void
10
+ }
package/types/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- export declare function useForceUpdate(): import("react").DispatchWithoutAction;
1
+ export declare const isServerSide: boolean;
2
+ export declare function useForceUpdate(): () => void;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,wBAAgB,cAAc,0CAE7B"}