@vvedantb/native-ui 0.38.0 → 0.40.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 +2 -3
- 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 +10 -18
- 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 +2 -29
- 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 +2 -3
- 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 +5 -22
- 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 +1 -98
- 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
|
@@ -120,89 +120,34 @@ function secondFactorCopy(strategy: SecondFactorStrategy, clientTrust: boolean)
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
export type SignInScreenProps = AuthNavigationOptions & {
|
|
123
|
-
/**
|
|
124
|
-
* Default `"sign-in"`. `"sign-up"` creates the account and checks an emailed
|
|
125
|
-
* code. `"reset-password"` emails a code, checks it, then sets a new password
|
|
126
|
-
* and signs in.
|
|
127
|
-
*/
|
|
128
123
|
mode?: SignInMode;
|
|
129
|
-
/** Default "Welcome back", "Create account" in `sign-up`, or "Reset password" in `reset-password`. */
|
|
130
124
|
title?: string;
|
|
131
|
-
/** Default "Sign in to continue", "Sign up to get started" in `sign-up`, or the reset hint in `reset-password`. */
|
|
132
125
|
subtitle?: string;
|
|
133
|
-
/** The app URL scheme, such as `"vibot"`, for the Google redirect `scheme://sso-callback`. */
|
|
134
126
|
scheme: string;
|
|
135
|
-
/** Default `"sso-callback"`. */
|
|
136
127
|
redirectPath?: string;
|
|
137
|
-
/** Default `true`. */
|
|
138
128
|
showGoogle?: boolean;
|
|
139
|
-
/** Default "Continue with Google". */
|
|
140
129
|
googleLabel?: string;
|
|
141
|
-
/** In `sign-in`: the "Sign up" link in the footer. No link without it. */
|
|
142
130
|
signUpHref?: Href;
|
|
143
|
-
/** In `sign-up` and `reset-password`: the "Sign in" link in the footer. No link without it. */
|
|
144
131
|
signInHref?: Href;
|
|
145
|
-
/**
|
|
146
|
-
* In `sign-in`: the "Forgot password?" link under the password, to a route
|
|
147
|
-
* that renders `ResetPasswordScreen`. No link without it.
|
|
148
|
-
*/
|
|
149
132
|
forgotPasswordHref?: Href;
|
|
150
|
-
/** Sign-up and the new-password step reject a shorter password before sending it. Default: no check. */
|
|
151
133
|
minPasswordLength?: number;
|
|
152
|
-
/** Default `"toast"`. `"inline"` shows errors under the fields. */
|
|
153
134
|
errorDisplay?: "toast" | "inline";
|
|
154
|
-
/** Prefix for every `testID`: `sign-in-email`, `sign-in-password`, `sign-in-submit` and the rest. Default the mode. */
|
|
155
135
|
testIDPrefix?: string;
|
|
156
|
-
/**
|
|
157
|
-
* Optional map from suffix name (such as `email`, `password` or `code`) to a full `testID`.
|
|
158
|
-
* When set, the entry overrides the default `${testIDPrefix ?? mode}-${name}` for that
|
|
159
|
-
* name, for example `{ code: "sign-up-verify-code" }`. A name without an entry keeps the default.
|
|
160
|
-
*/
|
|
161
136
|
testIDs?: Partial<Record<string, string>>;
|
|
162
|
-
/** Above the title. App brand chrome goes here. */
|
|
163
137
|
header?: ReactNode;
|
|
164
|
-
/** Below the footer link row, such as an app credit. */
|
|
165
138
|
footer?: ReactNode;
|
|
166
|
-
/**
|
|
167
|
-
* Called with the sign-in when the built-in UI cannot finish it:
|
|
168
|
-
* `needs_identifier`, any unknown status, `needs_first_factor` when no
|
|
169
|
-
* `email_code` or `phone_code` first factor exists (with its id), and
|
|
170
|
-
* `needs_second_factor` or `needs_client_trust` when no supported strategy
|
|
171
|
-
* (totp, backup code, phone code, email code) exists. The built-in screen
|
|
172
|
-
* runs `needs_first_factor` with an email or phone code, and always runs
|
|
173
|
-
* `needs_second_factor`, `needs_client_trust` and `needs_new_password`
|
|
174
|
-
* itself. When called, the web-fallback message is not
|
|
175
|
-
* shown. Without it, the screen shows the web fallback and logs
|
|
176
|
-
* `console.warn`. Ignored in `sign-up`.
|
|
177
|
-
*/
|
|
178
139
|
onIncomplete?: (signIn: IncompleteSignIn) => void;
|
|
179
|
-
/**
|
|
180
|
-
* Time for each Clerk call (create, prepare, attempt, reset password,
|
|
181
|
-
* set active), in milliseconds. A call that takes longer fails with code
|
|
182
|
-
* `auth_timeout`. Default 20000.
|
|
183
|
-
*/
|
|
184
140
|
stageTimeoutMs?: number;
|
|
185
|
-
/** Passed to every `AuthScreen`. Default `"default"`; `"hero"` is a coloured band over a rounded sheet. */
|
|
186
141
|
variant?: AuthScreenProps["variant"];
|
|
187
|
-
/** The hero band colour. Only used with `variant="hero"`. */
|
|
188
142
|
heroColor?: string;
|
|
189
|
-
/** The hero title and subtitle colour. Only used with `variant="hero"`. Default white. */
|
|
190
143
|
heroForeground?: string;
|
|
191
|
-
/** Replaces the primary submit label in `sign-in` and `sign-up`. `reset-password` keeps "Send code". */
|
|
192
144
|
submitLabel?: string;
|
|
193
|
-
/** Replaces the muted prompt in the footer, such as "New to Velth?". */
|
|
194
145
|
footerPrompt?: string;
|
|
195
|
-
/** Replaces the footer link label ("Sign up" or "Sign in"), such as "Create an account". */
|
|
196
146
|
footerLinkLabel?: string;
|
|
197
|
-
/** Default `false`. `true` puts a label ("Email", "Password", "Confirm password") above each field. */
|
|
198
147
|
showFieldLabels?: boolean;
|
|
199
|
-
/** Default "Email". */
|
|
200
148
|
emailPlaceholder?: string;
|
|
201
|
-
/** Default "Password". */
|
|
202
149
|
passwordPlaceholder?: string;
|
|
203
|
-
/** Variant of the Google button. Default `"outline"`. */
|
|
204
150
|
googleVariant?: GoogleSignInButtonProps["variant"];
|
|
205
|
-
/** Size of the Google button. Default: the button default. */
|
|
206
151
|
googleSize?: GoogleSignInButtonProps["size"];
|
|
207
152
|
};
|
|
208
153
|
|
|
@@ -256,7 +201,6 @@ export function SignInScreen({
|
|
|
256
201
|
const heroProps = { variant, heroColor, heroForeground };
|
|
257
202
|
const labelled = (label: string, control: ReactNode) =>
|
|
258
203
|
showFieldLabels ? <SettingsField label={label}>{control}</SettingsField> : control;
|
|
259
|
-
// Both are always defined: before Clerk loads, a call waits for it.
|
|
260
204
|
const signIn = signInCalls(useSignIn().signIn);
|
|
261
205
|
const signUpAttempt = useSignUp().signUp;
|
|
262
206
|
const router = useRouter();
|
|
@@ -284,7 +228,6 @@ export function SignInScreen({
|
|
|
284
228
|
const secondFactor = useSecondFactor({ stageTimeoutMs });
|
|
285
229
|
const [error, setError] = useState("");
|
|
286
230
|
const [submitting, setSubmitting] = useState(false);
|
|
287
|
-
// The field each "next" key moves to.
|
|
288
231
|
const passwordField = useRef<ComponentRef<typeof TextInput>>(null);
|
|
289
232
|
const confirmField = useRef<ComponentRef<typeof TextInput>>(null);
|
|
290
233
|
const signUp = mode === "sign-up";
|
|
@@ -310,7 +253,6 @@ export function SignInScreen({
|
|
|
310
253
|
);
|
|
311
254
|
};
|
|
312
255
|
|
|
313
|
-
// A status the built-in UI cannot finish: the app's `onIncomplete`, or the web fallback.
|
|
314
256
|
const unhandled = (attempt: IncompleteSignIn) => {
|
|
315
257
|
if (onIncomplete) return onIncomplete(attempt);
|
|
316
258
|
warnIncomplete(attempt);
|
|
@@ -359,9 +301,7 @@ export function SignInScreen({
|
|
|
359
301
|
await chooseFirstStrategy(strategy, list);
|
|
360
302
|
};
|
|
361
303
|
|
|
362
|
-
// Routes a sign-in attempt. `needs_first_factor` is built in only after `signIn.create`.
|
|
363
304
|
const routeAttempt = async (attempt: IncompleteSignIn, afterCreate: boolean) => {
|
|
364
|
-
// Clerk's `SignInStatus` omits `needs_client_trust`: widen before comparing.
|
|
365
305
|
const status: string | null = attempt.status;
|
|
366
306
|
if (status === "complete" && attempt.createdSessionId) {
|
|
367
307
|
await withAuthTimeout(signIn.setActive(), "set-active", stageTimeoutMs);
|
|
@@ -419,13 +359,11 @@ export function SignInScreen({
|
|
|
419
359
|
setError("");
|
|
420
360
|
try {
|
|
421
361
|
const result = await withAuthTimeout(signIn.resetPassword(newPassword), "reset-password", stageTimeoutMs);
|
|
422
|
-
// Clerk's `SignInStatus` omits `needs_client_trust`: widen before comparing.
|
|
423
362
|
const afterReset: string | null = result.status;
|
|
424
363
|
if (afterReset === "complete" && result.createdSessionId) {
|
|
425
364
|
await withAuthTimeout(signIn.setActive(), "set-active", stageTimeoutMs);
|
|
426
365
|
done();
|
|
427
366
|
} else if (afterReset === "needs_second_factor" || afterReset === "needs_client_trust") {
|
|
428
|
-
// A reset on an account with two-step verification: the code step, then the session.
|
|
429
367
|
setPendingNewPassword(false);
|
|
430
368
|
await startSecondFactor(result, afterReset === "needs_client_trust");
|
|
431
369
|
} else if (onIncomplete) {
|
|
@@ -461,7 +399,6 @@ export function SignInScreen({
|
|
|
461
399
|
}
|
|
462
400
|
};
|
|
463
401
|
|
|
464
|
-
// Emails the reset code. Throws what the call throws.
|
|
465
402
|
const requestResetCode = async () => {
|
|
466
403
|
await withAuthTimeout(signIn.sendResetCode(email.trim()), "create", stageTimeoutMs);
|
|
467
404
|
};
|
|
@@ -497,7 +434,6 @@ export function SignInScreen({
|
|
|
497
434
|
}
|
|
498
435
|
};
|
|
499
436
|
|
|
500
|
-
// Checks the emailed code. A good code gives `needs_new_password`, which `routeAttempt` shows.
|
|
501
437
|
const onResetCode = async (resetCode: string) => {
|
|
502
438
|
if (resetLoading) return;
|
|
503
439
|
setResetLoading(true);
|
|
@@ -528,7 +464,6 @@ export function SignInScreen({
|
|
|
528
464
|
};
|
|
529
465
|
|
|
530
466
|
const onSecondFactorBack = () => {
|
|
531
|
-
// The pending attempt stays; the next `signIn.create` replaces it.
|
|
532
467
|
setPendingSecondFactor(false);
|
|
533
468
|
setPendingFirstFactor(false);
|
|
534
469
|
setFirstError("");
|
|
@@ -549,7 +484,6 @@ export function SignInScreen({
|
|
|
549
484
|
return fail(AUTH_MESSAGES.signUpFailed, `Use at least ${minPasswordLength} characters for the password`);
|
|
550
485
|
}
|
|
551
486
|
if (password !== signUpConfirm) {
|
|
552
|
-
// Always under the confirm field, also with `errorDisplay="toast"`.
|
|
553
487
|
setError("");
|
|
554
488
|
setMismatch(true);
|
|
555
489
|
return;
|
|
@@ -729,7 +663,6 @@ export function SignInScreen({
|
|
|
729
663
|
const active = secondFactor.strategy;
|
|
730
664
|
const available = supportedSecondFactorStrategies(factors);
|
|
731
665
|
const others = available.filter((strategy) => strategy !== active);
|
|
732
|
-
// From a backup code, go back to the default non-backup method. Otherwise offer a backup code.
|
|
733
666
|
const switchTo =
|
|
734
667
|
active === "backup_code"
|
|
735
668
|
? pickSecondFactorStrategy(factors.filter((factor) => factor.strategy !== "backup_code"))
|
|
@@ -927,7 +860,6 @@ export function SignInScreen({
|
|
|
927
860
|
>
|
|
928
861
|
{reset ? AUTH_MESSAGES.sendResetCode : (submitLabel ?? (signUp ? "Create account" : "Sign in"))}
|
|
929
862
|
</Button>
|
|
930
|
-
{/* Bot protection mounts its widget here on web sign-up. */}
|
|
931
863
|
{signUp ? <View nativeID="clerk-captcha" /> : null}
|
|
932
864
|
</AuthScreen>
|
|
933
865
|
);
|
package/src/auth/authErrors.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isClerkAPIResponseError } from "@clerk/expo";
|
|
2
2
|
|
|
3
|
-
/** Words that must not reach the user: the auth provider and stack names. */
|
|
4
3
|
const PRODUCT_NAMES = /\b(clerk|convex)\b/gi;
|
|
5
4
|
|
|
6
5
|
/** The only Clerk codes that mean "Invalid email or password". */
|
|
@@ -23,7 +22,6 @@ type ParsedAuthError = {
|
|
|
23
22
|
const asString = (value: unknown): string | undefined =>
|
|
24
23
|
typeof value === "string" && value.length > 0 ? value : undefined;
|
|
25
24
|
|
|
26
|
-
/** Reads a Clerk API error, or a plain `{ errors: [...] }` object. No `zod`. */
|
|
27
25
|
function parseAuthError(error: unknown): ParsedAuthError | null {
|
|
28
26
|
if (typeof error !== "object" || error === null) return null;
|
|
29
27
|
const record = error as Record<string, unknown>;
|
|
@@ -120,10 +118,6 @@ export function logAuthFailure(stage: string, error: unknown): void {
|
|
|
120
118
|
}
|
|
121
119
|
|
|
122
120
|
export type AuthErrorOptions = {
|
|
123
|
-
/**
|
|
124
|
-
* Sign-in with email and password. `form_password_incorrect` and
|
|
125
|
-
* `form_identifier_not_found` (only these) return `fallback`.
|
|
126
|
-
*/
|
|
127
121
|
credentials?: boolean;
|
|
128
122
|
};
|
|
129
123
|
|
package/src/auth/clerkCore3.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { useSignIn } from "@clerk/expo";
|
|
|
2
2
|
import type { IncompleteSignIn } from "./SignInScreen";
|
|
3
3
|
import type { PrepareFirstFactorParams, PrepareSecondFactorParams, SecondFactorStrategy } from "./totp";
|
|
4
4
|
|
|
5
|
-
/** The sign-in resource of the `useSignIn` hook at the root of `@clerk/expo` 4. */
|
|
6
5
|
type CoreSignIn = ReturnType<typeof useSignIn>["signIn"];
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -35,12 +34,10 @@ export function signInCalls(signIn: CoreSignIn) {
|
|
|
35
34
|
get supportedSecondFactors() {
|
|
36
35
|
return signIn.supportedSecondFactors;
|
|
37
36
|
},
|
|
38
|
-
/** Starts a new sign-in with email and password. */
|
|
39
37
|
async password(identifier: string, password: string) {
|
|
40
38
|
await clerkCall(signIn.password({ identifier, password }));
|
|
41
39
|
return state();
|
|
42
40
|
},
|
|
43
|
-
/** Starts a new sign-in for `identifier` and emails its password-reset code. */
|
|
44
41
|
async sendResetCode(identifier: string) {
|
|
45
42
|
await clerkCall(signIn.create({ identifier }));
|
|
46
43
|
await clerkCall(signIn.resetPasswordEmailCode.sendCode());
|
|
@@ -49,7 +46,6 @@ export function signInCalls(signIn: CoreSignIn) {
|
|
|
49
46
|
await clerkCall(signIn.resetPasswordEmailCode.verifyCode({ code }));
|
|
50
47
|
return state();
|
|
51
48
|
},
|
|
52
|
-
/** Sets the new password. Other sessions stay signed in, as before. */
|
|
53
49
|
async resetPassword(password: string) {
|
|
54
50
|
await clerkCall(signIn.resetPasswordEmailCode.submitPassword({ password, signOutOfOtherSessions: false }));
|
|
55
51
|
return state();
|
|
@@ -67,7 +63,6 @@ export function signInCalls(signIn: CoreSignIn) {
|
|
|
67
63
|
else await clerkCall(signIn.emailCode.verifyCode({ code }));
|
|
68
64
|
return state();
|
|
69
65
|
},
|
|
70
|
-
/** Sends the second-factor code. Clerk picks the phone number or email of the sign-in itself. */
|
|
71
66
|
async prepareSecondFactor(params: PrepareSecondFactorParams) {
|
|
72
67
|
if (params.strategy === "phone_code") await clerkCall(signIn.mfa.sendPhoneCode());
|
|
73
68
|
else await clerkCall(signIn.mfa.sendEmailCode());
|
|
@@ -80,7 +75,6 @@ export function signInCalls(signIn: CoreSignIn) {
|
|
|
80
75
|
else await clerkCall(signIn.mfa.verifyEmailCode({ code }));
|
|
81
76
|
return state();
|
|
82
77
|
},
|
|
83
|
-
/** Makes the session of a complete sign-in the active one. */
|
|
84
78
|
async setActive() {
|
|
85
79
|
await clerkCall(signIn.finalize());
|
|
86
80
|
},
|
package/src/auth/index.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
// Clerk + Convex providers and the shared sign-in and sign-up screens. On
|
|
2
|
-
// `@vvedantb/native-ui/auth` only: they import `@clerk/expo`, `convex`,
|
|
3
|
-
// `expo-auth-session`, `expo-web-browser` and `expo-router`, and Metro does not
|
|
4
|
-
// tree-shake.
|
|
5
1
|
export { AuthProviders } from "./AuthProviders";
|
|
6
2
|
export type { AuthProvidersProps } from "./AuthProviders";
|
|
7
3
|
export { AuthScreen, OrDivider, FieldError } from "./AuthScreen";
|
package/src/auth/totp.ts
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
} from "./authErrors";
|
|
10
10
|
import { signInCalls } from "./clerkCore3";
|
|
11
11
|
|
|
12
|
-
/** Logs a timed-out stage. Other failures are not logged here. */
|
|
13
12
|
const logTimeout = (stage: string, error: unknown) => {
|
|
14
13
|
if (isAuthTimeoutError(error)) logAuthFailure(stage, error);
|
|
15
14
|
};
|
|
@@ -102,7 +101,6 @@ export async function prepareSecondFactorIfNeeded(args: {
|
|
|
102
101
|
signIn: Pick<SecondFactorSignIn, "supportedSecondFactors" | "prepareSecondFactor">;
|
|
103
102
|
strategy: SecondFactorStrategy;
|
|
104
103
|
factor?: SecondFactor;
|
|
105
|
-
/** Time for the Clerk call. Default 20000 ms. */
|
|
106
104
|
timeoutMs?: number;
|
|
107
105
|
}): Promise<TotpResult> {
|
|
108
106
|
const { signIn, strategy } = args;
|
|
@@ -149,7 +147,6 @@ export async function submitSecondFactor(args: {
|
|
|
149
147
|
setActive: TotpSetActive;
|
|
150
148
|
code: string;
|
|
151
149
|
strategy: SecondFactorStrategy;
|
|
152
|
-
/** Time for each Clerk call. Default 20000 ms. */
|
|
153
150
|
timeoutMs?: number;
|
|
154
151
|
}): Promise<TotpResult> {
|
|
155
152
|
const ms = args.timeoutMs ?? DEFAULT_STAGE_TIMEOUT_MS;
|
|
@@ -229,7 +226,6 @@ export async function prepareFirstFactorIfNeeded(args: {
|
|
|
229
226
|
signIn: Pick<FirstFactorSignIn, "supportedFirstFactors" | "prepareFirstFactor">;
|
|
230
227
|
strategy: FirstFactorStrategy;
|
|
231
228
|
factor?: FirstFactor;
|
|
232
|
-
/** Time for the Clerk call. Default 20000 ms. */
|
|
233
229
|
timeoutMs?: number;
|
|
234
230
|
}): Promise<TotpResult> {
|
|
235
231
|
const { signIn, strategy } = args;
|
|
@@ -268,7 +264,6 @@ export async function submitFirstFactor(args: {
|
|
|
268
264
|
signIn: Pick<FirstFactorSignIn, "attemptFirstFactor">;
|
|
269
265
|
code: string;
|
|
270
266
|
strategy: FirstFactorStrategy;
|
|
271
|
-
/** Time for the Clerk call. Default 20000 ms. */
|
|
272
267
|
timeoutMs?: number;
|
|
273
268
|
}): Promise<FirstFactorResult> {
|
|
274
269
|
try {
|
|
@@ -301,23 +296,16 @@ export function submitTotpSecondFactor(args: {
|
|
|
301
296
|
}
|
|
302
297
|
|
|
303
298
|
export type UseSecondFactorOptions = {
|
|
304
|
-
/** The strategy `submit` uses until `setStrategy` changes it. Default `"totp"`. */
|
|
305
299
|
strategy?: SecondFactorStrategy;
|
|
306
|
-
/** Time for each Clerk call, in milliseconds. Default 20000. */
|
|
307
300
|
stageTimeoutMs?: number;
|
|
308
301
|
};
|
|
309
302
|
|
|
310
303
|
export type UseSecondFactorResult = {
|
|
311
|
-
/** Checks the code and starts the session. Never throws. Sets `error` on failure. */
|
|
312
304
|
submit: (code: string) => Promise<TotpResult>;
|
|
313
|
-
/** Sends the code for `phone_code` and `email_code` (no call for the others). Never throws. Sets `error` on failure. */
|
|
314
305
|
prepare: (strategy?: SecondFactorStrategy, factor?: SecondFactor) => Promise<TotpResult>;
|
|
315
|
-
/** The strategy `submit` uses. */
|
|
316
306
|
strategy: SecondFactorStrategy;
|
|
317
307
|
setStrategy: (strategy: SecondFactorStrategy) => void;
|
|
318
|
-
/** True while `submit` or `prepare` runs. */
|
|
319
308
|
loading: boolean;
|
|
320
|
-
/** The last failure message, or `""`. */
|
|
321
309
|
error: string;
|
|
322
310
|
clearError: () => void;
|
|
323
311
|
};
|
|
@@ -330,7 +318,6 @@ export type UseSecondFactorResult = {
|
|
|
330
318
|
* `{ ok: true }` the session is active: navigate in the caller.
|
|
331
319
|
*/
|
|
332
320
|
export function useSecondFactor(options: UseSecondFactorOptions = {}): UseSecondFactorResult {
|
|
333
|
-
// Always defined: before Clerk loads, a call waits for it, inside the stage timeout.
|
|
334
321
|
const signIn = signInCalls(useSignIn().signIn);
|
|
335
322
|
const [chosen, setChosen] = useState<SecondFactorStrategy | null>(null);
|
|
336
323
|
const strategy = chosen ?? options.strategy ?? "totp";
|
package/src/brand/AppIcons.tsx
CHANGED
|
@@ -14,17 +14,11 @@ import {
|
|
|
14
14
|
} from "./svg";
|
|
15
15
|
|
|
16
16
|
export type AppIconProps = {
|
|
17
|
-
/** Rendered width and height in points (the glyph is square). Default 24. */
|
|
18
17
|
size?: number;
|
|
19
|
-
/** Glyph colour, for fill and stroke glyphs. Default the scheme's `tokens.color.foreground`. */
|
|
20
18
|
color?: string;
|
|
21
|
-
/** Stroke width in rendered points, for stroke glyphs. Default: the glyph's own weight. Fill glyphs ignore it. */
|
|
22
19
|
stroke?: number;
|
|
23
|
-
/** Accessible name. Without it the icon is hidden from assistive tech. On web: `role="img"` and `aria-label`, or `aria-hidden`. */
|
|
24
20
|
title?: string;
|
|
25
|
-
/** `"center"` (default) centres the glyph in its square. `"start"` left-aligns its ink, for vertical lists. */
|
|
26
21
|
align?: "center" | "start";
|
|
27
|
-
/** Set as `data-testid` on web, where `Svg` does not map `testID`. */
|
|
28
22
|
testID?: string;
|
|
29
23
|
style?: ViewProps["style"];
|
|
30
24
|
};
|
package/src/brand/AppMark.tsx
CHANGED
|
@@ -13,15 +13,10 @@ import {
|
|
|
13
13
|
} from "./svg";
|
|
14
14
|
|
|
15
15
|
export type AppMarkProps = {
|
|
16
|
-
/** Which family app's mark to draw. */
|
|
17
16
|
app: AppName;
|
|
18
|
-
/** `"mark"` (default): the plain `APP_ICONS` glyph. `"tile"`: white glyph on a black rounded tile. `"tile-light"`: black glyph on a white tile. */
|
|
19
17
|
variant?: AppMarkVariant;
|
|
20
|
-
/** Width and height in points. Default 24. */
|
|
21
18
|
size?: number;
|
|
22
|
-
/** Accessible name. Without it the mark is hidden from assistive tech. On web: `role="img"` and `aria-label`, or `aria-hidden`. */
|
|
23
19
|
title?: string;
|
|
24
|
-
/** Set as `data-testid` on web, where `Svg` does not map `testID`. */
|
|
25
20
|
testID?: string;
|
|
26
21
|
style?: ViewProps["style"];
|
|
27
22
|
};
|
|
@@ -10,15 +10,10 @@ import type { AppName } from "./svg";
|
|
|
10
10
|
export type ProductAppName = Exclude<AppName, "projectv" | "eva" | "bee">;
|
|
11
11
|
|
|
12
12
|
export type AppWordmarkProps = {
|
|
13
|
-
/** Which product app's name to show. The label is always the lowercase app id. */
|
|
14
13
|
app: ProductAppName;
|
|
15
|
-
/** Text font size in points (default 24). The icon is `Math.round(size * 1.4)` square and the gap is `0.2em`. */
|
|
16
14
|
size?: number;
|
|
17
|
-
/** `false` renders the name only (default `true`). */
|
|
18
15
|
icon?: boolean;
|
|
19
|
-
/** Icon and text colour. Default the scheme's `tokens.color.foreground`. */
|
|
20
16
|
color?: string;
|
|
21
|
-
/** When set, the wordmark is a pressable link (the web `href`). */
|
|
22
17
|
onPress?: () => void;
|
|
23
18
|
accessibilityLabel?: string;
|
|
24
19
|
className?: string;
|
|
@@ -54,8 +49,6 @@ export function AppWordmark({
|
|
|
54
49
|
fontSize: size,
|
|
55
50
|
lineHeight: size,
|
|
56
51
|
letterSpacing: size * WORDMARK.letterSpacingEm,
|
|
57
|
-
// The class alone draws Regular where an app maps every Instrument
|
|
58
|
-
// Sans class to one family.
|
|
59
52
|
fontWeight: WORDMARK.fontWeight,
|
|
60
53
|
color: fg,
|
|
61
54
|
includeFontPadding: false,
|
package/src/brand/GoogleMark.tsx
CHANGED
|
@@ -3,16 +3,12 @@ import Svg, { Path } from "react-native-svg";
|
|
|
3
3
|
import { svgA11yProps } from "../svgA11y";
|
|
4
4
|
|
|
5
5
|
export type GoogleMarkProps = {
|
|
6
|
-
/** Width and height in points. Default 18. */
|
|
7
6
|
size?: number;
|
|
8
|
-
/** Accessible name. Without it the mark is hidden from assistive tech, as it should be beside a "Continue with Google" label. On web: `role="img"` and `aria-label`, or `aria-hidden`. */
|
|
9
7
|
title?: string;
|
|
10
|
-
/** Set as `data-testid` on web, where `Svg` does not map `testID`. */
|
|
11
8
|
testID?: string;
|
|
12
9
|
style?: ViewProps["style"];
|
|
13
10
|
};
|
|
14
11
|
|
|
15
|
-
/** The four paths of the Google "G" on the 24 grid, each in its brand colour. */
|
|
16
12
|
const GOOGLE_G = [
|
|
17
13
|
{
|
|
18
14
|
fill: "#4285F4",
|
|
@@ -3,12 +3,10 @@ import Svg, { Path, Rect } from "react-native-svg";
|
|
|
3
3
|
import { svgA11yProps } from "../svgA11y";
|
|
4
4
|
import { useScheme } from "../useScheme";
|
|
5
5
|
|
|
6
|
-
/** A fill that follows the colour scheme, as the web `text-black dark:text-white`. */
|
|
7
6
|
type SchemeFill = string | { light: string; dark: string };
|
|
8
7
|
|
|
9
8
|
type ProviderMarkLayer =
|
|
10
9
|
| { d: string; fill: SchemeFill; evenOdd?: boolean }
|
|
11
|
-
/** A full-bleed square behind the glyph (the OpenCode tile). */
|
|
12
10
|
| { square: number; fill: SchemeFill };
|
|
13
11
|
|
|
14
12
|
export type ProviderMark = { viewBox: string; layers: readonly ProviderMarkLayer[] };
|
|
@@ -92,13 +90,9 @@ export function providerLabel(provider: string): string {
|
|
|
92
90
|
}
|
|
93
91
|
|
|
94
92
|
export type ProviderIconProps = {
|
|
95
|
-
/** "claude", "codex", "opencode" or "cursor". Any other value draws the Claude mark, as the web. */
|
|
96
93
|
provider: string;
|
|
97
|
-
/** Width and height in points. Default 14, as the web. */
|
|
98
94
|
size?: number;
|
|
99
|
-
/** Accessible name. Without it the mark is hidden from assistive tech (web `aria-hidden`). */
|
|
100
95
|
title?: string;
|
|
101
|
-
/** Set as `data-testid` on web, where `Svg` does not map `testID`. */
|
|
102
96
|
testID?: string;
|
|
103
97
|
style?: ViewProps["style"];
|
|
104
98
|
};
|
package/src/brand/familyApps.ts
CHANGED
package/src/brand/index.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// `svg.ts`, `familyApps.ts` and `vProAppBenefits.ts` are byte-identical copies of
|
|
2
|
-
// `@vvedantb/ui` `src/brand/` (pure data, no imports beyond each other). A test
|
|
3
|
-
// in this package fails when they differ: change both together.
|
|
4
1
|
export { APP_ICONS, IconBee, IconEva, IconProjectV, IconVelth, IconVerve, IconVhub, IconVibot, IconVmem } from "./AppIcons";
|
|
5
2
|
export type { AppIconComponent, AppIconProps } from "./AppIcons";
|
|
6
3
|
export { AppMark } from "./AppMark";
|
package/src/brand/svg.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// Geometry and raw SVG strings for the family app marks. No imports, so the
|
|
2
|
-
// asset script can load this file directly with Node.
|
|
3
|
-
|
|
4
1
|
/** Every mark. `eva` and `bee` are marks and icons only: they are not family apps, so `FAMILY_APPS` leaves them out. */
|
|
5
2
|
export const APP_NAMES = ["projectv", "vibot", "vhub", "vmem", "verve", "velth", "eva", "bee"] as const;
|
|
6
3
|
|
|
@@ -14,13 +11,9 @@ export const MARK_STROKE_WIDTH = 50;
|
|
|
14
11
|
export const TILE_RADIUS = 224;
|
|
15
12
|
|
|
16
13
|
export type MarkShape = {
|
|
17
|
-
/** Filled shapes (no stroke) versus lines (50 wide, round caps by default). */
|
|
18
14
|
kind: "fill" | "stroke";
|
|
19
|
-
/** Path data on the 1024 grid. */
|
|
20
15
|
paths: readonly string[];
|
|
21
|
-
/** Stroke width override on the 1024 grid. Defaults to `MARK_STROKE_WIDTH`. */
|
|
22
16
|
strokeWidth?: number;
|
|
23
|
-
/** Line cap override. Defaults to `"round"`. */
|
|
24
17
|
linecap?: "butt" | "round";
|
|
25
18
|
};
|
|
26
19
|
|
|
@@ -101,7 +94,6 @@ export const APP_MARKS: Record<AppName, MarkShape> = {
|
|
|
101
94
|
type Point = [number, number];
|
|
102
95
|
type Box = [minX: number, minY: number, maxX: number, maxY: number];
|
|
103
96
|
|
|
104
|
-
/** Roots in (0, 1) of the derivative of a Bezier with 1D control values `v` (quadratic or cubic). */
|
|
105
97
|
function bezierExtrema(v: number[]): number[] {
|
|
106
98
|
const roots: number[] = [];
|
|
107
99
|
if (v.length === 3) {
|
|
@@ -127,7 +119,6 @@ function bezierAt(v: number[], t: number): number {
|
|
|
127
119
|
return v.length === 3 ? u * u * p0 + 2 * u * t * p1 + t * t * p2 : u ** 3 * p0 + 3 * u * u * t * p1 + 3 * u * t * t * p2 + t ** 3 * p3;
|
|
128
120
|
}
|
|
129
121
|
|
|
130
|
-
/** Extreme points of an SVG elliptical arc (endpoint form, no rotation), including both ends. */
|
|
131
122
|
function arcPoints(from: Point, [rx0, ry0, , large, sweep, x, y]: [number, number, number, number, number, number, number]): Point[] {
|
|
132
123
|
const [x0, y0] = from;
|
|
133
124
|
let rx = Math.abs(rx0);
|
package/src/configureTheme.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { palette, type Palette } from "./palette";
|
|
|
2
2
|
import { tokens, type Tokens } from "./tokens";
|
|
3
3
|
import { fontFamily, type ThemeFonts } from "./typography";
|
|
4
4
|
|
|
5
|
-
/** `tokens` and `palette` value types with the literal hex widened to `string` and `readonly` dropped. */
|
|
6
5
|
type Widen<T> = T extends string ? string : { -readonly [K in keyof T]: Widen<T[K]> };
|
|
7
6
|
|
|
8
7
|
/** The `tokens.color` shape: each key a `{ light, dark }` pair, except `white` and `black`. */
|
|
@@ -12,21 +11,13 @@ export type ThemeColors = Widen<Tokens["color"]>;
|
|
|
12
11
|
export type ThemePalette = Widen<Palette>;
|
|
13
12
|
|
|
14
13
|
export type ThemeConfig = {
|
|
15
|
-
/** Overrides for `tokens.color` (neutrals and surfaces). Keys not given keep the package value. */
|
|
16
14
|
color?: Partial<ThemeColors>;
|
|
17
|
-
/** Overrides for `palette` (primary, danger, overlay and the other web semantic colours). */
|
|
18
15
|
palette?: Partial<ThemePalette>;
|
|
19
|
-
/** Overrides for `fontFamily`: the family name for each weight, as the app loads the fonts. */
|
|
20
16
|
font?: Partial<ThemeFonts>;
|
|
21
17
|
};
|
|
22
18
|
|
|
23
19
|
type ColorValue = string | { light: string; dark: string };
|
|
24
20
|
|
|
25
|
-
/**
|
|
26
|
-
* Copies each given key onto `target`. A `{ light, dark }` pair is copied into
|
|
27
|
-
* the existing pair object, so values that hold the pair (`floatingFill`,
|
|
28
|
-
* `floatingHairline`, `floatingSolidFill`) follow it.
|
|
29
|
-
*/
|
|
30
21
|
function assignValues(
|
|
31
22
|
target: { readonly [key: string]: ColorValue },
|
|
32
23
|
source: { readonly [key: string]: ColorValue | undefined },
|
|
@@ -39,7 +30,6 @@ function assignValues(
|
|
|
39
30
|
}
|
|
40
31
|
}
|
|
41
32
|
|
|
42
|
-
/** Bumped by each `configureTheme` call; `useScheme` redraws on it. */
|
|
43
33
|
let themeVersion = 0;
|
|
44
34
|
const themeListeners = new Set<() => void>();
|
|
45
35
|
|
package/src/controlStyles.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Colours for `Button`, `Input`, `Textarea`, the `Select` trigger, `Switch`,
|
|
3
|
-
* `Checkbox`, `Tabs`, `Card` and component text, taken from `palette` and
|
|
4
|
-
* `tokens` instead of NativeWind theme keys (`bg-primary`, `bg-input`,
|
|
5
|
-
* `text-foreground`) that apps do not define, or define without a dark value.
|
|
6
|
-
* Also text weights and sizes as styles, the page title type, the
|
|
7
|
-
* `SearchInput` metrics, the compact window test for dialogs and the
|
|
8
|
-
* touch-target maths. No React Native import, so the tests can load this file.
|
|
9
|
-
*/
|
|
10
1
|
import { palette, withAlpha } from "./palette";
|
|
11
2
|
import { tokens } from "./tokens";
|
|
12
3
|
|
|
@@ -148,7 +139,6 @@ export function typeStyle(weight: TypeWeight) {
|
|
|
148
139
|
return { fontWeight: FONT_WEIGHT[weight] };
|
|
149
140
|
}
|
|
150
141
|
|
|
151
|
-
/** Tailwind `text-*` sizes with their default line heights, in points. */
|
|
152
142
|
const TEXT_SIZE = {
|
|
153
143
|
"text-xs": { fontSize: 12, lineHeight: 16 },
|
|
154
144
|
"text-sm": { fontSize: 14, lineHeight: 20 },
|
|
@@ -160,7 +150,6 @@ const TEXT_SIZE = {
|
|
|
160
150
|
|
|
161
151
|
export type TextSize = keyof typeof TEXT_SIZE;
|
|
162
152
|
|
|
163
|
-
/** Tailwind `leading-tight`, `leading-snug` and `leading-relaxed`, as multiples of the size. */
|
|
164
153
|
const LEADING = { tight: 1.25, snug: 1.375, relaxed: 1.625 } as const;
|
|
165
154
|
|
|
166
155
|
export type TextLeading = keyof typeof LEADING;
|
|
@@ -178,7 +167,6 @@ export function sizeStyle(size: TextSize, leading?: TextLeading) {
|
|
|
178
167
|
return { fontSize, lineHeight: leading ? fontSize * LEADING[leading] : lineHeight };
|
|
179
168
|
}
|
|
180
169
|
|
|
181
|
-
/** Tailwind `tracking-tight` and `tracking-wide`, in em. */
|
|
182
170
|
const TRACKING = { tight: -0.025, wide: 0.025 } as const;
|
|
183
171
|
|
|
184
172
|
/**
|
|
@@ -3,13 +3,7 @@ import { ConfirmDialog } from "../ConfirmDialog";
|
|
|
3
3
|
import { crashDetails, dismissLastCrash, useLastCrash } from "./lastCrash";
|
|
4
4
|
|
|
5
5
|
export type LastCrashDialogProps = {
|
|
6
|
-
/** Names the app in the title and the copied details, for example "Velth". */
|
|
7
6
|
appName: string;
|
|
8
|
-
/**
|
|
9
|
-
* Puts the details on the clipboard, for example `expo-clipboard`'s
|
|
10
|
-
* `setStringAsync`. native-ui adds no clipboard package: without it the
|
|
11
|
-
* button opens the share sheet, where the text can be copied too.
|
|
12
|
-
*/
|
|
13
7
|
onCopy?: (text: string) => Promise<unknown>;
|
|
14
8
|
testID?: string;
|
|
15
9
|
};
|