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,110 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// SidebarNav — reusable sidebar navigation for app shells.
|
|
7
|
+
//
|
|
8
|
+
// Extracts the repeated sidebar + tab-button pattern used across Settings,
|
|
9
|
+
// AppStore, etc. Designed to sit inside a SplitPane.Panel.
|
|
10
|
+
//
|
|
11
|
+
// Usage:
|
|
12
|
+
// <SidebarNav label="Settings" title="Settings">
|
|
13
|
+
// <SidebarNav.Item active={tab === "a"} onClick={() => setTab("a")} icon={<Icon />}>
|
|
14
|
+
// Appearance
|
|
15
|
+
// </SidebarNav.Item>
|
|
16
|
+
// </SidebarNav>
|
|
17
|
+
//
|
|
18
|
+
// // Multiple sections:
|
|
19
|
+
// <SidebarNav label="App Store">
|
|
20
|
+
// <SidebarNav.Group title="Packages">
|
|
21
|
+
// <SidebarNav.Item ...>GUI Apps</SidebarNav.Item>
|
|
22
|
+
// </SidebarNav.Group>
|
|
23
|
+
// <SidebarNav.Group title="Repos">
|
|
24
|
+
// ...
|
|
25
|
+
// </SidebarNav.Group>
|
|
26
|
+
// </SidebarNav>
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
|
|
29
|
+
interface SidebarNavProps {
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
/** Accessible label for the <nav> element */
|
|
32
|
+
label: string;
|
|
33
|
+
/** Optional heading displayed at the top of the sidebar */
|
|
34
|
+
title?: string;
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function SidebarNavRoot({ children, label, title, className = '' }: SidebarNavProps) {
|
|
39
|
+
return (
|
|
40
|
+
<nav className={`flex flex-col py-2 ${className}`} aria-label={label}>
|
|
41
|
+
{title && (
|
|
42
|
+
<div className="px-3 pb-1">
|
|
43
|
+
<span className="text-copy-13 font-medium text-gray-800">{title}</span>
|
|
44
|
+
</div>
|
|
45
|
+
)}
|
|
46
|
+
{children}
|
|
47
|
+
</nav>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// SidebarNav.Group — optional section divider with a title
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
|
|
55
|
+
interface SidebarNavGroupProps {
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
title?: string;
|
|
58
|
+
className?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function SidebarNavGroup({ children, title, className = '' }: SidebarNavGroupProps) {
|
|
62
|
+
return (
|
|
63
|
+
<div className={className}>
|
|
64
|
+
{title && (
|
|
65
|
+
<div className="px-3 pt-4 pb-1">
|
|
66
|
+
<span className="text-copy-13 font-medium text-gray-800">{title}</span>
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
{children}
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
// SidebarNav.Item — a single navigation button
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
|
|
78
|
+
interface SidebarNavItemProps {
|
|
79
|
+
children: ReactNode;
|
|
80
|
+
active?: boolean;
|
|
81
|
+
onClick?: () => void;
|
|
82
|
+
icon?: ReactNode;
|
|
83
|
+
/** Trailing content (e.g. a count badge) */
|
|
84
|
+
suffix?: ReactNode;
|
|
85
|
+
className?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function SidebarNavItem({ children, active, onClick, icon, suffix, className = '' }: SidebarNavItemProps) {
|
|
89
|
+
return (
|
|
90
|
+
<button
|
|
91
|
+
onClick={onClick}
|
|
92
|
+
className={`mx-1 flex items-center gap-2 rounded-md px-2 py-1 text-copy-13 transition-colors ${
|
|
93
|
+
active ? 'bg-gray-alpha-200 text-gray-1000' : 'text-gray-900 hover:bg-gray-alpha-100 hover:text-gray-1000'
|
|
94
|
+
} ${className}`}
|
|
95
|
+
>
|
|
96
|
+
{icon && <span className="shrink-0 text-gray-800 [&>svg]:h-3.5 [&>svg]:w-3.5">{icon}</span>}
|
|
97
|
+
<span className="min-w-0 truncate">{children}</span>
|
|
98
|
+
{suffix && <span className="ml-auto font-mono text-copy-13 tabular-nums text-gray-700">{suffix}</span>}
|
|
99
|
+
</button>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
// Export
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
|
|
107
|
+
export const SidebarNav = Object.assign(SidebarNavRoot, {
|
|
108
|
+
Group: SidebarNavGroup,
|
|
109
|
+
Item: SidebarNavItem,
|
|
110
|
+
});
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type CSSProperties, type ReactNode, useCallback, useRef, useState, useSyncExternalStore } from 'react';
|
|
4
|
+
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// SplitPane — resizable two-panel layout (horizontal or vertical).
|
|
7
|
+
//
|
|
8
|
+
// Usage:
|
|
9
|
+
// <SplitPane defaultSize={240} min={120} max={400}>
|
|
10
|
+
// <SplitPane.Panel>Sidebar</SplitPane.Panel>
|
|
11
|
+
// <SplitPane.Panel>Main</SplitPane.Panel>
|
|
12
|
+
// </SplitPane>
|
|
13
|
+
//
|
|
14
|
+
// <SplitPane direction="vertical" defaultSize={200} min={100}>
|
|
15
|
+
// <SplitPane.Panel>Top</SplitPane.Panel>
|
|
16
|
+
// <SplitPane.Panel>Bottom</SplitPane.Panel>
|
|
17
|
+
// </SplitPane>
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
interface SplitPaneProps {
|
|
21
|
+
children: [ReactNode, ReactNode];
|
|
22
|
+
direction?: 'horizontal' | 'vertical';
|
|
23
|
+
defaultSize?: number;
|
|
24
|
+
min?: number;
|
|
25
|
+
max?: number;
|
|
26
|
+
/** On narrow viewports, stack panels vertically and hide the resize handle */
|
|
27
|
+
collapseBelow?: number;
|
|
28
|
+
onResize?: (size: number) => void;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function useMediaQuery(query: string) {
|
|
33
|
+
const subscribe = useCallback(
|
|
34
|
+
(callback: () => void) => {
|
|
35
|
+
const mql = window.matchMedia(query);
|
|
36
|
+
mql.addEventListener('change', callback);
|
|
37
|
+
return () => mql.removeEventListener('change', callback);
|
|
38
|
+
},
|
|
39
|
+
[query]
|
|
40
|
+
);
|
|
41
|
+
const getSnapshot = useCallback(() => window.matchMedia(query).matches, [query]);
|
|
42
|
+
const getServerSnapshot = useCallback(() => false, []);
|
|
43
|
+
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function SplitPaneRoot({
|
|
47
|
+
children,
|
|
48
|
+
direction = 'horizontal',
|
|
49
|
+
defaultSize = 240,
|
|
50
|
+
min = 100,
|
|
51
|
+
max = 600,
|
|
52
|
+
collapseBelow = 640,
|
|
53
|
+
onResize,
|
|
54
|
+
className = '',
|
|
55
|
+
}: SplitPaneProps) {
|
|
56
|
+
const [size, setSize] = useState(defaultSize);
|
|
57
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
58
|
+
const dragging = useRef(false);
|
|
59
|
+
const startPos = useRef(0);
|
|
60
|
+
const startSize = useRef(0);
|
|
61
|
+
const isMobile = useMediaQuery(`(max-width: ${collapseBelow}px)`);
|
|
62
|
+
|
|
63
|
+
const isHorizontal = direction === 'horizontal' && !isMobile;
|
|
64
|
+
const [first, second] = children;
|
|
65
|
+
|
|
66
|
+
const onPointerDown = useCallback(
|
|
67
|
+
(e: React.PointerEvent) => {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
dragging.current = true;
|
|
70
|
+
startPos.current = isHorizontal ? e.clientX : e.clientY;
|
|
71
|
+
startSize.current = size;
|
|
72
|
+
(e.target as HTMLElement).setPointerCapture(e.pointerId);
|
|
73
|
+
},
|
|
74
|
+
[isHorizontal, size]
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const onPointerMove = useCallback(
|
|
78
|
+
(e: React.PointerEvent) => {
|
|
79
|
+
if (!dragging.current) return;
|
|
80
|
+
const delta = (isHorizontal ? e.clientX : e.clientY) - startPos.current;
|
|
81
|
+
const next = Math.min(max, Math.max(min, startSize.current + delta));
|
|
82
|
+
setSize(next);
|
|
83
|
+
onResize?.(next);
|
|
84
|
+
},
|
|
85
|
+
[isHorizontal, min, max, onResize]
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const onPointerUp = useCallback(() => {
|
|
89
|
+
dragging.current = false;
|
|
90
|
+
}, []);
|
|
91
|
+
|
|
92
|
+
// On mobile, stack vertically with no resize handle
|
|
93
|
+
if (isMobile) {
|
|
94
|
+
return (
|
|
95
|
+
<div ref={containerRef} className={`flex flex-col h-full w-full overflow-hidden ${className}`}>
|
|
96
|
+
<div className="shrink-0 overflow-auto border-b border-gray-alpha-200">{first}</div>
|
|
97
|
+
<div className="flex-1 overflow-hidden">{second}</div>
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const firstStyle: CSSProperties = isHorizontal
|
|
103
|
+
? { width: size, minWidth: min, maxWidth: max, flexShrink: 0 }
|
|
104
|
+
: { height: size, minHeight: min, maxHeight: max, flexShrink: 0 };
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<div
|
|
108
|
+
ref={containerRef}
|
|
109
|
+
className={`flex ${isHorizontal ? 'flex-row' : 'flex-col'} h-full w-full overflow-hidden ${className}`}
|
|
110
|
+
>
|
|
111
|
+
<div style={firstStyle} className="overflow-hidden">
|
|
112
|
+
{first}
|
|
113
|
+
</div>
|
|
114
|
+
<div
|
|
115
|
+
className={`shrink-0 ${
|
|
116
|
+
isHorizontal
|
|
117
|
+
? 'w-px cursor-col-resize hover:w-0.5 hover:bg-blue-700/50 active:w-0.5 active:bg-blue-700'
|
|
118
|
+
: 'h-px cursor-row-resize hover:h-0.5 hover:bg-blue-700/50 active:h-0.5 active:bg-blue-700'
|
|
119
|
+
} bg-gray-alpha-200 transition-colors`}
|
|
120
|
+
onPointerDown={onPointerDown}
|
|
121
|
+
onPointerMove={onPointerMove}
|
|
122
|
+
onPointerUp={onPointerUp}
|
|
123
|
+
role="separator"
|
|
124
|
+
aria-orientation={isHorizontal ? 'vertical' : 'horizontal'}
|
|
125
|
+
tabIndex={0}
|
|
126
|
+
/>
|
|
127
|
+
<div className="flex-1 overflow-hidden">{second}</div>
|
|
128
|
+
</div>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ---------------------------------------------------------------------------
|
|
133
|
+
// SplitPane.Panel — thin wrapper for semantic clarity
|
|
134
|
+
// ---------------------------------------------------------------------------
|
|
135
|
+
|
|
136
|
+
function Panel({ children, className = '' }: { children: ReactNode; className?: string }) {
|
|
137
|
+
return <div className={`h-full w-full overflow-auto ${className}`}>{children}</div>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// ---------------------------------------------------------------------------
|
|
141
|
+
// Export as compound component
|
|
142
|
+
// ---------------------------------------------------------------------------
|
|
143
|
+
|
|
144
|
+
export const SplitPane = Object.assign(SplitPaneRoot, {
|
|
145
|
+
Panel,
|
|
146
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Badge } from '@/components/ui/badge';
|
|
2
|
+
|
|
3
|
+
export function StatusBadge({ status }: { status: string }) {
|
|
4
|
+
const variant = status === 'active' ? 'green' : status === 'creating' ? 'amber' : status === 'error' ? 'red' : 'gray';
|
|
5
|
+
return (
|
|
6
|
+
<Badge variant={variant} size="sm" contrast="low">
|
|
7
|
+
{status}
|
|
8
|
+
</Badge>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
import { Separator } from '@/components/ui/separator';
|
|
5
|
+
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// StatusBar — bottom bar for app-level status, breadcrumbs, and indicators.
|
|
8
|
+
//
|
|
9
|
+
// Usage:
|
|
10
|
+
// <StatusBar>
|
|
11
|
+
// <StatusBar.Item>Ln 42, Col 18</StatusBar.Item>
|
|
12
|
+
// <StatusBar.Separator />
|
|
13
|
+
// <StatusBar.Item>UTF-8</StatusBar.Item>
|
|
14
|
+
// <StatusBar.Spacer />
|
|
15
|
+
// <StatusBar.Item icon={<CheckCircle />} variant="success">Saved</StatusBar.Item>
|
|
16
|
+
// </StatusBar>
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
interface StatusBarProps {
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function StatusBarRoot({ children, className = '' }: StatusBarProps) {
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
className={`flex h-6 shrink-0 items-center gap-0 border-t border-gray-alpha-200 bg-background-100 px-2 font-mono text-label-13 text-gray-900 ${className}`}
|
|
28
|
+
role="status"
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
// StatusBar.Item
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
interface StatusBarItemProps {
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
icon?: ReactNode;
|
|
42
|
+
variant?: 'default' | 'success' | 'warning' | 'error';
|
|
43
|
+
onClick?: () => void;
|
|
44
|
+
className?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const variantColors = {
|
|
48
|
+
default: 'text-gray-900',
|
|
49
|
+
success: 'text-green-900',
|
|
50
|
+
warning: 'text-amber-900',
|
|
51
|
+
error: 'text-red-900',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
function StatusBarItem({ children, icon, variant = 'default', onClick, className = '' }: StatusBarItemProps) {
|
|
55
|
+
const classes = `inline-flex items-center gap-1 px-1.5 py-0.5 rounded-sm ${variantColors[variant]} ${
|
|
56
|
+
onClick ? 'cursor-pointer hover:bg-gray-alpha-200 transition-colors' : ''
|
|
57
|
+
} ${className}`;
|
|
58
|
+
|
|
59
|
+
if (onClick) {
|
|
60
|
+
return (
|
|
61
|
+
<button className={classes} onClick={onClick}>
|
|
62
|
+
{icon}
|
|
63
|
+
{children}
|
|
64
|
+
</button>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<span className={classes}>
|
|
70
|
+
{icon}
|
|
71
|
+
{children}
|
|
72
|
+
</span>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
// StatusBar.Separator
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
|
|
80
|
+
function StatusBarSeparator() {
|
|
81
|
+
return <Separator orientation="vertical" className="mx-0.5 h-3" />;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
// StatusBar.Spacer
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
|
|
88
|
+
function StatusBarSpacer() {
|
|
89
|
+
return <div className="flex-1" />;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
// Export
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
|
|
96
|
+
export const StatusBar = Object.assign(StatusBarRoot, {
|
|
97
|
+
Item: StatusBarItem,
|
|
98
|
+
Separator: StatusBarSeparator,
|
|
99
|
+
Spacer: StatusBarSpacer,
|
|
100
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type ButtonHTMLAttributes, forwardRef, type ReactNode } from 'react';
|
|
4
|
+
import { Separator } from '@/components/ui/separator';
|
|
5
|
+
import { Tooltip } from '@/components/ui/tooltip';
|
|
6
|
+
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Toolbar — horizontal bar of icon buttons, groups, and separators.
|
|
9
|
+
//
|
|
10
|
+
// Usage:
|
|
11
|
+
// <Toolbar>
|
|
12
|
+
// <Toolbar.Group>
|
|
13
|
+
// <Toolbar.Button tooltip="Back" onClick={goBack}><ChevronLeft /></Toolbar.Button>
|
|
14
|
+
// <Toolbar.Button tooltip="Forward" onClick={goFwd}><ChevronRight /></Toolbar.Button>
|
|
15
|
+
// </Toolbar.Group>
|
|
16
|
+
// <Toolbar.Separator />
|
|
17
|
+
// <Toolbar.Group>
|
|
18
|
+
// <Toolbar.Button tooltip="Refresh" active={loading}><Refresh /></Toolbar.Button>
|
|
19
|
+
// </Toolbar.Group>
|
|
20
|
+
// <Toolbar.Spacer />
|
|
21
|
+
// <Toolbar.Text>3 items</Toolbar.Text>
|
|
22
|
+
// </Toolbar>
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
interface ToolbarProps {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function ToolbarRoot({ children, className = '' }: ToolbarProps) {
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
className={`flex h-9 shrink-0 items-center gap-0.5 border-b border-gray-alpha-200 bg-background-100 px-1.5 ${className}`}
|
|
34
|
+
role="toolbar"
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
// Toolbar.Button
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
|
|
45
|
+
interface ToolbarButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
46
|
+
tooltip?: string;
|
|
47
|
+
active?: boolean;
|
|
48
|
+
children: ReactNode;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const ToolbarButton = forwardRef<HTMLButtonElement, ToolbarButtonProps>(function ToolbarButton(
|
|
52
|
+
{ tooltip, active, children, className = '', disabled, ...props },
|
|
53
|
+
ref
|
|
54
|
+
) {
|
|
55
|
+
const btn = (
|
|
56
|
+
<button
|
|
57
|
+
ref={ref}
|
|
58
|
+
disabled={disabled}
|
|
59
|
+
className={`inline-flex h-7 w-7 items-center justify-center rounded-md text-gray-900 transition-colors [&>svg]:h-3.5 [&>svg]:w-3.5
|
|
60
|
+
hover:bg-gray-alpha-200 hover:text-gray-1000
|
|
61
|
+
disabled:pointer-events-none disabled:opacity-40
|
|
62
|
+
${active ? 'bg-gray-alpha-200 text-gray-1000' : ''}
|
|
63
|
+
${className}`}
|
|
64
|
+
{...props}
|
|
65
|
+
>
|
|
66
|
+
{children}
|
|
67
|
+
</button>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
if (tooltip) {
|
|
71
|
+
return (
|
|
72
|
+
<Tooltip text={tooltip} desktopOnly>
|
|
73
|
+
{btn}
|
|
74
|
+
</Tooltip>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return btn;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
// Toolbar.Group — groups buttons together with tighter spacing
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
|
|
84
|
+
function ToolbarGroup({ children, className = '' }: { children: ReactNode; className?: string }) {
|
|
85
|
+
return <div className={`flex items-center gap-px ${className}`}>{children}</div>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// Toolbar.Separator
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
|
|
92
|
+
function ToolbarSeparator() {
|
|
93
|
+
return <Separator orientation="vertical" className="mx-1 h-4" />;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
// Toolbar.Spacer — pushes subsequent items to the right
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
function ToolbarSpacer() {
|
|
101
|
+
return <div className="flex-1" />;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
// Toolbar.Text — inline text label
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
|
|
108
|
+
function ToolbarText({ children, className = '' }: { children: ReactNode; className?: string }) {
|
|
109
|
+
return <span className={`px-1.5 text-label-13 text-gray-900 ${className}`}>{children}</span>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
// Toolbar.Input — inline input (e.g. address bar)
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
|
|
116
|
+
function ToolbarInput({
|
|
117
|
+
value,
|
|
118
|
+
onChange,
|
|
119
|
+
placeholder,
|
|
120
|
+
className = '',
|
|
121
|
+
readOnly,
|
|
122
|
+
}: {
|
|
123
|
+
value?: string;
|
|
124
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
125
|
+
placeholder?: string;
|
|
126
|
+
className?: string;
|
|
127
|
+
readOnly?: boolean;
|
|
128
|
+
}) {
|
|
129
|
+
return (
|
|
130
|
+
<input
|
|
131
|
+
type="text"
|
|
132
|
+
value={value}
|
|
133
|
+
onChange={onChange}
|
|
134
|
+
placeholder={placeholder}
|
|
135
|
+
readOnly={readOnly}
|
|
136
|
+
className={`h-6 flex-1 rounded-md border border-gray-alpha-200 bg-gray-alpha-100 px-2 font-mono text-label-13 text-gray-1000 placeholder:text-gray-700 outline-none transition-colors focus:border-blue-700 ${className}`}
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
// Export as compound component
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
|
|
145
|
+
export const Toolbar = Object.assign(ToolbarRoot, {
|
|
146
|
+
Button: ToolbarButton,
|
|
147
|
+
Group: ToolbarGroup,
|
|
148
|
+
Separator: ToolbarSeparator,
|
|
149
|
+
Spacer: ToolbarSpacer,
|
|
150
|
+
Text: ToolbarText,
|
|
151
|
+
Input: ToolbarInput,
|
|
152
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { LayoutGrid } from 'lucide-react';
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { AppIcon } from '@/components/app-icon';
|
|
6
|
+
import {
|
|
7
|
+
CommandDialog,
|
|
8
|
+
CommandGroup,
|
|
9
|
+
CommandInput,
|
|
10
|
+
CommandItem,
|
|
11
|
+
CommandList,
|
|
12
|
+
CommandSeparator,
|
|
13
|
+
} from '@/components/ui/command';
|
|
14
|
+
import { getAppId, useLaunchApp } from '@/lib/hooks/use-launch-app';
|
|
15
|
+
import { useDesktopStore } from '@/stores/desktop-store';
|
|
16
|
+
import type { DesktopEntry } from '@/types/desktop-entry';
|
|
17
|
+
|
|
18
|
+
export function AppLauncher({ externalToggle }: { externalToggle?: number }) {
|
|
19
|
+
const [open, setOpen] = useState(false);
|
|
20
|
+
const apps = useDesktopStore((s) => s.apps);
|
|
21
|
+
const launchApp = useLaunchApp();
|
|
22
|
+
|
|
23
|
+
// Toggle from centralized keybind system
|
|
24
|
+
const toggleRef = useRef(externalToggle);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (externalToggle !== undefined && externalToggle !== toggleRef.current) {
|
|
27
|
+
toggleRef.current = externalToggle;
|
|
28
|
+
setOpen((prev) => !prev);
|
|
29
|
+
}
|
|
30
|
+
}, [externalToggle]);
|
|
31
|
+
|
|
32
|
+
const launch = useCallback(
|
|
33
|
+
(entry: DesktopEntry) => {
|
|
34
|
+
launchApp(entry);
|
|
35
|
+
setOpen(false);
|
|
36
|
+
},
|
|
37
|
+
[launchApp]
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const builtinApps = apps.filter((a) => a.type === 'builtin');
|
|
41
|
+
const x11Apps = apps.filter((a) => a.type === 'x11' || a.type === 'web');
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<button
|
|
46
|
+
className={`flex h-8 items-center gap-1.5 rounded-md px-2 sm:px-2.5 text-label-13 transition-all ${
|
|
47
|
+
open ? '' : ''
|
|
48
|
+
}`}
|
|
49
|
+
style={{
|
|
50
|
+
background: open ? 'var(--khal-taskbar-active-bg)' : undefined,
|
|
51
|
+
color: open ? 'var(--khal-text-primary)' : 'var(--khal-text-secondary)',
|
|
52
|
+
}}
|
|
53
|
+
onMouseEnter={(e) => {
|
|
54
|
+
if (!open) (e.currentTarget as HTMLElement).style.background = 'var(--khal-taskbar-hover-bg)';
|
|
55
|
+
}}
|
|
56
|
+
onMouseLeave={(e) => {
|
|
57
|
+
if (!open) (e.currentTarget as HTMLElement).style.background = '';
|
|
58
|
+
}}
|
|
59
|
+
onClick={() => setOpen(true)}
|
|
60
|
+
aria-label="Open app launcher"
|
|
61
|
+
>
|
|
62
|
+
<LayoutGrid aria-hidden="true" size={16} />
|
|
63
|
+
<span className="hidden text-label-13 sm:inline">Apps</span>
|
|
64
|
+
</button>
|
|
65
|
+
|
|
66
|
+
<CommandDialog open={open} onOpenChange={setOpen}>
|
|
67
|
+
<CommandInput placeholder="Search apps..." />
|
|
68
|
+
<CommandList>
|
|
69
|
+
{builtinApps.length > 0 && (
|
|
70
|
+
<CommandGroup heading="Built-in">
|
|
71
|
+
{builtinApps.map((entry) => (
|
|
72
|
+
<CommandItem
|
|
73
|
+
key={entry.id}
|
|
74
|
+
value={[entry.name, entry.comment ?? '', entry.id].join(' ')}
|
|
75
|
+
onSelect={() => launch(entry)}
|
|
76
|
+
>
|
|
77
|
+
<AppIcon appId={getAppId(entry)} size={16} className="shrink-0 rounded" />
|
|
78
|
+
<span>{entry.name}</span>
|
|
79
|
+
{entry.comment && (
|
|
80
|
+
<span className="ml-2 text-label-12" style={{ color: 'var(--khal-text-muted)' }}>
|
|
81
|
+
{entry.comment}
|
|
82
|
+
</span>
|
|
83
|
+
)}
|
|
84
|
+
</CommandItem>
|
|
85
|
+
))}
|
|
86
|
+
</CommandGroup>
|
|
87
|
+
)}
|
|
88
|
+
{x11Apps.length > 0 && (
|
|
89
|
+
<>
|
|
90
|
+
<CommandSeparator />
|
|
91
|
+
<CommandGroup heading="Applications">
|
|
92
|
+
{x11Apps.map((entry) => (
|
|
93
|
+
<CommandItem
|
|
94
|
+
key={entry.id}
|
|
95
|
+
value={[entry.name, entry.comment ?? '', entry.id, entry.exec ?? ''].join(' ')}
|
|
96
|
+
onSelect={() => launch(entry)}
|
|
97
|
+
>
|
|
98
|
+
<AppIcon appId={getAppId(entry)} size={16} className="shrink-0 rounded" />
|
|
99
|
+
<span>{entry.name}</span>
|
|
100
|
+
{entry.comment && (
|
|
101
|
+
<span className="ml-2 text-label-12" style={{ color: 'var(--khal-text-muted)' }}>
|
|
102
|
+
{entry.comment}
|
|
103
|
+
</span>
|
|
104
|
+
)}
|
|
105
|
+
</CommandItem>
|
|
106
|
+
))}
|
|
107
|
+
</CommandGroup>
|
|
108
|
+
</>
|
|
109
|
+
)}
|
|
110
|
+
</CommandList>
|
|
111
|
+
</CommandDialog>
|
|
112
|
+
</>
|
|
113
|
+
);
|
|
114
|
+
}
|