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,151 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Archive, Copy, Download, Edit3, FolderPlus, Trash2 } from 'lucide-react';
|
|
4
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
6
|
+
import type { FsEntry } from './schema';
|
|
7
|
+
|
|
8
|
+
export interface ContextMenuState {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
entry: FsEntry;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface FilesContextMenuProps {
|
|
15
|
+
state: ContextMenuState;
|
|
16
|
+
currentPath: string;
|
|
17
|
+
filesRoot: string;
|
|
18
|
+
selectedNames: Set<string>;
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
onRename: (entry: FsEntry) => void;
|
|
21
|
+
onDelete: (entry: FsEntry) => void;
|
|
22
|
+
onDownload: (entry: FsEntry) => void;
|
|
23
|
+
onDownloadZip: (names: string[]) => void;
|
|
24
|
+
onNewFolder: () => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function FilesContextMenu({
|
|
28
|
+
state,
|
|
29
|
+
currentPath,
|
|
30
|
+
filesRoot,
|
|
31
|
+
selectedNames,
|
|
32
|
+
onClose,
|
|
33
|
+
onRename,
|
|
34
|
+
onDelete,
|
|
35
|
+
onDownload,
|
|
36
|
+
onDownloadZip,
|
|
37
|
+
onNewFolder,
|
|
38
|
+
}: FilesContextMenuProps) {
|
|
39
|
+
const menuRef = useRef<HTMLDivElement>(null);
|
|
40
|
+
|
|
41
|
+
const handleCopyPath = useCallback(() => {
|
|
42
|
+
const relativePath = currentPath === '/' ? `/${state.entry.name}` : `${currentPath}/${state.entry.name}`;
|
|
43
|
+
const absolutePath = filesRoot ? `${filesRoot}${relativePath}` : relativePath;
|
|
44
|
+
navigator.clipboard.writeText(absolutePath);
|
|
45
|
+
onClose();
|
|
46
|
+
}, [currentPath, filesRoot, state.entry.name, onClose]);
|
|
47
|
+
|
|
48
|
+
const handleRename = useCallback(() => {
|
|
49
|
+
onRename(state.entry);
|
|
50
|
+
onClose();
|
|
51
|
+
}, [state.entry, onRename, onClose]);
|
|
52
|
+
|
|
53
|
+
const handleDelete = useCallback(() => {
|
|
54
|
+
onDelete(state.entry);
|
|
55
|
+
onClose();
|
|
56
|
+
}, [state.entry, onDelete, onClose]);
|
|
57
|
+
|
|
58
|
+
const handleDownload = useCallback(() => {
|
|
59
|
+
onDownload(state.entry);
|
|
60
|
+
onClose();
|
|
61
|
+
}, [state.entry, onDownload, onClose]);
|
|
62
|
+
|
|
63
|
+
const handleDownloadZip = useCallback(() => {
|
|
64
|
+
onDownloadZip([...selectedNames]);
|
|
65
|
+
onClose();
|
|
66
|
+
}, [selectedNames, onDownloadZip, onClose]);
|
|
67
|
+
|
|
68
|
+
const handleNewFolder = useCallback(() => {
|
|
69
|
+
onNewFolder();
|
|
70
|
+
onClose();
|
|
71
|
+
}, [onNewFolder, onClose]);
|
|
72
|
+
|
|
73
|
+
// Close on Escape or click outside
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
const handleKeyDown = (e: KeyboardEvent) => {
|
|
76
|
+
if (e.key === 'Escape') onClose();
|
|
77
|
+
};
|
|
78
|
+
const handleMouseDown = (e: MouseEvent) => {
|
|
79
|
+
if (menuRef.current && !menuRef.current.contains(e.target as Node)) {
|
|
80
|
+
onClose();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
84
|
+
document.addEventListener('mousedown', handleMouseDown);
|
|
85
|
+
return () => {
|
|
86
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
87
|
+
document.removeEventListener('mousedown', handleMouseDown);
|
|
88
|
+
};
|
|
89
|
+
}, [onClose]);
|
|
90
|
+
|
|
91
|
+
// Adjust position to stay within viewport
|
|
92
|
+
const style: React.CSSProperties = {
|
|
93
|
+
position: 'fixed',
|
|
94
|
+
left: state.x,
|
|
95
|
+
top: state.y,
|
|
96
|
+
zIndex: 9999,
|
|
97
|
+
background: 'var(--khal-menu-bg)',
|
|
98
|
+
border: '1px solid var(--khal-menu-border)',
|
|
99
|
+
boxShadow: 'var(--khal-menu-shadow)',
|
|
100
|
+
color: 'var(--khal-text-primary)',
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return createPortal(
|
|
104
|
+
<div
|
|
105
|
+
ref={menuRef}
|
|
106
|
+
className="min-w-[10rem] overflow-hidden rounded-xl p-1 animate-in fade-in-0 zoom-in-95"
|
|
107
|
+
style={style}
|
|
108
|
+
>
|
|
109
|
+
<MenuItem icon={<Edit3 className="h-3.5 w-3.5" />} label="Rename" onClick={handleRename} />
|
|
110
|
+
{!state.entry.isDir && (
|
|
111
|
+
<MenuItem icon={<Download className="h-3.5 w-3.5" />} label="Download" onClick={handleDownload} />
|
|
112
|
+
)}
|
|
113
|
+
{selectedNames.size > 1 && (
|
|
114
|
+
<MenuItem
|
|
115
|
+
icon={<Archive className="h-3.5 w-3.5" />}
|
|
116
|
+
label={`Download ${selectedNames.size} as Zip`}
|
|
117
|
+
onClick={handleDownloadZip}
|
|
118
|
+
/>
|
|
119
|
+
)}
|
|
120
|
+
<MenuItem icon={<Trash2 className="h-3.5 w-3.5" />} label="Delete" onClick={handleDelete} destructive />
|
|
121
|
+
<MenuItem icon={<Copy className="h-3.5 w-3.5" />} label="Copy Path" onClick={handleCopyPath} />
|
|
122
|
+
<div className="-mx-1 my-1 h-px" style={{ background: 'var(--khal-border-default)' }} />
|
|
123
|
+
<MenuItem icon={<FolderPlus className="h-3.5 w-3.5" />} label="New Folder" onClick={handleNewFolder} />
|
|
124
|
+
</div>,
|
|
125
|
+
document.body
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function MenuItem({
|
|
130
|
+
icon,
|
|
131
|
+
label,
|
|
132
|
+
onClick,
|
|
133
|
+
destructive,
|
|
134
|
+
}: {
|
|
135
|
+
icon: React.ReactNode;
|
|
136
|
+
label: string;
|
|
137
|
+
onClick: () => void;
|
|
138
|
+
destructive?: boolean;
|
|
139
|
+
}) {
|
|
140
|
+
return (
|
|
141
|
+
<button
|
|
142
|
+
type="button"
|
|
143
|
+
className="relative flex w-full cursor-default items-center gap-2 rounded-lg px-2 py-1.5 text-copy-13 outline-none select-none transition-colors hover:bg-[var(--khal-menu-hover)]"
|
|
144
|
+
style={{ color: destructive ? 'var(--khal-danger, #ef4444)' : 'var(--khal-text-primary)' }}
|
|
145
|
+
onClick={onClick}
|
|
146
|
+
>
|
|
147
|
+
{icon}
|
|
148
|
+
{label}
|
|
149
|
+
</button>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Trash2 } from 'lucide-react';
|
|
4
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
6
|
+
|
|
7
|
+
interface DeleteConfirmDialogProps {
|
|
8
|
+
/** Names of items to delete */
|
|
9
|
+
names: string[];
|
|
10
|
+
onConfirm: () => void;
|
|
11
|
+
onCancel: () => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function DeleteConfirmDialog({ names, onConfirm, onCancel }: DeleteConfirmDialogProps) {
|
|
15
|
+
const cancelRef = useRef<HTMLButtonElement>(null);
|
|
16
|
+
|
|
17
|
+
// Focus cancel button on mount, close on Escape
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
cancelRef.current?.focus();
|
|
20
|
+
const handleKeyDown = (e: KeyboardEvent) => {
|
|
21
|
+
if (e.key === 'Escape') onCancel();
|
|
22
|
+
};
|
|
23
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
24
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
25
|
+
}, [onCancel]);
|
|
26
|
+
|
|
27
|
+
const handleBackdropClick = useCallback(
|
|
28
|
+
(e: React.MouseEvent) => {
|
|
29
|
+
if (e.target === e.currentTarget) onCancel();
|
|
30
|
+
},
|
|
31
|
+
[onCancel]
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const label = names.length === 1 ? names[0] : `${names.length} items`;
|
|
35
|
+
|
|
36
|
+
return createPortal(
|
|
37
|
+
<div
|
|
38
|
+
className="fixed inset-0 z-[9999] flex items-center justify-center bg-black/40"
|
|
39
|
+
onClick={handleBackdropClick}
|
|
40
|
+
onKeyDown={undefined}
|
|
41
|
+
role="presentation"
|
|
42
|
+
>
|
|
43
|
+
<div className="flex w-80 flex-col gap-4 rounded-xl border border-gray-alpha-200 bg-background-100 p-5 shadow-xl animate-in fade-in-0 zoom-in-95">
|
|
44
|
+
<div className="flex items-start gap-3">
|
|
45
|
+
<div className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-red-100 dark:bg-red-900/30">
|
|
46
|
+
<Trash2 className="h-4.5 w-4.5 text-red-600 dark:text-red-400" />
|
|
47
|
+
</div>
|
|
48
|
+
<div className="flex flex-col gap-1">
|
|
49
|
+
<span className="text-label-14 font-medium text-gray-1000">Delete {label}?</span>
|
|
50
|
+
<span className="text-copy-13 text-gray-800">
|
|
51
|
+
{names.length === 1
|
|
52
|
+
? 'This action cannot be undone.'
|
|
53
|
+
: `This will permanently delete ${names.length} items.`}
|
|
54
|
+
</span>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
<div className="flex justify-end gap-2">
|
|
58
|
+
<button
|
|
59
|
+
ref={cancelRef}
|
|
60
|
+
type="button"
|
|
61
|
+
onClick={onCancel}
|
|
62
|
+
className="rounded-lg border border-gray-alpha-400 bg-background-100 px-3 py-1.5 text-label-13 text-gray-1000 transition-colors hover:bg-gray-alpha-100"
|
|
63
|
+
>
|
|
64
|
+
Cancel
|
|
65
|
+
</button>
|
|
66
|
+
<button
|
|
67
|
+
type="button"
|
|
68
|
+
onClick={onConfirm}
|
|
69
|
+
className="rounded-lg bg-red-600 px-3 py-1.5 text-label-13 text-white transition-colors hover:bg-red-700"
|
|
70
|
+
>
|
|
71
|
+
Delete
|
|
72
|
+
</button>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>,
|
|
76
|
+
document.body
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
File,
|
|
5
|
+
FileArchive,
|
|
6
|
+
FileAudio,
|
|
7
|
+
FileCode,
|
|
8
|
+
FileImage,
|
|
9
|
+
FileJson,
|
|
10
|
+
FileSpreadsheet,
|
|
11
|
+
FileText,
|
|
12
|
+
FileVideo,
|
|
13
|
+
Folder,
|
|
14
|
+
} from 'lucide-react';
|
|
15
|
+
import type { FsEntry } from './schema';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Map of file extensions to icon components.
|
|
19
|
+
*/
|
|
20
|
+
const extensionIcons: Record<string, typeof File> = {
|
|
21
|
+
// Images
|
|
22
|
+
png: FileImage,
|
|
23
|
+
jpg: FileImage,
|
|
24
|
+
jpeg: FileImage,
|
|
25
|
+
gif: FileImage,
|
|
26
|
+
svg: FileImage,
|
|
27
|
+
webp: FileImage,
|
|
28
|
+
ico: FileImage,
|
|
29
|
+
// Video
|
|
30
|
+
mp4: FileVideo,
|
|
31
|
+
mov: FileVideo,
|
|
32
|
+
avi: FileVideo,
|
|
33
|
+
mkv: FileVideo,
|
|
34
|
+
webm: FileVideo,
|
|
35
|
+
// Audio
|
|
36
|
+
mp3: FileAudio,
|
|
37
|
+
wav: FileAudio,
|
|
38
|
+
flac: FileAudio,
|
|
39
|
+
ogg: FileAudio,
|
|
40
|
+
// Code
|
|
41
|
+
ts: FileCode,
|
|
42
|
+
tsx: FileCode,
|
|
43
|
+
js: FileCode,
|
|
44
|
+
jsx: FileCode,
|
|
45
|
+
py: FileCode,
|
|
46
|
+
rb: FileCode,
|
|
47
|
+
go: FileCode,
|
|
48
|
+
rs: FileCode,
|
|
49
|
+
c: FileCode,
|
|
50
|
+
cpp: FileCode,
|
|
51
|
+
h: FileCode,
|
|
52
|
+
css: FileCode,
|
|
53
|
+
html: FileCode,
|
|
54
|
+
// Data
|
|
55
|
+
json: FileJson,
|
|
56
|
+
yaml: FileCode,
|
|
57
|
+
yml: FileCode,
|
|
58
|
+
toml: FileCode,
|
|
59
|
+
xml: FileCode,
|
|
60
|
+
// Documents
|
|
61
|
+
md: FileText,
|
|
62
|
+
txt: FileText,
|
|
63
|
+
pdf: FileText,
|
|
64
|
+
doc: FileText,
|
|
65
|
+
docx: FileText,
|
|
66
|
+
// Spreadsheets
|
|
67
|
+
csv: FileSpreadsheet,
|
|
68
|
+
xls: FileSpreadsheet,
|
|
69
|
+
xlsx: FileSpreadsheet,
|
|
70
|
+
// Archives
|
|
71
|
+
zip: FileArchive,
|
|
72
|
+
tar: FileArchive,
|
|
73
|
+
gz: FileArchive,
|
|
74
|
+
rar: FileArchive,
|
|
75
|
+
'7z': FileArchive,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Get the appropriate icon component for a file entry.
|
|
80
|
+
*/
|
|
81
|
+
export function getFileIcon(entry: FsEntry): typeof File {
|
|
82
|
+
if (entry.isDir) return Folder;
|
|
83
|
+
const ext = entry.name.split('.').pop()?.toLowerCase() ?? '';
|
|
84
|
+
return extensionIcons[ext] ?? File;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Format file size in human-readable format.
|
|
89
|
+
*/
|
|
90
|
+
export function formatSize(bytes: number): string {
|
|
91
|
+
if (bytes === 0) return '0 B';
|
|
92
|
+
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
93
|
+
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
94
|
+
const value = bytes / 1024 ** i;
|
|
95
|
+
return `${value < 10 ? value.toFixed(1) : Math.round(value)} ${units[i]}`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Format a timestamp (epoch ms) as a relative or short date string.
|
|
100
|
+
*/
|
|
101
|
+
export function formatDate(mtime: number): string {
|
|
102
|
+
if (mtime === 0) return '--';
|
|
103
|
+
const now = Date.now();
|
|
104
|
+
const diff = now - mtime;
|
|
105
|
+
|
|
106
|
+
const seconds = Math.floor(diff / 1000);
|
|
107
|
+
if (seconds < 60) return 'just now';
|
|
108
|
+
|
|
109
|
+
const minutes = Math.floor(seconds / 60);
|
|
110
|
+
if (minutes < 60) return `${minutes}m ago`;
|
|
111
|
+
|
|
112
|
+
const hours = Math.floor(minutes / 60);
|
|
113
|
+
if (hours < 24) return `${hours}h ago`;
|
|
114
|
+
|
|
115
|
+
const days = Math.floor(hours / 24);
|
|
116
|
+
if (days < 7) return `${days}d ago`;
|
|
117
|
+
|
|
118
|
+
const date = new Date(mtime);
|
|
119
|
+
const month = date.toLocaleString('en', { month: 'short' });
|
|
120
|
+
const day = date.getDate();
|
|
121
|
+
const year = date.getFullYear();
|
|
122
|
+
const currentYear = new Date().getFullYear();
|
|
123
|
+
|
|
124
|
+
if (year === currentYear) {
|
|
125
|
+
return `${month} ${day}`;
|
|
126
|
+
}
|
|
127
|
+
return `${month} ${day}, ${year}`;
|
|
128
|
+
}
|