@vvedantb/native-ui 0.38.0 → 0.39.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/dist/Avatar.jsx +22 -19
- package/dist/BottomSheetContainer.jsx +0 -6
- package/dist/BulkActionBar.jsx +0 -24
- package/dist/Button.jsx +92 -116
- package/dist/Card.jsx +56 -50
- package/dist/ColorSwatches.jsx +0 -6
- package/dist/Dialog.jsx +0 -12
- package/dist/DropdownMenu.jsx +0 -10
- package/dist/EmptyState.jsx +0 -3
- package/dist/ExpoWebRoot.jsx +0 -6
- package/dist/Field.jsx +0 -17
- package/dist/FloatingSurface.jsx +95 -80
- package/dist/FloatingTabBar.jsx +0 -23
- package/dist/IconButton.jsx +0 -1
- package/dist/LoadingState.jsx +0 -6
- package/dist/PasswordInput.jsx +0 -15
- package/dist/PillTabs.jsx +39 -36
- package/dist/SearchInput.jsx +0 -13
- package/dist/SectionLabel.jsx +0 -1
- package/dist/SharedTransition.jsx +0 -3
- package/dist/Skeleton.jsx +0 -2
- package/dist/Spinner.jsx +0 -2
- package/dist/StatusDot.jsx +0 -5
- package/dist/Switch.jsx +32 -22
- package/dist/Tabs.jsx +27 -26
- package/dist/Textarea.jsx +0 -1
- package/dist/ThemeToggle.jsx +0 -1
- package/dist/Toast.jsx +80 -91
- package/dist/UpdateChecker.jsx +0 -1
- package/dist/ai/activity-question.jsx +0 -6
- package/dist/ai/activity-step-label.js +0 -6
- package/dist/ai/activity-step-types.js +0 -4
- package/dist/ai/activity-tasks-utils.js +0 -17
- package/dist/ai/activity-timeline.js +0 -8
- package/dist/ai/attachments.jsx +0 -2
- package/dist/ai/chain-of-thought.jsx +0 -3
- package/dist/ai/chat-text.js +0 -1
- package/dist/ai/chat-thread.jsx +0 -1
- package/dist/ai/choice-question.jsx +0 -10
- package/dist/ai/code-block.jsx +0 -31
- package/dist/ai/collapsible.jsx +0 -14
- package/dist/ai/conversation-context.js +0 -3
- package/dist/ai/conversation.jsx +2 -48
- package/dist/ai/file-chip.jsx +0 -2
- package/dist/ai/icon-button.jsx +0 -8
- package/dist/ai/index.js +0 -5
- package/dist/ai/message-context-menu.jsx +0 -7
- package/dist/ai/message.jsx +0 -21
- package/dist/ai/prompt-input-menu.jsx +0 -3
- package/dist/ai/prompt-input.jsx +0 -27
- package/dist/ai/response-text.jsx +0 -6
- package/dist/ai/sources.jsx +0 -1
- package/dist/ai/suggestion.jsx +0 -1
- package/dist/ai/trace.jsx +0 -11
- package/dist/ai/unified-diff.jsx +0 -4
- package/dist/auth/AuthScreen.jsx +0 -5
- package/dist/auth/GoogleSignInButton.jsx +0 -3
- package/dist/auth/SecondFactorScreen.jsx +0 -2
- package/dist/auth/SignInScreen.jsx +0 -17
- package/dist/auth/authErrors.js +0 -4
- package/dist/auth/clerkCore3.js +0 -7
- package/dist/auth/index.js +0 -4
- package/dist/auth/totp.js +0 -2
- package/dist/brand/GoogleMark.jsx +0 -1
- package/dist/brand/ProviderIcon.jsx +0 -2
- package/dist/brand/index.js +0 -3
- package/dist/brand/svg.js +0 -6
- package/dist/configureTheme.js +0 -9
- package/dist/controlStyles.js +0 -14
- package/dist/crash/lastCrash.js +3 -24
- package/dist/entries/ai.js +0 -3
- package/dist/entries/ambient.js +0 -2
- package/dist/entries/app-root.js +0 -5
- package/dist/entries/auth.js +0 -4
- package/dist/entries/bottom-sheet.js +0 -2
- package/dist/entries/brand.js +0 -1
- package/dist/entries/button.js +0 -1
- package/dist/entries/crash.js +0 -3
- package/dist/entries/date-time.js +0 -2
- package/dist/entries/expo-router.js +0 -3
- package/dist/entries/expo-web-root.js +0 -2
- package/dist/entries/floating.js +0 -2
- package/dist/entries/generative-ui.js +0 -4
- package/dist/entries/gesture-handler.js +0 -3
- package/dist/entries/keyboard-controller.js +0 -3
- package/dist/entries/layout.js +0 -2
- package/dist/entries/markdown.js +0 -3
- package/dist/entries/marketing.js +0 -1
- package/dist/entries/page-title.js +0 -5
- package/dist/entries/password-input.js +0 -2
- package/dist/entries/paste-input.js +0 -3
- package/dist/entries/primitives.js +0 -6
- package/dist/entries/search-input.js +0 -2
- package/dist/entries/tab-bar.js +0 -2
- package/dist/entries/theme.js +1 -2
- package/dist/entries/toast.js +0 -3
- package/dist/entries/video.js +0 -2
- package/dist/entries/webview.js +0 -2
- package/dist/examples/AiChatGallery.jsx +0 -11
- package/dist/examples/ParityGallery.jsx +0 -12
- package/dist/floating.js +0 -8
- package/dist/generative-ui/GenerativeUiPanel.jsx +0 -2
- package/dist/generative-ui/components.jsx +0 -8
- package/dist/glass.js +55 -0
- package/dist/glassBlur.jsx +0 -12
- package/dist/highlight.js +0 -26
- package/dist/index.js +1 -2
- package/dist/loadingGrid.js +0 -13
- package/dist/markdown/Markdown.jsx +0 -59
- package/dist/markdown/MarkdownTable.jsx +0 -18
- package/dist/markdown/tableText.js +0 -5
- package/dist/marketing/UpgradeToProCard.jsx +0 -5
- package/dist/marketing/pricing.js +0 -3
- package/dist/media/ImageGallery.jsx +0 -16
- package/dist/media/imageZoom.js +0 -4
- package/dist/media/zoom-image-gesture.jsx +0 -8
- package/dist/media/zoomImage.js +0 -3
- package/dist/motion.js +0 -3
- package/dist/neutralTheme.js +0 -5
- package/dist/pagerSwipe.js +0 -16
- package/dist/palette.js +0 -10
- package/dist/primitives/button.jsx +0 -5
- package/dist/primitives/keyboard-controller.jsx +0 -27
- package/dist/primitives/native-only-animated-view.jsx +0 -5
- package/dist/primitives/overlay.jsx +0 -2
- package/dist/primitives/pager-gesture.jsx +3 -29
- package/dist/primitives/paste-input.jsx +0 -5
- package/dist/primitives/select.jsx +0 -8
- package/dist/primitives/sheet-drag.jsx +0 -3
- package/dist/primitives/sheet-gesture.jsx +0 -8
- package/dist/primitives/swipe-row-gesture.jsx +3 -45
- package/dist/primitives/text.jsx +0 -5
- package/dist/primitives/toast-drag-gesture.jsx +4 -24
- package/dist/primitives/web-click-guard.js +0 -3
- package/dist/primitives/window-layer.jsx +0 -14
- package/dist/push.js +0 -6
- package/dist/relativeTime.js +0 -13
- package/dist/settings/MoreFromProjectV.jsx +0 -5
- package/dist/settings/ThemeModePicker.jsx +0 -4
- package/dist/settings/projectVMobileApps.js +1 -6
- package/dist/sheetDrag.js +0 -10
- package/dist/swipeRow.js +0 -15
- package/dist/tabBarRoutes.js +0 -4
- package/dist/tabIndicator.js +0 -4
- package/dist/tailwind-preset.cjs +0 -54
- package/dist/tailwind-preset.d.cts +0 -8
- package/dist/theme.jsx +29 -21
- package/dist/themeModeStore.js +0 -5
- package/dist/toastChrome.js +0 -6
- package/dist/toastDrag.js +0 -14
- package/dist/toastStore.js +0 -4
- package/dist/updateCheck.js +0 -7
- package/dist/video/InlineVideo.jsx +0 -2
- package/dist/webview/htmlView.js +0 -5
- package/package.json +3 -3
- package/src/ArtifactList.tsx +0 -2
- package/src/Avatar.tsx +3 -3
- package/src/Badge.tsx +0 -1
- package/src/BottomSheetContainer.tsx +0 -11
- package/src/BulkActionBar.tsx +0 -66
- package/src/Button.tsx +4 -40
- package/src/CaptureButton.tsx +0 -1
- package/src/Card.tsx +3 -15
- package/src/Checkbox.tsx +0 -2
- package/src/ColorSwatches.tsx +0 -9
- package/src/ConfirmDialog.tsx +0 -7
- package/src/DateTimeField.tsx +0 -5
- package/src/Dialog.tsx +0 -27
- package/src/DividedList.tsx +0 -1
- package/src/DropdownMenu.tsx +0 -51
- package/src/EmptyState.tsx +0 -5
- package/src/ExpoWebRoot.tsx +0 -10
- package/src/Field.tsx +0 -14
- package/src/FloatingFAB.tsx +0 -3
- package/src/FloatingSurface.tsx +11 -8
- package/src/FloatingTabBar.tsx +0 -25
- package/src/IconButton.tsx +0 -5
- package/src/Input.tsx +0 -1
- package/src/Label.tsx +0 -1
- package/src/LabeledSwitchRow.tsx +0 -2
- package/src/ListRow.tsx +0 -12
- package/src/LoadingState.tsx +0 -12
- package/src/MenuSheet.tsx +0 -2
- package/src/PageIndicator.tsx +0 -2
- package/src/PageTitle.tsx +0 -15
- package/src/Pager.tsx +0 -9
- package/src/PasswordInput.tsx +0 -24
- package/src/PillTabs.tsx +3 -11
- package/src/PinnedBotTile.tsx +0 -6
- package/src/Progress.tsx +0 -3
- package/src/ReactionRow.tsx +0 -8
- package/src/ScreenContainer.tsx +0 -4
- package/src/SearchInput.tsx +0 -25
- package/src/SectionLabel.tsx +0 -2
- package/src/Select.tsx +0 -6
- package/src/Separator.tsx +0 -2
- package/src/SharedTransition.tsx +0 -7
- package/src/Sheet.tsx +0 -3
- package/src/SheetRow.tsx +0 -12
- package/src/Skeleton.tsx +0 -10
- package/src/Spinner.tsx +0 -6
- package/src/StackPageHeader.tsx +0 -16
- package/src/StatGrid.tsx +0 -1
- package/src/StatusDot.tsx +0 -6
- package/src/SurfaceRow.tsx +0 -12
- package/src/SwipeableRow.tsx +0 -4
- package/src/Switch.tsx +3 -4
- package/src/Tabs.tsx +3 -27
- package/src/Textarea.tsx +0 -2
- package/src/ThemeToggle.tsx +0 -1
- package/src/Toast.tsx +3 -19
- package/src/UpdateChecker.tsx +0 -46
- package/src/ai/activity-question.tsx +0 -8
- package/src/ai/activity-step-detail.tsx +0 -5
- package/src/ai/activity-step-label.ts +0 -5
- package/src/ai/activity-step-types.ts +0 -24
- package/src/ai/activity-step.tsx +0 -4
- package/src/ai/activity-tasks-utils.ts +0 -13
- package/src/ai/activity-timeline.ts +0 -6
- package/src/ai/attachments.tsx +0 -13
- package/src/ai/chain-of-thought.tsx +0 -5
- package/src/ai/chat-jump-rail.tsx +0 -2
- package/src/ai/chat-text.ts +0 -1
- package/src/ai/chat-thread.tsx +0 -9
- package/src/ai/choice-question.tsx +0 -36
- package/src/ai/code-block.tsx +0 -52
- package/src/ai/collapsible.tsx +0 -12
- package/src/ai/conversation-context.ts +0 -14
- package/src/ai/conversation.tsx +0 -58
- package/src/ai/file-chip.tsx +0 -1
- package/src/ai/icon-button.tsx +0 -17
- package/src/ai/index.ts +0 -5
- package/src/ai/message-action-sheet.tsx +0 -8
- package/src/ai/message-context-menu.tsx +0 -22
- package/src/ai/message-quote.tsx +0 -4
- package/src/ai/message.tsx +0 -66
- package/src/ai/prompt-input-menu.tsx +0 -19
- package/src/ai/prompt-input.tsx +0 -97
- package/src/ai/reasoning.tsx +0 -6
- package/src/ai/reply-quote-chip.tsx +0 -5
- package/src/ai/response-text.tsx +0 -8
- package/src/ai/shimmer.tsx +0 -2
- package/src/ai/sources.tsx +0 -3
- package/src/ai/subagent-cards.tsx +0 -13
- package/src/ai/suggestion.tsx +0 -4
- package/src/ai/tool-approval-card.tsx +0 -14
- package/src/ai/trace.tsx +0 -23
- package/src/ai/unified-diff.tsx +0 -16
- package/src/ai/use-streaming-disclosure.ts +0 -4
- package/src/app-root/AuthGroupGate.tsx +0 -8
- package/src/app-root/SsoCallbackScreen.tsx +0 -10
- package/src/app-root/fonts.ts +0 -2
- package/src/auth/AccountScreens.tsx +0 -16
- package/src/auth/AuthProviders.tsx +0 -13
- package/src/auth/AuthScreen.tsx +0 -12
- package/src/auth/GoogleSignInButton.tsx +0 -12
- package/src/auth/SecondFactorScreen.tsx +0 -16
- package/src/auth/SignInScreen.tsx +0 -68
- package/src/auth/authErrors.ts +0 -6
- package/src/auth/clerkCore3.ts +0 -6
- package/src/auth/index.ts +0 -4
- package/src/auth/totp.ts +0 -13
- package/src/brand/AppIcons.tsx +0 -6
- package/src/brand/AppMark.tsx +0 -5
- package/src/brand/AppWordmark.tsx +0 -7
- package/src/brand/GoogleMark.tsx +0 -4
- package/src/brand/ProviderIcon.tsx +0 -6
- package/src/brand/familyApps.ts +0 -2
- package/src/brand/index.ts +0 -3
- package/src/brand/svg.ts +0 -9
- package/src/configureTheme.ts +0 -10
- package/src/controlStyles.ts +0 -12
- package/src/crash/LastCrashDialog.tsx +0 -6
- package/src/crash/lastCrash.ts +0 -21
- package/src/entries/ai.ts +0 -3
- package/src/entries/ambient.ts +0 -2
- package/src/entries/app-root.ts +0 -5
- package/src/entries/auth.ts +0 -4
- package/src/entries/bottom-sheet.ts +0 -2
- package/src/entries/brand.ts +0 -1
- package/src/entries/button.ts +0 -1
- package/src/entries/crash.ts +0 -3
- package/src/entries/date-time.ts +0 -2
- package/src/entries/expo-router.ts +0 -3
- package/src/entries/expo-web-root.ts +0 -2
- package/src/entries/floating.ts +0 -2
- package/src/entries/generative-ui.ts +0 -4
- package/src/entries/gesture-handler.ts +0 -3
- package/src/entries/keyboard-controller.ts +0 -3
- package/src/entries/layout.ts +0 -2
- package/src/entries/markdown.ts +0 -3
- package/src/entries/marketing.ts +0 -1
- package/src/entries/page-title.ts +0 -5
- package/src/entries/password-input.ts +0 -2
- package/src/entries/paste-input.ts +0 -3
- package/src/entries/primitives.ts +0 -6
- package/src/entries/search-input.ts +0 -2
- package/src/entries/tab-bar.ts +0 -2
- package/src/entries/theme.ts +2 -2
- package/src/entries/toast.ts +0 -3
- package/src/entries/video.ts +0 -2
- package/src/entries/webview.ts +0 -2
- package/src/examples/AiChatGallery.tsx +0 -11
- package/src/examples/ParityGallery.tsx +0 -25
- package/src/floating.ts +0 -6
- package/src/generative-ui/GenerativeUiPanel.tsx +0 -15
- package/src/generative-ui/components.tsx +0 -9
- package/src/generative-ui/context.ts +0 -2
- package/src/glass.ts +31 -0
- package/src/glassBlur.tsx +0 -15
- package/src/highlight.ts +0 -20
- package/src/index.ts +2 -2
- package/src/loadingGrid.ts +0 -12
- package/src/markdown/Markdown.tsx +0 -71
- package/src/markdown/MarkdownTable.tsx +0 -23
- package/src/markdown/tableText.ts +0 -3
- package/src/marketing/PricingModal.tsx +0 -13
- package/src/marketing/UpgradeToProCard.tsx +0 -14
- package/src/marketing/pricing.ts +0 -12
- package/src/media/ImageGallery.tsx +0 -18
- package/src/media/MediaCard.tsx +0 -8
- package/src/media/imageZoom.ts +0 -4
- package/src/media/zoom-image-gesture.tsx +0 -9
- package/src/media/zoomImage.ts +0 -5
- package/src/motion.ts +0 -3
- package/src/neutralTheme.ts +0 -3
- package/src/pagerSwipe.ts +0 -13
- package/src/palette.ts +0 -10
- package/src/pressScale.ts +0 -7
- package/src/primitives/button.tsx +0 -4
- package/src/primitives/card.tsx +0 -1
- package/src/primitives/input.tsx +0 -4
- package/src/primitives/keyboard-controller.tsx +0 -25
- package/src/primitives/keyboard-parts.tsx +0 -27
- package/src/primitives/native-only-animated-view.tsx +0 -5
- package/src/primitives/overlay.tsx +0 -25
- package/src/primitives/pager-gesture.tsx +0 -20
- package/src/primitives/paste-input.tsx +0 -4
- package/src/primitives/paste-parts.tsx +0 -1
- package/src/primitives/select.tsx +0 -16
- package/src/primitives/sheet-drag.tsx +0 -19
- package/src/primitives/sheet-gesture.tsx +0 -22
- package/src/primitives/swipe-row-gesture.tsx +0 -33
- package/src/primitives/switch.tsx +0 -4
- package/src/primitives/text.tsx +0 -4
- package/src/primitives/toast-drag-gesture.tsx +0 -13
- package/src/primitives/web-click-guard.ts +0 -2
- package/src/primitives/window-layer.tsx +0 -18
- package/src/push.ts +0 -15
- package/src/relativeTime.ts +0 -21
- package/src/router/RouterStackPageHeader.tsx +0 -1
- package/src/settings/MoreFromProjectV.tsx +0 -8
- package/src/settings/SettingsEmptyState.tsx +0 -2
- package/src/settings/SettingsSection.tsx +0 -3
- package/src/settings/SettingsToggleRow.tsx +0 -4
- package/src/settings/ThemeModePicker.tsx +0 -11
- package/src/settings/projectVMobileApps.ts +0 -8
- package/src/sheetDrag.ts +0 -9
- package/src/swipeRow.ts +0 -23
- package/src/tabBarRoutes.ts +0 -13
- package/src/tabIndicator.ts +0 -5
- package/src/tailwind-preset.cjs +0 -54
- package/src/tailwind-preset.d.cts +0 -8
- package/src/theme.tsx +11 -2
- package/src/themeModeStore.ts +0 -9
- package/src/toastChrome.ts +0 -6
- package/src/toastDrag.ts +0 -13
- package/src/toastStore.ts +0 -7
- package/src/updateCheck.ts +0 -15
- package/src/video/InlineVideo.tsx +0 -5
- package/src/webview/HtmlView.tsx +0 -23
- package/src/webview/HtmlView.web.tsx +0 -1
- package/src/webview/htmlView.ts +0 -5
package/dist/pagerSwipe.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The rules of a swiped `Pager`, as plain numbers, so they stay testable
|
|
3
|
-
* apart from the gesture. The pager's position is in pages: 0 is the first
|
|
4
|
-
* page, 1.5 is halfway between the second and the third. Distances are in
|
|
5
|
-
* points and velocities in points per second (the Gesture Handler units),
|
|
6
|
-
* positive to the right. Each rule is a worklet, so the drag runs it on the
|
|
7
|
-
* UI thread.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
1
|
/**
|
|
11
2
|
* Sideways travel (pt) before a drag takes the pager: twice a row swipe's
|
|
12
3
|
* (`SWIPE_ACTIVE_OFFSET_X`), so a swipeable row under the finger takes its
|
|
@@ -16,14 +7,8 @@ export const PAGER_ACTIVE_OFFSET_X = 24;
|
|
|
16
7
|
|
|
17
8
|
/** Vertical travel (pt) that leaves the touch to the page's own scroll. */
|
|
18
9
|
export const PAGER_FAIL_OFFSET_Y = 14;
|
|
19
|
-
|
|
20
|
-
/** A sideways flick at this speed (pt/s) turns the page, however short the drag. */
|
|
21
10
|
const FLICK_VELOCITY = 500;
|
|
22
|
-
|
|
23
|
-
/** How far ahead (s) the release velocity carries the pages when deciding where they settle. */
|
|
24
11
|
const PROJECTION_S = 0.2;
|
|
25
|
-
|
|
26
|
-
/** How far the pages move past the first or last page: less and less the further the finger goes. */
|
|
27
12
|
function rubberband(overshoot, dimension) {
|
|
28
13
|
"worklet";
|
|
29
14
|
|
|
@@ -58,7 +43,6 @@ export function pagerSettle(position, vx, width, from, count) {
|
|
|
58
43
|
"worklet";
|
|
59
44
|
|
|
60
45
|
const moved = position - from;
|
|
61
|
-
// A drag left (negative `vx`) moves toward the next page (a larger position).
|
|
62
46
|
const toward = -Math.sign(vx);
|
|
63
47
|
let target;
|
|
64
48
|
if (Math.abs(vx) >= FLICK_VELOCITY && moved !== 0 && toward === Math.sign(moved)) {
|
package/dist/palette.js
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
* drifts, so change `tokens.css` first and then this file.
|
|
10
10
|
*/
|
|
11
11
|
export const palette = {
|
|
12
|
-
/** `--accent` (web `primary`): near-black in light, near-white in dark. */
|
|
13
12
|
primary: {
|
|
14
13
|
light: "#181818",
|
|
15
14
|
dark: "#fcfcfc"
|
|
@@ -42,7 +41,6 @@ export const palette = {
|
|
|
42
41
|
light: "#1a1815",
|
|
43
42
|
dark: "#1a1815"
|
|
44
43
|
},
|
|
45
|
-
/** `--default` (web `secondary`): neutral control fill. */
|
|
46
44
|
default: {
|
|
47
45
|
light: "#ebebeb",
|
|
48
46
|
dark: "#272727"
|
|
@@ -67,12 +65,6 @@ export const palette = {
|
|
|
67
65
|
light: "#181818",
|
|
68
66
|
dark: "#fcfcfc"
|
|
69
67
|
},
|
|
70
|
-
/**
|
|
71
|
-
* The `FloatingTabBar` active pill: `--default` in light (it shows on the
|
|
72
|
-
* near-white glass bar) and `--segment` in dark. Its own key, so an app that
|
|
73
|
-
* themes `segment` for the segmented `Tabs` thumb keeps a pill that shows on
|
|
74
|
-
* the dark glass bar.
|
|
75
|
-
*/
|
|
76
68
|
tabBarPill: {
|
|
77
69
|
light: "#ebebeb",
|
|
78
70
|
dark: "#474747"
|
|
@@ -89,12 +81,10 @@ export const palette = {
|
|
|
89
81
|
light: "rgba(0, 0, 0, 0.5)",
|
|
90
82
|
dark: "rgba(0, 0, 0, 0.6)"
|
|
91
83
|
},
|
|
92
|
-
/** Web `DialogDescription` text: `--overlay-foreground` mixed 72% into `--overlay` (oklch), for 4.5:1 on the overlay. */
|
|
93
84
|
overlayMuted: {
|
|
94
85
|
light: "#505050",
|
|
95
86
|
dark: "#b5b5b5"
|
|
96
87
|
},
|
|
97
|
-
/** Fill of the web destructive `Button` (`oklch(47.2% 0.195 25.7)`), the same in both schemes. */
|
|
98
88
|
destructive: "#af0015"
|
|
99
89
|
};
|
|
100
90
|
/** `#rrggbb` with an alpha, as `rgba(...)`. For tints such as the badge fills (web `bg-danger/12`). */
|
|
@@ -33,8 +33,6 @@ const buttonVariants = cva(cn("group flex-row items-center justify-center gap-2
|
|
|
33
33
|
lg: "h-11 px-6",
|
|
34
34
|
icon: "h-10 w-10"
|
|
35
35
|
},
|
|
36
|
-
// The web `shape`: `pill` (default) is fully round, `rounded` the radius
|
|
37
|
-
// before 0.6.0. `Button` also sets the radius as a style, which wins.
|
|
38
36
|
shape: {
|
|
39
37
|
pill: "rounded-full",
|
|
40
38
|
rounded: "rounded-lg"
|
|
@@ -46,9 +44,6 @@ const buttonVariants = cva(cn("group flex-row items-center justify-center gap-2
|
|
|
46
44
|
shape: "pill"
|
|
47
45
|
}
|
|
48
46
|
});
|
|
49
|
-
|
|
50
|
-
// No weight: a class context cannot carry the `typeStyle` that a face class
|
|
51
|
-
// needs, so `Button` sets the medium face and its weight on its label.
|
|
52
47
|
const buttonTextVariants = cva("text-sm text-foreground", {
|
|
53
48
|
variants: {
|
|
54
49
|
variant: {
|
|
@@ -3,18 +3,6 @@ import { Platform } from "react-native";
|
|
|
3
3
|
import { KeyboardAvoidingView, KeyboardChatScrollView, KeyboardGestureArea, KeyboardStickyView, useKeyboardHandler } from "react-native-keyboard-controller";
|
|
4
4
|
import { runOnJS } from "react-native-reanimated";
|
|
5
5
|
import { COMPOSER_INPUT_ID, KeyboardPartsContext } from "./keyboard-parts";
|
|
6
|
-
|
|
7
|
-
// The keyboard parts on `react-native-keyboard-controller`: the keyboard's
|
|
8
|
-
// real position, frame by frame, on the UI thread. No timing of our own, so
|
|
9
|
-
// the composer can neither lag nor lead the keyboard; with Reduce Motion the
|
|
10
|
-
// system shortens the keyboard's own motion and the parts follow it.
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* A drag moves the keyboard on iOS (`keyboardDismissMode="interactive"`) and
|
|
14
|
-
* on Android 11+ (API 30, `WindowInsetsAnimation`). Android 10 and below has
|
|
15
|
-
* no interactive keyboard: `KeyboardGestureArea` then only renders its
|
|
16
|
-
* children, and the transcript keeps `on-drag`.
|
|
17
|
-
*/
|
|
18
6
|
const INTERACTIVE = Platform.OS === "ios" || Platform.OS === "android" && Number(Platform.Version) >= 30;
|
|
19
7
|
function AvoidingView(props) {
|
|
20
8
|
const $ = _c(2);
|
|
@@ -65,16 +53,6 @@ function StickyView(t0) {
|
|
|
65
53
|
}
|
|
66
54
|
return t2;
|
|
67
55
|
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* `always`: the content rises with the keyboard wherever the reader is, so
|
|
71
|
-
* what sat on the composer stays there (the newest message, at the end).
|
|
72
|
-
* Inverted, the keyboard's space is the content's top inset, the visual
|
|
73
|
-
* bottom: iOS scrolls below offset 0 into it, so the end moves there; Android
|
|
74
|
-
* moves the content down by it instead, so offset 0 stays the end. While the
|
|
75
|
-
* keyboard moves, the list scrolls with it, through offsets that are not the
|
|
76
|
-
* end on either platform.
|
|
77
|
-
*/
|
|
78
56
|
function ChatScrollView(t0) {
|
|
79
57
|
const $ = _c(19);
|
|
80
58
|
let bottomOffset;
|
|
@@ -156,11 +134,6 @@ function ChatScrollView(t0) {
|
|
|
156
134
|
}
|
|
157
135
|
return t6;
|
|
158
136
|
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* `ios`: the keyboard follows once the finger reaches the composer, then 1:1,
|
|
162
|
-
* and a release carries the finger's velocity, on both platforms.
|
|
163
|
-
*/
|
|
164
137
|
function GestureArea(t0) {
|
|
165
138
|
const $ = _c(4);
|
|
166
139
|
const {
|
|
@@ -2,11 +2,6 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
2
2
|
import { Platform, View } from "react-native";
|
|
3
3
|
import Animated from "react-native-reanimated";
|
|
4
4
|
import { useReduceMotion } from "../useReduceMotion";
|
|
5
|
-
/**
|
|
6
|
-
* `Animated.View` with layout animations on iOS and Android, a plain `View`
|
|
7
|
-
* on web. With Reduce Motion on, it drops the animations: sheets, toasts and
|
|
8
|
-
* the `Select` popover appear and leave in place.
|
|
9
|
-
*/
|
|
10
5
|
function NativeOnlyAnimatedView(t0) {
|
|
11
6
|
const $ = _c(15);
|
|
12
7
|
let children;
|
|
@@ -6,19 +6,11 @@ import { selectionHaptic } from "../haptics";
|
|
|
6
6
|
import { InsidePagerContext } from "../Pager";
|
|
7
7
|
import { PAGER_ACTIVE_OFFSET_X, PAGER_FAIL_OFFSET_Y, pagerPosition, pagerSettle, pagesBetween } from "../pagerSwipe";
|
|
8
8
|
import { useWebClickGuard } from "./web-click-guard";
|
|
9
|
-
|
|
10
|
-
// The pager on Gesture Handler: the track phase and the release run as
|
|
11
|
-
// worklets on the UI thread, so the pages never lag the finger. The rules are
|
|
12
|
-
// plain worklets in `pagerSwipe`.
|
|
13
|
-
|
|
14
|
-
/** The release: springs on at the finger's speed, no bounce (an overshoot would flash the next page's edge). */
|
|
15
9
|
const PAGER_SPRING = {
|
|
16
10
|
duration: 250,
|
|
17
11
|
dampingRatio: 1,
|
|
18
12
|
reduceMotion: ReduceMotion.System
|
|
19
13
|
};
|
|
20
|
-
|
|
21
|
-
/** A page set from outside (a tab press) slides there; at once with Reduce Motion. */
|
|
22
14
|
const PAGER_SLIDE = {
|
|
23
15
|
duration: 220,
|
|
24
16
|
reduceMotion: ReduceMotion.System
|
|
@@ -31,21 +23,15 @@ export function GesturePager({
|
|
|
31
23
|
renderPage
|
|
32
24
|
}) {
|
|
33
25
|
const width = useSharedValue(0);
|
|
34
|
-
// Where the pages were when the finger caught them, and the finger's travel then.
|
|
35
26
|
const start = useSharedValue(0);
|
|
36
27
|
const startX = useSharedValue(0);
|
|
37
28
|
const [mounted, setMounted] = useState(() => new Set([index]));
|
|
38
29
|
const [shown, setShown] = useState(index);
|
|
39
|
-
// A page reached from outside is drawn from then on, with every page the
|
|
40
|
-
// slide there passes, so it never crosses a blank page.
|
|
41
30
|
if (shown !== index) {
|
|
42
31
|
setShown(index);
|
|
43
32
|
setMounted(new Set([...mounted, ...pagesBetween(shown, index)]));
|
|
44
33
|
}
|
|
45
|
-
// The page a swipe settled on, until the new `index` comes back: that one must not stop the spring.
|
|
46
34
|
const settling = useRef(null);
|
|
47
|
-
// A page set from outside slides there. An effect: a shared value is never
|
|
48
|
-
// written in render.
|
|
49
35
|
useEffect(() => {
|
|
50
36
|
const fromSwipe = settling.current === index;
|
|
51
37
|
settling.current = null;
|
|
@@ -55,7 +41,6 @@ export function GesturePager({
|
|
|
55
41
|
const webClicks = useWebClickGuard();
|
|
56
42
|
const dragStarted = () => {
|
|
57
43
|
webClicks.swallowNext();
|
|
58
|
-
// Both neighbours, so the finger finds a page there.
|
|
59
44
|
setMounted(current => new Set([...current, index - 1, index + 1].filter(page => page >= 0 && page < count)));
|
|
60
45
|
};
|
|
61
46
|
const settled = page_0 => {
|
|
@@ -63,25 +48,16 @@ export function GesturePager({
|
|
|
63
48
|
selectionHaptic();
|
|
64
49
|
onIndexChange(page_0);
|
|
65
50
|
};
|
|
66
|
-
|
|
67
|
-
// Built on each render (for `index` and `count`): the detector keeps the
|
|
68
|
-
// same handler, and a drag in flight, and only takes the new config.
|
|
69
|
-
const pan = Gesture.Pan().enabled(count > 1)
|
|
70
|
-
// Clearly sideways only: a vertical drag is the page's scroll, and a row swipe starts sooner.
|
|
71
|
-
.activeOffsetX([-PAGER_ACTIVE_OFFSET_X, PAGER_ACTIVE_OFFSET_X]).failOffsetY([-PAGER_FAIL_OFFSET_Y, PAGER_FAIL_OFFSET_Y]).onStart(event => {
|
|
51
|
+
const pan = Gesture.Pan().enabled(count > 1).activeOffsetX([-PAGER_ACTIVE_OFFSET_X, PAGER_ACTIVE_OFFSET_X]).failOffsetY([-PAGER_FAIL_OFFSET_Y, PAGER_FAIL_OFFSET_Y]).onStart(event => {
|
|
72
52
|
cancelAnimation(progress);
|
|
73
53
|
start.set(progress.get());
|
|
74
|
-
// Count from here, so the pages do not jump by the slop the drag needed to start.
|
|
75
54
|
startX.set(event.translationX);
|
|
76
55
|
runOnJS(dragStarted)();
|
|
77
|
-
})
|
|
78
|
-
// Track phase: one shared value write per frame, on the UI thread.
|
|
79
|
-
.onUpdate(event_0 => {
|
|
56
|
+
}).onUpdate(event_0 => {
|
|
80
57
|
progress.set(pagerPosition(start.get(), event_0.translationX - startX.get(), width.get(), count));
|
|
81
58
|
}).onEnd(event_1 => {
|
|
82
59
|
const pageWidth = width.get();
|
|
83
60
|
const target = pagerSettle(progress.get(), event_1.velocityX, pageWidth, Math.round(start.get()), count);
|
|
84
|
-
// The finger's speed in pages per second, the unit of `progress`.
|
|
85
61
|
const velocity = pageWidth > 0 ? -event_1.velocityX / pageWidth : 0;
|
|
86
62
|
progress.set(withSpring(target, {
|
|
87
63
|
...PAGER_SPRING,
|
|
@@ -103,9 +79,7 @@ export function GesturePager({
|
|
|
103
79
|
<View ref={webClicks.ref} style={styles.track}>
|
|
104
80
|
{Array.from({
|
|
105
81
|
length: count
|
|
106
|
-
}, (_, page_1) => <View key={page_1}
|
|
107
|
-
// Off-screen pages are hidden from screen readers; the tabs above switch pages for them.
|
|
108
|
-
accessibilityElementsHidden={page_1 !== index} importantForAccessibility={page_1 === index ? "auto" : "no-hide-descendants"} style={{
|
|
82
|
+
}, (_, page_1) => <View key={page_1} accessibilityElementsHidden={page_1 !== index} importantForAccessibility={page_1 === index ? "auto" : "no-hide-descendants"} style={{
|
|
109
83
|
width: `${100 / count}%`
|
|
110
84
|
}}>
|
|
111
85
|
{mounted.has(page_1) ? renderPage(page_1) : null}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { TextInputWrapper } from "expo-paste-input";
|
|
3
3
|
import { PastePartsContext } from "./paste-parts";
|
|
4
|
-
|
|
5
|
-
// The image paste on `expo-paste-input`: on Android an `OnReceiveContentListener`
|
|
6
|
-
// on the wrapped field (Paste, and the keyboard's image insert), on iOS the
|
|
7
|
-
// field's `paste(_:)` and keyboard stickers. Text paste stays the field's own.
|
|
8
|
-
|
|
9
4
|
const Target = t0 => {
|
|
10
5
|
const $ = _c(6);
|
|
11
6
|
const {
|
|
@@ -154,7 +154,6 @@ const SelectTrigger = React.forwardRef((t0, ref) => {
|
|
|
154
154
|
}
|
|
155
155
|
return t8;
|
|
156
156
|
});
|
|
157
|
-
/** The popover fades in and out on the strong ease-out. */
|
|
158
157
|
const SELECT_ENTER = FadeIn.duration(150).easing(EASE_OUT);
|
|
159
158
|
const SELECT_EXIT = FadeOut.duration(100).easing(EASE_OUT);
|
|
160
159
|
const SelectContent = React.forwardRef((t0, ref) => {
|
|
@@ -331,13 +330,6 @@ const SelectLabel = React.forwardRef((t0, ref) => {
|
|
|
331
330
|
}
|
|
332
331
|
return t2;
|
|
333
332
|
});
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* On web `SelectPrimitive.Item` passes these props to a Radix DOM node, not a
|
|
337
|
-
* React Native view, so give it `aria-label` and `data-testid` there, not
|
|
338
|
-
* `accessibilityLabel` or `testID` (`selectItemA11yProps`).
|
|
339
|
-
*/
|
|
340
|
-
|
|
341
333
|
const SelectItem = React.forwardRef((t0, ref) => {
|
|
342
334
|
const $ = _c(22);
|
|
343
335
|
let className;
|
|
@@ -306,8 +306,6 @@ export function SheetMotionView(t0) {
|
|
|
306
306
|
}
|
|
307
307
|
return t3;
|
|
308
308
|
}
|
|
309
|
-
|
|
310
|
-
/** The drag on the JavaScript thread, for an app without `react-native-gesture-handler`. */
|
|
311
309
|
function PanResponderDragView(t0) {
|
|
312
310
|
const $ = _c(7);
|
|
313
311
|
const {
|
|
@@ -411,7 +409,6 @@ export function settleSheet(drag, position, vy, mayDismiss) {
|
|
|
411
409
|
drag.offset.set(withSpring(0, {
|
|
412
410
|
...SHEET_SNAP_SPRING,
|
|
413
411
|
velocity: sheetSnapVelocity(position, velocity),
|
|
414
|
-
// Bounce, but never so far up that the bottom edge lifts off the screen.
|
|
415
412
|
clamp: {
|
|
416
413
|
min: -SHEET_OVERPULL
|
|
417
414
|
}
|
|
@@ -14,14 +14,6 @@ import { ZoomImageContext } from "../media/zoomImage";
|
|
|
14
14
|
import { ZOOM_IMAGE_PARTS } from "../media/zoom-image-gesture";
|
|
15
15
|
import { GestureSwipeableRow } from "./swipe-row-gesture";
|
|
16
16
|
import { GestureToastDrag } from "./toast-drag-gesture";
|
|
17
|
-
|
|
18
|
-
// The sheet drag on Gesture Handler: the touch, the track phase and the
|
|
19
|
-
// release all run as worklets on the UI thread, so a busy JavaScript thread
|
|
20
|
-
// (a reply streaming in behind the sheet) cannot make the sheet lag the
|
|
21
|
-
// finger. The rules are the same as the `PanResponder` drag's (`sheet-drag`).
|
|
22
|
-
|
|
23
|
-
/** What a body inside the sheet needs from the drag around it. */
|
|
24
|
-
|
|
25
17
|
const SheetScrollLinkContext = createContext(null);
|
|
26
18
|
function motionOf(drag) {
|
|
27
19
|
return {
|
|
@@ -11,19 +11,11 @@ import { closeSwipeRows, isSwipeRowOpen, markSwipeRowClosed, markSwipeRowOpen, S
|
|
|
11
11
|
import { tokens } from "../tokens";
|
|
12
12
|
import { useScheme } from "../useScheme";
|
|
13
13
|
import { useWebClickGuard } from "./web-click-guard";
|
|
14
|
-
|
|
15
|
-
// The swipeable row on Gesture Handler: the track phase and the release run
|
|
16
|
-
// as worklets on the UI thread, so the row never lags the finger. The rules
|
|
17
|
-
// are plain worklets in `swipeRow`.
|
|
18
|
-
|
|
19
|
-
/** The release: springs on at the finger's speed, no bounce (a row overshooting rest would flash the other side). */
|
|
20
14
|
const ROW_SPRING = {
|
|
21
15
|
duration: 250,
|
|
22
16
|
dampingRatio: 1,
|
|
23
17
|
reduceMotion: ReduceMotion.System
|
|
24
18
|
};
|
|
25
|
-
|
|
26
|
-
/** The armed full swipe: the first action's icon grows a little, with the haptic, so the commit shows without it. */
|
|
27
19
|
const ARMED_SCALE = 1.15;
|
|
28
20
|
const ARMED_TIMING = {
|
|
29
21
|
duration: 150,
|
|
@@ -31,8 +23,6 @@ const ARMED_TIMING = {
|
|
|
31
23
|
reduceMotion: ReduceMotion.System
|
|
32
24
|
};
|
|
33
25
|
const ICON_SIZE = 20;
|
|
34
|
-
|
|
35
|
-
/** Each tone's fill and the icon colour on it. */
|
|
36
26
|
const TONES = {
|
|
37
27
|
default: {
|
|
38
28
|
fill: palette.primary,
|
|
@@ -57,12 +47,10 @@ export function GestureSwipeableRow({
|
|
|
57
47
|
const scheme = useScheme();
|
|
58
48
|
const x = useSharedValue(0);
|
|
59
49
|
const width = useSharedValue(0);
|
|
60
|
-
// Where the row was when the finger caught it.
|
|
61
50
|
const start = useSharedValue(0);
|
|
62
51
|
const dragging = useSharedValue(false);
|
|
63
52
|
const armed = useSharedValue(null);
|
|
64
53
|
const armedScale = useSharedValue(1);
|
|
65
|
-
// Plain values for the worklets: they must not capture the actions' functions.
|
|
66
54
|
const leading = leadingActions.length * SWIPE_ACTION_WIDTH;
|
|
67
55
|
const trailing = trailingActions.length * SWIPE_ACTION_WIDTH;
|
|
68
56
|
const leadingExits = leadingActions[0]?.exits === true;
|
|
@@ -70,13 +58,7 @@ export function GestureSwipeableRow({
|
|
|
70
58
|
const [handle] = useState(() => ({
|
|
71
59
|
close: () => x.set(withSpring(0, ROW_SPRING))
|
|
72
60
|
}));
|
|
73
|
-
|
|
74
|
-
// Whether this touch began while a row was open, so its release only closes that row. Nothing renders from it.
|
|
75
61
|
const closesOnRelease = useRef(false);
|
|
76
|
-
// The action strips mount on the row's first touch, not with the row: a
|
|
77
|
-
// list of a hundred rows then mounts no hidden buttons and icons up front.
|
|
78
|
-
// A touch lands a few frames before a swipe can move the row, so the strip
|
|
79
|
-
// is there before any of it shows.
|
|
80
62
|
const [revealed, setRevealed] = useState(false);
|
|
81
63
|
const reveal = () => setRevealed(true);
|
|
82
64
|
const webClicks = useWebClickGuard(isSwipeRowOpen);
|
|
@@ -88,15 +70,12 @@ export function GestureSwipeableRow({
|
|
|
88
70
|
};
|
|
89
71
|
const closed = () => markSwipeRowClosed(handle);
|
|
90
72
|
const firstOf = side => side === "leading" ? leadingActions[0] : trailingActions[0];
|
|
91
|
-
/** Runs an action once the row slid out: if it fails, the row comes back. */
|
|
92
73
|
const runExited = action => {
|
|
93
74
|
const result = action?.onPress();
|
|
94
75
|
if (result instanceof Promise) result.catch(() => x.set(withSpring(0, ROW_SPRING)));
|
|
95
76
|
};
|
|
96
|
-
// The worklets take sides, never the actions (their functions stay on the JavaScript thread).
|
|
97
77
|
const runFirstExited = side_0 => runExited(firstOf(side_0));
|
|
98
78
|
const runFirstInPlace = side_1 => void firstOf(side_1)?.onPress();
|
|
99
|
-
/** A tapped button: the row closes, or slides out for an action that exits, then the action runs. */
|
|
100
79
|
const press = (action_0, side_2) => {
|
|
101
80
|
closed();
|
|
102
81
|
if (!action_0.exits) {
|
|
@@ -114,9 +93,6 @@ export function GestureSwipeableRow({
|
|
|
114
93
|
if (finished) runOnJS(run)();
|
|
115
94
|
}));
|
|
116
95
|
};
|
|
117
|
-
|
|
118
|
-
// The full swipe arms and disarms as the row crosses the point: the icon
|
|
119
|
-
// grows, and a light haptic fires as it arms under the finger.
|
|
120
96
|
useAnimatedReaction(() => swipeRowArmed(x.get(), {
|
|
121
97
|
leading,
|
|
122
98
|
trailing,
|
|
@@ -127,16 +103,11 @@ export function GestureSwipeableRow({
|
|
|
127
103
|
armedScale.set(withTiming(side_3 ? ARMED_SCALE : 1, ARMED_TIMING));
|
|
128
104
|
if (side_3 && dragging.get()) runOnJS(impactHaptic)("light");
|
|
129
105
|
}, [leading, trailing]);
|
|
130
|
-
|
|
131
|
-
// Built on each render (for `enabled` and the actions): the detector keeps
|
|
132
|
-
// the same handler, and a drag in flight, and only takes the new config.
|
|
133
106
|
const activation = swipeRowActivation({
|
|
134
107
|
leading,
|
|
135
108
|
trailing
|
|
136
109
|
}, insidePager);
|
|
137
|
-
const pan = Gesture.Pan().enabled(enabled && leading + trailing > 0)
|
|
138
|
-
// Sideways intent first; a drag that goes vertical first is the list's scroll.
|
|
139
|
-
.activeOffsetX(activation.activeOffsetX).failOffsetY([-SWIPE_FAIL_OFFSET_Y, SWIPE_FAIL_OFFSET_Y]);
|
|
110
|
+
const pan = Gesture.Pan().enabled(enabled && leading + trailing > 0).activeOffsetX(activation.activeOffsetX).failOffsetY([-SWIPE_FAIL_OFFSET_Y, SWIPE_FAIL_OFFSET_Y]);
|
|
140
111
|
if (activation.failOffsetX !== undefined) pan.failOffsetX(activation.failOffsetX);
|
|
141
112
|
pan.onBegin(() => {
|
|
142
113
|
runOnJS(reveal)();
|
|
@@ -145,9 +116,7 @@ export function GestureSwipeableRow({
|
|
|
145
116
|
start.set(x.get());
|
|
146
117
|
dragging.set(true);
|
|
147
118
|
runOnJS(opened)();
|
|
148
|
-
})
|
|
149
|
-
// Track phase: one shared value write per frame, on the UI thread.
|
|
150
|
-
.onUpdate(event => {
|
|
119
|
+
}).onUpdate(event => {
|
|
151
120
|
x.set(swipeRowOffset(start.get() + event.translationX, {
|
|
152
121
|
leading,
|
|
153
122
|
trailing,
|
|
@@ -163,7 +132,6 @@ export function GestureSwipeableRow({
|
|
|
163
132
|
});
|
|
164
133
|
const velocity = event_0.velocityX;
|
|
165
134
|
if (success && settle.kind === "commit") {
|
|
166
|
-
// Armed by the fling rather than the position: the haptic fires now, with the commit.
|
|
167
135
|
if (armed.get() === null) runOnJS(impactHaptic)("light");
|
|
168
136
|
runOnJS(closed)();
|
|
169
137
|
const side_4 = settle.side;
|
|
@@ -213,10 +181,7 @@ export function GestureSwipeableRow({
|
|
|
213
181
|
<Animated.View style={[{
|
|
214
182
|
backgroundColor: backgroundColor ?? tokens.color.background[scheme]
|
|
215
183
|
}, rowStyle]}>
|
|
216
|
-
<View ref={webClicks.ref}
|
|
217
|
-
// While a row is open, a tap on any row only closes it: the row
|
|
218
|
-
// takes the touch from the pressables inside.
|
|
219
|
-
onStartShouldSetResponderCapture={() => {
|
|
184
|
+
<View ref={webClicks.ref} onStartShouldSetResponderCapture={() => {
|
|
220
185
|
closesOnRelease.current = isSwipeRowOpen();
|
|
221
186
|
return closesOnRelease.current;
|
|
222
187
|
}} onResponderRelease={() => {
|
|
@@ -228,13 +193,6 @@ export function GestureSwipeableRow({
|
|
|
228
193
|
</GestureDetector>
|
|
229
194
|
</View>;
|
|
230
195
|
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* One side's actions behind the row, the first at the screen edge, on the
|
|
234
|
-
* first action's fill (which stretches with a full swipe). Shown only while
|
|
235
|
-
* the row moves toward that side. Hidden from screen readers: they reach the
|
|
236
|
-
* actions on the row itself (`swipeActionsAccessibility`).
|
|
237
|
-
*/
|
|
238
196
|
function ActionStrip(t0) {
|
|
239
197
|
const $ = _c(22);
|
|
240
198
|
const {
|
package/dist/primitives/text.jsx
CHANGED
|
@@ -54,11 +54,6 @@ const ARIA_LEVEL = {
|
|
|
54
54
|
h3: "3",
|
|
55
55
|
h4: "4"
|
|
56
56
|
};
|
|
57
|
-
|
|
58
|
-
// The weight of each variant's `font-instrument-sans-*` class, set as a style
|
|
59
|
-
// beside it (`typeStyle`): where an app maps every one of those classes to one
|
|
60
|
-
// family, the class alone draws Regular. Headings are semibold, as the web
|
|
61
|
-
// titles; `h1` was `font-medium` before 0.3.13.
|
|
62
57
|
const WEIGHT = {
|
|
63
58
|
h1: typeStyle("medium"),
|
|
64
59
|
h2: typeStyle("medium"),
|
|
@@ -4,18 +4,12 @@ import Animated, { cancelAnimation, interpolate, ReduceMotion, runOnJS, useAnima
|
|
|
4
4
|
import { impactHaptic } from "../haptics";
|
|
5
5
|
import { TOAST_DRAG_ACTIVE_OFFSET_Y, toastDragDismisses, toastDragOffset } from "../toastDrag";
|
|
6
6
|
import { useWebClickGuard } from "./web-click-guard";
|
|
7
|
-
|
|
8
|
-
// The toast drag on Gesture Handler: the track phase and the release run as
|
|
9
|
-
// worklets on the UI thread. The rules are plain worklets in `toastDrag`.
|
|
10
|
-
|
|
11
|
-
/** Back home after a short drag: critically damped, no bounce. */
|
|
12
7
|
const HOME_SPRING = {
|
|
13
8
|
duration: 250,
|
|
14
9
|
dampingRatio: 1,
|
|
15
10
|
overshootClamping: true,
|
|
16
11
|
reduceMotion: ReduceMotion.System
|
|
17
12
|
};
|
|
18
|
-
/** Away up the screen: no overshoot back into view. */
|
|
19
13
|
const AWAY_SPRING = {
|
|
20
14
|
duration: 250,
|
|
21
15
|
dampingRatio: 1,
|
|
@@ -29,7 +23,6 @@ export function GestureToastDrag({
|
|
|
29
23
|
}) {
|
|
30
24
|
const y = useSharedValue(0);
|
|
31
25
|
const height = useSharedValue(0);
|
|
32
|
-
// Where the toast was when the finger caught it, and the finger's travel then.
|
|
33
26
|
const start = useSharedValue(0);
|
|
34
27
|
const startY = useSharedValue(0);
|
|
35
28
|
const webClicks = useWebClickGuard();
|
|
@@ -37,26 +30,18 @@ export function GestureToastDrag({
|
|
|
37
30
|
impactHaptic("light");
|
|
38
31
|
onDismiss();
|
|
39
32
|
};
|
|
40
|
-
|
|
41
|
-
// Built on each render: the detector keeps the same handler, and a drag in flight.
|
|
42
|
-
const pan = Gesture.Pan().activeOffsetY([-TOAST_DRAG_ACTIVE_OFFSET_Y, TOAST_DRAG_ACTIVE_OFFSET_Y])
|
|
43
|
-
// The timer holds from the touch, a tap included (a tap closes the toast anyway).
|
|
44
|
-
.onBegin(() => {
|
|
33
|
+
const pan = Gesture.Pan().activeOffsetY([-TOAST_DRAG_ACTIVE_OFFSET_Y, TOAST_DRAG_ACTIVE_OFFSET_Y]).onBegin(() => {
|
|
45
34
|
runOnJS(onHoldChange)(true);
|
|
46
35
|
}).onStart(event => {
|
|
47
36
|
cancelAnimation(y);
|
|
48
37
|
start.set(y.get());
|
|
49
|
-
// Count from here, so the toast does not jump by the slop the drag needed to start.
|
|
50
38
|
startY.set(event.translationY);
|
|
51
39
|
runOnJS(webClicks.swallowNext)();
|
|
52
|
-
})
|
|
53
|
-
// Track phase: one shared value write per frame, on the UI thread.
|
|
54
|
-
.onUpdate(event_0 => {
|
|
40
|
+
}).onUpdate(event_0 => {
|
|
55
41
|
y.set(toastDragOffset(start.get() + event_0.translationY - startY.get()));
|
|
56
42
|
}).onEnd(event_1 => {
|
|
57
43
|
const position = y.get();
|
|
58
44
|
if (toastDragDismisses(position, event_1.velocityY, height.get())) {
|
|
59
|
-
// Up past its own height, fading on the way (`toastStyle`), at the finger's speed.
|
|
60
45
|
y.set(withSpring(-height.get() * 1.5, {
|
|
61
46
|
...AWAY_SPRING,
|
|
62
47
|
velocity: event_1.velocityY
|
|
@@ -74,22 +59,17 @@ export function GestureToastDrag({
|
|
|
74
59
|
}).onFinalize(() => {
|
|
75
60
|
runOnJS(onHoldChange)(false);
|
|
76
61
|
});
|
|
77
|
-
|
|
78
|
-
// Linked to the same value: the toast fades as it rises, gone one height up.
|
|
79
62
|
const toastStyle = useAnimatedStyle(() => ({
|
|
80
63
|
opacity: height.get() > 0 ? interpolate(y.get(), [-height.get(), 0], [0, 1], "clamp") : 1,
|
|
81
64
|
transform: [{
|
|
82
65
|
translateY: y.get()
|
|
83
66
|
}]
|
|
84
67
|
}));
|
|
85
|
-
return
|
|
86
|
-
// Its own root: on iOS the toasts draw in a separate window (`FullWindowOverlay`).
|
|
87
|
-
<GestureHandlerRootView>
|
|
68
|
+
return <GestureHandlerRootView>
|
|
88
69
|
<GestureDetector gesture={pan}>
|
|
89
70
|
<Animated.View style={toastStyle} onLayout={event_2 => height.set(event_2.nativeEvent.layout.height)}>
|
|
90
71
|
<View ref={webClicks.ref}>{children}</View>
|
|
91
72
|
</Animated.View>
|
|
92
73
|
</GestureDetector>
|
|
93
|
-
</GestureHandlerRootView
|
|
94
|
-
);
|
|
74
|
+
</GestureHandlerRootView>;
|
|
95
75
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { useRef } from "react";
|
|
3
3
|
import { Platform } from "react-native";
|
|
4
|
-
|
|
5
|
-
/** The part of a DOM element the web click guard uses: on the web a `View` is a DOM element. */
|
|
6
|
-
|
|
7
4
|
function isDomNode(node) {
|
|
8
5
|
return "addEventListener" in node && typeof node.addEventListener === "function";
|
|
9
6
|
}
|
|
@@ -3,14 +3,6 @@ import { useId, useLayoutEffect, useSyncExternalStore } from "react";
|
|
|
3
3
|
import { BackHandler, Modal, StyleSheet, View } from "react-native";
|
|
4
4
|
import Animated, { FadeIn, FadeOut } from "react-native-reanimated";
|
|
5
5
|
import { useReduceMotion } from "../useReduceMotion";
|
|
6
|
-
|
|
7
|
-
// Overlays drawn in the app's own window. A React Native `Modal` is a window
|
|
8
|
-
// of its own on Android: it takes the focus as it opens and hands it back as
|
|
9
|
-
// it closes, and each time `react-native-keyboard-controller`'s chat list
|
|
10
|
-
// scrolls to its newest message. A layer in `WindowLayerHost` is a view over
|
|
11
|
-
// the app instead, so the focus never moves. Without a host, `WindowLayer`
|
|
12
|
-
// falls back to a `Modal`, so an app that mounts none keeps working.
|
|
13
|
-
|
|
14
6
|
const EMPTY = [];
|
|
15
7
|
let layers = EMPTY;
|
|
16
8
|
let hosts = 0;
|
|
@@ -29,8 +21,6 @@ const upsert = layer => {
|
|
|
29
21
|
layers = at === -1 ? [...layers, layer] : layers.map((item, index) => index === at ? layer : item);
|
|
30
22
|
emit();
|
|
31
23
|
};
|
|
32
|
-
|
|
33
|
-
// Layers that have called `onShow` once, as a Modal does once per opening.
|
|
34
24
|
const announced = new Set();
|
|
35
25
|
const showOnce = layer => {
|
|
36
26
|
if (announced.has(layer.id)) return;
|
|
@@ -43,16 +33,12 @@ const remove = id => {
|
|
|
43
33
|
layers = layers.filter(item => item.id !== id);
|
|
44
34
|
emit();
|
|
45
35
|
};
|
|
46
|
-
|
|
47
|
-
// Android back closes the newest layer, as a Modal's `onRequestClose`.
|
|
48
36
|
const onBack = () => {
|
|
49
37
|
const top = layers[layers.length - 1];
|
|
50
38
|
if (!top) return false;
|
|
51
39
|
top.onRequestClose();
|
|
52
40
|
return true;
|
|
53
41
|
};
|
|
54
|
-
|
|
55
|
-
/** Mounted: the host is there, and it answers Android back for its layers. */
|
|
56
42
|
const hostRef = view => {
|
|
57
43
|
if (view === null) return undefined;
|
|
58
44
|
hosts += 1;
|
package/dist/push.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef } from "react";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
|
-
|
|
4
|
-
// `expo-notifications`, `expo-constants` and `expo-device` are optional peers.
|
|
5
|
-
// Metro bundles a `require` placed directly in a `try` block as an optional
|
|
6
|
-
// dependency, so a missing peer does not break the bundle.
|
|
7
|
-
|
|
8
3
|
let notifications;
|
|
9
4
|
let constants;
|
|
10
5
|
let device;
|
|
@@ -77,7 +72,6 @@ export async function getExpoPushToken({
|
|
|
77
72
|
projectId
|
|
78
73
|
})).data;
|
|
79
74
|
} catch {
|
|
80
|
-
// No google-services.json in this build: FCM cannot issue a token.
|
|
81
75
|
return null;
|
|
82
76
|
}
|
|
83
77
|
}
|
package/dist/relativeTime.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
// The twin of `@vvedantb/ui`'s `formatCompactRelativeTime`
|
|
2
|
-
// (`ui/app/src/time/compactRelativeTime.ts`), which `RelativeDateTime` shows.
|
|
3
|
-
// The web file pulls no DOM, but the web package does, so this is a copy;
|
|
4
|
-
// tests/relativeTime.test.ts checks both give the same strings.
|
|
5
|
-
|
|
6
1
|
const MS_PER_MINUTE = 60_000;
|
|
7
2
|
const MS_PER_DAY = 86_400_000;
|
|
8
|
-
|
|
9
|
-
/** Rounds toward zero; `-0` becomes `0`. */
|
|
10
3
|
function truncate(n) {
|
|
11
4
|
return n < 0 ? Math.ceil(n) || 0 : Math.floor(n);
|
|
12
5
|
}
|
|
13
|
-
|
|
14
|
-
/** Local UTC offset in minutes, rounded to 15 minutes. */
|
|
15
6
|
function utcOffset(ms) {
|
|
16
7
|
return -Math.round(new Date(ms).getTimezoneOffset() / 15) * 15;
|
|
17
8
|
}
|
|
18
|
-
|
|
19
|
-
/** Adds calendar months in local time and clamps the day to the target month. */
|
|
20
9
|
function addMonths(ms, months) {
|
|
21
10
|
const date = new Date(ms);
|
|
22
11
|
const day = date.getDate();
|
|
@@ -26,8 +15,6 @@ function addMonths(ms, months) {
|
|
|
26
15
|
date.setDate(Math.min(day, daysInMonth));
|
|
27
16
|
return date.getTime();
|
|
28
17
|
}
|
|
29
|
-
|
|
30
|
-
/** Fractional calendar months from `a` to `b`, negated (the moment.js formula). */
|
|
31
18
|
function monthDiff(a, b) {
|
|
32
19
|
if (new Date(a).getDate() < new Date(b).getDate()) return -monthDiff(b, a);
|
|
33
20
|
const from = new Date(a);
|