@vvedantb/native-ui 0.27.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/DropdownMenu.jsx +26 -12
- package/dist/ai/conversation-context.js +2 -0
- package/dist/ai/conversation.jsx +31 -7
- package/dist/ai/message-context-menu.jsx +111 -113
- package/dist/entries/primitives.js +2 -0
- package/dist/media/ImageGallery.jsx +12 -15
- package/dist/primitives/overlay.jsx +31 -17
- package/dist/primitives/window-layer.jsx +230 -0
- package/package.json +1 -1
- package/src/DropdownMenu.tsx +13 -12
- package/src/ai/conversation-context.ts +3 -0
- package/src/ai/conversation.tsx +21 -0
- package/src/ai/message-context-menu.tsx +11 -10
- package/src/entries/primitives.ts +3 -0
- package/src/media/ImageGallery.tsx +6 -5
- package/src/primitives/overlay.tsx +18 -18
- package/src/primitives/window-layer.tsx +159 -0
package/README.md
CHANGED
|
@@ -348,7 +348,7 @@ configureTheme({ font: { regular: "Inter_400Regular", medium: "Inter_500Medium",
|
|
|
348
348
|
| Actions and fields | `Button` (`default`/`primary`, `secondary`, `outline`, `destructive`, `ghost`, `link`, `tinted`; `sm`/`small`, `default`/`medium`, `lg`/`large`, `icon`; `shape` `pill`/`rounded` from 0.6.0), `IconButton` (0.5.0), `CaptureButton` (0.5.0), `Input`, `SearchInput` (0.3.9), `PasswordInput` (0.11.0), `Textarea`, `Label`, `Select`, `Switch`, `Checkbox`, `LabeledSwitchRow`, `ColorSwatches` (0.5.0), `DateTimeField` (date-only, empty and clearable from 0.5.0) |
|
|
349
349
|
| Display | `Card` (+ `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter`; `onPress` from 0.5.0), `Badge`, `StatusDot` (`info` from 0.5.0), `Avatar` (+ `AvatarImage`, `AvatarFallback`, `initials()`), `Separator`, `Progress`, `Spinner`, `CenteredSpinner`, `Skeleton`, `EmptyState` (+ `EmptyState.Root` and parts), `ListRow` (`leading`, `titleEnd`, `control`, `onLongPress` from 0.5.0), `StatGrid` (0.5.0), `SectionLabel` (0.5.0), `Chip`, `Text` (0.5.0, `/primitives` only) |
|
|
350
350
|
| Navigation | `Tabs` (+ `TabsList`, `TabsTrigger` (`minHeight` from 0.14.0), `TabsContent`), `PillTabs`, `PageIndicator` (0.5.0), `FloatingTabBar`, `FloatingFAB`, `HeaderIconButton`, `ThemeToggle` (0.3.16), `StackPageHeader` (0.5.0) |
|
|
351
|
-
| Overlays | `Dialog`, `AlertDialog`, `ConfirmDialog`, `Sheet` (RN `Modal
|
|
351
|
+
| Overlays | `Dialog`, `AlertDialog`, `ConfirmDialog`, `Sheet` (a `WindowLayer` from 0.29.0: in the app's window under `WindowLayerHost`, else an RN `Modal`; each with the web part names; a `SheetContent` or compact `DialogContent` drags down to close), `SheetRow` (0.5.0), `BottomSheetContainer` (`@swmansion/react-native-bottom-sheet`; optional `detents`), `DropdownMenu` (Unreleased; see below) |
|
|
352
352
|
| Selection | `BulkActionBar` (Unreleased; see below) |
|
|
353
353
|
| Feedback | `toast()` and `<Toaster />` |
|
|
354
354
|
| Brand and upgrade | `APP_ICONS`, `IconVibot` and the other `Icon*`, `AppMark`, `AppWordmark`, `GoogleMark` (0.3.15), `FAMILY_APPS`, `V_PRO_APP_BENEFITS`, `UpgradeToProCard`, `PricingModal` |
|
|
@@ -621,7 +621,7 @@ import {
|
|
|
621
621
|
|
|
622
622
|
## DropdownMenu (Unreleased)
|
|
623
623
|
|
|
624
|
-
A small menu anchored to its trigger, the native counterpart of the web `DropdownMenu`. On `/primitives` and the root. From 0.12.1 the backdrop and menu sit in a full-size `View` inside the
|
|
624
|
+
A small menu anchored to its trigger, the native counterpart of the web `DropdownMenu`. On `/primitives` and the root. From 0.12.1 the backdrop and menu sit in a full-size `View` inside the overlay, so the menu stays above tab bars and glass layers. From 0.29.0 the overlay is a `WindowLayer`: in the app's window under `WindowLayerHost`, so a chat under it keeps its place, else an RN `Modal`.
|
|
625
625
|
|
|
626
626
|
```tsx
|
|
627
627
|
<DropdownMenu>
|
|
@@ -643,7 +643,7 @@ A small menu anchored to its trigger, the native counterpart of the web `Dropdow
|
|
|
643
643
|
| --- | --- |
|
|
644
644
|
| `DropdownMenu` | `open`, `defaultOpen`, `onOpenChange`. Holds the open state; renders no view. |
|
|
645
645
|
| `DropdownMenuTrigger` | `Pressable` props and `asChild`. On press it measures itself (`measureInWindow`) and opens the menu; pressed again it closes it. Reports `expanded`. With `asChild` the child must pass `ref` on to its native view (`Button` and `IconButton` do). |
|
|
646
|
-
| `DropdownMenuContent` | `align` (`"start"`, default, or `"end"`), `sideOffset` (default 4), `View` props. A transparent RN `Modal
|
|
646
|
+
| `DropdownMenuContent` | `align` (`"start"`, default, or `"end"`), `sideOffset` (default 4), `View` props. A `WindowLayer` (a transparent RN `Modal` without `WindowLayerHost`); the menu sits under the trigger and flips above it when it does not fit below. |
|
|
647
647
|
| `DropdownMenuLabel` | `children`. |
|
|
648
648
|
| `DropdownMenuItem` | `children`, `onSelect`, `icon` (a Tabler icon), `destructive`, `disabled`, `closeOnSelect` (default `true`). |
|
|
649
649
|
| `DropdownMenuRadioItem` | The same without `icon` and `destructive`, plus `checked`. |
|
package/dist/DropdownMenu.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import * as Slot from "@rn-primitives/slot";
|
|
3
3
|
import { createContext, useContext, useEffect, useRef, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { Pressable, ScrollView, StyleSheet, Text, View, useWindowDimensions } from "react-native";
|
|
5
5
|
import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
6
6
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
7
7
|
import { IconCheck } from "@tabler/icons-react-native";
|
|
@@ -16,6 +16,7 @@ import { tokens } from "./tokens";
|
|
|
16
16
|
import { useReduceMotion } from "./useReduceMotion";
|
|
17
17
|
import { useScheme } from "./useScheme";
|
|
18
18
|
import { useControllableState } from "./primitives/use-controllable-state";
|
|
19
|
+
import { WindowLayer } from "./primitives/window-layer";
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Sizes from the web menu classes (`_menu-classes.ts`): content `min-w-[12rem]
|
|
@@ -245,7 +246,8 @@ export function dropdownMenuPosition({
|
|
|
245
246
|
};
|
|
246
247
|
}
|
|
247
248
|
/**
|
|
248
|
-
* The menu in a
|
|
249
|
+
* The menu in a `WindowLayer` (in the app's window under `WindowLayerHost`, so
|
|
250
|
+
* a chat under it keeps its place; else a transparent `Modal`): the opaque overlay surface of
|
|
249
251
|
* `Dialog` and `Sheet` (`FloatingSurface` without blur, with the floating
|
|
250
252
|
* shadow) at radius 16, at least 192 wide, `p-1.5`, scrolling when taller than
|
|
251
253
|
* the room. A tap outside, Android back and the VoiceOver escape gesture close
|
|
@@ -254,7 +256,7 @@ export function dropdownMenuPosition({
|
|
|
254
256
|
* 100 ms. With Reduce Motion on, it appears and leaves at once.
|
|
255
257
|
*/
|
|
256
258
|
export function DropdownMenuContent(t0) {
|
|
257
|
-
const $ = _c(
|
|
259
|
+
const $ = _c(76);
|
|
258
260
|
let children;
|
|
259
261
|
let className;
|
|
260
262
|
let props;
|
|
@@ -286,11 +288,12 @@ export function DropdownMenuContent(t0) {
|
|
|
286
288
|
t1 = $[6];
|
|
287
289
|
}
|
|
288
290
|
const align = t1 === undefined ? "start" : t1;
|
|
291
|
+
const menu = useMenu("DropdownMenuContent");
|
|
289
292
|
const {
|
|
290
293
|
open,
|
|
291
294
|
setOpen,
|
|
292
295
|
trigger
|
|
293
|
-
} =
|
|
296
|
+
} = menu;
|
|
294
297
|
const window = useWindowDimensions();
|
|
295
298
|
const insets = useSafeAreaInsets();
|
|
296
299
|
const reduceMotion = useReduceMotion();
|
|
@@ -423,6 +426,9 @@ export function DropdownMenuContent(t0) {
|
|
|
423
426
|
}
|
|
424
427
|
const position = t9;
|
|
425
428
|
const transformOrigin = `${align === "end" ? 100 : 0}% ${position.bottom === undefined ? 0 : 100}%`;
|
|
429
|
+
if (!shown) {
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
426
432
|
let t10;
|
|
427
433
|
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
428
434
|
t10 = {
|
|
@@ -559,16 +565,24 @@ export function DropdownMenuContent(t0) {
|
|
|
559
565
|
t26 = $[69];
|
|
560
566
|
}
|
|
561
567
|
let t27;
|
|
562
|
-
if ($[70] !==
|
|
563
|
-
t27 = <
|
|
564
|
-
$[70] =
|
|
565
|
-
$[71] =
|
|
566
|
-
$[72] =
|
|
567
|
-
|
|
568
|
+
if ($[70] !== menu || $[71] !== t26) {
|
|
569
|
+
t27 = <MenuContext.Provider value={menu}>{t26}</MenuContext.Provider>;
|
|
570
|
+
$[70] = menu;
|
|
571
|
+
$[71] = t26;
|
|
572
|
+
$[72] = t27;
|
|
573
|
+
} else {
|
|
574
|
+
t27 = $[72];
|
|
575
|
+
}
|
|
576
|
+
let t28;
|
|
577
|
+
if ($[73] !== close || $[74] !== t27) {
|
|
578
|
+
t28 = <WindowLayer onRequestClose={close} fade={false}>{t27}</WindowLayer>;
|
|
579
|
+
$[73] = close;
|
|
580
|
+
$[74] = t27;
|
|
581
|
+
$[75] = t28;
|
|
568
582
|
} else {
|
|
569
|
-
|
|
583
|
+
t28 = $[75];
|
|
570
584
|
}
|
|
571
|
-
return
|
|
585
|
+
return t28;
|
|
572
586
|
}
|
|
573
587
|
|
|
574
588
|
/** Item type and icon size: the web `text-sm` with a 16 icon in 48 rows, or `text-lg` with a 22 icon and 56 rows with larger text. */
|
|
@@ -8,6 +8,8 @@ import { createContext, useContext } from "react";
|
|
|
8
8
|
* the `FlatList` of `ConversationList`. `scrollToEnd` goes to the newest
|
|
9
9
|
* message, which is offset 0 in an inverted list. `scrollTo` goes to an
|
|
10
10
|
* offset; only the `ScrollView` has it, so call it as `scrollTo?.(...)`.
|
|
11
|
+
* `scrollToIndex` brings one row of the list's `data` into view (a find in
|
|
12
|
+
* the thread); only the `FlatList` has it. `viewPosition` 0.5 centres it.
|
|
11
13
|
*/
|
|
12
14
|
|
|
13
15
|
export const ConversationContext = createContext(null);
|
package/dist/ai/conversation.jsx
CHANGED
|
@@ -366,6 +366,9 @@ export function ConversationList({
|
|
|
366
366
|
inset: 0,
|
|
367
367
|
keyboardMoving: false
|
|
368
368
|
});
|
|
369
|
+
// The list, and the row `scrollToIndex` last asked for, for its retry when that row was not drawn.
|
|
370
|
+
const listRef = useRef(null);
|
|
371
|
+
const indexTarget = useRef(null);
|
|
369
372
|
// Not inverted: hidden until the first jump to the end (see above). An
|
|
370
373
|
// empty list (a spinner, an empty state) shows at once.
|
|
371
374
|
const hasRows = (props.data?.length ?? 0) > 0;
|
|
@@ -400,7 +403,7 @@ export function ConversationList({
|
|
|
400
403
|
}
|
|
401
404
|
// The newest message's offset: inverted, 0 less the space before it.
|
|
402
405
|
const end = () => inverted ? size.current.inset > 0 ? -size.current.inset : 0 : Math.max(0, size.current.content + size.current.inset - size.current.view);
|
|
403
|
-
const
|
|
406
|
+
const list_1 = <FlatList className={cn("flex-1", className)}
|
|
404
407
|
// Inverted, the column's end is the top: a short thread sits there.
|
|
405
408
|
contentContainerClassName={cn("px-3 py-3", inverted && "grow justify-end", contentContainerClassName)} {...wired} style={[wired.style, !inverted && hasRows && !placed ? styles.hidden : null]}
|
|
406
409
|
// At the bottom, a new message shows at offset 0; scrolled up, it must not move what the reader sees.
|
|
@@ -412,18 +415,39 @@ export function ConversationList({
|
|
|
412
415
|
size.current.keyboardMoving = moving;
|
|
413
416
|
// The closing menu's window hands the focus back with a keyboard event: frozen until it ends.
|
|
414
417
|
if (!moving) conversation.settleOverlay();
|
|
415
|
-
}} /> : props.renderScrollComponent}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
+
}} /> : props.renderScrollComponent}
|
|
419
|
+
// A row the list has not drawn yet (it draws only those near the view):
|
|
420
|
+
// go to its estimated offset, which draws it, then to the row itself.
|
|
421
|
+
onScrollToIndexFailed={props.onScrollToIndexFailed ?? (info => {
|
|
422
|
+
const list = listRef.current;
|
|
423
|
+
const target = indexTarget.current;
|
|
424
|
+
if (!list || !target || target.index !== info.index || target.tries >= 3) return;
|
|
425
|
+
target.tries += 1;
|
|
426
|
+
list.scrollToOffset({
|
|
427
|
+
offset: info.averageItemLength * info.index,
|
|
428
|
+
animated: false
|
|
429
|
+
});
|
|
430
|
+
requestAnimationFrame(() => list.scrollToIndex(target));
|
|
431
|
+
})} ref={list_0 => {
|
|
432
|
+
listRef.current = list_0;
|
|
433
|
+
conversation.scrollRef.current = list_0 && {
|
|
434
|
+
scrollToEnd: options => list_0.scrollToOffset({
|
|
418
435
|
offset: end(),
|
|
419
436
|
animated: options?.animated
|
|
420
|
-
})
|
|
437
|
+
}),
|
|
438
|
+
scrollToIndex: options_0 => {
|
|
439
|
+
indexTarget.current = {
|
|
440
|
+
...options_0,
|
|
441
|
+
tries: 0
|
|
442
|
+
};
|
|
443
|
+
list_0.scrollToIndex(options_0);
|
|
444
|
+
}
|
|
421
445
|
};
|
|
422
446
|
}} />;
|
|
423
|
-
if (!keyboard) return
|
|
447
|
+
if (!keyboard) return list_1;
|
|
424
448
|
// The keyboard follows the finger from the composer's top: the dock less the inset it pads.
|
|
425
449
|
return <keyboard.GestureArea offset={Math.max(0, conversation.dockHeight - insets.bottom)} style={styles.fill}>
|
|
426
|
-
{
|
|
450
|
+
{list_1}
|
|
427
451
|
</keyboard.GestureArea>;
|
|
428
452
|
}
|
|
429
453
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Pressable, StyleSheet, Text, View, useWindowDimensions } from "react-native";
|
|
3
3
|
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
4
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
5
|
import { cn } from "../cn";
|
|
6
|
+
import { WindowLayer } from "../primitives/window-layer";
|
|
6
7
|
import { PANEL_SCALE_FROM, POPOVER_ENTER } from "../motion";
|
|
7
8
|
import { sizeStyle, typeStyle } from "../controlStyles";
|
|
8
9
|
import { palette, withAlpha } from "../palette";
|
|
9
10
|
import { useLargerText } from "../theme";
|
|
10
11
|
import { tokens } from "../tokens";
|
|
11
|
-
import { useReduceMotion } from "../useReduceMotion";
|
|
12
12
|
import { useScheme } from "../useScheme";
|
|
13
13
|
import { chatTextSize } from "./chat-text";
|
|
14
14
|
import { MESSAGE_MENU, messageContextMenuLayout } from "./message-menu-layout";
|
|
@@ -21,8 +21,9 @@ const LIFT_SCALE = 1.02;
|
|
|
21
21
|
* The iMessage hold menu for a chat message: the chat fades under a frosted
|
|
22
22
|
* wash of the screen colour, the held message stays in place,
|
|
23
23
|
* lifted, with the quick reactions in a pill above it and the actions in a
|
|
24
|
-
* card below it, label first and icon last. It
|
|
25
|
-
*
|
|
24
|
+
* card below it, label first and icon last. It draws in the app's window
|
|
25
|
+
* (`WindowLayer`) and fades in and out as one; with Reduce Motion on, it
|
|
26
|
+
* appears at once. As it fades
|
|
26
27
|
* in, the pill and the card grow into place from the message's side (0.96 to
|
|
27
28
|
* 1) and the held message lifts a little (to 1.02), in 150 ms; with Reduce
|
|
28
29
|
* Motion they are in place at once. A tap outside, Android back
|
|
@@ -30,7 +31,7 @@ const LIFT_SCALE = 1.02;
|
|
|
30
31
|
* runs. `Message` opens it with `menu`.
|
|
31
32
|
*/
|
|
32
33
|
export function MessageContextMenu(t0) {
|
|
33
|
-
const $ = _c(
|
|
34
|
+
const $ = _c(89);
|
|
34
35
|
const {
|
|
35
36
|
open,
|
|
36
37
|
onClose,
|
|
@@ -46,7 +47,6 @@ export function MessageContextMenu(t0) {
|
|
|
46
47
|
const window = useWindowDimensions();
|
|
47
48
|
const insets = useSafeAreaInsets();
|
|
48
49
|
const largerText = useLargerText();
|
|
49
|
-
const reduceMotion = useReduceMotion();
|
|
50
50
|
const rowHeight = largerText ? 56 : 48;
|
|
51
51
|
let t2;
|
|
52
52
|
if ($[0] !== largerText) {
|
|
@@ -151,57 +151,56 @@ export function MessageContextMenu(t0) {
|
|
|
151
151
|
}
|
|
152
152
|
const shadow = t9;
|
|
153
153
|
const pillWidth = Math.min(window.width - 2 * MESSAGE_MENU.edge, (menu.reactions?.items.length ?? 0) * 48 + 16);
|
|
154
|
-
|
|
155
|
-
let t11;
|
|
154
|
+
let t10;
|
|
156
155
|
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
157
|
-
|
|
156
|
+
t10 = {
|
|
158
157
|
flex: 1
|
|
159
158
|
};
|
|
160
|
-
$[18] =
|
|
159
|
+
$[18] = t10;
|
|
161
160
|
} else {
|
|
162
|
-
|
|
161
|
+
t10 = $[18];
|
|
163
162
|
}
|
|
164
|
-
const
|
|
165
|
-
const
|
|
166
|
-
let
|
|
167
|
-
if ($[19] !==
|
|
168
|
-
|
|
169
|
-
$[19] =
|
|
170
|
-
$[20] =
|
|
163
|
+
const t11 = `${testID}-backdrop`;
|
|
164
|
+
const t12 = tokens.color.background[scheme];
|
|
165
|
+
let t13;
|
|
166
|
+
if ($[19] !== t12) {
|
|
167
|
+
t13 = withAlpha(t12, 0.85);
|
|
168
|
+
$[19] = t12;
|
|
169
|
+
$[20] = t13;
|
|
171
170
|
} else {
|
|
172
|
-
|
|
171
|
+
t13 = $[20];
|
|
173
172
|
}
|
|
174
|
-
let
|
|
175
|
-
if ($[21] !==
|
|
176
|
-
|
|
177
|
-
backgroundColor:
|
|
173
|
+
let t14;
|
|
174
|
+
if ($[21] !== t13) {
|
|
175
|
+
t14 = [StyleSheet.absoluteFill, {
|
|
176
|
+
backgroundColor: t13
|
|
178
177
|
}];
|
|
179
|
-
$[21] =
|
|
180
|
-
$[22] =
|
|
178
|
+
$[21] = t13;
|
|
179
|
+
$[22] = t14;
|
|
181
180
|
} else {
|
|
182
|
-
|
|
181
|
+
t14 = $[22];
|
|
183
182
|
}
|
|
184
|
-
let
|
|
185
|
-
if ($[23] !== onClose || $[24] !==
|
|
186
|
-
|
|
183
|
+
let t15;
|
|
184
|
+
if ($[23] !== onClose || $[24] !== t11 || $[25] !== t14) {
|
|
185
|
+
t15 = <View style={StyleSheet.absoluteFill}><Pressable testID={t11} accessibilityRole="button" accessibilityLabel="Close menu" onPress={onClose} style={t14} /></View>;
|
|
187
186
|
$[23] = onClose;
|
|
188
|
-
$[24] =
|
|
189
|
-
$[25] =
|
|
190
|
-
$[26] =
|
|
187
|
+
$[24] = t11;
|
|
188
|
+
$[25] = t14;
|
|
189
|
+
$[26] = t15;
|
|
191
190
|
} else {
|
|
192
|
-
|
|
191
|
+
t15 = $[26];
|
|
193
192
|
}
|
|
194
|
-
const
|
|
195
|
-
let
|
|
196
|
-
if ($[27] !== anchor.width || $[28] !== anchor.x || $[29] !== layout.previewHeight || $[30] !== layout.previewTop || $[31] !==
|
|
197
|
-
|
|
193
|
+
const t16 = tokens.color.background[scheme];
|
|
194
|
+
let t17;
|
|
195
|
+
if ($[27] !== anchor.width || $[28] !== anchor.x || $[29] !== layout.previewHeight || $[30] !== layout.previewTop || $[31] !== t16) {
|
|
196
|
+
t17 = {
|
|
198
197
|
position: "absolute",
|
|
199
198
|
top: layout.previewTop,
|
|
200
199
|
left: anchor.x,
|
|
201
200
|
width: anchor.width,
|
|
202
201
|
height: layout.previewHeight,
|
|
203
202
|
overflow: "hidden",
|
|
204
|
-
backgroundColor:
|
|
203
|
+
backgroundColor: t16,
|
|
205
204
|
borderRadius: tokens.radius.card,
|
|
206
205
|
...shadow
|
|
207
206
|
};
|
|
@@ -209,32 +208,32 @@ export function MessageContextMenu(t0) {
|
|
|
209
208
|
$[28] = anchor.x;
|
|
210
209
|
$[29] = layout.previewHeight;
|
|
211
210
|
$[30] = layout.previewTop;
|
|
212
|
-
$[31] =
|
|
213
|
-
$[32] =
|
|
211
|
+
$[31] = t16;
|
|
212
|
+
$[32] = t17;
|
|
214
213
|
} else {
|
|
215
|
-
|
|
214
|
+
t17 = $[32];
|
|
216
215
|
}
|
|
217
|
-
let
|
|
218
|
-
if ($[33] !== liftStyle || $[34] !==
|
|
219
|
-
|
|
216
|
+
let t18;
|
|
217
|
+
if ($[33] !== liftStyle || $[34] !== t17) {
|
|
218
|
+
t18 = [t17, liftStyle];
|
|
220
219
|
$[33] = liftStyle;
|
|
221
|
-
$[34] =
|
|
222
|
-
$[35] =
|
|
220
|
+
$[34] = t17;
|
|
221
|
+
$[35] = t18;
|
|
223
222
|
} else {
|
|
224
|
-
|
|
223
|
+
t18 = $[35];
|
|
225
224
|
}
|
|
226
|
-
let
|
|
227
|
-
if ($[36] !== preview || $[37] !==
|
|
228
|
-
|
|
225
|
+
let t19;
|
|
226
|
+
if ($[36] !== preview || $[37] !== t18) {
|
|
227
|
+
t19 = <Animated.View pointerEvents="none" style={t18}>{preview}</Animated.View>;
|
|
229
228
|
$[36] = preview;
|
|
230
|
-
$[37] =
|
|
231
|
-
$[38] =
|
|
229
|
+
$[37] = t18;
|
|
230
|
+
$[38] = t19;
|
|
232
231
|
} else {
|
|
233
|
-
|
|
232
|
+
t19 = $[38];
|
|
234
233
|
}
|
|
235
|
-
let
|
|
234
|
+
let t20;
|
|
236
235
|
if ($[39] !== align || $[40] !== layout.pillTop || $[41] !== menu.reactions || $[42] !== pillWidth || $[43] !== popStyle || $[44] !== run || $[45] !== scheme || $[46] !== side || $[47] !== surface || $[48] !== testID) {
|
|
237
|
-
|
|
236
|
+
t20 = menu.reactions ? <Animated.View accessibilityRole="toolbar" style={[{
|
|
238
237
|
position: "absolute",
|
|
239
238
|
top: layout.pillTop,
|
|
240
239
|
...side(pillWidth),
|
|
@@ -265,113 +264,112 @@ export function MessageContextMenu(t0) {
|
|
|
265
264
|
$[46] = side;
|
|
266
265
|
$[47] = surface;
|
|
267
266
|
$[48] = testID;
|
|
268
|
-
$[49] =
|
|
267
|
+
$[49] = t20;
|
|
269
268
|
} else {
|
|
270
|
-
|
|
269
|
+
t20 = $[49];
|
|
271
270
|
}
|
|
272
|
-
const
|
|
273
|
-
let
|
|
271
|
+
const t21 = layout.menuTop;
|
|
272
|
+
let t22;
|
|
274
273
|
if ($[50] !== side) {
|
|
275
|
-
|
|
274
|
+
t22 = side(MESSAGE_MENU.menuWidth);
|
|
276
275
|
$[50] = side;
|
|
277
|
-
$[51] =
|
|
276
|
+
$[51] = t22;
|
|
278
277
|
} else {
|
|
279
|
-
|
|
278
|
+
t22 = $[51];
|
|
280
279
|
}
|
|
281
|
-
const
|
|
282
|
-
const
|
|
283
|
-
let
|
|
284
|
-
if ($[52] !== layout.menuTop || $[53] !== surface || $[54] !==
|
|
285
|
-
|
|
280
|
+
const t23 = window.width - 2 * MESSAGE_MENU.edge;
|
|
281
|
+
const t24 = align === "end" ? "right top" : "left top";
|
|
282
|
+
let t25;
|
|
283
|
+
if ($[52] !== layout.menuTop || $[53] !== surface || $[54] !== t22 || $[55] !== t23 || $[56] !== t24) {
|
|
284
|
+
t25 = {
|
|
286
285
|
position: "absolute",
|
|
287
|
-
top:
|
|
288
|
-
...
|
|
286
|
+
top: t21,
|
|
287
|
+
...t22,
|
|
289
288
|
width: MESSAGE_MENU.menuWidth,
|
|
290
|
-
maxWidth:
|
|
289
|
+
maxWidth: t23,
|
|
291
290
|
borderRadius: tokens.radius.card,
|
|
292
291
|
backgroundColor: surface,
|
|
293
292
|
overflow: "hidden",
|
|
294
|
-
transformOrigin:
|
|
293
|
+
transformOrigin: t24,
|
|
295
294
|
...shadow
|
|
296
295
|
};
|
|
297
296
|
$[52] = layout.menuTop;
|
|
298
297
|
$[53] = surface;
|
|
299
|
-
$[54] =
|
|
300
|
-
$[55] =
|
|
301
|
-
$[56] =
|
|
302
|
-
$[57] =
|
|
298
|
+
$[54] = t22;
|
|
299
|
+
$[55] = t23;
|
|
300
|
+
$[56] = t24;
|
|
301
|
+
$[57] = t25;
|
|
303
302
|
} else {
|
|
304
|
-
|
|
303
|
+
t25 = $[57];
|
|
305
304
|
}
|
|
306
|
-
let
|
|
307
|
-
if ($[58] !== popStyle || $[59] !==
|
|
308
|
-
|
|
305
|
+
let t26;
|
|
306
|
+
if ($[58] !== popStyle || $[59] !== t25) {
|
|
307
|
+
t26 = [t25, popStyle];
|
|
309
308
|
$[58] = popStyle;
|
|
310
|
-
$[59] =
|
|
311
|
-
$[60] =
|
|
309
|
+
$[59] = t25;
|
|
310
|
+
$[60] = t26;
|
|
312
311
|
} else {
|
|
313
|
-
|
|
312
|
+
t26 = $[60];
|
|
314
313
|
}
|
|
315
|
-
let
|
|
314
|
+
let t27;
|
|
316
315
|
if ($[61] !== body || $[62] !== largerText || $[63] !== menu.actions || $[64] !== rowHeight || $[65] !== run || $[66] !== testID) {
|
|
317
|
-
let
|
|
316
|
+
let t28;
|
|
318
317
|
if ($[68] !== body || $[69] !== largerText || $[70] !== rowHeight || $[71] !== run || $[72] !== testID) {
|
|
319
|
-
|
|
318
|
+
t28 = (action_0, index) => <MenuCardRow key={action_0.key} testID={`${testID}-action-${action_0.key}`} action={action_0} first={index === 0} rowHeight={rowHeight} body={body} iconSize={largerText ? 22 : 20} onPress={() => run(action_0.onPress)} />;
|
|
320
319
|
$[68] = body;
|
|
321
320
|
$[69] = largerText;
|
|
322
321
|
$[70] = rowHeight;
|
|
323
322
|
$[71] = run;
|
|
324
323
|
$[72] = testID;
|
|
325
|
-
$[73] =
|
|
324
|
+
$[73] = t28;
|
|
326
325
|
} else {
|
|
327
|
-
|
|
326
|
+
t28 = $[73];
|
|
328
327
|
}
|
|
329
|
-
|
|
328
|
+
t27 = menu.actions.map(t28);
|
|
330
329
|
$[61] = body;
|
|
331
330
|
$[62] = largerText;
|
|
332
331
|
$[63] = menu.actions;
|
|
333
332
|
$[64] = rowHeight;
|
|
334
333
|
$[65] = run;
|
|
335
334
|
$[66] = testID;
|
|
336
|
-
$[67] =
|
|
335
|
+
$[67] = t27;
|
|
337
336
|
} else {
|
|
338
|
-
|
|
337
|
+
t27 = $[67];
|
|
339
338
|
}
|
|
340
|
-
let
|
|
341
|
-
if ($[74] !==
|
|
342
|
-
|
|
343
|
-
$[74] =
|
|
344
|
-
$[75] =
|
|
345
|
-
$[76] =
|
|
339
|
+
let t28;
|
|
340
|
+
if ($[74] !== t26 || $[75] !== t27) {
|
|
341
|
+
t28 = <Animated.View accessibilityRole="menu" style={t26}>{t27}</Animated.View>;
|
|
342
|
+
$[74] = t26;
|
|
343
|
+
$[75] = t27;
|
|
344
|
+
$[76] = t28;
|
|
346
345
|
} else {
|
|
347
|
-
|
|
346
|
+
t28 = $[76];
|
|
348
347
|
}
|
|
349
|
-
let
|
|
350
|
-
if ($[77] !== appear || $[78] !== onClose || $[79] !==
|
|
351
|
-
|
|
348
|
+
let t29;
|
|
349
|
+
if ($[77] !== appear || $[78] !== onClose || $[79] !== t15 || $[80] !== t19 || $[81] !== t20 || $[82] !== t28 || $[83] !== testID) {
|
|
350
|
+
t29 = <View style={t10} testID={testID} accessibilityViewIsModal={true} onAccessibilityEscape={onClose} onLayout={appear}>{t15}{t19}{t20}{t28}</View>;
|
|
352
351
|
$[77] = appear;
|
|
353
352
|
$[78] = onClose;
|
|
354
|
-
$[79] =
|
|
355
|
-
$[80] =
|
|
356
|
-
$[81] =
|
|
357
|
-
$[82] =
|
|
353
|
+
$[79] = t15;
|
|
354
|
+
$[80] = t19;
|
|
355
|
+
$[81] = t20;
|
|
356
|
+
$[82] = t28;
|
|
358
357
|
$[83] = testID;
|
|
359
|
-
$[84] =
|
|
358
|
+
$[84] = t29;
|
|
360
359
|
} else {
|
|
361
|
-
|
|
360
|
+
t29 = $[84];
|
|
362
361
|
}
|
|
363
|
-
let
|
|
364
|
-
if ($[85] !== onClose || $[86] !== onDismissed || $[87] !==
|
|
365
|
-
|
|
362
|
+
let t30;
|
|
363
|
+
if ($[85] !== onClose || $[86] !== onDismissed || $[87] !== t29) {
|
|
364
|
+
t30 = <WindowLayer onRequestClose={onClose} onDismiss={onDismissed}>{t29}</WindowLayer>;
|
|
366
365
|
$[85] = onClose;
|
|
367
366
|
$[86] = onDismissed;
|
|
368
|
-
$[87] =
|
|
367
|
+
$[87] = t29;
|
|
369
368
|
$[88] = t30;
|
|
370
|
-
$[89] = t31;
|
|
371
369
|
} else {
|
|
372
|
-
|
|
370
|
+
t30 = $[88];
|
|
373
371
|
}
|
|
374
|
-
return
|
|
372
|
+
return t30;
|
|
375
373
|
}
|
|
376
374
|
|
|
377
375
|
/**
|
|
@@ -58,3 +58,5 @@ export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLab
|
|
|
58
58
|
export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHandle, SheetHeader, SheetTitle, SheetDescription, SheetBody, SheetFooter } from "../Sheet";
|
|
59
59
|
export { Toaster } from "../Toast";
|
|
60
60
|
export { toast } from "../toastStore";
|
|
61
|
+
// Overlays in the app's window (the hold menu, the image viewer): wrap the navigator once.
|
|
62
|
+
export { WindowLayerHost } from "../primitives/window-layer";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { useContext, useState } from "react";
|
|
3
|
-
import { FlatList, Image,
|
|
3
|
+
import { FlatList, Image, Pressable, Text, View, useWindowDimensions } from "react-native";
|
|
4
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
5
|
import { IconExternalLink, IconX } from "@tabler/icons-react-native";
|
|
6
6
|
import { typeStyle } from "../controlStyles";
|
|
7
|
+
import { WindowLayer } from "../primitives/window-layer";
|
|
7
8
|
import { IconButton } from "../IconButton";
|
|
8
9
|
import { withAlpha } from "../palette";
|
|
9
10
|
import { tokens } from "../tokens";
|
|
10
|
-
import { useReduceMotion } from "../useReduceMotion";
|
|
11
11
|
import { useScheme } from "../useScheme";
|
|
12
12
|
import { ZoomImageContext } from "./zoomImage";
|
|
13
13
|
import { imageAspect, imageGridTiles, imageViewerPage, MEDIA } from "./imageGrid";
|
|
@@ -346,7 +346,7 @@ function _temp(tile) {
|
|
|
346
346
|
* at once with Reduce Motion.
|
|
347
347
|
*/
|
|
348
348
|
export function ImageViewer(t0) {
|
|
349
|
-
const $ = _c(
|
|
349
|
+
const $ = _c(9);
|
|
350
350
|
const {
|
|
351
351
|
images,
|
|
352
352
|
index,
|
|
@@ -354,34 +354,31 @@ export function ImageViewer(t0) {
|
|
|
354
354
|
onClose,
|
|
355
355
|
onOpenImage
|
|
356
356
|
} = t0;
|
|
357
|
-
const reduceMotion = useReduceMotion();
|
|
358
357
|
if (index === null) {
|
|
359
358
|
return null;
|
|
360
359
|
}
|
|
361
|
-
|
|
362
|
-
let t2;
|
|
360
|
+
let t1;
|
|
363
361
|
if ($[0] !== images || $[1] !== index || $[2] !== onClose || $[3] !== onIndexChange || $[4] !== onOpenImage) {
|
|
364
|
-
|
|
362
|
+
t1 = <ViewerRoot><ViewerPages images={images} index={index} onIndexChange={onIndexChange} onClose={onClose} onOpenImage={onOpenImage} /></ViewerRoot>;
|
|
365
363
|
$[0] = images;
|
|
366
364
|
$[1] = index;
|
|
367
365
|
$[2] = onClose;
|
|
368
366
|
$[3] = onIndexChange;
|
|
369
367
|
$[4] = onOpenImage;
|
|
370
|
-
$[5] =
|
|
368
|
+
$[5] = t1;
|
|
371
369
|
} else {
|
|
372
|
-
|
|
370
|
+
t1 = $[5];
|
|
373
371
|
}
|
|
374
|
-
let
|
|
375
|
-
if ($[6] !== onClose || $[7] !== t1
|
|
376
|
-
|
|
372
|
+
let t2;
|
|
373
|
+
if ($[6] !== onClose || $[7] !== t1) {
|
|
374
|
+
t2 = <WindowLayer onRequestClose={onClose}>{t1}</WindowLayer>;
|
|
377
375
|
$[6] = onClose;
|
|
378
376
|
$[7] = t1;
|
|
379
377
|
$[8] = t2;
|
|
380
|
-
$[9] = t3;
|
|
381
378
|
} else {
|
|
382
|
-
|
|
379
|
+
t2 = $[8];
|
|
383
380
|
}
|
|
384
|
-
return
|
|
381
|
+
return t2;
|
|
385
382
|
}
|
|
386
383
|
|
|
387
384
|
/** The zoom parts' gesture root, when there are zoom parts. */
|