@vvedantb/native-ui 0.37.2 → 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/README.md +8 -7
- 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/app-root/AuthGroupGate.jsx +65 -0
- package/dist/app-root/SsoCallbackScreen.jsx +97 -0
- package/dist/app-root/fonts.js +88 -0
- package/dist/app-root/index.js +3 -0
- package/dist/auth/AuthScreen.jsx +250 -77
- package/dist/auth/GoogleSignInButton.jsx +0 -3
- package/dist/auth/SecondFactorScreen.jsx +18 -14
- package/dist/auth/SignInScreen.jsx +40 -34
- 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/LastCrashDialog.jsx +56 -0
- package/dist/crash/lastCrash.js +192 -0
- package/dist/entries/ai.js +0 -3
- package/dist/entries/ambient.js +0 -2
- package/dist/entries/app-root.js +1 -0
- 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 +2 -0
- 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 +4 -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 +4 -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 +158 -0
- package/dist/pagerSwipe.js +0 -16
- package/dist/palette.js +0 -10
- package/dist/primitives/button.jsx +0 -5
- package/dist/primitives/icon.jsx +0 -4
- 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 -10
- 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 +2 -9
- 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 +62 -0
- package/dist/themeModes.js +9 -0
- 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 +47 -19
- 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 +38 -0
- package/src/app-root/SsoCallbackScreen.tsx +52 -0
- package/src/app-root/fonts.ts +53 -0
- package/src/app-root/index.ts +6 -0
- package/src/auth/AccountScreens.tsx +0 -16
- package/src/auth/AuthProviders.tsx +0 -13
- package/src/auth/AuthScreen.tsx +95 -6
- package/src/auth/GoogleSignInButton.tsx +0 -12
- package/src/auth/SecondFactorScreen.tsx +17 -15
- package/src/auth/SignInScreen.tsx +103 -105
- 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 +36 -0
- package/src/crash/lastCrash.ts +218 -0
- package/src/entries/ai.ts +0 -3
- package/src/entries/ambient.ts +0 -2
- package/src/entries/app-root.ts +1 -0
- 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 +13 -0
- 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 +8 -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 +1 -21
- package/src/index.ts +7 -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 +127 -0
- 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/icon.tsx +0 -2
- 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 -18
- 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 +2 -16
- 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 +85 -0
- package/src/themeModes.ts +10 -0
- 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/types/prism-react-renderer.d.ts +22 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { configureTheme } from "./configureTheme";
|
|
2
|
+
import { palette, withAlpha } from "./palette";
|
|
3
|
+
import { tokens } from "./tokens";
|
|
4
|
+
|
|
5
|
+
/** The web Neutral theme (`.dark.neutral` in `@vvedantb/ui` tokens.css), as hex. */
|
|
6
|
+
export const NEUTRAL_PALETTE = {
|
|
7
|
+
background: "#222325",
|
|
8
|
+
surface: "#303134",
|
|
9
|
+
surfaceSecondary: "#3a3b3e",
|
|
10
|
+
surfaceTertiary: "#444548",
|
|
11
|
+
border: "#4e4f52",
|
|
12
|
+
muted: "#9fa0a2",
|
|
13
|
+
foreground: "#fafafa"
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** The same colours as space-separated RGB channels, for NativeWind variables that take channels. */
|
|
17
|
+
export const NEUTRAL_CHANNELS = {
|
|
18
|
+
background: "34 35 37",
|
|
19
|
+
surface: "48 49 52",
|
|
20
|
+
surfaceSecondary: "58 59 62",
|
|
21
|
+
surfaceTertiary: "68 69 72",
|
|
22
|
+
border: "78 79 82",
|
|
23
|
+
muted: "159 160 162",
|
|
24
|
+
foreground: "250 250 250"
|
|
25
|
+
};
|
|
26
|
+
const DARK = {
|
|
27
|
+
color: {
|
|
28
|
+
background: tokens.color.background.dark,
|
|
29
|
+
foreground: tokens.color.foreground.dark,
|
|
30
|
+
muted: tokens.color.muted.dark,
|
|
31
|
+
border: tokens.color.border.dark,
|
|
32
|
+
separator: tokens.color.separator.dark,
|
|
33
|
+
surface: tokens.color.surface.dark,
|
|
34
|
+
surfaceSecondary: tokens.color.surfaceSecondary.dark,
|
|
35
|
+
surfaceCard: tokens.color.surfaceCard.dark,
|
|
36
|
+
fill: tokens.color.fill.dark
|
|
37
|
+
},
|
|
38
|
+
palette: {
|
|
39
|
+
default: palette.default.dark,
|
|
40
|
+
overlay: palette.overlay.dark,
|
|
41
|
+
segment: palette.segment.dark,
|
|
42
|
+
surfaceTertiary: palette.surfaceTertiary.dark,
|
|
43
|
+
fieldPlaceholder: palette.fieldPlaceholder.dark,
|
|
44
|
+
tabBarPill: palette.tabBarPill.dark
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const NEUTRAL = {
|
|
48
|
+
color: {
|
|
49
|
+
background: NEUTRAL_PALETTE.background,
|
|
50
|
+
foreground: NEUTRAL_PALETTE.foreground,
|
|
51
|
+
muted: NEUTRAL_PALETTE.muted,
|
|
52
|
+
border: NEUTRAL_PALETTE.border,
|
|
53
|
+
separator: NEUTRAL_PALETTE.surfaceSecondary,
|
|
54
|
+
surface: NEUTRAL_PALETTE.surface,
|
|
55
|
+
surfaceSecondary: NEUTRAL_PALETTE.surfaceSecondary,
|
|
56
|
+
surfaceCard: NEUTRAL_PALETTE.surface,
|
|
57
|
+
fill: withAlpha(NEUTRAL_PALETTE.surface, 0.88)
|
|
58
|
+
},
|
|
59
|
+
palette: {
|
|
60
|
+
default: NEUTRAL_PALETTE.surfaceTertiary,
|
|
61
|
+
overlay: NEUTRAL_PALETTE.surface,
|
|
62
|
+
segment: NEUTRAL_PALETTE.surfaceTertiary,
|
|
63
|
+
surfaceTertiary: NEUTRAL_PALETTE.surfaceTertiary,
|
|
64
|
+
fieldPlaceholder: NEUTRAL_PALETTE.muted,
|
|
65
|
+
tabBarPill: NEUTRAL_PALETTE.surfaceTertiary
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** Dark-slot colours that replace the ones `paintDarkFamily` would paint. */
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Puts the Dark or Neutral colours in the kit's dark slot (`configureTheme`).
|
|
73
|
+
* Light is not changed. Kit parts under `NativeUiProvider` redraw at once.
|
|
74
|
+
* Status and accent colours stay Dark's. `overrides` replaces any painted
|
|
75
|
+
* dark-slot colour, for an app that keeps its own value.
|
|
76
|
+
*/
|
|
77
|
+
export function paintDarkFamily(family, overrides) {
|
|
78
|
+
const base = family === "neutral" ? NEUTRAL : DARK;
|
|
79
|
+
const next = {
|
|
80
|
+
color: {
|
|
81
|
+
...base.color,
|
|
82
|
+
...overrides?.color
|
|
83
|
+
},
|
|
84
|
+
palette: {
|
|
85
|
+
...base.palette,
|
|
86
|
+
...overrides?.palette
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const {
|
|
90
|
+
color
|
|
91
|
+
} = tokens;
|
|
92
|
+
configureTheme({
|
|
93
|
+
color: {
|
|
94
|
+
background: {
|
|
95
|
+
light: color.background.light,
|
|
96
|
+
dark: next.color.background
|
|
97
|
+
},
|
|
98
|
+
foreground: {
|
|
99
|
+
light: color.foreground.light,
|
|
100
|
+
dark: next.color.foreground
|
|
101
|
+
},
|
|
102
|
+
muted: {
|
|
103
|
+
light: color.muted.light,
|
|
104
|
+
dark: next.color.muted
|
|
105
|
+
},
|
|
106
|
+
border: {
|
|
107
|
+
light: color.border.light,
|
|
108
|
+
dark: next.color.border
|
|
109
|
+
},
|
|
110
|
+
separator: {
|
|
111
|
+
light: color.separator.light,
|
|
112
|
+
dark: next.color.separator
|
|
113
|
+
},
|
|
114
|
+
surface: {
|
|
115
|
+
light: color.surface.light,
|
|
116
|
+
dark: next.color.surface
|
|
117
|
+
},
|
|
118
|
+
surfaceSecondary: {
|
|
119
|
+
light: color.surfaceSecondary.light,
|
|
120
|
+
dark: next.color.surfaceSecondary
|
|
121
|
+
},
|
|
122
|
+
surfaceCard: {
|
|
123
|
+
light: color.surfaceCard.light,
|
|
124
|
+
dark: next.color.surfaceCard
|
|
125
|
+
},
|
|
126
|
+
fill: {
|
|
127
|
+
light: color.fill.light,
|
|
128
|
+
dark: next.color.fill
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
palette: {
|
|
132
|
+
default: {
|
|
133
|
+
light: palette.default.light,
|
|
134
|
+
dark: next.palette.default
|
|
135
|
+
},
|
|
136
|
+
overlay: {
|
|
137
|
+
light: palette.overlay.light,
|
|
138
|
+
dark: next.palette.overlay
|
|
139
|
+
},
|
|
140
|
+
segment: {
|
|
141
|
+
light: palette.segment.light,
|
|
142
|
+
dark: next.palette.segment
|
|
143
|
+
},
|
|
144
|
+
surfaceTertiary: {
|
|
145
|
+
light: palette.surfaceTertiary.light,
|
|
146
|
+
dark: next.palette.surfaceTertiary
|
|
147
|
+
},
|
|
148
|
+
fieldPlaceholder: {
|
|
149
|
+
light: palette.fieldPlaceholder.light,
|
|
150
|
+
dark: next.palette.fieldPlaceholder
|
|
151
|
+
},
|
|
152
|
+
tabBarPill: {
|
|
153
|
+
light: palette.tabBarPill.light,
|
|
154
|
+
dark: next.palette.tabBarPill
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
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: {
|
package/dist/primitives/icon.jsx
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
// Tabler, not Lucide: a Lucide icon always sets `testID` on its `Svg`, which
|
|
5
|
-
// on web is a DOM `<svg>`, so React logs it as an unknown DOM prop.
|
|
6
|
-
|
|
7
3
|
function Icon(t0) {
|
|
8
4
|
const $ = _c(6);
|
|
9
5
|
let Component;
|
|
@@ -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 {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import * as SelectPrimitive from "@rn-primitives/select";
|
|
3
|
-
// Tabler, not Lucide: a Lucide icon always sets `testID` on its `Svg`, which
|
|
4
|
-
// on web is a DOM `<svg>`, so React logs it as an unknown DOM prop.
|
|
5
3
|
import { IconCheck, IconChevronDown, IconChevronUp } from "@tabler/icons-react-native";
|
|
6
4
|
import * as React from "react";
|
|
7
5
|
import { Platform, ScrollView, StyleSheet, Text, View } from "react-native";
|
|
@@ -156,7 +154,6 @@ const SelectTrigger = React.forwardRef((t0, ref) => {
|
|
|
156
154
|
}
|
|
157
155
|
return t8;
|
|
158
156
|
});
|
|
159
|
-
/** The popover fades in and out on the strong ease-out. */
|
|
160
157
|
const SELECT_ENTER = FadeIn.duration(150).easing(EASE_OUT);
|
|
161
158
|
const SELECT_EXIT = FadeOut.duration(100).easing(EASE_OUT);
|
|
162
159
|
const SelectContent = React.forwardRef((t0, ref) => {
|
|
@@ -333,13 +330,6 @@ const SelectLabel = React.forwardRef((t0, ref) => {
|
|
|
333
330
|
}
|
|
334
331
|
return t2;
|
|
335
332
|
});
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* On web `SelectPrimitive.Item` passes these props to a Radix DOM node, not a
|
|
339
|
-
* React Native view, so give it `aria-label` and `data-testid` there, not
|
|
340
|
-
* `accessibilityLabel` or `testID` (`selectItemA11yProps`).
|
|
341
|
-
*/
|
|
342
|
-
|
|
343
333
|
const SelectItem = React.forwardRef((t0, ref) => {
|
|
344
334
|
const $ = _c(22);
|
|
345
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"),
|