@vxrn/safe-area 1.27.1 → 2.0.0-beta.45.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.
- package/.turbo/turbo-build.log +1 -1
- package/dist/cjs/InitialWindow.cjs +15 -17
- package/dist/cjs/InitialWindow.native.cjs +30 -0
- package/dist/cjs/InitialWindow.native.js +15 -16
- package/dist/cjs/InitialWindow.native.js.map +1 -1
- package/dist/cjs/NativeSafeAreaProvider.cjs +109 -135
- package/dist/cjs/NativeSafeAreaProvider.native.cjs +141 -0
- package/dist/cjs/NativeSafeAreaProvider.native.js +111 -141
- package/dist/cjs/NativeSafeAreaProvider.native.js.map +1 -1
- package/dist/cjs/SafeArea-types.cjs +9 -11
- package/dist/cjs/SafeArea-types.native.cjs +18 -0
- package/dist/cjs/SafeArea-types.native.js +9 -10
- package/dist/cjs/SafeArea-types.native.js.map +1 -1
- package/dist/cjs/SafeAreaContext.cjs +85 -106
- package/dist/cjs/SafeAreaContext.native.cjs +132 -0
- package/dist/cjs/SafeAreaContext.native.js +88 -108
- package/dist/cjs/SafeAreaContext.native.js.map +1 -1
- package/dist/cjs/SafeAreaView.cjs +67 -100
- package/dist/cjs/SafeAreaView.native.cjs +99 -0
- package/dist/cjs/SafeAreaView.native.js +74 -106
- package/dist/cjs/SafeAreaView.native.js.map +1 -1
- package/dist/cjs/getWindowFrame.cjs +20 -24
- package/dist/cjs/getWindowFrame.native.cjs +35 -0
- package/dist/cjs/getWindowFrame.native.js +21 -27
- package/dist/cjs/getWindowFrame.native.js.map +1 -1
- package/dist/cjs/index.cjs +9 -11
- package/dist/cjs/index.native.cjs +22 -0
- package/dist/cjs/index.native.js +9 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/InitialWindow.mjs +1 -0
- package/dist/esm/InitialWindow.mjs.map +1 -1
- package/dist/esm/InitialWindow.native.js +1 -0
- package/dist/esm/InitialWindow.native.js.map +1 -1
- package/dist/esm/NativeSafeAreaProvider.mjs +94 -109
- package/dist/esm/NativeSafeAreaProvider.mjs.map +1 -1
- package/dist/esm/NativeSafeAreaProvider.native.js +96 -116
- package/dist/esm/NativeSafeAreaProvider.native.js.map +1 -1
- package/dist/esm/SafeArea-types.mjs +0 -2
- package/dist/esm/SafeArea-types.native.js +0 -2
- package/dist/esm/SafeAreaContext.mjs +62 -74
- package/dist/esm/SafeAreaContext.mjs.map +1 -1
- package/dist/esm/SafeAreaContext.native.js +66 -78
- package/dist/esm/SafeAreaContext.native.js.map +1 -1
- package/dist/esm/SafeAreaView.mjs +52 -74
- package/dist/esm/SafeAreaView.mjs.map +1 -1
- package/dist/esm/SafeAreaView.native.js +60 -82
- package/dist/esm/SafeAreaView.native.js.map +1 -1
- package/dist/esm/getWindowFrame.mjs +7 -6
- package/dist/esm/getWindowFrame.mjs.map +1 -1
- package/dist/esm/getWindowFrame.native.js +9 -10
- package/dist/esm/getWindowFrame.native.js.map +1 -1
- package/dist/esm/index.js +5 -4
- package/dist/esm/index.mjs +5 -4
- package/dist/esm/index.native.js +5 -4
- package/package.json +2 -2
- package/dist/esm/SafeArea-types.mjs.map +0 -1
- package/dist/esm/SafeArea-types.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
$ tamagui-build
|
|
2
|
-
built @vxrn/safe-area in
|
|
2
|
+
built @vxrn/safe-area in 1332 ms
|
|
@@ -3,28 +3,26 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
10
|
};
|
|
11
11
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
21
|
var InitialWindow_exports = {};
|
|
24
22
|
__export(InitialWindow_exports, {
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
initialWindowMetrics: () => initialWindowMetrics,
|
|
24
|
+
initialWindowSafeAreaInsets: () => initialWindowSafeAreaInsets
|
|
27
25
|
});
|
|
28
26
|
module.exports = __toCommonJS(InitialWindow_exports);
|
|
29
27
|
const initialWindowMetrics = null;
|
|
30
|
-
const initialWindowSafeAreaInsets = null;
|
|
28
|
+
const initialWindowSafeAreaInsets = null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
+
var InitialWindow_exports = {};
|
|
24
|
+
__export(InitialWindow_exports, {
|
|
25
|
+
initialWindowMetrics: () => initialWindowMetrics,
|
|
26
|
+
initialWindowSafeAreaInsets: () => initialWindowSafeAreaInsets
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(InitialWindow_exports);
|
|
29
|
+
var initialWindowMetrics = null;
|
|
30
|
+
var initialWindowSafeAreaInsets = null;
|
|
@@ -5,29 +5,28 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
12
|
};
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
21
|
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
23
|
var InitialWindow_exports = {};
|
|
26
24
|
__export(InitialWindow_exports, {
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
initialWindowMetrics: () => initialWindowMetrics,
|
|
26
|
+
initialWindowSafeAreaInsets: () => initialWindowSafeAreaInsets
|
|
29
27
|
});
|
|
30
28
|
module.exports = __toCommonJS(InitialWindow_exports);
|
|
31
29
|
var initialWindowMetrics = null;
|
|
32
30
|
var initialWindowSafeAreaInsets = null;
|
|
31
|
+
|
|
33
32
|
//# sourceMappingURL=InitialWindow.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"InitialWindow.native.js","names":[],"sources":["cjs/InitialWindow.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 InitialWindow_exports = {};\n__export(InitialWindow_exports, {\n initialWindowMetrics: () => initialWindowMetrics,\n initialWindowSafeAreaInsets: () => initialWindowSafeAreaInsets\n});\nmodule.exports = __toCommonJS(InitialWindow_exports);\nvar initialWindowMetrics = null;\nvar initialWindowSafeAreaInsets = null;\n//# sourceMappingURL=InitialWindow.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,wBAAwB,CAAC;AAC7B,SAAS,uBAAuB;CAC9B,4BAA4B;CAC5B,mCAAmC;AACrC,CAAC;AACD,OAAO,UAAU,aAAa,qBAAqB;AACnD,IAAI,uBAAuB;AAC3B,IAAI,8BAA8B"}
|
|
@@ -5,158 +5,132 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
12
|
};
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
21
|
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
-
value: mod,
|
|
29
|
-
enumerable: true
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
30
25
|
}) : target, mod));
|
|
31
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: true
|
|
33
|
-
}), mod);
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
27
|
var NativeSafeAreaProvider_exports = {};
|
|
35
|
-
__export(NativeSafeAreaProvider_exports, {
|
|
36
|
-
NativeSafeAreaProvider: () => NativeSafeAreaProvider
|
|
37
|
-
});
|
|
28
|
+
__export(NativeSafeAreaProvider_exports, { NativeSafeAreaProvider: () => NativeSafeAreaProvider });
|
|
38
29
|
module.exports = __toCommonJS(NativeSafeAreaProvider_exports);
|
|
39
30
|
var React = __toESM(require("react"), 1);
|
|
40
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
32
|
const CSSTransitions = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
WebkitTransition: "webkitTransitionEnd",
|
|
34
|
+
Transition: "transitionEnd",
|
|
35
|
+
MozTransition: "transitionend",
|
|
36
|
+
MSTransition: "msTransitionEnd",
|
|
37
|
+
OTransition: "oTransitionEnd"
|
|
47
38
|
};
|
|
48
|
-
function NativeSafeAreaProvider({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const styleValues = Array.isArray(styleValue) ? styleValue.flat(Number.POSITIVE_INFINITY) : [styleValue];
|
|
95
|
-
const flattenedStyle = styleValues.reduce((result, value) => value && typeof value === "object" ? Object.assign(result, value) : result, {});
|
|
96
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)("div", {
|
|
97
|
-
style: flattenedStyle,
|
|
98
|
-
children
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)("div", {
|
|
102
|
-
style: {
|
|
103
|
-
display: "contents"
|
|
104
|
-
},
|
|
105
|
-
children
|
|
106
|
-
});
|
|
39
|
+
function NativeSafeAreaProvider({ children, style, onInsetsChange }) {
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
if (typeof document === "undefined") {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const element = createContextElement();
|
|
45
|
+
document.body.appendChild(element);
|
|
46
|
+
const onEnd = () => {
|
|
47
|
+
const { paddingTop, paddingBottom, paddingLeft, paddingRight } = window.getComputedStyle(element);
|
|
48
|
+
const insets = {
|
|
49
|
+
top: paddingTop ? Number.parseInt(paddingTop, 10) : 0,
|
|
50
|
+
bottom: paddingBottom ? Number.parseInt(paddingBottom, 10) : 0,
|
|
51
|
+
left: paddingLeft ? Number.parseInt(paddingLeft, 10) : 0,
|
|
52
|
+
right: paddingRight ? Number.parseInt(paddingRight, 10) : 0
|
|
53
|
+
};
|
|
54
|
+
const frame = {
|
|
55
|
+
x: 0,
|
|
56
|
+
y: 0,
|
|
57
|
+
width: document.documentElement.offsetWidth,
|
|
58
|
+
height: document.documentElement.offsetHeight
|
|
59
|
+
};
|
|
60
|
+
onInsetsChange({ nativeEvent: {
|
|
61
|
+
insets,
|
|
62
|
+
frame
|
|
63
|
+
} });
|
|
64
|
+
};
|
|
65
|
+
element.addEventListener(getSupportedTransitionEvent(), onEnd);
|
|
66
|
+
onEnd();
|
|
67
|
+
return () => {
|
|
68
|
+
document.body.removeChild(element);
|
|
69
|
+
element.removeEventListener(getSupportedTransitionEvent(), onEnd);
|
|
70
|
+
};
|
|
71
|
+
}, [onInsetsChange]);
|
|
72
|
+
if (style) {
|
|
73
|
+
const styleValue = style;
|
|
74
|
+
const styleValues = Array.isArray(styleValue) ? styleValue.flat(Number.POSITIVE_INFINITY) : [styleValue];
|
|
75
|
+
const flattenedStyle = styleValues.reduce((result, value) => value && typeof value === "object" ? Object.assign(result, value) : result, {});
|
|
76
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
77
|
+
style: flattenedStyle,
|
|
78
|
+
children
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
82
|
+
style: { display: "contents" },
|
|
83
|
+
children
|
|
84
|
+
});
|
|
107
85
|
}
|
|
108
86
|
let _supportedTransitionEvent = null;
|
|
109
87
|
function getSupportedTransitionEvent() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
88
|
+
if (_supportedTransitionEvent != null) {
|
|
89
|
+
return _supportedTransitionEvent;
|
|
90
|
+
}
|
|
91
|
+
const element = document.createElement("invalidtype");
|
|
92
|
+
_supportedTransitionEvent = CSSTransitions.Transition;
|
|
93
|
+
for (const key in CSSTransitions) {
|
|
94
|
+
if (element.style[key] !== void 0) {
|
|
95
|
+
_supportedTransitionEvent = CSSTransitions[key];
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return _supportedTransitionEvent;
|
|
122
100
|
}
|
|
123
101
|
let _supportedEnv = null;
|
|
124
102
|
function getSupportedEnv() {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
return _supportedEnv;
|
|
103
|
+
if (_supportedEnv !== null) {
|
|
104
|
+
return _supportedEnv;
|
|
105
|
+
}
|
|
106
|
+
const { CSS } = window;
|
|
107
|
+
if (CSS && CSS.supports && CSS.supports("top: constant(safe-area-inset-top)")) {
|
|
108
|
+
_supportedEnv = "constant";
|
|
109
|
+
} else {
|
|
110
|
+
_supportedEnv = "env";
|
|
111
|
+
}
|
|
112
|
+
return _supportedEnv;
|
|
137
113
|
}
|
|
138
114
|
function getInset(side) {
|
|
139
|
-
|
|
115
|
+
return `${getSupportedEnv()}(safe-area-inset-${side})`;
|
|
140
116
|
}
|
|
141
117
|
function createContextElement() {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return element;
|
|
162
|
-
}
|
|
118
|
+
const element = document.createElement("div");
|
|
119
|
+
const { style } = element;
|
|
120
|
+
style.position = "fixed";
|
|
121
|
+
style.left = "0";
|
|
122
|
+
style.top = "0";
|
|
123
|
+
style.width = "0";
|
|
124
|
+
style.height = "0";
|
|
125
|
+
style.zIndex = "-1";
|
|
126
|
+
style.overflow = "hidden";
|
|
127
|
+
style.visibility = "hidden";
|
|
128
|
+
style.transitionDuration = "0.05s";
|
|
129
|
+
style.transitionProperty = "padding";
|
|
130
|
+
style.transitionDelay = "0s";
|
|
131
|
+
style.paddingTop = getInset("top");
|
|
132
|
+
style.paddingBottom = getInset("bottom");
|
|
133
|
+
style.paddingLeft = getInset("left");
|
|
134
|
+
style.paddingRight = getInset("right");
|
|
135
|
+
return element;
|
|
136
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
27
|
+
}) : target, mod));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var NativeSafeAreaProvider_exports = {};
|
|
30
|
+
__export(NativeSafeAreaProvider_exports, { NativeSafeAreaProvider: () => NativeSafeAreaProvider });
|
|
31
|
+
module.exports = __toCommonJS(NativeSafeAreaProvider_exports);
|
|
32
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
var React = __toESM(require("react"), 1);
|
|
34
|
+
var CSSTransitions = {
|
|
35
|
+
WebkitTransition: "webkitTransitionEnd",
|
|
36
|
+
Transition: "transitionEnd",
|
|
37
|
+
MozTransition: "transitionend",
|
|
38
|
+
MSTransition: "msTransitionEnd",
|
|
39
|
+
OTransition: "oTransitionEnd"
|
|
40
|
+
};
|
|
41
|
+
function NativeSafeAreaProvider(param) {
|
|
42
|
+
var { children, style, onInsetsChange } = param;
|
|
43
|
+
React.useEffect(function() {
|
|
44
|
+
if (typeof document === "undefined") {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
var element = createContextElement();
|
|
48
|
+
document.body.appendChild(element);
|
|
49
|
+
var onEnd = function() {
|
|
50
|
+
var { paddingTop, paddingBottom, paddingLeft, paddingRight } = window.getComputedStyle(element);
|
|
51
|
+
var insets = {
|
|
52
|
+
top: paddingTop ? Number.parseInt(paddingTop, 10) : 0,
|
|
53
|
+
bottom: paddingBottom ? Number.parseInt(paddingBottom, 10) : 0,
|
|
54
|
+
left: paddingLeft ? Number.parseInt(paddingLeft, 10) : 0,
|
|
55
|
+
right: paddingRight ? Number.parseInt(paddingRight, 10) : 0
|
|
56
|
+
};
|
|
57
|
+
var frame = {
|
|
58
|
+
x: 0,
|
|
59
|
+
y: 0,
|
|
60
|
+
width: document.documentElement.offsetWidth,
|
|
61
|
+
height: document.documentElement.offsetHeight
|
|
62
|
+
};
|
|
63
|
+
onInsetsChange({ nativeEvent: {
|
|
64
|
+
insets,
|
|
65
|
+
frame
|
|
66
|
+
} });
|
|
67
|
+
};
|
|
68
|
+
element.addEventListener(getSupportedTransitionEvent(), onEnd);
|
|
69
|
+
onEnd();
|
|
70
|
+
return function() {
|
|
71
|
+
document.body.removeChild(element);
|
|
72
|
+
element.removeEventListener(getSupportedTransitionEvent(), onEnd);
|
|
73
|
+
};
|
|
74
|
+
}, [onInsetsChange]);
|
|
75
|
+
if (style) {
|
|
76
|
+
var styleValue = style;
|
|
77
|
+
var styleValues = Array.isArray(styleValue) ? styleValue.flat(Number.POSITIVE_INFINITY) : [styleValue];
|
|
78
|
+
var flattenedStyle = styleValues.reduce(function(result, value) {
|
|
79
|
+
return value && typeof value === "object" ? Object.assign(result, value) : result;
|
|
80
|
+
}, {});
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
82
|
+
style: flattenedStyle,
|
|
83
|
+
children
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
87
|
+
style: { display: "contents" },
|
|
88
|
+
children
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
var _supportedTransitionEvent = null;
|
|
92
|
+
function getSupportedTransitionEvent() {
|
|
93
|
+
if (_supportedTransitionEvent != null) {
|
|
94
|
+
return _supportedTransitionEvent;
|
|
95
|
+
}
|
|
96
|
+
var element = document.createElement("invalidtype");
|
|
97
|
+
_supportedTransitionEvent = CSSTransitions.Transition;
|
|
98
|
+
for (var key in CSSTransitions) {
|
|
99
|
+
if (element.style[key] !== void 0) {
|
|
100
|
+
_supportedTransitionEvent = CSSTransitions[key];
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return _supportedTransitionEvent;
|
|
105
|
+
}
|
|
106
|
+
var _supportedEnv = null;
|
|
107
|
+
function getSupportedEnv() {
|
|
108
|
+
if (_supportedEnv !== null) {
|
|
109
|
+
return _supportedEnv;
|
|
110
|
+
}
|
|
111
|
+
var { CSS } = window;
|
|
112
|
+
if (CSS && CSS.supports && CSS.supports("top: constant(safe-area-inset-top)")) {
|
|
113
|
+
_supportedEnv = "constant";
|
|
114
|
+
} else {
|
|
115
|
+
_supportedEnv = "env";
|
|
116
|
+
}
|
|
117
|
+
return _supportedEnv;
|
|
118
|
+
}
|
|
119
|
+
function getInset(side) {
|
|
120
|
+
return `${getSupportedEnv()}(safe-area-inset-${side})`;
|
|
121
|
+
}
|
|
122
|
+
function createContextElement() {
|
|
123
|
+
var element = document.createElement("div");
|
|
124
|
+
var { style } = element;
|
|
125
|
+
style.position = "fixed";
|
|
126
|
+
style.left = "0";
|
|
127
|
+
style.top = "0";
|
|
128
|
+
style.width = "0";
|
|
129
|
+
style.height = "0";
|
|
130
|
+
style.zIndex = "-1";
|
|
131
|
+
style.overflow = "hidden";
|
|
132
|
+
style.visibility = "hidden";
|
|
133
|
+
style.transitionDuration = "0.05s";
|
|
134
|
+
style.transitionProperty = "padding";
|
|
135
|
+
style.transitionDelay = "0s";
|
|
136
|
+
style.paddingTop = getInset("top");
|
|
137
|
+
style.paddingBottom = getInset("bottom");
|
|
138
|
+
style.paddingLeft = getInset("left");
|
|
139
|
+
style.paddingRight = getInset("right");
|
|
140
|
+
return element;
|
|
141
|
+
}
|