@cryptiklemur/lattice 4.0.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/lattice +1 -9
- package/dist/client/assets/{angular-html-N8PCEquT.js → angular-html-DKTL-XDO.js} +1 -1
- package/dist/client/assets/{angular-ts-CJ8RJIPD.js → angular-ts-tvBzOwQR.js} +1 -1
- package/dist/client/assets/{apl-BD6tCLWN.js → apl-CCzl5qFl.js} +1 -1
- package/dist/client/assets/{astro-CpIIfBs6.js → astro-DNQTpO2Y.js} +1 -1
- package/dist/client/assets/{blade-D3qgnjiV.js → blade-CyJoIMeJ.js} +1 -1
- package/dist/client/assets/{c-Dr6ADN_t.js → c-OEwk5KN8.js} +1 -1
- package/dist/client/assets/{cobol-BIfDE0Hr.js → cobol-DpHyJzz2.js} +1 -1
- package/dist/client/assets/{coffee-DHQ57vfY.js → coffee-BX5dbDzZ.js} +1 -1
- package/dist/client/assets/{cpp-CEBY6JOp.js → cpp-BTBjNg2U.js} +1 -1
- package/dist/client/assets/{crystal-D125CSmP.js → crystal-CNzZd6DW.js} +1 -1
- package/dist/client/assets/{css-CBmrkYSr.js → css-BuKsNmms.js} +1 -1
- package/dist/client/assets/{dist-A_mCRD1f.js → dist-CKpDHMy6.js} +2 -2
- package/dist/client/assets/{edge-Ccsz7cJW.js → edge-DzhnGgJE.js} +1 -1
- package/dist/client/assets/{elixir-Do6gk14X.js → elixir-Dqs0waqF.js} +1 -1
- package/dist/client/assets/{elm-Db22zT4C.js → elm-BtWwjxWn.js} +1 -1
- package/dist/client/assets/{erb-MXVqAAJD.js → erb-iPD89b4v.js} +1 -1
- package/dist/client/assets/{git-rebase-B-LLWBOA.js → git-rebase-BxVNXJL4.js} +1 -1
- package/dist/client/assets/{glimmer-js-eWszRU73.js → glimmer-js-BlyCupwF.js} +1 -1
- package/dist/client/assets/{glimmer-ts-VQmwGqUp.js → glimmer-ts-DjIxWOS9.js} +1 -1
- package/dist/client/assets/{glsl-B8ilOfAl.js → glsl-CGIL-65r.js} +1 -1
- package/dist/client/assets/{graphql-DnTqxeOc.js → graphql-DeOn6mNV.js} +1 -1
- package/dist/client/assets/{hack-XJsHYSQb.js → hack-DVppeCmS.js} +1 -1
- package/dist/client/assets/{haml-CQ7Vqzwp.js → haml-WDhua0Mp.js} +1 -1
- package/dist/client/assets/{handlebars-C4szooBf.js → handlebars-i2Fu_9HI.js} +1 -1
- package/dist/client/assets/{html-B6EgAiSd.js → html-B1e6oxzK.js} +1 -1
- package/dist/client/assets/{html-derivative-DdinogQX.js → html-derivative-MofKXIVd.js} +1 -1
- package/dist/client/assets/{http-BSLxCgRq.js → http-Dk6S5pRD.js} +1 -1
- package/dist/client/assets/{hurl-pOsTwNfp.js → hurl-CroFYYJG.js} +1 -1
- package/dist/client/assets/{index-BHQ_8mvl.js → index-CVu-S6Yk.js} +2 -2
- package/dist/client/assets/{java-DRQLiiST.js → java-B89FYjqS.js} +1 -1
- package/dist/client/assets/{javascript-DvEK2-47.js → javascript-m6CO1Uiy.js} +1 -1
- package/dist/client/assets/{jinja-D2NYJ25y.js → jinja-DC9Wi41X.js} +1 -1
- package/dist/client/assets/{jison-DDZaLNAp.js → jison-6xiegwDk.js} +1 -1
- package/dist/client/assets/{json-TGR0NIWd.js → json-HA-96-qr.js} +1 -1
- package/dist/client/assets/{jsx-BjUoPYga.js → jsx-Wt1a8i8U.js} +1 -1
- package/dist/client/assets/{julia-C4gjSpFu.js → julia-7M93VBON.js} +1 -1
- package/dist/client/assets/{just-H351x5u_.js → just-CjfDLYLv.js} +1 -1
- package/dist/client/assets/{latex-BiTmf6gf.js → latex-CitsJ46x.js} +1 -1
- package/dist/client/assets/{liquid-86ufjRy-.js → liquid-C8VIFin8.js} +1 -1
- package/dist/client/assets/{lua-BNxR0F_8.js → lua-Ba2N7esc.js} +1 -1
- package/dist/client/assets/{marko-CvRxpRjM.js → marko-lTLvb2wu.js} +1 -1
- package/dist/client/assets/{mdc-CYbAIy2C.js → mdc-D6IV-8FD.js} +1 -1
- package/dist/client/assets/{nginx-egdgMq-F.js → nginx-Ch5AjE6S.js} +1 -1
- package/dist/client/assets/{nim-CXBJVz_w.js → nim-WmDDC6LW.js} +1 -1
- package/dist/client/assets/{perl-XRfMobzg.js → perl-CQv0gYuq.js} +1 -1
- package/dist/client/assets/{php-Br7a8uil.js → php-BJmH0qOB.js} +1 -1
- package/dist/client/assets/{pug-BVbbUVvy.js → pug-CsHPkzc9.js} +1 -1
- package/dist/client/assets/{qml-ByKvrL1j.js → qml-B36ecArG.js} +1 -1
- package/dist/client/assets/{r-mVoV0Ni6.js → r-D5Yi5Z4y.js} +1 -1
- package/dist/client/assets/{razor-T5O-9UJL.js → razor-CHAxVq4R.js} +1 -1
- package/dist/client/assets/{regexp-CioRuhuN.js → regexp-gfs--3M7.js} +1 -1
- package/dist/client/assets/{rst-V__uTudD.js → rst-ugdlp-hl.js} +1 -1
- package/dist/client/assets/{ruby-C_PuKPTI.js → ruby-CDRRW37j.js} +1 -1
- package/dist/client/assets/{sas-D_DqqQH4.js → sas-DZaNQaIP.js} +1 -1
- package/dist/client/assets/{scss-D-TjzZ4c.js → scss-CzWQEplj.js} +1 -1
- package/dist/client/assets/{shellscript-E5759VHu.js → shellscript-fgYvpu9N.js} +1 -1
- package/dist/client/assets/{shellsession-AESTM-Pv.js → shellsession-BoAohHh7.js} +1 -1
- package/dist/client/assets/{soy-QrbrrcDv.js → soy-DBzVgv9x.js} +1 -1
- package/dist/client/assets/{sql-0M8VcDHD.js → sql-BYXpAYTs.js} +1 -1
- package/dist/client/assets/{stata-CgeIpGtc.js → stata-I71MMY3p.js} +1 -1
- package/dist/client/assets/{surrealql-DBGwnZbw.js → surrealql-C9U8_1VO.js} +1 -1
- package/dist/client/assets/{svelte-Cv0PvUc_.js → svelte-VOFrPnWT.js} +1 -1
- package/dist/client/assets/{templ-B9t7xRE4.js → templ-BIaxAEtC.js} +1 -1
- package/dist/client/assets/{tex-DhZZ8dr2.js → tex-D1dwnBE5.js} +1 -1
- package/dist/client/assets/{ts-tags-BFv8sbnd.js → ts-tags-C0L2Q0r5.js} +1 -1
- package/dist/client/assets/{tsx-CXC9KSbY.js → tsx-BqcycEv1.js} +1 -1
- package/dist/client/assets/{twig-CM_OO66r.js → twig-vyWqOhpM.js} +1 -1
- package/dist/client/assets/{typescript-BdgOTaoD.js → typescript-B2YbovqG.js} +1 -1
- package/dist/client/assets/{vue-BnQhjnCm.js → vue-CbXxGdjo.js} +1 -1
- package/dist/client/assets/{vue-html-CNnGecRI.js → vue-html-DDX4KXW7.js} +1 -1
- package/dist/client/assets/{vue-vine-DCuMkRhK.js → vue-vine-DsyY1LR5.js} +1 -1
- package/dist/client/assets/{xml-CbTD7cB8.js → xml-Ddi0-r0D.js} +1 -1
- package/dist/client/assets/{xsl-uOqqo7cf.js → xsl-CsFcZHFS.js} +1 -1
- package/dist/client/assets/{yaml-BNrLoH59.js → yaml-tGJWoH6Y.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/client/sw.js +1 -1
- package/dist/server/analytics/engine.js +832 -0
- package/dist/server/assets.js +39 -0
- package/dist/server/auth/passphrase.js +70 -0
- package/dist/server/config.js +47 -0
- package/dist/server/daemon.js +535 -0
- package/dist/server/features/ralph-loop.js +138 -0
- package/dist/server/features/scheduler.js +260 -0
- package/dist/server/features/sticky-notes.js +99 -0
- package/dist/server/handlers/analytics.js +28 -0
- package/dist/server/handlers/attachment.js +158 -0
- package/dist/server/handlers/bookmarks.js +41 -0
- package/dist/server/handlers/chat.js +350 -0
- package/dist/server/handlers/editor.js +72 -0
- package/dist/server/handlers/fs.js +234 -0
- package/dist/server/handlers/loop.js +33 -0
- package/dist/server/handlers/memory.js +181 -0
- package/dist/server/handlers/mesh.js +322 -0
- package/dist/server/handlers/notes.js +36 -0
- package/dist/server/handlers/plugins.js +593 -0
- package/dist/server/handlers/project-settings.js +166 -0
- package/dist/server/handlers/scheduler.js +52 -0
- package/dist/server/handlers/session.js +194 -0
- package/dist/server/handlers/settings.js +148 -0
- package/dist/server/handlers/skills.js +360 -0
- package/dist/server/handlers/terminal.js +75 -0
- package/dist/server/handlers/themes.js +102 -0
- package/dist/server/handlers/update.js +124 -0
- package/dist/server/identity.js +45 -0
- package/dist/server/index.js +435 -0
- package/dist/server/logger.js +20 -0
- package/dist/server/mesh/connector.js +355 -0
- package/dist/server/mesh/crypto.js +88 -0
- package/dist/server/mesh/discovery.js +95 -0
- package/dist/server/mesh/pairing.js +104 -0
- package/dist/server/mesh/peers.js +54 -0
- package/dist/server/mesh/proxy.js +86 -0
- package/dist/server/mesh/session-sync.js +85 -0
- package/dist/server/project/bookmarks.js +77 -0
- package/dist/server/project/context-breakdown.js +279 -0
- package/dist/server/project/file-browser.js +97 -0
- package/dist/server/project/project-files.js +274 -0
- package/dist/server/project/registry.js +51 -0
- package/dist/server/project/sdk-bridge.js +960 -0
- package/dist/server/project/session.js +696 -0
- package/dist/server/project/terminal.js +87 -0
- package/dist/server/project/warmup.js +242 -0
- package/dist/server/push.js +87 -0
- package/dist/server/tls.js +50 -0
- package/dist/server/tui.js +83 -0
- package/dist/server/update-checker.js +119 -0
- package/dist/server/ws/broadcast.js +50 -0
- package/dist/server/ws/router.js +105 -0
- package/dist/server/ws/server.js +2 -0
- package/dist/shared/analytics.js +1 -0
- package/dist/shared/messages.js +1 -0
- package/dist/shared/models.js +1 -0
- package/dist/shared/project-settings.js +1 -0
- package/package.json +5 -8
- package/themes/alabaster.json +9 -0
- package/themes/amoled.json +20 -0
- package/themes/ayu-light.json +9 -0
- package/themes/catppuccin-latte.json +9 -0
- package/themes/catppuccin-mocha.json +9 -0
- package/themes/clay-light.json +10 -0
- package/themes/clay.json +10 -0
- package/themes/dracula.json +9 -0
- package/themes/everforest-light.json +9 -0
- package/themes/everforest.json +9 -0
- package/themes/github-light.json +9 -0
- package/themes/gruvbox-dark.json +9 -0
- package/themes/gruvbox-light.json +9 -0
- package/themes/horizon-light.json +9 -0
- package/themes/kanagawa-lotus.json +9 -0
- package/themes/kanagawa.json +9 -0
- package/themes/modus-operandi.json +9 -0
- package/themes/monokai.json +9 -0
- package/themes/nightfox.json +9 -0
- package/themes/nord-light.json +9 -0
- package/themes/nord.json +9 -0
- package/themes/one-dark.json +9 -0
- package/themes/one-light.json +9 -0
- package/themes/palenight.json +9 -0
- package/themes/paper.json +9 -0
- package/themes/penumbra-light.json +9 -0
- package/themes/poimandres.json +9 -0
- package/themes/quiet-light.json +9 -0
- package/themes/rose-pine-dawn.json +9 -0
- package/themes/rose-pine.json +9 -0
- package/themes/solarized-dark.json +9 -0
- package/themes/solarized-light.json +9 -0
- package/themes/synthwave84.json +9 -0
- package/themes/tokyo-night-light.json +9 -0
- package/themes/tokyo-night.json +9 -0
- package/themes/vesper.json +9 -0
- package/index.html +0 -20
- package/public/icons/icon-192.svg +0 -11
- package/public/icons/icon-512.svg +0 -11
- package/public/sw-push.js +0 -53
- package/src/client/App.tsx +0 -42
- package/src/client/commands.ts +0 -36
- package/src/client/components/analytics/AnalyticsView.tsx +0 -244
- package/src/client/components/analytics/ChartCard.tsx +0 -194
- package/src/client/components/analytics/PeriodSelector.tsx +0 -42
- package/src/client/components/analytics/QuickStats.tsx +0 -122
- package/src/client/components/analytics/chartTokens.ts +0 -188
- package/src/client/components/analytics/charts/ActivityCalendar.tsx +0 -204
- package/src/client/components/analytics/charts/CacheEfficiencyChart.tsx +0 -56
- package/src/client/components/analytics/charts/ContextUtilizationChart.tsx +0 -106
- package/src/client/components/analytics/charts/CostAreaChart.tsx +0 -79
- package/src/client/components/analytics/charts/CostDistributionChart.tsx +0 -59
- package/src/client/components/analytics/charts/CostDonutChart.tsx +0 -84
- package/src/client/components/analytics/charts/CumulativeCostChart.tsx +0 -59
- package/src/client/components/analytics/charts/DailySummaryCards.tsx +0 -86
- package/src/client/components/analytics/charts/HourlyHeatmap.tsx +0 -133
- package/src/client/components/analytics/charts/NodeFleetOverview.tsx +0 -89
- package/src/client/components/analytics/charts/PermissionBreakdown.tsx +0 -98
- package/src/client/components/analytics/charts/ProjectRadar.tsx +0 -126
- package/src/client/components/analytics/charts/ResponseTimeScatter.tsx +0 -96
- package/src/client/components/analytics/charts/SessionBubbleChart.tsx +0 -114
- package/src/client/components/analytics/charts/SessionComplexityList.tsx +0 -65
- package/src/client/components/analytics/charts/SessionTimeline.tsx +0 -107
- package/src/client/components/analytics/charts/TokenFlowChart.tsx +0 -78
- package/src/client/components/analytics/charts/TokenSankeyChart.tsx +0 -93
- package/src/client/components/analytics/charts/ToolSunburst.tsx +0 -123
- package/src/client/components/analytics/charts/ToolTreemap.tsx +0 -110
- package/src/client/components/auth/PassphrasePrompt.tsx +0 -70
- package/src/client/components/chat/AttachmentChips.tsx +0 -116
- package/src/client/components/chat/ChatInput.tsx +0 -533
- package/src/client/components/chat/ChatView.tsx +0 -1076
- package/src/client/components/chat/CommandPalette.tsx +0 -162
- package/src/client/components/chat/ElicitationCard.tsx +0 -238
- package/src/client/components/chat/Message.tsx +0 -825
- package/src/client/components/chat/ModelSelector.tsx +0 -108
- package/src/client/components/chat/PermissionModeSelector.tsx +0 -41
- package/src/client/components/chat/PromptQuestion.tsx +0 -271
- package/src/client/components/chat/StatusBar.tsx +0 -50
- package/src/client/components/chat/TodoCard.tsx +0 -57
- package/src/client/components/chat/ToolGroup.tsx +0 -129
- package/src/client/components/chat/ToolResultRenderer.tsx +0 -348
- package/src/client/components/chat/VoiceRecorder.tsx +0 -85
- package/src/client/components/chat/toolSummary.ts +0 -41
- package/src/client/components/dashboard/DashboardView.tsx +0 -200
- package/src/client/components/dashboard/ProjectDashboardView.tsx +0 -179
- package/src/client/components/mesh/NodeBadge.tsx +0 -24
- package/src/client/components/mesh/PairingDialog.tsx +0 -340
- package/src/client/components/project-settings/ProjectClaude.tsx +0 -318
- package/src/client/components/project-settings/ProjectEnvironment.tsx +0 -235
- package/src/client/components/project-settings/ProjectGeneral.tsx +0 -76
- package/src/client/components/project-settings/ProjectMcp.tsx +0 -232
- package/src/client/components/project-settings/ProjectMemory.tsx +0 -488
- package/src/client/components/project-settings/ProjectNotifications.tsx +0 -48
- package/src/client/components/project-settings/ProjectPermissions.tsx +0 -209
- package/src/client/components/project-settings/ProjectPlugins.tsx +0 -117
- package/src/client/components/project-settings/ProjectRules.tsx +0 -286
- package/src/client/components/project-settings/ProjectSettingsView.tsx +0 -117
- package/src/client/components/project-settings/ProjectSkills.tsx +0 -91
- package/src/client/components/settings/Appearance.tsx +0 -275
- package/src/client/components/settings/BudgetSettings.tsx +0 -165
- package/src/client/components/settings/ClaudeSettings.tsx +0 -175
- package/src/client/components/settings/Editor.tsx +0 -123
- package/src/client/components/settings/Environment.tsx +0 -185
- package/src/client/components/settings/GlobalMcp.tsx +0 -216
- package/src/client/components/settings/GlobalMemory.tsx +0 -19
- package/src/client/components/settings/GlobalPlugins.tsx +0 -806
- package/src/client/components/settings/GlobalRules.tsx +0 -149
- package/src/client/components/settings/GlobalSkills.tsx +0 -140
- package/src/client/components/settings/MeshStatus.tsx +0 -183
- package/src/client/components/settings/Notifications.tsx +0 -123
- package/src/client/components/settings/SettingsView.tsx +0 -75
- package/src/client/components/settings/SkillMarketplace.tsx +0 -175
- package/src/client/components/settings/ThemePreview.tsx +0 -140
- package/src/client/components/settings/ThemeWizard.tsx +0 -405
- package/src/client/components/settings/mcp-shared.tsx +0 -194
- package/src/client/components/settings/skill-shared.tsx +0 -186
- package/src/client/components/setup/SetupWizard.tsx +0 -755
- package/src/client/components/sidebar/AddProjectModal.tsx +0 -438
- package/src/client/components/sidebar/NodeSettingsModal.tsx +0 -206
- package/src/client/components/sidebar/ProjectDropdown.tsx +0 -211
- package/src/client/components/sidebar/ProjectRail.tsx +0 -353
- package/src/client/components/sidebar/SearchFilter.tsx +0 -52
- package/src/client/components/sidebar/SessionList.tsx +0 -599
- package/src/client/components/sidebar/SettingsSidebar.tsx +0 -139
- package/src/client/components/sidebar/Sidebar.tsx +0 -469
- package/src/client/components/sidebar/UserIsland.tsx +0 -282
- package/src/client/components/sidebar/UserMenu.tsx +0 -107
- package/src/client/components/ui/CommandPalette.tsx +0 -321
- package/src/client/components/ui/ContextMenu.tsx +0 -153
- package/src/client/components/ui/ErrorBoundary.tsx +0 -56
- package/src/client/components/ui/IconPicker.tsx +0 -184
- package/src/client/components/ui/KeyboardShortcuts.tsx +0 -129
- package/src/client/components/ui/LatticeLogomark.tsx +0 -19
- package/src/client/components/ui/NodeDisconnectedOverlay.tsx +0 -35
- package/src/client/components/ui/PopupMenu.tsx +0 -120
- package/src/client/components/ui/SaveFooter.tsx +0 -63
- package/src/client/components/ui/Toast.tsx +0 -132
- package/src/client/components/ui/UpdateBanner.tsx +0 -110
- package/src/client/components/ui/UpdatePrompt.tsx +0 -47
- package/src/client/components/workspace/BookmarksView.tsx +0 -156
- package/src/client/components/workspace/FileBrowser.tsx +0 -174
- package/src/client/components/workspace/FileTree.tsx +0 -129
- package/src/client/components/workspace/FileViewer.tsx +0 -211
- package/src/client/components/workspace/NoteCard.tsx +0 -120
- package/src/client/components/workspace/NotesView.tsx +0 -102
- package/src/client/components/workspace/ScheduledTasksView.tsx +0 -117
- package/src/client/components/workspace/SplitPane.tsx +0 -81
- package/src/client/components/workspace/TabBar.tsx +0 -170
- package/src/client/components/workspace/TaskCard.tsx +0 -159
- package/src/client/components/workspace/TaskEditModal.tsx +0 -129
- package/src/client/components/workspace/TerminalInstance.tsx +0 -171
- package/src/client/components/workspace/TerminalView.tsx +0 -110
- package/src/client/components/workspace/WorkspaceView.tsx +0 -141
- package/src/client/hooks/useAnalytics.ts +0 -84
- package/src/client/hooks/useAttachments.ts +0 -313
- package/src/client/hooks/useBookmarks.ts +0 -57
- package/src/client/hooks/useEditorConfig.ts +0 -28
- package/src/client/hooks/useFocusTrap.ts +0 -74
- package/src/client/hooks/useIdleDetection.ts +0 -50
- package/src/client/hooks/useInstallPrompt.ts +0 -53
- package/src/client/hooks/useMesh.ts +0 -89
- package/src/client/hooks/useNotifications.ts +0 -54
- package/src/client/hooks/useOnline.ts +0 -6
- package/src/client/hooks/useProjectSettings.ts +0 -56
- package/src/client/hooks/useProjects.ts +0 -98
- package/src/client/hooks/usePushNotifications.ts +0 -92
- package/src/client/hooks/useSaveState.ts +0 -65
- package/src/client/hooks/useSession.ts +0 -580
- package/src/client/hooks/useSidebar.ts +0 -90
- package/src/client/hooks/useSkills.ts +0 -30
- package/src/client/hooks/useSpinnerVerb.ts +0 -36
- package/src/client/hooks/useSwipeDrawer.ts +0 -299
- package/src/client/hooks/useTheme.ts +0 -114
- package/src/client/hooks/useTimeTick.ts +0 -35
- package/src/client/hooks/useVoiceRecorder.ts +0 -169
- package/src/client/hooks/useWebSocket.ts +0 -27
- package/src/client/hooks/useWorkspace.ts +0 -57
- package/src/client/lib/theme-derive.ts +0 -196
- package/src/client/lib/workspace-url.ts +0 -219
- package/src/client/main.tsx +0 -10
- package/src/client/providers/WebSocketProvider.tsx +0 -186
- package/src/client/router.tsx +0 -578
- package/src/client/stores/analytics.ts +0 -68
- package/src/client/stores/bookmarks.ts +0 -45
- package/src/client/stores/mesh.ts +0 -78
- package/src/client/stores/session.ts +0 -569
- package/src/client/stores/sidebar.ts +0 -530
- package/src/client/stores/theme.ts +0 -44
- package/src/client/stores/workspace.ts +0 -518
- package/src/client/styles/global.css +0 -391
- package/src/client/styles/theme-vars.css +0 -18
- package/src/client/themes/index.ts +0 -105
- package/src/client/utils/editorUrl.ts +0 -55
- package/src/client/utils/findDuplicateKeys.ts +0 -12
- package/src/client/utils/formatSessionTitle.ts +0 -17
- package/src/client/vite-env.d.ts +0 -6
- package/src/server/analytics/engine.ts +0 -920
- package/src/server/assets.ts +0 -45
- package/src/server/auth/passphrase.ts +0 -78
- package/src/server/config.ts +0 -55
- package/src/server/daemon.ts +0 -567
- package/src/server/features/ralph-loop.ts +0 -173
- package/src/server/features/scheduler.ts +0 -304
- package/src/server/features/sticky-notes.ts +0 -104
- package/src/server/handlers/analytics.ts +0 -39
- package/src/server/handlers/attachment.ts +0 -189
- package/src/server/handlers/bookmarks.ts +0 -50
- package/src/server/handlers/chat.ts +0 -381
- package/src/server/handlers/editor.ts +0 -76
- package/src/server/handlers/fs.ts +0 -251
- package/src/server/handlers/loop.ts +0 -37
- package/src/server/handlers/memory.ts +0 -182
- package/src/server/handlers/mesh.ts +0 -362
- package/src/server/handlers/notes.ts +0 -47
- package/src/server/handlers/plugins.ts +0 -655
- package/src/server/handlers/project-settings.ts +0 -180
- package/src/server/handlers/scheduler.ts +0 -64
- package/src/server/handlers/session.ts +0 -226
- package/src/server/handlers/settings.ts +0 -157
- package/src/server/handlers/skills.ts +0 -378
- package/src/server/handlers/terminal.ts +0 -88
- package/src/server/handlers/themes.ts +0 -121
- package/src/server/handlers/update.ts +0 -133
- package/src/server/identity.ts +0 -56
- package/src/server/index.ts +0 -457
- package/src/server/logger.ts +0 -21
- package/src/server/mesh/connector.ts +0 -419
- package/src/server/mesh/crypto.ts +0 -106
- package/src/server/mesh/discovery.ts +0 -126
- package/src/server/mesh/pairing.ts +0 -123
- package/src/server/mesh/peers.ts +0 -60
- package/src/server/mesh/proxy.ts +0 -106
- package/src/server/mesh/session-sync.ts +0 -107
- package/src/server/project/bookmarks.ts +0 -83
- package/src/server/project/context-breakdown.ts +0 -307
- package/src/server/project/file-browser.ts +0 -106
- package/src/server/project/project-files.ts +0 -267
- package/src/server/project/pty-worker.cjs +0 -83
- package/src/server/project/registry.ts +0 -57
- package/src/server/project/sdk-bridge.ts +0 -1100
- package/src/server/project/session.ts +0 -723
- package/src/server/project/terminal.ts +0 -111
- package/src/server/project/warmup.ts +0 -285
- package/src/server/push.ts +0 -121
- package/src/server/tls.ts +0 -65
- package/src/server/tui.ts +0 -103
- package/src/server/update-checker.ts +0 -147
- package/src/server/ws/broadcast.ts +0 -61
- package/src/server/ws/router.ts +0 -123
- package/src/server/ws/server.ts +0 -2
- package/src/shared/analytics.ts +0 -40
- package/src/shared/messages.ts +0 -1302
- package/src/shared/models.ts +0 -255
- package/src/shared/project-settings.ts +0 -45
- package/tsconfig.json +0 -25
- package/vite.config.ts +0 -71
- /package/{src/server/runtime.ts → dist/server/runtime.js} +0 -0
- /package/{src/shared/constants.ts → dist/shared/constants.js} +0 -0
- /package/{src/shared/index.ts → dist/shared/index.js} +0 -0
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState, useMemo, useCallback } from "react";
|
|
2
|
-
import { useHotkey } from "@tanstack/react-hotkeys";
|
|
3
|
-
import { Search, Moon, Sun, Settings, Layout, MessageSquare, FolderOpen, Zap, RotateCcw } from "lucide-react";
|
|
4
|
-
import { useProjects } from "../../hooks/useProjects";
|
|
5
|
-
import { useSkills } from "../../hooks/useSkills";
|
|
6
|
-
import { useTheme } from "../../hooks/useTheme";
|
|
7
|
-
import { useWebSocket } from "../../hooks/useWebSocket";
|
|
8
|
-
import { useSidebar } from "../../hooks/useSidebar";
|
|
9
|
-
import { getSessionStore } from "../../stores/session";
|
|
10
|
-
import type { SettingsSection } from "../../stores/sidebar";
|
|
11
|
-
|
|
12
|
-
interface Command {
|
|
13
|
-
id: string;
|
|
14
|
-
label: string;
|
|
15
|
-
description?: string;
|
|
16
|
-
group: string;
|
|
17
|
-
icon?: React.ReactNode;
|
|
18
|
-
action: () => void;
|
|
19
|
-
keywords?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function CommandPalette() {
|
|
23
|
-
var [open, setOpen] = useState(false);
|
|
24
|
-
var [query, setQuery] = useState("");
|
|
25
|
-
var [selectedIndex, setSelectedIndex] = useState(0);
|
|
26
|
-
var inputRef = useRef<HTMLInputElement>(null);
|
|
27
|
-
var listRef = useRef<HTMLDivElement>(null);
|
|
28
|
-
|
|
29
|
-
var { projects, setActiveProject } = useProjects();
|
|
30
|
-
var skills = useSkills();
|
|
31
|
-
var { mode, toggleMode, themes, setTheme, currentThemeId } = useTheme();
|
|
32
|
-
var ws = useWebSocket();
|
|
33
|
-
var sidebar = useSidebar();
|
|
34
|
-
|
|
35
|
-
var close = useCallback(function () {
|
|
36
|
-
setOpen(false);
|
|
37
|
-
setQuery("");
|
|
38
|
-
setSelectedIndex(0);
|
|
39
|
-
}, []);
|
|
40
|
-
|
|
41
|
-
useHotkey("Mod+K", function (e) {
|
|
42
|
-
e.preventDefault();
|
|
43
|
-
setOpen(function (prev) {
|
|
44
|
-
if (prev) {
|
|
45
|
-
setQuery("");
|
|
46
|
-
setSelectedIndex(0);
|
|
47
|
-
}
|
|
48
|
-
return !prev;
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
useHotkey("Escape", function (e) {
|
|
53
|
-
e.preventDefault();
|
|
54
|
-
close();
|
|
55
|
-
}, { enabled: open });
|
|
56
|
-
|
|
57
|
-
// Focus input when opened
|
|
58
|
-
useEffect(function () {
|
|
59
|
-
if (open && inputRef.current) {
|
|
60
|
-
inputRef.current.focus();
|
|
61
|
-
}
|
|
62
|
-
}, [open]);
|
|
63
|
-
|
|
64
|
-
// Build command list
|
|
65
|
-
var commands = useMemo(function (): Command[] {
|
|
66
|
-
var cmds: Command[] = [];
|
|
67
|
-
|
|
68
|
-
// Navigation
|
|
69
|
-
cmds.push({
|
|
70
|
-
id: "nav:dashboard",
|
|
71
|
-
label: "Go to Dashboard",
|
|
72
|
-
group: "Navigation",
|
|
73
|
-
icon: <Layout size={14} />,
|
|
74
|
-
action: function () { sidebar.goToDashboard(); close(); },
|
|
75
|
-
keywords: "home overview",
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// Projects
|
|
79
|
-
projects.forEach(function (project) {
|
|
80
|
-
cmds.push({
|
|
81
|
-
id: "project:" + project.slug,
|
|
82
|
-
label: project.title || project.slug,
|
|
83
|
-
description: project.path,
|
|
84
|
-
group: "Projects",
|
|
85
|
-
icon: <FolderOpen size={14} />,
|
|
86
|
-
action: function () { setActiveProject(project); close(); },
|
|
87
|
-
keywords: "switch project " + project.slug,
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
// Session actions
|
|
92
|
-
var sessionState = getSessionStore().state;
|
|
93
|
-
if (sessionState.activeProjectSlug) {
|
|
94
|
-
cmds.push({
|
|
95
|
-
id: "session:new",
|
|
96
|
-
label: "New Session",
|
|
97
|
-
group: "Session",
|
|
98
|
-
icon: <MessageSquare size={14} />,
|
|
99
|
-
action: function () {
|
|
100
|
-
ws.send({ type: "session:create", projectSlug: sessionState.activeProjectSlug! });
|
|
101
|
-
close();
|
|
102
|
-
},
|
|
103
|
-
keywords: "create chat conversation",
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Settings sections
|
|
108
|
-
var settingsSections: Array<{ id: SettingsSection; label: string; keywords: string }> = [
|
|
109
|
-
{ id: "appearance", label: "Appearance", keywords: "theme visual colors" },
|
|
110
|
-
{ id: "claude", label: "Claude Settings", keywords: "api model key" },
|
|
111
|
-
{ id: "environment", label: "Environment", keywords: "env variables config" },
|
|
112
|
-
{ id: "mcp", label: "MCP Servers", keywords: "model context protocol" },
|
|
113
|
-
{ id: "skills", label: "Skills", keywords: "capabilities commands" },
|
|
114
|
-
{ id: "nodes", label: "Mesh Nodes", keywords: "machines network" },
|
|
115
|
-
];
|
|
116
|
-
settingsSections.forEach(function (section) {
|
|
117
|
-
cmds.push({
|
|
118
|
-
id: "settings:" + section.id,
|
|
119
|
-
label: section.label,
|
|
120
|
-
group: "Settings",
|
|
121
|
-
icon: <Settings size={14} />,
|
|
122
|
-
action: function () { sidebar.openSettings(section.id); close(); },
|
|
123
|
-
keywords: section.keywords,
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
// Theme
|
|
128
|
-
cmds.push({
|
|
129
|
-
id: "theme:toggle",
|
|
130
|
-
label: mode === "dark" ? "Switch to Light Mode" : "Switch to Dark Mode",
|
|
131
|
-
group: "Theme",
|
|
132
|
-
icon: mode === "dark" ? <Sun size={14} /> : <Moon size={14} />,
|
|
133
|
-
action: function () { toggleMode(); close(); },
|
|
134
|
-
keywords: "dark light mode toggle",
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
var themeVariant = mode === "dark" ? "dark" : "light";
|
|
138
|
-
themes.filter(function (t) { return t.theme.variant === themeVariant; }).forEach(function (t) {
|
|
139
|
-
if (t.id === currentThemeId) return;
|
|
140
|
-
cmds.push({
|
|
141
|
-
id: "theme:" + t.id,
|
|
142
|
-
label: t.theme.name,
|
|
143
|
-
group: "Theme",
|
|
144
|
-
icon: mode === "dark" ? <Moon size={14} /> : <Sun size={14} />,
|
|
145
|
-
action: function () { setTheme(t.id); close(); },
|
|
146
|
-
keywords: "color scheme " + t.theme.name,
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
// Skills
|
|
151
|
-
skills.forEach(function (skill) {
|
|
152
|
-
cmds.push({
|
|
153
|
-
id: "skill:" + skill.name,
|
|
154
|
-
label: "/" + skill.name,
|
|
155
|
-
description: skill.description,
|
|
156
|
-
group: "Skills",
|
|
157
|
-
icon: <Zap size={14} />,
|
|
158
|
-
action: function () {
|
|
159
|
-
// Focus chat input and prefill with skill command
|
|
160
|
-
var textarea = document.querySelector("textarea[aria-label='Message input']") as HTMLTextAreaElement | null;
|
|
161
|
-
if (textarea) {
|
|
162
|
-
textarea.value = "/" + skill.name + " ";
|
|
163
|
-
textarea.focus();
|
|
164
|
-
textarea.dispatchEvent(new Event("input", { bubbles: true }));
|
|
165
|
-
}
|
|
166
|
-
close();
|
|
167
|
-
},
|
|
168
|
-
keywords: skill.description,
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
// System
|
|
173
|
-
cmds.push({
|
|
174
|
-
id: "system:restart",
|
|
175
|
-
label: "Restart Daemon",
|
|
176
|
-
group: "System",
|
|
177
|
-
icon: <RotateCcw size={14} />,
|
|
178
|
-
action: function () { ws.send({ type: "settings:restart" } as any); close(); },
|
|
179
|
-
keywords: "reboot server",
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
return cmds;
|
|
183
|
-
}, [projects, skills, mode, themes, currentThemeId, sidebar, ws, close, setActiveProject, toggleMode, setTheme]);
|
|
184
|
-
|
|
185
|
-
// Filter commands
|
|
186
|
-
var filtered = useMemo(function () {
|
|
187
|
-
if (!query.trim()) return commands;
|
|
188
|
-
var q = query.toLowerCase();
|
|
189
|
-
return commands.filter(function (cmd) {
|
|
190
|
-
var searchText = (cmd.label + " " + (cmd.description || "") + " " + (cmd.keywords || "") + " " + cmd.group).toLowerCase();
|
|
191
|
-
// All words in query must match
|
|
192
|
-
var words = q.split(/\s+/);
|
|
193
|
-
for (var i = 0; i < words.length; i++) {
|
|
194
|
-
if (!searchText.includes(words[i])) return false;
|
|
195
|
-
}
|
|
196
|
-
return true;
|
|
197
|
-
});
|
|
198
|
-
}, [query, commands]);
|
|
199
|
-
|
|
200
|
-
// Reset selection when filter changes
|
|
201
|
-
useEffect(function () {
|
|
202
|
-
setSelectedIndex(0);
|
|
203
|
-
}, [filtered.length, query]);
|
|
204
|
-
|
|
205
|
-
// Scroll active item into view
|
|
206
|
-
useEffect(function () {
|
|
207
|
-
if (!listRef.current) return;
|
|
208
|
-
var active = listRef.current.querySelector("[data-active='true']") as HTMLElement | null;
|
|
209
|
-
if (active) {
|
|
210
|
-
active.scrollIntoView({ block: "nearest" });
|
|
211
|
-
}
|
|
212
|
-
}, [selectedIndex]);
|
|
213
|
-
|
|
214
|
-
function handleKeyDown(e: React.KeyboardEvent) {
|
|
215
|
-
if (e.key === "ArrowDown") {
|
|
216
|
-
e.preventDefault();
|
|
217
|
-
setSelectedIndex(function (i) { return i < filtered.length - 1 ? i + 1 : 0; });
|
|
218
|
-
} else if (e.key === "ArrowUp") {
|
|
219
|
-
e.preventDefault();
|
|
220
|
-
setSelectedIndex(function (i) { return i > 0 ? i - 1 : filtered.length - 1; });
|
|
221
|
-
} else if (e.key === "Enter") {
|
|
222
|
-
e.preventDefault();
|
|
223
|
-
if (filtered[selectedIndex]) {
|
|
224
|
-
filtered[selectedIndex].action();
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Group filtered commands
|
|
230
|
-
var grouped = useMemo(function () {
|
|
231
|
-
var groups: Array<{ name: string; items: Array<Command & { globalIndex: number }> }> = [];
|
|
232
|
-
var groupMap = new Map<string, Array<Command & { globalIndex: number }>>();
|
|
233
|
-
var globalIdx = 0;
|
|
234
|
-
filtered.forEach(function (cmd) {
|
|
235
|
-
var list = groupMap.get(cmd.group);
|
|
236
|
-
if (!list) {
|
|
237
|
-
list = [];
|
|
238
|
-
groupMap.set(cmd.group, list);
|
|
239
|
-
groups.push({ name: cmd.group, items: list });
|
|
240
|
-
}
|
|
241
|
-
list.push(Object.assign({}, cmd, { globalIndex: globalIdx }));
|
|
242
|
-
globalIdx++;
|
|
243
|
-
});
|
|
244
|
-
return groups;
|
|
245
|
-
}, [filtered]);
|
|
246
|
-
|
|
247
|
-
if (!open) return null;
|
|
248
|
-
|
|
249
|
-
return (
|
|
250
|
-
<div className="fixed inset-0 z-[9998] flex items-start justify-center pt-[15vh]" onClick={close}>
|
|
251
|
-
<div className="absolute inset-0 bg-base-content/50" />
|
|
252
|
-
<div
|
|
253
|
-
className="relative w-full max-w-[520px] mx-4 bg-base-200 border border-base-content/10 rounded-xl shadow-2xl overflow-hidden"
|
|
254
|
-
onClick={function (e) { e.stopPropagation(); }}
|
|
255
|
-
>
|
|
256
|
-
<div className="flex items-center gap-2 px-4 py-3 border-b border-base-content/10">
|
|
257
|
-
<Search size={16} className="text-base-content/30 flex-shrink-0" />
|
|
258
|
-
<input
|
|
259
|
-
ref={inputRef}
|
|
260
|
-
type="text"
|
|
261
|
-
value={query}
|
|
262
|
-
onChange={function (e) { setQuery(e.target.value); }}
|
|
263
|
-
onKeyDown={handleKeyDown}
|
|
264
|
-
placeholder="Type a command..."
|
|
265
|
-
className="flex-1 bg-transparent text-[14px] text-base-content outline-none placeholder:text-base-content/30"
|
|
266
|
-
/>
|
|
267
|
-
<kbd className="text-[10px] font-mono text-base-content/20 bg-base-300 px-1.5 py-0.5 rounded">ESC</kbd>
|
|
268
|
-
</div>
|
|
269
|
-
<div ref={listRef} className="max-h-[360px] overflow-y-auto py-1.5">
|
|
270
|
-
{grouped.length === 0 && (
|
|
271
|
-
<div className="px-4 py-8 text-center text-[13px] text-base-content/30">
|
|
272
|
-
No commands found
|
|
273
|
-
</div>
|
|
274
|
-
)}
|
|
275
|
-
{grouped.map(function (group) {
|
|
276
|
-
return (
|
|
277
|
-
<div key={group.name}>
|
|
278
|
-
<div className="px-4 pt-2 pb-1">
|
|
279
|
-
<span className="text-[9px] uppercase tracking-widest text-base-content/30 font-mono font-bold">{group.name}</span>
|
|
280
|
-
</div>
|
|
281
|
-
{group.items.map(function (cmd) {
|
|
282
|
-
var isActive = cmd.globalIndex === selectedIndex;
|
|
283
|
-
return (
|
|
284
|
-
<button
|
|
285
|
-
key={cmd.id}
|
|
286
|
-
data-active={isActive}
|
|
287
|
-
onMouseEnter={function () { setSelectedIndex(cmd.globalIndex); }}
|
|
288
|
-
onMouseDown={function (e) { e.preventDefault(); }}
|
|
289
|
-
onClick={function () { cmd.action(); }}
|
|
290
|
-
className={
|
|
291
|
-
"flex w-full items-center gap-3 px-4 py-2 text-left transition-colors " +
|
|
292
|
-
(isActive ? "bg-primary/10" : "hover:bg-base-content/5")
|
|
293
|
-
}
|
|
294
|
-
>
|
|
295
|
-
<div className={"flex-shrink-0 " + (isActive ? "text-primary" : "text-base-content/30")}>
|
|
296
|
-
{cmd.icon}
|
|
297
|
-
</div>
|
|
298
|
-
<div className="flex-1 min-w-0">
|
|
299
|
-
<div className={"text-[13px] truncate " + (isActive ? "text-base-content" : "text-base-content/70")}>
|
|
300
|
-
{cmd.label}
|
|
301
|
-
</div>
|
|
302
|
-
{cmd.description && (
|
|
303
|
-
<div className="text-[11px] text-base-content/30 truncate">{cmd.description}</div>
|
|
304
|
-
)}
|
|
305
|
-
</div>
|
|
306
|
-
</button>
|
|
307
|
-
);
|
|
308
|
-
})}
|
|
309
|
-
</div>
|
|
310
|
-
);
|
|
311
|
-
})}
|
|
312
|
-
</div>
|
|
313
|
-
<div className="flex items-center gap-3 px-4 py-2 border-t border-base-content/10 text-[10px] text-base-content/25 font-mono">
|
|
314
|
-
<span>↑↓ navigate</span>
|
|
315
|
-
<span>↵ select</span>
|
|
316
|
-
<span>esc close</span>
|
|
317
|
-
</div>
|
|
318
|
-
</div>
|
|
319
|
-
</div>
|
|
320
|
-
);
|
|
321
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from "react";
|
|
2
|
-
import { createPortal } from "react-dom";
|
|
3
|
-
import type { ReactNode } from "react";
|
|
4
|
-
|
|
5
|
-
export interface ContextMenuItem {
|
|
6
|
-
label: string;
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
onClick: () => void;
|
|
9
|
-
danger?: boolean;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
hidden?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface ContextMenuDivider {
|
|
15
|
-
type: "divider";
|
|
16
|
-
hidden?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type ContextMenuEntry = ContextMenuItem | ContextMenuDivider;
|
|
20
|
-
|
|
21
|
-
interface ContextMenuProps {
|
|
22
|
-
x: number;
|
|
23
|
-
y: number;
|
|
24
|
-
items: ContextMenuEntry[];
|
|
25
|
-
onClose: () => void;
|
|
26
|
-
label?: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function ContextMenu(props: ContextMenuProps) {
|
|
30
|
-
var menuRef = useRef<HTMLDivElement>(null);
|
|
31
|
-
var [focusIndex, setFocusIndex] = useState(-1);
|
|
32
|
-
var visibleItems = props.items.filter(function (item) { return !item.hidden; });
|
|
33
|
-
|
|
34
|
-
useEffect(function () {
|
|
35
|
-
function handleClick(e: MouseEvent) {
|
|
36
|
-
if (menuRef.current && !menuRef.current.contains(e.target as Node)) {
|
|
37
|
-
props.onClose();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function handleKey(e: KeyboardEvent) {
|
|
41
|
-
if (e.key === "Escape") {
|
|
42
|
-
e.preventDefault();
|
|
43
|
-
props.onClose();
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (e.key === "ArrowDown") {
|
|
47
|
-
e.preventDefault();
|
|
48
|
-
setFocusIndex(function (prev) {
|
|
49
|
-
var next = prev + 1;
|
|
50
|
-
while (next < visibleItems.length && (visibleItems[next] as ContextMenuDivider).type === "divider") next++;
|
|
51
|
-
return next < visibleItems.length ? next : prev;
|
|
52
|
-
});
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (e.key === "ArrowUp") {
|
|
56
|
-
e.preventDefault();
|
|
57
|
-
setFocusIndex(function (prev) {
|
|
58
|
-
var next = prev - 1;
|
|
59
|
-
while (next >= 0 && (visibleItems[next] as ContextMenuDivider).type === "divider") next--;
|
|
60
|
-
return next >= 0 ? next : prev;
|
|
61
|
-
});
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (e.key === "Enter" && focusIndex >= 0) {
|
|
65
|
-
e.preventDefault();
|
|
66
|
-
var item = visibleItems[focusIndex] as ContextMenuItem;
|
|
67
|
-
if (item && !item.disabled && (item as unknown as ContextMenuDivider).type !== "divider") {
|
|
68
|
-
item.onClick();
|
|
69
|
-
props.onClose();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
document.addEventListener("mousedown", handleClick);
|
|
74
|
-
document.addEventListener("keydown", handleKey);
|
|
75
|
-
return function () {
|
|
76
|
-
document.removeEventListener("mousedown", handleClick);
|
|
77
|
-
document.removeEventListener("keydown", handleKey);
|
|
78
|
-
};
|
|
79
|
-
}, [props.onClose, focusIndex, visibleItems]);
|
|
80
|
-
|
|
81
|
-
useEffect(function () {
|
|
82
|
-
if (!menuRef.current) return;
|
|
83
|
-
var rect = menuRef.current.getBoundingClientRect();
|
|
84
|
-
var vw = window.innerWidth;
|
|
85
|
-
var vh = window.innerHeight;
|
|
86
|
-
if (rect.right > vw) {
|
|
87
|
-
menuRef.current.style.left = Math.max(4, props.x - rect.width) + "px";
|
|
88
|
-
}
|
|
89
|
-
if (rect.bottom > vh) {
|
|
90
|
-
menuRef.current.style.top = Math.max(4, props.y - rect.height) + "px";
|
|
91
|
-
}
|
|
92
|
-
}, [props.x, props.y]);
|
|
93
|
-
|
|
94
|
-
return createPortal(
|
|
95
|
-
<div
|
|
96
|
-
ref={menuRef}
|
|
97
|
-
role="menu"
|
|
98
|
-
aria-label={props.label || "Context menu"}
|
|
99
|
-
onMouseDown={function (e) { e.stopPropagation(); }}
|
|
100
|
-
className="fixed z-[99999] bg-base-200 border border-base-content/20 rounded-lg shadow-xl p-1 min-w-[180px] animate-in fade-in zoom-in-95 duration-100"
|
|
101
|
-
style={{ top: props.y, left: props.x }}
|
|
102
|
-
>
|
|
103
|
-
{visibleItems.map(function (entry, i) {
|
|
104
|
-
if ((entry as ContextMenuDivider).type === "divider") {
|
|
105
|
-
return <div key={"d-" + i} className="my-1 border-t border-base-content/10" />;
|
|
106
|
-
}
|
|
107
|
-
var item = entry as ContextMenuItem;
|
|
108
|
-
var isFocused = i === focusIndex;
|
|
109
|
-
return (
|
|
110
|
-
<button
|
|
111
|
-
key={i}
|
|
112
|
-
role="menuitem"
|
|
113
|
-
tabIndex={isFocused ? 0 : -1}
|
|
114
|
-
disabled={item.disabled}
|
|
115
|
-
onClick={function () {
|
|
116
|
-
if (!item.disabled) {
|
|
117
|
-
item.onClick();
|
|
118
|
-
props.onClose();
|
|
119
|
-
}
|
|
120
|
-
}}
|
|
121
|
-
onMouseEnter={function () { setFocusIndex(i); }}
|
|
122
|
-
className={
|
|
123
|
-
"flex items-center gap-2 w-full px-2.5 py-1.5 rounded text-[13px] text-left transition-colors duration-[80ms] cursor-pointer " +
|
|
124
|
-
(item.disabled ? "opacity-40 cursor-not-allowed " : "") +
|
|
125
|
-
(item.danger ? "text-error hover:bg-error/10 " : "text-base-content/70 hover:bg-base-300 hover:text-base-content ") +
|
|
126
|
-
(isFocused ? (item.danger ? "bg-error/10" : "bg-base-300 text-base-content") : "")
|
|
127
|
-
}
|
|
128
|
-
>
|
|
129
|
-
{item.icon && <span className="w-4 h-4 opacity-60 shrink-0">{item.icon}</span>}
|
|
130
|
-
{item.label}
|
|
131
|
-
</button>
|
|
132
|
-
);
|
|
133
|
-
})}
|
|
134
|
-
</div>,
|
|
135
|
-
document.body,
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export function useContextMenu<T>() {
|
|
140
|
-
var [state, setState] = useState<{ x: number; y: number; data: T } | null>(null);
|
|
141
|
-
|
|
142
|
-
function open(e: React.MouseEvent, data: T) {
|
|
143
|
-
e.preventDefault();
|
|
144
|
-
e.stopPropagation();
|
|
145
|
-
setState({ x: e.clientX, y: e.clientY, data });
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function close() {
|
|
149
|
-
setState(null);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return { state, open, close };
|
|
153
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Component } from "react";
|
|
2
|
-
import type { ReactNode, ErrorInfo } from "react";
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
fallback?: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface State {
|
|
10
|
-
hasError: boolean;
|
|
11
|
-
error: Error | null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class ErrorBoundary extends Component<Props, State> {
|
|
15
|
-
constructor(props: Props) {
|
|
16
|
-
super(props);
|
|
17
|
-
this.state = { hasError: false, error: null };
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static getDerivedStateFromError(error: Error): State {
|
|
21
|
-
return { hasError: true, error };
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
componentDidCatch(error: Error, info: ErrorInfo) {
|
|
25
|
-
console.error("[lattice] Render error:", error, info.componentStack);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
handleReload() {
|
|
29
|
-
window.location.reload();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
render() {
|
|
33
|
-
if (this.state.hasError) {
|
|
34
|
-
if (this.props.fallback) {
|
|
35
|
-
return this.props.fallback;
|
|
36
|
-
}
|
|
37
|
-
return (
|
|
38
|
-
<div className="min-h-screen bg-base-100 flex items-center justify-center">
|
|
39
|
-
<div className="text-center max-w-[400px] p-8">
|
|
40
|
-
<h2 className="text-[20px] font-semibold text-error mb-3">Something went wrong</h2>
|
|
41
|
-
<p className="text-[14px] text-base-content/60 mb-5">
|
|
42
|
-
{this.state.error?.message || "An unexpected error occurred."}
|
|
43
|
-
</p>
|
|
44
|
-
<button
|
|
45
|
-
onClick={this.handleReload}
|
|
46
|
-
className="btn btn-primary btn-sm"
|
|
47
|
-
>
|
|
48
|
-
Reload
|
|
49
|
-
</button>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
return this.props.children;
|
|
55
|
-
}
|
|
56
|
-
}
|