Module Configuration
Module Name:skins.citizen.commandPalette
Dependencies:
mediawiki.apimediawiki.jqueryMsgmediawiki.languagemediawiki.page.readymediawiki.storagemediawiki.utilskins.citizen.commandPalette.codexvuepinia
CdxButtonCdxIconCdxSearchResultTitleCdxTextInputCdxThumbnail
resources/skins.citizen.commandPalette/init.js
Initialization
The command palette initializes automatically and registers itself with the search button:Architecture
Provider System
The command palette uses a provider-based architecture for extensibility: Provider Interface:- RecentItemsProvider - Recently visited pages
- CommandProvider - Slash commands (namespace, action, user)
- SearchProvider - Page search via MediaWiki API
- RelatedArticlesProvider - Related articles (if extension enabled)
- QueryActionProvider - Quick actions (full-text search, media search, page edit)
Store (Pinia)
Central state management using Pinia.useSearchStore
State:hasDisplayedItems- Whether any items existsearchUrl- Full search URL for current query
query(string) - New search query
result(CommandPaletteItem) - Selected item
itemId(string | number) - Item ID to remove
Vue Components
App.vue
Root component managing the command palette. Props: None Exposed Methods:open()- Opens the command paletteclose()- Closes the command palette
- Keyboard navigation (Arrow keys, Home, End)
- Enter to select
- Escape to close
- Arrow Right to focus actions
CommandPaletteHeader.vue
Search input header. Props:modelValue(string) - Current queryisPending(boolean) - Loading stateshowPending(boolean) - Show loading indicator
update:modelValue- Query changedclose- Close button clicked
CommandPaletteList.vue
Main results list. Props:items(Array<CommandPaletteItem>) - Items to displayhighlightedItemIndex(number) - Currently highlighted indexsearchQuery(string) - Current search querysetItemRef(Function) - Ref setter for items
select- Item selectedaction- Action button clickednavigate-list- Keyboard navigationfocus-action- Action focusedblur-actions- Action blurredhover- Item hovered
CommandPaletteListItem.vue
Individual list item. Props:item(CommandPaletteItem) - Item dataindex(number) - Item indexhighlighted(boolean) - Is highlightedsearchQuery(string) - Search query for highlighting
select- Item clickedaction- Action button clickedhover- Mouse hover
focusFirstButton()- Focus first action button
CommandPalettePresults.vue
Pre-search results (recent + related). Props: Same as CommandPaletteList Features:- Groups items by type (related, recent)
- Shows section headings
- Includes dismiss actions for recent items
CommandPaletteEmptyState.vue
Empty state display. Props:title(string) - Empty state titledescription(string) - Empty state descriptionicon(Object) - Codex icon object
CommandPaletteFooter.vue
Keyboard hints footer. Props:hasHighlightedItemWithActions(boolean)itemCount(number)highlightedItemType(string)isActionFocused(boolean)isFirstActionFocused(boolean)focusedActionIndex(number)actionCount(number)
Composables
useListNavigation
Handles keyboard navigation for lists. Parameters:navigableItems(Ref<Array>) - Items to navigateitemRefs(Ref<Map>) - Map of item refs
- ArrowUp - Previous item
- ArrowDown - Next item
- Home - First item
- End - Last item
useActionNavigation
Handles navigation between action buttons within an item. Parameters:actions(Ref<Array>) - Action buttonsemit(Function) - Vue emit function
- ArrowLeft - Previous action
- ArrowRight - Next action
- ArrowUp/Down - Return to list navigation
Providers Detail
SearchProvider
Searches MediaWiki pages. Location:providers/SearchProvider.js
CommandProvider
Handles slash commands. Commands:/nsor/namespace- Search by namespace/action- Trigger page actions/user- Search users
RecentItemsProvider
Manages recent items viaservices/recentItems.js.
Storage Key: skin-citizen-command-palette-recent-items
Methods:
RelatedArticlesProvider
Fetches related articles if RelatedArticles extension is installed. API: Uses MediaWiki Action APIquery+cirrusbuilddoc to get related pages.
QueryActionProvider
Provides quick actions for the current query. Actions:- Full-text search
- Media search (if MediaSearch extension enabled)
- Edit page (if query matches page name)
Search Clients
SearchClientFactory
Creates appropriate search client. Location:searchClients/SearchClientFactory.js
MwRestSearchClient
MediaWiki REST API search client. Methods: fetchByQuery(query) Searches pages by query. Parameters:query(string) - Search query
{ fetch: Promise, abort: Function }
Types
CommandPaletteItem
CommandPaletteAction
CommandPaletteActionResult
Configuration
Fromskin.json:
- wgCitizenEnableCommandPalette (boolean) - Enable command palette (default: true)
Keyboard Shortcuts
Global:- Click search button to open
- Escape - Close palette
- Arrow Up/Down - Navigate items
- Home/End - Jump to first/last item
- Enter - Select highlighted item
- Arrow Right - Focus item actions (if available)
- Arrow Left - Return to list from actions
- Type - Updates search query
Styling
Key CSS classes:.citizen-command-palette- Main container.citizen-command-palette-backdrop- Background overlay.citizen-command-palette__results- Results container.citizen-command-palette-list-item- Individual item.citizen-command-palette-list-item--highlighted- Highlighted item.citizen-command-palette-list-item__action- Action button
Extending the Command Palette
To add custom providers, register them in the providers array:Related Modules
- Search Module - Basic search typeahead
- Preferences - User preferences panel