@tamagui/use-window-dimensions 2.0.0-rc.8 → 2.0.0

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 (39) hide show
  1. package/dist/cjs/helpers.cjs +37 -30
  2. package/dist/cjs/helpers.native.js +14 -11
  3. package/dist/cjs/helpers.native.js.map +1 -1
  4. package/dist/cjs/index.cjs +29 -27
  5. package/dist/cjs/index.native.js +29 -27
  6. package/dist/cjs/index.native.js.map +1 -1
  7. package/dist/cjs/initialValue.cjs +12 -10
  8. package/dist/cjs/initialValue.native.js +12 -10
  9. package/dist/cjs/initialValue.native.js.map +1 -1
  10. package/dist/cjs/types.cjs +7 -5
  11. package/dist/cjs/types.native.js +7 -5
  12. package/dist/cjs/types.native.js.map +1 -1
  13. package/dist/esm/helpers.mjs +24 -18
  14. package/dist/esm/helpers.mjs.map +1 -1
  15. package/dist/esm/helpers.native.js +2 -1
  16. package/dist/esm/helpers.native.js.map +1 -1
  17. package/dist/esm/index.js +5 -12
  18. package/dist/esm/index.js.map +1 -6
  19. package/package.json +8 -12
  20. package/src/helpers.ts +6 -1
  21. package/types/helpers.d.ts.map +4 -4
  22. package/types/helpers.native.d.ts.map +2 -2
  23. package/types/index.d.ts.map +2 -2
  24. package/types/initialValue.d.ts.map +4 -6
  25. package/types/types.d.ts.map +2 -2
  26. package/dist/cjs/helpers.js +0 -50
  27. package/dist/cjs/helpers.js.map +0 -6
  28. package/dist/cjs/index.js +0 -39
  29. package/dist/cjs/index.js.map +0 -6
  30. package/dist/cjs/initialValue.js +0 -30
  31. package/dist/cjs/initialValue.js.map +0 -6
  32. package/dist/cjs/types.js +0 -14
  33. package/dist/cjs/types.js.map +0 -6
  34. package/dist/esm/helpers.js +0 -35
  35. package/dist/esm/helpers.js.map +0 -6
  36. package/dist/esm/initialValue.js +0 -14
  37. package/dist/esm/initialValue.js.map +0 -6
  38. package/dist/esm/types.js +0 -1
  39. package/dist/esm/types.js.map +0 -6
@@ -3,20 +3,22 @@ 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: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
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, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var helpers_exports = {};
22
24
  __export(helpers_exports, {
@@ -24,10 +26,9 @@ __export(helpers_exports, {
24
26
  subscribe: () => subscribe
25
27
  });
26
28
  module.exports = __toCommonJS(helpers_exports);
27
- var import_constants = require("@tamagui/constants"),
28
- import_initialValue = require("./initialValue.cjs");
29
- let lastSize = import_initialValue.initialValue,
30
- docEl = null;
29
+ var import_constants = require("@tamagui/constants");
30
+ let lastSize = require("./initialValue.cjs").initialValue;
31
+ let docEl = null;
31
32
  function getWindowSize() {
32
33
  docEl ||= window.document.documentElement;
33
34
  const nextSize = {
@@ -36,26 +37,32 @@ function getWindowSize() {
36
37
  scale: window.devicePixelRatio || 1,
37
38
  width: docEl.clientWidth
38
39
  };
39
- return nextSize.height !== lastSize.height || nextSize.width !== lastSize.width || nextSize.scale !== lastSize.scale ? (lastSize = nextSize, nextSize) : lastSize;
40
+ if (nextSize.height !== lastSize.height || nextSize.width !== lastSize.width || nextSize.scale !== lastSize.scale) {
41
+ lastSize = nextSize;
42
+ return nextSize;
43
+ }
44
+ return lastSize;
40
45
  }
41
46
  const cbs = /* @__PURE__ */new Set();
42
- if (import_constants.isClient) {
47
+ if (import_constants.isClient && typeof window !== "undefined" && typeof window.addEventListener === "function") {
43
48
  let flushUpdate = function () {
44
- lastUpdate = Date.now(), cbs.forEach(cb => cb(getWindowSize()));
45
- },
46
- lastUpdate = Date.now(),
47
- tm;
48
- const USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS,
49
- updateMaxMs = USER_MAX_MS ? +USER_MAX_MS : 100,
50
- onResize = () => {
51
- clearTimeout(tm);
52
- const timeSinceLast = Date.now() - lastUpdate;
53
- timeSinceLast < updateMaxMs ? tm = setTimeout(() => {
54
- flushUpdate();
55
- }, updateMaxMs - timeSinceLast) : flushUpdate();
56
- };
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
+ };
57
63
  window.addEventListener("resize", onResize);
58
64
  }
59
65
  function subscribe(cb) {
60
- return cbs.add(cb), () => cbs.delete(cb);
66
+ cbs.add(cb);
67
+ return () => cbs.delete(cb);
61
68
  }
@@ -5,20 +5,22 @@ 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: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
23
+ value: true
22
24
  }), mod);
23
25
  var helpers_native_exports = {};
24
26
  __export(helpers_native_exports, {
@@ -40,7 +42,8 @@ import_react_native.Dimensions.addEventListener("change", function (param) {
40
42
  });
41
43
  });
42
44
  function subscribe(cb) {
43
- return cbs.add(cb), function () {
45
+ cbs.add(cb);
46
+ return function () {
44
47
  return cbs.delete(cb);
45
48
  };
46
49
  }
@@ -1 +1 @@
1
- {"version":3,"names":["helpers_native_exports","__export","getWindowSize","subscribe","module","exports","__toCommonJS","import_react_native","require","Dimensions","get","cbs","Set","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;AAClBL,mBAAA,CAAAE,UAAA,CAAWI,gBAAA,CAAiB,UAAU,UAASC,KAAA,EAAO;EAClD,IAAI;IAAEC;EAAO,IAAID,KAAA;EACjBH,GAAA,CAAIK,OAAA,CAAQ,UAASC,EAAA,EAAI;IACrB,OAAOA,EAAA,CAAGF,MAAM;EACpB,CAAC;AACL,CAAC;AACM,SAASZ,UAAUc,EAAA,EAAI;EAC1B,OAAAN,GAAA,CAAIO,GAAA,CAAID,EAAE,GACH,YAAW;IACd,OAAON,GAAA,CAAIQ,MAAA,CAAOF,EAAE;EACxB;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["helpers_native_exports","__export","getWindowSize","subscribe","module","exports","__toCommonJS","import_react_native","require","Dimensions","get","cbs","Set","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;AAClBL,mBAAA,CAAAE,UAAA,CAAWI,gBAAA,CAAiB,UAAU,UAASC,KAAA,EAAO;EAClD,IAAI;IAAEC;EAAO,IAAID,KAAA;EACjBH,GAAA,CAAIK,OAAA,CAAQ,UAASC,EAAA,EAAI;IACrB,OAAOA,EAAA,CAAGF,MAAM;EACpB,CAAC;AACL,CAAC;AACM,SAASZ,UAAUc,EAAA,EAAI;EAC1BN,GAAA,CAAIO,GAAA,CAAID,EAAE;EACV,OAAO,YAAW;IACd,OAAON,GAAA,CAAIQ,MAAA,CAAOF,EAAE;EACxB;AACJ","ignoreList":[]}
@@ -2,44 +2,46 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
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: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
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
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var index_exports = {};
33
35
  __export(index_exports, {
34
36
  configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,
35
37
  useWindowDimensions: () => useWindowDimensions
36
38
  });
37
39
  module.exports = __toCommonJS(index_exports);
38
- var import_react = __toESM(require("react"), 1),
39
- import_constants = require("@tamagui/constants"),
40
- import_helpers = require("./helpers.cjs"),
41
- import_initialValue = require("./initialValue.cjs"),
42
- import_initialValue2 = require("./initialValue.cjs");
40
+ var import_react = __toESM(require("react"), 1);
41
+ var import_constants = require("@tamagui/constants");
42
+ var import_helpers = require("./helpers.cjs");
43
+ var import_initialValue = require("./initialValue.cjs");
44
+ var import_initialValue2 = require("./initialValue.cjs");
43
45
  function useWindowDimensions({
44
46
  serverValue = import_initialValue.initialValue
45
47
  } = {}) {
@@ -4,44 +4,46 @@ var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf,
8
- __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf;
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: !0
13
- });
14
- },
15
- __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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, {
17
18
  get: () => from[key],
18
19
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
20
  });
20
- return to;
21
- };
21
+ }
22
+ return to;
23
+ };
22
24
  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: !0
30
- }) : target, mod)),
31
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: !0
33
- }), mod);
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
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
34
36
  var index_exports = {};
35
37
  __export(index_exports, {
36
38
  configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,
37
39
  useWindowDimensions: () => useWindowDimensions
38
40
  });
39
41
  module.exports = __toCommonJS(index_exports);
40
- var import_react = __toESM(require("react"), 1),
41
- import_constants = require("@tamagui/constants"),
42
- import_helpers = require("./helpers.native.js"),
43
- import_initialValue = require("./initialValue.native.js"),
44
- import_initialValue2 = require("./initialValue.native.js");
42
+ var import_react = __toESM(require("react"), 1);
43
+ var import_constants = require("@tamagui/constants");
44
+ var import_helpers = require("./helpers.native.js");
45
+ var import_initialValue = require("./initialValue.native.js");
46
+ var import_initialValue2 = require("./initialValue.native.js");
45
47
  function useWindowDimensions() {
46
48
  var {
47
49
  serverValue = import_initialValue.initialValue
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,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;AASX,IAAAO,YAAS,GAAAC,OAAA,CAAAC,OAAoB;EAAAC,gBAAA,GAAAD,OAAA;EAAAE,cAAA,GAAAF,OAAA;EAAAG,mBAAA,GAAAH,OAAA;EAAAN,oBAAA,GAAAM,OAAA;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,"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":[]}
@@ -3,20 +3,22 @@ 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: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
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, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var initialValue_exports = {};
22
24
  __export(initialValue_exports, {
@@ -5,20 +5,22 @@ 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: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
23
+ value: true
22
24
  }), mod);
23
25
  var initialValue_exports = {};
24
26
  __export(initialValue_exports, {
@@ -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,"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":[]}
@@ -3,14 +3,16 @@ 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") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
- get: () => from[key],
8
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
- });
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
+ }
10
12
  return to;
11
13
  };
12
14
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
13
- value: !0
15
+ value: true
14
16
  }), mod);
15
17
  var types_exports = {};
16
18
  module.exports = __toCommonJS(types_exports);
@@ -5,14 +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") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
- get: () => from[key],
10
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
- });
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
+ }
12
14
  return to;
13
15
  };
14
16
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
- value: !0
17
+ value: true
16
18
  }), mod);
17
19
  var types_exports = {};
18
20
  module.exports = __toCommonJS(types_exports);
@@ -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,"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,7 +1,7 @@
1
1
  import { isClient } from "@tamagui/constants";
2
2
  import { initialValue } from "./initialValue.mjs";
3
- let lastSize = initialValue,
4
- docEl = null;
3
+ let lastSize = initialValue;
4
+ let docEl = null;
5
5
  function getWindowSize() {
6
6
  docEl ||= window.document.documentElement;
7
7
  const nextSize = {
@@ -10,28 +10,34 @@ function getWindowSize() {
10
10
  scale: window.devicePixelRatio || 1,
11
11
  width: docEl.clientWidth
12
12
  };
13
- return nextSize.height !== lastSize.height || nextSize.width !== lastSize.width || nextSize.scale !== lastSize.scale ? (lastSize = nextSize, nextSize) : lastSize;
13
+ if (nextSize.height !== lastSize.height || nextSize.width !== lastSize.width || nextSize.scale !== lastSize.scale) {
14
+ lastSize = nextSize;
15
+ return nextSize;
16
+ }
17
+ return lastSize;
14
18
  }
15
19
  const cbs = /* @__PURE__ */new Set();
16
- if (isClient) {
20
+ if (isClient && typeof window !== "undefined" && typeof window.addEventListener === "function") {
17
21
  let flushUpdate = function () {
18
- lastUpdate = Date.now(), cbs.forEach(cb => cb(getWindowSize()));
19
- },
20
- lastUpdate = Date.now(),
21
- tm;
22
- const USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS,
23
- updateMaxMs = USER_MAX_MS ? +USER_MAX_MS : 100,
24
- onResize = () => {
25
- clearTimeout(tm);
26
- const timeSinceLast = Date.now() - lastUpdate;
27
- timeSinceLast < updateMaxMs ? tm = setTimeout(() => {
28
- flushUpdate();
29
- }, updateMaxMs - timeSinceLast) : flushUpdate();
30
- };
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
+ };
31
36
  window.addEventListener("resize", onResize);
32
37
  }
33
38
  function subscribe(cb) {
34
- return cbs.add(cb), () => cbs.delete(cb);
39
+ cbs.add(cb);
40
+ return () => cbs.delete(cb);
35
41
  }
36
42
  export { getWindowSize, subscribe };
37
43
  //# 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","flushUpdate","lastUpdate","Date","now","forEach","cb","tm","USER_MAX_MS","process","env","TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS","updateMaxMs","onResize","clearTimeout","timeSinceLast","setTimeout","addEventListener","subscribe","add","delete"],"sources":["../../src/helpers.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,QAAA,QAAgB;AACzB,SAASC,YAAA,QAAoB;AAG7B,IAAIC,QAAA,GAAuBD,YAAA;EACvBE,KAAA,GAA4B;AAEzB,SAASC,cAAA,EAA4B;EAK1CD,KAAA,KAAUE,MAAA,CAAOC,QAAA,CAASC,eAAA;EAE1B,MAAMC,QAAA,GAAuB;IAC3BC,SAAA,EAAW;IACXC,MAAA,EAAQP,KAAA,CAAMQ,YAAA;IACdC,KAAA,EAAOP,MAAA,CAAOQ,gBAAA,IAAoB;IAClCC,KAAA,EAAOX,KAAA,CAAMY;EACf;EAEA,OACEP,QAAA,CAASE,MAAA,KAAWR,QAAA,CAASQ,MAAA,IAC7BF,QAAA,CAASM,KAAA,KAAUZ,QAAA,CAASY,KAAA,IAC5BN,QAAA,CAASI,KAAA,KAAUV,QAAA,CAASU,KAAA,IAE5BV,QAAA,GAAWM,QAAA,EACJA,QAAA,IAGFN,QAAA;AACT;AAEA,MAAMc,GAAA,GAAM,mBAAIC,GAAA,CAAwB;AAGxC,IAAIjB,QAAA,EAAU;EAMZ,IAASkB,WAAA,GAAT,SAAAA,CAAA,EAAuB;MACrBC,UAAA,GAAaC,IAAA,CAAKC,GAAA,CAAI,GACtBL,GAAA,CAAIM,OAAA,CAASC,EAAA,IAAOA,EAAA,CAAGnB,aAAA,CAAc,CAAC,CAAC;IACzC;IARIe,UAAA,GAAaC,IAAA,CAAKC,GAAA,CAAI;IACtBG,EAAA;EACJ,MAAMC,WAAA,GAAcC,OAAA,CAAQC,GAAA,CAAIC,2CAAA;IAC1BC,WAAA,GAAcJ,WAAA,GAAc,CAACA,WAAA,GAAc;IAO3CK,QAAA,GAAWA,CAAA,KAAM;MACrBC,YAAA,CAAaP,EAAE;MAGf,MAAMQ,aAAA,GAAgBZ,IAAA,CAAKC,GAAA,CAAI,IAAIF,UAAA;MAC/Ba,aAAA,GAAgBH,WAAA,GAClBL,EAAA,GAAKS,UAAA,CAAW,MAAM;QACpBf,WAAA,CAAY;MACd,GAAGW,WAAA,GAAcG,aAAa,IAE9Bd,WAAA,CAAY;IAEhB;EAEAb,MAAA,CAAO6B,gBAAA,CAAiB,UAAUJ,QAAQ;AAC5C;AAEO,SAASK,UAAUZ,EAAA,EAAoC;EAC5D,OAAAP,GAAA,CAAIoB,GAAA,CAAIb,EAAE,GACH,MAAMP,GAAA,CAAIqB,MAAA,CAAOd,EAAE;AAC5B","ignoreList":[]}
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":["../../src/helpers.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,QAAA,QAAgB;AACzB,SAASC,YAAA,QAAoB;AAG7B,IAAIC,QAAA,GAAuBD,YAAA;AAC3B,IAAIE,KAAA,GAA4B;AAEzB,SAASC,cAAA,EAA4B;EAC1CD,KAAI,KAAAE,MAAQ,CAAIC,QAAA,CAAAC,eAAmB;EACjC,MAAAC,QAAO;IACTC,SAAA;IAEAC,MAAA,EAAAP,KAAU,CAAAQ,YAAgB;IAE1BC,KAAA,EAAMP,MAAA,CAAAQ,gBAAuB;IAAAC,KAC3B,EAAAX,KAAA,CAAWY;EAAA;EACG,IACdP,QAAO,CAAAE,MAAO,KAAAR,QAAA,CAAAQ,MAAoB,IAAAF,QAAA,CAAAM,KAAA,KAAAZ,QAAA,CAAAY,KAAA,IAAAN,QAAA,CAAAI,KAAA,KAAAV,QAAA,CAAAU,KAAA;IAAAV,QAClC,GAAOM,QAAM;IACf,OAAAA,QAAA;EAEA;EAKE,OAAAN,QAAW;AACX;AAAO,MACTc,GAAA,sBAAAC,GAAA;AAEA,IAAAjB,QAAO,WAAAK,MAAA,2BAAAA,MAAA,CAAAa,gBAAA;EACT,IAAAC,WAAA,YAAAA,CAAA;IAEAC,UAAY,GAAAC,IAAA,CAAAC,GAAA;IAIZN,GACE,CAAAO,OAAA,CAAAC,EACA,IAAAA,EAAO,CAAApB,aAAW;EAQlB;EACE,IAAAgB,UAAA,GAAaC,IAAK,CAAAC,GAAI;EACtB,IAAAG,EAAA;EAAuC,MACzCC,WAAA,GAAAC,OAAA,CAAAC,GAAA,CAAAC,2CAAA;EARA,MAAIC,WAAA,GAAaJ,WAAS,IAAAA,WAAA;EAC1B,MAAIK,QAAA,GAAAA,CAAA;IACJC,YAAM,CAAAP,EAAA;IACN,MAAMQ,aAAA,GAAcZ,IAAA,CAAAC,GAAA,KAAeF,UAAA;IAOnC,IAAAa,aAAiB,GAAAH,WAAM,EAAAL,EAAA,GAAAS,UAAA;MACrBf,WAAA;IAGA,GAAAW,WAAM,GAAAG,aAAqB,OAC3Bd,WAAI;EACF;EACEd,MAAA,CAAAa,gBAAY,WAAAa,QAAA;AAAA;AACgB,SAChCI,SAAOA,CAAAX,EAAA;EACLR,GAAA,CAAAoB,GAAA,CAAAZ,EAAA;EAAY,OACd,MAAAR,GAAA,CAAAqB,MAAA,CAAAb,EAAA;AAAA;AAGF,SAAOpB,aAAA,EAAA+B,SAAiB","ignoreList":[]}
@@ -12,7 +12,8 @@ Dimensions.addEventListener("change", function (param) {
12
12
  });
13
13
  });
14
14
  function subscribe(cb) {
15
- return cbs.add(cb), function () {
15
+ cbs.add(cb);
16
+ return function () {
16
17
  return cbs.delete(cb);
17
18
  };
18
19
  }
@@ -1 +1 @@
1
- {"version":3,"names":["Dimensions","getWindowSize","get","cbs","Set","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;AAClBJ,UAAA,CAAWK,gBAAA,CAAiB,UAAU,UAASC,KAAA,EAAO;EAClD,IAAI;IAAEC;EAAO,IAAID,KAAA;EACjBH,GAAA,CAAIK,OAAA,CAAQ,UAASC,EAAA,EAAI;IACrB,OAAOA,EAAA,CAAGF,MAAM;EACpB,CAAC;AACL,CAAC;AACM,SAASG,UAAUD,EAAA,EAAI;EAC1B,OAAAN,GAAA,CAAIQ,GAAA,CAAIF,EAAE,GACH,YAAW;IACd,OAAON,GAAA,CAAIS,MAAA,CAAOH,EAAE;EACxB;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["Dimensions","getWindowSize","get","cbs","Set","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;AAClBJ,UAAA,CAAWK,gBAAA,CAAiB,UAAU,UAASC,KAAA,EAAO;EAClD,IAAI;IAAEC;EAAO,IAAID,KAAA;EACjBH,GAAA,CAAIK,OAAA,CAAQ,UAASC,EAAA,EAAI;IACrB,OAAOA,EAAA,CAAGF,MAAM;EACpB,CAAC;AACL,CAAC;AACM,SAASG,UAAUD,EAAA,EAAI;EAC1BN,GAAA,CAAIQ,GAAA,CAAIF,EAAE;EACV,OAAO,YAAW;IACd,OAAON,GAAA,CAAIS,MAAA,CAAOH,EAAE;EACxB;AACJ","ignoreList":[]}
package/dist/esm/index.js CHANGED
@@ -1,19 +1,12 @@
1
1
  import React from "react";
2
2
  import { isWeb } from "@tamagui/constants";
3
- import { getWindowSize, subscribe } from "./helpers";
4
- import { initialValue } from "./initialValue";
5
- import { configureInitialWindowDimensions } from "./initialValue";
3
+ import { getWindowSize, subscribe } from "./helpers.mjs";
4
+ import { initialValue } from "./initialValue.mjs";
5
+ import { configureInitialWindowDimensions } from "./initialValue.mjs";
6
6
  function useWindowDimensions({
7
7
  serverValue = initialValue
8
8
  } = {}) {
9
- return React.useSyncExternalStore(
10
- subscribe,
11
- getWindowSize,
12
- () => isWeb ? serverValue : getWindowSize()
13
- );
9
+ return React.useSyncExternalStore(subscribe, getWindowSize, () => isWeb ? serverValue : getWindowSize());
14
10
  }
15
- export {
16
- configureInitialWindowDimensions,
17
- useWindowDimensions
18
- };
11
+ export { configureInitialWindowDimensions, useWindowDimensions };
19
12
  //# sourceMappingURL=index.js.map
@@ -1,6 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,aAAa;AAEtB,SAAS,eAAe,iBAAiB;AAEzC,SAAS,oBAAoB;AAE7B,SAAS,wCAAwC;AAE1C,SAAS,oBAAoB;AAAA,EAClC,cAAc;AAChB,IAAkC,CAAC,GAAe;AAChD,SAAO,MAAM;AAAA,IAAqB;AAAA,IAAW;AAAA,IAAe,MAC1D,QAAQ,cAAc,cAAc;AAAA,EACtC;AACF;",
5
- "names": []
6
- }
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":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/use-window-dimensions",
3
- "version": "2.0.0-rc.8",
3
+ "version": "2.0.0",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "files": [
6
6
  "src",
@@ -16,15 +16,12 @@
16
16
  "./package.json": "./package.json",
17
17
  ".": {
18
18
  "types": "./types/index.d.ts",
19
- "react-native": {
20
- "module": "./dist/esm/index.native.js",
21
- "import": "./dist/esm/index.native.js",
22
- "require": "./dist/cjs/index.native.js"
23
- },
19
+ "react-native": "./dist/esm/index.native.js",
20
+ "browser": "./dist/esm/index.mjs",
24
21
  "module": "./dist/esm/index.mjs",
25
22
  "import": "./dist/esm/index.mjs",
26
23
  "require": "./dist/cjs/index.cjs",
27
- "default": "./dist/cjs/index.native.js"
24
+ "default": "./dist/esm/index.mjs"
28
25
  }
29
26
  },
30
27
  "publishConfig": {
@@ -37,15 +34,14 @@
37
34
  "clean:build": "tamagui-build clean:build"
38
35
  },
39
36
  "dependencies": {
40
- "@tamagui/constants": "2.0.0-rc.8"
37
+ "@tamagui/constants": "2.0.0"
41
38
  },
42
39
  "devDependencies": {
43
- "@tamagui/build": "2.0.0-rc.8",
40
+ "@tamagui/build": "2.0.0",
44
41
  "react": ">=19",
45
- "react-native": "0.81.5"
42
+ "react-native": "0.83.2"
46
43
  },
47
44
  "peerDependencies": {
48
- "react": ">=19",
49
- "react-native": "*"
45
+ "react": ">=19"
50
46
  }
51
47
  }
package/src/helpers.ts CHANGED
@@ -34,7 +34,12 @@ export function getWindowSize(): WindowSize {
34
34
  const cbs = new Set<WindowSizeListener>()
35
35
 
36
36
  // only attach resize listener on client (not during SSR)
37
- if (isClient) {
37
+ // also guard window.addEventListener since isClient=true on native but window.addEventListener is undefined
38
+ if (
39
+ isClient &&
40
+ typeof window !== 'undefined' &&
41
+ typeof window.addEventListener === 'function'
42
+ ) {
38
43
  let lastUpdate = Date.now()
39
44
  let tm: ReturnType<typeof setTimeout> | undefined
40
45
  const USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS
@@ -1,11 +1,11 @@
1
1
  {
2
- "mappings": "AAEA,cAAc,YAAY,0BAA0B;AAKpD,OAAO,iBAAS,iBAAiB;AAyDjC,OAAO,iBAAS,UAAU,IAAI",
2
+ "mappings": "AAEA,cAAc,YAAY,0BAA0B;AAKpD,OAAO,iBAAS,iBAAiB;AA8DjC,OAAO,iBAAS,UAAU,IAAI",
3
3
  "names": [],
4
4
  "sources": [
5
5
  "src/helpers.ts"
6
6
  ],
7
+ "version": 3,
7
8
  "sourcesContent": [
8
- "import { isClient } from '@tamagui/constants'\nimport { initialValue } from './initialValue'\nimport type { WindowSize, WindowSizeListener } from './types'\n\nlet lastSize: WindowSize = initialValue\nlet docEl: HTMLElement | null = null\n\nexport function getWindowSize(): WindowSize {\n if (process.env.TAMAGUI_TARGET !== 'web') {\n return initialValue\n }\n\n docEl ||= window.document.documentElement\n\n const nextSize: WindowSize = {\n fontScale: 1,\n height: docEl.clientHeight,\n scale: window.devicePixelRatio || 1,\n width: docEl.clientWidth,\n }\n\n if (\n nextSize.height !== lastSize.height ||\n nextSize.width !== lastSize.width ||\n nextSize.scale !== lastSize.scale\n ) {\n lastSize = nextSize\n return nextSize\n }\n\n return lastSize\n}\n\nconst cbs = new Set<WindowSizeListener>()\n\n// only attach resize listener on client (not during SSR)\nif (isClient) {\n let lastUpdate = Date.now()\n let tm: ReturnType<typeof setTimeout> | undefined\n const USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS\n const updateMaxMs = USER_MAX_MS ? +USER_MAX_MS : 100\n\n function flushUpdate() {\n lastUpdate = Date.now()\n cbs.forEach((cb) => cb(getWindowSize()))\n }\n\n const onResize = () => {\n clearTimeout(tm)\n\n // only update every few frames\n const timeSinceLast = Date.now() - lastUpdate\n if (timeSinceLast < updateMaxMs) {\n tm = setTimeout(() => {\n flushUpdate()\n }, updateMaxMs - timeSinceLast)\n } else {\n flushUpdate()\n }\n }\n\n window.addEventListener('resize', onResize)\n}\n\nexport function subscribe(cb: WindowSizeListener): () => void {\n cbs.add(cb)\n return () => cbs.delete(cb)\n}\n"
9
- ],
10
- "version": 3
9
+ "import { isClient } from '@tamagui/constants'\nimport { initialValue } from './initialValue'\nimport type { WindowSize, WindowSizeListener } from './types'\n\nlet lastSize: WindowSize = initialValue\nlet docEl: HTMLElement | null = null\n\nexport function getWindowSize(): WindowSize {\n if (process.env.TAMAGUI_TARGET !== 'web') {\n return initialValue\n }\n\n docEl ||= window.document.documentElement\n\n const nextSize: WindowSize = {\n fontScale: 1,\n height: docEl.clientHeight,\n scale: window.devicePixelRatio || 1,\n width: docEl.clientWidth,\n }\n\n if (\n nextSize.height !== lastSize.height ||\n nextSize.width !== lastSize.width ||\n nextSize.scale !== lastSize.scale\n ) {\n lastSize = nextSize\n return nextSize\n }\n\n return lastSize\n}\n\nconst cbs = new Set<WindowSizeListener>()\n\n// only attach resize listener on client (not during SSR)\n// also guard window.addEventListener since isClient=true on native but window.addEventListener is undefined\nif (\n isClient &&\n typeof window !== 'undefined' &&\n typeof window.addEventListener === 'function'\n) {\n let lastUpdate = Date.now()\n let tm: ReturnType<typeof setTimeout> | undefined\n const USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS\n const updateMaxMs = USER_MAX_MS ? +USER_MAX_MS : 100\n\n function flushUpdate() {\n lastUpdate = Date.now()\n cbs.forEach((cb) => cb(getWindowSize()))\n }\n\n const onResize = () => {\n clearTimeout(tm)\n\n // only update every few frames\n const timeSinceLast = Date.now() - lastUpdate\n if (timeSinceLast < updateMaxMs) {\n tm = setTimeout(() => {\n flushUpdate()\n }, updateMaxMs - timeSinceLast)\n } else {\n flushUpdate()\n }\n }\n\n window.addEventListener('resize', onResize)\n}\n\nexport function subscribe(cb: WindowSizeListener): () => void {\n cbs.add(cb)\n return () => cbs.delete(cb)\n}\n"
10
+ ]
11
11
  }
@@ -4,8 +4,8 @@
4
4
  "sources": [
5
5
  "src/helpers.native.ts"
6
6
  ],
7
+ "version": 3,
7
8
  "sourcesContent": [
8
9
  "import { Dimensions } from 'react-native'\nimport type { WindowSize, WindowSizeListener } from './types'\n\nexport function getWindowSize(): WindowSize {\n return Dimensions.get('window')\n}\n\nconst cbs = new Set<WindowSizeListener>()\n\nDimensions.addEventListener('change', ({ window }) => {\n cbs.forEach((cb) => cb(window))\n})\n\nexport function subscribe(cb: WindowSizeListener): () => void {\n cbs.add(cb)\n return () => cbs.delete(cb)\n}\n"
9
- ],
10
- "version": 3
10
+ ]
11
11
  }
@@ -4,8 +4,8 @@
4
4
  "sources": [
5
5
  "src/index.ts"
6
6
  ],
7
+ "version": 3,
7
8
  "sourcesContent": [
8
9
  "import React from 'react'\nimport { isWeb } from '@tamagui/constants'\n\nimport { getWindowSize, subscribe } from './helpers'\nimport type { WindowSize } from './types'\nimport { initialValue } from './initialValue'\n\nexport { configureInitialWindowDimensions } from './initialValue'\n\nexport function useWindowDimensions({\n serverValue = initialValue,\n}: { serverValue?: WindowSize } = {}): WindowSize {\n return React.useSyncExternalStore(subscribe, getWindowSize, () =>\n isWeb ? serverValue : getWindowSize()\n )\n}\n"
9
- ],
10
- "version": 3
10
+ ]
11
11
  }
@@ -1,13 +1,11 @@
1
1
  {
2
- "mappings": "AAAA,cAAc,kBAAkB;;;;AAKhC,OAAO,cAAMA,cAAc;AAO3B,OAAO,iBAAS,iCAAiC,MAAM",
3
- "names": [
4
- "initialValue: WindowSize"
5
- ],
2
+ "mappings": "AAAA,cAAc,kBAAkB;;;;AAKhC,OAAO,cAAM,cAAc;AAO3B,OAAO,iBAAS,iCAAiC,MAAM",
3
+ "names": [],
6
4
  "sources": [
7
5
  "src/initialValue.ts"
8
6
  ],
7
+ "version": 3,
9
8
  "sourcesContent": [
10
9
  "import type { WindowSize } from './types'\n\n/**\n * SSR safe useWindowDimensions\n */\nexport const initialValue: WindowSize = {\n width: 800,\n height: 600,\n scale: 1,\n fontScale: 1,\n}\n\nexport function configureInitialWindowDimensions(next: WindowSize): void {\n Object.assign(initialValue, next)\n}\n"
11
- ],
12
- "version": 3
10
+ ]
13
11
  }
@@ -4,8 +4,8 @@
4
4
  "sources": [
5
5
  "src/types.ts"
6
6
  ],
7
+ "version": 3,
7
8
  "sourcesContent": [
8
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
- ],
10
- "version": 3
10
+ ]
11
11
  }
@@ -1,50 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: !0 });
8
- }, __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from == "object" || typeof from == "function")
10
- for (let key of __getOwnPropNames(from))
11
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
- var helpers_exports = {};
16
- __export(helpers_exports, {
17
- getWindowSize: () => getWindowSize,
18
- subscribe: () => subscribe
19
- });
20
- module.exports = __toCommonJS(helpers_exports);
21
- var import_constants = require("@tamagui/constants"), import_initialValue = require("./initialValue");
22
- let lastSize = import_initialValue.initialValue, docEl = null;
23
- function getWindowSize() {
24
- docEl ||= window.document.documentElement;
25
- const nextSize = {
26
- fontScale: 1,
27
- height: docEl.clientHeight,
28
- scale: window.devicePixelRatio || 1,
29
- width: docEl.clientWidth
30
- };
31
- return nextSize.height !== lastSize.height || nextSize.width !== lastSize.width || nextSize.scale !== lastSize.scale ? (lastSize = nextSize, nextSize) : lastSize;
32
- }
33
- const cbs = /* @__PURE__ */ new Set();
34
- if (import_constants.isClient) {
35
- let flushUpdate = function() {
36
- lastUpdate = Date.now(), cbs.forEach((cb) => cb(getWindowSize()));
37
- }, lastUpdate = Date.now(), tm;
38
- const USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS, updateMaxMs = USER_MAX_MS ? +USER_MAX_MS : 100, onResize = () => {
39
- clearTimeout(tm);
40
- const timeSinceLast = Date.now() - lastUpdate;
41
- timeSinceLast < updateMaxMs ? tm = setTimeout(() => {
42
- flushUpdate();
43
- }, updateMaxMs - timeSinceLast) : flushUpdate();
44
- };
45
- window.addEventListener("resize", onResize);
46
- }
47
- function subscribe(cb) {
48
- return cbs.add(cb), () => cbs.delete(cb);
49
- }
50
- //# sourceMappingURL=helpers.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/helpers.ts"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAyB,+BACzB,sBAA6B;AAG7B,IAAI,WAAuB,kCACvB,QAA4B;AAEzB,SAAS,gBAA4B;AAK1C,YAAU,OAAO,SAAS;AAE1B,QAAM,WAAuB;AAAA,IAC3B,WAAW;AAAA,IACX,QAAQ,MAAM;AAAA,IACd,OAAO,OAAO,oBAAoB;AAAA,IAClC,OAAO,MAAM;AAAA,EACf;AAEA,SACE,SAAS,WAAW,SAAS,UAC7B,SAAS,UAAU,SAAS,SAC5B,SAAS,UAAU,SAAS,SAE5B,WAAW,UACJ,YAGF;AACT;AAEA,MAAM,MAAM,oBAAI,IAAwB;AAGxC,IAAI,2BAAU;AAMZ,MAAS,cAAT,WAAuB;AACrB,iBAAa,KAAK,IAAI,GACtB,IAAI,QAAQ,CAAC,OAAO,GAAG,cAAc,CAAC,CAAC;AAAA,EACzC,GARI,aAAa,KAAK,IAAI,GACtB;AACJ,QAAM,cAAc,QAAQ,IAAI,6CAC1B,cAAc,cAAc,CAAC,cAAc,KAO3C,WAAW,MAAM;AACrB,iBAAa,EAAE;AAGf,UAAM,gBAAgB,KAAK,IAAI,IAAI;AACnC,IAAI,gBAAgB,cAClB,KAAK,WAAW,MAAM;AACpB,kBAAY;AAAA,IACd,GAAG,cAAc,aAAa,IAE9B,YAAY;AAAA,EAEhB;AAEA,SAAO,iBAAiB,UAAU,QAAQ;AAC5C;AAEO,SAAS,UAAU,IAAoC;AAC5D,aAAI,IAAI,EAAE,GACH,MAAM,IAAI,OAAO,EAAE;AAC5B;",
5
- "names": []
6
- }
package/dist/cjs/index.js DELETED
@@ -1,39 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
14
- };
15
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
- var index_exports = {};
24
- __export(index_exports, {
25
- configureInitialWindowDimensions: () => import_initialValue2.configureInitialWindowDimensions,
26
- useWindowDimensions: () => useWindowDimensions
27
- });
28
- module.exports = __toCommonJS(index_exports);
29
- var import_react = __toESM(require("react"), 1), import_constants = require("@tamagui/constants"), import_helpers = require("./helpers"), import_initialValue = require("./initialValue"), import_initialValue2 = require("./initialValue");
30
- function useWindowDimensions({
31
- serverValue = import_initialValue.initialValue
32
- } = {}) {
33
- return import_react.default.useSyncExternalStore(
34
- import_helpers.subscribe,
35
- import_helpers.getWindowSize,
36
- () => import_constants.isWeb ? serverValue : (0, import_helpers.getWindowSize)()
37
- );
38
- }
39
- //# sourceMappingURL=index.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,8BAClB,mBAAsB,+BAEtB,iBAAyC,sBAEzC,sBAA6B,2BAE7BA,uBAAiD;AAE1C,SAAS,oBAAoB;AAAA,EAClC,cAAc;AAChB,IAAkC,CAAC,GAAe;AAChD,SAAO,aAAAC,QAAM;AAAA,IAAqB;AAAA,IAAW;AAAA,IAAe,MAC1D,yBAAQ,kBAAc,8BAAc;AAAA,EACtC;AACF;",
5
- "names": ["import_initialValue", "React"]
6
- }
@@ -1,30 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: !0 });
8
- }, __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from == "object" || typeof from == "function")
10
- for (let key of __getOwnPropNames(from))
11
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
- var initialValue_exports = {};
16
- __export(initialValue_exports, {
17
- configureInitialWindowDimensions: () => configureInitialWindowDimensions,
18
- initialValue: () => initialValue
19
- });
20
- module.exports = __toCommonJS(initialValue_exports);
21
- const initialValue = {
22
- width: 800,
23
- height: 600,
24
- scale: 1,
25
- fontScale: 1
26
- };
27
- function configureInitialWindowDimensions(next) {
28
- Object.assign(initialValue, next);
29
- }
30
- //# sourceMappingURL=initialValue.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/initialValue.ts"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,MAAM,eAA2B;AAAA,EACtC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,WAAW;AACb;AAEO,SAAS,iCAAiC,MAAwB;AACvE,SAAO,OAAO,cAAc,IAAI;AAClC;",
5
- "names": []
6
- }
package/dist/cjs/types.js DELETED
@@ -1,14 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from == "object" || typeof from == "function")
7
- for (let key of __getOwnPropNames(from))
8
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
- return to;
10
- };
11
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
- var types_exports = {};
13
- module.exports = __toCommonJS(types_exports);
14
- //# sourceMappingURL=types.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/types.ts"],
4
- "mappings": ";;;;;;;;;;;AAAA;AAAA;",
5
- "names": []
6
- }
@@ -1,35 +0,0 @@
1
- import { isClient } from "@tamagui/constants";
2
- import { initialValue } from "./initialValue";
3
- let lastSize = initialValue, docEl = null;
4
- function getWindowSize() {
5
- docEl ||= window.document.documentElement;
6
- const nextSize = {
7
- fontScale: 1,
8
- height: docEl.clientHeight,
9
- scale: window.devicePixelRatio || 1,
10
- width: docEl.clientWidth
11
- };
12
- return nextSize.height !== lastSize.height || nextSize.width !== lastSize.width || nextSize.scale !== lastSize.scale ? (lastSize = nextSize, nextSize) : lastSize;
13
- }
14
- const cbs = /* @__PURE__ */ new Set();
15
- if (isClient) {
16
- let flushUpdate = function() {
17
- lastUpdate = Date.now(), cbs.forEach((cb) => cb(getWindowSize()));
18
- }, lastUpdate = Date.now(), tm;
19
- const USER_MAX_MS = process.env.TAMAGUI_USE_WINDOW_DIMENSIONS_MAX_UPDATE_MS, updateMaxMs = USER_MAX_MS ? +USER_MAX_MS : 100, onResize = () => {
20
- clearTimeout(tm);
21
- const timeSinceLast = Date.now() - lastUpdate;
22
- timeSinceLast < updateMaxMs ? tm = setTimeout(() => {
23
- flushUpdate();
24
- }, updateMaxMs - timeSinceLast) : flushUpdate();
25
- };
26
- window.addEventListener("resize", onResize);
27
- }
28
- function subscribe(cb) {
29
- return cbs.add(cb), () => cbs.delete(cb);
30
- }
31
- export {
32
- getWindowSize,
33
- subscribe
34
- };
35
- //# sourceMappingURL=helpers.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/helpers.ts"],
4
- "mappings": "AAAA,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAG7B,IAAI,WAAuB,cACvB,QAA4B;AAEzB,SAAS,gBAA4B;AAK1C,YAAU,OAAO,SAAS;AAE1B,QAAM,WAAuB;AAAA,IAC3B,WAAW;AAAA,IACX,QAAQ,MAAM;AAAA,IACd,OAAO,OAAO,oBAAoB;AAAA,IAClC,OAAO,MAAM;AAAA,EACf;AAEA,SACE,SAAS,WAAW,SAAS,UAC7B,SAAS,UAAU,SAAS,SAC5B,SAAS,UAAU,SAAS,SAE5B,WAAW,UACJ,YAGF;AACT;AAEA,MAAM,MAAM,oBAAI,IAAwB;AAGxC,IAAI,UAAU;AAMZ,MAAS,cAAT,WAAuB;AACrB,iBAAa,KAAK,IAAI,GACtB,IAAI,QAAQ,CAAC,OAAO,GAAG,cAAc,CAAC,CAAC;AAAA,EACzC,GARI,aAAa,KAAK,IAAI,GACtB;AACJ,QAAM,cAAc,QAAQ,IAAI,6CAC1B,cAAc,cAAc,CAAC,cAAc,KAO3C,WAAW,MAAM;AACrB,iBAAa,EAAE;AAGf,UAAM,gBAAgB,KAAK,IAAI,IAAI;AACnC,IAAI,gBAAgB,cAClB,KAAK,WAAW,MAAM;AACpB,kBAAY;AAAA,IACd,GAAG,cAAc,aAAa,IAE9B,YAAY;AAAA,EAEhB;AAEA,SAAO,iBAAiB,UAAU,QAAQ;AAC5C;AAEO,SAAS,UAAU,IAAoC;AAC5D,aAAI,IAAI,EAAE,GACH,MAAM,IAAI,OAAO,EAAE;AAC5B;",
5
- "names": []
6
- }
@@ -1,14 +0,0 @@
1
- const initialValue = {
2
- width: 800,
3
- height: 600,
4
- scale: 1,
5
- fontScale: 1
6
- };
7
- function configureInitialWindowDimensions(next) {
8
- Object.assign(initialValue, next);
9
- }
10
- export {
11
- configureInitialWindowDimensions,
12
- initialValue
13
- };
14
- //# sourceMappingURL=initialValue.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/initialValue.ts"],
4
- "mappings": "AAKO,MAAM,eAA2B;AAAA,EACtC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,WAAW;AACb;AAEO,SAAS,iCAAiC,MAAwB;AACvE,SAAO,OAAO,cAAc,IAAI;AAClC;",
5
- "names": []
6
- }
package/dist/esm/types.js DELETED
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "mappings": "",
5
- "names": []
6
- }