@tamagui/use-window-dimensions 1.108.0 → 1.108.2
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 +12 -4
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/index.native.js +12 -4
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +2 -2
- package/dist/esm/index.native.js.map +2 -2
- package/package.json +3 -3
- package/src/index.ts +3 -2
- package/types/index.d.ts.map +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
7
|
for (var name in all)
|
|
7
8
|
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
@@ -11,14 +12,21 @@ var __export = (target, all) => {
|
|
|
11
12
|
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
13
|
return to;
|
|
13
14
|
};
|
|
14
|
-
var
|
|
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);
|
|
15
23
|
var src_exports = {};
|
|
16
24
|
__export(src_exports, {
|
|
17
25
|
configureInitialWindowDimensions: () => configureInitialWindowDimensions,
|
|
18
26
|
useWindowDimensions: () => useWindowDimensions
|
|
19
27
|
});
|
|
20
28
|
module.exports = __toCommonJS(src_exports);
|
|
21
|
-
var
|
|
29
|
+
var import_react = __toESM(require("react")), import_constants = require("@tamagui/constants"), import_react_native = require("react-native-web");
|
|
22
30
|
const initialValue = {
|
|
23
31
|
height: 800,
|
|
24
32
|
width: 600
|
|
@@ -36,7 +44,7 @@ function subscribe(cb) {
|
|
|
36
44
|
function useWindowDimensions({
|
|
37
45
|
serverValue = initialValue
|
|
38
46
|
} = {}) {
|
|
39
|
-
return
|
|
47
|
+
return import_react.default.useSyncExternalStore(
|
|
40
48
|
subscribe,
|
|
41
49
|
() => import_react_native.Dimensions.get("window"),
|
|
42
50
|
() => import_constants.isWeb ? serverValue : import_react_native.Dimensions.get("window")
|
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": "
|
|
5
|
-
"names": []
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,2BAClB,mBAAsB,+BAGtB,sBAA2B;AAW3B,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,SAAO,aAAAA,QAAM;AAAA,IACX;AAAA,IACA,MAAM,+BAAW,IAAI,QAAQ;AAAA,IAC7B,MAAO,yBAAQ,cAAc,+BAAW,IAAI,QAAQ;AAAA,EACtD;AACF;",
|
|
5
|
+
"names": ["React"]
|
|
6
6
|
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
8
9
|
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
@@ -12,14 +13,21 @@ var __export = (target, all) => {
|
|
|
12
13
|
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
14
|
return to;
|
|
14
15
|
};
|
|
15
|
-
var
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
+
mod
|
|
23
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
24
|
var src_exports = {};
|
|
17
25
|
__export(src_exports, {
|
|
18
26
|
configureInitialWindowDimensions: () => configureInitialWindowDimensions,
|
|
19
27
|
useWindowDimensions: () => useWindowDimensions
|
|
20
28
|
});
|
|
21
29
|
module.exports = __toCommonJS(src_exports);
|
|
22
|
-
var
|
|
30
|
+
var import_react = __toESM(require("react")), import_constants = require("@tamagui/constants"), import_react_native = require("react-native"), initialValue = {
|
|
23
31
|
height: 800,
|
|
24
32
|
width: 600
|
|
25
33
|
};
|
|
@@ -39,7 +47,7 @@ function subscribe(cb) {
|
|
|
39
47
|
}
|
|
40
48
|
function useWindowDimensions() {
|
|
41
49
|
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref_serverValue = _ref.serverValue, serverValue = _ref_serverValue === void 0 ? initialValue : _ref_serverValue;
|
|
42
|
-
return
|
|
50
|
+
return import_react.default.useSyncExternalStore(subscribe, function() {
|
|
43
51
|
return import_react_native.Dimensions.get("window");
|
|
44
52
|
}, function() {
|
|
45
53
|
return import_constants.isWeb ? serverValue : import_react_native.Dimensions.get("window");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/core/use-window-dimensions/src/index.ts"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["initialValue", "height", "width", "configureInitialWindowDimensions", "next", "Object", "assign", "Dimensions", "addEventListener", "cbs", "forEach", "cb", "window", "Set", "subscribe", "add", "delete", "useWindowDimensions", "serverValue", "useSyncExternalStore", "get", "isWeb"]
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;mBAAkB,2BAClB,mBAAsB,+BAGtB,sBAA2B,yBAWrBA,eAAqB;EACzBC,QAAQ;EACRC,OAAO;AACT;AAEO,SAASC,iCAAiCC,MAAU;AACzDC,SAAOC,OAAON,cAAcI,IAAAA;AAC9B;AAEAG,+BAAWC,iBAAiB,UAAU,WAAA;AACpCC,MAAIC,QAAQ,SAACC,IAAAA;WAAOA,GAAGC,MAAAA;;AACzB,CAAA;AAEA,IAAMH,MAAM,oBAAII,IAAAA;AAIhB,SAASC,UAAUH,IAAsB;AACvCF,aAAIM,IAAIJ,EAAAA,GACD,WAAA;WAAMF,IAAIO,OAAOL,EAAAA;;AAC1B;AAEO,SAASM,sBAAAA;MAAoB,OAAA,UAAA,SAAA,KAAA,UAAA,CAAA,MAAA,SAAA,UAAA,CAAA,IAER,CAAC,GAAA,mBAFO,KAClCC,aAAAA,cAAAA,qBAAAA,SAAclB,eAAAA;AAEd,SAAOmB,aAAAA,QAAMC,qBACXN,WACA,WAAA;WAAMP,+BAAWc,IAAI,QAAA;KACrB,WAAA;WAAOC,yBAAQJ,cAAcX,+BAAWc,IAAI,QAAA;;AAEhD;",
|
|
5
|
+
"names": ["initialValue", "height", "width", "configureInitialWindowDimensions", "next", "Object", "assign", "Dimensions", "addEventListener", "cbs", "forEach", "cb", "window", "Set", "subscribe", "add", "delete", "useWindowDimensions", "serverValue", "React", "useSyncExternalStore", "get", "isWeb"]
|
|
6
6
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { isWeb } from "@tamagui/constants";
|
|
2
|
-
import { useSyncExternalStore } from "react";
|
|
3
3
|
import { Dimensions } from "react-native-web";
|
|
4
4
|
const initialValue = {
|
|
5
5
|
height: 800,
|
|
@@ -18,7 +18,7 @@ function subscribe(cb) {
|
|
|
18
18
|
function useWindowDimensions({
|
|
19
19
|
serverValue = initialValue
|
|
20
20
|
} = {}) {
|
|
21
|
-
return useSyncExternalStore(
|
|
21
|
+
return React.useSyncExternalStore(
|
|
22
22
|
subscribe,
|
|
23
23
|
() => Dimensions.get("window"),
|
|
24
24
|
() => isWeb ? serverValue : Dimensions.get("window")
|
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,
|
|
4
|
+
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,aAAa;AAGtB,SAAS,kBAAkB;AAW3B,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,MAAM;AAAA,IACX;AAAA,IACA,MAAM,WAAW,IAAI,QAAQ;AAAA,IAC7B,MAAO,QAAQ,cAAc,WAAW,IAAI,QAAQ;AAAA,EACtD;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { isWeb } from "@tamagui/constants";
|
|
2
|
-
import { useSyncExternalStore } from "react";
|
|
3
3
|
import { Dimensions } from "react-native-web";
|
|
4
4
|
const initialValue = {
|
|
5
5
|
height: 800,
|
|
@@ -18,7 +18,7 @@ function subscribe(cb) {
|
|
|
18
18
|
function useWindowDimensions({
|
|
19
19
|
serverValue = initialValue
|
|
20
20
|
} = {}) {
|
|
21
|
-
return useSyncExternalStore(subscribe, () => Dimensions.get("window"), () => isWeb ? serverValue : Dimensions.get("window"));
|
|
21
|
+
return React.useSyncExternalStore(subscribe, () => Dimensions.get("window"), () => isWeb ? serverValue : Dimensions.get("window"));
|
|
22
22
|
}
|
|
23
23
|
export { configureInitialWindowDimensions, useWindowDimensions };
|
|
24
24
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["React","isWeb","Dimensions","initialValue","height","width","configureInitialWindowDimensions","next","Object","assign","addEventListener","cbs","forEach","cb","window","Set","subscribe","add","delete","useWindowDimensions","serverValue","useSyncExternalStore","get"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAClB,SAASC,KAAA,QAAa;AAGtB,SAASC,UAAA,QAAkB;AAW3B,MAAMC,YAAA,GAAqB;EACzBC,MAAA,EAAQ;EACRC,KAAA,EAAO;AACT;AAEO,SAASC,iCAAiCC,IAAA,EAAY;EAC3DC,MAAA,CAAOC,MAAA,CAAON,YAAA,EAAcI,IAAI;AAClC;AAEAL,UAAA,CAAWQ,gBAAA,CAAiB,UAAU,MAAM;EAC1CC,GAAA,CAAIC,OAAA,CAASC,EAAA,IAAOA,EAAA,CAAGC,MAAM,CAAC;AAChC,CAAC;AAED,MAAMH,GAAA,GAAM,mBAAII,GAAA,CAAc;AAI9B,SAASC,UAAUH,EAAA,EAAwB;EACzC,OAAAF,GAAA,CAAIM,GAAA,CAAIJ,EAAE,GACH,MAAMF,GAAA,CAAIO,MAAA,CAAOL,EAAE;AAC5B;AAEO,SAASM,oBAAoB;EAClCC,WAAA,GAAcjB;AAChB,IAA4B,CAAC,GAAG;EAC9B,OAAOH,KAAA,CAAMqB,oBAAA,CACXL,SAAA,EACA,MAAMd,UAAA,CAAWoB,GAAA,CAAI,QAAQ,GAC7B,MAAOrB,KAAA,GAAQmB,WAAA,GAAclB,UAAA,CAAWoB,GAAA,CAAI,QAAQ,CACtD;AACF","ignoreList":[]}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { isWeb } from "@tamagui/constants";
|
|
2
|
-
import { useSyncExternalStore } from "react";
|
|
3
3
|
import { Dimensions } from "react-native";
|
|
4
4
|
var initialValue = {
|
|
5
5
|
height: 800,
|
|
@@ -21,7 +21,7 @@ function subscribe(cb) {
|
|
|
21
21
|
}
|
|
22
22
|
function useWindowDimensions() {
|
|
23
23
|
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref_serverValue = _ref.serverValue, serverValue = _ref_serverValue === void 0 ? initialValue : _ref_serverValue;
|
|
24
|
-
return useSyncExternalStore(subscribe, function() {
|
|
24
|
+
return React.useSyncExternalStore(subscribe, function() {
|
|
25
25
|
return Dimensions.get("window");
|
|
26
26
|
}, function() {
|
|
27
27
|
return isWeb ? serverValue : Dimensions.get("window");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/core/use-window-dimensions/src/index.ts"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": ["
|
|
4
|
+
"mappings": "AAAA,OAAOA,WAAW;AAClB,SAASC,aAAa;AAGtB,SAASC,kBAAkB;AAW3B,IAAMC,eAAqB;EACzBC,QAAQ;EACRC,OAAO;AACT;AAEO,SAASC,iCAAiCC,MAAU;AACzDC,SAAOC,OAAON,cAAcI,IAAAA;AAC9B;AAEAL,WAAWQ,iBAAiB,UAAU,WAAA;AACpCC,MAAIC,QAAQ,SAACC,IAAAA;WAAOA,GAAGC,MAAAA;;AACzB,CAAA;AAEA,IAAMH,MAAM,oBAAII,IAAAA;AAIhB,SAASC,UAAUH,IAAsB;AACvCF,aAAIM,IAAIJ,EAAAA,GACD,WAAA;WAAMF,IAAIO,OAAOL,EAAAA;;AAC1B;AAEO,SAASM,sBAAAA;MAAoB,OAAA,UAAA,SAAA,KAAA,UAAA,CAAA,MAAA,SAAA,UAAA,CAAA,IAER,CAAC,GAAA,mBAFO,KAClCC,aAAAA,cAAAA,qBAAAA,SAAcjB,eAAAA;AAEd,SAAOH,MAAMqB,qBACXL,WACA,WAAA;WAAMd,WAAWoB,IAAI,QAAA;KACrB,WAAA;WAAOrB,QAAQmB,cAAclB,WAAWoB,IAAI,QAAA;;AAEhD;",
|
|
5
|
+
"names": ["React", "isWeb", "Dimensions", "initialValue", "height", "width", "configureInitialWindowDimensions", "next", "Object", "assign", "addEventListener", "cbs", "forEach", "cb", "window", "Set", "subscribe", "add", "delete", "useWindowDimensions", "serverValue", "useSyncExternalStore", "get"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-window-dimensions",
|
|
3
|
-
"version": "1.108.
|
|
3
|
+
"version": "1.108.2",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/constants": "1.108.
|
|
30
|
+
"@tamagui/constants": "1.108.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tamagui/build": "1.108.
|
|
33
|
+
"@tamagui/build": "1.108.2",
|
|
34
34
|
"react": "^18.2.0 || ^19.0.0",
|
|
35
35
|
"react-native": "0.74.1"
|
|
36
36
|
},
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import React from 'react'
|
|
1
2
|
import { isWeb } from '@tamagui/constants'
|
|
2
|
-
|
|
3
|
+
|
|
3
4
|
import type { ScaledSize } from 'react-native'
|
|
4
5
|
import { Dimensions } from 'react-native'
|
|
5
6
|
|
|
@@ -37,7 +38,7 @@ function subscribe(cb: WindowSizeListener) {
|
|
|
37
38
|
export function useWindowDimensions({
|
|
38
39
|
serverValue = initialValue,
|
|
39
40
|
}: { serverValue?: Size } = {}) {
|
|
40
|
-
return useSyncExternalStore(
|
|
41
|
+
return React.useSyncExternalStore(
|
|
41
42
|
subscribe,
|
|
42
43
|
() => Dimensions.get('window'),
|
|
43
44
|
() => (isWeb ? serverValue : Dimensions.get('window'))
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA;;GAEG;AAEH,KAAK,IAAI,GAAG;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAOD,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,IAAI,QAE1D;AAeD,wBAAgB,mBAAmB,CAAC,EAClC,WAA0B,GAC3B,GAAE;IAAE,WAAW,CAAC,EAAE,IAAI,CAAA;CAAO,QAM7B"}
|