@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
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
// Reference screen for the components that mirror `@vvedantb/ui`. Render it in
|
|
2
|
-
// an Expo route to compare against the web: it needs the same NativeWind setup
|
|
3
|
-
// as the rest of the package and a `SafeAreaProvider` above it. It always
|
|
4
|
-
// renders the default sizes (larger text off), as the web does. Prices, names
|
|
5
|
-
// and figures below are placeholders, not real data.
|
|
6
1
|
import { useState, type ReactNode } from "react";
|
|
7
2
|
import { ScrollView, Text, View, type TextProps } from "react-native";
|
|
8
3
|
import {
|
|
@@ -136,7 +131,6 @@ import {
|
|
|
136
131
|
} from "../ai";
|
|
137
132
|
import { AiChatSamples } from "./AiChatGallery";
|
|
138
133
|
|
|
139
|
-
// Every shared variant; the aliases (`primary`, `tertiary`, `danger`) draw as the name they alias.
|
|
140
134
|
const BUTTON_VARIANTS: ButtonVariant[] = [
|
|
141
135
|
"default",
|
|
142
136
|
"primary",
|
|
@@ -177,8 +171,6 @@ const STATUS_TONES: StatusTone[] = [
|
|
|
177
171
|
const SWATCHES = ["#db2777", "#2563eb", "#16a34a", "#f59e0b", "#181818", "#ffffff"];
|
|
178
172
|
const SWATCH_LABELS = ["Pink", "Blue", "Green", "Amber", "Black", "White"];
|
|
179
173
|
|
|
180
|
-
// Space after the last section, so Card, Upgrade and Overlays can scroll to the
|
|
181
|
-
// top of an 844-tall phone for screenshot crops.
|
|
182
174
|
const GALLERY_END_SPACE = 720;
|
|
183
175
|
|
|
184
176
|
const PLANS: PricingPlan[] = [
|
|
@@ -198,7 +190,6 @@ const PLANS: PricingPlan[] = [
|
|
|
198
190
|
},
|
|
199
191
|
];
|
|
200
192
|
|
|
201
|
-
/** Body text in the scheme's foreground (a style, so it reads in dark mode too). */
|
|
202
193
|
function GalleryText({ className, style, ...props }: TextProps & { className?: string }) {
|
|
203
194
|
const scheme = useScheme();
|
|
204
195
|
return (
|
|
@@ -257,14 +248,12 @@ function GalleryScreen() {
|
|
|
257
248
|
return (
|
|
258
249
|
<View className="flex-1">
|
|
259
250
|
<ScrollView
|
|
260
|
-
// So the SearchInput clear button takes the first tap while the keyboard is up.
|
|
261
251
|
keyboardShouldPersistTaps="handled"
|
|
262
252
|
contentContainerClassName="gap-8 px-4 pt-4"
|
|
263
253
|
contentContainerStyle={{ paddingBottom: GALLERY_END_SPACE }}
|
|
264
254
|
>
|
|
265
255
|
<Section title="Page title">
|
|
266
256
|
<PageTitle>Updates</PageTitle>
|
|
267
|
-
{/* `safeTop={false}` and `px-0`: here the header is not at the top of the screen, and the scroll view pads the sides. */}
|
|
268
257
|
<PageHeader
|
|
269
258
|
title="Apps"
|
|
270
259
|
safeTop={false}
|
|
@@ -275,7 +264,6 @@ function GalleryScreen() {
|
|
|
275
264
|
</Button>
|
|
276
265
|
}
|
|
277
266
|
/>
|
|
278
|
-
{/* A header icon action: switches the gallery between light and dark. */}
|
|
279
267
|
<PageHeader title="Settings" safeTop={false} className="px-0" action={<ThemeToggle />} />
|
|
280
268
|
</Section>
|
|
281
269
|
|
|
@@ -298,7 +286,6 @@ function GalleryScreen() {
|
|
|
298
286
|
</Section>
|
|
299
287
|
|
|
300
288
|
<Section title="Button">
|
|
301
|
-
{/* The web gallery: a full-width column of variants, then the sm row. */}
|
|
302
289
|
<View className="gap-2">
|
|
303
290
|
{BUTTON_VARIANTS.map((variant) => (
|
|
304
291
|
<Button key={variant} testID={`button-variant-${variant}`} variant={variant} onPress={() => toast(variant)}>
|
|
@@ -329,7 +316,6 @@ function GalleryScreen() {
|
|
|
329
316
|
<IconCopy size={16} color={tokens.color.foreground[scheme]} />
|
|
330
317
|
</Button>
|
|
331
318
|
</View>
|
|
332
|
-
{/* Pills by default, as on the web. `shape="rounded"` keeps radius 16, the look before 0.6.0. */}
|
|
333
319
|
<View className="flex-row flex-wrap items-center gap-2">
|
|
334
320
|
<Button shape="rounded" size="sm" fullWidth={false}>
|
|
335
321
|
Rounded
|
|
@@ -378,7 +364,6 @@ function GalleryScreen() {
|
|
|
378
364
|
<FieldDescription testID="field-parity-description">We never share it.</FieldDescription>
|
|
379
365
|
<FieldError testID="field-parity-error">Enter a valid email.</FieldError>
|
|
380
366
|
</Field>
|
|
381
|
-
{/* Empty (`sm`: icon and placeholder) and filled (`md`: the clear button). */}
|
|
382
367
|
<SearchInput value={emptySearch} onChange={setEmptySearch} />
|
|
383
368
|
<SearchInput value={search} onChange={setSearch} size="md" label="Search colours" />
|
|
384
369
|
<Textarea placeholder="Notes" accessibilityLabel="Notes" />
|
|
@@ -651,7 +636,6 @@ function GalleryScreen() {
|
|
|
651
636
|
</EmptyState.Root>
|
|
652
637
|
</Section>
|
|
653
638
|
|
|
654
|
-
{/* 0.5.0: the Verve, vibot and Velth pieces. */}
|
|
655
639
|
<Section title="ColorSwatches">
|
|
656
640
|
<ColorSwatches
|
|
657
641
|
value={swatch}
|
|
@@ -672,7 +656,6 @@ function GalleryScreen() {
|
|
|
672
656
|
</Section>
|
|
673
657
|
|
|
674
658
|
<Section title="DateTimeField">
|
|
675
|
-
{/* Date only, empty until picked, with a clear button once set. */}
|
|
676
659
|
<DateTimeField
|
|
677
660
|
mode="date"
|
|
678
661
|
value={due}
|
|
@@ -684,7 +667,6 @@ function GalleryScreen() {
|
|
|
684
667
|
</Section>
|
|
685
668
|
|
|
686
669
|
<Section title="ListRow">
|
|
687
|
-
{/* Long-press the first row for its second action. */}
|
|
688
670
|
<ListRow
|
|
689
671
|
title="Ada Lovelace"
|
|
690
672
|
meta="See you at nine"
|
|
@@ -701,7 +683,6 @@ function GalleryScreen() {
|
|
|
701
683
|
onPress={() => toast("Open thread")}
|
|
702
684
|
onLongPress={() => toast("Thread actions")}
|
|
703
685
|
/>
|
|
704
|
-
{/* The switch sits outside the pressable area: it toggles without opening the row. */}
|
|
705
686
|
<ListRow
|
|
706
687
|
title="Mute thread"
|
|
707
688
|
meta="Tap the row or the switch"
|
|
@@ -731,7 +712,6 @@ function GalleryScreen() {
|
|
|
731
712
|
</Section>
|
|
732
713
|
|
|
733
714
|
<Section title="SheetRow">
|
|
734
|
-
{/* Static rows on the sheet surface; in an app they sit in a `SheetContent`. */}
|
|
735
715
|
<View className="py-2" style={{ backgroundColor: palette.overlay[scheme], borderRadius: tokens.radius.lg }}>
|
|
736
716
|
<SheetRow icon={IconCopy} title="Copy link" onPress={() => toast("Copied")} />
|
|
737
717
|
<SheetRow icon={IconPhoto} title="Save image" detail="To your photo library" onPress={() => toast("Saved")} />
|
|
@@ -748,7 +728,6 @@ function GalleryScreen() {
|
|
|
748
728
|
</Section>
|
|
749
729
|
|
|
750
730
|
<Section title="StackPageHeader">
|
|
751
|
-
{/* `safeTop={false}`: the strip is not at the top of the screen. */}
|
|
752
731
|
<AmbientBackground className="flex-none overflow-hidden rounded-lg">
|
|
753
732
|
<StackPageHeader
|
|
754
733
|
title="Details"
|
|
@@ -764,7 +743,6 @@ function GalleryScreen() {
|
|
|
764
743
|
</Section>
|
|
765
744
|
|
|
766
745
|
<Section title="More from Project V">
|
|
767
|
-
{/* As in Velth's settings: the other four phone apps. A row opens the app, else V Store, else the website. */}
|
|
768
746
|
<MoreFromProjectV
|
|
769
747
|
current="velth"
|
|
770
748
|
onOpen={(id, target) => toast(target ? `Opened ${id} (${target})` : `Could not open ${id}`)}
|
|
@@ -773,7 +751,6 @@ function GalleryScreen() {
|
|
|
773
751
|
</Section>
|
|
774
752
|
|
|
775
753
|
<Section title="Camera chrome">
|
|
776
|
-
{/* A dark stand-in for the live preview. */}
|
|
777
754
|
<View className="h-72 justify-between overflow-hidden rounded-lg p-4" style={{ backgroundColor: NEUTRAL_900 }}>
|
|
778
755
|
<View className="flex-row justify-between">
|
|
779
756
|
<IconButton variant="overlay" icon={IconX} label="Close camera" onPress={() => toast("Close")} />
|
|
@@ -794,7 +771,6 @@ function GalleryScreen() {
|
|
|
794
771
|
</Section>
|
|
795
772
|
|
|
796
773
|
<Section title="Stepper">
|
|
797
|
-
{/* Minus is disabled at `min` (1 here), plus at `max` (6). */}
|
|
798
774
|
<View className="flex-row items-center justify-between rounded-lg bg-surface px-4 py-3">
|
|
799
775
|
<GalleryText>Tablets</GalleryText>
|
|
800
776
|
<Stepper
|
|
@@ -811,7 +787,6 @@ function GalleryScreen() {
|
|
|
811
787
|
<GalleryText testID="stepper-dose-value">{`Dose: ${dose}`}</GalleryText>
|
|
812
788
|
</Section>
|
|
813
789
|
|
|
814
|
-
{/* The full chat screen, with the composer and keyboard, is `AiChatGallery` (`@vvedantb/native-ui/ai-gallery`). */}
|
|
815
790
|
<Section title="AI chat">
|
|
816
791
|
<AiChatSamples />
|
|
817
792
|
<ChainOfThought defaultOpen>
|
package/src/floating.ts
CHANGED
|
@@ -14,12 +14,6 @@ export const FLOATING_PILL_RADIUS = tokens.radius.pill;
|
|
|
14
14
|
|
|
15
15
|
const FLOATING_BOX_SHADOW = "0px 8px 24px rgba(10, 10, 10, 0.12)";
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* Only the shadow keys, not `ViewStyle`: an Expo-widened `ViewStyle`
|
|
19
|
-
* (`position: "fixed"`, `backgroundImage`) is not assignable to a React
|
|
20
|
-
* Native 0.88 View `style`. A plain inferred type would be `{}` and lose
|
|
21
|
-
* `floatingShadow.shadowColor` and the rest for callers.
|
|
22
|
-
*/
|
|
23
17
|
type FloatingShadowStyle = {
|
|
24
18
|
shadowColor?: string;
|
|
25
19
|
shadowOffset?: { width: number; height: number };
|
|
@@ -8,22 +8,10 @@ import { GenerativeUiPanelContext } from "./context";
|
|
|
8
8
|
import { GenerativeUiRenderer } from "./renderer";
|
|
9
9
|
|
|
10
10
|
export type GenerativeUiPanelProps = {
|
|
11
|
-
/** The stored json-render spec, still serialised. */
|
|
12
11
|
spec: string;
|
|
13
|
-
/**
|
|
14
|
-
* Sends a button's text back to the agent. Undefined when the app cannot
|
|
15
|
-
* send now (an archived chat, a sleeping sandbox): every button is then
|
|
16
|
-
* disabled, as the web panel's disabled fieldset.
|
|
17
|
-
*/
|
|
18
12
|
onReply?: (message: string) => void;
|
|
19
|
-
/** Opens a button's link. Only http(s) URLs reach it. Default: `Linking.openURL`. */
|
|
20
13
|
onOpenUrl?: (url: string) => void;
|
|
21
|
-
/** Copies a code block. Without it, code blocks have no copy button. */
|
|
22
14
|
onCopy?: (text: string) => void | Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Draws an element type this catalog does not know (a spec from a newer
|
|
25
|
-
* catalog). Default: nothing, as the web panel.
|
|
26
|
-
*/
|
|
27
15
|
renderUnsupported?: (type: string) => ReactNode;
|
|
28
16
|
testID?: string;
|
|
29
17
|
};
|
|
@@ -34,7 +22,6 @@ const openUrl = (url: string) => {
|
|
|
34
22
|
|
|
35
23
|
const UnsupportedContext = createContext<((type: string) => ReactNode) | undefined>(undefined);
|
|
36
24
|
|
|
37
|
-
/** json-render's fallback for an unknown type, drawn by the app's `renderUnsupported`. */
|
|
38
25
|
function UnsupportedElement({ element }: ComponentRenderProps) {
|
|
39
26
|
const render = useContext(UnsupportedContext);
|
|
40
27
|
return render ? <>{render(element.type)}</> : null;
|
|
@@ -65,13 +52,11 @@ export function GenerativeUiPanel({
|
|
|
65
52
|
}
|
|
66
53
|
if (actionName === "open_url") {
|
|
67
54
|
const url = params?.url;
|
|
68
|
-
// A stored spec is data: only an http(s) link opens.
|
|
69
55
|
if (typeof url === "string" && isHttpUrl(url)) onOpenUrl(url);
|
|
70
56
|
}
|
|
71
57
|
};
|
|
72
58
|
|
|
73
59
|
return (
|
|
74
|
-
// The web `Surface density="tight"`: the card fill, radius 16, `p-3`.
|
|
75
60
|
<View testID={testID} className="min-w-0 p-3" style={cardStyle(scheme)}>
|
|
76
61
|
<GenerativeUiPanelContext.Provider value={{ canPress: onReply !== undefined, onCopy }}>
|
|
77
62
|
<UnsupportedContext.Provider value={renderUnsupported}>
|
|
@@ -15,13 +15,6 @@ import { useScheme } from "../useScheme";
|
|
|
15
15
|
import { useGenerativeUiPanel } from "./context";
|
|
16
16
|
import { ALIGN, BADGE_VARIANT, BUTTON_VARIANT, GAP, toneSurface, toneText } from "./styles";
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* The phone parts of a generative UI panel, one per catalog component, drawn
|
|
20
|
-
* as the web `@vvedantb/ui/generative-ui` draws them: the same sizes, tones and
|
|
21
|
-
* gaps, on the native theme tokens.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/** The web `text-2xs` (11 / 14), for a metric's delta; the other sizes are the shared `text-*`. */
|
|
25
18
|
const TEXT_2XS = { fontSize: 11, lineHeight: 14 };
|
|
26
19
|
|
|
27
20
|
const FONT_CLASS = {
|
|
@@ -154,7 +147,6 @@ export function MetricElement({ element }: ComponentRenderProps<GenerativeUiProp
|
|
|
154
147
|
return (
|
|
155
148
|
<View className="min-w-0 gap-0.5" accessible accessibilityLabel={`${label}, ${value}`}>
|
|
156
149
|
<Line size="text-xs" color={tokens.color.muted[scheme]} text={label} />
|
|
157
|
-
{/* The web `text-lg font-medium tabular-nums leading-tight`. */}
|
|
158
150
|
<Text
|
|
159
151
|
className={FONT_CLASS.semibold}
|
|
160
152
|
style={[
|
|
@@ -298,7 +290,6 @@ export function ImageElement({ element }: ComponentRenderProps<GenerativeUiProps
|
|
|
298
290
|
const [aspect, setAspect] = useState(4 / 3);
|
|
299
291
|
const [width, setWidth] = useState(0);
|
|
300
292
|
const [failed, setFailed] = useState(false);
|
|
301
|
-
// A stored spec is data: only a hosted http(s) image loads, never `file:` or `content:`.
|
|
302
293
|
if (!isHttpUrl(url) || failed) return null;
|
|
303
294
|
const height = width > 0 ? Math.min(320, width / aspect) : 0;
|
|
304
295
|
return (
|
|
@@ -2,9 +2,7 @@ import { createContext, useContext } from "react";
|
|
|
2
2
|
|
|
3
3
|
/** What a panel passes to every element it draws. */
|
|
4
4
|
export type GenerativeUiPanelOptions = {
|
|
5
|
-
/** False when the app cannot reply: every button is disabled, as the web's disabled fieldset. */
|
|
6
5
|
canPress: boolean;
|
|
7
|
-
/** Copies a code block. Without it, code blocks have no copy button. */
|
|
8
6
|
onCopy?: (text: string) => void | Promise<void>;
|
|
9
7
|
};
|
|
10
8
|
|
package/src/glass.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useSurface } from "./theme";
|
|
2
|
+
import { useScheme } from "./useScheme";
|
|
3
|
+
|
|
4
|
+
type Scheme = "light" | "dark";
|
|
5
|
+
|
|
6
|
+
export type GlassKind = "surface" | "control" | "small";
|
|
7
|
+
|
|
8
|
+
const HIGHLIGHT = { light: 0.5, dark: 0.12 } as const;
|
|
9
|
+
const RIM = { light: 0.4, dark: 0.08 } as const;
|
|
10
|
+
const DROP = {
|
|
11
|
+
surface: "0px 1px 3px rgba(0, 0, 0, 0.08)",
|
|
12
|
+
control: "0px 1px 2px rgba(0, 0, 0, 0.12)",
|
|
13
|
+
small: "0px 1px 1px rgba(0, 0, 0, 0.08)",
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The glass finish as a `boxShadow` string: a thin inset rim, a soft top-left
|
|
18
|
+
* highlight and a small drop shadow. The same recipe as the web components.
|
|
19
|
+
*/
|
|
20
|
+
export function glassShadow(kind: GlassKind, scheme: Scheme) {
|
|
21
|
+
const rim = `inset 0px 0px 0px 1px rgba(255, 255, 255, ${RIM[scheme]})`;
|
|
22
|
+
const highlight = `inset 1.5px 1.5px 1px -1px rgba(255, 255, 255, ${HIGHLIGHT[scheme]})`;
|
|
23
|
+
return `${rim}, ${highlight}, ${DROP[kind]}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** The glass style for `kind`, or `null` when `NativeUiProvider` sets `surface="flat"`. */
|
|
27
|
+
export function useGlass(kind: GlassKind): { boxShadow: string } | null {
|
|
28
|
+
const scheme = useScheme();
|
|
29
|
+
if (useSurface() === "flat") return null;
|
|
30
|
+
return { boxShadow: glassShadow(kind, scheme) };
|
|
31
|
+
}
|
package/src/glassBlur.tsx
CHANGED
|
@@ -10,12 +10,6 @@ import {
|
|
|
10
10
|
import { StyleSheet, View, type ViewProps } from "react-native";
|
|
11
11
|
import { loadBlur, type BlurTargetElement, type BlurTargetRef } from "./blur";
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* The current blur target, outside React state. A target change (each tab
|
|
15
|
-
* switch hands it from one tab to the next) then re-renders only the glass
|
|
16
|
-
* that subscribes, not the whole tab tree under the provider: as a context
|
|
17
|
-
* value it walked every mounted tab twice per switch.
|
|
18
|
-
*/
|
|
19
13
|
type BlurTargetStore = {
|
|
20
14
|
get: () => BlurTargetRef | null;
|
|
21
15
|
set: (next: BlurTargetRef | null) => void;
|
|
@@ -39,9 +33,6 @@ function createBlurTargetStore(): BlurTargetStore {
|
|
|
39
33
|
};
|
|
40
34
|
}
|
|
41
35
|
|
|
42
|
-
// `null` outside a provider and inside a target (a blur view must not sit
|
|
43
|
-
// inside its own target). The value is the provider's one store, so it never
|
|
44
|
-
// changes.
|
|
45
36
|
const BlurTargetStoreContext = createContext<BlurTargetStore | null>(null);
|
|
46
37
|
|
|
47
38
|
const noSubscribe = () => () => {};
|
|
@@ -63,7 +54,6 @@ export function GlassBlurProvider({ children }: { children: ReactNode }) {
|
|
|
63
54
|
}
|
|
64
55
|
|
|
65
56
|
export type GlassBlurTargetProps = ViewProps & {
|
|
66
|
-
/** Set `false` while the content is hidden, such as an unfocused tab. */
|
|
67
57
|
active?: boolean;
|
|
68
58
|
};
|
|
69
59
|
|
|
@@ -83,8 +73,6 @@ export function GlassBlurTarget({
|
|
|
83
73
|
const ref = useRef<BlurTargetElement>(null);
|
|
84
74
|
const BlurTargetView = loadBlur()?.BlurTargetView;
|
|
85
75
|
|
|
86
|
-
// Publish the ref only once it is attached: expo-blur compares
|
|
87
|
-
// `blurTarget.current` between renders to pick up a new target.
|
|
88
76
|
useLayoutEffect(() => {
|
|
89
77
|
if (!store || !active) {
|
|
90
78
|
return;
|
|
@@ -95,11 +83,8 @@ export function GlassBlurTarget({
|
|
|
95
83
|
};
|
|
96
84
|
}, [store, active]);
|
|
97
85
|
|
|
98
|
-
// Surfaces in here get no target: a blur view must not sit inside its own.
|
|
99
86
|
const content = <BlurTargetStoreContext.Provider value={null}>{children}</BlurTargetStoreContext.Provider>;
|
|
100
87
|
|
|
101
|
-
// The plain `View` is the fallback when expo-blur is absent: no `BlurView`
|
|
102
|
-
// then reads the store, so this branch needs no target ref.
|
|
103
88
|
return BlurTargetView ? (
|
|
104
89
|
<BlurTargetView ref={ref} style={[styles.fill, style]} {...props}>
|
|
105
90
|
{content}
|
package/src/highlight.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as PrismReactRenderer from "prism-react-renderer";
|
|
1
|
+
import type * as PrismReactRenderer from "../types/prism-react-renderer";
|
|
2
2
|
|
|
3
3
|
export type PrismReactRendererModule = typeof PrismReactRenderer;
|
|
4
4
|
|
|
@@ -18,8 +18,6 @@ export function loadPrismReactRenderer(): PrismReactRendererModule | null {
|
|
|
18
18
|
prismReactRenderer = null;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
// `?? null`: with the real peer types installed, TypeScript keeps `undefined`
|
|
22
|
-
// in the type after the `try` (the package typecheck only sees a stub).
|
|
23
21
|
return prismReactRenderer ?? null;
|
|
24
22
|
}
|
|
25
23
|
|
|
@@ -66,7 +64,6 @@ export const GITHUB_CODE_COLORS: Record<"light" | "dark", Record<CodeColorRole,
|
|
|
66
64
|
},
|
|
67
65
|
};
|
|
68
66
|
|
|
69
|
-
/** Prism token types to their GitHub role. Types not listed are plain. */
|
|
70
67
|
const PRISM_ROLE: Record<string, CodeColorRole> = {
|
|
71
68
|
comment: "comment",
|
|
72
69
|
prolog: "comment",
|
|
@@ -132,20 +129,16 @@ export const SCRIPT_LANGUAGES = new Set(["js", "jsx", "javascript", "mjs", "cjs"
|
|
|
132
129
|
/** Languages `shellTokens` colours. `prism-react-renderer` bundles no shell grammar. */
|
|
133
130
|
export const SHELL_LANGUAGES = new Set(["bash", "sh", "shell", "zsh", "shellscript", "console"]);
|
|
134
131
|
|
|
135
|
-
/** Keywords Shiki colours as constants (`constant.language`, `variable.language`, a `void` type). */
|
|
136
132
|
const SCRIPT_CONSTANT_KEYWORDS = new Set(["null", "undefined", "this", "super", "void"]);
|
|
137
133
|
|
|
138
134
|
const IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
|
|
139
135
|
|
|
140
|
-
/** A token's role before context: what Prism's types say, with the Shiki differences that need no context. */
|
|
141
136
|
function scriptBaseRole({ types, content }: PrismToken): CodeColorRole {
|
|
142
|
-
// Inside `${…}` Shiki keeps the punctuation in the string colour and the code in its own.
|
|
143
137
|
const interpolation = types.lastIndexOf("interpolation");
|
|
144
138
|
if (interpolation >= 0) {
|
|
145
139
|
const inner = types.slice(interpolation + 1);
|
|
146
140
|
return inner.includes("punctuation") || inner.includes("interpolation-punctuation") ? "string" : prismRole(inner);
|
|
147
141
|
}
|
|
148
|
-
// A regex character class, brackets and escapes too.
|
|
149
142
|
if (types.includes("char-class")) return "constant";
|
|
150
143
|
const role = prismRole(types);
|
|
151
144
|
if (role === "keyword" && SCRIPT_CONSTANT_KEYWORDS.has(content)) return "constant";
|
|
@@ -156,7 +149,6 @@ function scriptBaseRole({ types, content }: PrismToken): CodeColorRole {
|
|
|
156
149
|
|
|
157
150
|
type Piece = CodeToken & { line: number; types: readonly string[] };
|
|
158
151
|
|
|
159
|
-
/** Splits a token so escapes in strings and each word of plain text get a role of their own. */
|
|
160
152
|
function splitPiece(piece: Piece): Piece[] {
|
|
161
153
|
const parts =
|
|
162
154
|
piece.role === "string" && !piece.types.includes("regex")
|
|
@@ -186,7 +178,6 @@ export function scriptTokens(lines: readonly (readonly PrismToken[])[]): CodeTok
|
|
|
186
178
|
splitPiece({ content: token.content, types: token.types, role: scriptBaseRole(token), line }),
|
|
187
179
|
),
|
|
188
180
|
);
|
|
189
|
-
// Indices of the pieces that are not whitespace.
|
|
190
181
|
const sig = pieces.flatMap((piece, index) => (piece.content.trim() === "" ? [] : [index]));
|
|
191
182
|
const at = (position: number) => {
|
|
192
183
|
const index = sig[position];
|
|
@@ -206,7 +197,6 @@ export function scriptTokens(lines: readonly (readonly PrismToken[])[]): CodeTok
|
|
|
206
197
|
}
|
|
207
198
|
return undefined;
|
|
208
199
|
};
|
|
209
|
-
// An arrow function's parameters, or a declared function's or method's.
|
|
210
200
|
const isParameterList = (open: number, close: number) => {
|
|
211
201
|
const before = at(open - 1);
|
|
212
202
|
if (isWord(before, "function") || isWord(before, "constructor")) return true;
|
|
@@ -244,7 +234,6 @@ export function scriptTokens(lines: readonly (readonly PrismToken[])[]): CodeTok
|
|
|
244
234
|
}
|
|
245
235
|
let inImport = false;
|
|
246
236
|
let constPattern = 0;
|
|
247
|
-
// `Map<string, number>`: Shiki draws type-argument brackets plain, Prism as operators.
|
|
248
237
|
let generic = 0;
|
|
249
238
|
for (let position = 0; position < sig.length; position += 1) {
|
|
250
239
|
const piece = at(position);
|
|
@@ -252,7 +241,6 @@ export function scriptTokens(lines: readonly (readonly PrismToken[])[]): CodeTok
|
|
|
252
241
|
const previous = at(position - 1);
|
|
253
242
|
if (piece.role === "keyword" && piece.content === "import") inImport = true;
|
|
254
243
|
if (piece.role === "keyword" && piece.content === "from") inImport = false;
|
|
255
|
-
// `const { a, b } = …`: every name in the pattern.
|
|
256
244
|
if (isWord(previous, "const") && (piece.content === "{" || piece.content === "[")) constPattern = 1;
|
|
257
245
|
else if (constPattern > 0 && (piece.content === "{" || piece.content === "[")) constPattern += 1;
|
|
258
246
|
else if (constPattern > 0 && (piece.content === "}" || piece.content === "]")) constPattern -= 1;
|
|
@@ -285,16 +273,13 @@ function mergeLines(pieces: ReadonlyArray<CodeToken & { line: number }>, count:
|
|
|
285
273
|
return out;
|
|
286
274
|
}
|
|
287
275
|
|
|
288
|
-
/** Shell words Shiki colours as keywords. */
|
|
289
276
|
const SHELL_KEYWORDS = new Set([
|
|
290
277
|
"if", "then", "else", "elif", "fi", "for", "while", "until", "do", "done", "case", "esac", "in",
|
|
291
278
|
"function", "select", "break", "continue", "return", "export", "local", "readonly", "declare",
|
|
292
279
|
]);
|
|
293
280
|
|
|
294
|
-
/** After these a new command starts. */
|
|
295
281
|
const SHELL_COMMAND_KEYWORDS = new Set(["then", "else", "do", "if", "while", "until", "elif"]);
|
|
296
282
|
|
|
297
|
-
/** Shell builtins Shiki colours as constants (`support.function.builtin`). */
|
|
298
283
|
const SHELL_BUILTINS = new Set([
|
|
299
284
|
"echo", "cd", "printf", "source", "set", "unset", "exit", "pwd", "read", "eval", "exec", "shift",
|
|
300
285
|
"trap", "wait", "type", "alias", "unalias", "true", "false", "test", "ulimit", "umask", "kill",
|
|
@@ -319,9 +304,7 @@ export function shellTokens(code: string): CodeToken[][] {
|
|
|
319
304
|
};
|
|
320
305
|
let index = 0;
|
|
321
306
|
let command = true;
|
|
322
|
-
// `for NAME in`: the name is plain, then `in` is a keyword.
|
|
323
307
|
let forState: "none" | "name" | "in" = "none";
|
|
324
|
-
// Inside `[ … ]` Shiki draws test operators (`-f`) as keywords and words plain.
|
|
325
308
|
let inTest = false;
|
|
326
309
|
while (index < source.length) {
|
|
327
310
|
const rest = source.slice(index);
|
|
@@ -336,7 +319,6 @@ export function shellTokens(code: string): CodeToken[][] {
|
|
|
336
319
|
break;
|
|
337
320
|
}
|
|
338
321
|
if (rest.startsWith('"')) {
|
|
339
|
-
// Double quotes: the string colour, with `$VAR` and `${VAR}` names plain.
|
|
340
322
|
const end = rest.slice(1).search(/(?<!\\)"/);
|
|
341
323
|
const text = end < 0 ? rest : rest.slice(0, end + 2);
|
|
342
324
|
for (const part of text.split(/(\$\{[^}]*\}|\$[A-Za-z_]\w*)/)) {
|
|
@@ -362,7 +344,6 @@ export function shellTokens(code: string): CodeToken[][] {
|
|
|
362
344
|
const operator = /^(?:\d?>>?&?\d?|<|\|\||\||&&|;|&|\$\(|\(|\)|`)/.exec(rest);
|
|
363
345
|
if (operator) {
|
|
364
346
|
const text = operator[0];
|
|
365
|
-
// Shiki: `|`, `||` and redirects in the keyword colour, `&&` and `;` plain.
|
|
366
347
|
push(text, text === "&&" || text === ";" || text === "$(" || text === "(" || text === ")" || text === "`" ? "plain" : "keyword");
|
|
367
348
|
index += text.length;
|
|
368
349
|
command = text !== ")" && !/^\d?>/.test(text) && text !== "<";
|
|
@@ -384,7 +365,6 @@ export function shellTokens(code: string): CodeToken[][] {
|
|
|
384
365
|
forState = word === "for" ? "name" : "none";
|
|
385
366
|
continue;
|
|
386
367
|
}
|
|
387
|
-
// A test's brackets are plain, and what follows them is not a command.
|
|
388
368
|
if (word === "[" || word === "[[" || word === "]" || word === "]]") {
|
|
389
369
|
push(word, "plain");
|
|
390
370
|
command = false;
|
package/src/index.ts
CHANGED
|
@@ -5,12 +5,18 @@ export {
|
|
|
5
5
|
useNativeUi,
|
|
6
6
|
useLargerText,
|
|
7
7
|
useAccentColor,
|
|
8
|
+
useSurface,
|
|
8
9
|
DEFAULT_ACCENT,
|
|
9
10
|
} from "./theme";
|
|
10
|
-
export type { NativeUiTheme } from "./theme";
|
|
11
|
+
export type { NativeUiTheme, NativeUiSurface } from "./theme";
|
|
11
12
|
export { palette, withAlpha } from "./palette";
|
|
12
13
|
export type { Palette } from "./palette";
|
|
13
14
|
export { configureTheme } from "./configureTheme";
|
|
15
|
+
export { NEUTRAL_PALETTE, NEUTRAL_CHANNELS, paintDarkFamily } from "./neutralTheme";
|
|
16
|
+
export type { PaintDarkFamilyOverrides } from "./neutralTheme";
|
|
17
|
+
export { parseThemeMode } from "./themeModes";
|
|
18
|
+
export { createThemeModeStore } from "./themeModeStore";
|
|
19
|
+
export type { ThemeModeStorage, ThemeModeStore, ThemeModeStoreOptions } from "./themeModeStore";
|
|
14
20
|
export type { ThemeConfig, ThemeColors, ThemePalette } from "./configureTheme";
|
|
15
21
|
export { fontClass, fontFamily } from "./typography";
|
|
16
22
|
export type { ThemeFonts } from "./typography";
|
|
@@ -266,7 +272,6 @@ export type {
|
|
|
266
272
|
ProjectVLinking,
|
|
267
273
|
} from "./settings/projectVMobileApps";
|
|
268
274
|
export { PINK_50, PINK_100, PINK_600, PINK_700, NEUTRAL_100, NEUTRAL_500, NEUTRAL_900, Colors } from "./colors";
|
|
269
|
-
// Family app marks and their pure data (copied from `@vvedantb/ui/brand`), and `GoogleMark`.
|
|
270
275
|
export * from "./brand";
|
|
271
276
|
export { UpgradeToProCard } from "./marketing/UpgradeToProCard";
|
|
272
277
|
export type { UpgradeToProCardProps } from "./marketing/UpgradeToProCard";
|
package/src/loadingGrid.ts
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The web `LoadingState` `Drive` pixel grid (`packages/ui/src/ui/loading-state.tsx`)
|
|
3
|
-
* as plain numbers, so the timing stays testable apart from Reanimated. Each
|
|
4
|
-
* function is a worklet: the grid runs it on the UI thread every frame.
|
|
5
|
-
*
|
|
6
|
-
* Nine cells in a 3x3 grid pulse in a chevron wavefront that drives right.
|
|
7
|
-
* The 650 ms cycle is shorter than the sweep (0-360 ms of delays), so two
|
|
8
|
-
* fronts are always in flight.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
1
|
/** One pulse of a cell, in ms: the web `PATTERNS.Drive.dur`. */
|
|
12
2
|
export const DRIVE_CYCLE_MS = 650;
|
|
13
3
|
|
|
14
|
-
/** A cell's opacity at the low and high keyframes. */
|
|
15
4
|
const LOW = 0.12;
|
|
16
5
|
const HIGH = 1;
|
|
17
6
|
/** A cell's still opacity before its delay ends: the web inline `opacity: 0.15`. */
|
|
@@ -45,7 +34,6 @@ export function cssEaseInOut(x: number): number {
|
|
|
45
34
|
"worklet";
|
|
46
35
|
if (x <= 0) return 0;
|
|
47
36
|
if (x >= 1) return 1;
|
|
48
|
-
// x(t) = 3(1-t)^2 t x1 + 3(1-t) t^2 x2 + t^3 rises with t, so bisect for t.
|
|
49
37
|
const curve = (t: number, p1: number, p2: number) =>
|
|
50
38
|
3 * (1 - t) * (1 - t) * t * p1 + 3 * (1 - t) * t * t * p2 + t * t * t;
|
|
51
39
|
let lo = 0;
|