@vvedantb/ui 0.67.0 → 0.70.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/app/src/auth/useStableAuth.ts +0 -2
- package/app/src/confirm/ConfirmSkipHint.tsx +0 -2
- package/app/src/confirm/useAltHeld.ts +0 -17
- package/app/src/convex/ConvexClerkProvider.tsx +0 -3
- package/app/src/convex/env.ts +0 -4
- package/app/src/convex/errorMessage.ts +0 -1
- package/app/src/convex/useHeldResult.ts +0 -3
- package/app/src/page-motion/PageMotionProvider.tsx +0 -6
- package/app/src/page-title/createPageTitleContext.tsx +0 -14
- package/app/src/settings/SettingsEmptyState.tsx +0 -4
- package/app/src/settings/SettingsField.tsx +0 -4
- package/app/src/settings/SettingsPage.tsx +0 -12
- package/app/src/settings/SettingsSection.tsx +0 -14
- package/app/src/settings/ThemeModePicker.tsx +0 -6
- package/app/src/theme/createThemeProvider.tsx +0 -33
- package/app/src/time/compactRelativeTime.ts +0 -16
- package/app/src/update/staleDeployReload.ts +0 -40
- package/app/src/update/updateWatcher.ts +0 -8
- package/dist/app/src/auth/useStableAuth.js +0 -1
- package/dist/app/src/confirm/ConfirmSkipHint.js +0 -3
- package/dist/app/src/confirm/useAltHeld.js +0 -17
- package/dist/app/src/convex/env.js +0 -3
- package/dist/app/src/convex/errorMessage.js +0 -2
- package/dist/app/src/settings/ThemeModePicker.js +0 -1
- package/dist/app/src/theme/createThemeProvider.js +1 -11
- package/dist/app/src/time/compactRelativeTime.js +0 -8
- package/dist/app/src/update/staleDeployReload.js +3 -38
- package/dist/app/src/update/updateWatcher.js +1 -3
- package/dist/shell/src/AppShell.js +0 -14
- package/dist/shell/src/PageHeaderBar.js +0 -3
- package/dist/shell/src/SessionsHoverCard.js +0 -9
- package/dist/shell/src/SidePanelTabs.js +0 -36
- package/dist/shell/src/Sidebar.js +0 -1
- package/dist/shell/src/SidebarChrome.js +0 -19
- package/dist/shell/src/SidebarIconTooltip.js +0 -1
- package/dist/shell/src/SidebarRail.js +0 -12
- package/dist/shell/src/SidebarResize.js +1 -4
- package/dist/shell/src/app-shell-classes.js +0 -10
- package/dist/shell/src/index.js +0 -1
- package/dist/shell/src/shell-panel-motion.js +0 -12
- package/dist/src/ai-elements/activity-shared.js +0 -6
- package/dist/src/ai-elements/activity-step-label.js +0 -6
- package/dist/src/ai-elements/activity-step-types.js +0 -4
- package/dist/src/ai-elements/activity-tasks-utils.js +0 -17
- package/dist/src/ai-elements/activity-tasks.js +0 -55
- package/dist/src/ai-elements/artifact.js +0 -4
- package/dist/src/ai-elements/attachments.js +0 -41
- package/dist/src/ai-elements/code-block.js +0 -18
- package/dist/src/ai-elements/collapsible-user-message-body.js +0 -2
- package/dist/src/ai-elements/context.js +0 -13
- package/dist/src/ai-elements/conversation.js +0 -4
- package/dist/src/ai-elements/jump-rail.js +0 -5
- package/dist/src/ai-elements/message.js +0 -7
- package/dist/src/ai-elements/model-picker-types.js +0 -1
- package/dist/src/ai-elements/model-picker.js +1 -6
- package/dist/src/ai-elements/model-selector.js +0 -4
- package/dist/src/ai-elements/prompt-input-speech.js +0 -13
- package/dist/src/ai-elements/prompt-input.js +0 -1
- package/dist/src/ai-elements/provider-icon.js +0 -4
- package/dist/src/ai-elements/queue.js +0 -15
- package/dist/src/ai-elements/shimmer.js +0 -14
- package/dist/src/ai-elements/speech-input.js +0 -7
- package/dist/src/artifacts/artifact-frame.js +0 -2
- package/dist/src/audio/playChime.js +0 -2
- package/dist/src/audio/playTone.js +1 -4
- package/dist/src/brand/AppWordmark.js +0 -5
- package/dist/src/brand/svg.js +0 -6
- package/dist/src/client.js +0 -43
- package/dist/src/composer/Composer.js +0 -27
- package/dist/src/composer/input-area/InputArea.js +0 -3
- package/dist/src/composer/input-area/InputAreaEditor.js +1 -50
- package/dist/src/composer/input-area/composerPrediction.js +0 -3
- package/dist/src/generative-ui/content.js +0 -2
- package/dist/src/generative-ui/index.js +0 -3
- package/dist/src/generative-ui/layout.js +0 -5
- package/dist/src/hooks/use-count-up-display.js +0 -2
- package/dist/src/hooks/use-idle-callback.js +0 -3
- package/dist/src/hooks/use-persisted-scroll-parent.js +1 -8
- package/dist/src/icons/animated/index.js +0 -4
- package/dist/src/icons/board-icon.js +74 -41
- package/dist/src/icons/bolt-icon.js +30 -20
- package/dist/src/icons/building-icon.js +125 -61
- package/dist/src/icons/files-icon.js +103 -43
- package/dist/src/icons/inbox-icon.js +101 -49
- package/dist/src/icons/index.js +2 -1
- package/dist/src/icons/memory-icon.js +135 -58
- package/dist/src/icons/search-icon.js +143 -46
- package/dist/src/icons/settings-icon.js +113 -53
- package/dist/src/icons/solid-icons.js +665 -0
- package/dist/src/icons/with-active.js +25 -0
- package/dist/src/index.js +0 -40
- package/dist/src/kibo/gantt-features.js +0 -10
- package/dist/src/kibo/gantt-provider.js +0 -34
- package/dist/src/kibo/kanban.js +0 -15
- package/dist/src/kibo/list.js +0 -3
- package/dist/src/kibo/video-player.js +0 -7
- package/dist/src/logos/index.js +0 -4
- package/dist/src/markdown/Markdown.js +0 -15
- package/dist/src/markdown/MarkdownCodeBlock.js +0 -16
- package/dist/src/markdown/MarkdownInlineCode.js +0 -6
- package/dist/src/markdown/MarkdownLink.js +0 -5
- package/dist/src/markdown/codeFence.js +0 -1
- package/dist/src/markdown/codeHighlight.js +0 -19
- package/dist/src/markdown/incrementalBlocks.js +0 -45
- package/dist/src/markdown/markdownClipboard.js +0 -13
- package/dist/src/markdown/mermaid.js +0 -25
- package/dist/src/markdown/rehypeGithubAlerts.js +0 -4
- package/dist/src/markdown/useSmoothText.js +0 -5
- package/dist/src/marketing/PricingModal.js +0 -2
- package/dist/src/marketing/ProductHero.js +0 -2
- package/dist/src/marketing/createLandingKit.js +0 -5
- package/dist/src/marketing/marketing-classes.js +0 -7
- package/dist/src/motion/dock-motion.js +0 -27
- package/dist/src/motion/panel-transition.js +0 -2
- package/dist/src/ui/_field-classes.js +0 -3
- package/dist/src/ui/_menu-classes.js +0 -6
- package/dist/src/ui/_picker-classes.js +0 -9
- package/dist/src/ui/accordion.alt.js +0 -12
- package/dist/src/ui/badge.js +0 -1
- package/dist/src/ui/border-beam.js +0 -2
- package/dist/src/ui/breadcrumb.js +0 -15
- package/dist/src/ui/bulk-action-bar.js +0 -11
- package/dist/src/ui/button.js +0 -20
- package/dist/src/ui/calendar.js +1 -20
- package/dist/src/ui/card.js +0 -3
- package/dist/src/ui/carousel.js +0 -1
- package/dist/src/ui/clear-input.alt.js +0 -9
- package/dist/src/ui/clearInputDissolve.js +0 -4
- package/dist/src/ui/command.js +0 -15
- package/dist/src/ui/confetti-burst.js +0 -3
- package/dist/src/ui/confirm-dialog-parts.js +0 -11
- package/dist/src/ui/confirm-dialog.js +0 -6
- package/dist/src/ui/crossfade-icon.js +0 -2
- package/dist/src/ui/date-picker.js +0 -22
- package/dist/src/ui/dialog.js +0 -5
- package/dist/src/ui/empty-state.js +0 -7
- package/dist/src/ui/field.js +0 -21
- package/dist/src/ui/image-lightbox.js +0 -5
- package/dist/src/ui/input-group.alt.js +0 -24
- package/dist/src/ui/input-group.js +0 -4
- package/dist/src/ui/kbd.js +0 -3
- package/dist/src/ui/loading-state.js +0 -17
- package/dist/src/ui/marquee-on-hover.js +0 -3
- package/dist/src/ui/media-preview.js +0 -2
- package/dist/src/ui/modalTransition.js +0 -33
- package/dist/src/ui/overlay-a11y.js +0 -1
- package/dist/src/ui/page-title.js +0 -3
- package/dist/src/ui/refresh-spin-icon.js +0 -12
- package/dist/src/ui/search-input.js +0 -1
- package/dist/src/ui/select-field.js +0 -1
- package/dist/src/ui/send-queue-icon.js +0 -3
- package/dist/src/ui/sheet.js +0 -33
- package/dist/src/ui/slider.js +103 -82
- package/dist/src/ui/sonner-icons.js +0 -5
- package/dist/src/ui/sonner.js +0 -60
- package/dist/src/ui/spinner.js +0 -35
- package/dist/src/ui/status-dot.js +0 -2
- package/dist/src/ui/surface.js +0 -14
- package/dist/src/ui/switch.js +213 -36
- package/dist/src/ui/table.js +0 -1
- package/dist/src/ui/tabs-transition.js +0 -1
- package/dist/src/ui/tabs.js +0 -17
- package/dist/src/ui/tabsSliding.js +0 -6
- package/dist/src/ui/time-picker.js +0 -15
- package/dist/src/ui/toggle-search.js +0 -3
- package/dist/src/ui/ui-config.js +0 -16
- package/dist/src/utils/cat-color.js +0 -17
- package/dist/src/utils/cn.js +0 -5
- package/dist/src/utils/gesture.js +0 -8
- package/dist/src/utils/ref.js +0 -1
- package/dist/src/utils/runtimeVisibility.js +1 -22
- package/dist/src/utils/surface-radius.js +0 -11
- package/dist/src/utils/useDragSensors.js +0 -4
- package/dist/tokens/src/tailwind-preset.mjs +0 -3
- package/package.json +1 -1
- package/scripts/build-brand-assets.mjs +0 -8
- package/shell/src/AppShell.tsx +0 -37
- package/shell/src/AppSidebar.tsx +0 -14
- package/shell/src/ButtonTrack.tsx +0 -1
- package/shell/src/PageHeaderBar.tsx +0 -61
- package/shell/src/PageWrapper.tsx +0 -26
- package/shell/src/PillTabs.tsx +0 -1
- package/shell/src/SessionsHoverCard.tsx +0 -40
- package/shell/src/SidePanelTabs.tsx +0 -61
- package/shell/src/Sidebar.tsx +0 -1
- package/shell/src/SidebarAccountMenu.tsx +0 -40
- package/shell/src/SidebarChrome.tsx +0 -32
- package/shell/src/SidebarIconTooltip.tsx +0 -3
- package/shell/src/SidebarPanel.tsx +0 -20
- package/shell/src/SidebarRail.tsx +0 -44
- package/shell/src/SidebarResize.tsx +0 -6
- package/shell/src/SidebarUpgradeCard.tsx +0 -2
- package/shell/src/SignOutDialog.tsx +0 -6
- package/shell/src/app-shell-classes.ts +0 -15
- package/shell/src/index.ts +0 -1
- package/shell/src/shell-panel-motion.ts +0 -11
- package/shell/src/shell-variant.ts +0 -6
- package/src/ai-elements/activity-question.tsx +0 -2
- package/src/ai-elements/activity-shared.tsx +0 -11
- package/src/ai-elements/activity-step-detail.tsx +0 -2
- package/src/ai-elements/activity-step-label.ts +0 -5
- package/src/ai-elements/activity-step-types.ts +0 -24
- package/src/ai-elements/activity-tasks-utils.ts +0 -13
- package/src/ai-elements/activity-tasks.tsx +0 -61
- package/src/ai-elements/artifact.tsx +0 -7
- package/src/ai-elements/attachments.tsx +0 -33
- package/src/ai-elements/chat-day-divider.tsx +0 -3
- package/src/ai-elements/chat-jump-rail.tsx +0 -9
- package/src/ai-elements/code-block.tsx +0 -28
- package/src/ai-elements/collapsible-user-message-body.tsx +0 -2
- package/src/ai-elements/context.tsx +0 -10
- package/src/ai-elements/conversation.tsx +0 -16
- package/src/ai-elements/jump-rail.tsx +0 -31
- package/src/ai-elements/message.tsx +0 -32
- package/src/ai-elements/model-picker-content.tsx +0 -17
- package/src/ai-elements/model-picker-types.ts +0 -5
- package/src/ai-elements/model-picker.tsx +0 -36
- package/src/ai-elements/model-selector.tsx +0 -5
- package/src/ai-elements/prompt-input-speech.tsx +0 -11
- package/src/ai-elements/prompt-input.tsx +0 -26
- package/src/ai-elements/provider-icon.tsx +0 -2
- package/src/ai-elements/queue.tsx +0 -19
- package/src/ai-elements/reasoning.tsx +0 -4
- package/src/ai-elements/shimmer.tsx +0 -16
- package/src/ai-elements/simple-model-ladder.tsx +0 -1
- package/src/ai-elements/speech-input.tsx +0 -6
- package/src/ai-elements/test-results.tsx +0 -5
- package/src/ai-elements/trace.tsx +0 -2
- package/src/ai-elements/web-preview.tsx +0 -7
- package/src/artifacts/artifact-card.tsx +0 -7
- package/src/artifacts/artifact-dialogs.tsx +0 -4
- package/src/artifacts/artifact-frame.tsx +0 -10
- package/src/artifacts/artifact-list-toolbar.tsx +0 -6
- package/src/artifacts/artifact-list.tsx +0 -4
- package/src/artifacts/artifact-type-icon.tsx +0 -1
- package/src/artifacts/artifact-versions-menu.tsx +0 -3
- package/src/artifacts/artifact-viewer.tsx +0 -5
- package/src/artifacts/types.ts +0 -1
- package/src/audio/playChime.ts +0 -1
- package/src/audio/playTone.ts +0 -7
- package/src/brand/AppIcons.tsx +0 -5
- package/src/brand/AppMark.tsx +0 -6
- package/src/brand/AppWordmark.tsx +0 -10
- package/src/brand/familyApps.ts +0 -2
- package/src/brand/svg.ts +0 -9
- package/src/client.ts +0 -34
- package/src/composer/Composer.tsx +0 -70
- package/src/composer/input-area/ComposerSlashMenu.tsx +0 -1
- package/src/composer/input-area/ConnectionStatusMenuItem.tsx +0 -2
- package/src/composer/input-area/FadePresence.tsx +0 -4
- package/src/composer/input-area/InputActions.tsx +0 -5
- package/src/composer/input-area/InputArea.tsx +1 -28
- package/src/composer/input-area/InputAreaEditor.tsx +0 -39
- package/src/composer/input-area/InputBanners.tsx +0 -1
- package/src/composer/input-area/PromoBanner.tsx +0 -1
- package/src/composer/input-area/composerPrediction.ts +0 -2
- package/src/composer/input-area/useComposerSlashMenu.ts +0 -1
- package/src/composer/input-area/useInputAreaPrediction.ts +0 -1
- package/src/composer/prediction.ts +0 -6
- package/src/composer/useComposerPrediction.ts +0 -2
- package/src/generative-ui/GenerativeUiPanel.tsx +0 -11
- package/src/generative-ui/content.tsx +0 -2
- package/src/generative-ui/index.ts +0 -3
- package/src/generative-ui/layout.tsx +0 -5
- package/src/hooks/use-count-up-display.ts +0 -1
- package/src/hooks/use-idle-callback.ts +0 -5
- package/src/hooks/use-persisted-scroll-parent.ts +0 -4
- package/src/hooks/use-single-flight.ts +0 -5
- package/src/icons/animated/animated-bell-icon.tsx +0 -6
- package/src/icons/animated/animated-counter.tsx +0 -5
- package/src/icons/animated/animated-key-icon.tsx +0 -4
- package/src/icons/animated/animated-notification-icon.tsx +0 -14
- package/src/icons/animated/animated-progress.tsx +0 -10
- package/src/icons/animated/animated-status-dot.tsx +0 -4
- package/src/icons/animated/index.ts +0 -4
- package/src/icons/animated/morphing-menu-icon.tsx +0 -5
- package/src/icons/animated/morphing-mic-icon.tsx +0 -2
- package/src/icons/animated/pulsing-rings.tsx +0 -4
- package/src/icons/automation-icon.tsx +0 -1
- package/src/icons/board-icon.tsx +13 -10
- package/src/icons/bolt-icon.tsx +5 -4
- package/src/icons/building-icon.tsx +11 -9
- package/src/icons/draft-icon.tsx +0 -1
- package/src/icons/files-icon.tsx +9 -5
- package/src/icons/inbox-arrow-icon.tsx +0 -1
- package/src/icons/inbox-icon.tsx +9 -5
- package/src/icons/index.ts +12 -1
- package/src/icons/memory-icon.tsx +9 -11
- package/src/icons/nav-icon-base.tsx +0 -10
- package/src/icons/search-icon.tsx +7 -6
- package/src/icons/settings-icon.tsx +11 -13
- package/src/icons/sidebar-toggle-icon.tsx +0 -1
- package/src/icons/solid-icons.tsx +138 -0
- package/src/icons/with-active.tsx +14 -0
- package/src/index.ts +0 -30
- package/src/kibo/gantt-features.tsx +0 -16
- package/src/kibo/gantt-header.tsx +0 -4
- package/src/kibo/gantt-provider.tsx +0 -36
- package/src/kibo/gantt-sidebar.tsx +0 -7
- package/src/kibo/gantt-timeline.tsx +0 -4
- package/src/kibo/kanban.tsx +0 -49
- package/src/kibo/list.tsx +0 -8
- package/src/kibo/theme-switcher.tsx +0 -5
- package/src/kibo/video-player.tsx +0 -9
- package/src/logos/index.ts +0 -3
- package/src/logos/logo-svg.tsx +0 -5
- package/src/markdown/Markdown.tsx +0 -20
- package/src/markdown/MarkdownCodeBlock.tsx +0 -14
- package/src/markdown/MarkdownInlineCode.tsx +0 -6
- package/src/markdown/MarkdownLink.tsx +0 -4
- package/src/markdown/codeFence.ts +0 -3
- package/src/markdown/codeHighlight.ts +0 -16
- package/src/markdown/incrementalBlocks.ts +0 -49
- package/src/markdown/markdownClipboard.ts +0 -12
- package/src/markdown/mermaid.ts +0 -22
- package/src/markdown/rehypeGithubAlerts.ts +0 -3
- package/src/markdown/useSmoothText.ts +0 -5
- package/src/marketing/FloatingBar.tsx +0 -3
- package/src/marketing/PricingModal.tsx +0 -45
- package/src/marketing/ProductHero.tsx +0 -23
- package/src/marketing/ProductHeroOrbit.tsx +0 -5
- package/src/marketing/SiteFooter.tsx +0 -23
- package/src/marketing/SiteHeader.tsx +0 -14
- package/src/marketing/VProPricingModal.tsx +0 -5
- package/src/marketing/createLandingKit.tsx +0 -12
- package/src/marketing/landing.tsx +0 -12
- package/src/marketing/marketing-classes.ts +0 -7
- package/src/motion/dock-motion.ts +0 -25
- package/src/motion/list-enter.tsx +0 -4
- package/src/motion/panel-transition.tsx +0 -5
- package/src/ui/_field-classes.ts +0 -2
- package/src/ui/_menu-classes.ts +0 -4
- package/src/ui/_menu-parts.tsx +0 -5
- package/src/ui/_picker-classes.ts +0 -6
- package/src/ui/accordion.alt.tsx +0 -8
- package/src/ui/accordion.tsx +0 -4
- package/src/ui/badge.tsx +0 -1
- package/src/ui/border-beam.tsx +0 -11
- package/src/ui/breadcrumb.tsx +0 -13
- package/src/ui/bulk-action-bar.tsx +0 -24
- package/src/ui/button.tsx +0 -27
- package/src/ui/calendar.tsx +0 -18
- package/src/ui/card.tsx +0 -3
- package/src/ui/carousel.tsx +0 -4
- package/src/ui/checkbox.tsx +0 -1
- package/src/ui/clear-input.alt.tsx +0 -8
- package/src/ui/clear-input.tsx +0 -16
- package/src/ui/clearInputDissolve.ts +0 -4
- package/src/ui/command.tsx +0 -22
- package/src/ui/confetti-burst.tsx +0 -4
- package/src/ui/confirm-dialog-parts.tsx +0 -45
- package/src/ui/confirm-dialog.tsx +0 -26
- package/src/ui/context-menu.tsx +0 -10
- package/src/ui/count-pop.tsx +0 -2
- package/src/ui/crossfade-icon.tsx +0 -3
- package/src/ui/date-picker.tsx +0 -40
- package/src/ui/dialog.tsx +0 -18
- package/src/ui/dropdown-menu.tsx +0 -11
- package/src/ui/empty-state.tsx +0 -15
- package/src/ui/error-boundary.tsx +0 -7
- package/src/ui/field.tsx +0 -18
- package/src/ui/hover-card.tsx +0 -6
- package/src/ui/image-lightbox.tsx +0 -7
- package/src/ui/input-group.alt.tsx +0 -16
- package/src/ui/input-group.tsx +0 -3
- package/src/ui/kbd.tsx +0 -3
- package/src/ui/label.tsx +0 -1
- package/src/ui/labeled-slider-row.tsx +0 -2
- package/src/ui/list-row.tsx +0 -46
- package/src/ui/loading-state.tsx +0 -23
- package/src/ui/marquee-on-hover.tsx +1 -6
- package/src/ui/media-preview.tsx +0 -5
- package/src/ui/modalTransition.ts +0 -25
- package/src/ui/overlay-a11y.ts +0 -1
- package/src/ui/page-title.tsx +0 -4
- package/src/ui/popover.tsx +0 -8
- package/src/ui/progress.tsx +0 -1
- package/src/ui/refresh-spin-icon.tsx +0 -11
- package/src/ui/relative-date-time.tsx +0 -3
- package/src/ui/rolling-number.tsx +0 -2
- package/src/ui/search-input.tsx +0 -9
- package/src/ui/select-field.tsx +0 -5
- package/src/ui/select.tsx +0 -8
- package/src/ui/send-queue-icon.tsx +0 -3
- package/src/ui/separator.tsx +0 -1
- package/src/ui/sheet.tsx +0 -42
- package/src/ui/slide-over-panel.tsx +0 -2
- package/src/ui/slider.tsx +21 -9
- package/src/ui/sonner-icons.tsx +0 -4
- package/src/ui/sonner.tsx +0 -78
- package/src/ui/spinner.tsx +0 -50
- package/src/ui/status-dot.tsx +0 -10
- package/src/ui/surface.tsx +0 -13
- package/src/ui/switch.tsx +72 -3
- package/src/ui/table.tsx +0 -3
- package/src/ui/tabs-transition.tsx +0 -12
- package/src/ui/tabs.tsx +0 -17
- package/src/ui/tabsSliding.ts +0 -5
- package/src/ui/time-picker.tsx +0 -17
- package/src/ui/toggle-search.tsx +0 -6
- package/src/ui/toolbar-search-input.tsx +0 -3
- package/src/ui/tooltip.tsx +0 -5
- package/src/ui/ui-config.tsx +0 -19
- package/src/utils/cat-color.ts +0 -20
- package/src/utils/cn.ts +0 -4
- package/src/utils/gesture.ts +0 -8
- package/src/utils/ref.ts +0 -1
- package/src/utils/runtimeVisibility.ts +0 -19
- package/src/utils/surface-radius.ts +0 -11
- package/src/utils/useDragSensors.ts +0 -2
- package/tokens/examples/compat-shadcn-rgb/vite.config.ts +0 -2
- package/tokens/examples/toaster/Fixture.tsx +0 -4
- package/tokens/examples/toaster/UpdateToastFixture.tsx +0 -4
- package/tokens/examples/toaster/vite.config.ts +0 -2
- package/tokens/examples/tokens-moved/Fixture.tsx +0 -4
- package/tokens/examples/tokens-moved/vite.config.ts +0 -2
- package/tokens/src/tailwind-preset.mjs +0 -3
|
@@ -8,11 +8,9 @@ export type ClerkAuthSlice = {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export type StableAuthOptions = {
|
|
11
|
-
/** How long a sign-in loss reads as "still loading". Default 2000 ms. */
|
|
12
11
|
debounceMs?: number;
|
|
13
12
|
};
|
|
14
13
|
|
|
15
|
-
// Tracks sign-in during this session to detect stale deploy auth loss.
|
|
16
14
|
let wasEverSignedIn = false;
|
|
17
15
|
|
|
18
16
|
/**
|
|
@@ -3,8 +3,6 @@ import { cn } from "../cn.js";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { useAltHeld } from "./useAltHeld.js";
|
|
5
5
|
|
|
6
|
-
// `Hotkey` covers combinations, not a bare modifier, so the literal is parsed
|
|
7
|
-
// in rather than asserted. `formatForDisplay` renders it as ⌥ / Alt.
|
|
8
6
|
const ALT_HOTKEY = z.custom<Hotkey>().parse("Alt");
|
|
9
7
|
|
|
10
8
|
/** Platform-native "⌥-click skips confirmation" / "Alt-click skips confirmation". */
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import { useSyncExternalStore } from "react";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Whether Alt (Option on macOS) is held right now.
|
|
5
|
-
*
|
|
6
|
-
* Subscribes to the window so every confirmable control can restyle when the
|
|
7
|
-
* modifier goes down, and so Alt+click still works when the activating event
|
|
8
|
-
* is a Radix `onSelect` that does not carry `altKey`.
|
|
9
|
-
*
|
|
10
|
-
* Cleared on blur / visibility hide so a missed keyup after alt-tab cannot
|
|
11
|
-
* leave the app stuck in skip-confirm mode.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
3
|
/** The only two fields the store reads off a keyboard event. */
|
|
15
4
|
export type AltKeyEvent = { key: string; altKey: boolean };
|
|
16
5
|
|
|
@@ -52,8 +41,6 @@ export function createAltHeldStore(bind: AltHeldBinding): AltHeldStore {
|
|
|
52
41
|
if (event.key === "Alt" || event.altKey) setHeld(true);
|
|
53
42
|
},
|
|
54
43
|
keyUp: (event) => {
|
|
55
|
-
// A keyup for some other key still reports altKey while Alt is down, so
|
|
56
|
-
// only a released Alt — or a keyup without the modifier — clears.
|
|
57
44
|
if (event.key === "Alt" || !event.altKey) setHeld(false);
|
|
58
45
|
},
|
|
59
46
|
clear: () => setHeld(false),
|
|
@@ -68,8 +55,6 @@ export function createAltHeldStore(bind: AltHeldBinding): AltHeldStore {
|
|
|
68
55
|
if (listeners.size > 0) return;
|
|
69
56
|
unbind?.();
|
|
70
57
|
unbind = null;
|
|
71
|
-
// Nothing is listening for the keyup any more; start the next mount
|
|
72
|
-
// from a known-unheld state rather than a stale `true`.
|
|
73
58
|
altHeld = false;
|
|
74
59
|
};
|
|
75
60
|
},
|
|
@@ -88,8 +73,6 @@ function isInOpenMenu(target: EventTarget | null): boolean {
|
|
|
88
73
|
export const bindToWindow: AltHeldBinding = (signals) => {
|
|
89
74
|
if (typeof window === "undefined") return () => {};
|
|
90
75
|
const onKeyDown = (event: KeyboardEvent): void => {
|
|
91
|
-
// A bare Alt press can steal focus to the browser menu bar and dismiss an
|
|
92
|
-
// open Radix menu. Cancel it only when it lands inside one.
|
|
93
76
|
if (event.key === "Alt" && isInOpenMenu(event.target)) {
|
|
94
77
|
event.preventDefault();
|
|
95
78
|
}
|
|
@@ -7,11 +7,8 @@ import type { ComponentProps, ReactNode } from "react";
|
|
|
7
7
|
export type ConvexClerkUseAuth = ComponentProps<typeof ConvexProviderWithClerk>["useAuth"];
|
|
8
8
|
|
|
9
9
|
export type ConvexClerkProviderProps = {
|
|
10
|
-
/** No client (for example no Convex URL configured): children render without a provider. */
|
|
11
10
|
client: ConvexReactClient | null | undefined;
|
|
12
|
-
/** Default: `useAuth` from `@clerk/react`. */
|
|
13
11
|
useAuth?: ConvexClerkUseAuth;
|
|
14
|
-
/** `false` renders a plain `ConvexProvider` (no Clerk auth). Default `true`. */
|
|
15
12
|
clerk?: boolean;
|
|
16
13
|
children: ReactNode;
|
|
17
14
|
};
|
package/app/src/convex/env.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// Type-only: the app passes its own `z`, so zod stays an optional peer and the
|
|
2
|
-
// thrown ZodError comes from the app's zod version (3.25+ or 4), as today.
|
|
3
1
|
import type { z } from "zod";
|
|
4
2
|
|
|
5
3
|
export type ViteEnvName = "development" | "staging" | "production";
|
|
@@ -24,10 +22,8 @@ type ViteEnvShape = BaseShape & { VITE_ENV: z.ZodType<ViteEnvName> };
|
|
|
24
22
|
export type ViteEnvMode = "strict" | "fallback" | false;
|
|
25
23
|
|
|
26
24
|
export type ClientEnvOptions<Extra extends z.ZodRawShape> = {
|
|
27
|
-
/** The app's `z` from `"zod"`. */
|
|
28
25
|
z: typeof z;
|
|
29
26
|
viteEnv?: ViteEnvMode;
|
|
30
|
-
/** Extra keys, parsed after the base keys in the same `z.object`. A key here replaces a base key. */
|
|
31
27
|
extend?: Extra;
|
|
32
28
|
};
|
|
33
29
|
|
|
@@ -56,7 +56,6 @@ export function userFacingErrorMessage(
|
|
|
56
56
|
if (frame !== -1) text = text.slice(0, frame);
|
|
57
57
|
text = text.trim();
|
|
58
58
|
|
|
59
|
-
// Nothing survived the strip, or the whole thing was the client's envelope.
|
|
60
59
|
if (text.length === 0 || text.startsWith("[CONVEX")) return fallback;
|
|
61
60
|
return text;
|
|
62
61
|
}
|
|
@@ -14,9 +14,6 @@ import { useState } from "react";
|
|
|
14
14
|
* on purpose to keep the last result across argument changes.
|
|
15
15
|
*/
|
|
16
16
|
export function useHeldResult<T>(result: T | undefined, key: string | null): T | undefined {
|
|
17
|
-
// State, not a ref: reading a ref during render makes the React Compiler
|
|
18
|
-
// skip the file. Adjusting state during render is the supported way to
|
|
19
|
-
// remember a previous value.
|
|
20
17
|
const [held, setHeld] = useState({ key, value: result });
|
|
21
18
|
if (result !== undefined && (result !== held.value || key !== held.key)) {
|
|
22
19
|
setHeld({ key, value: result });
|
|
@@ -7,13 +7,7 @@ export type PageMotionConfigProps = {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export type PageMotionProviderProps = {
|
|
10
|
-
/** Page motion is off, for example from a user setting. */
|
|
11
10
|
disabled: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Pass `MotionConfig` from `motion/react`, or a component of the app that
|
|
14
|
-
* wraps it (for example in `LazyMotion`). Injected so this package does not
|
|
15
|
-
* import `motion`. Define it at module level, not inline.
|
|
16
|
-
*/
|
|
17
11
|
motionConfig: ComponentType<PageMotionConfigProps>;
|
|
18
12
|
children: ReactNode;
|
|
19
13
|
};
|
|
@@ -3,38 +3,24 @@ import { createContext, use, useEffect, useState, type ReactNode } from "react";
|
|
|
3
3
|
export type PageTitleValue = {
|
|
4
4
|
pageTitle: string;
|
|
5
5
|
setPageTitle: (title: string) => void;
|
|
6
|
-
/** Element a mobile top bar registers (as a ref) so pages can portal actions into it. */
|
|
7
6
|
mobileActionsSlot: HTMLElement | null;
|
|
8
7
|
setMobileActionsSlot: (slot: HTMLElement | null) => void;
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
export type DocumentTitleOptions = {
|
|
12
|
-
/** Appended after the page title, for example the app name. */
|
|
13
11
|
suffix?: string;
|
|
14
|
-
/** Between page title and suffix. Default `" · "`. */
|
|
15
12
|
separator?: string;
|
|
16
|
-
/** Title while no page title is set. Default: `document.title` when the provider mounted. */
|
|
17
13
|
fallback?: string;
|
|
18
14
|
};
|
|
19
15
|
|
|
20
16
|
export type PageTitleContextOptions = {
|
|
21
|
-
/**
|
|
22
|
-
* `usePageTitle()` outside the provider throws this message. When unset it
|
|
23
|
-
* returns an empty title and no-op setters instead.
|
|
24
|
-
*/
|
|
25
17
|
missingProviderMessage?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Also write `document.title` as `pageTitle + separator + suffix`, or
|
|
28
|
-
* `fallback` while the page title is empty. Off by default: the provider
|
|
29
|
-
* does not touch `document.title`. The mount-time title comes back on unmount.
|
|
30
|
-
*/
|
|
31
18
|
documentTitle?: DocumentTitleOptions;
|
|
32
19
|
};
|
|
33
20
|
|
|
34
21
|
export type PageTitleContextKit = {
|
|
35
22
|
PageTitleProvider: (props: { children: ReactNode }) => ReactNode;
|
|
36
23
|
usePageTitle: () => PageTitleValue;
|
|
37
|
-
/** Publishes `title` while the caller is mounted; non-string titles publish `""`. Clears on unmount. */
|
|
38
24
|
usePageTitleSync: (title: ReactNode) => void;
|
|
39
25
|
};
|
|
40
26
|
|
|
@@ -6,18 +6,14 @@ const ICON_CLASS = "mb-5 text-muted-foreground opacity-50";
|
|
|
6
6
|
/** `UiConfig.SettingsEmptyState`: replaces the built-in classes of a part. */
|
|
7
7
|
export interface SettingsEmptyStateConfig {
|
|
8
8
|
classes?: {
|
|
9
|
-
/** The icon above the title (colour, opacity, spacing). */
|
|
10
9
|
icon?: string;
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
interface SettingsEmptyStateProps {
|
|
15
|
-
/** Tabler icon component, rendered muted above the copy. */
|
|
16
14
|
icon: ComponentType<{ size?: number; className?: string }>;
|
|
17
15
|
title: string;
|
|
18
|
-
/** One line on what to do about it. */
|
|
19
16
|
description?: string;
|
|
20
|
-
/** Primary call to action, e.g. the same button as the section header. */
|
|
21
17
|
action?: ReactNode;
|
|
22
18
|
}
|
|
23
19
|
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
|
|
3
3
|
interface SettingsFieldProps {
|
|
4
|
-
/** Field name, shown above the control (stacked) or left of it (horizontal). */
|
|
5
4
|
label: ReactNode;
|
|
6
|
-
/** Help text, shown under the control (stacked) or under the label (horizontal). */
|
|
7
5
|
description?: ReactNode;
|
|
8
|
-
/** `id` of the control, so clicking the label focuses it. */
|
|
9
6
|
htmlFor?: string;
|
|
10
|
-
/** `"stacked"` (default) or `"horizontal"`. */
|
|
11
7
|
layout?: "stacked" | "horizontal";
|
|
12
8
|
children: ReactNode;
|
|
13
9
|
}
|
|
@@ -13,23 +13,11 @@ export type SettingsLayoutProps = {
|
|
|
13
13
|
|
|
14
14
|
export interface SettingsPageProps {
|
|
15
15
|
title: string;
|
|
16
|
-
/** Sparse primary action(s) in the title row (e.g. Add, Delete). */
|
|
17
16
|
headerRight?: ReactNode;
|
|
18
|
-
/** Filters / search / segmented controls. Sits under the title. */
|
|
19
17
|
toolbar?: ReactNode;
|
|
20
|
-
/** Route tabs. Sit under the title (and under toolbar if both exist). */
|
|
21
18
|
tabs?: ReactNode;
|
|
22
|
-
/**
|
|
23
|
-
* Wrap children in the standard settings section stack. Set false when the
|
|
24
|
-
* child already owns its own vertical rhythm.
|
|
25
|
-
*/
|
|
26
19
|
stack?: boolean;
|
|
27
|
-
/** Fill the remaining shell height instead of scrolling the page. */
|
|
28
20
|
fillHeight?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Page chrome supplied by the app (for example its own page container).
|
|
31
|
-
* Receives the stacked children. Defaults to a plain `div` layout.
|
|
32
|
-
*/
|
|
33
21
|
layout?: (props: SettingsLayoutProps) => ReactNode;
|
|
34
22
|
children: ReactNode;
|
|
35
23
|
}
|
|
@@ -18,33 +18,19 @@ const FOOTER_CLASS =
|
|
|
18
18
|
/** `UiConfig.SettingsSection`: replaces the built-in classes of a part. */
|
|
19
19
|
export interface SettingsSectionConfig {
|
|
20
20
|
classes?: {
|
|
21
|
-
/** The card behind the body and footer (tone, radius, nested field fills). */
|
|
22
21
|
card?: string;
|
|
23
|
-
/** The bottom bar that holds `footer`. */
|
|
24
22
|
footer?: string;
|
|
25
|
-
/** Body padding per `bodyVariant`. */
|
|
26
23
|
body?: Partial<Record<SettingsSectionBodyVariant, string>>;
|
|
27
24
|
};
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
interface SettingsSectionProps {
|
|
31
|
-
/** Section heading. Kept short — the description carries the detail. */
|
|
32
28
|
title: ReactNode;
|
|
33
|
-
/** Supporting copy shown under the heading. */
|
|
34
29
|
description?: ReactNode;
|
|
35
|
-
/** Control pinned to the top-right of the heading, e.g. a switch or link. */
|
|
36
30
|
action?: ReactNode;
|
|
37
|
-
/** Controls pinned to a bottom bar, e.g. a Save button. */
|
|
38
31
|
footer?: ReactNode;
|
|
39
32
|
children?: ReactNode;
|
|
40
|
-
/**
|
|
41
|
-
* Body padding contract. Prefer this over freelancing `bodyClassName` padding.
|
|
42
|
-
* - form: default labelled fields
|
|
43
|
-
* - list: edge-to-edge divided rows (`p-0`)
|
|
44
|
-
* - compact: tighter padding for dense controls
|
|
45
|
-
*/
|
|
46
33
|
bodyVariant?: SettingsSectionBodyVariant;
|
|
47
|
-
/** Applied to the body wrapper, for one-off layout (grids, etc.). */
|
|
48
34
|
bodyClassName?: string;
|
|
49
35
|
className?: string;
|
|
50
36
|
}
|
|
@@ -10,7 +10,6 @@ export const THEME_MODES = ["light", "neutral", "dark", "system"] as const satis
|
|
|
10
10
|
|
|
11
11
|
const LABELS: Record<ThemeMode, string> = { light: "Light", neutral: "Neutral", dark: "Dark", system: "System" };
|
|
12
12
|
const ICONS = { light: IconSun, neutral: IconCircleHalf, dark: IconMoon, system: IconDeviceDesktop };
|
|
13
|
-
// Swatches show the theme itself, so they use fixed colours, not tokens.
|
|
14
13
|
const SWATCHES: Record<ThemeMode, string> = {
|
|
15
14
|
light: "bg-white",
|
|
16
15
|
neutral: "bg-zinc-700",
|
|
@@ -25,12 +24,9 @@ const ICON_COLOURS: Record<ThemeMode, string> = {
|
|
|
25
24
|
};
|
|
26
25
|
|
|
27
26
|
export type ThemeModePickerProps = {
|
|
28
|
-
/** The selected theme (the stored choice, not the resolved one). */
|
|
29
27
|
value: string | undefined;
|
|
30
28
|
onChange: (mode: ThemeMode) => void;
|
|
31
|
-
/** Themes to show, in order. Default `THEME_MODES`. */
|
|
32
29
|
modes?: readonly ThemeMode[];
|
|
33
|
-
/** Smaller tiles in two columns, for menus and dialogs. Default `false`. */
|
|
34
30
|
compact?: boolean;
|
|
35
31
|
className?: string;
|
|
36
32
|
};
|
|
@@ -57,7 +53,6 @@ export function ThemeModePicker({ value, onChange, modes = THEME_MODES, compact
|
|
|
57
53
|
aria-pressed={active}
|
|
58
54
|
onClick={() => onChange(mode)}
|
|
59
55
|
className={cn(
|
|
60
|
-
// The border shows the selected state; idle tiles keep a transparent one to hold their size.
|
|
61
56
|
"relative flex h-full w-full flex-col items-center rounded-surface border font-medium motion-press active:scale-[0.96]",
|
|
62
57
|
compact ? "gap-1 p-2 text-2xs" : "gap-2 p-3 text-xs sm:gap-3 sm:p-4 sm:text-sm",
|
|
63
58
|
active
|
|
@@ -83,7 +78,6 @@ export function ThemeModePicker({ value, onChange, modes = THEME_MODES, compact
|
|
|
83
78
|
)}
|
|
84
79
|
>
|
|
85
80
|
{mode === "system" ? (
|
|
86
|
-
// Hard diagonal split, white over zinc-900, with no gradient.
|
|
87
81
|
<span
|
|
88
82
|
aria-hidden
|
|
89
83
|
className="absolute inset-0 bg-zinc-900"
|
|
@@ -5,55 +5,31 @@ export type ThemeAttribute = "class" | `data-${string}`;
|
|
|
5
5
|
|
|
6
6
|
export type ThemeProviderProps = {
|
|
7
7
|
children?: ReactNode;
|
|
8
|
-
/** localStorage key. Default `"theme"`. */
|
|
9
8
|
storageKey?: string;
|
|
10
|
-
/** Used when nothing is stored. Default `"system"` with `enableSystem`, else `"light"`. */
|
|
11
9
|
defaultTheme?: string;
|
|
12
|
-
/** Resolve `"system"` from `prefers-color-scheme`. Default `true`. */
|
|
13
10
|
enableSystem?: boolean;
|
|
14
|
-
/** Set `style.colorScheme` on `<html>` for light and dark. Default `true`. */
|
|
15
11
|
enableColorScheme?: boolean;
|
|
16
|
-
/** Where the theme goes on `<html>`. Default `"data-theme"`. */
|
|
17
12
|
attribute?: ThemeAttribute | ThemeAttribute[];
|
|
18
|
-
/** Theme names. Default `["light", "dark"]`. */
|
|
19
13
|
themes?: string[];
|
|
20
|
-
/**
|
|
21
|
-
* Theme name to the class or attribute value written. With `attribute="class"`
|
|
22
|
-
* a value can hold more than one class, for example
|
|
23
|
-
* `{ neutral: "dark neutral" }`; such a theme counts as dark when one of its
|
|
24
|
-
* classes is `dark`.
|
|
25
|
-
*/
|
|
26
14
|
value?: Record<string, string>;
|
|
27
|
-
/** Shown on `<html>` instead of the stored theme, which is left unchanged. */
|
|
28
15
|
forcedTheme?: string;
|
|
29
|
-
/** Turn CSS transitions off for one frame while the theme changes. Default `false`. */
|
|
30
16
|
disableTransitionOnChange?: boolean;
|
|
31
|
-
/** Nonce for the style element `disableTransitionOnChange` adds. */
|
|
32
17
|
nonce?: string;
|
|
33
18
|
};
|
|
34
19
|
|
|
35
20
|
export type ThemeState = {
|
|
36
|
-
/** Stored theme, `"system"` included. `undefined` only without `window`. */
|
|
37
21
|
theme: string | undefined;
|
|
38
|
-
/** Stores the theme. A function gets the theme of the render it came from. */
|
|
39
22
|
setTheme: (theme: string | ((theme: string | undefined) => string)) => void;
|
|
40
23
|
forcedTheme: string | undefined;
|
|
41
|
-
/** `theme`, with `"system"` resolved to `systemTheme`. */
|
|
42
24
|
resolvedTheme: string | undefined;
|
|
43
|
-
/** `themes` plus `"system"` with `enableSystem`. */
|
|
44
25
|
themes: string[];
|
|
45
|
-
/** `prefers-color-scheme` with `enableSystem`. Until the first effect runs it is `theme` unless that is `"system"` (as in next-themes). */
|
|
46
26
|
systemTheme: string | undefined;
|
|
47
|
-
/** `false` until the provider's first effect has run. */
|
|
48
27
|
mounted: boolean;
|
|
49
|
-
/** `mounted` and `resolvedTheme` is `"dark"`, or its `value` has the `dark` class. */
|
|
50
28
|
isDark: boolean;
|
|
51
|
-
/** `setTheme(resolvedTheme === "dark" ? "light" : "dark")`. */
|
|
52
29
|
toggleTheme: () => void;
|
|
53
30
|
};
|
|
54
31
|
|
|
55
32
|
export type ThemeProviderOptions = {
|
|
56
|
-
/** `useTheme()` outside the provider throws this message. When unset it returns an empty state with no-op setters. */
|
|
57
33
|
missingProviderMessage?: string;
|
|
58
34
|
};
|
|
59
35
|
|
|
@@ -94,12 +70,10 @@ export function applyThemeClass(theme: string): void {
|
|
|
94
70
|
document.documentElement.classList.add(theme);
|
|
95
71
|
}
|
|
96
72
|
|
|
97
|
-
/** The classes in a `value` entry. */
|
|
98
73
|
function classesOf(written: string): string[] {
|
|
99
74
|
return written.split(" ").filter((name) => name !== "");
|
|
100
75
|
}
|
|
101
76
|
|
|
102
|
-
/** `light` or `dark` for a theme whose `value` has more than one class, from those classes. */
|
|
103
77
|
function schemeOf(written: string | undefined): string | undefined {
|
|
104
78
|
if (!written || !written.includes(" ")) return undefined;
|
|
105
79
|
return classesOf(written).find((name) => COLOR_SCHEMES.includes(name));
|
|
@@ -115,7 +89,6 @@ function readTheme(storageKey: string, fallback: string): string | undefined {
|
|
|
115
89
|
try {
|
|
116
90
|
stored = localStorage.getItem(storageKey) || undefined;
|
|
117
91
|
} catch {
|
|
118
|
-
// Storage can be unavailable (privacy modes); fall back.
|
|
119
92
|
}
|
|
120
93
|
return stored || fallback;
|
|
121
94
|
}
|
|
@@ -126,7 +99,6 @@ function disableTransitions(nonce: string | undefined): () => void {
|
|
|
126
99
|
style.appendChild(document.createTextNode(DISABLE_TRANSITIONS_CSS));
|
|
127
100
|
document.head.appendChild(style);
|
|
128
101
|
return () => {
|
|
129
|
-
// Force a style recalculation before the transitions come back.
|
|
130
102
|
window.getComputedStyle(document.body);
|
|
131
103
|
setTimeout(() => {
|
|
132
104
|
document.head.removeChild(style);
|
|
@@ -157,7 +129,6 @@ function applyTheme(theme: string | undefined, options: DomOptions): void {
|
|
|
157
129
|
}
|
|
158
130
|
if (options.enableColorScheme) {
|
|
159
131
|
const fallback = COLOR_SCHEMES.includes(options.defaultTheme) ? options.defaultTheme : null;
|
|
160
|
-
// `null` clears the property in browsers; assigned as-is, as next-themes does.
|
|
161
132
|
const scheme = COLOR_SCHEMES.includes(resolved) ? resolved : (schemeOf(written) ?? fallback);
|
|
162
133
|
Reflect.set(root.style, "colorScheme", scheme);
|
|
163
134
|
}
|
|
@@ -180,7 +151,6 @@ export function createThemeProvider(options: ThemeProviderOptions = {}): ThemePr
|
|
|
180
151
|
const { missingProviderMessage } = options;
|
|
181
152
|
const Context = createContext<ThemeState | undefined>(undefined);
|
|
182
153
|
|
|
183
|
-
/** next-themes hands out a new `setTheme` exactly when `theme` changes; apps list it in effect deps. */
|
|
184
154
|
function useSetTheme(
|
|
185
155
|
theme: string | undefined,
|
|
186
156
|
storageKey: string,
|
|
@@ -192,7 +162,6 @@ export function createThemeProvider(options: ThemeProviderOptions = {}): ThemePr
|
|
|
192
162
|
try {
|
|
193
163
|
localStorage.setItem(storageKey, resolved);
|
|
194
164
|
} catch {
|
|
195
|
-
// Storage can be unavailable (privacy modes).
|
|
196
165
|
}
|
|
197
166
|
};
|
|
198
167
|
const [entry, setEntry] = useState(() => ({ theme, setTheme: make() }));
|
|
@@ -234,7 +203,6 @@ export function createThemeProvider(options: ThemeProviderOptions = {}): ThemePr
|
|
|
234
203
|
|
|
235
204
|
useEffect(() => setMounted(true), []);
|
|
236
205
|
|
|
237
|
-
// Listener and handler are rebuilt whenever `theme` or `forcedTheme` changes.
|
|
238
206
|
useEffect(() => {
|
|
239
207
|
const handleMedia = (media: { matches: boolean }) => {
|
|
240
208
|
setSystemTheme(systemThemeOf(media));
|
|
@@ -246,7 +214,6 @@ export function createThemeProvider(options: ThemeProviderOptions = {}): ThemePr
|
|
|
246
214
|
return () => media.removeListener(handleMedia);
|
|
247
215
|
}, [theme, forcedTheme]);
|
|
248
216
|
|
|
249
|
-
// Other tabs: follow a new value, or store the default when the key is removed.
|
|
250
217
|
useEffect(() => {
|
|
251
218
|
const handleStorage = (event: StorageEvent) => {
|
|
252
219
|
if (event.key !== storageKey) return;
|
|
@@ -1,35 +1,20 @@
|
|
|
1
1
|
export type CompactRelativeTimeOptions = {
|
|
2
|
-
/** Clock in ms. Defaults to `Date.now()`. */
|
|
3
2
|
now?: number;
|
|
4
|
-
/**
|
|
5
|
-
* Returned for anything under a minute old, including future times. When
|
|
6
|
-
* unset the result is whole seconds (`"42s"`), and a future time gives zero
|
|
7
|
-
* or a negative count (`"0s"`, `"-300s"`).
|
|
8
|
-
*/
|
|
9
3
|
justNow?: string;
|
|
10
|
-
/**
|
|
11
|
-
* `false` (default): elapsed time only. A day is 24 hours, a month 30 days,
|
|
12
|
-
* a year 12 of those months.
|
|
13
|
-
* `true`: days count local calendar days across a DST change, and months and
|
|
14
|
-
* years are calendar months, as `dayjs().diff(date, unit)` counts them.
|
|
15
|
-
*/
|
|
16
4
|
calendar?: boolean;
|
|
17
5
|
};
|
|
18
6
|
|
|
19
7
|
const MS_PER_MINUTE = 60_000;
|
|
20
8
|
const MS_PER_DAY = 86_400_000;
|
|
21
9
|
|
|
22
|
-
/** Rounds toward zero; `-0` becomes `0`. */
|
|
23
10
|
function truncate(n: number): number {
|
|
24
11
|
return n < 0 ? Math.ceil(n) || 0 : Math.floor(n);
|
|
25
12
|
}
|
|
26
13
|
|
|
27
|
-
/** Local UTC offset in minutes, rounded to 15 minutes. */
|
|
28
14
|
function utcOffset(ms: number): number {
|
|
29
15
|
return -Math.round(new Date(ms).getTimezoneOffset() / 15) * 15;
|
|
30
16
|
}
|
|
31
17
|
|
|
32
|
-
/** Adds calendar months in local time and clamps the day to the target month. */
|
|
33
18
|
function addMonths(ms: number, months: number): number {
|
|
34
19
|
const date = new Date(ms);
|
|
35
20
|
const day = date.getDate();
|
|
@@ -40,7 +25,6 @@ function addMonths(ms: number, months: number): number {
|
|
|
40
25
|
return date.getTime();
|
|
41
26
|
}
|
|
42
27
|
|
|
43
|
-
/** Fractional calendar months from `a` to `b`, negated (the moment.js formula). */
|
|
44
28
|
function monthDiff(a: number, b: number): number {
|
|
45
29
|
if (new Date(a).getDate() < new Date(b).getDate()) return -monthDiff(b, a);
|
|
46
30
|
const from = new Date(a);
|
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
// Stale-deploy / chunk-load recovery. After a new deploy, cached `index.html`
|
|
2
|
-
// (or a lazy route that preloaded against the old build) can point at asset
|
|
3
|
-
// hashes that no longer exist. The browser then throws a chunk-load error and
|
|
4
|
-
// the app wedges. This reloads the page once — with a cooldown so a build that
|
|
5
|
-
// is still broken cannot reload in a loop — pulling fresh HTML with the new
|
|
6
|
-
// asset references.
|
|
7
|
-
//
|
|
8
|
-
// This module holds only framework-agnostic logic. App-specific work, such as
|
|
9
|
-
// closing a Convex socket before the reload, is injected through `onBeforeReload`
|
|
10
|
-
// so nothing here imports Convex, a router or React.
|
|
11
|
-
|
|
12
|
-
/** Default cooldown: a second reload inside this window is refused. */
|
|
13
1
|
const DEFAULT_COOLDOWN_MS = 10_000;
|
|
14
|
-
/** `sessionStorage` key holding the timestamp of the last reload attempt. */
|
|
15
2
|
const DEFAULT_STORAGE_KEY = "deployment-reload-ts";
|
|
16
|
-
/** Query param used to bypass cached HTML on recovery. Stripped on boot. */
|
|
17
3
|
const DEFAULT_RELOAD_PARAM = "_vb_reload";
|
|
18
|
-
/** Vite serves hashed modules from here; a failed load under it means a new build. */
|
|
19
4
|
const DEFAULT_ASSETS_PATH = "/assets/";
|
|
20
5
|
|
|
21
6
|
export const STALE_DEPLOY_RELOAD_KEY = DEFAULT_STORAGE_KEY;
|
|
@@ -27,7 +12,6 @@ export function isChunkLoadError(error: unknown): boolean {
|
|
|
27
12
|
const msg = error.message;
|
|
28
13
|
return (
|
|
29
14
|
error.name === "ChunkLoadError" ||
|
|
30
|
-
// Covers Vite's "Failed to fetch dynamically imported module".
|
|
31
15
|
msg.includes("dynamically imported module") ||
|
|
32
16
|
msg.includes("Importing a module script failed") ||
|
|
33
17
|
msg.includes("Failed to load module script") ||
|
|
@@ -38,11 +22,8 @@ export function isChunkLoadError(error: unknown): boolean {
|
|
|
38
22
|
}
|
|
39
23
|
|
|
40
24
|
export type StaleDeployReloadConfig = {
|
|
41
|
-
/** Cooldown window in ms; a reload inside it is refused. Default 10000. */
|
|
42
25
|
cooldownMs?: number;
|
|
43
|
-
/** `sessionStorage` key for the cooldown timestamp. Default `deployment-reload-ts`. */
|
|
44
26
|
storageKey?: string;
|
|
45
|
-
/** Cache-bust query param, set on reload and stripped on boot. Default `_vb_reload`. */
|
|
46
27
|
reloadParam?: string;
|
|
47
28
|
};
|
|
48
29
|
|
|
@@ -60,7 +41,6 @@ export function claimStaleDeployReload(config: StaleDeployReloadConfig = {}): bo
|
|
|
60
41
|
sessionStorage.setItem(storageKey, String(Date.now()));
|
|
61
42
|
return true;
|
|
62
43
|
} catch {
|
|
63
|
-
// sessionStorage unavailable (e.g. private browsing); allow the reload.
|
|
64
44
|
return true;
|
|
65
45
|
}
|
|
66
46
|
}
|
|
@@ -76,7 +56,6 @@ export function stripStaleDeployReloadParam(
|
|
|
76
56
|
url.searchParams.delete(reloadParam);
|
|
77
57
|
history.replaceState(history.state, "", `${url.pathname}${url.search}${url.hash}`);
|
|
78
58
|
} catch {
|
|
79
|
-
// No location/history (non-browser); nothing to strip.
|
|
80
59
|
}
|
|
81
60
|
}
|
|
82
61
|
|
|
@@ -94,12 +73,6 @@ export function reloadForStaleDeploy(
|
|
|
94
73
|
location.replace(url.href);
|
|
95
74
|
}
|
|
96
75
|
|
|
97
|
-
/**
|
|
98
|
-
* True when a resource-load `error` targets a hashed module/modulepreload under
|
|
99
|
-
* the assets path. These errors (wrong MIME / 404 on `<script type="module">`)
|
|
100
|
-
* carry no `Error` object and do not bubble, so the listener below runs in the
|
|
101
|
-
* capture phase and inspects the event target instead.
|
|
102
|
-
*/
|
|
103
76
|
function isFailedHashedModule(target: EventTarget | null, assetsPath: string): boolean {
|
|
104
77
|
if (!(target instanceof HTMLScriptElement) && !(target instanceof HTMLLinkElement)) {
|
|
105
78
|
return false;
|
|
@@ -111,16 +84,9 @@ function isFailedHashedModule(target: EventTarget | null, assetsPath: string): b
|
|
|
111
84
|
}
|
|
112
85
|
|
|
113
86
|
export type InstallStaleDeployReloadOptions = StaleDeployReloadConfig & {
|
|
114
|
-
/**
|
|
115
|
-
* Runs just before the reload, e.g. `() => convex.close()`. Errors are
|
|
116
|
-
* swallowed so a failed teardown still reloads.
|
|
117
|
-
*/
|
|
118
87
|
onBeforeReload?: () => void;
|
|
119
|
-
/** When false, `install` registers nothing and returns a no-op. Default true. */
|
|
120
88
|
enabled?: boolean;
|
|
121
|
-
/** Assets path a failed module load must be under. Default `/assets/`. */
|
|
122
89
|
assetsPath?: string;
|
|
123
|
-
/** Reload hook. Default `reloadForStaleDeploy`. Override in tests. */
|
|
124
90
|
reload?: () => void;
|
|
125
91
|
};
|
|
126
92
|
|
|
@@ -150,17 +116,12 @@ export function installStaleDeployReload(
|
|
|
150
116
|
|
|
151
117
|
const doReload = reload ?? (() => reloadForStaleDeploy({ reloadParam }));
|
|
152
118
|
|
|
153
|
-
// Claim before preventDefault. Vite's preload helper resolves the failed
|
|
154
|
-
// `import()` to `undefined` when `vite:preloadError` is canceled; a lazy
|
|
155
|
-
// component then crashes reading `.default`. Preventing only after the claim
|
|
156
|
-
// wins keeps a refused claim from swallowing the rejection.
|
|
157
119
|
const handle = (event: Event): void => {
|
|
158
120
|
if (!claimStaleDeployReload({ cooldownMs, storageKey })) return;
|
|
159
121
|
event.preventDefault();
|
|
160
122
|
try {
|
|
161
123
|
onBeforeReload?.();
|
|
162
124
|
} catch {
|
|
163
|
-
// Teardown (e.g. a socket already closing) may throw; reload regardless.
|
|
164
125
|
}
|
|
165
126
|
doReload();
|
|
166
127
|
};
|
|
@@ -176,7 +137,6 @@ export function installStaleDeployReload(
|
|
|
176
137
|
};
|
|
177
138
|
|
|
178
139
|
window.addEventListener("vite:preloadError", onPreloadError);
|
|
179
|
-
// Resource-load errors do not bubble, so listen in the capture phase.
|
|
180
140
|
window.addEventListener("error", onError, true);
|
|
181
141
|
window.addEventListener("unhandledrejection", onRejection);
|
|
182
142
|
|
|
@@ -8,19 +8,12 @@ export type UpdateToastOptions = {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export type UpdateAvailableWatcherOptions = {
|
|
11
|
-
/** Origin to poll, usually `window.location.origin`. */
|
|
12
11
|
origin: string;
|
|
13
|
-
/** Toast API. Pass sonner's `toast`, or a fake in tests. */
|
|
14
12
|
toast: { message: (title: string, opts: UpdateToastOptions) => void };
|
|
15
|
-
/** Close the Convex socket before reload. Errors are swallowed. */
|
|
16
13
|
closeConvex?: () => void;
|
|
17
|
-
/** Poll interval in ms. Default 60000. */
|
|
18
14
|
pollMs?: number;
|
|
19
|
-
/** Default `app-update-available`. */
|
|
20
15
|
toastId?: string;
|
|
21
|
-
/** Pass `!import.meta.env.DEV`. When false, nothing starts. Default true. */
|
|
22
16
|
enabled?: boolean;
|
|
23
|
-
/** Reload hook. Default `window.location.reload()`. */
|
|
24
17
|
reload?: () => void;
|
|
25
18
|
};
|
|
26
19
|
|
|
@@ -53,7 +46,6 @@ export function showUpdateAvailableToast({
|
|
|
53
46
|
try {
|
|
54
47
|
closeConvex?.();
|
|
55
48
|
} catch {
|
|
56
|
-
// socket may already be closed during teardown
|
|
57
49
|
}
|
|
58
50
|
reload();
|
|
59
51
|
},
|
|
@@ -3,9 +3,6 @@ import { formatForDisplay } from "@tanstack/react-hotkeys";
|
|
|
3
3
|
import { cn } from "../cn.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { useAltHeld } from "./useAltHeld.js";
|
|
6
|
-
|
|
7
|
-
// `Hotkey` covers combinations, not a bare modifier, so the literal is parsed
|
|
8
|
-
// in rather than asserted. `formatForDisplay` renders it as ⌥ / Alt.
|
|
9
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
7
|
const ALT_HOTKEY = z.custom().parse("Alt");
|
|
11
8
|
|