@tamagui/react-native-media-driver 2.7.7 → 3.0.0-beta.1097.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/dist/cjs/index.cjs +9 -12
- package/dist/cjs/index.native.cjs +20 -0
- package/dist/cjs/index.native.js +9 -11
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/matchMedia.cjs +14 -18
- package/dist/cjs/matchMedia.native.cjs +29 -0
- package/dist/cjs/matchMedia.native.js +16 -19
- package/dist/cjs/matchMedia.native.js.map +1 -1
- package/dist/cjs/matchQuery.cjs +114 -132
- package/dist/cjs/matchQuery.native.cjs +144 -0
- package/dist/cjs/matchQuery.native.js +116 -133
- package/dist/cjs/matchQuery.native.js.map +1 -1
- package/dist/cjs/mediaQueryList.native.cjs +179 -0
- package/dist/cjs/mediaQueryList.native.js +159 -112
- package/dist/cjs/mediaQueryList.native.js.map +1 -1
- package/dist/esm/index.js +1 -3
- package/dist/esm/index.mjs +1 -3
- package/dist/esm/index.native.js +1 -3
- package/dist/esm/matchMedia.mjs +1 -0
- package/dist/esm/matchMedia.mjs.map +1 -1
- package/dist/esm/matchMedia.native.js +4 -2
- package/dist/esm/matchMedia.native.js.map +1 -1
- package/dist/esm/matchQuery.mjs +100 -115
- package/dist/esm/matchQuery.mjs.map +1 -1
- package/dist/esm/matchQuery.native.js +102 -117
- package/dist/esm/matchQuery.native.js.map +1 -1
- package/dist/esm/mediaQueryList.native.js +146 -94
- package/dist/esm/mediaQueryList.native.js.map +1 -1
- package/package.json +7 -4
- package/src/index.ts +0 -1
- package/src/matchMedia.native.ts +1 -1
- package/src/mediaQueryList.native.ts +115 -0
- package/types/index.d.ts +0 -1
- package/types/index.d.ts.map +2 -2
- package/types/matchMedia.native.d.ts.map +1 -1
- package/types/{mediaQueryList.d.ts → mediaQueryList.native.d.ts} +3 -3
- package/types/mediaQueryList.native.d.ts.map +11 -0
- package/dist/cjs/createMedia.cjs +0 -33
- package/dist/cjs/createMedia.native.js +0 -36
- package/dist/cjs/createMedia.native.js.map +0 -1
- package/dist/cjs/mediaQueryList.cjs +0 -78
- package/dist/esm/createMedia.mjs +0 -8
- package/dist/esm/createMedia.mjs.map +0 -1
- package/dist/esm/createMedia.native.js +0 -8
- package/dist/esm/createMedia.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/dist/esm/mediaQueryList.mjs +0 -53
- package/dist/esm/mediaQueryList.mjs.map +0 -1
- package/src/createMedia.ts +0 -19
- package/src/mediaQueryList.ts +0 -60
- package/types/createMedia.d.ts +0 -10
- package/types/createMedia.d.ts.map +0 -11
- package/types/mediaQueryList.d.ts.map +0 -11
|
@@ -5,27 +5,25 @@ 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 matchQuery_exports = {};
|
|
26
24
|
__export(matchQuery_exports, {
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
matchQuery: () => matchQuery,
|
|
26
|
+
parseQuery: () => parseQuery
|
|
29
27
|
});
|
|
30
28
|
module.exports = __toCommonJS(matchQuery_exports);
|
|
31
29
|
var RE_MEDIA_QUERY = /(?:(only|not)?\s*([^\s()]+)(?:\s*and)?\s*)?(.+)?/i;
|
|
@@ -34,130 +32,115 @@ var RE_MQ_FEATURE = /^(?:(min|max)-)?(.+)/;
|
|
|
34
32
|
var RE_LENGTH_UNIT = /(em|rem|px|cm|mm|in|pt|pc)?$/;
|
|
35
33
|
var RE_RESOLUTION_UNIT = /(dpi|dpcm|dppx)?$/;
|
|
36
34
|
function matchQuery(mediaQuery, values) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
return value === expValue;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
return expressionsMatch && !inverse || !expressionsMatch && inverse;
|
|
92
|
-
});
|
|
35
|
+
return parseQuery(mediaQuery).some(function(query) {
|
|
36
|
+
if (!query) return;
|
|
37
|
+
var inverse = query.inverse;
|
|
38
|
+
var typeMatch = query.type === "all" || values.type === query.type;
|
|
39
|
+
if (typeMatch && inverse || !(typeMatch || inverse)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
var expressionsMatch = query.expressions.every(function(expression) {
|
|
43
|
+
var feature = expression.feature;
|
|
44
|
+
var modifier = expression.modifier;
|
|
45
|
+
var expValue = expression.value;
|
|
46
|
+
var value = values[feature];
|
|
47
|
+
if (!value) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
switch (feature) {
|
|
51
|
+
case "orientation":
|
|
52
|
+
case "scan": return value.toLowerCase() === expValue.toLowerCase();
|
|
53
|
+
case "width":
|
|
54
|
+
case "height":
|
|
55
|
+
case "device-width":
|
|
56
|
+
case "device-height":
|
|
57
|
+
expValue = toPx(expValue);
|
|
58
|
+
value = toPx(value);
|
|
59
|
+
break;
|
|
60
|
+
case "resolution":
|
|
61
|
+
expValue = toDpi(expValue);
|
|
62
|
+
value = toDpi(value);
|
|
63
|
+
break;
|
|
64
|
+
case "aspect-ratio":
|
|
65
|
+
case "device-aspect-ratio":
|
|
66
|
+
case "device-pixel-ratio":
|
|
67
|
+
expValue = toDecimal(expValue);
|
|
68
|
+
value = toDecimal(value);
|
|
69
|
+
break;
|
|
70
|
+
case "grid":
|
|
71
|
+
case "color":
|
|
72
|
+
case "color-index":
|
|
73
|
+
case "monochrome":
|
|
74
|
+
expValue = Number.parseInt(expValue, 10) || 1;
|
|
75
|
+
value = Number.parseInt(value, 10) || 0;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
switch (modifier) {
|
|
79
|
+
case "min": return value >= expValue;
|
|
80
|
+
case "max": return value <= expValue;
|
|
81
|
+
default: return value === expValue;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return expressionsMatch && !inverse || !expressionsMatch && inverse;
|
|
85
|
+
});
|
|
93
86
|
}
|
|
94
87
|
function parseQuery(mediaQuery) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
88
|
+
return mediaQuery.split(",").map(function(query) {
|
|
89
|
+
query = query.trim();
|
|
90
|
+
var captures = query.match(RE_MEDIA_QUERY);
|
|
91
|
+
if (!captures) return null;
|
|
92
|
+
var modifier = captures[1];
|
|
93
|
+
var type = captures[2];
|
|
94
|
+
var expressionsCapture = captures[3] || "";
|
|
95
|
+
var expressions = expressionsCapture.match(/\([^)]+\)/g) || [];
|
|
96
|
+
return {
|
|
97
|
+
inverse: !!modifier && modifier.toLowerCase() === "not",
|
|
98
|
+
type: type ? type.toLowerCase() : "all",
|
|
99
|
+
expressions: expressions.map(function(expression) {
|
|
100
|
+
var captures2 = expression.match(RE_MQ_EXPRESSION);
|
|
101
|
+
var feature = captures2[1].toLowerCase().match(RE_MQ_FEATURE);
|
|
102
|
+
return {
|
|
103
|
+
modifier: feature[1],
|
|
104
|
+
feature: feature[2],
|
|
105
|
+
value: captures2[2]
|
|
106
|
+
};
|
|
107
|
+
})
|
|
108
|
+
};
|
|
109
|
+
});
|
|
117
110
|
}
|
|
118
111
|
function toDecimal(ratio) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
112
|
+
var decimal = Number(ratio);
|
|
113
|
+
var numbers;
|
|
114
|
+
if (!decimal) {
|
|
115
|
+
numbers = ratio.match(/^(\d+)\s*\/\s*(\d+)$/);
|
|
116
|
+
decimal = numbers[1] / numbers[2];
|
|
117
|
+
}
|
|
118
|
+
return decimal;
|
|
126
119
|
}
|
|
127
120
|
function toDpi(resolution) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
default:
|
|
137
|
-
return value;
|
|
138
|
-
}
|
|
121
|
+
var _String_match;
|
|
122
|
+
var value = Number.parseFloat(resolution);
|
|
123
|
+
var units = (_String_match = String(resolution).match(RE_RESOLUTION_UNIT)) === null || _String_match === void 0 ? void 0 : _String_match[1];
|
|
124
|
+
switch (units) {
|
|
125
|
+
case "dpcm": return value / 2.54;
|
|
126
|
+
case "dppx": return value * 96;
|
|
127
|
+
default: return value;
|
|
128
|
+
}
|
|
139
129
|
}
|
|
140
130
|
function toPx(length) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return value * 96;
|
|
155
|
-
case "pt":
|
|
156
|
-
return value * 72;
|
|
157
|
-
case "pc":
|
|
158
|
-
return value * 72 / 12;
|
|
159
|
-
default:
|
|
160
|
-
return value;
|
|
161
|
-
}
|
|
131
|
+
var _String_match;
|
|
132
|
+
var value = Number.parseFloat(length);
|
|
133
|
+
var units = (_String_match = String(length).match(RE_LENGTH_UNIT)) === null || _String_match === void 0 ? void 0 : _String_match[1];
|
|
134
|
+
switch (units) {
|
|
135
|
+
case "em": return value * 16;
|
|
136
|
+
case "rem": return value * 16;
|
|
137
|
+
case "cm": return value * 96 / 2.54;
|
|
138
|
+
case "mm": return value * 96 / 2.54 / 10;
|
|
139
|
+
case "in": return value * 96;
|
|
140
|
+
case "pt": return value * 72;
|
|
141
|
+
case "pc": return value * 72 / 12;
|
|
142
|
+
default: return value;
|
|
143
|
+
}
|
|
162
144
|
}
|
|
145
|
+
|
|
163
146
|
//# sourceMappingURL=matchQuery.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"matchQuery.native.js","names":[],"sources":["cjs/matchQuery.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 matchQuery_exports = {};\n__export(matchQuery_exports, {\n matchQuery: () => matchQuery,\n parseQuery: () => parseQuery\n});\nmodule.exports = __toCommonJS(matchQuery_exports);\nvar RE_MEDIA_QUERY = /(?:(only|not)?\\s*([^\\s()]+)(?:\\s*and)?\\s*)?(.+)?/i;\nvar RE_MQ_EXPRESSION = /\\(\\s*([^\\s:)]+)\\s*(?::\\s*([^\\s)]+))?\\s*\\)/;\nvar RE_MQ_FEATURE = /^(?:(min|max)-)?(.+)/;\nvar RE_LENGTH_UNIT = /(em|rem|px|cm|mm|in|pt|pc)?$/;\nvar RE_RESOLUTION_UNIT = /(dpi|dpcm|dppx)?$/;\nfunction matchQuery(mediaQuery, values) {\n return parseQuery(mediaQuery).some(function(query) {\n if (!query) return;\n var inverse = query.inverse;\n var typeMatch = query.type === \"all\" || values.type === query.type;\n if (typeMatch && inverse || !(typeMatch || inverse)) {\n return false;\n }\n var expressionsMatch = query.expressions.every(function(expression) {\n var feature = expression.feature;\n var modifier = expression.modifier;\n var expValue = expression.value;\n var value = values[feature];\n if (!value) {\n return false;\n }\n switch (feature) {\n case \"orientation\":\n case \"scan\":\n return value.toLowerCase() === expValue.toLowerCase();\n case \"width\":\n case \"height\":\n case \"device-width\":\n case \"device-height\":\n expValue = toPx(expValue);\n value = toPx(value);\n break;\n case \"resolution\":\n expValue = toDpi(expValue);\n value = toDpi(value);\n break;\n case \"aspect-ratio\":\n case \"device-aspect-ratio\":\n case /* Deprecated */\n \"device-pixel-ratio\":\n expValue = toDecimal(expValue);\n value = toDecimal(value);\n break;\n case \"grid\":\n case \"color\":\n case \"color-index\":\n case \"monochrome\":\n expValue = Number.parseInt(expValue, 10) || 1;\n value = Number.parseInt(value, 10) || 0;\n break;\n }\n switch (modifier) {\n case \"min\":\n return value >= expValue;\n case \"max\":\n return value <= expValue;\n default:\n return value === expValue;\n }\n });\n return expressionsMatch && !inverse || !expressionsMatch && inverse;\n });\n}\nfunction parseQuery(mediaQuery) {\n return mediaQuery.split(\",\").map(function(query) {\n query = query.trim();\n var captures = query.match(RE_MEDIA_QUERY);\n if (!captures) return null;\n var modifier = captures[1];\n var type = captures[2];\n var expressionsCapture = captures[3] || \"\";\n var expressions = expressionsCapture.match(/\\([^)]+\\)/g) || [];\n return {\n inverse: !!modifier && modifier.toLowerCase() === \"not\",\n type: type ? type.toLowerCase() : \"all\",\n expressions: expressions.map(function(expression) {\n var captures2 = expression.match(RE_MQ_EXPRESSION);\n var feature = captures2[1].toLowerCase().match(RE_MQ_FEATURE);\n return {\n modifier: feature[1],\n feature: feature[2],\n value: captures2[2]\n };\n })\n };\n });\n}\nfunction toDecimal(ratio) {\n var decimal = Number(ratio);\n var numbers;\n if (!decimal) {\n numbers = ratio.match(/^(\\d+)\\s*\\/\\s*(\\d+)$/);\n decimal = numbers[1] / numbers[2];\n }\n return decimal;\n}\nfunction toDpi(resolution) {\n var _String_match;\n var value = Number.parseFloat(resolution);\n var units = (_String_match = String(resolution).match(RE_RESOLUTION_UNIT)) === null || _String_match === void 0 ? void 0 : _String_match[1];\n switch (units) {\n case \"dpcm\":\n return value / 2.54;\n case \"dppx\":\n return value * 96;\n default:\n return value;\n }\n}\nfunction toPx(length) {\n var _String_match;\n var value = Number.parseFloat(length);\n var units = (_String_match = String(length).match(RE_LENGTH_UNIT)) === null || _String_match === void 0 ? void 0 : _String_match[1];\n switch (units) {\n case \"em\":\n return value * 16;\n case \"rem\":\n return value * 16;\n case \"cm\":\n return value * 96 / 2.54;\n case \"mm\":\n return value * 96 / 2.54 / 10;\n case \"in\":\n return value * 96;\n case \"pt\":\n return value * 72;\n case \"pc\":\n return value * 72 / 12;\n default:\n return value;\n }\n}\n//# sourceMappingURL=matchQuery.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,qBAAqB,CAAC;AAC1B,SAAS,oBAAoB;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pC,IAAI,SAAS,gBAAgB,OAAO,MAAM,CAAC,CAAC,MAAM,cAAc,OAAO,QAAQ,kBAAkB,KAAK,IAAI,KAAK,IAAI,cAAc;CACjI,QAAQ,OAAR;EACE,KAAK,MACH,OAAO,QAAQ;EACjB,KAAK,OACH,OAAO,QAAQ;EACjB,KAAK,MACH,OAAO,QAAQ,KAAK;EACtB,KAAK,MACH,OAAO,QAAQ,KAAK,OAAO;EAC7B,KAAK,MACH,OAAO,QAAQ;EACjB,KAAK,MACH,OAAO,QAAQ;EACjB,KAAK,MACH,OAAO,QAAQ,KAAK;EACtB,SACE,OAAO;CACX;AACF"}
|
|
@@ -0,0 +1,179 @@
|
|
|
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 mediaQueryList_native_exports = {};
|
|
24
|
+
__export(mediaQueryList_native_exports, { NativeMediaQueryList: () => NativeMediaQueryList });
|
|
25
|
+
module.exports = __toCommonJS(mediaQueryList_native_exports);
|
|
26
|
+
var import_react_native = require("react-native");
|
|
27
|
+
var import_matchQuery = require("./matchQuery.native.js");
|
|
28
|
+
function _class_call_check(instance, Constructor) {
|
|
29
|
+
if (!(instance instanceof Constructor)) {
|
|
30
|
+
throw new TypeError("Cannot call a class as a function");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function _defineProperties(target, props) {
|
|
34
|
+
for (var i = 0; i < props.length; i++) {
|
|
35
|
+
var descriptor = props[i];
|
|
36
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
37
|
+
descriptor.configurable = true;
|
|
38
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
39
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
43
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
44
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
45
|
+
return Constructor;
|
|
46
|
+
}
|
|
47
|
+
function _define_property(obj, key, value) {
|
|
48
|
+
if (key in obj) {
|
|
49
|
+
Object.defineProperty(obj, key, {
|
|
50
|
+
value,
|
|
51
|
+
enumerable: true,
|
|
52
|
+
configurable: true,
|
|
53
|
+
writable: true
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
obj[key] = value;
|
|
57
|
+
}
|
|
58
|
+
return obj;
|
|
59
|
+
}
|
|
60
|
+
var REDUCED_MOTION_RE = /\(\s*prefers-reduced-motion\s*:\s*([a-z-]+)\s*\)/i;
|
|
61
|
+
var reducedMotionEnabled = false;
|
|
62
|
+
var reducedMotionInitialized = false;
|
|
63
|
+
var reducedMotionListeners = /* @__PURE__ */ new Set();
|
|
64
|
+
function ensureReducedMotionSubscription() {
|
|
65
|
+
var _AccessibilityInfo_isReduceMotionEnabled, _AccessibilityInfo_addEventListener;
|
|
66
|
+
if (reducedMotionInitialized) return;
|
|
67
|
+
reducedMotionInitialized = true;
|
|
68
|
+
(_AccessibilityInfo_isReduceMotionEnabled = import_react_native.AccessibilityInfo.isReduceMotionEnabled) === null || _AccessibilityInfo_isReduceMotionEnabled === void 0 ? void 0 : _AccessibilityInfo_isReduceMotionEnabled.call(import_react_native.AccessibilityInfo).then(function(value) {
|
|
69
|
+
if (value !== reducedMotionEnabled) {
|
|
70
|
+
reducedMotionEnabled = value;
|
|
71
|
+
reducedMotionListeners.forEach(function(cb) {
|
|
72
|
+
return cb();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}).catch(function() {});
|
|
76
|
+
(_AccessibilityInfo_addEventListener = import_react_native.AccessibilityInfo.addEventListener) === null || _AccessibilityInfo_addEventListener === void 0 ? void 0 : _AccessibilityInfo_addEventListener.call(import_react_native.AccessibilityInfo, "reduceMotionChanged", function(value) {
|
|
77
|
+
if (value === reducedMotionEnabled) return;
|
|
78
|
+
reducedMotionEnabled = value;
|
|
79
|
+
reducedMotionListeners.forEach(function(cb) {
|
|
80
|
+
return cb();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
var NativeMediaQueryList = /* @__PURE__ */ (function() {
|
|
85
|
+
"use strict";
|
|
86
|
+
function NativeMediaQueryList2(query) {
|
|
87
|
+
var _this = this;
|
|
88
|
+
_class_call_check(this, NativeMediaQueryList2);
|
|
89
|
+
_define_property(this, "query", void 0);
|
|
90
|
+
_define_property(this, "listeners", void 0);
|
|
91
|
+
_define_property(this, "reducedMotionExpected", void 0);
|
|
92
|
+
this.query = query;
|
|
93
|
+
this.listeners = [];
|
|
94
|
+
this.reducedMotionExpected = null;
|
|
95
|
+
var reducedMotionMatch = query.match(REDUCED_MOTION_RE);
|
|
96
|
+
if (reducedMotionMatch) {
|
|
97
|
+
this.reducedMotionExpected = reducedMotionMatch[1];
|
|
98
|
+
ensureReducedMotionSubscription();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
this.notify();
|
|
102
|
+
import_react_native.Dimensions.addEventListener("change", function() {
|
|
103
|
+
_this.notify();
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
_create_class(NativeMediaQueryList2, [
|
|
107
|
+
{
|
|
108
|
+
key: "orientation",
|
|
109
|
+
get: function get() {
|
|
110
|
+
var windowDimensions = import_react_native.Dimensions.get("window");
|
|
111
|
+
return windowDimensions.height > windowDimensions.width ? "portrait" : "landscape";
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
key: "notify",
|
|
116
|
+
value: function notify() {
|
|
117
|
+
this.listeners.forEach(function(listener) {
|
|
118
|
+
listener();
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
key: "addListener",
|
|
124
|
+
value: function addListener(listener) {
|
|
125
|
+
if (this.reducedMotionExpected) {
|
|
126
|
+
reducedMotionListeners.add(listener);
|
|
127
|
+
this.listeners.push(listener);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
this.listeners.push(listener);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
key: "removeListener",
|
|
135
|
+
value: function removeListener(listener) {
|
|
136
|
+
if (this.reducedMotionExpected) {
|
|
137
|
+
reducedMotionListeners.delete(listener);
|
|
138
|
+
}
|
|
139
|
+
var index = this.listeners.indexOf(listener);
|
|
140
|
+
if (index !== -1) this.listeners.splice(index, 1);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
key: "match",
|
|
145
|
+
value: function match(query, param) {
|
|
146
|
+
var { width, height } = param;
|
|
147
|
+
var reducedMotionMatch = query.match(REDUCED_MOTION_RE);
|
|
148
|
+
if (reducedMotionMatch) {
|
|
149
|
+
var expected = reducedMotionMatch[1];
|
|
150
|
+
return expected === "reduce" ? reducedMotionEnabled : !reducedMotionEnabled;
|
|
151
|
+
}
|
|
152
|
+
return (0, import_matchQuery.matchQuery)(query, {
|
|
153
|
+
type: "screen",
|
|
154
|
+
orientation: height > width ? "portrait" : "landscape",
|
|
155
|
+
"device-width": width,
|
|
156
|
+
"device-height": height
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
key: "matches",
|
|
162
|
+
get: function get() {
|
|
163
|
+
if (this.reducedMotionExpected) {
|
|
164
|
+
return this.reducedMotionExpected === "reduce" ? reducedMotionEnabled : !reducedMotionEnabled;
|
|
165
|
+
}
|
|
166
|
+
var windowDimensions = import_react_native.Dimensions.get("window");
|
|
167
|
+
var matches = (0, import_matchQuery.matchQuery)(this.query, {
|
|
168
|
+
type: "screen",
|
|
169
|
+
orientation: this.orientation,
|
|
170
|
+
...windowDimensions,
|
|
171
|
+
"device-width": windowDimensions.width,
|
|
172
|
+
"device-height": windowDimensions.height
|
|
173
|
+
});
|
|
174
|
+
return matches;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
]);
|
|
178
|
+
return NativeMediaQueryList2;
|
|
179
|
+
})();
|