lightweight, client-only calendar web application. All data persists in the URL hash for instant sharing, No backend required. Optional AES-GCM password protection keeps shared links locked without a server
JavaScript
feat: add command palette for quick navigation and event management
Supun Lakmal061b3e3ea282
diff --git a/index.html b/index.htmlindex 57417c9..c3fbd83 100644--- a/index.html+++ b/index.html@@ -290,6 +290,12 @@<div><h2 id="month-label" class="month-label">Month 2026</h2><div class="panel-actions">+ <button id="command-palette-btn" class="ghost command-palette-btn" type="button"+ aria-label="Open command palette" title="Open command palette (Ctrl/Cmd+K)"+ data-i18n-aria-label="command.openPaletteAria">+ <i class="fa-solid fa-terminal" aria-hidden="true"></i>+ <span data-i18n="command.shortcutHint">Ctrl/Cmd+K</span>+ </button><button id="mobile-sidebar-toggle" class="mobile-only" type="button" aria-label="Toggle details panels"><i class="fa-solid fa-list-ul"></i><span data-i18n="label.details">Details</span>@@ -297,6 +303,51 @@</div></div></div>+ <div id="event-filter-bar" class="event-filter-bar" aria-label="Event filters">+ <label class="event-filter-field event-filter-search" for="event-filter-query">+ <span class="sr-only" data-i18n="filter.searchLabel">Search events</span>+ <i class="fa-solid fa-magnifying-glass" aria-hidden="true"></i>+ <input id="event-filter-query" type="search" placeholder="Search title"+ data-i18n-placeholder="filter.searchPlaceholder" data-i18n-aria-label="filter.searchAriaLabel"+ aria-label="Search events by title">+ </label>+ <label class="event-filter-field" for="event-filter-start">+ <span data-i18n="filter.fromLabel">From</span>+ <input id="event-filter-start" type="date" data-i18n-aria-label="filter.fromAriaLabel"+ aria-label="Filter events from date">+ </label>+ <label class="event-filter-field" for="event-filter-end">+ <span data-i18n="filter.toLabel">To</span>+ <input id="event-filter-end" type="date" data-i18n-aria-label="filter.toAriaLabel"+ aria-label="Filter events to date">+ </label>+ <label class="event-filter-field" for="event-filter-recurrence">+ <span data-i18n="filter.recurrenceLabel">Recurrence</span>+ <select id="event-filter-recurrence" data-i18n-aria-label="filter.recurrenceAriaLabel"+ aria-label="Filter recurrence">+ <option value="" data-i18n="filter.anyRecurrence">Any</option>+ <option value="none" data-i18n="recurrence.none">None</option>+ <option value="d" data-i18n="recurrence.daily">Daily</option>+ <option value="w" data-i18n="recurrence.weekly">Weekly</option>+ <option value="m" data-i18n="recurrence.monthly">Monthly</option>+ <option value="y" data-i18n="recurrence.yearly">Yearly</option>+ </select>+ </label>+ <label class="event-filter-field" for="event-filter-color">+ <span data-i18n="filter.colorLabel">Color</span>+ <select id="event-filter-color" data-i18n-aria-label="filter.colorAriaLabel" aria-label="Filter color">+ <option value="" data-i18n="filter.anyColor">Any color</option>+ </select>+ </label>+ <label class="event-filter-field" for="event-filter-timezone">+ <span data-i18n="filter.timezoneLabel">Timezone</span>+ <select id="event-filter-timezone" data-i18n-aria-label="filter.timezoneAriaLabel"+ aria-label="Timezone context for date filter">+ <option value="" data-i18n="filter.localTimezone">Local timezone</option>+ </select>+ </label>+ <button id="event-filter-clear" type="button" class="ghost event-filter-clear" data-i18n="filter.clear">Clear</button>+ </div><div id="weekday-row" class="weekday-row"></div><div id="calendar-grid" class="calendar-grid" role="grid" aria-label="Calendar"></div><div id="timeline-controls" class="timeline-controls hidden" aria-label="Timeline controls">@@ -431,6 +482,31 @@</div></div>+ <div id="command-palette-modal" class="modal hidden" role="dialog" aria-modal="true"+ aria-labelledby="command-palette-title">+ <div class="modal-backdrop"></div>+ <div class="modal-card command-palette-card">+ <header class="modal-header command-palette-header">+ <h3 id="command-palette-title" class="sr-only" data-i18n="command.paletteTitle">Command palette</h3>+ <label class="command-palette-input-wrap" for="command-palette-input">+ <i class="fa-solid fa-magnifying-glass" aria-hidden="true"></i>+ <input id="command-palette-input" type="search" autocomplete="off"+ placeholder="Search commands and events"+ data-i18n-placeholder="command.searchPlaceholder"+ data-i18n-aria-label="command.searchAriaLabel"+ aria-label="Search commands and events">+ </label>+ <button id="command-palette-close" type="button" class="icon-btn" aria-label="Close"+ data-i18n-aria-label="label.close">x</button>+ </header>+ <div class="command-palette-body">+ <p id="command-palette-empty" class="command-palette-empty hidden" data-i18n="command.noResults">No matches</p>+ <ul id="command-palette-results" class="command-palette-results" role="listbox"+ aria-label="Command palette results"></ul>+ </div>+ </div>+ </div>+<div id="event-modal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="event-modal-title"><div class="modal-backdrop"></div><div class="modal-card">diff --git a/locales/en.js b/locales/en.jsindex ea7aedf..8f8ec1b 100644--- a/locales/en.js+++ b/locales/en.js@@ -14,6 +14,51 @@ export default {"view.agenda": "Agenda","view.timeline": "Timeline",+ // Command palette+ "command.openPaletteAria": "Open command palette",+ "command.shortcutHint": "Ctrl/Cmd+K",+ "command.paletteTitle": "Command palette",+ "command.searchPlaceholder": "Search commands and events",+ "command.searchAriaLabel": "Search commands and events",+ "command.noResults": "No matches",+ "command.groupViews": "View",+ "command.groupTools": "Tool",+ "command.groupActions": "Action",+ "command.actionAddEvent": "Add event",+ "command.actionViewDay": "Switch to Day view",+ "command.actionViewWeek": "Switch to Week view",+ "command.actionViewMonth": "Switch to Month view",+ "command.actionViewYear": "Switch to Year view",+ "command.actionViewAgenda": "Switch to Agenda view",+ "command.actionViewTimeline": "Switch to Timeline view",+ "command.actionWorldPlanner": "Open World Planner",+ "command.actionTimezone": "Add timezone",+ "command.actionEnterFocus": "Enter Focus mode",+ "command.actionExitFocus": "Exit Focus mode",+ "command.actionCopyLink": "Copy share link",+ "command.actionShareQr": "Open QR sharing",+ "command.actionOpenJson": "Open JSON view",++ // Event filters+ "filter.searchLabel": "Search events",+ "filter.searchPlaceholder": "Search title",+ "filter.searchAriaLabel": "Search events by title",+ "filter.fromLabel": "From",+ "filter.fromAriaLabel": "Filter events from date",+ "filter.toLabel": "To",+ "filter.toAriaLabel": "Filter events to date",+ "filter.recurrenceLabel": "Recurrence",+ "filter.recurrenceAriaLabel": "Filter recurrence",+ "filter.anyRecurrence": "Any",+ "filter.colorLabel": "Color",+ "filter.colorAriaLabel": "Filter color",+ "filter.anyColor": "Any color",+ "filter.colorOption": "Color {{index}} ({{color}})",+ "filter.timezoneLabel": "Timezone",+ "filter.timezoneAriaLabel": "Timezone context for date filter",+ "filter.localTimezone": "Local timezone",+ "filter.clear": "Clear",+// Action buttons"btn.addEvent": "Add event","btn.copyLink": "Copy link",diff --git a/locales/it.js b/locales/it.jsindex 896b075..453efe8 100644--- a/locales/it.js+++ b/locales/it.js@@ -13,6 +13,51 @@ export default {'view.year': 'Anno','view.agenda': 'Agenda','view.timeline': 'Timeline',++ // Command palette+ 'command.openPaletteAria': 'Apri palette comandi',+ 'command.shortcutHint': 'Ctrl/Cmd+K',+ 'command.paletteTitle': 'Palette comandi',+ 'command.searchPlaceholder': 'Cerca comandi ed eventi',+ 'command.searchAriaLabel': 'Cerca comandi ed eventi',+ 'command.noResults': 'Nessun risultato',+ 'command.groupViews': 'Vista',+ 'command.groupTools': 'Strumento',+ 'command.groupActions': 'Azione',+ 'command.actionAddEvent': 'Aggiungi evento',+ 'command.actionViewDay': 'Passa alla vista Giorno',+ 'command.actionViewWeek': 'Passa alla vista Settimana',+ 'command.actionViewMonth': 'Passa alla vista Mese',+ 'command.actionViewYear': 'Passa alla vista Anno',+ 'command.actionViewAgenda': 'Passa alla vista Agenda',+ 'command.actionViewTimeline': 'Passa alla vista Timeline',+ 'command.actionWorldPlanner': 'Apri Pianificatore Mondiale',+ 'command.actionTimezone': 'Aggiungi fuso orario',+ 'command.actionEnterFocus': 'Entra in Focus',+ 'command.actionExitFocus': 'Esci da Focus',+ 'command.actionCopyLink': 'Copia link condivisibile',+ 'command.actionShareQr': 'Apri condivisione QR',+ 'command.actionOpenJson': 'Apri vista JSON',++ // Event filters+ 'filter.searchLabel': 'Cerca eventi',+ 'filter.searchPlaceholder': 'Cerca titolo',+ 'filter.searchAriaLabel': 'Cerca eventi per titolo',+ 'filter.fromLabel': 'Da',+ 'filter.fromAriaLabel': 'Filtra eventi dalla data',+ 'filter.toLabel': 'A',+ 'filter.toAriaLabel': 'Filtra eventi fino alla data',+ 'filter.recurrenceLabel': 'Ricorrenza',+ 'filter.recurrenceAriaLabel': 'Filtra ricorrenza',+ 'filter.anyRecurrence': 'Qualsiasi',+ 'filter.colorLabel': 'Colore',+ 'filter.colorAriaLabel': 'Filtra colore',+ 'filter.anyColor': 'Qualsiasi colore',+ 'filter.colorOption': 'Colore {{index}} ({{color}})',+ 'filter.timezoneLabel': 'Fuso orario',+ 'filter.timezoneAriaLabel': 'Contesto fuso orario per filtro data',+ 'filter.localTimezone': 'Fuso orario locale',+ 'filter.clear': 'Pulisci',// Action buttons'btn.addEvent': 'Aggiungi evento',diff --git a/locales/si.js b/locales/si.jsindex e8cf213..a406091 100644--- a/locales/si.js+++ b/locales/si.js@@ -15,6 +15,51 @@ export default {"view.timeline": "Timeline",+ // Command palette+ "command.openPaletteAria": "Open command palette",+ "command.shortcutHint": "Ctrl/Cmd+K",+ "command.paletteTitle": "Command palette",+ "command.searchPlaceholder": "Search commands and events",+ "command.searchAriaLabel": "Search commands and events",+ "command.noResults": "No matches",+ "command.groupViews": "View",+ "command.groupTools": "Tool",+ "command.groupActions": "Action",+ "command.actionAddEvent": "Add event",+ "command.actionViewDay": "Switch to Day view",+ "command.actionViewWeek": "Switch to Week view",+ "command.actionViewMonth": "Switch to Month view",+ "command.actionViewYear": "Switch to Year view",+ "command.actionViewAgenda": "Switch to Agenda view",+ "command.actionViewTimeline": "Switch to Timeline view",+ "command.actionWorldPlanner": "Open World Planner",+ "command.actionTimezone": "Add timezone",+ "command.actionEnterFocus": "Enter Focus mode",+ "command.actionExitFocus": "Exit Focus mode",+ "command.actionCopyLink": "Copy share link",+ "command.actionShareQr": "Open QR sharing",+ "command.actionOpenJson": "Open JSON view",++ // Event filters+ "filter.searchLabel": "Search events",+ "filter.searchPlaceholder": "Search title",+ "filter.searchAriaLabel": "Search events by title",+ "filter.fromLabel": "From",+ "filter.fromAriaLabel": "Filter events from date",+ "filter.toLabel": "To",+ "filter.toAriaLabel": "Filter events to date",+ "filter.recurrenceLabel": "Recurrence",+ "filter.recurrenceAriaLabel": "Filter recurrence",+ "filter.anyRecurrence": "Any",+ "filter.colorLabel": "Color",+ "filter.colorAriaLabel": "Filter color",+ "filter.anyColor": "Any color",+ "filter.colorOption": "Color {{index}} ({{color}})",+ "filter.timezoneLabel": "Timezone",+ "filter.timezoneAriaLabel": "Timezone context for date filter",+ "filter.localTimezone": "Local timezone",+ "filter.clear": "Clear",+// Action buttons"btn.addEvent": "සිදුවීම එක් කරන්න","btn.copyLink": "සබැඳිය පිටපත් කරන්න",diff --git a/locales/ta.js b/locales/ta.jsindex a328c4e..d77c5eb 100644--- a/locales/ta.js+++ b/locales/ta.js@@ -15,6 +15,51 @@ export default {'view.timeline': 'Timeline',+ // Command palette+ 'command.openPaletteAria': 'Open command palette',+ 'command.shortcutHint': 'Ctrl/Cmd+K',+ 'command.paletteTitle': 'Command palette',+ 'command.searchPlaceholder': 'Search commands and events',+ 'command.searchAriaLabel': 'Search commands and events',+ 'command.noResults': 'No matches',+ 'command.groupViews': 'View',+ 'command.groupTools': 'Tool',+ 'command.groupActions': 'Action',+ 'command.actionAddEvent': 'Add event',+ 'command.actionViewDay': 'Switch to Day view',+ 'command.actionViewWeek': 'Switch to Week view',+ 'command.actionViewMonth': 'Switch to Month view',+ 'command.actionViewYear': 'Switch to Year view',+ 'command.actionViewAgenda': 'Switch to Agenda view',+ 'command.actionViewTimeline': 'Switch to Timeline view',+ 'command.actionWorldPlanner': 'Open World Planner',+ 'command.actionTimezone': 'Add timezone',+ 'command.actionEnterFocus': 'Enter Focus mode',+ 'command.actionExitFocus': 'Exit Focus mode',+ 'command.actionCopyLink': 'Copy share link',+ 'command.actionShareQr': 'Open QR sharing',+ 'command.actionOpenJson': 'Open JSON view',++ // Event filters+ 'filter.searchLabel': 'Search events',+ 'filter.searchPlaceholder': 'Search title',+ 'filter.searchAriaLabel': 'Search events by title',+ 'filter.fromLabel': 'From',+ 'filter.fromAriaLabel': 'Filter events from date',+ 'filter.toLabel': 'To',+ 'filter.toAriaLabel': 'Filter events to date',+ 'filter.recurrenceLabel': 'Recurrence',+ 'filter.recurrenceAriaLabel': 'Filter recurrence',+ 'filter.anyRecurrence': 'Any',+ 'filter.colorLabel': 'Color',+ 'filter.colorAriaLabel': 'Filter color',+ 'filter.anyColor': 'Any color',+ 'filter.colorOption': 'Color {{index}} ({{color}})',+ 'filter.timezoneLabel': 'Timezone',+ 'filter.timezoneAriaLabel': 'Timezone context for date filter',+ 'filter.localTimezone': 'Local timezone',+ 'filter.clear': 'Clear',+// Action buttons'btn.addEvent': 'நிகழ்வைச் சேர்','btn.copyLink': 'இணைப்பை நகலெடு',diff --git a/modules/agendaRender.js b/modules/agendaRender.jsindex 3e0ee7e..18b1415 100644--- a/modules/agendaRender.js+++ b/modules/agendaRender.js@@ -43,16 +43,31 @@ function decorateOccurrences(occurrences, colors) {});}-function buildAgendaData({ events, colors, rangeMonths }) {+function buildAgendaData({ events, colors, rangeMonths, occurrences }) {const rangeStart = startOfDay(new Date());const rangeEnd = endOfDay(addMonths(rangeStart, rangeMonths));-- const expanded = expandEvents(events || [], rangeStart, rangeEnd);- const occurrences = decorateOccurrences(expanded, colors);- occurrences.sort((a, b) => a.start - b.start);+ const rangeStartMs = rangeStart.getTime();+ const rangeEndMs = rangeEnd.getTime();++ const expanded = Array.isArray(occurrences)+ ? occurrences+ .filter((occ) => occ && Number.isFinite(occ.start))+ .map((occ) => {+ const end = Number.isFinite(occ.end) ? occ.end : occ.start;+ return { ...occ, end };+ })+ : expandEvents(events || [], rangeStart, rangeEnd);++ const filteredByRange = expanded.filter((occ) => {+ const start = Number(occ.start);+ const end = Number.isFinite(occ.end) ? Number(occ.end) : start;+ return start <= rangeEndMs && end >= rangeStartMs;+ });+ const decoratedOccurrences = decorateOccurrences(filteredByRange, colors);+ decoratedOccurrences.sort((a, b) => a.start - b.start);const occurrencesByDay = new Map();- occurrences.forEach((occ) => {+ decoratedOccurrences.forEach((occ) => {const start = new Date(occ.start);const end = new Date(occ.end);const current = new Date(start.getFullYear(), start.getMonth(), start.getDate());@@ -68,11 +83,11 @@ function buildAgendaData({ events, colors, rangeMonths }) {}});- return { occurrences, occurrencesByDay, range: { start: rangeStart, end: rangeEnd } };+ return { occurrences: decoratedOccurrences, occurrencesByDay, range: { start: rangeStart, end: rangeEnd } };}-export function renderAgendaView({ events, colors, container, rangeMonths = 6, onEventClick } = {}) {- const data = buildAgendaData({ events, colors, rangeMonths });+export function renderAgendaView({ events, colors, container, rangeMonths = 6, onEventClick, occurrences } = {}) {+ const data = buildAgendaData({ events, colors, rangeMonths, occurrences });if (!container) return data;container.innerHTML = "";diff --git a/modules/cacheElements.js b/modules/cacheElements.jsindex 812e5a2..abdf4cc 100644--- a/modules/cacheElements.js+++ b/modules/cacheElements.js@@ -37,6 +37,15 @@ export function cacheElements(ui) {ui.timelineMinimapToday = document.getElementById("timeline-minimap-today");ui.timelineMinimapSelected = document.getElementById("timeline-minimap-selected");ui.timelineMinimapViewport = document.getElementById("timeline-minimap-viewport");+ ui.commandPaletteBtn = document.getElementById("command-palette-btn");+ ui.filterBar = document.getElementById("event-filter-bar");+ ui.filterQueryInput = document.getElementById("event-filter-query");+ ui.filterStartDate = document.getElementById("event-filter-start");+ ui.filterEndDate = document.getElementById("event-filter-end");+ ui.filterRecurrence = document.getElementById("event-filter-recurrence");+ ui.filterColor = document.getElementById("event-filter-color");+ ui.filterTimezone = document.getElementById("event-filter-timezone");+ ui.filterClear = document.getElementById("event-filter-clear");ui.selectedDateLabel = document.getElementById("selected-date-label");ui.eventList = document.getElementById("event-list");ui.addEventInline = document.getElementById("add-event-inline");@@ -90,6 +99,11 @@ export function cacheElements(ui) {ui.templateClose = document.getElementById("template-close");ui.templateCancel = document.getElementById("template-cancel");ui.templateLinks = document.getElementById("template-links");+ ui.commandPaletteModal = document.getElementById("command-palette-modal");+ ui.commandPaletteInput = document.getElementById("command-palette-input");+ ui.commandPaletteClose = document.getElementById("command-palette-close");+ ui.commandPaletteResults = document.getElementById("command-palette-results");+ ui.commandPaletteEmpty = document.getElementById("command-palette-empty");ui.toastContainer = document.getElementById("toast-container");diff --git a/script.js b/script.jsindex fef8bc9..e7be17d 100644--- a/script.js+++ b/script.js@@ -71,6 +71,18 @@ let timelineNeedsCenter = false;let timelinePendingAnchorDate = null;let timelineMinimapSession = null;const notifiedOccurrences = new Map();+const eventFilters = {+ query: "",+ startDate: "",+ endDate: "",+ recurrence: "",+ colorIndex: "",+ timezone: "",+};+let commandPaletteResults = [];+let commandPaletteActiveIndex = 0;+const COMMAND_PALETTE_MAX_RESULTS = 18;+const zoneDateFormatters = new Map();const ui = {};const MS_PER_DAY = 24 * 60 * MS_PER_MINUTE;@@ -155,6 +167,16 @@ function addDays(date, days) {return next;}+function addMonths(date, months) {+ const next = new Date(date.getTime());+ const day = next.getDate();+ next.setMonth(next.getMonth() + months);+ if (next.getDate() < day) {+ next.setDate(0);+ }+ return next;+}+function endOfDay(date) {return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59, 999);}@@ -194,10 +216,247 @@ function setCalendarHeaderLabel(text) {}function formatTime(date) {- // Use Intl for time as it is usually reliable (numbers/colons) or we can just stick to it.- // Actually, let's stick to locale sensitive time, it usually works fine (HH:mm).- return date.toLocaleTimeString(getCurrentLocale(), { hour: "2-digit", minute: "2-digit" });-}+ // Use Intl for time as it is usually reliable (numbers/colons) or we can just stick to it.+ // Actually, let's stick to locale sensitive time, it usually works fine (HH:mm).+ return date.toLocaleTimeString(getCurrentLocale(), { hour: "2-digit", minute: "2-digit" });+}++function normalizeDateInput(value) {+ return /^\d{4}-\d{2}-\d{2}$/.test(String(value || "")) ? String(value) : "";+}++function normalizeSearchText(value) {+ return String(value || "").trim().toLowerCase();+}++function getDateFormatterForZone(zone) {+ const cacheKey = String(zone || "");+ if (zoneDateFormatters.has(cacheKey)) {+ return zoneDateFormatters.get(cacheKey);+ }+ const formatter = new Intl.DateTimeFormat("en-CA", {+ timeZone: zone,+ year: "numeric",+ month: "2-digit",+ day: "2-digit",+ });+ zoneDateFormatters.set(cacheKey, formatter);+ return formatter;+}++function getDateKeyInZone(timestamp, zone) {+ const date = new Date(timestamp);+ if (!zone) return formatDateKey(date);+ try {+ const formatter = getDateFormatterForZone(zone);+ const parts = formatter.formatToParts(date);+ const year = parts.find((part) => part.type === "year")?.value;+ const month = parts.find((part) => part.type === "month")?.value;+ const day = parts.find((part) => part.type === "day")?.value;+ if (year && month && day) {+ return `${year}-${month}-${day}`;+ }+ } catch (_error) {+ // Ignore invalid timezone inputs and fall back to local date formatting.+ }+ return formatDateKey(date);+}++function getActiveEventFilters() {+ const query = normalizeSearchText(eventFilters.query);+ const recurrence = ["", "none", "d", "w", "m", "y"].includes(eventFilters.recurrence) ? eventFilters.recurrence : "";+ const startDateRaw = normalizeDateInput(eventFilters.startDate);+ const endDateRaw = normalizeDateInput(eventFilters.endDate);+ let startDate = startDateRaw;+ let endDate = endDateRaw;+ if (startDate && endDate && endDate < startDate) {+ startDate = endDateRaw;+ endDate = startDateRaw;+ }+ const parsedColor = Number(eventFilters.colorIndex);+ const colorIndex = Number.isInteger(parsedColor) && parsedColor >= 0 ? parsedColor : null;+ const timezone = eventFilters.timezone && isValidZone(eventFilters.timezone) ? eventFilters.timezone : "";+ return { query, recurrence, startDate, endDate, colorIndex, timezone };+}++function hasActiveEventFilters(filters = getActiveEventFilters()) {+ return !!(filters.query || filters.startDate || filters.endDate || filters.recurrence || Number.isInteger(filters.colorIndex) || filters.timezone);+}++function matchesOccurrenceFilters(occurrence, filters) {+ if (!occurrence || !Number.isFinite(occurrence.start)) return false;++ if (filters.query && !String(occurrence.title || "").toLowerCase().includes(filters.query)) {+ return false;+ }++ if (filters.recurrence === "none" && occurrence.rule) {+ return false;+ }+ if (filters.recurrence && filters.recurrence !== "none" && occurrence.rule !== filters.recurrence) {+ return false;+ }++ if (Number.isInteger(filters.colorIndex) && Number(occurrence.colorIndex) !== filters.colorIndex) {+ return false;+ }++ if (filters.startDate || filters.endDate) {+ const dateKey = getDateKeyInZone(occurrence.start, filters.timezone);+ if (filters.startDate && dateKey < filters.startDate) return false;+ if (filters.endDate && dateKey > filters.endDate) return false;+ }++ return true;+}++function filterOccurrences(occurrences) {+ const filters = getActiveEventFilters();+ if (!hasActiveEventFilters(filters)) {+ return Array.isArray(occurrences) ? occurrences.slice() : [];+ }+ return (Array.isArray(occurrences) ? occurrences : []).filter((occurrence) => matchesOccurrenceFilters(occurrence, filters));+}++function formatFilterColorOption(index, color) {+ return t("filter.colorOption", {+ index: String(index + 1),+ color,+ });+}++function syncFilterColorOptions() {+ if (!ui.filterColor) return;+ const previous = String(eventFilters.colorIndex || "");+ ui.filterColor.innerHTML = "";++ const allOption = document.createElement("option");+ allOption.value = "";+ allOption.textContent = t("filter.anyColor");+ ui.filterColor.appendChild(allOption);++ state.c.forEach((color, index) => {+ const option = document.createElement("option");+ option.value = String(index);+ option.textContent = formatFilterColorOption(index, color);+ ui.filterColor.appendChild(option);+ });++ const canRestore = previous && state.c[Number(previous)];+ ui.filterColor.value = canRestore ? previous : "";+ if (!canRestore) eventFilters.colorIndex = "";+}++function buildFilterTimezoneOptions() {+ const options = [];+ const seen = new Set();+ const include = (zone) => {+ if (typeof zone !== "string") return;+ const trimmed = zone.trim();+ if (!trimmed || seen.has(trimmed) || !isValidZone(trimmed)) return;+ seen.add(trimmed);+ options.push(trimmed);+ };++ include(getLocalZone());+ include("UTC");+ if (state && state.mp && Array.isArray(state.mp.z)) {+ state.mp.z.forEach(include);+ }+ include(eventFilters.timezone);+ return options;+}++function syncFilterTimezoneOptions() {+ if (!ui.filterTimezone) return;+ const previous = eventFilters.timezone || "";+ const options = buildFilterTimezoneOptions();+ ui.filterTimezone.innerHTML = "";++ const localOption = document.createElement("option");+ localOption.value = "";+ localOption.textContent = t("filter.localTimezone");+ ui.filterTimezone.appendChild(localOption);++ options.forEach((zone) => {+ const option = document.createElement("option");+ option.value = zone;+ option.textContent = zone;+ ui.filterTimezone.appendChild(option);+ });++ const canRestore = previous && options.includes(previous);+ ui.filterTimezone.value = canRestore ? previous : "";+ if (!canRestore) eventFilters.timezone = "";+}++function syncEventFilterControls() {+ syncFilterColorOptions();+ syncFilterTimezoneOptions();++ if (ui.filterQueryInput && document.activeElement !== ui.filterQueryInput) {+ ui.filterQueryInput.value = eventFilters.query;+ }+ if (ui.filterStartDate) ui.filterStartDate.value = normalizeDateInput(eventFilters.startDate);+ if (ui.filterEndDate) ui.filterEndDate.value = normalizeDateInput(eventFilters.endDate);+ if (ui.filterRecurrence) ui.filterRecurrence.value = eventFilters.recurrence || "";++ if (ui.filterBar) {+ ui.filterBar.classList.toggle(CSS_CLASSES.ACTIVE, hasActiveEventFilters());+ }+}++function readEventFiltersFromControls() {+ if (ui.filterQueryInput) {+ eventFilters.query = ui.filterQueryInput.value;+ }+ if (ui.filterStartDate) {+ eventFilters.startDate = normalizeDateInput(ui.filterStartDate.value);+ }+ if (ui.filterEndDate) {+ eventFilters.endDate = normalizeDateInput(ui.filterEndDate.value);+ }+ if (ui.filterRecurrence) {+ eventFilters.recurrence = ui.filterRecurrence.value || "";+ }+ if (ui.filterColor) {+ eventFilters.colorIndex = ui.filterColor.value || "";+ }+ if (ui.filterTimezone) {+ eventFilters.timezone = ui.filterTimezone.value || "";+ }++ if (eventFilters.startDate && eventFilters.endDate && eventFilters.endDate < eventFilters.startDate) {+ const nextStart = eventFilters.endDate;+ eventFilters.endDate = eventFilters.startDate;+ eventFilters.startDate = nextStart;+ if (ui.filterStartDate) ui.filterStartDate.value = eventFilters.startDate;+ if (ui.filterEndDate) ui.filterEndDate.value = eventFilters.endDate;+ }+}++function handleEventFilterInput() {+ readEventFiltersFromControls();+ render();+}++function clearEventFilters() {+ eventFilters.query = "";+ eventFilters.startDate = "";+ eventFilters.endDate = "";+ eventFilters.recurrence = "";+ eventFilters.colorIndex = "";+ eventFilters.timezone = "";++ if (ui.filterQueryInput) ui.filterQueryInput.value = "";+ if (ui.filterStartDate) ui.filterStartDate.value = "";+ if (ui.filterEndDate) ui.filterEndDate.value = "";+ if (ui.filterRecurrence) ui.filterRecurrence.value = "";+ if (ui.filterColor) ui.filterColor.value = "";+ if (ui.filterTimezone) ui.filterTimezone.value = "";++ render();+}function getStoredView(view) {return VALID_VIEWS.has(view) ? view : DEFAULT_VIEW;@@ -1525,8 +1784,9 @@ function render() {if (ui.titleInput && document.activeElement !== ui.titleInput) {ui.titleInput.value = state.t;}-- const weekStartsOnMonday = state.s.m === 1;+ syncEventFilterControls();++ const weekStartsOnMonday = state.s.m === 1;if (ui.calendarGrid) {ui.calendarGrid.className = `calendar-grid ${currentView}-view`;ui.calendarGrid.style.gridTemplateColumns = "";@@ -1542,11 +1802,11 @@ function render() {ui.weekdayRow.classList.toggle(CSS_CLASSES.HIDDEN, currentView === "year" || currentView === "agenda" || currentView === "timeline");}- if (currentView === "month") {- const range = getMonthGridRange(viewDate, weekStartsOnMonday);- const expanded = expandEvents(state.e, range.start, range.end);- const decorated = decorateOccurrences(expanded);- occurrencesByDay = groupOccurrences(decorated);+ if (currentView === "month") {+ const range = getMonthGridRange(viewDate, weekStartsOnMonday);+ const expanded = filterOccurrences(expandEvents(state.e, range.start, range.end));+ const decorated = decorateOccurrences(expanded);+ occurrencesByDay = groupOccurrences(decorated);setCalendarHeaderLabel(formatMonthLabel(viewDate));if (ui.weekdayRow) renderWeekdayHeaders(ui.weekdayRow, weekStartsOnMonday, "month");@@ -1562,11 +1822,11 @@ function render() {onEventClick: (event) => openEventModal({ index: event.sourceIndex }),});}- } else if (currentView === "week") {- const range = getWeekRange(selectedDate, weekStartsOnMonday);- const expanded = expandEvents(state.e, range.start, range.end);- const decorated = decorateOccurrences(expanded);- occurrencesByDay = groupOccurrences(decorated);+ } else if (currentView === "week") {+ const range = getWeekRange(selectedDate, weekStartsOnMonday);+ const expanded = filterOccurrences(expandEvents(state.e, range.start, range.end));+ const decorated = decorateOccurrences(expanded);+ occurrencesByDay = groupOccurrences(decorated);setCalendarHeaderLabel(formatRangeLabel(range.start, range.end));if (ui.weekdayRow) renderWeekdayHeaders(ui.weekdayRow, weekStartsOnMonday, "week", range.dates);@@ -1579,12 +1839,12 @@ function render() {onEventClick: (event) => openEventModal({ index: event.sourceIndex }),});}- } else if (currentView === "day") {- const start = startOfDay(selectedDate);- const end = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 23, 59, 59);- const expanded = expandEvents(state.e, start, end);- const decorated = decorateOccurrences(expanded);- occurrencesByDay = groupOccurrences(decorated);+ } else if (currentView === "day") {+ const start = startOfDay(selectedDate);+ const end = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 23, 59, 59);+ const expanded = filterOccurrences(expandEvents(state.e, start, end));+ const decorated = decorateOccurrences(expanded);+ occurrencesByDay = groupOccurrences(decorated);setCalendarHeaderLabel(formatDateLabel(selectedDate));if (ui.weekdayRow) renderWeekdayHeaders(ui.weekdayRow, weekStartsOnMonday, "day", [start]);@@ -1597,21 +1857,25 @@ function render() {onEventClick: (event) => openEventModal({ index: event.sourceIndex }),});}- } else if (currentView === "agenda") {- const agendaData = renderAgendaView({- events: state.e,- colors: state.c,- container: ui.calendarGrid,- rangeMonths: 6,- onEventClick: (event) => openEventModal({ index: event.sourceIndex }),- });+ } else if (currentView === "agenda") {+ const agendaStart = startOfDay(new Date());+ const agendaEnd = endOfDay(addMonths(agendaStart, 6));+ const filteredAgendaOccurrences = filterOccurrences(expandEvents(state.e, agendaStart, agendaEnd));+ const agendaData = renderAgendaView({+ events: state.e,+ colors: state.c,+ container: ui.calendarGrid,+ rangeMonths: 6,+ occurrences: filteredAgendaOccurrences,+ onEventClick: (event) => openEventModal({ index: event.sourceIndex }),+ });occurrencesByDay = agendaData && agendaData.occurrencesByDay ? agendaData.occurrencesByDay : new Map();if (agendaData && agendaData.range) {setCalendarHeaderLabel(t("agenda.title") + " - " + formatRangeLabel(agendaData.range.start, agendaData.range.end));}} else if (currentView === "timeline") {const range = getTimelineRange();- const expanded = expandEvents(state.e, range.start, range.end);+ const expanded = filterOccurrences(expandEvents(state.e, range.start, range.end));const decorated = decorateOccurrences(expanded);occurrencesByDay = groupOccurrences(decorated);@@ -1655,12 +1919,12 @@ function render() {}}} else if (currentView === "year") {- const year = viewDate.getFullYear();- const start = new Date(year, 0, 1);- const end = new Date(year, 11, 31, 23, 59, 59);- const expanded = expandEvents(state.e, start, end);- const decorated = decorateOccurrences(expanded);- occurrencesByDay = groupOccurrences(decorated);+ const year = viewDate.getFullYear();+ const start = new Date(year, 0, 1);+ const end = new Date(year, 11, 31, 23, 59, 59);+ const expanded = filterOccurrences(expandEvents(state.e, start, end));+ const decorated = decorateOccurrences(expanded);+ occurrencesByDay = groupOccurrences(decorated);setCalendarHeaderLabel(String(year));if (ui.calendarGrid) {@@ -1689,9 +1953,12 @@ function render() {if (ui.jsonModal && !ui.jsonModal.classList.contains(CSS_CLASSES.HIDDEN)) {updateJsonModal();}- updateLockUI();- initCountdownWidget(state.e);-}+ updateLockUI();+ initCountdownWidget(state.e);+ if (isOpenModalElement(ui.commandPaletteModal)) {+ renderCommandPaletteResults();+ }+}function renderEventList() {const key = formatDateKey(selectedDate);@@ -2194,6 +2461,375 @@ function closeTemplateModal() {templateGalleryController.closeModal();}+function formatRecurrenceLabel(rule) {+ if (rule === "d") return t("recurrence.daily");+ if (rule === "w") return t("recurrence.weekly");+ if (rule === "m") return t("recurrence.monthly");+ if (rule === "y") return t("recurrence.yearly");+ return t("recurrence.none");+}++function formatCommandPaletteEventMeta(item) {+ const dateLabel = item.startDate.toLocaleDateString(getCurrentLocale(), {+ weekday: "short",+ month: "short",+ day: "numeric",+ });+ const details = [dateLabel];+ if (item.isAllDay) {+ details.push(t("calendar.allDay"));+ } else {+ details.push(formatTime(item.startDate));+ }+ details.push(formatRecurrenceLabel(item.rule));+ return details.join(" · ");+}++function buildCommandPaletteCommands() {+ const focusActionLabel = focusMode && focusMode.isActive() ? t("command.actionExitFocus") : t("command.actionEnterFocus");+ return [+ {+ id: "add-event",+ type: "command",+ title: t("command.actionAddEvent"),+ meta: t("command.groupActions"),+ keywords: "new create add event",+ run: () => {+ closeCommandPalette();+ openEventModal({ date: selectedDate });+ },+ },+ {+ id: "view-day",+ type: "command",+ title: t("command.actionViewDay"),+ meta: t("command.groupViews"),+ keywords: "view day",+ run: () => {+ closeCommandPalette();+ setView("day");+ },+ },+ {+ id: "view-week",+ type: "command",+ title: t("command.actionViewWeek"),+ meta: t("command.groupViews"),+ keywords: "view week",+ run: () => {+ closeCommandPalette();+ setView("week");+ },+ },+ {+ id: "view-month",+ type: "command",+ title: t("command.actionViewMonth"),+ meta: t("command.groupViews"),+ keywords: "view month",+ run: () => {+ closeCommandPalette();+ setView("month");+ },+ },+ {+ id: "view-year",+ type: "command",+ title: t("command.actionViewYear"),+ meta: t("command.groupViews"),+ keywords: "view year",+ run: () => {+ closeCommandPalette();+ setView("year");+ },+ },+ {+ id: "view-agenda",+ type: "command",+ title: t("command.actionViewAgenda"),+ meta: t("command.groupViews"),+ keywords: "view agenda",+ run: () => {+ closeCommandPalette();+ setView("agenda");+ },+ },+ {+ id: "view-timeline",+ type: "command",+ title: t("command.actionViewTimeline"),+ meta: t("command.groupViews"),+ keywords: "view timeline",+ run: () => {+ closeCommandPalette();+ setView("timeline");+ },+ },+ {+ id: "open-world-planner",+ type: "command",+ title: t("command.actionWorldPlanner"),+ meta: t("command.groupTools"),+ keywords: "world planner timezone compare",+ run: () => {+ closeCommandPalette();+ if (worldPlanner) worldPlanner.open();+ },+ },+ {+ id: "open-timezone",+ type: "command",+ title: t("command.actionTimezone"),+ meta: t("command.groupTools"),+ keywords: "timezone clock add",+ run: () => {+ closeCommandPalette();+ openTzModal();+ },+ },+ {+ id: "focus-mode",+ type: "command",+ title: focusActionLabel,+ meta: t("command.groupTools"),+ keywords: "focus timer",+ run: () => {+ closeCommandPalette();+ handleFocusToggle();+ },+ },+ {+ id: "copy-link",+ type: "command",+ title: t("command.actionCopyLink"),+ meta: t("command.groupActions"),+ keywords: "copy link share",+ run: () => {+ closeCommandPalette();+ void handleCopyLink();+ },+ },+ {+ id: "share-qr",+ type: "command",+ title: t("command.actionShareQr"),+ meta: t("command.groupActions"),+ keywords: "qr share mobile",+ run: () => {+ closeCommandPalette();+ handleShareQr();+ },+ },+ {+ id: "open-json",+ type: "command",+ title: t("command.actionOpenJson"),+ meta: t("command.groupTools"),+ keywords: "json hash export",+ run: () => {+ closeCommandPalette();+ openJsonModal();+ },+ },+ ];+}++function buildCommandPaletteEventResults(query) {+ const nowMs = Date.now();+ const normalizedQuery = normalizeSearchText(query);++ const events = (state.e || [])+ .map((entry, index) => {+ if (!Array.isArray(entry)) return null;+ const startMin = Number(entry[0]);+ if (!Number.isFinite(startMin)) return null;+ const startMs = startMin * MS_PER_MINUTE;+ const title = String(entry[2] || "Untitled");+ return {+ index,+ title,+ titleNormalized: title.toLowerCase(),+ startMs,+ startDate: new Date(startMs),+ isAllDay: Number(entry[1]) === 0,+ rule: entry[4] || "",+ };+ })+ .filter(Boolean)+ .filter((item) => !normalizedQuery || item.titleNormalized.includes(normalizedQuery))+ .sort((a, b) => {+ const aPast = a.startMs < nowMs;+ const bPast = b.startMs < nowMs;+ if (aPast !== bPast) return aPast ? 1 : -1;+ return a.startMs - b.startMs;+ });++ const limit = normalizedQuery ? COMMAND_PALETTE_MAX_RESULTS : 7;+ return events.slice(0, limit).map((item) => ({+ id: `event-${item.index}`,+ type: "event",+ title: item.title,+ meta: formatCommandPaletteEventMeta(item),+ run: () => {+ closeCommandPalette();+ const nextDate = startOfDay(item.startDate);+ selectedDate = nextDate;+ viewDate = nextDate;+ if (currentView === "timeline") timelineNeedsCenter = true;+ render();+ if (ensureEditable({ silent: true })) {+ openEventModal({ index: item.index });+ }+ },+ }));+}++function buildCommandPaletteResults(query) {+ const normalizedQuery = normalizeSearchText(query);+ const commands = buildCommandPaletteCommands().filter((command) => {+ if (!normalizedQuery) return true;+ const haystack = `${command.title} ${command.keywords || ""}`.toLowerCase();+ return haystack.includes(normalizedQuery);+ });+ const events = buildCommandPaletteEventResults(normalizedQuery);+ const combined = [...commands, ...events];+ return combined.slice(0, COMMAND_PALETTE_MAX_RESULTS);+}++function updateCommandPaletteActiveState() {+ if (!ui.commandPaletteResults) return;+ const buttons = ui.commandPaletteResults.querySelectorAll(".command-palette-item");+ buttons.forEach((button, index) => {+ const isActive = index === commandPaletteActiveIndex;+ button.classList.toggle(CSS_CLASSES.ACTIVE, isActive);+ button.setAttribute("aria-selected", isActive ? "true" : "false");+ });+ const activeButton = buttons[commandPaletteActiveIndex];+ if (activeButton) activeButton.scrollIntoView({ block: "nearest" });+}++function setCommandPaletteActiveIndex(nextIndex) {+ if (!commandPaletteResults.length) return;+ const max = commandPaletteResults.length - 1;+ commandPaletteActiveIndex = clamp(nextIndex, 0, max);+ updateCommandPaletteActiveState();+}++function runCommandPaletteResult(index) {+ const result = commandPaletteResults[index];+ if (!result || typeof result.run !== "function") return;+ result.run();+}++function renderCommandPaletteResults() {+ if (!ui.commandPaletteResults || !ui.commandPaletteInput) return;+ commandPaletteResults = buildCommandPaletteResults(ui.commandPaletteInput.value || "");+ if (!commandPaletteResults.length) {+ commandPaletteActiveIndex = 0;+ } else {+ commandPaletteActiveIndex = clamp(commandPaletteActiveIndex, 0, commandPaletteResults.length - 1);+ }++ ui.commandPaletteResults.innerHTML = "";+ commandPaletteResults.forEach((result, index) => {+ const item = document.createElement("li");+ item.className = "command-palette-row";++ const button = document.createElement("button");+ button.type = "button";+ button.className = "command-palette-item";+ button.dataset.index = String(index);+ button.setAttribute("role", "option");+ button.classList.toggle(CSS_CLASSES.ACTIVE, index === commandPaletteActiveIndex);+ button.setAttribute("aria-selected", index === commandPaletteActiveIndex ? "true" : "false");++ const title = document.createElement("span");+ title.className = "command-palette-item-title";+ title.textContent = result.title;++ const meta = document.createElement("span");+ meta.className = "command-palette-item-meta";+ meta.textContent = result.meta;++ button.appendChild(title);+ button.appendChild(meta);+ item.appendChild(button);+ ui.commandPaletteResults.appendChild(item);+ });++ if (ui.commandPaletteEmpty) {+ ui.commandPaletteEmpty.classList.toggle(CSS_CLASSES.HIDDEN, commandPaletteResults.length > 0);+ }+}++function openCommandPalette({ query = "" } = {}) {+ if (!ui.commandPaletteModal || !ui.commandPaletteInput) return;+ ui.commandPaletteModal.classList.remove(CSS_CLASSES.HIDDEN);+ commandPaletteActiveIndex = 0;+ ui.commandPaletteInput.value = String(query || "");+ renderCommandPaletteResults();+ ui.commandPaletteInput.focus();+ ui.commandPaletteInput.select();+}++function closeCommandPalette() {+ if (!ui.commandPaletteModal) return;+ ui.commandPaletteModal.classList.add(CSS_CLASSES.HIDDEN);+ commandPaletteResults = [];+ commandPaletteActiveIndex = 0;+}++function toggleCommandPalette() {+ if (isOpenModalElement(ui.commandPaletteModal)) {+ closeCommandPalette();+ } else {+ openCommandPalette();+ }+}++function handleCommandPaletteInput() {+ commandPaletteActiveIndex = 0;+ renderCommandPaletteResults();+}++function handleCommandPaletteInputKeydown(event) {+ if (event.key === "ArrowDown") {+ event.preventDefault();+ if (!commandPaletteResults.length) return;+ setCommandPaletteActiveIndex(commandPaletteActiveIndex + 1);+ return;+ }+ if (event.key === "ArrowUp") {+ event.preventDefault();+ if (!commandPaletteResults.length) return;+ setCommandPaletteActiveIndex(commandPaletteActiveIndex - 1);+ return;+ }+ if (event.key === "Enter") {+ event.preventDefault();+ if (!commandPaletteResults.length) return;+ runCommandPaletteResult(commandPaletteActiveIndex);+ }+}++function handleCommandPaletteResultsClick(event) {+ const button = event.target.closest(".command-palette-item");+ if (!button) return;+ const index = Number(button.dataset.index);+ if (!Number.isFinite(index)) return;+ commandPaletteActiveIndex = index;+ runCommandPaletteResult(index);+}++function handleCommandPaletteResultsHover(event) {+ const button = event.target.closest(".command-palette-item");+ if (!button) return;+ const index = Number(button.dataset.index);+ if (!Number.isFinite(index)) return;+ commandPaletteActiveIndex = index;+ updateCommandPaletteActiveState();+}+function isOpenModalElement(element) {return !!(element && !element.classList.contains(CSS_CLASSES.HIDDEN));}@@ -2202,12 +2838,29 @@ function isOpenDialogElement(element) {return !!(element && element.hasAttribute("open"));}-function handleGlobalEscape(event) {+function handleGlobalKeydown(event) {+ const isCommandPaletteShortcut =+ (event.ctrlKey || event.metaKey) &&+ !event.shiftKey &&+ String(event.key || "").toLowerCase() === "k";++ if (isCommandPaletteShortcut) {+ event.preventDefault();+ toggleCommandPalette();+ return;+ }+if (event.key !== "Escape") return;// Focus overlay handles its own Escape behavior.if (focusMode && focusMode.isActive()) return;+ if (isOpenModalElement(ui.commandPaletteModal)) {+ event.preventDefault();+ closeCommandPalette();+ return;+ }+if (isOpenModalElement(ui.eventModal)) {event.preventDefault();closeEventModal();@@ -2397,6 +3050,14 @@ function bindEvents() {if (ui.timelineZoomIn) ui.timelineZoomIn.addEventListener("click", () => handleTimelineZoomStep(1));if (ui.timelineZoomRange) ui.timelineZoomRange.addEventListener("input", handleTimelineZoomInput);if (ui.timelineJumpToday) ui.timelineJumpToday.addEventListener("click", handleTimelineJumpToday);+ if (ui.commandPaletteBtn) ui.commandPaletteBtn.addEventListener("click", toggleCommandPalette);+ if (ui.filterQueryInput) ui.filterQueryInput.addEventListener("input", handleEventFilterInput);+ if (ui.filterStartDate) ui.filterStartDate.addEventListener("change", handleEventFilterInput);+ if (ui.filterEndDate) ui.filterEndDate.addEventListener("change", handleEventFilterInput);+ if (ui.filterRecurrence) ui.filterRecurrence.addEventListener("change", handleEventFilterInput);+ if (ui.filterColor) ui.filterColor.addEventListener("change", handleEventFilterInput);+ if (ui.filterTimezone) ui.filterTimezone.addEventListener("change", handleEventFilterInput);+ if (ui.filterClear) ui.filterClear.addEventListener("click", clearEventFilters);initLanguageDropdown();if (ui.unlockBtn) ui.unlockBtn.addEventListener("click", attemptUnlock);if (ui.viewJson) ui.viewJson.addEventListener("click", openJsonModal);@@ -2429,6 +3090,15 @@ function bindEvents() {if (ui.templateClose) ui.templateClose.addEventListener("click", closeTemplateModal);if (ui.templateCancel) ui.templateCancel.addEventListener("click", closeTemplateModal);if (ui.templateLinks) ui.templateLinks.addEventListener("click", handleTemplateLinkClick);+ if (ui.commandPaletteClose) ui.commandPaletteClose.addEventListener("click", closeCommandPalette);+ if (ui.commandPaletteInput) {+ ui.commandPaletteInput.addEventListener("input", handleCommandPaletteInput);+ ui.commandPaletteInput.addEventListener("keydown", handleCommandPaletteInputKeydown);+ }+ if (ui.commandPaletteResults) {+ ui.commandPaletteResults.addEventListener("click", handleCommandPaletteResultsClick);+ ui.commandPaletteResults.addEventListener("mousemove", handleCommandPaletteResultsHover);+ }if (ui.tzAddBtn) ui.tzAddBtn.addEventListener("click", openTzModal);if (ui.tzClose) ui.tzClose.addEventListener("click", closeTzModal);if (ui.tzSearch) ui.tzSearch.addEventListener("input", handleTzSearch);@@ -2447,10 +3117,17 @@ function bindEvents() {}});}+ if (ui.commandPaletteModal) {+ ui.commandPaletteModal.addEventListener("click", (event) => {+ if (event.target === ui.commandPaletteModal || event.target.classList.contains("modal-backdrop")) {+ closeCommandPalette();+ }+ });+ }window.addEventListener("hashchange", handleHashChange);window.addEventListener("resize", syncTopbarHeight);- document.addEventListener("keydown", handleGlobalEscape);+ document.addEventListener("keydown", handleGlobalKeydown);document.addEventListener("visibilitychange", () => {if (document.hidden) return;updateNotificationToggleLabel();diff --git a/styles.css b/styles.cssindex 71d657f..2691618 100644--- a/styles.css+++ b/styles.css@@ -163,6 +163,18 @@ button {gap: 8px;}+.sr-only {+ position: absolute;+ width: 1px;+ height: 1px;+ padding: 0;+ margin: -1px;+ overflow: hidden;+ clip: rect(0, 0, 0, 0);+ white-space: nowrap;+ border: 0;+}+.app {height: 100vh;display: flex;@@ -894,6 +906,94 @@ button:disabled {flex-wrap: wrap;}+.command-palette-btn {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 8px;+ min-height: 34px;+ padding: 6px 12px;+ border-radius: 999px;+ font-size: 0.78rem;+ letter-spacing: 0.03em;+}++.command-palette-btn > i {+ font-size: 0.8rem;+}++.event-filter-bar {+ display: grid;+ grid-template-columns: minmax(210px, 1.8fr) repeat(5, minmax(112px, 1fr)) auto;+ gap: 10px;+ padding: 12px 20px;+ border-bottom: 1px solid var(--border-soft);+ background: linear-gradient(180deg, color-mix(in srgb, var(--panel), transparent 2%), color-mix(in srgb, var(--panel-2), transparent 16%));+}++.event-filter-bar.active {+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent), transparent 74%);+}++.event-filter-field {+ display: flex;+ flex-direction: column;+ gap: 5px;+ min-width: 0;+}++.event-filter-field > span {+ font-size: 0.67rem;+ font-weight: 600;+ letter-spacing: 0.07em;+ text-transform: uppercase;+ color: var(--muted);+}++.event-filter-field input,+.event-filter-field select {+ width: 100%;+ min-height: 36px;+ padding: 8px 10px;+ border-radius: 9px;+ border: 1px solid var(--border-soft);+ background: var(--panel);+ color: var(--text);+ font-size: 0.82rem;+}++.event-filter-field input:focus,+.event-filter-field select:focus {+ outline: none;+ border-color: var(--accent);+ box-shadow: 0 0 0 2px var(--accent-soft);+}++.event-filter-search {+ position: relative;+ justify-content: flex-end;+}++.event-filter-search > i {+ position: absolute;+ left: 10px;+ bottom: 12px;+ font-size: 0.78rem;+ color: var(--muted);+ pointer-events: none;+}++.event-filter-search > input {+ padding-left: 30px;+}++.event-filter-clear {+ align-self: end;+ min-height: 36px;+ min-width: 72px;+ border-radius: 9px;+}+.timeline-controls {position: absolute;left: 50%;@@ -2102,6 +2202,103 @@ body[data-theme="dark"] .time-indicator-circle {text-align: center;}+.command-palette-card {+ width: min(760px, 95vw);+ max-height: min(72vh, 680px);+}++.command-palette-header {+ gap: 10px;+}++.command-palette-input-wrap {+ flex: 1;+ display: flex;+ align-items: center;+ gap: 10px;+ min-width: 0;+ padding: 6px 10px;+ border-radius: 10px;+ border: 1px solid var(--border-soft);+ background: var(--panel-2);+}++.command-palette-input-wrap > i {+ font-size: 0.82rem;+ color: var(--muted);+}++#command-palette-input {+ width: 100%;+ min-width: 0;+ border: none;+ background: transparent;+ color: var(--text);+ font-size: 0.9rem;+ padding: 4px 0;+}++#command-palette-input:focus {+ outline: none;+}++.command-palette-body {+ padding: 8px 18px 18px;+ display: flex;+ flex-direction: column;+ gap: 8px;+ overflow-y: auto;+}++.command-palette-empty {+ margin: 4px 2px 0;+ font-size: 0.8rem;+ color: var(--muted);+}++.command-palette-results {+ list-style: none;+ margin: 0;+ padding: 0;+ display: flex;+ flex-direction: column;+ gap: 6px;+}++.command-palette-item {+ width: 100%;+ border-radius: 10px;+ border: 1px solid var(--border-soft);+ background: var(--panel-2);+ color: var(--text);+ display: flex;+ align-items: baseline;+ justify-content: space-between;+ gap: 10px;+ padding: 10px 12px;+ text-align: left;+}++.command-palette-item:hover,+.command-palette-item.active {+ border-color: var(--accent);+ background: color-mix(in srgb, var(--accent-soft), transparent 22%);+}++.command-palette-item-title {+ font-size: 0.84rem;+ font-weight: 600;+ min-width: 0;+}++.command-palette-item-meta {+ font-size: 0.73rem;+ color: var(--muted);+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+}+.qr-modal-body {display: flex;flex-direction: column;@@ -2625,6 +2822,11 @@ body[data-theme="dark"] .app-launcher-modal-body,padding: 12px 16px;}+ .event-filter-bar {+ grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(110px, 1fr));+ padding: 10px 16px;+ }+.month-label {font-size: 1.2rem;}@@ -2747,6 +2949,33 @@ body[data-theme="dark"] .app-launcher-modal-body,align-items: flex-start;}+ .command-palette-btn span {+ display: none;+ }++ .event-filter-bar {+ grid-template-columns: repeat(2, minmax(0, 1fr));+ padding: 10px 14px;+ }++ .event-filter-search {+ grid-column: 1 / -1;+ }++ .event-filter-clear {+ grid-column: 1 / -1;+ width: 100%;+ }++ .command-palette-item {+ flex-direction: column;+ align-items: flex-start;+ }++ .command-palette-item-meta {+ white-space: normal;+ }+.field-row {grid-template-columns: 1fr;}diff --git a/tests/e2e/views.e2e.spec.js b/tests/e2e/views.e2e.spec.jsindex 479624d..62f78f2 100644--- a/tests/e2e/views.e2e.spec.js+++ b/tests/e2e/views.e2e.spec.js@@ -1,5 +1,5 @@const { test, expect } = require("@playwright/test");-const { clickSettingsControl, createEvent, selectCalendarView, waitForApp } = require("./helpers.cjs");+const { clickSettingsControl, createEvent, getDateKeyOffset, selectCalendarView, waitForApp } = require("./helpers.cjs");test.beforeEach(async ({ page }) => {await page.goto("/");@@ -86,3 +86,59 @@ test("countdown widget shows next event", async ({ page }) => {await expect(eventTitle).toBeVisible();}});++test("command palette opens with Ctrl+K and can switch view", async ({ page }) => {+ await page.keyboard.press("Control+k");+ await expect(page.locator("#command-palette-modal")).toBeVisible();++ await page.fill("#command-palette-input", "timeline");+ await expect(page.locator("#command-palette-results .command-palette-item").first()).toBeVisible();+ await page.locator("#command-palette-results .command-palette-item").first().click();++ await expect(page.locator("#command-palette-modal")).toBeHidden();+ await expect(page.locator("#calendar-grid")).toHaveClass(/timeline-view/);+});++test("command palette searches events and opens selected event", async ({ page }) => {+ const title = `PaletteEvent-${Date.now()}`;+ await createEvent(page, { title, allDay: true });++ await page.keyboard.press("Control+k");+ await expect(page.locator("#command-palette-modal")).toBeVisible();++ await page.fill("#command-palette-input", title);+ const eventResult = page.locator("#command-palette-results .command-palette-item", { hasText: title }).first();+ await expect(eventResult).toBeVisible();+ await eventResult.click();++ await expect(page.locator("#event-modal")).toBeVisible();+ await expect(page.locator("#event-title")).toHaveValue(title);+ await page.click("#event-cancel");+});++test("event filter bar supports title, recurrence, color, date range, and timezone filters", async ({ page }) => {+ const recurringTitle = `FilterRecurring-${Date.now()}`;++ await createEvent(page, { title: recurringTitle, allDay: true, recurrence: "d" });+ await expect(page.locator("#event-list .event-title", { hasText: recurringTitle })).toBeVisible();++ await page.fill("#event-filter-query", recurringTitle);+ await expect(page.locator("#event-list .event-title", { hasText: recurringTitle })).toBeVisible();++ await page.fill("#event-filter-query", "");+ await page.selectOption("#event-filter-recurrence", "d");+ await expect(page.locator("#event-list .event-title", { hasText: recurringTitle })).toBeVisible();++ await page.selectOption("#event-filter-recurrence", "");+ await page.selectOption("#event-filter-color", "0");+ await expect(page.locator("#event-list .event-title", { hasText: recurringTitle })).toBeVisible();++ await page.click("#event-filter-clear");+ const tomorrowKey = await getDateKeyOffset(page, 1);+ await page.selectOption("#event-filter-timezone", "UTC");+ await page.fill("#event-filter-start", tomorrowKey);+ await page.fill("#event-filter-end", tomorrowKey);++ await page.click(`.day-cell[data-date="${tomorrowKey}"] .day-number`);+ await expect(page.locator("#event-list .event-title", { hasText: recurringTitle })).toBeVisible();+});