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,62 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { cn } from '@/lib/utils';
|
|
6
|
+
|
|
7
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
8
|
+
const TooltipRoot = TooltipPrimitive.Root;
|
|
9
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
10
|
+
|
|
11
|
+
const TooltipContent = React.forwardRef<
|
|
12
|
+
React.ComponentRef<typeof TooltipPrimitive.Content>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
|
14
|
+
>(({ className, sideOffset = 4, style, ...props }, ref) => (
|
|
15
|
+
<TooltipPrimitive.Portal>
|
|
16
|
+
<TooltipPrimitive.Content
|
|
17
|
+
ref={ref}
|
|
18
|
+
sideOffset={sideOffset}
|
|
19
|
+
className={cn(
|
|
20
|
+
'z-[9999] overflow-hidden rounded-md px-2.5 py-1 text-label-12',
|
|
21
|
+
'animate-in fade-in-0 zoom-in-95',
|
|
22
|
+
'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',
|
|
23
|
+
'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
style={{
|
|
27
|
+
background: 'var(--khal-text-primary, var(--ds-gray-1000))',
|
|
28
|
+
color: 'var(--khal-text-inverse, var(--ds-background-100))',
|
|
29
|
+
...style,
|
|
30
|
+
}}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
</TooltipPrimitive.Portal>
|
|
34
|
+
));
|
|
35
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
36
|
+
|
|
37
|
+
interface SimpleTooltipProps {
|
|
38
|
+
text: React.ReactNode;
|
|
39
|
+
children: React.ReactNode;
|
|
40
|
+
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
41
|
+
delay?: boolean;
|
|
42
|
+
delayTime?: number;
|
|
43
|
+
desktopOnly?: boolean;
|
|
44
|
+
className?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function Tooltip({ text, children, position = 'top', delay, delayTime, desktopOnly, className }: SimpleTooltipProps) {
|
|
48
|
+
const delayDuration = delayTime ?? (delay ? 400 : 200);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<TooltipProvider delayDuration={delayDuration}>
|
|
52
|
+
<TooltipRoot>
|
|
53
|
+
<TooltipTrigger asChild>{children}</TooltipTrigger>
|
|
54
|
+
<TooltipContent side={position} className={cn(desktopOnly && 'max-md:hidden', className)}>
|
|
55
|
+
{text}
|
|
56
|
+
</TooltipContent>
|
|
57
|
+
</TooltipRoot>
|
|
58
|
+
</TooltipProvider>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { Tooltip, TooltipRoot, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ArrowUpDown, ChevronDown, Maximize2, X } from 'lucide-react';
|
|
4
|
+
import { useCallback, useState } from 'react';
|
|
5
|
+
import { AppIcon } from '@/components/app-icon';
|
|
6
|
+
import { APP_COMPONENTS } from '@/components/apps/app-registry';
|
|
7
|
+
import { Separator } from '@/components/ui/separator';
|
|
8
|
+
import { TASKBAR_HEIGHT } from '@/lib/constants';
|
|
9
|
+
import { useVisualViewport } from '@/lib/hooks/use-visual-viewport';
|
|
10
|
+
import { useWindowStore } from '@/stores/window-store';
|
|
11
|
+
import type { WindowState } from '@/types/window';
|
|
12
|
+
|
|
13
|
+
function AppContent({ windowId, appId, meta }: { windowId: string; appId: string; meta?: Record<string, unknown> }) {
|
|
14
|
+
const AppComponent = APP_COMPONENTS[appId];
|
|
15
|
+
if (AppComponent) return <AppComponent windowId={windowId} meta={meta} />;
|
|
16
|
+
return <div className="flex h-full items-center justify-center text-neutral-500 text-sm">Unknown app: {appId}</div>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function PaneHeader({
|
|
20
|
+
win,
|
|
21
|
+
isSplit,
|
|
22
|
+
onClose,
|
|
23
|
+
onSplit,
|
|
24
|
+
onUnsplit,
|
|
25
|
+
}: {
|
|
26
|
+
win: WindowState;
|
|
27
|
+
isSplit: boolean;
|
|
28
|
+
onClose: () => void;
|
|
29
|
+
onSplit: () => void;
|
|
30
|
+
onUnsplit: () => void;
|
|
31
|
+
}) {
|
|
32
|
+
return (
|
|
33
|
+
<div className="flex shrink-0 flex-col border-b border-gray-alpha-400 bg-background-200">
|
|
34
|
+
<div className="flex h-11 items-center gap-2 px-3">
|
|
35
|
+
<span className="text-gray-900" aria-hidden="true">
|
|
36
|
+
<AppIcon appId={win.appId} size={16} className="h-4 w-4 shrink-0" />
|
|
37
|
+
</span>
|
|
38
|
+
<span className="flex-1 truncate text-label-13 text-gray-1000">{win.title}</span>
|
|
39
|
+
<button
|
|
40
|
+
className="flex h-7 w-7 items-center justify-center rounded-md text-gray-900 transition-colors active:bg-gray-alpha-200"
|
|
41
|
+
onClick={isSplit ? onUnsplit : onSplit}
|
|
42
|
+
aria-label={isSplit ? 'Exit split view' : 'Split view'}
|
|
43
|
+
>
|
|
44
|
+
{isSplit ? <Maximize2 /> : <ArrowUpDown />}
|
|
45
|
+
</button>
|
|
46
|
+
<button
|
|
47
|
+
className="flex h-7 w-7 items-center justify-center rounded-md text-gray-900 transition-colors active:bg-red-200 active:text-red-900"
|
|
48
|
+
onClick={onClose}
|
|
49
|
+
aria-label={`Close ${win.title}`}
|
|
50
|
+
>
|
|
51
|
+
<X />
|
|
52
|
+
</button>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function CollapsedRow({
|
|
59
|
+
win,
|
|
60
|
+
onExpand,
|
|
61
|
+
onSplit,
|
|
62
|
+
onClose,
|
|
63
|
+
}: {
|
|
64
|
+
win: WindowState;
|
|
65
|
+
onExpand: () => void;
|
|
66
|
+
onSplit: () => void;
|
|
67
|
+
onClose: () => void;
|
|
68
|
+
}) {
|
|
69
|
+
return (
|
|
70
|
+
<div className="flex h-12 shrink-0 items-center border-b border-gray-alpha-400 bg-background-100">
|
|
71
|
+
<button
|
|
72
|
+
className="flex flex-1 items-center gap-3 px-4 active:bg-gray-alpha-200"
|
|
73
|
+
onClick={onExpand}
|
|
74
|
+
aria-label={`Expand ${win.title}`}
|
|
75
|
+
>
|
|
76
|
+
<span className="text-gray-900" aria-hidden="true">
|
|
77
|
+
<AppIcon appId={win.appId} size={16} className="h-4 w-4 shrink-0" />
|
|
78
|
+
</span>
|
|
79
|
+
<span className="flex-1 truncate text-left text-label-14 text-gray-1000">{win.title}</span>
|
|
80
|
+
<span className="text-gray-900" aria-hidden="true">
|
|
81
|
+
<ChevronDown />
|
|
82
|
+
</span>
|
|
83
|
+
</button>
|
|
84
|
+
<button
|
|
85
|
+
className="flex h-12 w-10 items-center justify-center text-gray-900 active:bg-gray-alpha-200"
|
|
86
|
+
onClick={onSplit}
|
|
87
|
+
aria-label={`Split ${win.title}`}
|
|
88
|
+
>
|
|
89
|
+
<ArrowUpDown />
|
|
90
|
+
</button>
|
|
91
|
+
<button
|
|
92
|
+
className="flex h-12 w-10 items-center justify-center text-gray-900 active:bg-red-200 active:text-red-900"
|
|
93
|
+
onClick={onClose}
|
|
94
|
+
aria-label={`Close ${win.title}`}
|
|
95
|
+
>
|
|
96
|
+
<X />
|
|
97
|
+
</button>
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface MobileWindowStackProps {
|
|
103
|
+
windows: WindowState[];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function MobileWindowStack({ windows }: MobileWindowStackProps) {
|
|
107
|
+
const focusWindow = useWindowStore((s) => s.focusWindow);
|
|
108
|
+
const closeWindow = useWindowStore((s) => s.closeWindow);
|
|
109
|
+
const viewport = useVisualViewport();
|
|
110
|
+
const keyboardOpen = typeof window !== 'undefined' ? viewport.height < window.innerHeight - 50 : false;
|
|
111
|
+
|
|
112
|
+
const [splitId, setSplitId] = useState<string | null>(null);
|
|
113
|
+
const focusedWin = windows.find((w) => w.focused && !w.minimized);
|
|
114
|
+
const splitWin = splitId ? windows.find((w) => w.id === splitId) : null;
|
|
115
|
+
if (splitId && !splitWin) setSplitId(null);
|
|
116
|
+
const isSplit =
|
|
117
|
+
splitWin !== null && splitWin !== undefined && focusedWin !== undefined && splitWin.id !== focusedWin.id;
|
|
118
|
+
|
|
119
|
+
const collapsed = windows.filter((w) => {
|
|
120
|
+
if (focusedWin && w.id === focusedWin.id) return false;
|
|
121
|
+
if (isSplit && splitWin && w.id === splitWin.id) return false;
|
|
122
|
+
return true;
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const handleClose = useCallback(
|
|
126
|
+
(id: string) => {
|
|
127
|
+
if (id === splitId) setSplitId(null);
|
|
128
|
+
closeWindow(id);
|
|
129
|
+
},
|
|
130
|
+
[closeWindow, splitId]
|
|
131
|
+
);
|
|
132
|
+
const handleExpand = useCallback(
|
|
133
|
+
(id: string) => {
|
|
134
|
+
setSplitId(null);
|
|
135
|
+
focusWindow(id);
|
|
136
|
+
},
|
|
137
|
+
[focusWindow]
|
|
138
|
+
);
|
|
139
|
+
const handleSplitWith = useCallback(
|
|
140
|
+
(id: string) => {
|
|
141
|
+
if (!focusedWin) {
|
|
142
|
+
focusWindow(id);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
setSplitId(id);
|
|
146
|
+
},
|
|
147
|
+
[focusedWin, focusWindow]
|
|
148
|
+
);
|
|
149
|
+
const handleUnsplit = useCallback(() => setSplitId(null), []);
|
|
150
|
+
|
|
151
|
+
if (windows.length === 0) return null;
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<div
|
|
155
|
+
className="fixed left-0 right-0 top-0 z-[8000] flex flex-col bg-background-100"
|
|
156
|
+
style={{
|
|
157
|
+
height: viewport.height,
|
|
158
|
+
paddingBottom: keyboardOpen ? 0 : TASKBAR_HEIGHT,
|
|
159
|
+
transform: viewport.offsetTop ? `translateY(${viewport.offsetTop}px)` : undefined,
|
|
160
|
+
}}
|
|
161
|
+
role="region"
|
|
162
|
+
aria-label="Open applications"
|
|
163
|
+
>
|
|
164
|
+
<div className="flex flex-1 flex-col min-h-0">
|
|
165
|
+
{focusedWin && (
|
|
166
|
+
<section
|
|
167
|
+
className={`flex flex-col min-h-0 ${isSplit ? 'h-1/2' : 'flex-1'}`}
|
|
168
|
+
aria-label={`${focusedWin.title} pane`}
|
|
169
|
+
>
|
|
170
|
+
<PaneHeader
|
|
171
|
+
win={focusedWin}
|
|
172
|
+
isSplit={isSplit}
|
|
173
|
+
onClose={() => handleClose(focusedWin.id)}
|
|
174
|
+
onSplit={() => {
|
|
175
|
+
const c = collapsed[0];
|
|
176
|
+
if (c) handleSplitWith(c.id);
|
|
177
|
+
}}
|
|
178
|
+
onUnsplit={handleUnsplit}
|
|
179
|
+
/>
|
|
180
|
+
<div className="relative flex-1 min-h-0 overflow-auto bg-background-100">
|
|
181
|
+
<AppContent windowId={focusedWin.id} appId={focusedWin.appId} meta={focusedWin.meta} />
|
|
182
|
+
</div>
|
|
183
|
+
</section>
|
|
184
|
+
)}
|
|
185
|
+
{isSplit && splitWin && (
|
|
186
|
+
<>
|
|
187
|
+
<Separator className="shrink-0" decorative={false} />
|
|
188
|
+
<section className="flex h-1/2 flex-col min-h-0" aria-label={`${splitWin.title} pane`}>
|
|
189
|
+
<PaneHeader
|
|
190
|
+
win={splitWin}
|
|
191
|
+
isSplit
|
|
192
|
+
onClose={() => handleClose(splitWin.id)}
|
|
193
|
+
onSplit={() => {}}
|
|
194
|
+
onUnsplit={handleUnsplit}
|
|
195
|
+
/>
|
|
196
|
+
<div className="relative flex-1 min-h-0 overflow-auto bg-background-100">
|
|
197
|
+
<AppContent windowId={splitWin.id} appId={splitWin.appId} meta={splitWin.meta} />
|
|
198
|
+
</div>
|
|
199
|
+
</section>
|
|
200
|
+
</>
|
|
201
|
+
)}
|
|
202
|
+
</div>
|
|
203
|
+
{collapsed.length > 0 && !keyboardOpen && (
|
|
204
|
+
<div className="shrink-0 overflow-y-auto max-h-36 border-t border-gray-alpha-400">
|
|
205
|
+
{collapsed.map((win) => (
|
|
206
|
+
<CollapsedRow
|
|
207
|
+
key={win.id}
|
|
208
|
+
win={win}
|
|
209
|
+
onExpand={() => handleExpand(win.id)}
|
|
210
|
+
onSplit={() => handleSplitWith(win.id)}
|
|
211
|
+
onClose={() => handleClose(win.id)}
|
|
212
|
+
/>
|
|
213
|
+
))}
|
|
214
|
+
</div>
|
|
215
|
+
)}
|
|
216
|
+
</div>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { TASKBAR_HEIGHT } from '@/lib/constants';
|
|
4
|
+
import type { SnapZone } from '@/types/window';
|
|
5
|
+
|
|
6
|
+
const ZONE_STYLE: Record<NonNullable<SnapZone>, React.CSSProperties> = {
|
|
7
|
+
left: { top: 0, left: 0, width: '50%', height: `calc(100% - ${TASKBAR_HEIGHT}px)` },
|
|
8
|
+
right: { top: 0, right: 0, width: '50%', height: `calc(100% - ${TASKBAR_HEIGHT}px)` },
|
|
9
|
+
top: { top: 0, left: 0, width: '100%', height: `calc(100% - ${TASKBAR_HEIGHT}px)` },
|
|
10
|
+
'top-left': { top: 0, left: 0, width: '50%', height: `calc(50% - ${TASKBAR_HEIGHT / 2}px)` },
|
|
11
|
+
'top-right': { top: 0, right: 0, width: '50%', height: `calc(50% - ${TASKBAR_HEIGHT / 2}px)` },
|
|
12
|
+
'bottom-left': { bottom: TASKBAR_HEIGHT, left: 0, width: '50%', height: `calc(50% - ${TASKBAR_HEIGHT / 2}px)` },
|
|
13
|
+
'bottom-right': { bottom: TASKBAR_HEIGHT, right: 0, width: '50%', height: `calc(50% - ${TASKBAR_HEIGHT / 2}px)` },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
interface SnapPreviewProps {
|
|
17
|
+
zone: SnapZone;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function SnapPreview({ zone }: SnapPreviewProps) {
|
|
21
|
+
if (!zone) return null;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className="pointer-events-none fixed inset-0 z-[8999]" aria-hidden="true">
|
|
25
|
+
<div
|
|
26
|
+
className="absolute rounded-xl border-2 backdrop-blur-sm transition-all duration-150 ease-out"
|
|
27
|
+
style={{
|
|
28
|
+
...ZONE_STYLE[zone],
|
|
29
|
+
margin: 6,
|
|
30
|
+
borderColor: 'var(--khal-accent-primary)',
|
|
31
|
+
background: 'var(--khal-accent-subtle)',
|
|
32
|
+
opacity: 0.8,
|
|
33
|
+
}}
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Maximize2, Minimize2, Minus, X } from 'lucide-react';
|
|
4
|
+
import { type ReactNode, useCallback, useState } from 'react';
|
|
5
|
+
import { AppIcon } from '@/components/app-icon';
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
__TAURI__?: {
|
|
10
|
+
window: {
|
|
11
|
+
getCurrentWindow: () => {
|
|
12
|
+
minimize: () => Promise<void>;
|
|
13
|
+
toggleMaximize: () => Promise<void>;
|
|
14
|
+
isMaximized: () => Promise<boolean>;
|
|
15
|
+
close: () => Promise<void>;
|
|
16
|
+
startDragging: () => Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface StandaloneFrameProps {
|
|
24
|
+
appId: string;
|
|
25
|
+
title: string;
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function getTauriWindow() {
|
|
30
|
+
return window.__TAURI__?.window.getCurrentWindow();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Glass-style rounded buttons with blur + color-coded hover */
|
|
34
|
+
function StandaloneControls({ maximized }: { maximized: boolean }) {
|
|
35
|
+
const win = getTauriWindow();
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
className="flex items-center"
|
|
40
|
+
style={{ gap: 'var(--khal-controls-gap, 2px)' }}
|
|
41
|
+
onPointerDown={(e) => e.stopPropagation()}
|
|
42
|
+
role="toolbar"
|
|
43
|
+
aria-label="Window controls"
|
|
44
|
+
>
|
|
45
|
+
<button
|
|
46
|
+
className="flex h-7 w-7 items-center justify-center rounded-md transition-colors"
|
|
47
|
+
style={{ background: 'var(--khal-controls-bg)', color: 'var(--khal-text-muted)' }}
|
|
48
|
+
onMouseEnter={(e) => {
|
|
49
|
+
const el = e.currentTarget as HTMLElement;
|
|
50
|
+
el.style.background = 'var(--khal-controls-minimize-hover-bg)';
|
|
51
|
+
el.style.backdropFilter = 'var(--khal-controls-blur)';
|
|
52
|
+
}}
|
|
53
|
+
onMouseLeave={(e) => {
|
|
54
|
+
const el = e.currentTarget as HTMLElement;
|
|
55
|
+
el.style.background = 'var(--khal-controls-bg)';
|
|
56
|
+
el.style.backdropFilter = '';
|
|
57
|
+
}}
|
|
58
|
+
onClick={() => win?.minimize()}
|
|
59
|
+
aria-label="Minimize window"
|
|
60
|
+
>
|
|
61
|
+
<Minus size={14} />
|
|
62
|
+
</button>
|
|
63
|
+
<button
|
|
64
|
+
className="flex h-7 w-7 items-center justify-center rounded-md transition-colors"
|
|
65
|
+
style={{ background: 'var(--khal-controls-bg)', color: 'var(--khal-text-muted)' }}
|
|
66
|
+
onMouseEnter={(e) => {
|
|
67
|
+
const el = e.currentTarget as HTMLElement;
|
|
68
|
+
el.style.background = 'var(--khal-controls-maximize-hover-bg)';
|
|
69
|
+
el.style.backdropFilter = 'var(--khal-controls-blur)';
|
|
70
|
+
}}
|
|
71
|
+
onMouseLeave={(e) => {
|
|
72
|
+
const el = e.currentTarget as HTMLElement;
|
|
73
|
+
el.style.background = 'var(--khal-controls-bg)';
|
|
74
|
+
el.style.backdropFilter = '';
|
|
75
|
+
}}
|
|
76
|
+
onClick={() => win?.toggleMaximize()}
|
|
77
|
+
aria-label={maximized ? 'Restore window' : 'Maximize window'}
|
|
78
|
+
>
|
|
79
|
+
{maximized ? <Minimize2 size={14} /> : <Maximize2 size={14} />}
|
|
80
|
+
</button>
|
|
81
|
+
<button
|
|
82
|
+
className="flex h-7 w-7 items-center justify-center rounded-md transition-colors"
|
|
83
|
+
style={{ background: 'var(--khal-controls-bg)', color: 'var(--khal-text-muted)' }}
|
|
84
|
+
onMouseEnter={(e) => {
|
|
85
|
+
const el = e.currentTarget as HTMLElement;
|
|
86
|
+
el.style.background = 'var(--khal-controls-close-hover-bg)';
|
|
87
|
+
el.style.color = 'var(--khal-controls-close-hover-color)';
|
|
88
|
+
el.style.backdropFilter = 'var(--khal-controls-blur)';
|
|
89
|
+
}}
|
|
90
|
+
onMouseLeave={(e) => {
|
|
91
|
+
const el = e.currentTarget as HTMLElement;
|
|
92
|
+
el.style.background = 'var(--khal-controls-bg)';
|
|
93
|
+
el.style.color = 'var(--khal-text-muted)';
|
|
94
|
+
el.style.backdropFilter = '';
|
|
95
|
+
}}
|
|
96
|
+
onClick={() => win?.close()}
|
|
97
|
+
aria-label="Close window"
|
|
98
|
+
>
|
|
99
|
+
<X size={14} />
|
|
100
|
+
</button>
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function StandaloneFrame({ appId, title, children }: StandaloneFrameProps) {
|
|
106
|
+
const [maximized, setMaximized] = useState(false);
|
|
107
|
+
|
|
108
|
+
const handleDrag = useCallback((e: React.PointerEvent) => {
|
|
109
|
+
// Only drag on primary button (left click)
|
|
110
|
+
if (e.button !== 0) return;
|
|
111
|
+
getTauriWindow()?.startDragging();
|
|
112
|
+
}, []);
|
|
113
|
+
|
|
114
|
+
const handleDoubleClick = useCallback(async () => {
|
|
115
|
+
const win = getTauriWindow();
|
|
116
|
+
if (!win) return;
|
|
117
|
+
await win.toggleMaximize();
|
|
118
|
+
setMaximized(await win.isMaximized());
|
|
119
|
+
}, []);
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<div
|
|
123
|
+
style={{
|
|
124
|
+
display: 'flex',
|
|
125
|
+
flexDirection: 'column',
|
|
126
|
+
height: '100vh',
|
|
127
|
+
backgroundColor: 'var(--ds-background-100, #0a0a0a)',
|
|
128
|
+
borderRadius: 'var(--os-window-radius, 10px)',
|
|
129
|
+
overflow: 'hidden',
|
|
130
|
+
boxShadow: 'var(--khal-window-shadow, 0 8px 32px rgba(0,0,0,0.4))',
|
|
131
|
+
border: 'var(--khal-window-border, 1px solid var(--khal-border-default, rgba(255,255,255,0.08)))',
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
{/* Title bar */}
|
|
135
|
+
<header
|
|
136
|
+
className="khal-window-frame flex shrink-0 items-center justify-between select-none"
|
|
137
|
+
style={{
|
|
138
|
+
height: 'var(--khal-frame-height, 40px)',
|
|
139
|
+
paddingLeft: 'var(--khal-frame-padding-x, 12px)',
|
|
140
|
+
paddingRight: 'var(--khal-frame-padding-x, 12px)',
|
|
141
|
+
background: 'var(--khal-window-frame-bg-focused, var(--khal-window-title-bg-focused))',
|
|
142
|
+
borderBottom: 'var(--khal-window-frame-border-bottom, 1px solid var(--khal-border-strong))',
|
|
143
|
+
backdropFilter: 'var(--khal-frame-backdrop, var(--khal-glass-filter, none))',
|
|
144
|
+
WebkitBackdropFilter: 'var(--khal-frame-backdrop, var(--khal-glass-filter, none))',
|
|
145
|
+
}}
|
|
146
|
+
onPointerDown={handleDrag}
|
|
147
|
+
onDoubleClick={handleDoubleClick}
|
|
148
|
+
>
|
|
149
|
+
<div className="flex min-w-0 items-center" style={{ gap: 'var(--khal-frame-icon-gap, 8px)' }}>
|
|
150
|
+
<span style={{ opacity: 'var(--khal-frame-icon-opacity, 1)' }}>
|
|
151
|
+
<AppIcon appId={appId} size={16} className="h-4 w-4 shrink-0" />
|
|
152
|
+
</span>
|
|
153
|
+
<h2
|
|
154
|
+
className="truncate font-medium"
|
|
155
|
+
style={{
|
|
156
|
+
fontSize: 'var(--khal-frame-font-size, 13px)',
|
|
157
|
+
color: 'var(--khal-text-primary)',
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
{title}
|
|
161
|
+
</h2>
|
|
162
|
+
</div>
|
|
163
|
+
<StandaloneControls maximized={maximized} />
|
|
164
|
+
</header>
|
|
165
|
+
|
|
166
|
+
{/* App content */}
|
|
167
|
+
<div style={{ flex: 1, overflow: 'auto' }}>{children}</div>
|
|
168
|
+
</div>
|
|
169
|
+
);
|
|
170
|
+
}
|