@vvedantb/native-ui 0.37.2 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/dist/Avatar.jsx +22 -19
- package/dist/BottomSheetContainer.jsx +0 -6
- package/dist/BulkActionBar.jsx +0 -24
- package/dist/Button.jsx +92 -116
- package/dist/Card.jsx +56 -50
- package/dist/ColorSwatches.jsx +0 -6
- package/dist/Dialog.jsx +0 -12
- package/dist/DropdownMenu.jsx +0 -10
- package/dist/EmptyState.jsx +0 -3
- package/dist/ExpoWebRoot.jsx +0 -6
- package/dist/Field.jsx +0 -17
- package/dist/FloatingSurface.jsx +95 -80
- package/dist/FloatingTabBar.jsx +0 -23
- package/dist/IconButton.jsx +0 -1
- package/dist/LoadingState.jsx +0 -6
- package/dist/PasswordInput.jsx +0 -15
- package/dist/PillTabs.jsx +39 -36
- package/dist/SearchInput.jsx +0 -13
- package/dist/SectionLabel.jsx +0 -1
- package/dist/SharedTransition.jsx +0 -3
- package/dist/Skeleton.jsx +0 -2
- package/dist/Spinner.jsx +0 -2
- package/dist/StatusDot.jsx +0 -5
- package/dist/Switch.jsx +32 -22
- package/dist/Tabs.jsx +27 -26
- package/dist/Textarea.jsx +0 -1
- package/dist/ThemeToggle.jsx +0 -1
- package/dist/Toast.jsx +80 -91
- package/dist/UpdateChecker.jsx +0 -1
- package/dist/ai/activity-question.jsx +0 -6
- package/dist/ai/activity-step-label.js +0 -6
- package/dist/ai/activity-step-types.js +0 -4
- package/dist/ai/activity-tasks-utils.js +0 -17
- package/dist/ai/activity-timeline.js +0 -8
- package/dist/ai/attachments.jsx +0 -2
- package/dist/ai/chain-of-thought.jsx +0 -3
- package/dist/ai/chat-text.js +0 -1
- package/dist/ai/chat-thread.jsx +0 -1
- package/dist/ai/choice-question.jsx +0 -10
- package/dist/ai/code-block.jsx +0 -31
- package/dist/ai/collapsible.jsx +0 -14
- package/dist/ai/conversation-context.js +0 -3
- package/dist/ai/conversation.jsx +2 -48
- package/dist/ai/file-chip.jsx +0 -2
- package/dist/ai/icon-button.jsx +0 -8
- package/dist/ai/index.js +0 -5
- package/dist/ai/message-context-menu.jsx +0 -7
- package/dist/ai/message.jsx +0 -21
- package/dist/ai/prompt-input-menu.jsx +0 -3
- package/dist/ai/prompt-input.jsx +0 -27
- package/dist/ai/response-text.jsx +0 -6
- package/dist/ai/sources.jsx +0 -1
- package/dist/ai/suggestion.jsx +0 -1
- package/dist/ai/trace.jsx +0 -11
- package/dist/ai/unified-diff.jsx +0 -4
- package/dist/app-root/AuthGroupGate.jsx +65 -0
- package/dist/app-root/SsoCallbackScreen.jsx +97 -0
- package/dist/app-root/fonts.js +88 -0
- package/dist/app-root/index.js +3 -0
- package/dist/auth/AuthScreen.jsx +250 -77
- package/dist/auth/GoogleSignInButton.jsx +0 -3
- package/dist/auth/SecondFactorScreen.jsx +18 -14
- package/dist/auth/SignInScreen.jsx +40 -34
- package/dist/auth/authErrors.js +0 -4
- package/dist/auth/clerkCore3.js +0 -7
- package/dist/auth/index.js +0 -4
- package/dist/auth/totp.js +0 -2
- package/dist/brand/GoogleMark.jsx +0 -1
- package/dist/brand/ProviderIcon.jsx +0 -2
- package/dist/brand/index.js +0 -3
- package/dist/brand/svg.js +0 -6
- package/dist/configureTheme.js +0 -9
- package/dist/controlStyles.js +0 -14
- package/dist/crash/LastCrashDialog.jsx +56 -0
- package/dist/crash/lastCrash.js +192 -0
- package/dist/entries/ai.js +0 -3
- package/dist/entries/ambient.js +0 -2
- package/dist/entries/app-root.js +1 -0
- package/dist/entries/auth.js +0 -4
- package/dist/entries/bottom-sheet.js +0 -2
- package/dist/entries/brand.js +0 -1
- package/dist/entries/button.js +0 -1
- package/dist/entries/crash.js +2 -0
- package/dist/entries/date-time.js +0 -2
- package/dist/entries/expo-router.js +0 -3
- package/dist/entries/expo-web-root.js +0 -2
- package/dist/entries/floating.js +0 -2
- package/dist/entries/generative-ui.js +0 -4
- package/dist/entries/gesture-handler.js +0 -3
- package/dist/entries/keyboard-controller.js +0 -3
- package/dist/entries/layout.js +0 -2
- package/dist/entries/markdown.js +0 -3
- package/dist/entries/marketing.js +0 -1
- package/dist/entries/page-title.js +0 -5
- package/dist/entries/password-input.js +0 -2
- package/dist/entries/paste-input.js +0 -3
- package/dist/entries/primitives.js +0 -6
- package/dist/entries/search-input.js +0 -2
- package/dist/entries/tab-bar.js +0 -2
- package/dist/entries/theme.js +4 -2
- package/dist/entries/toast.js +0 -3
- package/dist/entries/video.js +0 -2
- package/dist/entries/webview.js +0 -2
- package/dist/examples/AiChatGallery.jsx +0 -11
- package/dist/examples/ParityGallery.jsx +0 -12
- package/dist/floating.js +0 -8
- package/dist/generative-ui/GenerativeUiPanel.jsx +0 -2
- package/dist/generative-ui/components.jsx +0 -8
- package/dist/glass.js +55 -0
- package/dist/glassBlur.jsx +0 -12
- package/dist/highlight.js +0 -26
- package/dist/index.js +4 -2
- package/dist/loadingGrid.js +0 -13
- package/dist/markdown/Markdown.jsx +0 -59
- package/dist/markdown/MarkdownTable.jsx +0 -18
- package/dist/markdown/tableText.js +0 -5
- package/dist/marketing/UpgradeToProCard.jsx +0 -5
- package/dist/marketing/pricing.js +0 -3
- package/dist/media/ImageGallery.jsx +0 -16
- package/dist/media/imageZoom.js +0 -4
- package/dist/media/zoom-image-gesture.jsx +0 -8
- package/dist/media/zoomImage.js +0 -3
- package/dist/motion.js +0 -3
- package/dist/neutralTheme.js +158 -0
- package/dist/pagerSwipe.js +0 -16
- package/dist/palette.js +0 -10
- package/dist/primitives/button.jsx +0 -5
- package/dist/primitives/icon.jsx +0 -4
- package/dist/primitives/keyboard-controller.jsx +0 -27
- package/dist/primitives/native-only-animated-view.jsx +0 -5
- package/dist/primitives/overlay.jsx +0 -2
- package/dist/primitives/pager-gesture.jsx +3 -29
- package/dist/primitives/paste-input.jsx +0 -5
- package/dist/primitives/select.jsx +0 -10
- package/dist/primitives/sheet-drag.jsx +0 -3
- package/dist/primitives/sheet-gesture.jsx +0 -8
- package/dist/primitives/swipe-row-gesture.jsx +3 -45
- package/dist/primitives/text.jsx +0 -5
- package/dist/primitives/toast-drag-gesture.jsx +4 -24
- package/dist/primitives/web-click-guard.js +0 -3
- package/dist/primitives/window-layer.jsx +0 -14
- package/dist/push.js +0 -6
- package/dist/relativeTime.js +0 -13
- package/dist/settings/MoreFromProjectV.jsx +0 -5
- package/dist/settings/ThemeModePicker.jsx +2 -9
- package/dist/settings/projectVMobileApps.js +1 -6
- package/dist/sheetDrag.js +0 -10
- package/dist/swipeRow.js +0 -15
- package/dist/tabBarRoutes.js +0 -4
- package/dist/tabIndicator.js +0 -4
- package/dist/tailwind-preset.cjs +0 -54
- package/dist/tailwind-preset.d.cts +0 -8
- package/dist/theme.jsx +29 -21
- package/dist/themeModeStore.js +62 -0
- package/dist/themeModes.js +9 -0
- package/dist/toastChrome.js +0 -6
- package/dist/toastDrag.js +0 -14
- package/dist/toastStore.js +0 -4
- package/dist/updateCheck.js +0 -7
- package/dist/video/InlineVideo.jsx +0 -2
- package/dist/webview/htmlView.js +0 -5
- package/package.json +47 -19
- package/src/ArtifactList.tsx +0 -2
- package/src/Avatar.tsx +3 -3
- package/src/Badge.tsx +0 -1
- package/src/BottomSheetContainer.tsx +0 -11
- package/src/BulkActionBar.tsx +0 -66
- package/src/Button.tsx +4 -40
- package/src/CaptureButton.tsx +0 -1
- package/src/Card.tsx +3 -15
- package/src/Checkbox.tsx +0 -2
- package/src/ColorSwatches.tsx +0 -9
- package/src/ConfirmDialog.tsx +0 -7
- package/src/DateTimeField.tsx +0 -5
- package/src/Dialog.tsx +0 -27
- package/src/DividedList.tsx +0 -1
- package/src/DropdownMenu.tsx +0 -51
- package/src/EmptyState.tsx +0 -5
- package/src/ExpoWebRoot.tsx +0 -10
- package/src/Field.tsx +0 -14
- package/src/FloatingFAB.tsx +0 -3
- package/src/FloatingSurface.tsx +11 -8
- package/src/FloatingTabBar.tsx +0 -25
- package/src/IconButton.tsx +0 -5
- package/src/Input.tsx +0 -1
- package/src/Label.tsx +0 -1
- package/src/LabeledSwitchRow.tsx +0 -2
- package/src/ListRow.tsx +0 -12
- package/src/LoadingState.tsx +0 -12
- package/src/MenuSheet.tsx +0 -2
- package/src/PageIndicator.tsx +0 -2
- package/src/PageTitle.tsx +0 -15
- package/src/Pager.tsx +0 -9
- package/src/PasswordInput.tsx +0 -24
- package/src/PillTabs.tsx +3 -11
- package/src/PinnedBotTile.tsx +0 -6
- package/src/Progress.tsx +0 -3
- package/src/ReactionRow.tsx +0 -8
- package/src/ScreenContainer.tsx +0 -4
- package/src/SearchInput.tsx +0 -25
- package/src/SectionLabel.tsx +0 -2
- package/src/Select.tsx +0 -6
- package/src/Separator.tsx +0 -2
- package/src/SharedTransition.tsx +0 -7
- package/src/Sheet.tsx +0 -3
- package/src/SheetRow.tsx +0 -12
- package/src/Skeleton.tsx +0 -10
- package/src/Spinner.tsx +0 -6
- package/src/StackPageHeader.tsx +0 -16
- package/src/StatGrid.tsx +0 -1
- package/src/StatusDot.tsx +0 -6
- package/src/SurfaceRow.tsx +0 -12
- package/src/SwipeableRow.tsx +0 -4
- package/src/Switch.tsx +3 -4
- package/src/Tabs.tsx +3 -27
- package/src/Textarea.tsx +0 -2
- package/src/ThemeToggle.tsx +0 -1
- package/src/Toast.tsx +3 -19
- package/src/UpdateChecker.tsx +0 -46
- package/src/ai/activity-question.tsx +0 -8
- package/src/ai/activity-step-detail.tsx +0 -5
- package/src/ai/activity-step-label.ts +0 -5
- package/src/ai/activity-step-types.ts +0 -24
- package/src/ai/activity-step.tsx +0 -4
- package/src/ai/activity-tasks-utils.ts +0 -13
- package/src/ai/activity-timeline.ts +0 -6
- package/src/ai/attachments.tsx +0 -13
- package/src/ai/chain-of-thought.tsx +0 -5
- package/src/ai/chat-jump-rail.tsx +0 -2
- package/src/ai/chat-text.ts +0 -1
- package/src/ai/chat-thread.tsx +0 -9
- package/src/ai/choice-question.tsx +0 -36
- package/src/ai/code-block.tsx +0 -52
- package/src/ai/collapsible.tsx +0 -12
- package/src/ai/conversation-context.ts +0 -14
- package/src/ai/conversation.tsx +0 -58
- package/src/ai/file-chip.tsx +0 -1
- package/src/ai/icon-button.tsx +0 -17
- package/src/ai/index.ts +0 -5
- package/src/ai/message-action-sheet.tsx +0 -8
- package/src/ai/message-context-menu.tsx +0 -22
- package/src/ai/message-quote.tsx +0 -4
- package/src/ai/message.tsx +0 -66
- package/src/ai/prompt-input-menu.tsx +0 -19
- package/src/ai/prompt-input.tsx +0 -97
- package/src/ai/reasoning.tsx +0 -6
- package/src/ai/reply-quote-chip.tsx +0 -5
- package/src/ai/response-text.tsx +0 -8
- package/src/ai/shimmer.tsx +0 -2
- package/src/ai/sources.tsx +0 -3
- package/src/ai/subagent-cards.tsx +0 -13
- package/src/ai/suggestion.tsx +0 -4
- package/src/ai/tool-approval-card.tsx +0 -14
- package/src/ai/trace.tsx +0 -23
- package/src/ai/unified-diff.tsx +0 -16
- package/src/ai/use-streaming-disclosure.ts +0 -4
- package/src/app-root/AuthGroupGate.tsx +38 -0
- package/src/app-root/SsoCallbackScreen.tsx +52 -0
- package/src/app-root/fonts.ts +53 -0
- package/src/app-root/index.ts +6 -0
- package/src/auth/AccountScreens.tsx +0 -16
- package/src/auth/AuthProviders.tsx +0 -13
- package/src/auth/AuthScreen.tsx +95 -6
- package/src/auth/GoogleSignInButton.tsx +0 -12
- package/src/auth/SecondFactorScreen.tsx +17 -15
- package/src/auth/SignInScreen.tsx +103 -105
- package/src/auth/authErrors.ts +0 -6
- package/src/auth/clerkCore3.ts +0 -6
- package/src/auth/index.ts +0 -4
- package/src/auth/totp.ts +0 -13
- package/src/brand/AppIcons.tsx +0 -6
- package/src/brand/AppMark.tsx +0 -5
- package/src/brand/AppWordmark.tsx +0 -7
- package/src/brand/GoogleMark.tsx +0 -4
- package/src/brand/ProviderIcon.tsx +0 -6
- package/src/brand/familyApps.ts +0 -2
- package/src/brand/index.ts +0 -3
- package/src/brand/svg.ts +0 -9
- package/src/configureTheme.ts +0 -10
- package/src/controlStyles.ts +0 -12
- package/src/crash/LastCrashDialog.tsx +36 -0
- package/src/crash/lastCrash.ts +218 -0
- package/src/entries/ai.ts +0 -3
- package/src/entries/ambient.ts +0 -2
- package/src/entries/app-root.ts +1 -0
- package/src/entries/auth.ts +0 -4
- package/src/entries/bottom-sheet.ts +0 -2
- package/src/entries/brand.ts +0 -1
- package/src/entries/button.ts +0 -1
- package/src/entries/crash.ts +13 -0
- package/src/entries/date-time.ts +0 -2
- package/src/entries/expo-router.ts +0 -3
- package/src/entries/expo-web-root.ts +0 -2
- package/src/entries/floating.ts +0 -2
- package/src/entries/generative-ui.ts +0 -4
- package/src/entries/gesture-handler.ts +0 -3
- package/src/entries/keyboard-controller.ts +0 -3
- package/src/entries/layout.ts +0 -2
- package/src/entries/markdown.ts +0 -3
- package/src/entries/marketing.ts +0 -1
- package/src/entries/page-title.ts +0 -5
- package/src/entries/password-input.ts +0 -2
- package/src/entries/paste-input.ts +0 -3
- package/src/entries/primitives.ts +0 -6
- package/src/entries/search-input.ts +0 -2
- package/src/entries/tab-bar.ts +0 -2
- package/src/entries/theme.ts +8 -2
- package/src/entries/toast.ts +0 -3
- package/src/entries/video.ts +0 -2
- package/src/entries/webview.ts +0 -2
- package/src/examples/AiChatGallery.tsx +0 -11
- package/src/examples/ParityGallery.tsx +0 -25
- package/src/floating.ts +0 -6
- package/src/generative-ui/GenerativeUiPanel.tsx +0 -15
- package/src/generative-ui/components.tsx +0 -9
- package/src/generative-ui/context.ts +0 -2
- package/src/glass.ts +31 -0
- package/src/glassBlur.tsx +0 -15
- package/src/highlight.ts +1 -21
- package/src/index.ts +7 -2
- package/src/loadingGrid.ts +0 -12
- package/src/markdown/Markdown.tsx +0 -71
- package/src/markdown/MarkdownTable.tsx +0 -23
- package/src/markdown/tableText.ts +0 -3
- package/src/marketing/PricingModal.tsx +0 -13
- package/src/marketing/UpgradeToProCard.tsx +0 -14
- package/src/marketing/pricing.ts +0 -12
- package/src/media/ImageGallery.tsx +0 -18
- package/src/media/MediaCard.tsx +0 -8
- package/src/media/imageZoom.ts +0 -4
- package/src/media/zoom-image-gesture.tsx +0 -9
- package/src/media/zoomImage.ts +0 -5
- package/src/motion.ts +0 -3
- package/src/neutralTheme.ts +127 -0
- package/src/pagerSwipe.ts +0 -13
- package/src/palette.ts +0 -10
- package/src/pressScale.ts +0 -7
- package/src/primitives/button.tsx +0 -4
- package/src/primitives/card.tsx +0 -1
- package/src/primitives/icon.tsx +0 -2
- package/src/primitives/input.tsx +0 -4
- package/src/primitives/keyboard-controller.tsx +0 -25
- package/src/primitives/keyboard-parts.tsx +0 -27
- package/src/primitives/native-only-animated-view.tsx +0 -5
- package/src/primitives/overlay.tsx +0 -25
- package/src/primitives/pager-gesture.tsx +0 -20
- package/src/primitives/paste-input.tsx +0 -4
- package/src/primitives/paste-parts.tsx +0 -1
- package/src/primitives/select.tsx +0 -18
- package/src/primitives/sheet-drag.tsx +0 -19
- package/src/primitives/sheet-gesture.tsx +0 -22
- package/src/primitives/swipe-row-gesture.tsx +0 -33
- package/src/primitives/switch.tsx +0 -4
- package/src/primitives/text.tsx +0 -4
- package/src/primitives/toast-drag-gesture.tsx +0 -13
- package/src/primitives/web-click-guard.ts +0 -2
- package/src/primitives/window-layer.tsx +0 -18
- package/src/push.ts +0 -15
- package/src/relativeTime.ts +0 -21
- package/src/router/RouterStackPageHeader.tsx +0 -1
- package/src/settings/MoreFromProjectV.tsx +0 -8
- package/src/settings/SettingsEmptyState.tsx +0 -2
- package/src/settings/SettingsSection.tsx +0 -3
- package/src/settings/SettingsToggleRow.tsx +0 -4
- package/src/settings/ThemeModePicker.tsx +2 -16
- package/src/settings/projectVMobileApps.ts +0 -8
- package/src/sheetDrag.ts +0 -9
- package/src/swipeRow.ts +0 -23
- package/src/tabBarRoutes.ts +0 -13
- package/src/tabIndicator.ts +0 -5
- package/src/tailwind-preset.cjs +0 -54
- package/src/tailwind-preset.d.cts +0 -8
- package/src/theme.tsx +11 -2
- package/src/themeModeStore.ts +85 -0
- package/src/themeModes.ts +10 -0
- package/src/toastChrome.ts +0 -6
- package/src/toastDrag.ts +0 -13
- package/src/toastStore.ts +0 -7
- package/src/updateCheck.ts +0 -15
- package/src/video/InlineVideo.tsx +0 -5
- package/src/webview/HtmlView.tsx +0 -23
- package/src/webview/HtmlView.web.tsx +0 -1
- package/src/webview/htmlView.ts +0 -5
- package/types/prism-react-renderer.d.ts +22 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { useSyncExternalStore } from "react";
|
|
2
|
+
|
|
3
|
+
/** Where the crash is kept between launches, for example `expo-secure-store`. */
|
|
4
|
+
|
|
5
|
+
/** What a fatal error leaves behind for the next launch. */
|
|
6
|
+
|
|
7
|
+
const KEY = "v.lastCrash";
|
|
8
|
+
const MAX_CHARS = 1_800;
|
|
9
|
+
const FATAL_SAVE_MS = 1_000;
|
|
10
|
+
let secureStore;
|
|
11
|
+
function defaultStorage() {
|
|
12
|
+
if (secureStore === undefined) {
|
|
13
|
+
try {
|
|
14
|
+
const store = require("expo-secure-store");
|
|
15
|
+
secureStore = {
|
|
16
|
+
getItem: key => store.getItemAsync(key),
|
|
17
|
+
setItem: (key, value) => store.setItemAsync(key, value),
|
|
18
|
+
removeItem: key => store.deleteItemAsync(key)
|
|
19
|
+
};
|
|
20
|
+
} catch {
|
|
21
|
+
secureStore = null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return secureStore;
|
|
25
|
+
}
|
|
26
|
+
function defaultVersion() {
|
|
27
|
+
try {
|
|
28
|
+
const constants = require("expo-constants");
|
|
29
|
+
return constants.default?.expoConfig?.version ?? "?";
|
|
30
|
+
} catch {
|
|
31
|
+
return "?";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
let settings = null;
|
|
35
|
+
const current = () => settings ??= {
|
|
36
|
+
storage: defaultStorage(),
|
|
37
|
+
version: defaultVersion()
|
|
38
|
+
};
|
|
39
|
+
let last = null;
|
|
40
|
+
const listeners = new Set();
|
|
41
|
+
function publish(next) {
|
|
42
|
+
last = next;
|
|
43
|
+
for (const listener of listeners) listener();
|
|
44
|
+
}
|
|
45
|
+
const text = value => typeof value === "string" && value ? value : undefined;
|
|
46
|
+
const field = (caught, name) => typeof caught === "object" && caught !== null ? text(caught[name]) : undefined;
|
|
47
|
+
|
|
48
|
+
/** The name, message and a short stack of a thrown value. Never the value itself. */
|
|
49
|
+
export function fatalReport(caught) {
|
|
50
|
+
return {
|
|
51
|
+
name: field(caught, "name") ?? "Error",
|
|
52
|
+
message: (field(caught, "message") ?? String(caught)).slice(0, 500),
|
|
53
|
+
stack: (field(caught, "stack") ?? "").split("\n").slice(0, 15).join("\n")
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function isLastCrash(value) {
|
|
57
|
+
if (typeof value !== "object" || value === null) return false;
|
|
58
|
+
const crash = value;
|
|
59
|
+
return typeof crash.at === "number" && ["version", "name", "message", "stack"].every(key => typeof crash[key] === "string");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Saves the report for the next launch. Never throws. */
|
|
63
|
+
export async function saveLastCrash(report) {
|
|
64
|
+
try {
|
|
65
|
+
const {
|
|
66
|
+
storage,
|
|
67
|
+
version
|
|
68
|
+
} = current();
|
|
69
|
+
if (!storage) return;
|
|
70
|
+
const crash = {
|
|
71
|
+
at: Date.now(),
|
|
72
|
+
version,
|
|
73
|
+
...report
|
|
74
|
+
};
|
|
75
|
+
let json = JSON.stringify(crash);
|
|
76
|
+
if (json.length > MAX_CHARS) {
|
|
77
|
+
json = JSON.stringify({
|
|
78
|
+
...crash,
|
|
79
|
+
stack: crash.stack.slice(0, Math.max(0, MAX_CHARS - (json.length - crash.stack.length)))
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
await storage.setItem(KEY, json);
|
|
83
|
+
} catch {}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Reads the saved crash, so `LastCrashDialog` shows it. Never throws. */
|
|
87
|
+
export async function loadLastCrash() {
|
|
88
|
+
try {
|
|
89
|
+
const saved = await current().storage?.getItem(KEY);
|
|
90
|
+
const parsed = saved ? JSON.parse(saved) : null;
|
|
91
|
+
if (isLastCrash(parsed)) publish(parsed);
|
|
92
|
+
} catch {}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Shows `crash` in `LastCrashDialog` without saving it. For the gallery. */
|
|
96
|
+
export function showLastCrash(crash) {
|
|
97
|
+
publish(crash);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Forgets the shown crash. */
|
|
101
|
+
export function dismissLastCrash() {
|
|
102
|
+
publish(null);
|
|
103
|
+
void current().storage?.removeItem(KEY).catch(() => {});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** The crash saved by the last session, or `null`. */
|
|
107
|
+
export function useLastCrash() {
|
|
108
|
+
return useSyncExternalStore(_temp, _temp2, _temp3);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** The text Copy puts on the clipboard. */
|
|
112
|
+
function _temp3() {
|
|
113
|
+
return last;
|
|
114
|
+
}
|
|
115
|
+
function _temp2() {
|
|
116
|
+
return last;
|
|
117
|
+
}
|
|
118
|
+
function _temp(listener) {
|
|
119
|
+
listeners.add(listener);
|
|
120
|
+
return () => listeners.delete(listener);
|
|
121
|
+
}
|
|
122
|
+
export function crashDetails(crash, appName) {
|
|
123
|
+
return [`${appName} ${crash.version}, ${new Date(crash.at).toISOString()}`, `${crash.name}: ${crash.message}`, crash.stack].join("\n");
|
|
124
|
+
}
|
|
125
|
+
function errorUtilsOf(env) {
|
|
126
|
+
const value = env.ErrorUtils;
|
|
127
|
+
return typeof value?.getGlobalHandler === "function" && typeof value.setGlobalHandler === "function" ? value : null;
|
|
128
|
+
}
|
|
129
|
+
function trackerOf(env) {
|
|
130
|
+
const tracker = env.HermesInternal?.enablePromiseRejectionTracker;
|
|
131
|
+
return typeof tracker === "function" ? tracker : null;
|
|
132
|
+
}
|
|
133
|
+
function logUncaught(kind, caught, isFatal) {
|
|
134
|
+
try {
|
|
135
|
+
const report = fatalReport(caught);
|
|
136
|
+
console.error("[uncaught]", {
|
|
137
|
+
kind,
|
|
138
|
+
isFatal,
|
|
139
|
+
errorName: report.name,
|
|
140
|
+
errorMessage: report.message.slice(0, 200),
|
|
141
|
+
stack: report.stack.split("\n").slice(0, 6).join("\n")
|
|
142
|
+
});
|
|
143
|
+
} catch {}
|
|
144
|
+
}
|
|
145
|
+
let installed = false;
|
|
146
|
+
/**
|
|
147
|
+
* Call once at the top of the root layout, outside any component. It:
|
|
148
|
+
* - logs unhandled promise rejections and uncaught errors to `console.error`,
|
|
149
|
+
* which release builds otherwise swallow;
|
|
150
|
+
* - saves a fatal error before the app closes (waiting at most one second);
|
|
151
|
+
* - loads the crash the last session saved, for `LastCrashDialog`.
|
|
152
|
+
* Installs once; later calls return `false`. Never throws.
|
|
153
|
+
*/
|
|
154
|
+
export function installCrashCapture(options = {}) {
|
|
155
|
+
if (installed) return false;
|
|
156
|
+
try {
|
|
157
|
+
installed = true;
|
|
158
|
+
settings = {
|
|
159
|
+
storage: options.storage === undefined ? defaultStorage() : options.storage,
|
|
160
|
+
version: options.version ?? defaultVersion()
|
|
161
|
+
};
|
|
162
|
+
const env = options.env ?? globalThis;
|
|
163
|
+
trackerOf(env)?.({
|
|
164
|
+
allRejections: true,
|
|
165
|
+
onUnhandled: (_id, error) => logUncaught("unhandled-rejection", error)
|
|
166
|
+
});
|
|
167
|
+
const errorUtils = errorUtilsOf(env);
|
|
168
|
+
if (errorUtils) {
|
|
169
|
+
const previous = errorUtils.getGlobalHandler();
|
|
170
|
+
errorUtils.setGlobalHandler((error, isFatal) => {
|
|
171
|
+
logUncaught("uncaught-error", error, isFatal);
|
|
172
|
+
if (!isFatal) {
|
|
173
|
+
previous(error, isFatal);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const timeout = new Promise(resolve => setTimeout(resolve, FATAL_SAVE_MS));
|
|
177
|
+
void Promise.race([saveLastCrash(fatalReport(error)), timeout]).finally(() => previous(error, isFatal));
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
void loadLastCrash();
|
|
181
|
+
return true;
|
|
182
|
+
} catch {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** For tests only. */
|
|
188
|
+
export function resetCrashCaptureForTests() {
|
|
189
|
+
installed = false;
|
|
190
|
+
settings = null;
|
|
191
|
+
publish(null);
|
|
192
|
+
}
|
package/dist/entries/ai.js
CHANGED
package/dist/entries/ambient.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../app-root";
|
package/dist/entries/auth.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/auth`: `AuthProviders`, `SignInScreen`, `SignUpScreen`,
|
|
2
|
-
// `GoogleSignInButton` and the auth frame. Not on the root entry: it imports
|
|
3
|
-
// `@clerk/expo`, `convex`, `expo-auth-session`, `expo-web-browser` and
|
|
4
|
-
// `expo-router`, and Metro does not tree-shake.
|
|
5
1
|
export * from "../auth";
|
package/dist/entries/brand.js
CHANGED
package/dist/entries/button.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/expo-router`: components that need `expo-router`, an
|
|
2
|
-
// optional peer. Not on the root, `/layout` or `/page-title` entries: they
|
|
3
|
-
// never import it.
|
|
4
1
|
export { RouterStackPageHeader, goBackOrReplace } from "../router/RouterStackPageHeader";
|
|
5
2
|
export { TabScreen } from "../router/TabScreen";
|
package/dist/entries/floating.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/floating`: floating surfaces, glass blur targets and
|
|
2
|
-
// metrics. Reaches `expo-blur` only through its optional-peer loader.
|
|
3
1
|
export { FLOATING_INSET, FLOATING_TAB_BAR_HEIGHT, FLOATING_TAB_BAR_HEIGHT_LARGE, FLOATING_RADIUS, FLOATING_ROW_RADIUS, FLOATING_PILL_RADIUS, floatingShadow, floatingHairline, floatingFill, floatingSolidFill, tabBarReserve } from "../floating";
|
|
4
2
|
export { useReduceTransparency } from "../useReduceTransparency";
|
|
5
3
|
export { FloatingSurface, GlassSheetBackground } from "../FloatingSurface";
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/generative-ui`: agent-composed panels from the shared
|
|
2
|
-
// catalog (`@vvedantb/server/generative-ui`), as the web
|
|
3
|
-
// `@vvedantb/ui/generative-ui`. Imports `@json-render/react-native` (an
|
|
4
|
-
// optional peer): the only entry that does, so an app without it bundles none.
|
|
5
1
|
export { GenerativeUiPanel } from "../generative-ui/GenerativeUiPanel";
|
|
6
2
|
export { generativeUiNativeCatalog } from "../generative-ui/renderer";
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/keyboard-controller`. Imports
|
|
2
|
-
// `react-native-keyboard-controller` (an optional peer): the only entry that
|
|
3
|
-
// does, so an app without it keeps React Native's `KeyboardAvoidingView`.
|
|
4
1
|
export { KeyboardControllerProvider } from "../primitives/keyboard-controller";
|
package/dist/entries/layout.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/layout`: screen containers, page headers, section
|
|
2
|
-
// labels and settings chrome.
|
|
3
1
|
export { SafeAreaContainer } from "../SafeAreaContainer";
|
|
4
2
|
export { ScreenContainer } from "../ScreenContainer";
|
|
5
3
|
export { PageTitle, PageHeader } from "../PageTitle";
|
package/dist/entries/markdown.js
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/markdown`: `Markdown`, chat markdown styled as the web
|
|
2
|
-
// `.markdown` block. Not on the root entry: it imports the optional peer
|
|
3
|
-
// `react-native-marked`, and Metro does not tree-shake.
|
|
4
1
|
export { Markdown, markdownStyles, inlineCodeStyle, MARKDOWN_SCALE, MARKDOWN_LIST } from "../markdown/Markdown";
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/page-title`: `PageTitle`, `PageHeader` and (from 0.5.0)
|
|
2
|
-
// `StackPageHeader`. Reaches no optional peer, not even a loader.
|
|
3
|
-
// `StackPageHeader` imports one Tabler icon (a required peer) for its back
|
|
4
|
-
// button; Metro does not tree-shake by default, so that bundles the Tabler
|
|
5
|
-
// package with this entry.
|
|
6
1
|
export { PageTitle, PageHeader } from "../PageTitle";
|
|
7
2
|
export { StackPageHeader } from "../StackPageHeader";
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/primitives`: fields, display, tabs, overlays and
|
|
2
|
-
// toasts. `BottomSheetContainer`, `DateTimeField` and `AmbientBackground` are
|
|
3
|
-
// not here; they have their own entries. `Text` and `TextClassContext` are the
|
|
4
|
-
// `primitives/text` variants (from 0.5.0); they are not on the root entry.
|
|
5
1
|
export { Text, TextClassContext } from "../primitives/text";
|
|
6
2
|
export { Button } from "../Button";
|
|
7
3
|
export { Input } from "../Input";
|
|
@@ -61,7 +57,5 @@ export { fetchGitHubUpdate, isNewerVersion, newerGitHubRelease } from "../update
|
|
|
61
57
|
export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHandle, SheetHeader, SheetTitle, SheetDescription, SheetBody, SheetFooter } from "../Sheet";
|
|
62
58
|
export { Toaster } from "../Toast";
|
|
63
59
|
export { toast } from "../toastStore";
|
|
64
|
-
// Shared element transitions (Reanimated 4.8): the same `tag` on two screens moves the view between them.
|
|
65
60
|
export { DEFAULT_SHARED_TRANSITION, DEFAULT_FADE_CONTENT, createSharedTransition, sharedTransitionTag, useSharedTransitionStyle, SharedTransitionView, SharedTransitionText } from "../SharedTransition";
|
|
66
|
-
// Overlays in the app's window (the hold menu, the image viewer): wrap the navigator once.
|
|
67
61
|
export { WindowLayerHost } from "../primitives/window-layer";
|
package/dist/entries/tab-bar.js
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/tab-bar`. Does not import `expo-router`; reaches
|
|
2
|
-
// `expo-blur` and `expo-haptics` only through their optional-peer loaders.
|
|
3
1
|
export { FloatingTabBar } from "../FloatingTabBar";
|
|
4
2
|
export { FLOATING_INSET, FLOATING_TAB_BAR_HEIGHT, FLOATING_TAB_BAR_HEIGHT_LARGE, tabBarReserve } from "../floating";
|
package/dist/entries/theme.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/theme`: the provider, tokens and colour helpers.
|
|
2
1
|
export { cn } from "../cn";
|
|
3
|
-
export { tokens, NativeUiProvider, useNativeUi, useLargerText, useAccentColor, DEFAULT_ACCENT } from "../theme";
|
|
2
|
+
export { tokens, NativeUiProvider, useNativeUi, useLargerText, useAccentColor, useSurface, DEFAULT_ACCENT } from "../theme";
|
|
4
3
|
export { palette, withAlpha } from "../palette";
|
|
5
4
|
export { configureTheme } from "../configureTheme";
|
|
5
|
+
export { NEUTRAL_PALETTE, NEUTRAL_CHANNELS, paintDarkFamily } from "../neutralTheme";
|
|
6
|
+
export { THEME_MODES, parseThemeMode } from "../themeModes";
|
|
7
|
+
export { createThemeModeStore } from "../themeModeStore";
|
|
6
8
|
export { fontClass, fontFamily } from "../typography";
|
|
7
9
|
export { PINK_50, PINK_100, PINK_600, PINK_700, NEUTRAL_100, NEUTRAL_500, NEUTRAL_900, Colors } from "../colors";
|
|
8
10
|
export { useScheme } from "../useScheme";
|
package/dist/entries/toast.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/toast`: `toast()` and `<Toaster />`. Reaches no heavy
|
|
2
|
-
// optional peer, not even a loader (the toast surface is flat from 0.3.12): no
|
|
3
|
-
// `expo-blur`, bottom sheet, date picker, `dayjs` or `expo-router`.
|
|
4
1
|
export { Toaster } from "../Toast";
|
|
5
2
|
export { toast } from "../toastStore";
|
package/dist/entries/video.js
CHANGED
package/dist/entries/webview.js
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
// `@vvedantb/native-ui/webview`. Imports `react-native-webview` (an optional
|
|
2
|
-
// peer): the only entry that does, so an app without it bundles no WebView.
|
|
3
1
|
export { HtmlView } from "../webview/HtmlView";
|
|
4
2
|
export { HTML_VIEW_HEIGHT_SCRIPT, htmlViewNavigation, htmlViewPostScript, parseHtmlViewHeight } from "../webview/htmlView";
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
// Reference screen for the AI chat parts (`@vvedantb/native-ui/ai`). Render
|
|
3
|
-
// `AiChatGallery` in a full-screen Expo route, with the same NativeWind setup
|
|
4
|
-
// as the rest of the package and a `SafeAreaProvider` above it. The thread is
|
|
5
|
-
// fixed sample text, not a model. It follows the app's larger-text setting.
|
|
6
|
-
// `ParityGallery` shows `AiChatSamples` in its "AI chat" section.
|
|
7
2
|
import { useState } from "react";
|
|
8
3
|
import { View } from "react-native";
|
|
9
4
|
import { IconFileText, IconPaperclip, IconSearch } from "@tabler/icons-react-native";
|
|
@@ -22,12 +17,6 @@ const FINISHED_REASONING = "The question is how to keep one list the same on two
|
|
|
22
17
|
const FINISHED_REPLY = "Keep one copy of the list on a server and have each device read and write it.\n\nWhen a device changes an item, it sends the change with a timestamp. The other device fetches changes it has not seen.";
|
|
23
18
|
const SAMPLE_CODE = `type Change = {\n itemId: string;\n updatedAt: number;\n};`;
|
|
24
19
|
const STREAMING_REASONING = "Offline edits need to wait in a queue on the device.\nWhen the connection returns, send the queue in order and merge by timestamp…";
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The sample thread: a user message, a finished assistant message (folded
|
|
28
|
-
* reasoning and trace, reply, code, sources and actions), a second user
|
|
29
|
-
* message, and an assistant message that is still working while `streaming`.
|
|
30
|
-
*/
|
|
31
20
|
const DRAFT_FIELDS = [{
|
|
32
21
|
key: "to",
|
|
33
22
|
role: "to",
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
// Reference screen for the components that mirror `@vvedantb/ui`. Render it in
|
|
3
|
-
// an Expo route to compare against the web: it needs the same NativeWind setup
|
|
4
|
-
// as the rest of the package and a `SafeAreaProvider` above it. It always
|
|
5
|
-
// renders the default sizes (larger text off), as the web does. Prices, names
|
|
6
|
-
// and figures below are placeholders, not real data.
|
|
7
2
|
import { useState } from "react";
|
|
8
3
|
import { ScrollView, Text, View } from "react-native";
|
|
9
4
|
import { IconCopy, IconDots, IconInbox, IconPencil, IconPhoto, IconRefresh, IconTrash, IconX } from "@tabler/icons-react-native";
|
|
@@ -12,16 +7,11 @@ import { typeStyle } from "../controlStyles";
|
|
|
12
7
|
import { useScheme } from "../useScheme";
|
|
13
8
|
import { ChainOfThought, ChainOfThoughtContent, ChainOfThoughtHeader, ChainOfThoughtSearchResult, ChainOfThoughtSearchResults, ChainOfThoughtStep, ConversationEmptyState, Suggestion, Suggestions } from "../ai";
|
|
14
9
|
import { AiChatSamples } from "./AiChatGallery";
|
|
15
|
-
|
|
16
|
-
// Every shared variant; the aliases (`primary`, `tertiary`, `danger`) draw as the name they alias.
|
|
17
10
|
const BUTTON_VARIANTS = ["default", "primary", "secondary", "outline", "destructive", "danger", "ghost", "tertiary", "flat", "success", "warning", "link"];
|
|
18
11
|
const BADGE_VARIANTS = ["default", "secondary", "destructive", "destructive-soft", "outline", "success", "warning"];
|
|
19
12
|
const STATUS_TONES = ["progress", "business-review", "code-review", "done", "cancelled", "active", "critical", "info", "neutral"];
|
|
20
13
|
const SWATCHES = ["#db2777", "#2563eb", "#16a34a", "#f59e0b", "#181818", "#ffffff"];
|
|
21
14
|
const SWATCH_LABELS = ["Pink", "Blue", "Green", "Amber", "Black", "White"];
|
|
22
|
-
|
|
23
|
-
// Space after the last section, so Card, Upgrade and Overlays can scroll to the
|
|
24
|
-
// top of an 844-tall phone for screenshot crops.
|
|
25
15
|
const GALLERY_END_SPACE = 720;
|
|
26
16
|
const PLANS = [{
|
|
27
17
|
id: "free",
|
|
@@ -44,8 +34,6 @@ const PLANS = [{
|
|
|
44
34
|
featured: true,
|
|
45
35
|
intro: "Everything in Free, and:"
|
|
46
36
|
}];
|
|
47
|
-
|
|
48
|
-
/** Body text in the scheme's foreground (a style, so it reads in dark mode too). */
|
|
49
37
|
function GalleryText(t0) {
|
|
50
38
|
const $ = _c(13);
|
|
51
39
|
let className;
|
package/dist/floating.js
CHANGED
|
@@ -11,14 +11,6 @@ export const FLOATING_RADIUS = tokens.radius.card;
|
|
|
11
11
|
export const FLOATING_ROW_RADIUS = 20;
|
|
12
12
|
export const FLOATING_PILL_RADIUS = tokens.radius.pill;
|
|
13
13
|
const FLOATING_BOX_SHADOW = "0px 8px 24px rgba(10, 10, 10, 0.12)";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Only the shadow keys, not `ViewStyle`: an Expo-widened `ViewStyle`
|
|
17
|
-
* (`position: "fixed"`, `backgroundImage`) is not assignable to a React
|
|
18
|
-
* Native 0.88 View `style`. A plain inferred type would be `{}` and lose
|
|
19
|
-
* `floatingShadow.shadowColor` and the rest for callers.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
14
|
export const floatingShadow = Platform.select({
|
|
23
15
|
ios: {
|
|
24
16
|
shadowColor: "#0a0a0a",
|
|
@@ -10,8 +10,6 @@ const openUrl = url => {
|
|
|
10
10
|
void Linking.openURL(url);
|
|
11
11
|
};
|
|
12
12
|
const UnsupportedContext = createContext(undefined);
|
|
13
|
-
|
|
14
|
-
/** json-render's fallback for an unknown type, drawn by the app's `renderUnsupported`. */
|
|
15
13
|
function UnsupportedElement(t0) {
|
|
16
14
|
const $ = _c(3);
|
|
17
15
|
const {
|
|
@@ -14,14 +14,6 @@ import { tokens } from "../tokens";
|
|
|
14
14
|
import { useScheme } from "../useScheme";
|
|
15
15
|
import { useGenerativeUiPanel } from "./context";
|
|
16
16
|
import { ALIGN, BADGE_VARIANT, BUTTON_VARIANT, GAP, toneSurface, toneText } from "./styles";
|
|
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
17
|
const TEXT_2XS = {
|
|
26
18
|
fontSize: 11,
|
|
27
19
|
lineHeight: 14
|
package/dist/glass.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useSurface } from "./theme";
|
|
3
|
+
import { useScheme } from "./useScheme";
|
|
4
|
+
const HIGHLIGHT = {
|
|
5
|
+
light: 0.5,
|
|
6
|
+
dark: 0.12
|
|
7
|
+
};
|
|
8
|
+
const RIM = {
|
|
9
|
+
light: 0.4,
|
|
10
|
+
dark: 0.08
|
|
11
|
+
};
|
|
12
|
+
const DROP = {
|
|
13
|
+
surface: "0px 1px 3px rgba(0, 0, 0, 0.08)",
|
|
14
|
+
control: "0px 1px 2px rgba(0, 0, 0, 0.12)",
|
|
15
|
+
small: "0px 1px 1px rgba(0, 0, 0, 0.08)"
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The glass finish as a `boxShadow` string: a thin inset rim, a soft top-left
|
|
20
|
+
* highlight and a small drop shadow. The same recipe as the web components.
|
|
21
|
+
*/
|
|
22
|
+
export function glassShadow(kind, scheme) {
|
|
23
|
+
const rim = `inset 0px 0px 0px 1px rgba(255, 255, 255, ${RIM[scheme]})`;
|
|
24
|
+
const highlight = `inset 1.5px 1.5px 1px -1px rgba(255, 255, 255, ${HIGHLIGHT[scheme]})`;
|
|
25
|
+
return `${rim}, ${highlight}, ${DROP[kind]}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** The glass style for `kind`, or `null` when `NativeUiProvider` sets `surface="flat"`. */
|
|
29
|
+
export function useGlass(kind) {
|
|
30
|
+
const $ = _c(5);
|
|
31
|
+
const scheme = useScheme();
|
|
32
|
+
if (useSurface() === "flat") {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
let t0;
|
|
36
|
+
if ($[0] !== kind || $[1] !== scheme) {
|
|
37
|
+
t0 = glassShadow(kind, scheme);
|
|
38
|
+
$[0] = kind;
|
|
39
|
+
$[1] = scheme;
|
|
40
|
+
$[2] = t0;
|
|
41
|
+
} else {
|
|
42
|
+
t0 = $[2];
|
|
43
|
+
}
|
|
44
|
+
let t1;
|
|
45
|
+
if ($[3] !== t0) {
|
|
46
|
+
t1 = {
|
|
47
|
+
boxShadow: t0
|
|
48
|
+
};
|
|
49
|
+
$[3] = t0;
|
|
50
|
+
$[4] = t1;
|
|
51
|
+
} else {
|
|
52
|
+
t1 = $[4];
|
|
53
|
+
}
|
|
54
|
+
return t1;
|
|
55
|
+
}
|
package/dist/glassBlur.jsx
CHANGED
|
@@ -2,14 +2,6 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
2
2
|
import { createContext, useContext, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { StyleSheet, View } from "react-native";
|
|
4
4
|
import { loadBlur } from "./blur";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The current blur target, outside React state. A target change (each tab
|
|
8
|
-
* switch hands it from one tab to the next) then re-renders only the glass
|
|
9
|
-
* that subscribes, not the whole tab tree under the provider: as a context
|
|
10
|
-
* value it walked every mounted tab twice per switch.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
5
|
function createBlurTargetStore() {
|
|
14
6
|
let current = null;
|
|
15
7
|
const listeners = new Set();
|
|
@@ -26,10 +18,6 @@ function createBlurTargetStore() {
|
|
|
26
18
|
}
|
|
27
19
|
};
|
|
28
20
|
}
|
|
29
|
-
|
|
30
|
-
// `null` outside a provider and inside a target (a blur view must not sit
|
|
31
|
-
// inside its own target). The value is the provider's one store, so it never
|
|
32
|
-
// changes.
|
|
33
21
|
const BlurTargetStoreContext = createContext(null);
|
|
34
22
|
const noSubscribe = () => () => {};
|
|
35
23
|
const noTarget = () => null;
|