2026-02-24 23:41:54 +01:00
import { useMemo } from 'react'
feat: vault-native theming system with live reload (#154)
* feat: add theming system design file with 3 frames
Design frames for Settings > Appearance panel, Command Palette
theme switching, and live theme editing flow visualization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add Rust backend for vault-native theming system
Theme files live in _themes/*.json with colors, typography, and spacing
sections. Vault-level settings (.laputa/settings.json) store the active
theme. Built-in themes (default, dark, minimal) are seeded on vault
creation. All 6 Tauri commands registered: list_themes, get_theme,
get_vault_settings, save_vault_settings, set_active_theme, create_theme.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add frontend theme engine, settings UI, and command palette integration
Wire up useThemeManager hook to load themes via Tauri IPC, apply CSS
custom properties to :root, and support switching/creating themes.
Add Appearance section to Settings panel with color swatches and theme
cards. Register theme switch and create commands in the command registry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use .to_string() instead of format! for string literal (clippy)
* style: cargo fmt on theme.rs
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:05:14 +01:00
import type { SidebarSelection , ThemeFile , VaultEntry } from '../types'
2026-02-24 23:41:54 +01:00
import type { ViewMode } from './useViewMode'
feat: vault-native theming system with live reload (#154)
* feat: add theming system design file with 3 frames
Design frames for Settings > Appearance panel, Command Palette
theme switching, and live theme editing flow visualization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add Rust backend for vault-native theming system
Theme files live in _themes/*.json with colors, typography, and spacing
sections. Vault-level settings (.laputa/settings.json) store the active
theme. Built-in themes (default, dark, minimal) are seeded on vault
creation. All 6 Tauri commands registered: list_themes, get_theme,
get_vault_settings, save_vault_settings, set_active_theme, create_theme.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add frontend theme engine, settings UI, and command palette integration
Wire up useThemeManager hook to load themes via Tauri IPC, apply CSS
custom properties to :root, and support switching/creating themes.
Add Appearance section to Settings panel with color swatches and theme
cards. Register theme switch and create commands in the command registry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use .to_string() instead of format! for string literal (clippy)
* style: cargo fmt on theme.rs
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:05:14 +01:00
export type CommandGroup = 'Navigation' | 'Note' | 'Git' | 'View' | 'Appearance' | 'Settings'
2026-02-24 23:41:54 +01:00
export interface CommandAction {
id : string
label : string
group : CommandGroup
shortcut? : string
keywords? : string [ ]
enabled : boolean
execute : ( ) = > void
}
interface CommandRegistryConfig {
activeTabPath : string | null
entries : VaultEntry [ ]
modifiedCount : number
2026-03-04 13:11:58 +01:00
mcpStatus? : string
onInstallMcp ? : ( ) = > void
2026-03-07 01:14:12 +01:00
onReindexVault ? : ( ) = > void
2026-02-24 23:41:54 +01:00
onQuickOpen : ( ) = > void
onCreateNote : ( ) = > void
2026-02-28 19:13:29 +01:00
onCreateNoteOfType : ( type : string ) = > void
2026-02-24 23:41:54 +01:00
onSave : ( ) = > void
onOpenSettings : ( ) = > void
2026-03-01 16:04:51 +01:00
onOpenVault ? : ( ) = > void
2026-03-03 00:31:10 +01:00
onCreateType ? : ( ) = > void
2026-02-24 23:41:54 +01:00
onTrashNote : ( path : string ) = > void
2026-03-02 11:55:51 +01:00
onRestoreNote : ( path : string ) = > void
2026-02-24 23:41:54 +01:00
onArchiveNote : ( path : string ) = > void
onUnarchiveNote : ( path : string ) = > void
onCommitPush : ( ) = > void
2026-03-03 02:27:42 +01:00
onResolveConflicts ? : ( ) = > void
2026-02-24 23:41:54 +01:00
onSetViewMode : ( mode : ViewMode ) = > void
onToggleInspector : ( ) = > void
2026-03-03 02:00:48 +01:00
onToggleDiff ? : ( ) = > void
2026-03-02 18:38:25 +01:00
onToggleRawEditor ? : ( ) = > void
2026-03-02 05:00:29 +01:00
onToggleAIChat ? : ( ) = > void
2026-03-03 02:00:48 +01:00
activeNoteModified : boolean
2026-03-02 23:48:01 +01:00
onCheckForUpdates ? : ( ) = > void
2026-02-28 12:41:57 +01:00
onZoomIn : ( ) = > void
onZoomOut : ( ) = > void
onZoomReset : ( ) = > void
zoomLevel : number
2026-02-24 23:41:54 +01:00
onSelect : ( sel : SidebarSelection ) = > void
2026-03-02 03:08:15 +01:00
onOpenDailyNote : ( ) = > void
2026-02-24 23:41:54 +01:00
onCloseTab : ( path : string ) = > void
2026-02-25 19:39:12 +01:00
onGoBack ? : ( ) = > void
onGoForward ? : ( ) = > void
canGoBack? : boolean
canGoForward? : boolean
feat: vault-native theming system with live reload (#154)
* feat: add theming system design file with 3 frames
Design frames for Settings > Appearance panel, Command Palette
theme switching, and live theme editing flow visualization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add Rust backend for vault-native theming system
Theme files live in _themes/*.json with colors, typography, and spacing
sections. Vault-level settings (.laputa/settings.json) store the active
theme. Built-in themes (default, dark, minimal) are seeded on vault
creation. All 6 Tauri commands registered: list_themes, get_theme,
get_vault_settings, save_vault_settings, set_active_theme, create_theme.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add frontend theme engine, settings UI, and command palette integration
Wire up useThemeManager hook to load themes via Tauri IPC, apply CSS
custom properties to :root, and support switching/creating themes.
Add Appearance section to Settings panel with color swatches and theme
cards. Register theme switch and create commands in the command registry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use .to_string() instead of format! for string literal (clippy)
* style: cargo fmt on theme.rs
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:05:14 +01:00
themes? : ThemeFile [ ]
activeThemeId? : string | null
onSwitchTheme ? : ( themeId : string ) = > void
onCreateTheme ? : ( ) = > void
2026-03-02 21:05:20 +01:00
onOpenTheme ? : ( themeId : string ) = > void
2026-03-03 02:26:41 +01:00
onRemoveActiveVault ? : ( ) = > void
onRestoreGettingStarted ? : ( ) = > void
2026-03-05 11:18:53 +01:00
onRestoreDefaultThemes ? : ( ) = > void
2026-03-03 02:26:41 +01:00
isGettingStartedHidden? : boolean
vaultCount? : number
2026-02-24 23:41:54 +01:00
}
2026-02-28 19:13:29 +01:00
const PLURAL_OVERRIDES : Record < string , string > = {
Person : 'People' ,
Responsibility : 'Responsibilities' ,
}
const DEFAULT_TYPES = [ 'Event' , 'Person' , 'Project' , 'Note' ]
export function pluralizeType ( type : string ) : string {
if ( PLURAL_OVERRIDES [ type ] ) return PLURAL_OVERRIDES [ type ]
if ( type . endsWith ( 's' ) || type . endsWith ( 'x' ) || type . endsWith ( 'ch' ) || type . endsWith ( 'sh' ) ) return ` ${ type } es `
if ( type . endsWith ( 'y' ) && ! /[aeiou]y$/i . test ( type ) ) return ` ${ type . slice ( 0 , - 1 ) } ies `
return ` ${ type } s `
}
export function extractVaultTypes ( entries : VaultEntry [ ] ) : string [ ] {
const typeSet = new Set < string > ( )
for ( const e of entries ) {
if ( e . isA && e . isA !== 'Type' && ! e . trashed ) typeSet . add ( e . isA )
}
if ( typeSet . size === 0 ) return DEFAULT_TYPES
return Array . from ( typeSet ) . sort ( )
}
feat: vault-native theming system with live reload (#154)
* feat: add theming system design file with 3 frames
Design frames for Settings > Appearance panel, Command Palette
theme switching, and live theme editing flow visualization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add Rust backend for vault-native theming system
Theme files live in _themes/*.json with colors, typography, and spacing
sections. Vault-level settings (.laputa/settings.json) store the active
theme. Built-in themes (default, dark, minimal) are seeded on vault
creation. All 6 Tauri commands registered: list_themes, get_theme,
get_vault_settings, save_vault_settings, set_active_theme, create_theme.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add frontend theme engine, settings UI, and command palette integration
Wire up useThemeManager hook to load themes via Tauri IPC, apply CSS
custom properties to :root, and support switching/creating themes.
Add Appearance section to Settings panel with color swatches and theme
cards. Register theme switch and create commands in the command registry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use .to_string() instead of format! for string literal (clippy)
* style: cargo fmt on theme.rs
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:05:14 +01:00
const GROUP_ORDER : CommandGroup [ ] = [ 'Navigation' , 'Note' , 'Git' , 'View' , 'Appearance' , 'Settings' ]
2026-02-24 23:41:54 +01:00
export function groupSortKey ( group : CommandGroup ) : number {
return GROUP_ORDER . indexOf ( group )
}
2026-02-28 19:13:29 +01:00
export function buildTypeCommands (
types : string [ ] ,
onCreateNoteOfType : ( type : string ) = > void ,
onSelect : ( sel : SidebarSelection ) = > void ,
) : CommandAction [ ] {
return types . flatMap ( ( type ) = > {
const slug = type . toLowerCase ( ) . replace ( /\s+/g , '-' )
const plural = pluralizeType ( type )
return [
{
id : ` new- ${ slug } ` , label : ` New ${ type } ` , group : 'Note' as CommandGroup ,
keywords : [ 'new' , 'create' , type . toLowerCase ( ) ] ,
enabled : true , execute : ( ) = > onCreateNoteOfType ( type ) ,
} ,
{
id : ` list- ${ slug } ` , label : ` List ${ plural } ` , group : 'Navigation' as CommandGroup ,
keywords : [ 'list' , 'show' , 'filter' , type . toLowerCase ( ) , plural . toLowerCase ( ) ] ,
enabled : true , execute : ( ) = > onSelect ( { kind : 'sectionGroup' , type } ) ,
} ,
]
} )
}
2026-03-02 18:38:25 +01:00
export function buildViewCommands (
hasActiveNote : boolean ,
2026-03-03 02:00:48 +01:00
activeNoteModified : boolean ,
2026-03-02 18:38:25 +01:00
onSetViewMode : ( mode : ViewMode ) = > void ,
onToggleInspector : ( ) = > void ,
2026-03-03 02:00:48 +01:00
onToggleDiff : ( ( ) = > void ) | undefined ,
2026-03-02 18:38:25 +01:00
onToggleRawEditor : ( ( ) = > void ) | undefined ,
onToggleAIChat : ( ( ) = > void ) | undefined ,
zoomLevel : number ,
onZoomIn : ( ) = > void ,
onZoomOut : ( ) = > void ,
onZoomReset : ( ) = > void ,
) : CommandAction [ ] {
return [
{ id : 'view-editor' , label : 'Editor Only' , group : 'View' , shortcut : '⌘1' , keywords : [ 'layout' , 'focus' ] , enabled : true , execute : ( ) = > onSetViewMode ( 'editor-only' ) } ,
{ id : 'view-editor-list' , label : 'Editor + Note List' , group : 'View' , shortcut : '⌘2' , keywords : [ 'layout' ] , enabled : true , execute : ( ) = > onSetViewMode ( 'editor-list' ) } ,
{ id : 'view-all' , label : 'Full Layout' , group : 'View' , shortcut : '⌘3' , keywords : [ 'layout' , 'sidebar' ] , enabled : true , execute : ( ) = > onSetViewMode ( 'all' ) } ,
2026-03-03 02:00:48 +01:00
{ id : 'toggle-inspector' , label : 'Toggle Properties Panel' , group : 'View' , keywords : [ 'properties' , 'inspector' , 'panel' , 'right' , 'sidebar' ] , enabled : true , execute : onToggleInspector } ,
{ id : 'toggle-diff' , label : 'Toggle Diff Mode' , group : 'View' , keywords : [ 'diff' , 'changes' , 'git' , 'compare' , 'version' ] , enabled : hasActiveNote && activeNoteModified , execute : ( ) = > onToggleDiff ? . ( ) } ,
2026-03-02 18:38:25 +01:00
{ id : 'toggle-raw-editor' , label : 'Toggle Raw Editor' , group : 'View' , keywords : [ 'raw' , 'source' , 'markdown' , 'frontmatter' , 'code' , 'textarea' ] , enabled : hasActiveNote , execute : ( ) = > onToggleRawEditor ? . ( ) } ,
{ id : 'toggle-ai-chat' , label : 'Toggle AI Chat' , group : 'View' , shortcut : '⌘I' , keywords : [ 'ai' , 'agent' , 'chat' , 'assistant' , 'contextual' ] , enabled : true , execute : ( ) = > onToggleAIChat ? . ( ) } ,
2026-03-03 02:00:48 +01:00
{ id : 'toggle-backlinks' , label : 'Toggle Backlinks' , group : 'View' , keywords : [ 'backlinks' , 'references' , 'links' , 'mentions' , 'incoming' ] , enabled : hasActiveNote , execute : onToggleInspector } ,
2026-03-02 18:38:25 +01:00
{ id : 'zoom-in' , label : ` Zoom In ( ${ zoomLevel } %) ` , group : 'View' , shortcut : '⌘=' , keywords : [ 'zoom' , 'bigger' , 'larger' , 'scale' ] , enabled : zoomLevel < 150 , execute : onZoomIn } ,
{ id : 'zoom-out' , label : ` Zoom Out ( ${ zoomLevel } %) ` , group : 'View' , shortcut : '⌘-' , keywords : [ 'zoom' , 'smaller' , 'scale' ] , enabled : zoomLevel > 80 , execute : onZoomOut } ,
{ id : 'zoom-reset' , label : 'Reset Zoom' , group : 'View' , shortcut : '⌘0' , keywords : [ 'zoom' , 'actual' , 'default' , '100' ] , enabled : zoomLevel !== 100 , execute : onZoomReset } ,
]
}
feat: vault-native theming system with live reload (#154)
* feat: add theming system design file with 3 frames
Design frames for Settings > Appearance panel, Command Palette
theme switching, and live theme editing flow visualization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add Rust backend for vault-native theming system
Theme files live in _themes/*.json with colors, typography, and spacing
sections. Vault-level settings (.laputa/settings.json) store the active
theme. Built-in themes (default, dark, minimal) are seeded on vault
creation. All 6 Tauri commands registered: list_themes, get_theme,
get_vault_settings, save_vault_settings, set_active_theme, create_theme.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add frontend theme engine, settings UI, and command palette integration
Wire up useThemeManager hook to load themes via Tauri IPC, apply CSS
custom properties to :root, and support switching/creating themes.
Add Appearance section to Settings panel with color swatches and theme
cards. Register theme switch and create commands in the command registry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use .to_string() instead of format! for string literal (clippy)
* style: cargo fmt on theme.rs
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:05:14 +01:00
export function buildThemeCommands (
themes : ThemeFile [ ] | undefined ,
activeThemeId : string | null | undefined ,
onSwitchTheme : ( ( themeId : string ) = > void ) | undefined ,
onCreateTheme : ( ( ) = > void ) | undefined ,
2026-03-02 21:05:20 +01:00
onOpenTheme : ( ( themeId : string ) = > void ) | undefined ,
feat: vault-native theming system with live reload (#154)
* feat: add theming system design file with 3 frames
Design frames for Settings > Appearance panel, Command Palette
theme switching, and live theme editing flow visualization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add Rust backend for vault-native theming system
Theme files live in _themes/*.json with colors, typography, and spacing
sections. Vault-level settings (.laputa/settings.json) store the active
theme. Built-in themes (default, dark, minimal) are seeded on vault
creation. All 6 Tauri commands registered: list_themes, get_theme,
get_vault_settings, save_vault_settings, set_active_theme, create_theme.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add frontend theme engine, settings UI, and command palette integration
Wire up useThemeManager hook to load themes via Tauri IPC, apply CSS
custom properties to :root, and support switching/creating themes.
Add Appearance section to Settings panel with color swatches and theme
cards. Register theme switch and create commands in the command registry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use .to_string() instead of format! for string literal (clippy)
* style: cargo fmt on theme.rs
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:05:14 +01:00
) : CommandAction [ ] {
2026-03-02 21:05:20 +01:00
const cmds : CommandAction [ ] = [ ]
for ( const t of ( themes ? ? [ ] ) ) {
cmds . push ( {
id : ` switch-theme- ${ t . id } ` ,
label : ` Switch to ${ t . name } Theme ` ,
group : 'Appearance' as CommandGroup ,
keywords : [ 'theme' , 'appearance' , 'color' , t . name . toLowerCase ( ) ] ,
enabled : t.id !== activeThemeId ,
execute : ( ) = > onSwitchTheme ? . ( t . id ) ,
} )
if ( onOpenTheme ) {
cmds . push ( {
id : ` open-theme- ${ t . id } ` ,
label : ` Edit ${ t . name } Theme ` ,
group : 'Appearance' as CommandGroup ,
keywords : [ 'theme' , 'edit' , 'open' , 'appearance' , t . name . toLowerCase ( ) ] ,
enabled : true ,
execute : ( ) = > onOpenTheme ( t . id ) ,
} )
}
}
feat: vault-native theming system with live reload (#154)
* feat: add theming system design file with 3 frames
Design frames for Settings > Appearance panel, Command Palette
theme switching, and live theme editing flow visualization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add Rust backend for vault-native theming system
Theme files live in _themes/*.json with colors, typography, and spacing
sections. Vault-level settings (.laputa/settings.json) store the active
theme. Built-in themes (default, dark, minimal) are seeded on vault
creation. All 6 Tauri commands registered: list_themes, get_theme,
get_vault_settings, save_vault_settings, set_active_theme, create_theme.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add frontend theme engine, settings UI, and command palette integration
Wire up useThemeManager hook to load themes via Tauri IPC, apply CSS
custom properties to :root, and support switching/creating themes.
Add Appearance section to Settings panel with color swatches and theme
cards. Register theme switch and create commands in the command registry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use .to_string() instead of format! for string literal (clippy)
* style: cargo fmt on theme.rs
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:05:14 +01:00
if ( onCreateTheme ) {
2026-03-02 21:05:20 +01:00
cmds . push ( {
feat: vault-native theming system with live reload (#154)
* feat: add theming system design file with 3 frames
Design frames for Settings > Appearance panel, Command Palette
theme switching, and live theme editing flow visualization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add Rust backend for vault-native theming system
Theme files live in _themes/*.json with colors, typography, and spacing
sections. Vault-level settings (.laputa/settings.json) store the active
theme. Built-in themes (default, dark, minimal) are seeded on vault
creation. All 6 Tauri commands registered: list_themes, get_theme,
get_vault_settings, save_vault_settings, set_active_theme, create_theme.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add frontend theme engine, settings UI, and command palette integration
Wire up useThemeManager hook to load themes via Tauri IPC, apply CSS
custom properties to :root, and support switching/creating themes.
Add Appearance section to Settings panel with color swatches and theme
cards. Register theme switch and create commands in the command registry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use .to_string() instead of format! for string literal (clippy)
* style: cargo fmt on theme.rs
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:05:14 +01:00
id : 'new-theme' , label : 'New Theme' , group : 'Appearance' as CommandGroup ,
keywords : [ 'theme' , 'create' , 'appearance' ] , enabled : true , execute : onCreateTheme ,
} )
}
2026-03-02 21:05:20 +01:00
return cmds
feat: vault-native theming system with live reload (#154)
* feat: add theming system design file with 3 frames
Design frames for Settings > Appearance panel, Command Palette
theme switching, and live theme editing flow visualization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add Rust backend for vault-native theming system
Theme files live in _themes/*.json with colors, typography, and spacing
sections. Vault-level settings (.laputa/settings.json) store the active
theme. Built-in themes (default, dark, minimal) are seeded on vault
creation. All 6 Tauri commands registered: list_themes, get_theme,
get_vault_settings, save_vault_settings, set_active_theme, create_theme.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add frontend theme engine, settings UI, and command palette integration
Wire up useThemeManager hook to load themes via Tauri IPC, apply CSS
custom properties to :root, and support switching/creating themes.
Add Appearance section to Settings panel with color swatches and theme
cards. Register theme switch and create commands in the command registry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use .to_string() instead of format! for string literal (clippy)
* style: cargo fmt on theme.rs
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:05:14 +01:00
}
2026-02-24 23:41:54 +01:00
export function useCommandRegistry ( config : CommandRegistryConfig ) : CommandAction [ ] {
const {
2026-03-05 18:18:52 +01:00
activeTabPath , entries , modifiedCount ,
2026-02-28 19:13:29 +01:00
onQuickOpen , onCreateNote , onCreateNoteOfType , onSave , onOpenSettings ,
2026-03-02 11:55:51 +01:00
onTrashNote , onRestoreNote , onArchiveNote , onUnarchiveNote ,
2026-03-03 02:27:42 +01:00
onCommitPush , onResolveConflicts , onSetViewMode , onToggleInspector , onToggleDiff , onToggleRawEditor , onToggleAIChat , onOpenVault ,
2026-03-03 02:00:48 +01:00
activeNoteModified ,
2026-02-28 12:41:57 +01:00
onZoomIn , onZoomOut , onZoomReset , zoomLevel ,
2026-03-02 03:08:15 +01:00
onSelect , onOpenDailyNote , onCloseTab ,
2026-02-25 19:39:12 +01:00
onGoBack , onGoForward , canGoBack , canGoForward ,
2026-03-02 21:05:20 +01:00
themes , activeThemeId , onSwitchTheme , onCreateTheme , onOpenTheme ,
2026-03-03 16:46:47 +01:00
onCheckForUpdates ,
2026-03-03 00:31:10 +01:00
onCreateType ,
2026-03-05 11:18:53 +01:00
onRemoveActiveVault , onRestoreGettingStarted , onRestoreDefaultThemes , isGettingStartedHidden , vaultCount ,
2026-03-04 13:11:58 +01:00
mcpStatus , onInstallMcp ,
2026-03-07 01:14:12 +01:00
onReindexVault ,
2026-02-24 23:41:54 +01:00
} = config
const hasActiveNote = activeTabPath !== null
const activeEntry = useMemo (
( ) = > ( hasActiveNote ? entries . find ( e = > e . path === activeTabPath ) : undefined ) ,
[ entries , activeTabPath , hasActiveNote ] ,
)
const isArchived = activeEntry ? . archived ? ? false
2026-03-02 11:55:51 +01:00
const isTrashed = activeEntry ? . trashed ? ? false
2026-02-24 23:41:54 +01:00
2026-02-28 19:13:29 +01:00
const vaultTypes = useMemo ( ( ) = > extractVaultTypes ( entries ) , [ entries ] )
2026-02-24 23:41:54 +01:00
return useMemo ( ( ) = > {
const cmds : CommandAction [ ] = [
// Navigation
{ id : 'search-notes' , label : 'Search Notes' , group : 'Navigation' , shortcut : '⌘P' , keywords : [ 'find' , 'open' , 'quick' ] , enabled : true , execute : onQuickOpen } ,
{ id : 'go-all' , label : 'Go to All Notes' , group : 'Navigation' , keywords : [ 'filter' ] , enabled : true , execute : ( ) = > onSelect ( { kind : 'filter' , filter : 'all' } ) } ,
{ id : 'go-archived' , label : 'Go to Archived' , group : 'Navigation' , keywords : [ ] , enabled : true , execute : ( ) = > onSelect ( { kind : 'filter' , filter : 'archived' } ) } ,
{ id : 'go-trash' , label : 'Go to Trash' , group : 'Navigation' , keywords : [ 'deleted' ] , enabled : true , execute : ( ) = > onSelect ( { kind : 'filter' , filter : 'trash' } ) } ,
{ id : 'go-changes' , label : 'Go to Changes' , group : 'Navigation' , keywords : [ 'git' , 'modified' , 'pending' ] , enabled : true , execute : ( ) = > onSelect ( { kind : 'filter' , filter : 'changes' } ) } ,
2026-03-05 16:27:29 +01:00
{ id : 'go-pulse' , label : 'Go to Pulse' , group : 'Navigation' , keywords : [ 'activity' , 'history' , 'commits' , 'git' , 'feed' ] , enabled : true , execute : ( ) = > onSelect ( { kind : 'filter' , filter : 'pulse' } ) } ,
2026-02-25 19:39:12 +01:00
{ id : 'go-back' , label : 'Go Back' , group : 'Navigation' , shortcut : '⌘[' , keywords : [ 'previous' , 'history' , 'back' ] , enabled : ! ! canGoBack , execute : ( ) = > onGoBack ? . ( ) } ,
{ id : 'go-forward' , label : 'Go Forward' , group : 'Navigation' , shortcut : '⌘]' , keywords : [ 'next' , 'history' , 'forward' ] , enabled : ! ! canGoForward , execute : ( ) = > onGoForward ? . ( ) } ,
2026-02-24 23:41:54 +01:00
// Note actions (contextual)
{ id : 'create-note' , label : 'Create New Note' , group : 'Note' , shortcut : '⌘N' , keywords : [ 'new' , 'add' ] , enabled : true , execute : onCreateNote } ,
2026-03-03 00:31:10 +01:00
{ id : 'create-type' , label : 'New Type' , group : 'Note' , keywords : [ 'new' , 'create' , 'type' , 'template' ] , enabled : ! ! onCreateType , execute : ( ) = > onCreateType ? . ( ) } ,
2026-03-02 03:08:15 +01:00
{ id : 'open-daily-note' , label : "Open Today's Note" , group : 'Note' , shortcut : '⌘J' , keywords : [ 'daily' , 'journal' , 'today' ] , enabled : true , execute : onOpenDailyNote } ,
2026-02-24 23:41:54 +01:00
{ id : 'save-note' , label : 'Save Note' , group : 'Note' , shortcut : '⌘S' , keywords : [ 'write' ] , enabled : hasActiveNote , execute : onSave } ,
{ id : 'close-tab' , label : 'Close Tab' , group : 'Note' , shortcut : '⌘W' , keywords : [ ] , enabled : hasActiveNote , execute : ( ) = > { if ( activeTabPath ) onCloseTab ( activeTabPath ) } } ,
2026-03-02 11:55:51 +01:00
{
id : 'trash-note' , label : isTrashed ? 'Restore Note' : 'Trash Note' , group : 'Note' , shortcut : '⌘⌫' ,
keywords : [ 'delete' , 'remove' , 'restore' , 'trash' ] , enabled : hasActiveNote ,
execute : ( ) = > { if ( activeTabPath ) ( isTrashed ? onRestoreNote : onTrashNote ) ( activeTabPath ) } ,
} ,
2026-02-24 23:41:54 +01:00
{
id : 'archive-note' , label : isArchived ? 'Unarchive Note' : 'Archive Note' , group : 'Note' , shortcut : '⌘E' ,
keywords : [ 'archive' ] , enabled : hasActiveNote ,
execute : ( ) = > { if ( activeTabPath ) ( isArchived ? onUnarchiveNote : onArchiveNote ) ( activeTabPath ) } ,
} ,
// Git
{ id : 'commit-push' , label : 'Commit & Push' , group : 'Git' , keywords : [ 'git' , 'save' , 'sync' ] , enabled : modifiedCount > 0 , execute : onCommitPush } ,
2026-03-05 18:18:52 +01:00
{ id : 'resolve-conflicts' , label : 'Resolve Conflicts' , group : 'Git' , keywords : [ 'conflict' , 'merge' , 'git' , 'sync' ] , enabled : true , execute : ( ) = > onResolveConflicts ? . ( ) } ,
2026-02-24 23:41:54 +01:00
{ id : 'view-changes' , label : 'View Pending Changes' , group : 'Git' , keywords : [ 'modified' , 'diff' ] , enabled : true , execute : ( ) = > onSelect ( { kind : 'filter' , filter : 'changes' } ) } ,
// View
2026-03-03 02:00:48 +01:00
. . . buildViewCommands ( hasActiveNote , activeNoteModified , onSetViewMode , onToggleInspector , onToggleDiff , onToggleRawEditor , onToggleAIChat , zoomLevel , onZoomIn , onZoomOut , onZoomReset ) ,
2026-02-24 23:41:54 +01:00
feat: vault-native theming system with live reload (#154)
* feat: add theming system design file with 3 frames
Design frames for Settings > Appearance panel, Command Palette
theme switching, and live theme editing flow visualization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add Rust backend for vault-native theming system
Theme files live in _themes/*.json with colors, typography, and spacing
sections. Vault-level settings (.laputa/settings.json) store the active
theme. Built-in themes (default, dark, minimal) are seeded on vault
creation. All 6 Tauri commands registered: list_themes, get_theme,
get_vault_settings, save_vault_settings, set_active_theme, create_theme.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add frontend theme engine, settings UI, and command palette integration
Wire up useThemeManager hook to load themes via Tauri IPC, apply CSS
custom properties to :root, and support switching/creating themes.
Add Appearance section to Settings panel with color swatches and theme
cards. Register theme switch and create commands in the command registry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use .to_string() instead of format! for string literal (clippy)
* style: cargo fmt on theme.rs
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:05:14 +01:00
// Appearance
2026-03-02 21:05:20 +01:00
. . . buildThemeCommands ( themes , activeThemeId , onSwitchTheme , onCreateTheme , onOpenTheme ) ,
2026-03-05 12:30:38 +01:00
{ id : 'restore-default-themes' , label : 'Restore Default Themes' , group : 'Appearance' , keywords : [ 'theme' , 'reset' , 'restore' , 'default' , 'fix' , 'missing' ] , enabled : true , execute : ( ) = > onRestoreDefaultThemes ? . ( ) } ,
feat: vault-native theming system with live reload (#154)
* feat: add theming system design file with 3 frames
Design frames for Settings > Appearance panel, Command Palette
theme switching, and live theme editing flow visualization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add Rust backend for vault-native theming system
Theme files live in _themes/*.json with colors, typography, and spacing
sections. Vault-level settings (.laputa/settings.json) store the active
theme. Built-in themes (default, dark, minimal) are seeded on vault
creation. All 6 Tauri commands registered: list_themes, get_theme,
get_vault_settings, save_vault_settings, set_active_theme, create_theme.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add frontend theme engine, settings UI, and command palette integration
Wire up useThemeManager hook to load themes via Tauri IPC, apply CSS
custom properties to :root, and support switching/creating themes.
Add Appearance section to Settings panel with color swatches and theme
cards. Register theme switch and create commands in the command registry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use .to_string() instead of format! for string literal (clippy)
* style: cargo fmt on theme.rs
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:05:14 +01:00
2026-02-24 23:41:54 +01:00
// Settings
{ id : 'open-settings' , label : 'Open Settings' , group : 'Settings' , shortcut : '⌘,' , keywords : [ 'preferences' , 'config' ] , enabled : true , execute : onOpenSettings } ,
2026-03-01 16:04:51 +01:00
{ id : 'open-vault' , label : 'Open Vault…' , group : 'Settings' , keywords : [ 'vault' , 'folder' , 'switch' , 'open' , 'workspace' ] , enabled : true , execute : ( ) = > onOpenVault ? . ( ) } ,
2026-03-03 02:26:41 +01:00
{ id : 'remove-vault' , label : 'Remove Vault from List' , group : 'Settings' , keywords : [ 'vault' , 'remove' , 'disconnect' , 'hide' ] , enabled : ( vaultCount ? ? 0 ) > 1 && ! ! onRemoveActiveVault , execute : ( ) = > onRemoveActiveVault ? . ( ) } ,
{ id : 'restore-getting-started' , label : 'Restore Getting Started Vault' , group : 'Settings' , keywords : [ 'vault' , 'restore' , 'demo' , 'getting started' , 'reset' ] , enabled : ! ! isGettingStartedHidden && ! ! onRestoreGettingStarted , execute : ( ) = > onRestoreGettingStarted ? . ( ) } ,
2026-03-03 16:46:47 +01:00
{ id : 'check-updates' , label : 'Check for Updates' , group : 'Settings' , keywords : [ 'update' , 'version' , 'upgrade' , 'release' ] , enabled : true , execute : ( ) = > onCheckForUpdates ? . ( ) } ,
2026-03-07 11:33:18 +01:00
{ id : 'install-mcp' , label : mcpStatus === 'installed' ? 'Restore MCP Server' : 'Install MCP Server' , group : 'Settings' , keywords : [ 'mcp' , 'claude' , 'ai' , 'tools' , 'install' , 'restore' , 'fix' , 'repair' ] , enabled : mcpStatus !== 'checking' && ! ! onInstallMcp , execute : ( ) = > onInstallMcp ? . ( ) } ,
2026-03-07 01:14:12 +01:00
{ id : 'reindex-vault' , label : 'Reindex Vault' , group : 'Settings' , keywords : [ 'reindex' , 'index' , 'search' , 'rebuild' , 'refresh' ] , enabled : ! ! onReindexVault , execute : ( ) = > onReindexVault ? . ( ) } ,
2026-02-28 19:13:29 +01:00
// Type-aware: "New [Type]" and "List [Type]"
. . . buildTypeCommands ( vaultTypes , onCreateNoteOfType , onSelect ) ,
2026-02-24 23:41:54 +01:00
]
return cmds
} , [
2026-03-05 18:18:52 +01:00
hasActiveNote , activeTabPath , isArchived , isTrashed , modifiedCount , activeNoteModified ,
2026-03-03 00:31:10 +01:00
onQuickOpen , onCreateNote , onCreateNoteOfType , onCreateType , onSave , onOpenSettings ,
2026-03-02 11:55:51 +01:00
onTrashNote , onRestoreNote , onArchiveNote , onUnarchiveNote ,
2026-03-03 02:27:42 +01:00
onCommitPush , onResolveConflicts , onSetViewMode , onToggleInspector , onToggleDiff , onToggleRawEditor , onToggleAIChat , onOpenVault ,
2026-03-03 16:46:47 +01:00
onCheckForUpdates ,
2026-02-28 12:41:57 +01:00
onZoomIn , onZoomOut , onZoomReset , zoomLevel ,
2026-03-02 03:08:15 +01:00
onSelect , onOpenDailyNote , onCloseTab ,
2026-02-25 19:39:12 +01:00
onGoBack , onGoForward , canGoBack , canGoForward ,
2026-03-05 11:18:53 +01:00
vaultTypes , themes , activeThemeId , onSwitchTheme , onCreateTheme , onOpenTheme , onRestoreDefaultThemes ,
2026-03-03 02:48:10 +01:00
onRemoveActiveVault , onRestoreGettingStarted , isGettingStartedHidden , vaultCount ,
2026-03-04 13:11:58 +01:00
mcpStatus , onInstallMcp ,
2026-03-07 01:14:12 +01:00
onReindexVault ,
2026-02-24 23:41:54 +01:00
] )
}