@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.
Files changed (394) hide show
  1. package/bin/lattice +1 -9
  2. package/dist/client/assets/{angular-html-N8PCEquT.js → angular-html-DKTL-XDO.js} +1 -1
  3. package/dist/client/assets/{angular-ts-CJ8RJIPD.js → angular-ts-tvBzOwQR.js} +1 -1
  4. package/dist/client/assets/{apl-BD6tCLWN.js → apl-CCzl5qFl.js} +1 -1
  5. package/dist/client/assets/{astro-CpIIfBs6.js → astro-DNQTpO2Y.js} +1 -1
  6. package/dist/client/assets/{blade-D3qgnjiV.js → blade-CyJoIMeJ.js} +1 -1
  7. package/dist/client/assets/{c-Dr6ADN_t.js → c-OEwk5KN8.js} +1 -1
  8. package/dist/client/assets/{cobol-BIfDE0Hr.js → cobol-DpHyJzz2.js} +1 -1
  9. package/dist/client/assets/{coffee-DHQ57vfY.js → coffee-BX5dbDzZ.js} +1 -1
  10. package/dist/client/assets/{cpp-CEBY6JOp.js → cpp-BTBjNg2U.js} +1 -1
  11. package/dist/client/assets/{crystal-D125CSmP.js → crystal-CNzZd6DW.js} +1 -1
  12. package/dist/client/assets/{css-CBmrkYSr.js → css-BuKsNmms.js} +1 -1
  13. package/dist/client/assets/{dist-A_mCRD1f.js → dist-CKpDHMy6.js} +2 -2
  14. package/dist/client/assets/{edge-Ccsz7cJW.js → edge-DzhnGgJE.js} +1 -1
  15. package/dist/client/assets/{elixir-Do6gk14X.js → elixir-Dqs0waqF.js} +1 -1
  16. package/dist/client/assets/{elm-Db22zT4C.js → elm-BtWwjxWn.js} +1 -1
  17. package/dist/client/assets/{erb-MXVqAAJD.js → erb-iPD89b4v.js} +1 -1
  18. package/dist/client/assets/{git-rebase-B-LLWBOA.js → git-rebase-BxVNXJL4.js} +1 -1
  19. package/dist/client/assets/{glimmer-js-eWszRU73.js → glimmer-js-BlyCupwF.js} +1 -1
  20. package/dist/client/assets/{glimmer-ts-VQmwGqUp.js → glimmer-ts-DjIxWOS9.js} +1 -1
  21. package/dist/client/assets/{glsl-B8ilOfAl.js → glsl-CGIL-65r.js} +1 -1
  22. package/dist/client/assets/{graphql-DnTqxeOc.js → graphql-DeOn6mNV.js} +1 -1
  23. package/dist/client/assets/{hack-XJsHYSQb.js → hack-DVppeCmS.js} +1 -1
  24. package/dist/client/assets/{haml-CQ7Vqzwp.js → haml-WDhua0Mp.js} +1 -1
  25. package/dist/client/assets/{handlebars-C4szooBf.js → handlebars-i2Fu_9HI.js} +1 -1
  26. package/dist/client/assets/{html-B6EgAiSd.js → html-B1e6oxzK.js} +1 -1
  27. package/dist/client/assets/{html-derivative-DdinogQX.js → html-derivative-MofKXIVd.js} +1 -1
  28. package/dist/client/assets/{http-BSLxCgRq.js → http-Dk6S5pRD.js} +1 -1
  29. package/dist/client/assets/{hurl-pOsTwNfp.js → hurl-CroFYYJG.js} +1 -1
  30. package/dist/client/assets/{index-BHQ_8mvl.js → index-CVu-S6Yk.js} +2 -2
  31. package/dist/client/assets/{java-DRQLiiST.js → java-B89FYjqS.js} +1 -1
  32. package/dist/client/assets/{javascript-DvEK2-47.js → javascript-m6CO1Uiy.js} +1 -1
  33. package/dist/client/assets/{jinja-D2NYJ25y.js → jinja-DC9Wi41X.js} +1 -1
  34. package/dist/client/assets/{jison-DDZaLNAp.js → jison-6xiegwDk.js} +1 -1
  35. package/dist/client/assets/{json-TGR0NIWd.js → json-HA-96-qr.js} +1 -1
  36. package/dist/client/assets/{jsx-BjUoPYga.js → jsx-Wt1a8i8U.js} +1 -1
  37. package/dist/client/assets/{julia-C4gjSpFu.js → julia-7M93VBON.js} +1 -1
  38. package/dist/client/assets/{just-H351x5u_.js → just-CjfDLYLv.js} +1 -1
  39. package/dist/client/assets/{latex-BiTmf6gf.js → latex-CitsJ46x.js} +1 -1
  40. package/dist/client/assets/{liquid-86ufjRy-.js → liquid-C8VIFin8.js} +1 -1
  41. package/dist/client/assets/{lua-BNxR0F_8.js → lua-Ba2N7esc.js} +1 -1
  42. package/dist/client/assets/{marko-CvRxpRjM.js → marko-lTLvb2wu.js} +1 -1
  43. package/dist/client/assets/{mdc-CYbAIy2C.js → mdc-D6IV-8FD.js} +1 -1
  44. package/dist/client/assets/{nginx-egdgMq-F.js → nginx-Ch5AjE6S.js} +1 -1
  45. package/dist/client/assets/{nim-CXBJVz_w.js → nim-WmDDC6LW.js} +1 -1
  46. package/dist/client/assets/{perl-XRfMobzg.js → perl-CQv0gYuq.js} +1 -1
  47. package/dist/client/assets/{php-Br7a8uil.js → php-BJmH0qOB.js} +1 -1
  48. package/dist/client/assets/{pug-BVbbUVvy.js → pug-CsHPkzc9.js} +1 -1
  49. package/dist/client/assets/{qml-ByKvrL1j.js → qml-B36ecArG.js} +1 -1
  50. package/dist/client/assets/{r-mVoV0Ni6.js → r-D5Yi5Z4y.js} +1 -1
  51. package/dist/client/assets/{razor-T5O-9UJL.js → razor-CHAxVq4R.js} +1 -1
  52. package/dist/client/assets/{regexp-CioRuhuN.js → regexp-gfs--3M7.js} +1 -1
  53. package/dist/client/assets/{rst-V__uTudD.js → rst-ugdlp-hl.js} +1 -1
  54. package/dist/client/assets/{ruby-C_PuKPTI.js → ruby-CDRRW37j.js} +1 -1
  55. package/dist/client/assets/{sas-D_DqqQH4.js → sas-DZaNQaIP.js} +1 -1
  56. package/dist/client/assets/{scss-D-TjzZ4c.js → scss-CzWQEplj.js} +1 -1
  57. package/dist/client/assets/{shellscript-E5759VHu.js → shellscript-fgYvpu9N.js} +1 -1
  58. package/dist/client/assets/{shellsession-AESTM-Pv.js → shellsession-BoAohHh7.js} +1 -1
  59. package/dist/client/assets/{soy-QrbrrcDv.js → soy-DBzVgv9x.js} +1 -1
  60. package/dist/client/assets/{sql-0M8VcDHD.js → sql-BYXpAYTs.js} +1 -1
  61. package/dist/client/assets/{stata-CgeIpGtc.js → stata-I71MMY3p.js} +1 -1
  62. package/dist/client/assets/{surrealql-DBGwnZbw.js → surrealql-C9U8_1VO.js} +1 -1
  63. package/dist/client/assets/{svelte-Cv0PvUc_.js → svelte-VOFrPnWT.js} +1 -1
  64. package/dist/client/assets/{templ-B9t7xRE4.js → templ-BIaxAEtC.js} +1 -1
  65. package/dist/client/assets/{tex-DhZZ8dr2.js → tex-D1dwnBE5.js} +1 -1
  66. package/dist/client/assets/{ts-tags-BFv8sbnd.js → ts-tags-C0L2Q0r5.js} +1 -1
  67. package/dist/client/assets/{tsx-CXC9KSbY.js → tsx-BqcycEv1.js} +1 -1
  68. package/dist/client/assets/{twig-CM_OO66r.js → twig-vyWqOhpM.js} +1 -1
  69. package/dist/client/assets/{typescript-BdgOTaoD.js → typescript-B2YbovqG.js} +1 -1
  70. package/dist/client/assets/{vue-BnQhjnCm.js → vue-CbXxGdjo.js} +1 -1
  71. package/dist/client/assets/{vue-html-CNnGecRI.js → vue-html-DDX4KXW7.js} +1 -1
  72. package/dist/client/assets/{vue-vine-DCuMkRhK.js → vue-vine-DsyY1LR5.js} +1 -1
  73. package/dist/client/assets/{xml-CbTD7cB8.js → xml-Ddi0-r0D.js} +1 -1
  74. package/dist/client/assets/{xsl-uOqqo7cf.js → xsl-CsFcZHFS.js} +1 -1
  75. package/dist/client/assets/{yaml-BNrLoH59.js → yaml-tGJWoH6Y.js} +1 -1
  76. package/dist/client/index.html +1 -1
  77. package/dist/client/sw.js +1 -1
  78. package/dist/server/analytics/engine.js +832 -0
  79. package/dist/server/assets.js +39 -0
  80. package/dist/server/auth/passphrase.js +70 -0
  81. package/dist/server/config.js +47 -0
  82. package/dist/server/daemon.js +535 -0
  83. package/dist/server/features/ralph-loop.js +138 -0
  84. package/dist/server/features/scheduler.js +260 -0
  85. package/dist/server/features/sticky-notes.js +99 -0
  86. package/dist/server/handlers/analytics.js +28 -0
  87. package/dist/server/handlers/attachment.js +158 -0
  88. package/dist/server/handlers/bookmarks.js +41 -0
  89. package/dist/server/handlers/chat.js +350 -0
  90. package/dist/server/handlers/editor.js +72 -0
  91. package/dist/server/handlers/fs.js +234 -0
  92. package/dist/server/handlers/loop.js +33 -0
  93. package/dist/server/handlers/memory.js +181 -0
  94. package/dist/server/handlers/mesh.js +322 -0
  95. package/dist/server/handlers/notes.js +36 -0
  96. package/dist/server/handlers/plugins.js +593 -0
  97. package/dist/server/handlers/project-settings.js +166 -0
  98. package/dist/server/handlers/scheduler.js +52 -0
  99. package/dist/server/handlers/session.js +194 -0
  100. package/dist/server/handlers/settings.js +148 -0
  101. package/dist/server/handlers/skills.js +360 -0
  102. package/dist/server/handlers/terminal.js +75 -0
  103. package/dist/server/handlers/themes.js +102 -0
  104. package/dist/server/handlers/update.js +124 -0
  105. package/dist/server/identity.js +45 -0
  106. package/dist/server/index.js +435 -0
  107. package/dist/server/logger.js +20 -0
  108. package/dist/server/mesh/connector.js +355 -0
  109. package/dist/server/mesh/crypto.js +88 -0
  110. package/dist/server/mesh/discovery.js +95 -0
  111. package/dist/server/mesh/pairing.js +104 -0
  112. package/dist/server/mesh/peers.js +54 -0
  113. package/dist/server/mesh/proxy.js +86 -0
  114. package/dist/server/mesh/session-sync.js +85 -0
  115. package/dist/server/project/bookmarks.js +77 -0
  116. package/dist/server/project/context-breakdown.js +279 -0
  117. package/dist/server/project/file-browser.js +97 -0
  118. package/dist/server/project/project-files.js +274 -0
  119. package/dist/server/project/registry.js +51 -0
  120. package/dist/server/project/sdk-bridge.js +960 -0
  121. package/dist/server/project/session.js +696 -0
  122. package/dist/server/project/terminal.js +87 -0
  123. package/dist/server/project/warmup.js +242 -0
  124. package/dist/server/push.js +87 -0
  125. package/dist/server/tls.js +50 -0
  126. package/dist/server/tui.js +83 -0
  127. package/dist/server/update-checker.js +119 -0
  128. package/dist/server/ws/broadcast.js +50 -0
  129. package/dist/server/ws/router.js +105 -0
  130. package/dist/server/ws/server.js +2 -0
  131. package/dist/shared/analytics.js +1 -0
  132. package/dist/shared/messages.js +1 -0
  133. package/dist/shared/models.js +1 -0
  134. package/dist/shared/project-settings.js +1 -0
  135. package/package.json +5 -8
  136. package/themes/alabaster.json +9 -0
  137. package/themes/amoled.json +20 -0
  138. package/themes/ayu-light.json +9 -0
  139. package/themes/catppuccin-latte.json +9 -0
  140. package/themes/catppuccin-mocha.json +9 -0
  141. package/themes/clay-light.json +10 -0
  142. package/themes/clay.json +10 -0
  143. package/themes/dracula.json +9 -0
  144. package/themes/everforest-light.json +9 -0
  145. package/themes/everforest.json +9 -0
  146. package/themes/github-light.json +9 -0
  147. package/themes/gruvbox-dark.json +9 -0
  148. package/themes/gruvbox-light.json +9 -0
  149. package/themes/horizon-light.json +9 -0
  150. package/themes/kanagawa-lotus.json +9 -0
  151. package/themes/kanagawa.json +9 -0
  152. package/themes/modus-operandi.json +9 -0
  153. package/themes/monokai.json +9 -0
  154. package/themes/nightfox.json +9 -0
  155. package/themes/nord-light.json +9 -0
  156. package/themes/nord.json +9 -0
  157. package/themes/one-dark.json +9 -0
  158. package/themes/one-light.json +9 -0
  159. package/themes/palenight.json +9 -0
  160. package/themes/paper.json +9 -0
  161. package/themes/penumbra-light.json +9 -0
  162. package/themes/poimandres.json +9 -0
  163. package/themes/quiet-light.json +9 -0
  164. package/themes/rose-pine-dawn.json +9 -0
  165. package/themes/rose-pine.json +9 -0
  166. package/themes/solarized-dark.json +9 -0
  167. package/themes/solarized-light.json +9 -0
  168. package/themes/synthwave84.json +9 -0
  169. package/themes/tokyo-night-light.json +9 -0
  170. package/themes/tokyo-night.json +9 -0
  171. package/themes/vesper.json +9 -0
  172. package/index.html +0 -20
  173. package/public/icons/icon-192.svg +0 -11
  174. package/public/icons/icon-512.svg +0 -11
  175. package/public/sw-push.js +0 -53
  176. package/src/client/App.tsx +0 -42
  177. package/src/client/commands.ts +0 -36
  178. package/src/client/components/analytics/AnalyticsView.tsx +0 -244
  179. package/src/client/components/analytics/ChartCard.tsx +0 -194
  180. package/src/client/components/analytics/PeriodSelector.tsx +0 -42
  181. package/src/client/components/analytics/QuickStats.tsx +0 -122
  182. package/src/client/components/analytics/chartTokens.ts +0 -188
  183. package/src/client/components/analytics/charts/ActivityCalendar.tsx +0 -204
  184. package/src/client/components/analytics/charts/CacheEfficiencyChart.tsx +0 -56
  185. package/src/client/components/analytics/charts/ContextUtilizationChart.tsx +0 -106
  186. package/src/client/components/analytics/charts/CostAreaChart.tsx +0 -79
  187. package/src/client/components/analytics/charts/CostDistributionChart.tsx +0 -59
  188. package/src/client/components/analytics/charts/CostDonutChart.tsx +0 -84
  189. package/src/client/components/analytics/charts/CumulativeCostChart.tsx +0 -59
  190. package/src/client/components/analytics/charts/DailySummaryCards.tsx +0 -86
  191. package/src/client/components/analytics/charts/HourlyHeatmap.tsx +0 -133
  192. package/src/client/components/analytics/charts/NodeFleetOverview.tsx +0 -89
  193. package/src/client/components/analytics/charts/PermissionBreakdown.tsx +0 -98
  194. package/src/client/components/analytics/charts/ProjectRadar.tsx +0 -126
  195. package/src/client/components/analytics/charts/ResponseTimeScatter.tsx +0 -96
  196. package/src/client/components/analytics/charts/SessionBubbleChart.tsx +0 -114
  197. package/src/client/components/analytics/charts/SessionComplexityList.tsx +0 -65
  198. package/src/client/components/analytics/charts/SessionTimeline.tsx +0 -107
  199. package/src/client/components/analytics/charts/TokenFlowChart.tsx +0 -78
  200. package/src/client/components/analytics/charts/TokenSankeyChart.tsx +0 -93
  201. package/src/client/components/analytics/charts/ToolSunburst.tsx +0 -123
  202. package/src/client/components/analytics/charts/ToolTreemap.tsx +0 -110
  203. package/src/client/components/auth/PassphrasePrompt.tsx +0 -70
  204. package/src/client/components/chat/AttachmentChips.tsx +0 -116
  205. package/src/client/components/chat/ChatInput.tsx +0 -533
  206. package/src/client/components/chat/ChatView.tsx +0 -1076
  207. package/src/client/components/chat/CommandPalette.tsx +0 -162
  208. package/src/client/components/chat/ElicitationCard.tsx +0 -238
  209. package/src/client/components/chat/Message.tsx +0 -825
  210. package/src/client/components/chat/ModelSelector.tsx +0 -108
  211. package/src/client/components/chat/PermissionModeSelector.tsx +0 -41
  212. package/src/client/components/chat/PromptQuestion.tsx +0 -271
  213. package/src/client/components/chat/StatusBar.tsx +0 -50
  214. package/src/client/components/chat/TodoCard.tsx +0 -57
  215. package/src/client/components/chat/ToolGroup.tsx +0 -129
  216. package/src/client/components/chat/ToolResultRenderer.tsx +0 -348
  217. package/src/client/components/chat/VoiceRecorder.tsx +0 -85
  218. package/src/client/components/chat/toolSummary.ts +0 -41
  219. package/src/client/components/dashboard/DashboardView.tsx +0 -200
  220. package/src/client/components/dashboard/ProjectDashboardView.tsx +0 -179
  221. package/src/client/components/mesh/NodeBadge.tsx +0 -24
  222. package/src/client/components/mesh/PairingDialog.tsx +0 -340
  223. package/src/client/components/project-settings/ProjectClaude.tsx +0 -318
  224. package/src/client/components/project-settings/ProjectEnvironment.tsx +0 -235
  225. package/src/client/components/project-settings/ProjectGeneral.tsx +0 -76
  226. package/src/client/components/project-settings/ProjectMcp.tsx +0 -232
  227. package/src/client/components/project-settings/ProjectMemory.tsx +0 -488
  228. package/src/client/components/project-settings/ProjectNotifications.tsx +0 -48
  229. package/src/client/components/project-settings/ProjectPermissions.tsx +0 -209
  230. package/src/client/components/project-settings/ProjectPlugins.tsx +0 -117
  231. package/src/client/components/project-settings/ProjectRules.tsx +0 -286
  232. package/src/client/components/project-settings/ProjectSettingsView.tsx +0 -117
  233. package/src/client/components/project-settings/ProjectSkills.tsx +0 -91
  234. package/src/client/components/settings/Appearance.tsx +0 -275
  235. package/src/client/components/settings/BudgetSettings.tsx +0 -165
  236. package/src/client/components/settings/ClaudeSettings.tsx +0 -175
  237. package/src/client/components/settings/Editor.tsx +0 -123
  238. package/src/client/components/settings/Environment.tsx +0 -185
  239. package/src/client/components/settings/GlobalMcp.tsx +0 -216
  240. package/src/client/components/settings/GlobalMemory.tsx +0 -19
  241. package/src/client/components/settings/GlobalPlugins.tsx +0 -806
  242. package/src/client/components/settings/GlobalRules.tsx +0 -149
  243. package/src/client/components/settings/GlobalSkills.tsx +0 -140
  244. package/src/client/components/settings/MeshStatus.tsx +0 -183
  245. package/src/client/components/settings/Notifications.tsx +0 -123
  246. package/src/client/components/settings/SettingsView.tsx +0 -75
  247. package/src/client/components/settings/SkillMarketplace.tsx +0 -175
  248. package/src/client/components/settings/ThemePreview.tsx +0 -140
  249. package/src/client/components/settings/ThemeWizard.tsx +0 -405
  250. package/src/client/components/settings/mcp-shared.tsx +0 -194
  251. package/src/client/components/settings/skill-shared.tsx +0 -186
  252. package/src/client/components/setup/SetupWizard.tsx +0 -755
  253. package/src/client/components/sidebar/AddProjectModal.tsx +0 -438
  254. package/src/client/components/sidebar/NodeSettingsModal.tsx +0 -206
  255. package/src/client/components/sidebar/ProjectDropdown.tsx +0 -211
  256. package/src/client/components/sidebar/ProjectRail.tsx +0 -353
  257. package/src/client/components/sidebar/SearchFilter.tsx +0 -52
  258. package/src/client/components/sidebar/SessionList.tsx +0 -599
  259. package/src/client/components/sidebar/SettingsSidebar.tsx +0 -139
  260. package/src/client/components/sidebar/Sidebar.tsx +0 -469
  261. package/src/client/components/sidebar/UserIsland.tsx +0 -282
  262. package/src/client/components/sidebar/UserMenu.tsx +0 -107
  263. package/src/client/components/ui/CommandPalette.tsx +0 -321
  264. package/src/client/components/ui/ContextMenu.tsx +0 -153
  265. package/src/client/components/ui/ErrorBoundary.tsx +0 -56
  266. package/src/client/components/ui/IconPicker.tsx +0 -184
  267. package/src/client/components/ui/KeyboardShortcuts.tsx +0 -129
  268. package/src/client/components/ui/LatticeLogomark.tsx +0 -19
  269. package/src/client/components/ui/NodeDisconnectedOverlay.tsx +0 -35
  270. package/src/client/components/ui/PopupMenu.tsx +0 -120
  271. package/src/client/components/ui/SaveFooter.tsx +0 -63
  272. package/src/client/components/ui/Toast.tsx +0 -132
  273. package/src/client/components/ui/UpdateBanner.tsx +0 -110
  274. package/src/client/components/ui/UpdatePrompt.tsx +0 -47
  275. package/src/client/components/workspace/BookmarksView.tsx +0 -156
  276. package/src/client/components/workspace/FileBrowser.tsx +0 -174
  277. package/src/client/components/workspace/FileTree.tsx +0 -129
  278. package/src/client/components/workspace/FileViewer.tsx +0 -211
  279. package/src/client/components/workspace/NoteCard.tsx +0 -120
  280. package/src/client/components/workspace/NotesView.tsx +0 -102
  281. package/src/client/components/workspace/ScheduledTasksView.tsx +0 -117
  282. package/src/client/components/workspace/SplitPane.tsx +0 -81
  283. package/src/client/components/workspace/TabBar.tsx +0 -170
  284. package/src/client/components/workspace/TaskCard.tsx +0 -159
  285. package/src/client/components/workspace/TaskEditModal.tsx +0 -129
  286. package/src/client/components/workspace/TerminalInstance.tsx +0 -171
  287. package/src/client/components/workspace/TerminalView.tsx +0 -110
  288. package/src/client/components/workspace/WorkspaceView.tsx +0 -141
  289. package/src/client/hooks/useAnalytics.ts +0 -84
  290. package/src/client/hooks/useAttachments.ts +0 -313
  291. package/src/client/hooks/useBookmarks.ts +0 -57
  292. package/src/client/hooks/useEditorConfig.ts +0 -28
  293. package/src/client/hooks/useFocusTrap.ts +0 -74
  294. package/src/client/hooks/useIdleDetection.ts +0 -50
  295. package/src/client/hooks/useInstallPrompt.ts +0 -53
  296. package/src/client/hooks/useMesh.ts +0 -89
  297. package/src/client/hooks/useNotifications.ts +0 -54
  298. package/src/client/hooks/useOnline.ts +0 -6
  299. package/src/client/hooks/useProjectSettings.ts +0 -56
  300. package/src/client/hooks/useProjects.ts +0 -98
  301. package/src/client/hooks/usePushNotifications.ts +0 -92
  302. package/src/client/hooks/useSaveState.ts +0 -65
  303. package/src/client/hooks/useSession.ts +0 -580
  304. package/src/client/hooks/useSidebar.ts +0 -90
  305. package/src/client/hooks/useSkills.ts +0 -30
  306. package/src/client/hooks/useSpinnerVerb.ts +0 -36
  307. package/src/client/hooks/useSwipeDrawer.ts +0 -299
  308. package/src/client/hooks/useTheme.ts +0 -114
  309. package/src/client/hooks/useTimeTick.ts +0 -35
  310. package/src/client/hooks/useVoiceRecorder.ts +0 -169
  311. package/src/client/hooks/useWebSocket.ts +0 -27
  312. package/src/client/hooks/useWorkspace.ts +0 -57
  313. package/src/client/lib/theme-derive.ts +0 -196
  314. package/src/client/lib/workspace-url.ts +0 -219
  315. package/src/client/main.tsx +0 -10
  316. package/src/client/providers/WebSocketProvider.tsx +0 -186
  317. package/src/client/router.tsx +0 -578
  318. package/src/client/stores/analytics.ts +0 -68
  319. package/src/client/stores/bookmarks.ts +0 -45
  320. package/src/client/stores/mesh.ts +0 -78
  321. package/src/client/stores/session.ts +0 -569
  322. package/src/client/stores/sidebar.ts +0 -530
  323. package/src/client/stores/theme.ts +0 -44
  324. package/src/client/stores/workspace.ts +0 -518
  325. package/src/client/styles/global.css +0 -391
  326. package/src/client/styles/theme-vars.css +0 -18
  327. package/src/client/themes/index.ts +0 -105
  328. package/src/client/utils/editorUrl.ts +0 -55
  329. package/src/client/utils/findDuplicateKeys.ts +0 -12
  330. package/src/client/utils/formatSessionTitle.ts +0 -17
  331. package/src/client/vite-env.d.ts +0 -6
  332. package/src/server/analytics/engine.ts +0 -920
  333. package/src/server/assets.ts +0 -45
  334. package/src/server/auth/passphrase.ts +0 -78
  335. package/src/server/config.ts +0 -55
  336. package/src/server/daemon.ts +0 -567
  337. package/src/server/features/ralph-loop.ts +0 -173
  338. package/src/server/features/scheduler.ts +0 -304
  339. package/src/server/features/sticky-notes.ts +0 -104
  340. package/src/server/handlers/analytics.ts +0 -39
  341. package/src/server/handlers/attachment.ts +0 -189
  342. package/src/server/handlers/bookmarks.ts +0 -50
  343. package/src/server/handlers/chat.ts +0 -381
  344. package/src/server/handlers/editor.ts +0 -76
  345. package/src/server/handlers/fs.ts +0 -251
  346. package/src/server/handlers/loop.ts +0 -37
  347. package/src/server/handlers/memory.ts +0 -182
  348. package/src/server/handlers/mesh.ts +0 -362
  349. package/src/server/handlers/notes.ts +0 -47
  350. package/src/server/handlers/plugins.ts +0 -655
  351. package/src/server/handlers/project-settings.ts +0 -180
  352. package/src/server/handlers/scheduler.ts +0 -64
  353. package/src/server/handlers/session.ts +0 -226
  354. package/src/server/handlers/settings.ts +0 -157
  355. package/src/server/handlers/skills.ts +0 -378
  356. package/src/server/handlers/terminal.ts +0 -88
  357. package/src/server/handlers/themes.ts +0 -121
  358. package/src/server/handlers/update.ts +0 -133
  359. package/src/server/identity.ts +0 -56
  360. package/src/server/index.ts +0 -457
  361. package/src/server/logger.ts +0 -21
  362. package/src/server/mesh/connector.ts +0 -419
  363. package/src/server/mesh/crypto.ts +0 -106
  364. package/src/server/mesh/discovery.ts +0 -126
  365. package/src/server/mesh/pairing.ts +0 -123
  366. package/src/server/mesh/peers.ts +0 -60
  367. package/src/server/mesh/proxy.ts +0 -106
  368. package/src/server/mesh/session-sync.ts +0 -107
  369. package/src/server/project/bookmarks.ts +0 -83
  370. package/src/server/project/context-breakdown.ts +0 -307
  371. package/src/server/project/file-browser.ts +0 -106
  372. package/src/server/project/project-files.ts +0 -267
  373. package/src/server/project/pty-worker.cjs +0 -83
  374. package/src/server/project/registry.ts +0 -57
  375. package/src/server/project/sdk-bridge.ts +0 -1100
  376. package/src/server/project/session.ts +0 -723
  377. package/src/server/project/terminal.ts +0 -111
  378. package/src/server/project/warmup.ts +0 -285
  379. package/src/server/push.ts +0 -121
  380. package/src/server/tls.ts +0 -65
  381. package/src/server/tui.ts +0 -103
  382. package/src/server/update-checker.ts +0 -147
  383. package/src/server/ws/broadcast.ts +0 -61
  384. package/src/server/ws/router.ts +0 -123
  385. package/src/server/ws/server.ts +0 -2
  386. package/src/shared/analytics.ts +0 -40
  387. package/src/shared/messages.ts +0 -1302
  388. package/src/shared/models.ts +0 -255
  389. package/src/shared/project-settings.ts +0 -45
  390. package/tsconfig.json +0 -25
  391. package/vite.config.ts +0 -71
  392. /package/{src/server/runtime.ts → dist/server/runtime.js} +0 -0
  393. /package/{src/shared/constants.ts → dist/shared/constants.js} +0 -0
  394. /package/{src/shared/index.ts → dist/shared/index.js} +0 -0
@@ -1,530 +0,0 @@
1
- import { Store } from "@tanstack/react-store";
2
- import type { ProjectSettingsSection } from "#shared";
3
- import { encodeWorkspaceUrl, decodeWorkspaceUrl, isLegacySessionUrl, shortSessionId } from "../lib/workspace-url";
4
- import type { DecodedWorkspace } from "../lib/workspace-url";
5
- import { getWorkspaceStore, restoreWorkspace, setUrlSyncCallback, switchProjectWorkspace, setCurrentProjectKey } from "./workspace";
6
- import { setAnalyticsScope } from "./analytics";
7
-
8
- export type { ProjectSettingsSection };
9
-
10
- export type SettingsSection =
11
- | "appearance" | "claude" | "environment"
12
- | "mcp" | "skills" | "plugins" | "nodes" | "editor"
13
- | "rules" | "memory" | "notifications" | "budget";
14
-
15
- export type SidebarMode = "project" | "settings";
16
-
17
- export type ActiveView =
18
- | { type: "dashboard" }
19
- | { type: "project-dashboard" }
20
- | { type: "analytics" }
21
- | { type: "chat" }
22
- | { type: "settings"; section: SettingsSection }
23
- | { type: "project-settings"; section: ProjectSettingsSection };
24
-
25
- export interface SidebarState {
26
- activeProjectSlug: string | null;
27
- activeSessionId: string | null;
28
- sidebarMode: SidebarMode;
29
- activeView: ActiveView;
30
- previousView: ActiveView | null;
31
- userMenuOpen: boolean;
32
- projectDropdownOpen: boolean;
33
- drawerOpen: boolean;
34
- nodeSettingsOpen: boolean;
35
- addProjectOpen: boolean;
36
- confirmRemoveSlug: string | null;
37
- }
38
-
39
- const SETTINGS_SECTIONS: SettingsSection[] = ["appearance", "claude", "environment", "mcp", "skills", "plugins", "nodes", "editor", "rules", "memory", "notifications", "budget"];
40
-
41
- interface ParsedUrl {
42
- projectSlug: string | null;
43
- sessionId: string | null;
44
- settingsSection: SettingsSection | null;
45
- projectSettingsSection: ProjectSettingsSection | null;
46
- tParam: string | null;
47
- decodedWorkspace: DecodedWorkspace | null;
48
- }
49
-
50
- function resolveFullIdFromNothing(_shortId: string, _projectSlug: string): string | null {
51
- return null;
52
- }
53
-
54
- function parseInitialUrl(): ParsedUrl {
55
- const path = window.location.pathname;
56
- const parts = path.split("/").filter(function (p) { return p.length > 0; });
57
- const searchParams = new URLSearchParams(window.location.search);
58
- const tParam = searchParams.get("t");
59
-
60
- if (parts[0] === "settings") {
61
- const section = parts[1] as SettingsSection;
62
- if (section && SETTINGS_SECTIONS.indexOf(section) !== -1) {
63
- return { projectSlug: null, sessionId: null, settingsSection: section, projectSettingsSection: null, tParam: null, decodedWorkspace: null };
64
- }
65
- return { projectSlug: null, sessionId: null, settingsSection: "appearance", projectSettingsSection: null, tParam: null, decodedWorkspace: null };
66
- }
67
-
68
- if (parts.length >= 2 && parts[1] === "settings") {
69
- return { projectSlug: parts[0], sessionId: null, settingsSection: null, projectSettingsSection: (parts[2] || "general") as ProjectSettingsSection, tParam: null, decodedWorkspace: null };
70
- }
71
-
72
- const legacy = isLegacySessionUrl(path);
73
- if (legacy && !tParam) {
74
- const shortId = shortSessionId(legacy.sessionId);
75
- const newUrl = "/" + legacy.projectSlug + "?t=chat:" + shortId + "*";
76
- window.history.replaceState(null, "", newUrl);
77
- const decoded = decodeWorkspaceUrl("chat:" + shortId + "*", legacy.projectSlug, resolveFullIdFromNothing);
78
- return {
79
- projectSlug: legacy.projectSlug,
80
- sessionId: legacy.sessionId,
81
- settingsSection: null,
82
- projectSettingsSection: null,
83
- tParam: "chat:" + shortId + "*",
84
- decodedWorkspace: decoded,
85
- };
86
- }
87
-
88
- if (parts.length >= 1 && parts[0] !== "settings") {
89
- const projectSlug = parts[0];
90
- if (tParam) {
91
- const decoded = decodeWorkspaceUrl(tParam, projectSlug, resolveFullIdFromNothing);
92
- let sessionId: string | null = null;
93
- const activePane = decoded.panes.find(function (p) { return p.id === decoded.activePaneId; });
94
- if (activePane) {
95
- const activeTab = decoded.tabs.find(function (t) { return t.id === activePane.activeTabId; });
96
- if (activeTab && activeTab.type === "chat" && activeTab.sessionId) {
97
- sessionId = activeTab.sessionId;
98
- }
99
- }
100
- return { projectSlug, sessionId, settingsSection: null, projectSettingsSection: null, tParam, decodedWorkspace: decoded };
101
- }
102
- return { projectSlug, sessionId: null, settingsSection: null, projectSettingsSection: null, tParam: null, decodedWorkspace: null };
103
- }
104
-
105
- return { projectSlug: null, sessionId: null, settingsSection: null, projectSettingsSection: null, tParam: null, decodedWorkspace: null };
106
- }
107
-
108
- const initialUrl = parseInitialUrl();
109
-
110
- setCurrentProjectKey(initialUrl.settingsSection ? null : initialUrl.projectSlug);
111
- if (initialUrl.decodedWorkspace) {
112
- restoreWorkspace(initialUrl.decodedWorkspace);
113
- }
114
-
115
- const sidebarStore = new Store<SidebarState>({
116
- activeProjectSlug: initialUrl.settingsSection ? null : initialUrl.projectSlug,
117
- activeSessionId: initialUrl.settingsSection ? null : initialUrl.sessionId,
118
- sidebarMode: (initialUrl.settingsSection || initialUrl.projectSettingsSection) ? "settings" : "project",
119
- activeView: initialUrl.settingsSection
120
- ? { type: "settings", section: initialUrl.settingsSection }
121
- : initialUrl.projectSettingsSection
122
- ? { type: "project-settings", section: initialUrl.projectSettingsSection }
123
- : initialUrl.projectSlug
124
- ? (initialUrl.sessionId || initialUrl.tParam ? { type: "chat" } : { type: "project-dashboard" })
125
- : { type: "dashboard" },
126
- previousView: null,
127
- userMenuOpen: false,
128
- projectDropdownOpen: false,
129
- drawerOpen: false,
130
- nodeSettingsOpen: false,
131
- addProjectOpen: false,
132
- confirmRemoveSlug: null,
133
- });
134
-
135
- let lastEncodedUrl = "";
136
-
137
- function pushUrl(projectSlug: string | null, replace: boolean = false): void {
138
- const wsState = getWorkspaceStore().state;
139
- const encoded = encodeWorkspaceUrl(wsState, wsState.tabs, projectSlug);
140
- let path = "/";
141
- if (projectSlug) {
142
- path = "/" + projectSlug;
143
- if (encoded) {
144
- path += "?t=" + encoded;
145
- }
146
- }
147
- const hash = window.location.hash;
148
- const fullUrl = path + hash;
149
- if (window.location.pathname + window.location.search !== path) {
150
- if (replace) {
151
- window.history.replaceState(null, "", fullUrl);
152
- } else {
153
- window.history.pushState(null, "", fullUrl);
154
- }
155
- }
156
- lastEncodedUrl = encoded;
157
- }
158
-
159
- export function syncUrlFromWorkspace(): void {
160
- const state = sidebarStore.state;
161
- if (state.sidebarMode === "settings") return;
162
- if (!state.activeProjectSlug) return;
163
-
164
- const wsState = getWorkspaceStore().state;
165
- const encoded = encodeWorkspaceUrl(wsState, wsState.tabs, state.activeProjectSlug);
166
-
167
- if (encoded === lastEncodedUrl) return;
168
-
169
- const isActiveTabChangeOnly = detectActiveTabChangeOnly(lastEncodedUrl, encoded);
170
- lastEncodedUrl = encoded;
171
-
172
- let path = "/" + state.activeProjectSlug;
173
- if (encoded) {
174
- path += "?t=" + encoded;
175
- }
176
- const hash = window.location.hash;
177
- const fullUrl = path + hash;
178
-
179
- if (window.location.pathname + window.location.search !== path) {
180
- if (isActiveTabChangeOnly) {
181
- window.history.replaceState(null, "", fullUrl);
182
- } else {
183
- window.history.pushState(null, "", fullUrl);
184
- }
185
- }
186
- }
187
-
188
- function detectActiveTabChangeOnly(oldEncoded: string, newEncoded: string): boolean {
189
- const oldStripped = oldEncoded.replace(/\*/g, "");
190
- const newStripped = newEncoded.replace(/\*/g, "");
191
- return oldStripped === newStripped;
192
- }
193
-
194
- setUrlSyncCallback(syncUrlFromWorkspace);
195
-
196
- export function getSidebarStore(): Store<SidebarState> {
197
- return sidebarStore;
198
- }
199
-
200
- export function setActiveProjectSlug(slug: string | null): void {
201
- let prevSlug = sidebarStore.state.activeProjectSlug;
202
- sidebarStore.setState(function (state) {
203
- return {
204
- ...state,
205
- activeProjectSlug: slug,
206
- activeSessionId: null,
207
- sidebarMode: "project",
208
- activeView: slug ? { type: "project-dashboard" } : { type: "dashboard" },
209
- userMenuOpen: false,
210
- projectDropdownOpen: false,
211
- };
212
- });
213
- let path = "/";
214
- if (slug) {
215
- path = "/" + slug;
216
- }
217
- if (window.location.pathname + window.location.search !== path) {
218
- window.history.pushState(null, "", path);
219
- }
220
- lastEncodedUrl = "";
221
- // Switch workspace AFTER sidebar state is set so React sees both in same render
222
- switchProjectWorkspace(prevSlug, slug);
223
- }
224
-
225
- export function setActiveSessionId(sessionId: string | null): void {
226
- sidebarStore.setState(function (s) {
227
- return {
228
- ...s,
229
- activeSessionId: sessionId,
230
- activeView: sessionId ? { type: "chat" } : s.activeView,
231
- };
232
- });
233
- }
234
-
235
- export function navigateToSession(projectSlug: string, sessionId: string): void {
236
- sidebarStore.setState(function (state) {
237
- return {
238
- ...state,
239
- activeProjectSlug: projectSlug,
240
- activeSessionId: sessionId,
241
- sidebarMode: "project",
242
- activeView: { type: "chat" },
243
- userMenuOpen: false,
244
- projectDropdownOpen: false,
245
- };
246
- });
247
- }
248
-
249
- export function openSettings(section: SettingsSection): void {
250
- sidebarStore.setState(function (state) {
251
- return {
252
- ...state,
253
- sidebarMode: "settings",
254
- previousView: state.activeView.type !== "settings" ? state.activeView : state.previousView,
255
- activeView: { type: "settings", section: section },
256
- userMenuOpen: false,
257
- projectDropdownOpen: false,
258
- };
259
- });
260
- const path = "/settings/" + section;
261
- if (window.location.pathname !== path) {
262
- window.history.pushState(null, "", path);
263
- }
264
- }
265
-
266
- export function setSettingsSection(section: SettingsSection): void {
267
- sidebarStore.setState(function (state) {
268
- return {
269
- ...state,
270
- activeView: { type: "settings", section: section },
271
- };
272
- });
273
- const path = "/settings/" + section;
274
- if (window.location.pathname !== path) {
275
- window.history.replaceState(null, "", path);
276
- }
277
- }
278
-
279
- export function openProjectSettings(section: ProjectSettingsSection): void {
280
- sidebarStore.setState(function (state) {
281
- return {
282
- ...state,
283
- sidebarMode: "settings",
284
- previousView: state.activeView.type !== "settings" && state.activeView.type !== "project-settings" ? state.activeView : state.previousView,
285
- activeView: { type: "project-settings", section: section },
286
- userMenuOpen: false,
287
- projectDropdownOpen: false,
288
- };
289
- });
290
- const state = sidebarStore.state;
291
- const path = "/" + state.activeProjectSlug + "/settings/" + section;
292
- if (window.location.pathname !== path) {
293
- window.history.pushState(null, "", path);
294
- }
295
- }
296
-
297
- export function setProjectSettingsSection(section: ProjectSettingsSection): void {
298
- sidebarStore.setState(function (state) {
299
- return {
300
- ...state,
301
- activeView: { type: "project-settings", section: section },
302
- };
303
- });
304
- const state = sidebarStore.state;
305
- const path = "/" + state.activeProjectSlug + "/settings/" + section;
306
- if (window.location.pathname !== path) {
307
- window.history.replaceState(null, "", path);
308
- }
309
- }
310
-
311
- export function exitSettings(): void {
312
- const state = sidebarStore.state;
313
- const restored = state.previousView ?? { type: "chat" } as ActiveView;
314
- sidebarStore.setState(function (s) {
315
- return {
316
- ...s,
317
- sidebarMode: "project",
318
- activeView: restored,
319
- previousView: null,
320
- };
321
- });
322
- pushUrl(state.activeProjectSlug);
323
- }
324
-
325
- export function goToProjectDashboard(): void {
326
- sidebarStore.setState(function (state) {
327
- return {
328
- ...state,
329
- activeSessionId: null,
330
- sidebarMode: "project",
331
- activeView: { type: "project-dashboard" },
332
- userMenuOpen: false,
333
- projectDropdownOpen: false,
334
- };
335
- });
336
- const state = sidebarStore.state;
337
- let path = "/";
338
- if (state.activeProjectSlug) {
339
- path = "/" + state.activeProjectSlug;
340
- }
341
- if (window.location.pathname + window.location.search !== path) {
342
- window.history.pushState(null, "", path);
343
- }
344
- lastEncodedUrl = "";
345
- }
346
-
347
- export function goToDashboard(): void {
348
- let prevSlug = sidebarStore.state.activeProjectSlug;
349
- sidebarStore.setState(function (state) {
350
- return {
351
- ...state,
352
- activeProjectSlug: null,
353
- activeSessionId: null,
354
- sidebarMode: "project",
355
- activeView: { type: "dashboard" },
356
- userMenuOpen: false,
357
- projectDropdownOpen: false,
358
- };
359
- });
360
- if (window.location.pathname + window.location.search !== "/") {
361
- window.history.pushState(null, "", "/");
362
- }
363
- switchProjectWorkspace(prevSlug, null);
364
- lastEncodedUrl = "";
365
- }
366
-
367
- export function goToAnalytics(): void {
368
- setAnalyticsScope("global");
369
- sidebarStore.setState(function (state) {
370
- return { ...state, activeView: { type: "analytics" } };
371
- });
372
- pushUrl(sidebarStore.state.activeProjectSlug);
373
- }
374
-
375
- export function handlePopState(): void {
376
- const path = window.location.pathname;
377
- const parts = path.split("/").filter(function (p) { return p.length > 0; });
378
- const searchParams = new URLSearchParams(window.location.search);
379
- const tParam = searchParams.get("t");
380
-
381
- if (parts[0] === "settings") {
382
- const section = (parts[1] || "appearance") as SettingsSection;
383
- sidebarStore.setState(function (state) {
384
- return {
385
- ...state,
386
- sidebarMode: "settings",
387
- activeView: { type: "settings", section: section },
388
- userMenuOpen: false,
389
- projectDropdownOpen: false,
390
- };
391
- });
392
- return;
393
- }
394
-
395
- if (parts.length >= 2 && parts[1] === "settings") {
396
- const projectSettingsSection = (parts[2] || "general") as ProjectSettingsSection;
397
- sidebarStore.setState(function (state) {
398
- return {
399
- ...state,
400
- activeProjectSlug: parts[0],
401
- sidebarMode: "settings",
402
- activeView: { type: "project-settings", section: projectSettingsSection },
403
- userMenuOpen: false,
404
- projectDropdownOpen: false,
405
- };
406
- });
407
- return;
408
- }
409
-
410
- const projectSlug = parts.length > 0 ? parts[0] : null;
411
-
412
- if (tParam && projectSlug) {
413
- const decoded = decodeWorkspaceUrl(tParam, projectSlug, resolveFullIdFromNothing);
414
- restoreWorkspace(decoded);
415
- lastEncodedUrl = tParam;
416
-
417
- let sessionId: string | null = null;
418
- const activePane = decoded.panes.find(function (p) { return p.id === decoded.activePaneId; });
419
- if (activePane) {
420
- const activeTab = decoded.tabs.find(function (t) { return t.id === activePane.activeTabId; });
421
- if (activeTab && activeTab.type === "chat" && activeTab.sessionId) {
422
- sessionId = activeTab.sessionId;
423
- }
424
- }
425
-
426
- sidebarStore.setState(function (state) {
427
- return {
428
- ...state,
429
- activeProjectSlug: projectSlug,
430
- activeSessionId: sessionId,
431
- sidebarMode: "project",
432
- activeView: sessionId || decoded.tabs.length > 0 ? { type: "chat" } : { type: "project-dashboard" },
433
- userMenuOpen: false,
434
- projectDropdownOpen: false,
435
- };
436
- });
437
- return;
438
- }
439
-
440
- sidebarStore.setState(function (state) {
441
- return {
442
- ...state,
443
- activeProjectSlug: projectSlug,
444
- activeSessionId: null,
445
- sidebarMode: "project",
446
- activeView: projectSlug ? { type: "project-dashboard" } : { type: "dashboard" },
447
- userMenuOpen: false,
448
- projectDropdownOpen: false,
449
- };
450
- });
451
- lastEncodedUrl = "";
452
- }
453
-
454
- export function toggleUserMenu(): void {
455
- sidebarStore.setState(function (state) {
456
- return {
457
- ...state,
458
- userMenuOpen: !state.userMenuOpen,
459
- projectDropdownOpen: false,
460
- };
461
- });
462
- }
463
-
464
- export function toggleProjectDropdown(): void {
465
- sidebarStore.setState(function (state) {
466
- return {
467
- ...state,
468
- projectDropdownOpen: !state.projectDropdownOpen,
469
- userMenuOpen: false,
470
- };
471
- });
472
- }
473
-
474
- export function closeMenus(): void {
475
- sidebarStore.setState(function (state) {
476
- return {
477
- ...state,
478
- userMenuOpen: false,
479
- projectDropdownOpen: false,
480
- };
481
- });
482
- }
483
-
484
- export function toggleDrawer(): void {
485
- sidebarStore.setState(function (state) {
486
- return { ...state, drawerOpen: !state.drawerOpen };
487
- });
488
- }
489
-
490
- export function closeDrawer(): void {
491
- sidebarStore.setState(function (state) {
492
- return { ...state, drawerOpen: false };
493
- });
494
- }
495
-
496
- export function openNodeSettings(): void {
497
- sidebarStore.setState(function (state) {
498
- return { ...state, nodeSettingsOpen: true, userMenuOpen: false };
499
- });
500
- }
501
-
502
- export function closeNodeSettings(): void {
503
- sidebarStore.setState(function (state) {
504
- return { ...state, nodeSettingsOpen: false };
505
- });
506
- }
507
-
508
- export function openAddProject(): void {
509
- sidebarStore.setState(function (state) {
510
- return { ...state, addProjectOpen: true };
511
- });
512
- }
513
-
514
- export function closeAddProject(): void {
515
- sidebarStore.setState(function (state) {
516
- return { ...state, addProjectOpen: false };
517
- });
518
- }
519
-
520
- export function openConfirmRemove(slug: string): void {
521
- sidebarStore.setState(function (state) {
522
- return { ...state, confirmRemoveSlug: slug };
523
- });
524
- }
525
-
526
- export function closeConfirmRemove(): void {
527
- sidebarStore.setState(function (state) {
528
- return { ...state, confirmRemoveSlug: null };
529
- });
530
- }
@@ -1,44 +0,0 @@
1
- import { Store } from "@tanstack/react-store";
2
-
3
- export interface ThemeState {
4
- mode: "dark" | "light";
5
- darkThemeId: string;
6
- lightThemeId: string;
7
- }
8
-
9
- function loadInitialState(): ThemeState {
10
- var mode = localStorage.getItem("lattice-theme-mode");
11
- var darkThemeId = localStorage.getItem("lattice-theme-dark");
12
- var lightThemeId = localStorage.getItem("lattice-theme-light");
13
-
14
- return {
15
- mode: mode === "light" ? "light" : "dark",
16
- darkThemeId: darkThemeId ?? "dracula",
17
- lightThemeId: lightThemeId ?? "ayu-light",
18
- };
19
- }
20
-
21
- var themeStore = new Store<ThemeState>(loadInitialState());
22
-
23
- export function getThemeStore(): Store<ThemeState> {
24
- return themeStore;
25
- }
26
-
27
- export function toggleMode(): void {
28
- themeStore.setState(function (state) {
29
- var next: ThemeState["mode"] = state.mode === "dark" ? "light" : "dark";
30
- localStorage.setItem("lattice-theme-mode", next);
31
- return { ...state, mode: next };
32
- });
33
- }
34
-
35
- export function setThemeForMode(themeId: string): void {
36
- themeStore.setState(function (state) {
37
- if (state.mode === "dark") {
38
- localStorage.setItem("lattice-theme-dark", themeId);
39
- return { ...state, darkThemeId: themeId };
40
- }
41
- localStorage.setItem("lattice-theme-light", themeId);
42
- return { ...state, lightThemeId: themeId };
43
- });
44
- }