@tamagui/use-window-dimensions 2.7.7 → 3.0.0-beta.637.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.
@@ -1,68 +1,68 @@
1
+
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
6
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
10
11
  };
11
12
  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;
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
19
20
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
22
  var helpers_exports = {};
24
23
  __export(helpers_exports, {
25
- getWindowSize: () => getWindowSize,
26
- subscribe: () => subscribe
24
+ getWindowSize: () => getWindowSize,
25
+ subscribe: () => subscribe
27
26
  });
28
27
  module.exports = __toCommonJS(helpers_exports);
29
28
  var import_constants = require("@tamagui/constants");
30
29
  let lastSize = require("./initialValue.cjs").initialValue;
31
30
  let docEl = null;
32
31
  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;
32
+ docEl ||= window.document.documentElement;
33
+ const nextSize = {
34
+ fontScale: 1,
35
+ height: docEl.clientHeight,
36
+ scale: window.devicePixelRatio || 1,
37
+ width: docEl.clientWidth
38
+ };
39
+ if (nextSize.height !== lastSize.height || nextSize.width !== lastSize.width || nextSize.scale !== lastSize.scale) {
40
+ lastSize = nextSize;
41
+ return nextSize;
42
+ }
43
+ return lastSize;
45
44
  }
46
- const cbs = /* @__PURE__ */new Set();
45
+ const cbs = /* @__PURE__ */ new Set();
47
46
  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);
47
+ let flushUpdate = function() {
48
+ lastUpdate = Date.now();
49
+ cbs.forEach((cb) => cb(getWindowSize()));
50
+ };
51
+ let lastUpdate = Date.now();
52
+ let tm;
53
+ const USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS;
54
+ const updateMaxMs = USER_MAX_MS ? +USER_MAX_MS : 100;
55
+ const onResize = () => {
56
+ clearTimeout(tm);
57
+ const timeSinceLast = Date.now() - lastUpdate;
58
+ if (timeSinceLast < updateMaxMs) tm = setTimeout(() => {
59
+ flushUpdate();
60
+ }, updateMaxMs - timeSinceLast);
61
+ else flushUpdate();
62
+ };
63
+ window.addEventListener("resize", onResize);
64
64
  }
65
65
  function subscribe(cb) {
66
- cbs.add(cb);
67
- return () => cbs.delete(cb);
68
- }
66
+ cbs.add(cb);
67
+ return () => cbs.delete(cb);
68
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var helpers_native_exports = {};
25
+ __export(helpers_native_exports, {
26
+ getWindowSize: () => getWindowSize,
27
+ subscribe: () => subscribe
28
+ });
29
+ module.exports = __toCommonJS(helpers_native_exports);
30
+ var import_react_native = require("react-native");
31
+ function getWindowSize() {
32
+ return import_react_native.Dimensions.get("window");
33
+ }
34
+ var cbs = /* @__PURE__ */ new Set();
35
+ var isListening = false;
36
+ var ensureListening = function() {
37
+ if (isListening) return;
38
+ isListening = true;
39
+ import_react_native.Dimensions.addEventListener("change", function(param) {
40
+ var { window } = param;
41
+ cbs.forEach(function(cb) {
42
+ return cb(window);
43
+ });
44
+ });
45
+ };
46
+ function subscribe(cb) {
47
+ ensureListening();
48
+ cbs.add(cb);
49
+ return function() {
50
+ return cbs.delete(cb);
51
+ };
52
+ }
@@ -1,56 +1,54 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
12
13
  };
13
14
  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;
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
21
22
  };
22
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
24
  var helpers_native_exports = {};
26
25
  __export(helpers_native_exports, {
27
- getWindowSize: () => getWindowSize,
28
- subscribe: () => subscribe
26
+ getWindowSize: () => getWindowSize,
27
+ subscribe: () => subscribe
29
28
  });
30
29
  module.exports = __toCommonJS(helpers_native_exports);
31
30
  var import_react_native = require("react-native");
32
31
  function getWindowSize() {
33
- return import_react_native.Dimensions.get("window");
32
+ return import_react_native.Dimensions.get("window");
34
33
  }
35
- var cbs = /* @__PURE__ */new Set();
34
+ var cbs = /* @__PURE__ */ new Set();
36
35
  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
- });
36
+ var ensureListening = function() {
37
+ if (isListening) return;
38
+ isListening = true;
39
+ import_react_native.Dimensions.addEventListener("change", function(param) {
40
+ var { window } = param;
41
+ cbs.forEach(function(cb) {
42
+ return cb(window);
43
+ });
44
+ });
48
45
  };
49
46
  function subscribe(cb) {
50
- ensureListening();
51
- cbs.add(cb);
52
- return function () {
53
- return cbs.delete(cb);
54
- };
47
+ ensureListening();
48
+ cbs.add(cb);
49
+ return function() {
50
+ return cbs.delete(cb);
51
+ };
55
52
  }
53
+
56
54
  //# 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"}
@@ -1,3 +1,4 @@
1
+
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -5,36 +6,29 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
6
  var __getProtoOf = Object.getPrototypeOf;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
12
13
  };
13
14
  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;
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
21
22
  };
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
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
30
26
  }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
28
  var index_exports = {};
35
29
  __export(index_exports, {
36
- configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,
37
- useWindowDimensions: () => useWindowDimensions
30
+ configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,
31
+ useWindowDimensions: () => useWindowDimensions
38
32
  });
39
33
  module.exports = __toCommonJS(index_exports);
40
34
  var import_react = __toESM(require("react"), 1);
@@ -42,8 +36,6 @@ var import_constants = require("@tamagui/constants");
42
36
  var import_helpers = require("./helpers.cjs");
43
37
  var import_initialValue = require("./initialValue.cjs");
44
38
  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
- }
39
+ function useWindowDimensions({ serverValue = import_initialValue.initialValue } = {}) {
40
+ return import_react.default.useSyncExternalStore(import_helpers.subscribe, import_helpers.getWindowSize, () => import_constants.isWeb ? serverValue : (0, import_helpers.getWindowSize)());
41
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
28
+ }) : target, mod));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
+ configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,
33
+ useWindowDimensions: () => useWindowDimensions
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+ var import_react = __toESM(require("react"), 1);
37
+ var import_constants = require("@tamagui/constants");
38
+ var import_helpers = require("./helpers.native.js");
39
+ var import_initialValue = require("./initialValue.native.js");
40
+ var import_initialValue2 = require("./initialValue.native.js");
41
+ function useWindowDimensions() {
42
+ var { serverValue = import_initialValue.initialValue } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
43
+ return import_react.default.useSyncExternalStore(import_helpers.subscribe, import_helpers.getWindowSize, function() {
44
+ return import_constants.isWeb ? serverValue : (0, import_helpers.getWindowSize)();
45
+ });
46
+ }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,36 +8,29 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
8
  var __getProtoOf = Object.getPrototypeOf;
8
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
10
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
14
15
  };
15
16
  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;
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
23
24
  };
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
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
32
28
  }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
30
  var index_exports = {};
37
31
  __export(index_exports, {
38
- configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,
39
- useWindowDimensions: () => useWindowDimensions
32
+ configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,
33
+ useWindowDimensions: () => useWindowDimensions
40
34
  });
41
35
  module.exports = __toCommonJS(index_exports);
42
36
  var import_react = __toESM(require("react"), 1);
@@ -45,11 +39,10 @@ var import_helpers = require("./helpers.native.js");
45
39
  var import_initialValue = require("./initialValue.native.js");
46
40
  var import_initialValue2 = require("./initialValue.native.js");
47
41
  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
- });
42
+ var { serverValue = import_initialValue.initialValue } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
43
+ return import_react.default.useSyncExternalStore(import_helpers.subscribe, import_helpers.getWindowSize, function() {
44
+ return import_constants.isWeb ? serverValue : (0, import_helpers.getWindowSize)();
45
+ });
54
46
  }
47
+
55
48
  //# 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,eAAe;CAClF,CAAC;AACH"}
@@ -1,37 +1,36 @@
1
+
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
6
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
10
11
  };
11
12
  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;
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
19
20
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
22
  var initialValue_exports = {};
24
23
  __export(initialValue_exports, {
25
- configureInitialWindowDimensions: () => configureInitialWindowDimensions,
26
- initialValue: () => initialValue
24
+ configureInitialWindowDimensions: () => configureInitialWindowDimensions,
25
+ initialValue: () => initialValue
27
26
  });
28
27
  module.exports = __toCommonJS(initialValue_exports);
29
28
  const initialValue = {
30
- width: 800,
31
- height: 600,
32
- scale: 1,
33
- fontScale: 1
29
+ width: 800,
30
+ height: 600,
31
+ scale: 1,
32
+ fontScale: 1
34
33
  };
35
34
  function configureInitialWindowDimensions(next) {
36
- Object.assign(initialValue, next);
37
- }
35
+ Object.assign(initialValue, next);
36
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var initialValue_exports = {};
25
+ __export(initialValue_exports, {
26
+ configureInitialWindowDimensions: () => configureInitialWindowDimensions,
27
+ initialValue: () => initialValue
28
+ });
29
+ module.exports = __toCommonJS(initialValue_exports);
30
+ var initialValue = {
31
+ width: 800,
32
+ height: 600,
33
+ scale: 1,
34
+ fontScale: 1
35
+ };
36
+ function configureInitialWindowDimensions(next) {
37
+ Object.assign(initialValue, next);
38
+ }
@@ -1,40 +1,40 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
12
13
  };
13
14
  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;
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
21
22
  };
22
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
24
  var initialValue_exports = {};
26
25
  __export(initialValue_exports, {
27
- configureInitialWindowDimensions: () => configureInitialWindowDimensions,
28
- initialValue: () => initialValue
26
+ configureInitialWindowDimensions: () => configureInitialWindowDimensions,
27
+ initialValue: () => initialValue
29
28
  });
30
29
  module.exports = __toCommonJS(initialValue_exports);
31
30
  var initialValue = {
32
- width: 800,
33
- height: 600,
34
- scale: 1,
35
- fontScale: 1
31
+ width: 800,
32
+ height: 600,
33
+ scale: 1,
34
+ fontScale: 1
36
35
  };
37
36
  function configureInitialWindowDimensions(next) {
38
- Object.assign(initialValue, next);
37
+ Object.assign(initialValue, next);
39
38
  }
39
+
40
40
  //# 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"}
@@ -1,18 +1,17 @@
1
+
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
6
  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;
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ }
13
+ return to;
13
14
  };
14
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
- value: true
16
- }), mod);
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
17
16
  var types_exports = {};
18
- module.exports = __toCommonJS(types_exports);
17
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var types_exports = {};
19
+ module.exports = __toCommonJS(types_exports);
@@ -1,21 +1,21 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  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;
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
15
16
  };
16
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
17
- value: true
18
- }), mod);
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
18
  var types_exports = {};
20
19
  module.exports = __toCommonJS(types_exports);
20
+
21
21
  //# 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,6 @@
1
1
  {
2
2
  "name": "@tamagui/use-window-dimensions",
3
- "version": "2.7.7",
3
+ "version": "3.0.0-beta.637.1",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "files": [
6
6
  "src",
@@ -34,12 +34,12 @@
34
34
  "clean:build": "tamagui-build clean:build"
35
35
  },
36
36
  "dependencies": {
37
- "@tamagui/constants": "2.7.7"
37
+ "@tamagui/constants": "3.0.0-beta.637.1"
38
38
  },
39
39
  "devDependencies": {
40
- "@tamagui/build": "2.7.7",
40
+ "@tamagui/build": "3.0.0-beta.637.1",
41
41
  "react": ">=19",
42
- "react-native": "0.83.2"
42
+ "react-native": "0.86.2"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": ">=19"
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}