@tamagui/use-window-dimensions 2.7.7 → 3.0.0-beta.1093.1

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.
Files changed (38) hide show
  1. package/dist/cjs/helpers.cjs +47 -48
  2. package/dist/cjs/helpers.native.cjs +51 -0
  3. package/dist/cjs/helpers.native.js +31 -34
  4. package/dist/cjs/helpers.native.js.map +1 -1
  5. package/dist/cjs/index.cjs +20 -29
  6. package/dist/cjs/index.native.cjs +45 -0
  7. package/dist/cjs/index.native.js +22 -30
  8. package/dist/cjs/index.native.js.map +1 -1
  9. package/dist/cjs/initialValue.cjs +20 -22
  10. package/dist/cjs/initialValue.native.cjs +37 -0
  11. package/dist/cjs/initialValue.native.js +20 -21
  12. package/dist/cjs/initialValue.native.js.map +1 -1
  13. package/dist/cjs/types.cjs +9 -11
  14. package/dist/cjs/types.native.cjs +18 -0
  15. package/dist/cjs/types.native.js +9 -10
  16. package/dist/cjs/types.native.js.map +1 -1
  17. package/dist/esm/helpers.mjs +34 -31
  18. package/dist/esm/helpers.mjs.map +1 -1
  19. package/dist/esm/helpers.native.js +18 -18
  20. package/dist/esm/helpers.native.js.map +1 -1
  21. package/dist/esm/index.js +5 -6
  22. package/dist/esm/index.js.map +1 -1
  23. package/dist/esm/index.mjs +5 -6
  24. package/dist/esm/index.mjs.map +1 -1
  25. package/dist/esm/index.native.js +7 -8
  26. package/dist/esm/index.native.js.map +1 -1
  27. package/dist/esm/initialValue.mjs +6 -5
  28. package/dist/esm/initialValue.mjs.map +1 -1
  29. package/dist/esm/initialValue.native.js +6 -5
  30. package/dist/esm/initialValue.native.js.map +1 -1
  31. package/dist/esm/types.mjs +0 -2
  32. package/dist/esm/types.native.js +0 -2
  33. package/package.json +7 -5
  34. package/src/types.ts +1 -1
  35. package/types/types.d.ts +1 -1
  36. package/types/types.d.ts.map +1 -1
  37. package/dist/esm/types.mjs.map +0 -1
  38. package/dist/esm/types.native.js.map +0 -1
@@ -3,66 +3,65 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
10
  };
11
11
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
19
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
21
  var helpers_exports = {};
24
22
  __export(helpers_exports, {
25
- getWindowSize: () => getWindowSize,
26
- subscribe: () => subscribe
23
+ getWindowSize: () => getWindowSize,
24
+ subscribe: () => subscribe
27
25
  });
28
26
  module.exports = __toCommonJS(helpers_exports);
29
27
  var import_constants = require("@tamagui/constants");
30
28
  let lastSize = require("./initialValue.cjs").initialValue;
31
29
  let docEl = null;
32
30
  function getWindowSize() {
33
- docEl ||= window.document.documentElement;
34
- const nextSize = {
35
- fontScale: 1,
36
- height: docEl.clientHeight,
37
- scale: window.devicePixelRatio || 1,
38
- width: docEl.clientWidth
39
- };
40
- if (nextSize.height !== lastSize.height || nextSize.width !== lastSize.width || nextSize.scale !== lastSize.scale) {
41
- lastSize = nextSize;
42
- return nextSize;
43
- }
44
- return lastSize;
31
+ docEl ||= window.document.documentElement;
32
+ const nextSize = {
33
+ fontScale: 1,
34
+ height: docEl.clientHeight,
35
+ scale: window.devicePixelRatio || 1,
36
+ width: docEl.clientWidth
37
+ };
38
+ if (nextSize.height !== lastSize.height || nextSize.width !== lastSize.width || nextSize.scale !== lastSize.scale) {
39
+ lastSize = nextSize;
40
+ return nextSize;
41
+ }
42
+ return lastSize;
45
43
  }
46
- const cbs = /* @__PURE__ */new Set();
44
+ const cbs = /* @__PURE__ */ new Set();
47
45
  if (import_constants.isClient && typeof window !== "undefined" && typeof window.addEventListener === "function") {
48
- let flushUpdate = function () {
49
- lastUpdate = Date.now();
50
- cbs.forEach(cb => cb(getWindowSize()));
51
- };
52
- let lastUpdate = Date.now();
53
- let tm;
54
- const USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS;
55
- const updateMaxMs = USER_MAX_MS ? +USER_MAX_MS : 100;
56
- const onResize = () => {
57
- clearTimeout(tm);
58
- const timeSinceLast = Date.now() - lastUpdate;
59
- if (timeSinceLast < updateMaxMs) tm = setTimeout(() => {
60
- flushUpdate();
61
- }, updateMaxMs - timeSinceLast);else flushUpdate();
62
- };
63
- window.addEventListener("resize", onResize);
46
+ let flushUpdate = function() {
47
+ lastUpdate = Date.now();
48
+ cbs.forEach((cb) => cb(getWindowSize()));
49
+ };
50
+ let lastUpdate = Date.now();
51
+ let tm;
52
+ const USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS;
53
+ const updateMaxMs = USER_MAX_MS ? +USER_MAX_MS : 100;
54
+ const onResize = () => {
55
+ clearTimeout(tm);
56
+ const timeSinceLast = Date.now() - lastUpdate;
57
+ if (timeSinceLast < updateMaxMs) tm = setTimeout(() => {
58
+ flushUpdate();
59
+ }, updateMaxMs - timeSinceLast);
60
+ else flushUpdate();
61
+ };
62
+ window.addEventListener("resize", onResize);
64
63
  }
65
64
  function subscribe(cb) {
66
- cbs.add(cb);
67
- return () => cbs.delete(cb);
68
- }
65
+ cbs.add(cb);
66
+ return () => cbs.delete(cb);
67
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var helpers_native_exports = {};
24
+ __export(helpers_native_exports, {
25
+ getWindowSize: () => getWindowSize,
26
+ subscribe: () => subscribe
27
+ });
28
+ module.exports = __toCommonJS(helpers_native_exports);
29
+ var import_react_native = require("react-native");
30
+ function getWindowSize() {
31
+ return import_react_native.Dimensions.get("window");
32
+ }
33
+ var cbs = /* @__PURE__ */ new Set();
34
+ var isListening = false;
35
+ var ensureListening = function() {
36
+ if (isListening) return;
37
+ isListening = true;
38
+ import_react_native.Dimensions.addEventListener("change", function(param) {
39
+ var { window } = param;
40
+ cbs.forEach(function(cb) {
41
+ return cb(window);
42
+ });
43
+ });
44
+ };
45
+ function subscribe(cb) {
46
+ ensureListening();
47
+ cbs.add(cb);
48
+ return function() {
49
+ return cbs.delete(cb);
50
+ };
51
+ }
@@ -5,52 +5,49 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
12
  };
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
21
  };
22
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
23
  var helpers_native_exports = {};
26
24
  __export(helpers_native_exports, {
27
- getWindowSize: () => getWindowSize,
28
- subscribe: () => subscribe
25
+ getWindowSize: () => getWindowSize,
26
+ subscribe: () => subscribe
29
27
  });
30
28
  module.exports = __toCommonJS(helpers_native_exports);
31
29
  var import_react_native = require("react-native");
32
30
  function getWindowSize() {
33
- return import_react_native.Dimensions.get("window");
31
+ return import_react_native.Dimensions.get("window");
34
32
  }
35
- var cbs = /* @__PURE__ */new Set();
33
+ var cbs = /* @__PURE__ */ new Set();
36
34
  var isListening = false;
37
- var ensureListening = function () {
38
- if (isListening) return;
39
- isListening = true;
40
- import_react_native.Dimensions.addEventListener("change", function (param) {
41
- var {
42
- window
43
- } = param;
44
- cbs.forEach(function (cb) {
45
- return cb(window);
46
- });
47
- });
35
+ var ensureListening = function() {
36
+ if (isListening) return;
37
+ isListening = true;
38
+ import_react_native.Dimensions.addEventListener("change", function(param) {
39
+ var { window } = param;
40
+ cbs.forEach(function(cb) {
41
+ return cb(window);
42
+ });
43
+ });
48
44
  };
49
45
  function subscribe(cb) {
50
- ensureListening();
51
- cbs.add(cb);
52
- return function () {
53
- return cbs.delete(cb);
54
- };
46
+ ensureListening();
47
+ cbs.add(cb);
48
+ return function() {
49
+ return cbs.delete(cb);
50
+ };
55
51
  }
52
+
56
53
  //# sourceMappingURL=helpers.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["helpers_native_exports","__export","getWindowSize","subscribe","module","exports","__toCommonJS","import_react_native","require","Dimensions","get","cbs","Set","isListening","ensureListening","addEventListener","param","window","forEach","cb","add","delete"],"sources":["../../src/helpers.native.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,sBAAA;AAAAC,QAAA,CAAAD,sBAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA,aAAA;EAAAC,SAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAN,sBAAA;AAAA,IAAAO,mBAAA,GAA2BC,OAAA;AACpB,SAASN,cAAA,EAAgB;EAC5B,OAAOK,mBAAA,CAAAE,UAAA,CAAWC,GAAA,CAAI,QAAQ;AAClC;AACA,IAAIC,GAAA,GAAM,mBAAIC,GAAA,CAAI;AAClB,IAAIC,WAAA,GAAc;AAClB,IAAIC,eAAA,GAAkB,SAAAA,CAAA,EAAW;EAC7B,IAAID,WAAA,EAAa;EACjBA,WAAA,GAAc;EAIdN,mBAAA,CAAAE,UAAA,CAAWM,gBAAA,CAAiB,UAAU,UAASC,KAAA,EAAO;IAClD,IAAI;MAAEC;IAAO,IAAID,KAAA;IACjBL,GAAA,CAAIO,OAAA,CAAQ,UAASC,EAAA,EAAI;MACrB,OAAOA,EAAA,CAAGF,MAAM;IACpB,CAAC;EACL,CAAC;AACL;AACO,SAASd,UAAUgB,EAAA,EAAI;EAC1BL,eAAA,CAAgB;EAChBH,GAAA,CAAIS,GAAA,CAAID,EAAE;EACV,OAAO,YAAW;IACd,OAAOR,GAAA,CAAIU,MAAA,CAAOF,EAAE;EACxB;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"helpers.native.js","names":[],"sources":["cjs/helpers.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar helpers_native_exports = {};\n__export(helpers_native_exports, {\n getWindowSize: () => getWindowSize,\n subscribe: () => subscribe\n});\nmodule.exports = __toCommonJS(helpers_native_exports);\nvar import_react_native = require(\"react-native\");\nfunction getWindowSize() {\n return import_react_native.Dimensions.get(\"window\");\n}\nvar cbs = /* @__PURE__ */ new Set();\nvar isListening = false;\nvar ensureListening = function() {\n if (isListening) return;\n isListening = true;\n import_react_native.Dimensions.addEventListener(\"change\", function(param) {\n var { window } = param;\n cbs.forEach(function(cb) {\n return cb(window);\n });\n });\n};\nfunction subscribe(cb) {\n ensureListening();\n cbs.add(cb);\n return function() {\n return cbs.delete(cb);\n };\n}\n//# sourceMappingURL=helpers.native.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,yBAAyB,CAAC;AAC9B,SAAS,wBAAwB;CAC/B,qBAAqB;CACrB,iBAAiB;AACnB,CAAC;AACD,OAAO,UAAU,aAAa,sBAAsB;AACpD,IAAI,sBAAsB,QAAQ,cAAc;AAChD,SAAS,gBAAgB;CACvB,OAAO,oBAAoB,WAAW,IAAI,QAAQ;AACpD;AACA,IAAI,sBAAsB,IAAI,IAAI;AAClC,IAAI,cAAc;AAClB,IAAI,kBAAkB,WAAW;CAC/B,IAAI,aAAa;CACjB,cAAc;CACd,oBAAoB,WAAW,iBAAiB,UAAU,SAAS,OAAO;EACxE,IAAI,EAAE,WAAW;EACjB,IAAI,QAAQ,SAAS,IAAI;GACvB,OAAO,GAAG,MAAM;EAClB,CAAC;CACH,CAAC;AACH;AACA,SAAS,UAAU,IAAI;CACrB,gBAAgB;CAChB,IAAI,IAAI,EAAE;CACV,OAAO,WAAW;EAChB,OAAO,IAAI,OAAO,EAAE;CACtB;AACF"}
@@ -5,36 +5,29 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
12
  };
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
21
  };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: true
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
30
25
  }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
27
  var index_exports = {};
35
28
  __export(index_exports, {
36
- configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,
37
- useWindowDimensions: () => useWindowDimensions
29
+ configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,
30
+ useWindowDimensions: () => useWindowDimensions
38
31
  });
39
32
  module.exports = __toCommonJS(index_exports);
40
33
  var import_react = __toESM(require("react"), 1);
@@ -42,8 +35,6 @@ var import_constants = require("@tamagui/constants");
42
35
  var import_helpers = require("./helpers.cjs");
43
36
  var import_initialValue = require("./initialValue.cjs");
44
37
  var import_initialValue2 = require("./initialValue.cjs");
45
- function useWindowDimensions({
46
- serverValue = import_initialValue.initialValue
47
- } = {}) {
48
- return import_react.default.useSyncExternalStore(import_helpers.subscribe, import_helpers.getWindowSize, () => import_constants.isWeb ? serverValue : (0, import_helpers.getWindowSize)());
49
- }
38
+ function useWindowDimensions({ serverValue = import_initialValue.initialValue } = {}) {
39
+ return import_react.default.useSyncExternalStore(import_helpers.subscribe, import_helpers.getWindowSize, () => import_constants.isWeb ? serverValue : (0, import_helpers.getWindowSize)());
40
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
+ value: mod,
26
+ enumerable: true
27
+ }) : target, mod));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var index_exports = {};
30
+ __export(index_exports, {
31
+ configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,
32
+ useWindowDimensions: () => useWindowDimensions
33
+ });
34
+ module.exports = __toCommonJS(index_exports);
35
+ var import_react = __toESM(require("react"), 1);
36
+ var import_constants = require("@tamagui/constants");
37
+ var import_helpers = require("./helpers.native.js");
38
+ var import_initialValue = require("./initialValue.native.js");
39
+ var import_initialValue2 = require("./initialValue.native.js");
40
+ function useWindowDimensions() {
41
+ var { serverValue = import_initialValue.initialValue } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
42
+ return import_react.default.useSyncExternalStore(import_helpers.subscribe, import_helpers.getWindowSize, function() {
43
+ return import_constants.isWeb ? serverValue : (0, import_helpers.getWindowSize)();
44
+ });
45
+ }
@@ -7,36 +7,29 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
14
  };
15
15
  var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: () => from[key],
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
23
  };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
+ value: mod,
26
+ enumerable: true
32
27
  }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
29
  var index_exports = {};
37
30
  __export(index_exports, {
38
- configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,
39
- useWindowDimensions: () => useWindowDimensions
31
+ configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,
32
+ useWindowDimensions: () => useWindowDimensions
40
33
  });
41
34
  module.exports = __toCommonJS(index_exports);
42
35
  var import_react = __toESM(require("react"), 1);
@@ -45,11 +38,10 @@ var import_helpers = require("./helpers.native.js");
45
38
  var import_initialValue = require("./initialValue.native.js");
46
39
  var import_initialValue2 = require("./initialValue.native.js");
47
40
  function useWindowDimensions() {
48
- var {
49
- serverValue = import_initialValue.initialValue
50
- } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
51
- return import_react.default.useSyncExternalStore(import_helpers.subscribe, import_helpers.getWindowSize, function () {
52
- return import_constants.isWeb ? serverValue : (0, import_helpers.getWindowSize)();
53
- });
41
+ var { serverValue = import_initialValue.initialValue } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
42
+ return import_react.default.useSyncExternalStore(import_helpers.subscribe, import_helpers.getWindowSize, function() {
43
+ return import_constants.isWeb ? serverValue : (0, import_helpers.getWindowSize)();
44
+ });
54
45
  }
46
+
55
47
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","configureInitialWindowDimensions","import_initialValue2","useWindowDimensions","module","exports","import_react","__toESM","require","import_constants","import_helpers","import_initialValue","serverValue","initialValue","arguments","length","default","useSyncExternalStore","subscribe","getWindowSize","isWeb"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,gCAAA,EAAAA,CAAA,KAAAC,oBAAA,CAAAD,gCAAA;EAAAE,mBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAX,YAAkB,CAAAK,aAAA;AAClB,IAAAO,YAAA,GAAAC,OAAsB,CAAAC,OAAA;AAEtB,IAAAC,gBAAA,GAAyCD,OAAA;AAEzC,IAAAE,cAAA,GAAAF,OAA6B;AAE7B,IAAAG,mBAAA,GAAAH,OAAiD;AAE1C,IAAAN,oBAAS,GAAAM,OAAoB;AAAA,SAClCL,mBAAcA,CAAA;EAChB,IAAmC;IAAeS,WAAA,GAAAD,mBAAA,CAAAE;EAAA,IAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;EAChD,OAAOR,YAAA,CAAAU,OAAA,CAAMC,oBAAA,CAAAP,cAAA,CAAAQ,SAAA,EAAAR,cAAA,CAAAS,aAAA;IAAqB,OAAAV,gBAAA,CAAAW,KAAA,GAAAR,WAAA,OAAAF,cAAA,CAAAS,aAAA;EAAA,EAAW;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,\n useWindowDimensions: () => useWindowDimensions\n});\nmodule.exports = __toCommonJS(index_exports);\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_constants = require(\"@tamagui/constants\");\nvar import_helpers = require(\"./helpers\");\nvar import_initialValue = require(\"./initialValue\");\nvar import_initialValue2 = require(\"./initialValue\");\nfunction useWindowDimensions() {\n var { serverValue = import_initialValue.initialValue } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n return import_react.default.useSyncExternalStore(import_helpers.subscribe, import_helpers.getWindowSize, function() {\n return import_constants.isWeb ? serverValue : (0, import_helpers.getWindowSize)();\n });\n}\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,SAAS,eAAe;CACtB,wCAAwC,qBAAqB;CAC7D,2BAA2B;AAC7B,CAAC;AACD,OAAO,UAAU,aAAa,aAAa;AAC3C,IAAI,eAAe,QAAQ,QAAQ,OAAO,GAAG,CAAC;AAC9C,IAAI,mBAAmB,QAAQ,oBAAoB;AACnD,IAAI,iBAAiB,QAAQ,qBAAW;AACxC,IAAI,sBAAsB,QAAQ,0BAAgB;AAClD,IAAI,uBAAuB,QAAQ,0BAAgB;AACnD,SAAS,sBAAsB;CAC7B,IAAI,EAAE,cAAc,oBAAoB,iBAAiB,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK,CAAC;CAC3H,OAAO,aAAa,QAAQ,qBAAqB,eAAe,WAAW,eAAe,eAAe,WAAW;EAClH,OAAO,iBAAiB,QAAQ,eAAe,GAAG,eAAe,cAAa,CAAE;CAClF,CAAC;AACH"}
@@ -3,35 +3,33 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
10
  };
11
11
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
19
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
21
  var initialValue_exports = {};
24
22
  __export(initialValue_exports, {
25
- configureInitialWindowDimensions: () => configureInitialWindowDimensions,
26
- initialValue: () => initialValue
23
+ configureInitialWindowDimensions: () => configureInitialWindowDimensions,
24
+ initialValue: () => initialValue
27
25
  });
28
26
  module.exports = __toCommonJS(initialValue_exports);
29
27
  const initialValue = {
30
- width: 800,
31
- height: 600,
32
- scale: 1,
33
- fontScale: 1
28
+ width: 800,
29
+ height: 600,
30
+ scale: 1,
31
+ fontScale: 1
34
32
  };
35
33
  function configureInitialWindowDimensions(next) {
36
- Object.assign(initialValue, next);
37
- }
34
+ Object.assign(initialValue, next);
35
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var initialValue_exports = {};
24
+ __export(initialValue_exports, {
25
+ configureInitialWindowDimensions: () => configureInitialWindowDimensions,
26
+ initialValue: () => initialValue
27
+ });
28
+ module.exports = __toCommonJS(initialValue_exports);
29
+ var initialValue = {
30
+ width: 800,
31
+ height: 600,
32
+ scale: 1,
33
+ fontScale: 1
34
+ };
35
+ function configureInitialWindowDimensions(next) {
36
+ Object.assign(initialValue, next);
37
+ }
@@ -5,36 +5,35 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
12
  };
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
21
  };
22
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
23
  var initialValue_exports = {};
26
24
  __export(initialValue_exports, {
27
- configureInitialWindowDimensions: () => configureInitialWindowDimensions,
28
- initialValue: () => initialValue
25
+ configureInitialWindowDimensions: () => configureInitialWindowDimensions,
26
+ initialValue: () => initialValue
29
27
  });
30
28
  module.exports = __toCommonJS(initialValue_exports);
31
29
  var initialValue = {
32
- width: 800,
33
- height: 600,
34
- scale: 1,
35
- fontScale: 1
30
+ width: 800,
31
+ height: 600,
32
+ scale: 1,
33
+ fontScale: 1
36
34
  };
37
35
  function configureInitialWindowDimensions(next) {
38
- Object.assign(initialValue, next);
36
+ Object.assign(initialValue, next);
39
37
  }
38
+
40
39
  //# sourceMappingURL=initialValue.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","initialValue_exports","__export","configureInitialWindowDimensions","initialValue","module","exports","width","height","scale","fontScale","next","Object","assign"],"sources":["../../src/initialValue.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,oBAAA;AAAAC,QAAA,CAAAD,oBAAA;EAAAE,gCAAA,EAAAA,CAAA,KAAAA,gCAAA;EAAAC,YAAA,EAAAA,CAAA,KAAAA;AAAA;AAKOC,MAAM,CAAAC,OAAA,GAAAV,YAA2B,CAAAK,oBAAA;AAAA,IACtCG,YAAO;EACPG,KAAA,KAAQ;EACRC,MAAA,EAAO;EACPC,KAAA;EACFC,SAAA;AAEO;AACL,SAAOP,gCAAyBA,CAAAQ,IAAA;EAClCC,MAAA,CAAAC,MAAA,CAAAT,YAAA,EAAAO,IAAA","ignoreList":[]}
1
+ {"version":3,"file":"initialValue.native.js","names":[],"sources":["cjs/initialValue.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar initialValue_exports = {};\n__export(initialValue_exports, {\n configureInitialWindowDimensions: () => configureInitialWindowDimensions,\n initialValue: () => initialValue\n});\nmodule.exports = __toCommonJS(initialValue_exports);\nvar initialValue = {\n width: 800,\n height: 600,\n scale: 1,\n fontScale: 1\n};\nfunction configureInitialWindowDimensions(next) {\n Object.assign(initialValue, next);\n}\n//# sourceMappingURL=initialValue.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,uBAAuB,CAAC;AAC5B,SAAS,sBAAsB;CAC7B,wCAAwC;CACxC,oBAAoB;AACtB,CAAC;AACD,OAAO,UAAU,aAAa,oBAAoB;AAClD,IAAI,eAAe;CACjB,OAAO;CACP,QAAQ;CACR,OAAO;CACP,WAAW;AACb;AACA,SAAS,iCAAiC,MAAM;CAC9C,OAAO,OAAO,cAAc,IAAI;AAClC"}
@@ -3,16 +3,14 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
- get: () => from[key],
9
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
- });
11
- }
12
- return to;
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
12
+ return to;
13
13
  };
14
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
- value: true
16
- }), mod);
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
17
15
  var types_exports = {};
18
- module.exports = __toCommonJS(types_exports);
16
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
14
+ return to;
15
+ };
16
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
@@ -5,17 +5,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from === "object" || typeof from === "function") {
9
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
- get: () => from[key],
11
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
- });
13
- }
14
- return to;
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
14
+ return to;
15
15
  };
16
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
17
- value: true
18
- }), mod);
16
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
17
  var types_exports = {};
20
18
  module.exports = __toCommonJS(types_exports);
19
+
21
20
  //# sourceMappingURL=types.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../src/types.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"types.native.js","names":[],"sources":["cjs/types.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar types_exports = {};\nmodule.exports = __toCommonJS(types_exports);\n//# sourceMappingURL=types.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa"}
@@ -1,43 +1,46 @@
1
1
  import { isClient } from "@tamagui/constants";
2
2
  import { initialValue } from "./initialValue.mjs";
3
+
3
4
  let lastSize = initialValue;
4
5
  let docEl = null;
5
6
  function getWindowSize() {
6
- docEl ||= window.document.documentElement;
7
- const nextSize = {
8
- fontScale: 1,
9
- height: docEl.clientHeight,
10
- scale: window.devicePixelRatio || 1,
11
- width: docEl.clientWidth
12
- };
13
- if (nextSize.height !== lastSize.height || nextSize.width !== lastSize.width || nextSize.scale !== lastSize.scale) {
14
- lastSize = nextSize;
15
- return nextSize;
16
- }
17
- return lastSize;
7
+ docEl ||= window.document.documentElement;
8
+ const nextSize = {
9
+ fontScale: 1,
10
+ height: docEl.clientHeight,
11
+ scale: window.devicePixelRatio || 1,
12
+ width: docEl.clientWidth
13
+ };
14
+ if (nextSize.height !== lastSize.height || nextSize.width !== lastSize.width || nextSize.scale !== lastSize.scale) {
15
+ lastSize = nextSize;
16
+ return nextSize;
17
+ }
18
+ return lastSize;
18
19
  }
19
- const cbs = /* @__PURE__ */new Set();
20
+ const cbs = /* @__PURE__ */ new Set();
20
21
  if (isClient && typeof window !== "undefined" && typeof window.addEventListener === "function") {
21
- let flushUpdate = function () {
22
- lastUpdate = Date.now();
23
- cbs.forEach(cb => cb(getWindowSize()));
24
- };
25
- let lastUpdate = Date.now();
26
- let tm;
27
- const USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS;
28
- const updateMaxMs = USER_MAX_MS ? +USER_MAX_MS : 100;
29
- const onResize = () => {
30
- clearTimeout(tm);
31
- const timeSinceLast = Date.now() - lastUpdate;
32
- if (timeSinceLast < updateMaxMs) tm = setTimeout(() => {
33
- flushUpdate();
34
- }, updateMaxMs - timeSinceLast);else flushUpdate();
35
- };
36
- window.addEventListener("resize", onResize);
22
+ let flushUpdate = function() {
23
+ lastUpdate = Date.now();
24
+ cbs.forEach((cb) => cb(getWindowSize()));
25
+ };
26
+ let lastUpdate = Date.now();
27
+ let tm;
28
+ const USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS;
29
+ const updateMaxMs = USER_MAX_MS ? +USER_MAX_MS : 100;
30
+ const onResize = () => {
31
+ clearTimeout(tm);
32
+ const timeSinceLast = Date.now() - lastUpdate;
33
+ if (timeSinceLast < updateMaxMs) tm = setTimeout(() => {
34
+ flushUpdate();
35
+ }, updateMaxMs - timeSinceLast);
36
+ else flushUpdate();
37
+ };
38
+ window.addEventListener("resize", onResize);
37
39
  }
38
40
  function subscribe(cb) {
39
- cbs.add(cb);
40
- return () => cbs.delete(cb);
41
+ cbs.add(cb);
42
+ return () => cbs.delete(cb);
41
43
  }
44
+
42
45
  export { getWindowSize, subscribe };
43
46
  //# sourceMappingURL=helpers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["isClient","initialValue","lastSize","docEl","getWindowSize","window","document","documentElement","nextSize","fontScale","height","clientHeight","scale","devicePixelRatio","width","clientWidth","cbs","Set","addEventListener","flushUpdate","lastUpdate","Date","now","forEach","cb","tm","USER_MAX_MS","process","env","TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS","updateMaxMs","onResize","clearTimeout","timeSinceLast","setTimeout","subscribe","add","delete"],"sources":["helpers.mjs"],"sourcesContent":["import { isClient } from \"@tamagui/constants\";\nimport { initialValue } from \"./initialValue\";\n\nlet lastSize = initialValue;\nlet docEl = null;\nfunction getWindowSize() {\n\tdocEl ||= window.document.documentElement;\n\tconst nextSize = {\n\t\tfontScale: 1,\n\t\theight: docEl.clientHeight,\n\t\tscale: window.devicePixelRatio || 1,\n\t\twidth: docEl.clientWidth\n\t};\n\tif (nextSize.height !== lastSize.height || nextSize.width !== lastSize.width || nextSize.scale !== lastSize.scale) {\n\t\tlastSize = nextSize;\n\t\treturn nextSize;\n\t}\n\treturn lastSize;\n}\nconst cbs = /* @__PURE__ */ new Set();\nif (isClient && typeof window !== \"undefined\" && typeof window.addEventListener === \"function\") {\n\tlet flushUpdate = function() {\n\t\tlastUpdate = Date.now();\n\t\tcbs.forEach((cb) => cb(getWindowSize()));\n\t};\n\tlet lastUpdate = Date.now();\n\tlet tm;\n\tconst USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS;\n\tconst updateMaxMs = USER_MAX_MS ? +USER_MAX_MS : 100;\n\tconst onResize = () => {\n\t\tclearTimeout(tm);\n\t\tconst timeSinceLast = Date.now() - lastUpdate;\n\t\tif (timeSinceLast < updateMaxMs) tm = setTimeout(() => {\n\t\t\tflushUpdate();\n\t\t}, updateMaxMs - timeSinceLast);\n\t\telse flushUpdate();\n\t};\n\twindow.addEventListener(\"resize\", onResize);\n}\nfunction subscribe(cb) {\n\tcbs.add(cb);\n\treturn () => cbs.delete(cb);\n}\n\nexport { getWindowSize, subscribe };"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,YAAY,QAAQ,oBAAgB;AAE7C,IAAIC,QAAQ,GAAGD,YAAY;AAC3B,IAAIE,KAAK,GAAG,IAAI;AAChB,SAASC,aAAaA,CAAA,EAAG;EACxBD,KAAK,KAAKE,MAAM,CAACC,QAAQ,CAACC,eAAe;EACzC,MAAMC,QAAQ,GAAG;IAChBC,SAAS,EAAE,CAAC;IACZC,MAAM,EAAEP,KAAK,CAACQ,YAAY;IAC1BC,KAAK,EAAEP,MAAM,CAACQ,gBAAgB,IAAI,CAAC;IACnCC,KAAK,EAAEX,KAAK,CAACY;EACd,CAAC;EACD,IAAIP,QAAQ,CAACE,MAAM,KAAKR,QAAQ,CAACQ,MAAM,IAAIF,QAAQ,CAACM,KAAK,KAAKZ,QAAQ,CAACY,KAAK,IAAIN,QAAQ,CAACI,KAAK,KAAKV,QAAQ,CAACU,KAAK,EAAE;IAClHV,QAAQ,GAAGM,QAAQ;IACnB,OAAOA,QAAQ;EAChB;EACA,OAAON,QAAQ;AAChB;AACA,MAAMc,GAAG,GAAG,eAAgB,IAAIC,GAAG,CAAC,CAAC;AACrC,IAAIjB,QAAQ,IAAI,OAAOK,MAAM,KAAK,WAAW,IAAI,OAAOA,MAAM,CAACa,gBAAgB,KAAK,UAAU,EAAE;EAC/F,IAAIC,WAAW,GAAG,SAAAA,CAAA,EAAW;IAC5BC,UAAU,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;IACvBN,GAAG,CAACO,OAAO,CAAEC,EAAE,IAAKA,EAAE,CAACpB,aAAa,CAAC,CAAC,CAAC,CAAC;EACzC,CAAC;EACD,IAAIgB,UAAU,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;EAC3B,IAAIG,EAAE;EACN,MAAMC,WAAW,GAAGC,OAAO,CAACC,GAAG,CAACC,2CAA2C;EAC3E,MAAMC,WAAW,GAAGJ,WAAW,GAAG,CAACA,WAAW,GAAG,GAAG;EACpD,MAAMK,QAAQ,GAAGA,CAAA,KAAM;IACtBC,YAAY,CAACP,EAAE,CAAC;IAChB,MAAMQ,aAAa,GAAGZ,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGF,UAAU;IAC7C,IAAIa,aAAa,GAAGH,WAAW,EAAEL,EAAE,GAAGS,UAAU,CAAC,MAAM;MACtDf,WAAW,CAAC,CAAC;IACd,CAAC,EAAEW,WAAW,GAAGG,aAAa,CAAC,CAAC,KAC3Bd,WAAW,CAAC,CAAC;EACnB,CAAC;EACDd,MAAM,CAACa,gBAAgB,CAAC,QAAQ,EAAEa,QAAQ,CAAC;AAC5C;AACA,SAASI,SAASA,CAACX,EAAE,EAAE;EACtBR,GAAG,CAACoB,GAAG,CAACZ,EAAE,CAAC;EACX,OAAO,MAAMR,GAAG,CAACqB,MAAM,CAACb,EAAE,CAAC;AAC5B;AAEA,SAASpB,aAAa,EAAE+B,SAAS","ignoreList":[]}
1
+ {"version":3,"file":"helpers.js","names":[],"sources":["esm/helpers.js"],"sourcesContent":["import { isClient } from \"@tamagui/constants\";\nimport { initialValue } from \"./initialValue\";\n\nlet lastSize = initialValue;\nlet docEl = null;\nfunction getWindowSize() {\n\tdocEl ||= window.document.documentElement;\n\tconst nextSize = {\n\t\tfontScale: 1,\n\t\theight: docEl.clientHeight,\n\t\tscale: window.devicePixelRatio || 1,\n\t\twidth: docEl.clientWidth\n\t};\n\tif (nextSize.height !== lastSize.height || nextSize.width !== lastSize.width || nextSize.scale !== lastSize.scale) {\n\t\tlastSize = nextSize;\n\t\treturn nextSize;\n\t}\n\treturn lastSize;\n}\nconst cbs = /* @__PURE__ */ new Set();\nif (isClient && typeof window !== \"undefined\" && typeof window.addEventListener === \"function\") {\n\tlet flushUpdate = function() {\n\t\tlastUpdate = Date.now();\n\t\tcbs.forEach((cb) => cb(getWindowSize()));\n\t};\n\tlet lastUpdate = Date.now();\n\tlet tm;\n\tconst USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS;\n\tconst updateMaxMs = USER_MAX_MS ? +USER_MAX_MS : 100;\n\tconst onResize = () => {\n\t\tclearTimeout(tm);\n\t\tconst timeSinceLast = Date.now() - lastUpdate;\n\t\tif (timeSinceLast < updateMaxMs) tm = setTimeout(() => {\n\t\t\tflushUpdate();\n\t\t}, updateMaxMs - timeSinceLast);\n\t\telse flushUpdate();\n\t};\n\twindow.addEventListener(\"resize\", onResize);\n}\nfunction subscribe(cb) {\n\tcbs.add(cb);\n\treturn () => cbs.delete(cb);\n}\n\nexport { getWindowSize, subscribe };"],"mappings":";;;;AAGA,IAAI,WAAW;AACf,IAAI,QAAQ;AACZ,SAAS,gBAAgB;CACxB,UAAU,OAAO,SAAS;CAC1B,MAAM,WAAW;EAChB,WAAW;EACX,QAAQ,MAAM;EACd,OAAO,OAAO,oBAAoB;EAClC,OAAO,MAAM;CACd;CACA,IAAI,SAAS,WAAW,SAAS,UAAU,SAAS,UAAU,SAAS,SAAS,SAAS,UAAU,SAAS,OAAO;EAClH,WAAW;EACX,OAAO;CACR;CACA,OAAO;AACR;AACA,MAAM,sBAAsB,IAAI,IAAI;AACpC,IAAI,YAAY,OAAO,WAAW,eAAe,OAAO,OAAO,qBAAqB,YAAY;CAC/F,IAAI,cAAc,WAAW;EAC5B,aAAa,KAAK,IAAI;EACtB,IAAI,SAAS,OAAO,GAAG,cAAc,CAAC,CAAC;CACxC;CACA,IAAI,aAAa,KAAK,IAAI;CAC1B,IAAI;CACJ,MAAM,cAAc,QAAQ,IAAI;CAChC,MAAM,cAAc,cAAc,CAAC,cAAc;CACjD,MAAM,iBAAiB;EACtB,aAAa,EAAE;EACf,MAAM,gBAAgB,KAAK,IAAI,IAAI;EACnC,IAAI,gBAAgB,aAAa,KAAK,iBAAiB;GACtD,YAAY;EACb,GAAG,cAAc,aAAa;OACzB,YAAY;CAClB;CACA,OAAO,iBAAiB,UAAU,QAAQ;AAC3C;AACA,SAAS,UAAU,IAAI;CACtB,IAAI,IAAI,EAAE;CACV,aAAa,IAAI,OAAO,EAAE;AAC3B"}
@@ -1,27 +1,27 @@
1
1
  import { Dimensions } from "react-native";
2
+
2
3
  function getWindowSize() {
3
- return Dimensions.get("window");
4
+ return Dimensions.get("window");
4
5
  }
5
- var cbs = /* @__PURE__ */new Set();
6
+ var cbs = /* @__PURE__ */ new Set();
6
7
  var isListening = false;
7
- var ensureListening = function () {
8
- if (isListening) return;
9
- isListening = true;
10
- Dimensions.addEventListener("change", function (param) {
11
- var {
12
- window
13
- } = param;
14
- cbs.forEach(function (cb) {
15
- return cb(window);
16
- });
17
- });
8
+ var ensureListening = function() {
9
+ if (isListening) return;
10
+ isListening = true;
11
+ Dimensions.addEventListener("change", function(param) {
12
+ var { window } = param;
13
+ cbs.forEach(function(cb) {
14
+ return cb(window);
15
+ });
16
+ });
18
17
  };
19
18
  function subscribe(cb) {
20
- ensureListening();
21
- cbs.add(cb);
22
- return function () {
23
- return cbs.delete(cb);
24
- };
19
+ ensureListening();
20
+ cbs.add(cb);
21
+ return function() {
22
+ return cbs.delete(cb);
23
+ };
25
24
  }
25
+
26
26
  export { getWindowSize, subscribe };
27
27
  //# sourceMappingURL=helpers.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Dimensions","getWindowSize","get","cbs","Set","isListening","ensureListening","addEventListener","param","window","forEach","cb","subscribe","add","delete"],"sources":["../../src/helpers.native.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,UAAA,QAAkB;AACpB,SAASC,cAAA,EAAgB;EAC5B,OAAOD,UAAA,CAAWE,GAAA,CAAI,QAAQ;AAClC;AACA,IAAIC,GAAA,GAAM,mBAAIC,GAAA,CAAI;AAClB,IAAIC,WAAA,GAAc;AAClB,IAAIC,eAAA,GAAkB,SAAAA,CAAA,EAAW;EAC7B,IAAID,WAAA,EAAa;EACjBA,WAAA,GAAc;EAIdL,UAAA,CAAWO,gBAAA,CAAiB,UAAU,UAASC,KAAA,EAAO;IAClD,IAAI;MAAEC;IAAO,IAAID,KAAA;IACjBL,GAAA,CAAIO,OAAA,CAAQ,UAASC,EAAA,EAAI;MACrB,OAAOA,EAAA,CAAGF,MAAM;IACpB,CAAC;EACL,CAAC;AACL;AACO,SAASG,UAAUD,EAAA,EAAI;EAC1BL,eAAA,CAAgB;EAChBH,GAAA,CAAIU,GAAA,CAAIF,EAAE;EACV,OAAO,YAAW;IACd,OAAOR,GAAA,CAAIW,MAAA,CAAOH,EAAE;EACxB;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"helpers.native.js","names":[],"sources":["esm/helpers.native.js"],"sourcesContent":["import { Dimensions } from \"react-native\";\nfunction getWindowSize() {\n return Dimensions.get(\"window\");\n}\nvar cbs = /* @__PURE__ */ new Set();\nvar isListening = false;\nvar ensureListening = function() {\n if (isListening) return;\n isListening = true;\n Dimensions.addEventListener(\"change\", function(param) {\n var { window } = param;\n cbs.forEach(function(cb) {\n return cb(window);\n });\n });\n};\nfunction subscribe(cb) {\n ensureListening();\n cbs.add(cb);\n return function() {\n return cbs.delete(cb);\n };\n}\nexport {\n getWindowSize,\n subscribe\n};\n//# sourceMappingURL=helpers.native.js.map\n"],"mappings":";;;AACA,SAAS,gBAAgB;CACvB,OAAO,WAAW,IAAI,QAAQ;AAChC;AACA,IAAI,sBAAsB,IAAI,IAAI;AAClC,IAAI,cAAc;AAClB,IAAI,kBAAkB,WAAW;CAC/B,IAAI,aAAa;CACjB,cAAc;CACd,WAAW,iBAAiB,UAAU,SAAS,OAAO;EACpD,IAAI,EAAE,WAAW;EACjB,IAAI,QAAQ,SAAS,IAAI;GACvB,OAAO,GAAG,MAAM;EAClB,CAAC;CACH,CAAC;AACH;AACA,SAAS,UAAU,IAAI;CACrB,gBAAgB;CAChB,IAAI,IAAI,EAAE;CACV,OAAO,WAAW;EAChB,OAAO,IAAI,OAAO,EAAE;CACtB;AACF"}
package/dist/esm/index.js CHANGED
@@ -1,12 +1,11 @@
1
1
  import React from "react";
2
2
  import { isWeb } from "@tamagui/constants";
3
3
  import { getWindowSize, subscribe } from "./helpers.mjs";
4
- import { initialValue } from "./initialValue.mjs";
5
- import { configureInitialWindowDimensions } from "./initialValue.mjs";
6
- function useWindowDimensions({
7
- serverValue = initialValue
8
- } = {}) {
9
- return React.useSyncExternalStore(subscribe, getWindowSize, () => isWeb ? serverValue : getWindowSize());
4
+ import { configureInitialWindowDimensions, initialValue } from "./initialValue.mjs";
5
+
6
+ function useWindowDimensions({ serverValue = initialValue } = {}) {
7
+ return React.useSyncExternalStore(subscribe, getWindowSize, () => isWeb ? serverValue : getWindowSize());
10
8
  }
9
+
11
10
  export { configureInitialWindowDimensions, useWindowDimensions };
12
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","isWeb","getWindowSize","subscribe","initialValue","configureInitialWindowDimensions","useWindowDimensions","serverValue","useSyncExternalStore"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAClB,SAASC,KAAA,QAAa;AAEtB,SAASC,aAAA,EAAeC,SAAA,QAAiB;AAEzC,SAASC,YAAA,QAAoB;AAE7B,SAASC,gCAAA,QAAwC;AAE1C,SAASC,oBAAoB;EAClCC,WAAA,GAAcH;AAChB,IAAkC,CAAC,GAAe;EAChD,OAAOJ,KAAA,CAAMQ,oBAAA,CAAqBL,SAAA,EAAWD,aAAA,EAAe,MAC1DD,KAAA,GAAQM,WAAA,GAAcL,aAAA,CAAc,CACtC;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import React from \"react\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { getWindowSize, subscribe } from \"./helpers\";\nimport { initialValue } from \"./initialValue\";\nimport { configureInitialWindowDimensions } from \"./initialValue\";\nfunction useWindowDimensions({\n serverValue = initialValue\n} = {}) {\n return React.useSyncExternalStore(\n subscribe,\n getWindowSize,\n () => isWeb ? serverValue : getWindowSize()\n );\n}\nexport {\n configureInitialWindowDimensions,\n useWindowDimensions\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;;AAKA,SAAS,oBAAoB,EAC3B,cAAc,iBACZ,CAAC,GAAG;CACN,OAAO,MAAM,qBACX,WACA,qBACM,QAAQ,cAAc,cAAc,CAC5C;AACF"}
@@ -1,12 +1,11 @@
1
1
  import React from "react";
2
2
  import { isWeb } from "@tamagui/constants";
3
3
  import { getWindowSize, subscribe } from "./helpers.mjs";
4
- import { initialValue } from "./initialValue.mjs";
5
- import { configureInitialWindowDimensions } from "./initialValue.mjs";
6
- function useWindowDimensions({
7
- serverValue = initialValue
8
- } = {}) {
9
- return React.useSyncExternalStore(subscribe, getWindowSize, () => isWeb ? serverValue : getWindowSize());
4
+ import { configureInitialWindowDimensions, initialValue } from "./initialValue.mjs";
5
+
6
+ function useWindowDimensions({ serverValue = initialValue } = {}) {
7
+ return React.useSyncExternalStore(subscribe, getWindowSize, () => isWeb ? serverValue : getWindowSize());
10
8
  }
9
+
11
10
  export { configureInitialWindowDimensions, useWindowDimensions };
12
11
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","isWeb","getWindowSize","subscribe","initialValue","configureInitialWindowDimensions","useWindowDimensions","serverValue","useSyncExternalStore"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAClB,SAASC,KAAA,QAAa;AAEtB,SAASC,aAAA,EAAeC,SAAA,QAAiB;AAEzC,SAASC,YAAA,QAAoB;AAE7B,SAASC,gCAAA,QAAwC;AAE1C,SAASC,oBAAoB;EAClCC,WAAA,GAAcH;AAChB,IAAkC,CAAC,GAAe;EAChD,OAAOJ,KAAA,CAAMQ,oBAAA,CAAqBL,SAAA,EAAWD,aAAA,EAAe,MAC1DD,KAAA,GAAQM,WAAA,GAAcL,aAAA,CAAc,CACtC;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import React from \"react\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { getWindowSize, subscribe } from \"./helpers\";\nimport { initialValue } from \"./initialValue\";\nimport { configureInitialWindowDimensions } from \"./initialValue\";\nfunction useWindowDimensions({\n serverValue = initialValue\n} = {}) {\n return React.useSyncExternalStore(\n subscribe,\n getWindowSize,\n () => isWeb ? serverValue : getWindowSize()\n );\n}\nexport {\n configureInitialWindowDimensions,\n useWindowDimensions\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;;AAKA,SAAS,oBAAoB,EAC3B,cAAc,iBACZ,CAAC,GAAG;CACN,OAAO,MAAM,qBACX,WACA,qBACM,QAAQ,cAAc,cAAc,CAC5C;AACF"}
@@ -1,15 +1,14 @@
1
1
  import React from "react";
2
2
  import { isWeb } from "@tamagui/constants";
3
3
  import { getWindowSize, subscribe } from "./helpers.native.js";
4
- import { initialValue } from "./initialValue.native.js";
5
- import { configureInitialWindowDimensions } from "./initialValue.native.js";
4
+ import { configureInitialWindowDimensions, initialValue } from "./initialValue.native.js";
5
+
6
6
  function useWindowDimensions() {
7
- var {
8
- serverValue = initialValue
9
- } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
10
- return React.useSyncExternalStore(subscribe, getWindowSize, function () {
11
- return isWeb ? serverValue : getWindowSize();
12
- });
7
+ var { serverValue = initialValue } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8
+ return React.useSyncExternalStore(subscribe, getWindowSize, function() {
9
+ return isWeb ? serverValue : getWindowSize();
10
+ });
13
11
  }
12
+
14
13
  export { configureInitialWindowDimensions, useWindowDimensions };
15
14
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","isWeb","getWindowSize","subscribe","initialValue","configureInitialWindowDimensions","useWindowDimensions","serverValue","arguments","length","useSyncExternalStore"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAClB,SAASC,KAAA,QAAa;AAEtB,SAASC,aAAA,EAAeC,SAAA,QAAiB;AAEzC,SAASC,YAAA,QAAoB;AAE7B,SAASC,gCAAA,QAAwC;AAE1C,SAASC,oBAAA,EAAoB;EAClC;IAAAC,WAAc,GAAAH;EAAA,IAAAI,SAAA,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;EAChB,OAAkDR,KAAA,CAAAU,oBAAA,CAAAP,SAAA,EAAAD,aAAA;IAChD,OAAOD,KAAM,GAAAM,WAAA,GAAAL,aAAA;EAAA,EAAqB;AAAA;AAAW,SAE7CG,gCAAA,EACFC,mBAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["esm/index.native.js"],"sourcesContent":["import React from \"react\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { getWindowSize, subscribe } from \"./helpers\";\nimport { initialValue } from \"./initialValue\";\nimport { configureInitialWindowDimensions } from \"./initialValue\";\nfunction useWindowDimensions() {\n var { serverValue = initialValue } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};\n return React.useSyncExternalStore(subscribe, getWindowSize, function() {\n return isWeb ? serverValue : getWindowSize();\n });\n}\nexport {\n configureInitialWindowDimensions,\n useWindowDimensions\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;;AAKA,SAAS,sBAAsB;CAC7B,IAAI,EAAE,cAAc,iBAAiB,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK,CAAC;CACvG,OAAO,MAAM,qBAAqB,WAAW,eAAe,WAAW;EACrE,OAAO,QAAQ,cAAc,cAAc;CAC7C,CAAC;AACH"}
@@ -1,11 +1,12 @@
1
1
  const initialValue = {
2
- width: 800,
3
- height: 600,
4
- scale: 1,
5
- fontScale: 1
2
+ width: 800,
3
+ height: 600,
4
+ scale: 1,
5
+ fontScale: 1
6
6
  };
7
7
  function configureInitialWindowDimensions(next) {
8
- Object.assign(initialValue, next);
8
+ Object.assign(initialValue, next);
9
9
  }
10
+
10
11
  export { configureInitialWindowDimensions, initialValue };
11
12
  //# sourceMappingURL=initialValue.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["initialValue","width","height","scale","fontScale","configureInitialWindowDimensions","next","Object","assign"],"sources":["../../src/initialValue.ts"],"sourcesContent":[null],"mappings":"AAKO,MAAMA,YAAA,GAA2B;EACtCC,KAAA,EAAO;EACPC,MAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,SAAA,EAAW;AACb;AAEO,SAASC,iCAAiCC,IAAA,EAAwB;EACvEC,MAAA,CAAOC,MAAA,CAAOR,YAAA,EAAcM,IAAI;AAClC","ignoreList":[]}
1
+ {"version":3,"file":"initialValue.js","names":[],"sources":["esm/initialValue.js"],"sourcesContent":["const initialValue = {\n width: 800,\n height: 600,\n scale: 1,\n fontScale: 1\n};\nfunction configureInitialWindowDimensions(next) {\n Object.assign(initialValue, next);\n}\nexport {\n configureInitialWindowDimensions,\n initialValue\n};\n//# sourceMappingURL=initialValue.js.map\n"],"mappings":";AAAA,MAAM,eAAe;CACnB,OAAO;CACP,QAAQ;CACR,OAAO;CACP,WAAW;AACb;AACA,SAAS,iCAAiC,MAAM;CAC9C,OAAO,OAAO,cAAc,IAAI;AAClC"}
@@ -1,11 +1,12 @@
1
1
  var initialValue = {
2
- width: 800,
3
- height: 600,
4
- scale: 1,
5
- fontScale: 1
2
+ width: 800,
3
+ height: 600,
4
+ scale: 1,
5
+ fontScale: 1
6
6
  };
7
7
  function configureInitialWindowDimensions(next) {
8
- Object.assign(initialValue, next);
8
+ Object.assign(initialValue, next);
9
9
  }
10
+
10
11
  export { configureInitialWindowDimensions, initialValue };
11
12
  //# sourceMappingURL=initialValue.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["initialValue","width","height","scale","fontScale","configureInitialWindowDimensions","next","Object","assign"],"sources":["../../src/initialValue.ts"],"sourcesContent":[null],"mappings":"AAKO,IAAAA,YAAM;EACXC,KAAA,EAAO;EACPC,MAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,SAAA,EAAW;AACb;AAEO,SAASC,iCAAiCC,IAAA,EAAwB;EACvEC,MAAA,CAAOC,MAAA,CAAOR,YAAA,EAAcM,IAAI;AAClC","ignoreList":[]}
1
+ {"version":3,"file":"initialValue.native.js","names":[],"sources":["esm/initialValue.native.js"],"sourcesContent":["var initialValue = {\n width: 800,\n height: 600,\n scale: 1,\n fontScale: 1\n};\nfunction configureInitialWindowDimensions(next) {\n Object.assign(initialValue, next);\n}\nexport {\n configureInitialWindowDimensions,\n initialValue\n};\n//# sourceMappingURL=initialValue.js.map\n"],"mappings":";AAAA,IAAI,eAAe;CACjB,OAAO;CACP,QAAQ;CACR,OAAO;CACP,WAAW;AACb;AACA,SAAS,iCAAiC,MAAM;CAC9C,OAAO,OAAO,cAAc,IAAI;AAClC"}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=types.mjs.map
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=types.native.js.map
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@tamagui/use-window-dimensions",
3
- "version": "2.7.7",
3
+ "version": "3.0.0-beta.1093.1",
4
+ "license": "MIT",
4
5
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
6
  "files": [
6
7
  "src",
@@ -34,12 +35,13 @@
34
35
  "clean:build": "tamagui-build clean:build"
35
36
  },
36
37
  "dependencies": {
37
- "@tamagui/constants": "2.7.7"
38
+ "@tamagui/constants": "3.0.0-beta.1093.1",
39
+ "@tamagui/react-native-types": "3.0.0-beta.1093.1"
38
40
  },
39
41
  "devDependencies": {
40
- "@tamagui/build": "2.7.7",
41
- "react": ">=19",
42
- "react-native": "0.83.2"
42
+ "@tamagui/build": "3.0.0-beta.1093.1",
43
+ "react": "19.2.3",
44
+ "react-native": "0.86.2"
43
45
  },
44
46
  "peerDependencies": {
45
47
  "react": ">=19"
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ScaledSize } from 'react-native'
1
+ import type { ScaledSize } from '@tamagui/react-native-types'
2
2
 
3
3
  export type Size = {
4
4
  width: number
package/types/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ScaledSize } from "react-native";
1
+ import type { ScaledSize } from "@tamagui/react-native-types";
2
2
  export type Size = {
3
3
  width: number;
4
4
  height: number;
@@ -6,6 +6,6 @@
6
6
  ],
7
7
  "version": 3,
8
8
  "sourcesContent": [
9
- "import type { ScaledSize } from 'react-native'\n\nexport type Size = {\n width: number\n height: number\n}\n\nexport type WindowSize = ScaledSize\n\nexport type WindowSizeListener = (size: WindowSize) => void\n"
9
+ "import type { ScaledSize } from '@tamagui/react-native-types'\n\nexport type Size = {\n width: number\n height: number\n}\n\nexport type WindowSize = ScaledSize\n\nexport type WindowSizeListener = (size: WindowSize) => void\n"
10
10
  ]
11
11
  }
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}