@tamagui/use-window-dimensions 1.61.2 → 1.62.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.
- package/dist/cjs/index.js +7 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +51 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
10
|
for (let key of __getOwnPropNames(from))
|
|
13
|
-
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
12
|
return to;
|
|
17
13
|
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value:
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
19
15
|
var src_exports = {};
|
|
20
16
|
__export(src_exports, {
|
|
21
17
|
configureInitialWindowDimensions: () => configureInitialWindowDimensions,
|
|
22
18
|
useWindowDimensions: () => useWindowDimensions
|
|
23
19
|
});
|
|
24
20
|
module.exports = __toCommonJS(src_exports);
|
|
25
|
-
var import_constants = require("@tamagui/constants");
|
|
26
|
-
var import_react = require("react");
|
|
27
|
-
var import_react_native = require("react-native");
|
|
21
|
+
var import_constants = require("@tamagui/constants"), import_react = require("react"), import_react_native = require("react-native");
|
|
28
22
|
const initialValue = {
|
|
29
23
|
height: 800,
|
|
30
24
|
width: 600
|
|
@@ -37,8 +31,7 @@ import_react_native.Dimensions.addEventListener("change", () => {
|
|
|
37
31
|
});
|
|
38
32
|
const cbs = /* @__PURE__ */ new Set();
|
|
39
33
|
function subscribe(cb) {
|
|
40
|
-
cbs.add(cb);
|
|
41
|
-
return () => cbs.delete(cb);
|
|
34
|
+
return cbs.add(cb), () => cbs.delete(cb);
|
|
42
35
|
}
|
|
43
36
|
function useWindowDimensions({
|
|
44
37
|
serverValue = initialValue
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB,+BACtB,eAAqC,kBACrC,sBAAuC;AAWvC,MAAM,eAAqB;AAAA,EACzB,QAAQ;AAAA,EACR,OAAO;AACT;AAEO,SAAS,iCAAiC,MAAY;AAC3D,SAAO,OAAO,cAAc,IAAI;AAClC;AAEA,+BAAW,iBAAiB,UAAU,MAAM;AAC1C,MAAI,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC;AAChC,CAAC;AAED,MAAM,MAAM,oBAAI,IAAc;AAI9B,SAAS,UAAU,IAAwB;AACzC,aAAI,IAAI,EAAE,GACH,MAAM,IAAI,OAAO,EAAE;AAC5B;AAEO,SAAS,oBAAoB;AAAA,EAClC,cAAc;AAChB,IAA4B,CAAC,GAAG;AAC9B,aAAO;AAAA,IACL;AAAA,IACA,MAAM,+BAAW,IAAI,QAAQ;AAAA,IAC7B,MAAO,yBAAQ,cAAc,+BAAW,IAAI,QAAQ;AAAA,EACtD;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var src_exports = {};
|
|
17
|
+
__export(src_exports, {
|
|
18
|
+
configureInitialWindowDimensions: () => configureInitialWindowDimensions,
|
|
19
|
+
useWindowDimensions: () => useWindowDimensions
|
|
20
|
+
});
|
|
21
|
+
module.exports = __toCommonJS(src_exports);
|
|
22
|
+
var import_constants = require("@tamagui/constants"), import_react = require("react"), import_react_native = require("react-native");
|
|
23
|
+
const initialValue = {
|
|
24
|
+
height: 800,
|
|
25
|
+
width: 600
|
|
26
|
+
};
|
|
27
|
+
function configureInitialWindowDimensions(next) {
|
|
28
|
+
Object.assign(initialValue, next);
|
|
29
|
+
}
|
|
30
|
+
import_react_native.Dimensions.addEventListener("change", () => {
|
|
31
|
+
cbs.forEach((cb) => cb(window));
|
|
32
|
+
});
|
|
33
|
+
const cbs = /* @__PURE__ */ new Set();
|
|
34
|
+
function subscribe(cb) {
|
|
35
|
+
return cbs.add(cb), () => cbs.delete(cb);
|
|
36
|
+
}
|
|
37
|
+
function useWindowDimensions({
|
|
38
|
+
serverValue = initialValue
|
|
39
|
+
} = {}) {
|
|
40
|
+
return (0, import_react.useSyncExternalStore)(
|
|
41
|
+
subscribe,
|
|
42
|
+
() => import_react_native.Dimensions.get("window"),
|
|
43
|
+
() => import_constants.isWeb ? serverValue : import_react_native.Dimensions.get("window")
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
configureInitialWindowDimensions,
|
|
49
|
+
useWindowDimensions
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsB,+BACtB,eAAqC,kBACrC,sBAAuC;AAWvC,MAAM,eAAqB;AAAA,EACzB,QAAQ;AAAA,EACR,OAAO;AACT;AAEO,SAAS,iCAAiC,MAAY;AAC3D,SAAO,OAAO,cAAc,IAAI;AAClC;AAEA,+BAAW,iBAAiB,UAAU,MAAM;AAC1C,MAAI,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC;AAChC,CAAC;AAED,MAAM,MAAM,oBAAI,IAAc;AAI9B,SAAS,UAAU,IAAwB;AACzC,aAAI,IAAI,EAAE,GACH,MAAM,IAAI,OAAO,EAAE;AAC5B;AAEO,SAAS,oBAAoB;AAAA,EAClC,cAAc;AAChB,IAA4B,CAAC,GAAG;AAC9B,aAAO;AAAA,IACL;AAAA,IACA,MAAM,+BAAW,IAAI,QAAQ;AAAA,IAC7B,MAAO,yBAAQ,cAAc,+BAAW,IAAI,QAAQ;AAAA,EACtD;AACF;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -13,8 +13,7 @@ Dimensions.addEventListener("change", () => {
|
|
|
13
13
|
});
|
|
14
14
|
const cbs = /* @__PURE__ */ new Set();
|
|
15
15
|
function subscribe(cb) {
|
|
16
|
-
cbs.add(cb);
|
|
17
|
-
return () => cbs.delete(cb);
|
|
16
|
+
return cbs.add(cb), () => cbs.delete(cb);
|
|
18
17
|
}
|
|
19
18
|
function useWindowDimensions({
|
|
20
19
|
serverValue = initialValue
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "AAAA,SAAS,aAAa;AACtB,SAAS,4BAA4B;AACrC,SAAS,kBAA8B;AAWvC,MAAM,eAAqB;AAAA,EACzB,QAAQ;AAAA,EACR,OAAO;AACT;AAEO,SAAS,iCAAiC,MAAY;AAC3D,SAAO,OAAO,cAAc,IAAI;AAClC;AAEA,WAAW,iBAAiB,UAAU,MAAM;AAC1C,MAAI,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC;AAChC,CAAC;AAED,MAAM,MAAM,oBAAI,IAAc;AAI9B,SAAS,UAAU,IAAwB;AACzC,
|
|
4
|
+
"mappings": "AAAA,SAAS,aAAa;AACtB,SAAS,4BAA4B;AACrC,SAAS,kBAA8B;AAWvC,MAAM,eAAqB;AAAA,EACzB,QAAQ;AAAA,EACR,OAAO;AACT;AAEO,SAAS,iCAAiC,MAAY;AAC3D,SAAO,OAAO,cAAc,IAAI;AAClC;AAEA,WAAW,iBAAiB,UAAU,MAAM;AAC1C,MAAI,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC;AAChC,CAAC;AAED,MAAM,MAAM,oBAAI,IAAc;AAI9B,SAAS,UAAU,IAAwB;AACzC,aAAI,IAAI,EAAE,GACH,MAAM,IAAI,OAAO,EAAE;AAC5B;AAEO,SAAS,oBAAoB;AAAA,EAClC,cAAc;AAChB,IAA4B,CAAC,GAAG;AAC9B,SAAO;AAAA,IACL;AAAA,IACA,MAAM,WAAW,IAAI,QAAQ;AAAA,IAC7B,MAAO,QAAQ,cAAc,WAAW,IAAI,QAAQ;AAAA,EACtD;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-window-dimensions",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.0",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@tamagui/constants": "1.
|
|
29
|
+
"@tamagui/constants": "1.62.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@tamagui/build": "1.
|
|
32
|
+
"@tamagui/build": "1.62.0",
|
|
33
33
|
"react": "^18.2.0",
|
|
34
34
|
"react-native": "^0.72.1"
|
|
35
35
|
},
|