khal-os 1.260324.2
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/.env.example +23 -0
- package/.genie/mailbox/cli-sent.jsonl +3 -0
- package/.genie/mailbox/ds1-wave2-engineer-1.json +15 -0
- package/.genie/mailbox/ds1-wave2-engineer-2.json +15 -0
- package/.genie/mailbox/ds1-wave2-engineer-3.json +15 -0
- package/.genie/state/os-observability.json +39 -0
- package/.genie/state/tmux-control-mode-terminal.json +28 -0
- package/.genie/wishes/genieos-one-theme/WISH.md +417 -0
- package/.genie/wishes/workos-prod-rbac/WISH.md +345 -0
- package/.github/workflows/ci.yml +39 -0
- package/.github/workflows/release.yml +78 -0
- package/.github/workflows/version.yml +122 -0
- package/.husky/pre-commit +1 -0
- package/.pnpm-approve-builds.json +1 -0
- package/CLAUDE.md +117 -0
- package/LICENSE +21 -0
- package/README.md +38 -0
- package/biome.json +124 -0
- package/bun.lock +1249 -0
- package/docs/workos-setup.md +116 -0
- package/ecosystem.config.cjs +26 -0
- package/instrumentation.ts +8 -0
- package/knip.json +35 -0
- package/nats.conf +7 -0
- package/next.config.ts +25 -0
- package/package.json +78 -0
- package/packages/dev3000-app/components.ts +12 -0
- package/packages/dev3000-app/manifest.ts +19 -0
- package/packages/dev3000-app/package.json +23 -0
- package/packages/dev3000-app/views/dev3000/Dev3000App.tsx +758 -0
- package/packages/dev3000-app/views/dev3000/ErrorsPanel.tsx +160 -0
- package/packages/dev3000-app/views/dev3000/dev3000-context.tsx +21 -0
- package/packages/dev3000-app/views/dev3000/index.ts +4 -0
- package/packages/dev3000-app/views/dev3000/schema.ts +55 -0
- package/packages/dev3000-app/views/dev3000/service/index.ts +358 -0
- package/packages/dev3000-app/views/dev3000/service/runtime +1 -0
- package/packages/dev3000-app/views/dev3000/subjects.ts +9 -0
- package/packages/dev3000-app/views/dev3000/types.ts +77 -0
- package/packages/files-app/components.ts +12 -0
- package/packages/files-app/manifest.ts +19 -0
- package/packages/files-app/package.json +23 -0
- package/packages/files-app/views/files/ContextMenu.tsx +151 -0
- package/packages/files-app/views/files/DeleteConfirmDialog.tsx +39 -0
- package/packages/files-app/views/files/FileItem.tsx +128 -0
- package/packages/files-app/views/files/FilesApp.tsx +509 -0
- package/packages/files-app/views/files/FilesListView.tsx +201 -0
- package/packages/files-app/views/files/FilesToolbar.tsx +117 -0
- package/packages/files-app/views/files/GridView.tsx +90 -0
- package/packages/files-app/views/files/InlineInput.tsx +131 -0
- package/packages/files-app/views/files/UploadOverlay.tsx +61 -0
- package/packages/files-app/views/files/schema.ts +49 -0
- package/packages/files-app/views/files/service/index.ts +184 -0
- package/packages/files-app/views/files/service/runtime +1 -0
- package/packages/files-app/views/files/use-files.ts +201 -0
- package/packages/files-app/views/files/use-upload.ts +105 -0
- package/packages/genie-app/components.ts +12 -0
- package/packages/genie-app/lib/subjects.ts +87 -0
- package/packages/genie-app/manifest.ts +19 -0
- package/packages/genie-app/package.json +29 -0
- package/packages/genie-app/views/genie/service/agent-lifecycle.ts +136 -0
- package/packages/genie-app/views/genie/service/cli.ts +114 -0
- package/packages/genie-app/views/genie/service/comms.ts +141 -0
- package/packages/genie-app/views/genie/service/directory.ts +167 -0
- package/packages/genie-app/views/genie/service/index.ts +219 -0
- package/packages/genie-app/views/genie/service/system.ts +123 -0
- package/packages/genie-app/views/genie/service/teams.ts +191 -0
- package/packages/genie-app/views/genie/service/terminal-proxy.ts +184 -0
- package/packages/genie-app/views/genie/service/tmux-control.ts +318 -0
- package/packages/genie-app/views/genie/service/wishes.ts +270 -0
- package/packages/genie-app/views/genie/ui/GenieApp.tsx +5 -0
- package/packages/genie-app/views/genie/ui/PaneCard.tsx +307 -0
- package/packages/genie-app/views/genie/ui/Sidebar.tsx +212 -0
- package/packages/genie-app/views/genie/ui/TabBar.tsx +70 -0
- package/packages/genie-app/views/genie/ui/WorkspaceCanvas.tsx +343 -0
- package/packages/genie-app/views/genie/ui/XTermPane.tsx +306 -0
- package/packages/genie-app/views/genie/ui/hooks/useNatsAction.ts +54 -0
- package/packages/genie-app/views/genie/ui/hooks/useNatsRequest.ts +68 -0
- package/packages/genie-app/views/genie/ui/panels/AgentsPanel.tsx +399 -0
- package/packages/genie-app/views/genie/ui/panels/ChatPanel.tsx +351 -0
- package/packages/genie-app/views/genie/ui/panels/SystemPanel.tsx +195 -0
- package/packages/genie-app/views/genie/ui/panels/TeamsPanel.tsx +560 -0
- package/packages/genie-app/views/genie/ui/panels/WishesPanel.tsx +424 -0
- package/packages/nats-viewer-app/components.ts +12 -0
- package/packages/nats-viewer-app/manifest.ts +18 -0
- package/packages/nats-viewer-app/package.json +14 -0
- package/packages/nats-viewer-app/views/nats-viewer/ActiveSubs.tsx +34 -0
- package/packages/nats-viewer-app/views/nats-viewer/MessageLog.tsx +247 -0
- package/packages/nats-viewer-app/views/nats-viewer/NatsViewer.tsx +209 -0
- package/packages/nats-viewer-app/views/nats-viewer/PublishPanel.tsx +111 -0
- package/packages/nats-viewer-app/views/nats-viewer/RequestPanel.tsx +165 -0
- package/packages/nats-viewer-app/views/nats-viewer/Sidebar.tsx +59 -0
- package/packages/nats-viewer-app/views/nats-viewer/SubjectCatalog.tsx +63 -0
- package/packages/nats-viewer-app/views/nats-viewer/SubscribeInput.tsx +59 -0
- package/packages/nats-viewer-app/views/nats-viewer/index.ts +5 -0
- package/packages/nats-viewer-app/views/nats-viewer/nats-viewer-context.tsx +31 -0
- package/packages/nats-viewer-app/views/nats-viewer/types.ts +7 -0
- package/packages/nats-viewer-app/views/nats-viewer/use-message-buffer.ts +55 -0
- package/packages/os-cli/package.json +18 -0
- package/packages/os-cli/src/commands/events.ts +176 -0
- package/packages/os-cli/src/commands/logs.ts +96 -0
- package/packages/os-cli/src/commands/status.ts +53 -0
- package/packages/os-cli/src/commands/traces.ts +115 -0
- package/packages/os-cli/src/index.ts +15 -0
- package/packages/os-cli/src/lib/formatter.ts +123 -0
- package/packages/os-cli/src/lib/nats.ts +16 -0
- package/packages/os-cli/src/lib/trace-tree.ts +144 -0
- package/packages/os-cli/tsconfig.json +12 -0
- package/packages/os-sdk/package.json +27 -0
- package/packages/os-sdk/src/api/handler.ts +67 -0
- package/packages/os-sdk/src/config.ts +68 -0
- package/packages/os-sdk/src/db/factory.test.ts +42 -0
- package/packages/os-sdk/src/db/factory.ts +72 -0
- package/packages/os-sdk/src/db/migrate.ts +140 -0
- package/packages/os-sdk/src/db/provision.ts +44 -0
- package/packages/os-sdk/src/index.ts +36 -0
- package/packages/os-sdk/src/service/console-intercept.ts +60 -0
- package/packages/os-sdk/src/service/logger.ts +88 -0
- package/packages/os-sdk/src/service/o11y-streams.ts +88 -0
- package/packages/os-sdk/src/service/runtime.ts +259 -0
- package/packages/os-sdk/src/service/trace.ts +71 -0
- package/packages/os-sdk/tsconfig.json +16 -0
- package/packages/os-ui/package.json +13 -0
- package/packages/os-ui/src/index.ts +29 -0
- package/packages/os-ui/src/server.ts +4 -0
- package/packages/os-ui/tsconfig.json +19 -0
- package/packages/settings-app/components.ts +12 -0
- package/packages/settings-app/manifest.ts +18 -0
- package/packages/settings-app/package.json +14 -0
- package/packages/settings-app/views/settings/Settings.tsx +492 -0
- package/packages/terminal-app/components.ts +12 -0
- package/packages/terminal-app/manifest.ts +20 -0
- package/packages/terminal-app/package.json +23 -0
- package/packages/terminal-app/views/terminal/schema.ts +82 -0
- package/packages/terminal-app/views/terminal/service/index.ts +133 -0
- package/packages/terminal-app/views/terminal/service/runtime +1 -0
- package/packages/terminal-app/views/terminal/service/session.ts +290 -0
- package/packages/terminal-app/views/terminal/service/shell-hooks/bashrc-hook.sh +21 -0
- package/packages/terminal-app/views/terminal/types.ts +26 -0
- package/packages/terminal-app/views/terminal/ui/MultiTerminalApp.tsx +615 -0
- package/packages/terminal-app/views/terminal/ui/SplitDragHandle.tsx +91 -0
- package/packages/terminal-app/views/terminal/ui/SplitPaneRenderer.tsx +112 -0
- package/packages/terminal-app/views/terminal/ui/TerminalPane.tsx +478 -0
- package/packages/terminal-app/views/terminal/ui/TerminalTabBar.tsx +131 -0
- package/pnpm-workspace.yaml +9 -0
- package/postcss.config.mjs +7 -0
- package/public/file.svg +1 -0
- package/public/globe.svg +1 -0
- package/public/icons/code-server.svg +6 -0
- package/public/icons/default.svg +5 -0
- package/public/icons/dusk/1password.svg +1 -0
- package/public/icons/dusk/activity_monitor.svg +1 -0
- package/public/icons/dusk/app_store.svg +1 -0
- package/public/icons/dusk/atom.svg +1 -0
- package/public/icons/dusk/brave.svg +1 -0
- package/public/icons/dusk/calculator.svg +1 -0
- package/public/icons/dusk/calendar.svg +1 -0
- package/public/icons/dusk/chrome.svg +1 -0
- package/public/icons/dusk/chrome2.svg +1 -0
- package/public/icons/dusk/dashboard.svg +13 -0
- package/public/icons/dusk/discord.svg +1 -0
- package/public/icons/dusk/dropbox.svg +1 -0
- package/public/icons/dusk/electron.svg +1 -0
- package/public/icons/dusk/figma.svg +1 -0
- package/public/icons/dusk/finder.svg +1 -0
- package/public/icons/dusk/finder2.svg +1 -0
- package/public/icons/dusk/finder3.svg +1 -0
- package/public/icons/dusk/firefox.svg +1 -0
- package/public/icons/dusk/framer.svg +1 -0
- package/public/icons/dusk/gimp.svg +1 -0
- package/public/icons/dusk/github_desktop.svg +1 -0
- package/public/icons/dusk/hyper.svg +1 -0
- package/public/icons/dusk/hyper3.svg +1 -0
- package/public/icons/dusk/intellij.svg +1 -0
- package/public/icons/dusk/iterm2.svg +1 -0
- package/public/icons/dusk/itunes.svg +1 -0
- package/public/icons/dusk/mail.svg +1 -0
- package/public/icons/dusk/messenger.svg +1 -0
- package/public/icons/dusk/mongodb.svg +1 -0
- package/public/icons/dusk/notes.svg +1 -0
- package/public/icons/dusk/notion.svg +1 -0
- package/public/icons/dusk/obs.svg +1 -0
- package/public/icons/dusk/pages.svg +1 -0
- package/public/icons/dusk/photos.svg +1 -0
- package/public/icons/dusk/postman.svg +1 -0
- package/public/icons/dusk/preview.svg +1 -0
- package/public/icons/dusk/reminders.svg +1 -0
- package/public/icons/dusk/safari.svg +1 -0
- package/public/icons/dusk/sequel_pro.svg +1 -0
- package/public/icons/dusk/sketch.svg +1 -0
- package/public/icons/dusk/skype.svg +1 -0
- package/public/icons/dusk/slack.svg +1 -0
- package/public/icons/dusk/slack2.svg +1 -0
- package/public/icons/dusk/spotify.svg +1 -0
- package/public/icons/dusk/steam.svg +1 -0
- package/public/icons/dusk/system_preferences.svg +1 -0
- package/public/icons/dusk/tableplus.svg +1 -0
- package/public/icons/dusk/teams.svg +1 -0
- package/public/icons/dusk/telegram.svg +1 -0
- package/public/icons/dusk/terminal.svg +1 -0
- package/public/icons/dusk/todoist.svg +1 -0
- package/public/icons/dusk/trash.svg +1 -0
- package/public/icons/dusk/trello.svg +1 -0
- package/public/icons/dusk/vivaldi.svg +1 -0
- package/public/icons/dusk/vlc.svg +1 -0
- package/public/icons/dusk/vscode.svg +1 -0
- package/public/icons/dusk/whatsapp.svg +1 -0
- package/public/icons/dusk/xeyes.svg +1 -0
- package/public/icons/dusk/zoom.svg +1 -0
- package/public/icons/files.svg +5 -0
- package/public/icons/pwa/icon-192.png +0 -0
- package/public/icons/pwa/icon-512.png +0 -0
- package/public/icons/settings.svg +14 -0
- package/public/icons/terminal.svg +5 -0
- package/public/icons/text-editor.svg +7 -0
- package/public/manifest.json +38 -0
- package/public/next.svg +1 -0
- package/public/sw.js +41 -0
- package/public/vercel.svg +1 -0
- package/public/wallpapers/default.svg +10 -0
- package/public/window.svg +1 -0
- package/scripts/generate-pwa-icons.mjs +33 -0
- package/scripts/install-nats.sh +37 -0
- package/sentry.client.config.ts +21 -0
- package/sentry.edge.config.ts +12 -0
- package/sentry.server.config.ts +12 -0
- package/src/app/api/files/download/route.ts +81 -0
- package/src/app/api/files/download-zip/route.ts +102 -0
- package/src/app/api/files/upload/route.ts +58 -0
- package/src/app/api/webhooks/workos/route.ts +98 -0
- package/src/app/auth/callback/route.ts +16 -0
- package/src/app/auth/logout/route.ts +15 -0
- package/src/app/desktop/desktop-shell.tsx +110 -0
- package/src/app/desktop/layout.tsx +8 -0
- package/src/app/desktop/page.tsx +24 -0
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +7 -0
- package/src/app/layout.tsx +64 -0
- package/src/app/offline/page.tsx +83 -0
- package/src/app/page.tsx +5 -0
- package/src/app/standalone/[appId]/page.tsx +28 -0
- package/src/app/standalone/layout.tsx +10 -0
- package/src/components/app-icon.tsx +55 -0
- package/src/components/apps/_echo/schema.ts +14 -0
- package/src/components/apps/_echo/service/index.ts +42 -0
- package/src/components/apps/app-manifest.ts +97 -0
- package/src/components/apps/app-registry.ts +55 -0
- package/src/components/apps/dev3000/Dev3000App.tsx +224 -0
- package/src/components/apps/dev3000/ErrorsPanel.tsx +160 -0
- package/src/components/apps/dev3000/Sidebar.tsx +41 -0
- package/src/components/apps/dev3000/TimelineLog.tsx +173 -0
- package/src/components/apps/dev3000/dev3000-context.tsx +29 -0
- package/src/components/apps/dev3000/index.ts +4 -0
- package/src/components/apps/dev3000/schema.ts +48 -0
- package/src/components/apps/dev3000/service/index.ts +520 -0
- package/src/components/apps/dev3000/service/runtime +1 -0
- package/src/components/apps/dev3000/types.ts +15 -0
- package/src/components/apps/dev3000/use-message-buffer.ts +46 -0
- package/src/components/apps/files/ContextMenu.tsx +151 -0
- package/src/components/apps/files/DeleteConfirmDialog.tsx +78 -0
- package/src/components/apps/files/FileItem.tsx +128 -0
- package/src/components/apps/files/FilesApp.tsx +509 -0
- package/src/components/apps/files/FilesListView.tsx +201 -0
- package/src/components/apps/files/FilesToolbar.tsx +117 -0
- package/src/components/apps/files/GridView.tsx +90 -0
- package/src/components/apps/files/InlineInput.tsx +131 -0
- package/src/components/apps/files/UploadOverlay.tsx +61 -0
- package/src/components/apps/files/schema.ts +49 -0
- package/src/components/apps/files/service/index.ts +227 -0
- package/src/components/apps/files/service/runtime +1 -0
- package/src/components/apps/files/use-files.ts +201 -0
- package/src/components/apps/files/use-upload.ts +105 -0
- package/src/components/apps/nats-viewer/ActiveSubs.tsx +34 -0
- package/src/components/apps/nats-viewer/MessageLog.tsx +247 -0
- package/src/components/apps/nats-viewer/NatsViewer.tsx +209 -0
- package/src/components/apps/nats-viewer/PublishPanel.tsx +113 -0
- package/src/components/apps/nats-viewer/RequestPanel.tsx +167 -0
- package/src/components/apps/nats-viewer/Sidebar.tsx +62 -0
- package/src/components/apps/nats-viewer/SubjectCatalog.tsx +64 -0
- package/src/components/apps/nats-viewer/SubscribeInput.tsx +59 -0
- package/src/components/apps/nats-viewer/index.ts +5 -0
- package/src/components/apps/nats-viewer/nats-viewer-context.tsx +31 -0
- package/src/components/apps/nats-viewer/types.ts +7 -0
- package/src/components/apps/nats-viewer/use-message-buffer.ts +55 -0
- package/src/components/apps/settings/Settings.tsx +492 -0
- package/src/components/apps/terminal/schema.ts +82 -0
- package/src/components/apps/terminal/service/index.ts +189 -0
- package/src/components/apps/terminal/service/runtime +1 -0
- package/src/components/apps/terminal/service/session.ts +296 -0
- package/src/components/apps/terminal/service/shell-hooks/bashrc-hook.sh +21 -0
- package/src/components/apps/terminal/types.ts +26 -0
- package/src/components/apps/terminal/ui/MultiTerminalApp.tsx +617 -0
- package/src/components/apps/terminal/ui/SplitDragHandle.tsx +91 -0
- package/src/components/apps/terminal/ui/SplitPaneRenderer.tsx +112 -0
- package/src/components/apps/terminal/ui/TerminalPane.tsx +476 -0
- package/src/components/apps/terminal/ui/TerminalTabBar.tsx +131 -0
- package/src/components/desktop/AnimatedBackground.tsx +69 -0
- package/src/components/desktop/Desktop.tsx +79 -0
- package/src/components/desktop/DesktopBackground.tsx +16 -0
- package/src/components/desktop/DesktopIcon.tsx +49 -0
- package/src/components/desktop/ShortcutViewer.tsx +136 -0
- package/src/components/desktop/WindowRenderer.tsx +34 -0
- package/src/components/desktop/WindowSwitcher.tsx +42 -0
- package/src/components/notifications/NotificationCenter.tsx +153 -0
- package/src/components/notifications/NotificationToasts.tsx +66 -0
- package/src/components/notifications/OrphanSessionToast.tsx +293 -0
- package/src/components/os-primitives/collapsible-sidebar.tsx +226 -0
- package/src/components/os-primitives/dialog.tsx +76 -0
- package/src/components/os-primitives/empty-state.tsx +43 -0
- package/src/components/os-primitives/index.ts +21 -0
- package/src/components/os-primitives/list-view.tsx +155 -0
- package/src/components/os-primitives/property-panel.tsx +108 -0
- package/src/components/os-primitives/section-header.tsx +19 -0
- package/src/components/os-primitives/sidebar-nav.tsx +110 -0
- package/src/components/os-primitives/split-pane.tsx +146 -0
- package/src/components/os-primitives/status-badge.tsx +10 -0
- package/src/components/os-primitives/status-bar.tsx +100 -0
- package/src/components/os-primitives/toolbar.tsx +152 -0
- package/src/components/taskbar/AppLauncher.tsx +114 -0
- package/src/components/taskbar/RunningApps.tsx +71 -0
- package/src/components/taskbar/SystemTray.tsx +134 -0
- package/src/components/taskbar/Taskbar.tsx +45 -0
- package/src/components/taskbar/UserMenu.tsx +138 -0
- package/src/components/taskbar/WorkspaceSwitcher.tsx +9 -0
- package/src/components/ui/ContextMenu.tsx +130 -0
- package/src/components/ui/badge.tsx +39 -0
- package/src/components/ui/button.tsx +102 -0
- package/src/components/ui/command.tsx +165 -0
- package/src/components/ui/dropdown-menu.tsx +233 -0
- package/src/components/ui/input.tsx +48 -0
- package/src/components/ui/note.tsx +55 -0
- package/src/components/ui/separator.tsx +25 -0
- package/src/components/ui/spinner.tsx +42 -0
- package/src/components/ui/switch.tsx +36 -0
- package/src/components/ui/theme-provider.tsx +24 -0
- package/src/components/ui/theme-switcher.tsx +51 -0
- package/src/components/ui/tooltip.tsx +62 -0
- package/src/components/window/MobileWindowStack.tsx +218 -0
- package/src/components/window/SnapPreview.tsx +37 -0
- package/src/components/window/StandaloneFrame.tsx +170 -0
- package/src/components/window/Window.tsx +423 -0
- package/src/components/window/WindowContent.tsx +14 -0
- package/src/components/window/WindowControlsOverlay.tsx +89 -0
- package/src/components/window/WindowFrame.tsx +124 -0
- package/src/lib/auth/index.ts +27 -0
- package/src/lib/auth/roles.ts +50 -0
- package/src/lib/auth/types.ts +32 -0
- package/src/lib/auth/use-auth.ts +53 -0
- package/src/lib/auth/webhook-handler.ts +87 -0
- package/src/lib/auth/workos.ts +67 -0
- package/src/lib/constants.ts +1 -0
- package/src/lib/desktop/dedup.ts +57 -0
- package/src/lib/desktop/schema.ts +55 -0
- package/src/lib/files/filename-validation.ts +41 -0
- package/src/lib/files/safe-path.ts +49 -0
- package/src/lib/hooks/use-desktop-nats.ts +438 -0
- package/src/lib/hooks/use-is-mobile.ts +23 -0
- package/src/lib/hooks/use-launch-app.ts +79 -0
- package/src/lib/hooks/use-nats-notifications.ts +84 -0
- package/src/lib/hooks/use-nats.ts +60 -0
- package/src/lib/hooks/use-visual-viewport.ts +72 -0
- package/src/lib/icons/resolve-window-icon.ts +10 -0
- package/src/lib/keyboard/defaults.ts +146 -0
- package/src/lib/keyboard/types.ts +52 -0
- package/src/lib/keyboard/use-global-keybinds.ts +231 -0
- package/src/lib/nats-client.ts +255 -0
- package/src/lib/nats.ts +35 -0
- package/src/lib/notifications/schema.ts +12 -0
- package/src/lib/service-loader.ts +171 -0
- package/src/lib/subjects.ts +64 -0
- package/src/lib/utils.ts +6 -0
- package/src/lib/ws-bridge.ts +288 -0
- package/src/lib/ws-protocol.ts +53 -0
- package/src/lib/ws-server.ts +167 -0
- package/src/middleware.ts +57 -0
- package/src/stores/desktop-store.ts +112 -0
- package/src/stores/keybind-store.ts +66 -0
- package/src/stores/notification-store.ts +271 -0
- package/src/stores/theme-store.ts +25 -0
- package/src/stores/window-store.ts +294 -0
- package/src/theme/animations.css +68 -0
- package/src/theme/base.css +123 -0
- package/src/theme/controls.css +35 -0
- package/src/theme/design-tokens.css +276 -0
- package/src/theme/index.css +23 -0
- package/src/theme/menus.css +45 -0
- package/src/theme/status.css +41 -0
- package/src/theme/surfaces.css +94 -0
- package/src/theme/tailwind-map.css +138 -0
- package/src/theme/taskbar.css +25 -0
- package/src/theme/terminal.css +55 -0
- package/src/theme/typography.css +26 -0
- package/src/theme/utilities.css +156 -0
- package/src/theme/window.css +103 -0
- package/src/types/desktop-entry.ts +12 -0
- package/src/types/use-descendants.d.ts +13 -0
- package/src/types/window.ts +28 -0
- package/src/types.d.ts +9 -0
- package/tauri/Cargo.lock +5464 -0
- package/tauri/Cargo.toml +19 -0
- package/tauri/build.rs +3 -0
- package/tauri/capabilities/default.json +36 -0
- package/tauri/icons/128x128.png +0 -0
- package/tauri/icons/128x128@2x.png +0 -0
- package/tauri/icons/32x32.png +0 -0
- package/tauri/icons/icon.png +0 -0
- package/tauri/src/main.rs +396 -0
- package/tauri/tauri.conf.json +23 -0
- package/tsconfig.json +43 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createContext, type ReactNode, useCallback, useContext, useRef, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// CollapsibleSidebar — resizable sidebar with collapse/expand toggle.
|
|
7
|
+
//
|
|
8
|
+
// Usage:
|
|
9
|
+
// <CollapsibleSidebar defaultSize={220} min={160} max={360}>
|
|
10
|
+
// <CollapsibleSidebar.Header>
|
|
11
|
+
// <span>Explorer</span>
|
|
12
|
+
// <CollapsibleSidebar.CollapseButton />
|
|
13
|
+
// </CollapsibleSidebar.Header>
|
|
14
|
+
// <CollapsibleSidebar.Content>
|
|
15
|
+
// <FileTree />
|
|
16
|
+
// </CollapsibleSidebar.Content>
|
|
17
|
+
// </CollapsibleSidebar>
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
interface SidebarContextValue {
|
|
21
|
+
collapsed: boolean;
|
|
22
|
+
toggle: () => void;
|
|
23
|
+
size: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const SidebarContext = createContext<SidebarContextValue>({
|
|
27
|
+
collapsed: false,
|
|
28
|
+
toggle: () => {},
|
|
29
|
+
size: 220,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export function useSidebar() {
|
|
33
|
+
return useContext(SidebarContext);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface CollapsibleSidebarProps {
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
defaultSize?: number;
|
|
39
|
+
min?: number;
|
|
40
|
+
max?: number;
|
|
41
|
+
defaultCollapsed?: boolean;
|
|
42
|
+
side?: 'left' | 'right';
|
|
43
|
+
className?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function CollapsibleSidebarRoot({
|
|
47
|
+
children,
|
|
48
|
+
defaultSize = 220,
|
|
49
|
+
min = 140,
|
|
50
|
+
max = 400,
|
|
51
|
+
defaultCollapsed = false,
|
|
52
|
+
side = 'left',
|
|
53
|
+
className = '',
|
|
54
|
+
}: CollapsibleSidebarProps) {
|
|
55
|
+
const [collapsed, setCollapsed] = useState(defaultCollapsed);
|
|
56
|
+
const [size, setSize] = useState(defaultSize);
|
|
57
|
+
const dragging = useRef(false);
|
|
58
|
+
const startX = useRef(0);
|
|
59
|
+
const startSize = useRef(0);
|
|
60
|
+
|
|
61
|
+
const toggle = useCallback(() => setCollapsed((v) => !v), []);
|
|
62
|
+
|
|
63
|
+
const onPointerDown = useCallback(
|
|
64
|
+
(e: React.PointerEvent) => {
|
|
65
|
+
if (collapsed) return;
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
dragging.current = true;
|
|
68
|
+
startX.current = e.clientX;
|
|
69
|
+
startSize.current = size;
|
|
70
|
+
(e.target as HTMLElement).setPointerCapture(e.pointerId);
|
|
71
|
+
},
|
|
72
|
+
[collapsed, size]
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const onPointerMove = useCallback(
|
|
76
|
+
(e: React.PointerEvent) => {
|
|
77
|
+
if (!dragging.current) return;
|
|
78
|
+
const delta = side === 'left' ? e.clientX - startX.current : startX.current - e.clientX;
|
|
79
|
+
setSize(Math.min(max, Math.max(min, startSize.current + delta)));
|
|
80
|
+
},
|
|
81
|
+
[side, min, max]
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const onPointerUp = useCallback(() => {
|
|
85
|
+
dragging.current = false;
|
|
86
|
+
}, []);
|
|
87
|
+
|
|
88
|
+
const resizeHandle = (
|
|
89
|
+
<div
|
|
90
|
+
className={`w-px shrink-0 cursor-col-resize bg-gray-alpha-200 transition-colors hover:w-0.5 hover:bg-blue-700/50 active:w-0.5 active:bg-blue-700 ${
|
|
91
|
+
collapsed ? 'pointer-events-none' : ''
|
|
92
|
+
}`}
|
|
93
|
+
onPointerDown={onPointerDown}
|
|
94
|
+
onPointerMove={onPointerMove}
|
|
95
|
+
onPointerUp={onPointerUp}
|
|
96
|
+
role="separator"
|
|
97
|
+
aria-orientation="vertical"
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<SidebarContext.Provider value={{ collapsed, toggle, size }}>
|
|
103
|
+
<div className={`flex shrink-0 ${className}`} style={{ width: collapsed ? 0 : size }}>
|
|
104
|
+
{side === 'right' && resizeHandle}
|
|
105
|
+
<div
|
|
106
|
+
className={`flex h-full flex-col overflow-hidden transition-[width] duration-150 ${
|
|
107
|
+
collapsed ? 'w-0' : 'w-full'
|
|
108
|
+
}`}
|
|
109
|
+
>
|
|
110
|
+
{children}
|
|
111
|
+
</div>
|
|
112
|
+
{side === 'left' && resizeHandle}
|
|
113
|
+
</div>
|
|
114
|
+
</SidebarContext.Provider>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// ---------------------------------------------------------------------------
|
|
119
|
+
// CollapsibleSidebar.Header
|
|
120
|
+
// ---------------------------------------------------------------------------
|
|
121
|
+
|
|
122
|
+
function SidebarHeader({ children, className = '' }: { children: ReactNode; className?: string }) {
|
|
123
|
+
return (
|
|
124
|
+
<div className={`flex h-9 shrink-0 items-center justify-between border-b border-gray-alpha-200 px-3 ${className}`}>
|
|
125
|
+
{children}
|
|
126
|
+
</div>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
// CollapsibleSidebar.CollapseButton
|
|
132
|
+
// ---------------------------------------------------------------------------
|
|
133
|
+
|
|
134
|
+
function CollapseButton({ className = '' }: { className?: string }) {
|
|
135
|
+
const { collapsed, toggle } = useSidebar();
|
|
136
|
+
return (
|
|
137
|
+
<button
|
|
138
|
+
onClick={toggle}
|
|
139
|
+
className={`inline-flex h-5 w-5 items-center justify-center rounded text-gray-800 hover:bg-gray-alpha-200 hover:text-gray-1000 transition-colors ${className}`}
|
|
140
|
+
aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}
|
|
141
|
+
>
|
|
142
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none">
|
|
143
|
+
<path
|
|
144
|
+
d={collapsed ? 'M4.5 2L8.5 6L4.5 10' : 'M8.5 2L4.5 6L8.5 10'}
|
|
145
|
+
stroke="currentColor"
|
|
146
|
+
strokeWidth="1.5"
|
|
147
|
+
strokeLinecap="round"
|
|
148
|
+
strokeLinejoin="round"
|
|
149
|
+
/>
|
|
150
|
+
</svg>
|
|
151
|
+
</button>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
// CollapsibleSidebar.Content
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
158
|
+
|
|
159
|
+
function SidebarContent({ children, className = '' }: { children: ReactNode; className?: string }) {
|
|
160
|
+
return <div className={`flex-1 overflow-y-auto ${className}`}>{children}</div>;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// ---------------------------------------------------------------------------
|
|
164
|
+
// CollapsibleSidebar.Section
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
|
|
167
|
+
function SidebarSection({
|
|
168
|
+
title,
|
|
169
|
+
children,
|
|
170
|
+
className = '',
|
|
171
|
+
}: {
|
|
172
|
+
title?: string;
|
|
173
|
+
children: ReactNode;
|
|
174
|
+
className?: string;
|
|
175
|
+
}) {
|
|
176
|
+
return (
|
|
177
|
+
<div className={`${className}`}>
|
|
178
|
+
{title && (
|
|
179
|
+
<div className="px-3 pt-2 pb-1">
|
|
180
|
+
<span className="text-label-13 font-medium text-gray-800">{title}</span>
|
|
181
|
+
</div>
|
|
182
|
+
)}
|
|
183
|
+
{children}
|
|
184
|
+
</div>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// ---------------------------------------------------------------------------
|
|
189
|
+
// CollapsibleSidebar.Item
|
|
190
|
+
// ---------------------------------------------------------------------------
|
|
191
|
+
|
|
192
|
+
interface SidebarItemProps {
|
|
193
|
+
children: ReactNode;
|
|
194
|
+
icon?: ReactNode;
|
|
195
|
+
active?: boolean;
|
|
196
|
+
indent?: number;
|
|
197
|
+
onClick?: () => void;
|
|
198
|
+
className?: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function SidebarItem({ children, icon, active, indent = 0, onClick, className = '' }: SidebarItemProps) {
|
|
202
|
+
return (
|
|
203
|
+
<button
|
|
204
|
+
onClick={onClick}
|
|
205
|
+
className={`flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-label-13 transition-colors
|
|
206
|
+
${active ? 'bg-gray-alpha-200 text-gray-1000' : 'text-gray-900 hover:bg-gray-alpha-100 hover:text-gray-1000'}
|
|
207
|
+
${className}`}
|
|
208
|
+
style={{ paddingLeft: 8 + indent * 12 }}
|
|
209
|
+
>
|
|
210
|
+
{icon && <span className="shrink-0 text-gray-800 [&>svg]:h-3.5 [&>svg]:w-3.5">{icon}</span>}
|
|
211
|
+
<span className="min-w-0 truncate">{children}</span>
|
|
212
|
+
</button>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// ---------------------------------------------------------------------------
|
|
217
|
+
// Export
|
|
218
|
+
// ---------------------------------------------------------------------------
|
|
219
|
+
|
|
220
|
+
export const CollapsibleSidebar = Object.assign(CollapsibleSidebarRoot, {
|
|
221
|
+
Header: SidebarHeader,
|
|
222
|
+
CollapseButton,
|
|
223
|
+
Content: SidebarContent,
|
|
224
|
+
Section: SidebarSection,
|
|
225
|
+
Item: SidebarItem,
|
|
226
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
/* ------------------------------------------------------------------ */
|
|
6
|
+
/* Minimal compound Dialog primitive for OS chrome. */
|
|
7
|
+
/* Enough to satisfy DeleteConfirmDialog; expand as needed. */
|
|
8
|
+
/* ------------------------------------------------------------------ */
|
|
9
|
+
|
|
10
|
+
interface DialogRootProps {
|
|
11
|
+
open: boolean;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function DialogRoot({ open, onClose, children }: DialogRootProps) {
|
|
17
|
+
if (!open) return null;
|
|
18
|
+
return (
|
|
19
|
+
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/40" onClick={onClose}>
|
|
20
|
+
<div
|
|
21
|
+
className="bg-popover text-popover-foreground rounded-lg border p-6 shadow-lg"
|
|
22
|
+
onClick={(e) => e.stopPropagation()}
|
|
23
|
+
>
|
|
24
|
+
{children}
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function Body({ children }: { children: ReactNode }) {
|
|
31
|
+
return <div className="flex items-start gap-4">{children}</div>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function Icon({ children, variant: _variant }: { children: ReactNode; variant?: string }) {
|
|
35
|
+
return <div className="shrink-0">{children}</div>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function Title({ children }: { children: ReactNode }) {
|
|
39
|
+
return <h2 className="text-lg font-semibold">{children}</h2>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function Description({ children }: { children: ReactNode }) {
|
|
43
|
+
return <p className="text-muted-foreground text-sm">{children}</p>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function Actions({ children }: { children: ReactNode }) {
|
|
47
|
+
return <div className="mt-4 flex justify-end gap-2">{children}</div>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type BtnProps = ButtonHTMLAttributes<HTMLButtonElement> & { variant?: string };
|
|
51
|
+
|
|
52
|
+
function Cancel({ children, ...props }: BtnProps) {
|
|
53
|
+
return (
|
|
54
|
+
<button type="button" className="rounded px-3 py-1.5 text-sm hover:bg-muted" {...props}>
|
|
55
|
+
{children}
|
|
56
|
+
</button>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function Confirm({ children, variant: _variant, ...props }: BtnProps) {
|
|
61
|
+
return (
|
|
62
|
+
<button type="button" className="rounded bg-destructive px-3 py-1.5 text-sm text-destructive-foreground" {...props}>
|
|
63
|
+
{children}
|
|
64
|
+
</button>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const Dialog = Object.assign(DialogRoot, {
|
|
69
|
+
Body,
|
|
70
|
+
Icon,
|
|
71
|
+
Title,
|
|
72
|
+
Description,
|
|
73
|
+
Actions,
|
|
74
|
+
Cancel,
|
|
75
|
+
Confirm,
|
|
76
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// EmptyState — placeholder for empty views (no files, no results, etc.).
|
|
7
|
+
//
|
|
8
|
+
// Usage:
|
|
9
|
+
// <EmptyState
|
|
10
|
+
// icon={<FolderOpen />}
|
|
11
|
+
// title="No files"
|
|
12
|
+
// description="This folder is empty."
|
|
13
|
+
// action={<Button onClick={upload}>Upload File</Button>}
|
|
14
|
+
// />
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
interface EmptyStateProps {
|
|
18
|
+
icon?: ReactNode;
|
|
19
|
+
title: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
action?: ReactNode;
|
|
22
|
+
compact?: boolean;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function EmptyState({ icon, title, description, action, compact, className = '' }: EmptyStateProps) {
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
className={`flex flex-col items-center justify-center text-center ${
|
|
30
|
+
compact ? 'gap-2 py-6' : 'gap-3 py-12'
|
|
31
|
+
} ${className}`}
|
|
32
|
+
>
|
|
33
|
+
{icon && (
|
|
34
|
+
<div className={`text-gray-700 ${compact ? '[&>svg]:h-5 [&>svg]:w-5' : '[&>svg]:h-8 [&>svg]:w-8'}`}>{icon}</div>
|
|
35
|
+
)}
|
|
36
|
+
<div className="space-y-0.5">
|
|
37
|
+
<p className="text-label-13 font-medium text-gray-1000">{title}</p>
|
|
38
|
+
{description && <p className={`text-gray-800 ${compact ? 'text-label-13' : 'text-label-13'}`}>{description}</p>}
|
|
39
|
+
</div>
|
|
40
|
+
{action && <div className="mt-2 shrink-0">{action}</div>}
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// OS Primitives — UI building blocks for desktop app chrome.
|
|
2
|
+
// Built on top of shadcn/ui components and Geist design tokens.
|
|
3
|
+
//
|
|
4
|
+
// These fill the gap between shadcn's web-focused components and the
|
|
5
|
+
// needs of a desktop-style app (toolbars, split panes, status bars, etc.).
|
|
6
|
+
//
|
|
7
|
+
// shadcn/ui components to use directly (from @/components/ui/*):
|
|
8
|
+
// Button, Input, Badge, Spinner, Separator, Tooltip, Toggle (Switch),
|
|
9
|
+
// ContextMenu, Command (CommandDialog), DropdownMenu, Note, LoadingDots,
|
|
10
|
+
// ThemeSwitcher
|
|
11
|
+
|
|
12
|
+
export { CollapsibleSidebar, useSidebar } from './collapsible-sidebar';
|
|
13
|
+
export { EmptyState } from './empty-state';
|
|
14
|
+
export { ListView } from './list-view';
|
|
15
|
+
export { PropertyPanel } from './property-panel';
|
|
16
|
+
export { SectionHeader } from './section-header';
|
|
17
|
+
export { SidebarNav } from './sidebar-nav';
|
|
18
|
+
export { SplitPane } from './split-pane';
|
|
19
|
+
export { StatusBadge } from './status-badge';
|
|
20
|
+
export { StatusBar } from './status-bar';
|
|
21
|
+
export { Toolbar } from './toolbar';
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type KeyboardEvent, type ReactNode, useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// ListView — selectable list with keyboard navigation.
|
|
7
|
+
//
|
|
8
|
+
// Usage:
|
|
9
|
+
// <ListView
|
|
10
|
+
// items={files}
|
|
11
|
+
// selected={selectedId}
|
|
12
|
+
// onSelect={setSelectedId}
|
|
13
|
+
// onActivate={(item) => openFile(item)}
|
|
14
|
+
// renderItem={(item, { selected, focused }) => (
|
|
15
|
+
// <div className="flex items-center gap-2">
|
|
16
|
+
// <FileIcon name={item.name} />
|
|
17
|
+
// <span>{item.name}</span>
|
|
18
|
+
// </div>
|
|
19
|
+
// )}
|
|
20
|
+
// getKey={(item) => item.id}
|
|
21
|
+
// />
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
interface ListViewProps<T> {
|
|
25
|
+
items: T[];
|
|
26
|
+
selected?: string | string[] | null;
|
|
27
|
+
onSelect?: (key: string | null) => void;
|
|
28
|
+
onActivate?: (item: T) => void;
|
|
29
|
+
renderItem: (item: T, state: { selected: boolean; focused: boolean; index: number }) => ReactNode;
|
|
30
|
+
getKey: (item: T) => string;
|
|
31
|
+
multiSelect?: boolean;
|
|
32
|
+
emptyMessage?: string;
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function ListView<T>({
|
|
37
|
+
items,
|
|
38
|
+
selected,
|
|
39
|
+
onSelect,
|
|
40
|
+
onActivate,
|
|
41
|
+
renderItem,
|
|
42
|
+
getKey,
|
|
43
|
+
multiSelect = false,
|
|
44
|
+
emptyMessage = 'No items',
|
|
45
|
+
className = '',
|
|
46
|
+
}: ListViewProps<T>) {
|
|
47
|
+
const [focusIndex, setFocusIndex] = useState(0);
|
|
48
|
+
const listRef = useRef<HTMLDivElement>(null);
|
|
49
|
+
|
|
50
|
+
const selectedSet = new Set(selected == null ? [] : Array.isArray(selected) ? selected : [selected]);
|
|
51
|
+
|
|
52
|
+
const clamp = useCallback((i: number) => Math.max(0, Math.min(items.length - 1, i)), [items.length]);
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
setFocusIndex((prev) => clamp(prev));
|
|
56
|
+
}, [items.length, clamp]);
|
|
57
|
+
|
|
58
|
+
const scrollToIndex = useCallback((i: number) => {
|
|
59
|
+
const el = listRef.current?.children[i] as HTMLElement | undefined;
|
|
60
|
+
el?.scrollIntoView({ block: 'nearest' });
|
|
61
|
+
}, []);
|
|
62
|
+
|
|
63
|
+
const handleKeyDown = useCallback(
|
|
64
|
+
(e: KeyboardEvent) => {
|
|
65
|
+
switch (e.key) {
|
|
66
|
+
case 'ArrowDown': {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
const next = clamp(focusIndex + 1);
|
|
69
|
+
setFocusIndex(next);
|
|
70
|
+
scrollToIndex(next);
|
|
71
|
+
if (!multiSelect) onSelect?.(getKey(items[next]));
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case 'ArrowUp': {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
const prev = clamp(focusIndex - 1);
|
|
77
|
+
setFocusIndex(prev);
|
|
78
|
+
scrollToIndex(prev);
|
|
79
|
+
if (!multiSelect) onSelect?.(getKey(items[prev]));
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case 'Home': {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
setFocusIndex(0);
|
|
85
|
+
scrollToIndex(0);
|
|
86
|
+
if (!multiSelect && items.length > 0) onSelect?.(getKey(items[0]));
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
case 'End': {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
const last = items.length - 1;
|
|
92
|
+
setFocusIndex(last);
|
|
93
|
+
scrollToIndex(last);
|
|
94
|
+
if (!multiSelect && items.length > 0) onSelect?.(getKey(items[last]));
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case 'Enter':
|
|
98
|
+
case ' ': {
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
const item = items[focusIndex];
|
|
101
|
+
if (item) {
|
|
102
|
+
onSelect?.(getKey(item));
|
|
103
|
+
if (e.key === 'Enter') onActivate?.(item);
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
[focusIndex, items, clamp, scrollToIndex, onSelect, onActivate, getKey, multiSelect]
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
if (items.length === 0) {
|
|
113
|
+
return (
|
|
114
|
+
<div className={`flex h-full items-center justify-center text-label-13 text-gray-800 ${className}`}>
|
|
115
|
+
{emptyMessage}
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<div
|
|
122
|
+
ref={listRef}
|
|
123
|
+
className={`overflow-y-auto outline-none ${className}`}
|
|
124
|
+
role="listbox"
|
|
125
|
+
tabIndex={0}
|
|
126
|
+
onKeyDown={handleKeyDown}
|
|
127
|
+
aria-multiselectable={multiSelect}
|
|
128
|
+
>
|
|
129
|
+
{items.map((item, i) => {
|
|
130
|
+
const key = getKey(item);
|
|
131
|
+
const isSelected = selectedSet.has(key);
|
|
132
|
+
const isFocused = i === focusIndex;
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<div
|
|
136
|
+
key={key}
|
|
137
|
+
role="option"
|
|
138
|
+
aria-selected={isSelected}
|
|
139
|
+
className={`cursor-default select-none px-2 py-1 transition-colors
|
|
140
|
+
${isSelected ? 'bg-blue-700/15 text-gray-1000' : 'text-gray-1000'}
|
|
141
|
+
${isFocused && !isSelected ? 'bg-gray-alpha-100' : ''}
|
|
142
|
+
hover:bg-gray-alpha-200`}
|
|
143
|
+
onClick={() => {
|
|
144
|
+
setFocusIndex(i);
|
|
145
|
+
onSelect?.(key);
|
|
146
|
+
}}
|
|
147
|
+
onDoubleClick={() => onActivate?.(item)}
|
|
148
|
+
>
|
|
149
|
+
{renderItem(item, { selected: isSelected, focused: isFocused, index: i })}
|
|
150
|
+
</div>
|
|
151
|
+
);
|
|
152
|
+
})}
|
|
153
|
+
</div>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
import { Separator } from '@/components/ui/separator';
|
|
5
|
+
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// PropertyPanel — key-value inspector panel (like Finder's "Get Info").
|
|
8
|
+
//
|
|
9
|
+
// Usage:
|
|
10
|
+
// <PropertyPanel title="File Info">
|
|
11
|
+
// <PropertyPanel.Section title="General">
|
|
12
|
+
// <PropertyPanel.Row label="Name" value="document.pdf" />
|
|
13
|
+
// <PropertyPanel.Row label="Size" value="2.4 MB" />
|
|
14
|
+
// <PropertyPanel.Row label="Modified" value="Feb 10, 2026" />
|
|
15
|
+
// </PropertyPanel.Section>
|
|
16
|
+
// <PropertyPanel.Section title="Permissions">
|
|
17
|
+
// <PropertyPanel.Row label="Owner" value="vercel-sandbox" />
|
|
18
|
+
// <PropertyPanel.Row label="Group" value="users" />
|
|
19
|
+
// </PropertyPanel.Section>
|
|
20
|
+
// </PropertyPanel>
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
interface PropertyPanelProps {
|
|
24
|
+
title?: string;
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function PropertyPanelRoot({ title, children, className = '' }: PropertyPanelProps) {
|
|
30
|
+
return (
|
|
31
|
+
<div className={`flex flex-col overflow-y-auto ${className}`}>
|
|
32
|
+
{title && (
|
|
33
|
+
<div className="sticky top-0 z-10 border-b border-gray-alpha-200 bg-background-100 px-3 py-2">
|
|
34
|
+
<h3 className="text-label-13 font-medium text-gray-1000">{title}</h3>
|
|
35
|
+
</div>
|
|
36
|
+
)}
|
|
37
|
+
<div className="flex flex-col">{children}</div>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// PropertyPanel.Section
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
|
|
46
|
+
function PropertySection({
|
|
47
|
+
title,
|
|
48
|
+
children,
|
|
49
|
+
collapsible: _collapsible = false,
|
|
50
|
+
defaultOpen: _defaultOpen = true,
|
|
51
|
+
}: {
|
|
52
|
+
title?: string;
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
collapsible?: boolean;
|
|
55
|
+
defaultOpen?: boolean;
|
|
56
|
+
}) {
|
|
57
|
+
return (
|
|
58
|
+
<div className="border-b border-gray-alpha-200 last:border-b-0">
|
|
59
|
+
{title && (
|
|
60
|
+
<div className="px-3 pt-3 pb-1">
|
|
61
|
+
<span className="text-label-13 font-medium text-gray-800">{title}</span>
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
<div className={`px-3 pb-2 ${title ? '' : 'pt-2'}`}>{children}</div>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ---------------------------------------------------------------------------
|
|
70
|
+
// PropertyPanel.Row
|
|
71
|
+
// ---------------------------------------------------------------------------
|
|
72
|
+
|
|
73
|
+
interface PropertyRowProps {
|
|
74
|
+
label: string;
|
|
75
|
+
value?: ReactNode;
|
|
76
|
+
children?: ReactNode;
|
|
77
|
+
mono?: boolean;
|
|
78
|
+
copyable?: boolean;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function PropertyRow({ label, value, children, mono }: PropertyRowProps) {
|
|
82
|
+
return (
|
|
83
|
+
<div className="flex items-baseline justify-between gap-4 py-1">
|
|
84
|
+
<dt className="shrink-0 text-label-13 text-gray-800">{label}</dt>
|
|
85
|
+
<dd className={`min-w-0 truncate text-right text-label-13 text-gray-1000 ${mono ? 'font-mono' : ''}`}>
|
|
86
|
+
{children ?? value}
|
|
87
|
+
</dd>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
// PropertyPanel.Separator
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
|
|
96
|
+
function PropertySeparator() {
|
|
97
|
+
return <Separator className="my-1" />;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
// Export
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
|
|
104
|
+
export const PropertyPanel = Object.assign(PropertyPanelRoot, {
|
|
105
|
+
Section: PropertySection,
|
|
106
|
+
Row: PropertyRow,
|
|
107
|
+
Separator: PropertySeparator,
|
|
108
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function SectionHeader({
|
|
2
|
+
title,
|
|
3
|
+
description,
|
|
4
|
+
children,
|
|
5
|
+
}: {
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}) {
|
|
10
|
+
return (
|
|
11
|
+
<div className="mb-4 flex items-start justify-between">
|
|
12
|
+
<div>
|
|
13
|
+
<h2 className="text-copy-13 font-medium text-gray-1000">{title}</h2>
|
|
14
|
+
{description && <p className="mt-0.5 text-copy-13 text-gray-900">{description}</p>}
|
|
15
|
+
</div>
|
|
16
|
+
{children}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|