@rootnative/web 0.0.0-alpha.2 → 0.0.0-alpha.3
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/CHANGELOG.md +46 -1
- package/dist/StyleRegistryContext-ROsMlY4O.js +8 -0
- package/dist/StyleRegistryContext-ROsMlY4O.js.map +1 -0
- package/dist/assets-registry/index.d.ts +18 -0
- package/dist/assets-registry/index.js +12 -0
- package/dist/assets-registry/index.js.map +1 -0
- package/dist/compile-CVUjQrR9.js +400 -0
- package/dist/compile-CVUjQrR9.js.map +1 -0
- package/dist/index.d.ts +675 -87
- package/dist/index.js +2269 -1276
- package/dist/index.js.map +1 -1
- package/dist/{StyleRegistryContext-CAD45r4n.js → registry-Aa_Od5m0.js} +31 -9
- package/dist/registry-Aa_Od5m0.js.map +1 -0
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.js +8 -4
- package/dist/server/index.js.map +1 -1
- package/dist/style/index.d.ts +25 -0
- package/dist/style/index.js +35 -0
- package/dist/style/index.js.map +1 -0
- package/dist/vite/index.d.ts +9 -1
- package/dist/vite/index.js +136 -41
- package/dist/vite/index.js.map +1 -1
- package/llms.txt +183 -22
- package/package.json +13 -1
- package/dist/StyleRegistryContext-CAD45r4n.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { i as matchesMedia, n as isProductionEnv, r as isTestEnv, t as hasDOM } from "./env-DK5Mt9yX.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as getStyleRegistry } from "./registry-Aa_Od5m0.js";
|
|
3
|
+
import { a as pointerEventsStyle, d as setLeftAndRightSwap, f as toCSSColor, i as joinClassNames, n as compileStyle, o as resolveStyle, r as flattenStyle, s as systemFontStack, t as compileReset, u as getLeftAndRightSwap } from "./compile-CVUjQrR9.js";
|
|
4
|
+
import { n as useStyleRegistry } from "./StyleRegistryContext-ROsMlY4O.js";
|
|
3
5
|
import normalizeColor from "@react-native/normalize-colors";
|
|
4
6
|
import { Children, Fragment, cloneElement, createContext, createElement, isValidElement, memo, useCallback, useContext, useEffect, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
5
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { createPortal } from "react-dom";
|
|
6
9
|
// src/apis/AccessibilityInfo/index.ts
|
|
7
10
|
const mediaQueryOf = {
|
|
8
11
|
reduceMotionChanged: "(prefers-reduced-motion: reduce)",
|
|
@@ -83,39 +86,285 @@ const AccessibilityInfo = {
|
|
|
83
86
|
if (eventType === "focus" && target instanceof HTMLElement) target.focus();
|
|
84
87
|
}
|
|
85
88
|
};
|
|
89
|
+
// src/utils/scrollLock.ts
|
|
90
|
+
let locks = 0;
|
|
91
|
+
let pageOverflow = "";
|
|
92
|
+
let pageX = 0;
|
|
93
|
+
let pageY = 0;
|
|
94
|
+
const keepPlace = () => {
|
|
95
|
+
const viewport = window.visualViewport;
|
|
96
|
+
if (viewport !== null && viewport.scale === 1 && viewport.offsetTop > 0) window.scrollTo(pageX, pageY);
|
|
97
|
+
};
|
|
98
|
+
const lockScroll = () => {
|
|
99
|
+
const root = document.documentElement;
|
|
100
|
+
if (locks++ === 0) {
|
|
101
|
+
pageOverflow = root.style.overflow;
|
|
102
|
+
pageX = window.scrollX;
|
|
103
|
+
pageY = window.scrollY;
|
|
104
|
+
root.style.overflow = "hidden";
|
|
105
|
+
window.visualViewport?.addEventListener("scroll", keepPlace);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const unlockScroll = () => {
|
|
109
|
+
if (--locks === 0) {
|
|
110
|
+
document.documentElement.style.overflow = pageOverflow;
|
|
111
|
+
window.visualViewport?.removeEventListener("scroll", keepPlace);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
// src/utils/warn.ts
|
|
115
|
+
const warned = /* @__PURE__ */ new Set();
|
|
116
|
+
const warnOnce = (key, message) => {
|
|
117
|
+
if (isProductionEnv() || warned.has(key)) return;
|
|
118
|
+
warned.add(key);
|
|
119
|
+
console.warn(`[@rootnative/web] ${message}`);
|
|
120
|
+
};
|
|
86
121
|
// src/apis/Appearance/index.ts
|
|
87
122
|
const DARK_QUERY = "(prefers-color-scheme: dark)";
|
|
88
123
|
let override = null;
|
|
89
|
-
let last = null;
|
|
124
|
+
let last$1 = null;
|
|
90
125
|
let mediaList = null;
|
|
91
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
126
|
+
const listeners$1 = /* @__PURE__ */ new Set();
|
|
92
127
|
const system = () => matchesMedia(DARK_QUERY) ? "dark" : "light";
|
|
93
|
-
const current$
|
|
94
|
-
const notify = () => {
|
|
95
|
-
const next = current$
|
|
96
|
-
if (next === last) return;
|
|
97
|
-
last = next;
|
|
98
|
-
for (const listener of listeners) listener({ colorScheme: next });
|
|
128
|
+
const current$3 = () => override ?? system();
|
|
129
|
+
const notify$1 = () => {
|
|
130
|
+
const next = current$3();
|
|
131
|
+
if (next === last$1) return;
|
|
132
|
+
last$1 = next;
|
|
133
|
+
for (const listener of listeners$1) listener({ colorScheme: next });
|
|
99
134
|
};
|
|
100
|
-
const listen$
|
|
135
|
+
const listen$2 = () => {
|
|
101
136
|
if (mediaList !== null || !hasDOM() || typeof window.matchMedia !== "function") return;
|
|
102
137
|
mediaList = window.matchMedia(DARK_QUERY);
|
|
103
|
-
mediaList.addEventListener("change", notify);
|
|
138
|
+
mediaList.addEventListener("change", notify$1);
|
|
104
139
|
};
|
|
105
140
|
const Appearance = {
|
|
106
141
|
getColorScheme() {
|
|
107
|
-
return current$
|
|
142
|
+
return current$3();
|
|
108
143
|
},
|
|
109
144
|
setColorScheme(scheme) {
|
|
110
145
|
override = scheme === "light" || scheme === "dark" ? scheme : null;
|
|
111
146
|
if (hasDOM()) document.documentElement.style.colorScheme = override ?? "";
|
|
112
|
-
notify();
|
|
147
|
+
notify$1();
|
|
113
148
|
},
|
|
114
149
|
addChangeListener(listener) {
|
|
115
|
-
if (listeners.size === 0) last = current$
|
|
116
|
-
listeners.add(listener);
|
|
150
|
+
if (listeners$1.size === 0) last$1 = current$3();
|
|
151
|
+
listeners$1.add(listener);
|
|
152
|
+
listen$2();
|
|
153
|
+
return { remove: () => listeners$1.delete(listener) };
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
// src/apis/Alert/index.ts
|
|
157
|
+
const ALERT = "rn-alert";
|
|
158
|
+
const RULES$3 = [
|
|
159
|
+
`.${ALERT}{position:fixed;inset:auto;top:50%;left:50%;z-index:2147483647;box-sizing:border-box;min-width:min(280px,calc(100% - 48px));max-width:min(560px,calc(100% - 48px));max-height:calc(100% - 48px);margin:0;padding:24px 24px 8px;overflow:auto;border:0;border-radius:2px;background:#fff;color:rgba(0,0,0,.87);font-family:${systemFontStack};box-shadow:0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14),0 9px 46px 8px rgba(0,0,0,.12);transform:translate(-50%,-50%)}`,
|
|
160
|
+
`.${ALERT}:not([open]){display:none}`,
|
|
161
|
+
`.${ALERT}:focus{outline:none}`,
|
|
162
|
+
`.${ALERT}-title{margin:0;font-size:20px;font-weight:500;line-height:1.3;overflow-wrap:break-word}`,
|
|
163
|
+
`.${ALERT}-message{margin:0;font-size:16px;line-height:1.5;color:rgba(0,0,0,.6);white-space:pre-wrap;overflow-wrap:break-word}`,
|
|
164
|
+
`.${ALERT}-title+.${ALERT}-message{margin-top:16px}`,
|
|
165
|
+
`.${ALERT}-buttons{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;margin:24px -16px 0}`,
|
|
166
|
+
`.${ALERT}-buttons[data-neutral]>:first-child{margin-inline-end:auto}`,
|
|
167
|
+
`.${ALERT}-button{min-width:64px;min-height:36px;padding:0 8px;border:0;border-radius:2px;background:transparent;color:#009688;font:inherit;font-size:14px;font-weight:500;cursor:pointer}`,
|
|
168
|
+
`.${ALERT}-button:hover{background:rgba(0,150,136,.08)}`,
|
|
169
|
+
`.${ALERT}-button[data-style=destructive]{color:#d32f2f}`,
|
|
170
|
+
`.${ALERT}[data-scheme=dark]{background:#424242;color:#fff}`,
|
|
171
|
+
`.${ALERT}[data-scheme=dark] .${ALERT}-message{color:rgba(255,255,255,.7)}`,
|
|
172
|
+
`.${ALERT}[data-scheme=dark] .${ALERT}-button{color:#80cbc4}`,
|
|
173
|
+
`.${ALERT}[data-scheme=dark] .${ALERT}-button[data-style=destructive]{color:#ef9a9a}`,
|
|
174
|
+
`@supports selector(:focus-visible){.${ALERT}-button:focus-visible{outline:2px solid currentColor;outline-offset:-2px}}`,
|
|
175
|
+
`@supports selector(::backdrop){.${ALERT}::backdrop{background:rgba(0,0,0,.6)}}`
|
|
176
|
+
];
|
|
177
|
+
const openAlerts = /* @__PURE__ */ new Set();
|
|
178
|
+
let nextId = 0;
|
|
179
|
+
const lastIndexOf = (list, test) => {
|
|
180
|
+
for (let index = list.length - 1; index >= 0; index--) {
|
|
181
|
+
const button = list[index];
|
|
182
|
+
if (button !== void 0 && test(button)) return index;
|
|
183
|
+
}
|
|
184
|
+
return -1;
|
|
185
|
+
};
|
|
186
|
+
const isOutside = (event, element) => {
|
|
187
|
+
const box = element.getBoundingClientRect();
|
|
188
|
+
return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
|
|
189
|
+
};
|
|
190
|
+
const show = (title, message, buttons, options) => {
|
|
191
|
+
if (!hasDOM()) return;
|
|
192
|
+
getStyleRegistry().staticClass(ALERT, RULES$3);
|
|
193
|
+
const id = `${ALERT}-${++nextId}`;
|
|
194
|
+
const dialog = document.createElement("dialog");
|
|
195
|
+
dialog.className = ALERT;
|
|
196
|
+
dialog.setAttribute("role", "alertdialog");
|
|
197
|
+
const style = options?.userInterfaceStyle;
|
|
198
|
+
dialog.dataset["scheme"] = style === "light" || style === "dark" ? style : Appearance.getColorScheme() ?? "light";
|
|
199
|
+
if (title) {
|
|
200
|
+
const heading = document.createElement("div");
|
|
201
|
+
heading.className = `${ALERT}-title`;
|
|
202
|
+
heading.id = `${id}-title`;
|
|
203
|
+
heading.textContent = title;
|
|
204
|
+
dialog.append(heading);
|
|
205
|
+
dialog.setAttribute("aria-labelledby", heading.id);
|
|
206
|
+
}
|
|
207
|
+
if (message) {
|
|
208
|
+
const body = document.createElement("div");
|
|
209
|
+
body.className = `${ALERT}-message`;
|
|
210
|
+
body.id = `${id}-message`;
|
|
211
|
+
body.textContent = message;
|
|
212
|
+
dialog.append(body);
|
|
213
|
+
dialog.setAttribute("aria-describedby", body.id);
|
|
214
|
+
}
|
|
215
|
+
const list = buttons === void 0 || buttons.length === 0 ? [{ text: "OK" }] : buttons;
|
|
216
|
+
const modal = typeof dialog.showModal === "function";
|
|
217
|
+
const focused = document.activeElement;
|
|
218
|
+
let closed = false;
|
|
219
|
+
const close = () => {
|
|
220
|
+
if (closed) return;
|
|
221
|
+
closed = true;
|
|
222
|
+
openAlerts.delete(entry);
|
|
223
|
+
if (modal) dialog.close();
|
|
224
|
+
else if (focused instanceof HTMLElement && focused.isConnected) focused.focus();
|
|
225
|
+
dialog.remove();
|
|
226
|
+
unlockScroll();
|
|
227
|
+
};
|
|
228
|
+
const entry = { close };
|
|
229
|
+
const press = (button) => {
|
|
230
|
+
close();
|
|
231
|
+
button.onPress?.();
|
|
232
|
+
};
|
|
233
|
+
const dismiss = () => {
|
|
234
|
+
close();
|
|
235
|
+
options?.onDismiss?.();
|
|
236
|
+
};
|
|
237
|
+
const cancel = () => {
|
|
238
|
+
const cancelButton = list[lastIndexOf(list, (button) => button.style === "cancel")];
|
|
239
|
+
if (cancelButton !== void 0) press(cancelButton);
|
|
240
|
+
else if (options?.cancelable === true) dismiss();
|
|
241
|
+
};
|
|
242
|
+
const row = document.createElement("div");
|
|
243
|
+
row.className = `${ALERT}-buttons`;
|
|
244
|
+
if (list.length >= 3) row.dataset["neutral"] = "";
|
|
245
|
+
const elements = list.map((button, index) => {
|
|
246
|
+
const element = document.createElement("button");
|
|
247
|
+
element.type = "button";
|
|
248
|
+
element.className = `${ALERT}-button`;
|
|
249
|
+
element.textContent = button.text || (index === list.length - 1 ? "OK" : "");
|
|
250
|
+
if (button.style === "destructive") element.dataset["style"] = "destructive";
|
|
251
|
+
element.addEventListener("click", () => press(button));
|
|
252
|
+
row.append(element);
|
|
253
|
+
return element;
|
|
254
|
+
});
|
|
255
|
+
dialog.append(row);
|
|
256
|
+
dialog.addEventListener("cancel", (event) => {
|
|
257
|
+
event.preventDefault();
|
|
258
|
+
cancel();
|
|
259
|
+
});
|
|
260
|
+
dialog.addEventListener("close", () => {
|
|
261
|
+
if (!closed) dialog.showModal();
|
|
262
|
+
});
|
|
263
|
+
dialog.addEventListener("click", (event) => {
|
|
264
|
+
if (event.target === dialog && isOutside(event, dialog) && options?.cancelable === true) dismiss();
|
|
265
|
+
});
|
|
266
|
+
if (!modal) dialog.addEventListener("keydown", (event) => {
|
|
267
|
+
if (event.key === "Escape") cancel();
|
|
268
|
+
});
|
|
269
|
+
document.body.append(dialog);
|
|
270
|
+
if (modal) dialog.showModal();
|
|
271
|
+
else dialog.setAttribute("open", "");
|
|
272
|
+
lockScroll();
|
|
273
|
+
openAlerts.add(entry);
|
|
274
|
+
const preferred = list.findIndex((button) => button.isPreferred === true);
|
|
275
|
+
const target = preferred >= 0 ? preferred : lastIndexOf(list, (button) => button.style === "cancel");
|
|
276
|
+
elements[target >= 0 ? target : 0]?.focus();
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* React Native's `Alert` on a `<dialog role="alertdialog">` with the look of Android's
|
|
280
|
+
* AlertDialog. It isn't part of the React tree, so it works from any handler.
|
|
281
|
+
*/
|
|
282
|
+
const Alert = {
|
|
283
|
+
alert: (title, message, buttons, options) => show(title, message, buttons, options),
|
|
284
|
+
prompt: () => {
|
|
285
|
+
warnOnce("alert-prompt", "Alert.prompt does nothing on the web yet, as on Android.");
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
// src/apis/AppState/index.ts
|
|
289
|
+
const handlers$2 = {
|
|
290
|
+
change: /* @__PURE__ */ new Set(),
|
|
291
|
+
memoryWarning: /* @__PURE__ */ new Set(),
|
|
292
|
+
blur: /* @__PURE__ */ new Set(),
|
|
293
|
+
focus: /* @__PURE__ */ new Set()
|
|
294
|
+
};
|
|
295
|
+
let pageHidden = false;
|
|
296
|
+
let last = null;
|
|
297
|
+
let visible = true;
|
|
298
|
+
let caughtUp = false;
|
|
299
|
+
let lastFocusEvent = null;
|
|
300
|
+
let listening$2 = false;
|
|
301
|
+
const read$2 = () => {
|
|
302
|
+
if (!hasDOM()) return "active";
|
|
303
|
+
return pageHidden || document.visibilityState !== "visible" ? "background" : "active";
|
|
304
|
+
};
|
|
305
|
+
const emit$1 = (next) => {
|
|
306
|
+
if (next === last) return;
|
|
307
|
+
last = next;
|
|
308
|
+
for (const handler of handlers$2.change) handler(next);
|
|
309
|
+
};
|
|
310
|
+
const notify = () => emit$1(read$2());
|
|
311
|
+
const onVisibilityChange = () => {
|
|
312
|
+
const next = document.visibilityState === "visible";
|
|
313
|
+
if (next !== visible) {
|
|
314
|
+
caughtUp = false;
|
|
315
|
+
visible = next;
|
|
316
|
+
notify();
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (caughtUp) {
|
|
320
|
+
caughtUp = false;
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
caughtUp = true;
|
|
324
|
+
emit$1(next || pageHidden ? "background" : "active");
|
|
325
|
+
notify();
|
|
326
|
+
};
|
|
327
|
+
const onPageHide = () => {
|
|
328
|
+
pageHidden = true;
|
|
329
|
+
notify();
|
|
330
|
+
};
|
|
331
|
+
const onPageShow = () => {
|
|
332
|
+
pageHidden = false;
|
|
333
|
+
notify();
|
|
334
|
+
};
|
|
335
|
+
const onWindowFocus = (event) => {
|
|
336
|
+
if (event.target !== window || event.type === lastFocusEvent) return;
|
|
337
|
+
lastFocusEvent = event.type;
|
|
338
|
+
for (const handler of handlers$2[event.type === "focus" ? "focus" : "blur"]) handler();
|
|
339
|
+
};
|
|
340
|
+
const listen$1 = () => {
|
|
341
|
+
if (listening$2 || !hasDOM()) return;
|
|
342
|
+
listening$2 = true;
|
|
343
|
+
last = read$2();
|
|
344
|
+
visible = document.visibilityState === "visible";
|
|
345
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
346
|
+
window.addEventListener("pagehide", onPageHide);
|
|
347
|
+
window.addEventListener("pageshow", onPageShow);
|
|
348
|
+
window.addEventListener("focus", onWindowFocus);
|
|
349
|
+
window.addEventListener("blur", onWindowFocus);
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* The app is `active` while its page is visible, and in the `background` while the page is
|
|
353
|
+
* hidden or unloads. A focus change of the window fires `blur` and `focus`, as on Android, and
|
|
354
|
+
* the state stays `active`.
|
|
355
|
+
*/
|
|
356
|
+
const AppState = {
|
|
357
|
+
get currentState() {
|
|
358
|
+
return read$2();
|
|
359
|
+
},
|
|
360
|
+
isAvailable: true,
|
|
361
|
+
addEventListener(type, handler) {
|
|
362
|
+
const set = handlers$2[type];
|
|
363
|
+
if (set === void 0) throw new Error(`Trying to subscribe to unknown event: ${String(type)}`);
|
|
364
|
+
const entry = handler;
|
|
365
|
+
set.add(entry);
|
|
117
366
|
listen$1();
|
|
118
|
-
return { remove: () =>
|
|
367
|
+
return { remove: () => set.delete(entry) };
|
|
119
368
|
}
|
|
120
369
|
};
|
|
121
370
|
// src/apis/BackHandler/index.ts
|
|
@@ -131,6 +380,46 @@ const BackHandler = {
|
|
|
131
380
|
},
|
|
132
381
|
exitApp: () => {}
|
|
133
382
|
};
|
|
383
|
+
// src/apis/Clipboard/index.ts
|
|
384
|
+
const clipboardAPI = () => hasDOM() ? navigator.clipboard : void 0;
|
|
385
|
+
const warnDeprecated = () => warnOnce("clipboard-deprecated", "Clipboard is deprecated in React Native, which will remove it in a future release.");
|
|
386
|
+
const warnRefused = (reason) => warnOnce("clipboard-write", `Clipboard.setString: the browser refused the copy. ${reason}`);
|
|
387
|
+
const copyWithTextarea = (content) => {
|
|
388
|
+
const focused = document.activeElement;
|
|
389
|
+
const textarea = document.createElement("textarea");
|
|
390
|
+
textarea.value = content;
|
|
391
|
+
textarea.setAttribute("readonly", "");
|
|
392
|
+
textarea.style.cssText = "position:fixed;top:0;left:0;opacity:0;pointer-events:none";
|
|
393
|
+
document.body.append(textarea);
|
|
394
|
+
textarea.select();
|
|
395
|
+
textarea.setSelectionRange(0, content.length);
|
|
396
|
+
const copied = document.execCommand("copy");
|
|
397
|
+
textarea.remove();
|
|
398
|
+
if (focused instanceof HTMLElement) focused.focus({ preventScroll: true });
|
|
399
|
+
if (!copied) warnRefused("Call setString from a press handler.");
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* Reads and writes text on the clipboard with the async Clipboard API. Deprecated in React
|
|
403
|
+
* Native, so the first call logs a warning.
|
|
404
|
+
*/
|
|
405
|
+
const Clipboard = {
|
|
406
|
+
getString() {
|
|
407
|
+
warnDeprecated();
|
|
408
|
+
const api = clipboardAPI();
|
|
409
|
+
if (api === void 0 || typeof api.readText !== "function") return Promise.reject(/* @__PURE__ */ new Error("Clipboard.getString: this page can't read the clipboard. Reading needs https or localhost, and a browser with navigator.clipboard.readText."));
|
|
410
|
+
return api.readText();
|
|
411
|
+
},
|
|
412
|
+
setString(content) {
|
|
413
|
+
warnDeprecated();
|
|
414
|
+
if (!hasDOM()) return;
|
|
415
|
+
const api = clipboardAPI();
|
|
416
|
+
if (api === void 0 || typeof api.writeText !== "function") {
|
|
417
|
+
copyWithTextarea(content);
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
api.writeText(content).catch((error) => warnRefused(String(error)));
|
|
421
|
+
}
|
|
422
|
+
};
|
|
134
423
|
// src/apis/Dimensions/index.ts
|
|
135
424
|
const serverSize = Object.freeze({
|
|
136
425
|
width: 0,
|
|
@@ -138,7 +427,7 @@ const serverSize = Object.freeze({
|
|
|
138
427
|
scale: 1,
|
|
139
428
|
fontScale: 1
|
|
140
429
|
});
|
|
141
|
-
const read = () => {
|
|
430
|
+
const read$1 = () => {
|
|
142
431
|
if (!hasDOM()) return {
|
|
143
432
|
window: serverSize,
|
|
144
433
|
screen: serverSize
|
|
@@ -162,28 +451,28 @@ const read = () => {
|
|
|
162
451
|
};
|
|
163
452
|
};
|
|
164
453
|
const sameSize = (a, b) => a.width === b.width && a.height === b.height && a.scale === b.scale && a.fontScale === b.fontScale;
|
|
165
|
-
let current$
|
|
454
|
+
let current$2 = null;
|
|
166
455
|
const handlers = /* @__PURE__ */ new Set();
|
|
167
|
-
let listening = false;
|
|
456
|
+
let listening$1 = false;
|
|
168
457
|
const refresh = () => {
|
|
169
|
-
const next = read();
|
|
170
|
-
if (current$
|
|
171
|
-
return current$
|
|
458
|
+
const next = read$1();
|
|
459
|
+
if (current$2 === null || !sameSize(current$2.window, next.window) || !sameSize(current$2.screen, next.screen)) current$2 = next;
|
|
460
|
+
return current$2;
|
|
172
461
|
};
|
|
173
|
-
const update = () => {
|
|
174
|
-
const previous = current$
|
|
462
|
+
const update$1 = () => {
|
|
463
|
+
const previous = current$2;
|
|
175
464
|
const value = refresh();
|
|
176
465
|
if (value === previous) return;
|
|
177
466
|
for (const handler of handlers) handler(value);
|
|
178
467
|
};
|
|
179
468
|
const listen = () => {
|
|
180
|
-
if (listening || !hasDOM()) return;
|
|
181
|
-
listening = true;
|
|
182
|
-
window.addEventListener("resize", update);
|
|
469
|
+
if (listening$1 || !hasDOM()) return;
|
|
470
|
+
listening$1 = true;
|
|
471
|
+
window.addEventListener("resize", update$1);
|
|
183
472
|
};
|
|
184
473
|
const Dimensions = {
|
|
185
474
|
get(dimension) {
|
|
186
|
-
return (current$
|
|
475
|
+
return (current$2 === null || !listening$1 ? refresh() : current$2)[dimension];
|
|
187
476
|
},
|
|
188
477
|
addEventListener(type, handler) {
|
|
189
478
|
if (type !== "change") throw new Error(`Dimensions: unknown event "${String(type)}"`);
|
|
@@ -196,7 +485,6 @@ const Dimensions = {
|
|
|
196
485
|
// src/apis/I18nManager/index.ts
|
|
197
486
|
let allowed = true;
|
|
198
487
|
let forced = false;
|
|
199
|
-
let swapLeftAndRight = true;
|
|
200
488
|
const documentIsRTL = () => hasDOM() && getComputedStyle(document.documentElement).direction === "rtl";
|
|
201
489
|
const isRTL = () => forced || allowed && documentIsRTL();
|
|
202
490
|
const I18nManager = {
|
|
@@ -204,11 +492,11 @@ const I18nManager = {
|
|
|
204
492
|
return isRTL();
|
|
205
493
|
},
|
|
206
494
|
get doLeftAndRightSwapInRTL() {
|
|
207
|
-
return
|
|
495
|
+
return getLeftAndRightSwap();
|
|
208
496
|
},
|
|
209
497
|
getConstants: () => ({
|
|
210
498
|
isRTL: isRTL(),
|
|
211
|
-
doLeftAndRightSwapInRTL:
|
|
499
|
+
doLeftAndRightSwapInRTL: getLeftAndRightSwap(),
|
|
212
500
|
localeIdentifier: hasDOM() ? navigator.language : void 0
|
|
213
501
|
}),
|
|
214
502
|
allowRTL: (allow) => {
|
|
@@ -219,1281 +507,1326 @@ const I18nManager = {
|
|
|
219
507
|
if (hasDOM()) document.documentElement.dir = force ? "rtl" : "";
|
|
220
508
|
},
|
|
221
509
|
swapLeftAndRightInRTL: (swap) => {
|
|
222
|
-
|
|
510
|
+
setLeftAndRightSwap(swap);
|
|
223
511
|
}
|
|
224
512
|
};
|
|
225
|
-
// src/apis/
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
513
|
+
// src/apis/Keyboard/index.ts
|
|
514
|
+
/**
|
|
515
|
+
* Internal. Where the keyboard module reads the two browser objects. A test replaces them,
|
|
516
|
+
* because a headless browser shows no keyboard.
|
|
517
|
+
*/
|
|
518
|
+
const keyboardSources = {
|
|
519
|
+
visualViewport: () => window.visualViewport,
|
|
520
|
+
virtualKeyboard: () => navigator.virtualKeyboard
|
|
521
|
+
};
|
|
522
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
523
|
+
let observed = null;
|
|
524
|
+
let current$1 = null;
|
|
525
|
+
let frame = null;
|
|
526
|
+
const noTextInputTypes = /* @__PURE__ */ new Set([
|
|
527
|
+
"button",
|
|
528
|
+
"checkbox",
|
|
529
|
+
"color",
|
|
530
|
+
"file",
|
|
531
|
+
"hidden",
|
|
532
|
+
"image",
|
|
533
|
+
"radio",
|
|
534
|
+
"range",
|
|
535
|
+
"reset",
|
|
536
|
+
"submit"
|
|
537
|
+
]);
|
|
538
|
+
const isEditable = (element) => {
|
|
539
|
+
if (element instanceof HTMLTextAreaElement) return !element.readOnly && !element.disabled;
|
|
540
|
+
if (element instanceof HTMLInputElement) return !element.readOnly && !element.disabled && !noTextInputTypes.has(element.type);
|
|
541
|
+
return element instanceof HTMLElement && element.isContentEditable;
|
|
542
|
+
};
|
|
543
|
+
const read = () => {
|
|
544
|
+
if (!hasDOM()) return null;
|
|
545
|
+
const root = document.documentElement;
|
|
546
|
+
const virtualKeyboard = keyboardSources.virtualKeyboard();
|
|
547
|
+
if (virtualKeyboard?.overlaysContent === true) {
|
|
548
|
+
const { x, y, width, height } = virtualKeyboard.boundingRect;
|
|
549
|
+
return height > 0 ? {
|
|
550
|
+
screenX: x,
|
|
551
|
+
screenY: y,
|
|
552
|
+
width,
|
|
553
|
+
height
|
|
554
|
+
} : null;
|
|
248
555
|
}
|
|
249
|
-
const
|
|
556
|
+
const viewport = keyboardSources.visualViewport();
|
|
557
|
+
if (viewport === null || !isEditable(document.activeElement)) return null;
|
|
558
|
+
const height = Math.round(root.clientHeight - viewport.height * viewport.scale);
|
|
559
|
+
if (height <= 0) return null;
|
|
250
560
|
return {
|
|
251
|
-
|
|
252
|
-
|
|
561
|
+
screenX: 0,
|
|
562
|
+
screenY: Math.min(root.clientHeight - height + Math.round(viewport.offsetTop), root.clientHeight),
|
|
563
|
+
width: root.clientWidth,
|
|
564
|
+
height
|
|
253
565
|
};
|
|
254
566
|
};
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
});
|
|
261
|
-
};
|
|
262
|
-
const touchOf = (pointer, rect, timestamp) => ({
|
|
263
|
-
changedTouches: [],
|
|
264
|
-
identifier: pointer.id,
|
|
265
|
-
locationX: pointer.clientX - rect.left,
|
|
266
|
-
locationY: pointer.clientY - rect.top,
|
|
267
|
-
pageX: pointer.clientX + window.scrollX,
|
|
268
|
-
pageY: pointer.clientY + window.scrollY,
|
|
269
|
-
target: pointer.target,
|
|
270
|
-
timestamp,
|
|
271
|
-
touches: []
|
|
567
|
+
const hiddenMetrics = () => ({
|
|
568
|
+
screenX: 0,
|
|
569
|
+
screenY: hasDOM() ? document.documentElement.clientHeight : 0,
|
|
570
|
+
width: hasDOM() ? document.documentElement.clientWidth : 0,
|
|
571
|
+
height: 0
|
|
272
572
|
});
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
define$1(event.nativeEvent, {
|
|
278
|
-
...touch,
|
|
279
|
-
force: event.pressure,
|
|
280
|
-
touches,
|
|
281
|
-
changedTouches: [touch]
|
|
282
|
-
});
|
|
283
|
-
return event;
|
|
284
|
-
};
|
|
285
|
-
const pointerOf = (event) => ({
|
|
286
|
-
id: event.pointerId,
|
|
287
|
-
clientX: event.clientX,
|
|
288
|
-
clientY: event.clientY,
|
|
289
|
-
target: event.target
|
|
573
|
+
const toEvent = (endCoordinates) => ({
|
|
574
|
+
duration: 0,
|
|
575
|
+
easing: "keyboard",
|
|
576
|
+
endCoordinates
|
|
290
577
|
});
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
const dt = time - last.time;
|
|
297
|
-
state.dx += next.x - last.x;
|
|
298
|
-
state.dy += next.y - last.y;
|
|
299
|
-
state.vx = dt > 0 ? (next.x - last.x) / dt : 0;
|
|
300
|
-
state.vy = dt > 0 ? (next.y - last.y) / dt : 0;
|
|
301
|
-
}
|
|
302
|
-
state.moveX = next.x;
|
|
303
|
-
state.moveY = next.y;
|
|
304
|
-
state._accountsForMovesUpTo = time;
|
|
305
|
-
responder.last = {
|
|
306
|
-
x: next.x,
|
|
307
|
-
y: next.y,
|
|
308
|
-
time
|
|
309
|
-
};
|
|
578
|
+
const sameMetrics = (a, b) => a === b || a !== null && b !== null && a.screenX === b.screenX && a.screenY === b.screenY && a.width === b.width && a.height === b.height;
|
|
579
|
+
const emit = (name, event) => {
|
|
580
|
+
const set = listeners.get(name);
|
|
581
|
+
if (set === void 0) return;
|
|
582
|
+
for (const listener of set) listener(event);
|
|
310
583
|
};
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
responder.gestureState.numberActiveTouches = responder.pointers.size;
|
|
584
|
+
const update = () => {
|
|
585
|
+
frame = null;
|
|
586
|
+
const next = read();
|
|
587
|
+
if (sameMetrics(next, current$1)) return;
|
|
588
|
+
current$1 = next;
|
|
589
|
+
if (next === null) emit("keyboardDidHide", toEvent(hiddenMetrics()));
|
|
590
|
+
else emit("keyboardDidShow", toEvent(next));
|
|
319
591
|
};
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
const point = centroid(responder.pointers);
|
|
323
|
-
state.x0 = point.x;
|
|
324
|
-
state.y0 = point.y;
|
|
325
|
-
state.dx = 0;
|
|
326
|
-
state.dy = 0;
|
|
327
|
-
state.vx = 0;
|
|
328
|
-
state.vy = 0;
|
|
329
|
-
responder.last = {
|
|
330
|
-
x: point.x,
|
|
331
|
-
y: point.y,
|
|
332
|
-
time: event.timeStamp
|
|
333
|
-
};
|
|
334
|
-
responder.element = event.currentTarget;
|
|
335
|
-
current = responder;
|
|
336
|
-
grantEvent = event.nativeEvent;
|
|
337
|
-
for (const pointer of responder.pointers.values()) try {
|
|
338
|
-
responder.element.setPointerCapture(pointer.id);
|
|
339
|
-
} catch {}
|
|
340
|
-
responder.config.onPanResponderGrant?.(responderEvent, state);
|
|
341
|
-
responder.config.onPanResponderStart?.(responderEvent, state);
|
|
592
|
+
const schedule = () => {
|
|
593
|
+
if (frame === null) frame = requestAnimationFrame(update);
|
|
342
594
|
};
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
595
|
+
const startObserving = () => {
|
|
596
|
+
if (observed !== null || !hasDOM()) return;
|
|
597
|
+
observed = {
|
|
598
|
+
viewport: keyboardSources.visualViewport(),
|
|
599
|
+
virtualKeyboard: keyboardSources.virtualKeyboard()
|
|
600
|
+
};
|
|
601
|
+
current$1 = read();
|
|
602
|
+
observed.viewport?.addEventListener("resize", schedule);
|
|
603
|
+
observed.viewport?.addEventListener("scroll", schedule);
|
|
604
|
+
observed.virtualKeyboard?.addEventListener("geometrychange", schedule);
|
|
605
|
+
window.addEventListener("resize", schedule);
|
|
349
606
|
};
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
607
|
+
const stopObserving = () => {
|
|
608
|
+
if (observed === null) return;
|
|
609
|
+
for (const set of listeners.values()) if (set.size > 0) return;
|
|
610
|
+
observed.viewport?.removeEventListener("resize", schedule);
|
|
611
|
+
observed.viewport?.removeEventListener("scroll", schedule);
|
|
612
|
+
observed.virtualKeyboard?.removeEventListener("geometrychange", schedule);
|
|
613
|
+
window.removeEventListener("resize", schedule);
|
|
614
|
+
observed = null;
|
|
615
|
+
if (frame !== null) cancelAnimationFrame(frame);
|
|
616
|
+
frame = null;
|
|
617
|
+
current$1 = null;
|
|
355
618
|
};
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
619
|
+
const state = () => observed === null ? read() : current$1;
|
|
620
|
+
/**
|
|
621
|
+
* The keyboard of a phone or a tablet, as on Android: `keyboardDidShow` fires when the keyboard
|
|
622
|
+
* shows and when its height changes, and `keyboardDidHide` fires when it hides. The `Will` and
|
|
623
|
+
* `ChangeFrame` events never fire.
|
|
624
|
+
*/
|
|
625
|
+
const Keyboard = {
|
|
626
|
+
addListener(eventType, listener) {
|
|
627
|
+
let set = listeners.get(eventType);
|
|
628
|
+
if (set === void 0) {
|
|
629
|
+
set = /* @__PURE__ */ new Set();
|
|
630
|
+
listeners.set(eventType, set);
|
|
365
631
|
}
|
|
366
|
-
|
|
367
|
-
|
|
632
|
+
const entry = (event) => listener(event);
|
|
633
|
+
set.add(entry);
|
|
634
|
+
startObserving();
|
|
635
|
+
return { remove: () => {
|
|
636
|
+
set.delete(entry);
|
|
637
|
+
stopObserving();
|
|
638
|
+
} };
|
|
639
|
+
},
|
|
640
|
+
removeAllListeners(eventType) {
|
|
641
|
+
if (eventType === void 0 || eventType === null) listeners.clear();
|
|
642
|
+
else listeners.delete(eventType);
|
|
643
|
+
stopObserving();
|
|
644
|
+
},
|
|
645
|
+
dismiss() {
|
|
646
|
+
if (!hasDOM()) return;
|
|
647
|
+
const active = document.activeElement;
|
|
648
|
+
if (isEditable(active)) active.blur();
|
|
649
|
+
},
|
|
650
|
+
isVisible() {
|
|
651
|
+
return state() !== null;
|
|
652
|
+
},
|
|
653
|
+
metrics() {
|
|
654
|
+
return state() ?? void 0;
|
|
655
|
+
},
|
|
656
|
+
scheduleLayoutAnimation() {}
|
|
657
|
+
};
|
|
658
|
+
// src/apis/Linking/index.ts
|
|
659
|
+
const registrations = /* @__PURE__ */ new Map();
|
|
660
|
+
const addListener = (eventType, listener, context) => {
|
|
661
|
+
let set = registrations.get(eventType);
|
|
662
|
+
if (set === void 0) {
|
|
663
|
+
set = /* @__PURE__ */ new Set();
|
|
664
|
+
registrations.set(eventType, set);
|
|
368
665
|
}
|
|
369
|
-
|
|
666
|
+
const registration = {
|
|
667
|
+
listener,
|
|
668
|
+
context
|
|
669
|
+
};
|
|
670
|
+
const owner = set;
|
|
671
|
+
owner.add(registration);
|
|
672
|
+
return { remove: () => owner.delete(registration) };
|
|
370
673
|
};
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
674
|
+
const validate = (url) => {
|
|
675
|
+
if (typeof url !== "string") throw new Error(`Invalid URL: should be a string. Was: ${String(url)}`);
|
|
676
|
+
if (url === "") throw new Error("Invalid URL: cannot be empty");
|
|
677
|
+
};
|
|
678
|
+
const REFUSED_PROTOCOLS = /* @__PURE__ */ new Set(["javascript:", "data:"]);
|
|
679
|
+
const destination = (url) => {
|
|
680
|
+
if (!hasDOM()) return /* @__PURE__ */ new Error("Linking: there is no browser to open a URL in.");
|
|
681
|
+
let parsed;
|
|
682
|
+
try {
|
|
683
|
+
parsed = new URL(url, window.location.href);
|
|
684
|
+
} catch {
|
|
685
|
+
return /* @__PURE__ */ new Error(`Linking: "${url}" isn't a valid URL.`);
|
|
686
|
+
}
|
|
687
|
+
if (REFUSED_PROTOCOLS.has(parsed.protocol)) return /* @__PURE__ */ new Error(`Linking: refused to open a ${parsed.protocol} URL.`);
|
|
688
|
+
const web = parsed.protocol === "http:" || parsed.protocol === "https:";
|
|
689
|
+
return {
|
|
690
|
+
href: parsed.href,
|
|
691
|
+
newTab: web && parsed.origin !== window.location.origin
|
|
387
692
|
};
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
693
|
+
};
|
|
694
|
+
const loadedURL = () => {
|
|
695
|
+
if (!hasDOM()) return null;
|
|
696
|
+
const [entry] = performance.getEntriesByType("navigation");
|
|
697
|
+
return entry?.name || window.location.href;
|
|
698
|
+
};
|
|
699
|
+
/** For tests: `location.assign` can't be replaced, so the tests replace this. */
|
|
700
|
+
const browserNavigation = { assign: (href) => window.location.assign(href) };
|
|
701
|
+
/**
|
|
702
|
+
* Opens URLs and reports the URL that the page loaded with. A URL of this site opens in this tab,
|
|
703
|
+
* a URL of another site in a new tab, and `mailto:`, `tel:`, and other schemes go to the system.
|
|
704
|
+
* The browser never fires `url`: back, forward, and links belong to the router.
|
|
705
|
+
*/
|
|
706
|
+
const Linking = {
|
|
707
|
+
addEventListener: (eventType, listener) => addListener(eventType, listener),
|
|
708
|
+
addListener,
|
|
709
|
+
emit(eventType, ...args) {
|
|
710
|
+
const set = registrations.get(eventType);
|
|
711
|
+
if (set === void 0) return;
|
|
712
|
+
for (const { listener, context } of Array.from(set)) Reflect.apply(listener, context, args);
|
|
713
|
+
},
|
|
714
|
+
removeAllListeners(eventType) {
|
|
715
|
+
if (eventType === void 0 || eventType === null) registrations.clear();
|
|
716
|
+
else registrations.delete(eventType);
|
|
717
|
+
},
|
|
718
|
+
listenerCount: (eventType) => registrations.get(eventType)?.size ?? 0,
|
|
719
|
+
openURL(url) {
|
|
720
|
+
validate(url);
|
|
721
|
+
const target = destination(url);
|
|
722
|
+
if (target instanceof Error) return Promise.reject(target);
|
|
723
|
+
if (!target.newTab) {
|
|
724
|
+
browserNavigation.assign(target.href);
|
|
725
|
+
return Promise.resolve();
|
|
401
726
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
if (pointer === void 0) return;
|
|
407
|
-
const responderEvent = toResponderEvent(event, responder, pointer);
|
|
408
|
-
responder.pointers.delete(event.pointerId);
|
|
409
|
-
const { config, gestureState } = responder;
|
|
410
|
-
const responding = current === responder;
|
|
411
|
-
if (responding && cancel) {
|
|
412
|
-
config.onPanResponderTerminate?.(responderEvent, gestureState);
|
|
413
|
-
responder.pointers.clear();
|
|
414
|
-
finish(responder);
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
if (responding) config.onPanResponderEnd?.(responderEvent, gestureState);
|
|
418
|
-
if (responder.pointers.size === 0) {
|
|
419
|
-
if (responding) config.onPanResponderRelease?.(responderEvent, gestureState);
|
|
420
|
-
finish(responder);
|
|
421
|
-
} else rebase(responder, event.timeStamp);
|
|
422
|
-
};
|
|
423
|
-
return {
|
|
424
|
-
onPointerDownCapture: (event) => down(event, true),
|
|
425
|
-
onPointerDown: (event) => down(event, false),
|
|
426
|
-
onPointerMoveCapture: (event) => move(event, true),
|
|
427
|
-
onPointerMove: (event) => move(event, false),
|
|
428
|
-
onPointerUp: (event) => end(event, false),
|
|
429
|
-
onPointerCancel: (event) => end(event, true)
|
|
430
|
-
};
|
|
431
|
-
};
|
|
432
|
-
const PanResponder = { create(config) {
|
|
433
|
-
const responder = {
|
|
434
|
-
config,
|
|
435
|
-
gestureState: newGestureState(),
|
|
436
|
-
pointers: /* @__PURE__ */ new Map(),
|
|
437
|
-
element: null,
|
|
438
|
-
last: null
|
|
439
|
-
};
|
|
440
|
-
return {
|
|
441
|
-
panHandlers: createHandlers(responder),
|
|
442
|
-
getInteractionHandle: () => null
|
|
443
|
-
};
|
|
444
|
-
} };
|
|
445
|
-
// src/apis/PixelRatio/index.ts
|
|
446
|
-
const PixelRatio = {
|
|
447
|
-
get: () => Dimensions.get("window").scale,
|
|
448
|
-
getFontScale: () => Dimensions.get("window").fontScale,
|
|
449
|
-
getPixelSizeForLayoutSize: (layoutSize) => Math.round(layoutSize * PixelRatio.get()),
|
|
450
|
-
roundToNearestPixel: (layoutSize) => {
|
|
451
|
-
const ratio = PixelRatio.get();
|
|
452
|
-
return Math.round(layoutSize * ratio) / ratio;
|
|
727
|
+
const opened = window.open(target.href, "_blank");
|
|
728
|
+
if (opened === null) return Promise.reject(/* @__PURE__ */ new Error(`Linking: the browser blocked the new tab for ${target.href}. Call openURL from a press handler.`));
|
|
729
|
+
opened.opener = null;
|
|
730
|
+
return Promise.resolve();
|
|
453
731
|
},
|
|
454
|
-
|
|
732
|
+
canOpenURL(url) {
|
|
733
|
+
validate(url);
|
|
734
|
+
return Promise.resolve(!(destination(url) instanceof Error));
|
|
735
|
+
},
|
|
736
|
+
openSettings: () => Promise.reject(/* @__PURE__ */ new Error("Linking.openSettings: the web has no settings page for an app.")),
|
|
737
|
+
getInitialURL: () => Promise.resolve(loadedURL()),
|
|
738
|
+
sendIntent: () => Promise.reject(/* @__PURE__ */ new Error("Unsupported"))
|
|
455
739
|
};
|
|
456
|
-
// src/
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
740
|
+
// src/events/responderEvent.ts
|
|
741
|
+
const hasPoint = (event) => event.clientX !== void 0 && !(event.type === "click" && event.detail === 0);
|
|
742
|
+
const activeTypes = /* @__PURE__ */ new Set([
|
|
743
|
+
"pointerdown",
|
|
744
|
+
"pointermove",
|
|
745
|
+
"keydown"
|
|
746
|
+
]);
|
|
747
|
+
const define$1 = (target, fields) => {
|
|
748
|
+
for (const key in fields) {
|
|
749
|
+
if (key in target) continue;
|
|
750
|
+
Object.defineProperty(target, key, {
|
|
751
|
+
value: fields[key],
|
|
752
|
+
configurable: true
|
|
753
|
+
});
|
|
754
|
+
}
|
|
462
755
|
};
|
|
463
|
-
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
756
|
+
const toGestureResponderEvent = (event, element) => {
|
|
757
|
+
const native = event.nativeEvent;
|
|
758
|
+
if (!("locationX" in native)) {
|
|
759
|
+
const rect = element.getBoundingClientRect();
|
|
760
|
+
const point = hasPoint(native);
|
|
761
|
+
const clientX = point ? native.clientX ?? 0 : rect.left + rect.width / 2;
|
|
762
|
+
const clientY = point ? native.clientY ?? 0 : rect.top + rect.height / 2;
|
|
763
|
+
const touch = {
|
|
764
|
+
changedTouches: [],
|
|
765
|
+
force: native.pressure,
|
|
766
|
+
identifier: native.pointerId ?? 0,
|
|
767
|
+
locationX: clientX - rect.left,
|
|
768
|
+
locationY: clientY - rect.top,
|
|
769
|
+
pageX: clientX + window.scrollX,
|
|
770
|
+
pageY: clientY + window.scrollY,
|
|
771
|
+
target: native.target,
|
|
772
|
+
timestamp: event.timeStamp,
|
|
773
|
+
touches: []
|
|
774
|
+
};
|
|
775
|
+
define$1(native, {
|
|
776
|
+
...touch,
|
|
777
|
+
changedTouches: [touch],
|
|
778
|
+
touches: activeTypes.has(native.type) ? [touch] : []
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
return event;
|
|
782
|
+
};
|
|
783
|
+
const toMouseEvent = (event) => {
|
|
784
|
+
define$1(event.nativeEvent, { timestamp: event.timeStamp });
|
|
785
|
+
return event;
|
|
786
|
+
};
|
|
787
|
+
// src/events/press/Pressability.ts
|
|
788
|
+
const transitions = {
|
|
789
|
+
NOT_RESPONDER: { RESPONDER_GRANT: "RESPONDER_INACTIVE_PRESS_IN" },
|
|
790
|
+
RESPONDER_INACTIVE_PRESS_IN: {
|
|
791
|
+
DELAY: "RESPONDER_ACTIVE_PRESS_IN",
|
|
792
|
+
RESPONDER_RELEASE: "NOT_RESPONDER",
|
|
793
|
+
RESPONDER_TERMINATED: "NOT_RESPONDER",
|
|
794
|
+
ENTER_PRESS_RECT: "RESPONDER_INACTIVE_PRESS_IN",
|
|
795
|
+
LEAVE_PRESS_RECT: "RESPONDER_INACTIVE_PRESS_OUT"
|
|
468
796
|
},
|
|
469
|
-
|
|
470
|
-
|
|
797
|
+
RESPONDER_INACTIVE_PRESS_OUT: {
|
|
798
|
+
DELAY: "RESPONDER_ACTIVE_PRESS_OUT",
|
|
799
|
+
RESPONDER_RELEASE: "NOT_RESPONDER",
|
|
800
|
+
RESPONDER_TERMINATED: "NOT_RESPONDER",
|
|
801
|
+
ENTER_PRESS_RECT: "RESPONDER_INACTIVE_PRESS_IN",
|
|
802
|
+
LEAVE_PRESS_RECT: "RESPONDER_INACTIVE_PRESS_OUT"
|
|
471
803
|
},
|
|
472
|
-
|
|
473
|
-
|
|
804
|
+
RESPONDER_ACTIVE_PRESS_IN: {
|
|
805
|
+
RESPONDER_RELEASE: "NOT_RESPONDER",
|
|
806
|
+
RESPONDER_TERMINATED: "NOT_RESPONDER",
|
|
807
|
+
ENTER_PRESS_RECT: "RESPONDER_ACTIVE_PRESS_IN",
|
|
808
|
+
LEAVE_PRESS_RECT: "RESPONDER_ACTIVE_PRESS_OUT",
|
|
809
|
+
LONG_PRESS_DETECTED: "RESPONDER_ACTIVE_LONG_PRESS_IN"
|
|
474
810
|
},
|
|
475
|
-
|
|
476
|
-
|
|
811
|
+
RESPONDER_ACTIVE_PRESS_OUT: {
|
|
812
|
+
RESPONDER_RELEASE: "NOT_RESPONDER",
|
|
813
|
+
RESPONDER_TERMINATED: "NOT_RESPONDER",
|
|
814
|
+
ENTER_PRESS_RECT: "RESPONDER_ACTIVE_PRESS_IN",
|
|
815
|
+
LEAVE_PRESS_RECT: "RESPONDER_ACTIVE_PRESS_OUT"
|
|
477
816
|
},
|
|
478
|
-
|
|
479
|
-
|
|
817
|
+
RESPONDER_ACTIVE_LONG_PRESS_IN: {
|
|
818
|
+
RESPONDER_RELEASE: "NOT_RESPONDER",
|
|
819
|
+
RESPONDER_TERMINATED: "NOT_RESPONDER",
|
|
820
|
+
ENTER_PRESS_RECT: "RESPONDER_ACTIVE_LONG_PRESS_IN",
|
|
821
|
+
LEAVE_PRESS_RECT: "RESPONDER_ACTIVE_LONG_PRESS_OUT",
|
|
822
|
+
LONG_PRESS_DETECTED: "RESPONDER_ACTIVE_LONG_PRESS_IN"
|
|
480
823
|
},
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
824
|
+
RESPONDER_ACTIVE_LONG_PRESS_OUT: {
|
|
825
|
+
RESPONDER_RELEASE: "NOT_RESPONDER",
|
|
826
|
+
RESPONDER_TERMINATED: "NOT_RESPONDER",
|
|
827
|
+
ENTER_PRESS_RECT: "RESPONDER_ACTIVE_LONG_PRESS_IN",
|
|
828
|
+
LEAVE_PRESS_RECT: "RESPONDER_ACTIVE_LONG_PRESS_OUT"
|
|
484
829
|
}
|
|
485
830
|
};
|
|
486
|
-
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
const packed = normalizeColor(value);
|
|
498
|
-
if (packed === null || packed === void 0) return void 0;
|
|
499
|
-
const r = packed >>> 24 & 255;
|
|
500
|
-
const g = packed >>> 16 & 255;
|
|
501
|
-
const b = packed >>> 8 & 255;
|
|
502
|
-
const a = (packed & 255) / 255;
|
|
503
|
-
return a === 1 ? `rgb(${r},${g},${b})` : `rgba(${r},${g},${b},${round(a)})`;
|
|
504
|
-
};
|
|
505
|
-
const round = (n) => Math.round(n * 1e3) / 1e3;
|
|
506
|
-
// src/style/units.ts
|
|
507
|
-
const toUnit = (value, unit) => {
|
|
508
|
-
if (typeof value === "number") return value === 0 ? "0" : `${value}${unit}`;
|
|
509
|
-
return String(value);
|
|
510
|
-
};
|
|
511
|
-
const unitlessProperties = /* @__PURE__ */ new Set([
|
|
512
|
-
"aspectRatio",
|
|
513
|
-
"flex",
|
|
514
|
-
"flexGrow",
|
|
515
|
-
"flexShrink",
|
|
516
|
-
"fontWeight",
|
|
517
|
-
"lineClamp",
|
|
518
|
-
"WebkitLineClamp",
|
|
519
|
-
"opacity",
|
|
520
|
-
"zIndex",
|
|
521
|
-
"scale",
|
|
522
|
-
"shadowOpacity"
|
|
523
|
-
]);
|
|
524
|
-
// src/style/shadow.ts
|
|
525
|
-
const offsetOf = (value) => {
|
|
526
|
-
const o = value ?? {};
|
|
527
|
-
return {
|
|
528
|
-
x: typeof o.width === "number" ? o.width : 0,
|
|
529
|
-
y: typeof o.height === "number" ? o.height : 0
|
|
530
|
-
};
|
|
831
|
+
const isActive = (state) => state === "RESPONDER_ACTIVE_PRESS_IN" || state === "RESPONDER_ACTIVE_LONG_PRESS_IN";
|
|
832
|
+
const isActivation = (state) => state === "RESPONDER_ACTIVE_PRESS_OUT" || state === "RESPONDER_ACTIVE_PRESS_IN";
|
|
833
|
+
const isPressIn = (state) => state === "RESPONDER_INACTIVE_PRESS_IN" || state === "RESPONDER_ACTIVE_PRESS_IN" || state === "RESPONDER_ACTIVE_LONG_PRESS_IN";
|
|
834
|
+
const isTerminal = (signal) => signal === "RESPONDER_TERMINATED" || signal === "RESPONDER_RELEASE";
|
|
835
|
+
const DEFAULT_LONG_PRESS_DELAY_MS = 500;
|
|
836
|
+
const DEFAULT_MIN_PRESS_DURATION = 130;
|
|
837
|
+
const DEFAULT_PRESS_RECT_OFFSETS = {
|
|
838
|
+
bottom: 30,
|
|
839
|
+
left: 20,
|
|
840
|
+
right: 20,
|
|
841
|
+
top: 20
|
|
531
842
|
};
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
};
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
const color = toCSSColor(style["textShadowColor"] ?? "black");
|
|
544
|
-
if (color === void 0) return void 0;
|
|
545
|
-
return `${x}px ${y}px ${radius}px ${color}`;
|
|
546
|
-
};
|
|
547
|
-
const toCSSBoxShadow = (value) => {
|
|
548
|
-
if (typeof value === "string") return value;
|
|
549
|
-
if (!Array.isArray(value)) return void 0;
|
|
550
|
-
const shadows = value.map((s) => {
|
|
551
|
-
const parts = [
|
|
552
|
-
toUnit(s.offsetX, "px"),
|
|
553
|
-
toUnit(s.offsetY, "px"),
|
|
554
|
-
toUnit(s.blurRadius ?? 0, "px"),
|
|
555
|
-
toUnit(s.spreadDistance ?? 0, "px"),
|
|
556
|
-
toCSSColor(s.color ?? "black") ?? "black"
|
|
557
|
-
];
|
|
558
|
-
if (s.inset === true) parts.push("inset");
|
|
559
|
-
return parts.join(" ");
|
|
560
|
-
});
|
|
561
|
-
return shadows.length === 0 ? "none" : shadows.join(", ");
|
|
562
|
-
};
|
|
563
|
-
const lengthFilters = /* @__PURE__ */ new Set(["blur"]);
|
|
564
|
-
const angleFilters = /* @__PURE__ */ new Set(["hueRotate"]);
|
|
565
|
-
const toCSSFilter = (value) => {
|
|
566
|
-
if (typeof value === "string") return value;
|
|
567
|
-
if (!Array.isArray(value)) return void 0;
|
|
568
|
-
const parts = [];
|
|
569
|
-
for (const entry of value) for (const [name, raw] of Object.entries(entry)) {
|
|
570
|
-
const css = toFilterFunction(name, raw);
|
|
571
|
-
if (css !== void 0) parts.push(css);
|
|
572
|
-
}
|
|
573
|
-
return parts.length === 0 ? "none" : parts.join(" ");
|
|
574
|
-
};
|
|
575
|
-
const toFilterFunction = (name, raw) => {
|
|
576
|
-
if (name === "dropShadow") {
|
|
577
|
-
const shadow = typeof raw === "string" ? raw : dropShadow(raw);
|
|
578
|
-
return shadow === void 0 ? void 0 : `drop-shadow(${shadow})`;
|
|
579
|
-
}
|
|
580
|
-
const cssName = name === "hueRotate" ? "hue-rotate" : name;
|
|
581
|
-
if (typeof raw === "number") {
|
|
582
|
-
if (lengthFilters.has(name)) return `${cssName}(${raw}px)`;
|
|
583
|
-
if (angleFilters.has(name)) return `${cssName}(${raw}deg)`;
|
|
584
|
-
return `${cssName}(${raw})`;
|
|
585
|
-
}
|
|
586
|
-
if (typeof raw === "string") return `${cssName}(${raw})`;
|
|
587
|
-
};
|
|
588
|
-
const dropShadow = (v) => {
|
|
589
|
-
const color = toCSSColor(v["color"] ?? "black");
|
|
590
|
-
if (color === void 0) return void 0;
|
|
591
|
-
return [
|
|
592
|
-
toUnit(v["offsetX"] ?? 0, "px"),
|
|
593
|
-
toUnit(v["offsetY"] ?? 0, "px"),
|
|
594
|
-
toUnit(v["standardDeviation"] ?? 0, "px"),
|
|
595
|
-
color
|
|
596
|
-
].join(" ");
|
|
597
|
-
};
|
|
598
|
-
const withOpacity = (color, opacity) => {
|
|
599
|
-
if (opacity >= 1) return color;
|
|
600
|
-
const match = /^rgba?\((\d+),(\d+),(\d+)(?:,([\d.]+))?\)$/.exec(color);
|
|
601
|
-
if (match === null) return color;
|
|
602
|
-
const alpha = match[4] === void 0 ? 1 : Number(match[4]);
|
|
603
|
-
const a = Math.round(alpha * opacity * 1e3) / 1e3;
|
|
604
|
-
return `rgba(${match[1]},${match[2]},${match[3]},${a})`;
|
|
605
|
-
};
|
|
606
|
-
// src/style/transform.ts
|
|
607
|
-
const lengthFunctions = /* @__PURE__ */ new Set([
|
|
608
|
-
"translateX",
|
|
609
|
-
"translateY",
|
|
610
|
-
"translateZ",
|
|
611
|
-
"perspective"
|
|
612
|
-
]);
|
|
613
|
-
const toCSSTransform = (value) => {
|
|
614
|
-
if (typeof value === "string") return value;
|
|
615
|
-
if (!Array.isArray(value)) return void 0;
|
|
616
|
-
const parts = [];
|
|
617
|
-
for (const entry of value) {
|
|
618
|
-
if (entry === null || typeof entry !== "object") continue;
|
|
619
|
-
for (const [name, raw] of Object.entries(entry)) {
|
|
620
|
-
const css = toTransformFunction(name, raw);
|
|
621
|
-
if (css !== void 0) parts.push(css);
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
return parts.length === 0 ? "none" : parts.join(" ");
|
|
625
|
-
};
|
|
626
|
-
const toTransformFunction = (name, raw) => {
|
|
627
|
-
if (name === "matrix" && Array.isArray(raw)) return `${raw.length === 16 ? "matrix3d" : "matrix"}(${raw.join(",")})`;
|
|
628
|
-
if (name === "translate" && Array.isArray(raw)) return `translate(${raw.map((v) => toUnit(v, "px")).join(",")})`;
|
|
629
|
-
if (typeof raw === "number") return lengthFunctions.has(name) ? `${name}(${raw}px)` : `${name}(${raw})`;
|
|
630
|
-
if (typeof raw === "string") return `${name}(${raw})`;
|
|
631
|
-
};
|
|
632
|
-
const toCSSTransformOrigin = (value) => {
|
|
633
|
-
if (typeof value === "string") return value;
|
|
634
|
-
if (!Array.isArray(value)) return void 0;
|
|
635
|
-
return value.map((v) => toUnit(v, "px")).join(" ");
|
|
636
|
-
};
|
|
637
|
-
// src/style/resolveStyle.ts
|
|
638
|
-
const colorProperties = /* @__PURE__ */ new Set([
|
|
639
|
-
"backgroundColor",
|
|
640
|
-
"borderBlockColor",
|
|
641
|
-
"borderBlockEndColor",
|
|
642
|
-
"borderBlockStartColor",
|
|
643
|
-
"borderBottomColor",
|
|
644
|
-
"borderColor",
|
|
645
|
-
"borderEndColor",
|
|
646
|
-
"borderLeftColor",
|
|
647
|
-
"borderRightColor",
|
|
648
|
-
"borderStartColor",
|
|
649
|
-
"borderTopColor",
|
|
650
|
-
"color",
|
|
651
|
-
"outlineColor",
|
|
652
|
-
"textDecorationColor"
|
|
653
|
-
]);
|
|
654
|
-
const renamedProperties = {
|
|
655
|
-
borderEndColor: "borderInlineEndColor",
|
|
656
|
-
borderEndWidth: "borderInlineEndWidth",
|
|
657
|
-
borderStartColor: "borderInlineStartColor",
|
|
658
|
-
borderStartWidth: "borderInlineStartWidth",
|
|
659
|
-
borderTopStartRadius: "borderStartStartRadius",
|
|
660
|
-
borderTopEndRadius: "borderStartEndRadius",
|
|
661
|
-
borderBottomStartRadius: "borderEndStartRadius",
|
|
662
|
-
borderBottomEndRadius: "borderEndEndRadius",
|
|
663
|
-
end: "insetInlineEnd",
|
|
664
|
-
marginEnd: "marginInlineEnd",
|
|
665
|
-
marginStart: "marginInlineStart",
|
|
666
|
-
paddingEnd: "paddingInlineEnd",
|
|
667
|
-
paddingStart: "paddingInlineStart",
|
|
668
|
-
start: "insetInlineStart",
|
|
669
|
-
writingDirection: "direction"
|
|
670
|
-
};
|
|
671
|
-
const expandedProperties = {
|
|
672
|
-
marginHorizontal: ["marginLeft", "marginRight"],
|
|
673
|
-
marginVertical: ["marginTop", "marginBottom"],
|
|
674
|
-
paddingHorizontal: ["paddingLeft", "paddingRight"],
|
|
675
|
-
paddingVertical: ["paddingTop", "paddingBottom"]
|
|
676
|
-
};
|
|
677
|
-
const ignoredProperties = /* @__PURE__ */ new Set([
|
|
678
|
-
"borderCurve",
|
|
679
|
-
"elevation",
|
|
680
|
-
"includeFontPadding",
|
|
681
|
-
"overlayColor",
|
|
682
|
-
"shadowColor",
|
|
683
|
-
"shadowOffset",
|
|
684
|
-
"shadowOpacity",
|
|
685
|
-
"shadowRadius",
|
|
686
|
-
"textShadowColor",
|
|
687
|
-
"textShadowOffset",
|
|
688
|
-
"textShadowRadius",
|
|
689
|
-
"tintColor"
|
|
690
|
-
]);
|
|
691
|
-
const fontWeightNames = {
|
|
692
|
-
ultralight: "200",
|
|
693
|
-
thin: "100",
|
|
694
|
-
light: "300",
|
|
695
|
-
regular: "400",
|
|
696
|
-
medium: "500",
|
|
697
|
-
semibold: "600",
|
|
698
|
-
condensedBold: "700",
|
|
699
|
-
condensed: "400",
|
|
700
|
-
heavy: "800",
|
|
701
|
-
black: "900"
|
|
702
|
-
};
|
|
703
|
-
const resizeModeToObjectFit = {
|
|
704
|
-
contain: "contain",
|
|
705
|
-
cover: "cover",
|
|
706
|
-
stretch: "fill",
|
|
707
|
-
center: "none",
|
|
708
|
-
repeat: "none"
|
|
843
|
+
let longPressDeactivationDistance = 10;
|
|
844
|
+
const normalizeDelay = (delay, min = 0, fallback = 0) => Math.max(min, delay ?? fallback);
|
|
845
|
+
const normalizeRect = (rect) => typeof rect === "number" ? {
|
|
846
|
+
bottom: rect,
|
|
847
|
+
left: rect,
|
|
848
|
+
right: rect,
|
|
849
|
+
top: rect
|
|
850
|
+
} : rect;
|
|
851
|
+
const claimed = /* @__PURE__ */ new WeakSet();
|
|
852
|
+
const claimPress = (event) => {
|
|
853
|
+
claimed.add(event);
|
|
709
854
|
};
|
|
710
|
-
const
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
center: "middle",
|
|
714
|
-
bottom: "bottom"
|
|
855
|
+
const pressing = /* @__PURE__ */ new Map();
|
|
856
|
+
const terminatePress = (event) => {
|
|
857
|
+
pressing.get(event.pointerId)?.terminate(event, true);
|
|
715
858
|
};
|
|
716
|
-
const
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
if (shadow !== void 0) out["textShadow"] = shadow;
|
|
859
|
+
const isPressClaimed = (event) => claimed.has(event);
|
|
860
|
+
const isActivationKey = (key) => key === "Enter" || key === " ";
|
|
861
|
+
const hasNativeActivation = (element) => {
|
|
862
|
+
switch (element.tagName) {
|
|
863
|
+
case "BUTTON":
|
|
864
|
+
case "INPUT":
|
|
865
|
+
case "SELECT":
|
|
866
|
+
case "SUMMARY":
|
|
867
|
+
case "TEXTAREA": return true;
|
|
868
|
+
case "A":
|
|
869
|
+
case "AREA": return element.hasAttribute("href");
|
|
870
|
+
default: return element.isContentEditable;
|
|
729
871
|
}
|
|
730
|
-
return out;
|
|
731
872
|
};
|
|
732
|
-
const
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
const origin = toCSSTransformOrigin(value);
|
|
745
|
-
if (origin !== void 0) out["transformOrigin"] = origin;
|
|
746
|
-
return;
|
|
747
|
-
}
|
|
748
|
-
case "boxShadow": {
|
|
749
|
-
const shadow = toCSSBoxShadow(value);
|
|
750
|
-
if (shadow !== void 0) out["boxShadow"] = shadow;
|
|
751
|
-
return;
|
|
752
|
-
}
|
|
753
|
-
case "filter": {
|
|
754
|
-
const filter = toCSSFilter(value);
|
|
755
|
-
if (filter !== void 0) out["filter"] = filter;
|
|
756
|
-
return;
|
|
757
|
-
}
|
|
758
|
-
case "fontWeight":
|
|
759
|
-
out["fontWeight"] = fontWeightNames[String(value)] ?? String(value);
|
|
760
|
-
return;
|
|
761
|
-
case "fontFamily":
|
|
762
|
-
out["fontFamily"] = value === "System" ? systemFontStack : String(value);
|
|
763
|
-
return;
|
|
764
|
-
case "fontVariant":
|
|
765
|
-
out["fontVariant"] = Array.isArray(value) ? value.join(" ") : String(value);
|
|
766
|
-
return;
|
|
767
|
-
case "fontVariationSettings":
|
|
768
|
-
out["fontVariationSettings"] = Array.isArray(value) ? value.map((v) => `'${v.axis}' ${v.value}`).join(", ") : String(value);
|
|
769
|
-
return;
|
|
770
|
-
case "resizeMode": {
|
|
771
|
-
const fit = resizeModeToObjectFit[String(value)];
|
|
772
|
-
if (fit !== void 0 && out["objectFit"] === void 0) out["objectFit"] = fit;
|
|
773
|
-
return;
|
|
774
|
-
}
|
|
775
|
-
case "objectFit":
|
|
776
|
-
out["objectFit"] = String(value);
|
|
777
|
-
return;
|
|
778
|
-
case "textAlignVertical": {
|
|
779
|
-
const align = textAlignVerticalToVerticalAlign[String(value)];
|
|
780
|
-
if (align !== void 0 && out["verticalAlign"] === void 0) out["verticalAlign"] = align;
|
|
781
|
-
return;
|
|
782
|
-
}
|
|
783
|
-
case "backgroundImage":
|
|
784
|
-
if (typeof value === "string") out["backgroundImage"] = value;
|
|
785
|
-
return;
|
|
786
|
-
}
|
|
787
|
-
if (colorProperties.has(name)) {
|
|
788
|
-
const color = toCSSColor(value);
|
|
789
|
-
if (color !== void 0) out[renamedProperties[name] ?? name] = color;
|
|
790
|
-
return;
|
|
873
|
+
const nativeControl = "a[href],area[href],audio[controls],button,input,select,summary,textarea,video[controls],[contenteditable]:not([contenteditable=\"false\"])";
|
|
874
|
+
const startsInNativeControl = (event) => {
|
|
875
|
+
const { currentTarget, target } = event;
|
|
876
|
+
if (!(target instanceof Element)) return false;
|
|
877
|
+
const control = target.closest(nativeControl);
|
|
878
|
+
return control !== null && control !== currentTarget && currentTarget.contains(control);
|
|
879
|
+
};
|
|
880
|
+
const TAP_CLICK_WINDOW_MS = 1e3;
|
|
881
|
+
const stopRetargetedClick = (element, releasedAt) => {
|
|
882
|
+
function end() {
|
|
883
|
+
window.removeEventListener("click", onClick, true);
|
|
884
|
+
window.removeEventListener("pointerdown", end, true);
|
|
791
885
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
if (style === null || style === void 0 || style === false || style === "") return void 0;
|
|
800
|
-
if (!Array.isArray(style)) return style;
|
|
801
|
-
let result;
|
|
802
|
-
for (const entry of style) {
|
|
803
|
-
const flat = flattenStyle(entry);
|
|
804
|
-
if (flat === void 0) continue;
|
|
805
|
-
result = result === void 0 ? { ...flat } : Object.assign(result, flat);
|
|
806
|
-
}
|
|
807
|
-
return result;
|
|
808
|
-
};
|
|
809
|
-
const cache = /* @__PURE__ */ new WeakMap();
|
|
810
|
-
const compileStyle = (style, registry = getStyleRegistry()) => {
|
|
811
|
-
const flat = flattenStyle(style);
|
|
812
|
-
if (flat === void 0) return "";
|
|
813
|
-
const cacheable = Object.isFrozen(flat);
|
|
814
|
-
let perRegistry = cache.get(registry);
|
|
815
|
-
if (cacheable) {
|
|
816
|
-
const cached = perRegistry?.get(flat);
|
|
817
|
-
if (cached !== void 0) return cached;
|
|
818
|
-
}
|
|
819
|
-
const classes = registry.classesFor(resolveStyle(flat));
|
|
820
|
-
if (cacheable) {
|
|
821
|
-
if (perRegistry === void 0) {
|
|
822
|
-
perRegistry = /* @__PURE__ */ new WeakMap();
|
|
823
|
-
cache.set(registry, perRegistry);
|
|
824
|
-
}
|
|
825
|
-
perRegistry.set(flat, classes);
|
|
886
|
+
function onClick(event) {
|
|
887
|
+
if (event.detail === 0) return;
|
|
888
|
+
end();
|
|
889
|
+
if (event.timeStamp - releasedAt > TAP_CLICK_WINDOW_MS) return;
|
|
890
|
+
if (event.target instanceof Node && element.contains(event.target)) return;
|
|
891
|
+
event.preventDefault();
|
|
892
|
+
event.stopImmediatePropagation();
|
|
826
893
|
}
|
|
827
|
-
|
|
894
|
+
window.addEventListener("click", onClick, true);
|
|
895
|
+
window.addEventListener("pointerdown", end, true);
|
|
828
896
|
};
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
left: 0,
|
|
833
|
-
right: 0,
|
|
834
|
-
top: 0,
|
|
835
|
-
bottom: 0
|
|
897
|
+
const clear = (timer) => {
|
|
898
|
+
if (timer !== null) clearTimeout(timer);
|
|
899
|
+
return null;
|
|
836
900
|
};
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
901
|
+
var Pressability = class {
|
|
902
|
+
constructor(config) {
|
|
903
|
+
this.state = "NOT_RESPONDER";
|
|
904
|
+
this.element = null;
|
|
905
|
+
this.region = null;
|
|
906
|
+
this.pointerId = null;
|
|
907
|
+
this.key = null;
|
|
908
|
+
this.activatePosition = null;
|
|
909
|
+
this.activateTime = null;
|
|
910
|
+
this.hovered = false;
|
|
911
|
+
this.pointerClickPending = false;
|
|
912
|
+
this.cancelClick = false;
|
|
913
|
+
this.hoverInTimer = null;
|
|
914
|
+
this.hoverOutTimer = null;
|
|
915
|
+
this.longPressTimer = null;
|
|
916
|
+
this.pressDelayTimer = null;
|
|
917
|
+
this.pressOutTimer = null;
|
|
918
|
+
this.config = config;
|
|
919
|
+
this.handlers = this.createEventHandlers();
|
|
920
|
+
}
|
|
921
|
+
configure(config) {
|
|
922
|
+
this.config = config;
|
|
923
|
+
}
|
|
924
|
+
reset() {
|
|
925
|
+
this.hoverInTimer = clear(this.hoverInTimer);
|
|
926
|
+
this.hoverOutTimer = clear(this.hoverOutTimer);
|
|
927
|
+
this.longPressTimer = clear(this.longPressTimer);
|
|
928
|
+
this.pressDelayTimer = clear(this.pressDelayTimer);
|
|
929
|
+
this.pressOutTimer = clear(this.pressOutTimer);
|
|
930
|
+
if (this.pointerId !== null) pressing.delete(this.pointerId);
|
|
931
|
+
this.config = Object.freeze({});
|
|
932
|
+
}
|
|
933
|
+
getEventHandlers() {
|
|
934
|
+
return this.handlers;
|
|
935
|
+
}
|
|
936
|
+
terminate(event, clickFollows) {
|
|
937
|
+
const element = this.element;
|
|
938
|
+
if (event.pointerId !== this.pointerId || element === null) return;
|
|
939
|
+
this.pointerId = null;
|
|
940
|
+
pressing.delete(event.pointerId);
|
|
941
|
+
this.pointerClickPending = clickFollows;
|
|
942
|
+
this.receiveSignal("RESPONDER_TERMINATED", toGestureResponderEvent(event, element));
|
|
943
|
+
}
|
|
944
|
+
static setLongPressDeactivationDistance(distance) {
|
|
945
|
+
longPressDeactivationDistance = distance;
|
|
946
|
+
}
|
|
947
|
+
createEventHandlers() {
|
|
948
|
+
return {
|
|
949
|
+
onPointerDown: (event) => {
|
|
950
|
+
const native = event.nativeEvent;
|
|
951
|
+
if (event.button !== 0 || claimed.has(native) || this.config.disabled === true) return;
|
|
952
|
+
if (startsInNativeControl(event)) return;
|
|
953
|
+
claimed.add(native);
|
|
954
|
+
if (this.pointerId !== null || this.key !== null) return;
|
|
955
|
+
const element = event.currentTarget;
|
|
956
|
+
this.pointerId = event.pointerId;
|
|
957
|
+
pressing.set(event.pointerId, this);
|
|
958
|
+
this.pointerClickPending = true;
|
|
959
|
+
try {
|
|
960
|
+
element.setPointerCapture(event.pointerId);
|
|
961
|
+
} catch {}
|
|
962
|
+
this.grant(element, toGestureResponderEvent(event, element));
|
|
963
|
+
},
|
|
964
|
+
onPointerMove: (event) => {
|
|
965
|
+
const element = this.element;
|
|
966
|
+
if (event.pointerId !== this.pointerId || element === null) return;
|
|
967
|
+
const pressEvent = toGestureResponderEvent(event, element);
|
|
968
|
+
this.config.onPressMove?.(pressEvent);
|
|
969
|
+
const region = this.region;
|
|
970
|
+
if (region === null) return;
|
|
971
|
+
const { pageX, pageY } = pressEvent.nativeEvent;
|
|
972
|
+
const start = this.activatePosition;
|
|
973
|
+
if (start !== null && Math.hypot(start.pageX - pageX, start.pageY - pageY) > longPressDeactivationDistance) this.longPressTimer = clear(this.longPressTimer);
|
|
974
|
+
if (this.isWithinRegion(pageX, pageY, region)) this.receiveSignal("ENTER_PRESS_RECT", pressEvent);
|
|
975
|
+
else {
|
|
976
|
+
this.longPressTimer = clear(this.longPressTimer);
|
|
977
|
+
this.receiveSignal("LEAVE_PRESS_RECT", pressEvent);
|
|
978
|
+
}
|
|
979
|
+
},
|
|
980
|
+
onPointerUp: (event) => {
|
|
981
|
+
const element = this.element;
|
|
982
|
+
if (event.pointerId !== this.pointerId || element === null) return;
|
|
983
|
+
this.pointerId = null;
|
|
984
|
+
pressing.delete(event.pointerId);
|
|
985
|
+
this.receiveSignal("RESPONDER_RELEASE", toGestureResponderEvent(event, element));
|
|
986
|
+
if (event.pointerType !== "mouse") stopRetargetedClick(element, event.timeStamp);
|
|
987
|
+
},
|
|
988
|
+
onPointerCancel: (event) => {
|
|
989
|
+
this.terminate(event, false);
|
|
990
|
+
},
|
|
991
|
+
onClick: (event) => {
|
|
992
|
+
const native = event.nativeEvent;
|
|
993
|
+
if (claimed.has(native) || startsInNativeControl(event)) return;
|
|
994
|
+
if (this.pointerClickPending && event.detail > 0) {
|
|
995
|
+
this.pointerClickPending = false;
|
|
996
|
+
claimed.add(native);
|
|
997
|
+
if (this.cancelClick) event.preventDefault();
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
if (this.config.disabled === true) return;
|
|
1001
|
+
claimed.add(native);
|
|
1002
|
+
this.config.onPress?.(toGestureResponderEvent(event, event.currentTarget));
|
|
1003
|
+
},
|
|
1004
|
+
onKeyDown: (event) => {
|
|
1005
|
+
if (!isActivationKey(event.key) || event.repeat || event.nativeEvent.isComposing) return;
|
|
1006
|
+
const element = event.currentTarget;
|
|
1007
|
+
if (event.target !== element || this.config.disabled === true) return;
|
|
1008
|
+
if (hasNativeActivation(element)) return;
|
|
1009
|
+
if (event.key === " ") event.preventDefault();
|
|
1010
|
+
if (this.pointerId !== null || this.key !== null) return;
|
|
1011
|
+
this.key = event.key;
|
|
1012
|
+
this.grant(element, toGestureResponderEvent(event, element));
|
|
1013
|
+
},
|
|
1014
|
+
onKeyUp: (event) => {
|
|
1015
|
+
const element = this.element;
|
|
1016
|
+
if (event.key !== this.key || element === null) return;
|
|
1017
|
+
this.key = null;
|
|
1018
|
+
this.receiveSignal("RESPONDER_RELEASE", toGestureResponderEvent(event, element));
|
|
1019
|
+
},
|
|
1020
|
+
onFocus: (event) => {
|
|
1021
|
+
this.config.onFocus?.(event);
|
|
1022
|
+
},
|
|
1023
|
+
onBlur: (event) => {
|
|
1024
|
+
const element = this.element;
|
|
1025
|
+
if (this.key !== null && element !== null && event.target === event.currentTarget) {
|
|
1026
|
+
this.key = null;
|
|
1027
|
+
this.receiveSignal("RESPONDER_TERMINATED", toGestureResponderEvent(event, element));
|
|
1028
|
+
}
|
|
1029
|
+
this.config.onBlur?.(event);
|
|
1030
|
+
},
|
|
1031
|
+
onPointerEnter: (event) => {
|
|
1032
|
+
if (event.pointerType === "touch") return;
|
|
1033
|
+
this.hovered = true;
|
|
1034
|
+
this.hoverOutTimer = clear(this.hoverOutTimer);
|
|
1035
|
+
this.hover(event, this.config.onHoverIn, this.config.delayHoverIn, "in");
|
|
1036
|
+
},
|
|
1037
|
+
onPointerLeave: (event) => {
|
|
1038
|
+
if (!this.hovered) return;
|
|
1039
|
+
this.hovered = false;
|
|
1040
|
+
this.hoverInTimer = clear(this.hoverInTimer);
|
|
1041
|
+
this.hover(event, this.config.onHoverOut, this.config.delayHoverOut, "out");
|
|
1042
|
+
},
|
|
1043
|
+
onContextMenu: (event) => {
|
|
1044
|
+
if (this.pointerId !== null && this.config.onLongPress != null) event.preventDefault();
|
|
1045
|
+
}
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
hover(event, callback, delay, direction) {
|
|
1049
|
+
if (callback == null) return;
|
|
1050
|
+
const hoverEvent = toMouseEvent(event);
|
|
1051
|
+
const wait = normalizeDelay(delay);
|
|
1052
|
+
if (wait === 0) {
|
|
1053
|
+
callback(hoverEvent);
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
1056
|
+
const timer = setTimeout(() => callback(hoverEvent), wait);
|
|
1057
|
+
if (direction === "in") this.hoverInTimer = timer;
|
|
1058
|
+
else this.hoverOutTimer = timer;
|
|
1059
|
+
}
|
|
1060
|
+
grant(element, event) {
|
|
1061
|
+
this.pressOutTimer = clear(this.pressOutTimer);
|
|
1062
|
+
this.element = element;
|
|
1063
|
+
this.cancelClick = false;
|
|
1064
|
+
this.state = "NOT_RESPONDER";
|
|
1065
|
+
this.receiveSignal("RESPONDER_GRANT", event);
|
|
1066
|
+
const delayPressIn = normalizeDelay(this.config.delayPressIn);
|
|
1067
|
+
if (delayPressIn > 0) this.pressDelayTimer = setTimeout(() => this.receiveSignal("DELAY", event), delayPressIn);
|
|
1068
|
+
else this.receiveSignal("DELAY", event);
|
|
1069
|
+
const delayLongPress = normalizeDelay(this.config.delayLongPress, 10, DEFAULT_LONG_PRESS_DELAY_MS - delayPressIn);
|
|
1070
|
+
this.longPressTimer = setTimeout(() => {
|
|
1071
|
+
if (this.state === "RESPONDER_ACTIVE_PRESS_IN" || this.state === "RESPONDER_ACTIVE_LONG_PRESS_IN") this.receiveSignal("LONG_PRESS_DETECTED", event);
|
|
1072
|
+
}, delayLongPress + delayPressIn);
|
|
1073
|
+
}
|
|
1074
|
+
receiveSignal(signal, event) {
|
|
1075
|
+
const prevState = this.state;
|
|
1076
|
+
const nextState = transitions[prevState][signal];
|
|
1077
|
+
if (nextState === void 0 || nextState === prevState) return;
|
|
1078
|
+
this.performTransitionSideEffects(prevState, nextState, signal, event);
|
|
1079
|
+
this.state = nextState;
|
|
1080
|
+
}
|
|
1081
|
+
performTransitionSideEffects(prevState, nextState, signal, event) {
|
|
1082
|
+
if (isTerminal(signal)) {
|
|
1083
|
+
this.activatePosition = null;
|
|
1084
|
+
this.longPressTimer = clear(this.longPressTimer);
|
|
1085
|
+
}
|
|
1086
|
+
const isInitialTransition = prevState === "NOT_RESPONDER" && nextState === "RESPONDER_INACTIVE_PRESS_IN";
|
|
1087
|
+
const isActivationTransition = !isActivation(prevState) && isActivation(nextState);
|
|
1088
|
+
if (isInitialTransition || isActivationTransition) this.measureRegion();
|
|
1089
|
+
if (isPressIn(prevState) && signal === "LONG_PRESS_DETECTED") this.config.onLongPress?.(event);
|
|
1090
|
+
const isPrevActive = isActive(prevState);
|
|
1091
|
+
const isNextActive = isActive(nextState);
|
|
1092
|
+
if (!isPrevActive && isNextActive) this.activate(event);
|
|
1093
|
+
else if (isPrevActive && !isNextActive) this.deactivate(event);
|
|
1094
|
+
if (isPressIn(prevState) && signal === "RESPONDER_RELEASE") {
|
|
1095
|
+
if (!isNextActive && !isPrevActive) {
|
|
1096
|
+
this.activate(event);
|
|
1097
|
+
this.deactivate(event);
|
|
1098
|
+
}
|
|
1099
|
+
const { onLongPress, onPress } = this.config;
|
|
1100
|
+
if (onLongPress != null && prevState === "RESPONDER_ACTIVE_LONG_PRESS_IN") this.cancelClick = true;
|
|
1101
|
+
else if (onPress != null) {
|
|
1102
|
+
onPress(event);
|
|
1103
|
+
if (event.isDefaultPrevented()) this.cancelClick = true;
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
this.pressDelayTimer = clear(this.pressDelayTimer);
|
|
1107
|
+
}
|
|
1108
|
+
activate(event) {
|
|
1109
|
+
const { pageX, pageY } = event.nativeEvent;
|
|
1110
|
+
this.activatePosition = {
|
|
1111
|
+
pageX,
|
|
1112
|
+
pageY
|
|
1113
|
+
};
|
|
1114
|
+
this.activateTime = Date.now();
|
|
1115
|
+
this.config.onPressIn?.(event);
|
|
1116
|
+
}
|
|
1117
|
+
deactivate(event) {
|
|
1118
|
+
const { onPressOut } = this.config;
|
|
1119
|
+
if (onPressOut != null) {
|
|
1120
|
+
const minPressDuration = normalizeDelay(this.config.minPressDuration, 0, DEFAULT_MIN_PRESS_DURATION);
|
|
1121
|
+
const pressDuration = Date.now() - (this.activateTime ?? 0);
|
|
1122
|
+
const delayPressOut = Math.max(minPressDuration - pressDuration, normalizeDelay(this.config.delayPressOut));
|
|
1123
|
+
if (delayPressOut > 0) this.pressOutTimer = setTimeout(() => onPressOut(event), delayPressOut);
|
|
1124
|
+
else onPressOut(event);
|
|
1125
|
+
}
|
|
1126
|
+
this.activateTime = null;
|
|
1127
|
+
}
|
|
1128
|
+
measureRegion() {
|
|
1129
|
+
if (this.element === null) return;
|
|
1130
|
+
const rect = this.element.getBoundingClientRect();
|
|
1131
|
+
if (rect.width === 0 && rect.height === 0 && rect.top === 0 && rect.left === 0) return;
|
|
1132
|
+
this.region = {
|
|
1133
|
+
bottom: rect.bottom + window.scrollY,
|
|
1134
|
+
left: rect.left + window.scrollX,
|
|
1135
|
+
right: rect.right + window.scrollX,
|
|
1136
|
+
top: rect.top + window.scrollY
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
isWithinRegion(pageX, pageY, region) {
|
|
1140
|
+
const hitSlop = normalizeRect(this.config.hitSlop);
|
|
1141
|
+
const offset = normalizeRect(this.config.pressRectOffset);
|
|
1142
|
+
const bottom = region.bottom + (hitSlop?.bottom ?? 0) + (offset?.bottom ?? DEFAULT_PRESS_RECT_OFFSETS.bottom);
|
|
1143
|
+
const left = region.left - (hitSlop?.left ?? 0) - (offset?.left ?? DEFAULT_PRESS_RECT_OFFSETS.left);
|
|
1144
|
+
const right = region.right + (hitSlop?.right ?? 0) + (offset?.right ?? DEFAULT_PRESS_RECT_OFFSETS.right);
|
|
1145
|
+
const top = region.top - (hitSlop?.top ?? 0) - (offset?.top ?? DEFAULT_PRESS_RECT_OFFSETS.top);
|
|
1146
|
+
return pageX > left && pageX < right && pageY > top && pageY < bottom;
|
|
1147
|
+
}
|
|
840
1148
|
};
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
1149
|
+
// src/apis/PanResponder/index.ts
|
|
1150
|
+
let current = null;
|
|
1151
|
+
let grantEvent = null;
|
|
1152
|
+
let nextStateID = 1;
|
|
1153
|
+
let listening = false;
|
|
1154
|
+
const blockNativeScroll = (event) => {
|
|
1155
|
+
if (current !== null && current.blocksNative && event.cancelable) event.preventDefault();
|
|
845
1156
|
};
|
|
846
|
-
const
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
create,
|
|
851
|
-
flatten,
|
|
852
|
-
compose
|
|
853
|
-
});
|
|
854
|
-
// src/apis/useColorScheme/index.ts
|
|
855
|
-
const subscribe$1 = (onChange) => {
|
|
856
|
-
const subscription = Appearance.addChangeListener(onChange);
|
|
857
|
-
return () => subscription.remove();
|
|
1157
|
+
const listenForTouchMove = () => {
|
|
1158
|
+
if (listening || typeof document === "undefined") return;
|
|
1159
|
+
listening = true;
|
|
1160
|
+
document.addEventListener("touchmove", blockNativeScroll, { passive: false });
|
|
858
1161
|
};
|
|
859
|
-
const
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
1162
|
+
const newGestureState = () => ({
|
|
1163
|
+
stateID: nextStateID++,
|
|
1164
|
+
moveX: 0,
|
|
1165
|
+
moveY: 0,
|
|
1166
|
+
x0: 0,
|
|
1167
|
+
y0: 0,
|
|
1168
|
+
dx: 0,
|
|
1169
|
+
dy: 0,
|
|
1170
|
+
vx: 0,
|
|
1171
|
+
vy: 0,
|
|
1172
|
+
numberActiveTouches: 0,
|
|
1173
|
+
_accountsForMovesUpTo: 0
|
|
868
1174
|
});
|
|
869
|
-
const
|
|
870
|
-
|
|
871
|
-
|
|
1175
|
+
const centroid = (pointers) => {
|
|
1176
|
+
let x = 0;
|
|
1177
|
+
let y = 0;
|
|
1178
|
+
for (const pointer of pointers.values()) {
|
|
1179
|
+
x += pointer.clientX + window.scrollX;
|
|
1180
|
+
y += pointer.clientY + window.scrollY;
|
|
1181
|
+
}
|
|
1182
|
+
const count = pointers.size || 1;
|
|
1183
|
+
return {
|
|
1184
|
+
x: x / count,
|
|
1185
|
+
y: y / count
|
|
1186
|
+
};
|
|
872
1187
|
};
|
|
873
|
-
const
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
polite: "polite",
|
|
880
|
-
assertive: "assertive"
|
|
1188
|
+
const define = (target, fields) => {
|
|
1189
|
+
for (const key in fields) Object.defineProperty(target, key, {
|
|
1190
|
+
value: fields[key],
|
|
1191
|
+
configurable: true,
|
|
1192
|
+
writable: true
|
|
1193
|
+
});
|
|
881
1194
|
};
|
|
882
|
-
const
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
1195
|
+
const touchOf = (pointer, rect, timestamp) => ({
|
|
1196
|
+
changedTouches: [],
|
|
1197
|
+
identifier: pointer.id,
|
|
1198
|
+
locationX: pointer.clientX - rect.left,
|
|
1199
|
+
locationY: pointer.clientY - rect.top,
|
|
1200
|
+
pageX: pointer.clientX + window.scrollX,
|
|
1201
|
+
pageY: pointer.clientY + window.scrollY,
|
|
1202
|
+
target: pointer.target,
|
|
1203
|
+
timestamp,
|
|
1204
|
+
touches: []
|
|
1205
|
+
});
|
|
1206
|
+
const toResponderEvent = (event, responder, changed) => {
|
|
1207
|
+
const rect = (responder.element ?? event.currentTarget).getBoundingClientRect();
|
|
1208
|
+
const touches = [...responder.pointers.values()].map((p) => touchOf(p, rect, event.timeStamp));
|
|
1209
|
+
const touch = touchOf(changed, rect, event.timeStamp);
|
|
1210
|
+
define(event.nativeEvent, {
|
|
1211
|
+
...touch,
|
|
1212
|
+
force: event.pressure,
|
|
1213
|
+
touches,
|
|
1214
|
+
changedTouches: [touch]
|
|
1215
|
+
});
|
|
1216
|
+
return event;
|
|
1217
|
+
};
|
|
1218
|
+
const pointerOf = (event) => ({
|
|
1219
|
+
id: event.pointerId,
|
|
1220
|
+
clientX: event.clientX,
|
|
1221
|
+
clientY: event.clientY,
|
|
1222
|
+
target: event.target
|
|
1223
|
+
});
|
|
1224
|
+
const updateMove = (responder, time) => {
|
|
1225
|
+
const state = responder.gestureState;
|
|
1226
|
+
const next = centroid(responder.pointers);
|
|
1227
|
+
const last = responder.last;
|
|
1228
|
+
if (last !== null) {
|
|
1229
|
+
const dt = time - last.time;
|
|
1230
|
+
state.dx += next.x - last.x;
|
|
1231
|
+
state.dy += next.y - last.y;
|
|
1232
|
+
state.vx = dt > 0 ? (next.x - last.x) / dt : 0;
|
|
1233
|
+
state.vy = dt > 0 ? (next.y - last.y) / dt : 0;
|
|
919
1234
|
}
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
1235
|
+
state.moveX = next.x;
|
|
1236
|
+
state.moveY = next.y;
|
|
1237
|
+
state._accountsForMovesUpTo = time;
|
|
1238
|
+
responder.last = {
|
|
1239
|
+
x: next.x,
|
|
1240
|
+
y: next.y,
|
|
1241
|
+
time
|
|
1242
|
+
};
|
|
928
1243
|
};
|
|
929
|
-
|
|
930
|
-
const
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
search: "searchbox",
|
|
938
|
-
keyboardkey: "none"
|
|
1244
|
+
const rebase = (responder, time) => {
|
|
1245
|
+
const next = centroid(responder.pointers);
|
|
1246
|
+
responder.last = {
|
|
1247
|
+
x: next.x,
|
|
1248
|
+
y: next.y,
|
|
1249
|
+
time
|
|
1250
|
+
};
|
|
1251
|
+
responder.gestureState.numberActiveTouches = responder.pointers.size;
|
|
939
1252
|
};
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1253
|
+
const grant = (responder, event, responderEvent) => {
|
|
1254
|
+
const state = responder.gestureState;
|
|
1255
|
+
const point = centroid(responder.pointers);
|
|
1256
|
+
state.x0 = point.x;
|
|
1257
|
+
state.y0 = point.y;
|
|
1258
|
+
state.dx = 0;
|
|
1259
|
+
state.dy = 0;
|
|
1260
|
+
state.vx = 0;
|
|
1261
|
+
state.vy = 0;
|
|
1262
|
+
responder.last = {
|
|
1263
|
+
x: point.x,
|
|
1264
|
+
y: point.y,
|
|
1265
|
+
time: event.timeStamp
|
|
1266
|
+
};
|
|
1267
|
+
responder.element = event.currentTarget;
|
|
1268
|
+
current = responder;
|
|
1269
|
+
grantEvent = event.nativeEvent;
|
|
1270
|
+
claimPress(event.nativeEvent);
|
|
1271
|
+
terminatePress(event);
|
|
1272
|
+
for (const pointer of responder.pointers.values()) try {
|
|
1273
|
+
responder.element.setPointerCapture(pointer.id);
|
|
1274
|
+
} catch {}
|
|
1275
|
+
responder.config.onPanResponderGrant?.(responderEvent, state);
|
|
1276
|
+
responder.blocksNative = responder.config.onShouldBlockNativeResponder?.(responderEvent, state) !== false;
|
|
1277
|
+
responder.config.onPanResponderStart?.(responderEvent, state);
|
|
953
1278
|
};
|
|
954
|
-
const
|
|
955
|
-
const
|
|
956
|
-
|
|
957
|
-
const
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
tag: defaultTag,
|
|
961
|
-
role
|
|
962
|
-
} : resolved;
|
|
1279
|
+
const releaseCapture = (responder) => {
|
|
1280
|
+
const element = responder.element;
|
|
1281
|
+
if (element === null) return;
|
|
1282
|
+
for (const pointer of responder.pointers.values()) try {
|
|
1283
|
+
if (element.hasPointerCapture(pointer.id)) element.releasePointerCapture(pointer.id);
|
|
1284
|
+
} catch {}
|
|
963
1285
|
};
|
|
964
|
-
const
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1286
|
+
const finish = (responder) => {
|
|
1287
|
+
releaseCapture(responder);
|
|
1288
|
+
if (current === responder) current = null;
|
|
1289
|
+
responder.element = null;
|
|
1290
|
+
responder.last = null;
|
|
1291
|
+
};
|
|
1292
|
+
const negotiate = (responder, event, responderEvent, predicate) => {
|
|
1293
|
+
if (current === responder) return;
|
|
1294
|
+
if (current !== null && grantEvent === event.nativeEvent) return;
|
|
1295
|
+
if (predicate === void 0 || !predicate(responderEvent, responder.gestureState)) return;
|
|
1296
|
+
if (current !== null) {
|
|
1297
|
+
const holder = current;
|
|
1298
|
+
if (holder.config.onPanResponderTerminationRequest?.(responderEvent, holder.gestureState) === false) {
|
|
1299
|
+
responder.config.onPanResponderReject?.(responderEvent, responder.gestureState);
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
holder.config.onPanResponderTerminate?.(responderEvent, holder.gestureState);
|
|
1303
|
+
finish(holder);
|
|
1304
|
+
}
|
|
1305
|
+
grant(responder, event, responderEvent);
|
|
1306
|
+
};
|
|
1307
|
+
const createHandlers = (responder) => {
|
|
1308
|
+
const down = (event, capture) => {
|
|
1309
|
+
const pointer = pointerOf(event);
|
|
1310
|
+
const first = responder.pointers.size === 0;
|
|
1311
|
+
if (capture) {
|
|
1312
|
+
if (first) responder.gestureState = newGestureState();
|
|
1313
|
+
responder.pointers.set(pointer.id, pointer);
|
|
1314
|
+
rebase(responder, event.timeStamp);
|
|
1315
|
+
}
|
|
1316
|
+
const responderEvent = toResponderEvent(event, responder, pointer);
|
|
1317
|
+
const { config } = responder;
|
|
1318
|
+
if (current === responder) {
|
|
1319
|
+
if (capture) config.onPanResponderStart?.(responderEvent, responder.gestureState);
|
|
1320
|
+
return;
|
|
1321
|
+
}
|
|
1322
|
+
if (!capture && isPressClaimed(event.nativeEvent)) return;
|
|
1323
|
+
negotiate(responder, event, responderEvent, capture ? config.onStartShouldSetPanResponderCapture : config.onStartShouldSetPanResponder);
|
|
968
1324
|
};
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
1325
|
+
const move = (event, capture) => {
|
|
1326
|
+
const pointer = responder.pointers.get(event.pointerId);
|
|
1327
|
+
if (pointer === void 0) return;
|
|
1328
|
+
if (capture) {
|
|
1329
|
+
pointer.clientX = event.clientX;
|
|
1330
|
+
pointer.clientY = event.clientY;
|
|
1331
|
+
updateMove(responder, event.timeStamp);
|
|
1332
|
+
}
|
|
1333
|
+
const responderEvent = toResponderEvent(event, responder, pointer);
|
|
1334
|
+
const { config } = responder;
|
|
1335
|
+
if (current === responder) {
|
|
1336
|
+
if (capture) config.onPanResponderMove?.(responderEvent, responder.gestureState);
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1339
|
+
negotiate(responder, event, responderEvent, capture ? config.onMoveShouldSetPanResponderCapture : config.onMoveShouldSetPanResponder);
|
|
975
1340
|
};
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
1341
|
+
const end = (event, cancel) => {
|
|
1342
|
+
const pointer = responder.pointers.get(event.pointerId);
|
|
1343
|
+
if (pointer === void 0) return;
|
|
1344
|
+
const responderEvent = toResponderEvent(event, responder, pointer);
|
|
1345
|
+
responder.pointers.delete(event.pointerId);
|
|
1346
|
+
const { config, gestureState } = responder;
|
|
1347
|
+
const responding = current === responder;
|
|
1348
|
+
if (responding && cancel) {
|
|
1349
|
+
config.onPanResponderTerminate?.(responderEvent, gestureState);
|
|
1350
|
+
responder.pointers.clear();
|
|
1351
|
+
finish(responder);
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
if (responding) config.onPanResponderEnd?.(responderEvent, gestureState);
|
|
1355
|
+
if (responder.pointers.size === 0) {
|
|
1356
|
+
if (responding) config.onPanResponderRelease?.(responderEvent, gestureState);
|
|
1357
|
+
finish(responder);
|
|
1358
|
+
} else rebase(responder, event.timeStamp);
|
|
979
1359
|
};
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1360
|
+
return {
|
|
1361
|
+
onPointerDownCapture: (event) => down(event, true),
|
|
1362
|
+
onPointerDown: (event) => down(event, false),
|
|
1363
|
+
onPointerMoveCapture: (event) => move(event, true),
|
|
1364
|
+
onPointerMove: (event) => move(event, false),
|
|
1365
|
+
onPointerUp: (event) => end(event, false),
|
|
1366
|
+
onPointerCancel: (event) => end(event, true)
|
|
987
1367
|
};
|
|
988
1368
|
};
|
|
989
|
-
const
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
const useElementLayout = (ref, onLayout) => {
|
|
998
|
-
const latest = useRef(onLayout);
|
|
999
|
-
useEffect(() => {
|
|
1000
|
-
latest.current = onLayout;
|
|
1001
|
-
}, [onLayout]);
|
|
1002
|
-
const enabled = onLayout !== void 0;
|
|
1003
|
-
useEffect(() => {
|
|
1004
|
-
const element = ref.current;
|
|
1005
|
-
if (element === null || !enabled) return;
|
|
1006
|
-
const observer = new ResizeObserver(() => latest.current?.(measure(element)));
|
|
1007
|
-
observer.observe(element);
|
|
1008
|
-
return () => observer.disconnect();
|
|
1009
|
-
}, [ref, enabled]);
|
|
1010
|
-
};
|
|
1011
|
-
// src/components/View/index.tsx
|
|
1012
|
-
const resetStyle$2 = Object.freeze({
|
|
1013
|
-
alignItems: "stretch",
|
|
1014
|
-
backgroundColor: "transparent",
|
|
1015
|
-
border: "0 solid black",
|
|
1016
|
-
boxSizing: "border-box",
|
|
1017
|
-
display: "flex",
|
|
1018
|
-
flexBasis: "auto",
|
|
1019
|
-
flexDirection: "column",
|
|
1020
|
-
flexShrink: 0,
|
|
1021
|
-
listStyle: "none",
|
|
1022
|
-
margin: 0,
|
|
1023
|
-
minHeight: 0,
|
|
1024
|
-
minWidth: 0,
|
|
1025
|
-
padding: 0,
|
|
1026
|
-
position: "relative",
|
|
1027
|
-
textDecoration: "none",
|
|
1028
|
-
zIndex: 0
|
|
1029
|
-
});
|
|
1030
|
-
const pointerEventsClass = (registry, value) => registry.staticClass(`rn-pe-${value}`, value === "box-none" ? [".rn-pe-box-none{pointer-events:none}", ".rn-pe-box-none>*{pointer-events:auto}"] : [".rn-pe-box-only{pointer-events:auto}", ".rn-pe-box-only>*{pointer-events:none}"]);
|
|
1031
|
-
function View(props) {
|
|
1032
|
-
return useViewElement(props);
|
|
1033
|
-
}
|
|
1034
|
-
function useViewElement(props, extraClassName) {
|
|
1035
|
-
const { children, onLayout, pointerEvents, ref, style, ...rest } = props;
|
|
1036
|
-
const element = useRef(null);
|
|
1037
|
-
useImperativeHandle(ref, () => element.current, []);
|
|
1038
|
-
useElementLayout(element, onLayout);
|
|
1039
|
-
const registry = useStyleRegistry();
|
|
1040
|
-
const { tag, role } = resolveTag(rest, "div", children != null);
|
|
1041
|
-
let className = compileStyle([
|
|
1042
|
-
resetStyle$2,
|
|
1043
|
-
style,
|
|
1044
|
-
pointerEvents === "none" || pointerEvents === "auto" ? { pointerEvents } : void 0
|
|
1045
|
-
], registry);
|
|
1046
|
-
if (pointerEvents === "box-none" || pointerEvents === "box-only") className = `${className} ${pointerEventsClass(registry, pointerEvents)}`;
|
|
1047
|
-
if (extraClassName !== void 0) className = `${className} ${extraClassName}`;
|
|
1048
|
-
const domProps = toDOMProps(rest);
|
|
1049
|
-
if (role !== void 0) domProps["role"] = role;
|
|
1050
|
-
if (tag.length === 2 && tag[0] === "h") delete domProps["aria-level"];
|
|
1051
|
-
if (tag === "button") domProps["type"] = "button";
|
|
1052
|
-
domProps["className"] = className;
|
|
1053
|
-
domProps["ref"] = element;
|
|
1054
|
-
return createElement(tag, domProps, children);
|
|
1055
|
-
}
|
|
1056
|
-
// src/components/ActivityIndicator/index.tsx
|
|
1057
|
-
const GRAY = "#999999";
|
|
1058
|
-
const SPIN_CLASS = "rn-activity-indicator";
|
|
1059
|
-
const SPIN_RULES = ["@keyframes rn-activity-indicator-spin{to{transform:rotate(360deg)}}", `.${SPIN_CLASS}{animation:rn-activity-indicator-spin .75s linear infinite}`];
|
|
1060
|
-
const pausedStyle = { animationPlayState: "paused" };
|
|
1061
|
-
function ActivityIndicator(props) {
|
|
1062
|
-
const { animating = true, color = GRAY, hidesWhenStopped = true, onLayout, ref, size = "small", style, ...rest } = props;
|
|
1063
|
-
const spinClass = useStyleRegistry().staticClass(SPIN_CLASS, SPIN_RULES);
|
|
1064
|
-
const stroke = toCSSColor(color) ?? GRAY;
|
|
1065
|
-
const sizeStyle = size === "small" ? styles$2.sizeSmall : size === "large" ? styles$2.sizeLarge : {
|
|
1066
|
-
width: size,
|
|
1067
|
-
height: size
|
|
1369
|
+
const PanResponder = { create(config) {
|
|
1370
|
+
const responder = {
|
|
1371
|
+
config,
|
|
1372
|
+
gestureState: newGestureState(),
|
|
1373
|
+
pointers: /* @__PURE__ */ new Map(),
|
|
1374
|
+
element: null,
|
|
1375
|
+
last: null,
|
|
1376
|
+
blocksNative: true
|
|
1068
1377
|
};
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
width: "100%",
|
|
1084
|
-
children: [/* @__PURE__ */ jsx("circle", {
|
|
1085
|
-
cx: "16",
|
|
1086
|
-
cy: "16",
|
|
1087
|
-
fill: "none",
|
|
1088
|
-
opacity: "0.2",
|
|
1089
|
-
r: "14",
|
|
1090
|
-
stroke,
|
|
1091
|
-
strokeWidth: "4"
|
|
1092
|
-
}), /* @__PURE__ */ jsx("circle", {
|
|
1093
|
-
cx: "16",
|
|
1094
|
-
cy: "16",
|
|
1095
|
-
fill: "none",
|
|
1096
|
-
r: "14",
|
|
1097
|
-
stroke,
|
|
1098
|
-
strokeDasharray: "80",
|
|
1099
|
-
strokeDashoffset: "60",
|
|
1100
|
-
strokeWidth: "4"
|
|
1101
|
-
})]
|
|
1102
|
-
})
|
|
1103
|
-
})
|
|
1104
|
-
});
|
|
1105
|
-
}
|
|
1106
|
-
const styles$2 = StyleSheet.create({
|
|
1107
|
-
container: {
|
|
1108
|
-
alignItems: "center",
|
|
1109
|
-
justifyContent: "center"
|
|
1110
|
-
},
|
|
1111
|
-
sizeSmall: {
|
|
1112
|
-
width: 20,
|
|
1113
|
-
height: 20
|
|
1114
|
-
},
|
|
1115
|
-
sizeLarge: {
|
|
1116
|
-
width: 36,
|
|
1117
|
-
height: 36
|
|
1378
|
+
listenForTouchMove();
|
|
1379
|
+
return {
|
|
1380
|
+
panHandlers: createHandlers(responder),
|
|
1381
|
+
getInteractionHandle: () => null
|
|
1382
|
+
};
|
|
1383
|
+
} };
|
|
1384
|
+
// src/apis/PixelRatio/index.ts
|
|
1385
|
+
const PixelRatio = {
|
|
1386
|
+
get: () => Dimensions.get("window").scale,
|
|
1387
|
+
getFontScale: () => Dimensions.get("window").fontScale,
|
|
1388
|
+
getPixelSizeForLayoutSize: (layoutSize) => Math.round(layoutSize * PixelRatio.get()),
|
|
1389
|
+
roundToNearestPixel: (layoutSize) => {
|
|
1390
|
+
const ratio = PixelRatio.get();
|
|
1391
|
+
return Math.round(layoutSize * ratio) / ratio;
|
|
1118
1392
|
},
|
|
1119
|
-
|
|
1120
|
-
});
|
|
1121
|
-
// src/events/responderEvent.ts
|
|
1122
|
-
const hasPoint = (event) => event.clientX !== void 0 && !(event.type === "click" && event.detail === 0);
|
|
1123
|
-
const activeTypes = /* @__PURE__ */ new Set([
|
|
1124
|
-
"pointerdown",
|
|
1125
|
-
"pointermove",
|
|
1126
|
-
"keydown"
|
|
1127
|
-
]);
|
|
1128
|
-
const define = (target, fields) => {
|
|
1129
|
-
for (const key in fields) {
|
|
1130
|
-
if (key in target) continue;
|
|
1131
|
-
Object.defineProperty(target, key, {
|
|
1132
|
-
value: fields[key],
|
|
1133
|
-
configurable: true
|
|
1134
|
-
});
|
|
1135
|
-
}
|
|
1136
|
-
};
|
|
1137
|
-
const toGestureResponderEvent = (event, element) => {
|
|
1138
|
-
const native = event.nativeEvent;
|
|
1139
|
-
if (!("locationX" in native)) {
|
|
1140
|
-
const rect = element.getBoundingClientRect();
|
|
1141
|
-
const point = hasPoint(native);
|
|
1142
|
-
const clientX = point ? native.clientX ?? 0 : rect.left + rect.width / 2;
|
|
1143
|
-
const clientY = point ? native.clientY ?? 0 : rect.top + rect.height / 2;
|
|
1144
|
-
const touch = {
|
|
1145
|
-
changedTouches: [],
|
|
1146
|
-
force: native.pressure,
|
|
1147
|
-
identifier: native.pointerId ?? 0,
|
|
1148
|
-
locationX: clientX - rect.left,
|
|
1149
|
-
locationY: clientY - rect.top,
|
|
1150
|
-
pageX: clientX + window.scrollX,
|
|
1151
|
-
pageY: clientY + window.scrollY,
|
|
1152
|
-
target: native.target,
|
|
1153
|
-
timestamp: event.timeStamp,
|
|
1154
|
-
touches: []
|
|
1155
|
-
};
|
|
1156
|
-
define(native, {
|
|
1157
|
-
...touch,
|
|
1158
|
-
changedTouches: [touch],
|
|
1159
|
-
touches: activeTypes.has(native.type) ? [touch] : []
|
|
1160
|
-
});
|
|
1161
|
-
}
|
|
1162
|
-
return event;
|
|
1163
|
-
};
|
|
1164
|
-
const toMouseEvent = (event) => {
|
|
1165
|
-
define(event.nativeEvent, { timestamp: event.timeStamp });
|
|
1166
|
-
return event;
|
|
1393
|
+
startDetecting: () => {}
|
|
1167
1394
|
};
|
|
1168
|
-
// src/
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1395
|
+
// src/reactNativeVersion.ts
|
|
1396
|
+
const reactNativeVersion = {
|
|
1397
|
+
major: 0,
|
|
1398
|
+
minor: 88,
|
|
1399
|
+
patch: 1,
|
|
1400
|
+
prerelease: void 0
|
|
1401
|
+
};
|
|
1402
|
+
// src/apis/Platform/index.ts
|
|
1403
|
+
const Platform = {
|
|
1404
|
+
OS: "web",
|
|
1405
|
+
get Version() {
|
|
1406
|
+
return hasDOM() ? navigator.userAgent : "";
|
|
1177
1407
|
},
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
RESPONDER_RELEASE: "NOT_RESPONDER",
|
|
1181
|
-
RESPONDER_TERMINATED: "NOT_RESPONDER",
|
|
1182
|
-
ENTER_PRESS_RECT: "RESPONDER_INACTIVE_PRESS_IN",
|
|
1183
|
-
LEAVE_PRESS_RECT: "RESPONDER_INACTIVE_PRESS_OUT"
|
|
1408
|
+
get constants() {
|
|
1409
|
+
return { reactNativeVersion };
|
|
1184
1410
|
},
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
RESPONDER_TERMINATED: "NOT_RESPONDER",
|
|
1188
|
-
ENTER_PRESS_RECT: "RESPONDER_ACTIVE_PRESS_IN",
|
|
1189
|
-
LEAVE_PRESS_RECT: "RESPONDER_ACTIVE_PRESS_OUT",
|
|
1190
|
-
LONG_PRESS_DETECTED: "RESPONDER_ACTIVE_LONG_PRESS_IN"
|
|
1411
|
+
get isTV() {
|
|
1412
|
+
return false;
|
|
1191
1413
|
},
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
RESPONDER_TERMINATED: "NOT_RESPONDER",
|
|
1195
|
-
ENTER_PRESS_RECT: "RESPONDER_ACTIVE_PRESS_IN",
|
|
1196
|
-
LEAVE_PRESS_RECT: "RESPONDER_ACTIVE_PRESS_OUT"
|
|
1414
|
+
get isTesting() {
|
|
1415
|
+
return isTestEnv();
|
|
1197
1416
|
},
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
RESPONDER_TERMINATED: "NOT_RESPONDER",
|
|
1201
|
-
ENTER_PRESS_RECT: "RESPONDER_ACTIVE_LONG_PRESS_IN",
|
|
1202
|
-
LEAVE_PRESS_RECT: "RESPONDER_ACTIVE_LONG_PRESS_OUT",
|
|
1203
|
-
LONG_PRESS_DETECTED: "RESPONDER_ACTIVE_LONG_PRESS_IN"
|
|
1417
|
+
get isDisableAnimations() {
|
|
1418
|
+
return matchesMedia("(prefers-reduced-motion: reduce)");
|
|
1204
1419
|
},
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
ENTER_PRESS_RECT: "RESPONDER_ACTIVE_LONG_PRESS_IN",
|
|
1209
|
-
LEAVE_PRESS_RECT: "RESPONDER_ACTIVE_LONG_PRESS_OUT"
|
|
1420
|
+
select(spec) {
|
|
1421
|
+
if ("web" in spec) return spec.web;
|
|
1422
|
+
if ("default" in spec) return spec.default;
|
|
1210
1423
|
}
|
|
1211
1424
|
};
|
|
1212
|
-
|
|
1213
|
-
const
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
bottom: 30,
|
|
1220
|
-
left: 20,
|
|
1221
|
-
right: 20,
|
|
1222
|
-
top: 20
|
|
1425
|
+
// src/apis/processColor/index.ts
|
|
1426
|
+
const processColor = (color) => {
|
|
1427
|
+
if (color === void 0 || color === null) return color;
|
|
1428
|
+
if (typeof color !== "string" && typeof color !== "number") return null;
|
|
1429
|
+
const rgba = normalizeColor(color);
|
|
1430
|
+
if (rgba === null || rgba === void 0) return null;
|
|
1431
|
+
return (rgba << 24 | rgba >>> 8) >>> 0;
|
|
1223
1432
|
};
|
|
1224
|
-
|
|
1225
|
-
const
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1433
|
+
// src/apis/Share/index.ts
|
|
1434
|
+
const isAbort = (error) => error instanceof DOMException && error.name === "AbortError";
|
|
1435
|
+
/**
|
|
1436
|
+
* Opens the browser's share sheet with `navigator.share`. It shares the title, the message,
|
|
1437
|
+
* and the URL. A closed sheet resolves `dismissedAction`, as on iOS.
|
|
1438
|
+
*/
|
|
1439
|
+
const Share = {
|
|
1440
|
+
share(content, options = {}) {
|
|
1441
|
+
if (typeof content !== "object" || content === null) throw new Error("Content to share must be a valid object");
|
|
1442
|
+
if (typeof content.url !== "string" && typeof content.message !== "string") throw new Error("At least one of URL or message is required");
|
|
1443
|
+
if (typeof options !== "object" || options === null) throw new Error("Options must be a valid object");
|
|
1444
|
+
if (!hasDOM() || typeof navigator.share !== "function") return Promise.reject(/* @__PURE__ */ new Error("Unsupported platform"));
|
|
1445
|
+
const data = {};
|
|
1446
|
+
if (typeof content.title === "string") data.title = content.title;
|
|
1447
|
+
if (typeof content.message === "string") data.text = content.message;
|
|
1448
|
+
if (typeof content.url === "string") data.url = content.url;
|
|
1449
|
+
return navigator.share(data).then(() => ({
|
|
1450
|
+
action: "sharedAction",
|
|
1451
|
+
activityType: null
|
|
1452
|
+
}), (error) => {
|
|
1453
|
+
if (isAbort(error)) return {
|
|
1454
|
+
action: "dismissedAction",
|
|
1455
|
+
activityType: null
|
|
1456
|
+
};
|
|
1457
|
+
throw error;
|
|
1458
|
+
});
|
|
1459
|
+
},
|
|
1460
|
+
sharedAction: "sharedAction",
|
|
1461
|
+
dismissedAction: "dismissedAction"
|
|
1245
1462
|
};
|
|
1246
|
-
|
|
1247
|
-
const
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1463
|
+
// src/apis/StyleSheet/index.ts
|
|
1464
|
+
const absoluteFillObject = {
|
|
1465
|
+
position: "absolute",
|
|
1466
|
+
left: 0,
|
|
1467
|
+
right: 0,
|
|
1468
|
+
top: 0,
|
|
1469
|
+
bottom: 0
|
|
1252
1470
|
};
|
|
1253
|
-
const
|
|
1254
|
-
|
|
1255
|
-
return
|
|
1471
|
+
const create = (styles) => {
|
|
1472
|
+
for (const key in styles) Object.freeze(styles[key]);
|
|
1473
|
+
return Object.freeze(styles);
|
|
1256
1474
|
};
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
if (this.isWithinRegion(pageX, pageY, region)) this.receiveSignal("ENTER_PRESS_RECT", pressEvent);
|
|
1321
|
-
else {
|
|
1322
|
-
this.longPressTimer = clear(this.longPressTimer);
|
|
1323
|
-
this.receiveSignal("LEAVE_PRESS_RECT", pressEvent);
|
|
1324
|
-
}
|
|
1325
|
-
},
|
|
1326
|
-
onPointerUp: (event) => {
|
|
1327
|
-
const element = this.element;
|
|
1328
|
-
if (event.pointerId !== this.pointerId || element === null) return;
|
|
1329
|
-
this.pointerId = null;
|
|
1330
|
-
this.receiveSignal("RESPONDER_RELEASE", toGestureResponderEvent(event, element));
|
|
1331
|
-
},
|
|
1332
|
-
onPointerCancel: (event) => {
|
|
1333
|
-
const element = this.element;
|
|
1334
|
-
if (event.pointerId !== this.pointerId || element === null) return;
|
|
1335
|
-
this.pointerId = null;
|
|
1336
|
-
this.pointerClickPending = false;
|
|
1337
|
-
this.receiveSignal("RESPONDER_TERMINATED", toGestureResponderEvent(event, element));
|
|
1338
|
-
},
|
|
1339
|
-
onClick: (event) => {
|
|
1340
|
-
const native = event.nativeEvent;
|
|
1341
|
-
if (claimed.has(native) || startsInNativeControl(event)) return;
|
|
1342
|
-
if (this.pointerClickPending && event.detail > 0) {
|
|
1343
|
-
this.pointerClickPending = false;
|
|
1344
|
-
claimed.add(native);
|
|
1345
|
-
if (this.cancelClick) event.preventDefault();
|
|
1346
|
-
return;
|
|
1347
|
-
}
|
|
1348
|
-
if (this.config.disabled === true) return;
|
|
1349
|
-
claimed.add(native);
|
|
1350
|
-
this.config.onPress?.(toGestureResponderEvent(event, event.currentTarget));
|
|
1351
|
-
},
|
|
1352
|
-
onKeyDown: (event) => {
|
|
1353
|
-
if (!isActivationKey(event.key) || event.repeat || event.nativeEvent.isComposing) return;
|
|
1354
|
-
const element = event.currentTarget;
|
|
1355
|
-
if (event.target !== element || this.config.disabled === true) return;
|
|
1356
|
-
if (hasNativeActivation(element)) return;
|
|
1357
|
-
if (event.key === " ") event.preventDefault();
|
|
1358
|
-
if (this.pointerId !== null || this.key !== null) return;
|
|
1359
|
-
this.key = event.key;
|
|
1360
|
-
this.grant(element, toGestureResponderEvent(event, element));
|
|
1361
|
-
},
|
|
1362
|
-
onKeyUp: (event) => {
|
|
1363
|
-
const element = this.element;
|
|
1364
|
-
if (event.key !== this.key || element === null) return;
|
|
1365
|
-
this.key = null;
|
|
1366
|
-
this.receiveSignal("RESPONDER_RELEASE", toGestureResponderEvent(event, element));
|
|
1367
|
-
},
|
|
1368
|
-
onFocus: (event) => {
|
|
1369
|
-
this.config.onFocus?.(event);
|
|
1370
|
-
},
|
|
1371
|
-
onBlur: (event) => {
|
|
1372
|
-
const element = this.element;
|
|
1373
|
-
if (this.key !== null && element !== null && event.target === event.currentTarget) {
|
|
1374
|
-
this.key = null;
|
|
1375
|
-
this.receiveSignal("RESPONDER_TERMINATED", toGestureResponderEvent(event, element));
|
|
1376
|
-
}
|
|
1377
|
-
this.config.onBlur?.(event);
|
|
1378
|
-
},
|
|
1379
|
-
onPointerEnter: (event) => {
|
|
1380
|
-
if (event.pointerType === "touch") return;
|
|
1381
|
-
this.hovered = true;
|
|
1382
|
-
this.hoverOutTimer = clear(this.hoverOutTimer);
|
|
1383
|
-
this.hover(event, this.config.onHoverIn, this.config.delayHoverIn, "in");
|
|
1384
|
-
},
|
|
1385
|
-
onPointerLeave: (event) => {
|
|
1386
|
-
if (!this.hovered) return;
|
|
1387
|
-
this.hovered = false;
|
|
1388
|
-
this.hoverInTimer = clear(this.hoverInTimer);
|
|
1389
|
-
this.hover(event, this.config.onHoverOut, this.config.delayHoverOut, "out");
|
|
1390
|
-
},
|
|
1391
|
-
onContextMenu: (event) => {
|
|
1392
|
-
if (this.pointerId !== null && this.config.onLongPress != null) event.preventDefault();
|
|
1393
|
-
}
|
|
1475
|
+
const flatten = (style) => flattenStyle(style);
|
|
1476
|
+
const compose = (style1, style2) => {
|
|
1477
|
+
if (style1 && style2) return [style1, style2];
|
|
1478
|
+
return style1 || style2;
|
|
1479
|
+
};
|
|
1480
|
+
const StyleSheet = Object.freeze({
|
|
1481
|
+
absoluteFill: Object.freeze(absoluteFillObject),
|
|
1482
|
+
absoluteFillObject,
|
|
1483
|
+
hairlineWidth: 1,
|
|
1484
|
+
create,
|
|
1485
|
+
flatten,
|
|
1486
|
+
compose
|
|
1487
|
+
});
|
|
1488
|
+
// src/apis/useColorScheme/index.ts
|
|
1489
|
+
const subscribe$1 = (onChange) => {
|
|
1490
|
+
const subscription = Appearance.addChangeListener(onChange);
|
|
1491
|
+
return () => subscription.remove();
|
|
1492
|
+
};
|
|
1493
|
+
const getSnapshot$1 = () => Appearance.getColorScheme();
|
|
1494
|
+
const getServerSnapshot$1 = () => "light";
|
|
1495
|
+
const useColorScheme = () => useSyncExternalStore(subscribe$1, getSnapshot$1, getServerSnapshot$1);
|
|
1496
|
+
// src/apis/useWindowDimensions/index.ts
|
|
1497
|
+
const serverSnapshot = Object.freeze({
|
|
1498
|
+
width: 0,
|
|
1499
|
+
height: 0,
|
|
1500
|
+
scale: 1,
|
|
1501
|
+
fontScale: 1
|
|
1502
|
+
});
|
|
1503
|
+
const subscribe = (onChange) => {
|
|
1504
|
+
const subscription = Dimensions.addEventListener("change", onChange);
|
|
1505
|
+
return () => subscription.remove();
|
|
1506
|
+
};
|
|
1507
|
+
const getSnapshot = () => Dimensions.get("window");
|
|
1508
|
+
const getServerSnapshot = () => serverSnapshot;
|
|
1509
|
+
const useWindowDimensions = () => useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
1510
|
+
// src/apis/Vibration/index.ts
|
|
1511
|
+
const DEFAULT_LENGTH = 400;
|
|
1512
|
+
let repeatTimer;
|
|
1513
|
+
const canVibrate = () => hasDOM() && typeof navigator.vibrate === "function";
|
|
1514
|
+
const stopRepeat = () => {
|
|
1515
|
+
if (repeatTimer === void 0) return;
|
|
1516
|
+
clearTimeout(repeatTimer);
|
|
1517
|
+
repeatTimer = void 0;
|
|
1518
|
+
};
|
|
1519
|
+
/**
|
|
1520
|
+
* Vibrates the device with `navigator.vibrate`, with Android's rules: the durations apply, and
|
|
1521
|
+
* an array starts with a wait.
|
|
1522
|
+
*/
|
|
1523
|
+
const Vibration = {
|
|
1524
|
+
vibrate(pattern = DEFAULT_LENGTH, repeat = false) {
|
|
1525
|
+
let steps;
|
|
1526
|
+
if (typeof pattern === "number") steps = [pattern];
|
|
1527
|
+
else if (Array.isArray(pattern)) steps = [0, ...pattern];
|
|
1528
|
+
else throw new Error("Vibration pattern should be a number or array");
|
|
1529
|
+
stopRepeat();
|
|
1530
|
+
if (!canVibrate()) return;
|
|
1531
|
+
navigator.vibrate(steps);
|
|
1532
|
+
if (!repeat || typeof pattern === "number") return;
|
|
1533
|
+
const total = steps.reduce((sum, step) => sum + step, 0);
|
|
1534
|
+
if (total <= 0) return;
|
|
1535
|
+
const again = () => {
|
|
1536
|
+
navigator.vibrate(steps);
|
|
1537
|
+
repeatTimer = setTimeout(again, total);
|
|
1394
1538
|
};
|
|
1539
|
+
repeatTimer = setTimeout(again, total);
|
|
1540
|
+
},
|
|
1541
|
+
cancel() {
|
|
1542
|
+
stopRepeat();
|
|
1543
|
+
if (canVibrate()) navigator.vibrate(0);
|
|
1395
1544
|
}
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1545
|
+
};
|
|
1546
|
+
// src/style/webStyle.ts
|
|
1547
|
+
/**
|
|
1548
|
+
* A frozen style for the internals of a component that uses CSS React Native doesn't have, such
|
|
1549
|
+
* as `overflowX` or `position: 'sticky'`. The compiler passes unknown names through to CSS.
|
|
1550
|
+
*/
|
|
1551
|
+
const webStyle = (style) => Object.freeze(style);
|
|
1552
|
+
// src/render/domProps.ts
|
|
1553
|
+
const liveRegionToAriaLive = {
|
|
1554
|
+
none: "off",
|
|
1555
|
+
polite: "polite",
|
|
1556
|
+
assertive: "assertive"
|
|
1557
|
+
};
|
|
1558
|
+
const nativeHandler = /^on(Press|Layout|TextLayout|Accessibility|Magic|Responder|Refresh|.*ShouldSet)/;
|
|
1559
|
+
const isNativeHandler = (name) => nativeHandler.test(name);
|
|
1560
|
+
const passThrough = /* @__PURE__ */ new Set([
|
|
1561
|
+
"lang",
|
|
1562
|
+
"dir",
|
|
1563
|
+
"target",
|
|
1564
|
+
"rel",
|
|
1565
|
+
"download"
|
|
1566
|
+
]);
|
|
1567
|
+
const toDOMProps = (props) => {
|
|
1568
|
+
const out = {};
|
|
1569
|
+
for (const name in props) {
|
|
1570
|
+
const value = props[name];
|
|
1571
|
+
if (value === void 0) continue;
|
|
1572
|
+
if (name.startsWith("aria-") || name.startsWith("data-") || passThrough.has(name)) out[name] = value;
|
|
1573
|
+
else if (name.startsWith("on") && name.length > 2 && !nativeHandler.test(name)) out[name] = value;
|
|
1407
1574
|
}
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1575
|
+
const { accessibilityLabel, accessibilityLabelledBy, accessibilityHint, accessibilityState, accessibilityValue, accessibilityLiveRegion, accessibilityElementsHidden, accessibilityViewIsModal, importantForAccessibility, id, nativeID, testID, tabIndex, focusable, href } = props;
|
|
1576
|
+
if (accessibilityLabel !== void 0) out["aria-label"] ??= accessibilityLabel;
|
|
1577
|
+
if (accessibilityLabelledBy !== void 0) out["aria-labelledby"] ??= Array.isArray(accessibilityLabelledBy) ? accessibilityLabelledBy.join(" ") : accessibilityLabelledBy;
|
|
1578
|
+
if (accessibilityHint !== void 0) out["aria-description"] ??= accessibilityHint;
|
|
1579
|
+
if (accessibilityLiveRegion !== void 0) out["aria-live"] ??= liveRegionToAriaLive[accessibilityLiveRegion];
|
|
1580
|
+
if (accessibilityViewIsModal !== void 0) out["aria-modal"] ??= accessibilityViewIsModal;
|
|
1581
|
+
if (accessibilityElementsHidden === true || importantForAccessibility === "no-hide-descendants") out["aria-hidden"] ??= true;
|
|
1582
|
+
if (accessibilityState !== void 0) {
|
|
1583
|
+
const { busy, checked, disabled, expanded, selected } = accessibilityState;
|
|
1584
|
+
if (busy !== void 0) out["aria-busy"] ??= busy;
|
|
1585
|
+
if (checked !== void 0) out["aria-checked"] ??= checked;
|
|
1586
|
+
if (disabled !== void 0) out["aria-disabled"] ??= disabled;
|
|
1587
|
+
if (expanded !== void 0) out["aria-expanded"] ??= expanded;
|
|
1588
|
+
if (selected !== void 0) out["aria-selected"] ??= selected;
|
|
1421
1589
|
}
|
|
1422
|
-
|
|
1423
|
-
const
|
|
1424
|
-
|
|
1425
|
-
if (
|
|
1426
|
-
|
|
1427
|
-
|
|
1590
|
+
if (accessibilityValue !== void 0) {
|
|
1591
|
+
const { max, min, now, text } = accessibilityValue;
|
|
1592
|
+
if (max !== void 0) out["aria-valuemax"] ??= max;
|
|
1593
|
+
if (min !== void 0) out["aria-valuemin"] ??= min;
|
|
1594
|
+
if (now !== void 0) out["aria-valuenow"] ??= now;
|
|
1595
|
+
if (text !== void 0) out["aria-valuetext"] ??= text;
|
|
1428
1596
|
}
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
if (
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
this.deactivate(event);
|
|
1446
|
-
}
|
|
1447
|
-
const { onLongPress, onPress } = this.config;
|
|
1448
|
-
if (onLongPress != null && prevState === "RESPONDER_ACTIVE_LONG_PRESS_IN") this.cancelClick = true;
|
|
1449
|
-
else if (onPress != null) {
|
|
1450
|
-
onPress(event);
|
|
1451
|
-
if (event.isDefaultPrevented()) this.cancelClick = true;
|
|
1452
|
-
}
|
|
1597
|
+
const domId = id ?? nativeID;
|
|
1598
|
+
if (domId !== void 0) out["id"] = domId;
|
|
1599
|
+
if (testID !== void 0) out["data-testid"] = testID;
|
|
1600
|
+
if (href !== void 0) out["href"] = href;
|
|
1601
|
+
if (tabIndex !== void 0) out["tabIndex"] = tabIndex;
|
|
1602
|
+
else if (focusable === true) out["tabIndex"] = 0;
|
|
1603
|
+
else if (focusable === false) out["tabIndex"] = -1;
|
|
1604
|
+
return out;
|
|
1605
|
+
};
|
|
1606
|
+
// src/render/hostMethods.ts
|
|
1607
|
+
const applyNativeProps = (element, nativeProps) => {
|
|
1608
|
+
const inline = element.style;
|
|
1609
|
+
for (const [name, value] of Object.entries(nativeProps)) {
|
|
1610
|
+
if (name !== "style") {
|
|
1611
|
+
warnOnce(`set-native-props-${name}`, `setNativeProps: only \`style\` works on the web. \`${name}\` has no effect.`);
|
|
1612
|
+
continue;
|
|
1453
1613
|
}
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
activate(event) {
|
|
1457
|
-
const { pageX, pageY } = event.nativeEvent;
|
|
1458
|
-
this.activatePosition = {
|
|
1459
|
-
pageX,
|
|
1460
|
-
pageY
|
|
1461
|
-
};
|
|
1462
|
-
this.activateTime = Date.now();
|
|
1463
|
-
this.config.onPressIn?.(event);
|
|
1614
|
+
const flat = flattenStyle(value);
|
|
1615
|
+
if (flat !== void 0) Object.assign(inline, resolveStyle(flat));
|
|
1464
1616
|
}
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1617
|
+
};
|
|
1618
|
+
const hostMethods = (element) => ({
|
|
1619
|
+
measure: (callback) => {
|
|
1620
|
+
const { left, top, width, height } = element.getBoundingClientRect();
|
|
1621
|
+
const parent = element.parentElement?.getBoundingClientRect();
|
|
1622
|
+
callback(left - (parent?.left ?? 0), top - (parent?.top ?? 0), width, height, left, top);
|
|
1623
|
+
},
|
|
1624
|
+
measureInWindow: (callback) => {
|
|
1625
|
+
const { left, top, width, height } = element.getBoundingClientRect();
|
|
1626
|
+
callback(left, top, width, height);
|
|
1627
|
+
},
|
|
1628
|
+
measureLayout: (relativeToNativeNode, onSuccess, onFail) => {
|
|
1629
|
+
if (!(relativeToNativeNode instanceof Element) || !element.isConnected || !relativeToNativeNode.contains(element)) {
|
|
1630
|
+
onFail?.();
|
|
1631
|
+
return;
|
|
1473
1632
|
}
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1633
|
+
const { left, top, width, height } = element.getBoundingClientRect();
|
|
1634
|
+
const ancestor = relativeToNativeNode.getBoundingClientRect();
|
|
1635
|
+
onSuccess(left - ancestor.left, top - ancestor.top, width, height);
|
|
1636
|
+
},
|
|
1637
|
+
setNativeProps: (nativeProps) => applyNativeProps(element, nativeProps)
|
|
1638
|
+
});
|
|
1639
|
+
const withHostMethods = (element) => {
|
|
1640
|
+
const instance = element;
|
|
1641
|
+
if (instance.measureInWindow === void 0) Object.assign(instance, hostMethods(element));
|
|
1642
|
+
return instance;
|
|
1643
|
+
};
|
|
1644
|
+
// src/render/resolveTag.ts
|
|
1645
|
+
const legacyRoleToRole = {
|
|
1646
|
+
header: "heading",
|
|
1647
|
+
image: "img",
|
|
1648
|
+
imagebutton: "button",
|
|
1649
|
+
summary: "region",
|
|
1650
|
+
text: "none",
|
|
1651
|
+
adjustable: "slider",
|
|
1652
|
+
search: "searchbox",
|
|
1653
|
+
keyboardkey: "none"
|
|
1654
|
+
};
|
|
1655
|
+
const roleToTag = {
|
|
1656
|
+
article: "article",
|
|
1657
|
+
banner: "header",
|
|
1658
|
+
button: "button",
|
|
1659
|
+
complementary: "aside",
|
|
1660
|
+
contentinfo: "footer",
|
|
1661
|
+
figure: "figure",
|
|
1662
|
+
form: "form",
|
|
1663
|
+
list: "ul",
|
|
1664
|
+
listitem: "li",
|
|
1665
|
+
main: "main",
|
|
1666
|
+
navigation: "nav",
|
|
1667
|
+
separator: "hr"
|
|
1668
|
+
};
|
|
1669
|
+
const headingLevel = (level) => level !== void 0 && Number.isInteger(level) && level >= 1 && level <= 6 ? level : 2;
|
|
1670
|
+
const voidTags = /* @__PURE__ */ new Set(["hr"]);
|
|
1671
|
+
const resolveTag = (props, defaultTag, hasChildren = false) => {
|
|
1672
|
+
const role = props.role ?? mapLegacyRole(props.accessibilityRole);
|
|
1673
|
+
const resolved = tagForRole(role, props, defaultTag);
|
|
1674
|
+
return hasChildren && voidTags.has(resolved.tag) ? {
|
|
1675
|
+
tag: defaultTag,
|
|
1676
|
+
role
|
|
1677
|
+
} : resolved;
|
|
1678
|
+
};
|
|
1679
|
+
const tagForRole = (role, props, defaultTag) => {
|
|
1680
|
+
if (role === "heading") return {
|
|
1681
|
+
tag: `h${headingLevel(props["aria-level"])}`,
|
|
1682
|
+
role: void 0
|
|
1683
|
+
};
|
|
1684
|
+
if (role === "link") return props.href === void 0 ? {
|
|
1685
|
+
tag: defaultTag,
|
|
1686
|
+
role: "link"
|
|
1687
|
+
} : {
|
|
1688
|
+
tag: "a",
|
|
1689
|
+
role: void 0
|
|
1690
|
+
};
|
|
1691
|
+
if (role === void 0) return {
|
|
1692
|
+
tag: props.href === void 0 ? defaultTag : "a",
|
|
1693
|
+
role: void 0
|
|
1694
|
+
};
|
|
1695
|
+
const tag = roleToTag[role];
|
|
1696
|
+
return tag === void 0 ? {
|
|
1697
|
+
tag: defaultTag,
|
|
1698
|
+
role
|
|
1699
|
+
} : {
|
|
1700
|
+
tag,
|
|
1701
|
+
role: void 0
|
|
1702
|
+
};
|
|
1703
|
+
};
|
|
1704
|
+
const mapLegacyRole = (legacy) => legacy === void 0 ? void 0 : legacyRoleToRole[legacy] ?? legacy;
|
|
1705
|
+
// src/render/useElementLayout.ts
|
|
1706
|
+
const measure = (element) => ({ nativeEvent: { layout: {
|
|
1707
|
+
x: element.offsetLeft,
|
|
1708
|
+
y: element.offsetTop,
|
|
1709
|
+
width: element.offsetWidth,
|
|
1710
|
+
height: element.offsetHeight
|
|
1711
|
+
} } });
|
|
1712
|
+
const useElementLayout = (ref, onLayout) => {
|
|
1713
|
+
const latest = useRef(onLayout);
|
|
1714
|
+
useEffect(() => {
|
|
1715
|
+
latest.current = onLayout;
|
|
1716
|
+
}, [onLayout]);
|
|
1717
|
+
const enabled = onLayout !== void 0;
|
|
1718
|
+
useEffect(() => {
|
|
1719
|
+
const element = ref.current;
|
|
1720
|
+
if (element === null || !enabled) return;
|
|
1721
|
+
const observer = new ResizeObserver(() => latest.current?.(measure(element)));
|
|
1722
|
+
observer.observe(element);
|
|
1723
|
+
return () => observer.disconnect();
|
|
1724
|
+
}, [ref, enabled]);
|
|
1496
1725
|
};
|
|
1726
|
+
// src/components/View/index.tsx
|
|
1727
|
+
const resetStyle$2 = Object.freeze({
|
|
1728
|
+
alignItems: "stretch",
|
|
1729
|
+
backgroundColor: "transparent",
|
|
1730
|
+
border: "0 solid black",
|
|
1731
|
+
boxSizing: "border-box",
|
|
1732
|
+
display: "flex",
|
|
1733
|
+
flexBasis: "auto",
|
|
1734
|
+
flexDirection: "column",
|
|
1735
|
+
flexShrink: 0,
|
|
1736
|
+
listStyle: "none",
|
|
1737
|
+
margin: 0,
|
|
1738
|
+
minHeight: 0,
|
|
1739
|
+
minWidth: 0,
|
|
1740
|
+
padding: 0,
|
|
1741
|
+
position: "relative",
|
|
1742
|
+
textDecoration: "none",
|
|
1743
|
+
zIndex: 0
|
|
1744
|
+
});
|
|
1745
|
+
function View(props) {
|
|
1746
|
+
return useViewElement(props);
|
|
1747
|
+
}
|
|
1748
|
+
function useViewElement(props, extraClassName) {
|
|
1749
|
+
const { children, onLayout, pointerEvents, ref, style, ...rest } = props;
|
|
1750
|
+
const element = useRef(null);
|
|
1751
|
+
useImperativeHandle(ref, () => withHostMethods(element.current), []);
|
|
1752
|
+
useElementLayout(element, onLayout);
|
|
1753
|
+
const registry = useStyleRegistry();
|
|
1754
|
+
const { tag, role } = resolveTag(rest, "div", children != null);
|
|
1755
|
+
let className = joinClassNames(compileReset("rn-view", resetStyle$2, registry), compileStyle(pointerEvents === void 0 ? style : [style, pointerEventsStyle[pointerEvents]], registry));
|
|
1756
|
+
if (extraClassName !== void 0) className = `${className} ${extraClassName}`;
|
|
1757
|
+
const domProps = toDOMProps(rest);
|
|
1758
|
+
if (role !== void 0) domProps["role"] = role;
|
|
1759
|
+
if (tag.length === 2 && tag[0] === "h") delete domProps["aria-level"];
|
|
1760
|
+
if (tag === "button") domProps["type"] = "button";
|
|
1761
|
+
domProps["className"] = className;
|
|
1762
|
+
domProps["ref"] = element;
|
|
1763
|
+
return createElement(tag, domProps, children);
|
|
1764
|
+
}
|
|
1765
|
+
// src/components/ActivityIndicator/index.tsx
|
|
1766
|
+
const GRAY = "#999999";
|
|
1767
|
+
const SPIN_CLASS = "rn-activity-indicator";
|
|
1768
|
+
const SPIN_RULES = ["@keyframes rn-activity-indicator-spin{to{transform:rotate(360deg)}}", `.${SPIN_CLASS}{animation:rn-activity-indicator-spin .75s linear infinite}`];
|
|
1769
|
+
const hiddenStyle$1 = webStyle({ visibility: "hidden" });
|
|
1770
|
+
const pausedStyle = { animationPlayState: "paused" };
|
|
1771
|
+
function ActivityIndicator(props) {
|
|
1772
|
+
const { animating = true, color = GRAY, hidesWhenStopped = true, onLayout, ref, size = "small", style, ...rest } = props;
|
|
1773
|
+
const spinClass = useStyleRegistry().staticClass(SPIN_CLASS, SPIN_RULES);
|
|
1774
|
+
const stroke = toCSSColor(color) ?? GRAY;
|
|
1775
|
+
const sizeStyle = size === "small" ? styles$4.sizeSmall : size === "large" ? styles$4.sizeLarge : {
|
|
1776
|
+
width: size,
|
|
1777
|
+
height: size
|
|
1778
|
+
};
|
|
1779
|
+
return /* @__PURE__ */ jsx(View, {
|
|
1780
|
+
onLayout,
|
|
1781
|
+
style: [styles$4.container, style],
|
|
1782
|
+
children: /* @__PURE__ */ jsx(View, {
|
|
1783
|
+
role: "progressbar",
|
|
1784
|
+
...rest,
|
|
1785
|
+
ref,
|
|
1786
|
+
style: [sizeStyle, !animating && hidesWhenStopped && hiddenStyle$1],
|
|
1787
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
1788
|
+
"aria-hidden": true,
|
|
1789
|
+
className: spinClass,
|
|
1790
|
+
height: "100%",
|
|
1791
|
+
style: animating ? void 0 : pausedStyle,
|
|
1792
|
+
viewBox: "0 0 32 32",
|
|
1793
|
+
width: "100%",
|
|
1794
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
1795
|
+
cx: "16",
|
|
1796
|
+
cy: "16",
|
|
1797
|
+
fill: "none",
|
|
1798
|
+
opacity: "0.2",
|
|
1799
|
+
r: "14",
|
|
1800
|
+
stroke,
|
|
1801
|
+
strokeWidth: "4"
|
|
1802
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
1803
|
+
cx: "16",
|
|
1804
|
+
cy: "16",
|
|
1805
|
+
fill: "none",
|
|
1806
|
+
r: "14",
|
|
1807
|
+
stroke,
|
|
1808
|
+
strokeDasharray: "80",
|
|
1809
|
+
strokeDashoffset: "60",
|
|
1810
|
+
strokeWidth: "4"
|
|
1811
|
+
})]
|
|
1812
|
+
})
|
|
1813
|
+
})
|
|
1814
|
+
});
|
|
1815
|
+
}
|
|
1816
|
+
const styles$4 = StyleSheet.create({
|
|
1817
|
+
container: {
|
|
1818
|
+
alignItems: "center",
|
|
1819
|
+
justifyContent: "center"
|
|
1820
|
+
},
|
|
1821
|
+
sizeSmall: {
|
|
1822
|
+
width: 20,
|
|
1823
|
+
height: 20
|
|
1824
|
+
},
|
|
1825
|
+
sizeLarge: {
|
|
1826
|
+
width: 36,
|
|
1827
|
+
height: 36
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1497
1830
|
// src/events/press/usePressability.ts
|
|
1498
1831
|
function usePressability(config) {
|
|
1499
1832
|
const [pressability, setPressability] = useState(() => config == null ? null : new Pressability(config));
|
|
@@ -1582,7 +1915,7 @@ function Text(props) {
|
|
|
1582
1915
|
const { children, disabled, ellipsizeMode, numberOfLines, onBlur, onFocus, onLayout, onLongPress, onPress, onPressIn, onPressOut, pointerEvents, pressRetentionOffset, ref, selectable, selectionColor, style, suppressHighlighting: _suppressHighlighting, ...rest } = props;
|
|
1583
1916
|
const nested = useContext(TextAncestorContext);
|
|
1584
1917
|
const element = useRef(null);
|
|
1585
|
-
useImperativeHandle(ref, () => element.current, []);
|
|
1918
|
+
useImperativeHandle(ref, () => withHostMethods(element.current), []);
|
|
1586
1919
|
useElementLayout(element, onLayout);
|
|
1587
1920
|
const registry = useStyleRegistry();
|
|
1588
1921
|
const pressable = (onPress != null || onLongPress != null) && disabled !== true;
|
|
@@ -1610,14 +1943,16 @@ function Text(props) {
|
|
|
1610
1943
|
} : rest;
|
|
1611
1944
|
const { tag, role } = resolveTag(roleProps, "span", children != null);
|
|
1612
1945
|
const lineStyle = numberOfLines === void 0 || numberOfLines < 1 ? void 0 : numberOfLines === 1 ? singleLineStyle : multiLineStyle(numberOfLines);
|
|
1613
|
-
|
|
1614
|
-
|
|
1946
|
+
const clipStyle = ellipsizeMode === "clip" ? { textOverflow: "clip" } : void 0;
|
|
1947
|
+
const selectStyle = selectable === false ? { userSelect: "none" } : void 0;
|
|
1948
|
+
const pointerStyle = pointerEvents === void 0 ? void 0 : pointerEventsStyle[pointerEvents];
|
|
1949
|
+
let className = joinClassNames(nested ? compileReset("rn-text-nested", nestedResetStyle, registry) : compileReset("rn-text", resetStyle$1, registry), compileStyle([
|
|
1615
1950
|
style,
|
|
1616
1951
|
lineStyle,
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
], registry);
|
|
1952
|
+
clipStyle,
|
|
1953
|
+
selectStyle,
|
|
1954
|
+
pointerStyle
|
|
1955
|
+
], registry));
|
|
1621
1956
|
if (selectionColor !== void 0) {
|
|
1622
1957
|
const extra = selectionClass$1(registry, selectionColor);
|
|
1623
1958
|
if (extra !== void 0) className = `${className} ${extra}`;
|
|
@@ -1663,7 +1998,7 @@ const DEFAULT_ACTIVE_OPACITY$1 = .2;
|
|
|
1663
1998
|
const notCancelableStyle$2 = Object.freeze({ touchAction: "none" });
|
|
1664
1999
|
const isTrue$1 = (value) => value === void 0 ? void 0 : value === true || value === "true";
|
|
1665
2000
|
const restingOpacity = (style) => {
|
|
1666
|
-
const opacity = flattenStyle(style)?.
|
|
2001
|
+
const opacity = flattenStyle(style)?.opacity;
|
|
1667
2002
|
return typeof opacity === "number" ? opacity : 1;
|
|
1668
2003
|
};
|
|
1669
2004
|
function TouchableOpacity(props) {
|
|
@@ -1780,17 +2115,17 @@ function Button(props) {
|
|
|
1780
2115
|
disabled,
|
|
1781
2116
|
importantForAccessibility: importantForAccessibility === "no" ? "no-hide-descendants" : importantForAccessibility,
|
|
1782
2117
|
style: [
|
|
1783
|
-
styles$
|
|
2118
|
+
styles$3.button,
|
|
1784
2119
|
color != null && color !== "" && { backgroundColor: color },
|
|
1785
|
-
disabled === true && styles$
|
|
2120
|
+
disabled === true && styles$3.buttonDisabled
|
|
1786
2121
|
],
|
|
1787
2122
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1788
|
-
style: [styles$
|
|
2123
|
+
style: [styles$3.text, disabled === true && styles$3.textDisabled],
|
|
1789
2124
|
children: title
|
|
1790
2125
|
})
|
|
1791
2126
|
});
|
|
1792
2127
|
}
|
|
1793
|
-
const styles$
|
|
2128
|
+
const styles$3 = StyleSheet.create({
|
|
1794
2129
|
button: {
|
|
1795
2130
|
backgroundColor: "#2196F3",
|
|
1796
2131
|
borderRadius: 2
|
|
@@ -1804,6 +2139,234 @@ const styles$1 = StyleSheet.create({
|
|
|
1804
2139
|
buttonDisabled: { backgroundColor: "#dfdfdf" },
|
|
1805
2140
|
textDisabled: { color: "#a1a1a1" }
|
|
1806
2141
|
});
|
|
2142
|
+
const DRAG_RATE = .5;
|
|
2143
|
+
/**
|
|
2144
|
+
* The distance of the indicator for a finger distance. It follows the finger at half the speed,
|
|
2145
|
+
* and slows down past the target, so it never goes past twice the target.
|
|
2146
|
+
*/
|
|
2147
|
+
const pullOffset = (distance) => {
|
|
2148
|
+
const travel = Math.max(0, distance) * DRAG_RATE;
|
|
2149
|
+
if (travel <= 64) return travel;
|
|
2150
|
+
const extra = travel - 64;
|
|
2151
|
+
return 64 + 64 * extra / (extra + 64);
|
|
2152
|
+
};
|
|
2153
|
+
/** A release after this finger distance refreshes. */
|
|
2154
|
+
const releasesRefresh = (distance) => distance * DRAG_RATE > 64;
|
|
2155
|
+
// src/components/RefreshControl/index.tsx
|
|
2156
|
+
const ARC = "#000000";
|
|
2157
|
+
const DISC = "#FFFFFF";
|
|
2158
|
+
const ARC_LENGTH = 2 * Math.PI * 8.75;
|
|
2159
|
+
const INDICATOR_CLASS = "rn-refresh";
|
|
2160
|
+
const RULES$2 = [
|
|
2161
|
+
"@keyframes rn-refresh-spin{to{transform:rotate(360deg)}}",
|
|
2162
|
+
`.${INDICATOR_CLASS}{position:absolute;top:0;left:50%;z-index:1;display:flex;width:40px;height:40px;margin-left:-20px;border-radius:50%;box-shadow:0 1px 4px rgba(0,0,0,.3);pointer-events:none;opacity:0;transform:translateY(calc(var(--rn-refresh-top) - 100%));transition:transform .2s ease-out,opacity .2s}`,
|
|
2163
|
+
`.${INDICATOR_CLASS}[data-size=large]{width:56px;height:56px;margin-left:-28px}`,
|
|
2164
|
+
`.${INDICATOR_CLASS}[data-refreshing]{opacity:1;transform:translateY(calc(var(--rn-refresh-top) + 64px - 100%))}`,
|
|
2165
|
+
`.${INDICATOR_CLASS}>svg{width:100%;height:100%}`,
|
|
2166
|
+
`.${INDICATOR_CLASS}[data-refreshing]>svg{animation:rn-refresh-spin .75s linear infinite}`,
|
|
2167
|
+
`.${INDICATOR_CLASS} circle{stroke-dasharray:0 ${ARC_LENGTH}}`,
|
|
2168
|
+
`.${INDICATOR_CLASS}[data-refreshing] circle{stroke-dasharray:${ARC_LENGTH * .75} ${ARC_LENGTH}}`,
|
|
2169
|
+
`@media (prefers-reduced-motion:reduce){.${INDICATOR_CLASS}{transition:none}}`
|
|
2170
|
+
];
|
|
2171
|
+
const frameOf = (element) => {
|
|
2172
|
+
let toScreen = new DOMMatrix();
|
|
2173
|
+
for (let node = element; node !== null; node = node.parentElement) {
|
|
2174
|
+
const { transform } = getComputedStyle(node);
|
|
2175
|
+
if (transform !== "none") toScreen = new DOMMatrix(transform).multiply(toScreen);
|
|
2176
|
+
}
|
|
2177
|
+
return toScreen.inverse();
|
|
2178
|
+
};
|
|
2179
|
+
function RefreshControl(props) {
|
|
2180
|
+
const { children, colors, enabled = true, onRefresh, progressBackgroundColor, progressViewOffset = 0, refreshing, size = "default", style, tintColor, title, titleColor: _titleColor, ...rest } = props;
|
|
2181
|
+
const indicatorClass = useStyleRegistry().staticClass(INDICATOR_CLASS, RULES$2);
|
|
2182
|
+
const indicator = useRef(null);
|
|
2183
|
+
const latest = useRef({
|
|
2184
|
+
enabled,
|
|
2185
|
+
refreshing,
|
|
2186
|
+
onRefresh
|
|
2187
|
+
});
|
|
2188
|
+
useLayoutEffect(() => {
|
|
2189
|
+
latest.current = {
|
|
2190
|
+
enabled,
|
|
2191
|
+
refreshing,
|
|
2192
|
+
onRefresh
|
|
2193
|
+
};
|
|
2194
|
+
});
|
|
2195
|
+
useEffect(() => {
|
|
2196
|
+
const element = indicator.current;
|
|
2197
|
+
const area = element?.parentElement;
|
|
2198
|
+
if (!element || !area) return;
|
|
2199
|
+
const svg = element.firstElementChild;
|
|
2200
|
+
const arc = svg.firstElementChild;
|
|
2201
|
+
let gesture = null;
|
|
2202
|
+
let releaseTimer;
|
|
2203
|
+
const scrollTop = () => {
|
|
2204
|
+
const scroller = area.firstElementChild;
|
|
2205
|
+
return scroller instanceof HTMLElement && scroller !== element ? scroller.scrollTop : 0;
|
|
2206
|
+
};
|
|
2207
|
+
const draw = (distance) => {
|
|
2208
|
+
const offset = pullOffset(distance);
|
|
2209
|
+
const progress = Math.min(1, offset / 64);
|
|
2210
|
+
element.style.transition = "none";
|
|
2211
|
+
element.style.opacity = String(Math.min(1, offset / element.offsetHeight));
|
|
2212
|
+
element.style.transform = `translateY(calc(var(--rn-refresh-top) + ${offset}px - 100%))`;
|
|
2213
|
+
svg.style.transform = `rotate(${progress * 270}deg)`;
|
|
2214
|
+
arc.style.strokeDasharray = `${progress * .8 * ARC_LENGTH} ${ARC_LENGTH}`;
|
|
2215
|
+
};
|
|
2216
|
+
const clear = () => {
|
|
2217
|
+
element.style.transition = "";
|
|
2218
|
+
element.style.opacity = "";
|
|
2219
|
+
element.style.transform = "";
|
|
2220
|
+
svg.style.transform = "";
|
|
2221
|
+
arc.style.strokeDasharray = "";
|
|
2222
|
+
};
|
|
2223
|
+
const touchOf = (event) => Array.from(event.changedTouches).find((touch) => touch.identifier === gesture?.id);
|
|
2224
|
+
const onStart = (event) => {
|
|
2225
|
+
const touch = event.touches[0];
|
|
2226
|
+
const { enabled: on, refreshing: busy } = latest.current;
|
|
2227
|
+
gesture = event.touches.length === 1 && touch !== void 0 && on && !busy && scrollTop() <= 0 ? {
|
|
2228
|
+
id: touch.identifier,
|
|
2229
|
+
x: touch.clientX,
|
|
2230
|
+
y: touch.clientY,
|
|
2231
|
+
pulling: false,
|
|
2232
|
+
distance: 0,
|
|
2233
|
+
toLocal: frameOf(area)
|
|
2234
|
+
} : null;
|
|
2235
|
+
};
|
|
2236
|
+
const onMove = (event) => {
|
|
2237
|
+
const touch = touchOf(event);
|
|
2238
|
+
if (gesture === null || touch === void 0) return;
|
|
2239
|
+
const { a, b, c, d } = gesture.toLocal;
|
|
2240
|
+
const screenX = touch.clientX - gesture.x;
|
|
2241
|
+
const screenY = touch.clientY - gesture.y;
|
|
2242
|
+
const dx = a * screenX + c * screenY;
|
|
2243
|
+
const dy = b * screenX + d * screenY;
|
|
2244
|
+
if (!gesture.pulling) {
|
|
2245
|
+
if (dx === 0 && dy === 0) return;
|
|
2246
|
+
if (dy <= 0 || Math.abs(dx) > dy || scrollTop() > 0 || !event.cancelable) {
|
|
2247
|
+
gesture = null;
|
|
2248
|
+
return;
|
|
2249
|
+
}
|
|
2250
|
+
gesture.pulling = true;
|
|
2251
|
+
}
|
|
2252
|
+
event.preventDefault();
|
|
2253
|
+
gesture.distance = Math.max(0, dy);
|
|
2254
|
+
draw(gesture.distance);
|
|
2255
|
+
};
|
|
2256
|
+
const onEnd = (event) => {
|
|
2257
|
+
if (gesture === null || touchOf(event) === void 0) return;
|
|
2258
|
+
const { pulling, distance } = gesture;
|
|
2259
|
+
gesture = null;
|
|
2260
|
+
if (!pulling) return;
|
|
2261
|
+
const refresh = event.type === "touchend" && releasesRefresh(distance);
|
|
2262
|
+
if (refresh) element.setAttribute("data-refreshing", "");
|
|
2263
|
+
clear();
|
|
2264
|
+
if (!refresh) return;
|
|
2265
|
+
latest.current.onRefresh?.();
|
|
2266
|
+
releaseTimer = setTimeout(() => {
|
|
2267
|
+
if (!latest.current.refreshing) element.removeAttribute("data-refreshing");
|
|
2268
|
+
}, 0);
|
|
2269
|
+
};
|
|
2270
|
+
area.addEventListener("touchstart", onStart, { passive: true });
|
|
2271
|
+
area.addEventListener("touchmove", onMove, { passive: false });
|
|
2272
|
+
area.addEventListener("touchend", onEnd);
|
|
2273
|
+
area.addEventListener("touchcancel", onEnd);
|
|
2274
|
+
return () => {
|
|
2275
|
+
area.removeEventListener("touchstart", onStart);
|
|
2276
|
+
area.removeEventListener("touchmove", onMove);
|
|
2277
|
+
area.removeEventListener("touchend", onEnd);
|
|
2278
|
+
area.removeEventListener("touchcancel", onEnd);
|
|
2279
|
+
clearTimeout(releaseTimer);
|
|
2280
|
+
clear();
|
|
2281
|
+
};
|
|
2282
|
+
}, []);
|
|
2283
|
+
const indicatorStyle = {
|
|
2284
|
+
"--rn-refresh-top": `${progressViewOffset}px`,
|
|
2285
|
+
backgroundColor: toCSSColor(progressBackgroundColor) ?? DISC
|
|
2286
|
+
};
|
|
2287
|
+
const arcColor = toCSSColor(colors?.[0]) ?? toCSSColor(tintColor) ?? ARC;
|
|
2288
|
+
return /* @__PURE__ */ jsxs(View, {
|
|
2289
|
+
...rest,
|
|
2290
|
+
"aria-busy": refreshing,
|
|
2291
|
+
style: [styles$2.area, style],
|
|
2292
|
+
children: [children, /* @__PURE__ */ jsx("div", {
|
|
2293
|
+
ref: indicator,
|
|
2294
|
+
"aria-hidden": !refreshing,
|
|
2295
|
+
"aria-label": title,
|
|
2296
|
+
className: indicatorClass,
|
|
2297
|
+
"data-refreshing": refreshing ? "" : void 0,
|
|
2298
|
+
"data-size": size === "large" ? "large" : void 0,
|
|
2299
|
+
role: "progressbar",
|
|
2300
|
+
style: indicatorStyle,
|
|
2301
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
2302
|
+
"aria-hidden": true,
|
|
2303
|
+
viewBox: "0 0 40 40",
|
|
2304
|
+
children: /* @__PURE__ */ jsx("circle", {
|
|
2305
|
+
cx: "20",
|
|
2306
|
+
cy: "20",
|
|
2307
|
+
fill: "none",
|
|
2308
|
+
r: "8.75",
|
|
2309
|
+
stroke: arcColor,
|
|
2310
|
+
strokeLinecap: "round",
|
|
2311
|
+
strokeWidth: "2.5"
|
|
2312
|
+
})
|
|
2313
|
+
})
|
|
2314
|
+
})]
|
|
2315
|
+
});
|
|
2316
|
+
}
|
|
2317
|
+
const styles$2 = StyleSheet.create({ area: {
|
|
2318
|
+
position: "relative",
|
|
2319
|
+
overflow: "hidden"
|
|
2320
|
+
} });
|
|
2321
|
+
// src/style/splitLayoutProps.ts
|
|
2322
|
+
const OUTER = /* @__PURE__ */ new Set([
|
|
2323
|
+
"margin",
|
|
2324
|
+
"marginHorizontal",
|
|
2325
|
+
"marginVertical",
|
|
2326
|
+
"marginBottom",
|
|
2327
|
+
"marginTop",
|
|
2328
|
+
"marginLeft",
|
|
2329
|
+
"marginRight",
|
|
2330
|
+
"flex",
|
|
2331
|
+
"flexGrow",
|
|
2332
|
+
"flexShrink",
|
|
2333
|
+
"flexBasis",
|
|
2334
|
+
"alignSelf",
|
|
2335
|
+
"height",
|
|
2336
|
+
"minHeight",
|
|
2337
|
+
"maxHeight",
|
|
2338
|
+
"width",
|
|
2339
|
+
"minWidth",
|
|
2340
|
+
"maxWidth",
|
|
2341
|
+
"position",
|
|
2342
|
+
"left",
|
|
2343
|
+
"right",
|
|
2344
|
+
"bottom",
|
|
2345
|
+
"top",
|
|
2346
|
+
"transform",
|
|
2347
|
+
"transformOrigin",
|
|
2348
|
+
"rowGap",
|
|
2349
|
+
"columnGap",
|
|
2350
|
+
"gap"
|
|
2351
|
+
]);
|
|
2352
|
+
/**
|
|
2353
|
+
* Splits a flat style in two, as React Native's `splitLayoutProps` does: `outer` places the box,
|
|
2354
|
+
* `inner` is the rest. A wrapper takes `outer` and the wrapped box takes `inner`.
|
|
2355
|
+
*/
|
|
2356
|
+
const splitLayoutProps = (style) => {
|
|
2357
|
+
const outer = {};
|
|
2358
|
+
const inner = {};
|
|
2359
|
+
if (style == null) return {
|
|
2360
|
+
outer,
|
|
2361
|
+
inner
|
|
2362
|
+
};
|
|
2363
|
+
for (const [prop, value] of Object.entries(style)) if (OUTER.has(prop)) outer[prop] = value;
|
|
2364
|
+
else inner[prop] = value;
|
|
2365
|
+
return {
|
|
2366
|
+
outer,
|
|
2367
|
+
inner
|
|
2368
|
+
};
|
|
2369
|
+
};
|
|
1807
2370
|
// src/components/ScrollView/snap.ts
|
|
1808
2371
|
const nearest = (offset, candidates) => {
|
|
1809
2372
|
let best;
|
|
@@ -1840,33 +2403,37 @@ const snapTarget = (offset, viewport, contentSize, config) => {
|
|
|
1840
2403
|
return Math.abs(target - offset) < .5 ? void 0 : target;
|
|
1841
2404
|
};
|
|
1842
2405
|
// src/components/ScrollView/index.tsx
|
|
1843
|
-
const scrollerStyle =
|
|
2406
|
+
const scrollerStyle = webStyle({
|
|
1844
2407
|
flexGrow: 1,
|
|
1845
2408
|
flexShrink: 1,
|
|
1846
2409
|
overflowX: "hidden",
|
|
1847
2410
|
overflowY: "auto",
|
|
1848
2411
|
WebkitOverflowScrolling: "touch"
|
|
1849
2412
|
});
|
|
1850
|
-
const horizontalScrollerStyle =
|
|
2413
|
+
const horizontalScrollerStyle = webStyle({
|
|
1851
2414
|
flexDirection: "row",
|
|
1852
2415
|
overflowX: "auto",
|
|
1853
2416
|
overflowY: "hidden"
|
|
1854
2417
|
});
|
|
1855
|
-
const disabledScrollerStyle =
|
|
2418
|
+
const disabledScrollerStyle = webStyle({
|
|
1856
2419
|
overflowX: "hidden",
|
|
1857
2420
|
overflowY: "hidden"
|
|
1858
2421
|
});
|
|
2422
|
+
const refreshAreaStyle = Object.freeze({
|
|
2423
|
+
flexGrow: 1,
|
|
2424
|
+
flexShrink: 1
|
|
2425
|
+
});
|
|
1859
2426
|
const horizontalContentStyle = Object.freeze({ flexDirection: "row" });
|
|
1860
2427
|
const centerContentStyle = Object.freeze({
|
|
1861
2428
|
flexGrow: 1,
|
|
1862
2429
|
justifyContent: "center"
|
|
1863
2430
|
});
|
|
1864
|
-
const stickyStyle =
|
|
2431
|
+
const stickyStyle = webStyle({
|
|
1865
2432
|
position: "sticky",
|
|
1866
2433
|
top: 0,
|
|
1867
2434
|
zIndex: 10
|
|
1868
2435
|
});
|
|
1869
|
-
const invertedStickyStyle =
|
|
2436
|
+
const invertedStickyStyle = webStyle({
|
|
1870
2437
|
position: "sticky",
|
|
1871
2438
|
bottom: 0,
|
|
1872
2439
|
zIndex: 10
|
|
@@ -2082,6 +2649,7 @@ function ScrollView(props) {
|
|
|
2082
2649
|
children: items
|
|
2083
2650
|
});
|
|
2084
2651
|
const hideScrollbar = horizontal ? !showsHorizontalScrollIndicator : !showsVerticalScrollIndicator;
|
|
2652
|
+
const split = refreshControl === void 0 ? void 0 : splitLayoutProps(StyleSheet.flatten(style));
|
|
2085
2653
|
const scrollerElement = useViewElement({
|
|
2086
2654
|
...rest,
|
|
2087
2655
|
ref: scroller,
|
|
@@ -2089,7 +2657,7 @@ function ScrollView(props) {
|
|
|
2089
2657
|
scrollerStyle,
|
|
2090
2658
|
horizontal && horizontalScrollerStyle,
|
|
2091
2659
|
!scrollEnabled && disabledScrollerStyle,
|
|
2092
|
-
style
|
|
2660
|
+
split === void 0 ? style : split.inner
|
|
2093
2661
|
],
|
|
2094
2662
|
onScroll: handleScroll,
|
|
2095
2663
|
onScrollEnd: handleScrollEnd,
|
|
@@ -2137,7 +2705,7 @@ function ScrollView(props) {
|
|
|
2137
2705
|
getNativeScrollRef: () => element
|
|
2138
2706
|
});
|
|
2139
2707
|
}, [horizontal]);
|
|
2140
|
-
return refreshControl === void 0 ? scrollerElement : cloneElement(refreshControl,
|
|
2708
|
+
return refreshControl === void 0 || split === void 0 ? scrollerElement : cloneElement(refreshControl, { style: [refreshAreaStyle, split.outer] }, scrollerElement);
|
|
2141
2709
|
}
|
|
2142
2710
|
// src/components/FlatList/viewability.ts
|
|
2143
2711
|
const pixelsVisible = (top, bottom, viewport) => Math.max(0, Math.min(bottom, viewport) - Math.max(top, 0));
|
|
@@ -2321,7 +2889,7 @@ const createTrackers = (props) => {
|
|
|
2321
2889
|
return [];
|
|
2322
2890
|
};
|
|
2323
2891
|
function FlatList(props) {
|
|
2324
|
-
const { data, renderItem, ListItemComponent, keyExtractor = defaultKeyExtractor, getItemLayout: _getItemLayout, numColumns = 1, columnWrapperStyle, inverted, initialScrollIndex: _initialScrollIndex, ItemSeparatorComponent, ListEmptyComponent, ListHeaderComponent, ListHeaderComponentStyle, ListFooterComponent, ListFooterComponentStyle, CellRendererComponent, renderScrollComponent, horizontal = false, style, ref, onScroll: _onScroll, onContentSizeChange: _onContentSizeChange, onLayout: _onLayout, onEndReached: _onEndReached, onEndReachedThreshold: _onEndReachedThreshold, onStartReached: _onStartReached, onStartReachedThreshold: _onStartReachedThreshold, onViewableItemsChanged: _onViewableItemsChanged, viewabilityConfig: _viewabilityConfig, viewabilityConfigCallbackPairs: _viewabilityConfigCallbackPairs, onScrollToIndexFailed: _onScrollToIndexFailed,
|
|
2892
|
+
const { data, renderItem, ListItemComponent, keyExtractor = defaultKeyExtractor, getItemLayout: _getItemLayout, numColumns = 1, columnWrapperStyle, inverted, initialScrollIndex: _initialScrollIndex, ItemSeparatorComponent, ListEmptyComponent, ListHeaderComponent, ListHeaderComponentStyle, ListFooterComponent, ListFooterComponentStyle, CellRendererComponent, renderScrollComponent, horizontal = false, style, ref, onScroll: _onScroll, onContentSizeChange: _onContentSizeChange, onLayout: _onLayout, onEndReached: _onEndReached, onEndReachedThreshold: _onEndReachedThreshold, onStartReached: _onStartReached, onStartReachedThreshold: _onStartReachedThreshold, onViewableItemsChanged: _onViewableItemsChanged, viewabilityConfig: _viewabilityConfig, viewabilityConfigCallbackPairs: _viewabilityConfigCallbackPairs, onScrollToIndexFailed: _onScrollToIndexFailed, onRefresh, refreshing, progressViewOffset, extraData: _extraData, debug: _debug, disableVirtualization: _disableVirtualization, initialNumToRender: _initialNumToRender, maxToRenderPerBatch: _maxToRenderPerBatch, strictMode: _strictMode, updateCellsBatchingPeriod: _updateCellsBatchingPeriod, windowSize: _windowSize, legacyImplementation: _legacyImplementation, ...scrollViewProps } = props;
|
|
2325
2893
|
if (numColumns > 1 && horizontal) throw new Error("numColumns does not support horizontal.");
|
|
2326
2894
|
const latest = useRef(props);
|
|
2327
2895
|
useEffect(() => {
|
|
@@ -2625,21 +3193,27 @@ function FlatList(props) {
|
|
|
2625
3193
|
};
|
|
2626
3194
|
if (renderScrollComponent !== void 0) return /* @__PURE__ */ jsx(CustomScroller, {
|
|
2627
3195
|
...scrollProps,
|
|
3196
|
+
onRefresh,
|
|
3197
|
+
refreshing,
|
|
3198
|
+
progressViewOffset,
|
|
2628
3199
|
ref: scroller,
|
|
2629
3200
|
render: renderScrollComponent
|
|
2630
3201
|
});
|
|
3202
|
+
let refreshControl = scrollProps.refreshControl;
|
|
3203
|
+
if (onRefresh != null) {
|
|
3204
|
+
if (typeof refreshing !== "boolean") throw new Error("`refreshing` prop must be set as a boolean in order to use `onRefresh`, but got `" + JSON.stringify(refreshing ?? "undefined") + "`");
|
|
3205
|
+
refreshControl ??= /* @__PURE__ */ jsx(RefreshControl, {
|
|
3206
|
+
refreshing,
|
|
3207
|
+
onRefresh,
|
|
3208
|
+
progressViewOffset
|
|
3209
|
+
});
|
|
3210
|
+
}
|
|
2631
3211
|
return /* @__PURE__ */ jsx(ScrollView, {
|
|
2632
3212
|
...scrollProps,
|
|
3213
|
+
refreshControl,
|
|
2633
3214
|
ref: scroller
|
|
2634
3215
|
});
|
|
2635
3216
|
}
|
|
2636
|
-
// src/utils/warn.ts
|
|
2637
|
-
const warned = /* @__PURE__ */ new Set();
|
|
2638
|
-
const warnOnce = (key, message) => {
|
|
2639
|
-
if (isProductionEnv() || warned.has(key)) return;
|
|
2640
|
-
warned.add(key);
|
|
2641
|
-
console.warn(`[@rootnative/web] ${message}`);
|
|
2642
|
-
};
|
|
2643
3217
|
// src/components/Image/source.ts
|
|
2644
3218
|
const none = Object.freeze({
|
|
2645
3219
|
src: void 0,
|
|
@@ -2844,7 +3418,7 @@ function ImageComponent(props) {
|
|
|
2844
3418
|
const { alt, blurRadius, crossOrigin, decoding, defaultSource, fetchPriority, height, loading, onError, onLayout, onLoad, onLoadEnd, onLoadStart, ref, referrerPolicy, resizeMode: resizeModeProp, source, src, srcSet, style, tintColor: tintColorProp, width, fadeDuration: _fadeDuration, loadingIndicatorSource: _loadingIndicatorSource, onProgress: _onProgress, progressiveRenderingEnabled: _progressiveRenderingEnabled, resizeMethod: _resizeMethod, ...rest } = props;
|
|
2845
3419
|
const element = useRef(null);
|
|
2846
3420
|
const img = useRef(null);
|
|
2847
|
-
useImperativeHandle(ref, () => element.current, []);
|
|
3421
|
+
useImperativeHandle(ref, () => withHostMethods(element.current), []);
|
|
2848
3422
|
useElementLayout(element, onLayout);
|
|
2849
3423
|
const registry = useStyleRegistry();
|
|
2850
3424
|
const { resizeMode: styleResizeMode, objectFit, tintColor: styleTintColor, overlayColor: _overlayColor, ...userBoxStyle } = flattenStyle(style) ?? {};
|
|
@@ -2917,11 +3491,7 @@ function ImageComponent(props) {
|
|
|
2917
3491
|
width: userBoxStyle["width"] ?? width ?? resolved.width,
|
|
2918
3492
|
height: userBoxStyle["height"] ?? height ?? resolved.height
|
|
2919
3493
|
};
|
|
2920
|
-
const boxClassName = compileStyle([
|
|
2921
|
-
boxStyle,
|
|
2922
|
-
sizeStyle,
|
|
2923
|
-
userBoxStyle
|
|
2924
|
-
], registry);
|
|
3494
|
+
const boxClassName = joinClassNames(compileReset("rn-image", boxStyle, registry), compileStyle([sizeStyle, userBoxStyle], registry));
|
|
2925
3495
|
const label = alt ?? rest.accessibilityLabel ?? rest["aria-label"];
|
|
2926
3496
|
const domProps = toDOMProps(rest);
|
|
2927
3497
|
domProps["className"] = boxClassName;
|
|
@@ -3025,6 +3595,375 @@ const Image = Object.assign(ImageComponent, {
|
|
|
3025
3595
|
queryCache: () => Promise.resolve({}),
|
|
3026
3596
|
resolveAssetSource
|
|
3027
3597
|
});
|
|
3598
|
+
// src/components/KeyboardAvoidingView/index.tsx
|
|
3599
|
+
/**
|
|
3600
|
+
* A view that moves out of the way of the keyboard, with the math of React Native 0.88. As on
|
|
3601
|
+
* native, the frame of the view comes from `onLayout`, so its `y` is relative to its parent.
|
|
3602
|
+
* `keyboardVerticalOffset` adds the distance to the top of the window.
|
|
3603
|
+
*/
|
|
3604
|
+
function KeyboardAvoidingView(props) {
|
|
3605
|
+
const { behavior, children, contentContainerStyle, enabled = true, keyboardVerticalOffset = 0, style, onLayout, ...rest } = props;
|
|
3606
|
+
const [bottom, setBottom] = useState(0);
|
|
3607
|
+
const [initialFrameHeight, setInitialFrameHeight] = useState(0);
|
|
3608
|
+
const frame = useRef(null);
|
|
3609
|
+
const keyboard = useRef(null);
|
|
3610
|
+
const latestBottom = useRef(0);
|
|
3611
|
+
const shownBottom = useRef(0);
|
|
3612
|
+
const initialHeight = useRef(0);
|
|
3613
|
+
const latest = useRef({
|
|
3614
|
+
behavior,
|
|
3615
|
+
enabled,
|
|
3616
|
+
keyboardVerticalOffset,
|
|
3617
|
+
onLayout
|
|
3618
|
+
});
|
|
3619
|
+
useEffect(() => {
|
|
3620
|
+
latest.current = {
|
|
3621
|
+
behavior,
|
|
3622
|
+
enabled,
|
|
3623
|
+
keyboardVerticalOffset,
|
|
3624
|
+
onLayout
|
|
3625
|
+
};
|
|
3626
|
+
});
|
|
3627
|
+
const [handlers] = useState(() => {
|
|
3628
|
+
const relativeKeyboardHeight = (keyboardFrame) => {
|
|
3629
|
+
const layout = frame.current;
|
|
3630
|
+
if (layout === null) return 0;
|
|
3631
|
+
const keyboardY = keyboardFrame.screenY - latest.current.keyboardVerticalOffset;
|
|
3632
|
+
if (latest.current.behavior === "height") return Math.max(shownBottom.current + layout.y + layout.height - keyboardY, 0);
|
|
3633
|
+
return Math.max(layout.y + layout.height - keyboardY, 0);
|
|
3634
|
+
};
|
|
3635
|
+
const update = () => {
|
|
3636
|
+
const event = keyboard.current;
|
|
3637
|
+
const next = event === null ? 0 : relativeKeyboardHeight(event.endCoordinates);
|
|
3638
|
+
if (event !== null && latestBottom.current === next) return;
|
|
3639
|
+
latestBottom.current = next;
|
|
3640
|
+
if (latest.current.enabled) {
|
|
3641
|
+
shownBottom.current = next;
|
|
3642
|
+
setBottom(next);
|
|
3643
|
+
}
|
|
3644
|
+
};
|
|
3645
|
+
const handleLayout = (event) => {
|
|
3646
|
+
const old = frame.current;
|
|
3647
|
+
frame.current = event.nativeEvent.layout;
|
|
3648
|
+
if (initialHeight.current === 0) {
|
|
3649
|
+
initialHeight.current = frame.current.height;
|
|
3650
|
+
setInitialFrameHeight(frame.current.height);
|
|
3651
|
+
}
|
|
3652
|
+
if (old === null || old.height !== frame.current.height) update();
|
|
3653
|
+
latest.current.onLayout?.(event);
|
|
3654
|
+
};
|
|
3655
|
+
return {
|
|
3656
|
+
update,
|
|
3657
|
+
handleLayout
|
|
3658
|
+
};
|
|
3659
|
+
});
|
|
3660
|
+
useEffect(() => {
|
|
3661
|
+
const { update } = handlers;
|
|
3662
|
+
if (!Keyboard.isVisible()) {
|
|
3663
|
+
keyboard.current = null;
|
|
3664
|
+
update();
|
|
3665
|
+
}
|
|
3666
|
+
const subscriptions = [Keyboard.addListener("keyboardDidHide", () => {
|
|
3667
|
+
keyboard.current = null;
|
|
3668
|
+
update();
|
|
3669
|
+
}), Keyboard.addListener("keyboardDidShow", (event) => {
|
|
3670
|
+
keyboard.current = event;
|
|
3671
|
+
update();
|
|
3672
|
+
})];
|
|
3673
|
+
return () => {
|
|
3674
|
+
for (const subscription of subscriptions) subscription.remove();
|
|
3675
|
+
};
|
|
3676
|
+
}, [handlers]);
|
|
3677
|
+
useEffect(() => {
|
|
3678
|
+
if (enabled && shownBottom.current !== latestBottom.current) {
|
|
3679
|
+
shownBottom.current = latestBottom.current;
|
|
3680
|
+
setBottom(latestBottom.current);
|
|
3681
|
+
}
|
|
3682
|
+
}, [enabled]);
|
|
3683
|
+
const bottomHeight = enabled ? bottom : 0;
|
|
3684
|
+
const outerStyle = useMemo(() => {
|
|
3685
|
+
if (behavior === "padding") return [style, { paddingBottom: bottomHeight }];
|
|
3686
|
+
if (behavior === "height" && bottom > 0) return [style, {
|
|
3687
|
+
height: initialFrameHeight - bottomHeight,
|
|
3688
|
+
flex: 0
|
|
3689
|
+
}];
|
|
3690
|
+
return style;
|
|
3691
|
+
}, [
|
|
3692
|
+
behavior,
|
|
3693
|
+
bottom,
|
|
3694
|
+
bottomHeight,
|
|
3695
|
+
initialFrameHeight,
|
|
3696
|
+
style
|
|
3697
|
+
]);
|
|
3698
|
+
const innerStyle = useMemo(() => [contentContainerStyle, { bottom: bottomHeight }], [contentContainerStyle, bottomHeight]);
|
|
3699
|
+
return /* @__PURE__ */ jsx(View, {
|
|
3700
|
+
...rest,
|
|
3701
|
+
style: outerStyle,
|
|
3702
|
+
onLayout: handlers.handleLayout,
|
|
3703
|
+
children: behavior === "position" ? /* @__PURE__ */ jsx(View, {
|
|
3704
|
+
style: innerStyle,
|
|
3705
|
+
children
|
|
3706
|
+
}) : children
|
|
3707
|
+
});
|
|
3708
|
+
}
|
|
3709
|
+
// src/components/Modal/index.tsx
|
|
3710
|
+
const MODAL_CLASS = "rn-modal";
|
|
3711
|
+
const RULES$1 = [
|
|
3712
|
+
`.${MODAL_CLASS}{position:fixed;inset:0;z-index:2147483647;box-sizing:border-box;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;border:0;background:transparent;color:inherit;overflow:hidden}`,
|
|
3713
|
+
`.${MODAL_CLASS}[open]{display:flex;flex-direction:column}`,
|
|
3714
|
+
`.${MODAL_CLASS}:not([open]){display:none}`,
|
|
3715
|
+
`.${MODAL_CLASS}:focus{outline:none}`,
|
|
3716
|
+
`.${MODAL_CLASS}[data-closing]{pointer-events:none}`,
|
|
3717
|
+
`@supports selector(::backdrop){.${MODAL_CLASS}::backdrop{background:transparent}}`
|
|
3718
|
+
];
|
|
3719
|
+
const DURATION_MS = 200;
|
|
3720
|
+
const motions = {
|
|
3721
|
+
slide: {
|
|
3722
|
+
property: "transform",
|
|
3723
|
+
hidden: "translateY(100%)",
|
|
3724
|
+
shown: "translateY(0)",
|
|
3725
|
+
easing: "cubic-bezier(0.37, 0, 0.63, 1)"
|
|
3726
|
+
},
|
|
3727
|
+
fade: {
|
|
3728
|
+
property: "opacity",
|
|
3729
|
+
hidden: "0",
|
|
3730
|
+
shown: "1",
|
|
3731
|
+
easing: "cubic-bezier(0.333, 0, 0.667, 0.333)"
|
|
3732
|
+
}
|
|
3733
|
+
};
|
|
3734
|
+
const motionOf = (type) => type === "slide" || type === "fade" ? Platform.isDisableAnimations ? null : motions[type] : null;
|
|
3735
|
+
const animate = (element, motion, to, running) => {
|
|
3736
|
+
const from = running === null ? motion[to === "shown" ? "hidden" : "shown"] : getComputedStyle(element)[motion.property];
|
|
3737
|
+
running?.cancel();
|
|
3738
|
+
return element.animate([{ [motion.property]: from }, { [motion.property]: motion[to] }], {
|
|
3739
|
+
duration: DURATION_MS,
|
|
3740
|
+
easing: motion.easing,
|
|
3741
|
+
fill: to === "hidden" ? "forwards" : "none"
|
|
3742
|
+
});
|
|
3743
|
+
};
|
|
3744
|
+
const HostContext = createContext(null);
|
|
3745
|
+
const createHost = () => {
|
|
3746
|
+
const children = /* @__PURE__ */ new Set();
|
|
3747
|
+
let shown = false;
|
|
3748
|
+
return {
|
|
3749
|
+
add: (child) => {
|
|
3750
|
+
children.add(child);
|
|
3751
|
+
if (shown) child.show();
|
|
3752
|
+
return () => {
|
|
3753
|
+
children.delete(child);
|
|
3754
|
+
};
|
|
3755
|
+
},
|
|
3756
|
+
showChildren: () => {
|
|
3757
|
+
shown = true;
|
|
3758
|
+
for (const child of children) child.show();
|
|
3759
|
+
},
|
|
3760
|
+
hideChildren: () => {
|
|
3761
|
+
shown = false;
|
|
3762
|
+
const list = Array.from(children);
|
|
3763
|
+
for (let index = list.length - 1; index >= 0; index--) list[index]?.hide();
|
|
3764
|
+
}
|
|
3765
|
+
};
|
|
3766
|
+
};
|
|
3767
|
+
const subscribeNothing = () => () => {};
|
|
3768
|
+
const useIsClient = () => useSyncExternalStore(subscribeNothing, () => true, () => false);
|
|
3769
|
+
/**
|
|
3770
|
+
* React Native's `Modal` on a `<dialog>` in the top layer. `showModal()` makes the rest of the
|
|
3771
|
+
* page inert, keeps the focus inside, and turns Escape into `onRequestClose`.
|
|
3772
|
+
*/
|
|
3773
|
+
function Modal(props) {
|
|
3774
|
+
const { visible = true, onDismiss, animationType } = props;
|
|
3775
|
+
const shown = useIsClient() && visible;
|
|
3776
|
+
const [exiting, setExiting] = useState(false);
|
|
3777
|
+
const [lastShown, setLastShown] = useState(shown);
|
|
3778
|
+
if (lastShown !== shown) {
|
|
3779
|
+
setLastShown(shown);
|
|
3780
|
+
setExiting(!shown && animationType != null && animationType !== "none");
|
|
3781
|
+
}
|
|
3782
|
+
const mounted = shown || exiting;
|
|
3783
|
+
const onExited = useCallback(() => setExiting(false), []);
|
|
3784
|
+
const dismiss = useRef(onDismiss);
|
|
3785
|
+
const wasMounted = useRef(false);
|
|
3786
|
+
useEffect(() => {
|
|
3787
|
+
dismiss.current = onDismiss;
|
|
3788
|
+
});
|
|
3789
|
+
useEffect(() => {
|
|
3790
|
+
if (wasMounted.current && !mounted) dismiss.current?.();
|
|
3791
|
+
wasMounted.current = mounted;
|
|
3792
|
+
}, [mounted]);
|
|
3793
|
+
return mounted ? createPortal(/* @__PURE__ */ jsx(ModalDialog, {
|
|
3794
|
+
...props,
|
|
3795
|
+
closing: !shown,
|
|
3796
|
+
onExited
|
|
3797
|
+
}), document.body) : null;
|
|
3798
|
+
}
|
|
3799
|
+
function ModalDialog(props) {
|
|
3800
|
+
const { children, style, transparent, backdropColor, onRequestClose, onShow, ref, modalRef, animationType, closing, onExited, visible: _visible, onDismiss: _onDismiss, allowSwipeDismissal: _allowSwipeDismissal, hardwareAccelerated: _hardwareAccelerated, navigationBarTranslucent: _navigationBarTranslucent, onOrientationChange: _onOrientationChange, presentationStyle: _presentationStyle, statusBarTranslucent: _statusBarTranslucent, supportedOrientations: _supportedOrientations, ...rest } = props;
|
|
3801
|
+
const className = useStyleRegistry().staticClass(MODAL_CLASS, RULES$1);
|
|
3802
|
+
const dialog = useRef(null);
|
|
3803
|
+
const open = useRef(false);
|
|
3804
|
+
const announced = useRef(false);
|
|
3805
|
+
const parent = useContext(HostContext);
|
|
3806
|
+
const [host] = useState(createHost);
|
|
3807
|
+
const animation = useRef(null);
|
|
3808
|
+
const latest = useRef({
|
|
3809
|
+
onRequestClose,
|
|
3810
|
+
onShow,
|
|
3811
|
+
onExited,
|
|
3812
|
+
animationType
|
|
3813
|
+
});
|
|
3814
|
+
useLayoutEffect(() => {
|
|
3815
|
+
latest.current = {
|
|
3816
|
+
onRequestClose,
|
|
3817
|
+
onShow,
|
|
3818
|
+
onExited,
|
|
3819
|
+
animationType
|
|
3820
|
+
};
|
|
3821
|
+
});
|
|
3822
|
+
useImperativeHandle(ref, () => dialog.current, []);
|
|
3823
|
+
useImperativeHandle(modalRef, () => dialog.current, []);
|
|
3824
|
+
useLayoutEffect(() => {
|
|
3825
|
+
const element = dialog.current;
|
|
3826
|
+
if (element === null) return;
|
|
3827
|
+
const modal = typeof element.showModal === "function";
|
|
3828
|
+
let focused = null;
|
|
3829
|
+
const layer = {
|
|
3830
|
+
show: () => {
|
|
3831
|
+
if (open.current) return;
|
|
3832
|
+
open.current = true;
|
|
3833
|
+
if (modal) element.showModal();
|
|
3834
|
+
else {
|
|
3835
|
+
focused = document.activeElement;
|
|
3836
|
+
element.setAttribute("open", "");
|
|
3837
|
+
element.tabIndex = -1;
|
|
3838
|
+
element.focus();
|
|
3839
|
+
}
|
|
3840
|
+
lockScroll();
|
|
3841
|
+
host.showChildren();
|
|
3842
|
+
const announce = () => {
|
|
3843
|
+
if (announced.current) return;
|
|
3844
|
+
announced.current = true;
|
|
3845
|
+
latest.current.onShow?.({ nativeEvent: null });
|
|
3846
|
+
};
|
|
3847
|
+
const motion = motionOf(latest.current.animationType);
|
|
3848
|
+
if (motion === null || typeof element.animate !== "function") {
|
|
3849
|
+
announce();
|
|
3850
|
+
return;
|
|
3851
|
+
}
|
|
3852
|
+
const next = animate(element, motion, "shown", null);
|
|
3853
|
+
animation.current = next;
|
|
3854
|
+
next.onfinish = () => {
|
|
3855
|
+
if (animation.current !== next) return;
|
|
3856
|
+
animation.current = null;
|
|
3857
|
+
announce();
|
|
3858
|
+
};
|
|
3859
|
+
},
|
|
3860
|
+
hide: () => {
|
|
3861
|
+
if (!open.current) return;
|
|
3862
|
+
open.current = false;
|
|
3863
|
+
animation.current?.cancel();
|
|
3864
|
+
animation.current = null;
|
|
3865
|
+
host.hideChildren();
|
|
3866
|
+
if (modal) element.close();
|
|
3867
|
+
else {
|
|
3868
|
+
element.removeAttribute("open");
|
|
3869
|
+
if (focused instanceof HTMLElement && focused.isConnected) focused.focus();
|
|
3870
|
+
}
|
|
3871
|
+
unlockScroll();
|
|
3872
|
+
}
|
|
3873
|
+
};
|
|
3874
|
+
let remove;
|
|
3875
|
+
if (parent === null) layer.show();
|
|
3876
|
+
else remove = parent.add(layer);
|
|
3877
|
+
return () => {
|
|
3878
|
+
remove?.();
|
|
3879
|
+
layer.hide();
|
|
3880
|
+
};
|
|
3881
|
+
}, [host, parent]);
|
|
3882
|
+
const wasClosing = useRef(false);
|
|
3883
|
+
useLayoutEffect(() => {
|
|
3884
|
+
const element = dialog.current;
|
|
3885
|
+
if (element === null || closing === wasClosing.current) return;
|
|
3886
|
+
wasClosing.current = closing;
|
|
3887
|
+
const motion = motionOf(latest.current.animationType);
|
|
3888
|
+
const canAnimate = motion !== null && typeof element.animate === "function";
|
|
3889
|
+
if (closing) {
|
|
3890
|
+
host.hideChildren();
|
|
3891
|
+
if (!canAnimate) {
|
|
3892
|
+
latest.current.onExited();
|
|
3893
|
+
return;
|
|
3894
|
+
}
|
|
3895
|
+
const next = animate(element, motion, "hidden", animation.current);
|
|
3896
|
+
animation.current = next;
|
|
3897
|
+
next.onfinish = () => {
|
|
3898
|
+
if (animation.current === next) latest.current.onExited();
|
|
3899
|
+
};
|
|
3900
|
+
return;
|
|
3901
|
+
}
|
|
3902
|
+
host.showChildren();
|
|
3903
|
+
if (!canAnimate || animation.current === null) return;
|
|
3904
|
+
const next = animate(element, motion, "shown", animation.current);
|
|
3905
|
+
animation.current = next;
|
|
3906
|
+
next.onfinish = () => {
|
|
3907
|
+
if (animation.current === next) animation.current = null;
|
|
3908
|
+
};
|
|
3909
|
+
}, [closing, host]);
|
|
3910
|
+
const requestClose = () => {
|
|
3911
|
+
latest.current.onRequestClose?.({ nativeEvent: null });
|
|
3912
|
+
};
|
|
3913
|
+
const handleCancel = (event) => {
|
|
3914
|
+
if (event.target !== event.currentTarget) return;
|
|
3915
|
+
event.preventDefault();
|
|
3916
|
+
if (!closing) requestClose();
|
|
3917
|
+
};
|
|
3918
|
+
const handleClose = (event) => {
|
|
3919
|
+
const element = event.currentTarget;
|
|
3920
|
+
if (event.target === element && open.current && !element.open) element.showModal();
|
|
3921
|
+
};
|
|
3922
|
+
const domProps = toDOMProps(rest);
|
|
3923
|
+
const appPointerDown = domProps["onPointerDown"];
|
|
3924
|
+
const appClick = domProps["onClick"];
|
|
3925
|
+
const appKeyDown = domProps["onKeyDown"];
|
|
3926
|
+
const containerStyle = transparent ? styles$1.transparent : backdropColor != null ? { backgroundColor: backdropColor } : void 0;
|
|
3927
|
+
return /* @__PURE__ */ jsx("dialog", {
|
|
3928
|
+
...domProps,
|
|
3929
|
+
ref: dialog,
|
|
3930
|
+
className,
|
|
3931
|
+
"data-closing": closing ? "" : void 0,
|
|
3932
|
+
onCancel: handleCancel,
|
|
3933
|
+
onClose: handleClose,
|
|
3934
|
+
onPointerDown: (event) => {
|
|
3935
|
+
appPointerDown?.(event);
|
|
3936
|
+
claimPress(event.nativeEvent);
|
|
3937
|
+
},
|
|
3938
|
+
onClick: (event) => {
|
|
3939
|
+
appClick?.(event);
|
|
3940
|
+
claimPress(event.nativeEvent);
|
|
3941
|
+
},
|
|
3942
|
+
onKeyDown: (event) => {
|
|
3943
|
+
appKeyDown?.(event);
|
|
3944
|
+
const element = event.currentTarget;
|
|
3945
|
+
if (event.key === "Escape" && typeof element.showModal !== "function" && event.target.closest("dialog") === element) requestClose();
|
|
3946
|
+
},
|
|
3947
|
+
children: /* @__PURE__ */ jsx(HostContext.Provider, {
|
|
3948
|
+
value: host,
|
|
3949
|
+
children: /* @__PURE__ */ jsx(View, {
|
|
3950
|
+
style: [
|
|
3951
|
+
styles$1.container,
|
|
3952
|
+
style,
|
|
3953
|
+
containerStyle
|
|
3954
|
+
],
|
|
3955
|
+
children
|
|
3956
|
+
})
|
|
3957
|
+
})
|
|
3958
|
+
});
|
|
3959
|
+
}
|
|
3960
|
+
const styles$1 = StyleSheet.create({
|
|
3961
|
+
container: {
|
|
3962
|
+
flex: 1,
|
|
3963
|
+
backgroundColor: "white"
|
|
3964
|
+
},
|
|
3965
|
+
transparent: { backgroundColor: "transparent" }
|
|
3966
|
+
});
|
|
3028
3967
|
// src/components/Pressable/index.tsx
|
|
3029
3968
|
const notCancelableStyle$1 = Object.freeze({ touchAction: "none" });
|
|
3030
3969
|
const isFocusVisible = (element) => {
|
|
@@ -3609,7 +4548,7 @@ function TextInputComponent(props) {
|
|
|
3609
4548
|
}, [wantsContentSize, reportContentSize]);
|
|
3610
4549
|
useImperativeHandle(ref, () => {
|
|
3611
4550
|
const element = field.current;
|
|
3612
|
-
return Object.assign(element, {
|
|
4551
|
+
return Object.assign(withHostMethods(element), {
|
|
3613
4552
|
clear: () => {
|
|
3614
4553
|
element.value = "";
|
|
3615
4554
|
grow(element);
|
|
@@ -3617,11 +4556,10 @@ function TextInputComponent(props) {
|
|
|
3617
4556
|
},
|
|
3618
4557
|
isFocused: () => document.activeElement === element,
|
|
3619
4558
|
getNativeRef: () => element,
|
|
3620
|
-
setNativeProps: (
|
|
3621
|
-
if (
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
}
|
|
4559
|
+
setNativeProps: ({ text, ...others }) => {
|
|
4560
|
+
if (text !== void 0) element.value = text;
|
|
4561
|
+
applyNativeProps(element, others);
|
|
4562
|
+
grow(element);
|
|
3625
4563
|
}
|
|
3626
4564
|
});
|
|
3627
4565
|
}, [grow]);
|
|
@@ -3631,12 +4569,7 @@ function TextInputComponent(props) {
|
|
|
3631
4569
|
if (caretHidden === true) colorStyle["caretColor"] = "transparent";
|
|
3632
4570
|
else if (caret !== void 0) colorStyle["caretColor"] = caret;
|
|
3633
4571
|
if (textAlign !== void 0) colorStyle["textAlign"] = textAlign;
|
|
3634
|
-
let className = compileStyle([
|
|
3635
|
-
resetStyle,
|
|
3636
|
-
multiline && textareaStyle,
|
|
3637
|
-
flat,
|
|
3638
|
-
colorStyle
|
|
3639
|
-
], registry);
|
|
4572
|
+
let className = joinClassNames(compileReset("rn-text-input", resetStyle, registry), multiline === true && compileReset("rn-text-input-multiline", textareaStyle, registry), compileStyle([flat, colorStyle], registry));
|
|
3640
4573
|
const placeholderName = placeholderClass(registry, placeholderTextColor);
|
|
3641
4574
|
if (placeholderName !== void 0) className = `${className} ${placeholderName}`;
|
|
3642
4575
|
const selectionName = selectionClass(registry, selectionColor);
|
|
@@ -3867,6 +4800,66 @@ const TouchableNativeFeedback = Object.assign(function TouchableNativeFeedback(p
|
|
|
3867
4800
|
}),
|
|
3868
4801
|
canUseNativeForeground: () => false
|
|
3869
4802
|
});
|
|
3870
|
-
|
|
4803
|
+
// src/compat/createElement/index.tsx
|
|
4804
|
+
const mappedProps = /* @__PURE__ */ new Set([
|
|
4805
|
+
"focusable",
|
|
4806
|
+
"importantForAccessibility",
|
|
4807
|
+
"nativeID",
|
|
4808
|
+
"testID"
|
|
4809
|
+
]);
|
|
4810
|
+
const isNativeOnly = (name) => mappedProps.has(name) || name.startsWith("accessibility") || isNativeHandler(name);
|
|
4811
|
+
function Host({ type, props }) {
|
|
4812
|
+
const registry = useStyleRegistry();
|
|
4813
|
+
const { className, style, ...rest } = props;
|
|
4814
|
+
const domProps = {};
|
|
4815
|
+
for (const name in rest) if (!isNativeOnly(name)) domProps[name] = rest[name];
|
|
4816
|
+
Object.assign(domProps, toDOMProps(rest));
|
|
4817
|
+
const compiled = compileStyle(style, registry);
|
|
4818
|
+
const classes = typeof className === "string" && className !== "" ? [className] : [];
|
|
4819
|
+
if (compiled !== "") classes.push(compiled);
|
|
4820
|
+
if (classes.length > 0) domProps["className"] = classes.join(" ");
|
|
4821
|
+
return createElement(type, domProps);
|
|
4822
|
+
}
|
|
4823
|
+
/**
|
|
4824
|
+
* Compat export. Renders `type` with React Native props: `style` compiles to class names, and
|
|
4825
|
+
* the accessibility props become ARIA attributes. Every other prop goes to the element as it
|
|
4826
|
+
* is. Libraries such as `react-native-svg` import it from `react-native` on the web.
|
|
4827
|
+
*/
|
|
4828
|
+
const unstable_createElement = (type, props) => {
|
|
4829
|
+
const hostProps = props ?? {};
|
|
4830
|
+
return createElement(Host, {
|
|
4831
|
+
key: hostProps["key"],
|
|
4832
|
+
type,
|
|
4833
|
+
props: hostProps
|
|
4834
|
+
});
|
|
4835
|
+
};
|
|
4836
|
+
// src/compat/findNodeHandle/index.ts
|
|
4837
|
+
const isElement = (value) => value.nodeType === 1;
|
|
4838
|
+
/**
|
|
4839
|
+
* Compat export. On native it returns the tag of a view. On the web it returns the DOM element
|
|
4840
|
+
* of a ref, of an element, or of a scroll component. A number comes back as it is. A class
|
|
4841
|
+
* component instance gives `null`, because React has no `findDOMNode`.
|
|
4842
|
+
*/
|
|
4843
|
+
const findNodeHandle = (componentOrHandle) => {
|
|
4844
|
+
if (typeof componentOrHandle === "number") return componentOrHandle;
|
|
4845
|
+
if (typeof componentOrHandle !== "object" || componentOrHandle === null) return null;
|
|
4846
|
+
if (isElement(componentOrHandle)) return componentOrHandle;
|
|
4847
|
+
const { getScrollableNode } = componentOrHandle;
|
|
4848
|
+
if (typeof getScrollableNode === "function") return findNodeHandle(getScrollableNode.call(componentOrHandle));
|
|
4849
|
+
if ("current" in componentOrHandle) return findNodeHandle(componentOrHandle.current);
|
|
4850
|
+
return null;
|
|
4851
|
+
};
|
|
4852
|
+
// src/compat/TurboModuleRegistry/index.ts
|
|
4853
|
+
/**
|
|
4854
|
+
* Compat export. A browser has no native modules, so `get` always returns `null`. A library
|
|
4855
|
+
* that reads its native module at import time then takes its JavaScript path.
|
|
4856
|
+
*/
|
|
4857
|
+
const TurboModuleRegistry = {
|
|
4858
|
+
get: () => null,
|
|
4859
|
+
getEnforcing: (name) => {
|
|
4860
|
+
throw new Error(`TurboModuleRegistry.getEnforcing(...): '${name}' could not be found. A browser has no native modules.`);
|
|
4861
|
+
}
|
|
4862
|
+
};
|
|
4863
|
+
export { AccessibilityInfo, ActivityIndicator, Alert, AppState, Appearance, BackHandler, Button, Clipboard, Dimensions, FlatList, I18nManager, Image, Keyboard, KeyboardAvoidingView, Linking, Modal, PanResponder, PixelRatio, Platform, Pressable, RefreshControl, ScrollView, Share, StatusBar, StyleSheet, Switch, Text, TextAncestorContext, TextInput, TouchableHighlight, TouchableNativeFeedback, TouchableOpacity, TouchableWithoutFeedback, TurboModuleRegistry, Vibration, View, findNodeHandle, processColor, unstable_createElement, useColorScheme, usePressability, useWindowDimensions };
|
|
3871
4864
|
|
|
3872
4865
|
//# sourceMappingURL=index.js.map
|